[Feature] Hide Network, Date and time > Automatic update, and set the conf of Automat...
[apps/core/preloaded/settings.git] / src / setting-main.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #include <tapi_common.h>
23 #include <aul.h>
24 #include <time.h>
25 #include <setting-main.h>
26 #include <setting-plugin.h>
27
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);
32
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,
38 };
39
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,
44                                                            Evas_Object *obj,
45                                                            void *event_info);
46 static void __alternate_flight_mode(Evas_Object *check);
47
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);
49
50 setting_main_appdata *g_main_ad;
51 static void
52 __setting_chk_changed(void *data, Evas_Object *obj, void *event_info)
53 {
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);
60
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;
65         while (check_list) {
66                 item = (Setting_GenGroupItem_Data *)
67                     eina_list_data_get(check_list);
68                 if (NULL == item) {
69                         continue;
70                 }
71                 if (!(item->chk_status)) {
72                         isFoundNotSelSomeone = TRUE;
73                 } else {
74                         isFoundSelSomeone = TRUE;
75                 }
76                 if (isFoundNotSelSomeone && isFoundSelSomeone) {
77                         break;
78                 }
79                 check_list = eina_list_next(check_list);
80         }
81
82         if (isFoundNotSelSomeone) {
83                 g_main_ad->check_all_item->chk_status = 0;      /* for update new state */
84         } else {
85                 g_main_ad->check_all_item->chk_status = 1;      /* for update new state */
86         }
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);
89
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),
94                                                  EINA_FALSE);
95         }
96 }
97
98 static void __setting_list_changed(void *data, Evas_Object *obj,
99                                    void *event_info)
100 {
101
102         SETTING_TRACE_BEGIN;
103         /* error check */
104         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
105
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);
110
111         int old_status = elm_check_state_get(list_item->eo_check);
112         /* new status */
113         list_item->chk_status = !old_status;
114         elm_check_state_set(list_item->eo_check, list_item->chk_status);
115
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;
120         while (check_list) {
121                 group_item = (Setting_GenGroupItem_Data *)
122                     eina_list_data_get(check_list);
123                 if (NULL == group_item) {
124                         continue;
125                 }
126                 if (!(group_item->chk_status)) {
127                         isFoundNotSelSomeone = TRUE;
128                         /* break; */
129                 } else {
130                         isFoundSelSomeone = TRUE;
131                 }
132                 if (isFoundNotSelSomeone && isFoundSelSomeone) {
133                         break;
134                 }
135
136                 check_list = eina_list_next(check_list);
137         }
138
139         if (isFoundNotSelSomeone) {
140                 g_main_ad->check_all_item->chk_status = 0;      /* for update new state */
141         } else {
142                 g_main_ad->check_all_item->chk_status = 1;      /* for update new state */
143         }
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);
146
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),
151                                                  EINA_FALSE);
152         }
153
154 }
155
156 static void
157 __setting_chk_sel_all_changed(void *data, Evas_Object *obj, void *event_info)
158 {
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); */
166
167         Eina_List *check_list = g_main_ad->item_check_list;
168
169         while (check_list) {
170                 list_item = (Setting_GenGroupItem_Data *)
171                     eina_list_data_get(check_list);
172                 if (NULL == list_item) {
173                         continue;
174                 }
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);
179         }
180         if (is_all_checked) {
181                 elm_object_item_disabled_set(elm_toolbar_last_item_get
182                                                  (g_main_ad->controllbar_all_check),
183                                                  EINA_FALSE);
184         }
185 }
186
187 static void __setting_list_sel_all_changed(void *data, Evas_Object *obj,
188                                            void *event_info)
189 {
190         /* error check */
191         SETTING_TRACE_BEGIN;
192         SETTING_TRACE();
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);
198
199         int old_status = elm_check_state_get(list_item->eo_check);
200         /* new status */
201         int is_all_checked = list_item->chk_status = !old_status;
202         elm_check_state_set(list_item->eo_check, list_item->chk_status);
203
204         Eina_List *check_list = g_main_ad->item_check_list;
205
206         while (check_list) {
207                 list_item = (Setting_GenGroupItem_Data *)
208                     eina_list_data_get(check_list);
209                 if (NULL == list_item) {
210                         continue;
211                 }
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);
217         }
218         if (is_all_checked) {
219                 elm_object_item_disabled_set(elm_toolbar_last_item_get
220                                                  (g_main_ad->controllbar_all_check),
221                                                  EINA_FALSE);
222         }
223
224 }
225
226 static void __load_check_list(void *data, Evas_Object **genlist,
227                               char *menuNameKey)
228 {
229         SETTING_TRACE_BEGIN;
230         setting_main_appdata *ad = (setting_main_appdata *) data;
231
232         bool state = FALSE;
233         char *keyStr = NULL;
234         Cfg_Item_Position pos = Cfg_Item_Pos_Uninstall;
235         bool isFoundNonSelItem = FALSE;
236         bool isFoundSelSomeoneItem = FALSE;
237
238         int i, j;
239         char *icon_path = NULL;
240
241         ad->check_all_item =
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);
249
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"); */
255                 } else
256                     if (safeStrCmp
257                         (setting_cfg_get_category_name(i), menuNameKey)) {
258                         continue;
259                 }
260                 char *category_name = setting_cfg_get_category_name(i);
261
262                 category_item =
263                     setting_create_Gendial_field_group_titleItem(*genlist,
264                                                                  &(ad->itc
265                                                                    [GENDIAL_Type_group_item]),
266                                                                  NULL,
267                                                                  ELM_GENLIST_ITEM_NONE,
268                                                                  category_name,
269                                                                  NULL);
270                 if (category_item) {
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);
274
275                                 if (Cfg_Item_Pos_Level1 == pos) {
276                                         state = FALSE;
277                                         isFoundNonSelItem = TRUE;
278                                 } else {
279                                         state = TRUE;
280                                         isFoundSelSomeoneItem = TRUE;
281                                 }
282
283                         icon_path = setting_cfg_get_icon_path_idx(i, j);
284                         item =
285                             setting_create_Gendial_field_groupitem(*genlist,
286                                                                    &(ad->itc
287                                                                      [GENDIAL_Type_1text_2icon_2]),
288                                                                    category_item->item,
289                                                                    __setting_list_changed,
290                                                                    ad,
291                                                                    SWALLOW_Type_1CHECKICON,
292                                                                    NULL,
293                                                                    icon_path,
294                                                                    state,
295                                                                    keyStr, NULL,
296                                                                    __setting_chk_changed);
297
298                                 ad->item_check_list =
299                                     eina_list_append(ad->item_check_list, item);
300                         }
301                 } else {
302                         SETTING_TRACE_ERROR("category_item is NULL");
303                 }
304         }
305
306         if (ad->check_all_item) {
307                 if (isFoundNonSelItem) {
308                         ad->check_all_item->chk_status = 0;     /* for update new state */
309                 } else {
310                         ad->check_all_item->chk_status = 1;     /* for update new state */
311                 }
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);
314         } else {
315                 SETTING_TRACE_ERROR("ad->check_all_item is NULL");
316         }
317
318         if (isFoundSelSomeoneItem) {
319                 elm_object_item_disabled_set(elm_toolbar_last_item_get
320                                                  (ad->controllbar_all_check),
321                                                  EINA_FALSE);
322         } else {
323                 elm_object_item_disabled_set(elm_toolbar_last_item_get
324                                                  (ad->controllbar_all_check),
325                                                  EINA_TRUE);
326         }
327         SETTING_TRACE_END;
328 }
329
330
331 static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist)
332 {
333         // NOT UG --> it's just UI drawing
334
335         setting_main_appdata *ad = (setting_main_appdata *)data;
336         int value, err;
337         setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
338
339         /* create flight_mode */
340         ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
341                                                    &(ad->itc[GENDIAL_Type_1text_2icon]),
342                                                    NULL,
343                                                    setting_main_click_Gendial_list_flight_mode_cb,
344                                                    ad,
345                                                    SWALLOW_Type_1ICON_1RADIO,
346                                                    icon_path,
347                                                    NULL,
348                                                    value,
349                                                    keyStr,
350                                                    NULL,
351                                                    setting_main_click_list_flight_mode_cb);
352         __BACK_POINTER_SET(ad->data_flight);
353
354         return ad->data_flight;
355 }
356
357 static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
358 {
359         setting_main_appdata *ad = (setting_main_appdata *)data;
360
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]),
364                                                    NULL,
365                                                    setting_main_click_list_ex_ug_cb,
366                                                    ug_args,
367                                                    SWALLOW_Type_INVALID,
368                                                    icon_path,
369                                                    NULL,
370                                                    0,
371                                                    keyStr,
372                                                    pa_wifi,
373                                                    NULL);
374         __BACK_POINTER_SET(ad->data_wifi);
375         G_FREE(pa_wifi);
376
377         return ad->data_wifi;
378 }
379
380 static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
381 {
382         setting_main_appdata *ad = (setting_main_appdata *)data;
383
384         ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
385                                                    &(ad->itc[GENDIAL_Type_1icon_2text]),
386                                                    NULL,
387                                                    setting_main_click_list_ex_ug_cb,
388                                                    ug_args,
389                                                    SWALLOW_Type_INVALID,
390                                                    icon_path,
391                                                    NULL,
392                                                    0,
393                                                    keyStr,
394                                                    get_BT_on_off_str
395                                                    (),
396                                                    NULL);
397         __BACK_POINTER_SET(ad->data_bt);
398
399         return ad->data_bt;
400 }
401
402 static Setting_GenGroupItem_Data * __mobileap_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
403 {
404         setting_main_appdata *ad = (setting_main_appdata *)data;
405
406         ad->data_mobileApp = setting_create_Gendial_field_groupitem(genlist,
407                                                    &(ad->itc[GENDIAL_Type_1icon_2text]),
408                                                    NULL,
409                                                    setting_main_click_list_ex_ug_cb,
410                                                    ug_args,
411                                                    SWALLOW_Type_INVALID,
412                                                    icon_path,
413                                                    NULL,
414                                                    0,
415                                                    keyStr,
416                                                    get_Mobile_AP_on_off_str
417                                                    (),
418                                                    NULL);
419         __BACK_POINTER_SET(ad->data_mobileApp);
420
421         return ad->data_mobileApp;
422 }
423
424 static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
425 {
426         setting_main_appdata *ad = (setting_main_appdata *)data;
427
428         Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
429                                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
430                                                                    NULL,
431                                                                    setting_main_click_list_default_ug_cb,
432                                                                    ad,
433                                                                    SWALLOW_Type_INVALID,
434                                                                    icon_path,
435                                                                    NULL, 0,
436                                                                    keyStr,
437                                                                    NULL,
438                                                                    NULL);
439         return obj;
440 }
441
442 static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
443 {
444         setting_main_appdata *ad = (setting_main_appdata *)data;
445
446         Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
447                                                                        &(ad->itc[GENDIAL_Type_1text_1icon_2]),
448                                                                        NULL,
449                                                                        setting_main_click_list_network_ug_cb,
450                                                                        ad,
451                                                                        SWALLOW_Type_INVALID,
452                                                                        icon_path,
453                                                                        NULL, 0,
454                                                                        keyStr,
455                                                                        NULL,
456                                                                        NULL);
457
458         return obj;
459 }
460
461 static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
462 {
463         setting_main_appdata *ad = (setting_main_appdata *)data;
464
465         ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
466                                                    &(ad->itc[GENDIAL_Type_1icon_2text]),
467                                                    NULL,
468                                                    setting_main_click_list_ex_ug_cb,
469                                                    ug_args,
470                                                    SWALLOW_Type_INVALID,
471                                                    icon_path,
472                                                    NULL,
473                                                    0,
474                                                    keyStr,
475                                                    get_NFC_on_off_str(),
476                                                    NULL);
477         __BACK_POINTER_SET(ad->data_nfc);
478
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);
482
483         return ad->data_nfc;
484 }
485
486 static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist)
487 {
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]),
491                                                            NULL,
492                                                            setting_main_click_list_ex_ug_cb,
493                                                            ug_args,
494                                                            SWALLOW_Type_INVALID,
495                                                            icon_path,
496                                                            NULL, 0,
497                                                            keyStr,
498                                                            NULL,
499                                                            NULL);
500
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);
509         } else {
510                 /* do nothing */
511         }
512
513         return obj;
514 }
515
516 typedef struct mainlist_entry mainlist_entry;
517
518 struct mainlist_entry {
519         char* title;
520         Setting_GenGroupItem_Data* (*ui_handler)(void* data, char* title, char* iconpath, char* ugname, Evas_Object *genlist);
521 };
522
523
524 enum {
525         MAINLIST_ENTRY_FLIGHT_MODE = 0,
526         MAINLIST_ENTRY_WIFI,
527         MAINLIST_ENTRY_BT,
528         MAINLIST_ENTRY_MOBILEAP,
529         MAINLIST_ENTRY_ALLSHARE,
530         MAINLIST_ENTRY_NETWORK,
531         MAINLIST_ENTRY_NFC,
532         MAINLIST_ENTRY_DEFAULT,
533         MAINLIST_ENTRY_MAX,
534 };
535
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
545
546                 //--------------------------------------------------------------
547                 {NULL, NULL},
548         };
549
550
551 // Flight Mode  - not UG
552 // All share    - not UG
553 // WiFi                 - added toggle
554 // Bluetooth
555 // Mobile AP
556 // Network
557 // NFC
558 // Other UGs
559 void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
560 {
561         SETTING_TRACE_BEGIN;
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]),
567                                                      NULL,
568                                                      ELM_GENLIST_ITEM_NONE,
569                                                      KeyStr_Connectivity, NULL);
570         }
571
572         int idx_second_menu = 0;
573         
574         char *keyStr = NULL;
575         char *icon_path = NULL;
576         char *ug_args = NULL;
577         Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
578         int i, j;
579
580         bool is_emulator = isEmulBin();
581
582         for (i = 0; i < setting_cfg_get_category_length(); i++) {
583                 if (safeStrCmp
584                     (setting_cfg_get_category_name(i), KeyStr_Connectivity))
585                         continue;
586
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); */
594                         
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) {
599                             
600                                 ad->more_connective_menus[idx_second_menu++] = keyStr;
601                         }
602
603                         if (Cfg_Item_Pos_Level_All == inputPos) {
604                         } else if (inputPos != tmpPos) {        /* not in the inputPos level */
605                                 continue;
606                         }
607
608                         if (is_emulator) {
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*/
629                                 }else {
630                                         /* do nothing */
631                                 }
632                         }
633
634                         if (!safeStrCmp(KeyStr_FlightMode, keyStr)) {   /* load special radio */
635                                 // ug == NULL
636                                 mainlist_table[MAINLIST_ENTRY_FLIGHT_MODE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
637
638                         } else if (!safeStrCmp(KeyStr_AllShare, keyStr)) {      /* NOT UG */
639
640                                 mainlist_table[MAINLIST_ENTRY_ALLSHARE].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
641
642                         } else if (!safeStrCmp(KeyStr_WiFi, keyStr) && is_ug_installed_by_ug_args(ug_args)) {   /* load special icon */
643
644                                 mainlist_table[MAINLIST_ENTRY_WIFI].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
645
646                         } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr) && is_ug_installed_by_ug_args(ug_args)) {      /* load special icon */
647
648                                 mainlist_table[MAINLIST_ENTRY_BT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
649
650                         } else if (!safeStrCmp(KeyStr_MobileAP, keyStr) && is_ug_installed_by_ug_args(ug_args)) {       /* load special icon */
651
652                                 mainlist_table[MAINLIST_ENTRY_MOBILEAP].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
653
654                         } else if (!safeStrCmp(KeyStr_Network, keyStr) && is_ug_installed_by_ug_args(ug_args)) {        /* load special UG */
655
656                                 mainlist_table[MAINLIST_ENTRY_NETWORK].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
657
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)
662                                 {
663                                         mainlist_table[MAINLIST_ENTRY_NFC].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
664                                 }
665                         } else {        /* load other UGs */
666                                 if (is_ug_installed_by_ug_args(ug_args))
667                                 {
668                                         mainlist_table[MAINLIST_ENTRY_DEFAULT].ui_handler(ad, keyStr, icon_path, ug_args, genlist);
669                                 }
670                         }
671                 }
672         }
673
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)
677                 {
678                         char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
679                         int idx = 0;
680                         while (idx < MAX_MORE_MENU_NUM && ad->more_connective_menus[idx])
681                         {
682                                 if (idx != 0)
683                                 {
684                                         safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
685                                 }
686                                 safeStrNCat(sub_text, _(ad->more_connective_menus[idx]), MAX_COMMON_BUFFER_LEN);
687                                 idx++;
688                         }
689
690                         ad->data_moreConnect =
691                                 setting_create_Gendial_field_groupitem(ad->main_genlist,
692                                                                        &(ad->itc[GENDIAL_Type_2text_3]),
693                                                                        NULL,
694                                                                        setting_main_click_list_more_cb,
695                                                                        ad,
696                                                                        SWALLOW_Type_INVALID,
697                                                                        NULL,
698                                                                        NULL,
699                                                                        0,
700                                                                        KeyStr_MoreConnect,
701                                                                        sub_text,
702                                                                        NULL);
703                         __BACK_POINTER_SET(ad->data_moreConnect);
704                 }
705 #endif
706         SETTING_TRACE_END;
707 }
708
709 void __load_connectivity_level0_list(void *data)
710 {
711         setting_main_appdata *ad = data;
712         __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
713 }
714
715 void __load_connectivity_level_all_list(void *data)
716 {
717         SETTING_TRACE_BEGIN;
718         setting_main_appdata *ad = data;
719         __load_connectivity_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
720 }
721
722 void __load_system_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object *genlist)
723 {
724         SETTING_TRACE_BEGIN;
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]),
731                                                      NULL,
732                                                      ELM_GENLIST_ITEM_NONE,
733                                                      KeyStr_System, NULL);
734         }
735         int idx_second_menu = 0;
736
737         char *keyStr = NULL;
738         char *icon_path = NULL;
739         char *ug_args = NULL;
740
741         Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
742
743         int ncount = 0;
744         int i, j;
745
746         bool is_emulator = isEmulBin();
747
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))
751                         continue;
752
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);
760
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;
766                         }
767
768                         //SETTING_TRACE("KeyString :  %s , tmpPos : %d , inputPos : %d ", keyStr, tmpPos, inputPos );
769                         if (Cfg_Item_Pos_Level_All == inputPos) {
770                                 // do nothing
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?? ");
774                                 continue;
775                         }
776
777                         if (is_emulator) {
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*/
794                                 } else {
795                                         /* do nothing */
796                                 }
797                         }
798
799                         if (!safeStrCmp(KeyStr_Landscape, keyStr)) {    /* load special UG */
800                                 int value = 0;
801                                 vconf_get_bool
802                                     (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
803                                 value = !value;
804
805                                 ad->data_rotationMode =
806                                     setting_create_Gendial_field_groupitem(genlist,
807                                                                            &(ad->itc[GENDIAL_Type_1text_2icon]),
808                                                                            NULL,
809                                                                            setting_main_sel_list_mouse_up_cb,
810                                                                            ad,
811                                                                            SWALLOW_Type_1ICON_1RADIO,
812                                                                            icon_path,
813                                                                            NULL,
814                                                                            value,
815                                                                            keyStr,
816                                                                            NULL,
817                                                                            setting_main_list_mouse_up_cb);
818                                 __BACK_POINTER_SET(ad->data_rotationMode);
819                         }
820                         else if (!safeStrCmp(KeyStr_Brightness, keyStr)) {
821
822                                 char* pa_bright = get_brightness_mode_str();
823                                 ad->data_bright=
824                                     setting_create_Gendial_field_groupitem(genlist,
825                                                                            &(ad->itc[GENDIAL_Type_1icon_2text]),
826                                                                            NULL,
827                                                                            setting_main_click_list_ex_ug_cb,
828                                                                            ug_args,
829                                                                            SWALLOW_Type_INVALID,
830                                                                            icon_path,
831                                                                            NULL,
832                                                                            0,
833                                                                            keyStr,
834                                                                            pa_bright,
835                                                                            NULL);
836                                 __BACK_POINTER_SET(ad->data_bright);
837                                 ncount++;
838                         }
839                         else {  /* load other UGs */
840
841                                 if (is_ug_installed_by_ug_args(ug_args))
842                                 {
843                                         setting_create_Gendial_field_groupitem(genlist,
844                                                                                &(ad->itc[GENDIAL_Type_1text_1icon_2]),
845                                                                                NULL,
846                                                                                setting_main_click_list_ex_ug_cb,
847                                                                                ug_args,
848                                                                                SWALLOW_Type_INVALID,
849                                                                                icon_path,
850                                                                                NULL, 0,
851                                                                                keyStr,
852                                                                                NULL,
853                                                                                NULL);
854                                         ncount++;
855                                 }
856                         }
857                 }
858         }
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)
862                 {
863                         char sub_text[MAX_COMMON_BUFFER_LEN] = {0, };
864                         int idx = 0;
865                         while (idx < MAX_MORE_MENU_NUM && ad->more_system_menus[idx])
866                         {
867                                 if (idx != 0)
868                                 {
869                                         safeStrNCat(sub_text, ", ", MAX_COMMON_BUFFER_LEN);
870                                 }
871                                 safeStrNCat(sub_text, _(ad->more_system_menus[idx]), MAX_COMMON_BUFFER_LEN);
872                                 idx++;
873                         }
874                         
875                         ad->data_moreSystem =
876                                 setting_create_Gendial_field_groupitem(ad->main_genlist,
877                                                                        &(ad->itc[GENDIAL_Type_2text_3]),
878                                                                        NULL,
879                                                                        setting_main_click_list_more_cb,
880                                                                        ad,
881                                                                        SWALLOW_Type_INVALID,
882                                                                        NULL,
883                                                                        NULL,
884                                                                        0,
885                                                                        KeyStr_MoreSystem,
886                                                                        sub_text,
887                                                                        NULL);
888                         __BACK_POINTER_SET(ad->data_moreSystem);
889                 }
890 #endif
891 }
892
893 static void __load_system_level0_list(void *data)
894 {
895         setting_main_appdata *ad = data;
896         __load_system_menu_list(ad, Cfg_Item_Pos_Level0, ad->main_genlist);
897 }
898
899 static void __load_system_level_all_list(void *data)
900 {
901         SETTING_TRACE_BEGIN;
902         setting_main_appdata *ad = data;
903         __load_system_menu_list(ad, Cfg_Item_Pos_Level_All, ad->main_genlist);
904 }
905
906 static void __load_applications_menu_list(void *data,
907                                           Cfg_Item_Position inputPos)
908 {
909         SETTING_TRACE_BEGIN;
910         SETTING_TRACE_DEBUG("pos :%d", inputPos);
911         setting_main_appdata *ad = data;
912
913         if (isEmulBin()) {
914                 /* hide all menu in Emulator */
915                 return;
916         }
917
918         //group title
919         setting_create_Gendial_field_group_titleItem(ad->main_genlist,
920                                                      &(ad->itc[GENDIAL_Type_group_item]),
921                                                      NULL,
922                                                      ELM_GENLIST_ITEM_NONE,
923                                                      KeyStr_Applications, NULL);
924         char *keyStr = NULL;
925         char *icon_path = NULL;
926         char *ug_args = NULL;
927         Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
928         int i, j;
929
930         for (i = 0; i < setting_cfg_get_category_length(); i++) {
931                 if (safeStrCmp
932                     (setting_cfg_get_category_name(i), KeyStr_Applications))
933                         continue;
934
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);
939                         tmpPos =
940                             (Cfg_Item_Position) setting_cfg_get_pos_idx(i, j);
941
942                         if (Cfg_Item_Pos_Level_All == inputPos) {
943                         } else if (inputPos != tmpPos) {        /* not in the inputPos level */
944                                 continue;
945                         }
946
947                         setting_create_Gendial_field_groupitem(ad->main_genlist,
948                                                                &(ad->itc[GENDIAL_Type_1text_1icon_2]),
949                                                                NULL,
950                                                                setting_main_click_list_ex_ug_cb,
951                                                                ug_args,
952                                                                SWALLOW_Type_INVALID,
953                                                                icon_path, NULL,
954                                                                0, keyStr, NULL,
955                                                                NULL);
956
957                 }
958         }
959
960         SETTING_TRACE_END;
961 }
962
963 static void __load_applications_level0_list(void *data)
964 {
965         setting_main_appdata *ad = data;
966         __load_applications_menu_list(ad, Cfg_Item_Pos_Level0);
967 }
968
969 static void __load_applications_level_all_list(void *data)
970 {
971         SETTING_TRACE_BEGIN;
972         setting_main_appdata *ad = data;
973         __load_applications_menu_list(ad, Cfg_Item_Pos_Level_All);
974 }
975
976 static int __get_downloaded_apps_num(Cfg_Item_Position inputPos)
977 {
978         SETTING_TRACE_BEGIN;
979         SETTING_TRACE_DEBUG("pos :%d", inputPos);
980         int downloaded_apps_num = 0;
981         Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
982         int i, j;
983         for (i = 0; i < setting_cfg_get_category_length(); i++) {
984                 if (safeStrCmp
985                     (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
986                         continue;
987
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 */
992                                 continue;
993                         }
994
995                         downloaded_apps_num++;
996                 }
997         }
998
999 #ifdef PLUGIN
1000         //3rd cfg
1001         DIR *dp = opendir (PLUGIN_CFG_DIR);
1002         if (dp != NULL)
1003         {
1004                 struct dirent *ep;
1005                 while (ep = readdir (dp))
1006                 {
1007                                 if (0 == safeStrCmp(".", ep->d_name)
1008                                     || 0 == safeStrCmp("..", ep->d_name))
1009                                 {
1010                                         continue;
1011                                 }
1012                                 downloaded_apps_num++;
1013                 }
1014                 (void) closedir (dp);
1015         }
1016 #endif
1017         SETTING_TRACE("Exit %s with return[%d]",__FUNCTION__, downloaded_apps_num);
1018         return downloaded_apps_num;
1019 }
1020
1021 static void __load_downloaded_apps_menu_list(void *data,
1022                                              Cfg_Item_Position inputPos)
1023 {
1024         SETTING_TRACE_BEGIN;
1025         SETTING_TRACE_DEBUG("pos :%d", inputPos);
1026         setting_main_appdata *ad = data;
1027
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);
1034                 return;
1035         }
1036
1037         //group title
1038         setting_create_Gendial_field_group_titleItem(ad->main_genlist,
1039                                                      &(ad->itc[GENDIAL_Type_group_item]),
1040                                                      NULL,
1041                                                      ELM_GENLIST_ITEM_NONE,
1042                                                      KeyStr_DownloadedAPPs,
1043                                                      NULL);
1044         char *keyStr = NULL;
1045         char *icon_path = NULL;
1046         char *ug_args = NULL;
1047
1048         Cfg_Item_Position tmpPos = Cfg_Item_Pos_Uninstall;
1049         int i, j;
1050         for (i = 0; i < setting_cfg_get_category_length(); i++) {
1051                 if (safeStrCmp
1052                     (setting_cfg_get_category_name(i), KeyStr_DownloadedAPPs))
1053                         continue;
1054
1055                 for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1056                         keyStr = setting_cfg_get_keyname_idx(i, j);
1057                         tmpPos =
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);
1061
1062                         if (Cfg_Item_Pos_Level_All == inputPos) {
1063                         } else if (inputPos != tmpPos) {        /* not in the inputPos level */
1064                                 continue;
1065                         }
1066
1067                         setting_create_Gendial_field_groupitem(ad->main_genlist,
1068                                                                &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1069                                                                NULL,
1070                                                                setting_main_click_list_ex_ug_cb,
1071                                                                ug_args,
1072                                                                SWALLOW_Type_INVALID,
1073                                                                icon_path, NULL,
1074                                                                0, keyStr, NULL,
1075                                                                NULL);
1076
1077                 }
1078         }
1079
1080         #ifdef PLUGIN
1081         //3rd cfg
1082         DIR *dp = opendir (PLUGIN_CFG_DIR);
1083         if (dp != NULL)
1084         {
1085                 struct dirent *ep;
1086
1087                 char fullpath[256];
1088
1089                 while (ep = readdir (dp))
1090                 {
1091                                 memset(fullpath, 0x00, 256);
1092                                 strncpy(fullpath, PLUGIN_CFG_DIR, 256);
1093                                 strncat(fullpath, "/", 256);
1094                                 strncat(fullpath, ep->d_name, 256);
1095
1096                                 //SETTING_TRACE("ep->d_name:%s", ep->d_name);
1097                                 if (0 == safeStrCmp(".", ep->d_name)
1098                                     || 0 == safeStrCmp("..", ep->d_name))
1099                                 {
1100                                         continue;
1101                                 }
1102                                 SETTING_TRACE("fullpath: %s", fullpath);
1103                                 char *p = strrchr(ep->d_name, '.');
1104                                 *p = '\0';
1105                                 setting_create_Gendial_field_groupitem(ad->main_genlist,
1106                                                                        &(ad->itc[GENDIAL_Type_1text_1icon_2]),
1107                                                                        NULL,
1108                                                                        setting_main_click_list_plugin_cb,
1109                                                                        strdup(fullpath),
1110                                                                        SWALLOW_Type_INVALID,
1111                                                                        IMG_DefaultIcon, NULL,
1112                                                                        0, ep->d_name, NULL,
1113                                                                        NULL);
1114
1115                 }
1116                 (void) closedir (dp);
1117         }
1118         #endif
1119         SETTING_TRACE_END;
1120 }
1121
1122 static void __load_downloaded_apps_level0_list(void *data)
1123 {
1124         setting_main_appdata *ad = data;
1125         __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level0);
1126 }
1127
1128 static void __load_downloaded_apps_level_all_list(void *data)
1129 {
1130         SETTING_TRACE_BEGIN;
1131         setting_main_appdata *ad = data;
1132         __load_downloaded_apps_menu_list(ad, Cfg_Item_Pos_Level_All);
1133 }
1134
1135 static void __check_all_view_clear(void *data)
1136 {
1137         SETTING_TRACE_BEGIN;
1138         ret_if(!data);
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;
1143         }
1144
1145         ad->gl_sel_all = NULL;
1146         ad->edit_preferred_genlist  = NULL;
1147         ad->controllbar_all_check = NULL;
1148         ad->check_all_item =NULL;
1149 }
1150
1151 static void __prefered_buttons_cb(void *data, Evas_Object *obj, void *event_info)
1152 {
1153         SETTING_TRACE_BEGIN;
1154         ret_if(!data);
1155         setting_main_appdata *ad = (setting_main_appdata *) data;
1156         const char *key = NULL;
1157
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);
1162         #else
1163         key = elm_object_text_get(obj);
1164         #endif
1165         setting_retm_if(data == NULL
1166                         || key == NULL, "data == NULL || key == NULL");
1167
1168         SETTING_TRACE_DEBUG("press button: %s", key);
1169
1170         // "Done"
1171         if (!safeStrCmp(key, dgettext("sys_string", "IDS_COM_SK_DONE"))) {
1172
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
1178                         return;
1179                 }
1180
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
1185
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);
1194                 return;
1195         }
1196
1197         // "Cancel"
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);
1204                 return;
1205         }
1206 }
1207
1208 static void __setting_contorlbar_clicked(void *data, Evas_Object *obj,
1209                                          void *event_info)
1210 {
1211         SETTING_TRACE_BEGIN;
1212         ret_if(data == NULL || obj == NULL);
1213         setting_main_appdata *ad = (setting_main_appdata *) data;
1214         int index = -1;
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);
1219
1220         switch (index) {
1221         case 0:
1222                 {
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;
1229
1230                         break;
1231                 }
1232         case 1:
1233                 {
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;
1240                         break;
1241                 }
1242         default:
1243                 {
1244                         return;
1245                 }
1246         }
1247         int ret = setting_main_refresh(ad);
1248         ret_if(ret != SETTING_RETURN_SUCCESS);
1249 }
1250
1251 static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
1252 {
1253         SETTING_TRACE_BEGIN;
1254         ret_if(!data);
1255         setting_main_appdata *ad = (setting_main_appdata *) data;
1256         elm_win_lower(ad->win_main);
1257 }
1258
1259 static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
1260 {
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);
1265         ret_if(!item);
1266
1267         if (MAIN_PROFILE_ALL == ad->profile_type)
1268         {
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);
1277         }
1278         else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
1279         {
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);
1288         }
1289         else
1290         {
1291                 return;
1292         }
1293 }
1294
1295 /**
1296  * creat a layout
1297  */
1298 Evas_Object *__create_main_view_widgets(Evas_Object *win_main, void *cb,
1299                                         Evas_Object *content,
1300                                         char *title_text,
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)
1306 {
1307         SETTING_TRACE_BEGIN;
1308
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,
1314                                          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);
1319
1320         /*  add navi_bar to the layout */
1321         Evas_Object *navi_bar = elm_naviframe_add(ly);
1322
1323         elm_object_part_content_set(ly, "elm.swallow.content", navi_bar);
1324         evas_object_show(navi_bar);
1325         *navibar = navi_bar;
1326
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);
1330
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);
1335
1336         /*  add segment control */
1337         Evas_Object *segment = elm_segment_control_add(controlbar);
1338         setting_retvm_if(segment == NULL, FALSE, "segment == NULL");
1339
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));
1343
1344         evas_object_show(segment);
1345         evas_object_smart_callback_add(segment, "changed",
1346                                        __setting_contorlbar_clicked, cb);
1347
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);
1356
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);
1362
1363         elm_object_item_part_content_set(navi_it, "optionheader", controlbar);
1364         #else
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);
1367
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);
1370
1371         elm_object_item_part_content_set(navi_it, "controlbar", controlbar);
1372         elm_object_item_part_content_set(navi_it, "segment", segment);
1373         #endif
1374
1375
1376         if (isFoundPreferredItem) {
1377                 elm_segment_control_item_selected_set(seg_preferred, EINA_TRUE);
1378         } else {
1379                 elm_segment_control_item_selected_set(seg_all, EINA_TRUE);
1380         }
1381         return ly;
1382 }
1383
1384 static bool __setting_create_main_view(void *data)
1385 {
1386         SETTING_TRACE_BEGIN;
1387         /* error check */
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);
1397
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 */
1403
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);
1410
1411         ad->controlbar = controlbar;
1412
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);
1419         return TRUE;
1420 #endif
1421
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 */
1425         int i, j, pos;
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;
1432                                 break;
1433                         }
1434                 }
1435                 if (isFoundPreferredItem) {
1436                         break;
1437                 }
1438         }
1439
1440         ad->ly_main = __create_main_view_widgets(ad->win_main, ad,
1441                                                  ad->main_genlist,
1442                                                  _("IDS_COM_BODY_SETTINGS"),
1443                                                  isFoundPreferredItem,
1444                                                  &ad->navibar_main,
1445                                                  &ad->edit_item,
1446                                                  &ad->segment_all,
1447                                                  &ad->segment_preferred);
1448         setting_retvm_if(ad->ly_main == NULL, FALSE, "ad->ly_main == NULL");
1449
1450         SETTING_TRACE_END;
1451         return TRUE;
1452 }
1453
1454 static bool __setting_create_prefered_view(void *data)
1455 {
1456         SETTING_TRACE_BEGIN;
1457         /* error check */
1458         setting_retvm_if(data == NULL, FALSE, "data == NULL");
1459         setting_main_appdata *ad = (setting_main_appdata *) data;
1460
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 */
1465
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);
1472
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);
1476
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 */
1479
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));
1487         SETTING_TRACE_END;
1488         return TRUE;
1489 }
1490
1491 static void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
1492 {
1493         SETTING_TRACE_BEGIN;
1494         ret_if(!user_data);
1495         setting_main_appdata *ad = user_data;
1496         ad->b_fm_requesting = FALSE;
1497         SETTING_TRACE("result:%d", result);
1498
1499         int err = 0;
1500         switch (result) {
1501         case TAPI_POWER_FLIGHT_MODE_RESP_ON:
1502
1503                 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1504                                          SETTING_ON_OFF_BTN_ON, &err);
1505
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)
1509                 {
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) ***");
1515
1516                         //sucessfully sent,
1517                         ad->b_fm_requesting = TRUE;
1518
1519                 }
1520                 break;
1521
1522         case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
1523
1524                 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
1525                                          SETTING_ON_OFF_BTN_OFF, &err);
1526
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)
1530                 {
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) ***");
1536
1537                         //sucessfully sent,
1538                         ad->b_fm_requesting = TRUE;
1539                 }
1540
1541                 break;
1542
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)
1546                 {
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);
1549
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;
1553                 }
1554                 else if (FM_LEAVE == ad->fm_waiting_op)
1555                 {
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);
1558
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;
1562                 }
1563                 else //Current requset is the last one, Setting needs to notify user
1564                 {
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,
1569                                              FALSE, FALSE);
1570
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);
1575                         }
1576                         return;
1577                 }
1578
1579                 //sucessfully sent,
1580                 ad->b_fm_requesting = TRUE;
1581
1582                 break;
1583
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);
1589
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);
1594                 }
1595                 break;
1596         default:
1597                 /* do nothing */
1598                 break;
1599         }
1600         return;
1601 }
1602
1603 static int setting_main_refresh(void *data)
1604 {
1605         SETTING_TRACE_BEGIN;
1606         setting_main_appdata *ad = (setting_main_appdata *) data;
1607         elm_genlist_clear(ad->main_genlist);    /* first to clear list */
1608
1609         if (is_ug_installed_by_ug_args("rcs-config"))
1610         {
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]),
1616                                                        NULL,
1617                                                        setting_main_click_list_ex_ug_cb,
1618                                                        "rcs-config",
1619                                                        SWALLOW_Type_INVALID,
1620                                                        IMG_Joyn, NULL,
1621                                                        0, KeyStr_Joyn, NULL,
1622                                                        NULL);
1623         }
1624
1625         int i;
1626         for(i = Func_Type_Connectivity; i < Func_Type_MAX; i++)
1627                 (ad->load_fns[i]) (ad);
1628
1629         memset(ad->load_fns, 0, Func_Type_MAX *sizeof(menu_list_load_fn));
1630         SETTING_TRACE_END;
1631         return SETTING_RETURN_SUCCESS;
1632 }
1633
1634 static int setting_main_create(void *cb)
1635 {
1636         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1637
1638         setting_main_appdata *ad = (setting_main_appdata *) cb;
1639         g_main_ad = ad;
1640         //pass NULL to let TAPI access default module
1641         ad->handle = tel_init(NULL);
1642         if (!ad->handle) {
1643                 SETTING_TRACE_ERROR("*** [ERR] tel_init failed ***");
1644         } else {
1645                 SETTING_TRACE("tel_init ok[handle:%p]", ad->handle);
1646         }
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]));
1659
1660         setting_create_Gendial_itc("dialogue/2text.3", &(ad->itc[GENDIAL_Type_2text_3]));
1661
1662         ad->view_type = SETTING_VIEW_MAIN;
1663         __setting_create_main_view(ad);
1664         setting_view_main.is_create = 1;
1665
1666         return SETTING_RETURN_SUCCESS;
1667 }
1668
1669 static int setting_main_destroy(void *cb)
1670 {
1671         SETTING_TRACE_BEGIN;
1672         /* error check */
1673         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1674
1675         setting_main_appdata *ad = (setting_main_appdata *) cb;
1676         if (0 == setting_view_main.is_create)
1677         {
1678                 //already not exsit
1679                 return SETTING_RETURN_SUCCESS;
1680         }
1681
1682         if (ad->handle) {
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);
1686                 } else {
1687                         SETTING_TRACE("***  tel_deinit OK ");
1688                 }
1689                 ad->handle = NULL;
1690         }
1691
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;
1696         } else {
1697                 SETTING_TRACE("*** ad->item_check_list is NULL - abnormal state ");
1698         }
1699
1700         if (ad->ly_main) {
1701                 evas_object_del(ad->ly_main);
1702                 ad->ly_main = NULL;
1703         }
1704
1705         if (ad->flight_popup) {
1706                 evas_object_del(ad->flight_popup);
1707                 ad->flight_popup = NULL;
1708         }
1709         setting_view_main.is_create = 0;
1710         SETTING_TRACE_END;
1711         return SETTING_RETURN_SUCCESS;
1712 }
1713
1714 static int setting_main_update(void *cb)
1715 {
1716         SETTING_TRACE_BEGIN;
1717
1718         /* error check */
1719         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1720
1721         setting_main_appdata *ad = (setting_main_appdata *) cb;
1722
1723         if (ad->ly_main != NULL) {
1724                 //evas_object_show(ad->ly_main);
1725         }
1726
1727         return SETTING_RETURN_SUCCESS;
1728 }
1729
1730 static int setting_main_cleanup(void *cb)
1731 {
1732         SETTING_TRACE_BEGIN;
1733         /* error check */
1734         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
1735
1736         setting_main_appdata *ad = (setting_main_appdata *) cb;
1737
1738         if (ad->ly_main != NULL) {
1739                 //evas_object_hide(ad->ly_main);
1740         }
1741
1742         return SETTING_RETURN_SUCCESS;
1743 }
1744
1745 /* ***************************************************
1746  *
1747  *general func
1748  *
1749  ***************************************************/
1750
1751 void setting_update_gl_item(void* data)
1752 {
1753         SETTING_TRACE_BEGIN;
1754         setting_main_appdata *ad = data;
1755         retm_if(!data, "Invalid argument: data is NULL");
1756
1757         int nDx = 0;
1758         Eina_Bool bGlUpdate = EINA_FALSE;
1759         Setting_GenGroupItem_Data *item_to_update = NULL;
1760
1761         for(;nDx<GL_ITEM_MAX; nDx++) {
1762                 if(EINA_TRUE == ad->updateItems[nDx]) {
1763                         switch (nDx)
1764                         {
1765                         case GL_ITEM_WIFI:
1766                                 item_to_update = ad->data_wifi;
1767                                 bGlUpdate = EINA_TRUE;
1768                                 break;
1769                         case GL_ITEM_BT:
1770                                 item_to_update = ad->data_bt;
1771                                 bGlUpdate = EINA_TRUE;
1772                                 break;
1773                         case GL_ITEM_NFC:
1774                                 item_to_update = ad->data_nfc;
1775                                 bGlUpdate = EINA_TRUE;
1776                                 break;
1777                         case GL_ITEM_MAP:
1778                                 item_to_update = ad->data_mobileApp;
1779                                 bGlUpdate = EINA_TRUE;
1780                                 break;
1781                         case GL_ITEM_FLIGHT:
1782                                 item_to_update = ad->data_flight;
1783                                 bGlUpdate = EINA_FALSE;
1784                                 break;
1785
1786
1787
1788
1789                         default: // other case
1790                                 continue;
1791                         }
1792
1793                         if (item_to_update) {
1794                                 if(bGlUpdate) {
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);
1798                                 } else {
1799                                         SETTING_TRACE("chk update:%d", nDx);
1800                                         elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
1801                                 }
1802                         }
1803
1804                         ad->updateItems[nDx] = EINA_FALSE;
1805                 } // if(EINA_TRUE == ad->updateItems[nDx])
1806
1807         }
1808
1809         SETTING_TRACE_END;
1810         return;
1811 }
1812
1813 void setting_main_destroy_ug_cb(ui_gadget_h ug, void *priv)
1814 {
1815         setting_main_appdata *ad = (setting_main_appdata *) priv;
1816         if (!ad)
1817                 return;         /*  do nothing if ad is NULL */
1818
1819         if (ug) {
1820                 ug_destroy(ug);
1821                 ad->ug = NULL;
1822         }
1823
1824         setting_main_click_list_item_reset_data(ad, NULL);
1825
1826         // update main genlist in unloading UG
1827         SETTING_TRACE("update main genlist in unloading UG");
1828         setting_update_gl_item(ad);
1829
1830         SETTING_TRACE_END;
1831 }
1832
1833 void setting_main_result_ug_cb(ui_gadget_h ug, service_h service,
1834                                       void *priv)
1835 {
1836         if (!priv)
1837                 return;
1838         SETTING_TRACE_BEGIN;
1839
1840         SETTING_TRACE_END;
1841 }
1842
1843 void setting_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
1844                                       void *priv)
1845 {
1846         setting_main_appdata *ad = (setting_main_appdata *) priv;
1847         Evas_Object *base;
1848
1849         if (!priv)
1850                 return;
1851         SETTING_TRACE_BEGIN;
1852
1853         base = (Evas_Object *) ug_get_layout(ug);
1854         if (!base)
1855                 return;
1856
1857         switch (mode) {
1858         case UG_MODE_FULLVIEW:
1859                 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
1860                                                  EVAS_HINT_EXPAND);
1861                 elm_win_resize_object_add(ad->win_main, base);
1862                 evas_object_show(base);
1863                 break;
1864         default:
1865                 break;
1866         }
1867
1868         SETTING_TRACE_END;
1869 }
1870
1871 /* ***************************************************
1872  *
1873  *call back func
1874  *
1875  ***************************************************/
1876
1877 void setting_main_click_list_item_reset_data(void *data,
1878                                                     Evas_Object *obj)
1879 {
1880         SETTING_TRACE_BEGIN;
1881         setting_main_appdata *ad = (setting_main_appdata *) data;
1882
1883         ad->isInUGMode = FALSE;
1884
1885         SETTING_TRACE_END;
1886 }
1887
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,
1891                                    struct ug_cbs *cbs)
1892 {
1893         SETTING_TRACE_BEGIN;
1894         setting_main_appdata *ad = (setting_main_appdata *) data;
1895         if (!ug_to_load) {
1896                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
1897                 return;
1898         }
1899 #if DISABLED_CODE
1900         char ug_file[PATH_MAX];
1901         if (snprintf
1902             (ug_file, PATH_MAX, "%s/libug-%s.so", SETTING_UG_PATH,
1903              ug_to_load) < 0)
1904                 return;
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);
1908                 return;
1909         }
1910 #endif
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);
1913         if (ad->ug) {
1914                 ad->isInUGMode = TRUE;
1915         } else {
1916
1917                 evas_object_show(ad->ly_main);
1918
1919                 SETTING_TRACE_ERROR("errno:%d", errno);
1920                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
1921         }
1922         SETTING_TRACE_END;
1923 }
1924
1925 void
1926 setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj,
1927                                       void *event_info)
1928 {
1929         setting_main_appdata *ad = data;
1930         setting_create_simple_popup(ad, ad->win_main, NULL,
1931                                           NO_UG_FOUND_MSG);
1932 }
1933
1934 void
1935 setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
1936 {
1937         SETTING_TRACE_BEGIN;
1938         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1939
1940         int err;
1941         int value = -1;
1942         char *str_text = USB_NEED_OFF;
1943
1944         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1945
1946         setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
1947         if (err != 0)
1948         {
1949                 SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
1950                 setting_main_click_list_ex_ug_cb(data, obj, item);
1951                 return;
1952         }
1953
1954         /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
1955         if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB)
1956         {
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));
1959         }
1960         else
1961         {
1962                 setting_main_click_list_ex_ug_cb(data, obj, item);
1963         }
1964
1965         SETTING_TRACE_END;
1966 }
1967
1968 void setting_main_click_list_more_cb(void *data, Evas_Object *obj, void *event_info)
1969 {
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))
1980         {
1981                 ad->view_load = SETTING_VIEW_CONNECTIVE_MORE;
1982         }
1983         else if (0 == safeStrCmp(selected_item_data->keyStr, KeyStr_MoreSystem))
1984         {
1985                 ad->view_load = SETTING_VIEW_SYSTEM_MORE;
1986         }
1987         else
1988         {
1989                 return;
1990         }
1991         setting_view_change(&setting_view_main, &setting_view_more_menu, ad);
1992 }
1993
1994
1995 void
1996 setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
1997                                  void *event_info)
1998 {
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;
2002
2003         elm_genlist_item_selected_set(item, EINA_FALSE);
2004
2005         if (g_main_ad->ug) {
2006                 SETTING_TRACE
2007                     ("[ad->ug non-NULL]skip genlist click event!!");
2008
2009                 SETTING_TRACE_END;
2010                 return;
2011         }
2012
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);
2017                 SETTING_TRACE_END;
2018                 return;
2019         }
2020
2021         setting_main_appdata *ad = g_main_ad;
2022
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;
2027                 SETTING_TRACE_END;
2028                 return;
2029         } else {
2030                 SETTING_TRACE
2031                     ("isInUGMode : FALSE - another UG is NOT running now.")
2032         }
2033
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);
2038         ret_if(!item_name);
2039
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;
2046
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);
2050         if (path)
2051                 FREE(path);
2052         if (cbs)
2053                 FREE(cbs);
2054         path = NULL;
2055         cbs = NULL;
2056         service_destroy(svc);
2057 }
2058 void
2059 setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
2060                                  void *event_info)
2061 {
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);
2066 #ifdef PLUGIN
2067         setting_plugin_load((const char *)data);
2068 #endif
2069 }
2070
2071 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
2072                                           void *event_info)
2073 {
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 */
2080
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;*/
2084
2085         if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2086                 int err;
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);
2091                 } else {
2092                         setting_set_bool_slp_key
2093                             (BOOL_SLP_SETTING_USE_PACKET_DATA,
2094                              SETTING_ON_OFF_BTN_OFF, &err);
2095                 }
2096
2097         } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2098                 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, ! list_item->chk_status);
2099         }
2100
2101         return;
2102 }
2103
2104 void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
2105                                               void *event_info)
2106 {
2107         SETTING_TRACE_BEGIN;
2108         setting_retm_if(data == NULL, "Data parameter is NULL");
2109
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);
2115
2116         list_item->chk_status = elm_check_state_get(list_item->eo_check);
2117         /* new status */
2118
2119         /*setting_main_appdata *ad = (setting_main_appdata *) data;*/
2120
2121         if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
2122                 /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
2123                 int err;
2124                 setting_set_bool_slp_key(BOOL_SLP_SETTING_USE_PACKET_DATA,
2125                                          list_item->chk_status, &err);
2126
2127         } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
2128                 vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, (list_item->chk_status));
2129         }
2130
2131         return;
2132 }
2133
2134 void __alternate_flight_mode(Evas_Object *check)
2135 {
2136         SETTING_TRACE_BEGIN;
2137         int ret;
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;
2141
2142         //Check whether some requestion is processing by TAPI
2143         if (ad->b_fm_requesting)
2144         {
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;
2148                 return;
2149         }
2150
2151         //otherwise, invalid waiting operation and send requsetion to TAPI:
2152         ad->fm_waiting_op = FM_INVALID;
2153         if (status) {
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) ***");
2157         } else {
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) ***");
2161         }
2162
2163         //sucessfully sent,
2164         ad->b_fm_requesting = TRUE;
2165         SETTING_TRACE_END;
2166 }
2167
2168 void
2169 setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj,
2170                                       void *event_info)
2171 {
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;
2175
2176         elm_genlist_item_selected_set(item, EINA_FALSE);
2177
2178         if (g_main_ad->ug) {
2179                 SETTING_TRACE
2180                     ("[ad->ug non-NULL]skip genlist click event!!");
2181
2182                 SETTING_TRACE_END;
2183                 return;
2184         }
2185
2186         setting_main_appdata *ad = g_main_ad;
2187         setting_main_click_list_item_reset_data(ad, obj);
2188
2189         int err = 0;
2190         int value;
2191         setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2192         SETTING_TRACE("value:%d", value);
2193         switch (value) {
2194         case VCONFKEY_TELEPHONY_SIM_INSERTED:
2195                 {
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",
2205                                                            NULL, cbs);
2206                         FREE(cbs);
2207                         break;
2208                 }
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);
2214                 return;
2215                 break;
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);
2222                 return;
2223                 break;
2224         default:
2225                 break;
2226         }
2227
2228 }
2229
2230 static void
2231 setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj,
2232                                                void *event_info)
2233 {
2234     /* error check */
2235     setting_retm_if(data == NULL, "Data parameter is NULL");
2236
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);
2243     /* new status */
2244     list_item->chk_status = !old_status;
2245     elm_check_state_set(list_item->eo_check, list_item->chk_status);
2246
2247     __alternate_flight_mode(list_item->eo_check);
2248     SETTING_TRACE_END;
2249 }
2250
2251 void
2252 setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2253                                        void *event_info)
2254 {
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);
2262
2263         __alternate_flight_mode(obj);
2264         SETTING_TRACE_END;
2265 }
2266
2267
2268 /**
2269  * store current selection in setting.cfg
2270  */
2271 void setting_try_save_check_list(void *data)
2272 {
2273         SETTING_TRACE_BEGIN;
2274         setting_main_appdata *ad = (setting_main_appdata *) data;
2275
2276         Eina_List *check_list = ad->item_check_list;
2277         Setting_GenGroupItem_Data *list_item = NULL;
2278         int update_count = 0;
2279
2280         while (check_list) {
2281                 list_item = (Setting_GenGroupItem_Data *) eina_list_data_get(check_list);
2282                 if (NULL == list_item) continue;
2283
2284                 update_count++;
2285                 if (list_item->chk_status) {
2286                         /* to update config file */
2287                         setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level0);
2288                 } else {
2289                         /* to update config file */
2290                         setting_cfg_set_pos(list_item->keyStr, Cfg_Item_Pos_Level1);
2291                 }
2292                 check_list = eina_list_next(check_list);
2293         }
2294
2295         if (update_count == 0) {
2296                 /* to popup tips notify */
2297         } else {
2298                 setting_cfg_file_update();
2299         }
2300         SETTING_TRACE_END;
2301 }
2302
2303 void
2304 setting_main_click_edit_preferred_cb(void *data, Evas_Object *obj, void *event_info)
2305 {
2306         SETTING_TRACE_BEGIN;
2307
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);
2312
2313         SETTING_TRACE_END;
2314 }