From fac0f64d4b4f46b002dc9826fe11a3edeab9e7d2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 2 Jan 2017 12:05:35 +0100 Subject: Reply and edit draft action. --- components/mail/contents/ui/main.qml | 12 +++------ components/package/contents/ui/SingleMailView.qml | 32 ++++++++++++++++++++--- 2 files changed, 33 insertions(+), 11 deletions(-) (limited to 'components') diff --git a/components/mail/contents/ui/main.qml b/components/mail/contents/ui/main.qml index 5fceaf30..39df6040 100644 --- a/components/mail/contents/ui/main.qml +++ b/components/mail/contents/ui/main.qml @@ -57,9 +57,6 @@ Controls2.ApplicationWindow { //END Actions //BEGIN ActionHandler - - //TODO - /* KubeAction.ActionHandler { actionId: "org.kde.kube.actions.reply" function isReady(context) { @@ -67,8 +64,8 @@ Controls2.ApplicationWindow { } function handler(context) { - var component = composerComponent.createObject(app) - component.loadMessage(context.mail, false) + composer.loadMessage(context.mail, false) + composer.open() } } @@ -78,11 +75,10 @@ Controls2.ApplicationWindow { return context.mail && context.isDraft; } function handler(context) { - var component= composerComponent.createObject(app, {"draftMessage": context.mail}) - component.loadMessage(context.mail, true) + composer.loadMessage(context.mail, true) + composer.open() } } - */ //END ActionHandler //Controller diff --git a/components/package/contents/ui/SingleMailView.qml b/components/package/contents/ui/SingleMailView.qml index 5576391d..c2565cf1 100644 --- a/components/package/contents/ui/SingleMailView.qml +++ b/components/package/contents/ui/SingleMailView.qml @@ -25,6 +25,7 @@ import org.kde.kirigami 1.0 as Kirigami import QtQml 2.2 as QtQml import org.kube.framework.domain 1.0 as KubeFramework +import org.kube.framework.actions 1.0 as KubeAction Item { id: root @@ -346,7 +347,6 @@ Item { width: parent.width Text { - anchors{ verticalCenter: parent.verticalCenter left: parent.left @@ -380,8 +380,34 @@ Item { rightMargin: Kirigami.Units.gridUnit } - iconName: "mail-reply-sender" - //TODO add text + KubeAction.Context { + id: mailcontext + property variant mail + property bool isDraft + mail: model.mail + isDraft: model.draft + } + + KubeAction.Action { + id: replyAction + actionId: "org.kde.kube.actions.reply" + context: maillistcontext + } + + KubeAction.Action { + id: editAction + actionId: "org.kde.kube.actions.edit" + context: maillistcontext + } + + iconName: model.draft ? "document-edit" : "mail-reply-sender" + onClicked: { + if (model.draft) { + editAction.execute() + } else { + replyAction.execute() + } + } } } } -- cgit v1.2.3