Save file dialog: "Overwrite file" behaviour/implementation.

David Jarvie djarvie at
Wed Jun 10 10:30:55 BST 2009

On Monday 8 June 2009 1:37, Michael Leupold wrote:
> George Kiagiadakis wrote:
>> Adding a new argument to the existing static KFIleDialog::getSave*
>> functions is binary incompatible afaik, but instead of doing this,
>> maybe we should change the default behavior of those functions to ask
>> before overwriting files.
>> I'll explain a bit better the problem for people that have not
>> understood. Currently those functions return a file name without
>> checking if it exists or not and without asking the user if he wants
>> to overwrite it, which leads application developers to implement a
>> "confirm overwrite" dialog, which may differ in behavior in each
>> application and possibly cause usability issues like the one in bug
>> 185590. However, KFileDialog does have support for confirming
>> overwrite, but to use this feature you need to abandon the very
>> convenient static methods and construct a KFileDialog object manually
>> and call dialog->setConfirmOverwrite(true);
>> My suggestion here is to make this the default for the static methods,
>> which is something that probably most applications will want to have.
>> Of course this creates the problem that every application that uses a
>> custom confirm overwrite dialog will have to remove it, but it will be
>> difficult to track down all apps that do that. So, another option
>> would be to add new overloaded static methods that have the option to
>> ask for overwrite and suggest application developers to to use these
>> methods instead.
>> What do you think?
> I'd go with the latter and suggest using the new method. I fear changing
> the
> default behaviour is a no-no as it will lead to unexpected behaviour (eg.
> asking the user twice because the application-defined overwrite
> confirmation
> is still there and the static method still only return the name of an
> existing file). Apart from that the idea sounds necessary and sane.

I developed a patch for this recently - I'll submit it on reviewboard.

David Jarvie.
KAlarm author & maintainer.

More information about the kde-core-devel mailing list