src/hbplugins/inputmethods/touchinput/virtualqwerty.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 6 c3690ec91ef8
equal deleted inserted replaced
3:11d3954df52a 5:627c4a0fd0e7
   156             state.setTextCase(HbTextCaseLower);
   156             state.setTextCase(HbTextCaseLower);
   157         }
   157         }
   158         else if (automaticTextCaseNeeded()) {
   158         else if (automaticTextCaseNeeded()) {
   159             state.setTextCase(HbTextCaseAutomatic);
   159             state.setTextCase(HbTextCaseAutomatic);
   160         }
   160         }
   161         state.inputMode() = HbInputModeDefault;
   161         state.setInputMode(HbInputModeDefault);
   162         activateState(state);
   162         activateState(state);
   163         inputStateToEditor(state);
   163         inputStateToEditor(state);
   164     }
   164     }
   165 
   165 
   166     // load the new keymappings to all keypads and all mode handlers
   166     // load the new keymappings to all keypads and all mode handlers
   205 
   205 
   206     if (focusObject()) {
   206     if (focusObject()) {
   207         disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   207         disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   208         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   208         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int)));
   209     }
   209     }
       
   210     HbInputAbstractMethod::focusReceived();
   210 }
   211 }
   211 
   212 
   212 void HbVirtualQwerty::focusLost(bool focusSwitch)
   213 void HbVirtualQwerty::focusLost(bool focusSwitch)
   213 {
   214 {
   214     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusLost);
   215     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusLost);
   242 {
   243 {
   243     // if null is sent, just return.
   244     // if null is sent, just return.
   244     if(!keypadToOpen) {
   245     if(!keypadToOpen) {
   245         return;
   246         return;
   246     }
   247     }
   247     bool wasKeypadOpen = false;
   248     bool disableAnimation = false;
   248     // see if we are trying to open a different keypad than what is already opened.
   249     // see if we are trying to open a different keypad than what is already opened.
   249     if (mCurrentKeypad != keypadToOpen) {
   250     if (mCurrentKeypad != keypadToOpen) {
   250         // close currently open keypad. We always close keypad without animation
   251         // close currently open keypad. We always close keypad without animation
   251         // keypad should be closed with animation only when we loses focus and this is handled
   252         // keypad should be closed with animation only when we loses focus and this is handled
   252         // in focusLost function call.
   253         // in focusLost function call.
   253         if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) {
   254         if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) {
   254             mVkbHost->closeKeypad(false);
   255             mVkbHost->closeKeypad(false);
   255             // when their is a keypad that needs to be closed before opening the new keypad, we don't
   256             // when their is a keypad that needs to be closed before opening the new keypad, we don't
   256             // want to animate the opening of new keypad.
   257             // want to animate the opening of new keypad.
   257             wasKeypadOpen = true;
   258             disableAnimation = true;
   258         }
   259         }
   259     }
   260     }
   260     // Close candidate popup if open
   261     // Close candidate popup if open
   261     if (mCandidatePopup) {
   262     if (mCandidatePopup) {
   262         mCandidatePopup->hide();
   263         mCandidatePopup->hide();
   263     }
   264     }
       
   265 
       
   266     QObject::disconnect(mCurrentKeypad,SIGNAL(aboutToActivateCustomAction(HbAction*)),
       
   267         this,SLOT(aboutToActivateCustomAction(HbAction*)));
       
   268     QObject::connect(keypadToOpen,SIGNAL(aboutToActivateCustomAction(HbAction*)),
       
   269         this,SLOT(aboutToActivateCustomAction(HbAction*)));
       
   270 
   264     // assign new keypad to be opened to varable mCurrentKeypad
   271     // assign new keypad to be opened to varable mCurrentKeypad
   265     mCurrentKeypad =  keypadToOpen;
   272     mCurrentKeypad =  keypadToOpen;
   266 
   273 
   267     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
   274     if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) {
   268         connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed()));
   275         connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed()));
   269         if (inMinimizedMode) {
   276         if (inMinimizedMode) {
   270             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   277             mVkbHost->openMinimizedKeypad(mCurrentKeypad, this);
   271         } else {
   278         } else {
   272             mVkbHost->openKeypad(mCurrentKeypad, this, !wasKeypadOpen);
   279             mVkbHost->openKeypad(mCurrentKeypad, this, !disableAnimation);
   273         }
   280         }
   274 
   281 
   275         // If previous focused editor was numeric, prediction is disabled.
       
   276         // Enable prediction if prediction was set in alpha editor prior
       
   277         // to focusing numeric editor.
       
   278 /*        if (mPrevKeypadMode == EModeAbc && HbInputModeLatinPredictive == mPreviousInputMode) {
       
   279             mMode = HbInputModeLatinPredictive;
       
   280         } else if (mPrevKeypadMode == EModeNumeric && HbInputModeLatinPredictive == mMode) {
       
   281             // If the previous focused editor was alpha and if prediction is
       
   282             // on, disable prediction. Store the previous state because if
       
   283             // any alpha editor is focused next, the previous prediction state
       
   284             // should be enabled.
       
   285             mMode = HbInputModeDefault;
       
   286             mPreviousInputMode = HbInputModeLatinPredictive;
       
   287         }  */
       
   288         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   282         connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility()));
   289     }
   283     }
       
   284 }
       
   285 
       
   286 /*!
       
   287 vkb widget is about to call a custom action that is mapped to one of the keypad buttons.
       
   288 */
       
   289 void HbVirtualQwerty::aboutToActivateCustomAction(HbAction *custAction)
       
   290 {
       
   291     Q_UNUSED(custAction);
       
   292     mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit);
   290 }
   293 }
   291 
   294 
   292 HbInputVkbWidget* HbVirtualQwerty::constructKeyboard(HbKeypadMode currentInputType)
   295 HbInputVkbWidget* HbVirtualQwerty::constructKeyboard(HbKeypadMode currentInputType)
   293 {
   296 {
   294     HbInputVkbWidget *keyboard = 0;
   297     HbInputVkbWidget *keyboard = 0;
   330 void HbVirtualQwerty::keypadClosed()
   333 void HbVirtualQwerty::keypadClosed()
   331 {
   334 {
   332     if (mOrientationAboutToChange) {
   335     if (mOrientationAboutToChange) {
   333         mOrientationAboutToChange = false;
   336         mOrientationAboutToChange = false;
   334     }
   337     }
       
   338     if (mExactWordPopup && mExactWordPopup->isVisible()) {
       
   339         mExactWordPopup->hide();
       
   340     }	
   335 }
   341 }
   336 
   342 
   337 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod)
   343 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod)
   338 {
   344 {
   339     Q_UNUSED(vkbCloseMethod);
   345     Q_UNUSED(vkbCloseMethod);