|
1 /* |
|
2 * Copyright (c) 2005 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: Container for contact list settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef __CPENGCONTACTLISTSETTINGS_H__ |
|
21 #define __CPENGCONTACTLISTSETTINGS_H__ |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32base.h> |
|
25 #include "MPEngContactListProperties.h" |
|
26 #include "TPEngContactListBaseSettings.h" |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 /** |
|
31 * Contact list TInt property name. |
|
32 * Property level: KPEngCntLstPropertyNativeCached |
|
33 * |
|
34 * Has contact list been synchronized |
|
35 * |
|
36 * Possible property values: |
|
37 * - 0: (Default) not synchronized |
|
38 * - 1: synchronized |
|
39 */ |
|
40 const TUint KPEngHasBeenSynchronized = 0x0000101; // 257 |
|
41 |
|
42 |
|
43 /** |
|
44 * Contact list TInt property name. |
|
45 * Property level: KPEngCntLstPropertyNativeCached |
|
46 * |
|
47 * Does contact list exist on the server |
|
48 * |
|
49 * Possible property values: |
|
50 * - 0: (Default) Does not exist on server |
|
51 * - 1: list exists on the server |
|
52 */ |
|
53 const TUint KPEngListExistsOnServer = 0x0000103; //259 |
|
54 |
|
55 /** |
|
56 * Contact list TInt property name. |
|
57 * Property level: KPEngCntLstPropertyNativeCached |
|
58 * |
|
59 * Update of the contact list properties needed |
|
60 * |
|
61 * Possible property values: |
|
62 * - 0: (Default) not updated required |
|
63 * - 1: updated required |
|
64 */ |
|
65 const TUint KPEngPropertiesUpdateNeeded = 0x0000104; //260 |
|
66 |
|
67 /** |
|
68 * Contact list TInt property name. |
|
69 * Property level: KPEngCntLstPropertyNativeCached |
|
70 * |
|
71 * Should contact list be deleted from server |
|
72 * |
|
73 * Possible property values: |
|
74 * - 0: (Default) no delete needed |
|
75 * - 1: Delete of the contact list needed |
|
76 */ |
|
77 const TUint KPEngContactListDeleteNeeded = 0x0000105; //261 |
|
78 |
|
79 /** |
|
80 * Contact list TInt property name. |
|
81 * Property level: KPEngCntLstPropertyNativeCached |
|
82 * |
|
83 * Flag if update of the subscription is needed |
|
84 * |
|
85 * Possible property values: |
|
86 * - 0: (Default) no need of update |
|
87 * - 1: update of the subscription needed |
|
88 */ |
|
89 const TUint KPEngSubcriptionUpdate = 0x0000106; //262 |
|
90 |
|
91 /** |
|
92 * Contact list TInt property name. |
|
93 * Property level: KPEngCntLstPropertyNativeCached |
|
94 * |
|
95 * Flag if contact list is new default contact list |
|
96 * |
|
97 * Possible property values: |
|
98 * - 0: (Default) not det as new default contact list |
|
99 * - 1: marked as to be new default contact list |
|
100 */ |
|
101 const TUint KPEngNewDefaultContactList = 0x0000107; //263 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 // FORWARD DECLARATIONS |
|
107 class RWriteStream; |
|
108 class MPEngContactListSettingsManager; |
|
109 class CPEngContactListProperty; |
|
110 |
|
111 // CLASS DECLARATION |
|
112 |
|
113 /** |
|
114 * Container of one contact list item. |
|
115 * It includes, contact id, nick name, set of optional features |
|
116 * |
|
117 * @lib PEngListLib2 |
|
118 * @since 3.0 |
|
119 */ |
|
120 NONSHARABLE_CLASS( CPEngContactListSettings ) : |
|
121 public CBase, |
|
122 public MPEngContactListProperties |
|
123 |
|
124 { |
|
125 public: // Constructors and destructor |
|
126 |
|
127 /** |
|
128 * Two-phased constructor. |
|
129 */ |
|
130 static CPEngContactListSettings* NewLC( |
|
131 const TDesC& aContactList, |
|
132 const TPEngContactListBaseSettings& aBaseSettings, |
|
133 MPEngContactListSettingsManager& aManager ); |
|
134 |
|
135 /** |
|
136 * Two-phased constructor. |
|
137 */ |
|
138 static CPEngContactListSettings* NewServerLC( |
|
139 const TDesC& aContactList, |
|
140 const TDesC& aServerName, |
|
141 MPEngContactListSettingsManager& aManager ); |
|
142 |
|
143 /** |
|
144 * Two-phased constructor. |
|
145 */ |
|
146 static CPEngContactListSettings* NewStreamLC( |
|
147 RReadStream& aStream, |
|
148 MPEngContactListSettingsManager& aManager ); |
|
149 /** |
|
150 * Destructor. |
|
151 */ |
|
152 virtual ~CPEngContactListSettings(); |
|
153 |
|
154 |
|
155 |
|
156 public: // From MPEngContactListProperties |
|
157 |
|
158 /** |
|
159 * Is contact list synchronized? |
|
160 * @see <MPEngContactListProperties.h> |
|
161 */ |
|
162 TBool Synchronized() const; |
|
163 |
|
164 |
|
165 /** |
|
166 * Contact list local name. |
|
167 * @see <MPEngContactListProperties.h> |
|
168 */ |
|
169 const TDesC& Name() const; |
|
170 |
|
171 |
|
172 /** |
|
173 * Contact list server name. |
|
174 * @see <MPEngContactListProperties.h> |
|
175 */ |
|
176 const TDesC& ServerName() const; |
|
177 |
|
178 |
|
179 /** |
|
180 * Contact list display name. |
|
181 * @see <MPEngContactListProperties.h> |
|
182 */ |
|
183 TInt DisplayName( TPtrC& aDispName ) const; |
|
184 |
|
185 |
|
186 /** |
|
187 * Sets a new display name for the contact list. |
|
188 * @see <MPEngContactListProperties.h> |
|
189 */ |
|
190 void SetDisplayNameL( const TDesC& aDisplayName ); |
|
191 |
|
192 |
|
193 /** |
|
194 * Is the contact list the default list? |
|
195 * @see <MPEngContactListProperties.h> |
|
196 */ |
|
197 TBool IsDefault() const; |
|
198 |
|
199 |
|
200 /** |
|
201 * Gets presence attributes used for subscription. |
|
202 * @see <MPEngContactListProperties.h> |
|
203 */ |
|
204 const RArray<TUint32>& SubscriptionAttributes() const; |
|
205 |
|
206 |
|
207 /** |
|
208 * Sets used presence attributes for subscription. |
|
209 * @see <MPEngContactListProperties.h> |
|
210 */ |
|
211 TBool SetSubscriptionAttributesL( |
|
212 const MPEngAttributeList2& aAttributelist ); |
|
213 TBool SetSubscriptionAttributesL( |
|
214 const TArray<TUint32>& aAttributelist ); |
|
215 |
|
216 /** |
|
217 * Activates subscription for the contact list |
|
218 * @see <MPEngContactListProperties.h> |
|
219 */ |
|
220 TBool ActivateSubscriptionL(); |
|
221 |
|
222 |
|
223 /** |
|
224 * De Activates subscription for the contact list |
|
225 * @see <MPEngContactListProperties.h> |
|
226 */ |
|
227 TBool DeActivateSubscriptionL(); |
|
228 |
|
229 |
|
230 /** |
|
231 * Gets contact list base settings. |
|
232 * @see <MPEngContactListProperties.h> |
|
233 */ |
|
234 const TPEngContactListBaseSettings& BaseSettings() const; |
|
235 |
|
236 |
|
237 /** |
|
238 * Gets a property. |
|
239 * @see <MPEngContactListProperties.h> |
|
240 */ |
|
241 TInt GetProperty( TUint aName, |
|
242 TUint aLevel, |
|
243 TInt& aValue ) const; |
|
244 |
|
245 TInt GetProperty( TUint aName, |
|
246 TUint aLevel, |
|
247 TPtrC8& aValue ) const; |
|
248 |
|
249 TInt GetProperty( TUint aName, |
|
250 TUint aLevel, |
|
251 TPtrC16& aValue ) const; |
|
252 |
|
253 /** |
|
254 * Gets a property. |
|
255 * @see <MPEngContactListProperties.h> |
|
256 */ |
|
257 TInt Property( TUint aName, TUint aLevel ) const; |
|
258 |
|
259 /** |
|
260 * Sets a property. |
|
261 * @see <MPEngContactListProperties.h> |
|
262 */ |
|
263 void SetPropertyL( TUint aName, |
|
264 TUint aLevel, |
|
265 TInt aValue ); |
|
266 |
|
267 void SetPropertyL( TUint aName, |
|
268 TUint aLevel, |
|
269 const TDesC8& aValue ); |
|
270 |
|
271 void SetPropertyL( TUint aName, |
|
272 TUint aLevel, |
|
273 const TDesC16& aValue ); |
|
274 |
|
275 /** |
|
276 * Delete a property |
|
277 * @see <MPEngContactListProperties.h> |
|
278 */ |
|
279 void DeletePropertyL( TUint aName, TUint aLevel ); |
|
280 |
|
281 |
|
282 /** |
|
283 * Contact list properties extension interface. |
|
284 * @see <MPEngContactListProperties.h> |
|
285 */ |
|
286 inline MPEngContactListPropertiesExt* Extension() |
|
287 { |
|
288 return NULL; |
|
289 } |
|
290 |
|
291 inline const MPEngContactListPropertiesExt* Extension() const |
|
292 { |
|
293 return NULL; |
|
294 } |
|
295 |
|
296 |
|
297 |
|
298 public: // New functions |
|
299 |
|
300 /** |
|
301 * Update contact list server name. |
|
302 * Server name is composed from the user name and domain address. |
|
303 * |
|
304 * @since 3.0 |
|
305 * @param aUserName user name |
|
306 * @param aDomain domain address |
|
307 */ |
|
308 void UpdateListServerNameL( const TDesC& aUserName, |
|
309 const TDesC& aDomain ); |
|
310 |
|
311 /** |
|
312 * Display name |
|
313 * This can be called even when contact list hasn't been |
|
314 * synchronized |
|
315 * |
|
316 * @since 3.0 |
|
317 * @return display name |
|
318 */ |
|
319 const TDesC& DispName() const; |
|
320 |
|
321 |
|
322 /** |
|
323 * Push Display name update. |
|
324 * Update display name, flag for property update it skipped |
|
325 * Ownership of given buffer is taken in all cases. |
|
326 * |
|
327 * @since 3.0 |
|
328 * @param aDispName New display name. |
|
329 */ |
|
330 void PushUpdateDisplayNameL( HBufC* aDispName ); |
|
331 |
|
332 |
|
333 /** |
|
334 * Updates contact list type. |
|
335 * |
|
336 * @since 3.0 |
|
337 * @param aContactListType New type for the contact list. |
|
338 */ |
|
339 void UpdateListTypeL( TPEngContactListType aContactListType ); |
|
340 |
|
341 |
|
342 /** |
|
343 * Externalizes contact list settings to the stream |
|
344 * |
|
345 * @since 3.0 |
|
346 * @param aStream Stream to write to. |
|
347 */ |
|
348 void ExternalizeL( RWriteStream& aStream, |
|
349 TInt aStorageType ) const; |
|
350 |
|
351 /** |
|
352 * Internalize contact list settings from the stream |
|
353 * |
|
354 * @since 3.0 |
|
355 * @param aStream stream to read from |
|
356 */ |
|
357 void InternalizeL( RReadStream& aStream, |
|
358 TInt aStorageType ); |
|
359 |
|
360 private: |
|
361 |
|
362 /** |
|
363 * C++ constructor. |
|
364 */ |
|
365 CPEngContactListSettings( |
|
366 const TPEngContactListBaseSettings& aBaseSettings, |
|
367 MPEngContactListSettingsManager& aManager ); |
|
368 |
|
369 /** |
|
370 * C++ constructor. |
|
371 */ |
|
372 CPEngContactListSettings( |
|
373 MPEngContactListSettingsManager& aManager ); |
|
374 |
|
375 /** |
|
376 * Symbian 2nd phase constructor |
|
377 */ |
|
378 void ConstructL( const TDesC& aContactList ); |
|
379 |
|
380 /** |
|
381 * Symbian 2nd phase constructor |
|
382 */ |
|
383 void ConstructServerL( const TDesC& aContactList, |
|
384 const TDesC& aServerName ); |
|
385 |
|
386 |
|
387 private: // Data |
|
388 |
|
389 /// REF: Store entry of contact list settings |
|
390 MPEngContactListSettingsManager& iSettingsManager; |
|
391 |
|
392 /// OWN: Store Id of the contact list, same as local name of contact list |
|
393 HBufC* iName; |
|
394 |
|
395 /// OWN: Contact list server name |
|
396 HBufC* iServerName; |
|
397 |
|
398 /// OWN: Display name of the contact list |
|
399 HBufC* iDisplayName; |
|
400 |
|
401 /// OWN: Contact list base behavior |
|
402 TPEngContactListBaseSettings iBehavior; |
|
403 |
|
404 /// OWN: properties of the contact list |
|
405 RPointerArray<CPEngContactListProperty> iProperties; |
|
406 |
|
407 /// OWN: Presence attributes for subscription |
|
408 RArray<TUint32> iSubscriptionAttrs; |
|
409 }; |
|
410 |
|
411 #endif // __CPENGCONTACTLISTSETTINGS_H__ |
|
412 |
|
413 // End of File |
|
414 |