diff -r 923ff622b8b9 -r 4633027730f5 src/hbplugins/inputmethods/touchinput/virtual12key.cpp --- a/src/hbplugins/inputmethods/touchinput/virtual12key.cpp Tue Jul 06 14:36:53 2010 +0300 +++ b/src/hbplugins/inputmethods/touchinput/virtual12key.cpp Wed Aug 18 10:05:37 2010 +0300 @@ -66,7 +66,6 @@ mItutKeypad(0), mSctKeypad(0), mKeymap(0), - mOrientationAboutToChange(false), mCandidatePopup(0), mCurrentlyFocused(0), mVkbHost(0), @@ -165,7 +164,8 @@ void HbVirtual12Key::reset() { mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionReset); - mOrientationAboutToChange = false; + // close candidate popup if visible + closeCandidatePopup(); } Hb12KeyTouchKeyboard *HbVirtual12Key::construct12Keyboard() @@ -178,6 +178,7 @@ //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; } @@ -219,9 +220,7 @@ if (mCurrentlyFocused != focusObject()) { mCurrentlyFocused = focusObject(); // Focus changed from one editor to another. - if (mCandidatePopup) { - mCandidatePopup->hide(); - } + closeCandidatePopup(); } openKeypad(mItutKeypad); @@ -236,6 +235,9 @@ mActiveModeHandler, SLOT(cursorPositionChanged(int, int))); connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int))); + + disconnect(focusObject(), SIGNAL(orientationChanged()), this, SLOT(orientationChanged())); + connect(focusObject(), SIGNAL(orientationChanged()), this, SLOT(orientationChanged())); } HbInputAbstractMethod::focusReceived(); } @@ -263,6 +265,7 @@ closeKeypad(); mVkbHost = 0; } + HbInputAbstractMethod::focusLost(); } /*! @@ -274,9 +277,7 @@ mVkbHost->closeKeypad(!stateChangeInProgress()); // set mCurrentKeypad to null. mCurrentKeypad = 0; - if (mCandidatePopup) { - mCandidatePopup->hide(); - } + closeCandidatePopup(); } } @@ -307,10 +308,9 @@ disableAnimation = true; } } + // Close candidate popup if open - if (mCandidatePopup) { - mCandidatePopup->hide(); - } + closeCandidatePopup(); QObject::disconnect(mCurrentKeypad,SIGNAL(aboutToActivateCustomAction(HbAction*)), this,SLOT(aboutToActivateCustomAction(HbAction*))); @@ -334,6 +334,10 @@ mVkbHost, SLOT(ensureCursorVisibility())); } } + + if(mActiveModeHandler) { + mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionSetKeypad); + } } /*! @@ -372,7 +376,7 @@ void HbVirtual12Key::autocompletionStateChanged(HbKeyboardSettingFlags keyboardType, bool newState) { - if (keyboardType & HbKeyboardSetting12key) { + if ( isActiveMethod() && (keyboardType & HbKeyboardSetting12key) ) { mPredictionModeHandler->setAutocompletionStatus(newState); } } @@ -382,7 +386,6 @@ */ void HbVirtual12Key::keypadClosed() { - mOrientationAboutToChange = false; } /*! @@ -403,9 +406,8 @@ if (mVkbHost->keypadStatus() == HbVkbHost::HbVkbStatusOpened) { // We need to commit the inline word when we minimize the keypad mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit); - if (mCandidatePopup) { - mCandidatePopup->hide(); - } + // close candiatelist popup if visisble. + closeCandidatePopup(); // Close input. QInputContext* ic = qApp->inputContext(); @@ -529,6 +531,9 @@ 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 */ + mPredictionModeHandler->setAutocompletionStatus(HbInputSettingProxy::instance()->isAutocompletionEnabled(HbKeyboardSetting12key)); } else if (newState.inputMode() == HbInputModeDefault) { mActiveModeHandler = mBasicModeHandler; // Auto completer setup needs following line. @@ -624,13 +629,9 @@ */ void HbVirtual12Key::switchMode(int keyCode) { - if (keyCode == HbInputButton::ButtonKeyCodeAsterisk || - keyCode == HbInputButton::ButtonKeyCodeSymbol || - keyCode == HbInputButton::ButtonKeyCodeAlphabet) { - if (mCandidatePopup && mCandidatePopup->isVisible()) { - return; - } - + if (keyCode == HbInputButton::ButtonKeyCodeAsterisk && mCandidatePopup && mCandidatePopup->isVisible() && mCandidatePopup->isModal()) { + return; + } else if (keyCode == HbInputButton::ButtonKeyCodeAsterisk || keyCode == HbInputButton::ButtonKeyCodeSymbol || keyCode == HbInputButton::ButtonKeyCodeAlphabet) { if (mCurrentKeypad == mSctKeypad){ // if sct is active keypad, then launch itu-t keypad switchToAlphaMode(); @@ -682,19 +683,15 @@ } /*! -The call back from framework to indicate that the orientation is about to change. This closes the keypad -if it is already open. +The call back from framework to indicate that the orientation is changed. */ -void HbVirtual12Key::orientationAboutToChange() +void HbVirtual12Key::orientationChanged() { - HbInputMethod::orientationAboutToChange(); - if (isActiveMethod()) { - mOrientationAboutToChange = true; - mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCloseSpellQuery); - // We need to commit the inline word before orientation change. - mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit); - closeKeypad(); - } + //Close the spell Query if it is visible + //During the change of orientation focus is locked by the framework and hence the spell query + //cannot be closed. Closing spell query should result in change of focus back to the previous editor + //which is not possible if focus is locked. + mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCloseSpellQuery); } /*! @@ -704,8 +701,9 @@ { if (!mCandidatePopup) { 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())); } mCandidatePopup->populateList(candidates,true); mCandidatePopup->setModal(true); @@ -765,7 +763,7 @@ } /*! -Slot used by mode handlers to close the candidate popup. +Closes the candidate popup if visible. */ void HbVirtual12Key::closeCandidatePopup() { @@ -789,6 +787,7 @@ { if (!mCandidatePopup) { 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())); } @@ -802,8 +801,8 @@ mCandidatePopup->setBackgroundFaded(false); mCandidatePopup->show(); } - } else if (mCandidatePopup->isVisible()) { - mCandidatePopup->hide(); + } else { + closeCandidatePopup(); } } @@ -823,4 +822,8 @@ return false; } +void HbVirtual12Key::restorePreviousState() +{ + mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionRestorePreviousState); +} // End of file