Commit 8b2567b4 authored by Michael Abrahams's avatar Michael Abrahams

Handle two different "no custom shortcut" states

We distinguish between "use the default shortcut" and "turn off all
shortcuts for this action."

Maniphest Tasks: T2439
BUG: 362743
parent 8c5e55e6
......@@ -470,14 +470,20 @@ void KisActionRegistry::Private::loadCustomShortcuts(QString filename)
return;
}
// Distinguish between two "null" states for custom shortcuts.
for (auto i = actionInfoList.begin(); i != actionInfoList.end(); ++i) {
if (localShortcuts.hasKey(i.key())) {
QString entry = localShortcuts.readEntry(i.key(), QString());
if (entry != QStringLiteral("none")) {
if (entry == QStringLiteral("none")) {
// A shortcut list with a single entry "" means the user has disabled the shortcut.
// This occurs after stealing the shortcut without assigning a new one.
i.value().customShortcuts = QKeySequence::listFromString("")
} else {
i.value().customShortcuts = QKeySequence::listFromString(entry);
continue;
}
} else {
// An empty shortcut list means no custom shortcut has been set.
i.value().customShortcuts = QList<QKeySequence>();
}
i.value().customShortcuts = QList<QKeySequence>();
}
};
......@@ -81,9 +81,7 @@ KisShortcutsEditorDelegate::KisShortcutsEditorDelegate(QTreeWidget *parent, bool
connect(parent, SIGNAL(collapsed(QModelIndex)), this, SLOT(itemCollapsed(QModelIndex)));
}
void KisShortcutsEditorDelegate::stealShortcut(
const QKeySequence &seq,
QAction *action)
void KisShortcutsEditorDelegate::stealShortcut(const QKeySequence &seq, QAction *action)
{
QTreeWidget *view = static_cast<QTreeWidget *>(parent());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment