mobilemessaging/postcard/postcardinc/PostcardDocument.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2005 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:  
       
    15 *       CPostcardDocument, document class for Postcard application.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __POSTCARDDOCUMENT_H
       
    23 #define __POSTCARDDOCUMENT_H
       
    24 
       
    25 //  INCLUDES
       
    26 #include <msvapi.h>                     // CMsvEntry
       
    27 #include <MsgEditorDocument.h>          // CMsgEditorDocument
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // This tell how much of the max MMS size is reserved for greeting and recipient
       
    32 const TInt KPostcardAddressGreetingOverhead = 2000;
       
    33 // What's the max. size the greeting text can store itself internally
       
    34 // (the max. size of sent text is read from central repository)
       
    35 const TInt KPostcardDefaultGreetingSegment = 512; 
       
    36 
       
    37 // MACROS
       
    38 
       
    39 // DATA TYPES
       
    40 
       
    41 enum TPostcardMsgType // Type of the postcard 
       
    42     {
       
    43     EPostcardNew = 0,
       
    44     EPostcardDraft,
       
    45     EPostcardForward,
       
    46     EPostcardEdit,
       
    47     EPostcardSendAs,
       
    48     EPostcardSent
       
    49     };
       
    50 
       
    51 enum TPostcardPart // Enumerations for different parts of the postcard
       
    52     {
       
    53     EPostcardImage = 1,
       
    54     EPostcardText = 2,
       
    55     EPostcardRecipient = 4,
       
    56     EPostcardNone = 8   // Prevents unnecessary icons to be drawn at startup.
       
    57     };
       
    58 
       
    59 // FUNCTION PROTOTYPES
       
    60 
       
    61 // FORWARD DECLARATIONS
       
    62 
       
    63 class CMmsClientMtm;
       
    64 class CBaseMtmUi;
       
    65 class CMsgMediaResolver;
       
    66 class CMsgTextUtils;
       
    67 
       
    68 // CLASS DECLARATION
       
    69 
       
    70 class CPostcardDocument :public CMsgEditorDocument
       
    71     {
       
    72     public:  // Constructors and destructor
       
    73 
       
    74     /**
       
    75     * Destructor.
       
    76     */
       
    77     ~CPostcardDocument();
       
    78 
       
    79     /**
       
    80     * C++ constructor
       
    81     *
       
    82     * @param aApp   Reference to application instance
       
    83     */
       
    84     CPostcardDocument( CEikApplication& aApp );
       
    85 
       
    86     /**
       
    87     * Factory function to create this object
       
    88     *
       
    89     * @param aApp   Reference to application instance
       
    90     */
       
    91     static CPostcardDocument* NewL( CEikApplication& aApp );
       
    92 
       
    93     public: // New functions
       
    94 
       
    95     /**
       
    96     * InitializeL
       
    97     * Creates MediaResolver and MmsData
       
    98     */ 
       
    99     void InitializeL( RFs& aFs );
       
   100 
       
   101     public: // Virtuals from CMsgEditorDocument
       
   102 
       
   103     /**
       
   104     * DefaultMsgFolder
       
   105     * Returns default folder for new messages.
       
   106     * @return ID of the Drafts folder.
       
   107     */
       
   108     TMsvId DefaultMsgFolder() const;
       
   109 
       
   110     /**
       
   111     * DefaultMsgService
       
   112     * From CMsgEditorDocument
       
   113     * Returns default message service used by application
       
   114     * @return TMsvId KMsvLocalServiceIndexEntryId.
       
   115     */
       
   116     TMsvId DefaultMsgService() const;
       
   117 
       
   118     /**
       
   119     * CreateNewL
       
   120     * From CMsgEditorDocument
       
   121     * Creates new message.
       
   122     * A new message of type Postcard is created
       
   123     * in a destination folder.
       
   124     * Calls CreateNewL(TMsvId aServiceType, TMsvId aDestination,
       
   125     *                  TInt aTypeList).
       
   126     * @param aService service used for message
       
   127     * @param aDestFolder folder in which message will be saved eg.
       
   128     *                    KMsvDraftEntryIdValue
       
   129     * @return ID of mail operation.
       
   130     */
       
   131     TMsvId CreateNewL(TMsvId aService, TMsvId aDestFolder);
       
   132 
       
   133     /**
       
   134     * EntryChangedL
       
   135     * From CMsgEditorDocument
       
   136     * Called after entry is changed by BaseEditor SetEntry Function.
       
   137     * From MsgEditorDocument
       
   138     */
       
   139     void EntryChangedL();
       
   140 
       
   141     public: // From CMsgEditorDocument
       
   142 
       
   143     /*
       
   144     * Mtm
       
   145     * Accessor (Overrides baseeditor)
       
   146     * Returns CMmsClientMtm reference correctly casted from CBaseMtm
       
   147     * @param  None
       
   148     * @return Reference to documents CMmsClientMtm
       
   149     */
       
   150     CMmsClientMtm& Mtm();
       
   151 
       
   152     /*
       
   153     * MtmUi
       
   154     * Accessor (Overrides baseeditor)
       
   155     * Returns CMmsMtmUi reference correctly casted from CBaseMtmUi
       
   156     * @param  None
       
   157     * @return Reference to documents CMmsMtmUi
       
   158     */
       
   159     CBaseMtmUi& MtmUi();
       
   160 
       
   161     public:
       
   162 
       
   163     /**
       
   164     * Get pointer to MediaResolver
       
   165     * @return Pointer to MediaResolver
       
   166     */
       
   167     inline CMsgMediaResolver* MediaResolver( ) { return iMediaResolver; };
       
   168 
       
   169     /**
       
   170     * Get pointer to MmsData
       
   171     * @return Pointer to MmsData
       
   172     */
       
   173 	inline CMsgTextUtils* TextUtils( ) { return iTextUtils; };
       
   174 			
       
   175     /**
       
   176     * Messagetype accessor
       
   177     *
       
   178     * @return Message type
       
   179     */
       
   180     inline TPostcardMsgType MessageType() const { return iMsgType; };
       
   181 
       
   182     public: // new ones:
       
   183 
       
   184     /**
       
   185     * Sets aPart as changed
       
   186     */
       
   187     void SetChanged( TPostcardPart aPart );
       
   188 
       
   189     /**
       
   190     * Checks if aPart is changed
       
   191     */
       
   192     TBool Changed( TPostcardPart aPart ) const;
       
   193 
       
   194     /**
       
   195     * ETrue if any part of the postcard has been changed
       
   196     */
       
   197     TBool Modified( ) const;
       
   198 
       
   199     /**
       
   200     * Set whether message is SendAs, Forward, Reply or Open from Draft.
       
   201     * Function determines it from launch flags & entry flags.
       
   202     */
       
   203     void SetMessageType();
       
   204 
       
   205     /**
       
   206     * Returns the max size of the message
       
   207     */
       
   208 	TInt MaxMessageSize( ) const;
       
   209 
       
   210     /**
       
   211     * Returns the max size of the image (max message - textrecipientoverhead)
       
   212     */
       
   213 	TInt MaxImageSize( ) const;
       
   214 
       
   215     /**
       
   216     * Called by Controller so it knows if the app is started from ROM or not
       
   217     * Returns full filepath to this application
       
   218     */        
       
   219     TFileName AppFullName( );
       
   220 
       
   221     /**
       
   222     * Check if the mimetype is an image
       
   223     */
       
   224     TBool IsImage( const TDataType& aMimeType );
       
   225 
       
   226     /**
       
   227     * Tells the maximum width and height of the image.
       
   228     * If image is bigger than that -> scaling is needed
       
   229     */
       
   230 	TSize MaxImageDimensions( );
       
   231 	
       
   232     protected:  // New functions
       
   233 
       
   234     /**
       
   235     * ConstructL
       
   236     * 2nd phase constructor.
       
   237     */
       
   238     void ConstructL();
       
   239 
       
   240     private: // New Functions
       
   241 
       
   242     /**
       
   243     * Creates a new CPostcardAppUi
       
   244     */
       
   245     CEikAppUi* CreateAppUiL();
       
   246 
       
   247     private:  // data
       
   248 
       
   249     RFs                 iFs;
       
   250     TInt                iMsgChanged;
       
   251     TPostcardMsgType    iMsgType;
       
   252     CMsgMediaResolver*  iMediaResolver;
       
   253     CMsgTextUtils*      iTextUtils;
       
   254     TInt 				iMaxMessageSize;
       
   255     };
       
   256 
       
   257 
       
   258 #endif   // __POSTCARDDOCUMENT_H
       
   259 
       
   260 // End of file