📄 loginview.cpp
字号:
/*
* ============================================================================
* Name : CLoginView from CAknView
* Part of : Login
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <akncontext.h>
#include <akntitle.h>
#include <aknnotewrappers.h>
#include <LDMCM8.rsg>
#include <LDMCM8.mbg>
#include "LDMCM8.hrh"
#include "LoginView.h"
#include "LoginContainer.h"
#include "LDMCM8AppUi.h"
// ================= MEMBER FUNCTIONS =======================
CLoginView* CLoginView::NEWL()
{
CLoginView* self = NEWLC();
CleanupStack::Pop(self);
return self;
}
CLoginView* CLoginView::NEWLC()
{
CLoginView* self = new (ELeave) CLoginView;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
// C++ default constructor can NOT contain any code, that
// might leave.
//
CLoginView::CLoginView()
{
}
// EPOC default constructor can leave.
void CLoginView::ConstructL()
{
BaseConstructL(R_LOGIN_VIEW);//(R_AKNEXEDITOR_VIEW1);
}
// Destructor
CLoginView::~CLoginView()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
}
// ---------------------------------------------------------
// TUid CLoginView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CLoginView::Id() const
{
return KViewId2;
}
// ---------------------------------------------------------
// CLoginView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CLoginView::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
// case ELoginCmdSelectEdwin1:
// case ELoginCmdSelectGTextEd1:
// iContainer->FocusTo(aCommand);
// break;
//
case ELDMCM8CmdLoginLog:
{
TBuf<64> sTmpInfo;
//获取名称输入框内容
iContainer->GetInput(sTmpInfo, 1);
if (sTmpInfo.Length() == 0)
{
TBuf<32> sTmp;
CEikonEnv::Static()->ReadResource(sTmp, R_QTN_MCM_ERRORNAME);
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(sTmp);
}
iContainer->GetInput(sTmpInfo, 2);
if (sTmpInfo.Length() == 0)
{
TBuf<32> sTmp;
CEikonEnv::Static()->ReadResource(sTmp, R_QTN_MCM_ERRORPWD1);
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(sTmp);
}
else if (sTmpInfo.Length() != 6)
{
TBuf<32> sTmp;
CEikonEnv::Static()->ReadResource(sTmp, R_QTN_MCM_ERRORPWD2);
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(sTmp);
}
else
{
TBuf<32> sTmp;
CEikonEnv::Static()->ReadResource(sTmp, R_QTN_MCM_LOGIN_LOGINFO);
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
informationNote->ExecuteLD(sTmp);
}
}
break;
default:
AppUi()->HandleCommandL(aCommand);
break;
}
}
// ---------------------------------------------------------
// CLoginView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CLoginView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CLoginView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CLoginView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CLoginContainer;
iContainer->SetMopParent(this);
TRect rc;
rc.SetRect(ClientRect().iTl, TSize(176, 144));
iContainer->ConstructL(rc);
AppUi()->AddToStackL(*this, iContainer);
TBuf<KMaxPath> pathMbm;
#ifdef __WINS__
pathMbm.Copy(_L("z:\\system\\apps\\LDMCM8\\LDMCM8.mbm"));
#else
CLDMCM8AppUi* pApp = (CLDMCM8AppUi*)CEikonEnv::Static()->AppUi();
pApp->GetAppPath(pathMbm);
pathMbm.Append(_L("LDMCM8.mbm"));
#endif
CEikStatusPane* statusPane = StatusPane();
//modify icon by Miserce 2008-05-21
CAknContextPane* contextPane = (CAknContextPane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidContext));
CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(pathMbm, EMbmLdmcm8Loginicon);
contextPane->SetPicture(bitmap);
//
//modify Chinese title by Miserce 2008-05-21
TBuf<32> sTmpTitle;
CEikonEnv::Static()->ReadResource(sTmpTitle, R_QTN_MCM_LOGIN_TITLE);
CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
titlePane->SetTextL(sTmpTitle);
}
// ---------------------------------------------------------
// CLoginView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CLoginView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
iContainer = NULL;
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -