emailservices/psmruadapter/src/CPsMruAdapter.cpp
branchRCL_3
changeset 22 d620048b4810
parent 20 efd4f1afd43e
equal deleted inserted replaced
20:efd4f1afd43e 22:d620048b4810
    15  *
    15  *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
       
    20 
    20 #include <CPsData.h>
    21 #include <CPsData.h>
    21 #include <CPcsDefs.h>
    22 #include <CPcsDefs.h>
    22 #include <coemain.h>
    23 #include <coemain.h>
    23 #include <data_caging_path_literals.hrh>
    24 #include <data_caging_path_literals.hrh>
    24 #include <VPbkEng.rsg>
    25 #include <VPbkEng.rsg>
    51     FUNC_LOG;
    52     FUNC_LOG;
    52     PRINT ( _L( "Enter CPsMruAdapter::NewL" ) );
    53     PRINT ( _L( "Enter CPsMruAdapter::NewL" ) );
    53     
    54     
    54     // Get the PsData plugin parametrs
    55     // Get the PsData plugin parametrs
    55     TPsDataPluginParams* params =
    56     TPsDataPluginParams* params =
    56     		reinterpret_cast<TPsDataPluginParams*>(aPsDataPluginParameters );
    57             reinterpret_cast<TPsDataPluginParams*>(aPsDataPluginParameters );
    57     CPsMruAdapter* self = new ( ELeave ) CPsMruAdapter();
    58     CPsMruAdapter* self = new ( ELeave ) CPsMruAdapter();
    58     CleanupStack::PushL(self);
    59     CleanupStack::PushL(self);
    59     self->ConstructL( params->iDataStoreObserver, params->iStoreListObserver );
    60     self->ConstructL( params->iDataStoreObserver, params->iStoreListObserver );
    60     CleanupStack::Pop( self );
    61     CleanupStack::Pop( self );
    61     
    62     
    81 // Two Phase Construction
    82 // Two Phase Construction
    82 // ----------------------------------------------------------------------------
    83 // ----------------------------------------------------------------------------
    83 void CPsMruAdapter::ConstructL( MDataStoreObserver* aObserverForDataStore,
    84 void CPsMruAdapter::ConstructL( MDataStoreObserver* aObserverForDataStore,
    84         MStoreListObserver* aStoreListObserver )
    85         MStoreListObserver* aStoreListObserver )
    85     {
    86     {
    86     FUNC_LOG;	
    87     FUNC_LOG;   
    87     PRINT ( _L( "Enter CPsMruAdapter::ConstructL" ) );
    88     PRINT ( _L( "Enter CPsMruAdapter::ConstructL" ) );
    88 
    89 
    89     // Mail client for FS Email framework
    90     // Mail client for FS Email framework
    90     iMailClient = CFSMailClient::NewL();
    91     iMailClient = CFSMailClient::NewL();
    91 
    92 
   107 // CPsMruAdapter::~CPsMruAdapter
   108 // CPsMruAdapter::~CPsMruAdapter
   108 // Destructor
   109 // Destructor
   109 // ----------------------------------------------------------------------------
   110 // ----------------------------------------------------------------------------
   110 CPsMruAdapter::~CPsMruAdapter()
   111 CPsMruAdapter::~CPsMruAdapter()
   111     {
   112     {
   112     FUNC_LOG;	
   113     FUNC_LOG;   
   113     PRINT ( _L( "Enter CPsMruAdapter::~CPsMruAdapter" ) );
   114     PRINT ( _L( "Enter CPsMruAdapter::~CPsMruAdapter" ) );
   114 
   115 
   115     iSupportedUris.ResetAndDestroy();
   116     iSupportedUris.ResetAndDestroy();
   116 
   117 
   117     // Remove observer, we don't need it anymore because we're shutting down
   118     // Remove observer, we don't need it anymore because we're shutting down
   138 // ----------------------------------------------------------------------------
   139 // ----------------------------------------------------------------------------
   139 // CPsMruAdapter::RequestForDataL
   140 // CPsMruAdapter::RequestForDataL
   140 // 
   141 // 
   141 // ----------------------------------------------------------------------------
   142 // ----------------------------------------------------------------------------
   142 void CPsMruAdapter::RequestForDataL( TDesC& aDataStoreURI )
   143 void CPsMruAdapter::RequestForDataL( TDesC& aDataStoreURI )
   143 	{
   144     {
   144     FUNC_LOG;	
   145     FUNC_LOG;   
   145     PRINT ( _L( "Enter CPsMruAdapter::RequestForDataL" ) );
   146     PRINT ( _L( "Enter CPsMruAdapter::RequestForDataL" ) );
   146 
   147 
   147     // Add data to datastore, fill only requested one
   148     // Add data to datastore, fill only requested one
   148     FillDataStoreL( aDataStoreURI );
   149     FillDataStoreL( aDataStoreURI );
   149 
   150 
   156 // ----------------------------------------------------------------------------
   157 // ----------------------------------------------------------------------------
   157 
   158 
   158 void CPsMruAdapter::GetSupportedDataStoresL(
   159 void CPsMruAdapter::GetSupportedDataStoresL(
   159         RPointerArray<TDesC> &aDataStoresURIs )
   160         RPointerArray<TDesC> &aDataStoresURIs )
   160     {
   161     {
   161     FUNC_LOG;	
   162     FUNC_LOG;   
   162     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
   163     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
   163         {
   164         {
   164         aDataStoresURIs.Append( iSupportedUris[i] );
   165         aDataStoresURIs.Append( iSupportedUris[i] );
   165         }
   166         }
   166     }
   167     }
   169 // CPsMruAdapter::RequestForDataExtensionL
   170 // CPsMruAdapter::RequestForDataExtensionL
   170 // 
   171 // 
   171 // ----------------------------------------------------------------------------
   172 // ----------------------------------------------------------------------------
   172 TAny* CPsMruAdapter::RequestForDataExtensionL(TInt /*aItemId*/)
   173 TAny* CPsMruAdapter::RequestForDataExtensionL(TInt /*aItemId*/)
   173     {
   174     {
   174     FUNC_LOG;	
   175     FUNC_LOG;   
   175     // No extention required for this since we have and interger as itemId
   176     // No extention required for this since we have and interger as itemId
   176     // Simply return NULL
   177     // Simply return NULL
   177     return NULL;
   178     return NULL;
   178     }
   179     }
   179 
   180 
   181 // CPsMruAdapter::UpdateSupportedDataStoresList
   182 // CPsMruAdapter::UpdateSupportedDataStoresList
   182 // 
   183 // 
   183 // ----------------------------------------------------------------------------
   184 // ----------------------------------------------------------------------------
   184 void CPsMruAdapter::UpdateSupportedDataStoresList()
   185 void CPsMruAdapter::UpdateSupportedDataStoresList()
   185     {
   186     {
   186     FUNC_LOG;	
   187     FUNC_LOG;   
   187     // Mailboxes will be fetched to this array
   188     // Mailboxes will be fetched to this array
   188     RPointerArray<CFSMailBox> mailBoxes;
   189     RPointerArray<CFSMailBox> mailBoxes;
   189 
   190 
   190     // List all mailboxes
   191     // List all mailboxes
   191     TFSMailMsgId plugin;
   192     TFSMailMsgId plugin;
   220 // ----------------------------------------------------------------------------
   221 // ----------------------------------------------------------------------------
   221 // CPsMruAdapter::FillDataStoreL
   222 // CPsMruAdapter::FillDataStoreL
   222 // ----------------------------------------------------------------------------
   223 // ----------------------------------------------------------------------------
   223 TBool CPsMruAdapter::FillDataStoreL( TDesC& aDataStoreURI )
   224 TBool CPsMruAdapter::FillDataStoreL( TDesC& aDataStoreURI )
   224     {
   225     {
   225     FUNC_LOG;	
   226     FUNC_LOG;   
   226     TBool result = EFalse;
   227     TBool result = EFalse;
   227 
   228 
   228     TFSMailMsgId dataStoreId;
   229     TFSMailMsgId dataStoreId;
   229 
   230 
   230     if ( GetMailboxIdentifierFromUri( aDataStoreURI, dataStoreId ) )
   231     if ( GetMailboxIdentifierFromUri( aDataStoreURI, dataStoreId ) )
   235     return result;
   236     return result;
   236     }
   237     }
   237 
   238 
   238 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId )
   239 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId )
   239     {
   240     {
   240     FUNC_LOG;	
   241     FUNC_LOG;   
   241     TBool result = EFalse;
   242     TBool result = EFalse;
   242 
   243 
   243     // Create Uri for this mailbox
   244     // Create Uri for this mailbox
   244     HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength );
   245     HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength );
   245     if ( GetUriFromMailboxIdentifier( aId, *identifier ) )
   246     if ( GetUriFromMailboxIdentifier( aId, *identifier ) )
   250     return result;
   251     return result;
   251     }
   252     }
   252 
   253 
   253 void CPsMruAdapter::AddMruEmailsL( MDesCArray* aMruList, TDesC& aDataStoreURI )
   254 void CPsMruAdapter::AddMruEmailsL( MDesCArray* aMruList, TDesC& aDataStoreURI )
   254     {
   255     {
   255     FUNC_LOG;	
   256     FUNC_LOG;   
   256     TInt entryIndex = 0;
   257     TInt entryIndex = 0;
   257     // Add all data to data store, the format is:
   258     // Add all data to data store, the format is:
   258     // index0: displayname
   259     // index0: displayname
   259     // index1: email
   260     // index1: email
   260     // index2: next displayname
   261     // index2: next displayname
   279         }
   280         }
   280     }
   281     }
   281 
   282 
   282 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI )
   283 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI )
   283     {
   284     {
   284     FUNC_LOG;	
   285     FUNC_LOG;   
   285     TBool result = EFalse;
   286     TBool result = EFalse;
   286 // code was simplified not to trace all mailboxes
   287 // code was simplified not to trace all mailboxes
   287 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
   288 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
   288 // should not leave when new mailbox only when new mail address
   289 // should not leave when new mailbox only when new mail address
       
   290 // TODO SK how to avoid extra calls?    
   289     CFSMailBox *mailBox = iMailClient->GetMailBoxByUidLC(aId);
   291     CFSMailBox *mailBox = iMailClient->GetMailBoxByUidLC(aId);
   290     if( mailBox )
   292     if( mailBox )
   291         {
   293         {
   292         AddMailboxObserverL( aId );
   294         AddMailboxObserverL( aId );
   293         
   295         
   294         // Get MRU list for this mailbox
   296         // Get MRU list for this mailbox
   295         MDesCArray* mruList = mailBox->ListMrusL();
   297         MDesCArray* mruList = mailBox->ListMrusL(); // TODO SK this value can be cached?
       
   298         //TODO add to cleanup stack?
   296         
   299         
   297         // update the caching status as InProgress
   300         // update the caching status as InProgress
   298         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
   301         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
   299                 ECachingInProgress );
   302                 ECachingInProgress );
   300 
   303 
   325 // CPsContactDataAdapter::IsDataStoresSupportedL
   328 // CPsContactDataAdapter::IsDataStoresSupportedL
   326 // 
   329 // 
   327 // ----------------------------------------------------------------------------
   330 // ----------------------------------------------------------------------------
   328 TBool CPsMruAdapter::IsDataStoresSupportedL( TDesC& aDataStoreURI )
   331 TBool CPsMruAdapter::IsDataStoresSupportedL( TDesC& aDataStoreURI )
   329     {
   332     {
   330     FUNC_LOG;	
   333     FUNC_LOG;   
   331     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
   334     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
   332         {
   335         {
   333         if ( iSupportedUris[i]->Compare( aDataStoreURI ) == 0 )
   336         if ( iSupportedUris[i]->Compare( aDataStoreURI ) == 0 )
   334             return ETrue;
   337             return ETrue;
   335         }
   338         }
   340 // CPsContactDataAdapter::GetSupportedDataFieldsL
   343 // CPsContactDataAdapter::GetSupportedDataFieldsL
   341 // 
   344 // 
   342 // ----------------------------------------------------------------------------
   345 // ----------------------------------------------------------------------------
   343 void CPsMruAdapter::GetSupportedDataFieldsL( RArray<TInt>& aDataFields )
   346 void CPsMruAdapter::GetSupportedDataFieldsL( RArray<TInt>& aDataFields )
   344     {
   347     {
   345     FUNC_LOG;	
   348     FUNC_LOG;   
   346     aDataFields.Append( R_VPBK_FIELD_TYPE_FIRSTNAME );
   349     aDataFields.Append( R_VPBK_FIELD_TYPE_FIRSTNAME );
   347     aDataFields.Append( R_VPBK_FIELD_TYPE_LASTNAME );
   350     aDataFields.Append( R_VPBK_FIELD_TYPE_LASTNAME );
   348     aDataFields.Append( R_VPBK_FIELD_TYPE_EMAILGEN );
   351     aDataFields.Append( R_VPBK_FIELD_TYPE_EMAILGEN );
   349     }
   352     }
   350 
   353 
   351 TBool CPsMruAdapter::GetMailboxIdentifierFromUri( TDesC& aUri, TFSMailMsgId& aId )
   354 TBool CPsMruAdapter::GetMailboxIdentifierFromUri( TDesC& aUri, TFSMailMsgId& aId )
   352     {
   355     {
   353     FUNC_LOG;	
   356     FUNC_LOG;   
   354     // Find first separator in reverse order
   357     // Find first separator in reverse order
   355     TInt lastSeparator = aUri.LocateReverseF( KDefaultMailBoxURISeparator );
   358     TInt lastSeparator = aUri.LocateReverseF( KDefaultMailBoxURISeparator );
   356     if ( lastSeparator == KErrNotFound )
   359     if ( lastSeparator == KErrNotFound )
   357         return EFalse;
   360         return EFalse;
   358 
   361 
   390     return ETrue;
   393     return ETrue;
   391     }
   394     }
   392 
   395 
   393 TBool CPsMruAdapter::GetUriFromMailboxIdentifier( TFSMailMsgId& aId, HBufC& aUri )
   396 TBool CPsMruAdapter::GetUriFromMailboxIdentifier( TFSMailMsgId& aId, HBufC& aUri )
   394     {
   397     {
   395     FUNC_LOG;	
   398     FUNC_LOG;   
   396     // Add the uri identifier
   399     // Add the uri identifier
   397     aUri.Des().Copy( KDefaultMailBoxURI );
   400     aUri.Des().Copy( KDefaultMailBoxURI );
   398     // Add plugin ID
   401     // Add plugin ID
   399     aUri.Des().AppendNum( aId.PluginId().iUid );
   402     aUri.Des().AppendNum( aId.PluginId().iUid );
   400     // Add separator
   403     // Add separator
   406     }
   409     }
   407 
   410 
   408 void CPsMruAdapter::EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox,
   411 void CPsMruAdapter::EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox,
   409         TAny* /*aParam1*/, TAny* aParam2, TAny* /*aParam3*/ )
   412         TAny* /*aParam1*/, TAny* aParam2, TAny* /*aParam3*/ )
   410     {
   413     {
   411     FUNC_LOG;	
   414     FUNC_LOG;   
   412     switch ( aEvent )
   415     switch ( aEvent )
   413         {
   416         {
   414         case TFSEventMailMoved:
   417         case TFSEventMailMoved:
   415         case TFSEventMailCopied:		
   418         case TFSEventMailCopied:        
   416         case TFSEventNewMail:
   419         case TFSEventNewMail:
   417             {
   420             {
   418             // Check the new parent folder id for this message
   421             // Check the new parent folder id for this message
   419             // For all these events, param2 indicates the new parent folder
   422             // For all these events, param2 indicates the new parent folder
   420             TFSMailMsgId* parentFolderId =
   423             TFSMailMsgId* parentFolderId =
   421             		static_cast< TFSMailMsgId* >( aParam2 );
   424                     static_cast< TFSMailMsgId* >( aParam2 );
   422             if ( parentFolderId )
   425             if ( parentFolderId )
   423                 {
   426                 {
   424                 // Get the parent folder object
   427                 TFSFolderType folderType( EFSInbox ); 
   425                 CFSMailFolder* parentFolder = iMailClient->GetFolderByUidL(
   428                 if ( (*parentFolderId) == iPreviousParentFolderId && aMailbox == iPreviousMailboxId )
   426                         aMailbox, *parentFolderId );
       
   427                 if ( parentFolder )
       
   428                     {
   429                     {
   429                     CleanupStack::PushL( parentFolder );
   430                     // we assume that folder with some id does not change 
   430                 
   431                     // its type during mail synchronization
   431                     // If it's sent/outbox folder,
   432                     folderType = iPreviousParentFolderType;
   432                     // we'll consider that as a new message being sent
   433                     }
   433                     // and therefore we'll update the MRU list here
   434                 else
   434                     if ( ( parentFolder->GetFolderType() == EFSSentFolder ) || 
   435                     {
   435                          ( parentFolder->GetFolderType() == EFSOutbox ) )
   436                     // Get the parent folder object
       
   437                     CFSMailFolder* parentFolder = iMailClient->GetFolderByUidL(
       
   438                             aMailbox, *parentFolderId );
       
   439                     if ( parentFolder )
   436                         {
   440                         {
   437                         FillDataStoreL( aMailbox );
   441                         iPreviousParentFolderId = (*parentFolderId);
       
   442                         iPreviousMailboxId = aMailbox;
       
   443                         folderType = parentFolder->GetFolderType();
       
   444                         iPreviousParentFolderType = folderType;
       
   445                         delete parentFolder;
       
   446                         parentFolder = NULL;
   438                         }
   447                         }
   439                     CleanupStack::PopAndDestroy( parentFolder );
   448                     }
       
   449                 // If it's sent/outbox folder,
       
   450                 // we'll consider that as a new message being sent
       
   451                 // and therefore we'll update the MRU list here
       
   452                 if ( ( folderType == EFSSentFolder ) || 
       
   453                      ( folderType == EFSOutbox ) )
       
   454                     {
       
   455                     FillDataStoreL( aMailbox );
   440                     }
   456                     }
   441                 }
   457                 }
   442             }
   458             }
   443             break;
   459             break;
   444             
   460             
   457                 mailboxPtr = NULL;
   473                 mailboxPtr = NULL;
   458                 }
   474                 }
   459             else
   475             else
   460                 {
   476                 {
   461                 // mailbox still does not exist
   477                 // mailbox still does not exist
   462                 DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation	
   478                 DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation    
   463                 break;
   479                 break;
   464                 }
   480                 }
   465             
   481             
   466             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   482             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   467             if ( GetUriFromMailboxIdentifier( aMailbox, *identifier ) )
   483             if ( GetUriFromMailboxIdentifier( aMailbox, *identifier ) )
   508                         break;
   524                         break;
   509                         }
   525                         }
   510                     }
   526                     }
   511                 }
   527                 }
   512             delete identifier;
   528             delete identifier;
   513             }
   529             
       
   530             iPreviousParentFolderId = TFSMailMsgId();
       
   531             iPreviousMailboxId = TFSMailMsgId();  
   514             break;
   532             break;
   515         }
   533             }
   516     }
   534         case TFSEventMailboxSettingsChanged: // TODO SK check
   517 
   535             {
       
   536             iPreviousParentFolderId = TFSMailMsgId();
       
   537             iPreviousMailboxId = TFSMailMsgId();  
       
   538             break;
       
   539             }
       
   540         }
       
   541     }
   518 TBool CPsMruAdapter::AddMailboxObserverL( TFSMailMsgId& aId )
   542 TBool CPsMruAdapter::AddMailboxObserverL( TFSMailMsgId& aId )
   519     {
   543     {
   520     FUNC_LOG;	
   544     FUNC_LOG;   
   521     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   545     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   522         {
   546         {
   523         if( iObservedMailboxes[index] == aId )
   547         if( iObservedMailboxes[index] == aId )
   524             {
   548             {
   525             // Already observing
   549             // Already observing
   532     return ETrue;
   556     return ETrue;
   533     }
   557     }
   534 
   558 
   535 TBool CPsMruAdapter::RemoveMailboxObserver( TFSMailMsgId& aId )
   559 TBool CPsMruAdapter::RemoveMailboxObserver( TFSMailMsgId& aId )
   536     {
   560     {
   537     FUNC_LOG;	
   561     FUNC_LOG;   
   538     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   562     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   539         {
   563         {
   540         if( iObservedMailboxes[index] == aId )
   564         if( iObservedMailboxes[index] == aId )
   541             {
   565             {
   542             iMailClient->UnsubscribeMailboxEvents( aId, *this );
   566             iMailClient->UnsubscribeMailboxEvents( aId, *this );
   548     return EFalse;
   572     return EFalse;
   549     }
   573     }
   550 
   574 
   551 void CPsMruAdapter::RemoveAllMailboxObservers()
   575 void CPsMruAdapter::RemoveAllMailboxObservers()
   552     {
   576     {
   553     FUNC_LOG;	
   577     FUNC_LOG;   
   554     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   578     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
   555         {
   579         {
   556         iMailClient->UnsubscribeMailboxEvents( iObservedMailboxes[index], *this );
   580         iMailClient->UnsubscribeMailboxEvents( iObservedMailboxes[index], *this );
   557         }
   581         }
   558 
   582 
   559     iObservedMailboxes.Reset();	
   583     iObservedMailboxes.Reset(); 
   560     }
   584     }
   561 
   585 
   562 /**
   586 /**
   563  * If problem with NewMailbox this function will be called 
   587  * If problem with NewMailbox this function will be called 
   564  * by CDelayMailboxCreationHelper timer to try it after some delay
   588  * by CDelayMailboxCreationHelper timer to try it after some delay
   565  */
   589  */
   566 TBool CPsMruAdapter::DeleayedMailboxCreationEventL()
   590 TBool CPsMruAdapter::DeleayedMailboxCreationEventL()
   567 	{
   591     {
   568     FUNC_LOG;
   592     FUNC_LOG;
   569     for ( int i = iDelayedCreatedMailboxes.Count()-1; i>=0; i-- )
   593     for ( int i = iDelayedCreatedMailboxes.Count()-1; i>=0; i-- )
   570         {
   594         {
   571         CFSMailBox *mailboxPtr(NULL);
   595         CFSMailBox *mailboxPtr(NULL);
   572         // if mailbox is not ready it may leave there
   596         // if mailbox is not ready it may leave there
   596 
   620 
   597                 // In case there is a problem with transferring strings to  - should be obsolete 
   621                 // In case there is a problem with transferring strings to  - should be obsolete 
   598                 AddMailboxObserverL( iDelayedCreatedMailboxes[i] ); // will be added by FillDataStoreL
   622                 AddMailboxObserverL( iDelayedCreatedMailboxes[i] ); // will be added by FillDataStoreL
   599 
   623 
   600                 CleanupStack::Pop( identifier );
   624                 CleanupStack::Pop( identifier );
   601                 iDelayedCreatedMailboxes.Remove( i );    	
   625                 iDelayedCreatedMailboxes.Remove( i );       
   602                 }
   626                 }
   603             else
   627             else
   604                 {
   628                 {
   605                 CleanupStack::PopAndDestroy( identifier );
   629                 CleanupStack::PopAndDestroy( identifier );
   606                 }
   630                 }
   613  * If problem with NewMailbox this function will use 
   637  * If problem with NewMailbox this function will use 
   614  * CDelayMailboxCreationHelper to try it after some delay
   638  * CDelayMailboxCreationHelper to try it after some delay
   615  */
   639  */
   616 void CPsMruAdapter::DeleayMailboxCreationEventL( TFSMailMsgId &aMailbox )
   640 void CPsMruAdapter::DeleayMailboxCreationEventL( TFSMailMsgId &aMailbox )
   617     {
   641     {
   618     FUNC_LOG;	
   642     FUNC_LOG;   
   619     if ( NULL == iDelayMailboxCreationPtr )
   643     if ( NULL == iDelayMailboxCreationPtr )
   620         {
   644         {
   621         iDelayMailboxCreationPtr = CDelayMailboxCreationHelper::NewL( this );
   645         iDelayMailboxCreationPtr = CDelayMailboxCreationHelper::NewL( this );
   622         }
   646         }
   623     iDelayedCreatedMailboxes.Append( aMailbox );
   647     iDelayedCreatedMailboxes.Append( aMailbox );
   646     CleanupStack::Pop( self );
   670     CleanupStack::Pop( self );
   647     return self;
   671     return self;
   648     }
   672     }
   649 
   673 
   650 // used by MruAdapter when delayed datasource adding is needed
   674 // used by MruAdapter when delayed datasource adding is needed
   651 void CDelayMailboxCreationHelper::StartDelayedCall()	
   675 void CDelayMailboxCreationHelper::StartDelayedCall()    
   652     {
   676     {
   653     FUNC_LOG;
   677     FUNC_LOG;
   654     if( IsActive() )  // don't call again in case the timer rq is pending
   678     if( IsActive() )  // don't call again in case the timer rq is pending
   655         {
   679         {
   656         Cancel();
   680         Cancel();