diff options
Diffstat (limited to 'src/daemon/NotifyWidget.h')
-rw-r--r-- | src/daemon/NotifyWidget.h | 83 |
1 files changed, 76 insertions, 7 deletions
diff --git a/src/daemon/NotifyWidget.h b/src/daemon/NotifyWidget.h index 08a2f9e..80be6c7 100644 --- a/src/daemon/NotifyWidget.h +++ b/src/daemon/NotifyWidget.h @@ -25,6 +25,7 @@ #include <tqlabel.h> #include <tqtextedit.h> +#include <tqpixmap.h> #include <tqdbusvariant.h> class NotificationsService; @@ -37,29 +38,97 @@ public: NotifyWidget(TQWidget *parent=0, const char *name=0, NotificationsService *ns=0, TQ_INT32 id=0 ); virtual ~NotifyWidget(); + enum UrgencyLevel { Low, Normal, Critical }; + void setAutoMask(bool b); bool setIcon(const TQString& icon); + /** + * The actions send a request message back to the notification client when invoked. This functionality may not be implemented by the notification server, conforming clients should check if it is available before using it (see the GetCapabilities message in Protocol). An implementation is free to ignore any requested by the client. As an example one possible rendering of actions would be as buttons in the notification popup. + +Actions are sent over as a list of pairs. Each even element in the list (starting at index 0) represents the identifier for the action. Each odd element in the list is the localized string that will be displayed to the user. + +The default action (usually invoked by clicking the notification) should have a key named "default". The name can be anything, though implementations are free not to display it. + */ void setActions(const TQStringList& actions); - void setHints(const TQMap< TQString, TQT_DBusVariant >& hints); + + /** + * Hints are a way to provide extra data to a notification server that the server may be able to make use of. + * Hints + * Category + * Notifications can optionally have a type indicator. Although neither client or nor server must support this, some may choose to. Those servers implementing categories may use them to intelligently display the notification in a certain way, or group notifications of similar types. + +Categories are in class.specific form. class specifies the generic type of notification, and specific specifies the more specific type of notification. + + * Urgency + * Notifications have an urgency level associated with them. This defines the importance of the notification. + * Developers must use their own judgement when deciding the urgency of a notification. + * Typically, if the majority of programs are using the same level for a specific type of urgency, + * other applications should follow them. + * For low and normal urgencies, server implementations may display the notifications how they choose. + * They should, however, have a sane expiration timeout dependent on the urgency level. + * + * Critical notifications should not automatically expire, as they are things that the user will + * most likely want to know about. They should only be closed when the user dismisses them, + * for example, by clicking on the notification. + + * Persistence + * The server supports persistence of notifications. Notifications will be retained until they are + * acknowledged or removed by the user or recalled by the sender. The presence of this capability + * allows clients to depend on the server to ensure a notification is seen and eliminate the need + * for the client to display a reminding function (such as a status icon) of its own. + * + * image + */ + void setCategory(const TQString&); + void setPersistence(bool); + void setImage(const TQString&); + void setImageData(const TQValueList<TQT_DBusData>&); + void setSoundFile(const TQString&); + void setSoundName(const TQString&); + void setSuppressSound(bool); + void setTransient(bool); + void setUrgency(TQ_UINT16); + void setSenderPid(TQ_UINT64); + + /** + * The timeout time in milliseconds since the display of the notification at which the notification should automatically close. + +If -1, the notification's expiration time is dependent on the notification server's settings, and may vary for the type of notification. + +If 0, the notification never expires. + */ void setTimeout(TQ_INT32 t); protected: void mousePressEvent( TQMouseEvent *); private slots: - void timeout(); - void fadeAway(); + void slotTimeout(); + void slotFadeAway(); +/** + * DBus signals + * 1. org.freedesktop.Notifications.NotificationClosed is implemented + * 2. org.freedesktop.Notifications.ActionInvoked is not implemented (see mActions) + * 3. org.freedesktop.Notifications.ActivationToken is not implemented (see mActions) + */ private: NotificationsService *notificationService; - TQPoint mPosition; TQString mName; TQ_INT32 mId; TQString mIcon; - TQStringList mActions; - TQMap< TQString, TQT_DBusVariant > mHints; - + TQStringList mActions; // not implemented + TQString mCategory; // not implemented + TQTimer *mTimer; + TQ_UINT16 mUrgency; + TQPixmap mImageData; + TQString mSoundFile; + TQString mSoundName; + bool mPersistence; + bool mSuppressSound; + bool mTransient; + TQ_UINT64 mSenderPid; }; #endif /* SRC_DAEMON_NOTIFYWIDGET_H_ */ |