Pārlūkot izejas kodu

No longer lock vault on double click

See https://github.com/cryptomator/cryptomator/pull/3194#issuecomment-1806106843
Antoine James Tournepiche 1 gadu atpakaļ
vecāks
revīzija
fd84ff09e1

+ 4 - 11
src/main/java/org/cryptomator/ui/mainwindow/VaultListController.java

@@ -113,10 +113,12 @@ public class VaultListController implements FxController {
 		});
 		vaultList.addEventFilter(MouseEvent.MOUSE_RELEASED, this::deselect);
 
-		//toggle selected vault lock status on double click
+		//unlock vault on double click
 		vaultList.addEventFilter(MouseEvent.MOUSE_CLICKED, click -> {
 			if (click.getClickCount() >= 2) {
-				Optional.ofNullable(selectedVault.get()).ifPresent(this::toggleVaultLockStatus);
+				Optional.ofNullable(selectedVault.get())
+						.filter(Vault::isLocked)
+						.ifPresent(vault -> appWindows.startUnlockWorkflow(vault, mainWindow));
 			}
 		});
 
@@ -173,15 +175,6 @@ public class VaultListController implements FxController {
 		}
 	}
 
-	private void toggleVaultLockStatus(Vault vault) {
-		if (vault.isLocked()) {
-			appWindows.startUnlockWorkflow(vault, mainWindow);
-		}
-		if (vault.isUnlocked()) {
-			appWindows.startLockWorkflow(vault, mainWindow);
-		}
-	}
-
 	private void selectedVaultDidChange(@SuppressWarnings("unused") ObservableValue<? extends Vault> observableValue, @SuppressWarnings("unused") Vault oldValue, Vault newValue) {
 		if (newValue == null) {
 			return;