diff --git a/src/core/copyjob.cpp b/src/core/copyjob.cpp --- a/src/core/copyjob.cpp +++ b/src/core/copyjob.cpp @@ -483,7 +483,10 @@ if (srcurl.isLocalFile()) { const QString parentDir = srcurl.adjusted(QUrl::StripTrailingSlash).toLocalFile(); - m_parentDirs.insert(parentDir); + if (!m_parentDirs.contains(parentDir)) { + KDirWatch::self()->removeDir(parentDir); + m_parentDirs.insert(parentDir); + } } m_bCurrentSrcIsDir = true; // used by slotEntries @@ -524,7 +527,10 @@ if (srcurl.isLocalFile()) { const QString parentDir = srcurl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).path(); - m_parentDirs.insert(parentDir); + if (!m_parentDirs.contains(parentDir)) { + KDirWatch::self()->removeDir(parentDir); + m_parentDirs.insert(parentDir); + } } statNextSrc(); @@ -897,7 +903,7 @@ if (m_currentSrcURL.isLocalFile()) { const QString parentDir = m_currentSrcURL.adjusted(QUrl::RemoveFilename).path(); if (!m_parentDirs.contains(parentDir)) { - KDirWatch::self()->stopDirScan(parentDir); + KDirWatch::self()->removeDir(parentDir); m_parentDirs.insert(parentDir); } } @@ -1239,16 +1245,6 @@ } else { // we have finished creating dirs q->setProcessedAmount(KJob::Directories, m_processedDirs); // make sure final number appears - if (m_mode == CopyJob::Move) { - // Now we know which dirs hold the files we're going to delete. - // To speed things up and prevent double-notification, we disable KDirWatch - // on those dirs temporarily (using KDirWatch::self, that's the instanced - // used by e.g. kdirlister). - for (QSet::const_iterator it = m_parentDirs.constBegin(); it != m_parentDirs.constEnd(); ++it) { - KDirWatch::self()->stopDirScan(*it); - } - } - state = STATE_COPYING_FILES; m_processedFiles++; // Ralf wants it to start at 1, not 0 copyNextFile(); @@ -1768,7 +1764,7 @@ // Re-enable watching on the dirs that held the deleted/moved files if (d->m_mode == CopyJob::Move) { for (QSet::const_iterator it = d->m_parentDirs.constBegin(); it != d->m_parentDirs.constEnd(); ++it) { - KDirWatch::self()->restartDirScan(*it); + KDirWatch::self()->addDir(*it); } } Job::emitResult(); diff --git a/src/core/deletejob.cpp b/src/core/deletejob.cpp --- a/src/core/deletejob.cpp +++ b/src/core/deletejob.cpp @@ -268,7 +268,7 @@ // used by e.g. kdirlister). const QSet::const_iterator itEnd = m_parentDirs.constEnd(); for (QSet::const_iterator it = m_parentDirs.constBegin(); it != itEnd; ++it) { - KDirWatch::self()->stopDirScan(*it); + KDirWatch::self()->removeDir(*it); } state = DELETEJOB_STATE_DELETING_FILES; deleteNextFile(); @@ -371,7 +371,7 @@ { const auto itEnd = m_parentDirs.constEnd(); for (auto it = m_parentDirs.constBegin(); it != itEnd; ++it) { - KDirWatch::self()->restartDirScan(*it); + KDirWatch::self()->addDir(*it); } } @@ -386,7 +386,7 @@ // We are about to delete this dir, no need to watch it // Maybe we should ask kdirwatch to remove all watches recursively? // But then there would be no feedback (things disappearing progressively) during huge deletions - KDirWatch::self()->stopDirScan(url.adjusted(QUrl::StripTrailingSlash).toLocalFile()); + KDirWatch::self()->removeDir(url.adjusted(QUrl::StripTrailingSlash).toLocalFile()); } if (!KProtocolManager::canDeleteRecursive(url)) { //qDebug() << url << "is a directory, let's list it";