Bug 309221 - kfiledialog screws up urls when mode is set to Directory|Files
Summary: kfiledialog screws up urls when mode is set to Directory|Files
Status: RESOLVED WORKSFORME
Alias: None
Product: kfile
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.8.5
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords: testcase, triaged
Depends on:
Blocks:
 
Reported: 2012-10-29 21:52 UTC by Edward Hades
Modified: 2018-10-29 02:11 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!