4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 *@defgroup setting-phone
24 *UG creation code for setting-phone
27 * - event notification
32 #include <setting-phone.h>
33 #include <libxml/xmlmemory.h>
34 #include "unicode/unum.h"
35 #include <iniparser.h>
37 #include <setting-cfg.h>
39 #include <eventsystem.h>
42 #define UG_MODULE_API __attribute__ ((visibility("default")))
45 #define SETTING_PHONE_EDJ_PATH EDJDIR
46 #define SETTING_PHONE_GENLIST_EDJ_NAME SETTING_PHONE_EDJ_PATH"/setting-genlist.edj"
49 setting_view *__get_phone_view_to_load(app_control_h service)
53 char *viewtype = NULL;
54 app_control_get_extra_data(service, "viewtype", &viewtype);
59 SETTING_TRACE("viewtype:%s", viewtype);
61 if (!safeStrCmp(viewtype, "language")) {
64 app_control_get_extra_data(service, "caller", &caller);
66 setting_view_node_table_register(&setting_view_phone_display_language, NULL);
69 return &setting_view_phone_display_language;
71 setting_view_node_table_register(&setting_view_phone_language_region, NULL);
72 setting_view_node_table_register(&setting_view_phone_display_language,
73 &setting_view_phone_language_region);
74 setting_view_node_table_register(&setting_view_phone_region_format,
75 &setting_view_phone_language_region);
77 return &setting_view_phone_language_region;
79 } else if (!safeStrCmp(viewtype, "license")) {
80 setting_view_node_table_register(&setting_view_phone_license_main, NULL);
82 return &setting_view_phone_license_main;
84 #ifdef ENABLE_TICKER_NOTI
85 else if (!safeStrCmp(viewtype, "notification")) {
86 setting_view_node_table_register(&setting_view_phone_ticker_notification, NULL);
87 setting_view_node_table_register(&setting_view_phone_ticker_notification_details, &setting_view_phone_ticker_notification);
89 return &setting_view_phone_ticker_notification;
92 else if (!safeStrCmp(viewtype, "region")) {
93 setting_view_node_table_register(&setting_view_phone_region_format, NULL);
95 return &setting_view_phone_region_format;
98 return NULL; /* &setting_view_phone_main; */
102 Evas_Object *__get_phone_layout_to_return(app_control_h service, void *priv)
105 SettingPhoneUG *phoneUG = priv;
106 char *viewtype = NULL;
108 app_control_get_extra_data(service, "viewtype", &viewtype);
112 SETTING_TRACE("viewtype:%s", viewtype);
114 if (!safeStrCmp(viewtype, "language")) {
116 return phoneUG->ly_language;
117 } else if (!safeStrCmp(viewtype, "license")) {
119 return phoneUG->ly_license;
120 } else if (!safeStrCmp(viewtype, "notification")) {
122 return phoneUG->ly_ticker;
123 } else if (!safeStrCmp(viewtype, "region")) {
125 return phoneUG->ly_region;
128 return NULL; /* &setting_view_phone_main; */
134 const char *get_language_by_mobile_country_code(char *mcc)
136 const char *simLanguage = NULL;
137 char temp[128] = {0,};
138 Eina_List *elist = NULL;
139 setting_lang_entry *pnode = NULL;
140 Eina_List *langlist = setting_get_language_list();
142 EINA_LIST_FOREACH(langlist, elist, pnode) {
143 if (strstr(pnode->mcc, mcc) != NULL) {
144 snprintf(temp, 127, "%s.UTF-8", pnode->locale);
148 if (safeStrLen(temp) > 0) {
149 simLanguage = (char *)strdup(temp);
150 SETTING_TRACE_DEBUG("simLanguage: %s", simLanguage);
157 static void setting_phone_update_item(void *data)
159 setting_retm_if(data == NULL, "data is NULL");
160 SettingPhoneUG *ad = (SettingPhoneUG *) data;
162 Setting_GenGroupItem_Data *item_to_update = NULL;
164 item_to_update = ad->data_display_language;
165 retm_if(!item_to_update, "ad->data_display_language is NULL");
167 if (item_to_update) {
168 item_to_update->sub_desc = get_pa_display_language_str();
169 elm_object_item_data_set(item_to_update->item, item_to_update);
170 elm_genlist_item_update(item_to_update->item);
173 char *pa_region = vconf_get_str(VCONFKEY_REGIONFORMAT);
174 if (pa_region == NULL) {
176 ("[Error] get value of VCONFKEY_REGIONFORMAT fail.");
180 item_to_update = ad->data_region_fmt;
181 retm_if(!item_to_update, "ad->data_region_fmt is NULL");
183 if (item_to_update) {
184 int region_automatic = 1;
185 int ret = vconf_get_bool(VCONFKEY_SETAPPL_REGION_AUTOMATIC_BOOL, ®ion_automatic);
186 if (ret == VCONF_ERROR) {
187 SETTING_TRACE_ERROR("get vconf region automatic err.");
190 if (region_automatic == 1) {
191 item_to_update->sub_desc = (char *)g_strdup(_("IDS_ST_BODY_ANSWERINGMODE_AUTOMATIC"));
193 item_to_update->sub_desc = setting_phone_lang_get_region_str(pa_region);
195 item_to_update->keyStr = (char *)g_strdup(_(REGION_FORMAT_LOWER));
196 elm_object_item_data_set(item_to_update->item, item_to_update);
197 elm_genlist_item_update(item_to_update->item);
200 if (ad->data_region_fmt_example) {
203 setting_phone_lang_get_example_desc(pa_region, ad);
204 ad->data_region_fmt_example->keyStr =
205 (char *)g_strdup(example_desc);
207 elm_object_item_data_set(ad->data_region_fmt_example->item, ad->data_region_fmt_example);
208 elm_genlist_item_update(ad->data_region_fmt_example->item);
214 char *setting_phone_lang_get_region_str(const char *region)
217 setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
218 const char *localeID = NULL;
219 UChar displayname[SETTING_STR_SLP_LEN] = { 0, };
220 UErrorCode status = U_ZERO_ERROR;
221 char *ret_str = NULL;
223 const char *pa_lang = vconf_get_str(VCONFKEY_LANGSET);
225 char *q = strchr(pa_lang, '.');
229 SETTING_TRACE("pa_lang:%s", pa_lang);
231 uloc_setDefault(pa_lang, &err);
232 free((void *)pa_lang);
235 SETTING_TRACE_ERROR("get vconf failed");
238 localeID = uloc_getDefault();
239 uloc_getDisplayName(region, localeID, displayname, SETTING_STR_SLP_LEN,
242 char *str_displayname = setting_phone_lang_str_to_utf8(displayname);
243 if (str_displayname == NULL) {
244 SETTING_TRACE("Get displayname in utf8 failed");
249 char source[256] = {0,};
250 UChar dest[256] = {0,};
251 if (strlen(str_displayname) < 256) {
252 strcpy(source, str_displayname);
254 FREE(str_displayname);
257 u_strFromUTF8(dest, 256, &len, source, 256, &errcode);
258 u_strToUpper(dest, 1, dest, 1, "", &errcode);
259 u_strToUTF8(source, 256, NULL, dest, 256, &errcode);
260 ret_str = (char *)g_strdup(source);
262 FREE(str_displayname);
267 * Change language string to UTF8 format, the invoker need to free the return string
269 * @param unichars The source string will be translated.
271 * @return UTF8 format string.
273 char *setting_phone_lang_str_to_utf8(const UChar *unichars)
275 retv_if(unichars == NULL, NULL);
280 UErrorCode status = U_ZERO_ERROR;
282 len = u_strlen(unichars);
283 len_str = sizeof(char)*4*(len+1);
284 str = (char *)calloc(1, len_str);
289 u_strToUTF8(str, len_str, &len_utf8, unichars, len, &status);
293 char *setting_phone_lang_get_by_pattern(const char *locale, const char *skeleton, void *data)
295 setting_retvm_if(!locale, NULL, "locale parameter is NULL");
296 setting_retvm_if(data == NULL, NULL, "Data parameter is NULL");
298 SettingPhoneUG *ad = (SettingPhoneUG *) data;
300 /*remove ".UTF-8" in locale */
301 char locale_tmp[32] = {0,};
302 if (strlen(locale) < 32) {
303 strcpy(locale_tmp, locale);
307 char *p = safeStrStr(locale_tmp, ".UTF-8");
312 char *ret_str = NULL;
313 UChar customSkeleton[SETTING_STR_SLP_LEN] = { 0, };
314 UErrorCode status = U_ZERO_ERROR;
315 UDateFormat *formatter = NULL;
317 UChar bestPattern[SETTING_STR_SLP_LEN] = { 0, };
318 UChar formatted[SETTING_STR_SLP_LEN] = { 0, };
320 char bestPatternString[SETTING_STR_SLP_LEN] = { 0, };
321 char formattedString[SETTING_STR_SLP_LEN] = { 0, };
323 u_uastrncpy(customSkeleton, skeleton, safeStrLen(skeleton));
325 if (ad->pattern_generator == NULL
326 || safeStrCmp(locale_tmp, ad->prev_locale) != 0) {
327 if (ad->pattern_generator != NULL) {
328 udatpg_close(ad->pattern_generator);
329 ad->pattern_generator = NULL;
331 ad->pattern_generator = udatpg_open(locale_tmp, &status);
334 int32_t bestPatternCapacity =
335 (int32_t)(sizeof(bestPattern) / sizeof((bestPattern)[0]));
336 (void)udatpg_getBestPattern(ad->pattern_generator, customSkeleton,
337 u_strlen(customSkeleton), bestPattern,
338 bestPatternCapacity, &status);
340 u_austrcpy(bestPatternString, bestPattern);
341 SETTING_TRACE("BestPattern is %s", bestPatternString);
343 UDate date = ucal_getNow();
345 udat_open(UDAT_IGNORE, UDAT_IGNORE, locale_tmp, NULL, -1, bestPattern,
347 int32_t formattedCapacity =
348 (int32_t)(sizeof(formatted) / sizeof((formatted)[0]));
349 (void)udat_format(formatter, date, formatted, formattedCapacity, NULL,
351 u_austrcpy(formattedString, formatted);
352 SETTING_TRACE("DATE & TIME is %s", formattedString);
354 udat_close(formatter);
356 ret_str = g_strdup(formattedString);
361 static char *__setting_phone_number_format_get(const char *region)
364 setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
365 UNumberFormat *fmt = NULL;
366 UErrorCode status = U_ZERO_ERROR;
367 char decimal[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
368 char separator[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
370 char separator_ch = 0;
371 UChar u_decimal[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
372 UChar u_thousand[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
373 fmt = unum_open(UNUM_DEFAULT, NULL, -1, region, NULL, &status);
374 unum_getSymbol(fmt, UNUM_DECIMAL_SEPARATOR_SYMBOL, u_decimal, MAX_DISPLAY_NAME_LEN_ON_UI, &status);
375 u_austrcpy(decimal, u_decimal);
376 unum_getSymbol(fmt, UNUM_GROUPING_SEPARATOR_SYMBOL, u_thousand, MAX_DISPLAY_NAME_LEN_ON_UI, &status);
377 u_austrcpy(separator, u_thousand);
379 int len_seq = safeStrLen(separator);
380 decimal_ch = decimal[0];
381 separator_ch = separator[0];
382 if (len_seq == 2 || len_seq == 0) {
385 if (len_seq == 3 && !safeStrCmp(separator, "\xe2\x80\x99")) {
389 len_seq = safeStrLen(decimal);
390 if (len_seq == 2 || len_seq == 0) {
393 SETTING_TRACE("separator, decimal = %c, %c", separator_ch, decimal_ch);
398 char loc_number[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
399 snprintf(loc_number, sizeof(loc_number), "1%c234%c567%c89", separator_ch, separator_ch, decimal_ch);
400 SETTING_TRACE("loc_number = %s", loc_number);
401 return g_strdup(loc_number); /* should be freed by caller */
407 static char *__setting_phone_number_format_get(const char *region)
409 setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
410 UNumberFormat *fmt = NULL;
411 UErrorCode status = U_ZERO_ERROR;
412 UChar number_uchar[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
413 char number_char[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
414 double example_number = 1234567.89;
416 fmt = unum_open(UNUM_DEFAULT, NULL, -1, region, NULL, &status);
417 unum_formatDouble(fmt, example_number, number_uchar, MAX_DISPLAY_NAME_LEN_ON_UI, NULL, &status);
418 u_austrcpy(number_char, number_uchar);
419 SETTING_TRACE("number_char = %s", number_char);
422 return g_strdup(number_char); /* should be freed by caller */
427 static char *__setting_phone_number_format_get(const char *region)
430 struct lconv *locale = NULL;
431 char *decimal = NULL;
432 char *separator = NULL;
434 char separator_ch = 0;
436 locale = localeconv();
437 SETTING_TRACE("check localeconv");
438 decimal = locale->decimal_point;
439 separator = locale->thousands_sep;
440 int len_seq = safeStrLen(separator);
441 decimal_ch = decimal[0];
442 separator_ch = separator[0];
443 if (len_seq == 2 || len_seq == 0) {
446 SETTING_TRACE("separator, decimal = %c, %c", separator_ch, decimal_ch);
449 char loc_number[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
450 snprintf(loc_number, sizeof(loc_number), "1%c234%c567%c89", separator_ch, separator_ch, decimal_ch);
451 SETTING_TRACE("loc_number = %s", loc_number);
452 return g_strdup(loc_number); /* should be freed by caller */
456 char *setting_phone_lang_get_example_desc(const char *region, void *data)
458 setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
459 setting_retvm_if(data == NULL, NULL, "Data parameter is NULL");
460 char *date = setting_phone_lang_get_by_pattern(region,
461 UDAT_YEAR_MONTH_WEEKDAY_DAY,
464 enum appcore_time_format timeformat = APPCORE_TIME_FORMAT_12;
465 int ret = appcore_get_timeformat(&timeformat);
467 SETTING_TRACE_ERROR("call appcore_get_timeformat fail.");
468 timeformat = APPCORE_TIME_FORMAT_12;
471 char *time_skeleton = "hhmm";
472 if (timeformat == APPCORE_TIME_FORMAT_24) {
473 time_skeleton = "HHmm";
476 /*char *region_jp = vconf_get_str(VCONFKEY_REGIONFORMAT); */
479 /*if (safeStrStr(region_jp, "ja_JP") == NULL) { */
480 time = setting_phone_lang_get_by_pattern(region, time_skeleton, data);
482 time = setting_phone_lang_get_by_pattern("en_GB.UTF-8", time_skeleton, data);
485 char *number = __setting_phone_number_format_get(region);
487 Eina_Strbuf *temp_str = eina_strbuf_new();
488 char *r_str_text = NULL;
489 eina_strbuf_append_printf(temp_str,
490 "%s", _("IDS_ST_BODY_REGIONAL_EXAMPLE"));
491 eina_strbuf_append_printf(temp_str, "<br>%s : %s", _("IDS_ST_BODY_DATE"), date);
492 eina_strbuf_append_printf(temp_str, "<br>%s : %s", _("IDS_ST_HEADER_TIME"), time);
493 eina_strbuf_append_printf(temp_str, "<br>%s : %s", _("IDS_ST_BODY_NUMBER"), number);
495 SETTING_TRACE("temp_str: %s", temp_str);
496 r_str_text = eina_strbuf_string_steal(temp_str);
497 /* eina_strbuf_string_free(temp_str); */
498 eina_strbuf_free(temp_str);
499 SETTING_TRACE("r_str_text: %s", r_str_text);
504 return r_str_text; /* will be freed in calling place */
508 static void setting_phone_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
511 SettingPhoneUG *ad = (SettingPhoneUG *) data;
512 /* setting_view_update(&setting_view_about_main, ad); */
513 setting_view_update(ad->view_to_load, ad);
516 static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
517 app_control_h service, void *priv)
519 setting_retvm_if((!priv), NULL, "!priv");
521 SettingPhoneUG *phoneUG = priv;
524 phoneUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
525 phoneUG->win_get = (Evas_Object *) ug_get_window();
526 evas_object_show(phoneUG->win_main_layout);
527 phoneUG->evas = evas_object_evas_get(phoneUG->win_main_layout);
529 setting_retvm_if(phoneUG->win_main_layout == NULL, NULL,
530 "cannot get main window ");
532 /* --------------------------------------------------------- */
533 char *pa_path = NULL;;
535 /*elm_theme_extension_add(NULL, SETTING_PHONE_GENLIST_EDJ_NAME); */
537 pa_path = vconf_get_str(VCONFKEY_LANGSET);
540 ("%s*** language setting has no proper value (nil) ***%s",
541 SETTING_FONT_BGREEN, SETTING_FONT_BLACK);
545 bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
547 /* --------------------------------------------------------- */
550 int ret = setting_get_int_slp_key(INT_SLP_SETTING_SIM_SLOT, &value, &err);
552 SETTING_TRACE("fail to get vconf");
554 if (value == VCONFKEY_TELEPHONY_SIM_INSERTED) {
555 phoneUG->handle = tel_init(NULL);
556 SETTING_TRACE("phoneUG->handle:%d", phoneUG->handle);
557 memset(&(phoneUG->imsi), 0, sizeof(TelSimImsiInfo_t));
559 && TAPI_API_SUCCESS == tel_get_sim_imsi(phoneUG->handle, &(phoneUG->imsi))) {
560 SETTING_TRACE_SECURE_DEBUG("********************************************");
561 SETTING_TRACE_SECURE_DEBUG("imsi.szMcc: [%s]", phoneUG->imsi.szMcc);
562 SETTING_TRACE_SECURE_DEBUG("imsi.szMnc: [%s]", phoneUG->imsi.szMnc);
563 SETTING_TRACE_SECURE_DEBUG("imsi.szMsin: [%s]", phoneUG->imsi.szMsin);
564 SETTING_TRACE_SECURE_DEBUG("********************************************");
566 phoneUG->sim_lang = get_language_by_mobile_country_code(phoneUG->imsi.szMcc);
569 if (!phoneUG->sim_lang) {
570 /* if CSC has updated configuration for setting, initial vconf value changes. */
571 phoneUG->sim_lang = vconf_get_str(VCONFKEY_LANGSET); /* allocated */
573 SETTING_TRACE("sim_lang: [%s]", phoneUG->sim_lang);
575 /* register view node table */
576 setting_view_node_table_intialize();
578 setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_1icon_2));
579 setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_1icon));
581 /* 2 text - genlist > items */
582 setting_create_Gendial_itc("dialogue/2text", &(phoneUG->itc_1icon_2text));
584 setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_tb));
585 setting_create_Gendial_itc("1line", &(phoneUG->itc_1text));
586 setting_create_Gendial_itc("2line.top", &(phoneUG->itc_2text_3_parent));
587 setting_create_Gendial_itc("1line", &(phoneUG->itc_1icon_1text_sub));
590 setting_create_Gendial_itc("2line.top", &(phoneUG->itc_2text_2));
591 setting_create_Gendial_itc("multiline/1text",
592 &(phoneUG->itc_bg_1icon));
593 phoneUG->pattern_generator = NULL;
594 phoneUG->prev_locale = NULL;
595 /* creating a view. */
596 phoneUG->bundle_data = service;
597 phoneUG->view_to_load = __get_phone_view_to_load(service);
598 setting_retvm_if(NULL == phoneUG->view_to_load, NULL,
599 "NULL == phoneUG->view_to_load");
600 setting_view_node_set_cur_view(phoneUG->view_to_load);
601 setting_view_create(phoneUG->view_to_load, (void *)phoneUG);
602 evas_object_event_callback_add(phoneUG->win_main_layout,
603 EVAS_CALLBACK_RESIZE,
604 setting_phone_ug_cb_resize, phoneUG);
605 return __get_phone_layout_to_return(service, phoneUG);
608 static void setting_phone_ug_on_start(ui_gadget_h ug, app_control_h service,
613 static void setting_phone_ug_on_pause(ui_gadget_h ug, app_control_h service,
618 static void setting_phone_ug_on_resume(ui_gadget_h ug, app_control_h service,
623 SettingPhoneUG *phoneUG = priv;
625 Eina_Bool is_freezed = evas_object_freeze_events_get(phoneUG->navi_bar);
626 SETTING_TRACE_DEBUG("is_freezed : %d", is_freezed);
628 evas_object_freeze_events_set(phoneUG->navi_bar, EINA_FALSE);
631 static void setting_phone_ug_on_destroy(ui_gadget_h ug, app_control_h service,
635 setting_retm_if((!ug || !priv), "!ug || !priv");
636 SettingPhoneUG *phoneUG = priv;
638 evas_object_event_callback_del(phoneUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_phone_ug_cb_resize); /* fix flash issue for gallery */
641 if (phoneUG->handle && tel_deinit(phoneUG->handle) != TAPI_API_SUCCESS) {
642 SETTING_TRACE_ERROR("tel_deinit failed");
644 /* called when this shared gadget is terminated. similar with app_exit */
645 if (&setting_view_phone_language_region == phoneUG->view_to_load) {
646 setting_view_destroy(&setting_view_phone_display_language,
648 setting_view_destroy(&setting_view_phone_region_format,
650 setting_view_destroy(&setting_view_phone_language_region, phoneUG);
652 #ifdef ENABLE_TICKER_NOTI
653 else if (&setting_view_phone_ticker_notification ==
654 phoneUG->view_to_load) {
655 setting_view_destroy(&setting_view_phone_ticker_notification,
657 setting_view_destroy(&setting_view_phone_ticker_notification_details, phoneUG);
661 else if (&setting_view_phone_license_main == phoneUG->view_to_load) {
662 setting_view_destroy(&setting_view_phone_license_main, phoneUG);
665 FREE(phoneUG->sim_lang);
667 if (NULL != ug_get_layout(phoneUG->ug)) {
668 evas_object_hide((Evas_Object *) ug_get_layout(phoneUG->ug));
669 evas_object_del((Evas_Object *) ug_get_layout(phoneUG->ug));
675 static void setting_phone_ug_on_message(ui_gadget_h ug, app_control_h msg,
676 app_control_h service, void *priv)
679 setting_retm_if(NULL == priv, "priv is NULL");
680 char *pid_str = NULL;
682 app_control_get_extra_data(msg, "DEADPID", &pid_str);
685 int pid = (int)g_ascii_strtod(pid_str, NULL);
686 SETTING_TRACE_DEBUG("pid = %d", pid);
687 setting_retm_if(errno == ERANGE, "call g_ascii_strtod fail");
689 int ret = app_terminate_dead_cb(pid, priv);
690 setting_retm_if(ret != 0, "call app_terminate_dead_cb fail");
694 static void setting_phone_ug_on_event(ui_gadget_h ug, enum ug_event event,
695 app_control_h service, void *priv)
699 SettingPhoneUG *ad = (SettingPhoneUG *) priv;
701 case UG_EVENT_LOW_MEMORY:
703 case UG_EVENT_LOW_BATTERY:
705 case UG_EVENT_REGION_CHANGE: {
706 if (ad->gl_lang_region && setting_view_phone_language_region.is_create) {
707 elm_genlist_realized_items_update(ad->gl_lang_region);
708 setting_phone_update_item(ad);
712 case UG_EVENT_LANG_CHANGE: {
713 ad->lang_change = EINA_TRUE;
715 if (ad->gl_lang_region && setting_view_phone_language_region.is_create) {
716 elm_genlist_realized_items_update(ad->gl_lang_region);
717 setting_phone_update_item(ad);
720 setting_navi_items_update(ad->navi_bar);
724 case UG_EVENT_ROTATE_PORTRAIT:
726 case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
728 case UG_EVENT_ROTATE_LANDSCAPE:
730 case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
737 static void setting_phone_ug_on_key_event(ui_gadget_h ug,
738 enum ug_key_event event,
739 app_control_h service, void *priv)
742 SettingPhoneUG *ad = (SettingPhoneUG *) priv;
744 SETTING_TRACE("event:%d", event);
746 case UG_KEY_EVENT_END: {
747 if (elm_naviframe_top_item_get(ad->navi_bar) ==
748 elm_naviframe_bottom_item_get(ad->navi_bar)) {
751 setting_view_cb_at_endKey(ad);
760 UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
763 SettingPhoneUG *phoneUG = calloc(1, sizeof(SettingPhoneUG));
764 setting_retvm_if(!phoneUG, -1, "Create SettingPhoneUG obj failed");
766 ops->create = setting_phone_ug_on_create;
767 ops->start = setting_phone_ug_on_start;
768 ops->pause = setting_phone_ug_on_pause;
769 ops->resume = setting_phone_ug_on_resume;
770 ops->destroy = setting_phone_ug_on_destroy;
771 ops->message = setting_phone_ug_on_message;
772 ops->event = setting_phone_ug_on_event;
773 ops->key_event = setting_phone_ug_on_key_event;
775 ops->opt = UG_OPT_INDICATOR_ENABLE;
780 UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
783 struct SettingPhoneUG *phoneUG;
784 setting_retm_if(!ops, "ops == NULL");
792 /************* n-depth search **************/
793 static Setting_Cfg_Node_T s_cfg_node_array[] = {
794 {"IDS_ST_HEADER_DISPLAY_LANGUAGE", NULL, "viewtype:language;caller:setting", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
795 {"IDS_ST_BODY_REGION", NULL, "viewtype:region", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
796 {"IDS_ST_BODY_KEYBOARD", NULL, "viewtype:language", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
800 UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, char **applocale)
803 SETTING_TRACE(">> setting-phone-efl DB search code");
804 setting_retvm_if(!priv || !applocale, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, "pplist/applocale is NULL");
806 *applocale = strdup("setting:/usr/apps/org.tizen.setting/res/locale");
808 Eina_List **pplist = (Eina_List **)priv;
810 int size = sizeof(s_cfg_node_array) / sizeof(s_cfg_node_array[0]);
811 for (i = 0; i < size; i++) {
812 Setting_Cfg_Node_T *node = setting_plugin_search_item_subindex_add(s_cfg_node_array[i].key_name, s_cfg_node_array[i].ug_args, IMG_LanguageInput, s_cfg_node_array[i].item_type, s_cfg_node_array[i].data, "Language and Region");
813 *pplist = eina_list_append(*pplist, node);
818 void set_language_helper(char *lang)
820 int ret = vconf_set_str(VCONFKEY_LANGSET, lang);
823 /* set event system */
824 setting_set_event_system(SYS_EVENT_LANGUAGE_SET,
825 EVT_KEY_LANGUAGE_SET,
831 int set_regionformat_helper(char *region)
834 int ret = vconf_set_str(VCONFKEY_REGIONFORMAT, region);
836 /* set event system */
837 setting_set_event_system(SYS_EVENT_REGION_FORMAT,
838 EVT_KEY_REGION_FORMAT,