diff --git a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java index e15d195bf..e0c5f9bec 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/CreateNewVaultLocationController.java @@ -52,8 +52,10 @@ public class CreateNewVaultLocationController implements FxController { private Path customVaultPath = DEFAULT_CUSTOM_VAULT_PATH; public ToggleGroup predefinedLocationToggler; + public RadioButton iclouddriveRadioButton; public RadioButton dropboxRadioButton; public RadioButton gdriveRadioButton; + public RadioButton onedriveRadioButton; public RadioButton customRadioButton; @Inject @@ -91,10 +93,14 @@ public class CreateNewVaultLocationController implements FxController { } private void togglePredefinedLocation(@SuppressWarnings("unused") ObservableValue observable, @SuppressWarnings("unused") Toggle oldValue, Toggle newValue) { - if (dropboxRadioButton.equals(newValue)) { + if (iclouddriveRadioButton.equals(newValue)) { + vaultPath.set(locationPresets.getIclouddriveLocation().resolve(vaultName.get())); + } else if (dropboxRadioButton.equals(newValue)) { vaultPath.set(locationPresets.getDropboxLocation().resolve(vaultName.get())); } else if (gdriveRadioButton.equals(newValue)) { vaultPath.set(locationPresets.getGdriveLocation().resolve(vaultName.get())); + } else if (onedriveRadioButton.equals(newValue)) { + vaultPath.set(locationPresets.getOnedriveLocation().resolve(vaultName.get())); } else if (customRadioButton.equals(newValue)) { vaultPath.set(customVaultPath.resolve(vaultName.get())); } diff --git a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/LocationPresets.java b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/LocationPresets.java index a8a889acf..b3b6a4b25 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/LocationPresets.java +++ b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/LocationPresets.java @@ -13,20 +13,30 @@ import java.nio.file.Paths; public class LocationPresets { private static final String USER_HOME = System.getProperty("user.home"); + private static final String[] ICLOUDDRIVE_LOCATIONS = {"~/Library/Mobile Documents/iCloud~com~setolabs~Cryptomator/Documents"}; private static final String[] DROPBOX_LOCATIONS = {"~/Dropbox"}; private static final String[] GDRIVE_LOCATIONS = {"~/Google Drive"}; + private static final String[] ONEDRIVE_LOCATIONS = {"~/OneDrive"}; + private final ReadOnlyObjectProperty iclouddriveLocation; private final ReadOnlyObjectProperty dropboxLocation; private final ReadOnlyObjectProperty gdriveLocation; + private final ReadOnlyObjectProperty onedriveLocation; + private final BooleanBinding foundIclouddrive; private final BooleanBinding foundDropbox; private final BooleanBinding foundGdrive; + private final BooleanBinding foundOnedrive; @Inject public LocationPresets() { + this.iclouddriveLocation = new SimpleObjectProperty<>(existingWritablePath(ICLOUDDRIVE_LOCATIONS)); this.dropboxLocation = new SimpleObjectProperty<>(existingWritablePath(DROPBOX_LOCATIONS)); this.gdriveLocation = new SimpleObjectProperty<>(existingWritablePath(GDRIVE_LOCATIONS)); + this.onedriveLocation = new SimpleObjectProperty<>(existingWritablePath(ONEDRIVE_LOCATIONS)); + this.foundIclouddrive = iclouddriveLocation.isNotNull(); this.foundDropbox = dropboxLocation.isNotNull(); this.foundGdrive = gdriveLocation.isNotNull(); + this.foundOnedrive = onedriveLocation.isNotNull(); } private static Path existingWritablePath(String... candidates) { @@ -49,6 +59,22 @@ public class LocationPresets { /* Observables */ + public ReadOnlyObjectProperty iclouddriveLocationProperty() { + return iclouddriveLocation; + } + + public Path getIclouddriveLocation() { + return iclouddriveLocation.get(); + } + + public BooleanBinding foundIclouddriveProperty() { + return foundIclouddrive; + } + + public boolean isFoundIclouddrive() { + return foundIclouddrive.get(); + } + public ReadOnlyObjectProperty dropboxLocationProperty() { return dropboxLocation; } @@ -73,7 +99,7 @@ public class LocationPresets { return gdriveLocation.get(); } - public BooleanBinding froundGdriveProperty() { + public BooleanBinding foundGdriveProperty() { return foundGdrive; } @@ -81,4 +107,20 @@ public class LocationPresets { return foundGdrive.get(); } + public ReadOnlyObjectProperty onedriveLocationProperty() { + return onedriveLocation; + } + + public Path getOnedriveLocation() { + return onedriveLocation.get(); + } + + public BooleanBinding foundOnedriveProperty() { + return foundOnedrive; + } + + public boolean isFoundOnedrive() { + return foundOnedrive.get(); + } + } diff --git a/main/ui/src/main/resources/fxml/addvault_new_location.fxml b/main/ui/src/main/resources/fxml/addvault_new_location.fxml index 4a37ac4d6..420a0f960 100644 --- a/main/ui/src/main/resources/fxml/addvault_new_location.fxml +++ b/main/ui/src/main/resources/fxml/addvault_new_location.fxml @@ -29,8 +29,10 @@