40
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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: CSmsDataStore header
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __SMSDATASTORE_H__
|
|
20 |
#define __SMSDATASTORE_H__
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include <SmlDataProvider.h>
|
|
24 |
#include "snapshotitem.h"
|
|
25 |
#include "changefinder.h"
|
|
26 |
|
|
27 |
// FORWARD DECLARATIONS
|
|
28 |
class CSmsAdapterMsvApi;
|
|
29 |
class CNSmlDataItemUidSet;
|
|
30 |
class TNSmlSnapshotItem;
|
|
31 |
class CVMessageParser;
|
|
32 |
class COMADSFolderObject;
|
|
33 |
|
|
34 |
// CLASS DECLARATION
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Class CSmsDataStore
|
|
38 |
* Data Store class of SMS DS Plug In Adapter implementation.
|
|
39 |
* Inherited from generic CSmlDataStore class.
|
|
40 |
*/
|
|
41 |
class CSmsDataStore : public CSmlDataStore
|
|
42 |
{
|
|
43 |
public:
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Constructor, leaves the created instance into the CleanupStack.
|
|
47 |
*
|
|
48 |
* @return CSmsDataStore*, a new CSmsDataStore instance.
|
|
49 |
*/
|
|
50 |
static CSmsDataStore* NewLC();
|
|
51 |
|
|
52 |
/**
|
|
53 |
* Destructor
|
|
54 |
*/
|
|
55 |
virtual ~CSmsDataStore();
|
|
56 |
|
|
57 |
protected:
|
|
58 |
|
|
59 |
// Virtual functionality from CSmlDataStore, for comments see the CSmlDataStore header file
|
|
60 |
virtual void DoOpenL( const TDesC& aStoreName, MSmlSyncRelationship& aContext, TRequestStatus& aStatus );
|
|
61 |
virtual void DoCancelRequest();
|
|
62 |
virtual const TDesC& DoStoreName() const;
|
|
63 |
virtual void DoBeginTransactionL();
|
|
64 |
virtual void DoCommitTransactionL( TRequestStatus& aStatus );
|
|
65 |
virtual void DoRevertTransaction( TRequestStatus& aStatus );
|
|
66 |
virtual void DoBeginBatchL();
|
|
67 |
virtual void DoCommitBatchL( RArray<TInt>& aResultArray, TRequestStatus& aStatus );
|
|
68 |
virtual void DoCancelBatch();
|
|
69 |
virtual void DoSetRemoteStoreFormatL( const CSmlDataStoreFormat& aServerDataStoreFormat );
|
|
70 |
virtual void DoSetRemoteMaxObjectSize( TInt aServerMaxObjectSize );
|
|
71 |
virtual TInt DoMaxObjectSize() const;
|
|
72 |
virtual void DoOpenItemL( TSmlDbItemUid aUid, TBool& aFieldChange, TInt& aSize, TSmlDbItemUid& aParent, TDes8& aMimeType, TDes8& aMimeVer, TRequestStatus& aStatus );
|
|
73 |
virtual void DoCreateItemL( TSmlDbItemUid& aUid, TInt aSize, TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& aMimeVer, TRequestStatus& aStatus );
|
|
74 |
virtual void DoReplaceItemL( TSmlDbItemUid aUid, TInt aSize, TSmlDbItemUid aParent, TBool aFieldChange, TRequestStatus& aStatus );
|
|
75 |
virtual void DoReadItemL( TDes8& aBuffer );
|
|
76 |
virtual void DoWriteItemL( const TDesC8& aData );
|
|
77 |
virtual void DoCommitItemL( TRequestStatus& aStatus );
|
|
78 |
virtual void DoCloseItem();
|
|
79 |
virtual void DoMoveItemL( TSmlDbItemUid aUid, TSmlDbItemUid aNewParent, TRequestStatus& aStatus );
|
|
80 |
virtual void DoDeleteItemL( TSmlDbItemUid aUid, TRequestStatus& aStatus );
|
|
81 |
virtual void DoSoftDeleteItemL( TSmlDbItemUid aUid, TRequestStatus& aStatus );
|
|
82 |
virtual void DoDeleteAllItemsL( TRequestStatus& aStatus );
|
|
83 |
virtual TBool DoHasSyncHistory() const;
|
|
84 |
virtual const MSmlDataItemUidSet& DoAddedItems() const;
|
|
85 |
virtual const MSmlDataItemUidSet& DoDeletedItems() const;
|
|
86 |
virtual const MSmlDataItemUidSet& DoSoftDeletedItems() const;
|
|
87 |
virtual const MSmlDataItemUidSet& DoModifiedItems() const;
|
|
88 |
virtual const MSmlDataItemUidSet& DoMovedItems() const;
|
|
89 |
virtual void DoResetChangeInfoL( TRequestStatus& aStatus );
|
|
90 |
virtual void DoCommitChangeInfoL( TRequestStatus& aStatus, const MSmlDataItemUidSet& aItems );
|
|
91 |
virtual void DoCommitChangeInfoL( TRequestStatus& aStatus );
|
|
92 |
|
|
93 |
private:
|
|
94 |
|
|
95 |
|
|
96 |
/**
|
|
97 |
* Constructor.
|
|
98 |
*/
|
|
99 |
CSmsDataStore();
|
|
100 |
|
|
101 |
/**
|
|
102 |
* 2nd-phase Constructor.
|
|
103 |
*/
|
|
104 |
void ConstructL();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Registers snapshot to ChangeFinder.
|
|
108 |
*/
|
|
109 |
void RegisterSnapshotL() const;
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Registers a single folder to snapshot, used by RegisterSnapshotL.
|
|
113 |
*
|
|
114 |
* @param aSnapshot IN: a snapshot item array.
|
|
115 |
* @param aId IN: folder id.
|
|
116 |
* @return TInt, Not used.
|
|
117 |
*/
|
|
118 |
TInt RegisterFolderL( CSnapshotArray* aSnapshot, const TMsvId& aId ) const;
|
|
119 |
|
|
120 |
/**
|
|
121 |
* Registers user folder messages to snapshot, used by RegisterSnapshotL.
|
|
122 |
*
|
|
123 |
* @param aSnapshot IN: a snapshot item array.
|
|
124 |
* @return TInt, Not used.
|
|
125 |
*/
|
|
126 |
TInt RegisterUserFoldersL(CSnapshotArray* aSnapshot) const;
|
|
127 |
|
|
128 |
private: // Data members
|
|
129 |
|
|
130 |
/**
|
|
131 |
* @brief Data Store states:
|
|
132 |
* ESmsClosed: Store is closed.
|
|
133 |
* ESmsOpenAndWaiting: Store is ready to be used.
|
|
134 |
* ESmsItemOpen: Item is being read.
|
|
135 |
* ESmsItemCreating: Item is being created.
|
|
136 |
* ESmsItemUpdating: Item is being updated.
|
|
137 |
*/
|
|
138 |
enum TState
|
|
139 |
{
|
|
140 |
ESmsClosed = 0,
|
|
141 |
ESmsOpenAndWaiting,
|
|
142 |
ESmsItemOpen,
|
|
143 |
ESmsItemCreating,
|
|
144 |
ESmsItemUpdating
|
|
145 |
};
|
|
146 |
|
|
147 |
/**
|
|
148 |
* @brief Possible MIME types:
|
|
149 |
* EMessageFolder: Message folder
|
|
150 |
* ESmsMessageItem: SMS message.
|
|
151 |
*/
|
|
152 |
enum TMimeType
|
|
153 |
{
|
|
154 |
EMessageFolder = 0,
|
|
155 |
ESmsMessage
|
|
156 |
};
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Access to streams, used by ChangeFinder.
|
|
160 |
*/
|
|
161 |
MSmlSyncRelationship* iContext;
|
|
162 |
|
|
163 |
/**
|
|
164 |
* A flag indicating the existence of synchronization history.
|
|
165 |
*/
|
|
166 |
TBool iHasHistory;
|
|
167 |
/**
|
|
168 |
* Flag indicating, whether database is opened.
|
|
169 |
*/
|
|
170 |
TBool iDataBaseOpened;
|
|
171 |
/**
|
|
172 |
* Pointer to the variable, receiving the created Uid.
|
|
173 |
*/
|
|
174 |
TSmlDbItemUid* iCreatedUid;
|
|
175 |
|
|
176 |
/**
|
|
177 |
* The state of the active object.
|
|
178 |
*/
|
|
179 |
TState iCurrentState;
|
|
180 |
|
|
181 |
/**
|
|
182 |
* MIME type of the active object
|
|
183 |
*/
|
|
184 |
TMimeType iMimeType;
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Key that is used in sorting snapshot.
|
|
188 |
*/
|
|
189 |
const TKeyArrayFix iKey;
|
|
190 |
/**
|
|
191 |
* Change finder, used to determine db modifications.
|
|
192 |
*/
|
|
193 |
CChangeFinder* iChangeFinder;
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Used to access SMS message store;
|
|
197 |
*/
|
|
198 |
CSmsAdapterMsvApi* iMsvApi;
|
|
199 |
|
|
200 |
/**
|
|
201 |
* The location for temporary data
|
|
202 |
*/
|
|
203 |
CBufFlat* iDataBuffer;
|
|
204 |
/**
|
|
205 |
* Current position in a temporary data buffer (write).
|
|
206 |
*/
|
|
207 |
TInt iWriterPosition;
|
|
208 |
/**
|
|
209 |
* Current position in a temporary data buffer (read).
|
|
210 |
*/
|
|
211 |
TInt iReaderPosition;
|
|
212 |
|
|
213 |
/**
|
|
214 |
* Stores the currently active message id.
|
|
215 |
*/
|
|
216 |
TSmlDbItemUid iCurrentId;
|
|
217 |
/**
|
|
218 |
* Stores the parent id of currently active message.
|
|
219 |
*/
|
|
220 |
TSmlDbItemUid iParentId;
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Used to get asynchronous return values.
|
|
224 |
*/
|
|
225 |
TRequestStatus* iCallerStatus;
|
|
226 |
|
|
227 |
/**
|
|
228 |
* Used to store new items.
|
|
229 |
*/
|
|
230 |
CNSmlDataItemUidSet* iNewItems;
|
|
231 |
/**
|
|
232 |
* Used to store deleted items.
|
|
233 |
*/
|
|
234 |
CNSmlDataItemUidSet* iDeletedItems;
|
|
235 |
/**
|
|
236 |
* Used to store updated items.
|
|
237 |
*/
|
|
238 |
CNSmlDataItemUidSet* iUpdatedItems;
|
|
239 |
/**
|
|
240 |
* Used to store moved items.
|
|
241 |
*/
|
|
242 |
CNSmlDataItemUidSet* iMovedItems;
|
|
243 |
/**
|
|
244 |
* Used to store soft-deleted items (not supported).
|
|
245 |
*/
|
|
246 |
CNSmlDataItemUidSet* iSoftDeletedItems;
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Used to parse VMessages
|
|
250 |
*/
|
|
251 |
CVMessageParser* iMessageParser;
|
|
252 |
|
|
253 |
/**
|
|
254 |
* Used to parse OMA DS Folder Objects
|
|
255 |
*/
|
|
256 |
COMADSFolderObject* iFolderObjectParser;
|
|
257 |
|
|
258 |
/**
|
|
259 |
* Reserved pointer for future extension.
|
|
260 |
*/
|
|
261 |
TAny* iReserved;
|
|
262 |
};
|
|
263 |
|
|
264 |
#endif // __SMSDATASTORE_H__
|
|
265 |
|