Fix the boiler plate codes
[platform/framework/native/appfw.git] / src / system / FSysSettingInfo.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file                FSysSettingInfo.cpp
19  * @brief               This is the implementation file for SettingInfo class.
20  */
21
22 #include <FBaseString.h>
23 #include <FSysSettingInfo.h>
24
25 #include <FBaseSysLog.h>
26 #include <FSys_SettingInfoImpl.h>
27 #include <FSec_AccessController.h>
28
29 using namespace Tizen::Base;
30 using namespace Tizen::Security;
31
32 namespace Tizen { namespace System
33 {
34
35 SettingInfo::SettingInfo(void)
36         :__pSettingInfoImpl(null)
37 {
38 }
39
40 SettingInfo::~SettingInfo(void)
41 {
42 }
43
44 result
45 SettingInfo::SetSettingEventListener(ISettingEventListener* pListener)
46 {
47         return _SettingInfoImpl::SetSettingEventListener(pListener);
48 }
49
50 result
51 SettingInfo::AddSettingEventListener(ISettingEventListener& listener)
52 {
53         return _SettingInfoImpl::AddSettingEventListener(listener);
54 }
55
56 result
57 SettingInfo::RemoveSettingEventListener(ISettingEventListener& listener)
58 {
59         return _SettingInfoImpl::RemoveSettingEventListener(listener);
60 }
61
62 result
63 SettingInfo::GetValue(const String& key, String& value)
64 {
65         return _SettingInfoImpl::GetValue(key, value);
66 }
67
68 result
69 SettingInfo::GetValue(const String& key, int& value)
70 {
71         return _SettingInfoImpl::GetValue(key, value);
72 }
73
74 result
75 SettingInfo::GetValue(const String& key, long long& value)
76 {
77         return _SettingInfoImpl::GetValue(key, value);
78 }
79
80 result
81 SettingInfo::GetValue(const String& key, double& value)
82 {
83         return _SettingInfoImpl::GetValue(key, value);
84 }
85
86 result
87 SettingInfo::GetValue(const String& key, bool& value)
88 {
89         return _SettingInfoImpl::GetValue(key, value);
90 }
91
92 result
93 SettingInfo::GetValue(const String& key, UuId& value)
94 {
95         return _SettingInfoImpl::GetValue(key, value);
96 }
97
98 result
99 SettingInfo::SetWallpaper(const String& filePath)
100 {
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);
105 }
106
107 result
108 SettingInfo::SetRingtone(const String& filePath)
109 {
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);
114 }
115
116 result
117 SettingInfo::SetVolume(const String& soundCategory, int level)
118 {
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);
123 }
124
125 result 
126 SettingInfo::GetValueForPrivilegedKey(const String& key, bool& value)
127 {
128         return _SettingInfoImpl::GetValueForPrivilegedKey(key, value);
129 }
130
131 bool
132 SettingInfo::HasKey(const String& key)
133 {
134         return _SettingInfoImpl::HasKey(key);
135 }
136
137 result 
138 SettingInfo::SetValue(const String& key, bool value)
139 {
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);
144 }
145
146 result 
147 SettingInfo::SetValue(const String& key, int value)
148 {
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);
153 }
154
155 result 
156 SettingInfo::SetValue(const String& key, String value)
157 {
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);
162 }
163
164 result 
165 SettingInfo::SetValueForPrivilegedKey(const String& key, bool value)
166 {
167         return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
168 }
169
170 result 
171 SettingInfo::SetValueForPrivilegedKey(const String& key, String value)
172 {
173         return _SettingInfoImpl::SetValueForPrivilegedKey(key, value);
174 }
175
176 result 
177 SettingInfo::ResetToFactoryDefault(void)
178 {
179         return _SettingInfoImpl::ResetToFactoryDefault();
180 }
181
182 result 
183 SettingInfo::SetValueAsync(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
184 {
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);
189 }
190
191 result 
192 SettingInfo::SetValueAsyncForPrivilegedKey(const String& key, bool value, ISettingInfoSetValueAsyncResultListener* listener)
193 {
194         result r = E_SUCCESS;
195         return _SettingInfoImpl::SetValueAsyncForPrivilegedKey(key, value, listener);
196 }
197
198 } } // Tizen::System