File indexing completed on 2024-05-05 17:42:35
0001 /* 0002 SPDX-FileCopyrightText: 2013 Jan Grulich <jgrulich@redhat.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef PLASMA_NM_NETWORK_STATUS_H 0008 #define PLASMA_NM_NETWORK_STATUS_H 0009 0010 #include <QObject> 0011 0012 #include <NetworkManagerQt/Manager> 0013 0014 class NetworkStatus : public QObject 0015 { 0016 /** 0017 * Returns a formated list of active connections or NM status when there is no active connection 0018 */ 0019 Q_PROPERTY(QString activeConnections READ activeConnections NOTIFY activeConnectionsChanged) 0020 /** 0021 * Returns the current status of NetworkManager 0022 */ 0023 Q_PROPERTY(QString networkStatus READ networkStatus NOTIFY networkStatusChanged) 0024 Q_OBJECT 0025 public: 0026 enum SortedConnectionType { 0027 Wired, 0028 Wireless, 0029 Gsm, 0030 Cdma, 0031 Pppoe, 0032 Adsl, 0033 Infiniband, 0034 OLPCMesh, 0035 Bluetooth, 0036 Wireguard, 0037 Vpn, 0038 Other, 0039 }; 0040 0041 static SortedConnectionType connectionTypeToSortedType(NetworkManager::ConnectionSettings::ConnectionType type); 0042 0043 explicit NetworkStatus(QObject *parent = nullptr); 0044 ~NetworkStatus() override; 0045 0046 QString activeConnections() const; 0047 QString networkStatus() const; 0048 0049 private Q_SLOTS: 0050 void activeConnectionsChanged(); 0051 void defaultChanged(); 0052 void statusChanged(NetworkManager::Status status); 0053 void changeActiveConnections(); 0054 0055 Q_SIGNALS: 0056 void activeConnectionsChanged(const QString &activeConnections); 0057 void networkStatusChanged(const QString &status); 0058 0059 private: 0060 QString m_activeConnections; 0061 QString m_networkStatus; 0062 0063 QString checkUnknownReason() const; 0064 }; 0065 0066 #endif // PLAMA_NM_NETWORK_STATUS_H