[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:06:06 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=0cb6e71
The following commit has been merged in the master branch:
commit 0cb6e71eefcd4050e4439c7d842a7e081794a3cf
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Fri Dec 28 21:57:05 2012 +0000
Add Groups Tree Proxy Model based on AbstractGroupingProxyModel
---
KTp/Models/groups-tree-proxy-model.cpp | 40 ++++++++++++++++++++++
...ree-proxy-model.h => groups-tree-proxy-model.h} | 10 +++---
2 files changed, 44 insertions(+), 6 deletions(-)
diff --git a/KTp/Models/groups-tree-proxy-model.cpp b/KTp/Models/groups-tree-proxy-model.cpp
new file mode 100644
index 0000000..6fc7e29
--- /dev/null
+++ b/KTp/Models/groups-tree-proxy-model.cpp
@@ -0,0 +1,40 @@
+#include "groups-tree-proxy-model.h"
+
+#include "contacts-model.h"
+
+#include <TelepathyQt/Account>
+
+#include <KLocalizedString>
+
+GroupsTreeProxyModel::GroupsTreeProxyModel(QAbstractItemModel *sourceModel) :
+ AbstractGroupingProxyModel(sourceModel)
+{
+}
+
+QSet<QString> GroupsTreeProxyModel::groupsForIndex(const QModelIndex &sourceIndex) const
+{
+ QStringList groups = sourceIndex.data(ContactsModel::GroupsRole).value<QStringList>();
+ if (groups.isEmpty()) {
+ groups.append(QLatin1String("_unsorted"));
+ }
+
+ return groups.toSet();
+}
+
+
+QVariant GroupsTreeProxyModel::dataForGroup(const QString &group, int role) const
+{
+ switch (role) {
+ case ContactsModel::TypeRole:
+ return ContactsModel::GroupRowType;
+ case Qt::DisplayRole:
+ if (group == QLatin1String("_unsorted")) {
+ return i18n("Unsorted");
+ } else {
+ return group;
+ }
+ case ContactsModel::IdRole:
+ return group;
+ }
+ return QVariant();
+}
diff --git a/KTp/Models/accounts-tree-proxy-model.h b/KTp/Models/groups-tree-proxy-model.h
similarity index 52%
copy from KTp/Models/accounts-tree-proxy-model.h
copy to KTp/Models/groups-tree-proxy-model.h
index 1b8d1fe..c4a8579 100644
--- a/KTp/Models/accounts-tree-proxy-model.h
+++ b/KTp/Models/groups-tree-proxy-model.h
@@ -1,5 +1,5 @@
-#ifndef ACCOUNTSTREEPROXYMODEL_H
-#define ACCOUNTSTREEPROXYMODEL_H
+#ifndef GROUPSTREEPROXYMODEL_H
+#define GROUPSTREEPROXYMODEL_H
#include "abstract-grouping-proxy-model.h"
@@ -7,16 +7,14 @@
#include <KTp/ktp-export.h>
-class KTP_EXPORT AccountsTreeProxyModel : public AbstractGroupingProxyModel
+class KTP_EXPORT GroupsTreeProxyModel : public AbstractGroupingProxyModel
{
Q_OBJECT
public:
- AccountsTreeProxyModel(QAbstractItemModel *sourceModel, const Tp::AccountManagerPtr &accountManager);
+ GroupsTreeProxyModel(QAbstractItemModel *sourceModel);
virtual QSet<QString> groupsForIndex(const QModelIndex &sourceIndex) const;
virtual QVariant dataForGroup(const QString &group, int role) const;
-private:
- Tp::AccountManagerPtr m_accountManager;
};
#endif // ACCOUNTSTREEPROXYMODEL_H
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list