mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-19 13:46:04 +00:00
including windows mount option for selecting mount point (without functionality)
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
package org.cryptomator.ui.vaultoptions;
|
||||
|
||||
import javafx.beans.binding.BooleanBinding;
|
||||
import javafx.beans.property.BooleanProperty;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.cryptomator.common.settings.Settings;
|
||||
import org.cryptomator.common.settings.VolumeImpl;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
|
||||
@@ -12,14 +21,22 @@ import javax.inject.Inject;
|
||||
public class MountOptionsController implements FxController {
|
||||
|
||||
private final Vault vault;
|
||||
private final BooleanProperty osIsWindows = new SimpleBooleanProperty(SystemUtils.IS_OS_WINDOWS);
|
||||
private final BooleanBinding adapterIsDokan;
|
||||
private final ToggleGroup toggleGroup;
|
||||
public TextField driveName;
|
||||
public CheckBox readOnlyCheckbox;
|
||||
public CheckBox customMountFlagsCheckbox;
|
||||
public TextField mountFlags;
|
||||
public RadioButton automaticDriveLetter;
|
||||
public RadioButton specificDriveLetter;
|
||||
public RadioButton specificDirectory;
|
||||
|
||||
@Inject
|
||||
MountOptionsController(@VaultOptionsWindow Vault vault) {
|
||||
MountOptionsController(@VaultOptionsWindow Vault vault, Settings settings) {
|
||||
this.vault = vault;
|
||||
this.adapterIsDokan = settings.preferredVolumeImpl().isEqualTo(VolumeImpl.DOKANY);
|
||||
this.toggleGroup = new ToggleGroup();
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -36,6 +53,9 @@ public class MountOptionsController implements FxController {
|
||||
} else {
|
||||
mountFlags.textProperty().bind(vault.defaultMountFlagsProperty());
|
||||
}
|
||||
|
||||
toggleGroup.getToggles().addAll(automaticDriveLetter, specificDriveLetter, specificDirectory);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -51,4 +71,44 @@ public class MountOptionsController implements FxController {
|
||||
mountFlags.textProperty().bind(vault.defaultMountFlagsProperty());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void changeMountPointForWindows() {
|
||||
assert osIsWindows.get();
|
||||
if (specificDriveLetter.isSelected()) {
|
||||
//TODO: set any default free drive letter
|
||||
} else if (specificDirectory.isSelected()) {
|
||||
vault.getVaultSettings().usesIndividualMountPath().set(true);
|
||||
//TODO: open directory picker
|
||||
|
||||
} else {
|
||||
//set property
|
||||
vault.getVaultSettings().usesIndividualMountPath().set(false);
|
||||
vault.getVaultSettings().winDriveLetter().set(null);
|
||||
vault.getVaultSettings().individualMountPath().set(null);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void selectEmptyDirectory(ActionEvent actionEvent) {
|
||||
}
|
||||
|
||||
// Getter & Setter
|
||||
|
||||
public BooleanProperty osIsWindowsProperty() {
|
||||
return osIsWindows;
|
||||
}
|
||||
|
||||
public boolean getOsIsWindows() {
|
||||
return osIsWindows.get();
|
||||
}
|
||||
|
||||
public BooleanBinding adapterIsDokanProperty() {
|
||||
return adapterIsDokan;
|
||||
}
|
||||
|
||||
public boolean getAdapterIsDokan() {
|
||||
return adapterIsDokan.get();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.Hyperlink?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.RadioButton?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.cryptomator.ui.controls.AlphanumericTextField?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.vaultoptions.MountOptionsController"
|
||||
@@ -31,7 +35,26 @@
|
||||
<TextField fx:id="mountFlags" HBox.hgrow="ALWAYS" maxWidth="Infinity"/>
|
||||
</children>
|
||||
</HBox>
|
||||
|
||||
|
||||
<!-- TODO windows drive letter, see https://github.com/cryptomator/cryptomator/blob/1.4.16/main/ui/src/main/java/org/cryptomator/ui/model/Vault.java#L283-L298 -->
|
||||
<!-- TODO maybe change label to text because you cannot interact with the hbox -->
|
||||
<Label text="Mount Point"/>
|
||||
<RadioButton fx:id="automaticDriveLetter" text="Automatically pick free drive letter" visible="${controller.osIsWindows}" managed="${controller.adapterIsDokan}" onAction="#changeMountPointForWindows"/>
|
||||
<HBox spacing="6">
|
||||
<children>
|
||||
<RadioButton fx:id="specificDriveLetter" text="Choose specific drive letter" visible="${controller.osIsWindows}" managed="${controller.adapterIsDokan}" onAction="#changeMountPointForWindows"/>
|
||||
<ChoiceBox fx:id="DriveLetterSelection" disable="${!specificDriveLetter.selected}"/>
|
||||
</children>
|
||||
</HBox>
|
||||
<RadioButton fx:id="specificDirectory" text="Choose empty directory" visible="${controller.adapterIsDokan}" managed="${controller.adapterIsDokan}" onAction="#changeMountPointForWindows"/>
|
||||
<HBox visible="${specificDirectory.selected}" >
|
||||
<padding>
|
||||
<Insets left="25"/>
|
||||
</padding>
|
||||
<children>
|
||||
<TextField fx:id="mntDir" HBox.hgrow="ALWAYS" maxWidth="Infinity"/>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user