refactor(ConfirmationDialog): change dialog to `StatusModal`

This commit is contained in:
Pascal Precht 2021-09-09 11:10:29 +02:00 committed by Iuri Matias
parent a4df3c644b
commit 33d800fcda
16 changed files with 82 additions and 85 deletions

View File

@ -54,7 +54,6 @@ Item {
ConfirmationDialog {
property string settingsProp: ""
property var onConfirmed: (function(){})
height: 310
showCancelButton: true
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: qsTrId("this-feature-is-experimental-and-is-meant-for-testing-purposes-by-core-contributors-and-the-community--it-s-not-meant-for-real-use-and-makes-no-claims-of-security-or-integrity-of-funds-or-data--use-at-your-own-risk-")

View File

@ -207,7 +207,7 @@ StatusAppThreePanelLayout {
ConfirmationDialog {
id: removeContactConfirmationDialog
// % "Remove contact"
title: qsTrId("remove-contact")
header.title: qsTrId("remove-contact")
//% "Are you sure you want to remove this contact?"
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
onConfirmButtonClicked: {

View File

@ -298,7 +298,6 @@ Item {
ConfirmationDialog {
property string categoryId
btnType: "warn"
height: 216
showCancelButton: true
onClosed: {
destroy()

View File

@ -178,7 +178,6 @@ StatusModal {
id: deleteCategoryConfirmationDialogComponent
ConfirmationDialog {
btnType: "warn"
height: 216
showCancelButton: true
onClosed: {
destroy()

View File

@ -61,7 +61,7 @@ ModalPopup {
ConfirmationDialog {
id: declineAllDialog
//% "Decline all contacts"
title: qsTrId("decline-all-contacts")
header.title: qsTrId("decline-all-contacts")
//% "Are you sure you want to decline all these contact requests"
confirmationText: qsTrId("are-you-sure-you-want-to-decline-all-these-contact-requests")
onConfirmButtonClicked: {
@ -78,7 +78,7 @@ ModalPopup {
ConfirmationDialog {
id: acceptAllDialog
//% "Accept all contacts"
title: qsTrId("accept-all-contacts")
header.title: qsTrId("accept-all-contacts")
//% "Are you sure you want to accept all these contact requests"
confirmationText: qsTrId("are-you-sure-you-want-to-accept-all-these-contact-requests")
onConfirmButtonClicked: {

View File

@ -219,7 +219,7 @@ StatusModal {
ConfirmationDialog {
id: removeContactConfirmationDialog
title: qsTr("Remove contact")
header.title: qsTr("Remove contact")
confirmationText: qsTr("Are you sure you want to remove this contact?")
onConfirmButtonClicked: {
if (profileModel.contacts.isAdded(fromAuthor)) {

View File

@ -197,7 +197,7 @@ ScrollView {
id: confirmDialog
//% "Warning!"
title: qsTrId("close-app-title")
header.title: qsTrId("close-app-title")
//% "The account will be logged out. When you login again, the selected mode will be enabled"
confirmationText: qsTrId("the-account-will-be-logged-out--when-you-login-again--the-selected-mode-will-be-enabled")
onConfirmButtonClicked: {
@ -286,7 +286,6 @@ ScrollView {
ConfirmationDialog {
id: confirmationPopup
property string settingsProp: ""
height: 310
showCancelButton: true
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: (settingsProp === "isWalletV2Enabled" ? qsTr("<b>--DO NOT USE - UNDER ACTIVE DEVELOPMENT--</b>\n") : "") +

View File

@ -199,7 +199,7 @@ ModalPopup {
ConfirmationDialog {
id: confirmPopup
//% "Are you sure?"
title: qsTrId("are-you-sure?")
header.title: qsTrId("are-you-sure?")
//% "You will not be able to see the whole seed phrase again"
confirmationText: qsTrId("are-you-sure-description")
onConfirmButtonClicked: {

View File

@ -69,7 +69,7 @@ ListView {
ConfirmationDialog {
id: removeContactConfirmationDialog
//% "Remove contact"
title: qsTrId("remove-contact")
header.title: qsTrId("remove-contact")
//% "Are you sure you want to remove this contact?"
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
onConfirmButtonClicked: {

View File

@ -354,7 +354,6 @@ Item {
ConfirmationDialog {
id: confirmationPopup
height: 310
showCancelButton: true
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")

View File

@ -23,7 +23,7 @@ StatusRadioButtonRow {
id: confirmDialogComponent
ConfirmationDialog {
//% "Warning!"
title: qsTrId("close-app-title")
header.title: qsTrId("close-app-title")
//% "Change fleet to %1"
confirmationText: qsTrId("change-fleet-to--1").arg(newFleet)
onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet)

View File

@ -27,7 +27,7 @@ ModalPopup {
active: Qt.platform.os === Constants.linux
sourceComponent: ConfirmationDialog {
property string newLocale
title: qsTr("Change language")
header.title: qsTr("Change language")
confirmationText: qsTr("Display language has been changed. You must restart the application for changes to take effect.")
showCancelButton: true
confirmButtonLabel: qsTr("Close the app now")

View File

@ -26,7 +26,7 @@ StatusRadioButtonRow {
ConfirmationDialog {
id: confirmDialog
//% "Warning!"
title: qsTrId("close-app-title")
header.title: qsTrId("close-app-title")
//% "The account will be logged out. When you unlock it again, the selected network will be used"
confirmationText: qsTrId("logout-app-content")
onConfirmButtonClicked: {

View File

@ -1,77 +1,100 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../imports"
import "../shared/status"
import "./"
ModalPopup {
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
StatusModal {
id: confirmationDialog
anchors.centerIn: parent
property Popup parentPopup
property var value
property var executeConfirm
property var executeCancel
property string btnType: "warn"
property string confirmButtonLabel: qsTr("Confirm")
property string cancelButtonLabel: qsTr("Cancel")
property string confirmationText: qsTr("Are you sure you want to do this?")
property bool showCancelButton: false
property alias checkbox: checkbox
height: 186
width: 400
//% "Confirm your action"
title: qsTrId("confirm-your-action")
header.title: qsTr("Confirm you action")
focus: visible
//% "Confirm"
property string confirmButtonLabel: qsTrId("close-app-button")
//% "Cancel"
//% "Cancel"
property string cancelButtonLabel: qsTrId("browsing-cancel")
//% "Are you sure you want to this?"
property string confirmationText: qsTrId("are-you-sure-you-want-to-this-")
property var value
signal confirmButtonClicked()
signal cancelButtonClicked()
property var executeConfirm
property var executeCancel
contentItem: Item {
width: confirmationDialog.width
implicitHeight: childrenRect.height
Column {
width: parent.width - 32
anchors.horizontalCenter: parent.horizontalCenter
Item {
anchors.fill: parent
width: parent.width
height: 16
}
StyledText {
id: innerText
StatusBaseText {
text: confirmationDialog.confirmationText
font.pixelSize: 15
anchors.left: parent.left
anchors.right: parent.right
wrapMode: Text.WordWrap
color: Theme.palette.directColor1
}
Item {
width: parent.width
height: 16
}
StatusCheckBox {
id: checkbox
visible: false
anchors.top: innerText.bottom
anchors.topMargin: Style.current.halfPadding
Layout.preferredWidth: parent.width
//% "Do not show this again"
text: qsTrId("do-not-show-this-again")
}
text: qsTr("Do not show this again")
}
footer: Item {
id: footerContainer
Item {
width: parent.width
height: confirmButton.height//children[0].height
height: visible ? 16 : 0
visible: checkbox.visible
}
}
}
rightButtons: [
StatusFlatButton {
id: cancelButton
visible: showCancelButton
text: confirmationDialog.cancelButtonLabel
onClicked: {
if (executeCancel && typeof executeCancel === "function") {
executeCancel()
}
confirmationDialog.cancelButtonClicked()
}
},
StatusButton {
id: confirmButton
type: confirmationDialog.btnType
anchors.right: cancelButton.visible ? cancelButton.left : parent.right
anchors.rightMargin: cancelButton.visible ? Style.current.smallPadding : 0
type: {
switch (confirmationDialog.btnType) {
case "warn":
return StatusBaseButton.Type.Danger
break
default:
return StatusBaseButton.Type.Primary
}
}
text: confirmationDialog.confirmButtonLabel
anchors.bottom: parent.bottom
focus: true
Keys.onReturnPressed: function(event) {
confirmButton.clicked()
@ -80,27 +103,8 @@ ModalPopup {
if (executeConfirm && typeof executeConfirm === "function") {
executeConfirm()
}
confirmationDialog.confirmButtonClicked()
}
}
StatusButton {
id: cancelButton
anchors.right: parent.right
visible: showCancelButton
anchors.rightMargin: Style.current.smallPadding
text: confirmationDialog.cancelButtonLabel
anchors.bottom: parent.bottom
onClicked: {
if (executeCancel && typeof executeCancel === "function") {
executeCancel()
}
confirmationDialog.cancelButtonClicked()
}
}
}
]
}

View File

@ -62,7 +62,6 @@ Popup {
ConfirmationDialog {
id: confirmationPopup
height: 310
showCancelButton: true
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")

View File

@ -160,7 +160,6 @@ Item {
ConfirmationDialog {
id: confirmationPopup
height: 310
showCancelButton: true
confirmationText: qsTr("This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk.")
confirmButtonLabel: qsTr("I understand")