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