Bug 510658

Summary: QFileDialog::getExistingDirectory implementation does not open hidden folders initially
Product: [Plasma] plasma-integration Reporter: Rosalie <rosalie>
Component: generalAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kde, olib141
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.4.6
Sentry Crash Report:

Description Rosalie 2025-10-15 22:21:10 UTC
SUMMARY

When using `QFileDialog::getExistingDirectory` with a hidden path as starting path, it falls back to the user's home directory.

STEPS TO REPRODUCE
1. call `QFileDialog::getExistingDirectory(this, "", "/home/user/.config");

OBSERVED RESULT

It opens the user's home directory

EXPECTED RESULT

It opens the given hidden directory

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 42 KDE
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.19.0
Qt Version: 6.9.2
Comment 1 Oliver Beard 2025-10-15 22:24:33 UTC
As an important addendum:

kdialog --getexistingdirectory /home/user/.config

works, and has a different implementation not calling QFileDialog::getExistingDirectory.

https://invent.kde.org/utilities/kdialog/-/blob/master/src/kdialog.cpp?ref_type=heads#L828
Comment 2 David Redondo 2025-10-16 09:11:49 UTC
Works with other platformthemes
Comment 3 David Redondo 2025-10-16 09:26:20 UTC
getExistingDirectory(Url) passes the dir in the constructor https://invent.kde.org/qt/qt/qtbase/-/blob/dev/src/widgets/dialogs/qfiledialog.cpp#L2581

so as expected   

 QFileDialog d(nullptr, QString(), "/home/david/.config");
d.setFileMode(QFileDialog::Directory);
 d.show();
reproduces the bug. As noted by Oliver the following works as expected and as a side effect shows all hidden directories: 

 QFileDialog d(nullptr);
 d.setFileMode(QFileDialog::Directory);
 d.setDirectory("/home/david/.config");
 d.show();
Comment 4 Bug Janitor Service 2025-10-16 10:02:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-integration/-/merge_requests/190
Comment 5 David Redondo 2025-10-16 10:19:25 UTC
Git commit fce65181729f862cead091d6bab66ee10fa9882c by David Redondo.
Committed on 16/10/2025 at 10:14.
Pushed by davidre into branch 'master'.

KDirSelectDialog: Strip trailing slash for hidden check

If there's a trailing slash fileName return an empty string.
FIXED-IN:6.4.6

M  +1    -2    qt5/src/platformtheme/kdirselectdialog.cpp
M  +1    -2    qt6/src/platformtheme/kdirselectdialog.cpp

https://invent.kde.org/plasma/plasma-integration/-/commit/fce65181729f862cead091d6bab66ee10fa9882c
Comment 6 David Redondo 2025-10-16 10:24:18 UTC
Git commit 00c3cc5120febae4f9a175dddd62013dbf92d872 by David Redondo.
Committed on 16/10/2025 at 10:20.
Pushed by davidre into branch 'Plasma/6.5'.

KDirSelectDialog: Strip trailing slash for hidden check

If there's a trailing slash fileName return an empty string.
FIXED-IN:6.4.6


(cherry picked from commit fce65181729f862cead091d6bab66ee10fa9882c)

Co-authored-by: David Redondo <kde@david-redondo.de>

M  +1    -2    qt5/src/platformtheme/kdirselectdialog.cpp
M  +1    -2    qt6/src/platformtheme/kdirselectdialog.cpp

https://invent.kde.org/plasma/plasma-integration/-/commit/00c3cc5120febae4f9a175dddd62013dbf92d872
Comment 7 David Redondo 2025-10-16 10:38:56 UTC
Git commit 3d5fb47b6e3adddd0acabbdc51a7f5bc697eef75 by David Redondo.
Committed on 16/10/2025 at 10:33.
Pushed by davidre into branch 'Plasma/6.4'.

KDirSelectDialog: Strip trailing slash for hidden check

If there's a trailing slash fileName return an empty string.
FIXED-IN:6.4.6


(cherry picked from commit fce65181729f862cead091d6bab66ee10fa9882c)

Co-authored-by: David Redondo <kde@david-redondo.de>

(cherry picked from commit 00c3cc5120febae4f9a175dddd62013dbf92d872)

Co-authored-by: David Redondo <kde@david-redondo.de>

M  +1    -2    qt5/src/platformtheme/kdirselectdialog.cpp
M  +1    -2    qt6/src/platformtheme/kdirselectdialog.cpp

https://invent.kde.org/plasma/plasma-integration/-/commit/3d5fb47b6e3adddd0acabbdc51a7f5bc697eef75