diff -r e7aa27f58ae1 -r 578830873419 emailservices/emailcommon/inc/CFSMailMessageBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/emailservices/emailcommon/inc/CFSMailMessageBase.h Fri Apr 16 14:51:52 2010 +0300 @@ -0,0 +1,336 @@ +/* +* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: common email base object +* +*/ + + +#ifndef __CFSMAILMESSAGEBASE_H +#define __CFSMAILMESSAGEBASE_H + +#include +#include + + +#include "CFSMailAddress.h" + +// +#include +class NmMessageEnvelopePrivate; +class NmMessageEnvelope; +// + +/** + * email handling base class + * + * @lib FSFWCommonLib + * @since S60 v3.1 + */ +NONSHARABLE_CLASS ( CFSMailMessageBase ) : public CBase +{ + public: + + /** + * Two-phased constructor. + * + * @param aMessageId id of the email to be created + */ + IMPORT_C static CFSMailMessageBase* NewL( const TFSMailMsgId aMessageId ); + + /** + * Two-phased constructor. + * + * @param aMessageId id of the email to be created + */ + IMPORT_C static CFSMailMessageBase* NewLC( const TFSMailMsgId aMessageId ); + + /** + * Destructor. + */ + IMPORT_C virtual ~CFSMailMessageBase(); + + /** + * message id accessor + * + * @return message id + */ + IMPORT_C TFSMailMsgId GetMessageId() const; + + /** + * if email is related to another email, for example due reply / forward, + * related email id is returned + * + * @return related email id + */ + IMPORT_C TFSMailMsgId IsRelatedTo() const; + + /** + * set email related to another email, for example due reply / forward + * + * @param aMessageId related email id + */ + IMPORT_C void SetRelatedTo( const TFSMailMsgId aMessageId ); + + /** + * email parent folder id accessor + * + * @returns parent folder id + */ + IMPORT_C TFSMailMsgId GetFolderId() const ; + + /** + * email parent folder id mutator + * + * @param aFolderId parent folder id + */ + IMPORT_C void SetFolderId( const TFSMailMsgId aFolderId ); + + /** + * email mailbox id accessor + * + * @returns mailbox id + */ + IMPORT_C TFSMailMsgId GetMailBoxId() const ; + + /** + * email mailbox id mutator + * + * @param aMailBoxId mailbox id + */ + IMPORT_C void SetMailBoxId( const TFSMailMsgId aMailBoxId ); + + /** + * email sender address accessor + * + * @return email sender address, ownership not transferred to user + */ + IMPORT_C CFSMailAddress* GetSender() const; + + /** + * email sender address mutator + * + * @param aSender email sender address, ownership transferred from user + */ + IMPORT_C void SetSender( CFSMailAddress* aSender ); + + /** + * returns TO-recipients list of email + * + * @return to-recipients list, ownership not transferred user + */ + IMPORT_C RPointerArray GetToRecipients(); + + /** + * returns CC-recipients list of email + * + * @return cc-recipients list, ownership not transferred user + */ + IMPORT_C RPointerArray GetCCRecipients( ); + + /** + * returns BCC-recipients list of email + * + * @return bcc-recipients list, ownership not transferred user + */ + IMPORT_C RPointerArray GetBCCRecipients( ); + + /** + * appends one recipient to email TO-field, ownership transferred from user + * + * @param aRecipient new recipient email address + */ + IMPORT_C void AppendToRecipient( CFSMailAddress* aRecipient ); + + /** + * appends one recipient to email CC-field, ownership transferred from user + * + * @param aRecipient new recipient email address + */ + IMPORT_C void AppendCCRecipient( CFSMailAddress* aRecipient ); + + /** + * appends one recipient to email BCC field, ownership transferred from user + * + * @param aRecipient new recipient email address + */ + IMPORT_C void AppendBCCRecipient( CFSMailAddress* aRecipient ); + + /** + * clears email TO-recipients list + * + */ + IMPORT_C void ClearToRecipients(); + + /** + * clears email CC-recipients list + * + */ + IMPORT_C void ClearCcRecipients(); + + /** + * clears email BCC-recipients list + * + */ + IMPORT_C void ClearBccRecipients(); + + /** + * email subject accessor + * + * @return email subject, ownership not transferred user + */ + IMPORT_C TDesC& GetSubject() const; + + /** + * email subject mutator + * + * @param aSubject new email subject + */ + IMPORT_C void SetSubject( const TDesC& aSubject ); + + /** + * email date accessor + * + * @return email date + */ + IMPORT_C TTime GetDate() const; + + /** + * email date mutator + * + * @param aDate new email date + */ + IMPORT_C void SetDate( const TTime aDate ); + + /** + * email flags accessor + * + * @return email flags + */ + IMPORT_C TInt GetFlags() const; + + /** + * email flag set + * + * @aFlag email flag to be set + */ + IMPORT_C void SetFlag( const TInt aFlag ); + + /** + * email flag reset + * + * @aFlag email flag to be reset + */ + IMPORT_C void ResetFlag( const TInt aFlag ); + + /** + * test email flag is set + * + * @aFlag email flag to be tested + * @return email flag status (set/reset) + */ + IMPORT_C TBool IsFlagSet( const TInt aFlag ) const; + + /** + * Email reply-to address accessor ; defines optional email address + * that clients should use to send replies. Returns NULL pointer + * if address is not set, ownership not transferred to user. + * + * @return email reply-to address + */ + IMPORT_C const CFSMailAddress& GetReplyToAddress(); + + /** + * email reply-to address mutator, ownership transferred from user + * + * @param aReplyToAddress email reply-to address + */ + IMPORT_C void SetReplyToAddress( CFSMailAddress* aReplyToAddress ); + + // + /** + * gets the new NmMessageEnvelope object + * + * @return NmMessageEnvelope object + */ + IMPORT_C NmMessageEnvelope* GetNmMessageEnvelope(); + // + + protected: + + /** + * C++ default constructor. + */ + CFSMailMessageBase(); + + /** + * ConstructL + */ + IMPORT_C void ConstructL( const TFSMailMsgId aMessageId ); + + void ConstructL( const NmMessageEnvelope &aMessageEnvelope ); + + /** + * email message id mutator + * + * @param aMessageId message id to be set + */ + IMPORT_C void SetMessageId( const TFSMailMsgId aMessageId ); + + // + /** + * Reference to QT side of the message meta data object. + */ + QExplicitlySharedDataPointer iNmPrivateMessageEnvelope; + // + + private: // data + + /** + * id of another email or part this object is related to + * due some reason, like in reply or forward email use cases + */ + TFSMailMsgId iRelatedTo; + + /** + * email mailbox id + */ + TFSMailMsgId iMailBoxId; + + /** + * email parent folder id + */ + TFSMailMsgId iFolderId; + + /** + * email sender address + * do not use it directly! + */ + CFSMailAddress* iSender; + + /** + * email reply-to address + */ + CFSMailAddress* iReplyTo; + + /** + * email subject + */ + mutable TPtrC iSubjectPtr; + +}; + + +#endif // __CFSMAILMESSAGEBASE_H + +