summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/mail/contents/ui/Mail.qml1
-rw-r--r--components/package/contents/ui/MailListView.qml11
-rw-r--r--components/package/contents/ui/People.qml5
-rw-r--r--framework/domain/maillistmodel.cpp11
-rw-r--r--framework/domain/maillistmodel.h4
-rw-r--r--framework/domain/peoplemodel.cpp11
-rw-r--r--framework/domain/peoplemodel.h4
7 files changed, 45 insertions, 2 deletions
diff --git a/components/mail/contents/ui/Mail.qml b/components/mail/contents/ui/Mail.qml
index 1ae4062d..c5078877 100644
--- a/components/mail/contents/ui/Mail.qml
+++ b/components/mail/contents/ui/Mail.qml
@@ -395,6 +395,7 @@ Controls2.ApplicationWindow {
395 anchors.fill: parent 395 anchors.fill: parent
396 396
397 Controls2.TextField { 397 Controls2.TextField {
398 id: searchField
398 Layout.fillWidth: true 399 Layout.fillWidth: true
399 placeholderText: "Search... is not available in this beta" 400 placeholderText: "Search... is not available in this beta"
400 } 401 }
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml
index 35fd4ec9..97c1a0d4 100644
--- a/components/package/contents/ui/MailListView.qml
+++ b/components/package/contents/ui/MailListView.qml
@@ -31,6 +31,7 @@ Item {
31 property variant currentMail: null 31 property variant currentMail: null
32 property bool isDraft : false 32 property bool isDraft : false
33 property int currentIndex 33 property int currentIndex
34 property string filterString: searchBar.text;
34 35
35 onParentFolderChanged: { 36 onParentFolderChanged: {
36 currentMail = null 37 currentMail = null
@@ -88,10 +89,17 @@ Item {
88 } 89 }
89 } 90 }
90 91
92 TextField {
93 id: searchBar
94 anchors.top: toolbar.bottom
95 width: parent.width
96 placeholderText: qsTr("Filter...")
97 }
98
91 ListView { 99 ListView {
92 id: listView 100 id: listView
93 101
94 anchors.top: toolbar.bottom 102 anchors.top: searchBar.bottom
95 103
96 width: parent.width 104 width: parent.width
97 height: parent.height - toolbar.height 105 height: parent.height - toolbar.height
@@ -120,6 +128,7 @@ Item {
120 128
121 model: KubeFramework.MailListModel { 129 model: KubeFramework.MailListModel {
122 parentFolder: root.parentFolder 130 parentFolder: root.parentFolder
131 filter: root.filterString
123 } 132 }
124 133
125 delegate: Item { 134 delegate: Item {
diff --git a/components/package/contents/ui/People.qml b/components/package/contents/ui/People.qml
index f280e45b..de8425df 100644
--- a/components/package/contents/ui/People.qml
+++ b/components/package/contents/ui/People.qml
@@ -55,6 +55,7 @@ Popup {
55 } 55 }
56 56
57 TextField { 57 TextField {
58 id: searchBar
58 anchors.centerIn: parent 59 anchors.centerIn: parent
59 60
60 placeholderText: "Search..." 61 placeholderText: "Search..."
@@ -122,7 +123,9 @@ Popup {
122 123
123 Repeater { 124 Repeater {
124 125
125 model: KubeFramework.PeopleModel{} 126 model: KubeFramework.PeopleModel {
127 filter: searchBar.text
128 }
126 129
127 delegate: Rectangle { 130 delegate: Rectangle {
128 id: delegateRoot 131 id: delegateRoot
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
32MailListModel::~MailListModel() 33MailListModel::~MailListModel()
@@ -34,6 +35,16 @@ MailListModel::~MailListModel()
34 35
35} 36}
36 37
38void MailListModel::setFilter(const QString &filter)
39{
40 setFilterWildcard(filter);
41}
42
43QString MailListModel::filter() const
44{
45 return {};
46}
47
37QHash< int, QByteArray > MailListModel::roleNames() const 48QHash< 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
35public: 36public:
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
73private: 77private:
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
47void PeopleModel::setFilter(const QString &filter)
48{
49 setFilterWildcard(filter);
50}
51
52QString PeopleModel::filter() const
53{
54 return {};
55}
56
46QHash< int, QByteArray > PeopleModel::roleNames() const 57QHash< 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
38public: 39public:
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
63private: 67private:
64 QSharedPointer<QAbstractItemModel> mModel; 68 QSharedPointer<QAbstractItemModel> mModel;
65}; 69};