psln/Src/PslnUi.cpp
branchRCL_3
changeset 18 0aa5fbdfbc30
parent 0 2f259fa3e83a
child 25 941195f2d488
equal deleted inserted replaced
16:71dd06cfe933 18:0aa5fbdfbc30
    29 #include <akntitle.h>
    29 #include <akntitle.h>
    30 
    30 
    31 // Notes & Dialogs
    31 // Notes & Dialogs
    32 #include <AknGlobalNote.h>
    32 #include <AknGlobalNote.h>
    33 #include <aknnotewrappers.h>
    33 #include <aknnotewrappers.h>
       
    34 #include <AknWaitDialog.h> 
    34 
    35 
    35 // DRM.
    36 // DRM.
    36 #include <DRMHelper.h>
    37 #include <DRMHelper.h>
    37 #include <DRMRights.h>
    38 #include <DRMRights.h>
    38 
    39 
   152 //
   153 //
   153 CPslnUi::~CPslnUi()
   154 CPslnUi::~CPslnUi()
   154     {
   155     {
   155     PSLN_TRACE_DEBUG("CPslnUi::Destructor");
   156     PSLN_TRACE_DEBUG("CPslnUi::Destructor");
   156 
   157 
       
   158     HideProgressBar();
   157     // Reset skin info when exiting normally. This prevents model class
   159     // Reset skin info when exiting normally. This prevents model class
   158     // from trying to revert back to previous skin.
   160     // from trying to revert back to previous skin.
   159     if ( iView && iView->Id().iUid == KPslnMainView2.iUid )
   161     if ( iView && iView->Id().iUid == KPslnMainView2.iUid )
   160         {
   162         {
   161         // It is possible that Model is not created, if exiting immediately after
   163         // It is possible that Model is not created, if exiting immediately after
   325     PSLN_TRACE_DEBUG("CPslnUi::SkinConfigurationChanged");
   327     PSLN_TRACE_DEBUG("CPslnUi::SkinConfigurationChanged");
   326     TRAPD( err, SkinConfigurationChangedL( aReason ) );
   328     TRAPD( err, SkinConfigurationChangedL( aReason ) );
   327     if ( err != KErrNone )
   329     if ( err != KErrNone )
   328         {
   330         {
   329         TRAP_IGNORE( iGeneralThemeView->UpdateSkinListItemsL() );
   331         TRAP_IGNORE( iGeneralThemeView->UpdateSkinListItemsL() );
   330         TRAP_IGNORE( ToggleScreenBlankerL( EFalse, EFalse ) );
       
   331         }
   332         }
   332     }
   333     }
   333 
   334 
   334 // ---------------------------------------------------------------------------
   335 // ---------------------------------------------------------------------------
   335 // CPslnUi::SkinPackageChanged
   336 // CPslnUi::SkinPackageChanged
   719     iNaviPane->PushDefaultL();
   720     iNaviPane->PushDefaultL();
   720     SetStateOn( EPslnTabGroupCreated );
   721     SetStateOn( EPslnTabGroupCreated );
   721 #endif //RD_CONTROL_PANEL
   722 #endif //RD_CONTROL_PANEL
   722     }
   723     }
   723 
   724 
   724 // ---------------------------------------------------------------------------
       
   725 // Activates screen blanker. Note that second parameter is only used when
       
   726 // enabling blanker (i.e. first parameter is ETrue ).
       
   727 // ---------------------------------------------------------------------------
       
   728 void CPslnUi::ToggleScreenBlankerL( 
       
   729     const TBool& aToggleValue, const TBool& /*aStatusPaneVisible*/, const TBool& aRealAct )
       
   730     {
       
   731     TInt transitionEffectsValue = iModel->GetTransitionEffectStateL();
       
   732     if ( aToggleValue )
       
   733         {
       
   734         // Effects are enabled if value is NOT KMaxTInt.
       
   735         if( transitionEffectsValue != KMaxTInt )
       
   736             {
       
   737             if ( aRealAct )
       
   738                 {
       
   739                 iModel->TransEffect(EPslnTransitionEffectStartThemeActivation);
       
   740                 }
       
   741             else
       
   742                 {
       
   743                 iModel->TransEffect(EPslnTransitionEffectStartPreview);
       
   744                 }
       
   745             }
       
   746 //        else if ( iView && iView->MenuBar()->IsDisplayed() )
       
   747 //            {
       
   748 //            iView->MenuBar()->StopDisplayingMenuBar();
       
   749 //            }
       
   750         }
       
   751     else
       
   752         {
       
   753         // Effects are enabled if value is NOT KMaxTInt.
       
   754         if( transitionEffectsValue != KMaxTInt )
       
   755             {
       
   756             iModel->TransEffect(EPslnTransitionEffectStop);
       
   757             }
       
   758 //        else if ( iView && iView->MenuBar()->IsDisplayed() )
       
   759 //            {
       
   760 //            iView->MenuBar()->MenuPane()->DrawNow();
       
   761 //            }
       
   762         }
       
   763     }
       
   764 
       
   765 
   725 
   766 // ---------------------------------------------------------------------------
   726 // ---------------------------------------------------------------------------
   767 // Is this class able to handle a new skin activation related command.
   727 // Is this class able to handle a new skin activation related command.
   768 // ---------------------------------------------------------------------------
   728 // ---------------------------------------------------------------------------
   769 TBool CPslnUi::IsReadyToHandleCommands()
   729 TBool CPslnUi::IsReadyToHandleCommands()
   955             SetStateOff( EPslnSkinChangeRequested );
   915             SetStateOff( EPslnSkinChangeRequested );
   956             errorBuf = StringLoader::LoadLC( R_PSLN_QTN_MEMLO_RAM_OUT_OF_MEM );
   916             errorBuf = StringLoader::LoadLC( R_PSLN_QTN_MEMLO_RAM_OUT_OF_MEM );
   957             if ( GetStatus( EPslnSkinActivated ) )
   917             if ( GetStatus( EPslnSkinActivated ) )
   958                 {
   918                 {
   959                 SetStateOff( EPslnSkinActivated );
   919                 SetStateOff( EPslnSkinActivated );
       
   920                 HideProgressBar();
   960                 DoCreateWaitNoteL();
   921                 DoCreateWaitNoteL();
   961                 }
   922                 }
   962             break;
   923             break;
   963         // Skin activation failed due to skin being corrupted.
   924         // Skin activation failed due to skin being corrupted.
   964         // Set skin activation user activity off, so that subsequent attempts can be made.
   925         // Set skin activation user activity off, so that subsequent attempts can be made.
   970             iGeneralThemeView->HightlightDefaultSkin();
   931             iGeneralThemeView->HightlightDefaultSkin();
   971             errorBuf = StringLoader::LoadLC( R_PSLN_QTN_SKINS_ERROR_CORRUPTED );
   932             errorBuf = StringLoader::LoadLC( R_PSLN_QTN_SKINS_ERROR_CORRUPTED );
   972             if ( GetStatus( EPslnSkinActivated ) )
   933             if ( GetStatus( EPslnSkinActivated ) )
   973                 {
   934                 {
   974                 SetStateOff( EPslnSkinActivated );
   935                 SetStateOff( EPslnSkinActivated );
       
   936                 HideProgressBar();
   975                 DoCreateWaitNoteL();
   937                 DoCreateWaitNoteL();
   976                 }
   938                 }
   977             SetStateOn( EPslnListUpdateNeeded );
   939             SetStateOn( EPslnListUpdateNeeded );
   978             break;
   940             break;
   979         // Skin activation was success.
   941         // Skin activation was success.
   983         case EAknsSkinStatusConfigurationDeployed:
   945         case EAknsSkinStatusConfigurationDeployed:
   984             SetStateOff( EPslnSkinChangeRequested );
   946             SetStateOff( EPslnSkinChangeRequested );
   985             if ( GetStatus( EPslnSkinActivated ) )
   947             if ( GetStatus( EPslnSkinActivated ) )
   986                 {
   948                 {
   987                 SetStateOff( EPslnSkinActivated );
   949                 SetStateOff( EPslnSkinActivated );
       
   950                 HideProgressBar();
   988                 SkinDeployedL();
   951                 SkinDeployedL();
   989                 }
   952                 }
   990             else // Theme changed by other app, update view.
   953             else // Theme changed by other app, update view.
   991                 {
   954                 {
   992                 iModel->PerformCompleteUpdateL();             
   955                 iModel->PerformCompleteUpdateL();             
   993                 iGeneralThemeView->UpdateSkinListItemsL( iModel->ActiveSkinIndex() + 
   956                 iGeneralThemeView->UpdateSkinListItemsL( iModel->ActiveSkinIndex() + 
   994                                 PslnFeatures::IsEnhancedEmbeddedLinksSupported() );
   957                                 PslnFeatures::IsEnhancedEmbeddedLinksSupported() );
   995                 iGeneralThemeView->RemoveLocalSkinItems();
       
   996                 }
   958                 }
   997             
   959             
   998             if ( GetStatus( EPslnSoundActivationPending ) )
   960             if ( GetStatus( EPslnSoundActivationPending ) )
   999                 {
   961                 {
  1000                 SetStateOff( EPslnSoundActivationPending );
   962                 SetStateOff( EPslnSoundActivationPending );
  1001                 ActivateSoundsL();
   963                 ActivateSoundsL();
  1002                 }
   964                 }
  1003             ToggleScreenBlankerL( EFalse, EFalse );
       
  1004             break;
   965             break;
  1005         default:
   966         default:
  1006             break;
   967             break;
  1007         }
   968         }
  1008 
   969 
  1111             PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL 2");
  1072             PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL 2");
  1112             // Start changing active skin.
  1073             // Start changing active skin.
  1113             iModel->GuardActivationLC();
  1074             iModel->GuardActivationLC();
  1114             TBool shownote = EFalse;
  1075             TBool shownote = EFalse;
  1115 
  1076 
  1116             // Show screen clearer when skin is changing.
       
  1117             ToggleScreenBlankerL( ETrue, ETrue );
       
  1118 
       
  1119             PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL directly");
  1077             PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL directly");
  1120             shownote = iModel->ActivateSkinL( skinIndex );
  1078             shownote = iModel->ActivateSkinL( skinIndex );
       
  1079             ShowProgressBarL();
  1121 
  1080 
  1122             if ( shownote )
  1081             if ( shownote )
  1123                 {
  1082                 {
  1124                 PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL skin activated");
  1083                 PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL skin activated");
  1125                 SetStateOn( EPslnSkinActivated );
  1084                 SetStateOn( EPslnSkinActivated );
  1130                 // flag.
  1089                 // flag.
  1131                 if ( GetStatus( EPslnSkinChangeRequested ) )
  1090                 if ( GetStatus( EPslnSkinChangeRequested ) )
  1132                     {
  1091                     {
  1133                     PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL decline DRM activation");
  1092                     PSLN_TRACE_DEBUG("CPslnUi::ActivateSkinL decline DRM activation");
  1134                     SetStateOff( EPslnSkinChangeRequested );
  1093                     SetStateOff( EPslnSkinChangeRequested );
  1135                     // Remove screen clearer.
       
  1136                     ToggleScreenBlankerL( EFalse, EFalse );
       
  1137                     }
  1094                     }
  1138                 }
  1095                 }
  1139             CleanupStack::PopAndDestroy(); // activation guard
  1096             CleanupStack::PopAndDestroy(); // activation guard
  1140             }
  1097             }
  1141         }
  1098         }
  1357             {
  1314             {
  1358             SetStateOff( aPslnStatus );
  1315             SetStateOff( aPslnStatus );
  1359             error = err;
  1316             error = err;
  1360             }
  1317             }
  1361         }
  1318         }
  1362     iGeneralThemeView->RemoveLocalSkinItems();
       
  1363     return error;
  1319     return error;
  1364     }
  1320     }
  1365 
  1321 
  1366 // ---------------------------------------------------------------------------
  1322 // ---------------------------------------------------------------------------
  1367 // Non-leaving version of AddPluginToTabL.
  1323 // Non-leaving version of AddPluginToTabL.
  1473             }
  1429             }
  1474         else
  1430         else
  1475             {
  1431             {
  1476             iUSBAttached = EFalse;
  1432             iUSBAttached = EFalse;
  1477             }
  1433             }
  1478         static_cast< CPslnGeneralThemeView* >( iView )->RestartQuickPreviewL();
  1434         }
  1479         }
  1435     }
  1480     }
  1436 
       
  1437 // ---------------------------------------------------------------------------
       
  1438 // CPslnUi::ShowProgressBarL
       
  1439 // ---------------------------------------------------------------------------
       
  1440 //
       
  1441 void CPslnUi::ShowProgressBarL()
       
  1442     {
       
  1443     if ( iWaitDialog == NULL )
       
  1444         {
       
  1445         iWaitDialog = new (ELeave) CAknWaitDialog(
       
  1446                     ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ), ETrue );
       
  1447         iWaitDialog->PrepareLC( R_PSLN_GENERAL_WAIT_NOTE );
       
  1448 
       
  1449         HBufC* noteText = NULL;
       
  1450         noteText = StringLoader::LoadLC( R_PSLN_QTN_GEN_NOTE_PROCESSING, iEikonEnv );
       
  1451         iWaitDialog->SetTextL( *noteText );
       
  1452         CleanupStack::PopAndDestroy( noteText );
       
  1453 
       
  1454         iWaitDialog->RunLD();
       
  1455         }
       
  1456     }
       
  1457 
       
  1458 // ---------------------------------------------------------------------------
       
  1459 // CPslnUi::HideProgressBar
       
  1460 // ---------------------------------------------------------------------------
       
  1461 //
       
  1462 void CPslnUi::HideProgressBar()
       
  1463     {
       
  1464     if( iWaitDialog )
       
  1465         {
       
  1466         TRAP_IGNORE( iWaitDialog->ProcessFinishedL() )
       
  1467         delete iWaitDialog;
       
  1468         iWaitDialog = NULL;
       
  1469         }
       
  1470     }
       
  1471 
  1481 // End of File
  1472 // End of File
  1482 
  1473