From a419398305558f45ff4d336c2806ada6b3cdffcf Mon Sep 17 00:00:00 2001 From: Matthieu Hodgkinson Date: Thu, 13 Aug 2026 10:22:39 +0200 Subject: [PATCH] Linux file picker can select several files --- framework/interactive/internal/interactive.cpp | 15 +++++++++++++-- .../qml/Muse/Interactive/FileDialog.qml | 8 ++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/framework/interactive/internal/interactive.cpp b/framework/interactive/internal/interactive.cpp index e5f71f5953..64e094f0bc 100644 --- a/framework/interactive/internal/interactive.cpp +++ b/framework/interactive/internal/interactive.cpp @@ -432,8 +432,19 @@ io::paths_t Interactive::selectOpeningFilesSync(const std::string& title, const return paths; #else - NOT_SUPPORTED; - return io::paths_t{ selectOpeningFileSync(title, dir, filter, options) }; + UriQuery q = makeSelectFileQuery(FileDialogMode::OpenFiles, title, dir, filter, options); + + RetVal rv = openSync(q); + if (!rv.ret) { + return io::paths_t(); + } + + io::paths_t paths; + for (const Val& val : rv.val.toList()) { + paths.push_back(QUrl::fromUserInput(val.toQString()).toLocalFile()); + } + + return paths; #endif } diff --git a/framework/interactive/qml/Muse/Interactive/FileDialog.qml b/framework/interactive/qml/Muse/Interactive/FileDialog.qml index d3aadd5627..07fb03763c 100644 --- a/framework/interactive/qml/Muse/Interactive/FileDialog.qml +++ b/framework/interactive/qml/Muse/Interactive/FileDialog.qml @@ -65,8 +65,12 @@ QtPlatform.FileDialog { onAccepted: { if (root.fileMode === FileDialog.OpenFiles) { - const selectedUrls = root.fileUrls || [] - root.ret = { "errcode": 0, "value": selectedUrls } + let selectedFiles = [] + const selectedUrls = root.files || [] + for (let i = 0; i < selectedUrls.length; ++i) { + selectedFiles.push(selectedUrls[i].toString()) + } + root.ret = { "errcode": 0, "value": selectedFiles } } else if (root.fileMode === FileDialog.SaveFile) { root.ret = { "errcode": 0, "value": root.appendSuffixIfNeeded(root.currentFile.toString()) } } else {