email/imum/Mtms/Inc/SelectionOperationBase.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     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 *       Base class for operations which perform the same function on
       
    16 *       all entries of a CMsvEntrySelection
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef __SELECTIONOPERATIONBASE_H__
       
    21 #define __SELECTIONOPERATIONBASE_H__
       
    22 
       
    23 #include <msvapi.h>
       
    24 
       
    25 //  Forward declarations
       
    26 class CMsvEntrySelection;
       
    27 class CMsvEntry;
       
    28 
       
    29 /**
       
    30 * CSelectionOperationBase
       
    31 * Base class for operations which perform the same function on
       
    32 * all entries of a CMsvEntrySelection
       
    33 */
       
    34 class CSelectionOperationBase : public CMsvOperation
       
    35     {
       
    36     public:
       
    37 
       
    38         /**
       
    39         *
       
    40         */
       
    41         CSelectionOperationBase(
       
    42             CImumInternalApi& aMailboxApi,
       
    43             TInt aPriority,
       
    44             TRequestStatus& aObserverRequestStatus,
       
    45             CMsvEntrySelection* aEntrySelection );
       
    46 
       
    47         /**
       
    48         *
       
    49         */
       
    50         CSelectionOperationBase();
       
    51 
       
    52         /**
       
    53         *
       
    54         */
       
    55         inline void SetSelectionOwnershipExternal( TBool aExternalOwnership );
       
    56         /**
       
    57         *
       
    58         */
       
    59         inline TBool SelectionOwnershipExternal() const;
       
    60 
       
    61         /**
       
    62         *
       
    63         */
       
    64         inline TInt NumItems() const;
       
    65 
       
    66         /**
       
    67         *
       
    68         */
       
    69         inline TInt CurrentItemIndex() const;
       
    70 
       
    71         /**
       
    72         * Should be called in ConstructL of derived class
       
    73         * before SetActive();
       
    74         */
       
    75         void StartL();
       
    76 
       
    77     protected:
       
    78         /**
       
    79         * Destructor
       
    80         */
       
    81         ~CSelectionOperationBase();
       
    82 
       
    83         /**
       
    84         *
       
    85         */
       
    86         void Complete(TInt aCompletionCode);
       
    87 
       
    88         /**
       
    89         * From CActive
       
    90         */
       
    91         virtual void DoCancel();
       
    92 
       
    93     private:
       
    94         /**
       
    95         * From CActive
       
    96         */
       
    97         virtual void RunL();
       
    98 
       
    99         /**
       
   100         * From CActive
       
   101         */
       
   102         void DoRunL();
       
   103 
       
   104         /**
       
   105         * From CActive
       
   106         */
       
   107 		virtual TInt RunError(TInt aError);                       
       
   108 
       
   109         /**
       
   110         *
       
   111         */
       
   112         virtual CMsvOperation* CreateOperationL( TMsvId aMsvId )=0;
       
   113 
       
   114         /**
       
   115         *
       
   116         */
       
   117         virtual TBool StopOnError( TInt aErrorCode )=0;
       
   118 
       
   119         /**
       
   120         * Called if DoRunL leaves.
       
   121         */
       
   122         virtual void OpRunError( TInt aErrorCode ) = 0;
       
   123         /**
       
   124         * Get error from progress buffer.
       
   125         */
       
   126         virtual TInt CheckForError(const TDesC8& aProgress)=0;
       
   127 
       
   128     protected:
       
   129         CMsvOperation* iOperation;
       
   130     private:
       
   131         CMsvEntrySelection* iEntrySelection;
       
   132         TInt iCurrentEntryIndex;
       
   133         TBool iSelectionOwnershipExternal;
       
   134     };
       
   135 
       
   136 #include "SelectionOperationBase.inl"
       
   137 
       
   138 #endif //__SELECTIONOPERATIONBASE_H__