[SCM] ktp-contact-list packaging branch, master, updated. debian/15.12.1-2-1070-g6c56f91

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:05:37 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-contact-list.git;a=commitdiff;h=63c055b

The following commit has been merged in the master branch:
commit 63c055b05a7297c1a6c7876684802fb82158eb31
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Thu Mar 17 21:42:06 2011 +0100

    Move the account 'filtering' from the model to the proxy model, where it belongs. Also use the renamed TextUi dbus path.
---
 account-filter-model.cpp | 10 ++++++++++
 accounts-model.cpp       | 23 ++++++++++++-----------
 main-widget.cpp          |  4 ++--
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/account-filter-model.cpp b/account-filter-model.cpp
index 0347daa..da18d02 100644
--- a/account-filter-model.cpp
+++ b/account-filter-model.cpp
@@ -21,6 +21,7 @@
 
 #include "account-filter-model.h"
 #include "accounts-model.h"
+#include <KDebug>
 
 AccountFilterModel::AccountFilterModel(QObject *parent)
     : QSortFilterProxyModel(parent),
@@ -63,6 +64,15 @@ bool AccountFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sou
 
             rowAccepted = false;
         }
+    } else {
+        if (!sourceModel()->index(source_row, 0).data(AccountsModel::EnabledRole).toBool()) {
+            rowAccepted = false;
+        }
+        if (sourceModel()->index(source_row, 0).data(AccountsModel::ConnectionStatusRole).toInt()
+            != Tp::ConnectionStatusConnected) {
+
+            rowAccepted = false;
+        }
     }
 
     return rowAccepted;
diff --git a/accounts-model.cpp b/accounts-model.cpp
index dacb5a7..266828a 100644
--- a/accounts-model.cpp
+++ b/accounts-model.cpp
@@ -64,17 +64,15 @@ AccountsModel::AccountsModel(const Tp::AccountManagerPtr &am, QObject *parent)
             SLOT(onItemsRemoved(TreeNode*,int,int)));
 
     foreach (Tp::AccountPtr account, mPriv->mAM->allAccounts()) {
-        if(account->isEnabled() && account->connectionStatus() == Tp::ConnectionStatusConnected) {
-            AccountsModelItem *item = new AccountsModelItem(account);
-            connect(item, SIGNAL(connectionStatusChanged(QString,int)),
-                    this, SIGNAL(accountConnectionStatusChanged(QString,int)));
-            mPriv->mTree->addChild(item);
-        }
+        AccountsModelItem *item = new AccountsModelItem(account);
+        connect(item, SIGNAL(connectionStatusChanged(QString,int)),
+                this, SIGNAL(accountConnectionStatusChanged(QString,int)));
+        mPriv->mTree->addChild(item);
     }
 
-//     connect(mPriv->mAM.data(),
-//             SIGNAL(newAccount(Tp::AccountPtr)),
-//             SLOT(onNewAccount(Tp::AccountPtr)));
+    connect(mPriv->mAM.data(),
+            SIGNAL(newAccount(Tp::AccountPtr)),
+            SLOT(onNewAccount(Tp::AccountPtr)));
 
     QHash<int, QByteArray> roles;
     roles[ItemRole] = "item";
@@ -154,8 +152,11 @@ void AccountsModel::onItemsAdded(TreeNode *parent, const QList<TreeNode *> &node
 void AccountsModel::onItemsRemoved(TreeNode *parent, int first, int last)
 {
     QModelIndex parentIndex = index(parent);
-    beginRemoveRows(index(parent->parent()), parentIndex.row(), parentIndex.row());
-    parent->remove();
+    QList<TreeNode *> removedItems;
+    beginRemoveRows(parentIndex, first, last);
+    for (int i = last; i >= first; i--) {
+        parent->childAt(i)->remove();
+    }
     endRemoveRows();
 
     emit accountCountChanged();
diff --git a/main-widget.cpp b/main-widget.cpp
index 7930440..92d8ca9 100644
--- a/main-widget.cpp
+++ b/main-widget.cpp
@@ -46,7 +46,7 @@
 #include "contact-delegate.h"
 #include "contact-model-item.h"
 
-#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDEChatHandler"
+#define PREFERRED_TEXTCHAT_HANDLER "org.freedesktop.Telepathy.Client.KDE.TextUi"
 
 MainWidget::MainWidget(QWidget *parent)
  : QWidget(parent),
@@ -203,7 +203,7 @@ void MainWidget::onAccountConnectionStatusChanged(Tp::ConnectionStatus status)
     kDebug() << "Connection status is" << status;
     switch (status) {
     case Tp::ConnectionStatusConnected:
-        m_model->onNewAccount(Tp::AccountPtr(static_cast<Tp::Account*>(sender())));
+        //FIXME: Get the account (sender()) index and expand only that index
         m_contactsListView->expandAll();
         break;
     //Fall through

-- 
ktp-contact-list packaging



More information about the pkg-kde-commits mailing list