Commit 27a559ac authored by Tobias Fella's avatar Tobias Fella
Browse files

Improve confirmation Dialogs

- Port to Kirigami.PromptDialog
- Give all dialogs a title
- Give all dialogs a "yes" and a "no" button
Unfortunately, there is no QQC2.Dialog.Delete, so this is done using customFooterActions
parent 7edee2fc
Pipeline #202807 passed with stage
in 4 minutes and 45 seconds
......@@ -7,7 +7,7 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kpublictransport 1.0
import org.kde.itinerary 1.0
import "." as App
......@@ -20,7 +20,7 @@ App.JourneyQueryPage {
title: i18n("Alternative Connections")
journeyRequest: controller.journeyRequestFull
onJourneyChanged: replaceWarningSheet.sheetOpen = true
onJourneyChanged: replaceWarningDialog.open()
QQC2.ActionGroup { id: journeyActionGroup }
Component {
......@@ -53,28 +53,21 @@ App.JourneyQueryPage {
actions.contextualActions.push(oneJourneyAction.createObject(root));
}
Kirigami.OverlaySheet {
id: replaceWarningSheet
Kirigami.PromptDialog {
id: replaceWarningDialog
header: Kirigami.Heading {
text: i18n("Replace Journey")
}
QQC2.Label {
text: i18n("Do you really want to replace your existing reservation with the newly selected journey?")
wrapMode: Text.WordWrap
}
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
title: i18n("Replace Journey")
subtitle: i18n("Do you really want to replace your existing reservation with the newly selected journey?")
standardButtons: QQC2.Dialog.No
customFooterActions: [
Kirigami.Action {
text: i18n("Replace")
icon.name: "document-save"
onClicked: {
onTriggered: {
controller.applyJourney(root.journey, root.journeyRequest.to.name == controller.journeyRequestFull.to.name);
applicationWindow().pageStack.pop();
}
}
}
]
}
}
......@@ -7,7 +7,7 @@
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kitemmodels 1.0
import internal.org.kde.kcalendarcore 1.0 as KCalendarCore
import org.kde.kitinerary 1.0
......@@ -38,25 +38,24 @@ Kirigami.ScrollablePage {
property alias arrival: _controller.arrival
property alias departure: _controller.departure
Kirigami.OverlaySheet {
id: deleteWarningSheet
Kirigami.PromptDialog {
id: deleteWarningDialog
QQC2.Label {
text: i18n("Do you really want to delete this event?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Event")
subtitle: i18n("Do you really want to delete this event?")
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
standardButtons: QQC2.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
onTriggered: {
ReservationManager.removeBatch(root.batchId);
applicationWindow().pageStack.pop();
}
}
}
]
}
Component {
......@@ -179,7 +178,7 @@ Kirigami.ScrollablePage {
Kirigami.Action {
iconName: "edit-delete"
text: i18n("Delete")
onTriggered: deleteWarningSheet.sheetOpen = true
onTriggered: deleteWarningDialog.open()
}
]
}
......
......@@ -8,7 +8,7 @@ import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import Qt.labs.platform 1.1
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kitinerary 1.0
import org.kde.itinerary 1.0
import "." as App
......@@ -58,34 +58,33 @@ Kirigami.ScrollablePage {
iconName: "edit-delete"
text: i18n("Delete Document")
onTriggered: {
deleteWarningSheet.docId = model.id;
deleteWarningSheet.sheetOpen = true;
deleteWarningDialog.docId = model.id;
deleteWarningDialog.open()
}
}
]
}
}
Kirigami.OverlaySheet {
id: deleteWarningSheet
Kirigami.PromptDialog {
id: deleteWarningDialog
property string docId
QQC2.Label {
text: i18n("Do you really want to delete this document?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Document")
subtitle: i18n("Do you really want to delete this document?")
standardButtons: QQC2.Dialog.Cancel
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
ApplicationController.removeDocument(controller.batchId, deleteWarningSheet.docId);
deleteWarningSheet.sheetOpen = false;
onTriggered: {
ApplicationController.removeDocument(controller.batchId, deleteWarningDialog.docId);
deleteWarningDialog.close()
}
}
}
]
}
actions {
......
......@@ -6,42 +6,37 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15 as QQC2
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import org.kde.itinerary 1.0
import "." as App
PkPassPage {
property string genericPassId
Kirigami.OverlaySheet {
id: deleteWarningSheet
header: Kirigami.Heading {
text: i18n("Delete Pass")
}
Kirigami.PromptDialog {
id: deleteWarningDialog
QQC2.Label {
text: i18n("Do you really want to delete this pass?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Pass")
subtitle: i18n("Do you really want to delete this pass?")
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
standardButtons: QQC2.Dialog.Close
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
onTriggered: {
PassManager.remove(genericPassId)
applicationWindow().pageStack.pop();
}
}
}
]
}
actions.contextualActions: [
Kirigami.Action {
icon.name: "edit-delete"
text: i18n("Delete")
onTriggered: deleteWarningSheet.open()
onTriggered: deleteWarningDialog.open()
}
]
}
......@@ -55,30 +55,28 @@ Kirigami.Page {
Kirigami.Action {
iconName: "edit-delete"
text: i18n("Delete")
onTriggered: deleteWarningSheet.open()
onTriggered: deleteWarningDialog.open()
enabled: certSelector.currentIndex >= 0 && certSelector.count > 0
}
]
}
Kirigami.OverlaySheet {
id: deleteWarningSheet
QQC2.Label {
text: i18n("Do you really want to delete this certificate?")
wrapMode: Text.WordWrap
}
Kirigami.PromptDialog {
id: deleteWarningDialog
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
title: i18n("Delete Certificate")
subtitle: i18n("Do you really want to delete this certificate?")
standardButtons: QQC2.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
onTriggered: {
HealthCertificateManager.removeCertificate(certSelector.currentIndex);
deleteWarningSheet.close();
deleteWarningDialog.close();
}
}
}
]
}
header: ColumnLayout {
visible: certSelector.count > 0
......
......@@ -22,28 +22,24 @@ Kirigami.ScrollablePage {
page: root
}
Kirigami.OverlaySheet {
id: deleteWarningSheet
header: Kirigami.Heading {
text: i18n("Delete Pass")
}
Kirigami.PromptDialog {
id: deleteWarningDialog
QQC2.Label {
text: i18n("Do you really want to delete this pass?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Pass")
subtitle: i18n("Do you really want to delete this pass?")
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
standardButtons: QQC2.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
onTriggered: {
PassManager.remove(passId)
applicationWindow().pageStack.pop();
}
}
}
]
}
actions.main: Kirigami.Action {
......@@ -59,7 +55,7 @@ Kirigami.ScrollablePage {
Kirigami.Action {
icon.name: "edit-delete"
text: i18n("Delete")
onTriggered: deleteWarningSheet.open()
onTriggered: deleteWarningDialog.open()
}
]
......
......@@ -22,28 +22,24 @@ Kirigami.ScrollablePage {
page: root
}
Kirigami.OverlaySheet {
id: deleteWarningSheet
header: Kirigami.Heading {
text: i18n("Delete Ticket")
}
Kirigami.PromptDialog {
id: deleteWarningDialog
QQC2.Label {
text: i18n("Do you really want to delete this ticket?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Ticket")
subtitle: i18n("Do you really want to delete this ticket?")
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
standardButtons: QQC2.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
onTriggered: {
PassManager.remove(passId)
applicationWindow().pageStack.pop();
}
}
}
]
}
actions.main: Kirigami.Action {
......@@ -59,7 +55,7 @@ Kirigami.ScrollablePage {
Kirigami.Action {
icon.name: "edit-delete"
text: i18n("Delete")
onTriggered: deleteWarningSheet.open()
onTriggered: deleteWarningDialog.open()
}
]
......
......@@ -9,7 +9,7 @@ import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import Qt.labs.qmlmodels 1.0 as Models
import Qt.labs.platform 1.1 as Platform
import org.kde.kirigami 2.17 as Kirigami
import org.kde.kirigami 2.19 as Kirigami
import internal.org.kde.kcalendarcore 1.0 as KCalendarCore
import org.kde.itinerary 1.0
import "." as App
......@@ -97,26 +97,25 @@ Kirigami.ScrollablePage {
}
// page content
Kirigami.OverlaySheet {
id: deleteTripGroupWarningSheet
Kirigami.PromptDialog {
id: deleteTripGroupWarningDialog
property string tripGroupId
QQC2.Label {
text: i18n("Do you really want to delete this trip?")
wrapMode: Text.WordWrap
}
title: i18n("Delete Trip")
subtitle: i18n("Do you really want to delete this trip?")
footer: RowLayout {
QQC2.Button {
Layout.alignment: Qt.AlignHCenter
standardButtons: QQC2.Dialog.Cancel
customFooterActions: [
Kirigami.Action {
text: i18n("Delete")
icon.name: "edit-delete"
onClicked: {
deleteTripGroupWarningSheet.sheetOpen = false;
TripGroupManager.removeReservationsInGroup(deleteTripGroupWarningSheet.tripGroupId);
onTriggered: {
TripGroupManager.removeReservationsInGroup(deleteTripGroupWarningDialog.tripGroupId);
deleteTripGroupWarningDialog.close();
}
}
}
]
}
Platform.FileDialog {
......
......@@ -127,8 +127,8 @@ Kirigami.AbstractCard {
QQC2.ToolButton {
icon.name: "edit-delete"
onClicked: {
deleteTripGroupWarningSheet.tripGroupId = root.tripGroupId
deleteTripGroupWarningSheet.sheetOpen = true
deleteTripGroupWarningDialog.tripGroupId = root.tripGroupId
deleteTripGroupWarningDialog.open()
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment