harvesterplugins/contacts/src/ccontactsplugin.cpp
changeset 9 4a2987baf8f7
parent 7 51d10d255e92
child 15 df6898e696c6
equal deleted inserted replaced
8:2f67eb14d003 9:4a2987baf8f7
    76 // CContactsPlugin::~CContactsPlugin()
    76 // CContactsPlugin::~CContactsPlugin()
    77 // -----------------------------------------------------------------------------
    77 // -----------------------------------------------------------------------------
    78 //
    78 //
    79 CContactsPlugin::~CContactsPlugin()
    79 CContactsPlugin::~CContactsPlugin()
    80 	{
    80 	{
    81     if (iAsynchronizer)
    81     if( iAsynchronizer ) iAsynchronizer->CancelCallback(); 
    82         iAsynchronizer->CancelCallback();
       
    83 	delete iAsynchronizer;
    82 	delete iAsynchronizer;
    84 	iContacts = NULL;
    83 	iContacts = NULL;
    85 	delete iChangeNotifier;
    84 	delete iChangeNotifier;
    86 	delete iDatabase;
    85 	delete iDatabase;
    87 	delete iIndexer;
    86 	delete iIndexer;
    88 	
    87 	//delete NULL is safe - so no need to test nullity of iExceprt (which routinely
    89 	if (iExcerpt)
    88 	//keeps getting deleted in the plugin).
    90 		delete iExcerpt;
    89 	delete iExcerpt;
    91 	}
    90 	}
    92 	
    91 	
    93 // -----------------------------------------------------------------------------
    92 // -----------------------------------------------------------------------------
    94 // CContactsPlugin::ConstructL()
    93 // CContactsPlugin::ConstructL()
    95 // -----------------------------------------------------------------------------
    94 // -----------------------------------------------------------------------------
   149 	{
   148 	{
   150 	switch( aEvent.iType )
   149 	switch( aEvent.iType )
   151 		{
   150 		{
   152 		case EContactDbObserverEventContactChanged:
   151 		case EContactDbObserverEventContactChanged:
   153 		case EContactDbObserverEventGroupChanged:
   152 		case EContactDbObserverEventGroupChanged:
       
   153 		case EContactDbObserverEventOwnCardChanged:
   154 			OstTrace1( TRACE_NORMAL, DUP3_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL;Monitored update id=%d", aEvent.iContactId );			
   154 			OstTrace1( TRACE_NORMAL, DUP3_CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL;Monitored update id=%d", aEvent.iContactId );			
   155 			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored update id=%d.", aEvent.iContactId);
   155 			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored update id=%d.", aEvent.iContactId);
   156 #ifdef __PERFORMANCE_DATA
   156 #ifdef __PERFORMANCE_DATA
   157             iStartTime.UniversalTime();
   157             iStartTime.UniversalTime();
   158             CreateContactIndexItemL(aEvent.iContactId, ECPixUpdateAction);
   158             CreateContactIndexItemL(aEvent.iContactId, ECPixUpdateAction);
   162 #endif			
   162 #endif			
   163 			break;
   163 			break;
   164 
   164 
   165 		case EContactDbObserverEventContactDeleted:
   165 		case EContactDbObserverEventContactDeleted:
   166 		case EContactDbObserverEventGroupDeleted:
   166 		case EContactDbObserverEventGroupDeleted:
       
   167 		case EContactDbObserverEventOwnCardDeleted:
   167 			OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL();Monitored delete id=%d", aEvent.iContactId );
   168 			OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_HANDLEDATABASEEVENTL, "CContactsPlugin::HandleDatabaseEventL();Monitored delete id=%d", aEvent.iContactId );
   168 			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored delete id=%d.", aEvent.iContactId);
   169 			CPIXLOGSTRING2("CContactsPlugin::DelayedCallbackL(): Monitored delete id=%d.", aEvent.iContactId);
   169 #ifdef __PERFORMANCE_DATA
   170 #ifdef __PERFORMANCE_DATA
   170             iStartTime.UniversalTime();			
   171             iStartTime.UniversalTime();			
   171 			CreateContactIndexItemL(aEvent.iContactId, ECPixRemoveAction);
   172 			CreateContactIndexItemL(aEvent.iContactId, ECPixRemoveAction);
   338 // CContactsPlugin::CreateMessageIndexItemL
   339 // CContactsPlugin::CreateMessageIndexItemL
   339 // ---------------------------------------------------------------------------
   340 // ---------------------------------------------------------------------------
   340 //	    
   341 //	    
   341 void CContactsPlugin::CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType )
   342 void CContactsPlugin::CreateContactIndexItemL(TInt aContentId, TCPixActionType aActionType )
   342     {
   343     {
       
   344     //indexer is created only when StartPlugin() is called. Don't create contact 
       
   345     //if index is not ready. 
   343 	if (!iIndexer)
   346 	if (!iIndexer)
   344     	return;
   347     	return;
   345     
   348     
   346 	OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();aContentId=%d", aContentId );
   349 	OstTrace1( TRACE_NORMAL, CCONTACTSPLUGIN_CREATECONTACTINDEXITEML, "CContactsPlugin::CreateContactIndexItemL();aContentId=%d", aContentId );
   347 	CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): aContentId = %d ", aContentId );
   350 	CPIXLOGSTRING2("CContactsPlugin::CreateContactIndexItemL(): aContentId = %d ", aContentId );
   479 // ---------------------------------------------------------------------------
   482 // ---------------------------------------------------------------------------
   480 //
   483 //
   481 void CContactsPlugin::GetDateL(const TDesC& aTime, TDes& aDateString)
   484 void CContactsPlugin::GetDateL(const TDesC& aTime, TDes& aDateString)
   482     {
   485     {
   483     TTime time;
   486     TTime time;
   484     //sort the date string to the requried format dd/mm/yyyy from returned
   487     //aTime is of the form yyyy-mm-dd.
   485     //format yyyy/mm/dd as parse API is currently not supporting japanese date format
   488     //aDateString is of the form dd Month(spelled out) Year.
       
   489     //example: i/p: 2010-10-10; o/p: 10 October 2010.
   486     if( aTime.Length() >= KDateFieldLength)
   490     if( aTime.Length() >= KDateFieldLength)
   487         {
   491         {
   488         aDateString.Copy(aTime.Mid( KDayPosition, KDayLength ));
   492         aDateString.Copy(aTime.Mid( KDayPosition, KDayLength ));
   489         aDateString.Append(KDateSeparator);
   493         aDateString.Append(KDateSeparator);
   490         aDateString.Append(aTime.Mid( KMonthPosition, KDayLength ));
   494         aDateString.Append(aTime.Mid( KMonthPosition, KDayLength ));
   495             {
   499             {
   496             time.FormatL(aDateString, KTimeFormat);
   500             time.FormatL(aDateString, KTimeFormat);
   497             }
   501             }
   498         }
   502         }
   499     }
   503     }
       
   504 
   500 // ---------------------------------------------------------------------------
   505 // ---------------------------------------------------------------------------
   501 // CContactsPlugin::UpdatePerformaceDataL
   506 // CContactsPlugin::UpdatePerformaceDataL
   502 // ---------------------------------------------------------------------------
   507 // ---------------------------------------------------------------------------
   503 //	
   508 //	
   504 #ifdef __PERFORMANCE_DATA
   509 #ifdef __PERFORMANCE_DATA