File indexing completed on 2024-04-28 09:28:55

0001 /*
0002     SPDX-FileCopyrightText: 2021 Andreas Cord-Landwehr <cordlandwehr@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef CONFIGURATIONPROXY_H
0008 #define CONFIGURATIONPROXY_H
0009 
0010 #include "plasmanm_internal_export.h"
0011 
0012 #include "configuration.h"
0013 #include <QObject>
0014 #include <QPointer>
0015 
0016 #include <qqmlregistration.h>
0017 
0018 class PLASMANM_INTERNAL_EXPORT ConfigurationProxy : public QObject
0019 {
0020     Q_OBJECT
0021     QML_ELEMENT
0022     QML_NAMED_ELEMENT(Configuration)
0023     QML_SINGLETON
0024     Q_PROPERTY(bool unlockModemOnDetection READ unlockModemOnDetection WRITE setUnlockModemOnDetection)
0025     Q_PROPERTY(bool manageVirtualConnections READ manageVirtualConnections WRITE setManageVirtualConnections NOTIFY manageVirtualConnectionsChanged)
0026     Q_PROPERTY(bool airplaneModeEnabled READ airplaneModeEnabled WRITE setAirplaneModeEnabled NOTIFY airplaneModeEnabledChanged)
0027     Q_PROPERTY(QString hotspotName READ hotspotName WRITE setHotspotName)
0028     Q_PROPERTY(QString hotspotPassword READ hotspotPassword WRITE setHotspotPassword)
0029     Q_PROPERTY(QString hotspotConnectionPath READ hotspotConnectionPath WRITE setHotspotConnectionPath)
0030 
0031     // Readonly constant property, as this value should only be set by the platform
0032     Q_PROPERTY(bool showPasswordDialog READ showPasswordDialog CONSTANT)
0033 public:
0034     ConfigurationProxy(QObject *parent = nullptr);
0035     bool unlockModemOnDetection() const;
0036     void setUnlockModemOnDetection(bool unlock);
0037 
0038     bool manageVirtualConnections() const;
0039     void setManageVirtualConnections(bool manage);
0040 
0041     bool airplaneModeEnabled() const;
0042     void setAirplaneModeEnabled(bool enabled);
0043 
0044     QString hotspotName() const;
0045     void setHotspotName(const QString &name);
0046 
0047     QString hotspotPassword() const;
0048     void setHotspotPassword(const QString &password);
0049 
0050     QString hotspotConnectionPath() const;
0051     void setHotspotConnectionPath(const QString &path);
0052 
0053     bool showPasswordDialog() const;
0054 
0055     bool systemConnectionsByDefault() const;
0056 
0057 Q_SIGNALS:
0058     void airplaneModeEnabledChanged();
0059     void manageVirtualConnectionsChanged(bool manage);
0060 
0061 private:
0062     const QPointer<Configuration> mConfiguration;
0063 };
0064 
0065 #endif // CONFIGURATIONPROXY_H