Fix expansion of tree view on newly added accounts

The change is based on 97ce20ac02

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 Hannah von Reth
parent 57701351f6
commit 8154e50c98
3 changed files with 16 additions and 5 deletions

View File

@ -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

View File

@ -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<QString, QString> &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();

View File

@ -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