mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 12:41:27 +00:00
refactor controller:
* fix vault options UI not showing * rename from "get" to "is" methods in vault options controller
This commit is contained in:
@@ -34,8 +34,7 @@ public class MountOptionsController implements FxController {
|
|||||||
|
|
||||||
private final Stage window;
|
private final Stage window;
|
||||||
private final Vault vault;
|
private final Vault vault;
|
||||||
private final boolean webDavAndWindows;
|
private final VolumeImpl usedVolumeImpl;
|
||||||
private final boolean fuseAndWindows;
|
|
||||||
private final WindowsDriveLetters windowsDriveLetters;
|
private final WindowsDriveLetters windowsDriveLetters;
|
||||||
private final ResourceBundle resourceBundle;
|
private final ResourceBundle resourceBundle;
|
||||||
|
|
||||||
@@ -52,8 +51,7 @@ public class MountOptionsController implements FxController {
|
|||||||
MountOptionsController(@VaultOptionsWindow Stage window, @VaultOptionsWindow Vault vault, Settings settings, WindowsDriveLetters windowsDriveLetters, ResourceBundle resourceBundle, Environment environment) {
|
MountOptionsController(@VaultOptionsWindow Stage window, @VaultOptionsWindow Vault vault, Settings settings, WindowsDriveLetters windowsDriveLetters, ResourceBundle resourceBundle, Environment environment) {
|
||||||
this.window = window;
|
this.window = window;
|
||||||
this.vault = vault;
|
this.vault = vault;
|
||||||
this.webDavAndWindows = settings.preferredVolumeImpl().get() == VolumeImpl.WEBDAV && SystemUtils.IS_OS_WINDOWS;
|
this.usedVolumeImpl = settings.preferredVolumeImpl().get();
|
||||||
this.fuseAndWindows = settings.preferredVolumeImpl().get() == VolumeImpl.FUSE && SystemUtils.IS_OS_WINDOWS;
|
|
||||||
this.windowsDriveLetters = windowsDriveLetters;
|
this.windowsDriveLetters = windowsDriveLetters;
|
||||||
this.resourceBundle = resourceBundle;
|
this.resourceBundle = resourceBundle;
|
||||||
}
|
}
|
||||||
@@ -64,7 +62,7 @@ public class MountOptionsController implements FxController {
|
|||||||
// readonly:
|
// readonly:
|
||||||
readOnlyCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().usesReadOnlyMode());
|
readOnlyCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().usesReadOnlyMode());
|
||||||
//TODO: support this feature on Windows
|
//TODO: support this feature on Windows
|
||||||
if (fuseAndWindows) {
|
if (usedVolumeImpl == VolumeImpl.FUSE && isOsWindows()) {
|
||||||
readOnlyCheckbox.setSelected(false); // to prevent invalid states
|
readOnlyCheckbox.setSelected(false); // to prevent invalid states
|
||||||
readOnlyCheckbox.setDisable(true);
|
readOnlyCheckbox.setDisable(true);
|
||||||
}
|
}
|
||||||
@@ -176,22 +174,26 @@ public class MountOptionsController implements FxController {
|
|||||||
|
|
||||||
// Getter & Setter
|
// Getter & Setter
|
||||||
|
|
||||||
public boolean getOsIsWindows() {
|
public boolean isOsWindows() {
|
||||||
return SystemUtils.IS_OS_WINDOWS;
|
return SystemUtils.IS_OS_WINDOWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getCustomMountPointSupported() {
|
public boolean isCustomMountPointSupported() {
|
||||||
return webDavAndWindows;
|
return !(usedVolumeImpl == VolumeImpl.WEBDAV && isOsWindows());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getReadOnlySupported() {
|
public boolean isReadOnlySupported() {
|
||||||
return fuseAndWindows;
|
return !(usedVolumeImpl == VolumeImpl.FUSE && isOsWindows()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringProperty customMountPathProperty() {
|
public StringProperty customMountPathProperty() {
|
||||||
return vault.getVaultSettings().customMountPath();
|
return vault.getVaultSettings().customMountPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCustomMountOptionsSupported() {
|
||||||
|
return !(usedVolumeImpl == VolumeImpl.WEBDAV);
|
||||||
|
}
|
||||||
|
|
||||||
public String getCustomMountPath() {
|
public String getCustomMountPath() {
|
||||||
return vault.getVaultSettings().customMountPath().get();
|
return vault.getVaultSettings().customMountPath().get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<children>
|
<children>
|
||||||
<CheckBox fx:id="readOnlyCheckbox" text="%vaultOptions.mount.readonly"/>
|
<CheckBox fx:id="readOnlyCheckbox" text="%vaultOptions.mount.readonly"/>
|
||||||
|
|
||||||
<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags" visible="${!controller.webDavAndWindows}" managed="${!controller.webDavAndWindows}"/>
|
<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags" visible="${controller.customMountOptionsSupported}" managed="${controller.customMountOptionsSupported}"/>
|
||||||
|
|
||||||
<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity">
|
<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
@@ -38,11 +38,11 @@
|
|||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
</Label>
|
</Label>
|
||||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointAuto" text="%vaultOptions.mount.mountPoint.auto"/>
|
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointAuto" text="%vaultOptions.mount.mountPoint.auto"/>
|
||||||
<HBox spacing="6" visible="${controller.osIsWindows}" managed="${controller.osIsWindows}">
|
<HBox spacing="6" visible="${controller.osWindows}" managed="${controller.osWindows}">
|
||||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointWinDriveLetter" text="%vaultOptions.mount.mountPoint.driveLetter"/>
|
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointWinDriveLetter" text="%vaultOptions.mount.mountPoint.driveLetter"/>
|
||||||
<ChoiceBox fx:id="driveLetterSelection" disable="${!mountPointWinDriveLetter.selected}"/>
|
<ChoiceBox fx:id="driveLetterSelection" disable="${!mountPointWinDriveLetter.selected}"/>
|
||||||
</HBox>
|
</HBox>
|
||||||
<HBox spacing="6" alignment="CENTER_LEFT" visible="${!controller.customMountPointSupported}" managed="${!controller.customMountPointSupported}">
|
<HBox fx:id="customMountPointRadioBtn" spacing="6" alignment="CENTER_LEFT" visible="${controller.customMountOptionsSupported}" managed="${controller.customMountOptionsSupported}">
|
||||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointCustomDir" text="%vaultOptions.mount.mountPoint.custom" />
|
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointCustomDir" text="%vaultOptions.mount.mountPoint.custom" />
|
||||||
<Button text="%vaultOptions.mount.mountPoint.directoryPickerButton" onAction="#chooseCustomMountPoint" contentDisplay="LEFT" disable="${!mountPointCustomDir.selected}">
|
<Button text="%vaultOptions.mount.mountPoint.directoryPickerButton" onAction="#chooseCustomMountPoint" contentDisplay="LEFT" disable="${!mountPointCustomDir.selected}">
|
||||||
<graphic>
|
<graphic>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
</graphic>
|
</graphic>
|
||||||
</Button>
|
</Button>
|
||||||
</HBox>
|
</HBox>
|
||||||
<TextField text="${controller.customMountPath}" visible="${mountPointCustomDir.selected}" maxWidth="Infinity" disable="true" managed="${!controller.webDavAndWindows}">
|
<TextField text="${controller.customMountPath}" visible="${mountPointCustomDir.selected}" maxWidth="Infinity" disable="true" managed="${customMountPointRadioBtn.managed}">
|
||||||
<VBox.margin>
|
<VBox.margin>
|
||||||
<Insets left="24"/>
|
<Insets left="24"/>
|
||||||
</VBox.margin>
|
</VBox.margin>
|
||||||
|
|||||||
Reference in New Issue
Block a user