email/imum/Mtms/Inc/ImumDeleteMessagesFromServer.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     Deletes messages first locally and then from server.
       
    16 *
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #ifndef __CIMUMDELETEMESSAGESFROMSERVER_H__
       
    22 #define __CIMUMDELETEMESSAGESFROMSERVER_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <ImumInternalApi.h>            // CImumInternalApi
       
    26 #include <MsvPrgReporter.h>     // MMsvProgressDecoder
       
    27 #include "IMAPPRGR.H"           // TImap4UiProgressBuf
       
    28 
       
    29 // CONSTANTS
       
    30 // MACROS
       
    31 // DATA TYPES
       
    32 // FUNCTION PROTOTYPES
       
    33 // FORWARD DECLARATIONS
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37 * class CImumDeleteMessagesFromServer
       
    38 * Encapsulates delete locally operation and delete from server operation.
       
    39 * First deletes message locally and after it has been completed, deletes from the server
       
    40 * Decodes its own progress.
       
    41 */
       
    42 class CImumDeleteMessagesFromServer :
       
    43     public CMsvOperation,
       
    44     public MMsvProgressDecoder
       
    45     {
       
    46     public:
       
    47         /**
       
    48         * Constructor.
       
    49         */
       
    50         static CImumDeleteMessagesFromServer* NewL(
       
    51             CImumInternalApi& aMailboxApi,
       
    52             TRequestStatus& aObserverRequestStatus,
       
    53             CMsvEntrySelection& aDeletedEntries );
       
    54         /**
       
    55         * Destructor.
       
    56         */
       
    57         virtual ~CImumDeleteMessagesFromServer();
       
    58         /**
       
    59         *
       
    60         */
       
    61         virtual const TDesC8& ProgressL();
       
    62 
       
    63         /**
       
    64         * From MMsvProgressDecoder
       
    65         */
       
    66         virtual TInt DecodeProgress (
       
    67             const TDesC8& aProgress,
       
    68             TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
    69             TInt& aTotalEntryCount,
       
    70             TInt& aEntriesDone,
       
    71             TInt& aCurrentEntrySize,
       
    72             TInt& aCurrentBytesTrans,
       
    73             TBool aInternal );
       
    74 
       
    75     private:
       
    76         enum ImumDeleteMessagesState {
       
    77             EImumDeletingMessagesStateLocally = 0,
       
    78             EImumDeletingMessagesStateFromServer
       
    79             };
       
    80 
       
    81         /**
       
    82         * Constructor.
       
    83         */
       
    84         CImumDeleteMessagesFromServer(
       
    85             CImumInternalApi& aMailboxApi,
       
    86             TRequestStatus& aObserverRequestStatus );
       
    87 
       
    88         /**
       
    89         * Constructor.
       
    90         */
       
    91         void ConstructL( CMsvEntrySelection& aDeletedEntries );
       
    92         /**
       
    93         * From CActive
       
    94         */
       
    95         void DoCancel();
       
    96         /**
       
    97         * From CActive
       
    98         */
       
    99         void RunL();
       
   100 
       
   101         /**
       
   102         * Starts new local delete progress
       
   103         */
       
   104         void StartNextDeleteLocally();
       
   105 
       
   106         /**
       
   107         * Creates object of CImumDeleteMessagesLocally
       
   108         */
       
   109         void MakeNextDeleteLocallyL();
       
   110 
       
   111         /**
       
   112         * Starts entry delete after local delete is completed.
       
   113         */
       
   114         void StartDeleteFromServer();
       
   115 
       
   116         /**
       
   117         * Creates delete operation
       
   118         */
       
   119         void MakeDeleteFromServerL();
       
   120 
       
   121     private:
       
   122         CImumInternalApi&       iMailboxApi;
       
   123         CMsvOperation*          iOperation;
       
   124         CMsvEntry*              iEntry;
       
   125         CMsvEntrySelection*     iEntrySelection; // includes entries to be deleted
       
   126         TInt                    iEntryCount;
       
   127         TBuf8<1>                iBlank;
       
   128         HBufC*                  iProgressText;
       
   129         ImumDeleteMessagesState iState;
       
   130         TImap4UiProgressBuf     iUiProgress;
       
   131         TBool                   iDeleteProgress;
       
   132         // File Session
       
   133         RFs                     iFileSession;
       
   134         // Currently active drive
       
   135         TInt                    iDriveNo;
       
   136     };
       
   137 
       
   138 
       
   139 #endif      // __CIMUMDELETEMESSAGESFROMSERVER_H__
       
   140 
       
   141 // End of File