From 8154e50c982c7cf605dfd9102aaba51d29933a18 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Tue, 4 Feb 2020 15:35:14 +0100 Subject: [PATCH] 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 --- changelog/unreleased/7336 | 6 ++++++ src/gui/folderstatusmodel.cpp | 14 +++++++++----- src/gui/folderstatusmodel.h | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/7336 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