Browse Source

add yes/no button option to generic messagedialog, so it can be used

to ask the user a simple yes/no question.
patch-4
Sander van Grieken 3 years ago
parent
commit
271f36d3b3
  1. 70
      electrum/gui/qml/components/main.qml

70
electrum/gui/qml/components/main.qml

@ -145,6 +145,15 @@ ApplicationWindow
Component { Component {
id: _messageDialog id: _messageDialog
Dialog { Dialog {
id: dialog
title: qsTr("Message")
property bool yesno: false
property alias text: message.text
signal yesClicked
signal noClicked
parent: Overlay.overlay parent: Overlay.overlay
modal: true modal: true
x: (parent.width - width) / 2 x: (parent.width - width) / 2
@ -153,13 +162,43 @@ ApplicationWindow
color: "#aa000000" color: "#aa000000"
} }
title: qsTr("Message") ColumnLayout {
property alias text: messageLabel.text TextArea {
Label { id: message
id: messageLabel Layout.preferredWidth: Overlay.overlay.width *2/3
text: "Lorem ipsum dolor sit amet..." readOnly: true
wrapMode: TextInput.WordWrap
//textFormat: TextEdit.RichText // existing translations not richtext yet
background: Rectangle {
color: 'transparent'
}
} }
RowLayout {
Layout.alignment: Qt.AlignHCenter
Button {
text: qsTr('Ok')
visible: !yesno
onClicked: dialog.close()
}
Button {
text: qsTr('Yes')
visible: yesno
onClicked: {
yesClicked()
dialog.close()
}
}
Button {
text: qsTr('No')
visible: yesno
onClicked: {
noClicked()
dialog.close()
}
}
}
}
} }
} }
@ -184,33 +223,12 @@ ApplicationWindow
app.header.visible = false app.header.visible = false
mainStackView.clear() mainStackView.clear()
} }
/* OpenWallet as a popup dialog attempt
Component {
id: _openWallet
Dialog {
parent: Overlay.overlay
modal: true
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Overlay.modal: Rectangle {
color: "#aa000000"
}
title: qsTr("OpenWallet")
OpenWallet {
path: Daemon.path
}
}
}
*/
Connections { Connections {
target: Daemon target: Daemon
function onWalletRequiresPassword() { function onWalletRequiresPassword() {
console.log('wallet requires password') console.log('wallet requires password')
app.stack.push(Qt.resolvedUrl("OpenWallet.qml"), {"path": Daemon.path}) app.stack.push(Qt.resolvedUrl("OpenWallet.qml"), {"path": Daemon.path})
// var dialog = _openWallet.createObject(app)
//dialog.open()
} }
function onWalletOpenError(error) { function onWalletOpenError(error) {
console.log('wallet open error') console.log('wallet open error')

Loading…
Cancel
Save