diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2014-10-27 13:00:36 +0100 |
commit | 2eb26c170920d28213b71e549d5dac4663febb14 (patch) | |
tree | 8df5223ac114d758c2112a8fc787992175556418 /src/plugins/bearer/networkmanager/qnmdbushelper.cpp | |
parent | 49ddae28e0dcd1c59dd5d742cffedd5290d1224a (diff) | |
parent | 81998b4e8e440076bd22a9164f0a93481c0e597a (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/gui/text/qfontdatabase.cpp
Change-Id: I6ac1f55faa22b8e7b591386fb67f0333d0ea443d
Diffstat (limited to 'src/plugins/bearer/networkmanager/qnmdbushelper.cpp')
-rw-r--r-- | src/plugins/bearer/networkmanager/qnmdbushelper.cpp | 56 |
1 files changed, 37 insertions, 19 deletions
diff --git a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp index a2e055d784..0decfd78b9 100644 --- a/src/plugins/bearer/networkmanager/qnmdbushelper.cpp +++ b/src/plugins/bearer/networkmanager/qnmdbushelper.cpp @@ -60,7 +60,7 @@ QNmDBusHelper::~QNmDBusHelper() void QNmDBusHelper::deviceStateChanged(quint32 state) { QDBusMessage msg = this->message(); - if(state == NM_DEVICE_STATE_ACTIVATED + if (state == NM_DEVICE_STATE_ACTIVATED || state == NM_DEVICE_STATE_DISCONNECTED || state == NM_DEVICE_STATE_UNAVAILABLE || state == NM_DEVICE_STATE_FAILED) { @@ -70,18 +70,14 @@ void QNmDBusHelper::deviceStateChanged(quint32 state) void QNmDBusHelper::slotAccessPointAdded(QDBusObjectPath path) { - if(path.path().length() > 2) { - QDBusMessage msg = this->message(); - emit pathForAccessPointAdded(msg.path(), path); - } + if (path.path().length() > 2) + emit pathForAccessPointAdded(path.path()); } void QNmDBusHelper::slotAccessPointRemoved(QDBusObjectPath path) { - if(path.path().length() > 2) { - QDBusMessage msg = this->message(); - emit pathForAccessPointRemoved(msg.path(), path); - } + if (path.path().length() > 2) + emit pathForAccessPointRemoved(path.path()); } void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map) @@ -90,23 +86,29 @@ void QNmDBusHelper::slotPropertiesChanged(QMap<QString,QVariant> map) QMapIterator<QString, QVariant> i(map); while (i.hasNext()) { i.next(); - if( i.key() == "State") { //state only applies to device interfaces + if (i.key() == QStringLiteral("State")) { quint32 state = i.value().toUInt(); - if( state == NM_DEVICE_STATE_ACTIVATED + if (state == NM_DEVICE_STATE_ACTIVATED || state == NM_DEVICE_STATE_DISCONNECTED || state == NM_DEVICE_STATE_UNAVAILABLE || state == NM_DEVICE_STATE_FAILED) { - emit pathForPropertiesChanged( msg.path(), map); + emit pathForPropertiesChanged(msg.path(), map); } - } else if( i.key() == "ActiveAccessPoint") { + } else if (i.key() == QStringLiteral("ActiveAccessPoint")) { emit pathForPropertiesChanged(msg.path(), map); - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().value<QDBusObjectPath>().path(); - // } else if( i.key() == "Strength") - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value().toUInt(); - // else - // qWarning() << __PRETTY_FUNCTION__ << i.key() << ": " << i.value(); - } else if (i.key() == "ActiveConnections") { + } else if (i.key() == QStringLiteral("ActiveConnections")) { emit pathForPropertiesChanged(msg.path(), map); + } else if (i.key() == QStringLiteral("AvailableConnections")) { + const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>(); + QDBusObjectPath path; + QStringList paths; + dbusArgs.beginArray(); + while (!dbusArgs.atEnd()) { + dbusArgs >> path; + paths << path.path(); + } + dbusArgs.endArray(); + emit pathForConnectionsChanged(paths); } } } @@ -117,6 +119,22 @@ void QNmDBusHelper::slotSettingsRemoved() emit pathForSettingsRemoved(msg.path()); } +void QNmDBusHelper::activeConnectionPropertiesChanged(QMap<QString,QVariant> map) +{ + QDBusMessage msg = this->message(); + QMapIterator<QString, QVariant> i(map); + while (i.hasNext()) { + i.next(); + if (i.key() == QStringLiteral("State")) { + quint32 state = i.value().toUInt(); + if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED + || state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { + emit pathForPropertiesChanged(msg.path(), map); + } + } + } +} + QT_END_NAMESPACE #endif // QT_NO_DBUS |