gssettingsuis/Gs/GSDisplayPlugin/Src/GSDisplayPlugin.cpp
branchRCL_3
changeset 54 7e0eff37aedb
equal deleted inserted replaced
53:8ee96d21d9bf 54:7e0eff37aedb
       
     1 /*
       
     2 * Copyright (c) 2005-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:  View for Display sub-folder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "GSDisplayPlugin.h"
       
    21 
       
    22 #ifdef FF_POWER_SAVE
       
    23     #include "GSDisplayPluginAO.h"
       
    24 #endif // FF_POWER_SAVE
       
    25 
       
    26 #include "GSDisplayPluginModel.h"
       
    27 #include "GSDisplayPluginContainer.h"
       
    28 #include "GsDisplayPlugin.hrh"
       
    29 #include "GsLogger.h"
       
    30 
       
    31 #include <coeaui.h>
       
    32 #include <hlplch.h>             // For HlpLauncher
       
    33 #include <gulicon.h>
       
    34 #include <bautils.h>
       
    35 #include <featmgr.h>
       
    36 #include <StringLoader.h>
       
    37 #include <aknnotedialog.h>
       
    38 #include <AknWaitDialog.h>
       
    39 #include <aknslider.h>
       
    40 #include <aknradiobuttonsettingpage.h>
       
    41 #include <aknslidersettingpage.h>
       
    42 #include <aknnotewrappers.h>
       
    43 #include <aknViewAppUi.h>
       
    44 #include <AknsWallpaperUtils.h>
       
    45 #include <AknWaitDialog.h>
       
    46 #include <akntextsettingpage.h>
       
    47 #include <telephonydomainpskeys.h>
       
    48 #include <imageconversion.h>
       
    49 
       
    50 #include <MGFetch.h>            // Image selection
       
    51 #include <DRMCommon.h>
       
    52 #include <gsdisplaypluginrsc.rsg>
       
    53 #include <gsprivatepluginproviderids.h>
       
    54 #include <gsmainview.h>
       
    55 #include <gsbasecontainer.h>
       
    56 #include <gscommon.hrh>
       
    57 #include <gsdisplayplugin.mbg> // Icons
       
    58 
       
    59 // EXTERNAL DATA STRUCTURES
       
    60 
       
    61 // EXTERNAL FUNCTION PROTOTYPES
       
    62 
       
    63 // CONSTANTS
       
    64 const TInt KGSImageWelcomeNote = 2;
       
    65 // MACROS
       
    66 
       
    67 // LOCAL CONSTANTS AND MACROS
       
    68 //_LIT( KGSWelcomeNoteTextValue, "" );
       
    69 //_LIT( KGSScreenSaverTextValue, "" );
       
    70 
       
    71 _LIT( KGSDisplayPluginResourceFileName, "z:GSDisplayPluginRsc.rsc" );
       
    72 
       
    73 // MODULE DATA STRUCTURES
       
    74 
       
    75 // LOCAL FUNCTION PROTOTYPES
       
    76 
       
    77 // FORWARD DECLARATIONS
       
    78 
       
    79 // ============================= LOCAL FUNCTIONS ==============================
       
    80 
       
    81 // ========================= MEMBER FUNCTIONS =================================
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CGSDisplayPlugin::CGSDisplayPlugin()
       
    85 //
       
    86 // Constructor
       
    87 // ----------------------------------------------------------------------------
       
    88 //
       
    89 CGSDisplayPlugin::CGSDisplayPlugin()
       
    90   : iUpdateSSText( EFalse ),
       
    91     iUpdateWNote( ETrue ),
       
    92     iReshowOprtSetPage( EFalse ),
       
    93     iResourceLoader( *iCoeEnv )
       
    94     {
       
    95     }
       
    96 
       
    97 
       
    98 // ----------------------------------------------------------------------------
       
    99 // CGSDisplayPlugin::NewL()
       
   100 //
       
   101 // Symbian OS default constructor
       
   102 // ----------------------------------------------------------------------------
       
   103 CGSDisplayPlugin* CGSDisplayPlugin::NewL( TAny* /*aInitParams*/ )
       
   104     {
       
   105     CGSDisplayPlugin* self = new( ELeave ) CGSDisplayPlugin();
       
   106 
       
   107     CleanupStack::PushL( self );
       
   108     self->ConstructL();
       
   109     CleanupStack::Pop( self );
       
   110 
       
   111     return self;
       
   112     }
       
   113 
       
   114 
       
   115 // ----------------------------------------------------------------------------
       
   116 // CGSDisplayPlugin::ConstructL()
       
   117 //
       
   118 // Symbian OS two-phased constructor
       
   119 // ----------------------------------------------------------------------------
       
   120 void CGSDisplayPlugin::ConstructL()
       
   121     {
       
   122     FeatureManager::InitializeLibL();
       
   123 
       
   124     // Find the resource file
       
   125     TParse parse;
       
   126     parse.Set( KGSDisplayPluginResourceFileName,
       
   127                &KDC_RESOURCE_FILES_DIR, NULL );
       
   128     TFileName fileName( parse.FullName() );
       
   129 
       
   130     // Get language of resource file
       
   131     BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
       
   132 
       
   133     // Open resource file
       
   134     iResourceLoader.OpenL( fileName );
       
   135 
       
   136     BaseConstructL( R_GS_DISPL_VIEW );
       
   137 
       
   138 #ifdef FF_POWER_SAVE    
       
   139     iPsmActive = CGSDisplayPluginAO::NewL();
       
   140     iPsmActive->SetView( this );
       
   141 #endif // FF_POWER_SAVE    
       
   142     }
       
   143 
       
   144 
       
   145 // ----------------------------------------------------------------------------
       
   146 // CGSDisplayPlugin::~CGSDisplayPlugin
       
   147 //
       
   148 // Destructor
       
   149 // ----------------------------------------------------------------------------
       
   150 CGSDisplayPlugin::~CGSDisplayPlugin()
       
   151     {
       
   152     CloseDialog();
       
   153     FeatureManager::UnInitializeLib();
       
   154     iResourceLoader.Close();
       
   155 
       
   156 #ifdef FF_POWER_SAVE
       
   157     delete iPsmActive;
       
   158 #endif // FF_POWER_SAVE
       
   159     
       
   160     if ( iImageHandler )
       
   161         {
       
   162         delete iImageHandler;
       
   163         }
       
   164 
       
   165     if ( iModel )
       
   166         {
       
   167         iModel = NULL;
       
   168         }
       
   169     }
       
   170 
       
   171 
       
   172 // ----------------------------------------------------------------------------
       
   173 // TUid CGSDisplayPlugin::Id()
       
   174 //
       
   175 // Returns plug-in's ID.
       
   176 // ----------------------------------------------------------------------------
       
   177 TUid CGSDisplayPlugin::Id() const
       
   178     {
       
   179     return KGSDisplayPluginUid;
       
   180     }
       
   181 
       
   182 // ----------------------------------------------------------------------------
       
   183 // CGSDisplayPlugin::HandleCommandL
       
   184 //
       
   185 // Handles commands directed to this class.
       
   186 // ----------------------------------------------------------------------------
       
   187 void CGSDisplayPlugin::HandleCommandL( TInt aCommand )
       
   188     {
       
   189     switch ( aCommand )
       
   190         {
       
   191         case EGSMSKCmdAppChange:
       
   192             if ( EGSSettIdOperatorLogo == Container()->CurrentFeatureId() )
       
   193                 {
       
   194                 ChangeOperatorLogoSettingL( EFalse );
       
   195                 break;
       
   196                 }
       
   197         case EGSCmdAppChange:
       
   198             HandleListBoxSelectionL();
       
   199             break;
       
   200         case EAknSoftkeyBack:
       
   201             #ifdef RD_CONTROL_PANEL
       
   202                 iAppUi->ActivateLocalViewL( KGSGenPluginUid );
       
   203             #else //RD_CONTROL_PANEL
       
   204                 iAppUi->ActivateLocalViewL( KGSPrslnPluginUid );
       
   205             #endif //RD_CONTROL_PANEL
       
   206             break;
       
   207         case EGSCmdShowPowerSaveLedSettingPage:
       
   208             ShowPowerSaveLedSettingPageL( ETrue );
       
   209             break;
       
   210         case EAknCmdHelp:
       
   211             {
       
   212             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   213                 {
       
   214                 HlpLauncher::LaunchHelpApplicationL(
       
   215                     iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
       
   216                 }
       
   217             break;
       
   218             }
       
   219         default:
       
   220             iAppUi->HandleCommandL( aCommand );
       
   221             break;
       
   222         }
       
   223     }
       
   224 
       
   225 
       
   226 // ----------------------------------------------------------------------------
       
   227 // CGSDisplayPlugin::UpdateListBoxL
       
   228 //
       
   229 //
       
   230 // ----------------------------------------------------------------------------
       
   231 //
       
   232 void CGSDisplayPlugin::UpdateListBoxL( TInt aItemId )
       
   233     {
       
   234     if( Container() )
       
   235         {
       
   236         Container()->UpdateListBoxL( aItemId );
       
   237         }
       
   238     }
       
   239 
       
   240 
       
   241 // ----------------------------------------------------------------------------
       
   242 // CGSDisplayPlugin::Container
       
   243 //
       
   244 // Return handle to container class.
       
   245 // ----------------------------------------------------------------------------
       
   246 //
       
   247 CGSDisplayPluginContainer* CGSDisplayPlugin::Container()
       
   248     {
       
   249     return static_cast<CGSDisplayPluginContainer*>( iContainer );
       
   250     }
       
   251 
       
   252 
       
   253 // ----------------------------------------------------------------------------
       
   254 // CGSDisplayPlugin::NewContainerL()
       
   255 // Creates new iContainer.
       
   256 //
       
   257 // ----------------------------------------------------------------------------
       
   258 //
       
   259 void CGSDisplayPlugin::NewContainerL()
       
   260     {
       
   261     // container takes a CAknView pointer
       
   262     iContainer = new( ELeave ) CGSDisplayPluginContainer( /* *this*/ );
       
   263     }
       
   264 
       
   265 
       
   266 // ----------------------------------------------------------------------------
       
   267 // CGSDisplayPlugin::DoActivateL
       
   268 //
       
   269 // First method called by the Avkon framwork to invoke a view.
       
   270 // ----------------------------------------------------------------------------
       
   271 //
       
   272 void CGSDisplayPlugin::DoActivateL( const TVwsViewId& aPrevViewId,
       
   273                                     TUid aCustomMessageId,
       
   274                                     const TDesC8& aCustomMessage )
       
   275     {
       
   276     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );
       
   277     iModel = Container()->Model();
       
   278     }
       
   279 
       
   280 
       
   281 // ----------------------------------------------------------------------------
       
   282 // CGSDisplayPlugin::DoDeactivate
       
   283 //
       
   284 // Called by the Avkon view framework when closing.
       
   285 // ----------------------------------------------------------------------------
       
   286 //
       
   287 void CGSDisplayPlugin::DoDeactivate()
       
   288     {
       
   289     CGSBaseView::DoDeactivate();
       
   290     }
       
   291 
       
   292 // ----------------------------------------------------------------------------
       
   293 // CGSDisplayPlugin::HandleListBoxSelectionL()
       
   294 //
       
   295 // Handles events raised through a rocker key
       
   296 // ----------------------------------------------------------------------------
       
   297 void CGSDisplayPlugin::HandleListBoxSelectionL()
       
   298     {
       
   299     const TInt currentFeatureId = Container()->CurrentFeatureId();
       
   300     
       
   301     switch ( currentFeatureId )
       
   302         {
       
   303         case EGSSettIdContrast:
       
   304             if( iModel->ContrastL() != KErrNotSupported )
       
   305                 {
       
   306 #ifdef FF_POWER_SAVE                    
       
   307                 if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   308                     {
       
   309                     // If PSM is on, block setting:
       
   310                     DisplayBlockNoteL();
       
   311                     }
       
   312                 else
       
   313                     {
       
   314 #endif // FF_POWER_SAVE                    
       
   315                     ShowContrastSettingPageL();
       
   316 #ifdef FF_POWER_SAVE
       
   317                     }
       
   318 #endif // FF_POWER_SAVE
       
   319                 }
       
   320 
       
   321             
       
   322             break;
       
   323         case EGSSettIdBrightness:
       
   324             if( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl) )
       
   325                 {
       
   326 #ifdef FF_POWER_SAVE            
       
   327                 if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   328                     {
       
   329                     // If PSM is on, block setting:
       
   330                     DisplayBlockNoteL();
       
   331                     }
       
   332                 else
       
   333                     {
       
   334 #endif // FF_POWER_SAVE                    
       
   335                     ShowBrightnessSettingPageL();
       
   336 #ifdef FF_POWER_SAVE
       
   337                     }
       
   338 #endif // FF_POWER_SAVE              
       
   339                 }
       
   340             break;
       
   341         case EGSSettIdSSP:
       
   342 #ifdef FF_POWER_SAVE            
       
   343             if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   344                 {
       
   345                 // If PSM is on, block setting:
       
   346                 DisplayBlockNoteL();
       
   347                 }
       
   348             else
       
   349                 {
       
   350 #endif // FF_POWER_SAVE 
       
   351                 ShowScreenSaverPeriodSettingPageL();
       
   352 #ifdef FF_POWER_SAVE
       
   353                 }
       
   354 #endif // FF_POWER_SAVE      
       
   355             break;
       
   356         case EGSSettIdBacklight:
       
   357 #ifdef FF_POWER_SAVE            
       
   358             if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   359                 {
       
   360                 // If PSM is on, block setting:
       
   361                 DisplayBlockNoteL();
       
   362                 }
       
   363             else
       
   364                 {
       
   365 #endif // FF_POWER_SAVE                
       
   366                 ShowBacklightSettingPageL ( );
       
   367 #ifdef FF_POWER_SAVE
       
   368                 }
       
   369 #endif // FF_POWER_SAVE            
       
   370             break;
       
   371         case EGSSettIdAmbientLightSensor:
       
   372             {
       
   373 #ifdef FF_POWER_SAVE            
       
   374             if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   375                 {
       
   376                 // If PSM is on, block setting:
       
   377                 DisplayBlockNoteL();
       
   378                 }
       
   379             else
       
   380                 {
       
   381 #endif // FF_POWER_SAVE                    
       
   382                 ShowAmbientLightSensorSettingPageL();
       
   383 #ifdef FF_POWER_SAVE
       
   384                 }
       
   385 #endif // FF_POWER_SAVE      
       
   386             }
       
   387             break;
       
   388         case EGSSettIdWNI:
       
   389             ShowWelcomeNoteSettingPageL();
       
   390             break;
       
   391         case EGSSettIdDisplayTextSize:
       
   392             if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   393                 {
       
   394                 ShowDisplayTextSizeSettingPageL();
       
   395                 }
       
   396             break;
       
   397         case EGSSettIdPowerSaveLed:
       
   398             {
       
   399 #ifdef FF_POWER_SAVE            
       
   400             if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   401                 {
       
   402                 // If PSM is on, block setting:
       
   403                 DisplayBlockNoteL();
       
   404                 }
       
   405             else
       
   406                 {
       
   407 #endif // FF_POWER_SAVE                    
       
   408                 ShowPowerSaveLedSettingPageL( EFalse );
       
   409 #ifdef FF_POWER_SAVE
       
   410                 }
       
   411 #endif // FF_POWER_SAVE 
       
   412             }
       
   413             break;
       
   414         case EGSSettIdOperatorLogo:
       
   415         	do
       
   416         		{
       
   417         		iReshowOprtSetPage = EFalse;
       
   418         		ChangeOperatorLogoSettingL( ETrue );
       
   419         		}
       
   420         	while ( iReshowOprtSetPage );
       
   421             break;
       
   422         default:
       
   423             break;
       
   424         }
       
   425     }
       
   426 
       
   427 // ========================= From CGSPluginInterface ==================
       
   428 
       
   429 // ----------------------------------------------------------------------------
       
   430 // CGSDisplayPlugin::GetCaption
       
   431 //
       
   432 // Return application/view caption.
       
   433 // ----------------------------------------------------------------------------
       
   434 //
       
   435 void CGSDisplayPlugin::GetCaptionL( TDes& aCaption ) const
       
   436     {
       
   437     // the resource file is already opened.
       
   438     HBufC* result = StringLoader::LoadL( R_GS_DISPLAY_VIEW_CAPTION );
       
   439 
       
   440     aCaption.Copy( *result );
       
   441     delete result;
       
   442     }
       
   443 
       
   444 
       
   445 // ----------------------------------------------------------------------------
       
   446 // CGSDisplayPlugin::PluginProviderCategory
       
   447 //
       
   448 // A means to identify the location of this plug-in in the framework.
       
   449 // ----------------------------------------------------------------------------
       
   450 //
       
   451 TInt CGSDisplayPlugin::PluginProviderCategory() const
       
   452     {
       
   453     //To identify internal plug-ins.
       
   454     return KGSPluginProviderInternal;
       
   455     }
       
   456 
       
   457 
       
   458 // ---------------------------------------------------------------------------
       
   459 // CGSDisplayPlugin::ShowContrastSettingPageL()
       
   460 //
       
   461 // Display the contrast setting page.
       
   462 // ---------------------------------------------------------------------------
       
   463 //
       
   464 void CGSDisplayPlugin::ShowContrastSettingPageL()
       
   465     {
       
   466     TInt currentValue;
       
   467     TInt oldValue;
       
   468     oldValue = iModel->ContrastL();
       
   469 
       
   470     currentValue = oldValue;
       
   471 
       
   472     CAknSliderSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
       
   473                                  R_CONTRAST_SETTING_PAGE, currentValue );
       
   474 
       
   475     dlg->SetSettingId( KGSContrastSettingId );
       
   476     dlg->SetSettingPageObserver( this );
       
   477 
       
   478     if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   479         {
       
   480 #ifdef FF_POWER_SAVE
       
   481         if ( iPsmActive->Mode() != EPsmsrvModePowerSave )
       
   482             {
       
   483 #endif //FF_POWER_SAVE
       
   484             iModel->SetContrastL( oldValue );
       
   485 #ifdef FF_POWER_SAVE 
       
   486             }
       
   487 #endif //FF_POWER_SAVE
       
   488         }
       
   489     UpdateListBoxL( EGSSettIdContrast );
       
   490     }
       
   491 
       
   492 
       
   493 // ---------------------------------------------------------------------------
       
   494 // CGSDisplayPlugin::ShowBrightnessSettingPageL()
       
   495 //
       
   496 // Display the brightness setting page.
       
   497 // ---------------------------------------------------------------------------
       
   498 //
       
   499 void CGSDisplayPlugin::ShowBrightnessSettingPageL()
       
   500     {
       
   501     TInt currentValue;
       
   502     TInt oldValue = iModel->BrightnessL();
       
   503 
       
   504     currentValue = oldValue;
       
   505 
       
   506     CAknSliderSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
       
   507                                  R_BRIGHTNESS_SETTING_PAGE, currentValue );
       
   508 
       
   509     dlg->SetSettingId( KGSBrightnessSettingId );
       
   510     dlg->SetSettingPageObserver( this );
       
   511 
       
   512     if ( !dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged ) )
       
   513         {
       
   514 #ifdef FF_POWER_SAVE
       
   515         if ( iPsmActive->Mode() != EPsmsrvModePowerSave )
       
   516             {
       
   517 #endif //FF_POWER_SAVE
       
   518             iModel->SetBrightnessL( oldValue );
       
   519 #ifdef FF_POWER_SAVE 
       
   520             }
       
   521 #endif //FF_POWER_SAVE
       
   522         }
       
   523     UpdateListBoxL( EGSSettIdBrightness );
       
   524     }
       
   525 
       
   526 // ---------------------------------------------------------------------------
       
   527 // CGSDisplayPlugin::ShowAmbientLightSensorSettingPageL()
       
   528 //
       
   529 // Display the ambient light sensor setting page.
       
   530 // ---------------------------------------------------------------------------
       
   531 //
       
   532 void CGSDisplayPlugin::ShowAmbientLightSensorSettingPageL()
       
   533     {
       
   534     TInt currentValue;
       
   535     TInt oldValue = iModel->AmbientLightSensorL();
       
   536 
       
   537     currentValue = oldValue;
       
   538 
       
   539     CAknSliderSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
       
   540         R_AMBIENT_LIGHT_SENSOR_SETTING_PAGE, currentValue );
       
   541 
       
   542     dlg->SetSettingId( KGSAmbientLightSensorId );
       
   543     dlg->SetSettingPageObserver( this );
       
   544 
       
   545     if ( !dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   546         {
       
   547 #ifdef FF_POWER_SAVE
       
   548         if ( iPsmActive->Mode() != EPsmsrvModePowerSave )
       
   549             {
       
   550 #endif //FF_POWER_SAVE
       
   551             iModel->SetAmbientLightSensorL( oldValue );
       
   552 #ifdef FF_POWER_SAVE 
       
   553             }
       
   554 #endif //FF_POWER_SAVE
       
   555         }
       
   556     UpdateListBoxL( EGSSettIdAmbientLightSensor );
       
   557     }
       
   558 
       
   559 
       
   560 // ---------------------------------------------------------------------------
       
   561 // CGSDisplayPlugin::ShowScreenSaverPeriodSettingPageL()
       
   562 //
       
   563 // Display the screen saver period (time out) setting page.
       
   564 // ---------------------------------------------------------------------------
       
   565 //
       
   566 void CGSDisplayPlugin::ShowScreenSaverPeriodSettingPageL()
       
   567     {
       
   568     TInt sliderValue = iModel->ScreenSaverAndKeyguardPeriodL();
       
   569 
       
   570     CAknSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
       
   571                            R_SCREEN_SAVER_PERIOD_SETTING_PAGE, sliderValue );
       
   572 
       
   573     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   574         {
       
   575 #ifdef FF_POWER_SAVE         
       
   576         if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   577             {
       
   578             DisplayBlockNoteL();
       
   579             }
       
   580         else
       
   581             {
       
   582 #endif //FF_POWER_SAVE
       
   583             iModel->SetScreenSaverAndKeyguardPeriodL( sliderValue );
       
   584 #ifdef FF_POWER_SAVE 
       
   585             }
       
   586 #endif //FF_POWER_SAVE
       
   587         UpdateListBoxL( EGSSettIdSSP );
       
   588         }
       
   589     }
       
   590 
       
   591 // ---------------------------------------------------------------------------
       
   592 // CGSDisplayPlugin::ShowBacklightSettingPageL()
       
   593 //
       
   594 // Display the backlight time-out setting page.
       
   595 // ---------------------------------------------------------------------------
       
   596 //
       
   597 void CGSDisplayPlugin::ShowBacklightSettingPageL()
       
   598     {
       
   599     TInt sliderValue = iModel->BacklightPeriodL();
       
   600 
       
   601     CAknSettingPage* dlg = new( ELeave ) CAknSliderSettingPage(
       
   602                            R_BACKLIGHT_PERIOD_SETTING_PAGE, sliderValue );
       
   603 
       
   604     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   605         {
       
   606 #ifdef FF_POWER_SAVE 
       
   607         if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   608             {
       
   609             DisplayBlockNoteL();
       
   610             }
       
   611         else
       
   612             {
       
   613 #endif //FF_POWER_SAVE
       
   614             iModel->SetBacklightPeriodL( sliderValue );
       
   615 #ifdef FF_POWER_SAVE 
       
   616             }
       
   617 #endif //FF_POWER_SAVE
       
   618         UpdateListBoxL( EGSSettIdBacklight );
       
   619         }
       
   620     }
       
   621 
       
   622 
       
   623 // ---------------------------------------------------------------------------
       
   624 // CGSDisplayPlugin::HandleSettingPageEventL
       
   625 //
       
   626 // Handle any setting page related events
       
   627 // ---------------------------------------------------------------------------
       
   628 //
       
   629 void CGSDisplayPlugin::HandleSettingPageEventL( CAknSettingPage* aSettingPage,
       
   630                                      TAknSettingPageEvent aEventType )
       
   631     {
       
   632     TInt id = aSettingPage->SettingId();
       
   633 
       
   634     if ( aEventType == EEventSettingChanged )
       
   635         {
       
   636         switch ( id )
       
   637             {
       
   638             case KGSContrastSettingId:
       
   639                 if( iModel->ContrastL() != KErrNotSupported )
       
   640                     {
       
   641 #ifdef FF_POWER_SAVE 
       
   642                     if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   643                         {
       
   644                         DisplayBlockNoteL();
       
   645                         static_cast<CAknSliderSettingPage*>( aSettingPage )->
       
   646                             SliderControl()->SetValueL( iModel->ContrastL() );
       
   647                         }
       
   648                     else
       
   649                         {
       
   650 #endif //FF_POWER_SAVE
       
   651                         iModel->SetContrastL( static_cast<CAknSliderSettingPage*>
       
   652                             ( aSettingPage )->SliderControl()->Value() );
       
   653 #ifdef FF_POWER_SAVE 
       
   654                         }
       
   655 #endif //FF_POWER_SAVE
       
   656                     }
       
   657                 break;
       
   658             case KGSBrightnessSettingId:
       
   659                 if( FeatureManager::FeatureSupported(
       
   660                                     KFeatureIdBrightnessControl) )
       
   661                     {
       
   662 #ifdef FF_POWER_SAVE 
       
   663                     if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   664                         {
       
   665                         DisplayBlockNoteL();
       
   666                         static_cast<CAknSliderSettingPage*>( aSettingPage )->
       
   667                             SliderControl()->SetValueL( iModel->BrightnessL() );
       
   668                         }
       
   669                     else
       
   670                         {
       
   671 #endif //FF_POWER_SAVE
       
   672                         iModel->SetBrightnessL( static_cast<CAknSliderSettingPage*>
       
   673                             ( aSettingPage )->SliderControl()->Value() );
       
   674 #ifdef FF_POWER_SAVE 
       
   675                         }
       
   676 #endif //FF_POWER_SAVE
       
   677                     }
       
   678                 break;
       
   679             case KGSAmbientLightSensorId:
       
   680 #ifdef FF_POWER_SAVE
       
   681                 if ( iPsmActive->Mode() == EPsmsrvModePowerSave )
       
   682                     {
       
   683                     DisplayBlockNoteL();
       
   684                     static_cast<CAknSliderSettingPage*>( aSettingPage )->
       
   685                         SliderControl()->SetValueL( iModel->AmbientLightSensorL() );
       
   686                     }
       
   687                 else
       
   688                     {
       
   689 #endif //FF_POWER_SAVE
       
   690                     iModel->SetAmbientLightSensorL( static_cast<CAknSliderSettingPage*>
       
   691                          ( aSettingPage )->SliderControl()->Value() );
       
   692 #ifdef FF_POWER_SAVE 
       
   693                     }
       
   694 #endif //FF_POWER_SAVE
       
   695                 break;
       
   696             default:
       
   697                 break;
       
   698             }
       
   699         }
       
   700 
       
   701     if ( aEventType == EEventSettingOked )
       
   702         {
       
   703         TInt current;
       
   704 
       
   705         switch ( id )
       
   706             {
       
   707             case KGSWelcomeNoteSettingId:
       
   708                 current =
       
   709                    static_cast<CAknRadioButtonSettingPage*> ( aSettingPage )->
       
   710                    ListBoxControl()->CurrentItemIndex();
       
   711                 if ( current == KGSWNTextIndex )
       
   712                     {
       
   713                     ShowWelcomeNoteTextQueryL();
       
   714                     }
       
   715                 else if ( current == KGSWNImageIndex )
       
   716                     {
       
   717                     aSettingPage->MakeVisible(EFalse); 
       
   718                     ShowWelcomeNoteImageListL();
       
   719                     }
       
   720                 break;
       
   721             default:
       
   722                 break;
       
   723             }
       
   724         }
       
   725     }
       
   726 
       
   727 
       
   728 // ---------------------------------------------------------------------------
       
   729 // CGSDisplayPlugin::VerifySelectionL()
       
   730 //
       
   731 // An overloaded method from MMGFetchVerifier interface class
       
   732 // ---------------------------------------------------------------------------
       
   733 //
       
   734 TBool CGSDisplayPlugin::VerifySelectionL( const MDesCArray* aSelectedFiles )
       
   735     {
       
   736     const TBool KGSDrmProtectedContent = ETrue;
       
   737 
       
   738     TBool ret = ETrue;
       
   739     //
       
   740     if ( aSelectedFiles->MdcaCount() == 1 )
       
   741         {
       
   742         const TPtrC fileName( aSelectedFiles->MdcaPoint( 0 ) );
       
   743 
       
   744         // First, check if the selected file is DRM protected
       
   745         if  ( ret && CheckDRMProtectionL( fileName ) ==
       
   746                     KGSDrmProtectedContent )
       
   747             {
       
   748             // display the note to user
       
   749             // Show information note
       
   750             HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
   751                                           R_GS_DRM_NOT_ALLOWED );
       
   752 
       
   753             CAknInformationNote* note =
       
   754                 new( ELeave ) CAknInformationNote( ETrue );
       
   755             note->ExecuteLD( *prompt );
       
   756 
       
   757             CleanupStack::PopAndDestroy( prompt );
       
   758             ret = EFalse;
       
   759             }
       
   760 
       
   761         // Next, check whether the image header is valid
       
   762         if  ( ret )
       
   763             {
       
   764             CImageDecoder* imageDecoder = NULL;
       
   765             TRAPD( err, imageDecoder = CImageDecoder::FileNewL(
       
   766                   iCoeEnv->FsSession(), fileName, ContentAccess::EPeek ) );
       
   767 
       
   768             if  ( err != KErrNone )
       
   769                 {
       
   770                 // Show information note
       
   771                 HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
   772                                                   R_GS_IMAGE_CORRUPTED );
       
   773                 CAknInformationNote* note =
       
   774                     new( ELeave ) CAknInformationNote( ETrue );
       
   775                 note->ExecuteLD(*prompt);
       
   776                 CleanupStack::PopAndDestroy( prompt );
       
   777 
       
   778                 ret = EFalse;
       
   779                 }
       
   780             delete imageDecoder;
       
   781             }
       
   782         }
       
   783 
       
   784     return ret;
       
   785     }
       
   786 
       
   787 
       
   788 // ---------------------------------------------------------------------------
       
   789 // CGSDisplayPlugin::ShowWelcomeNoteSettingPageL()
       
   790 //
       
   791 // Display welcome note setting page
       
   792 // ---------------------------------------------------------------------------
       
   793 //
       
   794 void CGSDisplayPlugin::ShowWelcomeNoteSettingPageL()
       
   795     {
       
   796     iUpdateWNote = ETrue;
       
   797 
       
   798     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   799                                         R_WELCOME_NOTE_SETTING_PAGE_LBX );
       
   800     CleanupStack::PushL( items );
       
   801 
       
   802     TInt currentItem = iModel->WelcomeNoteTypeL();
       
   803     iWelcomeNoteType = currentItem;
       
   804 
       
   805     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
       
   806                                   R_WELCOME_NOTE_SETTING_PAGE,
       
   807                                   currentItem, items );
       
   808 
       
   809     dlg->SetSettingId( KGSWelcomeNoteSettingId );
       
   810     dlg->SetSettingPageObserver(this);
       
   811     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )
       
   812          && iUpdateWNote && currentItem != KGSImageWelcomeNote
       
   813          )
       
   814         {
       
   815         iModel->SetWelcomeNoteTypeL( currentItem );
       
   816         UpdateListBoxL( EGSSettIdWNI );
       
   817         }
       
   818 
       
   819     CleanupStack::PopAndDestroy( items );
       
   820     }
       
   821 
       
   822 // ---------------------------------------------------------------------------
       
   823 // CGSDisplayPlugin::ShowWelcomeNoteTextQueryL()
       
   824 //
       
   825 // Display welcome note text input dialog
       
   826 // ---------------------------------------------------------------------------
       
   827 //
       
   828 void CGSDisplayPlugin::ShowWelcomeNoteTextQueryL()
       
   829     {
       
   830     TBuf<KGSMaxWNText> note;
       
   831     iModel->WelcomeNoteTextL( note );
       
   832 
       
   833     CAknTextQueryDialog* dlg = new ( ELeave ) CAknTextQueryDialog( note );
       
   834     if( dlg->ExecuteLD( R_WELCOME_NOTE_TEXT_QUERY ) )
       
   835         {
       
   836         iModel->SetWelcomeNoteTextL( note );
       
   837         iUpdateWNote = ETrue;
       
   838         }
       
   839     else
       
   840         {
       
   841         iUpdateWNote = EFalse;
       
   842         }
       
   843    }
       
   844 
       
   845 // ---------------------------------------------------------------------------
       
   846 // CGSDisplayPlugin::ShowWelcomeNoteImageListL()
       
   847 //
       
   848 // Display welcome note image list from media gallery
       
   849 // ---------------------------------------------------------------------------
       
   850 //
       
   851 void CGSDisplayPlugin::ShowWelcomeNoteImageListL()
       
   852     {
       
   853     // If the MGFetch already launched, return.
       
   854     if ( iLaunchedImageFetch )
       
   855         {
       
   856         return;
       
   857         }
       
   858     CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
       
   859     CleanupStack::PushL( selectedFiles );
       
   860 
       
   861     iLaunchedImageFetch = ETrue;
       
   862     TBool ret = MGFetch::RunL( *selectedFiles, EImageFile, EFalse, this );
       
   863     iLaunchedImageFetch = EFalse;
       
   864 
       
   865     if ( ret && selectedFiles->MdcaCount() == 1 )
       
   866         {
       
   867         iImageHandler = CGSAsyncImageHandling::NewL( iCoeEnv->FsSession(),
       
   868                                                this, KGSWelcomeNoteImgPath );
       
   869 
       
   870         TPtrC imagePath = selectedFiles->MdcaPoint( 0 );
       
   871 
       
   872         //attempting to create private directory
       
   873         RFs fs;
       
   874         User::LeaveIfError( fs.Connect() );
       
   875         CleanupClosePushL( fs );
       
   876         TInt ret = fs.CreatePrivatePath( 2 );
       
   877         CleanupStack::PopAndDestroy(); //fs
       
   878 
       
   879         TRAPD( error,
       
   880                iModel->BackgroundImage()->SetWelcomeNoteImageL( imagePath, *iImageHandler )
       
   881              );
       
   882 
       
   883         if ( error == KErrNone )
       
   884             {
       
   885             // Show wait note
       
   886             ShowImageLoadWaitNoteL();
       
   887             }
       
   888         else
       
   889             {
       
   890             HandleImageErrorsL( error );
       
   891             }
       
   892         }
       
   893     else
       
   894         {
       
   895         iUpdateWNote = EFalse;
       
   896         }
       
   897 
       
   898     CleanupStack::PopAndDestroy( selectedFiles );
       
   899     }
       
   900 
       
   901 
       
   902 // ---------------------------------------------------------------------------
       
   903 // CGSDisplayPlugin::ShowDisplayTextSizeSettingPageL()
       
   904 //
       
   905 // Display display text size setting page
       
   906 // ---------------------------------------------------------------------------
       
   907 //
       
   908 void CGSDisplayPlugin::ShowDisplayTextSizeSettingPageL()
       
   909     {
       
   910     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   911                                      R_DISPLAY_TEXT_SIZE_SETTING_PAGE_LBX );
       
   912     CleanupStack::PushL( items );
       
   913 
       
   914     TInt currentItem = iModel->DisplayTextSizeL();
       
   915     // get the UI index from container
       
   916     Container()->MapZoomLevelToUi( currentItem );
       
   917     // store the current value for comparison
       
   918     TInt oldItem = currentItem;
       
   919 
       
   920     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
       
   921                                   R_DISPLAY_TEXT_SIZE_SETTING_PAGE,
       
   922                                   currentItem, items );
       
   923 
       
   924     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   925         {
       
   926         if( currentItem != oldItem )
       
   927             {
       
   928             // get the Avkon value from UI index
       
   929             Container()->MapZoomLevelFromUi( currentItem );
       
   930             // set Avkon value to CenRep. As an additional check, confirm
       
   931             // from feature manager that zooming is supported.
       
   932             if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   933                 {
       
   934                 iModel->SetDisplayTextSizeL( currentItem );
       
   935                 }
       
   936              // now inform all open apps of the switch
       
   937              // note that app needs software event capability to call this API
       
   938             TWsEvent event;
       
   939             event.SetType( KEikDynamicLayoutVariantSwitch );
       
   940             iEikonEnv->WsSession().SendEventToAllWindowGroups( event );
       
   941             }
       
   942 
       
   943         UpdateListBoxL( EGSSettIdDisplayTextSize );
       
   944         }
       
   945 
       
   946     CleanupStack::PopAndDestroy( items );
       
   947     }
       
   948 
       
   949 
       
   950 // ---------------------------------------------------------------------------
       
   951 // CGSDisplayPlugin::ShowPowerSaveLedSettingPageL()
       
   952 //
       
   953 // Display the screen saver object setting page.
       
   954 // ---------------------------------------------------------------------------
       
   955 //
       
   956 void CGSDisplayPlugin::ShowPowerSaveLedSettingPageL( TBool aSettingPage )
       
   957     {
       
   958 
       
   959     CDesCArrayFlat* items =
       
   960         iCoeEnv->ReadDesC16ArrayResourceL( R_POWER_SAVE_LED_SETTING_PAGE_LBX );
       
   961     CleanupStack::PushL( items );
       
   962 
       
   963     TInt currentItem = iModel->PowerSaveLedL();
       
   964 
       
   965     if( aSettingPage )
       
   966         {
       
   967         CAknRadioButtonSettingPage* dlg =
       
   968             new ( ELeave ) CAknRadioButtonSettingPage(
       
   969                                    R_POWER_SAVE_LED_SETTING_PAGE,
       
   970                                    currentItem, items );
       
   971 
       
   972         if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   973             {
       
   974             iModel->SetPowerSaveLedL( currentItem );
       
   975             UpdateListBoxL( EGSSettIdPowerSaveLed );
       
   976             }
       
   977         }
       
   978     else
       
   979         {
       
   980         iModel->SetPowerSaveLedL( !currentItem );
       
   981         UpdateListBoxL( EGSSettIdPowerSaveLed );
       
   982         }
       
   983     CleanupStack::PopAndDestroy( items );
       
   984     }
       
   985 
       
   986 
       
   987 // ---------------------------------------------------------------------------
       
   988 // CGSDisplayPlugin::ImageHandlingComplete()
       
   989 //
       
   990 // Method derived from MGSSyncImageHandlingObserver
       
   991 // Run when the asynchronous image converting is complete
       
   992 // ---------------------------------------------------------------------------
       
   993 //
       
   994 void CGSDisplayPlugin::ImageHandlingCompleteL( TInt aError )
       
   995     {
       
   996     if ( aError != KErrNone )
       
   997         {
       
   998         HandleImageErrorsL( aError );
       
   999         }
       
  1000     else
       
  1001         {
       
  1002         iModel->SetWelcomeNoteTypeL( KGSImageWelcomeNote );
       
  1003         UpdateListBoxL( EGSSettIdWNI );
       
  1004         }
       
  1005     HideImageLoadWaitNoteL();
       
  1006 
       
  1007     if( iImageHandler )
       
  1008         {
       
  1009         delete iImageHandler;
       
  1010         iImageHandler = NULL;
       
  1011         }
       
  1012     }
       
  1013 
       
  1014 
       
  1015 // ---------------------------------------------------------------------------
       
  1016 // CGSDisplayPlugin::ShowImageLoadWaitNoteL()
       
  1017 //
       
  1018 // Display image load wait note dialog.
       
  1019 // ---------------------------------------------------------------------------
       
  1020 //
       
  1021 void CGSDisplayPlugin::ShowImageLoadWaitNoteL()
       
  1022     {
       
  1023     if ( !iWaitDialog )
       
  1024         {
       
  1025         iWaitDialog = new( ELeave ) CAknWaitDialog(
       
  1026                       ( REINTERPRET_CAST(CEikDialog**,
       
  1027                       &iWaitDialog ) ), ETrue );
       
  1028 
       
  1029         iWaitDialog->ExecuteDlgLD( CAknNoteDialog::ENoTone,
       
  1030                                    R_IMAGE_LOAD_WAIT_NOTE );
       
  1031         }
       
  1032     }
       
  1033 
       
  1034 // ---------------------------------------------------------------------------
       
  1035 // CGSDisplayPlugin::HideImageLoadWaitNoteL()
       
  1036 //
       
  1037 // Hide image load wait note dialog.
       
  1038 // ---------------------------------------------------------------------------
       
  1039 //
       
  1040 void CGSDisplayPlugin::HideImageLoadWaitNoteL()
       
  1041     {
       
  1042     if ( iWaitDialog )
       
  1043         {
       
  1044         iWaitDialog->ProcessFinishedL(); // deletes the dialog
       
  1045         iWaitDialog = NULL;
       
  1046         }
       
  1047     }
       
  1048 
       
  1049 
       
  1050 // ---------------------------------------------------------------------------
       
  1051 // CGSDisplayPlugin::CheckDRMProtectionL
       
  1052 //
       
  1053 // Check if the selected image file is DRM protected.
       
  1054 // ---------------------------------------------------------------------------
       
  1055 //
       
  1056 TBool CGSDisplayPlugin::CheckDRMProtectionL( const TDesC& aOriginalFileName )
       
  1057     {
       
  1058     TBool isProtected( EFalse );
       
  1059     DRMCommon* drmClient = DRMCommon::NewL();
       
  1060     CleanupStack::PushL( drmClient );
       
  1061     TInt error = drmClient->Connect();
       
  1062     if ( error != DRMCommon::EOk )
       
  1063         {
       
  1064         User::Leave( KErrCorrupt );
       
  1065         }
       
  1066 
       
  1067     if ( aOriginalFileName != KNullDesC )
       
  1068         {
       
  1069         error = drmClient->IsProtectedFile( aOriginalFileName, isProtected );
       
  1070         if ( error != DRMCommon::EOk )
       
  1071             {
       
  1072             User::Leave( KErrCorrupt );
       
  1073             }
       
  1074         }
       
  1075 
       
  1076     CleanupStack::PopAndDestroy( drmClient );
       
  1077     return isProtected;
       
  1078     }
       
  1079 
       
  1080 // ---------------------------------------------------------------------------
       
  1081 // CGSDisplayPlugin::HandleImageErrorsL
       
  1082 //
       
  1083 // Prompt image related errors to the user
       
  1084 // ---------------------------------------------------------------------------
       
  1085 //
       
  1086 void CGSDisplayPlugin::HandleImageErrorsL( TInt aError )
       
  1087     {
       
  1088     if ( aError )
       
  1089         {
       
  1090         TInt resourceId;
       
  1091         switch( aError )
       
  1092             {
       
  1093             case KErrNotSupported:
       
  1094             case KErrUnderflow:
       
  1095                 // Image is corrupted or in wrong format
       
  1096                 resourceId = R_GS_IMAGE_CORRUPTED;
       
  1097                 break;
       
  1098             case KErrDiskFull:
       
  1099             case KErrNoMemory:
       
  1100                 // Image is too large
       
  1101                 resourceId = R_GS_IMAGE_TOO_LARGE;
       
  1102                 break;
       
  1103             default:
       
  1104                 // Better to give some error message than result in CONE5 panic:
       
  1105                 resourceId = R_GS_IMAGE_CORRUPTED;
       
  1106                 //User::LeaveIfError( aError );
       
  1107                 break;
       
  1108             }
       
  1109 
       
  1110         // Show information note
       
  1111         HBufC* prompt = iCoeEnv->AllocReadResourceLC( resourceId );
       
  1112         CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue );
       
  1113         note->ExecuteLD( *prompt );
       
  1114 
       
  1115         // Restoring previous welcome note value
       
  1116         iModel->SetWelcomeNoteTypeL( iWelcomeNoteType );
       
  1117         UpdateListBoxL( EGSSettIdWNI );
       
  1118         CleanupStack::PopAndDestroy( prompt );
       
  1119         }
       
  1120     }
       
  1121 
       
  1122 
       
  1123 // ----------------------------------------------------------------------------
       
  1124 // CGSDisplayPlugin::DynInitMenuPaneL()
       
  1125 //
       
  1126 // Display the dynamic menu
       
  1127 // ----------------------------------------------------------------------------
       
  1128 void CGSDisplayPlugin::DynInitMenuPaneL( TInt aResourceId,
       
  1129                                          CEikMenuPane* aMenuPane )
       
  1130     {
       
  1131     // show or hide the 'help' menu item when supported
       
  1132     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
  1133         {
       
  1134         User::LeaveIfNull( aMenuPane );
       
  1135 
       
  1136         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
  1137             {
       
  1138             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
  1139             }
       
  1140         else
       
  1141             {
       
  1142             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
  1143             }
       
  1144         }
       
  1145     }
       
  1146 
       
  1147 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  1148 
       
  1149 //
       
  1150 // ----------------------------------------------------------------------------------
       
  1151 // CGSDisplayPlugin::UpdateViewL()
       
  1152 // ----------------------------------------------------------------------------------
       
  1153 //
       
  1154 void CGSDisplayPlugin::UpdateViewL()
       
  1155     {
       
  1156     // Check what view is active, update if needed.
       
  1157     // If displaying main view, update all PSM changed items.
       
  1158     TVwsViewId activeView;
       
  1159     CEikonEnv::Static()->EikAppUi()->GetActiveViewId( activeView );
       
  1160 //    if( activeView.iViewUid == Id() )
       
  1161         {
       
  1162         __GSLOGSTRING( "[CGSDisplayPlugin] I am active!!!" );        
       
  1163         // Not too elegant - update only items that are affected by PSM
       
  1164         UpdateListBoxL( EGSSettIdContrast );
       
  1165         UpdateListBoxL( EGSSettIdBrightness );
       
  1166         UpdateListBoxL( EGSSettIdAmbientLightSensor );
       
  1167 //        UpdateListBoxL( EGSSettIdDisplayTextSize );
       
  1168         UpdateListBoxL( EGSSettIdSSP );
       
  1169 //        UpdateListBoxL( EGSSettIdSSO );
       
  1170 //        UpdateListBoxL( EGSSettIdWNI );
       
  1171         UpdateListBoxL( EGSSettIdBacklight );
       
  1172 //        UpdateListBoxL( EGSSettIdPowerSaveLed );
       
  1173         UpdateListBoxL( EGSSettIdOperatorLogo );
       
  1174         }
       
  1175     }
       
  1176 
       
  1177 #ifdef FF_POWER_SAVE
       
  1178 // ----------------------------------------------------------------------------------
       
  1179 // CGSDisplayPlugin::DisplayBlockNoteL()
       
  1180 // ----------------------------------------------------------------------------------
       
  1181 void CGSDisplayPlugin::DisplayBlockNoteL()
       
  1182     {
       
  1183     HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
  1184             R_GS_POWER_SAVING_PROTECTED_SETTINGS_INFONOTE );
       
  1185     CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
       
  1186     note->ExecuteLD( *prompt );
       
  1187     CleanupStack::PopAndDestroy( prompt );
       
  1188     }
       
  1189 #endif // FF_POWER_SAVE
       
  1190 
       
  1191 
       
  1192 // -----------------------------------------------------------------------------
       
  1193 // CGSDisplayPlugin::CreateIconL()
       
  1194 //
       
  1195 //
       
  1196 // -----------------------------------------------------------------------------
       
  1197 //
       
  1198 CGulIcon* CGSDisplayPlugin::CreateIconL( const TUid aIconType )
       
  1199     {
       
  1200     //EMbm<Mbm_file_name><Bitmap_name>
       
  1201     CGulIcon* icon;
       
  1202 
       
  1203     if( aIconType == KGSIconTypeLbxItem )
       
  1204         {
       
  1205         icon = AknsUtils::CreateGulIconL(
       
  1206         AknsUtils::SkinInstance(),
       
  1207         KAknsIIDQgnPropCpDevDisp,
       
  1208         KGSDefaultDisplayIconFileName,
       
  1209         EMbmGsdisplaypluginQgn_prop_cp_dev_disp,
       
  1210         EMbmGsdisplaypluginQgn_prop_cp_dev_disp_mask );
       
  1211         }
       
  1212        else
       
  1213         {
       
  1214         icon = CGSPluginInterface::CreateIconL( aIconType );
       
  1215         }
       
  1216 
       
  1217     return icon;
       
  1218     }
       
  1219     
       
  1220 
       
  1221 // -----------------------------------------------------------------------------
       
  1222 // CGSDisplayPlugin::ChangeOperatorLogoSettingL()
       
  1223 //
       
  1224 //
       
  1225 // -----------------------------------------------------------------------------
       
  1226 //
       
  1227 void CGSDisplayPlugin::ChangeOperatorLogoSettingL( TBool aUseSettingPage )
       
  1228     {
       
  1229     TInt currentValue = iModel->OperatorLogoL();
       
  1230     TBool isValueUpdated = EFalse;
       
  1231 
       
  1232     if ( aUseSettingPage )
       
  1233         {
       
  1234         isValueUpdated = ShowOperatorLogoSettingPageL( currentValue );
       
  1235         }
       
  1236     else
       
  1237         {
       
  1238         if( currentValue == KGSSettingOff )
       
  1239             {
       
  1240             currentValue = KGSSettingOn;
       
  1241             }
       
  1242         else
       
  1243             {
       
  1244             currentValue = KGSSettingOff;
       
  1245             }
       
  1246         isValueUpdated = ETrue;
       
  1247         }
       
  1248     // Value has been changed -> store it:
       
  1249     if ( isValueUpdated )
       
  1250         {
       
  1251         iModel->SetOperatorLogoL( currentValue );
       
  1252 
       
  1253         UpdateListBoxL( EGSSettIdOperatorLogo );
       
  1254         }
       
  1255     }
       
  1256 
       
  1257 
       
  1258 // -----------------------------------------------------------------------------
       
  1259 // CGSDisplayPlugin::ShowOperatorLogoSettingPageL()
       
  1260 //
       
  1261 // Note: Lbx index of each value is only internal to this function. The
       
  1262 // parameter given and modified is the actual operator logo value.
       
  1263 // -----------------------------------------------------------------------------
       
  1264 //
       
  1265 TBool CGSDisplayPlugin::ShowOperatorLogoSettingPageL(
       
  1266     TInt& aOperatorLogoValue )
       
  1267     {
       
  1268     TBool isValueUpdated = EFalse;
       
  1269     TInt previousValue = aOperatorLogoValue;
       
  1270     TInt selectedIndex;
       
  1271 
       
  1272     // Match aOperatorLogoValue value to lbx item index:
       
  1273     switch( aOperatorLogoValue )
       
  1274         {
       
  1275         case KGSSettingOn:
       
  1276             selectedIndex = KGSOpLogoLbxIndexOn;
       
  1277             break;
       
  1278         case KGSSettingOff:
       
  1279             selectedIndex = KGSOpLogoLbxIndexOff;
       
  1280             break;
       
  1281         }
       
  1282 
       
  1283     CDesCArrayFlat* items =
       
  1284         iCoeEnv->ReadDesC16ArrayResourceL( R_OPLOGO_ON_OFF_SETTING_PAGE_LBX );
       
  1285     CleanupStack::PushL( items );
       
  1286 
       
  1287     if ( !iOprtLogoSettingPage )
       
  1288     	{
       
  1289     	iOprtLogoSettingPage = new (ELeave) CAknRadioButtonSettingPage(
       
  1290             R_OPERATOR_LOGO_SETTING_PAGE,
       
  1291             selectedIndex,
       
  1292             items );
       
  1293     	}
       
  1294 
       
  1295     TBool ret = iOprtLogoSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
  1296     iOprtLogoSettingPage = NULL;
       
  1297     CleanupStack::PopAndDestroy( items );
       
  1298 
       
  1299      // Match selected lbx item index to aOperatorLogoValue:
       
  1300     switch( selectedIndex )
       
  1301         {
       
  1302         case KGSOpLogoLbxIndexOn:
       
  1303             aOperatorLogoValue = KGSSettingOn;
       
  1304             break;
       
  1305         case KGSOpLogoLbxIndexOff:
       
  1306             aOperatorLogoValue = KGSSettingOff;
       
  1307             break;
       
  1308         }
       
  1309 
       
  1310     if( aOperatorLogoValue != previousValue )
       
  1311         {
       
  1312         isValueUpdated = ETrue;
       
  1313         }
       
  1314     return isValueUpdated;
       
  1315     }
       
  1316 
       
  1317 // -----------------------------------------------------------------------------
       
  1318 // CGSDisplayPlugin::CloseDialog
       
  1319 //
       
  1320 //
       
  1321 // -----------------------------------------------------------------------------
       
  1322 //
       
  1323 void CGSDisplayPlugin::CloseDialog()
       
  1324     {
       
  1325     //Send ESC key sequence to setting dialog, so that it closes itself.
       
  1326     if ( iOprtLogoSettingPage )
       
  1327         {
       
  1328         iReshowOprtSetPage = ETrue;
       
  1329         TKeyEvent event;
       
  1330         event.iCode = EKeyEscape;
       
  1331         event.iScanCode = EStdKeyEscape;
       
  1332         event.iRepeats = 0;
       
  1333         TRAP_IGNORE( iCoeEnv->SimulateKeyEventL( event, EEventKeyDown );
       
  1334                      iCoeEnv->SimulateKeyEventL( event, EEventKey );
       
  1335                      iCoeEnv->SimulateKeyEventL( event, EEventKeyUp ); );
       
  1336         }
       
  1337     }
       
  1338 // End of File
       
  1339 
       
  1340