diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-21 12:11:49 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-03-21 12:11:49 +0100 |
commit | 0c91d01eb26793e745138c4598cf15d9a21c0136 (patch) | |
tree | 53ffeb02eaf1625598e937444430e4040e17b0a4 /framework/domain | |
parent | ed09c7689f7435761611cbfd3cda98bbd79c3a5e (diff) | |
download | kube-0c91d01eb26793e745138c4598cf15d9a21c0136.tar.gz kube-0c91d01eb26793e745138c4598cf15d9a21c0136.zip |
Filtering for maillistmodel and peoplemodel
Works surprisingly well and is very useful for testing.
The searchbar in the maillistmodel is a temporary solution as the global
searchbar has some usability issues. E.g. how do we reset the search?
As an intermediate step we could just hide the searchbar and make it
visible by clicking on the search button.
Diffstat (limited to 'framework/domain')
-rw-r--r-- | framework/domain/maillistmodel.cpp | 11 | ||||
-rw-r--r-- | framework/domain/maillistmodel.h | 4 | ||||
-rw-r--r-- | framework/domain/peoplemodel.cpp | 11 | ||||
-rw-r--r-- | framework/domain/peoplemodel.h | 4 |
4 files changed, 30 insertions, 0 deletions
diff --git a/framework/domain/maillistmodel.cpp b/framework/domain/maillistmodel.cpp index 11fb9f82..5a462021 100644 --- a/framework/domain/maillistmodel.cpp +++ b/framework/domain/maillistmodel.cpp | |||
@@ -27,6 +27,7 @@ MailListModel::MailListModel(QObject *parent) | |||
27 | { | 27 | { |
28 | setDynamicSortFilter(true); | 28 | setDynamicSortFilter(true); |
29 | sort(0, Qt::DescendingOrder); | 29 | sort(0, Qt::DescendingOrder); |
30 | setFilterCaseSensitivity(Qt::CaseInsensitive); | ||
30 | } | 31 | } |
31 | 32 | ||
32 | MailListModel::~MailListModel() | 33 | MailListModel::~MailListModel() |
@@ -34,6 +35,16 @@ MailListModel::~MailListModel() | |||
34 | 35 | ||
35 | } | 36 | } |
36 | 37 | ||
38 | void MailListModel::setFilter(const QString &filter) | ||
39 | { | ||
40 | setFilterWildcard(filter); | ||
41 | } | ||
42 | |||
43 | QString MailListModel::filter() const | ||
44 | { | ||
45 | return {}; | ||
46 | } | ||
47 | |||
37 | QHash< int, QByteArray > MailListModel::roleNames() const | 48 | QHash< int, QByteArray > MailListModel::roleNames() const |
38 | { | 49 | { |
39 | QHash<int, QByteArray> roles; | 50 | QHash<int, QByteArray> roles; |
diff --git a/framework/domain/maillistmodel.h b/framework/domain/maillistmodel.h index 5526a991..316ff4c6 100644 --- a/framework/domain/maillistmodel.h +++ b/framework/domain/maillistmodel.h | |||
@@ -31,6 +31,7 @@ class MailListModel : public QSortFilterProxyModel | |||
31 | Q_OBJECT | 31 | Q_OBJECT |
32 | Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) | 32 | Q_PROPERTY (QVariant parentFolder READ parentFolder WRITE setParentFolder) |
33 | Q_PROPERTY (QVariant mail READ mail WRITE setMail) | 33 | Q_PROPERTY (QVariant mail READ mail WRITE setMail) |
34 | Q_PROPERTY (QString filter READ filter WRITE setFilter) | ||
34 | 35 | ||
35 | public: | 36 | public: |
36 | MailListModel(QObject *parent = Q_NULLPTR); | 37 | MailListModel(QObject *parent = Q_NULLPTR); |
@@ -70,6 +71,9 @@ public: | |||
70 | void setMail(const QVariant &mail); | 71 | void setMail(const QVariant &mail); |
71 | QVariant mail() const; | 72 | QVariant mail() const; |
72 | 73 | ||
74 | void setFilter(const QString &mail); | ||
75 | QString filter() const; | ||
76 | |||
73 | private: | 77 | private: |
74 | void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); | 78 | void fetchMail(Sink::ApplicationDomain::Mail::Ptr mail); |
75 | 79 | ||
diff --git a/framework/domain/peoplemodel.cpp b/framework/domain/peoplemodel.cpp index d33c6703..ef2cc9a0 100644 --- a/framework/domain/peoplemodel.cpp +++ b/framework/domain/peoplemodel.cpp | |||
@@ -29,6 +29,7 @@ PeopleModel::PeopleModel(QObject *parent) | |||
29 | 29 | ||
30 | setDynamicSortFilter(true); | 30 | setDynamicSortFilter(true); |
31 | sort(0, Qt::DescendingOrder); | 31 | sort(0, Qt::DescendingOrder); |
32 | setFilterCaseSensitivity(Qt::CaseInsensitive); | ||
32 | Sink::Query query; | 33 | Sink::Query query; |
33 | query.setFlags(Sink::Query::LiveQuery); | 34 | query.setFlags(Sink::Query::LiveQuery); |
34 | query.request<Contact::Fn>(); | 35 | query.request<Contact::Fn>(); |
@@ -43,6 +44,16 @@ PeopleModel::~PeopleModel() | |||
43 | 44 | ||
44 | } | 45 | } |
45 | 46 | ||
47 | void PeopleModel::setFilter(const QString &filter) | ||
48 | { | ||
49 | setFilterWildcard(filter); | ||
50 | } | ||
51 | |||
52 | QString PeopleModel::filter() const | ||
53 | { | ||
54 | return {}; | ||
55 | } | ||
56 | |||
46 | QHash< int, QByteArray > PeopleModel::roleNames() const | 57 | QHash< int, QByteArray > PeopleModel::roleNames() const |
47 | { | 58 | { |
48 | static QHash<int, QByteArray> roles = { | 59 | static QHash<int, QByteArray> roles = { |
diff --git a/framework/domain/peoplemodel.h b/framework/domain/peoplemodel.h index 1e9d2d01..a59e752c 100644 --- a/framework/domain/peoplemodel.h +++ b/framework/domain/peoplemodel.h | |||
@@ -34,6 +34,7 @@ class PeopleModel : public QSortFilterProxyModel | |||
34 | { | 34 | { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | Q_PROPERTY (QVariant addressbook READ addressbook WRITE setAddressbook) | 36 | Q_PROPERTY (QVariant addressbook READ addressbook WRITE setAddressbook) |
37 | Q_PROPERTY (QString filter READ filter WRITE setFilter) | ||
37 | 38 | ||
38 | public: | 39 | public: |
39 | PeopleModel(QObject *parent = Q_NULLPTR); | 40 | PeopleModel(QObject *parent = Q_NULLPTR); |
@@ -60,6 +61,9 @@ public: | |||
60 | void setAddressbook(const QVariant &parentFolder); | 61 | void setAddressbook(const QVariant &parentFolder); |
61 | QVariant addressbook() const; | 62 | QVariant addressbook() const; |
62 | 63 | ||
64 | void setFilter(const QString &mail); | ||
65 | QString filter() const; | ||
66 | |||
63 | private: | 67 | private: |
64 | QSharedPointer<QAbstractItemModel> mModel; | 68 | QSharedPointer<QAbstractItemModel> mModel; |
65 | }; | 69 | }; |