psln/Src/PslnGeneralThemeView.cpp
changeset 0 2f259fa3e83a
child 18 0aa5fbdfbc30
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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:  General theme view.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 // General - services
       
    23 #include <StringLoader.h>
       
    24 #include <AknGlobalNote.h>
       
    25 #include <aknnotewrappers.h>
       
    26 #include <akntitle.h>
       
    27 #include <barsread.h>
       
    28 #include <eikbtgpc.h>
       
    29 #include <eikmenup.h>
       
    30 
       
    31 // Feature manager.
       
    32 #include <featmgr.h>
       
    33 #include <features.hrh>
       
    34 
       
    35 // Power save mode setting
       
    36 #include <psmsettings.h>
       
    37 
       
    38 // Resources
       
    39 #include <psln.rsg>
       
    40 #include <pslncommon.rsg>
       
    41 #include <data_caging_path_literals.hrh>
       
    42 
       
    43 // Psln specific.
       
    44 #include "PslnGeneralThemeView.h"
       
    45 #include "PslnConst.h"
       
    46 #include "PslnUi.h"
       
    47 #include "PslnModel.h"
       
    48 #include "PslnFeatures.h"
       
    49 #include "PslnDebug.h"
       
    50 
       
    51 
       
    52 // Path to common personalization resources. This resource file is meant for
       
    53 // shared resources between application and plugins.
       
    54 _LIT( KPslnCommonResourceFileName, "z:pslncommon.rsc" );
       
    55 
       
    56 // ============================ MEMBER FUNCTIONS ===============================
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // C++ constructor can NOT contain any code, that might leave.
       
    60 // -----------------------------------------------------------------------------
       
    61 //
       
    62 CPslnGeneralThemeView::CPslnGeneralThemeView()
       
    63     : iResourceLoaderCommon( *iCoeEnv )
       
    64     {
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // Symbian 2nd phase constructor can leave.
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void CPslnGeneralThemeView::ConstructL()
       
    72     {
       
    73     BaseConstructL( R_PSLN_GENERAL_VIEW );
       
    74 
       
    75     iNaviPaneContext = iPslnUi->PslnTabGroup();
       
    76 
       
    77     // Find the common resource file:
       
    78     TParse* parse = new (ELeave) TParse;
       
    79     CleanupStack::PushL( parse );
       
    80     parse->Set( KPslnCommonResourceFileName, &KDC_APP_RESOURCE_DIR, NULL );
       
    81     TFileName* fileName = new (ELeave) TFileName( parse->FullName() );
       
    82     CleanupStack::PushL( fileName );
       
    83 
       
    84     // Open resource file:
       
    85     iResourceLoaderCommon.OpenL( *fileName );
       
    86 
       
    87     CleanupStack::PopAndDestroy( 2, parse ); // fileName, parse
       
    88 
       
    89     // Normally download item is the first one.
       
    90     iDownloadItemIndex = 0;
       
    91 
       
    92     // If enchanted embedded links are not supported, then there shouldn't be
       
    93     // 'Download' item at all.
       
    94     if ( !PslnFeatures::IsEnhancedEmbeddedLinksSupported() )
       
    95         {
       
    96         iDownloadItemIndex = KErrNotFound;
       
    97         }
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // Two-phased constructor.
       
   102 // -----------------------------------------------------------------------------
       
   103 //
       
   104 CPslnGeneralThemeView* CPslnGeneralThemeView::NewLC()
       
   105     {
       
   106     CPslnGeneralThemeView* self = new (ELeave) CPslnGeneralThemeView();
       
   107     CleanupStack::PushL( self );
       
   108     self->ConstructL();
       
   109     return self;
       
   110     }
       
   111 
       
   112 // Destructor
       
   113 CPslnGeneralThemeView::~CPslnGeneralThemeView()
       
   114     {
       
   115     iResourceLoaderCommon.Close();
       
   116     }
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // CPslnGeneralThemeView::Id
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 TUid CPslnGeneralThemeView::Id() const
       
   123     {
       
   124     return KPslnGeneralView;
       
   125     }
       
   126 
       
   127 // -----------------------------------------------------------------------------
       
   128 // CPslnGeneralThemeView::HandleCommandL
       
   129 // -----------------------------------------------------------------------------
       
   130 //
       
   131 void CPslnGeneralThemeView::HandleCommandL( TInt aCommand )
       
   132     {
       
   133     // First set active item and active skin.
       
   134     if ( iContainer )
       
   135         {
       
   136         iCurrentItem = iContainer->CurrentItemIndex();
       
   137         }
       
   138     TInt activeSkinIndex = iCurrentItem;
       
   139     if ( iDownloadItemIndex != KErrNotFound )
       
   140         {
       
   141         activeSkinIndex--;
       
   142         }
       
   143     switch ( aCommand )
       
   144         {
       
   145         case EPslnCmdTransitionEffectsActivate:
       
   146             {
       
   147             TInt PsmMode = 0;
       
   148             CPsmSettings *PsmSettings = CPsmSettings::NewL();
       
   149             PsmSettings->GetCurrentMode( PsmMode );
       
   150             delete PsmSettings;
       
   151 
       
   152             if ( PsmMode == EPsmsrvModePowerSave ) // PSM on, setting is protected
       
   153                 {
       
   154                 HBufC* buf = StringLoader::LoadLC( R_PSLN_QTN_PSM_INFONOTE );
       
   155                 CAknInformationNote* note = new (ELeave) CAknInformationNote( ETrue );
       
   156                 note->ExecuteLD( *buf );
       
   157                 CleanupStack::PopAndDestroy( buf );
       
   158                 return;
       
   159                 }
       
   160 
       
   161             TInt error = iModel->SetTransitionEffectsL( EPslnEnableAllEffects );
       
   162             
       
   163             if ( error == KErrNone )
       
   164                 {            
       
   165                 if ( PslnFeatures::IsSupported( KPslnSupportAnimBackground ) &&
       
   166                      iModel->IsSupportAnimBg(  iModel->ActiveSkinIndex() ) )
       
   167                     {
       
   168                     error = iModel->SetAnimBackground( EPslnEnableAllEffects );
       
   169                     }            
       
   170                 }
       
   171             
       
   172             if ( error == KErrNoMemory )
       
   173                 {
       
   174                 HBufC* errorBuf = StringLoader::LoadLC(
       
   175                     R_PSLN_NOT_ENOUGH_MEMORY );
       
   176                 // Display global note.
       
   177                 CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
       
   178                 errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
       
   179                 CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
       
   180                 }
       
   181             else
       
   182                 {
       
   183                 User::LeaveIfError( error );
       
   184                 }
       
   185             }
       
   186             break;
       
   187         case EPslnCmdTransitionEffectsDeactivate:
       
   188             iModel->SetTransitionEffectsL( EPslnDisableAllEffects );
       
   189             //Deactive AnimBackground
       
   190             iModel->SetAnimBackground( EPslnDisableAllEffects );
       
   191             break;
       
   192         
       
   193         case EPslnCmdAnimBackgroundActivate:
       
   194             {
       
   195             TInt error = iModel->SetAnimBackground( EPslnEnableAllEffects );
       
   196             if ( error == KErrNoMemory )
       
   197                 {
       
   198                 HBufC* errorBuf = StringLoader::LoadLC(
       
   199                         R_PSLN_NOT_ENOUGH_MEMORY );
       
   200 
       
   201                 CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
       
   202                 errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
       
   203                 CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
       
   204                 }
       
   205             }
       
   206             break;
       
   207         case EPslnCmdAnimBackgroundDeactivate:
       
   208             iModel->SetAnimBackground( EPslnDisableAllEffects );
       
   209             break;        
       
   210         case EPslnCmdEmptyCommand: // Fallthrough
       
   211         case EPslnCmdAppActivate: // Fallthrough
       
   212             {
       
   213             if ( iContainer )
       
   214                 {
       
   215                 if ( iPreviewMode )
       
   216                     {
       
   217                     //stop preview
       
   218                     iToBeActivatedSkinIndex = activeSkinIndex; 
       
   219                     static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   220                         LockUpAndDownKeys( ETrue );
       
   221                     static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   222                         CancelThemePreviewL();
       
   223                         
       
   224                     HandlePreviewStateChange( EFalse );
       
   225                     }
       
   226                     
       
   227                 if ( iToBeActivatedSkinIndex != KErrNotFound )
       
   228                     {
       
   229                     activeSkinIndex = iToBeActivatedSkinIndex;
       
   230                     iToBeActivatedSkinIndex = -1;
       
   231                     }
       
   232                 // Do nothing if active theme is selected.
       
   233                 if ( iModel->IsActiveSkinSelected( activeSkinIndex  ) )
       
   234                     {
       
   235                     HandlePreviewStateChange( ETrue );
       
   236                     static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   237                         StartThemePreviewL();
       
   238                     break;
       
   239                     }
       
   240                 // Check is the theme corrupted.
       
   241                 if ( !iModel->IsValidForActivation( activeSkinIndex ) )
       
   242                     {
       
   243                     HBufC* errorBuf = StringLoader::LoadLC(
       
   244                         R_PSLN_QTN_SKINS_ERROR_CORRUPTED );
       
   245                     // Display global note.
       
   246                     CAknGlobalNote* errorNote = CAknGlobalNote::NewLC();
       
   247                     errorNote->ShowNoteL( EAknGlobalErrorNote, *errorBuf );
       
   248                     CleanupStack::PopAndDestroy( 2, errorBuf ); // errorNote also
       
   249                     return;
       
   250                     }
       
   251                 else
       
   252                     {
       
   253                     iModel->SetCurrentSelectedSkinIndex( activeSkinIndex );
       
   254                     }
       
   255                 static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   256                     LockUpAndDownKeys( EFalse );
       
   257                 }
       
   258             }
       
   259         case EPslnCmdAppDownload: // Fallthrough
       
   260         default:
       
   261             iPslnUi->HandleCommandL( aCommand );
       
   262             break;
       
   263         }
       
   264     }
       
   265 
       
   266 // ---------------------------------------------------------------------------
       
   267 // CPslnGeneralThemeView::UpdateSkinListItemsL()
       
   268 // ---------------------------------------------------------------------------
       
   269 //
       
   270 void CPslnGeneralThemeView::UpdateSkinListItemsL( TInt aCurrentIndex )
       
   271     {
       
   272     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::UpdateSkinListItemsL");
       
   273     if ( iContainer )
       
   274         {
       
   275         if ( aCurrentIndex == KErrNotFound )
       
   276             {
       
   277             aCurrentIndex = iContainer->CurrentItemIndex();
       
   278             }
       
   279         static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   280             UpdateSkinListItemsL( aCurrentIndex );
       
   281         }
       
   282     CheckMiddleSoftkeyLabelL();
       
   283     }
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CPslnGeneralThemeView::DoActivateL
       
   287 // -----------------------------------------------------------------------------
       
   288 //
       
   289 void CPslnGeneralThemeView::DoActivateL(
       
   290             const TVwsViewId& aPrevViewId,
       
   291             TUid aCustomMessageId,
       
   292             const TDesC8& aCustomMessage )
       
   293     {
       
   294     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DoActivateL");
       
   295 
       
   296     CPslnBaseView::DoActivateL(
       
   297         aPrevViewId,
       
   298         aCustomMessageId,
       
   299         aCustomMessage );
       
   300 
       
   301     // If view is directly activated (not through main view), update
       
   302     // tab group (and main view's active folder). The static views
       
   303     // have same UID as their tab index.
       
   304     if ( aPrevViewId.iAppUid != KUidPsln )
       
   305         {
       
   306         iPslnUi->UpdateTabIndex(
       
   307             KPslnGeneralView.iUid,
       
   308             KPslnGeneralView.iUid );
       
   309         }
       
   310 
       
   311     // Update skin list.
       
   312     // Set active index and update container.
       
   313     TInt currentlySelected  = iModel->ActiveSkinIndex();
       
   314     iModel->SetCurrentSelectedSkinIndex( currentlySelected );
       
   315 
       
   316     CheckMiddleSoftkeyLabelL();
       
   317 
       
   318     iPslnUi->ToggleScreenBlankerL( EFalse, EFalse );
       
   319     iToBeActivatedSkinIndex = -1;
       
   320     }
       
   321 
       
   322 // -----------------------------------------------------------------------------
       
   323 // CPslnGeneralThemeView::DoDeactivate
       
   324 // -----------------------------------------------------------------------------
       
   325 //
       
   326 void CPslnGeneralThemeView::DoDeactivate()
       
   327     {
       
   328     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DoDeactivate");
       
   329     RemoveCommandFromMSK();
       
   330     CPslnBaseView::DoDeactivate();
       
   331     }
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CPslnGeneralThemeView::DynInitMenuPaneL
       
   335 //
       
   336 // -----------------------------------------------------------------------------
       
   337 //
       
   338 void CPslnGeneralThemeView::DynInitMenuPaneL(
       
   339     TInt aResourceId, CEikMenuPane* aMenuPane )
       
   340     {
       
   341     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DynInitMenuPaneL");
       
   342     if( aResourceId == R_PSLN_GEN_VIEW_MENUPANE )
       
   343         {
       
   344         if ( iContainer )
       
   345             {
       
   346             iCurrentItem = iContainer->CurrentItemIndex();
       
   347             }
       
   348 
       
   349         TBool downloadExists = ETrue;
       
   350         // Download theme is not selected, or it is not supported.
       
   351         if ( iDownloadItemIndex == KErrNotFound )
       
   352             {
       
   353             // Download item is not supported.
       
   354             aMenuPane->SetItemDimmed( EPslnCmdAppDownload, ETrue );
       
   355             downloadExists = EFalse;
       
   356             }
       
   357         else if ( iCurrentItem != iDownloadItemIndex )
       
   358             {
       
   359             // Download is supported, but is not selected.
       
   360             aMenuPane->SetItemDimmed( EPslnCmdAppDownload, ETrue );
       
   361             downloadExists = ETrue;
       
   362             }
       
   363         else
       
   364             {
       
   365             aMenuPane->SetItemDimmed( EPslnCmdAppActivate, ETrue );
       
   366             }
       
   367 
       
   368         // Update current item index in model.
       
   369         // Possibly reduce by one, since UI might show Download item.
       
   370         TInt skinIndex = iCurrentItem - (TInt) downloadExists;
       
   371         iModel->SetCurrentSelectedSkinIndex( skinIndex );
       
   372 
       
   373         if( iModel->IsActiveSkinSelected() ||
       
   374            !iModel->IsValidForActivation( skinIndex ) )
       
   375             {
       
   376             aMenuPane->SetItemDimmed( EPslnCmdAppActivate, ETrue );
       
   377             }
       
   378         }
       
   379     else if ( aResourceId == R_PSLN_TRANSITION_EFFECTS_MENU_PANE )
       
   380         {
       
   381         if ( ( iCurrentItem == iDownloadItemIndex &&
       
   382              iDownloadItemIndex != KErrNotFound ) ||
       
   383             !FeatureManager::FeatureSupported(KFeatureIdUiTransitionEffects) )
       
   384             {
       
   385             // Remove Transition Effects when Download is highlighted.
       
   386             aMenuPane->SetItemDimmed( EPslnCmdTransitionEffectsSubMenuOpen, ETrue );
       
   387             }
       
   388         }
       
   389     else if ( aResourceId == R_PSLN_TRANSITION_EFFECTS_CASCADE_MENU )
       
   390         {
       
   391         // Do nothing with cascade menu values, if Download is highlighted.
       
   392         if ( iCurrentItem != iDownloadItemIndex ||
       
   393              iDownloadItemIndex != KErrNotFound )
       
   394             {
       
   395             TInt transitionEffectsValue = iModel->GetTransitionEffectStateL();
       
   396             // Effects are enabled if value is NOT KMaxTInt.
       
   397             if( transitionEffectsValue != KMaxTInt )
       
   398                 {
       
   399                 aMenuPane->SetItemButtonState(
       
   400                     EPslnCmdTransitionEffectsActivate,
       
   401                     EEikMenuItemSymbolOn );
       
   402                 aMenuPane->SetItemButtonState(
       
   403                     EPslnCmdTransitionEffectsDeactivate,
       
   404                     EEikMenuItemSymbolIndeterminate );
       
   405                 }
       
   406             else
       
   407                 {
       
   408                 aMenuPane->SetItemButtonState(
       
   409                     EPslnCmdTransitionEffectsActivate,
       
   410                     EEikMenuItemSymbolIndeterminate );
       
   411                 aMenuPane->SetItemButtonState(
       
   412                     EPslnCmdTransitionEffectsDeactivate,
       
   413                     EEikMenuItemSymbolOn );
       
   414                 }
       
   415             }
       
   416         }
       
   417     else if ( aResourceId == R_PSLN_ANIM_BACKGROUND_MENU_PANE )
       
   418         {
       
   419         TBool downloadExists = ETrue;
       
   420         if ( iDownloadItemIndex == KErrNotFound )
       
   421             {
       
   422             downloadExists = EFalse;
       
   423             }
       
   424         TInt skinIndex = iCurrentItem - (TInt) downloadExists;
       
   425 		
       
   426         if ( ( iCurrentItem != iDownloadItemIndex &&
       
   427              iDownloadItemIndex != KErrNotFound )||
       
   428              !iModel->IsActiveSkinSelected() ||
       
   429              !PslnFeatures::IsSupported( KPslnSupportAnimBackground ) ||
       
   430              !iModel->IsSupportAnimBg(skinIndex))
       
   431             {
       
   432             aMenuPane->SetItemDimmed( EPslnCmdAnimBackgroundSubMenuOpen, ETrue );
       
   433             }
       
   434         }
       
   435     else if ( aResourceId == R_PSLN_ANIM_BACKGROUND_CASCADE_MENU )
       
   436         {
       
   437         // Do nothing with cascade menu values, if Download is highlighted.
       
   438         if ( iCurrentItem != iDownloadItemIndex ||
       
   439              iDownloadItemIndex != KErrNotFound )
       
   440             {
       
   441             TInt animEffectsValue = iModel->AnimBackgroundState();
       
   442             // Animation background are enabled if value is NOT KMaxTInt.
       
   443             if( animEffectsValue != KMaxTInt )
       
   444                 {
       
   445                 aMenuPane->SetItemButtonState(
       
   446                     EPslnCmdAnimBackgroundActivate,
       
   447                     EEikMenuItemSymbolOn );
       
   448                 aMenuPane->SetItemButtonState(
       
   449                     EPslnCmdAnimBackgroundDeactivate,
       
   450                     EEikMenuItemSymbolIndeterminate );
       
   451                 }
       
   452             else
       
   453                 {
       
   454                 aMenuPane->SetItemButtonState(
       
   455                     EPslnCmdAnimBackgroundActivate,
       
   456                     EEikMenuItemSymbolIndeterminate );
       
   457                 aMenuPane->SetItemButtonState(
       
   458                     EPslnCmdAnimBackgroundDeactivate,
       
   459                     EEikMenuItemSymbolOn );
       
   460                 }
       
   461             }
       
   462         }
       
   463     else
       
   464         {
       
   465         PSLN_TRACE_DEBUG("CPslnGeneralThemeView::DynInitMenuPaneL empty else");
       
   466         }
       
   467     CPslnBaseView::DynInitMenuPaneL( aResourceId, aMenuPane );
       
   468     }
       
   469 
       
   470 // -----------------------------------------------------------------------------
       
   471 // Handle listbox selection.
       
   472 //
       
   473 // -----------------------------------------------------------------------------
       
   474 //
       
   475 void CPslnGeneralThemeView::HandleListBoxSelectionL()
       
   476     {
       
   477     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::HandleListBoxSelectionL");
       
   478     if ( iContainer )
       
   479         {
       
   480         iCurrentItem = iContainer->CurrentItemIndex();
       
   481         }
       
   482 
       
   483     if ( iCurrentItem == iDownloadItemIndex )
       
   484         {
       
   485         HandleCommandL( EPslnCmdAppDownload );
       
   486         }
       
   487     else
       
   488         {
       
   489         HandleCommandL( EPslnCmdAppActivate );
       
   490         }
       
   491     }
       
   492 
       
   493 // -----------------------------------------------------------------------------
       
   494 // Handle listbox item highlight.
       
   495 //
       
   496 // -----------------------------------------------------------------------------
       
   497 //
       
   498 void CPslnGeneralThemeView::HandleListBoxItemHighlightL()
       
   499     {
       
   500     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::HandleListBoxItemHighlightL");
       
   501     if ( iContainer )
       
   502         {
       
   503         HandlePreviewStateChange( ETrue );
       
   504         static_cast<CPslnGeneralThemeContainer*>(iContainer)->StartThemePreviewL();
       
   505         }
       
   506     }
       
   507 
       
   508 // -----------------------------------------------------------------------------
       
   509 // Create container.
       
   510 //
       
   511 // -----------------------------------------------------------------------------
       
   512 //
       
   513 void CPslnGeneralThemeView::NewContainerL()
       
   514     {
       
   515     iContainer = new(ELeave) CPslnGeneralThemeContainer();
       
   516     iContainer->SetMiddleSoftkeyObserver( this );
       
   517     static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   518         SetThemePreviewObserver( this );
       
   519     }
       
   520 
       
   521 // -----------------------------------------------------------------------------
       
   522 // Sets view specific title pane text.
       
   523 //
       
   524 // -----------------------------------------------------------------------------
       
   525 //
       
   526 void CPslnGeneralThemeView::SetTitlePaneL( TInt& aResourceId )
       
   527     {
       
   528     aResourceId = R_PSLN_TITLE_PANE_GENERAL;
       
   529     }
       
   530 
       
   531 // -----------------------------------------------------------------------------
       
   532 // Checks is there a need to update the middle softkey label.
       
   533 // This method should do nothing but MSK issues, since it is still called
       
   534 // if the framework does not support MSK.
       
   535 // -----------------------------------------------------------------------------
       
   536 //
       
   537 void CPslnGeneralThemeView::CheckMiddleSoftkeyLabelL()
       
   538     {
       
   539     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::CheckMiddleSoftkeyLabelL");
       
   540     TInt currentItem = KErrNotFound;
       
   541     if ( iContainer )
       
   542         {
       
   543         currentItem = iContainer->CurrentItemIndex();
       
   544         }
       
   545 
       
   546     TInt activeSkinIndex = 0;
       
   547     if ( iModel )
       
   548         {
       
   549         activeSkinIndex = iModel->ActiveSkinIndex();
       
   550         }
       
   551     if ( iDownloadItemIndex != KErrNotFound )
       
   552         {
       
   553         // If download item is present, increment current index,
       
   554         // so that skin index maps directly to listbox indexes.
       
   555         activeSkinIndex++;
       
   556         }
       
   557 
       
   558     // First remove any prevous commands.
       
   559     RemoveCommandFromMSK();
       
   560     if ( currentItem == iDownloadItemIndex && currentItem != KErrNotFound )
       
   561         {
       
   562         // Set middle softkey as Download.
       
   563         CPslnBaseView::SetMiddleSoftKeyLabelL(
       
   564             R_PSLN_MSK_SELECT,
       
   565             EPslnCmdAppDownload );
       
   566         }
       
   567     else if ( currentItem != activeSkinIndex )
       
   568         {
       
   569         // Set middle softkey as Apply.
       
   570         CPslnBaseView::SetMiddleSoftKeyLabelL(
       
   571             R_PSLN_MSK_ACTIVATE,
       
   572             EPslnCmdAppActivate );
       
   573         }
       
   574     else
       
   575         {
       
   576         // Set middle softkey as dummy.
       
   577         CPslnBaseView::SetMiddleSoftKeyLabelL(
       
   578             R_PSLN_MSK_DUMMY,
       
   579             EPslnCmdEmptyCommand );
       
   580         }
       
   581     }
       
   582 
       
   583 // -----------------------------------------------------------------------------
       
   584 // Requests container to update skin data for D column.
       
   585 // -----------------------------------------------------------------------------
       
   586 //
       
   587 void CPslnGeneralThemeView::UpdateSkinListItemsDColumnOnlyL()
       
   588     {
       
   589     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::UpdateSkinListItemsL");
       
   590     if ( iContainer )
       
   591         {
       
   592         static_cast<CPslnGeneralThemeContainer*>(iContainer)->
       
   593             UpdateSkinListItemsDColumnOnlyL();
       
   594         }
       
   595     CheckMiddleSoftkeyLabelL();
       
   596     }
       
   597 
       
   598 // -----------------------------------------------------------------------------
       
   599 // New theme preview state available.
       
   600 // -----------------------------------------------------------------------------
       
   601 //
       
   602 void CPslnGeneralThemeView::HandlePreviewStateChange( const TBool& aPreviewMode )
       
   603     {
       
   604     iPreviewMode = aPreviewMode;
       
   605 //    TRAPD( state, iModel->GetTransitionEffectStateL() );
       
   606 //    if ( state != KMaxTInt )
       
   607 //        {        
       
   608 //        CAknView::StopDisplayingMenuBar();
       
   609 //        }
       
   610     if ( iDelayedSkinActivation && !iPreviewMode )
       
   611         {
       
   612         TRAP_IGNORE( HandleCommandL( EPslnCmdAppActivate ) );
       
   613         iDelayedSkinActivation = EFalse;
       
   614         }
       
   615     }
       
   616 
       
   617     
       
   618 // ---------------------------------------------------------------------------
       
   619 // Restart Quick Preview
       
   620 // ---------------------------------------------------------------------------
       
   621 //
       
   622 void CPslnGeneralThemeView::RestartQuickPreviewL()
       
   623     {
       
   624     CPslnGeneralThemeContainer* container = static_cast<CPslnGeneralThemeContainer*>(iContainer);
       
   625 
       
   626     container->RestartQuickPreviewL();
       
   627     }
       
   628 
       
   629 // -----------------------------------------------------------------------------
       
   630 // Remove local skin items.
       
   631 // -----------------------------------------------------------------------------
       
   632 //
       
   633 void CPslnGeneralThemeView::RemoveLocalSkinItems()
       
   634     {
       
   635     // Remove locally skinned items.
       
   636     MAknsSkinInstance* si = AknsUtils::SkinInstance();
       
   637     if ( si )
       
   638         {        
       
   639         si->SetChangeEventsEnabled( EFalse );
       
   640         si->RemoveLocalItemDefs();
       
   641         si->SetChangeEventsEnabled( ETrue );
       
   642         }
       
   643     }
       
   644 
       
   645 // -----------------------------------------------------------------------------
       
   646 // Remove MSK command mappings.
       
   647 // This method should do nothing but MSK issues.
       
   648 // -----------------------------------------------------------------------------
       
   649 //
       
   650 void CPslnGeneralThemeView::RemoveCommandFromMSK()
       
   651     {
       
   652     PSLN_TRACE_DEBUG("CPslnGeneralThemeView::RemoveCommandFromMSK");
       
   653     CEikButtonGroupContainer* cbaGroup = Cba();
       
   654     // Check if model exists => indicates that UI is not exiting.
       
   655     if ( cbaGroup && iPslnUi->Model() )
       
   656         {
       
   657         cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EPslnCmdAppDownload );
       
   658         cbaGroup->RemoveCommandFromStack( KPslnMSKControlID, EPslnCmdAppActivate );
       
   659         }
       
   660     }
       
   661 // -----------------------------------------------------------------------------
       
   662 // Handle listbox stylus down event.
       
   663 // -----------------------------------------------------------------------------
       
   664 //
       
   665 void CPslnGeneralThemeView::HandleListBoxStylusDown()
       
   666     {
       
   667     }
       
   668     
       
   669 // -----------------------------------------------------------------------------
       
   670 // Handle listbox stylus move event.
       
   671 // -----------------------------------------------------------------------------
       
   672 //
       
   673 void CPslnGeneralThemeView::HandleListBoxStylusDrag()
       
   674     {
       
   675     }
       
   676 // -----------------------------------------------------------------------------
       
   677 // Hightligt Default skin
       
   678 // -----------------------------------------------------------------------------
       
   679 //
       
   680 void CPslnGeneralThemeView::HightlightDefaultSkin()
       
   681     {
       
   682     CPslnGeneralThemeContainer* container = static_cast<CPslnGeneralThemeContainer*>(iContainer);
       
   683     TInt modifier = container->IsEmbeddedLinkVisible( );
       
   684     container->SetCurrentItemIndex( modifier );
       
   685     }
       
   686 //  End of File