Add non-forced retry lock button

This commit is contained in:
Sebastian Stenzel 2021-11-17 14:03:04 +01:00
parent 1b43bf395f
commit 21d342d117
No known key found for this signature in database
GPG Key ID: 667B866EA8240A09
5 changed files with 18 additions and 5 deletions

View File

@ -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();
}
}

View File

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

View File

@ -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);
}

View File

@ -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>

View File

@ -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.