emailservices/emailcommon/inc/CFSMailMessageBase.h
changeset 18 578830873419
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 email base object
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CFSMAILMESSAGEBASE_H
       
    20 #define __CFSMAILMESSAGEBASE_H
       
    21 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 
       
    26 #include "CFSMailAddress.h"
       
    27 
       
    28 //<qmail>
       
    29 #include <QExplicitlySharedDataPointer>
       
    30 class NmMessageEnvelopePrivate;
       
    31 class NmMessageEnvelope;
       
    32 //</qmail>
       
    33 
       
    34 /**
       
    35  *  email handling base class
       
    36  *
       
    37  *  @lib FSFWCommonLib
       
    38  *  @since S60 v3.1
       
    39  */
       
    40 NONSHARABLE_CLASS ( CFSMailMessageBase ) : public CBase
       
    41 {
       
    42  public:
       
    43 
       
    44     /**
       
    45      * Two-phased constructor.
       
    46      *
       
    47      * @param aMessageId id of the email to be created
       
    48      */
       
    49      IMPORT_C static CFSMailMessageBase* NewL( const TFSMailMsgId aMessageId );
       
    50     
       
    51     /**
       
    52      * Two-phased constructor.
       
    53      *
       
    54      * @param aMessageId id of the email to be created
       
    55      */
       
    56      IMPORT_C static CFSMailMessageBase* NewLC( const TFSMailMsgId aMessageId );
       
    57  
       
    58     /**
       
    59      * Destructor.
       
    60      */  
       
    61      IMPORT_C virtual ~CFSMailMessageBase();
       
    62  
       
    63     /**
       
    64      * message id accessor
       
    65      *
       
    66      * @return message id
       
    67      */
       
    68      IMPORT_C TFSMailMsgId GetMessageId() const;
       
    69      
       
    70      /**
       
    71      * if email is related to another email, for example due reply / forward,
       
    72      * related email id is returned
       
    73      *
       
    74      * @return related email id
       
    75      */
       
    76      IMPORT_C TFSMailMsgId IsRelatedTo() const;
       
    77 
       
    78      /**
       
    79      * set email related to another email, for example due reply / forward
       
    80      *
       
    81      * @param aMessageId related email id
       
    82      */
       
    83      IMPORT_C void SetRelatedTo( const TFSMailMsgId aMessageId );
       
    84 
       
    85     /**
       
    86      * email parent folder id accessor
       
    87      *
       
    88      * @returns parent folder id
       
    89      */
       
    90      IMPORT_C TFSMailMsgId GetFolderId() const ;
       
    91 
       
    92     /**
       
    93      * email parent folder id mutator
       
    94      *
       
    95      * @param aFolderId parent folder id
       
    96      */
       
    97      IMPORT_C void SetFolderId( const TFSMailMsgId aFolderId );
       
    98 
       
    99     /**
       
   100      * email mailbox id accessor
       
   101      *
       
   102      * @returns mailbox id
       
   103      */
       
   104      IMPORT_C TFSMailMsgId GetMailBoxId() const ;
       
   105 
       
   106     /**
       
   107      * email mailbox id mutator
       
   108      *
       
   109      * @param aMailBoxId mailbox id
       
   110      */
       
   111      IMPORT_C void SetMailBoxId( const TFSMailMsgId aMailBoxId );
       
   112 
       
   113     /**
       
   114      * email sender address accessor
       
   115      *
       
   116      * @return email sender address, ownership not transferred to user
       
   117      */
       
   118      IMPORT_C CFSMailAddress* GetSender() const;
       
   119 
       
   120     /**
       
   121      * email sender address mutator
       
   122      *
       
   123      * @param aSender email sender address, ownership transferred from user
       
   124      */
       
   125      IMPORT_C void SetSender( CFSMailAddress* aSender );
       
   126 
       
   127     /**
       
   128      * returns TO-recipients list of email
       
   129      *
       
   130      * @return to-recipients list, ownership not transferred user
       
   131      */
       
   132      IMPORT_C RPointerArray<CFSMailAddress> GetToRecipients();
       
   133 
       
   134     /**
       
   135      * returns CC-recipients list of email
       
   136      *
       
   137      * @return cc-recipients list, ownership not transferred user
       
   138      */
       
   139      IMPORT_C RPointerArray<CFSMailAddress> GetCCRecipients(  );
       
   140 
       
   141     /**
       
   142      * returns BCC-recipients list of email
       
   143      *
       
   144      * @return bcc-recipients list, ownership not transferred user
       
   145      */
       
   146      IMPORT_C RPointerArray<CFSMailAddress> GetBCCRecipients( );
       
   147 
       
   148     /**
       
   149      * appends one recipient to email TO-field, ownership transferred from user
       
   150      *
       
   151      * @param aRecipient new recipient email address
       
   152      */
       
   153      IMPORT_C void AppendToRecipient( CFSMailAddress* aRecipient );
       
   154 
       
   155     /**
       
   156      * appends one recipient to email CC-field, ownership transferred from user
       
   157      *
       
   158      * @param aRecipient new recipient email address 
       
   159      */
       
   160      IMPORT_C void AppendCCRecipient( CFSMailAddress* aRecipient );
       
   161 
       
   162     /**
       
   163      * appends one recipient to email BCC field, ownership transferred from user
       
   164      *
       
   165      * @param aRecipient new recipient email address
       
   166      */
       
   167      IMPORT_C void AppendBCCRecipient( CFSMailAddress* aRecipient );
       
   168 
       
   169     /**
       
   170      * clears email TO-recipients list
       
   171      *
       
   172      */
       
   173      IMPORT_C void ClearToRecipients();
       
   174 
       
   175     /**
       
   176      * clears email CC-recipients list
       
   177      *
       
   178      */
       
   179      IMPORT_C void ClearCcRecipients();
       
   180 
       
   181     /**
       
   182      * clears email BCC-recipients list
       
   183      *
       
   184      */
       
   185      IMPORT_C void ClearBccRecipients();
       
   186 
       
   187     /**
       
   188      * email subject accessor
       
   189      *
       
   190      * @return email subject, ownership not transferred user
       
   191      */
       
   192      IMPORT_C TDesC& GetSubject() const;
       
   193 
       
   194     /**
       
   195      * email subject mutator
       
   196      *
       
   197      * @param aSubject new email subject
       
   198      */
       
   199      IMPORT_C void SetSubject( const TDesC& aSubject );
       
   200 
       
   201     /**
       
   202      * email date accessor
       
   203      *
       
   204      * @return email date
       
   205      */
       
   206      IMPORT_C TTime GetDate() const;
       
   207 
       
   208     /**
       
   209      * email date mutator
       
   210      *
       
   211      * @param aDate new email date
       
   212      */
       
   213      IMPORT_C void SetDate( const TTime aDate );
       
   214 
       
   215     /**
       
   216      * email flags accessor
       
   217      *
       
   218      * @return email flags
       
   219      */
       
   220      IMPORT_C TInt GetFlags() const;
       
   221 
       
   222     /**
       
   223      * email flag set
       
   224      *
       
   225      * @aFlag email flag to be set
       
   226      */
       
   227      IMPORT_C void SetFlag( const TInt aFlag );
       
   228 
       
   229     /**
       
   230      * email flag reset
       
   231      *
       
   232      * @aFlag email flag to be reset
       
   233      */
       
   234      IMPORT_C void ResetFlag( const TInt aFlag );
       
   235 
       
   236     /**
       
   237      * test email flag is set
       
   238      *
       
   239      * @aFlag email flag to be tested
       
   240      * @return email flag status (set/reset)
       
   241      */
       
   242      IMPORT_C TBool IsFlagSet( const TInt aFlag ) const;
       
   243 
       
   244     /**
       
   245      * Email reply-to address accessor ; defines optional email address
       
   246      * that clients should use to send replies. Returns NULL pointer
       
   247      * if address is not set, ownership not transferred to user.
       
   248      *
       
   249      * @return email reply-to address
       
   250      */
       
   251      IMPORT_C const CFSMailAddress& GetReplyToAddress();
       
   252 
       
   253     /**
       
   254      * email reply-to address mutator, ownership transferred from user
       
   255      *
       
   256      * @param aReplyToAddress email reply-to address
       
   257      */
       
   258      IMPORT_C void SetReplyToAddress( CFSMailAddress* aReplyToAddress );
       
   259 
       
   260     // <qmail>
       
   261     /**
       
   262      * gets the new NmMessageEnvelope object
       
   263      *
       
   264      * @return NmMessageEnvelope object
       
   265      */
       
   266      IMPORT_C NmMessageEnvelope* GetNmMessageEnvelope();
       
   267     // </qmail>
       
   268 
       
   269  protected:
       
   270 
       
   271     /**
       
   272      * C++ default constructor.
       
   273      */
       
   274      CFSMailMessageBase();
       
   275 
       
   276     /**
       
   277      * ConstructL
       
   278      */
       
   279     IMPORT_C void ConstructL( const TFSMailMsgId aMessageId );      
       
   280 
       
   281     void ConstructL( const NmMessageEnvelope &aMessageEnvelope );
       
   282     
       
   283     /**
       
   284      * email message id mutator
       
   285      *
       
   286      * @param aMessageId message id to be set
       
   287      */
       
   288     IMPORT_C void SetMessageId( const TFSMailMsgId aMessageId );
       
   289    
       
   290     // <qmail>
       
   291     /**
       
   292      * Reference to QT side of the message meta data object.
       
   293      */
       
   294      QExplicitlySharedDataPointer<NmMessageEnvelopePrivate> iNmPrivateMessageEnvelope;
       
   295     // </qmail>
       
   296 
       
   297  private: // data
       
   298 
       
   299     /**
       
   300      * id of another email or part this object is related to
       
   301      * due some reason, like in reply or forward email use cases
       
   302      */
       
   303      TFSMailMsgId    iRelatedTo;
       
   304 
       
   305     /**
       
   306      * email mailbox id
       
   307      */
       
   308      TFSMailMsgId    iMailBoxId;
       
   309 
       
   310      /**
       
   311      * email parent folder id
       
   312      */
       
   313      TFSMailMsgId    iFolderId;
       
   314 
       
   315      /**
       
   316      * email sender address
       
   317      * do not use it directly!
       
   318      */
       
   319      CFSMailAddress*    iSender;
       
   320 
       
   321      /**
       
   322      * email reply-to address
       
   323      */
       
   324      CFSMailAddress*    iReplyTo;
       
   325 
       
   326     /**
       
   327      * email subject
       
   328      */
       
   329      mutable TPtrC    iSubjectPtr;
       
   330      
       
   331 };
       
   332 
       
   333 
       
   334 #endif // __CFSMAILMESSAGEBASE_H
       
   335 
       
   336