summaryrefslogtreecommitdiff
path: root/src/lib/xdgnotificationactions.h
blob: 1d1e449672c74d18214eeb7c4b74849c4021926e (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
#ifndef XDGNOTIFICATIONACTIONS_H
#define XDGNOTIFICATIONACTIONS_H

#include <QAbstractListModel>

namespace xdg {

    class NotificationActions: public QAbstractListModel
    {
        Q_OBJECT

        QList<QPair<QString, QString>> m_actions;

        Q_PROPERTY(QStringList actionslist READ actionslist WRITE setActionslist NOTIFY actionslistChanged)

    public:
        NotificationActions(QObject *parent = nullptr);

        enum NotificationActionsRoles {
            KeyRole = Qt::UserRole + 1,
            TextRole,
        };

        QStringList actionslist() const;
        void setActionslist(const QStringList &newActionslist);

        int rowCount(const QModelIndex &parent = QModelIndex()) const override;
        QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
        QHash<int, QByteArray> roleNames() const override;

    signals:
        void actionslistChanged();
    private:
        QStringList m_actionslist;
    };

}


#endif // XDGNOTIFICATIONACTIONS_H