Qt 4.8
qnetworkmanagerengine.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the plugins of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qnetworkmanagerengine.h"
43 #include "qnetworkmanagerservice.h"
44 #include "../qnetworksession_impl.h"
45 
46 #include <QtNetwork/private/qnetworkconfiguration_p.h>
47 
48 #include <QtNetwork/qnetworksession.h>
49 
50 #include <QtCore/qdebug.h>
51 
52 #include <QtDBus>
53 #include <QDBusConnection>
54 #include <QDBusError>
55 #include <QDBusInterface>
56 #include <QDBusMessage>
57 #include <QDBusReply>
58 
59 #ifndef QT_NO_BEARERMANAGEMENT
60 #ifndef QT_NO_DBUS
61 
63 
65 : QBearerEngineImpl(parent),
66  interface(new QNetworkManagerInterface(this)),
69 {
70  if (!interface->isValid())
71  return;
72 
78 #if 0
79  connect(interface, SIGNAL(stateChanged(const QString,quint32)),
80  this, SIGNAL(configurationsChanged()));
81 #endif
86 
87  qDBusRegisterMetaType<QNmSettingsMap>();
88 
92 
96 }
97 
99 {
104 }
105 
107 {
108  QMutexLocker locker(&mutex);
109 
110  // Get current list of access points.
111  foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
112  locker.unlock();
113  deviceAdded(devicePath);
114  locker.relock();
115  }
116 
117  // Get connections.
118  foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) {
119  locker.unlock();
120  newConnection(settingsPath, systemSettings);
121  locker.relock();
122  }
123  foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) {
124  locker.unlock();
125  newConnection(settingsPath, userSettings);
126  locker.relock();
127  }
128 
129  // Get active connections.
130  foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
131  QNetworkManagerConnectionActive *activeConnection =
133  activeConnections.insert(acPath.path(), activeConnection);
134 
135  activeConnection->setConnections();
136  connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
138  }
139 }
140 
142 {
143  QMutexLocker locker(&mutex);
144 
145  return interface->isValid();
146 }
147 
149 {
150  QMutexLocker locker(&mutex);
151 
152  foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
153  QNetworkManagerConnectionActive activeConnection(acPath.path());
154 
155  const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' +
156  activeConnection.connection().path()));
157 
158  if (id == identifier) {
159  QList<QDBusObjectPath> devices = activeConnection.devices();
160 
161  if (devices.isEmpty())
162  continue;
163 
164  QNetworkManagerInterfaceDevice device(devices.at(0).path());
165  return device.networkInterface();
166  }
167  }
168 
169  return QString();
170 }
171 
173 {
174  QMutexLocker locker(&mutex);
175 
176  if (connectionFromId(id))
177  return true;
178 
179  for (int i = 0; i < accessPoints.count(); ++i) {
181 
182  const QString identifier =
183  QString::number(qHash(accessPoint->connectionInterface()->path()));
184 
185  if (id == identifier)
186  return true;
187  }
188 
189  return false;
190 }
191 
193 {
194  QMutexLocker locker(&mutex);
195 
197 
198  if (!connection)
199  return;
200 
201  QNmSettingsMap map = connection->getSettings();
202  const QString connectionType = map.value("connection").value("type").toString();
203 
204  QString dbusDevicePath;
205  foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
206  QNetworkManagerInterfaceDevice device(devicePath.path());
207  if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET &&
208  connectionType == QLatin1String("802-3-ethernet")) {
209  dbusDevicePath = devicePath.path();
210  break;
211  } else if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS &&
212  connectionType == QLatin1String("802-11-wireless")) {
213  dbusDevicePath = devicePath.path();
214  break;
215  }
216  else if (device.deviceType() == DEVICE_TYPE_GSM &&
217  connectionType == QLatin1String("gsm")) {
218  dbusDevicePath = devicePath.path();
219  break;
220  }
221  }
222 
223  const QString service = connection->connectionInterface()->service();
224  const QString settingsPath = connection->connectionInterface()->path();
225 
226  interface->activateConnection(service, QDBusObjectPath(settingsPath),
227  QDBusObjectPath(dbusDevicePath), QDBusObjectPath("/"));
228 }
229 
231 {
232  QMutexLocker locker(&mutex);
233 
234  foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
235  QNetworkManagerConnectionActive activeConnection(acPath.path());
236 
237  const QString identifier = QString::number(qHash(activeConnection.serviceName() + ' ' +
238  activeConnection.connection().path()));
239 
240  if (id == identifier && accessPointConfigurations.contains(id)) {
242  break;
243  }
244  }
245 }
246 
248 {
249  QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection);
250 }
251 
254 {
255  QMutexLocker locker(&mutex);
256 
257  Q_UNUSED(path)
258 
259  QMapIterator<QString, QVariant> i(properties);
260  while (i.hasNext()) {
261  i.next();
262 
263  if (i.key() == QLatin1String("ActiveConnections")) {
264  // Active connections changed, update configurations.
265 
267  qdbus_cast<QList<QDBusObjectPath> >(i.value().value<QDBusArgument>());
268 
269  QStringList identifiers = accessPointConfigurations.keys();
270  foreach (const QString &id, identifiers)
272 
273  QStringList priorActiveConnections = this->activeConnections.keys();
274 
275  foreach (const QDBusObjectPath &acPath, activeConnections) {
276  priorActiveConnections.removeOne(acPath.path());
277  QNetworkManagerConnectionActive *activeConnection =
278  this->activeConnections.value(acPath.path());
279  if (!activeConnection) {
280  activeConnection = new QNetworkManagerConnectionActive(acPath.path());
281  this->activeConnections.insert(acPath.path(), activeConnection);
282 
283  activeConnection->setConnections();
284  connect(activeConnection, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
286  }
287 
288  const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' +
289  activeConnection->connection().path()));
290 
291  identifiers.removeOne(id);
292 
294  if (ptr) {
295  ptr->mutex.lock();
296  if (activeConnection->state() == 2 &&
299  ptr->mutex.unlock();
300 
301  locker.unlock();
303  locker.relock();
304  } else {
305  ptr->mutex.unlock();
306  }
307  }
308  }
309 
310  while (!priorActiveConnections.isEmpty())
311  delete this->activeConnections.take(priorActiveConnections.takeFirst());
312 
313  while (!identifiers.isEmpty()) {
314  // These configurations are not active
316  accessPointConfigurations.value(identifiers.takeFirst());
317 
318  ptr->mutex.lock();
321  ptr->mutex.unlock();
322 
323  locker.unlock();
325  locker.relock();
326  } else {
327  ptr->mutex.unlock();
328  }
329  }
330  }
331  }
332 }
333 
336 {
337  QMutexLocker locker(&mutex);
338 
339  Q_UNUSED(properties)
340 
341  QNetworkManagerConnectionActive *activeConnection = activeConnections.value(path);
342 
343  if (!activeConnection)
344  return;
345 
346  const QString id = QString::number(qHash(activeConnection->serviceName() + ' ' +
347  activeConnection->connection().path()));
348 
350  if (ptr) {
351  ptr->mutex.lock();
352  if (activeConnection->state() == 2 &&
355  ptr->mutex.unlock();
356 
357  locker.unlock();
359  locker.relock();
360  } else {
361  ptr->mutex.unlock();
362  }
363  }
364 }
365 
368 {
369  Q_UNUSED(path);
370  Q_UNUSED(properties);
371 }
372 
374 {
375  QNetworkManagerInterfaceDevice device(path.path());
376  if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) {
378  new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path());
379 
380  wirelessDevice->setConnections();
381  connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)),
383  connect(wirelessDevice, SIGNAL(accessPointRemoved(QString,QDBusObjectPath)),
385  connect(wirelessDevice, SIGNAL(propertiesChanged(QString,QMap<QString,QVariant>)),
387 
388  foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
389  newAccessPoint(QString(), apPath);
390 
391  mutex.lock();
392  wirelessDevices.insert(path.path(), wirelessDevice);
393  mutex.unlock();
394  }
395 }
396 
398 {
399  QMutexLocker locker(&mutex);
400 
401  delete wirelessDevices.take(path.path());
402 }
403 
405  QNetworkManagerSettings *settings)
406 {
407  QMutexLocker locker(&mutex);
408 
409  if (!settings)
411 
412  if (!settings)
413  return;
414 
417  path.path());
418  connections.append(connection);
419 
420  connect(connection, SIGNAL(removed(QString)), this, SLOT(removeConnection(QString)));
421  connect(connection, SIGNAL(updated(const QNmSettingsMap&)),
422  this, SLOT(updateConnection(const QNmSettingsMap&)));
423 
424  const QString service = connection->connectionInterface()->service();
425  const QString settingsPath = connection->connectionInterface()->path();
426 
428  parseConnection(service, settingsPath, connection->getSettings());
429 
430  // Check if connection is active.
431  foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
432  QNetworkManagerConnectionActive activeConnection(acPath.path());
433 
434  if (activeConnection.serviceName() == service &&
435  activeConnection.connection().path() == settingsPath &&
436  activeConnection.state() == 2) {
438  break;
439  }
440  }
441 
443  accessPointConfigurations.insert(ptr->id, ptr);
444 
445  locker.unlock();
447 }
448 
450 {
451  QMutexLocker locker(&mutex);
452 
453  Q_UNUSED(path)
454 
457  if (!connection)
458  return;
459 
460  connections.removeAll(connection);
461 
462  const QString id = QString::number(qHash(connection->connectionInterface()->service() + ' ' +
463  connection->connectionInterface()->path()));
464 
466 
467  connection->deleteLater();
468 
469  locker.unlock();
471 }
472 
474 {
475  QMutexLocker locker(&mutex);
476 
479  if (!connection)
480  return;
481 
482  const QString service = connection->connectionInterface()->service();
483  const QString settingsPath = connection->connectionInterface()->path();
484 
485  QNetworkConfigurationPrivate *cpPriv = parseConnection(service, settingsPath, settings);
486 
487  // Check if connection is active.
488  foreach (const QDBusObjectPath &acPath, interface->activeConnections()) {
489  QNetworkManagerConnectionActive activeConnection(acPath.path());
490 
491  if (activeConnection.serviceName() == service &&
492  activeConnection.connection().path() == settingsPath &&
493  activeConnection.state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
495  break;
496  }
497  }
498 
500 
501  ptr->mutex.lock();
502 
503  ptr->isValid = cpPriv->isValid;
504  ptr->name = cpPriv->name;
505  ptr->id = cpPriv->id;
506  ptr->state = cpPriv->state;
507 
508  ptr->mutex.unlock();
509 
510  locker.unlock();
512  delete cpPriv;
513 }
514 
516 {
517  QMutexLocker locker(&mutex);
518 
519  QDBusPendingReply<QDBusObjectPath> reply = *watcher;
520  if (!reply.isError()) {
521  QDBusObjectPath result = reply.value();
522 
523  QNetworkManagerConnectionActive activeConnection(result.path());
524 
525  const QString id = QString::number(qHash(activeConnection.serviceName() + ' ' +
526  activeConnection.connection().path()));
527 
529  if (ptr) {
530  ptr->mutex.lock();
531  if (activeConnection.state() == 2 &&
534  ptr->mutex.unlock();
535 
536  locker.unlock();
538  locker.relock();
539  } else {
540  ptr->mutex.unlock();
541  }
542  }
543  }
544 }
545 
547 {
548  QMutexLocker locker(&mutex);
549 
550  Q_UNUSED(path)
551 
553  new QNetworkManagerInterfaceAccessPoint(objectPath.path());
554  accessPoints.append(accessPoint);
555 
556  accessPoint->setConnections();
557  connect(accessPoint, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
559 
560  // Check if configuration for this SSID already exists.
561  for (int i = 0; i < accessPoints.count(); ++i) {
562  if (accessPoint != accessPoints.at(i) &&
563  accessPoint->ssid() == accessPoints.at(i)->ssid()) {
564  return;
565  }
566  }
567 
568  // Check if configuration exists for connection.
569  if (!accessPoint->ssid().isEmpty()) {
570  for (int i = 0; i < connections.count(); ++i) {
572 
573  if (accessPoint->ssid() == connection->getSsid()) {
574  const QString service = connection->connectionInterface()->service();
575  const QString settingsPath = connection->connectionInterface()->path();
576  const QString connectionId = QString::number(qHash(service + ' ' + settingsPath));
577 
579  accessPointConfigurations.value(connectionId);
580  ptr->mutex.lock();
582  ptr->mutex.unlock();
583 
584  locker.unlock();
586  return;
587  }
588  }
589  }
590 
591  // New access point.
593 
594  ptr->name = accessPoint->ssid();
595  ptr->isValid = true;
596  ptr->id = QString::number(qHash(objectPath.path()));
598  if(accessPoint->flags() == NM_802_11_AP_FLAGS_PRIVACY) {
600  } else {
602  }
605 
606  accessPointConfigurations.insert(ptr->id, ptr);
607 
608  locker.unlock();
610 }
611 
613  const QDBusObjectPath &objectPath)
614 {
615  QMutexLocker locker(&mutex);
616 
617  Q_UNUSED(path)
618 
619  for (int i = 0; i < accessPoints.count(); ++i) {
621 
622  if (accessPoint->connectionInterface()->path() == objectPath.path()) {
623  accessPoints.removeOne(accessPoint);
624 
625  if (configuredAccessPoints.contains(accessPoint)) {
626  // find connection and change state to Defined
627  configuredAccessPoints.removeOne(accessPoint);
628  for (int i = 0; i < connections.count(); ++i) {
630 
631  if (accessPoint->ssid() == connection->getSsid()) {
632  const QString service = connection->connectionInterface()->service();
633  const QString settingsPath = connection->connectionInterface()->path();
634  const QString connectionId =
635  QString::number(qHash(service + ' ' + settingsPath));
636 
638  accessPointConfigurations.value(connectionId);
639  ptr->mutex.lock();
641  ptr->mutex.unlock();
642 
643  locker.unlock();
645  locker.relock();
646  break;
647  }
648  }
649  } else {
652 
653  if (ptr) {
654  locker.unlock();
656  locker.relock();
657  }
658  }
659 
660  delete accessPoint;
661 
662  break;
663  }
664  }
665 }
666 
668 {
669  QMutexLocker locker(&mutex);
670 
671  Q_UNUSED(map)
672 
675  if (!accessPoint)
676  return;
677 
678  for (int i = 0; i < connections.count(); ++i) {
680 
681  if (accessPoint->ssid() == connection->getSsid()) {
682  const QString service = connection->connectionInterface()->service();
683  const QString settingsPath = connection->connectionInterface()->path();
684  const QString connectionId = QString::number(qHash(service + ' ' + settingsPath));
685 
687  accessPointConfigurations.value(connectionId);
688  ptr->mutex.lock();
690  ptr->mutex.unlock();
691 
692  locker.unlock();
694  return;
695  }
696  }
697 }
698 
700  const QString &settingsPath,
701  const QNmSettingsMap &map)
702 {
704  cpPriv->name = map.value("connection").value("id").toString();
705  cpPriv->isValid = true;
706  cpPriv->id = QString::number(qHash(service + ' ' + settingsPath));
708 
710 
712 
713  const QString connectionType = map.value("connection").value("type").toString();
714 
715  if (connectionType == QLatin1String("802-3-ethernet")) {
718 
719  foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
720  QNetworkManagerInterfaceDevice device(devicePath.path());
721  if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET) {
722  QNetworkManagerInterfaceDeviceWired wiredDevice(device.connectionInterface()->path());
723  if (wiredDevice.carrier()) {
725  break;
726  }
727 
728  }
729  }
730  } else if (connectionType == QLatin1String("802-11-wireless")) {
732 
733  const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
734  const QString connectionSecurity = map.value("802-11-wireless").value("security").toString();
735  if(!connectionSecurity.isEmpty()) {
737  } else {
739  }
740  for (int i = 0; i < accessPoints.count(); ++i) {
741  if (connectionSsid == accessPoints.at(i)->ssid()) {
745 
746  const QString accessPointId =
749  accessPointConfigurations.take(accessPointId);
750 
751  if (ptr) {
752  mutex.unlock();
754  mutex.lock();
755  }
756  }
757  break;
758  }
759  }
760  } else if (connectionType == "gsm") {
762  } else if (connectionType == "cdma") {
764  }
765 
766  return cpPriv;
767 }
768 
770 {
771  for (int i = 0; i < connections.count(); ++i) {
773  const QString service = connection->connectionInterface()->service();
774  const QString settingsPath = connection->connectionInterface()->path();
775 
776  const QString identifier = QString::number(qHash(service + ' ' + settingsPath));
777 
778  if (id == identifier)
779  return connection;
780  }
781 
782  return 0;
783 }
784 
786 {
787  QMutexLocker locker(&mutex);
788 
790 
791  if (!ptr)
793 
794  if (!ptr->isValid)
796 
797  foreach (const QString &acPath, activeConnections.keys()) {
798  QNetworkManagerConnectionActive *activeConnection = activeConnections.value(acPath);
799 
800  const QString identifier = QString::number(qHash(activeConnection->serviceName() + ' ' +
801  activeConnection->connection().path()));
802 
803  if (id == identifier) {
804  switch (activeConnection->state()) {
805  case 0:
807  case 1:
809  case 2:
811  }
812  }
813  }
814 
821 
823 }
824 
826 {
827  QMutexLocker locker(&mutex);
828 
831  const QString networkInterface = getInterfaceFromId(id);
832  if (!networkInterface.isEmpty()) {
833  const QString devFile = QLatin1String("/sys/class/net/") +
834  networkInterface +
835  QLatin1String("/statistics/tx_bytes");
836 
837  quint64 result = Q_UINT64_C(0);
838 
839  QFile tx(devFile);
840  if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
841  QTextStream in(&tx);
842  in >> result;
843  tx.close();
844  }
845 
846  return result;
847  }
848  }
849 
850  return Q_UINT64_C(0);
851 }
852 
854 {
855  QMutexLocker locker(&mutex);
856 
859  const QString networkInterface = getInterfaceFromId(id);
860  if (!networkInterface.isEmpty()) {
861  const QString devFile = QLatin1String("/sys/class/net/") +
862  networkInterface +
863  QLatin1String("/statistics/rx_bytes");
864 
865  quint64 result = Q_UINT64_C(0);
866 
867  QFile tx(devFile);
868  if (tx.exists() && tx.open(QIODevice::ReadOnly | QIODevice::Text)) {
869  QTextStream in(&tx);
870  in >> result;
871  tx.close();
872  }
873 
874  return result;
875  }
876  }
877 
878  return Q_UINT64_C(0);
879 }
880 
882 {
883  QMutexLocker locker(&mutex);
884 
886  if (connection)
887  return connection->getTimestamp();
888  else
889  return Q_UINT64_C(0);
890 }
891 
892 QNetworkConfigurationManager::Capabilities QNetworkManagerEngine::capabilities() const
893 {
896 }
897 
899 {
900  return new QNetworkSessionPrivateImpl;
901 }
902 
904 {
906 }
907 
909 
910 #endif // QT_NO_DBUS
911 #endif // QT_NO_BEARERMANAGEMENT
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
QList< QDBusObjectPath > activeConnections() const
QNetworkManagerInterface * interface
quint64 bytesReceived(const QString &id)
uint qHash(const QProcEnvKey &key)
Definition: qprocess_p.h:96
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void lock()
Locks the mutex.
Definition: qmutex.cpp:151
QString path() const
Returns the object path that this interface is associated with.
void deviceRemoved(const QDBusObjectPath &path)
QString getInterfaceFromId(const QString &id)
T qdbus_cast(const QDBusArgument &arg)
QNetworkConfiguration::StateFlags state
bool open(OpenMode flags)
Opens the file using OpenMode mode, returning true if successful; otherwise false.
Definition: qfile.cpp:1064
The QDBusArgument class is used to marshall and demarshall D-Bus arguments.
Definition: qdbusargument.h:69
void configurationChanged(QNetworkConfigurationPrivatePointer config)
T1 value() const
Returns the first argument in this reply, cast to type T1 (the first template parameter of this class...
QHash< QString, QNetworkManagerConnectionActive * > activeConnections
#define SLOT(a)
Definition: qobjectdefs.h:226
void unlock()
Unlocks this mutex locker.
Definition: qmutex.h:117
QString toString() const
Returns the variant as a QString if the variant has type() String , Bool , ByteArray ...
Definition: qvariant.cpp:2270
void connectToId(const QString &id)
#define NM_DBUS_SERVICE_SYSTEM_SETTINGS
State
This enum describes the connectivity state of the session.
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
QNetworkManagerEngine(QObject *parent=0)
QNetworkConfigurationManager::Capabilities capabilities() const
bool isError() const
Returns true if the reply contains an error message, false if it contains a normal method reply...
QList< QNetworkManagerInterfaceAccessPoint * > accessPoints
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
The QDBusPendingCallWatcher class provides a convenient way for waiting for asynchronous replies...
The QString class provides a Unicode character string.
Definition: qstring.h:83
T * qobject_cast(QObject *object)
Definition: qobject.h:375
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it...
Definition: qhash.h:807
void activationFinished(QDBusPendingCallWatcher *watcher)
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
void updateConnection(const QNmSettingsMap &settings)
QHash< QString, QNetworkManagerInterfaceDeviceWireless * > wirelessDevices
void newConnection(const QDBusObjectPath &path, QNetworkManagerSettings *settings=0)
QDBusInterface * connectionInterface() const
QNetworkConfiguration::BearerType bearerType
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition: qobject.cpp:2327
QNetworkManagerSettings * systemSettings
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
Definition: qfile.cpp:626
void relock()
Relocks an unlocked mutex locker.
Definition: qmutex.h:125
bool removeOne(const T &t)
Removes the first occurrence of value in the list and returns true on success; otherwise returns fals...
Definition: qlist.h:796
QList< QNetworkManagerInterfaceAccessPoint * > configuredAccessPoints
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QList< QDBusObjectPath > listConnections()
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
QBool contains(const T &t) const
Returns true if the list contains an occurrence of value; otherwise returns false.
Definition: qlist.h:880
quint64 startTime(const QString &id)
void updateAccessPoint(const QMap< QString, QVariant > &map)
QHash< QString, QNetworkConfigurationPrivatePointer > accessPointConfigurations
unsigned __int64 quint64
Definition: qglobal.h:943
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
Q_INVOKABLE void requestUpdate()
void activeConnectionPropertiesChanged(const QString &path, const QMap< QString, QVariant > &properties)
const T value(const Key &key) const
Returns the value associated with the key key.
Definition: qmap.h:499
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
void configurationAdded(QNetworkConfigurationPrivatePointer config)
void interfacePropertiesChanged(const QString &path, const QMap< QString, QVariant > &properties)
void activateConnection(const QString &serviceName, QDBusObjectPath connection, QDBusObjectPath device, QDBusObjectPath specificObject)
QString path() const
Returns this object path.
T value(int i) const
Returns the value at index position i in the list.
Definition: qlist.h:661
const T * ptr(const T &t)
quint64 bytesWritten(const QString &id)
void deactivateConnection(QDBusObjectPath connectionPath) const
QList< QDBusObjectPath > getDevices() const
void unlock()
Unlocks the mutex.
Definition: qmutex.cpp:296
QDBusInterface * connectionInterface() const
void deviceAdded(const QDBusObjectPath &path)
void disconnectFromId(const QString &id)
bool hasIdentifier(const QString &id)
QList< QNetworkManagerSettingsConnection * > connections
#define NM_DBUS_SERVICE_USER_SETTINGS
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
Definition: qmutex.h:101
QNetworkConfiguration::Purpose purpose
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
QExplicitlySharedDataPointer< QNetworkConfigurationPrivate > QNetworkConfigurationPrivatePointer
The QTextStream class provides a convenient interface for reading and writing text.
Definition: qtextstream.h:73
QNetworkConfiguration::Type type
QNetworkManagerSettings * userSettings
QNetworkConfigurationPrivatePointer defaultConfiguration()
void removeConnection(const QString &path)
unsigned int quint32
Definition: qglobal.h:938
The QDBusObjectPath class enables the programmer to identify the OBJECT_PATH type provided by the D-B...
void configurationRemoved(QNetworkConfigurationPrivatePointer config)
QString service() const
Returns the name of the service this interface is associated with.
static const QCssKnownValue properties[NumProperties - 1]
Definition: qcssparser.cpp:67
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.
QNetworkConfigurationPrivate * parseConnection(const QString &service, const QString &settingsPath, const QNmSettingsMap &map)
#define Q_UINT64_C(c)
Definition: qglobal.h:941
void devicePropertiesChanged(const QString &path, const QMap< QString, QVariant > &properties)
void newAccessPoint(const QString &path, const QDBusObjectPath &objectPath)
The QDBusPendingReply class contains the reply to an asynchronous method call.
virtual void close()
Calls QFile::flush() and closes the file.
Definition: qfile.cpp:1680
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
Definition: qalgorithms.h:319
QNetworkSessionPrivate * createSessionBackend()
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
Definition: qhash.h:648
void deleteLater()
Schedules this object for deletion.
Definition: qobject.cpp:2145
QNetworkManagerSettingsConnection * connectionFromId(const QString &id) const
void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath)
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
int removeAll(const T &t)
Removes all occurrences of value in the list and returns the number of entries removed.
Definition: qlist.h:770
QNetworkSession::State sessionStateForId(const QString &id)
#define NM_802_11_AP_FLAGS_PRIVACY