diff --git a/scripting/scriptingutils.h b/scripting/scriptingutils.h
index 21d3cb5631..6477c3d880 100644
--- a/scripting/scriptingutils.h
+++ b/scripting/scriptingutils.h
@@ -26,9 +26,9 @@ along with this program. If not, see .
#include "screenedge.h"
#endif
-#include
-#include
+#include
#include
+#include
#include
#include
@@ -114,12 +114,10 @@ QScriptValue globalShortcut(QScriptContext *context, QScriptEngine *engine)
qDebug() << "Incorrect number of arguments! Expected: title, text, keySequence, callback";
return engine->undefinedValue();
}
- KActionCollection* actionCollection = new KActionCollection(script);
- QAction* a = actionCollection->addAction(context->argument(0).toString());
+ QAction* a = new QAction(script);
+ a->setObjectName(context->argument(0).toString());
a->setText(context->argument(1).toString());
-#if KWIN_QT5_PORTING
- a->setGlobalShortcut(KShortcut(context->argument(2).toString()));
-#endif
+ KGlobalAccel::self()->setShortcut(a, QList() << QKeySequence(context->argument(2).toString()));
script->registerShortcut(a, context->argument(3));
return engine->newVariant(true);
}