From f0e6864639ee0efc7c5c411e959e9b147f4573f0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 17 Aug 2015 12:46:24 +0200 Subject: [PATCH] FolderModel: Refresh the tree when new folder are added or removed. #3570 --- src/gui/folderstatusmodel.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index da41de0ba..3e13c5434 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -797,6 +797,23 @@ void FolderStatusModel::slotFolderSyncStateChange() // update the icon etc. now slotUpdateFolderState(f); + + if (state == SyncResult::Success) { + foreach (const SyncFileItemPtr &i, f->syncResult().syncFileItemVector()) { + if (i->_isDirectory && (i->_instruction == CSYNC_INSTRUCTION_NEW + || i->_instruction == CSYNC_INSTRUCTION_REMOVE)) { + // There is a new or a removed folder. reset all data + _folders[folderIndex]._fetched = false; + _folders[folderIndex]._fetching = false; + if (!_folders.at(folderIndex)._subs.isEmpty()) { + beginRemoveRows(index(folderIndex), 0, _folders.at(folderIndex)._subs.count() - 1); + _folders[folderIndex]._subs.clear(); + endRemoveRows(); + } + return; + } + } + } } void FolderStatusModel::resetFolders() -- 2.30.2