|
1 /* |
|
2 * Copyright (c) 2005-2009 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 CGSAccessoryPluginContainer class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <aknlists.h> |
|
20 #include <gsaccessoryplugin.rsg> |
|
21 #include <gsfwviewuids.h> // for KUidGS |
|
22 #include <gslistbox.h> |
|
23 #include <csxhelp/cp.hlp.hrh> |
|
24 #include <StringLoader.h> |
|
25 |
|
26 #include "gsaccessoryplugin.hrh" |
|
27 #include "gsaccessorypluginmodel.h" |
|
28 #include "gsaccessoryplugincontainer.h" |
|
29 #include "trace.h" |
|
30 |
|
31 // ========================== MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // --------------------------------------------------------------------------- |
|
34 // CGSAccessoryPluginContainer::CGSAccessoryPluginContainer() |
|
35 // --------------------------------------------------------------------------- |
|
36 // |
|
37 CGSAccessoryPluginContainer::CGSAccessoryPluginContainer( |
|
38 CGSAccessoryPluginModel& aModel ) |
|
39 : iModel( aModel ) |
|
40 { |
|
41 FUNC_LOG; |
|
42 } |
|
43 |
|
44 |
|
45 // --------------------------------------------------------------------------- |
|
46 // CGSAccessoryPluginContainer::~CGSAccessoryPluginContainer() |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CGSAccessoryPluginContainer::~CGSAccessoryPluginContainer() |
|
50 { |
|
51 FUNC_LOG; |
|
52 |
|
53 delete iListboxItemArray; |
|
54 delete iDefaultText; |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CGSAccessoryPluginContainer::CurrentFeatureId() |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 TInt CGSAccessoryPluginContainer::CurrentFeatureId() const |
|
63 { |
|
64 FUNC_LOG; |
|
65 |
|
66 return iListboxItemArray->CurrentFeature(); |
|
67 } |
|
68 |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CGSAccessoryPluginContainer::ChangeDefaultItemL() |
|
72 // --------------------------------------------------------------------------- |
|
73 // |
|
74 void CGSAccessoryPluginContainer::ChangeDefaultItemL( |
|
75 const TInt aNewDefaultItem, |
|
76 const TInt aOldDefaultItem ) |
|
77 { |
|
78 FUNC_LOG; |
|
79 |
|
80 INFO_2( "Default accessory changed from %d to %d", aOldDefaultItem, aNewDefaultItem ); |
|
81 |
|
82 ShowLabelL( aOldDefaultItem, KNullDesC ); |
|
83 ShowLabelL( aNewDefaultItem, *iDefaultText ); |
|
84 } |
|
85 |
|
86 |
|
87 // --------------------------------------------------------------------------- |
|
88 // CGSAccessoryPluginContainer::ConstructL() |
|
89 // --------------------------------------------------------------------------- |
|
90 // |
|
91 void CGSAccessoryPluginContainer::ConstructL( const TRect& aRect ) |
|
92 { |
|
93 FUNC_LOG; |
|
94 |
|
95 iListBox = new ( ELeave ) CAknDoubleStyleListBox; |
|
96 BaseConstructL( aRect, R_ACC_MAIN_VIEW_TITLE, R_ACC_MAIN_VIEW_LBX ); // Needs the listbox |
|
97 } |
|
98 |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // CGSAccessoryPluginContainer::ConstructListBoxL() |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CGSAccessoryPluginContainer::ConstructListBoxL( TInt aResLbxId ) |
|
105 { |
|
106 FUNC_LOG; |
|
107 |
|
108 iListBox->ConstructL( this, EAknListBoxSelectionList ); |
|
109 iListboxItemArray = CGSListBoxItemTextArray::NewL( |
|
110 aResLbxId, *iListBox, *iCoeEnv ); |
|
111 iListBox->Model()->SetItemTextArray( iListboxItemArray ); |
|
112 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
113 |
|
114 MakeVisibleIfSupportedL( EGSHeadset, EGSHeadsetListItemId ); |
|
115 MakeVisibleIfSupportedL( EGSHeadphones, EGSHeadphonesListItemId ); |
|
116 MakeVisibleIfSupportedL( EGSMusicStand, EGSMusicStandListItemId ); |
|
117 MakeVisibleIfSupportedL( EGSTextPhone, EGSTextPhoneListItemId ); |
|
118 MakeVisibleIfSupportedL( EGSTvout, EGSTvOutListItemId ); |
|
119 MakeVisibleIfSupportedL( EGSWiredCarkit, EGSWiredCarKitListItemId ); |
|
120 MakeVisibleIfSupportedL( EGSWirelessCarkit, EGSWirelessCarKitListItemId ); |
|
121 MakeVisibleIfSupportedL( EGSLoopset, EGSLoopsetListItemId ); |
|
122 MakeVisibleIfSupportedL( EGSHac, EGSHACListItemId ); |
|
123 |
|
124 iDefaultText = StringLoader::LoadL( R_ACC_DEFAULT_ACCESSORY ); |
|
125 ShowLabelL( iModel.DefaultAccessory(), *iDefaultText ); |
|
126 } |
|
127 |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // CGSAccessoryPluginContainer::GetHelpContext() const |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void CGSAccessoryPluginContainer::GetHelpContext( |
|
134 TCoeHelpContext& aContext ) const |
|
135 { |
|
136 FUNC_LOG; |
|
137 |
|
138 aContext.iMajor = KUidGS; |
|
139 aContext.iContext = KSET_HLP_ACCESSORIES_LIST; |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // CGSAccessoryPluginContainer::MakeVisibleIfSupportedL() |
|
145 // |
|
146 // --------------------------------------------------------------------------- |
|
147 // |
|
148 void CGSAccessoryPluginContainer::MakeVisibleIfSupportedL( |
|
149 TInt aAccessory, |
|
150 TInt aItemId ) |
|
151 { |
|
152 FUNC_LOG; |
|
153 |
|
154 if ( iModel.AccessorySupportedL( aAccessory ) ) |
|
155 { |
|
156 iListboxItemArray->SetItemVisibilityL( |
|
157 aItemId, CGSListBoxItemTextArray::EVisible ); |
|
158 } |
|
159 } |
|
160 |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // CGSAccessoryPluginContainer::ShowLabelL() |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 void CGSAccessoryPluginContainer::ShowLabelL( |
|
167 TInt aFeatureId, |
|
168 const TDesC& aLabel ) |
|
169 { |
|
170 FUNC_LOG; |
|
171 |
|
172 iListboxItemArray->SetDynamicTextDoublePaneL( aFeatureId, aLabel ); |
|
173 } |