1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2005 Olivier Goffart <ogoffart at kde.org> |
4 | SPDX-FileCopyrightText: 2006 Thiago Macieira <thiago@kde.org> |
5 | |
6 | SPDX-License-Identifier: LGPL-2.0-or-later |
7 | */ |
8 | |
9 | #ifndef KNOTIFICATIONMANAGER_H |
10 | #define KNOTIFICATIONMANAGER_H |
11 | |
12 | #include <knotification.h> |
13 | |
14 | #include <memory> |
15 | |
16 | class KNotification; |
17 | class QPixmap; |
18 | class KNotificationPlugin; |
19 | |
20 | class KNotificationManager : public QObject |
21 | { |
22 | Q_OBJECT |
23 | public: |
24 | static KNotificationManager *self(); |
25 | ~KNotificationManager() override; |
26 | |
27 | KNotificationPlugin *pluginForAction(const QString &action); |
28 | |
29 | /* |
30 | * send the dbus call to the knotify server |
31 | */ |
32 | void notify(KNotification *n); |
33 | |
34 | /* |
35 | * send the close dcop call to the knotify server for the notification with the identifier @p id . |
36 | * And remove the notification from the internal map |
37 | * id the id of the notification |
38 | * force if false, only close registered notification |
39 | */ |
40 | void close(int id); |
41 | |
42 | /* |
43 | * update one notification text and pixmap and actions |
44 | */ |
45 | void update(KNotification *n); |
46 | |
47 | /* |
48 | * re-emit the notification |
49 | */ |
50 | void reemit(KNotification *n); |
51 | |
52 | private Q_SLOTS: |
53 | void notificationClosed(); |
54 | void xdgActivationTokenReceived(int id, const QString &token); |
55 | void notificationActivated(int id, const QString &action); |
56 | void notificationReplied(int id, const QString &text); |
57 | void notifyPluginFinished(KNotification *notification); |
58 | void reparseConfiguration(const QString &app); |
59 | |
60 | private: |
61 | bool isInsideSandbox(); |
62 | |
63 | struct Private; |
64 | std::unique_ptr<Private> const d; |
65 | KNotificationManager(); |
66 | |
67 | friend class KNotificationManagerSingleton; |
68 | }; |
69 | |
70 | #endif |
71 | |