|
1 /* |
|
2 * Copyright (c) 2005-2008 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: Implementation of CGSAccMusicStandContainer class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32cmn.h> // For accessoriescrkeys.h |
|
20 #include <accessoriescrkeys.h> |
|
21 #include <AccSettingsDomainCRKeys.h> |
|
22 #include <gsaccessoryplugin.rsg> |
|
23 #include <gsfwviewuids.h> // for KUidGS |
|
24 #include <gslistbox.h> |
|
25 #include <csxhelp/cp.hlp.hrh> |
|
26 |
|
27 #include "gsaccessoryplugin.hrh" |
|
28 #include "gsaccessorypluginmodel.h" |
|
29 #include "gsaccmusicstandcontainer.h" |
|
30 #include "gsaccprofilelist.h" |
|
31 #include "trace.h" |
|
32 |
|
33 // ========================= MEMBER FUNCTIONS ================================ |
|
34 |
|
35 // --------------------------------------------------------------------------- |
|
36 // CGSAccMusicStandContainer::CGSAccMusicStandContainer() |
|
37 // --------------------------------------------------------------------------- |
|
38 // |
|
39 CGSAccMusicStandContainer::CGSAccMusicStandContainer( |
|
40 CGSAccessoryPluginModel& aModel ) |
|
41 : CGSAccBaseContainer( aModel ) |
|
42 { |
|
43 FUNC_LOG; |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CGSAccMusicStandContainer::~CGSAccMusicStandContainer() |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CGSAccMusicStandContainer::~CGSAccMusicStandContainer() |
|
52 { |
|
53 FUNC_LOG; |
|
54 |
|
55 delete iLightModeItems; |
|
56 delete iAutoAnswerItems; |
|
57 } |
|
58 |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CGSAccMusicStandContainer::UpdateListBoxL( TInt aFeatureId ) |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CGSAccMusicStandContainer::UpdateListBoxL( TInt aFeatureId ) |
|
65 { |
|
66 FUNC_LOG; |
|
67 |
|
68 switch( aFeatureId ) |
|
69 { |
|
70 case KGSSettIdMSDP: |
|
71 RefreshDefaultProfileL(); |
|
72 break; |
|
73 case KGSSettIdMSAA: |
|
74 RefreshAutoAnswerL(); |
|
75 break; |
|
76 case KGSSettIdMSL: |
|
77 RefreshLightModeL(); |
|
78 break; |
|
79 default: |
|
80 break; |
|
81 } |
|
82 |
|
83 iListBox->HandleItemAdditionL(); |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CGSAccMusicStandContainer::ConstructL() |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CGSAccMusicStandContainer::ConstructL( const TRect& aRect ) |
|
92 { |
|
93 FUNC_LOG; |
|
94 |
|
95 CreateListBoxL(); |
|
96 BaseConstructL( aRect, R_ACC_MUSIC_STAND_TITLE, R_ACC_MUSIC_STAND_LBX ); // Needs the listbox |
|
97 } |
|
98 |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CGSAccMusicStandContainer::ConstructListBoxL() |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CGSAccMusicStandContainer::ConstructListBoxL( TInt aResLbxId ) |
|
105 { |
|
106 FUNC_LOG; |
|
107 |
|
108 CGSAccBaseContainer::ConstructListBoxL( aResLbxId ); |
|
109 |
|
110 iAutoAnswerItems = |
|
111 iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_AUTO_ANSWER_SETTING_PAGE_LBX ); |
|
112 iLightModeItems = |
|
113 iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_LIGHTS_SETTING_PAGE_LBX ); |
|
114 |
|
115 RefreshDefaultProfileL(); |
|
116 MakeItemVisibleL( KGSSettIdMSDP ); |
|
117 |
|
118 RefreshAutoAnswerL(); |
|
119 MakeItemVisibleL( KGSSettIdMSAA ); |
|
120 |
|
121 RefreshLightModeL(); |
|
122 MakeItemVisibleL( KGSSettIdMSL ); |
|
123 } |
|
124 |
|
125 |
|
126 // --------------------------------------------------------------------------- |
|
127 // CGSAccMusicStandContainer::GetHelpContext() const |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 void CGSAccMusicStandContainer::GetHelpContext( |
|
131 TCoeHelpContext& aContext ) const |
|
132 { |
|
133 FUNC_LOG; |
|
134 |
|
135 aContext.iMajor = KUidGS; |
|
136 aContext.iContext = KSET_HLP_ACCESSORIES_MUSIC_ST; |
|
137 } |
|
138 |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // CGSAccMusicStandContainer::RefreshDefaultProfileL() |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 void CGSAccMusicStandContainer::RefreshDefaultProfileL() |
|
145 { |
|
146 FUNC_LOG; |
|
147 |
|
148 TInt profile = |
|
149 iModel.DefaultProfileByKey( KSettingsMusicStandDefaultProfile ); |
|
150 // Set default profile item text. |
|
151 SetItemTextL( |
|
152 KGSSettIdMSDP, |
|
153 iModel.ProfileList().NameByIdL( profile, iCoeEnv ) ); |
|
154 } |
|
155 |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CGSAccMusicStandContainer::RefreshAutoAnswerL() |
|
159 // --------------------------------------------------------------------------- |
|
160 // |
|
161 void CGSAccMusicStandContainer::RefreshAutoAnswerL() |
|
162 { |
|
163 FUNC_LOG; |
|
164 |
|
165 TInt mode = iModel.AutoAnswerModeByKey( KSettingsMusicStandAutomaticAnswer ); |
|
166 if ( iAutoAnswerItems && mode >= 0 && mode < iAutoAnswerItems->Count() ) |
|
167 { |
|
168 SetItemTextL( KGSSettIdMSAA, ( *iAutoAnswerItems )[ mode ] ); |
|
169 } |
|
170 } |
|
171 |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // CGSAccMusicStandContainer::RefreshLightModeL() |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 void CGSAccMusicStandContainer::RefreshLightModeL() |
|
178 { |
|
179 FUNC_LOG; |
|
180 |
|
181 TInt mode = iModel.LightMode( EAccModeMusicStand, KAccServerMusicStandLights ); |
|
182 if ( iLightModeItems && mode >= 0 && mode < iLightModeItems->Count() ) |
|
183 { |
|
184 SetItemTextL( KGSSettIdMSL, ( *iLightModeItems )[ mode ] ); |
|
185 } |
|
186 } |