From: alex-z Date: Tue, 14 Dec 2021 10:26:11 +0000 (+0200) Subject: Save folder settings to config when force-switching VFS. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~17^2~243^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3f3b752e440547ef70b0c46c1c9b594231af9e16;p=nextcloud-desktop.git Save folder settings to config when force-switching VFS. Signed-off-by: alex-z --- 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(); }