get rid of all delayedinit stuff

This commit is contained in:
Marco Martin 2013-02-05 16:00:12 +01:00
parent 584ccf15f4
commit 5f107d3fcb
4 changed files with 13 additions and 24 deletions

View File

@ -362,7 +362,7 @@ void Containment::restoreContents(KConfigGroup &group)
continue;
}
d->addApplet(plugin, QVariantList(), appletConfig.readEntry("geometry", QRectF()), appId, false);
d->addApplet(plugin, QVariantList(), appletConfig.readEntry("geometry", QRectF()), appId);
}
}
@ -507,9 +507,9 @@ Applet *Containment::addApplet(const QString &name, const QVariantList &args,
return d->addApplet(name, args, appletGeometry);
}
void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
void Containment::addApplet(Applet *applet, const QPointF &pos)
{
if (!isContainment() || (!delayInit && immutability() != Mutable)) {
if (!isContainment() || immutability() != Mutable) {
return;
}
@ -560,7 +560,7 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
connect(applet, SIGNAL(newStatus(Plasma::ItemStatus)), this, SLOT(checkStatus(Plasma::ItemStatus)));
connect(applet, SIGNAL(activate()), this, SIGNAL(activate()));
if (!delayInit && !currentContainment) {
if (!currentContainment) {
applet->restore(*applet->d->mainConfigGroup());
applet->init();
//FIXME: an on-appear animation would be nice to have again
@ -568,21 +568,16 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
}
applet->updateConstraints(Plasma::AllConstraints);
if (!delayInit) {
applet->flushPendingConstraintsEvents();
}
applet->flushPendingConstraintsEvents();
emit appletAdded(applet, pos);
if (!currentContainment) {
applet->updateConstraints(Plasma::StartupCompletedConstraint);
if (!delayInit) {
applet->flushPendingConstraintsEvents();
}
applet->flushPendingConstraintsEvents();
}
if (!delayInit) {
applet->d->scheduleModificationNotification();
}
applet->d->scheduleModificationNotification();
}
Applet::List Containment::applets() const

View File

@ -202,15 +202,10 @@ class PLASMA_EXPORT Containment : public Applet
/**
* Add an existing applet to this Containment
*
* If dontInit is true, the pending constraints are not flushed either.
* So it is your responsibility to call both init() and
* flushPendingConstraints() on the applet.
*
* @param applet the applet that should be added
* @param pos the containment-relative position
* @param dontInit if true, init() will not be called on the applet
*/
void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1), bool dontInit = true);
void addApplet(Applet *applet, const QPointF &pos = QPointF(-1, -1));
/**
* @return the applets currently in this Containment

View File

@ -391,13 +391,13 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra
}
Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &args,
const QRectF &appletGeometry, uint id, bool delayInit)
const QRectF &appletGeometry, uint id)
{
if (!q->isContainment()) {
return 0;
}
if (!delayInit && q->immutability() != Mutable) {
if (q->immutability() != Mutable) {
#ifndef NDEBUG
kDebug() << "addApplet for" << name << "requested, but we're currently immutable!";
#endif
@ -416,7 +416,7 @@ Applet *ContainmentPrivate::addApplet(const QString &name, const QVariantList &a
//kDebug() << applet->name() << "sizehint:" << applet->sizeHint() << "geometry:" << applet->geometry();
q->addApplet(applet, appletGeometry.topLeft(), delayInit);
q->addApplet(applet, appletGeometry.topLeft());
return applet;
}

View File

@ -95,8 +95,7 @@ public:
void configChanged();
Applet *addApplet(const QString &name, const QVariantList &args = QVariantList(),
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0,
bool delayedInit = false);
const QRectF &geometry = QRectF(-1, -1, -1, -1), uint id = 0);
KActionCollection *actions();