diff --git a/electrum/gui/qml/components/ConfirmTxDialog.qml b/electrum/gui/qml/components/ConfirmTxDialog.qml index af2e6ad5a..f472f0ff2 100644 --- a/electrum/gui/qml/components/ConfirmTxDialog.qml +++ b/electrum/gui/qml/components/ConfirmTxDialog.qml @@ -224,7 +224,7 @@ ElDialog { } } } - + Rectangle { height: 1 Layout.fillWidth: true @@ -248,11 +248,13 @@ ElDialog { Button { id: sendButton - text: qsTr('Pay') + text: Daemon.currentWallet.isWatchOnly ? qsTr('Finalize') : qsTr('Pay') enabled: finalizer.valid onClicked: { txaccepted() - finalizer.send_onchain() + if (!Daemon.currentWallet.isWatchOnly) { + finalizer.send_onchain() + } dialog.close() } } diff --git a/electrum/gui/qml/components/GenericShareDialog.qml b/electrum/gui/qml/components/GenericShareDialog.qml index 442117b2b..81bf4e9a9 100644 --- a/electrum/gui/qml/components/GenericShareDialog.qml +++ b/electrum/gui/qml/components/GenericShareDialog.qml @@ -13,7 +13,7 @@ ElDialog { title: '' parent: Overlay.overlay modal: true - standardButtons: Dialog.Ok + standardButtons: Dialog.Close width: parent.width height: parent.height @@ -86,7 +86,6 @@ ElDialog { onClicked: AppController.textToClipboard(dialog.text) } Button { - //enabled: false text: qsTr('Share') icon.source: '../../icons/share.png' onClicked: { diff --git a/electrum/gui/qml/components/Send.qml b/electrum/gui/qml/components/Send.qml index d04464a55..183c202c6 100644 --- a/electrum/gui/qml/components/Send.qml +++ b/electrum/gui/qml/components/Send.qml @@ -18,6 +18,13 @@ Pane { is_max.checked = false } + function showUnsignedTx(tx) { + var dialog = app.genericShareDialog.createObject(rootItem, + { title: qsTr('Raw Transaction'), text: tx } + ) + dialog.open() + } + GridLayout { id: form width: parent.width @@ -162,6 +169,9 @@ Pane { dialog.txaccepted.connect(function() { userEnteredPayment.clear() rootItem.clear() + if (Daemon.currentWallet.isWatchOnly) { + showUnsignedTx(dialog.finalizer.serializedTx()) + } }) dialog.open() } @@ -268,6 +278,11 @@ Pane { 'satoshis': invoice.amount, 'message': invoice.message }) + dialog.txaccepted.connect(function() { + if (Daemon.currentWallet.isWatchOnly) { + showUnsignedTx(dialog.finalizer.serializedTx()) + } + }) dialog.open() } else if (invoice.invoiceType == Invoice.LightningInvoice) { console.log('About to pay lightning invoice') diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index fba989b83..262c88525 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -123,7 +123,6 @@ Item { Item { - enabled: !Daemon.currentWallet.isWatchOnly Loader { anchors.fill: parent Send { @@ -148,7 +147,6 @@ Item { font.pixelSize: constants.fontSizeLarge } TabButton { - enabled: !Daemon.currentWallet.isWatchOnly text: qsTr('Send') font.pixelSize: constants.fontSizeLarge } diff --git a/electrum/gui/qml/components/main.qml b/electrum/gui/qml/components/main.qml index 38a5be2ee..49964a235 100644 --- a/electrum/gui/qml/components/main.qml +++ b/electrum/gui/qml/components/main.qml @@ -186,6 +186,14 @@ ApplicationWindow } } + property alias genericShareDialog: _genericShareDialog + Component { + id: _genericShareDialog + GenericShareDialog { + onClosed: destroy() + } + } + property alias channelOpenProgressDialog: _channelOpenProgressDialog ChannelOpenProgressDialog { id: _channelOpenProgressDialog diff --git a/electrum/gui/qml/qetxfinalizer.py b/electrum/gui/qml/qetxfinalizer.py index 900abe3e2..e832a0de0 100644 --- a/electrum/gui/qml/qetxfinalizer.py +++ b/electrum/gui/qml/qetxfinalizer.py @@ -273,14 +273,14 @@ class QETxFinalizer(QObject): amount = self._amount.satsInt if not self._amount.isMax else tx.output_value() - self._effectiveAmount = QEAmount(amount_sat=amount) + self._effectiveAmount.satsInt = amount self.effectiveAmountChanged.emit() tx_size = tx.estimated_size() fee = tx.get_fee() feerate = Decimal(fee) / tx_size # sat/byte - self.fee = QEAmount(amount_sat=fee) + self.fee.satsInt = fee self.feeRate = f'{feerate:.1f}' #TODO @@ -310,3 +310,7 @@ class QETxFinalizer(QObject): return self._wallet.sign_and_broadcast(self._tx) + + @pyqtSlot(result=str) + def serializedTx(self): + return str(self._tx)