phoneuis/dialer/src/cdialertoolbarcontainer.cpp
branchRCL_3
changeset 25 91c2fb4b78df
parent 19 544e34b3255a
child 57 94dc1107e8b2
--- a/phoneuis/dialer/src/cdialertoolbarcontainer.cpp	Wed Apr 14 15:56:42 2010 +0300
+++ b/phoneuis/dialer/src/cdialertoolbarcontainer.cpp	Tue Apr 27 16:37:10 2010 +0300
@@ -219,6 +219,10 @@
     {
     if ( aEventType == MCoeControlObserver::EEventStateChanged )
         {
+        // Give dialer a chance to update editor state before handling the button press.
+        // Used to reconfigure editor after user has closed virtual keyboard.
+        iParentControl.PrepareForFocusGainL();
+
         // Handle button press. 
 
         // Multistate buttons change state automatically when pressed. 
@@ -238,13 +242,7 @@
         
         if ( commandId == EPhoneDialerCmdClear )
             {
-            // simulate backspace
-            TKeyEvent keyEvent;
-            keyEvent.iModifiers = 0;
-            keyEvent.iRepeats = 0;
-            keyEvent.iCode = EKeyBackspace;
-            keyEvent.iScanCode = EStdKeyBackspace;
-            iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey );
+            SimulateBackspace();
             }
         else
             {
@@ -459,4 +457,27 @@
     return nextPos;
     }
 
+// ---------------------------------------------------------------------------
+// SimulateBackspace
+// Simulate backspace press including key down event, key event, and key up 
+// event
+// ---------------------------------------------------------------------------
+//
+void CDialerToolbarContainer::SimulateBackspace()
+    {
+    TKeyEvent keyEvent;
+    keyEvent.iModifiers = 0;
+    keyEvent.iRepeats = 0;
+    keyEvent.iCode = 0; // key code is always 0 for key up and down events
+    keyEvent.iScanCode = EStdKeyBackspace;
+
+    iCoeEnv->SimulateKeyEventL( keyEvent, EEventKeyDown );
+
+    keyEvent.iCode = EKeyBackspace;
+    iCoeEnv->SimulateKeyEventL( keyEvent, EEventKey );
+    
+    keyEvent.iCode = 0;
+    iCoeEnv->SimulateKeyEventL( keyEvent, EEventKeyUp );
+    }
+
 // end of file