summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-06-17 10:07:40 -0700
committerAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-06-17 10:07:40 -0700
commit1119c0974935f769ef46f8676972328ae1613775 (patch)
treeac09cac35517396f63ce1cf530f3fd2b196c0883
parent3ed934ff49f28894293a8b86447fed9747868a59 (diff)
Report the connection status reason using the Connection object if possible
On connection invalidated, emit the connection status changed signal to make sure the account model item is updated
-rw-r--r--NEWS10
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.cpp16
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.h1
3 files changed, 25 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 1ba0915..4460ffc 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+telepathy-qt4-yell 0.1.x
+=========================
+
+Enhancements:
+
+Fixes:
+ * Report the connection status reason using the Connection object if possible
+ * On connection invalidated, emit the connection status changed signal to make sure the account model item is updated
+
+
telepathy-qt4-yell 0.1.6 (2011-06-06)
======================================
diff --git a/TelepathyQt4Yell/Models/accounts-model-item.cpp b/TelepathyQt4Yell/Models/accounts-model-item.cpp
index 5dc056b..9e6d4d8 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.cpp
+++ b/TelepathyQt4Yell/Models/accounts-model-item.cpp
@@ -183,8 +183,13 @@ QVariant AccountsModelItem::data(int role) const
return Tp::ConnectionStatusDisconnected;
}
}
- case AccountsModel::ConnectionStatusReasonRole:
- return mPriv->mAccount->connectionStatusReason();
+ case AccountsModel::ConnectionStatusReasonRole: {
+ if (!mPriv->mAccount->connection().isNull()) {
+ return mPriv->mAccount->connection()->statusReason();
+ } else {
+ return mPriv->mAccount->connectionStatusReason();
+ }
+ }
case AccountsModel::ContactListStateRole: {
if (!mPriv->mManager.isNull()) {
return mPriv->mManager->state();
@@ -311,6 +316,8 @@ void AccountsModelItem::onConnectionChanged(const Tp::ConnectionPtr &connection)
connect(connection.data(), SIGNAL(statusChanged(Tp::ConnectionStatus)),
SLOT(onStatusChanged(Tp::ConnectionStatus)));
+ connect(connection.data(), SIGNAL(invalidated(Tp::DBusProxy*,QString,QString)),
+ SLOT(onConnectionInvalidated()));
onStatusChanged(connection->status());
mPriv->mManager = connection->contactManager();
@@ -324,6 +331,11 @@ void AccountsModelItem::onConnectionChanged(const Tp::ConnectionPtr &connection)
onContactManagerStateChanged(mPriv->mManager->state());
}
+void AccountsModelItem::onConnectionInvalidated()
+{
+ onStatusChanged(Tp::ConnectionStatusDisconnected);
+}
+
void AccountsModelItem::onContactManagerStateChanged(Tp::ContactListState state)
{
onChanged();
diff --git a/TelepathyQt4Yell/Models/accounts-model-item.h b/TelepathyQt4Yell/Models/accounts-model-item.h
index c73dae9..7ce141d 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.h
+++ b/TelepathyQt4Yell/Models/accounts-model-item.h
@@ -59,6 +59,7 @@ public:
public Q_SLOTS:
void addKnownContacts();
void onConnectionChanged(const Tp::ConnectionPtr &connection);
+ void onConnectionInvalidated();
Q_SIGNALS:
void connectionStatusChanged(const QString &accountId, int status);