Commit 1800d327 authored by David Redondo's avatar David Redondo 🏎

Only allow multi key shortcuts for standard shortcuts

KGlobalAccel can only handle key sequences with one key combination.
parent 23d22131
......@@ -171,6 +171,8 @@ QVariant BaseModel::data(const QModelIndex &index, int role) const
}
case IsDefaultRole:
return action.activeShortcuts == action.defaultShortcuts;
case SupportsMultipleKeysRole:
return true;
}
return QVariant();
}
......@@ -233,6 +235,7 @@ QHash<int, QByteArray> BaseModel::roleNames() const
{CustomShortcutsRole, QByteArrayLiteral("customShortcuts")},
{CheckedRole, QByteArrayLiteral("checked")},
{PendingDeletionRole, QByteArrayLiteral("pendingDeletion")},
{IsDefaultRole, QByteArrayLiteral("isDefault")}
{IsDefaultRole, QByteArrayLiteral("isDefault")},
{SupportsMultipleKeysRole, QByteArrayLiteral("supportsMultipleKeys")}
};
}
......@@ -60,7 +60,8 @@ public:
CustomShortcutsRole,
CheckedRole,
PendingDeletionRole,
IsDefaultRole
IsDefaultRole,
SupportsMultipleKeysRole
};
Q_ENUM(Roles)
......
......@@ -50,6 +50,14 @@ GlobalAccelModel::GlobalAccelModel(KGlobalAccelInterface *interface, QObject *pa
{
}
QVariant GlobalAccelModel::data(const QModelIndex &index, int role) const
{
if (role == SupportsMultipleKeysRole) {
return false;
}
return BaseModel::data(index, role);
}
void GlobalAccelModel::load()
{
if (!m_globalAccelInterface->isValid()) {
......
......@@ -42,6 +42,8 @@ public:
GlobalAccelModel(KGlobalAccelInterface *interface, QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role) const override;
void addApplication(const QString &desktopFileName, const QString &displayName);
void exportToConfig(const KConfigBase &config) override;
......
......@@ -137,6 +137,7 @@ Kirigami.AbstractListItem {
KeySequenceItem {
keySequence: modelData
showClearButton: false
multiKeyShortcutsAllowed: supportsMultipleKeys
checkForConflictsAgainst: ShortcutType.None
onCaptureFinished: {
kcm.requestKeySequence(this, originalIndex, keySequence, modelData)
......@@ -178,6 +179,7 @@ Kirigami.AbstractListItem {
signal finished
KeySequenceItem {
showClearButton: false
multiKeyShortcutsAllowed: model.supportsMultipleKeys
checkForConflictsAgainst: ShortcutType.None
onCaptureFinished: {
kcm.requestKeySequence(this, originalIndex, keySequence)
......
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