📄 celliddetectorcontainerview.cpp
字号:
/*
========================================================================
Name : CellidDetectorContainerView.cpp
Author : Hatma Suryotrisongko
Copyright : www.hatma.info
Description :
========================================================================
*/
// [[[ begin generated region: do not modify [Generated System Includes]
#include <aknviewappui.h>
#include <eikmenub.h>
#include <avkon.hrh>
#include <akncontext.h>
#include <akntitle.h>
#include <stringloader.h>
#include <barsread.h>
#include <eikbtgpc.h>
#include <CellidDetector.rsg>
// ]]] end generated region [Generated System Includes]
// [[[ begin generated region: do not modify [Generated User Includes]
#include "CellidDetector.hrh"
#include "CellidDetectorContainerView.h"
#include "CellidDetectorContainer.hrh"
#include "CellidDetectorContainer.h"
// ]]] end generated region [Generated User Includes]
#include "CellidDetector.h"
#include <aknnotewrappers.h>
// [[[ begin generated region: do not modify [Generated Constants]
// ]]] end generated region [Generated Constants]
/**
* First phase of Symbian two-phase construction. Should not contain any
* code that could leave.
*/
CCellidDetectorContainerView::CCellidDetectorContainerView()
{
// [[[ begin generated region: do not modify [Generated Contents]
iCellidDetectorContainer = NULL;
// ]]] end generated region [Generated Contents]
}
/**
* The view's destructor removes the container from the control
* stack and destroys it.
*/
CCellidDetectorContainerView::~CCellidDetectorContainerView()
{
// [[[ begin generated region: do not modify [Generated Contents]
delete iCellidDetectorContainer;
iCellidDetectorContainer = NULL;
// ]]] end generated region [Generated Contents]
}
/**
* Symbian two-phase constructor.
* This creates an instance then calls the second-phase constructor
* without leaving the instance on the cleanup stack.
* @return new instance of CCellidDetectorContainerView
*/
CCellidDetectorContainerView* CCellidDetectorContainerView::NewL()
{
CCellidDetectorContainerView* self = CCellidDetectorContainerView::NewLC();
CleanupStack::Pop( self );
return self;
}
/**
* Symbian two-phase constructor.
* This creates an instance, pushes it on the cleanup stack,
* then calls the second-phase constructor.
* @return new instance of CCellidDetectorContainerView
*/
CCellidDetectorContainerView* CCellidDetectorContainerView::NewLC()
{
CCellidDetectorContainerView* self = new ( ELeave ) CCellidDetectorContainerView();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
/**
* Second-phase constructor for view.
* Initialize contents from resource.
*/
void CCellidDetectorContainerView::ConstructL()
{
// [[[ begin generated region: do not modify [Generated Code]
BaseConstructL( R_CELLID_DETECTOR_CONTAINER_CELLID_DETECTOR_CONTAINER_VIEW );
// ]]] end generated region [Generated Code]
// add your own initialization code here
}
/**
* @return The UID for this view
*/
TUid CCellidDetectorContainerView::Id() const
{
return TUid::Uid( ECellidDetectorContainerViewId );
}
/**
* Handle a command for this view (override)
* @param aCommand command id to be handled
*/
void CCellidDetectorContainerView::HandleCommandL( TInt aCommand )
{
// [[[ begin generated region: do not modify [Generated Code]
TBool commandHandled = EFalse;
switch ( aCommand )
{ // code to dispatch to the AknView's menu and CBA commands is generated here
case ECellidDetectorContainerViewStart_TourMenuItemCommand:
commandHandled = HandleStart_TourMenuItemSelectedL( aCommand );
break;
default:
break;
}
if ( !commandHandled )
{
if ( aCommand == EAknSoftkeyExit )
{
AppUi()->HandleCommandL( EEikCmdExit );
}
}
// ]]] end generated region [Generated Code]
}
/**
* Handles user actions during activation of the view,
* such as initializing the content.
*/
void CCellidDetectorContainerView::DoActivateL(
const TVwsViewId& /*aPrevViewId*/,
TUid /*aCustomMessageId*/,
const TDesC8& /*aCustomMessage*/ )
{
// [[[ begin generated region: do not modify [Generated Contents]
SetupStatusPaneL();
if ( iCellidDetectorContainer == NULL )
{
iCellidDetectorContainer = CreateContainerL();
iCellidDetectorContainer->SetMopParent( this );
AppUi()->AddToStackL( *this, iCellidDetectorContainer );
}
// ]]] end generated region [Generated Contents]
}
/**
*/
void CCellidDetectorContainerView::DoDeactivate()
{
// [[[ begin generated region: do not modify [Generated Contents]
CleanupStatusPane();
if ( iCellidDetectorContainer != NULL )
{
AppUi()->RemoveFromViewStack( *this, iCellidDetectorContainer );
delete iCellidDetectorContainer;
iCellidDetectorContainer = NULL;
}
// ]]] end generated region [Generated Contents]
}
// [[[ begin generated function: do not modify
void CCellidDetectorContainerView::SetupStatusPaneL()
{
// reset the context pane
TUid contextPaneUid = TUid::Uid( EEikStatusPaneUidContext );
CEikStatusPaneBase::TPaneCapabilities subPaneContext =
StatusPane()->PaneCapabilities( contextPaneUid );
if ( subPaneContext.IsPresent() && subPaneContext.IsAppOwned() )
{
CAknContextPane* context = static_cast< CAknContextPane* > (
StatusPane()->ControlL( contextPaneUid ) );
context->SetPictureToDefaultL();
}
// setup the title pane
TUid titlePaneUid = TUid::Uid( EEikStatusPaneUidTitle );
CEikStatusPaneBase::TPaneCapabilities subPaneTitle =
StatusPane()->PaneCapabilities( titlePaneUid );
if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() )
{
CAknTitlePane* title = static_cast< CAknTitlePane* >(
StatusPane()->ControlL( titlePaneUid ) );
TResourceReader reader;
iEikonEnv->CreateResourceReaderLC( reader, R_CELLID_DETECTOR_CONTAINER_TITLE_RESOURCE );
title->SetFromResourceL( reader );
CleanupStack::PopAndDestroy(); // reader internal state
}
}
// ]]] end generated function
// [[[ begin generated function: do not modify
void CCellidDetectorContainerView::CleanupStatusPane()
{
}
// ]]] end generated function
/**
* Handle status pane size change for this view (override)
*/
void CCellidDetectorContainerView::HandleStatusPaneSizeChange()
{
CAknView::HandleStatusPaneSizeChange();
// this may fail, but we're not able to propagate exceptions here
TInt result;
TRAP( result, SetupStatusPaneL() );
// [[[ begin generated region: do not modify [Generated Code]
// ]]] end generated region [Generated Code]
}
/**
* Handle the selected event.
* @param aCommand the command id invoked
* @return ETrue if the command was handled, EFalse if not
*/
TBool CCellidDetectorContainerView::HandleStart_TourMenuItemSelectedL( TInt aCommand )
{
// TODO: implement selected event handler
TUint cellId;
TUint hasil;
CCellidDetector* devCellidUtility = CCellidDetector::NewL();
CleanupStack::PushL(devCellidUtility);
hasil = devCellidUtility->GetNetworkCellId(cellId);
CleanupStack::PopAndDestroy(devCellidUtility);
_LIT(KFormatString, "CellId : %d");
TBuf <50> aString;
aString.Format(KFormatString, hasil);
CAknConfirmationNote* note1 = new (ELeave) CAknConfirmationNote( ETrue ); //Waiting
note1->ExecuteLD(aString); //Blocks until note dismissed
return ETrue;
}
/** * Creates the top-level container for the view. You may modify this method's * contents and the CCellidDetectorContainer::NewL() signature as needed to initialize the * container, but the signature for this method is fixed. * @return new initialized instance of CCellidDetectorContainer */CCellidDetectorContainer* CCellidDetectorContainerView::CreateContainerL() { return CCellidDetectorContainer::NewL( ClientRect(), NULL, this ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -