From 65d41ccc49be44e1c3a393af97dfbb39296272cd Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 27 Sep 2023 21:05:26 +0200 Subject: [PATCH] qml: qualify all signal handler parameters --- .../gui/qml/components/AddressDetails.qml | 2 +- .../gui/qml/components/CloseChannelDialog.qml | 4 +-- .../gui/qml/components/OpenChannelDialog.qml | 17 ++++++---- electrum/gui/qml/components/TxDetails.qml | 2 +- .../gui/qml/components/WalletMainView.qml | 34 +++++++++++++------ electrum/gui/qml/components/main.qml | 9 +++-- 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/electrum/gui/qml/components/AddressDetails.qml b/electrum/gui/qml/components/AddressDetails.qml index 8cbbb2230..2c7ab2ef4 100644 --- a/electrum/gui/qml/components/AddressDetails.qml +++ b/electrum/gui/qml/components/AddressDetails.qml @@ -310,7 +310,7 @@ Pane { address: root.address onFrozenChanged: addressDetailsChanged() onLabelChanged: addressDetailsChanged() - onAuthRequired: { + onAuthRequired: (method, authMessage) => { app.handleAuthRequired(addressdetails, method, authMessage) } } diff --git a/electrum/gui/qml/components/CloseChannelDialog.qml b/electrum/gui/qml/components/CloseChannelDialog.qml index f05e710e6..8172da48f 100644 --- a/electrum/gui/qml/components/CloseChannelDialog.qml +++ b/electrum/gui/qml/components/CloseChannelDialog.qml @@ -202,7 +202,7 @@ ElDialog { wallet: Daemon.currentWallet channelid: dialog.channelid - onAuthRequired: { + onAuthRequired: (method, authMessage) => { app.handleAuthRequired(channeldetails, method, authMessage) } @@ -228,7 +228,7 @@ ElDialog { dialog.close() } - onChannelCloseFailed: { + onChannelCloseFailed: (message) => { errorText.text = message } } diff --git a/electrum/gui/qml/components/OpenChannelDialog.qml b/electrum/gui/qml/components/OpenChannelDialog.qml index 1ec3a61dd..d1730e465 100644 --- a/electrum/gui/qml/components/OpenChannelDialog.qml +++ b/electrum/gui/qml/components/OpenChannelDialog.qml @@ -212,16 +212,19 @@ ElDialog { ChannelOpener { id: channelopener wallet: Daemon.currentWallet - onAuthRequired: { + onAuthRequired: (method, authMessage) => { app.handleAuthRequired(channelopener, method, authMessage) } - onValidationError: { + onValidationError: (code, message) => { if (code == 'invalid_nodeid') { - var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), 'text': message }) + var dialog = app.messageDialog.createObject(app, { + title: qsTr('Error'), + text: message + }) dialog.open() } } - onConflictingBackup: { + onConflictingBackup: (message) => { var dialog = app.messageDialog.createObject(app, { 'text': message, 'yesno': true }) dialog.open() dialog.accepted.connect(function() { @@ -237,17 +240,17 @@ ElDialog { }) dialog.open() } - onChannelOpening: { + onChannelOpening: (peer) => { console.log('Channel is opening') app.channelOpenProgressDialog.reset() app.channelOpenProgressDialog.peer = peer app.channelOpenProgressDialog.open() } - onChannelOpenError: { + onChannelOpenError: (message) => { app.channelOpenProgressDialog.state = 'failed' app.channelOpenProgressDialog.error = message } - onChannelOpenSuccess: { + onChannelOpenSuccess: (cid, has_onchain_backup, min_depth, tx_complete) => { var message = qsTr('Channel established.') + ' ' + qsTr('This channel will be usable after %1 confirmations').arg(min_depth) if (!tx_complete) { diff --git a/electrum/gui/qml/components/TxDetails.qml b/electrum/gui/qml/components/TxDetails.qml index 9667fe525..577eb12e8 100644 --- a/electrum/gui/qml/components/TxDetails.qml +++ b/electrum/gui/qml/components/TxDetails.qml @@ -399,7 +399,7 @@ Pane { id: txdetails wallet: Daemon.currentWallet onLabelChanged: root.detailsChanged() - onConfirmRemoveLocalTx: { + onConfirmRemoveLocalTx: (message) => { var dialog = app.messageDialog.createObject(app, { text: message, yesno: true }) dialog.accepted.connect(function() { txdetails.removeLocalTx(true) diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 6b130d8b4..f12cfb122 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -264,16 +264,20 @@ Item { InvoiceParser { id: invoiceParser wallet: Daemon.currentWallet - onValidationError: { - var dialog = app.messageDialog.createObject(app, { text: message }) + onValidationError: (code, message) => { + var dialog = app.messageDialog.createObject(app, { + text: message + }) dialog.closed.connect(function() { restartSendDialog() }) dialog.open() } - onValidationWarning: { + onValidationWarning: (code, message) => { if (code == 'no_channels') { - var dialog = app.messageDialog.createObject(app, { text: message }) + var dialog = app.messageDialog.createObject(app, { + text: message + }) dialog.closed.connect(function() { restartSendDialog() }) @@ -284,18 +288,28 @@ Item { } onValidationSuccess: { closeSendDialog() - var dialog = invoiceDialog.createObject(app, { invoice: invoiceParser, payImmediately: invoiceParser.isLnurlPay }) + var dialog = invoiceDialog.createObject(app, { + invoice: invoiceParser, + payImmediately: invoiceParser.isLnurlPay + }) dialog.open() } - onInvoiceCreateError: console.log(code + ' ' + message) + onInvoiceCreateError: (code, message) => { + console.log(code + ' ' + message) + } onLnurlRetrieved: { closeSendDialog() - var dialog = lnurlPayDialog.createObject(app, { invoiceParser: invoiceParser }) + var dialog = lnurlPayDialog.createObject(app, { + invoiceParser: invoiceParser + }) dialog.open() } - onLnurlError: { - var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message }) + onLnurlError: (code, message) => { + var dialog = app.messageDialog.createObject(app, { + title: qsTr('Error'), + text: message } + ) dialog.open() } } @@ -477,7 +491,7 @@ Item { finalizer: TxFinalizer { wallet: Daemon.currentWallet canRbf: true - onFinished: { + onFinished: (signed, saved, complete) => { if (!complete) { var msg if (wallet.isWatchOnly) { diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index 588f8c24b..c44f5fb61 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -405,11 +405,14 @@ ApplicationWindow swaphelper: SwapHelper { id: _swaphelper wallet: Daemon.currentWallet - onAuthRequired: { + onAuthRequired: (method, authMessage) => { app.handleAuthRequired(_swaphelper, method, authMessage) } - onError: { - var dialog = app.messageDialog.createObject(app, { title: qsTr('Error'), text: message }) + onError: (message) => { + var dialog = app.messageDialog.createObject(app, { + title: qsTr('Error'), + text: message + }) dialog.open() } }