telepathy-qt: dbus-tubes: Use requestAllProperties instead of GetAll
Dario Freddi
drf at kemper.freedesktop.org
Tue Jul 3 15:08:41 PDT 2012
Module: telepathy-qt
Branch: master
Commit: 8f6d6be925da5d3d96fc190c29fe9ddcc5995ebc
URL: http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=8f6d6be925da5d3d96fc190c29fe9ddcc5995ebc
Author: Dario Freddi <dario.freddi at collabora.co.uk>
Date: Tue Jun 14 15:35:03 2011 +0200
dbus-tubes: Use requestAllProperties instead of GetAll
---
TelepathyQt/dbus-tube-channel.cpp | 45 ++++++++++++++++++-------------------
TelepathyQt/dbus-tube-channel.h | 2 +-
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/TelepathyQt/dbus-tube-channel.cpp b/TelepathyQt/dbus-tube-channel.cpp
index dd52c37..5b99d3f 100644
--- a/TelepathyQt/dbus-tube-channel.cpp
+++ b/TelepathyQt/dbus-tube-channel.cpp
@@ -28,6 +28,7 @@
#include <TelepathyQt/Connection>
#include <TelepathyQt/ContactManager>
#include <TelepathyQt/PendingVariant>
+#include <TelepathyQt/PendingVariantMap>
namespace Tp
{
@@ -138,18 +139,19 @@ void DBusTubeChannel::Private::introspectDBusTube(DBusTubeChannel::Private *self
debug() << "Introspect dbus tube properties";
- Client::DBus::PropertiesInterface *properties =
- parent->interface<Client::DBus::PropertiesInterface>();
-
- QDBusPendingCallWatcher *watcher =
- new QDBusPendingCallWatcher(
- properties->GetAll(
- QLatin1String(TP_QT_IFACE_CHANNEL_TYPE_DBUS_TUBE)),
- parent);
- parent->connect(watcher,
- SIGNAL(finished(QDBusPendingCallWatcher*)),
- parent,
- SLOT(gotDBusTubeProperties(QDBusPendingCallWatcher*)));
+ if (parent->immutableProperties().contains(QLatin1String("Service")) &&
+ parent->immutableProperties().contains(QLatin1String("SupportedAccessControls"))) {
+ self->extractProperties(parent->immutableProperties());
+ self->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureDBusTube, true);
+ } else {
+ Client::ChannelTypeDBusTubeInterface *dbusTubeInterface =
+ parent->interface<Client::ChannelTypeDBusTubeInterface>();
+
+ parent->connect(dbusTubeInterface->requestAllProperties(),
+ SIGNAL(finished(Tp::PendingOperation*)),
+ parent,
+ SLOT(onRequestAllPropertiesFinished(Tp::PendingOperation*)));
+ }
}
/**
@@ -333,20 +335,17 @@ QHash<ContactPtr, QString> DBusTubeChannel::busNames() const
return mPriv->busNames;
}
-void DBusTubeChannel::gotDBusTubeProperties(QDBusPendingCallWatcher *watcher)
+void DBusTubeChannel::onRequestAllPropertiesFinished(PendingOperation *op)
{
- QDBusPendingReply<QVariantMap> reply = *watcher;
-
- if (!reply.isError()) {
- QVariantMap props = reply.value();
- debug() << "Got reply to Properties::GetAll(DBusTubeChannel)";
- mPriv->extractProperties(props);
+ if (!op->isError()) {
+ debug() << "RequestAllProperties succeeded";
+ PendingVariantMap *result = qobject_cast<PendingVariantMap*>(op);
+ mPriv->extractProperties(result->result());
mPriv->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureDBusTube, true);
} else {
- warning().nospace() << "Properties::GetAll(DBusTubeChannel) failed "
- "with " << reply.error().name() << ": " << reply.error().message();
- mPriv->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureDBusTube, false,
- reply.error());
+ warning().nospace() << "RequestAllProperties failed "
+ "with " << op->errorName() << ": " << op->errorMessage();
+ mPriv->readinessHelper->setIntrospectCompleted(DBusTubeChannel::FeatureDBusTube, false);
}
}
diff --git a/TelepathyQt/dbus-tube-channel.h b/TelepathyQt/dbus-tube-channel.h
index c87e688..d44ec8c 100644
--- a/TelepathyQt/dbus-tube-channel.h
+++ b/TelepathyQt/dbus-tube-channel.h
@@ -64,7 +64,7 @@ Q_SIGNALS:
void busNamesChanged(const QHash<ContactPtr, QString> &added, const QList<ContactPtr> &removed);
private Q_SLOTS:
- TP_QT_NO_EXPORT void gotDBusTubeProperties(QDBusPendingCallWatcher *watcher);
+ TP_QT_NO_EXPORT void onRequestAllPropertiesFinished(Tp::PendingOperation*);
TP_QT_NO_EXPORT void onRequestPropertyDBusNamesFinished(Tp::PendingOperation *op);
TP_QT_NO_EXPORT void onDBusNamesChanged(const Tp::DBusTubeParticipants &added, const Tp::UIntList &removed);
TP_QT_NO_EXPORT void onContactsRetrieved(const QUuid &uuid, const QList<Tp::ContactPtr> &contacts);
More information about the telepathy-commits
mailing list