[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:22:05 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=3a3a945
The following commit has been merged in the master branch:
commit 3a3a945eabe205d33e6788b929ac29a8f67861fd
Author: Dan Vrátil <dan at progdan.cz>
Date: Sun Jul 15 19:12:00 2012 +0200
Filter by both account name and real name
REVIEW: 105556
---
logviewer/entity-proxy-model.cpp | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/logviewer/entity-proxy-model.cpp b/logviewer/entity-proxy-model.cpp
index e431cd0..ac1bbf5 100644
--- a/logviewer/entity-proxy-model.cpp
+++ b/logviewer/entity-proxy-model.cpp
@@ -19,8 +19,9 @@
#include "entity-proxy-model.h"
+#include "entity-model.h"
-#include <QDebug>
+#include <TelepathyQt/Types>
EntityProxyModel::EntityProxyModel(QObject *parent):
QSortFilterProxyModel(parent)
@@ -33,11 +34,28 @@ EntityProxyModel::~EntityProxyModel()
bool EntityProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
+ /* Always display account node */
if (source_parent == QModelIndex()) {
return true;
}
QModelIndex index = source_parent.child(source_row, 0);
QString term = filterRegExp().pattern();
- return index.data(Qt::DisplayRole).toString().contains(term, Qt::CaseInsensitive);
+
+ Tp::ContactPtr contact = index.data(EntityModel::ContactRole).value< Tp::ContactPtr >();
+ Tpl::EntityPtr entity = index.data(EntityModel::EntityRole).value< Tpl::EntityPtr >();
+
+ /* Check if contact's account name matches */
+ if (entity->alias().contains(term, Qt::CaseInsensitive)) {
+ return true;
+ }
+
+ /* If there's information about contact's real name try to match it too */
+ if (!contact.isNull()) {
+ if (contact->alias().contains(term, Qt::CaseInsensitive)) {
+ return true;
+ }
+ }
+
+ return false;
}
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list