[Kde-bindings] Ruby: various DBus int variants

Yaohan Chen yaohan.chen at gmail.com
Sun Aug 29 15:25:36 UTC 2010


Here is a script to test the addCookies method with kcookiejar. For me
it outputs "No such method..." when passing as Fixnum, and "...type
`UserType' (127) is not registered with DBus..." with the other types
it tries.


require 'Qt'

DBUS = Qt::DBusInterface.new 'org.kde.kded', '/modules/kcookiejar',
                             'org.kde.KCookieServer'
def try_dbus_call(method, *arguments)
  reply = Qt::DBusReply.new DBUS.call(method, *arguments)
  unless reply.valid?
    $stderr.puts reply.error.message
  end
  reply.value
end

puts 'Fixnum: '
try_dbus_call 'addCookies', 'http://www.testingwebsite.com',
              Qt::ByteArray.new(''),
              0
puts ''

['long long', 'long long int', 'qlonglong', 'int64'].each do |typename|
  puts "#{typename}: "
  try_dbus_call 'addCookies', 'http://www.testingwebsite.com',
                 Qt::ByteArray.new(''),
                 Qt::Variant.from_value(0, 'long long int')
  puts ''
end


On 8/29/10, Arno Rehn <arno at arnorehn.de> wrote:
> On Sunday 29 August 2010 09:07:33 Yaohan Chen wrote:
>> 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.
> Could you provide a test case which exhibits this behaviour? That would make
> fixing the bug much easier.
>
> --
> Arno Rehn
> arno at arnorehn.de
> _______________________________________________
> Kde-bindings mailing list
> Kde-bindings at kde.org
> https://mail.kde.org/mailman/listinfo/kde-bindings
>



More information about the Kde-bindings mailing list