From 573fc54be3aae345bc5925ac5f31f1550d93a683 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Wed, 24 Aug 2022 17:00:01 +0200 Subject: [PATCH] Don't show error message on ERR_USER_CANCELED There's no point telling the user what they just did. After https://invent.kde.org/frameworks/kio/-/commit/f192c133eb01bc8448d5ddd97fe20f8e6dbc467d this error has a text associated with it, so it might show up in the UI. (cherry picked from commit a44830c3a9f954c376d21d4526d94c26d19d010c) --- src/dolphinnewfilemenu.cpp | 2 +- src/panels/folders/folderspanel.cpp | 6 +++++- src/panels/places/placespanel.cpp | 6 +++++- src/views/dolphinview.cpp | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/dolphinnewfilemenu.cpp b/src/dolphinnewfilemenu.cpp index f83beccdaf..9b6b53b2e6 100644 --- a/src/dolphinnewfilemenu.cpp +++ b/src/dolphinnewfilemenu.cpp @@ -24,7 +24,7 @@ DolphinNewFileMenu::~DolphinNewFileMenu() void DolphinNewFileMenu::slotResult(KJob* job) { - if (job->error()) { + if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { Q_EMIT errorMessage(job->errorString()); } else { KNewFileMenu::slotResult(job); diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index d3d8b81f14..d9cc6128c4 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -255,7 +255,11 @@ void FoldersPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* eve KIO::DropJob *job = DragAndDropHelper::dropUrls(destItem.mostLocalUrl(), &dropEvent, this); if (job) { - connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) Q_EMIT errorMessage(job->errorString()); }); + connect(job, &KIO::DropJob::result, this, [this](KJob *job) { + if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { + Q_EMIT errorMessage(job->errorString()); + } + }); } } } diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 38dc4dc3a6..26f264462b 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -173,7 +173,11 @@ void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* { KIO::DropJob *job = DragAndDropHelper::dropUrls(dest, event, parent); if (job) { - connect(job, &KIO::DropJob::result, this, [this](KJob *job) { if (job->error()) Q_EMIT errorMessage(job->errorString()); }); + connect(job, &KIO::DropJob::result, this, [this](KJob *job) { + if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { + Q_EMIT errorMessage(job->errorString()); + } + }); } } diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 594889b1e1..e7774c9076 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1342,7 +1342,7 @@ void DolphinView::slotItemCreated(const QUrl& url) void DolphinView::slotJobResult(KJob *job) { - if (job->error()) { + if (job->error() && job->error() != KIO::ERR_USER_CANCELED) { Q_EMIT errorMessage(job->errorString()); } if (!m_selectedUrls.isEmpty()) {