⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookmesview.cpp

📁 symbian 3nd 实现短信息收发
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CBookMesView from CAknView
*  Part of  : BookMes
*  Copyright (c) 2003 Nokia. All rights reserved.
* ============================================================================
*/

// INCLUDE FILES
#include <aknviewappui.h>
#include <avkon.hrh>

#include <akntitle.h>
#include "FrMesAppUi.h"

#include <FrMes.rsg>
#include "FrMes.hrh"
#include "BookMesView.h"
#include "BookMesContainer.h"

#include "MessageView.h"
#include "CreateMesView.h"
#include "HelpView.h"

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

// C++ default constructor can NOT contain any code, that
// might leave.
//
CBookMesView* CBookMesView::NewL(MSendBookIndex * apSendBookIndex)
{
    CBookMesView* self = NewLC(apSendBookIndex);
    CleanupStack::Pop(self);
    return self;
}

CBookMesView* CBookMesView::NewLC(MSendBookIndex * apSendBookIndex)
{
    CBookMesView* self = new (ELeave) CBookMesView;
    CleanupStack::PushL(self);
    self->ConstructL(apSendBookIndex);
    return self;
}

CBookMesView::CBookMesView()
{
}

// EPOC default constructor can leave.
void CBookMesView::ConstructL(MSendBookIndex * apSendBookIndex)
{
    m_pSendBookIndex = apSendBookIndex;
	BaseConstructL(R_BOOKMES_VIEW);
}

// Destructor
CBookMesView::~CBookMesView()
{
    if (iContainer)
	{
        AppUi()->RemoveFromStack(iContainer);
	}
    delete iContainer;

// 	if(m_pSendBookIndex)
// 	{
// 		delete m_pSendBookIndex;
// 	}
// 	m_pSendBookIndex = NULL;
}

// ---------------------------------------------------------
// TUid CBookMesView::Id()
// Returns Id of the view.
// ---------------------------------------------------------
TUid CBookMesView::Id() const
{
    return KBookMesViewId;
}

// ---------------------------------------------------------
// CBookMesView::HandleCommandL(TInt aCommand)
// Handles commands
// ---------------------------------------------------------
void CBookMesView::HandleCommandL(TInt aCommand)
{
	switch(aCommand)
	{
	case EFrMesCmdBookMesOpen:
		{
			m_pSendBookIndex->SendBookIndex(iContainer->GetCurrentItemIndex());
			CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
			pApp->KPreViewID = KBookMesViewId;
			AppUi()->ActivateLocalViewL(KCreateMesViewId);	
		}
		break;	
	case EFrMesCmdBookMesSMS:
		{
			CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
			pApp->KPreViewID = KBookMesViewId;
			AppUi()->ActivateLocalViewL(KCreateMesViewId);	
		}
		break;
	case EFrMesCmdBookMesHelp:
		{
			CFrMesAppUi* pApp = (CFrMesAppUi*)CEikonEnv::Static()->AppUi();
			pApp->KPreViewID = KBookMesViewId;
			AppUi()->ActivateLocalViewL(KHelpViewId);
		}
		break;

	case EAknSoftkeyReturn:
		{
			AppUi()->ActivateLocalViewL(KMessageViewId);
		}
		break;
	case EFrMesCmdBookMesDelete:
		{
			iContainer->DeleteMes();
			iContainer->AddDataL();
		}
		break;
	default:
		AppUi()->HandleCommandL(aCommand);
		break;
	}
}

// ---------------------------------------------------------
// CBookMesView::HandleClientRectChange()
// Handles client rect change.
// ---------------------------------------------------------
void CBookMesView::HandleClientRectChange()
{
    if (iContainer)
	{
        iContainer->SetRect(ClientRect());
	}
}

// ---------------------------------------------------------
// CBookMesView::DoActivateL(...)
// Creates the Container class object.
// ---------------------------------------------------------
void CBookMesView::DoActivateL(const TVwsViewId& /*aPrevViewId*/,
							   TUid /*aCustomMessageId*/,
							   const TDesC8& /*aCustomMessage*/)
{
    iContainer = new (ELeave) CBookMesContainer;
    iContainer->SetMopParent(this);
	//     iContainer->ConstructL(ClientRect());
	//     AppUi()->AddToStackL(*this, iContainer);
	
	//===============================modify cba by wzg 08_07_06===============
	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_BOOKMES);
	CAknTitlePane* titlePane = (CAknTitlePane*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle));
	titlePane->SetTextL(sTmpTitle);
}

// ---------------------------------------------------------
// CBookMesView::DoDeactivate()
// Deletes the Container class object.
// ---------------------------------------------------------
void CBookMesView::DoDeactivate()
{
    if (iContainer)
	{
        AppUi()->RemoveFromStack(iContainer);
	}  
    delete iContainer;
    iContainer = NULL;
}

// End of File

⌨️ 快捷键说明

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