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

View file

@ -9,6 +9,11 @@
.qr-code {
-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.8), 10, 0, 0, 0);
-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 {