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

📄 testmyhttpclientappui.cpp

📁 一个简单的http客户端
💻 CPP
字号:
/*
 ============================================================================
 Name		: testMyHttpClientAppUi.cpp
 Author	  : 
 Copyright   : Your copyright notice
 Description : CtestMyHttpClientAppUi implementation
 ============================================================================
 */

// INCLUDE FILES
#include <avkon.hrh>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <f32file.h>
#include <s32file.h>
#include <hlplch.h>

#include <testMyHttpClient_0xE0582851.rsg>

#include "testMyHttpClient_0xE0582851.hlp.hrh"
#include "testMyHttpClient.hrh"
#include "testMyHttpClient.pan"
#include "testMyHttpClientApplication.h"
#include "testMyHttpClientAppUi.h"
#include "testMyHttpClientAppView.h"

#include "HttpEngine.h"

// ============================ MEMBER FUNCTIONS ===============================


// -----------------------------------------------------------------------------
// CtestMyHttpClientAppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppUi::ConstructL()
{
	// Initialise app UI with standard value.
	BaseConstructL(CAknAppUi::EAknEnableSkin);
	
	iEngine=CHttpEngine::NewL();

	// Create view object
	iAppView = CtestMyHttpClientAppView::NewL(ClientRect() );
	iEngine->SetObser(iAppView);
	AddToStackL(iAppView);
}
// -----------------------------------------------------------------------------
// CtestMyHttpClientAppUi::CtestMyHttpClientAppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppUi::CtestMyHttpClientAppUi()
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppUi::~CtestMyHttpClientAppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CtestMyHttpClientAppUi::~CtestMyHttpClientAppUi()
{
	if (iAppView)
	{
		RemoveFromStack(iAppView);
		delete iAppView;
		iAppView = NULL;
	}
	delete iEngine;
}

// -----------------------------------------------------------------------------
// CtestMyHttpClientAppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppUi::HandleCommandL(TInt aCommand)
{
	switch (aCommand)
	{
	case EEikCmdExit:
	case EAknSoftkeyExit:
		Exit();
		break;

	case ECommand1:
	{
		iEngine->ConnectL(_L("http://www.google.com/"));
	}
		break;
	case ECommand2:
	{
		iAppView->ClearScr();
	}
		break;
	case EHelp:
	{

		CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
		HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
	}
		break;
	case EAbout:
	{

		CAknMessageQueryDialog* dlg = new (ELeave)CAknMessageQueryDialog();
		dlg->PrepareLC(R_ABOUT_QUERY_DIALOG);
		HBufC* title = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TITLE);
		dlg->QueryHeading()->SetTextL(*title);
		CleanupStack::PopAndDestroy(); //title
		HBufC* msg = iEikonEnv->AllocReadResourceLC(R_ABOUT_DIALOG_TEXT);
		dlg->SetMessageTextL(*msg);
		CleanupStack::PopAndDestroy(); //msg
		dlg->RunLD();
	}
		break;
	default:
		Panic(EtestMyHttpClientUi);
		break;
	}
}
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
void CtestMyHttpClientAppUi::HandleStatusPaneSizeChange()
{
	iAppView->SetRect(ClientRect() );
}

CArrayFix<TCoeHelpContext>* CtestMyHttpClientAppUi::HelpContextL() const
{
#warning "Please see comment about help and UID3..."
	// Note: Help will not work if the application uid3 is not in the
	// protected range.  The default uid3 range for projects created
	// from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so that they
	// can be self signed and installed on the device during testing.
	// Once you get your official uid3 from Symbian Ltd. and find/replace
	// all occurrences of uid3 in your project, the context help will
	// work.
	CArrayFixFlat<TCoeHelpContext>* array = new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
	CleanupStack::PushL(array);
	array->AppendL(TCoeHelpContext(KUidtestMyHttpClientApp,
			KGeneral_Information));
	CleanupStack::Pop(array);
	return array;
}

// End of File

⌨️ 快捷键说明

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