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

📄 httpappui.cpp

📁 简单的socket请求
💻 CPP
字号:
/* Copyright (c) 2008, Nokia. All rights reserved */

#include <avkon.hrh>
#include <aknnotewrappers.h> 

#include "Http.pan"
#include "HttpAppUi.h"
#include "HttpAppView.h"
#include "Http.hrh"
#include "http.rsg"
#include "eikmenup.h"

_LIT(KFileName,"\\system\\temp.txt");

void CHttpAppUi::ConstructL()
{
    BaseConstructL(EAknEnableSkin);
	
    iAppView = CHttpAppView::NewL(ClientRect()); 
    AddToStackL(iAppView);

	iAppView->iExplorer->SetRequestMethod(REQUEST_METHOD_GET);
	if (iAppView->iExplorer->Isconnected()) 
	{
		iAppView->iExplorer->DisconnectL();					
	}
	iAppView->iExplorer->StartL();
// 	iAppView->BeginCount();
}

CHttpAppUi::CHttpAppUi()                              
{
    // add any construction that cannot leave here
}

CHttpAppUi::~CHttpAppUi()
{
    if (iAppView)
	{
        iEikonEnv->RemoveFromStack(iAppView);
        delete iAppView;
        iAppView = NULL;
	}
}

void CHttpAppUi::HandleCommandL(TInt aCommand)
{
    switch(aCommand)
	{
	case EEikCmdExit:
		
	case EAknSoftkeyExit:
		iAppView->iExplorer->DisconnectL();
		Exit();
		break;

	case EHttpSetServer:
		{
			TBuf<50> serverName;
			CAknQueryDialog* dlg;
			dlg = CAknQueryDialog::NewL(iAppView->iExplorer->iServerName, CAknQueryDialog::ENoTone );
			dlg->ExecuteLD(R_SOCKETS_DIALOG_CONNECT);
		}
		break;
		
	case EHttpOpenFile:
		iAppView->EmbedLaunchFileL(KFileName);
		break;
		
	case EHttpGetCommand:
		{
			iAppView->iExplorer->SetRequestMethod(REQUEST_METHOD_GET);
			if (iAppView->iExplorer->Isconnected()) 
			{
				iAppView->iExplorer->DisconnectL();					
			}
			iAppView->iExplorer->StartL();
// 			iAppView->BeginCount();
        }
            break;

		case EHttpPostCommand:
            {
				iAppView->iExplorer->SetRequestMethod(REQUEST_METHOD_POST);
				if (iAppView->iExplorer->Isconnected()) 
				{
					iAppView->iExplorer->DisconnectL();					
				}
				
				iAppView->iExplorer->ConnectL();
            }
            break;

		case EHttpIAPs1:
			{
				iAppView->SetIAPId(1);
			}
			break;
		case EHttpIAPs2:
			{
				iAppView->SetIAPId(2);
			}
			break;
		case EHttpIAPs3:
		case EHttpIAPs4:
		case EHttpIAPs5:
		case EHttpIAPs6:
		case EHttpIAPs7:
		case EHttpIAPs8:
			{
				iAppView->SetIAPId(aCommand-EHttpIAPs1);
			}
			break;

        default:
            Panic(EHttpBasicUi);
            break;
        }
    }

void CHttpAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
{
	switch(aResourceId)
	{
	case R_HTTP_MENU_SUBMENU_PANE:
		{
			TInt iapsCount = 0;
			for(iapsCount=0;iapsCount<MAX_IAPS_NUMBER;iapsCount++)
			{
				if(iapsCount<iAppView->iIAPs->Count())
				{
					aMenuPane->SetItemTextL
					    (EHttpIAPs1+iapsCount,iAppView->iIAPs->At(iapsCount)->name);
				}
				else
				{
					aMenuPane->DeleteMenuItem(EHttpIAPs1+iapsCount);
				}
								
			}
		}
			break;
	default:
		break;
	}
}



⌨️ 快捷键说明

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