Bug 459900

Summary: File picker could react more intelligently when the location field is given a full file path
Product: [Frameworks and Libraries] frameworks-kio Reporter: doncbugs
Component: Open/save dialogsAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: kdelibs-bugs, nate, qydwhotmail
Priority: NOR Keywords: usability
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.102
Sentry Crash Report:

Description doncbugs 2022-10-01 17:51:41 UTC
SUMMARY
For instance, when setting one's SDDM wallpaper, the dialog is opened. If you copy the location of an image and then paste that into the Location bar, it errors out saying that it is a file. I believe it should instead show the directory of the file and, perhaps, highlight the file.


STEPS TO REPRODUCE
1. Find an image to use (I downloaded one from Get New Wallpapers...)
2. Right-click on the image and copy the location
3. Go to the wallpaper changer for SDDM in System Settings
4. Open the dialog and the location into the Location Bar

OBSERVED RESULT
The file picker errors out and complains about a folder being expected.

EXPECTED RESULT
The file picker shows the parent folder of the file and selects the specified file, ready to open that as the chosen file.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon
KDE Plasma Version: 5.25.90
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
I noticed that the Location bar automatically appends '/' to the end of the location supplied. E.g. /path/to/image.png became /path/to/image.png/
Comment 1 Bug Janitor Service 2022-12-21 14:04:13 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1090
Comment 2 Fushan Wen 2022-12-31 15:35:55 UTC
Git commit ed569eccd4a7dffc737a64beb878b0588dba98e7 by Fushan Wen.
Committed on 31/12/2022 at 14:00.
Pushed by fusionfuture into branch 'master'.

kdiroperator: fix full file path not being stripped

QDir::isReadable always returns true for an unknown path if the
parent folder is readable, so use QFileInfo::isReadable instead.

Need to use QUrl::StripTrailingSlash and QUrl::RemoveFilename separately
since in QUrlPrivate::appendPath, QUrl::RemoveFilename is done before
QUrl::StripTrailingSlash.
FIXED-IN: 5.102

M  +22   -0    autotests/kdiroperatortest.cpp
M  +8    -2    src/filewidgets/kdiroperator.cpp

https://invent.kde.org/frameworks/kio/commit/ed569eccd4a7dffc737a64beb878b0588dba98e7