From 28ab73bcf260146e63faae84cb1a895fdfd9820a Mon Sep 17 00:00:00 2001 From: Yuri Chornoivan Date: Sat, 28 Mar 2020 16:08:37 +0200 Subject: [PATCH] Do not ask users if they want to overwrite saved file twice Summary: Qt file dialog already asks if user want the file to be overwritten. Test Plan: 1. Open a message with some link. 2. Right-click on the link and choose "Save link as..." 3. Save the file. 4. Repeat step 2, click "OK". 5. Confirm the file to be overwritten from Qt dialog. 6. Without this patch, a new KMail dialog should appear with another proposal to overwrite the file. Reviewers: #kde_pim, mlaurent Reviewed By: #kde_pim, mlaurent Subscribers: kde-pim Tags: #kde_pim Differential Revision: https://phabricator.kde.org/D28377 --- src/kmcommands.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/kmcommands.cpp b/src/kmcommands.cpp index bdb3fdd31..859482c5a 100644 --- a/src/kmcommands.cpp +++ b/src/kmcommands.cpp @@ -530,23 +530,6 @@ KMCommand::Result KMUrlSaveCommand::execute() KRecentDirs::add(recentDirClass, saveUrl.path()); } - bool fileExists = false; - if (saveUrl.isLocalFile()) { - fileExists = QFile::exists(saveUrl.toLocalFile()); - } else { - auto job = KIO::stat(saveUrl, KIO::StatJob::DestinationSide, 0); - KJobWidgets::setWindow(job, parentWidget()); - fileExists = job->exec(); - } - - if (fileExists) { - if (KMessageBox::warningContinueCancel(nullptr, - xi18nc("@info", "File %1 exists.Do you want to replace it?", - saveUrl.toDisplayString()), i18n("Save to File"), KGuiItem(i18n("&Replace"))) - != KMessageBox::Continue) { - return Canceled; - } - } KIO::Job *job = KIO::file_copy(mUrl, saveUrl, -1, KIO::Overwrite); connect(job, &KIO::Job::result, this, &KMUrlSaveCommand::slotUrlSaveResult); setEmitsCompletedItself(true);