From 603558562fbe33466612ee7d58ca5381cd9f4970 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 5 Jul 2023 17:16:36 +0800 Subject: [PATCH] Add convenience methods to folderman so that classes can add and remove paths from folders without needing to know which folder the path belongs to Signed-off-by: Claudio Cambra --- src/gui/folderman.cpp | 20 ++++++++++++++++++++ src/gui/folderman.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 27a79520036f..198731a8b0b6 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1259,6 +1259,26 @@ Folder *FolderMan::folderForPath(const QString &path) return it != folders.cend() ? *it : nullptr; } +void FolderMan::whitelistFolderPath(const QString &path) +{ + const auto folder = folderForPath(path); + if (!folder) { + return; + } + + folder->whitelistPath(path); +} + +void FolderMan::blacklistFolderPath(const QString &path) +{ + const auto folder = folderForPath(path); + if (!folder) { + return; + } + + folder->blacklistPath(path); +} + QStringList FolderMan::findFileInLocalFolders(const QString &relPath, const AccountPtr acc) { QStringList re; diff --git a/src/gui/folderman.h b/src/gui/folderman.h index 6c236ce8e8a4..03cee25b90f7 100644 --- a/src/gui/folderman.h +++ b/src/gui/folderman.h @@ -104,6 +104,9 @@ class FolderMan : public QObject /** Returns the folder which the file or directory stored in path is in */ Folder *folderForPath(const QString &path); + void whitelistFolderPath(const QString &path); + void blacklistFolderPath(const QString &path); + /** * returns a list of local files that exist on the local harddisk for an * incoming relative server path. The method checks with all existing sync