diff -r 6465d5bb863a -r 13e71d907dc3 gssettingsuis/Gs/GSCallDivertPlugin/Src/GSLocalBaseView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gssettingsuis/Gs/GSCallDivertPlugin/Src/GSLocalBaseView.cpp Thu Nov 04 13:38:47 2010 +0800 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base view for all the views in General Settings +* +*/ + + +// INCLUDE FILES +#include "GSLocalBaseView.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//Disabling warning caused by KGSDoActivateError constant +#pragma diag_suppress 177 +// CONSTANTS +_LIT( KGSDoActivateError, "DoActivateL" ); + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::CGSLocalBaseView +// +// C++ constructor +// --------------------------------------------------------------------------- +// +CGSLocalBaseView::CGSLocalBaseView() + { + iAppUi = iAvkonViewAppUi; + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::~CGSLocalBaseView +// +// Destructor +// --------------------------------------------------------------------------- +// +CGSLocalBaseView::~CGSLocalBaseView() + { + if ( iContainer && iAppUi ) + { + iAppUi->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + } + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::SetCurrentItem +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::SetCurrentItem( TInt aIndex ) + { + iCurrentItem = aIndex; + if( iContainer ) + { + iContainer->SetSelectedItem( aIndex ); + } + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::HandleListBoxEventL +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::HandleListBoxEventL( CEikListBox* /*aListBox*/, + TListBoxEvent aEventType ) + { + switch ( aEventType ) + { + case EEventEnterKeyPressed: + case EEventItemSingleClicked: + HandleListBoxSelectionL(); + break; + default: + break; + } + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::SetNaviPaneL +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::SetNaviPaneL() + { + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::CreateNaviPaneContextL +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::CreateNaviPaneContextL( TInt /*aResourceId*/ ) + { + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::HandleClientRectChange +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::HandleClientRectChange() + { + if ( iContainer && iContainer->iListBox ) + { + iContainer->SetRect( ClientRect() ); + } + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::DoActivateL +// Activates the view. +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::DoActivateL(const TVwsViewId& /*aPrevViewId*/, + TUid /*aCustomMessageId*/, + const TDesC8& /*aCustomMessage*/) + { + if( iContainer ) + { + iAppUi->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + + CreateContainerL(); + + iAppUi->AddToViewStackL( *this, iContainer ); + iContainer->iListBox->SetListBoxObserver( this ); + + SetNaviPaneL(); + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::DoDeactivate() +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::DoDeactivate() + { + if ( iContainer ) + { + iAppUi->RemoveFromViewStack( *this, iContainer ); + delete iContainer; + iContainer = NULL; + } + } + + +// --------------------------------------------------------------------------- +// CGSLocalBaseView::CreateContainerL() +// +// +// --------------------------------------------------------------------------- +// +void CGSLocalBaseView::CreateContainerL() + { + NewContainerL(); + __ASSERT_DEBUG( iContainer, + User::Panic( KGSDoActivateError, EGSViewPanicNullPtr ) ); + iContainer->SetMopParent( this ); + + TRAPD( error, iContainer->ConstructL( ClientRect() ) ); + + if ( error ) + { + delete iContainer; + iContainer = NULL; + User::Leave( error ); + } + } + + +//End of File