Skip to content

Commit

Permalink
[libconnman-qt] Use SetProperty for multiple properties. JB#46120
Browse files Browse the repository at this point in the history
ConnMan upstream requested to have all property setting functionality
behind SetProperty, and to drop SetProperties from the proposed patch.
This change accomodates that change.

SetProperty can accept DBUS_TYPE_ARRAY as variant. If the name is other
than "UserRoutes" it will be parsed as an array of dict, as it would
have been done with the removed SetProperties D-Bus method. The
QVariantMap is wrapped inside a QVariant, and the string for message is
set as "properties" to have the same value as in ConnMan vpn-provider.c
D-Bus method registration, to accommodate also the potential future use
of having requirement for the dict to be named as "properties".
  • Loading branch information
LaakkonenJussi committed Dec 30, 2019
1 parent 183f4e6 commit 0cc007a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 0 additions & 4 deletions libconnman-qt/connman_vpn_connection.xml
Expand Up @@ -6,10 +6,6 @@
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<method name="SetProperties">
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
<arg name="properties" type="a{sv}" direction="in"/>
</method>
<method name="SetProperty">
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
Expand Down
4 changes: 3 additions & 1 deletion libconnman-qt/vpnconnection.cpp
Expand Up @@ -155,7 +155,9 @@ void VpnConnection::modifyConnection(const QVariantMap &properties)
updatedProperties.remove(QString("immutable"));
updatedProperties.remove(QString("storeCredentials"));

d->m_connectionProxy.SetProperties(MarshalUtils::propertiesToDBus(updatedProperties));
// SetProperty supports a single property or an array of properties
d->m_connectionProxy.SetProperty(QString("Properties"),
QDBusVariant(MarshalUtils::propertiesToDBus(updatedProperties)));
}

void VpnConnection::activate()
Expand Down

0 comments on commit 0cc007a

Please sign in to comment.