KFileDialog::selectedFile's behaviour

Ingo Klöcker kloecker at kde.org
Wed May 27 22:00:49 BST 2009


On Wednesday 27 May 2009, David Jarvie wrote:
> On Wed, May 27, 2009 3:53 pm, Raphael Kubo da Costa wrote:
> > 2009/5/23 Raphael Kubo da Costa <kubito at gmail.com>:
> >> Hi there,
> >>
> >> When using KFileDialog with setMode(KFile::File),
> >> setOperationMode(KFileDialog::Saving) and passing a default
> >> mimetype to setMimeFilter, the dialog only returns a filename with
> >> extension if the name typed in the input box doesn't correspond to
> >> an existing file.
> >>
> >> So if you have foo and bar in your directory and pass
> >> "application/x-compressed-tar" to setMimeFilter's default
> >> parameter, entering "foobar" in the file name input box will make
> >> selectedFile() return "/path/to/foobar.tar.gz", whereas entering
> >> "foo" will return "/path/to/foo" and completely ignore the default
> >> extension passed, possibly because foo already exists.
> >>
> >> Is this behaviour a feature or a bug? ;)
> >
> > Please don't consider I'm trying to make any kind of pressure here,
> > but I can start working on a fix if it's indeed a bug.
>
> Having encountered this issue already, I'd say it's a bug.

I suppose it's a problem of expectation. Maybe the default filename 
extension should be "appended" (in light grey) to the filename the user 
enters (similar to the automatic (?) completion mode). Then it would be 
obvious to the user what happens if he enters just "foo". The extension 
should vanish when the user enters a dot or when he explicitly requests 
its removal by pressing Delete.

I noticed that very often I'm unsure whether the application will really 
append the extension. Giving visual feedback like described above would 
help me (and probably others) tremendously. Obviously, this would also 
fix the above bug (?) while on the same time making it possible to 
still get "foo" instead of "foo.tar.gz" if one does not want an 
extension.


Regards,
Ingo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090527/efc55a36/attachment.sig>


More information about the kde-core-devel mailing list