summaryrefslogtreecommitdiffstats
path: root/src/networksettings
diff options
context:
space:
mode:
Diffstat (limited to 'src/networksettings')
-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.cpp19
-rw-r--r--src/networksettings/wpasupplicant/qwifidevice.cpp1
5 files changed, 542 insertions, 0 deletions
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 868cfa3..2755eda 100644
--- a/src/networksettings/qnetworksettingsservicemodel.cpp
+++ b/src/networksettings/qnetworksettingsservicemodel.cpp
@@ -125,6 +125,12 @@ QList<QNetworkSettingsService*> QNetworkSettingsServiceModel::getModel()
//Filter model
+/*!
+ \qmltype NetworkSettingsServiceFilter
+ \inqmlmodule QtDeviceutilities.NetworkSettings
+ \abstract
+*/
+
QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent)
:QSortFilterProxyModel(parent)
{
@@ -136,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;
@@ -166,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/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.