From df519ed00a838e89ca22be4e0adc22d866d17f8e Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Sat, 3 Sep 2016 13:16:15 +0200 Subject: [PATCH] CURA-2157: Adding an confirmation dialog Tested while starting two prints and aborting them. The buttons for "Yes" and "No" are translated by Qt5. --- resources/qml/MonitorButton.qml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 79168ed6df..2a8e2f4097 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -4,6 +4,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 +import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.1 import UM 1.1 as UM @@ -160,7 +161,7 @@ Rectangle anchors.rightMargin: UM.Theme.getSize("default_margin").width text: catalog.i18nc("@label:", "Abort Print") - onClicked: Cura.MachineManager.printerOutputDevices[0].setJobState("abort") + onClicked: confirmationDialog.visible = true style: ButtonStyle { @@ -216,6 +217,18 @@ Rectangle } } + MessageDialog + { + id: confirmationDialog + + title: catalog.i18nc("@text:MessageDialog", "Abort print") + icon: StandardIcon.Warning + text: catalog.i18nc("@text:MessageDialog", "Do you really want to abort the print?") + standardButtons: StandardButton.Yes | StandardButton.No + Component.onCompleted: visible = false + onYes: Cura.MachineManager.printerOutputDevices[0].setJobState("abort") + } + Button { id: pauseResumeButton