mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
Add methods to Folder so that other classes can easily add folder paths to white/blacklists
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
993ee6cb5b
commit
2bcefd6105
2 changed files with 29 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
#include "common/syncjournaldb.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "account.h"
|
||||
|
@ -842,6 +843,29 @@ bool Folder::pathIsIgnored(const QString &path) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void Folder::appendPathToSelectiveSyncList(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.append(folderPath);
|
||||
journal->setSelectiveSyncList(listType, list);
|
||||
}
|
||||
}
|
||||
|
||||
void Folder::whitelistPath(const QString &path)
|
||||
{
|
||||
appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncWhiteList);
|
||||
}
|
||||
|
||||
void Folder::blacklistPath(const QString &path)
|
||||
{
|
||||
appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncBlackList);
|
||||
}
|
||||
|
||||
bool Folder::isFileExcludedAbsolute(const QString &fullPath) const
|
||||
{
|
||||
return _engine->excludedFiles().isExcluded(fullPath, path(), _definition.ignoreHiddenFiles);
|
||||
|
|
|
@ -301,6 +301,9 @@ public:
|
|||
|
||||
QString fileFromLocalPath(const QString &localPath) const;
|
||||
|
||||
void whitelistPath(const QString &path);
|
||||
void blacklistPath(const QString &path);
|
||||
|
||||
signals:
|
||||
void syncStateChange();
|
||||
void syncStarted();
|
||||
|
@ -468,6 +471,8 @@ private:
|
|||
|
||||
void correctPlaceholderFiles();
|
||||
|
||||
void appendPathToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType);
|
||||
|
||||
AccountStatePtr _accountState;
|
||||
FolderDefinition _definition;
|
||||
QString _canonicalLocalPath; // As returned with QFileInfo:canonicalFilePath. Always ends with "/"
|
||||
|
|
Loading…
Reference in a new issue