diff --git a/changelog/unreleased/7336 b/changelog/unreleased/7336 new file mode 100644 index 0000000000..2ceeeffbab --- /dev/null +++ b/changelog/unreleased/7336 @@ -0,0 +1,6 @@ +Bugfix: Expand file tree also when no folders are synced + +We have fixed the behaviour of the folder Widget, +when a account was added and none of its folders was selected to be synced, the tree was not expanded. + +https://github.com/owncloud/client/issues/7336 diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 5484eec3a9..cd3c6c1467 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -589,6 +589,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"); @@ -1090,10 +1097,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)); } } @@ -1200,7 +1204,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 dc451f1e5a..8c59a42880 100644 --- a/src/gui/folderstatusmodel.h +++ b/src/gui/folderstatusmodel.h @@ -52,6 +52,7 @@ public: QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE; bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; + void resetAndFetch(const QModelIndex &parent); bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; struct SubFolderInfo