KDE/kdelibs/plasma/extenders

Marco Martin notmart at gmail.com
Tue Nov 10 12:30:26 CET 2009


SVN commit 1047062 by mart:

emit a signal when the user clicks the close button.
would perhaps be better to bind it with an action and make it accessible
with action("close")?
CCMAIL: plasma-devel at kde.org


 M  +7 -1      extenderitem.cpp  
 M  +9 -0      extenderitem.h  


--- trunk/KDE/kdelibs/plasma/extenders/extenderitem.cpp #1047061:1047062
@@ -444,6 +444,11 @@
     d->hostApplet()->config("ExtenderItems").deleteGroup(QString::number(d->extenderItemId));
     d->extender->d->removeExtenderItem(this);
     emit d->extender->itemDetached(this);
+
+    if (sender() == d->destroyAction) {
+        emit destroyActionTriggered();
+    }
+
     deleteLater();
 }
 
@@ -689,6 +694,7 @@
       dragger(new FrameSvg(extenderItem)),
       background(new FrameSvg(extenderItem)),
       collapseIcon(0),
+      destroyAction(0),
       title(QString()),
       mouseOver(false),
       dragStarted(false),
@@ -766,7 +772,7 @@
 
     //add the close icon if desired.
     if (destroyActionVisibility) {
-        IconWidget *destroyAction = new IconWidget(q);
+        destroyAction = new IconWidget(q);
         destroyAction->setSvg("widgets/configuration-icons", "close");
         QSizeF size = destroyAction->sizeFromIconSize(iconSize);
         destroyAction->setMinimumSize(size);
--- trunk/KDE/kdelibs/plasma/extenders/extenderitem.h #1047061:1047062
@@ -254,6 +254,15 @@
          */
         void hideCloseButton();
 
+    Q_SIGNALS:
+        /**
+         * Emitted when the user closes the extender item with the destroy icon,
+         * not when the item is destroyed programmatically.
+         *
+         * @since 4.4
+         */
+        void destroyActionTriggered();
+
     protected:
         void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 


More information about the Plasma-devel mailing list