]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Add DiscoveryPhase::checkSelectiveSyncExistingFolder
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 28 Jun 2023 10:21:40 +0000 (18:21 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:40:36 +0000 (17:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h

index 05ab702663ef70c2df051e3979020e561481320d..446570e5387094b6a1cf80b0bdbc113c55168edf 100644 (file)
@@ -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
 {
index 93f3989229acc7568a094a4a8c31b2b6220f2228..38c54832eef8f497115a4166d076bdb28828dffe 100644 (file)
@@ -266,6 +266,8 @@ class DiscoveryPhase : public QObject
                                      const RemotePermissions rp,
                                      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.
      *
      * Note that it only considers parent directory renames. So if A/B got renamed to C/D,