email/mail/UtilsSrc/MsgMailAppUi.h
changeset 79 2981cb3aa489
parent 0 72b543305e3a
equal deleted inserted replaced
25:84d9eb65b26f 79:2981cb3aa489
       
     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:  Common base class for Mail application UI classes.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MSGMAILAPPUI_H
       
    20 #define MSGMAILAPPUI_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "MailLog.h"
       
    24 #include <MsgEditorAppUi.h>
       
    25 #include <MsgEditor.hrh>
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CMsgExpandableControl;
       
    29 class CMsgAddressControl;
       
    30 class CMsgAttachmentControl;
       
    31 class CMsgRecipientItem;
       
    32 class CMsgBodyControl;
       
    33 class CMsgMailDocument;
       
    34 class TMsvEmailEntry;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 *  A common base class for Mail editor and viewer applications' UIs.
       
    40 */
       
    41 class CMsgMailAppUi :public CMsgEditorAppUi
       
    42     {
       
    43     public: // iCommonFlags
       
    44     	enum TCommonFlags
       
    45             {
       
    46             EWestern = KBit0,
       
    47             EHelpSupported = KBit1
       
    48             };
       
    49     public:  // Constructors and destructor
       
    50                 
       
    51         /**
       
    52         * C++ default constructor.
       
    53         */
       
    54         IMPORT_C CMsgMailAppUi();
       
    55 
       
    56         /**
       
    57         * Destructor.
       
    58         */
       
    59         IMPORT_C virtual ~CMsgMailAppUi();
       
    60 
       
    61     public: // New functions
       
    62         
       
    63         /**
       
    64         * Saves a message.
       
    65         * @param  aInPreparation in certain cases new message 
       
    66         *         has to saved temporarily, then aInPreparation flag is set 
       
    67         *         to ETrue (default is EEalse) so automatic cleanup is made 
       
    68         *         by server if something goes wrong.
       
    69         * @param  aReply not used!. See CMsgMailDocument::CreateReplyL 
       
    70         *               Defaults to EFalse.
       
    71         * @return EFalse, if there are mailboxes defined, ETrue otherwise
       
    72         */
       
    73         IMPORT_C TBool MsgSaveL(const TBool aInPreparation, 
       
    74             const TBool aReply = EFalse);
       
    75 
       
    76         /**
       
    77         * Checks if critical level is reached when aSize is reserved
       
    78         * @param aSize amount of kilobytes to be reserved
       
    79         * @return ETrue if critical level is not reached
       
    80         */
       
    81         IMPORT_C TBool CheckFFSL(const TInt aSize);
       
    82 
       
    83         /**
       
    84         * *Deprecated*.
       
    85         * Leaves with KErrNotsupported. 
       
    86         * Use MailUtils::IsClosedFileL instead of this.
       
    87         * @param aBuf MIME type
       
    88         * @return ETrue if sending is not allowed.
       
    89         */
       
    90         IMPORT_C TBool IsBannedMimeL(const TDesC& aBuf) const;
       
    91 
       
    92 		/**
       
    93 		* Checks an EMail address.
       
    94 		* @param Address
       
    95 		* @return ETrue if EMail address is valid.
       
    96 		*/
       
    97 		IMPORT_C TBool IsValidAddress( const TDesC& aAddress ) const;
       
    98 		
       
    99 		/**
       
   100 		* inline
       
   101 		* @return reference to application coe enviroment
       
   102 		*/		
       
   103 		CCoeEnv& AppCoeEnv();
       
   104 
       
   105         /**
       
   106          * Enable or disable Dialer functionality.
       
   107          * @param aEnable ETrue  : Dialer enabled (send key opens Dialer)
       
   108          *                EFalse : Dialer disabled
       
   109          */
       
   110         IMPORT_C void SetDialerEnabled( TBool aEnable );
       
   111         
       
   112     protected:  // New functions
       
   113         
       
   114         /**
       
   115         * By default Symbian OS constructor is private.
       
   116         */
       
   117         IMPORT_C void ConstructL();
       
   118 
       
   119         /**
       
   120         * Returns a pointer to subject control UI object.
       
   121         * @return A pointer to a control.
       
   122         */
       
   123         CMsgExpandableControl* SubjectControl() const;
       
   124 
       
   125         /**
       
   126         * Returns a pointer to address control UI object.
       
   127         * @param aId id of the control.
       
   128         * @return A pointer to a control.
       
   129         */
       
   130         CMsgAddressControl* AddressControl(const TInt aId) const;
       
   131 
       
   132         /**
       
   133         * inline
       
   134         * Returns a pointer to attachment control UI object.
       
   135         * @return A pointer to a control. Ownership not transferred.
       
   136         */
       
   137         CMsgAttachmentControl* AttachmentControl() const;
       
   138 
       
   139         /**
       
   140         * Returns a pointer to body control UI object.
       
   141         * @return A pointer to a control.
       
   142         */
       
   143         CMsgBodyControl* BodyControl() const;
       
   144 
       
   145         /**
       
   146         * *Deprecated*.
       
   147         * Leaves with KErrNotsupported. 
       
   148         * Use MailUtils::IsClosedFileL instead of this.
       
   149         * @param aMimeType MIME type to be checked
       
   150         * @return ETrue if banned otherwise EFalse
       
   151         */
       
   152         IMPORT_C TBool CheckIfBannedL(const TDesC& aMimeType);
       
   153         
       
   154         /**
       
   155         * *Deprecated*.
       
   156         * Leaves with KErrNotsupported. 
       
   157         * Use MailUtils::IsClosedFileL instead of this.
       
   158         * @param aFile file to be checked
       
   159         * @return ETrue if banned otherwise EFalse
       
   160         */        
       
   161         IMPORT_C TBool CheckIfBannedL(RFile& aFile);
       
   162 
       
   163         /**
       
   164         * Cleans up wait note wrapper
       
   165         * @param aAny a pointer to wrapper.
       
   166         */
       
   167         IMPORT_C static void CleanupWaitNoteWrapper(TAny* aAny);
       
   168         
       
   169         /**
       
   170         * Removes wait note from screen, used as a cleanup method
       
   171         * @param aAny a pointer to dialog.
       
   172         */
       
   173         IMPORT_C static void CleanupWaitDialog(TAny* aAny);
       
   174         
       
   175         /**
       
   176         * Calculates message size.
       
   177         * Size is based to content of the UI components.
       
   178         * @param aCountAttachments ETrue if size of the attachments
       
   179         *   need to be count also. 
       
   180         * @return Size in bytes.
       
   181         */        
       
   182         IMPORT_C TInt MessageSizeL( TBool aCountAttachments );
       
   183 
       
   184     private: // implementation
       
   185         CMsgMailDocument* MailDocument();
       
   186         TBool DoSaveMessageL( TBool aInPreparation, TBool aReply );
       
   187         HBufC* ConstructAddressStringLC(CMsgRecipientItem* aRecItem);
       
   188         TBool StripIllegalCharsL(TDes& aString);
       
   189         void CheckStoreSpaceL( TMsvEmailEntry aMessage, TBool aReply );    
       
   190 		TBool SetServiceIdL( 
       
   191             TMsvEmailEntry& aEntry, CMsgMailDocument& aDocument );
       
   192         void SetEntryTimeL( TMsvEntry& aEntry );
       
   193         void SetEntryFlagsL( 
       
   194             TMsvEmailEntry& aEntry, 
       
   195             TMsvId aOrigMessageId );
       
   196         void SetHeaderFieldsL( TMsvEmailEntry& aMessage );
       
   197         void SetSmallIconL();    
       
   198 		void AppendRecipientsL( 
       
   199             CMsgAddressControl* aField, CDesCArray& aArray );
       
   200 		
       
   201 		/**
       
   202 		 * Construct message details from recipient array.
       
   203 		 * @param aControl Source for recipients.
       
   204 		 * @return Constructed details string. Empty string is returned if no
       
   205 		 *         recipients are found.
       
   206 		 */
       
   207 		HBufC* MakeDetailsLC( CMsgAddressControl& aControl );
       
   208 		
       
   209     protected:  // Data            
       
   210         /// Own: Feature flags for editor / viewer
       
   211         TUint32 iCommonFlags;
       
   212                         
       
   213         /// Message ID
       
   214         TMsvId iMessageID;        
       
   215 
       
   216     private:    // Data
       
   217         
       
   218         /// Own: Array containing banned characters in user inputted addresses.
       
   219         CDesCArrayFlat* iBannedChars;
       
   220 
       
   221         /// Own: Is refresh needed in address control after deleting
       
   222         TBool iNeedRefresh;
       
   223         
       
   224         RConeResourceLoader iResource;
       
   225         
       
   226     UNIT_TEST( T_UT_Mail )
       
   227     };
       
   228 
       
   229 #include "MsgMailAppUi.inl"
       
   230 
       
   231 #endif      // MSGMAILAPPUI_H   
       
   232             
       
   233 // End of File