1 /* |
|
2 * Copyright (c) 2007 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: Cpp file for Connectivity Settings plugin. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 #include <featmgr.h> |
|
21 #include "gsconnsettingsplugin.h" |
|
22 #include "gsconnsettingsplugin.hrh" |
|
23 #include "gsconnsettingspluginmodel.h" |
|
24 #include "gsconnsettingsplugincontainer.h" |
|
25 #include "gsconnsettingsselectiondlg.h" |
|
26 |
|
27 #include <gsconnsettingspluginrsc.rsg> |
|
28 #include <gsconnsettingsplugin.mbg> |
|
29 |
|
30 // Includes from GS framework: |
|
31 #include <gscommon.hrh> |
|
32 #include <gsfwviewuids.h> |
|
33 #include <gsprivatepluginproviderids.h> |
|
34 #include <gstabhelper.h> |
|
35 #include <gsmainview.h> |
|
36 |
|
37 #include <hlplch.h> // For HlpLauncher |
|
38 #include <featmgr.h> |
|
39 #include <csxhelp/cp.hlp.hrh> |
|
40 |
|
41 #include <gulicon.h> |
|
42 #include <AknsUtils.h> |
|
43 #include <aknViewAppUi.h> |
|
44 #include <aknradiobuttonsettingpage.h> |
|
45 #include <AknQueryDialog.h> |
|
46 #include <ConeResLoader.h> |
|
47 #include <barsread.h> // For TResourceReader |
|
48 #include <StringLoader.h> |
|
49 |
|
50 // Constants |
|
51 |
|
52 |
|
53 // ========================= MEMBER FUNCTIONS ================================ |
|
54 |
|
55 |
|
56 // --------------------------------------------------------------------------- |
|
57 // CGSConnSettingsPlugin::CConnectivitySettingsPlugin() |
|
58 // Constructor |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 CGSConnSettingsPlugin::CGSConnSettingsPlugin() |
|
62 : iResourceLoader( *iCoeEnv ) |
|
63 { |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 // CGSConnSettingsPlugin::~CConnectivitySettingsPlugin() |
|
68 // Destructor |
|
69 // --------------------------------------------------------------------------- |
|
70 // |
|
71 CGSConnSettingsPlugin::~CGSConnSettingsPlugin() |
|
72 { |
|
73 iResourceLoader.Close(); |
|
74 |
|
75 |
|
76 // Delete plugin loader |
|
77 if ( iPluginLoader ) |
|
78 { |
|
79 delete iPluginLoader; |
|
80 } |
|
81 |
|
82 // Delete possible plugins |
|
83 if ( iPluginArray ) |
|
84 { |
|
85 // Since the plugins are actually avkon views, avkon is responsible |
|
86 // for owning the plugins. This means we do not reset and destroy |
|
87 // the contents of the array in which the plugins reside. We have to |
|
88 // leave it up to avkon to tidy up. |
|
89 delete iPluginArray; |
|
90 } |
|
91 } |
|
92 |
|
93 // --------------------------------------------------------------------------- |
|
94 // CGSConnSettingsPlugin::NewL() |
|
95 // First phase constructor |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 CGSConnSettingsPlugin* CGSConnSettingsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
99 { |
|
100 CGSConnSettingsPlugin* self = new(ELeave) CGSConnSettingsPlugin(); |
|
101 CleanupStack::PushL(self); |
|
102 self->ConstructL(); |
|
103 CleanupStack::Pop(self); |
|
104 return self; |
|
105 } |
|
106 |
|
107 // --------------------------------------------------------------------------- |
|
108 // CGSConnSettingsPlugin::ConstructL() |
|
109 // Second phase constructor |
|
110 // --------------------------------------------------------------------------- |
|
111 // |
|
112 void CGSConnSettingsPlugin::ConstructL() |
|
113 { |
|
114 // Initialize FeatureManager |
|
115 FeatureManager::InitializeLibL(); |
|
116 iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan ); |
|
117 // Unload FeatureManager |
|
118 FeatureManager::UnInitializeLib(); |
|
119 |
|
120 OpenLocalizedResourceFileL( KGSConnSettingsPluginResourceFileName, |
|
121 iResourceLoader ); |
|
122 BaseConstructL( R_GS_CONN_SETTINGS_PLUGIN_VIEW ); |
|
123 } |
|
124 |
|
125 // --------------------------------------------------------------------------- |
|
126 // CGSConnSettingsPlugin::Id() |
|
127 // --------------------------------------------------------------------------- |
|
128 // |
|
129 TUid CGSConnSettingsPlugin::Id() const |
|
130 { |
|
131 return KGSConnSettingsPluginUid; |
|
132 } |
|
133 |
|
134 |
|
135 |
|
136 // ---------------------------------------------------------------------------- |
|
137 // CGSConnSettingsPlugin::NewContainerL() |
|
138 // Creates new iContainer. |
|
139 // |
|
140 // ---------------------------------------------------------------------------- |
|
141 // |
|
142 void CGSConnSettingsPlugin::NewContainerL() |
|
143 { |
|
144 iContainer = new( ELeave ) CGSConnSettingsPluginContainer( *this ); |
|
145 |
|
146 //Check if ECOM plugins are already loaded |
|
147 if ( iPluginArray == NULL ) |
|
148 { |
|
149 //Load plugins here after container is constructed. This saves memory when Connectivity Settings view |
|
150 //is not visible(object from CGSConnSettingsPlugin is constructed already in Connectivity view by GS and |
|
151 //container class only when the plugin is actually accessed) |
|
152 |
|
153 iPluginArray = new ( ELeave ) CArrayPtrFlat<CGSPluginInterface>( KGConnSettingsPluginCount ); |
|
154 iPluginLoader = CGSPluginLoader::NewL( iAppUi ); |
|
155 iPluginLoader->SetObserver( this ); |
|
156 iPluginLoader->LoadAsyncL( KGSPluginInterfaceUid, Id(), iPluginArray ); |
|
157 } |
|
158 |
|
159 Container()->SetPluginArray( iPluginArray ); |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // CGSConnSettingsPlugin::DoActivateL() |
|
164 // |
|
165 // |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void CGSConnSettingsPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
169 TUid aCustomMessageId, |
|
170 const TDesC8& aCustomMessage ) |
|
171 { |
|
172 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
173 |
|
174 // Add support for external view activation |
|
175 if ( iPrevViewId.iAppUid != KUidGS || iPrevViewId.iViewUid == TUid::Uid(0x0DEADBED) ) |
|
176 { |
|
177 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
178 if(cbaGroup) |
|
179 { |
|
180 HBufC* rightSKText = StringLoader::LoadLC (R_GS_CONN_SETTINGS_RSK_LABEL_EXIT); |
|
181 TPtr rskPtr = rightSKText->Des(); |
|
182 cbaGroup->SetCommandL(2,EAknSoftkeyExit,*rightSKText); |
|
183 CleanupStack::PopAndDestroy(rightSKText); |
|
184 } |
|
185 } |
|
186 iModel = Container()->Model(); |
|
187 } |
|
188 |
|
189 // --------------------------------------------------------------------------- |
|
190 // CGSConnSettingsPlugin::DoDeactivate() |
|
191 // |
|
192 // |
|
193 // --------------------------------------------------------------------------- |
|
194 // |
|
195 void CGSConnSettingsPlugin::DoDeactivate() |
|
196 { |
|
197 CGSBaseView::DoDeactivate(); |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // CGSConnSettingsPlugin:: HandleForegroundEventL |
|
202 // |
|
203 // |
|
204 // --------------------------------------------------------------------------- |
|
205 // |
|
206 void CGSConnSettingsPlugin::HandleForegroundEventL( TBool aForeground ) |
|
207 { |
|
208 //Load saved settings from Connection Settings API |
|
209 //If function leaves it is trapped and ignored as there is nothing that we can do about it |
|
210 if ( iModel && aForeground ) |
|
211 { |
|
212 TRAP_IGNORE( iModel->LoadSettingsL() ); |
|
213 UpdateListBoxL( EGSSettIdDataUsageHomeNw ); |
|
214 } |
|
215 } |
|
216 |
|
217 // ---------------------------------------------------------------------------- |
|
218 // CGSConnSettingsPlugin::HandleCommandL |
|
219 // |
|
220 // Handles menu commands directed to this class. |
|
221 // ---------------------------------------------------------------------------- |
|
222 void CGSConnSettingsPlugin::HandleCommandL( TInt aCommand ) |
|
223 { |
|
224 switch ( aCommand ) |
|
225 { |
|
226 case EGSConnSettMenuOpen: |
|
227 case EGSConnSettMenuChange: |
|
228 case EGSConnSettMskGeneral: |
|
229 HandleListBoxSelectionL(); |
|
230 break; |
|
231 |
|
232 case EAknSoftkeyBack: |
|
233 iAppUi->ActivateLocalViewL( KGSConPluginUid ); |
|
234 break; |
|
235 |
|
236 case EAknCmdHelp: |
|
237 { |
|
238 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
239 { |
|
240 HlpLauncher::LaunchHelpApplicationL( |
|
241 iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); |
|
242 } |
|
243 break; |
|
244 } |
|
245 default: |
|
246 iAppUi->HandleCommandL( aCommand ); |
|
247 break; |
|
248 } |
|
249 } |
|
250 |
|
251 |
|
252 // ----------------------------------------------------------------------------- |
|
253 // CGSSensorPlugin::DynInitMenuPaneL |
|
254 // ----------------------------------------------------------------------------- |
|
255 // |
|
256 void CGSConnSettingsPlugin::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
257 { |
|
258 // Check resource |
|
259 if ( R_GS_CONN_SETTINGS_MENU_ITEM_OPEN == aResourceId ) |
|
260 { |
|
261 // First, resolve current item in listbox |
|
262 const TInt currentItem = Container()->CurrentFeatureId(); |
|
263 |
|
264 switch (currentItem) |
|
265 { |
|
266 case EGSSettIdUsageOfWlan: |
|
267 case EGSSettIdDataUsageAbroad: |
|
268 case EGSSettIdDataUsageHomeNw: |
|
269 // Hide menu item 'Open' |
|
270 aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, ETrue ); |
|
271 aMenuPane->SetItemDimmed( EGSConnSettMenuChange, EFalse ); |
|
272 break; |
|
273 |
|
274 default: |
|
275 { |
|
276 // Hide menu item 'Change' if current item is ECOM plugin |
|
277 aMenuPane->SetItemDimmed( EGSConnSettMenuOpen, EFalse ); |
|
278 aMenuPane->SetItemDimmed( EGSConnSettMenuChange, ETrue ); |
|
279 break; |
|
280 } |
|
281 } |
|
282 } |
|
283 // Forward to base class |
|
284 CGSBaseView::DynInitMenuPaneL( aResourceId, aMenuPane ); |
|
285 } |
|
286 |
|
287 |
|
288 // ---------------------------------------------------------------------------- |
|
289 // CGSConnSettingsPlugin::HandleListBoxSelectionL() |
|
290 // |
|
291 // Handles events raised through a rocker key |
|
292 // ---------------------------------------------------------------------------- |
|
293 void CGSConnSettingsPlugin::HandleListBoxSelectionL() |
|
294 { |
|
295 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
296 |
|
297 switch ( currentFeatureId ) |
|
298 { |
|
299 case EGSSettIdUsageOfWlan: |
|
300 ShowUsageOfWlanSettingPageL(); |
|
301 break; |
|
302 |
|
303 case EGSSettIdDataUsageAbroad: |
|
304 ShowDataUsageAbroadSettingPageL(); |
|
305 break; |
|
306 |
|
307 case EGSSettIdDataUsageHomeNw: |
|
308 ShowDataUsageInHomeNwSettingPageL(); |
|
309 break; |
|
310 |
|
311 default: |
|
312 { |
|
313 //Feature ID didn't match, try plugins |
|
314 CGSPluginInterface* selectedPlugin( Container()->SelectedPluginL() ); |
|
315 |
|
316 switch( selectedPlugin->ItemType() ) |
|
317 { |
|
318 // In these cases the plugin is a view: |
|
319 case EGSItemTypeSingleLarge: |
|
320 case EGSItemTypeSetting: |
|
321 case EGSItemTypeSettingIcon: |
|
322 { |
|
323 CleanupStack::PushL( selectedPlugin ); |
|
324 iAppUi->ActivateLocalViewL( selectedPlugin->Id() ); |
|
325 CleanupStack::Pop( selectedPlugin ); |
|
326 break; |
|
327 } |
|
328 |
|
329 // In these cases the plugin is a dialog: |
|
330 case EGSItemTypeSettingDialog: |
|
331 case EGSItemTypeSingleLargeDialog: |
|
332 selectedPlugin->HandleSelection( EGSSelectionByMenu ); |
|
333 break; |
|
334 default: |
|
335 break; |
|
336 } |
|
337 break; |
|
338 } |
|
339 } |
|
340 } |
|
341 |
|
342 // ---------------------------------------------------------------------------- |
|
343 // CGSConnSettingsPlugin::UpdateListBoxL |
|
344 // |
|
345 // |
|
346 // ---------------------------------------------------------------------------- |
|
347 // |
|
348 void CGSConnSettingsPlugin::UpdateListBoxL( TInt aItemId ) |
|
349 { |
|
350 if( Container() ) |
|
351 { |
|
352 Container()->UpdateListBoxL( aItemId ); |
|
353 } |
|
354 } |
|
355 |
|
356 // ---------------------------------------------------------------------------- |
|
357 // CGSConnSettingsPlugin::Container |
|
358 // |
|
359 // Return handle to container class. |
|
360 // ---------------------------------------------------------------------------- |
|
361 // |
|
362 CGSConnSettingsPluginContainer* CGSConnSettingsPlugin::Container() |
|
363 { |
|
364 return static_cast<CGSConnSettingsPluginContainer*>( iContainer ); |
|
365 } |
|
366 |
|
367 // --------------------------------------------------------------------------- |
|
368 // CGSConnSettingsPlugin::UpperLevelViewUid() |
|
369 // |
|
370 // |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 TUid CGSConnSettingsPlugin::UpperLevelViewUid() |
|
374 { |
|
375 return KGSConPluginUid; |
|
376 } |
|
377 |
|
378 // ----------------------------------------------------------------------------- |
|
379 // CGSConnSettingsPlugin::GetHelpContext() |
|
380 // |
|
381 // |
|
382 // ----------------------------------------------------------------------------- |
|
383 // |
|
384 void CGSConnSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext ) |
|
385 { |
|
386 aContext.iMajor = KUidGS; |
|
387 aContext.iContext = KCP_HLP_ADMINISTRATIVE_SETTINGS; |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CGSConnSettingsPlugin::GetCaptionL() |
|
392 // |
|
393 // |
|
394 // --------------------------------------------------------------------------- |
|
395 // |
|
396 void CGSConnSettingsPlugin::GetCaptionL( TDes& aCaption ) const |
|
397 { |
|
398 // The resource file is already opened by iResourceLoader. |
|
399 HBufC* result = StringLoader::LoadL( R_GS_CONN_SETTINGS_VIEW_CAPTION ); |
|
400 aCaption.Copy( *result ); |
|
401 delete result; |
|
402 } |
|
403 |
|
404 // --------------------------------------------------------------------------- |
|
405 // CGSConnSettingsPlugin::CreateIconL |
|
406 // |
|
407 // Return the icon, if has one. |
|
408 // --------------------------------------------------------------------------- |
|
409 // |
|
410 CGulIcon* CGSConnSettingsPlugin::CreateIconL( const TUid aIconType ) |
|
411 { |
|
412 |
|
413 //EMbm<Mbm_file_name><Bitmap_name> |
|
414 CGulIcon* icon; |
|
415 TParse* fp = new( ELeave ) TParse(); |
|
416 CleanupStack::PushL( fp ); |
|
417 fp->Set( KGSConnSettingsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); |
|
418 |
|
419 if( aIconType == KGSIconTypeLbxItem ) |
|
420 { |
|
421 icon = AknsUtils::CreateGulIconL( |
|
422 AknsUtils::SkinInstance(), |
|
423 KAknsIIDQgnPropCpConnAdmin, |
|
424 fp->FullName(), |
|
425 // Let's use Connectivity plugin icon until we get graphics |
|
426 // for Connectivity Settings plugin icon |
|
427 // EMbmGsconnsettingspluginQgn_prop_cp_conn_settings, |
|
428 // EMbmGsconnsettingspluginQgn_prop_cp_conn_settings_mask ); |
|
429 EMbmGsconnsettingspluginQgn_prop_cp_conn, //from generated \epoc32\include\gsconnsettingsplugin.mbg |
|
430 EMbmGsconnsettingspluginQgn_prop_cp_conn_mask ); //from generated \epoc32\include\gsconnsettingsplugin.mbg |
|
431 } |
|
432 else |
|
433 { |
|
434 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
435 } |
|
436 CleanupStack::PopAndDestroy( fp ); |
|
437 return icon; |
|
438 } |
|
439 |
|
440 // --------------------------------------------------------------------------- |
|
441 // CGSConnSettingsPlugin::PluginProviderCategory() |
|
442 // |
|
443 // |
|
444 // --------------------------------------------------------------------------- |
|
445 // |
|
446 TInt CGSConnSettingsPlugin::PluginProviderCategory() const |
|
447 { |
|
448 return KGSPluginProviderInternal; |
|
449 } |
|
450 |
|
451 // --------------------------------------------------------------------------- |
|
452 // CGSConnSettingsPlugin::ShowUsageOfNewWlanSettingPageL() |
|
453 // |
|
454 // |
|
455 // --------------------------------------------------------------------------- |
|
456 // |
|
457 void CGSConnSettingsPlugin::ShowUsageOfWlanSettingPageL() |
|
458 { |
|
459 TBool currentItem = (TBool)iModel->UsageOfWlan(); |
|
460 iModel->SetUsageOfWlan( !currentItem ); |
|
461 UpdateListBoxL( EGSSettIdUsageOfWlan ); |
|
462 //Save current settings when the setting is changed |
|
463 //If function leaves it is trapped and ignored as there is nothing that we can do about it |
|
464 TRAP_IGNORE(iModel->SaveSettingsL()); |
|
465 } |
|
466 |
|
467 // --------------------------------------------------------------------------- |
|
468 // CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL() |
|
469 // |
|
470 // |
|
471 // --------------------------------------------------------------------------- |
|
472 // |
|
473 void CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL() |
|
474 { |
|
475 CDesCArrayFlat* items; |
|
476 |
|
477 if ( iIsWlanSupported ) |
|
478 { |
|
479 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
480 R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX ); |
|
481 } |
|
482 else |
|
483 { |
|
484 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
485 R_DATA_USAGE_ABROAD_SETTING_PAGE_LBX_NOWLAN ); |
|
486 } |
|
487 |
|
488 CleanupStack::PushL( items ); |
|
489 |
|
490 TInt currentItem = iModel->DataUsageAbroad(); |
|
491 |
|
492 // We may have to do in this way because EDataUsageAbroadDisabled is equal to 3 |
|
493 // and the actual index number should be 2 in this case |
|
494 if( !iIsWlanSupported && currentItem == EDataUsageAbroadDisabled ) |
|
495 { |
|
496 currentItem --; |
|
497 } |
|
498 |
|
499 TInt oldItem = currentItem; |
|
500 |
|
501 CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage( |
|
502 R_DATA_USAGE_ABROAD_SETTING_PAGE, currentItem, items ); |
|
503 |
|
504 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
505 { |
|
506 |
|
507 if( currentItem != oldItem ) |
|
508 { |
|
509 iModel->SetDataUsageAbroad( currentItem ); |
|
510 UpdateListBoxL( EGSSettIdDataUsageAbroad ); |
|
511 //Save current settings when the setting is changed |
|
512 //If function leaves it is trapped and ignored as there is nothing that we can do about it |
|
513 TRAP_IGNORE(iModel->SaveSettingsL()); |
|
514 } |
|
515 } |
|
516 CleanupStack::PopAndDestroy( items ); |
|
517 } |
|
518 |
|
519 // --------------------------------------------------------------------------- |
|
520 // CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL() |
|
521 // |
|
522 // |
|
523 // --------------------------------------------------------------------------- |
|
524 // |
|
525 void CGSConnSettingsPlugin::ShowDataUsageInHomeNwSettingPageL() |
|
526 { |
|
527 CDesCArrayFlat* items; |
|
528 |
|
529 if ( iIsWlanSupported ) |
|
530 { |
|
531 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
532 R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX ); |
|
533 } |
|
534 else |
|
535 { |
|
536 items = iCoeEnv->ReadDesC16ArrayResourceL( |
|
537 R_DATA_USAGE_HOME_NW_SETTING_PAGE_LBX_NOWLAN ); |
|
538 } |
|
539 |
|
540 CleanupStack::PushL( items ); |
|
541 |
|
542 TInt currentItem = iModel->DataUsageInHomeNw(); |
|
543 |
|
544 // We may have to do in this way because EDataUsageAbroadDisabled is equal to 3 |
|
545 // and the actual index number should be 2 in this case |
|
546 if( !iIsWlanSupported && currentItem == EDataUsageAbroadDisabled ) |
|
547 { |
|
548 currentItem --; |
|
549 } |
|
550 |
|
551 TInt oldItem = currentItem; |
|
552 |
|
553 CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage( |
|
554 R_DATA_USAGE_HOME_NW_SETTING_PAGE, currentItem, items ); |
|
555 |
|
556 if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
557 { |
|
558 |
|
559 if( currentItem != oldItem ) |
|
560 { |
|
561 iModel->SetDataUsageInHomeNw( currentItem ); |
|
562 UpdateListBoxL( EGSSettIdDataUsageHomeNw ); |
|
563 //Save current settings when the setting is changed |
|
564 //If function leaves it is trapped and ignored as there is nothing that we can do about it |
|
565 TRAP_IGNORE(iModel->SaveSettingsL()); |
|
566 } |
|
567 } |
|
568 CleanupStack::PopAndDestroy( items ); |
|
569 } |
|
570 |
|
571 // --------------------------------------------------------------------------- |
|
572 // CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL |
|
573 // --------------------------------------------------------------------------- |
|
574 // |
|
575 void CGSConnSettingsPlugin::CheckMiddleSoftkeyLabelL() |
|
576 { |
|
577 //Resolve current item |
|
578 const TInt currentItem = Container()->CurrentFeatureId(); |
|
579 |
|
580 //remove current middle soft key label |
|
581 RemoveCommandFromMSK(); |
|
582 |
|
583 switch (currentItem) |
|
584 { |
|
585 case EGSSettIdUsageOfWlan: |
|
586 case EGSSettIdDataUsageAbroad: |
|
587 case EGSSettIdDataUsageHomeNw: |
|
588 //Set middle soft key label to "Change" |
|
589 SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_CHANGE, EGSConnSettMskGeneral ); |
|
590 break; |
|
591 |
|
592 default: |
|
593 { |
|
594 //If current item is ECOM plugin set middle soft key label to "Open" |
|
595 SetMiddleSoftKeyLabelL( R_GS_CONN_SETTINGS_MSK_LABEL_OPEN, EGSConnSettMskGeneral ); |
|
596 break; |
|
597 } |
|
598 } |
|
599 } |
|
600 |
|
601 // ----------------------------------------------------------------------------- |
|
602 // CGSConnSettingsPlugin::HandleListBoxEventL |
|
603 // |
|
604 // ----------------------------------------------------------------------------- |
|
605 // |
|
606 void CGSConnSettingsPlugin::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
|
607 TListBoxEvent aEventType ) |
|
608 { |
|
609 switch ( aEventType ) |
|
610 { |
|
611 case EEventEnterKeyPressed: |
|
612 case EEventItemSingleClicked: |
|
613 HandleListBoxSelectionL(); |
|
614 break; |
|
615 default: |
|
616 break; |
|
617 } |
|
618 } |
|
619 |
|
620 // ----------------------------------------------------------------------------- |
|
621 // CGSConnSettingsPlugin::RemoveCommandFromMSK |
|
622 // |
|
623 // ----------------------------------------------------------------------------- |
|
624 // |
|
625 void CGSConnSettingsPlugin::RemoveCommandFromMSK() |
|
626 { |
|
627 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
628 if ( cbaGroup ) |
|
629 { |
|
630 // Remove command from stack |
|
631 cbaGroup->RemoveCommandFromStack( KGSConnSettingsMSKControlID, EGSConnSettMskGeneral ); |
|
632 } |
|
633 } |
|
634 |
|
635 // --------------------------------------------------------------------------- |
|
636 // CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL |
|
637 // Sets middle softkey label. |
|
638 // --------------------------------------------------------------------------- |
|
639 // |
|
640 void CGSConnSettingsPlugin::SetMiddleSoftKeyLabelL( |
|
641 const TInt aResourceId, const TInt aCommandId ) |
|
642 { |
|
643 CEikButtonGroupContainer* cbaGroup = Cba(); |
|
644 if ( cbaGroup ) |
|
645 { |
|
646 HBufC* middleSKText = StringLoader::LoadLC( aResourceId ); |
|
647 TPtr mskPtr = middleSKText->Des(); |
|
648 cbaGroup->AddCommandToStackL( |
|
649 KGSConnSettingsMSKControlID, |
|
650 aCommandId, |
|
651 mskPtr ); |
|
652 CleanupStack::Pop( middleSKText ); |
|
653 delete middleSKText; |
|
654 } |
|
655 } |
|
656 |
|
657 // --------------------------------------------------------------------------- |
|
658 // CGSConnSettingsPlugin::HandlePluginLoaded |
|
659 // Called by GSPluginLoader when plugins are loaded or error occured during that |
|
660 // --------------------------------------------------------------------------- |
|
661 // |
|
662 void CGSConnSettingsPlugin::HandlePluginLoaded( KGSPluginLoaderStatus aStatus ) |
|
663 { |
|
664 if ( iContainer && MGSPluginLoadObserver::EGSFinished == aStatus ) |
|
665 { |
|
666 #ifdef __DEBUG |
|
667 TRAPD( ignore, Container()->UpdateListBoxL( EGSExtPluginsListItemId ); ); |
|
668 TRACE_1( "[GSSensorPlugin] CGSSensorPlugin::HandlePluginLoaded() - Error: %i", ignore ); |
|
669 #else |
|
670 TRAP_IGNORE( Container()->UpdateListBoxL( EGSExtPluginsListItemId ); ); |
|
671 #endif // __DEBUG |
|
672 } |
|
673 } |
|
674 |
|
675 // End of File |
|