mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 18:21:26 +00:00
implement requested changes from PR review
This commit is contained in:
@@ -26,6 +26,7 @@ public class CreateNewVaultExpertSettingsController implements FxController {
|
||||
public static final int DEFAULT_SHORTENING_THRESHOLD = 220;
|
||||
public static final int MIN_SHORTENING_THRESHOLD = 36;
|
||||
private static final String DOCS_NAME_SHORTENING_URL = "https://docs.cryptomator.org/en/1.7/security/architecture/#name-shortening";
|
||||
|
||||
private final Stage window;
|
||||
private final Lazy<Application> application;
|
||||
private final Lazy<Scene> chooseLocationScene;
|
||||
@@ -60,6 +61,8 @@ public class CreateNewVaultExpertSettingsController implements FxController {
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
shorteningThresholdTextField.setPromptText(MIN_SHORTENING_THRESHOLD + "-" + DEFAULT_SHORTENING_THRESHOLD);
|
||||
shorteningThresholdTextField.setText(Integer.toString(DEFAULT_SHORTENING_THRESHOLD));
|
||||
shorteningThresholdTextField.textProperty().addListener((observable, oldValue, newValue) -> {
|
||||
try {
|
||||
int intValue = Integer.parseInt(newValue);
|
||||
@@ -73,7 +76,7 @@ public class CreateNewVaultExpertSettingsController implements FxController {
|
||||
@FXML
|
||||
public void toggleUseExpertSettings() {
|
||||
if (!expertSettingsCheckBox.isSelected()) {
|
||||
shorteningThresholdTextField.setText(DEFAULT_SHORTENING_THRESHOLD + "");
|
||||
shorteningThresholdTextField.setText(Integer.toString(DEFAULT_SHORTENING_THRESHOLD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,15 +95,11 @@ public class CreateNewVaultExpertSettingsController implements FxController {
|
||||
}
|
||||
|
||||
public boolean isValidShorteningThreshold() {
|
||||
try {
|
||||
var value = shorteningThreshold.get();
|
||||
if (value < MIN_SHORTENING_THRESHOLD || value > DEFAULT_SHORTENING_THRESHOLD) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
var value = shorteningThreshold.get();
|
||||
if (value < MIN_SHORTENING_THRESHOLD || value > DEFAULT_SHORTENING_THRESHOLD) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,6 @@ public class CreateNewVaultLocationController implements FxController {
|
||||
@Inject
|
||||
CreateNewVaultLocationController(@AddVaultWizardWindow Stage window, //
|
||||
@FxmlScene(FxmlFile.ADDVAULT_NEW_NAME) Lazy<Scene> chooseNameScene, //
|
||||
@FxmlScene(FxmlFile.ADDVAULT_NEW_PASSWORD) Lazy<Scene> choosePasswordScene, //
|
||||
@FxmlScene(FxmlFile.ADDVAULT_NEW_EXPERT_SETTINGS) Lazy<Scene> chooseExpertSettingsScene, //
|
||||
ObjectProperty<Path> vaultPath, //
|
||||
@Named("vaultName") StringProperty vaultName, //
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</Hyperlink>
|
||||
</HBox>
|
||||
<HBox>
|
||||
<NumericTextField fx:id="shorteningThresholdTextField" promptText="%addvaultwizard.new.shorteningThreshold.namePrompt" text="220"/>
|
||||
<NumericTextField fx:id="shorteningThresholdTextField"/>
|
||||
<Region prefWidth="4" HBox.hgrow="NEVER"/>
|
||||
<StackPane>
|
||||
<Label styleClass="label-muted" text="%addvaultwizard.new.shorteningThreshold.invalid" textAlignment="RIGHT" alignment="CENTER_RIGHT" visible="${!controller.validShorteningThreshold}" graphicTextGap="6">
|
||||
|
||||
@@ -66,7 +66,6 @@ addvaultwizard.new.validCharacters.dashes=Hyphen (%s) or underscore (%s)
|
||||
addvaultwizard.new.enableExpertSettings.checkbox=Enable expert settings
|
||||
addvaultwizard.new.shorteningThreshold.title=Limit the length of encrypted file names.
|
||||
addvaultwizard.new.shorteningThreshold.tooltip=Open the documentation to learn more.
|
||||
addvaultwizard.new.shorteningThreshold.namePrompt=36-220
|
||||
addvaultwizard.new.shorteningThreshold.message=Enter a value between 36 and 220 (default 220).
|
||||
addvaultwizard.new.shorteningThreshold.invalid=Invalid
|
||||
addvaultwizard.new.shorteningThreshold.valid=Valid
|
||||
|
||||
Reference in New Issue
Block a user