emailservices/psmruadapter/src/CPsMruAdapter.cpp
branchRCL_3
changeset 52 efd4f1afd43e
parent 29 6b8f3b30d0ec
child 60 d620048b4810
equal deleted inserted replaced
29:6b8f3b30d0ec 52:efd4f1afd43e
   284     FUNC_LOG;	
   284     FUNC_LOG;	
   285     TBool result = EFalse;
   285     TBool result = EFalse;
   286 // code was simplified not to trace all mailboxes
   286 // code was simplified not to trace all mailboxes
   287 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
   287 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
   288 // should not leave when new mailbox only when new mail address
   288 // should not leave when new mailbox only when new mail address
   289     CFSMailBox *mailBox = iMailClient->GetMailBoxByUidL(aId);
   289     CFSMailBox *mailBox = iMailClient->GetMailBoxByUidLC(aId);
   290     if ( mailBox )
   290     if( mailBox )
   291         {
   291         {
   292         CleanupStack::PushL( mailBox );
       
   293         AddMailboxObserverL( aId );
   292         AddMailboxObserverL( aId );
   294         
   293         
   295         // Get MRU list for this mailbox
   294         // Get MRU list for this mailbox
   296         MDesCArray* mruList = mailBox->ListMrusL();
   295         MDesCArray* mruList = mailBox->ListMrusL();
   297         CleanupStack::PopAndDestroy( mailBox );
       
   298         
   296         
   299         // update the caching status as InProgress
   297         // update the caching status as InProgress
   300         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
   298         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
   301                 ECachingInProgress );
   299                 ECachingInProgress );
   302 
   300 
   317             {  
   315             {  
   318             User::Leave(trap_err);       
   316             User::Leave(trap_err);       
   319             }
   317             }
   320         result = ETrue;
   318         result = ETrue;
   321         }   // if (mailBox)
   319         }   // if (mailBox)
       
   320     CleanupStack::PopAndDestroy( mailBox );
   322     return result;
   321     return result;
   323     }
   322     }
   324 
   323 
   325 // ----------------------------------------------------------------------------
   324 // ----------------------------------------------------------------------------
   326 // CPsContactDataAdapter::IsDataStoresSupportedL
   325 // CPsContactDataAdapter::IsDataStoresSupportedL
   450             TRAPD(trap_err, mailboxPtr = iMailClient->GetMailBoxByUidL( aMailbox ));
   449             TRAPD(trap_err, mailboxPtr = iMailClient->GetMailBoxByUidL( aMailbox ));
   451             if ( trap_err != KErrNone )
   450             if ( trap_err != KErrNone )
   452                 {
   451                 {
   453                 mailboxPtr = NULL;
   452                 mailboxPtr = NULL;
   454                 }
   453                 }
   455             if (NULL == mailboxPtr) // mailbox still does not exist 
   454             if( mailboxPtr ) 
   456                 {
   455                 {
       
   456                 delete mailboxPtr;
       
   457                 mailboxPtr = NULL;
       
   458                 }
       
   459             else
       
   460                 {
       
   461                 // mailbox still does not exist
   457                 DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation	
   462                 DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation	
   458                 break;
   463                 break;
   459                 }
   464                 }
   460             mailboxPtr = NULL;
   465             
   461             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   466             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   462             if ( GetUriFromMailboxIdentifier( aMailbox, *identifier ) )
   467             if ( GetUriFromMailboxIdentifier( aMailbox, *identifier ) )
   463                 {
   468                 {
   464                 // Add to supported Uri list
   469                 // Add to supported Uri list
   465                 iSupportedUris.AppendL( identifier );
   470                 iSupportedUris.AppendL( identifier );
   570             {
   575             {
   571             mailboxPtr = NULL;
   576             mailboxPtr = NULL;
   572             }
   577             }
   573         if ( mailboxPtr ) 
   578         if ( mailboxPtr ) 
   574             {
   579             {
       
   580             delete mailboxPtr;
       
   581             mailboxPtr = NULL;
       
   582             
   575             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   583             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
   576             if ( GetUriFromMailboxIdentifier( iDelayedCreatedMailboxes[i], *identifier ) )
   584             if ( GetUriFromMailboxIdentifier( iDelayedCreatedMailboxes[i], *identifier ) )
   577                 {
   585                 {
   578 
   586 
   579                 // Add to supported Uri list
   587                 // Add to supported Uri list