diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-08-09 10:43:37 +0300 |
---|---|---|
committer | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2021-09-02 16:21:48 +0300 |
commit | 3d65eb1bd0a4b6e2468bdfcbbcd427c7d92763ad (patch) | |
tree | edd95ad8bdaf23651de77614cc9659d6351f0fa1 | |
parent | 31482b1386970484adf7d576967c561b71328f29 (diff) |
cerence: hwr: Add userDataReset handler
Bind to Settings::userDataReset signal and react as follows:
- Disconnect DLM
- Deactivate XT9
Both of these will be reactivated on the next focus change (setInputMode
call).
Pick-to: 6.2
Change-Id: I8e69fa2c972f644ed1a10cc1bf42e38768df8d01
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
-rw-r--r-- | src/plugins/cerence/cerence-hwr/plugin/t9writeinputmethod.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/plugins/cerence/cerence-hwr/plugin/t9writeinputmethod.cpp b/src/plugins/cerence/cerence-hwr/plugin/t9writeinputmethod.cpp index fbceceb9..10f2c0dc 100644 --- a/src/plugins/cerence/cerence-hwr/plugin/t9writeinputmethod.cpp +++ b/src/plugins/cerence/cerence-hwr/plugin/t9writeinputmethod.cpp @@ -295,15 +295,6 @@ public: &QVirtualKeyboardDictionaryManager::activeDictionariesChanged, this, &T9WriteInputMethodPrivate::onActiveDynamicDictionariesChanged); - onAvailableDynamicDictionariesChanged(); - onActiveDynamicDictionariesChanged(); - - const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints(); - if (!inputMethodHints.testFlag(Qt::ImhHiddenText) && !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && - !inputMethodHints.testFlag(Qt::ImhSensitiveData)) { - dlmActivate(); - } - #ifdef HAVE_XT9 bindSettings(); #endif @@ -468,13 +459,17 @@ public: defaultDictionaryDisabledChangedConnection = QObjectPrivate::connect( Settings::instance(), &Settings::defaultDictionaryDisabledChanged, this, &T9WriteInputMethodPrivate::onDefaultDictionaryDisabledChanged); - + if (!userDataResetConnection) + userDataResetConnection = QObjectPrivate::connect( + Settings::instance(), &Settings::userDataReset, + this, &T9WriteInputMethodPrivate::onUserDataReset); } void unbindSettings() { QObject::disconnect(defaultInputMethodDisabledChangedConnection); QObject::disconnect(defaultDictionaryDisabledChangedConnection); + QObject::disconnect(userDataResetConnection); } void onXt9AlphabeticCoreDisabledChanged() @@ -503,6 +498,14 @@ public: xt9AwIme->setLdbEnabled(!Settings::instance()->isDefaultDictionaryDisabled()); } + void onUserDataReset() + { + dlmDeactivate(); +#ifdef HAVE_XT9 + xt9Exit(); +#endif + } + ET9STATUS request(ET9_Request *const pRequest) override { Q_Q(T9WriteInputMethod); @@ -760,6 +763,15 @@ public: return false; } + onAvailableDynamicDictionariesChanged(); + onActiveDynamicDictionariesChanged(); + + const Qt::InputMethodHints inputMethodHints = q->inputContext()->inputMethodHints(); + if (!inputMethodHints.testFlag(Qt::ImhHiddenText) && !inputMethodHints.testFlag(Qt::ImhNoPredictiveText) && + !inputMethodHints.testFlag(Qt::ImhSensitiveData)) { + dlmActivate(); + } + int isLanguageSupported = 0; DECUMA_API(DatabaseIsLanguageSupported)(sessionSettings.pStaticDB, language, &isLanguageSupported); if (!isLanguageSupported) { @@ -2351,6 +2363,7 @@ public: QMetaObject::Connection defaultInputMethodDisabledChangedConnection; QMetaObject::Connection defaultDictionaryDisabledChangedConnection; #endif + QMetaObject::Connection userDataResetConnection; }; const DECUMA_MEM_FUNCTIONS T9WriteInputMethodPrivate::memFuncs = { |