mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-21 20:21:27 +00:00
use SimpleDialog
This commit is contained in:
@@ -18,7 +18,6 @@ public enum FxmlFile {
|
||||
FORGET_PASSWORD("/fxml/forget_password.fxml"), //
|
||||
HEALTH_START("/fxml/health_start.fxml"), //
|
||||
HEALTH_CHECK_LIST("/fxml/health_check_list.fxml"), //
|
||||
HUB_ARCHIVED_VAULT("/fxml/hub_archived_vault.fxml"), //
|
||||
HUB_NO_KEYCHAIN("/fxml/hub_no_keychain.fxml"), //
|
||||
HUB_AUTH_FLOW("/fxml/hub_auth_flow.fxml"), //
|
||||
HUB_INVALID_LICENSE("/fxml/hub_invalid_license.fxml"), //
|
||||
|
||||
@@ -61,6 +61,15 @@ public class Dialogs {
|
||||
.setOkButtonKey(BUTTON_KEY_CLOSE);
|
||||
}
|
||||
|
||||
public SimpleDialog.Builder prepareHubVaulArchived(Stage window, Vault vault) {
|
||||
return createDialogBuilder().setOwner(window) //
|
||||
.setTitleKey("unlock.title", vault.getDisplayName()) //
|
||||
.setMessageKey("hub.archived.message") //
|
||||
.setDescriptionKey("hub.archived.description") //
|
||||
.setIcon(FontAwesome5Icon.BAN)//
|
||||
.setOkButtonKey(BUTTON_KEY_CLOSE);
|
||||
}
|
||||
|
||||
public SimpleDialog.Builder prepareRecoveryVaultAdded(Stage window, String displayName) {
|
||||
return createDialogBuilder().setOwner(window) //
|
||||
.setTitleKey("recover.existing.title") //
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package org.cryptomator.ui.keyloading.hub;
|
||||
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.keyloading.KeyLoading;
|
||||
import org.cryptomator.ui.keyloading.KeyLoadingScoped;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.WindowEvent;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@KeyLoadingScoped
|
||||
public class ArchivedVaultController implements FxController {
|
||||
|
||||
private final Stage window;
|
||||
private final CompletableFuture<ReceivedKey> result;
|
||||
|
||||
@Inject
|
||||
public ArchivedVaultController(@KeyLoading Stage window, CompletableFuture<ReceivedKey> result) {
|
||||
this.window = window;
|
||||
this.result = result;
|
||||
this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void close() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
private void windowClosed(WindowEvent windowEvent) {
|
||||
result.cancel(true);
|
||||
}
|
||||
}
|
||||
@@ -168,13 +168,6 @@ public abstract class HubKeyLoadingModule {
|
||||
return fxmlLoaders.createScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FxmlScene(FxmlFile.HUB_ARCHIVED_VAULT)
|
||||
@KeyLoadingScoped
|
||||
static Scene provideHubArchivedVaultScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
|
||||
return fxmlLoaders.createScene(FxmlFile.HUB_ARCHIVED_VAULT);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT)
|
||||
@KeyLoadingScoped
|
||||
@@ -227,10 +220,6 @@ public abstract class HubKeyLoadingModule {
|
||||
@FxControllerKey(RegisterFailedController.class)
|
||||
abstract FxController bindRegisterFailedController(RegisterFailedController controller);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@FxControllerKey(ArchivedVaultController.class)
|
||||
abstract FxController bindArchivedVaultController(ArchivedVaultController controller);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
import org.cryptomator.ui.dialogs.Dialogs;
|
||||
import org.cryptomator.ui.keyloading.KeyLoading;
|
||||
import org.cryptomator.ui.keyloading.KeyLoadingScoped;
|
||||
import org.slf4j.Logger;
|
||||
@@ -55,26 +56,27 @@ public class ReceiveKeyController implements FxController {
|
||||
private final Lazy<Scene> registerDeviceScene;
|
||||
private final Lazy<Scene> legacyRegisterDeviceScene;
|
||||
private final Lazy<Scene> unauthorizedScene;
|
||||
private final Lazy<Scene> archivedVaultScene;
|
||||
private final Lazy<Scene> accountInitializationScene;
|
||||
private final Lazy<Scene> invalidLicenseScene;
|
||||
private final HttpClient httpClient;
|
||||
private final Dialogs dialogs;
|
||||
private final Vault vault;
|
||||
|
||||
@Inject
|
||||
public ReceiveKeyController(@KeyLoading Vault vault,
|
||||
ExecutorService executor,
|
||||
@KeyLoading Stage window,
|
||||
HubConfig hubConfig,
|
||||
@Named("deviceId") String deviceId,
|
||||
@Named("bearerToken") AtomicReference<String> tokenRef,
|
||||
public ReceiveKeyController(@KeyLoading Vault vault, //
|
||||
ExecutorService executor, //
|
||||
@KeyLoading Stage window, //
|
||||
HubConfig hubConfig, //
|
||||
@Named("deviceId") String deviceId, //
|
||||
@Named("bearerToken") AtomicReference<String> tokenRef, //
|
||||
@Named("filesystemOwnerId") AtomicReference<String> fsOwnerId, //
|
||||
CompletableFuture<ReceivedKey> result,
|
||||
@FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy<Scene> registerDeviceScene,
|
||||
@FxmlScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE) Lazy<Scene> legacyRegisterDeviceScene,
|
||||
@FxmlScene(FxmlFile.HUB_ARCHIVED_VAULT) Lazy<Scene> archivedVaultScene,
|
||||
@FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy<Scene> unauthorizedScene,
|
||||
@FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT) Lazy<Scene> accountInitializationScene,
|
||||
@FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy<Scene> invalidLicenseScene) {
|
||||
CompletableFuture<ReceivedKey> result, //
|
||||
@FxmlScene(FxmlFile.HUB_REGISTER_DEVICE) Lazy<Scene> registerDeviceScene, //
|
||||
@FxmlScene(FxmlFile.HUB_LEGACY_REGISTER_DEVICE) Lazy<Scene> legacyRegisterDeviceScene, //
|
||||
@FxmlScene(FxmlFile.HUB_UNAUTHORIZED_DEVICE) Lazy<Scene> unauthorizedScene, //
|
||||
@FxmlScene(FxmlFile.HUB_REQUIRE_ACCOUNT_INIT) Lazy<Scene> accountInitializationScene, //
|
||||
@FxmlScene(FxmlFile.HUB_INVALID_LICENSE) Lazy<Scene> invalidLicenseScene, //
|
||||
Dialogs dialogs) {
|
||||
this.window = window;
|
||||
this.hubConfig = hubConfig;
|
||||
this.vaultId = extractVaultId(vault.getVaultConfigCache().getUnchecked().getKeyId()); // TODO: access vault config's JTI directly (requires changes in cryptofs)
|
||||
@@ -85,11 +87,12 @@ public class ReceiveKeyController implements FxController {
|
||||
this.registerDeviceScene = registerDeviceScene;
|
||||
this.legacyRegisterDeviceScene = legacyRegisterDeviceScene;
|
||||
this.unauthorizedScene = unauthorizedScene;
|
||||
this.archivedVaultScene = archivedVaultScene;
|
||||
this.accountInitializationScene = accountInitializationScene;
|
||||
this.invalidLicenseScene = invalidLicenseScene;
|
||||
this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed);
|
||||
this.httpClient = HttpClient.newBuilder().version(HttpClient.Version.HTTP_1_1).executor(executor).build();
|
||||
this.dialogs = dialogs;
|
||||
this.vault = vault;
|
||||
}
|
||||
|
||||
@FXML
|
||||
@@ -309,7 +312,8 @@ public class ReceiveKeyController implements FxController {
|
||||
}
|
||||
|
||||
private void accessGoneVaultArchived() {
|
||||
window.setScene(archivedVaultScene.get());
|
||||
window.close();
|
||||
dialogs.prepareHubVaulArchived((Stage)window.getOwner(), vault).build().showAndWait();
|
||||
}
|
||||
|
||||
private void accountInitializationRequired() {
|
||||
|
||||
Reference in New Issue
Block a user