From 7145d73f15b5aa12327a9bbb8f2efa9ae82823b8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 28 Jun 2023 18:21:40 +0800 Subject: [PATCH] Add DiscoveryPhase::checkSelectiveSyncExistingFolder Signed-off-by: Claudio Cambra --- src/libsync/discoveryphase.cpp | 13 +++++++++++++ src/libsync/discoveryphase.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 05ab70266..446570e53 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -157,6 +157,19 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path, checkFolderSizeLimit(path, callback); } +void DiscoveryPhase::checkSelectiveSyncExistingFolder(const QString &path, const RemotePermissions &rp, const qint64 folderSize) +{ + // TODO: Check for setting to obey big folder sync + // If no size limit is enforced, or if is in whitelist (explicitly allowed) or in blacklist (explicitly disallowed), do nothing. + if (!activeFolderSizeLimit() || findPathInList(_selectiveSyncWhiteList, path) || findPathInList(_selectiveSyncBlackList, path)) { + return; + } else if (folderSize >= _syncOptions._newBigFolderSizeLimit) { // If the folder is too big, notify the user and prompt for response. + const auto isExternalStorage = + _syncOptions._confirmExternalStorage && _syncOptions._vfs->mode() == Vfs::Off && rp.hasPermission(RemotePermissions::IsMounted); + emit newBigFolder(path, isExternalStorage); + } +} + /* Given a path on the remote, give the path as it is when the rename is done */ QString DiscoveryPhase::adjustRenamedPath(const QString &original, SyncFileItem::Direction d) const { diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 93f398922..38c54832e 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -266,6 +266,8 @@ class DiscoveryPhase : public QObject const RemotePermissions rp, const std::function callback); + void checkSelectiveSyncExistingFolder(const QString &path, const RemotePermissions &rp, const qint64 folderSize); + /** Given an original path, return the target path obtained when renaming is done. * * Note that it only considers parent directory renames. So if A/B got renamed to C/D, -- 2.30.2