diff options
-rw-r--r-- | src/dbus/qdbus_symbols_p.h | 5 | ||||
-rw-r--r-- | src/dbus/qdbusmessage.cpp | 27 | ||||
-rw-r--r-- | src/dbus/qdbusmessage.h | 3 | ||||
-rw-r--r-- | src/dbus/qdbusmessage_p.h | 2 |
4 files changed, 36 insertions, 1 deletions
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index 9ea05b2..7168e05 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -196,6 +196,8 @@ DEFINEFUNC(void , dbus_free, (void *memory), (memory), ) /* dbus-message.h */ DEFINEFUNC(DBusMessage* , dbus_message_copy, (const DBusMessage *message), (message), return) +DEFINEFUNC(dbus_bool_t , dbus_message_get_auto_start, (DBusMessage *message), + (message), return) DEFINEFUNC(const char* , dbus_message_get_error_name, (DBusMessage *message), (message), return) DEFINEFUNC(const char* , dbus_message_get_interface, (DBusMessage *message), @@ -268,6 +270,9 @@ DEFINEFUNC(DBusMessage* , dbus_message_new_signal, (const char *path, (path, interface, name), return) DEFINEFUNC(DBusMessage* , dbus_message_ref, (DBusMessage *message), (message), return) +DEFINEFUNC(void , dbus_message_set_auto_start, (DBusMessage *message, + dbus_bool_t auto_start), + (message, auto_start), return) DEFINEFUNC(dbus_bool_t , dbus_message_set_destination, (DBusMessage *message, const char *destination), (message, destination), return) diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp index 83b5503..f9be783 100644 --- a/src/dbus/qdbusmessage.cpp +++ b/src/dbus/qdbusmessage.cpp @@ -63,7 +63,7 @@ static inline const char *data(const QByteArray &arr) QDBusMessagePrivate::QDBusMessagePrivate() : msg(0), reply(0), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false), - parametersValidated(false) + parametersValidated(false), autoStart(true) { } @@ -129,6 +129,7 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message, QDB msg = q_dbus_message_new_method_call(data(d_ptr->service.toUtf8()), d_ptr->path.toUtf8(), data(d_ptr->interface.toUtf8()), d_ptr->name.toUtf8()); + q_dbus_message_set_auto_start( msg, d_ptr->autoStart ); break; case DBUS_MESSAGE_TYPE_METHOD_RETURN: msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN); @@ -644,6 +645,30 @@ bool QDBusMessage::isDelayedReply() const } /*! + Sets whether this message will have the auto start flag. + This flag only makes sense for method call messages. For + these messages it tells the dbus server to either auto + start the service responsible for the service name, or + not to auto start it. + + This flag is true by default. +*/ +void QDBusMessage::setAutoStart(bool enable) const +{ + d_ptr->autoStart = enable; +} + +/*! + Returns the auto start flag, as set by setAutoStart(). By default, this + flag is true, which means QtDBus will auto start a service, if it is + not running already. +*/ +bool QDBusMessage::isAutoStart() const +{ + return d_ptr->autoStart; +} + +/*! Sets the arguments that are going to be sent over D-Bus to \a arguments. Those will be the arguments to a method call or the parameters in the signal. diff --git a/src/dbus/qdbusmessage.h b/src/dbus/qdbusmessage.h index 1a85983..8106238 100644 --- a/src/dbus/qdbusmessage.h +++ b/src/dbus/qdbusmessage.h @@ -104,6 +104,9 @@ public: void setDelayedReply(bool enable) const; bool isDelayedReply() const; + void setAutoStart(bool enable) const; + bool isAutoStart() const; + void setArguments(const QList<QVariant> &arguments); QList<QVariant> arguments() const; diff --git a/src/dbus/qdbusmessage_p.h b/src/dbus/qdbusmessage_p.h index 6bf5448..eb27562 100644 --- a/src/dbus/qdbusmessage_p.h +++ b/src/dbus/qdbusmessage_p.h @@ -86,6 +86,8 @@ public: uint localMessage : 1; mutable uint parametersValidated : 1; + mutable uint autoStart : 1; + static void setParametersValidated(QDBusMessage &msg, bool enable) { msg.d_ptr->parametersValidated = enable; } |