File indexing completed on 2024-04-28 05:34:04

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