diff --git a/applet.cpp b/applet.cpp index 49db9327a..c92c87be5 100644 --- a/applet.cpp +++ b/applet.cpp @@ -181,6 +181,19 @@ void Applet::save(KConfigGroup &g) const KConfigGroup appletConfigGroup(&group, "Configuration"); if (extender()) { + //This would probably be nicer if it was located in extender. But in it's dtor, this won't + //work since when that get's called, the applet's config() isn't accesible anymore. (same + //problem with calling saveState(). Doing this in saveState() might be a possibility, but + //that would require every extender savestate implementation to call it's parent function, + //which isn't very nice. + foreach (ExtenderItem *item, extender()->attachedItems()) { + if (!item->isDetached() && item->autoExpireDelay()) { + //destroy temporary extender items, so their configuration won't linger after a + //plasma restart. + item->destroy(); + } + } + extender()->saveState(); } diff --git a/extender.cpp b/extender.cpp index 5340cc8ed..dd8ad6db7 100644 --- a/extender.cpp +++ b/extender.cpp @@ -56,14 +56,6 @@ Extender::Extender(Applet *applet) Extender::~Extender() { - //FIXME: this used to work, not anymore... fix. - foreach (ExtenderItem *item, attachedItems()) { - if (!item->isDetached() && item->autoExpireDelay()) { - //destroy temporary extender items, so their configuration won't linger after a plasma - //restart. - item->destroy(); - } - } delete d; } @@ -264,7 +256,6 @@ void ExtenderPrivate::removeExtenderItem(ExtenderItem *item) { attachedExtenderItems.removeOne(item); q->itemRemovedEvent(item); - emit q->itemDetached(item); } void ExtenderPrivate::adjustSizeHints() diff --git a/extenderitem.cpp b/extenderitem.cpp index fad3c0463..65117fcc0 100644 --- a/extenderitem.cpp +++ b/extenderitem.cpp @@ -75,8 +75,8 @@ class ExtenderItemPrivate { qreal left, top, right, bottom; dragger->getMargins(left, top, right, bottom); - QRectF rect(0, 0, q->size().width(), top + bottom + - dragger->elementSize("hint-preferred-icon-size").height()); + QRectF rect(0, 0, q->size().width(), + dragger->elementSize("hint-preferred-icon-size").height() + top + bottom); return rect; } @@ -85,7 +85,7 @@ class ExtenderItemPrivate { qreal left, top, right, bottom; dragger->getMargins(left, top, right, bottom); - return dragHandleRect().adjusted(left + collapseIcon->size().width(), top, + return dragHandleRect().adjusted(left + collapseIcon->size().width() + 1, top, -toolbox->size().width(), -bottom); } @@ -396,14 +396,13 @@ void ExtenderItem::setExtender(Extender *extender, const QPointF &pos) //first remove this item from the old extender. if (d->extender) { d->extender->d->removeExtenderItem(this); + emit d->extender->itemDetached(this); } //move the configuration. if (d->hostApplet() && (extender != d->extender)) { kDebug() << "moving configuration"; KConfigGroup c = extender->d->applet->config("ExtenderItems"); - kDebug() << "hostAppletId is " << d->hostApplet()->id(); - kDebug() << "config name is " << config().name(); config().reparent(&c); } @@ -490,8 +489,7 @@ uint ExtenderItem::sourceAppletId() const void ExtenderItem::destroy() { - kDebug() << "deleting config group."; - d->hostApplet()->config("ExtenderItem").deleteGroup(QString::number(d->extenderItemId)); + d->hostApplet()->config("ExtenderItems").deleteGroup(QString::number(d->extenderItemId)); if (d->extender) { d->extender->d->removeExtenderItem(this); }