41 // might leave. |
41 // might leave. |
42 // ------------------------------------------------------------------------------------------------ |
42 // ------------------------------------------------------------------------------------------------ |
43 // |
43 // |
44 CNSmlAgendaDataProvider::CNSmlAgendaDataProvider() |
44 CNSmlAgendaDataProvider::CNSmlAgendaDataProvider() |
45 { |
45 { |
46 _DBG_FILE("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): BEGIN"); |
46 FLOG(_L("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): BEGIN")); |
47 _DBG_FILE("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): END"); |
47 FLOG(_L("CNSmlAgendaDataProvider::CNSmlAgendaDataProvider(): END")); |
48 } |
48 } |
49 |
49 |
50 // ------------------------------------------------------------------------------------------------ |
50 // ------------------------------------------------------------------------------------------------ |
51 // CNSmlAgendaDataProvider::ConstructL |
51 // CNSmlAgendaDataProvider::ConstructL |
52 // Symbian 2nd phase constructor can leave. |
52 // Symbian 2nd phase constructor can leave. |
53 // ------------------------------------------------------------------------------------------------ |
53 // ------------------------------------------------------------------------------------------------ |
54 // |
54 // |
55 void CNSmlAgendaDataProvider::ConstructL( ) |
55 void CNSmlAgendaDataProvider::ConstructL( ) |
56 { |
56 { |
57 _DBG_FILE("CNSmlAgendaDataProvider::NewL: BEGIN"); |
57 FLOG(_L("CNSmlAgendaDataProvider::NewL: BEGIN")); |
58 iAgnDataStore = CNSmlAgendaDataStore::NewL(); |
58 iAgnDataStore = CNSmlAgendaDataStore::NewL(); |
59 iStringPool.OpenL(); |
59 FLOG(_L("CNSmlAgendaDataProvider::NewL: END")); |
60 User::LeaveIfError( iSession.Connect() ); |
|
61 _DBG_FILE("CNSmlAgendaDataProvider::NewL: BEGIN"); |
|
62 } |
60 } |
63 |
61 |
64 // ------------------------------------------------------------------------------------------------ |
62 // ------------------------------------------------------------------------------------------------ |
65 // CNSmlAgendaDataProvider::NewL |
63 // CNSmlAgendaDataProvider::NewL |
66 // Two-phased constructor. |
64 // Two-phased constructor. |
67 // ------------------------------------------------------------------------------------------------ |
65 // ------------------------------------------------------------------------------------------------ |
68 // |
66 // |
69 CNSmlAgendaDataProvider* CNSmlAgendaDataProvider::NewL() |
67 CNSmlAgendaDataProvider* CNSmlAgendaDataProvider::NewL() |
70 { |
68 { |
71 _DBG_FILE("CNSmlAgendaDataProvider::NewL: BEGIN"); |
69 FLOG(_L("CNSmlAgendaDataProvider::NewL: BEGIN")); |
72 CNSmlAgendaDataProvider* self = new ( ELeave ) CNSmlAgendaDataProvider(); |
70 CNSmlAgendaDataProvider* self = new ( ELeave ) CNSmlAgendaDataProvider(); |
73 CleanupStack::PushL( self ); |
71 CleanupStack::PushL( self ); |
74 self->ConstructL(); |
72 self->ConstructL(); |
75 CleanupStack::Pop( self ); |
73 CleanupStack::Pop( self ); |
76 _DBG_FILE("CNSmlAgendaDataProvider::NewL: BEGIN"); |
74 FLOG(_L("CNSmlAgendaDataProvider::NewL: END")); |
77 return self; |
75 return self; |
78 } |
76 } |
79 |
77 |
80 // ------------------------------------------------------------------------------------------------ |
78 // ------------------------------------------------------------------------------------------------ |
81 // CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider |
79 // CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider |
82 // Destructor. |
80 // Destructor. |
83 // ------------------------------------------------------------------------------------------------ |
81 // ------------------------------------------------------------------------------------------------ |
84 // |
82 // |
85 CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider() |
83 CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider() |
86 { |
84 { |
87 _DBG_FILE("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): BEGIN"); |
85 FLOG(_L("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): BEGIN")); |
|
86 delete iDSFormat; |
88 delete iAgnDataStore; |
87 delete iAgnDataStore; |
89 iSession.Close(); |
|
90 delete iDSFormat; |
|
91 iStringPool.Close(); |
|
92 iFilterArray.ResetAndDestroy(); |
88 iFilterArray.ResetAndDestroy(); |
93 iFilterArray.Close(); |
89 iFilterArray.Close(); |
94 _DBG_FILE("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): END"); |
90 FLOG(_L("CNSmlAgendaDataProvider::~CNSmlAgendaDataProvider(): END")); |
95 } |
91 } |
96 |
92 |
97 // ------------------------------------------------------------------------------------------------ |
93 // ------------------------------------------------------------------------------------------------ |
98 // CNSmlAgendaDataProvider::DoOnFrameworkEvent |
94 // CNSmlAgendaDataProvider::DoOnFrameworkEvent |
99 // Not supported. |
95 // Not supported. |
100 // ------------------------------------------------------------------------------------------------ |
96 // ------------------------------------------------------------------------------------------------ |
101 // |
97 // |
102 void CNSmlAgendaDataProvider::DoOnFrameworkEvent( TSmlFrameworkEvent /*aEvent*/, TInt /*aParam1*/, TInt /*aParam2*/ ) |
98 void CNSmlAgendaDataProvider::DoOnFrameworkEvent( TSmlFrameworkEvent /*aEvent*/, TInt /*aParam1*/, TInt /*aParam2*/ ) |
103 { |
99 { |
104 _DBG_FILE("CNSmlAgendaDataProvider::DoOnFrameworkEvent: BEGIN"); |
100 FLOG(_L("CNSmlAgendaDataProvider::DoOnFrameworkEvent: BEGIN")); |
105 _DBG_FILE("CNSmlAgendaDataProvider::DoOnFrameworkEvent: END"); |
101 FLOG(_L("CNSmlAgendaDataProvider::DoOnFrameworkEvent: END")); |
106 } |
102 } |
107 |
103 |
108 // ------------------------------------------------------------------------------------------------ |
104 // ------------------------------------------------------------------------------------------------ |
109 // CNSmlAgendaDataProvider::DoSupportsOperation |
105 // CNSmlAgendaDataProvider::DoSupportsOperation |
110 // Return supported operation uid. |
106 // Return supported operation uid. |
111 // ------------------------------------------------------------------------------------------------ |
107 // ------------------------------------------------------------------------------------------------ |
112 // |
108 // |
113 TBool CNSmlAgendaDataProvider::DoSupportsOperation( TUid aOpId ) const |
109 TBool CNSmlAgendaDataProvider::DoSupportsOperation( TUid aOpId ) const |
114 { |
110 { |
115 _DBG_FILE("CNSmlAgendaDataProvider::DoSupportsOperation: BEGIN"); |
111 FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: BEGIN")); |
116 if ( aOpId == KUidSmlSupportMultipleStores ) |
112 if ( aOpId == KUidSmlSupportMultipleStores ) |
117 { |
113 { |
118 _DBG_FILE("CNSmlAgendaDataProvider::DoSupportsOperation: END"); |
114 FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: END")); |
119 return ETrue; |
115 return ETrue; |
120 } |
116 } |
121 _DBG_FILE("CNSmlAgendaDataProvider::DoSupportsOperation: END"); |
117 FLOG(_L("CNSmlAgendaDataProvider::DoSupportsOperation: END")); |
122 return EFalse; |
118 return EFalse; |
123 } |
119 } |
124 |
120 |
125 // ------------------------------------------------------------------------------------------------ |
121 // ------------------------------------------------------------------------------------------------ |
126 // CNSmlAgendaDataProvider::DoStoreFormatL |
122 // CNSmlAgendaDataProvider::DoStoreFormatL |
127 // Return the current data store format. |
123 // Return the current data store format. |
128 // ------------------------------------------------------------------------------------------------ |
124 // ------------------------------------------------------------------------------------------------ |
129 // |
125 // |
130 const CSmlDataStoreFormat& CNSmlAgendaDataProvider::DoStoreFormatL() |
126 const CSmlDataStoreFormat& CNSmlAgendaDataProvider::DoStoreFormatL() |
131 { |
127 { |
132 _DBG_FILE("CNSmlAgendaDataProvider::DoStoreFormatL(): BEGIN"); |
128 FLOG(_L("CNSmlAgendaDataProvider::DoStoreFormatL(): BEGIN")); |
133 |
129 |
134 if ( iDSFormat ) |
130 if ( iDSFormat ) |
135 { |
131 { |
136 delete iDSFormat; |
132 delete iDSFormat; |
137 iDSFormat = NULL; |
133 iDSFormat = NULL; |
138 } |
134 } |
139 iDSFormat = DoOwnStoreFormatL(); |
135 // RD_MULTICAL |
140 |
136 iDSFormat = iAgnDataStore->StoreFormatL(); |
141 return *iDSFormat; |
137 // RD_MULTICAL |
|
138 return *iDSFormat; |
142 } |
139 } |
143 |
140 |
144 // ------------------------------------------------------------------------------------------------ |
141 // ------------------------------------------------------------------------------------------------ |
145 // CNSmlAgendaDataProvider::DoListStoresLC |
142 // CNSmlAgendaDataProvider::DoListStoresLC |
146 // Return the list of datastore names. |
143 // Return the list of datastore names. |
147 // ------------------------------------------------------------------------------------------------ |
144 // ------------------------------------------------------------------------------------------------ |
148 // |
145 // |
149 CDesCArray* CNSmlAgendaDataProvider::DoListStoresLC() |
146 CDesCArray* CNSmlAgendaDataProvider::DoListStoresLC() |
150 { |
147 { |
151 _DBG_FILE("CNSmlAgendaDataProvider::DoListStoresLC(): BEGIN"); |
148 FLOG(_L("CNSmlAgendaDataProvider::DoListStoresLC(): BEGIN")); |
152 _DBG_FILE("CNSmlAgendaDataProvider::DoListStoresLC(): END"); |
149 FLOG(_L("CNSmlAgendaDataProvider::DoListStoresLC(): END")); |
153 return iAgnDataStore->DoListAgendaFilesLC(); |
150 return iAgnDataStore->DoListAgendaFilesLC(); |
154 } |
151 } |
155 |
152 |
156 // ------------------------------------------------------------------------------------------------ |
153 // ------------------------------------------------------------------------------------------------ |
157 // CNSmlAgendaDataProvider::DoDefaultStoreL |
154 // CNSmlAgendaDataProvider::DoDefaultStoreL |
158 // Return the name of default store name. |
155 // Return the name of default store name. |
159 // ------------------------------------------------------------------------------------------------ |
156 // ------------------------------------------------------------------------------------------------ |
160 // |
157 // |
161 const TDesC& CNSmlAgendaDataProvider::DoDefaultStoreL() |
158 const TDesC& CNSmlAgendaDataProvider::DoDefaultStoreL() |
162 { |
159 { |
163 _DBG_FILE("CNSmlAgendaDataProvider::DoDefaultStoreL(): BEGIN"); |
160 FLOG(_L("CNSmlAgendaDataProvider::DoDefaultStoreL(): BEGIN")); |
164 _DBG_FILE("CNSmlAgendaDataProvider::DoDefaultStoreL(): END"); |
161 FLOG(_L("CNSmlAgendaDataProvider::DoDefaultStoreL(): END")); |
165 return iAgnDataStore->DoGetDefaultFileNameL(); |
162 return iAgnDataStore->DoGetDefaultFileNameL(); |
166 } |
163 } |
167 |
164 |
168 // ------------------------------------------------------------------------------------------------ |
165 // ------------------------------------------------------------------------------------------------ |
169 // CNSmlAgendaDataProvider::DoNewStoreInstanceLC |
166 // CNSmlAgendaDataProvider::DoNewStoreInstanceLC |
170 // Return instance of data store |
167 // Return instance of data store |
171 // ------------------------------------------------------------------------------------------------ |
168 // ------------------------------------------------------------------------------------------------ |
172 // |
169 // |
173 CSmlDataStore* CNSmlAgendaDataProvider::DoNewStoreInstanceLC() |
170 CSmlDataStore* CNSmlAgendaDataProvider::DoNewStoreInstanceLC() |
174 { |
171 { |
175 _DBG_FILE("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): BEGIN"); |
172 FLOG(_L("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): BEGIN")); |
176 CNSmlAgendaDataStore* newStore = CNSmlAgendaDataStore::NewL(); |
173 CNSmlAgendaDataStore* newStore = CNSmlAgendaDataStore::NewL(); |
177 CleanupStack::PushL( newStore ); |
174 CleanupStack::PushL( newStore ); |
178 _DBG_FILE("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): END"); |
175 FLOG(_L("CNSmlAgendaDataProvider::DoNewStoreInstanceLC(): END")); |
179 return newStore; |
176 return newStore; |
180 } |
177 } |
181 |
178 |
182 // ------------------------------------------------------------------------------------------------ |
179 // ------------------------------------------------------------------------------------------------ |
183 // CNSmlAgendaDataProvider::DoSupportedServerFiltersL |
180 // CNSmlAgendaDataProvider::DoSupportedServerFiltersL |
184 // |
181 // |
185 // ------------------------------------------------------------------------------------------------ |
182 // ------------------------------------------------------------------------------------------------ |
186 const RPointerArray<CSyncMLFilter>& CNSmlAgendaDataProvider::DoSupportedServerFiltersL() |
183 const RPointerArray<CSyncMLFilter>& CNSmlAgendaDataProvider::DoSupportedServerFiltersL() |
187 { |
184 { |
188 // This method returns empty array. It means that this Data Provider does not support filtering |
185 // This method returns empty array. It means that this Data Provider does not support filtering |
189 _DBG_FILE("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): BEGIN"); |
186 FLOG(_L("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): BEGIN")); |
190 _DBG_FILE("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): END"); |
187 FLOG(_L("CNSmlAgendaDataProvider::DoSupportedServerFiltersL(): END")); |
191 return iFilterArray; |
188 return iFilterArray; |
192 } |
189 } |
193 |
190 |
194 // ------------------------------------------------------------------------------------------------ |
191 // ------------------------------------------------------------------------------------------------ |
195 // CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL |
192 // CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL |
196 // |
193 // |
197 // ------------------------------------------------------------------------------------------------ |
194 // ------------------------------------------------------------------------------------------------ |
198 void CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL( const CSmlDataStoreFormat& /*aServerDataStoreFormat*/, RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
195 void CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL( const CSmlDataStoreFormat& /*aServerDataStoreFormat*/, RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
199 { |
196 { |
200 _DBG_FILE("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): BEGIN"); |
197 FLOG(_L("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): BEGIN")); |
201 User::Leave( KErrNotSupported ); |
198 FLOG(_L("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): END")); |
202 _DBG_FILE("CNSmlAgendaDataProvider::DoCheckSupportedServerFiltersL(): END"); |
199 User::Leave( KErrNotSupported ); |
203 } |
200 } |
204 |
201 |
205 // ------------------------------------------------------------------------------------------------ |
202 // ------------------------------------------------------------------------------------------------ |
206 // CNSmlAgendaDataProvider::CheckServerFiltersL |
203 // CNSmlAgendaDataProvider::CheckServerFiltersL |
207 // |
204 // |
208 // ------------------------------------------------------------------------------------------------ |
205 // ------------------------------------------------------------------------------------------------ |
209 void CNSmlAgendaDataProvider::DoCheckServerFiltersL( RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
206 void CNSmlAgendaDataProvider::DoCheckServerFiltersL( RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterChangeInfo& /*aChangeInfo*/ ) |
210 { |
207 { |
211 _DBG_FILE("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): BEGIN"); |
208 FLOG(_L("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): BEGIN")); |
212 User::Leave( KErrNotSupported ); |
209 FLOG(_L("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): END")); |
213 _DBG_FILE("CNSmlAgendaDataProvider::DoCheckServerFiltersL(): END"); |
210 User::Leave( KErrNotSupported ); |
214 } |
211 } |
215 |
212 |
216 // ------------------------------------------------------------------------------------------------ |
213 // ------------------------------------------------------------------------------------------------ |
217 // CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC |
214 // CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC |
218 // |
215 // |
219 // ------------------------------------------------------------------------------------------------ |
216 // ------------------------------------------------------------------------------------------------ |
220 HBufC* CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterMatchType /*aMatch*/, TDes& /*aFilterMimeType*/, TSyncMLFilterType& /*aFilterType*/, TDesC& /*aStoreName*/ ) |
217 HBufC* CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TSyncMLFilterMatchType /*aMatch*/, TDes& /*aFilterMimeType*/, TSyncMLFilterType& /*aFilterType*/, TDesC& /*aStoreName*/ ) |
221 { |
218 { |
222 _DBG_FILE("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): BEGIN"); |
219 FLOG(_L("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): BEGIN")); |
223 User::Leave( KErrNotSupported ); |
220 FLOG(_L("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): END")); |
224 _DBG_FILE("CNSmlAgendaDataProvider::DoGenerateRecordFilterQueryLC(): END"); |
221 User::Leave( KErrNotSupported ); |
225 return NULL; |
222 return NULL; |
226 } |
223 } |
227 |
224 |
228 // ------------------------------------------------------------------------------------------------ |
225 // ------------------------------------------------------------------------------------------------ |
229 // CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL |
226 // CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL |
230 // |
227 // |
231 // ------------------------------------------------------------------------------------------------ |
228 // ------------------------------------------------------------------------------------------------ |
232 void CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TDes& /*aFilterMimeType*/, RPointerArray<CSmlDataProperty>& /*aProperties*/, TDesC& /*aStoreName*/ ) |
229 void CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL( const RPointerArray<CSyncMLFilter>& /*aFilters*/, TDes& /*aFilterMimeType*/, RPointerArray<CSmlDataProperty>& /*aProperties*/, TDesC& /*aStoreName*/ ) |
233 { |
230 { |
234 _DBG_FILE("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): BEGIN"); |
231 FLOG(_L("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): BEGIN")); |
235 User::Leave( KErrNotSupported ); |
232 FLOG(_L("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): END")); |
236 _DBG_FILE("CNSmlAgendaDataProvider::DoGenerateFieldFilterQueryL(): END"); |
233 User::Leave( KErrNotSupported ); |
237 } |
|
238 |
|
239 // ------------------------------------------------------------------------------------------------ |
|
240 // CNSmlAgendaDataProvider::DoOwnStoreFormatL |
|
241 // Read own store format from own resource file. |
|
242 // ------------------------------------------------------------------------------------------------ |
|
243 // |
|
244 CSmlDataStoreFormat* CNSmlAgendaDataProvider::DoOwnStoreFormatL() |
|
245 { |
|
246 _DBG_FILE("CNSmlAgendaDataProvider::DoOwnStoreFormatL(): BEGIN"); |
|
247 TFileName fileName; |
|
248 TParse parse; |
|
249 |
|
250 // Check correct Data Sync protocol |
|
251 TInt value( EDataSyncNotRunning ); |
|
252 TInt error = RProperty::Get( KPSUidDataSynchronizationInternalKeys, |
|
253 KDataSyncStatus, |
|
254 value ); |
|
255 if ( error == KErrNone && |
|
256 value == EDataSyncRunning ) |
|
257 { |
|
258 parse.Set( KNSmlDSAgendaDataStoreRsc_1_1_2, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
259 } |
|
260 else // error or protocol version 1.2 |
|
261 { |
|
262 parse.Set( KNSmlDSAgendaDataStoreRsc_1_2, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
263 } |
|
264 |
|
265 fileName = parse.FullName(); |
|
266 RResourceFile resourceFile; |
|
267 BaflUtils::NearestLanguageFile( iSession, fileName ); |
|
268 |
|
269 resourceFile.OpenL( iSession, fileName ); |
|
270 CleanupClosePushL( resourceFile ); |
|
271 |
|
272 HBufC8* profileRes = resourceFile.AllocReadLC( NSML_AGENDA_DATA_STORE ); |
|
273 TResourceReader reader; |
|
274 reader.SetBuffer( profileRes ); |
|
275 |
|
276 CSmlDataStoreFormat* dsFormat = CSmlDataStoreFormat::NewLC( iStringPool, reader ); |
|
277 CleanupStack::Pop(); // dsFormat |
|
278 CleanupStack::PopAndDestroy( 2 ); // profileRes, resourceFile |
|
279 _DBG_FILE("CNSmlAgendaDataProvider::DoOwnStoreFormatL(): END"); |
|
280 return dsFormat; |
|
281 } |
234 } |
282 |
235 |
283 // =================================== OTHER EXPORTED FUNCTIONS =================================== |
236 // =================================== OTHER EXPORTED FUNCTIONS =================================== |
284 #ifndef IMPLEMENTATION_PROXY_ENTRY |
237 #ifndef IMPLEMENTATION_PROXY_ENTRY |
285 #define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) { { aUid }, ( aFuncPtr ) } |
238 #define IMPLEMENTATION_PROXY_ENTRY( aUid, aFuncPtr ) { { aUid }, ( aFuncPtr ) } |