summaryrefslogtreecommitdiff
path: root/libsowatch/notification.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-10-02 16:39:40 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-10-02 16:39:40 +0200
commit0a656b75f3fc80f13424db0e7ec403dff28a366e (patch)
tree23f72a2fde3f718048b49d9806ded3d315d50a80 /libsowatch/notification.h
parentd9f132f3d5bf41ee4f30e7ea2bd1b61120fa29b7 (diff)
downloadsowatch-0a656b75f3fc80f13424db0e7ec403dff28a366e.tar.gz
sowatch-0a656b75f3fc80f13424db0e7ec403dff28a366e.zip
new notifications list, time syncing
Diffstat (limited to 'libsowatch/notification.h')
-rw-r--r--libsowatch/notification.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/libsowatch/notification.h b/libsowatch/notification.h
index 1af0264..758a8b7 100644
--- a/libsowatch/notification.h
+++ b/libsowatch/notification.h
@@ -4,6 +4,7 @@
#include <QtCore/QString>
#include <QtCore/QDateTime>
#include <QtGui/QImage>
+#include <QtDeclarative/QtDeclarative>
#include "sowatch_global.h"
namespace sowatch
@@ -13,12 +14,13 @@ class SOWATCH_EXPORT Notification : public QObject
{
Q_OBJECT
Q_ENUMS(Type)
- Q_PROPERTY(Type type READ type)
- Q_PROPERTY(uint count READ count)
- Q_PROPERTY(QDateTime dateTime READ dateTime)
- Q_PROPERTY(QString title READ title)
- Q_PROPERTY(QString body READ body)
- Q_PROPERTY(QImage image READ image)
+ Q_PROPERTY(Type type READ type CONSTANT)
+ Q_PROPERTY(uint count READ count NOTIFY countChanged)
+ Q_PROPERTY(QDateTime dateTime READ dateTime NOTIFY dateTimeChanged)
+ Q_PROPERTY(QString displayTime READ displayTime NOTIFY displayTimeChanged STORED false)
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString body READ body NOTIFY bodyChanged)
+ Q_PROPERTY(QImage image READ image NOTIFY imageChanged)
public:
enum Type {
@@ -45,14 +47,30 @@ public:
virtual QImage image() const;
public slots:
+ /** Do something on this notification; open the application that caused it, answer, etc. */
virtual void activate() = 0;
- virtual void clear() = 0;
+ /** Dismiss this notification. */
+ virtual void dismiss() = 0;
signals:
+ /* For the convenience of QML users */
+ void countChanged();
+ void dateTimeChanged();
+ void displayTimeChanged();
+ void titleChanged();
+ void bodyChanged();
+ void imageChanged();
+
+ /** Generic "changed" signal if any of the properties changes; can be batched. */
void changed();
- void cleared();
+
+ /** The notification has been dismissed by the user or via dismiss(). */
+ void dismissed();
+ /* Provider of this notification object should delete it after dismissal. */
};
}
+QML_DECLARE_TYPE(sowatch::Notification)
+
#endif // SOWATCH_NOTIFICATION_H