gssettingsuis/Gs/GSDisplayPlugin/Src/GSDisplayPluginContainer.cpp
changeset 18 e3554c9069b6
parent 4 3f8368f032cf
child 19 30540fccecae
equal deleted inserted replaced
4:3f8368f032cf 18:e3554c9069b6
     1 /*
       
     2 * Copyright (c) 2005 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:  Container for the Display sub-folder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "GSDisplayPluginContainer.h"
       
    22 #include "GSDisplayPluginModel.h"
       
    23 #include "GsDisplayPlugin.hrh"
       
    24 #include "GSDisplayPlugin.h"
       
    25 
       
    26 #include <bldvariant.hrh>
       
    27 #include <aknlists.h>
       
    28 #include <eikfrlb.h>
       
    29 #include <aknslider.h>
       
    30 #include <gulicon.h>
       
    31 #include <StringLoader.h>
       
    32 #include <featmgr.h>
       
    33 #include <AknUtils.h>
       
    34 #include <csxhelp/cp.hlp.hrh>
       
    35 #include <gsfwviewuids.h>     // for KUidGS
       
    36 #include <GsDisplayPluginRsc.rsg>
       
    37 #include <gslistbox.h>
       
    38 #include <AknsConstants.h>    //for determining skin change
       
    39 #include <AknDef.hrh>
       
    40 #include <AknIconArray.h>
       
    41 
       
    42 // EXTERNAL DATA STRUCTURES
       
    43 
       
    44 // EXTERNAL FUNCTION PROTOTYPES
       
    45 
       
    46 // CONSTANTS
       
    47 
       
    48 // MACROS
       
    49 
       
    50 // LOCAL CONSTANTS AND MACROS
       
    51 const   TInt    KGSBufSize128 = 128;
       
    52 const   TInt    KGSNumberOfIcons = 3;
       
    53 const   TInt    KGSContrastIndex = 0;
       
    54 const   TInt    KGSBrightnessIndex = 1;
       
    55 const   TInt    KGSAmbientLightSensorIndex = 2;
       
    56 const   TInt    KGSSliderIndexMin = 0;
       
    57 const   TInt    KGSBrightnessMax = 31;
       
    58 const   TInt    KGSALSMax = 5;
       
    59 
       
    60 // MODULE DATA STRUCTURES
       
    61 // current ordering is based on the resource structure.
       
    62 enum TZoomLevel
       
    63     {
       
    64     EZoomLargeInUi,
       
    65     EZoomNormalInUi,
       
    66     EZoomSmallInUi
       
    67     };
       
    68 
       
    69 // LOCAL FUNCTION PROTOTYPES
       
    70 
       
    71 // FORWARD DECLARATIONS
       
    72 
       
    73 // ============================= LOCAL FUNCTIONS ==============================
       
    74 
       
    75 // ========================== MEMBER FUNCTIONS ================================
       
    76 
       
    77 // ---------------------------------------------------------------------------
       
    78 // CGSDisplayPluginContainer::ConstructL(const TRect& aRect)
       
    79 // Symbian OS two phased constructor
       
    80 //
       
    81 // ---------------------------------------------------------------------------
       
    82 //
       
    83 void CGSDisplayPluginContainer::ConstructL( const TRect& aRect )
       
    84     {
       
    85     iListBox = new ( ELeave ) CAknSettingStyleListBox;
       
    86     iModel = CGSDisplayPluginModel::NewL();
       
    87     iModel->SetOwner( this );
       
    88 
       
    89     BaseConstructL( aRect, R_GS_DISPLAY_VIEW_TITLE, R_DISPL_LBX );
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // CGSDisplayPluginContainer::~CGSDisplayPluginContainer()
       
    94 //
       
    95 // Destructor
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 CGSDisplayPluginContainer::~CGSDisplayPluginContainer()
       
    99     {
       
   100     if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   101         {
       
   102         delete iDispTxtSizeItems;
       
   103         }
       
   104 
       
   105     if ( iWelcomeItems )
       
   106         {
       
   107         delete iWelcomeItems;
       
   108         }
       
   109 
       
   110     if ( iLedItems )
       
   111         {
       
   112         delete iLedItems;
       
   113         }
       
   114     
       
   115     if ( iOperatorLogoItems)
       
   116         {
       
   117         delete iOperatorLogoItems;
       
   118         iOperatorLogoItems = NULL;
       
   119         }
       
   120 
       
   121     if ( iModel )
       
   122         {
       
   123         delete iModel;
       
   124         iModel = NULL;
       
   125         }
       
   126 
       
   127     if ( iListboxItemArray )
       
   128         {
       
   129         delete iListboxItemArray;
       
   130         }
       
   131     }
       
   132 
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // CGSDisplayPluginContainer::CGSDisplayPluginContainer()
       
   136 //
       
   137 // Constructor
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 CGSDisplayPluginContainer::CGSDisplayPluginContainer()
       
   141     {
       
   142     }
       
   143 
       
   144 // ---------------------------------------------------------------------------
       
   145 // CGSDisplayPluginContainer::ConstructListBoxL()
       
   146 // Destructor
       
   147 //
       
   148 // ---------------------------------------------------------------------------
       
   149 //
       
   150 void CGSDisplayPluginContainer::ConstructListBoxL( TInt aResLbxId )
       
   151     {
       
   152     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
   153     iListboxItemArray =
       
   154         CGSListBoxItemTextArray::NewL( aResLbxId, *iListBox, *iCoeEnv );
       
   155     iListBox->Model()->SetItemTextArray( iListboxItemArray );
       
   156     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   157 
       
   158 
       
   159     if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   160         {
       
   161         iDispTxtSizeItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   162                             R_DISPLAY_TEXT_SIZE_SETTING_PAGE_LBX );
       
   163         }
       
   164 
       
   165     iWelcomeItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   166                             R_WELCOME_NOTE_SETTING_PAGE_LBX );
       
   167     iLedItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   168                             R_POWER_SAVE_LED_SETTING_PAGE_LBX );
       
   169     iOperatorLogoItems = iCoeEnv->ReadDesC16ArrayResourceL(
       
   170                             R_OPLOGO_ON_OFF_SETTING_PAGE_LBX );
       
   171 
       
   172 
       
   173     CArrayPtr<CGulIcon>* icons =
       
   174             new( ELeave ) CAknIconArray( KGSNumberOfIcons );
       
   175     CleanupStack::PushL( icons );
       
   176 
       
   177     CGulIcon* icon = CGulIcon::NewL();
       
   178     CleanupStack::PushL( icon );
       
   179 
       
   180     CGulIcon* icon2 = CGulIcon::NewL();
       
   181     CleanupStack::PushL( icon2 );
       
   182 
       
   183     CGulIcon* icon3 = CGulIcon::NewL();
       
   184     CleanupStack::PushL( icon3 );
       
   185 
       
   186     icons->AppendL( icon );
       
   187     icons->AppendL( icon2 );
       
   188     icons->AppendL( icon3 );
       
   189 
       
   190     CEikFormattedCellListBox* listbox =
       
   191               static_cast<CEikFormattedCellListBox*>( iListBox );
       
   192     listbox->ItemDrawer()->FormattedCellData()->SetIconArray( icons );
       
   193     CleanupStack::Pop( 4, icons ); // icons, icon & icon2 & icon3
       
   194     iIconArray = listbox->ItemDrawer()->FormattedCellData()->IconArray();
       
   195 
       
   196     CreateListBoxItemsL();
       
   197     }
       
   198 
       
   199 // ---------------------------------------------------------------------------
       
   200 // CGSDisplayPluginContainer::CreateListBoxItemsL()
       
   201 //
       
   202 //
       
   203 // ---------------------------------------------------------------------------
       
   204 //
       
   205 void CGSDisplayPluginContainer::CreateListBoxItemsL()
       
   206     {
       
   207     if( iModel->ContrastL() != KErrNotSupported )
       
   208         {
       
   209         MakeContrastItemL();
       
   210         }
       
   211 
       
   212     TInt pslnStatus = iModel->BackgroundImage()->GetPlnsStatus();
       
   213 
       
   214     if ( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl) )
       
   215         {
       
   216         MakeBrightnessItemL();
       
   217         }
       
   218 
       
   219     if( iModel->CheckScreenSaverTimeoutSupportL() )
       
   220         {
       
   221         MakeSSPItemL();
       
   222         }
       
   223 
       
   224     MakeBacklightItemL();
       
   225 
       
   226     if ( FeatureManager::FeatureSupported( KFeatureIdAmbientLightSensor ) )
       
   227         {
       
   228         MakeAmbientLightSensorItemL();
       
   229         }
       
   230 
       
   231     if( iModel->IsUWNoteSupportedL() )
       
   232         {
       
   233         MakeWNIItemL();
       
   234         }
       
   235 
       
   236     if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   237         {
       
   238         MakeDisplayTextSizeItemL();
       
   239         }
       
   240 
       
   241     if ( iModel->CheckPowerSaveLedSupportL() )
       
   242         {
       
   243         MakePowerSaveLedItemL();
       
   244         }
       
   245     
       
   246     if ( iModel->ShowOperatorLogoSettingL() )
       
   247         {
       
   248         // Make item to show operator logo
       
   249         MakeOperatorLogoItemL();
       
   250         }
       
   251     }
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // CGSDisplayPluginContainer::UpdateListBoxL(TInt aItemId)
       
   255 //
       
   256 //
       
   257 // ---------------------------------------------------------------------------
       
   258 //
       
   259 void CGSDisplayPluginContainer::UpdateListBoxL( TInt aFeatureId )
       
   260     {
       
   261     switch ( aFeatureId )
       
   262         {
       
   263         case EGSSettIdContrast:
       
   264             if( iModel->ContrastL() != KErrNotSupported )
       
   265                 {
       
   266                 MakeContrastItemL();
       
   267                 }
       
   268             break;
       
   269         case EGSSettIdBrightness:
       
   270             if ( FeatureManager::FeatureSupported(
       
   271                              KFeatureIdBrightnessControl ) )
       
   272                 {
       
   273                 MakeBrightnessItemL();
       
   274                 }
       
   275             break;
       
   276         case EGSSettIdSSP:
       
   277             if( iModel->CheckScreenSaverTimeoutSupportL() )
       
   278                 {
       
   279                 MakeSSPItemL();
       
   280                 }
       
   281             break;
       
   282         case EGSSettIdBacklight:
       
   283             MakeBacklightItemL();
       
   284             break;
       
   285         case EGSSettIdAmbientLightSensor:
       
   286             if ( FeatureManager::FeatureSupported(
       
   287                               KFeatureIdAmbientLightSensor ) )
       
   288                 {
       
   289                 MakeAmbientLightSensorItemL();
       
   290                 }
       
   291             break;
       
   292         case EGSSettIdWNI:
       
   293             if( iModel->IsUWNoteSupportedL() )
       
   294                 {
       
   295                 MakeWNIItemL();
       
   296                 }
       
   297             break;
       
   298         case EGSSettIdDisplayTextSize:
       
   299             if ( FeatureManager::FeatureSupported ( KFeatureIdUiZoom ) )
       
   300                 {
       
   301                 MakeDisplayTextSizeItemL();
       
   302                 }
       
   303             break;
       
   304         case EGSSettIdPowerSaveLed:
       
   305             if ( iModel->CheckPowerSaveLedSupportL() )
       
   306                 {
       
   307                 MakePowerSaveLedItemL();
       
   308                 }
       
   309             break;
       
   310         case EGSSettIdOperatorLogo:
       
   311             if ( iModel->ShowOperatorLogoSettingL() )
       
   312                 {
       
   313                 // Update operator logo settings
       
   314                 MakeOperatorLogoItemL();
       
   315                 }
       
   316         default:
       
   317             break;
       
   318         }
       
   319 
       
   320     iListBox->HandleItemAdditionL();
       
   321     }
       
   322 
       
   323 // ---------------------------------------------------------------------------
       
   324 // CGSDisplayPluginContainer::MakeContrastItemL()
       
   325 //
       
   326 //
       
   327 // ---------------------------------------------------------------------------
       
   328 //
       
   329 void CGSDisplayPluginContainer::MakeContrastItemL()
       
   330     {
       
   331     TInt currentPos = iModel->ContrastL();
       
   332 
       
   333     CreateBitmapL( currentPos, R_CONTRAST_SLIDER, KGSContrastIndex );
       
   334 
       
   335     // And add to listbox
       
   336     iListboxItemArray->SetItemVisibilityL( EGSSettIdContrast,
       
   337         CGSListBoxItemTextArray::EVisible );
       
   338     }
       
   339 
       
   340 
       
   341 // ---------------------------------------------------------------------------
       
   342 // CGSDisplayPluginContainer::MakeBrightnessItemL()
       
   343 //
       
   344 //
       
   345 // ---------------------------------------------------------------------------
       
   346 //
       
   347 void CGSDisplayPluginContainer::MakeBrightnessItemL()
       
   348     {
       
   349     TInt currentPos = iModel->BrightnessL();
       
   350 
       
   351     if ( currentPos > KGSSliderIndexMin &&
       
   352          currentPos <= KGSBrightnessMax )
       
   353         {
       
   354         CreateBitmapL( currentPos, R_BRIGHTNESS_SLIDER, KGSBrightnessIndex );
       
   355 
       
   356         // And add to listbox
       
   357         iListboxItemArray->SetItemVisibilityL( EGSSettIdBrightness,
       
   358                            CGSListBoxItemTextArray::EVisible );
       
   359         }
       
   360     }
       
   361 
       
   362 
       
   363 // ---------------------------------------------------------------------------
       
   364 // CGSDisplayPluginContainer::MakeAmbientLightSensorItemL()
       
   365 //
       
   366 //
       
   367 // ---------------------------------------------------------------------------
       
   368 //
       
   369 void CGSDisplayPluginContainer::MakeAmbientLightSensorItemL()
       
   370     {
       
   371     TInt currentPos = iModel->AmbientLightSensorL();
       
   372 
       
   373     if ( currentPos > KGSSliderIndexMin &&
       
   374          currentPos <= KGSALSMax )
       
   375         {
       
   376         CreateBitmapL( currentPos, R_AMBIENT_LIGHT_SENSOR_SLIDER,
       
   377                        KGSAmbientLightSensorIndex );
       
   378 
       
   379         // And add to listbox
       
   380         iListboxItemArray->SetItemVisibilityL( EGSSettIdAmbientLightSensor,
       
   381                            CGSListBoxItemTextArray::EVisible );
       
   382 
       
   383         }
       
   384     }
       
   385 
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // CGSDisplayPluginContainer::MakeSSPItemL()
       
   389 //
       
   390 //
       
   391 // ---------------------------------------------------------------------------
       
   392 //
       
   393 void CGSDisplayPluginContainer::MakeSSPItemL()
       
   394     {
       
   395     TInt timeOut = iModel->ScreenSaverPeriodL();
       
   396     HBufC* dynamicText = CAknSlider::CreateValueTextInHBufCL( timeOut,
       
   397                                      R_SETTING_SCREEN_SAVER_SLIDER );
       
   398 
       
   399     // for A&H number conversion
       
   400     TPtr bufPtr = dynamicText->Des();
       
   401     if( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
       
   402         {
       
   403         AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
       
   404         }
       
   405 
       
   406     // Finally, set the dynamic text
       
   407     iListboxItemArray->SetDynamicTextL( EGSSettIdSSP, dynamicText->Des() );
       
   408 
       
   409     // And add to listbox
       
   410     iListboxItemArray->SetItemVisibilityL( EGSSettIdSSP,
       
   411                        CGSListBoxItemTextArray::EVisible );
       
   412 
       
   413     delete dynamicText;
       
   414     }
       
   415 
       
   416 
       
   417 // ---------------------------------------------------------------------------
       
   418 // CGSDisplayPluginContainer::MakeBackLightItemL()
       
   419 //
       
   420 // Backlight timeout item
       
   421 // ---------------------------------------------------------------------------
       
   422 //
       
   423 void CGSDisplayPluginContainer::MakeBacklightItemL()
       
   424     {
       
   425     TInt timeOut = iModel->BacklightPeriodL();
       
   426     HBufC* dynamicText = CAknSlider::CreateValueTextInHBufCL( timeOut,
       
   427                                      R_SETTING_BACKLIGHT_SLIDER );
       
   428 
       
   429     // for A&H number conversion
       
   430     TPtr bufPtr = dynamicText->Des();
       
   431     if( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
       
   432         {
       
   433         AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
       
   434         }
       
   435 
       
   436     // Finally, set the dynamic text
       
   437     iListboxItemArray->SetDynamicTextL( EGSSettIdBacklight,
       
   438                                         dynamicText->Des() );
       
   439 
       
   440     // And add to listbox
       
   441     iListboxItemArray->SetItemVisibilityL( EGSSettIdBacklight,
       
   442                        CGSListBoxItemTextArray::EVisible );
       
   443 
       
   444     delete dynamicText;
       
   445     }
       
   446 
       
   447 
       
   448 // ---------------------------------------------------------------------------
       
   449 // CGSDisplayPluginContainer::MakeDisplayTextSizeItemL()
       
   450 //
       
   451 // Display text size item
       
   452 // ---------------------------------------------------------------------------
       
   453 //
       
   454 void CGSDisplayPluginContainer::MakeDisplayTextSizeItemL()
       
   455     {
       
   456     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   457     TPtr ptrBuffer ( dynamicText->Des() );
       
   458 
       
   459     TInt textSize = iModel->DisplayTextSizeL();
       
   460     // value is changed through the below method
       
   461     MapZoomLevelToUi( textSize );
       
   462 
       
   463     ptrBuffer = ( *iDispTxtSizeItems )[ textSize ];
       
   464 
       
   465     // Finally, set the dynamic text
       
   466     iListboxItemArray->SetDynamicTextL( EGSSettIdDisplayTextSize, ptrBuffer );
       
   467     CleanupStack::PopAndDestroy( dynamicText );
       
   468 
       
   469     // And add to listbox
       
   470     iListboxItemArray->SetItemVisibilityL( EGSSettIdDisplayTextSize,
       
   471                        CGSListBoxItemTextArray::EVisible );
       
   472     }
       
   473 
       
   474 
       
   475 // ---------------------------------------------------------------------------
       
   476 // CGSDisplayPluginContainer::MakeWNIItemL()
       
   477 //
       
   478 // Welcome note item
       
   479 // ---------------------------------------------------------------------------
       
   480 //
       
   481 void CGSDisplayPluginContainer::MakeWNIItemL()
       
   482     {
       
   483     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   484     TPtr ptrBuffer ( dynamicText->Des() );
       
   485 
       
   486     const TInt welcomeNoteTypeIndex = iModel->WelcomeNoteTypeL();
       
   487     ptrBuffer = ( *iWelcomeItems )[ welcomeNoteTypeIndex ];
       
   488 
       
   489     // Finally, set the dynamic text
       
   490     iListboxItemArray->SetDynamicTextL( EGSSettIdWNI, ptrBuffer );
       
   491     CleanupStack::PopAndDestroy( dynamicText );
       
   492 
       
   493     // And add to listbox
       
   494     iListboxItemArray->SetItemVisibilityL( EGSSettIdWNI,
       
   495                        CGSListBoxItemTextArray::EVisible );
       
   496     }
       
   497 
       
   498 
       
   499 // ---------------------------------------------------------------------------
       
   500 // CGSDisplayPluginContainer::MakePowerSaveLedItemL()
       
   501 //
       
   502 //
       
   503 // ---------------------------------------------------------------------------
       
   504 //
       
   505 void CGSDisplayPluginContainer::MakePowerSaveLedItemL()
       
   506     {
       
   507 
       
   508     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   509     TPtr ptrBuffer ( dynamicText->Des() );
       
   510 
       
   511     TInt objectSel = iModel->PowerSaveLedL();
       
   512     ptrBuffer = ( *iLedItems )[ objectSel ];
       
   513 
       
   514     // Finally, set the dynamic text
       
   515     iListboxItemArray->SetDynamicTextL( EGSSettIdPowerSaveLed, ptrBuffer );
       
   516     CleanupStack::PopAndDestroy( dynamicText );
       
   517 
       
   518     // And add to listbox
       
   519     iListboxItemArray->SetItemVisibilityL( EGSSettIdPowerSaveLed,
       
   520         CGSListBoxItemTextArray::EVisible );
       
   521     }
       
   522 
       
   523 
       
   524 // ---------------------------------------------------------------------------
       
   525 // CGSDisplayPluginContainer::MakeOperatorLogoItemL()
       
   526 //
       
   527 //
       
   528 // ---------------------------------------------------------------------------
       
   529 //
       
   530 void CGSDisplayPluginContainer::MakeOperatorLogoItemL()
       
   531     {
       
   532     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   533     TPtr ptrBuffer ( dynamicText->Des() );
       
   534     
       
   535     TInt selectedItem = iModel->OperatorLogoL();
       
   536     ptrBuffer = ( *iOperatorLogoItems )[ 1 - selectedItem ];
       
   537     
       
   538     iListboxItemArray->SetDynamicTextL( EGSSettIdOperatorLogo, ptrBuffer );
       
   539     CleanupStack::PopAndDestroy( dynamicText );
       
   540 
       
   541     iListboxItemArray->SetItemVisibilityL( EGSSettIdOperatorLogo, 
       
   542             CGSListBoxItemTextArray::EVisible );
       
   543     }
       
   544 
       
   545 // ---------------------------------------------------------------------------
       
   546 // CGSDisplayPluginContainer::CreateBitmapL()
       
   547 //
       
   548 //
       
   549 // ---------------------------------------------------------------------------
       
   550 //
       
   551 void CGSDisplayPluginContainer::CreateBitmapL( TInt aValue, TInt aResourceId,
       
   552                                                TInt aIndex )
       
   553     {
       
   554     CGulIcon* icon =
       
   555             CAknSlider::CreateSetStyleListBoxIconL( aValue, aResourceId );
       
   556 
       
   557     if( icon )
       
   558         {
       
   559         delete iIconArray->At( aIndex );
       
   560         iIconArray->At( aIndex ) = icon;
       
   561         }
       
   562     }
       
   563 
       
   564 // ---------------------------------------------------------------------------
       
   565 // CGSDisplayPluginContainer::CurrentFeatureId()
       
   566 //
       
   567 // ---------------------------------------------------------------------------
       
   568 //
       
   569 TInt CGSDisplayPluginContainer::CurrentFeatureId( ) const
       
   570     {
       
   571     return iListboxItemArray->CurrentFeature( );
       
   572     }
       
   573 
       
   574 
       
   575 // ---------------------------------------------------------------------------
       
   576 // CGSDisplayPluginContainer::GetHelpContext() const
       
   577 // Gets Help
       
   578 //
       
   579 // ---------------------------------------------------------------------------
       
   580 //
       
   581 void CGSDisplayPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   582     {
       
   583     aContext.iMajor = KUidGS;
       
   584     aContext.iContext = KCP_HLP_DISPLAY;
       
   585     }
       
   586 
       
   587 // ---------------------------------------------------------------------------
       
   588 // CGSDisplayPluginContainer::HandleResourceChange()
       
   589 //
       
   590 // Handling changing of the skin
       
   591 // ---------------------------------------------------------------------------
       
   592 //
       
   593 void CGSDisplayPluginContainer::HandleResourceChange( TInt aType )
       
   594     {
       
   595     CCoeControl::HandleResourceChange( aType );
       
   596     if ( aType == KAknsMessageSkinChange ||
       
   597          aType == KEikDynamicLayoutVariantSwitch )
       
   598         {
       
   599         TRAP_IGNORE 
       
   600             (
       
   601             if( iModel->ContrastL() != KErrNotSupported )
       
   602                 {
       
   603                 MakeContrastItemL();
       
   604                 }
       
   605             );
       
   606 
       
   607         if ( FeatureManager::FeatureSupported( KFeatureIdBrightnessControl) )
       
   608             {
       
   609             TRAP_IGNORE( MakeBrightnessItemL() );
       
   610             }
       
   611 
       
   612         if ( FeatureManager::FeatureSupported( KFeatureIdAmbientLightSensor ) )
       
   613             {
       
   614             TRAP_IGNORE( MakeAmbientLightSensorItemL() );
       
   615             }
       
   616         }
       
   617     if ( aType == KEikDynamicLayoutVariantSwitch )
       
   618         {
       
   619         TRect mainPaneRect;
       
   620         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane,
       
   621                                            mainPaneRect);
       
   622         SetRect( mainPaneRect );
       
   623         }
       
   624     }
       
   625 
       
   626 // ---------------------------------------------------------------------------
       
   627 // CGSDisplayPluginContainer::MapZoomLevelToUi()
       
   628 //
       
   629 // Converts the value from Model's Avkon to setting page item index
       
   630 // ---------------------------------------------------------------------------
       
   631 //
       
   632 void CGSDisplayPluginContainer::MapZoomLevelToUi( TInt& aCurrentZoom )
       
   633     {
       
   634     TInt textSize = EZoomNormalInUi;
       
   635 
       
   636     switch( aCurrentZoom )
       
   637         {
       
   638         case EAknUiZoomSmall:
       
   639             textSize = EZoomSmallInUi;
       
   640             break;
       
   641         case EAknUiZoomLarge:
       
   642             textSize = EZoomLargeInUi;
       
   643             break;
       
   644         case EAknUiZoomNormal:
       
   645         default:
       
   646             textSize = EZoomNormalInUi;
       
   647             break;
       
   648         }
       
   649 
       
   650     aCurrentZoom = textSize;
       
   651     }
       
   652 
       
   653 
       
   654 // ---------------------------------------------------------------------------
       
   655 // CGSDisplayPluginContainer::MapZoomLevelFromUi()
       
   656 //
       
   657 // Converts the value from setting page item index to Model's Avkon value
       
   658 // ---------------------------------------------------------------------------
       
   659 //
       
   660 void CGSDisplayPluginContainer::MapZoomLevelFromUi ( TInt& aCurrentZoom )
       
   661     {
       
   662     TInt textSize = 0;
       
   663 
       
   664     switch( aCurrentZoom )
       
   665         {
       
   666         case EZoomSmallInUi:
       
   667             textSize = EAknUiZoomSmall;
       
   668             break;
       
   669         case EZoomLargeInUi:
       
   670             textSize = EAknUiZoomLarge;
       
   671             break;
       
   672         case EZoomNormalInUi:
       
   673         default:
       
   674             textSize = EAknUiZoomNormal;
       
   675             break;
       
   676         }
       
   677 
       
   678     aCurrentZoom = textSize;
       
   679     }
       
   680 
       
   681 // ---------------------------------------------------------------------------
       
   682 // CGSDisplayPluginContainer::Model()
       
   683 //
       
   684 // Return its member variable iModel.
       
   685 // ---------------------------------------------------------------------------
       
   686 //
       
   687 CGSDisplayPluginModel* CGSDisplayPluginContainer::Model()
       
   688     {
       
   689     return iModel;
       
   690     }
       
   691 
       
   692 void CGSDisplayPluginContainer::CloseDialog()
       
   693 	{
       
   694 	CAknViewAppUi* appUi = static_cast<CAknViewAppUi*>( CCoeEnv::Static()->AppUi() );
       
   695 	CGSDisplayPlugin* view = static_cast<CGSDisplayPlugin*>( appUi->View(KGSDisplayPluginUid) );
       
   696 	view->CloseDialog();
       
   697 	}
       
   698 
       
   699 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   700 
       
   701 // End of File