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