239 { |
239 { |
240 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
240 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
241 mVkbHost->closeKeypad(); |
241 mVkbHost->closeKeypad(); |
242 // set mCurrentKeypad to null. |
242 // set mCurrentKeypad to null. |
243 mCurrentKeypad = 0; |
243 mCurrentKeypad = 0; |
244 if (mCandidatePopup && mCandidatePopup->isVisible()) { |
244 if (mCandidatePopup) { |
245 mCandidatePopup->hide(); |
245 mCandidatePopup->hide(); |
246 } |
246 } |
247 } |
247 } |
248 } |
248 } |
249 |
249 |
251 { |
251 { |
252 // if null is sent, just return. |
252 // if null is sent, just return. |
253 if(!keypadToOpen) { |
253 if(!keypadToOpen) { |
254 return; |
254 return; |
255 } |
255 } |
|
256 bool wasKeypadOpen = false; |
256 // see if we are trying to open a different keypad than what is already opened. |
257 // see if we are trying to open a different keypad than what is already opened. |
257 if (mCurrentKeypad != keypadToOpen) { |
258 if (mCurrentKeypad != keypadToOpen) { |
258 // close currently open keypad. We always close keypad without animation |
259 // close currently open keypad. We always close keypad without animation |
259 // keypad should be closed with animation only when we loses focus and this is handled |
260 // keypad should be closed with animation only when we loses focus and this is handled |
260 // in focusLost function call. |
261 // in focusLost function call. |
261 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
262 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
262 mVkbHost->closeKeypad(false); |
263 mVkbHost->closeKeypad(false); |
|
264 // when their is a keypad that needs to be closed before opening the new keypad, we don't |
|
265 // want to animate the opening of new keypad. |
|
266 wasKeypadOpen = true; |
263 } |
267 } |
264 } |
268 } |
265 // Close candidate popup if open |
269 // Close candidate popup if open |
266 if (mCandidatePopup) { |
270 if (mCandidatePopup) { |
267 mCandidatePopup->hide(); |
271 mCandidatePopup->hide(); |
272 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) { |
276 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened) { |
273 connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed())); |
277 connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(keypadClosed())); |
274 if (inMinimizedMode) { |
278 if (inMinimizedMode) { |
275 mVkbHost->openMinimizedKeypad(mCurrentKeypad, this); |
279 mVkbHost->openMinimizedKeypad(mCurrentKeypad, this); |
276 } else { |
280 } else { |
277 mVkbHost->openKeypad(mCurrentKeypad, this); |
281 mVkbHost->openKeypad(mCurrentKeypad, this, !wasKeypadOpen); |
278 } |
282 } |
279 |
283 |
280 // If previous focused editor was numeric, prediction is disabled. |
284 // If previous focused editor was numeric, prediction is disabled. |
281 // Enable prediction if prediction was set in alpha editor prior |
285 // Enable prediction if prediction was set in alpha editor prior |
282 // to focusing numeric editor. |
286 // to focusing numeric editor. |
312 mActiveModeHandler->mouseHandler(x, event); |
316 mActiveModeHandler->mouseHandler(x, event); |
313 } |
317 } |
314 |
318 |
315 void HbVirtualQwerty::keypadClosed() |
319 void HbVirtualQwerty::keypadClosed() |
316 { |
320 { |
317 // by calling focuslost we will be committing the inline text. |
|
318 mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionFocusLost); |
|
319 |
|
320 if (mOrientationAboutToChange) { |
321 if (mOrientationAboutToChange) { |
321 mOrientationAboutToChange = false; |
322 mOrientationAboutToChange = false; |
322 } |
323 } |
323 } |
324 } |
324 |
325 |
325 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod) |
326 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod) |
326 { |
327 { |
327 Q_UNUSED(vkbCloseMethod); |
328 Q_UNUSED(vkbCloseMethod); |
328 if (isActiveMethod()) { |
329 if (isActiveMethod()) { |
329 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusMinimized) { |
330 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusMinimized) { |
330 mVkbHost->minimizeKeypad(!stateChangeInProgress()); |
331 // We need to commit the inline word when we minimize the keypad |
|
332 mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit); |
331 if (mCandidatePopup) { |
333 if (mCandidatePopup) { |
332 mCandidatePopup->hide(); |
334 mCandidatePopup->hide(); |
333 } |
335 } |
|
336 mVkbHost->minimizeKeypad(!stateChangeInProgress()); |
334 } |
337 } |
335 } |
338 } |
336 } |
339 } |
337 |
340 |
338 void HbVirtualQwerty::inputLanguageChanged(const HbInputLanguage &aNewLanguage) |
341 void HbVirtualQwerty::inputLanguageChanged(const HbInputLanguage &aNewLanguage) |
605 { |
608 { |
606 HbInputMethod::orientationAboutToChange(); |
609 HbInputMethod::orientationAboutToChange(); |
607 |
610 |
608 if (isActiveMethod()) { |
611 if (isActiveMethod()) { |
609 mOrientationAboutToChange = true; |
612 mOrientationAboutToChange = true; |
610 } |
613 // We need to commit the inline word before orientation change. |
611 closeKeypad(); |
614 mActiveModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionCommit); |
|
615 closeKeypad(); |
|
616 } |
612 } |
617 } |
613 |
618 |
614 /*! |
619 /*! |
615 This function is called during a long key press |
620 This function is called during a long key press |
616 for a long time. |
621 for a long time. |
685 default: |
690 default: |
686 break; |
691 break; |
687 } |
692 } |
688 } |
693 } |
689 |
694 |
|
695 /*! |
|
696 \deprecated HbVirtualQwerty::predictiveInputStatusChanged(int newStatus) |
|
697 is deprecated. Use predictiveInputStateChanged instead. |
|
698 */ |
690 void HbVirtualQwerty::predictiveInputStatusChanged(int newStatus) |
699 void HbVirtualQwerty::predictiveInputStatusChanged(int newStatus) |
691 { |
700 { |
|
701 predictiveInputStateChanged(HbKeyboardSettingQwerty, newStatus); |
|
702 } |
|
703 |
|
704 /*! |
|
705 The framework calls this method when the predictive input status changes. |
|
706 */ |
|
707 void HbVirtualQwerty::predictiveInputStateChanged(HbKeyboardSettingFlags keyboardType, bool newStatus) |
|
708 { |
692 Q_UNUSED(newStatus); |
709 Q_UNUSED(newStatus); |
693 |
710 |
694 HbInputFocusObject *focusedObject = focusObject(); |
711 if (keyboardType & HbKeyboardSettingQwerty) { |
695 if (focusedObject) { |
712 HbInputFocusObject *focusedObject = focusObject(); |
696 // Just refresh the situation. |
713 if (focusedObject) { |
697 inputStateActivated(inputState()); |
714 // Just refresh the situation. |
698 return; |
715 inputStateActivated(inputState()); |
|
716 } |
699 } |
717 } |
700 } |
718 } |
701 |
719 |
702 /*! |
720 /*! |
703 this function is called whenever there is a hardware keypress Or virtual keypad button is pressed. |
721 this function is called whenever there is a hardware keypress Or virtual keypad button is pressed. |
745 Returns true if prediction is on, prediction engine is available and predictions is allowed in current editor. |
763 Returns true if prediction is on, prediction engine is available and predictions is allowed in current editor. |
746 */ |
764 */ |
747 bool HbVirtualQwerty::usePrediction() const |
765 bool HbVirtualQwerty::usePrediction() const |
748 { |
766 { |
749 HbInputFocusObject *fo = focusObject(); |
767 HbInputFocusObject *fo = focusObject(); |
750 if (HbInputSettingProxy::instance()->predictiveInputStatus() && |
768 if (HbInputSettingProxy::instance()->predictiveInputStatus(HbKeyboardSettingQwerty) && |
751 fo && |
769 fo && |
752 fo->editorInterface().isPredictionAllowed() && |
770 fo->editorInterface().isPredictionAllowed() && |
753 mPredictionModeHandler->isActive() && |
771 mPredictionModeHandler->isActive() && |
754 HbPredictionFactory::instance()->predictionEngineForLanguage(inputState().language())) { |
772 HbPredictionFactory::instance()->predictionEngineForLanguage(inputState().language())) { |
755 return true; |
773 return true; |
756 } |
774 } |
757 |
775 |
758 return false; |
776 return false; |
759 } |
777 } |
760 |
778 |