From 602809693a5b9a20c83a5726cee0a6426bc2a6f3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 20 Feb 2006 13:23:11 +0000 Subject: 2006-02-20 Thiago Macieira * qt/qdbusinterface_p.h: * qt/qdbusinterface.cpp: Use the standard org.freedesktop.DBus.Method.NoReply annotation for the "async" calls instead of creating one for us. * qt/qdbusconnection_p.h: * qt/qdbusintegrator.cpp: Remove debugging code. * qt/qdbusintegrator.cpp: * qt/qdbusmessage.cpp: * qt/qdbusmessage_p.h: * qt/qdbusmessage.h: Change the behaviour of automatic reply-sending: now a reply is always sent, unless the caller didn't request one or if the user slot has already sent one. --- qt/qdbusmessage.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'qt/qdbusmessage.cpp') diff --git a/qt/qdbusmessage.cpp b/qt/qdbusmessage.cpp index 5c604c13..b88d7e39 100644 --- a/qt/qdbusmessage.cpp +++ b/qt/qdbusmessage.cpp @@ -34,7 +34,8 @@ #include "qdbusmessage_p.h" QDBusMessagePrivate::QDBusMessagePrivate(QDBusMessage *qq) - : msg(0), reply(0), q(qq), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), ref(1) + : msg(0), reply(0), q(qq), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), ref(1), + repliedTo(false) { } @@ -143,6 +144,7 @@ QDBusMessage QDBusMessage::methodReply(const QDBusMessage &other) QDBusMessage message; message.d->type = DBUS_MESSAGE_TYPE_METHOD_RETURN; message.d->reply = dbus_message_ref(other.d->msg); + other.d->repliedTo = true; return message; } @@ -166,6 +168,7 @@ QDBusMessage QDBusMessage::error(const QDBusMessage &other, const QString &name, message.d->name = name; message.d->message = msg; message.d->reply = dbus_message_ref(other.d->msg); + other.d->repliedTo = true; return message; } @@ -187,6 +190,7 @@ QDBusMessage QDBusMessage::error(const QDBusMessage &other, const QDBusError &er message.d->name = error.name(); message.d->message = error.message(); message.d->reply = dbus_message_ref(other.d->msg); + other.d->repliedTo = true; return message; } @@ -370,6 +374,30 @@ void QDBusMessage::setTimeout(int ms) d->timeout = ms; } +/*! + Returns the flag that indicates if this message should see a reply or not. This is only + meaningful for MethodCall messages: any other kind of message cannot have replies and this + function will always return false for them. +*/ +bool QDBusMessage::noReply() const +{ + if (!d->msg) + return false; + return dbus_message_get_no_reply(d->msg); +} + +/*! + Sets the flag that indicates whether we're expecting a reply from the callee. This flag only + makes sense for MethodCall messages. + + \param enable whether to enable the flag (i.e., we are not expecting a reply) +*/ +void QDBusMessage::setNoReply(bool enable) +{ + if (d->msg) + dbus_message_set_no_reply(d->msg, enable); +} + /*! Returns the unique serial number assigned to this message or 0 if the message was not sent yet. @@ -396,6 +424,15 @@ int QDBusMessage::replySerialNumber() const return dbus_message_get_reply_serial(d->msg); } +/*! + Returns true if this is a MethodCall message and a reply for it has been generated using + QDBusMessage::methodReply or QDBusMessage::error. +*/ +bool QDBusMessage::wasRepliedTo() const +{ + return d->repliedTo; +} + /*! Returns the signature of the signal that was received or for the output arguments of a method call. -- cgit