report_error_removing_dirs
authorDebian/Kubuntu Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 31 Mar 2016 13:38:43 +0000 (15:38 +0200)
committerNorbert Preining <norbert@preining.info>
Thu, 15 Jul 2021 01:20:01 +0000 (02:20 +0100)
===================================================================

Gbp-Pq: Name report_error_removing_dirs

src/core/copyjob.cpp

index 2420a8d3851b7d5bf34b42782d3cd084dc08d8d9..7e71e4b97fd418b3b44edf9e83f19a38624f933b 100644 (file)
@@ -152,6 +152,7 @@ public:
         , m_bOverwriteAllDirs(false)
         , m_bOverwriteWhenOlder(false)
         , m_conflictError(0)
+        , m_dirsFailedError(0)
         , m_reportTimer(nullptr)
     {
     }
@@ -208,6 +209,8 @@ public:
     bool m_bOverwriteAllDirs;
     bool m_bOverwriteWhenOlder;
     int m_conflictError;
+    int m_dirsFailedError;
+    QString m_dirsFailedErrorText;
 
     QTimer *m_reportTimer;
 
@@ -1905,6 +1908,10 @@ void CopyJobPrivate::setNextDirAttribute()
             m_reportTimer->stop();
         }
 
+        if (m_dirsFailedError) {
+            q->setError(m_dirsFailedError);
+            q->setErrorText(m_dirsFailedErrorText);
+        }
         q->emitResult();
     }
 }
@@ -1972,12 +1979,14 @@ void CopyJobPrivate::slotTotalSize(KJob *, qulonglong size)
 void CopyJobPrivate::slotResultDeletingDirs(KJob *job)
 {
     Q_Q(CopyJob);
+    const QUrl url = static_cast<KIO::SimpleJob *>(job)->url();
     if (job->error()) {
-        // Couldn't remove directory. Well, perhaps it's not empty
-        // because the user pressed Skip for a given file in it.
-        // Let's not display "Could not remove dir ..." for each of those dir !
+        m_dirsFailedError = job->error();
+        m_dirsFailedErrorText = job->errorText();
+        // Remove the parents
+        skip(url, true);
     } else {
-        m_successSrcList.append(static_cast<KIO::SimpleJob *>(job)->url());
+        m_successSrcList.append(url);
     }
     q->removeSubjob(job);
     Q_ASSERT(!q->hasSubjobs());