From 1649761e0dd7ebb4b967ed946e04e559f7dc91c7 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Mon, 25 Feb 2013 16:43:06 +0100 Subject: [PATCH] remove enableAction API; just use the KActionCollection --- src/plasma/applet.cpp | 9 --------- src/plasma/containment.cpp | 9 --------- src/plasma/containment.h | 8 -------- src/plasma/corona.cpp | 9 --------- src/plasma/corona.h | 8 -------- src/plasma/private/containment_p.cpp | 20 ++++++++++++-------- src/plasma/private/containment_p.h | 1 - 7 files changed, 12 insertions(+), 52 deletions(-) diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp index c10d0dc28..2d3a272df 100644 --- a/src/plasma/applet.cpp +++ b/src/plasma/applet.cpp @@ -914,15 +914,6 @@ bool Applet::isContainment() const return d->isContainment; } -// PRIVATE CLASS IMPLEMENTATION - - -void ContainmentPrivate::checkRemoveAction() -{ - q->enableAction("remove", q->immutability() == Mutable); -} - - } // Plasma namespace #include "moc_applet.cpp" diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index aa0e7c9cb..f7c1c05f9 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -450,15 +450,6 @@ int Containment::screen() const return d->screen; } -void Containment::enableAction(const QString &name, bool enable) -{ - QAction *action = actions()->action(name); - if (action) { - action->setEnabled(enable); - action->setVisible(enable); - } -} - void Containment::setDrawWallpaper(bool drawWallpaper) { d->drawWallpaper = drawWallpaper; diff --git a/src/plasma/containment.h b/src/plasma/containment.h index a5e6dadd3..89a569f13 100644 --- a/src/plasma/containment.h +++ b/src/plasma/containment.h @@ -160,14 +160,6 @@ class PLASMA_EXPORT Containment : public Applet */ void restore(KConfigGroup &group); - /** - * convenience function - enables or disables an action by name - * - * @param name the name of the action in our collection - * @param enable true to enable, false to disable - */ - void enableAction(const QString &name, bool enable); - /** * Return whether wallpaper is painted or not. */ diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index a25b15e59..0e02f81bc 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -361,15 +361,6 @@ KActionCollection *Corona::actions() const return &d->actions; } -void Corona::enableAction(const QString &name, bool enable) -{ - QAction *action = d->actions.action(name); - if (action) { - action->setEnabled(enable); - action->setVisible(enable); - } -} - void Corona::updateShortcuts() { QMutableListIterator > it(d->actionCollections); diff --git a/src/plasma/corona.h b/src/plasma/corona.h index 55cc8ed59..6fcea860e 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -164,14 +164,6 @@ public: */ QList freeEdges(int screen) const; - /** - * convenience function - enables or disables an action by name - * - * @param name the name of the action in our collection - * @param enable true to enable, false to disable - */ - void enableAction(const QString &name, bool enable); - /** * @since 4.3 * Updates keyboard shortcuts for all the CoronaBase's actions. diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index 601ad3015..194aaaf4e 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -143,8 +143,6 @@ void ContainmentPrivate::setScreen(int newScreen) swapScreensWith->setScreen(oldScreen); } - checkRemoveAction(); - if (newScreen >= 0) { emit q->activate(); } @@ -215,9 +213,19 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra //kDebug() << "got containmentConstraintsEvent" << constraints; if (constraints & Plasma::ImmutableConstraint) { //update actions - checkRemoveAction(); const bool unlocked = q->immutability() == Mutable; - q->enableAction("add widgets", unlocked); + + QAction *action = q->actions()->action("remove"); + if (action) { + action->setEnabled(unlocked); + action->setVisible(unlocked); + } + + action = q->actions()->action("add widgets"); + if (action) { + action->setEnabled(unlocked); + action->setVisible(unlocked); + } // tell the applets too foreach (Applet *a, applets) { @@ -241,10 +249,6 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra applet->updateConstraints(appletConstraints); } } - - if (constraints & Plasma::StartupCompletedConstraint && type < Plasma::CustomContainment) { - checkRemoveAction(); - } } Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &args, uint id) diff --git a/src/plasma/private/containment_p.h b/src/plasma/private/containment_p.h index f3eee7663..90faf7789 100644 --- a/src/plasma/private/containment_p.h +++ b/src/plasma/private/containment_p.h @@ -80,7 +80,6 @@ public: bool isPanelContainment() const; void setLockToolText(); void appletDeleted(Applet*); - void checkRemoveAction(); void configChanged(); Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(), uint id = 0);