mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-22 12:41:27 +00:00
further additions to #1060
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
package org.cryptomator.ui.recovervault;
|
||||
|
||||
import dagger.Lazy;
|
||||
import javafx.beans.Observable;
|
||||
import javafx.beans.property.StringProperty;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.stage.Stage;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.ui.common.FxmlFile;
|
||||
import org.cryptomator.ui.common.FxmlScene;
|
||||
@@ -20,16 +25,42 @@ public class RecoverVaultController implements FxController {
|
||||
|
||||
private final Stage window;
|
||||
private final Lazy<Scene> successScene;
|
||||
private final Vault vault;
|
||||
private StringProperty recoveryKey;
|
||||
|
||||
public TextArea textarea;
|
||||
|
||||
@Inject
|
||||
public RecoverVaultController(@RecoverVaultWindow Stage window, @FxmlScene(FxmlFile.RECOVER_VAULT) Lazy<Scene> successScene) {
|
||||
public RecoverVaultController(@RecoverVaultWindow Stage window, @FxmlScene(FxmlFile.RECOVER_VAULT) Lazy<Scene> successScene, @RecoverVaultWindow Vault vault, @RecoverVaultWindow StringProperty recoveryKey) {
|
||||
this.window = window;
|
||||
this.successScene = successScene;
|
||||
this.vault = vault;
|
||||
this.recoveryKey = recoveryKey;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
textarea.getParagraphs().addListener(this::updateRecoveryKeyProperty);
|
||||
}
|
||||
|
||||
|
||||
private void updateRecoveryKeyProperty(@SuppressWarnings("unused") Observable observable) {
|
||||
recoveryKey.set(textarea.getText());
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void close() {
|
||||
window.close();
|
||||
}
|
||||
|
||||
public void recoverData(ActionEvent actionEvent) {
|
||||
//TODO: CryptoAPI call, show progress bar
|
||||
}
|
||||
|
||||
/* Getter/Setter */
|
||||
|
||||
public Vault getVault() {
|
||||
return vault;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.ButtonBar?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.cryptomator.ui.controls.FormattedLabel?>
|
||||
<?import javafx.scene.control.CheckBox?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.recovervault.RecoverVaultController"
|
||||
@@ -16,10 +19,16 @@
|
||||
<Insets topRightBottomLeft="12"/>
|
||||
</padding>
|
||||
<children>
|
||||
<VBox spacing="6">
|
||||
<FormattedLabel format="TODO If you lost/forgot your password for vault %s, you can get access with your backup passphrase" arg1="${controller.vault.displayableName}" wrapText="true"/>
|
||||
<CheckBox fx:id="confirmation" text="TODO I have understood that all data will be decrypted. This cannot be undone."/>
|
||||
<TextArea editable="true" wrapText="true" prefRowCount="4" fx:id="textarea" promptText="TODO Paste here your backup passphrase."/>
|
||||
</VBox>
|
||||
<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"/>
|
||||
<Button text="TODO Proceed" ButtonBar.buttonData="NEXT_FORWARD" cancelButton="false" onAction="#recoverData" disable="${!confirmation.selected}"/>
|
||||
</buttons>
|
||||
</ButtonBar>
|
||||
</VBox>
|
||||
|
||||
Reference in New Issue
Block a user