detailmesview.cpp
来自「symbian 3nd 实现短信息收发」· C++ 代码 · 共 180 行
CPP
180 行
/*
* ============================================================================
* Name : CDetailMesView from CAknView
* Part of : DetailMes
* Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/
// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>
#include <FrMes.rsg>
#include "FrMes.hrh"
#include "DetailMesView.h"
#include "DetailMesContainer.h"
#include <akntitle.h>
#include <aknnotewrappers.h>
#include "FrMesAppUi.h"
#include "FrMesDB.h"
#include "MessageView.h"
#include "MessageDB.h"
#include "msvids.h"
#include "ReceiveMesView.h"
#include "SendMesView.h"
// ================= MEMBER FUNCTIONS =======================
// C++ default constructor can NOT contain any code, that
// might leave.
//
CDetailMesView* CDetailMesView::NewL(MGetIndex * apInBoxIndex,MGetIndex * apSendIndex)
{
CDetailMesView* self = NewLC(apInBoxIndex,apSendIndex);
CleanupStack::Pop(self);
return self;
}
CDetailMesView* CDetailMesView::NewLC(MGetIndex * apInBoxIndex,MGetIndex * apSendIndex)
{
CDetailMesView* self = new (ELeave) CDetailMesView;
CleanupStack::PushL(self);
self->ConstructL(apInBoxIndex,apSendIndex);
return self;
}
CDetailMesView::CDetailMesView()
{
}
// EPOC default constructor can leave.
void CDetailMesView::ConstructL(MGetIndex * apInBoxIndex,MGetIndex * apSendIndex)
{
m_pGetInBoxIndex = apInBoxIndex;
m_pGetSendIndex = apSendIndex;
BaseConstructL(R_DETAILMES_VIEW);
}
// Destructor
CDetailMesView::~CDetailMesView()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
}
// ---------------------------------------------------------
// TUid CDetailMesView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CDetailMesView::Id() const
{
return KDetailMesViewId;
}
// ---------------------------------------------------------
// CDetailMesView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CDetailMesView::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EAknSoftkeyBack:
{
CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
AppUi()->ActivateLocalViewL(pApp->KPreViewID);
}
break;
default:
AppUi()->HandleCommandL(aCommand);
break;
}
}
// ---------------------------------------------------------
// CDetailMesView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CDetailMesView::HandleClientRectChange()
{
if (iContainer)
{
iContainer->SetRect(ClientRect());
}
}
// ---------------------------------------------------------
// CDetailMesView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CDetailMesView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer = new (ELeave) CDetailMesContainer;
iContainer->SetMopParent(this);
//===============================modify cba by wzg===============
TRect rc;
rc.SetRect(ClientRect().iTl, TSize(176, 144));
iContainer->ConstructL(rc);
AppUi()->AddToStackL(*this, iContainer);
//modify title by wzg
TBuf<32> sTmpTitle;
CEikStatusPane* statusPane = StatusPane();
CEikonEnv::Static()->ReadResource(sTmpTitle,R_FRMES_VIEW_TITLE_DETAILMES);
CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
titlePane->SetTextL(sTmpTitle);
//set Edit content
SetEditText();
}
// ---------------------------------------------------------
// CDetailMesView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CDetailMesView::DoDeactivate()
{
if (iContainer)
{
AppUi()->RemoveFromStack(iContainer);
}
delete iContainer;
iContainer = NULL;
}
void CDetailMesView::SetEditText()
{
TInt Index;
CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
TMessageDBStruct* tempMessage;
CArrayFixFlat<TInt32>* tempArray;
if(pApp->KPreViewID == KReceiveViewId)
{
tempArray = pApp->m_pMessageDB->GetMessageArray(KMsvGlobalInBoxIndexEntryId);
m_pGetInBoxIndex->GetIndex(Index);
}
if(pApp->KPreViewID == KSendMesViewId)
{
tempArray = pApp->m_pMessageDB->GetMessageArray(KMsvSentEntryId);
m_pGetSendIndex->GetIndex(Index);
}
tempMessage = (TMessageDBStruct*)tempArray->At(Index);
iContainer->SetTextL(tempMessage->imobile,tempMessage->imessage);
}
// End of File
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?