66 : msg(0), reply(0),
type(DBUS_MESSAGE_TYPE_INVALID),
67 timeout(-1), localReply(0), ref(1), delayedReply(false), localMessage(false),
68 parametersValidated(false), autoStartService(true)
75 q_dbus_message_unref(
msg);
77 q_dbus_message_unref(
reply);
90 if (d_ptr->type == ErrorMessage) {
91 if (!d_ptr->message.isEmpty())
92 return d_ptr->message;
93 if (!d_ptr->arguments.isEmpty())
94 return d_ptr->arguments.at(0).toString();
119 DBusMessage *
msg = 0;
122 switch (d_ptr->
type) {
123 case DBUS_MESSAGE_TYPE_INVALID:
126 case DBUS_MESSAGE_TYPE_METHOD_CALL:
143 case DBUS_MESSAGE_TYPE_METHOD_RETURN:
144 msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
146 q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->
reply));
147 q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->
reply));
150 case DBUS_MESSAGE_TYPE_ERROR:
156 msg = q_dbus_message_new(DBUS_MESSAGE_TYPE_ERROR);
157 q_dbus_message_set_error_name(msg, d_ptr->
name.
toUtf8());
159 q_dbus_message_set_destination(msg, q_dbus_message_get_sender(d_ptr->
reply));
160 q_dbus_message_set_reply_serial(msg, q_dbus_message_get_serial(d_ptr->
reply));
163 case DBUS_MESSAGE_TYPE_SIGNAL:
190 q_dbus_message_iter_init_append(msg, &marshaller.
iterator);
194 for ( ; it != cend; ++
it)
202 q_dbus_message_unref(msg);
241 message.
d_ptr->
type = q_dbus_message_get_type(dmsg);
249 message.
d_ptr->
msg = q_dbus_message_ref(dmsg);
252 demarshaller.
message = q_dbus_message_ref(dmsg);
253 if (q_dbus_message_iter_init(demarshaller.
message, &demarshaller.
iterator))
254 while (!demarshaller.
atEnd())
276 for ( ; it !=
end; ++
it) {
277 int id = it->userType();
280 qstrlen(signature) != 1) ||
id == qMetaTypeId<QDBusVariant>()) {
294 retval.d_ptr->localMessage =
true;
295 q_dbus_message_unref(message);
296 if (retval.d_ptr->service.isEmpty())
383 message.
d_ptr->
type = DBUS_MESSAGE_TYPE_SIGNAL;
414 message.
d_ptr->
type = DBUS_MESSAGE_TYPE_METHOD_CALL;
430 error.
d_ptr->
type = DBUS_MESSAGE_TYPE_ERROR;
469 reply.
d_ptr->
type = DBUS_MESSAGE_TYPE_METHOD_RETURN;
471 reply.
d_ptr->
reply = q_dbus_message_ref(d_ptr->msg);
472 if (d_ptr->localMessage) {
490 reply.
d_ptr->
reply = q_dbus_message_ref(d_ptr->msg);
491 if (d_ptr->localMessage) {
566 if (!d_ptr->ref.deref())
588 return d_ptr->service;
606 return d_ptr->interface;
614 if (d_ptr->type != ErrorMessage)
624 if (d_ptr->type == ErrorMessage)
635 return d_ptr->signature;
647 return d_ptr->localMessage;
648 return !q_dbus_message_get_no_reply(d_ptr->msg);
667 d_ptr->delayedReply = enable;
677 return d_ptr->delayedReply;
702 d_ptr->autoStartService = enable;
716 return d_ptr->autoStartService;
737 return d_ptr->arguments;
757 switch (d_ptr->type) {
758 case DBUS_MESSAGE_TYPE_METHOD_CALL:
759 return MethodCallMessage;
760 case DBUS_MESSAGE_TYPE_METHOD_RETURN:
762 case DBUS_MESSAGE_TYPE_ERROR:
764 case DBUS_MESSAGE_TYPE_SIGNAL:
765 return SignalMessage;
769 return InvalidMessage;
782 #ifndef QT_NO_DEBUG_STREAM 788 return dbg <<
"MethodCall";
790 return dbg <<
"MethodReturn";
792 return dbg <<
"Signal";
794 return dbg <<
"Error";
796 return dbg <<
"Invalid";
805 for ( ; it !=
end; ++
it) {
815 dbg.
nospace() <<
"QDBusMessage(type=" << msg.
type()
816 <<
", service=" << msg.
service();
821 <<
", member=" << msg.
member();
The QVariant class acts like a union for the most common Qt data types.
QDBusMessage & operator=(const QDBusMessage &other)
Copies the contents of the object given by other.
The QDebug class provides an output stream for debugging information.
static QDBusMessage createError(const QString &name, const QString &msg)
Constructs a new DBus message representing an error, with the given name and msg. ...
static bool isLocal(const QDBusMessage &msg)
#define QT_END_NAMESPACE
This macro expands to.
bool checkMemberName(const QString &name, AllowEmptyFlag empty, QDBusError *error, const char *nameType=0)
static QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
Constructs a new DBus message with the given path, interface and name, representing a signal emission...
#define it(className, varName)
QDebug & nospace()
Clears the stream's internal flag that records whether the last character was a space and returns a r...
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
The QByteArray class provides an array of bytes.
QString service() const
Returns the name of the service or the bus address of the remote method call.
QList< QVariant > arguments
The QDBusError class represents an error received from the D-Bus bus or from remote applications foun...
void setAutoStartService(bool enable)
Sets the auto start flag to enable.
MessageType
The possible message types:
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool ref()
Atomically increments the value of this QAtomicInt.
void setDelayedReply(bool enable) const
Sets whether the message will be replied later (if enable is true) or if an automatic reply should be...
The QString class provides a Unicode character string.
static QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)
Sends the message without waiting for a reply.
static void debugVariantList(QDebug dbg, const QVariantList &list)
ErrorType
In order to facilitate verification of the most common D-Bus errors generated by the D-Bus implementa...
bool appendVariantInternal(const QVariant &arg)
static QDBusMessage fromDBusMessage(DBusMessage *dmsg, QDBusConnection::ConnectionCapabilities capabilities)
Constructs a QDBusMessage by parsing the given DBusMessage object.
QDBusMessage createErrorReply(const QString name, const QString &msg) const
Constructs a new DBus message representing an error reply message, with the given name and msg...
QString signature() const
Returns the signature of the signal that was received or for the output arguments of a method call...
void append(const T &t)
Inserts value at the end of the list.
bool checkBusName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString errorMessage() const
Returns the human-readable message associated with the error that was received.
QList< QVariant > arguments() const
Returns the list of arguments that are going to be sent or were received from D-Bus.
static QDBusMessage makeLocal(const QDBusConnectionPrivate &conn, const QDBusMessage &asSent)
QString path() const
Returns the path of the object that this message is being sent to (in the case of a method call) or b...
QDBusMessage()
Constructs an empty, invalid QDBusMessage object.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
~QDBusMessage()
Disposes of the object and frees any resources that were being held.
QDBusMessagePrivate * d_ptr
bool isReplyRequired() const
Returns the flag that indicates if this message should see a reply or not.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
static DBusMessage * toDBusMessage(const QDBusMessage &message, QDBusConnection::ConnectionCapabilities capabilities, QDBusError *error)
Constructs a DBusMessage object from message.
static const char * data(const QByteArray &arr)
QDBusMessage * localReply
QDBusMessage & operator<<(const QVariant &arg)
Appends the argument arg to the list of arguments to be sent over D-Bus in a method call or signal em...
QString member() const
Returns the name of the signal that was emitted or the name of the method that was called...
QDBusConnection::ConnectionCapabilities capabilities
bool isDelayedReply() const
Returns the delayed reply flag, as set by setDelayedReply().
QDBusMessage createReply(const QList< QVariant > &arguments=QList< QVariant >()) const
Constructs a new DBus message representing a reply, with the given arguments.
const char * constData() const
Returns a pointer to the data stored in the byte array.
QString interface() const
Returns the interface of the method being called (in the case of a method call) or of the signal bein...
uint qstrlen(const char *str)
bool autoStartService() const
Returns the auto start flag, as set by setAutoStartService().
QString errorName() const
Returns the name of the error that was received.
QVariant toVariantInternal()
static QDBusMessage createMethodCall(const QString &destination, const QString &path, const QString &interface, const QString &method)
Constructs a new DBus message representing a method call.
const_iterator ConstIterator
Qt-style synonym for QList::const_iterator.
if(void) toggleToolbarShown
void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
bool checkObjectPath(const QString &path, AllowEmptyFlag empty, QDBusError *error)
The QDBusMessage class represents one message sent or received over the D-Bus bus.
MessageType type() const
Returns the message type.
bool checkErrorName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
void setArguments(const QList< QVariant > &arguments)
Sets the arguments that are going to be sent over D-Bus to arguments.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
static QDBusMessage makeLocalReply(const QDBusConnectionPrivate &conn, const QDBusMessage &asSent)
bool checkInterfaceName(const QString &name, AllowEmptyFlag empty, QDBusError *error)
static const KeyPair *const end
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
#define qPrintable(string)
static QString errorString(ErrorType error)
Returns the error name associated with error condition error.
QString argumentToString(const QVariant &arg)
Dumps the contents of a QtDBus argument from arg into a string.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...