|
1 /* |
|
2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Data structure class for profile tones view settings. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // CLASS HEADER |
|
21 #include "CProfilesGSTonesViewSettings.h" |
|
22 |
|
23 // INTERNAL INCLUDES |
|
24 #include "ProfilesGSTonesPlugin.hrh" |
|
25 #include "ProfilesDebug.h" |
|
26 #include "CProfilesGSTonesViewFeatures.h" |
|
27 |
|
28 // INCLUDES FROM PROFILES SETTINGS VIEW |
|
29 |
|
30 // SYSTEM INCLUDES |
|
31 #include <centralrepository.h> |
|
32 #include <HWRMDomainCRKeys.h> |
|
33 #include <ProfileEngineDomainCRKeys.h> |
|
34 |
|
35 // ============================ MEMBER FUNCTIONS =============================== |
|
36 |
|
37 // Destructor |
|
38 CProfilesGSTonesViewSettings::~CProfilesGSTonesViewSettings() |
|
39 { |
|
40 delete iHwRmSession; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CProfilesGSTonesViewSettings::ConstructL |
|
45 // ----------------------------------------------------------------------------- |
|
46 // |
|
47 void CProfilesGSTonesViewSettings::ConstructL() |
|
48 { |
|
49 PRODEBUG( "CProfilesGSTonesPluginSettingHandler::ConstructL begin" ); |
|
50 if( iFeatures.IsLocalFeatureSupported( KTonesViewFeatureIdHac ) ) |
|
51 { |
|
52 iHwRmSession = CRepository::NewL( KCRUidHWSettings ); |
|
53 User::LeaveIfError( iHwRmSession->Get( KHWSettingsHearingAidMode, iHac ) ); |
|
54 } |
|
55 PRODEBUG( "CProfilesGSTonesPluginSettingHandler::ConstructL end" ); |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // CProfilesGSTonesViewSettings::NewL |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CProfilesGSTonesViewSettings* CProfilesGSTonesViewSettings::NewL( |
|
63 CProfilesGSTonesViewFeatures& aFeatures ) |
|
64 |
|
65 { |
|
66 CProfilesGSTonesViewSettings* self = new ( ELeave ) |
|
67 CProfilesGSTonesViewSettings( aFeatures ); |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL(); |
|
70 CleanupStack::Pop( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CProfilesGSTonesViewSettings::StoreIfChangedL |
|
76 // ----------------------------------------------------------------------------- |
|
77 // |
|
78 void CProfilesGSTonesViewSettings::StoreIfChangedL( TInt aSettingId ) const |
|
79 { |
|
80 if( ( aSettingId == EProfileGSTonesPluginSettingHacModeId ) && |
|
81 iFeatures.IsLocalFeatureSupported( KTonesViewFeatureIdHac ) ) |
|
82 { |
|
83 TInt currentValue( 0 ); |
|
84 User::LeaveIfError( iHwRmSession->Get( KHWSettingsHearingAidMode, |
|
85 currentValue ) ); |
|
86 if( currentValue != iHac ) |
|
87 { |
|
88 User::LeaveIfError( iHwRmSession->Set( KHWSettingsHearingAidMode, |
|
89 iHac ) ); |
|
90 currentValue = iHac; |
|
91 } |
|
92 } |
|
93 } |
|
94 |
|
95 // End Of File |
|
96 |