menufw/menufwui/matrixmenu/src/mmappui.cpp
branchRCL_3
changeset 88 3321d3e205b6
parent 83 5456b4e8b3a8
child 102 ba63c83f4716
--- a/menufw/menufwui/matrixmenu/src/mmappui.cpp	Wed Sep 01 12:32:46 2010 +0100
+++ b/menufw/menufwui/matrixmenu/src/mmappui.cpp	Tue Sep 14 20:58:58 2010 +0300
@@ -12,8 +12,8 @@
 * Contributors:
 *
 * Description:  Application UI class
-*  Version     : %version: MM_176.1.28.1.83 % << Don't touch! Updated by Synergy at check-out.
-*  Version     : %version: MM_176.1.28.1.83 % << Don't touch! Updated by Synergy at check-out.
+*  Version     : %version: MM_176.1.28.1.87 % << Don't touch! Updated by Synergy at check-out.
+*  Version     : %version: MM_176.1.28.1.87 % << Don't touch! Updated by Synergy at check-out.
 *
 */
 
@@ -106,8 +106,8 @@
     iIsKastorEffectStarted = EFalse;
     StartLayoutSwitchFullScreen( AknTransEffect::EApplicationStart );
 
-    RefreshUiPanesL( ETrue );
     Cba()->MakeVisible( EFalse );
+    StatusPane()->MakeVisible( EFalse );
     StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
 
     iDummyTemplateLib = CMmTemplateLibrary::NewL();
@@ -340,7 +340,7 @@
                 iCurrentContainer->MakeVisible( EFalse );
                 iDummyContainer->DrawNow();
                 }
-            CleanupForExitL( EExitKeyApplication );
+            CleanupForExitL( ECommingFromBackground );
             User::LeaveIfError( iCoeEnv->WsSession().SetWindowGroupOrdinalPosition(
             CEikonEnv::Static()->RootWin().Identifier(), 0 ) );
             iAppkeyHandler->StartL();
@@ -494,11 +494,6 @@
     MMPERF(("CMmAppUi::HandleBackCommandL - START"));
     DEBUG16(("\t_Mm_:current genre: %S",&iCurrentSuiteModel->SuiteName()));
 
-    iDummyContainer->MakeVisible( ETrue );
-    RefreshUiPanesL( ETrue );
-    iCurrentContainer->MakeVisible( EFalse );
-    iDummyContainer->DrawNow();
-
     iHNInterface->HandleBackEventL( iCurrentSuiteModel->SuiteName() );
 
     MMPERF(("CMmAppUi::HandleBackCommandL - DONE"));
@@ -1023,7 +1018,6 @@
 
     if ( IsEditMode() )
         {
-
         TInt modelId = iCurrentSuiteModel->IdByIndex( aModelItemIndex );
         if (modelId != KErrNotFound)
             {
@@ -1823,6 +1817,11 @@
                 aWidgetContainer &&
                 iCurrentContainer->IsHighlightVisible() &&
                 iCurrentContainer->WidgetType() != aWidgetContainer->WidgetType();
+        
+        if( iCurrentContainer && !highlightVisibleBefore )
+            {
+            iCurrentContainer->SetHighlightVisibilityL( EFalse );
+            }
 
         HandleWidgetChangeRefreshL( aWidgetContainer );
 
@@ -2377,7 +2376,6 @@
 //
 void CMmAppUi::HandleSuiteModelInitializedL( CHnSuiteModel* aModel )
     {
-
     StatusPane()->MakeVisible( ETrue );
     Cba()->MakeVisible( ETrue );
     if ( aModel == iHNInterface->GetLastSuiteModelL() )
@@ -2496,27 +2494,47 @@
         iCurrentContainer->CancelDragL( EFalse );
         SetEditModeL( EFalse );
         }
-
+    
+    THnSuiteWidgetType widgetType = iCurrentContainer
+            ? iCurrentContainer->WidgetType() : EUnspecified;
+    
     // reset model - revert to root if current view is not a suite view
     CHnSuiteModel* model = iHNInterface->GetLastSuiteModelL();
-    if ( model && aExitKey == EExitKeyApplication )
+    
+    TBool commingFromBackground( aExitKey == ECommingFromBackground ); 
+    
+    if( model && ( aExitKey == EExitKeyApplication || commingFromBackground ) )
         {
         TBool topSuiteIsBeingEvaluated =
             !model->GetItemsOrder()->IsSuiteReadyToShow();
         TBool topSuiteChanged = ResetToRootL();
         model = NULL; // ResetToRootL might have deleted the model
         TBool presentationChangeExpected = topSuiteChanged || topSuiteIsBeingEvaluated;
+        
+       
+        TBool mustDrawImmediately = !presentationChangeExpected
+                || !iDummyContainer->IsVisible() || commingFromBackground;
 
-        TBool mustDrawImmediately =
-            !presentationChangeExpected || !iDummyContainer->IsVisible();
-
-        if ( iCurrentContainer && mustDrawImmediately )
+        if( iCurrentContainer )
             {
-            DEBUG(("\t_Mm_:Top item index reset"));
-            iCurrentContainer->ResetWidgetPosition();
-            iCurrentContainer->Widget()->UpdateScrollBarsL();
-            iCurrentContainer->MakeVisible( ETrue );
-            iCurrentContainer->DrawNow();
+            if( commingFromBackground )
+                {
+				//do not draw the widget if the previous widget type is diffenernt than the current one 
+                mustDrawImmediately &= ( widgetType
+                        == iCurrentContainer->WidgetType() );
+
+                iCurrentContainer->SetWidgetCommingFromBackground( ETrue );
+                }
+
+            if( mustDrawImmediately )
+                {
+                DEBUG(("\t_Mm_:Top item index reset"));
+                iCurrentContainer->ResetWidgetPosition();
+                iCurrentContainer->Widget()->UpdateScrollBarsL();
+                iCurrentContainer->MakeVisible( ETrue );
+                iCurrentContainer->DrawNow();
+                iCurrentContainer->SetWidgetCommingFromBackground( EFalse );
+                }
             }
         }
 
@@ -2603,6 +2621,7 @@
 
     if( !succeeded )
         {
+        StartLayoutSwitchFullScreen( AknTransEffect::EApplicationExit );
         ShowHomescreenL( EExitReally );
         }
     }
@@ -2804,7 +2823,11 @@
         ResetContainerMapToRootL();
         if( iCurrentContainer )
             {
+            const TInt FirstItemIndex = 0; 
+            iCurrentContainer->GetSuiteModelL()->SetSuiteHighlightL( FirstItemIndex );
+            iMakeHightlightedItemFullyVisible = ETrue;
             iCurrentContainer->ResetWidgetPosition();
+            iCurrentContainer->SetEditModeL( EFalse );
             AddToStackL( iCurrentContainer );
             }
         RefreshUiPanesL( ETrue );
@@ -3035,23 +3058,22 @@
         isHiddenFromFS = EFalse;
         }
 
-  if (iCurrentContainer && iCurrentSuiteModel )
-    {
-    iCurrentContainer->HandleForegroundGainedL();
-    iDummyContainer->MakeVisible( EFalse );
-    iCurrentContainer->MakeVisible( ETrue );
-    RefreshUiPanesL();
+    if( iCurrentContainer && iCurrentSuiteModel )
+        {
+        iCurrentContainer->HandleForegroundGainedL();
+        iDummyContainer->MakeVisible( EFalse );
+        iCurrentContainer->MakeVisible( ETrue );
+        RefreshUiPanesL();
+        }
+    if( iSkinChangeNeeded && !iSkinChangeInProgress )
+        {
+        MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
+        if( skinInstance && !skinInstance->IsUpdateInProgress() )
+            {
+            RefreshIconsL();
+            }
+        }
     }
-  if (iSkinChangeNeeded && !iSkinChangeInProgress)
-    {
-    MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance();
-    if (skinInstance && !skinInstance->IsUpdateInProgress())
-      {
-      RefreshIconsL();
-
-      }
-    }
-  }
 
 // ---------------------------------------------------------------------------
 //