Review Request: Correctly handle the cases where a directory (without filename) is passed to KFileDialog::getSave*

Jonathan Marten jjm at
Mon Jun 8 13:28:25 BST 2009

This is an automatically generated e-mail. To reply, visit:

(Updated 2009-06-08 05:28:24.761575)

Review request for kdelibs.


Also simplify the two save cases in KEncodingFileDialog by simply passing the 'dir' parameter to KFileDialog - there is no need to treat it specially here.


Fix bug 194900 by simplifying the code in KFileDialog.  For the getSaveFileName/getSaveUrl cases, this originally used to create a KFileDialog and then used setSelection() on it to set the starting location and/or initial file name.  Doing this seems to always insert the basename of the setSelection() argument into the file name field of the dialogue - even if it is not present or is a directory.

Now the starting or special directory is passed directly to the KFileDialog constructor, which handles the cases where this is a directory correctly.  (The KFileWidget constructor does a KIO::stat() to check the filename/path, and decides what to do based on that).  This simplifies the code in KFileDialog too.

Extend the test cases (tests/kfiledialogtest.cpp) to check for these cases.  Since this test has grown quite a bit, add a caption to the dialogue of each sub-test to indicate what is being tested.

This addresses bug 194900.

Diffs (updated)

  /trunk/KDE/kdelibs/kio/kfile/kencodingfiledialog.cpp 977959 
  /trunk/KDE/kdelibs/kio/kfile/kfiledialog.cpp 977959 
  /trunk/KDE/kdelibs/kio/kfile/tests/kfiledialogtest.cpp 977959 



Checked operation of the file dialogue using the test case and the code in the bug report, correct operation observed.



More information about the kde-core-devel mailing list