1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-04-09 19:15:43 +02:00

on switch to VFS real plugin, convert existing files to placeholders

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Matthieu Gallien 2021-07-09 12:23:41 +02:00 committed by Felix Weilbach
parent 6ad63fb770
commit 9658aea963
3 changed files with 15 additions and 1 deletions

View File

@ -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();
}
}

View File

@ -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)

View File

@ -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: