From 64c90f8107d6c8e02f70a259b3fe2e1163cf90dc Mon Sep 17 00:00:00 2001 From: Ralph Plawetzki Date: Fri, 16 Sep 2022 18:59:15 +0200 Subject: [PATCH] Move checkbox to the front and rename members --- .../org/cryptomator/common/keychain/KeychainManager.java | 4 ++-- .../java/org/cryptomator/common/settings/Settings.java | 8 ++++---- .../cryptomator/common/settings/SettingsJsonAdapter.java | 4 ++-- .../ui/preferences/GeneralPreferencesController.java | 6 +++--- src/main/resources/fxml/preferences_general.fxml | 4 +--- src/main/resources/i18n/strings.properties | 1 - 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/cryptomator/common/keychain/KeychainManager.java b/src/main/java/org/cryptomator/common/keychain/KeychainManager.java index 8610c7f87..97c0a5de8 100644 --- a/src/main/java/org/cryptomator/common/keychain/KeychainManager.java +++ b/src/main/java/org/cryptomator/common/keychain/KeychainManager.java @@ -75,7 +75,7 @@ public class KeychainManager implements KeychainAccessProvider { @Override public boolean isSupported() { - return keychain.getValue() != null && !settings.disableAllKeyrings().get(); + return keychain.getValue() != null && settings.allowAllKeyrings().get(); } @Override @@ -94,7 +94,7 @@ public class KeychainManager implements KeychainAccessProvider { */ public boolean isPassphraseStored(String key) throws KeychainAccessException { // check if keyrings are disabled; in this case we don't need to ask the backend - if (settings.disableAllKeyrings().get()) return false; + if ( !settings.allowAllKeyrings().get() ) return false; char[] storedPw = null; try { storedPw = getKeychainOrFail().loadPassphrase(key); diff --git a/src/main/java/org/cryptomator/common/settings/Settings.java b/src/main/java/org/cryptomator/common/settings/Settings.java index 8c31f88b0..97e5e6794 100644 --- a/src/main/java/org/cryptomator/common/settings/Settings.java +++ b/src/main/java/org/cryptomator/common/settings/Settings.java @@ -33,7 +33,7 @@ public class Settings { public static final boolean DEFAULT_CHECK_FOR_UPDATES = false; public static final boolean DEFAULT_START_HIDDEN = false; public static final boolean DEFAULT_AUTO_CLOSE_VAULTS = false; - public static final boolean DEFAULT_DISABLE_ALL_KEYRINGS = false; + public static final boolean DEFAULT_ALLOW_ALL_KEYRINGS = true; public static final int DEFAULT_PORT = 42427; public static final int DEFAULT_NUM_TRAY_NOTIFICATIONS = 3; public static final WebDavUrlScheme DEFAULT_GVFS_SCHEME = WebDavUrlScheme.DAV; @@ -54,7 +54,7 @@ public class Settings { private final BooleanProperty checkForUpdates = new SimpleBooleanProperty(DEFAULT_CHECK_FOR_UPDATES); private final BooleanProperty startHidden = new SimpleBooleanProperty(DEFAULT_START_HIDDEN); private final BooleanProperty autoCloseVaults = new SimpleBooleanProperty(DEFAULT_AUTO_CLOSE_VAULTS); - private final BooleanProperty disableAllKeyrings = new SimpleBooleanProperty(DEFAULT_DISABLE_ALL_KEYRINGS); + private final BooleanProperty allowAllKeyrings = new SimpleBooleanProperty(DEFAULT_ALLOW_ALL_KEYRINGS); private final IntegerProperty port = new SimpleIntegerProperty(DEFAULT_PORT); private final IntegerProperty numTrayNotifications = new SimpleIntegerProperty(DEFAULT_NUM_TRAY_NOTIFICATIONS); private final ObjectProperty preferredGvfsScheme = new SimpleObjectProperty<>(DEFAULT_GVFS_SCHEME); @@ -87,7 +87,7 @@ public class Settings { checkForUpdates.addListener(this::somethingChanged); startHidden.addListener(this::somethingChanged); autoCloseVaults.addListener(this::somethingChanged); - disableAllKeyrings.addListener(this::somethingChanged); + allowAllKeyrings.addListener(this::somethingChanged); port.addListener(this::somethingChanged); numTrayNotifications.addListener(this::somethingChanged); preferredGvfsScheme.addListener(this::somethingChanged); @@ -143,7 +143,7 @@ public class Settings { return autoCloseVaults; } - public BooleanProperty disableAllKeyrings() { return disableAllKeyrings; } + public BooleanProperty allowAllKeyrings() { return allowAllKeyrings; } public IntegerProperty port() { return port; diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java index 34e1b4a7d..3f1e4aabe 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java @@ -50,7 +50,7 @@ public class SettingsJsonAdapter extends TypeAdapter { out.name("theme").value(value.theme().get().name()); out.name("uiOrientation").value(value.userInterfaceOrientation().get().name()); out.name("keychainProvider").value(value.keychainProvider().get()); - out.name("disableAllKeyrings").value(value.disableAllKeyrings().get()); + out.name("allowAllKeyrings").value(value.allowAllKeyrings().get()); out.name("licenseKey").value(value.licenseKey().get()); out.name("showMinimizeButton").value(value.showMinimizeButton().get()); out.name("showTrayIcon").value(value.showTrayIcon().get()); @@ -93,7 +93,7 @@ public class SettingsJsonAdapter extends TypeAdapter { case "theme" -> settings.theme().set(parseUiTheme(in.nextString())); case "uiOrientation" -> settings.userInterfaceOrientation().set(parseUiOrientation(in.nextString())); case "keychainProvider" -> settings.keychainProvider().set(in.nextString()); - case "disableAllKeyrings" -> settings.disableAllKeyrings().set(in.nextBoolean()); + case "allowAllKeyrings" -> settings.allowAllKeyrings().set(in.nextBoolean()); case "licenseKey" -> settings.licenseKey().set(in.nextString()); case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean()); case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean()); diff --git a/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java b/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java index 8b7480752..cf023fc82 100644 --- a/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java +++ b/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java @@ -33,7 +33,7 @@ public class GeneralPreferencesController implements FxController { private final Application application; private final Environment environment; private final List keychainAccessProviders; - public CheckBox disableAllKeyringsCheckbox; + public CheckBox allowAllKeyringsCheckbox; private final FxApplicationWindows appWindows; public ChoiceBox keychainBackendChoiceBox; public CheckBox startHiddenCheckbox; @@ -65,8 +65,8 @@ public class GeneralPreferencesController implements FxController { keychainBackendChoiceBox.setValue(keychainSettingsConverter.fromString(settings.keychainProvider().get())); keychainBackendChoiceBox.setConverter(new KeychainProviderDisplayNameConverter()); Bindings.bindBidirectional(settings.keychainProvider(), keychainBackendChoiceBox.valueProperty(), keychainSettingsConverter); - disableAllKeyringsCheckbox.selectedProperty().bindBidirectional(settings.disableAllKeyrings()); - keychainBackendChoiceBox.disableProperty().bindBidirectional(settings.disableAllKeyrings()); + allowAllKeyringsCheckbox.selectedProperty().bindBidirectional(settings.allowAllKeyrings()); + keychainBackendChoiceBox.disableProperty().bind(allowAllKeyringsCheckbox.selectedProperty().not()); } public boolean isAutoStartSupported() { diff --git a/src/main/resources/fxml/preferences_general.fxml b/src/main/resources/fxml/preferences_general.fxml index 42ac438d7..4f358ed55 100644 --- a/src/main/resources/fxml/preferences_general.fxml +++ b/src/main/resources/fxml/preferences_general.fxml @@ -4,7 +4,6 @@ - @@ -27,9 +26,8 @@ - diff --git a/src/main/resources/i18n/strings.properties b/src/main/resources/i18n/strings.properties index 8ce43dc70..460b56476 100644 --- a/src/main/resources/i18n/strings.properties +++ b/src/main/resources/i18n/strings.properties @@ -235,7 +235,6 @@ preferences.general.debugLogging=Enable debug logging preferences.general.debugDirectory=Reveal log files preferences.general.autoStart=Launch Cryptomator on system start preferences.general.keychainBackend=Store passwords with -preferences.general.disableAllKeyrings=Disable all keyrings ## Interface preferences.interface=Interface preferences.interface.theme=Look & Feel