]> cloud.milkyroute.net Git - dolphin.git/commitdiff
DolphinView: display errorMessage when copy errors occurs
authorMéven Car <meven@kde.org>
Sun, 29 Jun 2025 09:20:44 +0000 (11:20 +0200)
committerMéven Car <meven@kde.org>
Wed, 2 Jul 2025 08:36:35 +0000 (08:36 +0000)
when copying multiple files.

CopyJob skip those by default (CopyJobPrivate::slotSubError), and emits warning.
Hook this to errorMessage.

We would need to improve this as only the last error Message will be
visible.

BUG: 506282

src/views/dolphinview.cpp

index 9bbdc3b10e9572fba0e0ff49f280ead6454c043c..e8577e066366e7173d609f99edca9265cffa1b4f 100644 (file)
@@ -846,6 +846,9 @@ void DolphinView::copySelectedItems(const KFileItemList &selection, const QUrl &
     connect(job, &KIO::CopyJob::result, this, &DolphinView::slotJobResult);
     connect(job, &KIO::CopyJob::copying, this, &DolphinView::slotItemCreatedFromJob);
     connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotItemCreatedFromJob);
+    connect(job, &KIO::CopyJob::warning, this, [](KJob *job, const QString &warning) {
+        Q_EMIT errorMessage(job->errorString(), job->error());
+    });
     KIO::FileUndoManager::self()->recordCopyJob(job);
 }
 
@@ -865,6 +868,9 @@ void DolphinView::moveSelectedItems(const KFileItemList &selection, const QUrl &
     connect(job, &KIO::CopyJob::result, this, &DolphinView::slotJobResult);
     connect(job, &KIO::CopyJob::moving, this, &DolphinView::slotItemCreatedFromJob);
     connect(job, &KIO::CopyJob::copyingDone, this, &DolphinView::slotItemCreatedFromJob);
+    connect(job, &KIO::CopyJob::warning, this, [](KJob *job, const QString &warning) {
+        Q_EMIT errorMessage(job->errorString(), job->error());
+    });
     KIO::FileUndoManager::self()->recordCopyJob(job);
 }