refactor(ConfirmationDialog): change dialog to `StatusModal`
This commit is contained in:
parent
a4df3c644b
commit
33d800fcda
|
@ -54,7 +54,6 @@ Item {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
property string settingsProp: ""
|
property string settingsProp: ""
|
||||||
property var onConfirmed: (function(){})
|
property var onConfirmed: (function(){})
|
||||||
height: 310
|
|
||||||
showCancelButton: true
|
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."
|
//% "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-")
|
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-")
|
||||||
|
|
|
@ -207,7 +207,7 @@ StatusAppThreePanelLayout {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
// % "Remove contact"
|
// % "Remove contact"
|
||||||
title: qsTrId("remove-contact")
|
header.title: qsTrId("remove-contact")
|
||||||
//% "Are you sure you want to remove this contact?"
|
//% "Are you sure you want to remove this contact?"
|
||||||
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
|
|
@ -298,7 +298,6 @@ Item {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
property string categoryId
|
property string categoryId
|
||||||
btnType: "warn"
|
btnType: "warn"
|
||||||
height: 216
|
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
|
|
|
@ -178,7 +178,6 @@ StatusModal {
|
||||||
id: deleteCategoryConfirmationDialogComponent
|
id: deleteCategoryConfirmationDialogComponent
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
btnType: "warn"
|
btnType: "warn"
|
||||||
height: 216
|
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
|
|
|
@ -61,7 +61,7 @@ ModalPopup {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: declineAllDialog
|
id: declineAllDialog
|
||||||
//% "Decline all contacts"
|
//% "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"
|
//% "Are you sure you want to decline all these contact requests"
|
||||||
confirmationText: qsTrId("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: {
|
onConfirmButtonClicked: {
|
||||||
|
@ -78,7 +78,7 @@ ModalPopup {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: acceptAllDialog
|
id: acceptAllDialog
|
||||||
//% "Accept all contacts"
|
//% "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"
|
//% "Are you sure you want to accept all these contact requests"
|
||||||
confirmationText: qsTrId("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: {
|
onConfirmButtonClicked: {
|
||||||
|
|
|
@ -219,7 +219,7 @@ StatusModal {
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
title: qsTr("Remove contact")
|
header.title: qsTr("Remove contact")
|
||||||
confirmationText: qsTr("Are you sure you want to remove this contact?")
|
confirmationText: qsTr("Are you sure you want to remove this contact?")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
if (profileModel.contacts.isAdded(fromAuthor)) {
|
if (profileModel.contacts.isAdded(fromAuthor)) {
|
||||||
|
|
|
@ -197,7 +197,7 @@ ScrollView {
|
||||||
|
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
//% "Warning!"
|
//% "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"
|
//% "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")
|
confirmationText: qsTrId("the-account-will-be-logged-out--when-you-login-again--the-selected-mode-will-be-enabled")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
@ -286,7 +286,6 @@ ScrollView {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmationPopup
|
id: confirmationPopup
|
||||||
property string settingsProp: ""
|
property string settingsProp: ""
|
||||||
height: 310
|
|
||||||
showCancelButton: true
|
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."
|
//% "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") : "") +
|
confirmationText: (settingsProp === "isWalletV2Enabled" ? qsTr("<b>--DO NOT USE - UNDER ACTIVE DEVELOPMENT--</b>\n") : "") +
|
||||||
|
|
|
@ -199,7 +199,7 @@ ModalPopup {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmPopup
|
id: confirmPopup
|
||||||
//% "Are you sure?"
|
//% "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"
|
//% "You will not be able to see the whole seed phrase again"
|
||||||
confirmationText: qsTrId("are-you-sure-description")
|
confirmationText: qsTrId("are-you-sure-description")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
|
|
@ -69,7 +69,7 @@ ListView {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: removeContactConfirmationDialog
|
id: removeContactConfirmationDialog
|
||||||
//% "Remove contact"
|
//% "Remove contact"
|
||||||
title: qsTrId("remove-contact")
|
header.title: qsTrId("remove-contact")
|
||||||
//% "Are you sure you want to remove this contact?"
|
//% "Are you sure you want to remove this contact?"
|
||||||
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
confirmationText: qsTrId("are-you-sure-you-want-to-remove-this-contact-")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
|
|
@ -354,7 +354,6 @@ Item {
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmationPopup
|
id: confirmationPopup
|
||||||
height: 310
|
|
||||||
showCancelButton: true
|
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.")
|
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")
|
confirmButtonLabel: qsTr("I understand")
|
||||||
|
|
|
@ -23,7 +23,7 @@ StatusRadioButtonRow {
|
||||||
id: confirmDialogComponent
|
id: confirmDialogComponent
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
//% "Warning!"
|
//% "Warning!"
|
||||||
title: qsTrId("close-app-title")
|
header.title: qsTrId("close-app-title")
|
||||||
//% "Change fleet to %1"
|
//% "Change fleet to %1"
|
||||||
confirmationText: qsTrId("change-fleet-to--1").arg(newFleet)
|
confirmationText: qsTrId("change-fleet-to--1").arg(newFleet)
|
||||||
onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet)
|
onConfirmButtonClicked: profileModel.fleets.setFleet(newFleet)
|
||||||
|
|
|
@ -27,7 +27,7 @@ ModalPopup {
|
||||||
active: Qt.platform.os === Constants.linux
|
active: Qt.platform.os === Constants.linux
|
||||||
sourceComponent: ConfirmationDialog {
|
sourceComponent: ConfirmationDialog {
|
||||||
property string newLocale
|
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.")
|
confirmationText: qsTr("Display language has been changed. You must restart the application for changes to take effect.")
|
||||||
showCancelButton: true
|
showCancelButton: true
|
||||||
confirmButtonLabel: qsTr("Close the app now")
|
confirmButtonLabel: qsTr("Close the app now")
|
||||||
|
|
|
@ -26,7 +26,7 @@ StatusRadioButtonRow {
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmDialog
|
id: confirmDialog
|
||||||
//% "Warning!"
|
//% "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"
|
//% "The account will be logged out. When you unlock it again, the selected network will be used"
|
||||||
confirmationText: qsTrId("logout-app-content")
|
confirmationText: qsTrId("logout-app-content")
|
||||||
onConfirmButtonClicked: {
|
onConfirmButtonClicked: {
|
||||||
|
|
|
@ -1,77 +1,100 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.13
|
||||||
import QtQuick.Controls 2.13
|
import QtQuick.Controls 2.13
|
||||||
import QtQuick.Layouts 1.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
|
id: confirmationDialog
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
property Popup parentPopup
|
property Popup parentPopup
|
||||||
|
property var value
|
||||||
|
property var executeConfirm
|
||||||
|
property var executeCancel
|
||||||
property string btnType: "warn"
|
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 bool showCancelButton: false
|
||||||
property alias checkbox: checkbox
|
property alias checkbox: checkbox
|
||||||
|
|
||||||
|
|
||||||
height: 186
|
header.title: qsTr("Confirm you action")
|
||||||
width: 400
|
|
||||||
//% "Confirm your action"
|
|
||||||
title: qsTrId("confirm-your-action")
|
|
||||||
focus: visible
|
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 confirmButtonClicked()
|
||||||
signal cancelButtonClicked()
|
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 {
|
Item {
|
||||||
anchors.fill: parent
|
width: parent.width
|
||||||
|
height: 16
|
||||||
|
}
|
||||||
|
|
||||||
StyledText {
|
StatusBaseText {
|
||||||
id: innerText
|
|
||||||
text: confirmationDialog.confirmationText
|
text: confirmationDialog.confirmationText
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
|
color: Theme.palette.directColor1
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
width: parent.width
|
||||||
|
height: 16
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusCheckBox {
|
StatusCheckBox {
|
||||||
id: checkbox
|
id: checkbox
|
||||||
visible: false
|
visible: false
|
||||||
anchors.top: innerText.bottom
|
|
||||||
anchors.topMargin: Style.current.halfPadding
|
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
//% "Do not show this again"
|
text: qsTr("Do not show this again")
|
||||||
text: qsTrId("do-not-show-this-again")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
footer: Item {
|
|
||||||
id: footerContainer
|
|
||||||
width: parent.width
|
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 {
|
StatusButton {
|
||||||
id: confirmButton
|
id: confirmButton
|
||||||
type: confirmationDialog.btnType
|
type: {
|
||||||
anchors.right: cancelButton.visible ? cancelButton.left : parent.right
|
switch (confirmationDialog.btnType) {
|
||||||
anchors.rightMargin: cancelButton.visible ? Style.current.smallPadding : 0
|
case "warn":
|
||||||
|
return StatusBaseButton.Type.Danger
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
return StatusBaseButton.Type.Primary
|
||||||
|
}
|
||||||
|
}
|
||||||
text: confirmationDialog.confirmButtonLabel
|
text: confirmationDialog.confirmButtonLabel
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
focus: true
|
focus: true
|
||||||
Keys.onReturnPressed: function(event) {
|
Keys.onReturnPressed: function(event) {
|
||||||
confirmButton.clicked()
|
confirmButton.clicked()
|
||||||
|
@ -80,27 +103,8 @@ ModalPopup {
|
||||||
if (executeConfirm && typeof executeConfirm === "function") {
|
if (executeConfirm && typeof executeConfirm === "function") {
|
||||||
executeConfirm()
|
executeConfirm()
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmationDialog.confirmButtonClicked()
|
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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,6 @@ Popup {
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmationPopup
|
id: confirmationPopup
|
||||||
height: 310
|
|
||||||
showCancelButton: true
|
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.")
|
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")
|
confirmButtonLabel: qsTr("I understand")
|
||||||
|
|
|
@ -160,7 +160,6 @@ Item {
|
||||||
|
|
||||||
ConfirmationDialog {
|
ConfirmationDialog {
|
||||||
id: confirmationPopup
|
id: confirmationPopup
|
||||||
height: 310
|
|
||||||
showCancelButton: true
|
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.")
|
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")
|
confirmButtonLabel: qsTr("I understand")
|
||||||
|
|
Loading…
Reference in New Issue