Skip to content

Commit f6c0b66

Browse files
committed
Merge pull request #4579
b31fae7 Transfer: disable offline tx creation with long payment id (selsta)
2 parents bb4bc4a + b31fae7 commit f6c0b66

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

pages/Transfer.qml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ Rectangle {
8181
}
8282
property string startLinkText: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style><a href='#'>(%1)</a>".arg(qsTr("Start daemon")) + translationManager.emptyString
8383
property bool warningLongPidDescription: descriptionLine.text.match(/^[0-9a-f]{64}$/i)
84+
property bool paymentIdBlocked: paymentIdCheckbox.checked || warningLongPidDescription
85+
property bool hasTransferWarnings: warningContent !== "" || paymentIdBlocked
86+
property bool hasValidTransferInfo: !recipientModel.hasEmptyAddress()
87+
&& !recipientModel.hasEmptyAmount()
88+
&& !recipientModel.hasInvalidAddress()
89+
&& recipientModel.getAmountTotal() <= appWindow.getUnlockedBalance()
90+
property bool canSendTransaction: !sendButtonWarningBox.visible
91+
&& !hasTransferWarnings
92+
&& hasValidTransferInfo
93+
property bool canCreateOfflineTx: appWindow.viewOnly
94+
&& appWindow.daemonSynced
95+
&& !hasTransferWarnings
96+
&& hasValidTransferInfo
8497

8598
Clipboard { id: clipboard }
8699

@@ -819,7 +832,7 @@ Rectangle {
819832
text: qsTr("Long payment IDs are obsolete. \
820833
Long payment IDs were not encrypted on the blockchain and would harm your privacy. \
821834
If the party you're sending to still requires a long payment ID, please notify them.") + translationManager.emptyString;
822-
visible: paymentIdCheckbox.checked || warningLongPidDescription
835+
visible: root.paymentIdBlocked
823836
}
824837

825838
MoneroComponents.WarningBox {
@@ -834,7 +847,7 @@ Rectangle {
834847
rightIcon: "qrc:///images/rightArrow.png"
835848
Layout.topMargin: 4
836849
text: qsTr("Send") + translationManager.emptyString
837-
enabled: !sendButtonWarningBox.visible && !warningContent && !recipientModel.hasEmptyAddress() && !paymentIdWarningBox.visible
850+
enabled: root.canSendTransaction
838851
onClicked: {
839852
console.log("Transfer: paymentClicked")
840853
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
@@ -844,13 +857,6 @@ Rectangle {
844857
}
845858
}
846859
}
847-
848-
function checkInformation() {
849-
return !recipientModel.hasEmptyAmount() &&
850-
recipientModel.getAmountTotal() <= appWindow.getUnlockedBalance() &&
851-
!recipientModel.hasInvalidAddress();
852-
}
853-
854860
} // pageRoot
855861

856862
ColumnLayout {
@@ -934,7 +940,7 @@ Rectangle {
934940
visible: persistentSettings.transferShowAdvanced && appWindow.walletMode >= 2
935941
title: qsTr("Offline transaction signing") + translationManager.emptyString
936942
button1.text: qsTr("Create") + translationManager.emptyString
937-
button1.enabled: appWindow.viewOnly && pageRoot.checkInformation() && appWindow.daemonSynced
943+
button1.enabled: root.canCreateOfflineTx
938944
button1.onClicked: {
939945
console.log("Transfer: saveTx Clicked")
940946
var priority = priorityModelV5.get(priorityDropdown.currentIndex).priority
@@ -956,7 +962,7 @@ Rectangle {
956962
}
957963
tooltip: {
958964
var errorMessage = "";
959-
if (appWindow.viewOnly && !pageRoot.checkInformation()) {
965+
if (appWindow.viewOnly && !root.hasValidTransferInfo) {
960966
errorMessage = "<p class='orange'>" + qsTr("* To create a transaction file, please enter address and amount above") + "</p>";
961967
}
962968
var header = qsTr("Spend XMR from a cold (offline) wallet") + translationManager.emptyString;

0 commit comments

Comments
 (0)