meetingrequest/mrtasks/inc/cesmrfsemailmanager.h
branchRCL_3
changeset 12 4ce476e64c59
parent 11 0396474f30f5
child 13 8592a65ad3fb
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
       
     2 * Copyright (c) 2007-2009 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:  Class encapsulating FS email sending
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_ESMRFSEMAILMANAGER_H
       
    20 #define C_ESMRFSEMAILMANAGER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 //<cmail>
       
    24 #include "cfsmailcommon.h"
       
    25 #include "mmrinfoprocessor.h"
       
    26 #include "esmrdef.h"
       
    27 //</cmail>
       
    28 
       
    29 class CFSMailBox;
       
    30 class CFSMailMessage;
       
    31 class CFSMailMessagePart;
       
    32 class CFSMailClient;
       
    33 class CMRMailboxUtils;
       
    34 class TESMRInputParams;
       
    35 
       
    36 /**
       
    37  *  Class definition for FS Email manager class. This class encapsulates
       
    38  *  all mail sending acitivities with FS EMail framework.
       
    39  *
       
    40  *  @lib esmrtasks.lib
       
    41  */
       
    42 NONSHARABLE_CLASS( CESMRFSEMailManager ) : public CBase
       
    43     {
       
    44 public:
       
    45     /** Enumeration for text/calendar part */
       
    46     enum TESMRMethod
       
    47         {
       
    48         EESMRMethodRequest,     // Request
       
    49         EESMRMethodResponse,    // response
       
    50         EESMRMethodCancel       // cancellation
       
    51         };
       
    52 
       
    53 public: // Construction and destruction
       
    54     /**
       
    55      * Creates and initializes new CESMRSendMRRespFSEmailTask object.
       
    56      * Ownership is transferred to caller.
       
    57      * @param aMRMailboxUtils Reference to mailbox utilities
       
    58      */
       
    59     static CESMRFSEMailManager* NewL(
       
    60             CMRMailboxUtils& aMRMailboxUtils );
       
    61 
       
    62     /**
       
    63      * C++ destructor.
       
    64      */
       
    65     ~CESMRFSEMailManager();
       
    66 
       
    67     /**
       
    68      * Prepares email manager to be used for sending meeting
       
    69      * request.
       
    70      *
       
    71      * @param aMailboxOwnerAddr mailbox owner's email address
       
    72      */
       
    73     void PrepareForSendingL(
       
    74             const TDesC& aMailboxOwnerAddr );
       
    75 
       
    76     /**
       
    77      * Prepares email manager to be used for sending reply
       
    78      * message.
       
    79      *
       
    80      * @param aMailboxOwnerAddr mailbox owner's email address
       
    81      * @param aMsgId original message's id
       
    82      * @param aReplyAll is this reply for all participants
       
    83      */
       
    84     void PrepareForSendingReplyL(
       
    85             const TDesC& aMailboxOwnerAddr,
       
    86             const TFSMailMsgId& aMsgId,
       
    87             TBool aReplyAll );
       
    88 
       
    89     /**
       
    90      * Sets sender to email message
       
    91      * @param aAddress Sender's email address
       
    92      * @param aCommonName Sender's common name
       
    93      */
       
    94     void SetSenderL(
       
    95             const TDesC& aAddress,
       
    96             const TDesC& aCommonName );
       
    97 
       
    98     /**
       
    99      * Sets reply to address to email message
       
   100      * @param aAddress Email address
       
   101      * @param aCommonName Common name
       
   102      */
       
   103     void SetReplyToAddressL(
       
   104             const TDesC& aAddress,
       
   105             const TDesC& aCommonName );
       
   106     
       
   107     /**
       
   108      * Sets recipient to <to> field
       
   109      * @param aAddress Recipient's email address
       
   110      * @param aCommonName Recipient's common name
       
   111      */
       
   112     void AppendToRecipientL(
       
   113             const TDesC& aAddress,
       
   114             const TDesC& aCommonName );
       
   115 
       
   116     /**
       
   117      * Sets recipient to <cc> field
       
   118      * @param aAddress Recipient's email address
       
   119      * @param aCommonName Recipient's common name
       
   120      */
       
   121     void AppendCCRecipientL(
       
   122             const TDesC& aAddress,
       
   123             const TDesC& aCommonName );
       
   124 
       
   125     /**
       
   126      * Sets subject to email message
       
   127      * @param aSubject Email message's subject.
       
   128      */
       
   129     void SetSubjectL(
       
   130             const TDesC& aSubject);
       
   131 
       
   132     /**
       
   133      * Sets plain text part to email message.
       
   134      * @param aPlainText Plain text context
       
   135      */
       
   136     void CreateTextPlainPartL(
       
   137             const TDesC& aPlainText);
       
   138 
       
   139     /**
       
   140      * Sets calendar part to email message.
       
   141      * @param aCalendarMethod Calendar entry method.
       
   142      */
       
   143     void CreateTextCalendarPartL(
       
   144             TESMRMethod aCalendarMethod );
       
   145 
       
   146     /**
       
   147      * Sets calendar part to email message.
       
   148      * @param aCalendarMethod Calendar entry method.
       
   149      * @param aFilename File containing calendar part
       
   150      */
       
   151     void CreateTextCalendarPartL(
       
   152             TESMRMethod aCalendarMethod,
       
   153             const TDesC& aFilename );
       
   154 
       
   155     /**
       
   156      * Adds attachment to email message.
       
   157      * @param aAttachmentFile attachment filename.
       
   158      */
       
   159     void SetAttachmentL(
       
   160             const TDesC& aAttachmentFile );
       
   161 
       
   162     /**
       
   163      * Stores message to drafts folder.
       
   164      */
       
   165     TInt StoreMessageToDraftsFolderL();
       
   166 
       
   167     /**
       
   168      * Sends message.
       
   169      */
       
   170     TInt SendMessageL();
       
   171 
       
   172     /**
       
   173      *  Fetches mailbox id.
       
   174      *  @return Mailbox id
       
   175      */
       
   176     TFSMailMsgId MailboxId() const;
       
   177 
       
   178     /**
       
   179      * Send MRINFO object via mail framework
       
   180      * @param aParam Reference to ESMR input parameters
       
   181      * @param aInfoObject Reference to MRINFO object
       
   182      * @param aResponseMode Response mode definition.
       
   183      * @param aFreeResponseText Free response text
       
   184      */
       
   185     void SendMailViaSyncL(
       
   186             TESMRInputParams& aParams,
       
   187             MMRInfoObject& aInfoObject,
       
   188             MMRInfoProcessor::TMRInfoResponseMode aResponseMode,
       
   189             const TDesC& aFreeResponseText );
       
   190 
       
   191     /**
       
   192      *  Fetches message id.
       
   193      *  @return Message id
       
   194      */
       
   195     TFSMailMsgId MessageId() const;
       
   196 
       
   197     /**
       
   198      *  Fetches message folder id.
       
   199      *  @return Message folder id
       
   200      */
       
   201     TFSMailMsgId MessageFolderId() const;
       
   202 
       
   203 private:
       
   204     CESMRFSEMailManager(
       
   205             CMRMailboxUtils& aMRMailboxUtils );
       
   206 
       
   207     void ConstructL();
       
   208 
       
   209     CFSMailBox* SelectMailBoxL(
       
   210             const TDesC& aMailboxOwnerAddr );
       
   211 
       
   212     CFSMailMessage* CreateMessageL();
       
   213 
       
   214     CFSMailMessagePart* CreateParentPartL();
       
   215 
       
   216     void AddPlainTextPartL(
       
   217             const TDesC& aContent );
       
   218 
       
   219     void AddMessagePartFromFileL(
       
   220             const TDesC& aContentType,
       
   221             const TDesC& aContentClass,
       
   222             const TDesC& aContentDescription,
       
   223             const TDesC& aContentDisposition,
       
   224             const TDesC& aFileAndPath );
       
   225 
       
   226 private: // Data
       
   227     /**
       
   228     * Reference to mailbox utilites
       
   229     * Not own.
       
   230     */
       
   231     CMRMailboxUtils& iMRMailboxUtils;
       
   232 
       
   233     /**
       
   234     * FS EMail client
       
   235     * Own.
       
   236     */
       
   237     CFSMailClient* iMailClient;
       
   238 
       
   239     /**
       
   240     * FS EMailBox
       
   241     * Own.
       
   242     */
       
   243     CFSMailBox*    iMailBox;
       
   244 
       
   245     /**
       
   246     * FS Mail message
       
   247     * Own.
       
   248     */
       
   249     CFSMailMessage* iMessage;
       
   250 
       
   251     /**
       
   252     * Parent message part
       
   253     * Not own.
       
   254     */
       
   255     CFSMailMessagePart* iParentPart;
       
   256     };
       
   257 
       
   258 #endif  // C_ESMRFSEMAILMANAGER_H