commit libKF5NetworkManagerQt for openSUSE:Factory
Hello community, here is the log from the commit of package libKF5NetworkManagerQt for openSUSE:Factory checked in at 2016-10-28 12:25:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libKF5NetworkManagerQt (Old) and /work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "libKF5NetworkManagerQt" Changes: -------- --- /work/SRC/openSUSE:Factory/libKF5NetworkManagerQt/libKF5NetworkManagerQt.changes 2016-09-30 15:22:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libKF5NetworkManagerQt.new/libKF5NetworkManagerQt.changes 2016-10-28 12:25:07.000000000 +0200 @@ -1,0 +2,13 @@ +Sun Oct 2 13:01:53 UTC 2016 - hrvoje.senjan@gmail.com + +- Update to 5.27.0 + * We need to set the state during initialization + * Replace all blocking calls for initialization with + just one blocking call + * Use standard o.f.DBus.Properties interface for PropertiesChanged + signal for NM 1.4.0+ (kde#367938) + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.27.0.php +- Drop upstreamed fix-icons-with-NM-1.4.0.patch + +------------------------------------------------------------------- Old: ---- fix-icons-with-NM-1.4.0.patch networkmanager-qt-5.26.0.tar.xz New: ---- networkmanager-qt-5.27.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libKF5NetworkManagerQt.spec ++++++ --- /var/tmp/diff_new_pack.yXEjdI/_old 2016-10-28 12:25:08.000000000 +0200 +++ /var/tmp/diff_new_pack.yXEjdI/_new 2016-10-28 12:25:08.000000000 +0200 @@ -17,9 +17,9 @@ %define soversion 6 -%define _tar_path 5.26 +%define _tar_path 5.27 Name: libKF5NetworkManagerQt -Version: 5.26.0 +Version: 5.27.0 Release: 0 Summary: A Qt wrapper for NetworkManager DBus API License: LGPL-2.1 or LGPL-3.0 @@ -27,8 +27,6 @@ Url: http://www.kde.org Source: http://download.kde.org/stable/frameworks/%{_tar_path}/networkmanager-qt-%{version}.tar.xz Source1: baselibs.conf -# PATCH-FIX-UPSTREAM fix-icons-with-NM-1.4.0.patch kde#367938 -- fixes wrong network icons with NetworkManager 1.4.0+ -Patch: fix-icons-with-NM-1.4.0.patch BuildRequires: cmake BuildRequires: extra-cmake-modules >= %{_tar_path} BuildRequires: kf5-filesystem @@ -75,7 +73,6 @@ %prep %setup -q -n networkmanager-qt-%{version} -%patch -p1 %build %cmake_kf5 -d build ++++++ networkmanager-qt-5.26.0.tar.xz -> networkmanager-qt-5.27.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/CMakeLists.txt new/networkmanager-qt-5.27.0/CMakeLists.txt --- old/networkmanager-qt-5.26.0/CMakeLists.txt 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/CMakeLists.txt 2016-10-02 10:17:05.000000000 +0200 @@ -3,7 +3,7 @@ project(NetworkManagerQt) include(FeatureSummary) -find_package(ECM 5.26.0 NO_MODULE) +find_package(ECM 5.27.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -32,7 +32,7 @@ include(ECMSetupVersion) include(ECMGenerateHeaders) -set(KF5_VERSION "5.26.0") # handled by release scripts +set(KF5_VERSION "5.27.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX NETWORKMANAGERQT VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/networkmanagerqt_version.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/accesspoint.cpp new/networkmanager-qt-5.27.0/src/accesspoint.cpp --- old/networkmanager-qt-5.26.0/src/accesspoint.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/accesspoint.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -43,21 +43,6 @@ , q_ptr(q) { uni = path; - if (iface.isValid()) { - capabilities = convertCapabilities(iface.flags()); - wpaFlags = convertWpaFlags(iface.wpaFlags()); - rsnFlags = convertWpaFlags(iface.rsnFlags()); - signalStrength = iface.strength(); - rawSsid = iface.ssid(); - ssid = QString::fromUtf8(rawSsid); - frequency = iface.frequency(); - hardwareAddress = iface.hwAddress(); - maxBitRate = iface.maxBitrate(); - mode = q->convertOperationMode(iface.mode()); - if (NetworkManager::checkVersion(1, 0, 6)) { - lastSeen = iface.lastSeen(); - } - } } NetworkManager::AccessPoint::Capabilities NetworkManager::AccessPointPrivate::convertCapabilities(int caps) @@ -79,7 +64,19 @@ , d_ptr(new AccessPointPrivate(path, this)) { Q_D(AccessPoint); + + // Get all AccessPoint's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else QObject::connect(&d->iface, &OrgFreedesktopNetworkManagerAccessPointInterface::PropertiesChanged, d, &AccessPointPrivate::propertiesChanged); +#endif } NetworkManager::AccessPoint::~AccessPoint() @@ -182,6 +179,14 @@ return ourMode; } +void NetworkManager::AccessPointPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.AccessPoint")) { + propertiesChanged(properties); + } +} + void NetworkManager::AccessPointPrivate::propertiesChanged(const QVariantMap &properties) { Q_Q(AccessPoint); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/accesspoint_p.h new/networkmanager-qt-5.27.0/src/accesspoint_p.h --- old/networkmanager-qt-5.26.0/src/accesspoint_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/accesspoint_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -56,6 +56,7 @@ Q_DECLARE_PUBLIC(AccessPoint) AccessPoint *q_ptr; private Q_SLOTS: + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void propertiesChanged(const QVariantMap &properties); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/activeconnection.cpp new/networkmanager-qt-5.27.0/src/activeconnection.cpp --- old/networkmanager-qt-5.26.0/src/activeconnection.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/activeconnection.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -38,45 +38,12 @@ : iface(NetworkManagerPrivate::DBUS_SERVICE, dbusPath, QDBusConnection::sessionBus()) #else : iface(NetworkManagerPrivate::DBUS_SERVICE, dbusPath, QDBusConnection::systemBus()) - #endif , dhcp4Config(0) , dhcp6Config(0) , q_ptr(q) { - connection = NetworkManager::findConnection(iface.connection().path()); path = dbusPath; - default4 = iface.default4(); - default6 = iface.default6(); - specificObject = iface.specificObject().path(); - state = NetworkManager::ActiveConnectionPrivate::convertActiveConnectionState(iface.state()); - vpn = iface.vpn(); - uuid = iface.uuid(); - master = iface.master().path(); - Q_FOREACH (const QDBusObjectPath & devicePath, iface.devices()) { - devices.append(devicePath.path()); - } - id = iface.id(); - type = iface.type(); - QDBusObjectPath ip4ConfigObjectPath = iface.ip4Config(); - if (!ip4ConfigObjectPath.path().isNull() || ip4ConfigObjectPath.path() != QLatin1String("/")) { - ipV4ConfigPath = ip4ConfigObjectPath.path(); - } - - QDBusObjectPath ip6ConfigObjectPath = iface.ip6Config(); - if (!ip6ConfigObjectPath.path().isNull() || ip6ConfigObjectPath.path() != QLatin1String("/")) { - ipV6ConfigPath = ip6ConfigObjectPath.path(); - } - - QDBusObjectPath dhcp4ConfigObjectPath = iface.dhcp4Config(); - if (!dhcp4ConfigObjectPath.path().isNull() && dhcp4ConfigObjectPath.path() != QLatin1String("/")) { - dhcp4ConfigPath = dhcp4ConfigObjectPath.path(); - } - - QDBusObjectPath dhcp6ConfigObjectPath = iface.dhcp6Config(); - if (!dhcp6ConfigObjectPath.path().isNull() && dhcp6ConfigObjectPath.path() != QLatin1String("/")) { - dhcp6ConfigPath = dhcp6ConfigObjectPath.path(); - } } NetworkManager::ActiveConnectionPrivate::~ActiveConnectionPrivate() @@ -93,8 +60,18 @@ { Q_D(ActiveConnection); - connect(&d->iface, &OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d, &ActiveConnectionPrivate::propertiesChanged); + // Get all ActiveConnection's at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else + connect(&d->iface, &OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d, &ActiveConnectionPrivate::propertiesChanged); +#endif /* * Workaround: Re-check connection state before we watch changes in case it gets changed too quickly * BUG:352326 @@ -107,7 +84,12 @@ { Q_D(ActiveConnection); +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerConnectionActiveInterface::PropertiesChanged, d, &ActiveConnectionPrivate::propertiesChanged); +#endif /* * Workaround: Re-check connection state before we watch changes in case it gets changed too quickly @@ -302,102 +284,118 @@ } } -void NetworkManager::ActiveConnectionPrivate::propertiesChanged(const QVariantMap &properties) +void NetworkManager::ActiveConnectionPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) { - Q_Q(ActiveConnection); + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.Connection.Active")) { + propertiesChanged(properties); + } +} + +void NetworkManager::ActiveConnectionPrivate::propertiesChanged(const QVariantMap &properties) +{ // qCDebug(NMQT) << Q_FUNC_INFO << properties; QVariantMap::const_iterator it = properties.constBegin(); while (it != properties.constEnd()) { - const QString property = it.key(); - if (property == QLatin1String("Connection")) { - connection = NetworkManager::findConnection(qdbus_cast<QDBusObjectPath>(*it).path()); - Q_EMIT q->connectionChanged(connection); - const QString tmpId = connection->settings()->id(); - const QString tmpType = connection->settings()->typeAsString(connection->settings()->connectionType()); - if (tmpId != id) { - id = tmpId; - Q_EMIT q->idChanged(id); - } + propertyChanged(it.key(), it.value()); + ++it; + } +} - if (tmpType != type) { - Q_EMIT q->typeChanged(NetworkManager::ConnectionSettings::typeFromString(type)); - } - } else if (property == QLatin1String("Default")) { - default4 = it->toBool(); - Q_EMIT q->default4Changed(default4); - } else if (property == QLatin1String("Default6")) { - default6 = it->toBool(); - Q_EMIT q->default6Changed(default6); - } else if (property == QLatin1String("Dhcp4Config")) { - QDBusObjectPath dhcp4ConfigPathTmp = (*it).value<QDBusObjectPath>(); - if (dhcp4ConfigPathTmp.path().isNull()) { - dhcp4Config.clear(); - dhcp4ConfigPath.clear(); - } else if (!dhcp4Config || dhcp4Config->path() != dhcp4ConfigPathTmp.path()) { - dhcp4Config.clear(); - dhcp4ConfigPath = dhcp4ConfigPathTmp.path(); - } - Q_EMIT q->dhcp4ConfigChanged(); - } else if (property == QLatin1String("Dhcp6Config")) { - QDBusObjectPath dhcp6ConfigPathTmp = (*it).value<QDBusObjectPath>(); - if (dhcp6ConfigPathTmp.path().isNull()) { - dhcp6Config.clear(); - dhcp6ConfigPath.clear(); - } else if (!dhcp6Config || dhcp6Config->path() != dhcp6ConfigPathTmp.path()) { - dhcp6Config.clear(); - dhcp6ConfigPath = dhcp6ConfigPathTmp.path(); - } - Q_EMIT q->dhcp6ConfigChanged(); - } else if (property == QLatin1String("Ip4Config")) { - QDBusObjectPath ip4ConfigObjectPathTmp = (*it).value<QDBusObjectPath>(); - if (ip4ConfigObjectPathTmp.path().isNull() || ip4ConfigObjectPathTmp.path() == QLatin1String("/")) { - ipV4ConfigPath.clear(); - } else { - ipV4ConfigPath = ip4ConfigObjectPathTmp.path(); - } - ipV4Config = IpConfig(); - Q_EMIT q->ipV4ConfigChanged(); - } else if (property == QLatin1String("Ip6Config")) { - QDBusObjectPath ip6ConfigObjectPathTmp = (*it).value<QDBusObjectPath>(); - if (ip6ConfigObjectPathTmp.path().isNull() || ip6ConfigObjectPathTmp.path() == QLatin1String("/")) { - ipV6ConfigPath.clear(); - } else { - ipV6ConfigPath = ip6ConfigObjectPathTmp.path(); - } - ipV6Config = IpConfig(); - Q_EMIT q->ipV6ConfigChanged(); - } else if (property == QLatin1String("Id")) { - id = it->toString(); +void NetworkManager::ActiveConnectionPrivate::propertyChanged(const QString &property, const QVariant &value) +{ + Q_Q(ActiveConnection); + + // qCDebug(NMQT) << property << " - " << value; + + if (property == QLatin1String("Connection")) { + connection = NetworkManager::findConnection(qdbus_cast<QDBusObjectPath>(value).path()); + Q_EMIT q->connectionChanged(connection); + const QString tmpId = connection->settings()->id(); + const QString tmpType = connection->settings()->typeAsString(connection->settings()->connectionType()); + if (tmpId != id) { + id = tmpId; Q_EMIT q->idChanged(id); - } else if (property == QLatin1String("Type")) { - type = it->toString(); + } + + if (tmpType != type) { Q_EMIT q->typeChanged(NetworkManager::ConnectionSettings::typeFromString(type)); - } else if (property == QLatin1String("Master")) { - master = qdbus_cast<QDBusObjectPath>(*it).path(); - Q_EMIT q->masterChanged(master); - } else if (property == QLatin1String("SpecificObject")) { - specificObject = qdbus_cast<QDBusObjectPath>(*it).path(); - Q_EMIT q->specificObjectChanged(specificObject); - } else if (property == QLatin1String("State")) { - state = NetworkManager::ActiveConnectionPrivate::convertActiveConnectionState(it->toUInt()); - Q_EMIT q->stateChanged(state); - } else if (property == QLatin1String("Vpn")) { - vpn = it->toBool(); - Q_EMIT q->vpnChanged(vpn); - } else if (property == QLatin1String("Uuid")) { - uuid = it->toString(); - Q_EMIT q->uuidChanged(uuid); - } else if (property == QLatin1String("Devices")) { - devices.clear(); - Q_FOREACH (const QDBusObjectPath & path, it->value<QList<QDBusObjectPath> >()) { - devices.append(path.path()); - } - Q_EMIT q->devicesChanged(); + } + } else if (property == QLatin1String("Default")) { + default4 = value.toBool(); + Q_EMIT q->default4Changed(default4); + } else if (property == QLatin1String("Default6")) { + default6 = value.toBool(); + Q_EMIT q->default6Changed(default6); + } else if (property == QLatin1String("Dhcp4Config")) { + QDBusObjectPath dhcp4ConfigPathTmp = (value).value<QDBusObjectPath>(); + if (dhcp4ConfigPathTmp.path().isNull()) { + dhcp4Config.clear(); + dhcp4ConfigPath.clear(); + } else if (!dhcp4Config || dhcp4Config->path() != dhcp4ConfigPathTmp.path()) { + dhcp4Config.clear(); + dhcp4ConfigPath = dhcp4ConfigPathTmp.path(); + } + Q_EMIT q->dhcp4ConfigChanged(); + } else if (property == QLatin1String("Dhcp6Config")) { + QDBusObjectPath dhcp6ConfigPathTmp = (value).value<QDBusObjectPath>(); + if (dhcp6ConfigPathTmp.path().isNull()) { + dhcp6Config.clear(); + dhcp6ConfigPath.clear(); + } else if (!dhcp6Config || dhcp6Config->path() != dhcp6ConfigPathTmp.path()) { + dhcp6Config.clear(); + dhcp6ConfigPath = dhcp6ConfigPathTmp.path(); + } + Q_EMIT q->dhcp6ConfigChanged(); + } else if (property == QLatin1String("Ip4Config")) { + QDBusObjectPath ip4ConfigObjectPathTmp = (value).value<QDBusObjectPath>(); + if (ip4ConfigObjectPathTmp.path().isNull() || ip4ConfigObjectPathTmp.path() == QLatin1String("/")) { + ipV4ConfigPath.clear(); } else { - qCWarning(NMQT) << Q_FUNC_INFO << "Unhandled property" << property; + ipV4ConfigPath = ip4ConfigObjectPathTmp.path(); } - ++it; + ipV4Config = IpConfig(); + Q_EMIT q->ipV4ConfigChanged(); + } else if (property == QLatin1String("Ip6Config")) { + QDBusObjectPath ip6ConfigObjectPathTmp = (value).value<QDBusObjectPath>(); + if (ip6ConfigObjectPathTmp.path().isNull() || ip6ConfigObjectPathTmp.path() == QLatin1String("/")) { + ipV6ConfigPath.clear(); + } else { + ipV6ConfigPath = ip6ConfigObjectPathTmp.path(); + } + ipV6Config = IpConfig(); + Q_EMIT q->ipV6ConfigChanged(); + } else if (property == QLatin1String("Id")) { + id = value.toString(); + Q_EMIT q->idChanged(id); + } else if (property == QLatin1String("Type")) { + type = value.toString(); + Q_EMIT q->typeChanged(NetworkManager::ConnectionSettings::typeFromString(type)); + } else if (property == QLatin1String("Master")) { + master = qdbus_cast<QDBusObjectPath>(value).path(); + Q_EMIT q->masterChanged(master); + } else if (property == QLatin1String("SpecificObject")) { + specificObject = qdbus_cast<QDBusObjectPath>(value).path(); + Q_EMIT q->specificObjectChanged(specificObject); + } else if (property == QLatin1String("State")) { + state = NetworkManager::ActiveConnectionPrivate::convertActiveConnectionState(value.toUInt()); + Q_EMIT q->stateChanged(state); + } else if (property == QLatin1String("Vpn")) { + vpn = value.toBool(); + Q_EMIT q->vpnChanged(vpn); + } else if (property == QLatin1String("Uuid")) { + uuid = value.toString(); + Q_EMIT q->uuidChanged(uuid); + } else if (property == QLatin1String("Devices")) { + devices.clear(); + Q_FOREACH (const QDBusObjectPath & path, qdbus_cast< QList<QDBusObjectPath> >(value)) { + qCDebug(NMQT) << "Device append " << path.path(); + devices.append(path.path()); + } + Q_EMIT q->devicesChanged(); + } else { + qCWarning(NMQT) << Q_FUNC_INFO << "Unhandled property" << property; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/activeconnection_p.h new/networkmanager-qt-5.27.0/src/activeconnection_p.h --- old/networkmanager-qt-5.26.0/src/activeconnection_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/activeconnection_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -64,8 +64,18 @@ * BUG:352326 */ void recheckProperties(); -private Q_SLOTS: +public: + /** + * When subclassing make sure to call the parent class method + * if the property was not useful to your new class + */ + virtual void propertyChanged(const QString &property, const QVariant &value); + +public Q_SLOTS: void propertiesChanged(const QVariantMap &properties); + +private Q_SLOTS: + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); }; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/adsldevice.cpp new/networkmanager-qt-5.27.0/src/adsldevice.cpp --- old/networkmanager-qt-5.26.0/src/adsldevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/adsldevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -30,7 +30,6 @@ #endif , carrier(false) { - carrier = iface.carrier(); } NetworkManager::AdslDevice::~AdslDevice() @@ -41,7 +40,18 @@ : Device(*new AdslDevicePrivate(path, this), parent) { Q_D(AdslDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceAdslInterface::PropertiesChanged, d, &AdslDevicePrivate::propertiesChanged); +#endif } NetworkManager::AdslDevicePrivate::~AdslDevicePrivate() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/bluetoothdevice.cpp new/networkmanager-qt-5.27.0/src/bluetoothdevice.cpp --- old/networkmanager-qt-5.26.0/src/bluetoothdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/bluetoothdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -33,16 +33,24 @@ , btIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - btCapabilities = static_cast<QFlags<NetworkManager::BluetoothDevice::Capability> >(btIface.btCapabilities()); - hardwareAddress = btIface.hwAddress(); - name = btIface.name(); } NetworkManager::BluetoothDevice::BluetoothDevice(const QString &path, QObject *parent) : ModemDevice(*new BluetoothDevicePrivate(path, this), parent) { Q_D(BluetoothDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->btIface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->btIface, &OrgFreedesktopNetworkManagerDeviceBluetoothInterface::PropertiesChanged, d, &BluetoothDevicePrivate::propertiesChanged); +#endif } NetworkManager::BluetoothDevice::~BluetoothDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/bonddevice.cpp new/networkmanager-qt-5.27.0/src/bonddevice.cpp --- old/networkmanager-qt-5.26.0/src/bonddevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/bonddevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -32,13 +32,6 @@ #endif , carrier(false) { - carrier = iface.carrier(); - hwAddress = iface.hwAddress(); - QStringList list; - Q_FOREACH (const QDBusObjectPath & op, iface.slaves()) { - list << op.path(); - } - slaves = list; } NetworkManager::BondDevice::~BondDevice() @@ -49,7 +42,18 @@ Device(*new BondDevicePrivate(path, this), parent) { Q_D(BondDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceBondInterface::PropertiesChanged, d, &BondDevicePrivate::propertiesChanged); +#endif } NetworkManager::BondDevicePrivate::~BondDevicePrivate() @@ -94,7 +98,7 @@ Q_EMIT q->hwAddressChanged(hwAddress); } else if (property == QLatin1String("Slaves")) { QStringList list; - Q_FOREACH (const QDBusObjectPath & op, value.value<QList<QDBusObjectPath> >()) { + Q_FOREACH (const QDBusObjectPath & op, qdbus_cast< QList<QDBusObjectPath> >(value)) { list << op.path(); } slaves = list; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/bridgedevice.cpp new/networkmanager-qt-5.27.0/src/bridgedevice.cpp --- old/networkmanager-qt-5.26.0/src/bridgedevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/bridgedevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -30,13 +30,6 @@ #endif , carrier(false) { - carrier = iface.carrier(); - hwAddress = iface.hwAddress(); - QStringList list; - Q_FOREACH (const QDBusObjectPath & op, iface.slaves()) { - list << op.path(); - } - slaves = list; } NetworkManager::BridgeDevicePrivate::~BridgeDevicePrivate() @@ -47,7 +40,18 @@ Device(*new BridgeDevicePrivate(path, this), parent) { Q_D(BridgeDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceBridgeInterface::PropertiesChanged, d, &BridgeDevicePrivate::propertiesChanged); +#endif } NetworkManager::BridgeDevice::~BridgeDevice() @@ -92,7 +96,7 @@ Q_EMIT q->hwAddressChanged(hwAddress); } else if (property == QLatin1String("Slaves")) { QStringList list; - Q_FOREACH (const QDBusObjectPath & op, value.value<QList<QDBusObjectPath> >()) { + Q_FOREACH (const QDBusObjectPath & op, qdbus_cast< QList<QDBusObjectPath> >(value)) { list << op.path(); } slaves = list; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/connection.cpp new/networkmanager-qt-5.27.0/src/connection.cpp --- old/networkmanager-qt-5.26.0/src/connection.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/connection.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -74,7 +74,12 @@ connect(&d->iface, &OrgFreedesktopNetworkManagerSettingsConnectionInterface::Updated, d, &ConnectionPrivate::onConnectionUpdated); connect(&d->iface, &OrgFreedesktopNetworkManagerSettingsConnectionInterface::Removed, d, &ConnectionPrivate::onConnectionRemoved); d->unsaved = d->iface.unsaved(); +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerSettingsConnectionInterface::PropertiesChanged, d, &ConnectionPrivate::onPropertiesChanged); +#endif } NetworkManager::Connection::~Connection() @@ -178,6 +183,14 @@ Q_EMIT q->removed(tmpPath); } +void NetworkManager::ConnectionPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.Settings.Connection")) { + onPropertiesChanged(properties); + } +} + void NetworkManager::ConnectionPrivate::onPropertiesChanged(const QVariantMap &properties) { Q_Q(Connection); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/connection_p.h new/networkmanager-qt-5.27.0/src/connection_p.h --- old/networkmanager-qt-5.26.0/src/connection_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/connection_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -54,6 +54,7 @@ private Q_SLOTS: void onConnectionUpdated(); void onConnectionRemoved(); + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void onPropertiesChanged(const QVariantMap &properties); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/device.cpp new/networkmanager-qt-5.27.0/src/device.cpp --- old/networkmanager-qt-5.26.0/src/device.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/device.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -104,47 +104,6 @@ , mtu(0) , q_ptr(q) { - activeConnection = deviceIface.activeConnection().path(); - driver = deviceIface.driver(); - interfaceName = deviceIface.interface(); - ipInterface = deviceIface.ipInterface(); - ipV4Address = QHostAddress(ntohl(deviceIface.ip4Address())); - managed = deviceIface.managed(); - udi = deviceIface.udi(); - firmwareMissing = deviceIface.firmwareMissing(); - driverVersion = deviceIface.driverVersion(); - firmwareVersion = deviceIface.firmwareVersion(); - autoconnect = deviceIface.autoconnect(); - reason = NetworkManager::DevicePrivate::convertReason(deviceIface.stateReason().reason); - Q_FOREACH (const QDBusObjectPath & availableConnection, deviceIface.availableConnections()) { - availableConnections << availableConnection.path(); - } - physicalPortId = deviceIface.physicalPortId(); - mtu = deviceIface.mtu(); - nmPluginMissing = NetworkManager::checkVersion(1, 2, 0) ? deviceIface.nmPluginMissing() : false; - metered = NetworkManager::checkVersion(1, 0, 6) - ? NetworkManager::DevicePrivate::convertMeteredStatus(deviceIface.metered()) - : NetworkManager::Device::UnknownStatus; - - QDBusObjectPath ip4ConfigObjectPath = deviceIface.ip4Config(); - if (!ip4ConfigObjectPath.path().isNull() || ip4ConfigObjectPath.path() != QLatin1String("/")) { - ipV4ConfigPath = ip4ConfigObjectPath.path(); - } - - QDBusObjectPath ip6ConfigObjectPath = deviceIface.ip6Config(); - if (!ip6ConfigObjectPath.path().isNull() || ip6ConfigObjectPath.path() != QLatin1String("/")) { - ipV6ConfigPath = ip6ConfigObjectPath.path(); - } - - QDBusObjectPath dhcp4ConfigObjectPath = deviceIface.dhcp4Config(); - if (!dhcp4ConfigObjectPath.path().isNull() && dhcp4ConfigObjectPath.path() != QLatin1String("/")) { - dhcp4ConfigPath = dhcp4ConfigObjectPath.path(); - } - - QDBusObjectPath dhcp6ConfigObjectPath = deviceIface.dhcp6Config(); - if (!dhcp6ConfigObjectPath.path().isNull() && dhcp6ConfigObjectPath.path() != QLatin1String("/")) { - dhcp6ConfigPath = dhcp6ConfigObjectPath.path(); - } } NetworkManager::DevicePrivate::~DevicePrivate() @@ -161,10 +120,17 @@ qDBusRegisterMetaType<IpV6DBusRoute>(); qDBusRegisterMetaType<IpV6DBusRouteList>(); qDBusRegisterMetaType<DeviceDBusStateReason>(); - capabilities = convertCapabilities(deviceIface.capabilities()); - connectionState = convertState(deviceIface.state()); + + // This needs to be initialized as soon as possible, because based on this property + // we initialize the device type deviceType = static_cast<Device::Type>(deviceIface.deviceType()); + // Get all Device's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(deviceIface.staticInterfaceName(), uni); + if (!initialProperties.isEmpty()) { + propertiesChanged(initialProperties); + } + QObject::connect(&deviceIface, &OrgFreedesktopNetworkManagerDeviceInterface::StateChanged, this, &DevicePrivate::deviceStateChanged); } @@ -215,6 +181,7 @@ { Q_Q(Device); + // qCDebug(NMQT) << property << " - " << value; if (property == QLatin1String("ActiveConnection")) { // FIXME workaround, because NM doesn't Q_EMIT correct value // d->activeConnection = value.value<QDBusObjectPath>.path(); @@ -570,6 +537,14 @@ Q_EMIT q->stateChanged(connectionState, NetworkManager::DevicePrivate::convertState(oldState), NetworkManager::DevicePrivate::convertReason(reason)); } +void NetworkManager::DevicePrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName.contains(QLatin1String("org.freedesktop.NetworkManager.Device"))) { + propertiesChanged(properties); + } +} + void NetworkManager::DevicePrivate::propertiesChanged(const QVariantMap &properties) { // qCDebug(NMQT) << Q_FUNC_INFO << properties; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/device_p.h new/networkmanager-qt-5.27.0/src/device_p.h --- old/networkmanager-qt-5.26.0/src/device_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/device_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -86,6 +86,7 @@ public Q_SLOTS: void deviceStateChanged(uint, uint, uint); + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void propertiesChanged(const QVariantMap &properties); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/dhcp4config.cpp new/networkmanager-qt-5.27.0/src/dhcp4config.cpp --- old/networkmanager-qt-5.26.0/src/dhcp4config.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/dhcp4config.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -44,8 +44,12 @@ { Q_D(Dhcp4Config); Q_UNUSED(owner); - +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->myPath, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->dhcp4Iface, &OrgFreedesktopNetworkManagerDHCP4ConfigInterface::PropertiesChanged, d, &Dhcp4ConfigPrivate::dhcp4PropertiesChanged); +#endif d->options = d->dhcp4Iface.options(); } @@ -76,6 +80,14 @@ return value; } +void NetworkManager::Dhcp4ConfigPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.DHCP4Config")) { + dhcp4PropertiesChanged(properties); + } +} + void NetworkManager::Dhcp4ConfigPrivate::dhcp4PropertiesChanged(const QVariantMap &properties) { Q_Q(Dhcp4Config); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/dhcp4config_p.h new/networkmanager-qt-5.27.0/src/dhcp4config_p.h --- old/networkmanager-qt-5.26.0/src/dhcp4config_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/dhcp4config_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -41,6 +41,7 @@ Q_DECLARE_PUBLIC(Dhcp4Config) Dhcp4Config *q_ptr; protected Q_SLOTS: + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void dhcp4PropertiesChanged(const QVariantMap &); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/dhcp6config.cpp new/networkmanager-qt-5.27.0/src/dhcp6config.cpp --- old/networkmanager-qt-5.26.0/src/dhcp6config.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/dhcp6config.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -43,8 +43,12 @@ { Q_D(Dhcp6Config); Q_UNUSED(owner); - +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->dhcp6Iface, &OrgFreedesktopNetworkManagerDHCP6ConfigInterface::PropertiesChanged, d, &Dhcp6ConfigPrivate::dhcp6PropertiesChanged); +#endif d->options = d->dhcp6Iface.options(); } @@ -75,6 +79,15 @@ return value; } +void NetworkManager::Dhcp6ConfigPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.DHCP6Config")) { + dhcp6PropertiesChanged(properties); + } +} + + void NetworkManager::Dhcp6ConfigPrivate::dhcp6PropertiesChanged(const QVariantMap &properties) { Q_Q(Dhcp6Config); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/dhcp6config_p.h new/networkmanager-qt-5.27.0/src/dhcp6config_p.h --- old/networkmanager-qt-5.26.0/src/dhcp6config_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/dhcp6config_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -41,6 +41,7 @@ Q_DECLARE_PUBLIC(Dhcp6Config) Dhcp6Config *q_ptr; protected Q_SLOTS: + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void dhcp6PropertiesChanged(const QVariantMap &); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/genericdevice.cpp new/networkmanager-qt-5.27.0/src/genericdevice.cpp --- old/networkmanager-qt-5.26.0/src/genericdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/genericdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -30,8 +30,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - hwAddress = iface.hwAddress(); - typeDescription = iface.typeDescription(); } NetworkManager::GenericDevicePrivate::~GenericDevicePrivate() @@ -42,7 +40,18 @@ : Device(*new NetworkManager::GenericDevicePrivate(path, this), parent) { Q_D(GenericDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceGenericInterface::PropertiesChanged, d, &GenericDevicePrivate::propertiesChanged); +#endif } NetworkManager::GenericDevice::~GenericDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/gredevice.cpp new/networkmanager-qt-5.27.0/src/gredevice.cpp --- old/networkmanager-qt-5.26.0/src/gredevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/gredevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -31,16 +31,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - inputFlags = iface.inputFlags(); - outputFlags = iface.outputFlags(); - inputKey = iface.inputKey(); - outputKey = iface.outputKey(); - localEnd = iface.local(); - remoteEnd = iface.remote(); - parent = iface.parent().path(); - pathMtuDiscovery = iface.pathMtuDiscovery(); - tos = iface.tos(); - ttl = iface.ttl(); } NetworkManager::GreDevicePrivate::~GreDevicePrivate() @@ -51,7 +41,18 @@ Device(*new GreDevicePrivate(path, this), parent) { Q_D(GreDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else QObject::connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceGreInterface::PropertiesChanged, d, &GreDevicePrivate::propertiesChanged); +#endif } NetworkManager::GreDevice::~GreDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/infinibanddevice.cpp new/networkmanager-qt-5.27.0/src/infinibanddevice.cpp --- old/networkmanager-qt-5.26.0/src/infinibanddevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/infinibanddevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -32,8 +32,6 @@ #endif , carrier(false) { - carrier = iface.carrier(); - hwAddress = iface.hwAddress(); } NetworkManager::InfinibandDevice::~InfinibandDevice() @@ -44,7 +42,18 @@ : Device(*new InfinibandDevicePrivate(path, this), parent) { Q_D(InfinibandDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceInfinibandInterface::PropertiesChanged, d, &InfinibandDevicePrivate::propertiesChanged); +#endif } NetworkManager::InfinibandDevicePrivate::~InfinibandDevicePrivate() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/macvlandevice.cpp new/networkmanager-qt-5.27.0/src/macvlandevice.cpp --- old/networkmanager-qt-5.26.0/src/macvlandevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/macvlandevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -30,9 +30,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - mode = iface.mode(); - noPromisc = iface.noPromisc(); - parent = iface.parent().path(); } NetworkManager::MacVlanDevicePrivate::~MacVlanDevicePrivate() @@ -43,7 +40,18 @@ Device(*new MacVlanDevicePrivate(path, this), parent) { Q_D(MacVlanDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceMacvlanInterface::PropertiesChanged, d, &MacVlanDevicePrivate::propertiesChanged); +#endif } NetworkManager::MacVlanDevice::~MacVlanDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/manager.cpp new/networkmanager-qt-5.27.0/src/manager.cpp --- old/networkmanager-qt-5.26.0/src/manager.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/manager.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -97,9 +97,13 @@ this, &NetworkManagerPrivate::onDeviceAdded); connect(&iface, &OrgFreedesktopNetworkManagerInterface::DeviceRemoved, this, &NetworkManagerPrivate::onDeviceRemoved); +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, NetworkManagerPrivate::DBUS_DAEMON_PATH, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), this, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&iface, &OrgFreedesktopNetworkManagerInterface::PropertiesChanged, this, &NetworkManagerPrivate::propertiesChanged); - +#endif connect(&watcher, &QDBusServiceWatcher::serviceRegistered, this, &NetworkManagerPrivate::daemonRegistered); connect(&watcher, &QDBusServiceWatcher::serviceUnregistered, @@ -157,18 +161,10 @@ ); // Get all Manager's properties async - QDBusMessage message = QDBusMessage::createMethodCall(DBUS_SERVICE, - DBUS_DAEMON_PATH, - FDO_DBUS_PROPERTIES, - QLatin1String("GetAll")); - message << iface.staticInterfaceName(); -#ifdef NMQT_STATIC - QDBusConnection::sessionBus().callWithCallback(message, -#else - QDBusConnection::systemBus().callWithCallback(message, -#endif - this, - SLOT(propertiesChanged(QVariantMap))); + QVariantMap initialProperties = retrieveInitialProperties(iface.staticInterfaceName(), DBUS_DAEMON_PATH); + if (!initialProperties.isEmpty()) { + propertiesChanged(initialProperties); + } QTimer::singleShot(0, [this] { qobject_cast<SettingsPrivate *>(settingsNotifier())->init(); }); @@ -240,6 +236,30 @@ return m_supportedInterfaceTypes; } +QVariantMap NetworkManager::NetworkManagerPrivate::retrieveInitialProperties(const QString &interfaceName, const QString &path) +{ + QDBusMessage message = QDBusMessage::createMethodCall(DBUS_SERVICE, + path, + FDO_DBUS_PROPERTIES, + QLatin1String("GetAll")); + message << interfaceName; +#ifdef NMQT_STATIC + QDBusMessage resultMessage = QDBusConnection::sessionBus().call(message); +#else + QDBusMessage resultMessage = QDBusConnection::systemBus().call(message); +#endif + if (resultMessage.type() == QDBusMessage::ReplyMessage) { + QVariantMap result; + QDBusArgument dbusArgument = resultMessage.arguments().at(0).value<QDBusArgument>(); + while (!dbusArgument.atEnd()) { + dbusArgument >> result; + } + return result; + } + + return QVariantMap(); +} + NetworkManager::Device::Ptr NetworkManager::NetworkManagerPrivate::findRegisteredNetworkInterface(const QString &uni) { NetworkManager::Device::Ptr networkInterface; @@ -682,6 +702,14 @@ } } +void NetworkManager::NetworkManagerPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager")) { + propertiesChanged(properties); + } +} + void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap &changedProperties) { // qCDebug(NMQT) << Q_FUNC_INFO << changedProperties; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/manager_p.h new/networkmanager-qt-5.27.0/src/manager_p.h --- old/networkmanager-qt-5.26.0/src/manager_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/manager_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -46,6 +46,9 @@ static const QString DBUS_SETTINGS_PATH; static const QString FDO_DBUS_PROPERTIES; + // Functions useful also for other classes + static QVariantMap retrieveInitialProperties(const QString &interfaceName, const QString &path); + NetworkManagerPrivate(); ~NetworkManagerPrivate(); QDBusServiceWatcher watcher; @@ -121,6 +124,7 @@ void init(); void onDeviceAdded(const QDBusObjectPath &state); void onDeviceRemoved(const QDBusObjectPath &state); + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void propertiesChanged(const QVariantMap &changedProperties); void daemonRegistered(); void daemonUnregistered(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/modemdevice.cpp new/networkmanager-qt-5.27.0/src/modemdevice.cpp --- old/networkmanager-qt-5.26.0/src/modemdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/modemdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -43,26 +43,35 @@ { } -void NetworkManager::ModemDevicePrivate::initModemProperties() -{ - modemCapabilities = convertModemCapabilities(modemIface.modemCapabilities()); - currentCapabilities = convertModemCapabilities(modemIface.currentCapabilities()); -} - NetworkManager::ModemDevice::ModemDevice(const QString &path, QObject *parent) : Device(*new ModemDevicePrivate(path, this), parent) { Q_D(ModemDevice); - d->initModemProperties(); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->modemIface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else QObject::connect(&d->modemIface, &OrgFreedesktopNetworkManagerDeviceModemInterface::PropertiesChanged, d, &ModemDevicePrivate::propertiesChanged); +#endif } NetworkManager::ModemDevice::ModemDevice(NetworkManager::ModemDevicePrivate &dd, QObject *parent) : Device(dd, parent) { Q_D(ModemDevice); - d->initModemProperties(); + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else QObject::connect(&d->modemIface, &OrgFreedesktopNetworkManagerDeviceModemInterface::PropertiesChanged, d, &ModemDevicePrivate::propertiesChanged); +#endif } NetworkManager::ModemDevice::~ModemDevice() @@ -93,6 +102,8 @@ if (property == QLatin1String("CurrentCapabilities")) { currentCapabilities = convertModemCapabilities(value.toUInt()); Q_EMIT q->currentCapabilitiesChanged(currentCapabilities); + } else if (property == QLatin1String("ModemCapabilities")) { + modemCapabilities = convertModemCapabilities(value.toUInt()); } else { DevicePrivate::propertyChanged(property, value); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/olpcmeshdevice.cpp new/networkmanager-qt-5.27.0/src/olpcmeshdevice.cpp --- old/networkmanager-qt-5.26.0/src/olpcmeshdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/olpcmeshdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -33,16 +33,24 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - hardwareAddress = iface.hwAddress(); - activeChannel = iface.activeChannel(); - companion = iface.companion().path(); } NetworkManager::OlpcMeshDevice::OlpcMeshDevice(const QString &path, QObject *parent) : Device(*new OlpcMeshDevicePrivate(path, this), parent) { Q_D(OlpcMeshDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else QObject::connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceOlpcMeshInterface::PropertiesChanged, d, &OlpcMeshDevicePrivate::propertiesChanged); +#endif } NetworkManager::OlpcMeshDevice::~OlpcMeshDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/settings.cpp new/networkmanager-qt-5.27.0/src/settings.cpp --- old/networkmanager-qt-5.26.0/src/settings.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/settings.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -42,8 +42,13 @@ #endif , m_canModify(true) { +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, NetworkManagerPrivate::DBUS_SETTINGS_PATH, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), this, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&iface, &OrgFreedesktopNetworkManagerSettingsInterface::PropertiesChanged, this, &SettingsPrivate::propertiesChanged); +#endif connect(&iface, &OrgFreedesktopNetworkManagerSettingsInterface::NewConnection, this, &SettingsPrivate::onConnectionAdded); connect(&iface, &OrgFreedesktopNetworkManagerSettingsInterface::ConnectionRemoved, @@ -70,19 +75,11 @@ } } - // Get all Setting's properties async - QDBusMessage message = QDBusMessage::createMethodCall(NetworkManagerPrivate::DBUS_SERVICE, - NetworkManagerPrivate::DBUS_SETTINGS_PATH, - NetworkManagerPrivate::FDO_DBUS_PROPERTIES, - QStringLiteral("GetAll")); - message << iface.staticInterfaceName(); -#ifdef NMQT_STATIC - QDBusConnection::sessionBus().callWithCallback(message, -#else - QDBusConnection::systemBus().callWithCallback(message, -#endif - this, - SLOT(propertiesChanged(QVariantMap))); + // Get all Setting's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(iface.staticInterfaceName(), NetworkManagerPrivate::DBUS_SETTINGS_PATH); + if (!initialProperties.isEmpty()) { + propertiesChanged(initialProperties); + } } NetworkManager::Connection::List NetworkManager::SettingsPrivate::listConnections() @@ -153,6 +150,14 @@ iface.SaveHostname(hostname); } +void NetworkManager::SettingsPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.Settings")) { + propertiesChanged(properties); + } +} + void NetworkManager::SettingsPrivate::propertiesChanged(const QVariantMap &properties) { QVariantMap::const_iterator it = properties.constBegin(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/settings_p.h new/networkmanager-qt-5.27.0/src/settings_p.h --- old/networkmanager-qt-5.26.0/src/settings_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/settings_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -58,6 +58,7 @@ void onConnectionAdded(const QDBusObjectPath &); void onConnectionRemoved(const QDBusObjectPath &); void onConnectionRemoved(const QString &); + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void propertiesChanged(const QVariantMap &properties); void initNotifier(); protected: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/teamdevice.cpp new/networkmanager-qt-5.27.0/src/teamdevice.cpp --- old/networkmanager-qt-5.26.0/src/teamdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/teamdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -32,11 +32,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - carrier = iface.carrier(); - hwAddress = iface.hwAddress(); - Q_FOREACH (const QDBusObjectPath & op, iface.slaves()) { - slaves << op.path(); - } } NetworkManager::TeamDevicePrivate::~TeamDevicePrivate() @@ -47,7 +42,18 @@ : Device(*new TeamDevicePrivate(path, this), parent) { Q_D(TeamDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceTeamInterface::PropertiesChanged, d, &TeamDevicePrivate::propertiesChanged); +#endif } NetworkManager::TeamDevice::~TeamDevice() @@ -91,7 +97,7 @@ Q_EMIT q->hwAddressChanged(hwAddress); } else if (property == QLatin1String("Slaves")) { QStringList list; - Q_FOREACH (const QDBusObjectPath & op, value.value<QList<QDBusObjectPath> >()) { + Q_FOREACH (const QDBusObjectPath & op, qdbus_cast< QList<QDBusObjectPath> >(value)) { list << op.path(); } slaves = list; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/tundevice.cpp new/networkmanager-qt-5.27.0/src/tundevice.cpp --- old/networkmanager-qt-5.26.0/src/tundevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/tundevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -30,12 +30,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - owner = iface.owner(); - group = iface.group(); - mode = iface.mode(); - multiQueue = iface.multiQueue(); - noPi = iface.noPi(); - vnetHdr = iface.vnetHdr(); } NetworkManager::TunDevicePrivate::~TunDevicePrivate() @@ -46,7 +40,18 @@ : Device(*new TunDevicePrivate(path, this), parent) { Q_D(TunDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceTunInterface::PropertiesChanged, d, &TunDevicePrivate::propertiesChanged); +#endif } NetworkManager::TunDevice::~TunDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/vethdevice.cpp new/networkmanager-qt-5.27.0/src/vethdevice.cpp --- old/networkmanager-qt-5.26.0/src/vethdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/vethdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -32,7 +32,6 @@ , iface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - peer = iface.peer().path(); } NetworkManager::VethDevicePrivate::~VethDevicePrivate() @@ -43,7 +42,18 @@ : Device(*new VethDevicePrivate(path, this), parent) { Q_D(VethDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceVethInterface::PropertiesChanged, d, &VethDevicePrivate::propertiesChanged); +#endif } NetworkManager::VethDevice::~VethDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/vlandevice.cpp new/networkmanager-qt-5.27.0/src/vlandevice.cpp --- old/networkmanager-qt-5.26.0/src/vlandevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/vlandevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -31,12 +31,6 @@ #endif , carrier(false) { - carrier = iface.carrier(); - hwAddress = iface.hwAddress(); - if (NetworkManager::checkVersion(1, 0, 0)) { - parent = iface.parent().path(); - } - vlanId = iface.vlanId(); } NetworkManager::VlanDevice::~VlanDevice() @@ -47,7 +41,18 @@ : Device(*new VlanDevicePrivate(path, this), parent) { Q_D(VlanDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerDeviceVlanInterface::PropertiesChanged, d, &VlanDevicePrivate::propertiesChanged); +#endif } NetworkManager::VlanDevicePrivate::~VlanDevicePrivate() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/vpnconnection.cpp new/networkmanager-qt-5.27.0/src/vpnconnection.cpp --- old/networkmanager-qt-5.26.0/src/vpnconnection.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/vpnconnection.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -36,8 +36,6 @@ #endif , q_ptr(q) { - banner = iface.banner(); - state = convertVpnConnectionState(iface.vpnState()); } NetworkManager::VpnConnection::State NetworkManager::VpnConnectionPrivate::convertVpnConnectionState(uint state) @@ -54,7 +52,29 @@ : ActiveConnection(*new VpnConnectionPrivate(path, this), parent) { Q_D(VpnConnection); + + // We need to get ActiveConnection's properties, because by default every ActiveConnection + // is basically a VpnConnection + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(OrgFreedesktopNetworkManagerConnectionActiveInterface::staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + + // Try to retrieve VPN specific properties if this is a VPN connection + if (vpn()) { + // Get all VpnConnection's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->iface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->path, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->iface, &OrgFreedesktopNetworkManagerVPNConnectionInterface::PropertiesChanged, d, &VpnConnectionPrivate::propertiesChanged); +#endif connect(&d->iface, &OrgFreedesktopNetworkManagerVPNConnectionInterface::VpnStateChanged, d, &VpnConnectionPrivate::vpnStateChanged); } @@ -75,25 +95,31 @@ return d->state; } -void NetworkManager::VpnConnectionPrivate::propertiesChanged(const QVariantMap &properties) +void NetworkManager::VpnConnectionPrivate::dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties) +{ + Q_UNUSED(invalidatedProperties); + + if (interfaceName == QLatin1String("org.freedesktop.NetworkManager.VPN.Connection")) { + propertiesChanged(properties); + } else { + ActiveConnectionPrivate::propertiesChanged(properties); + } +} + +void NetworkManager::VpnConnectionPrivate::propertyChanged(const QString &property, const QVariant &value) { Q_Q(VpnConnection); - QVariantMap::const_iterator it = properties.constBegin(); - while (it != properties.constEnd()) { - const QString property = it.key(); - if (property == QLatin1String("Banner")) { - banner = it->toString(); - Q_EMIT q->bannerChanged(banner); - } else if (property == QLatin1String("VpnState")) { - state = NetworkManager::VpnConnectionPrivate::convertVpnConnectionState(it->toUInt()); - NetworkManager::VpnConnection::StateChangeReason reason = NetworkManager::VpnConnectionPrivate::convertVpnConnectionStateReason(properties.key("Reason").toUInt()); - // Do not notify about changed VpnState twice, because there is also signal VpnStateChanged() from NetworkManager - // Q_EMIT stateChanged(d->state, reason); - } else { - qCWarning(NMQT) << Q_FUNC_INFO << "Unhandled property" << property; - } - ++it; + if (property == QLatin1String("Banner")) { + banner = value.toString(); + Q_EMIT q->bannerChanged(banner); + } else if (property == QLatin1String("VpnState")) { + //Do not notify about changed VpnState twice, because there is also signal VpnStateChanged() from NetworkManager + state = NetworkManager::VpnConnectionPrivate::convertVpnConnectionState(value.toUInt()); + //NetworkManager::VpnConnection::StateChangeReason reason = NetworkManager::VpnConnectionPrivate::convertVpnConnectionStateReason(properties.key("Reason").toUInt()); + //Q_EMIT stateChanged(d->state, reason); + } else { + ActiveConnectionPrivate::propertyChanged(property, value); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/vpnconnection_p.h new/networkmanager-qt-5.27.0/src/vpnconnection_p.h --- old/networkmanager-qt-5.26.0/src/vpnconnection_p.h 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/vpnconnection_p.h 2016-10-02 10:17:05.000000000 +0200 @@ -46,8 +46,16 @@ Q_DECLARE_PUBLIC(VpnConnection) VpnConnection *q_ptr; + +protected: + /** + * When subclassing make sure to call the parent class method + * if the property was not useful to your new class + */ + virtual void propertyChanged(const QString &property, const QVariant &value) Q_DECL_OVERRIDE; + private Q_SLOTS: - void propertiesChanged(const QVariantMap &properties); + void dbusPropertiesChanged(const QString &interfaceName, const QVariantMap &properties, const QStringList &invalidatedProperties); void vpnStateChanged(uint new_state, uint reason); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/wimaxdevice.cpp new/networkmanager-qt-5.27.0/src/wimaxdevice.cpp --- old/networkmanager-qt-5.26.0/src/wimaxdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/wimaxdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -34,14 +34,6 @@ , wimaxIface(NetworkManagerPrivate::DBUS_SERVICE, path, QDBusConnection::systemBus()) #endif { - hardwareAddress = wimaxIface.hwAddress(); - centerFrequency = wimaxIface.centerFrequency(); - activeNsp = wimaxIface.activeNsp().path(); - bsid = wimaxIface.bsid(); - cinr = wimaxIface.cinr(); - rssi = wimaxIface.rssi(); - txPower = wimaxIface.txPower(); - qDBusRegisterMetaType<QList<QDBusObjectPath> >(); QList <QDBusObjectPath> nsps = wimaxIface.nsps(); Q_FOREACH (const QDBusObjectPath & op, nsps) { @@ -54,7 +46,18 @@ : Device(*new WimaxDevicePrivate(path, this), parent) { Q_D(WimaxDevice); + + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->wimaxIface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->wimaxIface, &OrgFreedesktopNetworkManagerDeviceWiMaxInterface::PropertiesChanged, d, &WimaxDevicePrivate::propertiesChanged); +#endif connect(&d->wimaxIface, &OrgFreedesktopNetworkManagerDeviceWiMaxInterface::NspAdded, d, &WimaxDevicePrivate::nspAdded); connect(&d->wimaxIface, &OrgFreedesktopNetworkManagerDeviceWiMaxInterface::NspRemoved, d, &WimaxDevicePrivate::nspRemoved); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/wireddevice.cpp new/networkmanager-qt-5.27.0/src/wireddevice.cpp --- old/networkmanager-qt-5.26.0/src/wireddevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/wireddevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -36,10 +36,6 @@ , bitrate(0) , carrier(false) { - hardwareAddress = wiredIface.hwAddress(); - permanentHardwareAddress = wiredIface.permHwAddress(); - bitrate = wiredIface.speed() * 1000; - carrier = wiredIface.carrier(); } NetworkManager::WiredDevicePrivate::~WiredDevicePrivate() @@ -50,7 +46,19 @@ : Device(*new NetworkManager::WiredDevicePrivate(path, this), parent) { Q_D(WiredDevice); + + // Get all WiredDevices's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->wiredIface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->wiredIface, &OrgFreedesktopNetworkManagerDeviceWiredInterface::PropertiesChanged, d, &WiredDevicePrivate::propertiesChanged); +#endif } NetworkManager::WiredDevice::~WiredDevice() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/networkmanager-qt-5.26.0/src/wirelessdevice.cpp new/networkmanager-qt-5.27.0/src/wirelessdevice.cpp --- old/networkmanager-qt-5.26.0/src/wirelessdevice.cpp 2016-09-06 00:45:49.000000000 +0200 +++ new/networkmanager-qt-5.27.0/src/wirelessdevice.cpp 2016-10-02 10:17:05.000000000 +0200 @@ -51,12 +51,6 @@ { Q_D(WirelessDevice); - d->hardwareAddress = d->wirelessIface.hwAddress(); - d->permanentHardwareAddress = d->wirelessIface.permHwAddress(); - d->mode = convertOperationMode(d->wirelessIface.mode()); - d->bitRate = d->wirelessIface.bitrate(); - d->wirelessCapabilities = convertCapabilities(d->wirelessIface.wirelessCapabilities()); - qDBusRegisterMetaType<QList<QDBusObjectPath> >(); QList <QDBusObjectPath> aps = d->wirelessIface.accessPoints(); @@ -66,11 +60,20 @@ d->accessPointAdded(op); } + // Get all WirelessDevices's properties at once + QVariantMap initialProperties = NetworkManagerPrivate::retrieveInitialProperties(d->wirelessIface.staticInterfaceName(), path); + if (!initialProperties.isEmpty()) { + d->propertiesChanged(initialProperties); + } + +#if NM_CHECK_VERSION(1, 4, 0) + QDBusConnection::systemBus().connect(NetworkManagerPrivate::DBUS_SERVICE, d->uni, NetworkManagerPrivate::FDO_DBUS_PROPERTIES, + QLatin1String("PropertiesChanged"), d, SLOT(dbusPropertiesChanged(QString,QVariantMap,QStringList))); +#else connect(&d->wirelessIface, &OrgFreedesktopNetworkManagerDeviceWirelessInterface::PropertiesChanged, d, &WirelessDevicePrivate::propertiesChanged); +#endif connect(&d->wirelessIface, &OrgFreedesktopNetworkManagerDeviceWirelessInterface::AccessPointAdded, d, &WirelessDevicePrivate::accessPointAdded); connect(&d->wirelessIface, &OrgFreedesktopNetworkManagerDeviceWirelessInterface::AccessPointRemoved, d, &WirelessDevicePrivate::accessPointRemoved); - - d->activeAccessPoint = findAccessPoint(d->wirelessIface.activeAccessPoint().path()); } NetworkManager::WirelessDevice::~WirelessDevice()
participants (1)
-
root@hilbert.suse.de