From e5f45ad6e74441337f1d41cc37cf8ee07f417e02 Mon Sep 17 00:00:00 2001 From: MyoungJune Park Date: Tue, 6 Aug 2013 20:54:30 +0900 Subject: [PATCH] fixed N_SE-47240 - applied ea_editfield_add - applied dialogue/editfield/title style to avoid string overflow in genlist --- .../include/setting-common-draw-widget.h | 1 + setting-common/src/setting-common-draw-genlist.c | 92 ++++++++++------------ setting-common/src/setting-common-draw-widget.c | 2 + setting-common/src/setting-common-plugin.c | 24 +++--- setting-plugin/CMakeLists.txt | 2 +- 5 files changed, 58 insertions(+), 63 deletions(-) diff --git a/setting-common/include/setting-common-draw-widget.h b/setting-common/include/setting-common-draw-widget.h index 6c028d9..bd8d9c9 100755 --- a/setting-common/include/setting-common-draw-widget.h +++ b/setting-common/include/setting-common-draw-widget.h @@ -34,6 +34,7 @@ extern const Elm_Genlist_Item_Class itc_sep_line; extern const Elm_Genlist_Item_Class itc_1text; extern const Elm_Genlist_Item_Class itc_1text_1icon_2; +extern const Elm_Genlist_Item_Class itc_dialogue_editfield_title; extern const Elm_Genlist_Item_Class itc_1icon; extern const Elm_Genlist_Item_Class itc_1icon_1text_sub; extern const Elm_Genlist_Item_Class itc_1text_1icon; diff --git a/setting-common/src/setting-common-draw-genlist.c b/setting-common/src/setting-common-draw-genlist.c index 9564ec8..2e6b3a5 100755 --- a/setting-common/src/setting-common-draw-genlist.c +++ b/setting-common/src/setting-common-draw-genlist.c @@ -60,6 +60,7 @@ const Elm_Genlist_Item_Class name = {\ DEFINE_ITC1("dialogue/1text", itc_1text); DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2); +DEFINE_ITC1("dialogue/editfield/title", itc_dialogue_editfield_title); DEFINE_ITC1("dialogue/1icon", itc_1icon); DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub); DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon); @@ -141,18 +142,21 @@ static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // { ret_if(!data); SETTING_TRACE_BEGIN; + #if 0 Evas_Object *entry_container = data; //whe entry unfocused, its guidetext will becomes "Input here" elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT")); if (elm_entry_is_empty(obj)) elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm"); elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm"); + #endif } static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext. { ret_if(!data); SETTING_TRACE_BEGIN; + #if 0 Evas_Object *entry_container = data; //whe entry focused, its guidetext will becomes "Input here" elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT")); @@ -162,6 +166,7 @@ static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // F Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj); if (imf_context) ecore_imf_context_input_panel_show(imf_context); + #endif } static void __eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents. { @@ -340,10 +345,6 @@ static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, /* SETTING_TRACE_BEGIN; */ Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) data; - /* SETTING_TRACE("part:%s", part); */ - if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */ - return NULL; - } /* for font size view */ if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) { @@ -368,9 +369,7 @@ static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, } if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */ - if (item_data->keyStr) { - return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */ - } + return (char *)g_strdup(_(item_data->keyStr)); } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */ if (item_data->sub_desc) { @@ -493,11 +492,21 @@ static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Objec { retv_if(!item_data || !parent, NULL); elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */ - Evas_Object *ed_name = - setting_create_editfiled(parent, _(item_data->keyStr), item_data->sub_desc); - evas_object_pass_events_set(ed_name, 1); - evas_object_propagate_events_set(ed_name, 0); - Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content"); + Evas_Object *entry = NULL; + entry = ea_editfield_add(parent, EA_EDITFIELD_SINGLELINE); + + char* def_str = NULL; + def_str = item_data->sub_desc; + + if (def_str && safeStrLen(def_str) > 0) { + elm_entry_entry_set(entry, def_str); + } else { + elm_object_part_text_set(entry , "elm.guide", _("IDS_ST_BODY_TAP_TO_INSERT")); + } + + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, 0); + item_data->eo_check = entry; elm_entry_input_panel_layout_set(entry, item_data->input_type); @@ -512,41 +521,24 @@ static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Objec } if (item_data->limit_filter_data) { - elm_entry_markup_filter_append - (entry, + elm_entry_markup_filter_append (entry, elm_entry_filter_limit_size, item_data->limit_filter_data); if (item_data->maxlength_reached_cb) { - evas_object_smart_callback_add(entry, - "maxlength,reached", - item_data->maxlength_reached_cb, - item_data); + evas_object_smart_callback_add(entry, "maxlength,reached", item_data->maxlength_reached_cb, item_data); } else { - evas_object_smart_callback_add(entry, - "maxlength,reached", - __max_len_reached, - item_data); + evas_object_smart_callback_add(entry, "maxlength,reached", __max_len_reached, item_data); } } if (item_data->stop_change_cb) {//invoked when stop focusing on - evas_object_smart_callback_add(entry, - "unfocused", - item_data->stop_change_cb, - item_data); - } - else - { - evas_object_smart_callback_add(entry, - "unfocused", - __entry_unfocused, - ed_name); + evas_object_smart_callback_add(entry, "unfocused", item_data->stop_change_cb, item_data); + } else { + evas_object_smart_callback_add(entry, "unfocused", __entry_unfocused, item_data); } + if (item_data->digits_filter_data) { - elm_entry_markup_filter_append - (entry, - elm_entry_filter_accept_set, - item_data->digits_filter_data); + elm_entry_markup_filter_append ( entry, elm_entry_filter_accept_set, item_data->digits_filter_data); } /* for Setting App, All the entrys's context popup shouldn't be able */ @@ -554,28 +546,25 @@ static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Objec elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT); if (item_data->chk_change_cb) { - evas_object_smart_callback_add - (entry, - "changed", item_data->chk_change_cb, - item_data); + evas_object_smart_callback_add (entry, "changed", item_data->chk_change_cb, item_data); } //default handle evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data); - evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name); - elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry); + evas_object_smart_callback_add(entry, "focused", __entry_focused, entry); + elm_object_signal_callback_add(entry, "elm,eraser,clicked", "elm", __eraser_clicked, entry); if (item_data->start_change_cb) { evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata); } evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data); - Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry); - if (imf_context) ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, item_data->x_callback_cb, item_data->userdata); - if (item_data->input_panel_disable_flag) { elm_entry_input_panel_enabled_set(entry, EINA_FALSE); } - return ed_name; + return entry; + + // ??? + //elm_entry_prediction_allow_set(entry, FALSE); } static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent) { @@ -838,12 +827,18 @@ static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = { static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part) { +// SETTING_TRACE_BEGIN; retv_if(!data, NULL); Setting_GenGroupItem_Data *item_data = data; retv_if(!data, NULL); __Content_Drawer *cd_list = NULL; __drawer_fp fp = NULL; - if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1")) + //SETTING_TRACE(" ----> part : %s", part); + + if (!safeStrCmp(part, "elm.icon") + || !safeStrCmp(part, "elm.icon.1") + || !safeStrCmp(part, "elm.icon.entry") + ) { fp = __add_left_default; //hold default drawer cd_list = __cd_left; @@ -1336,7 +1331,6 @@ Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo( item_data->chk_change_cb = chk_change_cb; item_data->stop_change_cb = chk_focus_out_cb; item_data->isSinglelineFlag = true; - //setting_call_back_func chk_focus_out_cb, item_data->input_type = input_type; item_data->isPasswordFlag = isPasswordFlag; diff --git a/setting-common/src/setting-common-draw-widget.c b/setting-common/src/setting-common-draw-widget.c index 510fb39..da7e411 100755 --- a/setting-common/src/setting-common-draw-widget.c +++ b/setting-common/src/setting-common-draw-widget.c @@ -19,6 +19,8 @@ #include #include +#include + /** * Hide the input pannel * diff --git a/setting-common/src/setting-common-plugin.c b/setting-common/src/setting-common-plugin.c index 189397c..70fd6b6 100755 --- a/setting-common/src/setting-common-plugin.c +++ b/setting-common/src/setting-common-plugin.c @@ -563,9 +563,9 @@ int setting_plugin_is_editfield_exist(PluginNode* context) Setting_GenGroupItem_Data* list_item = arg.obj; int min_length = list_item->minlength; - //int entry_len = safeStrLen(entry_str_utf8); int entry_len = safeStrLen(list_item->sub_desc); - SETTING_TRACE(" >>> entry _ len : %d ", entry_len); + //SETTING_TRACE(" >>> entry _ len : %d ", entry_len); + //SETTING_TRACE(" >>> minlength _ len : %d ", min_length); if ( entry_len < min_length) { @@ -590,9 +590,6 @@ int setting_plugin_is_editfield_exist(PluginNode* context) return ret; } - - - static Eina_Bool ___click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info) { SETTING_TRACE_BEGIN; @@ -967,7 +964,8 @@ static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info) //------------------------------------------------------------------------------------------- - setting_hide_input_pannel_cb(obj); + //setting_hide_input_pannel_cb(obj); + const char *entry_str = elm_entry_entry_get(obj); char *entry_str_utf8 = NULL; entry_str_utf8 = elm_entry_markup_to_utf8(entry_str); @@ -978,8 +976,10 @@ static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info) int min_length = list_item->minlength; int entry_len = safeStrLen(entry_str_utf8); + SETTING_TRACE(" >>> minlength _ len : %d ", min_length); SETTING_TRACE(" >>> entry _ len : %d ", entry_len); + SETTING_TRACE(" >>> 1"); if (entry_len < min_length) { if (!list_item->notify) { @@ -1019,7 +1019,7 @@ static void __editbox_list_cb(void *data, Evas_Object *obj, { SETTING_TRACE_BEGIN; /* error check */ - +#if 0 retm_if(event_info == NULL, "Invalid argument: event info is NULL"); Elm_Object_Item *item = (Elm_Object_Item *) event_info; elm_genlist_item_selected_set(item, 0); @@ -1029,10 +1029,10 @@ static void __editbox_list_cb(void *data, Evas_Object *obj, if (!elm_object_focus_get(list_item->eo_check)) { elm_object_focus_set(list_item->eo_check, EINA_TRUE); } - Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(list_item->eo_check); setting_retm_if(imf_context == NULL, "imf_context is NULL"); ecore_imf_context_input_panel_show(imf_context); +#endif } @@ -1086,17 +1086,15 @@ static void* editbox_func(void *data, xmlNode *xmlObj) if (maxlength) { min_len = atoi(minlength); - SETTING_TRACE(" >> MINLENGTH FILTER IS AVAILABLE !!!! maxlength = %d", min_len); + SETTING_TRACE(" >> MINLENGTH FILTER IS AVAILABLE !!!! minlength = %d", min_len); } - - Setting_GenGroupItem_Data *list_item = NULL; if (max_len == -1 && min_len == -1 ) { // without maxlength filter - list_item = setting_create_Gendial_field_def(pd->scroller, &(itc_1icon), + list_item = setting_create_Gendial_field_def(pd->scroller, &(itc_dialogue_editfield_title), __editbox_list_cb, pd, SWALLOW_Type_LAYOUT_ENTRY, NULL, NULL, 0, title, key_str, @@ -1106,7 +1104,7 @@ static void* editbox_func(void *data, xmlNode *xmlObj) // add max length filter list_item = setting_create_Gendial_field_entry_fo( pd->scroller, - &(itc_1icon), + &(itc_dialogue_editfield_title), __editbox_list_cb, pd, SWALLOW_Type_LAYOUT_ENTRY, diff --git a/setting-plugin/CMakeLists.txt b/setting-plugin/CMakeLists.txt index ec8b0f8..3e66f73 100755 --- a/setting-plugin/CMakeLists.txt +++ b/setting-plugin/CMakeLists.txt @@ -2,7 +2,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include) INCLUDE(FindPkgConfig) -pkg_check_modules(pkgs_plugin REQUIRED elementary ecore ecore-x edje evas appcore-common appcore-efl ui-gadget-1 capi-appfw-application dlog capi-system-device libxml-2.0) +pkg_check_modules(pkgs_plugin REQUIRED elementary ecore ecore-x edje evas appcore-common appcore-efl ui-gadget-1 capi-appfw-application dlog capi-system-device libxml-2.0 efl-assist) FOREACH(flag ${pkgs_plugin_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -- 2.7.4