📄 logexampleview2.cpp
字号:
/*
* ============================================================================
* Name : CLogExampleView2 from LogExampleView2.h
* Part of : LogExample
* Created : 26.05.2005 by Forum Nokia
* Implementation notes:
* Initial content was generated by Series 60 Application Wizard.
* Version : 1.0
* Copyright: Nokia Corporation
* ============================================================================
*/
// INCLUDE FILES
#include "LogExample.hrh"
#include "LogExampleView2.h"
#include "LogExampleContainer2.h"
#include "LogExampleAppUi.h"
#include "LogExEngine.h"
#include <aknviewappui.h>
#include <avkon.hrh>
#include <LogExample.rsg>
#include <aknquerydialog.h> // CAknQueryDialog
#include <eikmenup.h> // DynInitMenuPaneL
// ================= MEMBER FUNCTIONS =======================
// ---------------------------------------------------------
// CLogExampleView2::ConstructL(const TRect& aRect)
// Symbian two-phased constructor
// ---------------------------------------------------------
//
void CLogExampleView2::ConstructL()
{
BaseConstructL( R_LOGEXAMPLE_VIEW2 );
/* Container is created in constructor instead of
DoActivate because container implements observer
interface and it is strictly connected to lifetime of view.
*/
iContainer = new (ELeave) CLogExampleContainer2;
iContainer->SetMopParent(this);
iContainer->ConstructL( ClientRect() );
AppUi()->AddToStackL( *this, iContainer );
}
// ---------------------------------------------------------
// CLogExampleView2::~CLogExampleView2()
// Destructor
// ---------------------------------------------------------
//
CLogExampleView2::~CLogExampleView2()
{
if ( iContainer )
{
AppUi()->RemoveFromViewStack( *this, iContainer );
}
delete iContainer;
iContainer = NULL;
}
// ---------------------------------------------------------
// CLogExampleView2::GetObserver()
// Returns observer
// ---------------------------------------------------------
//
MEventsObserver* CLogExampleView2::GetObserver()
{
return iContainer;
}
// ---------------------------------------------------------
// TUid CLogExampleView2::Id()
// Returns view's Uid
// ---------------------------------------------------------
//
TUid CLogExampleView2::Id() const
{
return KView2Id;
}
// ---------------------------------------------------------
// CLogExampleView2::HandleCommandL(TInt aCommand)
// Takes care of view command handling
// ---------------------------------------------------------
//
void CLogExampleView2::HandleCommandL(TInt aCommand)
{
switch ( aCommand )
{
case ELogExampleCmdShowDetails:
{
iContainer->ShowEventDetailsL();
break;
}
case ELogExampleCmdDelete:
{
CAknQueryDialog* deleteQuery = CAknQueryDialog::NewL();
if(deleteQuery->ExecuteLD(R_LOGEXAMPLE_DELETECONFIRMATION_QUERY))
{
TLogId selectedId = -1;
iContainer->GetSelectedId(selectedId);
CLogExampleAppUi* appUi = static_cast<CLogExampleAppUi*>(AppUi());
CLogExEngine* model = appUi->Model();
iContainer->ResetEventList();
model->DeleteEventL(selectedId);
}
break;
}
default:
{
AppUi()->HandleCommandL( aCommand );
break;
}
}
}
// ---------------------------------------------------------
// CLogExampleView2::HandleClientRectChange()
// Reacts client size change
// ---------------------------------------------------------
//
void CLogExampleView2::HandleClientRectChange()
{
if ( iContainer )
{
iContainer->SetRect( ClientRect() );
}
}
// ---------------------------------------------------------
// CLogExampleView2::DoActivateL(const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
// const TDesC8& /*aCustomMessage*/)
// Activates view
// ---------------------------------------------------------
//
void CLogExampleView2::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/)
{
iContainer->ResetEventList();
}
// ---------------------------------------------------------
// CLogExampleView2::DoDeactivate()
// Deactivates view
// ---------------------------------------------------------
//
void CLogExampleView2::DoDeactivate()
{
}
// ------------------------------------------------------------------------------
// CLogExampleView2::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
// This function is called by the EIKON framework just before it displays
// a menu pane. Its default implementation is empty, and by overriding it,
// the application can set the state of menu items dynamically according
// to the state of application data.
// ------------------------------------------------------------------------------
//
void CLogExampleView2::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
/*
Simple dynamic menu.
Items are dimmed depending on state of the application.
Note: This can only be used with Series60 where items are hidden when dimmed.
*/
if( aResourceId == R_LOGEXAMPLE_VIEW2_MENU && iContainer->ListBoxItemCount() == 0)
{
aMenuPane->SetItemDimmed(ELogExampleCmdShowDetails, ETrue);
aMenuPane->SetItemDimmed(ELogExampleCmdDelete, ETrue);
}
}
// ----------------------------------------------------
// CLogExampleView2::ResetEventList()
// Empties the list of events
// ----------------------------------------------------
//
void CLogExampleView2::ResetEventList()
{
iContainer->ResetEventList();
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -