summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--views/CMakeLists.txt1
-rw-r--r--views/search/main.qml100
-rw-r--r--views/search/metadata.json4
-rw-r--r--views/search/qml/View.qml39
-rw-r--r--views/search/tests/tst_searchview.qml120
5 files changed, 264 insertions, 0 deletions
diff --git a/views/CMakeLists.txt b/views/CMakeLists.txt
index 5b19620d..565b48b0 100644
--- a/views/CMakeLists.txt
+++ b/views/CMakeLists.txt
@@ -9,6 +9,7 @@ install_view(conversation)
9install_view(people) 9install_view(people)
10install_view(log) 10install_view(log)
11install_view(accounts) 11install_view(accounts)
12install_view(search)
12if (${EXPERIMENTAL_VIEWS}) 13if (${EXPERIMENTAL_VIEWS})
13 install_view(inboxcrusher) 14 install_view(inboxcrusher)
14endif() 15endif()
diff --git a/views/search/main.qml b/views/search/main.qml
new file mode 100644
index 00000000..06b59b42
--- /dev/null
+++ b/views/search/main.qml
@@ -0,0 +1,100 @@
1/*
2 * Copyright (C) 2018 Christian Mollekopf, <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19import QtQuick 2.7
20import QtQuick.Controls 2.0
21import QtQuick.Window 2.0
22
23import org.kube.framework 1.0 as Kube
24import org.kube.test 1.0
25import "qml"
26
27ApplicationWindow {
28 id: app
29 height: Screen.desktopAvailableHeight * 0.8
30 width: Screen.desktopAvailableWidth * 0.8
31
32 Component.onCompleted: {
33 var initialState = {
34 accounts: [{
35 id: "account1",
36 name: "Test Account"
37 }],
38 identities: [{
39 account: "account1",
40 name: "Test Identity",
41 address: "identity@example.org"
42 }],
43 resources: [{
44 id: "resource1",
45 account: "account1",
46 type: "dummy"
47 },
48 {
49 id: "resource2",
50 account: "account1",
51 type: "mailtransport"
52 }],
53 folders: [{
54 id: "folder1",
55 resource: "resource1",
56 name: "Folder 1",
57 mails: [{
58 resource: "resource1",
59 messageId: "<msg1@test.com>",
60 date: "2017-07-24T15:46:29",
61 subject: "subject1",
62 body: "body",
63 to: ["to@example.org"],
64 cc: ["cc@example.org"],
65 bcc: ["bcc@example.org"],
66 },
67 {
68 resource: "resource1",
69 inReplyTo: "<msg1@test.com>",
70 date: "2017-07-24T16:46:29",
71 subject: "subject2",
72 body: "body2",
73 to: ["to@example.org"],
74 },
75 {
76 resource: "resource1",
77 inReplyTo: "<msg1@test.com>",
78 date: "2017-07-24T17:46:29",
79 subject: "subject3",
80 body: "body3\n\n\n\nfoo\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nThe End",
81 to: ["to@example.org"],
82 },
83 {
84 resource: "resource1",
85 inReplyTo: "<msg1@test.com>",
86 date: "2017-07-24T18:46:29",
87 subject: "subject4",
88 body: "body4",
89 to: ["to@example.org"],
90 },
91 ]
92 }],
93 }
94 TestStore.setup(initialState)
95 }
96
97 View {
98 anchors.fill: parent
99 }
100}
diff --git a/views/search/metadata.json b/views/search/metadata.json
new file mode 100644
index 00000000..870ff2aa
--- /dev/null
+++ b/views/search/metadata.json
@@ -0,0 +1,4 @@
1{
2 "icon": "mail-message-inverted",
3 "tooltip": "Follow conversations."
4}
diff --git a/views/search/qml/View.qml b/views/search/qml/View.qml
new file mode 100644
index 00000000..d2c8ae65
--- /dev/null
+++ b/views/search/qml/View.qml
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 * Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20
21import QtQuick 2.7
22import QtQuick.Controls 1.3
23import QtQuick.Controls 2.0 as Controls2
24import QtQuick.Layouts 1.1
25
26import org.kube.framework 1.0 as Kube
27
28FocusScope {
29 Rectangle {
30 anchors.fill: parent
31 Kube.MailListView {
32 id: mailListView
33 anchors.fill: parent
34 activeFocusOnTab: true
35 Layout.minimumWidth: Kube.Units.gridUnit * 10
36 }
37 }
38 }
39}
diff --git a/views/search/tests/tst_searchview.qml b/views/search/tests/tst_searchview.qml
new file mode 100644
index 00000000..610c28b3
--- /dev/null
+++ b/views/search/tests/tst_searchview.qml
@@ -0,0 +1,120 @@
1/*
2 * Copyright 2017 Christian Mollekopf <mollekopf@kolabsys.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.7
21import QtTest 1.0
22import "../qml"
23import org.kube.framework 1.0 as Kube
24import org.kube.test 1.0
25
26TestCase {
27 id: testCase
28 width: 400
29 height: 400
30 name: "MailView"
31
32 Component {
33 id: mailViewComponent
34 View {
35 focus: true
36 }
37 }
38
39 function test_1start() {
40 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
41 verify(mailView)
42 }
43
44 function test_2verifyInitialFocus() {
45 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
46 var newMailButton = findChild(mailView, "newMailButton");
47 verify(newMailButton)
48 // verify(newMailButton.activeFocus)
49 }
50
51 function test_3selectMessage() {
52 var initialState = {
53 accounts: [{
54 id: "account1",
55 name: "Test Account"
56 }],
57 identities: [{
58 account: "account1",
59 name: "Test Identity",
60 address: "identity@example.org"
61 }],
62 resources: [{
63 id: "resource1",
64 account: "account1",
65 type: "dummy"
66 },
67 {
68 id: "resource2",
69 account: "account1",
70 type: "mailtransport"
71 }],
72 folders: [{
73 id: "folder1",
74 resource: "resource1",
75 name: "Folder 1",
76 specialpurpose: ["inbox"],
77 mails: [{
78 resource: "resource1",
79 subject: "subject1",
80 body: "body",
81 to: ["to@example.org"],
82 cc: ["cc@example.org"],
83 bcc: ["bcc@example.org"],
84 draft: true
85 },
86 {
87 resource: "resource1",
88 subject: "subject2",
89 body: "body",
90 to: ["to@example.org"],
91 cc: ["cc@example.org"],
92 bcc: ["bcc@example.org"],
93 draft: true
94 }
95 ],
96 }],
97 }
98 TestStore.setup(initialState)
99 var mailView = createTemporaryObject(mailViewComponent, testCase, {})
100 var folderListView = findChild(mailView, "folderListView");
101 verify(folderListView)
102
103 var folder = TestStore.load("folder", {resource: "resource1"})
104 verify(folder)
105
106 Kube.Fabric.postMessage(Kube.Messages.folderSelection, {"folder": folder, "trash": false});
107
108 var mailListView = findChild(mailView, "mailListView");
109 verify(mailListView)
110 var listView = findChild(mailListView, "listView");
111 verify(listView)
112 tryCompare(listView, "count", 2)
113
114 var conversationView = findChild(mailView, "mailView");
115 verify(conversationView)
116 var listView = findChild(conversationView, "listView");
117 verify(listView)
118 // tryCompare(listView, "count", 2)
119 }
120}