1
0

qml: offer same choices as desktop; Open, Discard, Save to wallet

This commit is contained in:
Sander van Grieken
2025-05-09 11:15:10 +02:00
parent 8368469e2c
commit 77407fa206
3 changed files with 137 additions and 30 deletions

View File

@@ -8,23 +8,25 @@ Item {
Connections {
target: AppController ? AppController.plugin('psbt_nostr') : null
function onCosignerReceivedPsbt(pubkey, event, tx, label) {
var dialog = app.messageDialog.createObject(app, {
text: [
label
? qsTr('A transaction was received from your cosigner with label: <br/><br/><b>%1</b>').arg(label)
: qsTr('A transaction was received from your cosigner.'),
qsTr('Do you want to open it now?')
].join('<br/><br/>'),
yesno: true,
richText: true
var dialog = psbtReceiveDialog.createObject(app, {
tx_label: label
})
dialog.accepted.connect(function () {
var page = app.stack.push(Qt.resolvedUrl('../../../gui/qml/components/TxDetails.qml'), {
rawtx: tx
})
page.closed.connect(function () {
target.acceptPsbt(Daemon.currentWallet, event)
})
if (dialog.choice == PsbtReceiveDialog.Choice.Open) {
console.log('label:' + label)
console.log('tx:' + tx)
target.saveTxLabel(Daemon.currentWallet, tx, label)
var page = app.stack.push(Qt.resolvedUrl('../../../gui/qml/components/TxDetails.qml'), {
rawtx: tx
})
page.closed.connect(function () {
target.acceptPsbt(Daemon.currentWallet, event)
})
} else if (dialog.choice == PsbtReceiveDialog.Choice.Save) {
target.acceptPsbt(Daemon.currentWallet, event, true)
} else {
console.log('choice not set')
}
})
dialog.rejected.connect(function () {
target.rejectPsbt(Daemon.currentWallet, event)
@@ -33,6 +35,13 @@ Item {
}
}
Component {
id: psbtReceiveDialog
PsbtReceiveDialog {
onClosed: destroy()
}
}
property variant export_tx_button: Component {
FlatButton {
id: psbt_nostr_send_button