--- a/src/hbplugins/inputmethods/common/hbinputpredictionhandler.cpp Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbplugins/inputmethods/common/hbinputpredictionhandler.cpp Mon Oct 04 00:38:12 2010 +0300
@@ -389,8 +389,11 @@
void HbInputPredictionHandlerPrivate::init()
{
mEngine = 0;
- HbInputLanguage language = HbInputSettingProxy::instance()->globalInputLanguage();
- mEngine = HbPredictionFactory::instance()->predictionEngineForLanguage(language.language());
+ HbInputLanguage language = mInputMethod->inputState().language();
+ if(!language.language()) {
+ language = HbInputSettingProxy::instance()->globalInputLanguage();
+ }
+ mEngine = HbPredictionFactory::instance()->predictionEngineForLanguage(language.language());
if (mEngine && !mCandidates) {
mCandidates = new QStringList();
}
@@ -642,7 +645,7 @@
break;
case HbInputModeActionPrimaryLanguageChanged:
if(!d->mEngine) {
- d->init();
+ d->init();
}
if (d->mEngine) {
d->mEngine->setLanguage(HbInputSettingProxy::instance()->globalInputLanguage());
@@ -836,18 +839,19 @@
// set the focus back to the editor which caused the launch of spell dialog.
HbInputFocusObject *newFocusObject = new HbInputFocusObject(savedFocusObject);
newFocusObject->releaseFocus();
- newFocusObject->setFocus();
+ if(HbInputMethod::activeInputMethod()->isFocusLocked()) {
+ HbInputMethod::activeInputMethod()->unlockFocus();
+ newFocusObject->setFocus();
+ HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject);
+ HbInputMethod::activeInputMethod()->lockFocus();
+ } else {
+ newFocusObject->setFocus();
+ HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject);
+ }
HbAbstractEdit *abstractEdit = qobject_cast<HbAbstractEdit*>(savedFocusObject);
if(abstractEdit) {
abstractEdit->setCursorPosition(abstractEdit->cursorPosition());
}
- if(HbInputMethod::activeInputMethod()->isFocusLocked()) {
- HbInputMethod::activeInputMethod()->unlockFocus();
- HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject);
- HbInputMethod::activeInputMethod()->lockFocus();
- } else {
- HbInputMethod::activeInputMethod()->setFocusObject(newFocusObject);
- }
if (closeReason == HbInputSpellQuery::HbOkPressed) {
d->commit(string,true);
@@ -887,4 +891,16 @@
}
}
+
+void HbInputPredictionHandler::setLanguage(HbInputLanguage& language)
+{
+ Q_D(HbInputPredictionHandler);
+ if(!d->mEngine) {
+ d->init();
+ }
+ // set the engines language only if the current language is different
+ if(d->mEngine && d->mEngine->language().language() != language.language()) {
+ d->mEngine->setLanguage(language);
+ }
+}
// EOF