summaryrefslogtreecommitdiffstats
path: root/src/networksettings
diff options
context:
space:
mode:
authorMikko Gronoff <mikko.gronoff@qt.io>2018-10-15 15:07:42 +0300
committerMikko Gronoff <mikko.gronoff@qt.io>2018-10-15 15:08:26 +0300
commit9ad08f17c3cd96bb6b9d5d501870cb3987ed9097 (patch)
treee84ab2f923e202f3021e8a9f4d227fef195dfaf9 /src/networksettings
parent59405866644db41b866bdb561fe8ad2a1892f73b (diff)
parent261e4c619214af5e5cf95ec08a7d46d702ae0a93 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
* origin/5.11: 261e4c6 Doc: Add documentation for C++ classes 0ecd391 Fix ip address tracking and display Commit 0ecd391 originally cherry-picked from 5.12 branch, hence few bogus conflicts in qnetworksettingsmanager.cpp. Conflicts: src/networksettings/qnetworksettingsinterfacemodel.cpp src/networksettings/qnetworksettingsmanager.cpp Change-Id: Ib8007ffc55ba935da42209303f637b51bad3ab1d
Diffstat (limited to 'src/networksettings')
-rw-r--r--src/networksettings/qnetworksettings.cpp330
-rw-r--r--src/networksettings/qnetworksettingsaddressmodel.cpp45
-rw-r--r--src/networksettings/qnetworksettingsinterface.cpp68
-rw-r--r--src/networksettings/qnetworksettingsinterfacemodel.cpp50
-rw-r--r--src/networksettings/qnetworksettingsmanager.cpp124
-rw-r--r--src/networksettings/qnetworksettingsservice.cpp223
-rw-r--r--src/networksettings/qnetworksettingsservicemodel.cpp142
-rw-r--r--src/networksettings/qnetworksettingsuseragent.cpp74
8 files changed, 1052 insertions, 4 deletions
diff --git a/src/networksettings/qnetworksettings.cpp b/src/networksettings/qnetworksettings.cpp
index 66a9ba2..324959e 100644
--- a/src/networksettings/qnetworksettings.cpp
+++ b/src/networksettings/qnetworksettings.cpp
@@ -30,27 +30,129 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsState
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsState class represents the network interface
+ state.
+
+ \sa QNetworkSettingsManager
+*/
+
+/*!
+ \enum QNetworkSettingsState::States
+
+ This enum type holds the state of the network interface.
+
+ \value Idle
+ \value Failure
+ Failed to connect.
+ \value Association
+ Authentication in progress.
+ \value Configuration
+ Configuration in progress.
+ \value Ready
+ Connected to a network.
+ \value Disconnect
+ Disconnected from a network.
+ \value Online
+ Acquired an IP address.
+ \value Undefined
+ Undefined state.
+*/
+
+/*!
+ \property QNetworkSettingsState::state
+ \brief The state of the network interface.
+
+ \sa QNetworkSettingsState::States
+*/
+
+/*!
+ \fn QNetworkSettingsState::stateChanged()
+ This signal is emitted when the state of the network interface changes.
+
+ \sa QNetworkSettingsState::States
+*/
+
+/*!
+ Creates a new network interface state object with the state \a state and the
+ parent \a parent.
+*/
QNetworkSettingsState::QNetworkSettingsState(States state, QObject *parent)
: QObject(parent)
, m_state(state)
{
}
+/*!
+ Creates a new network interface state object with the parent \a parent.
+*/
QNetworkSettingsState::QNetworkSettingsState(QObject *parent)
: QObject(parent)
, m_state(Undefined)
{
}
+/*!
+ Returns the network interface state.
+*/
QNetworkSettingsState::States QNetworkSettingsState::state() const {
return m_state;
}
+/*!
+ Sets the network interface state to \a state.
+*/
void QNetworkSettingsState::setState(const States state) {
m_state = state;
emit stateChanged();
}
+/*!
+ \class QNetworkSettingsType
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsType class represents the network interface
+ type.
+
+ \sa QNetworkSettingsManager
+*/
+
+/*!
+ \enum QNetworkSettingsType::Types
+
+ This enum type holds the type of the network interface.
+
+ \value Wired
+ Wired network
+ \value Wifi
+ Wifi network
+ \value Bluetooth
+ Bluetooth network
+ \value Unknown
+ Unknown network type
+*/
+
+/*!
+ \property QNetworkSettingsType::type
+ \brief The type of the network interface.
+
+ \sa QNetworkSettingsType::Types
+*/
+
+/*!
+ \fn QNetworkSettingsType::typeChanged()
+ This signal is emitted when the type of the network interface changes.
+
+ \sa QNetworkSettingsType::Types
+*/
+
+/*!
+ Creates a new network interface type object with the type \a type and
+ parent \a parent.
+*/
QNetworkSettingsType::QNetworkSettingsType(Types type, QObject *parent)
: QObject(parent)
, m_type(type)
@@ -58,21 +160,76 @@ QNetworkSettingsType::QNetworkSettingsType(Types type, QObject *parent)
m_type = type;
}
+/*!
+ Creates a new network interface type object with the parent \a parent.
+*/
QNetworkSettingsType::QNetworkSettingsType(QObject *parent)
: QObject(parent)
{
m_type = Unknown;
}
+/*!
+ Returns the network interface type.
+*/
QNetworkSettingsType::Types QNetworkSettingsType::type() const {
return m_type;
}
+/*!
+ Sets the network interface type to \a type.
+*/
void QNetworkSettingsType::setType(const Types type) {
m_type = type;
emit typeChanged();
}
+/*!
+ \class QNetworkSettingsIPv4
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsIPv4 class encapsulates IPv4 network
+ configuration.
+*/
+
+/*!
+ \enum QNetworkSettingsIPv4::MethodType
+
+ This enum type holds the method used for IPv4 configuration.
+
+ \value Dhcp
+ The DHCP protocol is used for the network configuration.
+ \value Manual
+ The network is configured manually.
+ \value Off
+ The network is not configured.
+*/
+
+/*!
+ \property QNetworkSettingsIPv4::address
+ \brief Holds the IPv4 address.
+*/
+
+/*!
+ \property QNetworkSettingsIPv4::gateway
+ \brief Holds the IPv4 gateway address.
+*/
+
+/*!
+ \property QNetworkSettingsIPv4::method
+ \brief Holds the method of IPv4 configuration.
+
+ \sa QNetworkSettingsIPv4::MethodType
+*/
+
+/*!
+ \property QNetworkSettingsIPv4::mask
+ \brief Holds the IPv4 network mask.
+*/
+
+/*!
+ Creates a new IPv4 network configuration with the parent \a parent.
+*/
QNetworkSettingsIPv4::QNetworkSettingsIPv4(QObject *parent)
: QObject(parent)
{
@@ -81,6 +238,7 @@ QNetworkSettingsIPv4::QNetworkSettingsIPv4(QObject *parent)
QString QNetworkSettingsIPv4::address() const {
return m_address;
}
+
void QNetworkSettingsIPv4::setAddress(const QString& address) {
m_address = address;
emit addressChanged();
@@ -113,6 +271,74 @@ void QNetworkSettingsIPv4::setMask(const QString& mask) {
emit maskChanged();
}
+/*!
+ \class QNetworkSettingsIPv6
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsIPv6 class encapsulates IPv6 network
+ configuration.
+*/
+
+/*!
+ \enum QNetworkSettingsIPv6::MethodType
+
+ This enum type holds the method used for IPv6 configuration.
+
+ \value Auto
+ The network is configured automatically.
+ \value Manual
+ The network is configured manually.
+ \value Off
+ The network is not configured.
+*/
+
+/*!
+ \enum QNetworkSettingsIPv6::PrivacyType
+ \brief Holds the method of applying the privacy extensions in IPv6.
+
+ \value Disabled
+ Disables privacy extensions in IPv6
+ \value Enabled
+ Enables \l {https://tools.ietf.org/html/rfc4941}
+ {Privacy Extensions for Stateless Address Autoconfiguration in IPv6}.
+ \value Preferred
+ Enables privacy extensions and gives preference to the use of
+ temporary addresses, even when a public address is available
+*/
+
+/*!
+ \property QNetworkSettingsIPv6::address
+ \brief Holds the IPv6 address.
+*/
+
+/*!
+ \property QNetworkSettingsIPv6::gateway
+ \brief Holds the IPv6 gateway address.
+*/
+
+/*!
+ \property QNetworkSettingsIPv6::method
+ \brief Holds the method of IPv6 configuration.
+
+ \sa QNetworkSettingsIPv6::MethodType
+*/
+
+/*!
+ \property QNetworkSettingsIPv6::privacy
+ \brief Holds the method of applying privacy extensions for IPv6.
+
+ \sa QNetworkSettingsIPv6::PrivacyType
+*/
+
+/*!
+ \property QNetworkSettingsIPv6::prefixLength
+ \brief Holds the IPv6 network prefix length in bits.
+*/
+
+
+/*!
+ Creates a new IPv6 network configuration with the parent \a parent.
+*/
QNetworkSettingsIPv6::QNetworkSettingsIPv6(QObject *parent)
: QObject(parent)
{
@@ -163,6 +389,62 @@ void QNetworkSettingsIPv6::setPrefixLength(const int& prefixLength) {
emit prefixLengthChanged();
}
+
+/*!
+ \class QNetworkSettingsProxy
+ \inmodule QtDeviceUtilities
+ \brief The QNetworkSettingsProxy class encapsulates network proxy
+ configuration.
+*/
+
+/*!
+ \enum QNetworkSettingsProxy::MethodType
+ \brief Holds the network proxy configuration method.
+
+ \value Direct
+ Direct network connection, no proxy in use
+ \value Auto
+ Automatic proxy configuration
+ \value Manual
+ Manual proxy configuration
+
+ \sa url
+*/
+
+/*!
+ \property QNetworkSettingsProxy::method
+ \brief Holds the network proxy configuration method.
+
+ \sa MethodType
+*/
+
+/*!
+ \property QNetworkSettingsProxy::url
+ \brief Holds the proxy URL.
+
+ For manual proxy configuration, this property holds the proxy server
+ address. For automatic configuration, it holds the proxy auto-config URL.
+
+ \sa MethodType
+*/
+
+/*!
+ \property QNetworkSettingsProxy::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.
+
+ This property can be used as a model for a view
+ that lists the proxy exclusion addresses.
+
+ \sa QNetworkSettingsAddressModel
+*/
+
+/*!
+ Creates a new proxy configuration with the parent \a parent.
+*/
QNetworkSettingsProxy::QNetworkSettingsProxy(QObject *parent)
: QObject(parent)
{
@@ -213,10 +495,58 @@ void QNetworkSettingsProxy::setMethod(const MethodType& method) {
emit methodChanged();
}
+/*!
+ \class QNetworkSettingsWireless
+ \inmodule QtDeviceUtilities
+ \brief The QNetworkSettingsWireless class encapsulates the configuration
+ for a Wifi network service.
+*/
+
+/*!
+ \enum QNetworkSettingsWireless::SecurityFlags
+ \brief This enum type holds the wireless security protocol used to
+ protect the connection.
+
+ \value None
+ Not protected
+ \value WEP
+ Wired Equivalent Privacy (WEP)
+ \value WPA
+ Wi-Fi Protected Access (WPA)
+ \value WPA2
+ Wi-Fi Protected Access, version 2 (WPA2)
+*/
+
+/*!
+ \property QNetworkSettingsWireless::signalStrength
+ \brief Holds the Wifi signal strength, in the range from 0 to 100.
+*/
+
+/*!
+ \property QNetworkSettingsWireless::hidden
+ \readonly
+ \brief Holds whether the wireless SSID is hidden.
+*/
+
+/*!
+ \property QNetworkSettingsWireless::isOutOfRange
+ \brief Holds whether the Wifi access point is out of range.
+*/
+
+
+/*!
+ Creates a new Wifi network configuration with the parent \a parent.
+*/
QNetworkSettingsWireless::QNetworkSettingsWireless(QObject* parent)
: QObject(parent) {
}
+/*!
+ Returns whether the Wifi network supports the wireless security
+ protocols specified in \a security.
+
+ \sa QNetworkSettingsWireless::SecurityFlags
+*/
bool QNetworkSettingsWireless::supportsSecurity(SecurityFlags security) {
if (m_securityFlags & security) {
return true;
diff --git a/src/networksettings/qnetworksettingsaddressmodel.cpp b/src/networksettings/qnetworksettingsaddressmodel.cpp
index d86318b..7872018 100644
--- a/src/networksettings/qnetworksettingsaddressmodel.cpp
+++ b/src/networksettings/qnetworksettingsaddressmodel.cpp
@@ -30,17 +30,49 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsAddressModel
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsAddressModel class represents a network
+ interface address.
+
+ An address model contains a lists of available network interface addresses.
+
+ \sa QNetworkSettingsManager
+*/
+
+/*!
+ \property QNetworkSettingsAddressModel::count
+ \brief Holds the number of rows in the model.
+*/
+
+/*!
+ \fn QNetworkSettingsAddressModel::countChanged()
+ This signal is emitted when the number of rows in the model changes.
+*/
+
+/*!
+ Creates an address model with the parent \a parent.
+*/
QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(QObject *parent)
:QStringListModel(parent)
{
}
+/*!
+ Creates an address model with the addresses specified by
+ \a strings and parent \a parent.
+*/
QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent)
:QStringListModel(parent)
{
setStringList(strings);
}
+/*!
+ Adds the addresses specified by \a addresses to the address model.
+*/
void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses)
{
m_addresses = addresses;
@@ -48,6 +80,9 @@ void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses)
emit countChanged();
}
+/*!
+ Adds the address specified by \a address to the address model.
+*/
void QNetworkSettingsAddressModel::append(const QString& address)
{
int row = rowCount();
@@ -61,17 +96,27 @@ void QNetworkSettingsAddressModel::append(const QString& address)
emit countChanged();
}
+/*!
+ Removes the address at the position specified by \a index from the address
+ model.
+*/
void QNetworkSettingsAddressModel::remove(int index)
{
removeRows(index, 1);
emit countChanged();
}
+/*!
+ Returns the number of rows in the address model.
+*/
int QNetworkSettingsAddressModel::count() const
{
return rowCount();
}
+/*!
+ Resets the changes made to the addresses in the address model.
+*/
void QNetworkSettingsAddressModel::resetChanges()
{
QStringListModel::setStringList(m_addresses);
diff --git a/src/networksettings/qnetworksettingsinterface.cpp b/src/networksettings/qnetworksettingsinterface.cpp
index 9fb0147..7bf6ae0 100644
--- a/src/networksettings/qnetworksettingsinterface.cpp
+++ b/src/networksettings/qnetworksettingsinterface.cpp
@@ -33,6 +33,45 @@
QT_BEGIN_NAMESPACE
/*!
+ \class QNetworkSettingsInterface
+ \inmodule QtDeviceUtilities
+ \brief Represents a network interface.
+
+ The QNetworkSettingsInterface class represents a network interface attached
+ to the host.
+
+ Instances of this class cannot be created directly. Instead, they can be
+ retrieved via QNetworkSettingsManager::interfaces().
+*/
+
+/*!
+ \property QNetworkSettingsInterface::state
+ \readonly
+ \brief Holds the state of the network interface.
+
+ \sa QNetworkSettingsState::States
+*/
+
+/*!
+ \property QNetworkSettingsInterface::name
+ \readonly
+ \brief Holds the name of the network interface.
+*/
+
+/*!
+ \property QNetworkSettingsInterface::powered
+ \brief Holds whether the network interface is powered on of off.
+*/
+
+/*!
+ \property QNetworkSettingsInterface::type
+ \readonly
+ \brief Holds the type of the network interface.
+
+ \sa QNetworkSettingsType::Types
+*/
+
+/*!
\qmltype NetworkInterface
\inqmlmodule QtDeviceUtilities.NetworkSettings
\brief Represents a network interface.
@@ -46,6 +85,10 @@ QT_BEGIN_NAMESPACE
\sa {NetworkSettingsManager::interfaces}{NetworkSettingsManager.interfaces}
*/
+
+/*!
+ Creates a new network interface with the parent \a parent.
+*/
QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) :
QObject(parent)
,d_ptr(new QNetworkSettingsInterfacePrivate(this))
@@ -58,6 +101,10 @@ QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) :
\readonly
\brief Holds the name of the network interface.
*/
+
+/*!
+ Returns the name of the network interface.
+*/
QString QNetworkSettingsInterface::name() const
{
Q_D(const QNetworkSettingsInterface);
@@ -95,6 +142,10 @@ QString QNetworkSettingsInterface::name() const
\value NetworkSettingsState.Undefined
Undefined state.
*/
+
+/*!
+ Returns the state of the network interface.
+*/
QNetworkSettingsState::States QNetworkSettingsInterface::state()
{
Q_D(QNetworkSettingsInterface);
@@ -113,6 +164,10 @@ QNetworkSettingsState::States QNetworkSettingsInterface::state()
\value NetworkSettingsType.Bluetooth Bluetooth network
\value NetworkSettingsType.Unknown Unknown network type
*/
+
+/*!
+ Returns the type of the network interface.
+*/
QNetworkSettingsType::Types QNetworkSettingsInterface::type()
{
Q_D(QNetworkSettingsInterface);
@@ -121,7 +176,11 @@ QNetworkSettingsType::Types QNetworkSettingsInterface::type()
/*!
\qmlproperty bool NetworkInterface::powered
- \brief Holds whether the network interface is powered on of off.
+ \brief Holds whether the network interface is powered on or off.
+*/
+
+/*!
+ Returns whether the network interface is powered on or off.
*/
bool QNetworkSettingsInterface::powered() const
{
@@ -129,6 +188,9 @@ bool QNetworkSettingsInterface::powered() const
return d->powered();
}
+/*!
+ Sets the powered state in the network interface to \a powered.
+*/
void QNetworkSettingsInterface::setPowered(const bool powered)
{
Q_D(QNetworkSettingsInterface);
@@ -139,6 +201,10 @@ void QNetworkSettingsInterface::setPowered(const bool powered)
\qmlmethod void NetworkInterface::scanServices()
\brief Initiates a scan for network interface services.
*/
+
+/*!
+ Initiates a scan for network interface services.
+*/
void QNetworkSettingsInterface::scanServices()
{
Q_D(QNetworkSettingsInterface);
diff --git a/src/networksettings/qnetworksettingsinterfacemodel.cpp b/src/networksettings/qnetworksettingsinterfacemodel.cpp
index baff929..b099c6d 100644
--- a/src/networksettings/qnetworksettingsinterfacemodel.cpp
+++ b/src/networksettings/qnetworksettingsinterfacemodel.cpp
@@ -31,6 +31,33 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsInterfaceModel
+ \inmodule QtDeviceUtilities
+ \brief The QNetworkSettingsInterfaceModel class represents a network
+ interface model.
+
+ The network interface model contains a list of network interfaces
+ attached to the host.
+*/
+
+/*!
+ \enum QNetworkSettingsInterfaceModel::Roles
+ \brief This enum type holds information about a network interface.
+
+ \value Type
+ Network interface \l{QNetworkSettingsType::Types}{type}.
+ \value Status
+ Network interface \l{QNetworkSettingsState::States}{state}.
+ \value Name
+ Network interface name.
+ \value Powered
+ Whether the network interface is powered on or off.
+*/
+
+/*!
+ Creates a new network interface model with the parent \a parent.
+*/
QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent)
: QAbstractListModel(parent)
{
@@ -41,18 +68,27 @@ QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent)
m_roleNames.insert(Powered, "powered");
}
+/*!
+ Returns an array of the names of the roles in the model.
+*/
QHash<int, QByteArray> QNetworkSettingsInterfaceModel::roleNames() const
{
return m_roleNames;
}
-
+/*!
+ Returns the number of rows in the model with the parent \a parent.
+*/
int QNetworkSettingsInterfaceModel::rowCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
return m_items.count();
}
+/*!
+ Returns the data at the index \a index in the model for the type of data
+ specified by \a role.
+*/
QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int role) const
{
if (!index.isValid()) return QVariant();
@@ -81,6 +117,9 @@ QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int rol
}
+/*!
+ Appends \a item to the model.
+*/
void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -91,6 +130,9 @@ void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item)
endInsertRows();
}
+/*!
+ Inserts \a item into \a row in the model.
+*/
void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface* item)
{
item->setParent(this);
@@ -107,6 +149,9 @@ void QNetworkSettingsInterfaceModel::connectStateChanges(QNetworkSettingsInterfa
connect(item, &QNetworkSettingsInterface::poweredChanged, this, &QNetworkSettingsInterfaceModel::poweredChanged);
}
+/*!
+ Removes the row \a row from the model.
+*/
void QNetworkSettingsInterfaceModel::remove(int row)
{
beginRemoveRows(QModelIndex(), row, row);
@@ -119,6 +164,9 @@ void QNetworkSettingsInterfaceModel::updated(int row)
dataChanged(createIndex(row, 0), createIndex(row, 0));
}
+/*!
+ Returns the network interface model.
+*/
QList<QNetworkSettingsInterface*> QNetworkSettingsInterfaceModel::getModel()
{
return m_items;
diff --git a/src/networksettings/qnetworksettingsmanager.cpp b/src/networksettings/qnetworksettingsmanager.cpp
index e3f8e50..b1cfbf8 100644
--- a/src/networksettings/qnetworksettingsmanager.cpp
+++ b/src/networksettings/qnetworksettingsmanager.cpp
@@ -37,24 +37,116 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsManager
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsManager class manages network settings.
+
+ The network manager is designed to be used as a model that contains lists
+ of available network interfaces and services.
+
+ A delegate in a view that uses the interface model can access the
+ network interface item with the data model role.
+
+ The services list in the model can be controlled with the
+ \l QNetworkSettingsType::type property, and network service items can be
+ retrieved with the \l QNetworkSettingsServiceFilter::itemFromRow() method.
+
+ \sa QNetworkSettingsService
+*/
+
+/*!
+ \property QNetworkSettingsManager::services
+ \brief Holds the service model.
+
+ \sa QNetworkSettingsServiceFilter
+*/
+
+/*!
+ \property QNetworkSettingsManager::interfaces
+ \brief Holds the interface model.
+
+ \sa QNetworkSettingsInterfaceModel
+*/
+
+/*!
+ \property QNetworkSettingsManager::userAgent
+ \brief Holds the user credentials for connecting to a network.
+
+ \sa QNetworkSettingsUserAgent
+*/
+
+/*!
+ \property QNetworkSettingsManager::currentWifiConnection
+ \brief Holds the current Wifi connection.
+
+ \sa QNetworkSettingsService
+*/
+
+/*!
+ \property QNetworkSettingsManager::currentWiredConnection
+ \brief Holds the current wired connection.
+
+ \sa QNetworkSettingsService
+*/
+
+/*!
+ \fn QNetworkSettingsManager::servicesChanged()
+
+ This signal is emitted when the network service changes.
+*/
+
+/*!
+ \fn QNetworkSettingsManager::interfacesChanged()
+
+ This signal is emitted when the network interface changes.
+*/
+
+/*!
+ \fn QNetworkSettingsManager::currentWifiConnectionChanged()
+
+ This signal is emitted when the current Wifi connection changes.
+*/
+
+/*!
+ \fn QNetworkSettingsManager::currentWiredConnectionChanged()
+
+ This signal is emitted when the current wired connection changes.
+*/
+
+/*!
+ Creates a network manager with the parent \a parent.
+*/
QNetworkSettingsManager::QNetworkSettingsManager(QObject *parent) :
QObject(parent)
,d_ptr(new QNetworkSettingsManagerPrivate(this))
{
}
+/*!
+ Returns the service model.
+
+ \l QNetworkSettingsType::Types
+*/
QNetworkSettingsServiceFilter *QNetworkSettingsManager::services()
{
Q_D(QNetworkSettingsManager);
return d->serviceFilter();
}
+/*!
+ Returns the interface model.
+*/
QNetworkSettingsInterfaceModel *QNetworkSettingsManager::interfaces()
{
Q_D(QNetworkSettingsManager);
return d->interfaceModel();
}
+/*!
+ Returns the service model \a name of the type \a type.
+*/
QNetworkSettingsService* QNetworkSettingsManager::service(const QString& name, int type)
{
Q_D(QNetworkSettingsManager);
@@ -67,6 +159,10 @@ QNetworkSettingsService* QNetworkSettingsManager::service(const QString& name, i
return nullptr;
}
+/*!
+ Creates a connection to the network specified by \a name using the password
+ \a passphrase.
+*/
void QNetworkSettingsManager::connectBySsid(const QString &name, const QString &passphrase)
{
Q_D(QNetworkSettingsManager);
@@ -76,6 +172,9 @@ void QNetworkSettingsManager::connectBySsid(const QString &name, const QString &
d->connectBySsid(name);
}
+/*!
+ Clears the connection state.
+*/
void QNetworkSettingsManager::clearConnectionState()
{
Q_D(QNetworkSettingsManager);
@@ -85,12 +184,18 @@ void QNetworkSettingsManager::clearConnectionState()
agent->clearConnectionState();
}
+/*!
+ Attempts to connect using the next network interface in the model.
+*/
void QNetworkSettingsManager::tryNextConnection()
{
Q_D(QNetworkSettingsManager);
d->tryNextConnection();
}
+/*!
+ Terminates the current connection to the specified \a service.
+*/
void QNetworkSettingsManager::clearCurrentConnection(QNetworkSettingsService* service)
{
Q_D(QNetworkSettingsManager);
@@ -109,6 +214,9 @@ void QNetworkSettingsManager::clearCurrentConnection(QNetworkSettingsService* se
}
}
+/*!
+ Creates a connection to the specified \a service.
+*/
void QNetworkSettingsManager::setCurrentConnection(QNetworkSettingsService* service)
{
Q_D(QNetworkSettingsManager);
@@ -125,19 +233,27 @@ void QNetworkSettingsManager::setCurrentConnection(QNetworkSettingsService* serv
}
}
+/*!
+ Returns the current Wifi connection.
+*/
QNetworkSettingsService* QNetworkSettingsManager::currentWifiConnection()
{
Q_D(QNetworkSettingsManager);
return d->currentWifiConnection();
}
-
+/*!
+ Returns the current wired connection.
+*/
QNetworkSettingsService* QNetworkSettingsManager::currentWiredConnection()
{
Q_D(QNetworkSettingsManager);
return d->currentWiredConnection();
}
+/*!
+ Returns the network interface instance \a instance of the type \a type.
+*/
QNetworkSettingsInterface* QNetworkSettingsManager::interface(int type, int instance)
{
Q_D(QNetworkSettingsManager);
@@ -154,6 +270,9 @@ QNetworkSettingsInterface* QNetworkSettingsManager::interface(int type, int inst
return nullptr;
}
+/*!
+ Sets the user credentials for connecting to a network to \a agent.
+*/
void QNetworkSettingsManager::setUserAgent(QNetworkSettingsUserAgent *agent)
{
Q_D(QNetworkSettingsManager);
@@ -162,6 +281,9 @@ void QNetworkSettingsManager::setUserAgent(QNetworkSettingsUserAgent *agent)
this, &QNetworkSettingsManager::tryNextConnection);
}
+/*!
+ Returns the user credentials for connecting to a network.
+*/
QNetworkSettingsUserAgent* QNetworkSettingsManager::userAgent()
{
Q_D(QNetworkSettingsManager);
diff --git a/src/networksettings/qnetworksettingsservice.cpp b/src/networksettings/qnetworksettingsservice.cpp
index d3ea020..c91c4f6 100644
--- a/src/networksettings/qnetworksettingsservice.cpp
+++ b/src/networksettings/qnetworksettingsservice.cpp
@@ -32,6 +32,107 @@
QT_BEGIN_NAMESPACE
/*!
+ \class QNetworkSettingsService
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsService class represents a network service.
+
+ \sa QNetworkSettingsManager::services()
+*/
+
+/*!
+ \property QNetworkSettingsService::id
+ \readonly
+ \brief Holds a unique ID of this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::name
+ \readonly
+ \brief Holds the name of this service.
+*/
+
+
+/*!
+ \property QNetworkSettingsService::state
+ \readonly
+ \brief Holds the state of this service.
+
+ \sa QNetworkSettingsState::States
+*/
+
+/*!
+ \property QNetworkSettingsService::type
+ \readonly
+ \brief Holds the type of this service.
+
+ \sa QNetworkSettingsType::Types
+*/
+
+/*!
+ \property QNetworkSettingsService::ipv4
+ \readonly
+ \brief Holds the IPv4 address for this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::ipv6
+ \readonly
+ \brief Holds the IPv6 address for this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::proxy
+ \readonly
+ \brief Holds the proxy settings for this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::wirelessConfig
+ \readonly
+ \brief Holds the wireless configuration for this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::domains
+ \readonly
+ \brief The model containing the domains associated with this service.
+
+ This property can be used as a model for a view that lists the domain
+ addresses associated with this service.
+*/
+
+/*!
+ \property QNetworkSettingsService::nameservers
+ \readonly
+ \brief The model containing the domain name servers associated with this
+ service.
+
+ This property can be used as a model for a view that lists the domain name
+ server (DNS) addresses associated with this service.
+*/
+
+/*!
+ \fn QNetworkSettingsService::connectionStateCleared()
+
+ This signal is emitted when the connection state is cleared.
+*/
+
+/*!
+ \fn QNetworkSettingsService::serviceConnected(QNetworkSettingsService* service);
+
+ This signal is emitted when the connection to the network \a service is
+ created.
+*/
+
+/*!
+ \fn QNetworkSettingsService::serviceDisconnected(QNetworkSettingsService* service);
+
+ This signal is emitted when the connection to the network \a service is
+ cut.
+*/
+
+/*!
\qmltype NetworkService
\inqmlmodule QtDeviceUtilities.NetworkSettings
\brief Represents a network service.
@@ -44,6 +145,10 @@ QT_BEGIN_NAMESPACE
\sa {NetworkSettingsManager::services}{NetworkSettingsManager.services}
*/
+/*!
+ Creates a network service with the identifier \a aServiceId and
+ parent \a parent.
+*/
QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObject* parent) :
QObject(parent)
,d_ptr(new QNetworkSettingsServicePrivate(aServiceId, this))
@@ -56,6 +161,10 @@ QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObj
\readonly
\brief Holds a unique ID of this service.
*/
+
+/*!
+ Returns the unique identifier of the network service.
+*/
QString QNetworkSettingsService::id() const
{
Q_D(const QNetworkSettingsService);
@@ -67,6 +176,10 @@ QString QNetworkSettingsService::id() const
\readonly
\brief Holds the name of this service.
*/
+
+/*!
+ Returns the network service name.
+*/
QString QNetworkSettingsService::name() const
{
Q_D(const QNetworkSettingsService);
@@ -76,6 +189,11 @@ QString QNetworkSettingsService::name() const
/*!
\qmlmethod void NetworkService::setAutoConnect(bool auto)
*/
+
+/*!
+ Sets automatic connections to the network service to
+ \a autoconnect.
+*/
void QNetworkSettingsService::setAutoConnect(const bool autoconnect)
{
Q_UNUSED(autoconnect);
@@ -89,6 +207,12 @@ void QNetworkSettingsService::setAutoConnect(const bool autoconnect)
See \l [QML] {NetworkInterface::state}{NetworkInterface.state}
for possible states.
*/
+
+/*!
+ Returns the network service state.
+
+ \sa QNetworkSettingsState::States
+*/
QNetworkSettingsState::States QNetworkSettingsService::state()
{
Q_D(QNetworkSettingsService);
@@ -103,6 +227,12 @@ QNetworkSettingsState::States QNetworkSettingsService::state()
See \l [QML] {NetworkInterface::type}{NetworkInterface.type}
for possible types.
*/
+
+/*!
+ Returns the network service type.
+
+ \sa QNetworkSettingsType::Types
+*/
QNetworkSettingsType::Types QNetworkSettingsService::type()
{
Q_D(QNetworkSettingsService);
@@ -114,6 +244,10 @@ QNetworkSettingsType::Types QNetworkSettingsService::type()
\readonly
\brief Holds the IPv4 address for this service.
*/
+
+/*!
+ Returns the IPv4 address of the network service.
+*/
QNetworkSettingsIPv4* QNetworkSettingsService::ipv4()
{
Q_D(QNetworkSettingsService);
@@ -125,6 +259,10 @@ QNetworkSettingsIPv4* QNetworkSettingsService::ipv4()
\readonly
\brief Holds the IPv6 address for this service.
*/
+
+/*!
+ Returns the IPv6 address of the network service.
+*/
QNetworkSettingsIPv6* QNetworkSettingsService::ipv6()
{
Q_D(QNetworkSettingsService);
@@ -136,6 +274,10 @@ QNetworkSettingsIPv6* QNetworkSettingsService::ipv6()
\readonly
\brief Holds the proxy settings for this service.
*/
+
+/*!
+ Returns the address of proxy used for the network service.
+*/
QNetworkSettingsProxy* QNetworkSettingsService::proxy()
{
Q_D(QNetworkSettingsService);
@@ -147,18 +289,29 @@ QNetworkSettingsProxy* QNetworkSettingsService::proxy()
\readonly
\brief Holds the wireless configuration for this service.
*/
+
+/*!
+ Returns the wireless configuration of the network service.
+*/
QNetworkSettingsWireless* QNetworkSettingsService::wirelessConfig()
{
Q_D(QNetworkSettingsService);
return &d->m_wifiConfig;
}
+/*!
+ Sets the placeholder state of the network service to
+ \a placeholderState.
+*/
void QNetworkSettingsService::setPlaceholderState(bool placeholderState)
{
Q_D(QNetworkSettingsService);
d->setPlaceholderState(placeholderState);
}
+/*!
+ Returns the placeholder state of the network service.
+*/
bool QNetworkSettingsService::placeholderState() const
{
Q_D(const QNetworkSettingsService);
@@ -197,6 +350,10 @@ bool QNetworkSettingsService::placeholderState() const
\brief Clears unsaved changes from the \l domains model.
*/
+/*!
+ Returns the model containing the domains associated with this network
+ settings service.
+*/
QAbstractItemModel* QNetworkSettingsService::domains()
{
Q_D(QNetworkSettingsService);
@@ -238,6 +395,10 @@ QAbstractItemModel* QNetworkSettingsService::domains()
\brief Clears unsaved changes from the \l nameservers model.
*/
+/*!
+ Returns the model containing the domain name servers associated with this
+ network service.
+*/
QAbstractItemModel* QNetworkSettingsService::nameservers()
{
Q_D(QNetworkSettingsService);
@@ -252,6 +413,14 @@ QAbstractItemModel* QNetworkSettingsService::nameservers()
\sa ipv4
*/
+
+/*!
+ Sets up the IPv4 configuration.
+
+ Call this method after changing the IPv4 settings.
+
+ \sa ipv4()
+*/
void QNetworkSettingsService::setupIpv4Config()
{
Q_D(QNetworkSettingsService);
@@ -266,6 +435,14 @@ void QNetworkSettingsService::setupIpv4Config()
\sa ipv6
*/
+
+/*!
+ Sets up the IPv6 configuration.
+
+ Call this method after changing the IPv6 settings.
+
+ \sa ipv6()
+*/
void QNetworkSettingsService::setupIpv6Config()
{
Q_D(QNetworkSettingsService);
@@ -280,6 +457,14 @@ void QNetworkSettingsService::setupIpv6Config()
\sa nameservers
*/
+
+/*!
+ Sets up the domain name server configuration.
+
+ Call this method after changing the domain name server settings.
+
+ \sa nameservers
+*/
void QNetworkSettingsService::setupNameserversConfig()
{
Q_D(QNetworkSettingsService);
@@ -294,6 +479,14 @@ void QNetworkSettingsService::setupNameserversConfig()
\sa domains
*/
+
+/*!
+ Sets up the domain configuration.
+
+ Call this method after modifying the list of domain addresses.
+
+ \sa domains
+*/
void QNetworkSettingsService::setupDomainsConfig()
{
Q_D(QNetworkSettingsService);
@@ -308,6 +501,14 @@ void QNetworkSettingsService::setupDomainsConfig()
\sa proxy
*/
+
+/*!
+ Sets up the network proxy configuration.
+
+ Call this method after modifying the network proxy settings.
+
+ \sa proxy
+*/
void QNetworkSettingsService::setupNetworkSettingsProxy()
{
Q_D(QNetworkSettingsService);
@@ -320,12 +521,23 @@ void QNetworkSettingsService::setupNetworkSettingsProxy()
\sa disconnectService()
*/
+
+/*!
+ Initiates the process of connecting to this network service.
+
+ \sa disconnectService()
+*/
void QNetworkSettingsService::connectService()
{
emit connectionStateCleared();
doConnectService();
}
+/*!
+ Creates a connection to this network service.
+
+ \sa connectService(), disconnectService()
+*/
void QNetworkSettingsService::doConnectService()
{
Q_D(QNetworkSettingsService);
@@ -338,6 +550,12 @@ void QNetworkSettingsService::doConnectService()
\sa connectService()
*/
+
+/*!
+ Disconnects this service.
+
+ \sa connectService()
+*/
void QNetworkSettingsService::disconnectService()
{
Q_D(QNetworkSettingsService);
@@ -349,6 +567,11 @@ void QNetworkSettingsService::disconnectService()
\brief Removes this service from the service cache and clears
any remembered credentials.
*/
+
+/*!
+ Removes this service from the service cache and clears any remembered
+ credentials.
+*/
void QNetworkSettingsService::removeService()
{
Q_D(QNetworkSettingsService);
diff --git a/src/networksettings/qnetworksettingsservicemodel.cpp b/src/networksettings/qnetworksettingsservicemodel.cpp
index 0fe3f47..2a0a2a8 100644
--- a/src/networksettings/qnetworksettingsservicemodel.cpp
+++ b/src/networksettings/qnetworksettingsservicemodel.cpp
@@ -31,6 +31,36 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsServiceModel
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsServiceModel class represents a network service.
+
+ The network service model contains a list of network services provided by
+ the host.
+
+ \sa QNetworkSettingsService
+*/
+
+/*!
+ \enum QNetworkSettingsServiceModel::Roles
+
+ This enum type holds information about the network connection.
+
+ \value Type
+ Network \l{QNetworkSettingsType::Types}{type}.
+ \value Name
+ The service set identifier (SSID) of the network.
+ \value SignalStrength
+ The signal strength of the connection.
+ \value Connected
+ Whether the connection has been established.
+*/
+
+/*!
+ Creates a network service model with the parent \a parent.
+*/
QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent)
: QAbstractListModel(parent)
{
@@ -40,23 +70,35 @@ QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent)
m_roleNames.insert(Connected, "connected");
}
+/*!
+ Deletes the network service model.
+*/
QNetworkSettingsServiceModel::~QNetworkSettingsServiceModel()
{
}
+/*!
+ Returns an array of the names of the roles in the model.
+*/
QHash<int, QByteArray> QNetworkSettingsServiceModel::roleNames() const
{
return m_roleNames;
}
-
+/*!
+ Returns the number of rows in the model with the parent \a parent.
+*/
int QNetworkSettingsServiceModel::rowCount(const QModelIndex & parent) const
{
Q_UNUSED(parent);
return m_items.count();
}
+/*!
+ Returns the data at the index \a index in the model for the type of data
+ specified by \a role.
+*/
QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role) const
{
if (!index.isValid()) return QVariant();
@@ -77,6 +119,9 @@ QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role)
return QVariant();
}
+/*!
+ Replaces placeholder data with \a item. Returns \c true on success.
+*/
bool QNetworkSettingsServiceModel::replacePlaceholder(QNetworkSettingsService* item)
{
if (item->type() == QNetworkSettingsType::Wired) {
@@ -93,6 +138,9 @@ bool QNetworkSettingsServiceModel::replacePlaceholder(QNetworkSettingsService* i
return false;
}
+/*!
+ Appends \a item to the model.
+*/
void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item)
{
item->setParent(this);
@@ -107,6 +155,9 @@ void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item)
endResetModel();
}
+/*!
+ Inserts \a item into \a row in the model.
+*/
void QNetworkSettingsServiceModel::insert(int row, QNetworkSettingsService* item)
{
item->setParent(this);
@@ -129,6 +180,9 @@ void QNetworkSettingsServiceModel::connectStateChanges(QNetworkSettingsService*
connect(wireless, &QNetworkSettingsWireless::signalStrengthChanged, this, &QNetworkSettingsServiceModel::signalStrengthChanged);
}
+/*!
+ Removes the row \a row from the model.
+*/
void QNetworkSettingsServiceModel::remove(int row)
{
QNetworkSettingsService* item = m_items.at(row);
@@ -144,6 +198,10 @@ void QNetworkSettingsServiceModel::remove(int row)
endRemoveRows();
}
+/*!
+ Removes the service specified by \a id from the model. Returns \c true if the service
+ was successfully removed, \c false otherwise.
+*/
bool QNetworkSettingsServiceModel::removeService(const QString &id)
{
bool ret = false;
@@ -157,11 +215,17 @@ bool QNetworkSettingsServiceModel::removeService(const QString &id)
return ret;
}
+/*!
+ Marks the data on the row \a row in the model as updated.
+*/
void QNetworkSettingsServiceModel::updated(int row)
{
dataChanged(createIndex(row, 0), createIndex(row, 0));
}
+/*!
+ Returns the service with the name \a name.
+*/
QNetworkSettingsService* QNetworkSettingsServiceModel::getByName(const QString& name)
{
QNetworkSettingsService* ret = nullptr;
@@ -174,11 +238,17 @@ QNetworkSettingsService* QNetworkSettingsServiceModel::getByName(const QString&
return ret;
}
+/*!
+ Returns the network service model.
+*/
QList<QNetworkSettingsService*> QNetworkSettingsServiceModel::getModel()
{
return m_items;
}
+/*!
+ This signal is emitted when the connection status changes.
+*/
void QNetworkSettingsServiceModel::connectionStatusChanged()
{
QNetworkSettingsService *s = qobject_cast<QNetworkSettingsService*>(sender());
@@ -194,6 +264,9 @@ void QNetworkSettingsServiceModel::connectionStatusChanged()
}
+/*!
+ This signal is emitted when the signal strength changes.
+*/
void QNetworkSettingsServiceModel::signalStrengthChanged()
{
QNetworkSettingsWireless *s = qobject_cast<QNetworkSettingsWireless*>(sender());
@@ -210,17 +283,57 @@ void QNetworkSettingsServiceModel::signalStrengthChanged()
//Filter model
/*!
+ \class QNetworkSettingsServiceFilter
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsServiceFilter class represents a network service
+ filter.
+
+ \sa QNetworkSettingsService
+*/
+
+/*!
+ \property QNetworkSettingsServiceFilter::type
+ \brief The type of the network.
+
+ \l QNetworkSettingsType::Types
+*/
+
+/*!
+ \property QNetworkSettingsServiceFilter::wiredNetworksAvailable
+ \brief Whether wired networks are available.
+*/
+
+/*!
+ \fn QNetworkSettingsServiceFilter::typeChanged()
+
+ This signal is emitted when the network type changes.
+*/
+
+/*!
+ \fn QNetworkSettingsServiceFilter::wiredNetworksAvailableChanged()
+
+ This signal is emitted when the availability of wired networks changes.
+*/
+
+/*!
\qmltype NetworkSettingsServiceFilter
\inqmlmodule QtDeviceutilities.NetworkSettings
\abstract
*/
+/*!
+ Creates a network service filter with the parent \a parent.
+*/
QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent)
:QSortFilterProxyModel(parent), m_type(QNetworkSettingsType::Unknown)
{
connect(this, &QNetworkSettingsServiceFilter::typeChanged, this, &QNetworkSettingsServiceFilter::invalidate);
}
+/*!
+ Deletes the network service filter.
+*/
QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter()
{
@@ -234,17 +347,32 @@ QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter()
\value NetworkSettingsType.Bluetooth Bluetooth network
\value NetworkSettingsType.Unknown Unknown network type
*/
+
+/*!
+ Returns the service model.
+
+ \l QNetworkSettingsType::Types
+*/
QNetworkSettingsType::Types QNetworkSettingsServiceFilter::type() const
{
return m_type;
}
+/*!
+ \fn void QNetworkSettingsServiceFilter::setType(QNetworkSettingsType::Types type)
+
+ Sets the service model to \a type.
+*/
void QNetworkSettingsServiceFilter::setType(const QNetworkSettingsType::Types type)
{
m_type = type;
emit typeChanged();
}
+/*!
+ Returns whether the row \a source_row has the user role and whether it is
+ found in the model \a source_parent.
+*/
bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const
{
if (this->sourceModel())
@@ -269,6 +397,10 @@ bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QMod
Returns the service at \a index in the model.
*/
+
+/*!
+ Returns the service at \a row in the model.
+*/
QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const
{
QModelIndex idx = index(row, 0);
@@ -290,6 +422,11 @@ QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const
Returns the connected service index in the model.
Returns negative number if no active connection is available.
*/
+
+/*!
+ Returns the connected service index in the model.
+ Returns negative number if no active connection is available.
+*/
int QNetworkSettingsServiceFilter::activeRow() const
{
QNetworkSettingsServiceModel* model = qobject_cast<QNetworkSettingsServiceModel*>(sourceModel());
@@ -308,6 +445,9 @@ int QNetworkSettingsServiceFilter::activeRow() const
return -1;
}
+/*!
+ Sets the availability of wired networks to \a wiredNetworksAvailable.
+*/
void QNetworkSettingsServiceFilter::setWiredNetworksAvailable(bool wiredNetworksAvailable)
{
m_wiredNetworksAvailable = wiredNetworksAvailable;
diff --git a/src/networksettings/qnetworksettingsuseragent.cpp b/src/networksettings/qnetworksettingsuseragent.cpp
index cdf1e45..7458682 100644
--- a/src/networksettings/qnetworksettingsuseragent.cpp
+++ b/src/networksettings/qnetworksettingsuseragent.cpp
@@ -31,36 +31,110 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QNetworkSettingsUserAgent
+ \inmodule QtDeviceUtilities
+
+ \brief The QNetworkSettingsUserAgent represents the user credentials for
+ connecting to a network.
+
+ The QNetworkSettingsService::connectService() method is used to connect to
+ a Wifi network. The network name is specified by using a service set
+ identifier (SSID). If no password is needed, the connection is created
+ immediately. QNetworkSettingsService::state property can be used to
+ monitor the state of the connection.
+
+ If a password is needed, the
+ QNetworkSettingsUserAgent::showUserCredentialsInput() signal is emitted.
+ To create a connection, the password is set by using the
+ QNetworkSettingsUserAgent::setPassphrase() method.
+
+ \sa QNetworkSettingsManager
+*/
+
+/*!
+ \fn QNetworkSettingsUserAgent::showUserCredentialsInput()
+
+ This signal is emitted when user credentials are required for connecting to
+ a Wifi network.
+
+ \sa QNetworkSettingsService::connectService()
+*/
+
+/*!
+ \fn QNetworkSettingsUserAgent::error()
+
+ This signal is emitted when the connection failed due to invalid user
+ credentials.
+*/
+
+/*!
+ \fn QNetworkSettingsUserAgent::ready(bool cancel)
+
+ This signal is emitted when the user has either submitted the password
+ for the network, or if \a cancel is \c true, cancelled the password
+ query.
+*/
+
+/*!
+ \fn QNetworkSettingsUserAgent::requestNextConnection()
+
+ This signal is emitted when the network manager attempts to connect using
+ the next network interface in the model.
+*/
+
+/*!
+ Creates a user agent with the parent \a parent.
+*/
QNetworkSettingsUserAgent::QNetworkSettingsUserAgent(QObject *parent)
:QObject(parent)
,d_ptr(new QNetworkSettingsUserAgentPrivate(this))
{
}
+/*!
+ Sets the password for connecting to a Wifi network to \a passphrase.
+
+ This method needs to be called in response to receiving the
+ \l showUserCredentialsInput() signal.
+*/
void QNetworkSettingsUserAgent::setPassphrase(const QString &passphrase)
{
Q_D(QNetworkSettingsUserAgent);
d->setPassphrase(passphrase);
}
+/*!
+ Cancels the user credentials input request.
+*/
void QNetworkSettingsUserAgent::cancelInput()
{
Q_D(QNetworkSettingsUserAgent);
d->cancel();
}
+/*!
+ Returns the password of the user agent.
+*/
QString QNetworkSettingsUserAgent::passphrase() const
{
Q_D(const QNetworkSettingsUserAgent);
return d->passphrase();
}
+/*!
+ Sets the name of the network to \a ssid and the password of the user agent
+ to \a passphrase.
+*/
void QNetworkSettingsUserAgent::setSsidAndPassphrase(const QString &ssid, const QString &passphrase)
{
Q_D(QNetworkSettingsUserAgent);
d->setSsidAndPassphrase(ssid, passphrase);
}
+/*!
+ Clears the connection state.
+*/
void QNetworkSettingsUserAgent::clearConnectionState()
{
Q_D(QNetworkSettingsUserAgent);