mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
Adjust dialog message to show current status
checking vs user interaction
This commit is contained in:
@@ -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<String> 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<Scene> authFlowScene, @FxmlScene(FxmlFile.HUB_UNTRUSTED_HOST) Lazy<Scene> untrustedHostScene, CompletableFuture<ReceivedKey> result, Settings settings, Environment env, ResourceBundle resourceBundle) {
|
||||
public CheckHostTrustController(@KeyLoading Stage window, //
|
||||
HubConfig hubConfig, //
|
||||
@FxmlScene(FxmlFile.HUB_AUTH_FLOW) Lazy<Scene> authFlowScene, //
|
||||
@FxmlScene(FxmlFile.HUB_UNTRUSTED_HOST) Lazy<Scene> untrustedHostScene, //
|
||||
CompletableFuture<ReceivedKey> 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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</StackPane>
|
||||
</Group>
|
||||
<VBox HBox.hgrow="ALWAYS">
|
||||
<Label fx:id="messageLabel" styleClass="label-large" text="%hub.checkHostTrust.message" wrapText="true" textAlignment="LEFT">
|
||||
<Label styleClass="label-large" text="${controller.messageLabel}" wrapText="true" textAlignment="LEFT">
|
||||
<padding>
|
||||
<Insets bottom="6" top="6"/>
|
||||
</padding>
|
||||
|
||||
@@ -163,8 +163,9 @@ hub.noKeychain.message=Unable to access device key
|
||||
hub.noKeychain.description=In order to unlock Hub vaults, a device key is required, which is secured using a keychain. To proceed, enable “%s” and select a keychain in the preferences.
|
||||
hub.noKeychain.openBtn=Open Preferences
|
||||
### Check Host Authenticity
|
||||
hub.checkHostTrust.message=Trust this host?
|
||||
hub.checkHostTrust.message.plural=Trust these hosts?
|
||||
hub.checkHostTrust.message.check=Checking Configuration…
|
||||
hub.checkHostTrust.message.ask=Trust this host?
|
||||
hub.checkHostTrust.message.ask.plural=Trust these hosts?
|
||||
hub.checkHostTrust.trustBtn=Trust
|
||||
hub.checkHostTrust.denyBtn=Deny
|
||||
### Waiting
|
||||
|
||||
Reference in New Issue
Block a user