emailservices/emailcommon/inc/CFSMailMessage.h
changeset 20 ecc8def7944a
parent 18 578830873419
child 62 a8c646b56683
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    41      * Two-phased constructor.
    41      * Two-phased constructor.
    42      *
    42      *
    43      * @param aMessageId message id in plugin containing email
    43      * @param aMessageId message id in plugin containing email
    44      */
    44      */
    45      IMPORT_C static CFSMailMessage* NewL( TFSMailMsgId aMessageId );
    45      IMPORT_C static CFSMailMessage* NewL( TFSMailMsgId aMessageId );
    46 
    46     
    47     /**
    47     /**
    48      * Two-phased constructor.
    48      * Two-phased constructor.
    49      *
    49      *
    50      * @param aMessageId message id in plugin containing email
    50      * @param aMessageId message id in plugin containing email
    51      */
    51      */
    52      IMPORT_C static CFSMailMessage* NewLC( TFSMailMsgId aMessageId );
    52      IMPORT_C static CFSMailMessage* NewLC( TFSMailMsgId aMessageId );
    53 
    53 
       
    54 // <qmail>
    54      /**
    55      /**
    55       * Two-phased constructor.
    56       * Two-phased constructor.
    56       *
    57       *
    57       * @param aMessageId message id in plugin containing email
    58       * @param aMessageId message id in plugin containing email
    58       */
    59       */
    59       IMPORT_C static CFSMailMessage* NewL( const NmMessage &aMessage );
    60       IMPORT_C static CFSMailMessage* NewL( const NmMessage &aMessage );
       
    61 // </qmail>
    60 
    62 
    61     /**
    63     /**
    62      * saves this message
    64      * saves this message
    63      */
    65      */
    64      IMPORT_C void SaveMessageL();
    66      IMPORT_C void SaveMessageL();
    65 
    67 
    66      //<qmail>
    68 // <qmail>
    67     /**
    69     /**
    68      * saves this message asynchronously
    70      * saves this message asynchronously
    69      */
    71      */
    70     IMPORT_C TInt SaveMessageL(MFSMailRequestObserver& aOperationObserver);
    72     IMPORT_C TInt SaveMessageL(MFSMailRequestObserver& aOperationObserver);
    71 
    73 
    72     /**
    74     /**
    73      * saves message parts asynchronously
    75      * saves message parts asynchronously
    74      */
    76      */
    75     IMPORT_C TInt SaveMessagePartsL(
    77     IMPORT_C TInt SaveMessagePartsL(
    76             MFSMailRequestObserver& aOperationObserver);
    78             MFSMailRequestObserver& aOperationObserver);
    77     //</qmail>
    79 // </qmail>
    78 
    80 
    79     /**
    81     /**
    80      * destructor
    82      * destructor
    81      */
    83      */  
    82      IMPORT_C ~CFSMailMessage();
    84      IMPORT_C ~CFSMailMessage();
    83 
    85 
    84     /**
    86     /**
    85      * Adds new attachment to this email.
    87      * Adds new attachment to this email.
    86      *
    88      * 
    87      * @param aFilePath contains full path to new attachment file.
    89      * @param aFilePath contains full path to new attachment file.
    88      * @param aInsertBefore specifies position where new attachment is created.
    90      * @param aInsertBefore specifies position where new attachment is created.
    89      *        If NullId then new attachment is created as last.
    91      *        If NullId then new attachment is created as last.
    90      *
    92      *
    91      * @return new email part object, ownership is transferred to user
    93      * @return new email part object, ownership is transferred to user
    92      */
    94      */ 
    93      IMPORT_C CFSMailMessagePart* AddNewAttachmentL( const TDesC& aFilePath,
    95      IMPORT_C CFSMailMessagePart* AddNewAttachmentL( const TDesC& aFilePath,
    94                                                      const TFSMailMsgId aInsertBefore);
    96                                                      const TFSMailMsgId aInsertBefore);
    95 
    97 
    96      // <qmail>
    98 // <qmail>
    97      /**
    99      /**
    98       * Adds new attachment to this email asynchronously
   100       * Adds new attachment to this email asynchronously
    99       */
   101       */
   100      IMPORT_C TInt AddNewAttachmentL( const TDesC& aFilePath,
   102      IMPORT_C TInt AddNewAttachmentL( const TDesC& aFilePath,
   101                                       MFSMailRequestObserver& aOperationObserver);
   103                                       MFSMailRequestObserver& aOperationObserver);
   102      // </qmail>
   104 // </qmail>
   103      
   105      
   104      /**
   106      /**
   105       * Adds new attachment to this email.
   107       * Adds new attachment to this email.
   106       *
   108       * 
   107       * @param aFile contains access to new attachment file.
   109       * @param aFile contains access to new attachment file.
   108       * @param aMimeType user can give content type of the new part,
   110       * @param aMimeType user can give content type of the new part,
   109       *        otherwise content type is tried to recognized by method
   111       *        otherwise content type is tried to recognized by method
   110       *
   112       *
   111       * @return new email part object, ownership is transferred to user
   113       * @return new email part object, ownership is transferred to user
   112       */
   114       */ 
   113      IMPORT_C CFSMailMessagePart* AddNewAttachmentL( RFile& aFile,
   115      IMPORT_C CFSMailMessagePart* AddNewAttachmentL( RFile& aFile, 
   114                                                      const TDesC8& aMimeType );
   116                                                      const TDesC8& aMimeType );
   115 
   117 
   116      /**
   118      /**
   117    * Returns a flat list of message parts that can be handled as attachments.
   119      * Returns a flat list of message parts that can be handled as attachments.
   118    * Excludes message parts that are multipart and parts that are considered
   120      * Excludes message parts that are multipart and parts that are considered
   119    * plain text or html body.
   121      * plain text or html body.
   120    *
   122      * 
   121    * @param aParts contains flat list of attachments
   123      * @param aParts contains flat list of attachments
   122    */
   124      */        
   123    IMPORT_C void AttachmentListL(RPointerArray<CFSMailMessagePart>& aParts);
   125      IMPORT_C void AttachmentListL(RPointerArray<CFSMailMessagePart>& aParts);
   124 
   126 
   125    //<qmail>
   127 // <qmail>
   126     /**
   128     /**
   127      * Returns plain text body part for this email or NULL if not found.
   129      * Returns plain text body part for this email or NULL if not found.
   128      *
   130      * 
   129      * @return plain text email body part, ownership is transferred to user
   131      * @return plain text email body part, ownership is transferred to user
   130      */
   132      */        
   131     IMPORT_C CFSMailMessagePart* PlainTextBodyPartL(
   133     IMPORT_C CFSMailMessagePart* PlainTextBodyPartL(
   132             TFSMailMessagePartDataSource aDataSource =
   134             TFSMailMessagePartDataSource aDataSource =
   133                     EDataSourceMessageStore);
   135                     EDataSourceMessageStore);
   134 
   136 
   135     /**
   137     /**
   136      * Returns html body part for this message or NULL if not found.
   138      * Returns html body part for this message or NULL if not found.
   137      *
   139      * 
   138      * @return html email body part, ownership is transferred to user
   140      * @return html email body part, ownership is transferred to user
   139      */
   141      */        
   140     IMPORT_C CFSMailMessagePart* HtmlBodyPartL(
   142     IMPORT_C CFSMailMessagePart* HtmlBodyPartL(
   141             TFSMailMessagePartDataSource aDataSource =
   143             TFSMailMessagePartDataSource aDataSource =
   142                     EDataSourceMessageStore);
   144                     EDataSourceMessageStore);
   143     //</qmail>
   145 // </qmail>
   144 
   146 
   145     /**
   147     /**
   146      * Returns ETrue if this part is actually a message.
   148      * Returns ETrue if this part is actually a message.
   147      * In that case it shoud safe to cast this part to CFSMailMessage
   149      * In that case it shoud safe to cast this part to CFSMailMessage
   148      *
   150      * 
   149      * @return true if this message part is a message
   151      * @return true if this message part is a message
   150      */
   152      */        
   151    IMPORT_C TBool IsMessageL() const;
   153      IMPORT_C TBool IsMessageL() const;
   152 
   154 
   153    /**
   155      /**
   154      * Returns a flat list of message parts that can be handled as attachments.
   156      * Returns a flat list of message parts that can be handled as attachments.
   155      * Excludes message parts that are multipart and parts that are considered
   157      * Excludes message parts that are multipart and parts that are considered
   156      * plain text or html body.
   158      * plain text or html body.
   157      *
   159      * 
   158      * @param aParts contains flat list of attachments
   160      * @param aParts contains flat list of attachments
   159      */
   161      */        
   160      void DoAttachmentListL(RPointerArray<CFSMailMessagePart>& aParts);
   162      void DoAttachmentListL(RPointerArray<CFSMailMessagePart>& aParts);
   161 
   163 
   162     //<qmail>
   164 // <qmail>
   163     /**
   165     /**
   164      * gets the new NmMessage object
   166      * gets the new NmMessage object
   165      *
   167      *
   166      * @return NmMessage object based on iNmPrivateMessagePart and iNmPrivateMessageEnvelope
   168      * @return NmMessage object based on iNmPrivateMessagePart and iNmPrivateMessageEnvelope
   167      */
   169      */
   168     IMPORT_C NmMessage* GetNmMessage();
   170     IMPORT_C NmMessage* GetNmMessage();
   169     //</qmail>
   171 // </qmail>
   170 
   172 
   171  protected:
   173  protected:
   172 
   174 
   173  private:
   175  private:
   174 
   176 
   180     /**
   182     /**
   181      * Two-phased constructor
   183      * Two-phased constructor
   182      */
   184      */
   183      void ConstructL( TFSMailMsgId aMessageId );
   185      void ConstructL( TFSMailMsgId aMessageId );
   184 
   186 
       
   187 // <qmail>
   185      /**
   188      /**
   186       * Two-phased constructor
   189       * Two-phased constructor
   187       */
   190       */
   188       void ConstructL( const NmMessage &aMessage );
   191       void ConstructL( const NmMessage &aMessage );
       
   192 // </qmail>
   189 
   193 
   190     /**
   194     /**
   191      * Returns content-type parameters and their associated values.
   195      * Returns content-type parameters and their associated values.
   192      * This function is made private to prevent usage from CFSMailMessage
   196      * This function is made private to prevent usage from CFSMailMessage
   193      *
   197      * 
   194      * @return content type parameters
   198      * @return content type parameters
   195      */
   199      */
   196   CDesCArray& ContentTypeParameters();
   200     CDesCArray& ContentTypeParameters();
   197 
   201 
   198  private: // data
   202  private: // data
   199     //<qmail>
   203     //<qmail>
   200     // Array is used to pass self pointer as RPointerArray reference to plugin funstion
   204     // Array is used to pass self pointer as RPointerArray reference to plugin funstion
   201     // Do not destroy its content (just Reset)!
   205     // Do not destroy its content (just Reset)!