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