put a note of the Flora license description
[apps/core/preloaded/settings.git] / src / setting.c
index 09c4112..de28fff 100755 (executable)
@@ -1,28 +1,23 @@
 /*
  * setting
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  *
- * 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");
+ * Licensed under the Flora License, Version 1.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://www.apache.org/licenses/LICENSE-2.0
+ *     http://floralicense.org/license/
  *
  * 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 <setting.h>
 #include <app.h>
 
 #include <appcore-common.h>
-#include <heynoti.h>
 #include <Ecore_X.h>
 #include <sensor.h>
 #include <aul.h>
 #include "setting-main.h"
 #include <elm_object.h>
 #include <appsvc.h>
+#include <EWebKit2.h>
+#include <nfc.h>
+#include <signal.h>
 
 extern void setting_update_gl_item(void* data);
 
 #define KEY_END "XF86Stop"
+#define SUPPORT_UG_MESSAGE
 
 int g_geometry_x, g_geometry_y, g_geometry_w, g_geometry_h;
-extern int aul_listen_app_dead_signal(int (*func)(int signal, void *data), void *data);
+
+void termination_handler(int signum)
+{
+       SETTING_TRACE_BEGIN;
+       SETTING_TRACE(">>>>>>>>>>> SIGTERM >>>>>>>>>>>>>>> SETTING");
+
+       elm_exit();
+}
 
 static void __main_motion_sensor_cb( unsigned long long timestamp, void *data)
 {
@@ -85,7 +91,6 @@ static void __main_motion_sensor_cb( unsigned long long timestamp, void *data)
                        //SETTING_TRACE("content type:%s", type);
                        if (0 == safeStrCmp(type, "genlist")) {
                                genlist = content;
-                       //} else if (0 == safeStrCmp(type, "layout") || 0 == safeStrCmp(type, "conformant")) {
                        } else if (NULL != type) {//type="layout","conformant" etc..
                                //layout
                                //genlist = elm_object_part_content_get(content, "elm.swallow.contents");
@@ -100,7 +105,6 @@ static void __main_motion_sensor_cb( unsigned long long timestamp, void *data)
                                        type = elm_object_widget_type_get(subobj);
                                        if (0 == safeStrCmp(type, "genlist")) {
                                                genlist = subobj;
-                                               //SETTING_TRACE("Get the genlist:%p", genlist);
                                                Elm_Object_Item *first_item = elm_genlist_first_item_get(genlist);
                                                if (first_item) {
                                                        elm_genlist_item_show(first_item, ELM_GENLIST_ITEM_SCROLLTO_TOP);
@@ -111,7 +115,6 @@ static void __main_motion_sensor_cb( unsigned long long timestamp, void *data)
                        } else {
                                //keep genlist to be NULL.
                        }
-                       //SETTING_TRACE("genlist(:%p) type:%s", genlist, elm_object_widget_type_get(genlist));
                        if (genlist && 0 == safeStrCmp(elm_object_widget_type_get(genlist), "genlist")) {
                                SETTING_TRACE("Get the genlist:%p", genlist);
                                Elm_Object_Item *first_item = elm_genlist_first_item_get(genlist);
@@ -144,21 +147,9 @@ static int setting_main_keydown_cb(void *data, int type, void *event)
                        Evas_Object *content = elm_object_content_get(popup);
                        const char *type = elm_widget_type_get(content);
                        if (type && !safeStrCmp(type, "progressbar")) {
-                               SETTING_TRACE_DEBUG
-                                   ("Found popup[%p], but it respresent a progress bar, so skip it.",
-                                    popup);
+                               SETTING_TRACE_DEBUG ("Found popup[%p], but it respresent a progress bar, so skip it.", popup);
                        } else {
-                               evas_object_smart_callback_call(popup,
-                                                               "timeout",
-                                                               NULL);
-
-                               /* error handling */
-                               /*Evas_Object *popup2 = get_toppest_popup_window(ad->evas);
-                                  if (popup == popup2)
-                                  {
-                                  SETTING_TRACE_ERROR("error handling");
-                                  evas_object_del(popup);
-                                  } */
+                               evas_object_smart_callback_call(popup, "timeout", NULL);
                        }
                }
                return;
@@ -178,7 +169,7 @@ static int setting_main_keydown_cb(void *data, int type, void *event)
                }
        }
 }
-#else                          /* FOR MWC DEMO 2010.02.07 */
+#else
        if (ev && !safeStrCmp(ev->keyname, KEY_END)) {
                /* do nothing except exit */
                SETTING_TRACE("before --- elm_exit ");
@@ -215,36 +206,61 @@ static void setting_main_low_battery_cb(void *data)
 /**
 * To active rotation effect in Setting App
 */
-static void setting_main_rotate(enum appcore_rm m, void *data)
+static void setting_main_rotate(app_device_orientation_e m, void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
-       int r;
 
        if (ad == NULL || ad->win_main == NULL)
-               return 0;
+               return;
 
 #if 0
+                               int value = 0;
+                               vconf_get_bool
+                                   (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
+                               // true  : aoto rotation OFF
+                               // false : auto rotation ON
+                               value = !value;
+#else
+       //int hold_flag = 0;
+       //vconf_get_bool (VCONFKEY_SETAPPL_ROTATE_HOLD_BOOL, &hold_flag);
+       //SETTING_TRACE("hold_flag:%d", hold_flag);
+       //if (hold_flag)
+       //{
+               //do nothing..
+       //      return;
+       //}
+
+       int value = 0;
+       vconf_get_bool (VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
+
+       if (value == 0)
+               m = 0;
+
+       elm_win_rotation_with_resize_set(ad->win_main, m);
+
+       /////Send the rotation event to UGs..
+       enum ug_event event = UG_EVENT_ROTATE_PORTRAIT;
        switch (m) {
-       case APPCORE_RM_PORTRAIT_NORMAL:
-               r = 0;
+       case APP_DEVICE_ORIENTATION_0:
+               event = UG_EVENT_ROTATE_PORTRAIT;
                break;
-       case APPCORE_RM_PORTRAIT_REVERSE:
-               r = 180;
+       case APP_DEVICE_ORIENTATION_180:
+               event = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
                break;
-       case APPCORE_RM_LANDSCAPE_NORMAL:
-               r = 270;
+       case APP_DEVICE_ORIENTATION_90:
+               event = UG_EVENT_ROTATE_LANDSCAPE;
                break;
-       case APPCORE_RM_LANDSCAPE_REVERSE:
-               r = 90;
+       case APP_DEVICE_ORIENTATION_270:
+               event = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
                break;
        default:
-               r = -1;
-               break;
+               return;
        }
+       ug_send_event(event);
+       //elm_win_rotation_get
 #endif
-       if (r >= 0)
-               elm_win_rotation_with_resize_set(ad->win_main, r);
+
 }
 #endif
 
@@ -267,6 +283,16 @@ static void setting_main_del_win(void *data, Evas_Object *obj, void *event)
        elm_exit();
 }
 
+void profile_changed_cb(void *data, Evas_Object * obj, void *event)
+{
+       const char *profile = elm_config_profile_get();
+
+       if (strcmp(profile, "desktop") == 0)
+               elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_HIDE);
+       else
+               elm_win_indicator_mode_set (obj, ELM_WIN_INDICATOR_SHOW);
+}
+
 /**
 * To create a win object, the win is shared between the App and all its UGs
 */
@@ -276,12 +302,13 @@ static Evas_Object *setting_main_create_win(const char *name)
        Evas_Object *eo;
        int w, h;
 
-       eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       //eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       eo = elm_win_util_standard_add(name, name);
        if (eo) {
                elm_win_title_set(eo, name);
-               elm_win_borderless_set(eo, EINA_TRUE);
-               evas_object_smart_callback_add(eo, "delete,request",
-                                              setting_main_del_win, NULL);
+               evas_object_smart_callback_add(eo, "delete,request", setting_main_del_win, NULL);
+               evas_object_smart_callback_add(eo, "profile,changed", profile_changed_cb, NULL);
+               //elm_win_conformant_set(eo, EINA_TRUE);
                ecore_x_window_size_get(ecore_x_window_root_first_get(),
                                        &w, &h);
                evas_object_resize(eo, w, h);
@@ -368,20 +395,18 @@ static void setting_main_lang_changed_cb(void *data)
 #if SUPPORT_BOTTOM_BTNS
                elm_object_item_text_set(ad->edit_item, _(EDIT_PREFERRED_STR));
 #else
-               //elm_object_text_set(ad->edit_item, _(EDIT_PREFERRED_STR));
                Evas_Object *eo_btn = elm_object_item_part_content_get(ad->edit_item, "object");
                setting_retm_if(eo_btn == NULL, "get eo_lbtn failed");
                elm_object_text_set(eo_btn, _(EDIT_PREFERRED_STR));
 #endif
        }
 
-       if (ad->segment_all) elm_object_item_text_set(ad->segment_all, _(ALL_STR));
-       if (ad->segment_preferred) elm_object_item_text_set(ad->segment_preferred,
-                                          _(PREFERRED_STR));
+       if (ad->segment_all)
+               elm_object_item_text_set(ad->segment_all, _(ALL_STR));
+       if (ad->segment_preferred)
+               elm_object_item_text_set(ad->segment_preferred, _(PREFERRED_STR));
 
-       Elm_Object_Item *item = NULL;
-       item = elm_toolbar_first_item_get(ad->controlbar);
-       setting_retvm_if(!item, SETTING_RETURN_FAIL, "get toolbar first item failed");
+       // set toolbar text
        char tmp_text[MAX_DISPLAY_NAME_LEN_ON_UI + 1] = {0,};
        if (MAIN_PROFILE_ALL == ad->profile_type) {
                snprintf(tmp_text, MAX_DISPLAY_NAME_LEN_ON_UI, "%s", _(PREFERRED_STR));
@@ -390,7 +415,9 @@ static void setting_main_lang_changed_cb(void *data)
        } else {
                /* do nothing */
        }
-       elm_object_item_text_set(item, tmp_text);
+       Evas_Object *btn = elm_object_item_part_content_get(navi_it, "toolbar_button1");
+       elm_object_text_set(btn, tmp_text);
+
 
        if (ad->ug)
                ug_send_event(UG_EVENT_LANG_CHANGE);
@@ -410,36 +437,63 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data)
 
        if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_WIDGET_THEME_STR)) {
                return;
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL)) {
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_TELEPHONY_FLIGHT_MODE)) {
                item_to_update = ad->data_flight;
                retm_if(!item_to_update, "ad->data_flight is NULL");
 
                int status = 0;
-               vconf_get_bool(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, &status);
+               vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &status);
                item_to_update->chk_status = status;
                //do not need delay for checks
                elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+
+               //Flight mode is ON : Network menu dimmed
+               if (ad->data_network)
+               {
+                       if (status)
+                       {
+                               setting_disable_genlist_item(ad->data_network->item);
+                       }
+                       else
+                       {
+                               setting_enable_genlist_item(ad->data_network->item);
+                       }
+               }
                return;
-       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL)) {
+       } else if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL)) {
                item_to_update = ad->data_rotationMode;
                retm_if(!item_to_update, "ad->data_rotationMode is NULL");
 
                int status = 0;
-               vconf_get_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &status);
+               vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &status);
 
-               item_to_update->chk_status = !status;
-               SETTING_TRACE("ad->bAppPause:%d", ad->bAppPause);
-               SETTING_TRACE("ad->ug:%p", ad->ug);
+               item_to_update->chk_status = status;
                //do not need delay for checks
                elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+               SETTING_TRACE("item_to_update->chk_status:%d", item_to_update->chk_status);
+               if (item_to_update->chk_status) //rotation function is not blocked
+               {
+                       SETTING_TRACE("Rotation function is on, it is necessary to adjust the device orientation");
+                       int mode = APP_DEVICE_ORIENTATION_0;
+                       mode = app_get_device_orientation();
+                       elm_win_rotation_with_resize_set(ad->win_main, mode);
+               }
+
                return;
        } else if (!safeStrCmp(vconf_name, VCONFKEY_NFC_STATE)) {
                SETTING_TRACE_DEBUG("%s updated", vconf_name);
                item_to_update = ad->data_nfc;
                retm_if(!item_to_update, "ad->data_nfc is NULL");
 
-               item_to_update->sub_desc = (char *)g_strdup(get_NFC_on_off_str());
+               int status = 0;
+               vconf_get_bool(VCONFKEY_NFC_STATE, &status);
 
+               item_to_update->chk_status = status;
+               //do not need delay for checks
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+               SETTING_TRACE("item_to_update->chk_status:%d", item_to_update->chk_status);
+
+               item_to_update->sub_desc = (char *)g_strdup(get_NFC_on_off_str());
                SETTING_TRACE_DEBUG("%s", item_to_update->sub_desc);
 
                if (ad->bAppPause || ad->ug) {
@@ -453,6 +507,7 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data)
 
 /**
 * the event process when int VCONFS changes
+* @todo code clean - it has big if-else structure
 */
 static void setting_int_vconf_change_cb(keynode_t *key, void *data)
 {
@@ -466,13 +521,17 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data)
        char *pa_wifi_device = NULL;
        Setting_GenGroupItem_Data* item_to_update = NULL;
 
+
        if (!safeStrCmp(vconf_name, VCONFKEY_WIFI_STATE)) {
+       // do handling in case of VCONFKEY_WIFI_STATE
                item_to_update = ad->data_wifi;
                retm_if(!item_to_update, "ad->data_wifi is NULL");
 
                switch (status) {
                case VCONFKEY_WIFI_OFF:
                        item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
                        break;
 
                case VCONFKEY_WIFI_UNCONNECTED:
@@ -485,28 +544,58 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data)
                                item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
                        }
                        FREE(pa_wifi_device);
+
+                       item_to_update->chk_status = EINA_TRUE;
                        break;
                default:
                        SETTING_TRACE_ERROR("Invalid wifi status!");
                        return;
                }
 
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+
                if (ad->bAppPause || ad->ug) {
                        ad->updateItems[GL_ITEM_WIFI] = EINA_TRUE;
                } else { // app is not in pause without ug
                        elm_object_item_data_set(item_to_update->item, item_to_update);
                        elm_genlist_item_update(item_to_update->item);
                }
+       }
+       else if (!safeStrCmp(vconf_name, VCONFKEY_CALL_STATE)) {
+       // do handling in case of VCONFKEY_CALL_STATE
+               //In call situation : Wi-fi / Tethering / Network menu dimmed
+               if (VCONFKEY_CALL_OFF != status)
+               {
+                       if (ad->data_network)
+                               setting_disable_genlist_item(ad->data_network->item);
+                       if (ad->data_wifi)
+                               setting_disable_genlist_item(ad->data_wifi->item);
+               }
+               else
+               {
+                       if (ad->data_network)
+                               setting_enable_genlist_item(ad->data_network->item);
+                       if (ad->data_wifi)
+                               setting_enable_genlist_item(ad->data_wifi->item);
+               }
+
        } else if (!safeStrCmp(vconf_name, VCONFKEY_BT_STATUS)) {
                item_to_update = ad->data_bt;
                retm_if(!item_to_update, "ad->data_bt is NULL");
 
                if (FALSE == status) {
                        item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
                } else {
                        item_to_update->sub_desc = (char *)g_strdup(_("IDS_COM_BODY_ON_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_TRUE;
                }
 
+               item_to_update->chk_status = status;
+               elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
+
                if (ad->bAppPause || ad->ug) {
                        ad->updateItems[GL_ITEM_BT] = EINA_TRUE;
                } else { // app is not in pause without ug
@@ -533,7 +622,7 @@ static void setting_int_vconf_change_cb(keynode_t *key, void *data)
                        elm_genlist_item_update(ad->data_bright->item);
                }
        } else {
-                       SETTING_TRACE_ERROR("vconf_name is bad[%s]", vconf_name);
+               SETTING_TRACE_ERROR("vconf_name is bad[%s]", vconf_name);
        }
 
        return;
@@ -566,6 +655,9 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
                case VCONFKEY_WIFI_OFF:
                        item_to_update->sub_desc =
                                (char *)g_strdup(setting_gettext ("IDS_COM_BODY_OFF_M_STATUS"));
+
+                       item_to_update->chk_status = EINA_FALSE;
+                       elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
                        break;
 
                case VCONFKEY_WIFI_UNCONNECTED:
@@ -578,6 +670,9 @@ static void setting_string_vconf_change_cb(keynode_t *key, void *data)
                                item_to_update->sub_desc =
                                        (char *) g_strdup(setting_gettext ("IDS_COM_BODY_ON_M_STATUS"));
                        }
+
+                       item_to_update->chk_status = EINA_TRUE;
+                       elm_check_state_set(item_to_update->eo_check, item_to_update->chk_status);
                        break;
                default:
                        SETTING_TRACE_ERROR("Invalid wifi status!");
@@ -606,7 +701,6 @@ static Eina_Bool setting_on_idle_lazy(void *data)
                SETTING_TRACE_ERROR("sensor attach fail");
        }
 
-
        if (sensor_motion_doubletap_set_cb(ad->sf_handle, __main_motion_sensor_cb, ad) != SENSOR_ERROR_NONE) {
                SETTING_TRACE("sensor_motion_doubletap_set_cb fail to gather data");
        }
@@ -615,16 +709,7 @@ static Eina_Bool setting_on_idle_lazy(void *data)
                SETTING_TRACE_ERROR("sensor_start fail");
        }
 
-//     appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, setting_main_lang_changed_cb, ad);
-
-#if LOW_BATTERY_DO_NOTHING
-//     appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, setting_main_low_battery_cb, ad);
-#endif
-
-//     appcore_set_event_callback(APPCORE_EVENT_REGION_CHANGE, setting_main_region_changed_cb, ad);
-
 #if SUPPORT_APP_ROATION
-//     appcore_set_rotation_cb(setting_main_rotate, ad);
        evas_object_geometry_get(ad->win_main, &g_geometry_x, &g_geometry_y, &g_geometry_w, &g_geometry_h);
 #endif
 
@@ -634,7 +719,7 @@ static Eina_Bool setting_on_idle_lazy(void *data)
 /**
 * The function is called to create Setting view widgets
 */
-static int setting_main_app_create(void *data)
+static bool setting_main_app_create(void *data)
 {
        SETTING_TRACE_BEGIN;
        //fprintf(stderr, "[TIME] 3. it taked %d msec from main to setting_main_app_create \n", appcore_measure_time());
@@ -642,6 +727,12 @@ static int setting_main_app_create(void *data)
        //appcore_measure_start();
        setting_main_appdata *ad = data;
 
+       // registering sigterm
+       if (signal(SIGTERM, termination_handler) == SIG_IGN)
+       {
+               signal(SIGTERM, SIG_IGN);
+       }
+
        ad->data_roaming_popup = NULL;
 
        /* create window */
@@ -653,7 +744,7 @@ static int setting_main_app_create(void *data)
 
        /* load config file */
        int cfg_operation_ret = setting_cfg_init();
-       PLUGIN_INIT(ad);
+       //PLUGIN_INIT(ad);
 
        elm_theme_extension_add(NULL, SETTING_THEME_EDJ_NAME);
 #if SUPPORT_LCD_TIMEOUT_KEEPING
@@ -730,16 +821,19 @@ static int setting_main_app_create(void *data)
        //SETTING_TRACE("[TIME] 4. setting_main_app_create taked %d msec ", appcore_measure_time());
        //appcore_measure_start();
 
+       // set default local automatically
+       set_defaultLangICU();
        return true;
 }
 
 /**
 * The function is called when Setting is terminated
 */
-static void setting_main_app_terminate(void *data)
+static int setting_main_app_terminate(void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
+       //vconf_set_bool (VCONFKEY_SETAPPL_ROTATE_HOLD_BOOL, FALSE);
        PLUGIN_FINI;
        setting_cfg_exit();
        clear_system_service_data();
@@ -796,6 +890,7 @@ static void setting_main_app_pause(void *data)
 #endif
 
        sensor_stop(ad->sf_handle, SENSOR_MOTION_DOUBLETAP);
+
 }
 
 /**
@@ -827,63 +922,31 @@ static void setting_main_app_resume(void *data)
 }
 
 /**
-* The function is called by app-fwk after app_create. It always do the process which cost much time.
-*/
-static int setting_main_app_reset(service_h service, void *data)
+ * The function is called by app-fwk after app_create. It always do the process which cost much time.
+ */
+static void setting_main_app_reset(service_h service, void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
 
-#if SUPPORT_LIVEBOX_DEMO
-       char *ug_name = NULL;
-       if(b != NULL)
+       int value = 0;
+       vconf_get_bool (VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &value);
+       SETTING_TRACE("value:%d", value);
+       if (value) //rotation function is not blocked
        {
-               ug_name = (char*)appsvc_get_data(b, "ug");
-               if(ug_name)
-               {
-                       SETTING_TRACE_DEBUG("get ug_name : %s", ug_name);
-                       struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
-                       setting_retm_if(!cbs, "calloc failed");
-                       cbs->layout_cb = setting_main_layout_ug_cb;
-                       cbs->result_cb = setting_main_result_ug_cb;
-                       cbs->destroy_cb = setting_main_destroy_ug_cb;
-                       cbs->priv = (void *)ad;
-
-                       char *path = get_ug_path_from_ug_args(data);
-                       service_h svc = get_bundle_from_ug_args(data);
-                       ad->ug = ug_create(NULL, ug_name, UG_MODE_FULLVIEW, svc, cbs);
-                       if (ad->ug) {
-                               ad->isInUGMode = TRUE;
-                       } else {
-
-                               evas_object_show(ad->ly_main);
-
-                               SETTING_TRACE_ERROR("errno:%d", errno);
-                               setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
-                       }
-                       if (path)
-                               FREE(path);
-                       if (cbs)
-                               FREE(cbs);
-                       path = NULL;
-                       cbs = NULL;
-                       service_destroy(svc);
-               }
-               else
-               {
-                       SETTING_TRACE_DEBUG("ug_name is NULL");
-               }
+               SETTING_TRACE("Rotation function is on, it is necessary to adjust the device orientation");
+               int mode = APP_DEVICE_ORIENTATION_0;
+               mode = app_get_device_orientation();
+               elm_win_rotation_with_resize_set(ad->win_main, mode);
        }
-       else
-       {
-               SETTING_TRACE_DEBUG("bundle is NULL");
-       }
-#endif
+
        vconf_callback_fn cb = NULL;
 
        cb = setting_int_vconf_change_cb;
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_BT_STATUS, cb, data);
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_WIFI_STATE, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_CALL_STATE, cb, ad);
+
        //do need to disable 'Brightness' menu,just disable sub-items in 'Brightness' menu
        //REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SYSMAN_BATTERY_STATUS_LOW, cb, ad);
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, cb, data);
@@ -895,8 +958,8 @@ static int setting_main_app_reset(service_h service, void *data)
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_USB_MODE_INT, cb, ad);
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_WIDGET_THEME_STR, cb, ad);
 
-       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, cb, ad);
-       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_TELEPHONY_FLIGHT_MODE, cb, ad);
+       REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, cb, ad);
        REGISTER_VCONF_NODE(ad->listened_list, VCONFKEY_NFC_STATE, cb, ad);
 
        if (ad->win_main)
@@ -904,12 +967,71 @@ static int setting_main_app_reset(service_h service, void *data)
 
        ecore_idler_add(setting_on_idle_lazy, ad);
 
-       //fprintf(stderr, "[TIME] 5. app_create -> app_resume (first display) : %d msec\n", appcore_measure_time());
-       //SETTING_TRACE("[TIME] 5. app_create -> app_resume (first display) : %d msec", appcore_measure_time());
-       //fprintf(stderr, "[TIME] Total. aul_launch -> app_resume (first display) : %d msec\n", appcore_measure_time_from("APP_START_TIME"));
-       //SETTING_TRACE("[TIME] Total. aul_launch -> app_resume (first display) : %d msec", appcore_measure_time_from("APP_START_TIME"));
+       int flight_mode = 0;
+       vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &flight_mode);
+       if (flight_mode)
+       {
+               if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
+       }
+
+       int call_status = VCONFKEY_CALL_OFF;
+       vconf_get_int(VCONFKEY_CALL_STATE, &call_status);
+       if (VCONFKEY_CALL_OFF != call_status)
+       {
+               if (ad->data_network) setting_disable_genlist_item(ad->data_network->item);
+               if (ad->data_wifi) setting_disable_genlist_item(ad->data_wifi->item);
+               //if (ad->data_mobileApp) setting_disable_genlist_item(ad->data_mobileApp->item);
+       }
+
+       /* for jumping view */
+       service_get_extra_data(service, "view_to_jump", &(ad->view_to_jump));
+       if(ad->view_to_jump)
+       {
+               SETTING_TRACE_DEBUG("view to jump is %s", ad->view_to_jump);
+               /* Jumping */
+               if(!safeStrCmp(ad->view_to_jump, KeyStr_Sounds))
+               {
+
+                       SETTING_TRACE_DEBUG("Kill launched ug.");
+                       if(ad->isInUGMode == TRUE && (safeStrCmp(ad->cur_loaded_ug, "setting-profile-efl") != 0))
+                       {
+                               ug_destroy_all();
+                               ad->ug = NULL;
+                       }
+                       if(ad->isInUGMode == TRUE && (safeStrCmp(ad->cur_loaded_ug, "setting-profile-efl") == 0))
+                       {
+                               return;
+                       }
+
+                       struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
+                       setting_retm_if(!cbs, "calloc failed");
+                       cbs->layout_cb = setting_main_layout_ug_cb;
+                       cbs->result_cb = setting_main_result_ug_cb;
+                       cbs->destroy_cb = setting_main_destroy_ug_cb;
+                       cbs->priv = (void *)ad;
 
-       //return 0;
+                       SETTING_TRACE_DEBUG("call setting-profile-efl ug");
+                       ad->ug = ug_create(NULL, "setting-profile-efl", UG_MODE_FULLVIEW, 0, cbs);
+                       if (ad->ug) {
+                               ad->isInUGMode = TRUE;
+                               memset(ad->cur_loaded_ug, 0x00, MAX_DISPLAY_NAME_LEN_ON_UI);
+                               safeCopyStr(ad->cur_loaded_ug, "setting-profile-efl", MAX_DISPLAY_NAME_LEN_ON_UI);
+                       } else {
+                               evas_object_show(ad->ly_main);
+
+                               SETTING_TRACE_ERROR("errno:%d", errno);
+                               setting_create_simple_popup(ad, ad->win_main, NULL, NO_UG_FOUND_MSG);
+                       }
+                       if (cbs)
+                               FREE(cbs);
+                       cbs = NULL;
+                       ad->view_to_jump = NULL;
+               }
+       }
+       else
+       {
+               SETTING_TRACE_DEBUG("No need to jump view. Draw main.");
+       }
 }
 
 int main(int argc, char *argv[])
@@ -939,8 +1061,8 @@ int main(int argc, char *argv[])
                .device_orientation = setting_main_rotate,
        };
 
-       memset(&ad, 0x0, sizeof(setting_main_appdata));
-       //ops.data = &ad;
+
+       memset(&ad, 0x00, sizeof(setting_main_appdata));
 
        //fprintf(stderr, "[TIME] 2. main : %d msec \n", appcore_measure_time());
        //SETTING_TRACE("[TIME] 2. main : %d msec ", appcore_measure_time());