reworked event cell texts

This commit is contained in:
Armin Schrenk
2025-03-04 17:00:14 +01:00
parent bda38096e1
commit f2a480c7a0
3 changed files with 47 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ public enum FontAwesome5Icon {
CLIPBOARD("\uF328"), //
COG("\uF013"), //
COGS("\uF085"), //
COMPRESS_ALT("\uF422"), //
COPY("\uF0C5"), //
CROWN("\uF521"), //
DONATE("\uF4B9"), //

View File

@@ -3,6 +3,8 @@ package org.cryptomator.ui.eventview;
import org.cryptomator.common.Nullable;
import org.cryptomator.common.ObservableUtil;
import org.cryptomator.cryptofs.CryptoPath;
import org.cryptomator.cryptofs.event.BrokenDirFileEvent;
import org.cryptomator.cryptofs.event.BrokenFileNodeEvent;
import org.cryptomator.cryptofs.event.ConflictResolutionFailedEvent;
import org.cryptomator.cryptofs.event.ConflictResolvedEvent;
import org.cryptomator.cryptofs.event.DecryptionFailedEvent;
@@ -107,13 +109,28 @@ public class EventListCellController implements FxController {
case ConflictResolvedEvent fse -> this.adjustToConflictResolvedEvent(fse);
case ConflictResolutionFailedEvent fse -> this.adjustToConflictEvent(fse);
case DecryptionFailedEvent fse -> this.adjustToDecryptionFailedEvent(fse);
case BrokenDirFileEvent fse -> this.adjustToBrokenDirFileEvent(fse);
case BrokenFileNodeEvent fse -> this.adjustToBrokenFileNodeEvent(fse);
}
}
private void adjustToBrokenFileNodeEvent(BrokenFileNodeEvent bfe) {
eventIcon.setValue(FontAwesome5Icon.TIMES);
eventMessage.setValue(resourceBundle.getString("event.brokenFileNode.message"));
eventDescription.setValue(bfe.ciphertextPath().getFileName().toString());
if (revealService != null) {
addAction("event.brokenFileNode.showEncrypted", () -> reveal(revealService, convertVaultPathToSystemPath(bfe.ciphertextPath())));
} else {
addAction("event.brokenFileNode.copyEncrypted", () -> copyToClipboard(convertVaultPathToSystemPath(bfe.ciphertextPath()).toString()));
}
addAction("event.brokenFileNode.copyDecrypted", () -> copyToClipboard(convertVaultPathToSystemPath(bfe.cleartextPath()).toString()));
}
private void adjustToConflictResolvedEvent(ConflictResolvedEvent cre) {
eventIcon.setValue(FontAwesome5Icon.FILE);
eventMessage.setValue(cre.resolvedCleartextPath().toString());
eventDescription.setValue(resourceBundle.getString("event.conflictResolved.description"));
eventIcon.setValue(FontAwesome5Icon.CHECK);
eventMessage.setValue(resourceBundle.getString("event.conflictResolved.message"));
eventDescription.setValue(cre.resolvedCiphertextPath().getFileName().toString());
if (revealService != null) {
addAction("event.conflictResolved.showDecrypted", () -> reveal(revealService, convertVaultPathToSystemPath(cre.resolvedCleartextPath())));
} else {
@@ -122,9 +139,9 @@ public class EventListCellController implements FxController {
}
private void adjustToConflictEvent(ConflictResolutionFailedEvent cfe) {
eventIcon.setValue(FontAwesome5Icon.TIMES);
eventMessage.setValue(cfe.canonicalCleartextPath().toString());
eventDescription.setValue(resourceBundle.getString("event.conflict.description"));
eventIcon.setValue(FontAwesome5Icon.COMPRESS_ALT);
eventMessage.setValue(resourceBundle.getString("event.conflict.message"));
eventDescription.setValue(cfe.conflictingCiphertextPath().getFileName().toString());
if (revealService != null) {
addAction("event.conflict.showDecrypted", () -> reveal(revealService, convertVaultPathToSystemPath(cfe.canonicalCleartextPath())));
addAction("event.conflict.showEncrypted", () -> reveal(revealService, cfe.conflictingCiphertextPath()));
@@ -136,8 +153,8 @@ public class EventListCellController implements FxController {
private void adjustToDecryptionFailedEvent(DecryptionFailedEvent dfe) {
eventIcon.setValue(FontAwesome5Icon.BAN);
eventMessage.setValue(dfe.ciphertextPath().toString());
eventDescription.setValue(resourceBundle.getString("event.decryptionFailed.description"));
eventMessage.setValue(resourceBundle.getString("event.decryptionFailed.message"));
eventDescription.setValue(dfe.ciphertextPath().getFileName().toString());
if (revealService != null) {
addAction("event.decryptionFailed.showEncrypted", () -> reveal(revealService, dfe.ciphertextPath()));
} else {
@@ -145,6 +162,17 @@ public class EventListCellController implements FxController {
}
}
private void adjustToBrokenDirFileEvent(BrokenDirFileEvent bde) {
eventIcon.setValue(FontAwesome5Icon.TIMES);
eventMessage.setValue(resourceBundle.getString("event.brokenDirFile.message"));
eventDescription.setValue(bde.ciphertextPath().getParent().getFileName().toString());
if (revealService != null) {
addAction("event.brokenDirFile.showEncrypted", () -> reveal(revealService, bde.ciphertextPath()));
} else {
addAction("event.brokenDirFile.copyEncrypted", () -> copyToClipboard(bde.ciphertextPath().toString()));
}
}
private void addAction(String localizationKey, Runnable action) {
var entry = new MenuItem(resourceBundle.getString(localizationKey));
entry.getStyleClass().addLast("dropdown-button-context-menu-item");

View File

@@ -585,16 +585,21 @@ shareVault.hub.openHub=Open Cryptomator Hub
eventView.title=Events
eventView.filter.allVaults=All
event.vaultLocked.message=***********
event.vaultLocked.description=Unlock vault "%s" for details
event.conflictResolved.description=Resolved conflict
event.vaultLocked.description=Unlock "%s" for details
event.conflictResolved.message=Resolved conflict
event.conflictResolved.showDecrypted=Show decrypted file
event.conflictResolved.copyDecrypted=Copy decrypted path
event.conflict.description=Cannot resolve conflict.
event.conflict.message=Conflict resolution failed
event.conflict.showDecrypted=Show decrypted, original file
event.conflict.copyDecrypted=Copy decrypted, original path
event.conflict.showEncrypted=Show conflicting, encrypted file
event.conflict.copyEncrypted=Copy conflicting, encrypted path
event.decryptionFailed.description=Decryption failed.
event.decryptionFailed.message=Decryption failed
event.decryptionFailed.showEncrypted=Show encrypted file
event.decryptionFailed.copyEncrypted=Copy encrypted path
event.brokenDirFile.message=Broken directory link
event.brokenDirFile.showEncrypted=Show broken, encrypted link
event.brokenDirFile.copyEncrypted=Copy path of broken link
event.brokenFileNode.message=Broken filesystem node
event.brokenFileNode.showEncrypted=Show broken, encrypted node
event.brokenFileNode.copyDecrypted=Copy decrypted path