From 7fca1acbb651ae703a34b63551cffb8f4a18881f Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 1 Dec 2008 01:08:43 +0000 Subject: [PATCH] if the applet is destroyed, then returnToSource() the extenders. perhaps we should be watching for extenders being deleted at random (QObject::destroyed signal?). also, seems that returnToSource is broken in general atm, but only for items in the panel, though that seems to be a separate issue. i wonder if that's a PopupApplet bug? will need to investigate. CCMAIL:r.scheepmaker@student.utwente.nl BUG:176411 svn path=/trunk/KDE/kdelibs/; revision=891037 --- private/extenderapplet.cpp | 23 ++++++++++++++--------- private/extenderapplet_p.h | 5 +++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/private/extenderapplet.cpp b/private/extenderapplet.cpp index 1278cccfb..d95589e74 100644 --- a/private/extenderapplet.cpp +++ b/private/extenderapplet.cpp @@ -24,31 +24,34 @@ #include +namespace Plasma +{ + ExtenderApplet::ExtenderApplet(QObject *parent, const QVariantList &args) - : Plasma::PopupApplet(parent, args) + : PopupApplet(parent, args) { } ExtenderApplet::~ExtenderApplet() { + if (destroyed()) { + disconnect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)), + this, SLOT(itemDetached(Plasma::ExtenderItem*))); + foreach (ExtenderItem *item, extender()->attachedItems()) { + item->returnToSource(); + } + } } void ExtenderApplet::init() { setPopupIcon("utilities-desktop-extra"); - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this); - layout->setSpacing(0); - setLayout(layout); - - extender()->setAppearance(Plasma::Extender::NoBorders); + extender()->setAppearance(Extender::NoBorders); extender()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)), this, SLOT(itemDetached(Plasma::ExtenderItem*))); - - layout->addItem(extender()); - //updateGeometry(); } void ExtenderApplet::itemDetached(Plasma::ExtenderItem *) @@ -58,5 +61,7 @@ void ExtenderApplet::itemDetached(Plasma::ExtenderItem *) } } +} // namespace Plasma + #include "extenderapplet_p.moc" diff --git a/private/extenderapplet_p.h b/private/extenderapplet_p.h index ce5c9e290..18d43aaab 100644 --- a/private/extenderapplet_p.h +++ b/private/extenderapplet_p.h @@ -22,6 +22,9 @@ #include "popupapplet.h" +namespace Plasma +{ + /** * This class is used as a 'host' for detached extender items. When an extender item is dropped * somewhere, this applet is added at the location where the item is dropped, and the item is added @@ -40,4 +43,6 @@ class ExtenderApplet : public Plasma::PopupApplet void itemDetached(Plasma::ExtenderItem *); }; +} // namespace Plasma + #endif