idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 18 d05a55b217df
--- a/idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp	Fri Mar 12 15:41:49 2010 +0200
+++ b/idlehomescreen/xmluirendering/uiengine/src/xnkeyeventdispatcher.cpp	Mon Mar 15 12:39:47 2010 +0200
@@ -40,6 +40,8 @@
     ( k == EStdKeyLeftArrow || k == EStdKeyRightArrow || \
       k == EStdKeyUpArrow || k == EStdKeyDownArrow ) 
 
+const TInt KOneView = 1;
+
 // -----------------------------------------------------------------------------
 // SetInitialFocusL
 // -----------------------------------------------------------------------------
@@ -274,8 +276,30 @@
                 if ( !iNode )
                     {
                     // Find initial location for focus
-                    ResolveAndSetFocusL(); 
-                                            
+                    ResolveAndSetFocusL();
+                    
+                    // If focus is still not set, we are in normal mode and the view is empty.
+                    // left and right arrows lead to next/previous view. When other arrows
+                    // are pressed, the focus is hidden.
+                    if( !iNode )
+                        {
+                        if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
+                            aKeyEvent.iScanCode == EStdKeyRightArrow )
+                            {
+                            iUiEngine.ViewManager()->ActivateNextViewL();
+                            }
+                        else if( iUiEngine.ViewManager()->ViewAmount() != KOneView &&
+                                 aKeyEvent.iScanCode == EStdKeyLeftArrow )
+                            {
+                            iUiEngine.ViewManager()->ActivatePreviousViewL();
+                            }
+                        else
+                            {
+                            // hide focus if view is not switched
+                            appui.HideFocus();
+                            }
+                        }
+
                     return EKeyWasConsumed;
                     }
                 }