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
This commit is contained in:
Hannah von Reth 2020-02-04 15:35:14 +01:00 committed by Kevin Ottens
parent fdc3b7c8da
commit 13c9d6431d
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 10 additions and 5 deletions

View file

@ -600,6 +600,13 @@ void FolderStatusModel::fetchMore(const QModelIndex &parent)
QTimer::singleShot(1000, this, &FolderStatusModel::slotShowFetchProgress); 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) void FolderStatusModel::slotGatherPermissions(const QString &href, const QMap<QString, QString> &map)
{ {
auto it = map.find("permissions"); auto it = map.find("permissions");
@ -1103,10 +1110,7 @@ void FolderStatusModel::slotFolderSyncStateChange(Folder *f)
if (f->syncResult().folderStructureWasChanged() if (f->syncResult().folderStructureWasChanged()
&& (state == SyncResult::Success || state == SyncResult::Problem)) { && (state == SyncResult::Success || state == SyncResult::Problem)) {
// There is a new or a removed folder. reset all data // There is a new or a removed folder. reset all data
auto &info = _folders[folderIndex]; resetAndFetch(index(folderIndex));
auto idx = index(folderIndex);
info.resetSubs(this, idx);
fetchMore(idx);
} }
} }
@ -1211,7 +1215,7 @@ void FolderStatusModel::slotNewBigFolder()
return; return;
} }
_folders[folderIndex].resetSubs(this, index(folderIndex)); resetAndFetch(index(folderIndex));
emit suggestExpand(index(folderIndex)); emit suggestExpand(index(folderIndex));
emit dirtyChanged(); emit dirtyChanged();

View file

@ -54,6 +54,7 @@ public:
QModelIndex parent(const QModelIndex &child) const override; QModelIndex parent(const QModelIndex &child) const override;
bool canFetchMore(const QModelIndex &parent) const override; bool canFetchMore(const QModelIndex &parent) const override;
void fetchMore(const QModelIndex &parent) override; void fetchMore(const QModelIndex &parent) override;
void resetAndFetch(const QModelIndex &parent);
bool hasChildren(const QModelIndex &parent = QModelIndex()) const override; bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
struct SubFolderInfo struct SubFolderInfo