phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp
branchRCL_3
changeset 6 38529f706030
parent 5 2a26698d78ba
child 7 544e34b3255a
--- a/phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp	Mon Mar 15 12:40:24 2010 +0200
+++ b/phoneapp/phoneuicontrol/src/cphonekeyeventforwarder.cpp	Wed Mar 31 21:30:06 2010 +0300
@@ -31,6 +31,11 @@
 #include "cphonetimer.h"
 #include "phonelogger.h"
 #include "phoneui.pan"
+#include "mphoneviewcommandhandle.h"
+#include "cphoneqwertyhandler.h"
+#include "tphonecmdparampointer.h"
+#include "mphoneqwertymodeobserver.h"
+#include "cdialer.h"
 
 // CONSTANTS
 
@@ -73,6 +78,8 @@
         env->EikAppUi()->RemoveFromStack( this );
         }
     delete iLongPressKeyEventTimer;
+    
+    delete iQwertyHandler;
     }
 
 // -----------------------------------------------------------------------------
@@ -199,6 +206,17 @@
 
     // Create the long press key event timer
     iLongPressKeyEventTimer = CPhoneTimer::NewL();
+    
+    // Create qwerty mode handler
+    iQwertyHandler = CPhoneQwertyHandler::NewL(); 
+    
+    TPhoneCmdParamPointer ptrParam;
+    iViewCommandHandle->ExecuteCommand( EPhoneViewGetQwertyModeObserver, &ptrParam );
+    CDialer* qwertyObserver = 
+            static_cast<CDialer*>( ptrParam.Pointer() );
+            
+    iQwertyHandler->AddQwertyModeObserverL( *qwertyObserver );
+
     }
 
 // -----------------------------------------------------------------------------
@@ -294,6 +312,24 @@
         default:
             break;
         }
+    
+    // Check if keyEvent is simulated in Dialer.
+    const TBool simulatedByDialer = 
+        ( ( aKeyEvent.iModifiers & ( EModifierNumLock | EModifierKeypad ) ) 
+                == ( EModifierNumLock | EModifierKeypad ) );
+    
+    if(  simulatedByDialer && iQwertyHandler->IsQwertyInput() )
+        {
+        // When dialler key was pressed and
+        // qwerty is open and editor is alphanumeric
+        //  -Dont let FEP to handle key events 
+        //    -> Multitapping doesnt work
+        //    -> Numbers are inserted to dialler without modifications
+        // Also effects # / * - key handling 
+        iStateMachine->State()->HandleKeyEventL( aKeyEvent, aType );
+        response = EKeyWasConsumed;
+        }
+    
     return response;
     }