[SCM] ktp-common-internals packaging branch, master, updated. debian/15.12.1-2-1839-gf0635e9

Maximiliano Curia maxy at moszumanska.debian.org
Mon May 9 09:05:52 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=726c954

The following commit has been merged in the master branch:
commit 726c954e88fc9a71abf259e1fd21740a7c2beef4
Author: David Edmundson <kde at davidedmundson.co.uk>
Date:   Tue Nov 13 22:46:07 2012 +0900

    AccountsListModel now takes an AccountSet to know which accounts to show
    
    REVIEW: 107319
---
 KTp/Models/accounts-list-model.cpp | 34 +++++++++++++++-------------------
 KTp/Models/accounts-list-model.h   |  4 ++--
 KTp/Widgets/accounts-combo-box.cpp |  6 +++---
 KTp/Widgets/accounts-combo-box.h   |  2 +-
 4 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/KTp/Models/accounts-list-model.cpp b/KTp/Models/accounts-list-model.cpp
index d46011a..5328eb3 100644
--- a/KTp/Models/accounts-list-model.cpp
+++ b/KTp/Models/accounts-list-model.cpp
@@ -30,12 +30,12 @@
 #include <KTp/presence.h>
 
 #include <TelepathyQt/Account>
-#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/AccountSet>
 
 class AccountsListModel::Private {
 public:
     QList<Tp::AccountPtr> accounts;
-    Tp::AccountManagerPtr accountManager;
+    Tp::AccountSetPtr accountSet;
 
 };
 
@@ -50,13 +50,19 @@ AccountsListModel::~AccountsListModel()
 {
 }
 
-void AccountsListModel::setAccountManager(const Tp::AccountManagerPtr &accountManager)
+void AccountsListModel::setAccountSet(const Tp::AccountSetPtr &accountSet)
 {
-    d->accountManager = accountManager;
-    Q_FOREACH(const Tp::AccountPtr &account, d->accountManager->allAccounts()) {
+    beginResetModel();
+    d->accounts.clear();
+    endResetModel();
+
+    d->accountSet = accountSet;
+    Q_FOREACH(const Tp::AccountPtr &account, d->accountSet->accounts()) {
         onAccountAdded(account);
     }
-    connect(d->accountManager.data(), SIGNAL(newAccount(Tp::AccountPtr)), SLOT(onAccountAdded(Tp::AccountPtr)));
+    connect(d->accountSet.data(), SIGNAL(accountAdded(Tp::AccountPtr)), SLOT(onAccountAdded(Tp::AccountPtr)));
+    connect(d->accountSet.data(), SIGNAL(accountRemoved(Tp::AccountPtr)), SLOT(onAccountRemoved(Tp::AccountPtr)));
+
 }
 
 int AccountsListModel::rowCount(const QModelIndex & parent) const
@@ -219,20 +225,10 @@ void AccountsListModel::onAccountAdded(const Tp::AccountPtr &account)
     }
 }
 
-void AccountsListModel::onAccountRemoved()
+void AccountsListModel::onAccountRemoved(const Tp::AccountPtr &account)
 {
-    Tp::AccountPtr item = Tp::AccountPtr(qobject_cast<Tp::Account*>(sender()));
-
-    Q_ASSERT(item);
-    if (!item) {
-        kWarning() << "Not an Account pointer:" << sender();
-        return;
-    }
-
-    // We can be pretty sure that there is only one reference to a specific Account in the list
-    // If we screw up here, the styling delegate will screw up even more
-    beginRemoveRows(QModelIndex(), d->accounts.indexOf(item), d->accounts.indexOf(item));
-    d->accounts.removeAll(item);
+    beginRemoveRows(QModelIndex(), d->accounts.indexOf(account), d->accounts.indexOf(account));
+    d->accounts.removeAll(account);
     endRemoveRows();
 }
 
diff --git a/KTp/Models/accounts-list-model.h b/KTp/Models/accounts-list-model.h
index f205a69..a6bdbd4 100644
--- a/KTp/Models/accounts-list-model.h
+++ b/KTp/Models/accounts-list-model.h
@@ -48,7 +48,7 @@ public:
     explicit AccountsListModel(QObject *parent = 0);
     virtual ~AccountsListModel();
 
-    void setAccountManager(const Tp::AccountManagerPtr &accountManager);
+    void setAccountSet(const Tp::AccountSetPtr &accountSet);
 
     virtual int rowCount(const QModelIndex & parent = QModelIndex()) const;
     virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -59,7 +59,7 @@ public:
 
 private Q_SLOTS:
     void onAccountAdded(const Tp::AccountPtr &account);
-    void onAccountRemoved();
+    void onAccountRemoved(const Tp::AccountPtr &account);
     void onAccountUpdated();
 
 private:
diff --git a/KTp/Widgets/accounts-combo-box.cpp b/KTp/Widgets/accounts-combo-box.cpp
index d427e9b..d1ffbac 100644
--- a/KTp/Widgets/accounts-combo-box.cpp
+++ b/KTp/Widgets/accounts-combo-box.cpp
@@ -19,7 +19,7 @@
 
 #include "accounts-combo-box.h"
 
-#include <TelepathyQt/AccountManager>
+#include <TelepathyQt/AccountSet>
 #include <TelepathyQt/Account>
 
 #include <KTp/Models/accounts-list-model.h>
@@ -39,9 +39,9 @@ KTp::AccountsComboBox::AccountsComboBox(QWidget *parent) :
     setModel(d->model);
 }
 
-void KTp::AccountsComboBox::setAccountManager(const Tp::AccountManagerPtr &accountManager)
+void KTp::AccountsComboBox::setAccountSet(const Tp::AccountSetPtr &accountSet)
 {
-    d->model->setAccountManager(accountManager);
+    d->model->setAccountSet(accountSet);
 }
 
 Tp::AccountPtr KTp::AccountsComboBox::currentAccount()
diff --git a/KTp/Widgets/accounts-combo-box.h b/KTp/Widgets/accounts-combo-box.h
index 92d6d99..b5a17da 100644
--- a/KTp/Widgets/accounts-combo-box.h
+++ b/KTp/Widgets/accounts-combo-box.h
@@ -33,7 +33,7 @@ public:
     explicit AccountsComboBox(QWidget *parent = 0);
 
 public:
-    void setAccountManager(const Tp::AccountManagerPtr &accountManager);
+    void setAccountSet(const Tp::AccountSetPtr &accountSet);
     Tp::AccountPtr currentAccount();
 
 private:

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list