387 } |
387 } |
388 |
388 |
389 void HbInputPredictionHandlerPrivate::init() |
389 void HbInputPredictionHandlerPrivate::init() |
390 { |
390 { |
391 mEngine = 0; |
391 mEngine = 0; |
392 HbInputLanguage language = HbInputSettingProxy::instance()->globalInputLanguage(); |
392 HbInputLanguage language = mInputMethod->inputState().language(); |
393 mEngine = HbPredictionFactory::instance()->predictionEngineForLanguage(language.language()); |
393 if(!language.language()) { |
|
394 language = HbInputSettingProxy::instance()->globalInputLanguage(); |
|
395 } |
|
396 mEngine = HbPredictionFactory::instance()->predictionEngineForLanguage(language.language()); |
394 if (mEngine && !mCandidates) { |
397 if (mEngine && !mCandidates) { |
395 mCandidates = new QStringList(); |
398 mCandidates = new QStringList(); |
396 } |
399 } |
397 } |
400 } |
398 |
401 |
834 |
837 |
835 Q_D(HbInputPredictionHandler); |
838 Q_D(HbInputPredictionHandler); |
836 // set the focus back to the editor which caused the launch of spell dialog. |
839 // set the focus back to the editor which caused the launch of spell dialog. |
837 HbInputFocusObject *newFocusObject = new HbInputFocusObject(savedFocusObject); |
840 HbInputFocusObject *newFocusObject = new HbInputFocusObject(savedFocusObject); |
838 newFocusObject->releaseFocus(); |
841 newFocusObject->releaseFocus(); |
839 newFocusObject->setFocus(); |
842 if(HbInputMethod::activeInputMethod()->isFocusLocked()) { |
|
843 HbInputMethod::activeInputMethod()->unlockFocus(); |
|
844 newFocusObject->setFocus(); |
|
845 HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject); |
|
846 HbInputMethod::activeInputMethod()->lockFocus(); |
|
847 } else { |
|
848 newFocusObject->setFocus(); |
|
849 HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject); |
|
850 } |
840 HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(savedFocusObject); |
851 HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(savedFocusObject); |
841 if(abstractEdit) { |
852 if(abstractEdit) { |
842 abstractEdit->setCursorPosition(abstractEdit->cursorPosition()); |
853 abstractEdit->setCursorPosition(abstractEdit->cursorPosition()); |
843 } |
|
844 if(HbInputMethod::activeInputMethod()->isFocusLocked()) { |
|
845 HbInputMethod::activeInputMethod()->unlockFocus(); |
|
846 HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject); |
|
847 HbInputMethod::activeInputMethod()->lockFocus(); |
|
848 } else { |
|
849 HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject); |
|
850 } |
854 } |
851 |
855 |
852 if (closeReason == HbInputSpellQuery::HbOkPressed) { |
856 if (closeReason == HbInputSpellQuery::HbOkPressed) { |
853 d->commit(string,true); |
857 d->commit(string,true); |
854 } else if(closeReason == HbInputSpellQuery::HbCancelPressed) { |
858 } else if(closeReason == HbInputSpellQuery::HbCancelPressed) { |