gssettingsuis/Gs/GSDisplayPlugin/Src/GSDisplayPlugin.cpp
changeset 0 8c5d936e5675
child 13 23553eb4e470
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     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() == EPsmsrvModeNormal )
       
   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() == EPsmsrvModeNormal )
       
   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() == EPsmsrvModeNormal )
       
   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->ScreenSaverPeriodL();
       
   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->SetScreenSaverPeriodL( 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                     ShowWelcomeNoteImageListL();
       
   718                     }
       
   719                 break;
       
   720             default:
       
   721                 break;
       
   722             }
       
   723         }
       
   724     }
       
   725 
       
   726 
       
   727 // ---------------------------------------------------------------------------
       
   728 // CGSDisplayPlugin::VerifySelectionL()
       
   729 //
       
   730 // An overloaded method from MMGFetchVerifier interface class
       
   731 // ---------------------------------------------------------------------------
       
   732 //
       
   733 TBool CGSDisplayPlugin::VerifySelectionL( const MDesCArray* aSelectedFiles )
       
   734     {
       
   735     const TBool KGSDrmProtectedContent = ETrue;
       
   736 
       
   737     TBool ret = ETrue;
       
   738     //
       
   739     if ( aSelectedFiles->MdcaCount() == 1 )
       
   740         {
       
   741         const TPtrC fileName( aSelectedFiles->MdcaPoint( 0 ) );
       
   742 
       
   743         // First, check if the selected file is DRM protected
       
   744         if  ( ret && CheckDRMProtectionL( fileName ) ==
       
   745                     KGSDrmProtectedContent )
       
   746             {
       
   747             // display the note to user
       
   748             // Show information note
       
   749             HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
   750                                           R_GS_DRM_NOT_ALLOWED );
       
   751 
       
   752             CAknInformationNote* note =
       
   753                 new( ELeave ) CAknInformationNote( ETrue );
       
   754             note->ExecuteLD( *prompt );
       
   755 
       
   756             CleanupStack::PopAndDestroy( prompt );
       
   757             ret = EFalse;
       
   758             }
       
   759 
       
   760         // Next, check whether the image header is valid
       
   761         if  ( ret )
       
   762             {
       
   763             CImageDecoder* imageDecoder = NULL;
       
   764             TRAPD( err, imageDecoder = CImageDecoder::FileNewL(
       
   765                   iCoeEnv->FsSession(), fileName, ContentAccess::EPeek ) );
       
   766 
       
   767             if  ( err != KErrNone )
       
   768                 {
       
   769                 // Show information note
       
   770                 HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
   771                                                   R_GS_IMAGE_CORRUPTED );
       
   772                 CAknInformationNote* note =
       
   773                     new( ELeave ) CAknInformationNote( ETrue );
       
   774                 note->ExecuteLD(*prompt);
       
   775                 CleanupStack::PopAndDestroy( prompt );
       
   776 
       
   777                 ret = EFalse;
       
   778                 }
       
   779             delete imageDecoder;
       
   780             }
       
   781         }
       
   782 
       
   783     return ret;
       
   784     }
       
   785 
       
   786 
       
   787 // ---------------------------------------------------------------------------
       
   788 // CGSDisplayPlugin::ShowWelcomeNoteSettingPageL()
       
   789 //
       
   790 // Display welcome note setting page
       
   791 // ---------------------------------------------------------------------------
       
   792 //
       
   793 void CGSDisplayPlugin::ShowWelcomeNoteSettingPageL()
       
   794     {
       
   795     iUpdateWNote = ETrue;
       
   796 
       
   797     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   798                                         R_WELCOME_NOTE_SETTING_PAGE_LBX );
       
   799     CleanupStack::PushL( items );
       
   800 
       
   801     TInt currentItem = iModel->WelcomeNoteTypeL();
       
   802     iWelcomeNoteType = currentItem;
       
   803 
       
   804     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
       
   805                                   R_WELCOME_NOTE_SETTING_PAGE,
       
   806                                   currentItem, items );
       
   807 
       
   808     dlg->SetSettingId( KGSWelcomeNoteSettingId );
       
   809     dlg->SetSettingPageObserver(this);
       
   810     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged )
       
   811          && iUpdateWNote && currentItem != KGSImageWelcomeNote
       
   812          )
       
   813         {
       
   814         iModel->SetWelcomeNoteTypeL( currentItem );
       
   815         UpdateListBoxL( EGSSettIdWNI );
       
   816         }
       
   817 
       
   818     CleanupStack::PopAndDestroy( items );
       
   819     }
       
   820 
       
   821 // ---------------------------------------------------------------------------
       
   822 // CGSDisplayPlugin::ShowWelcomeNoteTextQueryL()
       
   823 //
       
   824 // Display welcome note text input dialog
       
   825 // ---------------------------------------------------------------------------
       
   826 //
       
   827 void CGSDisplayPlugin::ShowWelcomeNoteTextQueryL()
       
   828     {
       
   829     TBuf<KGSMaxWNText> note;
       
   830     iModel->WelcomeNoteTextL( note );
       
   831 
       
   832     CAknTextQueryDialog* dlg = new ( ELeave ) CAknTextQueryDialog( note );
       
   833     if( dlg->ExecuteLD( R_WELCOME_NOTE_TEXT_QUERY ) )
       
   834         {
       
   835         iModel->SetWelcomeNoteTextL( note );
       
   836         iUpdateWNote = ETrue;
       
   837         }
       
   838     else
       
   839         {
       
   840         iUpdateWNote = EFalse;
       
   841         }
       
   842    }
       
   843 
       
   844 // ---------------------------------------------------------------------------
       
   845 // CGSDisplayPlugin::ShowWelcomeNoteImageListL()
       
   846 //
       
   847 // Display welcome note image list from media gallery
       
   848 // ---------------------------------------------------------------------------
       
   849 //
       
   850 void CGSDisplayPlugin::ShowWelcomeNoteImageListL()
       
   851     {
       
   852     // If the MGFetch already launched, return.
       
   853     if ( iLaunchedImageFetch )
       
   854         {
       
   855         return;
       
   856         }
       
   857     CDesCArray* selectedFiles = new ( ELeave ) CDesCArrayFlat( 1 );
       
   858     CleanupStack::PushL( selectedFiles );
       
   859 
       
   860     iLaunchedImageFetch = ETrue;
       
   861     TBool ret = MGFetch::RunL( *selectedFiles, EImageFile, EFalse, this );
       
   862     iLaunchedImageFetch = EFalse;
       
   863 
       
   864     if ( ret && selectedFiles->MdcaCount() == 1 )
       
   865         {
       
   866         iImageHandler = CGSAsyncImageHandling::NewL( iCoeEnv->FsSession(),
       
   867                                                this, KGSWelcomeNoteImgPath );
       
   868 
       
   869         TPtrC imagePath = selectedFiles->MdcaPoint( 0 );
       
   870 
       
   871         //attempting to create private directory
       
   872         RFs fs;
       
   873         User::LeaveIfError( fs.Connect() );
       
   874         CleanupClosePushL( fs );
       
   875         TInt ret = fs.CreatePrivatePath( 2 );
       
   876         CleanupStack::PopAndDestroy(); //fs
       
   877 
       
   878         TRAPD( error,
       
   879                iModel->BackgroundImage()->SetWelcomeNoteImageL( imagePath, *iImageHandler )
       
   880              );
       
   881 
       
   882         if ( error == KErrNone )
       
   883             {
       
   884             // Show wait note
       
   885             ShowImageLoadWaitNoteL();
       
   886             }
       
   887         else
       
   888             {
       
   889             HandleImageErrorsL( error );
       
   890             }
       
   891         }
       
   892     else
       
   893         {
       
   894         iUpdateWNote = EFalse;
       
   895         }
       
   896 
       
   897     CleanupStack::PopAndDestroy( selectedFiles );
       
   898     }
       
   899 
       
   900 
       
   901 // ---------------------------------------------------------------------------
       
   902 // CGSDisplayPlugin::ShowDisplayTextSizeSettingPageL()
       
   903 //
       
   904 // Display display text size setting page
       
   905 // ---------------------------------------------------------------------------
       
   906 //
       
   907 void CGSDisplayPlugin::ShowDisplayTextSizeSettingPageL()
       
   908     {
       
   909     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL(
       
   910                                      R_DISPLAY_TEXT_SIZE_SETTING_PAGE_LBX );
       
   911     CleanupStack::PushL( items );
       
   912 
       
   913     TInt currentItem = iModel->DisplayTextSizeL();
       
   914     // get the UI index from container
       
   915     Container()->MapZoomLevelToUi( currentItem );
       
   916     // store the current value for comparison
       
   917     TInt oldItem = currentItem;
       
   918 
       
   919     CAknSettingPage* dlg = new( ELeave ) CAknRadioButtonSettingPage(
       
   920                                   R_DISPLAY_TEXT_SIZE_SETTING_PAGE,
       
   921                                   currentItem, items );
       
   922 
       
   923     if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   924         {
       
   925         if( currentItem != oldItem )
       
   926             {
       
   927             // get the Avkon value from UI index
       
   928             Container()->MapZoomLevelFromUi( currentItem );
       
   929             // set Avkon value to CenRep. As an additional check, confirm
       
   930             // from feature manager that zooming is supported.
       
   931             if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   932                 {
       
   933                 iModel->SetDisplayTextSizeL( currentItem );
       
   934                 }
       
   935              // now inform all open apps of the switch
       
   936              // note that app needs software event capability to call this API
       
   937             TWsEvent event;
       
   938             event.SetType( KEikDynamicLayoutVariantSwitch );
       
   939             iEikonEnv->WsSession().SendEventToAllWindowGroups( event );
       
   940             }
       
   941 
       
   942         UpdateListBoxL( EGSSettIdDisplayTextSize );
       
   943         }
       
   944 
       
   945     CleanupStack::PopAndDestroy( items );
       
   946     }
       
   947 
       
   948 
       
   949 // ---------------------------------------------------------------------------
       
   950 // CGSDisplayPlugin::ShowPowerSaveLedSettingPageL()
       
   951 //
       
   952 // Display the screen saver object setting page.
       
   953 // ---------------------------------------------------------------------------
       
   954 //
       
   955 void CGSDisplayPlugin::ShowPowerSaveLedSettingPageL( TBool aSettingPage )
       
   956     {
       
   957 
       
   958     CDesCArrayFlat* items =
       
   959         iCoeEnv->ReadDesC16ArrayResourceL( R_POWER_SAVE_LED_SETTING_PAGE_LBX );
       
   960     CleanupStack::PushL( items );
       
   961 
       
   962     TInt currentItem = iModel->PowerSaveLedL();
       
   963 
       
   964     if( aSettingPage )
       
   965         {
       
   966         CAknRadioButtonSettingPage* dlg =
       
   967             new ( ELeave ) CAknRadioButtonSettingPage(
       
   968                                    R_POWER_SAVE_LED_SETTING_PAGE,
       
   969                                    currentItem, items );
       
   970 
       
   971         if ( dlg->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )
       
   972             {
       
   973             iModel->SetPowerSaveLedL( currentItem );
       
   974             UpdateListBoxL( EGSSettIdPowerSaveLed );
       
   975             }
       
   976         }
       
   977     else
       
   978         {
       
   979         iModel->SetPowerSaveLedL( !currentItem );
       
   980         UpdateListBoxL( EGSSettIdPowerSaveLed );
       
   981         }
       
   982     CleanupStack::PopAndDestroy( items );
       
   983     }
       
   984 
       
   985 
       
   986 // ---------------------------------------------------------------------------
       
   987 // CGSDisplayPlugin::ImageHandlingComplete()
       
   988 //
       
   989 // Method derived from MGSSyncImageHandlingObserver
       
   990 // Run when the asynchronous image converting is complete
       
   991 // ---------------------------------------------------------------------------
       
   992 //
       
   993 void CGSDisplayPlugin::ImageHandlingCompleteL( TInt aError )
       
   994     {
       
   995     if ( aError != KErrNone )
       
   996         {
       
   997         HandleImageErrorsL( aError );
       
   998         }
       
   999     else
       
  1000         {
       
  1001         iModel->SetWelcomeNoteTypeL( KGSImageWelcomeNote );
       
  1002         UpdateListBoxL( EGSSettIdWNI );
       
  1003         }
       
  1004     HideImageLoadWaitNoteL();
       
  1005 
       
  1006     if( iImageHandler )
       
  1007         {
       
  1008         delete iImageHandler;
       
  1009         iImageHandler = NULL;
       
  1010         }
       
  1011     }
       
  1012 
       
  1013 
       
  1014 // ---------------------------------------------------------------------------
       
  1015 // CGSDisplayPlugin::ShowImageLoadWaitNoteL()
       
  1016 //
       
  1017 // Display image load wait note dialog.
       
  1018 // ---------------------------------------------------------------------------
       
  1019 //
       
  1020 void CGSDisplayPlugin::ShowImageLoadWaitNoteL()
       
  1021     {
       
  1022     if ( !iWaitDialog )
       
  1023         {
       
  1024         iWaitDialog = new( ELeave ) CAknWaitDialog(
       
  1025                       ( REINTERPRET_CAST(CEikDialog**,
       
  1026                       &iWaitDialog ) ), ETrue );
       
  1027 
       
  1028         iWaitDialog->ExecuteDlgLD( CAknNoteDialog::ENoTone,
       
  1029                                    R_IMAGE_LOAD_WAIT_NOTE );
       
  1030         }
       
  1031     }
       
  1032 
       
  1033 // ---------------------------------------------------------------------------
       
  1034 // CGSDisplayPlugin::HideImageLoadWaitNoteL()
       
  1035 //
       
  1036 // Hide image load wait note dialog.
       
  1037 // ---------------------------------------------------------------------------
       
  1038 //
       
  1039 void CGSDisplayPlugin::HideImageLoadWaitNoteL()
       
  1040     {
       
  1041     if ( iWaitDialog )
       
  1042         {
       
  1043         iWaitDialog->ProcessFinishedL(); // deletes the dialog
       
  1044         iWaitDialog = NULL;
       
  1045         }
       
  1046     }
       
  1047 
       
  1048 
       
  1049 // ---------------------------------------------------------------------------
       
  1050 // CGSDisplayPlugin::CheckDRMProtectionL
       
  1051 //
       
  1052 // Check if the selected image file is DRM protected.
       
  1053 // ---------------------------------------------------------------------------
       
  1054 //
       
  1055 TBool CGSDisplayPlugin::CheckDRMProtectionL( const TDesC& aOriginalFileName )
       
  1056     {
       
  1057     TBool isProtected( EFalse );
       
  1058     DRMCommon* drmClient = DRMCommon::NewL();
       
  1059     CleanupStack::PushL( drmClient );
       
  1060     TInt error = drmClient->Connect();
       
  1061     if ( error != DRMCommon::EOk )
       
  1062         {
       
  1063         User::Leave( KErrCorrupt );
       
  1064         }
       
  1065 
       
  1066     if ( aOriginalFileName != KNullDesC )
       
  1067         {
       
  1068         error = drmClient->IsProtectedFile( aOriginalFileName, isProtected );
       
  1069         if ( error != DRMCommon::EOk )
       
  1070             {
       
  1071             User::Leave( KErrCorrupt );
       
  1072             }
       
  1073         }
       
  1074 
       
  1075     CleanupStack::PopAndDestroy( drmClient );
       
  1076     return isProtected;
       
  1077     }
       
  1078 
       
  1079 // ---------------------------------------------------------------------------
       
  1080 // CGSDisplayPlugin::HandleImageErrorsL
       
  1081 //
       
  1082 // Prompt image related errors to the user
       
  1083 // ---------------------------------------------------------------------------
       
  1084 //
       
  1085 void CGSDisplayPlugin::HandleImageErrorsL( TInt aError )
       
  1086     {
       
  1087     if ( aError )
       
  1088         {
       
  1089         TInt resourceId;
       
  1090         switch( aError )
       
  1091             {
       
  1092             case KErrNotSupported:
       
  1093             case KErrUnderflow:
       
  1094                 // Image is corrupted or in wrong format
       
  1095                 resourceId = R_GS_IMAGE_CORRUPTED;
       
  1096                 break;
       
  1097             case KErrDiskFull:
       
  1098             case KErrNoMemory:
       
  1099                 // Image is too large
       
  1100                 resourceId = R_GS_IMAGE_TOO_LARGE;
       
  1101                 break;
       
  1102             default:
       
  1103                 // Better to give some error message than result in CONE5 panic:
       
  1104                 resourceId = R_GS_IMAGE_CORRUPTED;
       
  1105                 //User::LeaveIfError( aError );
       
  1106                 break;
       
  1107             }
       
  1108 
       
  1109         // Show information note
       
  1110         HBufC* prompt = iCoeEnv->AllocReadResourceLC( resourceId );
       
  1111         CAknInformationNote* note = new( ELeave ) CAknInformationNote( ETrue );
       
  1112         note->ExecuteLD( *prompt );
       
  1113 
       
  1114         // Restoring previous welcome note value
       
  1115         iModel->SetWelcomeNoteTypeL( iWelcomeNoteType );
       
  1116         UpdateListBoxL( EGSSettIdWNI );
       
  1117         CleanupStack::PopAndDestroy( prompt );
       
  1118         }
       
  1119     }
       
  1120 
       
  1121 
       
  1122 // ----------------------------------------------------------------------------
       
  1123 // CGSDisplayPlugin::DynInitMenuPaneL()
       
  1124 //
       
  1125 // Display the dynamic menu
       
  1126 // ----------------------------------------------------------------------------
       
  1127 void CGSDisplayPlugin::DynInitMenuPaneL( TInt aResourceId,
       
  1128                                          CEikMenuPane* aMenuPane )
       
  1129     {
       
  1130     // show or hide the 'help' menu item when supported
       
  1131     if( aResourceId == R_GS_MENU_ITEM_HELP )
       
  1132         {
       
  1133         User::LeaveIfNull( aMenuPane );
       
  1134 
       
  1135         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
  1136             {
       
  1137             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
  1138             }
       
  1139         else
       
  1140             {
       
  1141             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
  1142             }
       
  1143         }
       
  1144     }
       
  1145 
       
  1146 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
  1147 
       
  1148 //
       
  1149 // ----------------------------------------------------------------------------------
       
  1150 // CGSDisplayPlugin::UpdateViewL()
       
  1151 // ----------------------------------------------------------------------------------
       
  1152 //
       
  1153 void CGSDisplayPlugin::UpdateViewL()
       
  1154     {
       
  1155     // Check what view is active, update if needed.
       
  1156     // If displaying main view, update all PSM changed items.
       
  1157     TVwsViewId activeView;
       
  1158     CEikonEnv::Static()->EikAppUi()->GetActiveViewId( activeView );
       
  1159 //    if( activeView.iViewUid == Id() )
       
  1160         {
       
  1161         __GSLOGSTRING( "[CGSDisplayPlugin] I am active!!!" );        
       
  1162         // Not too elegant - update only items that are affected by PSM
       
  1163         UpdateListBoxL( EGSSettIdContrast );
       
  1164         UpdateListBoxL( EGSSettIdBrightness );
       
  1165         UpdateListBoxL( EGSSettIdAmbientLightSensor );
       
  1166 //        UpdateListBoxL( EGSSettIdDisplayTextSize );
       
  1167         UpdateListBoxL( EGSSettIdSSP );
       
  1168 //        UpdateListBoxL( EGSSettIdSSO );
       
  1169 //        UpdateListBoxL( EGSSettIdWNI );
       
  1170         UpdateListBoxL( EGSSettIdBacklight );
       
  1171 //        UpdateListBoxL( EGSSettIdPowerSaveLed );
       
  1172         UpdateListBoxL( EGSSettIdOperatorLogo );
       
  1173         }
       
  1174     }
       
  1175 
       
  1176 #ifdef FF_POWER_SAVE
       
  1177 // ----------------------------------------------------------------------------------
       
  1178 // CGSDisplayPlugin::DisplayBlockNoteL()
       
  1179 // ----------------------------------------------------------------------------------
       
  1180 void CGSDisplayPlugin::DisplayBlockNoteL()
       
  1181     {
       
  1182     HBufC* prompt = iCoeEnv->AllocReadResourceLC(
       
  1183             R_GS_POWER_SAVING_PROTECTED_SETTINGS_INFONOTE );
       
  1184     CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue );
       
  1185     note->ExecuteLD( *prompt );
       
  1186     CleanupStack::PopAndDestroy( prompt );
       
  1187     }
       
  1188 #endif // FF_POWER_SAVE
       
  1189 
       
  1190 
       
  1191 // -----------------------------------------------------------------------------
       
  1192 // CGSDisplayPlugin::CreateIconL()
       
  1193 //
       
  1194 //
       
  1195 // -----------------------------------------------------------------------------
       
  1196 //
       
  1197 CGulIcon* CGSDisplayPlugin::CreateIconL( const TUid aIconType )
       
  1198     {
       
  1199     //EMbm<Mbm_file_name><Bitmap_name>
       
  1200     CGulIcon* icon;
       
  1201 
       
  1202     if( aIconType == KGSIconTypeLbxItem )
       
  1203         {
       
  1204         icon = AknsUtils::CreateGulIconL(
       
  1205         AknsUtils::SkinInstance(),
       
  1206         KAknsIIDQgnPropCpDevDisp,
       
  1207         KGSDefaultDisplayIconFileName,
       
  1208         EMbmGsdisplaypluginQgn_prop_cp_dev_disp,
       
  1209         EMbmGsdisplaypluginQgn_prop_cp_dev_disp_mask );
       
  1210         }
       
  1211        else
       
  1212         {
       
  1213         icon = CGSPluginInterface::CreateIconL( aIconType );
       
  1214         }
       
  1215 
       
  1216     return icon;
       
  1217     }
       
  1218     
       
  1219 
       
  1220 // -----------------------------------------------------------------------------
       
  1221 // CGSDisplayPlugin::ChangeOperatorLogoSettingL()
       
  1222 //
       
  1223 //
       
  1224 // -----------------------------------------------------------------------------
       
  1225 //
       
  1226 void CGSDisplayPlugin::ChangeOperatorLogoSettingL( TBool aUseSettingPage )
       
  1227     {
       
  1228     TInt currentValue = iModel->OperatorLogoL();
       
  1229     TBool isValueUpdated = EFalse;
       
  1230 
       
  1231     if ( aUseSettingPage )
       
  1232         {
       
  1233         isValueUpdated = ShowOperatorLogoSettingPageL( currentValue );
       
  1234         }
       
  1235     else
       
  1236         {
       
  1237         if( currentValue == KGSSettingOff )
       
  1238             {
       
  1239             currentValue = KGSSettingOn;
       
  1240             }
       
  1241         else
       
  1242             {
       
  1243             currentValue = KGSSettingOff;
       
  1244             }
       
  1245         isValueUpdated = ETrue;
       
  1246         }
       
  1247     // Value has been changed -> store it:
       
  1248     if ( isValueUpdated )
       
  1249         {
       
  1250         iModel->SetOperatorLogoL( currentValue );
       
  1251 
       
  1252         UpdateListBoxL( EGSSettIdOperatorLogo );
       
  1253         }
       
  1254     }
       
  1255 
       
  1256 
       
  1257 // -----------------------------------------------------------------------------
       
  1258 // CGSDisplayPlugin::ShowOperatorLogoSettingPageL()
       
  1259 //
       
  1260 // Note: Lbx index of each value is only internal to this function. The
       
  1261 // parameter given and modified is the actual operator logo value.
       
  1262 // -----------------------------------------------------------------------------
       
  1263 //
       
  1264 TBool CGSDisplayPlugin::ShowOperatorLogoSettingPageL(
       
  1265     TInt& aOperatorLogoValue )
       
  1266     {
       
  1267     TBool isValueUpdated = EFalse;
       
  1268     TInt previousValue = aOperatorLogoValue;
       
  1269     TInt selectedIndex;
       
  1270 
       
  1271     // Match aOperatorLogoValue value to lbx item index:
       
  1272     switch( aOperatorLogoValue )
       
  1273         {
       
  1274         case KGSSettingOn:
       
  1275             selectedIndex = KGSOpLogoLbxIndexOn;
       
  1276             break;
       
  1277         case KGSSettingOff:
       
  1278             selectedIndex = KGSOpLogoLbxIndexOff;
       
  1279             break;
       
  1280         }
       
  1281 
       
  1282     CDesCArrayFlat* items =
       
  1283         iCoeEnv->ReadDesC16ArrayResourceL( R_OPLOGO_ON_OFF_SETTING_PAGE_LBX );
       
  1284     CleanupStack::PushL( items );
       
  1285 
       
  1286     if ( !iOprtLogoSettingPage )
       
  1287     	{
       
  1288     	iOprtLogoSettingPage = new (ELeave) CAknRadioButtonSettingPage(
       
  1289             R_OPERATOR_LOGO_SETTING_PAGE,
       
  1290             selectedIndex,
       
  1291             items );
       
  1292     	}
       
  1293 
       
  1294     TBool ret = iOprtLogoSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
  1295     iOprtLogoSettingPage = NULL;
       
  1296     CleanupStack::PopAndDestroy( items );
       
  1297 
       
  1298      // Match selected lbx item index to aOperatorLogoValue:
       
  1299     switch( selectedIndex )
       
  1300         {
       
  1301         case KGSOpLogoLbxIndexOn:
       
  1302             aOperatorLogoValue = KGSSettingOn;
       
  1303             break;
       
  1304         case KGSOpLogoLbxIndexOff:
       
  1305             aOperatorLogoValue = KGSSettingOff;
       
  1306             break;
       
  1307         }
       
  1308 
       
  1309     if( aOperatorLogoValue != previousValue )
       
  1310         {
       
  1311         isValueUpdated = ETrue;
       
  1312         }
       
  1313     return isValueUpdated;
       
  1314     }
       
  1315 
       
  1316 // -----------------------------------------------------------------------------
       
  1317 // CGSDisplayPlugin::CloseDialog
       
  1318 //
       
  1319 //
       
  1320 // -----------------------------------------------------------------------------
       
  1321 //
       
  1322 void CGSDisplayPlugin::CloseDialog()
       
  1323     {
       
  1324     //Send ESC key sequence to setting dialog, so that it closes itself.
       
  1325     if ( iOprtLogoSettingPage )
       
  1326         {
       
  1327         iReshowOprtSetPage = ETrue;
       
  1328         TKeyEvent event;
       
  1329         event.iCode = EKeyEscape;
       
  1330         event.iScanCode = EStdKeyEscape;
       
  1331         event.iRepeats = 0;
       
  1332         TRAP_IGNORE( iCoeEnv->SimulateKeyEventL( event, EEventKeyDown );
       
  1333                      iCoeEnv->SimulateKeyEventL( event, EEventKey );
       
  1334                      iCoeEnv->SimulateKeyEventL( event, EEventKeyUp ); );
       
  1335         }
       
  1336     }
       
  1337 // End of File
       
  1338 
       
  1339