[telepathy-qt4/master] ClientRegistrar: Use ChannelRequestPtr to represent channel requests on AbstractClientHandler::handleChannels.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Tue May 19 06:48:59 PDT 2009
---
TelepathyQt4/abstract-client.h | 2 +-
TelepathyQt4/client-registrar-internal.h | 1 +
TelepathyQt4/client-registrar.cpp | 23 ++++++++++++++++++-----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/TelepathyQt4/abstract-client.h b/TelepathyQt4/abstract-client.h
index 6e8a67e..d646b3d 100644
--- a/TelepathyQt4/abstract-client.h
+++ b/TelepathyQt4/abstract-client.h
@@ -70,7 +70,7 @@ public:
const AccountPtr &account,
const ConnectionPtr &connection,
const QList<ChannelPtr> &channels,
- const QStringList &requestsSatisfied,
+ const QList<ChannelRequestPtr> &requestsSatisfied,
const QDateTime &userActionTime,
const QVariantMap &handlerInfo) = 0;
diff --git a/TelepathyQt4/client-registrar-internal.h b/TelepathyQt4/client-registrar-internal.h
index ae991e6..960cae8 100644
--- a/TelepathyQt4/client-registrar-internal.h
+++ b/TelepathyQt4/client-registrar-internal.h
@@ -177,6 +177,7 @@ private:
AccountPtr mAccount;
ConnectionPtr mConnection;
QList<ChannelPtr> mChannels;
+ QList<ChannelRequestPtr> mChannelRequests;
};
class ClientHandlerRequestsAdaptor : public QDBusAbstractAdaptor
diff --git a/TelepathyQt4/client-registrar.cpp b/TelepathyQt4/client-registrar.cpp
index 4296c97..455e301 100644
--- a/TelepathyQt4/client-registrar.cpp
+++ b/TelepathyQt4/client-registrar.cpp
@@ -29,6 +29,7 @@
#include <TelepathyQt4/Account>
#include <TelepathyQt4/Channel>
+#include <TelepathyQt4/ChannelRequest>
#include <TelepathyQt4/Connection>
#include <TelepathyQt4/PendingClientOperation>
#include <TelepathyQt4/PendingReady>
@@ -139,6 +140,16 @@ void ClientHandlerAdaptor::HandleChannelsCall::process()
connect(mConnection->becomeReady(),
SIGNAL(finished(Tp::PendingOperation *)),
SLOT(onConnectionReady(Tp::PendingOperation *)));
+
+ ChannelRequestPtr channelRequest;
+ foreach (const QDBusObjectPath &path, mRequestsSatisfied) {
+ channelRequest = ChannelRequest::create(mBus,
+ path.path(), QVariantMap());
+ connect(channelRequest->becomeReady(),
+ SIGNAL(finished(Tp::PendingOperation *)),
+ SLOT(onObjectReady(Tp::PendingOperation *)));
+ mChannelRequests.append(channelRequest);
+ }
}
void ClientHandlerAdaptor::HandleChannelsCall::onObjectReady(
@@ -185,10 +196,10 @@ void ClientHandlerAdaptor::HandleChannelsCall::checkFinished()
}
}
- // now we are ready to call AbstractClientHandler::handleChannels
- QStringList requestsSatisfied;
- foreach (const QDBusObjectPath &path, mRequestsSatisfied) {
- requestsSatisfied.append(path.path());
+ foreach (const ChannelRequestPtr &channelRequest, mChannelRequests) {
+ if (!channelRequest->isReady()) {
+ return;
+ }
}
// FIXME: Telepathy supports 64-bit time_t, but Qt only does so on
@@ -199,7 +210,7 @@ void ClientHandlerAdaptor::HandleChannelsCall::checkFinished()
userActionTime = QDateTime::fromTime_t((uint) mUserActionTime);
}
mClient->handleChannels(mOperation, mAccount, mConnection, mChannels,
- requestsSatisfied, userActionTime, mHandlerInfo);
+ mChannelRequests, userActionTime, mHandlerInfo);
emit finished();
}
@@ -224,6 +235,8 @@ ClientHandlerRequestsAdaptor::~ClientHandlerRequestsAdaptor()
{
}
+// TODO should we use ChannelRequestPtr on
+// AbstractClientHandler::addRequest/removeRequest?
void ClientHandlerRequestsAdaptor::AddRequest(
const QDBusObjectPath &request,
const QVariantMap &properties,
--
1.5.6.5
More information about the telepathy-commits
mailing list