aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-08-04 17:53:39 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2017-08-07 07:01:31 +0000
commit54aef7bc4a3609cf01fdb56ad7494bc8a339bab8 (patch)
treef015d8bdaf6da4d4f1fac390cabbd0ae45955572
parent0fc522d7b85ca7c833558fa8b95364a62638b2fa (diff)
Filter LipiInputMethod inputModes by input method hints
Since adding the new component InputModeKey in commit ea998f43d62ac12fd0f48a51683eb343ee1a52f1 certain tests (tst_plugin::test_hwrNumericInputSequence) started to fail. The reason for the failure is the LipiInputMethod which always returns all the supported input modes (Latin, Numeric and Digits) regardless of input method hints. This change modifies this behavior and limits the input modes to ones actually requested by input method hints. Change-Id: Iddc315a60541a879d2e655d0cbf4d65189026e8f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/virtualkeyboard/lipiinputmethod.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/virtualkeyboard/lipiinputmethod.cpp b/src/virtualkeyboard/lipiinputmethod.cpp
index a326f0d2..10dcb4ae 100644
--- a/src/virtualkeyboard/lipiinputmethod.cpp
+++ b/src/virtualkeyboard/lipiinputmethod.cpp
@@ -483,10 +483,19 @@ LipiInputMethod::~LipiInputMethod()
QList<InputEngine::InputMode> LipiInputMethod::inputModes(const QString &locale)
{
Q_UNUSED(locale)
- return QList<InputEngine::InputMode>()
- << InputEngine::Latin
- << InputEngine::Numeric
- << InputEngine::Dialable;
+ QList<InputEngine::InputMode> availableInputModes;
+ const Qt::InputMethodHints inputMethodHints(inputContext()->inputMethodHints());
+
+ if (inputMethodHints.testFlag(Qt::ImhDialableCharactersOnly) || inputMethodHints.testFlag(Qt::ImhDigitsOnly)) {
+ availableInputModes.append(InputEngine::Dialable);
+ } else if (inputMethodHints.testFlag(Qt::ImhFormattedNumbersOnly)) {
+ availableInputModes.append(InputEngine::Numeric);
+ } else {
+ availableInputModes.append(InputEngine::Latin);
+ availableInputModes.append(InputEngine::Numeric);
+ }
+
+ return availableInputModes;
}
bool LipiInputMethod::setInputMode(const QString &locale, InputEngine::InputMode inputMode)