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