?? redview.cpp
字號:
/* Copyright (c) 2007, Nokia. All rights reserved */
#include <akncontext.h>
#include "ParkingAppUi.h"
#include "RedView.h"
#include "RedContainer.h"
#include "Parking.hrh"
#include "Parking.rsg"
#include <Parking.mbg>
CRedView* CRedView::NewL()
{
CRedView* self = NewLC();
CleanupStack::Pop(self);
return self;
}
CRedView* CRedView::NewLC()
{
CRedView* self = new (ELeave) CRedView();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
void CRedView::ConstructL()
{
BaseConstructL();
}
CRedView::CRedView()
{
m_pAppContainer = NULL;
}
CRedView::~CRedView()
{
}
TUid CRedView::Id() const
{
return TUid::Uid(1);
}
void CRedView::HandleCommandL(TInt aCommand)
{
AppUi()->HandleCommandL(aCommand);
}
void CRedView::HandleClientRectChange()
{
}
void CRedView::DoActivateL(const TVwsViewId&, TUid, const TDesC8&)
{
m_pAppContainer = new( ELeave ) CRedContainer();
m_pAppContainer->SetMopParent(this);
m_pAppContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, m_pAppContainer );
CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
//Set view icon
CAknContextPane* contextPane = (CAknContextPane*) sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(_L("\\system\\apps\\PARKING\\Parking.mbm"), EMbmParkingWmpnss_32x32_i);
contextPane->SetPicture(bitmap);
}
void CRedView::DoDeactivate()
{
if(m_pAppContainer)
{
AppUi()->RemoveFromStack( m_pAppContainer );
delete m_pAppContainer;
m_pAppContainer = NULL;
}
}
/***************************************************************
****************************CUserInfo***************************
***************************************************************/
void CUserInfo::InternalizeL(RReadStream& aRead)
{
TInt nLen = aRead.ReadInt32L();
if(m_pStrName)
{
delete m_pStrName;
m_pStrName = NULL;
}
if(nLen > 0)
{
m_pStrName = HBufC::NewLC(nLen);
aRead >> m_pStrName;
CleanupStack::Pop();
}
nLen = aRead.ReadInt32L();
if(m_pStrPassword)
{
delete m_pStrPassword;
m_pStrPassword = NULL;
}
if(nLen > 0)
{
m_pStrPassword = HBufC::NewLC(nLen);
aRead >> m_pStrPassword;
CleanupStack::Pop();
}
}
void CUserInfo::ExternalizeL(RWriteStream& aWrite) const
{
if(m_pStrName)
{
aWrite.WriteInt32L(m_pStrName->Length());
aWrite << m_pStrName;
}
else
{
aWrite.WriteInt32L(0);
}
if(m_pStrPassword)
{
aWrite.WriteInt32L(m_pStrPassword->Length());
aWrite << m_pStrPassword;
}
else
{
aWrite.WriteInt32L(0);
}
}
/***************************************************************
****************************CUserManager************************
***************************************************************/
void CUserManage::ReadUser()
{
TBuf<32> sFilePath;
sFilePath.Copy(_L("user.reg"));
RReadStream rStream;
TInt nCount = rStream.ReadInt32L();
for (TInt i = 0; i<nCount; i++)
{
CUserInfo* pUser = CUserInfo::NewL();
pUser->InternalizeL(rStream);
m_arrUserInfo.Append(pUser);
}
}
void CUserManage::WriteUser()
{
TBuf<32> sFilePath;
sFilePath.Copy(_L("user.reg"));
RWriteStream wStream;
wStream.WriteInt32L(m_arrUserInfo.Count());
for (TInt i = 0; i<m_arrUserInfo.Count(); i++)
{
// CUserInfo* pUser = m_arrUserInfo[i];
m_arrUserInfo[i]->ExternalizeL(wStream);
}
wStream.CommitL();
wStream.Close();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -