Folder *f = folderMan->addFolder(_accountState, definition);
if (f) {
if (definition.virtualFilesMode != Vfs::Off && folderWizard->property("useVirtualFiles").toBool())
- f->setNewFilesAreVirtual(true);
+ f->setRootPinState(PinState::OnlineOnly);
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, selectiveSyncBlackList);
bool ok = false;
auto oldBlacklist = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, {});
- for (const auto &entry : oldBlacklist) {
- folder->journalDb()->schedulePathForRemoteDiscovery(entry);
- folder->schedulePathForLocalDiscovery(entry);
- }
// Change the folder vfs mode and load the plugin
folder->setSupportsVirtualFiles(true);
folder->setVfsOnOffSwitchPending(false);
- // Sets pin states to OnlineOnly everywhere
- folder->setNewFilesAreVirtual(true);
+ // Setting to Unspecified retains existing data.
+ // Selective sync excluded folders become OnlineOnly.
+ folder->setRootPinState(PinState::Unspecified);
+ for (const auto &entry : oldBlacklist) {
+ folder->journalDb()->schedulePathForRemoteDiscovery(entry);
+ folder->vfs().setPinState(entry, PinState::OnlineOnly);
+ }
+ folder->slotNextSyncFullLocalDiscovery();
FolderMan::instance()->scheduleFolder(folder);
folder->setVfsOnOffSwitchPending(false);
// Wipe pin states and selective sync db
- folder->setNewFilesAreVirtual(false);
+ folder->setRootPinState(PinState::AlwaysLocal);
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, {});
FolderMan::instance()->scheduleFolder(folder);
return;
// similar to socket api: sets pin state recursively and sync
- folder->setNewFilesAreVirtual(state == PinState::OnlineOnly);
+ folder->setRootPinState(state);
folder->scheduleThisFolderSoon();
}
return pinState && *pinState == PinState::OnlineOnly;
}
-void Folder::setNewFilesAreVirtual(bool enabled)
+void Folder::setRootPinState(PinState state)
{
- const auto newPin = enabled ? PinState::OnlineOnly : PinState::AlwaysLocal;
- _vfs->setPinState(QString(), newPin);
+ _vfs->setPinState(QString(), state);
// We don't actually need discovery, but it's important to recurse
// into all folders, so the changes can be applied.
/** whether new remote files shall become virtual locally
*
- * This is the root folder pin state and can be overridden by explicit subfolder pin states.
+ * This happens when the root folder pin state is OnlineOnly, but can be
+ * overridden by explicit subfolder pin states.
*/
bool newFilesAreVirtual() const;
- void setNewFilesAreVirtual(bool enabled);
+ void setRootPinState(PinState state);
/** Whether user desires a switch that couldn't be executed yet, see member */
bool isVfsOnOffSwitchPending() const { return _vfsOnOffPending; }
*/
void schedulePathForLocalDiscovery(const QString &relativePath);
+ /** Ensures that the next sync performs a full local discovery. */
+ void slotNextSyncFullLocalDiscovery();
+
private slots:
void slotSyncStarted();
void slotSyncFinished(bool);
*/
void slotScheduleThisFolder();
- /** Ensures that the next sync performs a full local discovery. */
- void slotNextSyncFullLocalDiscovery();
-
/** Adjust sync result based on conflict data from IssuesWidget.
*
* This is pretty awkward, but IssuesWidget just keeps better track
// Migrate the old "usePlaceholders" setting to the root folder pin state
if (settings.value(QLatin1String(versionC), 1).toInt() == 1
&& settings.value(QLatin1String("usePlaceholders"), false).toBool()) {
- f->setNewFilesAreVirtual(true);
+ f->setRootPinState(PinState::OnlineOnly);
}
// Migration: Mark folders that shall be saved in a backwards-compatible way
auto f = folderMan->addFolder(account, folderDefinition);
if (f) {
if (folderDefinition.virtualFilesMode != Vfs::Off && _ocWizard->useVirtualFileSync())
- f->setNewFilesAreVirtual(true);
+ f->setRootPinState(PinState::OnlineOnly);
f->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList,
_ocWizard->selectiveSyncBlacklist());