Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/notificationsmodel.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | */ | ||||
20 | | ||||
21 | #pragma once | ||||
22 | | ||||
23 | #include <QAbstractListModel> | ||||
24 | #include <QScopedPointer> | ||||
25 | #include <QSharedPointer> | ||||
26 | | ||||
27 | #include "notifications.h" | ||||
28 | | ||||
29 | namespace NotificationManager | ||||
30 | { | ||||
31 | | ||||
32 | class NotificationsModel : public QAbstractListModel | ||||
33 | { | ||||
34 | Q_OBJECT | ||||
35 | | ||||
36 | public: | ||||
37 | ~NotificationsModel() override; | ||||
38 | | ||||
39 | using Ptr = QSharedPointer<NotificationsModel>; | ||||
40 | static Ptr createNotificationsModel(); | ||||
41 | | ||||
42 | QDateTime lastRead() const; | ||||
43 | void setLastRead(const QDateTime &lastRead); | ||||
44 | | ||||
45 | QVariant data(const QModelIndex &index, int role) const override; | ||||
46 | int rowCount(const QModelIndex &parent = QModelIndex()) const override; | ||||
47 | | ||||
48 | void expire(uint notificationId); | ||||
49 | void close(uint notificationId); | ||||
50 | void configure(uint notificationId); | ||||
51 | void configure(const QString &desktopEntry, const QString ¬ifyRcName, const QString &eventId); | ||||
52 | void invokeDefaultAction(uint notificationId); | ||||
53 | void invokeAction(uint notificationId, const QString &actionName); | ||||
54 | | ||||
55 | void startTimeout(uint notificationId); | ||||
56 | void stopTimeout(uint notificationId); | ||||
57 | | ||||
58 | void clear(Notifications::ClearFlags flags); | ||||
59 | | ||||
60 | signals: | ||||
61 | void lastReadChanged(); | ||||
62 | | ||||
63 | private: | ||||
64 | class Private; | ||||
65 | QScopedPointer<Private> d; | ||||
66 | | ||||
67 | NotificationsModel(); | ||||
68 | Q_DISABLE_COPY(NotificationsModel) | ||||
69 | | ||||
70 | }; | ||||
71 | | ||||
72 | } // namespace NotificationManager |