From 6f2e63d52f59574c12b0f6bfd2687c43deb0e4e5 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Wed, 28 Jun 2023 19:39:09 +0800 Subject: [PATCH] Create and connect specific signal for existing folder now being discovered to be big Signed-off-by: Claudio Cambra --- src/gui/folder.cpp | 1 + src/libsync/discovery.cpp | 2 +- src/libsync/discoveryphase.cpp | 6 ++---- src/libsync/discoveryphase.h | 3 ++- src/libsync/syncengine.cpp | 1 + src/libsync/syncengine.h | 2 ++ 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 9a503853e..9879ed302 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -108,6 +108,7 @@ Folder::Folder(const FolderDefinition &definition, this, &Folder::slotItemCompleted); connect(_engine.data(), &SyncEngine::newBigFolder, this, &Folder::slotNewBigFolderDiscovered); + connect(_engine.data(), &SyncEngine::existingFolderNowBig, this, &Folder::slotExistingFolderNowBig); connect(_engine.data(), &SyncEngine::seenLockedFile, FolderMan::instance(), &FolderMan::slotSyncOnceFileUnlocks); connect(_engine.data(), &SyncEngine::aboutToPropagate, this, &Folder::slotLogPropagationStart); diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 16b2b12c5..e9bbe46b6 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -728,7 +728,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo(const SyncFileItemPtr &it ENFORCE(dbEntry.isDirectory()); if (differingSize) { - _discoveryData->checkSelectiveSyncExistingFolder(path._server, serverEntry.remotePerm, sizeOnServer); + _discoveryData->checkSelectiveSyncExistingFolder(path._server, sizeOnServer); } item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA; diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 446570e53..b1efc3157 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -157,16 +157,14 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path, checkFolderSizeLimit(path, callback); } -void DiscoveryPhase::checkSelectiveSyncExistingFolder(const QString &path, const RemotePermissions &rp, const qint64 folderSize) +void DiscoveryPhase::checkSelectiveSyncExistingFolder(const QString &path, 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); + emit existingFolderNowBig(path); } } diff --git a/src/libsync/discoveryphase.h b/src/libsync/discoveryphase.h index 38c54832e..1775325a6 100644 --- a/src/libsync/discoveryphase.h +++ b/src/libsync/discoveryphase.h @@ -266,7 +266,7 @@ class DiscoveryPhase : public QObject const RemotePermissions rp, const std::function callback); - void checkSelectiveSyncExistingFolder(const QString &path, const RemotePermissions &rp, const qint64 folderSize); + void checkSelectiveSyncExistingFolder(const QString &path, const qint64 folderSize); /** Given an original path, return the target path obtained when renaming is done. * @@ -324,6 +324,7 @@ signals: // A new folder was discovered and was not synced because of the confirmation feature void newBigFolder(const QString &folder, bool isExternal); + void existingFolderNowBig(const QString &folder); /** For excluded items that don't show up in itemDiscovered() * diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 7a13f7133..b4fadc453 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -656,6 +656,7 @@ void SyncEngine::startSync() connect(_discoveryPhase.data(), &DiscoveryPhase::itemDiscovered, this, &SyncEngine::slotItemDiscovered); connect(_discoveryPhase.data(), &DiscoveryPhase::newBigFolder, this, &SyncEngine::newBigFolder); + connect(_discoveryPhase.data(), &DiscoveryPhase::existingFolderNowBig, this, &SyncEngine::existingFolderNowBig); connect(_discoveryPhase.data(), &DiscoveryPhase::fatalError, this, [this](const QString &errorString, ErrorCategory errorCategory) { Q_EMIT syncError(errorString, errorCategory); finalize(false); diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index fce3a96b6..d1c4ab9d5 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -187,6 +187,8 @@ signals: // A new folder was discovered and was not synced because of the confirmation feature void newBigFolder(const QString &folder, bool isExternal); + void existingFolderNowBig(const QString &folder); + /** Emitted when propagation has problems with a locked file. * * Forwarded from OwncloudPropagator::seenLockedFile. -- 2.39.5