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 | /** |
21 | * @internal |
22 | * @author Olivier Goffart |
23 | */ |
24 | class KNotificationManager : public QObject |
25 | { |
26 | Q_OBJECT |
27 | public: |
28 | static KNotificationManager *self(); |
29 | ~KNotificationManager() override; |
30 | |
31 | KNotificationPlugin *pluginForAction(const QString &action); |
32 | |
33 | /** |
34 | * send the dbus call to the knotify server |
35 | */ |
36 | void notify(KNotification *n); |
37 | |
38 | /** |
39 | * send the close dcop call to the knotify server for the notification with the identifier @p id . |
40 | * And remove the notification from the internal map |
41 | * @param id the id of the notification |
42 | * @param force if false, only close registered notification |
43 | */ |
44 | void close(int id); |
45 | |
46 | /** |
47 | * update one notification text and pixmap and actions |
48 | */ |
49 | void update(KNotification *n); |
50 | |
51 | /** |
52 | * re-emit the notification |
53 | */ |
54 | void reemit(KNotification *n); |
55 | |
56 | private Q_SLOTS: |
57 | void notificationClosed(); |
58 | void xdgActivationTokenReceived(int id, const QString &token); |
59 | void notificationActivated(int id, const QString &action); |
60 | void notificationReplied(int id, const QString &text); |
61 | void notifyPluginFinished(KNotification *notification); |
62 | void reparseConfiguration(const QString &app); |
63 | |
64 | private: |
65 | bool isInsideSandbox(); |
66 | |
67 | struct Private; |
68 | std::unique_ptr<Private> const d; |
69 | KNotificationManager(); |
70 | |
71 | friend class KNotificationManagerSingleton; |
72 | }; |
73 | |
74 | #endif |
75 |