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