cmmanager/gsconnsettingsplugin/src/gsconnsettingsplugin.cpp
changeset 18 fcbbe021d614
parent 4 77415202bfc8
equal deleted inserted replaced
4:77415202bfc8 18:fcbbe021d614
    26 
    26 
    27 #include <gsconnsettingspluginrsc.rsg>
    27 #include <gsconnsettingspluginrsc.rsg>
    28 #include <gsconnsettingsplugin.mbg>
    28 #include <gsconnsettingsplugin.mbg>
    29 
    29 
    30 // Includes from GS framework:
    30 // Includes from GS framework:
    31 #include <GSCommon.hrh>
    31 #include <gscommon.hrh>
    32 #include <GSFWViewUIDs.h>
    32 #include <gsfwviewuids.h>
    33 #include <GSPrivatePluginProviderIds.h>
    33 #include <gsprivatepluginproviderids.h>
    34 #include <GSTabHelper.h>
    34 #include <gstabhelper.h>
    35 #include <GSMainView.h>
    35 #include <gsmainview.h>
    36 
    36 
    37 #include <hlplch.h> // For HlpLauncher
    37 #include <hlplch.h> // For HlpLauncher
    38 #include <featmgr.h>
    38 #include <featmgr.h>
    39 #include <csxhelp/cp.hlp.hrh>
    39 #include <csxhelp/cp.hlp.hrh>
    40 
    40 
   113     {
   113     {
   114     // Initialize FeatureManager
   114     // Initialize FeatureManager
   115     FeatureManager::InitializeLibL();
   115     FeatureManager::InitializeLibL();
   116     iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
   116     iIsWlanSupported = FeatureManager::FeatureSupported( KFeatureIdProtocolWlan );
   117     // Unload FeatureManager
   117     // Unload FeatureManager
   118     FeatureManager::UnInitializeLib();  
   118     FeatureManager::UnInitializeLib();
   119     
   119     
   120     OpenLocalizedResourceFileL( KGSConnSettingsPluginResourceFileName,
   120     OpenLocalizedResourceFileL( KGSConnSettingsPluginResourceFileName,
   121                                 iResourceLoader ); 
   121                                 iResourceLoader ); 
   122     BaseConstructL( R_GS_CONN_SETTINGS_PLUGIN_VIEW );
   122     BaseConstructL( R_GS_CONN_SETTINGS_PLUGIN_VIEW );
   123     }
   123     }
   382 // -----------------------------------------------------------------------------
   382 // -----------------------------------------------------------------------------
   383 //
   383 //
   384 void CGSConnSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext )
   384 void CGSConnSettingsPlugin::GetHelpContext( TCoeHelpContext& aContext )
   385     {
   385     {
   386     aContext.iMajor = KUidGS;
   386     aContext.iMajor = KUidGS;
   387     aContext.iContext = KHLP_OCC_CONN_SETTINGS;
   387     aContext.iContext = KCP_HLP_ADMINISTRATIVE_SETTINGS;
   388     }
   388     }
   389 
   389 
   390 // ---------------------------------------------------------------------------
   390 // ---------------------------------------------------------------------------
   391 // CGSConnSettingsPlugin::GetCaptionL()
   391 // CGSConnSettingsPlugin::GetCaptionL()
   392 //
   392 //
   454 // 
   454 // 
   455 // ---------------------------------------------------------------------------
   455 // ---------------------------------------------------------------------------
   456 //
   456 //
   457 void CGSConnSettingsPlugin::ShowUsageOfWlanSettingPageL()
   457 void CGSConnSettingsPlugin::ShowUsageOfWlanSettingPageL()
   458     {
   458     {
   459 
   459     TBool currentItem = (TBool)iModel->UsageOfWlan();
   460     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
   460     iModel->SetUsageOfWlan( !currentItem );
   461             R_USAGE_OF_WLAN_SETTING_PAGE_LBX );
   461     UpdateListBoxL( EGSSettIdUsageOfWlan );
   462     CleanupStack::PushL( items );
   462     //Save current settings when the setting is changed
   463 
   463     //If function leaves it is trapped and ignored as there is nothing that we can do about it
   464     TInt currentItem = iModel->UsageOfWlan();
   464     TRAP_IGNORE(iModel->SaveSettingsL());
   465     TInt oldItem = currentItem;
       
   466     
       
   467     CGSConnSettingsSelectionDlg* dlg = CGSConnSettingsSelectionDlg::NewL(
       
   468                                                 R_USAGE_OF_WLAN_SETTING_PAGE,
       
   469                                                 currentItem,
       
   470                                                 items,
       
   471                                                 R_USAGE_OF_WLAN_INFO_POPUP_TEXTS );
       
   472 
       
   473     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   474         {
       
   475 
       
   476         if( currentItem != oldItem )
       
   477             {
       
   478             iModel->SetUsageOfWlan( currentItem );
       
   479             UpdateListBoxL( EGSSettIdUsageOfWlan );
       
   480             //Save current settings when the setting is changed
       
   481             //If function leaves it is trapped and ignored as there is nothing that we can do about it
       
   482             TRAP_IGNORE(iModel->SaveSettingsL());
       
   483             }
       
   484         }
       
   485 
       
   486     CleanupStack::PopAndDestroy( items );
       
   487 
       
   488     }
   465     }
   489 
   466 
   490 // ---------------------------------------------------------------------------
   467 // ---------------------------------------------------------------------------
   491 // CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
   468 // CGSConnSettingsPlugin::ShowDataUsageAbroadSettingPageL()
   492 //
   469 //
   509         }
   486         }
   510     
   487     
   511     CleanupStack::PushL( items );
   488     CleanupStack::PushL( items );
   512 
   489 
   513     TInt currentItem = iModel->DataUsageAbroad();
   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     
   514     TInt oldItem = currentItem;
   499     TInt oldItem = currentItem;
   515 
   500 
   516     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
   501     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
   517             R_DATA_USAGE_ABROAD_SETTING_PAGE, currentItem, items );
   502             R_DATA_USAGE_ABROAD_SETTING_PAGE, currentItem, items );
   518 
   503 
   553         }
   538         }
   554     
   539     
   555     CleanupStack::PushL( items );
   540     CleanupStack::PushL( items );
   556 
   541 
   557     TInt currentItem = iModel->DataUsageInHomeNw();
   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     
   558     TInt oldItem = currentItem;
   551     TInt oldItem = currentItem;
   559 
   552 
   560     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
   553     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
   561             R_DATA_USAGE_HOME_NW_SETTING_PAGE, currentItem, items );
   554             R_DATA_USAGE_HOME_NW_SETTING_PAGE, currentItem, items );
   562 
   555