Choose folders in the platform's dialogue, not by typing a path

Every folder the desktop asked for was a text field: the library folder
at launch, an import's source and second copy, a preset folder brought
over from Lightroom. A typed path is how a destination silently becomes
a new folder nobody meant — one wrong letter three levels down and the
write succeeds somewhere the photographer will never look — and a field
cannot make the folder that is not there yet.

They now open the platform's own dialogue through rfd: the XDG desktop
portal on Linux, the common item dialogue on Windows. The portal rather
than GTK because it reaches the user's files from inside the Flatpak and
needs no GTK in a Slint application, and it draws whichever desktop's
chooser is running, "New folder" included. It is awaited on Slint's
event loop (spawn_local), so the window keeps drawing while it is open,
and parented to the window so it opens over it.

PathRow shows what is chosen, read-only, beside the button. Android has
no filesystem dialogue — only SAF, which returns document trees, not
paths — so there the same rows stay typed fields (Pickers.local-paths).

The launch screen keeps the folder used last on screen with "Open
folder" beside it, so reopening is one press. Presets get two buttons,
a folder and a single .xmp file, because no platform dialogue picks
"a file or a folder" in one go.
This commit is contained in:
2026-09-26 14:13:53 -04:00
parent 94542371f6
commit 6683c14b40
12 changed files with 612 additions and 47 deletions
+24 -5
View File
@@ -1,6 +1,7 @@
import { Theme } from "theme.slint";
import { Button, Field, Caption, PanelHeading } from "widgets.slint";
import { ChoiceChip } from "controls.slint";
import { Pickers } from "pickers.slint";
// TRACES: FR-DEV-6
// One kind of edit, and whether a copy carries it.
@@ -137,12 +138,13 @@ export component PresetSheet inherits Rectangle {
callback scope-toggled(string);
/// TRACES: FR-DEV-6
/// Read Lightroom presets from a typed path, and what came of the last
/// attempt. A typed path rather than a file dialogue because that is the
/// idiom this application already has — the launch screen takes a library
/// the same way, and there is no native picker anywhere in it.
/// Read Lightroom presets from a path, and what came of the last attempt.
/// Chosen in the platform's dialogue where there is one — `true` asks for
/// a single `.xmp` file, `false` for a folder of them — and typed where
/// there is not (Android).
in property <string> import-report;
callback import-presets(string);
callback browse-presets(bool);
background: #000000CC;
@@ -314,7 +316,24 @@ export component PresetSheet inherits Rectangle {
PanelHeading { text: "IMPORT"; }
Field {
// Two buttons rather than one dialogue, because no platform
// dialogue picks "a file or a folder" in one go: the portal
// and Windows each ask for one kind.
if Pickers.local-paths: HorizontalLayout {
spacing: Theme.gap-sm;
Button {
text: "Folder…";
horizontal-stretch: 1;
clicked => { root.browse-presets(false); }
}
Button {
text: ".xmp file…";
horizontal-stretch: 1;
clicked => { root.browse-presets(true); }
}
}
if !Pickers.local-paths: Field {
placeholder: "Path to a .xmp file or folder";
accepted(path) => { root.import-presets(path); }
}