Hello community, here is the log from the commit of package kpeople5 for openSUSE:Factory checked in at 2015-07-14 17:28:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kpeople5 (Old) and /work/SRC/openSUSE:Factory/.kpeople5.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kpeople5" Changes: -------- --- /work/SRC/openSUSE:Factory/kpeople5/kpeople5.changes 2015-06-23 12:11:07.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kpeople5.new/kpeople5.changes 2015-07-14 17:28:59.000000000 +0200 @@ -1,0 +2,8 @@ +Sun Jul 5 18:45:20 UTC 2015 - hrvoje.sen...@gmail.com + +- Update to 5.12.0 + * Implement PersonsModel filtering facilities + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.12.0.php + +------------------------------------------------------------------- Old: ---- kpeople-5.11.0.tar.xz New: ---- kpeople-5.12.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kpeople5.spec ++++++ --- /var/tmp/diff_new_pack.3nQWX1/_old 2015-07-14 17:28:59.000000000 +0200 +++ /var/tmp/diff_new_pack.3nQWX1/_new 2015-07-14 17:28:59.000000000 +0200 @@ -18,9 +18,9 @@ %bcond_without lang %define rname kpeople -%define _tar_path 5.11 +%define _tar_path 5.12 Name: kpeople5 -Version: 5.11.0 +Version: 5.12.0 Release: 0 %define kf5_version %{version} BuildRequires: extra-cmake-modules >= %{_tar_path} ++++++ kpeople-5.11.0.tar.xz -> kpeople-5.12.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/CMakeLists.txt new/kpeople-5.12.0/CMakeLists.txt --- old/kpeople-5.11.0/CMakeLists.txt 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/CMakeLists.txt 2015-07-05 11:11:07.000000000 +0200 @@ -3,14 +3,14 @@ project (KPeople) include(FeatureSummary) -find_package(ECM 5.11.0 NO_MODULE) +find_package(ECM 5.12.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) -set(KF5_VERSION "5.11.0") # handled by release scripts -set(KF5_DEP_VERSION "5.11.0") # handled by release scripts +set(KF5_VERSION "5.12.0") # handled by release scripts +set(KF5_DEP_VERSION "5.12.0") # handled by release scripts set(REQUIRED_QT_VERSION 5.2.0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/CMakeLists.txt new/kpeople-5.12.0/autotests/CMakeLists.txt --- old/kpeople-5.11.0/autotests/CMakeLists.txt 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/autotests/CMakeLists.txt 2015-07-05 11:11:07.000000000 +0200 @@ -1,4 +1,7 @@ find_package(Qt5Test) -ecm_add_test(TEST_NAME persondatatest persondatatests.cpp fakecontactsource.cpp LINK_LIBRARIES Qt5::Sql Qt5::Test KF5::People KF5::PeopleBackend) -ecm_add_test(TEST_NAME personsmodeltest personsmodeltest.cpp fakecontactsource.cpp LINK_LIBRARIES Qt5::Sql Qt5::Test KF5::People KF5::PeopleBackend) +set(libs Qt5::Sql Qt5::Test KF5::People KF5::PeopleBackend) + +ecm_add_test(TEST_NAME persondatatest persondatatests.cpp fakecontactsource.cpp LINK_LIBRARIES ${libs}) +ecm_add_test(TEST_NAME personsmodeltest personsmodeltest.cpp fakecontactsource.cpp LINK_LIBRARIES ${libs}) +ecm_add_test(TEST_NAME personsproxymodeltest personsproxymodeltest.cpp fakecontactsource.cpp LINK_LIBRARIES ${libs}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/fakecontactsource.cpp new/kpeople-5.12.0/autotests/fakecontactsource.cpp --- old/kpeople-5.11.0/autotests/fakecontactsource.cpp 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/autotests/fakecontactsource.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -81,7 +81,8 @@ { KPeople::AbstractContact::Ptr contact2(new FakeContact(QVariantMap { { KPeople::AbstractContact::NameProperty, QStringLiteral("Contact 2") }, - { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") } + { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") }, + { KPeople::AbstractContact::PhoneNumberProperty, QStringLiteral("+1 234 567 890") } })); contacts[QStringLiteral("fakesource://contact2")] = contact2; } @@ -89,7 +90,8 @@ { KPeople::AbstractContact::Ptr contact3(new FakeContact(QVariantMap { { KPeople::AbstractContact::NameProperty, QStringLiteral("Contact 3") }, - { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") } + { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") }, + { KPeople::AbstractContact::PhoneNumberProperty, QStringLiteral("+34 666 777 999") } })); contacts[QStringLiteral("fakesource://contact3")] = contact3; } @@ -97,7 +99,7 @@ { KPeople::AbstractContact::Ptr contact4(new FakeContact(QVariantMap { { KPeople::AbstractContact::NameProperty, QStringLiteral("Contact 4") }, - { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") } + { KPeople::AbstractContact::EmailProperty, QStringLiteral("conta...@example.com") } })); contacts[QStringLiteral("fakesource://contact4")] = contact4; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/fakecontactsource.h new/kpeople-5.12.0/autotests/fakecontactsource.h --- old/kpeople-5.11.0/autotests/fakecontactsource.h 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/autotests/fakecontactsource.h 2015-07-05 11:11:07.000000000 +0200 @@ -23,6 +23,16 @@ #include <backends/basepersonsdatasource.h> #include <backends/allcontactsmonitor.h> +/** +the fake datasource is configured with + +ID - NAME - email - phone +contact1 - Contact1 - conta...@example.com - +contact2 - PersonA - conta...@example.com - +1 234 567 890 +contact3 - PersonA - conta...@example.com - +34 666 777 999 +contact4 - PersonA - conta...@example.com +*/ + class FakeContactSource : public KPeople::BasePersonsDataSource { public: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/persondatatests.cpp new/kpeople-5.12.0/autotests/persondatatests.cpp --- old/kpeople-5.11.0/autotests/persondatatests.cpp 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/autotests/persondatatests.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -34,13 +34,6 @@ QTEST_GUILESS_MAIN(PersonDataTests); -//the fake datasource is configured with - -//ID - NAME - email -//contact1 - Contact1 - conta...@example.com -//contact2 - PersonA - conta...@example.com -//contact3 - PersonA - conta...@example.com - using namespace KPeople; //this tests PersonData but also implicitly tests the private classes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/personsmodeltest.cpp new/kpeople-5.12.0/autotests/personsmodeltest.cpp --- old/kpeople-5.11.0/autotests/personsmodeltest.cpp 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/autotests/personsmodeltest.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -35,13 +35,6 @@ QTEST_GUILESS_MAIN(PersonsModelTest); -//the fake datasource is configured with - -//ID - NAME - email -//contact1 - Contact1 - conta...@example.com -//contact2 - PersonA - conta...@example.com -//contact3 - PersonA - conta...@example.com - using namespace KPeople; void PersonsModelTest::initTestCase() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/personsproxymodeltest.cpp new/kpeople-5.12.0/autotests/personsproxymodeltest.cpp --- old/kpeople-5.11.0/autotests/personsproxymodeltest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kpeople-5.12.0/autotests/personsproxymodeltest.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2015 Aleix Pol i Gonzalez <aleix...@blue-systems.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include "personsproxymodeltest.h" + +#include <QtTest> +#include <QFile> +#include <QTemporaryFile> +#include <QVariant> + +//private includes +#include "personmanager_p.h" +#include "personpluginmanager_p.h" + +//public kpeople includes +#include <personsmodel.h> +#include <personssortfilterproxymodel.h> + +#include "fakecontactsource.h" + +QTEST_GUILESS_MAIN(PersonsProxyModelTest); + +using namespace KPeople; + +void PersonsProxyModelTest::initTestCase() +{ + QVERIFY(m_database.open()); + + // Called before the first testfunction is executed + PersonManager::instance(m_database.fileName()); + m_source = new FakeContactSource(0); //don't own. PersonPluginManager removes it on destruction + QHash<QString, BasePersonsDataSource *> sources; + sources[QStringLiteral("fakesource")] = m_source; + PersonPluginManager::setDataSourcePlugins(sources); + + m_model = new KPeople::PersonsModel(this); + QSignalSpy modelInit(m_model, SIGNAL(modelInitialized(bool))); + + QTRY_COMPARE(modelInit.count(), 1); + QCOMPARE(modelInit.first().at(0).toBool(), true); +} + +void PersonsProxyModelTest::cleanupTestCase() +{ + // Called after the last testfunction was executed + m_database.close(); +} + +void PersonsProxyModelTest::testFiltering() +{ + PersonsSortFilterProxyModel proxy; + proxy.setSourceModel(m_model); + + QCOMPARE(proxy.rowCount(), 4); + + proxy.setRequiredProperties(QStringList() << AbstractContact::PhoneNumberProperty); + + QCOMPARE(proxy.rowCount(), 2); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/autotests/personsproxymodeltest.h new/kpeople-5.12.0/autotests/personsproxymodeltest.h --- old/kpeople-5.11.0/autotests/personsproxymodeltest.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kpeople-5.12.0/autotests/personsproxymodeltest.h 2015-07-05 11:11:07.000000000 +0200 @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2015 Aleix Pol i Gonzalez <aleix...@blue-systems.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef PERSONSPROXYMODELTEST_H +#define PERSONSPROXYMODELTEST_H + +#include <QObject> +#include <QTemporaryFile> + +class FakeContactSource; +namespace KPeople { class PersonsModel; } + +class PersonsProxyModelTest : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void initTestCase(); + void cleanupTestCase(); + + void testFiltering(); + +private: + FakeContactSource *m_source; + KPeople::PersonsModel* m_model; + QTemporaryFile m_database; +}; + +#endif // PERSONSMODELTEST_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/po/ast/kpeople5.po new/kpeople-5.12.0/po/ast/kpeople5.po --- old/kpeople-5.11.0/po/ast/kpeople5.po 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/po/ast/kpeople5.po 2015-07-05 11:11:07.000000000 +0200 @@ -7,9 +7,9 @@ "Project-Id-Version: \n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2015-02-27 09:45+0000\n" -"PO-Revision-Date: 2015-04-06 15:21+0100\n" -"Last-Translator: enolp <en...@softastur.org>\n" -"Language-Team: Asturian <kde-i18n-...@kde.org>\n" +"PO-Revision-Date: 2015-06-30 17:06+0100\n" +"Last-Translator: Enol P. <en...@softastur.org>\n" +"Language-Team: Asturian <alminsitrado...@softastur.org>\n" "Language: ast\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -18,63 +18,53 @@ "X-Generator: Lokalize 2.0\n" #: match.cpp:52 -#, fuzzy msgctxt "@title:column" msgid "Name" msgstr "Nome" #: match.cpp:55 -#, fuzzy msgctxt "@title:column" msgid "E-mail" msgstr "Corréu" #: widgets/mergedelegate.cpp:99 -#, fuzzy msgctxt "reasons join" msgid ", " msgstr ", " #: widgets/mergedelegate.cpp:99 -#, fuzzy, kde-format +#, kde-format msgctxt "name: merge reasons" msgid "%1: %2" msgstr "%1: %2" #: widgets/mergedialog.cpp:64 -#, fuzzy msgid "Duplicates Manager" msgstr "Xestor de duplicaos" #: widgets/mergedialog.cpp:73 -#, fuzzy msgid "Select contacts to be merged" msgstr "Esbilla los contautos pa mecer" #. i18n: ectx: property (text), widget (QLabel, avatarPixmapLabel) #: widgets/person-details-presentation.ui:43 -#, fuzzy msgid "Avatar" msgstr "Avatar" #: widgets/plugins/emaildetailswidget.cpp:50 -#, fuzzy msgctxt "E-mail field label" msgid "E-mail" msgstr "Corréu" #: widgets/plugins/mergecontactswidget.cpp:50 -#, fuzzy msgid "Show Merge Suggestions..." msgstr "Amosar suxerencies de mecíu..." #: widgets/plugins/mergecontactswidget.cpp:88 -#, fuzzy msgid "Merge with Selected Contacts" msgstr "Mecer colos contautos esbillaos" #: widgets/plugins/phonedetailswidget.cpp:38 -#, fuzzy msgctxt "Phone details title" msgid "Phone" msgstr "Teléfonu" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/po/ca/kpeople5.po new/kpeople-5.12.0/po/ca/kpeople5.po --- old/kpeople-5.11.0/po/ca/kpeople5.po 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/po/ca/kpeople5.po 2015-07-05 11:11:07.000000000 +0200 @@ -17,6 +17,7 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Accelerator-Marker: &\n" "X-Generator: Lokalize 1.5\n" #: match.cpp:52 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/src/CMakeLists.txt new/kpeople-5.12.0/src/CMakeLists.txt --- old/kpeople-5.11.0/src/CMakeLists.txt 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/src/CMakeLists.txt 2015-07-05 11:11:07.000000000 +0200 @@ -17,6 +17,7 @@ personsmodel.cpp personpluginmanager.cpp personmanager.cpp + personssortfilterproxymodel.cpp ) add_library(KF5::People ALIAS KF5People) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/src/backends/abstractcontact.cpp new/kpeople-5.12.0/src/backends/abstractcontact.cpp --- old/kpeople-5.11.0/src/backends/abstractcontact.cpp 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/src/backends/abstractcontact.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -22,6 +22,7 @@ const QString AbstractContact::NameProperty = QStringLiteral("name"); const QString AbstractContact::EmailProperty = QStringLiteral("email"); +const QString AbstractContact::PhoneNumberProperty = QStringLiteral("phoneNumber"); const QString AbstractContact::PresenceProperty = QStringLiteral("presence"); const QString AbstractContact::AllEmailsProperty = QStringLiteral("all-email"); const QString AbstractContact::PictureProperty = QStringLiteral("picture"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/src/backends/abstractcontact.h new/kpeople-5.12.0/src/backends/abstractcontact.h --- old/kpeople-5.11.0/src/backends/abstractcontact.h 2015-06-06 23:24:47.000000000 +0200 +++ new/kpeople-5.12.0/src/backends/abstractcontact.h 2015-07-05 11:11:07.000000000 +0200 @@ -50,6 +50,9 @@ /** String property representing the preferred name of the contact */ static const QString EmailProperty; + /** String property representing the preferred phone number of the contact */ + static const QString PhoneNumberProperty; + /** * String property representing the IM presence of the contact. * @sa KPeople::iconNameForPresenceString() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/src/personssortfilterproxymodel.cpp new/kpeople-5.12.0/src/personssortfilterproxymodel.cpp --- old/kpeople-5.11.0/src/personssortfilterproxymodel.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kpeople-5.12.0/src/personssortfilterproxymodel.cpp 2015-07-05 11:11:07.000000000 +0200 @@ -0,0 +1,69 @@ +/* + Copyright (C) 2015 Aleix Pol i Gonzalez <aleix...@blue-systems.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "personssortfilterproxymodel.h" +#include "backends/abstractcontact.h" +#include "personsmodel.h" + +namespace KPeople +{ + +class PersonsSortFilterProxyModelPrivate +{ +public: + QStringList m_keys; +}; + +PersonsSortFilterProxyModel::PersonsSortFilterProxyModel(QObject *parent) + : QSortFilterProxyModel(parent) + , d_ptr(new PersonsSortFilterProxyModelPrivate) +{} + +PersonsSortFilterProxyModel::~PersonsSortFilterProxyModel() +{} + +QStringList PersonsSortFilterProxyModel::requiredProperties() const +{ + Q_D(const PersonsSortFilterProxyModel); + return d->m_keys; +} + +void PersonsSortFilterProxyModel::setRequiredProperties(const QStringList &props) +{ + Q_D(PersonsSortFilterProxyModel); + d->m_keys = props; + invalidate(); +} + +bool PersonsSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const +{ + Q_D(const PersonsSortFilterProxyModel); + const QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); + Q_ASSERT(idx.isValid()); + + const AbstractContact::Ptr contact = idx.data(KPeople::PersonsModel::PersonVCardRole).value<AbstractContact::Ptr>(); + Q_ASSERT(contact); + foreach(const QString &key, d->m_keys) { + if (contact->customProperty(key).isNull()) + return false; + } + + return true; +} + +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kpeople-5.11.0/src/personssortfilterproxymodel.h new/kpeople-5.12.0/src/personssortfilterproxymodel.h --- old/kpeople-5.11.0/src/personssortfilterproxymodel.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kpeople-5.12.0/src/personssortfilterproxymodel.h 2015-07-05 11:11:07.000000000 +0200 @@ -0,0 +1,62 @@ +/* + Copyright (C) 2015 Aleix Pol i Gonzalez <aleix...@blue-systems.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef PERSONSSORTFILTERMODEL_H +#define PERSONSSORTFILTERMODEL_H + +#include <QScopedPointer> +#include <QSortFilterProxyModel> +#include <kpeople/kpeople_export.h> + +namespace KPeople +{ + +class PersonsSortFilterProxyModelPrivate; + +/** + * Helps filtering and sorting PresonsModel + * + * Especially useful for creating interfaces around specific properties rather + * than the complete set as a whole. + * + * @sa PersonsModel + */ +class KPEOPLE_EXPORT PersonsSortFilterProxyModel : public QSortFilterProxyModel +{ +Q_OBJECT +/** Specifies the properties that should be provided by the contact for the contact to be shown. */ +Q_PROPERTY(QStringList requiredProperties READ requiredProperties WRITE setRequiredProperties) +public: + PersonsSortFilterProxyModel(QObject *parent = Q_NULLPTR); + ~PersonsSortFilterProxyModel(); + + QStringList requiredProperties() const; + void setRequiredProperties(const QStringList &props); + + bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(PersonsSortFilterProxyModel) + + QScopedPointer<PersonsSortFilterProxyModelPrivate> const d_ptr; + Q_DECLARE_PRIVATE(PersonsSortFilterProxyModel); +}; + +} + +#endif // PERSONSSORTFILTERMODEL_H