⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 emailexampleengine.h

📁 基于symbian的收发SMS、MMS消息
💻 H
字号:
#ifndef __EMAILEXAMPLEENGINE_H__
#define __EMAILEXAMPLEENGINE_H__

#include <e32base.h>
#include <msvapi.h>

#include <imapset.h>
#include <pop3set.h>


enum TProtocolType
	{
	EProtocolPop3,
	EProtocolImap4
	};

enum TEmailExampleEngineEvent
	{
	ERemoteCountChanged,
	};

/*
* ============================================================================
*  Name     : MEmailExampleEngineObserver from EmailExampleEngine.h
*  Part of  : EmailExample
*  Created  : 09/11/2003 by Forum Nokia
*  Implementation notes:
*		Common observer to handle asynchronous events conserning engine
*
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

class MEmailExampleEngineObserver
	{
public:
	virtual void HandleEngineChangedEventL(TEmailExampleEngineEvent aEvent)=0;
	};

class CBaseMtm;
class CMtmStore;
class CClientMtmRegistry;
class CImap4Mail;
class CPop3Mail;

/*
* ============================================================================
*  Name     : CEmailExampleEngine from EmailExampleEngine.h
*  Part of  : EmailExample
*  Created  : 09/11/2003 by Forum Nokia
*  Implementation notes:
*		Statemachine which handles events common for both
*		implemented protocols IMAP and POP.
*		Note for instructional purposes the structure is kept
*		so that most functions are implemented in 2 versions
*		one for imap one for pop. Leaving other protocol out
*		for advanced exercises is though trivial.
*
*  Version  : 1.0
*  Copyright: Nokia Corporation
* ============================================================================
*/

class CEmailExampleEngine : public CActive, public MMsvSessionObserver
	{
public:
// creational
	static CEmailExampleEngine* NewL(MEmailExampleEngineObserver& aObserver);
	~CEmailExampleEngine();

// interface

    /*
    * HandleCmdRemoteFetchL()
    *
    * Calls remote mailbox download function of selected protocol type.
	*
    * Returns:
    *					KErrNone if everything went like planned
    *
    */
	TInt  HandleCmdRemoteFetchL();

	/*
    * RemoteOpenEmailL(TInt aIndex)
    *
    * Uses generic messaging architecture and opens selected message entry.
	* May generate dial-up connection to fetch message body.
    *
    * Params:
    *	(1) TInt aIndex		index to message entry to be opened
    *
    */
	void  RemoteOpenEmailL(TInt aIndex);

	/*
    * Settings()
    *
    * Initiates selection dialog which gives user the possibility
	* to change internet email protocol used.
    *
    */
	void Settings();

	TBool HandleAccountNotDefined();
	TPtrC RemoteEmailTextL(TInt aIndex);
	TPtrC RemoteEmailSenderL(TInt aIndex);
	TInt  RemoteEmailCount();

// private functions
private:
	CEmailExampleEngine(MEmailExampleEngineObserver& aObserver);
	void ConstructL();
	CMsvEntrySelection* UpdateEntriesL(const TMsvId& aServiceId);
	void OpenEmailL(TMsvId& aEntryId);

	//IMAP/POP common
	void UpdateRemoteCountL();

	//IMAP specific
	TBool Imap4AccountNotDefined();
	TInt SyncWithRemoteServerImap4L();
	void UpdateRemoteCountImap4L();

	//POP specific
	TBool Pop3AccountNotDefined();
	TInt  FetchRemoteMailPop3L();
	void UpdateRemoteCountPop3L();

	void SetProtocolType( TInt aProtocolType );

// from CActive
	void RunL();
	void DoCancel();
	TInt RunError(TInt aError);

// from MMsvSessionObserver
    void HandleSessionEventL(TMsvSessionEvent aEvent,TAny* aArg1,TAny* aArg2,TAny* aArg3);

// private types
private:
	// internal state indication
	enum TInternalState
		{
		EInitialising,
		EReadyButNeedsUpdating,
		EReady,
		EEditing,
		EWaitingForImap4,
		ESyncImap4,
		EWaitingForPop3,
		EFetchingPop3,
		};
// private data
private:
	MEmailExampleEngineObserver& iObserver;
    CMsvSession* iMsvSession;
	CClientMtmRegistry* iMtmReg;
	CMtmStore* iMtmStore;
	TInternalState iState;
	CMsvEntry* iEntry;
	CMsvEntrySelection* iRemoteEntries;
	TInt iRemoteCount;

	CImap4Mail* iImapMail;
	TBool iNoImap4defined;

	CPop3Mail* iPopMail;
	TBool iNoPop3defined;

public:
	TInt iSettingProtocolType;
	TInt iProtocolType;
	};

#endif // __EMAILEXAMPLEENGINE_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -