mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-19 19:21:27 +00:00
Updated custom mount point layout
This commit is contained in:
@@ -26,7 +26,6 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.text.Text;
|
||||
@@ -40,7 +39,6 @@ import org.cryptomator.common.settings.VaultSettings;
|
||||
import org.cryptomator.common.settings.VolumeImpl;
|
||||
import org.cryptomator.cryptolib.api.InvalidPassphraseException;
|
||||
import org.cryptomator.cryptolib.api.UnsupportedVaultFormatException;
|
||||
import org.cryptomator.frontend.webdav.ServerLifecycleException;
|
||||
import org.cryptomator.keychain.KeychainAccess;
|
||||
import org.cryptomator.ui.controls.SecPasswordField;
|
||||
import org.cryptomator.ui.l10n.Localization;
|
||||
@@ -58,6 +56,8 @@ import javax.inject.Named;
|
||||
import java.io.File;
|
||||
import java.nio.file.DirectoryNotEmptyException;
|
||||
import java.nio.file.NotDirectoryException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Objects;
|
||||
@@ -130,7 +130,7 @@ public class UnlockController implements ViewController {
|
||||
private HBox customMountPoint;
|
||||
|
||||
@FXML
|
||||
private Label customMountPointField;
|
||||
private Label customMountPointLabel;
|
||||
|
||||
@FXML
|
||||
private ProgressIndicator progressIndicator;
|
||||
@@ -246,7 +246,11 @@ public class UnlockController implements ViewController {
|
||||
useReadOnlyMode.setSelected(vaultSettings.usesReadOnlyMode().get());
|
||||
if (!settings.preferredVolumeImpl().get().equals(VolumeImpl.WEBDAV)) {
|
||||
useCustomMountPoint.setSelected(vaultSettings.usesIndividualMountPath().get());
|
||||
customMountPointField.textProperty().setValue(vaultSettings.individualMountPath().getValueSafe());
|
||||
if (vaultSettings.individualMountPath().get() == null) {
|
||||
customMountPointLabel.textProperty().setValue(localization.getString("unlock.label.chooseMountPath"));
|
||||
} else {
|
||||
customMountPointLabel.textProperty().setValue(displayablePath(vaultSettings.individualMountPath().getValueSafe()));
|
||||
}
|
||||
}
|
||||
|
||||
vaultSubs = vaultSubs.and(EasyBind.subscribe(unlockAfterStartup.selectedProperty(), vaultSettings.unlockAfterStartup()::set));
|
||||
@@ -255,6 +259,18 @@ public class UnlockController implements ViewController {
|
||||
vaultSubs = vaultSubs.and(EasyBind.subscribe(useReadOnlyMode.selectedProperty(), vaultSettings.usesReadOnlyMode()::set));
|
||||
}
|
||||
|
||||
private String displayablePath(String path) {
|
||||
Path homeDir = Paths.get(SystemUtils.USER_HOME);
|
||||
Path p = Paths.get(path);
|
||||
if (p.startsWith(homeDir)) {
|
||||
Path relativePath = homeDir.relativize(p);
|
||||
String homePrefix = SystemUtils.IS_OS_WINDOWS ? "~\\" : "~/";
|
||||
return homePrefix + relativePath.toString();
|
||||
} else {
|
||||
return p.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// ****************************************
|
||||
// Downloads link
|
||||
// ****************************************
|
||||
@@ -298,7 +314,7 @@ public class UnlockController implements ViewController {
|
||||
DirectoryChooser dirChooser = new DirectoryChooser();
|
||||
File file = dirChooser.showDialog(mainWindow);
|
||||
if (file != null) {
|
||||
customMountPointField.setText(file.toString());
|
||||
customMountPointLabel.setText(displayablePath(file.toString()));
|
||||
vault.setCustomMountPath(file.toString());
|
||||
}
|
||||
}
|
||||
@@ -476,9 +492,9 @@ public class UnlockController implements ViewController {
|
||||
/* state */
|
||||
|
||||
public enum State {
|
||||
UNLOCKING(null),
|
||||
INITIALIZED("unlock.successLabel.vaultCreated"),
|
||||
PASSWORD_CHANGED("unlock.successLabel.passwordChanged"),
|
||||
UNLOCKING(null), //
|
||||
INITIALIZED("unlock.successLabel.vaultCreated"), //
|
||||
PASSWORD_CHANGED("unlock.successLabel.passwordChanged"), //
|
||||
UPGRADED("unlock.successLabel.upgraded");
|
||||
|
||||
private Optional<String> successMessage;
|
||||
|
||||
@@ -90,10 +90,12 @@
|
||||
<ChoiceBox GridPane.rowIndex="7" GridPane.columnIndex="1" fx:id="winDriveLetter" GridPane.hgrow="ALWAYS" maxWidth="Infinity" cacheShape="true" cache="true" />
|
||||
|
||||
<!-- Row 3.7 Alt2 -->
|
||||
<HBox fx:id="customMountPoint" GridPane.rowIndex="7" GridPane.columnIndex="0" GridPane.columnSpan="2" spacing="6">
|
||||
<Label HBox.hgrow="NEVER" minWidth="-Infinity" text="%unlock.label.mountPath" cacheShape="true" cache="true" />
|
||||
<Label HBox.hgrow="ALWAYS" fx:id="customMountPointField" textOverrun="LEADING_ELLIPSIS" cacheShape="true" cache="true" />
|
||||
<Button HBox.hgrow="NEVER" minWidth="-Infinity" text="" styleClass="ionicons" onAction="#didClickChooseCustomMountPoint" focusTraversable="true" cacheShape="true" cache="true"/>
|
||||
<HBox fx:id="customMountPoint" GridPane.rowIndex="7" GridPane.columnIndex="0" GridPane.columnSpan="2" spacing="6" alignment="BASELINE_LEFT" cacheShape="true" cache="true">
|
||||
<padding>
|
||||
<Insets left="20.0" />
|
||||
</padding>
|
||||
<Label HBox.hgrow="ALWAYS" fx:id="customMountPointLabel" textOverrun="LEADING_ELLIPSIS" cacheShape="true" cache="true" />
|
||||
<Button HBox.hgrow="NEVER" minWidth="-Infinity" text="" styleClass="ionicons" onAction="#didClickChooseCustomMountPoint" focusTraversable="true" cacheShape="true" cache="true" />
|
||||
</HBox>
|
||||
</GridPane>
|
||||
|
||||
|
||||
@@ -73,11 +73,10 @@ unlock.label.savePassword=Save Password
|
||||
unlock.label.mountName=Drive Name
|
||||
unlock.label.unlockAfterStartup=Auto-Unlock on Start (Experimental)
|
||||
unlock.label.revealAfterMount=Reveal Drive
|
||||
unlock.label.useReadOnlyMode=Read-only
|
||||
unlock.label.useReadOnlyMode=Read-Only
|
||||
unlock.label.winDriveLetter=Drive Letter
|
||||
unlock.label.useOwnMountPath=Use Custom Mount Point
|
||||
unlock.label.mountPath=Mount path
|
||||
unlock.label.mountPathButton=Apply
|
||||
unlock.label.chooseMountPath=Choose empty directory…
|
||||
unlock.label.downloadsPageLink=All Cryptomator versions
|
||||
unlock.label.advancedHeading=Advanced Options
|
||||
unlock.button.unlock=Unlock Vault
|
||||
|
||||
Reference in New Issue
Block a user