Bug 437505

Summary: Request - tree-style folder selector for portal apps (flatpaks, for example)
Product: [Plasma] xdg-desktop-portal-kde Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: wishlist CC: bharadwaj.raju777, fabian, mte90net, nate, postix, rakuco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.0
Sentry Crash Report:

Description Patrick Silva 2021-05-22 14:25:12 UTC
Currently Qt native apps trigger a tree-style folder selector,
seen in the screenshot below.
https://bugsfiles.kde.org/attachment.cgi?id=138680

However, as mentioned in bug 419874 comment 23 and bug 419874 comment 24, portal apps (the ones installed via flatpak, for example) trigger a folder selector that is a bit confusing because it looks like file open/save dialogs and it can have a preview panel (if it is enabled via Options button in the upper right corner), which is pointless for a folder selector. Please see the following screenshot.
https://bugsfiles.kde.org/attachment.cgi?id=138679

For consistency reasons and to avoid potential confusion, I think that using tree-style folder selector with portal apps too would be nice.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.22.80
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Graphics Platform: X11
Comment 1 Fabian Vogt 2022-01-17 18:27:08 UTC
The issue is that the tree-style folder selection is only implemented in the plasma platformtheme plugin (in plasma-integration), and only accessible through QFileDialog. QFileDialog does not provide some of the APIs necessary to implement e.g. option selection.

To fix this, KDirSelectDialog (and its dependencies) would have to be extracted from plasma-integration into KIO.
Comment 2 Bug Janitor Service 2022-01-17 21:10:40 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/62
Comment 3 Fabian Vogt 2022-01-19 09:36:18 UTC
Git commit 551c583bd883056d28895597ce8d4571cd6a6f81 by Fabian Vogt.
Committed on 18/01/2022 at 20:02.
Pushed by fvogt into branch 'master'.

Use QFileDialog for selecting directories

KFileWidget is not as good at selecting directories as KDirSelectDialog
from plasma-integration. On top of that, directory selection appears to be
entirely broken currently.

Use KDirSelectDialog through QFileDialog if possible.

M  +32   -0    src/filechooser.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/commit/551c583bd883056d28895597ce8d4571cd6a6f81
Comment 4 Fabian Vogt 2022-01-19 09:37:52 UTC
Git commit 4b29ae78943b46ddfa3f3eca45c442f13c5a67e8 by Fabian Vogt.
Committed on 19/01/2022 at 09:37.
Pushed by fvogt into branch 'Plasma/5.24'.

Use QFileDialog for selecting directories

KFileWidget is not as good at selecting directories as KDirSelectDialog
from plasma-integration. On top of that, directory selection appears to be
entirely broken currently.

Use KDirSelectDialog through QFileDialog if possible.
(cherry picked from commit 551c583bd883056d28895597ce8d4571cd6a6f81)

M  +32   -0    src/filechooser.cpp

https://invent.kde.org/plasma/xdg-desktop-portal-kde/commit/4b29ae78943b46ddfa3f3eca45c442f13c5a67e8
Comment 5 Daniele Scasciafratte 2022-01-29 11:28:38 UTC
*** Bug 449289 has been marked as a duplicate of this bug. ***