diff --git a/src/scripting/scripting.cpp b/src/scripting/scripting.cpp index 7ad1a86c3a..a17e03013a 100644 --- a/src/scripting/scripting.cpp +++ b/src/scripting/scripting.cpp @@ -624,27 +624,6 @@ void KWin::JSEngineGlobalMethodsWrapper::registerWindow(QQuickWindow *window) } } -bool KWin::JSEngineGlobalMethodsWrapper::registerShortcut(const QString &name, const QString &text, const QKeySequence &keys, QJSValue function) -{ - if (!function.isCallable()) { - qCDebug(KWIN_SCRIPTING) << "Fourth and final argument must be a javascript function"; - return false; - } - - QAction *a = new QAction(this); - a->setObjectName(name); - a->setText(text); - const QKeySequence shortcut = QKeySequence(keys); - KGlobalAccel::self()->setShortcut(a, QList{shortcut}); - - connect(a, &QAction::triggered, this, [=]() mutable { - QJSValueList arguments; - arguments << Scripting::self()->qmlEngine()->toScriptValue(a); - function.call(arguments); - }); - return true; -} - KWin::Scripting *KWin::Scripting::s_self = nullptr; KWin::Scripting *KWin::Scripting::create(QObject *parent) diff --git a/src/scripting/scripting.h b/src/scripting/scripting.h index 39b47aada9..ce209c3bca 100644 --- a/src/scripting/scripting.h +++ b/src/scripting/scripting.h @@ -299,7 +299,6 @@ public: public Q_SLOTS: QVariant readConfig(const QString &key, QVariant defaultValue = QVariant()); void registerWindow(QQuickWindow *window); - bool registerShortcut(const QString &name, const QString &text, const QKeySequence &keys, QJSValue function); private: DeclarativeScript *m_script;