File indexing completed on 2024-04-28 05:33:52

0001 /*
0002     SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
0003     SPDX-FileCopyrightText: 2020 Kai Uwe Broulik <kde@broulik.de>
0004 
0005     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0006 */
0007 
0008 #ifndef PLASMA_NM_CONNECTIVITY_MONITOR_H
0009 #define PLASMA_NM_CONNECTIVITY_MONITOR_H
0010 
0011 #include <NetworkManagerQt/Manager>
0012 
0013 #include <KNotification>
0014 #include <QObject>
0015 #include <QPointer>
0016 #include <QTimer>
0017 
0018 #include <QCoroCore>
0019 
0020 class ConnectivityMonitor : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     explicit ConnectivityMonitor(QObject *parent);
0025     ~ConnectivityMonitor() override;
0026 
0027 private Q_SLOTS:
0028     void connectivityChanged(NetworkManager::Connectivity connectivity);
0029     QCoro::Task<void> checkConnectivity();
0030 
0031 private:
0032     void showLimitedConnectivityNotification();
0033 
0034     QPointer<KNotification> m_notification;
0035 
0036     QTimer m_limitedConnectivityTimer;
0037 };
0038 
0039 #endif // PLASMA_NM_CONNECTIVITY_MONITOR_H