Tizen 2.0 Release
[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_1ICON_1PROCESS, __add_left_default},
800         {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
801 };
802 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
803         //right part object of the type
804         {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
805         {SWALLOW_Type_1ICON_1PROCESS, __add_process},
806         {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
807 };
808
809 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
810         //end part object of the type
811         {SWALLOW_Type_1RADIO, __add_radio},
812 };
813 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
814         {"elm.icon", __cd_left},
815         {"elm.icon.1", __cd_left},
816         {"elm.icon.2", __cd_right},
817         {"elm.swallow.end", __cd_end},
818 };*/
819
820 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
821                                          const char *part)
822 {
823         retv_if(!data, NULL);
824         Setting_GenGroupItem_Data *item_data = data;
825         retv_if(!data, NULL);
826         __Content_Drawer *cd_list = NULL;
827         __drawer_fp fp = NULL;
828         if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
829         {
830                 fp = __add_left_default; //hold default drawer
831                 cd_list = __cd_left;
832         }
833         else if (!safeStrCmp(part, "elm.icon.2"))
834         {
835                 fp = __add_right_default; //hold default drawer
836                 cd_list = __cd_right;
837         }
838         else if (!safeStrCmp(part, "elm.swallow.end"))
839         {
840                 //the default value of fp is NULL here
841                 cd_list = __cd_end;
842         }
843         if (!cd_list) return NULL;//invalid part
844
845         int idx = 0;
846         for (; idx < SWALLOW_Type_MAX; idx++)
847         {
848                 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
849                 {
850                         fp = cd_list[idx].draw;
851                         break;
852                 }
853         }
854         return fp ? fp(item_data, obj) : NULL;
855 }
856
857 static void _gl_Gendial_del(void *data, Evas_Object *obj)
858 {
859         /* SETTING_TRACE_BEGIN; */
860         Setting_GenGroupItem_Data *item_data =
861             (Setting_GenGroupItem_Data *) data;
862         if (item_data) {
863                 G_FREE(item_data->keyStr);
864                 G_FREE(item_data->sub_desc);
865                 G_FREE((item_data->l_swallow_path));
866                 G_FREE((item_data->r_swallow_path));
867                 G_FREE(item_data->item_style);
868
869
870                 if (item_data->digits_filter_data)
871                 {
872                         G_FREE(item_data->digits_filter_data->accepted);
873                         G_FREE(item_data->digits_filter_data->rejected);
874                         FREE(item_data->digits_filter_data);
875
876                 }
877
878                 if (item_data->notify) {
879                         evas_object_del(item_data->notify);
880                         item_data->notify = NULL;
881                 }
882
883                 FREE(item_data->limit_filter_data);
884                 __BACK_POINTER_UNSET(item_data);
885                 FREE(item_data);
886         }
887         /* SETTING_TRACE_END; */
888 }
889
890 /**
891  * To intialize an Elm_Genlist_Item_Class, according to item style
892  *
893  * @param[in] item_style
894  * @param[in/out] itc
895  */
896 bool setting_create_Gendial_itc(const char *item_style,
897                                 Elm_Genlist_Item_Class *itc)
898 {
899         itc->item_style = item_style;
900         itc->func.text_get = _gl_Gendial_text_get;
901         itc->func.content_get = _gl_Gendial_content_get;
902         itc->func.state_get = NULL;
903         itc->func.del = _gl_Gendial_del;        /* _gl_Gendial_del; */
904         return TRUE;
905 }
906
907 /**
908  * Create group style item
909  *
910  * @return a pointer to Setting_GenGroupItem_Data
911  */
912 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
913                                                 const Elm_Genlist_Item_Class *itc,
914                                                 Elm_Object_Item *parent,
915                                                 Elm_Genlist_Item_Type flag,     /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
916                                                 const char *keyStr,
917                                                 setting_call_back_func gl_sel)
918 {
919         /* SETTING_TRACE_BEGIN; */
920         Setting_GenGroupItem_Data *item_data =
921             (Setting_GenGroupItem_Data *) calloc(1,
922                                                  sizeof
923                                                  (Setting_GenGroupItem_Data));
924         setting_retvm_if(!item_data, NULL, "calloc failed");
925         item_data->keyStr = (char *)g_strdup(keyStr);
926         if (gl_sel) {
927                 item_data->item =
928                     elm_genlist_item_append(genlist, itc, item_data, parent,
929                                             flag, gl_sel, NULL);
930         } else {
931                 item_data->item =
932                     elm_genlist_item_append(genlist, itc, item_data, parent,
933                                             flag, _gl_Gendial_sel, NULL);
934         }
935         return item_data;
936 }
937
938 /**
939  * Create separator style item with title
940  *
941  * @return a pointer to Setting_GenGroupItem_Data
942  */
943 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
944                                                 Evas_Object *genlist,
945                                                 const Elm_Genlist_Item_Class *itc,
946                                                 const char *keyStr,
947                                                 setting_call_back_func gl_sel)
948 {
949         /* SETTING_TRACE_BEGIN; */
950         Setting_GenGroupItem_Data *item_data =
951             (Setting_GenGroupItem_Data *) calloc(1,
952                                                  sizeof
953                                                  (Setting_GenGroupItem_Data));
954         setting_retvm_if(!item_data, NULL, "calloc failed");
955         item_data->keyStr = (char *)g_strdup(keyStr);
956         if (gl_sel) {
957                 item_data->item =
958                     elm_genlist_item_append(genlist, itc, item_data, NULL,
959                                             ELM_GENLIST_ITEM_NONE, gl_sel,
960                                             NULL);
961         } else {
962                 item_data->item =
963                     elm_genlist_item_append(genlist, itc, item_data, NULL,
964                                             ELM_GENLIST_ITEM_NONE,
965                                             _gl_Gendial_sel, NULL);
966         }
967         return item_data;
968 }
969
970 /**
971  * Create 1radio-1text style item
972  *
973  * @return a pointer to Setting_GenGroupItem_Data
974  */
975
976 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
977                                         Evas_Object *genlist,
978                                         const Elm_Genlist_Item_Class *itc,
979                                         setting_call_back_func gl_sel,
980                                         void *sel_data,
981                                         SWALLOW_Type swallow_type,
982                                         Evas_Object *rgd, int chk_status,
983                                         const char *keyStr,
984                                         setting_call_back_func chk_change_cb)
985 {
986         /* SETTING_TRACE_BEGIN; */
987         Setting_GenGroupItem_Data *item_data =
988             (Setting_GenGroupItem_Data *) calloc(1,
989                                                  sizeof
990                                                  (Setting_GenGroupItem_Data));
991         setting_retvm_if(!item_data, NULL, "calloc failed");
992         item_data->keyStr = (char *)g_strdup(keyStr);
993         item_data->swallow_type = swallow_type;
994         item_data->chk_status = chk_status;
995         item_data->chk_change_cb = chk_change_cb;
996         item_data->rgd = rgd;
997
998         if (gl_sel) {
999                 item_data->item =
1000                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1001                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1002                                             sel_data);
1003         } else {
1004                 item_data->item =
1005                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1006                                             ELM_GENLIST_ITEM_NONE,
1007                                             _gl_Gendial_sel, sel_data);
1008         }
1009         return item_data;
1010 }
1011
1012 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1013                                         Evas_Object *genlist,
1014                                         const Elm_Genlist_Item_Class *itc,
1015                                         setting_call_back_func gl_sel,
1016                                         void *sel_data,
1017                                         SWALLOW_Type swallow_type,
1018                                         Evas_Object *rgd, int chk_status,
1019                                         const char *keyStr,
1020                                         const char *sub_desc,
1021                                         setting_call_back_func chk_change_cb)
1022 {
1023         /* SETTING_TRACE_BEGIN; */
1024         Setting_GenGroupItem_Data *item_data =
1025             (Setting_GenGroupItem_Data *) calloc(1,
1026                                                  sizeof
1027                                                  (Setting_GenGroupItem_Data));
1028         setting_retvm_if(!item_data, NULL, "calloc failed");
1029         item_data->keyStr = (char *)g_strdup(keyStr);
1030         item_data->sub_desc = (char *)g_strdup(sub_desc);
1031         item_data->swallow_type = swallow_type;
1032         item_data->chk_status = chk_status;
1033         item_data->chk_change_cb = chk_change_cb;
1034         item_data->rgd = rgd;
1035
1036         if (gl_sel) {
1037                 item_data->item =
1038                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1039                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1040                                             sel_data);
1041         } else {
1042                 item_data->item =
1043                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1044                                             ELM_GENLIST_ITEM_NONE,
1045                                             _gl_Gendial_sel, sel_data);
1046         }
1047         return item_data;
1048 }
1049
1050 /**
1051  * Create common style item with menu icon
1052  *
1053  * @return a pointer to Setting_GenGroupItem_Data
1054  */
1055 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1056                                         Evas_Object *genlist,
1057                                         const Elm_Genlist_Item_Class *itc,
1058                                         Elm_Object_Item *parent,
1059                                         setting_call_back_func gl_sel,
1060                                         void *sel_data,
1061                                         SWALLOW_Type swallow_type,
1062                                         char *l_icon_path,
1063                                         char *r_icon_path, int chk_status,
1064                                         const char *keyStr, char *sub_desc,
1065                                         setting_call_back_func
1066                                         chk_change_cb)
1067 {
1068 //      SETTING_TRACE_BEGIN;
1069         Setting_GenGroupItem_Data *item_data = (
1070                 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1071         setting_retvm_if(!item_data, NULL, "calloc failed");
1072
1073         /* to do formatting customizition in one place */
1074         if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1075             || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1076                 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1077
1078                 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1079                 char* temp1 = (char *)keyStr;
1080                 char*temp2 = strchr(temp1, '&');
1081                 char* temp = NULL;
1082
1083                 while (NULL != temp2) {
1084                         if (0 == safeStrNCmp(temp2, "&amp;", strlen("&amp;")) ||//'&'
1085                             0 == safeStrNCmp(temp2, "&lt;", strlen("&lt;")) ||//'<'
1086                             0 == safeStrNCmp(temp2, "&gt;", strlen("&gt;")) ||//'>'
1087                             0 == safeStrNCmp(temp2, "&quot;", strlen("&quot;")) ||//double quotes
1088                             0 == safeStrNCmp(temp2, "&apos;", strlen("&apos;")) ||//single quotes
1089                             0 == safeStrNCmp(temp2, "&nbsp;", strlen("&nbsp;")) ||//space character
1090                             0 == safeStrNCmp(temp2, "&copy;", strlen("&copy;")) ||//copyright character
1091                             0 == safeStrNCmp(temp2, "&reg;", strlen("&reg;"))//registeration character
1092                            ) {//escape character,do nothing
1093                            temp = temp2 + 1;
1094                            if ('\0' == temp[0]) break;
1095                            temp2 = strchr(temp, '&');
1096                         }
1097                         else
1098                         {
1099                                 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1100                                 g_strlcat(speciliztion, "&amp;", MAX_SPECIALIZITION_LEN);
1101                                 temp1 = temp2 + 1;
1102                                 if ('\0' == temp1[0]) break;
1103                                 temp2 = strchr(temp1, '&');
1104                         }
1105                 }
1106                 if ('\0' != temp1[0]) {
1107                         g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1108                 }
1109
1110
1111                 item_data->keyStr = (char *)g_strdup(speciliztion);
1112         } else {
1113                 item_data->keyStr = (char *)g_strdup(keyStr);
1114         }
1115
1116         item_data->sub_desc = (char *)g_strdup(sub_desc);
1117         item_data->swallow_type = swallow_type;
1118         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1119         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1120         item_data->chk_status = chk_status;
1121         item_data->chk_change_cb = chk_change_cb;
1122
1123         if (gl_sel) {
1124                 item_data->item =
1125                     elm_genlist_item_append(genlist, itc, item_data, parent,
1126                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1127                                             sel_data);
1128         } else {
1129                 item_data->item =
1130                     elm_genlist_item_append(genlist, itc, item_data, parent,
1131                                             ELM_GENLIST_ITEM_NONE,
1132                                             _gl_Gendial_sel, sel_data);
1133
1134                 //help text clicking issue
1135                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1136         }
1137         if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1138                 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1139                                                                 &(itc_sep_line),
1140                                                                 NULL, NULL,
1141                                                                 ELM_GENLIST_ITEM_NONE,
1142                                                                 NULL, NULL);
1143                 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1144                 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1145                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1146         }
1147
1148         return item_data;
1149 }
1150
1151 /**
1152  * Common function to create a genlist item
1153  * @return a pointer to Setting_GenGroupItem_Data
1154  */
1155 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1156                                                             genlist,
1157                                                             const Elm_Genlist_Item_Class *itc,
1158                                                             setting_call_back_func
1159                                                             gl_sel,
1160                                                             void *sel_data,
1161                                                             SWALLOW_Type
1162                                                             swallow_type,
1163                                                             char *l_icon_path,
1164                                                             char *r_icon_path,
1165                                                             int chk_status,
1166                                                             const char *keyStr,
1167                                                             char *sub_desc,
1168                                                             setting_call_back_func chk_change_cb)
1169 {
1170         return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1171                                                       gl_sel, sel_data,
1172                                                       swallow_type, l_icon_path,
1173                                                       r_icon_path, chk_status,
1174                                                       keyStr, sub_desc,
1175                                                       chk_change_cb);
1176 }
1177
1178 /**
1179  * Create 1entry style item
1180  * @return a pointer to Setting_GenGroupItem_Data
1181  */
1182 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(
1183                                                                   Evas_Object * genlist,
1184                                                               const Elm_Genlist_Item_Class *itc,
1185                                                               setting_call_back_func gl_sel,
1186                                                               void *sel_data,
1187                                                               SWALLOW_Type swallow_type,
1188                                                               char *l_icon_path,
1189                                                               char *r_icon_path,
1190                                                               int chk_status,
1191                                                               const char *keyStr,
1192                                                               char *sub_desc,
1193                                                               setting_call_back_func chk_change_cb,
1194                                                               Elm_Input_Panel_Layout input_type,
1195                                                               bool isPasswordFlag,
1196                                                               bool isFocusFlag,
1197                                                               int max_char_count,
1198                                                               int max_byte_count,
1199                                                               char *accepted,
1200                                                               char *rejected)
1201 {
1202         /* SETTING_TRACE_BEGIN; */
1203         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1204         setting_retvm_if(!item_data, NULL, "calloc failed");
1205         item_data->keyStr = (char *)g_strdup(keyStr);
1206         item_data->sub_desc = (char *)g_strdup(sub_desc);
1207         item_data->swallow_type = swallow_type;
1208         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1209         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1210         item_data->chk_status = chk_status;
1211         item_data->chk_change_cb = chk_change_cb;
1212
1213     //setting_call_back_func chk_focus_out_cb,
1214
1215
1216         item_data->input_type = input_type;
1217         item_data->isPasswordFlag = isPasswordFlag;
1218         item_data->isFocusFlag = isFocusFlag;
1219
1220         Elm_Entry_Filter_Accept_Set *digits_filter_data =
1221             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1222         if(!digits_filter_data) {
1223                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1224                 // free allocated data
1225                 G_FREE(item_data->keyStr);
1226                 G_FREE(item_data->sub_desc);
1227                 G_FREE(item_data->l_swallow_path);
1228                 G_FREE(item_data->r_swallow_path);
1229                 FREE(item_data);
1230                 return NULL;
1231         }
1232
1233
1234         Elm_Entry_Filter_Limit_Size *limit_filter_data =
1235             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1236         if(!limit_filter_data) {
1237                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1238
1239                 // free allocated data
1240                 G_FREE(item_data->keyStr);
1241                 G_FREE(item_data->sub_desc);
1242                 G_FREE(item_data->l_swallow_path);
1243                 G_FREE(item_data->r_swallow_path);
1244                 FREE(item_data);
1245                 FREE(digits_filter_data);
1246                 return NULL;
1247         }
1248
1249         limit_filter_data->max_char_count = max_char_count;
1250         limit_filter_data->max_byte_count = max_byte_count;
1251         digits_filter_data->accepted = (char *)g_strdup(accepted);
1252         digits_filter_data->rejected = (char *)g_strdup(rejected);
1253
1254         item_data->digits_filter_data = digits_filter_data;
1255         item_data->limit_filter_data = limit_filter_data;
1256         item_data->userdata = sel_data;
1257
1258         if (gl_sel) {
1259                 item_data->item =
1260                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1261                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1262                                             sel_data);
1263         } else {
1264                 item_data->item =
1265                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1266                                             ELM_GENLIST_ITEM_NONE,
1267                                             _gl_Gendial_sel, sel_data);
1268         }
1269         return item_data;
1270 }
1271
1272 /**
1273  * Create 1entry style item
1274  * focus out
1275  * @return a pointer to Setting_GenGroupItem_Data
1276  */
1277 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo(
1278                                                                   Evas_Object * genlist,
1279                                                               const Elm_Genlist_Item_Class *itc,
1280                                                               setting_call_back_func gl_sel,
1281                                                               void *sel_data,
1282                                                               SWALLOW_Type swallow_type,
1283                                                               char *l_icon_path,
1284                                                               char *r_icon_path,
1285                                                               int chk_status,
1286                                                               const char *keyStr,
1287                                                               char *sub_desc,
1288                                                               setting_call_back_func chk_change_cb,
1289                                                               setting_call_back_func chk_focus_out_cb,
1290                                                               Elm_Input_Panel_Layout input_type,
1291                                                               bool isPasswordFlag,
1292                                                               bool isFocusFlag,
1293                                                               int max_char_count,
1294                                                               int max_byte_count,
1295                                                               char *accepted,
1296                                                               char *rejected)
1297 {
1298         /* SETTING_TRACE_BEGIN; */
1299         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1300         setting_retvm_if(!item_data, NULL, "calloc failed");
1301         item_data->keyStr = (char *)g_strdup(keyStr);
1302         item_data->sub_desc = (char *)g_strdup(sub_desc);
1303         item_data->swallow_type = swallow_type;
1304         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1305         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1306         item_data->chk_status = chk_status;
1307         item_data->chk_change_cb = chk_change_cb;
1308         item_data->stop_change_cb = chk_focus_out_cb;
1309         item_data->isSinglelineFlag = true;
1310     //setting_call_back_func chk_focus_out_cb,
1311
1312         item_data->input_type = input_type;
1313         item_data->isPasswordFlag = isPasswordFlag;
1314         item_data->isFocusFlag = isFocusFlag;
1315
1316         Elm_Entry_Filter_Accept_Set *digits_filter_data =
1317             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1318         if(!digits_filter_data) {
1319                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1320                 // free allocated data
1321                 G_FREE(item_data->keyStr);
1322                 G_FREE(item_data->sub_desc);
1323                 G_FREE(item_data->l_swallow_path);
1324                 G_FREE(item_data->r_swallow_path);
1325                 FREE(item_data);
1326                 return NULL;
1327         }
1328
1329
1330         Elm_Entry_Filter_Limit_Size *limit_filter_data =
1331             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1332         if(!limit_filter_data) {
1333                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1334
1335                 // free allocated data
1336                 G_FREE(item_data->keyStr);
1337                 G_FREE(item_data->sub_desc);
1338                 G_FREE(item_data->l_swallow_path);
1339                 G_FREE(item_data->r_swallow_path);
1340                 FREE(item_data);
1341                 FREE(digits_filter_data);
1342                 return NULL;
1343         }
1344
1345         limit_filter_data->max_char_count = max_char_count;
1346         limit_filter_data->max_byte_count = max_byte_count;
1347         digits_filter_data->accepted = (char *)g_strdup(accepted);
1348         digits_filter_data->rejected = (char *)g_strdup(rejected);
1349
1350         item_data->digits_filter_data = digits_filter_data;
1351         item_data->limit_filter_data = limit_filter_data;
1352         item_data->userdata = sel_data;
1353
1354         if (gl_sel) {
1355                 item_data->item =
1356                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1357                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1358                                             sel_data);
1359         } else {
1360                 item_data->item =
1361                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1362                                             ELM_GENLIST_ITEM_NONE,
1363                                             _gl_Gendial_sel, sel_data);
1364         }
1365         return item_data;
1366 }
1367
1368 /**
1369  * General function to create a parent item of expandable item
1370  *
1371  * @return a pointer to Setting_GenGroupItem_Data
1372  */
1373 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1374                                                 Evas_Object *genlist,
1375                                                 const Elm_Genlist_Item_Class *itc,
1376                                                 setting_call_back_func gl_sel,
1377                                                 void *sel_data,
1378                                                 SWALLOW_Type swallow_type,
1379                                                 const char *keyStr,
1380                                                 char *sub_desc)
1381 {
1382         /* SETTING_TRACE_BEGIN; */
1383         Setting_GenGroupItem_Data *item_data =
1384             (Setting_GenGroupItem_Data *) calloc(1,
1385                                                  sizeof
1386                                                  (Setting_GenGroupItem_Data));
1387         setting_retvm_if(!item_data, NULL, "calloc failed");
1388         item_data->keyStr = (char *)g_strdup(keyStr);
1389         item_data->sub_desc = (char *)g_strdup(sub_desc);
1390         item_data->swallow_type = swallow_type;
1391
1392         if (gl_sel) {
1393                 item_data->item =
1394                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1395                                             ELM_GENLIST_ITEM_TREE, gl_sel,
1396                                             sel_data);
1397         } else {
1398                 item_data->item =
1399                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1400                                             ELM_GENLIST_ITEM_TREE,
1401                                             _gl_Gendial_sel_expand, sel_data);
1402         }
1403         return item_data;
1404 }
1405
1406 /**
1407  * General function to create a subitem of expandable item
1408  *
1409  * @return a pointer to Setting_GenGroupItem_Data
1410  */
1411 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1412                                         Evas_Object *genlist,
1413                                         const Elm_Genlist_Item_Class *itc,
1414                                         setting_call_back_func gl_sel,
1415                                         void *sel_data,
1416                                         Elm_Object_Item *parent,
1417                                         SWALLOW_Type swallow_type,
1418                                         Evas_Object *rgd, int chk_status,
1419                                         const char *keyStr,
1420                                         setting_call_back_func
1421                                         chk_change_cb)
1422 {
1423         /* SETTING_TRACE_BEGIN; */
1424         Setting_GenGroupItem_Data *item_data =
1425             (Setting_GenGroupItem_Data *) calloc(1,
1426                                                  sizeof
1427                                                  (Setting_GenGroupItem_Data));
1428         setting_retvm_if(!item_data, NULL, "calloc failed");
1429         item_data->keyStr = (char *)g_strdup(keyStr);
1430         item_data->swallow_type = swallow_type;
1431         item_data->chk_status = chk_status;
1432         item_data->rgd = rgd;
1433
1434         if (!gl_sel) {
1435                 gl_sel = setting_sub_list_sel_cb;
1436         }
1437         if (!chk_change_cb) {
1438                 chk_change_cb = setting_sub_list_rd_change;
1439         }
1440
1441         item_data->chk_change_cb = chk_change_cb;
1442         item_data->item =
1443             elm_genlist_item_append(genlist, itc, item_data, parent,
1444                                     ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1445         return item_data;
1446 }
1447
1448 /**
1449  * To make genlist support expandable style item
1450  */
1451 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1452                                        setting_call_back_func gl_exp_cb,
1453                                        setting_call_back_func gl_smart_cb)
1454 {
1455         ret_if(NULL == genlist);
1456         elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1457         if (!gl_smart_cb) {
1458                 gl_smart_cb = __exp_list_smart_cb;
1459         }
1460
1461         if (gl_exp_cb)
1462                 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1463         evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1464
1465         evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1466         evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1467 }
1468
1469 /*
1470 example:
1471
1472 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1473                                                         &(networkUG->itc_1text_2icon));
1474
1475 1. create a process genlist item : [intial state is 'PROCESS']
1476 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1477                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1478                                                 SWALLOW_Type_1RADIO_1PROCESS,
1479                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1480                                                 "Searching..", NULL);
1481 or [intial state is 'UNPROCESS']
1482 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1483                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1484                                                 SWALLOW_Type_1RADIO,
1485                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1486                                                 "Searching..", NULL);
1487
1488 2. to set the PROCESS state at any place as you like:
1489 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1490 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1491 */
1492 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1493 {
1494         if (data_item) {
1495                 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1496                         return;
1497                 }
1498
1499                 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1500                 elm_object_item_data_set(data_item->item, data_item);
1501                 elm_genlist_item_update(data_item->item);
1502         }
1503 }
1504
1505 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1506 {
1507         if (data_item) {
1508                 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1509                         return;
1510                 }
1511                 data_item->swallow_type = SWALLOW_Type_1RADIO;
1512                 elm_object_item_data_set(data_item->item, data_item);
1513                 elm_genlist_item_update(data_item->item);
1514         }
1515 }
1516
1517 /**
1518 * Check if some item is selected in done-list
1519 */
1520
1521 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1522 {
1523         SETTING_TRACE_BEGIN;
1524         bool isFound = FALSE;   /* wether can found some item checked */
1525         int idx = 0;
1526         for (; idx < list_data->cur_item_num; idx++) {
1527                 if (list_data->chk_items[idx].data_GenItem->chk_status) {
1528                         isFound = TRUE;
1529                         break;
1530                 }
1531         }
1532         return isFound;
1533 }
1534
1535 static void __setting_done_list_item_sel(void *data)
1536 {
1537         SETTING_TRACE_BEGIN;
1538         retm_if(data == NULL, "data == NULL");
1539         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1540
1541         int sel_num = 0;
1542         int idx = 0;
1543
1544         setting_create_sel_info_popup(list_data->ly_parent,
1545                                       &(list_data->selInfoPop_layout),
1546                                       &(list_data->selInfoPop));
1547
1548         /* else for other checks, do rotinue checking */
1549         bool isFound = FALSE;   /* wether found the item not checked */
1550         for (idx = 0; idx < list_data->cur_item_num; idx++) {
1551                 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1552                         /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1553                         isFound = TRUE;
1554                         /* break; */
1555                 } else {
1556                         /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1557                         sel_num++;
1558                 }
1559         }
1560
1561         if (isFound) {  /* reset state of chk_sel_all */
1562                 list_data->select_all_checked = 0;
1563                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1564         } else {
1565                 list_data->select_all_checked = 1;
1566                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1567         }
1568
1569         /* SETTING_TRACE("sel_num:%d", sel_num); */
1570         if (!sel_num) {
1571                 if (list_data->navi_it) {
1572                         Evas_Object  *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1573                         elm_object_disabled_set(button, EINA_TRUE);
1574                 }
1575                 evas_object_hide(list_data->selInfoPop);
1576                 return;
1577         }
1578
1579         char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1580         snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1581
1582         /*  text set and timeout set */
1583         edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1584
1585         if (list_data->navi_it) {
1586                 Evas_Object  *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1587                 elm_object_disabled_set(button, EINA_FALSE);
1588         }
1589 }
1590
1591 /**
1592 * Do process when clicking the check object in the done-list item
1593 */
1594 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1595                                           void *event_info)
1596 {
1597         SETTING_TRACE_BEGIN;
1598         /* error check */
1599         retm_if(data == NULL, "Data parameter is NULL");
1600         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1601
1602         /* new status */
1603         list_item->chk_status = elm_check_state_get(list_item->eo_check);
1604
1605         Setting_Done_List_Data *list_data = list_item->userdata;
1606         __setting_done_list_item_sel(list_data);
1607 }
1608
1609 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1610                                                   void *event_info)
1611 {
1612         /* error check */
1613         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1614         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1615         elm_genlist_item_selected_set(item, 0);
1616         Setting_GenGroupItem_Data *list_item =
1617             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1618
1619         int old_status = elm_check_state_get(list_item->eo_check);
1620         /* new status */
1621         list_item->chk_status = !old_status;
1622         elm_check_state_set(list_item->eo_check, list_item->chk_status);
1623
1624         /* other process.. */
1625         Setting_Done_List_Data *list_data = list_item->userdata;
1626         __setting_done_list_item_sel(list_data);
1627 }
1628
1629 static void __setting_select_all_done(void *data)
1630 {
1631         SETTING_TRACE_BEGIN;
1632         retm_if(data == NULL, "data == NULL");
1633         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1634
1635         int sel_num = 0;
1636         int idx = 0;
1637
1638         setting_create_sel_info_popup(list_data->ly_parent,
1639                                       &(list_data->selInfoPop_layout),
1640                                       &(list_data->selInfoPop));
1641
1642         if (list_data->select_all_checked) {
1643                 /* set all other checks state to be 1 */
1644                 SETTING_TRACE_DEBUG("Select All checked");
1645                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1646                         list_data->chk_items[idx].data_GenItem->chk_status = 1;
1647                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1648                         elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1649                 }
1650                 sel_num = list_data->cur_item_num;
1651         } else {
1652                 SETTING_TRACE_DEBUG("Select All unchecked");
1653                 /* set all other checks state to be 0 */
1654                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1655                         list_data->chk_items[idx].data_GenItem->chk_status = 0;
1656                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1657                         elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1658                 }
1659                 sel_num = 0;
1660         }
1661
1662         /* SETTING_TRACE("sel_num:%d", sel_num); */
1663         if (!sel_num) {
1664                 if (list_data->navi_it) {
1665                         Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1666                         elm_object_disabled_set(button, EINA_TRUE);
1667                 }
1668
1669                 evas_object_hide(list_data->selInfoPop);
1670                 return;
1671         }
1672         char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1673         snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1674
1675         /*  text set and timeout set */
1676         edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1677
1678         if (list_data->navi_it) {
1679                 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1680                 elm_object_disabled_set(button, EINA_FALSE);
1681         }
1682 }
1683
1684 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1685 {
1686         SETTING_TRACE_BEGIN;
1687         retm_if(data == NULL, "data == NULL");
1688         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1689
1690         list_data->select_all_checked = !list_data->select_all_checked;
1691         elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1692
1693         __setting_select_all_done(list_data);
1694 }
1695
1696 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1697 {
1698         SETTING_TRACE_BEGIN;
1699         retm_if(data == NULL, "data == NULL");
1700         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1701
1702         list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1703         elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1704         __setting_select_all_done(data);
1705 }
1706
1707 /**
1708 * The API to create done-list.
1709 *
1710 * @param[in] list_data
1711 * @return a done-list
1712 */
1713 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1714 {
1715         SETTING_TRACE_BEGIN;
1716         retvm_if(list_data == NULL, NULL, "list_data == NULL");
1717         Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1718         elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1719         evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1720         evas_object_show(sub_layout);
1721
1722         setting_create_Gendial_itc("1text.1icon.3", &(list_data->itc_1text_1icon));
1723
1724         Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1725         retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1726         elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default"); //select_all/default
1727         evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1728         evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1729         evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1730
1731         Eina_Bool select_all_checked = list_data->select_all_checked;
1732         Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1733         elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1734         evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1735         evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1736         elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1737
1738         list_data->select_all_checkbox = select_all_checkbox;
1739         elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1740
1741         Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1742         retvm_if(scroller == NULL, NULL, "scroller == NULL");
1743         elm_genlist_clear(scroller);    /* first to clear list */
1744
1745         elm_object_part_content_set(sub_layout, "search_list", scroller);
1746         elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1747
1748         int index = 0;
1749         for (; index < list_data->cur_item_num; index++) {
1750                 list_data->chk_items[index].data_GenItem =
1751                     setting_create_Gendial_field_def(scroller,
1752                                                      &(list_data->itc_1text_1icon),
1753                                                      setting_done_list_Gendial_mouse_up_cb,
1754                                                      list_data,
1755                                                      SWALLOW_Type_1CHECK, NULL,
1756                                                      NULL, 0,
1757                                                      list_data->chk_items
1758                                                      [index].item_name, NULL,
1759                                                      setting_done_list_Gendial_chk_btn_cb);
1760                 if (list_data->chk_items[index].data_GenItem) {
1761                         list_data->chk_items[index].data_GenItem->userdata = list_data;
1762                 } else {
1763                         SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1764                 }
1765
1766         }
1767
1768         return sub_layout;
1769 }
1770
1771 /**
1772 * To disable a specialized genlist item
1773 *
1774 * @param[in] item
1775 */
1776 void setting_disable_genlist_item(Elm_Object_Item *item)
1777 {
1778         if (item) {
1779                 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1780         }
1781 }
1782
1783 /**
1784 * To enable a specialized genlist item
1785 *
1786 * @param[in] item
1787 */
1788 void setting_enable_genlist_item(Elm_Object_Item *item)
1789 {
1790         if (item) {
1791                 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */
1792         }
1793 }
1794