1 /* |
|
2 * Copyright (c) 2005 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 notepad dataprovider |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 |
|
21 #include <barsc.h> |
|
22 #include <bautils.h> |
|
23 #include <SmlDataProvider.h> |
|
24 #include <implementationproxy.h> |
|
25 #include <nsmlnotepaddatastoreformat.rsg> |
|
26 #include <data_caging_path_literals.hrh> |
|
27 #include "NSmlNotepadDataProvider.h" |
|
28 #include "NSmlNotepadDatastore.h" |
|
29 #include "nsmlnotepaddefs.h" |
|
30 |
|
31 #include "nsmlnotepadlogging.h" |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CNSmlNotepadDataProvider::NewL |
|
37 // ----------------------------------------------------------------------------- |
|
38 // |
|
39 CNSmlNotepadDataProvider* CNSmlNotepadDataProvider::NewL() |
|
40 { |
|
41 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewL(): begin"); |
|
42 CNSmlNotepadDataProvider* self = NewLC(); |
|
43 CleanupStack::Pop(self); |
|
44 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewL(): end"); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CNSmlNotepadDataProvider::NewLC |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 CNSmlNotepadDataProvider* CNSmlNotepadDataProvider::NewLC() |
|
53 { |
|
54 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewLC(): begin"); |
|
55 CNSmlNotepadDataProvider* self = new (ELeave) CNSmlNotepadDataProvider(); |
|
56 CleanupStack::PushL( self ); |
|
57 self->ConstructL(); |
|
58 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::NewLC(): end"); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // CNSmlNotepadDataProvider::CNSmlNotepadDataProvider |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 CNSmlNotepadDataProvider::CNSmlNotepadDataProvider() |
|
67 { |
|
68 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::CNSmlNotepadDataProvider(): begin"); |
|
69 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::CNSmlNotepadDataProvider(): end"); |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CNSmlNotepadDataProvider::ConstructL |
|
74 // ----------------------------------------------------------------------------- |
|
75 // |
|
76 void CNSmlNotepadDataProvider::ConstructL() |
|
77 { |
|
78 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::ConstructL(): begin"); |
|
79 User::LeaveIfError( iRfs.Connect() ); |
|
80 iNotepadDataStore = CNSmlNotepadDataStore::NewL(); |
|
81 iStringPool.OpenL(); |
|
82 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::ConstructL(): end"); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CNSmlNotepadDataProvider::CNSmlNotepadDataProvider |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider() |
|
90 { |
|
91 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider(): begin"); |
|
92 iRfs.Close(); |
|
93 if(iNotepadDataStore) |
|
94 { |
|
95 delete iNotepadDataStore; |
|
96 iNotepadDataStore = NULL; |
|
97 } |
|
98 if(iStoreFormat) |
|
99 { |
|
100 delete iStoreFormat; |
|
101 iStoreFormat = NULL; |
|
102 } |
|
103 iFilterArray.ResetAndDestroy(); |
|
104 iFilterArray.Close(); |
|
105 iStringPool.Close(); |
|
106 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::~CNSmlNotepadDataProvider(): end"); |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CNSmlNotepadDataProvider::DoOnFrameworkEvent |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CNSmlNotepadDataProvider::DoOnFrameworkEvent( TSmlFrameworkEvent /*aFrameworkEvent*/, |
|
114 TInt /*aParam1*/, |
|
115 TInt /*aParam2*/ ) |
|
116 { |
|
117 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoOnFrameworkEvent(): begin"); |
|
118 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoOnFrameworkEvent(): end"); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CNSmlNotepadDataProvider::DoSupportsOperation |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 TBool CNSmlNotepadDataProvider::DoSupportsOperation( TUid aOpId ) const |
|
126 { |
|
127 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportsOperation(): begin"); |
|
128 if ( aOpId == KUidSmlSupportMultipleStores ) |
|
129 { |
|
130 _NOTEPAD_DBG_FILE("CNSmlAgendaDataProvider::DoSupportsOperation: true end"); |
|
131 return ETrue; |
|
132 } |
|
133 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportsOperation(): end"); |
|
134 return EFalse; // KUidSmlSupportTransaction ,KUidSmlSupportSuspendResume, KUidSmlSupportUserSelectableMatchType |
|
135 } |
|
136 |
|
137 // ----------------------------------------------------------------------------- |
|
138 // CNSmlNotepadDataProvider::DoStoreFormatL |
|
139 // ----------------------------------------------------------------------------- |
|
140 // |
|
141 const CSmlDataStoreFormat& CNSmlNotepadDataProvider::DoStoreFormatL() |
|
142 { |
|
143 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoStoreFormatL(): begin"); |
|
144 if( !iStoreFormat ) |
|
145 { |
|
146 TFileName fileName; |
|
147 TParse parse; |
|
148 |
|
149 // Locate the resource file |
|
150 TFileName dllFileName; |
|
151 Dll::FileName( dllFileName ); |
|
152 |
|
153 TFileName resourceFileName; |
|
154 resourceFileName.Copy( TParsePtrC( dllFileName ).Drive() ); |
|
155 resourceFileName.Append(KNSmlNotepadStoreFormatRsc); |
|
156 |
|
157 parse.Set( resourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
158 fileName = parse.FullName(); |
|
159 RResourceFile resourceFile; |
|
160 BaflUtils::NearestLanguageFile( iRfs, fileName ); |
|
161 resourceFile.OpenL( iRfs,fileName ); |
|
162 CleanupClosePushL( resourceFile ); |
|
163 HBufC8* notepadDataFormat = resourceFile.AllocReadLC( NSML_NOTEPAD_DATA_STORE_FORMAT ); |
|
164 TResourceReader reader; |
|
165 reader.SetBuffer( notepadDataFormat ); |
|
166 iStoreFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader ); |
|
167 CleanupStack::Pop(iStoreFormat); // iStoreFormat |
|
168 CleanupStack::PopAndDestroy( 2 ); // notepadDataFormat,resourceFile |
|
169 } |
|
170 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoStoreFormatL(): end"); |
|
171 return *iStoreFormat; |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CNSmlNotepadDataProvider::DoListStoresLC |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 |
|
179 CDesCArray* CNSmlNotepadDataProvider::DoListStoresLC() |
|
180 { |
|
181 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoListStoresLC(): begin"); |
|
182 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoListStoresLC(): end"); |
|
183 return iNotepadDataStore->DoListStoresLC(); |
|
184 } |
|
185 |
|
186 // ----------------------------------------------------------------------------- |
|
187 // CNSmlNotepadDataProvider::DoDefaultStoreL |
|
188 // ----------------------------------------------------------------------------- |
|
189 // |
|
190 const TDesC& CNSmlNotepadDataProvider::DoDefaultStoreL() |
|
191 { |
|
192 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoDefaultStoreL(): begin"); |
|
193 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoDefaultStoreL(): end"); |
|
194 return iNotepadDataStore->DefaultStoreNameL(); |
|
195 } |
|
196 |
|
197 // ----------------------------------------------------------------------------- |
|
198 // CNSmlNotepadDataProvider::DoNewStoreInstanceLC |
|
199 // ----------------------------------------------------------------------------- |
|
200 // |
|
201 CSmlDataStore* CNSmlNotepadDataProvider::DoNewStoreInstanceLC() |
|
202 { |
|
203 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoNewStoreInstanceLC(): begin"); |
|
204 CNSmlNotepadDataStore* newDataStore = CNSmlNotepadDataStore::NewL(); |
|
205 CleanupStack::PushL( newDataStore ); |
|
206 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoNewStoreInstanceLC(): end"); |
|
207 return newDataStore; |
|
208 } |
|
209 |
|
210 // ------------------------------------------------------------------------------------------------ |
|
211 // CNSmlNotepadDataProvider::DoSupportedServerFiltersL |
|
212 // |
|
213 // ------------------------------------------------------------------------------------------------ |
|
214 const RPointerArray<CSyncMLFilter>& CNSmlNotepadDataProvider::DoSupportedServerFiltersL() |
|
215 { |
|
216 // This method returns empty array. It means that this Data Provider does not support filtering |
|
217 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportedServerFiltersL(): BEGIN"); |
|
218 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoSupportedServerFiltersL(): END"); |
|
219 return iFilterArray; |
|
220 } |
|
221 |
|
222 // ------------------------------------------------------------------------------------------------ |
|
223 // CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL |
|
224 // |
|
225 // ------------------------------------------------------------------------------------------------ |
|
226 void CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL( const CSmlDataStoreFormat& /*aServerDataStoreFormat*/, |
|
227 RPointerArray<CSyncMLFilter>& /*aFilters*/, |
|
228 TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
|
229 { |
|
230 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL(): BEGIN"); |
|
231 User::Leave( KErrNotSupported ); |
|
232 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckSupportedServerFiltersL(): END"); |
|
233 } |
|
234 |
|
235 // ------------------------------------------------------------------------------------------------ |
|
236 // CNSmlNotepadDataProvider::CheckServerFiltersL |
|
237 // |
|
238 // ------------------------------------------------------------------------------------------------ |
|
239 void CNSmlNotepadDataProvider::DoCheckServerFiltersL( RPointerArray<CSyncMLFilter>& /*aFilters*/, |
|
240 TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
|
241 { |
|
242 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckServerFiltersL(): BEGIN"); |
|
243 User::Leave( KErrNotSupported ); |
|
244 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoCheckServerFiltersL(): END"); |
|
245 } |
|
246 |
|
247 // ------------------------------------------------------------------------------------------------ |
|
248 // CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC |
|
249 // |
|
250 // ------------------------------------------------------------------------------------------------ |
|
251 HBufC* CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC( const RPointerArray<CSyncMLFilter>& /*aFilters*/, |
|
252 TSyncMLFilterMatchType /*aMatch*/, |
|
253 TDes& /*aFilterMimeType*/, |
|
254 TSyncMLFilterType& /*aFilterType*/, |
|
255 TDesC& /*aStoreName*/ ) |
|
256 { |
|
257 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC(): BEGIN"); |
|
258 User::Leave( KErrNotSupported ); |
|
259 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateRecordFilterQueryLC(): END"); |
|
260 return NULL; |
|
261 } |
|
262 |
|
263 // ------------------------------------------------------------------------------------------------ |
|
264 // CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL |
|
265 // |
|
266 // ------------------------------------------------------------------------------------------------ |
|
267 void CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL( const RPointerArray<CSyncMLFilter>& /*aFilters*/, |
|
268 TDes& /*aFilterMimeType*/, |
|
269 RPointerArray<CSmlDataProperty>& /*aProperties*/, |
|
270 TDesC& /*aStoreName*/ ) |
|
271 { |
|
272 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL(): BEGIN"); |
|
273 User::Leave( KErrNotSupported ); |
|
274 _NOTEPAD_DBG_FILE("CNSmlNotepadDataProvider::DoGenerateFieldFilterQueryL(): END"); |
|
275 } |
|
276 |
|
277 // ----------------------------------------------------------------------------- |
|
278 // ImplementationGroupProxy array |
|
279 // ----------------------------------------------------------------------------- |
|
280 // |
|
281 #ifndef IMPLEMENTATION_PROXY_ENTRY |
|
282 #define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) {{aUid},(aFuncPtr)} |
|
283 #endif |
|
284 |
|
285 const TImplementationProxy ImplementationTable[] = |
|
286 { |
|
287 IMPLEMENTATION_PROXY_ENTRY( KNSmlNotepadAdapterImplUid, CNSmlNotepadDataProvider::NewL ) |
|
288 }; |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // ImplementationGroupProxy |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount ) |
|
295 { |
|
296 _NOTEPAD_DBG_FILE("ImplementationGroupProxy() for CNSmlNotepadDataProvider: begin"); |
|
297 aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ); |
|
298 _NOTEPAD_DBG_FILE("ImplementationGroupProxy() for CNSmlNotepadDataProvider: end"); |
|
299 return ImplementationTable; |
|
300 } |
|
301 |
|
302 // ----------------------------------------------------------------------------- |
|
303 // E32Dll |
|
304 // DLL entry point. |
|
305 // ----------------------------------------------------------------------------- |
|
306 // |
|
307 #ifndef EKA2 |
|
308 GLDEF_C TInt E32Dll( TDllReason /*aReason*/ ) |
|
309 { |
|
310 return KErrNone; |
|
311 } |
|
312 #endif |
|
313 |
|
314 // End of File |
|