mirror of
https://github.com/cryptomator/cryptomator.git
synced 2024-11-23 12:09:45 +00:00
renamed mount option controller members
This commit is contained in:
parent
4029f86a0d
commit
2d3a035d9e
@ -44,11 +44,11 @@ public class MountOptionsController implements FxController {
|
||||
|
||||
public CheckBox readOnlyCheckbox;
|
||||
public CheckBox customMountFlagsCheckbox;
|
||||
public TextField mountFlags;
|
||||
public ToggleGroup mountPoint;
|
||||
public RadioButton mountPointAuto;
|
||||
public RadioButton mountPointWinDriveLetter;
|
||||
public RadioButton mountPointCustomDir;
|
||||
public TextField mountFlagsField;
|
||||
public ToggleGroup mountPointToggleGroup;
|
||||
public RadioButton mountPointAutoBtn;
|
||||
public RadioButton mountPointDriveLetterBtn;
|
||||
public RadioButton mountPointDirBtn;
|
||||
public ChoiceBox<String> driveLetterSelection;
|
||||
|
||||
@Inject
|
||||
@ -70,26 +70,26 @@ public class MountOptionsController implements FxController {
|
||||
readOnlyCheckbox.selectedProperty().bindBidirectional(vault.getVaultSettings().usesReadOnlyMode());
|
||||
|
||||
// custom mount flags:
|
||||
mountFlags.disableProperty().bind(customMountFlagsCheckbox.selectedProperty().not());
|
||||
mountFlagsField.disableProperty().bind(customMountFlagsCheckbox.selectedProperty().not());
|
||||
customMountFlagsCheckbox.setSelected(vault.isHavingCustomMountFlags());
|
||||
|
||||
// mount point options:
|
||||
mountPoint.selectedToggleProperty().addListener(this::toggleMountPoint);
|
||||
mountPointToggleGroup.selectedToggleProperty().addListener(this::toggleMountPoint);
|
||||
driveLetterSelection.getItems().addAll(windowsDriveLetters.getAllDriveLetters());
|
||||
driveLetterSelection.setConverter(new WinDriveLetterLabelConverter(windowsDriveLetters, resourceBundle));
|
||||
driveLetterSelection.setValue(vault.getVaultSettings().winDriveLetter().get());
|
||||
|
||||
if (vault.getVaultSettings().useCustomMountPath().get() && vault.getVaultSettings().getCustomMountPath().isPresent()) {
|
||||
mountPoint.selectToggle(mountPointCustomDir);
|
||||
mountPointToggleGroup.selectToggle(mountPointDirBtn);
|
||||
} else if (!Strings.isNullOrEmpty(vault.getVaultSettings().winDriveLetter().get())) {
|
||||
mountPoint.selectToggle(mountPointWinDriveLetter);
|
||||
mountPointToggleGroup.selectToggle(mountPointDriveLetterBtn);
|
||||
} else {
|
||||
mountPoint.selectToggle(mountPointAuto);
|
||||
mountPointToggleGroup.selectToggle(mountPointAutoBtn);
|
||||
}
|
||||
|
||||
vault.getVaultSettings().useCustomMountPath().bind(mountPoint.selectedToggleProperty().isEqualTo(mountPointCustomDir));
|
||||
vault.getVaultSettings().useCustomMountPath().bind(mountPointToggleGroup.selectedToggleProperty().isEqualTo(mountPointDirBtn));
|
||||
vault.getVaultSettings().winDriveLetter().bind( //
|
||||
Bindings.when(mountPoint.selectedToggleProperty().isEqualTo(mountPointWinDriveLetter)) //
|
||||
Bindings.when(mountPointToggleGroup.selectedToggleProperty().isEqualTo(mountPointDriveLetterBtn)) //
|
||||
.then(driveLetterSelection.getSelectionModel().selectedItemProperty()) //
|
||||
.otherwise((String) null) //
|
||||
);
|
||||
@ -99,19 +99,19 @@ public class MountOptionsController implements FxController {
|
||||
public void toggleUseCustomMountFlags() {
|
||||
if (customMountFlagsCheckbox.isSelected()) {
|
||||
readOnlyCheckbox.setSelected(false); // to prevent invalid states
|
||||
mountFlags.textProperty().unbind();
|
||||
mountFlagsField.textProperty().unbind();
|
||||
vault.setCustomMountFlags(vault.defaultMountFlagsProperty().getValue());
|
||||
mountFlags.textProperty().bindBidirectional(vault.getVaultSettings().mountFlags());
|
||||
mountFlagsField.textProperty().bindBidirectional(vault.getVaultSettings().mountFlags());
|
||||
} else {
|
||||
mountFlags.textProperty().unbindBidirectional(vault.getVaultSettings().mountFlags());
|
||||
mountFlagsField.textProperty().unbindBidirectional(vault.getVaultSettings().mountFlags());
|
||||
vault.setCustomMountFlags(null);
|
||||
mountFlags.textProperty().bind(vault.defaultMountFlagsProperty());
|
||||
mountFlagsField.textProperty().bind(vault.defaultMountFlagsProperty());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void chooseCustomMountPoint() {
|
||||
chooseCustomMountPointOrReset(mountPointCustomDir);
|
||||
chooseCustomMountPointOrReset(mountPointDirBtn);
|
||||
}
|
||||
|
||||
private void chooseCustomMountPointOrReset(Toggle previousMountToggle) {
|
||||
@ -130,12 +130,12 @@ public class MountOptionsController implements FxController {
|
||||
if (file != null) {
|
||||
vault.getVaultSettings().customMountPath().set(file.getAbsolutePath());
|
||||
} else {
|
||||
mountPoint.selectToggle(previousMountToggle);
|
||||
mountPointToggleGroup.selectToggle(previousMountToggle);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleMountPoint(@SuppressWarnings("unused") ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) {
|
||||
if (mountPointCustomDir.equals(newValue) && Strings.isNullOrEmpty(vault.getVaultSettings().customMountPath().get())) {
|
||||
if (mountPointDirBtn.equals(newValue) && Strings.isNullOrEmpty(vault.getVaultSettings().customMountPath().get())) {
|
||||
chooseCustomMountPointOrReset(oldValue);
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
fx:controller="org.cryptomator.ui.vaultoptions.MountOptionsController"
|
||||
spacing="6">
|
||||
<fx:define>
|
||||
<ToggleGroup fx:id="mountPoint"/>
|
||||
<ToggleGroup fx:id="mountPointToggleGroup"/>
|
||||
</fx:define>
|
||||
<padding>
|
||||
<Insets topRightBottomLeft="12"/>
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
<VBox visible="${controller.mountFlagsSupported}" managed="${controller.mountFlagsSupported}">
|
||||
<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags"/>
|
||||
<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity">
|
||||
<TextField fx:id="mountFlagsField" HBox.hgrow="ALWAYS" maxWidth="Infinity">
|
||||
<VBox.margin>
|
||||
<Insets left="24"/>
|
||||
</VBox.margin>
|
||||
@ -40,22 +40,22 @@
|
||||
</VBox.margin>
|
||||
</Label>
|
||||
|
||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointAuto" text="%vaultOptions.mount.mountPoint.auto"/>
|
||||
<RadioButton toggleGroup="${mountPointToggleGroup}" fx:id="mountPointAutoBtn" text="%vaultOptions.mount.mountPoint.auto"/>
|
||||
|
||||
<HBox spacing="6" visible="${controller.mountpointDriveLetterSupported}" managed="${controller.mountpointDriveLetterSupported}">
|
||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointWinDriveLetter" text="%vaultOptions.mount.mountPoint.driveLetter"/>
|
||||
<RadioButton toggleGroup="${mountPointToggleGroup}" fx:id="mountPointDriveLetterBtn" text="%vaultOptions.mount.mountPoint.driveLetter"/>
|
||||
<ChoiceBox fx:id="driveLetterSelection" disable="${!mountPointWinDriveLetter.selected}"/>
|
||||
</HBox>
|
||||
|
||||
<HBox fx:id="customMountPointRadioBtn" spacing="6" alignment="CENTER_LEFT" visible="${controller.mountpointDirSupported}" managed="${controller.mountpointDirSupported}">
|
||||
<RadioButton toggleGroup="${mountPoint}" fx:id="mountPointCustomDir" text="%vaultOptions.mount.mountPoint.custom"/>
|
||||
<RadioButton toggleGroup="${mountPointToggleGroup}" fx:id="mountPointDirBtn" text="%vaultOptions.mount.mountPoint.custom"/>
|
||||
<Button text="%vaultOptions.mount.mountPoint.directoryPickerButton" onAction="#chooseCustomMountPoint" contentDisplay="LEFT" disable="${!mountPointCustomDir.selected}">
|
||||
<graphic>
|
||||
<FontAwesome5IconView glyph="FOLDER_OPEN" glyphSize="15"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
</HBox>
|
||||
<TextField text="${controller.customMountPath}" visible="${mountPointCustomDir.selected}" maxWidth="Infinity" disable="true" managed="${customMountPointRadioBtn.managed}">
|
||||
<TextField text="${controller.customMountPath}" visible="${mountPointDirBtn.selected}" maxWidth="Infinity" disable="true" managed="${customMountPointRadioBtn.managed}">
|
||||
<VBox.margin>
|
||||
<Insets left="24"/>
|
||||
</VBox.margin>
|
||||
|
Loading…
Reference in New Issue
Block a user