summaryrefslogtreecommitdiffstats
path: root/components/package
diff options
context:
space:
mode:
Diffstat (limited to 'components/package')
-rw-r--r--components/package/contents/ui/AccountSwitcher.qml102
-rw-r--r--components/package/contents/ui/FolderListView.qml19
-rw-r--r--components/package/contents/ui/MailListView.qml199
-rw-r--r--components/package/contents/ui/People.qml133
-rw-r--r--components/package/contents/ui/SingleMailView.qml4
5 files changed, 337 insertions, 120 deletions
diff --git a/components/package/contents/ui/AccountSwitcher.qml b/components/package/contents/ui/AccountSwitcher.qml
index 6d1c0aa2..eb5702e0 100644
--- a/components/package/contents/ui/AccountSwitcher.qml
+++ b/components/package/contents/ui/AccountSwitcher.qml
@@ -1,20 +1,20 @@
1/* 1/*
2 Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net> 2 * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
3 3 *
4 This program is free software; you can redistribute it and/or modify 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 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 6 * the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version. 7 * (at your option) any later version.
8 8 *
9 This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 * GNU General Public License for more details.
13 13 *
14 You should have received a copy of the GNU General Public License along 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., 15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17*/ 17 */
18 18
19import QtQuick 2.4 19import QtQuick 2.4
20import QtQuick.Layouts 1.1 20import QtQuick.Layouts 1.1
@@ -29,74 +29,78 @@ import org.kube.framework.domain 1.0 as KubeFramework
29import org.kube.framework.accounts 1.0 as KubeAccounts 29import org.kube.framework.accounts 1.0 as KubeAccounts
30import org.kube.components 1.0 as KubeComponents 30import org.kube.components 1.0 as KubeComponents
31 31
32Controls2.Button { 32Controls.ToolButton {
33 id: accountSwitcher 33 id: accountSwitcher
34 34
35 property variant accountId 35 property variant accountId
36 property variant accountName
37
38 width: parent.width
36 39
37 KubeFramework.FolderController { 40 KubeFramework.FolderController {
38 id: folderController 41 id: folderController
39 } 42 }
40 43
41 text: "Accounts" 44 KubeAccounts.AccountsModel {
45 id: accountsModel
46 }
47
42 48
43 onClicked: { 49 onClicked: {
44 popup.open() 50 popup.open()
45 focus = false
46 } 51 }
47 52
48 Controls2.Popup { 53 Controls2.Popup {
49 id: popup 54 id: popup
50 55
51 height: 300 56 height: listView.count == 0 ? Kirigami.Units.gridUnit * 4 : Kirigami.Units.gridUnit * 2 + listView.count * Kirigami.Units.gridUnit * 3
52 width: 600 57 width: Kirigami.Units.gridUnit * 20
53 58
54 x: 0 59 y: accountSwitcher.height
55 y: - popup.height
56 60
57 modal: true 61 modal: true
58 focus: true 62 focus: true
59 closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent 63 closePolicy: Controls2.Popup.CloseOnEscape | Controls2.Popup.CloseOnPressOutsideParent
60 64
61 Item { 65 Item {
62 id: footer 66 id: buttons
63
64 anchors { 67 anchors {
65 bottom: parent.bottom 68 bottom: parent.bottom
66 left: parent.left
67 right: parent.right
68 margins: Kirigami.Units.largeSpacing
69 } 69 }
70 70
71 height: Kirigami.Units.gridUnit + Kirigami.Units.smallSpacing * 1 71 height: Kirigami.Units.gridUnit * 2
72 width: listView.width 72 width: parent.width
73 73
74 Controls2.Button { 74 Controls2.Button {
75 75
76
76 anchors { 77 anchors {
77 verticalCenter: parent.verticalCenter 78 left: parent.left
78 right: parent.right 79 bottom: parent.bottom
79 } 80 }
80 81
81 text: "Create new Account"
82 82
83 //iconName: "view-refresh"
84 text: "Sync"
85 enabled: folderController.synchronizeAction.enabled
83 onClicked: { 86 onClicked: {
84 accountWizard.open() 87 folderController.synchronizeAction.execute()
85 popup.close() 88 popup.close()
86 } 89 }
87 } 90 }
88 91
89 Controls2.Button { 92 Controls2.Button {
93 id: newAccountButton
94
90 anchors { 95 anchors {
91 verticalCenter: parent.verticalCenter 96 right: parent.right
92 left: parent.left 97 bottom: parent.bottom
93 } 98 }
94 99
95 //iconName: "view-refresh" 100 text: "Create new Account"
96 text: "Sync" 101
97 enabled: folderController.synchronizeAction.enabled
98 onClicked: { 102 onClicked: {
99 folderController.synchronizeAction.execute() 103 accountWizard.open()
100 popup.close() 104 popup.close()
101 } 105 }
102 } 106 }
@@ -107,15 +111,14 @@ Controls2.Button {
107 111
108 anchors { 112 anchors {
109 top: parent.top 113 top: parent.top
110 bottom: footer.top 114 bottom: buttons.top
111 left: parent.left 115 left: parent.left
112 right: parent.right 116 right: parent.right
113 margins: Kirigami.Units.smallSpacing
114 } 117 }
115 118
116 clip: true 119 clip: true
117 120
118 model: KubeAccounts.AccountsModel { } 121 model: accountsModel
119 122
120 delegate: Kirigami.AbstractListItem { 123 delegate: Kirigami.AbstractListItem {
121 id: accountDelegate 124 id: accountDelegate
@@ -141,6 +144,13 @@ Controls2.Button {
141 value: model.accountId 144 value: model.accountId
142 } 145 }
143 146
147 QtQml.Binding {
148 target: accountSwitcher
149 property: "accountName"
150 when: listView.currentIndex == index
151 value: model.name
152 }
153
144 RowLayout { 154 RowLayout {
145 anchors { 155 anchors {
146 verticalCenter: parent.verticalCenter 156 verticalCenter: parent.verticalCenter
@@ -155,9 +165,9 @@ Controls2.Button {
155 accountId: model.accountId 165 accountId: model.accountId
156 } 166 }
157 167
158// Kirigami.Icon { 168 // Kirigami.Icon {
159// source: model.icon 169 // source: model.icon
160// } 170 // }
161 171
162 Controls2.Label { 172 Controls2.Label {
163 text: model.name 173 text: model.name
diff --git a/components/package/contents/ui/FolderListView.qml b/components/package/contents/ui/FolderListView.qml
index e8600832..e7db2905 100644
--- a/components/package/contents/ui/FolderListView.qml
+++ b/components/package/contents/ui/FolderListView.qml
@@ -96,11 +96,15 @@ Rectangle {
96 rowDelegate: Rectangle { 96 rowDelegate: Rectangle {
97 color: styleData.selected ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor 97 color: styleData.selected ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
98 98
99 height: Kirigami.Units.gridUnit * 2 99 height: Kirigami.Units.gridUnit * 1.5
100 width: 20 100 width: 20
101 101
102 } 102 }
103 103
104 frame: Rectangle {
105 color: Kirigami.Theme.textColor
106 }
107
104 branchDelegate: Item { 108 branchDelegate: Item {
105 109
106 width: 16; height: 16 110 width: 16; height: 16
@@ -120,6 +124,19 @@ Rectangle {
120 124
121 color: styleData.selected ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor 125 color: styleData.selected ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
122 126
127 DropArea {
128 anchors.fill: parent
129
130 Rectangle {
131 anchors.fill: parent
132 color: Kirigami.Theme.viewBackgroundColor
133
134 opacity: 0.3
135
136 visible: parent.containsDrag
137 }
138 }
139
123 Text { 140 Text {
124 anchors { 141 anchors {
125 verticalCenter: parent.verticalCenter 142 verticalCenter: parent.verticalCenter
diff --git a/components/package/contents/ui/MailListView.qml b/components/package/contents/ui/MailListView.qml
index 68db1c43..6ec86aee 100644
--- a/components/package/contents/ui/MailListView.qml
+++ b/components/package/contents/ui/MailListView.qml
@@ -89,7 +89,7 @@ Item {
89 } 89 }
90 } 90 }
91 91
92 ListView { 92 ListView {
93 id: listView 93 id: listView
94 94
95 anchors.top: toolbar.bottom 95 anchors.top: toolbar.bottom
@@ -119,106 +119,161 @@ Item {
119 parentFolder: root.parentFolder 119 parentFolder: root.parentFolder
120 } 120 }
121 121
122 delegate: Kirigami.AbstractListItem { 122 delegate: Item {
123 id: mailListDelegate 123 id: origin
124 124
125 width: scrollbar.visible ? listView.width - scrollbar.width : listView.width 125 width: delegateRoot.width
126 height: Kirigami.Units.gridUnit * 4.5 126 height: delegateRoot.height
127 127
128 enabled: true 128 QtQml.Binding {
129 supportsMouseEvents: true 129 target: root
130 130 property: "currentMail"
131 checked: listView.currentIndex == index 131 when: listView.currentIndex == index
132 onClicked: { 132 value: model.domainObject
133 listView.currentIndex = model.index 133 }
134 QtQml.Binding {
135 target: root
136 property: "isDraft"
137 when: listView.currentIndex == index
138 value: model.draft
134 } 139 }
135 140
136 //Content
137 Item { 141 Item {
138 width: parent.width 142 id: delegateRoot
139 height: parent.height 143
140 144 width: scrollbar.visible ? listView.width - scrollbar.width : listView.width
141 QtQml.Binding { 145 height: Kirigami.Units.gridUnit * 5
142 target: root 146
143 property: "currentMail" 147 states: [
144 when: listView.currentIndex == index 148 State {
145 value: model.domainObject 149 name: "dnd"
146 } 150 when: mouseArea.drag.active
147 QtQml.Binding { 151
148 target: root 152 PropertyChanges {target: mouseArea; cursorShape: Qt.ClosedHandCursor}
149 property: "isDraft" 153 PropertyChanges {target: delegateRoot; x: x; y:y}
150 when: listView.currentIndex == index 154 PropertyChanges {target: delegateRoot; parent: root}
151 value: model.draft 155
156 PropertyChanges {target: delegateRoot; opacity: 0.7}
157 PropertyChanges {target: background; color: Kirigami.Theme.highlightColor}
158 PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor}
159 PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor}
160 PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor}
161 PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor}
162 },
163 State {
164 name: "selected"
165 when: listView.currentIndex == index && !mouseArea.drag.active
166
167 PropertyChanges {target: background; color: Kirigami.Theme.highlightColor}
168 PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor}
169 PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor}
170 PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor}
171 PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor}
172 },
173 State {
174 name: "hovered"
175 when: mouseArea.containsMouse && !mouseArea.drag.active
176
177 PropertyChanges {target: background; color: Kirigami.Theme.buttonHoverColor; opacity: 0.7}
178 PropertyChanges {target: subject; color: Kirigami.Theme.highlightedTextColor}
179 PropertyChanges {target: sender; color: Kirigami.Theme.highlightedTextColor}
180 PropertyChanges {target: date; color: Kirigami.Theme.highlightedTextColor}
181 PropertyChanges {target: threadCounter; color: Kirigami.Theme.highlightedTextColor}
152 } 182 }
183 ]
153 184
154 //TODO implement bulk action 185 Drag.active: mouseArea.drag.active
155 // Controls.CheckBox { 186 Drag.hotSpot.x: Kirigami.Units.gridUnit * 2
156 // visible: mailListDelegate.containsMouse == true 187 Drag.hotSpot.y: height / 2
157 // }
158 188
159 Column { 189 MouseArea {
160 anchors { 190 id: mouseArea
161 verticalCenter: parent.verticalCenter
162 left: parent.left
163 leftMargin: Kirigami.Units.largeSpacing
164 }
165 191
166 Text{ 192 anchors.fill: parent
167 text: model.subject
168 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : model.unread ? "#1d99f3" : Kirigami.Theme.textColor
169 193
170 maximumLineCount: 2 194 hoverEnabled: true
171 width: mailListDelegate.width - Kirigami.Units.gridUnit * 3 195 drag.target: parent
172 wrapMode: Text.WrapAnywhere
173 elide: Text.ElideRight
174 }
175 196
176 Text { 197 onClicked: {
177 text: model.senderName 198 listView.currentIndex = index
178 font.italic: true
179 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor
180 width: mailListDelegate.width - Kirigami.Units.gridUnit * 3
181 elide: Text.ElideRight
182 } 199 }
183 } 200 }
184 201
185 Text { 202 Rectangle {
186 anchors { 203 id: background
187 right: parent.right 204
188 bottom: parent.bottom 205 anchors.fill: parent
189 } 206
190 text: Qt.formatDateTime(model.date, "dd MMM yyyy") 207 color: Kirigami.Theme.viewBackgroundColor
191 font.italic: true
192 color: mailListDelegate.checked ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.disabledTextColor
193 font.pointSize: 9
194 }
195 208
209 border.color: Kirigami.Theme.backgroundColor
210 border.width: 1
211 }
196 212
197 Item { 213 Item {
214 id: content
215
198 anchors { 216 anchors {
217 top: parent.top
218 bottom: parent.bottom
219 left: parent.left
199 right: parent.right 220 right: parent.right
221 margins: Kirigami.Units.smallSpacing
200 } 222 }
201 223
202 height: Kirigami.Units.gridUnit * 1.2 224 Column {
203 width: height 225 anchors {
204 226 verticalCenter: parent.verticalCenter
205 visible: !mailListDelegate.checked 227 left: parent.left
228 leftMargin: Kirigami.Units.largeSpacing
229 }
230
231 Text{
232 id: subject
233
234 text: model.subject
235 color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.textColor
236
237 maximumLineCount: 2
238 width: content.width - Kirigami.Units.gridUnit * 3
239 wrapMode: Text.WrapAnywhere
240 elide: Text.ElideRight
241 }
242
243 Text {
244 id: sender
245
246 text: model.senderName
247 font.italic: true
248 color: Kirigami.Theme.textColor
249 width: delegateRoot.width - Kirigami.Units.gridUnit * 3
250 elide: Text.ElideRight
251 }
252 }
206 253
207 Rectangle { 254 Text {
208 anchors.fill: parent 255 id: date
209 256
210 opacity: model.unread ? 1 : 0.5 257 anchors {
211 radius: 80 258 right: parent.right
212 color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor 259 bottom: parent.bottom
260 }
261 text: Qt.formatDateTime(model.date, "dd MMM yyyy")
262 font.italic: true
263 color: Kirigami.Theme.disabledTextColor
264 font.pointSize: 9
213 } 265 }
214 266
215 Text { 267 Text {
216 anchors.centerIn: parent 268 id: threadCounter
217 269
270 anchors {
271 right: parent.right
272 }
218 text: model.threadSize 273 text: model.threadSize
219 color: Kirigami.Theme.highlightedTextColor 274 color: model.unread ? Kirigami.Theme.highlightColor : Kirigami.Theme.disabledTextColor
275 visible: model.threadSize > 1
220 } 276 }
221
222 } 277 }
223 } 278 }
224 } 279 }
diff --git a/components/package/contents/ui/People.qml b/components/package/contents/ui/People.qml
new file mode 100644
index 00000000..47dd82ec
--- /dev/null
+++ b/components/package/contents/ui/People.qml
@@ -0,0 +1,133 @@
1 /*
2 Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net>
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.Controls 1.4 as Controls
22import QtQuick.Layouts 1.1
23
24import org.kde.kirigami 1.0 as Kirigami
25
26Popup {
27
28 modal: true
29
30 Controls.SplitView {
31 anchors.fill: parent
32
33 Item {
34 height: parent.height
35 width: Kirigami.Units.gridUnit * 14
36
37 Item {
38 id: toolBar
39
40 width: parent.width - scroll.width
41 height: Kirigami.Units.gridUnit * 2
42
43 Rectangle {
44
45 anchors.centerIn: parent
46
47 height: Kirigami.Units.gridUnit * 1.5
48 width: parent.width* 0.8
49
50 color: "#27ae60"
51
52 clip: true
53
54 Text {
55
56 anchors.centerIn: parent
57
58 clip: true
59
60 text: "New Contact"
61
62 color: "white"
63 }
64 }
65 }
66
67 ListView {
68 id: listView
69
70 anchors {
71 top: toolBar.bottom
72 left: parent.left
73 right: parent.right
74 bottom: parent.bottom
75 topMargin: Kirigami.Units.smallSpacing
76 }
77
78 model: 15
79 clip: true
80
81 ScrollBar.vertical: ScrollBar {
82 id: scroll
83 }
84
85 delegate: Kirigami.AbstractListItem {
86 height: Kirigami.Units.gridUnit * 2.5
87 width: listView.width - scroll.width
88
89 clip: true
90
91 Avatar {
92 id: avatar
93
94 anchors {
95 verticalCenter: parent.verticalCenter
96 left: parent.left
97 leftMargin: Kirigami.Units.smallSpacing
98 }
99
100 height: parent.height * 0.9
101 width: height
102
103 name: "Wolfgang Rosenzweig"
104 }
105
106 Text {
107 id: name
108
109 anchors {
110 left: avatar.right
111 leftMargin: Kirigami.Units.smallSpacing
112 verticalCenter: avatar.verticalCenter
113 }
114
115 text: "Wolfgang Rosenzweig"
116 color: Kirigami.Theme.textColor
117 }
118 }
119 }
120 }
121
122 Item {
123 height: parent.height
124 Layout.fillWidth: true
125
126 ToolBar {
127
128 width: parent.width
129 height: Kirigami.Units.gridUnit * 2
130 }
131 }
132 }
133}
diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml
index 6baeaed2..ab203ef5 100644
--- a/components/package/contents/ui/SingleMailView.qml
+++ b/components/package/contents/ui/SingleMailView.qml
@@ -27,11 +27,13 @@ import QtQml 2.2 as QtQml
27import org.kube.framework.domain 1.0 as KubeFramework 27import org.kube.framework.domain 1.0 as KubeFramework
28import org.kube.framework.actions 1.0 as KubeAction 28import org.kube.framework.actions 1.0 as KubeAction
29 29
30Item { 30Rectangle {
31 id: root 31 id: root
32 32
33 property variant mail; 33 property variant mail;
34 34
35 color: Kirigami.Theme.backgroundColor
36
35 ListView { 37 ListView {
36 id: listView 38 id: listView
37 anchors { 39 anchors {