From: Olivier Goffart Date: Mon, 17 Aug 2015 10:46:24 +0000 (+0200) Subject: FolderModel: Refresh the tree when new folder are added or removed. #3570 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~1408^2~209 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f0e6864639ee0efc7c5c411e959e9b147f4573f0;p=nextcloud-desktop.git FolderModel: Refresh the tree when new folder are added or removed. #3570 --- 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()