mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-23 13:35:58 +03:00
Selective sync: When applying selective sync, put new folder that were just checked in the white list
Issue #3560 Otherwise the just checked folder will be chacked again for their size. We do not want that.
This commit is contained in:
parent
8b52a121bb
commit
ae7b2509a5
1 changed files with 8 additions and 9 deletions
|
@ -566,13 +566,14 @@ void FolderStatusModel::slotApplySelectiveSync()
|
||||||
QStringList blackList = createBlackList(&_folders[i], oldBlackList);
|
QStringList blackList = createBlackList(&_folders[i], oldBlackList);
|
||||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
|
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, blackList);
|
||||||
|
|
||||||
// The folders that were undecided should be part of the white list if they are not in the blacklist
|
auto blackListSet = blackList.toSet();
|
||||||
QStringList toAddToWhiteList;
|
auto oldBlackListSet = oldBlackList.toSet();
|
||||||
foreach (const auto &undec, folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList)) {
|
|
||||||
if (!blackList.contains(undec)) {
|
// The folders that were undecided or blacklisted and that are now checked should go on the white list.
|
||||||
toAddToWhiteList.append(undec);
|
// The user confirmed them already just now.
|
||||||
}
|
QStringList toAddToWhiteList = ((oldBlackListSet + folder->journalDb()->getSelectiveSyncList(
|
||||||
}
|
SyncJournalDb::SelectiveSyncUndecidedList).toSet()) - blackListSet).toList();
|
||||||
|
|
||||||
if (!toAddToWhiteList.isEmpty()) {
|
if (!toAddToWhiteList.isEmpty()) {
|
||||||
auto whiteList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
|
auto whiteList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
|
||||||
whiteList += toAddToWhiteList;
|
whiteList += toAddToWhiteList;
|
||||||
|
@ -582,8 +583,6 @@ void FolderStatusModel::slotApplySelectiveSync()
|
||||||
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
|
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
|
||||||
|
|
||||||
// do the sync if there was changes
|
// do the sync if there was changes
|
||||||
auto blackListSet = blackList.toSet();
|
|
||||||
auto oldBlackListSet = oldBlackList.toSet();
|
|
||||||
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
|
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
if (folder->isBusy()) {
|
if (folder->isBusy()) {
|
||||||
|
|
Loading…
Reference in a new issue