Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
libqt4
qdbusviewer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File qdbusviewer.patch of Package libqt4
From 560242131f9b5795cb7a3347b1b5a6a973f54e4a Mon Sep 17 00:00:00 2001 From: Dirk Mueller <mueller@kde.org> Date: Fri, 4 Jan 2013 13:45:24 +0100 Subject: [PATCH] Try harder in matching the method signature In cases where the Propertiesdialog has no specific Implementation for a dbus data type, it creates a regular QLineEdit. In such cases, qdbusviewer then tried to call the method with the arg set to a string instead of the real datatype (for example uint64), which usually does not work. We can be more clever and try to implicitely convert the user input to the right datatype, which makes the invocation succeed. --- tools/qdbus/qdbusviewer/qdbusviewer.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) --- tools/qdbus/qdbusviewer/qdbusviewer.cpp +++ tools/qdbus/qdbusviewer/qdbusviewer.cpp @@ -259,7 +259,8 @@ void QDBusViewer::callMethod(const BusSignature &sig) const QList<QByteArray> paramTypes = method.parameterTypes(); const QList<QByteArray> paramNames = method.parameterNames(); - QList<int> types; // remember the low-level D-Bus type + QList<int> types; // remember the low-level D-Bus type + QList<QVariant::Type> qvtypes; // remember the QVariant Type for (int i = 0; i < paramTypes.count(); ++i) { const QByteArray paramType = paramTypes.at(i); if (paramType.endsWith('&')) @@ -268,6 +269,7 @@ void QDBusViewer::callMethod(const BusSignature &sig) QVariant::Type type = QVariant::nameToType(paramType); dialog.addProperty(QString::fromLatin1(paramNames.value(i)), type); types.append(QMetaType::type(paramType)); + qvtypes.append(type); } if (!types.isEmpty()) { @@ -279,9 +281,16 @@ void QDBusViewer::callMethod(const BusSignature &sig) args = dialog.values(); } - // Special case - convert a value to a QDBusVariant if the - // interface wants a variant + // Try to convert the values we got as good as possible to the + // dbus signature. this is especially important for those inputted as strings for (int i = 0; i < args.count(); ++i) { + QVariant a = args.at(i); + if (qvtypes.at(i) != a.type() + && a.canConvert(qvtypes.at(i))) { + args[i].convert(qvtypes.at(i)); + } + // Special case - convert a value to a QDBusVariant if the + // interface wants a variant if (types.at(i) == qMetaTypeId<QDBusVariant>()) args[i] = QVariant::fromValue(QDBusVariant(args.at(i))); } -- 1.8.0.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor