messagingappbase/mcesettings/src/MceSettingsEmailSel.cpp
branchRCL_3
changeset 24 e00582ce7ecd
parent 22 52d61119153d
equal deleted inserted replaced
22:52d61119153d 24:e00582ce7ecd
   104     
   104     
   105     if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) )
   105     if ( FeatureManager::FeatureSupported( KFeatureIdFfEmailFramework ) )
   106     {
   106     {
   107       iEmailFramework = ETrue;
   107       iEmailFramework = ETrue;
   108     } 
   108     } 
       
   109     iCmaillistItems = NULL;
       
   110     iCmailBoxes = NULL;
       
   111     iCmaillistItemUids = NULL;
   109     }
   112     }
   110     
   113     
   111 // ---------------------------------------------------------
   114 // ---------------------------------------------------------
   112 // CMceSettingsEmailSel::CMceSettingsEmailSel
   115 // CMceSettingsEmailSel::CMceSettingsEmailSel
   113 // contructor
   116 // contructor
   126 CMceSettingsEmailSel::~CMceSettingsEmailSel()
   129 CMceSettingsEmailSel::~CMceSettingsEmailSel()
   127     {
   130     {
   128     if( iMtmStore )
   131     if( iMtmStore )
   129     	{
   132     	{
   130     	delete iMtmStore;
   133     	delete iMtmStore;
       
   134     	iMtmStore = NULL;
   131     	}     
   135     	}     
   132     if( iMsvSessionPtr )
   136     if( iMsvSessionPtr )
   133     	{
   137     	{
   134     	delete iMsvSessionPtr;
   138     	delete iMsvSessionPtr;
       
   139     	iMsvSessionPtr = NULL;
   135     	}  	  
   140     	}  	  
   136     UnLoadResource();    	 	
   141     UnLoadResource();    	 	
       
   142     if(iCmaillistItemUids)
       
   143         {
       
   144         delete iCmaillistItemUids;
       
   145         iCmaillistItemUids  = NULL;
       
   146         }
       
   147     if(iCmailBoxes)
       
   148         {
       
   149         iCmailBoxes->Close();
       
   150         delete iCmailBoxes;
       
   151         iCmailBoxes  = NULL;
       
   152         }
       
   153     if(iCmaillistItems)
       
   154         {
       
   155         delete iCmaillistItems;
       
   156         iCmaillistItems = NULL;
       
   157         }
   137     }    
   158     }    
   138 
   159 
   139 // ---------------------------------------------------------
   160 // ---------------------------------------------------------
   140 // CMceSettingsEmailSel::LoadResourceL
   161 // CMceSettingsEmailSel::LoadResourceL
   141 // Load the resource for the dll module
   162 // Load the resource for the dll module
   362             User::LeaveIfError( iMsvSessionPtr->GetEntry(
   383             User::LeaveIfError( iMsvSessionPtr->GetEntry(
   363                     aSelectedService, serviceId, entry ) );
   384                     aSelectedService, serviceId, entry ) );
   364             aMtmType = entry.iMtm;
   385             aMtmType = entry.iMtm;
   365             }
   386             }
   366         }
   387         }
   367     delete iCmaillistItemUids;
   388     if(iCmaillistItemUids)
   368     iCmaillistItemUids  = NULL;
   389         {
   369     delete iCmaillistItems;
   390     	delete iCmaillistItemUids;
   370     iCmaillistItems = NULL;;
   391         iCmaillistItemUids  = NULL;
       
   392         }
       
   393     if(iCmaillistItems)
       
   394         {
       
   395    		delete iCmaillistItems;
       
   396         iCmaillistItems = NULL;
       
   397         }
   371     CleanupStack::PopAndDestroy( aListItemUids );
   398     CleanupStack::PopAndDestroy( aListItemUids );
   372     CleanupStack::PopAndDestroy( aListItems );
   399     CleanupStack::PopAndDestroy( aListItems );
   373     if(cancel)
   400     if(cancel)
   374         return EFalse;
   401         return EFalse;
   375     else
   402     else
   619     //Sort the cmail Entry items based on time
   646     //Sort the cmail Entry items based on time
   620     TKeyArrayFix key( 0, ECmpTInt64 );
   647     TKeyArrayFix key( 0, ECmpTInt64 );
   621     atimeItems->Sort(key);
   648     atimeItems->Sort(key);
   622     TUid cmailEntryUid;
   649     TUid cmailEntryUid;
   623     
   650     
       
   651     if(iCmaillistItems)
       
   652         {
       
   653         delete iCmaillistItems;
       
   654         iCmaillistItems = NULL;
       
   655         }   
   624     //Array to get the list of Cmail Boxes
   656     //Array to get the list of Cmail Boxes
   625     iCmaillistItems = new (ELeave) CDesCArrayFlat(
   657     iCmaillistItems = new (ELeave) CDesCArrayFlat(
   626                                 KArrayGranularity );
   658                                 KArrayGranularity );
   627     
   659     
   628     iCmaillistItemUids = new ( ELeave ) CArrayFixFlat<TUid>( KArrayGranularity );
   660     if(iCmaillistItemUids)
   629     
   661         {
       
   662         delete iCmaillistItemUids;
       
   663         iCmaillistItemUids = NULL;
       
   664         }
       
   665     iCmaillistItemUids = new ( ELeave ) 
       
   666             CArrayFixFlat<TUid>( KArrayGranularity );
       
   667    
   630     // Go one by one in Hash table
   668     // Go one by one in Hash table
   631     if(atimeItems->Count() > 0)
   669     if(atimeItems->Count() > 0)
   632         {    
   670         {    
   633         for(TInt cnt = (atimeItems->Count() - 1) ; cnt >= 0 ; cnt--)
   671         for(TInt cnt = (atimeItems->Count() - 1) ; cnt >= 0 ; cnt--)
   634             {
   672             {
   657     TTime timeNow;
   695     TTime timeNow;
   658     
   696     
   659     if(iEmailFramework)
   697     if(iEmailFramework)
   660         {
   698         {
   661         //Added for Cmail Details
   699         //Added for Cmail Details
       
   700         if(iCmailBoxes)
       
   701            {
       
   702            iCmailBoxes->Close();
       
   703            delete iCmailBoxes;
       
   704            iCmailBoxes  = NULL;
       
   705            }
   662         iCmailBoxes =
   706         iCmailBoxes =
   663               new( ELeave )RHashMap< TInt64, TInt >
   707               new( ELeave )RHashMap< TInt64, TInt >
   664                       (&TPtrC8Hash , &TInt64Ident);    
   708                       (&TPtrC8Hash , &TInt64Ident);    
   665         
   709         
   666         // This array is used to map user selection to correct service.
   710         // This array is used to map user selection to correct service.
   752       if(iEmailFramework)
   796       if(iEmailFramework)
   753           {
   797           {
   754           AppendCmailBoxesL(timeItems, aEntry);
   798           AppendCmailBoxesL(timeItems, aEntry);
   755           CleanupStack::PopAndDestroy( cmaillist );
   799           CleanupStack::PopAndDestroy( cmaillist );
   756           CleanupStack::PopAndDestroy( timeItems );
   800           CleanupStack::PopAndDestroy( timeItems );
   757           delete iCmailBoxes;
   801           if(iCmailBoxes)
   758           iCmailBoxes = NULL;
   802               {
       
   803               iCmailBoxes->Close();
       
   804               delete iCmailBoxes;
       
   805               iCmailBoxes = NULL;
       
   806               }
   759           }
   807           }
   760       }
   808       }
   761 
   809 
   762 // ---------------------------------------------------------
   810 // ---------------------------------------------------------
   763 // CMceSettingsEmailSel::IfMailBoxAlreadyAdded
   811 // CMceSettingsEmailSel::IfMailBoxAlreadyAdded