📄 tcpipimpexappui.cpp
字号:
/**
*
* @brief Definition of CTcpipImpExAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "TcpipImpExAppUi.h"
// System Includes
#include <aknglobalnote.h>
#include <eikmenup.h>
// User includes
#include "TcpipImpExContainer.h" // CTcpipImpExContainer
#include "TcpipImpExEngine.h" // CTcpipImpExEngine
#include "TcpipImpEx.hrh"
#include "TcpipImpEx.pan"
#include "TcpipImpEx.rsg"
// ================= 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 CTcpipImpExAppUi::ConstructL()
{
BaseConstructL();
iAppContainer = CTcpipImpExContainer::NewL(ClientRect());
iAppContainer->SetMopParent(this);
AddToStackL(iAppContainer);
iEngine = CTcpipImpExEngine::NewL(*this);
iDateTimeMenuState = EFalse;
}
/**
* Destructor.
* Removes the application's container from the stack and deletes it.
*/
CTcpipImpExAppUi::~CTcpipImpExAppUi()
{
if (iAppContainer)
{
RemoveFromStack(iAppContainer);
delete iAppContainer;
}
delete iEngine;
}
/**
* From CEikAppUi, takes care of command handling.
*
* @param aCommand command to be handled
*/
void CTcpipImpExAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case ETcpipImpExampleCmdReadTime:
{
iDateTimeMenuState = ETrue;
iEngine->ConnectL();
break;
}
case EAknSoftkeyExit:
case EAknSoftkeyBack:
case EEikCmdExit:
{
Exit();
break;
}
default:
break;
}
}
void CTcpipImpExAppUi::Error(const TDesC& aErrMessage, TInt aErrCode)
{
_LIT(KNewLine, "\n");
TRAPD(error,
HBufC* errorTitleCode = HBufC::NewLC(50);
errorTitleCode->Des().Append(aErrMessage);
errorTitleCode->Des().Append(KNewLine);
errorTitleCode->Des().AppendNum(aErrCode);
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->ShowNoteL(EAknGlobalErrorNote, *errorTitleCode);
CleanupStack::PopAndDestroy(globalNote);
CleanupStack::PopAndDestroy(errorTitleCode);
)
if(error != KErrNone)
{
User::Panic (KPanicTcpipImpEx, ETcpipImpExAppView);
}
}
void CTcpipImpExAppUi::ResponseReceived(const TDesC8& aMessage)
{
TBuf<50> unicodeBuf;
unicodeBuf.Copy(aMessage);
TRAPD(error,
CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
globalNote->ShowNoteL(EAknGlobalInformationNote, unicodeBuf);
CleanupStack::PopAndDestroy(globalNote);
)
if(error != KErrNone)
{
User::Panic (KPanicTcpipImpEx, ETcpipImpExAppView);
}
}
void CTcpipImpExAppUi::SetStatus(const TDesC& aStatus)
{
// Update contents of status window
TRAPD(error,iAppContainer->UpdateLabelL(aStatus));
if(error != KErrNone)
{
User::Panic (KPanicTcpipImpEx, ETcpipImpExAppView);
}
}
void CTcpipImpExAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
{
if (aResourceId == R_TCPIPIMPEXAMPLE_MENU_PANE)
{
aMenuPane->SetItemDimmed(ETcpipImpExampleCmdReadTime, iDateTimeMenuState);
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -