From 3f3b752e440547ef70b0c46c1c9b594231af9e16 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 33a1634d9..6da7388db 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 8fd8bfbbb..e18aecbfa 100644 --- a/src/gui/folder.h +++ b/src/gui/folder.h @@ -289,6 +289,8 @@ public: void switchToVirtualFiles(); + void processSwitchedToVirtualFiles(); + /** Whether this folder should show selective sync ui */ bool supportsSelectiveSync() const; @@ -500,6 +502,10 @@ private: */ 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 73ad0c553..a2c13597c 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(); }