File indexing completed on 2024-05-05 17:42:34

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_AVAILABLE_DEVICES_H
0008 #define PLASMA_NM_AVAILABLE_DEVICES_H
0009 
0010 #include <QObject>
0011 
0012 #include <NetworkManagerQt/Device>
0013 
0014 class AvailableDevices : public QObject
0015 {
0016     /**
0017      * Return true when there is present wired device
0018      */
0019     Q_PROPERTY(bool wiredDeviceAvailable READ isWiredDeviceAvailable NOTIFY wiredDeviceAvailableChanged)
0020     /**
0021      * Return true when there is present wireless device
0022      */
0023     Q_PROPERTY(bool wirelessDeviceAvailable READ isWirelessDeviceAvailable NOTIFY wirelessDeviceAvailableChanged)
0024 
0025     /**
0026      * Return true when there is present modem device
0027      */
0028     Q_PROPERTY(bool modemDeviceAvailable READ isModemDeviceAvailable NOTIFY modemDeviceAvailableChanged)
0029     /**
0030      * Return true when there is present bluetooth device
0031      * Bluetooth device is visible for NetworkManager only when there is some Bluetooth connection
0032      */
0033     Q_PROPERTY(bool bluetoothDeviceAvailable READ isBluetoothDeviceAvailable NOTIFY bluetoothDeviceAvailableChanged)
0034     Q_OBJECT
0035 public:
0036     explicit AvailableDevices(QObject *parent = nullptr);
0037     ~AvailableDevices() override;
0038 
0039 public Q_SLOTS:
0040     bool isWiredDeviceAvailable() const;
0041     bool isWirelessDeviceAvailable() const;
0042     bool isModemDeviceAvailable() const;
0043     bool isBluetoothDeviceAvailable() const;
0044 
0045 private Q_SLOTS:
0046     void deviceAdded(const QString &dev);
0047     void deviceRemoved();
0048 
0049 Q_SIGNALS:
0050     void wiredDeviceAvailableChanged(bool available);
0051     void wirelessDeviceAvailableChanged(bool available);
0052     void modemDeviceAvailableChanged(bool available);
0053     void bluetoothDeviceAvailableChanged(bool available);
0054 
0055 private:
0056     bool m_wiredDeviceAvailable = false;
0057     bool m_wirelessDeviceAvailable = false;
0058     bool m_modemDeviceAvailable = false;
0059     bool m_bluetoothDeviceAvailable = false;
0060 };
0061 
0062 #endif // PLASMA_NM_AVAILABLE_DEVICES_H