Bug 102972

Summary: Handle overwrite request in the file dialog itself; don't leave it up to the parent app
Product: [Frameworks and Libraries] frameworks-kio Reporter: Sebastien <slaout>
Component: Open/save dialogsAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: wishlist CC: alpeterson, binner, bugseforuns, esigra, kdelibs-bugs, monstermunch, nate, simonandric5
Priority: NOR Keywords: junior-jobs, usability
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 267749    

Description Sebastien 2005-04-01 01:01:07 UTC
Version:            (using KDE KDE 3.4.0)

When using KFileDialog to get a save url or file, if the user select an existing file the save dialog don't show a confirmation message to ask me if I want to overwrite the existing file or not.

Perhapse I haven't searched enouth (because it's strange KDE doesn't provide such parameter), but I haven't found any parameter to ask confirmation.

So, it's what I do:

    KURL url;
    bool tryAgain = true;
    while (tryAgain)
    {
        url = KFileDialog::getSaveURL();

        if (url.isEmpty())
        {
            tryAgain = false;
        }

        if (!KIO::NetAccess::exists(url, true, this) ||
            KMessageBox::warningYesNo(this, "<qt>" + i18n("The file <strong>%1</strong> already exists. Do you wish to overwrite it?").arg(url.prettyURL()) + "</qt>", i18n("File Exists")) == KMessageBox::Yes)
        {
            tryAgain = false;
        }
    }

Very heavy to do this, and the message can to not be the same as in other applications.
Can this feature be integrated into the dialogs?
At least as an optional parameter.
It will allow to have consistent messages, and it will allow programers to not reinvent the wheel.
Comment 1 Christian Loose 2005-06-11 12:13:09 UTC
*** Bug 92034 has been marked as a duplicate of this bug. ***
Comment 2 Christian Loose 2005-06-11 12:18:18 UTC
This feature is really needed, because IMHO it doesn't make sense that for every small feature where a file is saved, the programmer has to write his own override file test. 

Please also see Bug 107201.
Comment 3 Christian Loose 2005-07-29 15:56:42 UTC
*** Bug 109778 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Feck 2009-08-27 02:36:17 UTC
Moving from "kio/kfile" component to "kfile" product, helps sorting out duplicates.
Comment 5 Nate Graham 2018-04-11 20:45:32 UTC
*** Bug 318749 has been marked as a duplicate of this bug. ***
Comment 6 Nate Graham 2018-04-11 20:45:36 UTC
*** Bug 291204 has been marked as a duplicate of this bug. ***
Comment 7 Nate Graham 2018-04-11 20:46:42 UTC
*** Bug 146806 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2018-05-10 13:08:40 UTC
This was already fixed some time ago. Some individual apps (such as Kate) may still try to handle overwrite themselves; we'll be fixing those soon.