Skip to content

Commit

Permalink
Save folder settings to config when force-switching VFS.
Browse files Browse the repository at this point in the history
Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander authored and backportbot[bot] committed Dec 14, 2021
1 parent 31e47e5 commit 7d97175
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/folder.cpp
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/gui/folder.h
Expand Up @@ -289,6 +289,8 @@ class Folder : public QObject

void switchToVirtualFiles();

void processSwitchedToVirtualFiles();

/** Whether this folder should show selective sync ui */
bool supportsSelectiveSync() const;

Expand Down Expand Up @@ -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.
*
Expand Down
4 changes: 4 additions & 0 deletions src/gui/folderman.cpp
Expand Up @@ -211,6 +211,10 @@ int FolderMan::setupFolders()

emit folderListChanged(_folderMap);

for (const auto folder : _folderMap) {
folder->processSwitchedToVirtualFiles();
}

return _folderMap.size();
}

Expand Down

0 comments on commit 7d97175

Please sign in to comment.