mobilemessaging/audiomsg/inc/audiomessagedocument.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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:   Document class for AudioMessage application
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __AUDIOMESSAGEDOCUMENT_H
       
    22 #define __AUDIOMESSAGEDOCUMENT_H
       
    23 
       
    24 #include <msvapi.h>     
       
    25 #include <MsgEditorDocument.h>
       
    26 #include <mmsmsventry.h>
       
    27 
       
    28 #include "audiomessage.hrh"
       
    29 
       
    30 class CMmsClientMtm;
       
    31 class CBaseMtmUi;
       
    32 class CMsgMediaResolver;
       
    33 
       
    34 // ========== CLASS DECLARATION ============================
       
    35 
       
    36 /**
       
    37  * document class
       
    38  *
       
    39  * @lib AudioMessage.exe
       
    40  * @since S60 v3.1
       
    41  */
       
    42 class CAudioMessageDocument : public CMsgEditorDocument
       
    43     {
       
    44 
       
    45     public:     // New functions
       
    46 
       
    47        /**
       
    48         * Messagetype accessor
       
    49         *
       
    50         * @return Message type
       
    51         */
       
    52         TAmsUiMessageType MessageType() const;
       
    53 
       
    54         /**
       
    55          * C++ constructor
       
    56          *
       
    57          * @param aApp   Reference to application instance
       
    58          */
       
    59         CAudioMessageDocument( CEikApplication& aApp );
       
    60 
       
    61         /**
       
    62          * Factory function to create this object
       
    63          *
       
    64          * @param aApp   Reference to application instance
       
    65          */
       
    66         static CAudioMessageDocument* NewL( CEikApplication& aApp );
       
    67 
       
    68         /**
       
    69          * Destructor.
       
    70          */
       
    71         /*virtual*/ 
       
    72         ~CAudioMessageDocument();
       
    73  		
       
    74  		/**
       
    75 	     * DefaultMsgService
       
    76 	     * From CMsgEditorDocument
       
    77 	     * Returns default message service used by application
       
    78 	     * @return TMsvId KMsvLocalServiceIndexEntryId.
       
    79 	     */
       
    80 	    inline TMsvId DefaultMsgService() const;
       
    81 	       
       
    82 	    /**
       
    83 	     * DefaultMsgFolder
       
    84 	     * Returns default folder for new messages.
       
    85 	     * @return ID of the Drafts folder.
       
    86 	     */
       
    87 	    inline TMsvId DefaultMsgFolder() const;
       
    88 	    
       
    89 	    /**
       
    90 	     * CreateNewL
       
    91 	     * From CMsgEditorDocument
       
    92 	     * Creates new message.
       
    93 	     * A new message of type Postcard is created
       
    94 	     * in a destination folder.
       
    95 	     * Calls CreateNewL(TMsvId aServiceType, TMsvId aDestination,
       
    96 	     *                  TInt aTypeList).
       
    97 	     * @param aService service used for message
       
    98 	     * @param aDestFolder folder in which message will be saved eg.
       
    99 	     *                    KMsvDraftEntryIdValue
       
   100 	     * @return ID of mail operation.
       
   101 	     */
       
   102 	    TMsvId CreateNewL(TMsvId aService, TMsvId aDestFolder);
       
   103 	    
       
   104 	    /**
       
   105 	     * EntryChangedL
       
   106 	     * From CMsgEditorDocument
       
   107 	     * Called after entry is changed by BaseEditor SetEntry Function.
       
   108 	     * From MsgEditorDocument
       
   109 	     */
       
   110 	    void EntryChangedL();
       
   111 
       
   112 	    /**
       
   113 	     * Mtm
       
   114 	     * Accessor (Overrides baseeditor)
       
   115 	     * Returns CMmsClientMtm reference correctly casted from CBaseMtm
       
   116 	     * @param  None
       
   117 	     * @return Reference to documents CMmsClientMtm
       
   118 	     */
       
   119 	    CMmsClientMtm& Mtm();
       
   120 
       
   121 	    /**
       
   122 	     * MtmUi
       
   123 	     * Accessor (Overrides baseeditor)
       
   124 	     * Returns CBaseMtmUi reference
       
   125 	     * @param  None
       
   126 	     * @return Reference to documents CBaseMtmUi
       
   127 	     */
       
   128 	    CBaseMtmUi& MtmUi();
       
   129 
       
   130 	    /**
       
   131 	     * InitializeL
       
   132 	     * Creates MediaResolver
       
   133 	     */ 
       
   134 	    TInt InitializeL();
       
   135 
       
   136         /**
       
   137          * Set whether message is SendAs, Forward, Reply or Open from Draft.
       
   138          * Function determines it from launchflags & entry flags.
       
   139          */
       
   140         void SetMessageType();
       
   141 
       
   142         /*
       
   143          * Mutator. 
       
   144          *
       
   145          * @param size of "addresses"
       
   146          */
       
   147         inline void SetAddressSize( TInt aAddressSize );
       
   148         
       
   149         /**
       
   150          * Accessor
       
   151          *
       
   152          * @return size of address
       
   153          */
       
   154         inline TInt AddressSize() const;
       
   155 
       
   156         /**
       
   157          * Accessor
       
   158          *
       
   159          * @return size of audio file
       
   160          */
       
   161         inline TUint AudioFileSize() const;
       
   162         /**
       
   163          * Mutator. 
       
   164          *
       
   165          * @param size of audio file
       
   166          */
       
   167        	inline void SetAudioFileSize( TUint aAudioFileSize );
       
   168 
       
   169    	   	/**
       
   170          * Accessor
       
   171          *
       
   172          * @return maximum message size in bytes
       
   173          */
       
   174       	inline TUint32 MaxMessageSize() const;
       
   175      	
       
   176      	/**
       
   177          * Saved
       
   178          * Queries whether message is saved.
       
   179          * @param None
       
   180          * @return ETrue,  User has already saved message (in this or some previous session)
       
   181          *                 ie InPreparation flag is not set
       
   182          *         EFalse, Message has not been saved by user yet.
       
   183          */
       
   184         inline TBool Saved() const;
       
   185 
       
   186         /**
       
   187          * Mutator
       
   188          * Set the body modified flag.
       
   189          *
       
   190          * @param aModified
       
   191          */
       
   192         inline void SetBodyModified( TBool aModified );
       
   193 
       
   194         /**
       
   195          * Accessor
       
   196          * Get the body modified flag.
       
   197          *
       
   198          * @return iBodyModified flag
       
   199          */
       
   200         inline TBool BodyModified() const;
       
   201 
       
   202         /**
       
   203          * Mutator
       
   204          * Set the header modified flag.
       
   205          * @param aModified
       
   206          */
       
   207         inline void SetHeaderModified( TBool aModified );
       
   208 
       
   209         /**
       
   210          * Accessor
       
   211          * Get the header modified flag.
       
   212          *
       
   213          * @return iHeaderModified flag
       
   214          */
       
   215         inline TBool HeaderModified() const;
       
   216 
       
   217         /*
       
   218          * Accessor
       
   219          *
       
   220          * @return ETrue if either iBodyModified or iHeaderModified
       
   221          *         flag is ETrue.
       
   222          */
       
   223         inline TBool Modified() const;
       
   224         
       
   225 		/**
       
   226 		* Sets the duration of the voice in microseconds.
       
   227 		* This is for data storage only (does not affect playback).
       
   228 		* @param aDuration The new duration.
       
   229 		*/
       
   230         inline void SetDuration(TTimeIntervalMicroSeconds aDuration);
       
   231 		/**
       
   232 		 * Request duration information from the implementor
       
   233 		 * @return duration in microseconds 
       
   234 		 */
       
   235 		inline TTimeIntervalMicroSeconds GetDuration();
       
   236    		
       
   237 	    /**
       
   238 	    * Get pointer to MediaResolver
       
   239 	    * @return Pointer to MediaResolver
       
   240 	    */
       
   241    		inline CMsgMediaResolver* MediaResolver( );
       
   242 
       
   243         /*
       
   244         * Mutator
       
   245         * Set the application mode : EAmsEditor/EAmsViewer.
       
   246         * @param aStatus
       
   247         */
       
   248    		inline void SetAppMode(TAmsAppStatus aStatus );
       
   249  
       
   250         /*
       
   251         * Accessor
       
   252         *
       
   253         * @return the mode of application EAmsEditor/EAmsViewer
       
   254         *         
       
   255         */
       
   256    		inline TAmsAppStatus GetAppMode();
       
   257    		
       
   258         /*
       
   259         * Mutator
       
   260         * Set the audio clip status : EAmsClipNone/EAmsClipFromGallery/EAmsClipFromRecorder.
       
   261         * @param aStatus
       
   262         */
       
   263    		inline void SetClipStatus(TAmsClipStatus aStatus );
       
   264 
       
   265         /*
       
   266         * Accessor
       
   267         *
       
   268         * @return the status of audio clip : EAmsClipNone/EAmsClipFromGallery/EAmsClipFromRecorder.
       
   269         *         
       
   270         */
       
   271    		inline TAmsClipStatus GetClipStatus();
       
   272 
       
   273         /*
       
   274         * Mutator
       
   275         * Set the audio insert status : inside, recoder, fetched, smil added.
       
   276         * @param aStatus
       
   277         */
       
   278    		inline void SetInsertedStatus(TAmsInsertedStatus aStatus );
       
   279 
       
   280         /*
       
   281         * Accessor
       
   282         *
       
   283         * @return the status of audio clip : EAmsNone/EAmsRecorded/EAmsFetched/
       
   284         *          							 EAmsInsideMessage/EAmsSmilAdded
       
   285         */
       
   286    		inline TAmsInsertedStatus GetInsertedStatus();
       
   287    		
       
   288    		inline TAmsRecordIconStatus GetRecordIconStatus(); 
       
   289    		
       
   290    		inline void SetRecordIconStatus ( TAmsRecordIconStatus aRecordIconStatus );
       
   291    		   
       
   292      	/**
       
   293         * Check if message is forwarded.
       
   294         *
       
   295         * @return ETrue, if is forward.
       
   296         */
       
   297         inline TBool IsForward() const;
       
   298         
       
   299         TBool IsAmrL( RFile& aFile,TDataType& aMimeType ) const;
       
   300 
       
   301 
       
   302     private:
       
   303 
       
   304         /**
       
   305         * 2nd phase constructor
       
   306         * By default Symbian OS constructor is private.
       
   307         */
       
   308         void ConstructL();
       
   309 
       
   310         /**
       
   311         * Creates a new AudioMessageAppUi
       
   312         *
       
   313         * @return a pointer to CAudioMessageAppUi
       
   314         */
       
   315         CEikAppUi* CreateAppUiL();
       
   316 
       
   317     public:  // data
       
   318          
       
   319          /**
       
   320          * Attachmentid for audio.  
       
   321 		 */
       
   322         TMsvAttachmentId iAudio;
       
   323 
       
   324         /**
       
   325          * Attachmentid for smil.  
       
   326 		 */
       
   327         TMsvAttachmentId iSmil;
       
   328 
       
   329 
       
   330     private:  // data
       
   331 
       
   332         /**
       
   333 	     * from where message is opened
       
   334 	     */
       
   335         TAmsUiMessageType iMessageType;
       
   336 
       
   337 	    /**
       
   338 	     * mediaresolver
       
   339 	     * Own.
       
   340 	     */
       
   341 	    CMsgMediaResolver* iMediaResolver;
       
   342 
       
   343 	    /**
       
   344 	     * for recordingdlg use
       
   345 	     */
       
   346 	    TInt iMaxMessageSize;
       
   347 	    
       
   348 	    /**
       
   349 	     * for to-control
       
   350 	     */
       
   351 	    TInt iAddressSize;
       
   352 
       
   353 	    /**
       
   354 	     * amr file size
       
   355 	     */
       
   356 	    TUint iAudioFileSize;
       
   357 
       
   358 	    /**
       
   359 	     * dirty bit for recipients
       
   360 	     */
       
   361 	    TBool iHeaderModified;
       
   362 
       
   363 	    /**
       
   364 	     * dirty bit for voicefile
       
   365 	     */
       
   366 	    TBool iBodyModified;
       
   367 
       
   368    	    /**
       
   369 	     * amr duration ms
       
   370 	     */
       
   371 		TTimeIntervalMicroSeconds iDuration;
       
   372 
       
   373    	    /**
       
   374 	     * editor or viewer
       
   375 	     */
       
   376 		TAmsAppStatus iAppStatus;
       
   377 
       
   378    	    /**
       
   379 	     * callery, recoder, attachment
       
   380 	     */
       
   381 		TAmsClipStatus iClipStatus;
       
   382 
       
   383    	    /**
       
   384 	     * none, recoder,fetched, smiladded, inside
       
   385 	     */
       
   386 		TAmsInsertedStatus iInsertedStatus;
       
   387 
       
   388 		TAmsRecordIconStatus iRecordIconStatus;
       
   389 	};
       
   390 
       
   391 #include "audiomessagedocument.inl"
       
   392 
       
   393 #endif      // __AUDIOMESSAGEDOCUMENT_H
       
   394