qml: allow separate data for clipboard/share and QR code in GenericShareDialog
This commit is contained in:
@@ -9,6 +9,8 @@ ElDialog {
|
|||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
property string text
|
property string text
|
||||||
|
property string text_qr
|
||||||
|
// if text_qr is undefined text will be used
|
||||||
|
|
||||||
title: ''
|
title: ''
|
||||||
parent: Overlay.overlay
|
parent: Overlay.overlay
|
||||||
@@ -97,6 +99,6 @@ ElDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
qr.qrdata = dialog.text
|
qr.qrdata = dialog.text_qr ? dialog.text_qr : dialog.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ Pane {
|
|||||||
is_max.checked = false
|
is_max.checked = false
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUnsignedTx(tx) {
|
function showUnsignedTx(tx, qrtx) {
|
||||||
var dialog = app.genericShareDialog.createObject(rootItem,
|
var dialog = app.genericShareDialog.createObject(rootItem,
|
||||||
{ title: qsTr('Raw Transaction'), text: tx }
|
{ title: qsTr('Raw Transaction'), text: tx, text_qr: qrtx }
|
||||||
)
|
)
|
||||||
dialog.open()
|
dialog.open()
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ Pane {
|
|||||||
userEnteredPayment.clear()
|
userEnteredPayment.clear()
|
||||||
rootItem.clear()
|
rootItem.clear()
|
||||||
if (Daemon.currentWallet.isWatchOnly) {
|
if (Daemon.currentWallet.isWatchOnly) {
|
||||||
showUnsignedTx(dialog.finalizer.serializedTx())
|
showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true))
|
||||||
} else {
|
} else {
|
||||||
dialog.finalizer.send_onchain()
|
dialog.finalizer.send_onchain()
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ Pane {
|
|||||||
var wo = Daemon.currentWallet.isWatchOnly
|
var wo = Daemon.currentWallet.isWatchOnly
|
||||||
dialog.txaccepted.connect(function() {
|
dialog.txaccepted.connect(function() {
|
||||||
if (wo) {
|
if (wo) {
|
||||||
showUnsignedTx(dialog.finalizer.serializedTx())
|
showUnsignedTx(dialog.finalizer.serializedTx(false), dialog.finalizer.serializedTx(true))
|
||||||
} else {
|
} else {
|
||||||
dialog.finalizer.send_onchain()
|
dialog.finalizer.send_onchain()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,5 +312,9 @@ class QETxFinalizer(QObject):
|
|||||||
self._wallet.sign(self._tx, broadcast=True)
|
self._wallet.sign(self._tx, broadcast=True)
|
||||||
|
|
||||||
@pyqtSlot(result=str)
|
@pyqtSlot(result=str)
|
||||||
def serializedTx(self):
|
@pyqtSlot(bool, result=str)
|
||||||
return str(self._tx)
|
def serializedTx(self, for_qr=False):
|
||||||
|
if for_qr:
|
||||||
|
return self._tx.to_qr_data()
|
||||||
|
else:
|
||||||
|
return str(self._tx)
|
||||||
|
|||||||
Reference in New Issue
Block a user