remove enableAction API; just use the KActionCollection

This commit is contained in:
Aaron Seigo 2013-02-25 16:43:06 +01:00
parent a674a7b894
commit 1649761e0d
7 changed files with 12 additions and 52 deletions

View File

@ -914,15 +914,6 @@ bool Applet::isContainment() const
return d->isContainment; return d->isContainment;
} }
// PRIVATE CLASS IMPLEMENTATION
void ContainmentPrivate::checkRemoveAction()
{
q->enableAction("remove", q->immutability() == Mutable);
}
} // Plasma namespace } // Plasma namespace
#include "moc_applet.cpp" #include "moc_applet.cpp"

View File

@ -450,15 +450,6 @@ int Containment::screen() const
return d->screen; 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) void Containment::setDrawWallpaper(bool drawWallpaper)
{ {
d->drawWallpaper = drawWallpaper; d->drawWallpaper = drawWallpaper;

View File

@ -160,14 +160,6 @@ class PLASMA_EXPORT Containment : public Applet
*/ */
void restore(KConfigGroup &group); 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. * Return whether wallpaper is painted or not.
*/ */

View File

@ -361,15 +361,6 @@ KActionCollection *Corona::actions() const
return &d->actions; 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() void Corona::updateShortcuts()
{ {
QMutableListIterator<QWeakPointer<KActionCollection> > it(d->actionCollections); QMutableListIterator<QWeakPointer<KActionCollection> > it(d->actionCollections);

View File

@ -164,14 +164,6 @@ public:
*/ */
QList<Plasma::Location> freeEdges(int screen) const; QList<Plasma::Location> 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 * @since 4.3
* Updates keyboard shortcuts for all the CoronaBase's actions. * Updates keyboard shortcuts for all the CoronaBase's actions.

View File

@ -143,8 +143,6 @@ void ContainmentPrivate::setScreen(int newScreen)
swapScreensWith->setScreen(oldScreen); swapScreensWith->setScreen(oldScreen);
} }
checkRemoveAction();
if (newScreen >= 0) { if (newScreen >= 0) {
emit q->activate(); emit q->activate();
} }
@ -215,9 +213,19 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
//kDebug() << "got containmentConstraintsEvent" << constraints; //kDebug() << "got containmentConstraintsEvent" << constraints;
if (constraints & Plasma::ImmutableConstraint) { if (constraints & Plasma::ImmutableConstraint) {
//update actions //update actions
checkRemoveAction();
const bool unlocked = q->immutability() == Mutable; 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 // tell the applets too
foreach (Applet *a, applets) { foreach (Applet *a, applets) {
@ -241,10 +249,6 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
applet->updateConstraints(appletConstraints); applet->updateConstraints(appletConstraints);
} }
} }
if (constraints & Plasma::StartupCompletedConstraint && type < Plasma::CustomContainment) {
checkRemoveAction();
}
} }
Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &args, uint id) Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &args, uint id)

View File

@ -80,7 +80,6 @@ public:
bool isPanelContainment() const; bool isPanelContainment() const;
void setLockToolText(); void setLockToolText();
void appletDeleted(Applet*); void appletDeleted(Applet*);
void checkRemoveAction();
void configChanged(); void configChanged();
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(), uint id = 0); Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(), uint id = 0);