summaryrefslogtreecommitdiff
path: root/daemon/notificationmanager.h
blob: 747561c7982e018f359fb4be042cf58813585c16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef NOTIFICATIONMANAGER_H
#define NOTIFICATIONMANAGER_H

#include <QObject>
#include <QtDBus/QDBusContext>
#include <QLoggingCategory>
#include "settings.h"

#include <QDBusInterface>
#include <QDBusPendingCallWatcher>

typedef QHash<QString, QString> QStringHash;

class NotificationManager : public QObject, protected QDBusContext
{
    Q_OBJECT
    QLoggingCategory l;
    Q_CLASSINFO("D-Bus Interface", "org.freedesktop.Notifications")

    Q_PROPERTY(QDBusInterface* interface READ interface)
public:
    explicit NotificationManager(Settings *settings, QObject *parent = 0);
            ~NotificationManager();

    QDBusInterface* interface() const;

Q_SIGNALS:
    void error(const QString &message);
    void missedCallNotify(const QString &sender, const QString &data);
    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 telegramNotify(const QString &sender, const QString &data);
    void hangoutsNotify(const QString &sender, const QString &data);
    void whatsappNotify(const QString &sender, const QString &data);
    void emailNotify(const QString &sender, const QString &data, const QString &subject);

public Q_SLOTS:
    uint 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);

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