Bug 256155 - KWallet's readMap is not friendly to non-C++ applications
Summary: KWallet's readMap is not friendly to non-C++ applications
Status: REOPENED
Alias: None
Product: frameworks-kwallet
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.115.0
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Valentin Rusu
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 16:18 UTC by Darin McBride
Modified: 2024-09-14 16:24 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin McBride 2010-11-05 16:18:58 UTC
Version:           4.5 (using Devel) 
OS:                Linux

When I connect to KWallet from Perl using DBus (Net::DBus), and call KWallet's readMap function, I get back a bunch of binary data.  From perusing kwalleteditor.h, it appears that this data is simply a binary dump of a QMap<QString,QString> object.  This apparently works in C++, but does not do any good in other languages.

Please add an API that would make this accessible in other languages.  One possibility would be a readMapKeys which would return all the keys in the given map, and a readMapData which would take all the same input as readMap plus a key name, and return just the data for that key.  Another possibility would be a readMapAsXML which would simply transform the entire map into XML and return that.  Most languages would be able to handle that (though that might be more painful in C).

Also, trying to find documentation on the kwallet DBus API was very difficult.  I couldn't actually find any.

Reproducible: Always
Comment 1 Christoph Feck 2010-11-05 16:23:33 UTC
Isn't it the responsibility of your "bindings" to convert the data?
Comment 2 Darin McBride 2010-11-05 17:03:53 UTC
Even qdbusviewer is not able to convert the data because it is being returned as an array of bytes.  Checking the introspection in qdbusviewer, I get (part of the result):

<method name="readMap"> <arg direction="out" type="ay"/>

Looking in dbus-protocol.h, I see "a" is for array, and "y" is for "byte".  It's not returning a "QMap<QString,QString>", thus the general DBus binding cannot know how to convert the data back into normal data structures.

Looking at dbus-protocol.h a bit further, I see a "dict" type - perhaps that's closer to the meaning of KWallet's map, and maybe that should be the return of readMap over DBus, instead of new APIs?  (Though I don't know if the Perl bindings support dict yet.)
Comment 3 Darin McBride 2010-11-07 05:45:42 UTC
Just to add to this, I noticed that there is a dict type used for readMapList, which, again, has an odd return type: instead of being a dict of a dict, it, again, just seems to store the QMap<QString,QString> object as a QByteArray, which means again that I would need a binding that was particular to KWallet instead of generic to DBus in order to handle this.

Basically, the output in qdbusviewer also does not show the actual mapping, it merely shows the numeric representation of each byte (e.g., "{0, 0, 0, 3, 0, 0, 0, 8, ...").
Comment 4 Constantin Berzan 2010-12-11 03:03:42 UTC
Yep, it would be really nice if readMap would return a DBus dict rather than a binary array.
Comment 5 Christoph Cullmann 2024-09-14 16:17:50 UTC
Hi,

kdelibs (version 4 and earlier) is no longer maintained since a few years.

KDE Frameworks 5 or 6 might already have implemented this wish.

If not, please re-open against the matching framework if feasible or against the application that shows the issue.

We then can still dispatch it to the right Bugzilla product or component.

Greetings
Christoph Cullmann
Comment 6 Joachim Mairböck 2024-09-14 16:24:59 UTC
This is still the case for Frameworks 5.115.0. I don't have KF6 installed at the moment.