Bug 369216 - kdialog path parsing regression
Summary: kdialog path parsing regression
Status: RESOLVED FIXED
Alias: None
Product: kdialog
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Brad Hards
URL:
Keywords:
: 373721 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-09-23 01:47 UTC by Paul
Modified: 2017-01-13 00:47 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul 2016-09-23 01:47:47 UTC
kdialog --getsavefilename /path/to/newfile.ext
no longer starts in the supplied directory, but always uses a default (for me ~/Documents)
kdialog --getsavefilename file:///path/to/newfile.ext
still works, but chromium is not that smart.
This regression resulted from the recent commit REVIEW:128639
Code which prepended "file://" to the path was removed as it is not cross-platform.
I believe QUrl::fromUserInput is doing the right thing, so I'm not sure where it breaks.


Reproducible: Always

Steps to Reproduce:
1. kdialog --getsavefilename /path/to/newfile.ext
2.
3.

Actual Results:  
Dialog starts in ~/Documents

Expected Results:  
Dialog starts in /path/to

kdialog master, KDE frameworks 5.26, Qt 5.7, ArchLinux.
Comment 1 Burkhard Lück 2016-09-23 06:17:29 UTC
kdialog master, KDE frameworks 5.27, Qt 5.6.1 build from sources works here
Comment 2 Christoph Feck 2016-09-25 01:45:35 UTC
Bug is reproducible with KF5 master and Qt 5.8 branch.

Using
    kdialog --getsavefilename /path/to/
shows the correct folder.

Using
    kdialog --getsavefilename /path/to/filename.ext
shows the correct filename, but the wrong folder ("Home" on my system).
Comment 3 Burkhard Lück 2016-09-25 12:38:58 UTC
Christoph is right here, using his examples I have the same issue
Comment 4 Paul 2016-09-25 20:24:07 UTC
My best guess now is it's in KIO's KFileWidget::setSelection
-     d->setLocationText(QUrl(url));
+    d->setLocationText(urlFromString(url));
since the second last edit to kfilewidget.cpp made that change in another function and it has the affect of prepending file:// to absolute paths on Linux.
Comment 5 Kai Uwe Broulik 2016-12-20 13:45:31 UTC
Paul, I can confirm that this fixes the problem in kdialog for me.
Can you please go to https://phabricator.kde.org/ and submit your patch here for review so it can be included (or commented on by those who know the code better than I ;)
Thanks!
Comment 6 Christoph Feck 2016-12-20 18:11:06 UTC
*** Bug 373721 has been marked as a duplicate of this bug. ***
Comment 7 Kai Uwe Broulik 2016-12-23 09:39:28 UTC
Git commit e62d80b07366bbeb8327a514c3a6be0975787b98 by Kai Uwe Broulik.
Committed on 23/12/2016 at 09:37.
Pushed by broulik into branch 'master'.

[KFileWidget] Use urlFromString instead of QUrl(QString) in setSelection

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

M  +10   -0    autotests/kfilewidgettest.cpp
M  +1    -1    src/filewidgets/kfilewidget.cpp

https://commits.kde.org/kio/e62d80b07366bbeb8327a514c3a6be0975787b98
Comment 8 Peter Petrov 2017-01-13 00:41:10 UTC
In which user-facing release is this fix expected to be included? Apparently it's not part of the just released 16.12.1.
Comment 9 Christoph Feck 2017-01-13 00:44:55 UTC
Peter, you need kio from KF5 version 5.30.0 (the applications and frameworks have independend release schedules).
Comment 10 Peter Petrov 2017-01-13 00:47:59 UTC
Right, sorry for the noise. Didn't notice the fix was in kio (frameworks) instead of kdialog (applications).