harvesterplugins/calendar/src/ccalendarplugin.cpp
changeset 26 367228f82b66
parent 18 1edf350003c5
child 27 7a8855317cbd
equal deleted inserted replaced
24:1abfa342db42 26:367228f82b66
    85 	delete iAsynchronizer;
    85 	delete iAsynchronizer;
    86 	delete iIndexer;
    86 	delete iIndexer;
    87 
    87 
    88 	delete iEntryView;
    88 	delete iEntryView;
    89 	delete iCalIterator;
    89 	delete iCalIterator;
    90 #ifdef USE_HIGHLIGHTER	
    90 	iJobQueue.Reset();
       
    91 	iJobQueue.Close();
       
    92 //#ifdef USE_HIGHLIGHTER	
    91 	if(iExcerpt)
    93 	if(iExcerpt)
    92 	    delete iExcerpt;
    94 	    delete iExcerpt;
    93 	iExcerpt = NULL;
    95 	iExcerpt = NULL;
    94 #endif
    96 //#endif
    95 	if( iSession )
    97 	if( iSession )
    96 		{
    98 		{
    97 		iSession->StopChangeNotification();
    99 		iSession->StopChangeNotification();
    98 		}
   100 		}
    99 	delete iSession;
   101 	delete iSession;
   103 // CCalendarPlugin::ConstructL
   105 // CCalendarPlugin::ConstructL
   104 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   105 //  
   107 //  
   106 void CCalendarPlugin::ConstructL()
   108 void CCalendarPlugin::ConstructL()
   107 	{
   109 	{
       
   110     iIndexState = ETrue;
   108 	iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
   111 	iAsynchronizer = CDelayedCallback::NewL( CActive::EPriorityIdle );
   109 	iSession = CCalSession::NewL();	
   112 	iSession = CCalSession::NewL();	
   110 	TRAPD ( err , iSession->OpenL( iSession->DefaultFileNameL() ) );
   113 	TRAPD ( err , iSession->OpenL( iSession->DefaultFileNameL() ) );
   111 	if ( err == KErrNotFound)
   114 	if ( err == KErrNotFound)
   112 	    {
   115 	    {
   151 //  
   154 //  
   152 void CCalendarPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/)
   155 void CCalendarPlugin::StartHarvestingL(const TDesC& /*aQualifiedBaseAppClass*/)
   153     {
   156     {
   154     iIndexer->ResetL();
   157     iIndexer->ResetL();
   155     iStartHarvesting = ETrue;
   158     iStartHarvesting = ETrue;
       
   159     iHarvestState = EHarvesterStartHarvest;
   156 #ifdef __PERFORMANCE_DATA
   160 #ifdef __PERFORMANCE_DATA
   157     iStartTime.UniversalTime();
   161     iStartTime.UniversalTime();
   158 #endif  
   162 #endif  
   159     if (iFirstEntry)
   163     if (iFirstEntry)
   160         {
   164         {
   175 // CCalendarPlugin::Completed
   179 // CCalendarPlugin::Completed
   176 // -----------------------------------------------------------------------------
   180 // -----------------------------------------------------------------------------
   177 //
   181 //
   178 void CCalendarPlugin::Completed( TInt aError )
   182 void CCalendarPlugin::Completed( TInt aError )
   179 	{
   183 	{
   180 	// No error code and harvesting is needed star harvesting.
   184 	// No error code and harvesting is needed start harvesting.
   181 	iFirstEntry = ETrue;
   185 	iFirstEntry = ETrue;
   182 	if (aError == KErrNone && iStartHarvesting)
   186 	if (aError == KErrNone && iStartHarvesting)
   183 		{
   187 		{
   184 		// Calendar entry view constructed successfully, start harvesting
   188 		// Calendar entry view constructed successfully, start harvesting
   185 		iAsynchronizer->Start( 0, this, KHarvestingDelay );
   189 		iAsynchronizer->Start( 0, this, KHarvestingDelay );
   199 // CContactsPlugin::DelayedCallbackL
   203 // CContactsPlugin::DelayedCallbackL
   200 // -----------------------------------------------------------------------------
   204 // -----------------------------------------------------------------------------
   201 //
   205 //
   202 void CCalendarPlugin::DelayedCallbackL( TInt /*aCode*/ )
   206 void CCalendarPlugin::DelayedCallbackL( TInt /*aCode*/ )
   203     {
   207     {
       
   208     if(!iIndexState)
       
   209         return;
   204     // Harvest items on each call
   210     // Harvest items on each call
   205 	TPtrC8 uid( KNullDesC8 );
   211 	TPtrC8 uid( KNullDesC8 );
   206 
   212 	
   207 	if( iFirstEntry )
   213     if( iFirstEntry )
   208 		{
   214         {
   209 		uid.Set( iCalIterator->FirstL() );
   215         uid.Set( iCalIterator->FirstL() );
   210 		iFirstEntry = EFalse;
   216         iFirstEntry = EFalse;
   211 		}
   217         }
   212 	else
   218     else
   213 		{
   219         {
   214 		uid.Set( iCalIterator->NextL() );
   220         uid.Set( iCalIterator->NextL() );
   215 		}
   221         }
   216 
   222 
   217 	if( uid != KNullDesC8 )
   223     if( uid != KNullDesC8 )
   218 		{
   224         {
   219 		RPointerArray<CCalEntry> entryArray;
   225         RPointerArray<CCalEntry> entryArray;
   220 		CleanupResetAndDestroyPushL(entryArray);
   226         CleanupResetAndDestroyPushL(entryArray);
   221 		iEntryView->FetchL( uid, entryArray );
   227         iEntryView->FetchL( uid, entryArray );
   222 		// Handle only the first (i.e. parent entry)
   228         // Handle only the first (i.e. parent entry)
   223 		if( entryArray.Count() > 0 )
   229         if( entryArray.Count() > 0 )
   224 			{
   230             {
   225 			CCalEntry* entry = (CCalEntry*)entryArray[ 0 ];
   231             CCalEntry* entry = (CCalEntry*)entryArray[ 0 ];
   226 			OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_DELAYEDCALLBACKL, "CCalendarPlugin::DelayedCallbackL();Harvesting id=%d", entry->LocalUidL() );
   232             OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_DELAYEDCALLBACKL, "CCalendarPlugin::DelayedCallbackL();Harvesting id=%d", entry->LocalUidL() );
   227 			CPIXLOGSTRING2("CCalendarPlugin::DelayedCallbackL(): Harvesting id=%d.", entry->LocalUidL());
   233             CPIXLOGSTRING2("CCalendarPlugin::DelayedCallbackL(): Harvesting id=%d.", entry->LocalUidL());
   228 			CreateEntryL( entry->LocalUidL(), ECPixAddAction );
   234             CreateEntryL( entry->LocalUidL(), ECPixAddAction );
   229 			}
   235             }
   230 		CleanupStack::PopAndDestroy(&entryArray);
   236         CleanupStack::PopAndDestroy(&entryArray);
   231 
   237 
   232 		// Request next entry.
   238         // Request next entry.
   233 		iAsynchronizer->Start( 0, this, KHarvestingDelay );
   239         iAsynchronizer->Start( 0, this, KHarvestingDelay );
   234 		}
   240         }
   235 	else
   241     else
   236 		{
   242         {
   237 		// Harvesting was successfully completed
   243         // Harvesting was successfully completed
   238 		iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   244         iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   239 		Flush(*iIndexer);
   245         Flush(*iIndexer);
   240 #ifdef __PERFORMANCE_DATA
   246 #ifdef __PERFORMANCE_DATA
   241     UpdatePerformaceDataL();
   247     UpdatePerformaceDataL();
   242 #endif
   248 #endif
   243 		iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);		
   249         iHarvestState = EHarvesterIdleState;
   244 		}
   250         iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrNone);		
       
   251         }
       
   252 
   245 	}
   253 	}
   246 
   254 
   247 // ---------------------------------------------------------------------------
   255 // ---------------------------------------------------------------------------
   248 // CCalendarPlugin::DelayedError
   256 // CCalendarPlugin::DelayedError
   249 // ---------------------------------------------------------------------------
   257 // ---------------------------------------------------------------------------
   251 void CCalendarPlugin::DelayedError(TInt aError)
   259 void CCalendarPlugin::DelayedError(TInt aError)
   252 	{
   260 	{
   253 	// Harvesting was completed
   261 	// Harvesting was completed
   254 	iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   262 	iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   255 	Flush(*iIndexer);
   263 	Flush(*iIndexer);
       
   264 	iHarvestState = EHarvesterIdleState;
   256 	iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aError);
   265 	iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), aError);
   257 	}
   266 	}
   258 
   267 
   259 // ---------------------------------------------------------------------------
   268 // ---------------------------------------------------------------------------
   260 // CCalendarPlugin::CalChangeNotification
   269 // CCalendarPlugin::CalChangeNotification
   287 #ifdef __PERFORMANCE_DATA
   296 #ifdef __PERFORMANCE_DATA
   288             iStartTime.UniversalTime();
   297             iStartTime.UniversalTime();
   289 			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
   298 			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
   290 			UpdatePerformaceDataL(ECPixAddAction);
   299 			UpdatePerformaceDataL(ECPixAddAction);
   291 #else
   300 #else
   292 			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
   301 			if( iIndexState )
       
   302 			    CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
       
   303 			else
       
   304 			    OverWriteOrAddToQueueL(changedEntry.iEntryId, ECPixAddAction);
   293 #endif
   305 #endif
   294 			break;
   306 			break;
   295 			}
   307 			}
   296 
   308 
   297 		case EChangeDelete:
   309 		case EChangeDelete:
   301 #ifdef __PERFORMANCE_DATA
   313 #ifdef __PERFORMANCE_DATA
   302             iStartTime.UniversalTime();
   314             iStartTime.UniversalTime();
   303 			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
   315 			CreateEntryL( changedEntry.iEntryId, ECPixAddAction );
   304 			UpdatePerformaceDataL(ECPixAddAction);
   316 			UpdatePerformaceDataL(ECPixAddAction);
   305 #else
   317 #else
   306 			CreateEntryL( changedEntry.iEntryId, ECPixRemoveAction );
   318 			if( iIndexState )
       
   319 			    CreateEntryL( changedEntry.iEntryId, ECPixRemoveAction );
       
   320 			else
       
   321 			    OverWriteOrAddToQueueL(changedEntry.iEntryId, ECPixRemoveAction);
   307 #endif
   322 #endif
   308 			break;
   323 			break;
   309 			}
   324 			}
   310 
   325 
   311 		case EChangeModify:
   326 		case EChangeModify:
   315 #ifdef __PERFORMANCE_DATA
   330 #ifdef __PERFORMANCE_DATA
   316             iStartTime.UniversalTime(); 
   331             iStartTime.UniversalTime(); 
   317 			CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
   332 			CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
   318 			UpdatePerformaceDataL(ECPixUpdateAction);
   333 			UpdatePerformaceDataL(ECPixUpdateAction);
   319 #else
   334 #else
   320 			CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
   335 			if( iIndexState )
       
   336 			    CreateEntryL( changedEntry.iEntryId, ECPixUpdateAction );
       
   337 			else
       
   338 			    OverWriteOrAddToQueueL(changedEntry.iEntryId, ECPixUpdateAction);
   321 #endif
   339 #endif
   322 			break;
   340 			break;
   323 			}
   341 			}
   324 			
   342 			
   325 		/* TCalChangeEntry documentation:
   343 		/* TCalChangeEntry documentation:
   336 			// EHarvesterStatusHibernate state.
   354 			// EHarvesterStatusHibernate state.
   337 			// Now add it to the harvesting queue and force a reharvest.
   355 			// Now add it to the harvesting queue and force a reharvest.
   338 
   356 
   339 			iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   357 			iFirstEntry = ETrue; // Make sure we can harvest next time as well...
   340 			Flush(*iIndexer);
   358 			Flush(*iIndexer);
       
   359 			iJobQueue.Reset();
   341 			iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrCancel);
   360 			iObserver->HarvestingCompleted(this, iIndexer->GetBaseAppClass(), KErrCancel);
   342 			iObserver->RemoveHarvestingQueue(this, iIndexer->GetBaseAppClass());
   361 			iObserver->RemoveHarvestingQueue(this, iIndexer->GetBaseAppClass());
   343 			iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass(), ETrue);
   362 			iObserver->AddHarvestingQueue(this, iIndexer->GetBaseAppClass(), ETrue);
   344 			break;
   363 			break;
   345 			}
   364 			}
   355 //  
   374 //  
   356 void CCalendarPlugin::CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType )
   375 void CCalendarPlugin::CreateEntryL( const TCalLocalUid& aLocalUid, TCPixActionType aActionType )
   357 	{
   376 	{
   358 	if (!iIndexer)
   377 	if (!iIndexer)
   359     	return;
   378     	return;
   360 #ifdef USE_HIGHLIGHTER	
   379 //#ifdef USE_HIGHLIGHTER	
   361 	//Reset Excerpt
   380 	//Reset Excerpt
   362 	ResetExcerpt();
   381 	ResetExcerpt();
   363 #endif	
   382 //#endif
   364 	
       
   365 
       
   366 	OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Uid=%d", aLocalUid );
   383 	OstTrace1( TRACE_NORMAL, CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL();Uid=%d", aLocalUid );
   367 	CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL():  Uid = %d.", aLocalUid);
   384 	CPIXLOGSTRING2("CCalendarPlugin::CreateEntryL():  Uid = %d.", aLocalUid);	
   368 	
   385 	
   369 	// creating CSearchDocument object with unique ID for this application
   386 	// creating CSearchDocument object with unique ID for this application
   370 	TBuf<20> docid_str;
   387 	TBuf<20> docid_str;
   371 	docid_str.AppendNum(aLocalUid);
   388 	docid_str.AppendNum(aLocalUid);
   372 	
   389 	
   390             CleanupStack::PopAndDestroy(index_item);
   407             CleanupStack::PopAndDestroy(index_item);
   391             OstTrace0( TRACE_NORMAL, DUP1_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Donot harvest Note item." );
   408             OstTrace0( TRACE_NORMAL, DUP1_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL(): Donot harvest Note item." );
   392             CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Donot harvest Note item.");
   409             CPIXLOGSTRING("CCalendarPlugin::CreateEntryL(): Donot harvest Note item.");
   393             return;
   410             return;
   394 		    }
   411 		    }
   395 
   412 		OstTrace0( TRACE_NORMAL, DUP3_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin:: Indexing Calender" );
   396 		// Add fields
   413 		// Add fields
   397 		index_item->AddFieldL(KCalendarSummaryField, entry->SummaryL());
   414 		index_item->AddFieldL(KCalendarSummaryField, entry->SummaryL());
   398 		index_item->AddFieldL(KCalendarDescriptionField, entry->DescriptionL());
   415 		index_item->AddFieldL(KCalendarDescriptionField, entry->DescriptionL());
   399 		index_item->AddFieldL(KCalendarLocationField, entry->LocationL());
   416 		index_item->AddFieldL(KCalendarLocationField, entry->LocationL());
   400 #ifdef USE_HIGHLIGHTER
   417 //#ifdef USE_HIGHLIGHTER
   401 		index_item->AddHLDisplayFieldL(entry->SummaryL());
   418 		index_item->AddHLDisplayFieldL(entry->SummaryL());
   402 		AddToFieldExcerptL(entry->DescriptionL());
   419 		AddToFieldExcerptL(entry->DescriptionL());
   403 		AddToFieldExcerptL(entry->LocationL());
   420 		AddToFieldExcerptL(entry->LocationL());
   404 #endif
   421 //#endif
   405 
   422 
   406 		TBuf<30> dateString;
   423 		TBuf<30> dateString;
   407 		TDateTime datetime = entry->StartTimeL().TimeLocalL().DateTime();
   424 		TDateTime datetime = entry->StartTimeL().TimeLocalL().DateTime();
   408 		GetDateTimeDescriptorL(datetime, KCalendarTimeFormat, dateString);
   425 		GetDateTimeDescriptorL(datetime, KCalendarTimeFormat, dateString);
   409 		/*dateString.Format( KCalendarTimeFormat, datetime.Year(),
   426 		
   410 		                                     TInt(datetime.Month()+ 1),
       
   411 		                                     datetime.Day() + 1,
       
   412 		                                     datetime.Hour(),
       
   413 		                                     datetime.Minute());*/
       
   414 		index_item->AddFieldL(KCalendarStartTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   427 		index_item->AddFieldL(KCalendarStartTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   415 #ifdef USE_HIGHLIGHTER
   428 //#ifdef USE_HIGHLIGHTER
   416 		GetDateTimeDescriptorL(datetime, KExcerptTimeFormat, dateString);
   429 		GetDateTimeDescriptorL(datetime, KExcerptTimeFormat, dateString);
   417 		AddToFieldExcerptL(dateString);
   430 		AddToFieldExcerptL(dateString);
   418 #endif
   431 //#endif
   419 		        
   432 		        
   420 		TDateTime endTime = entry->EndTimeL().TimeLocalL().DateTime();
   433 		TDateTime endTime = entry->EndTimeL().TimeLocalL().DateTime();
   421 		GetDateTimeDescriptorL(endTime, KCalendarTimeFormat, dateString);
   434 		GetDateTimeDescriptorL(endTime, KCalendarTimeFormat, dateString);
   422 		/*dateString.Format( KCalendarTimeFormat, endTime.Year(),
   435 		
   423                                                 TInt(endTime.Month()+ 1),
       
   424                                                 endTime.Day() + 1,
       
   425                                                 endTime.Hour(),
       
   426                                                 endTime.Minute());*/
       
   427 		index_item->AddFieldL(KCalendarEndTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   436 		index_item->AddFieldL(KCalendarEndTimeField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   428 #ifdef USE_HIGHLIGHTER
   437 //#ifdef USE_HIGHLIGHTER
   429         GetDateTimeDescriptorL(endTime, KExcerptTimeFormat, dateString);
   438         GetDateTimeDescriptorL(endTime, KExcerptTimeFormat, dateString);
   430         AddToFieldExcerptL(dateString);
   439         AddToFieldExcerptL(dateString);
   431 #endif
   440 //#endif
   432 		
   441 		
   433 		if( CCalEntry::ETodo == entry->EntryTypeL())
   442 		if( CCalEntry::ETodo == entry->EntryTypeL())
   434 		    {
   443 		    {
   435             TUint priority = entry->PriorityL();        
   444             TUint priority = entry->PriorityL();        
   436             switch(priority)
   445             switch(priority)
   450                 }
   459                 }
   451             TTime completedTime = entry->CompletedTimeL().TimeLocalL();
   460             TTime completedTime = entry->CompletedTimeL().TimeLocalL();
   452             if( completedTime != Time::NullTTime())
   461             if( completedTime != Time::NullTTime())
   453                 {
   462                 {
   454                 TDateTime compTime = completedTime.DateTime();
   463                 TDateTime compTime = completedTime.DateTime();
   455                 GetDateTimeDescriptorL(compTime, KCalendarTimeFormat, dateString);
   464                 GetDateTimeDescriptorL(compTime, KCalendarTimeFormat, dateString);                
   456                 /*dateString.Format( KCalendarTimeFormat, compTime.Year(),
       
   457                                                     TInt(compTime.Month()+ 1),
       
   458                                                     compTime.Day() + 1,
       
   459                                                     compTime.Hour(),
       
   460                                                     compTime.Minute());*/
       
   461                 index_item->AddFieldL(KCalenderCompletedField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   465                 index_item->AddFieldL(KCalenderCompletedField, dateString, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   462 #ifdef USE_HIGHLIGHTER
   466 //#ifdef USE_HIGHLIGHTER
   463         GetDateTimeDescriptorL(compTime, KExcerptTimeFormat, dateString);
   467         GetDateTimeDescriptorL(compTime, KExcerptTimeFormat, dateString);
   464         AddToFieldExcerptL(dateString);
   468         AddToFieldExcerptL(dateString);
   465 #endif
   469 //#endif
   466                 }
   470                 }
   467 		    }
   471 		    }
   468 		index_item->AddFieldL(KMimeTypeField, KMimeTypeCalendar, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   472 		index_item->AddFieldL(KMimeTypeField, KMimeTypeCalendar, CDocumentField::EStoreYes | CDocumentField::EIndexUnTokenized);
   469 
   473 
   470 #ifdef USE_HIGHLIGHTER
   474 //#ifdef USE_HIGHLIGHTER
   471 		if(iExcerpt)
   475 		if(iExcerpt)
   472 		index_item->AddExcerptL(*iExcerpt);
   476 		index_item->AddExcerptL(*iExcerpt);
       
   477 /*
   473 #else
   478 #else
   474 
   479 
   475     	TInt excerptLength = 1 /*single 1-character delimiters*/ + entry->DescriptionL().Length() + entry->LocationL().Length();
   480     	TInt excerptLength = 1 single 1-character delimiters + entry->DescriptionL().Length() + entry->LocationL().Length();
   476     	
   481     	
   477 		HBufC* excerpt = HBufC::NewLC(excerptLength);
   482 		HBufC* excerpt = HBufC::NewLC(excerptLength);
   478 		TPtr excerptDes = excerpt->Des();
   483 		TPtr excerptDes = excerpt->Des();
   479 		excerptDes.Append(entry->DescriptionL());
   484 		excerptDes.Append(entry->DescriptionL());
   480 		excerptDes.Append(KExcerptDelimiter);
   485 		excerptDes.Append(KExcerptDelimiter);
   482     
   487     
   483 	    index_item->AddExcerptL(*excerpt);
   488 	    index_item->AddExcerptL(*excerpt);
   484         CleanupStack::PopAndDestroy(excerpt);
   489         CleanupStack::PopAndDestroy(excerpt);
   485        
   490        
   486 #endif
   491 #endif
       
   492 */
   487         CleanupStack::PopAndDestroy(entry);
   493         CleanupStack::PopAndDestroy(entry);
   488 
   494 
   489 		/*
   495 		/*
   490 		RPointerArray<CCalAttendee>& attendees = iEntry.AttendeesL();
   496 		RPointerArray<CCalAttendee>& attendees = iEntry.AttendeesL();
   491 		for( TInt i = 0; i < attendees.Count(); i++ )
   497 		for( TInt i = 0; i < attendees.Count(); i++ )
   515 		TRAPD(err, iIndexer->DeleteL(docid_str));
   521 		TRAPD(err, iIndexer->DeleteL(docid_str));
   516 		OstTrace1( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL: iIndexer->RemoveL;err=%d", err );
   522 		OstTrace1( TRACE_NORMAL, DUP2_CCALENDARPLUGIN_CREATEENTRYL, "CCalendarPlugin::CreateEntryL: iIndexer->RemoveL;err=%d", err );
   517 		}
   523 		}
   518 
   524 
   519 	}
   525 	}
   520 #ifdef USE_HIGHLIGHTER
   526 //#ifdef USE_HIGHLIGHTER
   521 // ---------------------------------------------------------------------------
   527 // ---------------------------------------------------------------------------
   522 // CCalendarPlugin::AddToFieldExcerptL
   528 // CCalendarPlugin::AddToFieldExcerptL
   523 // ---------------------------------------------------------------------------
   529 // ---------------------------------------------------------------------------
   524 //
   530 //
   525 void CCalendarPlugin::AddToFieldExcerptL(const TDesC& aExcerptValue)
   531 void CCalendarPlugin::AddToFieldExcerptL(const TDesC& aExcerptValue)
   526 {
   532 {
       
   533 OstTraceFunctionEntry0( CCALENDARPLUGIN_ADDTOFIELDEXCERPTL_ENTRY );
       
   534 OstTraceExt1( TRACE_NORMAL, CCALENDARPLUGIN_ADDTOFIELDEXCERPTL, "CCalendarPlugin::AddToFieldExcerptL;excerptvalue=%S", aExcerptValue );
       
   535 
   527 if(!iExcerpt)
   536 if(!iExcerpt)
   528     {
   537     {
   529     iExcerpt = HBufC::NewL(5);
   538     iExcerpt = HBufC::NewL(5);
   530     }
   539     }
   531 if(aExcerptValue.Compare(KNullDesC) != 0)//value is not Null
   540 if(aExcerptValue.Compare(KNullDesC) != 0)//value is not Null
   538         }
   547         }
   539     TPtr ptr = iExcerpt->Des();
   548     TPtr ptr = iExcerpt->Des();
   540     ptr.Append(aExcerptValue);
   549     ptr.Append(aExcerptValue);
   541     ptr.Append(KExcerptDelimiter);
   550     ptr.Append(KExcerptDelimiter);
   542     }
   551     }
       
   552 OstTraceFunctionExit0( CCALENDARPLUGIN_ADDTOFIELDEXCERPTL_EXIT );
   543 }
   553 }
   544 
   554 
   545 // -----------------------------------------------------------------------------
   555 // -----------------------------------------------------------------------------
   546 // CCalendarPlugin::ResetExcerpt() 
   556 // CCalendarPlugin::ResetExcerpt() 
   547 // -----------------------------------------------------------------------------
   557 // -----------------------------------------------------------------------------
   552         {
   562         {
   553         delete iExcerpt;
   563         delete iExcerpt;
   554         iExcerpt = NULL;
   564         iExcerpt = NULL;
   555         }
   565         }
   556     }
   566     }
   557 #endif
   567 //#endif
   558 // -----------------------------------------------------------------------------
   568 // -----------------------------------------------------------------------------
   559 // CCalendarPlugin::GetDateTimeDescriptorL() 
   569 // CCalendarPlugin::GetDateTimeDescriptorL() 
   560 // -----------------------------------------------------------------------------
   570 // -----------------------------------------------------------------------------
   561 //
   571 //
   562 void CCalendarPlugin::GetDateTimeDescriptorL(TDateTime& datetime, const TDesC& aFormat, TDes& dateString)
   572 void CCalendarPlugin::GetDateTimeDescriptorL(TDateTime& datetime, const TDesC& aFormat, TDes& dateString)
   565                              TInt(datetime.Month()+ 1),
   575                              TInt(datetime.Month()+ 1),
   566                              datetime.Day() + 1,
   576                              datetime.Day() + 1,
   567                              datetime.Hour(),
   577                              datetime.Hour(),
   568                              datetime.Minute());
   578                              datetime.Minute());
   569     }
   579     }
   570 
   580 // -----------------------------------------------------------------------------
   571 
   581 // CCalendarPlugin::PausePluginL() 
       
   582 // -----------------------------------------------------------------------------
       
   583 //
       
   584 void CCalendarPlugin::PausePluginL()
       
   585     {
       
   586     OstTraceFunctionEntry0( CCALENDARPLUGIN_PAUSEPLUGINL_ENTRY );
       
   587     iIndexState = EFalse;
       
   588     OstTraceFunctionExit0( CCALENDARPLUGIN_PAUSEPLUGINL_EXIT );
       
   589     }
       
   590 // -----------------------------------------------------------------------------
       
   591 // CCalendarPlugin::ResumePluginL() 
       
   592 // -----------------------------------------------------------------------------
       
   593 //
       
   594 void CCalendarPlugin::ResumePluginL()
       
   595     {
       
   596     OstTraceFunctionEntry0( CCALENDARPLUGIN_RESUMEPLUGINL_ENTRY );
       
   597     iIndexState = ETrue;
       
   598         
       
   599     if( iHarvestState == EHarvesterStartHarvest )
       
   600         {
       
   601         if(iAsynchronizer->CallbackPending())
       
   602             iAsynchronizer->CancelCallback();
       
   603         iAsynchronizer->Start( 0, this, KHarvestingDelay );
       
   604         }
       
   605     else
       
   606         {
       
   607         IndexQueuedItems();
       
   608         }
       
   609     OstTraceFunctionExit0( CCALENDARPLUGIN_RESUMEPLUGINL_EXIT );
       
   610     }
       
   611 // -----------------------------------------------------------------------------
       
   612 // CCalendarPlugin::OverWriteOrAddToQueueL() 
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 void CCalendarPlugin::OverWriteOrAddToQueueL(const TCalLocalUid& aLocalUid, TCPixActionType aActionType)
       
   616     {
       
   617     OstTraceFunctionEntry0( CCALENDARPLUGIN_OVERWRITEORADDTOQUEUEL_ENTRY );
       
   618     TRecord entry;    
       
   619     for (TInt i=0; i<iJobQueue.Count(); i++)
       
   620         {
       
   621             if (iJobQueue[i].iLocalUid == aLocalUid)
       
   622             {
       
   623                 // Older version found
       
   624                 iJobQueue[i].iLocalUid = aLocalUid;
       
   625                 iJobQueue[i].iActionType = aActionType;
       
   626                 OstTraceFunctionExit0( CCALENDARPLUGIN_OVERWRITEORADDTOQUEUEL_EXIT );
       
   627                 return;
       
   628             }
       
   629         }        
       
   630     // older not found, append
       
   631     entry.iActionType = aActionType;
       
   632     entry.iLocalUid = aLocalUid;
       
   633     iJobQueue.AppendL(entry);
       
   634     OstTraceFunctionExit0( DUP1_CCALENDARPLUGIN_OVERWRITEORADDTOQUEUEL_EXIT );
       
   635     }
       
   636 // -----------------------------------------------------------------------------
       
   637 // CCalendarPlugin::IndexQueuedItems() 
       
   638 // -----------------------------------------------------------------------------
       
   639 //
       
   640 void CCalendarPlugin::IndexQueuedItems()
       
   641     {
       
   642     OstTraceFunctionEntry0( CCALENDARPLUGIN_INDEXQUEUEDITEMS_ENTRY );
       
   643     while (iJobQueue.Count()>0)
       
   644         {
       
   645         TRecord entry = iJobQueue[0];        
       
   646         //Let the indexer handle this object TRAP it as it can leave
       
   647         TRAPD(err,CreateEntryL( entry.iLocalUid, entry.iActionType ));        
       
   648         if(KErrNone == err)
       
   649             {
       
   650             iJobQueue.Remove(0);
       
   651             }
       
   652         }
       
   653     OstTraceFunctionExit0( CCALENDARPLUGIN_INDEXQUEUEDITEMS_EXIT );
       
   654     }
   572 // ---------------------------------------------------------------------------
   655 // ---------------------------------------------------------------------------
   573 // CCalendarPlugin::UpdatePerformaceDataL
   656 // CCalendarPlugin::UpdatePerformaceDataL
   574 // ---------------------------------------------------------------------------
   657 // ---------------------------------------------------------------------------
   575 //
   658 //
   576 #ifdef __PERFORMANCE_DATA
   659 #ifdef __PERFORMANCE_DATA