From: Jihoon Chung Date: Sat, 29 Dec 2012 04:25:32 +0000 (+0900) Subject: Apply vconf key path builder X-Git-Tag: submit/trunk/20130102.022110~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dcc9a0394a0857a27983085afaa2de7e7562642d;p=platform%2Fframework%2Fweb%2Fwrt-installer.git Apply vconf key path builder [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 --- diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 8df7c1a..35ea45f 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -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(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(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(WrtDB::SETTINGS_TYPE_ON)); vconf_set_int(geolocationUsageKey.c_str(), static_cast(WrtDB::SETTINGS_TYPE_ON)); diff --git a/src/jobs/widget_install/widget_install_errors.h b/src/jobs/widget_install/widget_install_errors.h index 7c24dfa..109caff 100644 --- a/src/jobs/widget_install/widget_install_errors.h +++ b/src/jobs/widget_install/widget_install_errors.h @@ -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 diff --git a/src/jobs/widget_uninstall/task_remove_files.cpp b/src/jobs/widget_uninstall/task_remove_files.cpp index 2d814b4..d7c3157 100644 --- a/src/jobs/widget_uninstall/task_remove_files.cpp +++ b/src/jobs/widget_uninstall/task_remove_files.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -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 {