84 |
84 |
85 // autocompleter connection |
85 // autocompleter connection |
86 connect(this, SIGNAL(autoCompletionPopupClosed(QString, int)), mBasicModeHandler, SLOT(autoCompletionPopupClosed(QString, int))); |
86 connect(this, SIGNAL(autoCompletionPopupClosed(QString, int)), mBasicModeHandler, SLOT(autoCompletionPopupClosed(QString, int))); |
87 |
87 |
88 connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool))); |
88 connect(HbInputSettingProxy::instance(), SIGNAL(predictiveInputStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(predictiveInputStateChanged(HbKeyboardSettingFlags,bool))); |
|
89 connect(HbInputSettingProxy::instance(), SIGNAL(primaryCandidateModeChanged(HbPrimaryCandidateMode)), this, SLOT(primaryCandidateModeChanged(HbPrimaryCandidateMode))); |
|
90 connect(HbInputSettingProxy::instance(), SIGNAL(autocompletionStateChanged(HbKeyboardSettingFlags,bool)), this, SLOT(autocompletionStateChanged(HbKeyboardSettingFlags,bool))); |
|
91 connect(HbInputSettingProxy::instance(), SIGNAL(typingCorrectionLevelChanged(HbTypingCorrectionLevel)), this, SLOT(typingCorrectionLevelChanged(HbTypingCorrectionLevel))); |
|
92 mPredictionModeHandler->setPrimaryCandidateMode(HbInputSettingProxy::instance()->primaryCandidateMode()); |
|
93 mPredictionModeHandler->setAutocompletionStatus(HbInputSettingProxy::instance()->isAutocompletionEnabled(HbKeyboardSettingQwerty)); |
|
94 mPredictionModeHandler->setTypingCorrectionLevel(HbInputSettingProxy::instance()->typingCorrectionLevel()); |
89 } |
95 } |
90 |
96 |
91 // --------------------------------------------------------------------------- |
97 // --------------------------------------------------------------------------- |
92 // HbVirtualQwerty::~HbVirtualQwerty |
98 // HbVirtualQwerty::~HbVirtualQwerty |
93 // |
99 // |
216 |
222 |
217 if (focusObject()) { |
223 if (focusObject()) { |
218 disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int))); |
224 disconnect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mActiveModeHandler, SLOT(cursorPositionChanged(int, int))); |
219 } |
225 } |
220 |
226 |
|
227 closeExactWordPopup(); |
221 if (!focusSwitch) { |
228 if (!focusSwitch) { |
222 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
229 if (mVkbHost && mVkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
223 // Context switch has happened but the keypad is still open. |
230 // Context switch has happened but the keypad is still open. |
224 // Close it. |
231 // Close it. |
225 closeKeypad(); |
232 closeKeypad(); |
240 } |
247 } |
241 |
248 |
242 void HbVirtualQwerty::openKeypad(HbInputVkbWidget * keypadToOpen,bool inMinimizedMode ) |
249 void HbVirtualQwerty::openKeypad(HbInputVkbWidget * keypadToOpen,bool inMinimizedMode ) |
243 { |
250 { |
244 // if null is sent, just return. |
251 // if null is sent, just return. |
245 if(!keypadToOpen) { |
252 if(!keypadToOpen || !focusObject()) { |
246 return; |
253 return; |
247 } |
254 } |
248 bool disableAnimation = false; |
255 bool disableAnimation = false; |
249 // see if we are trying to open a different keypad than what is already opened. |
256 // see if we are trying to open a different keypad than what is already opened. |
250 if (mCurrentKeypad != keypadToOpen) { |
257 if (mCurrentKeypad != keypadToOpen) { |
277 mVkbHost->openMinimizedKeypad(mCurrentKeypad, this); |
284 mVkbHost->openMinimizedKeypad(mCurrentKeypad, this); |
278 } else { |
285 } else { |
279 mVkbHost->openKeypad(mCurrentKeypad, this, !disableAnimation); |
286 mVkbHost->openKeypad(mCurrentKeypad, this, !disableAnimation); |
280 } |
287 } |
281 |
288 |
282 connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), mVkbHost, SLOT(ensureCursorVisibility())); |
289 if (focusObject()) { |
|
290 connect(&(focusObject()->editorInterface()), SIGNAL(cursorPositionChanged(int, int)), |
|
291 mVkbHost, SLOT(ensureCursorVisibility())); |
|
292 } |
283 } |
293 } |
284 } |
294 } |
285 |
295 |
286 /*! |
296 /*! |
287 vkb widget is about to call a custom action that is mapped to one of the keypad buttons. |
297 vkb widget is about to call a custom action that is mapped to one of the keypad buttons. |
333 void HbVirtualQwerty::keypadClosed() |
343 void HbVirtualQwerty::keypadClosed() |
334 { |
344 { |
335 if (mOrientationAboutToChange) { |
345 if (mOrientationAboutToChange) { |
336 mOrientationAboutToChange = false; |
346 mOrientationAboutToChange = false; |
337 } |
347 } |
338 if (mExactWordPopup && mExactWordPopup->isVisible()) { |
348 if (mVkbHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized) { |
339 mExactWordPopup->hide(); |
349 closeExactWordPopup(); |
340 } |
350 } |
341 } |
351 } |
342 |
352 |
343 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod) |
353 void HbVirtualQwerty::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod vkbCloseMethod) |
344 { |
354 { |
365 mCurrentKeypad->keypadLanguageChangeAnimationUpdate(0); |
375 mCurrentKeypad->keypadLanguageChangeAnimationUpdate(0); |
366 } |
376 } |
367 // load the new key keymappings for newLanguage to all keypads and all mode handlers |
377 // load the new key keymappings for newLanguage to all keypads and all mode handlers |
368 loadKeymap(aNewLanguage); |
378 loadKeymap(aNewLanguage); |
369 |
379 |
370 if (mCurrentKeypad && mCurrentKeypad != mQwertyAlphaKeypad |
380 if (focusObject() && mCurrentKeypad) { |
371 && mCurrentKeypad != mQwertyNumericKeypad) { |
381 if (mCurrentKeypad != mQwertyAlphaKeypad && mCurrentKeypad != mQwertyNumericKeypad) { |
|
382 mCurrentKeypad->animKeyboardChange(); |
|
383 openKeypad(mQwertyAlphaKeypad); |
|
384 } |
372 mCurrentKeypad->animKeyboardChange(); |
385 mCurrentKeypad->animKeyboardChange(); |
373 openKeypad(mQwertyAlphaKeypad); |
386 } |
374 } |
|
375 |
|
376 mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionPrimaryLanguageChanged); |
387 mPredictionModeHandler->actionHandler(HbInputModeHandler::HbInputModeActionPrimaryLanguageChanged); |
377 if (mCurrentKeypad){ |
|
378 mCurrentKeypad->animKeyboardChange(); |
|
379 } |
|
380 |
|
381 } |
388 } |
382 |
389 |
383 void HbVirtualQwerty::inputStateActivated(const HbInputState& newState) |
390 void HbVirtualQwerty::inputStateActivated(const HbInputState& newState) |
384 { |
391 { |
385 |
392 |
435 keymappings,loads them to all avaialble keyboards and to all mode handlers |
442 keymappings,loads them to all avaialble keyboards and to all mode handlers |
436 */ |
443 */ |
437 void HbVirtualQwerty::loadKeymap(const HbInputLanguage &newLanguage) |
444 void HbVirtualQwerty::loadKeymap(const HbInputLanguage &newLanguage) |
438 { |
445 { |
439 // inform all the mode handler about the language change. |
446 // inform all the mode handler about the language change. |
440 //dont try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage |
447 //don't try to get the keymappings if we ( mKeyData) already have keymappings for newLanguage |
441 if (!mKeymap || mKeymap->language() != newLanguage) { |
448 if (!mKeymap || mKeymap->language() != newLanguage) { |
442 |
449 |
443 const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(newLanguage); |
450 const HbKeymap* keymap = HbKeymapFactory::instance()->keymap(newLanguage); |
444 if (keymap) { |
451 if (keymap) { |
445 mKeymap = keymap; |
452 mKeymap = keymap; |
681 inputStateActivated(inputState()); |
688 inputStateActivated(inputState()); |
682 } |
689 } |
683 } |
690 } |
684 } |
691 } |
685 |
692 |
|
693 void HbVirtualQwerty::primaryCandidateModeChanged(HbPrimaryCandidateMode mode) |
|
694 { |
|
695 mPredictionModeHandler->setPrimaryCandidateMode(mode); |
|
696 } |
|
697 |
|
698 void HbVirtualQwerty::autocompletionStateChanged(HbKeyboardSettingFlags keyboardType, bool newState) |
|
699 { |
|
700 if (keyboardType & HbKeyboardSettingQwerty) { |
|
701 mPredictionModeHandler->setAutocompletionStatus(newState); |
|
702 } |
|
703 } |
|
704 |
|
705 void HbVirtualQwerty::typingCorrectionLevelChanged(HbTypingCorrectionLevel correctionLevel) |
|
706 { |
|
707 mPredictionModeHandler->setTypingCorrectionLevel(correctionLevel); |
|
708 } |
686 /*! |
709 /*! |
687 this function is called whenever there is a hardware keypress Or virtual keypad button is pressed. |
710 this function is called whenever there is a hardware keypress Or virtual keypad button is pressed. |
688 */ |
711 */ |
689 bool HbVirtualQwerty::filterEvent(const QEvent* event) |
712 bool HbVirtualQwerty::filterEvent(const QEvent* event) |
690 { |
713 { |
701 */ |
724 */ |
702 void HbVirtualQwerty::launchExactWordPopup(QString exactWord) |
725 void HbVirtualQwerty::launchExactWordPopup(QString exactWord) |
703 { |
726 { |
704 if (!mExactWordPopup) { |
727 if (!mExactWordPopup) { |
705 mExactWordPopup = HbExactWordPopup::instance(); |
728 mExactWordPopup = HbExactWordPopup::instance(); |
706 connect(mExactWordPopup, SIGNAL(exactWordSelected()), mPredictionModeHandler, SLOT(exactWordPopupClosed())); |
729 connect(mExactWordPopup, SIGNAL(exactWordSelected()), mPredictionModeHandler, SLOT(exactWordSelected())); |
707 } |
730 } |
708 mExactWordPopup->setText(exactWord); |
731 mExactWordPopup->setText(exactWord); |
709 mExactWordPopup->showText(getCursorCoordinatePosition()); |
732 mExactWordPopup->showText(getCursorCoordinatePosition()); |
710 } |
733 } |
711 |
734 |