[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:36 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-common-internals.git;a=commitdiff;h=c72ed04
The following commit has been merged in the master branch:
commit c72ed042cce7eddaad88af6eaba07e21a03cedfb
Author: David Edmundson <kde at davidedmundson.co.uk>
Date: Thu Mar 14 11:28:55 2013 +0100
Add a method to filter contacts that are only from a specific account.
Use case: Text-ui has a dialog to invite contacts to chat, I only want
to show people from the same account.
Reviewed-by: Aleix Pol Gonzalez <aleixpol at gmail.com>
Reviewed-by: Andrea Scarpino <andrea at archlinux.org>
REVIEW: 109472
CCBUG: 316688
---
KTp/Models/contacts-filter-model.cpp | 28 ++++++++++++++++++++++++++++
KTp/Models/contacts-filter-model.h | 13 +++++++++++++
2 files changed, 41 insertions(+)
diff --git a/KTp/Models/contacts-filter-model.cpp b/KTp/Models/contacts-filter-model.cpp
index f8ac2d0..9cc3f25 100644
--- a/KTp/Models/contacts-filter-model.cpp
+++ b/KTp/Models/contacts-filter-model.cpp
@@ -67,6 +67,7 @@ public:
Qt::MatchFlags aliasFilterMatchFlags;
Qt::MatchFlags groupsFilterMatchFlags;
Qt::MatchFlags idFilterMatchFlags;
+ Tp::AccountPtr accountFilter;
bool filterAcceptsAccount(const QModelIndex &index) const;
bool filterAcceptsContact(const QModelIndex &index) const;
@@ -316,6 +317,13 @@ bool ContactsFilterModel::Private::filterAcceptsContact(const QModelIndex &index
}
}
+ //check account
+ if (accountFilter) {
+ if(index.data(KTp::AccountRole).value<Tp::AccountPtr>() != accountFilter) {
+ return false;
+ }
+ }
+
return true;
}
@@ -755,6 +763,26 @@ Qt::MatchFlags ContactsFilterModel::idFilterMatchFlags() const
return d->idFilterMatchFlags;
}
+
+Tp::AccountPtr ContactsFilterModel::accountFilter() const
+{
+ return d->accountFilter;
+}
+
+void ContactsFilterModel::setAccountFilter(const Tp::AccountPtr &accountFilter)
+{
+ if (d->accountFilter != accountFilter) {
+ d->accountFilter = accountFilter;
+ invalidateFilter();
+ Q_EMIT accountFilterChanged(accountFilter);
+ }
+}
+
+void ContactsFilterModel::clearAccountFilter()
+{
+ setAccountFilter(Tp::AccountPtr());
+}
+
void ContactsFilterModel::resetIdFilterMatchFlags()
{
setIdFilterMatchFlags(Qt::MatchStartsWith | Qt::MatchWrap);
diff --git a/KTp/Models/contacts-filter-model.h b/KTp/Models/contacts-filter-model.h
index e5a8c8f..f5b41a5 100644
--- a/KTp/Models/contacts-filter-model.h
+++ b/KTp/Models/contacts-filter-model.h
@@ -24,6 +24,7 @@
#include <QSortFilterProxyModel>
+#include <KTp/types.h>
#include <KTp/ktp-export.h>
namespace KTp
@@ -132,6 +133,13 @@ class KTP_EXPORT ContactsFilterModel : public QSortFilterProxyModel
RESET resetIdFilterMatchFlags
WRITE setIdFilterMatchFlags
NOTIFY idFilterMatchFlagsChanged)
+
+ Q_PROPERTY(Tp::AccountPtr accountFilter
+ READ accountFilter
+ RESET clearAccountFilter
+ WRITE setAccountFilter
+ NOTIFY accountFilterChanged)
+
Q_PROPERTY(QString sortRoleString
READ sortRoleString
WRITE setSortRoleString)
@@ -270,6 +278,11 @@ public:
Q_SLOT void setIdFilterMatchFlags(Qt::MatchFlags idFilterMatchFlags);
Q_SIGNAL void idFilterMatchFlagsChanged(Qt::MatchFlags idFilterMatchFlags);
+ Tp::AccountPtr accountFilter() const;
+ Q_SLOT void clearAccountFilter();
+ Q_SLOT void setAccountFilter(const Tp::AccountPtr &accountFilter);
+ Q_SIGNAL void accountFilterChanged(const Tp::AccountPtr &accountFilter);
+
QStringList tubesFilterStrings() const;
Q_SLOT void clearTubesFilterStrings();
Q_SLOT void setTubesFilterStrings(const QStringList &tubesFilterStrings);
--
ktp-common-internals packaging
More information about the pkg-kde-commits
mailing list