1.1 --- a/epoc32/include/popcmtm.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/popcmtm.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,233 @@
1.4 -popcmtm.h
1.5 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// Client MTM for the POP3 protocol
1.19 +//
1.20 +//
1.21 +
1.22 +
1.23 +#if !defined (__POPCMTM_H__)
1.24 +#define __POPCMTM_H__
1.25 +
1.26 +#if !defined (__MIUTMSG_H__)
1.27 +#include <miutmsg.h>
1.28 +#endif
1.29 +#if !defined (__MIUTPARS_H__)
1.30 +#include <miutpars.h> //TImMessageField
1.31 +#endif
1.32 +#if !defined (__POP3CMDS_H__)
1.33 +#include <pop3cmds.h> // KPOP3MTMConnect etc
1.34 +#endif
1.35 +#if !defined (__POP3SET_H__)
1.36 +#include <pop3set.h> // KPOP3MTMConnect etc
1.37 +#endif
1.38 +
1.39 +class CImPOP3GetMail;
1.40 +class CImEmailAutoSend;
1.41 +
1.42 +/////// Pop3 Client MTM /////////////////////////////////////////////////////////////////////////////
1.43 +class CPop3ClientMtm : public CBaseMtm
1.44 +/** POP3 client MTM interface.
1.45 +
1.46 +Most of the functions in this class are implementations of the virtual functions
1.47 +defined by the base class CBaseMtm.
1.48 +@publishedAll
1.49 +@released
1.50 +*/
1.51 + {
1.52 +/**
1.53 +@deprecated
1.54 +*/
1.55 +
1.56 +public:
1.57 + enum TImPopcNewEmailHeaderType
1.58 + {
1.59 + EForwardedEmail,
1.60 + EReplyToEmail,
1.61 + EReceiptToEmail
1.62 + };
1.63 +
1.64 +public:
1.65 + IMPORT_C static CPop3ClientMtm* NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
1.66 + ~CPop3ClientMtm();
1.67 +
1.68 + void SaveMessageL();
1.69 + void LoadMessageL();
1.70 +
1.71 + IMPORT_C void StoreSettingsL();
1.72 + IMPORT_C void RestoreSettingsL();
1.73 +
1.74 + CMsvOperation* ReplyL (TMsvId aId, TMsvPartList aPartlist, TRequestStatus& aCompletionStatus);
1.75 + CMsvOperation* ForwardL(TMsvId aId, TMsvPartList aPartList, TRequestStatus& aCompletionStatus);
1.76 +
1.77 + TUint ValidateMessage(TMsvPartList aPartList);
1.78 + TMsvPartList Find(const TDesC& aTextToFind, TMsvPartList aPartList);
1.79 +
1.80 + void AddAddresseeL(const TDesC& aRealAddress);
1.81 + void AddAddresseeL(const TDesC& aRealAddress, const TDesC& aAlias);
1.82 + void RemoveAddressee(TInt aIndex);
1.83 +
1.84 + IMPORT_C void SetSettingsL(const CImPop3Settings& aSettings);
1.85 + IMPORT_C const CImPop3Settings& Settings() const;
1.86 +
1.87 + // --- RTTI functions ---
1.88 + TInt QueryCapability(TUid aCapability, TInt& aResponse);
1.89 + void InvokeSyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter);
1.90 + CMsvOperation* InvokeAsyncFunctionL(TInt aFunctionId, const CMsvEntrySelection& aSelection, TDes8& aParameter, TRequestStatus& aCompletionStatus);
1.91 +
1.92 + // Attachment functions to support the SendAs API
1.93 + IMPORT_C virtual void AddAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.94 + IMPORT_C virtual void AddAttachmentL(RFile& aFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.95 + IMPORT_C virtual void AddLinkedAttachmentL(const TDesC& aFilePath, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.96 + IMPORT_C virtual void AddEntryAsAttachmentL(TMsvId aAttachmentId, TRequestStatus& aStatus);
1.97 + EXPORT_C virtual void CreateAttachmentL(const TDesC& aFileName, RFile& aAttachmentFile, const TDesC8& aMimeType, TUint aCharset, TRequestStatus& aStatus);
1.98 + IMPORT_C virtual void CreateMessageL(TMsvId aServiceId);
1.99 +
1.100 + IMPORT_C virtual TMsvId DefaultServiceL() const;
1.101 + IMPORT_C virtual void RemoveDefaultServiceL();
1.102 + IMPORT_C virtual void ChangeDefaultServiceL(const TMsvId& aService);
1.103 +
1.104 +protected:
1.105 + CPop3ClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession);
1.106 + void ConstructL();
1.107 + void ContextEntrySwitched();
1.108 +
1.109 +private:
1.110 + TBool ValidateAddress(const TPtrC& anAddress);
1.111 + void SendOnNextConnectionL();
1.112 + TMsvPartList DoFindL(const TDesC& aTextToFind, TMsvPartList aPartList);
1.113 + CMsvEntrySelection* FilteredChildrenLC(TBool aNewOnly, TInt aMaxEmailSize);
1.114 + CMsvEntrySelection* FilteredSelectionLC(TInt aMaxEmailSize, const CMsvEntrySelection& aSelection);
1.115 +
1.116 +
1.117 +
1.118 +private:
1.119 + CImPop3Settings* iImPop3Settings;
1.120 + TImMessageField iTImMessageField;
1.121 + CImHeader* iHeader;
1.122 +
1.123 + HBufC* iEmailAddressFormatString; // defines format of email address used by "Send as" API eg _LIT("/"%S/" <%S>")
1.124 + CImEmailOperation* iImEmailOperation;
1.125 + CImPOP3GetMail* iImPOP3GetMail;
1.126 + };
1.127 +
1.128 +
1.129 +class CImPOP3GetMail : public CMsvOperation
1.130 +/** Encapsulates an operation to copy/move POP3 emails from the remote inbox to
1.131 +any local folder.
1.132 +
1.133 +Functionality is provided to:
1.134 +
1.135 +1. copy/move any new emails
1.136 +
1.137 +2. copy/move a selection of emails
1.138 +
1.139 +3. copy/move all emails
1.140 +
1.141 +4. in the Remote Inbox to a local folder.
1.142 +
1.143 +There are three cases for copying/moving the emails from the Remote Inbox:
1.144 +
1.145 +1. the user is connected to the account so just copy/move the emails
1.146 +
1.147 +2. the user is not connected to the account so connect, copy/move the emails,
1.148 +and then disconnect
1.149 +
1.150 +3. the user is not connected to the account so connect, copy/move the emails,
1.151 +and then stay online
1.152 +
1.153 +Objects of this type are returned from CPop3ClientMtm::InvokeAsyncFunctionL()
1.154 +when a suitable get command is requested.
1.155 +@publishedAll
1.156 +@released
1.157 +*/
1.158 + {
1.159 +public:
1.160 + /** Defines types of get mail operation. */
1.161 + enum TImPOP3GetMailType
1.162 + {
1.163 + /** Connect and copy new mail and stay online. */
1.164 + EConnectAndCopyNewMailAndStayOnline,
1.165 + /** Connect and copy new mail and disconnect. */
1.166 + EConnectAndCopyNewMailAndDisconnect,
1.167 + /** Connect and move new mail and stay online. */
1.168 + EConnectAndMoveNewMailAndStayOnline,
1.169 + /** Connect and move new mail and disconnect. */
1.170 + EConnectAndMoveNewMailAndDisconnect,
1.171 + /** Connect and copy mail selection and stay online. */
1.172 + EConnectAndCopyMailSelectionAndStayOnline,
1.173 + /** Connect and copy mail selection and disconnect. */
1.174 + EConnectAndCopyMailSelectionAndDisconnect,
1.175 + /** Connect and move mail selection and stay online. */
1.176 + EConnectAndMoveMailSelectionAndStayOnline,
1.177 + /** Connect and move mail selection and disconnect. */
1.178 + EConnectAndMoveMailSelectionAndDisconnect,
1.179 + /** Connect and copy all mail and stay online. */
1.180 + EConnectAndCopyAllMailAndStayOnline,
1.181 + /** Connect and copy all mail and disconnect. */
1.182 + EConnectAndCopyAllMailAndDisconnect,
1.183 + /** Connect and move all mail and stay online. */
1.184 + EConnectAndMoveAllMailAndStayOnline,
1.185 + /** Connect and move all mail and disconnect. */
1.186 + EConnectAndMoveAllMailAndDisconnect
1.187 + };
1.188 +
1.189 +public:
1.190 + IMPORT_C CMsvOperation* GetMailL(CPop3ClientMtm& aPop3ClientMtm, TRequestStatus& aObserverRequestStatus, const CMsvEntrySelection& aMsvEntrySelection, TDes8& aPop3GetMailInfo, TImPOP3GetMailType aPOP3GetMailType);
1.191 + IMPORT_C const TDesC8& FinalProgress();
1.192 + IMPORT_C ~CImPOP3GetMail();
1.193 + void DoCancel();
1.194 + void RunL();
1.195 + const TDesC8& ProgressL();
1.196 +private:
1.197 + CImPOP3GetMail(CMsvSession& aMsvSession, TRequestStatus& aObserverRequestStatus, CPop3ClientMtm& aPop3ClientMtm, TImPOP3GetMailType aPOP3GetMailType);
1.198 + void ConstructL(const CMsvEntrySelection& aMsvEntrySelection, TDes8& aPop3GetMailInfo);
1.199 + void SelectNextStateL(); // selects next state to go to
1.200 + void ChangeStateL(); // initiates the next state operation
1.201 + void SelectAndChangeToNextStateL();
1.202 + void RequestComplete(TInt aError);
1.203 + void Complete();
1.204 + void ConnectToMailboxL();
1.205 + void CopyMoveNewMessagesL(TBool aCopy);
1.206 + void CopyMoveMessageSelectionL(TBool aCopy);
1.207 + void CopyMoveAllMessagesL(TBool aCopy);
1.208 + void DisconnectFromMailboxL();
1.209 + void ResetProgress();
1.210 + void StoreProgressL();
1.211 +private:
1.212 + enum TImPOP3GetMailState
1.213 + {
1.214 + EConnectToMailbox,
1.215 + ECopyNewMessages,
1.216 + EMoveNewMessages,
1.217 + ECopyMessageSelection,
1.218 + EMoveMessageSelection,
1.219 + ECopyAllMessages,
1.220 + EMoveAllMessages,
1.221 + EDisconnectFromMailbox,
1.222 + EFinished
1.223 + };
1.224 +
1.225 + CPop3ClientMtm& iPop3ClientMtm;
1.226 + CMsvEntrySelection* iMsvEntrySelection;
1.227 + CMsvOperation* iMsvOperation;
1.228 +
1.229 + TPop3Progress iProgress;
1.230 + TPop3Progress iErrorProgress;
1.231 + TImPOP3GetMailState iState;
1.232 + TImPOP3GetMailType iPOP3GetMailType;
1.233 + TPckgBuf<TPop3Progress> iProgressBuf;
1.234 + TPckgBuf<TImPop3GetMailInfo> iPop3GetMailInfo;
1.235 + };
1.236 +
1.237 +#endif // __POPCMTM_H__