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:
Olivier Goffart 2015-08-07 13:36:10 +02:00
parent 8b52a121bb
commit ae7b2509a5

View file

@ -566,13 +566,14 @@ void FolderStatusModel::slotApplySelectiveSync()
QStringList blackList = createBlackList(&_folders[i], oldBlackList);
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
QStringList toAddToWhiteList;
foreach (const auto &undec, folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList)) {
if (!blackList.contains(undec)) {
toAddToWhiteList.append(undec);
}
}
auto blackListSet = blackList.toSet();
auto oldBlackListSet = oldBlackList.toSet();
// The folders that were undecided or blacklisted and that are now checked should go on the white list.
// The user confirmed them already just now.
QStringList toAddToWhiteList = ((oldBlackListSet + folder->journalDb()->getSelectiveSyncList(
SyncJournalDb::SelectiveSyncUndecidedList).toSet()) - blackListSet).toList();
if (!toAddToWhiteList.isEmpty()) {
auto whiteList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList);
whiteList += toAddToWhiteList;
@ -582,8 +583,6 @@ void FolderStatusModel::slotApplySelectiveSync()
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, QStringList());
// do the sync if there was changes
auto blackListSet = blackList.toSet();
auto oldBlackListSet = oldBlackList.toSet();
auto changes = (oldBlackListSet - blackListSet) + (blackListSet - oldBlackListSet);
if (!changes.isEmpty()) {
if (folder->isBusy()) {