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) {
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)
[[nodiscard]] bool isSwitchToVfsNeeded(const FolderDefinition &folderDefinition) const;
+ void addFolderToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType list);
+
QSet<Folder *> _disabledFolders;
Folder::Map _folderMap;
QString _folderConfigPath;