idlehomescreen/xmluirendering/uiengine/src/xneditmode.cpp
branchRCL_3
changeset 18 d05a55b217df
parent 12 9674c1a575e9
child 23 7be2816dbabd
--- a/idlehomescreen/xmluirendering/uiengine/src/xneditmode.cpp	Wed Mar 31 21:17:19 2010 +0300
+++ b/idlehomescreen/xmluirendering/uiengine/src/xneditmode.cpp	Wed Apr 14 15:47:59 2010 +0300
@@ -335,41 +335,51 @@
 // -----------------------------------------------------------------------------
 //
 void CXnEditMode::MakeVisible( TBool aVisible )
-    {        
+    {                
+    CXnAppUiAdapter& appui( iUiEngine.AppUiAdapter() );
+    CXnViewControlAdapter* control = 
+        static_cast< CXnViewControlAdapter* >(
+            appui.ViewManager().ActiveViewData().ViewNode()->Control() );
+    RWindow& window( Window() );
+    
     TBool visible( IsVisible() ? ETrue : EFalse );
-    
     if ( aVisible == visible )
         {
-        return;
+        if( aVisible )
+            {
+            // If a new Homescreen page has been added in Edit mode, bring the control back to the front       
+            control->DrawableWindow()->SetPointerGrab( EFalse );
+        
+        	window.SetOrdinalPosition( 0 );
+    	    window.SetPointerGrab( ETrue );
+	        window.ClaimPointerGrab();   
+            }
+    
+        return;    
         }
         
     CCoeControl::MakeVisible( aVisible );
-
-    CXnAppUiAdapter& appui( iUiEngine.AppUiAdapter() );
     
     // Remove focus
     appui.HideFocus();
-    
-    CXnViewControlAdapter* control = static_cast< CXnViewControlAdapter* >(
-        appui.ViewManager().ActiveViewData().ViewNode()->Control() );
-            
+                    
     if ( aVisible )
         {
         control->DrawableWindow()->SetPointerGrab( EFalse );
         
-        Window().SetOrdinalPosition( 0 );
-        Window().SetPointerGrab( ETrue );
-        Window().ClaimPointerGrab();      
+        window.SetOrdinalPosition( 0 );
+        window.SetPointerGrab( ETrue );
+        window.ClaimPointerGrab();      
         
         TRAP_IGNORE( appui.HandleEnterEditModeL( ETrue ) );                                
         }
     else
         {
-        Window().SetPointerGrab( EFalse );
+        window.SetPointerGrab( EFalse );
         
         control->DrawableWindow()->SetPointerGrab( ETrue );               
         
-        TRAP_IGNORE( appui.HandleEnterEditModeL( EFalse ) );                                                
+        TRAP_IGNORE( appui.HandleEnterEditModeL( EFalse ) );               
         }
     
     // Update background
@@ -646,7 +656,7 @@
         CXnNode* focused( iUiEngine.FocusedNode() );
         
         if ( focused && ( aKeyEvent.iScanCode == EStdKeyDevice3 ||
-            aKeyEvent.iScanCode == EStdKeyEnter ) )
+            aKeyEvent.iCode == EKeyEnter ) )
             {
             CXnPluginData* plugin( iUiEngine.ViewManager()->
                     ActiveViewData().Plugin( focused ) );
@@ -670,7 +680,7 @@
                         
                         if ( menuIf )
                             {
-                            menuIf->TryDisplayingMenuBarL( *id );
+                            menuIf->TryDisplayingMenuBarL( *id, ETrue );
                             iUiEngine.Editor()->SetTargetPlugin( focused );
                             }                        
                         }
@@ -831,6 +841,8 @@
         {                
         iDraggingNode = NULL;
         iTargetNode = NULL;
+                
+        iUiEngine.Editor()->SetTargetPlugin( NULL );
         
         iState = aState;