From 2896e18429db83ff05a3999dbe86ca746fba033a Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Thu, 12 Mar 2026 11:42:44 +0100 Subject: [PATCH] Adjust dialog message to show current status checking vs user interaction --- .../hub/CheckHostTrustController.java | 35 ++++++++++++++----- .../resources/fxml/hub_check_host_trust.fxml | 2 +- src/main/resources/i18n/strings.properties | 5 +-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostTrustController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostTrustController.java index 2a3ea249e..2201ed18d 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostTrustController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/CheckHostTrustController.java @@ -14,9 +14,10 @@ import org.slf4j.LoggerFactory; import javax.inject.Inject; import javafx.application.Platform; +import javafx.beans.property.SimpleStringProperty; +import javafx.beans.property.StringProperty; import javafx.fxml.FXML; import javafx.scene.Scene; -import javafx.scene.control.Label; import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.stage.Stage; @@ -31,8 +32,9 @@ import java.util.concurrent.CompletableFuture; public class CheckHostTrustController implements FxController { private static final Logger LOG = LoggerFactory.getLogger(CheckHostTrustController.class); - private static final String MESSAGE_SINGULAR_KEY = "hub.checkHostTrust.message"; - private static final String MESSAGE_PLURAL_KEY = "hub.checkHostTrust.message.plural"; + private static final String CHECK_KEY = "hub.checkHostTrust.message.check"; + private static final String ASK_SINGULAR_KEY = "hub.checkHostTrust.message.ask"; + private static final String ASK_PLURAL_KEY = "hub.checkHostTrust.message.ask.plural"; private static final String TRUSTED_CRYPTOMATOR_CLOUD_DOMAIN = ".cryptomator.cloud"; private final Stage window; @@ -46,15 +48,20 @@ public class CheckHostTrustController implements FxController { private final Environment env; private final ResourceBundle resourceBundle; private final SortedSet hostnames; - - @FXML - private Label messageLabel; + private final StringProperty messageLabel; @FXML private TextFlow hostnamesFlow; @Inject - public CheckHostTrustController(@KeyLoading Stage window, HubConfig hubConfig, @FxmlScene(FxmlFile.HUB_AUTH_FLOW) Lazy authFlowScene, @FxmlScene(FxmlFile.HUB_UNTRUSTED_HOST) Lazy untrustedHostScene, CompletableFuture result, Settings settings, Environment env, ResourceBundle resourceBundle) { + public CheckHostTrustController(@KeyLoading Stage window, // + HubConfig hubConfig, // + @FxmlScene(FxmlFile.HUB_AUTH_FLOW) Lazy authFlowScene, // + @FxmlScene(FxmlFile.HUB_UNTRUSTED_HOST) Lazy untrustedHostScene, // + CompletableFuture result, // + Settings settings, // + Environment env, // + ResourceBundle resourceBundle) { this.window = window; this.hubConfig = hubConfig; this.canonicalHubUri = hubConfig.getApiBaseUrl(); @@ -66,6 +73,7 @@ public class CheckHostTrustController implements FxController { this.env = env; this.resourceBundle = resourceBundle; this.hostnames = new TreeSet<>(); + this.messageLabel = new SimpleStringProperty(resourceBundle.getString(CHECK_KEY)); } @FXML @@ -113,8 +121,8 @@ public class CheckHostTrustController implements FxController { for (var hostname : hostnames) { hostnamesFlow.getChildren().add(new Text(hostname + System.lineSeparator())); } - var messageKey = hostnames.size() > 1 ? MESSAGE_PLURAL_KEY : MESSAGE_SINGULAR_KEY; - messageLabel.setText(resourceBundle.getString(messageKey)); + var messageKey = hostnames.size() > 1 ? ASK_PLURAL_KEY : ASK_SINGULAR_KEY; + messageLabel.set(resourceBundle.getString(messageKey)); } private boolean isConsistentHubConfig() { @@ -160,4 +168,13 @@ public class CheckHostTrustController implements FxController { }; } + //--- JavaFX property getter & setter + public StringProperty messageLabelProperty() { + return messageLabel; + } + + public String getMessageLabel() { + return messageLabel.get(); + } + } diff --git a/src/main/resources/fxml/hub_check_host_trust.fxml b/src/main/resources/fxml/hub_check_host_trust.fxml index ace2e660c..e93936a93 100644 --- a/src/main/resources/fxml/hub_check_host_trust.fxml +++ b/src/main/resources/fxml/hub_check_host_trust.fxml @@ -35,7 +35,7 @@ -