Skip to content

Commit

Permalink
inputmethod: Drop imExtensionEvent method
Browse files Browse the repository at this point in the history
  • Loading branch information
dobey committed Jun 30, 2022
1 parent 3c2e5f1 commit e9079ae
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 40 deletions.
69 changes: 30 additions & 39 deletions src/plugin/inputmethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Qt::EnterKeyType>();

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);
Expand Down Expand Up @@ -459,6 +420,36 @@ void InputMethod::update()
checkAutocaps();
d->previous_position = position;
}

// Check for action key overrides
auto enterKeyType = inputMethodHost()->inputMethodQuery(Qt::ImEnterKeyType).value<Qt::EnterKeyType>();

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()
Expand Down
1 change: 0 additions & 1 deletion src/plugin/inputmethod.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QString, QSharedPointer<MKeyOverride> > &overrides) override;
//! \reimp_end

Expand Down

0 comments on commit e9079ae

Please sign in to comment.