[Kde-bindings] Ruby: various DBus int variants

Yaohan Chen yaohan.chen at gmail.com
Sun Aug 29 07:07:33 UTC 2010


I am having trouble passing a number as "qlonglong" to a DBus method.
The method is KDE cookie jar's addCookies, and qdbus prints its
signature as

  method void org.kde.KCookieServer.addCookies(QString url, QByteArray
cookieHeader, qlonglong windowId)

If I just pass the windowId directly, I get "No such method
'addCookies' in interface 'org.kde.KCookieServer' at object path
'/modules/kcookiejar' (signature 'sayi')"

If I use Qt::Variant.from_value(WINDOW_ID, 'long long int') or 'long
long', 'qlonglong', I get:

  QDBusMarshaller: type `UserType' (127) is not registered with D-BUS. Use
  qDBusRegisterMetaType to register it
  QDBusConnection: error: could not send message to service "org.kde.kded" path
  "/modules/kcookiejar" interface "org.kde.KCookieServer" member "addCookies":
  Marshalling failed: Unregistered type UserType passed in arguments

The full code is at
http://github.com/hagabaka/absorb/blob/master/data/absorb/cookie.rb .
The "findDOMCookies" method works and it uses QString and QByteArray,
so I think the problem is with qlonglong.

I also get a crash with Qt::Variant.from_value(number, 'unsigned int')
and I think any other unsigned type.

I'm using Kubuntu with libqt4-ruby1.8 4:4.5.0b-0ubuntu2~lucid1.

> On Tuesday 03 August 2010 14:53:41 Richard Dale wrote:
> > On Tuesday, August 03, 2010 01:41:02 pm Arno Rehn wrote:
> > > On Sunday 01 August 2010 21:23:20 Sylvain Sauvage wrote:
> > > > Hi all,
> > > >
> > > > DBus integers can be 16, 32, or 64 bits, signed or unsigned, but
> > > > I can’t find a way to make a matching Qt::Variant in Ruby (for
> > > > DBus arguments are Qt::Variants).
> > > >
> > > > In the 2006-12-04 entry of qtruby Changelog, it reads:
> > > >   1095  * Add an option extra argument to Qt::Variant.fromValue() and
> > > >   1096  qVariantFromValue
> > > >   1097            to specify a type string, for use with QtDBus args.
> > > >   For
> > > >
> > > > example: 1098
> > > >
> > > >   1099                  v = Qt::Variant.fromValue(5, "uint")
> > > >   1100
> > > >   1101            Will force the Qt::Variant to be a specific type
> > > >
> > > > (line numbers from June 22th’s version (websvn)).
> > > >
> > > > But it doesn’t work anymore:
> > > > Qt::Variant.fromValue( 0, 'uint' )
> > > > => #<Qt::Variant:0x7f3a5b86bdb0 typeName=int>
> > > >
> > > > Is there a new way?
> > >
> > > The type name has changed to 'unsigned int' - however it then crashes.
> > > Have to investigate that.
> >
> > It should be the same as whatever QVariant::typeName() returns for the type
> > which I expect is still "uint". But ideally it shouldn't crash.
> It looks for the method signature as it is in Smoke, and Smoke only knows
> about 'unsigned int' (or 'long long' instead of 'qlonglong' for that matter).

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list