2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FSysSettingInfo.cpp
19 * @brief This is the implementation file for SettingInfo class.
22 #include <FBaseString.h>
23 #include <FSysSettingInfo.h>
25 #include <FBaseSysLog.h>
26 #include <FSys_SettingInfoImpl.h>
27 #include <FSec_AccessController.h>
29 using namespace Tizen::Base;
30 using namespace Tizen::Security;
32 namespace Tizen { namespace System
35 SettingInfo::SettingInfo(void)
36 :__pSettingInfoImpl(null)
40 SettingInfo::~SettingInfo(void)
45 SettingInfo::SetSettingEventListener(ISettingEventListener* pListener)
47 return _SettingInfoImpl::SetSettingEventListener(pListener);
51 SettingInfo::AddSettingEventListener(ISettingEventListener& listener)
53 return _SettingInfoImpl::AddSettingEventListener(listener);
57 SettingInfo::RemoveSettingEventListener(ISettingEventListener& listener)
59 return _SettingInfoImpl::RemoveSettingEventListener(listener);
63 SettingInfo::GetValue(const String& key, String& value)
65 return _SettingInfoImpl::GetValue(key, value);
69 SettingInfo::GetValue(const String& key, int& value)
71 return _SettingInfoImpl::GetValue(key, value);
75 SettingInfo::GetValue(const String& key, long long& value)
77 return _SettingInfoImpl::GetValue(key, value);
81 SettingInfo::GetValue(const String& key, double& value)
83 return _SettingInfoImpl::GetValue(key, value);
87 SettingInfo::GetValue(const String& key, bool& value)
89 return _SettingInfoImpl::GetValue(key, value);
93 SettingInfo::GetValue(const String& key, UuId& value)
95 return _SettingInfoImpl::GetValue(key, value);
99 SettingInfo::SetWallpaper(const String& filePath)
101 result r = E_SUCCESS;
102 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
103 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."));
104 return _SettingInfoImpl::SetWallpaper(filePath);
108 SettingInfo::SetRingtone(const String& filePath)
110 result r = E_SUCCESS;
111 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
112 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."));
113 return _SettingInfoImpl::SetRingtone(filePath);
117 SettingInfo::SetVolume(const String& soundCategory, int level)
119 result r = E_SUCCESS;
120 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
121 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."));
122 return _SettingInfoImpl::SetVolume(soundCategory, level);
126 SettingInfo::GetValueForPrivilegedKey(const String& key, bool& value)
128 return _SettingInfoImpl::GetValueForPrivilegedKey(key, value);
132 SettingInfo::HasKey(const String& key)
134 return _SettingInfoImpl::HasKey(key);
138 SettingInfo::SetValue(const String& key, bool value)
140 result r = E_SUCCESS;
141 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
142 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."));
143 return _SettingInfoImpl::SetValue(key, value);
147 SettingInfo::SetValue(const String& key, int value)
149 result r = E_SUCCESS;
150 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
151 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."));
152 return _SettingInfoImpl::SetValue(key, value);
156 SettingInfo::SetValue(const String& key, String value)
158 result r = E_SUCCESS;
159 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
160 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."));
161 return _SettingInfoImpl::SetValue(key, value);
165 SettingInfo::SetValueForPrivilegedKey(const String& key, bool value)
167 return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
171 SettingInfo::SetValueForPrivilegedKey(const String& key, String value)
173 return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
177 SettingInfo::ResetToFactoryDefault(void)
179 return _SettingInfoImpl::ResetToFactoryDefault();
183 SettingInfo::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
185 result r = E_SUCCESS;
186 r = _AccessController::CheckUserPrivilege(_PRV_SETTING);
187 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."));
188 return _SettingInfoImpl::SetValueAsync(key, value, listener);
192 SettingInfo::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
194 result r = E_SUCCESS;
195 return _SettingInfoImpl::SetValueAsyncForPrivilegedKey(key, value, listener);