Bug 194900 - KFileDialog.getSaveUrl places last part of startDir parameter also in filename field
Summary: KFileDialog.getSaveUrl places last part of startDir parameter also in filenam...
Status: RESOLVED FIXED
Alias: None
Product: kfile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-01 19:56 UTC by Wilbert Berendsen
Modified: 2009-07-02 16:52 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
The dialog yielded by the above statement (37.95 KB, image/png)
2009-06-01 19:58 UTC, Wilbert Berendsen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wilbert Berendsen 2009-06-01 19:56:42 UTC
Version:            (using KDE 4.2.2)
OS:                Linux
Installed from:    Ubuntu Packages

When I call KFileDialog.setSaveUrl (and the other save dialogs in KFileDialog and KEncodingFileDialog) with a directory in the startDir parameter, the dialog is displayed with in the specified directory (which is OK), but also with the name of the directory (i.e. the last part of the given path) in the Name entry field (which is not Ok).

I would expect the Name field to be empty, and with keyboard focus, like the different open dialogs do.

This happens whether or not I append a slash to the directory. Example (typed from Python):

>>> from PyKDE4.kio import *
>>> KFileDialog.getSaveFileName(KUrl('/home/wilbert/test/'))
Comment 1 Wilbert Berendsen 2009-06-01 19:58:17 UTC
Created attachment 34174 [details]
The dialog yielded by the above statement

The Name field displays 'test', but should be empty.
Comment 2 Jonathan Marten 2009-06-08 12:24:04 UTC
Patch submitted at http://reviewboard.kde.org/r/803/
Comment 3 Wilbert Berendsen 2009-06-08 13:34:26 UTC
Great! Does this patch also fix the same issue in the KEncodingFileDialog class? (this exhibits the same problem as the regular KFileDialog).

btw the python example wasn't complete: of course one should also create a KApplication() before the example will work :-)
Comment 4 Jonathan Marten 2009-06-08 14:06:46 UTC
Regarding comment #3: the save cases of KEncodingFileDialog also use setSelection and so may well have the same problem.  I'll update the patch to also simplify those - there is no need to handle the startDir parameter specially.
Comment 5 Jonathan Marten 2009-07-02 16:52:37 UTC
SVN commit 990505 by marten:

Handle the cases where a directory (without filename) is passed to one of the
KFileDialog::getSaveFile* functions.  Don't handle the startDir parameter to these
(or any other of the static functions) in any way specially, just pass it straight
in to the constructor.  This and KFileWidget will take care of parsing and
checking the parameter.

Ensure that the KFile::LocalOnly option is set for the getSaveFile* functions.
Removed kWarning() for a non-local file in these - if anything is to be done
about non-local files then it should be in KFileWidget.

Also pass the parameter straight through for the KEncodingFileDialog static functions.

Reviewed at http://reviewboard.kde.org/r/803/

BUG:194900


 M  +2 -9      kencodingfiledialog.cpp  
 M  +28 -46    kfiledialog.cpp  
 M  +58 -7     tests/kfiledialogtest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=990505