qml: port over 'show_qr to warn if QR code is missing data'
This commit is contained in:
@@ -12,6 +12,7 @@ ElDialog {
|
||||
property string text_qr
|
||||
// if text_qr is undefined text will be used
|
||||
property string text_help
|
||||
property string text_warn
|
||||
|
||||
title: qsTr('Share Transaction')
|
||||
|
||||
@@ -55,6 +56,17 @@ ElDialog {
|
||||
visible: dialog.text_help
|
||||
text: dialog.text_help
|
||||
}
|
||||
|
||||
InfoTextArea {
|
||||
Layout.fillWidth: true
|
||||
Layout.margins: constants.paddingLarge
|
||||
Layout.topMargin: dialog.text_help
|
||||
? 0
|
||||
: constants.paddingLarge
|
||||
visible: dialog.text_warn
|
||||
text: dialog.text_warn
|
||||
iconStyle: InfoTextArea.IconStyle.Warn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -374,9 +374,10 @@ Pane {
|
||||
onClicked: {
|
||||
var msg = ''
|
||||
if (txdetails.isComplete) {
|
||||
// TODO: iff offline wallet?
|
||||
// TODO: or also if just temporarily offline?
|
||||
msg = qsTr('This transaction is complete. Please share it with an online device')
|
||||
if (!txdetails.isMined && !txdetails.mempoolDepth) // local
|
||||
// TODO: iff offline wallet?
|
||||
// TODO: or also if just temporarily offline?
|
||||
msg = qsTr('This transaction is complete. Please share it with an online device')
|
||||
} else if (txdetails.wallet.isWatchOnly) {
|
||||
msg = qsTr('This transaction should be signed. Present this QR code to the signing device')
|
||||
} else if (txdetails.wallet.isMultisig && txdetails.wallet.walletType != '2fa') {
|
||||
@@ -387,7 +388,7 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
app.stack.getRoot().showExport(txdetails.getSerializedTx(false), txdetails.getSerializedTx(true), msg)
|
||||
app.stack.getRoot().showExport(txdetails.getSerializedTx(), msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,14 +51,17 @@ Item {
|
||||
}
|
||||
|
||||
function showExportByTxid(txid, helptext) {
|
||||
showExport(Daemon.currentWallet.getSerializedTx(txid, false), Daemon.currentWallet.getSerializedTx(txid, true), helptext)
|
||||
showExport(Daemon.currentWallet.getSerializedTx(txid), helptext)
|
||||
}
|
||||
|
||||
function showExport(data, data_qr, helptext) {
|
||||
function showExport(data, helptext) {
|
||||
var dialog = exportTxDialog.createObject(app, {
|
||||
text: data,
|
||||
text_qr: data_qr,
|
||||
text_help: helptext
|
||||
text: data[0],
|
||||
text_qr: data[1],
|
||||
text_help: helptext,
|
||||
text_warn: data[2]
|
||||
? ''
|
||||
: qsTr('Warning: Some data (prev txs / "full utxos") was left out of the QR code as it would not fit. This might cause issues if signing offline. As a workaround, try exporting the tx as file or text instead.')
|
||||
})
|
||||
dialog.open()
|
||||
}
|
||||
|
||||
@@ -391,11 +391,7 @@ class QETxDetails(QObject, QtEventListener):
|
||||
self._can_remove = True
|
||||
self.detailsChanged.emit()
|
||||
|
||||
@pyqtSlot(result=str)
|
||||
@pyqtSlot(bool, result=str)
|
||||
def getSerializedTx(self, for_qr=False):
|
||||
tx = self._tx
|
||||
if for_qr:
|
||||
return tx.to_qr_data()[0]
|
||||
else:
|
||||
return str(tx)
|
||||
@pyqtSlot(result='QVariantList')
|
||||
def getSerializedTx(self):
|
||||
txqr = self._tx.to_qr_data()
|
||||
return [str(self._tx), txqr[0], txqr[1]]
|
||||
|
||||
@@ -728,11 +728,8 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
|
||||
self.dataChanged.emit()
|
||||
|
||||
@pyqtSlot(str, result=str)
|
||||
@pyqtSlot(str, bool, result=str)
|
||||
def getSerializedTx(self, txid, for_qr=False):
|
||||
@pyqtSlot(str, result='QVariantList')
|
||||
def getSerializedTx(self, txid):
|
||||
tx = self.wallet.db.get_transaction(txid)
|
||||
if for_qr:
|
||||
return tx.to_qr_data()[0]
|
||||
else:
|
||||
return str(tx)
|
||||
txqr = tx.to_qr_data()
|
||||
return [str(tx), txqr[0], txqr[1]]
|
||||
|
||||
Reference in New Issue
Block a user