/***************************************************************************
- * Copyright (C) 2005-2015 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include <QApplication>
Action::Action(QObject *parent)
-#ifdef HAVE_KDE4
- : KAction(parent)
-#else
: QWidgetAction(parent)
-#endif
{
init();
}
Action::Action(const QString &text, QObject *parent, const QObject *receiver, const char *slot, const QKeySequence &shortcut)
-#ifdef HAVE_KDE4
- : KAction(parent)
-#else
: QWidgetAction(parent)
-#endif
{
init();
setText(text);
Action::Action(const QIcon &icon, const QString &text, QObject *parent, const QObject *receiver, const char *slot, const QKeySequence &shortcut)
-#ifdef HAVE_KDE4
- : KAction(parent)
-#else
: QWidgetAction(parent)
-#endif
{
init();
setIcon(icon);
}
-#ifdef HAVE_KDE4
-void Action::init() {}
-#else
void Action::init()
{
connect(this, SIGNAL(triggered(bool)), this, SLOT(slotTriggered()));
QKeySequence Action::shortcut(ShortcutTypes type) const
{
Q_ASSERT(type);
- if (type == DefaultShortcut)
- return property("defaultShortcut").value<QKeySequence>();
+ if (type == DefaultShortcut) {
+ auto sequence = property("defaultShortcuts").value<QList<QKeySequence>>();
+ return sequence.isEmpty() ? QKeySequence() : sequence.first();
+ }
- if (shortcuts().count()) return shortcuts().value(0);
- return QKeySequence();
+ return shortcuts().isEmpty() ? QKeySequence() : shortcuts().first();
}
{
Q_ASSERT(type);
- if (type & DefaultShortcut)
- setProperty("defaultShortcut", key);
-
+ if (type & DefaultShortcut) {
+ setProperty("defaultShortcuts", QVariant::fromValue(QList<QKeySequence>() << key));
+ }
if (type & ActiveShortcut)
QAction::setShortcut(key);
}
-
-
-#endif /* HAVE_KDE4 */