Apply vconf key path builder
authorJihoon Chung <jihoon.chung@samsung.com>
Sat, 29 Dec 2012 04:25:32 +0000 (13:25 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 2 Jan 2013 02:14:54 +0000 (11:14 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] Replace local define to using common inline function
[SCMRequest] must be imported with wrt-commons
https://tizendev.org/gerrit/#/c/25043/

Change-Id: I2bd0b47debfcb2756a5988c00102eae6ed48545e

src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/widget_install_errors.h
src/jobs/widget_uninstall/task_remove_files.cpp

index 8df7c1a..35ea45f 100644 (file)
@@ -27,6 +27,7 @@
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
+#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/foreach.h>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/log/log.h>
@@ -44,15 +45,6 @@ using namespace WrtDB;
 namespace Jobs {
 namespace WidgetInstall {
 
-namespace {
-const char * const VCONF_KEY_PREFIX = "file/private/";
-const char * const VCONF_KEY_GROUP = "/security";
-const char * const VCONF_KEY_POPUP_USAGE = "/popup_usage";
-const char * const VCONF_KEY_GEOLOCATION_USAGE = "/geolocation_usage";
-const char * const VCONF_KEY_WEB_NOTIFICATION_USAGE = "/web_notification_usage";
-const char * const VCONF_KEY_WEB_DATABASE_USAGE = "/web_database_usage";
-const char * const VCONF_KEY_FILESYSTEM_USAGE = "/filesystem_usage";
-}
 TaskDatabase::TaskDatabase(InstallerContext& context) :
     DPL::TaskDecl<TaskDatabase>(this),
     m_context(context),
@@ -199,21 +191,27 @@ void TaskDatabase::StepRemoveExternalFiles()
 void TaskDatabase::StepCreateVconf()
 {
     LogDebug("StepCreateVconf");
-     std::string keyPrefix =
-        VCONF_KEY_PREFIX
-        + DPL::ToUTF8String(m_context.locations->getPkgname())
-        + VCONF_KEY_GROUP;
-    std::string securityPopupUsageKey = keyPrefix + VCONF_KEY_POPUP_USAGE;
-    std::string geolocationUsageKey = keyPrefix + VCONF_KEY_GEOLOCATION_USAGE;
-    std::string webNotificationUsageKey = keyPrefix + VCONF_KEY_WEB_NOTIFICATION_USAGE;
-    std::string webDatabaseUsageKey = keyPrefix + VCONF_KEY_WEB_DATABASE_USAGE;
-    std::string filesystemUsageKey = keyPrefix + VCONF_KEY_FILESYSTEM_USAGE;
-
-    vconf_set_int(securityPopupUsageKey.c_str(),
+    std::string popupUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyPopupUsage(
+            m_context.locations->getPkgname());
+    std::string geolocationUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
+            m_context.locations->getPkgname());
+    std::string webNotificationUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
+            m_context.locations->getPkgname());
+    std::string webDatabaseUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
+            m_context.locations->getPkgname());
+    std::string filesystemUsageKey =
+        WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
+            m_context.locations->getPkgname());
+
+    vconf_set_int(popupUsageKey.c_str(),
                   static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
     // prevent permission error
-    vconf_unset(securityPopupUsageKey.c_str());
-    vconf_set_int(securityPopupUsageKey.c_str(),
+    vconf_unset(popupUsageKey.c_str());
+    vconf_set_int(popupUsageKey.c_str(),
                   static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
     vconf_set_int(geolocationUsageKey.c_str(),
                   static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
index 7c24dfa..109caff 100644 (file)
@@ -47,7 +47,7 @@ enum Type
     ErrorDeferred,                   ///< Widget installation was deferred and will be continued when possible
     ErrorDatabaseFailure,            ///< Failure in database
     ErrorRemovingFolderFailure,      ///< Failure in removing existing widget folder
-    ErrorCreateVconfFailure,        ///< Failure in creating vconf
+    ErrorCreateVconfFailure,         ///< Failure in creating vconf
     ErrorInstallOspServcie,          ///< Failure in installing osp service
     ErrorUpdateWidget,               ///< Failure in widget update.
     ErrorInstallToExt,               ///< Failure in install to sdcard
index 2d814b4..d7c3157 100644 (file)
@@ -25,6 +25,7 @@
 #include <widget_uninstall/uninstaller_context.h>
 #include <dpl/wrt-dao-rw/widget_dao.h>
 #include <dpl/wrt-dao-ro/widget_config.h>
+#include <dpl/wrt-dao-ro/vconf_config.h>
 #include <dpl/assert.h>
 #include <dpl/utils/wrt_utility.h>
 #include <ail.h>
@@ -178,8 +179,8 @@ void TaskRemoveFiles::StepRemoveExternalLocations()
 void TaskRemoveFiles::StepRemoveVconf()
 {
     std::string key =
-        VCONF_KEY_PREFIX
-        + DPL::ToUTF8String(m_context.locations->getPkgname()) ;
+        WrtDB::VconfConfig::GetVconfKeyRootPath(
+            m_context.locations->getPkgname());
     if(vconf_unset_recursive(key.c_str())) {
         LogError("Fail to unset vconf file");
     } else {