diff --git a/scripting/scriptingutils.h b/scripting/scriptingutils.h index 2e04b33198..5213be7667 100644 --- a/scripting/scriptingutils.h +++ b/scripting/scriptingutils.h @@ -115,9 +115,11 @@ QScriptValue globalShortcut(QScriptContext *context, QScriptEngine *engine) return engine->undefinedValue(); } KActionCollection* actionCollection = new KActionCollection(script); - KAction* a = (KAction*)actionCollection->addAction(context->argument(0).toString()); + QAction* a = actionCollection->addAction(context->argument(0).toString()); a->setText(context->argument(1).toString()); +#if KWIN_QT5_PORTING a->setGlobalShortcut(KShortcut(context->argument(2).toString())); +#endif script->registerShortcut(a, context->argument(3)); return engine->newVariant(true); } diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 3c416f9ad9..3d5cbf4427 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -492,7 +492,7 @@ void TabBox::handlerReady() void TabBox::initShortcuts(KActionCollection* keys) { - KAction *a = NULL; + QAction *a = NULL; // The setGlobalShortcut(shortcut); shortcut = a->globalShortcut() // sequence is necessary in the case where the user has defined a @@ -502,7 +502,7 @@ void TabBox::initShortcuts(KActionCollection* keys) a->setText( i18n(name) ); \ shortcut = KShortcut(key); \ qobject_cast( a )->setGlobalShortcut(shortcut); \ - shortcut = a->globalShortcut(); \ + shortcut = qobject_cast( a )->globalShortcut(); \ connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); \ connect(a, SIGNAL(globalShortcutChanged(QKeySequence)), SLOT(shortcutSlot)); diff --git a/virtualdesktops.cpp b/virtualdesktops.cpp index 795ae671d8..63e85f3f6f 100644 --- a/virtualdesktops.cpp +++ b/virtualdesktops.cpp @@ -24,6 +24,7 @@ along with this program. If not, see . #include #include #include +#include #include namespace KWin { @@ -420,7 +421,7 @@ void VirtualDesktopManager::setNETDesktopLayout(Qt::Orientation orientation, uin void VirtualDesktopManager::initShortcuts(KActionCollection *keys) { - KAction *a = keys->addAction(QStringLiteral("Group:Desktop Switching")); + QAction *a = keys->addAction(QStringLiteral("Group:Desktop Switching")); a->setText(i18n("Desktop Switching")); initSwitchToShortcuts(keys); @@ -448,16 +449,20 @@ void VirtualDesktopManager::initSwitchToShortcuts(KActionCollection *keys) void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const KLocalizedString &label, uint value, const KShortcut &key, const char *slot) { - KAction *a = keys->addAction(name.arg(value), this, slot); + QAction *a = keys->addAction(name.arg(value), this, slot); a->setText(label.subs(value).toString()); +#if KWIN_QT5_PORTING a->setGlobalShortcut(key); +#endif a->setData(value); } void VirtualDesktopManager::addAction(KActionCollection *keys, const QString &name, const QString &label, const char *slot) { - KAction *a = keys->addAction(name, this, slot); + QAction *a = keys->addAction(name, this, slot); +#if KWIN_QT5_PORTING a->setGlobalShortcut(KShortcut()); +#endif a->setText(label); }