aboutsummaryrefslogtreecommitdiffstats
path: root/src/virtualkeyboard/hunspellinputmethod_p.cpp
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-01-06 11:14:07 +0200
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-01-20 17:37:41 +0000
commit839a0afec5c39c92ac7221e2c5b6a866d6848382 (patch)
tree12a6bf83805af3cecc2887518d4ce12098dac817 /src/virtualkeyboard/hunspellinputmethod_p.cpp
parente2c4fde1804654e449465aee1b9d217e05f06075 (diff)
Automatically hide word candidate list
This change adds support for automatically hiding word candidate list when inactive. This feature includes the following enhancements: - Added new settings: * VirtualKeyboardSettings.wordCandidateList.autoHideDelay * VirtualKeyboardSettings.wordCandidateList.alwaysVisible - Automatic hiding of word candidate list when inactive and when autoHideDelay elapsed. - alwaysVisible setting restores the old functionality. - Added new signal selectionListsChanged() to input method, allowing the input method to dynamically allocate or deallocate selection lists. - HunspellInputMethod does not allocate selection list when dictionary cannot be loaded, or Qt::ImhNoPredictiveText is enabled. Also, it will no longer use pre-edit text in this case. - OpenWnnInputMethod does not allocate selection list if not needed. [ChangeLog] Automatically hide word candidate list when inactive. Change-Id: Ifa95ae8a7c47a96719ffdc2929601ff2ef9c0d2e Reviewed-by: Gordan Markus <gordan.markus@pelagicore.com> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/virtualkeyboard/hunspellinputmethod_p.cpp')
-rw-r--r--src/virtualkeyboard/hunspellinputmethod_p.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/virtualkeyboard/hunspellinputmethod_p.cpp b/src/virtualkeyboard/hunspellinputmethod_p.cpp
index 34f343d3..2512337d 100644
--- a/src/virtualkeyboard/hunspellinputmethod_p.cpp
+++ b/src/virtualkeyboard/hunspellinputmethod_p.cpp
@@ -53,7 +53,8 @@ HunspellInputMethodPrivate::HunspellInputMethodPrivate(HunspellInputMethod *q_pt
activeWordIndex(-1),
wordCompletionPoint(2),
ignoreUpdate(false),
- autoSpaceAllowed(false)
+ autoSpaceAllowed(false),
+ dictionaryState(DictionaryNotLoaded)
{
if (hunspellWorker)
hunspellWorker->start();
@@ -65,6 +66,7 @@ HunspellInputMethodPrivate::~HunspellInputMethodPrivate()
bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
{
+ Q_Q(HunspellInputMethod);
if (!hunspellWorker)
return false;
if (this->locale != locale) {
@@ -90,6 +92,8 @@ bool HunspellInputMethodPrivate::createHunspell(const QString &locale)
searchPaths.append(defaultPath);
}
QSharedPointer<HunspellLoadDictionaryTask> loadDictionaryTask(new HunspellLoadDictionaryTask(locale, searchPaths));
+ QObject::connect(loadDictionaryTask.data(), &HunspellLoadDictionaryTask::completed, q, &HunspellInputMethod::dictionaryLoadCompleted);
+ dictionaryState = HunspellInputMethodPrivate::DictionaryLoading;
hunspellWorker->addTask(loadDictionaryTask);
this->locale = locale;
}
@@ -110,7 +114,7 @@ void HunspellInputMethodPrivate::reset()
bool HunspellInputMethodPrivate::updateSuggestions()
{
bool wordCandidateListChanged = false;
- if (!word.isEmpty()) {
+ if (!word.isEmpty() && dictionaryState != HunspellInputMethodPrivate::DictionaryNotLoaded) {
if (hunspellWorker)
hunspellWorker->removeAllTasksExcept<HunspellLoadDictionaryTask>();
if (wordCandidates.isEmpty()) {