From 63b27e7054980f4ed96f5906150b97d7d15e6c65 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 16 Nov 2022 10:13:55 +0200 Subject: [PATCH] hide spend and freeze context menu items on address cell in utxo table --- .../java/com/sparrowwallet/sparrow/control/AddressCell.java | 2 +- .../java/com/sparrowwallet/sparrow/control/EntryCell.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java b/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java index 117330e6..37934e24 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/AddressCell.java @@ -40,7 +40,7 @@ public class AddressCell extends TreeTableCell { if(utxoEntry != null) { Address address = addressStatus.getAddress(); setText(address.toString()); - setContextMenu(new EntryCell.AddressContextMenu(address, utxoEntry.getOutputDescriptor(), new NodeEntry(utxoEntry.getWallet(), utxoEntry.getNode()))); + setContextMenu(new EntryCell.AddressContextMenu(address, utxoEntry.getOutputDescriptor(), new NodeEntry(utxoEntry.getWallet(), utxoEntry.getNode()), false)); Tooltip tooltip = new Tooltip(); tooltip.setShowDelay(Duration.millis(250)); tooltip.setText(getTooltipText(utxoEntry, addressStatus.isDuplicate(), addressStatus.isDustAttack())); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java index f7d0a62d..3ed5c841 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/EntryCell.java @@ -120,7 +120,7 @@ public class EntryCell extends TreeTableCell { NodeEntry nodeEntry = (NodeEntry)entry; Address address = nodeEntry.getAddress(); setText(address.toString()); - setContextMenu(new AddressContextMenu(address, nodeEntry.getOutputDescriptor(), nodeEntry)); + setContextMenu(new AddressContextMenu(address, nodeEntry.getOutputDescriptor(), nodeEntry, true)); Tooltip tooltip = new Tooltip(); tooltip.setShowDelay(Duration.millis(250)); tooltip.setText(nodeEntry.getNode().toString()); @@ -568,7 +568,7 @@ public class EntryCell extends TreeTableCell { } public static class AddressContextMenu extends ContextMenu { - public AddressContextMenu(Address address, String outputDescriptor, NodeEntry nodeEntry) { + public AddressContextMenu(Address address, String outputDescriptor, NodeEntry nodeEntry, boolean addUtxoItems) { if(nodeEntry == null || !nodeEntry.getWallet().isBip47()) { MenuItem receiveToAddress = new MenuItem("Receive To"); receiveToAddress.setGraphic(getReceiveGlyph()); @@ -591,7 +591,7 @@ public class EntryCell extends TreeTableCell { getItems().add(signVerifyMessage); } - if(nodeEntry != null && !nodeEntry.getNode().getUnspentTransactionOutputs().isEmpty()) { + if(addUtxoItems && nodeEntry != null && !nodeEntry.getNode().getUnspentTransactionOutputs().isEmpty()) { List utxos = nodeEntry.getNode().getUnspentTransactionOutputs().stream().collect(Collectors.toList()); MenuItem spendUtxos = new MenuItem("Spend UTXOs"); spendUtxos.setGraphic(getSendGlyph());