carefully save applets on creation, prevents losing new applets right after adding them

svn path=/trunk/KDE/kdelibs/; revision=895934
This commit is contained in:
Aaron J. Seigo 2008-12-12 01:05:00 +00:00
parent 4ffa080061
commit 29b2776ee4
2 changed files with 22 additions and 10 deletions

View File

@ -183,18 +183,23 @@ void Applet::save(KConfigGroup &g) const
group = *d->mainConfigGroup(); group = *d->mainConfigGroup();
} }
kDebug() << "saving to" << group.name(); //kDebug() << "saving to" << group.name();
// we call the dptr member directly for locked since isImmutable() // we call the dptr member directly for locked since isImmutable()
// also checks kiosk and parent containers // also checks kiosk and parent containers
group.writeEntry("immutability", (int)d->immutability); group.writeEntry("immutability", (int)d->immutability);
group.writeEntry("plugin", pluginName()); group.writeEntry("plugin", pluginName());
group.writeEntry("geometry", geometry());
group.writeEntry("zvalue", zValue());
if (!d->started) {
return;
}
//FIXME: for containments, we need to have some special values here w/regards to //FIXME: for containments, we need to have some special values here w/regards to
// screen affinity (e.g. "bottom of screen 0") // screen affinity (e.g. "bottom of screen 0")
//kDebug() << pluginName() << "geometry is" << geometry() //kDebug() << pluginName() << "geometry is" << geometry()
// << "pos is" << pos() << "bounding rect is" << boundingRect(); // << "pos is" << pos() << "bounding rect is" << boundingRect();
group.writeEntry("geometry", geometry());
group.writeEntry("zvalue", zValue());
if (transform() == QTransform()) { if (transform() == QTransform()) {
group.deleteEntry("transform"); group.deleteEntry("transform");
} else { } else {

View File

@ -748,15 +748,24 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit)
applet->updateConstraints(Plasma::AllConstraints); applet->updateConstraints(Plasma::AllConstraints);
if (!currentContainment) {
applet->updateConstraints(Plasma::StartupCompletedConstraint);
}
if (!delayInit) { if (!delayInit) {
applet->flushPendingConstraintsEvents(); applet->flushPendingConstraintsEvents();
} }
emit appletAdded(applet, pos); emit appletAdded(applet, pos);
if (!delayInit) {
KConfigGroup cg;
applet->save(cg);
emit configNeedsSaving();
}
if (!currentContainment) {
applet->updateConstraints(Plasma::StartupCompletedConstraint);
if (!delayInit) {
applet->flushPendingConstraintsEvents();
}
}
} }
Applet::List Containment::applets() const Applet::List Containment::applets() const
@ -1762,8 +1771,6 @@ void ContainmentPrivate::positionContainments()
qSort(containments.begin(), containments.end(), containmentSortByPosition); qSort(containments.begin(), containments.end(), containmentSortByPosition);
it.toFront(); it.toFront();
int toolBoxMargin = 0;
int column = 0; int column = 0;
int x = 0; int x = 0;
int y = 0; int y = 0;