bug fix on 3rd lock app list and control
authorMyoungJune Park <mj2004.park@samsung.com>
Fri, 19 Apr 2013 13:26:36 +0000 (22:26 +0900)
committerMyoungJune Park <mj2004.park@samsung.com>
Fri, 19 Apr 2013 14:31:24 +0000 (23:31 +0900)
Change-Id: Ibb7ff3f144b5d6381cd78102cbfab003d131c5fd

packaging/org.tizen.setting.spec
setting-security/src/setting-security-locktype.c
setting-security/src/setting-security-main.c

index 46f9488c8ac2ad932a66e7266978a352efa66f06..5db1ffb9ab66d5abc0a6ec453a476b47be5836ce 100755 (executable)
@@ -252,7 +252,7 @@ GOPTION="-g 6514"
        rm -rf /opt/data/setting/set_info
        #vconftool $GOPTION set -t string db/setting/privacy_passwd ""
        vconftool $GOPTION set -t int db/setting/screen_lock_type "1" -f
-       vconftool $GOPTION set -t string db/setting/3rd_lock_pkg_name ""
+       vconftool $GOPTION set -t string db/setting/3rd_lock_pkg_name "org.tizen.lockscreen"
        # NOT USED NOW.
        #vconftool $GOPTION set -t bool db/setting/rcs "0"
 
index 36a74ca98352a27885afeb8e5c61e7a1abecfa58..b53a1ce7d0704376355179ed98cca21e0f8d8266 100755 (executable)
@@ -88,12 +88,12 @@ static char* __get_lockapp_pkgname_from_appname(char *app_name)
        for(; item != NULL; item = item->next)
        {
                if(safeStrCmp(item->app_name, app_name) == 0)
-                       return item->app_name;
+                       //return item->app_name;
+                       return item->pkg_name;
        }
        return NULL;
 }
 
-//ail_cb_ret_e __get_appinfo_cb(const ail_appinfo_h appinfo, void *user_data)
 int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
 {
        SETTING_TRACE_BEGIN;
@@ -106,41 +106,36 @@ int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
 
        openlock_appdata *item = lockapp_data;
        openlock_appdata *new_item = NULL;
-       char *pkg_name = NULL;
        char *app_name = NULL;
        char *app_id = NULL;
-       ail_appinfo_h ai;
+       ail_appinfo_h handle;
        int ret = 0;
 
-       //ret = pkgmgrinfo_appinfo_get_pkgname(appinfo, &pkg_name);
        ret = pkgmgrinfo_appinfo_get_appid(appinfo, &app_id);
-
-       //ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
-       //ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &app_name);
        if(ret != 0 || !app_id)
        {
                SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_get_appid returns error");
                return -1;
        }
 
-       ret = ail_get_appinfo(app_id, &ai);
+       ret = ail_get_appinfo(app_id, &handle);
        if(ret != AIL_ERROR_OK)
        {
                SETTING_TRACE_DEBUG("ail_get_appinfo() returns error");
                return -1;
        }
-       ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &app_name);
-       ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
+       ail_appinfo_get_str(handle, AIL_PROP_NAME_STR, &app_name);
 
-       if(!app_name || !pkg_name)
+       if(!app_name)
        {
                SETTING_TRACE_DEBUG("ail_appinfo_get_str() returns error");
-               ail_destroy_appinfo(ai);
+               ail_destroy_appinfo(handle);
                return -1;
        }
        SETTING_TRACE_DEBUG("app_name %s", app_name);
-       SETTING_TRACE_DEBUG("pkg_name %s", pkg_name);
-       
+       SETTING_TRACE_DEBUG("app_id %s", app_id);// format : 1234567890.AppName
+
+
        while(item->next != NULL)
                item = item->next;
 
@@ -148,10 +143,10 @@ int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
        {
                SETTING_TRACE_DEBUG("first app");
                /* first app */
-               item->pkg_name = (char*)strdup(pkg_name);
-               item->app_name = (char*)strdup(app_name);
+               item->app_name = (char*)strdup(app_name);               // for display
+               item->pkg_name = (char*)strdup(app_id);                 // for vconf
 
-               if(!pkg_name && !app_name)
+               if(!app_id && !app_name)
                        SETTING_TRACE_DEBUG("app info %d %s %s", item->index, item->pkg_name, item->app_name);
        }
        else
@@ -162,13 +157,13 @@ int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
                if(new_item != NULL)
                {
                        memset(new_item, 0x00, sizeof(openlock_appdata));
-                       new_item->pkg_name = (char*)strdup(pkg_name);
-                       new_item->app_name = (char*)strdup(app_name);
+                       new_item->app_name = (char*)strdup(app_name);           // for display
+                       new_item->pkg_name = (char*)strdup(app_id);                     // for vconf
                        new_item->index = item->index + 1;
                        new_item->prev = item;
                        item->next = new_item;
 
-                       if(!pkg_name && !app_name)
+                       if(!app_id && !app_name)
                                SETTING_TRACE_DEBUG("app info %d %s %s", new_item->index, new_item->pkg_name, new_item->app_name);
                }
                else
@@ -176,7 +171,7 @@ int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
                        SETTING_TRACE_DEBUG("malloc() failed");
                }
        }
-       return 0; //AIL_CB_RET_CONTINUE;
+       return 0;
 }
 
 static int __add_3rd_party_lock(void *data)
@@ -188,24 +183,23 @@ static int __add_3rd_party_lock(void *data)
        SettingSecurityUG *ad = (SettingSecurityUG *) data;
 
        /* Get info from AIL */
-       pkgmgrinfo_appinfo_filter_h filter;             //ail_filter_h filter;
-       int ret = 0;                                                    //ail_error_e ret;
-       int count = -1;                                                 //int count = 0;
+       pkgmgrinfo_appinfo_filter_h filter;
+       int ret = 0;
+       int count = -1;
 
-       ret = pkgmgrinfo_appinfo_filter_create(&filter);        //ret = ail_filter_new(&filter);
-       if(ret > 0)             //if(ret != AIL_ERROR_OK)
+       ret = pkgmgrinfo_appinfo_filter_create(&filter);
+       if(ret > 0)
        {
-               SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_filter_create() failed"); //SETTING_TRACE_DEBUG("ail_filter_new() failed");
+               SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_filter_create() failed");
                return;
        }
        ret = pkgmgrinfo_appinfo_filter_add_string(filter, PMINFO_APPINFO_PROP_APP_CATEGORY, "http://tizen.org/category/lockapp");
-       //ret = ail_filter_add_str(filter, AIL_PROP_CATEGORIES_STR, "lockscreen");
-       ret = pkgmgrinfo_appinfo_filter_count(filter, &count);  ////ret = ail_filter_count_appinfo(filter, &count);
+       ret = pkgmgrinfo_appinfo_filter_count(filter, &count);
        SETTING_TRACE_DEBUG("There is/are %d 3rd lock app(s)", count);
        if(count <= 0)
        {
                SETTING_TRACE_DEBUG("No 3rd lock app");
-               pkgmgrinfo_appinfo_filter_destroy(filter);      //ail_filter_destroy(filter);
+               pkgmgrinfo_appinfo_filter_destroy(filter);
                return;
 
        }
@@ -223,8 +217,8 @@ static int __add_3rd_party_lock(void *data)
        lockapp_data->app_name = NULL;
        lockapp_data->index = 0;
 
-       pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, __get_appinfo_cb, NULL);      //ail_filter_list_appinfo_foreach(filter, __get_appinfo_cb, ad);
-       pkgmgrinfo_appinfo_filter_destroy(filter);      //ail_filter_destroy(filter);
+       pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, __get_appinfo_cb, NULL);
+       pkgmgrinfo_appinfo_filter_destroy(filter);
 
        /* Add to genlist */
        openlock_appdata *list = lockapp_data;
@@ -257,6 +251,10 @@ static int __add_3rd_party_lock(void *data)
        SETTING_TRACE_END;
 }
 
+
+/**
+ * create the lock type list
+ */
 void __add_locktype_items(void *data)
 {
        SETTING_TRACE_BEGIN;
@@ -282,6 +280,7 @@ void __add_locktype_items(void *data)
 
        //evas_object_smart_callback_add(ad->sl_scroller, "realized", __gl_realized_cb, NULL);
 
+       // [FLOW] add default lock type
        /* to do : radio menu */
        /* 1) swipe */
        ad->data_locktype_swipe =
@@ -300,7 +299,7 @@ void __add_locktype_items(void *data)
                SETTING_TRACE_ERROR("item_data is NULL");
        }
 
-       /* Add 3rd party lock apps in list. */
+       /* [FLOW] Add 3rd party lock apps in list. */
        index = __add_3rd_party_lock(ad);
 
        /* update info */
@@ -309,7 +308,8 @@ void __add_locktype_items(void *data)
        {
                char *open_lock_name = NULL;
                open_lock_name = vconf_get_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
-               index = __get_index_of_lockapp(open_lock_name);
+               //index = __get_index_of_lockapp(open_lock_name);       // <-- symbol mismatch ?
+               index = __get_lockapp_index_from_pkgname(open_lock_name);
 
                if(open_lock_name)
                        FREE(open_lock_name);
@@ -394,6 +394,9 @@ static int setting_security_locktype_cleanup(void *cb)
  **
  ****************************************************/
 
+/**
+ * select each item of the list
+ */
 static void
 setting_security_locktype_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
                                               void *event_info)
@@ -442,6 +445,7 @@ setting_security_locktype_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
                        vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type);
                        /* set radio */
                        elm_radio_value_set(list_item->eo_check, lock_type + index);
+                       ug_destroy_me(ad->ug);
                        break;
                default:
                        break;
index 831f998c2670a2b874000e88c5ec10a98e93bb1d..e6091b29f10a0f1e882bb097561d91678eab94c2 100755 (executable)
@@ -108,6 +108,7 @@ static int setting_security_main_create(void *cb)
 
        Elm_Object_Item *item = NULL;
 
+       //item_data->sub_desc = (char *)g_strdup(sub_desc);
        /* Screen lock type */
        ad->data_screen_lock_type = setting_create_Gendial_field_def(scroller, &(ad->itc_2text_2),
                                                                setting_security_main_mouse_up_Gendial_list_cb,ad,
@@ -183,9 +184,14 @@ static int setting_security_main_update(void *cb)
        retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
 
        SettingSecurityUG *ad = (SettingSecurityUG *) cb;
-
        evas_object_show(ad->ly_main);
 
+       if (ad->data_screen_lock_type ) {
+               G_FREE(ad->data_screen_lock_type->sub_desc);
+               ad->data_screen_lock_type->sub_desc = (char *)g_strdup(get_pa_screen_lock_type_str(ad));
+               elm_genlist_item_update(ad->data_screen_lock_type->item);
+       }
+
        return SETTING_RETURN_SUCCESS;
 }