[Telepathy-commits] [telepathy-qt4/master] Account: Only start introspection/become ready if valid.
Andre Moreira Magalhaes (andrunko)
andre.magalhaes at collabora.co.uk
Fri Feb 13 10:41:43 PST 2009
---
TelepathyQt4/Client/account.cpp | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/TelepathyQt4/Client/account.cpp b/TelepathyQt4/Client/account.cpp
index 023c6cd..c8f7732 100644
--- a/TelepathyQt4/Client/account.cpp
+++ b/TelepathyQt4/Client/account.cpp
@@ -30,6 +30,7 @@
#include <TelepathyQt4/Client/AccountManager>
#include <TelepathyQt4/Client/Connection>
#include <TelepathyQt4/Client/ConnectionManager>
+#include <TelepathyQt4/Client/PendingFailure>
#include <TelepathyQt4/Client/PendingReadyAccount>
#include <TelepathyQt4/Client/PendingVoidMethodCall>
#include <TelepathyQt4/Constants>
@@ -156,15 +157,17 @@ Account::Account(AccountManager *am, const QString &objectPath,
OptionalInterfaceFactory<Account>(this),
mPriv(new Private(am, this))
{
- connect(mPriv->baseInterface,
- SIGNAL(Removed()),
- SLOT(onRemoved()));
- connect(mPriv->baseInterface,
- SIGNAL(AccountPropertyChanged(const QVariantMap &)),
- SLOT(onPropertyChanged(const QVariantMap &)));
-
- mPriv->introspectQueue.enqueue(&Account::callGetAll);
- QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+ if (isValid()) {
+ connect(mPriv->baseInterface,
+ SIGNAL(Removed()),
+ SLOT(onRemoved()));
+ connect(mPriv->baseInterface,
+ SIGNAL(AccountPropertyChanged(const QVariantMap &)),
+ SLOT(onPropertyChanged(const QVariantMap &)));
+
+ mPriv->introspectQueue.enqueue(&Account::callGetAll);
+ QTimer::singleShot(0, this, SLOT(continueIntrospection()));
+ }
}
/**
@@ -624,6 +627,14 @@ bool Account::isReady(Features features) const
*/
PendingReadyAccount *Account::becomeReady(Features requestedFeatures)
{
+ if (!isValid()) {
+ PendingReadyAccount *operation =
+ new PendingReadyAccount(requestedFeatures, this);
+ operation->setFinishedWithError(TELEPATHY_ERROR_NOT_AVAILABLE,
+ "Account is invalid");
+ return operation;
+ }
+
if (isReady(requestedFeatures)) {
PendingReadyAccount *operation =
new PendingReadyAccount(requestedFeatures, this);
--
1.5.6.5
More information about the telepathy-commits
mailing list