mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-20 03:31:27 +00:00
fixes #263
This commit is contained in:
@@ -43,6 +43,9 @@ public class SettingsController extends LocalizedFXMLViewController {
|
||||
@FXML
|
||||
private TextField portField;
|
||||
|
||||
@FXML
|
||||
private Label useIpv6Label;
|
||||
|
||||
@FXML
|
||||
private CheckBox useIpv6Checkbox;
|
||||
|
||||
@@ -55,7 +58,8 @@ public class SettingsController extends LocalizedFXMLViewController {
|
||||
checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled() && !areUpdatesManagedExternally());
|
||||
portField.setText(String.valueOf(settings.getPort()));
|
||||
portField.addEventFilter(KeyEvent.KEY_TYPED, this::filterNumericKeyEvents);
|
||||
useIpv6Checkbox.setDisable(!SystemUtils.IS_OS_WINDOWS);
|
||||
useIpv6Label.setVisible(SystemUtils.IS_OS_WINDOWS);
|
||||
useIpv6Checkbox.setVisible(SystemUtils.IS_OS_WINDOWS);
|
||||
useIpv6Checkbox.setSelected(SystemUtils.IS_OS_WINDOWS && settings.shouldUseIpv6());
|
||||
versionLabel.setText(String.format(localization.getString("settings.version.label"), applicationVersion().orElse("SNAPSHOT")));
|
||||
|
||||
@@ -81,7 +85,7 @@ public class SettingsController extends LocalizedFXMLViewController {
|
||||
private void portDidChange(String newValue) {
|
||||
try {
|
||||
int port = Integer.parseInt(newValue);
|
||||
if (port < Settings.MIN_PORT || port > Settings.MAX_PORT) {
|
||||
if (!settings.isPortValid(port)) {
|
||||
settings.setPort(Settings.DEFAULT_PORT);
|
||||
} else {
|
||||
settings.setPort(port);
|
||||
|
||||
@@ -93,8 +93,8 @@ public class Settings implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPortValid(int port) {
|
||||
return port == DEFAULT_PORT || port >= MIN_PORT && port <= MAX_PORT;
|
||||
public boolean isPortValid(int port) {
|
||||
return port == DEFAULT_PORT || port >= MIN_PORT && port <= MAX_PORT || port == 0;
|
||||
}
|
||||
|
||||
public boolean shouldUseIpv6() {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<TextField GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="portField" cacheShape="true" cache="true" promptText="%settings.port.prompt" />
|
||||
|
||||
<!-- Row 2 -->
|
||||
<Label GridPane.rowIndex="2" GridPane.columnIndex="0" text="%settings.useipv6.label" cacheShape="true" cache="true" />
|
||||
<Label GridPane.rowIndex="2" GridPane.columnIndex="0" fx:id="useIpv6Label" text="%settings.useipv6.label" cacheShape="true" cache="true" />
|
||||
<CheckBox GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="useIpv6Checkbox" cacheShape="true" cache="true" />
|
||||
</children>
|
||||
</GridPane>
|
||||
|
||||
Reference in New Issue
Block a user