From: Hannah von Reth Date: Tue, 4 Feb 2020 14:35:14 +0000 (+0100) Subject: Fix expansion of tree view on newly added accounts X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~133 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=13c9d6431d3b9f50a2f85640b6eb530659b4baad;p=nextcloud-desktop.git Fix expansion of tree view on newly added accounts The change is based on 97ce20ac028660e6ae3dd0b98d4b487999d8768a I removed a few lines of code there which are already part of fetchMore() Fixes: #7336 --- diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 1d743f80f..ee26988dd 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -600,6 +600,13 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent) QTimer::singleShot(1000, this, &FolderStatusModel::slotShowFetchProgress); } +void FolderStatusModel::resetAndFetch(const QModelIndex &parent) +{ + auto info = infoForIndex(parent); + info->resetSubs(this, parent); + fetchMore(parent); +} + void FolderStatusModel::slotGatherPermissions(const QString &href, const QMap &map) { auto it = map.find("permissions"); @@ -1103,10 +1110,7 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f) if (f->syncResult().folderStructureWasChanged() && (state == SyncResult::Success || state == SyncResult::Problem)) { // There is a new or a removed folder. reset all data - auto &info = _folders[folderIndex]; - auto idx = index(folderIndex); - info.resetSubs(this, idx); - fetchMore(idx); + resetAndFetch(index(folderIndex)); } } @@ -1211,7 +1215,7 @@ void FolderStatusModel::slotNewBigFolder() return; } - _folders[folderIndex].resetSubs(this, index(folderIndex)); + resetAndFetch(index(folderIndex)); emit suggestExpand(index(folderIndex)); emit dirtyChanged(); diff --git a/src/gui/folderstatusmodel.h b/src/gui/folderstatusmodel.h index 63c8d4333..a4248a6f5 100644 --- a/src/gui/folderstatusmodel.h +++ b/src/gui/folderstatusmodel.h @@ -54,6 +54,7 @@ public: QModelIndex parent(const QModelIndex &child) const override; bool canFetchMore(const QModelIndex &parent) const override; void fetchMore(const QModelIndex &parent) override; + void resetAndFetch(const QModelIndex &parent); bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; struct SubFolderInfo