From 29b2776ee4e7bb86313ecd3c021b674619ac7393 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Fri, 12 Dec 2008 01:05:00 +0000 Subject: [PATCH] carefully save applets on creation, prevents losing new applets right after adding them svn path=/trunk/KDE/kdelibs/; revision=895934 --- applet.cpp | 13 +++++++++---- containment.cpp | 19 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/applet.cpp b/applet.cpp index 0967ac36f..93f69eaab 100644 --- a/applet.cpp +++ b/applet.cpp @@ -183,18 +183,23 @@ void Applet::save(KConfigGroup &g) const group = *d->mainConfigGroup(); } - kDebug() << "saving to" << group.name(); + //kDebug() << "saving to" << group.name(); // we call the dptr member directly for locked since isImmutable() // also checks kiosk and parent containers group.writeEntry("immutability", (int)d->immutability); 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 // screen affinity (e.g. "bottom of screen 0") //kDebug() << pluginName() << "geometry is" << geometry() // << "pos is" << pos() << "bounding rect is" << boundingRect(); - group.writeEntry("geometry", geometry()); - group.writeEntry("zvalue", zValue()); - if (transform() == QTransform()) { group.deleteEntry("transform"); } else { diff --git a/containment.cpp b/containment.cpp index dab4da216..4746c8e87 100644 --- a/containment.cpp +++ b/containment.cpp @@ -748,15 +748,24 @@ void Containment::addApplet(Applet *applet, const QPointF &pos, bool delayInit) applet->updateConstraints(Plasma::AllConstraints); - if (!currentContainment) { - applet->updateConstraints(Plasma::StartupCompletedConstraint); - } - if (!delayInit) { applet->flushPendingConstraintsEvents(); } 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 @@ -1762,8 +1771,6 @@ void ContainmentPrivate::positionContainments() qSort(containments.begin(), containments.end(), containmentSortByPosition); it.toFront(); - int toolBoxMargin = 0; - int column = 0; int x = 0; int y = 0;