tizen 2.3 release
[apps/home/settings.git] / src / setting-handler.c
1 #include <setting-handler.h>
2 #include <setting-helper.h>
3
4 #include <wifi.h>
5 //#include <nfc.h>
6 #include <bluetooth.h>
7 #include <dbus/dbus.h>
8
9 static Setting_GenGroupItem_Data * __flightmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
10 {
11         //SETTING_TRACE_BEGIN;
12         // NOT UG --> it's just UI drawing
13
14         setting_main_appdata *ad = (setting_main_appdata *)data;
15         int value, err;
16         setting_get_bool_slp_key (BOOL_SLP_SETTING_FLIGHT_MODE, &value, &err);
17
18         /* create flight_mode */
19         ad->data_flight = setting_create_Gendial_field_groupitem(genlist,
20                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
21                                                    parent,
22                                                    setting_main_click_Gendial_list_flight_mode_cb,
23                                                    ad,
24                                                    SWALLOW_Type_1ICON_1RADIO,
25                                                    icon_path,
26                                                    NULL,
27                                                    value,
28                                                    keyStr,
29                                                    NULL,
30                                                    setting_main_click_list_flight_mode_cb);
31         __BACK_POINTER_SET(ad->data_flight);
32
33         return ad->data_flight;
34 }
35
36 static Setting_GenGroupItem_Data * __netrestrictionmode_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
37 {
38         //SETTING_TRACE_BEGIN;
39         // NOT UG --> it's just UI drawing
40
41         setting_main_appdata    *ad = (setting_main_appdata *)data;
42         int                                             value, err;
43
44         setting_get_bool_slp_key( BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &value, &err );
45
46         /* create restriction mode */
47         ad->data_netrestrictionmode = setting_create_Gendial_field_groupitem(genlist,
48                                                    &(ad->itc[GENDIAL_Type_1text_2icon]),
49                                                    parent,
50                                                    setting_main_click_list_net_restriction_mode_cb,
51                                                    ad,
52                                                    SWALLOW_Type_1ICON_1RADIO,
53                                                    IMG_NetRestrictionMode,
54                                                    NULL,
55                                                    value,
56                                                    keyStr,
57                                                    NULL,
58                                                    setting_main_click_list_check_net_restriction_mode_cb );
59         __BACK_POINTER_SET(ad->data_netrestrictionmode);
60
61         if ( ad->data_wifi )
62         {
63                 if ( value == 1 )
64                         setting_disable_genlist_item( ad->data_wifi->item );
65         }
66
67         return ad->data_netrestrictionmode;
68 }
69
70 static Setting_GenGroupItem_Data * __wifi_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
71 {
72         //SETTING_TRACE_BEGIN;
73         setting_main_appdata *ad = (setting_main_appdata *)data;
74
75         int err;
76         int value = -1;
77         setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &value, &err);
78
79         preference_set_boolean(WIFI_LAST_ON_OFF_STATE, (value ? 1 : 0));
80         ad->data_wifi = setting_create_Gendial_field_groupitem(genlist,
81
82                                                    //&(ad->itc[GENDIAL_Type_1text_2icon_divider]),
83                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
84                                                    parent,
85                                                    setting_main_click_list_ex_ug_cb,
86                                                    ug_args,
87                                                    SWALLOW_Type_1ICON_1RADIO,
88                                                    icon_path,
89                                                    NULL,
90                                                    value,
91                                                    keyStr,
92                                                    NULL,
93                                                    setting_main_click_list_wifi_mode_cb);
94         __BACK_POINTER_SET(ad->data_wifi);
95         if(ad->data_wifi)
96         {
97                 ad->data_wifi->userdata = ad;
98         }
99
100         return ad->data_wifi;
101 }
102
103 static Setting_GenGroupItem_Data * __bluetooth_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
104 {
105         //SETTING_TRACE_BEGIN;
106         setting_main_appdata *ad = (setting_main_appdata *)data;
107         int value, err;
108         setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &value, &err);
109
110         ad->data_bt = setting_create_Gendial_field_groupitem(genlist,
111                                                    //&(ad->itc[GENDIAL_Type_1text_2icon_divider]),
112                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
113                                                    parent,
114                                                    setting_main_click_list_ex_ug_cb,
115                                                    ug_args,
116                                                    SWALLOW_Type_1ICON_1RADIO,
117                                                    icon_path,
118                                                    NULL,
119                                                    value,
120                                                    keyStr,
121                                                    NULL,
122                                                    setting_main_click_list_bt_mode_cb);
123         __BACK_POINTER_SET(ad->data_bt);
124         if(ad->data_bt)
125         {
126                 ad->data_bt->userdata = ad;
127         }
128
129         return ad->data_bt;
130 }
131
132 static Setting_GenGroupItem_Data * __mobileap_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
133 {
134         //SETTING_TRACE_BEGIN;
135         setting_main_appdata *ad = (setting_main_appdata *)data;
136
137         ad->data_mobileApp = setting_create_Gendial_field_groupitem(genlist,
138                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
139                                                    parent,
140                                                    setting_main_click_list_ex_ug_cb,
141                                                    ug_args,
142                                                    SWALLOW_Type_INVALID,
143                                                    icon_path,
144                                                    NULL,
145                                                    0,
146                                                    keyStr,
147                                                    NULL,
148                                                    NULL);
149         __BACK_POINTER_SET(ad->data_mobileApp);
150         if(ad->data_mobileApp)
151         {
152                 ad->data_mobileApp->userdata = ad;
153         }
154
155         return ad->data_mobileApp;
156 }
157
158 static Setting_GenGroupItem_Data * __allshare_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
159 {
160         //SETTING_TRACE_BEGIN;
161         setting_main_appdata *ad = (setting_main_appdata *)data;
162
163         Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
164                                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
165                                                                    parent,
166                                                                    setting_main_click_list_default_ug_cb,
167                                                                    ad,
168                                                                    SWALLOW_Type_INVALID,
169                                                                    icon_path,
170                                                                    NULL, 0,
171                                                                    keyStr,
172                                                                    NULL,
173                                                                    NULL);
174         return obj;
175 }
176
177 static Setting_GenGroupItem_Data * __network_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
178 {
179         //SETTING_TRACE_BEGIN;
180         setting_main_appdata *ad = (setting_main_appdata *)data;
181
182         ad->data_network = setting_create_Gendial_field_groupitem(genlist,
183                                                                        &(ad->itc[GENDIAL_Type_1text_1icon_2]),
184                                                                        parent,
185                                                                        setting_main_click_list_network_ug_cb,
186                                                                        ad,
187                                                                        SWALLOW_Type_INVALID,
188                                                                        icon_path,
189                                                                        NULL, 0,
190                                                                        keyStr,
191                                                                        NULL,
192                                                                        NULL);
193
194         int flight_mode = 0;
195         vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
196         if (flight_mode)
197         {
198                 if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
199         }
200
201         __BACK_POINTER_SET(ad->data_network);
202         return ad->data_network;
203 }
204
205 #if SUPPORT_NFC
206 static Setting_GenGroupItem_Data * __nfc_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
207 {
208         //SETTING_TRACE_BEGIN;
209         if(!is_NFC_feature_supported()){
210                 SETTING_TRACE("!is_NFC_feature_supported");
211                 return NULL;
212         }
213         setting_main_appdata *ad = (setting_main_appdata *)data;
214
215         int value, err;
216         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &value, &err);
217
218         ad->data_nfc = setting_create_Gendial_field_groupitem(genlist,
219                                                    &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
220                                                    //&(ad->itc[GENDIAL_Type_1text_2icon]),
221                                                    parent,
222                                                    setting_main_click_list_ex_ug_cb,
223                                                    ug_args,
224                                                    SWALLOW_Type_1ICON_1RADIO,
225                                                    icon_path,
226                                                    NULL,
227                                                    value,
228                                                    keyStr,
229                                                    NULL,
230                                                    setting_main_click_list_nfc_mode_cb);
231         __BACK_POINTER_SET(ad->data_nfc);
232         if(ad->data_nfc)
233         {
234                 ad->data_nfc->userdata = ad;
235         }
236
237         return ad->data_nfc;
238 }
239 #endif
240
241 static Setting_GenGroupItem_Data * __adjust_screen_tone_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
242 {
243         SETTING_TRACE_BEGIN;
244         setting_main_appdata *ad = (setting_main_appdata *)data;
245         Setting_GenGroupItem_Data * obj = NULL;
246
247         int value = 0;
248         vconf_get_bool(VCONFKEY_SETAPPL_BOOL_AUTO_ADJUST_SCREEN_TONE, &value);
249         obj = setting_create_Gendial_field_groupitem(genlist,
250                                                    &(ad->itc[GENDIAL_Type_1text_2icon]),
251                                                    parent,
252                                                    setting_main_display_list_cb,
253                                                    ad,
254                                                    SWALLOW_Type_1ICON_1RADIO,
255                                                    icon_path,
256                                                    NULL,
257                                                    value,
258                                                    keyStr,
259                                                    NULL,
260                                                    setting_main_display_auto_adjust_chk_btn_cb);
261
262         if (obj)
263         {
264                 __BACK_POINTER_SET(obj);
265                 obj->userdata = ad;
266                 ad->data_screentone = obj;
267         }
268         return obj;
269 }
270
271 static Setting_GenGroupItem_Data * __landscape_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
272 {
273         SETTING_TRACE_BEGIN;
274         setting_main_appdata *ad = (setting_main_appdata *)data;
275         Setting_GenGroupItem_Data * obj = NULL;
276
277         int value = 0;
278         vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
279         obj = setting_create_Gendial_field_groupitem(genlist,
280                                                    &(ad->itc[GENDIAL_Type_1text_2icon]),
281                                                    parent,
282                                                    setting_main_display_list_cb,
283                                                    ad,
284                                                    SWALLOW_Type_1ICON_1RADIO,
285                                                    icon_path,
286                                                    NULL,
287                                                    value,
288                                                    keyStr,
289                                                    NULL,
290                                                    setting_main_display_auto_rotate_chk_btn_cb);
291
292         if (obj)
293         {
294                 __BACK_POINTER_SET(obj);
295                 obj->userdata = ad;
296                 ad->data_landscape = obj;
297         }
298         return obj;
299
300
301
302 }
303
304
305 static Setting_GenGroupItem_Data * __multiwindow_mode_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
306 {
307         SETTING_TRACE_BEGIN;
308         setting_main_appdata *ad = (setting_main_appdata *)data;
309         Setting_GenGroupItem_Data * obj = NULL;
310
311         int value;
312         int ret = vconf_get_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, &value);
313         if (ret != 0) {
314                 SETTING_TRACE_ERROR("get multi-window vconf failed");
315                 value = 0;
316         }
317         SETTING_TRACE("multi-window vconf value=%d\n",value);
318         obj =
319                 setting_create_Gendial_field_groupitem(genlist,
320                            &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
321                            parent,
322                            setting_main_click_list_ex_ug_cb,
323                            ug_args,
324                            SWALLOW_Type_1ICON_1RADIO,
325                            icon_path,
326                            NULL,
327                            value,
328                            keyStr,
329                            NULL,
330                            setting_main_list_mouse_up_cb);
331
332         if (obj)
333         {
334                 __BACK_POINTER_SET(obj);
335                 obj->userdata = ad;
336                 ad->data_multi_window = obj;
337         }
338         return obj;
339 }
340
341
342 static Setting_GenGroupItem_Data * __brightness_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
343 {
344         SETTING_TRACE_BEGIN;
345         setting_main_appdata *ad = (setting_main_appdata *)data;
346         Setting_GenGroupItem_Data * obj = NULL;
347
348         char* pa_bright = get_brightness_mode_str();
349         obj =
350                 setting_create_Gendial_field_groupitem(genlist,
351                                 &(ad->itc[GENDIAL_Type_1icon_2text]),
352                                 parent,
353                                 setting_main_click_list_ex_ug_cb,
354                                 ug_args,
355                                 SWALLOW_Type_INVALID,
356                                 icon_path,
357                                 NULL,
358                                 0,
359                                 keyStr,
360                                 pa_bright,
361                                 NULL);
362
363         if (obj)
364         {
365                 __BACK_POINTER_SET(obj);
366                 obj->userdata = ad;
367                 ad->data_bright = obj;
368         }
369         return obj;
370 }
371
372 #if SUPPORT_BLOCKINGMODE
373 static Setting_GenGroupItem_Data * __blocking_mode_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
374 {
375         SETTING_TRACE_BEGIN;
376         setting_main_appdata *ad = (setting_main_appdata *)data;
377         Setting_GenGroupItem_Data * obj = NULL;
378
379         int value;
380         int ret = vconf_get_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, &value);
381         if (ret != 0) {
382                 SETTING_TRACE_ERROR("get vconf failed");
383                 value = 1;
384         }
385         obj =  setting_create_Gendial_field_groupitem(genlist,
386                         &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
387                         //&(ad->itc[GENDIAL_Type_1text_2icon]),
388                         parent,
389                         setting_main_click_list_ex_ug_cb,
390                         ug_args,
391                         SWALLOW_Type_1ICON_1RADIO,
392                         icon_path,
393                         NULL,
394                         value,
395                         keyStr,
396                         NULL,
397                         setting_main_list_mouse_up_cb);
398         if (obj)
399         {
400                 __BACK_POINTER_SET(obj);
401                 obj->userdata = ad;
402                 ad->data_blocking = obj;
403         }
404         return obj;
405
406 }
407 #endif
408
409 static Setting_GenGroupItem_Data * __personal_mode_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
410 {
411         SETTING_TRACE_BEGIN;
412         setting_main_appdata *ad = (setting_main_appdata *)data;
413         Setting_GenGroupItem_Data * obj = NULL;
414
415         int value;
416         int ret = vconf_get_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL, &value);
417         if (ret != 0) {
418                 SETTING_TRACE_ERROR("get vconf failed");
419                 value = 0;
420         }
421         obj =  setting_create_Gendial_field_groupitem(genlist,
422                                                         &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
423                                                    //&(ad->itc[GENDIAL_Type_1text_2icon]),
424                                                    parent,
425                                                    setting_main_click_list_ex_personal_mode_cb,
426                                                    ug_args,
427                                                    SWALLOW_Type_1ICON_1RADIO,
428                                                    icon_path,
429                                                    NULL,
430                                                    value,
431                                                    keyStr,
432                                                    NULL,
433                                                    setting_main_list_mouse_up_cb);
434         if (obj)
435         {
436                 __BACK_POINTER_SET(obj);
437                 obj->userdata = ad;
438                 ad->data_personalpage = obj;
439         }
440         return obj;
441 }
442
443
444
445 static Setting_GenGroupItem_Data * __hightouch_sens_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
446 {
447         SETTING_TRACE_BEGIN;
448         setting_main_appdata *ad = (setting_main_appdata *)data;
449         Setting_GenGroupItem_Data * obj = NULL;
450
451         int value = 0;
452         int entouch = display_get_enhanced_touch();
453         if(1 == entouch){
454                 //enhanced status ON
455                 value = 1;
456         }
457         else{
458                 value = 0;
459         }
460         vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, value); //sync to vconf
461
462          /* create high touch sensitivity */
463         obj = setting_create_Gendial_field_groupitem(genlist,
464                            &(ad->itc[GENDIAL_Type_1text_2icon]),
465                            parent,
466                            setting_main_mouse_up_Gendial_list_sensitivity_cb,
467                            ad,
468                            SWALLOW_Type_1ICON_1RADIO,
469                            icon_path,
470                            NULL,
471                            value,
472                            KeyStr_HighTouchSens,
473                            NULL,
474                            setting_main_high_touch_sens_chk_btn_cb);
475
476          if (obj)
477          {
478                  __BACK_POINTER_SET(obj);
479                  obj->userdata = ad;
480                  ad->data_high_touch_sensitivity = obj;
481          }
482
483         return obj;
484 }
485
486 //__screen_mode_handler
487 static Setting_GenGroupItem_Data * __screen_mode_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
488 {
489         SETTING_TRACE_BEGIN;
490         setting_main_appdata *ad = (setting_main_appdata *)data;
491
492         mainlist_entry* entry =  settinig_drawer_hash_find(ad, keyStr);
493
494         Setting_GenGroupItem_Data *item_data = NULL;
495         if (entry)
496         {
497                 item_data = entry->ui_handler(ad, keyStr, icon_path, ug_args, genlist, parent);
498                 entry->item_data = item_data;
499         }
500
501         char* pa_screenmode = get_pa_screen_mode_str();
502
503         Setting_GenGroupItem_Data * obj = NULL;
504         obj =
505                 setting_create_Gendial_field_groupitem(genlist,
506                                 &(ad->itc[GENDIAL_Type_1icon_2text]),
507                                 parent,
508                                 setting_main_click_list_ex_ug_cb,
509                                 ug_args,
510                                 SWALLOW_Type_INVALID,
511                                 icon_path,
512                                 NULL,
513                                 0,
514                                 keyStr,
515                                 pa_screenmode,
516                                 NULL);
517         G_FREE(pa_screenmode);
518         __BACK_POINTER_SET(obj);
519         if(obj)
520         {
521                 obj->userdata = ad;
522                 ad->data_screenmode = obj;
523         }
524
525         return obj;
526 }
527
528
529
530
531 static Setting_GenGroupItem_Data * __battery_percent_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
532 {
533         SETTING_TRACE_BEGIN;
534         setting_main_appdata *ad = (setting_main_appdata *)data;
535         Setting_GenGroupItem_Data * obj = NULL;
536
537         int value = 0;
538         vconf_get_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, &value);
539         obj = setting_create_Gendial_field_groupitem(genlist,
540                                                    &(ad->itc[GENDIAL_Type_1text_2icon]),
541                                                    parent,
542                                                    setting_main_display_list_cb,
543                                                    ad,
544                                                    SWALLOW_Type_1ICON_1RADIO,
545                                                    icon_path,
546                                                    NULL,
547                                                    value,
548                                                    keyStr,
549                                                    NULL,
550                                                    setting_main_display_battery_chk_btn_cb);
551         __BACK_POINTER_SET(obj);
552         if(obj)
553         {
554                 obj->userdata = ad;
555                 ad->data_battery = obj;
556         }
557
558         return obj;
559 }
560
561 static Setting_GenGroupItem_Data * __backlight_time_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
562 {
563         SETTING_TRACE_BEGIN;
564         setting_main_appdata *ad = (setting_main_appdata *)data;
565         Setting_GenGroupItem_Data * obj = NULL;
566
567         char* pa_backlight = get_pa_backlight_time_str();
568         obj = setting_create_Gendial_field_groupitem(genlist,
569                                 &(ad->itc[GENDIAL_Type_1icon_2text]),
570                                 parent,
571                                 setting_main_click_list_ex_ug_cb,
572                                 ug_args,
573                                 SWALLOW_Type_INVALID,
574                                 icon_path,
575                                 NULL,
576                                 0,
577                                 keyStr,
578                                 pa_backlight,
579                                 NULL);
580         G_FREE(pa_backlight);
581         __BACK_POINTER_SET(obj);
582         if(obj)
583         {
584                 obj->userdata = ad;
585                 ad->data_backlight = obj;
586         }
587
588         return obj;
589 }
590
591 static Setting_GenGroupItem_Data * __nearby_device_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
592 {
593         SETTING_TRACE_BEGIN;
594         setting_main_appdata *ad = (setting_main_appdata *)data;
595         Setting_GenGroupItem_Data * obj = NULL;
596
597         Cfg_Item_State state = Cfg_Item_Error;
598         Setting_Cfg_Node_T* pnode = get_cfg_node_by_keystr( _(keyStr) );
599         if (pnode && pnode->tfunc && pnode->tfunc->get_item_state) {
600                 pnode->tfunc->get_item_state(&state, NULL);
601         }
602
603         obj = setting_create_Gendial_field_groupitem(genlist,
604                         &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
605                         //&(ad->itc[GENDIAL_Type_1text_2icon]),
606                         parent,
607                         setting_main_click_list_ex_ug_cb,
608                         ug_args,
609                         SWALLOW_Type_1ICON_1RADIO,
610                         icon_path,
611                         NULL,
612                         state,
613                         keyStr,
614                         NULL,
615                         setting_main_click_list_nearby_devices_cb);
616         __BACK_POINTER_SET(obj);
617         if(obj)
618         {
619                 obj->userdata = ad;
620
621                 ad->data_nearby_devices = obj;
622         }
623
624         return obj;
625 }
626
627 static Setting_GenGroupItem_Data * __developer_option_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
628 {
629         SETTING_TRACE_BEGIN;
630         setting_main_appdata *ad = (setting_main_appdata *)data;
631         Setting_GenGroupItem_Data * obj = NULL;
632 #ifdef BINARY_RELEASE_TYPE_ENG
633         /*for eng binary: always show <developer option>*/
634         obj = setting_create_Gendial_field_groupitem(genlist,
635                                                            &(ad->itc[GENDIAL_Type_1text_1icon_2]),
636                                                            parent,
637                                                            setting_main_click_list_ex_ug_cb,
638                                                            ug_args,
639                                                            SWALLOW_Type_INVALID,
640                                                            icon_path,
641                                                            NULL, 0,
642                                                            keyStr,
643                                                            NULL,
644                                                            NULL);
645
646 #else
647         /*for user binary: need to check develop_option_state vconf value*/
648         int dev_op_state = 0;
649         int ret = 0;
650         ret = vconf_get_bool(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE,&dev_op_state);
651         if(ret != 0){
652                 SETTING_TRACE_ERROR("Failed to ger vconf value %d",ret);
653         }
654         if(dev_op_state){
655                 obj = setting_create_Gendial_field_groupitem(genlist,
656                                                            &(ad->itc[GENDIAL_Type_1text_1icon_2]),
657                                                            parent,
658                                                            setting_main_click_list_ex_ug_cb,
659                                                            ug_args,
660                                                            SWALLOW_Type_INVALID,
661                                                            icon_path,
662                                                            NULL, 0,
663                                                            keyStr,
664                                                            NULL,
665                                                            NULL);
666         }else{
667                 SETTING_TRACE("dev_op_state is 0");
668         }
669 #endif
670         return obj;
671 }
672
673
674 static Setting_GenGroupItem_Data * __joyn_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
675 {
676         SETTING_TRACE_BEGIN;
677         setting_main_appdata *ad = (setting_main_appdata *)data;
678         if (vcui_doc_rcs_get_install_status() == EINA_TRUE) {
679                 ad->data_joyn  = setting_create_Gendial_field_groupitem(genlist,
680                                                                    &(ad->itc[GENDIAL_Type_1text_1icon_2]),
681                                                                    parent,
682                                                                    setting_main_click_list_ex_ug_cb,
683                                                                    ug_args,
684                                                                    SWALLOW_Type_INVALID,
685                                                                    icon_path,
686                                                                    NULL, 0,
687                                                                    keyStr,
688                                                                    NULL,
689                                                                    NULL);
690                 __BACK_POINTER_SET(ad->data_joyn);
691                 if(ad->data_joyn)
692                 {
693                         ad->data_joyn->userdata = ad;
694                 }
695                 return ad->data_joyn;
696         } else {
697                 SETTING_TRACE("Joyn account is NOT available");
698         }
699         return NULL;
700 }
701
702 #if SUPPORT_NFC
703 static Setting_GenGroupItem_Data * __sbeam_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
704 {
705         //SETTING_TRACE_BEGIN;
706         if(!is_NFC_feature_supported()){
707                 SETTING_TRACE("!is_NFC_feature_supported");
708                 return NULL;
709         }
710         setting_main_appdata *ad = (setting_main_appdata *)data;
711
712
713         int value, err;
714         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_SBEAM, &value, &err);
715
716         ad->data_sbeam = setting_create_Gendial_field_groupitem(genlist,
717                                                 &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
718                                                    //&(ad->itc[GENDIAL_Type_1text_2icon]),
719                                                    parent,
720                                                    setting_main_click_list_ex_ug_cb,
721                                                    ug_args,
722                                                    SWALLOW_Type_1ICON_1RADIO,
723                                                    icon_path,
724                                                    NULL,
725                                                    value,
726                                                    keyStr,
727                                                    NULL,
728                                                    setting_main_click_list_sbeam_mode_cb);
729         __BACK_POINTER_SET(ad->data_sbeam);
730         if(ad->data_sbeam)
731         {
732                 ad->data_sbeam->userdata = ad;
733         }
734
735         return ad->data_sbeam;
736 }
737 #endif
738
739 static Setting_GenGroupItem_Data * __default_handler(void* data, char* keyStr, char* icon_path, char* ug_args, Evas_Object *genlist, Elm_Object_Item *parent)
740 {
741         //SETTING_TRACE_BEGIN;
742         setting_main_appdata *ad = (setting_main_appdata *)data;
743         Setting_GenGroupItem_Data * obj = setting_create_Gendial_field_groupitem(genlist,
744                                                            &(ad->itc[GENDIAL_Type_1text_1icon_2]),
745                                                            parent,
746                                                            setting_main_click_list_ex_ug_cb,
747                                                            ug_args,
748                                                            SWALLOW_Type_INVALID,
749                                                            icon_path,
750                                                            NULL, 0,
751                                                            keyStr,
752                                                            NULL,
753                                                            NULL);
754
755         return obj;
756 }
757
758 static Setting_GenGroupItem_Data * __powersaving_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
759 {
760         // NOT UG --> it's just UI drawing
761         setting_main_appdata *ad = (setting_main_appdata *)data;
762
763         Setting_GenGroupItem_Data *item_data = NULL;
764
765 #if SUPPORT_POWERSAVING
766         int value;
767         int ret = vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, &value);
768         if (ret != 0) {
769                 SETTING_TRACE_ERROR("get vconf failed");
770                 value = 1;
771         }
772         ad->data_powersaving =  setting_create_Gendial_field_groupitem(genlist,
773                         &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
774                         //&(ad->itc[GENDIAL_Type_1text_2icon]),
775                         parent,
776                         setting_main_click_list_ex_ug_cb,
777                         ug_name,
778                         SWALLOW_Type_1ICON_1RADIO,
779                         icon_path,
780                         NULL,
781                         value,
782                         keyStr,
783                         NULL,
784                         setting_main_list_mouse_up_cb);
785         __BACK_POINTER_SET(ad->data_powersaving);
786         item_data = ad->data_powersaving;
787 #endif
788
789 #if SUPPORT_PSMODE
790         ad->data_powersaving =  setting_create_Gendial_field_groupitem(genlist,
791                         &(ad->itc[GENDIAL_Type_1text_1icon_2]),
792                         parent,
793                         setting_main_click_list_ex_ug_cb,
794                         ug_name,
795                         SWALLOW_Type_INVALID,
796                         icon_path,
797                         NULL,
798                         0,
799                         keyStr,
800                         NULL,
801                         NULL);
802         __BACK_POINTER_SET(ad->data_powersaving);
803         item_data = ad->data_powersaving;
804         int flight_key;
805         int ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_key);
806         if (ret != 0) {
807                 SETTING_TRACE_ERROR("get vconf failed");
808                 flight_key = 1;
809         }
810
811         if (ad->data_powersaving) {
812                 if(flight_key){
813                         setting_disable_genlist_item(ad->data_powersaving->item);
814                 }
815         }
816 #endif
817         return item_data;
818 }
819
820 static Setting_GenGroupItem_Data * __driving_handler(void* data, char* keyStr, char* icon_path, char* ug_name, Evas_Object *genlist, Elm_Object_Item *parent)
821 {
822         // NOT UG --> it's just UI drawing
823
824         setting_main_appdata *ad = (setting_main_appdata *)data;
825         int value;
826         int ret = vconf_get_bool(VCONFKEY_SETAPPL_DM_DRIVING_MODE, &value);
827         if (ret != 0) {
828                 SETTING_TRACE_ERROR("get vconf failed");
829                 value = 1;
830         }
831         ad->data_driving =  setting_create_Gendial_field_groupitem(genlist,
832                                         &(ad->itc[GENDIAL_Type_1text_2icon_divider]),
833                                            //&(ad->itc[GENDIAL_Type_1text_2icon]),
834                                            parent,
835                                            setting_main_click_list_ex_ug_cb,
836                                            ug_name,
837                                            SWALLOW_Type_1ICON_1RADIO,
838                                            icon_path,
839                                            NULL,
840                                            value,
841                                            keyStr,
842                                            NULL,
843                                            setting_main_list_mouse_up_cb);
844         __BACK_POINTER_SET(ad->data_driving);
845         return ad->data_driving;
846 }
847
848 //////////////////////////////////////////////////////////////////////////////////////////////
849 // list handler
850 static mainlist_entry mainlist_table[] = {
851         {KeyStr_FlightMode,     __default_handler, UG_HANDLE, NULL},                    // 0 --> NOT UG
852         {KeyStr_NetRestrictionMode,     __netrestrictionmode_handler, UI_PROC, NULL},   // 0 --> NOT UG
853         {KeyStr_WiFi,                   __default_handler, UI_PROC, NULL},                              // 1 --> UG
854         {KeyStr_Bluetooth,              __default_handler, UI_PROC, NULL},
855         {KeyStr_MobileAP,               __mobileap_handler,UG_HANDLE, NULL},                    // 1 --> UG
856         {KeyStr_AllShare,               __allshare_handler, UI_PROC, NULL},                     // NOT UG
857         {KeyStr_Location,               __default_handler,UI_PROC, NULL},                               // 1 --> UG
858         {KeyStr_Network,                __default_handler,UG_HANDLE, NULL},                             // 1 --> UG
859 #if SUPPORT_NFC
860         {KeyStr_NFC,                    __nfc_handler,UG_HANDLE, NULL},                                 // 1 --> UG
861         {KeyStr_SBeam,                  __sbeam_handler,UG_HANDLE, NULL},                               // 1 --> UG
862 #endif
863         {KeyStr_Powersaving,            __powersaving_handler, UI_PROC, NULL},                          // 1 --> UG
864         {keystr_Drivingmode,            __driving_handler, UI_PROC, NULL},                              // 1 --> UG
865         {KeyStr_Joyn,                   __joyn_handler,UI_PROC, NULL},
866         {KeyStr_DeveloperOption, __developer_option_handler,UI_PROC, NULL},
867         {KeyStr_BacklightTime, __backlight_time_handler,UI_PROC, NULL},
868         {KeyStr_BatteryPercent, __battery_percent_handler,UG_HANDLE, NULL},
869         {Keystr_ScreenMode, __screen_mode_handler, UG_HANDLE, NULL},
870         {KeyStr_HighTouchSens, __default_handler, UI_PROC, NULL},
871         //{KeyStr_Guestmode, __guest_mode_handler,UI_PROC, NULL},
872         {keystr_Personalmode, __personal_mode_handler,UI_PROC, NULL},
873 #if SUPPORT_BLOCKINGMODE
874         {keystr_Blockingmode, __blocking_mode_handler,UI_PROC, NULL},
875 #endif
876         {KeyStr_Brightness, __brightness_handler,UI_PROC, NULL},
877         {KeyStr_MultiWindowMode, __multiwindow_mode_handler,UI_PROC, NULL},
878         {KeyStr_Landscape, __landscape_handler, UG_HANDLE, NULL},
879         {KeyStr_AdjustScreenTone, __adjust_screen_tone_handler, UI_PROC, NULL},
880         {"Default",                     __default_handler, DEFAULT_UI, NULL},                           // 1 --> UG
881
882         //--------------------------------------------------------------
883         {NULL, NULL, ERROR_STATE, NULL},
884 };
885
886 //-----------------------------------------------------------------------------------------
887 // hash table utility
888 static void __list_hash_free_cb(void *obj)
889 {
890         SETTING_TRACE_BEGIN;
891    //const char *name = key;
892    //const char *number = data;
893    //printf("%s: %s\n", name, number);
894
895 }
896
897 // hash table utility
898 void settinig_drawer_hash_init(void *cb)
899 {
900         SETTING_TRACE_BEGIN;
901
902         setting_main_appdata *ad = (setting_main_appdata *) cb;
903         eina_init();
904
905         mainlist_entry* pnode = NULL;
906         ad->main_list_hash = eina_hash_string_superfast_new(__list_hash_free_cb);
907
908         for (pnode = &mainlist_table[0]; pnode->title != NULL; pnode++)
909         {
910                 eina_hash_add(ad->main_list_hash , pnode->title, pnode);
911                 //SETTING_TRACE("init and add data to hash : %s ", pnode->title);
912         }
913 }
914
915 // hash table utility
916 mainlist_entry* settinig_drawer_hash_find(void *cb, char* search_str)
917 {
918         //SETTING_TRACE_BEGIN;
919         //SETTING_TRACE("------------------ HASH SEARCH ----------------------, %s", search_str);
920         setting_main_appdata *ad = (setting_main_appdata *) cb;
921         mainlist_entry* pnode = NULL;
922
923         pnode = eina_hash_find(ad->main_list_hash, search_str);
924         return pnode;   // statically allocated
925 }
926 //-----------------------------------------------------------------------------------------
927
928
929 /* ***************************************************
930  *
931  *call back func
932  *
933  ***************************************************/
934
935
936 /* obj is the layout clicked */
937 void
938 setting_main_click_list_item_ug_cb(void *data, Evas_Object *obj,
939                                    char *ug_to_load, app_control_h svc,
940                                    struct ug_cbs *cbs)
941 {
942         SETTING_TRACE_BEGIN;
943         setting_main_appdata *ad = (setting_main_appdata *) data;
944         if (!ug_to_load) {
945                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
946                 return;
947         }
948         SETTING_TRACE("to create libug-%s.so", ug_to_load);
949         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
950
951         //setting_conformant_keypad_state(ad->win_main, TRUE);
952         ad->ug = setting_ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
953         if (ad->ug) {
954                 ad->isInUGMode = TRUE;
955         } else {
956                 elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE);
957                 evas_object_show(ad->ly_main);
958                 //don't going to access globle var errno
959                 //SETTING_TRACE_ERROR("errno:%d", errno);
960                 //SETTING_TRACE_ERROR("Failed to load /usr/ug/lib/libug-%s.so", ug_to_load);
961                 //SETTING_TRACE_ERROR("Failed to load lib-%s.so", ug_to_load);
962                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
963         }
964 }
965
966 void /* obj is the layout clicked */
967 setting_main_click_grid_item_ug_cb(void *data, Evas_Object *obj,
968                                    char *ug_to_load, app_control_h svc,
969                                    struct ug_cbs *cbs)
970 {
971         SETTING_TRACE_BEGIN;
972         setting_main_appdata *ad = (setting_main_appdata *) data;
973         if (!ug_to_load) {
974                 setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
975                 return;
976         }
977
978         SETTING_TRACE("to create libug-%s.so", ug_to_load);
979         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
980
981         //setting_conformant_keypad_state(ad->win_main, TRUE);
982         ad->ug = setting_ug_create(NULL, ug_to_load, UG_MODE_FULLVIEW, svc, cbs);
983         if (ad->ug) {
984                 ad->isInUGMode = TRUE;
985         } else {
986                 elm_object_tree_focus_allow_set(ad->ly_main, EINA_TRUE);
987                 evas_object_show(ad->ly_main);
988
989                 SETTING_TRACE_ERROR("errno:%d", errno);
990         }
991         //SETTING_TRACE_END;
992 }
993
994 void setting_main_click_list_default_ug_cb(void *data, Evas_Object *obj, void *event_info)
995 {
996         setting_main_appdata *ad = data;
997         setting_create_simple_popup(ad, ad->win_main, NULL,
998                                           NO_UG_FOUND_MSG);
999 }
1000
1001 void setting_main_click_list_usb_cb(void *data, Evas_Object *obj, void *event_info)
1002 {
1003         SETTING_TRACE_BEGIN;
1004         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1005
1006         int err;
1007         int value = -1;
1008         char *str_text = USB_NEED_OFF;
1009
1010         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1011
1012         setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &value, &err);
1013         if (err != 0)
1014         {
1015                 SETTING_TRACE_ERROR("FAIL: VCONFKEY_MOBILE_HOTSPOT_MODE may not exist\n");
1016                 setting_main_click_list_ex_ug_cb(data, obj, item);
1017                 return;
1018         }
1019
1020         /* If mobile hotspot is on, going USB utilties is blocked by a popup*/
1021         if (value & VCONFKEY_MOBILE_HOTSPOT_MODE_USB)
1022         {
1023                 elm_genlist_item_selected_set(item, EINA_FALSE);
1024                 setting_create_simple_popup(g_main_ad, g_main_ad->win_main, NULL, str_text);
1025         }
1026         else
1027         {
1028                 setting_main_click_list_ex_ug_cb(data, obj, item);
1029         }
1030 }
1031
1032 void setting_main_kies_via_wifi_care_resp_cb(void *data, Evas_Object *obj,
1033                                                void *event_info)
1034 {
1035         SETTING_TRACE_BEGIN;
1036         setting_retm_if(NULL == data, "NULL == data");
1037         setting_main_appdata *ad = g_main_ad;
1038         int response_type = btn_type(obj);
1039
1040         if (POPUP_RESPONSE_OK == response_type)
1041         {
1042                 // do  nothing..
1043                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1044                 setting_retm_if(!cbs, "calloc failed");
1045                 cbs->layout_cb = setting_main_layout_ug_cb;
1046                 cbs->result_cb = setting_main_result_ug_cb;
1047                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1048                 cbs->priv = (void *)ad;
1049
1050                 char *path = get_ug_path_from_ug_args(data);
1051                 app_control_h svc = get_bundle_from_ug_args(data);
1052                 setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1053                 if (path)
1054                 {
1055                         FREE(path);
1056                 }
1057                 if (cbs)
1058                 {
1059                         FREE(cbs);
1060                 }
1061                 path = NULL;
1062                 cbs = NULL;
1063                 app_control_destroy(svc);
1064         }
1065         else if (POPUP_RESPONSE_CANCEL == response_type)
1066         {
1067                 SETTING_TRACE(" cancel - do nothing ");
1068         } else {
1069                 SETTING_TRACE(" NOT REACHABLE -- response_type : %d", response_type);
1070         }
1071         evas_object_del(ad->popup_kies_via_wifi);
1072         ad->popup_kies_via_wifi = NULL;
1073 }
1074 void setting_main_kies_via_wifi_warn_resp_cb(void *data, Evas_Object *obj,
1075                                                void *event_info)
1076 {
1077         setting_retm_if(NULL == data, "NULL == data");
1078         setting_main_appdata *ad = g_main_ad;
1079         evas_object_del(ad->popup_kies_via_wifi);
1080         ad->popup_kies_via_wifi = NULL;
1081 }
1082
1083
1084
1085
1086 void setting_main_click_list_ex_personal_mode_cb(void *data, Evas_Object *obj,
1087                                  void *event_info)
1088 {
1089         SETTING_TRACE_BEGIN;
1090         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1091         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1092
1093         elm_genlist_item_selected_set(item, EINA_FALSE);
1094
1095         bool is_running = FALSE;
1096         app_manager_is_running("org.tizen.setting.personal", &is_running);
1097         if(!is_running)
1098         {
1099                 elm_object_tree_focus_allow_set(g_main_ad->ly_main, EINA_FALSE);
1100                 app_control_h svc;
1101                 if(app_control_create(&svc))
1102                 {
1103                         //FREE(cbs);
1104                         return;
1105                 }
1106                 app_control_set_app_id(svc, "org.tizen.setting.personal");
1107                 app_control_set_window(svc, elm_win_xwindow_get(g_main_ad->win_main));
1108                 app_control_set_operation(svc, APP_CONTROL_OPERATION_DEFAULT);
1109                 app_control_send_launch_request(svc, NULL, NULL);
1110                 app_control_destroy(svc);
1111         }
1112 }
1113
1114 void setting_main_click_list_ex_ug_cb(void *data, Evas_Object *obj,
1115                                  void *event_info)
1116 {
1117         SETTING_TRACE_BEGIN;
1118         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1119         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1120
1121         elm_genlist_item_selected_set(item, EINA_FALSE);
1122
1123
1124         SETTING_TRACE("g_main_ad->isInUGMode:%d", g_main_ad->isInUGMode);
1125         SETTING_TRACE("g_main_ad->ug:%p", g_main_ad->ug);
1126         if (g_main_ad->isInUGMode && g_main_ad->ug) {
1127                 SETTING_TRACE
1128                     ("[ad->ug non-NULL]skip genlist click event!!");
1129
1130                 //SETTING_TRACE_END;
1131                 return;
1132         }
1133
1134         setting_main_appdata *ad = g_main_ad;
1135
1136         /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1137         if (ad->isInUGMode) {
1138                 SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1139                 ad->isInUGMode = FALSE;
1140                 //SETTING_TRACE_END;
1141                 return;
1142         } else {
1143                 SETTING_TRACE
1144                     ("isInUGMode : FALSE - another UG is NOT running now.")
1145         }
1146
1147         Setting_GenGroupItem_Data *selected_item_data =
1148             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1149         setting_main_click_list_item_reset_data(ad, obj);
1150         const char *item_name = _(selected_item_data->keyStr);
1151         SETTING_TRACE("item_name:%s", item_name);
1152         ret_if(!item_name);
1153
1154         if (!safeStrCmp(KeyStr_KeisOverWifi, selected_item_data->keyStr)) {
1155                 int status = VCONFKEY_MOBEX_ENGINE_STATUS_NOT_CONNECT;
1156                 int methord = VCONFKEY_MOBEX_ENGIN_NONE;
1157                 vconf_get_int(VCONFKEY_MOBEX_ENGINE_STATUS_INT, &status);
1158                 vconf_get_int(VCONFKEY_MOBEX_ENGINE_CONNECTION_METHOD_INT, &methord);
1159
1160                 if (status != VCONFKEY_MOBEX_ENGINE_STATUS_NOT_CONNECT
1161                     && methord == VCONFKEY_MOBEX_ENGIN_USB)
1162                 {
1163                         ad->popup_kies_via_wifi =
1164                             setting_create_popup_with_btn(data, ad->win_main,
1165                                                  NULL, Kies_Warrning_Str,
1166                                                  setting_main_kies_via_wifi_warn_resp_cb,
1167                                                  0, 1, "IDS_COM_SK_OK");
1168                 }
1169                 else
1170                 {
1171                         ad->popup_kies_via_wifi = setting_create_popup_with_btn(data,
1172                                          ad->win_main,
1173                                          NULL,_(Kies_Caring_Str),
1174                                          setting_main_kies_via_wifi_care_resp_cb,
1175                                          0, 2, "IDS_COM_SK_OK","IDS_COM_SK_CANCEL");
1176                 }
1177                 return;
1178         }
1179
1180
1181         if (safeStrCmp(selected_item_data->keyStr, KeyStr_MoreDisplay) == 0) {
1182                 return;
1183         }
1184
1185         if ( !safeStrCmp(selected_item_data->keyStr, KeyStr_Call)
1186             || !safeStrCmp(selected_item_data->keyStr, keystr_Blockingmode)
1187                 || !safeStrCmp(selected_item_data->keyStr, keystr_Drivingmode)
1188                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_SimMgr)
1189                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_WiFi)
1190                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_Location)
1191                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_Bluetooth)
1192                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_MobileAP)
1193                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_WiFiDirect)
1194                 || !safeStrCmp(selected_item_data->keyStr, KeyStr_Wallpaper)
1195            )
1196         {
1197                 if(app_launcher(data) == 0)
1198                 {
1199                         ad->event_freeze_timer = ecore_timer_add(1, setting_main_freeze_event_timer_cb, ad);
1200                         evas_object_freeze_events_set(ad->navibar_main, EINA_TRUE);
1201                 }
1202                 int click_times = setting_cfg_get_click_times(selected_item_data->keyStr);
1203                 setting_cfg_set_click_times(selected_item_data->keyStr, ++click_times);
1204                 return;
1205         }
1206
1207         //special checking:
1208         //1.powersaving cannot work when Flightmode on
1209         if (safeStrCmp(selected_item_data->keyStr, KeyStr_Powersaving) == 0) {
1210                 int status = 0;
1211                 vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status);
1212                 if (status)
1213                 {
1214                         setting_create_simple_popup(NULL, ad->win_main,
1215                                                     NULL, "IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON");
1216                         return;
1217                 }
1218         }
1219
1220         //2.Quick command cannot work when TTS on
1221         int tts_state = 0;
1222         vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &tts_state);
1223         if (tts_state)
1224         {
1225                 if (!safeStrCmp(selected_item_data->keyStr, KeyStr_QUICK_CMD))
1226                 {
1227                         char noti_str[MAX_SPECIALIZITION_LEN + 1] = { 0, };
1228                         snprintf(noti_str, sizeof(noti_str), _(FEATURE_UNAVALIABLE_WHILE_TTS_ON), _(KeyStr_QUICK_CMD));
1229                         setting_create_popup_without_btn(NULL, ad->win_main, NULL, _(noti_str),
1230                                                          NULL, 0.0, TRUE, FALSE);
1231                         return;
1232                 }
1233         }
1234
1235         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1236         setting_retm_if(!cbs, "calloc failed");
1237         cbs->layout_cb = setting_main_layout_ug_cb;
1238         cbs->result_cb = setting_main_result_ug_cb;
1239         cbs->destroy_cb = setting_main_destroy_ug_cb;
1240         cbs->priv = (void *)ad;
1241
1242         char *path = get_ug_path_from_ug_args(data);
1243         app_control_h svc = get_bundle_from_ug_args(data);
1244         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1245         if (path)
1246         {
1247                 FREE(path);
1248         }
1249         if (cbs)
1250         {
1251                 FREE(cbs);
1252         }
1253         path = NULL;
1254         cbs = NULL;
1255         app_control_destroy(svc);
1256
1257 }
1258
1259 #if SUPPORT_BLOCKINGMODE
1260 static void
1261 ___blocking_mode_resp_cb(void *data, Evas_Object *obj, void *event_info)
1262 {
1263         SETTING_TRACE_BEGIN;
1264         setting_retm_if(obj == NULL, "obj parameter is NULL");
1265         setting_retm_if(data == NULL, "Data parameter is NULL");
1266         int reposnse_type = btn_type(obj);
1267         if (g_main_ad->popup_blocking_mode)
1268         {
1269                 evas_object_del(g_main_ad->popup_blocking_mode);
1270                 g_main_ad->popup_blocking_mode = NULL;
1271         }
1272         switch (reposnse_type) {
1273         case POPUP_RESPONSE_OK:
1274         {
1275                 if (g_main_ad->isInUGMode && g_main_ad->ug) {
1276                         SETTING_TRACE("[ad->ug non-NULL]skip genlist click event!!");
1277
1278                         return;
1279                 }
1280
1281                 setting_main_appdata *ad = g_main_ad;
1282
1283                 /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1284                 if (ad->isInUGMode) {
1285                         SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1286                         ad->isInUGMode = FALSE;
1287                         return;
1288                 } else {
1289                         SETTING_TRACE
1290                         ("isInUGMode : FALSE - another UG is NOT running now.")
1291                 }
1292
1293                 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1294                 SETTING_TRACE("process item [%s]", list_item->keyStr);
1295                 list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
1296
1297                 if (!list_item->chk_status) {
1298                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, !list_item->chk_status);
1299                 }
1300
1301                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1302                 setting_retm_if(!cbs, "calloc failed");
1303                 cbs->layout_cb = setting_main_layout_ug_cb;
1304                 cbs->result_cb = setting_main_result_ug_cb;
1305                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1306                 cbs->priv = (void *)ad;
1307                 char *ug_args = NULL;
1308
1309                 char *keyStr = NULL;
1310                 int i, j;
1311
1312                 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1313                         for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1314                                 keyStr = setting_cfg_get_keyname_idx(i, j);
1315                                 if (!safeStrCmp(keystr_Blockingmode, keyStr)) {
1316                                         ug_args = setting_cfg_get_ug_args_idx(i, j);
1317                                         break;
1318                                 }
1319                         }
1320                 }
1321
1322                 if(ug_args)
1323                 {
1324                         setting_create_quickpannel_notification("setting-blockingmode-efl",
1325                                                 NOTIFICATION_TYPE_ONGOING,
1326                                                 NOTIFICATION_LY_ONGOING_EVENT,
1327                                                 "IDS_ST_BODY_BLOCKING_MODE",
1328                                                 "IDS_ST_BODY_BLOCKING_MODE_IS_ENABLED",
1329                                                 IMG_BlockingMode, &ad->noti_id);
1330                         char *path = get_ug_path_from_ug_args(ug_args);
1331                         app_control_h svc = get_bundle_from_ug_args(ug_args);
1332                         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1333                         FREE(path);
1334                         app_control_destroy(svc);
1335                 }else
1336                 {
1337                         SETTING_TRACE("blocking mode not found");
1338                 }
1339                 FREE(cbs);
1340
1341         }
1342         default:
1343                 break;
1344         }
1345 }
1346 #endif
1347
1348 #if SUPPORT_DRIVINGMODE
1349 static void
1350 ___driving_mode_resp_cb(void *data, Evas_Object *obj, void *event_info)
1351 {
1352         SETTING_TRACE_BEGIN;
1353         setting_retm_if(obj == NULL, "obj parameter is NULL");
1354         setting_retm_if(data == NULL, "Data parameter is NULL");
1355         int reposnse_type = btn_type(obj);
1356         if (g_main_ad->driving_mode_popup)
1357         {
1358                 evas_object_del(g_main_ad->driving_mode_popup);
1359                 g_main_ad->driving_mode_popup = NULL;
1360         }
1361         switch (reposnse_type) {
1362         case POPUP_RESPONSE_OK:
1363         {
1364                 if (g_main_ad->isInUGMode && g_main_ad->ug) {
1365                         SETTING_TRACE("[ad->ug non-NULL]skip genlist click event!!");
1366
1367                         return;
1368                 }
1369
1370                 setting_main_appdata *ad = g_main_ad;
1371
1372                 /*  if UG is created by Setting app, setting_main_click_list_ex_ug_cb is diabled. */
1373                 if (ad->isInUGMode) {
1374                         SETTING_TRACE("isInUGMode : TRUE - another UG is running now.");
1375                         ad->isInUGMode = FALSE;
1376                         return;
1377                 } else {
1378                         SETTING_TRACE
1379                         ("isInUGMode : FALSE - another UG is NOT running now.");
1380                 }
1381
1382                 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1383                 if(list_item && list_item->keyStr){
1384                         SETTING_TRACE("process item [%s]", list_item->keyStr);
1385                 }
1386                 list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
1387
1388                 if (!list_item->chk_status) {
1389                         vconf_set_bool(VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE, !list_item->chk_status);
1390                 }
1391
1392                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1393                 setting_retm_if(!cbs, "calloc failed");
1394                 cbs->layout_cb = setting_main_layout_ug_cb;
1395                 cbs->result_cb = setting_main_result_ug_cb;
1396                 cbs->destroy_cb = setting_main_destroy_ug_cb;
1397                 cbs->priv = (void *)ad;
1398                 char *ug_args = NULL;
1399
1400                 char *keyStr = NULL;
1401                 int i, j;
1402
1403                 for (i = 0; i < setting_cfg_get_category_length(); i++) {
1404                         for (j = 0; j < setting_cfg_get_menu_length(i); j++) {
1405                                 keyStr = setting_cfg_get_keyname_idx(i, j);
1406                                 if (!safeStrCmp(keystr_Drivingmode, keyStr)) {
1407                                         ug_args = setting_cfg_get_ug_args_idx(i, j);
1408                                         break;
1409                                 }
1410                         }
1411                 }
1412
1413                 if(ug_args)
1414                 {
1415                         //__driving_mode_create_noti(ad,"IDS_ST_BODY_INCOMING_CALLS_AND_NEW_NOTIFICATIONS_WILL_BE_READ_OUT_AUTOMATICALLY");
1416                         setting_create_quickpannel_notification("setting-drivingmode-efl",
1417                                                 NOTIFICATION_TYPE_ONGOING,
1418                                                 NOTIFICATION_LY_ONGOING_EVENT,
1419                                                 keystr_Drivingmode,
1420                                                 "IDS_ST_BODY_INCOMING_CALLS_AND_NEW_NOTIFICATIONS_WILL_BE_READ_OUT_AUTOMATICALLY",
1421                                                 IMG_DrivingMode, &ad->noti_id);
1422
1423                         char *path = get_ug_path_from_ug_args(ug_args);
1424                         app_control_h svc = get_bundle_from_ug_args(ug_args);
1425                         setting_main_click_list_item_ug_cb(ad, obj, path, svc, cbs);
1426                         FREE(path);
1427                         app_control_destroy(svc);
1428                 }else
1429                 {
1430                         SETTING_TRACE("driving mode not found");
1431                 }
1432                 FREE(cbs);
1433
1434         }
1435         default:
1436                 break;
1437         }
1438 }
1439 #endif
1440
1441
1442 /**
1443  * toggle cb
1444  */
1445 static void __personal_mode_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
1446 {
1447         SETTING_TRACE_BEGIN;
1448         ret_if(!user_data);
1449
1450         Setting_GenGroupItem_Data *item = (Setting_GenGroupItem_Data*)user_data;
1451
1452         /* Rollback toggle before applying */
1453         int status = 0;
1454         vconf_get_bool(VCONFKEY_SETAPPL_PERSONAL_MODE_STATUS_BOOL, &status);
1455         item->chk_status = status;
1456         elm_check_state_set(item->eo_check, item->chk_status);
1457 }
1458
1459 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
1460                                           void *event_info)
1461 {
1462         //SETTING_TRACE_BEGIN;
1463         retm_if(data == NULL, "Data parameter is NULL");
1464         Setting_GenGroupItem_Data *list_item =
1465             (Setting_GenGroupItem_Data *) data;
1466         SETTING_TRACE("process item [%s]", list_item->keyStr);
1467         list_item->chk_status = elm_check_state_get(eo);        /* for update new state */
1468
1469         SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
1470                       list_item->chk_status);
1471         setting_main_appdata *ad = g_main_ad;
1472
1473         if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
1474                 int err;
1475                 if (elm_check_state_get(eo)) {
1476                         setting_set_bool_slp_key
1477                             (BOOL_SLP_SETTING_USE_PACKET_DATA,
1478                              SETTING_ON_OFF_BTN_ON, &err);
1479                 } else {
1480                         setting_set_bool_slp_key
1481                             (BOOL_SLP_SETTING_USE_PACKET_DATA,
1482                              SETTING_ON_OFF_BTN_OFF, &err);
1483                 }
1484 #if SUPPORT_DRIVINGMODE
1485         } else if (!safeStrCmp(keystr_Drivingmode, list_item->keyStr)) {
1486                 //if set on, need to add popup
1487                 if (list_item->chk_status) {
1488                         if (!check_drivingmode_sub_item()) {
1489                                 g_main_ad->driving_mode_popup = setting_create_popup_with_btn(list_item, ad->win_main,
1490                                                 NULL,"IDS_ST_POP_TO_ENABLE_HANDS_FREE_MODE_ENABLE_AT_LEAST_ONE_RELEVANT_FUNCTION",
1491                                                 ___driving_mode_resp_cb, 0,
1492                                                 2, "IDS_COM_SK_OK","IDS_COM_SK_CANCEL");
1493                                 list_item->chk_status = !list_item->chk_status;
1494                                 elm_genlist_item_update(list_item->item);
1495                                 return;
1496                         }
1497                 }
1498                 else{
1499                         //
1500                 }
1501                 vconf_set_bool(VCONFKEY_SETAPPL_DRIVINGMODE_DRIVINGMODE, list_item->chk_status);
1502
1503                 // call the set_state
1504                 Setting_Cfg_Node_T* pnode = get_cfg_node_by_keystr(_(list_item->keyStr));
1505                 if (pnode && pnode->tfunc && pnode->tfunc->set_item_state) {
1506                         pnode->tfunc->set_item_state(list_item->chk_status, NULL, ad);
1507                 }
1508 #endif
1509 #if SUPPORT_BLOCKINGMODE
1510         } else if (!safeStrCmp(keystr_Blockingmode, list_item->keyStr)) {
1511
1512                 if (list_item->chk_status) {
1513                         if (!check_blockingmode_sub_item()) {
1514                                 g_main_ad->popup_blocking_mode = setting_create_popup_with_btn(ad, ad->win_main,
1515                                                 NULL,"IDS_ST_BODY_TO_ENABLE_BLOCKING_MODE_ENABLE_AT_LEAST_ONE_OPTION",
1516                                                 ___blocking_mode_resp_cb, 0,
1517                                                 2, "IDS_COM_SK_OK","IDS_COM_SK_CANCEL");
1518                                 list_item->chk_status = !list_item->chk_status;
1519                                 elm_genlist_item_update(list_item->item);
1520                                 return;
1521                         }
1522                 }else {
1523                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_INCOMINGCALL, FALSE);
1524                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_NOTIFICATIONS, FALSE);
1525                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_ALARM_AND_TIMER, FALSE);
1526                         vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_LED_INDICATOR, FALSE);
1527                 }
1528                 vconf_set_bool(VCONFKEY_SETAPPL_BLOCKINGMODE_BLOCKINGMODE, list_item->chk_status);
1529
1530                 Setting_Cfg_Node_T* pnode = get_cfg_node_by_keystr(_(list_item->keyStr));
1531
1532                 if (pnode && pnode->tfunc && pnode->tfunc->set_item_state) {
1533                         pnode->tfunc->set_item_state(list_item->chk_status, NULL, ad);
1534                 }
1535 #endif
1536 #if SUPPORT_PERSONALPAGE
1537         } else if (!safeStrCmp(keystr_Personalmode, list_item->keyStr)) {
1538                 //personalmode_toggle_set_state(list_item->chk_status, NULL, ad);
1539                 if (Cfg_Item_Error == list_item->chk_status) return;
1540
1541                 bool is_running = FALSE;
1542                 app_manager_is_running("org.tizen.setting.personal", &is_running);
1543                 if(!is_running)
1544                 {
1545                         elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
1546                         app_control_h svc;
1547                         if(app_control_create(&svc))
1548                         {
1549                                 return;
1550                         }
1551                         // verify current key
1552                         app_control_add_extra_data(svc, "viewtype", "unlock_method");
1553                         app_control_set_app_id(svc, "org.tizen.setting.personal");
1554                         app_control_set_window(svc, elm_win_xwindow_get(ad->win_main));
1555                         app_control_set_operation(svc, APP_CONTROL_OPERATION_DEFAULT);
1556                         app_control_send_launch_request(svc, __personal_mode_cb, ad->data_temp);
1557                         app_control_destroy(svc);
1558                 }
1559 #endif
1560
1561 #if SUPPORT_GUESTMODE
1562         } else if (!safeStrCmp(KeyStr_Guestmode, list_item->keyStr)) {
1563                 vconf_set_bool(VCONFKEY_SETAPPL_GM_GUEST_MODE, list_item->chk_status);
1564 #endif
1565
1566 #if SUPPORT_POWERSAVING
1567         } else if (!safeStrCmp(KeyStr_Powersaving, list_item->keyStr)) {
1568                 if (list_item->chk_status) {
1569                         if (!check_powersaving_sub_item()) {
1570                                 setting_create_popup_without_btn(ad, ad->win_main, NULL,
1571                                                 "IDS_ST_BODY_TO_ENABLE_POWER_SAVING_MODE_ENABLE_AT_LEAST_ONE_FUNCTION",
1572                                                 NULL, POPUP_INTERVAL, FALSE, FALSE);
1573                                 list_item->chk_status = !list_item->chk_status;
1574                         }
1575                 }
1576                 vconf_set_bool(VCONFKEY_SETAPPL_PWRSV_SYSMODE_STATUS, list_item->chk_status);
1577                 vconf_set_int(VCONFKEY_SETAPPL_PSMODE, list_item->chk_status);
1578         } else if(!safeStrCmp(KeyStr_MultiWindowMode, list_item->keyStr)){
1579                 //Multi window toggle action
1580                 //elm_genlist_item_update(list_item->item);
1581                 int ret = vconf_set_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, list_item->chk_status);
1582                 if(ret != 0){
1583                         SETTING_TRACE_ERROR("Set multi window vconf failed.");
1584                 }
1585 #endif
1586         }
1587         return;
1588 }
1589
1590
1591
1592
1593 static void ___wifi_activated_cb(wifi_error_e result, void* user_data)
1594 {
1595         SETTING_TRACE_BEGIN;
1596         if (result == WIFI_ERROR_NONE)
1597         {
1598                 SETTING_TRACE("Wi-Fi Activation Succeeded");
1599         }
1600         else
1601         {
1602                 SETTING_TRACE("Wi-Fi Activation Failed! error : %d", result);
1603         }
1604
1605         (void)wifi_deinitialize();
1606 }
1607
1608 #if SUPPORT_TETHERING
1609 static void __tethering_disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
1610 {
1611         int ret;
1612
1613         if (data) {
1614                 tethering_h th = (tethering_h)data;
1615                 tethering_destroy(th);
1616         }
1617
1618         ret = wifi_initialize();
1619         setting_retm_if(ret < 0, "*** [ERR] wifi_initialize() ***");
1620
1621         ret = wifi_activate(___wifi_activated_cb, NULL);
1622         if (ret < 0) {
1623                 SETTING_TRACE_ERROR("*** [ERR] wifi_activate() ***");
1624                 (void)wifi_deinitialize();
1625                 return;
1626         }
1627 }
1628 #endif
1629
1630 static Eina_Bool __wifi_timeout(void *data)
1631 {
1632         //SETTING_TRACE_BEGIN;
1633         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1634         Setting_GenGroupItem_Data *list_item = data;
1635         int status, err;
1636         setting_get_int_slp_key(INT_SLP_SETTING_WIFI_STATUS, &status, &err);
1637         SETTING_TRACE("value:%d", status);
1638
1639         int i;
1640         for (i = VIEW_All_List; i < VIEW_Max; i++)
1641         {
1642                 list_item = g_main_ad->gl_data_item[i][GL_WiFi];
1643                 if (list_item)
1644                 {
1645                         list_item->chk_status = status;
1646                         list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1647                         elm_object_item_data_set(list_item->item, list_item);
1648                         elm_genlist_item_update(list_item->item);
1649                 }
1650         }
1651         setting_main_appdata *ad = list_item->userdata;
1652         ad->wifi_timer = NULL;
1653
1654         return ECORE_CALLBACK_CANCEL;
1655 }
1656
1657 static void __tethering_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
1658 {
1659         setting_retm_if(NULL == obj, "NULL == obj");
1660         int response_type = btn_type(obj);
1661         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
1662
1663         if (g_main_ad)
1664         {
1665                 evas_object_del(g_main_ad->popup_wifi_mode);
1666                 g_main_ad->popup_wifi_mode = NULL;
1667         }
1668
1669         int i = 0;
1670         Setting_GenGroupItem_Data *update_item = NULL;
1671         if (POPUP_RESPONSE_OK == response_type)
1672         {
1673                 //add timeout strategy..
1674                 ret_if(!list_item->userdata);
1675                 setting_main_appdata *ad = list_item->userdata;
1676                 if (ad->wifi_timer) {
1677                         ecore_timer_del(ad->wifi_timer);
1678                         ad->wifi_timer = NULL;
1679                 }
1680                 ad->wifi_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __wifi_timeout, list_item);
1681
1682 #if SUPPORT_TETHERING
1683                 int type = tethering_is_enabled(NULL, TETHERING_TYPE_WIFI)?TETHERING_TYPE_WIFI:TETHERING_TYPE_WIFI_AP;
1684
1685                 tethering_h th = NULL;
1686                 tethering_error_e ret = TETHERING_ERROR_NONE;
1687
1688                 ret = tethering_create(&th);
1689                 if (ret != TETHERING_ERROR_NONE) {
1690                         for (i = VIEW_All_List; i < VIEW_Max; i++)
1691                         {
1692                                 update_item = ad->gl_data_item[i][GL_WiFi];
1693                                 if (update_item)
1694                                 {
1695                                         update_item->chk_status = EINA_FALSE;
1696                                         update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1697                                         elm_object_item_data_set(update_item->item, update_item);
1698                                         elm_genlist_item_update(update_item->item);
1699                                 }
1700                         }
1701                 }
1702
1703                 ret = tethering_set_disabled_cb(th, type, __tethering_disabled_cb, th);
1704                 if (ret != TETHERING_ERROR_NONE) {
1705                         for (i = VIEW_All_List; i < VIEW_Max; i++)
1706                         {
1707                                 update_item = ad->gl_data_item[i][GL_WiFi];
1708                                 if (update_item)
1709                                 {
1710                                         update_item->chk_status = EINA_FALSE;
1711                                         update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1712                                         elm_object_item_data_set(update_item->item, update_item);
1713                                         elm_genlist_item_update(update_item->item);
1714                                 }
1715                         }
1716
1717                         tethering_destroy(th);
1718                         return;
1719                 }
1720
1721                 (void) tethering_disable(th, type);
1722 #endif
1723         }
1724         else if (POPUP_RESPONSE_CANCEL == response_type)
1725         {
1726                 for (i = VIEW_All_List; i < VIEW_Max; i++)
1727                 {
1728                         update_item = g_main_ad->gl_data_item[i][GL_WiFi];
1729                         if (update_item)
1730                         {
1731                                 update_item->chk_status = EINA_FALSE;
1732                                 update_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1733                                 elm_object_item_data_set(update_item->item, update_item);
1734                                 elm_genlist_item_update(update_item->item);
1735                         }
1736                 }
1737         }
1738 }
1739
1740
1741 void __alternate_wifi_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
1742 {
1743         //SETTING_TRACE_BEGIN;
1744         //int ret;
1745         Eina_Bool status =  elm_check_state_get(check);
1746         SETTING_TRACE("wifi mode status : %d", status);
1747
1748         //int value, err;
1749         int i = 0;
1750         Setting_GenGroupItem_Data* item_to_update = NULL;
1751
1752 #if SUPPORT_TETHERING
1753         if (tethering_is_enabled(NULL, TETHERING_TYPE_WIFI)
1754             || tethering_is_enabled(NULL, TETHERING_TYPE_WIFI_AP)) {
1755                 for (i = VIEW_All_List; i < VIEW_Max; i++)
1756                 {
1757                         item_to_update = g_main_ad->gl_data_item[i][GL_WiFi];
1758                         if (item_to_update)
1759                         {
1760                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1761                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1762                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1763                         }
1764                 }
1765
1766                 g_main_ad->popup_wifi_mode = setting_create_popup_with_btn(list_item,
1767                                 g_main_ad->win_main, NULL,
1768                                 "IDS_MOBILEAP_POP_TURNING_ON_WI_FI_WILL_DISABLE_MOBILE_HOTSPOT_CONTINUE_Q_VZW",
1769                                 __tethering_turn_off_resp_cb,
1770                                 0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
1771         } else
1772 #endif
1773         {
1774                 int wifi_state = VCONFKEY_WIFI_OFF;
1775                 vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
1776                 DBusMessageIter iter;
1777                 DBusMessage *message = NULL;
1778                 DBusConnection *connection = NULL;
1779                 SETTING_TRACE("status:%d", status);
1780                 if (status) {
1781                         if (wifi_state != VCONFKEY_WIFI_OFF) {
1782                                 // Wi-Fi is enabled
1783                                 SETTING_TRACE("Wi-Fi is already enabled");
1784                                 return ;
1785                         }
1786                         connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
1787                         if (connection == NULL) {
1788                                 SETTING_TRACE_ERROR("Failed to get system bus");
1789                                 return;
1790                         }
1791
1792                         message = dbus_message_new_method_call(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
1793                                                 NETCONFIG_WIFI_INTERFACE, "LoadDriver");
1794                         if (message == NULL) {
1795                                 SETTING_TRACE_ERROR("Failed DBus method call");
1796                                 dbus_connection_unref(connection);
1797                                 return ;
1798                         }
1799
1800                         g_main_ad->wifi_op = OP_WIFI_TURNING_ON;
1801
1802                         dbus_message_iter_init_append(message, &iter);
1803                         dbus_bool_t val = FALSE;
1804                         dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &val);
1805
1806                         dbus_connection_send_with_reply(connection, message, NULL, 10000);
1807
1808                         dbus_message_unref(message);
1809                         dbus_connection_unref(connection);
1810
1811                 } else {
1812                         if (wifi_state == VCONFKEY_WIFI_OFF) {
1813                                 // Wi-Fi is disabled
1814                                 SETTING_TRACE("Wi-Fi is already disabled");
1815                                 return ;
1816                         }
1817
1818                         connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
1819                         if (connection == NULL) {
1820                                 SETTING_TRACE_ERROR("Failed to get system bus");
1821                                 return;
1822                         }
1823
1824                         message = dbus_message_new_method_call(NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
1825                                                 NETCONFIG_WIFI_INTERFACE, "RemoveDriver");
1826                         if (message == NULL) {
1827                                 SETTING_TRACE_ERROR("Failed DBus method call");
1828                                 dbus_connection_unref(connection);
1829                                 return;
1830                         }
1831                         g_main_ad->wifi_op = OP_WIFI_TURNING_OFF;
1832
1833                         dbus_connection_send_with_reply(connection, message, NULL, 10000);
1834
1835                         dbus_message_unref(message);
1836                         dbus_connection_unref(connection);
1837
1838                 }
1839
1840                 for (i = VIEW_All_List; i < VIEW_Max; i++)
1841                 {
1842                         item_to_update = g_main_ad->gl_data_item[i][GL_WiFi];
1843                         if (item_to_update)
1844                         {
1845                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1846                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1847                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1848
1849                         }
1850                 }
1851
1852                 //add timeout strategy..
1853                 ret_if(!list_item->userdata);
1854                 setting_main_appdata *ad = list_item->userdata;
1855                 if (ad->wifi_timer) {
1856                         ecore_timer_del(ad->wifi_timer);
1857                         ad->wifi_timer = NULL;
1858                 }
1859                 ad->wifi_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __wifi_timeout, list_item);
1860         }
1861 }
1862
1863 static Eina_Bool __bt_timeout(void *data)
1864 {
1865         //SETTING_TRACE_BEGIN;
1866         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1867         int status, err;
1868         setting_get_bool_slp_key(INT_SLP_SETTING_BT_STATUS, &status, &err);
1869         SETTING_TRACE("value:%d", status);
1870
1871         setting_main_appdata *ad = data;
1872         Setting_GenGroupItem_Data *item_to_update;
1873         int i;
1874         for (i = VIEW_All_List; i < VIEW_Max; i++)
1875         {
1876                 item_to_update = ad->gl_data_item[i][GL_BT];
1877                 SETTING_TRACE("[%d]item_to_update:%p", i, item_to_update);
1878                 if (item_to_update)
1879                 {
1880                         item_to_update->chk_status = status;
1881                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1882                         elm_object_item_data_set(item_to_update->item, item_to_update);
1883                         //elm_genlist_item_fields_update(item_to_update->item, "*", ELM_GENLIST_ITEM_FIELD_STATE);
1884                         elm_genlist_item_update(item_to_update->item);
1885                 }
1886         }
1887
1888
1889         ad->bt_timer = NULL;
1890         return ECORE_CALLBACK_CANCEL;
1891 }
1892
1893 void __alternate_bt_mode(Setting_GenGroupItem_Data *list_item, Evas_Object *check)
1894 {
1895         //SETTING_TRACE_BEGIN;
1896         int ret;
1897         Eina_Bool status =  elm_check_state_get(check);
1898         SETTING_TRACE("bt mode status : %d", status);
1899
1900         bt_adapter_state_e value;
1901         ret = bt_initialize();
1902         if (bt_adapter_get_state(&value) != BT_ERROR_NONE)
1903         {
1904                 SETTING_TRACE_ERROR("bt_adapter_get_state() failed ");
1905                 return;
1906         }
1907
1908         setting_main_appdata *ad = g_main_ad;
1909
1910         if (status == value)
1911         {
1912                 SETTING_TRACE("status == value");
1913                 int i;
1914                 for (i = VIEW_All_List; i < VIEW_Max; i++)
1915                 {
1916                         setting_force_update_gl_item_chk_status(ad->gl_data_item[i][GL_BT], value);
1917                 }
1918                 return;
1919         }
1920         do
1921         {
1922                 //add timeout strategy..
1923                 Setting_GenGroupItem_Data *item_to_update;
1924                 int i;
1925                 for (i = VIEW_All_List; i < VIEW_Max; i++)
1926                 {
1927                         item_to_update = ad->gl_data_item[i][GL_BT];
1928                         SETTING_TRACE("[%d]item_to_update:%p", i, item_to_update);
1929                         if (item_to_update)
1930                         {
1931                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
1932                                 elm_object_item_data_set(item_to_update->item, item_to_update);
1933                                 //elm_genlist_item_update(list_item->item);
1934                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
1935                         }
1936                 }
1937                 SETTING_TRACE("1111");
1938                 if (ad->bt_timer) {
1939                         ecore_timer_del(ad->bt_timer);
1940                         ad->bt_timer = NULL;
1941                 }
1942                 ad->bt_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __bt_timeout, ad);
1943
1944                 if (ret < 0)
1945                 {
1946                         break;
1947                 }
1948                 status ? (ret = bt_adapter_enable()) : (ret = bt_adapter_disable());
1949                 if (ret < 0)
1950                 {
1951                         break;
1952                 }
1953                 ret = bt_deinitialize();
1954                 if (ret < 0)
1955                 {
1956                         break;
1957                 }
1958
1959                 return;
1960         } while(0);
1961
1962         int err;
1963         int val = 0;
1964         setting_get_int_slp_key(INT_SLP_SETTING_BT_STATUS, &val, &err);
1965         setting_force_update_gl_item_chk_status(list_item, val);
1966 }
1967
1968 static Eina_Bool __nfc_timeout(void *data)
1969 {
1970         //SETTING_TRACE_BEGIN;
1971         retvm_if(!data, ECORE_CALLBACK_CANCEL, "Invalid argument: data is NULL");
1972         setting_main_appdata *ad = data;
1973         Setting_GenGroupItem_Data *list_item = NULL;
1974         int status, err;
1975         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &status, &err);
1976         SETTING_TRACE("value:%d", status);
1977
1978
1979         int i;
1980         for (i = VIEW_All_List; i < VIEW_Max; i++)
1981         {
1982                 list_item = ad->gl_data_item[i][GL_NFC];
1983                 if (list_item)
1984                 {
1985                         list_item->chk_status = status;
1986                         list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
1987                         elm_object_item_data_set(list_item->item, list_item);
1988                         elm_genlist_item_update(list_item->item);
1989                 }
1990                 // disable sbeam
1991                 list_item = ad->gl_data_item[i][GL_SBeam];
1992                 setting_genlist_item_disabled_set(list_item, 0);
1993         }
1994
1995
1996         ad->nfc_timer = NULL;
1997         return ECORE_CALLBACK_CANCEL;
1998 }
1999
2000 #if SUPPORT_NFC
2001 static void __nfc_activation_completed_cb(nfc_error_e error, void *data)
2002 {
2003         SETTING_TRACE_BEGIN;
2004         setting_main_appdata *ad = data;
2005         if (error == NFC_ERROR_NONE) {
2006                 Setting_GenGroupItem_Data *list_item;
2007                 int status;
2008                 vconf_get_bool(VCONFKEY_NFC_STATE, &status);
2009                 SETTING_TRACE("value:%d", status);
2010
2011                 int i;
2012                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2013                 {
2014                         list_item = ad->gl_data_item[i][GL_NFC];
2015                         if (list_item)
2016                         {
2017                                 list_item->chk_status = status;
2018                                 list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
2019                                 elm_object_item_data_set(list_item->item, list_item);
2020                                 elm_genlist_item_fields_update(list_item->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2021                         }
2022                 }
2023
2024
2025                 if (nfc_manager_deinitialize() != NFC_ERROR_NONE)
2026                 {
2027                         SETTING_TRACE_ERROR("failed on nfc_manager_deinitialize");
2028                 }
2029                 // error - none
2030                 ad->nfc_try_activate_running = EINA_FALSE;
2031                 //SETTING_TRACE("nfc_try_activate_running - FALSE");
2032
2033                 Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2034                 if (old_list == ad->search_genlist)
2035                 {
2036                         SETTING_TRACE("Already be in search mode");
2037                         elm_genlist_realized_items_update(ad->search_genlist);
2038                 }
2039
2040                 // enable sbeam
2041                 Setting_GenGroupItem_Data *item_to_update;
2042                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2043                 {
2044                         item_to_update = ad->gl_data_item[i][GL_SBeam];
2045                         setting_genlist_item_disabled_set(item_to_update, 0);
2046                 }
2047         }
2048
2049 }
2050
2051 void setting_alternate_nfc_mode(Setting_GenGroupItem_Data *list_item, Eina_Bool status)
2052 {
2053         SETTING_TRACE_BEGIN;
2054         setting_main_appdata *ad = g_main_ad;
2055         int ret = 0;
2056         SETTING_TRACE(".......nfc mode status : %d", status);
2057         SETTING_TRACE("nfc_manager_is_activated:%d", nfc_manager_is_activated());
2058
2059         if (status == nfc_manager_is_activated())
2060         {
2061                 return;
2062         }
2063
2064         ad->nfc_try_activate_running = EINA_TRUE;
2065         //SETTING_TRACE("nfc_try_activate_running - TRUE");
2066
2067         // disable sbeam
2068         Setting_GenGroupItem_Data *item_to_update;
2069         int i;
2070         // disable sbeam
2071         for (i = VIEW_All_List; i < VIEW_Max; i++)
2072         {
2073                 item_to_update = ad->gl_data_item[i][GL_SBeam];
2074                 setting_genlist_item_disabled_set(item_to_update, 1);
2075         }
2076
2077         ret = nfc_manager_initialize(NULL, NULL);
2078         if(ret != NFC_ERROR_NONE)
2079         {
2080                 //init error
2081                 SETTING_TRACE_ERROR("failed on nfc_manager_initialize");
2082                 goto error_handle;
2083         }
2084         ret = nfc_manager_set_activation(status, __nfc_activation_completed_cb, ad);
2085         if (ret != NFC_ERROR_NONE)
2086         {
2087                 //active error
2088                 SETTING_TRACE_ERROR("failed on nfc_manager_set_activation");
2089                 goto error_handle;
2090         }
2091
2092         for (i = 0; i < VIEW_Max; i++)
2093         {
2094                 item_to_update = ad->gl_data_item[i][GL_NFC];
2095                 if (item_to_update)
2096                 {
2097                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
2098                         elm_object_item_data_set(item_to_update->item, item_to_update);
2099                         elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2100
2101                 }
2102         }
2103         //add timeout strategy..
2104         if (ad->nfc_timer) {
2105                 ecore_timer_del(ad->nfc_timer);
2106                 ad->nfc_timer = NULL;
2107         }
2108         ad->nfc_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __nfc_timeout, ad);
2109         return;
2110
2111 error_handle:
2112         ad->nfc_try_activate_running = EINA_TRUE;
2113         int state, err;
2114         setting_get_bool_slp_key(BOOL_SLP_SETTING_NFC_STATUS, &state, &err);
2115         SETTING_TRACE("value:%d", state);
2116         for (i = VIEW_All_List; i < VIEW_Max; i++)
2117         {
2118                 // disable sbeam
2119                 item_to_update = ad->gl_data_item[i][GL_SBeam];
2120                 setting_genlist_item_disabled_set(item_to_update, 0);
2121
2122                 item_to_update = ad->gl_data_item[i][GL_NFC];
2123                 if (item_to_update)
2124                 {
2125                         item_to_update->chk_status = state;
2126                         item_to_update->swallow_type = SWALLOW_Type_1ICON_1RADIO;
2127                         elm_object_item_data_set(item_to_update->item, item_to_update);
2128                         elm_genlist_item_update(item_to_update->item);
2129                 }
2130         }
2131 }
2132
2133 static void __nfc_activation_completed_cb_when_enbale_sbeam(nfc_error_e error, void *data)
2134 {
2135         SETTING_TRACE_BEGIN;
2136         setting_main_appdata *ad = g_main_ad;
2137         int ret;
2138         if (error == NFC_ERROR_NONE) {
2139                 Setting_GenGroupItem_Data *list_item;
2140                 int status;
2141                 vconf_get_bool(VCONFKEY_NFC_STATE, &status);
2142                 SETTING_TRACE("value:%d", status);
2143
2144
2145                 Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2146                 if (old_list == ad->search_genlist)
2147                 {
2148                         SETTING_TRACE("Already be in search mode");
2149                         elm_genlist_realized_items_update(ad->search_genlist);
2150                 }
2151
2152
2153                 ret = nfc_manager_deinitialize();
2154                 if (ret < 0) {
2155                         vconf_get_bool(VCONFKEY_NFC_STATE, &status);
2156                         SETTING_TRACE_DEBUG("nfc status : %d", status);
2157                         if (!status)
2158                         {
2159                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2160                         }
2161                 }
2162                 int i;
2163                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2164                 {
2165                         list_item = ad->gl_data_item[i][GL_NFC];
2166                         if (list_item)
2167                         {
2168                                 list_item->chk_status = status;
2169                                 list_item->swallow_type = SWALLOW_Type_1ICON_1RADIO;
2170                                 elm_object_item_data_set(list_item->item, list_item);
2171                                 elm_genlist_item_fields_update(list_item->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2172                         }
2173                         // enable sbeam
2174                         setting_genlist_item_disabled_set(list_item, 0);
2175                 }
2176         }else{
2177                 SETTING_TRACE("error code %d",error);
2178         }
2179
2180 }
2181
2182 void setting_alternate_sbeam_mode(Setting_GenGroupItem_Data *list_item, Eina_Bool status)
2183 {
2184         //SETTING_TRACE_BEGIN;
2185         setting_main_appdata *ad = g_main_ad;
2186         //Eina_Bool status =  elm_check_state_get(check);
2187         SETTING_TRACE("wifi mode status : %d", status);
2188
2189         vconf_set_bool(VCONFKEY_NFC_SBEAM, status);
2190
2191         if (status) {
2192                 int nfc_status = 0;
2193                 vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2194                 if (!nfc_status) {
2195                         bool is_nfc_exist = FALSE;
2196                         Setting_GenGroupItem_Data *item_to_update;
2197                         int i;
2198                         for (i = VIEW_All_List; i < VIEW_Max; i++)
2199                         {
2200                                 item_to_update = ad->gl_data_item[i][GL_NFC];
2201                                 if (!item_to_update) continue;
2202                                 setting_genlist_item_disabled_set(item_to_update, 1);
2203
2204                                 is_nfc_exist = TRUE;
2205                         }
2206                         if (is_nfc_exist)
2207                         {
2208                                 //try to open nfc
2209                                 int ret;
2210                                 ret = nfc_manager_initialize(NULL, NULL);
2211                                 if (ret < 0) {
2212                                         vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2213                                         SETTING_TRACE_DEBUG("nfc status : %d", nfc_status);
2214                                         if (!nfc_status)
2215                                         {
2216                                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2217                                         }
2218                                 }
2219                                 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_initialize() ***");
2220
2221                                 ret = nfc_manager_set_activation(!nfc_status, __nfc_activation_completed_cb_when_enbale_sbeam, ad);
2222                                 if (ret < 0) {
2223                                         vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_status);
2224                                         SETTING_TRACE_DEBUG("nfc status : %d", nfc_status);
2225                                         if (!nfc_status)
2226                                         {
2227                                                 vconf_set_bool(VCONFKEY_NFC_SBEAM, !status);
2228                                         }
2229                                 }
2230                                 setting_retm_if(ret < 0, "*** [ERR] nfc_manager_set_activation() ***");
2231
2232                                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2233                                 {
2234                                         item_to_update = ad->gl_data_item[i][GL_NFC];
2235                                         if (item_to_update && item_to_update->item) {
2236                                                 item_to_update->swallow_type = SWALLOW_Type_1ICON_1PROCESS;
2237                                                 elm_object_item_data_set(item_to_update->item, item_to_update);
2238                                                 elm_genlist_item_fields_update(item_to_update->item, "elm.icon.2", ELM_GENLIST_ITEM_FIELD_CONTENT);
2239                                         }
2240                                 }
2241                                 //add timeout strategy..
2242                                 if (ad->nfc_timer) {
2243                                         ecore_timer_del(ad->nfc_timer);
2244                                         ad->nfc_timer = NULL;
2245                                 }
2246                                 ad->nfc_timer = ecore_timer_add(5.0, (Ecore_Task_Cb) __nfc_timeout, ad);
2247
2248                         }
2249
2250                 }
2251         }
2252 }
2253 #endif
2254
2255 void setting_main_click_list_network_ug_cb(void *data, Evas_Object *obj, void *event_info)
2256 {
2257         SETTING_TRACE_BEGIN;
2258         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2259         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2260
2261         elm_genlist_item_selected_set(item, EINA_FALSE);
2262
2263         if (g_main_ad->isInUGMode && g_main_ad->ug) {
2264                 SETTING_TRACE
2265                     ("[ad->ug non-NULL]skip genlist click event!!");
2266
2267                 //SETTING_TRACE_END;
2268                 return;
2269         }
2270
2271         int flight_mode = 0;
2272         vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
2273         if (flight_mode)
2274         {
2275                 setting_create_simple_popup(NULL, g_main_ad->win_main,
2276                                             NULL, "IDS_IM_POP_THIS_FEATURE_IS_NOT_AVAILABLE_WHILE_FLIGHT_MODE_IS_ON");
2277                 return;
2278         }
2279
2280         setting_main_appdata *ad = g_main_ad;
2281         setting_main_click_list_item_reset_data(ad, obj);
2282
2283         int err = 0;
2284         int value;
2285         setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
2286         SETTING_TRACE("value:%d", value);
2287         switch (value) {
2288         case VCONFKEY_TELEPHONY_SIM_INSERTED:
2289                 {
2290                         struct ug_cbs *cbs =
2291                             (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2292                         setting_retm_if(!cbs, "calloc failed");
2293                         cbs->layout_cb = setting_main_layout_ug_cb;
2294                         cbs->result_cb = setting_main_result_ug_cb;
2295                         cbs->destroy_cb = setting_main_destroy_ug_cb;
2296                         cbs->priv = (void *)ad;
2297                         setting_main_click_list_item_ug_cb(ad, obj,
2298                                                            "setting-network-efl",
2299                                                            NULL, cbs);
2300                         FREE(cbs);
2301                         break;
2302                 }
2303         case VCONFKEY_TELEPHONY_SIM_NOT_PRESENT:
2304                 setting_create_simple_popup(NULL, ad->win_main,
2305                                             NULL, "IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES");
2306                 SETTING_TRACE("%s*** [ERR] No SIM. sim_slot_type=%d ***%s",
2307                               SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2308                 return;
2309                 break;
2310         case VCONFKEY_TELEPHONY_SIM_CARD_ERROR:
2311         case VCONFKEY_TELEPHONY_SIM_UNKNOWN:
2312                 setting_create_simple_popup(NULL, ad->win_main,
2313                                             NULL,"IDS_ST_POP_INSERT_SIM_CARD_TO_ACCESS_NETWORK_SERVICES");
2314                 SETTING_TRACE("%s*** [ERR] Invalid SIM. sim_slot_type=%d ***%s",
2315                               SETTING_FONT_RED, value, SETTING_FONT_BLACK);
2316                 return;
2317                 break;
2318         default:
2319                 break;
2320         }
2321
2322 }
2323
2324
2325 void setting_main_tapi_event_cb(TapiHandle *handle, int result, void *data, void *user_data)
2326 {
2327         SETTING_TRACE_BEGIN;
2328         ret_if(!user_data);
2329         setting_main_appdata *ad = user_data;
2330         ad->b_fm_requesting = FALSE;
2331         SETTING_TRACE("result:%d", result);
2332
2333         int err = 0;
2334         switch (result) {
2335         case TAPI_POWER_FLIGHT_MODE_RESP_ON:
2336
2337                 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
2338                                          SETTING_ON_OFF_BTN_ON, &err);
2339
2340                 //If Setting has validate operation (fm_waiting_op == FM_LEAVE) to process, process it.
2341                 //Otherwise, do nothing
2342                 if (FM_LEAVE == ad->fm_waiting_op)
2343                 {
2344                         //Send the latest operation
2345                         ad->fm_waiting_op = FM_INVALID;
2346                         err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2347                         setting_retm_if(err != TAPI_API_SUCCESS,
2348                                         "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2349
2350                         //sucessfully sent,
2351                         ad->b_fm_requesting = TRUE;
2352
2353                 }
2354                 break;
2355
2356         case TAPI_POWER_FLIGHT_MODE_RESP_OFF:
2357
2358                 setting_set_bool_slp_key(BOOL_SLP_SETTING_FLIGHT_MODE,
2359                                          SETTING_ON_OFF_BTN_OFF, &err);
2360
2361                 //If Setting has validate operation (here, fm_waiting_op == FM_ENTER) to process,process it.
2362                 //Otherwise, do nothing
2363                 if (FM_ENTER == ad->fm_waiting_op)
2364                 {
2365                         //Send the latest operation
2366                         ad->fm_waiting_op = FM_INVALID;
2367                         err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2368                         setting_retm_if(err != TAPI_API_SUCCESS,
2369                                         "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2370
2371                         //sucessfully sent,
2372                         ad->b_fm_requesting = TRUE;
2373                 }
2374
2375                 break;
2376
2377         case TAPI_POWER_FLIGHT_MODE_RESP_FAIL:
2378                 //Setting has a validate operation to process, Send the operation request
2379                 if (FM_ENTER == ad->fm_waiting_op)
2380                 {
2381                         ad->fm_waiting_op = FM_INVALID;
2382                         err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2383
2384                         setting_retm_if(err != TAPI_API_SUCCESS,
2385                                         "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2386                         ad->b_fm_requesting = TRUE;
2387                 }
2388                 else if (FM_LEAVE == ad->fm_waiting_op)
2389                 {
2390                         ad->fm_waiting_op = FM_INVALID;
2391                         err = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2392
2393                         setting_retm_if(err != TAPI_API_SUCCESS,
2394                                         "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2395                         ad->b_fm_requesting = TRUE;
2396                 }
2397                 else //Current requset is the last one, Setting needs to notify user
2398                 {
2399                         setting_create_popup_without_btn(ad, ad->win_main,
2400                                              "IDS_COM_POP_ERROR",
2401                                              "IDS_ST_POP_UNABLE_TO_TURN_ON_FLIGHT_MODE_VODA",
2402                                              NULL, POPUP_INTERVAL,
2403                                              FALSE, FALSE);
2404
2405                         //It is need to rollback the status,
2406                         Setting_GenGroupItem_Data *item_to_update;
2407                         int i;
2408                         for (i = VIEW_All_List; i < VIEW_Max; i++)
2409                         {
2410                                 item_to_update = ad->gl_data_item[i][GL_FlightMode];
2411                                 if (item_to_update)
2412                                 {
2413                                         setting_update_gl_item_chk_status(item_to_update, !(item_to_update->chk_status));
2414                                 }
2415                         }
2416
2417                         return;
2418                 }
2419
2420                 //sucessfully sent,
2421                 ad->b_fm_requesting = TRUE;
2422
2423                 break;
2424
2425         case TAPI_POWER_FLIGHT_MODE_RESP_MAX:
2426                 setting_create_popup_without_btn(ad, ad->win_main,
2427                                      "IDS_COM_POP_ERROR",
2428                                      "IDS_COM_POP_UNEXPECTED_ERROR",
2429                                      NULL, POPUP_INTERVAL, FALSE, FALSE);
2430
2431                 //It is need to rollback the status,
2432                 Setting_GenGroupItem_Data *item_to_update;
2433                 int i;
2434                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2435                 {
2436                         item_to_update = ad->gl_data_item[i][GL_FlightMode];
2437                         if (item_to_update)
2438                         {
2439                                 setting_update_gl_item_chk_status(item_to_update, !(item_to_update->chk_status));
2440                         }
2441                 }
2442                 break;
2443         default:
2444                 /* do nothing */
2445                 break;
2446         }
2447         return;
2448 }
2449
2450 void setting_main_alternate_flight_mode(int status)
2451 {
2452         SETTING_TRACE_BEGIN;
2453         setting_main_appdata *ad = g_main_ad;
2454         int ret;
2455         //Check whether some requestion is processing by TAPI
2456         if (ad->b_fm_requesting)
2457         {
2458                 //Do nothing, just mark the lastest operation..
2459                 SETTING_TRACE("Some requestion is processing by TAPI, wait to process");
2460                 ad->fm_waiting_op = status ? FM_ENTER : FM_LEAVE;
2461                 return;
2462         }
2463
2464         //otherwise, invalid waiting operation and send requsetion to TAPI:
2465         ad->fm_waiting_op = FM_INVALID;
2466         if (status) {
2467                 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_ENTER,setting_main_tapi_event_cb,ad);
2468                 setting_retm_if(ret != TAPI_API_SUCCESS,
2469                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_ENTER) ***");
2470         } else {
2471                 ret = tel_set_flight_mode(ad->handle, TAPI_POWER_FLIGHT_MODE_LEAVE,setting_main_tapi_event_cb,ad);
2472                 setting_retm_if(ret != TAPI_API_SUCCESS,
2473                                 "*** [ERR] tel_set_flight_mode(TAPI_POWER_FLIGHT_MODE_LEAVE) ***");
2474         }
2475
2476         //sucessfully sent,
2477         ad->b_fm_requesting = TRUE;
2478 }
2479
2480
2481 void setting_flightmode_turn_on_resp_cb(void *data, Evas_Object *obj, void *event_info)
2482 {
2483         setting_retm_if(NULL == obj, "NULL == obj");
2484         //setting_retm_if(NULL == data, "NULL == data");
2485         SETTING_TRACE_BEGIN;
2486         int response_type = btn_type(obj);
2487         //Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
2488
2489         if (g_main_ad)
2490         {
2491                 evas_object_del(g_main_ad->popup_flight_mode);
2492                 g_main_ad->popup_flight_mode = NULL;
2493
2494                 if (POPUP_RESPONSE_OK == response_type)
2495                 {
2496                         setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_TRUE);
2497                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_TRUE);
2498                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_TRUE);
2499                         setting_main_alternate_flight_mode(1);
2500
2501                         int firewall_state;
2502                         vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall_state);
2503                         if(firewall_state)
2504                         {
2505                                 setting_remove_quickpannel_notification("setting-firewall-efl", NOTIFICATION_TYPE_ONGOING, &g_main_ad->noti_id);
2506                         }
2507                 }
2508                 else if (POPUP_RESPONSE_CANCEL == response_type)
2509                 {
2510                         setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_FALSE);
2511                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_FALSE);
2512                         setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_FALSE);
2513                 }
2514         }
2515 }
2516
2517 void setting_flightmode_turn_off_resp_cb(void *data, Evas_Object *obj, void *event_info)
2518 {
2519         setting_retm_if(NULL == obj, "NULL == obj");
2520         //setting_retm_if(NULL == data, "NULL == data");
2521         SETTING_TRACE_BEGIN;
2522         int response_type = btn_type(obj);
2523         //Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
2524
2525         if (g_main_ad)
2526         {
2527                 evas_object_del(g_main_ad->popup_flight_mode);
2528                 g_main_ad->popup_flight_mode = NULL;
2529         }
2530
2531         if (POPUP_RESPONSE_OK == response_type)
2532         {
2533                 setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_FALSE);
2534                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_FALSE);
2535                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_FALSE);
2536                 setting_main_alternate_flight_mode(0);
2537
2538                 int firewall_state;
2539                 vconf_get_bool(VCONFKEY_SETAPPL_FIREWALL_KEY, &firewall_state);
2540                 if(firewall_state)
2541                 {
2542                         setting_create_quickpannel_notification("setting-firewall-efl",
2543                                                 NOTIFICATION_TYPE_ONGOING,
2544                                                 NOTIFICATION_LY_ONGOING_EVENT,
2545                                                 "IDS_ST_BODY_FIREWALL_ENABLED_ABB",
2546                                                 "IDS_ST_BODY_CONFIGURE_FIREWALL_SETTINGS",
2547                                                 IMG_Firewall, &g_main_ad->noti_id);
2548                 }
2549
2550                 //remove quickpannel warning
2551                 //setting_remove_quickpannel_notification("setting-flightmode-efl", NOTIFICATION_TYPE_ONGOING, &g_main_ad->flight_noti_id);
2552         }
2553         else if (POPUP_RESPONSE_CANCEL == response_type)
2554         {
2555                 setting_update_gl_item_chk_status(g_main_ad->data_flight, EINA_TRUE);
2556                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_All_List][GL_FlightMode], EINA_TRUE);
2557                 setting_update_gl_item_chk_status(g_main_ad->gl_data_item[VIEW_Common][GL_FlightMode], EINA_TRUE);
2558         }
2559 }
2560
2561
2562 /**
2563  * genlist touch cb
2564  */
2565 void setting_main_click_Gendial_list_flight_mode_cb(void *data, Evas_Object *obj, void *event_info)
2566 {
2567         /* error check */
2568         setting_retm_if(data == NULL, "Data parameter is NULL");
2569
2570         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2571         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2572         elm_genlist_item_selected_set(item, 0);
2573         Setting_GenGroupItem_Data *list_item =
2574                 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2575         int old_status = list_item->chk_status;//elm_check_state_get(list_item->eo_check);
2576
2577         if (!g_main_ad)
2578         {
2579                 return;
2580         }
2581
2582         /* new status */
2583         if(!old_status) {
2584                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2585                                 g_main_ad->win_main, "IDS_ST_POP_ENABLE_FLIGHT_MODE"/*KeyStr_FlightMode*/,
2586                                 ENABLE_FLIGHT_MODE_MSG,
2587                                 setting_flightmode_turn_on_resp_cb,
2588                                 0, 2, "IDS_ST_BUTTON_ENABLE", "IDS_COM_SK_CANCEL");
2589         } else {
2590                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2591                                 g_main_ad->win_main, KeyStr_FlightMode,
2592                                 "IDS_COM_POP_FLIGHT_MODE_WILL_BE_DISABLED",
2593                                 setting_flightmode_turn_off_resp_cb,
2594                                 0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
2595         }
2596 }
2597
2598 void setting_main_click_Gendial_list_multi_window_mode_cb(void *data, Evas_Object *obj, void *event_info)
2599 {
2600         SETTING_TRACE_BEGIN;
2601         setting_retm_if(data == NULL, "Data parameter is NULL");
2602
2603         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2604         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2605         elm_genlist_item_selected_set(item, 0);
2606         Setting_GenGroupItem_Data *list_item =
2607                 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2608         int new_status = !list_item->chk_status;
2609         setting_update_gl_item_chk_status(list_item, new_status);
2610         int ret = vconf_set_bool(VCONFKEY_QUICKSETTING_MULTIWINDOW_ENABLED, new_status);
2611         if(ret != 0){
2612                 SETTING_TRACE_ERROR("Set multi window vconf failed.");
2613         }
2614 }
2615
2616 void
2617 setting_main_mouse_up_Gendial_list_sensitivity_cb(void *data, Evas_Object *obj,
2618                                               void *event_info)
2619 {
2620         /* error check */
2621         setting_retm_if(data == NULL, "Data parameter is NULL");
2622
2623         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2624         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
2625         elm_genlist_item_selected_set(item, 0);
2626         Setting_GenGroupItem_Data *list_item =
2627             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
2628
2629         if (!safeStrCmp(KeyStr_HighTouchSens, list_item->keyStr)) {
2630                 display_set_enhanced_touch(!list_item->chk_status);
2631
2632                 int status = display_get_enhanced_touch();
2633                 SETTING_TRACE("display_get_enhanced_touch():%d", status);
2634                 if (status >= 0)
2635                 {
2636                         vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, (1 == status)); //sync to vconf
2637                 }
2638                 else
2639                 {
2640                         setting_create_simple_popup(NULL, g_main_ad->win_main,
2641                                                     NULL, "IDS_COM_POP_UNEXPECTED_ERROR");
2642                 }
2643         }
2644
2645 }
2646
2647 void setting_main_high_touch_sens_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
2648 {
2649         //SETTING_TRACE_BEGIN;
2650         /* error check */
2651         retm_if(data == NULL, "Data parameter is NULL");
2652         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2653
2654         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
2655         display_set_enhanced_touch(list_item->chk_status);
2656
2657         int status = display_get_enhanced_touch();
2658         SETTING_TRACE("display_get_enhanced_touch():%d", status);
2659         if (status >= 0)
2660         {
2661                 vconf_set_bool(VCONFKEY_SETAPPL_ENHANCED_TOUCH, (1 == status)); //sync to vconf
2662         }
2663         else
2664         {
2665                 setting_create_simple_popup(NULL, g_main_ad->win_main,
2666                                             NULL, "IDS_COM_POP_UNEXPECTED_ERROR");
2667                 //rollback status
2668                 int i;
2669                 for (i = VIEW_All_List; i < VIEW_Max; i++)
2670                 {
2671                         setting_force_update_gl_item_chk_status(g_main_ad->gl_data_item[i][GL_TouchSens], !(list_item->chk_status));
2672                 }
2673         }
2674
2675 }
2676
2677 /**
2678  * toggle cb for flight-mode
2679  */
2680 void setting_main_click_list_flight_mode_cb(void *data, Evas_Object *obj,
2681                                        void *event_info)
2682 {
2683         //SETTING_TRACE_BEGIN;
2684         retm_if(data == NULL, "Data parameter is NULL");
2685         Setting_GenGroupItem_Data *list_item =
2686             (Setting_GenGroupItem_Data *) data;
2687         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2688         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2689                       list_item->chk_status);
2690
2691         if(g_main_ad && list_item->chk_status) {
2692                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2693                                 g_main_ad->win_main, "IDS_ST_POP_ENABLE_FLIGHT_MODE"/*KeyStr_FlightMode*/,
2694                                 ENABLE_FLIGHT_MODE_MSG,
2695                                 setting_flightmode_turn_on_resp_cb,
2696                                 0, 2, "IDS_ST_BUTTON_ENABLE", "IDS_COM_SK_CANCEL");
2697         } else {
2698                 //setting_main_alternate_flight_mode(list_item->chk_status);
2699                 g_main_ad->popup_flight_mode = setting_create_popup_with_btn(list_item,
2700                                 g_main_ad->win_main, KeyStr_FlightMode,
2701                                 "IDS_COM_POP_FLIGHT_MODE_WILL_BE_DISABLED",
2702                                 setting_flightmode_turn_off_resp_cb,
2703                                 0, 2, "IDS_COM_SK_OK", "IDS_COM_SK_CANCEL");
2704         }
2705 }
2706
2707 /**
2708  * genlist touch cb for network restriction mode
2709  */
2710 void
2711 setting_main_click_list_net_restriction_mode_cb( void *data, Evas_Object *obj, void *event_info )
2712 {
2713         /* error check */
2714         setting_retm_if(data == NULL, "Data parameter is NULL");
2715         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
2716         setting_main_appdata    *ad = g_main_ad;
2717
2718         Elm_Object_Item *item = (Elm_Object_Item *)event_info;
2719         elm_genlist_item_selected_set(item, 0);
2720         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)elm_object_item_data_get( item );
2721         int             old_status = list_item->chk_status;
2722
2723         if (!old_status )
2724         {
2725                 // Off -> On
2726                 ad->popup_net_restriction_mode = setting_create_popup_with_btn( NULL,
2727                                                         ad->win_main,
2728                                                         "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2729                                                         "IDS_QP_POP_IN_NETWORK_RESTRICTION_MODE_YOU_CAN_USE_ALL_YOUR_APPLICATIONS_WITHOUT_CONNECTING_TO_THE_NETWORK_YOU_CAN_ALSO_RECEIVE_CALLS_AND_SMS_MESSAGES_MSG_JPN" ,
2730                                                         setting_main_net_restriction_mode_turn_on_resp_cb,
2731                                                         0,      // timer
2732                                                         2,      // button count
2733                                                         "IDS_COM_SK_OK",
2734                                                         "IDS_COM_SK_CANCEL" );
2735         }
2736         else
2737         {
2738                 // On -> Off
2739                 ad->popup_net_restriction_mode = setting_create_popup_with_btn( NULL,
2740                                                         ad->win_main,
2741                                                         "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2742                                                         "IDS_QP_POP_NETWORK_RESTRICTION_MODE_WILL_BE_DISABLED_JPN",
2743                                                         setting_main_net_restriction_mode_turn_off_resp_cb,
2744                                                         0,      // timer
2745                                                         2,      // button count
2746                                                         "IDS_COM_SK_OK",
2747                                                         "IDS_COM_SK_CANCEL" );
2748         }
2749
2750         return;
2751 }
2752
2753 /**
2754  * check(on/off) cb for network restriction mode
2755  */
2756 void
2757 setting_main_click_list_check_net_restriction_mode_cb( void *data, Evas_Object *obj, void *event_info )
2758 {
2759         retm_if( data == NULL, "Data parameter is NULL" );
2760
2761         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *)data;
2762         setting_main_appdata    *ad = g_main_ad;
2763
2764         list_item->chk_status = elm_check_state_get( obj );     /* for update new state */
2765         SETTING_TRACE( "process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status );
2766
2767         if (list_item->chk_status )
2768         {
2769                 // Off -> On
2770                 ad->popup_net_restriction_mode = setting_create_popup_with_btn( NULL,
2771                                         ad->win_main,
2772                                         "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2773                                         "IDS_QP_POP_IN_NETWORK_RESTRICTION_MODE_YOU_CAN_USE_ALL_YOUR_APPLICATIONS_WITHOUT_CONNECTING_TO_THE_NETWORK_YOU_CAN_ALSO_RECEIVE_CALLS_AND_SMS_MESSAGES_MSG_JPN",
2774                                         setting_main_net_restriction_mode_turn_on_resp_cb,
2775                                         0,      // timer
2776                                         2,      // button count
2777                                         "IDS_COM_SK_OK",
2778                                         "IDS_COM_SK_CANCEL");
2779         }
2780         else
2781         {
2782                 // On -> Off
2783                 ad->popup_net_restriction_mode = setting_create_popup_with_btn( NULL,
2784                                         ad->win_main,
2785                                         "IDS_ST_HEADER_NETWORK_RESTRICTION_MODE_ABB_JPN",
2786                                         "IDS_QP_POP_NETWORK_RESTRICTION_MODE_WILL_BE_DISABLED_JPN",
2787                                         setting_main_net_restriction_mode_turn_off_resp_cb,
2788                                         0,      // timer
2789                                         2,      // button count
2790                                         "IDS_COM_SK_OK",
2791                                         "IDS_COM_SK_CANCEL" );
2792         }
2793         return;
2794 }
2795
2796 /**
2797  * turn on popup cb for network restriction mode
2798  */
2799 void
2800 setting_main_net_restriction_mode_turn_on_resp_cb( void *data, Evas_Object *obj, void *event_info )
2801 {
2802         SETTING_TRACE_BEGIN;
2803
2804         /* error check */
2805         setting_retm_if(NULL == obj, "NULL == obj");
2806         int             response_type = btn_type( obj );
2807         setting_main_appdata *ad = g_main_ad;
2808         int             status, err = 0;
2809
2810         if ( ad == NULL )
2811                 return;
2812
2813         if ( ad->popup_net_restriction_mode )
2814         {
2815                 evas_object_del( ad->popup_net_restriction_mode );
2816                 ad->popup_net_restriction_mode = NULL;
2817         }
2818
2819
2820         if ( response_type == POPUP_RESPONSE_OK )
2821         {
2822                 status = EINA_TRUE;
2823                 setting_set_bool_slp_key( BOOL_SLP_SETTING_NET_RESTRICTION_MODE, SETTING_ON_OFF_BTN_ON, &err );
2824         }
2825         else if ( response_type == POPUP_RESPONSE_CANCEL )
2826         {
2827                 setting_get_bool_slp_key( BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &status, &err );
2828         }
2829
2830         Setting_GenGroupItem_Data *item_to_update;
2831         int i;
2832         for (i = VIEW_All_List; i < VIEW_Max; i++)
2833         {
2834                 item_to_update =ad->gl_data_item[i][GL_NetRestriction];
2835                 setting_update_gl_item_chk_status(item_to_update, status );
2836         }
2837
2838         Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2839         if (old_list == ad->search_genlist)
2840         {
2841                 SETTING_TRACE("Already be in search mode");
2842                 elm_genlist_realized_items_update(ad->search_genlist);
2843         }
2844
2845         return;
2846 }
2847
2848 /**
2849  * turn off popup cb for network restriction mode
2850  */
2851 void
2852 setting_main_net_restriction_mode_turn_off_resp_cb( void *data, Evas_Object *obj, void *event_info )
2853 {
2854         SETTING_TRACE_BEGIN;
2855
2856         /* error check */
2857         setting_retm_if(NULL == obj, "NULL == obj");
2858
2859         int             response_type = btn_type( obj );
2860         setting_main_appdata *ad = g_main_ad;
2861         int             status, err = 0;
2862
2863         if ( ad == NULL )
2864                 return;
2865
2866         if ( ad->popup_net_restriction_mode )
2867         {
2868                 evas_object_del( ad->popup_net_restriction_mode );
2869                 ad->popup_net_restriction_mode = NULL;
2870         }
2871
2872         if ( response_type == POPUP_RESPONSE_OK )
2873         {
2874                 status = EINA_FALSE;
2875                 setting_set_bool_slp_key( BOOL_SLP_SETTING_NET_RESTRICTION_MODE, SETTING_ON_OFF_BTN_OFF, &err );
2876                 SETTING_TRACE("BOOL_SLP_SETTING_NET_RESTRICTION_MODE - off");
2877         }
2878         else if ( response_type == POPUP_RESPONSE_CANCEL )
2879         {
2880                 setting_get_bool_slp_key( BOOL_SLP_SETTING_NET_RESTRICTION_MODE, &status, &err );
2881
2882                 SETTING_TRACE("BOOL_SLP_SETTING_NET_RESTRICTION_MODE - update UI by getting vconf");
2883         }
2884         Setting_GenGroupItem_Data *item_to_update;
2885         int i;
2886         for (i = VIEW_All_List; i < VIEW_Max; i++)
2887         {
2888                 item_to_update = ad->gl_data_item[i][GL_NetRestriction];
2889                 setting_update_gl_item_chk_status(item_to_update, status );
2890         }
2891
2892         Evas_Object *old_list = elm_object_part_content_get(ad->ly_topview, "content");
2893         if (old_list == ad->search_genlist)
2894         {
2895                 SETTING_TRACE("Already be in search mode");
2896                 elm_genlist_realized_items_update(ad->search_genlist);
2897         }
2898
2899         return;
2900 }
2901
2902 /**
2903  * toggle cb
2904  */
2905 void setting_main_click_list_wifi_mode_cb(void *data, Evas_Object *obj,
2906                                        void *event_info)
2907 {
2908         //SETTING_TRACE_BEGIN;
2909         retm_if(data == NULL, "Data parameter is NULL");
2910         Setting_GenGroupItem_Data *list_item =
2911             (Setting_GenGroupItem_Data *) data;
2912         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2913         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2914                       list_item->chk_status);
2915
2916         __alternate_wifi_mode(list_item, obj);
2917 }
2918
2919 void setting_main_click_list_motion_cb(void *data, Evas_Object *obj,
2920                                        void *event_info)
2921 {
2922         //SETTING_TRACE_BEGIN;
2923         retm_if(data == NULL, "Data parameter is NULL");
2924         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2925         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2926         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
2927                       list_item->chk_status);
2928
2929         int err = 0;
2930         int ret = setting_set_bool_slp_key(BOOL_SLP_SETTING_MOTION_ACTIVATION, list_item->chk_status, &err);
2931         if (0 != ret)   //rollback
2932         {
2933                 setting_update_gl_item_chk_status(list_item, !(list_item->chk_status));
2934                 return;
2935         }
2936
2937         /* If motion activation changes to OFF when screen lock type is motion unlock, screen lock type should be set SWIPE automatically */
2938         if(!list_item->chk_status)
2939         {
2940                 int screen_lock_type = 0;
2941                 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type);
2942                 if(screen_lock_type == SETTING_SCREEN_LOCK_TYPE_MOTION)
2943                         vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_SWIPE);
2944         }
2945 }
2946
2947 void setting_main_click_list_nearby_devices_cb(void *data, Evas_Object *obj,
2948                                        void *event_info)
2949 {
2950         //SETTING_TRACE_BEGIN;
2951         retm_if(data == NULL, "Data parameter is NULL");
2952         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
2953         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
2954         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr), list_item->chk_status);
2955
2956         int chk_status = list_item->chk_status;
2957
2958         if (chk_status)
2959         {
2960                 //to turn on
2961                 //app_launcher("setting-allshare-efl|mode:on");
2962                 //rollback first
2963                 setting_update_gl_item_chk_status(list_item, VCONFKEY_ALLSHARE_DISABLE);
2964
2965                 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
2966                 setting_retm_if(!cbs, "calloc failed");
2967                 cbs->layout_cb = setting_main_layout_ug_cb;
2968                 cbs->result_cb = setting_main_result_ug_cb;
2969                 cbs->destroy_cb = setting_main_destroy_ug_cb;
2970                 cbs->priv = (void *)g_main_ad;
2971
2972                 app_control_h svc = NULL;
2973                 app_control_create(&svc);
2974                 app_control_add_extra_data(svc, "mode", "on");
2975                 setting_main_click_list_item_ug_cb(g_main_ad, obj, "setting-allshare-efl", svc, cbs);
2976                 if (cbs)
2977                 {
2978                         FREE(cbs);
2979                 }
2980                 cbs = NULL;
2981                 app_control_destroy(svc);
2982         }
2983         else
2984         {
2985                 //to turn off
2986                 int ret = 0;
2987                 ret = vconf_set_int(VCONFKEY_ALLSHARE_STATUS, VCONFKEY_ALLSHARE_DISABLE);
2988                 if (0 != ret)   //rollback
2989                 {
2990                         setting_update_gl_item_chk_status(list_item, VCONFKEY_ALLSHARE_ENABLE);
2991                         return;
2992                 }
2993         }
2994 }
2995
2996 /**
2997  * toggle cb
2998  */
2999 void setting_main_click_list_bt_mode_cb(void *data, Evas_Object *obj,
3000                                        void *event_info)
3001 {
3002         retm_if(data == NULL, "Data parameter is NULL");
3003         Setting_GenGroupItem_Data *list_item =
3004             (Setting_GenGroupItem_Data *) data;
3005         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
3006         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
3007                       list_item->chk_status);
3008
3009         __alternate_bt_mode(list_item, obj);
3010 }
3011
3012 #if SUPPORT_NFC
3013 /**
3014  * toggle cb
3015  */
3016 void setting_main_click_list_nfc_mode_cb(void *data, Evas_Object *obj,
3017                                        void *event_info)
3018 {
3019         retm_if(data == NULL, "Data parameter is NULL");
3020         Setting_GenGroupItem_Data *list_item =
3021             (Setting_GenGroupItem_Data *) data;
3022         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
3023         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
3024                       list_item->chk_status);
3025
3026         Eina_Bool status =  elm_check_state_get(obj);
3027         setting_alternate_nfc_mode(list_item, status);
3028 }
3029
3030 /**
3031  * toggle cb
3032  */
3033 void setting_main_click_list_sbeam_mode_cb(void *data, Evas_Object *obj,
3034                                        void *event_info)
3035 {
3036         retm_if(data == NULL, "Data parameter is NULL");
3037         setting_main_appdata *ad = g_main_ad;
3038         Setting_GenGroupItem_Data *list_item =
3039             (Setting_GenGroupItem_Data *) data;
3040         list_item->chk_status = elm_check_state_get(obj);       /* for update new state */
3041         SETTING_TRACE("process item [%s], status:%d", _(list_item->keyStr),
3042                       list_item->chk_status);
3043
3044         if (ad->nfc_try_activate_running)
3045         {
3046                 SETTING_TRACE("CHECK : nfc state update is in progress. DON'T DO ANY MORE !!!!!!!!!!!!!!!!!!!!!!!");
3047                 elm_check_state_set(obj, !list_item->chk_status);
3048                 // roll back
3049                 return;
3050         } else {
3051                 SETTING_TRACE("CHECK : nfc state update is NOT in progress. - GO AHEAD !!!");
3052                 Eina_Bool status =  elm_check_state_get(obj);
3053                 setting_alternate_sbeam_mode(list_item, status);
3054         }
3055 }
3056 #endif
3057
3058 void setting_main_display_auto_adjust_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
3059 {
3060         SETTING_TRACE_BEGIN;
3061         /* error check */
3062         retm_if(data == NULL, "Data parameter is NULL");
3063         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
3064
3065         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
3066         vconf_set_bool(VCONFKEY_SETAPPL_LCD_AUTO_DISPLAY_ADJUSTMENT, list_item->chk_status);
3067         //setting_display_set_auto_adjust_tone(list_item->chk_status); //todo:copy it from display
3068 }
3069
3070 void setting_main_display_auto_rotate_chk_btn_cb(void *data, Evas_Object *obj, void *event_info)
3071 {
3072         SETTING_TRACE_BEGIN;
3073         /* error check */
3074         retm_if(data == NULL, "Data parameter is NULL");
3075         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
3076         setting_main_appdata *ad = g_main_ad;
3077
3078         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
3079
3080         if(list_item->chk_status == 1)
3081         {
3082                 int angle = elm_win_rotation_get(ad->win_main);
3083                 elm_win_rotation_with_resize_set(ad->win_main, angle);
3084         }
3085         else
3086         {
3087                 elm_win_rotation_with_resize_set(ad->win_main, 0);
3088         }
3089
3090         vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, list_item->chk_status);
3091 }
3092
3093
3094 void setting_main_display_battery_chk_btn_cb(void *data, Evas_Object *obj,
3095                                         void *event_info)
3096 {
3097         SETTING_TRACE_BEGIN;
3098         /* error check */
3099         retm_if(data == NULL, "Data parameter is NULL");
3100         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
3101
3102         list_item->chk_status = elm_check_state_get(obj);       /*  for genlist update status */
3103         vconf_set_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, list_item->chk_status);
3104 }
3105
3106 void setting_main_display_list_cb(void *data, Evas_Object *obj, void *event_info)
3107 {
3108         /* error check */
3109         setting_retm_if(data == NULL, "Data parameter is NULL");
3110
3111         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
3112         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
3113         elm_genlist_item_selected_set(item, 0);
3114         Setting_GenGroupItem_Data *list_item =
3115             (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
3116
3117         setting_main_appdata *ad = data;
3118
3119         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
3120         if (!safeStrCmp(KeyStr_BatteryPercent, list_item->keyStr)) {
3121                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
3122                 vconf_set_bool(VCONFKEY_SETAPPL_BATTERY_PERCENTAGE_BOOL, list_item->chk_status);
3123         }
3124 #if SUPPORT_AUTO_ADJUST_SCREEN_TONE
3125         else if (!safeStrCmp(KeyStr_AdjustScreenTone, list_item->keyStr)) {
3126                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
3127                 vconf_set_bool(VCONFKEY_SETAPPL_LCD_AUTO_DISPLAY_ADJUSTMENT, list_item->chk_status);
3128
3129         }
3130 #endif
3131         else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
3132                 setting_update_gl_item_chk_status(list_item, !list_item->chk_status);
3133                 if(list_item->chk_status == 1)
3134                 {
3135                         int angle = elm_win_rotation_get(ad->win_main);
3136                         elm_win_rotation_with_resize_set(ad->win_main, angle);
3137                 }
3138                 else
3139                 {
3140                         elm_win_rotation_with_resize_set(ad->win_main, 0);
3141                 }
3142
3143                 vconf_set_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, list_item->chk_status);
3144         }
3145 }
3146