Move checkbox to the front and rename members

This commit is contained in:
Ralph Plawetzki
2022-09-16 18:59:15 +02:00
parent b34bf6f161
commit 64c90f8107
6 changed files with 12 additions and 15 deletions

View File

@@ -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);

View File

@@ -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<WebDavUrlScheme> 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;

View File

@@ -50,7 +50,7 @@ public class SettingsJsonAdapter extends TypeAdapter<Settings> {
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<Settings> {
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());

View File

@@ -33,7 +33,7 @@ public class GeneralPreferencesController implements FxController {
private final Application application;
private final Environment environment;
private final List<KeychainAccessProvider> keychainAccessProviders;
public CheckBox disableAllKeyringsCheckbox;
public CheckBox allowAllKeyringsCheckbox;
private final FxApplicationWindows appWindows;
public ChoiceBox<KeychainAccessProvider> 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() {

View File

@@ -4,7 +4,6 @@
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
@@ -27,9 +26,8 @@
<CheckBox fx:id="autoCloseVaultsCheckbox" text="%preferences.general.autoCloseVaults" />
<HBox spacing="12" alignment="CENTER_LEFT">
<Label text="%preferences.general.keychainBackend"/>
<CheckBox fx:id="allowAllKeyringsCheckbox" text="%preferences.general.keychainBackend"/>
<ChoiceBox fx:id="keychainBackendChoiceBox"/>
<CheckBox text="%preferences.general.disableAllKeyrings" fx:id="disableAllKeyringsCheckbox"/>
</HBox>
<Region VBox.vgrow="ALWAYS"/>

View File

@@ -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