summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
authorHolger Schroeder <holger.schroeder.ext@basyskom.de>2010-02-12 13:26:06 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-02-12 13:26:06 (GMT)
commitc6fa4e8647dd16c6b864fce5047aadaee005b0f9 (patch)
treeb105ef2f4f01f763dddf4cdbb76d81e9e88a9d4f /src/dbus
parentd1cb6591ed94d3999a7c0d2d36e478ffc44350c6 (diff)
downloadQt-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')
-rw-r--r--src/dbus/qdbus_symbols_p.h5
-rw-r--r--src/dbus/qdbusmessage.cpp27
-rw-r--r--src/dbus/qdbusmessage.h3
-rw-r--r--src/dbus/qdbusmessage_p.h2
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; }