email/mail/EditorSrc/cmsgmailsendop.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 sending mail message.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMSGMAILSENDOP_H
       
    21 #define CMSGMAILSENDOP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include "cmsgmailbaseop.h"
       
    25 #include <msvapi.h>
       
    26 #include <muiuflagger.h>                    // CMuiuFlags
       
    27 
       
    28 // DATA TYPES
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CMsgMailPreferences;
       
    32 class MMsgMailAppUiOpDelegate;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 /**
       
    36 * State machine -based operation for sending mail message.
       
    37 * The most important steps are to save and send the message.
       
    38 * Some tasks need to be delegated to Editor App UI.
       
    39 */
       
    40 NONSHARABLE_CLASS( CMsgMailSendOp ) : public CMsgMailBaseOp
       
    41     {
       
    42     protected:
       
    43     
       
    44         enum TSendState
       
    45             {
       
    46             EPrepare = EFirstFreeState, // praparation phase
       
    47             ESaveMessage, // save message
       
    48             ESendMessage, // send message
       
    49             EFinalize // finalize operation
       
    50             };
       
    51     
       
    52     public:  // Constructors and destructor
       
    53     
       
    54         /**
       
    55         * Two-phased constructor.
       
    56         * @param aDocument Editor's document
       
    57         * @param aOpDelegate interface for delegating some tasks to app ui
       
    58         */
       
    59         static CMsgMailSendOp* NewL(
       
    60             CMsgMailEditorDocument& aDocument,
       
    61             MMsgMailAppUiOpDelegate& aOpDelegate );
       
    62 
       
    63         /**
       
    64         * Destructor. Cancels operation.
       
    65         */
       
    66         virtual ~CMsgMailSendOp();
       
    67         
       
    68     protected: // from CMsgMailBaseOp
       
    69     
       
    70         void SetNextState();
       
    71         
       
    72         void HandleStateActionL();
       
    73         
       
    74         void HandleOperationCancel();
       
    75 
       
    76     private:  // Implementation
       
    77         
       
    78         void PrepareL();
       
    79         
       
    80         void SaveMessageL();
       
    81         
       
    82         void SendMessageL();
       
    83         
       
    84         void Finalize();
       
    85 
       
    86         TMsvId SendingBoxL( CMsgMailPreferences& aPrefs ) const;
       
    87         
       
    88         void SetSchedulingOptionsL( CMsgMailPreferences& aPrefs,
       
    89                                     TMsvId aSendingBox ) const;
       
    90                                     
       
    91         TInt WaitNoteTextResourceId() const;
       
    92         
       
    93         TBool CheckOwnAddressL() const;
       
    94         
       
    95         void SendNativeMailL();
       
    96         
       
    97 
       
    98     private:
       
    99     
       
   100         /**
       
   101         * Constructor.        
       
   102         * @param aDocument Editor's document
       
   103         * @param aOpDelegate interface for delegating some tasks to app ui
       
   104         */
       
   105         CMsgMailSendOp( CMsgMailEditorDocument& aDocument,
       
   106                         MMsgMailAppUiOpDelegate& aOpDelegate );
       
   107 
       
   108         /**
       
   109         * By default Symbian 2nd phase constructor is private.
       
   110         */
       
   111         void ConstructL();
       
   112         
       
   113     private:
       
   114     
       
   115         // For delegating some unmanageable tasks, not own
       
   116         MMsgMailAppUiOpDelegate& iOpDelegate;
       
   117         
       
   118         CMuiuFlags*     iFlags;
       
   119     };
       
   120 
       
   121 #endif      // CMSGMAILSENDOP_H
       
   122 
       
   123 // End of File