|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: s_spproperty.cpp |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <spproperty.h> |
|
19 |
|
20 TServicePropertyName gPropertyName = EPropertyUnknown; |
|
21 TInt gContactViewPluginId = 0; |
|
22 HBufC* gPropertyContactStoreId = 0; |
|
23 HBufC* gPropertyBrandId = 0; |
|
24 TBool gPropertyInvalid = EFalse; |
|
25 TInt gPropertyBrandLanguage = 0; |
|
26 TInt gPropertyBrandVersion = 0; |
|
27 TInt gPropertyXIMP = 0; |
|
28 TOnOff gPropertyPresenceRequestPreference = EOff; |
|
29 TInt gContactViewId = 0; |
|
30 |
|
31 TOnOff gPropertyVoIPEnabled = EOff; |
|
32 TInt gPropertyPresenceSettingsId = 0; |
|
33 TInt gPropertyIMSettingsId = 0; |
|
34 TInt gPropertyPCSPluginId = 0; |
|
35 |
|
36 CSPProperty* CSPProperty::NewL() |
|
37 { |
|
38 return new ( ELeave ) CSPProperty; |
|
39 } |
|
40 |
|
41 |
|
42 CSPProperty* CSPProperty::NewLC() |
|
43 { |
|
44 |
|
45 CSPProperty* self = new ( ELeave ) CSPProperty; |
|
46 CleanupStack::PushL( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 CSPProperty::~CSPProperty(){} |
|
51 |
|
52 |
|
53 TServicePropertyName CSPProperty::GetName() const |
|
54 { |
|
55 return iPropertyName; |
|
56 } |
|
57 |
|
58 |
|
59 TInt CSPProperty::SetName( TServicePropertyName aPropertyname ) |
|
60 { |
|
61 iPropertyName = aPropertyname; |
|
62 return KErrNone; |
|
63 } |
|
64 |
|
65 |
|
66 TSPItemType CSPProperty::GetPropertyType() const |
|
67 { |
|
68 TSPItemType type = EItemTypeNotDefined; |
|
69 return type; |
|
70 } |
|
71 |
|
72 |
|
73 TInt CSPProperty::SetPropertyType( TSPItemType /*aPropertyType*/ ){ return KErrNone; } |
|
74 |
|
75 |
|
76 TPropertyDataType CSPProperty::GetDataType() const |
|
77 { |
|
78 TPropertyDataType type = EDataTypeNotSet; |
|
79 return type; |
|
80 } |
|
81 |
|
82 |
|
83 void CSPProperty::SetDataType( TPropertyDataType /*aDataType*/ ){} |
|
84 |
|
85 |
|
86 TInt CSPProperty::GetValue( TInt& aValue ) const |
|
87 { |
|
88 if( gPropertyInvalid ) |
|
89 { |
|
90 return KErrNotFound; |
|
91 } |
|
92 |
|
93 if( GetName() == EPropertyContactViewPluginId ) |
|
94 { |
|
95 aValue = gContactViewPluginId; |
|
96 } |
|
97 else if( GetName() == EPropertyBrandLanguage ) |
|
98 { |
|
99 aValue = gPropertyBrandLanguage; |
|
100 } |
|
101 else if( GetName() == EPropertyBrandVersion ) |
|
102 { |
|
103 aValue = gPropertyBrandVersion; |
|
104 } |
|
105 else if( GetName() == EPropertyPCSPluginId ) |
|
106 { |
|
107 aValue = gPropertyXIMP; |
|
108 } |
|
109 else if( GetName() == EPropertyContactViewId ) |
|
110 { |
|
111 aValue = gContactViewId; |
|
112 } |
|
113 else if( GetName() == ESubPropertyPresenceSettingsId ) |
|
114 { |
|
115 aValue = gPropertyPresenceSettingsId; |
|
116 } |
|
117 else if( GetName() == ESubPropertyIMSettingsId ) |
|
118 { |
|
119 aValue = gPropertyIMSettingsId; |
|
120 } |
|
121 else if( GetName() == EPropertyPCSPluginId ) |
|
122 { |
|
123 aValue = gPropertyPCSPluginId; |
|
124 } |
|
125 |
|
126 return KErrNone; |
|
127 } |
|
128 |
|
129 TInt CSPProperty::SetValue( TInt aValue ) |
|
130 { |
|
131 if( GetName() == EPropertyContactViewPluginId ) |
|
132 { |
|
133 gContactViewPluginId = aValue; |
|
134 } |
|
135 else if( GetName() == EPropertyBrandLanguage ) |
|
136 { |
|
137 gPropertyBrandLanguage = aValue; |
|
138 } |
|
139 else if( GetName() == EPropertyBrandVersion ) |
|
140 { |
|
141 gPropertyBrandVersion = aValue; |
|
142 } |
|
143 else if( GetName() == EPropertyPCSPluginId ) |
|
144 { |
|
145 gPropertyXIMP = aValue; |
|
146 } |
|
147 else if( GetName() == EPropertyContactViewId ) |
|
148 { |
|
149 gContactViewId = aValue ; |
|
150 } |
|
151 else if( GetName() == ESubPropertyPresenceSettingsId ) |
|
152 { |
|
153 gPropertyPresenceSettingsId = aValue ; |
|
154 } |
|
155 else if( GetName() == ESubPropertyIMSettingsId ) |
|
156 { |
|
157 gPropertyIMSettingsId = aValue ; |
|
158 } |
|
159 else if( GetName() == EPropertyPCSPluginId ) |
|
160 { |
|
161 gPropertyPCSPluginId = aValue ; |
|
162 } |
|
163 |
|
164 |
|
165 return KErrNone; |
|
166 } |
|
167 |
|
168 |
|
169 TInt CSPProperty::GetValue( TDes& aValue ) const |
|
170 { |
|
171 if( gPropertyInvalid ) |
|
172 { |
|
173 return KErrNotFound; |
|
174 } |
|
175 if( GetName() == EPropertyContactStoreId ) |
|
176 { |
|
177 if (gPropertyContactStoreId) |
|
178 { |
|
179 aValue.Copy(*gPropertyContactStoreId); |
|
180 } |
|
181 } |
|
182 else if( GetName() == EPropertyBrandId ) |
|
183 { |
|
184 if (gPropertyBrandId) |
|
185 { |
|
186 aValue.Copy(*gPropertyBrandId); |
|
187 } |
|
188 } |
|
189 |
|
190 return KErrNone; |
|
191 } |
|
192 |
|
193 TInt CSPProperty::SetValue( const TDesC& aValue ) |
|
194 { |
|
195 if( GetName() == EPropertyContactStoreId ) |
|
196 { |
|
197 |
|
198 if (gPropertyContactStoreId) |
|
199 { |
|
200 delete gPropertyContactStoreId; |
|
201 gPropertyContactStoreId = NULL; |
|
202 } |
|
203 |
|
204 gPropertyContactStoreId = aValue.Alloc(); |
|
205 } |
|
206 else if( GetName() == EPropertyBrandId ) |
|
207 { |
|
208 if (gPropertyBrandId) |
|
209 { |
|
210 delete gPropertyBrandId; |
|
211 gPropertyBrandId = NULL; |
|
212 } |
|
213 gPropertyBrandId = aValue.Alloc(); |
|
214 } |
|
215 |
|
216 return KErrNone; |
|
217 } |
|
218 |
|
219 TInt CSPProperty::GetValue( TOnOff& aValue ) const |
|
220 { |
|
221 if( gPropertyInvalid ) |
|
222 { |
|
223 return KErrNotFound; |
|
224 } |
|
225 |
|
226 if( GetName() == ESubPropertyPresenceRequestPreference ) |
|
227 { |
|
228 aValue = gPropertyPresenceRequestPreference; |
|
229 } |
|
230 else if( GetName() == ESubPropertyVoIPEnabled ) |
|
231 { |
|
232 aValue = gPropertyVoIPEnabled; |
|
233 } |
|
234 |
|
235 return KErrNone; |
|
236 } |
|
237 |
|
238 |
|
239 TInt CSPProperty::SetValue( TOnOff aValue ) |
|
240 { |
|
241 if( gPropertyInvalid ) |
|
242 { |
|
243 return KErrNotFound; |
|
244 } |
|
245 |
|
246 if( GetName() == ESubPropertyPresenceRequestPreference ) |
|
247 { |
|
248 gPropertyPresenceRequestPreference = aValue; |
|
249 } |
|
250 else if( GetName() == ESubPropertyVoIPEnabled ) |
|
251 { |
|
252 gPropertyVoIPEnabled = aValue; |
|
253 } |
|
254 |
|
255 return KErrNone; |
|
256 } |
|
257 |
|
258 |
|
259 TInt CSPProperty::SetValueNoDataTypeCheck( const TDesC& /*aValue*/ ){ return KErrNone; } |
|
260 |
|
261 |
|
262 TPropertyDataType CSPProperty::DataType( TServicePropertyName /*aProperty*/ ) |
|
263 { |
|
264 TPropertyDataType type = EDataTypeNotSet; |
|
265 return type; |
|
266 } |
|
267 |
|
268 |
|
269 TSPItemType CSPProperty::PropertyType( TServicePropertyName /*aProperty*/ ) |
|
270 { |
|
271 TSPItemType type = EItemTypeNotDefined; |
|
272 return type; |
|
273 } |
|
274 |
|
275 |
|
276 void CSPProperty::CopyL( const CSPProperty& aSource ) |
|
277 { |
|
278 iPropertyName = aSource.GetName(); |
|
279 |
|
280 if( GetName() == EPropertyContactStoreId ) |
|
281 { |
|
282 HBufC* value = HBufC::NewLC(500); |
|
283 TPtr valuePtr = value->Des(); |
|
284 aSource.GetValue(valuePtr); |
|
285 SetValue( valuePtr ); |
|
286 |
|
287 CleanupStack::PopAndDestroy(value); |
|
288 } |
|
289 else if( GetName() == EPropertyBrandId ) |
|
290 { |
|
291 HBufC* value = HBufC::NewLC(500); |
|
292 TPtr valuePtr = value->Des(); |
|
293 aSource.GetValue(valuePtr); |
|
294 SetValue( valuePtr ); |
|
295 |
|
296 CleanupStack::PopAndDestroy(value); |
|
297 } |
|
298 else if( GetName() == EPropertyContactViewPluginId ) |
|
299 { |
|
300 TInt value = 0; |
|
301 aSource.GetValue( value ); |
|
302 SetValue( value ); |
|
303 } |
|
304 |
|
305 } |
|
306 |
|
307 |
|
308 TBool CSPProperty::CSPProperty::operator==( |
|
309 const CSPProperty& /*aProperty*/ ) const{ return ETrue; } |
|
310 |
|
311 CSPProperty::CSPProperty(){} |
|
312 |
|
313 void CSPProperty::ConstructL(){} |
|
314 |
|
315 |
|
316 TInt SetDefaultValue( TServicePropertyName /*aProperty*/ ){ return KErrNone; } |
|
317 |