diff options
author | Holger Schroeder <holger.schroeder.ext@basyskom.de> | 2010-02-12 13:26:06 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-12 13:26:06 (GMT) |
commit | c6fa4e8647dd16c6b864fce5047aadaee005b0f9 (patch) | |
tree | b105ef2f4f01f763dddf4cdbb76d81e9e88a9d4f /src/dbus/qdbusmessage.cpp | |
parent | d1cb6591ed94d3999a7c0d2d36e478ffc44350c6 (diff) | |
download | Qt-c6fa4e8647dd16c6b864fce5047aadaee005b0f9.zip Qt-c6fa4e8647dd16c6b864fce5047aadaee005b0f9.tar.gz Qt-c6fa4e8647dd16c6b864fce5047aadaee005b0f9.tar.bz2 |
Changes: add functionality for dbus auto start to qt
RevBy: TrustMe
Details: This is the first part of an implementation
that introduces handling of the dbus autoStart flag
into qt. This flag determines in the used dbus implementation,
if the receiver of a method call will be started if
it is not running yet, or if it will not be started.
The part from dbus up to QDBusMessage should be fine,
but i do not know how to set this flag from the higher
layers. Ideally this would be generated from qdbusxml2cpp.
Merge-request: 2307
Reviewed-by: Thiago Macieira <thiago.macieira@nokia.com>
Diffstat (limited to 'src/dbus/qdbusmessage.cpp')
-rw-r--r-- | src/dbus/qdbusmessage.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
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. |