diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2014-07-01 16:15:16 +0300 |
---|---|---|
committer | Kalle Viironen <kalle.viironen@digia.com> | 2014-07-01 16:44:53 +0300 |
commit | f359ce339222e9683965621b5835e0e44188ea1e (patch) | |
tree | 05fac9d1624b8c825f584563658116c1a48a542c | |
parent | faa4f63aaa6e20a317e3531b38b6c7a06fa496eb (diff) |
Add option to disable auto correction in HunspellInputMethodv1.1.0
The auto correction is disabled by default.
Change-Id: Iff8a7b619c3aed4eaa75de0791e601cbe9636125
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
-rw-r--r-- | src/virtualkeyboard/hunspellinputmethod.cpp | 1 | ||||
-rw-r--r-- | src/virtualkeyboard/hunspellworker.cpp | 2 | ||||
-rw-r--r-- | src/virtualkeyboard/hunspellworker.h | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/src/virtualkeyboard/hunspellinputmethod.cpp b/src/virtualkeyboard/hunspellinputmethod.cpp index 148fb691..7f78fa29 100644 --- a/src/virtualkeyboard/hunspellinputmethod.cpp +++ b/src/virtualkeyboard/hunspellinputmethod.cpp @@ -112,6 +112,7 @@ public: QSharedPointer<HunspellBuildSuggestionsTask> buildSuggestionsTask(new HunspellBuildSuggestionsTask()); buildSuggestionsTask->word = word; buildSuggestionsTask->wordList = wordList; + buildSuggestionsTask->autoCorrect = false; hunspellWorker->addTask(buildSuggestionsTask); QSharedPointer<HunspellUpdateSuggestionsTask> updateSuggestionsTask(new HunspellUpdateSuggestionsTask()); updateSuggestionsTask->wordList = wordList; diff --git a/src/virtualkeyboard/hunspellworker.cpp b/src/virtualkeyboard/hunspellworker.cpp index 9a35f4fb..eeee7c7c 100644 --- a/src/virtualkeyboard/hunspellworker.cpp +++ b/src/virtualkeyboard/hunspellworker.cpp @@ -79,7 +79,7 @@ void HunspellBuildSuggestionsTask::run() which may be suboptimal for the purpose, but gives some clue how much the suggested word differs from the given word. */ - if (wordList->list.length() > 1 && (!spellCheck(word) || suggestCapitalization)) { + if (autoCorrect && wordList->list.length() > 1 && (!spellCheck(word) || suggestCapitalization)) { if (lastWordCompletionIndex > firstWordCompletionIndex || levenshteinDistance(word, wordList->list.at(firstWordCompletionIndex)) < 3) wordList->index = firstWordCompletionIndex; } diff --git a/src/virtualkeyboard/hunspellworker.h b/src/virtualkeyboard/hunspellworker.h index 4ccadf74..aaadd6e1 100644 --- a/src/virtualkeyboard/hunspellworker.h +++ b/src/virtualkeyboard/hunspellworker.h @@ -61,6 +61,7 @@ class HunspellBuildSuggestionsTask : public HunspellTask public: QString word; QSharedPointer<HunspellWordList> wordList; + bool autoCorrect; void run(); bool spellCheck(const QString &word); |