diff options
Diffstat (limited to 'views')
-rw-r--r-- | views/calendar/main.qml | 92 | ||||
-rw-r--r-- | views/calendar/metadata.json | 4 | ||||
-rw-r--r-- | views/calendar/qml/DaylongEvents.qml | 16 | ||||
-rw-r--r-- | views/calendar/qml/View.qml | 141 | ||||
-rw-r--r-- | views/calendar/qml/WeekEvents.qml | 65 | ||||
-rw-r--r-- | views/calendar/tests/tst_calendar.qml | 36 |
6 files changed, 354 insertions, 0 deletions
diff --git a/views/calendar/main.qml b/views/calendar/main.qml new file mode 100644 index 00000000..4065b876 --- /dev/null +++ b/views/calendar/main.qml | |||
@@ -0,0 +1,92 @@ | |||
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 | |||
19 | import QtQuick 2.7 | ||
20 | import QtQuick.Controls 2.0 | ||
21 | import QtQuick.Window 2.0 | ||
22 | |||
23 | import org.kube.framework 1.0 as Kube | ||
24 | import org.kube.test 1.0 | ||
25 | import "qml" | ||
26 | |||
27 | ApplicationWindow { | ||
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 | specialpurpose: ["inbox"], | ||
58 | mails: [{ | ||
59 | resource: "resource1", | ||
60 | messageId: "<msg1@test.com>", | ||
61 | date: "2017-07-24T15:46:29", | ||
62 | subject: "subject1", | ||
63 | body: "body", | ||
64 | to: ["to@example.org"], | ||
65 | cc: ["cc@example.org"], | ||
66 | bcc: ["bcc@example.org"], | ||
67 | }, | ||
68 | { | ||
69 | resource: "resource1", | ||
70 | inReplyTo: "<msg1@test.com>", | ||
71 | date: "2017-07-24T16:46:29", | ||
72 | subject: "subject2", | ||
73 | body: "body2", | ||
74 | to: ["to@example.org"], | ||
75 | }, | ||
76 | { | ||
77 | resource: "resource1", | ||
78 | date: "2017-07-24T18:46:29", | ||
79 | subject: "subject4", | ||
80 | body: "body4", | ||
81 | to: ["to@example.org"], | ||
82 | }, | ||
83 | ] | ||
84 | }], | ||
85 | } | ||
86 | TestStore.setup(initialState) | ||
87 | } | ||
88 | |||
89 | View { | ||
90 | anchors.fill: parent | ||
91 | } | ||
92 | } | ||
diff --git a/views/calendar/metadata.json b/views/calendar/metadata.json new file mode 100644 index 00000000..669f85a6 --- /dev/null +++ b/views/calendar/metadata.json | |||
@@ -0,0 +1,4 @@ | |||
1 | { | ||
2 | "icon": "mail-task", | ||
3 | "tooltip": "Get things done!" | ||
4 | } | ||
diff --git a/views/calendar/qml/DaylongEvents.qml b/views/calendar/qml/DaylongEvents.qml new file mode 100644 index 00000000..340c9d79 --- /dev/null +++ b/views/calendar/qml/DaylongEvents.qml | |||
@@ -0,0 +1,16 @@ | |||
1 | import QtQuick 2.7 | ||
2 | |||
3 | ListModel { | ||
4 | ListElement { | ||
5 | color: "#af1a6a" | ||
6 | starts: 1 | ||
7 | duration: 4 | ||
8 | text: "Baustelle Adalbertstr." | ||
9 | } | ||
10 | ListElement { | ||
11 | color: "#134bab" | ||
12 | starts: 0 | ||
13 | duration: 6 | ||
14 | text: "Urlaub" | ||
15 | } | ||
16 | } | ||
diff --git a/views/calendar/qml/View.qml b/views/calendar/qml/View.qml new file mode 100644 index 00000000..1b72881d --- /dev/null +++ b/views/calendar/qml/View.qml | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Michael Bohlender, <bohlender@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 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Controls 2.0 | ||
22 | import Qt.labs.calendar 1.0 | ||
23 | |||
24 | import org.kube.framework 1.0 as Kube | ||
25 | |||
26 | FocusScope { | ||
27 | id: root | ||
28 | |||
29 | property var month: Calendar.March | ||
30 | property var year: 2017 | ||
31 | |||
32 | |||
33 | Column { | ||
34 | anchors.centerIn: parent | ||
35 | |||
36 | DayOfWeekRow { | ||
37 | |||
38 | anchors.horizontalCenter: parent.horizontalCenter | ||
39 | |||
40 | spacing: 0 | ||
41 | locale: Qt.locale("de") | ||
42 | |||
43 | delegate: Rectangle { | ||
44 | width: Kube.Units.gridUnit * 7 | ||
45 | height: Kube.Units.gridUnit + Kube.Units.smallSpacing * 3 | ||
46 | |||
47 | border.width: 1 | ||
48 | border.color: "lightgrey" | ||
49 | color: Kube.Colors.viewBackgroundColor | ||
50 | |||
51 | Kube.Label { | ||
52 | anchors { | ||
53 | top: parent.top | ||
54 | left: parent.left | ||
55 | margins: Kube.Units.smallSpacing | ||
56 | } | ||
57 | text: model.shortName | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | |||
62 | Rectangle { | ||
63 | height: Kube.Units.gridUnit * 3 | ||
64 | width: parent.width | ||
65 | color: Kube.Colors.viewBackgroundColor | ||
66 | |||
67 | ListView { | ||
68 | id: daylong | ||
69 | |||
70 | anchors.fill: parent | ||
71 | |||
72 | model: DaylongEvents {} | ||
73 | |||
74 | delegate: Item { | ||
75 | height: Kube.Units.gridUnit | ||
76 | width: daylong.width | ||
77 | |||
78 | Rectangle { | ||
79 | width: Kube.Units.gridUnit * 7 * model.duration | ||
80 | height: Kube.Units.gridUnit | ||
81 | x: Kube.Units.gridUnit * 7 * model.starts | ||
82 | color: model.color | ||
83 | |||
84 | Kube.Label { | ||
85 | anchors { | ||
86 | left: parent.left | ||
87 | leftMargin: Kube.Units.smallSpacing | ||
88 | } | ||
89 | color: Kube.Colors.highlightedTextColor | ||
90 | text: model.text | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } | ||
95 | } | ||
96 | |||
97 | RowLayout { | ||
98 | |||
99 | anchors.horizontalCenter: parent.horizontalCenter | ||
100 | |||
101 | spacing: 0 | ||
102 | |||
103 | Repeater { | ||
104 | model: WeekEvents{} | ||
105 | delegate: Rectangle { | ||
106 | id: day | ||
107 | |||
108 | property var events: model.events | ||
109 | |||
110 | width: Kube.Units.gridUnit * 7 | ||
111 | height: Kube.Units.gridUnit * 20 | ||
112 | |||
113 | border.width: 1 | ||
114 | border.color: "lightgrey" | ||
115 | color: Kube.Colors.viewBackgroundColor | ||
116 | |||
117 | Repeater { | ||
118 | model: parent.events | ||
119 | |||
120 | delegate: Rectangle { | ||
121 | anchors.horizontalCenter: parent.horizontalCenter | ||
122 | width: parent.width - Kube.Units.smallSpacing * 2 | ||
123 | height: Kube.Units.gridUnit * duration | ||
124 | y: Kube.Units.gridUnit * starts | ||
125 | color: model.color | ||
126 | |||
127 | Kube.Label { | ||
128 | anchors { | ||
129 | left: parent.left | ||
130 | leftMargin: Kube.Units.smallSpacing | ||
131 | } | ||
132 | text: model.text | ||
133 | color: Kube.Colors.highlightedTextColor | ||
134 | } | ||
135 | } | ||
136 | } | ||
137 | } | ||
138 | } | ||
139 | } | ||
140 | } | ||
141 | } | ||
diff --git a/views/calendar/qml/WeekEvents.qml b/views/calendar/qml/WeekEvents.qml new file mode 100644 index 00000000..b08c00a5 --- /dev/null +++ b/views/calendar/qml/WeekEvents.qml | |||
@@ -0,0 +1,65 @@ | |||
1 | import QtQuick 2.7 | ||
2 | |||
3 | ListModel { | ||
4 | ListElement { | ||
5 | events: [ | ||
6 | ListElement { | ||
7 | color: "#af1a6a" | ||
8 | starts: 1 | ||
9 | duration: 4 | ||
10 | text: "Meeting" | ||
11 | }, | ||
12 | ListElement { | ||
13 | color: "#134bab" | ||
14 | starts: 9 | ||
15 | duration: 5 | ||
16 | text: "Sport" | ||
17 | } | ||
18 | ] | ||
19 | } | ||
20 | ListElement { | ||
21 | events: [ | ||
22 | ListElement { | ||
23 | color: "#134bab" | ||
24 | starts: 9 | ||
25 | duration: 5 | ||
26 | text: "Sport" | ||
27 | } | ||
28 | ] | ||
29 | } | ||
30 | ListElement { | ||
31 | events: [] | ||
32 | } | ||
33 | ListElement { | ||
34 | events: [ | ||
35 | ListElement { | ||
36 | color: "#af1a6a" | ||
37 | starts: 1 | ||
38 | duration: 4 | ||
39 | text: "Meeting" | ||
40 | } | ||
41 | ] | ||
42 | } | ||
43 | ListElement { | ||
44 | events: [ | ||
45 | ListElement { | ||
46 | color: "#af1a6a" | ||
47 | starts: 3 | ||
48 | duration: 5 | ||
49 | text: "Meeting" | ||
50 | }, | ||
51 | ListElement { | ||
52 | color: "#af1a6a" | ||
53 | starts: 9 | ||
54 | duration: 4 | ||
55 | text: "Meeting2" | ||
56 | } | ||
57 | ] | ||
58 | } | ||
59 | ListElement { | ||
60 | events: [] | ||
61 | } | ||
62 | ListElement { | ||
63 | events: [] | ||
64 | } | ||
65 | } | ||
diff --git a/views/calendar/tests/tst_calendar.qml b/views/calendar/tests/tst_calendar.qml new file mode 100644 index 00000000..46f7dba2 --- /dev/null +++ b/views/calendar/tests/tst_calendar.qml | |||
@@ -0,0 +1,36 @@ | |||
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 | |||
20 | import QtQuick 2.7 | ||
21 | import QtTest 1.0 | ||
22 | import "../qml" | ||
23 | |||
24 | TestCase { | ||
25 | width: 400 | ||
26 | height: 400 | ||
27 | name: "Todo" | ||
28 | |||
29 | View { | ||
30 | id: view | ||
31 | } | ||
32 | |||
33 | function test_start() { | ||
34 | verify(view) | ||
35 | } | ||
36 | } | ||