aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-05-12 00:14:58 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-05-15 16:00:24 +0000
commitae8c8fdf92df18849376b943955063b5d5723454 (patch)
tree5a45ab7c4bce920efb6355d5f419c4e10efe00fd /src/virtualkeyboard
parente4595b6a04d28def801fb70dec5222914453ee14 (diff)
Hunspell: Update selection list status when loading dictionary
HunspellInputMethod must update selection list status immediately after dictionary starts load. This issue should not cause issues in normal use, but it will cause automatic tests to fail with lipi-toolkit. This is because LipiInputMethod uses HunspellInputMethod for spell correction and suggestions. The automated tests rely on selection list status when deciding if spell correction is available or not. The failing tests was test_hwrWordReselection_data. Also, fix incorrect debug stating dictionary could not be found. Change-Id: Ic6c3526a494fb60dde234c000ed9bd0d70f53335 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/virtualkeyboard')
-rw-r--r--src/virtualkeyboard/hunspellinputmethod.cpp2
-rw-r--r--src/virtualkeyboard/hunspellinputmethod_p.cpp1
-rw-r--r--src/virtualkeyboard/hunspellworker.cpp3
3 files changed, 4 insertions, 2 deletions
diff --git a/src/virtualkeyboard/hunspellinputmethod.cpp b/src/virtualkeyboard/hunspellinputmethod.cpp
index 5cd88c2e..be1a8ce9 100644
--- a/src/virtualkeyboard/hunspellinputmethod.cpp
+++ b/src/virtualkeyboard/hunspellinputmethod.cpp
@@ -163,7 +163,7 @@ QList<SelectionListModel::Type> HunspellInputMethod::selectionLists()
{
Q_D(const HunspellInputMethod);
Qt::InputMethodHints inputMethodHints = inputContext()->inputMethodHints();
- if (d->dictionaryState != HunspellInputMethodPrivate::DictionaryReady || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || inputMethodHints.testFlag(Qt::ImhHiddenText))
+ if (d->dictionaryState == HunspellInputMethodPrivate::DictionaryNotLoaded || inputMethodHints.testFlag(Qt::ImhNoPredictiveText) || inputMethodHints.testFlag(Qt::ImhHiddenText))
return QList<SelectionListModel::Type>();
return QList<SelectionListModel::Type>() << SelectionListModel::WordCandidateList;
}
diff --git a/src/virtualkeyboard/hunspellinputmethod_p.cpp b/src/virtualkeyboard/hunspellinputmethod_p.cpp
index 2512337d..90a60dd5 100644
--- a/src/virtualkeyboard/hunspellinputmethod_p.cpp
+++ b/src/virtualkeyboard/hunspellinputmethod_p.cpp
@@ -94,6 +94,7 @@ bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(new HunspellLoadDictionaryTask(locale, searchPaths));
QObject::connect(loadDictionaryTask.data(), &HunspellLoadDictionaryTask::completed, q, &HunspellInputMethod::dictionaryLoadCompleted);
dictionaryState = HunspellInputMethodPrivate::DictionaryLoading;
+ emit q->selectionListsChanged();
hunspellWorker->addTask(loadDictionaryTask);
this->locale = locale;
}
diff --git a/src/virtualkeyboard/hunspellworker.cpp b/src/virtualkeyboard/hunspellworker.cpp
index 1a6d18ef..ff937578 100644
--- a/src/virtualkeyboard/hunspellworker.cpp
+++ b/src/virtualkeyboard/hunspellworker.cpp
@@ -89,7 +89,6 @@ void HunspellLoadDictionaryTask::run()
}
if (!affPath.isEmpty() && !dicPath.isEmpty()) {
- VIRTUALKEYBOARD_DEBUG() << "Hunspell dictionary is missing for the" << locale << "language. Search paths" << searchPaths;
*hunspellPtr = Hunspell_create(affPath.toUtf8().constData(), dicPath.toUtf8().constData());
if (*hunspellPtr) {
/* Make sure the encoding used by the dictionary is supported
@@ -105,6 +104,8 @@ void HunspellLoadDictionaryTask::run()
#ifdef QT_VIRTUALKEYBOARD_DEBUG
VIRTUALKEYBOARD_DEBUG() << "HunspellLoadDictionaryTask::run(): time:" << perf.elapsed() << "ms";
#endif
+ } else {
+ VIRTUALKEYBOARD_DEBUG() << "Hunspell dictionary is missing for" << locale << ". Search paths" << searchPaths;
}
emit completed(*hunspellPtr != 0);