File indexing completed on 2024-04-21 16:20:06
0001 /* 0002 SPDX-FileCopyrightText: 2009 Will Stephenson <wstephenson@kde.org> 0003 SPDX-FileCopyrightText: 2013 Daniel Nicoletti <dantti12@gmail.com> 0004 SPDX-FileCopyrightText: 2013 Lukas Tinkl <ltinkl@redhat.com> 0005 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com> 0006 0007 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0008 */ 0009 0010 #ifndef PLASMA_NM_NOTIFICATION_H 0011 #define PLASMA_NM_NOTIFICATION_H 0012 0013 #include <QObject> 0014 0015 #include <NetworkManagerQt/Device> 0016 #include <NetworkManagerQt/VpnConnection> 0017 0018 class QTimer; 0019 0020 class KNotification; 0021 class Notification : public QObject 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit Notification(QObject *parent = nullptr); 0026 0027 private Q_SLOTS: 0028 void deviceAdded(const QString &uni); 0029 void addDevice(const NetworkManager::Device::Ptr &device); 0030 void stateChanged(NetworkManager::Device::State newstate, NetworkManager::Device::State oldstate, NetworkManager::Device::StateChangeReason reason); 0031 0032 void addActiveConnection(const QString &path); 0033 void addActiveConnection(const NetworkManager::ActiveConnection::Ptr &ac); 0034 void onActiveConnectionStateChanged(NetworkManager::ActiveConnection::State state); 0035 void onVpnConnectionStateChanged(NetworkManager::VpnConnection::State state, NetworkManager::VpnConnection::StateChangeReason reason); 0036 0037 void notificationClosed(); 0038 0039 void onPrepareForSleep(bool sleep); 0040 void onCheckActiveConnectionOnResume(); 0041 0042 private: 0043 QHash<QString, KNotification *> m_notifications; 0044 0045 bool m_preparingForSleep = false; 0046 bool m_justLaunched = true; 0047 QStringList m_activeConnectionsBeforeSleep; 0048 QTimer *m_checkActiveConnectionOnResumeTimer = nullptr; 0049 }; 0050 0051 #endif // PLASMA_NM_NOTIFICATION_H