aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-03-23 00:52:25 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-08-15 20:01:12 (GMT)
commit91846f4199a7bcc8b055492360326527f72c1acb (patch)
treee191edb81a9f8efeea935c5f498af81f1d05552f
parentc82fc387b450f08bbf87990d431476343a210a08 (diff)
Use Monitor's objectName() if available to identify subscriber
Makes debugging easier. Fallbacks to this pointer-as-int.
-rw-r--r--src/core/monitor_p.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/monitor_p.cpp b/src/core/monitor_p.cpp
index 31705c4..02c6b53 100644
--- a/src/core/monitor_p.cpp
+++ b/src/core/monitor_p.cpp
@@ -629,13 +629,20 @@ int MonitorPrivate::translateAndCompress(QQueue<Protocol::ChangeNotification> &n
void MonitorPrivate::commandReceived(qint64 tag, const Protocol::Command &command)
{
+ Q_Q(Monitor);
Q_UNUSED(tag);
if (command.isResponse()) {
switch (command.type()) {
case Protocol::Command::Hello: {
Protocol::HelloResponse hello(command);
qCDebug(AKONADICORE_LOG) << q_ptr << "Connected to notification bus";
- Protocol::CreateSubscriptionCommand subCmd(session->sessionId() + QByteArray::number(quintptr(this)));
+ QByteArray subname = session->sessionId() + " - ";
+ if (!q->objectName().isEmpty()) {
+ subname += q->objectName().toLatin1();
+ } else {
+ subname += QByteArray::number(quintptr(q));
+ }
+ Protocol::CreateSubscriptionCommand subCmd(subname);
ntfConnection->sendCommand(2, subCmd);
break;
}