3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Flora License, Version 1.1 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an AS IS BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 #include <setting-common-draw-widget.h>
21 #include <system_settings.h>
23 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
24 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
25 static void _gl_Gendial_del(void *data, Evas_Object *obj);
26 const Elm_Genlist_Item_Class itc_seperator = {
27 .item_style = "dialogue/separator",
28 .func.text_get = NULL,
29 .func.content_get = NULL,
30 .func.state_get = NULL,
34 const Elm_Genlist_Item_Class itc_bottom_seperator = {
35 .item_style = "dialogue/separator",
36 .func.text_get = NULL,
37 .func.content_get = NULL,
38 .func.state_get = NULL,
42 const Elm_Genlist_Item_Class itc_sep_line = {
43 .item_style = "dialogue/separator",
44 .func.text_get = _gl_Gendial_text_get,
45 .func.content_get = NULL,
46 .func.state_get = NULL,
50 #define DEFINE_ITC1(style, name) \
51 const Elm_Genlist_Item_Class name = {\
53 .func.text_get = _gl_Gendial_text_get,\
54 .func.content_get = _gl_Gendial_content_get,\
55 .func.state_get = NULL,\
56 .func.del = _gl_Gendial_del,\
59 DEFINE_ITC1("dialogue/1text", itc_1text);
60 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
62 DEFINE_ITC1("dialogue/1icon", itc_1icon);
63 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
64 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
65 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
66 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
68 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
69 DEFINE_ITC1("dialogue/2text", itc_2text);
70 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
71 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
72 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
73 DEFINE_ITC1("dialogue/2text.1icon.10.tb", itc_2text_1icon_7);
75 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
76 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
77 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
79 DEFINE_ITC1("multiline/1text", itc_multiline_text);
80 DEFINE_ITC1("1text.1icon.3", itc_1text_1icon_3_tb);
81 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
82 DEFINE_ITC1("select_all", itc_sel_all);
83 //DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
84 DEFINE_ITC1("1icon", itc_bg_1icon);
85 DEFINE_ITC1("dialogue/title", itc_group_item);
88 * Do process when clicking on a common genlist item
90 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
94 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
95 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
96 elm_genlist_item_selected_set(item, 0);
97 Setting_GenGroupItem_Data *list_item =
98 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
100 setting_retm_if(data == NULL, "Data parameter is NULL");
101 Evas_Object *radio = data;
102 elm_radio_value_set(radio, list_item->chk_status);
105 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
107 retm_if(data == NULL, "Data parameter is NULL");
108 Setting_GenGroupItem_Data *list_item =
109 (Setting_GenGroupItem_Data *) data;
110 list_item->chk_status = elm_radio_value_get(obj); /* for update */
113 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
115 retm_if(data == NULL, "Data parameter is NULL");
117 Setting_GenGroupItem_Data *list_item =
118 (Setting_GenGroupItem_Data *) data;
119 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
120 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
123 if (elm_entry_is_empty(obj))
125 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
126 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
130 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
131 if (elm_object_focus_get(obj)) //only do when entry is focused
133 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
139 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
143 Evas_Object *entry_container = data;
144 //whe entry unfocused, its guidetext will becomes "Input here"
145 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
146 if (elm_entry_is_empty(obj))
147 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
148 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
150 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
154 Evas_Object *entry_container = data;
155 //whe entry focused, its guidetext will becomes "Input here"
156 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
157 if (!elm_entry_is_empty(obj))
158 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
159 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
161 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
162 if (imf_context) ecore_imf_context_input_panel_show(imf_context);
164 static void __eraser_clicked(void *data, Evas_Object *obj, const char *emission, const char *source) // When X marked button is clicked, empty entry's contents.
168 Evas_Object *entry = data;
169 elm_entry_entry_set(entry, "");
170 elm_object_focus_set(entry, EINA_TRUE);
173 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
175 retm_if(data == NULL, "Data parameter is NULL");
177 Setting_GenGroupItem_Data *list_item =
178 (Setting_GenGroupItem_Data *) data;
179 list_item->chk_status = elm_check_state_get(obj); /* for update */
182 static void __error_popup_response_cb(void *data, Evas_Object *obj,
186 retm_if(data == NULL, "Data parameter is NULL");
187 Setting_GenGroupItem_Data *list_item = data;
188 if (list_item->notify) {
189 evas_object_del(list_item->notify);
190 list_item->notify = NULL;
194 static void __max_len_reached(void *data, Evas_Object *obj, void *event_info)
197 retm_if(data == NULL, "Data parameter is NULL");
198 retm_if(!elm_object_focus_get(obj), "Entry is not focused");//notify only when entry is being focused on.
200 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
201 if (!list_item->notify)
203 list_item->notify = setting_create_popup_without_btn(list_item, list_item->win_main,
204 NULL, _(EXCEED_LIMITATION_STR),
205 __error_popup_response_cb,
206 POPUP_INTERVAL, FALSE, FALSE);
207 elm_object_focus_set(list_item->eo_check, EINA_FALSE);
209 //postpone 2 seconds again
210 elm_popup_timeout_set(list_item->notify, POPUP_INTERVAL);
215 static void __entry_keydown(void *data, Evas *e, Evas_Object *obj, void *event_info)
217 retm_if(data == NULL, "Data parameter is NULL");
218 retm_if(event_info == NULL, "event_info is NULL");
219 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
220 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
222 if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
223 || safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
225 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
226 list_item->enterKeyPressFlag = true;
227 //hide the eraser button
228 //format like:xx<br/>
229 if (list_item->isSinglelineFlag == FALSE) {
230 const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
231 elm_entry_entry_set(obj, entry_str);
233 elm_entry_cursor_end_set(obj);
235 setting_hide_input_pannel_cb(obj);
237 list_item->enterKeyPressFlag = false;
238 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
239 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
240 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
242 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
249 * Do process when clicking radio in subitem of expandable item
251 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
254 retm_if(data == NULL, "Data parameter is NULL");
255 Setting_GenGroupItem_Data *list_item =
256 (Setting_GenGroupItem_Data *) data;
257 list_item->chk_status = elm_radio_value_get(obj); /* for update */
259 Elm_Object_Item *subItem = list_item->item;
260 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
262 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
263 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
265 ret_if(NULL == data_subItem || NULL == data_parentItem);
267 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
268 list_item->chk_status, &err);
270 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
271 elm_object_item_data_set(data_parentItem->item, data_parentItem);
272 elm_genlist_item_update(data_parentItem->item);
276 * Do process when clicking on subitem of expandable item
278 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
282 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
283 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
284 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
285 elm_genlist_item_selected_set(subitem, 0);
286 Setting_GenGroupItem_Data *data_subItem =
287 elm_object_item_data_get(subitem);
288 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
289 ret_if(NULL == data_subItem || NULL == data_parentItem);
291 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
293 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
294 data_subItem->chk_status, &err);
295 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
297 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
298 elm_object_item_data_set(data_parentItem->item, data_parentItem);
299 elm_genlist_item_update(data_parentItem->item);
302 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
304 ret_if(data == NULL || event_info == NULL);
305 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
306 char *cb_type = data;
308 if (0 == safeStrCmp(cb_type, "drag")
309 || 0 == safeStrCmp(cb_type, "longpressed")) {
310 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
311 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
312 } else if (0 == safeStrCmp(cb_type, "contracted")) {
313 elm_genlist_item_subitems_clear(item);
317 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
319 /* SETTING_TRACE_BEGIN; */
320 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
321 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
322 elm_genlist_item_selected_set(item, 0);
325 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
328 /* SETTING_TRACE_BEGIN; */
329 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
330 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
331 elm_genlist_item_selected_set(item, 0);
332 bool status = !elm_genlist_item_expanded_get(item);
333 elm_genlist_item_expanded_set(item, status);
336 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
339 /* SETTING_TRACE_BEGIN; */
340 Setting_GenGroupItem_Data *item_data =
341 (Setting_GenGroupItem_Data *) data;
342 /* SETTING_TRACE("part:%s", part); */
343 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
347 /* for font size view */
348 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
349 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
351 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
352 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
353 font_size = LABEL_FONT_SIZE_SMALL;
354 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
355 font_size = LABEL_FONT_SIZE_LARGE;
356 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
357 font_size = LABEL_FONT_SIZE_HUGE;
358 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
359 font_size = LABEL_FONT_SIZE_GIANT;
361 font_size = LABEL_FONT_SIZE_NORMAL;
363 SETTING_TRACE("font_size:%d", font_size);
364 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
365 font_size, _(item_data->keyStr));
366 return (char *)g_strdup(speciliztion);
369 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
370 if (item_data->keyStr) {
371 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
374 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
375 if (item_data->sub_desc) {
376 return (char *)g_strdup(item_data->sub_desc);
383 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
385 retv_if(!item_data || !parent, NULL);
386 Evas_Object *check = elm_check_add(parent);
387 elm_check_state_set(check, item_data->chk_status);
388 evas_object_show(check);
389 evas_object_pass_events_set(check, 1);
390 evas_object_propagate_events_set(check, 0);
392 item_data->eo_check = check;
394 if (item_data->chk_change_cb) {
395 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
397 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
401 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
403 retv_if(!item_data || !parent, NULL);
404 Evas_Object *check = __add_check(item_data, parent);
406 Evas_Object *thumb = NULL;
407 if (item_data->r_swallow_path) {
408 thumb = elm_icon_add(parent);
409 elm_icon_file_set(thumb,
410 item_data->r_swallow_path,
412 evas_object_size_hint_aspect_set(thumb,
413 EVAS_ASPECT_CONTROL_VERTICAL,
417 Evas_Object *layout = elm_layout_add(parent);
418 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
420 evas_object_size_hint_weight_set(layout,
423 elm_object_part_content_set(layout, "checkbox", check);
424 elm_object_part_content_set(layout, "thumbnail", thumb);
425 evas_object_show(layout);
428 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
430 retv_if(!item_data || !parent, NULL);
431 Evas_Object *check = __add_check(item_data, parent);
432 elm_object_style_set(check, "on&off");
435 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
437 retv_if(!item_data || !parent, NULL);
438 Evas_Object *chk = __add_toggle(item_data, parent);
439 elm_object_style_set(chk, "on&off");
443 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
445 retv_if(!item_data || !parent, NULL);
446 if (!item_data->rgd) { /* exceptional handling */
447 item_data->rgd = elm_radio_add(parent);
448 elm_radio_state_value_set(item_data->rgd, -1);
450 Evas_Object *radio = elm_radio_add(parent);
451 elm_radio_state_value_set(radio,
452 item_data->chk_status);
453 elm_radio_group_add(radio, item_data->rgd);
454 evas_object_show(radio);
455 item_data->eo_check = radio;
456 if (item_data->chk_change_cb) {
457 evas_object_smart_callback_add(radio,
459 item_data->chk_change_cb,
462 evas_object_smart_callback_add(radio,
469 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
471 retv_if(!item_data || !parent, NULL);
472 Evas_Object *btn = elm_button_add(parent);
473 evas_object_show(btn);
474 if (item_data->r_swallow_path)
476 elm_object_style_set(btn, item_data->r_swallow_path);
478 if (item_data->keyStr)
480 elm_object_text_set(btn, _(item_data->keyStr));
482 evas_object_propagate_events_set(btn, EINA_FALSE);
483 if (item_data->chk_change_cb)
484 evas_object_smart_callback_add(btn,
486 item_data->chk_change_cb,
491 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
493 retv_if(!item_data || !parent, NULL);
494 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
495 Evas_Object *ed_name =
496 setting_create_editfiled(parent, _(item_data->keyStr), item_data->sub_desc);
497 evas_object_pass_events_set(ed_name, 1);
498 evas_object_propagate_events_set(ed_name, 0);
499 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
500 item_data->eo_check = entry;
501 elm_entry_input_panel_layout_set(entry, item_data->input_type);
503 if (item_data->isSinglelineFlag) {
504 elm_entry_scrollable_set(entry, EINA_TRUE);
505 elm_entry_single_line_set(entry, EINA_TRUE);
508 if (item_data->isPasswordFlag) {
509 elm_entry_single_line_set(entry, EINA_TRUE);
510 elm_entry_password_set(entry, EINA_TRUE);
513 if (item_data->limit_filter_data) {
514 elm_entry_markup_filter_append
516 elm_entry_filter_limit_size,
517 item_data->limit_filter_data);
519 if (item_data->maxlength_reached_cb) {
520 evas_object_smart_callback_add(entry,
522 item_data->maxlength_reached_cb,
525 evas_object_smart_callback_add(entry,
531 if (item_data->stop_change_cb) {//invoked when stop focusing on
532 evas_object_smart_callback_add(entry,
534 item_data->stop_change_cb,
539 evas_object_smart_callback_add(entry,
544 if (item_data->digits_filter_data) {
545 elm_entry_markup_filter_append
547 elm_entry_filter_accept_set,
548 item_data->digits_filter_data);
551 /* for Setting App, All the entrys's context popup shouldn't be able */
552 /* to insert images, text is the only one can be inserted. */
553 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
555 if (item_data->chk_change_cb) {
556 evas_object_smart_callback_add
558 "changed", item_data->chk_change_cb,
562 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
563 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
564 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
566 if (item_data->start_change_cb) {
567 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
569 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
571 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(entry);
572 if (imf_context) ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, item_data->x_callback_cb, item_data->userdata);
574 if (item_data->input_panel_disable_flag) {
575 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
579 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
581 retv_if(!item_data || !parent, NULL);
582 Evas_Object *li_slider =
583 setting_create_slider(parent, item_data->evas,
584 item_data->l_swallow_path,
585 item_data->r_swallow_path,
586 item_data->chk_status,
587 item_data->isIndicatorVisible,
588 item_data->slider_min,
589 item_data->slider_max,
590 item_data->chk_change_cb,
591 item_data->start_change_cb,
592 item_data->stop_change_cb,
594 evas_object_pass_events_set(li_slider, 1);
595 evas_object_propagate_events_set(li_slider, 0);
596 item_data->eo_check = li_slider;
600 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
602 retv_if(!item_data || !parent, NULL);
603 /* **********create time/date field */
604 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
605 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
606 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
607 evas_object_show(datetimefield);
609 evas_object_pass_events_set(datetimefield, 1);
610 evas_object_propagate_events_set(datetimefield, 0);
612 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
613 const char *time_format = NULL;
614 if (item_data->chk_status)//12 hours
616 time_format = "%I : %M %p";
618 time_format = "%H : %M";
621 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
622 char *old_format = elm_datetime_format_get(datetimefield);
623 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
625 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
627 SETTING_TRACE("datefield_format:%s", date_format);
629 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
630 "%s %s", item_data->sub_desc, time_format);
632 elm_datetime_format_set(datetimefield, date_format);
634 // min : 1970 1, 01, Thursday 00:00:00
635 // max : 2038 1, 19, Thursday 03:14:07
637 memset(&ts_ret, 0, sizeof(struct tm));
638 ts_ret.tm_year = 138;
641 elm_datetime_value_max_set(datetimefield, &ts_ret);
646 elm_datetime_value_min_set(datetimefield, &ts_ret);
649 time_t ctime = time(NULL);
651 struct tm *ts = localtime_r(&ctime, &ts_ret);
654 elm_datetime_value_set(datetimefield, &ts_ret);
656 if (item_data->chk_change_cb) {
657 evas_object_smart_callback_add(datetimefield,
659 item_data->chk_change_cb,
663 if (item_data->isItemDisableFlag) {
664 setting_disable_evas_object(datetimefield);
666 return datetimefield;
668 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
670 retv_if(!item_data || !parent, NULL);
671 Evas_Object *box = elm_box_add(parent);
672 elm_box_horizontal_set(box, 1);
675 Evas_Object *radio = __add_radio(item_data, parent);
676 setting_disable_evas_object(radio);
677 elm_box_pack_end(box, radio);
680 Evas_Object *separator =
681 setting_create_blank_rect_customize(box,
682 SETTING_HALF_SCREEN_WIDTH,
683 SETTING_PADDING_HEIGHT);
684 elm_box_pack_end(box, separator);
687 Evas_Object *progressbar = elm_progressbar_add(parent);
688 elm_object_style_set(progressbar, "list_process");
689 evas_object_size_hint_align_set(progressbar,
690 EVAS_HINT_FILL, 0.5);
691 evas_object_size_hint_weight_set(progressbar,
694 elm_progressbar_pulse(progressbar, EINA_TRUE);
695 evas_object_show(progressbar);
696 elm_box_pack_end(box, progressbar);
698 evas_object_show(box);
701 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
703 retv_if(!item_data || !parent, NULL);
704 // added by JTS: CQ H0100135171
705 Evas_Object *box = elm_box_add(parent);
706 elm_box_horizontal_set(box, 1);
709 Evas_Object *separator =
710 setting_create_blank_rect_customize(box,
711 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
712 elm_box_pack_end(box, separator);
715 Evas_Object *progressbar = elm_progressbar_add(parent);
716 elm_object_style_set(progressbar, "list_process");
717 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
718 evas_object_size_hint_weight_set(progressbar,
719 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
720 elm_progressbar_pulse(progressbar, EINA_TRUE);
721 evas_object_show(progressbar);
722 elm_box_pack_end(box, progressbar);
724 evas_object_show(box);
728 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
730 retv_if(!item_data || !parent, NULL);
731 Evas_Object *progressbar = elm_progressbar_add(parent);
732 elm_object_style_set(progressbar, "list_process");
733 evas_object_size_hint_align_set(progressbar,
734 EVAS_HINT_FILL, 0.5);
735 evas_object_size_hint_weight_set(progressbar,
738 elm_progressbar_pulse(progressbar, EINA_TRUE);
739 evas_object_show(progressbar);
743 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
745 retv_if(!item_data || !parent, NULL);
748 Evas_Object *radio = __add_radio(item_data, parent);
753 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
755 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
756 Evas_Object *icon = elm_icon_add(parent);
757 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
758 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
761 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
763 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
764 Evas_Object *icon = elm_icon_add(parent);
765 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
766 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
771 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
774 SWALLOW_Type type; // ui type
777 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
779 {SWALLOW_Type_1CHECK, __add_check},
780 {SWALLOW_Type_1TOGGLE, __add_toggle},
781 {SWALLOW_Type_1RADIO, __add_radio},
782 {SWALLOW_Type_1BUTTON, __add_button},
784 //base objects in an layout
785 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
786 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
787 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
789 //other compelx objects
790 {SWALLOW_Type_1SEARCH, __add_search},
791 {SWALLOW_Type_1PROCESS, __add_process},
792 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
793 {SWALLOW_Type_1CHECKICON, __add_check_icon},
794 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
795 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
797 //left part object of the type
798 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
799 {SWALLOW_Type_1ICON_1PROCESS, __add_left_default},
800 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
802 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
803 //right part object of the type
804 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
805 {SWALLOW_Type_1ICON_1PROCESS, __add_process},
806 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
809 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
810 //end part object of the type
811 {SWALLOW_Type_1RADIO, __add_radio},
813 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
814 {"elm.icon", __cd_left},
815 {"elm.icon.1", __cd_left},
816 {"elm.icon.2", __cd_right},
817 {"elm.swallow.end", __cd_end},
820 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
823 retv_if(!data, NULL);
824 Setting_GenGroupItem_Data *item_data = data;
825 retv_if(!data, NULL);
826 __Content_Drawer *cd_list = NULL;
827 __drawer_fp fp = NULL;
828 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
830 fp = __add_left_default; //hold default drawer
833 else if (!safeStrCmp(part, "elm.icon.2"))
835 fp = __add_right_default; //hold default drawer
836 cd_list = __cd_right;
838 else if (!safeStrCmp(part, "elm.swallow.end"))
840 //the default value of fp is NULL here
843 if (!cd_list) return NULL;//invalid part
846 for (; idx < SWALLOW_Type_MAX; idx++)
848 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
850 fp = cd_list[idx].draw;
854 return fp ? fp(item_data, obj) : NULL;
857 static void _gl_Gendial_del(void *data, Evas_Object *obj)
859 /* SETTING_TRACE_BEGIN; */
860 Setting_GenGroupItem_Data *item_data =
861 (Setting_GenGroupItem_Data *) data;
863 G_FREE(item_data->keyStr);
864 G_FREE(item_data->sub_desc);
865 G_FREE((item_data->l_swallow_path));
866 G_FREE((item_data->r_swallow_path));
867 G_FREE(item_data->item_style);
870 if (item_data->digits_filter_data)
872 G_FREE(item_data->digits_filter_data->accepted);
873 G_FREE(item_data->digits_filter_data->rejected);
874 FREE(item_data->digits_filter_data);
878 if (item_data->notify) {
879 evas_object_del(item_data->notify);
880 item_data->notify = NULL;
883 FREE(item_data->limit_filter_data);
884 __BACK_POINTER_UNSET(item_data);
887 /* SETTING_TRACE_END; */
891 * To intialize an Elm_Genlist_Item_Class, according to item style
893 * @param[in] item_style
896 bool setting_create_Gendial_itc(const char *item_style,
897 Elm_Genlist_Item_Class *itc)
899 itc->item_style = item_style;
900 itc->func.text_get = _gl_Gendial_text_get;
901 itc->func.content_get = _gl_Gendial_content_get;
902 itc->func.state_get = NULL;
903 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
908 * Create group style item
910 * @return a pointer to Setting_GenGroupItem_Data
912 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
913 const Elm_Genlist_Item_Class *itc,
914 Elm_Object_Item *parent,
915 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
917 setting_call_back_func gl_sel)
919 /* SETTING_TRACE_BEGIN; */
920 Setting_GenGroupItem_Data *item_data =
921 (Setting_GenGroupItem_Data *) calloc(1,
923 (Setting_GenGroupItem_Data));
924 setting_retvm_if(!item_data, NULL, "calloc failed");
925 item_data->keyStr = (char *)g_strdup(keyStr);
928 elm_genlist_item_append(genlist, itc, item_data, parent,
932 elm_genlist_item_append(genlist, itc, item_data, parent,
933 flag, _gl_Gendial_sel, NULL);
939 * Create separator style item with title
941 * @return a pointer to Setting_GenGroupItem_Data
943 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
944 Evas_Object *genlist,
945 const Elm_Genlist_Item_Class *itc,
947 setting_call_back_func gl_sel)
949 /* SETTING_TRACE_BEGIN; */
950 Setting_GenGroupItem_Data *item_data =
951 (Setting_GenGroupItem_Data *) calloc(1,
953 (Setting_GenGroupItem_Data));
954 setting_retvm_if(!item_data, NULL, "calloc failed");
955 item_data->keyStr = (char *)g_strdup(keyStr);
958 elm_genlist_item_append(genlist, itc, item_data, NULL,
959 ELM_GENLIST_ITEM_NONE, gl_sel,
963 elm_genlist_item_append(genlist, itc, item_data, NULL,
964 ELM_GENLIST_ITEM_NONE,
965 _gl_Gendial_sel, NULL);
971 * Create 1radio-1text style item
973 * @return a pointer to Setting_GenGroupItem_Data
976 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
977 Evas_Object *genlist,
978 const Elm_Genlist_Item_Class *itc,
979 setting_call_back_func gl_sel,
981 SWALLOW_Type swallow_type,
982 Evas_Object *rgd, int chk_status,
984 setting_call_back_func chk_change_cb)
986 /* SETTING_TRACE_BEGIN; */
987 Setting_GenGroupItem_Data *item_data =
988 (Setting_GenGroupItem_Data *) calloc(1,
990 (Setting_GenGroupItem_Data));
991 setting_retvm_if(!item_data, NULL, "calloc failed");
992 item_data->keyStr = (char *)g_strdup(keyStr);
993 item_data->swallow_type = swallow_type;
994 item_data->chk_status = chk_status;
995 item_data->chk_change_cb = chk_change_cb;
996 item_data->rgd = rgd;
1000 elm_genlist_item_append(genlist, itc, item_data, NULL,
1001 ELM_GENLIST_ITEM_NONE, gl_sel,
1005 elm_genlist_item_append(genlist, itc, item_data, NULL,
1006 ELM_GENLIST_ITEM_NONE,
1007 _gl_Gendial_sel, sel_data);
1012 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1013 Evas_Object *genlist,
1014 const Elm_Genlist_Item_Class *itc,
1015 setting_call_back_func gl_sel,
1017 SWALLOW_Type swallow_type,
1018 Evas_Object *rgd, int chk_status,
1020 const char *sub_desc,
1021 setting_call_back_func chk_change_cb)
1023 /* SETTING_TRACE_BEGIN; */
1024 Setting_GenGroupItem_Data *item_data =
1025 (Setting_GenGroupItem_Data *) calloc(1,
1027 (Setting_GenGroupItem_Data));
1028 setting_retvm_if(!item_data, NULL, "calloc failed");
1029 item_data->keyStr = (char *)g_strdup(keyStr);
1030 item_data->sub_desc = (char *)g_strdup(sub_desc);
1031 item_data->swallow_type = swallow_type;
1032 item_data->chk_status = chk_status;
1033 item_data->chk_change_cb = chk_change_cb;
1034 item_data->rgd = rgd;
1038 elm_genlist_item_append(genlist, itc, item_data, NULL,
1039 ELM_GENLIST_ITEM_NONE, gl_sel,
1043 elm_genlist_item_append(genlist, itc, item_data, NULL,
1044 ELM_GENLIST_ITEM_NONE,
1045 _gl_Gendial_sel, sel_data);
1051 * Create common style item with menu icon
1053 * @return a pointer to Setting_GenGroupItem_Data
1055 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1056 Evas_Object *genlist,
1057 const Elm_Genlist_Item_Class *itc,
1058 Elm_Object_Item *parent,
1059 setting_call_back_func gl_sel,
1061 SWALLOW_Type swallow_type,
1063 char *r_icon_path, int chk_status,
1064 const char *keyStr, char *sub_desc,
1065 setting_call_back_func
1068 // SETTING_TRACE_BEGIN;
1069 Setting_GenGroupItem_Data *item_data = (
1070 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1071 setting_retvm_if(!item_data, NULL, "calloc failed");
1073 /* to do formatting customizition in one place */
1074 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1075 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1076 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1078 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1079 char* temp1 = (char *)keyStr;
1080 char*temp2 = strchr(temp1, '&');
1083 while (NULL != temp2) {
1084 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1085 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1086 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1087 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1088 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1089 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1090 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1091 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1092 ) {//escape character,do nothing
1094 if ('\0' == temp[0]) break;
1095 temp2 = strchr(temp, '&');
1099 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1100 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1102 if ('\0' == temp1[0]) break;
1103 temp2 = strchr(temp1, '&');
1106 if ('\0' != temp1[0]) {
1107 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1111 item_data->keyStr = (char *)g_strdup(speciliztion);
1113 item_data->keyStr = (char *)g_strdup(keyStr);
1116 item_data->sub_desc = (char *)g_strdup(sub_desc);
1117 item_data->swallow_type = swallow_type;
1118 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1119 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1120 item_data->chk_status = chk_status;
1121 item_data->chk_change_cb = chk_change_cb;
1125 elm_genlist_item_append(genlist, itc, item_data, parent,
1126 ELM_GENLIST_ITEM_NONE, gl_sel,
1130 elm_genlist_item_append(genlist, itc, item_data, parent,
1131 ELM_GENLIST_ITEM_NONE,
1132 _gl_Gendial_sel, sel_data);
1134 //help text clicking issue
1135 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1137 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1138 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1141 ELM_GENLIST_ITEM_NONE,
1143 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1144 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1145 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1152 * Common function to create a genlist item
1153 * @return a pointer to Setting_GenGroupItem_Data
1155 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1157 const Elm_Genlist_Item_Class *itc,
1158 setting_call_back_func
1168 setting_call_back_func chk_change_cb)
1170 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1172 swallow_type, l_icon_path,
1173 r_icon_path, chk_status,
1179 * Create 1entry style item
1180 * @return a pointer to Setting_GenGroupItem_Data
1182 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(
1183 Evas_Object * genlist,
1184 const Elm_Genlist_Item_Class *itc,
1185 setting_call_back_func gl_sel,
1187 SWALLOW_Type swallow_type,
1193 setting_call_back_func chk_change_cb,
1194 Elm_Input_Panel_Layout input_type,
1195 bool isPasswordFlag,
1202 /* SETTING_TRACE_BEGIN; */
1203 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1204 setting_retvm_if(!item_data, NULL, "calloc failed");
1205 item_data->keyStr = (char *)g_strdup(keyStr);
1206 item_data->sub_desc = (char *)g_strdup(sub_desc);
1207 item_data->swallow_type = swallow_type;
1208 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1209 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1210 item_data->chk_status = chk_status;
1211 item_data->chk_change_cb = chk_change_cb;
1213 //setting_call_back_func chk_focus_out_cb,
1216 item_data->input_type = input_type;
1217 item_data->isPasswordFlag = isPasswordFlag;
1218 item_data->isFocusFlag = isFocusFlag;
1220 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1221 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1222 if(!digits_filter_data) {
1223 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1224 // free allocated data
1225 G_FREE(item_data->keyStr);
1226 G_FREE(item_data->sub_desc);
1227 G_FREE(item_data->l_swallow_path);
1228 G_FREE(item_data->r_swallow_path);
1234 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1235 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1236 if(!limit_filter_data) {
1237 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1239 // free allocated data
1240 G_FREE(item_data->keyStr);
1241 G_FREE(item_data->sub_desc);
1242 G_FREE(item_data->l_swallow_path);
1243 G_FREE(item_data->r_swallow_path);
1245 FREE(digits_filter_data);
1249 limit_filter_data->max_char_count = max_char_count;
1250 limit_filter_data->max_byte_count = max_byte_count;
1251 digits_filter_data->accepted = (char *)g_strdup(accepted);
1252 digits_filter_data->rejected = (char *)g_strdup(rejected);
1254 item_data->digits_filter_data = digits_filter_data;
1255 item_data->limit_filter_data = limit_filter_data;
1256 item_data->userdata = sel_data;
1260 elm_genlist_item_append(genlist, itc, item_data, NULL,
1261 ELM_GENLIST_ITEM_NONE, gl_sel,
1265 elm_genlist_item_append(genlist, itc, item_data, NULL,
1266 ELM_GENLIST_ITEM_NONE,
1267 _gl_Gendial_sel, sel_data);
1273 * Create 1entry style item
1275 * @return a pointer to Setting_GenGroupItem_Data
1277 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry_fo(
1278 Evas_Object * genlist,
1279 const Elm_Genlist_Item_Class *itc,
1280 setting_call_back_func gl_sel,
1282 SWALLOW_Type swallow_type,
1288 setting_call_back_func chk_change_cb,
1289 setting_call_back_func chk_focus_out_cb,
1290 Elm_Input_Panel_Layout input_type,
1291 bool isPasswordFlag,
1298 /* SETTING_TRACE_BEGIN; */
1299 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1, sizeof (Setting_GenGroupItem_Data));
1300 setting_retvm_if(!item_data, NULL, "calloc failed");
1301 item_data->keyStr = (char *)g_strdup(keyStr);
1302 item_data->sub_desc = (char *)g_strdup(sub_desc);
1303 item_data->swallow_type = swallow_type;
1304 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1305 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1306 item_data->chk_status = chk_status;
1307 item_data->chk_change_cb = chk_change_cb;
1308 item_data->stop_change_cb = chk_focus_out_cb;
1309 item_data->isSinglelineFlag = true;
1310 //setting_call_back_func chk_focus_out_cb,
1312 item_data->input_type = input_type;
1313 item_data->isPasswordFlag = isPasswordFlag;
1314 item_data->isFocusFlag = isFocusFlag;
1316 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1317 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1318 if(!digits_filter_data) {
1319 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1320 // free allocated data
1321 G_FREE(item_data->keyStr);
1322 G_FREE(item_data->sub_desc);
1323 G_FREE(item_data->l_swallow_path);
1324 G_FREE(item_data->r_swallow_path);
1330 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1331 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1332 if(!limit_filter_data) {
1333 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size failed");
1335 // free allocated data
1336 G_FREE(item_data->keyStr);
1337 G_FREE(item_data->sub_desc);
1338 G_FREE(item_data->l_swallow_path);
1339 G_FREE(item_data->r_swallow_path);
1341 FREE(digits_filter_data);
1345 limit_filter_data->max_char_count = max_char_count;
1346 limit_filter_data->max_byte_count = max_byte_count;
1347 digits_filter_data->accepted = (char *)g_strdup(accepted);
1348 digits_filter_data->rejected = (char *)g_strdup(rejected);
1350 item_data->digits_filter_data = digits_filter_data;
1351 item_data->limit_filter_data = limit_filter_data;
1352 item_data->userdata = sel_data;
1356 elm_genlist_item_append(genlist, itc, item_data, NULL,
1357 ELM_GENLIST_ITEM_NONE, gl_sel,
1361 elm_genlist_item_append(genlist, itc, item_data, NULL,
1362 ELM_GENLIST_ITEM_NONE,
1363 _gl_Gendial_sel, sel_data);
1369 * General function to create a parent item of expandable item
1371 * @return a pointer to Setting_GenGroupItem_Data
1373 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1374 Evas_Object *genlist,
1375 const Elm_Genlist_Item_Class *itc,
1376 setting_call_back_func gl_sel,
1378 SWALLOW_Type swallow_type,
1382 /* SETTING_TRACE_BEGIN; */
1383 Setting_GenGroupItem_Data *item_data =
1384 (Setting_GenGroupItem_Data *) calloc(1,
1386 (Setting_GenGroupItem_Data));
1387 setting_retvm_if(!item_data, NULL, "calloc failed");
1388 item_data->keyStr = (char *)g_strdup(keyStr);
1389 item_data->sub_desc = (char *)g_strdup(sub_desc);
1390 item_data->swallow_type = swallow_type;
1394 elm_genlist_item_append(genlist, itc, item_data, NULL,
1395 ELM_GENLIST_ITEM_TREE, gl_sel,
1399 elm_genlist_item_append(genlist, itc, item_data, NULL,
1400 ELM_GENLIST_ITEM_TREE,
1401 _gl_Gendial_sel_expand, sel_data);
1407 * General function to create a subitem of expandable item
1409 * @return a pointer to Setting_GenGroupItem_Data
1411 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1412 Evas_Object *genlist,
1413 const Elm_Genlist_Item_Class *itc,
1414 setting_call_back_func gl_sel,
1416 Elm_Object_Item *parent,
1417 SWALLOW_Type swallow_type,
1418 Evas_Object *rgd, int chk_status,
1420 setting_call_back_func
1423 /* SETTING_TRACE_BEGIN; */
1424 Setting_GenGroupItem_Data *item_data =
1425 (Setting_GenGroupItem_Data *) calloc(1,
1427 (Setting_GenGroupItem_Data));
1428 setting_retvm_if(!item_data, NULL, "calloc failed");
1429 item_data->keyStr = (char *)g_strdup(keyStr);
1430 item_data->swallow_type = swallow_type;
1431 item_data->chk_status = chk_status;
1432 item_data->rgd = rgd;
1435 gl_sel = setting_sub_list_sel_cb;
1437 if (!chk_change_cb) {
1438 chk_change_cb = setting_sub_list_rd_change;
1441 item_data->chk_change_cb = chk_change_cb;
1443 elm_genlist_item_append(genlist, itc, item_data, parent,
1444 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1449 * To make genlist support expandable style item
1451 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1452 setting_call_back_func gl_exp_cb,
1453 setting_call_back_func gl_smart_cb)
1455 ret_if(NULL == genlist);
1456 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1458 gl_smart_cb = __exp_list_smart_cb;
1462 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1463 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1465 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1466 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1472 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1473 &(networkUG->itc_1text_2icon));
1475 1. create a process genlist item : [intial state is 'PROCESS']
1476 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1477 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1478 SWALLOW_Type_1RADIO_1PROCESS,
1479 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1480 "Searching..", NULL);
1481 or [intial state is 'UNPROCESS']
1482 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1483 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1484 SWALLOW_Type_1RADIO,
1485 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1486 "Searching..", NULL);
1488 2. to set the PROCESS state at any place as you like:
1489 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1490 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1492 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1495 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1499 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1500 elm_object_item_data_set(data_item->item, data_item);
1501 elm_genlist_item_update(data_item->item);
1505 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1508 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1511 data_item->swallow_type = SWALLOW_Type_1RADIO;
1512 elm_object_item_data_set(data_item->item, data_item);
1513 elm_genlist_item_update(data_item->item);
1518 * Check if some item is selected in done-list
1521 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1523 SETTING_TRACE_BEGIN;
1524 bool isFound = FALSE; /* wether can found some item checked */
1526 for (; idx < list_data->cur_item_num; idx++) {
1527 if (list_data->chk_items[idx].data_GenItem->chk_status) {
1535 static void __setting_done_list_item_sel(void *data)
1537 SETTING_TRACE_BEGIN;
1538 retm_if(data == NULL, "data == NULL");
1539 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1544 setting_create_sel_info_popup(list_data->ly_parent,
1545 &(list_data->selInfoPop_layout),
1546 &(list_data->selInfoPop));
1548 /* else for other checks, do rotinue checking */
1549 bool isFound = FALSE; /* wether found the item not checked */
1550 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1551 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1552 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1556 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1561 if (isFound) { /* reset state of chk_sel_all */
1562 list_data->select_all_checked = 0;
1563 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1565 list_data->select_all_checked = 1;
1566 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1569 /* SETTING_TRACE("sel_num:%d", sel_num); */
1571 if (list_data->navi_it) {
1572 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1573 elm_object_disabled_set(button, EINA_TRUE);
1575 evas_object_hide(list_data->selInfoPop);
1579 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1580 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1582 /* text set and timeout set */
1583 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1585 if (list_data->navi_it) {
1586 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1587 elm_object_disabled_set(button, EINA_FALSE);
1592 * Do process when clicking the check object in the done-list item
1594 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1597 SETTING_TRACE_BEGIN;
1599 retm_if(data == NULL, "Data parameter is NULL");
1600 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1603 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1605 Setting_Done_List_Data *list_data = list_item->userdata;
1606 __setting_done_list_item_sel(list_data);
1609 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1613 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1614 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1615 elm_genlist_item_selected_set(item, 0);
1616 Setting_GenGroupItem_Data *list_item =
1617 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1619 int old_status = elm_check_state_get(list_item->eo_check);
1621 list_item->chk_status = !old_status;
1622 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1624 /* other process.. */
1625 Setting_Done_List_Data *list_data = list_item->userdata;
1626 __setting_done_list_item_sel(list_data);
1629 static void __setting_select_all_done(void *data)
1631 SETTING_TRACE_BEGIN;
1632 retm_if(data == NULL, "data == NULL");
1633 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1638 setting_create_sel_info_popup(list_data->ly_parent,
1639 &(list_data->selInfoPop_layout),
1640 &(list_data->selInfoPop));
1642 if (list_data->select_all_checked) {
1643 /* set all other checks state to be 1 */
1644 SETTING_TRACE_DEBUG("Select All checked");
1645 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1646 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1647 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1648 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1650 sel_num = list_data->cur_item_num;
1652 SETTING_TRACE_DEBUG("Select All unchecked");
1653 /* set all other checks state to be 0 */
1654 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1655 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1656 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1657 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1662 /* SETTING_TRACE("sel_num:%d", sel_num); */
1664 if (list_data->navi_it) {
1665 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1666 elm_object_disabled_set(button, EINA_TRUE);
1669 evas_object_hide(list_data->selInfoPop);
1672 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1673 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s (%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1675 /* text set and timeout set */
1676 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1678 if (list_data->navi_it) {
1679 Evas_Object *button = elm_object_item_part_content_get(list_data->navi_it, "toolbar_button1");
1680 elm_object_disabled_set(button, EINA_FALSE);
1684 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1686 SETTING_TRACE_BEGIN;
1687 retm_if(data == NULL, "data == NULL");
1688 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1690 list_data->select_all_checked = !list_data->select_all_checked;
1691 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1693 __setting_select_all_done(list_data);
1696 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1698 SETTING_TRACE_BEGIN;
1699 retm_if(data == NULL, "data == NULL");
1700 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1702 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1703 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1704 __setting_select_all_done(data);
1708 * The API to create done-list.
1710 * @param[in] list_data
1711 * @return a done-list
1713 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1715 SETTING_TRACE_BEGIN;
1716 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1717 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1718 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1719 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1720 evas_object_show(sub_layout);
1722 setting_create_Gendial_itc("1text.1icon.3", &(list_data->itc_1text_1icon));
1724 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1725 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1726 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default"); //select_all/default
1727 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1728 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1729 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1731 Eina_Bool select_all_checked = list_data->select_all_checked;
1732 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1733 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1734 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1735 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1736 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1738 list_data->select_all_checkbox = select_all_checkbox;
1739 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1741 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1742 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1743 elm_genlist_clear(scroller); /* first to clear list */
1745 elm_object_part_content_set(sub_layout, "search_list", scroller);
1746 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1749 for (; index < list_data->cur_item_num; index++) {
1750 list_data->chk_items[index].data_GenItem =
1751 setting_create_Gendial_field_def(scroller,
1752 &(list_data->itc_1text_1icon),
1753 setting_done_list_Gendial_mouse_up_cb,
1755 SWALLOW_Type_1CHECK, NULL,
1757 list_data->chk_items
1758 [index].item_name, NULL,
1759 setting_done_list_Gendial_chk_btn_cb);
1760 if (list_data->chk_items[index].data_GenItem) {
1761 list_data->chk_items[index].data_GenItem->userdata = list_data;
1763 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1772 * To disable a specialized genlist item
1776 void setting_disable_genlist_item(Elm_Object_Item *item)
1779 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1784 * To enable a specialized genlist item
1788 void setting_enable_genlist_item(Elm_Object_Item *item)
1791 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */