File indexing completed on 2024-04-28 15:29:09
0001 /* 0002 This file is part of the KDE libraries 0003 SPDX-FileCopyrightText: 2005 Olivier Goffart <ogoffart at kde.org> 0004 SPDX-FileCopyrightText: 2006 Thiago Macieira <thiago@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 0009 #ifndef KNOTIFICATIONMANAGER_H 0010 #define KNOTIFICATIONMANAGER_H 0011 0012 #include <knotification.h> 0013 0014 #include <memory> 0015 0016 class KNotification; 0017 class QPixmap; 0018 class KNotificationPlugin; 0019 0020 /** 0021 * @internal 0022 * @author Olivier Goffart 0023 */ 0024 class KNotificationManager : public QObject 0025 { 0026 Q_OBJECT 0027 public: 0028 static KNotificationManager *self(); 0029 ~KNotificationManager() override; 0030 0031 KNotificationPlugin *pluginForAction(const QString &action); 0032 0033 /** 0034 * send the dbus call to the knotify server 0035 */ 0036 void notify(KNotification *n); 0037 0038 /** 0039 * send the close dcop call to the knotify server for the notification with the identifier @p id . 0040 * And remove the notification from the internal map 0041 * @param id the id of the notification 0042 * @param force if false, only close registered notification 0043 */ 0044 void close(int id, bool force = false); 0045 0046 /** 0047 * update one notification text and pixmap and actions 0048 */ 0049 void update(KNotification *n); 0050 0051 /** 0052 * re-emit the notification, eventually with new contexts 0053 */ 0054 void reemit(KNotification *n); 0055 0056 private Q_SLOTS: 0057 void notificationClosed(); 0058 void xdgActivationTokenReceived(int id, const QString &token); 0059 void notificationActivated(int id, int action); 0060 void notificationReplied(int id, const QString &text); 0061 void notifyPluginFinished(KNotification *notification); 0062 void reparseConfiguration(const QString &app); 0063 0064 private: 0065 struct Private; 0066 std::unique_ptr<Private> const d; 0067 KNotificationManager(); 0068 0069 friend class KNotificationManagerSingleton; 0070 }; 0071 0072 #endif