[Kde-bindings] KDE/kdebindings/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Tue Oct 3 10:23:28 UTC 2006
SVN commit 591847 by rdale:
* Added ruby implementations of Qt::DBusConnectionInterface.serviceOwner(),
registeredServiceNames(), isServiceRegistered(), servicePid(), serviceUid()
and startService()
* Added a Qt::DBusMessage.value() method to return the Ruby value of the Qt::Variant
at the beginning of the arguments array, or nil if the message wasn't a ReplyMessage.
* Fixed incorrect Qt::Variant.toUInt() method name
CCMAIL: kde-bindings at kde.org
M +11 -0 ChangeLog
M +38 -5 rubylib/qtruby/lib/Qt/qtruby4.rb
--- trunk/KDE/kdebindings/qtruby/ChangeLog #591846:591847
@@ -1,3 +1,14 @@
+2006-10-03 Richard Dale <rdale at foton.es>
+
+ * Added ruby implementations of Qt::DBusConnectionInterface.serviceOwner(),
+ registeredServiceNames(), isServiceRegistered(), servicePid(), serviceUid()
+ and startService()
+
+ * Added a Qt::DBusMessage.value() method to return the Ruby value of the Qt::Variant
+ at the beginning of the arguments array, or nil if the message wasn't a ReplyMessage.
+
+ * Fixed incorrect Qt::Variant.toUInt() method name
+
2006-10-02 Richard Dale <rdale at foton.es>
* qVariantFromValue() wasn't working with non-Qt classes as arguments,
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/lib/Qt/qtruby4.rb #591846:591847
@@ -398,6 +398,32 @@
end
end
+ class DBusConnectionInterface < Qt::Base
+ def serviceOwner(name)
+ return internalConstCall(Qt::DBus::AutoDetect, "GetNameOwner", [Qt::Variant.new(name)]).value
+ end
+
+ def registeredServiceNames
+ return internalConstCall(Qt::DBus::AutoDetect, "ListNames").value
+ end
+
+ def isServiceRegistered(serviceName)
+ return internalConstCall(Qt::DBus::AutoDetect, "NameHasOwner", [Qt::Variant.new(serviceName)]).value
+ end
+
+ def servicePid(serviceName)
+ return internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixProcessID", [Qt::Variant.new(serviceName)]).value
+ end
+
+ def serviceUid(serviceName)
+ return internalConstCall(Qt::DBus::AutoDetect, "GetConnectionUnixUser", [Qt::Variant.new(serviceName)]).value
+ end
+
+ def startService(name)
+ return call("StartServiceByName", Qt::Variant.new(name), Qt::Variant.new(0)).value
+ end
+ end
+
class DBusInterface < Qt::Base
def method_missing(id, *args)
begin
@@ -406,14 +432,12 @@
super(id, *args)
rescue
if args.length == 0
- qdbusMessage = call(id.to_s)
+ return call(id.to_s).value
else
# create an Array 'dbusArgs' of Qt::Variants from '*args'
qdbusArgs = args.collect {|arg| qVariantFromValue(arg)}
- qdbusMessage = call(id.to_s, *dbusArgs)
+ return qdbusMessage = call(id.to_s, *dbusArgs).value
end
- reply = qdbusMessage.arguments
- return reply.length > 0 ? reply[0].to_ruby : nil
end
end
end
@@ -422,6 +446,15 @@
def type(*args)
method_missing(:type, *args)
end
+
+ def value
+ if type() == Qt::DBusMessage::ReplyMessage
+ reply = arguments()
+ return reply.length > 0 ? reply[0].to_ruby : nil
+ else
+ return nil
+ end
+ end
end
class Dialog < Qt::Base
@@ -1423,7 +1456,7 @@
when Qt::Variant::Time
return toTime
when Qt::Variant::UInt
- return toUint
+ return toUInt
when Qt::Variant::ULongLong
return toULongLong
when Qt::Variant::Url
More information about the Kde-bindings
mailing list