diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java index 8058956ce..abc6f629f 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java @@ -37,30 +37,30 @@ public class SettingsJsonAdapter extends TypeAdapter { @Override public void write(JsonWriter out, Settings value) throws IOException { out.beginObject(); - out.name("lastWrittenByVersion").value(env.getAppVersion()+env.getBuildNumber().map("-"::concat).orElse("")); + out.name("writtenByVersion").value(env.getAppVersion() + env.getBuildNumber().map("-"::concat).orElse("")); out.name("directories"); writeVaultSettingsArray(out, value.getDirectories()); out.name("askedForUpdateCheck").value(value.askedForUpdateCheck().get()); - out.name("checkForUpdatesEnabled").value(value.checkForUpdates().get()); - out.name("startHidden").value(value.startHidden().get()); out.name("autoCloseVaults").value(value.autoCloseVaults().get()); - out.name("port").value(value.port().get()); - out.name("numTrayNotifications").value(value.numTrayNotifications().get()); + out.name("checkForUpdatesEnabled").value(value.checkForUpdates().get()); out.name("debugMode").value(value.debugMode().get()); - out.name("theme").value(value.theme().get().name()); - out.name("uiOrientation").value(value.userInterfaceOrientation().get().name()); + out.name("displayConfiguration").value((value.displayConfigurationProperty().get())); out.name("keychainProvider").value(value.keychainProvider().get()); - out.name("useKeychain").value(value.useKeychain().get()); + out.name("language").value((value.languageProperty().get())); out.name("licenseKey").value(value.licenseKey().get()); + out.name("mountService").value(value.mountService().get()); + out.name("numTrayNotifications").value(value.numTrayNotifications().get()); + out.name("port").value(value.port().get()); out.name("showMinimizeButton").value(value.showMinimizeButton().get()); out.name("showTrayIcon").value(value.showTrayIcon().get()); + out.name("startHidden").value(value.startHidden().get()); + out.name("theme").value(value.theme().get().name()); + out.name("uiOrientation").value(value.userInterfaceOrientation().get().name()); + out.name("useKeychain").value(value.useKeychain().get()); + out.name("windowHeight").value((value.windowHeightProperty().get())); + out.name("windowWidth").value((value.windowWidthProperty().get())); out.name("windowXPosition").value((value.windowXPositionProperty().get())); out.name("windowYPosition").value((value.windowYPositionProperty().get())); - out.name("windowWidth").value((value.windowWidthProperty().get())); - out.name("windowHeight").value((value.windowHeightProperty().get())); - out.name("displayConfiguration").value((value.displayConfigurationProperty().get())); - out.name("language").value((value.languageProperty().get())); - out.name("mountService").value(value.mountService().get()); out.endObject(); } @@ -82,33 +82,34 @@ public class SettingsJsonAdapter extends TypeAdapter { while (in.hasNext()) { String name = in.nextName(); switch (name) { + case "writtenByVersion" -> in.skipValue(); //noop case "directories" -> settings.getDirectories().addAll(readVaultSettingsArray(in)); case "askedForUpdateCheck" -> settings.askedForUpdateCheck().set(in.nextBoolean()); - case "checkForUpdatesEnabled" -> settings.checkForUpdates().set(in.nextBoolean()); - case "startHidden" -> settings.startHidden().set(in.nextBoolean()); case "autoCloseVaults" -> settings.autoCloseVaults().set(in.nextBoolean()); - case "port" -> settings.port().set(in.nextInt()); - case "numTrayNotifications" -> settings.numTrayNotifications().set(in.nextInt()); + case "checkForUpdatesEnabled" -> settings.checkForUpdates().set(in.nextBoolean()); case "debugMode" -> settings.debugMode().set(in.nextBoolean()); - case "theme" -> settings.theme().set(parseUiTheme(in.nextString())); - case "uiOrientation" -> settings.userInterfaceOrientation().set(parseUiOrientation(in.nextString())); - case "keychainProvider" -> settings.keychainProvider().set(in.nextString()); - case "useKeychain" -> settings.useKeychain().set(in.nextBoolean()); - case "licenseKey" -> settings.licenseKey().set(in.nextString()); - case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean()); - case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean()); - case "windowXPosition" -> settings.windowXPositionProperty().set(in.nextInt()); - case "windowYPosition" -> settings.windowYPositionProperty().set(in.nextInt()); - case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt()); - case "windowHeight" -> settings.windowHeightProperty().set(in.nextInt()); case "displayConfiguration" -> settings.displayConfigurationProperty().set(in.nextString()); + case "keychainProvider" -> settings.keychainProvider().set(in.nextString()); case "language" -> settings.languageProperty().set(in.nextString()); + case "licenseKey" -> settings.licenseKey().set(in.nextString()); case "mountService" -> { var token = in.peek(); if (JsonToken.STRING == token) { settings.mountService().set(in.nextString()); } } + case "numTrayNotifications" -> settings.numTrayNotifications().set(in.nextInt()); + case "port" -> settings.port().set(in.nextInt()); + case "showMinimizeButton" -> settings.showMinimizeButton().set(in.nextBoolean()); + case "showTrayIcon" -> settings.showTrayIcon().set(in.nextBoolean()); + case "startHidden" -> settings.startHidden().set(in.nextBoolean()); + case "theme" -> settings.theme().set(parseUiTheme(in.nextString())); + case "uiOrientation" -> settings.userInterfaceOrientation().set(parseUiOrientation(in.nextString())); + case "useKeychain" -> settings.useKeychain().set(in.nextBoolean()); + case "windowHeight" -> settings.windowHeightProperty().set(in.nextInt()); + case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt()); + case "windowXPosition" -> settings.windowXPositionProperty().set(in.nextInt()); + case "windowYPosition" -> settings.windowYPositionProperty().set(in.nextInt()); //1.6.x legacy case "preferredVolumeImpl" -> volumeImpl = in.nextString(); //legacy end @@ -134,7 +135,7 @@ public class SettingsJsonAdapter extends TypeAdapter { if (volumeImpl.equals("Dokany")) { return "org.cryptomator.frontend.dokany.mount.DokanyMountProvider"; } else if (volumeImpl.equals("FUSE")) { - if(SystemUtils.IS_OS_WINDOWS) { + if (SystemUtils.IS_OS_WINDOWS) { return "org.cryptomator.frontend.fuse.mount.WinFspNetworkMountProvider"; } else if (SystemUtils.IS_OS_MAC) { return "org.cryptomator.frontend.fuse.mount.MacFuseMountProvider"; @@ -142,7 +143,7 @@ public class SettingsJsonAdapter extends TypeAdapter { return "org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider"; } } else { - if(SystemUtils.IS_OS_WINDOWS) { + if (SystemUtils.IS_OS_WINDOWS) { return "org.cryptomator.frontend.webdav.mount.WindowsMounter"; } else if (SystemUtils.IS_OS_MAC) { return "org.cryptomator.frontend.webdav.mount.MacAppleScriptMounter"; diff --git a/src/main/java/org/cryptomator/ui/common/FxmlFile.java b/src/main/java/org/cryptomator/ui/common/FxmlFile.java index eac58eb86..c5b66498a 100644 --- a/src/main/java/org/cryptomator/ui/common/FxmlFile.java +++ b/src/main/java/org/cryptomator/ui/common/FxmlFile.java @@ -15,7 +15,7 @@ public enum FxmlFile { HEALTH_CHECK_LIST("/fxml/health_check_list.fxml"), // HUB_NO_KEYCHAIN("/fxml/hub_no_keychain.fxml"), // HUB_AUTH_FLOW("/fxml/hub_auth_flow.fxml"), // - HUB_LICENSE_EXCEEDED("/fxml/hub_license_exceeded.fxml"), // + HUB_INVALID_LICENSE("/fxml/hub_invalid_license.fxml"), // HUB_RECEIVE_KEY("/fxml/hub_receive_key.fxml"), // HUB_REGISTER_DEVICE("/fxml/hub_register_device.fxml"), // HUB_REGISTER_SUCCESS("/fxml/hub_register_success.fxml"), // diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java index 5adcb243d..6f63ee98e 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/HubKeyLoadingModule.java @@ -102,10 +102,10 @@ public abstract class HubKeyLoadingModule { } @Provides - @FxmlScene(FxmlFile.HUB_LICENSE_EXCEEDED) + @FxmlScene(FxmlFile.HUB_INVALID_LICENSE) @KeyLoadingScoped - static Scene provideLicenseExceededScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) { - return fxmlLoaders.createScene(FxmlFile.HUB_LICENSE_EXCEEDED); + static Scene provideInvalidLicenseScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) { + return fxmlLoaders.createScene(FxmlFile.HUB_INVALID_LICENSE); } @Provides @@ -162,8 +162,8 @@ public abstract class HubKeyLoadingModule { @Binds @IntoMap - @FxControllerKey(LicenseExceededController.class) - abstract FxController bindLicenseExceededController(LicenseExceededController controller); + @FxControllerKey(InvalidLicenseController.class) + abstract FxController bindInvalidLicenseController(InvalidLicenseController controller); @Binds @IntoMap diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/LicenseExceededController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/InvalidLicenseController.java similarity index 72% rename from src/main/java/org/cryptomator/ui/keyloading/hub/LicenseExceededController.java rename to src/main/java/org/cryptomator/ui/keyloading/hub/InvalidLicenseController.java index 115ba16b4..6e0240ce6 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/LicenseExceededController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/InvalidLicenseController.java @@ -7,12 +7,12 @@ import javax.inject.Inject; import javafx.fxml.FXML; import javafx.stage.Stage; -public class LicenseExceededController implements FxController { +public class InvalidLicenseController implements FxController { private final Stage window; @Inject - public LicenseExceededController(@KeyLoading Stage window) { + public InvalidLicenseController(@KeyLoading Stage window) { this.window = window; } diff --git a/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java b/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java index 44a09b988..6f6e7cb42 100644 --- a/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java +++ b/src/main/java/org/cryptomator/ui/keyloading/hub/ReceiveKeyController.java @@ -42,11 +42,11 @@ public class ReceiveKeyController implements FxController { private final Lazy registerDeviceScene; private final Lazy unauthorizedScene; private final URI vaultBaseUri; - private final Lazy licenseExceededScene; + private final Lazy invalidLicenseScene; private final HttpClient httpClient; @Inject - public ReceiveKeyController(@KeyLoading Vault vault, ExecutorService executor, @KeyLoading Stage window, @Named("deviceId") String deviceId, @Named("bearerToken") AtomicReference tokenRef, CompletableFuture result, @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy registerDeviceScene, @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy unauthorizedScene, @FxmlScene(FxmlFile.HUB_LICENSE_EXCEEDED) Lazy licenseExceededScene) { + public ReceiveKeyController(@KeyLoading Vault vault, ExecutorService executor, @KeyLoading Stage window, @Named("deviceId") String deviceId, @Named("bearerToken") AtomicReference tokenRef, CompletableFuture result, @FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy registerDeviceScene, @FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy unauthorizedScene, @FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy invalidLicenseScene) { this.window = window; this.deviceId = deviceId; this.bearerToken = Objects.requireNonNull(tokenRef.get()); @@ -54,7 +54,7 @@ public class ReceiveKeyController implements FxController { this.registerDeviceScene = registerDeviceScene; this.unauthorizedScene = unauthorizedScene; this.vaultBaseUri = getVaultBaseUri(vault); - this.licenseExceededScene = licenseExceededScene; + this.invalidLicenseScene = invalidLicenseScene; this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed); this.httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).executor(executor).build(); } @@ -96,7 +96,7 @@ public class ReceiveKeyController implements FxController { } private void licenseExceeded() { - window.setScene(licenseExceededScene.get()); + window.setScene(invalidLicenseScene.get()); } private void needsDeviceRegistration() { diff --git a/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java b/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java index 12fdfd692..ef6148c87 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java @@ -5,6 +5,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.tobiasdiez.easybind.EasyBind; +import org.apache.commons.lang3.SystemUtils; import org.cryptomator.common.vaults.Vault; import org.cryptomator.integrations.mount.Mountpoint; import org.cryptomator.integrations.revealpath.RevealFailedException; @@ -101,7 +102,11 @@ public class VaultDetailUnlockedController implements FxController { private void handleDragEvent(DragEvent event) { if (DragEvent.DRAG_OVER.equals(event.getEventType()) && event.getGestureSource() == null && event.getDragboard().hasFiles()) { - event.acceptTransferModes(TransferMode.LINK); + if(SystemUtils.IS_OS_WINDOWS || SystemUtils.IS_OS_MAC) { + event.acceptTransferModes(TransferMode.LINK); + } else { + event.acceptTransferModes(TransferMode.ANY); + } draggingOver.set(true); } else if (DragEvent.DRAG_DROPPED.equals(event.getEventType()) && event.getGestureSource() == null && event.getDragboard().hasFiles()) { List ciphertextPaths = event.getDragboard().getFiles().stream().map(File::toPath).map(this::getCiphertextPath).flatMap(Optional::stream).toList(); diff --git a/src/main/resources/fxml/hub_license_exceeded.fxml b/src/main/resources/fxml/hub_invalid_license.fxml similarity index 84% rename from src/main/resources/fxml/hub_license_exceeded.fxml rename to src/main/resources/fxml/hub_invalid_license.fxml index 10be37307..e01443a3f 100644 --- a/src/main/resources/fxml/hub_license_exceeded.fxml +++ b/src/main/resources/fxml/hub_invalid_license.fxml @@ -13,7 +13,7 @@ -