add 'use owned account' button on public and deshielded variants

This commit is contained in:
Sergio Chouhy 2026-06-05 23:24:28 -03:00
parent c375470358
commit 3efa884128
3 changed files with 17 additions and 8 deletions

View File

@ -77,6 +77,7 @@ Rectangle {
}
dashboardView.transferResult = msg
dashboardView.transferResultIsError = isError
dashboardView.transferTxHash = (obj && obj.tx_hash) ? obj.tx_hash : ""
}
}
@ -165,6 +166,7 @@ Rectangle {
function(error) {
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onTransferPrivateRequested: (fromId, toKeysJsonOrAddress, amount) => {
@ -176,6 +178,7 @@ Rectangle {
dashboardView.transferPending = false
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onTransferPrivateOwnedRequested: (fromId, toAccountId, amount) => {
@ -187,6 +190,7 @@ Rectangle {
dashboardView.transferPending = false
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onTransferShieldedRequested: (fromId, toKeysJsonOrAddress, amount) => {
@ -198,6 +202,7 @@ Rectangle {
dashboardView.transferPending = false
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onTransferShieldedOwnedRequested: (fromId, toAccountId, amount) => {
@ -209,6 +214,7 @@ Rectangle {
dashboardView.transferPending = false
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onTransferDeshieldedRequested: (fromId, toAccountId, amount) => {
@ -220,6 +226,7 @@ Rectangle {
dashboardView.transferPending = false
dashboardView.transferResult = qsTr("Error: %1").arg(error)
dashboardView.transferResultIsError = true
dashboardView.transferTxHash = ""
})
}
onCopyRequested: (copyText) => {

View File

@ -13,6 +13,7 @@ Rectangle {
property var publicAccountModel: null
property var privateAccountModel: null
property string transferResult: ""
property string transferTxHash: ""
property bool transferResultIsError: false
property bool transferPending: false
property int lastSyncedBlock: 0
@ -61,6 +62,7 @@ Rectangle {
publicAccountModel: root.publicAccountModel
privateAccountModel: root.privateAccountModel
transferResult: root.transferResult
transferTxHash: root.transferTxHash
transferResultIsError: root.transferResultIsError
transferPending: root.transferPending

View File

@ -15,6 +15,7 @@ Rectangle {
property var publicAccountModel: null
property var privateAccountModel: null
property string transferResult: ""
property string transferTxHash: ""
property bool transferResultIsError: false
property bool transferPending: false
@ -37,9 +38,8 @@ Rectangle {
readonly property bool isPrivateTab: transferTypeBar.currentIndex === 1
readonly property bool isShieldedTab: transferTypeBar.currentIndex === 2
readonly property bool isDeshieldedTab: transferTypeBar.currentIndex === 3
readonly property bool showOwnedOption: isPrivateTab || isShieldedTab
readonly property bool toComboPermanent: isDeshieldedTab
readonly property bool toAddressValid: (toComboPermanent || (showOwnedOption && useOwnedAccountForTo))
readonly property bool showOwnedOption: true
readonly property bool toAddressValid: useOwnedAccountForTo
? (toFilterCount > 0 && toCombo.currentIndex >= 0)
: (toField && toField.text.trim().length > 0)
readonly property bool needsProof: isPrivateTab || isShieldedTab || isDeshieldedTab
@ -142,15 +142,15 @@ Rectangle {
LogosTextField {
id: toField
Layout.fillWidth: true
placeholderText: d.isPublicTab ? qsTr("Recipient address") : qsTr("Recipient private keys (JSON)")
visible: !d.toComboPermanent && (!d.showOwnedOption || !d.useOwnedAccountForTo)
placeholderText: (d.isPublicTab || d.isDeshieldedTab) ? qsTr("Recipient address") : qsTr("Recipient private keys (JSON)")
visible: !d.useOwnedAccountForTo
}
AccountComboBox {
id: toCombo
Layout.fillWidth: true
model: (d.isPublicTab || d.isDeshieldedTab) ? root.publicAccountModel : root.privateAccountModel
visible: d.toComboPermanent || (d.showOwnedOption && d.useOwnedAccountForTo && toFilterCount > 0)
visible: d.useOwnedAccountForTo && toFilterCount > 0
onCopyRequested: (text) => root.copyRequested(text)
}
}
@ -184,7 +184,7 @@ Rectangle {
? (fromCombo.currentValue ?? "")
: Base58.decode(manualFromField.text.trim())
var rawTo = toField.text.trim()
var toAddress = (d.toComboPermanent || (d.useOwnedAccountForTo && toCombo.currentIndex >= 0))
var toAddress = (d.useOwnedAccountForTo && toCombo.currentIndex >= 0)
? (toCombo.currentValue ?? "")
: (rawTo.startsWith("{") ? rawTo : Base58.decode(rawTo))
var amount = amountField.text.trim()
@ -246,7 +246,7 @@ Rectangle {
Layout.alignment: Qt.AlignRight
Layout.preferredHeight: 40
Layout.preferredWidth: 40
onCopyText: root.copyRequested(root.transferResult)
onCopyText: root.copyRequested(root.transferTxHash || root.transferResult)
visible: resultText.text
}
}