[SCM] ktp-accounts-kcm packaging branch, master, updated. debian/15.12.1-1-1157-gc4589c5

Maximiliano Curia maxy at moszumanska.debian.org
Fri May 27 23:57:11 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-accounts-kcm.git;a=commitdiff;h=df330fd

The following commit has been merged in the master branch:
commit df330fd0b1cbaf1fb84ac1fb6b8b6a5839924920
Author: George Goldberg <grundleborg at googlemail.com>
Date:   Sat Feb 14 21:28:48 2009 +0000

    Display the accounts under the categories VALID and INVALID in the accounts list view.
    
    svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=926230
---
 src/accounts-list-model.cpp    | 33 ++++++++++++++++++++++++++++++---
 src/kcm-telepathy-accounts.cpp |  4 ++++
 src/main-widget.ui             |  6 +++---
 3 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/src/accounts-list-model.cpp b/src/accounts-list-model.cpp
index e99398c..d3512f2 100644
--- a/src/accounts-list-model.cpp
+++ b/src/accounts-list-model.cpp
@@ -22,6 +22,7 @@
 
 #include "account-item.h"
 
+#include <kcategorizedsortfilterproxymodel.h>
 #include <kdebug.h>
 
 #include <TelepathyQt4/Client/Account>
@@ -52,12 +53,38 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
 {
     // FIXME: This is a basic implementation just so I can see what's going
     // on while developing this code further. Needs expanding.
-    if(role == Qt::DisplayRole)
+    QVariant data;
+
+    switch(role)
     {
-        return QVariant(m_readyAccounts.at(index.row())->account()->displayName());
+    case Qt::DisplayRole:
+        data = QVariant(m_readyAccounts.at(index.row())->account()->displayName());
+        break;
+    case KCategorizedSortFilterProxyModel::CategoryDisplayRole:
+        if(m_readyAccounts.at(index.row())->account()->isValidAccount())
+        {
+            data = QVariant(QString("Valid Accounts"));
+        }
+        else
+        {
+            data = QVariant(QString("Invalid Accounts"));
+        }
+        break;
+    case KCategorizedSortFilterProxyModel::CategorySortRole:
+        if(m_readyAccounts.at(index.row())->account()->isValidAccount())
+        {
+            data = QVariant(4);
+        }
+        else
+        {
+            data = QVariant(5);
+        }
+        break;
+    default:
+        break;
     }
 
-    return QVariant();
+    return data;
 }
 
 void AccountsListModel::addAccount(Telepathy::Client::Account *account)
diff --git a/src/kcm-telepathy-accounts.cpp b/src/kcm-telepathy-accounts.cpp
index 32be267..4435909 100644
--- a/src/kcm-telepathy-accounts.cpp
+++ b/src/kcm-telepathy-accounts.cpp
@@ -23,6 +23,7 @@
 #include "accounts-list-model.h"
 
 #include <kcategorizedsortfilterproxymodel.h>
+#include <kcategorydrawer.h>
 #include <kgenericfactory.h>
 
 #include <TelepathyQt4/Client/Account>
@@ -45,10 +46,13 @@ KCMTelepathyAccounts::KCMTelepathyAccounts(QWidget *parent, const QVariantList&
 
     // Set up the UI stuff.
     setupUi(this);
+    m_accountsListView->setCategoryDrawer(new KCategoryDrawer);
+
     m_accountsListModel = new AccountsListModel(this);
     m_accountsListProxyModel = new KCategorizedSortFilterProxyModel(this);
     m_accountsListProxyModel->setSourceModel(m_accountsListModel);
     m_accountsListView->setModel(m_accountsListProxyModel);
+    m_accountsListProxyModel->setCategorizedModel(true);
 }
 
 KCMTelepathyAccounts::~KCMTelepathyAccounts()
diff --git a/src/main-widget.ui b/src/main-widget.ui
index 5ad7905..ead4c23 100644
--- a/src/main-widget.ui
+++ b/src/main-widget.ui
@@ -70,9 +70,9 @@
  </widget>
  <customwidgets>
   <customwidget>
-   <class>KListWidget</class>
-   <extends>QListWidget</extends>
-   <header>klistwidget.h</header>
+   <class>KCategorizedView</class>
+   <extends>QListView</extends>
+   <header>kcategorizedview.h</header>
   </customwidget>
   <customwidget>
    <class>KPushButton</class>

-- 
ktp-accounts-kcm packaging



More information about the pkg-kde-commits mailing list