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)
committerPeter Michael Green <plugwash@raspbian.org>
Fri, 15 Nov 2024 07:30:48 +0000 (07:30 +0000)
===================================================================

Gbp-Pq: Name report_error_removing_dirs

src/core/copyjob.cpp

index 8822ce4bc7dc42f62514b0dd741af1f753dd0b59..146aa3a17608ddba3883ab90dd0929d1aab93042 100644 (file)
@@ -239,6 +239,7 @@ public:
         , m_bOverwriteAllDirs(false)
         , m_bOverwriteWhenOlder(false)
         , m_conflictError(0)
+        , m_dirsFailedError(0)
         , m_reportTimer(nullptr)
     {
     }
@@ -313,6 +314,8 @@ public:
     };
 
     int m_conflictError;
+    int m_dirsFailedError;
+    QString m_dirsFailedErrorText;
 
     QTimer *m_reportTimer;
 
@@ -2155,6 +2158,10 @@ void CopyJobPrivate::setNextDirAttribute()
             m_reportTimer->stop();
         }
 
+        if (m_dirsFailedError) {
+            q->setError(m_dirsFailedError);
+            q->setErrorText(m_dirsFailedErrorText);
+        }
         q->emitResult();
     }
 }
@@ -2226,12 +2233,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());