src/hbplugins/inputmethods/touchinput/hbinputprediction12keyhandler.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
--- a/src/hbplugins/inputmethods/touchinput/hbinputprediction12keyhandler.cpp	Fri Jun 11 13:58:22 2010 +0300
+++ b/src/hbplugins/inputmethods/touchinput/hbinputprediction12keyhandler.cpp	Wed Jun 23 18:33:25 2010 +0300
@@ -44,8 +44,8 @@
 #include "hbinputabstractbase.h"
 #include "hbinputprediction12keyhandler_p.h"
 
-#define HbDeltaHeight 3.0
-#define MAXUDBWORDSIZE 64
+static const qreal HbDeltaHeight = 3.0;
+static const qint16 MAXUDBWORDSIZE = 64;
 
 HbInputPrediction12KeyHandlerPrivate::HbInputPrediction12KeyHandlerPrivate()
 :mLastKey(0),
@@ -84,9 +84,10 @@
     if (keyEvent->isAutoRepeat() && mLastKey == buttonId) {
         if (buttonId == HbInputButton::ButtonKeyCodeAsterisk) {
             //Remove the "?" mark if present
-            chopQMarkAndUpdateEditor();
-            q->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
-            mInputMethod->selectSpecialCharacterTableMode();
+            if (!mCanContinuePrediction) {
+                chopQMarkAndUpdateEditor();
+            }	
+            mInputMethod->switchMode(buttonId);
             mLongPressHappened = true;
         } else if (buttonId == HbInputButton::ButtonKeyCodeShift) {
             mInputMethod->switchMode(HbInputButton::ButtonKeyCodeShift);
@@ -120,7 +121,7 @@
     }
 
     if (buttonId == HbInputButton::ButtonKeyCodeShift) {
-        // if we get a second consequtive shift key press, 
+        // if we get a second consecutive shift key press, 
         // we want to handle it in buttonRelease
         if (mTimer->isActive() && (mLastKey == buttonId)){
             mShiftKeyDoubleTap = true;
@@ -149,6 +150,11 @@
     mButtonDown = false;
     int buttonId = keyEvent->key(); 
 
+	// short key press of character keys should not be handled when "?" is displayed
+    if (!mCanContinuePrediction && !mLongPressHappened &&
+		buttonId >= Qt::Key_1 && buttonId <= Qt::Key_9) {
+        return false;
+    }	
     // Sym key is handled in this class it self, so not passing it to 
     // the base mode handlers.	
     if (buttonId == HbInputButton::ButtonKeyCodeSymbol ||
@@ -170,7 +176,6 @@
             (*mCandidates)[mBestGuessLocation].chop(1);
             updateEditor();
             q->launchSpellQueryDialog();
-            mCanContinuePrediction = true;
         } else {
             mInputMethod->starKeySelected();
         }
@@ -213,7 +218,10 @@
         }
         return true;
     }
-
+	// ButtonKeyCodeSettings should not be propagated to the engine
+    if(buttonId == HbInputButton::ButtonKeyCodeSettings) {
+        return true;
+    }
     if (buttonId != HbInputButton::ButtonKeyCodeDelete &&
         mInputMethod->currentKeyboardType() == HbKeyboardSctPortrait) {
         q->sctCharacterSelected(QChar(buttonId));