|
1 /* |
|
2 * Copyright (c) 2004 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: Contact list model interface & related definitions. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __MPENGCONTACTLIST2_H__ |
|
19 #define __MPENGCONTACTLIST2_H__ |
|
20 |
|
21 |
|
22 // INCLUDES |
|
23 #include <E32Std.h> |
|
24 #include <BaDescA.h> |
|
25 #include <MPEngContactItem.h> |
|
26 |
|
27 |
|
28 |
|
29 // DATA TYPES |
|
30 |
|
31 |
|
32 /** |
|
33 * Contact list sub views. |
|
34 * |
|
35 * @since 3.0 |
|
36 */ |
|
37 enum TPEngContactListView |
|
38 { |
|
39 /** |
|
40 * Contact list as it presented in the storage of the PEC engine |
|
41 * This contact list contains also changes which has been |
|
42 * done on the contact list, but haven't been yet commited to the |
|
43 * Network server, therefore network version of the contact |
|
44 * list can vary till the next update call. |
|
45 * NOTE! |
|
46 * Local and Network contact list are identical once |
|
47 * Contact list is not editable |
|
48 */ |
|
49 EPEngCntListLocalView = 1, |
|
50 |
|
51 /** |
|
52 * Contact list as it exists on network server |
|
53 * This is version of the contact list, as it was last time |
|
54 * updated to the Network Server. |
|
55 * Content is mostly same as EPEngCntListLocalVersion, unless |
|
56 * there have been dome some changes on the contact list |
|
57 * and client haven't updated them yet to the network. |
|
58 * NOTE! |
|
59 * Local and Network contact list are identical once |
|
60 * Contact list is not editable |
|
61 */ |
|
62 EPEngCntListNetworkView = 2, |
|
63 |
|
64 /** |
|
65 * Contacts which were removed from the contact list. |
|
66 * Those contact have been removed from the contact list |
|
67 * within last update of the contact list to the network. |
|
68 * Contact can be removed on demand of the Client, or network |
|
69 * server can refuse contact item when it is tried to be added |
|
70 * Contact are also removed when contact list update transaction |
|
71 * fails for what ever reason. |
|
72 * NOTE! |
|
73 * Removed Contact are not defined for not editable contact lists |
|
74 */ |
|
75 EPEngRemovedContacts = 3, |
|
76 |
|
77 /** |
|
78 * Contacts which were added to the contact. |
|
79 * Those contact have been added to the contact list |
|
80 * within last update of the contact list to the network. |
|
81 * Contact can be added on demand of the Client, or network |
|
82 * server can also merge two contact into one, if they are same |
|
83 * and it failed to be recognized by the client. For intance |
|
84 * lack of knowledge of the Domain name. |
|
85 * NOTE! |
|
86 * Added Contact are not defined for not editable contact lists |
|
87 */ |
|
88 EPEngAddedContacts = 4 |
|
89 }; |
|
90 |
|
91 // CONSTANTS |
|
92 |
|
93 /** |
|
94 * Special case of the contact list created by the Server |
|
95 * Content of the contact list is set of users subscribing |
|
96 * presence of the loged user. |
|
97 * Watcher List does not have to be available always, depends on |
|
98 * the server user is logged in. |
|
99 */ |
|
100 _LIT( KPEngWatcherList, "watcherlist" ); |
|
101 |
|
102 |
|
103 // FORWARD DECLARATIONS |
|
104 class MPEngContactListProperties; |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 // CLASS DECLARATION |
|
111 /** |
|
112 * General API for different contact lists. |
|
113 * |
|
114 * Interface allows users to manipulate and retrieve |
|
115 * data from the contact list. |
|
116 * |
|
117 * @since 3.0 |
|
118 */ |
|
119 class MPEngContactList2 |
|
120 { |
|
121 |
|
122 public: // Mutators |
|
123 |
|
124 /** |
|
125 * Inserts a Contact into the Contact list. |
|
126 * |
|
127 * Each Contact can exist only once in the contact list. |
|
128 * If added contact already exists in the contact list, function |
|
129 * Leaves with KErrAlready exists. |
|
130 * If Contact List nick name needs to be changed for contact, |
|
131 * MPEngContactItem.h interface should be used instead. |
|
132 * This function can also fail if some other client |
|
133 * is already editing content of this contact list. |
|
134 * |
|
135 * Function leaves with KErrNoMemory, if there is insufficient |
|
136 * memory available to perform operation. |
|
137 * |
|
138 * If the function leaves, the Contact list is left in the state |
|
139 * it was before |
|
140 * |
|
141 * !NOTE! |
|
142 * This function is not available for Non-Editable contact lists. |
|
143 * |
|
144 * @since 3.0 |
|
145 * |
|
146 * @param aContact Contact to be added to the contact list |
|
147 * @param aNickName nick name for the contact |
|
148 * If nick name is not passed, no nick name is defined |
|
149 * for the contact, same as KNullDesC value. |
|
150 * @return The position within the contact list. |
|
151 */ |
|
152 virtual TInt AddContactL( const TDesC& aContact, |
|
153 const TDesC& aNickName = KNullDesC ) = 0; |
|
154 |
|
155 /** |
|
156 * Removes Contact from the Contact list |
|
157 * |
|
158 * If contact does not exists in the contact list, function |
|
159 * does nothing. |
|
160 * |
|
161 * Function leaves with KErrNoMemory, if there is insufficient |
|
162 * memory available to perform operation. |
|
163 * |
|
164 * If the function leaves, the Contact list is left in the state |
|
165 * it was before |
|
166 * |
|
167 * !NOTE! |
|
168 * This function is not available for Non-Editable contact lists. |
|
169 * |
|
170 * @since 3.0 |
|
171 * |
|
172 * @param aContact The contact to be removed from the Contact list |
|
173 */ |
|
174 virtual void RemoveContactL( const TDesC& aContact ) = 0; |
|
175 |
|
176 |
|
177 |
|
178 /** |
|
179 * Find Contact in the contact list |
|
180 * |
|
181 * Finds Contact in defined contact list. |
|
182 * Search is performed with the comparison sense to |
|
183 * Contact specifics and also smart domain comparison is employed |
|
184 * if home domain is known to the system. |
|
185 * By default search is performed on the Local contact list view |
|
186 * |
|
187 * !NOTE! |
|
188 * Not all views are available for Non-Editable contact lists |
|
189 * |
|
190 * @since 3.0 |
|
191 * |
|
192 * @param aContact contact to look for |
|
193 * @param aView Contact list view to look for Contact in, by default |
|
194 * Local contact list view is used |
|
195 * @return position |
|
196 */ |
|
197 virtual TInt FindContact( |
|
198 const TDesC& aContact, |
|
199 TPEngContactListView aView |
|
200 = EPEngCntListLocalView ) const = 0; |
|
201 |
|
202 |
|
203 |
|
204 /** |
|
205 * Count of the Contacts of the Contact list view |
|
206 * |
|
207 * Returns count of the contact IDs on the defined Contact List |
|
208 * view. |
|
209 * By default Local List view is used |
|
210 * |
|
211 * !NOTE! |
|
212 * Not all views are available for Non-Editable contact lists |
|
213 * |
|
214 * @since 3.0 |
|
215 * @param aView Contact list view to get count for, by default |
|
216 * Local contact list view is used |
|
217 * @return Count of the Contact of the list |
|
218 */ |
|
219 virtual TInt Count( TPEngContactListView aView |
|
220 = EPEngCntListLocalView ) const = 0; |
|
221 |
|
222 |
|
223 /** |
|
224 * Contact Item of the Contact list |
|
225 * |
|
226 * Gets reference to the particular contact item model |
|
227 * of the contact list. This model can be used to view contact |
|
228 * item details and modify them. |
|
229 * Both const and non const overload available. |
|
230 * |
|
231 * There is no difference if contact item model was retrieved |
|
232 * from Network or local view as far as contact item exists in |
|
233 * both views. |
|
234 * |
|
235 * !NOTE! |
|
236 * Contact Item can be retrieved only for Local and network |
|
237 * Contact list view. Since there are not details |
|
238 * available for Removed and Added contacts, except contact part, |
|
239 * also editing of those lists is not allowed at any case. |
|
240 * More about contact item model services can be seen in |
|
241 * MPEngContactItem.h |
|
242 * |
|
243 * @since 3.0 |
|
244 * @param aIndex index of desired contact Item within list |
|
245 * @param aSublist sublist of the contact list |
|
246 * @return reference to contact Item model |
|
247 */ |
|
248 virtual MPEngContactItem& ContactItem( |
|
249 TInt aIndex, |
|
250 TPEngContactListView aView |
|
251 = EPEngCntListLocalView ) = 0; |
|
252 |
|
253 virtual const MPEngContactItem& ContactItem( |
|
254 TInt aIndex, |
|
255 TPEngContactListView aView |
|
256 = EPEngCntListLocalView ) const = 0; |
|
257 |
|
258 |
|
259 /** |
|
260 * Contacts which were removed from the contact list |
|
261 * |
|
262 * List of the contact's WV Ids which were removed form the contact |
|
263 * list, either on the clients demand or by the Network server |
|
264 * Contacts can be also removed once update operation fails |
|
265 * |
|
266 * @since 3.0 |
|
267 * @return des array with removed contacts |
|
268 */ |
|
269 virtual const MDesCArray& RemovedContacts( ) const = 0; |
|
270 |
|
271 |
|
272 /** |
|
273 * Contacts which were added to the contact list |
|
274 * |
|
275 * List of the contact's WV Ids which were added to the contact |
|
276 * list, either on the clients demand or by the Network server. |
|
277 * |
|
278 * @since 3.0 |
|
279 * @return des array with added contacts |
|
280 */ |
|
281 virtual const MDesCArray& AddedContacts( ) const = 0; |
|
282 |
|
283 |
|
284 |
|
285 public: // Contact List properties |
|
286 |
|
287 /** |
|
288 * Contact list Settings |
|
289 * |
|
290 * Returns contact list properties model. |
|
291 * This model can be used to view contact list |
|
292 * details and also to edit certain parameters of the |
|
293 * contact list which are allowed to be altered once |
|
294 * contact list exists. |
|
295 * |
|
296 * @since 3.0 |
|
297 * @return Contact list properties model |
|
298 */ |
|
299 virtual MPEngContactListProperties& ListProperties() = 0; |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 public: // Functions for storage management |
|
305 |
|
306 /** |
|
307 * Remove all contacts from the contact list |
|
308 * |
|
309 * Cleans contact list from all Contacts |
|
310 * |
|
311 * @since 3.0 |
|
312 */ |
|
313 virtual void RemoveAllContactsL( ) = 0; |
|
314 |
|
315 |
|
316 /** |
|
317 * Suspend contact list update notifications |
|
318 * |
|
319 * This should be used when client is intending to do lot |
|
320 * of small changes of the contact list content and wants |
|
321 * them to be notified to other clients all at once once |
|
322 * editing is finished. |
|
323 * Suspending is removed by calling ReleaseUpdateNotification() |
|
324 * |
|
325 * @since 3.0 |
|
326 */ |
|
327 virtual void SuspendUpdateNotification( ) = 0; |
|
328 |
|
329 |
|
330 /** |
|
331 * Release sending of the contact list update notifications |
|
332 * |
|
333 * Update notifications are released and also all notifications |
|
334 * which were ignored when suspend was active are now notified |
|
335 * |
|
336 * @since 3.0 |
|
337 */ |
|
338 virtual void ReleaseUpdateNotification( ) = 0; |
|
339 |
|
340 |
|
341 /** |
|
342 * Roll back all changes |
|
343 * |
|
344 * All un-commited changes are rolled back and |
|
345 * contact list is put in the state it exist on the network. |
|
346 * This will roll back changes of the Contact Item edition |
|
347 * and also Contact List Network related changes |
|
348 * |
|
349 * @since 3.0 |
|
350 * @return KErrNone if store of the roll back state was successful |
|
351 * system wide error if storing failed |
|
352 */ |
|
353 virtual TInt RollBackAllChangesL( ) = 0; |
|
354 |
|
355 |
|
356 /** |
|
357 * Contact list locked by other client |
|
358 * |
|
359 * Returns ETrue if contact list has been locked by another |
|
360 * client for editing of its content |
|
361 * |
|
362 * @since 3.0 |
|
363 * @return ETrue if Contact List is locked |
|
364 */ |
|
365 virtual TBool UpdateInProgress( ) const = 0; |
|
366 |
|
367 |
|
368 /** |
|
369 * Update of the contact list required |
|
370 * |
|
371 * Returns ETrue if contact list needs to be upated |
|
372 * |
|
373 * @since 3.0 |
|
374 * @return ETrue if update is needed. EFalse if not. |
|
375 */ |
|
376 virtual TBool UpdateRequired() const = 0; |
|
377 |
|
378 |
|
379 |
|
380 protected: //Destructor |
|
381 |
|
382 /** |
|
383 * Virtual inline destructor. |
|
384 * Protected destructor to prohibits deletion trough interface. |
|
385 */ |
|
386 virtual ~MPEngContactList2() {}; |
|
387 }; |
|
388 |
|
389 |
|
390 #endif // __MPENGCONTACTLIST2_H__ |
|
391 |
|
392 // End of File |
|
393 |
|
394 |
|
395 |