tcpipmultihomingexappui.cpp

来自「最新官方例子,图形,描述副,基本控件,通讯协议,等等,」· C++ 代码 · 共 113 行

CPP
113
字号
/**
*
* @brief Definition of CTcpipMultiHomingExAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/

// INCLUDE FILES

// Class include
#include "TcpipMultiHomingExAppUi.h"

#include <aknglobalnote.h>

// User includes
#include "TcpipMultiHomingExContainer.h" 	// CTcpipMultiHomingExContainer
#include "TcpipMultiHomingExEngine.h" 		// CTcpipMultiHomingExEngine
#include "TcpipMultiHomingEx.hrh"
#include "TcpipMultiHomingEx.pan"

// CONSTANTS

_LIT(KNewLine, "\n");
const TInt KMaxErrCodeLength = 10;

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

/**
* Symbian OS 2nd phase constructor.  Constructs the application's container,
* setting itself as the container's MOP parent, and adds it to the control
* stack.
*/
void CTcpipMultiHomingExAppUi::ConstructL()
	{
	BaseConstructL();
	iAppContainer = CTcpipMultiHomingExContainer::NewL(ClientRect());
	iAppContainer->SetMopParent(this);
	AddToStackL(iAppContainer);
	iEngine = CTcpipMultiHomingExEngine::NewL(*this);
	}

/**
* Destructor.
* Removes the application's container from the stack and deletes it.
*/
CTcpipMultiHomingExAppUi::~CTcpipMultiHomingExAppUi()
	{
	if (iAppContainer)
		{
		RemoveFromStack(iAppContainer);
		delete iAppContainer;
		}
	delete iEngine;
	}

/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void CTcpipMultiHomingExAppUi::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case ETcpipMultiHomingExampleCmdReadTime:
			{
			iEngine->ConnectL();
			break;
			}
		case EAknSoftkeyExit:
		case EAknSoftkeyBack:
		case EEikCmdExit:
			{
			Exit();
			break;
			}
		default:
			break;
		}
	}

void CTcpipMultiHomingExAppUi::ErrorL(const TDesC& aErrMessage, TInt aErrCode)
    {

    HBufC* errorTitleCode = HBufC::NewLC(aErrMessage.Length() + KNewLine().Length() + KMaxErrCodeLength);
	TPtr ptr = errorTitleCode->Des();
	ptr.Append(aErrMessage);
    ptr.Append(KNewLine);
	ptr.AppendNum(aErrCode);

    CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
    globalNote->ShowNoteL(EAknGlobalErrorNote, *errorTitleCode);
    CleanupStack::PopAndDestroy(globalNote);
    CleanupStack::PopAndDestroy(errorTitleCode);
    }

void CTcpipMultiHomingExAppUi::ResponseReceivedL(const TDesC& aMessage)
	{
    CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
    globalNote->ShowNoteL(EAknGlobalInformationNote, aMessage);
    CleanupStack::PopAndDestroy(globalNote);
	}

void CTcpipMultiHomingExAppUi::SetStatus(const TDesC& aStatus)
    {
    // Update contents of status window
    TRAPD(err, iAppContainer->UpdateLabelL(aStatus));
	// Ignore error
    }

// End of File

⌨️ 快捷键说明

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