mobilemessaging/audiomsg/inc/audiomessageinsertoperation.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2005-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:   Class that handles insert operations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __AUDIOMESSAGEINSERTOPERATION_H
       
    22 #define __AUDIOMESSAGEINSERTOPERATION_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <msvapi.h>
       
    26 
       
    27 #include <MsgEditorView.h>
       
    28 #include "audiomessageoperation.h"
       
    29 
       
    30 class CMsgMediaInfo;
       
    31 class CAudioMessageRecorder;
       
    32 
       
    33 // ========== CLASS DECLARATION ============================
       
    34 
       
    35 /**
       
    36  * insert class
       
    37  *
       
    38  * @lib AudioMessage.exe
       
    39  * @since S60 v3.1
       
    40  */
       
    41 class CAudioMessageInsertOperation : public CAudioMessageOperation
       
    42     {
       
    43     protected:
       
    44 	    enum TAmsInsertState
       
    45 		    {
       
    46 		    EAmsInit,
       
    47 		    EAmsCheckAttas,
       
    48 		    EAmsSetAudio,
       
    49 		    EAmsSetDuration,
       
    50 		    EAmsInsertSmil,
       
    51 		    EAmsCommit,
       
    52 		    EAmsRemoveAudio,
       
    53 		    EAmsRemoveSmil,
       
    54 		    EAmsInsertReady
       
    55 		    };
       
    56 
       
    57     public: // new operations
       
    58 
       
    59         /**
       
    60        	 * Factory method that creates this object.
       
    61          * @param aOperationObserver
       
    62          * @param aDocument
       
    63          * @param aView
       
    64          */
       
    65        	static CAudioMessageInsertOperation* NewL( 
       
    66             MAmsOperationObserver& aOperationObserver,
       
    67             CAudioMessageDocument& aDocument,
       
    68             CMsgEditorView& aView );
       
    69 
       
    70         /**
       
    71          * Initializes the iState,then completes
       
    72          * @param aInfo Media type to be checked
       
    73          * @param aVal, delete/insert
       
    74          */        
       
    75         void Insert( CMsgMediaInfo* aInfo, TBool aVal, TBool aNew = ETrue );
       
    76 
       
    77         /**
       
    78          * Destructor
       
    79          */
       
    80        	~CAudioMessageInsertOperation();
       
    81        
       
    82         /**
       
    83         * Removes old audio.
       
    84         */
       
    85 		void DoRemoveAudioL( );
       
    86         
       
    87         /**
       
    88         * Removes old audio.
       
    89         */
       
    90 		void DoRemoveSmilL();
       
    91 		
       
    92 	// From CActive	
       
    93     protected:
       
    94         void RunL();
       
    95         void DoCancel();
       
    96 
       
    97     private: // new operations
       
    98         /**
       
    99          * Constructor.
       
   100          */
       
   101         CAudioMessageInsertOperation( MAmsOperationObserver& aOperationObserver,
       
   102         	CAudioMessageDocument& aDocument,
       
   103         	CMsgEditorView& aView );
       
   104 
       
   105         
       
   106         /**
       
   107          * Called in RunL to do the actual state transition 
       
   108          */
       
   109         void  DoInsertStepL();
       
   110         
       
   111         /**
       
   112          * Removes possible old audio.
       
   113          * Starts creating new attachment
       
   114          */
       
   115    		void DoCreateNewAudioAttaL();
       
   116 
       
   117        	/**
       
   118          * size limit check.
       
   119          * @return ETrue if size is ok
       
   120          */
       
   121         TBool CheckSizeForInsert();
       
   122         
       
   123         /*
       
   124         * Set the duration of the clip to the SMIL
       
   125         */
       
   126         void DoSetDurationL( );
       
   127 
       
   128     private: // data
       
   129 
       
   130         CMsgEditorView& iView;
       
   131         
       
   132         /**
       
   133          * media info
       
   134          * Own.  
       
   135 		 */
       
   136         CMsgMediaInfo*  iInfo;
       
   137 
       
   138         /**
       
   139          * current insertion/deletion state
       
   140 		 */
       
   141         TInt iState;
       
   142         
       
   143         /**
       
   144          * Pointer to the created file
       
   145          * Not own.  
       
   146 		 */
       
   147         RFile* iEditFile;  
       
   148         
       
   149         //TFileName iFileName;
       
   150         //TFileName iContentLocationFileName;
       
   151         
       
   152         /**
       
   153          * remove bit
       
   154 		 */
       
   155         TBool iRemove;
       
   156         TBool iNew;
       
   157     };
       
   158 
       
   159 #endif // __AUDIOMESSAGEINSERTOPERATION_H