1 /* |
|
2 * Copyright (c) 2002-2007 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: |
|
15 : |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <CVPbkContactManager.h> |
|
22 |
|
23 #include "CVPbkContactOperationBaseStub.h" |
|
24 #include "s_CVPbkContactStoreList.h" |
|
25 |
|
26 // CLASS DECLARATIONS |
|
27 |
|
28 /** |
|
29 * Virtual Phonebook Contact Manager. Contact Manager is the root access point |
|
30 * to Virtual Phonebook engine functionality. The client can specify the list |
|
31 * of stores in the constructor he/she is interested in or load additional |
|
32 * plug-ins later on. In addition to loading the implementing plug-ins the |
|
33 * client must open the stores. Clients should share the contact manager |
|
34 * instance within their context, otherwise e.g. field types from two |
|
35 * different instances will not produce the matches as the matching is |
|
36 * based on pointer comparison. |
|
37 * |
|
38 * Examples of absolute URI stores: |
|
39 * Default contact database: "cntdb://contacts.cdb" |
|
40 * LDAP store: "ldap://www.telnumbers.com/" |
|
41 * The URI scheme name is used to resolve a store capable of supporting |
|
42 * this type of store. The actual store implementations are ECom plugins. |
|
43 * |
|
44 * @lib VPbkEng.lib |
|
45 */ |
|
46 |
|
47 TSecurityInfo gTSecurityInfo; |
|
48 CVPbkContactOperationBaseStub* gOperationStub; |
|
49 CVPbkContactStoreListStub gStoreList; |
|
50 |
|
51 /** |
|
52 * Creates a contact manager instance and loads the plug-ins that can |
|
53 * handle the stores corresponding to the aURIList. |
|
54 * @param aURIList Universal Resource Identifier list of the stores |
|
55 * to be loaded initially. |
|
56 * @param aFs File system handle. NULL opens a new connection. |
|
57 * @return Contact manager instance. |
|
58 */ |
|
59 EXPORT_C CVPbkContactManager* CVPbkContactManager::NewL( |
|
60 const CVPbkContactStoreUriArray& /*aURIList*/, |
|
61 RFs* aFs /*= NULL*/) |
|
62 { |
|
63 return new( ELeave ) CVPbkContactManager( gTSecurityInfo, aFs); |
|
64 } |
|
65 |
|
66 /** |
|
67 * Creates a contact manager instance and loads the plug-ins that can |
|
68 * handle the stores corresponding to the aURIList. |
|
69 * @param aSecurityInfo Security info from caller to be passed for stores. |
|
70 * Stores can check security info and deside |
|
71 * if client can use service. |
|
72 * @param aURIList Universal Resource Identifier list of the stores |
|
73 * to be loaded initially. |
|
74 * @param aFs File system handle. NULL opens a new connection. |
|
75 * @return Contact manager instance. |
|
76 */ |
|
77 EXPORT_C CVPbkContactManager* CVPbkContactManager::NewL( |
|
78 TSecurityInfo aSecurityInfo, |
|
79 const CVPbkContactStoreUriArray& /*aURIList*/, |
|
80 RFs* aFs /*= NULL*/) |
|
81 { |
|
82 return new( ELeave ) CVPbkContactManager( aSecurityInfo, aFs); |
|
83 } |
|
84 |
|
85 /** |
|
86 * Destructor. |
|
87 */ |
|
88 CVPbkContactManager::~CVPbkContactManager(){ } |
|
89 |
|
90 |
|
91 /** |
|
92 * The contact manager owns a master list of field types that clients |
|
93 * use. The store implementation then maps their native types |
|
94 * to Virtual Phonebook types. Clients don't create field type objects |
|
95 * themselves but use always references to types offered |
|
96 * by this function. |
|
97 * |
|
98 * @return The global list of field types. |
|
99 */ |
|
100 EXPORT_C const MVPbkFieldTypeList& CVPbkContactManager::FieldTypes() const |
|
101 { |
|
102 MVPbkFieldTypeList* retValue = NULL; |
|
103 return *retValue; |
|
104 |
|
105 } |
|
106 |
|
107 /** |
|
108 * The contact store list is used to handle a set of stores. |
|
109 * After creation of manager the client can use the list to open |
|
110 * all stores. |
|
111 * |
|
112 * @return The list of available contact stores. |
|
113 */ |
|
114 EXPORT_C MVPbkContactStoreList& CVPbkContactManager::ContactStoresL(){ return gStoreList; } |
|
115 |
|
116 /** |
|
117 * Loads a store plug-in for given URI and adds aURI |
|
118 * to the list of stores handled by this manager. |
|
119 * If there is no store plug-in for the aURI then nothing changes. |
|
120 * |
|
121 * @param aURI the store URI to be loaded. |
|
122 */ |
|
123 EXPORT_C void CVPbkContactManager::LoadContactStoreL(const TVPbkContactStoreUriPtr& /*aURI*/){ } |
|
124 |
|
125 /** |
|
126 * Attribute manager is used for handling contact attributes like |
|
127 * speed dialing or defaults. |
|
128 * |
|
129 * @returns The contact attribute manager. |
|
130 */ |
|
131 EXPORT_C MVPbkContactAttributeManager& CVPbkContactManager::ContactAttributeManagerL() |
|
132 { |
|
133 MVPbkContactAttributeManager* ret = NULL; |
|
134 return *ret; |
|
135 } |
|
136 |
|
137 /** |
|
138 * Creates a new contact view specified by the view definition. |
|
139 * The view can not be used before it has notified the observer |
|
140 * that it is ready. |
|
141 * |
|
142 * @param aObserver the observer for view events. |
|
143 * @param aViewDefinition Definition of the view to create |
|
144 * @param aSortOrder a list of field types that defines fields |
|
145 * that are used in sorting. View contacts |
|
146 * have these fields. However, the store can have restrictions |
|
147 * for types that can be used in the sort order. |
|
148 * The sort order has no effect for shared views that have |
|
149 * already been created. |
|
150 * |
|
151 * @see CVPbkSortOrder |
|
152 * @return Newly created view. |
|
153 * If NULL CleanupStack pop is still needed |
|
154 */ |
|
155 EXPORT_C MVPbkContactViewBase* CVPbkContactManager::CreateContactViewLC( |
|
156 MVPbkContactViewObserver& /*aObserver*/, |
|
157 const CVPbkContactViewDefinition& /*aViewDefinition*/, |
|
158 const MVPbkFieldTypeList& /*aSortOrder*/) const |
|
159 { |
|
160 return NULL; |
|
161 } |
|
162 |
|
163 /** |
|
164 * Retrieves asynchronously a contact that is individualized by |
|
165 * a contact link. Delete the operation for canceling. |
|
166 * |
|
167 * @param aLink a link to the contact |
|
168 * @param aObserver operation observer |
|
169 * @return New handle to the operation |
|
170 * @Asynchronous |
|
171 */ |
|
172 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::RetrieveContactL( |
|
173 const MVPbkContactLink& /*aLink*/, |
|
174 MVPbkSingleContactOperationObserver& /*aObserver*/) const |
|
175 { |
|
176 gOperationStub = new( ELeave ) CVPbkContactOperationBaseStub(); |
|
177 return gOperationStub; |
|
178 } |
|
179 |
|
180 /** |
|
181 * Creates an array of links corresponding to a packaged link or links. |
|
182 * Packed links have been obtained by packing a link or a link array |
|
183 * and they can be used for example for IPC but not for saving links. |
|
184 * Loads the store plug-ins that are capable of creating the |
|
185 * appropriate links. |
|
186 * |
|
187 * @param aPackedLinks packed links |
|
188 * @return A link array. |
|
189 * @see MVPbkContactLink::PackLC |
|
190 * @see MVPbkContactLinkArray::PackLC |
|
191 */ |
|
192 EXPORT_C MVPbkContactLinkArray* CVPbkContactManager::CreateLinksLC( |
|
193 const TDesC8& /*aPackedLinks*/) const{ return NULL; } |
|
194 |
|
195 /** |
|
196 * Internalizes a permanent link or links. An externalized link |
|
197 * has been created using MVPbkStreamable interface from |
|
198 * MVPbkContactLink. |
|
199 * Loads the store plug-ins that are capable of creating the |
|
200 * appropriate links. |
|
201 * |
|
202 * @param aStream a stream that contains a link or links. |
|
203 * @return A link array |
|
204 * @see MVPbkContactLink::Streamable |
|
205 */ |
|
206 EXPORT_C MVPbkContactLinkArray* CVPbkContactManager::CreateLinksLC( |
|
207 RReadStream& /*aStream*/) const{ return NULL; } |
|
208 |
|
209 /** |
|
210 * Deletes contacts defined in link array asynchronously. |
|
211 * |
|
212 * @param aContactLinks Contacts to delete |
|
213 * @param aObserver Operation observer |
|
214 * @return New handle to the operation |
|
215 */ |
|
216 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::DeleteContactsL( |
|
217 const MVPbkContactLinkArray& /*aContactLinks*/, |
|
218 MVPbkBatchOperationObserver& /*aObserver*/){ return NULL; } |
|
219 |
|
220 /** |
|
221 * Commits all contacts in aContacts asynchronously. |
|
222 * |
|
223 * @see MVPbkStoreContact::CommitL |
|
224 * @param aContacts Contacts to commit. |
|
225 * @param aObserver Operation observer. |
|
226 * @return New handle to the operation. |
|
227 */ |
|
228 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::CommitContactsL( |
|
229 const TArray<MVPbkStoreContact*>& /*aContacts*/, |
|
230 MVPbkBatchOperationObserver& /*aObserver*/){ return NULL; } |
|
231 |
|
232 /** |
|
233 * Copies all contacts in aContactLinks to aTargetStore asynchronously. |
|
234 * If aTargetStore is NULL, contacts are copied to the store where |
|
235 * they already are, ie. the contacts are duplicated. |
|
236 * |
|
237 * @param aContactLinks Array of contact links to duplicate. |
|
238 * @param aTargetStore Target store to copy contacts to. |
|
239 * If NULL this behaves like duplicate. |
|
240 * @param aObserver Observer for the copying process. |
|
241 * @return New handle to the operation. |
|
242 */ |
|
243 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::CopyContactsL( |
|
244 const MVPbkContactLinkArray& /*aContactLinks*/, |
|
245 MVPbkContactStore* /*aTargetStore*/, |
|
246 MVPbkBatchOperationObserver& /*aObserver*/){ return NULL; } |
|
247 |
|
248 /** |
|
249 * Searches the contact stores for a phone number using |
|
250 * defined amount of digits from the end of the number asynchronously. |
|
251 * The store implementations determine, which field types are included |
|
252 * in the search. |
|
253 * |
|
254 * @param aPhoneNumber Phone number to search for. |
|
255 * @param aMaxMatchDigits Maximum number of digits to match |
|
256 * from the end of the number. |
|
257 * @param aObserver Observer for the find process. |
|
258 * @return New handle to the find operation. |
|
259 */ |
|
260 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::MatchPhoneNumberL( |
|
261 const TDesC& /*aPhoneNumber*/, |
|
262 TInt /*aMaxMatchDigits*/, |
|
263 MVPbkContactFindObserver& /*aObserver*/){ return NULL; } |
|
264 |
|
265 /** |
|
266 * Searches the contact stores for a contact that contains |
|
267 * the given string in one of the field defined by given |
|
268 * field type list asynchronously. |
|
269 * NOTE: In some cases the find matches also other fields than |
|
270 * those specified in aFieldTypes. Always loop through the |
|
271 * results to check match in the required fields. |
|
272 * |
|
273 * @param aSearchString String to search for. |
|
274 * @param aFieldTypes List of field types that the search will include. |
|
275 * a field type list: use CVPbkFieldTypeRefsList and |
|
276 * append the types that are needed from |
|
277 * the master field type list (FieldTypes()) |
|
278 * to the reference list. Selection can be done |
|
279 * in a dynamic way using CVPbkFieldTypeSelector or |
|
280 * static way using resource ids of the field types. |
|
281 * @param aObserver Observer for the find process. |
|
282 * @return New handle to the find operation. |
|
283 */ |
|
284 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::FindL( |
|
285 const TDesC& /*aSearchString*/, |
|
286 const MVPbkFieldTypeList& /*aFieldTypes*/, |
|
287 MVPbkContactFindObserver& /*aObserver*/){ return NULL; } |
|
288 |
|
289 /** |
|
290 * Finds a string containing text that is stored in one or more |
|
291 * fields asynchronously. Client can give multiple find words. |
|
292 * All the words must match to separated data. E.g. if there are |
|
293 * two find words: "Jo" and "Jo" then field data "John Johnson" |
|
294 * matches but "John Doe" doesn't if the word parser uses |
|
295 * white space as a word separator. |
|
296 * |
|
297 * NOTE: The accuracy of the results depends on the implementation |
|
298 * of the store to carry out the find operation. The performance |
|
299 * can also vary depending on the store. |
|
300 * |
|
301 * @param aSearchStrings strings that are compared to field data. |
|
302 * @param aFieldTypes types of the fields that are used. Constructing |
|
303 * a fieldtype list: use CVPbkFieldTypeRefsList and |
|
304 * append the types that are needed from |
|
305 * the master fieldtype list (FieldTypes()) |
|
306 * to the reference list. Selection can be done |
|
307 * in a dynamic way using CVPbkFieldTypeSelector or |
|
308 * static way using resource ids of the fieldtypes. |
|
309 * |
|
310 * @param aObserver an observer for asynchronous operation. |
|
311 * @param aWordParserCallBack a client implementation of word parser |
|
312 * function that separates the field data |
|
313 * into words. Parameter to function is |
|
314 * TVPbkWordParserParam. |
|
315 * @return New handle to the find operation. |
|
316 */ |
|
317 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::FindL( |
|
318 const MDesC16Array& /*aSearchStrings*/, |
|
319 const MVPbkFieldTypeList& /*aFieldTypes*/, |
|
320 MVPbkContactFindFromStoresObserver& /*aObserver*/, |
|
321 const TCallBack& /*aWordParserCallBack*/ ){ return NULL; } |
|
322 |
|
323 /** |
|
324 * Compresses all stores asynchronously. |
|
325 * NOTE: Not all stores are able to implement compression to their |
|
326 * repositories. |
|
327 * |
|
328 * @param aObserver Operation observer. |
|
329 * @return New handle to the operation. |
|
330 */ |
|
331 EXPORT_C MVPbkContactOperationBase* CVPbkContactManager::CompressStoresL( |
|
332 MVPbkBatchOperationObserver& /*aObserver*/){ return NULL; } |
|
333 |
|
334 /** |
|
335 * Returns the file server session of the contact manager. |
|
336 * |
|
337 * @return File server session of the contact manager. |
|
338 */ |
|
339 EXPORT_C RFs& CVPbkContactManager::FsSession() |
|
340 { |
|
341 RFs* rfs = NULL; |
|
342 return *rfs; |
|
343 } |
|
344 |
|
345 |
|
346 CVPbkContactManager::CVPbkContactManager( TSecurityInfo /*aSecurityInfo*/, RFs* /*aFs*/ ) |
|
347 { |
|
348 |
|
349 } |
|
350 |
|
351 |
|
352 void CVPbkContactManager::ConstructL(const CVPbkContactStoreUriArray& /*aURIList*/) |
|
353 { |
|
354 |
|
355 } |
|
356 |
|
357 |
|
358 MVPbkContactStore* CVPbkContactManager::FindStore(const TVPbkContactStoreUriPtr& /*aURI*/) const |
|
359 { |
|
360 return NULL; |
|
361 } |
|
362 |
|
363 |
|
364 MVPbkContactViewBase* CVPbkContactManager::CreateOptimizedCompositeViewLC( |
|
365 MVPbkContactViewObserver& /*aObserver*/, |
|
366 const CVPbkContactViewDefinition& /*aViewDefinition*/, |
|
367 const MVPbkFieldTypeList& /*aSortOrder*/) const |
|
368 { |
|
369 return NULL; |
|
370 } |
|
371 |
|
372 MVPbkContactViewBase* CVPbkContactManager::CreateCompositeViewLC( |
|
373 MVPbkContactViewObserver& /*aObserver*/, |
|
374 const CVPbkContactViewDefinition& /*aViewDefinition*/, |
|
375 const MVPbkFieldTypeList& /*aSortOrder*/) const |
|
376 { |
|
377 return NULL; |
|
378 } |
|
379 |
|
380 // End of file |
|