File indexing completed on 2024-04-28 16:54:33
0001 /* 0002 SPDX-FileCopyrightText: 2018-2019 Kai Uwe Broulik <kde@privat.broulik.de> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "notification.h" 0010 #include "server.h" 0011 0012 #include <QDateTime> 0013 #include <QTimer> 0014 0015 namespace NotificationManager 0016 { 0017 class Q_DECL_HIDDEN AbstractNotificationsModel::Private 0018 { 0019 public: 0020 explicit Private(AbstractNotificationsModel *q); 0021 ~Private(); 0022 0023 void onNotificationAdded(const Notification ¬ification); 0024 void onNotificationReplaced(uint replacedId, const Notification ¬ification); 0025 void onNotificationRemoved(uint notificationId, Server::CloseReason reason); 0026 0027 void setupNotificationTimeout(const Notification ¬ification); 0028 0029 void removeRows(const QVector<int> &rows); 0030 0031 AbstractNotificationsModel *q; 0032 0033 QVector<Notification> notifications; 0034 // Fallback timeout to ensure all notifications expire eventually 0035 // otherwise when it isn't shown to the user and doesn't expire 0036 // an app might wait indefinitely for the notification to do so 0037 QHash<uint /*notificationId*/, QTimer *> notificationTimeouts; 0038 0039 QVector<uint /*notificationId*/> pendingRemovals; 0040 QTimer pendingRemovalTimer; 0041 0042 QDateTime lastRead; 0043 QWindow *window = nullptr; 0044 }; 0045 0046 }