Parcourir la source

Add non-forced retry lock button

Sebastian Stenzel il y a 3 ans
Parent
commit
21d342d117

+ 11 - 1
src/main/java/org/cryptomator/ui/lock/LockForcedController.java

@@ -35,7 +35,13 @@ public class LockForcedController implements FxController {
 	}
 
 	@FXML
-	public void confirmForcedLock() {
+	public void retry() {
+		forceLockDecisionLock.interacted(LockModule.ForceLockDecision.RETRY);
+		window.close();
+	}
+
+	@FXML
+	public void force() {
 		forceLockDecisionLock.interacted(LockModule.ForceLockDecision.FORCE);
 		window.close();
 	}
@@ -54,4 +60,8 @@ public class LockForcedController implements FxController {
 		return vault.getDisplayName();
 	}
 
+	public boolean isForceSupported() {
+		return vault.supportsForcedUnmount();
+	}
+
 }

+ 1 - 0
src/main/java/org/cryptomator/ui/lock/LockModule.java

@@ -28,6 +28,7 @@ abstract class LockModule {
 
 	enum ForceLockDecision {
 		CANCEL,
+		RETRY,
 		FORCE;
 	}
 

+ 1 - 0
src/main/java/org/cryptomator/ui/lock/LockWorkflow.java

@@ -62,6 +62,7 @@ public class LockWorkflow extends Task<Void> {
 			LOG.info("Locking {} failed (forced: {}).", vault.getDisplayName(), forced, e);
 			var decision = askUserForAction();
 			switch (decision) {
+				case RETRY -> lock(false);
 				case FORCE -> lock(true);
 				case CANCEL -> cancel(false);
 			}

+ 3 - 3
src/main/resources/fxml/lock_forced.fxml

@@ -33,11 +33,11 @@
 		</HBox>
 
 		<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
-			<ButtonBar buttonMinWidth="120" buttonOrder="+CI">
+			<ButtonBar buttonMinWidth="100" buttonOrder="+CIU">
 				<buttons>
 					<Button text="%generic.button.cancel" ButtonBar.buttonData="CANCEL_CLOSE" defaultButton="true" cancelButton="true" onAction="#cancel"/>
-					<!-- TODO: third button with retry? -->
-					<Button text="%lock.forced.confirmBtn" ButtonBar.buttonData="FINISH" onAction="#confirmForcedLock"/>
+					<Button text="%lock.forced.retryBtn" ButtonBar.buttonData="FINISH" onAction="#retry"/>
+					<Button text="%lock.forced.forceBtn" ButtonBar.buttonData="OTHER" onAction="#force" disable="${!controller.forceSupported}"/>
 				</buttons>
 			</ButtonBar>
 		</VBox>

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

@@ -120,7 +120,8 @@ unlock.error.invalidMountPoint.existing=Mount point "%s" already exists or paren
 ## Force
 lock.forced.heading=Graceful lock failed
 lock.forced.message=Locking "%s" was blocked by pending operations or open files. You can force lock this vault, however interrupting I/O may result in the loss of unsaved data.
-lock.forced.confirmBtn=Force Lock
+lock.forced.retryBtn=Retry
+lock.forced.forceBtn=Force Lock
 ## Failure
 lock.fail.heading=Locking vault failed.
 lock.fail.message=Vault "%s" could not be locked. Ensure unsaved work is saved elsewhere and important Read/Write operations are finished. In order to close the vault, kill the Cryptomator process.