From d11c7535bafe7a9bae2d72ab003da77137a22b8f Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Sat, 16 Jan 2016 16:02:57 +0000 Subject: [PATCH] Add clearActions() to remove every applet interface action REVIEW: 126742 --- src/scriptengines/qml/plasmoid/appletinterface.cpp | 7 +++++++ src/scriptengines/qml/plasmoid/appletinterface.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/scriptengines/qml/plasmoid/appletinterface.cpp b/src/scriptengines/qml/plasmoid/appletinterface.cpp index 8e4979ae9..550438d05 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.cpp +++ b/src/scriptengines/qml/plasmoid/appletinterface.cpp @@ -499,6 +499,13 @@ void AppletInterface::removeAction(const QString &name) m_actions.removeAll(name); } +void AppletInterface::clearActions() +{ + Q_FOREACH (const QString &action, m_actions) { + removeAction(action); + } +} + QAction *AppletInterface::action(QString name) const { return applet()->actions()->action(name); diff --git a/src/scriptengines/qml/plasmoid/appletinterface.h b/src/scriptengines/qml/plasmoid/appletinterface.h index ad6849990..8dcac08ef 100644 --- a/src/scriptengines/qml/plasmoid/appletinterface.h +++ b/src/scriptengines/qml/plasmoid/appletinterface.h @@ -242,6 +242,8 @@ public: Q_INVOKABLE void removeAction(const QString &name); + Q_INVOKABLE void clearActions(); + Q_INVOKABLE QAction *action(QString name) const; /**