Save folder settings to config when force-switching VFS.
authoralex-z <blackslayer4@gmail.com>
Tue, 14 Dec 2021 10:26:11 +0000 (12:26 +0200)
committeralex-z <blackslayer4@gmail.com>
Tue, 14 Dec 2021 14:33:35 +0000 (16:33 +0200)
Signed-off-by: alex-z <blackslayer4@gmail.com>
src/gui/folder.cpp
src/gui/folder.h
src/gui/folderman.cpp

index 33a1634d9f0c286a832d2176f70eb80b1f354d6d..6da7388db12a6103e882a7051028f6a3e7a98a31 100644 (file)
@@ -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
index 8fd8bfbbbe2227de2adc751c8804d8472c4413bb..e18aecbfa8ddd6bc80163239ad661fc548d1b6a8 100644 (file)
@@ -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.
      *
index 73ad0c5535ea82a76d35560813452e79eaaa46f5..a2c13597c0139f409908620618181a730d2ee849 100644 (file)
@@ -211,6 +211,10 @@ int FolderMan::setupFolders()
 
     emit folderListChanged(_folderMap);
 
+    for (const auto folder : _folderMap) {
+        folder->processSwitchedToVirtualFiles();
+    }
+
     return _folderMap.size();
 }