Imap4Mail.h
上传用户:sempras
上传日期:2007-03-04
资源大小:821k
文件大小:2k
- #ifndef __IMAP4MAIL_H__
- #define __IMAP4MAIL_H__
- #include <msvapi.h>
- #include <ckncancl.h>
- #include <ImapConnectionObserver.h>
- #include "impcmtm.h"
- class CImap4ClientMtm;
- class CMsvEmailUtils;
- /*
- * ============================================================================
- * Name : CImap4Mail from Imap4Mail.h
- * Part of : EmailExample
- * Created : 09/11/2003 by Forum Nokia
- * Implementation notes:
- * Engine class that wraps some Imap4 functionality.
- * Implemented as statemachine.
- *
- * Version : 1.0
- * Copyright: Nokia Corporation
- * ============================================================================
- */
- class CImap4Mail : public CActive, public MMsvSessionObserver,public MCknCancellableOperation
- {
- public:
- // creational
- static CImap4Mail* NewL(TRequestStatus& aStatus,CMsvSession& aMsvSession);
- ~CImap4Mail();
- // interface
- /*
- * SyncWithRemoteServerL(TMsvId aMailId=NULL)
- *
- * only interface method which initiates multiple state process which
- * connects to remote mailbox and synchronizes folders and message headers
- * from remote server.
- *
- * Params:
- * (1) TMsvId aMailId initial entry id
- *
- */
- void SyncWithRemoteServerL(TMsvId aMailId=NULL);
- // private functions
- private:
- CImap4Mail(TRequestStatus& aStatus,CMsvSession& aMsvSession);
- void ConstructL();
- // state handlers
- void ExecuteConnectL();
- void ExecuteSyncL();
- void ExecuteWaitSyncL();
- void ExecuteDisconnectL();
- // helpers
- void MailCommandL(TInt aCommand,TDes8& aParams);
- void LoadMtmL();
- void Queue();
- // from CActive
- void RunL();
- void DoCancel();
- TInt RunError(TInt aError);
- // from MCknCancellableOperation
- void CancelOperation();
- // from MMsvSessionObserver
- void HandleSessionEventL(TMsvSessionEvent aEvent,TAny* aArg1,TAny* aArg2,TAny* aArg3);
- // from MMsvImapConnectionObserver
- void HandleImapConnectionEvent( TImapConnectionEvent aConnectionState);
- // private state values for the state machine
- private:
- enum TInternalState
- {
- EInitialising,
- EReady,
- EConnecting,
- ESync,
- EWaitSync,
- EDisconnectRemote,
- EDisconnecting,
- ECanceling
- } ;
- // private data
- private:
- CMsvEmailUtils* iImap4Utils;
- TRequestStatus& iObserverStatus;
- CMsvSession& iMsvSession;
- CImap4ClientMtm* iImap4Mtm;
- TMsvId iServiceId;
- CMsvOperation* iOperation;
- CCknCancelDialog* iDialog;
- TInternalState iState;
- CMsvEntrySelection* iMsvSelection;
- TMsvId iMailId;
- };
- #endif //__Imap4_H__