[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:47 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=ee690ba
The following commit has been merged in the master branch:
commit ee690ba57653d3e02c97029129e4a37a34f673ee
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Mon Oct 1 00:46:14 2012 +0100
Make AccountsModelItem private and instead expose a role of just the AccountPtr
This means AccountsItem can be private, ready for the move to extragear.
Also fixes a potential crash if the account is removed whilst editing as EditAccountDialog stores the AccountPtr which is ref counted.
---
KTp/Models/accounts-list-model.cpp | 6 +++---
KTp/Models/accounts-list-model.h | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/KTp/Models/accounts-list-model.cpp b/KTp/Models/accounts-list-model.cpp
index 4a015fa..345aaec 100644
--- a/KTp/Models/accounts-list-model.cpp
+++ b/KTp/Models/accounts-list-model.cpp
@@ -104,8 +104,8 @@ 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()));
+ case AccountsListModel::AccountRole:
+ data = QVariant::fromValue<Tp::AccountPtr>(account);
break;
default:
@@ -122,7 +122,7 @@ bool AccountsListModel::setData(const QModelIndex &index, const QVariant &value,
}
if (role == Qt::CheckStateRole) {
//this is index from QSortFilterProxyModel
- index.data(AccountItemRole).value<AccountItem*>()->account()->setEnabled(value.toInt() == Qt::Checked);
+ index.data(AccountRole).value<Tp::AccountPtr>()->setEnabled(value.toInt() == Qt::Checked);
return true;
}
diff --git a/KTp/Models/accounts-list-model.h b/KTp/Models/accounts-list-model.h
index 1078667..8937354 100644
--- a/KTp/Models/accounts-list-model.h
+++ b/KTp/Models/accounts-list-model.h
@@ -39,7 +39,7 @@ public:
ConnectionStateIconRole,
ConnectionErrorMessageDisplayRole,
ConnectionProtocolNameRole,
- AccountItemRole
+ AccountRole
};
explicit AccountsListModel(QObject *parent = 0);
@@ -66,6 +66,7 @@ private:
QList<AccountItem*> m_accounts;
};
+Q_DECLARE_METATYPE(Tp::AccountPtr)
#endif // header guard
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list