diff -r 6465d5bb863a -r 13e71d907dc3 gssettingsuis/Gs/GSDataCallPlugin/Src/GSDataCallPluginContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gssettingsuis/Gs/GSDataCallPlugin/Src/GSDataCallPluginContainer.cpp Thu Nov 04 13:38:47 2010 +0800 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2005 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: Container for the Data sub-folder +* +*/ + + +// INCLUDE FILES +#include "GSDataCallPluginContainer.h" +#include "GSDataCallPluginModel.h" +#include "GsDataCallPlugin.hrh" + +#include +#include +#include +#include +#include +#include +#include +#include + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::ConstructL() +// +// Symbian OS two phased constructor +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::ConstructL( const TRect& aRect ) + { + iListBox = new( ELeave ) CAknSettingStyleListBox; + + BaseConstructL( aRect, R_GS_CSD_VIEW_TITLE, R_DCALL_LBX ); + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::~CGSDataCallPluginContainer() +// +// Destructor +// --------------------------------------------------------------------------- +// +CGSDataCallPluginContainer::~CGSDataCallPluginContainer() + { + delete iAutodisconValue; + delete iListboxItemArray; + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::ConstructListBoxL() +// +// Construct the listbox from resource array. +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::ConstructListBoxL( TInt aResLbxId ) + { + iListBox->ConstructL( this, EAknListBoxSelectionList ); + + iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, + *iListBox, *iCoeEnv ); + iListBox->Model()->SetItemTextArray( iListboxItemArray ); + iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); + + + CreateListBoxItemsL(); + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::CreateListBoxItemsL() +// +// Create listbox items. +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::CreateListBoxItemsL() + { + MakeAutodisconItemL(); + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::UpdateListBoxL() +// +// Update listbox item. +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::UpdateListBoxL( TInt aFeatureId ) + { + switch( aFeatureId ) + { + case KGSSettIdAutodiscon: + MakeAutodisconItemL(); + break; + default: + break; + } + + iListBox->HandleItemAdditionL(); + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::MakeAutodisconItemL() +// +// Create auto disconnect list item +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::MakeAutodisconItemL() + { + CGSDataCallPluginModel* model = CGSDataCallPluginModel::NewL(); + + TInt time = model->AutodisconnectTimeL(); + delete model; + + HBufC* buf = NULL; + + switch( time ) + { + case KGSTimeUnlimited: + buf = iEikonEnv->AllocReadResourceL( R_AUTODISCON_VALUE_NO ); + break; + case KGSOneMinute: + { + buf = iEikonEnv->AllocReadResourceL( R_AUTODISCON_VALUE_1MIN ); + // for A&H number conversion + TPtr bufPtr( buf->Des() ); + if( AknTextUtils::DigitModeQuery( + AknTextUtils::EDigitModeShownToUser ) ) + { + AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); + } + } + break; + default: + buf = StringLoader::LoadL( R_AUTODISCON_VALUE_MIN, + time, iEikonEnv ); + break; + } + + TPtr bufPtr( buf->Des() ); + iListboxItemArray->SetDynamicTextL( KGSSettIdAutodiscon, bufPtr ); + + // And add to listbox + iListboxItemArray->SetItemVisibilityL( KGSSettIdAutodiscon, + CGSListBoxItemTextArray::EVisible ); + + + delete buf; + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::GetHelpContext() const +// +// Gets Help +// --------------------------------------------------------------------------- +// +void CGSDataCallPluginContainer::GetHelpContext( + TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidGS; + aContext.iContext = KSET_HLP_CONNEC_DATA; + } + + +// --------------------------------------------------------------------------- +// CGSDataCallPluginContainer::CurrentFeatureId() +// +// Return the feature id of selected listitem +// --------------------------------------------------------------------------- +// +TInt CGSDataCallPluginContainer::CurrentFeatureId( ) const + { + return iListboxItemArray->CurrentFeature( ); + } + + +// End of File