From 7d97175b3ada865b84bf98305153cece699b0167 Mon Sep 17 00:00:00 2001 From: alex-z Date: Tue, 14 Dec 2021 12:26:11 +0200 Subject: [PATCH] Save folder settings to config when force-switching VFS. Signed-off-by: alex-z --- src/gui/folder.cpp | 9 +++++++++ src/gui/folder.h | 6 ++++++ src/gui/folderman.cpp | 4 ++++ 3 files changed, 19 insertions(+) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 33a1634d9f0c2..6da7388db12a6 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -691,6 +691,15 @@ void Folder::setRootPinState(PinState state) void Folder::switchToVirtualFiles() { SyncEngine::switchToVirtualFiles(path(), _journal, *_vfs); + _hasSwitchedToVfs = true; +} + +void Folder::processSwitchedToVirtualFiles() +{ + if (_hasSwitchedToVfs) { + _hasSwitchedToVfs = false; + saveToSettings(); + } } bool Folder::supportsSelectiveSync() const diff --git a/src/gui/folder.h b/src/gui/folder.h index 8fd8bfbbbe222..e18aecbfa8ddd 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -289,6 +289,8 @@ class Folder : public QObject void switchToVirtualFiles(); + void processSwitchedToVirtualFiles(); + /** Whether this folder should show selective sync ui */ bool supportsSelectiveSync() const; @@ -500,6 +502,10 @@ private slots: */ bool _vfsOnOffPending = false; + /** Whether this folder has just switched to VFS or not + */ + bool _hasSwitchedToVfs = false; + /** * Watches this folder's local directory for changes. * diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 73ad0c5535ea8..a2c13597c0139 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -211,6 +211,10 @@ int FolderMan::setupFolders() emit folderListChanged(_folderMap); + for (const auto folder : _folderMap) { + folder->processSwitchedToVirtualFiles(); + } + return _folderMap.size(); }