diff -urNr desktop-2.5.2-orig/src/gui/folderwatcher.cpp desktop-2.5.2/src/gui/folderwatcher.cpp --- desktop-2.5.2-orig/src/gui/folderwatcher.cpp 2019-03-19 02:52:24.000000000 +0100 +++ desktop-2.5.2/src/gui/folderwatcher.cpp 2019-05-10 09:53:53.861934327 +0200 @@ -75,9 +75,28 @@ return _isReliable; } + +void FolderWatcher::appendSubPaths(QDir dir, QStringList& subPaths) { + QStringList newSubPaths = dir.entryList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files); + for (int i = 0; i < newSubPaths.size(); i++) { + QString path = dir.path() + "/" + newSubPaths[i]; + QFileInfo fileInfo(path); + subPaths.append(path); + if (fileInfo.isDir()) { + QDir dir(path); + appendSubPaths(dir, subPaths); + } + } +} + void FolderWatcher::changeDetected(const QString &path) { + QFileInfo fileInfo(path); QStringList paths(path); + if (fileInfo.isDir()) { + QDir dir(path); + appendSubPaths(dir, paths); + } changeDetected(paths); } diff -urNr desktop-2.5.2-orig/src/gui/folderwatcher.h desktop-2.5.2/src/gui/folderwatcher.h --- desktop-2.5.2-orig/src/gui/folderwatcher.h 2019-03-19 02:52:24.000000000 +0100 +++ desktop-2.5.2/src/gui/folderwatcher.h 2019-05-10 09:56:15.063411278 +0200 @@ -26,6 +26,7 @@ #include #include #include +#include class QTimer; @@ -120,6 +121,8 @@ Folder *_folder; bool _isReliable = true; + void appendSubPaths(QDir dir, QStringList& subPaths); + friend class FolderWatcherPrivate; }; } diff -urNr desktop-2.5.2-orig/test/testfolderwatcher.cpp desktop-2.5.2/test/testfolderwatcher.cpp --- desktop-2.5.2-orig/test/testfolderwatcher.cpp 2019-03-19 02:52:24.000000000 +0100 +++ desktop-2.5.2/test/testfolderwatcher.cpp 2019-05-10 09:57:51.453556579 +0200 @@ -140,6 +140,16 @@ QVERIFY(waitForPathChanged(file)); } + void testMove3LevelDirWithFile() { + QString file(_rootPath + "/a0/b/c/empty.txt"); + mkdir(_rootPath + "/a0"); + mkdir(_rootPath + "/a0/b"); + mkdir(_rootPath + "/a0/b/c"); + touch(file); + mv(_rootPath + "/a0 ", _rootPath + "/a"); + QVERIFY(waitForPathChanged(_rootPath + "/a/b/c/empty.txt")); + } + void testCreateADir() { QString file(_rootPath+"/a1/b1/new_dir"); mkdir(file);