|
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 CGSAccHeadsetContainer class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32cmn.h> // For accessoriescrkeys.h |
|
20 #include <accessoriescrkeys.h> |
|
21 #include <gsaccessoryplugin.rsg> |
|
22 #include <gsfwviewuids.h> // for KUidGS |
|
23 #include <gslistbox.h> |
|
24 #include <csxhelp/cp.hlp.hrh> |
|
25 |
|
26 #include "gsaccessoryplugin.hrh" |
|
27 #include "gsaccessorypluginmodel.h" |
|
28 #include "gsaccheadsetcontainer.h" |
|
29 #include "gsaccprofilelist.h" |
|
30 #include "trace.h" |
|
31 |
|
32 // ========================= MEMBER FUNCTIONS ================================ |
|
33 |
|
34 // --------------------------------------------------------------------------- |
|
35 // CGSAccHeadsetContainer::CGSAccHeadsetContainer() |
|
36 // --------------------------------------------------------------------------- |
|
37 // |
|
38 CGSAccHeadsetContainer::CGSAccHeadsetContainer( |
|
39 CGSAccessoryPluginModel& aModel ) |
|
40 : CGSAccBaseContainer( aModel ) |
|
41 { |
|
42 FUNC_LOG; |
|
43 } |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // CGSAccHeadsetContainer::~CGSAccHeadsetContainer() |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CGSAccHeadsetContainer::~CGSAccHeadsetContainer() |
|
51 { |
|
52 FUNC_LOG; |
|
53 |
|
54 delete iAutoAnswerItems; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CGSAccHeadsetContainer::UpdateListBoxL( TInt aFeatureId ) |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 void CGSAccHeadsetContainer::UpdateListBoxL( TInt aFeatureId ) |
|
63 { |
|
64 FUNC_LOG; |
|
65 |
|
66 switch( aFeatureId ) |
|
67 { |
|
68 case KGSSettIdHSDP: |
|
69 RefreshDefaultProfileL(); |
|
70 break; |
|
71 case KGSSettIdHSAA: |
|
72 RefreshAutoAnswerL(); |
|
73 break; |
|
74 default: |
|
75 break; |
|
76 } |
|
77 |
|
78 iListBox->HandleItemAdditionL(); |
|
79 } |
|
80 |
|
81 |
|
82 // --------------------------------------------------------------------------- |
|
83 // CGSAccHeadsetContainer::ConstructL() |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CGSAccHeadsetContainer::ConstructL( const TRect& aRect ) |
|
87 { |
|
88 FUNC_LOG; |
|
89 |
|
90 CreateListBoxL(); |
|
91 BaseConstructL( aRect, R_ACC_HEADSET_TITLE, R_ACC_HEADSET_LBX ); // Needs the listbox |
|
92 } |
|
93 |
|
94 |
|
95 // --------------------------------------------------------------------------- |
|
96 // CGSAccHeadsetContainer::ConstructListBoxL() |
|
97 // --------------------------------------------------------------------------- |
|
98 // |
|
99 void CGSAccHeadsetContainer::ConstructListBoxL( TInt aResLbxId ) |
|
100 { |
|
101 FUNC_LOG; |
|
102 |
|
103 CGSAccBaseContainer::ConstructListBoxL( aResLbxId ); |
|
104 |
|
105 iAutoAnswerItems = |
|
106 iCoeEnv->ReadDesC16ArrayResourceL( R_ACC_AUTO_ANSWER_SETTING_PAGE_LBX ); |
|
107 |
|
108 RefreshDefaultProfileL(); |
|
109 MakeItemVisibleL( KGSSettIdHSDP ); |
|
110 |
|
111 RefreshAutoAnswerL(); |
|
112 MakeItemVisibleL( KGSSettIdHSAA ); |
|
113 } |
|
114 |
|
115 |
|
116 // --------------------------------------------------------------------------- |
|
117 // CGSAccHeadsetContainer::GetHelpContext() const |
|
118 // --------------------------------------------------------------------------- |
|
119 // |
|
120 void CGSAccHeadsetContainer::GetHelpContext( TCoeHelpContext& aContext ) const |
|
121 { |
|
122 FUNC_LOG; |
|
123 |
|
124 aContext.iMajor = KUidGS; |
|
125 aContext.iContext = KSET_HLP_ACCESSORIES_HEADSET; |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CGSAccHeadsetContainer::RefreshDefaultProfileL() |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void CGSAccHeadsetContainer::RefreshDefaultProfileL() |
|
134 { |
|
135 FUNC_LOG; |
|
136 |
|
137 TInt profile = |
|
138 iModel.DefaultProfileByKey( KSettingsHeadsetDefaultProfile ); |
|
139 // Set default profile item text. |
|
140 SetItemTextL( |
|
141 KGSSettIdHSDP, |
|
142 iModel.ProfileList().NameByIdL( profile, iCoeEnv ) ); |
|
143 } |
|
144 |
|
145 |
|
146 // --------------------------------------------------------------------------- |
|
147 // CGSAccHeadsetContainer::RefreshAutoAnswerL() |
|
148 // --------------------------------------------------------------------------- |
|
149 // |
|
150 void CGSAccHeadsetContainer::RefreshAutoAnswerL() |
|
151 { |
|
152 FUNC_LOG; |
|
153 |
|
154 TInt mode = iModel.AutoAnswerModeByKey( KSettingsHeadsetAutomaticAnswer ); |
|
155 if ( iAutoAnswerItems && mode >= 0 && mode < iAutoAnswerItems->Count() ) |
|
156 { |
|
157 SetItemTextL( KGSSettIdHSAA, ( *iAutoAnswerItems )[ mode ] ); |
|
158 } |
|
159 } |