Selaa lähdekoodia

Show mountpath in reveal button

Armin Schrenk 2 vuotta sitten
vanhempi
commit
6a52d15510

+ 16 - 11
src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java

@@ -34,10 +34,9 @@ public class VaultDetailUnlockedController implements FxController {
 	private final Stage mainWindow;
 	private final LoadingCache<Vault, VaultStatisticsComponent> vaultStats;
 	private final VaultStatisticsComponent.Builder vaultStatsBuilder;
-	private final ObservableValue<Mountpoint> mountPoint;
 	private final ObservableValue<Boolean> accessibleViaPath;
 	private final ObservableValue<Boolean> accessibleViaUri;
-	private final ObservableValue<String> mountUri;
+	private final ObservableValue<String> mountPoint;
 
 	@Inject
 	public VaultDetailUnlockedController(ObjectProperty<Vault> vault, FxApplicationWindows appWindows, VaultService vaultService, VaultStatisticsComponent.Builder vaultStatsBuilder, @MainWindow Stage mainWindow) {
@@ -47,10 +46,16 @@ public class VaultDetailUnlockedController implements FxController {
 		this.mainWindow = mainWindow;
 		this.vaultStats = CacheBuilder.newBuilder().weakValues().build(CacheLoader.from(this::buildVaultStats));
 		this.vaultStatsBuilder = vaultStatsBuilder;
-		this.mountPoint = vault.flatMap(Vault::mountPointProperty);
-		this.accessibleViaPath = mountPoint.map(m -> m instanceof Mountpoint.WithPath).orElse(false);
-		this.accessibleViaUri = mountPoint.map(m -> m instanceof Mountpoint.WithUri).orElse(false);
-		this.mountUri = mountPoint.map(Mountpoint::uri).map(URI::toASCIIString).orElse("");
+		var mp = vault.flatMap(Vault::mountPointProperty);
+		this.accessibleViaPath = mp.map(m -> m instanceof Mountpoint.WithPath).orElse(false);
+		this.accessibleViaUri = mp.map(m -> m instanceof Mountpoint.WithUri).orElse(false);
+		this.mountPoint = mp.map(m -> {
+			if(m instanceof Mountpoint.WithPath mwp) {
+				return mwp.path().toString();
+			} else {
+				return m.uri().toASCIIString();
+			}
+		});
 	}
 
 	private VaultStatisticsComponent buildVaultStats(Vault vault) {
@@ -66,7 +71,7 @@ public class VaultDetailUnlockedController implements FxController {
 	public void copyMountUri() {
 		//TODO: add popup that conent is copied
 		ClipboardContent clipboardContent = new ClipboardContent();
-		clipboardContent.putString(getMountUri());
+		clipboardContent.putString(mountPoint.getValue());
 		Clipboard.getSystemClipboard().setContent(clipboardContent);
 	}
 
@@ -106,12 +111,12 @@ public class VaultDetailUnlockedController implements FxController {
 		return accessibleViaUri.getValue();
 	}
 
-	public ObservableValue<String> mountUriProperty() {
-		return mountUri;
+	public ObservableValue<String> mountPointProperty() {
+		return mountPoint;
 	}
 
-	public String getMountUri() {
-		return mountUri.getValue();
+	public String getMountPoint() {
+		return mountPoint.getValue();
 	}
 
 

+ 2 - 2
src/main/resources/fxml/vault_detail_unlocked.fxml

@@ -2,7 +2,6 @@
 <?import org.cryptomator.ui.controls.ThroughputLabel?>
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.Label?>
-<?import javafx.scene.control.Tooltip?>
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.Region?>
 <?import javafx.scene.layout.VBox?>
@@ -18,6 +17,7 @@
 				<FontAwesome5IconView glyph="HDD" glyphSize="24"/>
 				<VBox spacing="4" alignment="CENTER_LEFT">
 					<Label text="%main.vaultDetail.revealBtn"/>
+					<Label styleClass="label-extra-small" text="${controller.mountPoint}" textOverrun="CENTER_ELLIPSIS"/>
 				</VBox>
 			</HBox>
 		</graphic>
@@ -28,7 +28,7 @@
 				<FontAwesome5IconView glyph="LINK" glyphSize="24"/>
 				<VBox spacing="4" alignment="CENTER_LEFT">
 					<Label text="%generic.button.copy"/> <!-- TODO -->
-					<Label styleClass="label-extra-small" text="${controller.mountUri}" textOverrun="CENTER_ELLIPSIS"/>
+					<Label styleClass="label-extra-small" text="${controller.mountPoint}" textOverrun="CENTER_ELLIPSIS"/>
 				</VBox>
 			</HBox>
 		</graphic>