Repository navigation
Fix Decrypt File Name dialog to reuse a single window - #4164
Conversation
WalkthroughDecrypt-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
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 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
mappingbefore 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
📒 Files selected for processing (3)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.javasrc/main/java/org/cryptomator/ui/decryptname/DecryptNameComponent.javasrc/main/java/org/cryptomator/ui/mainwindow/VaultDetailUnlockedController.java
…lear mapping on close
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.java (1)
61-61: Consider removinginitialListfield — it's now always empty.Since the constructor no longer receives a
List<Path>parameter andinitialListis alwaysList.of(), the field serves no purpose. Thedecrypt(initialList)call ininitialize()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
📒 Files selected for processing (3)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.javasrc/main/java/org/cryptomator/ui/decryptname/DecryptNameComponent.javasrc/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
There was a problem hiding this comment.
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
📒 Files selected for processing (2)
src/main/java/org/cryptomator/ui/decryptname/DecryptFileNamesViewController.javasrc/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()); |
There was a problem hiding this comment.
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.
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.