summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-08-08 05:58:46 -0700
committerAlvaro Soliverez <alvaro.soliverez@collabora.co.uk>2011-08-08 05:58:46 -0700
commit3904538bfd1e9e48a111377b0ee03a395f876a47 (patch)
treefd761fc44ded1b09fc2d64f765d5bde584ecd0cb
parentd9214613c68ff5df16c12c0662824fb71a19c44e (diff)
Improved the way an AccountsModelItem is setup on startup
-rw-r--r--NEWS1
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.cpp6
-rw-r--r--TelepathyQt4Yell/Models/accounts-model-item.h2
-rw-r--r--TelepathyQt4Yell/Models/accounts-model.cpp8
4 files changed, 8 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index b4e30b6..9a65c03 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ Fixes:
* It should be possible to send messages with non-default type and flags
* Make contact refresh methods private in AccountsModelItem
* Fixed a crash when items are removed from TreeNode
+ * Improved the way an AccountsModelItem is setup on startup
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 840f972..9498886 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.cpp
+++ b/TelepathyQt4Yell/Models/accounts-model-item.cpp
@@ -179,6 +179,7 @@ AccountsModelItem::AccountsModelItem(const Tp::AccountPtr &account)
connect(mPriv->mAccount.data(),
SIGNAL(connectionChanged(Tp::ConnectionPtr)),
SLOT(onConnectionChanged(Tp::ConnectionPtr)));
+ QTimer::singleShot(0, this, SLOT(startup()));
}
AccountsModelItem::~AccountsModelItem()
@@ -186,6 +187,11 @@ AccountsModelItem::~AccountsModelItem()
delete mPriv;
}
+void AccountsModelItem::startup()
+{
+ onConnectionChanged(mPriv->mAccount->connection());
+}
+
QVariant AccountsModelItem::data(int role) const
{
switch (role) {
diff --git a/TelepathyQt4Yell/Models/accounts-model-item.h b/TelepathyQt4Yell/Models/accounts-model-item.h
index 664d7d6..f6ad623 100644
--- a/TelepathyQt4Yell/Models/accounts-model-item.h
+++ b/TelepathyQt4Yell/Models/accounts-model-item.h
@@ -82,8 +82,8 @@ Q_SIGNALS:
void connectionStatusChanged(const QString &accountId, int status);
private Q_SLOTS:
+ void startup();
void onRemoved();
-
void onChanged();
void onStatusChanged(Tp::ConnectionStatus status);
diff --git a/TelepathyQt4Yell/Models/accounts-model.cpp b/TelepathyQt4Yell/Models/accounts-model.cpp
index 7386059..8a8a618 100644
--- a/TelepathyQt4Yell/Models/accounts-model.cpp
+++ b/TelepathyQt4Yell/Models/accounts-model.cpp
@@ -156,14 +156,6 @@ void AccountsModel::onNewAccount(const Tp::AccountPtr &account)
connect(item, SIGNAL(connectionStatusChanged(QString,int)),
this, SIGNAL(accountConnectionStatusChanged(QString,int)));
onItemsAdded(mPriv->mTree, QList<TreeNode *>() << item);
-
- // this is done here because the item needs to be added to the tree so that the necessary signals
- // are in place to detect when adding contacts to the account item
- // otherwise, addKnownContacts will be called, but the contacts will not be added to the model
- if (!account->connection().isNull()
- && account->connection()->isValid()) {
- item->onConnectionChanged(account->connection());
- }
emit newAccountItem(account->uniqueIdentifier());
}