tizen 2.3 release
[apps/home/settings.git] / setting-phone / src / setting-phone.c
index 4542225..86da824 100755 (executable)
@@ -1,18 +1,22 @@
 /*
  * setting
- * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * Licensed under the Flora License, Version 1.1 (the License);
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *     http://floralicense.org/license/
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
+ * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
+ *
  */
 
 /**
 #include <libxml/xmlmemory.h>
 #include <Ecore_X.h>
 #include "unicode/unum.h"
+#include <iniparser.h>
+#include <locale.h>
+#include <setting-cfg.h>
+
 
 #ifndef UG_MODULE_API
 #define UG_MODULE_API __attribute__ ((visibility("default")))
 #endif
 
-setting_view *__get_phone_view_to_load(service_h service)
+#define SETTING_PHONE_EDJ_PATH         EDJDIR
+#define SETTING_PHONE_GENLIST_EDJ_NAME SETTING_PHONE_EDJ_PATH"/setting-genlist.edj"
+
+
+setting_view *__get_phone_view_to_load(app_control_h service)
 {
        SETTING_TRACE_BEGIN;
 
        char *viewtype = NULL;
-
-       service_get_extra_data(service, "viewtype", &viewtype);
-       if(!viewtype)
+       app_control_get_extra_data(service, "viewtype", &viewtype);
+       if(!viewtype){
                return NULL;
+       }
 
        SETTING_TRACE("viewtype:%s", viewtype);
 
        if (!safeStrCmp(viewtype, "language")) {
                char *caller = NULL;
 
-               service_get_extra_data(service, "caller", &caller);
+               app_control_get_extra_data(service, "caller", &caller);
                if (caller) {
                        setting_view_node_table_register(&setting_view_phone_display_language, NULL);
+                       FREE(viewtype);
+                       FREE(caller);
                        return &setting_view_phone_display_language;
                } else {
                        setting_view_node_table_register(&setting_view_phone_language_region, NULL);
@@ -59,87 +73,86 @@ setting_view *__get_phone_view_to_load(service_h service)
                                                         &setting_view_phone_language_region);
                        setting_view_node_table_register(&setting_view_phone_region_format,
                                                         &setting_view_phone_language_region);
-
+                       FREE(viewtype);
                        return &setting_view_phone_language_region;
                }
+       } else if (!safeStrCmp(viewtype, "license")) {
+               setting_view_node_table_register(&setting_view_phone_license_main, NULL);
+               FREE(viewtype);
+               return &setting_view_phone_license_main;
+       }
+       #ifdef ENABLE_TICKER_NOTI
+       else if (!safeStrCmp(viewtype, "notification")) {
+               setting_view_node_table_register(&setting_view_phone_ticker_notification, NULL);
+               setting_view_node_table_register(&setting_view_phone_ticker_notification_details, &setting_view_phone_ticker_notification);
+               FREE(viewtype);
+               return &setting_view_phone_ticker_notification;
+       }
+       #endif
+       else if (!safeStrCmp(viewtype, "region")) {
+               setting_view_node_table_register(&setting_view_phone_region_format, NULL);
+               FREE(viewtype);
+               return &setting_view_phone_region_format;
        } else {
+               FREE(viewtype);
                return NULL;    /* &setting_view_phone_main; */
        }
 }
 
-Evas_Object *__get_phone_layout_to_return(service_h service, void *priv)
+Evas_Object *__get_phone_layout_to_return(app_control_h service, void *priv)
 {
        SETTING_TRACE_BEGIN;
        SettingPhoneUG *phoneUG = priv;
        char *viewtype = NULL;
 
-       service_get_extra_data(service, "viewtype", &viewtype);
-       if(!viewtype)
+       app_control_get_extra_data(service, "viewtype", &viewtype);
+       if(!viewtype) {
                return NULL;
+       }
        SETTING_TRACE("viewtype:%s", viewtype);
 
        if (!safeStrCmp(viewtype, "language")) {
+               FREE(viewtype);
                return phoneUG->ly_language;
+       } else if (!safeStrCmp(viewtype, "license")) {
+               FREE(viewtype);
+               return phoneUG->ly_license;
+       } else if (!safeStrCmp(viewtype, "notification")) {
+               FREE(viewtype);
+               return phoneUG->ly_ticker;
+       } else if (!safeStrCmp(viewtype, "region")) {
+               FREE(viewtype);
+               return phoneUG->ly_region;
        } else {
+               FREE(viewtype);
                return NULL;    /* &setting_view_phone_main; */
        }
 
 }
 
 
-const char *get_language_by_mobile_country_code(int mcc)
+const char *get_language_by_mobile_country_code(char *mcc)
 {
        const char *simLanguage = NULL;
+       char temp[128] = {0,};
+       Eina_List* elist = NULL;
+       setting_lang_entry* pnode = NULL;
+       Eina_List* langlist = setting_get_language_list();
 
-       switch (mcc) {
-       case 262:               /* GERMAN */
-               simLanguage = "de_DE.UTF-8";
-               break;
-       case 204:               /* DUTCH */
-               simLanguage = "nl_NL.UTF-8";
-               break;
-       case 214:               /* SPAINISH */
-               simLanguage = "es_ES.UTF-8";
-               break;
-       case 268:               /* PORTUGUESE */
-               simLanguage = "pt_PT.UTF-8";
-               break;
-       case 202:               /* GREEK */
-               simLanguage = "el_GR.UTF-8";
-               break;
-       case 222:               /* ITALIAN */
-               simLanguage = "it_IT.UTF-8";
-               break;
-       case 208:               /* FRENCH */
-               simLanguage = "fr_FR.UTF-8";
-               break;
-       case 286:               /* TURKISH */
-               simLanguage = "tr_TR.UTF-8";
-               break;
-       case 450:               /* KOREAN */
-               simLanguage = "ko_KR.UTF-8";
-               break;
-       case 440:               /* JAPAN */
-               simLanguage = "ja_JP.UTF-8";
-               break;
-       case 460:               /* CHINA */
-               simLanguage = "zh_CN.UTF-8";
-               break;
-       case 454:               /* CANTONESE */
-               simLanguage = "zh_HK.UTF-8";
-               break;
-       case 466:               /* TAIWAN */
-               simLanguage = "zh_TW.UTF-8";
-               break;
-       case 250:               /* RUSSIAN */
-               simLanguage = "ru_RU.UTF-8";
-               break;
-       default:                /* get value from db/menu_widget/language at vconf */
-               simLanguage = "en_US.UTF-8";
-               break;
+       EINA_LIST_FOREACH( langlist, elist, pnode) {
+               if(strstr(pnode->mcc, mcc) != NULL)
+               {
+                       snprintf(temp, 127, "%s.UTF-8", pnode->locale);
+               }
+       }
+
+       if(safeStrLen(temp) > 0)
+       {
+               simLanguage = (char*)strdup(temp);
+               SETTING_TRACE_DEBUG("simLanguage: %s", simLanguage);
        }
-       return simLanguage;
 
+       return simLanguage;
 }
 
 
@@ -170,12 +183,25 @@ static void setting_phone_update_item(void *data)
        retm_if (!item_to_update, "ad->data_region_fmt is NULL");
 
        if (item_to_update) {
-               item_to_update->sub_desc = setting_phone_lang_get_region_str(pa_region);
+               int region_automatic = 1;
+               int ret = vconf_get_bool(VCONFKEY_SETAPPL_REGION_AUTOMATIC_BOOL, &region_automatic);
+               if (ret == VCONF_ERROR) {
+                       SETTING_TRACE_ERROR("get vconf region automatic err.");
+               }
+
+               if(region_automatic == 1)
+               {
+                       item_to_update->sub_desc = (char*)g_strdup(_("IDS_COM_BODY_AUTOMATIC"));
+               } else {
+                       item_to_update->sub_desc = setting_phone_lang_get_region_str(pa_region);
+               }
+               item_to_update->keyStr = (char*)g_strdup(_(REGION_FORMAT_LOWER));
                elm_object_item_data_set(item_to_update->item, item_to_update);
                elm_genlist_item_update(item_to_update->item);
        }
 
        if (ad->data_region_fmt_example) {
+
                char *example_desc =
                    setting_phone_lang_get_example_desc(pa_region, ad);
                ad->data_region_fmt_example->keyStr =
@@ -185,13 +211,7 @@ static void setting_phone_update_item(void *data)
                elm_genlist_item_update(ad->data_region_fmt_example->item);
        }
 
-#if 0
-       if (ad->pop_progress)
-       {
-               evas_object_del(ad->pop_progress);
-               ad->popup = NULL;
-       }
-#endif
+       FREE(pa_region);
 }
 
 char *setting_phone_lang_get_region_str(const char *region)
@@ -208,9 +228,9 @@ char *setting_phone_lang_get_region_str(const char *region)
                char *q = strchr(pa_lang, '.');
                if (q) {
                        *q = '\0';
-               }   
+               }
                SETTING_TRACE("pa_lang:%s", pa_lang);
-               int err = -1; 
+               int err = -1;
                uloc_setDefault(pa_lang, &err);
                free((void *)pa_lang);
                pa_lang = NULL;
@@ -222,18 +242,26 @@ char *setting_phone_lang_get_region_str(const char *region)
        uloc_getDisplayName(region, localeID, displayname, SETTING_STR_SLP_LEN,
                            &status);
 
-       if (U_FAILURE(status)) {
-               SETTING_TRACE("NO : uloc_getDisplayName : %d ", status);
+       char *str_displayname = setting_phone_lang_str_to_utf8(displayname);
+       if (str_displayname == NULL) {
+               SETTING_TRACE("Get displayname in utf8 failed");
+               return NULL;
+       }
+       int len = 0;
+       UErrorCode errcode;
+       char source[256] = {0,};
+       UChar dest[256] = {0,};
+       if (strlen(str_displayname) < 256) {
+               strcpy(source, str_displayname);
        } else {
-               SETTING_TRACE(" OK : uloc_getDisplayName : %s ", displayname);
+               return NULL;
        }
+       u_strFromUTF8(dest, 256, &len, source, 256, &errcode);
+       u_strToUpper(dest, 1, dest, 1, "", &errcode);
+       u_strToUTF8(source, 256, NULL, dest, 256, &errcode);
+       ret_str = (char *)g_strdup(source);
 
-       char *str_displayname = setting_phone_lang_str_to_utf8(displayname);
-       ret_str = (char *)g_strdup(str_displayname);
-
-       if (str_displayname) {
-               FREE(str_displayname);
-       }
+       FREE(str_displayname);
        return ret_str;
 }
 
@@ -256,21 +284,33 @@ char *setting_phone_lang_str_to_utf8(const UChar *unichars)
        len = u_strlen(unichars);
        len_str = sizeof(char) *4 * (len + 1);
        str = (char *)calloc(1, len_str);
-       if (!str)
+       if (!str){
                return NULL;
+       }
 
        u_strToUTF8(str, len_str, &len_utf8, unichars, len, &status);
        return str;
 }
 
-char *setting_phone_lang_get_by_pattern(const char *locale,
-                                              const char *skeleton, void *data)
+char *setting_phone_lang_get_by_pattern(const char *locale, const char *skeleton, void *data)
 {
        setting_retvm_if(!locale, NULL, "locale parameter is NULL");
        setting_retvm_if(data == NULL, NULL, "Data parameter is NULL");
 
        SettingPhoneUG *ad = (SettingPhoneUG *) data;
 
+       //remove ".UTF-8" in locale
+       char locale_tmp[32] = {0,};
+       if (strlen(locale) <32) {
+               strcpy(locale_tmp, locale);
+       } else {
+               return NULL;
+       }
+       char *p = safeStrStr(locale_tmp, ".UTF-8");
+       if (p) {
+               *p = 0;
+       }
+
        char *ret_str = NULL;
        UChar customSkeleton[SETTING_STR_SLP_LEN] = { 0, };
        UErrorCode status = U_ZERO_ERROR;
@@ -285,12 +325,12 @@ char *setting_phone_lang_get_by_pattern(const char *locale,
        u_uastrncpy(customSkeleton, skeleton, safeStrLen(skeleton));
 
        if (ad->pattern_generator == NULL
-           || safeStrCmp(locale, ad->prev_locale) != 0) {
+           || safeStrCmp(locale_tmp, ad->prev_locale) != 0) {
                if (ad->pattern_generator != NULL) {
                        udatpg_close(ad->pattern_generator);
                        ad->pattern_generator = NULL;
                }
-               ad->pattern_generator = udatpg_open(locale, &status);
+               ad->pattern_generator = udatpg_open(locale_tmp, &status);
        }
 
        int32_t bestPatternCapacity =
@@ -304,7 +344,7 @@ char *setting_phone_lang_get_by_pattern(const char *locale,
 
        UDate date = ucal_getNow();
        formatter =
-           udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern,
+           udat_open(UDAT_IGNORE, UDAT_IGNORE, locale_tmp, NULL, -1, bestPattern,
                      -1, &status);
        int32_t formattedCapacity =
            (int32_t) (sizeof(formatted) / sizeof((formatted)[0]));
@@ -319,6 +359,53 @@ char *setting_phone_lang_get_by_pattern(const char *locale,
        return ret_str;
 }
 
+#if 1
+static char *__setting_phone_number_format_get(const char *region)
+{
+       SETTING_TRACE_BEGIN;
+       setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
+       UNumberFormat *fmt = NULL;
+       UErrorCode status = U_ZERO_ERROR;
+       char decimal[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
+       char separator[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
+       char decimal_ch = 0;
+       char separator_ch = 0;
+       UChar u_decimal[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
+       UChar u_thousand[MAX_DISPLAY_NAME_LEN_ON_UI] = { 0 };
+       fmt = unum_open(UNUM_DEFAULT, NULL, -1, region, NULL, &status);
+       unum_getSymbol(fmt, UNUM_DECIMAL_SEPARATOR_SYMBOL, u_decimal, MAX_DISPLAY_NAME_LEN_ON_UI, &status);
+       u_austrcpy(decimal, u_decimal);
+       unum_getSymbol(fmt, UNUM_GROUPING_SEPARATOR_SYMBOL, u_thousand, MAX_DISPLAY_NAME_LEN_ON_UI, &status);
+       u_austrcpy(separator, u_thousand);
+
+       int len_seq = safeStrLen(separator);
+       decimal_ch = decimal[0];
+       separator_ch = separator[0];
+       if (len_seq == 2 || len_seq == 0) {
+               separator_ch = 32;
+       }
+       if (len_seq == 3 && !safeStrCmp(separator, "\xe2\x80\x99")) {
+               separator_ch = 39;
+       }
+
+       len_seq = safeStrLen(decimal);
+       if (len_seq == 2 || len_seq == 0) {
+               decimal_ch = 44;
+       }
+       SETTING_TRACE("separator, decimal = %c, %c", separator_ch, decimal_ch);
+
+       unum_close(fmt);
+
+       //make example
+       char loc_number[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
+       snprintf(loc_number, sizeof(loc_number), "1%c234%c567%c89", separator_ch, separator_ch, decimal_ch);
+       SETTING_TRACE("loc_number = %s", loc_number);
+       return g_strdup(loc_number); /* should be freed by caller */
+}
+#endif
+
+
+#if 0
 static char *__setting_phone_number_format_get(const char *region)
 {
        setting_retvm_if(region == NULL, NULL, "region parameter is NULL");
@@ -336,6 +423,37 @@ static char *__setting_phone_number_format_get(const char *region)
 
        return g_strdup(number_char); /* should be freed by caller */
 }
+#endif
+
+#if 0
+static char *__setting_phone_number_format_get(const char *region)
+{
+       SETTING_TRACE_BEGIN;
+       struct lconv *locale = NULL;
+       char *decimal = NULL;
+       char *separator = NULL;
+       char decimal_ch = 0;
+       char separator_ch = 0;
+
+       locale = localeconv();
+       SETTING_TRACE("check localeconv");
+       decimal = locale->decimal_point;
+       separator = locale->thousands_sep;
+       int len_seq = safeStrLen(separator);
+       decimal_ch = decimal[0];
+       separator_ch = separator[0];
+       if (len_seq == 2 || len_seq == 0) {
+               separator_ch = 32;
+       }
+       SETTING_TRACE("separator, decimal = %c, %c", separator_ch, decimal_ch);
+
+       //make example
+       char loc_number[MAX_DISPLAY_NAME_LEN_ON_UI] = {0,};
+       snprintf(loc_number, sizeof(loc_number), "1%c234%c567%c89", separator_ch, separator_ch, decimal_ch);
+       SETTING_TRACE("loc_number = %s", loc_number);
+       return g_strdup(loc_number); /* should be freed by caller */
+}
+#endif
 
 char *setting_phone_lang_get_example_desc(const char *region, void *data)
 {
@@ -357,7 +475,14 @@ char *setting_phone_lang_get_example_desc(const char *region, void *data)
                time_skeleton = "HHmm";
        }
 
-       char *time = setting_phone_lang_get_by_pattern(region, time_skeleton, data);
+       //char *region_jp = vconf_get_str(VCONFKEY_REGIONFORMAT);
+       char *time = NULL;
+
+       //if (safeStrStr(region_jp, "ja_JP") == NULL) {
+               time = setting_phone_lang_get_by_pattern(region, time_skeleton, data);
+       /*}else{
+               time = setting_phone_lang_get_by_pattern("en_GB.UTF-8", time_skeleton, data);
+       }*/
 
        char *number = __setting_phone_number_format_get(region);
 
@@ -369,9 +494,12 @@ char *setting_phone_lang_get_example_desc(const char *region, void *data)
        eina_strbuf_append_printf(temp_str, "<br>%s : %s", _("IDS_COM_BODY_DETAILS_TIME"), time);
        eina_strbuf_append_printf(temp_str, "<br>%s : %s", _("IDS_ST_BODY_NUMBER"), number);
 
+       SETTING_TRACE("temp_str: %s", temp_str);
        r_str_text = eina_strbuf_string_steal(temp_str);
        /* eina_strbuf_string_free(temp_str); */
        eina_strbuf_free(temp_str);
+       SETTING_TRACE("r_str_text: %s", r_str_text);
+
        G_FREE(date);
        G_FREE(time);
        G_FREE(number);
@@ -388,7 +516,7 @@ static void setting_phone_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
 }
 
 static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
-                                       service_h service, void *priv)
+                                       app_control_h service, void *priv)
 {
        setting_retvm_if((!priv), NULL, "!priv");
        SETTING_TRACE_BEGIN;
@@ -406,6 +534,8 @@ static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
        /* --------------------------------------------------------- */
        char *pa_path = NULL;;
 
+       //elm_theme_extension_add(NULL, SETTING_PHONE_GENLIST_EDJ_NAME);
+
        pa_path = vconf_get_str(VCONFKEY_LANGSET);
        if (!pa_path) {
                SETTING_TRACE
@@ -414,7 +544,7 @@ static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
                return NULL;
        }
        /* set launguage */
-       setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
+       bindtextdomain(SETTING_PACKAGE, SETTING_LOCALEDIR);
        FREE(pa_path);
        /* ---------------------------------------------------------     */
        int value = 0;
@@ -429,14 +559,13 @@ static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
                memset(&(phoneUG->imsi), 0, sizeof(TelSimImsiInfo_t));
                if (phoneUG->handle
                    && TAPI_API_SUCCESS == tel_get_sim_imsi(phoneUG->handle, &(phoneUG->imsi))) {
-                       SETTING_TRACE("********************************************");
-                       //SETTING_TRACE("imsi.bValid: [%d]", phoneUG->imsi.bValid);
-                       SETTING_TRACE("imsi.szMcc: [%s]", phoneUG->imsi.szMcc);
-                       SETTING_TRACE("imsi.szMnc: [%s]", phoneUG->imsi.szMnc);
-                       SETTING_TRACE("imsi.szMsin: [%s]", phoneUG->imsi.szMsin);
-                       SETTING_TRACE("********************************************");
-
-                       phoneUG->sim_lang = get_language_by_mobile_country_code(atoi(phoneUG->imsi.szMcc));
+                       SETTING_TRACE_SECURE_DEBUG("********************************************");
+                       SETTING_TRACE_SECURE_DEBUG("imsi.szMcc: [%s]", phoneUG->imsi.szMcc);
+                       SETTING_TRACE_SECURE_DEBUG("imsi.szMnc: [%s]", phoneUG->imsi.szMnc);
+                       SETTING_TRACE_SECURE_DEBUG("imsi.szMsin: [%s]", phoneUG->imsi.szMsin);
+                       SETTING_TRACE_SECURE_DEBUG("********************************************");
+
+                       phoneUG->sim_lang = get_language_by_mobile_country_code(phoneUG->imsi.szMcc);
                }
        }
        if (!phoneUG->sim_lang) {
@@ -448,27 +577,19 @@ static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
        /* register view node table */
        setting_view_node_table_intialize();
 
-       setting_create_Gendial_itc("dialogue/1text.1icon.2",
-                                  &(phoneUG->itc_1text_1icon_2));
-       setting_create_Gendial_itc("dialogue/1text.1icon",
-                                  &(phoneUG->itc_1text_1icon));
+       setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_1icon_2));
+       setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_1icon));
 
        // 2 text - genlist > items
        setting_create_Gendial_itc("dialogue/2text", &(phoneUG->itc_1icon_2text));
 
-       setting_create_Gendial_itc("dialogue/1text", &(phoneUG->itc_1text));
-       setting_create_Gendial_itc("dialogue/2text.3/expandable",
-                                  &(phoneUG->itc_2text_3_parent));
-       setting_create_Gendial_itc("dialogue/1text.1icon/expandable2",
-                                  &(phoneUG->itc_1icon_1text_sub));
+       setting_create_Gendial_itc("1line", &(phoneUG->itc_1text_tb));
+       setting_create_Gendial_itc("1line", &(phoneUG->itc_1text));
+       setting_create_Gendial_itc("2line.top", &(phoneUG->itc_2text_3_parent));
+       setting_create_Gendial_itc("1line", &(phoneUG->itc_1icon_1text_sub));
 
-       phoneUG->itc_seperator.item_style = "dialogue/separator";
-       phoneUG->itc_seperator.func.text_get = NULL;
-       phoneUG->itc_seperator.func.content_get = NULL;
-       phoneUG->itc_seperator.func.state_get = NULL;
-       phoneUG->itc_seperator.func.del = NULL;
 
-       setting_create_Gendial_itc("dialogue/2text.3", &(phoneUG->itc_2text_2));
+       setting_create_Gendial_itc("2line.top", &(phoneUG->itc_2text_2));
        setting_create_Gendial_itc("multiline/1text",
                                   &(phoneUG->itc_bg_1icon));
        phoneUG->pattern_generator = NULL;
@@ -486,22 +607,30 @@ static void *setting_phone_ug_on_create(ui_gadget_h ug, enum ug_mode mode,
        return __get_phone_layout_to_return(service, phoneUG);
 }
 
-static void setting_phone_ug_on_start(ui_gadget_h ug, service_h service,
+static void setting_phone_ug_on_start(ui_gadget_h ug, app_control_h service,
                                      void *priv)
 {
 }
 
-static void setting_phone_ug_on_pause(ui_gadget_h ug, service_h service,
+static void setting_phone_ug_on_pause(ui_gadget_h ug, app_control_h service,
                                      void *priv)
 {
 }
 
-static void setting_phone_ug_on_resume(ui_gadget_h ug, service_h service,
+static void setting_phone_ug_on_resume(ui_gadget_h ug, app_control_h service,
                                       void *priv)
 {
+       SETTING_TRACE_BEGIN;
+       ret_if(!priv);
+       SettingPhoneUG *phoneUG = priv;
+
+       Eina_Bool is_freezed = evas_object_freeze_events_get(phoneUG->navi_bar);
+       SETTING_TRACE_DEBUG("is_freezed : %d", is_freezed);
+       if(is_freezed)
+               evas_object_freeze_events_set(phoneUG->navi_bar, EINA_FALSE);
 }
 
-static void setting_phone_ug_on_destroy(ui_gadget_h ug, service_h service,
+static void setting_phone_ug_on_destroy(ui_gadget_h ug, app_control_h service,
                                        void *priv)
 {
        SETTING_TRACE_BEGIN;
@@ -522,6 +651,20 @@ static void setting_phone_ug_on_destroy(ui_gadget_h ug, service_h service,
                                     phoneUG);
                setting_view_destroy(&setting_view_phone_language_region, phoneUG);
        }
+       #ifdef ENABLE_TICKER_NOTI
+       else if (&setting_view_phone_ticker_notification ==
+                  phoneUG->view_to_load) {
+               setting_view_destroy(&setting_view_phone_ticker_notification,
+                                    phoneUG);
+               setting_view_destroy(&setting_view_phone_ticker_notification_details, phoneUG);
+
+       }
+       #endif
+       else if (&setting_view_phone_license_main == phoneUG->view_to_load) {
+               setting_view_destroy(&setting_view_phone_license_main, phoneUG);
+       }
+
+       FREE(phoneUG->sim_lang);
 
        if (NULL != ug_get_layout(phoneUG->ug)) {
                evas_object_hide((Evas_Object *) ug_get_layout(phoneUG->ug));
@@ -531,14 +674,14 @@ static void setting_phone_ug_on_destroy(ui_gadget_h ug, service_h service,
        SETTING_TRACE_END;
 }
 
-static void setting_phone_ug_on_message(ui_gadget_h ug, service_h msg,
-                                       service_h service, void *priv)
+static void setting_phone_ug_on_message(ui_gadget_h ug, app_control_h msg,
+                                       app_control_h service, void *priv)
 {
        SETTING_TRACE_BEGIN;
        setting_retm_if(NULL == priv, "priv is NULL");
        char *pid_str = NULL;
 
-       service_get_extra_data(msg, "DEADPID", &pid_str);
+       app_control_get_extra_data(msg, "DEADPID", &pid_str);
        if (pid_str)
        {
                errno = 0;
@@ -552,7 +695,7 @@ static void setting_phone_ug_on_message(ui_gadget_h ug, service_h msg,
 }
 
 static void setting_phone_ug_on_event(ui_gadget_h ug, enum ug_event event,
-                                     service_h service, void *priv)
+                                     app_control_h service, void *priv)
 {
        SETTING_TRACE_BEGIN;
 
@@ -566,27 +709,20 @@ static void setting_phone_ug_on_event(ui_gadget_h ug, enum ug_event event,
        {
                if (ad->gl_lang_region && setting_view_phone_language_region.is_create) {
                        elm_genlist_realized_items_update(ad->gl_lang_region);
-                       Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
-                       ret_if(!navi_it);
-                       elm_object_item_text_set(navi_it, _(KeyStr_LanguageRegion));
                        setting_phone_update_item(ad);
                }
        }
        break;
        case UG_EVENT_LANG_CHANGE:
        {
+               ad->lang_change = EINA_TRUE;
+
                if (ad->gl_lang_region && setting_view_phone_language_region.is_create) {
                        elm_genlist_realized_items_update(ad->gl_lang_region);
-                       Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navi_bar);
-                       ret_if(!navi_it);
-                       elm_object_item_text_set(navi_it, _(KeyStr_LanguageRegion));
                        setting_phone_update_item(ad);
                }
 
-               if (ad->pop_progress) {
-                       evas_object_del(ad->pop_progress);
-                       ad->popup = NULL;
-               }
+               setting_navi_items_update(ad->navi_bar);
        }
        break;
 
@@ -605,7 +741,7 @@ static void setting_phone_ug_on_event(ui_gadget_h ug, enum ug_event event,
 
 static void setting_phone_ug_on_key_event(ui_gadget_h ug,
                                          enum ug_key_event event,
-                                         service_h service, void *priv)
+                                         app_control_h service, void *priv)
 {
        SETTING_TRACE_BEGIN;
        SettingPhoneUG *ad = (SettingPhoneUG *) priv;
@@ -654,47 +790,34 @@ UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
        setting_retm_if(!ops, "ops == NULL");
 
        phoneUG = ops->priv;
-       if (phoneUG)
+       if (phoneUG){
                FREE(phoneUG);
+       }
 }
 
-/*****/
-UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
-{
-       SETTING_TRACE_BEGIN;
-
-       int ret = 0;
-       char *ug_type = NULL;
-
-       service_get_extra_data(service, "viewtype", &ug_type);
-#if SUPPORT_RUN_SYSTEM_COMMAND
-       ret += excuteCmd(SETTING_POSTINST_FILE, 1, ug_type);
-#else
-       if (0 == safeStrCmp(ug_type, "language")) {
-               // INT_SLP_SETTING_LANG
-               ret += vconf_set_int(VCONFKEY_SETAPPL_LANG_INT, 10);
-               ret += vconf_set_str(VCONFKEY_LANGSET, "en_GB.UTF-8");
-               ret += vconf_set_str(VCONFKEY_REGIONFORMAT,"en_GB.UTF-8");
-       }
+/************* n-depth search **************/
+static Setting_Cfg_Node_T s_cfg_node_array[] = {
+       {"IDS_ST_HEADER_DISPLAY_LANGUAGE", NULL, "viewtype:language;caller:setting", Cfg_Item_Pos_Level0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+       {"IDS_ST_BODY_REGION", NULL, "viewtype:region", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+       {"IDS_ST_BODY_KEYBOARD", NULL, "viewtype:language", 0, 0, 0, Cfg_Item_View_Node, NULL, NULL, NULL, NULL},
+};
 
-#endif
-       if (0 == safeStrCmp(ug_type, "language"))
-       {
-               SETTING_TRACE("Begin to reset language & region...");
 
-               //b .reset default localeid
-               int err = -1;
-               uloc_setDefault("en_US", &err);
+UG_MODULE_API int setting_plugin_search_init(app_control_h service, void *priv, char** applocale)
+{
+       SETTING_TRACE_BEGIN;
+       SETTING_TRACE(">> setting-phone-efl DB search code");
+       setting_retvm_if(!priv || !applocale,SETTING_GENERAL_ERR_NULL_DATA_PARAMETER, "pplist/applocale is NULL");
 
-               //c. reset date&time format
-               vconf_set_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, SETTING_DATE_FORMAT_DD_MM_YYYY);
+       *applocale = strdup("setting:/usr/apps/org.tizen.setting/res/locale");
 
-               //d. terminate other apps
-               // ret += aul_app_get_running_app_info(app_terminate_func, NULL);
+       Eina_List **pplist = (Eina_List**)priv;
+       int i;
+       int size = sizeof(s_cfg_node_array)/sizeof(s_cfg_node_array[0]);
+       for(i=0;i<size;i++) {
+               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_DisplayLanguage,s_cfg_node_array[i].item_type,  s_cfg_node_array[i].data, "Language and Region");
+               *pplist = eina_list_append(*pplist, node);
        }
-       /*  DO NOTHING */
-       return ret;
-
+       return 0;
 }
 
-/*****/