Bug 309221

Summary: kfiledialog screws up urls when mode is set to Directory|Files
Product: [Unmaintained] kfile Reporter: Edward Hades <edward.hades>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: amarok-bugs-dist, cfeck, nate
Priority: NOR Keywords: testcase, triaged
Version: 4.8.5   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Edward Hades 2012-10-29 21:52:04 UTC
Hi,

In general KFileDialog accepts URLs without problems (try opening a http://some/picture.jpg in gwenview). However, if you set mode to KFile::Directory|KFile::Files, it will screw up the URL.

Reproducible: Always

Steps to Reproduce:
Consider the following code:

====x cut here x========
#include <KAboutData>
#include <KApplication>
#include <KCmdLineArgs>
#include <KFileDialog>
#include <KMessageBox>

int main(int argc, char* argv[])
{
    KCmdLineArgs::init(argc, argv, new KAboutData("", "", KLocalizedString(), ""));
    KApplication app;

    {
    KFileDialog dlg(KUrl("/"), "*.*|", 0);
    dlg.exec();

    KMessageBox::information(0, dlg.selectedUrl().prettyUrl());
    }

    {
    KFileDialog dlg(KUrl("/"), "*.*|", 0);
    dlg.setMode(KFile::Files | KFile::Directory);
    dlg.exec();

    KMessageBox::information(0, dlg.selectedUrl().prettyUrl());
    }

    return 0;
}
====x cut here x========

Compile it, run, and input "http://localhost" in the file dialogs that will come up.
Actual Results:  
At first it shows "http://localhost", then it shows "file:///http:/localhost".

Expected Results:  
Show "http://localhost" both times.

Note the curly braces around the KFileDialog invokation. If you remove them, the result is even weirder: "http://localhost/http:/localhost", which hints somehow, that at some point previous URL is being prepended.
Comment 1 Nate Graham 2018-04-10 20:02:32 UTC
Is this still reproducible with the KDE Frameworks 5 version?
Comment 2 Andrew Crouthamel 2018-09-28 03:20:48 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Andrew Crouthamel 2018-10-29 02:11:18 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!