Make QDBusConnectionPrivate::send return bool

It used to return the sent message's serial ID, but we never used that.
So simply use boolean instead.

Change-Id: Ic5d393bfd36e48a193fcffff13b73753ccf47759
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Reviewed-by: Albert Astals Cid <aacid@kde.org>
This commit is contained in:
Thiago Macieira 2014-12-29 19:25:28 -02:00
parent 9af53bfc81
commit edaf7c30d4
2 changed files with 7 additions and 14 deletions

View File

@ -198,7 +198,7 @@ public:
QString getNameOwner(const QString &service);
int send(const QDBusMessage &message);
bool send(const QDBusMessage &message);
QDBusMessage sendWithReply(const QDBusMessage &message, int mode, int timeout = -1);
QDBusMessage sendWithReplyLocal(const QDBusMessage &message);
QDBusPendingCallPrivate *sendWithReplyAsync(const QDBusMessage &message, QObject *receiver,

View File

@ -1873,10 +1873,10 @@ void QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate *call)
delete call;
}
int QDBusConnectionPrivate::send(const QDBusMessage& message)
bool QDBusConnectionPrivate::send(const QDBusMessage& message)
{
if (QDBusMessagePrivate::isLocal(message))
return -1; // don't send; the reply will be retrieved by the caller
return true; // don't send; the reply will be retrieved by the caller
// through the d_ptr->localReply link
QDBusError error;
@ -1900,24 +1900,17 @@ int QDBusConnectionPrivate::send(const QDBusMessage& message)
"invalid", qPrintable(message.service()),
qPrintable(error.message()));
lastError = error;
return 0;
return false;
}
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
qDBusDebug() << this << "sending message (no reply):" << message;
checkThread();
bool isOk;
{
QDBusDispatchLocker locker(SendMessageAction, this);
isOk = q_dbus_connection_send(connection, msg, 0);
}
int serial = 0;
if (isOk)
serial = q_dbus_message_get_serial(msg);
QDBusDispatchLocker locker(SendMessageAction, this);
bool isOk = q_dbus_connection_send(connection, msg, 0);
q_dbus_message_unref(msg);
return serial;
return isOk;
}
// small helper to note long running blocking dbus calls.