Repository navigation
Conversation
Attachment and file downloads always opened the folder the platform suggests, with no way to change it (flectar#71). The save dialog is built in a single place, `DocumentDialog::file_dialog`, which never called `set_directory`. Settings → General now carries a Download location card to pick a folder or reset to the platform default. The stored path is resolved when a download is saved, not when the path is stored: a location can become unavailable later, such as an unmounted network share, so a download falls back to the platform default instead of failing. The setting covers mail attachments and the Files view, which share `DocumentProvider::export`. Import dialogs keep the platform default, since a download location does not describe where files are read from. Tests cover path resolution (empty, missing, a file instead of a directory, and a usable directory), the dialog built from the setting, and that settings blobs written before this field still load. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #71.
Problem
Attachment and file downloads always open the folder the platform suggests, with no way to change it. Every save dialog is built in one place,
DocumentDialog::file_dialoginsrc/documents.rs, and it never calledset_directory.Solution
Settings.download_directorystores the folder, and Settings → General gains a Download location card to pick one or reset to the platform default.The stored path is resolved when a download is saved, not when the path is stored. A location can become unavailable later — an unmounted network share, a removed drive — so
resolve_download_directoryfalls back to the platform default for an empty setting, a path that no longer exists, or a path that is not a directory. A download never fails because a saved location went away.Scope:
attachment_controller.rs) and the Files view (files_controller.rs), which shareDocumentProvider::export. Both go throughdownload_dialog_for, so a future download site picks the location up without repeating the lookup.download_directory_availableis set, whichstartup.rsties tocfg!(desktop). Mobile hosts export through their own document provider and have no filesystem directory to offer.User-visible effects
download,location,folder,attachments).Download location is saved once an account is set up., matching howset_theme_presethandles session-only settings.Tests
In
src/documents.rs:configured_directory_is_used_when_it_existsempty_setting_uses_the_platform_defaultmissing_directory_uses_the_platform_defaultfile_path_instead_of_a_directory_uses_the_platform_defaultdownload_dialog_starts_in_the_configured_directorydownload_dialog_without_a_configured_directory_uses_the_platform_defaultIn
crates/flectar-mail-core/src/db/repo/settings.rs, the three existing settings tests are extended,old_blob_gets_field_defaultsincluded, so settings blobs written before this field still load.rfd::AsyncFileDialogcannot be introspected, so every decision sits in a pure function ahead of it.Checks
cargo fmt --all -- --check,scripts/check-platform-gates.py,scripts/check-translations.shandcargo test --workspace --lockedpass.cargo clippy --workspace --all-targets --locked -- -D warningspasses except for a pre-existingclippy::nonminimal_boolhit atcrates/flectar-mail-core/src/jmap/client.rs:211, which newer Clippy reports and which I left untouched as unrelated to this change.Three test failures on my Windows machine are pre-existing and unrelated:
files::tests::save_does_not_clobberfails withPermissionDeniedand reproduces on an unmodifiedmain, and the twomail_securityOpenPGP tests need a working GnuPG.Why this is a draft
The UI has not been inspected in light and dark themes or at the documented phone and tablet preview sizes yet, as
CONTRIBUTING.mdrequires.tests/text_fit.rspasses, so text fits at desktop font sizes, but that is not the same as the visual review. I will mark this ready once that is done.Generative tool disclosure
This change was written with Claude Code (Claude Opus 5), as recorded in the commit trailer. No third-party code or assets were copied in, and no dependencies were added.