From 52b74a74fe551bce0166a5df536a147f4227d18c Mon Sep 17 00:00:00 2001 From: Jan-Peter Klein Date: Wed, 25 Oct 2023 14:02:29 +0200 Subject: [PATCH] display specific mount options according to selected volume type in vault mounting options --- .../vaultoptions/MountOptionsController.java | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java b/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java index 1cf9f3be2..df9777140 100644 --- a/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java +++ b/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java @@ -52,7 +52,6 @@ public class MountOptionsController implements FxController { private final WindowsDriveLetters windowsDriveLetters; private final ResourceBundle resourceBundle; private final Lazy application; - private final Settings settings; private final ObservableValue defaultMountFlags; private final ObservableValue mountpointDirSupported; @@ -84,36 +83,34 @@ public class MountOptionsController implements FxController { @Inject MountOptionsController(@VaultOptionsWindow Stage window, // @VaultOptionsWindow Vault vault, // - ObservableValue mountService, // WindowsDriveLetters windowsDriveLetters, // ResourceBundle resourceBundle, // Lazy application, - Settings settings, // List mountProviders, // @Named("FUPFMS") AtomicReference firstUsedProblematicFuseMountService) { this.window = window; this.vaultSettings = vault.getVaultSettings(); this.windowsDriveLetters = windowsDriveLetters; this.resourceBundle = resourceBundle; - this.defaultMountFlags = mountService.map(as -> { - if (as.service().hasCapability(MountCapability.MOUNT_FLAGS)) { - return as.service().getDefaultMountFlags(); - } else { - return ""; - } - }); - 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.readOnlySupported = mountService.map(as -> as.service().hasCapability(MountCapability.READ_ONLY)); this.directoryPath = vault.getVaultSettings().mountPoint.map(p -> isDriveLetter(p) ? null : p.toString()); this.application = application; - this.settings = settings; this.mountProviders = mountProviders; var fallbackProvider = mountProviders.stream().findFirst().orElse(null); this.selectedMountService = ObservableUtil.mapWithDefault(vaultSettings.mountService, serviceName -> mountProviders.stream().filter(s -> s.getClass().getName().equals(serviceName)).findFirst().orElse(fallbackProvider), fallbackProvider); this.fuseRestartRequired = selectedMountService.map(s -> firstUsedProblematicFuseMountService.get() != null && MountModule.isProblematicFuseService(s) && !firstUsedProblematicFuseMountService.get().equals(s)); this.loopbackPortSupported = BooleanExpression.booleanExpression(selectedMountService.map(s -> s.hasCapability(MountCapability.LOOPBACK_PORT))); + + this.defaultMountFlags = selectedMountService.map(s -> { + if (s.hasCapability(MountCapability.MOUNT_FLAGS)) { + return s.getDefaultMountFlags(); + } else { + return ""; + } + }); + this.mountFlagsSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_FLAGS)); + this.readOnlySupported = selectedMountService.map(s -> s.hasCapability(MountCapability.READ_ONLY)); + this.mountpointDirSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_TO_EXISTING_DIR) || s.hasCapability(MountCapability.MOUNT_WITHIN_EXISTING_PARENT)); + this.mountpointDriveLetterSupported = selectedMountService.map(s -> s.hasCapability(MountCapability.MOUNT_AS_DRIVE_LETTER)); } @FXML