email/imum/Mtms/Inc/ImumOnlineOperation.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 *       Common base class for email online operations
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __IMUMONLINEOPERATION_H__
       
    20 #define __IMUMONLINEOPERATION_H__
       
    21 
       
    22 #include <msvstd.h>
       
    23 #include <msvapi.h>
       
    24 #include <eikenv.h>
       
    25 #include <ImumInternalApi.h>            // CImumInternalApi
       
    26 #include "PROGTYPE.H"
       
    27 
       
    28 class CEikonEnv;
       
    29 class CBaseMtmUi;
       
    30 class CMsvEntrySelection;
       
    31 class MMsvProgressReporter;
       
    32 
       
    33 /**
       
    34 * class CImumOnlineOperation
       
    35 *
       
    36 * Common base class for email online operations.
       
    37 */
       
    38 class CImumOnlineOperation : public CMsvOperation
       
    39     {
       
    40     public:
       
    41         /**
       
    42         *
       
    43         */
       
    44         virtual ~CImumOnlineOperation();
       
    45 
       
    46         /**
       
    47         *
       
    48         */
       
    49         virtual const TDesC8& ProgressL();
       
    50 
       
    51         /**
       
    52         * For reporting if DoRunL leaves
       
    53         */
       
    54         virtual const TDesC8& GetErrorProgressL(TInt aError) = 0;
       
    55 
       
    56     protected:
       
    57         /**
       
    58         * C++ constructor
       
    59         */
       
    60         // Construction.
       
    61         CImumOnlineOperation(
       
    62             CImumInternalApi& aMailboxApi,
       
    63             TInt aPriority,
       
    64             TRequestStatus& aObserverRequestStatus,
       
    65             MMsvProgressReporter& aReporter);
       
    66 
       
    67         /**
       
    68         * Base constructor
       
    69         */
       
    70         void BaseConstructL(TUid aMtmType);
       
    71 
       
    72         /**
       
    73         * From CActive
       
    74         */
       
    75         virtual void DoCancel();
       
    76 
       
    77         /**
       
    78         * From CActive
       
    79         */
       
    80         virtual void RunL();
       
    81 
       
    82         /**
       
    83         * From CActive
       
    84         */
       
    85         virtual void DoRunL() = 0;
       
    86 
       
    87         /**
       
    88         * From CActive
       
    89         */
       
    90         virtual TInt RunError( TInt aError );
       
    91 
       
    92         /**
       
    93         * Completes observer with status aStatus
       
    94         * @param aStatus: Status of the operation.
       
    95         * Override if needed to complete with other status than KErrNone.
       
    96         */
       
    97         void CompleteObserver( TInt aStatus = KErrNone );
       
    98 
       
    99         /**
       
   100         *
       
   101         */
       
   102         void CompleteThis();
       
   103 
       
   104         /**
       
   105         * Sub-operation helpers
       
   106         */
       
   107         TInt GetOperationCompletionCodeL();
       
   108 
       
   109         /**
       
   110         *
       
   111         */
       
   112         void InvokeClientMtmAsyncFunctionL(
       
   113             TInt aFunctionId,
       
   114             TMsvId aEntryId,
       
   115             TMsvId aContextId,
       
   116             const TDesC8& aParams=KNullDesC8);
       
   117 
       
   118         /**
       
   119         *
       
   120         */
       
   121         void InvokeClientMtmAsyncFunctionL(
       
   122             TInt aFunctionId,
       
   123             const CMsvEntrySelection& aSel,
       
   124             TMsvId aContextId,
       
   125             const TDesC8& aParams=KNullDesC8);
       
   126 
       
   127         /**
       
   128         * Progress reporter helpers.
       
   129         */
       
   130         void ReDisplayProgressL(TInt aTitleResourceId, TMsvId aServiceId);
       
   131 
       
   132         /**
       
   133         * Check free space from current drive
       
   134         * This function is used during RunL function, which is run after
       
   135         * a notification comes from fileserver.
       
   136         * @since S60 3.0
       
   137         * @return KErrNone, when everything is fine
       
   138         */
       
   139         virtual TInt DoDiskSpaceCheckL();
       
   140 
       
   141     protected:
       
   142         // Progress reporter mixin.
       
   143         MMsvProgressReporter& iReporter;
       
   144         // Internal API reference
       
   145         CImumInternalApi& iMailboxApi;
       
   146         // MTM UI. (Obtained from iReporter.MtmStore())
       
   147         CBaseMtmUi* iMtmUi;
       
   148         // The sub-operation.
       
   149         CMsvOperation* iOperation;
       
   150         // Status of current operation
       
   151         TInt iError;
       
   152         // Return this if iOperation==NULL.
       
   153         TBuf8<1> iDummyProg;
       
   154         // Uikon env for resource reading.
       
   155         CEikonEnv* iEikEnv;
       
   156     };
       
   157 
       
   158 
       
   159 #endif