Merge "change setting icon patchset2. change icon." 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         setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
821                                          setting_about_main_mouse_up_Gendial_list_cb,
822                                          ad, SWALLOW_Type_INVALID, NULL, NULL,
823                                          0, DIAGNOSTICS_USAGE_STR,
824                                          NULL, NULL);
825 #endif
826
827 #ifdef SUPPORT_FOTA
828         // [UI] Software update
829         setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
830                                          setting_about_main_mouse_up_Gendial_list_cb,
831                                          ad, SWALLOW_Type_INVALID, NULL, NULL,
832                                          0, SOFTWARE_UPDATE_STR,
833                                          NULL, NULL);
834 #endif
835         // [UI] Certificates
836         // implementation is in progress.
837         if (is_ug_installed_by_ug_args("setting-manage-applications-efl"))
838         {
839                 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
840                                                  setting_about_main_mouse_up_Gendial_list_cb,
841                                                  ad, SWALLOW_Type_INVALID, NULL, NULL,
842                                                  0, "IDS_COM_BODY_CERTIFICATES", NULL, NULL);
843
844                 item = elm_genlist_item_append(scroller, &itc_bottom_seperator, NULL, NULL,
845                                                 ELM_GENLIST_ITEM_NONE, NULL, NULL);
846                 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
847         }
848
849
850         ad->update_timer =
851             ecore_timer_add(2, (Ecore_Task_Cb) __timer_update_cb, ad);
852
853         return SETTING_RETURN_SUCCESS;
854 }
855
856 static int setting_about_main_create(void *cb)
857 {
858         SETTING_TRACE_BEGIN;
859         /* error check */
860         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
861
862         SettingAboutUG *ad = (SettingAboutUG *) cb;
863
864         Evas_Object *scroller = elm_genlist_add(ad->win_main_layout);
865         retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER,
866                  "Cannot set scroller object  as contento of layout");
867         elm_object_style_set(scroller, "dialogue");
868         elm_genlist_clear(scroller);    /* first to clear list */
869
870         /*  Enabling illume notification property for window */
871         elm_win_conformant_set(ad->win_main_layout, 1);
872         Evas_Object *conformant = elm_conformant_add(ad->win_main_layout);
873         elm_object_style_set(conformant, "internal_layout");    /*  By Kollus. 2011-01-04 */
874         evas_object_show(conformant);
875         elm_object_content_set(conformant, scroller);
876         ad->genlsit = scroller;
877
878         ad->ly_main =
879             setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
880                                            _(KeyStr_AboutPhone),
881                                            _("IDS_COM_BODY_BACK"), NULL, NULL,
882                                            setting_about_main_click_softkey_back_cb,
883                                            NULL, NULL, ad, conformant,
884                                            &ad->navi_bar, NULL);
885
886         evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_UP,
887                                        __about_main_gl_mouse_up, ad);
888
889         ad->navi_item = elm_naviframe_top_item_get(ad->navi_bar);
890
891         int err = 0;
892         int value;
893         setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
894         if (VCONFKEY_TELEPHONY_SIM_INSERTED != value)
895         {
896                 setting_about_generate_genlist((void *)ad);
897         } else {
898                 if (ad->handle && !ad->tapi_responsed) {//not responsed yet
899                         //SETTING_TRACE(">>> IF THERE'S SIM CARD, THIS LINE SHOULD NOT WORK");
900                 } else {//already responsed
901                         // do nothing
902                 }
903         }
904
905         setting_view_about_main.is_create = 1;
906         SETTING_TRACE_END;
907         return SETTING_RETURN_SUCCESS;
908 }
909
910 static int setting_about_main_destroy(void *cb)
911 {
912         SETTING_TRACE_BEGIN;
913         /* error check */
914         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
915
916         SettingAboutUG *ad = (SettingAboutUG *) cb;
917
918         if (ad->update_timer) {
919                 ecore_timer_del(ad->update_timer);
920                 ad->update_timer = NULL;
921         }
922         if (ad->popup) {
923                 evas_object_del(ad->popup);
924                 ad->popup = NULL;
925         }
926
927         if (ad->ly_main != NULL) {
928                 evas_object_del(ad->ly_main);
929                 ad->ly_main = NULL;
930         }
931
932         setting_view_about_main.is_create = 0;
933         return SETTING_RETURN_SUCCESS;
934 }
935
936 static int setting_about_main_update(void *cb)
937 {
938         SETTING_TRACE_BEGIN;
939         /* error check */
940         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
941
942         SettingAboutUG *ad = (SettingAboutUG *) cb;
943
944         if (ad->ly_main != NULL) {
945                 evas_object_show(ad->ly_main);
946         }
947
948         return SETTING_RETURN_SUCCESS;
949 }
950
951 static int setting_about_main_cleanup(void *cb)
952 {
953         SETTING_TRACE_BEGIN;
954         /* error check */
955         retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
956
957         SettingAboutUG *ad = (SettingAboutUG *) cb;
958
959         if (ad->ly_main != NULL) {
960                 /*  evas_object_hide(ad->ly_main); */
961         }
962
963         return SETTING_RETURN_SUCCESS;
964 }
965
966 /* ***************************************************
967  *
968  *general func
969  *
970  ***************************************************/
971
972 /* ***************************************************
973  *
974  *call back func
975  *
976  ***************************************************/
977
978 static void
979 setting_about_main_click_softkey_back_cb(void *data, Evas_Object *obj,
980                                          void *event_info)
981 {
982         SETTING_TRACE_BEGIN;
983         /* error check */
984         setting_retm_if(data == NULL, "Data parameter is NULL");
985
986         SettingAboutUG *ad = (SettingAboutUG *) data;
987         if (ad->empty_flag) {
988                 if (ad->popup) {
989                         evas_object_del(ad->popup);
990                         ad->popup = NULL;
991                 }
992                 ad->popup = setting_create_popup_without_btn(ad, ad->win_get, NULL, _(EMPTY_LIMITATION_STR),
993                                      __about_popup_rsp_cb, POPUP_INTERVAL, FALSE, FALSE);
994                 if (ad->item_dev_name) {
995                         elm_object_focus_set(ad->item_dev_name->eo_check, EINA_TRUE);
996                 }
997                 return;
998         }
999
1000         /* Send destroy request */
1001         ug_destroy_me(ad->ug);
1002         //imf must be hided before view is destroyed.
1003         //Following code is just to improve the hiding speed. If not add these code,
1004         //the input pannel will also be hided with the view destroyed,but it works too slow.
1005         if (ad->item_dev_name) {
1006                 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
1007                 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
1008         }
1009
1010         SETTING_TRACE_END;
1011 }
1012
1013 /**
1014 * @brief
1015 *
1016 * @param data
1017 * @param obj
1018 * @param event_info
1019 */
1020 static void
1021 setting_about_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
1022                                             void *event_info)
1023 {
1024         SETTING_TRACE_BEGIN;
1025         /* error check */
1026         setting_retm_if(data == NULL, "Data parameter is NULL");
1027
1028         retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1029         Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1030         elm_genlist_item_selected_set(item, 0);
1031         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1032
1033         /* SettingAboutUG *ad = (SettingAboutUG *) data; */
1034
1035         SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
1036         if (!safeStrCmp("IDS_ST_BODY_OPEN_SOURCE_LICENCES", list_item->keyStr)) {
1037
1038                 //setting_view_change(&setting_view_about_main, &setting_view_about_licences, data);
1039
1040         } else if (!safeStrCmp("IDS_COM_BODY_CERTIFICATES", list_item->keyStr)) {
1041                 __setting_about_main_certificates_clicked(data);
1042         } else if (!safeStrCmp(SETTING_ABOUT_DEVICE_NAME_STR, list_item->keyStr)) {
1043                 __setting_about_main_device_name_clicked(data, list_item->eo_check);
1044         } else if (!safeStrCmp(DIAGNOSTICS_USAGE_STR, list_item->keyStr)) {
1045                 __setting_about_main_diagnostics_usage_clicked(data, list_item->eo_check);
1046         } else if (!safeStrCmp(SOFTWARE_UPDATE_STR, list_item->keyStr)) {
1047 #ifdef SUPPORT_FOTA
1048                 if(aul_app_is_running("com.samsung.oma-dm-ui"))
1049                 {
1050                         SETTING_TRACE_DEBUG("oma-dm-ui is already launched. ");
1051                         aul_open_app("com.samsung.oma-dm-ui");
1052                 }
1053                 else
1054                 {
1055                         SETTING_TRACE_DEBUG("oma-dm-ui will be launched. ");
1056                         aul_launch_app("com.samsung.oma-dm-ui", NULL);
1057                 }
1058 #endif
1059         }
1060 }
1061
1062 static void __destroy_certificates_ug_cb(ui_gadget_h ug, void *priv)
1063 {
1064         SETTING_TRACE_BEGIN;
1065
1066         /* restore the '<-' button on the navigate bar */
1067         ret_if(!priv);
1068         SettingAboutUG *ad = (SettingAboutUG *) priv;   /* ad is point to priv */
1069
1070         if (ug) {
1071                 ug_destroy(ug);
1072                 ad->ug_loading = NULL;
1073         }
1074
1075 }
1076
1077 static void __setting_about_main_certificates_clicked(void *data)
1078 {
1079         SETTING_TRACE_BEGIN;
1080         retm_if(data == NULL, "Data parameter is NULL");
1081         SettingAboutUG *ad = (SettingAboutUG *)data;
1082
1083         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1084         if (!cbs) {
1085                 return;
1086         }
1087
1088         cbs->layout_cb = setting_about_layout_ug_cb;
1089         cbs->result_cb = NULL;
1090         cbs->destroy_cb = __destroy_certificates_ug_cb;
1091         cbs->priv = (void *)ad;
1092
1093         ad->ug_loading =
1094             ug_create(ad->ug, "setting-manage-certificates-efl", UG_MODE_FULLVIEW, NULL, cbs);
1095
1096         if (NULL == ad->ug_loading) {   /* error handling */
1097                 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
1098         }
1099         FREE(cbs);
1100 }
1101
1102 static void __top_back_cb(void *data, Evas_Object *obj,
1103                                          void *event_info)
1104 {
1105         SETTING_TRACE_BEGIN;
1106         /* error check */
1107         setting_retm_if(data == NULL, "Data parameter is NULL");
1108
1109         SettingAboutUG *ad = (SettingAboutUG *) data;
1110
1111         if (ad->item_dev_name)
1112                 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
1113
1114         SETTING_TRACE_END;
1115 }
1116
1117 static void _input_panel_event_cb(void *data, Ecore_IMF_Context *ctx, int value)
1118 {
1119         SETTING_TRACE_BEGIN;
1120         retm_if(data == NULL, "Data parameter is NULL");
1121         retm_if(ctx == NULL, "obj parameter is NULL");
1122
1123         SettingAboutUG *ad = (SettingAboutUG *)data;
1124
1125         if(value == ECORE_IMF_INPUT_PANEL_STATE_SHOW)
1126         {
1127                 SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_SHOW");
1128                 if(ad->navi_item && !elm_object_item_part_content_get(ad->navi_item, "title_right_btn"))
1129                 {
1130                         Evas_Object *r_button = setting_create_button(ad->navi_bar,
1131                                                                         dgettext("sys_string", "IDS_COM_BODY_BACK"),
1132                                                                         NAVI_BACK_BUTTON_STYLE,
1133                                                                         __top_back_cb,
1134                                                                         ad);
1135                         elm_object_item_part_content_set(ad->navi_item, "title_right_btn", r_button);
1136                 }
1137         }
1138         else if(value == ECORE_IMF_INPUT_PANEL_STATE_HIDE)
1139         {
1140                 SETTING_TRACE("value == ECORE_IMF_INPUT_PANEL_STATE_HIDE");
1141                 if(ad->navi_item && elm_object_item_part_content_get(ad->navi_item, "title_right_btn")) {
1142                         Evas_Object *btn = elm_object_item_part_content_unset(ad->navi_item, "title_right_btn");
1143                         evas_object_del(btn);
1144                 }
1145
1146                 if (ad->item_dev_name) {
1147                         elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
1148                 }
1149         }
1150 }
1151
1152 static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj)
1153 {
1154         SETTING_TRACE_BEGIN;
1155         retm_if(data == NULL, "Data parameter is NULL");
1156         retm_if(obj == NULL, "obj parameter is NULL");
1157         SettingAboutUG *ad = (SettingAboutUG *)data;
1158
1159         int mobile_ap_status = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
1160         int err = -1;
1161         int ret = setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &mobile_ap_status, &err);
1162         setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
1163
1164         if (!elm_object_focus_get(obj)) {
1165                 elm_object_focus_set(obj, EINA_TRUE);
1166         }
1167
1168         if ((mobile_ap_status & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) && !ad->popup_showed_flag) {
1169                 if (ad->popup) {
1170                         evas_object_del(ad->popup);
1171                         ad->popup = NULL;
1172                 }
1173                 ad->popup = setting_create_popup_with_btn(ad, ad->win_get,
1174                                          NULL, _(SETTING_ABOUT_MOBILE_AP_TURNED_OFF),
1175                                          __setting_about_main_mobile_ap_turn_off_ask_resp_cb, 0,
1176                                          1, _("IDS_COM_SK_OK"));
1177         } else {
1178                 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
1179                 setting_retm_if(imf_context == NULL, "imf_context is NULL");
1180                 ecore_imf_context_input_panel_event_callback_add(imf_context, ECORE_IMF_INPUT_PANEL_STATE_EVENT, _input_panel_event_cb, ad);
1181                 ecore_imf_context_input_panel_show(imf_context);
1182         }
1183 }
1184
1185
1186 static void __destroy_diagnostics_usage_ug_cb(ui_gadget_h ug, void *priv)
1187 {
1188         SETTING_TRACE_BEGIN;
1189
1190         /* restore the '<-' button on the navigate bar */
1191         ret_if(!priv);
1192         SettingAboutUG *ad = (SettingAboutUG *) priv;   /* ad is point to priv */
1193
1194         if (ug) {
1195                 ug_destroy(ug);
1196                 ad->ug_loading = NULL;
1197         }
1198
1199         Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
1200         ret_if(!navi_it);
1201         Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
1202
1203         if (back_btn != NULL) {
1204                 elm_object_style_set(back_btn, NAVI_BACK_BUTTON_STYLE); /* take into effect */
1205         }
1206 }
1207
1208 static void __setting_about_main_diagnostics_usage_clicked(void *data, Evas_Object *obj)
1209 {
1210         SETTING_TRACE_BEGIN;
1211         retm_if(data == NULL, "Data parameter is NULL");
1212         SettingAboutUG *ad = (SettingAboutUG *)data;
1213
1214         // create UG
1215         if (!ad)
1216                 return;         /*  do nothing if ad is NULL */
1217
1218         struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
1219         if (!cbs) {
1220                 return;
1221         }
1222
1223         cbs->layout_cb = setting_about_layout_ug_cb;
1224         cbs->result_cb = NULL;
1225         cbs->destroy_cb = __destroy_diagnostics_usage_ug_cb;
1226         cbs->priv = (void *)ad;
1227
1228         ad->ug_loading =
1229             ug_create(ad->ug, "setting-crash-efl", UG_MODE_FULLVIEW, NULL, cbs);
1230
1231         if (NULL == ad->ug_loading) {   /* error handling */
1232                 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
1233                 setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
1234         }
1235         FREE(cbs);
1236 }
1237
1238 static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
1239                                                     Evas_Object *obj,
1240                                                     void *event_info)
1241 {
1242         SETTING_TRACE_BEGIN;
1243         setting_retm_if(data == NULL, "Data parameter is NULL");
1244         SettingAboutUG *ad = (SettingAboutUG *)data;
1245         int response_type = btn_type(obj);
1246
1247         if (POPUP_RESPONSE_OK == response_type) {
1248                 ad->popup_showed_flag = TRUE;
1249
1250                 if (ad->item_dev_name) {
1251                         Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ad->item_dev_name->eo_check);
1252                         setting_retm_if(imf_context == NULL, "imf_context is NULL");
1253                         ecore_imf_context_input_panel_show(imf_context);
1254                 }
1255         }
1256
1257         if (ad->popup)
1258         {
1259                 evas_object_del(ad->popup);
1260                 ad->popup = NULL;
1261         }
1262 }
1263
1264 static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info)
1265 {
1266         SETTING_TRACE_BEGIN;
1267         setting_retm_if(data == NULL, "Data parameter is NULL");
1268         setting_retm_if(event_info == NULL, "event_info parameter is NULL");
1269
1270         SettingAboutUG *ad = (SettingAboutUG *) data;
1271         Elm_Object_Item *parentItem = event_info;       /* parent item */
1272         Evas_Object *scroller = elm_object_item_widget_get(parentItem);
1273
1274         Evas_Object *rgd = elm_radio_add(scroller);
1275         elm_radio_value_set(rgd, -1);
1276
1277         int i = 0;
1278         Setting_GenGroupItem_Data *item_data = NULL;
1279         for(; i < SETTING_ABOUT_MY_NUMBERS_LEN; i++) {
1280                 if (ad->my_numbers.list[i].name == NULL) {
1281                         break;
1282                 }
1283
1284                 item_data = setting_create_Gendial_exp_sub_field(scroller,
1285                                         &(ad->itc_1icon_1text_sub),
1286                                         NULL, NULL, parentItem,
1287                                         SWALLOW_Type_1RADIO, rgd,
1288                                         i,
1289                                         ad->my_numbers.list[i].name, __setting_about_sub_list_rd_change);
1290                 if (item_data) {
1291                         item_data->userdata = ad;
1292                         elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1293                 } else {
1294                         SETTING_TRACE_ERROR("item_data is NULL");
1295                 }
1296         }
1297         elm_radio_value_set(rgd, ad->my_number_sel_idx);
1298 }
1299
1300 static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info) {
1301         SETTING_TRACE_BEGIN;
1302         retm_if(data == NULL, "Data parameter is NULL");
1303         Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1304         SettingAboutUG *ad = (SettingAboutUG *) list_item->userdata;
1305         SETTING_TRACE("my_number_sel_idx = %d", ad->my_number_sel_idx);
1306         elm_radio_value_set(obj, ad->my_number_sel_idx);
1307 }
1308