diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index efbf46d906f51..cb757a2d6379f 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1259,7 +1259,7 @@ Folder *FolderMan::folderForPath(const QString &path) return it != folders.cend() ? *it : nullptr; } -void FolderMan::whitelistFolderPath(const QString &path) +void FolderMan::addFolderToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType list) { const auto folder = folderForPath(path); if (!folder) { @@ -1268,19 +1268,28 @@ void FolderMan::whitelistFolderPath(const QString &path) const QString folderPath = folder->cleanPath() + QLatin1Char('/'); const auto relPath = path.mid(folderPath.length()); - folder->whitelistPath(relPath); + + switch (list) { + case SyncJournalDb::SelectiveSyncListType::SelectiveSyncWhiteList: + folder->whitelistPath(relPath); + break; + case SyncJournalDb::SelectiveSyncListType::SelectiveSyncBlackList: + folder->blacklistPath(relPath); + break; + default: + Q_UNREACHABLE(); + } } -void FolderMan::blacklistFolderPath(const QString &path) +void FolderMan::whitelistFolderPath(const QString &path) { - const auto folder = folderForPath(path); - if (!folder) { - return; - } + addFolderToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncListType::SelectiveSyncWhiteList); +} - const QString folderPath = folder->cleanPath() + QLatin1Char('/'); - const auto relPath = path.mid(folderPath.length()); - folder->blacklistPath(relPath); +void FolderMan::blacklistFolderPath(const QString &path) +{ + addFolderToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncListType::SelectiveSyncBlackList); +} } QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const AccountPtr acc) diff --git a/src/gui/folderman.h b/src/gui/folderman.h index a79f1119355c2..684ba29829e41 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -358,6 +358,8 @@ private slots: [[nodiscard]] bool isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) const; + void addFolderToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType list); + QSet _disabledFolders; Folder::Map _folderMap; QString _folderConfigPath;