summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2017-04-26 10:50:12 +0200
committerMichael Bohlender <michael.bohlender@kdemail.net>2017-04-26 10:50:12 +0200
commita7e6a9cd045fc09cd3fb9db81c1773c2ca34c2f4 (patch)
tree6055722bd038bd45942eaf6dac1007723158c727
parent6a01712a5e0312b3462bb1422334488c5068ce7c (diff)
downloadkube-a7e6a9cd045fc09cd3fb9db81c1773c2ca34c2f4.tar.gz
kube-a7e6a9cd045fc09cd3fb9db81c1773c2ca34c2f4.zip
introduce icon button, use it in maillistview
-rw-r--r--framework/qml/IconButton.qml54
-rw-r--r--framework/qml/MailListView.qml20
-rw-r--r--framework/qmldir1
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
19import QtQuick 2.4
20import QtQuick.Layouts 1.1
21import QtQuick.Templates 2.0 as T
22import org.kube.framework 1.0 as Kube
23
24T.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
14People 1.0 People.qml 14People 1.0 People.qml
15NotificationPopup 1.0 NotificationPopup.qml 15NotificationPopup 1.0 NotificationPopup.qml
16Icon 1.0 Icon.qml 16Icon 1.0 Icon.qml
17IconButton 1.0 IconButton.qml
17Button 1.0 Button.qml 18Button 1.0 Button.qml
18Popup 1.0 Popup.qml 19Popup 1.0 Popup.qml
19ComboBox 1.0 ComboBox.qml 20ComboBox 1.0 ComboBox.qml