summaryrefslogtreecommitdiffstats
path: root/src/networksettings
diff options
context:
space:
mode:
Diffstat (limited to 'src/networksettings')
-rw-r--r--src/networksettings/connman/connman_manager.xml10
-rw-r--r--src/networksettings/connman/connmancommon.cpp4
-rw-r--r--src/networksettings/connman/connmancommon.h12
-rw-r--r--src/networksettings/connman/qnetworksettingsmanager_p.cpp34
-rw-r--r--src/networksettings/connman/qnetworksettingsmanager_p.h5
-rw-r--r--src/networksettings/connman/qnetworksettingsservice_p.cpp4
-rw-r--r--src/networksettings/networksettings.pro6
-rw-r--r--src/networksettings/qnetworksettings.qdoc271
-rw-r--r--src/networksettings/qnetworksettingsinterface.cpp70
-rw-r--r--src/networksettings/qnetworksettingsservice.cpp181
-rw-r--r--src/networksettings/qnetworksettingsservicemodel.cpp36
-rw-r--r--src/networksettings/qnetworksettingsservicemodel.h1
-rw-r--r--src/networksettings/wpasupplicant/qwifidevice.cpp1
13 files changed, 598 insertions, 37 deletions
diff --git a/src/networksettings/connman/connman_manager.xml b/src/networksettings/connman/connman_manager.xml
index 5c52b27..c6ed244 100644
--- a/src/networksettings/connman/connman_manager.xml
+++ b/src/networksettings/connman/connman_manager.xml
@@ -14,17 +14,17 @@
<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"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapStructList"/>
</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"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapStructList"/>
</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"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ConnmanMapStructList"/>
</method>
<method name="RemoveSavedService" tp:name-for-bindings="Remove_Saved_Services">
@@ -90,13 +90,13 @@
<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"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ConnmanMapStructList"/>
<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"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="ConnmanMapStructList"/>
</signal>
<signal name="PropertyChanged" tp:name-for-bindings="Property_Changed">
diff --git a/src/networksettings/connman/connmancommon.cpp b/src/networksettings/connman/connmancommon.cpp
index 90ab9ee..f609f22 100644
--- a/src/networksettings/connman/connmancommon.cpp
+++ b/src/networksettings/connman/connmancommon.cpp
@@ -29,7 +29,7 @@
#include "connmancommon.h"
//Conversion operations for datatypes
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj)
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMapStruct &obj)
{
argument.beginStructure();
argument >> obj.objectPath >> obj.propertyMap;
@@ -37,7 +37,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj)
return argument;
}
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj)
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMapStruct &obj)
{
argument.beginStructure();
argument << obj.objectPath << obj.propertyMap;
diff --git a/src/networksettings/connman/connmancommon.h b/src/networksettings/connman/connmancommon.h
index 7748455..b50a11d 100644
--- a/src/networksettings/connman/connmancommon.h
+++ b/src/networksettings/connman/connmancommon.h
@@ -50,21 +50,21 @@
#define AttributeDisconnect QStringLiteral("disconnect")
#define AttributeOneline QStringLiteral("online")
-struct ConnmanMap {
+struct ConnmanMapStruct {
QDBusObjectPath objectPath;
QVariantMap propertyMap;
};
-QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj);
-const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj);
+QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMapStruct &obj);
+const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMapStruct &obj);
const QString &operator>>(const QString &argument, QNetworkSettingsType &obj);
const QString &operator>>(const QString &argument, QNetworkSettingsState &obj);
-typedef QList<ConnmanMap> ConnmanMapList;
+typedef QList<ConnmanMapStruct> ConnmanMapStructList;
-Q_DECLARE_METATYPE( ConnmanMap )
-Q_DECLARE_METATYPE( ConnmanMapList )
+Q_DECLARE_METATYPE( ConnmanMapStruct )
+Q_DECLARE_METATYPE( ConnmanMapStructList )
#endif // CONNMANCOMMON_H
diff --git a/src/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/networksettings/connman/qnetworksettingsmanager_p.cpp
index f77b331..875be9b 100644
--- a/src/networksettings/connman/qnetworksettingsmanager_p.cpp
+++ b/src/networksettings/connman/qnetworksettingsmanager_p.cpp
@@ -32,11 +32,18 @@
#include "qnetworksettingsinterface.h"
#include "qnetworksettingsinterface_p.h"
#include "qnetworksettingsservicemodel.h"
+#include "qnetworksettingsuseragent.h"
QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent)
:QObject(parent)
,q_ptr(parent)
{
+ qDBusRegisterMetaType<ConnmanMapStruct>();
+ qDBusRegisterMetaType<ConnmanMapStructList>();
+
+ QNetworkSettingsUserAgent* userAgent = new QNetworkSettingsUserAgent(this);
+ this->setUserAgent(userAgent);
+
m_serviceModel = new QNetworkSettingsServiceModel(this);
m_serviceFilter = new QNetworkSettingsServiceFilter(this);
m_serviceFilter->setSourceModel(m_serviceModel);
@@ -45,7 +52,7 @@ QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsM
if (m_manager->isValid()) {
//List technologies
- QDBusPendingReply<ConnmanMapList> reply = m_manager->GetTechnologies();
+ QDBusPendingReply<ConnmanMapStructList> reply = m_manager->GetTechnologies();
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(getTechnologiesFinished(QDBusPendingCallWatcher*)));
@@ -55,7 +62,7 @@ QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsM
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
this, SLOT(getServicesFinished(QDBusPendingCallWatcher*)));
- connect(m_manager, &NetConnmanManagerInterface::ServicesChanged, this, &QNetworkSettingsManagerPrivate::servicesChanged);
+ connect(m_manager, &NetConnmanManagerInterface::ServicesChanged, this, &QNetworkSettingsManagerPrivate::onServicesChanged);
m_manager->RegisterAgent(QDBusObjectPath(AgentPath));
}
@@ -72,17 +79,19 @@ void QNetworkSettingsManagerPrivate::requestInput(const QString& service, const
if (servicePtr->id() == service)
emit servicePtr->showCrendentialInput();
}
+ m_agent->showUserCredentialsInput();
}
void QNetworkSettingsManagerPrivate::getServicesFinished(QDBusPendingCallWatcher *watcher)
{
Q_Q(QNetworkSettingsManager);
- QDBusPendingReply<ConnmanMapList> reply = *watcher;
+ QDBusPendingReply<ConnmanMapStructList> reply = *watcher;
watcher->deleteLater();
+
if (reply.isError())
return;
- foreach (const ConnmanMap &object, reply.value()) {
+ foreach (const ConnmanMapStruct &object, reply.value()) {
const QString servicePath = object.objectPath.path();
QNetworkSettingsService *service = new QNetworkSettingsService(servicePath, this);
m_serviceModel->append(service);
@@ -111,12 +120,12 @@ void QNetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWat
{
Q_Q(QNetworkSettingsManager);
- QDBusPendingReply<ConnmanMapList> reply = *watcher;
+ QDBusPendingReply<ConnmanMapStructList> reply = *watcher;
watcher->deleteLater();
if (reply.isError())
return;
- foreach (const ConnmanMap &object, reply.value()) {
+ foreach (const ConnmanMapStruct &object, reply.value()) {
ConnmanSettingsInterface *item = new ConnmanSettingsInterface(object.objectPath.path(), object.propertyMap, this);
if (item->type() == QNetworkSettingsType::Wired) {
@@ -129,19 +138,14 @@ void QNetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWat
}
}
-void QNetworkSettingsManagerPrivate::servicesChanged(ConnmanMapList changed, const QList<QDBusObjectPath> &removed)
+void QNetworkSettingsManagerPrivate::onServicesChanged(ConnmanMapStructList 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();
- }
+ m_serviceModel->removeService(path.path());
}
QStringList newServices;
- foreach (ConnmanMap map, changed) {
+ foreach (ConnmanMapStruct map, changed) {
bool found = false;
foreach (QNetworkSettingsService* service, m_serviceModel->getModel()) {
if (service->id() == map.objectPath.path()) {
@@ -160,5 +164,5 @@ void QNetworkSettingsManagerPrivate::servicesChanged(ConnmanMapList changed, con
void QNetworkSettingsManagerPrivate::setUserAgent(QNetworkSettingsUserAgent *agent)
{
- Q_UNUSED(agent);
+ m_agent = agent;
}
diff --git a/src/networksettings/connman/qnetworksettingsmanager_p.h b/src/networksettings/connman/qnetworksettingsmanager_p.h
index 37a57dd..cb42654 100644
--- a/src/networksettings/connman/qnetworksettingsmanager_p.h
+++ b/src/networksettings/connman/qnetworksettingsmanager_p.h
@@ -47,12 +47,12 @@ public:
explicit QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent);
QNetworkSettingsManager *q_ptr;
void setUserAgent(QNetworkSettingsUserAgent *agent);
-
+ QNetworkSettingsUserAgent *getUserAgent() {return m_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);
+ void onServicesChanged(ConnmanMapStructList changed, const QList<QDBusObjectPath> &removed);
protected:
QNetworkSettingsInterfaceModel m_interfaceModel;
@@ -60,6 +60,7 @@ protected:
QNetworkSettingsServiceFilter *m_serviceFilter;
private:
NetConnmanManagerInterface *m_manager;
+ QNetworkSettingsUserAgent *m_agent;
};
#endif // QNETWORKSETTINGSMANAGERPRIVATE_H
diff --git a/src/networksettings/connman/qnetworksettingsservice_p.cpp b/src/networksettings/connman/qnetworksettingsservice_p.cpp
index c7ac462..8a7b2cf 100644
--- a/src/networksettings/connman/qnetworksettingsservice_p.cpp
+++ b/src/networksettings/connman/qnetworksettingsservice_p.cpp
@@ -239,8 +239,8 @@ QNetworkSettingsServicePrivate::QNetworkSettingsServicePrivate(const QString& id
,q_ptr(parent)
,m_id(id)
{
- qDBusRegisterMetaType<ConnmanMap>();
- qDBusRegisterMetaType<ConnmanMapList>();
+ qDBusRegisterMetaType<ConnmanMapStruct>();
+ qDBusRegisterMetaType<ConnmanMapStructList>();
m_service = new NetConnmanServiceInterface(QStringLiteral("net.connman"), m_id,
QDBusConnection::systemBus(), this);
diff --git a/src/networksettings/networksettings.pro b/src/networksettings/networksettings.pro
index 7220625..9ae1bb3 100644
--- a/src/networksettings/networksettings.pro
+++ b/src/networksettings/networksettings.pro
@@ -9,11 +9,11 @@ QT = core network
MODULE = networksettings
load(qt_module)
-connman {
- include(connman.pri)
+wpasupplicant {
+ include(wpasupplicant.pri)
}
else {
- include(wpasupplicant.pri)
+ include(connman.pri)
}
# Input
diff --git a/src/networksettings/qnetworksettings.qdoc b/src/networksettings/qnetworksettings.qdoc
new file mode 100644
index 0000000..008030d
--- /dev/null
+++ b/src/networksettings/qnetworksettings.qdoc
@@ -0,0 +1,271 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Device Utilities module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL$
+** 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 https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 or (at your option) any later version
+** approved by the KDE Free Qt Foundation. The licenses are as published by
+** the Free Software Foundation and appearing in the file LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \qmltype NetworkSettingsIPv4
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Encapsulates IPv4 network configuration.
+
+ The NetworkSettingsIPv4 type cannot be instantiated directly.
+
+ \sa {NetworkService::ipv4}{NetworkService.ipv4}
+*/
+
+/*!
+ \qmlproperty string NetworkSettingsIPv4::address
+ \brief Holds the IPv4 address.
+*/
+
+/*!
+ \qmlproperty string NetworkSettingsIPv4::gateway
+ \brief Holds the IPv4 gateway address
+*/
+
+/*!
+ \qmlproperty enumeration NetworkSettingsIPv4::method
+ \brief Holds the method of IPv4 configuration.
+
+ Possible values:
+
+ \value NetworkSettingsIPv4.Dhcp
+ Use DHCP protocol for IPv4 configuration
+
+ \value NetworkSettingsIPv4.Manual
+ Use manual settings
+
+ \value NetworkSettingsIPv4.Off
+ No configuration done
+*/
+
+/*!
+ \qmlproperty string NetworkSettingsIPv4::mask
+ \brief Holds the IPv4 network mask.
+*/
+
+/*!
+ \qmltype NetworkSettingsIPv6
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Encapsulates IPv6 network configuration.
+
+ The NetworkSettingsIPv6 type cannot be instantiated directly.
+
+ \sa {NetworkService::ipv6}{NetworkService.ipv6}
+*/
+
+/*!
+ \qmlproperty string NetworkSettingsIPv6::address
+ \brief Holds the IPv6 address.
+*/
+
+/*!
+ \qmlproperty string NetworkSettingsIPv6::gateway
+ \brief Holds the IPv6 gateway address.
+*/
+
+/*!
+ \qmlproperty enumeration NetworkSettingsIPv6::method
+ \brief Holds the method of IPv6 configuration.
+
+ Possible values:
+
+ \value NetworkSettingsIPv6.Auto
+ Use automatic configuration
+
+ \value NetworkSettingsIPv6.Manual
+ Use manual configuration
+
+ \value NetworkSettingsIPv6.Off
+ No configuration done
+*/
+
+/*!
+ \qmlproperty enumeration NetworkSettingsIPv6::privacy
+ \brief Holds the method of applying privacy extensions for IPv6.
+
+ Possible values:
+
+ \value NetworkSettingsIPv6.Disabled
+ Disable privacy extensions in IPv6
+
+ \value NetworkSettingsIPv6.Enabled
+ Enable \l {https://tools.ietf.org/html/rfc4941}
+ {Privacy Extensions for Stateless Address Autoconfiguration in IPv6}
+
+ \value NetworkSettingsIPv6.Preferred
+ Enable privacy extensions and prefer the use of temporary addresses, even
+ when a public address is available
+*/
+
+/*!
+ \qmlproperty int NetworkSettingsIPv6::prefixLength
+ \brief Holds the IPv6 network prefix length in bits.
+*/
+
+/*!
+ \qmltype NetworkSettingsProxy
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Encapsulates network proxy configuration.
+
+ The NetworkSettingsProxy type cannot be instantiated directly.
+
+ \sa {NetworkService::proxy}{NetworkService.proxy}
+*/
+
+/*!
+ \qmlproperty url NetworkSettingsProxy::url
+ \brief Holds the proxy URL.
+
+ For manual proxy configuration, the \e url holds the
+ proxy server address. For automatic configuration, it holds
+ the proxy auto-config URL.
+
+ \sa method
+*/
+
+/*!
+ \qmlproperty enumeration NetworkSettingsProxy::method
+ \brief Holds the network proxy configuration method.
+
+ Possible values:
+
+ \value NetworkSettingsProxy.Direct
+ Direct network connection, no proxy in use
+
+ \value NetworkSettingsProxy.Auto
+ Automatic proxy configuration
+
+ \value NetworkSettingsProxy.Manual
+ Manual proxy configuration
+
+ \sa url
+*/
+
+/*!
+ \qmlproperty object NetworkSettingsProxy::excludes
+ \readonly
+ \brief The model containing the proxy exclusion list.
+
+ The addresses in the proxy exclusion list are accessed directly,
+ instead of forwarding the requests to a proxy.
+
+ The \e excludes property can be used as a model for a view
+ that lists the proxy exclusion addresses.
+
+ \sa excludes.count, excludes.append(), excludes.remove(), excludes.resetChanges()
+*/
+
+/*!
+ \qmlproperty int NetworkSettingsProxy::excludes.count
+ \readonly
+ \brief Holds the number of addresses in the \l excludes model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::excludes.append(string address)
+ \brief Adds \a address into the \l excludes model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::excludes.remove(int index)
+ \brief Removes the entry at index \a index from the \l excludes model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::excludes.resetChanges()
+ \brief Clears unsaved changes from the \l excludes model.
+*/
+
+/*!
+ \qmlproperty object NetworkSettingsProxy::servers
+ \readonly
+ \brief The model containing the proxy servers.
+
+ The \e servers property can be used as a model for a view
+ that lists the proxy servers.
+
+ \sa servers.count, servers.append(), servers.remove(), servers.resetChanges()
+*/
+
+/*!
+ \qmlproperty int NetworkSettingsProxy::servers.count
+ \readonly
+ \brief Holds the number of addresses in the \l servers model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::servers.append(string address)
+ \brief Adds \a address into the \l servers model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::servers.remove(int index)
+ \brief Removes the entry at index \a index from the \l servers model.
+*/
+
+/*!
+ \qmlmethod void NetworkSettingsProxy::servers.resetChanges()
+ \brief Clears unsaved changes from the \l servers model.
+*/
+
+/*!
+ \qmltype NetworkSettingsWireless
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Encapsulates configuration for a Wifi network service.
+
+ The NetworkSettingsWireless type cannot be instantiated directly.
+
+ \sa {NetworkService::wirelessConfig}{NetworkService.wirelessConfig}
+*/
+
+/*!
+ \qmlproperty int NetworkSettingsWireless::signalStrength
+ \brief Holds the Wifi signal strength, in the range of 0 to 100.
+*/
+
+/*!
+ \qmlproperty bool NetworkSettingsWireless::hidden
+ \readonly
+ \brief Holds whether the wireless SSID is hidden.
+*/
+
+/*!
+ \qmlproperty bool NetworkSettingsWireless::isOutOfRange
+ \brief Holds whether the Wifi access point is out of range.
+*/
+
+/*!
+ \qmlmethod bool NetworkSettingsWireless::supportsSecurity(int flags)
+ \brief Returns whether the Wifi supports the wireless security
+ protocol(s) specified in \a flags.
+
+ Possible values:
+
+ \value 2 Wired Equivalent Privacy (WEP)
+ \value 4 Wi-Fi Protected Access (WPA)
+ \value 8 Wi-Fi Protected Access, version 2 (WPA2)
+*/
diff --git a/src/networksettings/qnetworksettingsinterface.cpp b/src/networksettings/qnetworksettingsinterface.cpp
index 91a8fa5..fcde01a 100644
--- a/src/networksettings/qnetworksettingsinterface.cpp
+++ b/src/networksettings/qnetworksettingsinterface.cpp
@@ -30,6 +30,20 @@
#include "qnetworksettingsinterface_p.h"
#include "qnetworksettings.h"
+/*!
+ \qmltype NetworkInterface
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Represents a network interface.
+
+ The NetworkInterface QML type represents a network interface attached
+ to the host.
+
+ Instances of NetworkInterface cannot be created directly; instead, they can
+ be retrieved via NetworkSettingsManager.
+
+ \sa {NetworkSettingsManager::interfaces}{NetworkSettingsManager.interfaces}
+*/
+
QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) :
QObject(parent)
,d_ptr(new QNetworkSettingsInterfacePrivate(this))
@@ -37,24 +51,76 @@ QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) :
}
+/*!
+ \qmlproperty string NetworkInterface::name
+ \readonly
+ \brief Holds the name of the network interface.
+*/
QString QNetworkSettingsInterface::name() const
{
Q_D(const QNetworkSettingsInterface);
return d->m_name;
}
+/*!
+ \qmlproperty enumeration NetworkInterface::state
+ \readonly
+ \brief Holds the state of the network interface.
+
+ Possible values:
+
+ \value NetworkSettingsState.Idle
+ Idle
+
+ \value NetworkSettingsState.Failure
+ Failed to connect
+
+ \value NetworkSettingsState.Association
+ Authentication in progress
+
+ \value NetworkSettingsState.Configuration
+ Configuration in progress
+
+ \value NetworkSettingsState.Ready
+ Connected to a network
+
+ \value NetworkSettingsState.Disconnect
+ Disconnected from a network
+
+ \value NetworkSettingsState.Online
+ Online (acquired an IP address)
+
+ \value NetworkSettingsState.Undefined
+ Undefined state.
+*/
QNetworkSettingsState::States QNetworkSettingsInterface::state()
{
Q_D(QNetworkSettingsInterface);
return d->m_state.state();
}
+/*!
+ \qmlproperty enumeration NetworkInterface::type
+ \readonly
+ \brief Holds the type of the network interface.
+
+ Possible values:
+
+ \value NetworkSettingsType.Wired Wired network
+ \value NetworkSettingsType.Wifi Wifi network
+ \value NetworkSettingsType.Bluetooth Bluetooth network
+ \value NetworkSettingsType.Unknown Unknown network type
+*/
QNetworkSettingsType::Types QNetworkSettingsInterface::type()
{
Q_D(QNetworkSettingsInterface);
return d->m_type.type();
}
+/*!
+ \qmlproperty bool NetworkInterface::powered
+ \brief Holds whether the network interface is powered on of off.
+*/
bool QNetworkSettingsInterface::powered() const
{
Q_D(const QNetworkSettingsInterface);
@@ -67,6 +133,10 @@ void QNetworkSettingsInterface::setPowered(const bool powered)
d->setPowered(powered);
}
+/*!
+ \qmlmethod void NetworkInterface::scanServices()
+ \brief Initiates a scan for network interface services.
+*/
void QNetworkSettingsInterface::scanServices()
{
Q_D(QNetworkSettingsInterface);
diff --git a/src/networksettings/qnetworksettingsservice.cpp b/src/networksettings/qnetworksettingsservice.cpp
index 4634496..cbbfd10 100644
--- a/src/networksettings/qnetworksettingsservice.cpp
+++ b/src/networksettings/qnetworksettingsservice.cpp
@@ -29,6 +29,19 @@
#include "qnetworksettingsservice.h"
#include "qnetworksettingsservice_p.h"
+/*!
+ \qmltype NetworkService
+ \inqmlmodule QtDeviceUtilities.NetworkSettings
+ \brief Represents a network service.
+
+ The NetworkService QML type represents a network service.
+
+ Instances of NetworkService cannot be created directly; instead, they can
+ be retrieved via NetworkSettingsManager.
+
+ \sa {NetworkSettingsManager::services}{NetworkSettingsManager.services}
+*/
+
QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObject* parent) :
QObject(parent)
,d_ptr(new QNetworkSettingsServicePrivate(aServiceId, this))
@@ -36,107 +49,275 @@ QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObj
}
+/*!
+ \qmlproperty string NetworkService::id
+ \readonly
+ \brief Holds a unique ID of this service.
+*/
QString QNetworkSettingsService::id() const
{
Q_D(const QNetworkSettingsService);
return d->m_id;
}
+/*!
+ \qmlproperty string NetworkService::name
+ \readonly
+ \brief Holds the name of this service.
+*/
QString QNetworkSettingsService::name() const
{
Q_D(const QNetworkSettingsService);
return d->m_name;
}
+/*!
+ \qmlmethod void NetworkService::setAutoConnect(bool auto)
+*/
void QNetworkSettingsService::setAutoConnect(const bool autoconnect)
{
Q_UNUSED(autoconnect);
}
+/*!
+ \qmlproperty enumeration NetworkService::state
+ \readonly
+ \brief Holds the state of this service.
+
+ See \l [QML] {NetworkInterface::state}{NetworkInterface.state}
+ for possible states.
+*/
QNetworkSettingsState::States QNetworkSettingsService::state()
{
Q_D(QNetworkSettingsService);
return d->m_state.state();
}
+/*!
+ \qmlproperty enumeration NetworkService::type
+ \readonly
+ \brief Holds the type of this service.
+
+ See \l [QML] {NetworkInterface::type}{NetworkInterface.type}
+ for possible types.
+*/
QNetworkSettingsType::Types QNetworkSettingsService::type()
{
Q_D(QNetworkSettingsService);
return d->m_type.type();
}
+/*!
+ \qmlproperty NetworkSettingsIPv4 NetworkService::ipv4
+ \readonly
+ \brief Holds the IPv4 address for this service.
+*/
QNetworkSettingsIPv4* QNetworkSettingsService::ipv4()
{
Q_D(QNetworkSettingsService);
return &d->m_ipv4config;
}
+/*!
+ \qmlproperty NetworkSettingsIPv6 NetworkService::ipv6
+ \readonly
+ \brief Holds the IPv6 address for this service.
+*/
QNetworkSettingsIPv6* QNetworkSettingsService::ipv6()
{
Q_D(QNetworkSettingsService);
return &d->m_ipv6config;
}
+/*!
+ \qmlproperty NetworkSettingsProxy NetworkService::proxy
+ \readonly
+ \brief Holds the proxy settings for this service.
+*/
QNetworkSettingsProxy* QNetworkSettingsService::proxy()
{
Q_D(QNetworkSettingsService);
return &d->m_proxyConfig;
}
+/*!
+ \qmlproperty NetworkSettingsWireless NetworkService::wirelessConfig
+ \readonly
+ \brief Holds the wireless configuration for this service.
+*/
QNetworkSettingsWireless* QNetworkSettingsService::wirelessConfig()
{
Q_D(QNetworkSettingsService);
return &d->m_wifiConfig;
}
+/*!
+ \qmlproperty object NetworkService::domains
+ \readonly
+ \brief The model containing the domains associated with this service.
+
+ The \e domains property can be used as a model for a view
+ that lists the domain addresses associated with this service.
+
+ \sa domains.count, domains.append(), domains.remove(), domains.resetChanges()
+*/
+
+/*!
+ \qmlproperty int NetworkService::domains.count
+ \readonly
+ \brief Holds the number of domain addresses in the \l domains model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::domains.append(string address)
+ \brief Adds \a address into the \l domains model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::domains.remove(int index)
+ \brief Removes the entry at index \a index from the \l domains model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::domains.resetChanges()
+ \brief Clears unsaved changes from the \l domains model.
+*/
+
QAbstractItemModel* QNetworkSettingsService::domains()
{
Q_D(QNetworkSettingsService);
return &d->m_domainsConfig;
}
+/*!
+ \qmlproperty object NetworkService::nameservers
+ \readonly
+ \brief The model containing the domain name servers associated with this
+ service.
+
+ The \e nameservers property can be used as a model for a view
+ that lists the domain name server (DNS) addresses associated with this
+ service.
+
+ \sa nameservers.count, nameservers.append(), nameservers.remove(), nameservers.resetChanges()
+*/
+
+/*!
+ \qmlproperty int NetworkService::nameservers.count
+ \readonly
+ \brief Holds the number of domain name server addresses in the
+ \l nameservers model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::nameservers.append(string address)
+ \brief Adds \a address into the \l nameservers model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::nameservers.remove(int index)
+ \brief Removes the entry at index \a index from the \l nameservers model.
+*/
+
+/*!
+ \qmlmethod void NetworkService::nameservers.resetChanges()
+ \brief Clears unsaved changes from the \l nameservers model.
+*/
+
QAbstractItemModel* QNetworkSettingsService::nameservers()
{
Q_D(QNetworkSettingsService);
return &d->m_nameserverConfig;
}
+/*!
+ \qmlmethod void NetworkService::setupIpv4Config()
+ \brief Sets up the IPv4 configuration.
+
+ Call this method after changing the IPv4 settings.
+
+ \sa ipv4
+*/
void QNetworkSettingsService::setupIpv4Config()
{
Q_D(QNetworkSettingsService);
d->setupIpv4Config();
}
+/*!
+ \qmlmethod void NetworkService::setupIpv6Config()
+ \brief Sets up the IPv6 configuration.
+
+ Call this method after changing the IPv6 settings.
+
+ \sa ipv6
+*/
void QNetworkSettingsService::setupIpv6Config()
{
Q_D(QNetworkSettingsService);
d->setupIpv6Config();
}
+/*!
+ \qmlmethod void NetworkService::setupNameserversConfig()
+ \brief Sets up the domain name server configuration.
+
+ Call this method after modifying the list of domain name servers.
+
+ \sa nameservers
+*/
void QNetworkSettingsService::setupNameserversConfig()
{
Q_D(QNetworkSettingsService);
d->setupNameserversConfig();
}
+/*!
+ \qmlmethod void NetworkService::setupDomainsConfig()
+ \brief Sets up the domains configuration.
+
+ Call this method after modifying the list of domain addresses.
+
+ \sa domains
+*/
void QNetworkSettingsService::setupDomainsConfig()
{
Q_D(QNetworkSettingsService);
d->setupDomainsConfig();
}
+/*!
+ \qmlmethod void NetworkService::setupNetworkSettingsProxy()
+ \brief Sets up the network proxy configuration.
+
+ Call this method after modifying the network proxy settings.
+
+ \sa proxy
+*/
void QNetworkSettingsService::setupNetworkSettingsProxy()
{
Q_D(QNetworkSettingsService);
d->setupQNetworkSettingsProxy();
}
+/*!
+ \qmlmethod void NetworkService::connectService()
+ \brief Initiates the process of connecting to this network service.
+
+ \sa disconnectService()
+*/
void QNetworkSettingsService::connectService()
{
Q_D(QNetworkSettingsService);
d->connectService();
}
+/*!
+ \qmlmethod void NetworkService::disconnectService()
+ \brief Disconnects this service.
+
+ \sa connectService()
+*/
void QNetworkSettingsService::disconnectService()
{
Q_D(QNetworkSettingsService);
diff --git a/src/networksettings/qnetworksettingsservicemodel.cpp b/src/networksettings/qnetworksettingsservicemodel.cpp
index 4b8d87c..2755eda 100644
--- a/src/networksettings/qnetworksettingsservicemodel.cpp
+++ b/src/networksettings/qnetworksettingsservicemodel.cpp
@@ -79,9 +79,9 @@ void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item)
{
item->setParent(this);
- beginInsertRows(QModelIndex(), rowCount(), rowCount());
+ beginResetModel();
m_items.append(item);
- endInsertRows();
+ endResetModel();
}
void QNetworkSettingsServiceModel::insert(int row, QNetworkSettingsService* item)
@@ -100,6 +100,19 @@ void QNetworkSettingsServiceModel::remove(int row)
endRemoveRows();
}
+bool QNetworkSettingsServiceModel::removeService(const QString &id)
+{
+ bool ret = false;
+ for (int i=0; i < m_items.count(); i++) {
+ if (m_items.at(i)->id() == id) {
+ remove(i);
+ ret = true;
+ break;
+ }
+ }
+ return ret;
+}
+
void QNetworkSettingsServiceModel::updated(int row)
{
dataChanged(createIndex(row, 0), createIndex(row, 0));
@@ -112,6 +125,12 @@ QList<QNetworkSettingsService*> QNetworkSettingsServiceModel::getModel()
//Filter model
+/*!
+ \qmltype NetworkSettingsServiceFilter
+ \inqmlmodule QtDeviceutilities.NetworkSettings
+ \abstract
+*/
+
QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent)
:QSortFilterProxyModel(parent)
{
@@ -123,6 +142,14 @@ QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter()
}
+/*!
+ \qmlproperty enumeration NetworkSettingsServiceFilter::type
+
+ \value NetworkSettingsType.Wired Wired network
+ \value NetworkSettingsType.Wifi Wifi network
+ \value NetworkSettingsType.Bluetooth Bluetooth network
+ \value NetworkSettingsType.Unknown Unknown network type
+*/
QNetworkSettingsType::Types QNetworkSettingsServiceFilter::type() const
{
return m_type;
@@ -153,6 +180,11 @@ bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QMod
return false;
}
+/*!
+ \qmlmethod NetworkService NetworkSettingsServiceFilter::itemFromRow(int index)
+
+ Returns the service at \a index in the model.
+*/
QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const
{
QModelIndex idx = index(row, 0);
diff --git a/src/networksettings/qnetworksettingsservicemodel.h b/src/networksettings/qnetworksettingsservicemodel.h
index 811c127..0cf1601 100644
--- a/src/networksettings/qnetworksettingsservicemodel.h
+++ b/src/networksettings/qnetworksettingsservicemodel.h
@@ -47,6 +47,7 @@ public:
void append(QNetworkSettingsService* networkService);
void insert(int row, QNetworkSettingsService* networkInterface);
void remove(int row);
+ bool removeService(const QString &id);
void updated(int row);
QList<QNetworkSettingsService*> getModel();
diff --git a/src/networksettings/wpasupplicant/qwifidevice.cpp b/src/networksettings/wpasupplicant/qwifidevice.cpp
index 3b6fdd1..8441700 100644
--- a/src/networksettings/wpasupplicant/qwifidevice.cpp
+++ b/src/networksettings/wpasupplicant/qwifidevice.cpp
@@ -38,6 +38,7 @@ QT_BEGIN_NAMESPACE
\inmodule B2Qt.Wifi.Cpp
\ingroup wifi-cppclasses
\brief Represents a physical device.
+ \internal
Use this class to query if a device is Wifi capable, before attempting
to use the functionality of QWifiManager.