Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions framework/interactive/internal/interactive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,19 @@ static UriQuery makeSelectFileQuery(FileDialogMode mode, const std::string& titl
q.set("folder", QUrl::fromLocalFile(current.toQString()).toString().toStdString());
} else if (mode == FileDialogMode::SaveFile) {
q.set("currentFile", QUrl::fromLocalFile(current.toQString()).toString().toStdString());

// Some Linux native/portal dialogs don't auto-append the extension when the user
// doesn't type one, which then leaves the caller without a way to pick the right
// writer. Only do this when there is a single filter on offer: some callers (e.g.
// "Save As" with the experimental uncompressed-folder option) present more than one
// filter, where a global default suffix would be applied regardless of the filter
// the user actually selected, defeating the alternate option.
if (filter.size() == 1) {
std::string suffix = io::suffix(current);
if (!suffix.empty()) {
q.set("defaultSuffix", suffix);
}
}
}

return q;
Expand Down