Skip to content

Fix Decrypt File Name dialog to reuse a single window - #4164

Merged
mindmonk merged 5 commits into
developfrom
feature/decrypt-name-single-dialog-per-vault
Mar 31, 2026
Merged

mindmonk merged 5 commits into
developfrom
feature/decrypt-name-single-dialog-per-vault

Conversation

@mindmonk

@mindmonk mindmonk commented Mar 2, 2026

Copy link
Copy Markdown

This PR fixes the Decrypt File Name behavior in Vault Details for unlocked vaults.

Previously, each Decrypt File Name action (button click or drag-and-drop) created a new dialog window.

Now, the dialog is reused per vault and brought to front, while refreshing its content with the latest dropped/selected files.

@coderabbitai

coderabbitai Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Walkthrough

Decrypt-name UI flow was refactored: DecryptFileNamesViewController no longer accepts an initial list via constructor, adds a public decrypt(List) method that invokes checkAndDecrypt(...) and updates its mapping, and clears mapping when the window is hidden. DecryptNameComponent exposes a controller() accessor, changes showDecryptFileNameWindow to accept List and calls controller().decrypt(pathsToDecrypt) before showing the window; its subcomponent factory no longer requires the paths parameter. VaultDetailUnlockedController caches DecryptNameComponent instances per Vault (LoadingCache) and reuses them when showing the decrypt-name window.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

misc:filesystem, misc:gui

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: converting from creating new windows to reusing a single window for the Decrypt File Names dialog.
Description check ✅ Passed The description is directly related to the changeset, explaining the before/after behavior and the intent of the changes across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/decrypt-name-single-dialog-per-vault

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java (1)

153-159: Consider explicit empty-input behavior in reused-window mode.

At Line 154, empty input is a no-op, so reopening via button can show stale previous results. If the intended refresh behavior is “no selection => empty table”, clear mapping before returning.

Proposed adjustment
 public void decrypt(List<Path> pathsToDecrypt) {
 	if (pathsToDecrypt.isEmpty()) {
-		return;
+		mapping.clear();
+		cipherToCleartextTable.setItems(mapping);
+		return;
 	}
 	checkAndDecrypt(pathsToDecrypt);
 	cipherToCleartextTable.setItems(mapping);
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`
around lines 153 - 159, The decrypt(List<Path> pathsToDecrypt) method currently
returns immediately on empty input leaving previous results visible; update it
so that when pathsToDecrypt.isEmpty() you clear the backing observable
(mapping.clear()) and refresh the view
(cipherToCleartextTable.setItems(mapping)) before returning, otherwise proceed
to call checkAndDecrypt(pathsToDecrypt) as before; this ensures the reused
window shows an empty table when no selection is provided.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`:
- Around line 153-159: The decrypt(List<Path> pathsToDecrypt) method currently
returns immediately on empty input leaving previous results visible; update it
so that when pathsToDecrypt.isEmpty() you clear the backing observable
(mapping.clear()) and refresh the view
(cipherToCleartextTable.setItems(mapping)) before returning, otherwise proceed
to call checkAndDecrypt(pathsToDecrypt) as before; this ensures the reused
window shows an empty table when no selection is provided.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4090413 and 92d11d8.

📒 Files selected for processing (3)
  • src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java
  • src/main/java/org/cryptomator/ui/decryptname/DecryptNameComponent.java
  • src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java

@mindmonk
mindmonk requested a review from infeo March 2, 2026 14:10
@infeo infeo added this to the next milestone Mar 8, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java (1)

61-61: Consider removing initialList field — it's now always empty.

Since the constructor no longer receives a List<Path> parameter and initialList is always List.of(), the field serves no purpose. The decrypt(initialList) call in initialize() returns immediately due to the empty check on line 155-156.

♻️ Proposed cleanup
 private final Vault vault;
 private final ResourceBundle resourceBundle;
-private final List<Path> initialList;
 public DecryptFileNamesViewController(`@DecryptNameWindow` Stage window, `@DecryptNameWindow` Vault vault, ResourceBundle resourceBundle) {
     this.window = window;
     this.vault = vault;
     this.resourceBundle = resourceBundle;
     this.mapping = new SimpleListProperty<>(FXCollections.observableArrayList());
-    this.initialList = List.of();
 }
-decrypt(initialList);
 window.setOnHidden(_ -> mapping.clear());

Also applies to: 76-76, 126-126

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`
at line 61, The field initialList in DecryptFileNamesViewController is always
empty and unused; remove the private final List<Path> initialList declaration,
delete any assignment or constructor parameter related to it, and remove the
decrypt(initialList) call in initialize() (or replace it with a direct
no-op/empty-list call if you prefer explicitness); ensure any references to
initialList elsewhere in DecryptFileNamesViewController (including line ranges
around the constructor and initialize method) are removed or updated so the
class compiles without that field.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`:
- Line 61: The field initialList in DecryptFileNamesViewController is always
empty and unused; remove the private final List<Path> initialList declaration,
delete any assignment or constructor parameter related to it, and remove the
decrypt(initialList) call in initialize() (or replace it with a direct
no-op/empty-list call if you prefer explicitness); ensure any references to
initialList elsewhere in DecryptFileNamesViewController (including line ranges
around the constructor and initialize method) are removed or updated so the
class compiles without that field.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe624bd0-9d55-4e2c-9acb-752e850ce542

📥 Commits

Reviewing files that changed from the base of the PR and between 92d11d8 and 9eca05a.

📒 Files selected for processing (3)
  • src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java
  • src/main/java/org/cryptomator/ui/decryptname/DecryptNameComponent.java
  • src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/cryptomator/ui/decryptname/DecryptNameComponent.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`:
- Line 123: When the window is hidden the handler currently only calls
mapping.clear() (window.setOnHidden), but it must also reset the drop‑zone UI so
stale error text/icon and any pending 5s clear timer are cancelled; update the
window.setOnHidden handler to clear mapping AND reset the drop‑zone state (clear
error text/icon, hide error icon) and cancel or run the scheduled timer (or call
the existing method that does that reset) so the dialog is truly fresh when
reopened.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ee5952c8-84ac-4c82-8ba9-d80389750d3a

📥 Commits

Reviewing files that changed from the base of the PR and between 9eca05a and 87fe209.

📒 Files selected for processing (2)
  • src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java
  • src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java

if (!initialList.isEmpty()) {
checkAndDecrypt(initialList);
}
window.setOnHidden(_ -> mapping.clear());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Reset the drop-zone state when the cached window closes.

Line 123 clears the table data, but the previous error text/icon survives until the 5-second timer fires. If the dialog is closed and reopened quickly after an error, the user can still see the stale error state in what otherwise looks like a fresh window.

Possible fix
@@
-		dropZoneText.setValue(resourceBundle.getString("decryptNames.dropZone.message"));
-		dropZoneIcon.setValue(FontAwesome5Icon.FILE_IMPORT);
+		resetDropZone();
@@
-		window.setOnHidden(_ -> mapping.clear());
+		window.setOnHidden(_ -> {
+			mapping.clear();
+			resetDropZone();
+		});
 	}
+
+	private void resetDropZone() {
+		dropZoneText.setValue(resourceBundle.getString("decryptNames.dropZone.message"));
+		dropZoneIcon.setValue(FontAwesome5Icon.FILE_IMPORT);
+		wrongFilesSelected.setValue(false);
+	}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java`
at line 123, When the window is hidden the handler currently only calls
mapping.clear() (window.setOnHidden), but it must also reset the drop‑zone UI so
stale error text/icon and any pending 5s clear timer are cancelled; update the
window.setOnHidden handler to clear mapping AND reset the drop‑zone state (clear
error text/icon, hide error icon) and cancel or run the scheduled timer (or call
the existing method that does that reset) so the dialog is truly fresh when
reopened.

@mindmonk
mindmonk merged commit 9de0981 into develop Mar 31, 2026
29 checks passed
@mindmonk
mindmonk deleted the feature/decrypt-name-single-dialog-per-vault branch March 31, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants