Skip to content

Commit

Permalink
fix: shortcut modify failed
Browse files Browse the repository at this point in the history
modify failed when new shortcut accels(Supper+X) contains old shortcut accels(Supper)
requestRestore is only emitted when "press" is false, to handle self-conflicts
pms: Bug-289101
  • Loading branch information
kegechen committed Dec 24, 2024
1 parent db3a2d6 commit 0103871
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/plugin-keyboard/operation/keyboardcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ KeyboardController::KeyboardController(QObject *parent)

ShortcutInfo *conflict = m_shortcutModel->getInfo(shortcut);

if (conflict && conflict == current && conflict->accels == current->accels) {
Q_EMIT requestRestore();
return;
}

if (!press) {
if (shortcut.isEmpty()) {
Q_EMIT requestRestore();
Expand All @@ -45,8 +40,13 @@ KeyboardController::KeyboardController(QObject *parent)
return;
}

// have conflict
if (conflict) {
// have conflict
// self conflict
if (conflict == current && conflict->accels == current->accels) {
Q_EMIT requestRestore();
return;
}

auto conflictName = QString("<font color=\"red\">%1</font>").arg(conflict->name);
QString text = KeyboardController::tr("This shortcut conflicts with [%1]").arg(conflictName);
Expand Down

0 comments on commit 0103871

Please sign in to comment.