2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FSysSettingInfo.cpp
20 * @brief This is the implementation file for SettingInfo class.
23 #include <FBaseString.h>
24 #include <FSysSettingInfo.h>
26 #include <FBaseSysLog.h>
27 #include <FSys_SettingInfoImpl.h>
28 #include <FSec_AccessController.h>
30 using namespace Tizen::Base;
31 using namespace Tizen::Security;
33 namespace Tizen { namespace System
36 SettingInfo::SettingInfo(void)
37 :__pSettingInfoImpl(null)
41 SettingInfo::~SettingInfo(void)
46 SettingInfo::SetSettingEventListener(ISettingEventListener* pListener)
48 return _SettingInfoImpl::SetSettingEventListener(pListener);
52 SettingInfo::AddSettingEventListener(ISettingEventListener& listener)
54 return _SettingInfoImpl::AddSettingEventListener(listener);
58 SettingInfo::RemoveSettingEventListener(ISettingEventListener& listener)
60 return _SettingInfoImpl::RemoveSettingEventListener(listener);
64 SettingInfo::GetValue(const String& key, String& value)
66 return _SettingInfoImpl::GetValue(key, value);
70 SettingInfo::GetValue(const String& key, int& value)
72 return _SettingInfoImpl::GetValue(key, value);
76 SettingInfo::GetValue(const String& key, long long& value)
78 return _SettingInfoImpl::GetValue(key, value);
82 SettingInfo::GetValue(const String& key, double& value)
84 return _SettingInfoImpl::GetValue(key, value);
88 SettingInfo::GetValue(const String& key, bool& value)
90 return _SettingInfoImpl::GetValue(key, value);
94 SettingInfo::GetValue(const String& key, UuId& value)
96 return _SettingInfoImpl::GetValue(key, value);
100 SettingInfo::SetWallpaper(const String& filePath)
102 result r = E_SUCCESS;
103 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
104 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
105 return _SettingInfoImpl::SetWallpaper(filePath);
109 SettingInfo::SetRingtone(const String& filePath)
111 result r = E_SUCCESS;
112 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
113 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
114 return _SettingInfoImpl::SetRingtone(filePath);
118 SettingInfo::SetVolume(const String& soundCategory, int level)
120 result r = E_SUCCESS;
121 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
122 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
123 return _SettingInfoImpl::SetVolume(soundCategory, level);
127 SettingInfo::GetValueForPrivilegedKey(const String& key, bool& value)
129 return _SettingInfoImpl::GetValueForPrivilegedKey(key, value);
133 SettingInfo::HasKey(const String& key)
135 return _SettingInfoImpl::HasKey(key);
139 SettingInfo::SetValue(const String& key, bool value)
141 result r = E_SUCCESS;
142 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
143 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
144 return _SettingInfoImpl::SetValue(key, value);
148 SettingInfo::SetValue(const String& key, int value)
150 result r = E_SUCCESS;
151 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
152 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
153 return _SettingInfoImpl::SetValue(key, value);
157 SettingInfo::SetValue(const String& key, String value)
159 result r = E_SUCCESS;
160 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
161 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
162 return _SettingInfoImpl::SetValue(key, value);
166 SettingInfo::SetValueForPrivilegedKey(const String& key, bool value)
168 return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
172 SettingInfo::SetValueForPrivilegedKey(const String& key, String value)
174 return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
178 SettingInfo::ResetToFactoryDefault(void)
180 return _SettingInfoImpl::ResetToFactoryDefault();
184 SettingInfo::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
186 result r = E_SUCCESS;
187 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
188 SysTryReturn(NID_SYS, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
189 return _SettingInfoImpl::SetValueAsync(key, value, listener);
193 SettingInfo::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
195 result r = E_SUCCESS;
196 return _SettingInfoImpl::SetValueAsyncForPrivilegedKey(key, value, listener);