diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/qml/IconButton.qml | 54 | ||||
-rw-r--r-- | framework/qml/MailListView.qml | 20 | ||||
-rw-r--r-- | framework/qmldir | 1 |
3 files changed, 65 insertions, 10 deletions
diff --git a/framework/qml/IconButton.qml b/framework/qml/IconButton.qml new file mode 100644 index 00000000..13f817a0 --- /dev/null +++ b/framework/qml/IconButton.qml | |||
@@ -0,0 +1,54 @@ | |||
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 | |||
19 | import QtQuick 2.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | import QtQuick.Templates 2.0 as T | ||
22 | import org.kube.framework 1.0 as Kube | ||
23 | |||
24 | T.Button { | ||
25 | id: root | ||
26 | |||
27 | property var iconName | ||
28 | |||
29 | width: Kube.Units.gridUnit + padding * 2 | ||
30 | height: Kube.Units.gridUnit + padding * 2 | ||
31 | |||
32 | padding: Kube.Units.smallSpacing | ||
33 | |||
34 | clip: true | ||
35 | hoverEnabled: true | ||
36 | |||
37 | background: Rectangle { | ||
38 | color: Kube.Colors.buttonColor | ||
39 | |||
40 | Rectangle { | ||
41 | anchors.fill: parent | ||
42 | visible: root.hovered || root.pressed | ||
43 | color: root.pressed ? Kube.Colors.textColor : Kube.Colors.viewBackgroundColor | ||
44 | opacity: 0.2 | ||
45 | } | ||
46 | } | ||
47 | |||
48 | contentItem: Kube.Icon { | ||
49 | width: root.height - Kube.Units.smallSpacing * 2 | ||
50 | height: width | ||
51 | iconName: root.iconName | ||
52 | } | ||
53 | } | ||
54 | |||
diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index b7b09d61..a0921a6e 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml | |||
@@ -261,40 +261,40 @@ Item { | |||
261 | spacing: Kube.Units.smallSpacing | 261 | spacing: Kube.Units.smallSpacing |
262 | opacity: 0.7 | 262 | opacity: 0.7 |
263 | 263 | ||
264 | Kube.Button { | 264 | Kube.IconButton { |
265 | id: readButton | 265 | id: readButton |
266 | text: "r" | 266 | iconName: Kube.Icons.markAsRead |
267 | visible: enabled | 267 | visible: enabled |
268 | enabled: model.unread | 268 | enabled: model.unread |
269 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": model.mail}) | 269 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": model.mail}) |
270 | } | 270 | } |
271 | Kube.Button { | 271 | Kube.IconButton { |
272 | id: unreadButton | 272 | id: unreadButton |
273 | text: "u" | 273 | iconName: Kube.Icons.markAsUnread |
274 | visible: enabled | 274 | visible: enabled |
275 | enabled: !model.unread | 275 | enabled: !model.unread |
276 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsUnread, {"mail": model.mail}) | 276 | onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsUnread, {"mail": model.mail}) |
277 | } | 277 | } |
278 | 278 | ||
279 | Kube.Button { | 279 | Kube.IconButton { |
280 | id: importantButton | 280 | id: importantButton |
281 | text: "i" | 281 | iconName: Kube.Icons.markImportant |
282 | visible: enabled | 282 | visible: enabled |
283 | enabled: !!model.mail | 283 | enabled: !!model.mail |
284 | onClicked: Kube.Fabric.postMessage(Kube.Messages.toggleImportant, {"mail": model.mail, "important": model.important}) | 284 | onClicked: Kube.Fabric.postMessage(Kube.Messages.toggleImportant, {"mail": model.mail, "important": model.important}) |
285 | } | 285 | } |
286 | 286 | ||
287 | Kube.Button { | 287 | Kube.IconButton { |
288 | id: deleteButton | 288 | id: deleteButton |
289 | text: "d" | 289 | iconName: Kube.Icons.moveToTrash |
290 | visible: enabled | 290 | visible: enabled |
291 | enabled: !!model.mail | 291 | enabled: !!model.mail |
292 | onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) | 292 | onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) |
293 | } | 293 | } |
294 | 294 | ||
295 | Kube.Button { | 295 | Kube.IconButton { |
296 | id: restoreButton | 296 | id: restoreButton |
297 | text: "re" | 297 | iconName: Kube.Icons.undo |
298 | visible: enabled | 298 | visible: enabled |
299 | enabled: !!model.trash | 299 | enabled: !!model.trash |
300 | onClicked: Kube.Fabric.postMessage(Kube.Messages.restoreFromTrash, {"mail": model.mail}) | 300 | onClicked: Kube.Fabric.postMessage(Kube.Messages.restoreFromTrash, {"mail": model.mail}) |
diff --git a/framework/qmldir b/framework/qmldir index 8e969c96..5bb1530b 100644 --- a/framework/qmldir +++ b/framework/qmldir | |||
@@ -14,6 +14,7 @@ Outbox 1.0 Outbox.qml | |||
14 | People 1.0 People.qml | 14 | People 1.0 People.qml |
15 | NotificationPopup 1.0 NotificationPopup.qml | 15 | NotificationPopup 1.0 NotificationPopup.qml |
16 | Icon 1.0 Icon.qml | 16 | Icon 1.0 Icon.qml |
17 | IconButton 1.0 IconButton.qml | ||
17 | Button 1.0 Button.qml | 18 | Button 1.0 Button.qml |
18 | Popup 1.0 Popup.qml | 19 | Popup 1.0 Popup.qml |
19 | ComboBox 1.0 ComboBox.qml | 20 | ComboBox 1.0 ComboBox.qml |