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