close qr display dialog for current fresh address when it updates

This commit is contained in:
Craig Raw 2024-04-04 12:50:03 +02:00
parent 6b4c301458
commit 33d9f260c4
2 changed files with 15 additions and 4 deletions

View file

@ -70,6 +70,8 @@ public class ReceiveController extends WalletFormController implements Initializ
private NodeEntry currentEntry; private NodeEntry currentEntry;
private QRDisplayDialog addressQrDialog;
@Override @Override
public void initialize(URL location, ResourceBundle resources) { public void initialize(URL location, ResourceBundle resources) {
EventManager.get().register(this); EventManager.get().register(this);
@ -83,10 +85,11 @@ public class ReceiveController extends WalletFormController implements Initializ
displayAddress.setVisible(false); displayAddress.setVisible(false);
qrCode.setOnMouseClicked(event -> { qrCode.setOnMouseClicked(event -> {
if(currentEntry != null) { if(currentEntry != null && addressQrDialog == null) {
QRDisplayDialog qrDisplayDialog = new QRDisplayDialog(currentEntry.getAddress().toString()); addressQrDialog = new QRDisplayDialog(currentEntry.getAddress().toString());
qrDisplayDialog.initOwner(address.getScene().getWindow()); addressQrDialog.initOwner(address.getScene().getWindow());
qrDisplayDialog.showAndWait(); addressQrDialog.showAndWait();
addressQrDialog = null;
} }
}); });
@ -198,6 +201,9 @@ public class ReceiveController extends WalletFormController implements Initializ
public void refreshAddress() { public void refreshAddress() {
NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry); NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry);
setNodeEntry(freshEntry); setNodeEntry(freshEntry);
if(addressQrDialog != null) {
addressQrDialog.close();
}
} }
private void ensureSufficientGapLimit(int index) { private void ensureSufficientGapLimit(int index) {

View file

@ -9,6 +9,11 @@
.qr-code { .qr-code {
-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0); -fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0);
-fx-padding: 20; -fx-padding: 20;
-fx-cursor: hand;
}
.qr-code:hover {
-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 10, 0, 0, 0);
} }
#lastUsedField .input-container, #derivationField .input-container { #lastUsedField .input-container, #derivationField .input-container {