mobilemessaging/unieditor/application/inc/UniEditorSaveOperation.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2006,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:   CUniEditorSaveOperation, asynchronous operation for object saving     
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef __UNIEDITORSAVEOPERATION_H
       
    21 #define __UNIEDITORSAVEOPERATION_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "UniMsvEntry.h"
       
    25 #include "UniEditorOperation.h"
       
    26 #include "UniEditorDocument.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // FORWARD DECLARATIONS
       
    33 
       
    34 class CMDXMLDocument;
       
    35 class CUniEditorHeader;
       
    36 class CMsgEditorView;
       
    37 
       
    38 // DATA TYPES
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 
       
    42 // CLASS DECLARATION
       
    43 
       
    44 /**
       
    45 * CUniEditorSaveOperation, Storage for single attachment in presentation. 
       
    46 *
       
    47 * @since 3.2
       
    48 */
       
    49 class CUniEditorSaveOperation : public CUniEditorOperation,
       
    50                                 public MUniObjectSaveObserver,
       
    51                                 public MUniSmilComposeObserver
       
    52     {
       
    53     public:  // New methods
       
    54 
       
    55         /**
       
    56         * Factory method that creates this object.
       
    57         *
       
    58         * @since    3.1
       
    59         * @param    aObserver
       
    60         * @return   Pointer to instance in cleanup stack
       
    61         */
       
    62         static CUniEditorSaveOperation* NewL(
       
    63             MUniEditorOperationObserver& aObserver,
       
    64             CUniEditorDocument& aDocument,
       
    65             CUniEditorHeader& aHeader,
       
    66             CMsgEditorView& aView,
       
    67             RFs& aFs );
       
    68 
       
    69         /**
       
    70         * Destructor
       
    71         */
       
    72         virtual ~CUniEditorSaveOperation();
       
    73 
       
    74         /**
       
    75         * Starts save operation
       
    76         */
       
    77         void Save( TUniSaveType aSaveType );
       
    78         
       
    79         /**
       
    80         * Start single object's save operation
       
    81         */
       
    82         void SaveL( CUniObject& aObject );
       
    83         
       
    84         /**
       
    85         * Detaches DOM object.
       
    86         */
       
    87         inline CMDXMLDocument* DetachDom();
       
    88 
       
    89     protected:
       
    90 
       
    91         /**
       
    92         * From CActive
       
    93         */
       
    94         void RunL();
       
    95 
       
    96         /**
       
    97         * From CActive
       
    98         */
       
    99        TInt RunError( TInt aError );
       
   100         /**
       
   101         * From MUniObjectSaveObserver
       
   102         */
       
   103         void ObjectSaveReady( TInt aError );
       
   104 
       
   105         /**
       
   106         * From MUniSmilComposeObserve
       
   107         */
       
   108         void SmilComposeEvent( TInt aError );
       
   109         
       
   110         /**
       
   111         * From CUniEditorOperation
       
   112         */
       
   113         void DoCancelCleanup();
       
   114         
       
   115     private:
       
   116 
       
   117         /**
       
   118         * Constructor.
       
   119         *
       
   120         * @since    3.1
       
   121         */
       
   122         CUniEditorSaveOperation( MUniEditorOperationObserver& aObserver,
       
   123                                  CUniEditorDocument& aDocument,
       
   124                                  CUniEditorHeader& aHeader,
       
   125                                  CMsgEditorView& aView,
       
   126                                  RFs& aFs );
       
   127 
       
   128         /**
       
   129         * 2nd phase constructor.
       
   130         *
       
   131         * @since    3.1
       
   132         */
       
   133         void ConstructL();
       
   134 
       
   135         /**
       
   136         * Performs save step
       
   137         */
       
   138         void DoSaveStepL();
       
   139 
       
   140         /**
       
   141         * Performs save checks
       
   142         */
       
   143         void DoSaveChecksL();
       
   144 
       
   145         /**
       
   146         * Saves object.
       
   147         */
       
   148         void DoSaveObjectL();
       
   149 
       
   150         /**
       
   151         * Saves attachments
       
   152         */
       
   153         void DoSaveAttachments();
       
   154 
       
   155         /** 
       
   156         * Composes SMIL
       
   157         */
       
   158         void DoComposeSmilL();
       
   159 
       
   160         /**
       
   161         * Finalizes save operation
       
   162         */
       
   163         void DoFinalizeSaveL();
       
   164 
       
   165         /**
       
   166         * Saves plugins
       
   167         */
       
   168         void DoSavePluginsL();
       
   169 
       
   170         /**
       
   171         * Checks disk space.
       
   172         */
       
   173         TBool CheckDiskSpaceL();
       
   174 
       
   175         /**
       
   176         * Creates description.
       
   177         *
       
   178         * @return Pointer to description buffer. NULL if description should not be updated.
       
   179         */
       
   180         HBufC* CreateDescriptionL();
       
   181 
       
   182         /**
       
   183         * Return ETrue if forward message, otherwise EFalse.
       
   184         */
       
   185         inline TBool IsForward() const;
       
   186 
       
   187     protected: // data
       
   188 
       
   189         // assigned to iOperationState
       
   190         enum TUniEditorSaveState
       
   191             {
       
   192             EUniEditorSaveCheck,
       
   193             EUniEditorSaveObjects,
       
   194             EUniEditorSaveAttachment,
       
   195             EUniEditorSaveSmilCompose,
       
   196             EUniEditorSaveFinalize,
       
   197             EUniEditorSavePlugins,
       
   198             EUniEditorSaveEnd,
       
   199             EUniEditorSaveError
       
   200             };
       
   201 
       
   202         CUniEditorHeader& iHeader;
       
   203         CMsgEditorView& iView;
       
   204 
       
   205         CMDXMLDocument* iDom;
       
   206 
       
   207         TUint32 iMaxMessageSize;
       
   208         TUniSaveType iSaveType;
       
   209         TBool iComposeSmil;
       
   210         
       
   211         CUniObject* iSavedObject;
       
   212         
       
   213         CMsvStore* iEditStore;
       
   214 
       
   215     };
       
   216 
       
   217 #include "UniEditorSaveOperation.inl"
       
   218 
       
   219 #endif // __MMSEDITORSAVEOPERATION_H