diff -r 000000000000 -r ca436256272f profilesapplication/Profiles/ProfilesGSTonesPlugin/src/CProfilesGSTonesViewSettings.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/profilesapplication/Profiles/ProfilesGSTonesPlugin/src/CProfilesGSTonesViewSettings.cpp Thu Dec 17 08:45:58 2009 +0200 @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2006 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: Data structure class for profile tones view settings. +* +*/ + + + +// CLASS HEADER +#include "CProfilesGSTonesViewSettings.h" + +// INTERNAL INCLUDES +#include "ProfilesGSTonesPlugin.hrh" +#include "ProfilesDebug.h" +#include "CProfilesGSTonesViewFeatures.h" + +// INCLUDES FROM PROFILES SETTINGS VIEW + +// SYSTEM INCLUDES +#include +#include +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// Destructor +CProfilesGSTonesViewSettings::~CProfilesGSTonesViewSettings() + { + delete iHwRmSession; + } + +// ----------------------------------------------------------------------------- +// CProfilesGSTonesViewSettings::ConstructL +// ----------------------------------------------------------------------------- +// +void CProfilesGSTonesViewSettings::ConstructL() + { + PRODEBUG( "CProfilesGSTonesPluginSettingHandler::ConstructL begin" ); + if( iFeatures.IsLocalFeatureSupported( KTonesViewFeatureIdHac ) ) + { + iHwRmSession = CRepository::NewL( KCRUidHWSettings ); + User::LeaveIfError( iHwRmSession->Get( KHWSettingsHearingAidMode, iHac ) ); + } + PRODEBUG( "CProfilesGSTonesPluginSettingHandler::ConstructL end" ); + } + +// ----------------------------------------------------------------------------- +// CProfilesGSTonesViewSettings::NewL +// ----------------------------------------------------------------------------- +// +CProfilesGSTonesViewSettings* CProfilesGSTonesViewSettings::NewL( + CProfilesGSTonesViewFeatures& aFeatures ) + + { + CProfilesGSTonesViewSettings* self = new ( ELeave ) + CProfilesGSTonesViewSettings( aFeatures ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CProfilesGSTonesViewSettings::StoreIfChangedL +// ----------------------------------------------------------------------------- +// +void CProfilesGSTonesViewSettings::StoreIfChangedL( TInt aSettingId ) const + { + if( ( aSettingId == EProfileGSTonesPluginSettingHacModeId ) && + iFeatures.IsLocalFeatureSupported( KTonesViewFeatureIdHac ) ) + { + TInt currentValue( 0 ); + User::LeaveIfError( iHwRmSession->Get( KHWSettingsHearingAidMode, + currentValue ) ); + if( currentValue != iHac ) + { + User::LeaveIfError( iHwRmSession->Set( KHWSettingsHearingAidMode, + iHac ) ); + currentValue = iHac; + } + } + } + +// End Of File +