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>
25 #include <setting-main.h>
26 #include <setting-plugin.h>
28 static int setting_main_create(void *cb);
29 static int setting_main_destroy(void *cb);
30 static int setting_main_update(void *cb);
31 static int setting_main_cleanup(void *cb);
33 setting_view setting_view_main = {
34 .create = setting_main_create,
35 .update = setting_main_update,
36 .destroy = setting_main_destroy,
37 .cleanup = setting_main_cleanup,
40 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data);
41 static int setting_main_refresh(void *data);
42 static void __alternate_flight_mode(Evas_Object *check);
43 static void setting_main_click_Gendial_list_flight_mode_cb(void *data,
46 static void __alternate_flight_mode(Evas_Object *check);
48 void setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj, char *ug_to_load, service_h svc, struct ug_cbs *cbs);
50 setting_main_appdata *g_main_ad;
52 __setting_chk_changed(void *data, Evas_Object *obj, void *event_info)
54 /* SETTING_TRACE_BEGIN; */
55 retm_if(data == NULL, "Data parameter is NULL");
56 Setting_GenGroupItem_Data *list_item =
57 (Setting_GenGroupItem_Data *) data;
58 /* SETTING_TRACE("process item [%s]", _(list_item->keyStr)); */
59 list_item->chk_status = elm_check_state_get(obj);
61 Eina_List *check_list = g_main_ad->item_check_list;
62 Setting_GenGroupItem_Data *item = NULL;
63 bool isFoundNotSelSomeone = FALSE;
64 bool isFoundSelSomeone = FALSE;
66 item = (Setting_GenGroupItem_Data *)
67 eina_list_data_get(check_list);
71 if (!(item->chk_status)) {
72 isFoundNotSelSomeone = TRUE;
74 isFoundSelSomeone = TRUE;
76 if (isFoundNotSelSomeone && isFoundSelSomeone) {
79 check_list = eina_list_next(check_list);
82 if (isFoundNotSelSomeone) {
83 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
85 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
87 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
88 elm_genlist_item_update(g_main_ad->check_all_item->item);
90 if (isFoundSelSomeone) {
91 /* SETTING_TRACE("Set it to active"); */
92 elm_object_item_disabled_set(elm_toolbar_last_item_get
93 (g_main_ad->controllbar_all_check),
98 static void __setting_list_changed(void *data, Evas_Object *obj,
104 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
106 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
107 elm_genlist_item_selected_set(item, 0);
108 Setting_GenGroupItem_Data *list_item =
109 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
111 int old_status = elm_check_state_get(list_item->eo_check);
113 list_item->chk_status = !old_status;
114 elm_check_state_set(list_item->eo_check, list_item->chk_status);
116 Eina_List *check_list = g_main_ad->item_check_list;
117 Setting_GenGroupItem_Data *group_item = NULL;
118 bool isFoundNotSelSomeone = FALSE;
119 bool isFoundSelSomeone = FALSE;
121 group_item = (Setting_GenGroupItem_Data *)
122 eina_list_data_get(check_list);
123 if (NULL == group_item) {
126 if (!(group_item->chk_status)) {
127 isFoundNotSelSomeone = TRUE;
130 isFoundSelSomeone = TRUE;
132 if (isFoundNotSelSomeone && isFoundSelSomeone) {
136 check_list = eina_list_next(check_list);
139 if (isFoundNotSelSomeone) {
140 g_main_ad->check_all_item->chk_status = 0; /* for update new state */
142 g_main_ad->check_all_item->chk_status = 1; /* for update new state */
144 elm_object_item_data_set(g_main_ad->check_all_item->item, g_main_ad->check_all_item);
145 elm_genlist_item_update(g_main_ad->check_all_item->item);
147 if (isFoundSelSomeone) {
148 /* SETTING_TRACE("Set it to active"); */
149 elm_object_item_disabled_set(elm_toolbar_last_item_get
150 (g_main_ad->controllbar_all_check),
157 __setting_chk_sel_all_changed(void *data, Evas_Object *obj, void *event_info)
159 /* SETTING_TRACE_BEGIN; */
160 retm_if(data == NULL, "Data parameter is NULL");
161 Setting_GenGroupItem_Data *list_item =
162 (Setting_GenGroupItem_Data *) data;
163 bool is_all_checked = elm_check_state_get(obj);
164 list_item->chk_status = is_all_checked; /* for update new state */
165 /* SETTING_TRACE("is_all_checked:%d", is_all_checked); */
167 Eina_List *check_list = g_main_ad->item_check_list;
170 list_item = (Setting_GenGroupItem_Data *)
171 eina_list_data_get(check_list);
172 if (NULL == list_item) {
175 list_item->chk_status = is_all_checked;
176 elm_object_item_data_set(list_item->item, list_item);
177 elm_genlist_item_update(list_item->item);
178 check_list = eina_list_next(check_list);
180 if (is_all_checked) {
181 elm_object_item_disabled_set(elm_toolbar_last_item_get
182 (g_main_ad->controllbar_all_check),
187 static void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
193 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
194 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
195 elm_genlist_item_selected_set(item, 0);
196 Setting_GenGroupItem_Data *list_item =
197 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
199 int old_status = elm_check_state_get(list_item->eo_check);
201 int is_all_checked = list_item->chk_status = !old_status;
202 elm_check_state_set(list_item->eo_check, list_item->chk_status);
204 Eina_List *check_list = g_main_ad->item_check_list;
207 list_item = (Setting_GenGroupItem_Data *)
208 eina_list_data_get(check_list);
209 if (NULL == list_item) {
212 list_item->chk_status = is_all_checked;
213 /* elm_check_state_set(list_item->eo_check, is_all_checked); */
214 elm_object_item_data_set(list_item->item, list_item);
215 elm_genlist_item_update(list_item->item);
216 check_list = eina_list_next(check_list);
218 if (is_all_checked) {
219 elm_object_item_disabled_set(elm_toolbar_last_item_get
220 (g_main_ad->controllbar_all_check),
226 static void __load_check_list(void *data, Evas_Object **genlist,
230 setting_main_appdata *ad = (setting_main_appdata *) data;
234 Cfg_Item_Position pos = Cfg_Item_Pos_Uninstall;
235 bool isFoundNonSelItem = FALSE;
236 bool isFoundSelSomeoneItem = FALSE;
239 char *icon_path = NULL;
242 setting_create_Gendial_field_def(ad->gl_sel_all,
243 &(ad->itc[GENDIAL_Type_sel_all]),
244 __setting_list_sel_all_changed, ad,
245 SWALLOW_Type_1CHECK, NULL, NULL,
246 state, KeyStr_Select_All, NULL,
247 __setting_chk_sel_all_changed);
248 __BACK_POINTER_SET(ad->check_all_item);
250 Setting_GenGroupItem_Data *item = NULL;
251 Setting_GenGroupItem_Data *category_item = NULL;
252 for (i = 0; i < setting_cfg_get_category_length(); i++) {
253 if (NULL == menuNameKey) {
254 /* SETTING_TRACE("load all the items in config file"); */
257 (setting_cfg_get_category_name(i), menuNameKey)) {
260 char *category_name = setting_cfg_get_category_name(i);
263 setting_create_Gendial_field_group_titleItem(*genlist,
265 [GENDIAL_Type_group_item]),
267 ELM_GENLIST_ITEM_NONE,
271 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
272 keyStr = setting_cfg_get_keyname_idx(i, j);
273 pos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
275 if (Cfg_Item_Pos_Level1 == pos) {
277 isFoundNonSelItem = TRUE;
280 isFoundSelSomeoneItem = TRUE;
283 icon_path = setting_cfg_get_icon_path_idx(i, j);
285 setting_create_Gendial_field_groupitem(*genlist,
287 [GENDIAL_Type_1text_2icon_2]),
289 __setting_list_changed,
291 SWALLOW_Type_1CHECKICON,
296 __setting_chk_changed);
298 ad->item_check_list =
299 eina_list_append(ad->item_check_list, item);
302 SETTING_TRACE_ERROR("category_item is NULL");
306 if (ad->check_all_item) {
307 if (isFoundNonSelItem) {
308 ad->check_all_item->chk_status = 0; /* for update new state */
310 ad->check_all_item->chk_status = 1; /* for update new state */
312 elm_object_item_data_set(ad->check_all_item->item, ad->check_all_item);
313 elm_genlist_item_update(ad->check_all_item->item);
315 SETTING_TRACE_ERROR("ad->check_all_item is NULL");
318 if (isFoundSelSomeoneItem) {
319 elm_object_item_disabled_set(elm_toolbar_last_item_get
320 (ad->controllbar_all_check),
323 elm_object_item_disabled_set(elm_toolbar_last_item_get
324 (ad->controllbar_all_check),
331 static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist)
333 // NOT UG --> it's just UI drawing
335 setting_main_appdata *ad = (setting_main_appdata *)data;
337 setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
339 /* create flight_mode */
340 ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
341 &(ad->itc[GENDIAL_Type_1text_2icon]),
343 setting_main_click_Gendial_list_flight_mode_cb,
345 SWALLOW_Type_1ICON_1RADIO,
351 setting_main_click_list_flight_mode_cb);
352 __BACK_POINTER_SET(ad->data_flight);
354 return ad->data_flight;
357 static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
359 setting_main_appdata *ad = (setting_main_appdata *)data;
361 char* pa_wifi = get_pa_Wi_Fi_on_off_str();
362 ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
363 &(ad->itc[GENDIAL_Type_1icon_2text]),
365 setting_main_click_list_ex_ug_cb,
367 SWALLOW_Type_INVALID,
374 __BACK_POINTER_SET(ad->data_wifi);
377 return ad->data_wifi;
380 static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
382 setting_main_appdata *ad = (setting_main_appdata *)data;
384 ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
385 &(ad->itc[GENDIAL_Type_1icon_2text]),
387 setting_main_click_list_ex_ug_cb,
389 SWALLOW_Type_INVALID,
397 __BACK_POINTER_SET(ad->data_bt);
402 static Setting_GenGroupItem_Data * __mobileap_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
404 setting_main_appdata *ad = (setting_main_appdata *)data;
406 ad->data_mobileApp = setting_create_Gendial_field_groupitem(genlist,
407 &(ad->itc[GENDIAL_Type_1icon_2text]),
409 setting_main_click_list_ex_ug_cb,
411 SWALLOW_Type_INVALID,
416 get_Mobile_AP_on_off_str
419 __BACK_POINTER_SET(ad->data_mobileApp);
421 return ad->data_mobileApp;
424 static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
426 setting_main_appdata *ad = (setting_main_appdata *)data;
428 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
429 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
431 setting_main_click_list_default_ug_cb,
433 SWALLOW_Type_INVALID,
442 static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
444 setting_main_appdata *ad = (setting_main_appdata *)data;
446 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
447 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
449 setting_main_click_list_network_ug_cb,
451 SWALLOW_Type_INVALID,
461 static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
463 setting_main_appdata *ad = (setting_main_appdata *)data;
465 ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
466 &(ad->itc[GENDIAL_Type_1icon_2text]),
468 setting_main_click_list_ex_ug_cb,
470 SWALLOW_Type_INVALID,
475 get_NFC_on_off_str(),
477 __BACK_POINTER_SET(ad->data_nfc);
479 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
480 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
481 NULL, NULL, 0, SETTING_NFC_DESC, NULL, NULL);
486 static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
488 setting_main_appdata *ad = (setting_main_appdata *)data;
489 Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
490 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
492 setting_main_click_list_ex_ug_cb,
494 SWALLOW_Type_INVALID,
501 if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
502 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
503 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
504 NULL, NULL, 0, SETTING_WIFI_DIRECT_DESC, NULL, NULL);
505 } else if (!safeStrCmp(KeyStr_KeisOverWifi, keyStr)) {
506 setting_create_Gendial_field_def(genlist, &itc_multiline_text, NULL,
507 ad, SWALLOW_Type_LAYOUT_SPECIALIZTION,
508 NULL, NULL, 0, SETTING_KIES_VIA_WIFI_DESC, NULL, NULL);
516 typedef struct mainlist_entry mainlist_entry;
518 struct mainlist_entry {
520 Setting_GenGroupItem_Data* (*ui_handler)(void* data, char* title, char* iconpath, char* ugname, Evas_Object *genlist);
525 MAINLIST_ENTRY_FLIGHT_MODE = 0,
528 MAINLIST_ENTRY_MOBILEAP,
529 MAINLIST_ENTRY_ALLSHARE,
530 MAINLIST_ENTRY_NETWORK,
532 MAINLIST_ENTRY_DEFAULT,
536 static mainlist_entry mainlist_table[] = {
537 {KeyStr_FlightMode, __flightmode_handler}, // 0 --> NOT UG
538 {KeyStr_WiFi, __wifi_handler}, // 1 --> UG
539 {KeyStr_Bluetooth, __bluetooth_handler}, // 1 --> UG
540 {KeyStr_MobileAP, __mobileap_handler}, // 1 --> UG
541 {KeyStr_AllShare, __allshare_handler}, // NOT UG
542 {KeyStr_Network, __network_handler}, // 1 --> UG
543 {KeyStr_NFC, __nfc_handler}, // 1 --> UG
544 {"Default", __default_handler}, // 1 --> UG
546 //--------------------------------------------------------------
551 // Flight Mode - not UG
552 // All share - not UG
553 // WiFi - added toggle
559 void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
562 setting_main_appdata *ad = data;
563 //group title, only display in setting main view
564 if (SETTING_VIEW_MAIN == ad->view_load) {
565 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
566 &(ad->itc[GENDIAL_Type_group_item]),
568 ELM_GENLIST_ITEM_NONE,
569 KeyStr_Connectivity, NULL);
572 int idx_second_menu = 0;
575 char *icon_path = NULL;
576 char *ug_args = NULL;
577 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
580 bool is_emulator = isEmulBin();
582 for (i = 0; i < setting_cfg_get_category_length(); i++) {
584 (setting_cfg_get_category_name(i), KeyStr_Connectivity))
587 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
588 keyStr = setting_cfg_get_keyname_idx(i, j);
589 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
590 ug_args = setting_cfg_get_ug_args_idx(i, j);
591 icon_path = setting_cfg_get_icon_path_idx(i, j);
592 /* SETTING_TRACE_DEBUG("Got an item[keyStr:%s, ug_args:%s, pos:%d]", */
593 /* keyStr, ug_args, tmpPos); */
595 if (idx_second_menu < MAX_MORE_MENU_NUM
596 && Cfg_Item_Pos_Level1 == tmpPos
597 && SETTING_VIEW_MAIN == ad->view_load
598 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
600 ad->more_connective_menus[idx_second_menu++] = keyStr;
603 if (Cfg_Item_Pos_Level_All == inputPos) {
604 } else if (inputPos != tmpPos) { /* not in the inputPos level */
609 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) {
610 continue; /* hide Flight Mode in Emulator*/
611 } else if (!safeStrCmp(KeyStr_WiFi, keyStr)) {
612 continue; /* hide WIFI in Emulator*/
613 } else if (!safeStrCmp(KeyStr_MobileAP, keyStr)) {
614 continue; /* hide Tethering in Emulator*/
615 } else if (!safeStrCmp(KeyStr_NFC, keyStr)) {
616 continue; /* hide NFC in Emulator*/
617 } else if (!safeStrCmp(KeyStr_WiFiDirect, keyStr)) {
618 continue; /* hide WiFiDirect in Emulator*/
619 } else if (!safeStrCmp(KeyStr_AllShareCast, keyStr)) {
620 continue; /* hide AllShareCast in Emulator*/
621 } else if (!safeStrCmp(KeyStr_NearbyDevices, keyStr)) {
622 continue; /* hide NearbyDevices in Emulator*/
623 } else if (!safeStrCmp(KeyStr_KeisOverWifi, keyStr)) {
624 continue; /* hide KeisOverWifi in Emulator*/
625 } else if (!safeStrCmp(KeyStr_Synchronise, keyStr)) {
626 continue; /* hide Synchronise in Emulator*/
627 } else if (!safeStrCmp(KeyStr_Network, keyStr)) {
628 continue; /* hide Network in Emulator*/
634 if (!safeStrCmp(KeyStr_FlightMode, keyStr)) { /* load special radio */
636 mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
638 } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) { /* NOT UG */
640 mainlist_table[MAINLIST_ENTRY_ALLSHARE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
642 } else if (!safeStrCmp(KeyStr_WiFi, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
644 mainlist_table[MAINLIST_ENTRY_WIFI].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
646 } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
648 mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
650 } else if (!safeStrCmp(KeyStr_MobileAP, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
652 mainlist_table[MAINLIST_ENTRY_MOBILEAP].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
654 } else if (!safeStrCmp(KeyStr_Network, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special UG */
656 mainlist_table[MAINLIST_ENTRY_NETWORK].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
658 } else if (!safeStrCmp(KeyStr_NFC, keyStr) && is_ug_installed_by_ug_args(ug_args)) { /* load special icon */
659 int nfc_value = FALSE; //default
660 vconf_get_bool(VCONFKEY_NFC_FEATURE, &nfc_value);
661 if (VCONFKEY_NFC_FEATURE_ON == nfc_value)
663 mainlist_table[MAINLIST_ENTRY_NFC].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
665 } else { /* load other UGs */
666 if (is_ug_installed_by_ug_args(ug_args))
668 mainlist_table[MAINLIST_ENTRY_DEFAULT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
674 //end group , only display in setting main view
675 #if SUPPORT_MORE_ITEM_FUNCTION
676 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type)
678 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
680 while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
684 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
686 safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
690 ad->data_moreConnect =
691 setting_create_Gendial_field_groupitem(ad->main_genlist,
692 &(ad->itc[GENDIAL_Type_2text_3]),
694 setting_main_click_list_more_cb,
696 SWALLOW_Type_INVALID,
703 __BACK_POINTER_SET(ad->data_moreConnect);
709 void __load_connectivity_level0_list(void *data)
711 setting_main_appdata *ad = data;
712 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
715 void __load_connectivity_level_all_list(void *data)
718 setting_main_appdata *ad = data;
719 __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
722 void __load_system_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
725 SETTING_TRACE_DEBUG("pos :%d", inputPos);
726 setting_main_appdata *ad = data;
727 //group title, only display in setting main view
728 if (SETTING_VIEW_MAIN == ad->view_load) {
729 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
730 &(ad->itc[GENDIAL_Type_group_item]),
732 ELM_GENLIST_ITEM_NONE,
733 KeyStr_System, NULL);
735 int idx_second_menu = 0;
738 char *icon_path = NULL;
739 char *ug_args = NULL;
741 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
746 bool is_emulator = isEmulBin();
748 //SETTING_TRACE("setting_cfg_get_category_length() :: %d ", setting_cfg_get_category_length());
749 for (i = 0; i < setting_cfg_get_category_length(); i++) {
750 if (safeStrCmp(setting_cfg_get_category_name(i), KeyStr_System))
753 //SETTING_TRACE(" setting_cfg_get_menu_length(%d) :: %d ",i, setting_cfg_get_menu_length(i) );
754 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
755 keyStr = setting_cfg_get_keyname_idx(i, j);
756 /* sg_path = setting_cfg_get_ugpath_idx(i, j); */
757 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
758 icon_path = setting_cfg_get_icon_path_idx(i, j);
759 ug_args = setting_cfg_get_ug_args_idx(i, j);
761 if (idx_second_menu < MAX_MORE_MENU_NUM
762 && Cfg_Item_Pos_Level1 == tmpPos
763 && SETTING_VIEW_MAIN == ad->view_load
764 && MAIN_PROFILE_PREFERRED == ad->profile_type) {
765 ad->more_system_menus[idx_second_menu++] = keyStr;
768 //SETTING_TRACE("KeyString : %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
769 if (Cfg_Item_Pos_Level_All == inputPos) {
771 //SETTING_TRACE("Cfg_Item_Pos_Level_All == inputPos ---> no draw --- WHY?? ");
772 } else if (inputPos != tmpPos) { /* not in the inputPos level */
773 //SETTING_TRACE("inputPos == tmp Pos ---> no draw --- WHY?? ");
778 if (!safeStrCmp(KeyStr_EventsNotifications, keyStr)) {
779 continue; /* hide EventsNotifications in Emulator*/
780 } else if (!safeStrCmp(KeyStr_Security, keyStr)) {
781 continue; /* hide Security in Emulator*/
782 } else if (!safeStrCmp(KeyStr_Motions, keyStr)) {
783 continue; /* hide Motion in Emulator*/
784 } else if (!safeStrCmp(KeyStr_Accessibility, keyStr)) {
785 continue; /* hide Accessibility in Emulator*/
786 } else if (!safeStrCmp(KeyStr_VoiceInOut, keyStr)) {
787 continue; /* hide VoiceInOut in Emulator*/
788 } else if (!safeStrCmp(keystr_Drivingmode, keyStr)) {
789 continue; /* hide Drivingmode in Emulator*/
790 } else if (!safeStrCmp(KeyStr_License, keyStr)) {
791 continue; /* hide License in Emulator*/
792 } else if (!safeStrCmp(KeyStr_Memory, keyStr)) {
793 continue; /* hide Memory in Emulator*/
799 if (!safeStrCmp(KeyStr_Landscape, keyStr)) { /* load special UG */
802 (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
805 ad->data_rotationMode =
806 setting_create_Gendial_field_groupitem(genlist,
807 &(ad->itc[GENDIAL_Type_1text_2icon]),
809 setting_main_sel_list_mouse_up_cb,
811 SWALLOW_Type_1ICON_1RADIO,
817 setting_main_list_mouse_up_cb);
818 __BACK_POINTER_SET(ad->data_rotationMode);
820 else if (!safeStrCmp(KeyStr_Brightness, keyStr)) {
822 char* pa_bright = get_brightness_mode_str();
824 setting_create_Gendial_field_groupitem(genlist,
825 &(ad->itc[GENDIAL_Type_1icon_2text]),
827 setting_main_click_list_ex_ug_cb,
829 SWALLOW_Type_INVALID,
836 __BACK_POINTER_SET(ad->data_bright);
839 else { /* load other UGs */
841 if (is_ug_installed_by_ug_args(ug_args))
843 setting_create_Gendial_field_groupitem(genlist,
844 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
846 setting_main_click_list_ex_ug_cb,
848 SWALLOW_Type_INVALID,
859 //end group, only display in setting main view
860 #if SUPPORT_MORE_ITEM_FUNCTION
861 if (SETTING_VIEW_MAIN == ad->view_load && MAIN_PROFILE_PREFERRED == ad->profile_type)
863 char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
865 while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
869 safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
871 safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
875 ad->data_moreSystem =
876 setting_create_Gendial_field_groupitem(ad->main_genlist,
877 &(ad->itc[GENDIAL_Type_2text_3]),
879 setting_main_click_list_more_cb,
881 SWALLOW_Type_INVALID,
888 __BACK_POINTER_SET(ad->data_moreSystem);
893 static void __load_system_level0_list(void *data)
895 setting_main_appdata *ad = data;
896 __load_system_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
899 static void __load_system_level_all_list(void *data)
902 setting_main_appdata *ad = data;
903 __load_system_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
906 static void __load_applications_menu_list(void *data,
907 Cfg_Item_Position inputPos)
910 SETTING_TRACE_DEBUG("pos :%d", inputPos);
911 setting_main_appdata *ad = data;
914 /* hide all menu in Emulator */
919 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
920 &(ad->itc[GENDIAL_Type_group_item]),
922 ELM_GENLIST_ITEM_NONE,
923 KeyStr_Applications, NULL);
925 char *icon_path = NULL;
926 char *ug_args = NULL;
927 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
930 for (i = 0; i < setting_cfg_get_category_length(); i++) {
932 (setting_cfg_get_category_name(i), KeyStr_Applications))
935 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
936 keyStr = setting_cfg_get_keyname_idx(i, j);
937 icon_path = setting_cfg_get_icon_path_idx(i, j);
938 ug_args = setting_cfg_get_ug_args_idx(i, j);
940 (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
942 if (Cfg_Item_Pos_Level_All == inputPos) {
943 } else if (inputPos != tmpPos) { /* not in the inputPos level */
947 setting_create_Gendial_field_groupitem(ad->main_genlist,
948 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
950 setting_main_click_list_ex_ug_cb,
952 SWALLOW_Type_INVALID,
963 static void __load_applications_level0_list(void *data)
965 setting_main_appdata *ad = data;
966 __load_applications_menu_list(ad, Cfg_Item_Pos_Level0);
969 static void __load_applications_level_all_list(void *data)
972 setting_main_appdata *ad = data;
973 __load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
976 static int __get_downloaded_apps_num(Cfg_Item_Position inputPos)
979 SETTING_TRACE_DEBUG("pos :%d", inputPos);
980 int downloaded_apps_num = 0;
981 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
983 for (i = 0; i < setting_cfg_get_category_length(); i++) {
985 (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
988 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
989 tmpPos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
990 if (Cfg_Item_Pos_Level_All == inputPos) {
991 } else if (inputPos != tmpPos) { /* not in the inputPos level */
995 downloaded_apps_num++;
1001 DIR *dp = opendir (PLUGIN_CFG_DIR);
1005 while (ep = readdir (dp))
1007 if (0 == safeStrCmp(".", ep->d_name)
1008 || 0 == safeStrCmp("..", ep->d_name))
1012 downloaded_apps_num++;
1014 (void) closedir (dp);
1017 SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1018 return downloaded_apps_num;
1021 static void __load_downloaded_apps_menu_list(void *data,
1022 Cfg_Item_Position inputPos)
1024 SETTING_TRACE_BEGIN;
1025 SETTING_TRACE_DEBUG("pos :%d", inputPos);
1026 setting_main_appdata *ad = data;
1028 // if the number of download apps is zero, display a bottom seperator
1029 if (0 == __get_downloaded_apps_num(inputPos)) {
1030 Elm_Object_Item *item = NULL;
1031 item = elm_genlist_item_append(ad->main_genlist, &itc_bottom_seperator, NULL, NULL,
1032 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1033 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1038 setting_create_Gendial_field_group_titleItem(ad->main_genlist,
1039 &(ad->itc[GENDIAL_Type_group_item]),
1041 ELM_GENLIST_ITEM_NONE,
1042 KeyStr_DownloadedAPPs,
1044 char *keyStr = NULL;
1045 char *icon_path = NULL;
1046 char *ug_args = NULL;
1048 Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1050 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1052 (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
1055 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1056 keyStr = setting_cfg_get_keyname_idx(i, j);
1058 (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1059 icon_path = setting_cfg_get_icon_path_idx(i, j);
1060 ug_args = setting_cfg_get_ug_args_idx(i, j);
1062 if (Cfg_Item_Pos_Level_All == inputPos) {
1063 } else if (inputPos != tmpPos) { /* not in the inputPos level */
1067 setting_create_Gendial_field_groupitem(ad->main_genlist,
1068 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1070 setting_main_click_list_ex_ug_cb,
1072 SWALLOW_Type_INVALID,
1082 DIR *dp = opendir (PLUGIN_CFG_DIR);
1089 while (ep = readdir (dp))
1091 memset(fullpath, 0x00, 256);
1092 strncpy(fullpath, PLUGIN_CFG_DIR, 256);
1093 strncat(fullpath, "/", 256);
1094 strncat(fullpath, ep->d_name, 256);
1096 //SETTING_TRACE("ep->d_name:%s", ep->d_name);
1097 if (0 == safeStrCmp(".", ep->d_name)
1098 || 0 == safeStrCmp("..", ep->d_name))
1102 SETTING_TRACE("fullpath: %s", fullpath);
1103 char *p = strrchr(ep->d_name, '.');
1105 setting_create_Gendial_field_groupitem(ad->main_genlist,
1106 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1108 setting_main_click_list_plugin_cb,
1110 SWALLOW_Type_INVALID,
1111 IMG_DefaultIcon, NULL,
1112 0, ep->d_name, NULL,
1116 (void) closedir (dp);
1122 static void __load_downloaded_apps_level0_list(void *data)
1124 setting_main_appdata *ad = data;
1125 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level0);
1128 static void __load_downloaded_apps_level_all_list(void *data)
1130 SETTING_TRACE_BEGIN;
1131 setting_main_appdata *ad = data;
1132 __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level_All);
1135 static void __check_all_view_clear(void *data)
1137 SETTING_TRACE_BEGIN;
1139 setting_main_appdata *ad = data;
1140 if (ad->item_check_list) {
1141 eina_list_free(ad->item_check_list);
1142 ad->item_check_list = NULL;
1145 ad->gl_sel_all = NULL;
1146 ad->edit_preferred_genlist = NULL;
1147 ad->controllbar_all_check = NULL;
1148 ad->check_all_item =NULL;
1151 static void __prefered_buttons_cb(void *data, Evas_Object *obj, void *event_info)
1153 SETTING_TRACE_BEGIN;
1155 setting_main_appdata *ad = (setting_main_appdata *) data;
1156 const char *key = NULL;
1158 #if SUPPORT_BOTTOM_BTNS
1159 ret_if(!event_info);
1160 Elm_Object_Item *it = event_info;
1161 key = elm_object_item_text_get(it);
1163 key = elm_object_text_get(obj);
1165 setting_retm_if(data == NULL
1166 || key == NULL, "data == NULL || key == NULL");
1168 SETTING_TRACE_DEBUG("press button: %s", key);
1171 if (!safeStrCmp(key, dgettext("sys_string", "IDS_COM_SK_DONE"))) {
1173 if (ad->profile_type == MAIN_PROFILE_ALL) {
1174 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1175 setting_try_save_check_list(ad); /* need to save too */
1176 __check_all_view_clear(ad);
1177 elm_naviframe_item_pop(ad->navibar_main); // pop(preferred) --> main
1181 // MAIN_PROFILE_PREFERRED and Etc
1182 // redraw setting-main
1183 setting_try_save_check_list(ad);
1184 elm_naviframe_item_pop(ad->navibar_main); // pop (preferred) -> main
1186 //After the view is popuped, all the object handlers should be reset NULL.
1187 __check_all_view_clear(ad);
1188 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1189 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1190 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1191 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1192 int ret = setting_main_refresh(ad);
1193 ret_if(ret != SETTING_RETURN_SUCCESS);
1198 if (!safeStrCmp(key, setting_gettext("IDS_COM_SK_CANCEL"))
1199 || !safeStrCmp(key, dgettext("sys_string", "IDS_COM_BODY_BACK"))) {
1200 SETTING_TRACE_DEBUG("Cancel to hide current view.");
1201 elm_naviframe_item_pop(ad->navibar_main);
1202 //After the view is popuped, all the object handlers should be reset NULL.
1203 __check_all_view_clear(ad);
1208 static void __setting_contorlbar_clicked(void *data, Evas_Object *obj,
1211 SETTING_TRACE_BEGIN;
1212 ret_if(data == NULL || obj == NULL);
1213 setting_main_appdata *ad = (setting_main_appdata *) data;
1215 /* elm_segment_control_selected_segment_get(obj, &index); */
1216 Elm_Object_Item *sel_item = elm_segment_control_item_selected_get(obj);
1217 ret_if(sel_item == NULL);
1218 index = elm_segment_control_item_index_get(sel_item);
1223 SETTING_TRACE("Preferred");
1224 ad->profile_type = MAIN_PROFILE_PREFERRED;
1225 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1226 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1227 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1228 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1234 SETTING_TRACE("All");
1235 ad->profile_type = MAIN_PROFILE_ALL;
1236 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
1237 ad->load_fns[Func_Type_System] = __load_system_level_all_list;
1238 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1239 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1247 int ret = setting_main_refresh(ad);
1248 ret_if(ret != SETTING_RETURN_SUCCESS);
1251 static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1253 SETTING_TRACE_BEGIN;
1255 setting_main_appdata *ad = (setting_main_appdata *) data;
1256 elm_win_lower(ad->win_main);
1259 static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
1261 SETTING_TRACE_BEGIN;
1262 ret_if(!data || !obj);
1263 setting_main_appdata *ad = (setting_main_appdata *) data;
1264 Elm_Object_Item *item = elm_toolbar_first_item_get(obj);
1267 if (MAIN_PROFILE_ALL == ad->profile_type)
1269 SETTING_TRACE("Change to Preferred view");
1270 elm_object_item_text_set(item, _(ALL_STR));
1271 ad->profile_type = MAIN_PROFILE_PREFERRED;
1272 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1273 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1274 ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
1275 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
1276 setting_main_refresh(ad);
1278 else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
1280 SETTING_TRACE("Change to ALL view");
1281 elm_object_item_text_set(item, _(PREFERRED_STR));
1282 ad->profile_type = MAIN_PROFILE_ALL;
1283 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
1284 ad->load_fns[Func_Type_System] = __load_system_level_all_list;
1285 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1286 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1287 setting_main_refresh(ad);
1298 Evas_Object *__create_main_view_widgets(Evas_Object *win_main, void *cb,
1299 Evas_Object *content,
1301 bool isFoundPreferredItem,
1302 Evas_Object **navibar,
1303 Elm_Object_Item **edit_item,
1304 Elm_Object_Item **segment_all,
1305 Elm_Object_Item **segment_preferred)
1307 SETTING_TRACE_BEGIN;
1309 /* add layout to win_main */
1310 Evas_Object *ly = elm_layout_add(win_main);
1311 setting_retvm_if(ly == NULL, FALSE, "layout == NULL");
1312 elm_layout_theme_set(ly, "layout", "application", "default");
1313 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
1315 elm_win_resize_object_add(win_main, ly);
1316 Evas_Object *bg = setting_create_bg(ly, win_main, "group_list");
1317 elm_object_part_content_set(ly, "elm.swallow.bg", bg);
1318 evas_object_show(ly);
1320 /* add navi_bar to the layout */
1321 Evas_Object *navi_bar = elm_naviframe_add(ly);
1323 elm_object_part_content_set(ly, "elm.swallow.content", navi_bar);
1324 evas_object_show(navi_bar);
1325 *navibar = navi_bar;
1327 // create 'back' button on navigaiton bar
1328 Evas_Object* btn_back = elm_button_add(navi_bar);
1329 evas_object_smart_callback_add(btn_back, "clicked", __btnback_clicked_cb, g_main_ad);
1331 Evas_Object *controlbar = elm_toolbar_add(navi_bar);
1332 setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
1333 elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
1334 //elm_object_style_set(controlbar, NAVI_CONTROLBAR_STYLE);
1336 /* add segment control */
1337 Evas_Object *segment = elm_segment_control_add(controlbar);
1338 setting_retvm_if(segment == NULL, FALSE, "segment == NULL");
1340 Elm_Object_Item *seg_preferred = NULL, *seg_all = NULL;
1341 *segment_preferred = seg_preferred = elm_segment_control_item_add(segment, NULL, _(PREFERRED_STR));
1342 *segment_all = seg_all = elm_segment_control_item_add(segment, NULL, _(ALL_STR));
1344 evas_object_show(segment);
1345 evas_object_smart_callback_add(segment, "changed",
1346 __setting_contorlbar_clicked, cb);
1348 #if !SUPPORT_BOTTOM_BTNS
1349 Elm_Object_Item *item = NULL;
1350 Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, NULL);
1351 elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
1352 /* add 'Edit preffered' button to controlbar */
1353 Evas_Object *btn_pref = setting_create_button(controlbar, _(EDIT_PREFERRED_STR),
1354 NAVI_DEF_BUTTON_STYLE,
1355 setting_main_click_edit_preferred_cb,cb);
1357 *edit_item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1358 elm_object_item_part_content_set(*edit_item, "object", btn_pref);
1359 item = elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1360 elm_object_item_part_content_set(item, "object", segment);
1361 elm_toolbar_item_append(controlbar, NULL, NULL, NULL, NULL);
1363 elm_object_item_part_content_set(navi_it, "optionheader", controlbar);
1365 Elm_Object_Item *navi_it = elm_naviframe_item_push(navi_bar, title_text, btn_back, NULL, content, "segment/instant");
1366 elm_object_style_set(btn_back, NAVI_BACK_BUTTON_STYLE);
1368 elm_object_item_disabled_set(elm_toolbar_item_append(controlbar, NULL, "", NULL, NULL), EINA_TRUE);
1369 *edit_item = elm_toolbar_item_append(controlbar, NULL, _(EDIT_PREFERRED_STR), setting_main_click_edit_preferred_cb, cb);
1371 elm_object_item_part_content_set(navi_it, "controlbar", controlbar);
1372 elm_object_item_part_content_set(navi_it, "segment", segment);
1376 if (isFoundPreferredItem) {
1377 elm_segment_control_item_selected_set(seg_preferred, EINA_TRUE);
1379 elm_segment_control_item_selected_set(seg_all, EINA_TRUE);
1384 static bool __setting_create_main_view(void *data)
1386 SETTING_TRACE_BEGIN;
1388 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1389 setting_main_appdata *ad = (setting_main_appdata *) data;
1390 #if SUPPORT_MORE_ITEM_FUNCTION
1391 ad->ly_main = setting_create_win_layout(ad->win_main, ad->win_main);
1392 ad->navibar_main = setting_create_navi_bar(ad->ly_main);
1393 /* add controlbar */
1394 Evas_Object *controlbar = elm_toolbar_add(ad->navibar_main);
1395 setting_retvm_if(controlbar == NULL, FALSE, "controlbar == NULL");
1396 elm_toolbar_shrink_mode_set(controlbar, ELM_TOOLBAR_SHRINK_EXPAND);
1398 ad->main_genlist = elm_genlist_add(ad->navibar_main);
1399 elm_object_style_set(ad->main_genlist, "dialogue");
1400 retvm_if(ad->main_genlist == NULL, FALSE,
1401 "Cannot set scroller object as contento of layout");
1402 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1404 setting_create_navi_bar_buttons(_("IDS_COM_BODY_SETTINGS"),
1405 _("IDS_COM_BODY_BACK"), "", _("IDS_ST_OPT_ALL"),
1406 __btnback_clicked_cb, NULL,
1407 __allFrequent_btn_cb, ad, ad->main_genlist,
1408 ad->navibar_main, controlbar);
1409 elm_object_item_disabled_set(elm_toolbar_last_item_get(controlbar), EINA_TRUE);
1411 ad->controlbar = controlbar;
1413 ad->profile_type = MAIN_PROFILE_PREFERRED;
1414 ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
1415 ad->load_fns[Func_Type_System] = __load_system_level0_list;
1416 ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
1417 ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
1418 setting_main_refresh(ad);
1422 ad->main_genlist = elm_genlist_add(ad->win_main);
1423 elm_object_style_set(ad->main_genlist, "dialogue");
1424 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1426 int isFoundPreferredItem = FALSE;
1427 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1428 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1429 pos = (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
1430 if (Cfg_Item_Pos_Level0 == pos) {
1431 isFoundPreferredItem = TRUE;
1435 if (isFoundPreferredItem) {
1440 ad->ly_main = __create_main_view_widgets(ad->win_main, ad,
1442 _("IDS_COM_BODY_SETTINGS"),
1443 isFoundPreferredItem,
1447 &ad->segment_preferred);
1448 setting_retvm_if(ad->ly_main == NULL, FALSE, "ad->ly_main == NULL");
1454 static bool __setting_create_prefered_view(void *data)
1456 SETTING_TRACE_BEGIN;
1458 setting_retvm_if(data == NULL, FALSE, "data == NULL");
1459 setting_main_appdata *ad = (setting_main_appdata *) data;
1461 /* the genlist will be destroyed with its parent view, when using elm_naviframe_item_pop() to destroy the view. */
1462 ad->edit_preferred_genlist = elm_genlist_add(ad->win_main);
1463 elm_object_style_set(ad->edit_preferred_genlist, "dialogue");
1464 elm_genlist_clear(ad->edit_preferred_genlist); /* first to clear list */
1466 /* [UI] edit preffered view */
1467 Evas_Object *sub_layout = elm_layout_add(ad->win_main);
1468 elm_object_style_set(sub_layout, "dialogue");
1469 elm_layout_file_set(sub_layout, SETTING_THEME_EDJ_NAME, "search_layout");
1470 evas_object_size_hint_weight_set(sub_layout, EVAS_HINT_EXPAND, 0.0);
1471 evas_object_show(sub_layout);
1473 ad->gl_sel_all = elm_genlist_add(ad->win_main);
1474 elm_genlist_clear(ad->gl_sel_all); /* first to clear list */
1475 elm_genlist_bounce_set(ad->gl_sel_all, 0, 0);
1477 elm_object_part_content_set(sub_layout, "search_bar", ad->gl_sel_all); /* add 'Select all' */
1478 elm_object_part_content_set(sub_layout, "search_list", ad->edit_preferred_genlist); /* add Genlist */
1480 /* push, not create */
1481 setting_push_layout_navi_bar(_(EDIT_PREFERRED_STR),
1482 _("IDS_COM_SK_CANCEL"),
1483 _("IDS_COM_SK_DONE"), NULL,
1484 __prefered_buttons_cb, __prefered_buttons_cb, NULL, ad,
1485 sub_layout, ad->navibar_main,
1486 &(ad->controllbar_all_check));
1491 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
1493 SETTING_TRACE_BEGIN;
1495 setting_main_appdata *ad = user_data;
1496 ad->b_fm_requesting = FALSE;
1497 SETTING_TRACE("result:%d", result);
1501 case TAPI_POWER_FLIGHT_MODE_RESP_ON:
1503 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1504 SETTING_ON_OFF_BTN_ON, &err);
1506 //If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it.
1507 //Otherwise, do nothing
1508 if (FM_LEAVE == ad->fm_waiting_op)
1510 //Send the latest operation
1511 ad->fm_waiting_op = FM_INVALID;
1512 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1513 setting_retm_if(err != TAPI_API_SUCCESS,
1514 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1517 ad->b_fm_requesting = TRUE;
1522 case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
1524 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1525 SETTING_ON_OFF_BTN_OFF, &err);
1527 //If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it.
1528 //Otherwise, do nothing
1529 if (FM_ENTER == ad->fm_waiting_op)
1531 //Send the latest operation
1532 ad->fm_waiting_op = FM_INVALID;
1533 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1534 setting_retm_if(err != TAPI_API_SUCCESS,
1535 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1538 ad->b_fm_requesting = TRUE;
1543 case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
1544 //Setting has a validate operation to process, Send the operation request
1545 if (FM_ENTER == ad->fm_waiting_op)
1547 ad->fm_waiting_op = FM_INVALID;
1548 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
1550 setting_retm_if(err != TAPI_API_SUCCESS,
1551 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
1552 ad->b_fm_requesting = TRUE;
1554 else if (FM_LEAVE == ad->fm_waiting_op)
1556 ad->fm_waiting_op = FM_INVALID;
1557 err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
1559 setting_retm_if(err != TAPI_API_SUCCESS,
1560 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
1561 ad->b_fm_requesting = TRUE;
1563 else //Current requset is the last one, Setting needs to notify user
1565 setting_create_popup_without_btn(ad, ad->win_main,
1566 _("IDS_COM_POP_ERROR"),
1567 _("IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA"),
1568 NULL, POPUP_INTERVAL,
1571 //It is need to rollback the status,
1572 if (ad->data_flight) {
1573 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1574 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1580 ad->b_fm_requesting = TRUE;
1584 case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
1585 setting_create_popup_without_btn(ad, ad->win_main,
1586 _("IDS_COM_POP_ERROR"),
1587 _("IDS_COM_POP_UNEXPECTED_ERROR"),
1588 NULL, POPUP_INTERVAL, FALSE, FALSE);
1590 //It is need to rollback the status,
1591 if (ad->data_flight) {
1592 ad->data_flight->chk_status = !ad->data_flight->chk_status;
1593 elm_check_state_set(ad->data_flight->eo_check, ad->data_flight->chk_status);
1603 static int setting_main_refresh(void *data)
1605 SETTING_TRACE_BEGIN;
1606 setting_main_appdata *ad = (setting_main_appdata *) data;
1607 elm_genlist_clear(ad->main_genlist); /* first to clear list */
1609 if (is_ug_installed_by_ug_args("rcs-config"))
1611 Elm_Object_Item *item = elm_genlist_item_append(ad->main_genlist, &itc_seperator, NULL, NULL,
1612 ELM_GENLIST_ITEM_NONE, NULL, NULL);
1613 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1614 setting_create_Gendial_field_groupitem(ad->main_genlist,
1615 &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1617 setting_main_click_list_ex_ug_cb,
1619 SWALLOW_Type_INVALID,
1621 0, KeyStr_Joyn, NULL,
1626 for(i = Func_Type_Connectivity; i < Func_Type_MAX; i++)
1627 (ad->load_fns[i]) (ad);
1629 memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
1631 return SETTING_RETURN_SUCCESS;
1634 static int setting_main_create(void *cb)
1636 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1638 setting_main_appdata *ad = (setting_main_appdata *) cb;
1640 //pass NULL to let TAPI access default module
1641 ad->handle = tel_init(NULL);
1643 SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***");
1645 SETTING_TRACE("tel_init ok[handle:%p]", ad->handle);
1647 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1648 &(ad->itc[GENDIAL_Type_1text_1icon_2]));
1649 setting_create_Gendial_itc("dialogue/1text.2icon",
1650 &(ad->itc[GENDIAL_Type_1text_2icon]));
1651 setting_create_Gendial_itc("dialogue/2text.1icon.3",
1652 &(ad->itc[GENDIAL_Type_1icon_2text]));
1653 setting_create_Gendial_itc("dialogue/1text.1icon.2",
1654 &(ad->itc[GENDIAL_Type_1text_2icon_2]));
1655 setting_create_Gendial_itc("dialogue/title",
1656 &(ad->itc[GENDIAL_Type_group_item]));
1657 setting_create_Gendial_itc("select_all",
1658 &(ad->itc[GENDIAL_Type_sel_all]));
1660 setting_create_Gendial_itc("dialogue/2text.3", &(ad->itc[GENDIAL_Type_2text_3]));
1662 ad->view_type = SETTING_VIEW_MAIN;
1663 __setting_create_main_view(ad);
1664 setting_view_main.is_create = 1;
1666 return SETTING_RETURN_SUCCESS;
1669 static int setting_main_destroy(void *cb)
1671 SETTING_TRACE_BEGIN;
1673 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1675 setting_main_appdata *ad = (setting_main_appdata *) cb;
1676 if (0 == setting_view_main.is_create)
1679 return SETTING_RETURN_SUCCESS;
1683 int tapi_ret = tel_deinit(ad->handle);
1684 if (tapi_ret != TAPI_API_SUCCESS) {
1685 SETTING_TRACE_DEBUG("*** [ERR] tel_deinit. [%d] ***", tapi_ret);
1687 SETTING_TRACE("*** tel_deinit OK ");
1692 /* then destroy the UI object. */
1693 if (ad->item_check_list) {
1694 eina_list_free(ad->item_check_list);
1695 ad->item_check_list = NULL;
1697 SETTING_TRACE("*** ad->item_check_list is NULL - abnormal state ");
1701 evas_object_del(ad->ly_main);
1705 if (ad->flight_popup) {
1706 evas_object_del(ad->flight_popup);
1707 ad->flight_popup = NULL;
1709 setting_view_main.is_create = 0;
1711 return SETTING_RETURN_SUCCESS;
1714 static int setting_main_update(void *cb)
1716 SETTING_TRACE_BEGIN;
1719 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1721 setting_main_appdata *ad = (setting_main_appdata *) cb;
1723 if (ad->ly_main != NULL) {
1724 //evas_object_show(ad->ly_main);
1727 return SETTING_RETURN_SUCCESS;
1730 static int setting_main_cleanup(void *cb)
1732 SETTING_TRACE_BEGIN;
1734 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1736 setting_main_appdata *ad = (setting_main_appdata *) cb;
1738 if (ad->ly_main != NULL) {
1739 //evas_object_hide(ad->ly_main);
1742 return SETTING_RETURN_SUCCESS;
1745 /* ***************************************************
1749 ***************************************************/
1751 void setting_update_gl_item(void* data)
1753 SETTING_TRACE_BEGIN;
1754 setting_main_appdata *ad = data;
1755 retm_if(!data, "Invalid argument: data is NULL");
1758 Eina_Bool bGlUpdate = EINA_FALSE;
1759 Setting_GenGroupItem_Data *item_to_update = NULL;
1761 for(;nDx<GL_ITEM_MAX; nDx++) {
1762 if(EINA_TRUE == ad->updateItems[nDx]) {
1766 item_to_update = ad->data_wifi;
1767 bGlUpdate = EINA_TRUE;
1770 item_to_update = ad->data_bt;
1771 bGlUpdate = EINA_TRUE;
1774 item_to_update = ad->data_nfc;
1775 bGlUpdate = EINA_TRUE;
1778 item_to_update = ad->data_mobileApp;
1779 bGlUpdate = EINA_TRUE;
1781 case GL_ITEM_FLIGHT:
1782 item_to_update = ad->data_flight;
1783 bGlUpdate = EINA_FALSE;
1789 default: // other case
1793 if (item_to_update) {
1795 SETTING_TRACE("gl update:%d", nDx);
1796 elm_object_item_data_set(item_to_update->item, item_to_update);
1797 elm_genlist_item_update(item_to_update->item);
1799 SETTING_TRACE("chk update:%d", nDx);
1800 elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
1804 ad->updateItems[nDx] = EINA_FALSE;
1805 } // if(EINA_TRUE == ad->updateItems[nDx])
1813 void setting_main_destroy_ug_cb(ui_gadget_h ug, void *priv)
1815 setting_main_appdata *ad = (setting_main_appdata *) priv;
1817 return; /* do nothing if ad is NULL */
1824 setting_main_click_list_item_reset_data(ad, NULL);
1826 // update main genlist in unloading UG
1827 SETTING_TRACE("update main genlist in unloading UG");
1828 setting_update_gl_item(ad);
1833 void setting_main_result_ug_cb(ui_gadget_h ug, service_h service,
1838 SETTING_TRACE_BEGIN;
1843 void setting_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
1846 setting_main_appdata *ad = (setting_main_appdata *) priv;
1851 SETTING_TRACE_BEGIN;
1853 base = (Evas_Object *) ug_get_layout(ug);
1858 case UG_MODE_FULLVIEW:
1859 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
1861 elm_win_resize_object_add(ad->win_main, base);
1862 evas_object_show(base);
1871 /* ***************************************************
1875 ***************************************************/
1877 void setting_main_click_list_item_reset_data(void *data,
1880 SETTING_TRACE_BEGIN;
1881 setting_main_appdata *ad = (setting_main_appdata *) data;
1883 ad->isInUGMode = FALSE;
1888 void /* obj is the layout clicked */
1889 setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
1890 char *ug_to_load, service_h svc,
1893 SETTING_TRACE_BEGIN;
1894 setting_main_appdata *ad = (setting_main_appdata *) data;
1896 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
1900 char ug_file[PATH_MAX];
1902 (ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH,
1905 SETTING_TRACE("ug_file:%s", ug_file);
1906 if (!ecore_file_exists(ug_file)) {
1907 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
1911 SETTING_TRACE("to create libug-%s.so", ug_to_load);
1912 ad->ug = ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
1914 ad->isInUGMode = TRUE;
1917 evas_object_show(ad->ly_main);
1919 SETTING_TRACE_ERROR("errno:%d", errno);
1920 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
1926 setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj,
1929 setting_main_appdata *ad = data;
1930 setting_create_simple_popup(ad, ad->win_main, NULL,
1935 setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
1937 SETTING_TRACE_BEGIN;
1938 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1942 char *str_text = USB_NEED_OFF;
1944 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1946 setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
1949 SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
1950 setting_main_click_list_ex_ug_cb(data, obj, item);
1954 /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
1955 if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB)
1957 elm_genlist_item_selected_set(item, EINA_FALSE);
1958 setting_create_simple_popup(g_main_ad, g_main_ad->win_main, NULL, (str_text));
1962 setting_main_click_list_ex_ug_cb(data, obj, item);
1968 void setting_main_click_list_more_cb(void *data, Evas_Object *obj, void *event_info)
1970 SETTING_TRACE_BEGIN;
1971 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1972 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1973 elm_genlist_item_selected_set(item, EINA_FALSE);
1974 retm_if(data == NULL, "Invalid argument: data is NULL");
1975 setting_main_appdata *ad = data;
1976 Setting_GenGroupItem_Data *selected_item_data =
1977 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1978 SETTING_TRACE("selected_item_data->keyStr:%s", selected_item_data->keyStr);
1979 if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreConnect))
1981 ad->view_load = SETTING_VIEW_CONNECTIVE_MORE;
1983 else if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreSystem))
1985 ad->view_load = SETTING_VIEW_SYSTEM_MORE;
1991 setting_view_change(&setting_view_main, &setting_view_more_menu, ad);
1996 setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
1999 SETTING_TRACE_BEGIN;
2000 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2001 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2003 elm_genlist_item_selected_set(item, EINA_FALSE);
2005 if (g_main_ad->ug) {
2007 ("[ad->ug non-NULL]skip genlist click event!!");
2013 if (NULL == data) { /* pass NULL to ug_args when create setting.cfg. */
2014 setting_create_simple_popup(g_main_ad,
2015 g_main_ad->win_main,
2016 NULL, NO_UG_FOUND_MSG);
2021 setting_main_appdata *ad = g_main_ad;
2023 /* if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
2024 if (ad->isInUGMode) {
2025 SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
2026 ad->isInUGMode = FALSE;
2031 ("isInUGMode : FALSE - another UG is NOT running now.")
2034 Setting_GenGroupItem_Data *selected_item_data =
2035 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2036 setting_main_click_list_item_reset_data(ad, obj);
2037 const char *item_name = _(selected_item_data->keyStr);
2040 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2041 setting_retm_if(!cbs, "calloc failed");
2042 cbs->layout_cb = setting_main_layout_ug_cb;
2043 cbs->result_cb = setting_main_result_ug_cb;
2044 cbs->destroy_cb = setting_main_destroy_ug_cb;
2045 cbs->priv = (void *)ad;
2047 char *path = get_ug_path_from_ug_args(data);
2048 service_h svc = get_bundle_from_ug_args(data);
2049 setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
2056 service_destroy(svc);
2059 setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
2062 SETTING_TRACE_BEGIN;
2063 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2064 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2065 elm_genlist_item_selected_set(item, EINA_FALSE);
2067 setting_plugin_load((const char *)data);
2071 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
2074 SETTING_TRACE_BEGIN;
2075 retm_if(data == NULL, "Data parameter is NULL");
2076 Setting_GenGroupItem_Data *list_item =
2077 (Setting_GenGroupItem_Data *) data;
2078 SETTING_TRACE("process item [%s]", list_item->keyStr);
2079 list_item->chk_status = elm_check_state_get(eo); /* for update new state */
2081 SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
2082 list_item->chk_status);
2083 /*setting_main_appdata *ad = g_main_ad;*/
2085 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2087 if (elm_check_state_get(eo)) {
2088 setting_set_bool_slp_key
2089 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2090 SETTING_ON_OFF_BTN_ON, &err);
2092 setting_set_bool_slp_key
2093 (BOOL_SLP_SETTING_USE_PACKET_DATA,
2094 SETTING_ON_OFF_BTN_OFF, &err);
2097 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2098 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, ! list_item->chk_status);
2104 void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
2107 SETTING_TRACE_BEGIN;
2108 setting_retm_if(data == NULL, "Data parameter is NULL");
2110 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2111 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2112 elm_genlist_item_selected_set(item, 0);
2113 Setting_GenGroupItem_Data *list_item =
2114 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2116 list_item->chk_status = elm_check_state_get(list_item->eo_check);
2119 /*setting_main_appdata *ad = (setting_main_appdata *) data;*/
2121 if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2122 /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
2124 setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA,
2125 list_item->chk_status, &err);
2127 } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2128 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, (list_item->chk_status));
2134 void __alternate_flight_mode(Evas_Object *check)
2136 SETTING_TRACE_BEGIN;
2138 Eina_Bool status = elm_check_state_get(check);
2139 SETTING_TRACE("flight mode status : %d", status);
2140 setting_main_appdata *ad = g_main_ad;
2142 //Check whether some requestion is processing by TAPI
2143 if (ad->b_fm_requesting)
2145 //Do nothing, just mark the lastest operation..
2146 SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
2147 ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
2151 //otherwise, invalid waiting operation and send requsetion to TAPI:
2152 ad->fm_waiting_op = FM_INVALID;
2154 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2155 setting_retm_if(ret != TAPI_API_SUCCESS,
2156 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2158 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2159 setting_retm_if(ret != TAPI_API_SUCCESS,
2160 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2164 ad->b_fm_requesting = TRUE;
2169 setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj,
2172 SETTING_TRACE_BEGIN;
2173 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2174 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2176 elm_genlist_item_selected_set(item, EINA_FALSE);
2178 if (g_main_ad->ug) {
2180 ("[ad->ug non-NULL]skip genlist click event!!");
2186 setting_main_appdata *ad = g_main_ad;
2187 setting_main_click_list_item_reset_data(ad, obj);
2191 setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2192 SETTING_TRACE("value:%d", value);
2194 case VCONFKEY_TELEPHONY_SIM_INSERTED:
2196 struct ug_cbs *cbs =
2197 (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2198 setting_retm_if(!cbs, "calloc failed");
2199 cbs->layout_cb = setting_main_layout_ug_cb;
2200 cbs->result_cb = setting_main_result_ug_cb;
2201 cbs->destroy_cb = setting_main_destroy_ug_cb;
2202 cbs->priv = (void *)ad;
2203 setting_main_click_list_item_ug_cb(data, obj,
2204 "setting-network-efl",
2209 case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
2210 setting_create_simple_popup(NULL, ad->win_main,
2211 NULL, _("IDS_ST_HEADER_INSERT_SIM_CARD_ABB"));
2212 SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
2213 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2216 case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
2217 case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
2218 setting_create_simple_popup(NULL, ad->win_main,
2219 NULL,_("IDS_COM_BODY_INVALID_SIM_CARD"));
2220 SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
2221 SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2231 setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj,
2235 setting_retm_if(data == NULL, "Data parameter is NULL");
2237 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2238 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2239 elm_genlist_item_selected_set(item, 0);
2240 Setting_GenGroupItem_Data *list_item =
2241 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2242 int old_status = elm_check_state_get(list_item->eo_check);
2244 list_item->chk_status = !old_status;
2245 elm_check_state_set(list_item->eo_check, list_item->chk_status);
2247 __alternate_flight_mode(list_item->eo_check);
2252 setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2255 SETTING_TRACE_BEGIN;
2256 retm_if(data == NULL, "Data parameter is NULL");
2257 Setting_GenGroupItem_Data *list_item =
2258 (Setting_GenGroupItem_Data *) data;
2259 list_item->chk_status = elm_check_state_get(obj); /* for update new state */
2260 SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2261 list_item->chk_status);
2263 __alternate_flight_mode(obj);
2269 * store current selection in setting.cfg
2271 void setting_try_save_check_list(void *data)
2273 SETTING_TRACE_BEGIN;
2274 setting_main_appdata *ad = (setting_main_appdata *) data;
2276 Eina_List *check_list = ad->item_check_list;
2277 Setting_GenGroupItem_Data *list_item = NULL;
2278 int update_count = 0;
2280 while (check_list) {
2281 list_item = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list);
2282 if (NULL == list_item) continue;
2285 if (list_item->chk_status) {
2286 /* to update config file */
2287 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level0);
2289 /* to update config file */
2290 setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level1);
2292 check_list = eina_list_next(check_list);
2295 if (update_count == 0) {
2296 /* to popup tips notify */
2298 setting_cfg_file_update();
2304 setting_main_click_edit_preferred_cb(void *data, Evas_Object *obj, void *event_info)
2306 SETTING_TRACE_BEGIN;
2308 setting_main_appdata *ad = (setting_main_appdata *) data;
2309 ad->view_type = SETTING_VIEW_ALL_CHECK;
2310 __setting_create_prefered_view(ad);
2311 __load_check_list(ad, &(ad->edit_preferred_genlist), NULL);