fix for applying wayland (removing X)
[apps/home/settings.git] / setting-common / src / setting-common-draw-genlist.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <setting-common-draw-widget.h>
22 #include <glib.h>
23 #include <system_settings.h>
24 #include <efl_assist.h>
25 #include <setting-debug.h>
26
27 #define DEF_BUF_SIZE 32
28
29 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
30 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
31 static void _gl_Gendial_del(void *data, Evas_Object *obj);
32
33 EXPORT_PUBLIC
34 const Elm_Genlist_Item_Class itc_seperator = {
35         .item_style = "dialogue/separator.transparent.2",
36         .func.text_get = NULL,
37         .func.content_get = NULL,
38         .func.state_get = NULL,
39         .func.del = NULL,
40 };
41
42 EXPORT_PUBLIC
43 const Elm_Genlist_Item_Class itc_bottom_seperator = {
44         .item_style = NULL,
45         .func.text_get = NULL,
46         .func.content_get = NULL,
47         .func.state_get = NULL,
48         .func.del = NULL,
49 };
50
51 EXPORT_PUBLIC
52 const Elm_Genlist_Item_Class itc_sep_line = {
53         .item_style = "dialogue/separator.transparent.2",
54         .func.text_get = _gl_Gendial_text_get,
55         .func.content_get = NULL,
56         .func.state_get = NULL,
57         .func.del = NULL,
58 };
59
60 EXPORT_PUBLIC
61 const Elm_Genlist_Item_Class itc_bottom_line = {
62         .item_style = "bottom_line",
63         .func.text_get = NULL,
64         .func.content_get = NULL,
65         .func.state_get = NULL,
66         .func.del = NULL,
67 };
68
69 #define DEFINE_ITC1(style, name) \
70         EXPORT_PUBLIC const Elm_Genlist_Item_Class name = {\
71                                                            .item_style = style,\
72                                                            .func.text_get = _gl_Gendial_text_get,\
73                                                            .func.content_get = _gl_Gendial_content_get,\
74                                                            .func.state_get = NULL,\
75                                                            .func.del = _gl_Gendial_del,\
76                                                           };
77
78 DEFINE_ITC1("1line", itc_1text);
79 DEFINE_ITC1("1line", itc_1text_1icon_2);
80 DEFINE_ITC1("1line", itc_1text_1icon_2_tb);
81
82 DEFINE_ITC1("dialogue/editfield/title", itc_dialogue_editfield_title);
83 DEFINE_ITC1("1icon", itc_1icon);
84 DEFINE_ITC1("1line", itc_1icon_1text_sub);
85 DEFINE_ITC1("1line", itc_1text_1icon);
86 DEFINE_ITC1("1line", itc_1text_1icon_3);
87 DEFINE_ITC1("1line", itc_1text_2icon);
88 DEFINE_ITC1("1line", itc_1text_2icon_2);
89 DEFINE_ITC1("1line", itc_1text_2icon_10);
90
91 DEFINE_ITC1("2line.top", itc_2text_2);
92 DEFINE_ITC1("2line.top", itc_2text);
93 DEFINE_ITC1("multiline_sub.main", itc_multiline_2text_1icon);
94 DEFINE_ITC1("2line.top", itc_2text_1icon_3);
95 DEFINE_ITC1("2line.top", itc_2text_1icon_2);
96 DEFINE_ITC1("2line.top", itc_2text_1icon_6);
97 DEFINE_ITC1("2line.top", itc_2text_1icon_7);
98 DEFINE_ITC1("2line.top", itc_2text_1icon_10);
99
100 DEFINE_ITC1("2line.top.2", itc_2text_3_parent);
101 DEFINE_ITC1("2line.top", itc_1text_parent);
102
103 DEFINE_ITC1("2line.top", itc_2text_3);
104 DEFINE_ITC1("2line.top", itc_2text_2icon_3);
105
106 /*DEFINE_ITC1("multiline/1text", itc_multiline_text); */
107 DEFINE_ITC1("multiline_sub", itc_multiline_text);
108 DEFINE_ITC1("1line", itc_1text_1icon_3_tb);
109 DEFINE_ITC1("1line", itc_cm_1text_1icon_2);
110 DEFINE_ITC1("select_all", itc_sel_all);
111 /*DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon); */
112 DEFINE_ITC1("1icon", itc_bg_1icon);
113 DEFINE_ITC1("groupindex", itc_group_item);
114 DEFINE_ITC1("1icon", itc_1icon_with_no_line);
115 DEFINE_ITC1("1icon", itc_1icon_with_no_padding);
116 DEFINE_ITC1("1line", itc_multiline_1text_1icon);
117 DEFINE_ITC1("1line", itc_1text_2icon_divider);
118 DEFINE_ITC1("1line", itc_no_group_1text_1icon_2);
119
120 DEFINE_ITC1("entry.main", itc_editfield);
121 DEFINE_ITC1("2line.top", itc_multiline_2text);
122 DEFINE_ITC1("1line", itc_1text_1icon_divider);
123 DEFINE_ITC1("1text", itc_normal_1text);
124
125 typedef struct _tagParamData {
126         Setting_GenGroupItem_Data *item_data;
127         Evas_Object *parent;
128         /*      Evas_Object *btn_left; */
129         /*      Evas_Object *btn_right; */
130         Evas_Object *box;
131 } Datefield_Paramdata;
132
133
134 /**
135  * Do process when clicking on a common genlist item
136  */
137 EXPORT_PUBLIC
138 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
139                                             void *event_info)
140 {
141         /* error check */
142         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
143         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
144         elm_genlist_item_selected_set(item, 0);
145         Setting_GenGroupItem_Data *list_item =
146             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
147
148         setting_retm_if(data == NULL, "Data parameter is NULL");
149         Evas_Object *radio = data;
150         setting_retm_if(NULL == list_item, "list_item is NULL");
151         elm_radio_value_set(radio, list_item->chk_status);
152 }
153
154 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
155 {
156         retm_if(data == NULL, "Data parameter is NULL");
157         Setting_GenGroupItem_Data *list_item =
158             (Setting_GenGroupItem_Data *) data;
159         list_item->chk_status = elm_radio_value_get(obj);       /*  for update */
160 }
161
162 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
163 {
164         retm_if(data == NULL, "Data parameter is NULL");
165         SETTING_TRACE_BEGIN;
166         Setting_GenGroupItem_Data *list_item =
167             (Setting_GenGroupItem_Data *) data;
168         list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
169         Evas_Object *entry_container = elm_object_parent_widget_get(obj);
170         if (entry_container) {
171                 if (elm_entry_is_empty(obj)) {
172                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
173                         elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
174                 } else {
175                         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
176                         if (elm_object_focus_get(obj)) { /*only do when entry is focused */
177                                 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
178                         }
179                 }
180         }
181 }
182
183 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) /* Unfocused callback will show guidetext and hide X marked button. */
184 {
185         ret_if(!data);
186         SETTING_TRACE_BEGIN;
187         Evas_Object *entry_container = data;
188         /*whe entry unfocused, its guidetext will becomes "Input here" */
189
190         if (elm_entry_is_empty(obj)) {
191                 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
192                 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
193         }
194         elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
195 }
196
197 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) /* Focused callback will show X marked button and hide guidetext. */
198 {
199         ret_if(!data);
200         SETTING_TRACE_BEGIN;
201         Evas_Object *entry_container = data;
202         /*whe entry focused, its guidetext will becomes "Input here" */
203
204         if (!elm_entry_is_empty(obj)) {
205                 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
206         } else {
207                 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
208         }
209         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
210
211         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
212         if (imf_context) ecore_imf_context_input_panel_show(imf_context);
213 }
214
215 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. */
216 {
217         ret_if(!data);
218         Evas_Object *entry = data;
219         elm_entry_entry_set(entry, "");
220         elm_object_focus_set(entry, EINA_TRUE);
221 }
222
223 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
224 {
225         retm_if(data == NULL, "Data parameter is NULL");
226         Setting_GenGroupItem_Data *list_item =
227             (Setting_GenGroupItem_Data *) data;
228         list_item->chk_status = elm_check_state_get(obj);       /*  for update */
229 }
230
231 static void __error_popup_response_cb(void *data, Evas_Object *obj,
232                                       void *event_info)
233 {
234         SETTING_TRACE_BEGIN;
235         retm_if(data == NULL, "Data parameter is NULL");
236         Setting_GenGroupItem_Data *list_item = data;
237         if (list_item->notify) {
238                 evas_object_del(list_item->notify);
239                 list_item->notify = NULL;
240         }
241 }
242
243 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
244 {
245         SETTING_TRACE_BEGIN;
246         retm_if(data == NULL, "Data parameter is NULL");
247         retm_if(!elm_object_focus_get(obj), "Entry is not focused");/*notify only when entry is being focused on. */
248
249         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
250         if (!list_item->notify) {
251                 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
252                                                                      NULL, _(EXCEED_LIMITATION_STR),
253                                                                      __error_popup_response_cb,
254                                                                      POPUP_INTERVAL, FALSE, FALSE);
255                 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
256         } else {
257                 /*postpone 2 seconds again */
258                 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
259         }
260
261 }
262
263 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
264 {
265         retm_if(data == NULL, "Data parameter is NULL");
266         retm_if(event_info == NULL, "event_info is NULL");
267         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
268         Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
269         list_item->enterKeyPressFlag = FALSE;
270         list_item->spaceKeyPressFlag = FALSE;
271         if (safeStrCmp(ev->key, "KP_Enter") == 0 /*it is for Japanese keyboard to fix N_SE-10719 */
272             || safeStrCmp(ev->key, "Return") == 0) { /*to disable the 'Enter' orginal function */
273                 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
274                 list_item->enterKeyPressFlag = TRUE;
275                 /*hide the eraser button */
276                 /*format like:xx<br/> */
277                 if (list_item->isSinglelineFlag == FALSE) {
278                         const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
279                         elm_entry_entry_set(obj, entry_str);
280                         FREE(entry_str);
281                         elm_entry_cursor_end_set(obj);
282                 }
283                 setting_hide_input_pannel_cb(obj);
284         } else {
285                 if (safeStrCmp(ev->key, "space") == 0) {
286                         list_item->spaceKeyPressFlag = TRUE;
287                 } else {
288                         list_item->spaceKeyPressFlag = FALSE;
289                 }
290         }
291 }
292
293 /**
294  * Do process when clicking radio in subitem of expandable item
295  */
296 EXPORT_PUBLIC
297 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
298 {
299         SETTING_TRACE_BEGIN;
300         retm_if(data == NULL, "Data parameter is NULL");
301         Setting_GenGroupItem_Data *list_item =
302             (Setting_GenGroupItem_Data *) data;
303         list_item->chk_status = elm_radio_value_get(obj);       /*  for update */
304
305         Elm_Object_Item *subItem = list_item->item;
306         Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
307
308         Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem);    /* subItem data */
309         Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem);      /* parent data */
310
311         ret_if(NULL == data_subItem || NULL == data_parentItem);
312         int err;
313         setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
314                                 list_item->chk_status, &err);
315         ret_if(0 != err);
316         data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
317         elm_object_item_data_set(data_parentItem->item, data_parentItem);
318         elm_genlist_item_update(data_parentItem->item);
319 }
320
321 /**
322  * Do process when clicking on subitem of expandable item
323  */
324 EXPORT_PUBLIC
325 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
326 {
327         SETTING_TRACE_BEGIN;
328         /* error check */
329         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
330         Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
331         Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
332         elm_genlist_item_selected_set(subitem, 0);
333         Setting_GenGroupItem_Data *data_subItem =
334             elm_object_item_data_get(subitem);
335         Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem);      /* parent data */
336         ret_if(NULL == data_subItem || NULL == data_parentItem);
337
338         elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
339         int err;
340         setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
341                                 data_subItem->chk_status, &err);
342         setting_retm_if(0 != err, "Set vconf error[%d]", data_parentItem->int_slp_setting_binded);
343
344         data_parentItem->sub_desc = (char *)g_strdup(data_subItem->keyStr);
345         elm_object_item_data_set(data_parentItem->item, data_parentItem);
346         elm_genlist_item_update(data_parentItem->item);
347         elm_genlist_item_expanded_set(parentItem, EINA_FALSE);
348 }
349
350 #if 0
351 static Eina_Bool __upadte_list_on_idler(void *data)
352 {
353         SETTING_TRACE_BEGIN;
354         /* error check */
355         retv_if(data == NULL, FALSE);
356         Elm_Object_Item *item = data;
357         elm_genlist_item_update(item);
358         return ECORE_CALLBACK_CANCEL;
359         /*return EINA_FALSE; */
360 }
361 #endif
362 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
363 {
364         ret_if(data == NULL || event_info == NULL);
365         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
366         Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(item);    /* parent data */
367         char *cb_type = data;
368
369         /*SETTING_TRACE_DEBUG("cb_type: %s", cb_type); */
370         if (0 == safeStrCmp(cb_type, "drag")
371             || 0 == safeStrCmp(cb_type, "longpressed")) {
372         } else if (0 == safeStrCmp(cb_type, "contracted")) {
373                 elm_genlist_item_subitems_clear(item);
374                 /*SETTING_TRACE_DEBUG("%s:%d", _(data_parentItem->keyStr), data_parentItem->con_style); */
375                 if (data_parentItem) {
376                         setting_genlist_item_groupstyle_set(data_parentItem, data_parentItem->con_style);
377                         const char *tmp = data_parentItem->r_swallow_path;
378                         data_parentItem->r_swallow_path = g_strdup(SETTING_IMAGE_PATH_CFG"00_list_button_expand_closed.png");
379                         elm_object_item_data_set(data_parentItem->item, data_parentItem);
380                         elm_genlist_item_update(data_parentItem->item);
381                         FREE(tmp);
382                 }
383         } else if (0 == safeStrCmp(cb_type, "expanded")) {
384                 /*SETTING_TRACE_DEBUG("%s:%d", _(data_parentItem->keyStr), data_parentItem->con_style); */
385                 if (data_parentItem) {
386                         setting_genlist_item_groupstyle_set(data_parentItem, data_parentItem->exp_style);
387                         const char *tmp = data_parentItem->r_swallow_path;
388                         data_parentItem->r_swallow_path = g_strdup(SETTING_IMAGE_PATH_CFG"00_list_button_expand_opened.png");
389                         elm_object_item_data_set(data_parentItem->item, data_parentItem);
390                         elm_genlist_item_update(data_parentItem->item);
391                         FREE(tmp);
392                 }
393         }
394 }
395
396 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
397 {
398         /* SETTING_TRACE_BEGIN; */
399         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
400         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
401         elm_genlist_item_selected_set(item, 0);
402 }
403
404 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
405                                    void *event_info)
406 {
407         /* SETTING_TRACE_BEGIN; */
408         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
409         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
410         elm_genlist_item_selected_set(item, 0);
411         bool status = !elm_genlist_item_expanded_get(item);
412         elm_genlist_item_expanded_set(item, status);
413 }
414
415 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
416                                   const char *part)
417 {
418         /*SETTING_TRACE_BEGIN; */
419         Setting_GenGroupItem_Data *item_data =
420             (Setting_GenGroupItem_Data *) data;
421         /* SETTING_TRACE("part:%s", part); */
422         if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) {     /* no need to create 'text' part */
423                 return NULL;
424         }
425
426         char *ret_str = NULL;
427         /* for font size view */
428         if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
429                 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
430                 int font_size = -1;
431                 /*SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status); */
432                 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
433                         font_size = LABEL_FONT_SIZE_SMALL;
434                 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
435                         font_size = LABEL_FONT_SIZE_LARGE;
436                 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
437                         font_size = LABEL_FONT_SIZE_HUGE;
438                 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
439                         font_size = LABEL_FONT_SIZE_GIANT;
440                 } else {
441                         font_size = LABEL_FONT_SIZE_NORMAL;
442                 }
443                 /*SETTING_TRACE("font_size:%d", font_size); */
444                 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
445                          font_size, _(item_data->keyStr));
446                 ret_str = (char *)g_strdup(speciliztion);
447                 return ret_str;
448         }
449
450         /*char buf[1024]; */
451         /*SETTING_TRACE("part:[%s], text:[%s] ", part, _(item_data->keyStr)); */
452         if (!safeStrCmp(part, "elm.text.main") || !safeStrCmp(part, "elm.text.main.left") || !safeStrCmp(part, "elm.text.main.left.top")) {     /* title */
453                 if (item_data->keyStr) {
454                         ret_str = (char *)g_strdup(_(item_data->keyStr));       /* use item_data->keyStr */
455                 }
456
457         } else if (!safeStrCmp(part, "elm.text.2") || !safeStrCmp(part, "elm.text.sub.left.bottom")) {  /* bottom or right */
458                 if (item_data->sub_desc) {
459                         ret_str = (char *)g_strdup(_(item_data->sub_desc));
460                 }
461
462         } else if (!safeStrCmp(part, "elm.text.multiline")) {   /* title */
463                 if (item_data->keyStr) {
464                         ret_str = (char *)g_strdup(_(item_data->keyStr));
465                 }
466         } else {
467                 FREE(ret_str);
468                 return NULL;
469         }
470
471         return ret_str;
472 }
473
474 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
475 {
476         retv_if(!item_data || !parent, NULL);
477         Evas_Object *content = elm_layout_add(parent);
478         Evas_Object *check = elm_check_add(content);
479         /*elm_layout_theme_set(content, "layout", "list/C/type.2", "default"); */
480         /* To fix check button flicker issue when rotate the screen*/
481         if (item_data->isItemDisableFlag)
482                 elm_object_disabled_set(check, EINA_FALSE);
483
484         elm_check_state_set(check, item_data->chk_status);
485         evas_object_propagate_events_set(check, 0);
486         evas_object_size_hint_align_set(check, EVAS_HINT_FILL, EVAS_HINT_FILL);
487         evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
488
489         /*SETTING_TRACE("item_data->swallow_type:%d", item_data->swallow_type); */
490
491         if (SWALLOW_Type_1ICON_1CHECK == item_data->swallow_type
492             || SWALLOW_Type_1CHECK == item_data->swallow_type
493             || SWALLOW_Type_1CHECKICON == item_data->swallow_type) {
494                 /*elm_object_style_set(check, "default/genlist"); */
495                 elm_check_state_pointer_set(check, (Eina_Bool *)(&(item_data->chk_status)));
496                 /*evas_object_repeat_events_set(check, EINA_TRUE); */
497                 evas_object_pass_events_set(check, 1);
498         } else {
499                 evas_object_pass_events_set(check, 1);
500         }
501
502
503         item_data->eo_check = check;
504         setting_genlist_unregister_tts_access_highlight(item_data->eo_check, item_data->itc);
505
506         if (item_data->chk_change_cb) {
507                 evas_object_smart_callback_add(check, "changed", item_data->chk_change_cb, item_data);
508         } else {
509                 evas_object_smart_callback_add(check, "changed", __chk_changed, item_data);
510         }
511         evas_object_show(check);
512
513         /*Evas_Object *content = elm_layout_add(parent); */
514         /*"list/B/type.3" */
515         elm_layout_theme_set(content, "layout", "list/B/type.4", "default");
516         elm_layout_content_set(content, "elm.swallow.content", check);
517         return content;
518 }
519
520 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
521 {
522         retv_if(!item_data || !parent, NULL);
523         __add_check(item_data, parent);
524         Evas_Object *check = item_data->eo_check;
525
526         Evas_Object *thumb = NULL;
527         if (item_data->r_swallow_path) {
528                 thumb = elm_icon_add(parent);
529                 elm_image_file_set(thumb,
530                                    item_data->r_swallow_path,
531                                    NULL);
532                 evas_object_size_hint_aspect_set(thumb,
533                                                  EVAS_ASPECT_CONTROL_VERTICAL,
534                                                  1, 1);
535         }
536
537         Evas_Object *layout = elm_layout_add(parent);
538         elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
539                             "thumbnail_icon2");
540         evas_object_size_hint_weight_set(layout,
541                                          EVAS_HINT_EXPAND,
542                                          EVAS_HINT_EXPAND);
543         elm_object_part_content_set(layout, "checkbox", check);
544         elm_object_part_content_set(layout, "thumbnail", thumb);
545         evas_object_show(layout);
546         return layout;
547 }
548
549 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
550 {
551         retv_if(!item_data || !parent, NULL);
552         Evas_Object *ly_toggle = elm_layout_add(parent);
553         elm_layout_theme_set(ly_toggle, "layout", "list/C/type.3", "default");
554         __add_check(item_data, parent);
555         Evas_Object *check = item_data->eo_check;
556         elm_object_style_set(check, "on&off");
557
558         /*SETTING_TRACE_DEBUG("toggleDisableFlag %u", item_data->toggleDisableFlag); */
559         if (item_data->toggleDisableFlag)
560                 elm_object_disabled_set(check, EINA_TRUE);
561
562         if (SWALLOW_Type_1TOGGLE == item_data->swallow_type
563             || SWALLOW_Type_1ICON_1RADIO == item_data->swallow_type) {
564                 /*SETTING_TRACE("Re-registered"); */
565                 char state[MAX_SPECIALIZITION_LEN] = {0,};
566                 snprintf(state, sizeof(state),
567                          _("IDS_ST_BODY_P1SS_IS_CURRENTLY_P2SS_T_TTS"),
568                          _(item_data->keyStr), item_data->chk_status ? _("IDS_ST_BODY_ON_M_STATUS") : _("IDS_ST_BODY_ALERTTYPE_OFF"));
569
570                 Evas_Object *eo = elm_object_item_access_object_get(item_data->item);
571                 elm_access_info_set(eo, ELM_ACCESS_STATE, isEmptyStr(state) ? NULL : state);
572         }
573         setting_genlist_unregister_tts_access_highlight(item_data->eo_check, item_data->itc);
574
575         elm_layout_content_set(ly_toggle, "elm.swallow.content", check);
576         /*return check; */
577         return ly_toggle;
578 }
579
580 static Evas_Object *__add_dot_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
581 {
582         /*SETTING_TRACE_BEGIN; */
583         retv_if(!item_data || !parent || -1 == item_data->chk_status, NULL);
584         return NULL;
585 #if 0
586         Evas_Object *eo_img = NULL;
587         eo_img = elm_image_add(parent);
588
589         if (eo_img) {
590                 evas_object_propagate_events_set(eo_img, EINA_FALSE);
591                 if (0 == item_data->chk_status) {
592                         elm_image_file_set(eo_img, SETTING_ICON_PATH_CFG"A01-1_top_off.png", NULL);
593                 } else if (1 == item_data->chk_status) {
594                         elm_image_file_set(eo_img, SETTING_ICON_PATH_CFG"A01-1_top_on.png", NULL);
595                 }
596                 evas_object_size_hint_min_set(eo_img, ELM_SCALE_SIZE(40), ELM_SCALE_SIZE(40));
597                 evas_object_size_hint_max_set(eo_img, 40, 40);
598                 evas_object_show(eo_img);
599         }
600         return eo_img;
601 #endif
602 }
603
604
605 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
606 {
607         retv_if(!item_data || !parent, NULL);
608         Evas_Object *chk = __add_toggle(item_data, parent);
609         elm_object_style_set(chk, "on&off");
610         return chk;
611 }
612
613
614 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
615 {
616         retv_if(!item_data || !parent, NULL);
617         if (!item_data->rgd) {  /* exceptional handling */
618                 item_data->rgd = elm_radio_add(parent);
619                 elm_radio_state_value_set(item_data->rgd, -1);
620         }
621         Evas_Object *ly_radio = elm_layout_add(parent);
622         elm_layout_theme_set(ly_radio, "layout", "list/B/type.4", "default");
623         Evas_Object *radio = elm_radio_add(ly_radio);
624         evas_object_propagate_events_set(radio, EINA_FALSE);
625         evas_object_repeat_events_set(radio, EINA_TRUE);
626         elm_radio_state_value_set(radio,
627                                   item_data->chk_status);
628         elm_radio_group_add(radio, item_data->rgd);
629         evas_object_show(radio);
630         item_data->eo_check = radio;
631         if (item_data->chk_change_cb) {
632                 evas_object_smart_callback_add(radio,
633                                                "changed",
634                                                item_data->chk_change_cb,
635                                                item_data);
636         } else {
637                 evas_object_smart_callback_add(radio,
638                                                "changed",
639                                                __radio_changed,
640                                                item_data);
641         }
642         setting_genlist_unregister_tts_access_highlight(item_data->eo_check, item_data->itc);
643         elm_layout_content_set(ly_radio, "elm.swallow.content", radio);
644         /*return check; */
645         return ly_radio;
646 }
647
648 static Evas_Object *__add_radio_right(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
649 {
650         retv_if(!item_data || !parent, NULL);
651         if (!item_data->rgd) {
652                 item_data->rgd = elm_radio_add(parent);
653                 elm_radio_state_value_set(item_data->rgd, -1);
654         }
655         Evas_Object *ly_radio = elm_layout_add(parent);
656         elm_layout_theme_set(ly_radio, "layout", "list/C/type.2", "default");
657         Evas_Object *radio = elm_radio_add(ly_radio);
658
659         elm_object_style_set(radio, "list");
660
661         elm_radio_state_value_set(radio,
662                                   item_data->chk_status);
663         elm_radio_group_add(radio, item_data->rgd);
664         evas_object_show(radio);
665         item_data->eo_check = radio;
666         if (item_data->chk_change_cb) {
667                 evas_object_smart_callback_add(radio,
668                                                "changed",
669                                                item_data->chk_change_cb,
670                                                item_data);
671         } else {
672                 evas_object_smart_callback_add(radio,
673                                                "changed",
674                                                __radio_changed,
675                                                item_data);
676         }
677         setting_genlist_unregister_tts_access_highlight(item_data->eo_check, item_data->itc);
678         elm_layout_content_set(ly_radio, "elm.swallow.content", radio);
679
680         return ly_radio;
681 }
682
683 static Evas_Object *__add_radio_text(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
684 {
685         retv_if(!item_data || !parent, NULL);
686         if (!item_data->rgd) {  /* exceptional handling */
687                 item_data->rgd = elm_radio_add(parent);
688                 elm_radio_state_value_set(item_data->rgd, -1);
689         }
690         Evas_Object *radio = elm_radio_add(parent);
691         evas_object_propagate_events_set(radio, EINA_FALSE);
692         evas_object_repeat_events_set(radio, EINA_FALSE);
693         elm_radio_state_value_set(radio,
694                                   item_data->chk_status);
695         elm_radio_group_add(radio, item_data->rgd);
696         evas_object_show(radio);
697         item_data->eo_check = radio;
698         if (item_data->chk_change_cb) {
699                 evas_object_smart_callback_add(radio,
700                                                "changed",
701                                                item_data->chk_change_cb,
702                                                item_data);
703         } else {
704                 evas_object_smart_callback_add(radio,
705                                                "changed",
706                                                __radio_changed,
707                                                item_data);
708         }
709         return radio;
710 }
711
712
713 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
714 {
715         retv_if(!item_data || !parent, NULL);
716         Evas_Object *btn = elm_button_add(parent);
717         elm_object_text_set(btn, "Edit");
718         evas_object_show(btn);
719         if (item_data->r_swallow_path) {
720                 elm_object_style_set(btn, item_data->r_swallow_path);
721         }
722         if (item_data->keyStr && item_data->swallow_type != SWALLOW_Type_1RADIO_1BTN) {
723                 elm_object_text_set(btn, _(item_data->keyStr));
724         }
725         evas_object_propagate_events_set(btn, EINA_FALSE);
726
727         if (item_data->stop_change_cb) {        /* just only for 1radio_1btn type */
728                 /* arrow button's tts info */
729                 if (safeStrCmp(item_data->keyStr, "IDS_ST_BODY_SIMPLE_PASSWORD") == 0)
730                         setting_set_tts_info(btn, "Change simple password", NULL, NULL, NULL);
731                 else if (safeStrCmp(item_data->keyStr, "IDS_ST_BODY_PASSWORD") == 0)
732                         setting_set_tts_info(btn, "Change password", NULL, NULL, NULL);
733
734                 evas_object_smart_callback_add(btn,
735                                                "clicked",
736                                                item_data->stop_change_cb,
737                                                item_data);
738         } else if (item_data->chk_change_cb) {  /* for other types */
739                 evas_object_smart_callback_add(btn,
740                                                "clicked",
741                                                item_data->chk_change_cb,
742                                                item_data);
743         }
744         SETTING_TRACE_DEBUG("toggleDisableFlag %u", item_data->toggleDisableFlag);
745         if (item_data->toggleDisableFlag)
746                 elm_object_disabled_set(btn, EINA_TRUE);
747         return btn;
748 }
749
750
751 static Evas_Object *__add_gif(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
752 {
753         retv_if(!item_data || !parent, NULL);
754         Evas_Object *image = NULL;
755         const char **png_list = (const char **)item_data->belongs_to;
756
757         /*SETTING_TRACE("item_data->belongs_to:%p", png_list); */
758         if (png_list && *png_list) {
759                 if (png_list[1]) {      /*png_list is an array end with 'NULL', and it has at least 2 png file, */
760                         image = setting_create_gif(parent, png_list);
761                 } else {        /*png_list just has one png file, */
762                         image = setting_create_image(parent, *png_list);
763                 }
764         }
765
766         return image;
767 }
768
769 static Evas_Object *__add_image(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
770 {
771         retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
772         Evas_Object *image = NULL;
773         image = setting_create_image(parent, item_data->l_swallow_path);
774         return image;
775 }
776
777 static void __entry_without_layout_focused_cb(void *data, Evas_Object *obj, void *ei) /* Focused callback will show X marked button and hide guidetext. */
778 {
779         SETTING_TRACE_BEGIN;
780         Setting_GenGroupItem_Data *id = data;
781         if (!elm_entry_is_empty(obj)) {
782                 elm_object_item_signal_emit(id->item, "elm,state,eraser,show", "");
783         }
784         elm_object_item_signal_emit(id->item, "elm,state,rename,hide", "");
785
786         /* accessibiliy */
787         Evas_Object *acc = elm_object_item_access_object_get(id->item);
788         if (!acc) return;
789
790         const char *txt = elm_entry_entry_get(obj);
791         if (!txt || 0 == strlen(txt))
792                 txt = elm_object_part_text_get(obj, "elm.guide");
793
794         /* Say entry focused */
795         Eina_Stringshare *str = eina_stringshare_printf("%s, Edit Field, Keyboard opened", txt);
796         elm_access_say((char *)str);
797         eina_stringshare_del(str);
798         SETTING_TRACE_END;
799 }
800
801 static void __entry_without_layout_unfocused_cb(void *data, Evas_Object *obj, void *event_info) /* Unfocused callback will show guidetext and hide X marked button. */
802 {
803         SETTING_TRACE_BEGIN;
804         setting_retm_if(data == NULL, "invalid parameter: data is NULL");
805         Setting_GenGroupItem_Data *id = data;
806         setting_retm_if(id->item == NULL, "item is NULL");
807         elm_object_item_signal_emit(id->item, "elm,state,eraser,hide", "");
808         elm_object_item_signal_emit(id->item, "elm,state,rename,show", "");
809         SETTING_TRACE_END;
810 }
811
812 static void __rejected_char_cb(void *data, Evas_Object *obj, void *event_info)
813 {
814         SETTING_TRACE_BEGIN;
815
816         /*SETTING_TRACE_DEBUG("Input char is not an Alphanumeric&Symbol."); */
817         setting_create_simple_popup(NULL, elm_object_parent_widget_get(obj), NULL, _("IDS_ST_BODY_PASSWORD_CONTAINS_INVALID_CHARACTER_ABB"));
818 }
819
820 static Evas_Object *__add_entry_without_layout(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
821 {
822         elm_genlist_mode_set(parent, ELM_LIST_COMPRESS);        /* resolve abnormal height issue */
823         Evas_Object *entry = NULL;
824         Ea_Editfield_Type type;
825
826         if (item_data->isPasswordFlag) {
827                 type = EA_EDITFIELD_SCROLL_SINGLELINE_PASSWORD;
828         } else if (item_data->isSinglelineFlag) {
829                 type = EA_EDITFIELD_SINGLELINE;
830         } else {
831                 type = EA_EDITFIELD_MULTILINE;
832         }
833         item_data->eo_check = entry = ea_editfield_add(parent, type);
834         evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
835         evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
836         if (item_data->focus_unallowed) {
837                 elm_object_focus_allow_set(entry, EINA_FALSE);
838         }
839         elm_entry_input_panel_layout_set(entry,
840                                          item_data->input_type);
841         /*elm_entry_context_menu_disabled_set(entry, TRUE); */
842         /*elm_entry_magnifier_disabled_set(entry, TRUE); */
843         elm_entry_prediction_allow_set(entry, FALSE);
844         elm_entry_input_panel_return_key_type_set(entry, item_data->return_key_type);
845         if (item_data->disable_auto_cap) {
846                 elm_entry_autocapital_type_set(entry, ELM_AUTOCAPITAL_TYPE_NONE);
847         }
848
849         if (item_data->isSinglelineFlag) {
850                 elm_entry_scrollable_set(entry, EINA_TRUE);
851                 elm_entry_single_line_set(entry, EINA_TRUE);
852                 elm_object_signal_emit(entry, "elm,state,scroll,enabled", "");
853         } else {
854                 /*for multi-line editfield or entry, need to disable clear button,refer to P130802-3553*/
855                 ea_editfield_clear_button_disabled_set(entry, EINA_TRUE);
856         }
857
858         if (item_data->isPasswordFlag) {
859                 /*elm_entry_single_line_set(entry, EINA_TRUE); */
860                 elm_entry_password_set(entry, EINA_TRUE);
861                 elm_entry_input_panel_return_key_disabled_set(entry, EINA_TRUE);
862
863                 static Elm_Entry_Filter_Accept_Set accept_filter_data;
864                 accept_filter_data.accepted = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!""#$%&'()*+,-./:;<=>?@[]\\^_`{|}~";
865                 accept_filter_data.rejected = NULL;
866                 elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &accept_filter_data);
867
868                 evas_object_smart_callback_add(entry, "rejected", __rejected_char_cb, item_data);
869         }
870
871         if (item_data->limit_filter_data) {
872                 elm_entry_markup_filter_append
873                 (entry,
874                  elm_entry_filter_limit_size,
875                  item_data->limit_filter_data);
876
877                 if (item_data->maxlength_reached_cb) {
878                         evas_object_smart_callback_add(entry,
879                                                        "maxlength,reached",
880                                                        item_data->maxlength_reached_cb,
881                                                        item_data);
882                 } else {
883                         evas_object_smart_callback_add(entry,
884                                                        "maxlength,reached",
885                                                        __max_len_reached,
886                                                        item_data);
887                 }
888         }
889
890         /*SETTING_TRACE("item_data->stop_change_cb:%p", item_data->stop_change_cb); */
891         if (item_data->stop_change_cb) {/*invoked when stop focusing on */
892                 evas_object_smart_callback_add(entry,
893                                                "unfocused",
894                                                item_data->stop_change_cb,
895                                                item_data);
896         } else {
897                 evas_object_smart_callback_add(entry,
898                                                "unfocused",
899                                                __entry_without_layout_unfocused_cb,
900                                                item_data);
901         }
902         if (item_data->digits_filter_data) {
903                 elm_entry_markup_filter_append(entry,
904                                                elm_entry_filter_accept_set,
905                                                item_data->digits_filter_data);
906         }
907
908
909         if (item_data->sub_desc && safeStrLen(item_data->sub_desc) > 0) {
910                 elm_entry_entry_set(entry, item_data->sub_desc);
911         } else {
912                 if (item_data->guide_text) {
913                         elm_object_part_text_set(entry, "elm.guide", _(item_data->guide_text)); /* Add guide text to elm_entry. */
914                 } else {
915                         elm_object_part_text_set(entry, "elm.guide", _("IDS_ST_BODY_TAP_TO_INSERT"));
916                 }
917         }
918
919
920         /* for Setting App, All the entrys's context popup shouldn't be able */
921         /* to insert images, text is the only one can be inserted. */
922         elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
923
924         if (item_data->chk_change_cb) {
925                 evas_object_smart_callback_add(entry,
926                                                "changed",
927                                                item_data->chk_change_cb,
928                                                item_data);
929                 evas_object_smart_callback_add(entry,
930                                                "preedit,changed",
931                                                item_data->chk_change_cb,
932                                                item_data);
933         } else {
934                 /*default handle */
935                 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
936         }
937
938         /* callback for handling enter key */
939         if (item_data->activated_cb) {
940                 evas_object_smart_callback_add(entry,
941                                                "activated",
942                                                item_data->activated_cb,
943                                                item_data);
944         }
945
946         /*SETTING_TRACE("item_data->focus_cb:%p", item_data->focus_cb); */
947
948         if (item_data->focus_cb) {
949                 evas_object_smart_callback_add(entry, "focused", item_data->focus_cb, item_data);
950         } else {
951                 evas_object_smart_callback_add(entry, "focused", __entry_without_layout_focused_cb, item_data);
952         }
953
954         /*elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry); */
955
956         if (item_data->start_change_cb) {
957                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
958         } else {
959                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
960         }
961
962         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
963         if (imf_context && item_data->x_callback_cb) {
964                 ecore_imf_context_input_panel_event_callback_add(imf_context,
965                                                                  ECORE_IMF_INPUT_PANEL_STATE_EVENT,
966                                                                  item_data->x_callback_cb,
967                                                                  item_data->userdata);
968         }
969         if (item_data->input_panel_disable_flag) {
970                 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
971         }
972         if (entry && item_data->entry_auto_focus) {
973                 evas_object_show(entry);
974                 elm_object_focus_set(entry, EINA_TRUE);
975         }
976
977         return entry;
978 }
979
980 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
981 {
982         retv_if(!item_data || !parent, NULL);
983         elm_genlist_mode_set(parent, ELM_LIST_COMPRESS);        /* resolve abnormal height issue */
984         Evas_Object *ed_name =
985             setting_create_editfiled(parent, _(item_data->keyStr),
986                                      item_data->sub_desc, item_data->guide_text);
987         evas_object_pass_events_set(ed_name, 1);
988         evas_object_propagate_events_set(ed_name, 0);
989         Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
990         item_data->eo_check = entry;
991         elm_entry_input_panel_layout_set(entry,
992                                          item_data->input_type);
993
994         if (item_data->isSinglelineFlag) {
995                 elm_entry_scrollable_set(entry, EINA_TRUE);
996                 elm_entry_single_line_set(entry, EINA_TRUE);
997         }
998
999         if (item_data->isPasswordFlag) {
1000                 elm_entry_single_line_set(entry, EINA_TRUE);
1001                 elm_entry_password_set(entry, EINA_TRUE);
1002         }
1003
1004         if (item_data->limit_filter_data) {
1005                 elm_entry_markup_filter_append
1006                 (entry,
1007                  elm_entry_filter_limit_size,
1008                  item_data->limit_filter_data);
1009
1010                 if (item_data->maxlength_reached_cb) {
1011                         evas_object_smart_callback_add(entry,
1012                                                        "maxlength,reached",
1013                                                        item_data->maxlength_reached_cb,
1014                                                        item_data);
1015                 } else {
1016                         evas_object_smart_callback_add(entry,
1017                                                        "maxlength,reached",
1018                                                        __max_len_reached,
1019                                                        item_data);
1020                 }
1021         }
1022         if (item_data->stop_change_cb) {/*invoked when stop focusing on */
1023                 evas_object_smart_callback_add(entry,
1024                                                "unfocused",
1025                                                item_data->stop_change_cb,
1026                                                item_data);
1027         } else {
1028                 evas_object_smart_callback_add(entry,
1029                                                "unfocused",
1030                                                __entry_unfocused,
1031                                                ed_name);
1032         }
1033         if (item_data->digits_filter_data) {
1034                 elm_entry_markup_filter_append(entry,
1035                                                elm_entry_filter_accept_set,
1036                                                item_data->digits_filter_data);
1037         }
1038
1039         /* for Setting App, All the entrys's context popup shouldn't be able */
1040         /* to insert images, text is the only one can be inserted. */
1041         elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
1042
1043         if (item_data->chk_change_cb) {
1044                 evas_object_smart_callback_add(entry,
1045                                                "changed",
1046                                                item_data->chk_change_cb,
1047                                                item_data);
1048         } else {
1049                 /*default handle */
1050                 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
1051         }
1052
1053         /* callback for handling enter key */
1054         if (item_data->activated_cb) {
1055                 evas_object_smart_callback_add(entry,
1056                                                "activated",
1057                                                item_data->activated_cb,
1058                                                item_data);
1059         }
1060
1061         if (item_data->focus_cb) {
1062                 evas_object_smart_callback_add(entry, "focused", item_data->focus_cb, item_data);
1063         } else {
1064                 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
1065         }
1066
1067         elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
1068
1069         if (item_data->start_change_cb) {
1070                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
1071         } else {
1072                 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
1073         }
1074
1075         Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
1076         if (imf_context) {
1077                 ecore_imf_context_input_panel_event_callback_add(imf_context,
1078                                                                  ECORE_IMF_INPUT_PANEL_STATE_EVENT,
1079                                                                  item_data->x_callback_cb,
1080                                                                  item_data->userdata);
1081         }
1082         if (item_data->input_panel_disable_flag) {
1083                 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
1084         }
1085         return ed_name;
1086 }
1087
1088 static Evas_Object *__add_5step_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1089 {
1090         SETTING_TRACE_BEGIN;
1091         retv_if(!item_data || !parent, NULL);
1092         Evas_Object *li_slider =
1093             setting_create_5step_slider(parent, item_data->evas,
1094                                         item_data->l_swallow_path,
1095                                         item_data->r_swallow_path,
1096                                         item_data->chk_status,
1097                                         item_data->isIndicatorVisible,
1098                                         item_data->slider_min,
1099                                         item_data->slider_max,
1100                                         item_data->chk_change_cb,
1101                                         item_data->start_change_cb,
1102                                         item_data->stop_change_cb,
1103                                         item_data);
1104         evas_object_pass_events_set(li_slider, 1);
1105         evas_object_propagate_events_set(li_slider, 0);
1106         item_data->eo_check = li_slider;
1107         return li_slider;
1108 }
1109
1110 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1111 {
1112         retv_if(!item_data || !parent, NULL);
1113         Evas_Object *li_slider =
1114             setting_create_slider(parent, item_data->evas,
1115                                   item_data->l_swallow_path,
1116                                   item_data->r_swallow_path,
1117                                   item_data->chk_status,
1118                                   item_data->isIndicatorVisible,
1119                                   item_data->slider_min,
1120                                   item_data->slider_max,
1121                                   item_data->chk_change_cb,
1122                                   item_data->start_change_cb,
1123                                   item_data->stop_change_cb,
1124                                   item_data);
1125         evas_object_pass_events_set(li_slider, 1);
1126         evas_object_propagate_events_set(li_slider, 0);
1127         item_data->eo_check = li_slider;
1128         return li_slider;
1129 }
1130
1131 static Evas_Object *__add_layout(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1132 {
1133         retv_if(!item_data || !parent, NULL);
1134         Evas_Object *layout = elm_layout_add(parent);
1135         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1136         setting_retvm_if(layout == NULL, FALSE, "layout == NULL");
1137         elm_layout_theme_set(layout, "layout", "application", "default");
1138         int w = item_data->chk_status;
1139         int h = item_data->chk_status;
1140         elm_object_part_content_set(layout, "elm.swallow.bg", setting_create_blank_rect_customize(parent, w, h));
1141         /*elm_object_part_content_set(layout, "elm.swallow.content", navi); */
1142 #if 0
1143         char **load_arglist = (char **)item_data->belongs_to;
1144         char *load_name = item_data->keyStr;
1145         char *load_style = item_data->item_style;
1146         if (0 == safeStrCmp(load_style, "APP"))
1147                 app_launcher(load_name);/*how to adjust the size */
1148         else if (0 == safeStrCmp(load_style, "UG")) {
1149                 struct ug_cbs cbs = {0,};
1150
1151                 cbs.layout_cb = __ug_layout_cb;
1152                 cbs.result_cb = __ug_result_cb;
1153                 cbs.destroy_cb = __ug_destroy_cb;
1154                 cbs.priv = ad;
1155
1156                 ad->camera_ug = setting_ug_create(NULL, load_name, UG_MODE_FULLVIEW, ad->app_control_handle, &cbs);
1157         }
1158
1159 #endif
1160         return layout;
1161 }
1162
1163 static void __picker_popup_cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1164 {
1165         SETTING_TRACE_BEGIN;
1166         Evas_Object *popup = data;
1167         evas_object_del(popup);
1168 }
1169
1170 static void __picker_popup_set_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1171 {
1172         /*printf("Set clicked\n"); */
1173         SETTING_TRACE_BEGIN;
1174         SETTING_TRACE("DEFAULT @@@");
1175         elm_object_signal_emit(data, "picker,action,value,set", "");
1176         /*Evas_Object *popup = evas_object_data_get((Evas_Object *)data, "popup"); */
1177         /*evas_object_del(popup); */
1178 }
1179
1180 static Evas_Object *_datefield_picker_popup_add(Evas_Object *parent, Evas_Object *datetime, void *data)
1181 {
1182         Datefield_Paramdata  *param = (Datefield_Paramdata *)data;
1183
1184         Setting_GenGroupItem_Data *item_data = param->item_data;
1185
1186         Evas_Object *popup = elm_popup_add(parent);
1187         ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb, NULL);
1188
1189         Evas_Object *cancel_btn = elm_button_add(popup);
1190         elm_object_style_set(cancel_btn, "popup");
1191         elm_object_text_set(cancel_btn, "Cancel");
1192         elm_object_part_content_set(popup, "button1", cancel_btn);
1193         evas_object_smart_callback_add(cancel_btn, "clicked", __picker_popup_cancel_btn_clicked_cb, popup);
1194
1195         Evas_Object *set_btn = elm_button_add(popup);
1196         elm_object_style_set(set_btn, "popup");
1197         elm_object_text_set(set_btn, "Set");
1198         elm_object_part_content_set(popup, "button2", set_btn);
1199
1200         if (item_data->activated_cb)
1201                 /*evas_object_smart_callback_add(set_btn, "clicked", item_data->activated_cb, datetime); */
1202                 evas_object_smart_callback_add(set_btn, "clicked", item_data->activated_cb, item_data);
1203         else
1204                 evas_object_smart_callback_add(set_btn, "clicked", __picker_popup_set_btn_clicked_cb, datetime);
1205
1206         return popup;
1207 }
1208
1209 static void _datefield_date_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1210 {
1211         SETTING_TRACE_BEGIN;
1212
1213         /*Evas_Object *parent = data; */
1214         Datefield_Paramdata  *param = (Datefield_Paramdata *)data;
1215         Evas_Object *popup = _datefield_picker_popup_add(param->parent, obj/*elm_button*/, param/* context */);
1216
1217         elm_object_part_text_set(popup, "title,text", "Set date");
1218
1219         Evas_Object *datetime = elm_datetime_add(param->parent);
1220
1221         evas_object_data_set(datetime, "popup", popup);
1222
1223         /*--------------------------------------- */
1224         param->item_data->eo_check = datetime;
1225         /*--------------------------------------- */
1226
1227         elm_object_content_set(popup, datetime);
1228         evas_object_show(popup);
1229
1230         /*--------------------------------------- */
1231         /*param->item_data->eo_check = param->box; */
1232         /*--------------------------------------- */
1233 }
1234
1235 static void _datefield_time_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1236 {
1237         SETTING_TRACE_BEGIN;
1238         Datefield_Paramdata  *param = (Datefield_Paramdata *)data;
1239
1240         Evas_Object *datetime = elm_datetime_add(param->parent);
1241
1242         elm_object_style_set(datetime, "date_layout");
1243
1244         char *pa_time_format = get_pa_time_format_str();
1245         if (pa_time_format) {
1246                 if (!strncmp(pa_time_format, "IDS_ST_BODY_12_HOURS", strlen("IDS_ST_BODY_12_HOURS")))
1247                         elm_datetime_format_set(datetime, "%l:%M %P");
1248                 else
1249                         elm_datetime_format_set(datetime, "%H:%M");
1250         }
1251
1252         evas_object_size_hint_align_set(datetime, 0.5 , 0.5);
1253         evas_object_show(datetime);
1254
1255         Evas_Object *popup = _datefield_picker_popup_add(param->parent, obj, (void *)data);
1256         elm_object_part_text_set(popup, "title,text", "Set time");
1257
1258         evas_object_data_set(datetime, "popup", popup);
1259
1260         /*--------------------------------------- */
1261         param->item_data->eo_check = datetime;
1262         /*--------------------------------------- */
1263
1264         elm_object_content_set(popup, datetime);
1265         evas_object_show(popup);
1266
1267         FREE(pa_time_format);
1268         /*--------------------------------------- */
1269         /*param->item_data->eo_check = param->box; */
1270         /*--------------------------------------- */
1271 }
1272
1273 EXPORT_PUBLIC char *__setting_phone_lang_get_by_pattern(const char *locale, const char *skeleton)
1274 {
1275         /*setting_retvm_if(!locale, NULL, "locale parameter is NULL"); */
1276         /*setting_retvm_if(data == NULL, NULL, "Data parameter is NULL"); */
1277
1278         /*remove ".UTF-8" in locale */
1279         char locale_tmp[DEF_BUF_SIZE] = {0,};
1280         strncpy(locale_tmp, locale, DEF_BUF_SIZE);
1281         locale_tmp[DEF_BUF_SIZE - 1] = '\0';
1282
1283         char *p = safeStrStr(locale_tmp, ".UTF-8");
1284         if (p) {
1285                 *p = 0;
1286         }
1287
1288         char *ret_str = NULL;
1289         UChar customSkeleton[SETTING_STR_SLP_LEN] = { 0, };
1290         UErrorCode status = U_ZERO_ERROR;
1291         UDateFormat *formatter = NULL;
1292
1293         UChar bestPattern[SETTING_STR_SLP_LEN] = { 0, };
1294         UChar formatted[SETTING_STR_SLP_LEN] = { 0, };
1295
1296         char bestPatternString[SETTING_STR_SLP_LEN] = { 0, };
1297         char formattedString[SETTING_STR_SLP_LEN] = { 0, };
1298
1299         u_uastrncpy(customSkeleton, skeleton, safeStrLen(skeleton));
1300
1301         UDateTimePatternGenerator *pattern_generator;
1302         pattern_generator = udatpg_open(locale_tmp, &status);
1303
1304         int32_t bestPatternCapacity = (int32_t)(sizeof(bestPattern) / sizeof((bestPattern)[0]));
1305         (void)udatpg_getBestPattern(pattern_generator, customSkeleton, u_strlen(customSkeleton), bestPattern, bestPatternCapacity, &status);
1306
1307         u_austrcpy(bestPatternString, bestPattern);
1308         SETTING_TRACE("BestPattern is %s", bestPatternString);
1309
1310         UDate date = ucal_getNow();
1311         formatter = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale_tmp, NULL, -1, bestPattern, -1, &status);
1312         int32_t formattedCapacity = (int32_t)(sizeof(formatted) / sizeof((formatted)[0]));
1313         (void)udat_format(formatter, date, formatted, formattedCapacity, NULL, &status);
1314         u_austrcpy(formattedString, formatted);
1315         SETTING_TRACE("DATE & TIME is %s", formattedString);
1316
1317         udat_close(formatter);
1318
1319         ret_str = g_strdup(formattedString);
1320         return ret_str;
1321 }
1322
1323
1324 /**
1325  * eo_check ??
1326  */
1327 static Evas_Object *__add_datefield_new(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1328 {
1329         SETTING_TRACE_BEGIN;
1330         retv_if(!item_data || !parent, NULL);
1331
1332         Datefield_Paramdata  *param = malloc(sizeof(Datefield_Paramdata));
1333         setting_retvm_if(NULL == param, NULL, "param is NULL");
1334
1335         param->item_data = item_data;
1336         /*param->parent = parent; */
1337         param->parent = item_data->nf;
1338
1339         char *date = __setting_phone_lang_get_by_pattern("en_US", "MMM/d/yyyy");
1340         char *pa_time_format = get_pa_time_format_str();
1341         char *time;
1342
1343         if (pa_time_format) {
1344                 if (!strncmp(pa_time_format, "IDS_ST_BODY_12_HOURS", strlen("IDS_ST_BODY_12_HOURS")))
1345                         time = __setting_phone_lang_get_by_pattern("en_US", "hhmm");
1346                 else
1347                         time = __setting_phone_lang_get_by_pattern("en_US", "Hm");
1348                 SETTING_TRACE("DATE : %s ", date);
1349                 SETTING_TRACE("TIME : %s ", time);
1350         }
1351
1352         Evas_Object *btn_left = elm_button_add(parent);
1353         elm_object_style_set(btn_left, "datetime");
1354         evas_object_size_hint_weight_set(btn_left, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1355         evas_object_size_hint_min_set(btn_left, ELM_SCALE_SIZE(90), -1);
1356         evas_object_resize(btn_left, 300, -1);
1357
1358         elm_object_text_set(btn_left, date);
1359         evas_object_smart_callback_add(btn_left, "clicked", _datefield_date_btn_clicked_cb , param);
1360         evas_object_show(btn_left);
1361
1362         Evas_Object *btn_right = elm_button_add(parent);
1363         elm_object_style_set(btn_right, "datetime");
1364         evas_object_size_hint_weight_set(btn_right, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1365         evas_object_size_hint_min_set(btn_right, ELM_SCALE_SIZE(90), -1);
1366         evas_object_resize(btn_right, 270, -1);
1367         elm_object_text_set(btn_right, time);
1368         evas_object_smart_callback_add(btn_right, "clicked", _datefield_time_btn_clicked_cb , param);
1369         evas_object_show(btn_right);
1370
1371         param->item_data->btn_left = btn_left;
1372         param->item_data->btn_right = btn_right;
1373
1374         Evas_Object *box = elm_box_add(parent);
1375         evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1376
1377         Evas_Object *box1 = elm_box_add(box);
1378         evas_object_size_hint_weight_set(box1, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1379         elm_box_horizontal_set(box1, 1);
1380         elm_box_align_set(box1, 0.5, 0.0);
1381         elm_box_padding_set(box1, ELM_SCALE_SIZE(15), ELM_SCALE_SIZE(5));
1382
1383         elm_box_pack_end(box1, btn_left);
1384         elm_box_pack_end(box1, btn_right);
1385         evas_object_show(box1);
1386
1387         elm_box_pack_end(box, box1);
1388         evas_object_show(box);
1389
1390         FREE(pa_time_format);
1391         return box;
1392 }
1393
1394 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1395 {
1396         retv_if(!item_data || !parent, NULL);
1397         Evas_Object *box = elm_box_add(parent);
1398         elm_box_horizontal_set(box, 1);
1399
1400         /*a.radio.. */
1401         /*Evas_Object *radio = __add_radio(item_data, parent);
1402         setting_disable_evas_object(radio);
1403         elm_box_pack_end(box, radio);
1404
1405         //b.separator..
1406         Evas_Object *separator =
1407                 setting_create_blank_rect_customize(box,
1408                                 SETTING_HALF_SCREEN_WIDTH,
1409                                 SETTING_PADDING_HEIGHT);
1410         elm_box_pack_end(box, separator);*/
1411
1412         /*c.progressbar.. */
1413         Evas_Object *progressbar = elm_progressbar_add(parent);
1414         elm_object_style_set(progressbar, PROGRESSBAR_STYLE);
1415         evas_object_size_hint_align_set(progressbar,
1416                                         EVAS_HINT_FILL, 0.5);
1417         evas_object_size_hint_weight_set(progressbar,
1418                                          EVAS_HINT_EXPAND,
1419                                          EVAS_HINT_EXPAND);
1420         elm_progressbar_pulse(progressbar, EINA_TRUE);
1421         evas_object_show(progressbar);
1422         elm_box_pack_end(box, progressbar);
1423
1424         evas_object_show(box);
1425         return box;
1426 }
1427
1428 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1429 {
1430         retv_if(!item_data || !parent, NULL);
1431         /* added by JTS: CQ H0100135171 */
1432         Evas_Object *box = elm_box_add(parent);
1433         elm_box_horizontal_set(box, 1);
1434
1435         /*b.separator.. */
1436         Evas_Object *separator =
1437             setting_create_blank_rect_customize(box,
1438                                                 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
1439         elm_box_pack_end(box, separator);
1440
1441         /*c.progressbar.. */
1442         Evas_Object *progressbar = elm_progressbar_add(parent);
1443         elm_object_style_set(progressbar, PROGRESSBAR_STYLE);
1444         evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
1445         evas_object_size_hint_weight_set(progressbar,
1446                                          EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1447         elm_progressbar_pulse(progressbar, EINA_TRUE);
1448         evas_object_show(progressbar);
1449         elm_box_pack_end(box, progressbar);
1450
1451         evas_object_show(box);
1452         return box;
1453
1454 }
1455
1456 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1457 {
1458         retv_if(!item_data || !parent, NULL);
1459         Evas_Object *progressbar = elm_progressbar_add(parent);
1460         elm_object_style_set(progressbar, PROGRESSBAR_STYLE);
1461         evas_object_size_hint_align_set(progressbar,
1462                                         EVAS_HINT_FILL, 0.5);
1463         evas_object_size_hint_weight_set(progressbar,
1464                                          EVAS_HINT_EXPAND,
1465                                          EVAS_HINT_EXPAND);
1466         elm_progressbar_pulse(progressbar, EINA_TRUE);
1467         evas_object_show(progressbar);
1468         return progressbar;
1469 }
1470
1471 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1472 {
1473         retv_if(!item_data || !parent, NULL);
1474
1475         /*a.radio.. */
1476         Evas_Object *radio = __add_radio(item_data, parent);
1477
1478         return radio;
1479 }
1480
1481 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1482 {
1483         if (!item_data || !parent || !item_data->l_swallow_path) {
1484                 return NULL;
1485         }
1486
1487         if (SWALLOW_Type_1ICON_WITHOUT_CIRCLE_BG == item_data->swallow_type
1488             || SWALLOW_Type_1ICON_1DOTTOOGLE == item_data->swallow_type
1489             || SWALLOW_Type_1ICON_1IMAGE == item_data->swallow_type) {
1490                 Evas_Object *icon = elm_icon_add(parent);
1491                 elm_image_file_set(icon, item_data->l_swallow_path, NULL);
1492                 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1493                 return icon;
1494         }
1495
1496         Evas_Object *ic = NULL;
1497         ic = elm_layout_add(parent);
1498         Evas_Object *c = NULL;
1499
1500         elm_layout_theme_set(ic, "layout", "list/B/type.4", "default");
1501         c = elm_image_add(parent);
1502         elm_image_file_set(c, item_data->l_swallow_path, NULL);
1503         setting_decorate_image_RGBA(c, 14, 41, 73, 255);
1504         evas_object_size_hint_align_set(c, EVAS_HINT_FILL, EVAS_HINT_FILL);
1505         evas_object_size_hint_weight_set(c, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1506         elm_layout_content_set(ic, "elm.swallow.content", c);
1507
1508         return ic;
1509 }
1510
1511 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
1512 {
1513         if (!item_data || !parent || !item_data->r_swallow_path) {
1514                 return NULL;
1515         }
1516
1517 #if 0
1518         Evas_Object *icon = elm_icon_add(parent);
1519         elm_image_file_set(icon, item_data->r_swallow_path, NULL);
1520         evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
1521         if (!safeStrCmp(item_data->r_swallow_path, SETTING_IMAGE_PATH_CFG"00_list_button_expand_closed.png"))
1522                 else if (!safeStrCmp(item_data->r_swallow_path, SETTING_IMAGE_PATH_CFG"00_list_button_expand_opened.png"))
1523                         return icon;
1524 #else
1525         Evas_Object *ic = NULL;
1526         ic = elm_layout_add(parent);
1527         Evas_Object *icon = NULL;
1528
1529         elm_layout_theme_set(ic, "layout", "list/C/type.3", "default");
1530         icon = elm_image_add(parent);
1531         if (!safeStrCmp(item_data->r_swallow_path, SETTING_IMAGE_PATH_CFG"00_list_button_expand_closed.png"))
1532                 setting_decorate_image_RGBA(icon, 14, 41, 73, 255);
1533         else if (!safeStrCmp(item_data->r_swallow_path, SETTING_IMAGE_PATH_CFG"00_list_button_expand_opened.png"))
1534                 setting_decorate_image_RGBA(icon, 14, 41, 73, 255);
1535         elm_image_file_set(icon, item_data->r_swallow_path, NULL);
1536         evas_object_size_hint_align_set(icon, 0.0, EVAS_HINT_FILL);
1537         evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1538         elm_layout_content_set(ic, "elm.swallow.content", icon);
1539         return ic;
1540
1541 #endif
1542 }
1543
1544 /* draw handler */
1545 typedef Evas_Object *(*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
1546 typedef struct {
1547         SWALLOW_Type type;                      /* ui type */
1548         __drawer_fp draw;
1549 } __Content_Drawer;
1550 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
1551         /*base objects */
1552         {SWALLOW_Type_1CHECK, __add_check},
1553         {SWALLOW_Type_1ICON_1CHECK, __add_check},
1554         {SWALLOW_Type_1TOGGLE, __add_toggle},
1555         {SWALLOW_Type_1RADIO, __add_radio},
1556         {SWALLOW_Type_1BUTTON, __add_button},
1557         {SWALLOW_Type_1GIF, __add_gif},
1558         {SWALLOW_Type_1IMAGE, __add_image},
1559         {SWALLOW_Type_1TEXT_1IMAGE, __add_image},
1560
1561         /*base objects in an layout */
1562         {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
1563         {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
1564         {SWALLOW_Type_LAYOUT_5STEP_SLIDER, __add_5step_slider},
1565         /*{SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield2}, */
1566         {SWALLOW_Type_LOAD_LAYOUT, __add_layout},
1567
1568         /*other compelx objects */
1569         {SWALLOW_Type_1SEARCH, __add_search},
1570         {SWALLOW_Type_1PROCESS, __add_process},
1571         {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
1572         {SWALLOW_Type_1CHECKICON, __add_check_icon},
1573         {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
1574         {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
1575         {SWALLOW_Type_1RADIO_1BTN, __add_radio},
1576         {SWALLOW_Type_1RADIO_1TEXT, __add_radio_text},
1577
1578         /*left part object of the type */
1579         {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
1580         {SWALLOW_Type_1ICON_1PROCESS, __add_left_default},
1581         {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
1582 };
1583 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
1584         /*right part object of the type */
1585         {SWALLOW_Type_1CHECK_RIGHT, __add_check},
1586         {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
1587         {SWALLOW_Type_1ICON_1CHECK, __add_right_default},
1588         {SWALLOW_Type_1ICON_1DOTTOOGLE, __add_dot_toggle},
1589         {SWALLOW_Type_1ICON_1PROCESS, __add_process},
1590         {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
1591         {SWALLOW_Type_1RADIO_1BTN, __add_button},
1592         {SWALLOW_Type_1RADIO_RIGHT, __add_radio_right},
1593 };
1594
1595 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
1596         /*end part object of the type */
1597         {SWALLOW_Type_1RADIO, __add_radio},
1598 };
1599
1600 static void __multiline_eraser_clicked(void *data, Evas_Object *obj, void *event_info) /* When X marked button clicked, make string as empty. */
1601 {
1602         Setting_GenGroupItem_Data *list_item = data;
1603         Evas_Object *entry = elm_object_item_part_content_get(list_item->item, "elm.icon.entry");
1604         elm_object_focus_set(entry, EINA_TRUE); /* After button is clicked, entry should get focus again. */
1605         elm_entry_entry_set(entry, "");
1606 }
1607
1608 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
1609                                             const char *part)
1610 {
1611         retv_if(!data, NULL);
1612         Setting_GenGroupItem_Data *item_data = data;
1613         retv_if(!data, NULL);
1614         __Content_Drawer *cd_list = NULL;
1615         __drawer_fp fp = NULL;
1616         /*SETTING_TRACE("content get [%s]",part); */
1617
1618
1619         if (!safeStrCmp(part, "elm.icon.1")) { /* LEFT AREA */
1620                 if (item_data->swallow_type == SWALLOW_Type_LAYOUT_EDITFIELD
1621                     && item_data->isPasswordFlag == TRUE)
1622                         return NULL;
1623                 fp = __add_left_default; /*hold default drawer */
1624                 cd_list = __cd_left;
1625         } else if (!safeStrCmp(part, "elm.icon.2")) { /* RIGHT AREA */
1626                 if (item_data->swallow_type == SWALLOW_Type_LAYOUT_EDITFIELD
1627                     && item_data->isPasswordFlag == TRUE)
1628                         return NULL;
1629                 fp = __add_right_default; /*hold default drawer */
1630                 cd_list = __cd_right;
1631         } else if (!safeStrCmp(part, "elm.icon")) { /* CENTER WHOLE */
1632                 fp = __add_left_default; /*hold default drawer */
1633                 cd_list = __cd_left;
1634         } else if (!safeStrCmp(part, "elm.swallow.end")) {
1635                 /*the default value of fp is NULL here */
1636                 cd_list = __cd_end;
1637         }
1638         /* To do : add code for editfield */
1639         else if (!safeStrCmp(part, "elm.icon.entry")) {
1640                 if (item_data->swallow_type == SWALLOW_Type_LAYOUT_DATEFIELD) {
1641                         /*fp = __add_datefield; */
1642                         fp = __add_datefield_new;
1643                 } else {
1644                         fp = __add_entry_without_layout;
1645                 }
1646         } else if (!safeStrCmp(part, "elm.icon.eraser")) {
1647                 /*fp = __add_button_eraser; */
1648                 Evas_Object *btn = elm_button_add(obj);
1649                 elm_object_style_set(btn, "editfield_clear"); /*Make "X" marked button by changing style. */
1650                 evas_object_smart_callback_add(btn, "clicked", __multiline_eraser_clicked, item_data);
1651                 return btn;
1652         } else if (!safeStrCmp(part, "elm.icon.edit")) {
1653                 Evas_Object *btn = elm_button_add(obj);
1654                 elm_object_style_set(btn, "minus");
1655                 evas_object_propagate_events_set(btn, EINA_FALSE);
1656                 return btn;
1657         }
1658         /* End. */
1659
1660         /*if (!cd_list) return NULL;//invalid part */
1661
1662         if (cd_list) {
1663                 int idx = 0;
1664                 for (; idx < SWALLOW_Type_MAX; idx++) {
1665                         if (item_data->swallow_type == cd_list[idx].type) { /*match using swallow type */
1666                                 fp = cd_list[idx].draw;
1667                                 break;
1668                         }
1669                 }
1670         }
1671         return fp ? fp(item_data, obj) : NULL;
1672 }
1673
1674 static void _gl_Gendial_del(void *data, Evas_Object *obj)
1675 {
1676         /* SETTING_TRACE_BEGIN; */
1677         Setting_GenGroupItem_Data *item_data =
1678             (Setting_GenGroupItem_Data *) data;
1679         if (item_data) {
1680                 item_data->eo_check = NULL;/*set to NULL at once */
1681                 G_FREE(item_data->keyStr);
1682                 G_FREE(item_data->sub_desc);
1683                 G_FREE(item_data->guide_text);
1684                 G_FREE((item_data->l_swallow_path));
1685                 G_FREE((item_data->r_swallow_path));
1686                 G_FREE(item_data->item_style);
1687
1688
1689                 if (item_data->digits_filter_data) {
1690                         G_FREE(item_data->digits_filter_data->accepted);
1691                         G_FREE(item_data->digits_filter_data->rejected);
1692                         FREE(item_data->digits_filter_data);
1693
1694                 }
1695
1696                 if (item_data->notify) {
1697                         evas_object_del(item_data->notify);
1698                         item_data->notify = NULL;
1699                 }
1700
1701                 FREE(item_data->limit_filter_data);
1702                 __BACK_POINTER_UNSET(item_data);
1703                 FREE(item_data);
1704                 data = NULL;
1705         }
1706         /* SETTING_TRACE_END; */
1707 }
1708
1709 /**
1710  * To intialize an Elm_Genlist_Item_Class, according to item style
1711  *
1712  * @param[in] item_style
1713  * @param[in/out] itc
1714  */
1715 EXPORT_PUBLIC
1716 bool setting_create_Gendial_itc(const char *item_style,
1717                                 Elm_Genlist_Item_Class *itc)
1718 {
1719         itc->item_style = item_style;
1720         itc->func.text_get = _gl_Gendial_text_get;
1721         itc->func.content_get = _gl_Gendial_content_get;
1722         itc->func.state_get = NULL;
1723         itc->func.del = _gl_Gendial_del;        /* _gl_Gendial_del; */
1724         return TRUE;
1725 }
1726
1727 /**
1728  * Create group style item
1729  *
1730  * @return a pointer to Setting_GenGroupItem_Data
1731  */
1732 EXPORT_PUBLIC
1733 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
1734                                                                         const Elm_Genlist_Item_Class *itc,
1735                                                                         Elm_Object_Item *parent,
1736                                                                         Elm_Genlist_Item_Type flag,     /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
1737                                                                         const char *keyStr,
1738                                                                         setting_call_back_func gl_sel)
1739 {
1740         /* SETTING_TRACE_BEGIN; */
1741
1742         ADD_GL_SEPARATOR(genlist);
1743         Setting_GenGroupItem_Data *item_data =
1744             (Setting_GenGroupItem_Data *) calloc(1,
1745                                                  sizeof
1746                                                  (Setting_GenGroupItem_Data));
1747         setting_retvm_if(!item_data, NULL, "calloc failed");
1748         item_data->keyStr = (char *)g_strdup(keyStr);
1749         if (itc && itc->item_style) {
1750                 item_data->itc = (char *)g_strdup(itc->item_style);
1751         }
1752         if (gl_sel) {
1753                 item_data->item =
1754                     elm_genlist_item_append(genlist, itc, item_data, parent,
1755                                             flag, gl_sel, NULL);
1756         } else {
1757                 item_data->item =
1758                     elm_genlist_item_append(genlist, itc, item_data, parent,
1759                                             flag, _gl_Gendial_sel, NULL);
1760         }
1761         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1762         return item_data;
1763 }
1764
1765 /**
1766  * Create separator style item with title
1767  *
1768  * @return a pointer to Setting_GenGroupItem_Data
1769  */
1770 EXPORT_PUBLIC Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
1771     Evas_Object *genlist,
1772     const Elm_Genlist_Item_Class *itc,
1773     const char *keyStr,
1774     setting_call_back_func gl_sel)
1775 {
1776         /* SETTING_TRACE_BEGIN; */
1777         Setting_GenGroupItem_Data *item_data =
1778             (Setting_GenGroupItem_Data *) calloc(1,
1779                                                  sizeof
1780                                                  (Setting_GenGroupItem_Data));
1781         setting_retvm_if(!item_data, NULL, "calloc failed");
1782         item_data->keyStr = (char *)g_strdup(keyStr);
1783         if (itc && itc->item_style) {
1784                 item_data->itc = (char *)g_strdup(itc->item_style);
1785         }
1786         if (gl_sel) {
1787                 item_data->item =
1788                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1789                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1790                                             NULL);
1791         } else {
1792                 item_data->item =
1793                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1794                                             ELM_GENLIST_ITEM_NONE,
1795                                             _gl_Gendial_sel, NULL);
1796         }
1797         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1798         return item_data;
1799 }
1800
1801 /**
1802  * Create 1radio-1text style item
1803  *
1804  * @return a pointer to Setting_GenGroupItem_Data
1805  */
1806 EXPORT_PUBLIC
1807 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
1808     Evas_Object *genlist,
1809     const Elm_Genlist_Item_Class *itc,
1810     setting_call_back_func gl_sel,
1811     void *sel_data,
1812     SWALLOW_Type swallow_type,
1813     Evas_Object *rgd, int chk_status,
1814     const char *keyStr,
1815     setting_call_back_func chk_change_cb)
1816 {
1817         /* SETTING_TRACE_BEGIN; */
1818         Setting_GenGroupItem_Data *item_data =
1819             (Setting_GenGroupItem_Data *) calloc(1,
1820                                                  sizeof
1821                                                  (Setting_GenGroupItem_Data));
1822         setting_retvm_if(!item_data, NULL, "calloc failed");
1823         item_data->keyStr = (char *)g_strdup(keyStr);
1824         item_data->swallow_type = swallow_type;
1825         item_data->chk_status = chk_status;
1826         item_data->chk_change_cb = chk_change_cb;
1827         item_data->rgd = rgd;
1828         if (itc && itc->item_style) {
1829                 item_data->itc = (char *)g_strdup(itc->item_style);
1830         }
1831
1832         if (gl_sel) {
1833                 item_data->item =
1834                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1835                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1836                                             sel_data);
1837         } else {
1838                 item_data->item =
1839                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1840                                             ELM_GENLIST_ITEM_NONE,
1841                                             _gl_Gendial_sel, sel_data);
1842         }
1843         return item_data;
1844 }
1845
1846 /**
1847  * Create 1radio-2text style item
1848  *
1849  * @return a pointer to Setting_GenGroupItem_Data
1850  */
1851 EXPORT_PUBLIC
1852 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio_2text(
1853     Evas_Object *genlist,
1854     const Elm_Genlist_Item_Class *itc,
1855     setting_call_back_func gl_sel,
1856     void *sel_data,
1857     SWALLOW_Type swallow_type,
1858     Evas_Object *rgd, int chk_status,
1859     const char *keyStr,
1860     char *sub_desc,
1861     setting_call_back_func chk_change_cb)
1862 {
1863         /* SETTING_TRACE_BEGIN; */
1864         Setting_GenGroupItem_Data *item_data =
1865             (Setting_GenGroupItem_Data *) calloc(1,
1866                                                  sizeof
1867                                                  (Setting_GenGroupItem_Data));
1868         setting_retvm_if(!item_data, NULL, "calloc failed");
1869         item_data->keyStr = (char *)g_strdup(keyStr);
1870         item_data->swallow_type = swallow_type;
1871         item_data->chk_status = chk_status;
1872         item_data->chk_change_cb = chk_change_cb;
1873         item_data->rgd = rgd;
1874         item_data->sub_desc = (char *)g_strdup(sub_desc);
1875         if (itc && itc->item_style) {
1876                 item_data->itc = (char *)g_strdup(itc->item_style);
1877         }
1878
1879         if (gl_sel) {
1880                 item_data->item =
1881                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1882                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1883                                             sel_data);
1884         } else {
1885                 item_data->item =
1886                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1887                                             ELM_GENLIST_ITEM_NONE,
1888                                             _gl_Gendial_sel, sel_data);
1889         }
1890         return item_data;
1891 }
1892
1893
1894 EXPORT_PUBLIC
1895 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio_1button(
1896     Evas_Object *genlist,
1897     const Elm_Genlist_Item_Class *itc,
1898     setting_call_back_func gl_sel,
1899     void *sel_data,
1900     SWALLOW_Type swallow_type,
1901     char *button_style,
1902     Evas_Object *rgd, int chk_status,
1903     const char *keyStr,
1904     setting_call_back_func chk_change_cb,
1905     setting_call_back_func btn_clicked_cb)
1906 {
1907         /* SETTING_TRACE_BEGIN; */
1908         Setting_GenGroupItem_Data *item_data =
1909             (Setting_GenGroupItem_Data *) calloc(1,
1910                                                  sizeof
1911                                                  (Setting_GenGroupItem_Data));
1912         setting_retvm_if(!item_data, NULL, "calloc failed");
1913         item_data->keyStr = (char *)g_strdup(keyStr);
1914         item_data->swallow_type = swallow_type;
1915         if (SWALLOW_Type_1RADIO_RIGHT == swallow_type) {
1916                 /*Radio in right,so icon is in left */
1917                 item_data->l_swallow_path = (char *)g_strdup(button_style);
1918         } else {
1919                 item_data->r_swallow_path = (char *)g_strdup(button_style);
1920         }
1921         item_data->chk_status = chk_status;
1922         item_data->chk_change_cb = chk_change_cb;
1923         item_data->stop_change_cb = btn_clicked_cb;
1924         item_data->rgd = rgd;
1925         if (itc && itc->item_style) {
1926                 item_data->itc = (char *)g_strdup(itc->item_style);
1927         }
1928
1929         if (gl_sel) {
1930                 item_data->item =
1931                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1932                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1933                                             sel_data);
1934         } else {
1935                 item_data->item =
1936                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1937                                             ELM_GENLIST_ITEM_NONE,
1938                                             _gl_Gendial_sel, sel_data);
1939         }
1940         return item_data;
1941 }
1942
1943 EXPORT_PUBLIC
1944 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1945     Evas_Object *genlist,
1946     const Elm_Genlist_Item_Class *itc,
1947     setting_call_back_func gl_sel,
1948     void *sel_data,
1949     SWALLOW_Type swallow_type,
1950     Evas_Object *rgd, int chk_status,
1951     const char *keyStr,
1952     const char *sub_desc,
1953     setting_call_back_func chk_change_cb)
1954 {
1955         /* SETTING_TRACE_BEGIN; */
1956         Setting_GenGroupItem_Data *item_data =
1957             (Setting_GenGroupItem_Data *) calloc(1,
1958                                                  sizeof
1959                                                  (Setting_GenGroupItem_Data));
1960         setting_retvm_if(!item_data, NULL, "calloc failed");
1961         item_data->keyStr = (char *)g_strdup(keyStr);
1962         item_data->sub_desc = (char *)g_strdup(sub_desc);
1963         item_data->swallow_type = swallow_type;
1964         item_data->chk_status = chk_status;
1965         item_data->chk_change_cb = chk_change_cb;
1966         item_data->rgd = rgd;
1967         if (itc && itc->item_style) {
1968                 item_data->itc = (char *)g_strdup(itc->item_style);
1969         }
1970
1971         if (gl_sel) {
1972                 item_data->item =
1973                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1974                                             ELM_GENLIST_ITEM_NONE, gl_sel,
1975                                             sel_data);
1976         } else {
1977                 item_data->item =
1978                     elm_genlist_item_append(genlist, itc, item_data, NULL,
1979                                             ELM_GENLIST_ITEM_NONE,
1980                                             _gl_Gendial_sel, sel_data);
1981         }
1982         return item_data;
1983 }
1984
1985 /**
1986  * Create common style item with menu icon
1987  *
1988  * @return a pointer to Setting_GenGroupItem_Data
1989  */
1990 EXPORT_PUBLIC
1991 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1992     Evas_Object *genlist,
1993     const Elm_Genlist_Item_Class *itc,
1994     Elm_Object_Item *parent,
1995     setting_call_back_func gl_sel,
1996     void *sel_data,
1997     SWALLOW_Type swallow_type,
1998     char *l_icon_path,
1999     char *r_icon_path, int chk_status,
2000     const char *keyStr, char *sub_desc,
2001     setting_call_back_func
2002     chk_change_cb)
2003 {
2004         /*      SETTING_TRACE_BEGIN; */
2005         Setting_GenGroupItem_Data *item_data = (
2006                                                    Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
2007         setting_retvm_if(!item_data, NULL, "calloc failed");
2008
2009         /* to do formatting customizition in one place */
2010         if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
2011             || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
2012                 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
2013
2014                 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
2015                 char *temp1 = (char *)keyStr;
2016                 char *temp2 = strchr(temp1, '&');
2017                 char *temp = NULL;
2018
2019                 while (NULL != temp2) {
2020                         if (0 == safeStrNCmp(temp2, "&amp;", strlen("&amp;")) ||/*'&' */
2021                             0 == safeStrNCmp(temp2, "&lt;", strlen("&lt;")) ||/*'<' */
2022                             0 == safeStrNCmp(temp2, "&gt;", strlen("&gt;")) ||/*'>' */
2023                             0 == safeStrNCmp(temp2, "&quot;", strlen("&quot;")) ||/*double quotes */
2024                             0 == safeStrNCmp(temp2, "&apos;", strlen("&apos;")) ||/*single quotes */
2025                             0 == safeStrNCmp(temp2, "&nbsp;", strlen("&nbsp;")) ||/*space character */
2026                             0 == safeStrNCmp(temp2, "&copy;", strlen("&copy;")) ||/*copyright character */
2027                             0 == safeStrNCmp(temp2, "&reg;", strlen("&reg;"))/*registeration character */
2028                            ) {/*escape character,do nothing */
2029                                 temp = temp2 + 1;
2030                                 if ('\0' == temp[0]) break;
2031                                 temp2 = strchr(temp, '&');
2032                         } else {
2033                                 g_strlcat(speciliztion, temp1, temp2 - temp1 + 1);
2034                                 g_strlcat(speciliztion, "&amp;", MAX_SPECIALIZITION_LEN);
2035                                 temp1 = temp2 + 1;
2036                                 if ('\0' == temp1[0]) break;
2037                                 temp2 = strchr(temp1, '&');
2038                         }
2039                 }
2040                 if ('\0' != temp1[0]) {
2041                         g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
2042                 }
2043
2044
2045                 item_data->keyStr = (char *)g_strdup(speciliztion);
2046         } else {
2047                 item_data->keyStr = (char *)g_strdup(keyStr);
2048         }
2049
2050         item_data->sub_desc = NULL;
2051         if (sub_desc)
2052                 item_data->sub_desc = (char *)g_strdup(sub_desc);
2053
2054         item_data->swallow_type = swallow_type;
2055         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
2056         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
2057         item_data->chk_status = chk_status;
2058         item_data->chk_change_cb = chk_change_cb;
2059         if (itc && itc->item_style) {
2060                 item_data->itc = (char *)g_strdup(itc->item_style);
2061         }
2062
2063         const char *insert_type = evas_object_data_get(genlist, "InsertType");
2064         /*SETTING_TRACE("insert_type:%s", insert_type); */
2065         if (!gl_sel) gl_sel = _gl_Gendial_sel;
2066         if (0 == safeStrCmp(insert_type, "Insert before")) {
2067                 item_data->item =
2068                     elm_genlist_item_insert_before(genlist, itc, item_data, parent, parent,
2069                                                    ELM_GENLIST_ITEM_NONE, gl_sel,
2070                                                    sel_data);
2071         } else if (0 == safeStrCmp(insert_type, "Insert after")) {
2072                 item_data->item =
2073                     elm_genlist_item_insert_after(genlist, itc, item_data, parent, parent,
2074                                                   ELM_GENLIST_ITEM_NONE, gl_sel,
2075                                                   sel_data);
2076         } else if (0 == safeStrCmp(insert_type, "Prepend")) {
2077                 item_data->item =
2078                     elm_genlist_item_prepend(genlist, itc, item_data, parent,
2079                                              ELM_GENLIST_ITEM_NONE, gl_sel,
2080                                              sel_data);
2081         } else {
2082                 item_data->item =
2083                     elm_genlist_item_append(genlist, itc, item_data, parent,
2084                                             ELM_GENLIST_ITEM_NONE, gl_sel,
2085                                             sel_data);
2086         }
2087         /*help text clicking issue */
2088         if (SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type)
2089                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2090         evas_object_data_set(genlist, "InsertType", NULL);/*redundant process,it should be due to invokers,but maybe they forget it */
2091
2092         return item_data;
2093 }
2094
2095 EXPORT_PUBLIC
2096 Setting_GenGroupItem_Data *setting_create_Gendial_field_helpitem_without_bottom_separator(
2097     Evas_Object *genlist,
2098     const Elm_Genlist_Item_Class *itc,
2099     SWALLOW_Type swallow_type,
2100     const char *keyStr)
2101 {
2102         /*      SETTING_TRACE_BEGIN; */
2103         Setting_GenGroupItem_Data *item_data = (
2104                                                    Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
2105         setting_retvm_if(!item_data, NULL, "calloc failed");
2106
2107         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
2108
2109         char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
2110         char *temp1 = (char *)keyStr;
2111         char *temp2 = strchr(temp1, '&');
2112         char *temp = NULL;
2113
2114         while (NULL != temp2) {
2115                 if (0 == safeStrNCmp(temp2, "&amp;", strlen("&amp;")) ||/*'&' */
2116                     0 == safeStrNCmp(temp2, "&lt;", strlen("&lt;")) ||/*'<' */
2117                     0 == safeStrNCmp(temp2, "&gt;", strlen("&gt;")) ||/*'>' */
2118                     0 == safeStrNCmp(temp2, "&quot;", strlen("&quot;")) ||/*double quotes */
2119                     0 == safeStrNCmp(temp2, "&apos;", strlen("&apos;")) ||/*single quotes */
2120                     0 == safeStrNCmp(temp2, "&nbsp;", strlen("&nbsp;")) ||/*space character */
2121                     0 == safeStrNCmp(temp2, "&copy;", strlen("&copy;")) ||/*copyright character */
2122                     0 == safeStrNCmp(temp2, "&reg;", strlen("&reg;"))/*registeration character */
2123                    ) {/*escape character,do nothing */
2124                         temp = temp2 + 1;
2125                         if ('\0' == temp[0]) break;
2126                         temp2 = strchr(temp, '&');
2127                 } else {
2128                         g_strlcat(speciliztion, temp1, temp2 - temp1 + 1);
2129                         g_strlcat(speciliztion, "&amp;", MAX_SPECIALIZITION_LEN);
2130                         temp1 = temp2 + 1;
2131                         if ('\0' == temp1[0]) break;
2132                         temp2 = strchr(temp1, '&');
2133                 }
2134         }
2135         if ('\0' != temp1[0]) {
2136                 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
2137         }
2138
2139
2140         item_data->keyStr = (char *)g_strdup(speciliztion);
2141         item_data->swallow_type = swallow_type;
2142         if (itc && itc->item_style) {
2143                 item_data->itc = (char *)g_strdup(itc->item_style);
2144         }
2145
2146         item_data->item =
2147             elm_genlist_item_append(genlist, itc, item_data, NULL,
2148                                     ELM_GENLIST_ITEM_NONE,
2149                                     NULL, NULL);
2150
2151         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2152         return item_data;
2153 }
2154
2155 EXPORT_PUBLIC
2156 Setting_GenGroupItem_Data *setting_create_Gendial_field_insert_help_without_bottom_separator(
2157     Evas_Object *genlist,
2158     const Elm_Genlist_Item_Class *itc,
2159     Elm_Object_Item *after_it,
2160     SWALLOW_Type swallow_type,
2161     const char *keyStr)
2162 {
2163         /*      SETTING_TRACE_BEGIN; */
2164         Setting_GenGroupItem_Data *item_data = (
2165                                                    Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
2166         setting_retvm_if(!item_data, NULL, "calloc failed");
2167
2168         elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
2169
2170         char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
2171         char *temp1 = (char *)keyStr;
2172         char *temp2 = strchr(temp1, '&');
2173         char *temp = NULL;
2174
2175         while (NULL != temp2) {
2176                 if (0 == safeStrNCmp(temp2, "&amp;", strlen("&amp;")) ||/*'&' */
2177                     0 == safeStrNCmp(temp2, "&lt;", strlen("&lt;")) ||/*'<' */
2178                     0 == safeStrNCmp(temp2, "&gt;", strlen("&gt;")) ||/*'>' */
2179                     0 == safeStrNCmp(temp2, "&quot;", strlen("&quot;")) ||/*double quotes */
2180                     0 == safeStrNCmp(temp2, "&apos;", strlen("&apos;")) ||/*single quotes */
2181                     0 == safeStrNCmp(temp2, "&nbsp;", strlen("&nbsp;")) ||/*space character */
2182                     0 == safeStrNCmp(temp2, "&copy;", strlen("&copy;")) ||/*copyright character */
2183                     0 == safeStrNCmp(temp2, "&reg;", strlen("&reg;"))/*registeration character */
2184                    ) {/*escape character,do nothing */
2185                         temp = temp2 + 1;
2186                         if ('\0' == temp[0]) break;
2187                         temp2 = strchr(temp, '&');
2188                 } else {
2189                         g_strlcat(speciliztion, temp1, temp2 - temp1 + 1);
2190                         g_strlcat(speciliztion, "&amp;", MAX_SPECIALIZITION_LEN);
2191                         temp1 = temp2 + 1;
2192                         if ('\0' == temp1[0]) break;
2193                         temp2 = strchr(temp1, '&');
2194                 }
2195         }
2196         if ('\0' != temp1[0]) {
2197                 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
2198         }
2199
2200
2201         item_data->keyStr = (char *)g_strdup(speciliztion);
2202         item_data->swallow_type = swallow_type;
2203         if (itc && itc->item_style) {
2204                 item_data->itc = (char *)g_strdup(itc->item_style);
2205         }
2206
2207         item_data->item =
2208             elm_genlist_item_insert_after(genlist, itc, item_data, NULL, after_it,
2209                                           ELM_GENLIST_ITEM_NONE,
2210                                           NULL, NULL);
2211
2212         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2213         return item_data;
2214 }
2215
2216
2217 /**
2218  * Common function to create a genlist item
2219  * @return a pointer to Setting_GenGroupItem_Data
2220  */
2221 EXPORT_PUBLIC Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
2222                                                                           genlist,
2223                                                                           const Elm_Genlist_Item_Class *itc,
2224                                                                           setting_call_back_func
2225                                                                           gl_sel,
2226                                                                           void *sel_data,
2227                                                                           SWALLOW_Type
2228                                                                           swallow_type,
2229                                                                           char *l_icon_path,
2230                                                                           char *r_icon_path,
2231                                                                           int chk_status,
2232                                                                           const char *keyStr,
2233                                                                           char *sub_desc,
2234                                                                           setting_call_back_func chk_change_cb)
2235 {
2236         return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
2237                                                       gl_sel, sel_data,
2238                                                       swallow_type, l_icon_path,
2239                                                       r_icon_path, chk_status,
2240                                                       keyStr, sub_desc,
2241                                                       chk_change_cb);
2242 }
2243
2244 /**
2245  * Create 1entry style item
2246  * focus out
2247  * @return a pointer to Setting_GenGroupItem_Data
2248  */
2249 EXPORT_PUBLIC
2250 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo(
2251     Evas_Object *genlist,
2252     const Elm_Genlist_Item_Class *itc,
2253     setting_call_back_func gl_sel,
2254     void *sel_data,
2255     SWALLOW_Type swallow_type,
2256     char *l_icon_path,
2257     char *r_icon_path,
2258     int chk_status,
2259     const char *keyStr,
2260     char *sub_desc,
2261     setting_call_back_func chk_change_cb,
2262     setting_call_back_func chk_focus_out_cb,
2263     Elm_Input_Panel_Layout input_type,
2264     bool isPasswordFlag,
2265     bool isFocusFlag,
2266     int min_char_count,
2267     int max_char_count,
2268     int max_byte_count,
2269     char *accepted,
2270     char *rejected)
2271 {
2272         /* SETTING_TRACE_BEGIN; */
2273         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
2274         setting_retvm_if(!item_data, NULL, "calloc failed");
2275         item_data->keyStr = (char *)g_strdup(keyStr);
2276         item_data->sub_desc = (char *)g_strdup(sub_desc);
2277         item_data->swallow_type = swallow_type;
2278         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
2279         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
2280         item_data->chk_status = chk_status;
2281         item_data->chk_change_cb = chk_change_cb;
2282         item_data->stop_change_cb = chk_focus_out_cb;
2283         item_data->isSinglelineFlag = true;
2284
2285         item_data->input_type = input_type;
2286         item_data->isPasswordFlag = isPasswordFlag;
2287         item_data->isFocusFlag = isFocusFlag;
2288         if (itc && itc->item_style) {
2289                 item_data->itc = (char *)g_strdup(itc->item_style);
2290         }
2291
2292         Elm_Entry_Filter_Accept_Set *digits_filter_data =
2293             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
2294         if (!digits_filter_data) {
2295                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
2296                 /* free allocated data */
2297                 G_FREE(item_data->keyStr);
2298                 G_FREE(item_data->sub_desc);
2299                 G_FREE(item_data->l_swallow_path);
2300                 G_FREE(item_data->r_swallow_path);
2301                 G_FREE(item_data->itc);
2302                 FREE(item_data);
2303                 return NULL;
2304         }
2305
2306
2307         Elm_Entry_Filter_Limit_Size *limit_filter_data =
2308             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof(Elm_Entry_Filter_Limit_Size));
2309         if (!limit_filter_data) {
2310                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
2311
2312                 /* free allocated data */
2313                 G_FREE(item_data->keyStr);
2314                 G_FREE(item_data->sub_desc);
2315                 G_FREE(item_data->l_swallow_path);
2316                 G_FREE(item_data->r_swallow_path);
2317                 G_FREE(item_data->itc);
2318                 FREE(item_data);
2319                 FREE(digits_filter_data);
2320                 return NULL;
2321         }
2322
2323         limit_filter_data->max_char_count = max_char_count;
2324         limit_filter_data->max_byte_count = max_byte_count;
2325         digits_filter_data->accepted = (char *)g_strdup(accepted);
2326         digits_filter_data->rejected = (char *)g_strdup(rejected);
2327
2328         item_data->digits_filter_data = digits_filter_data;
2329         item_data->limit_filter_data = limit_filter_data;
2330         item_data->userdata = sel_data;
2331
2332         item_data->minlength = min_char_count;
2333
2334         if (gl_sel) {
2335                 item_data->item =
2336                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2337                                             ELM_GENLIST_ITEM_NONE, gl_sel,
2338                                             sel_data);
2339         } else {
2340                 item_data->item =
2341                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2342                                             ELM_GENLIST_ITEM_NONE,
2343                                             _gl_Gendial_sel, sel_data);
2344         }
2345         return item_data;
2346 }
2347
2348 /**
2349  * Create 1entry style item
2350  * @return a pointer to Setting_GenGroupItem_Data
2351  */
2352 EXPORT_PUBLIC
2353 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
2354                                                               genlist,
2355                                                               const Elm_Genlist_Item_Class *itc,
2356                                                               setting_call_back_func gl_sel,
2357                                                               void *sel_data,
2358                                                               SWALLOW_Type
2359                                                               swallow_type,
2360                                                               char *l_icon_path,
2361                                                               char *r_icon_path,
2362                                                               int chk_status,
2363                                                               const char *keyStr,
2364                                                               char *sub_desc,
2365                                                               setting_call_back_func
2366                                                               chk_change_cb,
2367                                                               Elm_Input_Panel_Layout
2368                                                               input_type,
2369                                                               bool isPasswordFlag,
2370                                                               bool isFocusFlag,
2371                                                               int max_char_count,
2372                                                               int max_byte_count,
2373                                                               char *accepted,
2374                                                               char *rejected)
2375 {
2376         /* SETTING_TRACE_BEGIN; */
2377         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
2378                                                                                     sizeof(Setting_GenGroupItem_Data));
2379         setting_retvm_if(!item_data, NULL, "calloc failed");
2380         item_data->keyStr = (char *)g_strdup(keyStr);
2381         item_data->sub_desc = (char *)g_strdup(sub_desc);
2382         item_data->swallow_type = swallow_type;
2383         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
2384         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
2385         item_data->chk_status = chk_status;
2386         item_data->chk_change_cb = chk_change_cb;
2387
2388         item_data->input_type = input_type;
2389         item_data->isPasswordFlag = isPasswordFlag;
2390         item_data->isFocusFlag = isFocusFlag;
2391         if (itc && itc->item_style) {
2392                 item_data->itc = (char *)g_strdup(itc->item_style);
2393         }
2394
2395         Elm_Entry_Filter_Accept_Set *digits_filter_data =
2396             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
2397         if (!digits_filter_data) {
2398                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
2399                 /* free allocated data */
2400                 G_FREE(item_data->keyStr);
2401                 G_FREE(item_data->sub_desc);
2402                 G_FREE(item_data->l_swallow_path);
2403                 G_FREE(item_data->r_swallow_path);
2404                 G_FREE(item_data->itc);
2405                 FREE(item_data);
2406                 return NULL;
2407         }
2408
2409
2410         Elm_Entry_Filter_Limit_Size *limit_filter_data =
2411             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof(Elm_Entry_Filter_Limit_Size));
2412         if (!limit_filter_data) {
2413                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
2414
2415                 /* free allocated data */
2416                 G_FREE(item_data->keyStr);
2417                 G_FREE(item_data->sub_desc);
2418                 G_FREE(item_data->l_swallow_path);
2419                 G_FREE(item_data->r_swallow_path);
2420                 G_FREE(item_data->itc);
2421                 FREE(item_data);
2422                 FREE(digits_filter_data);
2423                 return NULL;
2424         }
2425
2426         limit_filter_data->max_char_count = max_char_count;
2427         limit_filter_data->max_byte_count = max_byte_count;
2428         digits_filter_data->accepted = (char *)g_strdup(accepted);
2429         digits_filter_data->rejected = (char *)g_strdup(rejected);
2430
2431         item_data->digits_filter_data = digits_filter_data;
2432         item_data->limit_filter_data = limit_filter_data;
2433         item_data->userdata = sel_data;
2434
2435         if (gl_sel) {
2436                 item_data->item =
2437                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2438                                             ELM_GENLIST_ITEM_NONE, gl_sel,
2439                                             sel_data);
2440         } else {
2441                 item_data->item =
2442                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2443                                             ELM_GENLIST_ITEM_NONE,
2444                                             _gl_Gendial_sel, sel_data);
2445         }
2446
2447         if (swallow_type == SWALLOW_Type_LAYOUT_EDITFIELD)
2448                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2449
2450         return item_data;
2451 }
2452
2453 /**
2454  * Create 1entry style item with parameter return_key_type
2455  * @return a pointer to Setting_GenGroupItem_Data
2456  */
2457 EXPORT_PUBLIC
2458 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_with_return_key(Evas_Object *
2459                                                                               genlist,
2460                                                                               const Elm_Genlist_Item_Class *itc,
2461                                                                               setting_call_back_func gl_sel,
2462                                                                               void *sel_data,
2463                                                                               SWALLOW_Type
2464                                                                               swallow_type,
2465                                                                               char *l_icon_path,
2466                                                                               char *r_icon_path,
2467                                                                               int chk_status,
2468                                                                               const char *keyStr,
2469                                                                               char *sub_desc,
2470                                                                               setting_call_back_func
2471                                                                               chk_change_cb,
2472                                                                               setting_call_back_func
2473                                                                               max_reach_cb,
2474                                                                               Elm_Input_Panel_Layout
2475                                                                               input_type,
2476                                                                               bool isPasswordFlag,
2477                                                                               bool isFocusFlag,
2478                                                                               int max_char_count,
2479                                                                               int max_byte_count,
2480                                                                               char *accepted,
2481                                                                               char *rejected,
2482                                                                               Elm_Input_Panel_Return_Key_Type return_key_type,
2483                                                                               setting_call_back_func
2484                                                                               activated_cb,
2485                                                                               setting_call_back_func x_callback_cb)
2486 {
2487         /* SETTING_TRACE_BEGIN; */
2488         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
2489                                                                                     sizeof(Setting_GenGroupItem_Data));
2490         setting_retvm_if(!item_data, NULL, "calloc failed");
2491         item_data->keyStr = (char *)g_strdup(keyStr);
2492         item_data->sub_desc = (char *)g_strdup(sub_desc);
2493         item_data->swallow_type = swallow_type;
2494         item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
2495         item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
2496         item_data->chk_status = chk_status;
2497         item_data->chk_change_cb = chk_change_cb;
2498         item_data->maxlength_reached_cb = max_reach_cb;
2499         item_data->x_callback_cb = x_callback_cb;
2500
2501         item_data->input_type = input_type;
2502         item_data->isPasswordFlag = isPasswordFlag;
2503         item_data->isSinglelineFlag = isPasswordFlag;
2504         item_data->isFocusFlag = isFocusFlag;
2505         item_data->return_key_type = return_key_type;
2506         item_data->disable_auto_cap = EINA_TRUE;
2507         if (itc && itc->item_style) {
2508                 item_data->itc = (char *)g_strdup(itc->item_style);
2509         }
2510         Elm_Entry_Filter_Accept_Set *digits_filter_data =
2511             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
2512         if (!digits_filter_data) {
2513                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
2514                 /* free allocated data */
2515                 G_FREE(item_data->keyStr);
2516                 G_FREE(item_data->sub_desc);
2517                 G_FREE(item_data->l_swallow_path);
2518                 G_FREE(item_data->r_swallow_path);
2519                 G_FREE(item_data->itc);
2520                 FREE(item_data);
2521                 return NULL;
2522         }
2523
2524
2525         Elm_Entry_Filter_Limit_Size *limit_filter_data =
2526             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof(Elm_Entry_Filter_Limit_Size));
2527         if (!limit_filter_data) {
2528                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
2529
2530                 /* free allocated data */
2531                 G_FREE(item_data->keyStr);
2532                 G_FREE(item_data->sub_desc);
2533                 G_FREE(item_data->l_swallow_path);
2534                 G_FREE(item_data->r_swallow_path);
2535                 FREE(item_data->itc);
2536                 FREE(item_data);
2537                 FREE(digits_filter_data);
2538                 return NULL;
2539         }
2540
2541         limit_filter_data->max_char_count = max_char_count;
2542         limit_filter_data->max_byte_count = max_byte_count;
2543         digits_filter_data->accepted = (char *)g_strdup(accepted);
2544         digits_filter_data->rejected = (char *)g_strdup(rejected);
2545
2546         item_data->digits_filter_data = digits_filter_data;
2547         item_data->limit_filter_data = limit_filter_data;
2548         item_data->userdata = sel_data;
2549
2550         if (gl_sel) {
2551                 item_data->item =
2552                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2553                                             ELM_GENLIST_ITEM_NONE, gl_sel,
2554                                             sel_data);
2555         } else {
2556                 item_data->item =
2557                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2558                                             ELM_GENLIST_ITEM_NONE,
2559                                             _gl_Gendial_sel, sel_data);
2560         }
2561
2562         if (swallow_type == SWALLOW_Type_LAYOUT_EDITFIELD)
2563                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2564
2565         return item_data;
2566 }
2567
2568 /**
2569  * Create 1entry style item
2570  * @return a pointer to Setting_GenGroupItem_Data
2571  */
2572 EXPORT_PUBLIC
2573 Setting_GenGroupItem_Data *setting_create_Gendial_field_editfield(Evas_Object *
2574                                                                   genlist,
2575                                                                   const Elm_Genlist_Item_Class *itc,
2576                                                                   setting_call_back_func gl_sel,
2577                                                                   void *sel_data,
2578                                                                   SWALLOW_Type
2579                                                                   swallow_type,
2580                                                                   const char *keyStr,
2581                                                                   char *sub_desc,
2582                                                                   setting_call_back_func
2583                                                                   chk_change_cb,
2584                                                                   setting_call_back_func
2585                                                                   focused_cb,
2586                                                                   setting_call_back_func
2587                                                                   unfocused_cb,
2588                                                                   setting_call_back_func
2589                                                                   activated_cb,
2590                                                                   setting_call_back_func
2591                                                                   max_reached_cb,
2592                                                                   Elm_Input_Panel_Layout
2593                                                                   input_type,
2594                                                                   bool isPasswordFlag,
2595                                                                   bool isFocusFlag,
2596                                                                   int max_char_count,
2597                                                                   int max_byte_count,
2598                                                                   char *accepted,
2599                                                                   char *rejected)
2600 {
2601         /* SETTING_TRACE_BEGIN; */
2602         Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
2603                                                                                     sizeof(Setting_GenGroupItem_Data));
2604         setting_retvm_if(!item_data, NULL, "calloc failed");
2605         item_data->keyStr = (char *)g_strdup(keyStr);
2606         item_data->sub_desc = (char *)g_strdup(sub_desc);
2607         item_data->swallow_type = swallow_type;
2608         item_data->l_swallow_path = NULL;
2609         item_data->r_swallow_path = NULL;
2610         item_data->chk_status = 0;
2611         item_data->chk_change_cb = chk_change_cb;
2612         item_data->focus_cb = focused_cb;
2613         item_data->stop_change_cb = unfocused_cb;
2614         item_data->activated_cb = activated_cb;
2615         item_data->maxlength_reached_cb = max_reached_cb;
2616
2617         item_data->input_type = input_type;
2618         item_data->isPasswordFlag = isPasswordFlag;
2619         if (isPasswordFlag)
2620                 item_data->guide_text = (char *)g_strdup(_("IDS_ST_BODY_ENTER_PASSWORD"));
2621         item_data->isSinglelineFlag = isPasswordFlag;
2622         item_data->isFocusFlag = isFocusFlag;
2623         item_data->userdata = sel_data;
2624         if (itc && itc->item_style) {
2625                 item_data->itc = (char *)g_strdup(itc->item_style);
2626         }
2627         Elm_Entry_Filter_Accept_Set *digits_filter_data =
2628             (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
2629         if (!digits_filter_data) {
2630                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
2631                 /* free allocated data */
2632                 G_FREE(item_data->keyStr);
2633                 G_FREE(item_data->sub_desc);
2634                 G_FREE(item_data->guide_text);
2635                 G_FREE(item_data->itc);
2636                 FREE(item_data);
2637                 return NULL;
2638         }
2639
2640
2641         Elm_Entry_Filter_Limit_Size *limit_filter_data =
2642             (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof(Elm_Entry_Filter_Limit_Size));
2643         if (!limit_filter_data) {
2644                 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
2645
2646                 /* free allocated data */
2647                 G_FREE(item_data->keyStr);
2648                 G_FREE(item_data->sub_desc);
2649                 G_FREE(item_data->guide_text);
2650                 G_FREE(item_data->itc);
2651                 FREE(item_data);
2652                 FREE(digits_filter_data);
2653                 return NULL;
2654         }
2655
2656         limit_filter_data->max_char_count = max_char_count;
2657         limit_filter_data->max_byte_count = max_byte_count;
2658         digits_filter_data->accepted = (char *)g_strdup(accepted);
2659         digits_filter_data->rejected = (char *)g_strdup(rejected);
2660
2661         item_data->digits_filter_data = digits_filter_data;
2662         item_data->limit_filter_data = limit_filter_data;
2663         item_data->userdata = sel_data;
2664
2665         if (gl_sel) {
2666                 item_data->item =
2667                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2668                                             ELM_GENLIST_ITEM_NONE, gl_sel,
2669                                             sel_data);
2670         } else {
2671                 item_data->item =
2672                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2673                                             ELM_GENLIST_ITEM_NONE,
2674                                             _gl_Gendial_sel, sel_data);
2675         }
2676         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
2677
2678         return item_data;
2679 }
2680
2681 /**
2682  * General function to create a parent item of expandable item
2683  *
2684  * @return a pointer to Setting_GenGroupItem_Data
2685  */
2686 EXPORT_PUBLIC
2687 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
2688     Evas_Object *genlist,
2689     const Elm_Genlist_Item_Class *itc,
2690     setting_call_back_func gl_sel,
2691     void *sel_data,
2692     SWALLOW_Type swallow_type,
2693     const char *keyStr,
2694     char *sub_desc,
2695     setting_group_style exp_style,
2696     setting_group_style con_style)
2697 {
2698         /* SETTING_TRACE_BEGIN; */
2699         Setting_GenGroupItem_Data *item_data =
2700             (Setting_GenGroupItem_Data *) calloc(1,
2701                                                  sizeof
2702                                                  (Setting_GenGroupItem_Data));
2703         setting_retvm_if(!item_data, NULL, "calloc failed");
2704         item_data->keyStr = (char *)g_strdup(keyStr);
2705         item_data->sub_desc = (char *)g_strdup(sub_desc);
2706         item_data->swallow_type = swallow_type;
2707         item_data->exp_style = exp_style;
2708         item_data->con_style = con_style;
2709         item_data->group_style = con_style;
2710         item_data->r_swallow_path = (char *)g_strdup(SETTING_IMAGE_PATH_CFG"00_list_button_expand_closed.png");
2711         if (itc && itc->item_style) {
2712                 item_data->itc = (char *)g_strdup(itc->item_style);
2713         }
2714         if (gl_sel) {
2715                 item_data->item =
2716                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2717                                             ELM_GENLIST_ITEM_TREE, gl_sel,
2718                                             sel_data);
2719         } else {
2720                 item_data->item =
2721                     elm_genlist_item_append(genlist, itc, item_data, NULL,
2722                                             ELM_GENLIST_ITEM_TREE,
2723                                             _gl_Gendial_sel_expand, sel_data);
2724         }
2725         return item_data;
2726 }
2727
2728 /**
2729  * General function to create a subitem of expandable item
2730  *
2731  * @return a pointer to Setting_GenGroupItem_Data
2732  */
2733 EXPORT_PUBLIC
2734 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
2735     Evas_Object *genlist,
2736     const Elm_Genlist_Item_Class *itc,
2737     setting_call_back_func gl_sel,
2738     void *sel_data,
2739     Elm_Object_Item *parent,
2740     SWALLOW_Type swallow_type,
2741     Evas_Object *rgd, int chk_status,
2742     const char *keyStr,
2743     setting_call_back_func
2744     chk_change_cb)
2745 {
2746         /* SETTING_TRACE_BEGIN; */
2747         Setting_GenGroupItem_Data *item_data =
2748             (Setting_GenGroupItem_Data *) calloc(1,
2749                                                  sizeof
2750                                                  (Setting_GenGroupItem_Data));
2751         setting_retvm_if(!item_data, NULL, "calloc failed");
2752         item_data->keyStr = (char *)g_strdup(keyStr);
2753         item_data->swallow_type = swallow_type;
2754         item_data->chk_status = chk_status;
2755         item_data->rgd = rgd;
2756         if (itc && itc->item_style) {
2757                 item_data->itc = (char *)g_strdup(itc->item_style);
2758         }
2759         if (!gl_sel) {
2760                 gl_sel = setting_sub_list_sel_cb;
2761         }
2762         if (!chk_change_cb) {
2763                 chk_change_cb = setting_sub_list_rd_change;
2764         }
2765
2766         item_data->chk_change_cb = chk_change_cb;
2767         item_data->item =
2768             elm_genlist_item_append(genlist, itc, item_data, parent,
2769                                     ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
2770
2771         return item_data;
2772 }
2773
2774 /**
2775  * General function to create a subitem of expandable item with group style
2776  *
2777  * @return a pointer to Setting_GenGroupItem_Data
2778  */
2779 EXPORT_PUBLIC
2780 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field_with_group_style(
2781     Evas_Object *genlist,
2782     const Elm_Genlist_Item_Class *itc,
2783     setting_call_back_func gl_sel,
2784     void *sel_data,
2785     Elm_Object_Item *parent,
2786     SWALLOW_Type swallow_type,
2787     Evas_Object *rgd, int chk_status,
2788     const char *keyStr,
2789     setting_call_back_func
2790     chk_change_cb,
2791     setting_group_style group_style)
2792 {
2793         SETTING_TRACE_BEGIN
2794         Setting_GenGroupItem_Data *item_data =
2795             (Setting_GenGroupItem_Data *) calloc(1,
2796                                                  sizeof
2797                                                  (Setting_GenGroupItem_Data));
2798         setting_retvm_if(!item_data, NULL, "calloc failed");
2799         item_data->keyStr = (char *)g_strdup(keyStr);
2800         item_data->swallow_type = swallow_type;
2801         item_data->chk_status = chk_status;
2802         item_data->rgd = rgd;
2803         if (itc && itc->item_style) {
2804                 item_data->itc = (char *)g_strdup(itc->item_style);
2805         }
2806         if (!gl_sel) {
2807                 gl_sel = setting_sub_list_sel_cb;
2808         }
2809         if (!chk_change_cb) {
2810                 chk_change_cb = setting_sub_list_rd_change;
2811         }
2812
2813         item_data->chk_change_cb = chk_change_cb;
2814         item_data->group_style = group_style;
2815         item_data->item =
2816             elm_genlist_item_append(genlist, itc, item_data, parent,
2817                                     ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
2818         return item_data;
2819 }
2820
2821 /**
2822  * To make genlist support expandable style item
2823  */
2824 EXPORT_PUBLIC
2825 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
2826                                        setting_call_back_func gl_exp_cb,
2827                                        setting_call_back_func gl_smart_cb)
2828 {
2829         ret_if(NULL == genlist);
2830         elm_genlist_tree_effect_enabled_set(genlist, EINA_FALSE);
2831         if (!gl_smart_cb) {
2832                 gl_smart_cb = __exp_list_smart_cb;
2833         }
2834
2835         if (gl_exp_cb)
2836                 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
2837         evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
2838         evas_object_smart_callback_add(genlist, "expanded", gl_smart_cb, "expanded");
2839
2840         evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
2841         evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
2842 }
2843
2844 /*
2845 example:
2846
2847 setting_create_Gendial_itc("dialogue/1text.2icon.2",
2848                                                         &(networkUG->itc_1text_2icon));
2849
2850 1. create a process genlist item : [intial state is 'PROCESS']
2851 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
2852                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
2853                                                 SWALLOW_Type_1RADIO_1PROCESS,
2854                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
2855                                                 "Searching..", NULL);
2856 or [intial state is 'UNPROCESS']
2857 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
2858                                                 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
2859                                                 SWALLOW_Type_1RADIO,
2860                                                 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
2861                                                 "Searching..", NULL);
2862
2863 2. to set the PROCESS state at any place as you like:
2864 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
2865 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
2866 */
2867 EXPORT_PUBLIC
2868 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
2869 {
2870         if (data_item) {
2871                 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
2872                         return;
2873                 }
2874
2875                 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
2876                 elm_object_item_data_set(data_item->item, data_item);
2877                 elm_genlist_item_update(data_item->item);
2878         }
2879 }
2880
2881 EXPORT_PUBLIC
2882 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
2883 {
2884         if (data_item) {
2885                 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
2886                         return;
2887                 }
2888                 data_item->swallow_type = SWALLOW_Type_1RADIO;
2889                 elm_object_item_data_set(data_item->item, data_item);
2890                 elm_genlist_item_update(data_item->item);
2891         }
2892 }
2893
2894 /**
2895 * Check if some item is selected in done-list
2896 */
2897 EXPORT_PUBLIC
2898 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
2899 {
2900         SETTING_TRACE_BEGIN;
2901         bool isFound = FALSE;   /* wether can found some item checked */
2902         int idx = 0;
2903         for (; idx < list_data->cur_item_num; idx++) {
2904                 if (list_data->chk_items[idx].data_GenItem->chk_status) {
2905                         isFound = TRUE;
2906                         break;
2907                 }
2908         }
2909         return isFound;
2910 }
2911
2912 static void __setting_done_list_item_sel(void *data)
2913 {
2914         SETTING_TRACE_BEGIN;
2915         retm_if(data == NULL, "data == NULL");
2916         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
2917
2918         int sel_num = 0;
2919         int idx = 0;
2920         /* else for other checks, do rotinue checking */
2921         bool isFound = FALSE;   /* wether found the item not checked */
2922         for (idx = 0; idx < list_data->cur_item_num; idx++) {
2923                 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
2924                         /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
2925                         isFound = TRUE;
2926                         /* break; */
2927                 } else {
2928                         /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
2929                         sel_num++;
2930                 }
2931         }
2932
2933         list_data->cur_item_selnum = sel_num;
2934         if (isFound) {  /* reset state of chk_sel_all */
2935                 list_data->select_all_checked = 0;
2936                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
2937         } else {
2938                 list_data->select_all_checked = 1;
2939                 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
2940         }
2941
2942         if (sel_num > 0) {
2943                 char text[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, };
2944                 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, _("IDS_ST_HEADER_PD_SELECTED"), sel_num);
2945                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", text);
2946         } else {
2947                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", _(list_data->navi_title));
2948         }
2949
2950         /* SETTING_TRACE("sel_num:%d", sel_num); */
2951         if (!sel_num) {
2952                 if (list_data->navi_it) {
2953                         Evas_Object  *toolbar = elm_object_item_part_content_get(list_data->navi_it, "toolbar");
2954                         elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_TRUE);
2955                 }
2956                 evas_object_hide(list_data->selInfoPop);
2957                 return;
2958         }
2959
2960         if (list_data->navi_it) {
2961                 Evas_Object  *toolbar = elm_object_item_part_content_get(list_data->navi_it, "toolbar");
2962                 elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE);
2963         }
2964 }
2965
2966 /**
2967 * Do process when clicking the check object in the done-list item
2968 */
2969 EXPORT_PUBLIC
2970 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
2971                                           void *event_info)
2972 {
2973         SETTING_TRACE_BEGIN;
2974         /* error check */
2975         retm_if(data == NULL, "Data parameter is NULL");
2976         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2977
2978         /* new status */
2979         list_item->chk_status = elm_check_state_get(obj);
2980
2981         Setting_Done_List_Data *list_data = list_item->userdata;
2982         __setting_done_list_item_sel(list_data);
2983 }
2984
2985 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
2986                                                   void *event_info)
2987 {
2988         /* error check */
2989         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2990         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2991         elm_genlist_item_selected_set(item, 0);
2992         Setting_GenGroupItem_Data *list_item =
2993             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2994         setting_retm_if(NULL == list_item, "list_item is NULL");
2995
2996         /* new status */
2997         setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
2998
2999         /* other process.. */
3000         Setting_Done_List_Data *list_data = list_item->userdata;
3001         __setting_done_list_item_sel(list_data);
3002 }
3003
3004 static void __setting_select_all_done(void *data)
3005 {
3006         SETTING_TRACE_BEGIN;
3007         retm_if(data == NULL, "data == NULL");
3008         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
3009
3010         int sel_num = 0;
3011         int idx = 0;
3012
3013         if (list_data->select_all_checked) {
3014                 /* set all other checks state to be 1 */
3015                 SETTING_TRACE_DEBUG("Select All checked");
3016                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
3017                         list_data->chk_items[idx].data_GenItem->chk_status = 1;
3018                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
3019                         elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
3020                 }
3021                 sel_num = list_data->cur_item_num;
3022         } else {
3023                 SETTING_TRACE_DEBUG("Select All unchecked");
3024                 /* set all other checks state to be 0 */
3025                 for (idx = 0; idx < list_data->cur_item_num; idx++) {
3026                         list_data->chk_items[idx].data_GenItem->chk_status = 0;
3027                         elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
3028                         elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
3029                 }
3030                 sel_num = 0;
3031         }
3032
3033         /*  text set and timeout set */
3034         if (sel_num > 0) {
3035                 char text[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0, };
3036                 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, _("IDS_ST_HEADER_PD_SELECTED"), sel_num);
3037                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", text);
3038         } else {
3039                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", _(list_data->navi_title));
3040         }
3041         /* SETTING_TRACE("sel_num:%d", sel_num); */
3042         if (!sel_num) {
3043                 if (list_data->navi_it) {
3044                         Evas_Object *toolbar = elm_object_item_part_content_get(list_data->navi_it, "toolbar");
3045                         elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_TRUE);
3046                 }
3047
3048                 evas_object_hide(list_data->selInfoPop);
3049                 return;
3050         }
3051
3052         if (list_data->navi_it) {
3053                 Evas_Object *toolbar = elm_object_item_part_content_get(list_data->navi_it, "toolbar");
3054                 elm_object_item_disabled_set(elm_toolbar_last_item_get(toolbar), EINA_FALSE);
3055         }
3056 }
3057
3058 static void __setting_select_all_layout_mouse_up_cb(void *data, Evas_Object *obj, void *event_info)
3059 {
3060         SETTING_TRACE_BEGIN;
3061         retm_if(data == NULL, "data == NULL");
3062         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
3063
3064         list_data->select_all_checked = !list_data->select_all_checked;
3065         /*elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked); */
3066
3067         __setting_select_all_done(list_data);
3068 }
3069
3070 /*static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
3071 {
3072         SETTING_TRACE_BEGIN;
3073         retm_if(data == NULL, "data == NULL");
3074         Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
3075         list_data->select_all_checkbox = obj;
3076         list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
3077         elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
3078         __setting_select_all_done(data);
3079 }*/
3080 static void setting_callback_select_all_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
3081 {
3082         SETTING_TRACE_BEGIN;
3083         retm_if(data == NULL, "data is NULL");
3084
3085         Evas_Object *select_button_ic = (Evas_Object *)data;
3086         elm_image_file_set(select_button_ic, SETTING_ICON_PATH_CFG"select_all.png", NULL);
3087 }
3088 static void setting_callback_select_all_button_unpressed_cb(void *data, Evas_Object *obj, void *event_info)
3089 {
3090         SETTING_TRACE_BEGIN;
3091         retm_if(data == NULL, "data is NULL");
3092
3093         Evas_Object *select_button_ic = (Evas_Object *)data;
3094         elm_image_file_set(select_button_ic, SETTING_ICON_PATH_CFG"select_all.png", NULL);
3095 }
3096 /**
3097 * The API to create done-list.
3098 *
3099 * @param[in] list_data
3100 * @return a done-list
3101 */
3102 EXPORT_PUBLIC
3103 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data, const char *title)
3104 {
3105         SETTING_TRACE_BEGIN;
3106         retvm_if(list_data == NULL, NULL, "list_data == NULL");
3107         setting_create_Gendial_itc("1line", &(list_data->itc_1text_1icon));
3108         if (title) {
3109                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", _(title));
3110         } else {
3111                 title = elm_object_item_part_text_get(list_data->navi_it, "elm.text.title");
3112         }
3113
3114         memset((char *)(list_data->navi_title), 0, sizeof(list_data->navi_title));
3115         safeCopyStr((char *)(list_data->navi_title), title, sizeof(list_data->navi_title));
3116         SETTING_TRACE("list_data->navi_title:%s", list_data->navi_title);
3117
3118         Evas_Object *allbtn = elm_button_add(list_data->win_main);
3119         elm_object_style_set(allbtn, "naviframe/title_icon");
3120
3121         Evas_Object *icon = elm_icon_add(allbtn);
3122         elm_image_file_set(icon, SETTING_ICON_PATH_CFG"select_all.png", NULL);
3123
3124         elm_object_content_set(allbtn, icon);
3125         elm_object_focus_allow_set(allbtn, EINA_FALSE);
3126         evas_object_propagate_events_set(allbtn, EINA_FALSE);
3127         evas_object_smart_callback_add(allbtn, "clicked", __setting_select_all_layout_mouse_up_cb, list_data);
3128         evas_object_smart_callback_add(allbtn, "pressed", setting_callback_select_all_button_pressed_cb, icon);
3129         evas_object_smart_callback_add(allbtn, "unpressed", setting_callback_select_all_button_unpressed_cb, icon);
3130
3131         evas_object_show(allbtn);
3132         elm_object_item_part_content_set(list_data->navi_it, "title_right_btn", allbtn);
3133
3134         Evas_Object *scroller = elm_genlist_add(list_data->win_main);
3135         retvm_if(scroller == NULL, NULL, "scroller == NULL");
3136         //elm_genlist_realization_mode_set(scroller, EINA_TRUE);
3137         elm_genlist_clear(scroller);    /* first to clear list */
3138         evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL);
3139
3140
3141         int index = 0;
3142         for (; index < list_data->cur_item_num; index++) {
3143                 list_data->chk_items[index].data_GenItem =
3144                     setting_create_Gendial_field_def(scroller,
3145                                                      &(list_data->itc_1text_1icon),
3146                                                      setting_done_list_Gendial_mouse_up_cb,
3147                                                      list_data,
3148                                                      SWALLOW_Type_1CHECK, NULL,
3149                                                      NULL, 0,
3150                                                      list_data->chk_items
3151                                                      [index].item_name, NULL,
3152                                                      setting_done_list_Gendial_chk_btn_cb);
3153                 if (list_data->chk_items[index].data_GenItem) {
3154                         list_data->chk_items[index].data_GenItem->userdata = list_data;
3155                 } else {
3156                         SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
3157                 }
3158
3159         }
3160
3161         return scroller;
3162 }
3163
3164 /**
3165 * The API to create done-list-with-image
3166 *
3167 * @param[in] list_data
3168 * @return a done-list-with-image
3169 */
3170 EXPORT_PUBLIC
3171 Evas_Object *setting_create_done_list_with_image(Setting_Done_List_Data *list_data, const char *title)
3172 {
3173         SETTING_TRACE_BEGIN;
3174         retvm_if(list_data == NULL, NULL, "list_data == NULL");
3175         setting_create_Gendial_itc("1text.2icon.4", &(list_data->itc_1text_2icon));
3176         if (title) {
3177                 elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", title);
3178         }
3179         /*elm_object_item_part_text_set(list_data->navi_it, "elm.text.title", _(KeyStr_Select_Item)); */
3180         memset((char *)(list_data->navi_title), 0, sizeof(list_data->navi_title));
3181         safeCopyStr((char *)(list_data->navi_title), elm_object_item_part_text_get(list_data->navi_it, "elm.text.title"), sizeof(list_data->navi_title));
3182         SETTING_TRACE("list_data->navi_title:%s", list_data->navi_title);
3183
3184         Evas_Object *allbtn = elm_button_add(list_data->win_main);
3185         elm_object_style_set(allbtn, "naviframe/title_icon");
3186         Evas_Object *icon = elm_icon_add(allbtn);
3187         elm_image_file_set(icon, SETTING_ICON_PATH_CFG"select_all.png", NULL);
3188
3189         /*evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1 , 1); */
3190         /*elm_image_resizable_set(icon, EINA_TRUE, EINA_TRUE); */
3191         elm_object_content_set(allbtn, icon);
3192         elm_object_focus_allow_set(allbtn, EINA_FALSE);
3193         evas_object_propagate_events_set(allbtn, EINA_FALSE);
3194         evas_object_smart_callback_add(allbtn, "clicked", __setting_select_all_layout_mouse_up_cb, list_data);
3195         evas_object_smart_callback_add(allbtn, "pressed", setting_callback_select_all_button_pressed_cb, icon);
3196         evas_object_smart_callback_add(allbtn, "unpressed", setting_callback_select_all_button_unpressed_cb, icon);
3197
3198         evas_object_show(allbtn);
3199         elm_object_item_part_content_set(list_data->navi_it, "title_right_btn", allbtn);
3200
3201         Evas_Object *scroller = elm_genlist_add(list_data->win_main);
3202         retvm_if(scroller == NULL, NULL, "scroller == NULL");
3203         //elm_genlist_realization_mode_set(scroller, EINA_TRUE);
3204         elm_genlist_clear(scroller);    /* first to clear list */
3205         evas_object_smart_callback_add(scroller, "realized", __gl_realized_cb, NULL);
3206
3207         int index = 0;
3208         for (; index < list_data->cur_item_num; index++) {
3209                 list_data->chk_items[index].data_GenItem =
3210                     setting_create_Gendial_field_def(scroller,
3211                                                      &(list_data->itc_1text_2icon),
3212                                                      setting_done_list_Gendial_mouse_up_cb,
3213                                                      list_data,
3214                                                      SWALLOW_Type_1CHECK, NULL,
3215                                                      list_data->allow_items[index].thumb_path, 0,
3216                                                      list_data->chk_items
3217                                                      [index].item_name, NULL,
3218                                                      setting_done_list_Gendial_chk_btn_cb);
3219                 if (list_data->chk_items[index].data_GenItem) {
3220                         list_data->chk_items[index].data_GenItem->userdata = list_data;
3221                 } else {
3222                         SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
3223                 }
3224         }
3225
3226         return scroller;
3227 }
3228
3229 /**
3230 * To disable a specialized genlist item
3231 *
3232 * @param[in] item
3233 */
3234 EXPORT_PUBLIC
3235 void setting_disable_genlist_item(Elm_Object_Item *item)
3236 {
3237         if (item) {
3238                 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
3239                 /*elm_genlist_item_update(item); */
3240         }
3241 }
3242
3243 /**
3244 * To enable a specialized genlist item
3245 *
3246 * @param[in] item
3247 */
3248 EXPORT_PUBLIC
3249 void setting_enable_genlist_item(Elm_Object_Item *item)
3250 {
3251         if (item) {
3252                 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */
3253                 /*elm_genlist_item_update(item); */
3254         }
3255 }
3256
3257 EXPORT_PUBLIC
3258 void setting_genlist_item_disabled_set(Setting_GenGroupItem_Data *item_data, int disable)
3259 {
3260         if (item_data && item_data->item) {
3261                 elm_object_item_disabled_set(item_data->item, disable); /* make it be dim displayed */
3262         }
3263 }
3264 EXPORT_PUBLIC void setting_genlist_unregister_tts_access_highlight(Evas_Object *obj, const char *itc)
3265 {
3266         setting_retm_if(!obj, "obj is NULL");
3267         if (!itc || (itc && 0 != safeStrCmp(itc, "dialogue/1text.2icon.divider")
3268                      && 0 != safeStrCmp(itc, "dialogue/1text.1icon.divider")
3269                      && 0 != safeStrCmp(itc, "dialogue/setting.1text.2icon.4.divider.tb")
3270                      && 0 != safeStrCmp(itc, "dialogue/setting.1text.2icon.divider")
3271                      && 0 != safeStrCmp(itc, "dialogue/newset.1text.2icon.divider")))   {
3272
3273                 /*SETTING_TRACE("check/radio highlight is unregistered"); */
3274                 elm_access_object_unregister(obj);
3275         }
3276 }
3277
3278
3279 EXPORT_PUBLIC
3280 void __add_gl_tts_feature(Elm_Object_Item *item)
3281 {
3282         /*SETTING_TRACE_BEGIN; */
3283         ret_if(!item);
3284         const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(item);
3285         ret_if(!itc);
3286         /*SETTING_TRACE("itc->item_style:%s", itc->item_style); */
3287         if (0 == safeStrCmp(itc->item_style, "dialogue/separator")) {
3288                 elm_object_item_access_unregister(item);
3289                 return;
3290         }
3291
3292         /*all items which may have text to read */
3293         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item);
3294         ret_if(!list_item);
3295         if (isSpaceStr(list_item->keyStr)) {
3296                 elm_object_item_access_unregister(item);
3297                 return;
3298         }
3299
3300         if (!safeStrCmp(itc->item_style, "1icon/with_no_line")
3301             && list_item->swallow_type == SWALLOW_Type_1BUTTON) {
3302                 elm_object_item_access_unregister(item);
3303                 return;
3304         }
3305
3306         char lable[MAX_SPECIALIZITION_LEN] = {0,};
3307         char state[MAX_SPECIALIZITION_LEN] = {0,};
3308         char guide[MAX_SPECIALIZITION_LEN] = {0,};
3309
3310
3311
3312         if (list_item) {
3313                 /*SETTING_TRACE("list_item->keyStr:%s", _(list_item->keyStr)); */
3314                 if (list_item->swallow_type == SWALLOW_Type_1TOGGLE
3315                     || list_item->swallow_type == SWALLOW_Type_1ICON_1RADIO
3316                     || list_item->swallow_type == SWALLOW_Type_1RADIO
3317                     || list_item->swallow_type == SWALLOW_Type_1CHECK
3318                     || list_item->swallow_type == SWALLOW_Type_1RADIO_1LABLE
3319                     || list_item->swallow_type == SWALLOW_Type_1ICON_1DOTTOOGLE) {
3320                         /*unregister_access_highlight(list_item); */
3321
3322                 }
3323                 switch (list_item->swallow_type) {
3324                         case SWALLOW_Type_1TOGGLE:
3325                         case SWALLOW_Type_1ICON_1RADIO: {
3326                                         /*SETTING_TRACE("case SWALLOW_Type_1TOGGLE or SWALLOW_Type_1ICON_1RADIO"); */
3327                                         /*"dialogue/1text.2icon.divider".keystr current is on/off,switch the switcher to chaneg it,click the item for detail settings" */
3328                                         /*not:keystr current is on/off,switch the switcher or click the item to chaneg it. */
3329                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3330                                         snprintf(state, sizeof(state),
3331                                                  _("IDS_ST_BODY_P1SS_IS_CURRENTLY_P2SS_T_TTS"),
3332                                                  _(list_item->keyStr), list_item->chk_status ? _("IDS_ST_BODY_ON_M_STATUS") : _("IDS_ST_BODY_ALERTTYPE_OFF"));
3333
3334                                         if (0 == safeStrCmp(itc->item_style, "dialogue/1text.2icon.divider")
3335                                             || 0 == safeStrCmp(itc->item_style, "dialogue/1text.1icon.divider")) {
3336                                                 /*g_strlcat(guide, _("Tap switcher to change it, or double tap the item for detail settings"), MAX_SPECIALIZITION_LEN); */
3337                                                 g_strlcat(guide, _("IDS_ST_BODY_TOGGLE_THE_BUTTON_TO_ENABLE_OR_DISABLE_SCREEN_READER_OR_DOUBLE_TAP_TO_OPEN_THE_MENU_T_TTS"), MAX_SPECIALIZITION_LEN);
3338                                         } else {
3339                                                 /*g_strlcat(guide, _("Tap item or switcher to chaneg it."), MAX_SPECIALIZITION_LEN); */
3340                                                 g_strlcat(guide, _("IDS_ST_BODY_DOUBLE_TAP_TO_EDIT_THIS_FIELD_T_TTS"), MAX_SPECIALIZITION_LEN);
3341                                         }
3342                                         break;
3343                                 }
3344                         case SWALLOW_Type_1CHECK:
3345                         case SWALLOW_Type_1RADIO:
3346                         case SWALLOW_Type_1RADIO_1LABLE: {
3347                                         /*SETTING_TRACE("case SWALLOW_Type_1CHECK or SWALLOW_Type_1RADIO or SWALLOW_Type_1RADIO_1LABLE"); */
3348                                         /*keystr, click to select it */
3349                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3350                                         /*g_strlcat(guide, _("Double tap it to select"), MAX_SPECIALIZITION_LEN); */
3351                                         g_strlcat(guide, _("IDS_ST_BODY_DOUBLE_TAP_TO_EDIT_THIS_FIELD_T_TTS"), MAX_SPECIALIZITION_LEN);
3352                                         break;
3353                                 }
3354                         case SWALLOW_Type_1ICON_1PROCESS: {
3355                                         /*SETTING_TRACE("case SWALLOW_Type_1ICON_1PROCESS"); */
3356                                         /*keystr,its setting is in processing */
3357                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3358                                         g_strlcat(guide, _("IDS_ST_BODY_YOUR_CHANGES_ARE_BEING_MADE_T_TTS"), MAX_SPECIALIZITION_LEN);
3359                                         break;
3360                                 }
3361                         case SWALLOW_Type_LAYOUT_ENTRY:
3362                         case SWALLOW_Type_LAYOUT_EDITFIELD: {
3363                                         /*SETTING_TRACE("case SWALLOW_Type_LAYOUT_ENTRY"); */
3364                                         /*keystr is substr,to tap and modify it if you want */
3365                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3366                                         snprintf(state, sizeof(state), _("IDS_ST_BODY_P1SS_IS_CURRENTLY_P2SS_T_TTS"), _(list_item->keyStr), list_item->sub_desc);
3367                                         g_strlcat(guide, _("IDS_ST_BODY_DOUBLE_TAP_TO_EDIT_THIS_FIELD_T_TTS"), MAX_SPECIALIZITION_LEN);
3368                                         break;
3369                                 }
3370                         case SWALLOW_Type_LAYOUT_DATEFIELD: {
3371                                         /*year month ... */
3372                                         /*to do.. */
3373                                         /*SETTING_TRACE("case SWALLOW_Type_LAYOUT_DATEFIELD"); */
3374                                         break;
3375                                 }
3376                         case SWALLOW_Type_INVALID:
3377                         case SWALLOW_Type_1ICON_1DOTTOOGLE: {
3378                                         /*SETTING_TRACE("case SWALLOW_Type_INVALID"); */
3379                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3380                                         /*SETTING_TRACE("list_item->sub_desc:%s", list_item->sub_desc); */
3381                                         if (list_item->sub_desc) {
3382                                                 snprintf(state, sizeof(state), _("IDS_ST_BODY_P1SS_IS_CURRENTLY_P2SS_T_TTS"), _(list_item->keyStr), _(list_item->sub_desc));
3383                                         }
3384                                         /*SETTING_TRACE("state:%s", state); */
3385
3386                                         if (0 != safeStrCmp(itc->item_style, "dialogue/multiline/2text")
3387                                             && 0 != safeStrCmp(itc->item_style, "dialogue/2text.1icon.3")) {
3388                                                 if (0 == safeStrCmp(itc->item_style, "dialogue/2text.3/expandable")) {
3389                                                         g_strlcat(guide, _("IDS_ST_BODY_DOUBLE_TAP_TO_OPEN_THE_MENU_T_TTS"), MAX_SPECIALIZITION_LEN);
3390                                                 } else
3391                                                         g_strlcat(guide, _(TTS_CONTENT_MENU_CLICK_INFO), MAX_SPECIALIZITION_LEN);
3392                                         }
3393                                         /*SETTING_TRACE("guild:%s", guide); */
3394                                         break;
3395                                 }
3396                                 /*read the KEYSTR directly */
3397                         case SWALLOW_Type_1TEXT_1IMAGE: {
3398                                         g_strlcat(lable, _(list_item->keyStr), MAX_SPECIALIZITION_LEN);
3399                                         break;
3400                                 }
3401                         case SWALLOW_Type_LAYOUT_SPECIALIZTION:
3402                         default: { /*skip them */
3403                                         return;
3404                                 }
3405                 }
3406
3407                 /*SETTING_TRACE("speciliztion:%s", speciliztion); */
3408                 Evas_Object *eo = elm_object_item_access_object_get(item);
3409                 /*setting_set_tts_info(eo, speciliztion, " ", NULL, TTS_CONTENT_MENU_CLICK_INFO); */
3410                 setting_set_tts_info(eo, lable, " ", isEmptyStr(state) ? NULL : state, isEmptyStr(guide) ? NULL : guide);
3411         }
3412 }
3413
3414 EXPORT_PUBLIC
3415 void setting_check_genlist_item_bottom_line(Elm_Object_Item *item)
3416 {
3417         /*SETTING_TRACE_BEGIN; */
3418         ret_if(!item);
3419         const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(item);
3420         if (itc && itc->item_style) {
3421                 /*SETTING_TRACE("itc->item_style:%s", itc->item_style); */
3422                 if (0 == safeStrCmp(itc->item_style, "groupindex")
3423                     || 0 == safeStrNCmp(itc->item_style, "dialogue/separator", safeStrLen("dialogue/separator"))
3424                     || 0 == safeStrNCmp(itc->item_style, "bottom_line", safeStrLen("bottom_line"))
3425                     || 0 == safeStrNCmp(itc->item_style, "multiline_sub", safeStrLen("multiline_sub"))
3426                     || 0 == safeStrNCmp(itc->item_style, "1icon", safeStrLen("1icon"))
3427                    ) {
3428                         if (0 == safeStrCmp(itc->item_style, "groupindex")) {
3429                                 Elm_Object_Item *prev_item = elm_genlist_item_prev_get(item);
3430                                 if (prev_item) {
3431                                         const Elm_Genlist_Item_Class *itc2 = elm_genlist_item_item_class_get(prev_item);
3432                                         if (itc2 && !safeStrCmp(itc2->item_style, "bottom_line")) {
3433                                                 elm_object_item_del(prev_item);
3434                                         }
3435                                 }
3436                         }
3437                         return;
3438                 } else {
3439
3440                         /*SETTING_TRACE("Adding[prev_item:%p, next_item:%p].....", prev_item, next_item); */
3441                         Evas_Object *scroller = elm_object_item_widget_get(item);
3442                         Elm_Object_Item *parent = elm_genlist_item_parent_get(item);
3443                         /*SETTING_TRACE("parent:%p", parent); */
3444                         if (parent) { /*expandable */
3445                                 Elm_Object_Item *it = elm_genlist_item_insert_before(scroller, &(itc_bottom_line), NULL, parent,
3446                                                                                      item, ELM_GENLIST_ITEM_NONE, NULL, NULL);
3447                                 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
3448                                 //Evas_Object *real_obj = elm_object_item_edje_get(item);
3449                                 //setting_decorate_image_RGBA(real_obj, 0, 0, 85, 255);
3450                         }
3451
3452                 }
3453         }
3454 }
3455
3456 EXPORT_PUBLIC
3457 void __gl_realized_cb(void *data, Evas_Object *obj, void *event_info)
3458 {
3459         /*SETTING_TRACE_BEGIN; */
3460         setting_retm_if(event_info == NULL, "invalid parameter: event_info is NULL");
3461         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
3462         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item);
3463 #if SUPPORT_TTS
3464         __add_gl_tts_feature(item);
3465 #endif
3466         setting_check_genlist_item_bottom_line(item);
3467
3468         if (list_item) {
3469                 /*SETTING_TRACE("%s:%d", _(list_item->keyStr), list_item->group_style); */
3470                 if (list_item->group_style == SETTING_GROUP_STYLE_TOP) {
3471                         elm_object_item_signal_emit(item, "elm,state,top", "");
3472                 } else if (list_item->group_style == SETTING_GROUP_STYLE_BOTTOM) {
3473                         elm_object_item_signal_emit(item, "elm,state,bottom", "");
3474                 } else if (list_item->group_style == SETTING_GROUP_STYLE_CENTER) {
3475                         elm_object_item_signal_emit(item, "elm,state,center", "");
3476                 } else {
3477                         elm_object_item_signal_emit(item, "elm,state,normal", "");
3478                 }
3479         } else {
3480                 /* item is used for description */
3481                 elm_object_item_signal_emit(item, "elm,state,center", "");
3482         }
3483 }
3484
3485 EXPORT_PUBLIC void setting_genlist_item_groupstyle_set(Setting_GenGroupItem_Data *list_item, setting_group_style group_style)
3486 {
3487         if (list_item) {
3488                 list_item->group_style = group_style;
3489                 /*SETTING_TRACE("list_item->group_style:%d", list_item->group_style); */
3490                 if (list_item->item) {
3491                         /*SETTING_TRACE("%s:%d", _(list_item->keyStr), list_item->group_style); */
3492                         if (list_item->group_style == SETTING_GROUP_STYLE_TOP) {
3493                                 elm_object_item_signal_emit(list_item->item, "elm,state,top", "");
3494                         } else if (list_item->group_style == SETTING_GROUP_STYLE_BOTTOM) {
3495                                 elm_object_item_signal_emit(list_item->item, "elm,state,bottom", "");
3496                         } else if (list_item->group_style == SETTING_GROUP_STYLE_CENTER) {
3497                                 elm_object_item_signal_emit(list_item->item, "elm,state,center", "");
3498                         } else {
3499                                 elm_object_item_signal_emit(list_item->item, "elm,state,normal", "");
3500                         }
3501                 }
3502         }
3503 }
3504
3505 /*for check,radio,slider etc.. */
3506 EXPORT_PUBLIC void setting_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status)
3507 {
3508         if (item_data && item_data->chk_status != status) {
3509                 item_data->chk_status = status;
3510                 if (item_data->item) {
3511                         /*SETTING_TRACE_DEBUG("update item %d", item_data->chk_status); */
3512                         elm_genlist_item_fields_update(item_data->item, "*", ELM_GENLIST_ITEM_FIELD_CONTENT);
3513                 }
3514         }
3515 }
3516
3517 /*do not check current status, only update the icon.2 of item which has 2 icons. */
3518 EXPORT_PUBLIC void setting_force_update_gl_item_chk_status(Setting_GenGroupItem_Data *item_data, int status)
3519 {
3520         if (item_data) {
3521                 item_data->chk_status = status;
3522                 if (item_data->item) {
3523                         /*SETTING_TRACE_DEBUG("update item %s : %d", item_data->keyStr, item_data->chk_status); */
3524                         elm_genlist_item_fields_update(item_data->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
3525                 }
3526         }
3527 }
3528