diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-28 11:04:12 +0200 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2014-07-28 11:04:12 +0200 |
| commit | 0ead71b6a9b5c49a4bdc055ce45bc8531b538a20 (patch) | |
| tree | 21e92503bf004773625c6208f08a1c6b93182b96 /daemon/notificationmanager.h | |
| parent | 05502a35e1b1bd10a4ba81d2974d5c41e6a1ef35 (diff) | |
| parent | 5f3e8fd022e29d3014b4e0888f310a5ac512b467 (diff) | |
Merge pull request #12 from smurfy/notifications
Notifications via freedesktop.org interface snooping
Diffstat (limited to 'daemon/notificationmanager.h')
| -rw-r--r-- | daemon/notificationmanager.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/daemon/notificationmanager.h b/daemon/notificationmanager.h new file mode 100644 index 0000000..4695db9 --- /dev/null +++ b/daemon/notificationmanager.h @@ -0,0 +1,51 @@ +#ifndef NOTIFICATIONMANAGER_H +#define NOTIFICATIONMANAGER_H + +#include <QObject> +#include "Logger" +#include "settings.h" + +#include <QDBusInterface> +#include <QDBusPendingCallWatcher> + +typedef QHash<QString, QString> QStringHash; + +class NotificationManager : public QObject +{ + Q_OBJECT + LOG4QT_DECLARE_QCLASS_LOGGER + Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications") + + Q_PROPERTY(QDBusInterface* interface READ interface) +public: + explicit NotificationManager(QObject *parent = 0); + ~NotificationManager(); + + QDBusInterface* interface() const; + +Q_SIGNALS: + void error(const QString &message); + void smsNotify(const QString &sender, const QString &data); + void twitterNotify(const QString &sender, const QString &data); + void facebookNotify(const QString &sender, const QString &data); + void emailNotify(const QString &sender, const QString &data,const QString &subject); + +public Q_SLOTS: + void Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout); + void setSettings(Settings *settings); + +protected Q_SLOTS: + void initialize(bool notifyError = false); + +private: + class NotificationManagerPrivate *d_ptr; + + QString getCleanAppName(QString app_name); + QStringHash getCategoryParams(QString category); + Settings *settings; + + Q_DISABLE_COPY(NotificationManager) + Q_DECLARE_PRIVATE(NotificationManager) +}; + +#endif // NOTIFICATIONMANAGER_H |
