email/mail/EditorSrc/cmsgmailrestoreattmsgsop.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002-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:  State machine -based operation for restoring attached messages.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMSGMAILRESTOREATTMSGSOP_H
       
    21 #define CMSGMAILRESTOREATTMSGSOP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "cmsgmailbaseop.h"
       
    25 #include <msvapi.h>
       
    26 
       
    27 // DATA TYPES
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * State machine -based operation for restoring attached messages.
       
    34 */
       
    35 NONSHARABLE_CLASS( CMsgMailRestoreAttMsgsOp ) : public CMsgMailBaseOp
       
    36     {
       
    37     protected:
       
    38     
       
    39         enum TLaunchState
       
    40             {
       
    41             EGetMsgDigestEntries = EFirstFreeState, // get msg digest entries
       
    42             EPrepareAddAttMsgs, // preparation step for adding attached msgs
       
    43             EAddAttMsgs // add attached messages
       
    44             };
       
    45     
       
    46     public:  // Constructors and destructor
       
    47     
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         * @param aDocument Editor's document
       
    51         */
       
    52         static CMsgMailRestoreAttMsgsOp* NewL(
       
    53             CMsgMailEditorDocument& aDocument );
       
    54 
       
    55         /**
       
    56         * Destructor. Cancels operation.
       
    57         */
       
    58         ~CMsgMailRestoreAttMsgsOp();
       
    59         
       
    60     public: // API
       
    61     
       
    62         /**
       
    63         * Method for querying the count of all attached messages,
       
    64         * including invalid ones.
       
    65         * To get correct result this method should be called once the
       
    66         * operation has completed.
       
    67         * @return count of all attached messages
       
    68         */        
       
    69         TInt CountAllAttaMsgs() const;
       
    70             
       
    71         /**
       
    72         * Method for querying the count of invalid attached messages.
       
    73         * To get correct result this method should be called once the
       
    74         * operation has completed.
       
    75         * @return count of removed invalid attached messages
       
    76         */        
       
    77         TInt CountInvalidAttaMsgs() const;
       
    78 
       
    79     protected: // from CMsgMailBaseOp
       
    80     
       
    81         void SetNextState();
       
    82         
       
    83         void HandleStateActionL();
       
    84         
       
    85         void HandleOperationCancel();
       
    86         
       
    87         TBool HandleStateActionError( TInt aError );
       
    88         
       
    89     private:  // Implementation
       
    90         
       
    91         void GetMsgDigestEntriesL();
       
    92         
       
    93         void PrepareAddAttMsgsL();
       
    94         
       
    95         void AddAttMsgsL();
       
    96         
       
    97         void DoAddAttMsgL( TInt aIndex ) const;
       
    98 
       
    99     private:
       
   100     
       
   101         /**
       
   102         * Constructor.
       
   103         * @param aDocument Editor's document
       
   104         */
       
   105         CMsgMailRestoreAttMsgsOp( CMsgMailEditorDocument& aDocument );
       
   106 
       
   107         /**
       
   108         * By default Symbian 2nd phase constructor is private.
       
   109         */
       
   110         void ConstructL();
       
   111         
       
   112     private:       
       
   113     
       
   114         // Entries belonging to the current message, not own
       
   115         const CMsvEntrySelection* iEntries;
       
   116         
       
   117         // Index for iterating entry selection
       
   118         TInt iIndex;
       
   119         
       
   120         // Number of all attached messages, including invalid ones
       
   121         TInt iAllAttaMsgCount;
       
   122         
       
   123         // Number of invalid attached messages
       
   124         TInt iInvalidAttaMsgCount;
       
   125     };
       
   126 
       
   127 #endif      // CMSGMAILRESTOREATTMSGSOP_H
       
   128 
       
   129 // End of File