Fix N_SE-13547 and N_SE-13516
[apps/core/preloaded/settings.git] / src / setting.c
index 517ebe4..c702afb 100755 (executable)
@@ -219,32 +219,11 @@ static void setting_main_rotate(enum appcore_rm m, void *data)
 {
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
-       int r;
 
        if (ad == NULL || ad->win_main == NULL)
-               return 0;
-
-#if 0
-       switch (m) {
-       case APPCORE_RM_PORTRAIT_NORMAL:
-               r = 0;
-               break;
-       case APPCORE_RM_PORTRAIT_REVERSE:
-               r = 180;
-               break;
-       case APPCORE_RM_LANDSCAPE_NORMAL:
-               r = 270;
-               break;
-       case APPCORE_RM_LANDSCAPE_REVERSE:
-               r = 90;
-               break;
-       default:
-               r = -1;
-               break;
-       }
-#endif
-       if (r >= 0)
-               elm_win_rotation_with_resize_set(ad->win_main, r);
+               return;
+
+       elm_win_rotation_with_resize_set(ad->win_main, m);
 }
 #endif
 
@@ -443,6 +422,15 @@ static void setting_other_vconf_change_cb(keynode_t *key, void *data)
                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);
@@ -861,6 +849,17 @@ static int setting_main_app_reset(service_h service, void *data)
        SETTING_TRACE_BEGIN;
        setting_main_appdata *ad = data;
 
+       int value = 0;
+       vconf_get_bool (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
+       SETTING_TRACE("value:%d", value);
+       if (!value) //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);
+       }
+
 #if SUPPORT_LIVEBOX_DEMO
        char *ug_name = NULL;
        if(b != NULL)