50
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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: DS contacts datastore.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef __NSMLCONTACTSDATASTORE_H__
|
|
19 |
#define __NSMLCONTACTSDATASTORE_H__
|
|
20 |
|
|
21 |
// INCLUDE FILES
|
|
22 |
#include <smldataprovider.h>
|
|
23 |
#include <smldataformat.h>
|
|
24 |
#include <f32file.h>
|
|
25 |
|
|
26 |
// MACROS
|
|
27 |
#define KNSmlvCard21Version TVersion(2,1,0);
|
|
28 |
#define KNSmlvCard30Version TVersion(3,0,0);
|
|
29 |
|
|
30 |
// CONSTANTS
|
|
31 |
_LIT( KNSmlContactStoreNameForDefaultDB, "symbian" );
|
|
32 |
_LIT( KNSmlDriveC, "C" );
|
|
33 |
_LIT8( KNSmlvCard30Name, "text/vcard" );
|
|
34 |
_LIT8( KNSmlvCard30Ver, "3.0" );
|
|
35 |
_LIT8( KNSmlvCard21Name, "text/x-vcard" );
|
|
36 |
_LIT8( KNSmlvCard21Ver, "2.1" );
|
|
37 |
_LIT8(KUidFormat, "%d");
|
|
38 |
|
|
39 |
|
|
40 |
_LIT8( KVersitTokenHOME, "HOME" );
|
|
41 |
_LIT8( KVersitTokenWORK, "WORK" );
|
|
42 |
_LIT8( KVersitTokenCELL, "CELL" );
|
|
43 |
_LIT8( KVersitTokenPAGER,"PAGER" );
|
|
44 |
_LIT8( KVersitTokenFAX, "FAX" );
|
|
45 |
_LIT8( KVersitTokenVOICE,"VOICE" );
|
|
46 |
_LIT8( KVersitTokenVIDEO,"VIDEO" );
|
|
47 |
|
|
48 |
const TInt KNSmlContactsGranularity = 8;
|
|
49 |
const TInt KNSmlCompactAfterChanges = 16;
|
|
50 |
const TInt KNSmlDataStoreMaxSize = 102400; // 100 k
|
|
51 |
const TInt KNSmlDefaultStoreNameMaxSize = 256;
|
|
52 |
const TInt KNSmlItemDataExpandSize = 1024;
|
|
53 |
const TInt KNSmlNoError = 1;
|
|
54 |
|
|
55 |
_LIT(KNSmlContactsStoreFormatRsc_1_1_2,"NSmlContactsDataStoreFormat_1_1_2.rsc");
|
|
56 |
_LIT(KNSmlContactsStoreFormatRsc_1_2,"NSmlContactsDataStoreFormat_1_2.rsc");
|
|
57 |
|
|
58 |
// FORWARD DECLARATIONS
|
|
59 |
|
|
60 |
class CNsmlContactsDataStoreExtension;
|
|
61 |
class MContactsModsFetcher;
|
|
62 |
class CNSmlDataModBase;
|
|
63 |
class CNSmlChangeFinder;
|
|
64 |
class CNSmlDataItemUidSet;
|
|
65 |
class TNSmlSnapshotItem;
|
|
66 |
|
|
67 |
// CLASS DECLARATION
|
|
68 |
|
|
69 |
// ------------------------------------------------------------------------------------------------
|
|
70 |
// CNSmlContactsDataStore
|
|
71 |
//
|
|
72 |
// @lib nsmlcontactsdataprovider.lib
|
|
73 |
// ------------------------------------------------------------------------------------------------
|
|
74 |
class CNSmlContactsDataStore : public CSmlDataStore
|
|
75 |
{
|
|
76 |
public:
|
|
77 |
/**
|
|
78 |
* Two-phased constructor.
|
|
79 |
*/
|
|
80 |
IMPORT_C static CNSmlContactsDataStore* NewL();
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Destructor.
|
|
84 |
*/
|
|
85 |
IMPORT_C virtual ~CNSmlContactsDataStore();
|
|
86 |
|
|
87 |
/**
|
|
88 |
* Default store name of client.
|
|
89 |
* @return Default store name.
|
|
90 |
*/
|
|
91 |
IMPORT_C const TDesC& DefaultStoreNameL() const;
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Gets a list of all contacts databases on client.
|
|
95 |
* @return List of databases.
|
|
96 |
*/
|
|
97 |
IMPORT_C CDesCArray* DoListStoresLC();
|
|
98 |
|
|
99 |
protected:
|
|
100 |
/**
|
|
101 |
* 2nd phase constructor.
|
|
102 |
*/
|
|
103 |
IMPORT_C void ConstructL();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* 2nd phase constructor.
|
|
107 |
* @param aStorename Name of the contact database instance.
|
|
108 |
*/
|
|
109 |
IMPORT_C void ConstructL( const TDesC& aStoreName );
|
|
110 |
|
|
111 |
/**
|
|
112 |
* DoOpenL() opens the data store specified by aStoreName asynchronously.
|
|
113 |
* @param aStoreName The name of the data store to open.
|
|
114 |
* @param aContext Identifies the specific synchronisation relationship to use for the synchronisation.
|
|
115 |
* @param aStatus On completion of the open, contains the result code.
|
|
116 |
*/
|
|
117 |
IMPORT_C void DoOpenL(const TDesC& aStoreName, MSmlSyncRelationship& aContext, TRequestStatus& aStatus);
|
|
118 |
|
|
119 |
/**
|
|
120 |
* DoCancelRequest() cancels the current asynchronous request, including open. Only one asynchronous request may be outstanding at any one time.
|
|
121 |
*/
|
|
122 |
IMPORT_C void DoCancelRequest();
|
|
123 |
|
|
124 |
/**
|
|
125 |
* DoStoreName() returns the name of the open data store.
|
|
126 |
* @return The name of the currently opened data store.
|
|
127 |
*/
|
|
128 |
IMPORT_C const TDesC& DoStoreName() const;
|
|
129 |
|
|
130 |
/**
|
|
131 |
* DoBeginTransactionL() starts the transaction mode. During this mode calls to CreateItemL, ReplaceItemL,
|
|
132 |
* WriteItemL, CommitItemL, MoveItemL, DeleteItemL and SoftDeleteItemL will be part of this transaction.
|
|
133 |
* Their RequestStatus must be completed, even if the change is not yet really executed in the Data Store.
|
|
134 |
* If a RequestStatus is completed with an error code, the transaction has failed and a rollback must be
|
|
135 |
* done. In this case RevertTransaction will be called.
|
|
136 |
*/
|
|
137 |
IMPORT_C void DoBeginTransactionL();
|
|
138 |
|
|
139 |
/**
|
|
140 |
* DoCommitTransactionL() will be called at the end of a successful transaction. At this point in time the
|
|
141 |
* operations within the transaction are applied to the Data Store in an atomic way. If all operations
|
|
142 |
* succeed, the RequestStatus must be completed with KErrNone. If an operation fails, a rollback must be
|
|
143 |
* done and the RequestStatus must be completed with an appropriate error code.
|
|
144 |
*/
|
|
145 |
IMPORT_C void DoCommitTransactionL(TRequestStatus& aStatus);
|
|
146 |
|
|
147 |
/**
|
|
148 |
* DoRevertTransaction() will be called to abort an ongoing transaction. None of the operations already
|
|
149 |
* submitted may be applied to the Data Store. The RequestStatus must be completed with KErrNone as a revert
|
|
150 |
* cannot fail.
|
|
151 |
*/
|
|
152 |
IMPORT_C void DoRevertTransaction(TRequestStatus& aStatus);
|
|
153 |
|
|
154 |
/**
|
|
155 |
* DoBeginBatchL() starts the batch mode. During this mode calls to CreateItemL, ReplaceItemL,
|
|
156 |
* WriteItemL, CommitItemL, MoveItemL, DeleteItemL and SoftDeleteItemL will be part of this batch.
|
|
157 |
* Their RequestStatus must be completed with KErrNone, which only signals acceptance of the operation
|
|
158 |
* for batch processing.
|
|
159 |
*/
|
|
160 |
IMPORT_C void DoBeginBatchL();
|
|
161 |
|
|
162 |
/**
|
|
163 |
* DoCommitBatchL() will be called at the end of the batch mode. This tells the Data Store to
|
|
164 |
* process the batched operations (in the order they were submitted), and to append the error code
|
|
165 |
* for each operation to aResultArray.
|
|
166 |
* The error codes in aResultArray are only valid if the RequestStatus is completed with KErrNone.
|
|
167 |
* If the RequestStatus is completed with an error code none of the operations in the batch mode
|
|
168 |
* were applied to the Data Store.
|
|
169 |
*/
|
|
170 |
IMPORT_C void DoCommitBatchL(RArray<TInt>& aResultArray, TRequestStatus& aStatus);
|
|
171 |
|
|
172 |
/**
|
|
173 |
* DoCancelBatch() will be called to abort an ongoing batch mode. None of the operations already
|
|
174 |
* submitted may be applied to the Data Store.
|
|
175 |
*/
|
|
176 |
IMPORT_C void DoCancelBatch();
|
|
177 |
|
|
178 |
/**
|
|
179 |
* DoSetRemoteStoreFormatL() sets the SyncML server Data Format - this may optionally be used by the Data
|
|
180 |
* Provider to filter out properties that the server does not support, and should be used to avoid deleting
|
|
181 |
* these properties in case the server sends a changed item to the Data Provider
|
|
182 |
*/
|
|
183 |
IMPORT_C void DoSetRemoteStoreFormatL(const CSmlDataStoreFormat& aServerDataStoreFormat);
|
|
184 |
|
|
185 |
/**
|
|
186 |
* DoSetRemoteMaxObjectSize() sets the SyncML server maximum object size - this may optionally be used by the
|
|
187 |
* Data Provider to not send items to the server exceeding its maximum size. 0 means there is no limit.
|
|
188 |
*/
|
|
189 |
IMPORT_C void DoSetRemoteMaxObjectSize(TInt aServerMaxObjectSize);
|
|
190 |
|
|
191 |
/**
|
|
192 |
* DoMaxObjectSize() gets the Data Store maximum object size which is reported to the SyncML server. 0 means
|
|
193 |
* there is no limit.
|
|
194 |
* @return The maximum object size.
|
|
195 |
*/
|
|
196 |
IMPORT_C TInt DoMaxObjectSize() const;
|
|
197 |
|
|
198 |
/**
|
|
199 |
* DoOpenItemL() opens the data item specified by aUid asynchronously for reading.
|
|
200 |
* @param aUid Item UID which going to be read.
|
|
201 |
* @param aFieldChange Accept field changes.
|
|
202 |
* @param aParent Parent of the item.
|
|
203 |
* @param aSize Size of the item data.
|
|
204 |
* @param aMimeType MIME type of the item.
|
|
205 |
* @param aMimeVer MIME version used on item.
|
|
206 |
* @param aStatus On completion of the opening of item, contains the result code.
|
|
207 |
*/
|
|
208 |
IMPORT_C void DoOpenItemL(TSmlDbItemUid aUid, TBool& aFieldChange, TInt& aSize, TSmlDbItemUid& aParent, TDes8& aMimeType, TDes8& aMimeVer, TRequestStatus& aStatus);
|
|
209 |
|
|
210 |
/**
|
|
211 |
* DoCreateItemL() sets the item properties and reference to aUid which will be created.
|
|
212 |
* @param aUid Reference to item UID which going to be created.
|
|
213 |
* @param aSize Size of the item to be created.
|
|
214 |
* @param aParent Parent of the item.
|
|
215 |
* @param aMimeType MIME type of the item.
|
|
216 |
* @param aMimeVer MIME version used on item.
|
|
217 |
* @param aStatus On completion of the creating an item, contains the result code.
|
|
218 |
*/
|
|
219 |
IMPORT_C void DoCreateItemL(TSmlDbItemUid& aUid, TInt aSize, TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& aMimeVer, TRequestStatus& aStatus);
|
|
220 |
|
|
221 |
/**
|
|
222 |
* DoReplaceItemL() opens the data item specified by aUid asynchronously to be updated.
|
|
223 |
* @param aUid Item UID which going to be updated.
|
|
224 |
* @param aSize Size of the item data.
|
|
225 |
* @param aParent Parent of the item.
|
|
226 |
* @param aFieldChange Accept field changes.
|
|
227 |
* @param aStatus On completion of the updating of item, contains the result code.
|
|
228 |
*/
|
|
229 |
IMPORT_C void DoReplaceItemL(TSmlDbItemUid aUid, TInt aSize, TSmlDbItemUid aParent, TBool aFieldChange, TRequestStatus& aStatus);
|
|
230 |
|
|
231 |
/**
|
|
232 |
* DoReadItemL() reads data(or size of aBuffer) of an item opened in DoOpenItemL() to given aBuffer.
|
|
233 |
* @param aBuffer Buffer to item data.
|
|
234 |
*/
|
|
235 |
IMPORT_C void DoReadItemL(TDes8& aBuffer);
|
|
236 |
|
|
237 |
/**
|
|
238 |
* DoWriteItemL() writes aData of an item opened in DoCreateItemL() or DoReplaceItemL() to be saved on database.
|
|
239 |
* @param aData Item data (or part of data).
|
|
240 |
*/
|
|
241 |
IMPORT_C void DoWriteItemL(const TDesC8& aData);
|
|
242 |
|
|
243 |
/**
|
|
244 |
* DoCommitItemL() completes an item operation started in DoCreateItemL() or DoReplaceItemL().
|
|
245 |
* @param aStatus On completion of the operation, contains the result code.
|
|
246 |
*/
|
|
247 |
IMPORT_C void DoCommitItemL(TRequestStatus& aStatus);
|
|
248 |
|
|
249 |
/**
|
|
250 |
* DoCloseItem() completes an item operation started in DoOpenItemL().
|
|
251 |
*/
|
|
252 |
IMPORT_C void DoCloseItem();
|
|
253 |
|
|
254 |
/**
|
|
255 |
* DoMoveItemL() moves item specified by aUid asynchronously.
|
|
256 |
* @param aUid Item UID which going to be moved.
|
|
257 |
* @param aNewParent A new parent of the item.
|
|
258 |
* @param aStatus On completion of the moving an item, contains the result code.
|
|
259 |
*/
|
|
260 |
IMPORT_C void DoMoveItemL(TSmlDbItemUid aUid, TSmlDbItemUid aNewParent, TRequestStatus& aStatus);
|
|
261 |
|
|
262 |
/**
|
|
263 |
* DoDeleteItemL() deletes item specified by aUid asynchronously.
|
|
264 |
* @param aUid Item UID which going to be deleted.
|
|
265 |
* @param aStatus On completion of the deleting an item, contains the result code.
|
|
266 |
*/
|
|
267 |
IMPORT_C void DoDeleteItemL(TSmlDbItemUid aUid, TRequestStatus& aStatus);
|
|
268 |
|
|
269 |
/**
|
|
270 |
* DoSoftDeleteItemL() soft deletes item specified by aUid asynchronously.
|
|
271 |
* @param aUid Item UID which going to be softdeleted.
|
|
272 |
* @param aStatus On completion of the softdeleting an item, contains the result code.
|
|
273 |
*/
|
|
274 |
IMPORT_C void DoSoftDeleteItemL(TSmlDbItemUid aUid, TRequestStatus& aStatus);
|
|
275 |
|
|
276 |
/**
|
|
277 |
* DoDeleteAllItemsL() deletes all items from opened database asynchronously.
|
|
278 |
* @param aStatus On completion of delete, contains the result code.
|
|
279 |
*/
|
|
280 |
IMPORT_C void DoDeleteAllItemsL(TRequestStatus& aStatus);
|
|
281 |
|
|
282 |
/**
|
|
283 |
* DoHasSyncHistory() checks if previous sync with opened server and context.
|
|
284 |
* @return ETrue if there is synchonization history.
|
|
285 |
*/
|
|
286 |
IMPORT_C TBool DoHasSyncHistory() const;
|
|
287 |
|
|
288 |
/**
|
|
289 |
* DoAddedItems() gets all added items on client since previous synchronization.
|
|
290 |
* @return Added items.
|
|
291 |
*/
|
|
292 |
IMPORT_C const MSmlDataItemUidSet& DoAddedItems() const;
|
|
293 |
|
|
294 |
/**
|
|
295 |
* DoDeletedItems() gets all deleted items on client since previous synchronization.
|
|
296 |
* @return Deleted items.
|
|
297 |
*/
|
|
298 |
IMPORT_C const MSmlDataItemUidSet& DoDeletedItems() const;
|
|
299 |
|
|
300 |
/**
|
|
301 |
* DoSoftDeletedItems() gets all softdeleted items on client since previous synchronization.
|
|
302 |
* @return Soft deleted items.
|
|
303 |
*/
|
|
304 |
IMPORT_C const MSmlDataItemUidSet& DoSoftDeletedItems() const;
|
|
305 |
|
|
306 |
/**
|
|
307 |
* DoModifiedItems() gets all modified items on client since previous synchronization.
|
|
308 |
* @return Modified items.
|
|
309 |
*/
|
|
310 |
IMPORT_C const MSmlDataItemUidSet& DoModifiedItems() const;
|
|
311 |
|
|
312 |
/**
|
|
313 |
* DoMovedItems() gets all moved items on client since previous synchronization.
|
|
314 |
* @return Moved items.
|
|
315 |
*/
|
|
316 |
IMPORT_C const MSmlDataItemUidSet& DoMovedItems() const;
|
|
317 |
|
|
318 |
/**
|
|
319 |
* DoResetChangeInfoL() resets client synchronization data => next time will be slow sync.
|
|
320 |
* @param aStatus On completion of reset, contains the result code.
|
|
321 |
*/
|
|
322 |
IMPORT_C void DoResetChangeInfoL(TRequestStatus& aStatus);
|
|
323 |
|
|
324 |
/**
|
|
325 |
* DoCommitChangeInfoL() commits client synchronization changes for given aItems list.
|
|
326 |
* @param aStatus On completion of given items, contains the result code.
|
|
327 |
* @param aItems Item ids to be commited.
|
|
328 |
*/
|
|
329 |
IMPORT_C void DoCommitChangeInfoL(TRequestStatus& aStatus, const MSmlDataItemUidSet& aItems);
|
|
330 |
|
|
331 |
/**
|
|
332 |
* DoCommitChangeInfoL() commits all client synchronization changes.
|
|
333 |
* @param aStatus On completion of all items, contains the result code.
|
|
334 |
*/
|
|
335 |
IMPORT_C void DoCommitChangeInfoL(TRequestStatus& aStatus);
|
|
336 |
|
|
337 |
/**
|
|
338 |
* Default constructor.
|
|
339 |
*/
|
|
340 |
IMPORT_C CNSmlContactsDataStore();
|
|
341 |
|
|
342 |
/**
|
|
343 |
* SetOwnStoreFormatL() Sets dataproviders own storeformat.
|
|
344 |
*/
|
|
345 |
IMPORT_C void SetOwnStoreFormatL();
|
|
346 |
|
|
347 |
/**
|
|
348 |
* LdoFetchItemL() Fetches item data from database.
|
|
349 |
* @param aUid Items uid for fetching.
|
|
350 |
* @param aItem Items data after fetch.
|
|
351 |
* @return KErrNone if successful.
|
|
352 |
*/
|
|
353 |
IMPORT_C TInt LdoFetchItemL( TSmlDbItemUid& aUid, CBufBase& aItem );
|
|
354 |
|
|
355 |
/**
|
|
356 |
* LdoAddItemL() Adds item data to database.
|
|
357 |
* @param aUid Item uid reference for add.
|
|
358 |
* @param aItem Item data to be added.
|
|
359 |
* @param aSize Item data size.
|
|
360 |
* @param aLastModified Item creation date.
|
|
361 |
* @return KErrNone if successful.
|
|
362 |
*/
|
|
363 |
IMPORT_C TInt LdoAddItemL( TSmlDbItemUid& aUid,
|
|
364 |
const TDesC8& aItem,
|
|
365 |
TInt aSize,
|
|
366 |
TTime& aLastModified );
|
|
367 |
|
|
368 |
/**
|
|
369 |
* LdoAddItemsL() Adds several items to database.
|
|
370 |
* @param aUids Array of items uid references for add.
|
|
371 |
* @param aItem Items data to be added.
|
|
372 |
* @param aSize Items data size.
|
|
373 |
* @param aLastModified Last items creation date.
|
|
374 |
* @return KErrNone if successful.
|
|
375 |
*/
|
|
376 |
IMPORT_C TInt LdoAddItemsL( RArray<TInt>& aUids,
|
|
377 |
CBufBase*& aItem,
|
|
378 |
TInt aSize,
|
|
379 |
TTime& aLastModified );
|
|
380 |
|
|
381 |
/**
|
|
382 |
* LdoUpdateItemL() Updates item data to database.
|
|
383 |
* @param aUid Item uid for update.
|
|
384 |
* @param aItem Item data to be updated.
|
|
385 |
* @param aSize Item data size.
|
|
386 |
* @param aLastModified Item modification date.
|
|
387 |
* @return KErrNone if successful.
|
|
388 |
*/
|
|
389 |
IMPORT_C TInt LdoUpdateItemL( TSmlDbItemUid aUid,
|
|
390 |
const TDesC8& aItem,
|
|
391 |
TInt aSize,
|
|
392 |
TTime& aLastModified );
|
|
393 |
|
|
394 |
/**
|
|
395 |
* LdoMergeLC() Merges item data from server in update with clients item data.
|
|
396 |
* @param aUid Item uid for update.
|
|
397 |
* @param aItem Item data to be merged.
|
|
398 |
* @return KErrNone if successful.
|
|
399 |
*/
|
|
400 |
IMPORT_C CBufBase* LdoMergeLC( TSmlDbItemUid& aUid, const TDesC8& aItem );
|
|
401 |
|
|
402 |
/**
|
|
403 |
* DriveBelowCriticalLevelL() Checks if there is enough space on client to store added item data.
|
|
404 |
* @param aSize Item size to be added.
|
|
405 |
* @return ETrue if there isn't enough drive space.
|
|
406 |
*/
|
|
407 |
IMPORT_C TBool DriveBelowCriticalLevelL( TInt aSize );
|
|
408 |
|
|
409 |
/**
|
|
410 |
* StripPropertyL() Removes aProperty from aItem data.
|
|
411 |
* @param aItem Item data to be stripped.
|
|
412 |
* @param aProperty Property to be removed from aItem.
|
|
413 |
*/
|
|
414 |
IMPORT_C void StripPropertyL( HBufC8*& aItem, const TDesC8& aProperty ) const;
|
|
415 |
|
|
416 |
/**
|
|
417 |
* StripPropertyL() Remove aPropertys from aItem data.
|
|
418 |
* @param aItem Item(s) data to be stripped.
|
|
419 |
* @param aProperty Property to be removed from aItem.
|
|
420 |
*/
|
|
421 |
IMPORT_C void StripPropertyL( CBufBase*& aItem, const TDesC8& aProperty ) const;
|
|
422 |
|
|
423 |
/**
|
|
424 |
* ExecuteBufferL()Executes all buffered items from buffer.
|
|
425 |
* @param aResultArray Array to return statuscodes for each command.
|
|
426 |
* @return KErrNone if successful.
|
|
427 |
*/
|
|
428 |
IMPORT_C TInt ExecuteBufferL(RArray<TInt>& aResultArray);
|
|
429 |
|
|
430 |
/**
|
|
431 |
* AddBufferListL()Adds a new item to buffer.
|
|
432 |
* @param aUid New item's uid.
|
|
433 |
* @param aSize New item's size.
|
|
434 |
* @param aStatus New item's status.
|
|
435 |
* @return Pointer to the buffer.
|
|
436 |
*/
|
|
437 |
IMPORT_C CBufBase* AddBufferListL(TSmlDbItemUid& aUid, TInt aSize, TInt aStatus);
|
|
438 |
|
|
439 |
/**
|
|
440 |
* Reads all modifications from clients contacts databse.
|
|
441 |
*/
|
|
442 |
TInt FetchModificationsL();
|
|
443 |
|
|
444 |
protected: // New
|
|
445 |
|
|
446 |
IMPORT_C virtual const TDesC& GetStoreFormatResourceFileL() const;
|
|
447 |
|
|
448 |
/**
|
|
449 |
* Performs the actual computation for ExecuteBufferL() method.
|
|
450 |
* Allows re-implementation of the method in sub-classes.
|
|
451 |
*
|
|
452 |
* @param aResultArray Array to return statuscodes for each command.
|
|
453 |
* @return KErrNone if successful.
|
|
454 |
*/
|
|
455 |
IMPORT_C virtual TInt DoExecuteBufferL(RArray<TInt>& aResultArray);
|
|
456 |
|
|
457 |
/**
|
|
458 |
* Get datamod instance
|
|
459 |
* @return reference to datamod instance.
|
|
460 |
*/
|
|
461 |
IMPORT_C virtual CNSmlDataModBase& GetDataMod();
|
|
462 |
|
|
463 |
/**
|
|
464 |
* Exports the contact in the vCard format from contacts database.
|
|
465 |
* @param aUid UID of the contact to be exported
|
|
466 |
* @param aContactBufBase Upon return includes the contents of
|
|
467 |
* the exported vCard.
|
|
468 |
* @return Error code.
|
|
469 |
*/
|
|
470 |
IMPORT_C virtual TInt ExportContactsL( const TUid& aUid,
|
|
471 |
CBufBase& aContactBufBase );
|
|
472 |
|
|
473 |
/**
|
|
474 |
* Imports the contact in the vCard to contacts database.
|
|
475 |
* @param aContactBufBase The contents of the vCards to be
|
|
476 |
* imported.
|
|
477 |
* @return An UID array of the contacts which were imported.
|
|
478 |
*/
|
|
479 |
IMPORT_C virtual CArrayFixFlat<TUid>* ImportContactsL(
|
|
480 |
const TDesC8& aContactBufBase );
|
|
481 |
|
|
482 |
protected: // data
|
|
483 |
|
|
484 |
// MODULE DATA STRUCTURES
|
|
485 |
enum TNSmlDataStoreStatus // DataStore status
|
|
486 |
{
|
|
487 |
ENSmlClosed = 1,
|
|
488 |
ENSmlOpenAndWaiting,
|
|
489 |
ENSmlItemOverflow,
|
|
490 |
ENSmlItemOpen,
|
|
491 |
ENSmlItemCreating,
|
|
492 |
ENSmlItemUpdating
|
|
493 |
};
|
|
494 |
|
|
495 |
enum TNSmlCntCommand // Modification type
|
|
496 |
{
|
|
497 |
ENSmlCntItemAdd = 1,
|
|
498 |
ENSmlCntItemDelete,
|
|
499 |
ENSmlCntItemSoftDelete,
|
|
500 |
ENSmlCntItemRead,
|
|
501 |
ENSmlCntItemMove,
|
|
502 |
ENSmlCntItemReplace,
|
|
503 |
ENSmlCntItemFieldLevelReplace
|
|
504 |
};
|
|
505 |
|
|
506 |
// ------------------------------------------------------------------------------------------------
|
|
507 |
// Buffering Stuff for BatchMode operations
|
|
508 |
// ------------------------------------------------------------------------------------------------
|
|
509 |
class CNSmlContactsBufferItem : public CBase
|
|
510 |
{
|
|
511 |
public:
|
|
512 |
/**
|
|
513 |
* Destructor.
|
|
514 |
*/
|
|
515 |
~CNSmlContactsBufferItem();
|
|
516 |
|
|
517 |
public: // data
|
|
518 |
TSmlDbItemUid *iPUid; // New item ID
|
|
519 |
TSmlDbItemUid iUid; // Item ID
|
|
520 |
CBufBase *iItemData; // Item data
|
|
521 |
HBufC8 *iMimeType; // Mimetype
|
|
522 |
HBufC8 *iMimeVersion; // Mime version
|
|
523 |
TNSmlCntCommand iModType; // Commands type
|
|
524 |
TInt iStatus; // Command status
|
|
525 |
TInt iSize; // Item size
|
|
526 |
};
|
|
527 |
|
|
528 |
|
|
529 |
protected:
|
|
530 |
TRequestStatus* iCallerStatus;
|
|
531 |
TBool iBatchMode;
|
|
532 |
TNSmlCntCommand iModType;
|
|
533 |
TBool iOpened;
|
|
534 |
TBool iSyncHistory;
|
|
535 |
TInt64 iOpenedStoreId;
|
|
536 |
RPointerArray<CNSmlContactsBufferItem> iContactsBufferItemList;
|
|
537 |
TSmlDbItemUid *iPUid;
|
|
538 |
TSmlDbItemUid iUid;
|
|
539 |
CBufBase* iItemDataAddBatch;
|
|
540 |
RArray<TInt> iAddResultArray;
|
|
541 |
CBufBase* iItemData;
|
|
542 |
|
|
543 |
CNSmlChangeFinder* iChangeFinder;
|
|
544 |
TKeyArrayFix iKey;
|
|
545 |
TBool iSnapshotRegistered;
|
|
546 |
TBool iFieldLevelReplace;
|
|
547 |
CSmlDataStoreFormat* iStoreFormat;
|
|
548 |
|
|
549 |
TInt iServerMaxObjectSize;
|
|
550 |
TInt iItemPos;
|
|
551 |
TNSmlDataStoreStatus iState;
|
|
552 |
|
|
553 |
|
|
554 |
TBool iTransactionMode;
|
|
555 |
TInt iModificationCount;
|
|
556 |
|
|
557 |
TPtrC8 iMimeTypeItem;
|
|
558 |
TPtrC8 iMimeVersionItem;
|
|
559 |
|
|
560 |
TPtrC8 iUsedMimeType;
|
|
561 |
TPtrC8 iUsedMimeVersion;
|
|
562 |
|
|
563 |
RStringF iServerMimeType;
|
|
564 |
RStringF iServerMimeVersion;
|
|
565 |
|
|
566 |
HBufC* iDefaultStoreName;
|
|
567 |
|
|
568 |
CNSmlDataModBase* iDataMod;
|
|
569 |
|
|
570 |
RFs iRfs;
|
|
571 |
TInt iDrive;
|
|
572 |
|
|
573 |
TInt iItemSize;
|
|
574 |
|
|
575 |
HBufC* iStoreName;
|
|
576 |
|
|
577 |
RStringPool iStringPool;
|
|
578 |
|
|
579 |
CNSmlDataItemUidSet* iNewUids;
|
|
580 |
CNSmlDataItemUidSet* iDeletedUids;
|
|
581 |
CNSmlDataItemUidSet* iSoftDeletedUids;
|
|
582 |
CNSmlDataItemUidSet* iReplacedUids;
|
|
583 |
CNSmlDataItemUidSet* iMovedUids;
|
|
584 |
|
|
585 |
TBool iLastItem;
|
|
586 |
TInt iStateItem;
|
|
587 |
|
|
588 |
CNsmlContactsDataStoreExtension* iContactsDataStoreExtension;
|
|
589 |
|
|
590 |
CArrayFixSeg<TNSmlSnapshotItem>* iSnapshot;
|
|
591 |
CArrayFixFlat<TUid>* iCntUidList;
|
|
592 |
|
|
593 |
};
|
|
594 |
|
|
595 |
#endif // __NSMLCONTACTSDATASTORE_H__
|
|
596 |
|
|
597 |
// End of File
|