diff -r 000000000000 -r 2e3d3ce01487 systemsettings/GSAccessoryPlugin/src/gsaccheadphonescontainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemsettings/GSAccessoryPlugin/src/gsaccheadphonescontainer.cpp Tue Feb 02 10:12:00 2010 +0200 @@ -0,0 +1,126 @@ +/* +* Copyright (c) 2005-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: Implementation of CGSAccHeadphonesContainer class +* +*/ + + +#include // For accessoriescrkeys.h +#include +#include +#include // for KUidGS +#include +#include + +#include "gsaccessoryplugin.hrh" +#include "gsaccessorypluginmodel.h" +#include "gsaccprofilelist.h" +#include "gsaccheadphonescontainer.h" +#include "trace.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::CGSAccHeadphonesContainer() +// --------------------------------------------------------------------------- +// +CGSAccHeadphonesContainer::CGSAccHeadphonesContainer( + CGSAccessoryPluginModel& aModel ) + : CGSAccBaseContainer( aModel ) + { + FUNC_LOG; + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::~CGSAccHeadphonesContainer() +// --------------------------------------------------------------------------- +// +CGSAccHeadphonesContainer::~CGSAccHeadphonesContainer() + { + FUNC_LOG; + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::UpdateListBoxL( TInt aFeatureId ) +// --------------------------------------------------------------------------- +// +void CGSAccHeadphonesContainer::UpdateListBoxL( TInt aFeatureId ) + { + FUNC_LOG; + + if ( aFeatureId == KGSSettIdHPDP ) + { + RefreshDefaultProfileL(); + } + + iListBox->HandleItemAdditionL(); + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::ConstructL() +// --------------------------------------------------------------------------- +// +void CGSAccHeadphonesContainer::ConstructL( const TRect& aRect ) + { + FUNC_LOG; + + CreateListBoxL(); + BaseConstructL( aRect, R_ACC_HEADPHONES_TITLE, R_ACC_HEADPHONES_LBX ); // Needs the listbox + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::ConstructListBoxL() +// --------------------------------------------------------------------------- +// +void CGSAccHeadphonesContainer::ConstructListBoxL( TInt aResLbxId ) + { + FUNC_LOG; + + CGSAccBaseContainer::ConstructListBoxL( aResLbxId ); + + RefreshDefaultProfileL(); + MakeItemVisibleL( KGSSettIdHPDP ); + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::GetHelpContext() const +// --------------------------------------------------------------------------- +// +void CGSAccHeadphonesContainer::GetHelpContext( TCoeHelpContext& aContext ) const + { + aContext.iMajor = KUidGS; + aContext.iContext = KSET_HLP_ACCESSORIES_HEADPHONE; + } + + +// --------------------------------------------------------------------------- +// CGSAccHeadphonesContainer::RefreshDefaultProfileL() +// --------------------------------------------------------------------------- +// +void CGSAccHeadphonesContainer::RefreshDefaultProfileL() + { + FUNC_LOG; + + TInt profile = + iModel.DefaultProfileByKey( KSettingsHeadphonesDefaultProfile ); + // Set default profile item text. + SetItemTextL( + KGSSettIdHPDP, + iModel.ProfileList().NameByIdL( profile, iCoeEnv ) ); + }