emailservices/emailstore/message_store/server/src/ContainerStoreDeleteHandler.cpp
branchRCL_3
changeset 18 6b8f3b30d0ec
parent 0 8466d47a6819
equal deleted inserted replaced
17:67369d1b217f 18:6b8f3b30d0ec
   113 // ==========================================================================
   113 // ==========================================================================
   114 // FUNCTION: FindContainerToDeleteL
   114 // FUNCTION: FindContainerToDeleteL
   115 // ==========================================================================
   115 // ==========================================================================
   116 void CDeleteHandler::FindContainerToDeleteL()
   116 void CDeleteHandler::FindContainerToDeleteL()
   117     {
   117     {
   118     TBool done = EFalse;
   118     TBool done(EFalse);
   119     
   119     
   120     TContainerId containerId = KToBeDeletedContainers;
   120     TContainerId containerId = KToBeDeletedContainers;
   121     if ( iState == ERetryDelete )
   121     if ( iState == ERetryDelete )
   122         {
   122         {
   123         containerId = KToRetryDeleteContainers;
   123         containerId = KToRetryDeleteContainers;
   161     __LOG_ENTER( "DoNextDeleteL" )
   161     __LOG_ENTER( "DoNextDeleteL" )
   162     
   162     
   163     // Delete the lowest node in the hierarchy.        
   163     // Delete the lowest node in the hierarchy.        
   164     TRAPD( result, FindContainerToDeleteL() );
   164     TRAPD( result, FindContainerToDeleteL() );
   165 
   165 
   166     TBool more = EFalse;    
   166     TBool more ( EFalse );    
   167         
   167         
   168     if( result == KErrNone )
   168     if( result == KErrNone )
   169         {        
   169         {        
   170         if( iStack.Count() > 0 )
   170         if( iStack.Count() > 0 )
   171             {
   171             {
   199 
   199 
   200     if( !more )
   200     if( !more )
   201         {   
   201         {   
   202         if ( iState == ERetryDelete )
   202         if ( iState == ERetryDelete )
   203             {
   203             {
   204             iState = EDelete;
   204             //next state
       
   205             iState = EDeleteFromSortingTable;
       
   206             more = ETrue;
       
   207             }
       
   208         else if(iState == EDeleteFromSortingTable)
       
   209             {
       
   210             //check sorting table for containers that have been marked for deletion
       
   211             if(!iContainerStore.DeleteFromSortingTable())
       
   212                 {
       
   213                 //if nor more then set to next state
       
   214                 iState = EDelete;
       
   215                 }
   205             more = ETrue;
   216             more = ETrue;
   206             }
   217             }
   207         else
   218         else
   208             {
   219             {
   209             iBackgroundOperationsObserver.BackgroundOperationsCompleted();         
   220             iBackgroundOperationsObserver.BackgroundOperationsCompleted();         
   212 
   223 
   213     __LOG_EXIT                    
   224     __LOG_EXIT                    
   214     return more;
   225     return more;
   215     
   226     
   216     } // end DoNextDelete
   227     } // end DoNextDelete
   217 
       
   218 // ==========================================================================
       
   219 // FUNCTION: FinishDeletes
       
   220 // ==========================================================================
       
   221 void CDeleteHandler::FinishDeletes()
       
   222     {
       
   223     if( IsActive() )
       
   224         {
       
   225         Cancel();
       
   226         
       
   227         // Loop until all deletes are done.
       
   228         while( DoNextDelete() )
       
   229             {
       
   230             }        
       
   231         
       
   232         } // end if
       
   233     
       
   234     } // end FinishDeletes