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
This commit is contained in:
parent
6f3d2bc0ea
commit
7fca1acbb6
@ -24,31 +24,34 @@
|
|||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
#include <QGraphicsLinearLayout>
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
ExtenderApplet::ExtenderApplet(QObject *parent, const QVariantList &args)
|
ExtenderApplet::ExtenderApplet(QObject *parent, const QVariantList &args)
|
||||||
: Plasma::PopupApplet(parent, args)
|
: PopupApplet(parent, args)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtenderApplet::~ExtenderApplet()
|
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()
|
void ExtenderApplet::init()
|
||||||
{
|
{
|
||||||
setPopupIcon("utilities-desktop-extra");
|
setPopupIcon("utilities-desktop-extra");
|
||||||
|
|
||||||
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
|
extender()->setAppearance(Extender::NoBorders);
|
||||||
layout->setSpacing(0);
|
|
||||||
setLayout(layout);
|
|
||||||
|
|
||||||
extender()->setAppearance(Plasma::Extender::NoBorders);
|
|
||||||
extender()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
extender()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||||
|
|
||||||
connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)),
|
connect(extender(), SIGNAL(itemDetached(Plasma::ExtenderItem*)),
|
||||||
this, SLOT(itemDetached(Plasma::ExtenderItem*)));
|
this, SLOT(itemDetached(Plasma::ExtenderItem*)));
|
||||||
|
|
||||||
layout->addItem(extender());
|
|
||||||
//updateGeometry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
|
void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
|
||||||
@ -58,5 +61,7 @@ void ExtenderApplet::itemDetached(Plasma::ExtenderItem *)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Plasma
|
||||||
|
|
||||||
#include "extenderapplet_p.moc"
|
#include "extenderapplet_p.moc"
|
||||||
|
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include "popupapplet.h"
|
#include "popupapplet.h"
|
||||||
|
|
||||||
|
namespace Plasma
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used as a 'host' for detached extender items. When an extender item is dropped
|
* 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
|
* 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 *);
|
void itemDetached(Plasma::ExtenderItem *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Plasma
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user