150 CalCommon::TCalTimeRange( startTimeCal, endTimeCal ) ); |
156 CalCommon::TCalTimeRange( startTimeCal, endTimeCal ) ); |
151 //Start the Monitoring |
157 //Start the Monitoring |
152 iSession->StartChangeNotification( *this, *filter ); |
158 iSession->StartChangeNotification( *this, *filter ); |
153 delete filter; |
159 delete filter; |
154 CPIXLOGSTRING("CNotesPlugin::StartPluginL: Exit"); |
160 CPIXLOGSTRING("CNotesPlugin::StartPluginL: Exit"); |
|
161 OstTraceFunctionExit0( CNOTESPLUGIN_STARTPLUGINL_EXIT ); |
155 } |
162 } |
156 |
163 |
157 // --------------------------------------------------------------------------- |
164 // --------------------------------------------------------------------------- |
158 // CNotesPlugin::StartHarvestingL |
165 // CNotesPlugin::StartHarvestingL |
159 // --------------------------------------------------------------------------- |
166 // --------------------------------------------------------------------------- |
160 // |
167 // |
161 void CNotesPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/) |
168 void CNotesPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/) |
162 { |
169 { |
|
170 OstTraceFunctionEntry0( CNOTESPLUGIN_STARTHARVESTINGL_ENTRY ); |
163 CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Enter"); |
171 CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Enter"); |
164 iIndexer->ResetL(); |
172 iIndexer->ResetL(); |
165 //Have taken start time and end time reference from calender plugin |
173 //Have taken start time and end time reference from calender plugin |
166 TTime startTime , endTime; |
174 TTime startTime , endTime; |
167 InitTimeValuesL( startTime , endTime ); |
175 InitTimeValuesL( startTime , endTime ); |
169 startTimeCal.SetTimeUtcL( startTime ); |
177 startTimeCal.SetTimeUtcL( startTime ); |
170 endTimeCal.SetTimeUtcL( endTime ); |
178 endTimeCal.SetTimeUtcL( endTime ); |
171 //Create an instance for list of Notes items in the system |
179 //Create an instance for list of Notes items in the system |
172 iNotesInstanceView->FindInstanceL( iNotesInstanceArray , CalCommon::EIncludeNotes , CalCommon::TCalTimeRange( startTimeCal, endTimeCal )); |
180 iNotesInstanceView->FindInstanceL( iNotesInstanceArray , CalCommon::EIncludeNotes , CalCommon::TCalTimeRange( startTimeCal, endTimeCal )); |
173 iNoteCount = iNotesInstanceArray.Count(); |
181 iNoteCount = iNotesInstanceArray.Count(); |
|
182 OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_STARTHARVESTINGL, "CNotesPlugin::StartHarvestingL;Notes Count=%d", iNoteCount ); |
174 CPIXLOGSTRING2("CNotesPlugin::StartHarvestingL(): Notes count =%d.", iNoteCount); |
183 CPIXLOGSTRING2("CNotesPlugin::StartHarvestingL(): Notes count =%d.", iNoteCount); |
175 #ifdef __PERFORMANCE_DATA |
184 #ifdef __PERFORMANCE_DATA |
176 iStartTime.UniversalTime(); |
185 iStartTime.UniversalTime(); |
177 #endif |
186 #endif |
178 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
187 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
179 CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Exit"); |
188 CPIXLOGSTRING("CNotesPlugin::StartHarvestingL: Exit"); |
|
189 OstTraceFunctionExit0( CNOTESPLUGIN_STARTHARVESTINGL_EXIT ); |
180 } |
190 } |
181 |
191 |
182 // ----------------------------------------------------------------------------- |
192 // ----------------------------------------------------------------------------- |
183 // CNotesPlugin::DelayedCallbackL |
193 // CNotesPlugin::DelayedCallbackL |
184 // ----------------------------------------------------------------------------- |
194 // ----------------------------------------------------------------------------- |
185 // |
195 // |
186 void CNotesPlugin::DelayedCallbackL( TInt /*aCode*/ ) |
196 void CNotesPlugin::DelayedCallbackL( TInt /*aCode*/ ) |
187 { |
197 { |
|
198 OstTraceFunctionEntry0( CNOTESPLUGIN_DELAYEDCALLBACKL_ENTRY ); |
188 // Harvest items on each call |
199 // Harvest items on each call |
189 CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Enter"); |
200 CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Enter"); |
190 if( iNoteCount ) |
201 if( iNoteCount ) |
191 { |
202 { |
|
203 OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_DELAYEDCALLBACKL, "CNotesPlugin::DelayedCallbackL;Remaining Notes Count=%d", iNoteCount ); |
192 CPIXLOGSTRING2("CNotesPlugin::DelayedCallbackL(): remaining Note count=%d.", iNoteCount); |
204 CPIXLOGSTRING2("CNotesPlugin::DelayedCallbackL(): remaining Note count=%d.", iNoteCount); |
193 // Retrieve the calendar entry for the calinstance and update the CPix database. |
205 // Retrieve the calendar entry for the calinstance and update the CPix database. |
194 CCalEntry& noteentry = iNotesInstanceArray[iNoteCount - 1]->Entry(); |
206 CCalEntry& noteentry = iNotesInstanceArray[iNoteCount - 1]->Entry(); |
195 CreateNoteEntryL( noteentry.LocalUidL(), ECPixAddAction ); |
207 CreateNoteEntryL( noteentry.LocalUidL(), ECPixAddAction ); |
196 iNoteCount--; |
208 iNoteCount--; |
197 // Request next entry. |
209 // Request next entry. |
198 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
210 iAsynchronizer->Start( 0, this, KHarvestingDelay ); |
199 } |
211 } |
200 else |
212 else |
201 { |
213 { |
|
214 OstTrace0( TRACE_NORMAL, DUP1_CNOTESPLUGIN_DELAYEDCALLBACKL, "CNotesPlugin::DelayedCallbackL: Completed Harvesting" ); |
202 CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Completed Harvesting"); |
215 CPIXLOGSTRING("CNotesPlugin::DelayedCallbackL: Completed Harvesting"); |
203 // Harvesting was successfully completed |
216 // Harvesting was successfully completed |
204 Flush(*iIndexer); |
217 Flush(*iIndexer); |
205 #ifdef __PERFORMANCE_DATA |
218 #ifdef __PERFORMANCE_DATA |
206 UpdatePerformaceDataL(); |
219 UpdatePerformaceDataL(); |
207 #endif |
220 #endif |
208 iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone); |
221 iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone); |
209 } |
222 } |
|
223 OstTraceFunctionExit0( CNOTESPLUGIN_DELAYEDCALLBACKL_EXIT ); |
210 } |
224 } |
211 |
225 |
212 // --------------------------------------------------------------------------- |
226 // --------------------------------------------------------------------------- |
213 // CNotesPlugin::DelayedError |
227 // CNotesPlugin::DelayedError |
214 // --------------------------------------------------------------------------- |
228 // --------------------------------------------------------------------------- |
224 // CNotesPlugin::CalChangeNotification |
238 // CNotesPlugin::CalChangeNotification |
225 // --------------------------------------------------------------------------- |
239 // --------------------------------------------------------------------------- |
226 // |
240 // |
227 void CNotesPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems ) |
241 void CNotesPlugin::CalChangeNotification( RArray< TCalChangeEntry >& aChangeItems ) |
228 { |
242 { |
|
243 OstTraceFunctionEntry0( CNOTESPLUGIN_CALCHANGENOTIFICATION_ENTRY ); |
229 CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Enter"); |
244 CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Enter"); |
230 const TInt count(aChangeItems.Count()); |
245 const TInt count(aChangeItems.Count()); |
|
246 OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_CALCHANGENOTIFICATION, "CNotesPlugin::CalChangeNotification;Changed Item Count=%d", count ); |
231 CPIXLOGSTRING2("CNotesPlugin::CalChangeNotification(): changed item count =%d.", count); |
247 CPIXLOGSTRING2("CNotesPlugin::CalChangeNotification(): changed item count =%d.", count); |
232 for( TInt i = 0; i < count; ++i ) |
248 for( TInt i = 0; i < count; ++i ) |
233 { |
249 { |
234 TRAP_IGNORE(HandleNoteChangedEntryL( aChangeItems[ i ] )); |
250 TRAP_IGNORE(HandleNoteChangedEntryL( aChangeItems[ i ] )); |
235 } |
251 } |
236 CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Exit"); |
252 CPIXLOGSTRING("CNotesPlugin::CalChangeNotification: Exit"); |
|
253 OstTraceFunctionExit0( CNOTESPLUGIN_CALCHANGENOTIFICATION_EXIT ); |
237 } |
254 } |
238 |
255 |
239 // --------------------------------------------------------------------------- |
256 // --------------------------------------------------------------------------- |
240 // CNotesPlugin::HandleChangedEntryL |
257 // CNotesPlugin::HandleChangedEntryL |
241 // --------------------------------------------------------------------------- |
258 // --------------------------------------------------------------------------- |
244 { |
261 { |
245 switch( changedEntry.iChangeType ) |
262 switch( changedEntry.iChangeType ) |
246 { |
263 { |
247 case EChangeAdd: |
264 case EChangeAdd: |
248 { |
265 { |
|
266 OstTrace1( TRACE_NORMAL, CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored add id=%d", changedEntry.iEntryId ); |
249 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId); |
267 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored add id=%d.", changedEntry.iEntryId); |
250 CreateNoteEntryL( changedEntry.iEntryId, ECPixAddAction ); |
268 CreateNoteEntryL( changedEntry.iEntryId, ECPixAddAction ); |
251 break; |
269 break; |
252 } |
270 } |
253 |
271 |
254 case EChangeDelete: |
272 case EChangeDelete: |
255 { |
273 { |
|
274 OstTrace1( TRACE_NORMAL, DUP1_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored delete id=%d", changedEntry.iEntryId ); |
256 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId); |
275 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored delete id=%d.", changedEntry.iEntryId); |
257 CreateNoteEntryL( changedEntry.iEntryId, ECPixRemoveAction ); |
276 CreateNoteEntryL( changedEntry.iEntryId, ECPixRemoveAction ); |
258 break; |
277 break; |
259 } |
278 } |
260 |
279 |
261 case EChangeModify: |
280 case EChangeModify: |
262 { |
281 { |
|
282 OstTrace1( TRACE_NORMAL, DUP2_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL;Monitored update id=%d", changedEntry.iEntryId ); |
263 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId); |
283 CPIXLOGSTRING2("CNotesPlugin::HandleNoteChangedEntryL(): Monitored update id=%d.", changedEntry.iEntryId); |
264 CreateNoteEntryL( changedEntry.iEntryId, ECPixUpdateAction ); |
284 CreateNoteEntryL( changedEntry.iEntryId, ECPixUpdateAction ); |
265 break; |
285 break; |
266 } |
286 } |
267 |
287 |
268 case EChangeUndefined: |
288 case EChangeUndefined: |
269 { |
289 { |
|
290 OstTrace0( TRACE_NORMAL, DUP3_CNOTESPLUGIN_HANDLENOTECHANGEDENTRYL, "CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined." ); |
270 CPIXLOGSTRING("CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined."); |
291 CPIXLOGSTRING("CNotesPlugin::HandleNoteChangedEntryL(): EChangeUndefined."); |
271 // This event could be related to synchronization. |
292 // This event could be related to synchronization. |
272 // Mark harvesting as cancelled. |
293 // Mark harvesting as cancelled. |
273 // Remove it from the harvesting queue to cause it to enter |
294 // Remove it from the harvesting queue to cause it to enter |
274 // EHarvesterStatusHibernate state. |
295 // EHarvesterStatusHibernate state. |
309 CCalEntry* entry = iEntryView->FetchL(aLocalUid); |
331 CCalEntry* entry = iEntryView->FetchL(aLocalUid); |
310 CleanupStack::PushL(entry); |
332 CleanupStack::PushL(entry); |
311 |
333 |
312 if( CCalEntry::ENote != entry->EntryTypeL() ) |
334 if( CCalEntry::ENote != entry->EntryTypeL() ) |
313 { |
335 { |
|
336 OstTrace0( TRACE_NORMAL, DUP1_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): return as not a Note entry." ); |
314 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): return as not a Note entry."); |
337 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): return as not a Note entry."); |
315 CleanupStack::PopAndDestroy(entry); |
338 CleanupStack::PopAndDestroy(entry); |
316 return; |
339 return; |
317 } |
340 } |
|
341 OstTrace0( TRACE_NORMAL, DUP2_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Creating document." ); |
318 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Creating document."); |
342 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Creating document."); |
319 CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(NOTESAPPCLASS)); |
343 CSearchDocument* index_item = CSearchDocument::NewLC(docid_str, _L(NOTESAPPCLASS)); |
320 // Add Description fields |
344 // Add Description fields |
321 index_item->AddFieldL(KNpdMemo, entry->DescriptionL()); |
345 index_item->AddFieldL(KNpdMemo, entry->DescriptionL()); |
322 // Add Date fields |
346 // Add Date fields |
342 TRAP_IGNORE( iIndexer->AddL(*index_item) ); |
366 TRAP_IGNORE( iIndexer->AddL(*index_item) ); |
343 #else |
367 #else |
344 TRAPD( err, iIndexer->AddL(*index_item) ); |
368 TRAPD( err, iIndexer->AddL(*index_item) ); |
345 if ( err == KErrNone ) |
369 if ( err == KErrNone ) |
346 { |
370 { |
|
371 OstTrace0( TRACE_NORMAL, DUP3_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Added." ); |
347 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Added."); |
372 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Added."); |
348 } |
373 } |
349 else |
374 else |
350 { |
375 { |
|
376 OstTrace1( TRACE_NORMAL, DUP4_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while adding=%d", err ); |
351 CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in adding.", err); |
377 CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in adding.", err); |
352 } |
378 } |
353 #endif |
379 #endif |
354 } |
380 } |
355 else if ( aActionType == ECPixUpdateAction ) |
381 else if ( aActionType == ECPixUpdateAction ) |
358 TRAP_IGNORE( iIndexer->UpdateL(*index_item) ); |
384 TRAP_IGNORE( iIndexer->UpdateL(*index_item) ); |
359 #else |
385 #else |
360 TRAPD( err, iIndexer->UpdateL(*index_item) ); |
386 TRAPD( err, iIndexer->UpdateL(*index_item) ); |
361 if ( err == KErrNone ) |
387 if ( err == KErrNone ) |
362 { |
388 { |
|
389 OstTrace0( TRACE_NORMAL, DUP5_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL(): Updated." ); |
363 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Updated."); |
390 CPIXLOGSTRING("CNotesPlugin::CreateNoteEntryL(): Updated."); |
364 } |
391 } |
365 else |
392 else |
366 { |
393 { |
|
394 OstTrace1( TRACE_NORMAL, DUP6_CNOTESPLUGIN_CREATENOTEENTRYL, "CNotesPlugin::CreateNoteEntryL;Error while updating=%d", err ); |
367 CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in updating.", err); |
395 CPIXLOGSTRING2("CNotesPlugin::CreateNoteEntryL(): Error %d in updating.", err); |
368 } |
396 } |
369 #endif |
397 #endif |
370 } |
398 } |
371 CleanupStack::PopAndDestroy(index_item); |
399 CleanupStack::PopAndDestroy(index_item); |
393 // CNotesPlugin::InitTimeValuesL |
423 // CNotesPlugin::InitTimeValuesL |
394 // --------------------------------------------------------------------------- |
424 // --------------------------------------------------------------------------- |
395 // |
425 // |
396 void CNotesPlugin::InitTimeValuesL( TTime& aStartTime, TTime& aEndTime ) |
426 void CNotesPlugin::InitTimeValuesL( TTime& aStartTime, TTime& aEndTime ) |
397 { |
427 { |
|
428 OstTraceFunctionEntry0( CNOTESPLUGIN_INITTIMEVALUESL_ENTRY ); |
398 CPIXLOGSTRING("CNotesPlugin::InitTimeValuesL: Enter"); |
429 CPIXLOGSTRING("CNotesPlugin::InitTimeValuesL: Enter"); |
399 //Open the cpix common repository |
430 //Open the cpix common repository |
400 CRepository* cpixrepo = CRepository::NewL( KCPIXrepoUidMenu ); |
431 CRepository* cpixrepo = CRepository::NewL( KCPIXrepoUidMenu ); |
401 TBuf<KDateStringLength> temp; |
432 TBuf<KDateStringLength> temp; |
402 //Read the Start date from the cenrep |
433 //Read the Start date from the cenrep |