src/hbplugins/inputmethods/touchinput/virtual12key.cpp
changeset 23 e6ad4ef83b23
parent 21 4633027730f5
child 30 80e4d18b72f5
--- a/src/hbplugins/inputmethods/touchinput/virtual12key.cpp	Wed Aug 18 10:05:37 2010 +0300
+++ b/src/hbplugins/inputmethods/touchinput/virtual12key.cpp	Thu Sep 02 20:44:51 2010 +0300
@@ -68,8 +68,7 @@
                 mKeymap(0),
                 mCandidatePopup(0),
                 mCurrentlyFocused(0),
-                mVkbHost(0),
-                mKeyboardChangeAlreadyInprogress(false)
+                mVkbHost(0)
 {
     initializeModeHandlers();
 }
@@ -79,7 +78,7 @@
     mBasicModeHandler = new HbInputBasic12KeyHandler(this);
     mPredictionModeHandler = new HbInputPrediction12KeyHandler(this);
     mNumericModeHandler = new HbInputNumeric12KeyHandler(this);
-	   
+       
     mActiveModeHandler = mBasicModeHandler;
 
     mBasicModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionInit);
@@ -123,7 +122,7 @@
     delete mPredictionModeHandler;
     mPredictionModeHandler = 0;
     delete mNumericModeHandler;
-    mNumericModeHandler = 0;	
+    mNumericModeHandler = 0;    
 }
 
 /*!
@@ -173,13 +172,11 @@
     Hb12KeyTouchKeyboard *tempKeypad = new Hb12KeyTouchKeyboard(this, mKeymap);
     connect(tempKeypad, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)),
             this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
-    connect(tempKeypad, SIGNAL(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)),
-            this, SLOT(rockerDirection(int, HbInputVirtualRocker::RockerSelectionMode)));
     //FLICKDISABLED connect(tempKeypad, SIGNAL(flickEvent(HbInputVkbWidget::FlickDirection)), this, SLOT(flickEvent(HbInputVkbWidget::FlickDirection)));
     connect(tempKeypad, SIGNAL(smileySelected(QString)), this, SLOT(smileySelected(QString)));
     connect(tempKeypad, SIGNAL(mouseMovedOutOfButton()), this, SLOT(mouseMovedOutOfButton()));
     connect(tempKeypad, SIGNAL(settingsListClosed()), this, SLOT(restorePreviousState()));
-    tempKeypad->setRockerVisible(true);
+
     return tempKeypad;
 }
 
@@ -291,10 +288,6 @@
         return;
     }
 
-    mKeyboardChangeAlreadyInprogress = true;
-    HbInputSettingProxy::instance()->setActiveKeyboard(HbKeyboardVirtual12Key);
-    mKeyboardChangeAlreadyInprogress = false;
-
     bool disableAnimation = false;
     // see if we are trying to open a different keypad than what is already opened.
     if (mCurrentKeypad != keypadToOpen) {
@@ -422,51 +415,6 @@
 }
 
 /*!
-The rocker widget emits the signal rockerDirection when there is any rocker movement. This method catches the emitted
-signal and makes the cursor movements according to the rcker movement.
-*/
-void HbVirtual12Key::rockerDirection(int aDirection, HbInputVirtualRocker::RockerSelectionMode aSelectionMode)
-{
-    Qt::KeyboardModifiers modifiers = 0;
-    if (aSelectionMode == HbInputVirtualRocker::RockerSelectionModeOn) {
-        modifiers = Qt::ShiftModifier;
-    }
-    // commit any character/word which is in inline edit.
-    mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
-
-    HbInputLanguage inputlang = HbInputSettingProxy::instance()->globalInputLanguage();
-
-    switch (aDirection) {
-    case HbInputVirtualRocker::HbRockerDirectionLeft:
-        if (inputlang.isRightToLeftLanguage()) {
-            focusObject()->cursorRight(modifiers);
-        } else {
-            focusObject()->cursorLeft(modifiers);
-        }
-        break;
-    case HbInputVirtualRocker::HbRockerDirectionRight:
-        if (inputlang.isRightToLeftLanguage()) {
-            focusObject()->cursorLeft(modifiers);
-        } else {
-            focusObject()->cursorRight(modifiers);
-        }
-        break;
-    case HbInputVirtualRocker::HbRockerDirectionUp: {
-        QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Up, modifiers);
-        focusObject()->sendEvent(keyEvent);
-        }
-        break;
-    case HbInputVirtualRocker::HbRockerDirectionDown: {
-        QKeyEvent keyEvent(QEvent::KeyPress, Qt::Key_Down, modifiers);
-        focusObject()->sendEvent(keyEvent);
-        }
-        break;
-    default:
-        break;
-    }
-}
-
-/*!
 Notification from the generic input method framework indicating a change of input language.
 The VKB keypad needs to refreshed to show the renewed key mapping.
 */
@@ -509,7 +457,7 @@
 */
 void HbVirtual12Key::inputStateActivated(const HbInputState& newState)
 {
-    if (!isActiveMethod() || mKeyboardChangeAlreadyInprogress) {
+    if (!isActiveMethod()) {
         return;  // Just to be sure...
     }
 
@@ -527,12 +475,12 @@
     }
 
     HbInputModeHandler *previousModeHandler = mActiveModeHandler;
-	if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
+    if (newState.inputMode() == HbInputModeDefault && usePrediction()) {
         mActiveModeHandler = mPredictionModeHandler;        
         // by passing HbInputModeActionFocusRecieved we will be setting the candidate list and keypad
         mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusRecieved);
-		/* The below line should be added in orientationChanged Slot, however currently it is not working correctly
-		 hence this fix is temporarily added here */
+        /* The below line should be added in orientationChanged Slot, however currently it is not working correctly
+         hence this fix is temporarily added here */
         mPredictionModeHandler->setAutocompletionStatus(HbInputSettingProxy::instance()->isAutocompletionEnabled(HbKeyboardSetting12key));
     } else if (newState.inputMode() == HbInputModeDefault) {
         mActiveModeHandler = mBasicModeHandler;
@@ -593,7 +541,7 @@
             }
             if(mNumericModeHandler) {
                 mNumericModeHandler->setKeymap(mKeymap);
-            }			
+            }           
         }
     }
 }
@@ -636,8 +584,16 @@
             // if sct is active keypad, then launch itu-t keypad
             switchToAlphaMode();
         } else {
-            // launch special character keypad
-            displaySpecialCharacterTable(this);
+             if (keyCode == HbInputButton::ButtonKeyCodeSymbol && HbInputSettingProxy::instance()->globalInputLanguage().language() == QLocale::Chinese) {
+                 HbInputLanguage primaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage();
+                 HbInputMethod::activeInputMethod()->activateState(HbInputState(HbInputModeDefault,
+                                       HbTextCaseAutomatic,
+                                       HbKeyboardTouchPortrait,
+                                       primaryInputLanguage));
+             } else {
+                 // launch special character keypad
+                 displaySpecialCharacterTable(this);
+             }
         }
     } else if (keyCode == HbInputButton::ButtonKeyCodeShift) {
         HbInputState nextState = inputState();
@@ -663,8 +619,7 @@
         connect(mSctKeypad, SIGNAL(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)),
                 this, SLOT(keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod)));
         connect(mSctKeypad, SIGNAL(smileySelected(QString)),
-                this, SLOT(smileySelected(QString)));
-        mSctKeypad->setRockerVisible(false);
+                this, SLOT(smileySelected(QString)));     
     }
     mSctKeypad->setMode(EModeAbc, HbModifierNone);
     //Open the keypad
@@ -789,7 +744,7 @@
         mCandidatePopup = new HbCandidateList(this);
         connect(mCandidatePopup, SIGNAL(candidatePopupCancelled()), this, SLOT(restorePreviousState()));
         connect(mCandidatePopup, SIGNAL(candidateSelected(int,QString)), this, SLOT(candidatePopupClosed(int,QString)));
-        QObject::connect(mCandidatePopup,SIGNAL(launchSpellQueryDialog()),mPredictionModeHandler,SLOT(launchSpellQueryDialog()));		
+        QObject::connect(mCandidatePopup,SIGNAL(launchSpellQueryDialog()),mPredictionModeHandler,SLOT(launchSpellQueryDialog()));       
     }
 
     if (candidates.count() > 0) {