email/mail/UtilsSrc/MsgMailDocument.h
branchRCL_3
changeset 27 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
26:ebe688cedc25 27:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2002 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:  Base class for document classes of the 
       
    15 *                 mail viewer and editor applications
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef MSGMAILDOCUMENT_H
       
    21 #define MSGMAILDOCUMENT_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <MsgEditorDocument.h>          // CMsgEditorDocument
       
    25 #include <apgcli.h>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CImHeader;
       
    29 class CMsgMailViewerSettings;
       
    30 class TMsvEmailEntry;
       
    31 class CImEmailMessage;
       
    32 class CEikMenuPane;
       
    33 class CMsgMailPreferences;
       
    34 class CMailMessage;
       
    35 class CMailCRHandler;
       
    36 
       
    37 // CLASS DECLARATION
       
    38 
       
    39 /**
       
    40 *   CMsgMailDocument, base class for editor and viewer application document 
       
    41 *   classes.
       
    42 *   Defines CMsgMailDocument -class, which is a base class for document 
       
    43 *   classes of the mail viewer and editor applications. The document is 
       
    44 *   part of the Symbian OS application framework.
       
    45 */
       
    46 class CMsgMailDocument :public CMsgEditorDocument
       
    47     {
       
    48     public:  // Constructors and destructor
       
    49     
       
    50 	// Types of messages to keep count
       
    51 	enum
       
    52 		{
       
    53 	    EIndexAddHeaders = 0,
       
    54 	    EIndexLast
       
    55 	    };
       
    56 
       
    57         /**
       
    58         * Destructor.
       
    59         */
       
    60         IMPORT_C ~CMsgMailDocument();
       
    61 
       
    62     public: // New functions
       
    63         
       
    64         /**
       
    65         * Sets preferences of the message..
       
    66         * @param aModel model.
       
    67         */
       
    68         void SetPreferences(CMsgMailPreferences* aPrefs);
       
    69 
       
    70         /**
       
    71         * Returns header of the message.
       
    72         * @return CImHeader, header of the message.
       
    73         */
       
    74         CImHeader& HeaderL() const;
       
    75         
       
    76 		/**
       
    77         * Get entry of the message.
       
    78         * @return TMsvEmailEntry entry of the message.
       
    79         */
       
    80         IMPORT_C const TMsvEmailEntry& TMsvEMailEntryL();
       
    81 
       
    82         
       
    83         /**
       
    84         * Returns reference to message object.
       
    85         * @return CImEmailMessage reference to message.
       
    86         */
       
    87         IMPORT_C CImEmailMessage& MessageL();               
       
    88         
       
    89         /**
       
    90         * inline
       
    91         * Creates new message.
       
    92         * @see CreateNewL(TMsvId aServiceType, TMsvId aDestination, 
       
    93         *    TInt aTypeList, TUid aMtm)
       
    94         * 
       
    95         *   calls  CreateNewL(aService, aTarget, aTypeList, KUidMsgTypeSMTP);
       
    96         */
       
    97         TMsvId CreateNewL(TMsvId aService, TMsvId aTarget, 
       
    98             TInt aTypeList);
       
    99 
       
   100         /**
       
   101         * inline
       
   102         * @return a pointer to Mail Central Repository handler.
       
   103         * Ownership not transferred.
       
   104         */
       
   105         CMailCRHandler* MailCRHandler() const;
       
   106         
       
   107         /**
       
   108         * Creates new message.
       
   109         * A new message of given type is created in a destination folder.
       
   110         * @param aServiceType service used for sending message
       
   111         * @param aTarget folder in which message will be saved eg. 
       
   112         * KMsvDraftEntryIdValue
       
   113         * @param aTypeList type of message to be created. 
       
   114         * @see TMsvEmailTypeList
       
   115         * @param aMtm, message type to be created e.g. KUidMsgTypeSMTP
       
   116         * @return ID of mail operation. 
       
   117         */
       
   118         IMPORT_C TMsvId CreateNewL(TMsvId aServiceType, TMsvId aTarget, 
       
   119             TInt aTypeList, TUid aMtm);
       
   120         
       
   121         /**
       
   122         * Creates new message entry.
       
   123         * @return new message ID.
       
   124         */        
       
   125         TMsvId CreateNewEntryL( TMsvEmailEntry& aEntry );
       
   126         
       
   127         /**
       
   128         * Returns a preferences object of the document.
       
   129         * @return A preference object.
       
   130         */
       
   131         CMsgMailPreferences& SendOptions() const;
       
   132 
       
   133         /**
       
   134         * Sets iConfNote flag according to parameter.
       
   135         * @param aConfNote value to set.
       
   136         */
       
   137         void SetConfirmation(TBool aConfNote);
       
   138 
       
   139         /**
       
   140         * Checks if confirmation note needs to be shown to user.
       
   141         * @return ETrue if note is needed. 
       
   142         */
       
   143         TBool ShowConfirmation() const;
       
   144 
       
   145         /**
       
   146         * Save iHeader information to current store.
       
   147         */
       
   148         void SaveHeaderToStoreL();
       
   149 
       
   150         /**
       
   151         * Check if we are dealing with a SyncML mail
       
   152         * @deprecated
       
   153         * @returns EFalse.
       
   154         */
       
   155         IMPORT_C TBool IsSyncMLMail();
       
   156         
       
   157         /**
       
   158         * Check file mime type
       
   159         * @param aFile file to be checked.
       
   160         * @return TDataType mime type of a file.
       
   161         */        
       
   162         IMPORT_C TDataType ResolveMimeType( RFile aFile );
       
   163         
       
   164         /**
       
   165         * Informs the model of updated central repository value
       
   166         * Integer override
       
   167         * @param aMessageType The index of entry.
       
   168         * @param aValue Received value
       
   169         */
       
   170         TInt SetReceivedIntL( const TUint aMessageType, const TInt aValue );
       
   171         
       
   172         /**
       
   173         * Informs the model of updated central repository value
       
   174         * Real override
       
   175         * @param aMessageType The index of entry.
       
   176         * @param aValue Received value
       
   177         */
       
   178         TInt SetReceivedRealL( 
       
   179             const TUint aMessageType, const TReal aValue );
       
   180         
       
   181         /**
       
   182         * Informs the model of updated central repository value
       
   183         * Binary override
       
   184         * @param aMessageType The index of entry.
       
   185         * @param aValue Received value
       
   186         */
       
   187         TInt SetReceivedBinaryL( 
       
   188             const TUint aMessageType, const TDesC8 aValue );
       
   189         
       
   190         /**
       
   191         * Informs the model of updated central repository value
       
   192         * String override
       
   193         * @param aMessageType The index of entry.
       
   194         * @param aValue Received value
       
   195         */
       
   196         TInt SetReceivedStringL( 
       
   197             const TUint aMessageType, 
       
   198             const TDesC16 aValue );
       
   199         
       
   200         /**
       
   201         * Check if we are below critical level.
       
   202         * @param aBytesToWrite bytes to be written.
       
   203         * @retur ETrue if critical level is not reached.
       
   204         */        
       
   205         TBool DiskSpaceBelowCriticalLevelL( TInt aBytesToWrite );
       
   206         
       
   207     protected:  // New functions
       
   208         /**
       
   209         * Constructor.
       
   210         * Initializes variables and calls parent class constructor.
       
   211         * @param aApp application object.
       
   212         */
       
   213         IMPORT_C CMsgMailDocument(CEikApplication& aApp);
       
   214     
       
   215     public: // Functions from base classes 
       
   216         
       
   217         /// From CMsgEditorDocument
       
   218         TMsvId DefaultMsgService() const;
       
   219         TMsvId DefaultMsgFolder() const;
       
   220         TMsvId CreateNewL(TMsvId aService, TMsvId aTarget);       
       
   221     
       
   222     protected:  // Functions from base classes 
       
   223         
       
   224         /// From CMsgEditorDocument
       
   225         IMPORT_C void EntryChangedL();
       
   226         IMPORT_C CMsvOperation* CreateReplyL(
       
   227             TMsvId aDest, 
       
   228             TMsvPartList aParts, 
       
   229             TRequestStatus& aStatus );
       
   230         IMPORT_C CMsvOperation* CreateForwardL(
       
   231             TMsvId aDest, 
       
   232             TMsvPartList aParts, 
       
   233             TRequestStatus& aStatus );
       
   234 
       
   235     
       
   236     private: // implementation
       
   237         void AddAttachmentNamesToMessageBodyL( const TDesC& aString );
       
   238         HBufC* GetAttachmentNamesFromMessageL( 
       
   239             CImEmailMessage* aMailMessage );
       
   240         TBool IsPlainHTMLMessageL( CImEmailMessage* aMailMessage );
       
   241         static TInt ShowHtmlNoteCallBackL( TAny* aCaller );
       
   242         
       
   243     protected:  // Data
       
   244         /// Own: Message proferences
       
   245         CMsgMailPreferences* iPrefs;
       
   246                
       
   247         // Ref: Mail message
       
   248 		CMailMessage* iViewedMessage;
       
   249 		
       
   250 		// Own: message centry
       
   251 		CMsvEntry* iMessageCEntry;
       
   252 		
       
   253 		// original message id
       
   254 		TMsvId iMessageID;
       
   255 		
       
   256 		// Ref: Mail CR handler         
       
   257         CMailCRHandler* iMailCRHandler;
       
   258         
       
   259     private:    // Data
       
   260         /// Own: Mail message
       
   261         CImEmailMessage* iMessage;
       
   262         
       
   263         /// Own: Message header
       
   264         CImHeader* iHeader;            
       
   265         
       
   266         /**
       
   267         * iConfNote flag telling if user needs to be informed
       
   268         * when attachment added.
       
   269         */
       
   270         TBool iConfNote;
       
   271 		
       
   272 		// AP session
       
   273 		RApaLsSession iApaSession;
       
   274 		
       
   275 		//own
       
   276 		CIdle* iIdle;
       
   277 		
       
   278 		/**
       
   279 		* iShowNoteCallBack is used to show
       
   280 		* html note to user with some delay.
       
   281 		*/
       
   282 		TCallBack iShowNoteCallBack;
       
   283         
       
   284 		
       
   285     };
       
   286 
       
   287 #include "MsgMailDocument.inl" // Inline functions
       
   288 
       
   289 #endif      // MSGMAILDOCUMENT_H
       
   290             
       
   291 // End of File
       
   292