Fix expansion of tree view on newly added accounts
authorHannah von Reth <hannah.vonreth@owncloud.com>
Tue, 4 Feb 2020 14:35:14 +0000 (15:35 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:07 +0000 (10:59 +0100)
The change is based on 97ce20ac028660e6ae3dd0b98d4b487999d8768a

I removed a few lines of code there which are already part of fetchMore()

Fixes: #7336
src/gui/folderstatusmodel.cpp
src/gui/folderstatusmodel.h

index 1d743f80f643d6852b9595ce9a5ab10fc67b3e13..ee26988dd699026db0fe87bffbcca4992083df58 100644 (file)
@@ -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<QString, QString> &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();
index 63c8d433385c812fe46b016abfca0d72124dc418..a4248a6f57793d10d46bf19aad4017eb84894e69 100644 (file)
@@ -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