Bug 419874

Summary: Folder selection does not work in file picker dialog
Product: [Plasma] xdg-desktop-portal-kde Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: normal CC: bharadwaj.raju777, iguanamiyagi, io, jgrulich, katyaberezyaka, leonny02, matthias.schrumpf, med.medin.2014, nate, xanonix161, yricky
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.83
Sentry Crash Report:
Attachments: gtk-portal-folder-test.py
Transmission flatpak folder select working on my system
expected folder selector

Description Patrick Silva 2020-04-09 11:52:01 UTC
SUMMARY
This issue was already reported in flathub tracker
https://github.com/flathub/flathub/issues/1442

I can reproduce on Arch Linux, but not on Neon unstable edition.

STEPS TO REPRODUCE
1. install Transmission torrent client from flathub:
flatpak install flathub com.transmissionbt.Transmission
2. try to select another folder to "Save to location" setting in "Downloading" tab of Transmission preferences 
3. 

OBSERVED RESULT
Transmission triggers the KDE open file dialog, no folder can be selected.

EXPECTED RESULT
Transmission should trigger "Select a file" GTK3 dialog that allows folder selection.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.2
Comment 1 Patrick Silva 2020-04-09 11:54:47 UTC
I have built and installed master branch of xdg-desktop-portal-kde on Arch Linux, but this issue persists.
Comment 2 Jan Grulich 2020-04-09 12:11:03 UTC
We don't have support for this yet in Qt and neither in xdg-desktop-portal-kde.
Comment 3 Jan Grulich 2020-04-22 05:49:16 UTC
Qt change: https://codereview.qt-project.org/c/qt/qtbase/+/297872
Xdg-desktop-portal-kde change: https://phabricator.kde.org/D29071
Comment 4 Jan Grulich 2020-04-22 05:52:33 UTC
*** Bug 406115 has been marked as a duplicate of this bug. ***
Comment 5 Jan Grulich 2020-04-28 11:29:54 UTC
Git commit 976d0c5fade9c24a939e00fcf8708b0ae6e11402 by Jan Grulich.
Committed on 28/04/2020 at 11:29.
Pushed by grulich into branch 'master'.

FileChooser portal: add support for opening directories

Summary: BUG: 419874

Test Plan: This is also implemented on Qt side and currently on review: https://codereview.qt-project.org/c/qt/qtbase/+/297872. Tested with xdg-portal-test-kde using mentioned Qt patch.

Reviewers: apol, #plasma

Reviewed By: apol

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D29071

M  +7    -1    src/filechooser.cpp

https://commits.kde.org/xdg-desktop-portal-kde/976d0c5fade9c24a939e00fcf8708b0ae6e11402
Comment 6 Kai Uwe Broulik 2020-05-11 07:42:21 UTC
*** Bug 421310 has been marked as a duplicate of this bug. ***
Comment 7 Patrick Silva 2020-11-24 12:02:00 UTC
it's still impossible to select a folder with GTK3 apps installed via flatpak.
Nothing happens when I click on "Open" button of the dialog.


Operating System: Arch Linux
KDE Plasma Version: 5.20.3
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.2
Comment 9 Jan Grulich 2020-11-24 13:45:26 UTC
What is your version of xdg-desktop-portal? I will try to investigate.
Comment 10 Patrick Silva 2020-11-24 14:03:09 UTC
(In reply to Jan Grulich from comment #9)
> What is your version of xdg-desktop-portal? I will try to investigate.

xdg-desktop-portal 1.8.0-1
Comment 11 Patrick Silva 2021-04-03 11:53:47 UTC
*** Bug 428181 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2021-04-21 22:57:45 UTC
*** Bug 435797 has been marked as a duplicate of this bug. ***
Comment 13 Bharadwaj Raju 2021-05-14 11:48:10 UTC
*** Bug 430753 has been marked as a duplicate of this bug. ***
Comment 14 Bharadwaj Raju 2021-05-14 11:48:19 UTC
*** Bug 435276 has been marked as a duplicate of this bug. ***
Comment 15 Bug Janitor Service 2021-05-14 14:24:43 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/445
Comment 16 medin 2021-05-14 15:32:04 UTC
*** Bug 435276 has been marked as a duplicate of this bug. ***
Comment 17 David Faure 2021-05-15 18:26:42 UTC
Git commit 0829537a46c4fb2d907ab5c383fda041786175df by David Faure, on behalf of Bharadwaj Raju.
Committed on 15/05/2021 at 18:26.
Pushed by dfaure into branch 'master'.

Allow selecting directories in KFileWidget

Removes the restriction on not being able to select directories in KFileWidget. If user selects a directory but isn't in directory mode, then slotOk will take care of it.

Required for folder selection via xdg-desktop-portal-kde (eg in Firefox, Flatpaks, etc) to work properly. See also https://invent.kde.org/plasma/xdg-desktop-portal-kde/commit/976d0c5fade9c24a939e00fcf8708b0ae6e11402

M  +5    -1    src/filewidgets/kfilewidget.cpp

https://invent.kde.org/frameworks/kio/commit/0829537a46c4fb2d907ab5c383fda041786175df
Comment 18 Patrick Silva 2021-05-22 12:10:21 UTC
This bug persists on neon unstsble with Firefox from Ubuntu repos and the following flatpaks:
Transmission torrent client
Celluloid player
Rhythmbox player

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 19 Bharadwaj Raju 2021-05-22 12:14:04 UTC
Created attachment 138678 [details]
gtk-portal-folder-test.py

Can you test this small Python script? Run it with env var GTK_USE_PORTAL=1.
Comment 20 Bharadwaj Raju 2021-05-22 12:21:08 UTC
Created attachment 138679 [details]
Transmission flatpak folder select working on my system

I cannot reproduce this bug with Transmission FlatPak.

Neon Unstable, Frameworks 5.83.0.
Comment 21 Patrick Silva 2021-05-22 12:25:56 UTC
I also can reproduce running your script with
$GTK_USE_PORTAL=1 python3 file_419874.py
Comment 22 Bharadwaj Raju 2021-05-22 12:33:44 UTC
What does apt list --installed libkf5kiofilewidgets5 say?
Comment 23 Patrick Silva 2021-05-22 12:35:19 UTC
Created attachment 138680 [details]
expected folder selector

ok, I need to select the desired folder with left click and click on "Open"
button. Sorry for my mistake. However, current folder selection seems a bit confusing, I was expecting the folder selector seen in my screenshot.
Comment 24 Patrick Silva 2021-05-22 12:42:13 UTC
The folder selector seen in your screenshot looks like file open/save dialogs.
Also preview panel in the right side is pointless for a folder selector.
Comment 25 Bharadwaj Raju 2021-05-22 12:50:51 UTC
(In reply to Patrick Silva from comment #23)
> Created attachment 138680 [details]
> expecting folder selector
> 
> ok, I need to select the desired folder with left click and click on "Open"
> button. Sorry for my mistake. However, current folder selection seems a bit
> confusing, I was expecting the folder selector seen in my screenshot.
Right then, closing as FIXED.


(In reply to Patrick Silva from comment #24)
> The folder selector seen in your screenshot looks like file open/save
> dialogs.
It *looks* like a file dialog, but it only shows directories, not files.

> Also preview panel in the right side is pointless for a folder selector.
I'll work on disabling preview panel for directory mode later.


Currently, native Qt apps use a tree-style folder selector. If you'd like them to use this kind, or if you'd like portal apps to use tree-style instead, please open a separate request (and please link it here).
Comment 26 Patrick Silva 2021-05-22 13:07:39 UTC
Humm, I have just noticed that we can not select a folder in the left panel
(Desktop, Documents, Downloads, Music, Videos, etc).
I click on any of them, then nothing happens on clicking Open button.
I can only select folders listed in the files view.

I will open a request for tree-style folder selector later.
Thank you very much Bharadwa.
Comment 27 Patrick Silva 2021-05-22 14:26:59 UTC
(In reply to Bharadwaj Raju from comment #25)
> if you'd like portal apps to use tree-style
> instead, please open a separate request (and please link it here).

done, see bug 437505
Comment 28 Patrick Silva 2021-08-08 12:37:51 UTC
*** Bug 440676 has been marked as a duplicate of this bug. ***