From: Matthieu Gallien Date: Fri, 9 Jul 2021 10:23:41 +0000 (+0200) Subject: on switch to VFS real plugin, convert existing files to placeholders X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~18^2~122^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9658aea9639012c62ddfcfb60d72d1bc01efaec8;p=nextcloud-desktop.git on switch to VFS real plugin, convert existing files to placeholders Signed-off-by: Matthieu Gallien --- diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 993dcb69e..3a33d4542 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -669,8 +669,10 @@ void Folder::setVirtualFilesEnabled(bool enabled) _definition.virtualFilesMode = newMode; startVfs(); - if (newMode != Vfs::Off) + if (newMode != Vfs::Off) { _saveInFoldersWithPlaceholders = true; + SyncEngine::switchToVirtualFiles(path(), _journal, *_vfs); + } saveToSettings(); } } diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 9813e63cb..47f24f832 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -1019,6 +1019,16 @@ void SyncEngine::wipeVirtualFiles(const QString &localPath, SyncJournalDb &journ // But hydrated placeholders may still be around. } +void SyncEngine::switchToVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs) +{ + qCInfo(lcEngine) << "Convert to virtual files inside" << localPath; + journal.getFilesBelowPath({}, [&](const SyncJournalFileRecord &rec) { + SyncFileItem item; + QString localFile = localPath + rec.path(); + vfs.convertToPlaceholder(localFile, item, localFile); + }); +} + void SyncEngine::abort() { if (_propagator) diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 991ef4820..9d0bada92 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -134,6 +134,8 @@ public: */ static void wipeVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs); + static void switchToVirtualFiles(const QString &localPath, SyncJournalDb &journal, Vfs &vfs); + auto getPropagator() { return _propagator; } // for the test signals: