📄 httpappview.h
字号:
/* Copyright (c) 2008, Nokia. All rights reserved */
#ifndef __HTTP_APPVIEW_H__
#define __HTTP_APPVIEW_H__
#include <coecntrl.h>
#include "Explorer.h"
#include <aknlists.h>
#include <flogger.h>
class CEikRichTextEditor; //编辑框
class CDocumentHandler;
/*!
class MDisplayData
view类提供给Explorer类的接口,实现文本的绘制以及获取接入点ID
*/
class MDisplayData
{
public:
virtual void SetStartWrite() =0;
virtual void WriteToFile(TDesC8& aData) =0;
virtual void KeyEventL(TInt aCode) =0;
virtual void SetEditText(TDesC8 aData) =0;
virtual void DisplayText(TDesC8& aData) =0;
virtual TUint32 GetIAPId() =0;
virtual void NextConnect() = 0;
virtual void SetUrl(TDesC8& aData) = 0;
virtual void NotifyState(TInt aTotalLen, TInt aDownLen) = 0;
};
struct IAPs
{
TBuf<52> name;
TUint32 id;
};
/*!
@class CHttpAppView
@discussion An instance of this class is the Application View object
for the Http example application
*/
class CHttpAppView : public CCoeControl,public MDisplayData
{
public:
/*!
@function NewL
@discussion Create a CHttpAppView object, which will draw itself to aRect
@param aRect The rectangle this view will be drawn to
@result A pointer to the created instance of CHttpAppView
*/
static CHttpAppView* NewL(const TRect& aRect);
/*!
@function NewLC
@discussion Create a CHttpAppView object, which will draw itself to aRect
@param aRect The rectangle this view will be drawn to
@result A pointer to the created instance of CHttpAppView
*/
static CHttpAppView* NewLC(const TRect& aRect);
/*!
@function ~CHttpAppView
@discussion Destroy the object
*/
~CHttpAppView();
void KeyEventL(TInt aCode);
public: // from CCoeControl
/*!
@function Draw
@discussion Draw this CHttpAppView to the screen
@param aRect The rectangle of this view that needs updating
*/
void Draw(const TRect& aRect) const;
virtual void SizeChanged();
TInt CountComponentControls() const; //来自CCoeControl
CCoeControl* ComponentControl(TInt aIndex) const; //来自CCoeControl
// HBufC16* ConvertToUnicode(TText* text);
/*
* 函数名称: WriteToFile
* 功能描述: 持久化接收到的数据
* 输入参数: aData 数据
*/
void WriteToFile(TDesC8& aData);
/*
* 函数名称: SetStartWrite
* 功能描述: 设置iStartWrite
*/
void SetStartWrite();
/*
* 函数名称: SetEditText
* 功能描述: 设置iRichEditor文本
* 输入参数: aData 文本
*/
void SetEditText(TDesC8 aData);
/*
* 函数名称: DisplayText
* 功能描述: 在iRichEditor显示文本
* 输入参数: aData 文本
*/
void DisplayText(TDesC8& aData);
/*
* 函数名称: EmbedLaunchFileL
* 功能描述: 调用系统程序打开文件
* 输入参数: aFile 文件路径
*/
void EmbedLaunchFileL(const TDesC& aFile);
/*
* 函数名称: GetGPRSIAPsFromIAPTableL
* 功能描述: 获取手机的所有接入点
* 输入参数: aList 保存得到的接入点
*/
void GetGPRSIAPsFromIAPTableL(CArrayPtrFlat<IAPs>* aList);
/*
* 函数名称: SetIAPId
* 功能描述: 设置用户选择的接入点
* 输入参数: aSel 接入点编号
*/
void SetIAPId(TUint32 aSel);
/*
* 函数名称: GetIAPId
* 功能描述: 获取接入点Id
* 返 回 值: 是否碰撞
*/
TUint32 GetIAPId();
void WriteLog(TDesC8& aLog);
void NextConnect();
void SetUrl(TDesC8& aData);
void NotifyState(TInt aTotalLen, TInt aDownLen);
void BeginCount();
void EndCount();
static TInt CountCallback(TAny* aPtr);
void CountCallback();
private:
CDocumentHandler* iDocHandler;
/*!
@function ConstructL
@discussion Perform the second phase construction of a CHttpAppView object
@param aRect The rectangle this view will be drawn to
*/
void ConstructL(const TRect& aRect);
/*!
@function CHttpAppView
@discussion Perform the first phase of two phase construction
*/
CHttpAppView();
public:
//explorer指针
CExplorer* iExplorer;
//保存手机中的所有接入点名和ID
CArrayPtrFlat<IAPs>* iIAPs;
public:
//编缉框
CEikRichTextEditor* iRichEditor;
//是否开始接入数据
TBool iStartWrite;
//当前使用的接入点Id
TUint32 iIAPId;
TInt iConnectType;
CPeriodic *iCurTimer;
TInt iCount;
TUint32 iCmwapIad;
TUint32 iCmnetIad;
TBuf8<512> iUrl;
TBool iNeedHost;
TInt iDownLen;
TInt iTotalLen;
};
#endif // __HTTP_APPVIEW_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -