remove enableAction API; just use the KActionCollection
This commit is contained in:
parent
a674a7b894
commit
1649761e0d
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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<QWeakPointer<KActionCollection> > it(d->actionCollections);
|
||||
|
@ -164,14 +164,6 @@ public:
|
||||
*/
|
||||
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
|
||||
* Updates keyboard shortcuts for all the CoronaBase's actions.
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user