fixed N_SE-48266
authorMyoungJune Park <mj2004.park@samsung.com>
Mon, 5 Aug 2013 13:27:25 +0000 (22:27 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Mon, 5 Aug 2013 13:28:15 +0000 (22:28 +0900)
- The content is too short" notification is only showing when try to open another
  Settings page but not showing when terminating Settings page

- add handler for focus handling

setting-common/src/setting-common-draw-genlist.c
setting-common/src/setting-common-plugin.c

index 2d0ba9e..a16e26e 100755 (executable)
@@ -147,6 +147,7 @@ static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) //
                elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
        elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
 }
+
 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);
@@ -242,7 +243,6 @@ static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_i
                        elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
                }
        }
-
 }
 
 /**
@@ -1337,7 +1337,6 @@ Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo(
                return NULL;
        }
 
-
        Elm_Entry_Filter_Limit_Size *limit_filter_data =
            (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
        if(!limit_filter_data) {
index 19caa5e..189397c 100755 (executable)
@@ -513,14 +513,98 @@ static int __cfg_file_write(Draw_Data *pd)
        return TRUE;
 }
 
+typedef struct {
+       int state;
+       Setting_GenGroupItem_Data* obj;
+} HashArgs;
 
-static void ___click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info)
+static Eina_Bool _plugin_foreach_cb_check_editfield(const Eina_Hash *hash, const void*key, void* data, void* fdata)
+{
+
+       HashArgs* pret = (HashArgs*)fdata;
+       //int* pret = (int*)fdata;
+
+    Setting_GenGroupItem_Data* node = (Setting_GenGroupItem_Data*) data;
+       //SETTING_TRACE("%s --- %s ", (char*)key, node->keyStr);
+
+       if (node->keyStr && !strcmp(node->keyStr, "string"))
+       {
+               // focus check
+               if (elm_object_focus_get(node->eo_check))
+               {
+                       SETTING_TRACE("FOCUS SET !!! ");
+                       pret->state = 1;
+                       pret->obj= node;
+                       return EINA_FALSE;
+               } else {
+                       SETTING_TRACE("FOCUS UN -- SET !!! ");
+                       pret->state = 0;
+               }
+       }
+
+       return EINA_TRUE;
+}
+
+int setting_plugin_is_editfield_exist(PluginNode* context)
+{
+       int ret = 0;
+       HashArgs arg;
+       arg.state = 0;
+       arg.obj = NULL;
+
+       if (context->ui_list) {
+               eina_hash_foreach(context->ui_list,_plugin_foreach_cb_check_editfield, &arg);
+       }
+       SETTING_TRACE("%d -- (%x)", arg.state, arg.obj);
+
+       if (arg.state )
+       {
+               ret = 0;
+
+               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);
+
+               if ( entry_len < min_length)
+               {
+                       if (!list_item->notify) {
+                               SETTING_TRACE("notify 1");
+                               list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
+                                               NULL, _(EXCEED_MINLENGTH_LIMITATION_STR),
+                                               __error_popup_response_cb,
+                                               POPUP_INTERVAL, FALSE, FALSE);
+                               elm_object_focus_set(list_item->eo_check, EINA_FALSE);
+                       } else {
+                               SETTING_TRACE("notify 0 ");
+                               //postpone 2 seconds again
+                               elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
+                       }
+                       //elm_object_focus_set(obj, EINA_TRUE);
+
+                       ret = 1;
+               }
+       }
+
+       return ret;
+}
+
+
+
+
+static Eina_Bool ___click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
        ret_if(!data);
        PluginNode* node = (PluginNode*)data;
        Draw_Data *pd = node->pd;
 
+       int is_stop = setting_plugin_is_editfield_exist(node);
+       if (is_stop)
+               return EINA_FALSE;
+       // continue
+
        static int work = 0;
 
        if (work == 0)
@@ -540,6 +624,10 @@ static void ___click_softkey_back_cb(void *data, Evas_Object *obj, void *event_i
                //pd->root = NULL;
                #endif
 
+               // check callback -----------------------------------------
+
+               //---------------------------------------------------------
+
                // ug --> destroy
                if(ug)
                {
@@ -556,6 +644,7 @@ static void ___click_softkey_back_cb(void *data, Evas_Object *obj, void *event_i
                }
                work = 0;
        }
+       return EINA_TRUE;
 }
 
 
@@ -868,6 +957,16 @@ static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
        SETTING_TRACE_BEGIN;
        retm_if(!data || !obj, "Data parameter is NULL");
 
+       //-------------------------------------------------------------------------------------------
+       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");
+       //-------------------------------------------------------------------------------------------
+
+
        setting_hide_input_pannel_cb(obj);
        const char *entry_str = elm_entry_entry_get(obj);
        char *entry_str_utf8 = NULL;
@@ -879,6 +978,8 @@ 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(" >>> entry _ len : %d ", entry_len);
+
        if (entry_len < min_length) {
 
                if (!list_item->notify) {
@@ -891,7 +992,7 @@ static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
                        //postpone 2 seconds again
                        elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
                }
-               elm_object_focus_set(obj, EINA_TRUE);
+               // elm_object_focus_set(obj, EINA_TRUE);
                return;
        }