From 75a57778d9dd4f379fe0bca9a2aa22b9ee829fa9 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 30 Aug 2018 18:14:13 +0200 Subject: [PATCH] Virtual files: Don't show selective sync Issue #6724 --- src/gui/accountsettings.cpp | 5 ++++- src/gui/folderstatusmodel.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 99fdb2023..47721a10f 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -403,6 +403,9 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) bool folderPaused = _model->data(index, FolderStatusDelegate::FolderSyncPaused).toBool(); bool folderConnected = _model->data(index, FolderStatusDelegate::FolderAccountConnected).toBool(); auto folderMan = FolderMan::instance(); + QPointer folder = folderMan->folder(alias); + if (!folder) + return; auto *menu = new QMenu(tv); @@ -414,7 +417,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) ac = menu->addAction(tr("Edit Ignored Files")); connect(ac, &QAction::triggered, this, &AccountSettings::slotEditCurrentIgnoredFiles); - if (!_ui->_folderList->isExpanded(index)) { + if (!_ui->_folderList->isExpanded(index) && !folder->useVirtualFiles()) { ac = menu->addAction(tr("Choose what to sync")); ac->setEnabled(folderConnected); connect(ac, &QAction::triggered, this, &AccountSettings::doExpand); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 22f915ce5..73d68fc96 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -370,6 +370,8 @@ int FolderStatusModel::rowCount(const QModelIndex &parent) const auto info = infoForIndex(parent); if (!info) return 0; + if (info->_folder && info->_folder->useVirtualFiles()) + return 0; if (info->hasLabel()) return 1; return info->_subs.count(); @@ -525,6 +527,9 @@ bool FolderStatusModel::hasChildren(const QModelIndex &parent) const if (!info) return false; + if (info->_folder && info->_folder->useVirtualFiles()) + return false; + if (!info->_fetched) return true; @@ -550,6 +555,10 @@ bool FolderStatusModel::canFetchMore(const QModelIndex &parent) const // Keep showing the error to the user, it will be hidden when the account reconnects return false; } + if (info->_folder && info->_folder->useVirtualFiles()) { + // Selective sync is hidden in that case + return false; + } return true; } -- 2.30.2