meetingui/meetingrequestutils/inc/CMRUtilsEmailSender.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     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 *       Class which takes care of e-mail editing and sending.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __CMRUTILSEMAILSENDER_H__
       
    22 #define __CMRUTILSEMAILSENDER_H__
       
    23 
       
    24 //  INCLUDES
       
    25 #include <e32base.h>
       
    26 #include <msvstd.h>
       
    27 #include <CMRUtils.h>
       
    28 #include "CMRUtilsInternal.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CCalSession;
       
    32 class CCalEntry;
       
    33 class MMRUtilsObserver;
       
    34 class CClientMtmRegistry;
       
    35 class CSendUi;
       
    36 class CMessageData;
       
    37 class CStringResourceReader;
       
    38 
       
    39 // CLASS DECLARATION
       
    40 
       
    41 /**
       
    42 * Interface for a class which takes care of e-mail editing and sending.
       
    43 */
       
    44 class MMRUtilsEmailSender
       
    45     {
       
    46     public: // Constructors and destructors
       
    47     
       
    48         /**
       
    49         * Destructor, allows deletion through this interface.
       
    50         */
       
    51         virtual ~MMRUtilsEmailSender() {};    
       
    52             
       
    53      public: // New functions
       
    54      
       
    55         /**
       
    56         * @see CMRUtils
       
    57         */
       
    58         virtual void ReplyToL( CMRUtilsInternal::TMailRecipients aRecipients,
       
    59                                const CCalEntry& aCalEntry,
       
    60                                TMsvId aMailBox,
       
    61                                const TDesC& aSenderAddr ) = 0;
       
    62     
       
    63         /**
       
    64         * @see CMRUtils
       
    65         */
       
    66         virtual void SendL( const CCalEntry& aCalEntry, TMsvId aMailBox ) = 0;        
       
    67     };
       
    68 
       
    69 /**
       
    70 * Implementation class for MMRUtilsEmailSender interface.
       
    71 */
       
    72 class CMRUtilsEmailSender : public CBase, public MMRUtilsEmailSender
       
    73     {
       
    74     public: // Constructors and destructors
       
    75 
       
    76         /**
       
    77         * Symbian two-phased constructor.
       
    78         * @param aCalSession calendar session reference
       
    79         * @param aObserver observer reference
       
    80         * @return instantiated object
       
    81         */
       
    82         static CMRUtilsEmailSender* NewL( CCalSession& aCalSession );        
       
    83 
       
    84         /**
       
    85         * Destructor.
       
    86         */
       
    87         ~CMRUtilsEmailSender();
       
    88 
       
    89     public: // From MMRUtilsEmailSender
       
    90     
       
    91         void ReplyToL( CMRUtilsInternal::TMailRecipients aRecipients,
       
    92                        const CCalEntry& aCalEntry,
       
    93                        TMsvId aMailBox,
       
    94                        const TDesC& aSenderAddr );
       
    95     
       
    96         void SendL( const CCalEntry& aCalEntry, TMsvId aMailBox );
       
    97         
       
    98     protected: // New functions
       
    99 
       
   100         /**
       
   101         * Helper function which adds recipients determined by aRecipients
       
   102         * to aMsgData.
       
   103         * @param aRecipients enumeration
       
   104         * @param aCalEntry calendar entry containing attendees
       
   105         * @param aSenderAddr sender's e-mail address
       
   106         * @param aMsgData data where recipients are added
       
   107         */
       
   108         void AddRecipientsToMsgL( CMRUtilsInternal::TMailRecipients aRecipients,
       
   109                                   const CCalEntry& aCalEntry,
       
   110                                   const TDesC& aSenderAddr,
       
   111                                   CMessageData& aMsgData ) const;
       
   112           
       
   113         /**
       
   114         * Helper function which adds recipients determined by aCalEntry
       
   115         * method (request, cancel etc.) to aMsgData.
       
   116         * @param aCalEntry calendar entry containing attendees
       
   117         * @param aMsgData data where recipients are added
       
   118         */                                            
       
   119         void AddRecipientsToMsgL( const CCalEntry& aCalEntry,
       
   120                                   CMessageData& aMsgData ) const;
       
   121                                  
       
   122         /**
       
   123         * Helper function which adds one recipient to aMsgData, leaves with
       
   124         * KErrArgument if aRecipient is NULL or does not have e-mail address.
       
   125         * @param aRecipient calendar user, ownership not transferred
       
   126         * @param aMsgData data where recipient is added
       
   127         */ 
       
   128         void AddRecipientToMsgL( const CCalUser* aRecipient,
       
   129                                  CMessageData& aMsgData ) const;                                 
       
   130 
       
   131         /**
       
   132         * Helper function which creates e-mail subject with prefix.
       
   133         * @param aSubject subject without prefix
       
   134         * @param aReply ETrue if reply, EFalse if forward
       
   135         * @return new subject string, ownership transferred
       
   136         */                                  
       
   137         HBufC* CreateSubjectPrefixStringL( const TDesC& aSubject,
       
   138                                            TBool aReply ) const;
       
   139 
       
   140         /**
       
   141         * Helper function which sets method (e.g. "REPLY") to aString.
       
   142         * @param aString string to contain method
       
   143         * @param aCalEntry entry which specifies the method
       
   144         */                                                                             
       
   145         void SetMethodStringL( TDes8& aString,
       
   146                                const CCalEntry& aCalEntry );
       
   147                                
       
   148         
       
   149         /**
       
   150         * Used with TCleanupOperation to delete tmp attachment file.
       
   151         * @param aPtr, HBufC pointer to attachment file name
       
   152         */             
       
   153         static void CleanupTmpAttachment( TAny* aPtr );                                                 
       
   154         
       
   155     protected: // Constructors and destructors
       
   156     
       
   157         /**
       
   158         * C++ default constructor.
       
   159         * @param aCalSession calendar session reference
       
   160         * @param aObserver observer reference
       
   161         */
       
   162         CMRUtilsEmailSender( CCalSession& aCalSession );
       
   163 
       
   164         /**
       
   165         *  Constructor, second phase.
       
   166         */
       
   167         void ConstructL();            
       
   168         
       
   169     protected: // data
       
   170     
       
   171         // File server session
       
   172         RFs iFs;
       
   173     
       
   174         // Calendar session
       
   175         CCalSession& iCalSession;
       
   176                 
       
   177         // Resource reader, own
       
   178         CStringResourceReader* iResReader;
       
   179         
       
   180         // SendUi, own
       
   181         CSendUi* iSendUi;
       
   182     };
       
   183 
       
   184 #endif // __CMRUTILSEMAILSENDER_H__
       
   185 
       
   186 // End of File