Files
purple-electrumwallet/electrum/gui/qml/components/MessageDialog.qml
T

82 lines
2.2 KiB
QML
Raw Normal View History

2023-07-17 10:49:06 +02:00
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import QtQuick.Controls.Material
2022-03-30 21:08:48 +02:00
import "controls"
ElDialog {
2022-03-30 21:08:48 +02:00
id: dialog
title: yesno ? qsTr("Question") : qsTr("Message")
iconSource: yesno
? Qt.resolvedUrl('../../icons/question.png')
: Qt.resolvedUrl('../../icons/info.png')
2022-03-30 21:08:48 +02:00
property bool yesno: false
property alias text: message.text
2023-01-10 16:53:21 +01:00
property bool richText: false
2022-03-30 21:08:48 +02:00
2022-12-28 14:59:39 +01:00
z: 1 // raise z so it also covers dialogs using overlay as parent
2022-09-27 09:55:06 +02:00
anchors.centerIn: parent
2023-02-03 17:27:12 +01:00
padding: 0
needsSystemBarPadding: false
2023-02-03 17:27:12 +01:00
2023-04-20 12:07:05 +02:00
width: rootLayout.width
2022-03-30 21:08:48 +02:00
ColumnLayout {
2023-04-20 12:07:05 +02:00
id: rootLayout
width: dialog.parent.width * 2/3
2023-02-03 17:27:12 +01:00
ColumnLayout {
visible: text
2023-02-03 17:27:12 +01:00
Layout.margins: constants.paddingMedium
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
TextArea {
id: message
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
readOnly: true
wrapMode: TextInput.WordWrap
textFormat: richText ? TextEdit.RichText : TextEdit.PlainText
background: Rectangle {
color: 'transparent'
}
2022-03-30 21:08:48 +02:00
}
}
2023-02-03 17:27:12 +01:00
ButtonContainer {
2023-04-20 12:07:05 +02:00
Layout.fillWidth: true
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
textUnderIcon: false
2022-03-30 21:08:48 +02:00
text: qsTr('Ok')
2023-02-03 17:27:12 +01:00
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
2022-03-30 21:08:48 +02:00
visible: !yesno
onClicked: doAccept()
2022-03-30 21:08:48 +02:00
}
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('No')
icon.source: Qt.resolvedUrl('../../icons/closebutton.png')
2022-03-30 21:08:48 +02:00
visible: yesno
onClicked: doReject()
2022-03-30 21:08:48 +02:00
}
2023-02-03 17:27:12 +01:00
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
textUnderIcon: false
text: qsTr('Yes')
icon.source: Qt.resolvedUrl('../../icons/confirmed.png')
2022-03-30 21:08:48 +02:00
visible: yesno
onClicked: doAccept()
2022-03-30 21:08:48 +02:00
}
}
}
}