From e9079aee82c62702c4aefed1a9b717d0d6ec7fe7 Mon Sep 17 00:00:00 2001 From: Rodney Dawes Date: Thu, 30 Jun 2022 15:52:21 -0400 Subject: [PATCH] inputmethod: Drop imExtensionEvent method --- src/plugin/inputmethod.cpp | 69 +++++++++++++++++--------------------- src/plugin/inputmethod.h | 1 - 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/plugin/inputmethod.cpp b/src/plugin/inputmethod.cpp index 60966d5b..a8f76741 100644 --- a/src/plugin/inputmethod.cpp +++ b/src/plugin/inputmethod.cpp @@ -260,45 +260,6 @@ void InputMethod::handleClientChange() hide(); } -bool InputMethod::imExtensionEvent(MImExtensionEvent *event) -{ - Q_D(InputMethod); - - if (not event or event->type() != MImExtensionEvent::Update) { - return false; - } - - auto enterKeyType = inputMethodHost()->inputMethodQuery(Qt::ImEnterKeyType).value(); - - d->actionKeyOverrider.reset(new MKeyOverride(actionKeyName)); - switch (enterKeyType) { - case Qt::EnterKeyDefault: - case Qt::EnterKeyReturn: - d->actionKeyOverrider->setLabel(QString()); - break; - case Qt::EnterKeyDone: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Done")); - break; - case Qt::EnterKeyGo: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Go")); - break; - case Qt::EnterKeySend: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Send")); - break; - case Qt::EnterKeySearch: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Search")); - break; - case Qt::EnterKeyNext: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Next")); - break; - case Qt::EnterKeyPrevious: - d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Previous")); - break; - } - emit actionKeyOverrideChanged(); - return true; -} - void InputMethod::onAutoCorrectSettingChanged() { Q_D(InputMethod); @@ -459,6 +420,36 @@ void InputMethod::update() checkAutocaps(); d->previous_position = position; } + + // Check for action key overrides + auto enterKeyType = inputMethodHost()->inputMethodQuery(Qt::ImEnterKeyType).value(); + + d->actionKeyOverrider.reset(new MKeyOverride(actionKeyName)); + switch (enterKeyType) { + case Qt::EnterKeyDefault: + case Qt::EnterKeyReturn: + d->actionKeyOverrider->setLabel(QString()); + break; + case Qt::EnterKeyDone: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Done")); + break; + case Qt::EnterKeyGo: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Go")); + break; + case Qt::EnterKeySend: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Send")); + break; + case Qt::EnterKeySearch: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Search")); + break; + case Qt::EnterKeyNext: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Next")); + break; + case Qt::EnterKeyPrevious: + d->actionKeyOverrider->setLabel(d->m_gettext->qsTr("Previous")); + break; + } + emit actionKeyOverrideChanged(); } void InputMethod::updateWordEngine() diff --git a/src/plugin/inputmethod.h b/src/plugin/inputmethod.h index 87d66056..66ea195b 100644 --- a/src/plugin/inputmethod.h +++ b/src/plugin/inputmethod.h @@ -97,7 +97,6 @@ class InputMethod void handleAppOrientationChanged(int angle) override; void handleClientChange() override; void reset() override; - bool imExtensionEvent(MImExtensionEvent *event) override; void setKeyOverrides(const QMap > &overrides) override; //! \reimp_end