KDE/kdelibs/plasma

Marco Martin notmart at gmail.com
Wed Jul 8 16:56:01 CEST 2009


SVN commit 993364 by mart:

api to show/hide plasmoids from the systray, like NotificationItems
this REALLY needs api review
CCMAIL:plasma-devel at kde.org


 M  +12 -0     plasma.h  
 M  +12 -0     popupapplet.cpp  
 M  +7 -0      popupapplet.h  
 M  +3 -0      private/popupapplet_p.h  


--- trunk/KDE/kdelibs/plasma/plasma.h #993363:993364
@@ -250,6 +250,17 @@
 };
 Q_DECLARE_FLAGS(MessageButtons, MessageButton)
 
+/**
+ * Status of an applet...
+ * FIXME: this will have to move in PopupApplet? or find an api-less way?
+ */
+enum ItemStatus {
+    UnknownStatus = 0,
+    PassiveStatus = 1,
+    ActiveStatus = 2,
+    NeedsAttentionStatus = 3
+};
+Q_ENUMS(ItemStatus)
 
 /**
  * @return the scaling factor (0..1) for a ZoomLevel
@@ -288,4 +299,5 @@
 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip)
 Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::ComponentTypes)
 
+
 #endif // multiple inclusion guard
--- trunk/KDE/kdelibs/plasma/popupapplet.cpp #993363:993364
@@ -481,6 +481,17 @@
     return d->dialog && d->dialog->isVisible();
 }
 
+ItemStatus PopupApplet::status()
+{
+    return d->itemStatus;
+}
+
+void PopupApplet::setStatus(ItemStatus status)
+{
+    d->itemStatus = status;
+    emit newStatus(status);
+}
+
 PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
         : q(applet),
           icon(0),
@@ -489,6 +500,7 @@
           popupPlacement(Plasma::FloatingPopup),
           savedAspectRatio(Plasma::InvalidAspectRatioMode),
           timer(0),
+          itemStatus(UnknownStatus),
           popupLostFocus(false),
           passive(false)
 {
--- trunk/KDE/kdelibs/plasma/popupapplet.h #993363:993364
@@ -22,6 +22,7 @@
 
 #include <plasma/applet.h>
 #include <plasma/plasma_export.h>
+#include <plasma/plasma.h>
 
 class QGraphicsProxyWidget;
 class QGraphicsLinearLayout;
@@ -107,6 +108,9 @@
      */
     bool isPopupShowing() const;
 
+    ItemStatus status();
+    void setStatus(ItemStatus stat);
+
 public Q_SLOTS:
     /**
      * Hides the popup.
@@ -142,6 +146,9 @@
     void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
     void dropEvent(QGraphicsSceneDragDropEvent *event);
 
+Q_SIGNALS:
+    void newStatus(ItemStatus status);
+
 private:
     Q_PRIVATE_SLOT(d, void internalTogglePopup())
     Q_PRIVATE_SLOT(d, void hideTimedPopup())
--- trunk/KDE/kdelibs/plasma/private/popupapplet_p.h #993363:993364
@@ -20,6 +20,8 @@
 #ifndef POPUPAPPLET_P_H
 #define POPUPAPPLET_P_H
 
+#include <plasma/plasma.h>
+
 namespace Plasma
 {
 
@@ -46,6 +48,7 @@
     Plasma::AspectRatioMode savedAspectRatio;
     QTimer *timer;
     QPoint clicked;
+    ItemStatus itemStatus;
     bool popupLostFocus : 1;
     bool passive : 1;
 };


More information about the Plasma-devel mailing list