diff options
Diffstat (limited to 'src/qtdevicesettings/networksettingsplugin/networksettings/connman')
13 files changed, 0 insertions, 1446 deletions
diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml deleted file mode 100644 index 5c52b27..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml +++ /dev/null @@ -1,108 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<node name="/Manager" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="net.connman.Manager"> - - <method name="GetProperties" tp:name-for-bindings="Get_Properties"> - <arg name="properties" type="a{sv}" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> - </method> - - <method name="SetProperty" tp:name-for-bindings="Set_Property"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </method> - - <method name="GetTechnologies" tp:name-for-bindings="Get_Technologies"> - <arg name="technologies" type="a(oa{sv})" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapList"/> - </method> - - <method name="GetServices" tp:name-for-bindings="Get_Services"> - <arg name="services" type="a(oa{sv})" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapList"/> - </method> - - <method name="GetSavedServices" tp:name-for-bindings="Get_Saved_Services"> - <arg name="services" type="a(oa{sv})" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapList"/> - </method> - - <method name="RemoveSavedService" tp:name-for-bindings="Remove_Saved_Services"> - <arg name="identifier" type="s" direction="in"/> - </method> - - <method name="RegisterAgent" tp:name-for-bindings="Register_Agent"> - <arg name="path" type="o"/> - </method> - - <method name="UnregisterAgent" tp:name-for-bindings="Unregister_Agent"> - <arg name="path" type="o"/> - </method> - - <method name="RegisterCounter" tp:name-for-bindings="Register_Counter"> - <arg name="path" type="o"/> - <arg name="accuracy" type="u"/> - <arg name="period" type="u"/> - </method> - - <method name="UnregisterCounter" tp:name-for-bindings="Unregister_Counter"> - <arg name="path" type="o"/> - </method> - - <method name="ResetCounters" tp:name-for-bindings="Reset_Counters"> - <arg name="type" type="s"/> - </method> - - <method name="CreateSession" tp:name-for-bindings="Create_Session"> - <arg name="settings" type="a{sv}"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> - <arg name="notifier" type="o"/> - <arg name="session" type="o" direction="out"/> - </method> - - <method name="DestroySession" tp:name-for-bindings="Destroy_Session"> - <arg name="session" type="o"/> - </method> - - <method name="RequestPrivateNetwork" tp:name-for-bindings="Request_Private_Network"> - <arg name="options" type="a{sv}"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> - <arg name="path" type="o" direction="out"/> - <arg name="dict" type="a{sv}" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/> - <arg name="fd" type="i" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/> - </method> - - <method name="ReleasePrivateNetwork" tp:name-for-bindings="Release_Private_Network"> - <arg name="path" type="o"/> - </method> - - <signal name="NetworkTypeAdded" tp:name-for-bindings="NetworkType_Added"> - <arg name="technology" type="o"/> - <arg name="properties" type="a{sv}"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> - </signal> - - <signal name="NetworkTypeRemoved" tp:name-for-bindings="NetworkType_Removed"> - <arg name="technology" type="o"/> - </signal> - - <signal name="ServicesChanged" tp:name-for-bindings="Services_Changed"> - <arg name="changed" type="a(oa{sv})"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ConnmanMapList"/> - <arg name="removed" type="ao"/> - </signal> - - <signal name="SavedServicesChanged" tp:name-for-bindings="SavedServices_Changed"> - <arg name="changed" type="a(oa{sv})"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ConnmanMapList"/> - </signal> - - <signal name="PropertyChanged" tp:name-for-bindings="Property_Changed"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </signal> - - </interface> -</node> diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml deleted file mode 100644 index c41aca4..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<node name="/Service" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="net.connman.Service"> - - <method name="GetProperties" tp:name-for-bindings="Get_Properties"> - <arg name="properties" type="a{sv}" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> - </method> - - <method name="SetProperty" tp:name-for-bindings="Set_Property"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </method> - - <method name="ClearProperty" tp:name-for-bindings="Clear_Property"> - <arg name="name" type="s" /> - </method> - - <method name="Connect" tp:name-for-bindings="Connect" /> - - <method name="Disconnect" tp:name-for-bindings="Disconnect" /> - - <method name="Remove" tp:name-for-bindings="Remove" /> - - <method name="MoveBefore" tp:name-for-bindings="Move_Before"> - <arg name="service" type="o"/> - </method> - - <method name="MoveAfter" tp:name-for-bindings="Move_After"> - <arg name="service" type="o"/> - </method> - - <method name="ResetCounters" tp:name-for-bindings="Reset_Counters" /> - - <signal name="PropertyChanged" tp:name-for-bindings="Property_Changed"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </signal> - - </interface> -</node> diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml deleted file mode 100644 index 08d780f..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<node name="/Service" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0"> - <interface name="net.connman.Technology"> - - <method name="GetProperties" tp:name-for-bindings="Get_Properties"> - <arg name="properties" type="a{sv}" direction="out"/> - <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/> - </method> - - <method name="SetProperty" tp:name-for-bindings="Set_Property"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </method> - - <method name="Scan" tp:name-for-bindings="Scan"/> - - <signal name="PropertyChanged" tp:name-for-bindings="Property_Changed"> - <arg name="name" type="s"/> - <arg name="value" type="v"/> - </signal> - - </interface> -</node> diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp deleted file mode 100644 index 94a1fa1..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "connmancommon.h" - -//Conversion operations for datatypes -const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj) -{ - argument.beginStructure(); - argument >> obj.objectPath >> obj.propertyMap; - argument.endStructure(); - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj) -{ - argument.beginStructure(); - argument << obj.objectPath << obj.propertyMap; - argument.endStructure(); - return argument; -} - -const QString &operator>>(const QString &argument, QNetworkSettingsType &obj) -{ - if (argument == AttributeEthernet) { - obj.setType(QNetworkSettingsType::Wired); - } - else if (argument == AttributeWifi) { - obj.setType(QNetworkSettingsType::Wifi); - } - else { - obj.setType(QNetworkSettingsType::Unknown); - } - - return argument; -} - -const QString &operator>>(const QString &argument, QNetworkSettingsState &obj) -{ - if (argument == AttributeIdle) { - obj.setState(QNetworkSettingsState::Idle); - } - else if (argument == AttributeFailure) { - obj.setState(QNetworkSettingsState::Failure); - } - else if (argument == AttributeAssociation) { - obj.setState(QNetworkSettingsState::Association); - } - else if (argument == AttributeConfiguration) { - obj.setState(QNetworkSettingsState::Configuration); - } - else if (argument == AttributeReady) { - obj.setState(QNetworkSettingsState::Ready); - } - else if (argument == AttributeDisconnect) { - obj.setState(QNetworkSettingsState::Disconnect); - } - else if (argument == AttributeOneline) { - obj.setState(QNetworkSettingsState::Online); - } - else { - obj.setState(QNetworkSettingsState::Undefined); - } - return argument; -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h deleted file mode 100644 index dd3e7af..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef CONNMANCOMMON_H -#define CONNMANCOMMON_H - -#include <QtCore/QMetaType> -#include <QtDBus> -#include <qnetworksettings.h> - -#define AgentPath "/ConnmanAgent" -#define PropertyState "State" -#define PropertyName "Name" -#define PropertyType "Type" -#define PropertyConnected "Connected" -#define PropertyPowered "Powered" - -#define AttributeWifi "wifi" -#define AttributeEthernet "ethernet" -#define AttributeIdle "idle" -#define AttributeFailure "failure" -#define AttributeAssociation "association" -#define AttributeConfiguration "configuration" -#define AttributeReady "ready" -#define AttributeDisconnect "disconnect" -#define AttributeOneline "online" - -struct ConnmanMap { - QDBusObjectPath objectPath; - QVariantMap propertyMap; -}; - -QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj); -const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj); - -const QString &operator>>(const QString &argument, QNetworkSettingsType &obj); -const QString &operator>>(const QString &argument, QNetworkSettingsState &obj); - -typedef QList<ConnmanMap> ConnmanMapList; - -Q_DECLARE_METATYPE( ConnmanMap ) -Q_DECLARE_METATYPE( ConnmanMapList ) - - -#endif // CONNMANCOMMON_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp deleted file mode 100644 index 9a034d0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsinterface_p.h" -#include "qnetworksettingsinterface.h" -#include "connman_technology_interface.h" -#include "connmancommon.h" - -QNetworkSettingsInterfacePrivate::QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent) - : QObject(parent) - ,q_ptr(parent) -{ - -} - -void QNetworkSettingsInterfacePrivate::initialize(const QString& path, const QVariantMap& properties) -{ - m_technology = new NetConnmanTechnologyInterface("net.connman", path, - QDBusConnection::systemBus(), this); - connect(m_technology, SIGNAL(PropertyChanged(QString,QDBusVariant)), - this, SLOT(updateProperty(QString,QDBusVariant))); - - updateProperty(PropertyName, properties[PropertyName]); - updateProperty(PropertyType, properties[PropertyType]); - updateProperty(PropertyConnected, properties[PropertyConnected]); - updateProperty(PropertyPowered, properties[PropertyPowered]); -} - -void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QDBusVariant &value) -{ - updateProperty(name, value.variant()); -} - -void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QVariant &value) -{ - Q_Q(QNetworkSettingsInterface); - if (name == PropertyName) { - m_name = qdbus_cast<QString>(value); - } - else if (name == PropertyType) { - qdbus_cast<QString>(value) >> m_type; - emit q->typeChanged(); - } - else if (name == PropertyConnected) { - bool connected = qdbus_cast<bool>(value); - if (connected) - m_state.setState(QNetworkSettingsState::Online); - else - m_state.setState(QNetworkSettingsState::Disconnect); - emit q->stateChanged(); - } - else if (name == PropertyPowered) { - m_powered = qdbus_cast<bool>(value); - emit q->poweredChanged(); - } -} - -void QNetworkSettingsInterfacePrivate::setState(QNetworkSettingsState::States aState) -{ - Q_Q(QNetworkSettingsInterface); - m_state.setState(aState); - emit q->stateChanged(); -} - -void QNetworkSettingsInterfacePrivate::setPowered(const bool aPowered) -{ - m_technology->SetProperty(PropertyPowered, QDBusVariant(QVariant(aPowered))); -} - -void QNetworkSettingsInterfacePrivate::scan() -{ - m_technology->Scan(); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h deleted file mode 100644 index 6e1d5ca..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSINTERFACEPRIVATE_H -#define QNETWORKSETTINGSINTERFACEPRIVATE_H - -#include <QObject> -#include <QtDBus> -#include "qnetworksettings.h" -#include "qnetworksettingsinterface.h" - -class NetConnmanTechnologyInterface; - -class QNetworkSettingsInterfacePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsInterface) -public: - explicit QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent); - void initialize(const QString& path, const QVariantMap& properties); - void setPowered(const bool power); - void setState(QNetworkSettingsState::States aState); - void scan(); - -public slots: - void updateProperty(const QString &name, const QDBusVariant &value); -protected: - void updateProperty(const QString &name, const QVariant &value); - -protected: - NetConnmanTechnologyInterface *m_technology; - QString m_name; - QNetworkSettingsType m_type; - QNetworkSettingsState m_state; - bool m_powered; - QNetworkSettingsInterface *q_ptr; -}; - - -class ConnmanSettingsInterface : public QNetworkSettingsInterface -{ - Q_OBJECT -public: - ConnmanSettingsInterface(const QString& path, const QVariantMap& properties, QObject *parent=0) - :QNetworkSettingsInterface(parent) - { - if (d_ptr) - d_ptr->initialize(path, properties); - } - - void setState(QNetworkSettingsState::States aState) { - Q_D(QNetworkSettingsInterface); - d->setState(aState); - } - - virtual ~ConnmanSettingsInterface() { - - } -}; -#endif // QNETWORKSETTINGSINTERFACEPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp deleted file mode 100644 index 8df7276..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsmanager_p.h" -#include "connman_manager_interface.cpp" -#include "moc_connman_manager_interface.cpp" -#include "qnetworksettingsinterface.h" -#include "qnetworksettingsinterface_p.h" - -QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent) - :QObject(parent) - ,q_ptr(parent) -{ - m_serviceFilter.setSourceModel(&m_serviceModel); - m_manager = new NetConnmanManagerInterface("net.connman", "/", - QDBusConnection::systemBus(), this); - - if (m_manager->isValid()) { - //List technologies - QDBusPendingReply<ConnmanMapList> reply = m_manager->GetTechnologies(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(getTechnologiesFinished(QDBusPendingCallWatcher*))); - - reply = m_manager->GetServices(); - watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(getServicesFinished(QDBusPendingCallWatcher*))); - - connect(m_manager, &NetConnmanManagerInterface::ServicesChanged, this, &QNetworkSettingsManagerPrivate::servicesChanged); - - m_manager->RegisterAgent(QDBusObjectPath(AgentPath)); - } - else { - delete m_manager; - m_manager = NULL; - } -} - -void QNetworkSettingsManagerPrivate::requestInput(const QString& service, const QString& type) -{ - Q_UNUSED(type); - foreach (QNetworkSettingsService* servicePtr, m_serviceModel.getModel()) { - if (servicePtr->id() == service) - emit servicePtr->showCrendentialInput(); - } -} - -void QNetworkSettingsManagerPrivate::getServicesFinished(QDBusPendingCallWatcher *watcher) -{ - Q_Q(QNetworkSettingsManager); - QDBusPendingReply<ConnmanMapList> reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) - return; - - foreach (const ConnmanMap &object, reply.value()) { - const QString servicePath = object.objectPath.path(); - QNetworkSettingsService *service = new QNetworkSettingsService(servicePath, this); - m_serviceModel.append(service); - - //Update status property - QString n = qdbus_cast<QString>(object.propertyMap[PropertyName]); - QString t = qdbus_cast<QString>(object.propertyMap[PropertyType]); - QString s = qdbus_cast<QString>(object.propertyMap[PropertyState]); - - QNetworkSettingsType type; - t >> type; - QNetworkSettingsState state; - s >> state; - - foreach (QNetworkSettingsInterface* item, m_interfaceModel.getModel()) { - ConnmanSettingsInterface* technology = qobject_cast<ConnmanSettingsInterface*>(item); - if (technology->name() == n && technology->type() == type.type()) { - technology->setState(state.state()); - } - } - } - emit q->servicesChanged(); -} - -void QNetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWatcher *watcher) -{ - Q_Q(QNetworkSettingsManager); - - QDBusPendingReply<ConnmanMapList> reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) - return; - - foreach (const ConnmanMap &object, reply.value()) { - ConnmanSettingsInterface *item = new ConnmanSettingsInterface(object.objectPath.path(), object.propertyMap, this); - - if (item->type() == QNetworkSettingsType::Wired) { - m_interfaceModel.insert(0, item); - } - else if (item->type() == QNetworkSettingsType::Wifi) { - m_interfaceModel.append(item); - } - emit q->interfacesChanged(); - } -} - -void QNetworkSettingsManagerPrivate::servicesChanged(ConnmanMapList changed, const QList<QDBusObjectPath> &removed) -{ - foreach (QDBusObjectPath path, removed) { - QList<QNetworkSettingsService*> serviceList = m_serviceModel.getModel(); - QMutableListIterator<QNetworkSettingsService*> i(serviceList); - while (i.hasNext()) { - if (i.next()->id() == path.path()) - i.remove(); - } - } - - QStringList newServices; - foreach (ConnmanMap map, changed) { - bool found = false; - foreach (QNetworkSettingsService* service, m_serviceModel.getModel()) { - if (service->id() == map.objectPath.path()) { - found =true; - break; - } - } - if (!found) - newServices.append(map.objectPath.path()); - } - foreach (QString newService, newServices) { - QNetworkSettingsService *service = new QNetworkSettingsService(newService, this); - m_serviceModel.append(service); - } -} - -void QNetworkSettingsManagerPrivate::setUserAgent(QNetworkSettingsUserAgent *agent) -{ - -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h deleted file mode 100644 index cadf63f..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSMANAGERPRIVATE_H -#define QNETWORKSETTINGSMANAGERPRIVATE_H - -#include <QObject> -#include <QtDBus> -#include "connmancommon.h" -#include "qnetworksettingsmanager.h" -#include "qnetworksettingsinterfacemodel.h" -#include "qnetworksettingsservicemodel.h" - -class NetConnmanManagerInterface; - -class QNetworkSettingsManagerPrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsManager) -public: - explicit QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent); - QNetworkSettingsManager *q_ptr; - void setUserAgent(QNetworkSettingsUserAgent *agent); - -public slots: - void getServicesFinished(QDBusPendingCallWatcher *watcher); - void getTechnologiesFinished(QDBusPendingCallWatcher *watcher); - void requestInput(const QString& service, const QString& type); - void servicesChanged(ConnmanMapList changed, const QList<QDBusObjectPath> &removed); - -protected: - QNetworkSettingsInterfaceModel m_interfaceModel; - QNetworkSettingsServiceModel m_serviceModel; - QNetworkSettingsServiceFilter m_serviceFilter; -private: - NetConnmanManagerInterface *m_manager; -}; - -#endif // QNETWORKSETTINGSMANAGERPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp deleted file mode 100644 index 9e2e83c..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsservice_p.h" -#include "connman_service_interface.h" -#include "connmancommon.h" - -const QString PropertyIPv4("IPv4"); -const QString PropertyQNetworkSettingsIPv4("IPv4.Configuration"); -const QString PropertyIPv6("IPv6"); -const QString PropertyQNetworkSettingsIPv6("IPv6.Configuration"); -const QString PropertyNameservers("Nameservers"); -const QString PropertyNameserversConfig("Nameservers.Configuration"); -const QString PropertyDomains("Domains"); -const QString PropertyDomainsConfig("Domains.Configuration"); -const QString PropertyProxy("Proxy"); -const QString PropertyQNetworkSettingsProxy("Proxy.Configuration"); -const QString PropertyAddress("Address"); -const QString PropertyNetMask("Netmask"); -const QString PropertyGateway("Gateway"); -const QString PropertyPrefixLength("PrefixLength"); -const QString PropertyMethod("Method"); -const QString PropertyPrivacy("Privacy"); -const QString PropertyUrl("Url"); -const QString PropertyServers("Servers"); -const QString PropertyExcludes("Excludes"); -const QString PropertyStrength("Strength"); -const QString PropertySecurity("Security"); - -const QString AttributeAuto("auto"); -const QString AttributeDhcp("dhcp"); -const QString AttributeManual("manual"); -const QString AttributeOff("off"); -const QString AttributeDisabled("disabled"); -const QString AttributeEnabled("enabled"); -const QString AttributePreferred("preferred"); -const QString AttributeDirect("direct"); -const QString AttributeNone("none"); -const QString AttributeWep("wep"); -const QString AttributePsk("psk"); -const QString AttributeIeee("ieee8021x"); -const QString AttributeWps("wps"); -const QString AttributeInvalidKey("invalid-key"); - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv4 &obj) -{ - obj.setAddress(argument[PropertyAddress].toString()); - obj.setMask(argument[PropertyNetMask].toString()); - obj.setGateway(argument[PropertyGateway].toString()); - - QString method = argument[PropertyMethod].toString(); - - if (method == AttributeDhcp) { - obj.setMethod(QNetworkSettingsIPv4::Dhcp); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsIPv4::Manual); - } - else if (method == AttributeOff) { - obj.setMethod(QNetworkSettingsIPv4::Off); - } - else { - obj.setMethod(QNetworkSettingsIPv4::Off); - } - return argument; -} - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv4 &obj) -{ - argument.insert(PropertyAddress, QVariant::fromValue(obj.address())); - - argument.insert(PropertyNetMask, QVariant::fromValue(obj.mask())); - - argument.insert(PropertyGateway, QVariant::fromValue(obj.gateway())); - - QString method; - switch (obj.method()) { - case QNetworkSettingsIPv4::Dhcp: - method = AttributeDhcp; - break; - case QNetworkSettingsIPv4::Manual: - method = AttributeManual; - break; - case QNetworkSettingsIPv4::Off: - method = AttributeOff; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - return argument; -} - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv6 &obj) -{ - obj.setAddress(argument[PropertyAddress].toString()); - obj.setGateway(argument[PropertyGateway].toString()); - obj.setPrefixLength(argument[PropertyPrefixLength].toInt()); - QString method = argument[PropertyMethod].toString(); - if (method == AttributeAuto) { - obj.setMethod(QNetworkSettingsIPv6::Auto); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsIPv6::Manual); - } - else if (method == AttributeOff) { - obj.setMethod(QNetworkSettingsIPv6::Off); - } - QString privacy = argument[PropertyPrivacy].toString(); - - if (privacy == AttributeDisabled) { - obj.setPrivacy(QNetworkSettingsIPv6::Disabled); - } - else if (privacy == AttributeEnabled) { - obj.setPrivacy(QNetworkSettingsIPv6::Enabled); - } - else if (privacy == AttributePreferred) { - obj.setPrivacy(QNetworkSettingsIPv6::Preferred); - } - return argument; -} - - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv6 &obj) -{ - argument.insert(PropertyAddress, QVariant::fromValue(obj.address())); - argument.insert(PropertyGateway, QVariant::fromValue(obj.address())); - argument.insert(PropertyPrefixLength, QVariant::fromValue(obj.prefixLength())); - - QString method; - switch (obj.method()) { - case QNetworkSettingsIPv6::Auto: - method = AttributeAuto; - break; - case QNetworkSettingsIPv6::Manual: - method = AttributeManual; - break; - case QNetworkSettingsIPv6::Off: - method = AttributeOff; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - - QString privacy; - switch (obj.privacy()) { - case QNetworkSettingsIPv6::Disabled: - method = AttributeDisabled; - break; - case QNetworkSettingsIPv6::Enabled: - method = AttributeEnabled; - break; - case QNetworkSettingsIPv6::Preferred: - method = AttributePreferred; - break; - default: - break; - } - argument.insert(PropertyPrivacy, QVariant::fromValue(privacy)); - - return argument; -} - - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsProxy &obj) -{ - QString method = argument[PropertyMethod].toString(); - if (method == AttributeDirect) { - obj.setMethod(QNetworkSettingsProxy::Direct); - } - else if (method == AttributeAuto) { - obj.setMethod(QNetworkSettingsProxy::Auto); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsProxy::Manual); - } - - QString urlStr = argument[PropertyUrl].toString(); - obj.setUrl(QUrl(urlStr)); - - obj.setServers(argument[PropertyServers].toStringList()); - obj.setExcludes(argument[PropertyExcludes].toStringList()); - - return argument; -} - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsProxy &obj) -{ - QString method; - switch (obj.method()) { - case QNetworkSettingsProxy::Direct: - method = AttributeDirect; - break; - case QNetworkSettingsProxy::Auto: - method = AttributeAuto; - break; - case QNetworkSettingsProxy::Manual: - method = AttributeManual; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - argument.insert(PropertyUrl, QVariant::fromValue(obj.url().toString())); - argument.insert(PropertyServers, QVariant::fromValue(obj.servers())); - argument.insert(PropertyServers, QVariant::fromValue(obj.excludes())); - - return argument; -} - -QNetworkSettingsServicePrivate::QNetworkSettingsServicePrivate(const QString& id, QNetworkSettingsService *parent) : - QObject(parent) - ,q_ptr(parent) - ,m_id(id) -{ - qDBusRegisterMetaType<ConnmanMap>(); - qDBusRegisterMetaType<ConnmanMapList>(); - - m_service = new NetConnmanServiceInterface("net.connman", m_id, - QDBusConnection::systemBus(), this); - - connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)), - this, SLOT(updateProperty(QString,QDBusVariant))); - - QDBusPendingReply<QVariantMap> reply = m_service->GetProperties(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(propertiesUpdated(QDBusPendingCallWatcher*))); -} - -void QNetworkSettingsServicePrivate::setupIpv6Config() -{ - QVariantMap param; - param << m_ipv6config; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsIPv6, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupNameserversConfig() -{ - QVariant param = QVariant::fromValue(m_nameserverConfig.stringList()); - if (m_service) - m_service->SetProperty(PropertyNameserversConfig, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupDomainsConfig() -{ - QVariant param = QVariant::fromValue(m_domainsConfig.stringList()); - if (m_service) - m_service->SetProperty(PropertyDomainsConfig, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupQNetworkSettingsProxy() -{ - QVariantMap param; - param << m_proxyConfig; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsProxy, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupIpv4Config() -{ - QVariantMap param; - param << m_ipv4config; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsIPv4, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::connectService() -{ - if (m_service) { - m_service->Connect(); - } -} - -void QNetworkSettingsServicePrivate::disconnectService() -{ - if (m_service) - m_service->Disconnect(); - -} - -void QNetworkSettingsServicePrivate::propertiesUpdated(QDBusPendingCallWatcher *call) -{ - QDBusPendingReply<QVariantMap> reply = *call; - call->deleteLater(); - - if (!reply.isError()) - setupConfiguration(reply.value()); -} - -void QNetworkSettingsServicePrivate::updateProperty(const QString &name, const QDBusVariant &value) -{ - updateProperty(name, value.variant()); -} - -void QNetworkSettingsServicePrivate::updateProperty(const QString& key, const QVariant& val) -{ - Q_Q(QNetworkSettingsService); - - if (key == PropertyIPv4) { - QVariantMap value = qdbus_cast<QVariantMap>(val); - value >> m_ipv4config; - emit q->ipv4Changed(); - } - else if (key == PropertyIPv6) { - QVariantMap value = qdbus_cast<QVariantMap>(val); - value >> m_ipv6config; - emit q->ipv6Changed(); - } - else if (key == PropertyNameservers) { - QStringList value = qdbus_cast<QStringList>(val); - m_nameserverConfig.setStringList(value); - emit q->nameserversChanged(); - } - else if (key == PropertyDomains) { - QStringList value = qdbus_cast<QStringList>(val); - m_domainsConfig.setStringList(value); - emit q->domainsChanged(); - } - else if (key == PropertyProxy) { - QVariantMap value = qdbus_cast<QVariantMap>(val); - value >> m_proxyConfig; - emit q->proxyChanged(); - } - else if (key == PropertyState) { - QString value = qdbus_cast<QString>(val); - value >> m_state; - emit q->stateChanged(); - } - else if (key == PropertyName) { - m_name = qdbus_cast<QString>(val); - emit q->nameChanged(); - } - else if (key == PropertyType) { - QString value = qdbus_cast<QString>(val); - value >> m_type; - } - else if (key == PropertyStrength) { - m_wifiConfig.setSignalStrength(val.toInt()); - } - else if (key == PropertySecurity) { - QStringList value = qdbus_cast<QStringList>(val); - foreach (const QString str, value) { - if (str == AttributeNone || str == AttributeWps) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::None); - } - else if (str == AttributeWep) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WEP); - } - else if (str == AttributePsk) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA); - } - else if (str == AttributeIeee) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA2); - } - } - } -} - -void QNetworkSettingsServicePrivate::setupConfiguration(const QVariantMap &properties) -{ - QVariantMap::const_iterator it = properties.constBegin(), end = properties.constEnd(); - for ( ; it != end; ++it) { - updateProperty(it.key(), it.value()); - } -} - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h deleted file mode 100644 index 39a04bd..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSSERVICEPRIVATE_H -#define QNETWORKSETTINGSSERVICEPRIVATE_H - -#include <QtDBus> -#include "qnetworksettingsservice.h" -#include "qnetworksettings.h" - -class NetConnmanServiceInterface; - -class QNetworkSettingsServicePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsService) -public: - QNetworkSettingsServicePrivate(const QString& aPath, QNetworkSettingsService *parent=0); - - QNetworkSettingsService *q_ptr; -private slots: - void propertiesUpdated(QDBusPendingCallWatcher *call); - void updateProperty(const QString &name, const QDBusVariant &value); - -private: - void setupConfiguration(const QVariantMap &properties); - void updateProperty(const QString& key, const QVariant& value); - -protected: - void setAutoConnect(const bool autoconnect); - void setupIpv4Config(); - void setupIpv6Config(); - void setupNameserversConfig(); - void setupDomainsConfig(); - void setupQNetworkSettingsProxy(); - void connectService(); - void disconnectService(); - - QString m_id; - QString m_name; - QNetworkSettingsState m_state; - QNetworkSettingsIPv4 m_ipv4config; - QNetworkSettingsIPv6 m_ipv6config; - QNetworkSettingsAddressModel m_domainsConfig; - QNetworkSettingsAddressModel m_nameserverConfig; - QNetworkSettingsProxy m_proxyConfig; - QNetworkSettingsWireless m_wifiConfig; - QNetworkSettingsType m_type; - NetConnmanServiceInterface *m_service; -}; - -#endif // QNETWORKSETTINGSSERVICEPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp deleted file mode 100644 index 3b10bed..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsuseragent_p.h" -#include "connmancommon.h" - -const QString PropertyPassphrase("Passphrase"); - -QNetworkSettingsUserAgentPrivate::QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent) - :QDBusAbstractAdaptor(parent) - ,q_ptr(parent) - ,m_pendingReply(false) -{ - - setAutoRelaySignals(true); - QMetaObject::invokeMethod(this, "registerAgent", Qt::QueuedConnection); -} - -void QNetworkSettingsUserAgentPrivate::cancel() -{ - // handle method call net.connman.Agent.Cancel - m_pendingReply = false; - QMetaObject::invokeMethod(parent(), "Cancel"); -} - -void QNetworkSettingsUserAgentPrivate::release() -{ - // handle method call net.connman.Agent.Release - QMetaObject::invokeMethod(parent(), "Release"); -} - -void QNetworkSettingsUserAgentPrivate::ReportError(const QDBusObjectPath &path, const QString ¶m) -{ - Q_Q(QNetworkSettingsUserAgent); - Q_UNUSED(path); - Q_UNUSED(param); - emit q->error(); -} - -void QNetworkSettingsUserAgentPrivate::registerAgent() -{ - Q_Q(QNetworkSettingsUserAgent); - QDBusConnection::systemBus().registerObject(AgentPath, q_ptr); -} - -QVariantMap QNetworkSettingsUserAgentPrivate::RequestInput(const QDBusObjectPath &path, const QVariantMap ¶ms, const QDBusMessage &msg) -{ - Q_Q(QNetworkSettingsUserAgent); - Q_UNUSED(path); - Q_UNUSED(params); - msg.setDelayedReply(true); - m_reply = msg.createReply(); - m_pendingReply = true; - emit q->showUserCredentialsInput(); - return QVariantMap(); -} - -void QNetworkSettingsUserAgentPrivate::setUserCredentials(const QString& username, - const QString& password) -{ - m_username = username; - m_passphrase = password; - QVariantMap response; - response[PropertyName] = m_username; - response[PropertyPassphrase] = m_passphrase; - m_reply << response; - m_pendingReply = false; - QDBusConnection::systemBus().send(m_reply); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h deleted file mode 100644 index 92e1516..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSUSERAGENTPRIVATE_H -#define QNETWORKSETTINGSUSERAGENTPRIVATE_H - -#include <QtCore/QObject> -#include <QtDBus/QtDBus> -#include "qnetworksettingsuseragent.h" - -QT_BEGIN_NAMESPACE -class QByteArray; -template<class T> class QList; -template<class Key, class Value> class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -const QString AgentPath("/ConnmanAgent"); - -class QNetworkSettingsUserAgentPrivate : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "net.connman.Agent") - Q_DECLARE_PUBLIC(QNetworkSettingsUserAgent) -public: - QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent=0); - void setUserCredentials(const QString& aUsername, const QString& aPassword); - void cancel(); - void release(); -public Q_SLOTS: // Dbus methods - void ReportError(const QDBusObjectPath &path, const QString ¶m); - QVariantMap RequestInput(const QDBusObjectPath &path, const QVariantMap ¶ms, - const QDBusMessage &message); - void registerAgent(); -private: - QNetworkSettingsUserAgent *q_ptr; - QDBusMessage m_reply; - bool m_pendingReply; - QString m_passphrase; - QString m_username; -}; - -#endif // QNETWORKSETTINGSUSERAGENTPRIVATE_H |