[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:45 UTC 2016


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

The following commit has been merged in the master branch:
commit 809e6bbbae3ac35f78b7ff685dbd7143a61835ce
Author: Martin Klapetek <martin.klapetek at gmail.com>
Date:   Tue Dec 27 15:15:48 2011 +0100

    Get rid of itemForIndex and add new AccountsListModel role to return AccountItem
    
    Reviewed-by: David Edmundson
---
 KTp/Models/accounts-list-model.cpp | 10 +++++++---
 KTp/Models/accounts-list-model.h   |  7 ++++---
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/KTp/Models/accounts-list-model.cpp b/KTp/Models/accounts-list-model.cpp
index b1a6e05..58db79e 100644
--- a/KTp/Models/accounts-list-model.cpp
+++ b/KTp/Models/accounts-list-model.cpp
@@ -104,6 +104,10 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
         data = QVariant(m_accounts.at(index.row())->connectionProtocolName());
         break;
 
+    case AccountsListModel::AccountItemRole:
+        data = QVariant::fromValue<AccountItem*>(m_accounts.at(index.row()));
+        break;
+
     default:
         break;
     }
@@ -118,8 +122,8 @@ bool AccountsListModel::setData(const QModelIndex &index, const QVariant &value,
     }
     kDebug();
     if(role == Qt::CheckStateRole) {
-        m_accounts.at(index.row())->account()->setEnabled(value.toInt() == Qt::Checked);
-        kDebug() << "shit";
+        //this is index from QSortFilterProxyModel
+        index.data(AccountItemRole).value<AccountItem*>()->account()->setEnabled(value.toInt() == Qt::Checked);
         return true;
     }
 
@@ -230,7 +234,7 @@ void AccountsListModel::onAccountItemRemoved()
     endRemoveRows();
 
     // FIXME: Workaround until the KWidgetItemDelegate gets fixed (probably KDE 4.7)
-    reset();
+    //reset();
     delete item;
 }
 
diff --git a/KTp/Models/accounts-list-model.h b/KTp/Models/accounts-list-model.h
index 1101172..061c192 100644
--- a/KTp/Models/accounts-list-model.h
+++ b/KTp/Models/accounts-list-model.h
@@ -35,9 +35,10 @@ class AccountsListModel : public QAbstractListModel
 public:
     enum Roles {
         ConnectionStateDisplayRole = Qt::UserRole+1,
-        ConnectionStateIconRole = Qt::UserRole+2,
-        ConnectionErrorMessageDisplayRole = Qt::UserRole+3,
-        ConnectionProtocolNameRole = Qt::UserRole+4
+        ConnectionStateIconRole,
+        ConnectionErrorMessageDisplayRole,
+        ConnectionProtocolNameRole,
+        AccountItemRole
     };
 
     explicit AccountsListModel(QObject *parent = 0);

-- 
ktp-common-internals packaging



More information about the pkg-kde-commits mailing list