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.
22 #include <tapi_common.h>
26 #include <setting-main.h>
27 #include <setting-plugin.h>
29 #include <bluetooth.h>
32 #define PLUGIN_PREFIX "/opt"
34 typedef struct _DrawAppInfo
37 //------------------------------------
38 void (*draw_app)(void* arg, char* name, char* pkgname);
42 static int setting_main_create(void *cb);
43 static int setting_main_destroy(void *cb);
44 static int setting_main_update(void *cb);
45 static int setting_main_cleanup(void *cb);
47 setting_view setting_view_main = {
48 .create = setting_main_create,
49 .update = setting_main_update,
50 .destroy = setting_main_destroy,
51 .cleanup = setting_main_cleanup,
54 setting_main_appdata *g_main_ad = NULL;
56 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data);
57 static int setting_main_refresh(void *data);
58 static void __alternate_flight_mode(Evas_Object *check);
59 static void setting_main_click_Gendial_list_flight_mode_cb(void *data,
62 static void __alternate_flight_mode(Evas_Object *check);
64 void setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj, char *ug_to_load, service_h svc, struct ug_cbs *cbs);
67 __setting_chk_changed(void *data, Evas_Object *obj, void *event_info)
69 /* SETTING_TRACE_BEGIN; */
70 retm_if(data == NULL, "Data parameter is NULL");
71 Setting_GenGroupItem_Data *list_item =
72 (Setting_GenGroupItem_Data *) data;
73 /* SETTING_TRACE("process item [%s]", _(list_item->keyStr)); */
74 list_item->chk_status = elm_check_state_get(obj);
76 Eina_List *check_list = g_main_ad->item_check_list;
77 Setting_GenGroupItem_Data *item = NULL;
78 bool isFoundNotSelSomeone = FALSE;
79 bool isFoundSelSomeone = FALSE;
81 item = (Setting_GenGroupItem_Data *)
82 eina_list_data_get(check_list);
86 if (!(item->chk_status)) {
87 isFoundNotSelSomeone = TRUE;
89 isFoundSelSomeone = TRUE;
91 if (isFoundNotSelSomeone && isFoundSelSomeone) {
94 check_list = eina_list_next(check_list);
97 if (isFoundNotSelSomeone) {
98 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
100 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
102 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
103 elm_genlist_item_update(g_main_ad->check_all_item->item);
105 if (isFoundSelSomeone) {
106 /* SETTING_TRACE("Set it to active"); */
108 elm_object_item_disabled_set(elm_toolbar_last_item_get
109 (g_main_ad->controllbar_all_check),
114 static void __setting_list_changed(void *data, Evas_Object *obj,
120 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
122 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
123 elm_genlist_item_selected_set(item, 0);
124 Setting_GenGroupItem_Data *list_item =
125 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
127 int old_status = elm_check_state_get(list_item->eo_check);
129 list_item->chk_status = !old_status;
130 elm_check_state_set(list_item->eo_check, list_item->chk_status);
132 Eina_List *check_list = g_main_ad->item_check_list;
133 Setting_GenGroupItem_Data *group_item = NULL;
134 bool isFoundNotSelSomeone = FALSE;
135 bool isFoundSelSomeone = FALSE;
137 group_item = (Setting_GenGroupItem_Data *)
138 eina_list_data_get(check_list);
139 if (NULL == group_item) {
142 if (!(group_item->chk_status)) {
143 isFoundNotSelSomeone = TRUE;
146 isFoundSelSomeone = TRUE;
148 if (isFoundNotSelSomeone && isFoundSelSomeone) {
152 check_list = eina_list_next(check_list);
155 if (isFoundNotSelSomeone) {
156 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
158 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
160 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
161 elm_genlist_item_update(g_main_ad->check_all_item->item);
163 if (isFoundSelSomeone) {
164 /* SETTING_TRACE("Set it to active"); */
166 elm_object_item_disabled_set(elm_toolbar_last_item_get
167 (g_main_ad->controllbar_all_check),
174 __setting_chk_sel_all_changed(void *data, Evas_Object *obj, void *event_info)
176 /* SETTING_TRACE_BEGIN; */
177 retm_if(data == NULL, "Data parameter is NULL");
178 Setting_GenGroupItem_Data *list_item =
179 (Setting_GenGroupItem_Data *) data;
180 bool is_all_checked = elm_check_state_get(obj);
181 list_item->chk_status = is_all_checked; /* for update new state */
182 /* SETTING_TRACE("is_all_checked:%d", is_all_checked); */
184 Eina_List *check_list = g_main_ad->item_check_list;
187 list_item = (Setting_GenGroupItem_Data *)
188 eina_list_data_get(check_list);
189 if (NULL == list_item) {
192 list_item->chk_status = is_all_checked;
193 elm_object_item_data_set(list_item->item, list_item);
194 elm_genlist_item_update(list_item->item);
195 check_list = eina_list_next(check_list);
197 if (is_all_checked) {
199 elm_object_item_disabled_set(elm_toolbar_last_item_get
200 (g_main_ad->controllbar_all_check),
205 static void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
211 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
212 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
213 elm_genlist_item_selected_set(item, 0);
214 Setting_GenGroupItem_Data *list_item =
215 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
217 int old_status = elm_check_state_get(list_item->eo_check);
219 int is_all_checked = list_item->chk_status = !old_status;
220 elm_check_state_set(list_item->eo_check, list_item->chk_status);
222 Eina_List *check_list = g_main_ad->item_check_list;
225 list_item = (Setting_GenGroupItem_Data *)
226 eina_list_data_get(check_list);
227 if (NULL == list_item) {
230 list_item->chk_status = is_all_checked;
231 /* elm_check_state_set(list_item->eo_check, is_all_checked); */
232 elm_object_item_data_set(list_item->item, list_item);
233 elm_genlist_item_update(list_item->item);
234 check_list = eina_list_next(check_list);
236 if (is_all_checked) {
238 elm_object_item_disabled_set(elm_toolbar_last_item_get
239 (g_main_ad->controllbar_all_check),
245 static void __load_check_list(void *data, Evas_Object **genlist,
249 setting_main_appdata *ad = (setting_main_appdata *) data;
253 Cfg_Item_Position pos = Cfg_Item_Pos_Uninstall;
254 bool isFoundNonSelItem = FALSE;
255 bool isFoundSelSomeoneItem = FALSE;
258 char *icon_path = NULL;
261 setting_create_Gendial_field_def(ad->gl_sel_all,
262 &(ad->itc[GENDIAL_Type_sel_all]),
263 __setting_list_sel_all_changed, ad,
264 SWALLOW_Type_1CHECK, NULL, NULL,
265 state, KeyStr_Select_All, NULL,
266 __setting_chk_sel_all_changed);
267 __BACK_POINTER_SET(ad->check_all_item);
269 Setting_GenGroupItem_Data *item = NULL;
270 Setting_GenGroupItem_Data *category_item = NULL;
271 for (i = 0; i < setting_cfg_get_category_length(); i++) {
272 if (NULL == menuNameKey) {
273 /* SETTING_TRACE("load all the items in config file"); */
276 (setting_cfg_get_category_name(i), menuNameKey)) {
279 char *category_name = setting_cfg_get_category_name(i);
282 setting_create_Gendial_field_group_titleItem(*genlist,
284 [GENDIAL_Type_group_item]),
286 ELM_GENLIST_ITEM_NONE,
290 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
291 keyStr = setting_cfg_get_keyname_idx(i, j);
292 pos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
294 if (Cfg_Item_Pos_Level1 == pos) {
296 isFoundNonSelItem = TRUE;
299 isFoundSelSomeoneItem = TRUE;
302 icon_path = setting_cfg_get_icon_path_idx(i, j);
304 setting_create_Gendial_field_groupitem(*genlist,
306 [GENDIAL_Type_1text_2icon_2]),
308 __setting_list_changed,
310 SWALLOW_Type_1CHECKICON,
315 __setting_chk_changed);
317 ad->item_check_list =
318 eina_list_append(ad->item_check_list, item);
321 SETTING_TRACE_ERROR("category_item is NULL");
325 if (ad->check_all_item) {
326 if (isFoundNonSelItem) {
327 ad->check_all_item->chk_status = 0; /* for update new state */
329 ad->check_all_item->chk_status = 1; /* for update new state */
331 elm_object_item_data_set(ad->check_all_item->item, ad->check_all_item);
332 elm_genlist_item_update(ad->check_all_item->item);
334 SETTING_TRACE_ERROR("ad->check_all_item is NULL");
337 if (isFoundSelSomeoneItem) {
338 /* elm_object_item_disabled_set(elm_toolbar_last_item_get
339 (ad->controllbar_all_check),
344 elm_object_item_disabled_set(elm_toolbar_last_item_get
345 (ad->controllbar_all_check),
352 static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist)
354 // NOT UG --> it's just UI drawing
356 setting_main_appdata *ad = (setting_main_appdata *)data;
358 setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
360 /* create flight_mode */
361 ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
362 &(ad->itc[GENDIAL_Type_1text_2icon]),
364 setting_main_click_Gendial_list_flight_mode_cb,
366 SWALLOW_Type_1ICON_1RADIO,
372 setting_main_click_list_flight_mode_cb);
373 __BACK_POINTER_SET(ad->data_flight);
375 return ad->data_flight;
378 static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
380 setting_main_appdata *ad = (setting_main_appdata *)data;
382 setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
384 char* pa_wifi = get_pa_Wi_Fi_on_off_str();
385 ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
386 &(ad->itc[GENDIAL_Type_2text_2icon_3]),
388 setting_main_click_list_ex_ug_cb,
390 SWALLOW_Type_1ICON_1RADIO,
396 setting_main_click_list_wifi_mode_cb);
397 __BACK_POINTER_SET(ad->data_wifi);
400 return ad->data_wifi;
403 static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
405 setting_main_appdata *ad = (setting_main_appdata *)data;
407 setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
409 ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
410 &(ad->itc[GENDIAL_Type_2text_2icon_3]),
412 setting_main_click_list_ex_ug_cb,
414 SWALLOW_Type_1ICON_1RADIO,
421 setting_main_click_list_bt_mode_cb);
422 __BACK_POINTER_SET(ad->data_bt);
427 static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
429 setting_main_appdata *ad = (setting_main_appdata *)data;
431 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
432 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
434 setting_main_click_list_default_ug_cb,
436 SWALLOW_Type_INVALID,
445 static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
447 setting_main_appdata *ad = (setting_main_appdata *)data;
449 ad->data_network = setting_create_Gendial_field_groupitem(genlist,
450 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
452 setting_main_click_list_network_ug_cb,
454 SWALLOW_Type_INVALID,
461 return ad->data_network;
464 static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
466 setting_main_appdata *ad = (setting_main_appdata *)data;
469 setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
471 ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
472 &(ad->itc[GENDIAL_Type_2text_2icon_3]),
474 setting_main_click_list_ex_ug_cb,
476 SWALLOW_Type_1ICON_1RADIO,
481 get_NFC_on_off_str(),
482 setting_main_click_list_nfc_mode_cb);
483 __BACK_POINTER_SET(ad->data_nfc);
486 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
487 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
488 NULL, NULL, 0, SETTING_NFC_DESC, NULL, NULL);
489 elm_genlist_item_select_mode_set(elm_genlist_item_append(genlist, &(itc_seperator), NULL, NULL,ELM_GENLIST_ITEM_NONE, NULL, NULL),
490 ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
495 static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
497 setting_main_appdata *ad = (setting_main_appdata *)data;
498 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
499 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
501 setting_main_click_list_ex_ug_cb,
503 SWALLOW_Type_INVALID,
514 typedef struct mainlist_entry mainlist_entry;
516 struct mainlist_entry {
518 Setting_GenGroupItem_Data* (*ui_handler)(void* data, char* title, char* iconpath, char* ugname, Evas_Object *genlist);
523 MAINLIST_ENTRY_FLIGHT_MODE = 0,
526 MAINLIST_ENTRY_ALLSHARE,
527 MAINLIST_ENTRY_NETWORK,
529 MAINLIST_ENTRY_DEFAULT,
533 static mainlist_entry mainlist_table[] = {
534 {KeyStr_FlightMode, __flightmode_handler}, // 0 --> NOT UG
535 {KeyStr_WiFi, __wifi_handler}, // 1 --> UG
536 {KeyStr_Bluetooth, __bluetooth_handler}, // 1 --> UG
537 {KeyStr_AllShare, __allshare_handler}, // NOT UG
538 {KeyStr_Network, __network_handler}, // 1 --> UG
539 {KeyStr_NFC, __nfc_handler}, // 1 --> UG
540 {"Default", __default_handler}, // 1 --> UG
542 //--------------------------------------------------------------
547 void __gl_realized(void *data, Evas_Object *obj, void *event_info)
549 //SETTING_TRACE_BEGIN;
550 setting_retm_if(data == NULL, "invalid parameter: data is NULL");
551 setting_retm_if(event_info == NULL, "invalid parameter: event_info is NULL");
552 setting_main_appdata *ad = (setting_main_appdata *)data;
553 Elm_Object_Item *item = (Elm_Object_Item *)event_info;
554 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get(item);
556 //setting_retm_if(list_item == NULL, "list_item is NULL");
559 if (list_item->group_style == SETTING_GROUP_STYLE_TOP) {
560 elm_object_item_signal_emit(item, "elm,state,top", "");
561 } else if (list_item->group_style == SETTING_GROUP_STYLE_BOTTOM) {
562 elm_object_item_signal_emit(item, "elm,state,bottom", "");
563 } else if (list_item->group_style == SETTING_GROUP_STYLE_CENTER) {
564 elm_object_item_signal_emit(item, "elm,state,center", "");
565 } else if (list_item->group_style == SETTING_GROUP_STYLE_NONE) {
568 SETTING_TRACE_ERROR("list_item->group_style is wrong");
571 /* item is used for description */
572 elm_object_item_signal_emit(item, "elm,state,center", "");
576 // Flight Mode - not UG
577 // All share - not UG
578 // WiFi - added toggle
584 void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
587 setting_main_appdata *ad = data;
588 //group title, only display in setting main view
589 if (SETTING_VIEW_MAIN == ad->view_load) {
590 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
591 &(ad->itc[GENDIAL_Type_group_item]),
593 ELM_GENLIST_ITEM_NONE,
594 KeyStr_Connectivity, NULL);
597 int idx_second_menu = 0;
600 char *icon_path = NULL;
601 char *ug_args = NULL;
602 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
605 bool is_emulator = isEmulBin();
607 Setting_GenGroupItem_Data *item_data = NULL;
610 for (i = 0; i < setting_cfg_get_category_length(); i++) {
612 (setting_cfg_get_category_name(i), KeyStr_Connectivity))
615 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
616 keyStr = setting_cfg_get_keyname_idx(i, j);
617 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
618 ug_args = setting_cfg_get_ug_args_idx(i, j);
619 icon_path = setting_cfg_get_icon_path_idx(i, j);
620 /* SETTING_TRACE_DEBUG("Got an item[keyStr:%s, ug_args:%s, pos:%d]", */
621 /* keyStr, ug_args, tmpPos); */
624 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) {
625 continue; /* hide Flight Mode in Emulator*/
626 } else if (!safeStrCmp(KeyStr_WiFi, keyStr)) {
627 continue; /* hide WIFI in Emulator*/
628 } else if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
629 continue; /* hide WiFiDirect in Emulator*/
630 } else if (!safeStrCmp(KeyStr_Network, keyStr)) {
631 continue; /* hide Network in Emulator*/
632 } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr)) {
633 continue; /* hide Bluetooth in Emulator*/
634 } else if (!safeStrCmp(KeyStr_MobileAP, keyStr)) {
635 continue; /* hide Tethering in Emulator*/
641 if (idx_second_menu < MAX_MORE_MENU_NUM
642 && Cfg_Item_Pos_Level1 == tmpPos
643 && SETTING_VIEW_MAIN == ad->view_load
644 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
646 if (is_ug_installed_by_ug_args(ug_args)) {
647 ad->more_connective_menus[idx_second_menu++] = keyStr;
651 if (Cfg_Item_Pos_Level_All == inputPos) {
652 } else if (inputPos != tmpPos) { /* not in the inputPos level */
656 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) { /* load special radio */
658 item_data = mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
660 } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) { /* NOT UG */
662 item_data = mainlist_table[MAINLIST_ENTRY_ALLSHARE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
664 } else if (!safeStrCmp(KeyStr_WiFi, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
666 item_data = mainlist_table[MAINLIST_ENTRY_WIFI].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
668 } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
670 item_data = mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
674 else if (!safeStrCmp(KeyStr_MobileAP, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
676 item_data = mainlist_table[MAINLIST_ENTRY_MOBILEAP].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
680 else if (!safeStrCmp(KeyStr_Network, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special UG */
682 item_data = mainlist_table[MAINLIST_ENTRY_NETWORK].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
684 } else if (!safeStrCmp(KeyStr_NFC, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
685 int nfc_value = FALSE; //default
686 vconf_get_bool(VCONFKEY_NFC_FEATURE, &nfc_value);
687 if (VCONFKEY_NFC_FEATURE_ON == nfc_value)
689 item_data = mainlist_table[MAINLIST_ENTRY_NFC].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
691 } else { /* load other UGs */
692 if (is_ug_installed_by_ug_args(ug_args))
694 item_data = mainlist_table[MAINLIST_ENTRY_DEFAULT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
700 item_data->group_style = SETTING_GROUP_STYLE_TOP;
701 } else if (j == setting_cfg_get_menu_length(i) - 1) {
702 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
704 item_data->group_style = SETTING_GROUP_STYLE_CENTER;
708 item_data->group_style = SETTING_GROUP_STYLE_TOP;
715 //end group , only display in setting main view
716 #if SUPPORT_MORE_ITEM_FUNCTION
717 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
719 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
721 while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
725 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
727 safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
731 ad->data_moreConnect =
732 setting_create_Gendial_field_groupitem(ad->main_genlist,
733 &(ad->itc[GENDIAL_Type_2text_3]),
735 setting_main_click_list_more_cb,
737 SWALLOW_Type_INVALID,
744 __BACK_POINTER_SET(ad->data_moreConnect);
746 /* if has <more ..> item , change the last item_date to SETTING_GROUP_STYLE_CENTER*/
747 if (item_data && index > 1) {
748 item_data->group_style = SETTING_GROUP_STYLE_CENTER;
750 ad->data_moreConnect->group_style = SETTING_GROUP_STYLE_BOTTOM;
752 item_data = ad->data_moreConnect;
758 item_data->group_style = SETTING_GROUP_STYLE_NONE;
759 } else if (index == 2) {
760 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
765 void __load_connectivity_level0_list(void *data)
767 setting_main_appdata *ad = data;
768 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
771 void __load_connectivity_level_all_list(void *data)
774 setting_main_appdata *ad = data;
775 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
778 void __load_system_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
781 SETTING_TRACE_DEBUG("pos :%d", inputPos);
782 setting_main_appdata *ad = data;
783 //group title, only display in setting main view
784 if (SETTING_VIEW_MAIN == ad->view_load) {
785 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
786 &(ad->itc[GENDIAL_Type_group_item]),
788 ELM_GENLIST_ITEM_NONE,
789 KeyStr_System, NULL);
791 int idx_second_menu = 0;
794 char *icon_path = NULL;
795 char *ug_args = NULL;
797 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
802 bool is_emulator = isEmulBin();
804 Setting_GenGroupItem_Data *item_data = NULL;
807 //SETTING_TRACE("setting_cfg_get_category_length() :: %d ", setting_cfg_get_category_length());
808 for (i = 0; i < setting_cfg_get_category_length(); i++) {
809 if (safeStrCmp(setting_cfg_get_category_name(i), KeyStr_System))
812 //SETTING_TRACE(" setting_cfg_get_menu_length(%d) :: %d ",i, setting_cfg_get_menu_length(i) );
813 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
814 keyStr = setting_cfg_get_keyname_idx(i, j);
815 /* sg_path = setting_cfg_get_ugpath_idx(i, j); */
816 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
817 icon_path = setting_cfg_get_icon_path_idx(i, j);
818 ug_args = setting_cfg_get_ug_args_idx(i, j);
820 //SETTING_TRACE("KeyString : %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
823 if (!safeStrCmp(KeyStr_Security, keyStr)) {
824 continue; /* hide Security in Emulator*/
825 } else if (!safeStrCmp(KeyStr_Memory, keyStr)) {
826 continue; /* hide Memory in Emulator*/
827 } else if (!safeStrCmp(KeyStr_Powersaving, keyStr)) {
828 continue; /* hide Powersaving in Emulator*/
834 if (idx_second_menu < MAX_MORE_MENU_NUM
835 && Cfg_Item_Pos_Level1 == tmpPos
836 && SETTING_VIEW_MAIN == ad->view_load
837 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
839 if (is_ug_installed_by_ug_args(ug_args)) {
840 ad->more_system_menus[idx_second_menu++] = keyStr;
844 if (Cfg_Item_Pos_Level_All == inputPos) {
846 //SETTING_TRACE("Cfg_Item_Pos_Level_All == inputPos ---> no draw --- WHY?? ");
847 } else if (inputPos != tmpPos) { /* not in the inputPos level */
848 //SETTING_TRACE("inputPos == tmp Pos ---> no draw --- WHY?? ");
852 if (!safeStrCmp(KeyStr_Landscape, keyStr)) { /* load special UG */
855 (VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
857 ad->data_rotationMode =
858 setting_create_Gendial_field_groupitem(genlist,
859 &(ad->itc[GENDIAL_Type_1text_2icon]),
861 setting_main_sel_list_mouse_up_cb,
863 SWALLOW_Type_1ICON_1RADIO,
869 setting_main_list_mouse_up_cb);
870 __BACK_POINTER_SET(ad->data_rotationMode);
871 item_data = ad->data_rotationMode;
873 else if (!safeStrCmp(KeyStr_Brightness, keyStr)) {
875 char* pa_bright = get_brightness_mode_str();
877 setting_create_Gendial_field_groupitem(genlist,
878 &(ad->itc[GENDIAL_Type_1icon_2text]),
880 setting_main_click_list_ex_ug_cb,
882 SWALLOW_Type_INVALID,
889 __BACK_POINTER_SET(ad->data_bright);
890 item_data = ad->data_bright;
893 else { /* load other UGs */
894 item_data = setting_create_Gendial_field_groupitem(genlist,
895 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
897 setting_main_click_list_ex_ug_cb,
899 SWALLOW_Type_INVALID,
910 item_data->group_style = SETTING_GROUP_STYLE_TOP;
911 } else if (j == setting_cfg_get_menu_length(i) - 1) {
912 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
914 item_data->group_style = SETTING_GROUP_STYLE_CENTER;
918 item_data->group_style = SETTING_GROUP_STYLE_TOP;
924 //end group, only display in setting main view
925 #if SUPPORT_MORE_ITEM_FUNCTION
926 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type && idx_second_menu > 0)
928 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
930 while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
934 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
936 safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
940 ad->data_moreSystem =
941 setting_create_Gendial_field_groupitem(ad->main_genlist,
942 &(ad->itc[GENDIAL_Type_2text_3]),
944 setting_main_click_list_more_cb,
946 SWALLOW_Type_INVALID,
953 __BACK_POINTER_SET(ad->data_moreSystem);
955 /* if has <more ..> item , change the last item_date to SETTING_GROUP_STYLE_CENTER*/
956 if (item_data && index > 1) {
957 item_data->group_style = SETTING_GROUP_STYLE_CENTER;
959 ad->data_moreSystem->group_style = SETTING_GROUP_STYLE_BOTTOM;
961 item_data = ad->data_moreSystem;
966 item_data->group_style = SETTING_GROUP_STYLE_NONE;
967 } else if (index == 2) {
968 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
972 static void __load_system_level0_list(void *data)
974 setting_main_appdata *ad = data;
975 __load_system_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
978 static void __load_system_level_all_list(void *data)
981 setting_main_appdata *ad = data;
982 __load_system_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
985 static void __load_applications_menu_list(void *data,
986 Cfg_Item_Position inputPos)
989 SETTING_TRACE_DEBUG("pos :%d", inputPos);
990 setting_main_appdata *ad = data;
992 bool is_emulator = isEmulBin();
995 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
996 &(ad->itc[GENDIAL_Type_group_item]),
998 ELM_GENLIST_ITEM_NONE,
999 KeyStr_Applications, NULL);
1000 char *keyStr = NULL;
1001 char *icon_path = NULL;
1002 char *ug_args = NULL;
1003 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1006 Setting_GenGroupItem_Data *item_data = NULL;
1008 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1010 (setting_cfg_get_category_name(i), KeyStr_Applications))
1013 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1014 keyStr = setting_cfg_get_keyname_idx(i, j);
1015 icon_path = setting_cfg_get_icon_path_idx(i, j);
1016 ug_args = setting_cfg_get_ug_args_idx(i, j);
1018 (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1020 if (Cfg_Item_Pos_Level_All == inputPos) {
1021 } else if (inputPos != tmpPos) { /* not in the inputPos level */
1026 /* hide all except Email */
1027 if (safeStrCmp(KeyStr_Email, keyStr)) {
1034 item_data = setting_create_Gendial_field_groupitem(ad->main_genlist,
1035 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1037 setting_main_click_list_ex_ug_cb,
1039 SWALLOW_Type_INVALID,
1046 item_data->group_style = SETTING_GROUP_STYLE_TOP;
1047 } else if (j == setting_cfg_get_menu_length(i) - 1) {
1048 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
1050 item_data->group_style = SETTING_GROUP_STYLE_CENTER;
1054 item_data->group_style = SETTING_GROUP_STYLE_TOP;
1062 item_data->group_style = SETTING_GROUP_STYLE_NONE;
1063 } else if (index == 2) {
1064 item_data->group_style = SETTING_GROUP_STYLE_BOTTOM;
1070 static void __load_applications_level0_list(void *data)
1072 setting_main_appdata *ad = data;
1073 __load_applications_menu_list(ad, Cfg_Item_Pos_Level0);
1076 static void __load_applications_level_all_list(void *data)
1078 SETTING_TRACE_BEGIN;
1079 setting_main_appdata *ad = data;
1080 __load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
1084 bool is_3rdapp_installed_setting_cfg(char* pkgname)
1086 SETTING_TRACE_BEGIN;
1090 if (snprintf(path, 512, PLUGIN_PREFIX"/apps/%s/setting/setting.xml", pkgname) < 0)
1094 bool result_opt = false;
1096 if(stat(path, &st) == 0) {
1099 SETTING_TRACE_ERROR(" %s is *NOT* present\n", path);
1109 static void draw_3rdapp(void* data, char* name, char* pkgname)
1111 SETTING_TRACE_BEGIN;
1112 SETTING_TRACE(" name : %s", name);
1113 SETTING_TRACE(" pkgname : %s", pkgname);
1115 setting_main_appdata *ad = data;
1119 if (snprintf(fullpath, 512, PLUGIN_PREFIX"/apps/%s/setting/setting.xml", pkgname) < 0)
1122 SETTING_TRACE(" fullpath : %s", fullpath);
1126 if (ad->plugin_path)
1128 free(ad->plugin_path);
1129 ad->plugin_path = NULL;
1131 ad->plugin_path = strdup(fullpath);
1133 setting_create_Gendial_field_groupitem(ad->main_genlist,
1134 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1136 setting_main_click_list_plugin_cb,
1138 SWALLOW_Type_INVALID,
1139 IMG_DefaultIcon, NULL,
1150 static ail_cb_ret_e __download_apps_cb(ail_appinfo_h ai, void* data)
1152 DrawAppInfo* pinfo = (DrawAppInfo*)data;
1155 if (AIL_ERROR_OK == ail_appinfo_get_str(ai, AIL_PROP_PACKAGE_STR, &id))
1157 SETTING_TRACE(" 3rd party - app name : ----> %s ", id);
1160 ail_appinfo_h handle;
1165 bool nodisplay = false;
1166 bool removable = true;
1168 if (AIL_ERROR_OK == ail_package_get_appinfo(id, &handle))
1170 if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &name))
1171 SETTING_TRACE("cannot get name");
1173 if (AIL_ERROR_OK != ail_appinfo_get_str(handle, AIL_PROP_ICON_STR, &icon))
1174 SETTING_TRACE("cannot get icon");
1176 if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_NODISPLAY_BOOL, &nodisplay))
1177 SETTING_TRACE("cannot get nodisplay");
1179 if (AIL_ERROR_OK != ail_appinfo_get_bool(handle, AIL_PROP_X_SLP_REMOVABLE_BOOL, &removable))
1180 SETTING_TRACE("cannot get removable");
1182 if (AIL_ERROR_OK != ail_appinfo_get_int(handle, AIL_PROP_X_SLP_INSTALLEDTIME_INT, &installed_time))
1183 SETTING_TRACE("cannot get installed_time");
1185 //SETTING_TRACE("installed_time = %d ", installed_time);
1186 if (installed_time != 0 && is_3rdapp_installed_setting_cfg(id) == true )
1188 SETTING_TRACE(" 3rd party - app name : ----> id : %s --- name : %s ", id, name);
1189 SETTING_TRACE(" 3rd party - icon : ----> %s ", icon);
1190 SETTING_TRACE(" 3rd party - nodisplay : ----> %d ", nodisplay);
1194 if (pinfo->draw_app != NULL)
1196 SETTING_TRACE(">>> pkg name --> %s ", id);
1197 pinfo->draw_app(pinfo->data, strdup(name)/* appname*/, strdup(id)/* pkg_name*/);
1202 return AIL_CB_RET_CONTINUE;
1207 * get 3rd party applist from AIL & searching dir/file by the defined rule
1209 * if data is NULL --> just get how many items are there
1210 * if data is NOT NULL --> draw UI code
1212 static int get_downloadapp_list(void* data)
1214 SETTING_TRACE_BEGIN;
1216 setting_main_appdata *ad = data;
1221 DrawAppInfo* pinfo = (DrawAppInfo*)malloc(sizeof(DrawAppInfo));
1225 pinfo->draw_app = draw_3rdapp;
1228 if (ail_filter_new(&f) == AIL_ERROR_OK)
1230 if (ail_filter_add_bool(f, AIL_PROP_NODISPLAY_BOOL, false) != AIL_ERROR_OK)
1232 SETTING_TRACE("ail filter error");
1237 ail_filter_destroy(f);
1241 ail_filter_list_appinfo_foreach(f, __download_apps_cb, pinfo);
1242 //---------------------------------------------------------------
1243 ail_filter_destroy(f);
1245 ncount = pinfo->ncount;
1255 static int __get_downloaded_apps_num(Cfg_Item_Position inputPos)
1257 SETTING_TRACE_BEGIN;
1258 SETTING_TRACE_DEBUG("pos :%d", inputPos);
1259 int downloaded_apps_num = 0;
1260 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1262 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1264 (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
1267 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1268 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1269 if (Cfg_Item_Pos_Level_All == inputPos) {
1270 } else if (inputPos != tmpPos) { /* not in the inputPos level */
1274 downloaded_apps_num++;
1278 // draw UI with AUL code
1280 downloaded_apps_num = get_downloadapp_list(NULL);
1281 SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1284 SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1285 return downloaded_apps_num;
1289 static void __load_downloaded_apps_menu_list(void *data,
1290 Cfg_Item_Position inputPos)
1292 SETTING_TRACE_BEGIN;
1293 SETTING_TRACE_DEBUG("pos :%d", inputPos);
1294 setting_main_appdata *ad = data;
1296 // if the number of download apps is zero, display a bottom seperator
1297 if (0 == __get_downloaded_apps_num(inputPos)) {
1298 Elm_Object_Item *item = NULL;
1299 item = elm_genlist_item_append(ad->main_genlist, &itc_bottom_seperator, NULL, NULL,
1300 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1301 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1306 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
1307 &(ad->itc[GENDIAL_Type_group_item]),
1309 ELM_GENLIST_ITEM_NONE,
1310 KeyStr_DownloadedAPPs,
1312 get_downloadapp_list(ad);
1313 //SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1317 static void __load_downloaded_apps_level0_list(void *data)
1319 setting_main_appdata *ad = data;
1320 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level0);
1323 static void __load_downloaded_apps_level_all_list(void *data)
1325 SETTING_TRACE_BEGIN;
1326 setting_main_appdata *ad = data;
1327 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level_All);
1330 static void __check_all_view_clear(void *data)
1332 SETTING_TRACE_BEGIN;
1334 setting_main_appdata *ad = data;
1335 if (ad->item_check_list) {
1336 eina_list_free(ad->item_check_list);
1337 ad->item_check_list = NULL;
1340 ad->gl_sel_all = NULL;
1341 ad->edit_preferred_genlist = NULL;
1342 //ad->controllbar_all_check = NULL;
1343 ad->check_all_item =NULL;
1346 static void __prefered_buttons_cb(void *data, Evas_Object *obj, void *event_info)
1348 SETTING_TRACE_BEGIN;
1350 setting_main_appdata *ad = (setting_main_appdata *) data;
1351 const char *key = NULL;
1353 key = elm_object_text_get(obj);
1354 setting_retm_if(data == NULL
1355 || key == NULL, "data == NULL || key == NULL");
1357 SETTING_TRACE_DEBUG("press button: %s", key);
1360 if (!safeStrCmp(key, dgettext("sys_string", "IDS_COM_SK_DONE"))) {
1362 if (ad->profile_type == MAIN_PROFILE_ALL) {
1363 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1364 setting_try_save_check_list(ad); /* need to save too */
1365 __check_all_view_clear(ad);
1366 elm_naviframe_item_pop(ad->navibar_main); // pop(preferred) --> main
1370 // MAIN_PROFILE_PREFERRED and Etc
1371 // redraw setting-main
1372 setting_try_save_check_list(ad);
1373 elm_naviframe_item_pop(ad->navibar_main); // pop (preferred) -> main
1375 //After the view is popuped, all the object handlers should be reset NULL.
1376 __check_all_view_clear(ad);
1377 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1378 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1379 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1380 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1381 int ret = setting_main_refresh(ad);
1382 ret_if(ret != SETTING_RETURN_SUCCESS);
1387 if (!safeStrCmp(key, setting_gettext("IDS_COM_SK_CANCEL"))
1388 || !safeStrCmp(key, dgettext("sys_string", "IDS_COM_BODY_BACK"))) {
1389 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1390 elm_naviframe_item_pop(ad->navibar_main);
1391 //After the view is popuped, all the object handlers should be reset NULL.
1392 __check_all_view_clear(ad);
1398 static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1400 SETTING_TRACE_BEGIN;
1402 setting_main_appdata *ad = (setting_main_appdata *) data;
1403 elm_win_lower(ad->win_main);
1406 static Eina_Bool __refresh_on_idle(void *data)
1408 SETTING_TRACE_BEGIN;
1409 retv_if(!data, FALSE);
1410 setting_main_appdata *ad = data;
1411 if (MAIN_PROFILE_ALL == ad->profile_type)
1413 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
1414 ad->load_fns[Func_Type_System] = __load_system_level_all_list;
1415 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1416 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1417 setting_main_refresh(ad);
1419 else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
1421 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1422 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1423 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1424 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1425 setting_main_refresh(ad);
1427 ad->refresh_idler = NULL;
1431 static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
1433 SETTING_TRACE_BEGIN;
1434 ret_if(!data || !obj);
1435 setting_main_appdata *ad = (setting_main_appdata *) data;
1436 //if already has the task,cancel the old task with ecore_idler_del,then add new idler task.
1437 if (ad->refresh_idler) {
1438 ecore_idler_del(ad->refresh_idler);
1439 ad->refresh_idler = NULL;
1442 //Elm_Object_Item *item = elm_toolbar_first_item_get(obj);
1444 if (MAIN_PROFILE_ALL == ad->profile_type)
1446 SETTING_TRACE("Change to Preferred view");
1447 elm_object_text_set(obj, _(ALL_STR));
1448 ad->profile_type = MAIN_PROFILE_PREFERRED;
1450 else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
1452 SETTING_TRACE("Change to ALL view");
1453 elm_object_text_set(obj, _(PREFERRED_STR));
1454 ad->profile_type = MAIN_PROFILE_ALL;
1460 ad->refresh_idler = ecore_idler_add((Ecore_Task_Cb) __refresh_on_idle, ad);
1463 static void __setting_show_title_toolbar(void *data, Evas_Object *obj, void *event_info)
1465 SETTING_TRACE_BEGIN;
1466 //elm_object_item_signal_emit(data, "elm,state,sip,shown", "");
1467 setting_main_appdata *ad = (setting_main_appdata *) data;
1469 Evas_Object *navi_bar = NULL;
1471 if (ad->isInUGMode && ad->ug) {
1472 Evas_Object *layout = (Evas_Object *)ug_get_layout(ad->ug);
1474 navi_bar = elm_object_part_content_get(layout, "elm.swallow.content");
1476 navi_bar = ad->navibar_main;
1479 const char *support = evas_object_data_get(navi_bar, "sip.naviframe.title_obj");
1480 SETTING_TRACE("support:%s", support);
1483 Elm_Object_Item *top_item = elm_naviframe_top_item_get(navi_bar);
1485 elm_object_item_signal_emit(top_item, "elm,state,sip,shown", "");
1489 static void __setting_hide_title_toolbar(void *data, Evas_Object *obj, void *event_info)
1491 SETTING_TRACE_BEGIN;
1492 //elm_object_item_signal_emit(data, "elm,state,sip,hidden", "");
1493 setting_main_appdata *ad = (setting_main_appdata *) data;
1495 Evas_Object *navi_bar = NULL;
1497 if (ad->isInUGMode && ad->ug) {
1498 Evas_Object *layout = (Evas_Object *)ug_get_layout(ad->ug);
1500 navi_bar = elm_object_part_content_get(layout, "elm.swallow.content");
1502 navi_bar = ad->navibar_main;
1505 const char *support = evas_object_data_get(navi_bar, "sip.naviframe.title_obj");
1507 SETTING_TRACE("support:%s", support);
1510 Elm_Object_Item *top_item = elm_naviframe_top_item_get(navi_bar);
1512 elm_object_item_signal_emit(top_item, "elm,state,sip,hidden", "");
1516 static bool __setting_create_main_view(void *data)
1518 SETTING_TRACE_BEGIN;
1520 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1521 setting_main_appdata *ad = (setting_main_appdata *) data;
1523 Evas_Object *conform = elm_conformant_add(ad->win_main);
1524 ad->ly_main = setting_create_win_layout(ad->win_main, ad->win_main);
1525 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1526 evas_object_size_hint_align_set(conform, EVAS_HINT_FILL, EVAS_HINT_FILL);
1527 elm_win_resize_object_add(ad->win_main, conform);
1528 elm_object_content_set(conform, ad->ly_main);
1529 evas_object_show(conform);
1531 evas_object_smart_callback_add(conform, "virtualkeypad,state,on", __setting_show_title_toolbar, ad);
1532 evas_object_smart_callback_add(conform, "virtualkeypad,state,off", __setting_hide_title_toolbar, ad);
1534 elm_win_conformant_set(ad->win_main, EINA_TRUE);
1536 ad->conform = conform;
1538 ad->navibar_main = setting_create_navi_bar(ad->ly_main);
1540 ad->main_genlist = elm_genlist_add(ad->navibar_main);
1541 elm_object_style_set(ad->main_genlist, "dialogue");
1542 retvm_if(ad->main_genlist == NULL, FALSE,
1543 "Cannot set scroller object as contento of layout");
1545 //elm_genlist_homogeneous_set(ad->main_genlist, EINA_TRUE);
1546 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1547 evas_object_smart_callback_add(ad->main_genlist, "realized", __gl_realized, ad);
1549 setting_create_navi_bar_buttons(_("IDS_COM_BODY_SETTINGS"),
1550 _("IDS_COM_BODY_BACK"), NULL, _("IDS_ST_OPT_ALL"),
1551 __btnback_clicked_cb, NULL,
1552 __allFrequent_btn_cb, ad, ad->main_genlist,
1553 ad->navibar_main, NULL);
1555 ad->profile_type = MAIN_PROFILE_PREFERRED;
1556 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1557 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1558 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1559 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1560 setting_main_refresh(ad);
1564 static bool __setting_create_prefered_view(void *data)
1566 SETTING_TRACE_BEGIN;
1568 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1569 setting_main_appdata *ad = (setting_main_appdata *) data;
1571 /* the genlist will be destroyed with its parent view, when using elm_naviframe_item_pop() to destroy the view. */
1572 ad->edit_preferred_genlist = elm_genlist_add(ad->win_main);
1573 elm_object_style_set(ad->edit_preferred_genlist, "dialogue");
1574 elm_genlist_clear(ad->edit_preferred_genlist); /* first to clear list */
1576 /* [UI] edit preffered view */
1577 Evas_Object *sub_layout = elm_layout_add(ad->win_main);
1578 elm_object_style_set(sub_layout, "dialogue");
1579 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1580 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1581 evas_object_show(sub_layout);
1583 ad->gl_sel_all = elm_genlist_add(ad->win_main);
1584 elm_genlist_clear(ad->gl_sel_all); /* first to clear list */
1585 elm_genlist_bounce_set(ad->gl_sel_all, 0, 0);
1587 elm_object_part_content_set(sub_layout, "search_bar", ad->gl_sel_all); /* add 'Select all' */
1588 elm_object_part_content_set(sub_layout, "search_list", ad->edit_preferred_genlist); /* add Genlist */
1590 /* push, not create */
1591 setting_push_layout_navi_bar(_(EDIT_PREFERRED_STR),
1592 _("IDS_COM_SK_CANCEL"),
1593 _("IDS_COM_SK_DONE"), NULL,
1594 __prefered_buttons_cb, __prefered_buttons_cb, NULL, ad,
1595 sub_layout, ad->navibar_main,
1601 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
1603 SETTING_TRACE_BEGIN;
1605 setting_main_appdata *ad = user_data;
1606 ad->b_fm_requesting = FALSE;
1607 SETTING_TRACE("result:%d", result);
1611 case TAPI_POWER_FLIGHT_MODE_RESP_ON:
1613 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1614 SETTING_ON_OFF_BTN_ON, &err);
1616 //If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it.
1617 //Otherwise, do nothing
1618 if (FM_LEAVE == ad->fm_waiting_op)
1620 //Send the latest operation
1621 ad->fm_waiting_op = FM_INVALID;
1622 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1623 setting_retm_if(err != TAPI_API_SUCCESS,
1624 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1627 ad->b_fm_requesting = TRUE;
1632 case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
1634 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1635 SETTING_ON_OFF_BTN_OFF, &err);
1637 //If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it.
1638 //Otherwise, do nothing
1639 if (FM_ENTER == ad->fm_waiting_op)
1641 //Send the latest operation
1642 ad->fm_waiting_op = FM_INVALID;
1643 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1644 setting_retm_if(err != TAPI_API_SUCCESS,
1645 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1648 ad->b_fm_requesting = TRUE;
1653 case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
1654 //Setting has a validate operation to process, Send the operation request
1655 if (FM_ENTER == ad->fm_waiting_op)
1657 ad->fm_waiting_op = FM_INVALID;
1658 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1660 setting_retm_if(err != TAPI_API_SUCCESS,
1661 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1662 ad->b_fm_requesting = TRUE;
1664 else if (FM_LEAVE == ad->fm_waiting_op)
1666 ad->fm_waiting_op = FM_INVALID;
1667 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1669 setting_retm_if(err != TAPI_API_SUCCESS,
1670 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1671 ad->b_fm_requesting = TRUE;
1673 else //Current requset is the last one, Setting needs to notify user
1675 setting_create_popup_without_btn(ad, ad->win_main,
1676 _("IDS_COM_POP_ERROR"),
1677 _("IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA"),
1678 NULL, POPUP_INTERVAL,
1681 //It is need to rollback the status,
1682 if (ad->data_flight) {
1683 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1684 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1690 ad->b_fm_requesting = TRUE;
1694 case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
1695 setting_create_popup_without_btn(ad, ad->win_main,
1696 _("IDS_COM_POP_ERROR"),
1697 _("IDS_COM_POP_UNEXPECTED_ERROR"),
1698 NULL, POPUP_INTERVAL, FALSE, FALSE);
1700 //It is need to rollback the status,
1701 if (ad->data_flight) {
1702 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1703 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1713 static int setting_main_refresh(void *data)
1715 SETTING_TRACE_BEGIN;
1716 setting_main_appdata *ad = (setting_main_appdata *) data;
1717 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1720 if (is_ug_installed_by_ug_args("rcs-config"))
1722 Elm_Object_Item *item = elm_genlist_item_append(ad->main_genlist, &itc_seperator, NULL, NULL,
1723 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1724 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1725 setting_create_Gendial_field_groupitem(ad->main_genlist,
1726 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1728 setting_main_click_list_ex_ug_cb,
1730 SWALLOW_Type_INVALID,
1732 0, KeyStr_Joyn, NULL,
1738 for(i = Func_Type_Connectivity; i < Func_Type_MAX; i++)
1739 (ad->load_fns[i]) (ad);
1741 memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
1743 return SETTING_RETURN_SUCCESS;
1746 static int setting_main_create(void *cb)
1748 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1750 setting_main_appdata *ad = (setting_main_appdata *) cb;
1752 //pass NULL to let TAPI access default module
1753 ad->handle = tel_init(NULL);
1755 SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***");
1757 SETTING_TRACE("tel_init ok[handle:%p]", ad->handle);
1759 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1760 &(ad->itc[GENDIAL_Type_1text_1icon_2]));
1761 setting_create_Gendial_itc("dialogue/1text.2icon",
1762 &(ad->itc[GENDIAL_Type_1text_2icon]));
1763 setting_create_Gendial_itc("dialogue/2text.1icon.3",
1764 &(ad->itc[GENDIAL_Type_1icon_2text]));
1765 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1766 &(ad->itc[GENDIAL_Type_1text_2icon_2]));
1767 setting_create_Gendial_itc("dialogue/2text.2icon.3",
1768 &(ad->itc[GENDIAL_Type_2text_2icon_3]));
1769 setting_create_Gendial_itc("dialogue/title",
1770 &(ad->itc[GENDIAL_Type_group_item]));
1771 setting_create_Gendial_itc("select_all",
1772 &(ad->itc[GENDIAL_Type_sel_all]));
1774 setting_create_Gendial_itc("dialogue/2text.3", &(ad->itc[GENDIAL_Type_2text_3]));
1776 ad->view_type = SETTING_VIEW_MAIN;
1777 __setting_create_main_view(ad);
1779 setting_view_main.is_create = 1;
1781 return SETTING_RETURN_SUCCESS;
1784 static int setting_main_destroy(void *cb)
1786 SETTING_TRACE_BEGIN;
1788 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1790 setting_main_appdata *ad = (setting_main_appdata *) cb;
1791 if (0 == setting_view_main.is_create)
1794 return SETTING_RETURN_SUCCESS;
1797 evas_object_smart_callback_del(ad->conform, "virtualkeypad,state,on", __setting_show_title_toolbar);
1798 evas_object_smart_callback_del(ad->conform, "virtualkeypad,state,off", __setting_hide_title_toolbar);
1800 if (ad->refresh_idler) {
1801 ecore_idler_del(ad->refresh_idler);
1802 ad->refresh_idler = NULL;
1806 int tapi_ret = tel_deinit(ad->handle);
1807 if (tapi_ret != TAPI_API_SUCCESS) {
1808 SETTING_TRACE_DEBUG("*** [ERR] tel_deinit. [%d] ***", tapi_ret);
1810 SETTING_TRACE("*** tel_deinit OK ");
1815 /* then destroy the UI object. */
1816 if (ad->item_check_list) {
1817 eina_list_free(ad->item_check_list);
1818 ad->item_check_list = NULL;
1820 SETTING_TRACE("*** ad->item_check_list is NULL - abnormal state ");
1824 evas_object_del(ad->ly_main);
1828 if (ad->flight_popup) {
1829 evas_object_del(ad->flight_popup);
1830 ad->flight_popup = NULL;
1834 if (ad->plugin_node)
1836 setting_plugin_destroy(ad->plugin_node);
1840 evas_object_smart_callback_del(ad->main_genlist, "realized", __gl_realized);
1842 setting_view_main.is_create = 0;
1844 return SETTING_RETURN_SUCCESS;
1847 static int setting_main_update(void *cb)
1849 SETTING_TRACE_BEGIN;
1852 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1854 setting_main_appdata *ad = (setting_main_appdata *) cb;
1856 if (ad->ly_main != NULL) {
1857 //evas_object_show(ad->ly_main);
1860 return SETTING_RETURN_SUCCESS;
1863 static int setting_main_cleanup(void *cb)
1865 SETTING_TRACE_BEGIN;
1867 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1869 setting_main_appdata *ad = (setting_main_appdata *) cb;
1871 if (ad->ly_main != NULL) {
1872 //evas_object_hide(ad->ly_main);
1875 return SETTING_RETURN_SUCCESS;
1878 /* ***************************************************
1882 ***************************************************/
1884 void setting_update_gl_item(void* data)
1886 SETTING_TRACE_BEGIN;
1887 setting_main_appdata *ad = data;
1888 retm_if(!data, "Invalid argument: data is NULL");
1891 Eina_Bool bGlUpdate = EINA_FALSE;
1892 Setting_GenGroupItem_Data *item_to_update = NULL;
1894 for(;nDx<GL_ITEM_MAX; nDx++) {
1895 if(EINA_TRUE == ad->updateItems[nDx]) {
1899 item_to_update = ad->data_wifi;
1900 bGlUpdate = EINA_TRUE;
1903 item_to_update = ad->data_bt;
1904 bGlUpdate = EINA_TRUE;
1907 item_to_update = ad->data_nfc;
1908 bGlUpdate = EINA_TRUE;
1910 case GL_ITEM_FLIGHT:
1911 item_to_update = ad->data_flight;
1912 bGlUpdate = EINA_FALSE;
1918 default: // other case
1922 if (item_to_update) {
1923 SETTING_TRACE("gl update [%s], bGlUpdate:%d", _(item_to_update->keyStr), bGlUpdate);
1925 SETTING_TRACE("gl update:%d", nDx);
1926 elm_object_item_data_set(item_to_update->item, item_to_update);
1927 elm_genlist_item_update(item_to_update->item);
1929 SETTING_TRACE("chk update:%d", nDx);
1930 elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
1934 ad->updateItems[nDx] = EINA_FALSE;
1935 } // if(EINA_TRUE == ad->updateItems[nDx])
1943 void setting_main_destroy_ug_cb(ui_gadget_h ug, void *priv)
1945 setting_main_appdata *ad = (setting_main_appdata *) priv;
1947 return; /* do nothing if ad is NULL */
1954 setting_main_click_list_item_reset_data(ad, NULL);
1956 // update main genlist in unloading UG
1957 SETTING_TRACE("update main genlist in unloading UG");
1958 setting_update_gl_item(ad);
1963 void setting_main_result_ug_cb(ui_gadget_h ug, service_h service,
1968 // set default local automatically
1969 set_defaultLangICU();
1972 void setting_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
1975 setting_main_appdata *ad = (setting_main_appdata *) priv;
1980 SETTING_TRACE_BEGIN;
1982 base = (Evas_Object *) ug_get_layout(ug);
1987 case UG_MODE_FULLVIEW:
1988 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
1990 evas_object_show(base);
1999 /* ***************************************************
2003 ***************************************************/
2005 void setting_main_click_list_item_reset_data(void *data,
2008 SETTING_TRACE_BEGIN;
2009 setting_main_appdata *ad = (setting_main_appdata *) data;
2011 ad->isInUGMode = FALSE;
2016 void /* obj is the layout clicked */
2017 setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
2018 char *ug_to_load, service_h svc,
2021 SETTING_TRACE_BEGIN;
2022 setting_main_appdata *ad = (setting_main_appdata *) data;
2024 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2028 char ug_file[PATH_MAX];
2030 (ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH,
2033 SETTING_TRACE("ug_file:%s", ug_file);
2034 if (!ecore_file_exists(ug_file)) {
2035 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2039 SETTING_TRACE("to create libug-%s.so", ug_to_load);
2040 ad->ug = ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
2042 ad->isInUGMode = TRUE;
2043 memset(ad->cur_loaded_ug, 0x00, MAX_DISPLAY_NAME_LEN_ON_UI);
2044 safeCopyStr(ad->cur_loaded_ug, ug_to_load, MAX_DISPLAY_NAME_LEN_ON_UI);
2047 evas_object_show(ad->ly_main);
2049 SETTING_TRACE_ERROR("errno:%d", errno);
2050 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
2056 setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj,
2059 setting_main_appdata *ad = data;
2060 setting_create_simple_popup(ad, ad->win_main, NULL,
2065 setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
2067 SETTING_TRACE_BEGIN;
2068 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2072 char *str_text = USB_NEED_OFF;
2074 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2076 setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
2079 SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
2080 setting_main_click_list_ex_ug_cb(data, obj, item);
2084 /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
2085 if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB)
2087 elm_genlist_item_selected_set(item, EINA_FALSE);
2088 setting_create_simple_popup(g_main_ad, g_main_ad->win_main, NULL, (str_text));
2092 setting_main_click_list_ex_ug_cb(data, obj, item);
2098 void setting_main_click_list_more_cb(void *data, Evas_Object *obj, void *event_info)
2100 SETTING_TRACE_BEGIN;
2101 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2102 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2103 elm_genlist_item_selected_set(item, EINA_FALSE);
2104 retm_if(data == NULL, "Invalid argument: data is NULL");
2105 setting_main_appdata *ad = data;
2106 Setting_GenGroupItem_Data *selected_item_data =
2107 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2108 SETTING_TRACE("selected_item_data->keyStr:%s", selected_item_data->keyStr);
2109 if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreConnect))
2111 ad->view_load = SETTING_VIEW_CONNECTIVE_MORE;
2113 else if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreSystem))
2115 ad->view_load = SETTING_VIEW_SYSTEM_MORE;
2121 setting_view_change(&setting_view_main, &setting_view_more_menu, ad);
2126 setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
2129 SETTING_TRACE_BEGIN;
2130 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2131 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2133 elm_genlist_item_selected_set(item, EINA_FALSE);
2135 if (g_main_ad->ug) {
2137 ("[ad->ug non-NULL]skip genlist click event!!");
2143 if (NULL == data) { /* pass NULL to ug_args when create setting.cfg. */
2144 setting_create_simple_popup(g_main_ad,
2145 g_main_ad->win_main,
2146 NULL, NO_UG_FOUND_MSG);
2151 setting_main_appdata *ad = g_main_ad;
2153 /* if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
2154 if (ad->isInUGMode) {
2155 SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
2156 ad->isInUGMode = FALSE;
2161 ("isInUGMode : FALSE - another UG is NOT running now.")
2164 Setting_GenGroupItem_Data *selected_item_data =
2165 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2166 setting_main_click_list_item_reset_data(ad, obj);
2167 const char *item_name = _(selected_item_data->keyStr);
2170 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2171 setting_retm_if(!cbs, "calloc failed");
2172 cbs->layout_cb = setting_main_layout_ug_cb;
2173 cbs->result_cb = setting_main_result_ug_cb;
2174 cbs->destroy_cb = setting_main_destroy_ug_cb;
2175 cbs->priv = (void *)ad;
2177 char *path = get_ug_path_from_ug_args(data);
2178 service_h svc = get_bundle_from_ug_args(data);
2179 setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
2186 service_destroy(svc);
2189 setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
2192 SETTING_TRACE_BEGIN;
2193 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2194 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2195 elm_genlist_item_selected_set(item, EINA_FALSE);
2197 setting_main_appdata *ad = data;
2198 if (ad->plugin_path)
2200 PluginNode* plugin_node = setting_plugin_create();
2202 plugin_node->plugin_path = strdup(ad->plugin_path);
2204 setting_plugin_load(plugin_node, (const char *)ad->plugin_path);
2205 ad->plugin_node = (void*)plugin_node;
2210 free(ad->plugin_path);
2211 ad->plugin_path = NULL;
2218 * @see [caller] setting_main_list_mouse_up_cb
2219 * @see [caller] setting_main_sel_list_mouse_up_cb
2221 static void __rotate_lock_handler(int chk_status, setting_main_appdata *ad )
2223 SETTING_TRACE_BEGIN;
2224 if( chk_status == 1)
2227 int angle = elm_win_rotation_get(ad->win_main);
2228 elm_win_rotation_with_resize_set(ad->win_main, angle);
2230 elm_win_rotation_with_resize_set(ad->win_main, 0);
2232 vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, chk_status);
2238 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
2241 SETTING_TRACE_BEGIN;
2242 retm_if(data == NULL, "Data parameter is NULL");
2243 Setting_GenGroupItem_Data *list_item =
2244 (Setting_GenGroupItem_Data *) data;
2245 SETTING_TRACE("process item [%s]", list_item->keyStr);
2246 list_item->chk_status = elm_check_state_get(eo); /* for update new state */
2248 SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
2249 list_item->chk_status);
2250 setting_main_appdata *ad = g_main_ad;
2252 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2254 if (elm_check_state_get(eo)) {
2255 setting_set_bool_slp_key
2256 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2257 SETTING_ON_OFF_BTN_ON, &err);
2259 setting_set_bool_slp_key
2260 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2261 SETTING_ON_OFF_BTN_OFF, &err);
2264 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2265 __rotate_lock_handler(list_item->chk_status, ad);
2274 void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
2277 SETTING_TRACE_BEGIN;
2278 setting_retm_if(data == NULL, "Data parameter is NULL");
2280 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2281 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2282 elm_genlist_item_selected_set(item, 0);
2283 Setting_GenGroupItem_Data *list_item =
2284 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2286 list_item->chk_status = elm_check_state_get(list_item->eo_check);
2289 list_item->chk_status = !list_item->chk_status;
2290 elm_check_state_set(list_item->eo_check, list_item->chk_status);
2292 setting_main_appdata *ad = (setting_main_appdata *) data;
2293 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2294 /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
2296 setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA,
2297 list_item->chk_status, &err);
2299 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2300 __rotate_lock_handler(list_item->chk_status, ad);
2306 void __alternate_flight_mode(Evas_Object *check)
2308 SETTING_TRACE_BEGIN;
2310 Eina_Bool status = elm_check_state_get(check);
2311 SETTING_TRACE("flight mode status : %d", status);
2312 setting_main_appdata *ad = g_main_ad;
2314 //Check whether some requestion is processing by TAPI
2315 if (ad->b_fm_requesting)
2317 //Do nothing, just mark the lastest operation..
2318 SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
2319 ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
2323 //otherwise, invalid waiting operation and send requsetion to TAPI:
2324 ad->fm_waiting_op = FM_INVALID;
2326 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2327 setting_retm_if(ret != TAPI_API_SUCCESS,
2328 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2330 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2331 setting_retm_if(ret != TAPI_API_SUCCESS,
2332 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2336 ad->b_fm_requesting = TRUE;
2340 void __alternate_wifi_mode(Evas_Object *check)
2342 SETTING_TRACE_BEGIN;
2344 Eina_Bool status = elm_check_state_get(check);
2345 SETTING_TRACE("wifi mode status : %d", status);
2347 ret = wifi_initialize();
2348 setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***");
2352 ret = wifi_activate(NULL, NULL);
2353 setting_retm_if(ret < 0,
2354 "*** [ERR] wifi_activate() ***");
2356 ret = wifi_deactivate(NULL, NULL);
2357 setting_retm_if(ret < 0,
2358 "*** [ERR] wifi_deactivate() ***");
2360 ret = wifi_deinitialize();
2361 setting_retm_if(ret < 0, "*** [ERR] wifi_deinitialize() ***");
2366 void __alternate_bt_mode(Evas_Object *check)
2368 SETTING_TRACE_BEGIN;
2370 Eina_Bool status = elm_check_state_get(check);
2371 SETTING_TRACE("bt mode status : %d", status);
2373 ret = bt_initialize();
2374 setting_retm_if(ret < 0, "*** [ERR] bt_initialize() ***");
2378 ret = bt_adapter_enable();
2379 setting_retm_if(ret < 0,
2380 "*** [ERR] bt_adapter_enable() ***");
2382 ret = bt_adapter_disable();
2383 setting_retm_if(ret < 0,
2384 "*** [ERR] bt_adapter_disable() ***");
2387 ret = bt_deinitialize();
2388 setting_retm_if(ret < 0, "*** [ERR] bt_deinitialize() ***");
2393 void __alternate_nfc_mode(Evas_Object *check)
2395 SETTING_TRACE_BEGIN;
2397 Eina_Bool status = elm_check_state_get(check);
2398 SETTING_TRACE("nfc mode status : %d", status);
2400 ret = nfc_manager_initialize(NULL, NULL);
2401 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_initialize() ***");
2404 ret = nfc_manager_set_activation(status, NULL, NULL);
2405 setting_retm_if(ret < 0,
2406 "*** [ERR] nfc_manager_set_activation() ***");
2408 ret = nfc_manager_deinitialize();
2409 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_deinitialize() ***");
2414 void __alternate_sbeam_mode(Evas_Object *check)
2416 SETTING_TRACE_BEGIN;
2418 Eina_Bool status = elm_check_state_get(check);
2419 SETTING_TRACE("wifi mode status : %d", status);
2421 vconf_set_bool(VCONFKEY_NFC_SBEAM, status);
2427 setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj,
2430 SETTING_TRACE_BEGIN;
2431 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2432 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2434 elm_genlist_item_selected_set(item, EINA_FALSE);
2436 if (g_main_ad->ug) {
2438 ("[ad->ug non-NULL]skip genlist click event!!");
2444 setting_main_appdata *ad = g_main_ad;
2445 setting_main_click_list_item_reset_data(ad, obj);
2449 setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2450 SETTING_TRACE("value:%d", value);
2452 case VCONFKEY_TELEPHONY_SIM_INSERTED:
2454 struct ug_cbs *cbs =
2455 (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2456 setting_retm_if(!cbs, "calloc failed");
2457 cbs->layout_cb = setting_main_layout_ug_cb;
2458 cbs->result_cb = setting_main_result_ug_cb;
2459 cbs->destroy_cb = setting_main_destroy_ug_cb;
2460 cbs->priv = (void *)ad;
2461 setting_main_click_list_item_ug_cb(data, obj,
2462 "setting-network-efl",
2467 case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
2468 setting_create_simple_popup(NULL, ad->win_main,
2469 NULL, _("IDS_ST_HEADER_INSERT_SIM_CARD_ABB"));
2470 SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
2471 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2474 case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
2475 case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
2476 setting_create_simple_popup(NULL, ad->win_main,
2477 NULL,_("IDS_COM_BODY_INVALID_SIM_CARD"));
2478 SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
2479 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2492 setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj,
2496 setting_retm_if(data == NULL, "Data parameter is NULL");
2498 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2499 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2500 elm_genlist_item_selected_set(item, 0);
2501 Setting_GenGroupItem_Data *list_item =
2502 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2503 int old_status = elm_check_state_get(list_item->eo_check);
2505 list_item->chk_status = !old_status;
2506 elm_check_state_set(list_item->eo_check, list_item->chk_status);
2508 __alternate_flight_mode(list_item->eo_check);
2516 setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2519 SETTING_TRACE_BEGIN;
2520 retm_if(data == NULL, "Data parameter is NULL");
2521 Setting_GenGroupItem_Data *list_item =
2522 (Setting_GenGroupItem_Data *) data;
2523 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2524 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2525 list_item->chk_status);
2527 __alternate_flight_mode(obj);
2535 setting_main_click_list_wifi_mode_cb(void *data, Evas_Object *obj,
2538 SETTING_TRACE_BEGIN;
2539 retm_if(data == NULL, "Data parameter is NULL");
2540 Setting_GenGroupItem_Data *list_item =
2541 (Setting_GenGroupItem_Data *) data;
2542 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2543 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2544 list_item->chk_status);
2546 __alternate_wifi_mode(obj);
2554 setting_main_click_list_bt_mode_cb(void *data, Evas_Object *obj,
2557 SETTING_TRACE_BEGIN;
2558 retm_if(data == NULL, "Data parameter is NULL");
2559 Setting_GenGroupItem_Data *list_item =
2560 (Setting_GenGroupItem_Data *) data;
2561 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2562 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2563 list_item->chk_status);
2565 __alternate_bt_mode(obj);
2573 setting_main_click_list_nfc_mode_cb(void *data, Evas_Object *obj,
2576 SETTING_TRACE_BEGIN;
2577 retm_if(data == NULL, "Data parameter is NULL");
2578 Setting_GenGroupItem_Data *list_item =
2579 (Setting_GenGroupItem_Data *) data;
2580 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2581 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2582 list_item->chk_status);
2584 __alternate_nfc_mode(obj);
2592 setting_main_click_list_sbeam_mode_cb(void *data, Evas_Object *obj,
2595 SETTING_TRACE_BEGIN;
2596 retm_if(data == NULL, "Data parameter is NULL");
2597 Setting_GenGroupItem_Data *list_item =
2598 (Setting_GenGroupItem_Data *) data;
2599 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2600 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2601 list_item->chk_status);
2603 __alternate_sbeam_mode(obj);
2608 * store current selection in setting.cfg
2610 void setting_try_save_check_list(void *data)
2612 SETTING_TRACE_BEGIN;
2613 setting_main_appdata *ad = (setting_main_appdata *) data;
2615 Eina_List *check_list = ad->item_check_list;
2616 Setting_GenGroupItem_Data *list_item = NULL;
2617 int update_count = 0;
2619 while (check_list) {
2620 list_item = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list);
2621 if (NULL == list_item) continue;
2624 if (list_item->chk_status) {
2625 /* to update config file */
2626 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level0);
2628 /* to update config file */
2629 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level1);
2631 check_list = eina_list_next(check_list);
2634 if (update_count == 0) {
2635 /* to popup tips notify */
2637 setting_cfg_file_update();
2643 setting_main_click_edit_preferred_cb(void *data, Evas_Object *obj, void *event_info)
2645 SETTING_TRACE_BEGIN;
2647 setting_main_appdata *ad = (setting_main_appdata *) data;
2648 ad->view_type = SETTING_VIEW_ALL_CHECK;
2649 __setting_create_prefered_view(ad);
2650 __load_check_list(ad, &(ad->edit_preferred_genlist), NULL);