2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <setting-about-main.h>
19 #include <iniparser.h>
20 #include <sys/types.h>
23 #include <bluetooth-api.h>
25 #define MAX_DEVICE_NAME_LEN 24
26 #define EMPTY_LIMITATION_STR "Name cannot be empty!"
29 static int setting_about_main_create(void *cb);
30 static int setting_about_main_destroy(void *cb);
31 static int setting_about_main_update(void *cb);
32 static int setting_about_main_cleanup(void *cb);
34 setting_view setting_view_about_main = {
35 .create = setting_about_main_create,
36 .destroy = setting_about_main_destroy,
37 .update = setting_about_main_update,
38 .cleanup = setting_about_main_cleanup,
41 static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
45 static void __setting_about_main_certificates_clicked(void *data);
46 static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj);
47 static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info);
48 static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info);
49 /* ***************************************************
53 ***************************************************/
56 __setting_about_device_name_changed_cb(void *data, Evas_Object *obj,
59 retm_if(!data || !obj, "Data parameter is NULL");
60 //return if entry is not focused too
61 retm_if(!elm_object_focus_get(obj), "Entry is not focused");
63 Setting_GenGroupItem_Data *list_item =
64 (Setting_GenGroupItem_Data *) data;
65 SettingAboutUG *ad = list_item->userdata;
66 retm_if(ad == NULL, "Data parameter is NULL");
68 const char *entry_str = elm_entry_entry_get(obj);
69 int entry_len = safeStrLen(entry_str);
70 SETTING_TRACE("entry_str:[%s], lenght:%d", entry_str, entry_len);
73 G_FREE(list_item->sub_desc);//release first
74 list_item->sub_desc = (char *)g_strdup(entry_str);
76 if (NULL == entry_str || 0 == entry_len) {
79 ad->empty_flag = TRUE;
80 Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
83 Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
84 setting_disable_evas_object(back_btn);
85 setting_dim_evas_object(back_btn, TRUE);
92 ad->empty_flag = FALSE;
93 Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
96 Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
97 setting_enable_evas_object(back_btn);
98 setting_undo_dim_evas_object(back_btn, TRUE);
105 void setting_about_main_get_phonenumber(char *my_numbers[], int *my_numbers_len, int *selected_index)
108 /* Currently only have one SIM card */
109 TelSimSubscriberInfo_t subscriber;
110 TapiResult_t ret = 0;
111 ret = tel_get_sim_msisdn(&subscriber);
112 setting_retm_if(ret != TAPI_API_SUCCESS, "call tel_get_sim_msisdn failed");
114 SETTING_TRACE("num[%s]", subscriber.num);
117 if(!isEmptyStr(subscriber.num)) {
118 my_numbers[0] = (char *)g_strdup(subscriber.num);
121 SETTING_TRACE("subscriber.num is empty string");
122 my_numbers[0] = NULL;
128 - No ini: Unavailable
129 - Tizen @ target: TIZEN
132 void setting_about_main_get_phone_model_name(char* szStr, int nSize)
134 retm_if(szStr == NULL, "szStr parameter is NULL");
139 const char* szBinVer = NULL;
141 dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
143 szBinVer = (char*)iniparser_getstr(dic, "Version:Build");
145 char* str = g_strdup(szBinVer);
152 sscanf(str, "%s %s", szBin, szEmul);
158 if (!strncmp(szEmul, "emul", 4)) {
159 snprintf(szStr, nSize, "%s", "SDK");
161 if (!strncmp(szBin, "TIZEN", 5)) {
162 snprintf(szStr, nSize, "TIZEN REFERENCE");
164 snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
169 iniparser_freedict(dic);
174 void setting_about_main_get_sw_version(char* szStr, int nSize)
176 retm_if(szStr == NULL, "szStr parameter is NULL");
178 dictionary* dic = iniparser_load(SETTING_ABOUT_INFO_PATH);
180 snprintf(szStr, nSize, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
183 g_strdup((char*)iniparser_getstr(dic, "Version:Version"));
185 char* pPos = szBinVer;
187 if ('.' == *pPos) *pPos = '\0';
190 szBinVer = g_strdup(_("IDS_ST_HEADER_UNAVAILABLE"));
192 char* szBinVerMaj = g_strdup((char*)iniparser_getstr(dic, "Version:Major"));
193 char* szBinVerMin = g_strdup((char*)iniparser_getstr(dic, "Version:Minor"));
195 if (szBinVerMaj == NULL || szBinVerMaj == '\0'
196 || szBinVerMin == NULL || szBinVerMin == '\0') {
197 snprintf(szStr, nSize, "TIZEN %s", szBinVer);
199 snprintf(szStr, nSize, "TIZEN%s.%s %s", szBinVerMaj, szBinVerMin, szBinVer);
202 if (szBinVer != NULL) G_FREE(szBinVer);
203 if (szBinVerMaj != NULL) G_FREE(szBinVerMaj);
204 if (szBinVerMin != NULL) G_FREE(szBinVerMin);
208 iniparser_freedict(dic);
213 void setting_about_main_get_wifi_mac_address_string(char *str, int size)
215 setting_retm_if(str == NULL, "str parameter is NULL");
216 setting_retm_if(size < SETTING_ABOUT_WIFI_MAC_STR_LEN+1, "size parameter is wrong");
218 FILE *p = fopen(SETTING_ABOUT_MACINFO_PATH, "r");
224 fread(str, sizeof(char), SETTING_ABOUT_WIFI_MAC_STR_LEN, p);
228 perror("open failed!");
232 SETTING_TRACE_DEBUG("get_wifi_mac_address : %s", str);
234 if(safeStrLen(str) == 0)
235 snprintf(str, size, "%s (%s)", _("IDS_ST_HEADER_UNAVAILABLE"), _(SETTING_ABOUT_NEVER_TURN_WIFI_ON_STR));
243 void setting_about_main_get_battery_string(char *str, int size)
245 setting_retm_if(str == NULL, "str parameter is NULL");
248 char file[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
249 snprintf(file, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO,
250 "%s/%s/%s", SETTING_ABOUT_POWER_SUPPLY_PATH, "battery", "capacity");
252 char buf[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
256 fd = open(file, O_RDONLY);
258 r = read(fd, buf, MAX_DISPLAY_STR_LEN_ON_PHONE_INFO);
259 if ((r >= 0) && (r < MAX_DISPLAY_STR_LEN_ON_PHONE_INFO)) {
262 snprintf(str, size, "%d%s", val, "\%");
264 SETTING_TRACE_ERROR("read file fail");
265 snprintf(str, size, _("IDS_ST_HEADER_UNAVAILABLE"));
270 SETTING_TRACE_ERROR("open file fail");
271 snprintf(str, size, _("IDS_ST_HEADER_UNAVAILABLE"));
275 void setting_about_main_get_bluetooth_address_string(char *str, int size)
277 setting_retm_if(str == NULL, "str parameter is NULL");
279 bluetooth_device_address_t local_address;
280 memset(&local_address, 0x0, sizeof(local_address));
283 /* for fixing BS of dbus signal */
284 bluetooth_register_callback(NULL, NULL);
286 ret = bluetooth_get_local_address(&local_address);
288 /* for fixing BS of dbus signal */
289 bluetooth_unregister_callback();
293 snprintf(str, size, "%s", _("IDS_ST_HEADER_UNAVAILABLE"));
297 snprintf(str, size, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
298 local_address.addr[0], local_address.addr[1], local_address.addr[2],
299 local_address.addr[3], local_address.addr[4], local_address.addr[5]);
301 SETTING_TRACE_DEBUG("bt address : %s", str);
304 int __stat_get_cpuinfo(float *usr_pct, float *sys_pct)
306 setting_retvm_if(usr_pct == NULL, -ENOENT, "param usr_pct is null");
307 setting_retvm_if(sys_pct == NULL, -ENOENT, "param sys_pct is null");
312 static unsigned long long usr_time = 0, nice_time = 0, sys_time = 0;
313 static unsigned long long old_usr = 0, old_nice = 0, old_sys = 0;
314 static struct timeval old_tv, cur_tv;
315 unsigned long long elapsed_tick;
321 tick_per_sec = sysconf(_SC_CLK_TCK);
322 cpu_num = sysconf(_SC_NPROCESSORS_ONLN);
327 gettimeofday(&cur_tv, NULL);
328 fp = fopen(SETTING_ABOUT_STAT_PATH, "r");
330 SETTING_TRACE_ERROR("fp == NULL");
334 char cpu_info[MAX_COMMON_BUFFER_LEN] = {0,};
335 char *cpu_info_p = fgets(cpu_info, MAX_COMMON_BUFFER_LEN, fp);
337 if(cpu_info_p == NULL) {
338 SETTING_TRACE_ERROR("fgets failed");
339 fclose(fp); // free - code
344 unsigned long long tmp_long = 0;
346 /* split cpu_info, get 3 numbers headmost*/
347 while ((substr = strsep(&cpu_info_p, " \t")) != NULL) {
349 tmp_long = strtoull(substr, &endptr, 10);
350 if (tmp_long != 0 && tmp_long != ULLONG_MAX) {
356 nice_time = tmp_long;
375 SETTING_TRACE_ERROR("old_usr == 0");
379 elapsed_tick = (cur_tv.tv_sec - old_tv.tv_sec) * tick_per_sec +
380 ((cur_tv.tv_usec - old_tv.tv_usec) * tick_per_sec) / 1000000;
383 if (elapsed_tick != 0)
385 ((float)(usr_time - old_usr) * 100 / elapsed_tick) /
390 if (elapsed_tick != 0)
392 ((float)(sys_time - old_sys) * 100 / elapsed_tick) /
399 old_nice = nice_time;
406 static Eina_Bool __timer_update_cb(const void *data)
408 retv_if(data == NULL, TRUE);
409 SettingAboutUG *ad = (SettingAboutUG *) data;
411 char str[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
412 if (ad->item_data_cpu) {
414 int ret = __stat_get_cpuinfo(&usr, &sys);
415 if (ret == -ENOENT) {
416 SETTING_TRACE_ERROR("call __stat_get_cpuinfo fail");
417 snprintf(str, sizeof(str),
418 _("IDS_ST_HEADER_UNAVAILABLE"));
420 snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
423 ad->item_data_cpu->sub_desc = (char *)g_strdup(str);
424 elm_object_item_data_set(ad->item_data_cpu->item, ad->item_data_cpu);
425 elm_genlist_item_update(ad->item_data_cpu->item);
428 if (ad->item_data_battery) {
429 setting_about_main_get_battery_string(str, sizeof(str));
430 ad->item_data_battery->sub_desc = (char *)g_strdup(str);
431 elm_object_item_data_set(ad->item_data_battery->item, ad->item_data_battery);
432 elm_genlist_item_update(ad->item_data_battery->item);
438 __about_main_gl_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event)
441 SettingAboutUG *ad = (SettingAboutUG *) data;
442 retm_if(event == NULL, "Invalid argument: event info is NULL");
443 Evas_Event_Mouse_Up *ev = (Evas_Event_Mouse_Up *)event;
445 if (ad->item_dev_name) {
446 Elm_Object_Item *selected_item = elm_genlist_at_xy_item_get(ad->genlsit, ev->output.x, ev->output.y, NULL);
447 if (ad->empty_flag && ad->item_dev_name->item != selected_item) {
448 setting_create_popup_without_btn(ad, ad->win_get,_(EMPTY_LIMITATION_STR),
449 NULL, NULL, POPUP_INTERVAL);
454 //invoke elm_object_unfocus to trigger "unfocus" event.
455 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
456 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
462 static void __entry_unfocus_cb(void *data, Evas_Object *obj, void *event_info)
465 retm_if(!data || !obj, "Data parameter is NULL");
467 Evas_Object *entry_container = elm_object_parent_widget_get(obj);
470 elm_object_part_text_set(entry_container, "elm.guidetext", _("IDS_ST_BODY_TAP_TO_INSERT"));
472 if(elm_entry_is_empty(obj))
473 elm_object_signal_emit(entry_container, "elm,state,guidetext,show", "elm");
474 elm_object_signal_emit(entry_container, "elm,state,eraser,hide", "elm");
477 //Setting_GenGroupItem_Data *list_item = data;
478 const char *entry_str = elm_entry_entry_get(obj);
479 char *entry_str_utf8 = NULL;
480 entry_str_utf8 = elm_entry_markup_to_utf8(entry_str);
481 //int len = safeStrLen(entry_str_utf8);
482 SETTING_TRACE("To store \"%s\" into vconf[%s]", entry_str_utf8, VCONFKEY_SETAPPL_DEVICE_NAME_STR);
484 if (0 != vconf_set_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR, entry_str_utf8)) {
485 SETTING_TRACE_ERROR("Set vconf[%s] failed",
486 VCONFKEY_SETAPPL_DEVICE_NAME_STR);
489 FREE(entry_str_utf8);
493 static void __entry_key_down_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
495 ret_if(data == NULL);
496 SettingAboutUG *ad = (SettingAboutUG*)data;
497 Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info;
498 SETTING_TRACE_DEBUG("ev->key : %s", ev->key);
500 if(safeStrCmp(ev->key, "Return") == 0)
502 // if entry has 1 char at list, hide ime.
503 if(safeStrLen(elm_entry_entry_get(obj)) > 0)
505 ecore_imf_context_input_panel_hide((Ecore_IMF_Context*)elm_entry_imf_context_get(obj));
509 setting_create_popup_without_btn(ad, ad->win_get,_(EMPTY_LIMITATION_STR),
510 NULL, NULL, POPUP_INTERVAL);
515 static Eina_Bool __add_event_on_idler(void *data)
517 retv_if(data==NULL, FALSE);
519 SettingAboutUG *ad = (SettingAboutUG*)data;
521 if(ad->item_dev_name)
522 evas_object_event_callback_add(ad->item_dev_name->eo_check, EVAS_CALLBACK_KEY_DOWN, __entry_key_down_cb, ad);
524 return ECORE_CALLBACK_CANCEL;
527 static int setting_about_main_create(void *cb)
531 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
533 SettingAboutUG *ad = (SettingAboutUG *) cb;
535 Evas_Object *scroller = elm_genlist_add(ad->win_main_layout);
536 retvm_if(scroller == NULL, SETTING_DRAW_ERR_FAIL_SCROLLER,
537 "Cannot set scroller object as contento of layout");
538 elm_genlist_clear(scroller); /* first to clear list */
540 /* Enabling illume notification property for window */
541 elm_win_conformant_set(ad->win_main_layout, 1);
542 Evas_Object *conformant = elm_conformant_add(ad->win_main_layout);
543 elm_object_style_set(conformant, "internal_layout"); /* By Kollus. 2011-01-04 */
544 evas_object_show(conformant);
545 elm_object_content_set(conformant, scroller);
546 ad->genlsit = scroller;
549 setting_create_layout_navi_bar(ad->win_main_layout, ad->win_get,
550 _(KeyStr_AboutPhone),
551 _("IDS_COM_BODY_BACK"), NULL, NULL,
552 setting_about_main_click_softkey_back_cb,
553 NULL, NULL, ad, conformant,
554 &ad->navi_bar, NULL);
556 evas_object_event_callback_add(scroller, EVAS_CALLBACK_MOUSE_UP,
557 __about_main_gl_mouse_up, ad);
559 Elm_Object_Item *item = NULL;
560 Setting_GenGroupItem_Data *item_data = NULL;
561 char str[MAX_DISPLAY_STR_LEN_ON_PHONE_INFO] = { 0, };
563 (void)setting_create_Gendial_field_titleItem(scroller,
564 &(ad->itc_group_item),
565 SETTING_ABOUT_DEVICE_INFO_STR, NULL);
568 char *name_value = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
569 char *pa_sub_desc = elm_entry_utf8_to_markup(name_value);
572 ad->empty_flag = FALSE;
573 if (NULL == pa_sub_desc || '\0' == pa_sub_desc[0])
575 ad->empty_flag = TRUE;
576 Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
579 Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
580 setting_disable_evas_object(back_btn);
581 setting_dim_evas_object(back_btn, TRUE);
587 setting_create_Gendial_field_def(scroller, &(ad->itc_1icon),
588 setting_about_main_mouse_up_Gendial_list_cb,
589 ad, SWALLOW_Type_LAYOUT_ENTRY,
590 NULL, NULL, 0, SETTING_ABOUT_DEVICE_NAME_STR, pa_sub_desc,
591 __setting_about_device_name_changed_cb);
592 if (ad->item_dev_name) {
593 ad->item_dev_name->userdata = ad;
594 ad->item_dev_name->isSinglelineFlag = 1;
595 ad->item_dev_name->stop_change_cb = __entry_unfocus_cb;
596 ad->item_dev_name->limit_filter_data = calloc(1, sizeof(Elm_Entry_Filter_Accept_Set));
598 if (ad->item_dev_name->limit_filter_data) {
599 //max byte len is 31 not 31+1
600 ad->item_dev_name->limit_filter_data->max_byte_count = MAX_DEVICE_NAME_LEN;
601 ad->item_dev_name->win_main = ad->win_get;
603 ad->item_dev_name->input_panel_disable_flag = EINA_TRUE;
605 SETTING_TRACE_ERROR("ad->item_dev_name is NULL");
610 int my_numbers_len = 0;
611 setting_about_main_get_phonenumber(ad->my_numbers, &my_numbers_len, &ad->my_number_sel_idx);
612 if (my_numbers_len == 1) {
614 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2),
615 setting_about_main_mouse_up_Gendial_list_cb,
616 ad, SWALLOW_Type_INVALID, NULL,
617 NULL, 0, SETTING_ABOUT_MY_NUMBER_STR,
618 ad->my_numbers[0], NULL);
620 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
622 SETTING_TRACE_ERROR("item_data is NULL");
624 } else if (my_numbers_len > 1){
625 setting_enable_expandable_genlist(scroller, ad,
626 __setting_about_main_exp_cb, NULL);
627 item_data = setting_create_Gendial_exp_parent_field(scroller,
628 &(ad->itc_2text_3_parent),
630 SWALLOW_Type_INVALID,
631 SETTING_ABOUT_MY_NUMBER_STR,
632 ad->my_numbers[ad->my_number_sel_idx]);
635 SETTING_TRACE_ERROR("don't have my number");
638 memset(str, 0x00, sizeof(str));
639 setting_about_main_get_phone_model_name(str, sizeof(str));
641 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
642 NULL, SWALLOW_Type_INVALID, NULL,
643 NULL, 0, SETTING_ABOUT_MODEL_STR, str, NULL);
645 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
647 SETTING_TRACE_ERROR("item_data is NULL");
650 memset(str, 0x00, sizeof(str));
651 setting_about_main_get_sw_version(str, sizeof(str));
653 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
654 NULL, SWALLOW_Type_INVALID, NULL,
655 NULL, 0, SETTING_ABOUT_VERSION_STR, str, NULL);
657 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
659 SETTING_TRACE_ERROR("item_data is NULL");
662 if ( ! isEmulBin()) { // requested by DI Kim due to BT BS on 11/26
663 memset(str, 0x00, sizeof(str));
664 setting_about_main_get_bluetooth_address_string(str, sizeof(str));
666 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
667 NULL, SWALLOW_Type_INVALID, NULL,
668 NULL, 0, SETTING_ABOUT_BLUETOOTH_STR, str, NULL);
670 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
672 SETTING_TRACE_ERROR("item_data is NULL");
675 memset(str, 0x00, sizeof(str));
676 setting_about_main_get_wifi_mac_address_string(str, sizeof(str));
679 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
680 NULL, SWALLOW_Type_INVALID, NULL,
681 NULL, 0, SETTING_ABOUT_WIFI_STR, str, NULL);
683 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
685 SETTING_TRACE_ERROR("item_data is NULL");
688 memset(str, 0x00, sizeof(str));
689 setting_about_main_get_battery_string(str, sizeof(str));
691 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
692 NULL, SWALLOW_Type_INVALID, NULL,
693 NULL, 0, SETTING_ABOUT_BATTERY_STR, str, NULL);
695 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
696 ad->item_data_battery = item_data;
698 SETTING_TRACE_ERROR("item_data is NULL");
701 memset(str, 0x00, sizeof(str));
703 int ret = __stat_get_cpuinfo(&usr, &sys);
704 if (ret == -ENOENT) {
705 SETTING_TRACE_ERROR("call __stat_get_cpuinfo fail");
706 snprintf(str, sizeof(str), _("IDS_ST_HEADER_UNAVAILABLE"));
708 snprintf(str, sizeof(str), "%.0f%s", usr + sys, "\%");
711 ad->item_data_cpu = item_data =
712 setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2), NULL,
713 NULL, SWALLOW_Type_INVALID, NULL,
714 NULL, 0, SETTING_ABOUT_CPU_USAGE_STR, str, NULL);
716 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
718 SETTING_TRACE_ERROR("item_data is NULL");
722 elm_genlist_item_append(scroller, &(ad->itc_seperator), NULL, NULL,
723 ELM_GENLIST_ITEM_NONE, NULL, NULL);
724 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
726 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
727 setting_about_main_mouse_up_Gendial_list_cb,
728 ad, SWALLOW_Type_INVALID, NULL, NULL,
729 0, "IDS_ST_BODY_OPEN_SOURCE_LICENCES",
731 // implementation is in progress.
732 setting_create_Gendial_field_def(scroller, &(ad->itc_1text),
733 setting_about_main_mouse_up_Gendial_list_cb,
734 ad, SWALLOW_Type_INVALID, NULL, NULL,
735 0, "IDS_COM_BODY_CERTIFICATES", NULL, NULL);
738 ecore_timer_add(2, (Ecore_Task_Cb) __timer_update_cb, ad);
740 ecore_idler_add(__add_event_on_idler, ad);
742 setting_view_about_main.is_create = 1;
744 return SETTING_RETURN_SUCCESS;
747 static int setting_about_main_destroy(void *cb)
751 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
753 SettingAboutUG *ad = (SettingAboutUG *) cb;
755 if (ad->update_timer) {
756 ecore_timer_del(ad->update_timer);
757 ad->update_timer = NULL;
760 evas_object_del(ad->popup);
763 if (ad->progress_bar) {
764 evas_object_del(ad->progress_bar);
765 ad->progress_bar = NULL;
768 if (ad->ly_main != NULL) {
769 evas_object_del(ad->ly_main);
773 setting_view_about_main.is_create = 0;
774 return SETTING_RETURN_SUCCESS;
777 static int setting_about_main_update(void *cb)
781 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
783 SettingAboutUG *ad = (SettingAboutUG *) cb;
785 if (ad->ly_main != NULL) {
786 evas_object_show(ad->ly_main);
789 return SETTING_RETURN_SUCCESS;
792 static int setting_about_main_cleanup(void *cb)
794 return SETTING_RETURN_SUCCESS;
797 /* ***************************************************
801 ***************************************************/
803 /* ***************************************************
807 ***************************************************/
810 setting_about_main_click_softkey_back_cb(void *data, Evas_Object *obj,
815 setting_retm_if(data == NULL, "Data parameter is NULL");
817 SettingAboutUG *ad = (SettingAboutUG *) data;
818 if (ad->empty_flag) {
819 setting_create_popup_without_btn(ad, ad->win_get,_(EMPTY_LIMITATION_STR),
820 NULL, NULL, POPUP_INTERVAL);
821 if (ad->item_dev_name) {
822 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_TRUE);
827 /* Send destroy request */
828 ug_destroy_me(ad->ug);
829 //imf must be hided before view is destroyed.
830 //Following code is just to improve the hiding speed. If not add these code,
831 //the input pannel will also be hided with the view destroyed,but it works too slow.
832 if (ad->item_dev_name) {
833 elm_object_focus_set(ad->item_dev_name->eo_check, EINA_FALSE);
834 setting_hide_input_pannel_cb(ad->item_dev_name->eo_check);
848 setting_about_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
853 setting_retm_if(data == NULL, "Data parameter is NULL");
855 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
856 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
857 elm_genlist_item_selected_set(item, 0);
858 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
860 /* SettingAboutUG *ad = (SettingAboutUG *) data; */
862 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
863 if (!safeStrCmp("IDS_ST_BODY_OPEN_SOURCE_LICENCES", list_item->keyStr)) {
865 setting_view_change(&setting_view_about_main, &setting_view_about_licences, data);
867 } else if (!safeStrCmp("IDS_COM_BODY_CERTIFICATES", list_item->keyStr)) {
868 __setting_about_main_certificates_clicked(data);
869 } else if (!safeStrCmp(SETTING_ABOUT_DEVICE_NAME_STR, list_item->keyStr)) {
870 __setting_about_main_device_name_clicked(data, list_item->eo_check);
874 static void __destroy_certificates_ug_cb(struct ui_gadget *ug, void *priv)
878 /* restore the '<-' button on the navigate bar */
880 SettingAboutUG *ad = (SettingAboutUG *) priv; /* ad is point to priv */
884 ad->ug_loading = NULL;
889 static void __setting_about_main_certificates_clicked(void *data)
892 retm_if(data == NULL, "Data parameter is NULL");
893 SettingAboutUG *ad = (SettingAboutUG *)data;
895 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
900 cbs->layout_cb = setting_about_layout_ug_cb;
901 cbs->result_cb = NULL;
902 cbs->destroy_cb = __destroy_certificates_ug_cb;
903 cbs->priv = (void *)ad;
906 ug_create(ad->ug, "setting-manage-applications-efl", UG_MODE_FULLVIEW, NULL, cbs);
908 if (NULL == ad->ug_loading) { /* error handling */
909 SETTING_TRACE_ERROR("NULL == ad->ug_loading");
915 static void __setting_about_main_device_name_clicked(void *data, Evas_Object *obj)
918 retm_if(data == NULL, "Data parameter is NULL");
919 retm_if(obj == NULL, "obj parameter is NULL");
920 SettingAboutUG *ad = (SettingAboutUG *)data;
922 int mobile_ap_status = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
924 int ret = setting_get_int_slp_key(INT_SLP_SETTING_MOBILE_AP_STATUS, &mobile_ap_status, &err);
925 //setting_retm_if(ret == SETTING_RETURN_FAIL, "Get vconf failed");
927 if (!elm_object_focus_get(obj)) {
928 elm_object_focus_set(obj, EINA_TRUE);
931 if ((mobile_ap_status & VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI) && !ad->popup_showed_flag) {
933 evas_object_del(ad->popup);
936 ad->popup = setting_create_popup_with_btn(ad, ad->win_get,
937 _(SETTING_ABOUT_MOBILE_AP_TURNED_OFF),
938 NULL, __setting_about_main_mobile_ap_turn_off_ask_resp_cb, 0,
939 1, _("IDS_COM_SK_OK"));
941 Ecore_IMF_Context *imf_context = (Ecore_IMF_Context *)elm_entry_imf_context_get(obj);
942 setting_retm_if(imf_context == NULL, "imf_context is NULL");
943 ecore_imf_context_input_panel_show(imf_context);
1002 static void __setting_about_main_mobile_ap_turn_off_ask_resp_cb(void *data,
1006 SETTING_TRACE_BEGIN;
1007 setting_retm_if(data == NULL, "Data parameter is NULL");
1008 SettingAboutUG *ad = (SettingAboutUG *)data;
1009 int response_type = btn_type(obj);
1011 if (POPUP_RESPONSE_OK == response_type) {
1012 ad->popup_showed_flag = TRUE;
1013 Ecore_IMF_Context *imf_context = elm_entry_imf_context_get(ad->item_dev_name->eo_check);
1014 setting_retm_if(imf_context == NULL, "imf_context is NULL");
1015 ecore_imf_context_input_panel_show(imf_context);
1020 evas_object_del(ad->popup);
1025 static void __setting_about_main_exp_cb(void *data, Evas_Object *obj, void *event_info)
1027 SETTING_TRACE_BEGIN;
1028 setting_retm_if(data == NULL, "Data parameter is NULL");
1029 setting_retm_if(event_info == NULL, "event_info parameter is NULL");
1031 SettingAboutUG *ad = (SettingAboutUG *) data;
1032 Elm_Object_Item *parentItem = event_info; /* parent item */
1033 Evas_Object *scroller = elm_object_item_widget_get(parentItem);
1035 Evas_Object *rgd = elm_radio_add(scroller);
1036 elm_radio_value_set(rgd, -1);
1039 Setting_GenGroupItem_Data *item_data = NULL;
1040 for(; i < SETTING_ABOUT_MY_NUMBERS_LEN; i++) {
1041 if (ad->my_numbers[i] == NULL) {
1045 item_data = setting_create_Gendial_exp_sub_field(scroller,
1046 &(ad->itc_1icon_1text_sub),
1047 NULL, NULL, parentItem,
1048 SWALLOW_Type_1RADIO, rgd,
1050 ad->my_numbers[i], __setting_about_sub_list_rd_change);
1052 item_data->userdata = ad;
1053 elm_genlist_item_select_mode_set(item_data->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
1055 SETTING_TRACE_ERROR("item_data is NULL");
1058 elm_radio_value_set(rgd, ad->my_number_sel_idx);
1061 static void __setting_about_sub_list_rd_change(void *data, Evas_Object *obj, void *event_info) {
1062 SETTING_TRACE_BEGIN;
1063 retm_if(data == NULL, "Data parameter is NULL");
1064 Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
1065 SettingAboutUG *ad = (SettingAboutUG *) list_item->userdata;
1066 SETTING_TRACE("my_number_sel_idx = %d", ad->my_number_sel_idx);
1067 elm_radio_value_set(obj, ad->my_number_sel_idx);