Commit f15bb39e authored by Yuri Chornoivan's avatar Yuri Chornoivan Committed by Laurent Montel
Browse files

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

(cherry picked from commit 28ab73bc)
parent 51e3b13b
......@@ -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 <filename>%1</filename> exists.<nl/>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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment