0a4f4c7a1e38422ee935799cece828b2dfaaefb3
[apps/home/settings.git] / setting-common / src / setting-common-draw-genlist.c
1 /*
2  * setting
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://floralicense.org/license/
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an AS IS BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #include <setting-common-draw-widget.h>
18 #include <glib.h>
19 #include <utilX.h>
20 #include <Ecore_X.h>
21 #include <system_settings.h>
22
23 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
24 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
25 static void _gl_Gendial_del(void *data, Evas_Object *obj);
26 const Elm_Genlist_Item_Class itc_seperator = {
27         .item_style = "dialogue/separator",
28         .func.text_get = NULL,
29         .func.content_get = NULL,
30         .func.state_get = NULL,
31         .func.del = NULL,
32 };
33
34 const Elm_Genlist_Item_Class itc_bottom_seperator = {
35         .item_style = "dialogue/separator",
36         .func.text_get = NULL,
37         .func.content_get = NULL,
38         .func.state_get = NULL,
39         .func.del = NULL,
40 };
41
42 const Elm_Genlist_Item_Class itc_sep_line = {
43         .item_style = "dialogue/separator",
44         .func.text_get = _gl_Gendial_text_get,
45         .func.content_get = NULL,
46         .func.state_get = NULL,
47         .func.del = NULL,
48 };
49
50 #define DEFINE_ITC1(style, name) \
51 const Elm_Genlist_Item_Class name = {\
52         .item_style = style,\
53         .func.text_get = _gl_Gendial_text_get,\
54         .func.content_get = _gl_Gendial_content_get,\
55         .func.state_get = NULL,\
56         .func.del = _gl_Gendial_del,\
57 };
58
59 DEFINE_ITC1("dialogue/1text", itc_1text);
60 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
61
62 DEFINE_ITC1("dialogue/1icon", itc_1icon);
63 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
64 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
65 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
66 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
67
68 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
69 DEFINE_ITC1("dialogue/2text", itc_2text);
70 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
71 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
72 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
73 DEFINE_ITC1("dialogue/2text.1icon.10.tb", itc_2text_1icon_7);
74
75 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
76 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
77 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
78
79 DEFINE_ITC1("multiline/1text", itc_multiline_text);
80 DEFINE_ITC1("1text.1icon.3", itc_1text_1icon_3_tb);
81 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
82 DEFINE_ITC1("select_all", itc_sel_all);
83 //DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
84 DEFINE_ITC1("1icon", itc_bg_1icon);
85 DEFINE_ITC1("dialogue/title", itc_group_item);
86
87 /**
88  * Do process when clicking on a common genlist item
89  */
90 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
91                                             void *event_info)
92 {
93         /* error check */
94         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
95         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
96         elm_genlist_item_selected_set(item, 0);
97         Setting_GenGroupItem_Data *list_item =
98             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
99
100         setting_retm_if(data == NULL, "Data parameter is NULL");
101         Evas_Object *radio = data;
102         elm_radio_value_set(radio, list_item->chk_status);
103 }
104
105 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
106 {
107         retm_if(data == NULL, "Data parameter is NULL");
108         Setting_GenGroupItem_Data *list_item =
109             (Setting_GenGroupItem_Data *) data;
110         list_item->chk_status = elm_radio_value_get(obj);       /*  for update */
111 }
112
113 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
114 {
115         retm_if(data == NULL, "Data parameter is NULL");
116         SETTING_TRACE_BEGIN;
117         Setting_GenGroupItem_Data *list_item =
118             (Setting_GenGroupItem_Data *) data;
119         list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
120         Evas_Object *entry_container = elm_object_parent_widget_get(obj);
121         if (entry_container)
122         {
123                 if (elm_entry_is_empty(obj))
124                 {
125                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
126                         elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
127                 }
128                 else
129                 {
130                         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
131                         if (elm_object_focus_get(obj)) //only do when entry is focused
132                         {
133                                 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
134                         }
135                 }
136         }
137 }
138
139 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
140 {
141         ret_if(!data);
142         SETTING_TRACE_BEGIN;
143         Evas_Object *entry_container = data;
144         //whe entry unfocused, its guidetext will becomes "Input here"
145         elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
146         if (elm_entry_is_empty(obj))
147                 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
148         elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
149 }
150 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
151 {
152         ret_if(!data);
153         SETTING_TRACE_BEGIN;
154         Evas_Object *entry_container = data;
155         //whe entry focused, its guidetext will becomes "Input here"
156         elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
157         if (!elm_entry_is_empty(obj))
158                 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
159         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
160
161         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
162         if (imf_context) ecore_imf_context_input_panel_show(imf_context);
163 }
164 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.
165 {
166         ret_if(!data);
167         SETTING_TRACE_BEGIN;
168         Evas_Object *entry = data;
169         elm_entry_entry_set(entry, "");
170         elm_object_focus_set(entry, EINA_TRUE);
171 }
172
173 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
174 {
175         retm_if(data == NULL, "Data parameter is NULL");
176         SETTING_TRACE_BEGIN;
177         Setting_GenGroupItem_Data *list_item =
178             (Setting_GenGroupItem_Data *) data;
179         list_item->chk_status = elm_check_state_get(obj);       /*  for update */
180 }
181
182 static void __error_popup_response_cb(void *data, Evas_Object *obj,
183                                      void *event_info)
184 {
185         SETTING_TRACE_BEGIN;
186         retm_if(data == NULL, "Data parameter is NULL");
187         Setting_GenGroupItem_Data *list_item = data;
188         if (list_item->notify) {
189                 evas_object_del(list_item->notify);
190                 list_item->notify = NULL;
191         }
192 }
193
194 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
195 {
196         SETTING_TRACE_BEGIN;
197         retm_if(data == NULL, "Data parameter is NULL");
198         retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
199
200         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
201         if (!list_item->notify)
202         {
203                 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
204                                                          NULL, _(EXCEED_LIMITATION_STR),
205                                                          __error_popup_response_cb,
206                                                          POPUP_INTERVAL, FALSE, FALSE);
207                 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
208         } else {
209                 //postpone 2 seconds again
210                 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
211         }
212
213 }
214
215 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
216 {
217         retm_if(data == NULL, "Data parameter is NULL");
218         retm_if(event_info == NULL, "event_info is NULL");
219         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
220         Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
221         SETTING_TRACE_BEGIN;
222         if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
223            || safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
224         {
225                 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
226                 list_item->enterKeyPressFlag = true;
227                 //hide the eraser button
228                 //format like:xx<br/>
229                 if (list_item->isSinglelineFlag == FALSE) {
230                         const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
231                         elm_entry_entry_set(obj, entry_str);
232                         FREE(entry_str);
233                         elm_entry_cursor_end_set(obj);
234                 }
235                 setting_hide_input_pannel_cb(obj);
236         } else {
237                 list_item->enterKeyPressFlag = false;
238                 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
239                 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
240                         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
241                 } else {
242                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
243                 }
244         }
245
246 }
247
248 /**
249  * Do process when clicking radio in subitem of expandable item
250  */
251 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
252 {
253         SETTING_TRACE_BEGIN;
254         retm_if(data == NULL, "Data parameter is NULL");
255         Setting_GenGroupItem_Data *list_item =
256             (Setting_GenGroupItem_Data *) data;
257         list_item->chk_status = elm_radio_value_get(obj);       /*  for update */
258
259         Elm_Object_Item *subItem = list_item->item;
260         Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
261
262         Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem);    /* subItem data */
263         Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem);      /* parent data */
264
265         ret_if(NULL == data_subItem || NULL == data_parentItem);
266         int err;
267         setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
268                                 list_item->chk_status, &err);
269         ret_if(0 != err);
270         data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
271         elm_object_item_data_set(data_parentItem->item, data_parentItem);
272         elm_genlist_item_update(data_parentItem->item);
273 }
274
275 /**
276  * Do process when clicking on subitem of expandable item
277  */
278 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
279 {
280         SETTING_TRACE_BEGIN;
281         /* error check */
282         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
283         Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
284         Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
285         elm_genlist_item_selected_set(subitem, 0);
286         Setting_GenGroupItem_Data *data_subItem =
287             elm_object_item_data_get(subitem);
288         Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem);      /* parent data */
289         ret_if(NULL == data_subItem || NULL == data_parentItem);
290
291         elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
292         int err;
293         setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
294                                 data_subItem->chk_status, &err);
295         setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
296
297         data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
298         elm_object_item_data_set(data_parentItem->item, data_parentItem);
299         elm_genlist_item_update(data_parentItem->item);
300 }
301
302 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
303 {
304         ret_if(data == NULL || event_info == NULL);
305         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
306         char *cb_type = data;
307
308         if (0 == safeStrCmp(cb_type, "drag")
309             || 0 == safeStrCmp(cb_type, "longpressed")) {
310                 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
311                 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
312         } else if (0 == safeStrCmp(cb_type, "contracted")) {
313                 elm_genlist_item_subitems_clear(item);
314         }
315 }
316
317 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
318 {
319         /* SETTING_TRACE_BEGIN; */
320         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
321         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
322         elm_genlist_item_selected_set(item, 0);
323 }
324
325 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
326                                    void *event_info)
327 {
328         /* SETTING_TRACE_BEGIN; */
329         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
330         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
331         elm_genlist_item_selected_set(item, 0);
332         bool status = !elm_genlist_item_expanded_get(item);
333         elm_genlist_item_expanded_set(item, status);
334 }
335
336 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
337                                    const char *part)
338 {
339         /* SETTING_TRACE_BEGIN; */
340         Setting_GenGroupItem_Data *item_data =
341             (Setting_GenGroupItem_Data *) data;
342         /* SETTING_TRACE("part:%s", part); */
343         if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) {     /* no need to create 'text' part */
344                 return NULL;
345         }
346
347         /* for font size view */
348         if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
349                 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
350                 int font_size = -1;
351                 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
352                 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
353                         font_size = LABEL_FONT_SIZE_SMALL;
354                 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
355                         font_size = LABEL_FONT_SIZE_LARGE;
356                 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
357                         font_size = LABEL_FONT_SIZE_HUGE;
358                 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
359                         font_size = LABEL_FONT_SIZE_GIANT;
360                 } else {
361                         font_size = LABEL_FONT_SIZE_NORMAL;
362                 }
363                 SETTING_TRACE("font_size:%d", font_size);
364                 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
365                         font_size, _(item_data->keyStr));
366                 return (char *)g_strdup(speciliztion);
367         }
368
369         if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
370                 if (item_data->keyStr) {
371                         return (char *)g_strdup(_(item_data->keyStr));  /* use item_data->keyStr */
372                 }
373
374         } else if (!safeStrCmp(part, "elm.text.2")) {   /* bottom or right */
375                 if (item_data->sub_desc) {
376                         return (char *)g_strdup(item_data->sub_desc);
377                 }
378         }
379
380         return NULL;
381 }
382
383 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
384 {
385         retv_if(!item_data || !parent, NULL);
386         Evas_Object *check = elm_check_add(parent);
387         elm_check_state_set(check, item_data->chk_status);
388         evas_object_show(check);
389         evas_object_pass_events_set(check, 1);
390         evas_object_propagate_events_set(check, 0);
391
392         item_data->eo_check = check;
393
394         if (item_data->chk_change_cb) {
395                 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
396         } else {
397                 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
398         }
399         return check;
400 }
401 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
402 {
403         retv_if(!item_data || !parent, NULL);
404         Evas_Object *check = __add_check(item_data, parent);
405
406         Evas_Object *thumb = NULL;
407         if (item_data->r_swallow_path) {
408                 thumb = elm_icon_add(parent);
409                 elm_icon_file_set(thumb,
410                                   item_data->r_swallow_path,
411                                   NULL);
412                 evas_object_size_hint_aspect_set(thumb,
413                                                  EVAS_ASPECT_CONTROL_VERTICAL,
414                                                  1, 1);
415         }
416
417         Evas_Object *layout = elm_layout_add(parent);
418         elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
419                             "thumbnail_icon2");
420         evas_object_size_hint_weight_set(layout,
421                                          EVAS_HINT_EXPAND,
422                                          EVAS_HINT_EXPAND);
423         elm_object_part_content_set(layout, "checkbox", check);
424         elm_object_part_content_set(layout, "thumbnail", thumb);
425         evas_object_show(layout);
426         return layout;
427 }
428 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
429 {
430         retv_if(!item_data || !parent, NULL);
431         Evas_Object *check = __add_check(item_data, parent);
432         elm_object_style_set(check, "on&off");
433         return check;
434 }
435 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
436 {
437         retv_if(!item_data || !parent, NULL);
438         Evas_Object *chk = __add_toggle(item_data, parent);
439         elm_object_style_set(chk, "on&off");
440         return chk;
441 }
442
443 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
444 {
445         retv_if(!item_data || !parent, NULL);
446         if (!item_data->rgd) {  /* exceptional handling */
447                 item_data->rgd = elm_radio_add(parent);
448                 elm_radio_state_value_set(item_data->rgd, -1);
449         }
450         Evas_Object *radio = elm_radio_add(parent);
451         elm_radio_state_value_set(radio,
452                                   item_data->chk_status);
453         elm_radio_group_add(radio, item_data->rgd);
454         evas_object_show(radio);
455         item_data->eo_check = radio;
456         if (item_data->chk_change_cb) {
457                 evas_object_smart_callback_add(radio,
458                                                "changed",
459                                                item_data->chk_change_cb,
460                                                item_data);
461         } else {
462                 evas_object_smart_callback_add(radio,
463                                                "changed",
464                                                __radio_changed,
465                                                item_data);
466         }
467         return radio;
468 }
469 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
470 {
471         retv_if(!item_data || !parent, NULL);
472         Evas_Object *btn = elm_button_add(parent);
473         evas_object_show(btn);
474         if (item_data->r_swallow_path)
475         {
476                 elm_object_style_set(btn, item_data->r_swallow_path);
477         }
478         if (item_data->keyStr)
479         {
480                 elm_object_text_set(btn, _(item_data->keyStr));
481         }
482         evas_object_propagate_events_set(btn, EINA_FALSE);
483         if (item_data->chk_change_cb)
484                 evas_object_smart_callback_add(btn,
485                                                "clicked",
486                                                item_data->chk_change_cb,
487                                                item_data);
488         return btn;
489 }
490
491 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
492 {
493         retv_if(!item_data || !parent, NULL);
494         elm_genlist_mode_set(parent, ELM_LIST_COMPRESS);        /* resolve abnormal height issue */
495         Evas_Object *ed_name =
496             setting_create_editfiled(parent, _(item_data->keyStr), item_data->sub_desc);
497         evas_object_pass_events_set(ed_name, 1);
498         evas_object_propagate_events_set(ed_name, 0);
499         Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
500         item_data->eo_check = entry;
501         elm_entry_input_panel_layout_set(entry, item_data->input_type);
502
503         if (item_data->isSinglelineFlag) {
504                 elm_entry_scrollable_set(entry, EINA_TRUE);
505                 elm_entry_single_line_set(entry, EINA_TRUE);
506         }
507
508         if (item_data->isPasswordFlag) {
509                 elm_entry_single_line_set(entry, EINA_TRUE);
510                 elm_entry_password_set(entry, EINA_TRUE);
511         }
512
513         if (item_data->limit_filter_data) {
514                 elm_entry_markup_filter_append
515                     (entry,
516                      elm_entry_filter_limit_size,
517                      item_data->limit_filter_data);
518
519                 if (item_data->maxlength_reached_cb) {
520                         evas_object_smart_callback_add(entry,
521                                                       "maxlength,reached",
522                                                       item_data->maxlength_reached_cb,
523                                                       item_data);
524                 } else {
525                         evas_object_smart_callback_add(entry,
526                                                       "maxlength,reached",
527                                                       __max_len_reached,
528                                                       item_data);
529                 }
530         }
531         if (item_data->stop_change_cb) {//invoked when stop focusing on
532                 evas_object_smart_callback_add(entry,
533                                                       "unfocused",
534                                                       item_data->stop_change_cb,
535                                                       item_data);
536         }
537         else
538         {
539                 evas_object_smart_callback_add(entry,
540                                               "unfocused",
541                                               __entry_unfocused,
542                                               ed_name);
543         }
544         if (item_data->digits_filter_data) {
545                 elm_entry_markup_filter_append
546                     (entry,
547                      elm_entry_filter_accept_set,
548                      item_data->digits_filter_data);
549         }
550
551         /* for Setting App, All the entrys's context popup shouldn't be able */
552         /* to insert images, text is the only one can be inserted. */
553         elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
554
555         if (item_data->chk_change_cb) {
556                 evas_object_smart_callback_add
557                     (entry,
558                      "changed", item_data->chk_change_cb,
559                      item_data);
560         }
561         //default handle
562         evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
563         evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
564         elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
565
566         if (item_data->start_change_cb) {
567                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
568         }
569         evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
570
571         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
572         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);
573
574         if (item_data->input_panel_disable_flag) {
575                 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
576         }
577         return ed_name;
578 }
579 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
580 {
581         retv_if(!item_data || !parent, NULL);
582         Evas_Object *li_slider =
583             setting_create_slider(parent, item_data->evas,
584                                   item_data->l_swallow_path,
585                                   item_data->r_swallow_path,
586                                   item_data->chk_status,
587                                   item_data->isIndicatorVisible,
588                                   item_data->slider_min,
589                                   item_data->slider_max,
590                                   item_data->chk_change_cb,
591                                   item_data->start_change_cb,
592                                   item_data->stop_change_cb,
593                                   item_data);
594         evas_object_pass_events_set(li_slider, 1);
595         evas_object_propagate_events_set(li_slider, 0);
596         item_data->eo_check = li_slider;
597         return li_slider;
598 }
599
600 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
601 {
602         retv_if(!item_data || !parent, NULL);
603         /* **********create time/date field */
604         Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
605         evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
606         evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
607         evas_object_show(datetimefield);
608
609         evas_object_pass_events_set(datetimefield, 1);
610         evas_object_propagate_events_set(datetimefield, 0);
611
612         char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
613         const char *time_format = NULL;
614         if (item_data->chk_status)//12 hours
615         {
616                 time_format = "%I : %M %p";
617         } else { //24 hours
618                 time_format = "%H : %M";
619         }
620
621 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
622         char *old_format = elm_datetime_format_get(datetimefield);
623         snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
624                  "%s", old_format);
625         safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
626         FREE(old_format);
627         SETTING_TRACE("datefield_format:%s", date_format);
628 #else
629         snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
630                  "%s %s", item_data->sub_desc, time_format);
631 #endif
632         elm_datetime_format_set(datetimefield, date_format);
633
634         // min : 1970 1, 01, Thursday 00:00:00
635         // max : 2038 1, 19, Thursday 03:14:07
636         struct tm ts_ret;
637         memset(&ts_ret, 0, sizeof(struct tm));
638         ts_ret.tm_year = 138;
639         ts_ret.tm_mon = 1;
640         ts_ret.tm_mday = 19;
641         elm_datetime_value_max_set(datetimefield, &ts_ret);
642
643         ts_ret.tm_year = 70;
644         ts_ret.tm_mon = 0;
645         ts_ret.tm_mday = 1;
646         elm_datetime_value_min_set(datetimefield, &ts_ret);
647
648
649         time_t ctime = time(NULL);
650         //struct tm ts_ret;
651         struct tm *ts = localtime_r(&ctime, &ts_ret);
652         retv_if(!ts, NULL);
653
654         elm_datetime_value_set(datetimefield, &ts_ret);
655
656         if (item_data->chk_change_cb) {
657                 evas_object_smart_callback_add(datetimefield,
658                                                "changed",
659                                                item_data->chk_change_cb,
660                                                item_data);
661         }
662
663         if (item_data->isItemDisableFlag) {
664                 setting_disable_evas_object(datetimefield);
665         }
666         return datetimefield;
667 }
668 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
669 {
670         retv_if(!item_data || !parent, NULL);
671         Evas_Object *box = elm_box_add(parent);
672         elm_box_horizontal_set(box, 1);
673
674         //a.radio..
675         Evas_Object *radio = __add_radio(item_data, parent);
676         setting_disable_evas_object(radio);
677         elm_box_pack_end(box, radio);
678
679         //b.separator..
680         Evas_Object *separator =
681                 setting_create_blank_rect_customize(box,
682                                 SETTING_HALF_SCREEN_WIDTH,
683                                 SETTING_PADDING_HEIGHT);
684         elm_box_pack_end(box, separator);
685
686         //c.progressbar..
687         Evas_Object *progressbar = elm_progressbar_add(parent);
688         elm_object_style_set(progressbar, "list_process");
689         evas_object_size_hint_align_set(progressbar,
690                                         EVAS_HINT_FILL, 0.5);
691         evas_object_size_hint_weight_set(progressbar,
692                                          EVAS_HINT_EXPAND,
693                                          EVAS_HINT_EXPAND);
694         elm_progressbar_pulse(progressbar, EINA_TRUE);
695         evas_object_show(progressbar);
696         elm_box_pack_end(box, progressbar);
697
698         evas_object_show(box);
699         return box;
700 }
701 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
702 {
703         retv_if(!item_data || !parent, NULL);
704         // added by JTS: CQ H0100135171
705         Evas_Object *box = elm_box_add(parent);
706         elm_box_horizontal_set(box, 1);
707
708         //b.separator..
709         Evas_Object *separator =
710                 setting_create_blank_rect_customize(box,
711                 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
712         elm_box_pack_end(box, separator);
713
714         //c.progressbar..
715         Evas_Object *progressbar = elm_progressbar_add(parent);
716         elm_object_style_set(progressbar, "list_process");
717         evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
718         evas_object_size_hint_weight_set(progressbar,
719                                         EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
720         elm_progressbar_pulse(progressbar, EINA_TRUE);
721         evas_object_show(progressbar);
722         elm_box_pack_end(box, progressbar);
723
724         evas_object_show(box);
725         return box;
726
727 }
728 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
729 {
730         retv_if(!item_data || !parent, NULL);
731         Evas_Object *progressbar = elm_progressbar_add(parent);
732         elm_object_style_set(progressbar, "list_process");
733         evas_object_size_hint_align_set(progressbar,
734                                         EVAS_HINT_FILL, 0.5);
735         evas_object_size_hint_weight_set(progressbar,
736                                          EVAS_HINT_EXPAND,
737                                          EVAS_HINT_EXPAND);
738         elm_progressbar_pulse(progressbar, EINA_TRUE);
739         evas_object_show(progressbar);
740         return progressbar;
741 }
742
743 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
744 {
745         retv_if(!item_data || !parent, NULL);
746
747         //a.radio..
748         Evas_Object *radio = __add_radio(item_data, parent);
749
750         return radio;
751 }
752
753 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
754 {
755         retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
756         Evas_Object *icon = elm_icon_add(parent);
757         elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
758         evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
759         return icon;
760 }
761 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
762 {
763         retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
764         Evas_Object *icon = elm_icon_add(parent);
765         elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
766         evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
767         return icon;
768 }
769
770 // draw handler
771 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
772 typedef struct
773 {
774         SWALLOW_Type type;                      // ui type
775         __drawer_fp draw;
776 } __Content_Drawer;
777 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
778         //base objects
779         {SWALLOW_Type_1CHECK, __add_check},
780         {SWALLOW_Type_1TOGGLE, __add_toggle},
781         {SWALLOW_Type_1RADIO, __add_radio},
782         {SWALLOW_Type_1BUTTON, __add_button},
783
784         //base objects in an layout
785         {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
786         {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
787         {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
788
789         //other compelx objects
790         {SWALLOW_Type_1SEARCH, __add_search},
791         {SWALLOW_Type_1PROCESS, __add_process},
792         {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
793         {SWALLOW_Type_1CHECKICON, __add_check_icon},
794         {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
795         {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
796
797         //left part object of the type
798         {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
799         {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
800 };
801 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
802         //right part object of the type
803         {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
804         {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
805 };
806
807 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
808         //end part object of the type
809         {SWALLOW_Type_1RADIO, __add_radio},
810 };
811 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
812         {"elm.icon", __cd_left},
813         {"elm.icon.1", __cd_left},
814         {"elm.icon.2", __cd_right},
815         {"elm.swallow.end", __cd_end},
816 };*/
817
818 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
819                                          const char *part)
820 {
821         retv_if(!data, NULL);
822         Setting_GenGroupItem_Data *item_data = data;
823         retv_if(!data, NULL);
824         __Content_Drawer *cd_list = NULL;
825         __drawer_fp fp = NULL;
826         if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
827         {
828                 fp = __add_left_default; //hold default drawer
829                 cd_list = __cd_left;
830         }
831         else if (!safeStrCmp(part, "elm.icon.2"))
832         {
833                 fp = __add_right_default; //hold default drawer
834                 cd_list = __cd_right;
835         }
836         else if (!safeStrCmp(part, "elm.swallow.end"))
837         {
838                 //the default value of fp is NULL here
839                 cd_list = __cd_end;
840         }
841         if (!cd_list) return NULL;//invalid part
842
843         int idx = 0;
844         for (; idx < SWALLOW_Type_MAX; idx++)
845         {
846                 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
847                 {
848                         fp = cd_list[idx].draw;
849                         break;
850                 }
851         }
852         return fp ? fp(item_data, obj) : NULL;
853 }
854
855 static void _gl_Gendial_del(void *data, Evas_Object *obj)
856 {
857         /* SETTING_TRACE_BEGIN; */
858         Setting_GenGroupItem_Data *item_data =
859             (Setting_GenGroupItem_Data *) data;
860         if (item_data) {
861                 G_FREE(item_data->keyStr);
862                 G_FREE(item_data->sub_desc);
863                 G_FREE((item_data->l_swallow_path));
864                 G_FREE((item_data->r_swallow_path));
865                 G_FREE(item_data->item_style);
866
867
868                 if (item_data->digits_filter_data)
869                 {
870                         G_FREE(item_data->digits_filter_data->accepted);
871                         G_FREE(item_data->digits_filter_data->rejected);
872                         FREE(item_data->digits_filter_data);
873
874                 }
875
876                 if (item_data->notify) {
877                         evas_object_del(item_data->notify);
878                         item_data->notify = NULL;
879                 }
880
881                 FREE(item_data->limit_filter_data);
882                 __BACK_POINTER_UNSET(item_data);
883                 FREE(item_data);
884         }
885         /* SETTING_TRACE_END; */
886 }
887
888 /**
889  * To intialize an Elm_Genlist_Item_Class, according to item style
890  *
891  * @param[in] item_style
892  * @param[in/out] itc
893  */
894 bool setting_create_Gendial_itc(const char *item_style,
895                                 Elm_Genlist_Item_Class *itc)
896 {
897         itc->item_style = item_style;
898         itc->func.text_get = _gl_Gendial_text_get;
899         itc->func.content_get = _gl_Gendial_content_get;
900         itc->func.state_get = NULL;
901         itc->func.del = _gl_Gendial_del;        /* _gl_Gendial_del; */
902         return TRUE;
903 }
904
905 /**
906  * Create group style item
907  *
908  * @return a pointer to Setting_GenGroupItem_Data
909  */
910 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
911                                                 const Elm_Genlist_Item_Class *itc,
912                                                 Elm_Object_Item *parent,
913                                                 Elm_Genlist_Item_Type flag,     /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
914                                                 const char *keyStr,
915                                                 setting_call_back_func gl_sel)
916 {
917         /* SETTING_TRACE_BEGIN; */
918         Setting_GenGroupItem_Data *item_data =
919             (Setting_GenGroupItem_Data *) calloc(1,
920                                                  sizeof
921                                                  (Setting_GenGroupItem_Data));
922         setting_retvm_if(!item_data, NULL, "calloc failed");
923         item_data->keyStr = (char *)g_strdup(keyStr);
924         if (gl_sel) {
925                 item_data->item =
926                     elm_genlist_item_append(genlist, itc, item_data, parent,
927                                             flag, gl_sel, NULL);
928         } else {
929                 item_data->item =
930                     elm_genlist_item_append(genlist, itc, item_data, parent,
931                                             flag, _gl_Gendial_sel, NULL);
932         }
933         return item_data;
934 }
935
936 /**
937  * Create separator style item with title
938  *
939  * @return a pointer to Setting_GenGroupItem_Data
940  */
941 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
942                                                 Evas_Object *genlist,
943                                                 const Elm_Genlist_Item_Class *itc,
944                                                 const char *keyStr,
945                                                 setting_call_back_func gl_sel)
946 {
947         /* SETTING_TRACE_BEGIN; */
948         Setting_GenGroupItem_Data *item_data =
949             (Setting_GenGroupItem_Data *) calloc(1,
950                                                  sizeof
951                                                  (Setting_GenGroupItem_Data));
952         setting_retvm_if(!item_data, NULL, "calloc failed");
953         item_data->keyStr = (char *)g_strdup(keyStr);
954         if (gl_sel) {
955                 item_data->item =
956                     elm_genlist_item_append(genlist, itc, item_data, NULL,
957                                             ELM_GENLIST_ITEM_NONE, gl_sel,
958                                             NULL);
959         } else {
960                 item_data->item =
961                     elm_genlist_item_append(genlist, itc, item_data, NULL,
962                                             ELM_GENLIST_ITEM_NONE,
963                                             _gl_Gendial_sel, NULL);
964         }
965         return item_data;
966 }
967
968 /**
969  * Create 1radio-1text style item
970  *
971  * @return a pointer to Setting_GenGroupItem_Data
972  */
973
974 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
975                                         Evas_Object *genlist,
976                                         const Elm_Genlist_Item_Class *itc,
977                                         setting_call_back_func gl_sel,
978                                         void *sel_data,
979                                         SWALLOW_Type swallow_type,
980                                         Evas_Object *rgd, int chk_status,
981                                         const char *keyStr,
982                                         setting_call_back_func chk_change_cb)
983 {
984         /* SETTING_TRACE_BEGIN; */
985         Setting_GenGroupItem_Data *item_data =
986             (Setting_GenGroupItem_Data *) calloc(1,
987                                                  sizeof
988                                                  (Setting_GenGroupItem_Data));
989         setting_retvm_if(!item_data, NULL, "calloc failed");
990         item_data->keyStr = (char *)g_strdup(keyStr);
991         item_data->swallow_type = swallow_type;
992         item_data->chk_status = chk_status;
993         item_data->chk_change_cb = chk_change_cb;
994         item_data->rgd = rgd;
995
996         if (gl_sel) {
997                 item_data->item =
998                     elm_genlist_item_append(genlist, itc, item_data, NULL,
999                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1000                                             sel_data);
1001         } else {
1002                 item_data->item =
1003                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1004                                             ELM_GENLIST_ITEM_NONE,
1005                                             _gl_Gendial_sel, sel_data);
1006         }
1007         return item_data;
1008 }
1009
1010 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1011                                         Evas_Object *genlist,
1012                                         const Elm_Genlist_Item_Class *itc,
1013                                         setting_call_back_func gl_sel,
1014                                         void *sel_data,
1015                                         SWALLOW_Type swallow_type,
1016                                         Evas_Object *rgd, int chk_status,
1017                                         const char *keyStr,
1018                                         const char *sub_desc,
1019                                         setting_call_back_func chk_change_cb)
1020 {
1021         /* SETTING_TRACE_BEGIN; */
1022         Setting_GenGroupItem_Data *item_data =
1023             (Setting_GenGroupItem_Data *) calloc(1,
1024                                                  sizeof
1025                                                  (Setting_GenGroupItem_Data));
1026         setting_retvm_if(!item_data, NULL, "calloc failed");
1027         item_data->keyStr = (char *)g_strdup(keyStr);
1028         item_data->sub_desc = (char *)g_strdup(sub_desc);
1029         item_data->swallow_type = swallow_type;
1030         item_data->chk_status = chk_status;
1031         item_data->chk_change_cb = chk_change_cb;
1032         item_data->rgd = rgd;
1033
1034         if (gl_sel) {
1035                 item_data->item =
1036                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1037                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1038                                             sel_data);
1039         } else {
1040                 item_data->item =
1041                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1042                                             ELM_GENLIST_ITEM_NONE,
1043                                             _gl_Gendial_sel, sel_data);
1044         }
1045         return item_data;
1046 }
1047
1048 /**
1049  * Create common style item with menu icon
1050  *
1051  * @return a pointer to Setting_GenGroupItem_Data
1052  */
1053 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1054                                         Evas_Object *genlist,
1055                                         const Elm_Genlist_Item_Class *itc,
1056                                         Elm_Object_Item *parent,
1057                                         setting_call_back_func gl_sel,
1058                                         void *sel_data,
1059                                         SWALLOW_Type swallow_type,
1060                                         char *l_icon_path,
1061                                         char *r_icon_path, int chk_status,
1062                                         const char *keyStr, char *sub_desc,
1063                                         setting_call_back_func
1064                                         chk_change_cb)
1065 {
1066 //      SETTING_TRACE_BEGIN;
1067         Setting_GenGroupItem_Data *item_data = (
1068                 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1069         setting_retvm_if(!item_data, NULL, "calloc failed");
1070
1071         /* to do formatting customizition in one place */
1072         if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1073             || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1074                 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1075
1076                 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1077                 char* temp1 = (char *)keyStr;
1078                 char*temp2 = strchr(temp1, '&');
1079                 char* temp = NULL;
1080
1081                 while (NULL != temp2) {
1082                         if (0 == safeStrNCmp(temp2, "&amp;", strlen("&amp;")) ||//'&'
1083                             0 == safeStrNCmp(temp2, "&lt;", strlen("&lt;")) ||//'<'
1084                             0 == safeStrNCmp(temp2, "&gt;", strlen("&gt;")) ||//'>'
1085                             0 == safeStrNCmp(temp2, "&quot;", strlen("&quot;")) ||//double quotes
1086                             0 == safeStrNCmp(temp2, "&apos;", strlen("&apos;")) ||//single quotes
1087                             0 == safeStrNCmp(temp2, "&nbsp;", strlen("&nbsp;")) ||//space character
1088                             0 == safeStrNCmp(temp2, "&copy;", strlen("&copy;")) ||//copyright character
1089                             0 == safeStrNCmp(temp2, "&reg;", strlen("&reg;"))//registeration character
1090                            ) {//escape character,do nothing
1091                            temp = temp2 + 1;
1092                            if ('\0' == temp[0]) break;
1093                            temp2 = strchr(temp, '&');
1094                         }
1095                         else
1096                         {
1097                                 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1098                                 g_strlcat(speciliztion, "&amp;", MAX_SPECIALIZITION_LEN);
1099                                 temp1 = temp2 + 1;
1100                                 if ('\0' == temp1[0]) break;
1101                                 temp2 = strchr(temp1, '&');
1102                         }
1103                 }
1104                 if ('\0' != temp1[0]) {
1105                         g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1106                 }
1107
1108
1109                 item_data->keyStr = (char *)g_strdup(speciliztion);
1110         } else {
1111                 item_data->keyStr = (char *)g_strdup(keyStr);
1112         }
1113
1114         item_data->sub_desc = (char *)g_strdup(sub_desc);
1115         item_data->swallow_type = swallow_type;
1116         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1117         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1118         item_data->chk_status = chk_status;
1119         item_data->chk_change_cb = chk_change_cb;
1120
1121         if (gl_sel) {
1122                 item_data->item =
1123                     elm_genlist_item_append(genlist, itc, item_data, parent,
1124                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1125                                             sel_data);
1126         } else {
1127                 item_data->item =
1128                     elm_genlist_item_append(genlist, itc, item_data, parent,
1129                                             ELM_GENLIST_ITEM_NONE,
1130                                             _gl_Gendial_sel, sel_data);
1131
1132                 //help text clicking issue
1133                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1134         }
1135         if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1136                 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1137                                                                 &(itc_sep_line),
1138                                                                 NULL, NULL,
1139                                                                 ELM_GENLIST_ITEM_NONE,
1140                                                                 NULL, NULL);
1141                 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1142                 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1143                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1144         }
1145
1146         return item_data;
1147 }
1148
1149 /**
1150  * Common function to create a genlist item
1151  * @return a pointer to Setting_GenGroupItem_Data
1152  */
1153 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1154                                                             genlist,
1155                                                             const Elm_Genlist_Item_Class *itc,
1156                                                             setting_call_back_func
1157                                                             gl_sel,
1158                                                             void *sel_data,
1159                                                             SWALLOW_Type
1160                                                             swallow_type,
1161                                                             char *l_icon_path,
1162                                                             char *r_icon_path,
1163                                                             int chk_status,
1164                                                             const char *keyStr,
1165                                                             char *sub_desc,
1166                                                             setting_call_back_func chk_change_cb)
1167 {
1168         return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1169                                                       gl_sel, sel_data,
1170                                                       swallow_type, l_icon_path,
1171                                                       r_icon_path, chk_status,
1172                                                       keyStr, sub_desc,
1173                                                       chk_change_cb);
1174 }
1175
1176 /**
1177  * Create 1entry style item
1178  * @return a pointer to Setting_GenGroupItem_Data
1179  */
1180 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(
1181                                                                   Evas_Object * genlist,
1182                                                               const Elm_Genlist_Item_Class *itc,
1183                                                               setting_call_back_func gl_sel,
1184                                                               void *sel_data,
1185                                                               SWALLOW_Type swallow_type,
1186                                                               char *l_icon_path,
1187                                                               char *r_icon_path,
1188                                                               int chk_status,
1189                                                               const char *keyStr,
1190                                                               char *sub_desc,
1191                                                               setting_call_back_func chk_change_cb,
1192                                                               Elm_Input_Panel_Layout input_type,
1193                                                               bool isPasswordFlag,
1194                                                               bool isFocusFlag,
1195                                                               int max_char_count,
1196                                                               int max_byte_count,
1197                                                               char *accepted,
1198                                                               char *rejected)
1199 {
1200         /* SETTING_TRACE_BEGIN; */
1201         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1202         setting_retvm_if(!item_data, NULL, "calloc failed");
1203         item_data->keyStr = (char *)g_strdup(keyStr);
1204         item_data->sub_desc = (char *)g_strdup(sub_desc);
1205         item_data->swallow_type = swallow_type;
1206         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1207         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1208         item_data->chk_status = chk_status;
1209         item_data->chk_change_cb = chk_change_cb;
1210
1211     //setting_call_back_func chk_focus_out_cb,
1212
1213
1214         item_data->input_type = input_type;
1215         item_data->isPasswordFlag = isPasswordFlag;
1216         item_data->isFocusFlag = isFocusFlag;
1217
1218         Elm_Entry_Filter_Accept_Set *digits_filter_data =
1219             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1220         if(!digits_filter_data) {
1221                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1222                 // free allocated data
1223                 G_FREE(item_data->keyStr);
1224                 G_FREE(item_data->sub_desc);
1225                 G_FREE(item_data->l_swallow_path);
1226                 G_FREE(item_data->r_swallow_path);
1227                 FREE(item_data);
1228                 return NULL;
1229         }
1230
1231
1232         Elm_Entry_Filter_Limit_Size *limit_filter_data =
1233             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1234         if(!limit_filter_data) {
1235                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1236
1237                 // free allocated data
1238                 G_FREE(item_data->keyStr);
1239                 G_FREE(item_data->sub_desc);
1240                 G_FREE(item_data->l_swallow_path);
1241                 G_FREE(item_data->r_swallow_path);
1242                 FREE(item_data);
1243                 FREE(digits_filter_data);
1244                 return NULL;
1245         }
1246
1247         limit_filter_data->max_char_count = max_char_count;
1248         limit_filter_data->max_byte_count = max_byte_count;
1249         digits_filter_data->accepted = (char *)g_strdup(accepted);
1250         digits_filter_data->rejected = (char *)g_strdup(rejected);
1251
1252         item_data->digits_filter_data = digits_filter_data;
1253         item_data->limit_filter_data = limit_filter_data;
1254         item_data->userdata = sel_data;
1255
1256         if (gl_sel) {
1257                 item_data->item =
1258                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1259                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1260                                             sel_data);
1261         } else {
1262                 item_data->item =
1263                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1264                                             ELM_GENLIST_ITEM_NONE,
1265                                             _gl_Gendial_sel, sel_data);
1266         }
1267         return item_data;
1268 }
1269
1270 /**
1271  * Create 1entry style item
1272  * focus out
1273  * @return a pointer to Setting_GenGroupItem_Data
1274  */
1275 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo(
1276                                                                   Evas_Object * genlist,
1277                                                               const Elm_Genlist_Item_Class *itc,
1278                                                               setting_call_back_func gl_sel,
1279                                                               void *sel_data,
1280                                                               SWALLOW_Type swallow_type,
1281                                                               char *l_icon_path,
1282                                                               char *r_icon_path,
1283                                                               int chk_status,
1284                                                               const char *keyStr,
1285                                                               char *sub_desc,
1286                                                               setting_call_back_func chk_change_cb,
1287                                                               setting_call_back_func chk_focus_out_cb,
1288                                                               Elm_Input_Panel_Layout input_type,
1289                                                               bool isPasswordFlag,
1290                                                               bool isFocusFlag,
1291                                                               int max_char_count,
1292                                                               int max_byte_count,
1293                                                               char *accepted,
1294                                                               char *rejected)
1295 {
1296         /* SETTING_TRACE_BEGIN; */
1297         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1298         setting_retvm_if(!item_data, NULL, "calloc failed");
1299         item_data->keyStr = (char *)g_strdup(keyStr);
1300         item_data->sub_desc = (char *)g_strdup(sub_desc);
1301         item_data->swallow_type = swallow_type;
1302         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1303         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1304         item_data->chk_status = chk_status;
1305         item_data->chk_change_cb = chk_change_cb;
1306         item_data->stop_change_cb = chk_focus_out_cb;
1307         item_data->isSinglelineFlag = true;
1308     //setting_call_back_func chk_focus_out_cb,
1309
1310         item_data->input_type = input_type;
1311         item_data->isPasswordFlag = isPasswordFlag;
1312         item_data->isFocusFlag = isFocusFlag;
1313
1314         Elm_Entry_Filter_Accept_Set *digits_filter_data =
1315             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1316         if(!digits_filter_data) {
1317                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1318                 // free allocated data
1319                 G_FREE(item_data->keyStr);
1320                 G_FREE(item_data->sub_desc);
1321                 G_FREE(item_data->l_swallow_path);
1322                 G_FREE(item_data->r_swallow_path);
1323                 FREE(item_data);
1324                 return NULL;
1325         }
1326
1327
1328         Elm_Entry_Filter_Limit_Size *limit_filter_data =
1329             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1330         if(!limit_filter_data) {
1331                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1332
1333                 // free allocated data
1334                 G_FREE(item_data->keyStr);
1335                 G_FREE(item_data->sub_desc);
1336                 G_FREE(item_data->l_swallow_path);
1337                 G_FREE(item_data->r_swallow_path);
1338                 FREE(item_data);
1339                 FREE(digits_filter_data);
1340                 return NULL;
1341         }
1342
1343         limit_filter_data->max_char_count = max_char_count;
1344         limit_filter_data->max_byte_count = max_byte_count;
1345         digits_filter_data->accepted = (char *)g_strdup(accepted);
1346         digits_filter_data->rejected = (char *)g_strdup(rejected);
1347
1348         item_data->digits_filter_data = digits_filter_data;
1349         item_data->limit_filter_data = limit_filter_data;
1350         item_data->userdata = sel_data;
1351
1352         if (gl_sel) {
1353                 item_data->item =
1354                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1355                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1356                                             sel_data);
1357         } else {
1358                 item_data->item =
1359                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1360                                             ELM_GENLIST_ITEM_NONE,
1361                                             _gl_Gendial_sel, sel_data);
1362         }
1363         return item_data;
1364 }
1365
1366 /**
1367  * General function to create a parent item of expandable item
1368  *
1369  * @return a pointer to Setting_GenGroupItem_Data
1370  */
1371 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1372                                                 Evas_Object *genlist,
1373                                                 const Elm_Genlist_Item_Class *itc,
1374                                                 setting_call_back_func gl_sel,
1375                                                 void *sel_data,
1376                                                 SWALLOW_Type swallow_type,
1377                                                 const char *keyStr,
1378                                                 char *sub_desc)
1379 {
1380         /* SETTING_TRACE_BEGIN; */
1381         Setting_GenGroupItem_Data *item_data =
1382             (Setting_GenGroupItem_Data *) calloc(1,
1383                                                  sizeof
1384                                                  (Setting_GenGroupItem_Data));
1385         setting_retvm_if(!item_data, NULL, "calloc failed");
1386         item_data->keyStr = (char *)g_strdup(keyStr);
1387         item_data->sub_desc = (char *)g_strdup(sub_desc);
1388         item_data->swallow_type = swallow_type;
1389
1390         if (gl_sel) {
1391                 item_data->item =
1392                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1393                                             ELM_GENLIST_ITEM_TREE, gl_sel,
1394                                             sel_data);
1395         } else {
1396                 item_data->item =
1397                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1398                                             ELM_GENLIST_ITEM_TREE,
1399                                             _gl_Gendial_sel_expand, sel_data);
1400         }
1401         return item_data;
1402 }
1403
1404 /**
1405  * General function to create a subitem of expandable item
1406  *
1407  * @return a pointer to Setting_GenGroupItem_Data
1408  */
1409 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1410                                         Evas_Object *genlist,
1411                                         const Elm_Genlist_Item_Class *itc,
1412                                         setting_call_back_func gl_sel,
1413                                         void *sel_data,
1414                                         Elm_Object_Item *parent,
1415                                         SWALLOW_Type swallow_type,
1416                                         Evas_Object *rgd, int chk_status,
1417                                         const char *keyStr,
1418                                         setting_call_back_func
1419                                         chk_change_cb)
1420 {
1421         /* SETTING_TRACE_BEGIN; */
1422         Setting_GenGroupItem_Data *item_data =
1423             (Setting_GenGroupItem_Data *) calloc(1,
1424                                                  sizeof
1425                                                  (Setting_GenGroupItem_Data));
1426         setting_retvm_if(!item_data, NULL, "calloc failed");
1427         item_data->keyStr = (char *)g_strdup(keyStr);
1428         item_data->swallow_type = swallow_type;
1429         item_data->chk_status = chk_status;
1430         item_data->rgd = rgd;
1431
1432         if (!gl_sel) {
1433                 gl_sel = setting_sub_list_sel_cb;
1434         }
1435         if (!chk_change_cb) {
1436                 chk_change_cb = setting_sub_list_rd_change;
1437         }
1438
1439         item_data->chk_change_cb = chk_change_cb;
1440         item_data->item =
1441             elm_genlist_item_append(genlist, itc, item_data, parent,
1442                                     ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1443         return item_data;
1444 }
1445
1446 /**
1447  * To make genlist support expandable style item
1448  */
1449 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1450                                        setting_call_back_func gl_exp_cb,
1451                                        setting_call_back_func gl_smart_cb)
1452 {
1453         ret_if(NULL == genlist);
1454         elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1455         if (!gl_smart_cb) {
1456                 gl_smart_cb = __exp_list_smart_cb;
1457         }
1458
1459         if (gl_exp_cb)
1460                 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1461         evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1462
1463         evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1464         evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1465 }
1466
1467 /*
1468 example:
1469
1470 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1471                                                         &(networkUG->itc_1text_2icon));
1472
1473 1. create a process genlist item : [intial state is 'PROCESS']
1474 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1475                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1476                                                 SWALLOW_Type_1RADIO_1PROCESS,
1477                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1478                                                 "Searching..", NULL);
1479 or [intial state is 'UNPROCESS']
1480 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1481                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1482                                                 SWALLOW_Type_1RADIO,
1483                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1484                                                 "Searching..", NULL);
1485
1486 2. to set the PROCESS state at any place as you like:
1487 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1488 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1489 */
1490 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1491 {
1492         if (data_item) {
1493                 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1494                         return;
1495                 }
1496
1497                 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1498                 elm_object_item_data_set(data_item->item, data_item);
1499                 elm_genlist_item_update(data_item->item);
1500         }
1501 }
1502
1503 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1504 {
1505         if (data_item) {
1506                 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1507                         return;
1508                 }
1509                 data_item->swallow_type = SWALLOW_Type_1RADIO;
1510                 elm_object_item_data_set(data_item->item, data_item);
1511                 elm_genlist_item_update(data_item->item);
1512         }
1513 }
1514
1515 /**
1516 * Check if some item is selected in done-list
1517 */
1518
1519 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1520 {
1521         SETTING_TRACE_BEGIN;
1522         bool isFound = FALSE;   /* wether can found some item checked */
1523         int idx = 0;
1524         for (; idx < list_data->cur_item_num; idx++) {
1525                 if (list_data->chk_items[idx].data_GenItem->chk_status) {
1526                         isFound = TRUE;
1527                         break;
1528                 }
1529         }
1530         return isFound;
1531 }
1532
1533 static void __setting_done_list_item_sel(void *data)
1534 {
1535         SETTING_TRACE_BEGIN;
1536         retm_if(data == NULL, "data == NULL");
1537         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1538
1539         int sel_num = 0;
1540         int idx = 0;
1541
1542         setting_create_sel_info_popup(list_data->ly_parent,
1543                                       &(list_data->selInfoPop_layout),
1544                                       &(list_data->selInfoPop));
1545
1546         /* else for other checks, do rotinue checking */
1547         bool isFound = FALSE;   /* wether found the item not checked */
1548         for (idx = 0; idx < list_data->cur_item_num; idx++) {
1549                 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1550                         /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1551                         isFound = TRUE;
1552                         /* break; */
1553                 } else {
1554                         /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1555                         sel_num++;
1556                 }
1557         }
1558
1559         if (isFound) {  /* reset state of chk_sel_all */
1560                 list_data->select_all_checked = 0;
1561                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1562         } else {
1563                 list_data->select_all_checked = 1;
1564                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1565         }
1566
1567         /* SETTING_TRACE("sel_num:%d", sel_num); */
1568         if (!sel_num) {
1569                 if (list_data->navi_it) {
1570                         Evas_Object  *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1571                         elm_object_disabled_set(button, EINA_TRUE);
1572                 }
1573                 evas_object_hide(list_data->selInfoPop);
1574                 return;
1575         }
1576
1577         char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1578         snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1579
1580         /*  text set and timeout set */
1581         edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1582
1583         if (list_data->navi_it) {
1584                 Evas_Object  *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1585                 elm_object_disabled_set(button, EINA_FALSE);
1586         }
1587 }
1588
1589 /**
1590 * Do process when clicking the check object in the done-list item
1591 */
1592 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1593                                           void *event_info)
1594 {
1595         SETTING_TRACE_BEGIN;
1596         /* error check */
1597         retm_if(data == NULL, "Data parameter is NULL");
1598         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1599
1600         /* new status */
1601         list_item->chk_status = elm_check_state_get(list_item->eo_check);
1602
1603         Setting_Done_List_Data *list_data = list_item->userdata;
1604         __setting_done_list_item_sel(list_data);
1605 }
1606
1607 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1608                                                   void *event_info)
1609 {
1610         /* error check */
1611         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1612         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1613         elm_genlist_item_selected_set(item, 0);
1614         Setting_GenGroupItem_Data *list_item =
1615             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1616
1617         int old_status = elm_check_state_get(list_item->eo_check);
1618         /* new status */
1619         list_item->chk_status = !old_status;
1620         elm_check_state_set(list_item->eo_check, list_item->chk_status);
1621
1622         /* other process.. */
1623         Setting_Done_List_Data *list_data = list_item->userdata;
1624         __setting_done_list_item_sel(list_data);
1625 }
1626
1627 static void __setting_select_all_done(void *data)
1628 {
1629         SETTING_TRACE_BEGIN;
1630         retm_if(data == NULL, "data == NULL");
1631         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1632
1633         int sel_num = 0;
1634         int idx = 0;
1635
1636         setting_create_sel_info_popup(list_data->ly_parent,
1637                                       &(list_data->selInfoPop_layout),
1638                                       &(list_data->selInfoPop));
1639
1640         if (list_data->select_all_checked) {
1641                 /* set all other checks state to be 1 */
1642                 SETTING_TRACE_DEBUG("Select All checked");
1643                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1644                         list_data->chk_items[idx].data_GenItem->chk_status = 1;
1645                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1646                         elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1647                 }
1648                 sel_num = list_data->cur_item_num;
1649         } else {
1650                 SETTING_TRACE_DEBUG("Select All unchecked");
1651                 /* set all other checks state to be 0 */
1652                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1653                         list_data->chk_items[idx].data_GenItem->chk_status = 0;
1654                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1655                         elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1656                 }
1657                 sel_num = 0;
1658         }
1659
1660         /* SETTING_TRACE("sel_num:%d", sel_num); */
1661         if (!sel_num) {
1662                 if (list_data->navi_it) {
1663                         Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1664                         elm_object_disabled_set(button, EINA_TRUE);
1665                 }
1666
1667                 evas_object_hide(list_data->selInfoPop);
1668                 return;
1669         }
1670         char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1671         snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1672
1673         /*  text set and timeout set */
1674         edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1675
1676         if (list_data->navi_it) {
1677                 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1678                 elm_object_disabled_set(button, EINA_FALSE);
1679         }
1680 }
1681
1682 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1683 {
1684         SETTING_TRACE_BEGIN;
1685         retm_if(data == NULL, "data == NULL");
1686         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1687
1688         list_data->select_all_checked = !list_data->select_all_checked;
1689         elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1690
1691         __setting_select_all_done(list_data);
1692 }
1693
1694 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1695 {
1696         SETTING_TRACE_BEGIN;
1697         retm_if(data == NULL, "data == NULL");
1698         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1699
1700         list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1701         elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1702         __setting_select_all_done(data);
1703 }
1704
1705 /**
1706 * The API to create done-list.
1707 *
1708 * @param[in] list_data
1709 * @return a done-list
1710 */
1711 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1712 {
1713         SETTING_TRACE_BEGIN;
1714         retvm_if(list_data == NULL, NULL, "list_data == NULL");
1715         Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1716         elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1717         evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1718         evas_object_show(sub_layout);
1719
1720         setting_create_Gendial_itc("1text.1icon.3", &(list_data->itc_1text_1icon));
1721
1722         Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1723         retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1724         elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default"); //select_all/default
1725         evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1726         evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1727         evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1728
1729         Eina_Bool select_all_checked = list_data->select_all_checked;
1730         Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1731         elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1732         evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1733         evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1734         elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1735
1736         list_data->select_all_checkbox = select_all_checkbox;
1737         elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1738
1739         Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1740         retvm_if(scroller == NULL, NULL, "scroller == NULL");
1741         elm_genlist_clear(scroller);    /* first to clear list */
1742
1743         elm_object_part_content_set(sub_layout, "search_list", scroller);
1744         elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1745
1746         int index = 0;
1747         for (; index < list_data->cur_item_num; index++) {
1748                 list_data->chk_items[index].data_GenItem =
1749                     setting_create_Gendial_field_def(scroller,
1750                                                      &(list_data->itc_1text_1icon),
1751                                                      setting_done_list_Gendial_mouse_up_cb,
1752                                                      list_data,
1753                                                      SWALLOW_Type_1CHECK, NULL,
1754                                                      NULL, 0,
1755                                                      list_data->chk_items
1756                                                      [index].item_name, NULL,
1757                                                      setting_done_list_Gendial_chk_btn_cb);
1758                 if (list_data->chk_items[index].data_GenItem) {
1759                         list_data->chk_items[index].data_GenItem->userdata = list_data;
1760                 } else {
1761                         SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1762                 }
1763
1764         }
1765
1766         return sub_layout;
1767 }
1768
1769 /**
1770 * To disable a specialized genlist item
1771 *
1772 * @param[in] item
1773 */
1774 void setting_disable_genlist_item(Elm_Object_Item *item)
1775 {
1776         if (item) {
1777                 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1778         }
1779 }
1780
1781 /**
1782 * To enable a specialized genlist item
1783 *
1784 * @param[in] item
1785 */
1786 void setting_enable_genlist_item(Elm_Object_Item *item)
1787 {
1788         if (item) {
1789                 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */
1790         }
1791 }
1792