diff -r 000000000000 -r 2e3d3ce01487 systemsettings/GSAccessoryPlugin/src/gsaccmusicstandview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/systemsettings/GSAccessoryPlugin/src/gsaccmusicstandview.cpp Tue Feb 02 10:12:00 2010 +0200 @@ -0,0 +1,166 @@ +/* +* 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 CGSAccMusicStandView class +* +*/ + + +#include // For accessoriescrkeys.h +#include +#include +#include +#include + +#include "acclocalviewids.h" +#include "gsaccessoryplugin.hrh" +#include "gsaccmusicstandcontainer.h" +#include "gsaccmusicstandview.h" +#include "trace.h" + +// ========================= MEMBER FUNCTIONS ================================ + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::NewLC() +// --------------------------------------------------------------------------- +// +CGSAccMusicStandView* CGSAccMusicStandView::NewLC( + CGSAccessoryPluginModel& aModel ) + { + CGSAccMusicStandView* self = + new ( ELeave ) CGSAccMusicStandView( aModel ); + CleanupStack::PushL( self ); + self->BaseConstructL( R_ACC_MUSIC_STAND_VIEW ); + return self; + } + + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::~CGSAccMusicStandView() +// --------------------------------------------------------------------------- +// +CGSAccMusicStandView::~CGSAccMusicStandView() + { + FUNC_LOG; + } + + +// --------------------------------------------------------------------------- +// TUid CGSAccMusicStandView::Id() +// --------------------------------------------------------------------------- +// +TUid CGSAccMusicStandView::Id() const + { + return KAccMusicStandViewId; + } + + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::HandleCommandL() +// --------------------------------------------------------------------------- +// +void CGSAccMusicStandView::HandleCommandL( TInt aCommand ) + { + FUNC_LOG; + + if ( aCommand == EGSCmdAppChange ) + { + const TInt currentFeatureId = iContainer->CurrentFeatureId(); + if ( currentFeatureId == KGSSettIdMSAA ) + { + // Change automatic answer mode setting through selection dialog + ChangeAutoAnswerModeSettingL( + KSettingsMusicStandAutomaticAnswer, + KGSSettIdMSAA, + ETrue ); + } + else if ( currentFeatureId == KGSSettIdMSL ) + { + // Change lights mode setting through selection dialog + ChangeLightModeSettingL( + EAccModeMusicStand, + KAccServerMusicStandLights, + KGSSettIdMSL, + ETrue ); + } + else + { + // Act as user had pressed the selection key + HandleListBoxSelectionL( currentFeatureId ); + } + } + else + { + CGSAccBaseView::HandleCommandL( aCommand ); + } + } + + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::NewContainerL() +// --------------------------------------------------------------------------- +// +void CGSAccMusicStandView::NewContainerL() + { + iContainer = new ( ELeave ) CGSAccMusicStandContainer( iModel ); + } + + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::HandleListBoxSelectionL() +// --------------------------------------------------------------------------- +// +void CGSAccMusicStandView::HandleListBoxSelectionL( TInt aSelectedItem ) + { + FUNC_LOG; + + // User has pressed selection key. If the selected item has just two + // possible values, flip the value to the other option. If the item has + // more possible values, show a selection dialog. + switch ( aSelectedItem ) + { + case KGSSettIdMSDP: + // Show selection dialog for the accessory default profile + ChangeDefaultProfileL( + KSettingsMusicStandDefaultProfile, KGSSettIdMSDP ); + break; + case KGSSettIdMSAA: + // Change automatic answer mode setting without selection dialog + ChangeAutoAnswerModeSettingL( + KSettingsMusicStandAutomaticAnswer, + KGSSettIdMSAA, + EFalse ); + break; + case KGSSettIdMSL: + // Change lights mode setting without selection dialog + ChangeLightModeSettingL( + EAccModeMusicStand, + KAccServerMusicStandLights, + KGSSettIdMSL, + EFalse ); + break; + default: + break; + } + } + + +// --------------------------------------------------------------------------- +// CGSAccMusicStandView::CGSAccMusicStandView() +// --------------------------------------------------------------------------- +// +CGSAccMusicStandView::CGSAccMusicStandView( CGSAccessoryPluginModel& aModel ) + : CGSAccBaseView( aModel ) + { + FUNC_LOG; + }