emailuis/emailui/src/ncsheadercontainer.cpp
changeset 4 e7aa27f58ae1
parent 3 a4d6f1ea0416
child 8 e1b6206813b4
--- a/emailuis/emailui/src/ncsheadercontainer.cpp	Tue Jan 26 11:45:42 2010 +0200
+++ b/emailuis/emailui/src/ncsheadercontainer.cpp	Tue Feb 02 00:02:40 2010 +0200
@@ -526,7 +526,6 @@
 		        {
 		        FindFocused()->OfferKeyEventL( aKeyEvent, aType );
 		        ret = EKeyWasConsumed;
-		        doScroll = ETrue;
 		        }
 		    }
     	}
@@ -543,27 +542,7 @@
 
     if( doScroll )
     	{
-		// scroll the screen if the cursor goes beyond the screen
-		CNcsComposeViewContainer& parent = 
-            static_cast<CNcsComposeViewContainer&>( iParent );
-		
-		TInt screenPos( -Position().iY );
-		TInt cursorPos( CursorPosition() );
-		TInt lineHeight( Rect().Height() / LineCount() );
-		TInt screenHeight( parent.Rect().Height() );
-		
-		if( cursorPos - lineHeight < screenPos )
-			{
-			screenPos = cursorPos - lineHeight;		    	
-			}
-		else
-		if( cursorPos + lineHeight > screenPos + screenHeight )
-			{
-			screenPos = cursorPos + lineHeight - screenHeight;
-			}
-		
-		parent.ScrollL( screenPos );
-		PositionChanged();
+    	DoScrollL();
     	}
 
     return ret;
@@ -657,6 +636,7 @@
     if ( ret == EKeyWasConsumed )
         {
         container->UpdateScrollBarL();
+        DoScrollL();
         }
 
 	// NOTE: If we're leaving the header (down was pushed on last control)
@@ -1979,3 +1959,30 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CNcsHeaderContainer::DoScrollL
+// 
+// -----------------------------------------------------------------------------
+void CNcsHeaderContainer::DoScrollL()
+    {
+    // scroll the screen if the cursor goes beyond the screen
+    CNcsComposeViewContainer& parent = static_cast<CNcsComposeViewContainer&>( iParent );
+    
+    TInt screenPos( -Position().iY );
+    TInt cursorPos( CursorPosition() );
+    TInt lineHeight( Rect().Height() / LineCount() );
+    TInt screenHeight( parent.Rect().Height() );
+    
+    if( cursorPos - lineHeight < screenPos )
+        {
+        screenPos = cursorPos - lineHeight;             
+        }
+    else
+    if( cursorPos + lineHeight > screenPos + screenHeight )
+        {
+        screenPos = cursorPos + lineHeight - screenHeight;
+        }
+    
+    parent.ScrollL( screenPos );
+    PositionChanged();    
+    }