summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusmessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusmessage.cpp')
-rw-r--r--src/dbus/qdbusmessage.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 83b5503..30ddc61 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), autoStartService(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->autoStartService );
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
@@ -644,6 +645,45 @@ bool QDBusMessage::isDelayedReply() const
}
/*!
+ Sets the auto start flag to \a enable. This flag only makes sense
+ for method call messages, where it tells the D-Bus server to
+ either auto start the service responsible for the service name, or
+ not to auto start it.
+
+ By default this flag is true, i.e. a service is autostarted.
+ This means:
+
+ When the service that this method call is sent to is already
+ running, the method call is sent to it. If the service is not
+ running yet, the D-Bus daemon is requested to autostart the
+ service that is assigned to this service name. This is
+ handled by .service files that are placed in a directory known
+ to the D-Bus server. These files then each contain a service
+ name and the path to a program that should be executed when
+ this service name is requested.
+
+ \since 4.7
+*/
+void QDBusMessage::setAutoStartService(bool enable)
+{
+ d_ptr->autoStartService = enable;
+}
+
+/*!
+ Returns the auto start flag, as set by setAutoStartService(). By default, this
+ flag is true, which means QtDBus will auto start a service, if it is
+ not running already.
+
+ \sa setAutoStartService()
+
+ \since 4.7
+*/
+bool QDBusMessage::autoStartService() const
+{
+ return d_ptr->autoStartService;
+}
+
+/*!
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.