From: Manuel Nickschas Date: Wed, 3 Feb 2016 21:50:02 +0000 (+0100) Subject: Fix shortcut handling with KDE Frameworks X-Git-Tag: travis-deploy-test~532 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=c878493af33f5d01e07360bebdbe06131ded5015;hp=b1eb0bfaa5019e3b5a58ff8086d22c2764d6e419 Fix shortcut handling with KDE Frameworks KDE Frameworks slightly altered the way it handles default shortcuts for actions; the property name was changed to support lists of shortcuts. This issue lead to default shortcuts not being active for Quassel built against KDE Frameworks. --- diff --git a/src/uisupport/action.cpp b/src/uisupport/action.cpp index c222dc19..216cac84 100644 --- a/src/uisupport/action.cpp +++ b/src/uisupport/action.cpp @@ -98,11 +98,12 @@ void Action::setShortcutConfigurable(bool b) QKeySequence Action::shortcut(ShortcutTypes type) const { Q_ASSERT(type); - if (type == DefaultShortcut) - return property("defaultShortcut").value(); + if (type == DefaultShortcut) { + auto sequence = property("defaultShortcuts").value>(); + return sequence.isEmpty() ? QKeySequence() : sequence.first(); + } - if (shortcuts().count()) return shortcuts().value(0); - return QKeySequence(); + return shortcuts().isEmpty() ? QKeySequence() : shortcuts().first(); } @@ -117,7 +118,7 @@ void Action::setShortcut(const QKeySequence &key, ShortcutTypes type) Q_ASSERT(type); if (type & DefaultShortcut) - setProperty("defaultShortcut", key); + setProperty("defaultShortcuts", QVariant::fromValue(QList() << key)); if (type & ActiveShortcut) QAction::setShortcut(key);