src/hbplugins/inputmethods/touchinput/virtual12key.cpp
changeset 6 c3690ec91ef8
parent 5 627c4a0fd0e7
child 7 923ff622b8b9
--- a/src/hbplugins/inputmethods/touchinput/virtual12key.cpp	Fri Jun 11 13:58:22 2010 +0300
+++ b/src/hbplugins/inputmethods/touchinput/virtual12key.cpp	Wed Jun 23 18:33:25 2010 +0300
@@ -98,6 +98,8 @@
             mBasicModeHandler, SLOT(actionHandler(HbInputModeAction )));
 
     connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)));
+    connect(HbInputSettingProxy::instance(), SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(autocompletionStateChanged(HbKeyboardSettingFlags,bool)));
+    mPredictionModeHandler->setAutocompletionStatus(HbInputSettingProxy::instance()->isAutocompletionEnabled(HbKeyboardSetting12key));
 }
 
 bool HbVirtual12Key::isSctModeActive() const
@@ -286,14 +288,15 @@
 */
 void HbVirtual12Key::openKeypad(HbInputVkbWidget * keypadToOpen,bool inMinimizedMode)
 {
+    // if null is sent, just return.
+    if(!keypadToOpen || !focusObject()) {
+        return;
+    }
+
     mKeyboardChangeAlreadyInprogress = true;
     HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
     mKeyboardChangeAlreadyInprogress = false;
 
-    // if null is sent, just return.
-    if(!keypadToOpen) {
-        return;
-    }
     bool disableAnimation = false;
     // see if we are trying to open a different keypad than what is already opened.
     if (mCurrentKeypad != keypadToOpen) {
@@ -329,8 +332,10 @@
         } else {
             mVkbHost->openKeypad(mCurrentKeypad, this, (!stateChangeInProgress() && !disableAnimation));
         }
-        connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)),
-                mVkbHost, SLOT(ensureCursorVisibility()));
+        if (focusObject()) {
+            connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)),
+                    mVkbHost, SLOT(ensureCursorVisibility()));
+        }
     }
 }
 
@@ -368,6 +373,13 @@
     }
 }
 
+void HbVirtual12Key::autocompletionStateChanged(HbKeyboardSettingFlags keyboardType, bool newState)
+{
+    if (keyboardType & HbKeyboardSetting12key) {
+        mPredictionModeHandler->setAutocompletionStatus(newState);
+    }
+}
+
 /*!
 Call back indicating that the keypad is closed.
 */
@@ -512,7 +524,7 @@
 
     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
 	if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
-        mActiveModeHandler = mPredictionModeHandler;
+        mActiveModeHandler = mPredictionModeHandler;        
         // by passing HbInputModeActionFocusRecieved we will be setting the candidate list and keypad
         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
     } else if (newState.inputMode() == HbInputModeDefault) {
@@ -553,7 +565,7 @@
 */
 void HbVirtual12Key::loadKeymap(const HbInputLanguage &newLanguage)
 {
-    //dont try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage
+    //don't try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage
     if (!mKeymap || mKeymap->language().language() != newLanguage.language()) {
         const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(newLanguage);
         if(keymap) {
@@ -809,15 +821,4 @@
     return false;
 }
 
-/*!
-This function returns true if the latest mouse release was part of a horizontal flick event
-*/
-HbInputVkbWidget::HbFlickDirection HbVirtual12Key::flickDirection() const
-{
-    if (mCurrentKeypad) {
-        return mCurrentKeypad->flickDirection();
-    } else {
-        return HbInputVkbWidget::HbFlickDirectionNone;
-    }
-}
 // End of file