📄 callsummaryappui.cpp
字号:
/**
*
* @brief Definition of CCallSummaryAppUi
*
* Copyright (c) EMCC Software Ltd 2003
* @version 1.0
*/
// INCLUDE FILES
// Class include
#include "CallSummaryappui.h"
// System includes
#include <aknnavi.h> // CAknNavigationControlContainer
#include <aknnavide.h> // CAknNavigationDecorator
#include <akntabgrp.h> // CAknTabGroup
#include <logwrap.rsg> // R_LOG_DIR_IN, R_LOG_DIR_OUT strings
// User includes
#include "CallSummary.hrh" // TCallSummaryViewNumber
#include "CallView.h" // CIncomingView
#include "PhoneBookEngine.h" // CPhoneBookEngine
#include "TopTenView.h" // CTopTenView
// Constants
const TUid KUidIncomingView = { EIncomingViewId };
const TUid KUidOutgoingView = { EOutgoingViewId };
const TUid KUidTopTenView = { ETopTenViewId };
// ================= MEMBER FUNCTIONS =======================
/**
* Symbian OS 2nd phase constructor. Constructs the application's views,
* transferring ownership of them to the superclass.
* Sets view 1 as the default and remembers that this is the current view id.
*/
void CCallSummaryAppUi::ConstructL()
{
BaseConstructL();
// Show tabs for main views from resources
CEikStatusPane* sp = StatusPane();
// Fetch pointer to the default navi pane control
iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
// Tabgroup has been read from resource and pushed to the navi pane.
// Get pointer to the navigation decorator with the ResourceDecorator() function.
// Application owns the decorator and it has responsibility to delete the object.
iDecoratedTabGroup = iNaviPane->ResourceDecorator();
if (iDecoratedTabGroup)
{
iTabGroup = (CAknTabGroup*) iDecoratedTabGroup->DecoratedControl();
}
// Construct the phonebook engine
iPhoneBookEngine = CPhoneBookEngine::NewL();
iIncomingView = CCallView::NewL(R_LOG_DIR_IN, KUidIncomingView, *iPhoneBookEngine);
AddViewL(iIncomingView); // transfer ownership
iOutgoingView = CCallView::NewL(R_LOG_DIR_OUT, KUidOutgoingView, *iPhoneBookEngine);
AddViewL(iOutgoingView); // transfer ownership
iTopTenView = CTopTenView::NewL(R_LOG_DIR_OUT, KUidTopTenView, *iPhoneBookEngine);
AddViewL(iTopTenView); // transfer ownership
SetDefaultViewL(*iIncomingView);
iCurrentViewId = EIncomingViewId;
}
/**
* Destructor.
*/
CCallSummaryAppUi::~CCallSummaryAppUi()
{
delete iDecoratedTabGroup;
delete iPhoneBookEngine;
}
/**
* From CEikAppUi, takes care of key event handling for both views.
*
* @param aKeyEvent Event to handled.
* @param aType Type of the key event.
* @return Response code (EKeyWasConsumed, EKeyWasNotConsumed).
*/
TKeyResponse CCallSummaryAppUi::HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode /*aType*/)
{
if (!iTabGroup)
{
return EKeyWasNotConsumed;
}
TInt active = iTabGroup->ActiveTabIndex();
TInt count = iTabGroup->TabCount();
switch (aKeyEvent.iCode)
{
case EKeyLeftArrow:
{
if (active > 0)
{
active--;
iTabGroup->SetActiveTabByIndex(active);
ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
}
break;
}
case EKeyRightArrow:
{
if((active + 1) < count)
{
active++;
iTabGroup->SetActiveTabByIndex(active);
ActivateLocalViewL(TUid::Uid(iTabGroup->TabIdFromIndex(active)));
}
break;
}
default:
{
return EKeyWasNotConsumed;
}
}
return EKeyWasConsumed;
}
/**
* From CEikAppUi, takes care of command handling for both views.
*
* @param aCommand command to be handled
*/
void CCallSummaryAppUi::HandleCommandL(TInt aCommand)
{
switch (aCommand)
{
case EAknSoftkeyExit:
case EEikCmdExit:
{
Exit();
break;
}
default:
{
}
break;
}
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -