email/imum/Utils/Inc/ImumMboxServiceDeletion.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2007 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:  MsvOperation encapsulating deletion of email service
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_IMUMMBOXSERVICEDELETION_H
       
    20 #define C_IMUMMBOXSERVICEDELETION_H
       
    21 
       
    22 #include <MsvPrgReporter.h>
       
    23 
       
    24 class CImumInternalApiImpl;
       
    25 
       
    26 /**
       
    27 * MsvOperation encapsulating deletion of email service entries.
       
    28 */
       
    29 NONSHARABLE_CLASS( CImumMBoxServiceDeletion ) :
       
    30     public CMsvOperation,
       
    31     public MMsvProgressDecoder
       
    32     {
       
    33     private:
       
    34     
       
    35         /**
       
    36          * 
       
    37          * @param aStatus
       
    38          * @return CMsvOperation*
       
    39          * @since S60 3.2
       
    40          */
       
    41         CMsvOperation* GetPreCreatedMailDeletionOpL( TRequestStatus& aStatus );
       
    42         
       
    43         /**
       
    44          * Sets the mailbox name into the iProgressString
       
    45          * @param aServiceId
       
    46          * @since S60 3.2
       
    47          */
       
    48         void SetProgressStringL( TMsvId aServiceId );
       
    49         
       
    50     public:
       
    51         /**
       
    52         *
       
    53         * @param aMsvSession
       
    54         * @param aObserverRequestStatus
       
    55         * @param aReporter
       
    56         * @param aServiceId
       
    57         * @return CImumMBoxServiceDeletion*
       
    58         * @since S60 3.2
       
    59         */
       
    60         IMPORT_C static CImumMBoxServiceDeletion* NewL(
       
    61             CMsvSession& aMsvSession,
       
    62             TRequestStatus& aObserverRequestStatus,
       
    63             MMsvProgressReporter& aReporter,
       
    64             TMsvId aServiceId );
       
    65 
       
    66         /**
       
    67         * Destructor
       
    68         * @since S60 3.2
       
    69         */
       
    70         ~CImumMBoxServiceDeletion();
       
    71 
       
    72         /**
       
    73         * 
       
    74         * @since S60 3.2
       
    75         */
       
    76         virtual const TDesC8& ProgressL();
       
    77 
       
    78         /**
       
    79         * From MMsvProgressDecoder
       
    80         * @since S60 3.2
       
    81         */
       
    82         virtual TInt DecodeProgress (
       
    83             const TDesC8& aProgress,
       
    84             TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
    85             TInt& aTotalEntryCount,
       
    86             TInt& aEntriesDone,
       
    87             TInt& aCurrentEntrySize,
       
    88             TInt& aCurrentBytesTrans, TBool aInternal );
       
    89 
       
    90 
       
    91     protected:
       
    92     
       
    93         /**
       
    94         * From CActive
       
    95         * @since S60 3.2
       
    96         */
       
    97         virtual void RunL();
       
    98 
       
    99         /**
       
   100         * From CActive
       
   101         * @since S60 3.2
       
   102         */
       
   103         virtual void DoCancel();
       
   104         
       
   105         /**
       
   106         * From CActive
       
   107         * @since S60 3.2
       
   108         */
       
   109 		virtual TInt RunError(TInt aError);               
       
   110 
       
   111     protected:
       
   112     
       
   113         /**
       
   114         * @param aMsvSession
       
   115         * @param aObserverRequestStatus
       
   116         * @param aReporter
       
   117         * @param aServiceId
       
   118         * @since S60 3.2
       
   119         */
       
   120         CImumMBoxServiceDeletion(
       
   121             CMsvSession& aMsvSession,
       
   122             TRequestStatus& aObserverRequestStatus,
       
   123             MMsvProgressReporter& aReporter,
       
   124             TMsvId aServiceId );
       
   125 
       
   126         /**
       
   127         * Second phase Constructor
       
   128         * @since S60 3.2
       
   129         */
       
   130         void ConstructL();
       
   131 
       
   132         /**
       
   133         * Kick off an entry deletion and go active.
       
   134         * @since S60 3.2
       
   135         */
       
   136         void BeginDeleteOperationL();
       
   137 
       
   138         /**
       
   139         * Kick off an operation to remove any
       
   140         * pre-created messages for the SMTP service and go active.
       
   141         * @since S60 3.2
       
   142         */
       
   143         void RemovePreCreatedMessagesL();
       
   144 
       
   145         /**
       
   146         *
       
   147         * @since S60 3.2
       
   148         */
       
   149         void DoRunL();
       
   150 
       
   151         
       
   152         /**
       
   153         * Signals observer that we're done
       
   154         * @since S60 3.2
       
   155         */
       
   156         void CompleteObserver();
       
   157 
       
   158         
       
   159         /**
       
   160         * Removes the account from the Central Repository
       
   161         * @since S60 3.2
       
   162         */
       
   163         void BeginRemoveAccountDeleteOpL();
       
   164         
       
   165         
       
   166         /**
       
   167         * 
       
   168         * @since S60 3.2
       
   169         */
       
   170         void DoRemoveMailboxL();
       
   171         
       
   172     private:
       
   173     	enum TState
       
   174             { EDoPrompts,
       
   175               EDeleteService,
       
   176               EDeletePreCreatedMsgs,
       
   177               EStateComplete };
       
   178               
       
   179         MMsvProgressReporter& 			iReporter;        
       
   180         TState 							iState;
       
   181         CMsvOperation* 					iSubOperation;
       
   182         TBuf8<KMsvProgressBufferLength> iProgressBuf;
       
   183         TMsvId 							iServiceId;
       
   184         TMsvId                          iSMTPServiceId;
       
   185         HBufC* 							iProgressString;
       
   186         TUid                            iMtm;
       
   187         TBool                           iCanProceed;                
       
   188         CImumInternalApiImpl*           iEmailApi;
       
   189     };
       
   190 
       
   191 
       
   192 #endif //C_IMUMMBOXSERVICEDELETION_H