From d48e1e733146e4fc9c6580de18f064ead7b2ecbf Mon Sep 17 00:00:00 2001 From: birkeh Date: Wed, 6 Mar 2019 22:56:19 +0100 Subject: [PATCH] cleanup folder tree --- cmainwindow.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmainwindow.cpp b/cmainwindow.cpp index c6328cb..57d8ee1 100644 --- a/cmainwindow.cpp +++ b/cmainwindow.cpp @@ -240,6 +240,23 @@ void cMainWindow::cleanFolderTree(const QString& folder) if(m_pictureList.hasPath(lpItem->data(Qt::UserRole+2).toString())) break; + + if(indexSource.child(0, 0).isValid()) + break; + } + + QDir dir; + szFolder = m_pictureLibrary.rootPath() + "/" + folder; + + while(szFolder.length() > m_pictureLibrary.rootPath().length()) + { + dir.setPath(szFolder); + if(dir.isEmpty()) + dir.rmdir(szFolder); + else + break; + + szFolder = szFolder.left(szFolder.lastIndexOf("/")); } }