summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dee6416)
#include <Elementary.h>
#include <Evas.h>
#include <efl_extension.h>
#include <Elementary.h>
#include <Evas.h>
#include <efl_extension.h>
+#include <string>
+
+using namespace std;
enum {
APP_TYPE_SELECT_MODE = 1,
enum {
APP_TYPE_SELECT_MODE = 1,
struct _InputKeyboardData
{
struct _InputKeyboardData
{
- char *guide_text;
- char *default_text;
- char *return_key_type;
+ string guide_text;
+ string default_text;
+ string return_key_type;
int max_text_length;
int cursor_position_set;
};
int max_text_length;
int cursor_position_set;
};
int ret = -1;
char *default_text = NULL;
char *guide_text = NULL;
int ret = -1;
char *default_text = NULL;
char *guide_text = NULL;
- char *return_key_type = _("IDS_AMEMO_BUTTON_SEND");
+ char *return_key_type = NULL;
char *max_text_length = NULL;
char *cursor_position_set = NULL;
char *max_text_length = NULL;
char *cursor_position_set = NULL;
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text);
if (ret == APP_CONTROL_ERROR_NONE) {
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_DEFAULT_TEXT, &default_text);
if (ret == APP_CONTROL_ERROR_NONE) {
- g_input_keyboard_data.default_text = default_text;
+ if (default_text) {
+ g_input_keyboard_data.default_text = string(default_text);
+ free(default_text);
+ }
}
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text);
if (ret == APP_CONTROL_ERROR_NONE) {
}
ret = app_control_get_extra_data(app_control, APP_CONTROL_DATA_INPUT_GUIDE_TEXT, &guide_text);
if (ret == APP_CONTROL_ERROR_NONE) {
- g_input_keyboard_data.guide_text = guide_text;
+ if (guide_text) {
+ g_input_keyboard_data.guide_text = string(guide_text);
+ free(guide_text);
+ }
}
ret = app_control_get_extra_data(app_control, "return_key_type", &return_key_type);
if (ret == APP_CONTROL_ERROR_NONE) {
}
ret = app_control_get_extra_data(app_control, "return_key_type", &return_key_type);
if (ret == APP_CONTROL_ERROR_NONE) {
- g_input_keyboard_data.return_key_type = return_key_type;
+ if (return_key_type) {
+ g_input_keyboard_data.return_key_type = string(return_key_type);
+ free(return_key_type);
+ }
}
ret = app_control_get_extra_data(app_control, "max_text_length", &max_text_length);
if (ret == APP_CONTROL_ERROR_NONE) {
}
ret = app_control_get_extra_data(app_control, "max_text_length", &max_text_length);
if (ret == APP_CONTROL_ERROR_NONE) {
- g_input_keyboard_data.max_text_length = atoi(max_text_length);
- free(max_text_length);
+ if (max_text_length) {
+ g_input_keyboard_data.max_text_length = atoi(max_text_length);
+ free(max_text_length);
+ }
}
ret = app_control_get_extra_data(app_control, "cursor_position_set", &cursor_position_set);
if (ret == APP_CONTROL_ERROR_NONE) {
}
ret = app_control_get_extra_data(app_control, "cursor_position_set", &cursor_position_set);
if (ret == APP_CONTROL_ERROR_NONE) {
- g_input_keyboard_data.cursor_position_set = atoi(cursor_position_set);
- free(cursor_position_set);
+ if (cursor_position_set) {
+ g_input_keyboard_data.cursor_position_set = atoi(cursor_position_set);
+ free(cursor_position_set);
+ }
void input_keyboard_deinit(void)
{
void input_keyboard_deinit(void)
{
- if (g_input_keyboard_data.guide_text)
- free(g_input_keyboard_data.guide_text);
-
- if (g_input_keyboard_data.default_text)
- free(g_input_keyboard_data.default_text);
-
- if (g_input_keyboard_data.return_key_type)
- free(g_input_keyboard_data.return_key_type);
-
- g_input_keyboard_data.default_text = NULL;
- g_input_keyboard_data.guide_text = NULL;
- g_input_keyboard_data.return_key_type = _("IDS_AMEMO_BUTTON_SEND");
+ g_input_keyboard_data.return_key_type = string(_("IDS_AMEMO_BUTTON_SEND"));
g_input_keyboard_data.max_text_length = KEYBOARD_EDITOR_CHAR_COUNT_MAX;
g_input_keyboard_data.cursor_position_set = 0;
g_input_keyboard_data.max_text_length = KEYBOARD_EDITOR_CHAR_COUNT_MAX;
g_input_keyboard_data.cursor_position_set = 0;
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
elm_entry_single_line_set(entry, EINA_TRUE);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text);
- elm_entry_entry_set(entry, g_input_keyboard_data.default_text);
+ elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text.c_str());
+ elm_entry_entry_set(entry, g_input_keyboard_data.default_text.c_str());
elm_entry_cursor_end_set(entry);
evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_entry_cursor_end_set(entry);
evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
- if (g_input_keyboard_data.return_key_type && strcmp(g_input_keyboard_data.return_key_type, "DONE") == 0) {
+ if (g_input_keyboard_data.return_key_type == string("DONE")) {
elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad);
}
elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad);
}
elm_box_pack_end(box, entry);
Evas_Object *btn = elm_button_add(box);
elm_box_pack_end(box, entry);
Evas_Object *btn = elm_button_add(box);
- elm_object_text_set(btn, g_input_keyboard_data.return_key_type);
+ elm_object_text_set(btn, g_input_keyboard_data.return_key_type.c_str());
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, NULL);
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, 0.5);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, NULL);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text);
- elm_entry_entry_set(entry, g_input_keyboard_data.default_text);
+ elm_object_part_text_set(entry, "elm.guide", g_input_keyboard_data.guide_text.c_str());
+ elm_entry_entry_set(entry, g_input_keyboard_data.default_text.c_str());
elm_entry_cursor_end_set(entry);
evas_object_smart_callback_add(entry, "focused", editfield_focused_cb, editfield);
evas_object_smart_callback_add(entry, "unfocused", editfield_unfocused_cb, editfield);
elm_entry_cursor_end_set(entry);
evas_object_smart_callback_add(entry, "focused", editfield_focused_cb, editfield);
evas_object_smart_callback_add(entry, "unfocused", editfield_unfocused_cb, editfield);
- if (g_input_keyboard_data.return_key_type && strcmp(g_input_keyboard_data.return_key_type, "DONE") == 0) {
+ if (g_input_keyboard_data.return_key_type == string("DONE")) {
elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad);
}
elm_entry_input_panel_return_key_type_set(entry, ELM_INPUT_PANEL_RETURN_KEY_TYPE_DONE);
evas_object_smart_callback_add(entry, "activated", enter_keydown_cb, ad);
}