disable receive address field once used

This commit is contained in:
Craig Raw 2021-04-20 11:46:36 +02:00
parent e62b44bbbe
commit 164742387f
2 changed files with 3 additions and 1 deletions

View file

@ -126,6 +126,7 @@ public class ReceiveController extends WalletFormController implements Initializ
lastUsed.setText("Never"); lastUsed.setText("Never");
lastUsed.setGraphic(getUnusedGlyph()); lastUsed.setGraphic(getUnusedGlyph());
address.getStyleClass().remove("error"); address.getStyleClass().remove("error");
address.setDisable(false);
} else if(!currentOutputs.isEmpty()) { } else if(!currentOutputs.isEmpty()) {
long count = currentOutputs.size(); long count = currentOutputs.size();
BlockTransactionHashIndex lastUsedReference = currentOutputs.stream().skip(count - 1).findFirst().get(); BlockTransactionHashIndex lastUsedReference = currentOutputs.stream().skip(count - 1).findFirst().get();
@ -133,11 +134,13 @@ public class ReceiveController extends WalletFormController implements Initializ
lastUsed.setGraphic(getWarningGlyph()); lastUsed.setGraphic(getWarningGlyph());
if(!address.getStyleClass().contains("error")) { if(!address.getStyleClass().contains("error")) {
address.getStyleClass().add("error"); address.getStyleClass().add("error");
address.setDisable(true);
} }
} else { } else {
lastUsed.setText("Unknown"); lastUsed.setText("Unknown");
lastUsed.setGraphic(null); lastUsed.setGraphic(null);
address.getStyleClass().remove("error"); address.getStyleClass().remove("error");
address.setDisable(false);
} }
} }

View file

@ -9,7 +9,6 @@
<?import tornadofx.control.Fieldset?> <?import tornadofx.control.Fieldset?>
<?import tornadofx.control.Form?> <?import tornadofx.control.Form?>
<?import tornadofx.control.Field?> <?import tornadofx.control.Field?>
<?import com.sparrowwallet.sparrow.control.CopyableTextField?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import com.sparrowwallet.sparrow.control.CopyableLabel?> <?import com.sparrowwallet.sparrow.control.CopyableLabel?>