1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/app/smtcmtm.h Wed Mar 31 12:27:01 2010 +0100
1.3 @@ -0,0 +1,154 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// SMTCPMTM.H
1.18 +// Client MTM for the SMTP protocol
1.19 +//
1.20 +//
1.21 +
1.22 +#if !defined (__SMTCMTM_H__)
1.23 +#define __SMTCMTM_H__
1.24 +
1.25 +#if !defined (__E32BASE_H__)
1.26 +#include <e32base.h> // CActive, TFileName)
1.27 +#endif
1.28 +
1.29 +#if !defined(__BADESCA_H__)
1.30 +#include <badesca.h>
1.31 +#endif
1.32 +
1.33 +#if !defined (__MSVAPI_H__)
1.34 +#include <msvapi.h>
1.35 +#endif
1.36 +
1.37 +#if !defined (__MTCLBASE_H__)
1.38 +#include <mtclbase.h>
1.39 +#endif
1.40 +
1.41 +#if !defined (__MIUTHDR_H__)
1.42 +#include <miuthdr.h>
1.43 +#endif
1.44 +
1.45 +#if !defined (__MIUTPARS_H__)
1.46 +#include <miutpars.h> //TImMessageField
1.47 +#endif
1.48 +
1.49 +#if !defined (__MIUTMSG_H__)
1.50 +#include <miutmsg.h> //CImEmailMessage
1.51 +#endif
1.52 +
1.53 +#if !defined (__SMTPSET_H__)
1.54 +#include <smtpset.h>
1.55 +#endif
1.56 +
1.57 +#if !defined (__SMTPCMDS_H__)
1.58 +#include <smtpcmds.h>
1.59 +#endif
1.60 +
1.61 +class CMsvEntry;
1.62 +class CMtmDllRegistry;
1.63 +class CRichText;
1.64 +class TMsvEntry;
1.65 +class CRegisteredMtmDll;
1.66 +class CImSmtpSettings;
1.67 +class CMsvSession;
1.68 +class CImAttachmentWaiter;
1.69 +
1.70 +/////// Smtp Client MTM /////////////////////////////////////////////////////////////////////////////
1.71 +class CSmtpClientMtm : public CBaseMtm
1.72 +/** SMTP client MTM interface.
1.73 +
1.74 +Most of the functions in this class are implementations of the virtual functions
1.75 +defined by the base class CBaseMtm.
1.76 +@publishedAll
1.77 +@released
1.78 +*/
1.79 + {
1.80 +public:
1.81 + IMPORT_C static CSmtpClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
1.82 + ~CSmtpClientMtm();
1.83 +
1.84 + void SaveMessageL();
1.85 + void LoadMessageL();
1.86 +
1.87 + IMPORT_C void StoreSettingsL();
1.88 + IMPORT_C void RestoreSettingsL();
1.89 +
1.90 + CMsvOperation* ReplyL (TMsvId aReplyEntryId, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus);
1.91 + CMsvOperation* ForwardL(TMsvId aForwardEntryId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
1.92 +
1.93 + TMsvPartList ValidateMessage(TMsvPartList aPartList);
1.94 + TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
1.95 +
1.96 + // addresssee list (used by objects with no MTM knowledge)
1.97 + void AddAddresseeL(const TDesC& aRealAddress);
1.98 + void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
1.99 + void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress);
1.100 + void AddAddresseeL(TMsvRecipientType aType, const TDesC& aRealAddress, const TDesC& aAlias);
1.101 + void RemoveAddressee(TInt aIndex);
1.102 +
1.103 + IMPORT_C void SetSettingsL(const CImSmtpSettings& aSettings);
1.104 + IMPORT_C const CImSmtpSettings& Settings() const;
1.105 + IMPORT_C void SetSubjectL(const TDesC& aSubject);
1.106 + IMPORT_C const TPtrC SubjectL() const;
1.107 +
1.108 + // --- RTTI functions ---
1.109 + TInt QueryCapability(TUid aCapability, TInt& aResponse);
1.110 + void InvokeSyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter);
1.111 + CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId,const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus);
1.112 +
1.113 + // Attachment functions to support the SendAs API
1.114 + IMPORT_C virtual void AddAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.115 + IMPORT_C virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.116 + IMPORT_C virtual void AddLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.117 + IMPORT_C virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus);
1.118 + IMPORT_C virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.119 + IMPORT_C virtual void CreateMessageL(TMsvId aServiceId);
1.120 +
1.121 + IMPORT_C virtual TMsvId DefaultServiceL() const;
1.122 + IMPORT_C virtual void RemoveDefaultServiceL();
1.123 + IMPORT_C virtual void ChangeDefaultServiceL(const TMsvId& aService);
1.124 + IMPORT_C void CancelAttachmentOperation();
1.125 +
1.126 +protected:
1.127 + CSmtpClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
1.128 + void ConstructL();
1.129 +
1.130 + void ContextEntrySwitched(); // called after the context of this instance has been changed to another entry
1.131 +private:
1.132 + TBool ValidateAddress(const TPtrC& anAddress);
1.133 + void ResetData();
1.134 +
1.135 + void RestoreEmailMessageL();
1.136 + void StoreEmailMessageL();
1.137 + void SetAddresseeListL();
1.138 + void GetBodyTextL(CImEmailMessage& aMessage, TMsvId aMsvId);
1.139 + TInt32 GetAttachmentSizeL(CImEmailMessage& aMessage, TMsvId aMsvId);
1.140 + TMsvPartList DoFindL(const TDesC& aTextToFind, TMsvPartList aPartList);
1.141 +
1.142 +private:
1.143 + CMsvOperationActiveSchedulerWait* iWait;
1.144 + CImSmtpSettings* iImSmtpSettings;
1.145 + CImHeader* iHeader;
1.146 + HBufC* iSubject;
1.147 +
1.148 + TImMessageField iTImMessageField;
1.149 + HBufC* iEmailAddressFormatString; // defines format of email address used by "Send as" API eg _LIT("/"%S/" <%S>")
1.150 + CMsvEntrySelection* iEntrySelection;
1.151 + CImEmailOperation* iImEmailOperation;
1.152 + CImAttachmentWaiter* iAttachmentWaiter;
1.153 + CImEmailMessage* iEmailMessage;
1.154 + };
1.155 +
1.156 +
1.157 +#endif // __SMTCMTM_H__