email/mail/EditorSrc/cmsgmaillaunchop.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 mail editor view launching.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMSGMAILLAUNCHOP_H
       
    21 #define CMSGMAILLAUNCHOP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "cmsgmailbaseop.h"
       
    25 
       
    26 // DATA TYPES
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CRichText;
       
    30 class MMsgMailAppUiOpDelegate;
       
    31 class CMsgMailRestoreSuperOp;
       
    32 
       
    33 // CLASS DECLARATION
       
    34 /**
       
    35 * State machine -based operation for mail editor view launching.
       
    36 * Operation consists e.g. of initialization, restoring body and
       
    37 * attachments, executing view and finalizing operation. This operation
       
    38 * needs to delegate some of its tasks to Editor App UI.
       
    39 */
       
    40 NONSHARABLE_CLASS( CMsgMailLaunchOp ) : public CMsgMailBaseOp
       
    41     {
       
    42     protected:
       
    43     
       
    44         enum TLaunchState
       
    45             {
       
    46             EInitLaunch = EFirstFreeState, // initialization
       
    47             ERestoreBody, // restore message body
       
    48             EConvertLineBreaks, // convert body line breaks            
       
    49             ERestoreAllAttas, // restore attachments and atta msgs
       
    50             EExecuteView, // execute editor view
       
    51             EFinalize // finalize operation
       
    52             };
       
    53     
       
    54     public:  // Constructors and destructor
       
    55     
       
    56         /**
       
    57         * Two-phased constructor.
       
    58         * @param aDocument Editor's document
       
    59         * @param aOpDelegate interface for delegating some tasks to app ui
       
    60         */
       
    61         static CMsgMailLaunchOp* NewL(
       
    62             CMsgMailEditorDocument& aDocument,
       
    63             MMsgMailAppUiOpDelegate& aOpDelegate );
       
    64 
       
    65         /**
       
    66         * Destructor. Cancels operation.
       
    67         */
       
    68         virtual ~CMsgMailLaunchOp();
       
    69 
       
    70     protected: // from CMsgMailBaseOp
       
    71     
       
    72         void SetNextState();
       
    73         
       
    74         void HandleStateActionL();
       
    75         
       
    76         void HandleOperationCancel();
       
    77         
       
    78     private:  // Implementation
       
    79         
       
    80         void InitLaunchL();
       
    81         
       
    82         void RestoreBodyL();
       
    83         
       
    84         void ConvertLineBreaksL();
       
    85         
       
    86         void RestoreAllAttasL();
       
    87 
       
    88         void ExecuteViewL();
       
    89         
       
    90         void FinalizeL();
       
    91         
       
    92         void ConvertLineBreaksL( CRichText& aRtf ) const;
       
    93 
       
    94     private:
       
    95     
       
    96         /**
       
    97         * Constructor.
       
    98         * @param aDocument Editor's document
       
    99         * @param aOpDelegate interface for delegating some tasks to app ui        
       
   100         */
       
   101         CMsgMailLaunchOp( CMsgMailEditorDocument& aDocument,
       
   102                           MMsgMailAppUiOpDelegate& aOpDelegate );
       
   103 
       
   104         /**
       
   105         * By default Symbian 2nd phase constructor is private.
       
   106         */
       
   107         void ConstructL();
       
   108         
       
   109     private:
       
   110     
       
   111         // Body text, valid after initialization phase, not own
       
   112         CRichText* iBodyText;
       
   113         
       
   114         // For delegating some unmanageable tasks, not own
       
   115         MMsgMailAppUiOpDelegate& iOpDelegate;
       
   116         
       
   117         // Operation for adding attachments and attached messages
       
   118         CMsgMailRestoreSuperOp* iRestoreSuperOp;
       
   119     };
       
   120 
       
   121 #endif      // CMSGMAILLAUNCHOP_H
       
   122 
       
   123 // End of File