menufw/menufwui/matrixmenu/src/mmappui.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 88 3321d3e205b6
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:  Application UI class
    14 * Description:  Application UI class
    15 *  Version     : %version: MM_176.1.28.1.87 % << Don't touch! Updated by Synergy at check-out.
    15 *  Version     : %version: MM_176.1.28.1.83 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.87 % << Don't touch! Updated by Synergy at check-out.
    16 *  Version     : %version: MM_176.1.28.1.83 % << Don't touch! Updated by Synergy at check-out.
    17 *
    17 *
    18 */
    18 */
    19 
    19 
    20 #include <e32base.h>
    20 #include <e32base.h>
    21 #include <e32cmn.h>
    21 #include <e32cmn.h>
   104     isHiddenFromFS = ETrue;
   104     isHiddenFromFS = ETrue;
   105     FeatureManager::InitializeLibL();
   105     FeatureManager::InitializeLibL();
   106     iIsKastorEffectStarted = EFalse;
   106     iIsKastorEffectStarted = EFalse;
   107     StartLayoutSwitchFullScreen( AknTransEffect::EApplicationStart );
   107     StartLayoutSwitchFullScreen( AknTransEffect::EApplicationStart );
   108 
   108 
       
   109     RefreshUiPanesL( ETrue );
   109     Cba()->MakeVisible( EFalse );
   110     Cba()->MakeVisible( EFalse );
   110     StatusPane()->MakeVisible( EFalse );
       
   111     StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
   111     StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
   112 
   112 
   113     iDummyTemplateLib = CMmTemplateLibrary::NewL();
   113     iDummyTemplateLib = CMmTemplateLibrary::NewL();
   114     iDummyContainer = CMmWidgetContainer::NewGridContainerL( ClientRect(),
   114     iDummyContainer = CMmWidgetContainer::NewGridContainerL( ClientRect(),
   115             this, iDummyTemplateLib );
   115             this, iDummyTemplateLib );
   338                 iDummyContainer->MakeVisible( ETrue );
   338                 iDummyContainer->MakeVisible( ETrue );
   339                 RefreshUiPanesL( ETrue );
   339                 RefreshUiPanesL( ETrue );
   340                 iCurrentContainer->MakeVisible( EFalse );
   340                 iCurrentContainer->MakeVisible( EFalse );
   341                 iDummyContainer->DrawNow();
   341                 iDummyContainer->DrawNow();
   342                 }
   342                 }
   343             CleanupForExitL( ECommingFromBackground );
   343             CleanupForExitL( EExitKeyApplication );
   344             User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition(
   344             User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition(
   345             CEikonEnv::Static()->RootWin().Identifier(), 0 ) );
   345             CEikonEnv::Static()->RootWin().Identifier(), 0 ) );
   346             iAppkeyHandler->StartL();
   346             iAppkeyHandler->StartL();
   347             }
   347             }
   348         }
   348         }
   492     {
   492     {
   493     DEBUG(("_Mm_:CMmAppUi::HandleBackCommandL IN"));
   493     DEBUG(("_Mm_:CMmAppUi::HandleBackCommandL IN"));
   494     MMPERF(("CMmAppUi::HandleBackCommandL - START"));
   494     MMPERF(("CMmAppUi::HandleBackCommandL - START"));
   495     DEBUG16(("\t_Mm_:current genre: %S",&iCurrentSuiteModel->SuiteName()));
   495     DEBUG16(("\t_Mm_:current genre: %S",&iCurrentSuiteModel->SuiteName()));
   496 
   496 
       
   497     iDummyContainer->MakeVisible( ETrue );
       
   498     RefreshUiPanesL( ETrue );
       
   499     iCurrentContainer->MakeVisible( EFalse );
       
   500     iDummyContainer->DrawNow();
       
   501 
   497     iHNInterface->HandleBackEventL( iCurrentSuiteModel->SuiteName() );
   502     iHNInterface->HandleBackEventL( iCurrentSuiteModel->SuiteName() );
   498 
   503 
   499     MMPERF(("CMmAppUi::HandleBackCommandL - DONE"));
   504     MMPERF(("CMmAppUi::HandleBackCommandL - DONE"));
   500     DEBUG(("_Mm_:CMmAppUi::HandleBackCommandL OUT"));
   505     DEBUG(("_Mm_:CMmAppUi::HandleBackCommandL OUT"));
   501     }
   506     }
  1016     {
  1021     {
  1017     MMPERF(("CMmAppUi::HandleDragStartL - START"));
  1022     MMPERF(("CMmAppUi::HandleDragStartL - START"));
  1018 
  1023 
  1019     if ( IsEditMode() )
  1024     if ( IsEditMode() )
  1020         {
  1025         {
       
  1026 
  1021         TInt modelId = iCurrentSuiteModel->IdByIndex( aModelItemIndex );
  1027         TInt modelId = iCurrentSuiteModel->IdByIndex( aModelItemIndex );
  1022         if (modelId != KErrNotFound)
  1028         if (modelId != KErrNotFound)
  1023             {
  1029             {
  1024             CHnItemModel *itModel = iCurrentSuiteModel->GetItemModel( modelId );
  1030             CHnItemModel *itModel = iCurrentSuiteModel->GetItemModel( modelId );
  1025             if (itModel->GetItemType() == EItemTypeParentFolder)
  1031             if (itModel->GetItemType() == EItemTypeParentFolder)
  1815         TBool highlightVisibleBefore =
  1821         TBool highlightVisibleBefore =
  1816                 iCurrentContainer &&
  1822                 iCurrentContainer &&
  1817                 aWidgetContainer &&
  1823                 aWidgetContainer &&
  1818                 iCurrentContainer->IsHighlightVisible() &&
  1824                 iCurrentContainer->IsHighlightVisible() &&
  1819                 iCurrentContainer->WidgetType() != aWidgetContainer->WidgetType();
  1825                 iCurrentContainer->WidgetType() != aWidgetContainer->WidgetType();
  1820         
       
  1821         if( iCurrentContainer && !highlightVisibleBefore )
       
  1822             {
       
  1823             iCurrentContainer->SetHighlightVisibilityL( EFalse );
       
  1824             }
       
  1825 
  1826 
  1826         HandleWidgetChangeRefreshL( aWidgetContainer );
  1827         HandleWidgetChangeRefreshL( aWidgetContainer );
  1827 
  1828 
  1828         if ( highlightVisibleBefore )
  1829         if ( highlightVisibleBefore )
  1829             {
  1830             {
  2374 //
  2375 //
  2375 // ---------------------------------------------------------------------------
  2376 // ---------------------------------------------------------------------------
  2376 //
  2377 //
  2377 void CMmAppUi::HandleSuiteModelInitializedL( CHnSuiteModel* aModel )
  2378 void CMmAppUi::HandleSuiteModelInitializedL( CHnSuiteModel* aModel )
  2378     {
  2379     {
       
  2380 
  2379     StatusPane()->MakeVisible( ETrue );
  2381     StatusPane()->MakeVisible( ETrue );
  2380     Cba()->MakeVisible( ETrue );
  2382     Cba()->MakeVisible( ETrue );
  2381     if ( aModel == iHNInterface->GetLastSuiteModelL() )
  2383     if ( aModel == iHNInterface->GetLastSuiteModelL() )
  2382         {
  2384         {
  2383         TBool showOpenFolderEffect(iCurrentSuiteModel
  2385         TBool showOpenFolderEffect(iCurrentSuiteModel
  2492         {
  2494         {
  2493         DEBUG(("\t_Mm_:Edit Mode turned off"));
  2495         DEBUG(("\t_Mm_:Edit Mode turned off"));
  2494         iCurrentContainer->CancelDragL( EFalse );
  2496         iCurrentContainer->CancelDragL( EFalse );
  2495         SetEditModeL( EFalse );
  2497         SetEditModeL( EFalse );
  2496         }
  2498         }
  2497     
  2499 
  2498     THnSuiteWidgetType widgetType = iCurrentContainer
       
  2499             ? iCurrentContainer->WidgetType() : EUnspecified;
       
  2500     
       
  2501     // reset model - revert to root if current view is not a suite view
  2500     // reset model - revert to root if current view is not a suite view
  2502     CHnSuiteModel* model = iHNInterface->GetLastSuiteModelL();
  2501     CHnSuiteModel* model = iHNInterface->GetLastSuiteModelL();
  2503     
  2502     if ( model && aExitKey == EExitKeyApplication )
  2504     TBool commingFromBackground( aExitKey == ECommingFromBackground ); 
       
  2505     
       
  2506     if( model && ( aExitKey == EExitKeyApplication || commingFromBackground ) )
       
  2507         {
  2503         {
  2508         TBool topSuiteIsBeingEvaluated =
  2504         TBool topSuiteIsBeingEvaluated =
  2509             !model->GetItemsOrder()->IsSuiteReadyToShow();
  2505             !model->GetItemsOrder()->IsSuiteReadyToShow();
  2510         TBool topSuiteChanged = ResetToRootL();
  2506         TBool topSuiteChanged = ResetToRootL();
  2511         model = NULL; // ResetToRootL might have deleted the model
  2507         model = NULL; // ResetToRootL might have deleted the model
  2512         TBool presentationChangeExpected = topSuiteChanged || topSuiteIsBeingEvaluated;
  2508         TBool presentationChangeExpected = topSuiteChanged || topSuiteIsBeingEvaluated;
  2513         
  2509 
  2514        
  2510         TBool mustDrawImmediately =
  2515         TBool mustDrawImmediately = !presentationChangeExpected
  2511             !presentationChangeExpected || !iDummyContainer->IsVisible();
  2516                 || !iDummyContainer->IsVisible() || commingFromBackground;
  2512 
  2517 
  2513         if ( iCurrentContainer && mustDrawImmediately )
  2518         if( iCurrentContainer )
  2514             {
  2519             {
  2515             DEBUG(("\t_Mm_:Top item index reset"));
  2520             if( commingFromBackground )
  2516             iCurrentContainer->ResetWidgetPosition();
  2521                 {
  2517             iCurrentContainer->Widget()->UpdateScrollBarsL();
  2522 				//do not draw the widget if the previous widget type is diffenernt than the current one 
  2518             iCurrentContainer->MakeVisible( ETrue );
  2523                 mustDrawImmediately &= ( widgetType
  2519             iCurrentContainer->DrawNow();
  2524                         == iCurrentContainer->WidgetType() );
       
  2525 
       
  2526                 iCurrentContainer->SetWidgetCommingFromBackground( ETrue );
       
  2527                 }
       
  2528 
       
  2529             if( mustDrawImmediately )
       
  2530                 {
       
  2531                 DEBUG(("\t_Mm_:Top item index reset"));
       
  2532                 iCurrentContainer->ResetWidgetPosition();
       
  2533                 iCurrentContainer->Widget()->UpdateScrollBarsL();
       
  2534                 iCurrentContainer->MakeVisible( ETrue );
       
  2535                 iCurrentContainer->DrawNow();
       
  2536                 iCurrentContainer->SetWidgetCommingFromBackground( EFalse );
       
  2537                 }
       
  2538             }
  2520             }
  2539         }
  2521         }
  2540 
  2522 
  2541     DEBUG(("_Mm_:CMmAppUi::CleanupForExitL - OUT"));
  2523     DEBUG(("_Mm_:CMmAppUi::CleanupForExitL - OUT"));
  2542     }
  2524     }
  2619         CleanupStack::PopAndDestroy( windowName );
  2601         CleanupStack::PopAndDestroy( windowName );
  2620         }
  2602         }
  2621 
  2603 
  2622     if( !succeeded )
  2604     if( !succeeded )
  2623         {
  2605         {
  2624         StartLayoutSwitchFullScreen( AknTransEffect::EApplicationExit );
       
  2625         ShowHomescreenL( EExitReally );
  2606         ShowHomescreenL( EExitReally );
  2626         }
  2607         }
  2627     }
  2608     }
  2628 
  2609 
  2629 // ---------------------------------------------------------------------------
  2610 // ---------------------------------------------------------------------------
  2821                 iCurrentSuiteModel->SuiteName(),
  2802                 iCurrentSuiteModel->SuiteName(),
  2822                 iHNInterface->GetSuiteModelsCountL() - 1 );
  2803                 iHNInterface->GetSuiteModelsCountL() - 1 );
  2823         ResetContainerMapToRootL();
  2804         ResetContainerMapToRootL();
  2824         if( iCurrentContainer )
  2805         if( iCurrentContainer )
  2825             {
  2806             {
  2826             const TInt FirstItemIndex = 0; 
       
  2827             iCurrentContainer->GetSuiteModelL()->SetSuiteHighlightL( FirstItemIndex );
       
  2828             iMakeHightlightedItemFullyVisible = ETrue;
       
  2829             iCurrentContainer->ResetWidgetPosition();
  2807             iCurrentContainer->ResetWidgetPosition();
  2830             iCurrentContainer->SetEditModeL( EFalse );
       
  2831             AddToStackL( iCurrentContainer );
  2808             AddToStackL( iCurrentContainer );
  2832             }
  2809             }
  2833         RefreshUiPanesL( ETrue );
  2810         RefreshUiPanesL( ETrue );
  2834         resetConsumed = ETrue;
  2811         resetConsumed = ETrue;
  2835         }
  2812         }
  3056         {
  3033         {
  3057         HideApplicationFromFSW( EFalse );
  3034         HideApplicationFromFSW( EFalse );
  3058         isHiddenFromFS = EFalse;
  3035         isHiddenFromFS = EFalse;
  3059         }
  3036         }
  3060 
  3037 
  3061     if( iCurrentContainer && iCurrentSuiteModel )
  3038   if (iCurrentContainer && iCurrentSuiteModel )
  3062         {
  3039     {
  3063         iCurrentContainer->HandleForegroundGainedL();
  3040     iCurrentContainer->HandleForegroundGainedL();
  3064         iDummyContainer->MakeVisible( EFalse );
  3041     iDummyContainer->MakeVisible( EFalse );
  3065         iCurrentContainer->MakeVisible( ETrue );
  3042     iCurrentContainer->MakeVisible( ETrue );
  3066         RefreshUiPanesL();
  3043     RefreshUiPanesL();
  3067         }
  3044     }
  3068     if( iSkinChangeNeeded && !iSkinChangeInProgress )
  3045   if (iSkinChangeNeeded && !iSkinChangeInProgress)
  3069         {
  3046     {
  3070         MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
  3047     MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
  3071         if( skinInstance && !skinInstance->IsUpdateInProgress() )
  3048     if (skinInstance && !skinInstance->IsUpdateInProgress())
  3072             {
  3049       {
  3073             RefreshIconsL();
  3050       RefreshIconsL();
  3074             }
  3051 
  3075         }
  3052       }
  3076     }
  3053     }
       
  3054   }
  3077 
  3055 
  3078 // ---------------------------------------------------------------------------
  3056 // ---------------------------------------------------------------------------
  3079 //
  3057 //
  3080 // ---------------------------------------------------------------------------
  3058 // ---------------------------------------------------------------------------
  3081 //
  3059 //