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