From: Claudio Cambra Date: Wed, 5 Jul 2023 15:44:45 +0000 (+0800) Subject: Ensure newly whitelisted or blacklisted paths are removed from undecided list X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~92^2^2~57^2~26 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5f250a5dad3fbe709488e271f4692c05f3984264;p=nextcloud-desktop.git Ensure newly whitelisted or blacklisted paths are removed from undecided list Signed-off-by: Claudio Cambra --- diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 81c63dc56..dd246f109 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -856,14 +856,29 @@ void Folder::appendPathToSelectiveSyncList(const QString &path, const SyncJourna } } +void Folder::removePathFromSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType) +{ + const auto folderPath = trailingSlashPath(path); + const auto journal = journalDb(); + auto ok = false; + auto list = journal->getSelectiveSyncList(listType, &ok); + + if (ok) { + list.removeAll(folderPath); + journal->setSelectiveSyncList(listType, list); + } +} + void Folder::whitelistPath(const QString &path) { appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncWhiteList); + removePathFromSelectiveSyncList(path, SyncJournalDb::SelectiveSyncUndecidedList); } void Folder::blacklistPath(const QString &path) { appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncBlackList); + removePathFromSelectiveSyncList(path, SyncJournalDb::SelectiveSyncUndecidedList); } bool Folder::isFileExcludedAbsolute(const QString &fullPath) const diff --git a/src/gui/folder.h b/src/gui/folder.h index 5ffbde52d..821f90716 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -472,6 +472,7 @@ private: void correctPlaceholderFiles(); void appendPathToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType); + void removePathFromSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType); AccountStatePtr _accountState; FolderDefinition _definition;