|
1 /* |
|
2 * Copyright (c) 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: MCS settings plug-in main class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <ecom/implementationproxy.h> |
|
19 #include <e32std.h> |
|
20 #include <eikmenup.h> |
|
21 #include <eikbtgpc.h> |
|
22 #include <StringLoader.h> |
|
23 #include <gsfwviewuids.h> |
|
24 #include <gsprivatepluginproviderids.h> |
|
25 #include <bautils.h> |
|
26 #include <pathinfo.h> |
|
27 #include <featmgr.h> |
|
28 #include <e32property.h> // For RProperty |
|
29 #include <activeidle2domainpskeys.h> // For KPSUidActiveIdle2 |
|
30 |
|
31 #include <avkon.rsg> |
|
32 #include <mcspluginsettingsres.rsg> |
|
33 #include <aisystemuids.hrh> |
|
34 |
|
35 #include "mcspluginsettings.hrh" |
|
36 #include "mcspluginsettings.h" |
|
37 #include "mcspluginsettingscontainer.h" |
|
38 #include "mcspluginsettingsmodel.h" |
|
39 #include "mcspluginuids.hrh" |
|
40 |
|
41 const TUid KUidScutSettingsPlugin = |
|
42 { |
|
43 AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN |
|
44 }; |
|
45 |
|
46 const TUid KUidAiFwCommon = |
|
47 { |
|
48 AI_UID3_AIFW_COMMON |
|
49 }; |
|
50 |
|
51 _LIT(KMCSSettingsResourceFileName, "mcspluginsettingsres.rsc"); |
|
52 |
|
53 /** Implementation table for MCS settings plug-in */ |
|
54 const TImplementationProxy KMCSPluginSettingsImplementationTable[] = |
|
55 { |
|
56 IMPLEMENTATION_PROXY_ENTRY( |
|
57 AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN, CMCSPluginSettings::NewL) |
|
58 }; |
|
59 |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // Gate/factory function. |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
66 { |
|
67 aTableCount = |
|
68 sizeof(KMCSPluginSettingsImplementationTable) / |
|
69 sizeof(TImplementationProxy); |
|
70 return KMCSPluginSettingsImplementationTable; |
|
71 } |
|
72 |
|
73 // ======== MEMBER FUNCTIONS ======== |
|
74 |
|
75 // --------------------------------------------------------------------------- |
|
76 // First phase construction |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CMCSPluginSettings::CMCSPluginSettings() |
|
80 { |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // Second phase construction |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 void CMCSPluginSettings::ConstructL() |
|
88 { |
|
89 FeatureManager::InitializeLibL(); |
|
90 |
|
91 TParsePtrC driveParse(PathInfo::RomRootPath()); |
|
92 TFileName resourceName(driveParse.Drive()); |
|
93 // Find the resource file. |
|
94 TParse parse; |
|
95 parse.Set(KMCSSettingsResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
96 resourceName.Append(parse.FullName()); |
|
97 // Open resource file. |
|
98 iResourceLoader.OpenL(resourceName); |
|
99 |
|
100 iModel = CMCSPluginSettingsModel::NewL(*this, iCoeEnv); |
|
101 |
|
102 BaseConstructL(R_AI_MCS_SETTINGS_VIEW); |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // Two-phased constructor |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 CMCSPluginSettings* CMCSPluginSettings::NewL( TAny* /*aInitParams*/ ) |
|
110 { |
|
111 CMCSPluginSettings* self = new (ELeave) CMCSPluginSettings; |
|
112 CleanupStack::PushL(self); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop(self); |
|
115 return self; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // Destructor |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 CMCSPluginSettings::~CMCSPluginSettings() |
|
123 { |
|
124 FeatureManager::UnInitializeLib(); |
|
125 iResourceLoader.Close(); |
|
126 delete iModel; |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // From CAknView |
|
131 // Returns view id. |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 TUid CMCSPluginSettings::Id() const |
|
135 { |
|
136 return KUidScutSettingsPlugin; |
|
137 } |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // From CAknView |
|
141 // Handles commands. |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 void CMCSPluginSettings::HandleCommandL(TInt aCommand) |
|
145 { |
|
146 switch (aCommand) |
|
147 { |
|
148 case EAiScutSettingsCmdChange: |
|
149 Container()->HandleChangeCommandL(); |
|
150 break; |
|
151 |
|
152 case EAknCmdHelp: |
|
153 Container()->HandleHelpCommandL(); |
|
154 break; |
|
155 |
|
156 case EAknSoftkeyBack: |
|
157 if (iAppUi->View(KGSMainViewUid)) |
|
158 { |
|
159 // if we are in GS activate parent plugin view (standby view)... |
|
160 iAppUi->ActivateLocalViewL(KGSPrslnPluginUid); |
|
161 } |
|
162 else |
|
163 { |
|
164 iAppUi->ActivateLocalViewL(iPrevViewId.iViewUid); |
|
165 } |
|
166 break; |
|
167 |
|
168 case EAknSoftkeyExit: |
|
169 iAppUi->HandleCommandL(EAknCmdExit); |
|
170 break; |
|
171 |
|
172 default: |
|
173 iAppUi->HandleCommandL(aCommand); |
|
174 break; |
|
175 } |
|
176 } |
|
177 |
|
178 // ---------------------------------------------------------------------------- |
|
179 // From CAknView |
|
180 // First method called by the Avkon framwork |
|
181 // ---------------------------------------------------------------------------- |
|
182 // |
|
183 void CMCSPluginSettings::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage) |
|
184 { |
|
185 CEikButtonGroupContainer* cba = Cba(); |
|
186 |
|
187 if (cba) |
|
188 { |
|
189 if (aCustomMessageId == KUidAiFwCommon) |
|
190 { |
|
191 cba->SetCommandSetL(R_SCUT_SOFTKEYS_OPTIONS_EXIT_CHANGE); |
|
192 } |
|
193 else |
|
194 { |
|
195 cba->SetCommandSetL(R_SCUT_SOFTKEYS_OPTIONS_BACK_CHANGE); |
|
196 } |
|
197 cba->DrawDeferred(); |
|
198 } |
|
199 |
|
200 CGSBaseView::DoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage); |
|
201 |
|
202 iModel->UpdateSettingsContainerL( aCustomMessage ); |
|
203 } |
|
204 |
|
205 // ---------------------------------------------------------------------------- |
|
206 // From CAknView |
|
207 // Called by the Avkon view framework when closing. |
|
208 // ---------------------------------------------------------------------------- |
|
209 // |
|
210 void CMCSPluginSettings::DoDeactivate() |
|
211 { |
|
212 CGSBaseView::DoDeactivate(); |
|
213 |
|
214 iModel->SetContainer(Container()); |
|
215 } |
|
216 |
|
217 // ---------------------------------------------------------------------------- |
|
218 // From MEikMenuObserver |
|
219 // ---------------------------------------------------------------------------- |
|
220 // |
|
221 void CMCSPluginSettings::DynInitMenuPaneL( |
|
222 TInt aResourceId, CEikMenuPane* aMenuPane) |
|
223 { |
|
224 if (aMenuPane && aResourceId == R_AI_MCS_SETTINGS_MENUPANE) |
|
225 { |
|
226 if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) |
|
227 { |
|
228 // Disable help if not supported |
|
229 aMenuPane->SetItemDimmed(EAknCmdHelp, ETrue); |
|
230 } |
|
231 if (iModel->MdcaCount() == 0) |
|
232 { |
|
233 aMenuPane->SetItemDimmed(EAiScutSettingsCmdChange, ETrue); |
|
234 } |
|
235 } |
|
236 } |
|
237 |
|
238 // --------------------------------------------------------------------------- |
|
239 // From CGSPluginInterface. 256 |
|
240 // --------------------------------------------------------------------------- |
|
241 // |
|
242 void CMCSPluginSettings::GetCaptionL(TDes& aCaption) const |
|
243 { |
|
244 iCoeEnv->ReadResourceL(aCaption, R_AI_MCS_SETTINGS_VIEW_CAPTION); |
|
245 } |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // From CGSPluginInterface |
|
249 // --------------------------------------------------------------------------- |
|
250 // |
|
251 TInt CMCSPluginSettings::PluginProviderCategory() const |
|
252 { |
|
253 return KGSPluginProviderInternal; |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // From CGSPluginInterface |
|
258 // --------------------------------------------------------------------------- |
|
259 // |
|
260 TBool CMCSPluginSettings::Visible() const |
|
261 { |
|
262 return EFalse; |
|
263 } |
|
264 |
|
265 // --------------------------------------------------------------------------- |
|
266 // From CGSBaseView |
|
267 // Returns view id. |
|
268 // --------------------------------------------------------------------------- |
|
269 // |
|
270 CMCSPluginSettingsContainer* CMCSPluginSettings::Container() |
|
271 { |
|
272 return static_cast<CMCSPluginSettingsContainer*>(iContainer); |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // From CGSBaseView |
|
277 // --------------------------------------------------------------------------- |
|
278 // |
|
279 void CMCSPluginSettings::NewContainerL() |
|
280 { |
|
281 delete iContainer; |
|
282 iContainer = NULL; |
|
283 |
|
284 iContainer = new (ELeave) CMCSPluginSettingsContainer(); |
|
285 Container()->SetModel(iModel); |
|
286 iModel->SetContainer(Container()); |
|
287 } |
|
288 |
|
289 // --------------------------------------------------------------------------- |
|
290 // From CGSBaseView |
|
291 // --------------------------------------------------------------------------- |
|
292 // |
|
293 void CMCSPluginSettings::HandleListBoxSelectionL() |
|
294 { |
|
295 Container()->HandleChangeCommandL(); |
|
296 } |
|
297 |
|
298 // --------------------------------------------------------------------------- |
|
299 // Returns if container exists or not |
|
300 // --------------------------------------------------------------------------- |
|
301 // |
|
302 TBool CMCSPluginSettings::Activated() const |
|
303 { |
|
304 return iContainer ? ETrue : EFalse; |
|
305 } |
|
306 |
|
307 // End of File. |