Merge "[Feature] Hide some menus in emulator . ." into 2.0_beta
[apps/core/preloaded/settings.git] / setting-about / src / setting-about-main.c
1 /*
2  * setting
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
5  *
6  * Contact: MyoungJune Park <mj2004.park@samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <setting-cfg.h>
22 #include <setting-about-main.h>
23 #include <aul.h>
24 #include <iniparser.h>
25 #include <sys/types.h>
26 #include <sys/stat.h>
27 #include <fcntl.h>
28 #include <bluetooth-api.h>
29
30
31 #include <app_manager.h>
32
33 #define DEVNAME_BLOCK_SPACE     0
34 // #define SUPPORT_DIAG_USAGE
35
36 /** @todo : need to handle unicode encoded input characters */
37
38 #define MAX_DEVICE_NAME_LEN                     24
39 #define EMPTY_LIMITATION_STR            "IDS_ST_BODY_THE_NAME_FIELD_CANNOT_BE_EMPTY"
40 #define DIAGNOSTICS_USAGE_STR       "Diagnostics and Usage"
41 #define SOFTWARE_UPDATE_STR                     "IDS_ST_MBODY_SOFTWARE_UPDATE"
42
43
44 static int setting_about_main_create(void *cb);
45 static int setting_about_main_destroy(void *cb);
46 static int setting_about_main_update(void *cb);
47 static int setting_about_main_cleanup(void *cb);
48
49 setting_view setting_view_about_main = {
50         .create = setting_about_main_create,
51         .destroy = setting_about_main_destroy,
52         .update = setting_about_main_update,
53         .cleanup = setting_about_main_cleanup,
54 };
55
56 static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info);
57
58 /**
59 * Do process when clicking '<-' button
60 *
61 * @param data
62 * @param obj
63 * @param event_info
64 */
65 static void setting_about_main_click_softkey_back_cb(void *data,
66                                                      Evas_Object *obj,
67                                                      void *event_info);
68
69 /**
70 * Do process when clicking on some genlist item
71 *
72 * @param data
73 * @param obj
74 * @param event_info
75 */
76 static void setting_about_main_mouse_up_Gendial_list_cb(void *data,
77                                                         Evas_Object *obj,
78                                                         void *event_info);
79
80 static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
81                                                     Evas_Object *obj,
82                                                     void *event_info);
83
84 static void __setting_about_main_certificates_clicked(void *data);
85 static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj);
86 static void __setting_about_main_diagnostics_usage_clicked(void *data, Evas_Object *obj);
87
88 static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info);
89 /* ***************************************************
90  *
91  *basic func
92  *
93  ***************************************************/
94 static void __about_popup_rsp_cb(void *data, Evas_Object *obj, void *event_info)
95 {
96         SettingAboutUG *ad = data;
97         if (obj) {
98                 evas_object_del(obj);
99                 obj = NULL;
100         }
101         ad->popup = NULL;
102 }
103 static void __device_name_changed_cb(void *data, Evas_Object *obj)
104 {
105         retm_if(!data || !obj, "Data parameter is NULL");
106         //return if entry is not focused too
107
108         Setting_GenGroupItem_Data *list_item =
109             (Setting_GenGroupItem_Data *) data;
110         SettingAboutUG *ad = list_item->userdata;
111         retm_if(ad == NULL, "Data parameter is NULL");
112
113         const char *entry_str = elm_entry_entry_get(obj);
114         int entry_len = safeStrLen(entry_str);
115         SETTING_TRACE("entry_str:[%s], lenght:%d", entry_str, entry_len);
116
117 #if DEVNAME_BLOCK_SPACE
118         //block 'Space' key
119         if (entry_len > 0 && NULL != strstr(entry_str, " ")) {//cancel the effect of input 'space character'
120                 SETTING_TRACE("Cannot input the 'space' key or 'enter' key");
121
122                 int i = 0;
123                 int j = 0;
124                 char *tmp = (char *)g_strdup(entry_str);
125                 for (; tmp[i];) {
126                         if (tmp[i] == ' ') {
127                                 for (j = i; tmp[j]; j++) {
128                                         tmp[j] = tmp[j + 1];
129                                 }
130                         } else {
131                                 i++;
132                         }
133                 }
134                 G_FREE(list_item->sub_desc);
135                 list_item->sub_desc = (char *)g_strdup(tmp);
136                 G_FREE(tmp);
137                 SETTING_TRACE("sub_desc:[%s]", list_item->sub_desc);
138
139                 elm_entry_entry_set(obj, list_item->sub_desc);
140                 elm_entry_cursor_end_set(obj);
141         }
142 #endif
143         //for genlist update
144         G_FREE(list_item->sub_desc);//release first
145         list_item->sub_desc = (char *)g_strdup(entry_str);
146
147         if (NULL == entry_str || 0 == entry_len) {
148                 if (!ad->empty_flag)
149                 {
150                         ad->empty_flag = TRUE;
151                         Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
152                         if (navi_it)
153                         {
154                                 Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
155                                 setting_disable_evas_object(back_btn);
156                                 setting_dim_evas_object(back_btn, TRUE);
157
158                                 Evas_Object *top_r_btn = elm_object_item_part_content_get(navi_it, "title_right_btn");
159                                 if(top_r_btn)
160                                 {
161                                         setting_disable_evas_object(top_r_btn);
162                                         setting_dim_evas_object(top_r_btn, TRUE);
163                                 }
164                         }
165                 }
166         } else {
167                 if (ad->empty_flag)
168                 {
169                         ad->empty_flag = FALSE;
170                         Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
171                         if (navi_it)
172                         {
173                                 Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
174                                 setting_enable_evas_object(back_btn);
175                                 setting_undo_dim_evas_object(back_btn, TRUE);
176
177                                 Evas_Object *top_r_btn = elm_object_item_part_content_get(navi_it, "title_right_btn");
178                                 if(top_r_btn)
179                                 {
180                                         setting_enable_evas_object(top_r_btn);
181                                         setting_undo_dim_evas_object(top_r_btn, TRUE);
182                                 }
183                         }
184                 }
185         }
186
187 }
188
189 static void
190 __setting_about_device_name_changed_cb(void *data, Evas_Object *obj,
191                                        void *event_info)
192 {
193         __device_name_changed_cb(data, obj);
194 }
195
196
197 /**
198  *      Model Name:
199  *              - No ini: Unavailable
200  *              - I9500 @ target: GT-I9500
201  *              - I9500 @ emul: SDK
202  *              - SLP   @ target: GT-SLP
203  *              - SLP   @ emul: SDK
204  */
205 void setting_about_main_get_phone_model_name(char* szStr, int nSize)
206 {
207         retm_if(szStr == NULL, "szStr parameter is NULL");
208
209         char szBin[50];
210         char szEmul[50];
211
212         const char* szBinVer = NULL;
213
214         dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
215         if (dic) {
216                 szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
217                 if (szBinVer) {
218                         char* str = g_strdup(szBinVer);
219                         if (str) {
220                                 char* pPos = str;
221                                 while (*pPos++) {
222                                         if ('_' == *pPos)
223                                                 *pPos = ' ';
224                                 }
225                                 sscanf(str, "%s %s", szBin, szEmul);
226                         }
227                         G_FREE(str);
228                 }
229         }
230
231         if (!strncmp(szEmul, "emul", 4)) {
232                 snprintf(szStr, nSize, "%s", "SDK");
233         } else {
234                 if (!strncmp(szBin, "I9500", 5)) {
235                         snprintf(szStr, nSize, "GT-%s", szBin);
236                 } else if (!strncmp(szBin, "SLP", 3)) {
237                         snprintf(szStr, nSize, "GT-%s", szBin);
238                 } else {
239                         snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
240                 }
241         }
242
243         if (dic) {
244                 iniparser_freedict(dic);
245                 dic = NULL;
246         }
247 }
248
249 void setting_about_main_get_sw_version(char* szStr, int nSize)
250 {
251         retm_if(szStr == NULL, "szStr parameter is NULL");
252
253         dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
254         if (dic == NULL) {
255                 snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
256         } else {
257                 char* szBinVer =
258                         g_strdup((char*)iniparser_getstr(dic, "Version:Build"));
259                 char* szVerMaj =
260                         g_strdup((char*)iniparser_getstr(dic, "Version:Major"));
261                 char* szVerMin =
262                         g_strdup((char*)iniparser_getstr(dic, "Version:Minor"));
263
264                 if (szBinVer) {
265                         char* pPos = szBinVer;
266                         while(*pPos++) {
267                                 if ('.' == *pPos) *pPos = '\0';
268                         }
269                 }
270                 else {
271                         szBinVer = g_strdup(_("IDS_ST_HEADER_UNAVAILABLE"));
272                 }
273                 if (!szVerMaj) {
274                         szVerMaj = g_strdup("-");
275                 }
276                 if (!szVerMin) {
277                         szVerMin = g_strdup("-");
278                 }
279
280                 snprintf(szStr, nSize, "SLP%s.%s (%s)", szVerMaj, szVerMin, szBinVer);
281                 G_FREE(szBinVer);
282                 G_FREE(szVerMaj);
283                 G_FREE(szVerMin);
284         }
285
286         if (dic) {
287                 iniparser_freedict(dic);
288                 dic = NULL;
289         }
290 }
291
292 void setting_about_main_get_wifi_mac_address_string(char *str, int size)
293 {
294         setting_retm_if(str == NULL, "str parameter is NULL");
295         setting_retm_if(size < SETTING_ABOUT_WIFI_MAC_STR_LEN+1, "size parameter is wrong");
296
297         FILE *p = fopen(SETTING_ABOUT_MACINFO_PATH, "r");
298
299         if (p) {
300                 int size = fread(str, sizeof(char), SETTING_ABOUT_WIFI_MAC_STR_LEN, p);
301                 if (size != SETTING_ABOUT_WIFI_MAC_STR_LEN) {
302                         SETTING_TRACE_ERROR("fail to call fread");
303                 }
304                 fclose(p);
305                 p = NULL;
306         } else {
307                 perror("open failed!");
308         }
309
310         SETTING_TRACE_DEBUG("get_wifi_mac_address : %s", str);
311
312         int wifi_state = VCONFKEY_WIFI_OFF;
313         vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
314
315         if((safeStrLen(str) == 0) || (wifi_state == VCONFKEY_WIFI_OFF))
316                 snprintf(str, size, "%s  (%s)", _("IDS_ST_HEADER_UNAVAILABLE"), _(SETTING_ABOUT_NEVER_TURN_WIFI_ON_STR));
317 }
318
319 void setting_about_main_get_battery_string(char *str, int size)
320 {
321         setting_retm_if(str == NULL, "str parameter is NULL");
322
323         int val = -1;
324         char file[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
325         snprintf(file, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO,
326                  "%s/%s/%s", SETTING_ABOUT_POWER_SUPPLY_PATH, "battery", "capacity");
327
328         char buf[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
329         int fd = 0;
330         int r = 0;
331
332         fd = open(file, O_RDONLY);
333         if (fd != -1) {
334                 r = read(fd, buf, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
335                 if ((r >= 0) && (r < MAX_DISPLAY_STR_LEN_ON_PHONE_INFO)) {
336                         buf[r] = '\0';
337                         val = atoi(buf);
338                         snprintf(str, size, "%d%s", val, "\%");
339                 } else {
340                         SETTING_TRACE_ERROR("read file fail");
341                         snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
342                 }
343
344                 close(fd);
345         } else {
346                 SETTING_TRACE_ERROR("open file fail");
347                 snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
348         }
349 }
350
351 void setting_about_main_get_bluetooth_address_string(char *str, int size)
352 {
353         setting_retm_if(str == NULL, "str parameter is NULL");
354
355         bluetooth_device_address_t local_address;
356         memset(&local_address, 0x0, sizeof(local_address));
357         int ret = 0;
358
359         /* for fixing BS of dbus signal */
360         bluetooth_register_callback(NULL, NULL);
361
362         ret = bluetooth_get_local_address(&local_address);
363
364         /* for fixing BS of dbus signal */
365         bluetooth_unregister_callback();
366
367         if (ret < 0) {
368                 snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
369         } else {
370                 snprintf(str, size, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
371                         local_address.addr[0], local_address.addr[1], local_address.addr[2],
372                         local_address.addr[3], local_address.addr[4], local_address.addr[5]);
373         }
374         SETTING_TRACE_DEBUG("bt address : %s", str);
375 }
376
377 int __stat_get_cpuinfo(float *usr_pct, float *sys_pct)
378 {
379         setting_retvm_if(usr_pct == NULL, -ENOENT, "param usr_pct is null");
380         setting_retvm_if(sys_pct == NULL, -ENOENT, "param sys_pct is null");
381
382         /*  default value */
383         *usr_pct = 0.0;
384         *sys_pct = 0.0;
385         static unsigned long long usr_time = 0, nice_time = 0, sys_time = 0;
386         static unsigned long long old_usr = 0, old_nice = 0, old_sys = 0;
387         static struct timeval old_tv, cur_tv;
388         unsigned long long elapsed_tick;
389         long tick_per_sec;
390         long cpu_num;
391         FILE *fp = NULL;
392         int ret = 0;
393
394         tick_per_sec = sysconf(_SC_CLK_TCK);
395         cpu_num = sysconf(_SC_NPROCESSORS_ONLN);
396
397         if (cpu_num < 1)
398                 cpu_num = 1;
399
400         gettimeofday(&cur_tv, NULL);
401         fp = fopen(SETTING_ABOUT_STAT_PATH, "r");
402         if (fp == NULL) {
403                 SETTING_TRACE_ERROR("fp == NULL");
404                 return -ENOENT;
405         }
406
407         char cpu_info[MAX_COMMON_BUFFER_LEN] = {0,};
408         char *cpu_info_p = fgets(cpu_info, MAX_COMMON_BUFFER_LEN, fp);
409
410                 if(cpu_info_p == NULL) {
411                         SETTING_TRACE_ERROR("fgets failed");
412                         fclose(fp);   // free - code
413                         return -ENOENT;
414                 }
415
416         char *substr = NULL;
417         unsigned long long tmp_long = 0;
418         int i = 0;
419         /* split cpu_info, get 3 numbers headmost*/
420         while ((substr = strsep(&cpu_info_p, " \t")) != NULL) {
421                 char* endptr = NULL;
422                 tmp_long = strtoull(substr, &endptr, 10);
423                 if (tmp_long != 0 && tmp_long != ULLONG_MAX) {
424                         switch (i) {
425                         case 0:
426                                 usr_time = tmp_long;
427                                 break;
428                         case 1:
429                                 nice_time = tmp_long;
430                                 break;
431                         case 2:
432                                 sys_time = tmp_long;
433                                 break;
434                         default:
435                                 break;
436                         }
437                         i++;
438                 }
439                 if (i >= 3) {
440                         break;
441                 }
442         }
443
444         fclose(fp);
445         fp = NULL;
446         if (old_usr == 0) {
447                 ret = -EAGAIN;
448                 SETTING_TRACE_ERROR("old_usr == 0");
449                 goto out;
450         }
451
452         elapsed_tick = (cur_tv.tv_sec - old_tv.tv_sec) * tick_per_sec +
453             ((cur_tv.tv_usec - old_tv.tv_usec) * tick_per_sec) / 1000000;
454
455         /* REMOVE BS */
456         if (elapsed_tick != 0)
457                 *usr_pct =
458                     ((float)(usr_time - old_usr) * 100 / elapsed_tick) /
459                     cpu_num;
460         else
461                 *usr_pct = 0;
462         /* REMOVE BS */
463         if (elapsed_tick != 0)
464                 *sys_pct =
465                     ((float)(sys_time - old_sys) * 100 / elapsed_tick) /
466                     cpu_num;
467         else
468                 *sys_pct = 0;
469
470  out:
471         old_usr = usr_time;
472         old_nice = nice_time;
473         old_sys = sys_time;
474         old_tv = cur_tv;
475
476         return ret;
477 }
478
479 static Eina_Bool __timer_update_cb(const void *data)
480 {
481         retv_if(data == NULL, TRUE);
482         SettingAboutUG *ad = (SettingAboutUG *) data;
483
484         char str[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
485         if (ad->item_data_cpu) {
486                 float usr, sys;
487                 int ret = __stat_get_cpuinfo(&usr, &sys);
488                 if (ret == -ENOENT) {
489                         SETTING_TRACE_ERROR("call __stat_get_cpuinfo fail");
490                         snprintf(str, sizeof(str), "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
491                 } else {
492                         snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
493                 }
494
495                 ad->item_data_cpu->sub_desc = (char *)g_strdup(str);
496                 elm_object_item_data_set(ad->item_data_cpu->item, ad->item_data_cpu);
497                 elm_genlist_item_update(ad->item_data_cpu->item);
498         }
499
500         if (ad->item_data_battery) {
501                 setting_about_main_get_battery_string(str, sizeof(str));
502                 /*SETTING_TRACE("str:%s", str);*/
503                 ad->item_data_battery->sub_desc = (char *)g_strdup(str);
504                 elm_object_item_data_set(ad->item_data_battery->item, ad->item_data_battery);
505                 elm_genlist_item_update(ad->item_data_battery->item);
506         }
507         return TRUE;
508 }
509
510 static void
511 __about_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event)
512 {
513         ret_if(!data);
514         SettingAboutUG *ad = (SettingAboutUG *) data;
515         retm_if(event == NULL, "Invalid argument: event info is NULL");
516         Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event;
517
518         if (ad->item_dev_name) {
519                 Elm_Object_Item *selected_item = elm_genlist_at_xy_item_get(ad->genlsit, ev->output.x, ev->output.y, NULL);
520                 if (ad->item_dev_name->item == selected_item)//do nothing..
521                         return;
522
523                 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);//to make inputing words input
524         }
525 }
526
527 static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
528 {
529         SETTING_TRACE_BEGIN;
530         retm_if(!data || !obj, "Data parameter is NULL");
531
532         Evas_Object *entry_container = elm_object_parent_widget_get(obj);
533         if (entry_container) {
534                 //whe entry unfocused, its guidetext will becomes "Input here"
535                 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
536                 if (elm_entry_is_empty(obj))
537                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
538                 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
539         }
540
541         //Setting_GenGroupItem_Data *list_item = data;
542         const char *entry_str = elm_entry_entry_get(obj);
543         char *entry_str_utf8 = NULL;
544         entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
545         //int len = safeStrLen(entry_str_utf8);
546         SETTING_TRACE("To store \"%s\" into vconf[%s]", entry_str_utf8, VCONFKEY_SETAPPL_DEVICE_NAME_STR);
547
548         //ecore_idler_add(__check_on_idler, ad);
549         Setting_GenGroupItem_Data *item_dev_name = data;
550         SettingAboutUG *ad = item_dev_name->userdata;
551         __device_name_changed_cb(item_dev_name, item_dev_name->eo_check);
552         //after unfocus,need updating..
553         elm_object_item_data_set(item_dev_name->item, item_dev_name);
554         elm_genlist_item_update(item_dev_name->item);
555
556
557         if(ad->navi_item
558            && elm_object_item_part_content_get(ad->navi_item, "title_right_btn")) {
559                 Evas_Object *btn = elm_object_item_part_content_unset(ad->navi_item, "title_right_btn");
560                 evas_object_del(btn);
561         }
562         setting_hide_input_pannel_cb(item_dev_name->eo_check);
563         if (item_dev_name) {
564                 if (ad->empty_flag) {
565                         if (ad->popup) {
566                                 evas_object_del(ad->popup);
567                                 ad->popup = NULL;
568                         }
569                         ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(EMPTY_LIMITATION_STR),
570                                              __about_popup_rsp_cb, POPUP_INTERVAL, FALSE, FALSE);
571                         return;
572                 } else {
573                 }
574         }
575
576
577         if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, entry_str_utf8)) {
578                 SETTING_TRACE_ERROR("Set vconf[%s] failed",
579                                     VCONFKEY_SETAPPL_DEVICE_NAME_STR);
580         }
581
582         FREE(entry_str_utf8);
583
584 }
585
586 static void __entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
587 {
588         ret_if(data == NULL);
589         SettingAboutUG *ad = (SettingAboutUG*)data;
590         Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
591         SETTING_TRACE_DEBUG("ev->key : %s", ev->key);
592
593         SETTING_TRACE("ad->item_dev_name->eo_check:%p", ad->item_dev_name->eo_check);
594         SETTING_TRACE("obj:%p, %s", obj, elm_entry_entry_get(obj));
595         if(safeStrCmp(ev->key, "Return") == 0)
596         {
597                 // if entry has 1 char at list, hide ime.
598                 if(safeStrLen(elm_entry_entry_get(obj)) > 0)
599                 {
600                         ecore_imf_context_input_panel_hide((Ecore_IMF_Context*)elm_entry_imf_context_get(obj));
601                 }
602                 else
603                 {
604                         if (ad->popup) {
605                                 evas_object_del(ad->popup);
606                                 ad->popup = NULL;
607                         }
608                         ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(EMPTY_LIMITATION_STR),
609                                              __about_popup_rsp_cb, POPUP_INTERVAL, FALSE, FALSE);
610                 }
611         } else {
612                 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
613                 if(safeStrLen(elm_entry_entry_get(obj)) > 0) {
614                         elm_object_signal_emit(entry_container, "elm,state,guidetext,hide", "elm");
615                 } else {
616                         //elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
617                         elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
618                 }
619         }
620 }
621
622
623 int setting_about_generate_genlist(void *data)
624 {
625         SETTING_TRACE_BEGIN;
626         /* error check */
627         retv_if(data == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
628
629         SettingAboutUG *ad = (SettingAboutUG *) data; 
630
631         Evas_Object *scroller = ad->genlsit;
632         Elm_Object_Item *item = NULL;
633         Setting_GenGroupItem_Data *item_data = NULL;
634         char str[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
635         (void)setting_create_Gendial_field_titleItem(scroller,
636                                                      &(ad->itc_group_item),
637                                                      SETTING_ABOUT_DEVICE_INFO_STR, NULL);
638         /* Device name */
639         char *name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
640         char *pa_sub_desc = elm_entry_utf8_to_markup(name_value);
641         FREE(name_value);
642
643         ad->empty_flag = FALSE;
644         if (NULL == pa_sub_desc || '\0' == pa_sub_desc[0])
645         {
646                 ad->empty_flag = TRUE;
647                 Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
648                 if (navi_it)
649                 {
650                         Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
651                         setting_disable_evas_object(back_btn);
652                         setting_dim_evas_object(back_btn, TRUE);
653                 }
654         }
655
656
657         // [UI] Device name
658         char *app_name = NULL;
659         int ret_get_app_name = app_manager_get_app_name("com.samsung.oma-dm-ui", &app_name);
660         if (ret_get_app_name == APP_MANAGER_ERROR_INVALID_PACKAGE )
661         {
662                 SETTING_TRACE(">>>>>>>>>>>>>>>>>> UNINSTALLED PACKAGE");
663                 ad->item_dev_name = NULL;
664         } else {
665
666                 ad->item_dev_name =
667                         setting_create_Gendial_field_def(scroller, &(ad->itc_1icon),
668                                                                  setting_about_main_mouse_up_Gendial_list_cb,
669                                                          ad, SWALLOW_Type_LAYOUT_ENTRY,
670                                                          NULL, NULL, 0, SETTING_ABOUT_DEVICE_NAME_STR, pa_sub_desc,
671                                                          __setting_about_device_name_changed_cb);
672                 if (ad->item_dev_name) {
673                         ad->item_dev_name->userdata = ad;
674                         ad->item_dev_name->isSinglelineFlag = 1;
675                         ad->item_dev_name->start_change_cb = (setting_call_back_func)__entry_key_down_cb;
676                         ad->item_dev_name->stop_change_cb = __entry_unfocus_cb;
677                         ad->item_dev_name->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
678
679                         if (ad->item_dev_name->limit_filter_data) {
680                                 //max byte len is 31 not 31+1
681                                 //ad->item_dev_name->limit_filter_data->max_byte_count = MAX_DEVICE_NAME_LEN + OFFESET_ENTRY_FILTER;
682                                 ad->item_dev_name->limit_filter_data->max_byte_count = MAX_DEVICE_NAME_LEN;
683                                 ad->item_dev_name->win_main = ad->win_get;
684                         }
685                         //ad->item_dev_name->input_type = ELM_INPUT_PANEL_LAYOUT_NUMBER;
686                         ad->item_dev_name->input_panel_disable_flag = EINA_TRUE;
687                 } else {
688                                 SETTING_TRACE_ERROR("ad->item_dev_name is NULL");
689                 }
690                 FREE(pa_sub_desc);
691         }
692
693         // [UI] My number
694         if (ad->my_numbers.count == 1) {
695                 item_data =
696                         setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2),
697                                              setting_about_main_mouse_up_Gendial_list_cb,
698                                              ad, SWALLOW_Type_INVALID, NULL,
699                                              NULL, 0, SETTING_ABOUT_MY_NUMBER_STR,
700                                              ad->my_numbers.list[0].name, NULL);
701                 if (item_data) {
702                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
703                 } else {
704                         SETTING_TRACE_ERROR("item_data is NULL");
705                 }
706         } else if (ad->my_numbers.count > 1){
707                 setting_enable_expandable_genlist(scroller, ad,
708                                           __setting_about_main_exp_cb, NULL);
709                 item_data = setting_create_Gendial_exp_parent_field(scroller,
710                                                     &(ad->itc_2text_3_parent),
711                                                     NULL, NULL,
712                                                     SWALLOW_Type_INVALID,
713                                                     SETTING_ABOUT_MY_NUMBER_STR,
714                                                     ad->my_numbers.list[ad->my_number_sel_idx].name);
715
716         } else {
717                 SETTING_TRACE_ERROR("don't have my number");
718         }
719
720         // [UI] Phone model
721         memset(str, 0x00, sizeof(str));
722         setting_about_main_get_phone_model_name(str, sizeof(str));
723         item_data =
724             setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
725                                              NULL, SWALLOW_Type_INVALID, NULL,
726                                              NULL, 0, SETTING_ABOUT_MODEL_STR, str, NULL);
727         if (item_data) {
728                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
729         } else {
730                 SETTING_TRACE_ERROR("item_data is NULL");
731         }
732
733         // [UI] SW version
734         memset(str, 0x00, sizeof(str));
735         setting_about_main_get_sw_version(str, sizeof(str));
736         item_data =
737             setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
738                                              NULL, SWALLOW_Type_INVALID, NULL,
739                                              NULL, 0, SETTING_ABOUT_VERSION_STR, str, NULL);
740         if (item_data) {
741                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
742         } else {
743                 SETTING_TRACE_ERROR("item_data is NULL");
744         }
745
746         // [UI] Bluetooth address
747         if ( ! isEmulBin()) { // requested by DI Kim due to BT BS on 11/26
748                 memset(str, 0x00, sizeof(str));
749                 setting_about_main_get_bluetooth_address_string(str, sizeof(str));
750                 ad->item_data_bt =
751                         setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
752                                                          NULL, SWALLOW_Type_INVALID, NULL,
753                                                          NULL, 0, SETTING_ABOUT_BLUETOOTH_STR, str, NULL);
754                 if (ad->item_data_bt) {
755                         elm_genlist_item_select_mode_set(ad->item_data_bt->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
756                 } else {
757                                 SETTING_TRACE_ERROR("item_data is NULL");
758                 }
759         }
760
761         // [UI] MAC address
762         memset(str, 0x00, sizeof(str));
763         setting_about_main_get_wifi_mac_address_string(str, sizeof(str));
764
765         SETTING_TRACE_DEBUG("[about main] get_wifi_mac_address : %s", str);
766
767         ad->item_data_wifi =
768             setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
769                                              NULL, SWALLOW_Type_INVALID, NULL,
770                                              NULL, 0, SETTING_ABOUT_WIFI_STR, str, NULL);
771         if (ad->item_data_wifi) {
772                 elm_genlist_item_select_mode_set(ad->item_data_wifi->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
773         } else {
774                 SETTING_TRACE_ERROR("item_data is NULL");
775         }
776
777         // [UI] Battery
778         memset(str, 0x00, sizeof(str));
779         setting_about_main_get_battery_string(str, sizeof(str));
780         item_data =
781             setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
782                                              NULL, SWALLOW_Type_INVALID, NULL,
783                                              NULL, 0, SETTING_ABOUT_BATTERY_STR, str, NULL);
784         if (item_data) {
785                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
786                 ad->item_data_battery = item_data;
787         } else {
788                 SETTING_TRACE_ERROR("item_data is NULL");
789         }
790
791         // [UI] CPU Info
792         memset(str, 0x00, sizeof(str));
793         float usr, sys;
794         int ret = __stat_get_cpuinfo(&usr, &sys);
795         if (ret == -ENOENT) {
796                 SETTING_TRACE_ERROR("call __stat_get_cpuinfo fail");
797                 snprintf(str, sizeof(str), "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
798         } else {
799                 snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
800         }
801
802         ad->item_data_cpu = item_data =
803             setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
804                                              NULL, SWALLOW_Type_INVALID, NULL,
805                                              NULL, 0, SETTING_ABOUT_CPU_USAGE_STR, str, NULL);
806         if (item_data) {
807                 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
808         } else {
809                 SETTING_TRACE_ERROR("item_data is NULL");
810         }
811
812         // [UI] separator
813         item =
814             elm_genlist_item_append(scroller, &(ad->itc_seperator), NULL, NULL,
815                                     ELM_GENLIST_ITEM_NONE, NULL, NULL);
816         elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
817
818 #ifdef SUPPORT_DIAG_USAGE
819         // [UI] Diagnostics and Usage
820         if (!isEmulBin()) {
821                 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
822                                          setting_about_main_mouse_up_Gendial_list_cb,
823                                          ad, SWALLOW_Type_INVALID, NULL, NULL,
824                                          0, DIAGNOSTICS_USAGE_STR,
825                                          NULL, NULL);
826         }
827 #endif
828
829 #ifdef SUPPORT_FOTA
830         // [UI] Software update
831         if (!isEmulBin()) {
832                 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
833                                          setting_about_main_mouse_up_Gendial_list_cb,
834                                          ad, SWALLOW_Type_INVALID, NULL, NULL,
835                                          0, SOFTWARE_UPDATE_STR,
836                                          NULL, NULL);
837         }
838 #endif
839         // [UI] Certificates
840         // implementation is in progress.
841         if (is_ug_installed_by_ug_args("setting-manage-applications-efl"))
842         {
843                 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
844                                                  setting_about_main_mouse_up_Gendial_list_cb,
845                                                  ad, SWALLOW_Type_INVALID, NULL, NULL,
846                                                  0, "IDS_COM_BODY_CERTIFICATES", NULL, NULL);
847
848                 item = elm_genlist_item_append(scroller, &itc_bottom_seperator, NULL, NULL,
849                                                 ELM_GENLIST_ITEM_NONE, NULL, NULL);
850                 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
851         }
852
853
854         ad->update_timer =
855             ecore_timer_add(2, (Ecore_Task_Cb) __timer_update_cb, ad);
856
857         return SETTING_RETURN_SUCCESS;
858 }
859
860 static int setting_about_main_create(void *cb)
861 {
862         SETTING_TRACE_BEGIN;
863         /* error check */
864         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
865
866         SettingAboutUG *ad = (SettingAboutUG *) cb;
867
868         Evas_Object *scroller = elm_genlist_add(ad->win_main_layout);
869         retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER,
870                  "Cannot set scroller object  as contento of layout");
871         elm_object_style_set(scroller, "dialogue");
872         elm_genlist_clear(scroller);    /* first to clear list */
873
874         /*  Enabling illume notification property for window */
875         elm_win_conformant_set(ad->win_main_layout, 1);
876         Evas_Object *conformant = elm_conformant_add(ad->win_main_layout);
877         elm_object_style_set(conformant, "internal_layout");    /*  By Kollus. 2011-01-04 */
878         evas_object_show(conformant);
879         elm_object_content_set(conformant, scroller);
880         ad->genlsit = scroller;
881
882         ad->ly_main =
883             setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
884                                            _(KeyStr_AboutPhone),
885                                            _("IDS_COM_BODY_BACK"), NULL, NULL,
886                                            setting_about_main_click_softkey_back_cb,
887                                            NULL, NULL, ad, conformant,
888                                            &ad->navi_bar, NULL);
889
890         evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_UP,
891                                        __about_main_gl_mouse_up, ad);
892
893         ad->navi_item = elm_naviframe_top_item_get(ad->navi_bar);
894
895         int err = 0;
896         int value;
897         setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
898         if (VCONFKEY_TELEPHONY_SIM_INSERTED != value)
899         {
900                 setting_about_generate_genlist((void *)ad);
901         } else {
902                 if (ad->handle && !ad->tapi_responsed) {//not responsed yet
903                         //SETTING_TRACE(">>> IF THERE'S SIM CARD, THIS LINE SHOULD NOT WORK");
904                 } else {//already responsed
905                         // do nothing
906                 }
907         }
908
909         setting_view_about_main.is_create = 1;
910         SETTING_TRACE_END;
911         return SETTING_RETURN_SUCCESS;
912 }
913
914 static int setting_about_main_destroy(void *cb)
915 {
916         SETTING_TRACE_BEGIN;
917         /* error check */
918         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
919
920         SettingAboutUG *ad = (SettingAboutUG *) cb;
921
922         if (ad->update_timer) {
923                 ecore_timer_del(ad->update_timer);
924                 ad->update_timer = NULL;
925         }
926         if (ad->popup) {
927                 evas_object_del(ad->popup);
928                 ad->popup = NULL;
929         }
930
931         if (ad->ly_main != NULL) {
932                 evas_object_del(ad->ly_main);
933                 ad->ly_main = NULL;
934         }
935
936         setting_view_about_main.is_create = 0;
937         return SETTING_RETURN_SUCCESS;
938 }
939
940 static int setting_about_main_update(void *cb)
941 {
942         SETTING_TRACE_BEGIN;
943         /* error check */
944         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
945
946         SettingAboutUG *ad = (SettingAboutUG *) cb;
947
948         if (ad->ly_main != NULL) {
949                 evas_object_show(ad->ly_main);
950         }
951
952         return SETTING_RETURN_SUCCESS;
953 }
954
955 static int setting_about_main_cleanup(void *cb)
956 {
957         SETTING_TRACE_BEGIN;
958         /* error check */
959         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
960
961         SettingAboutUG *ad = (SettingAboutUG *) cb;
962
963         if (ad->ly_main != NULL) {
964                 /*  evas_object_hide(ad->ly_main); */
965         }
966
967         return SETTING_RETURN_SUCCESS;
968 }
969
970 /* ***************************************************
971  *
972  *general func
973  *
974  ***************************************************/
975
976 /* ***************************************************
977  *
978  *call back func
979  *
980  ***************************************************/
981
982 static void
983 setting_about_main_click_softkey_back_cb(void *data, Evas_Object *obj,
984                                          void *event_info)
985 {
986         SETTING_TRACE_BEGIN;
987         /* error check */
988         setting_retm_if(data == NULL, "Data parameter is NULL");
989
990         SettingAboutUG *ad = (SettingAboutUG *) data;
991         if (ad->empty_flag) {
992                 if (ad->popup) {
993                         evas_object_del(ad->popup);
994                         ad->popup = NULL;
995                 }
996                 ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(EMPTY_LIMITATION_STR),
997                                      __about_popup_rsp_cb, POPUP_INTERVAL, FALSE, FALSE);
998                 if (ad->item_dev_name) {
999                         elm_object_focus_set(ad->item_dev_name->eo_check, EINA_TRUE);
1000                 }
1001                 return;
1002         }
1003
1004         /* Send destroy request */
1005         ug_destroy_me(ad->ug);
1006         //imf must be hided before view is destroyed.
1007         //Following code is just to improve the hiding speed. If not add these code,
1008         //the input pannel will also be hided with the view destroyed,but it works too slow.
1009         if (ad->item_dev_name) {
1010                 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
1011                 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
1012         }
1013
1014         SETTING_TRACE_END;
1015 }
1016
1017 /**
1018 * @brief
1019 *
1020 * @param data
1021 * @param obj
1022 * @param event_info
1023 */
1024 static void
1025 setting_about_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
1026                                             void *event_info)
1027 {
1028         SETTING_TRACE_BEGIN;
1029         /* error check */
1030         setting_retm_if(data == NULL, "Data parameter is NULL");
1031
1032         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1033         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1034         elm_genlist_item_selected_set(item, 0);
1035         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1036
1037         /* SettingAboutUG *ad = (SettingAboutUG *) data; */
1038
1039         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
1040         if (!safeStrCmp("IDS_ST_BODY_OPEN_SOURCE_LICENCES", list_item->keyStr)) {
1041
1042                 //setting_view_change(&setting_view_about_main, &setting_view_about_licences, data);
1043
1044         } else if (!safeStrCmp("IDS_COM_BODY_CERTIFICATES", list_item->keyStr)) {
1045                 __setting_about_main_certificates_clicked(data);
1046         } else if (!safeStrCmp(SETTING_ABOUT_DEVICE_NAME_STR, list_item->keyStr)) {
1047                 __setting_about_main_device_name_clicked(data, list_item->eo_check);
1048         } else if (!safeStrCmp(DIAGNOSTICS_USAGE_STR, list_item->keyStr)) {
1049                 __setting_about_main_diagnostics_usage_clicked(data, list_item->eo_check);
1050         } else if (!safeStrCmp(SOFTWARE_UPDATE_STR, list_item->keyStr)) {
1051 #ifdef SUPPORT_FOTA
1052                 if(aul_app_is_running("com.samsung.oma-dm-ui"))
1053                 {
1054                         SETTING_TRACE_DEBUG("oma-dm-ui is already launched. ");
1055                         aul_open_app("com.samsung.oma-dm-ui");
1056                 }
1057                 else
1058                 {
1059                         SETTING_TRACE_DEBUG("oma-dm-ui will be launched. ");
1060                         aul_launch_app("com.samsung.oma-dm-ui", NULL);
1061                 }
1062 #endif
1063         }
1064 }
1065
1066 static void __destroy_certificates_ug_cb(ui_gadget_h ug, void *priv)
1067 {
1068         SETTING_TRACE_BEGIN;
1069
1070         /* restore the '<-' button on the navigate bar */
1071         ret_if(!priv);
1072         SettingAboutUG *ad = (SettingAboutUG *) priv;   /* ad is point to priv */
1073
1074         if (ug) {
1075                 ug_destroy(ug);
1076                 ad->ug_loading = NULL;
1077         }
1078
1079 }
1080
1081 static void __setting_about_main_certificates_clicked(void *data)
1082 {
1083         SETTING_TRACE_BEGIN;
1084         retm_if(data == NULL, "Data parameter is NULL");
1085         SettingAboutUG *ad = (SettingAboutUG *)data;
1086
1087         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1088         if (!cbs) {
1089                 return;
1090         }
1091
1092         cbs->layout_cb = setting_about_layout_ug_cb;
1093         cbs->result_cb = NULL;
1094         cbs->destroy_cb = __destroy_certificates_ug_cb;
1095         cbs->priv = (void *)ad;
1096
1097         ad->ug_loading =
1098             ug_create(ad->ug, "setting-manage-certificates-efl", UG_MODE_FULLVIEW, NULL, cbs);
1099
1100         if (NULL == ad->ug_loading) {   /* error handling */
1101                 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
1102         }
1103         FREE(cbs);
1104 }
1105
1106 static void __top_back_cb(void *data, Evas_Object *obj,
1107                                          void *event_info)
1108 {
1109         SETTING_TRACE_BEGIN;
1110         /* error check */
1111         setting_retm_if(data == NULL, "Data parameter is NULL");
1112
1113         SettingAboutUG *ad = (SettingAboutUG *) data;
1114
1115         if (ad->item_dev_name)
1116                 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
1117
1118         SETTING_TRACE_END;
1119 }
1120
1121 static void _input_panel_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
1122 {
1123         SETTING_TRACE_BEGIN;
1124         retm_if(data == NULL, "Data parameter is NULL");
1125         retm_if(ctx == NULL, "obj parameter is NULL");
1126
1127         SettingAboutUG *ad = (SettingAboutUG *)data;
1128
1129         if(value == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
1130         {
1131                 SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW");
1132                 if(ad->navi_item && !elm_object_item_part_content_get(ad->navi_item, "title_right_btn"))
1133                 {
1134                         Evas_Object *r_button = setting_create_button(ad->navi_bar,
1135                                                                         dgettext("sys_string", "IDS_COM_BODY_BACK"),
1136                                                                         NAVI_BACK_BUTTON_STYLE,
1137                                                                         __top_back_cb,
1138                                                                         ad);
1139                         elm_object_item_part_content_set(ad->navi_item, "title_right_btn", r_button);
1140                 }
1141         }
1142         else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
1143         {
1144                 SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE");
1145                 if(ad->navi_item && elm_object_item_part_content_get(ad->navi_item, "title_right_btn")) {
1146                         Evas_Object *btn = elm_object_item_part_content_unset(ad->navi_item, "title_right_btn");
1147                         evas_object_del(btn);
1148                 }
1149
1150                 if (ad->item_dev_name) {
1151                         elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
1152                 }
1153         }
1154 }
1155
1156 static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj)
1157 {
1158         SETTING_TRACE_BEGIN;
1159         retm_if(data == NULL, "Data parameter is NULL");
1160         retm_if(obj == NULL, "obj parameter is NULL");
1161         SettingAboutUG *ad = (SettingAboutUG *)data;
1162
1163         int mobile_ap_status = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
1164         int err = -1;
1165         int ret = setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &mobile_ap_status, &err);
1166         setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
1167
1168         if (!elm_object_focus_get(obj)) {
1169                 elm_object_focus_set(obj, EINA_TRUE);
1170         }
1171
1172         if ((mobile_ap_status & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) && !ad->popup_showed_flag) {
1173                 if (ad->popup) {
1174                         evas_object_del(ad->popup);
1175                         ad->popup = NULL;
1176                 }
1177                 ad->popup = setting_create_popup_with_btn(ad, ad->win_get,
1178                                          NULL, _(SETTING_ABOUT_MOBILE_AP_TURNED_OFF),
1179                                          __setting_about_main_mobile_ap_turn_off_ask_resp_cb, 0,
1180                                          1, _("IDS_COM_SK_OK"));
1181         } else {
1182                 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
1183                 setting_retm_if(imf_context == NULL, "imf_context is NULL");
1184                 ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_cb, ad);
1185                 ecore_imf_context_input_panel_show(imf_context);
1186         }
1187 }
1188
1189
1190 static void __destroy_diagnostics_usage_ug_cb(ui_gadget_h ug, void *priv)
1191 {
1192         SETTING_TRACE_BEGIN;
1193
1194         /* restore the '<-' button on the navigate bar */
1195         ret_if(!priv);
1196         SettingAboutUG *ad = (SettingAboutUG *) priv;   /* ad is point to priv */
1197
1198         if (ug) {
1199                 ug_destroy(ug);
1200                 ad->ug_loading = NULL;
1201         }
1202
1203         Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
1204         ret_if(!navi_it);
1205         Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
1206
1207         if (back_btn != NULL) {
1208                 elm_object_style_set(back_btn, NAVI_BACK_BUTTON_STYLE); /* take into effect */
1209         }
1210 }
1211
1212 static void __setting_about_main_diagnostics_usage_clicked(void *data, Evas_Object *obj)
1213 {
1214         SETTING_TRACE_BEGIN;
1215         retm_if(data == NULL, "Data parameter is NULL");
1216         SettingAboutUG *ad = (SettingAboutUG *)data;
1217
1218         // create UG
1219         if (!ad)
1220                 return;         /*  do nothing if ad is NULL */
1221
1222         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1223         if (!cbs) {
1224                 return;
1225         }
1226
1227         cbs->layout_cb = setting_about_layout_ug_cb;
1228         cbs->result_cb = NULL;
1229         cbs->destroy_cb = __destroy_diagnostics_usage_ug_cb;
1230         cbs->priv = (void *)ad;
1231
1232         ad->ug_loading =
1233             ug_create(ad->ug, "setting-crash-efl", UG_MODE_FULLVIEW, NULL, cbs);
1234
1235         if (NULL == ad->ug_loading) {   /* error handling */
1236                 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
1237                 setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
1238         }
1239         FREE(cbs);
1240 }
1241
1242 static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
1243                                                     Evas_Object *obj,
1244                                                     void *event_info)
1245 {
1246         SETTING_TRACE_BEGIN;
1247         setting_retm_if(data == NULL, "Data parameter is NULL");
1248         SettingAboutUG *ad = (SettingAboutUG *)data;
1249         int response_type = btn_type(obj);
1250
1251         if (POPUP_RESPONSE_OK == response_type) {
1252                 ad->popup_showed_flag = TRUE;
1253
1254                 if (ad->item_dev_name) {
1255                         Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ad->item_dev_name->eo_check);
1256                         setting_retm_if(imf_context == NULL, "imf_context is NULL");
1257                         ecore_imf_context_input_panel_show(imf_context);
1258                 }
1259         }
1260
1261         if (ad->popup)
1262         {
1263                 evas_object_del(ad->popup);
1264                 ad->popup = NULL;
1265         }
1266 }
1267
1268 static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info)
1269 {
1270         SETTING_TRACE_BEGIN;
1271         setting_retm_if(data == NULL, "Data parameter is NULL");
1272         setting_retm_if(event_info == NULL, "event_info parameter is NULL");
1273
1274         SettingAboutUG *ad = (SettingAboutUG *) data;
1275         Elm_Object_Item *parentItem = event_info;       /* parent item */
1276         Evas_Object *scroller = elm_object_item_widget_get(parentItem);
1277
1278         Evas_Object *rgd = elm_radio_add(scroller);
1279         elm_radio_value_set(rgd, -1);
1280
1281         int i = 0;
1282         Setting_GenGroupItem_Data *item_data = NULL;
1283         for(; i < SETTING_ABOUT_MY_NUMBERS_LEN; i++) {
1284                 if (ad->my_numbers.list[i].name == NULL) {
1285                         break;
1286                 }
1287
1288                 item_data = setting_create_Gendial_exp_sub_field(scroller,
1289                                         &(ad->itc_1icon_1text_sub),
1290                                         NULL, NULL, parentItem,
1291                                         SWALLOW_Type_1RADIO, rgd,
1292                                         i,
1293                                         ad->my_numbers.list[i].name, __setting_about_sub_list_rd_change);
1294                 if (item_data) {
1295                         item_data->userdata = ad;
1296                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1297                 } else {
1298                         SETTING_TRACE_ERROR("item_data is NULL");
1299                 }
1300         }
1301         elm_radio_value_set(rgd, ad->my_number_sel_idx);
1302 }
1303
1304 static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info) {
1305         SETTING_TRACE_BEGIN;
1306         retm_if(data == NULL, "Data parameter is NULL");
1307         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1308         SettingAboutUG *ad = (SettingAboutUG *) list_item->userdata;
1309         SETTING_TRACE("my_number_sel_idx = %d", ad->my_number_sel_idx);
1310         elm_radio_value_set(obj, ad->my_number_sel_idx);
1311 }
1312