mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-08-27 19:36:36 +00:00
adding recover vault dialogue stub
This commit is contained in:
@@ -19,6 +19,7 @@ public enum FxmlFile {
|
|||||||
QUIT("/fxml/quit.fxml"), //
|
QUIT("/fxml/quit.fxml"), //
|
||||||
RECOVERYKEY_CREATE("/fxml/recoverykey_create.fxml"), //
|
RECOVERYKEY_CREATE("/fxml/recoverykey_create.fxml"), //
|
||||||
RECOVERYKEY_SUCCESS("/fxml/recoverykey_success.fxml"), //
|
RECOVERYKEY_SUCCESS("/fxml/recoverykey_success.fxml"), //
|
||||||
|
RECOVER_VAULT("/fxml/recovervault.fxml"),// TODO
|
||||||
REMOVE_VAULT("/fxml/remove_vault.fxml"), //
|
REMOVE_VAULT("/fxml/remove_vault.fxml"), //
|
||||||
UNLOCK("/fxml/unlock.fxml"),
|
UNLOCK("/fxml/unlock.fxml"),
|
||||||
UNLOCK_GENERIC_ERROR("/fxml/unlock_generic_error.fxml"), //
|
UNLOCK_GENERIC_ERROR("/fxml/unlock_generic_error.fxml"), //
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package org.cryptomator.ui.recovervault;
|
||||||
|
|
||||||
|
import dagger.BindsInstance;
|
||||||
|
import dagger.Lazy;
|
||||||
|
import dagger.Subcomponent;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.cryptomator.common.vaults.Vault;
|
||||||
|
import org.cryptomator.ui.common.FxmlFile;
|
||||||
|
import org.cryptomator.ui.common.FxmlScene;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
@RecoverVaultScoped
|
||||||
|
@Subcomponent(modules = {RecoverVaultModule.class})
|
||||||
|
public interface RecoverVaultComponent {
|
||||||
|
|
||||||
|
@RecoverVaultWindow
|
||||||
|
Stage window();
|
||||||
|
|
||||||
|
@FxmlScene(FxmlFile.RECOVER_VAULT)
|
||||||
|
Lazy<Scene> scene();
|
||||||
|
|
||||||
|
default void showRecoverVaultWindow() {
|
||||||
|
Stage stage = window();
|
||||||
|
stage.setScene(scene().get());
|
||||||
|
stage.sizeToScene();
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subcomponent.Builder
|
||||||
|
interface Builder {
|
||||||
|
|
||||||
|
@BindsInstance
|
||||||
|
Builder vault(@RecoverVaultWindow Vault vault);
|
||||||
|
|
||||||
|
@BindsInstance
|
||||||
|
Builder owner(@Named("recoverVaultOwner") Stage owner);
|
||||||
|
|
||||||
|
RecoverVaultComponent build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package org.cryptomator.ui.recovervault;
|
||||||
|
|
||||||
|
import dagger.Lazy;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.cryptomator.ui.common.FxController;
|
||||||
|
import org.cryptomator.ui.common.FxmlFile;
|
||||||
|
import org.cryptomator.ui.common.FxmlScene;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
@RecoverVaultScoped
|
||||||
|
public class RecoverVaultController implements FxController {
|
||||||
|
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(RecoverVaultController.class);
|
||||||
|
|
||||||
|
private final Stage window;
|
||||||
|
private final Lazy<Scene> successScene;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public RecoverVaultController(@RecoverVaultWindow Stage window, @FxmlScene(FxmlFile.RECOVER_VAULT) Lazy<Scene> successScene) {
|
||||||
|
this.window = window;
|
||||||
|
this.successScene = successScene;
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void close() {
|
||||||
|
window.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package org.cryptomator.ui.recovervault;
|
||||||
|
|
||||||
|
import dagger.Binds;
|
||||||
|
import dagger.Module;
|
||||||
|
import dagger.Provides;
|
||||||
|
import dagger.multibindings.IntoMap;
|
||||||
|
import javafx.beans.property.SimpleStringProperty;
|
||||||
|
import javafx.beans.property.StringProperty;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.scene.image.Image;
|
||||||
|
import javafx.stage.Modality;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import org.cryptomator.ui.common.DefaultSceneFactory;
|
||||||
|
import org.cryptomator.ui.common.FXMLLoaderFactory;
|
||||||
|
import org.cryptomator.ui.common.FxController;
|
||||||
|
import org.cryptomator.ui.common.FxControllerKey;
|
||||||
|
import org.cryptomator.ui.common.FxmlFile;
|
||||||
|
import org.cryptomator.ui.common.FxmlScene;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
import javax.inject.Provider;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
@Module
|
||||||
|
abstract class RecoverVaultModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@RecoverVaultWindow
|
||||||
|
@RecoverVaultScoped
|
||||||
|
static FXMLLoaderFactory provideFxmlLoaderFactory(Map<Class<? extends FxController>, Provider<FxController>> factories, DefaultSceneFactory sceneFactory, ResourceBundle resourceBundle) {
|
||||||
|
return new FXMLLoaderFactory(factories, sceneFactory, resourceBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@RecoverVaultWindow
|
||||||
|
@RecoverVaultScoped
|
||||||
|
static Stage provideStage(ResourceBundle resourceBundle, @Named("windowIcons") List<Image> windowIcons, @Named("recoverVaultOwner") Stage owner) {
|
||||||
|
Stage stage = new Stage();
|
||||||
|
//TODO stage.setTitle(resourceBundle.getString("recoverVault.title"));
|
||||||
|
stage.setTitle("TODO recover Vault");
|
||||||
|
stage.setResizable(false);
|
||||||
|
stage.initModality(Modality.WINDOW_MODAL);
|
||||||
|
stage.initOwner(owner);
|
||||||
|
stage.getIcons().addAll(windowIcons);
|
||||||
|
return stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@RecoverVaultWindow
|
||||||
|
@RecoverVaultScoped
|
||||||
|
static StringProperty provideRecoveryKeyProperty() {
|
||||||
|
return new SimpleStringProperty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@FxmlScene(FxmlFile.RECOVER_VAULT)
|
||||||
|
@RecoverVaultScoped
|
||||||
|
static Scene provideRecoverVaultScene(@RecoverVaultWindow FXMLLoaderFactory fxmlLoaders) {
|
||||||
|
return fxmlLoaders.createScene("/fxml/recovervault.fxml");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@FxControllerKey(RecoverVaultController.class)
|
||||||
|
abstract FxController bindRecoverVaultController(RecoverVaultController controller);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.cryptomator.ui.recovervault;
|
||||||
|
|
||||||
|
import javax.inject.Scope;
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
@Scope
|
||||||
|
@Documented
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface RecoverVaultScoped {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.cryptomator.ui.recovervault;
|
||||||
|
|
||||||
|
import javax.inject.Qualifier;
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
@Qualifier
|
||||||
|
@Documented
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
public @interface RecoverVaultWindow {
|
||||||
|
|
||||||
|
}
|
||||||
+9
-1
@@ -5,6 +5,7 @@ import javafx.stage.Stage;
|
|||||||
import org.cryptomator.common.vaults.Vault;
|
import org.cryptomator.common.vaults.Vault;
|
||||||
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
|
import org.cryptomator.ui.changepassword.ChangePasswordComponent;
|
||||||
import org.cryptomator.ui.common.FxController;
|
import org.cryptomator.ui.common.FxController;
|
||||||
|
import org.cryptomator.ui.recovervault.RecoverVaultComponent;
|
||||||
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;
|
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@@ -16,13 +17,15 @@ public class GeneralVaultOptionsController implements FxController {
|
|||||||
private final Stage window;
|
private final Stage window;
|
||||||
private final ChangePasswordComponent.Builder changePasswordWindow;
|
private final ChangePasswordComponent.Builder changePasswordWindow;
|
||||||
private final RecoveryKeyComponent.Builder recoveryKeyWindow;
|
private final RecoveryKeyComponent.Builder recoveryKeyWindow;
|
||||||
|
private final RecoverVaultComponent.Builder recoverVaultWindow;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
GeneralVaultOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow) {
|
GeneralVaultOptionsController(@VaultOptionsWindow Vault vault, @VaultOptionsWindow Stage window, ChangePasswordComponent.Builder changePasswordWindow, RecoveryKeyComponent.Builder recoveryKeyWindow, RecoverVaultComponent.Builder recoverVaultWindow) {
|
||||||
this.vault = vault;
|
this.vault = vault;
|
||||||
this.window = window;
|
this.window = window;
|
||||||
this.changePasswordWindow = changePasswordWindow;
|
this.changePasswordWindow = changePasswordWindow;
|
||||||
this.recoveryKeyWindow = recoveryKeyWindow;
|
this.recoveryKeyWindow = recoveryKeyWindow;
|
||||||
|
this.recoverVaultWindow = recoverVaultWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@@ -35,4 +38,9 @@ public class GeneralVaultOptionsController implements FxController {
|
|||||||
recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyCreationWindow();
|
recoveryKeyWindow.vault(vault).owner(window).build().showRecoveryKeyCreationWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void showRecoverVaultDialogue(){
|
||||||
|
recoverVaultWindow.vault(vault).owner(window).build().showRecoverVaultWindow();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.cryptomator.ui.common.FxControllerKey;
|
|||||||
import org.cryptomator.ui.common.FxmlFile;
|
import org.cryptomator.ui.common.FxmlFile;
|
||||||
import org.cryptomator.ui.common.FxmlScene;
|
import org.cryptomator.ui.common.FxmlScene;
|
||||||
import org.cryptomator.ui.mainwindow.MainWindow;
|
import org.cryptomator.ui.mainwindow.MainWindow;
|
||||||
|
import org.cryptomator.ui.recovervault.RecoverVaultComponent;
|
||||||
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;
|
import org.cryptomator.ui.recoverykey.RecoveryKeyComponent;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
@@ -25,7 +26,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
@Module(subcomponents = {ChangePasswordComponent.class, RecoveryKeyComponent.class})
|
@Module(subcomponents = {ChangePasswordComponent.class, RecoveryKeyComponent.class, RecoverVaultComponent.class})
|
||||||
abstract class VaultOptionsModule {
|
abstract class VaultOptionsModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.ButtonBar?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
<VBox xmlns="http://javafx.com/javafx"
|
||||||
|
xmlns:fx="http://javafx.com/fxml"
|
||||||
|
fx:controller="org.cryptomator.ui.recovervault.RecoverVaultController"
|
||||||
|
minWidth="400"
|
||||||
|
maxWidth="400"
|
||||||
|
minHeight="145"
|
||||||
|
spacing="12"
|
||||||
|
alignment="TOP_CENTER">
|
||||||
|
<padding>
|
||||||
|
<Insets topRightBottomLeft="12"/>
|
||||||
|
</padding>
|
||||||
|
<children>
|
||||||
|
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
|
||||||
|
<ButtonBar buttonMinWidth="120" buttonOrder="C+X">
|
||||||
|
<buttons>
|
||||||
|
<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" cancelButton="true" onAction="#close"/>
|
||||||
|
</buttons>
|
||||||
|
</ButtonBar>
|
||||||
|
</VBox>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
@@ -13,5 +13,6 @@
|
|||||||
<children>
|
<children>
|
||||||
<Button text="%vaultOptions.general.changePasswordBtn" onAction="#changePassword"/>
|
<Button text="%vaultOptions.general.changePasswordBtn" onAction="#changePassword"/>
|
||||||
<Button text="%vaultOptions.general.showRecoveryKeyBtn" onAction="#showRecoveryKey"/>
|
<Button text="%vaultOptions.general.showRecoveryKeyBtn" onAction="#showRecoveryKey"/>
|
||||||
|
<Button text="TODO recoverVault" onAction="#showRecoverVaultDialogue"/>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|||||||
Reference in New Issue
Block a user