Version: (using KDE 4.1.2) Take the following code: KFileDialog dlg( KUrl(QString()), QString("*.*|"), this ); dlg.setMode( KFile::Files ); dlg.exec(); KUrl::List files = dlg.selectedUrls(); This shows a file dialog which allows selecting of files. selectedUrls() returns the selected urls as expected. However, when setting the mode to files or directories: dlg.setMode( KFile::Files | KFile::Directories ); selectedUrls() returns the parent directory of the file which has been selected. Reproducible in KDE 4.1.2 up to 4.2-SVN.
SVN commit 873458 by ereslibre: Test case for bug #173137. I cannot reproduce this issue... For testing the test case, execute kdelibs/kio/kfile/tests/kfiledialogtest and the first dialog is the test case. Select some files... the result is the expected. Maybe the bug report is also very vague... CCBUG: 173137 M +16 -0 kfiledialogtest.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=873458
How is this report vague? I find it crystal clear. It's even got example code.
It doesn't specify if with Files | Directory you get the parent folder url ONLY, the parent folder url AND the selected files...
Sorry, I should have been more specific - Files | Directory returns _only_ the parent directory of the selected files.
Can you please the test case I wrote for this bug ? I cannot reproduce this problem with current trunk.
Okay, whilst running the unit test, I seem to have narrowed down the problem to be more specific! Clicking on a single file in the dialog causes it to pretend to choose the selected file, however returns the parent directory. Selecting a single file in the dialog so that it does not immediately return, and then clicking on the OK button, it seems to return the correct selected file. Can you reproduce this?
Yes, I could now reproduce... see Mark why I meant this report was a bit vague ? I will try to track it down (still fighting with other bug...).
SVN commit 874314 by ereslibre: No need to double connect things. activated() signal is enough. This was getting two times into the slotOK() method, which was returning more than the expected values. BUG: 173137 M +0 -4 kdiroperator.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=874314
SVN commit 1190805 by dfaure: Remove more code so that double-clicking on a file (in double-click mode) doesn't select the file + the dir + the dir again, in KFile::Files | KFile::Directory mode. The activated() signal is indeed enough, no need to do anything about double-click explicitely anywhere. Tested with the "bug 173137" testcase in kfiledialogtest, in single-click and double-click mode, and testing with click + Ok, Key_Enter, double-click. Hope I didn't miss anything. The bug was already marked as fixed, but double-click global setting was probably not tested back then. Reported by xdarklight. CCBUG: 173137 M +0 -39 kdiroperator.cpp M +2 -2 kdiroperator.h M +0 -11 kfilewidget.cpp M +0 -1 kfilewidget.h WebSVN link: http://websvn.kde.org/?view=rev&revision=1190805