telepathy-qt: Fix HandledChannelNotifier for Qt5

David Edmundson davidedmundson at kemper.freedesktop.org
Mon Jan 27 15:11:50 PST 2014


Module: telepathy-qt
Branch: master
Commit: 46029e9f26c78f95c9846097d296ddaec9826c44
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=46029e9f26c78f95c9846097d296ddaec9826c44

Author: Martin Kampas <martin.kampas at tieto.com>
Date:   Tue Nov 12 11:54:00 2013 +0100

Fix HandledChannelNotifier for Qt5

The QObject::connectNotify() signature changed in Qt5.

Detected by
TestAccountChannelDispatcher::testCreateAndHandleChannelHandledAgain()
which hangs forever because HandledChannelNotifier::handledAgain() gets
never emitted.

Reviewed-by: David Edmundson <davidedmundson at kde.org>

---

 TelepathyQt/handled-channel-notifier.cpp |    9 +++++++++
 TelepathyQt/handled-channel-notifier.h   |    6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/TelepathyQt/handled-channel-notifier.cpp b/TelepathyQt/handled-channel-notifier.cpp
index 47b2b55..e871306 100644
--- a/TelepathyQt/handled-channel-notifier.cpp
+++ b/TelepathyQt/handled-channel-notifier.cpp
@@ -93,11 +93,20 @@ void HandledChannelNotifier::onChannelInvalidated()
     deleteLater();
 }
 
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+void HandledChannelNotifier::connectNotify(const QMetaMethod &signal)
+{
+    if (signal == QMetaMethod::fromSignal(&HandledChannelNotifier::handledAgain)) {
+        mPriv->handler->setQueueChannelReceived(false);
+    }
+}
+#else
 void HandledChannelNotifier::connectNotify(const char *signalName)
 {
     if (qstrcmp(signalName, SIGNAL(handledAgain(QDateTime,Tp::ChannelRequestHints))) == 0) {
         mPriv->handler->setQueueChannelReceived(false);
     }
 }
+#endif
 
 } // Tp
diff --git a/TelepathyQt/handled-channel-notifier.h b/TelepathyQt/handled-channel-notifier.h
index 0dab6af..6474031 100644
--- a/TelepathyQt/handled-channel-notifier.h
+++ b/TelepathyQt/handled-channel-notifier.h
@@ -52,7 +52,11 @@ Q_SIGNALS:
     void handledAgain(const QDateTime &userActionTime, const Tp::ChannelRequestHints &requestHints);
 
 protected:
-    void connectNotify(const char *);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    void connectNotify(const QMetaMethod &signal);
+#else
+    void connectNotify(const char *signal);
+#endif
 
 private Q_SLOTS:
     TP_QT_NO_EXPORT void onChannelReceived(const Tp::ChannelPtr &channel,



More information about the telepathy-commits mailing list