api to show/hide plasmoids from the systray, like NotificationItems

this REALLY needs api review
CCMAIL:plasma-devel@kde.org

svn path=/trunk/KDE/kdelibs/; revision=993364
This commit is contained in:
Marco Martin 2009-07-08 14:55:59 +00:00
parent c201a16450
commit 1300eea396
4 changed files with 34 additions and 0 deletions

View File

@ -250,6 +250,17 @@ enum MessageButton {
};
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::Constraints)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Flip)
Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::ComponentTypes)
#endif // multiple inclusion guard

View File

@ -481,6 +481,17 @@ bool PopupApplet::isPopupShowing() const
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 @@ PopupAppletPrivate::PopupAppletPrivate(PopupApplet *applet)
popupPlacement(Plasma::FloatingPopup),
savedAspectRatio(Plasma::InvalidAspectRatioMode),
timer(0),
itemStatus(UnknownStatus),
popupLostFocus(false),
passive(false)
{

View File

@ -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 @@ public:
*/
bool isPopupShowing() const;
ItemStatus status();
void setStatus(ItemStatus stat);
public Q_SLOTS:
/**
* Hides the popup.
@ -142,6 +146,9 @@ protected:
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())

View File

@ -20,6 +20,8 @@
#ifndef POPUPAPPLET_P_H
#define POPUPAPPLET_P_H
#include <plasma/plasma.h>
namespace Plasma
{
@ -46,6 +48,7 @@ public:
Plasma::AspectRatioMode savedAspectRatio;
QTimer *timer;
QPoint clicked;
ItemStatus itemStatus;
bool popupLostFocus : 1;
bool passive : 1;
};