Merge "support haptic"
[apps/core/preloaded/settings.git] / src / setting-main.c
index 5c448af..7898d1c 100755 (executable)
@@ -590,6 +590,8 @@ void __load_connectivity_menu_list(void *data, Cfg_Item_Position inputPos, Evas_
                                        continue; /* hide Network in Emulator*/
                                } else if (!safeStrCmp(KeyStr_Bluetooth, keyStr)) {
                                        continue; /* hide Bluetooth in Emulator*/
+                               } else if (!safeStrCmp(KeyStr_MobileAP, keyStr)) {
+                                       continue; /* hide Tethering in Emulator*/
                                } else {
                                        /* do nothing */
                                }
@@ -773,6 +775,8 @@ void __load_system_menu_list(void *data, Cfg_Item_Position inputPos, Evas_Object
                                int value = 0;
                                vconf_get_bool
                                    (VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, &value);
+                               // true  : auto rotation OFF
+                               // false : auto rotation ON
                                value = !value;
 
                                ad->data_rotationMode =
@@ -955,10 +959,10 @@ static void __load_applications_level_all_list(void *data)
 bool is_3rdapp_installed_setting_cfg(char* pkgname)
 {
        SETTING_TRACE_BEGIN;
-       // /opt/apps/
+       // /usr/apps/
        char path[512];
 
-       if (snprintf(path, 512, "/opt/apps/%s/setting/setting.xml", pkgname) < 0)
+       if (snprintf(path, 512, "/usr/apps/%s/setting/setting.xml", pkgname) < 0)
                return false;
 
        struct stat st;
@@ -989,7 +993,7 @@ static void draw_3rdapp(void* data, char* name, char* pkgname)
        //3rd cfg
        char fullpath[512];
 
-       if (snprintf(fullpath, 512, "/opt/apps/%s/setting/setting.xml", pkgname) < 0)
+       if (snprintf(fullpath, 512, "/usr/apps/%s/setting/setting.xml", pkgname) < 0)
                return false;
 
        SETTING_TRACE(" fullpath : %s", fullpath);
@@ -1402,40 +1406,61 @@ static void __btnback_clicked_cb(void *data, Evas_Object *obj, void *event_info)
        elm_win_lower(ad->win_main);
 }
 
+static Eina_Bool __refresh_on_idle(void *data)
+{
+       SETTING_TRACE_BEGIN;
+       retv_if(!data, FALSE);
+       setting_main_appdata *ad = data;
+       if (MAIN_PROFILE_ALL == ad->profile_type)
+       {
+               ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
+               ad->load_fns[Func_Type_System] = __load_system_level_all_list;
+               ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
+               ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
+               setting_main_refresh(ad);
+       }
+       else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
+       {
+               ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
+               ad->load_fns[Func_Type_System] = __load_system_level0_list;
+               ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
+               ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
+               setting_main_refresh(ad);
+       }
+       ad->refresh_idler = NULL;
+       return FALSE;
+}
+
 static void __allFrequent_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
        SETTING_TRACE_BEGIN;
        ret_if(!data || !obj);
        setting_main_appdata *ad = (setting_main_appdata *) data;
+       //if already has the task,cancel the old task with ecore_idler_del,then add new idler task.
+       if (ad->refresh_idler) {
+               ecore_idler_del(ad->refresh_idler);
+               ad->refresh_idler = NULL;
+       }
+
        Elm_Object_Item *item = elm_toolbar_first_item_get(obj);
        ret_if(!item);
-
        if (MAIN_PROFILE_ALL == ad->profile_type)
        {
                SETTING_TRACE("Change to Preferred view");
                elm_object_item_text_set(item, _(ALL_STR));
                ad->profile_type = MAIN_PROFILE_PREFERRED;
-               ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level0_list;
-               ad->load_fns[Func_Type_System] = __load_system_level0_list;
-               ad->load_fns[Func_Type_Apps] = __load_applications_level0_list;
-               ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level0_list;
-               setting_main_refresh(ad);
        }
        else if (MAIN_PROFILE_PREFERRED == ad->profile_type)
        {
                SETTING_TRACE("Change to ALL view");
                elm_object_item_text_set(item, _(PREFERRED_STR));
                ad->profile_type = MAIN_PROFILE_ALL;
-               ad->load_fns[Func_Type_Connectivity] = __load_connectivity_level_all_list;
-               ad->load_fns[Func_Type_System] = __load_system_level_all_list;
-               ad->load_fns[Func_Type_Apps] = __load_applications_level_all_list;
-               ad->load_fns[Func_Type_DownApp] = __load_downloaded_apps_level_all_list;
-               setting_main_refresh(ad);
        }
        else
        {
                return;
        }
+       ad->refresh_idler = ecore_idler_add((Ecore_Task_Cb) __refresh_on_idle, ad);
 }
 
 /**
@@ -1825,6 +1850,10 @@ static int setting_main_destroy(void *cb)
                //already not exsit
                return SETTING_RETURN_SUCCESS;
        }
+       if (ad->refresh_idler) {
+               ecore_idler_del(ad->refresh_idler);
+               ad->refresh_idler = NULL;
+       }
 
        if (ad->handle) {
                int tapi_ret = tel_deinit(ad->handle);
@@ -2204,6 +2233,27 @@ setting_main_click_list_plugin_cb(void *data, Evas_Object *obj,
 #endif
 }
 
+/**
+ * @see [caller] setting_main_list_mouse_up_cb
+ * @see [caller] setting_main_sel_list_mouse_up_cb
+ */
+static void __rotate_lock_handler(int chk_status, setting_main_appdata *ad )
+{
+       SETTING_TRACE_BEGIN;
+       if( chk_status == 1)
+       {
+               // toggle : 0 --> 1
+               int angle = elm_win_rotation_get(ad->win_main);
+               elm_win_rotation_with_resize_set(ad->win_main, angle);
+       } else {
+               elm_win_rotation_with_resize_set(ad->win_main, 0);
+       }
+       vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, !chk_status);
+}
+
+/**
+ * toggle cb
+ */
 void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
                                          void *event_info)
 {
@@ -2216,7 +2266,7 @@ void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
 
        SETTING_TRACE("change radio[%s], status is:%d", _(list_item->keyStr),
                      list_item->chk_status);
-       /*setting_main_appdata *ad = g_main_ad;*/
+       setting_main_appdata *ad = g_main_ad;
 
        if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
                int err;
@@ -2231,12 +2281,15 @@ void setting_main_list_mouse_up_cb(void *data, Evas_Object *eo,
                }
 
        } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
-               vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, ! list_item->chk_status);
+               __rotate_lock_handler(list_item->chk_status, ad);
        }
 
        return;
 }
 
+/**
+ * genlist touch cb
+ */
 void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
                                              void *event_info)
 {
@@ -2250,9 +2303,12 @@ void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
            (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
 
        list_item->chk_status = elm_check_state_get(list_item->eo_check);
+
        /* new status */
+    list_item->chk_status = !list_item->chk_status;
+    elm_check_state_set(list_item->eo_check, list_item->chk_status);
 
-       /*setting_main_appdata *ad = (setting_main_appdata *) data;*/
+       setting_main_appdata *ad = (setting_main_appdata *) data;
 
        if (!safeStrCmp(KeyStr_UsePacketData, list_item->keyStr)) {
                /* setting_reset_slp_key_by_status(eo, BOOL_SLP_SETTING_USE_PACKET_DATA); */
@@ -2261,7 +2317,7 @@ void setting_main_sel_list_mouse_up_cb(void *data, Evas_Object *eo,
                                         list_item->chk_status, &err);
 
        } else if (!safeStrCmp(KeyStr_Landscape, list_item->keyStr)) {
-               vconf_set_bool(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, (list_item->chk_status));
+               __rotate_lock_handler(list_item->chk_status, ad);
        }
 
        return;