ac = menu->addAction(tr("Edit Ignored Files"));
connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentIgnoredFiles);
- if (!_ui->_folderList->isExpanded(index) && !folder->supportsVirtualFiles()) {
+ if (!_ui->_folderList->isExpanded(index) && folder->supportsSelectiveSync()) {
ac = menu->addAction(tr("Choose what to sync"));
ac->setEnabled(folderConnected);
connect(ac, &QAction::triggered, this, &AccountSettings::doExpand);
_journal.setPinStateForPath("", enabled ? PinState::OnlineOnly : PinState::AlwaysLocal);
}
+bool Folder::supportsSelectiveSync() const
+{
+ return !supportsVirtualFiles() && !isVfsOnOffSwitchPending();
+}
+
void Folder::saveToSettings() const
{
// Remove first to make sure we don't get duplicates
bool Folder::supportsVirtualFiles() const
{
- return _definition.virtualFilesMode != Vfs::Off;
+ return _definition.virtualFilesMode != Vfs::Off && !isVfsOnOffSwitchPending();
}
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction dir, bool *cancel)
bool newFilesAreVirtual() const;
void setNewFilesAreVirtual(bool enabled);
+ /** Whether user desires a switch that couldn't be executed yet, see member */
+ bool isVfsOnOffSwitchPending() const { return _vfsOnOffPending; }
+ void setVfsOnOffSwitchPending(bool pending) { _vfsOnOffPending = pending; }
+
+ /** Whether this folder should show selective sync ui */
+ bool supportsSelectiveSync() const;
+
signals:
void syncStateChange();
void syncStarted();
*/
bool _saveInFoldersWithPlaceholders = false;
+ /** Whether a vfs mode switch is pending
+ *
+ * When the user desires that vfs be switched on/off but it hasn't been
+ * executed yet (syncs are still running), some options should be hidden,
+ * disabled or different.
+ */
+ bool _vfsOnOffPending = false;
+
/**
* Watches this folder's local directory for changes.
*
auto info = infoForIndex(parent);
if (!info)
return 0;
- if (info->_folder && info->_folder->supportsVirtualFiles())
+ if (info->_folder && !info->_folder->supportsSelectiveSync())
return 0;
if (info->hasLabel())
return 1;
if (!info)
return false;
- if (info->_folder && info->_folder->supportsVirtualFiles())
+ if (info->_folder && !info->_folder->supportsSelectiveSync())
return false;
if (!info->_fetched)
// Keep showing the error to the user, it will be hidden when the account reconnects
return false;
}
- if (info->_folder && info->_folder->supportsVirtualFiles()) {
+ if (info->_folder && !info->_folder->supportsSelectiveSync()) {
// Selective sync is hidden in that case
return false;
}