[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:42 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=5689a91
The following commit has been merged in the master branch:
commit 5689a915505eef0cbe6d72c8048f1324671f9d68
Author: George Goldberg <grundleborg at googlemail.com>
Date: Tue Jul 28 16:12:55 2009 +0000
Implement removing of accounts.
Thanks to Matteo Nardi for the patch.
BUG: 201396
svn path=/trunk/playground/network/telepathy-accounts-kcm/; revision=1003684
---
KTp/Models/accounts-list-model.cpp | 38 +++++++++++++++++---------------------
KTp/Models/accounts-list-model.h | 1 +
2 files changed, 18 insertions(+), 21 deletions(-)
diff --git a/KTp/Models/accounts-list-model.cpp b/KTp/Models/accounts-list-model.cpp
index 92c1b12..54fc370 100644
--- a/KTp/Models/accounts-list-model.cpp
+++ b/KTp/Models/accounts-list-model.cpp
@@ -22,7 +22,6 @@
#include "account-item.h"
-#include <KCategorizedSortFilterProxyModel>
#include <KDebug>
#include <KIcon>
@@ -81,24 +80,6 @@ QVariant AccountsListModel::data(const QModelIndex &index, int role) const
}
break;
- case KCategorizedSortFilterProxyModel::CategoryDisplayRole:
- if(account->isValidAccount()) {
- data = QVariant(QString("Valid Accounts"));
- }
- else {
- data = QVariant(QString("Invalid Accounts"));
- }
- break;
-
- case KCategorizedSortFilterProxyModel::CategorySortRole:
- if(account->isValidAccount()) {
- data = QVariant(4);
- }
- else {
- data = QVariant(5);
- }
- break;
-
default:
break;
}
@@ -160,6 +141,21 @@ void AccountsListModel::addAccount(const Tp::AccountPtr &account)
}
}
+void AccountsListModel::removeAccount(const QModelIndex &index)
+{
+ kDebug();
+
+ if(!index.isValid()) {
+ kDebug() << "Can't remove Account: Invalid index";
+ return;
+ }
+ AccountItem *accountItem = m_readyAccounts.at(index.row());
+
+ Q_ASSERT(accountItem);
+
+ accountItem->remove();
+}
+
void AccountsListModel::onAccountItemReady()
{
kDebug();
@@ -202,8 +198,8 @@ void AccountsListModel::onAccountItemRemoved()
return;
}
- beginRemoveRows(QModelIndex(), m_readyAccounts.lastIndexOf(item)-1,
- m_readyAccounts.lastIndexOf(item)-1);
+ beginRemoveRows(QModelIndex(), m_readyAccounts.lastIndexOf(item),
+ m_readyAccounts.lastIndexOf(item));
m_readyAccounts.removeAll(item);
m_unreadyAccounts.removeAll(item);
endRemoveRows();
diff --git a/KTp/Models/accounts-list-model.h b/KTp/Models/accounts-list-model.h
index 02fd381..6922833 100644
--- a/KTp/Models/accounts-list-model.h
+++ b/KTp/Models/accounts-list-model.h
@@ -40,6 +40,7 @@ public:
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
void addAccount(const Tp::AccountPtr &account);
+ void removeAccount(const QModelIndex &index);
private Q_SLOTS:
void onAccountItemReady();
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list