Forráskód Böngészése

disabling open button in addExistingVault wizard if no file is selected.

Armin Schrenk 6 éve
szülő
commit
01ca501607

+ 14 - 2
main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ChooseExistingVaultController.java

@@ -1,14 +1,15 @@
 package org.cryptomator.ui.addvaultwizard;
 
 import dagger.Lazy;
+import javafx.beans.property.BooleanProperty;
 import javafx.beans.property.ObjectProperty;
+import javafx.beans.property.SimpleBooleanProperty;
 import javafx.collections.ObservableList;
 import javafx.fxml.FXML;
 import javafx.scene.Scene;
 import javafx.stage.FileChooser;
 import javafx.stage.Stage;
 import org.cryptomator.common.settings.VaultSettings;
-import org.cryptomator.ui.common.FXMLLoaderFactory;
 import org.cryptomator.ui.common.FxController;
 import org.cryptomator.ui.common.FxmlFile;
 import org.cryptomator.ui.common.FxmlScene;
@@ -16,7 +17,6 @@ import org.cryptomator.ui.model.Vault;
 import org.cryptomator.ui.model.VaultFactory;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 import java.io.File;
 import java.nio.file.Path;
 import java.util.ResourceBundle;
@@ -28,6 +28,7 @@ public class ChooseExistingVaultController implements FxController {
 	private final Lazy<Scene> welcomeScene;
 	private final ObjectProperty<Path> vaultPath;
 	private final ObservableList<Vault> vaults;
+	private final BooleanProperty isVaultPathNull;
 	private final VaultFactory vaultFactory;
 	private final ResourceBundle resourceBundle;
 
@@ -39,6 +40,8 @@ public class ChooseExistingVaultController implements FxController {
 		this.vaults = vaults;
 		this.vaultFactory = vaultFactory;
 		this.resourceBundle = resourceBundle;
+		this.isVaultPathNull = new SimpleBooleanProperty();
+		isVaultPathNull.bind(vaultPath.isNull());
 	}
 
 	@FXML
@@ -75,4 +78,13 @@ public class ChooseExistingVaultController implements FxController {
 	public ObjectProperty<Path> vaultPathProperty() {
 		return vaultPath;
 	}
+
+	public boolean getIsVaultPathNull() {
+		return isVaultPathNull.get();
+	}
+
+	public BooleanProperty isVaultPathNullProperty() {
+		return isVaultPathNull;
+	}
+
 }

+ 1 - 1
main/ui/src/main/resources/fxml/addvault_existing.fxml

@@ -28,7 +28,7 @@
 		<ButtonBar buttonMinWidth="120" buttonOrder="B+I">
 			<buttons>
 				<Button text="TODO Back" ButtonBar.buttonData="BACK_PREVIOUS" onAction="#back"/>
-				<Button text="TODO Open" ButtonBar.buttonData="FINISH" onAction="#finish" defaultButton="true"/>
+				<Button text="TODO Open" ButtonBar.buttonData="FINISH" onAction="#finish" defaultButton="true" disable="${controller.isVaultPathNull}"/>
 			</buttons>
 		</ButtonBar>
 	</children>

+ 1 - 1
main/ui/src/main/resources/i18n/strings.properties

@@ -1,4 +1,4 @@
-addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault 
+addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault. The directory contain it will be displayed. 
 addvaultwizard.existing.filePickerTitle=Open Masterkey File
 main.closeBtn.tooltip=Close
 main.settingsBtn.tooltip=Settings

+ 1 - 1
main/ui/src/main/resources/i18n/strings_en.properties

@@ -1,4 +1,4 @@
-addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault 
+addvaultwizard.existing.instruction=Please choose the masterkey.cryptomator file of your existing vault. The directory contain it will be displayed. 
 addvaultwizard.existing.filePickerTitle=Open Masterkey File
 main.closeBtn.tooltip=Close
 main.settingsBtn.tooltip=Settings