first impl draft

This commit is contained in:
Armin Schrenk 2023-03-20 14:38:22 +01:00
parent 77bc60fe5b
commit dcfdb5ad21
No known key found for this signature in database
GPG Key ID: 8F2992163CBBA7FC
5 changed files with 30 additions and 2 deletions

View File

@ -38,7 +38,7 @@
<cryptomator.integrations.win.version>1.2.0</cryptomator.integrations.win.version>
<cryptomator.integrations.mac.version>1.2.0</cryptomator.integrations.mac.version>
<cryptomator.integrations.linux.version>1.2.0</cryptomator.integrations.linux.version>
<cryptomator.fuse.version>2.0.4</cryptomator.fuse.version>
<cryptomator.fuse.version>2.1.0-SNAPSHOT</cryptomator.fuse.version>
<cryptomator.dokany.version>2.0.0</cryptomator.dokany.version>
<cryptomator.webdav.version>2.0.2</cryptomator.webdav.version>

View File

@ -65,7 +65,13 @@ public class Mounter {
builder.setMountFlags(mountFlags);
}
}
case VOLUME_ID -> builder.setVolumeId(vaultSettings.getId());
case VOLUME_ID -> {
if(vaultSettings.usesVaultIdAsVolumeId().get()) {
builder.setVolumeId(vaultSettings.getId()+"\\test");
} else {
builder.setVolumeId(vaultSettings.mountName().get());
}
}
case VOLUME_NAME -> builder.setVolumeName(vaultSettings.mountName().get());
}
}

View File

@ -42,6 +42,7 @@ public class VaultSettings {
private final String id;
private final ObjectProperty<Path> path = new SimpleObjectProperty<>();
private final StringProperty displayName = new SimpleStringProperty();
private final BooleanProperty vaultIdAsVolumeId = new SimpleBooleanProperty(false);
private final BooleanProperty unlockAfterStartup = new SimpleBooleanProperty(DEFAULT_UNLOCK_AFTER_STARTUP);
private final BooleanProperty revealAfterMount = new SimpleBooleanProperty(DEFAULT_REVEAL_AFTER_MOUNT);
private final BooleanProperty usesReadOnlyMode = new SimpleBooleanProperty(DEFAULT_USES_READONLY_MODE);
@ -127,6 +128,10 @@ public class VaultSettings {
return mountPoint;
}
public BooleanProperty usesVaultIdAsVolumeId() {
return vaultIdAsVolumeId;
}
public BooleanProperty usesReadOnlyMode() {
return usesReadOnlyMode;
}

View File

@ -40,6 +40,7 @@ public class MountOptionsController implements FxController {
private final ObservableValue<String> defaultMountFlags;
private final ObservableValue<Boolean> mountpointDirSupported;
private final ObservableValue<Boolean> mountpointDriveLetterSupported;
private final ObservableValue<Boolean> volumeIdSupported;
private final ObservableValue<Boolean> readOnlySupported;
private final ObservableValue<Boolean> mountFlagsSupported;
private final ObservableValue<String> directoryPath;
@ -48,6 +49,7 @@ public class MountOptionsController implements FxController {
//-- FXML objects --
public CheckBox readOnlyCheckbox;
public CheckBox useVaultIdAsVolumeId;
public CheckBox customMountFlagsCheckbox;
public TextField mountFlagsField;
public ToggleGroup mountPointToggleGroup;
@ -73,6 +75,7 @@ public class MountOptionsController implements FxController {
this.mountpointDirSupported = mountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_TO_EXISTING_DIR) || as.service().hasCapability(MountCapability.MOUNT_WITHIN_EXISTING_PARENT));
this.mountpointDriveLetterSupported = mountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_AS_DRIVE_LETTER));
this.mountFlagsSupported = mountService.map(as -> as.service().hasCapability(MountCapability.MOUNT_FLAGS));
this.volumeIdSupported = mountService.map(as -> as.service().hasCapability(MountCapability.VOLUME_ID));
this.readOnlySupported = mountService.map(as -> as.service().hasCapability(MountCapability.READ_ONLY));
this.directoryPath = vault.getVaultSettings().mountPoint().map(p -> isDriveLetter(p) ? null : p.toString());
this.applicationWindows = applicationWindows;
@ -83,6 +86,9 @@ public class MountOptionsController implements FxController {
// readonly:
readOnlyCheckbox.selectedProperty().bindBidirectional(vaultSettings.usesReadOnlyMode());
// use volume name as volume id
useVaultIdAsVolumeId.selectedProperty().bindBidirectional(vaultSettings.usesVaultIdAsVolumeId());
// custom mount flags:
mountFlagsField.disableProperty().bind(customMountFlagsCheckbox.selectedProperty().not());
customMountFlagsCheckbox.setSelected(!Strings.isNullOrEmpty(vaultSettings.mountFlags().getValue()));
@ -267,6 +273,16 @@ public class MountOptionsController implements FxController {
return readOnlySupported.getValue();
}
public ObservableValue<Boolean> volumeIdSupportedProperty() {
return volumeIdSupported;
}
public boolean getVolumeIdSupported() {
return volumeIdSupported.getValue();
}
public ObservableValue<String> directoryPathProperty() {
return directoryPath;
}

View File

@ -30,6 +30,7 @@
<Hyperlink styleClass="hyperlink-underline" text="%vaultOptions.mount.linkToPreferences" onAction="#openVolumePreferences" wrapText="true"/>
</TextFlow>
<CheckBox fx:id="readOnlyCheckbox" text="%vaultOptions.mount.readonly" visible="${controller.readOnlySupported}" managed="${controller.readOnlySupported}"/>
<CheckBox fx:id="useVaultIdAsVolumeId" text="TODO vault id as volume id" visible="${controller.volumeIdSupported}" managed="${controller.volumeIdSupported}"/>
<VBox visible="${controller.mountFlagsSupported}" managed="${controller.mountFlagsSupported}">
<CheckBox fx:id="customMountFlagsCheckbox" text="%vaultOptions.mount.customMountFlags" onAction="#toggleUseCustomMountFlags"/>