Add DiscoveryPhase::checkSelectiveSyncExistingFolder

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2023-06-28 18:21:40 +08:00
parent e3dc6be371
commit 7145d73f15
No known key found for this signature in database
GPG key ID: C839200C384636B0
2 changed files with 15 additions and 0 deletions

View file

@ -157,6 +157,19 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path,
checkFolderSizeLimit(path, callback); 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 */ /* 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 QString DiscoveryPhase::adjustRenamedPath(const QString &original, SyncFileItem::Direction d) const
{ {

View file

@ -266,6 +266,8 @@ class DiscoveryPhase : public QObject
const RemotePermissions rp, const RemotePermissions rp,
const std::function<void(bool)> callback); const std::function<void(bool)> 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. /** 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, * Note that it only considers parent directory renames. So if A/B got renamed to C/D,