[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/plasma/private
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2008-12-01 1:08:44
Message-ID: 1228093724.605480.8306.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 891037 by aseigo:

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


 M  +14 -9     extenderapplet.cpp  
 M  +5 -0      extenderapplet_p.h  


--- trunk/KDE/kdelibs/plasma/private/extenderapplet.cpp #891036:891037
@@ -24,31 +24,34 @@
 
 #include <QGraphicsLinearLayout>
 
+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 @@
     }
 }
 
+} // namespace Plasma
+
 #include "extenderapplet_p.moc"
 
--- trunk/KDE/kdelibs/plasma/private/extenderapplet_p.h #891036:891037
@@ -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 @@
         void itemDetached(Plasma::ExtenderItem *);
 };
 
+} // namespace Plasma
+
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic