New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot choose a folder in Flatpak build #2479
Comments
This is a Qt bug, it shouldn't be using the portal to open folders. |
I just saw this: https://flatpak.github.io/xdg-desktop-portal/portal-docs.html#gdbus-org.freedesktop.portal.FileChooser It doesn't look like selecting folders is actually supported by the xdg-desktop-portal spec at all? There's no mention of them. |
Wait, so are you saying qt could use its own file chooser dialog from within the flatpak? I thought that wasn't possible due to the nature of the sandbox. |
If you want to select a folder inside the sandbox, using a local file chooser works. There is no way to select a host-side folder at runtime. |
I opened a bug report against Qt: https://bugreports.qt.io/browse/QTBUG-72755 IMO this is still a bug in Flatpak, or at least a limitation that should be documented. Thanks all for your help. |
Could this be a bug in the runtime itself? |
For what it's worth, I tried creating a Snap and it did the same thing. Screenshot of my Snap build: snapcraft.yml:
|
It is a well-known limitation. |
I just checked Solarus and it calls QFileDialog::getOpenFileName(), which means it requests to open a file, not a directory and even the filter says "Select archive or quest.dat". Qt actually doesn't use portal when trying to open a folder and when you want to open a folder, you have to change file mode in QFileDialog. |
For reference: These all are patches to make Qt not to use portals when opening folders. All were merged to Qt 5.12 and we backported them all to our KDE 5.11 runtime (also to KDE 5.9lts). |
Thank you all for the info and help. The bit about You all were extremely helpful, thanks a lot for answering (and even over the holiday), it made my life easier. 😄 |
I had issues opening directories in flatpak apps in KDE environment in Ubuntu 20.04. I think it was related to this issue or the mentioned Qt issues. The issue was that I wasn't able to select a directory in VS Code, Ungoogled Chromium or Slack, because they launched xdg-dekstop-portal-kde as the directory chooser, but that allowed only selecting files. Workaround
This makes the flatpak apps use the GTK portal instead. |
Linux distribution and version
Tested on elementary OS Loki 0.4 and Ubuntu 18.10
Flatpak version
Flatpak 1.0.6
Description of the problem
I've used Flatpak to build Solarus Game Engine, a Qt-based desktop program that helps people make games.
It must load these games as folders. This is what "File > Add quest..." is supposed to look like:
I can click a folder and select "choose" and it chooses that whole folder.
However, the Flatpak build does not use the Qt file browser dialog. It uses the native system one. Here's the resulting Flatpak on elementary OS 0.4 Loki:
I cannot select a folder. The only option is "Open" which causes the file browser to navigate into the folder.
To be sure this wasn't an issue with elementary OS, I also tested on Ubuntu 18.10 with nearly the same result:
Any ideas?
Steps to reproduce
Thank you, and happy holidays!
The text was updated successfully, but these errors were encountered: