diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index d04d1d92..1fa3aab2 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml @@ -1,81 +1,82 @@ /* Copyright (C) 2017 Michael Bohlender, Copyright (C) 2017 Christian Mollekopf, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ pragma Singleton import QtQuick 2.7 Item { property string error: "error" property string info_inverted: "documentinfo-inverted" property string error_inverted: "error-inverted" property string busy: "view-refresh" property string busy_inverted: "view-refresh-inverted" property string noNetworkConnection_inverted: "network-disconnect-inverted" property string connected: "dialog-ok" property string connected_inverted: "dialog-ok-inverted" property string success: "dialog-ok" property string success_inverted: "dialog-ok-inverted" property string markAsRead: "mail-mark-read-inverted" property string markAsUnread: "mail-mark-unread-new-inverted" - property string markImportant: "kubeimportant" + property string markImportant: "kubeimportant-inverted" property string markUnimportant: "kubeunimportant" + property string isImportant: "kubeimportant" property string undo: "edit-undo-inverted" property string moveToTrash: "kubetrash" property string edit: "document-edit" property string edit_inverted: "document-edit-inverted" property string replyToSender: "mail-reply-sender" property string forward: "mail-forward" property string outbox: "mail-folder-outbox" property string outbox_inverted: "mail-folder-outbox-inverted" property string copy: "edit-copy" property string menu_inverted: "application-menu-inverted" property string group: "group" property string user: "im-user" property string user_inverted: "im-user-inverted" property string search_inverted: "edit-find-inverted" property string mail_inverted: "mail-message-inverted" property string goBack: "go-previous" property string goBack_inverted: "go-previous-inverted" property string goDown: "go-down" property string goDown_inverted: "go-down-inverted" property string goUp: "go-up" property string checkbox: "checkbox" property string password_show: "password-show-on" property string password_hide: "password-show-off" property string secure: "document-encrypt" property string insecure: "document-decrypt" property string signed: "document-sign" property string key_import_inverted: "view-certificate-import-inverted" property string addNew: "list-add" property string listRemove: "list-remove" property string remove: "kube-list-remove-inverted" property string folder: "folder" property string save_inverted: "document-save-inverted" property string bold: "format-text-bold-symbolic" property string italic: "format-text-italic-symbolic" property string underline: "format-text-underline-symbolic" property string help: "question-inverted" } diff --git a/framework/qml/MailListView.qml b/framework/qml/MailListView.qml index 998d9729..ee4f4957 100644 --- a/framework/qml/MailListView.qml +++ b/framework/qml/MailListView.qml @@ -1,279 +1,292 @@ /* Copyright (C) 2016 Michael Bohlender, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.1 import org.kube.framework 1.0 as Kube FocusScope { id: root //Private properties property variant parentFolder: null property bool isDraft : false property bool isImportant : false property bool isTrash : false property bool isUnread : false property variant currentMail: null property alias filter: mailListModel.filter onParentFolderChanged: { currentMail = null } Kube.Listener { filter: Kube.Messages.selectNextConversation onMessageReceived: { listView.incrementCurrentIndex() listView.forceActiveFocus() } } Kube.Listener { filter: Kube.Messages.selectPreviousConversation onMessageReceived: { listView.decrementCurrentIndex() listView.forceActiveFocus() } } Kube.Label { anchors.centerIn: parent visible: listView.count === 0 //TODO depending on whether we synchronized already or not the label should change. text: qsTr("Nothing here...") } ColumnLayout { anchors.fill: parent spacing: 0 Kube.ListView { id: listView objectName: "listView" Layout.fillWidth: true Layout.fillHeight: true clip: true focus: true onActiveFocusChanged: { if (activeFocus && currentIndex < 0) { currentIndex = 0 } } Keys.onPressed: { //Not implemented as a shortcut because we want it only to apply if we have the focus if (event.text == "d") { Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": root.currentMail}) } else if (event.text == "r") { Kube.Fabric.postMessage(Kube.Messages.reply, {"mail": root.currentMail}) } } onCurrentItemChanged: { if (currentItem) { var currentData = currentItem.currentData; root.currentMail = currentData.mail; root.isDraft = currentData.draft; root.isTrash = currentData.trash; root.isImportant = currentData.important; root.isUnread = currentData.unread; if (currentData.mail && currentData.unread) { Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": currentData.mail}) } } } model: Kube.MailListModel { id: mailListModel parentFolder: root.parentFolder } delegate: Kube.ListDelegate { id: delegateRoot //Required for D&D property var mail: model.mail width: listView.availableWidth height: Kube.Units.gridUnit * 5 color: Kube.Colors.viewBackgroundColor border.color: Kube.Colors.backgroundColor border.width: 1 states: [ State { name: "dnd" when: mouseArea.drag.active PropertyChanges {target: mouseArea; cursorShape: Qt.ClosedHandCursor} PropertyChanges {target: delegateRoot; x: x; y: y} PropertyChanges {target: delegateRoot; parent: root} PropertyChanges {target: delegateRoot; opacity: 0.2} PropertyChanges {target: delegateRoot; highlighted: true} } ] Drag.active: mouseArea.drag.active Drag.hotSpot.x: mouseArea.mouseX Drag.hotSpot.y: mouseArea.mouseY Drag.source: delegateRoot MouseArea { id: mouseArea anchors.fill: parent drag.target: parent onReleased: parent.Drag.drop() onClicked: delegateRoot.clicked() } Item { id: content anchors { fill: parent margins: Kube.Units.smallSpacing } property color unreadColor: (model.unread && !delegateRoot.highlighted) ? Kube.Colors.highlightColor : delegateRoot.textColor //TODO batch editing // Kube.CheckBox { // id: checkBox // // anchors.verticalCenter: parent.verticalCenter // visible: (checked || delegateRoot.hovered) && !mouseArea.drag.active // opacity: 0.9 // } Column { anchors { verticalCenter: parent.verticalCenter left: parent.left leftMargin: Kube.Units.largeSpacing // + checkBox.width } Kube.Label{ id: subject width: content.width - Kube.Units.gridUnit * 3 text: model.subject color: content.unreadColor maximumLineCount: 2 wrapMode: Text.WordWrap elide: Text.ElideRight } Kube.Label { id: sender text: model.senderName color: delegateRoot.textColor font.italic: true width: delegateRoot.width - Kube.Units.gridUnit * 3 elide: Text.ElideRight } } Kube.Label { id: date anchors { right: parent.right bottom: parent.bottom } visible: !delegateRoot.focused text: Qt.formatDateTime(model.date, "dd MMM yyyy") font.italic: true color: delegateRoot.disabledTextColor font.pointSize: Kube.Units.tinyFontSize } Kube.Label { id: threadCounter - anchors.right: parent.right + anchors { + right: parent.right + margins: Kube.Units.smallSpacing + } text: model.threadSize color: content.unreadColor - visible: model.threadSize > 1 + visible: model.threadSize > 1 && !delegateRoot.focused + } } - Row { + Kube.Icon { + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + margins: Kube.Units.smallSpacing + } + + visible: model.important && !delegateRoot.focused && !mouseArea.drag.active + iconName: Kube.Icons.isImportant + } + + Column { id: buttons anchors { right: parent.right - bottom: parent.bottom margins: Kube.Units.smallSpacing + verticalCenter: parent.verticalCenter } visible: delegateRoot.focused && !mouseArea.drag.active - - spacing: Kube.Units.smallSpacing opacity: 0.7 Kube.IconButton { id: readButton iconName: Kube.Icons.markAsRead visible: model.unread onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsRead, {"mail": model.mail}) tooltip: qsTr("Mark as read") } Kube.IconButton { id: unreadButton iconName: Kube.Icons.markAsUnread visible: !model.unread onClicked: Kube.Fabric.postMessage(Kube.Messages.markAsUnread, {"mail": model.mail}) activeFocusOnTab: false tooltip: qsTr("Mark as unread") } Kube.IconButton { id: importantButton iconName: model.important ? Kube.Icons.markImportant : Kube.Icons.markUnimportant visible: !!model.mail onClicked: Kube.Fabric.postMessage(Kube.Messages.setImportant, {"mail": model.mail, "important": !model.important}) activeFocusOnTab: false tooltip: qsTr("Mark as important") } Kube.IconButton { id: deleteButton objectName: "deleteButton" iconName: Kube.Icons.moveToTrash visible: !!model.mail onClicked: Kube.Fabric.postMessage(Kube.Messages.moveToTrash, {"mail": model.mail}) activeFocusOnTab: false tooltip: qsTr("Move to trash") } Kube.IconButton { id: restoreButton iconName: Kube.Icons.undo visible: !!model.trash onClicked: Kube.Fabric.postMessage(Kube.Messages.restoreFromTrash, {"mail": model.mail}) activeFocusOnTab: false tooltip: qsTr("Restore from trash") } } } } } } diff --git a/icons/breeze/icons/actions/24/kubeimportant.svg b/icons/breeze/icons/actions/24/kubeimportant-inverted.svg similarity index 100% copy from icons/breeze/icons/actions/24/kubeimportant.svg copy to icons/breeze/icons/actions/24/kubeimportant-inverted.svg diff --git a/icons/breeze/icons/actions/24/kubeimportant.svg b/icons/breeze/icons/actions/24/kubeimportant.svg index 1a2949d8..3a5089a4 100644 --- a/icons/breeze/icons/actions/24/kubeimportant.svg +++ b/icons/breeze/icons/actions/24/kubeimportant.svg @@ -1,111 +1,111 @@ image/svg+xml - +