4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <setting-common-draw-widget.h>
25 #include <system_settings.h>
27 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj, const char *part);
28 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj, const char *part);
29 static void _gl_Gendial_del(void *data, Evas_Object *obj);
30 const Elm_Genlist_Item_Class itc_seperator = {
31 .item_style = "dialogue/separator/21/with_line",
32 .func.text_get = NULL,
33 .func.content_get = NULL,
34 .func.state_get = NULL,
38 const Elm_Genlist_Item_Class itc_bottom_seperator = {
39 .item_style = "dialogue/separator/20",
40 .func.text_get = NULL,
41 .func.content_get = NULL,
42 .func.state_get = NULL,
46 const Elm_Genlist_Item_Class itc_sep_line = {
47 .item_style = "dialogue/separator/1/with_line",
48 .func.text_get = _gl_Gendial_text_get,
49 .func.content_get = NULL,
50 .func.state_get = NULL,
54 #define DEFINE_ITC1(style, name) \
55 const Elm_Genlist_Item_Class name = {\
57 .func.text_get = _gl_Gendial_text_get,\
58 .func.content_get = _gl_Gendial_content_get,\
59 .func.state_get = NULL,\
60 .func.del = _gl_Gendial_del,\
63 DEFINE_ITC1("dialogue/1text", itc_1text);
64 DEFINE_ITC1("dialogue/1text.1icon.2", itc_1text_1icon_2);
66 DEFINE_ITC1("dialogue/1icon", itc_1icon);
67 DEFINE_ITC1("dialogue/1text.1icon/expandable2", itc_1icon_1text_sub);
68 DEFINE_ITC1("dialogue/1text.1icon", itc_1text_1icon);
69 DEFINE_ITC1("dialogue/1text.2icon", itc_1text_2icon);
70 DEFINE_ITC1("dialogue/1text.2icon.2", itc_1text_2icon_2);
72 DEFINE_ITC1("dialogue/2text.2", itc_2text_2);
73 DEFINE_ITC1("dialogue/2text", itc_2text);
74 DEFINE_ITC1("multiline/2text.1icon", itc_multiline_2text_1icon);
75 DEFINE_ITC1("dialogue/2text.1icon.3", itc_2text_1icon_3);
76 DEFINE_ITC1("dialogue/2text.1icon.6", itc_2text_1icon_6);
77 DEFINE_ITC1("dialogue/2text.1icon.7", itc_2text_1icon_7);
79 DEFINE_ITC1("dialogue/2text.3/expandable", itc_2text_3_parent);
80 DEFINE_ITC1("dialogue/2text.3", itc_2text_3);
81 DEFINE_ITC1("dialogue/2text.2icon.3", itc_2text_2icon_3);
83 DEFINE_ITC1("multiline/1text", itc_multiline_text);
84 DEFINE_ITC1("1text.1icon.2", itc_cm_1text_1icon_2);
85 DEFINE_ITC1("select_all", itc_sel_all);
86 DEFINE_ITC1("dialogue/bg/1icon", itc_bg_1icon);
87 DEFINE_ITC1("dialogue/title", itc_group_item);
90 * Do process when clicking on a common genlist item
92 void setting_mouse_up_Gendial_list_radio_cb(void *data, Evas_Object *obj,
96 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
97 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
98 elm_genlist_item_selected_set(item, 0);
99 Setting_GenGroupItem_Data *list_item =
100 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
102 setting_retm_if(data == NULL, "Data parameter is NULL");
103 Evas_Object *radio = data;
104 elm_radio_value_set(radio, list_item->chk_status);
107 static void __radio_changed(void *data, Evas_Object *obj, void *event_info)
109 retm_if(data == NULL, "Data parameter is NULL");
110 Setting_GenGroupItem_Data *list_item =
111 (Setting_GenGroupItem_Data *) data;
112 list_item->chk_status = elm_radio_value_get(obj); /* for update */
115 static void __entry_changed(void *data, Evas_Object *obj, void *event_info)
117 retm_if(data == NULL, "Data parameter is NULL");
119 Setting_GenGroupItem_Data *list_item =
120 (Setting_GenGroupItem_Data *) data;
121 list_item->sub_desc = (char *)g_strdup(elm_entry_entry_get(obj));
122 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
125 if (elm_entry_is_empty(obj))
127 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
128 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
132 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
133 if (elm_object_focus_get(obj)) //only do when entry is focused
135 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
141 static void __entry_unfocused(void *data, Evas_Object *obj, void *event_info) // Unfocused callback will show guidetext and hide X marked button.
145 Evas_Object *entry_container = data;
146 //whe entry unfocused, its guidetext will becomes "Input here"
147 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
148 if (elm_entry_is_empty(obj))
149 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
150 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
152 static void __entry_focused(void *data, Evas_Object *obj, void *event_info) // Focused callback will show X marked button and hide guidetext.
156 Evas_Object *entry_container = data;
157 //whe entry focused, its guidetext will becomes "Input here"
158 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
159 if (!elm_entry_is_empty(obj))
160 elm_object_signal_emit(entry_container, "elm,state,eraser,show", "elm");
161 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
163 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
164 if (imf_context) ecore_imf_context_input_panel_show(imf_context);
166 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.
169 Evas_Object *entry = data;
170 elm_entry_entry_set(entry, "");
171 elm_object_focus_set(entry, EINA_TRUE);
174 static void __chk_changed(void *data, Evas_Object *obj, void *event_info)
176 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;
221 if(safeStrCmp(ev->key, "KP_Enter") == 0 //it is for Japanese keyboard to fix N_SE-10719
222 || safeStrCmp(ev->key, "Return") == 0) //to disable the 'Enter' orginal function
224 SETTING_TRACE("ENTER %s ev->key:%s", __FUNCTION__, ev->key);
225 list_item->enterKeyPressFlag = true;
226 //hide the eraser button
227 //format like:xx<br/>
228 const char *entry_str = remove_first_substring(elm_entry_entry_get(obj), "<br/>");
229 elm_entry_entry_set(obj, entry_str);
231 elm_entry_cursor_end_set(obj);
232 setting_hide_input_pannel_cb(obj);
234 list_item->enterKeyPressFlag = false;
235 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
236 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
237 elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
239 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
246 * Do process when clicking radio in subitem of expandable item
248 void setting_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info)
251 retm_if(data == NULL, "Data parameter is NULL");
252 Setting_GenGroupItem_Data *list_item =
253 (Setting_GenGroupItem_Data *) data;
254 list_item->chk_status = elm_radio_value_get(obj); /* for update */
256 Elm_Object_Item *subItem = list_item->item;
257 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subItem);
259 Setting_GenGroupItem_Data *data_subItem = elm_object_item_data_get(subItem); /* subItem data */
260 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
262 ret_if(NULL == data_subItem || NULL == data_parentItem);
264 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
265 list_item->chk_status, &err);
267 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
268 elm_object_item_data_set(data_parentItem->item, data_parentItem);
269 elm_genlist_item_update(data_parentItem->item);
273 * Do process when clicking on subitem of expandable item
275 void setting_sub_list_sel_cb(void *data, Evas_Object *obj, void *event_info)
279 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
280 Elm_Object_Item *subitem = (Elm_Object_Item *) event_info;
281 Elm_Object_Item *parentItem = elm_genlist_item_parent_get(subitem);
282 elm_genlist_item_selected_set(subitem, 0);
283 Setting_GenGroupItem_Data *data_subItem =
284 elm_object_item_data_get(subitem);
285 Setting_GenGroupItem_Data *data_parentItem = elm_object_item_data_get(parentItem); /* parent data */
286 ret_if(NULL == data_subItem || NULL == data_parentItem);
288 elm_radio_value_set(data_subItem->rgd, data_subItem->chk_status);
290 setting_set_int_slp_key(data_parentItem->int_slp_setting_binded,
291 data_subItem->chk_status, &err);
292 setting_retm_if(0 != err, "Set vconf error[%d]",data_parentItem->int_slp_setting_binded);
294 data_parentItem->sub_desc = (char *)g_strdup(_(data_subItem->keyStr));
295 elm_object_item_data_set(data_parentItem->item, data_parentItem);
296 elm_genlist_item_update(data_parentItem->item);
299 static void __exp_list_smart_cb(void *data, Evas_Object *obj, void *event_info)
301 ret_if(data == NULL || event_info == NULL);
302 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
303 char *cb_type = data;
305 if (0 == safeStrCmp(cb_type, "drag")
306 || 0 == safeStrCmp(cb_type, "longpressed")) {
307 //Evas_Object *base_view = (Evas_Object *) elm_genlist_item_object_get(item);
308 //edje_object_signal_emit(base_view, "mouse,out", "touch_arrow");
309 } else if (0 == safeStrCmp(cb_type, "contracted")) {
310 elm_genlist_item_subitems_clear(item);
314 static void _gl_Gendial_sel(void *data, Evas_Object *obj, void *event_info)
316 /* SETTING_TRACE_BEGIN; */
317 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
318 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
319 elm_genlist_item_selected_set(item, 0);
322 static void _gl_Gendial_sel_expand(void *data, Evas_Object *obj,
325 /* SETTING_TRACE_BEGIN; */
326 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
327 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
328 elm_genlist_item_selected_set(item, 0);
329 bool status = !elm_genlist_item_expanded_get(item);
330 elm_genlist_item_expanded_set(item, status);
333 static char *_gl_Gendial_text_get(void *data, Evas_Object *obj,
336 /* SETTING_TRACE_BEGIN; */
337 Setting_GenGroupItem_Data *item_data =
338 (Setting_GenGroupItem_Data *) data;
339 /* SETTING_TRACE("part:%s", part); */
340 if (SWALLOW_Type_LAYOUT_ENTRY == item_data->swallow_type) { /* no need to create 'text' part */
344 /* for font size view */
345 if (SWALLOW_Type_1RADIO_1LABLE == item_data->swallow_type) {
346 char speciliztion[MAX_SPECIALIZITION_LEN] = {0,};
348 SETTING_TRACE("item_data->chk_status:%d", item_data->chk_status);
349 if (SYSTEM_SETTINGS_FONT_SIZE_SMALL == item_data->chk_status) {
350 font_size = LABEL_FONT_SIZE_SMALL;
351 } else if (SYSTEM_SETTINGS_FONT_SIZE_LARGE == item_data->chk_status) {
352 font_size = LABEL_FONT_SIZE_LARGE;
353 } else if (SYSTEM_SETTINGS_FONT_SIZE_HUGE == item_data->chk_status) {
354 font_size = LABEL_FONT_SIZE_HUGE;
355 } else if (SYSTEM_SETTINGS_FONT_SIZE_GIANT == item_data->chk_status) {
356 font_size = LABEL_FONT_SIZE_GIANT;
358 font_size = LABEL_FONT_SIZE_NORMAL;
360 SETTING_TRACE("font_size:%d", font_size);
361 snprintf(speciliztion, sizeof(speciliztion), "<font_size=%d>%s</font_size>",
362 font_size, _(item_data->keyStr));
363 return (char *)g_strdup(speciliztion);
366 if (!safeStrCmp(part, "elm.text") || !safeStrCmp(part, "elm.text.1")) { /* title */
367 if (item_data->keyStr) {
368 return (char *)g_strdup(_(item_data->keyStr)); /* use item_data->keyStr */
371 } else if (!safeStrCmp(part, "elm.text.2")) { /* bottom or right */
372 if (item_data->sub_desc) {
373 return (char *)g_strdup(item_data->sub_desc);
380 static Evas_Object *__add_check(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
382 retv_if(!item_data || !parent, NULL);
383 Evas_Object *check = elm_check_add(parent);
384 elm_check_state_set(check, item_data->chk_status);
385 evas_object_show(check);
386 evas_object_pass_events_set(check, 1);
387 evas_object_propagate_events_set(check, 0);
389 item_data->eo_check = check;
391 if (item_data->chk_change_cb) {
392 evas_object_smart_callback_add(check,"changed",item_data->chk_change_cb,item_data);
394 evas_object_smart_callback_add(check,"changed", __chk_changed, item_data);
398 static Evas_Object *__add_check_icon(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
400 retv_if(!item_data || !parent, NULL);
401 Evas_Object *check = __add_check(item_data, parent);
403 Evas_Object *thumb = NULL;
404 if (item_data->r_swallow_path) {
405 thumb = elm_icon_add(parent);
406 elm_icon_file_set(thumb,
407 item_data->r_swallow_path,
409 evas_object_size_hint_aspect_set(thumb,
410 EVAS_ASPECT_CONTROL_VERTICAL,
414 Evas_Object *layout = elm_layout_add(parent);
415 elm_layout_file_set(layout, SETTING_THEME_EDJ_NAME,
417 evas_object_size_hint_weight_set(layout,
420 elm_object_part_content_set(layout, "checkbox", check);
421 elm_object_part_content_set(layout, "thumbnail", thumb);
422 evas_object_show(layout);
425 static Evas_Object *__add_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
427 retv_if(!item_data || !parent, NULL);
428 Evas_Object *check = __add_check(item_data, parent);
429 elm_object_style_set(check, "on&off");
432 static Evas_Object *__add_multiline_toggle(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
434 retv_if(!item_data || !parent, NULL);
435 Evas_Object *chk = __add_toggle(item_data, parent);
436 elm_object_style_set(chk, "on&off");
440 static Evas_Object *__add_radio(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
442 retv_if(!item_data || !parent, NULL);
443 if (!item_data->rgd) { /* exceptional handling */
444 item_data->rgd = elm_radio_add(parent);
445 elm_radio_state_value_set(item_data->rgd, -1);
447 Evas_Object *radio = elm_radio_add(parent);
448 elm_radio_state_value_set(radio,
449 item_data->chk_status);
450 elm_radio_group_add(radio, item_data->rgd);
451 evas_object_show(radio);
452 item_data->eo_check = radio;
453 if (item_data->chk_change_cb) {
454 evas_object_smart_callback_add(radio,
456 item_data->chk_change_cb,
459 evas_object_smart_callback_add(radio,
466 static Evas_Object *__add_button(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
468 retv_if(!item_data || !parent, NULL);
469 Evas_Object *btn = elm_button_add(parent);
470 evas_object_show(btn);
471 if (item_data->r_swallow_path)
473 elm_object_style_set(btn, item_data->r_swallow_path);
475 if (item_data->keyStr)
477 elm_object_text_set(btn, _(item_data->keyStr));
479 evas_object_propagate_events_set(btn, EINA_FALSE);
480 if (item_data->chk_change_cb)
481 evas_object_smart_callback_add(btn,
483 item_data->chk_change_cb,
487 static Evas_Object *__add_entry(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
489 retv_if(!item_data || !parent, NULL);
490 elm_genlist_mode_set(parent, ELM_LIST_COMPRESS); /* resolve abnormal height issue */
491 Evas_Object *ed_name =
492 setting_create_editfiled(parent, _(item_data->keyStr),
493 item_data->sub_desc);
494 Evas_Object *entry = elm_object_part_content_get(ed_name, "elm.swallow.content");
495 item_data->eo_check = entry;
496 elm_entry_input_panel_layout_set(entry,
497 item_data->input_type);
499 if (item_data->isSinglelineFlag) {
500 elm_entry_single_line_set(entry, EINA_TRUE);
503 if (item_data->isPasswordFlag) {
504 elm_entry_single_line_set(entry, EINA_TRUE);
505 elm_entry_password_set(entry, EINA_TRUE);
508 if (item_data->limit_filter_data) {
509 elm_entry_markup_filter_append
511 elm_entry_filter_limit_size,
512 item_data->limit_filter_data);
514 if (item_data->maxlength_reached_cb) {
515 evas_object_smart_callback_add(entry,
517 item_data->maxlength_reached_cb,
520 evas_object_smart_callback_add(entry,
526 if (item_data->stop_change_cb) {//invoked when stop focusing on
527 evas_object_smart_callback_add(entry,
529 item_data->stop_change_cb,
534 evas_object_smart_callback_add(entry,
539 if (item_data->digits_filter_data) {
540 elm_entry_markup_filter_append
542 elm_entry_filter_accept_set,
543 item_data->digits_filter_data);
546 /* for Setting App, All the entrys's context popup shouldn't be able */
547 /* to insert images, text is the only one can be inserted. */
548 elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);
550 if (item_data->chk_change_cb) {
551 evas_object_smart_callback_add
553 "changed", item_data->chk_change_cb,
557 evas_object_smart_callback_add(entry, "changed", __entry_changed, item_data);
558 evas_object_smart_callback_add(entry, "focused", __entry_focused, ed_name);
559 elm_object_signal_callback_add(ed_name, "elm,eraser,clicked", "elm", __eraser_clicked, entry);
561 if (item_data->start_change_cb) {
562 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, (Evas_Object_Event_Cb)(item_data->start_change_cb), item_data->userdata);
564 evas_object_event_callback_add(entry, EVAS_CALLBACK_KEY_DOWN, __entry_keydown, item_data);
566 if (item_data->input_panel_disable_flag) {
567 elm_entry_input_panel_enabled_set(entry, EINA_FALSE);
571 static Evas_Object *__add_slider(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
573 retv_if(!item_data || !parent, NULL);
574 Evas_Object *li_slider =
575 setting_create_slider(parent, item_data->evas,
576 item_data->l_swallow_path,
577 item_data->r_swallow_path,
578 item_data->chk_status,
579 item_data->isIndicatorVisible,
580 item_data->slider_min,
581 item_data->slider_max,
582 item_data->chk_change_cb,
583 item_data->start_change_cb,
584 item_data->stop_change_cb,
586 evas_object_pass_events_set(li_slider, 1);
587 evas_object_propagate_events_set(li_slider, 0);
588 item_data->eo_check = li_slider;
592 static Evas_Object *__add_datefield(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
594 retv_if(!item_data || !parent, NULL);
595 /* **********create time/date field */
596 Evas_Object *datetimefield = item_data->eo_check = elm_datetime_add(parent);
597 evas_object_size_hint_weight_set(datetimefield, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
598 evas_object_size_hint_align_set(datetimefield, EVAS_HINT_FILL, 0.5);
599 evas_object_show(datetimefield);
601 char date_format[MAX_DATETIME_FORMAT_LEN + 1] = {0, };
602 const char *time_format = NULL;
603 if (item_data->chk_status)//12 hours
605 time_format = "%I : %M %p";
607 time_format = "%H : %M";
610 #if SUPPORT_DATEFIELD_DATE_FORMAT_AUTOSET //Get date-format from datefiled itself, if elm_datetime_add() supports set date-format via ICU.
611 char *old_format = elm_datetime_format_get(datetimefield);
612 snprintf(date_format, MAX_DATE_FORMAT_LEN + 1, //add one space " "
614 safeStrNCat(date_format, time_format, MAX_DATETIME_FORMAT_LEN);
616 SETTING_TRACE("datefield_format:%s", date_format);
618 snprintf(date_format, MAX_DATETIME_FORMAT_LEN,
619 "%s %s", item_data->sub_desc, time_format);
621 elm_datetime_format_set(datetimefield, date_format);
623 // min : 1970 1, 01, Thursday 00:00:00
624 // max : 2038 1, 19, Thursday 03:14:07
626 memset(&ts_ret, 0, sizeof(struct tm));
627 ts_ret.tm_year = 138;
630 elm_datetime_value_max_set(datetimefield, &ts_ret);
635 elm_datetime_value_min_set(datetimefield, &ts_ret);
638 time_t ctime = time(NULL);
640 struct tm *ts = localtime_r(&ctime, &ts_ret);
643 elm_datetime_value_set(datetimefield, &ts_ret);
645 if (item_data->chk_change_cb) {
646 evas_object_smart_callback_add(datetimefield,
648 item_data->chk_change_cb,
652 if (item_data->isItemDisableFlag) {
653 setting_disable_evas_object(datetimefield);
655 return datetimefield;
657 static Evas_Object *__add_radio_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
659 retv_if(!item_data || !parent, NULL);
660 Evas_Object *box = elm_box_add(parent);
661 elm_box_horizontal_set(box, 1);
664 Evas_Object *radio = __add_radio(item_data, parent);
665 setting_disable_evas_object(radio);
666 elm_box_pack_end(box, radio);
669 Evas_Object *separator =
670 setting_create_blank_rect_customize(box,
671 SETTING_HALF_SCREEN_WIDTH,
672 SETTING_PADDING_HEIGHT);
673 elm_box_pack_end(box, separator);
676 Evas_Object *progressbar = elm_progressbar_add(parent);
677 elm_object_style_set(progressbar, "list_process");
678 evas_object_size_hint_align_set(progressbar,
679 EVAS_HINT_FILL, 0.5);
680 evas_object_size_hint_weight_set(progressbar,
683 elm_progressbar_pulse(progressbar, EINA_TRUE);
684 evas_object_show(progressbar);
685 elm_box_pack_end(box, progressbar);
687 evas_object_show(box);
690 static Evas_Object *__add_search(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
692 retv_if(!item_data || !parent, NULL);
693 // added by JTS: CQ H0100135171
694 Evas_Object *box = elm_box_add(parent);
695 elm_box_horizontal_set(box, 1);
698 Evas_Object *separator =
699 setting_create_blank_rect_customize(box,
700 SETTING_HALF_SCREEN_WIDTH, SETTING_PADDING_HEIGHT);
701 elm_box_pack_end(box, separator);
704 Evas_Object *progressbar = elm_progressbar_add(parent);
705 elm_object_style_set(progressbar, "list_process");
706 evas_object_size_hint_align_set(progressbar, EVAS_HINT_FILL, 0.5);
707 evas_object_size_hint_weight_set(progressbar,
708 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
709 elm_progressbar_pulse(progressbar, EINA_TRUE);
710 evas_object_show(progressbar);
711 elm_box_pack_end(box, progressbar);
713 evas_object_show(box);
717 static Evas_Object *__add_process(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
719 retv_if(!item_data || !parent, NULL);
720 Evas_Object *progressbar = elm_progressbar_add(parent);
721 elm_object_style_set(progressbar, "list_process");
722 evas_object_size_hint_align_set(progressbar,
723 EVAS_HINT_FILL, 0.5);
724 evas_object_size_hint_weight_set(progressbar,
727 elm_progressbar_pulse(progressbar, EINA_TRUE);
728 evas_object_show(progressbar);
732 static Evas_Object *__add_radio_lable(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
734 retv_if(!item_data || !parent, NULL);
737 Evas_Object *radio = __add_radio(item_data, parent);
742 static Evas_Object *__add_left_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
744 retv_if(!item_data || !parent || !item_data->l_swallow_path, NULL);
745 Evas_Object *icon = elm_icon_add(parent);
746 elm_icon_file_set(icon, item_data->l_swallow_path,NULL);
747 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
750 static Evas_Object *__add_right_default(Setting_GenGroupItem_Data *item_data, Evas_Object *parent)
752 retv_if(!item_data || !parent || !item_data->r_swallow_path, NULL);
753 Evas_Object *icon = elm_icon_add(parent);
754 elm_icon_file_set(icon, item_data->r_swallow_path,NULL);
755 evas_object_size_hint_aspect_set(icon,EVAS_ASPECT_CONTROL_VERTICAL,1, 1);
760 typedef Evas_Object * (*__drawer_fp)(Setting_GenGroupItem_Data *item_data, Evas_Object *parent);
763 SWALLOW_Type type; // ui type
766 static __Content_Drawer __cd_left[SWALLOW_Type_MAX] = {
768 {SWALLOW_Type_1CHECK, __add_check},
769 {SWALLOW_Type_1TOGGLE, __add_toggle},
770 {SWALLOW_Type_1RADIO, __add_radio},
771 {SWALLOW_Type_1BUTTON, __add_button},
773 //base objects in an layout
774 {SWALLOW_Type_LAYOUT_ENTRY, __add_entry},
775 {SWALLOW_Type_LAYOUT_SLIDER, __add_slider},
776 {SWALLOW_Type_LAYOUT_DATEFIELD, __add_datefield},
778 //other compelx objects
779 {SWALLOW_Type_1SEARCH, __add_search},
780 {SWALLOW_Type_1PROCESS, __add_process},
781 {SWALLOW_Type_MULTILINE_1TOGGLE, __add_multiline_toggle},
782 {SWALLOW_Type_1CHECKICON, __add_check_icon},
783 {SWALLOW_Type_1RADIO_1SEARCH, __add_radio_search},
784 {SWALLOW_Type_1RADIO_1LABLE, __add_radio_lable},
786 //left part object of the type
787 {SWALLOW_Type_1ICON_1RADIO, __add_left_default},
788 {SWALLOW_Type_1RADIO_1PROCESS, __add_radio},
790 static __Content_Drawer __cd_right[SWALLOW_Type_MAX] = {
791 //right part object of the type
792 {SWALLOW_Type_1ICON_1RADIO, __add_toggle},
793 {SWALLOW_Type_1RADIO_1PROCESS, __add_process},
796 static __Content_Drawer __cd_end[SWALLOW_Type_MAX] = {
797 //end part object of the type
798 {SWALLOW_Type_1RADIO, __add_radio},
800 /*static __Part_Drawer __pd[__MAX_PART_NUM] = {
801 {"elm.icon", __cd_left},
802 {"elm.icon.1", __cd_left},
803 {"elm.icon.2", __cd_right},
804 {"elm.swallow.end", __cd_end},
807 static Evas_Object *_gl_Gendial_content_get(void *data, Evas_Object *obj,
810 retv_if(!data, NULL);
811 Setting_GenGroupItem_Data *item_data = data;
812 retv_if(!data, NULL);
813 __Content_Drawer *cd_list = NULL;
814 __drawer_fp fp = NULL;
815 if (!safeStrCmp(part, "elm.icon") || !safeStrCmp(part, "elm.icon.1"))
817 fp = __add_left_default; //hold default drawer
820 else if (!safeStrCmp(part, "elm.icon.2"))
822 fp = __add_right_default; //hold default drawer
823 cd_list = __cd_right;
825 else if (!safeStrCmp(part, "elm.swallow.end"))
827 //the default value of fp is NULL here
830 if (!cd_list) return NULL;//invalid part
833 for (; idx < SWALLOW_Type_MAX; idx++)
835 if (item_data->swallow_type == cd_list[idx].type)//match using swallow type
837 fp = cd_list[idx].draw;
841 return fp ? fp(item_data, obj) : NULL;
844 static void _gl_Gendial_del(void *data, Evas_Object *obj)
846 /* SETTING_TRACE_BEGIN; */
847 Setting_GenGroupItem_Data *item_data =
848 (Setting_GenGroupItem_Data *) data;
850 G_FREE(item_data->keyStr);
851 G_FREE(item_data->sub_desc);
852 G_FREE((item_data->l_swallow_path));
853 G_FREE((item_data->r_swallow_path));
854 G_FREE(item_data->item_style);
857 if (item_data->digits_filter_data)
859 G_FREE(item_data->digits_filter_data->accepted);
860 G_FREE(item_data->digits_filter_data->rejected);
861 FREE(item_data->digits_filter_data);
865 if (item_data->notify) {
866 evas_object_del(item_data->notify);
867 item_data->notify = NULL;
870 FREE(item_data->limit_filter_data);
871 __BACK_POINTER_UNSET(item_data);
874 /* SETTING_TRACE_END; */
878 * To intialize an Elm_Genlist_Item_Class, according to item style
880 * @param[in] item_style
883 bool setting_create_Gendial_itc(const char *item_style,
884 Elm_Genlist_Item_Class *itc)
886 itc->item_style = item_style;
887 itc->func.text_get = _gl_Gendial_text_get;
888 itc->func.content_get = _gl_Gendial_content_get;
889 itc->func.state_get = NULL;
890 itc->func.del = _gl_Gendial_del; /* _gl_Gendial_del; */
895 * Create group style item
897 * @return a pointer to Setting_GenGroupItem_Data
899 Setting_GenGroupItem_Data *setting_create_Gendial_field_group_titleItem(Evas_Object *genlist,
900 const Elm_Genlist_Item_Class *itc,
901 Elm_Object_Item *parent,
902 Elm_Genlist_Item_Type flag, /* ELM_GENLIST_ITEM_GROUP or ELM_GENLIST_ITEM_NONE */
904 setting_call_back_func gl_sel)
906 /* SETTING_TRACE_BEGIN; */
907 Setting_GenGroupItem_Data *item_data =
908 (Setting_GenGroupItem_Data *) calloc(1,
910 (Setting_GenGroupItem_Data));
911 setting_retvm_if(!item_data, NULL, "calloc failed");
912 item_data->keyStr = (char *)g_strdup(keyStr);
915 elm_genlist_item_append(genlist, itc, item_data, parent,
919 elm_genlist_item_append(genlist, itc, item_data, parent,
920 flag, _gl_Gendial_sel, NULL);
926 * Create separator style item with title
928 * @return a pointer to Setting_GenGroupItem_Data
930 Setting_GenGroupItem_Data *setting_create_Gendial_field_titleItem(
931 Evas_Object *genlist,
932 const Elm_Genlist_Item_Class *itc,
934 setting_call_back_func gl_sel)
936 /* SETTING_TRACE_BEGIN; */
937 Setting_GenGroupItem_Data *item_data =
938 (Setting_GenGroupItem_Data *) calloc(1,
940 (Setting_GenGroupItem_Data));
941 setting_retvm_if(!item_data, NULL, "calloc failed");
942 item_data->keyStr = (char *)g_strdup(keyStr);
945 elm_genlist_item_append(genlist, itc, item_data, NULL,
946 ELM_GENLIST_ITEM_NONE, gl_sel,
950 elm_genlist_item_append(genlist, itc, item_data, NULL,
951 ELM_GENLIST_ITEM_NONE,
952 _gl_Gendial_sel, NULL);
958 * Create 1radio-1text style item
960 * @return a pointer to Setting_GenGroupItem_Data
963 Setting_GenGroupItem_Data *setting_create_Gendial_field_1radio(
964 Evas_Object *genlist,
965 const Elm_Genlist_Item_Class *itc,
966 setting_call_back_func gl_sel,
968 SWALLOW_Type swallow_type,
969 Evas_Object *rgd, int chk_status,
971 setting_call_back_func chk_change_cb)
973 /* SETTING_TRACE_BEGIN; */
974 Setting_GenGroupItem_Data *item_data =
975 (Setting_GenGroupItem_Data *) calloc(1,
977 (Setting_GenGroupItem_Data));
978 setting_retvm_if(!item_data, NULL, "calloc failed");
979 item_data->keyStr = (char *)g_strdup(keyStr);
980 item_data->swallow_type = swallow_type;
981 item_data->chk_status = chk_status;
982 item_data->chk_change_cb = chk_change_cb;
983 item_data->rgd = rgd;
987 elm_genlist_item_append(genlist, itc, item_data, NULL,
988 ELM_GENLIST_ITEM_NONE, gl_sel,
992 elm_genlist_item_append(genlist, itc, item_data, NULL,
993 ELM_GENLIST_ITEM_NONE,
994 _gl_Gendial_sel, sel_data);
999 Setting_GenGroupItem_Data *setting_create_Gendial_field_2radio(
1000 Evas_Object *genlist,
1001 const Elm_Genlist_Item_Class *itc,
1002 setting_call_back_func gl_sel,
1004 SWALLOW_Type swallow_type,
1005 Evas_Object *rgd, int chk_status,
1007 const char *sub_desc,
1008 setting_call_back_func chk_change_cb)
1010 /* SETTING_TRACE_BEGIN; */
1011 Setting_GenGroupItem_Data *item_data =
1012 (Setting_GenGroupItem_Data *) calloc(1,
1014 (Setting_GenGroupItem_Data));
1015 setting_retvm_if(!item_data, NULL, "calloc failed");
1016 item_data->keyStr = (char *)g_strdup(keyStr);
1017 item_data->sub_desc = (char *)g_strdup(sub_desc);
1018 item_data->swallow_type = swallow_type;
1019 item_data->chk_status = chk_status;
1020 item_data->chk_change_cb = chk_change_cb;
1021 item_data->rgd = rgd;
1025 elm_genlist_item_append(genlist, itc, item_data, NULL,
1026 ELM_GENLIST_ITEM_NONE, gl_sel,
1030 elm_genlist_item_append(genlist, itc, item_data, NULL,
1031 ELM_GENLIST_ITEM_NONE,
1032 _gl_Gendial_sel, sel_data);
1038 * Create common style item with menu icon
1040 * @return a pointer to Setting_GenGroupItem_Data
1042 Setting_GenGroupItem_Data *setting_create_Gendial_field_groupitem(
1043 Evas_Object *genlist,
1044 const Elm_Genlist_Item_Class *itc,
1045 Elm_Object_Item *parent,
1046 setting_call_back_func gl_sel,
1048 SWALLOW_Type swallow_type,
1050 char *r_icon_path, int chk_status,
1051 const char *keyStr, char *sub_desc,
1052 setting_call_back_func
1055 // SETTING_TRACE_BEGIN;
1056 Setting_GenGroupItem_Data *item_data = (
1057 Setting_GenGroupItem_Data *) calloc(1, sizeof(Setting_GenGroupItem_Data));
1058 setting_retvm_if(!item_data, NULL, "calloc failed");
1060 /* to do formatting customizition in one place */
1061 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type
1062 || SWALLOW_Type_LAYOUT_SPECIALIZTION_X == swallow_type) {
1063 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
1065 char speciliztion[MAX_SPECIALIZITION_LEN] = { 0, };
1066 char* temp1 = (char *)keyStr;
1067 char*temp2 = strchr(temp1, '&');
1070 while (NULL != temp2) {
1071 if (0 == safeStrNCmp(temp2, "&", strlen("&")) ||//'&'
1072 0 == safeStrNCmp(temp2, "<", strlen("<")) ||//'<'
1073 0 == safeStrNCmp(temp2, ">", strlen(">")) ||//'>'
1074 0 == safeStrNCmp(temp2, """, strlen(""")) ||//double quotes
1075 0 == safeStrNCmp(temp2, "'", strlen("'")) ||//single quotes
1076 0 == safeStrNCmp(temp2, " ", strlen(" ")) ||//space character
1077 0 == safeStrNCmp(temp2, "©", strlen("©")) ||//copyright character
1078 0 == safeStrNCmp(temp2, "®", strlen("®"))//registeration character
1079 ) {//escape character,do nothing
1081 if ('\0' == temp[0]) break;
1082 temp2 = strchr(temp, '&');
1086 g_strlcat(speciliztion, temp1, temp2 - temp1 +1);
1087 g_strlcat(speciliztion, "&", MAX_SPECIALIZITION_LEN);
1089 if ('\0' == temp1[0]) break;
1090 temp2 = strchr(temp1, '&');
1093 if ('\0' != temp1[0]) {
1094 g_strlcat(speciliztion, temp1, MAX_SPECIALIZITION_LEN);
1098 item_data->keyStr = (char *)g_strdup(speciliztion);
1100 item_data->keyStr = (char *)g_strdup(keyStr);
1103 item_data->sub_desc = (char *)g_strdup(sub_desc);
1104 item_data->swallow_type = swallow_type;
1105 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1106 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1107 item_data->chk_status = chk_status;
1108 item_data->chk_change_cb = chk_change_cb;
1112 elm_genlist_item_append(genlist, itc, item_data, parent,
1113 ELM_GENLIST_ITEM_NONE, gl_sel,
1117 elm_genlist_item_append(genlist, itc, item_data, parent,
1118 ELM_GENLIST_ITEM_NONE,
1119 _gl_Gendial_sel, sel_data);
1121 if (SWALLOW_Type_LAYOUT_SPECIALIZTION == swallow_type) {
1122 Elm_Object_Item *item = elm_genlist_item_append(genlist,
1125 ELM_GENLIST_ITEM_NONE,
1127 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1128 //Fix the separator line disappear issue when clicking "SPECIALIZTION" words in new HD theme
1129 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1136 * Common function to create a genlist item
1137 * @return a pointer to Setting_GenGroupItem_Data
1139 Setting_GenGroupItem_Data *setting_create_Gendial_field_def(Evas_Object *
1141 const Elm_Genlist_Item_Class *itc,
1142 setting_call_back_func
1152 setting_call_back_func chk_change_cb)
1154 return setting_create_Gendial_field_groupitem(genlist, itc, NULL,
1156 swallow_type, l_icon_path,
1157 r_icon_path, chk_status,
1163 * Create 1entry style item
1164 * @return a pointer to Setting_GenGroupItem_Data
1166 Setting_GenGroupItem_Data *setting_create_Gendial_field_entry(Evas_Object *
1168 const Elm_Genlist_Item_Class *itc,
1169 setting_call_back_func gl_sel,
1178 setting_call_back_func
1180 Elm_Input_Panel_Layout
1182 bool isPasswordFlag,
1189 /* SETTING_TRACE_BEGIN; */
1190 Setting_GenGroupItem_Data *item_data = (Setting_GenGroupItem_Data *) calloc(1,
1191 sizeof (Setting_GenGroupItem_Data));
1192 setting_retvm_if(!item_data, NULL, "calloc failed");
1193 item_data->keyStr = (char *)g_strdup(keyStr);
1194 item_data->sub_desc = (char *)g_strdup(sub_desc);
1195 item_data->swallow_type = swallow_type;
1196 item_data->l_swallow_path = (char *)g_strdup(l_icon_path);
1197 item_data->r_swallow_path = (char *)g_strdup(r_icon_path);
1198 item_data->chk_status = chk_status;
1199 item_data->chk_change_cb = chk_change_cb;
1201 item_data->input_type = input_type;
1202 item_data->isPasswordFlag = isPasswordFlag;
1203 item_data->isFocusFlag = isFocusFlag;
1205 Elm_Entry_Filter_Accept_Set *digits_filter_data =
1206 (Elm_Entry_Filter_Accept_Set *) calloc(1, sizeof (Elm_Entry_Filter_Accept_Set));
1207 if(!digits_filter_data) {
1208 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Accept_Set failed");
1209 // free allocated data
1210 G_FREE(item_data->keyStr);
1211 G_FREE(item_data->sub_desc);
1212 G_FREE(item_data->l_swallow_path);
1213 G_FREE(item_data->r_swallow_path);
1219 Elm_Entry_Filter_Limit_Size *limit_filter_data =
1220 (Elm_Entry_Filter_Limit_Size *) calloc(1, sizeof (Elm_Entry_Filter_Limit_Size));
1221 if(!limit_filter_data) {
1222 SETTING_TRACE_ERROR("calloc Elm_Entry_Filter_Limit_Size 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);
1230 FREE(digits_filter_data);
1234 limit_filter_data->max_char_count = max_char_count;
1235 limit_filter_data->max_byte_count = max_byte_count;
1236 digits_filter_data->accepted = (char *)g_strdup(accepted);
1237 digits_filter_data->rejected = (char *)g_strdup(rejected);
1239 item_data->digits_filter_data = digits_filter_data;
1240 item_data->limit_filter_data = limit_filter_data;
1241 item_data->userdata = sel_data;
1245 elm_genlist_item_append(genlist, itc, item_data, NULL,
1246 ELM_GENLIST_ITEM_NONE, gl_sel,
1250 elm_genlist_item_append(genlist, itc, item_data, NULL,
1251 ELM_GENLIST_ITEM_NONE,
1252 _gl_Gendial_sel, sel_data);
1258 * General function to create a parent item of expandable item
1260 * @return a pointer to Setting_GenGroupItem_Data
1262 Setting_GenGroupItem_Data *setting_create_Gendial_exp_parent_field(
1263 Evas_Object *genlist,
1264 const Elm_Genlist_Item_Class *itc,
1265 setting_call_back_func gl_sel,
1267 SWALLOW_Type swallow_type,
1271 /* SETTING_TRACE_BEGIN; */
1272 Setting_GenGroupItem_Data *item_data =
1273 (Setting_GenGroupItem_Data *) calloc(1,
1275 (Setting_GenGroupItem_Data));
1276 setting_retvm_if(!item_data, NULL, "calloc failed");
1277 item_data->keyStr = (char *)g_strdup(keyStr);
1278 item_data->sub_desc = (char *)g_strdup(sub_desc);
1279 item_data->swallow_type = swallow_type;
1280 item_data->childs = NULL;
1284 elm_genlist_item_append(genlist, itc, item_data, NULL,
1285 ELM_GENLIST_ITEM_TREE, gl_sel,
1289 elm_genlist_item_append(genlist, itc, item_data, NULL,
1290 ELM_GENLIST_ITEM_TREE,
1291 _gl_Gendial_sel_expand, sel_data);
1297 * General function to create a subitem of expandable item
1299 * @return a pointer to Setting_GenGroupItem_Data
1301 Setting_GenGroupItem_Data *setting_create_Gendial_exp_sub_field(
1302 Evas_Object *genlist,
1303 const Elm_Genlist_Item_Class *itc,
1304 setting_call_back_func gl_sel,
1306 Elm_Object_Item *parent,
1307 SWALLOW_Type swallow_type,
1308 Evas_Object *rgd, int chk_status,
1310 setting_call_back_func
1313 /* SETTING_TRACE_BEGIN; */
1314 Setting_GenGroupItem_Data *item_data =
1315 (Setting_GenGroupItem_Data *) calloc(1,
1317 (Setting_GenGroupItem_Data));
1318 setting_retvm_if(!item_data, NULL, "calloc failed");
1319 item_data->keyStr = (char *)g_strdup(keyStr);
1320 item_data->swallow_type = swallow_type;
1321 item_data->chk_status = chk_status;
1322 item_data->rgd = rgd;
1325 gl_sel = setting_sub_list_sel_cb;
1327 if (!chk_change_cb) {
1328 chk_change_cb = setting_sub_list_rd_change;
1331 item_data->chk_change_cb = chk_change_cb;
1333 elm_genlist_item_append(genlist, itc, item_data, parent,
1334 ELM_GENLIST_ITEM_NONE, gl_sel, sel_data);
1339 * To make genlist support expandable style item
1341 void setting_enable_expandable_genlist(Evas_Object *genlist, void *data,
1342 setting_call_back_func gl_exp_cb,
1343 setting_call_back_func gl_smart_cb)
1345 ret_if(NULL == genlist);
1346 elm_genlist_tree_effect_enabled_set(genlist, TRUE);
1348 gl_smart_cb = __exp_list_smart_cb;
1352 evas_object_smart_callback_add(genlist, "expanded", gl_exp_cb, data);
1353 evas_object_smart_callback_add(genlist, "contracted", gl_smart_cb, "contracted");
1355 evas_object_smart_callback_add(genlist, "drag", gl_smart_cb, "drag");
1356 evas_object_smart_callback_add(genlist, "longpressed", gl_smart_cb, "longpressed");
1362 setting_create_Gendial_itc("dialogue/1text.2icon.2",
1363 &(networkUG->itc_1text_2icon));
1365 1. create a process genlist item : [intial state is 'PROCESS']
1366 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1367 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1368 SWALLOW_Type_1RADIO_1PROCESS,
1369 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1370 "Searching..", NULL);
1371 or [intial state is 'UNPROCESS']
1372 ad->data_searching_net = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_2icon),
1373 setting_network_select_network_mouse_up_Gendial_list_radio_cb, ad,
1374 SWALLOW_Type_1RADIO,
1375 ad->chk_sel, TAPI_NETWORK_SELECTIONMODE_MANUAL,
1376 "Searching..", NULL);
1378 2. to set the PROCESS state at any place as you like:
1379 setting_begin_progress_genlist_item(ad->data_searching_net); -- change from UNPROCESS->PROCESS
1380 setting_finish_progress_genlist_item(ad->data_searching_net);--change from PROCESS->UNPROCESS
1382 void setting_begin_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1385 if (SWALLOW_Type_1RADIO != data_item->swallow_type) {
1389 data_item->swallow_type = SWALLOW_Type_1RADIO_1PROCESS;
1390 elm_object_item_data_set(data_item->item, data_item);
1391 elm_genlist_item_update(data_item->item);
1395 void setting_finish_progress_genlist_item(Setting_GenGroupItem_Data *data_item)
1398 if (SWALLOW_Type_1RADIO_1PROCESS != data_item->swallow_type) {
1401 data_item->swallow_type = SWALLOW_Type_1RADIO;
1402 elm_object_item_data_set(data_item->item, data_item);
1403 elm_genlist_item_update(data_item->item);
1408 * Check if some item is selected in done-list
1411 bool setting_done_list_is_some_item_selected(Setting_Done_List_Data *list_data)
1413 SETTING_TRACE_BEGIN;
1414 bool isFound = FALSE; /* wether can found some item checked */
1417 for (; idx < list_data->cur_item_num; idx++) {
1419 elm_check_state_get(list_data->chk_items[idx].
1420 data_GenItem->eo_check);
1429 static void __setting_done_list_item_sel(void *data)
1431 SETTING_TRACE_BEGIN;
1432 retm_if(data == NULL, "data == NULL");
1433 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1438 setting_create_sel_info_popup(list_data->ly_parent,
1439 &(list_data->selInfoPop_layout),
1440 &(list_data->selInfoPop));
1442 /* else for other checks, do rotinue checking */
1443 bool isFound = FALSE; /* wether found the item not checked */
1444 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1445 if (!list_data->chk_items[idx].data_GenItem->chk_status) {
1446 /* SETTING_TRACE("%s not select", _(list_data->chk_items[idx].item_name)); */
1450 /* SETTING_TRACE("%s select", _(list_data->chk_items[idx].item_name)); */
1455 if (isFound) { /* reset state of chk_sel_all */
1456 list_data->select_all_checked = 0;
1457 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1459 list_data->select_all_checked = 1;
1460 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1463 /* SETTING_TRACE("sel_num:%d", sel_num); */
1465 Elm_Object_Item *button = elm_toolbar_first_item_get(list_data->controllbar);
1466 elm_object_item_disabled_set(button, EINA_TRUE);
1467 evas_object_hide(list_data->selInfoPop);
1470 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1471 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1473 /* text set and timeout set */
1474 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1476 Elm_Object_Item *button = elm_toolbar_first_item_get(list_data->controllbar);
1477 elm_object_item_disabled_set(button, EINA_FALSE);
1481 * Do process when clicking the check object in the done-list item
1483 void setting_done_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
1486 SETTING_TRACE_BEGIN;
1488 retm_if(data == NULL, "Data parameter is NULL");
1489 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1492 list_item->chk_status = elm_check_state_get(list_item->eo_check);
1494 Setting_Done_List_Data *list_data = list_item->userdata;
1495 __setting_done_list_item_sel(list_data);
1498 static void setting_done_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
1502 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1503 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1504 elm_genlist_item_selected_set(item, 0);
1505 Setting_GenGroupItem_Data *list_item =
1506 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1508 int old_status = elm_check_state_get(list_item->eo_check);
1510 list_item->chk_status = !old_status;
1511 elm_check_state_set(list_item->eo_check, list_item->chk_status);
1513 /* other process.. */
1514 Setting_Done_List_Data *list_data = list_item->userdata;
1515 __setting_done_list_item_sel(list_data);
1518 static void __setting_select_all_done(void *data)
1520 SETTING_TRACE_BEGIN;
1521 retm_if(data == NULL, "data == NULL");
1522 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1527 setting_create_sel_info_popup(list_data->ly_parent,
1528 &(list_data->selInfoPop_layout),
1529 &(list_data->selInfoPop));
1531 if (list_data->select_all_checked) {
1532 /* set all other checks state to be 1 */
1533 SETTING_TRACE_DEBUG("Select All checked");
1534 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1535 list_data->chk_items[idx].data_GenItem->chk_status = 1;
1536 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items [idx].data_GenItem);
1537 elm_genlist_item_update(list_data->chk_items [idx].data_GenItem->item);
1539 sel_num = list_data->cur_item_num;
1541 SETTING_TRACE_DEBUG("Select All unchecked");
1542 /* set all other checks state to be 0 */
1543 for (idx = 0; idx < list_data->cur_item_num; idx++) {
1544 list_data->chk_items[idx].data_GenItem->chk_status = 0;
1545 elm_object_item_data_set(list_data->chk_items[idx].data_GenItem->item, list_data->chk_items[idx].data_GenItem);
1546 elm_genlist_item_update(list_data->chk_items[idx].data_GenItem->item);
1551 /* SETTING_TRACE("sel_num:%d", sel_num); */
1553 Elm_Object_Item *button = elm_toolbar_first_item_get(list_data->controllbar);
1554 elm_object_item_disabled_set(button, EINA_TRUE);
1555 evas_object_hide(list_data->selInfoPop);
1558 char text[MAX_DISPLAY_NAME_LEN_ON_UI +1] = {0, };
1559 snprintf(text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s(%d)", _("IDS_ST_OPT_SELECTED"), sel_num);
1561 /* text set and timeout set */
1562 edje_object_part_text_set(_EDJ(list_data->selInfoPop_layout), "elm.text", text);
1563 Elm_Object_Item *button = elm_toolbar_first_item_get(list_data->controllbar);
1564 elm_object_item_disabled_set(button, EINA_FALSE);
1567 static void __setting_select_all_layout_mouse_down_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
1569 SETTING_TRACE_BEGIN;
1570 retm_if(data == NULL, "data == NULL");
1571 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1573 list_data->select_all_checked = !list_data->select_all_checked;
1574 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1576 __setting_select_all_done(list_data);
1579 static void __setting_select_all_check_changed_cb(void *data, Evas_Object *obj, void *event_info)
1581 SETTING_TRACE_BEGIN;
1582 retm_if(data == NULL, "data == NULL");
1583 Setting_Done_List_Data *list_data = (Setting_Done_List_Data *)data;
1585 list_data->select_all_checked = elm_check_state_get(list_data->select_all_checkbox);
1586 elm_check_state_pointer_set(list_data->select_all_checkbox, &list_data->select_all_checked);
1587 __setting_select_all_done(data);
1591 * The API to create done-list.
1593 * @param[in] list_data
1594 * @return a done-list
1596 Evas_Object *setting_create_done_list(Setting_Done_List_Data *list_data)
1598 SETTING_TRACE_BEGIN;
1599 retvm_if(list_data == NULL, NULL, "list_data == NULL");
1600 Evas_Object *sub_layout = elm_layout_add(list_data->win_main);
1601 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1602 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1603 evas_object_show(sub_layout);
1605 setting_create_Gendial_itc("1text.1icon.2", &(list_data->itc_1text_1icon));
1607 Evas_Object *select_all_layout = elm_layout_add(sub_layout);
1608 retvm_if(select_all_layout == NULL, NULL, "select_all_layout == NULL");
1609 elm_layout_theme_set(select_all_layout, "genlist", "item", "select_all/default");
1610 evas_object_size_hint_weight_set(select_all_layout, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
1611 evas_object_size_hint_align_set(select_all_layout, EVAS_HINT_FILL, EVAS_HINT_FILL);
1612 evas_object_event_callback_add(select_all_layout, EVAS_CALLBACK_MOUSE_DOWN, __setting_select_all_layout_mouse_down_cb, list_data);
1614 Eina_Bool select_all_checked = list_data->select_all_checked;
1615 Evas_Object *select_all_checkbox = elm_check_add(select_all_layout);
1616 elm_check_state_pointer_set(select_all_checkbox, &select_all_checked);
1617 evas_object_smart_callback_add(select_all_checkbox, "changed", __setting_select_all_check_changed_cb, list_data);
1618 evas_object_propagate_events_set(select_all_checkbox, EINA_FALSE);
1619 elm_object_part_content_set(select_all_layout, "elm.icon", select_all_checkbox);
1621 list_data->select_all_checkbox = select_all_checkbox;
1622 elm_object_part_text_set(select_all_layout, "elm.text", _(KeyStr_Select_All));
1624 Evas_Object *scroller = elm_genlist_add(list_data->win_main);
1625 retvm_if(scroller == NULL, NULL, "scroller == NULL");
1626 elm_genlist_clear(scroller); /* first to clear list */
1628 elm_object_part_content_set(sub_layout, "search_list", scroller);
1629 elm_object_part_content_set(sub_layout, "search_bar", select_all_layout);
1632 for (; index < list_data->cur_item_num; index++) {
1633 list_data->chk_items[index].data_GenItem =
1634 setting_create_Gendial_field_def(scroller,
1635 &(list_data->itc_1text_1icon),
1636 setting_done_list_Gendial_mouse_up_cb,
1638 SWALLOW_Type_1CHECK, NULL,
1640 list_data->chk_items
1641 [index].item_name, NULL,
1642 setting_done_list_Gendial_chk_btn_cb);
1643 if (list_data->chk_items[index].data_GenItem) {
1644 list_data->chk_items[index].data_GenItem->userdata = list_data;
1646 SETTING_TRACE_ERROR("list_data->chk_items[index].data_GenItem is NULL");
1655 * To disable a specialized genlist item
1659 void setting_disable_genlist_item(Elm_Object_Item *item)
1662 elm_object_item_disabled_set(item, EINA_TRUE); /* make it be dim displayed */
1667 * To enable a specialized genlist item
1671 void setting_enable_genlist_item(Elm_Object_Item *item)
1674 elm_object_item_disabled_set(item, EINA_FALSE); /* make it be normally displayed */