|
1 /* |
|
2 * Copyright (c) 2004-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 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include "s_CVPbkContactStoreList.h" |
|
25 #include "CVPbkStoreContactStub.h" |
|
26 #include "s_CVPbkContactView.h" |
|
27 |
|
28 CVPbkContactStoreStub gLocalStore; |
|
29 CVPbkContactStoreStub gXSPStore; |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 |
|
33 /** |
|
34 * Returns fixed properties of this contact store. |
|
35 * |
|
36 * Fixed properties do not change when the store is open. |
|
37 * The store must be opened before retrieving the properties. |
|
38 * |
|
39 * @return Store properties. |
|
40 */ |
|
41 const MVPbkContactStoreProperties& CVPbkContactStoreStub::StoreProperties() const |
|
42 { |
|
43 MVPbkContactStoreProperties* ret = NULL; |
|
44 return *ret; |
|
45 } |
|
46 |
|
47 /** |
|
48 * Opens this contact store asynchronously. |
|
49 * |
|
50 * Calls back the observer when the opening completes. Notice |
|
51 * that the same store instance can be opened by several observers. |
|
52 * |
|
53 * @param aObserver An observer for the store. |
|
54 * @exception KErrInUse If another asynchronous operation |
|
55 * is already in progress. |
|
56 */ |
|
57 void CVPbkContactStoreStub::OpenL( |
|
58 MVPbkContactStoreObserver& /*aObserver*/ ) { } |
|
59 |
|
60 /** |
|
61 * Replaces an existing store and opens it asynchronously. |
|
62 * |
|
63 * E.g. If the database is a file then this replaces the database if |
|
64 * it's not locked by other clients. If the store |
|
65 * implementation can not implment replacing then this behaves |
|
66 * like OpenL. |
|
67 * |
|
68 * If the store does not exist, it is created if possible. |
|
69 * Calls back the observer when the opening completes. |
|
70 * |
|
71 * @param aObserver An observer for the store. |
|
72 */ |
|
73 void CVPbkContactStoreStub::ReplaceL( |
|
74 MVPbkContactStoreObserver& /*aObserver*/ ) { } |
|
75 |
|
76 /** |
|
77 * Closes this contact store from a single observer. |
|
78 * |
|
79 * This can be always called safely even if OpenL or ReplaceL |
|
80 * hasn't been called. |
|
81 * If the client calls OpenL it must also call this after usage, |
|
82 * The observer will no longer receive events from this store. |
|
83 * If there are other observers for the store then the store |
|
84 * will remain open for them. |
|
85 * |
|
86 * @param aObserver An observer that was given in OpenL or ReplaceL. |
|
87 */ |
|
88 void CVPbkContactStoreStub::Close( |
|
89 MVPbkContactStoreObserver& /*aObserver*/ ) { } |
|
90 |
|
91 /** |
|
92 * Creates a new contact associated to this store. |
|
93 * |
|
94 * The contact can be edited and then it must be committed by |
|
95 * calling MVPbkStoreContact::CommitL for actually saving |
|
96 * it to the store. |
|
97 * |
|
98 * @return A new contact associated to this store. Caller takes |
|
99 * ownership of the returned contact. |
|
100 * @see MVPbkStoreContact |
|
101 * @see MVPbkStoreContact::CommitL |
|
102 */ |
|
103 MVPbkStoreContact* CVPbkContactStoreStub::CreateNewContactLC() |
|
104 { |
|
105 return new (ELeave) CVPbkStoreContactStub; |
|
106 } |
|
107 |
|
108 /** |
|
109 * Creates a new contact group associated to this store. |
|
110 * |
|
111 * MVPbkContactStoreProperties::SupportsContactGroups must be |
|
112 * true if this is used. |
|
113 * The contact group might be saved to the store immeadiately |
|
114 * depending on the store implementation. |
|
115 * It is left open for editing. Use CommitL to commit |
|
116 * the creation of the group and its content. |
|
117 * |
|
118 * @return A new contact group associated to this store. Caller takes |
|
119 * the ownership of the returned contact group. |
|
120 * @exception KErrNotSupported if the store doesn't support groups. |
|
121 * Client should check store properties before |
|
122 * calling this. |
|
123 * @see MVPbkContactStoreProperties |
|
124 * @see MVPbkContactGroup |
|
125 * @see MVPbkStoreContact |
|
126 * @see MVPbkStoreContact::CommitL |
|
127 */ |
|
128 MVPbkContactGroup* CVPbkContactStoreStub::CreateNewContactGroupLC() { return NULL; } |
|
129 |
|
130 /** |
|
131 * Creates a new contact view from the store asynchronously. |
|
132 * |
|
133 * Client gets the ownership of the view. The content of |
|
134 * the view depends on the CVPbkContactViewDefinition. The |
|
135 * client must wait the observer event before using the view. |
|
136 * |
|
137 * @param aViewDefinition Defines the properties of the new view. |
|
138 * @param aObserver An observer for the view events. |
|
139 * @param aSortOrder Field types that are used in the view contact |
|
140 * in the same order as in this list. Notice that |
|
141 * stores may not support all possible field types |
|
142 * in a view contact. The implementation |
|
143 * of the view contact must have as many fields as |
|
144 * the sort order. If the store doesn't support the |
|
145 * field type in a view contact then it sets empty |
|
146 * data to the field. |
|
147 * @return A new contact view object. Caller takes ownership of the |
|
148 * returned contact. |
|
149 * @see MVPbkContactView |
|
150 * @see CVPbkContactViewDefinition |
|
151 */ |
|
152 MVPbkContactView* CVPbkContactStoreStub::CreateViewLC( |
|
153 const CVPbkContactViewDefinition& /*aViewDefinition*/, |
|
154 MVPbkContactViewObserver& /*aObserver*/, |
|
155 const MVPbkFieldTypeList& /*aSortOrder*/ ) |
|
156 { |
|
157 CVPbkContactViewStub* some = new (ELeave) CVPbkContactViewStub; |
|
158 CleanupStack::PushL(some); |
|
159 return some; |
|
160 } |
|
161 |
|
162 /** |
|
163 * Returns contact groups contained in this store. |
|
164 * |
|
165 * MVPbkContactStoreProperties::SupportsContactGroups must be |
|
166 * true if this is used. Implementation should return an empty |
|
167 * link array and not NULL. |
|
168 * |
|
169 * @return Contact group identifiers contained in this store. |
|
170 */ |
|
171 MVPbkContactLinkArray* CVPbkContactStoreStub::ContactGroupsLC() const { return NULL; } |
|
172 |
|
173 /** |
|
174 * Returns a contact store information. Information can vary |
|
175 * runtime. |
|
176 * |
|
177 * @return Contact store information. |
|
178 */ |
|
179 const MVPbkContactStoreInfo& CVPbkContactStoreStub::StoreInfo() const |
|
180 { |
|
181 MVPbkContactStoreInfo* ret = NULL; |
|
182 return *ret; |
|
183 } |
|
184 |
|
185 /** |
|
186 * This is part of Virtual Phonebook internal framefork and not |
|
187 * usable for clients. Clients use CVPbkContactManager |
|
188 * for creating links from a stream. |
|
189 * |
|
190 * Creates a link array from a stream. Stream contains the internals |
|
191 * of the contact link. Internals are the contact store implementation |
|
192 * specific part of the package format. |
|
193 * |
|
194 * NOTE: this must work wheter the OpenL has been called or not. This |
|
195 * means that a link can not contain any data that would need |
|
196 * an open store before internalizing. |
|
197 * |
|
198 * @param aStream A stream containing the link internals. |
|
199 * @return A new contact link. |
|
200 * @internal |
|
201 */ |
|
202 MVPbkContactLink* CVPbkContactStoreStub::CreateLinkFromInternalsLC( |
|
203 RReadStream& /*aStream*/ ) const { return NULL; } |
|
204 |
|
205 /** |
|
206 * Returns own contact link asynchronously. |
|
207 * |
|
208 * @params aObserver Operation observer |
|
209 * @return operation handle |
|
210 * @Asynchronous |
|
211 */ |
|
212 MVPbkContactOperationBase* CVPbkContactStoreStub::OwnContactLinkL( |
|
213 MVPbkSingleContactLinkOperationObserver& /*aObserver*/) const { return NULL; } |
|
214 |
|
215 |
|
216 /** |
|
217 * Returns the parent object of this object. For the root of the |
|
218 * hierarchy returns self. |
|
219 * @return The parent object. |
|
220 */ |
|
221 MVPbkObjectHierarchy& CVPbkContactStoreStub::ParentObject() const |
|
222 { |
|
223 MVPbkObjectHierarchy* ret=NULL; |
|
224 return *ret; |
|
225 } |
|
226 |
|
227 |
|
228 /** |
|
229 * Creates an operation for contact retrieval. |
|
230 * |
|
231 * @param aLink A link to the contact |
|
232 * @param aObserver An observer for the operation. |
|
233 * @return A handle to the operation or NULL if the factory |
|
234 * doesn't have reference to the store of the link. |
|
235 */ |
|
236 MVPbkContactOperation* CVPbkContactStoreStub::CreateContactRetrieverL( |
|
237 const MVPbkContactLink& /*aLink*/, |
|
238 MVPbkSingleContactOperationObserver& /*aObserver*/) { return NULL; } |
|
239 |
|
240 /** |
|
241 * Creates an operation for deleting multiple contacts. |
|
242 * |
|
243 * @param aContactLinks An array of contact links that specify |
|
244 * the contacts. |
|
245 * @param aObserver An observer for the operation. |
|
246 * @return A handle to the operation or NULL |
|
247 */ |
|
248 MVPbkContactOperation* CVPbkContactStoreStub::CreateDeleteContactsOperationL( |
|
249 const MVPbkContactLinkArray& /*aContactLinks*/, |
|
250 MVPbkBatchOperationObserver& /*aObserver*/ ) { return NULL; } |
|
251 |
|
252 /** |
|
253 * Creates an operation for committing multiple contacts. |
|
254 * |
|
255 * @param aContacts An array of contact links that specify |
|
256 * the contacts |
|
257 * @param aObserver An observer for the operation. |
|
258 * @return A handle to the operation or NULL |
|
259 */ |
|
260 MVPbkContactOperation* CVPbkContactStoreStub::CreateCommitContactsOperationL( |
|
261 const TArray<MVPbkStoreContact*>& /*aContacts*/, |
|
262 MVPbkBatchOperationObserver& /*aObserver*/) { return NULL; } |
|
263 |
|
264 /** |
|
265 * Creates an operation for asynchronous phone number matching. |
|
266 * |
|
267 * @param aPhoneNumber A phone number to search for. |
|
268 * @param aMaxMatchDigits Maximum number of digits to match from |
|
269 * the end of the number. |
|
270 * @param aObserver Observer for the find process. |
|
271 * @return A handle to the operation or NULL |
|
272 */ |
|
273 MVPbkContactOperation* CVPbkContactStoreStub::CreateMatchPhoneNumberOperationL( |
|
274 const TDesC& /*aPhoneNumber*/, |
|
275 TInt /*aMaxMatchDigits*/, |
|
276 MVPbkContactFindObserver& /*aObserver*/) { return NULL; } |
|
277 |
|
278 /** |
|
279 * Creates an operation for asynchronous contact finding. |
|
280 * |
|
281 * @param aSearchString String to search for. |
|
282 * @param aFieldTypes List of field types that the search will include. |
|
283 * @param aObserver Observer for the find process. |
|
284 * @return A handle to the operation or NULL |
|
285 */ |
|
286 MVPbkContactOperation* CVPbkContactStoreStub::CreateFindOperationL( |
|
287 const TDesC& /*aSearchString*/, |
|
288 const MVPbkFieldTypeList& /*aFieldTypes*/, |
|
289 MVPbkContactFindObserver& /*aObserver*/) { return NULL; } |
|
290 |
|
291 /** |
|
292 * Creates an operation for asynchronous contact finding. |
|
293 * Finds a string containing text that is stored in one or more fields. |
|
294 * Client can give multiple find words. All the words must match to separated |
|
295 * data. E.g if there are two find words: "Jo" and "Jo" then field data |
|
296 * "John Johnson" matches but "John Doe" doesn't if the word parser uses |
|
297 * white space as a word separator. |
|
298 * |
|
299 * NOTE: The accuracy of the results depends on the ability of the store |
|
300 * implementation to implement the find. The performance can vary |
|
301 * too depending on the store. |
|
302 * |
|
303 * @param aSearchStrings Words that are compared to field data. |
|
304 * @param aFieldTypes Types of the fields that are used. |
|
305 * @param aObserver An observer for asynchronous operation. |
|
306 * @param aWordParserCallBack a client implementation of word parser |
|
307 * function that separates the field data |
|
308 * into words. Parameter to function is |
|
309 * TVPbkWordParserParam. |
|
310 * @return A handle to the operation or NULL |
|
311 */ |
|
312 MVPbkContactOperation* CVPbkContactStoreStub::CreateFindOperationL( |
|
313 const MDesC16Array& /*aSearchStrings*/, |
|
314 const MVPbkFieldTypeList& /*aFieldTypes*/, |
|
315 MVPbkContactFindFromStoresObserver& /*aObserver*/, |
|
316 const TCallBack& /*aWordParserCallBack*/ ) { return NULL ;} |
|
317 |
|
318 /** |
|
319 * Creates an operation for compressing the store. |
|
320 * |
|
321 * @param aObserver An observer for the compress operation. |
|
322 * @return A handle to the operation or NULL |
|
323 */ |
|
324 MVPbkContactOperation* CVPbkContactStoreStub::CreateCompressStoresOperationL( |
|
325 MVPbkBatchOperationObserver& /*aObserver*/) { return NULL; } |
|
326 |
|
327 |
|
328 /** |
|
329 * Returns the number of stores in the list. |
|
330 * |
|
331 * @return The number of stores in the list. |
|
332 */ |
|
333 TInt CVPbkContactStoreListStub::Count() const { return 0; } |
|
334 |
|
335 /** |
|
336 * Returns the store in given index in the list. |
|
337 * |
|
338 * @param aIndex the index of the store in the list |
|
339 * @precond aIndex > && aIndex < Count() |
|
340 * VPbkError::Panic(VPbkError::EInvalidStoreIndex) |
|
341 * is raised if the precondition does not hold. |
|
342 * @return The store in the specified index. |
|
343 */ |
|
344 MVPbkContactStore& CVPbkContactStoreListStub::At(TInt /*aIndex*/) const |
|
345 { |
|
346 MVPbkContactStore* ret =NULL; |
|
347 return *ret; |
|
348 } |
|
349 |
|
350 /** |
|
351 * Finds the contact store corresponding to the aUri. |
|
352 * |
|
353 * @param aUri the store URI to search for. |
|
354 * @return The contact store corresponding to the aUri or NULL. |
|
355 */ |
|
356 MVPbkContactStore* CVPbkContactStoreListStub::Find( |
|
357 const TVPbkContactStoreUriPtr& /*aUri*/) const |
|
358 { |
|
359 return &gXSPStore; |
|
360 } |
|
361 |
|
362 /** |
|
363 * Opens all stores in the list asynchronously. |
|
364 * |
|
365 * A client can not use stores before it has successfully opened |
|
366 * them. CloseAll must be always called by the same observer that has |
|
367 * opened stores. |
|
368 * |
|
369 * NOTE: There can be only one observer for one store list at a time. |
|
370 * |
|
371 * @param aObserver An observer for the stores. |
|
372 * @exception KErrInUse If one observer is currently opening this list. |
|
373 */ |
|
374 void CVPbkContactStoreListStub::OpenAllL(MVPbkContactStoreListObserver& /*aObserver*/) { } |
|
375 |
|
376 /** |
|
377 * Closes all stores in the list. |
|
378 * |
|
379 * This is safe to call in all circumstances. Implementations |
|
380 * can not trust that OpenAllL has been called before. |
|
381 * |
|
382 * @param aObserver An observer for the close process. |
|
383 */ |
|
384 void CVPbkContactStoreListStub::CloseAll(MVPbkContactStoreListObserver& /*aObserver*/) { } |
|
385 |
|
386 |
|
387 |
|
388 //End of file |