Qt::CursorShape shape = Qt::ArrowCursor;
const auto pos = folderList->mapFromGlobal(QCursor::pos());
const auto index = folderList->indexAt(pos);
- if (model->classify(index) == FolderStatusModel::RootFolder
- && (FolderStatusDelegate::errorsListRect(folderList->visualRect(index)).contains(pos)
- || FolderStatusDelegate::optionsButtonRect(folderList->visualRect(index),folderList->layoutDirection()).contains(pos))) {
+ if (model->classify(index) == FolderStatusModel::RootFolder &&
+ (FolderStatusDelegate::errorsListRect(folderList->visualRect(index)).contains(pos) ||
+ FolderStatusDelegate::optionsButtonRect(folderList->visualRect(index),folderList->layoutDirection()).contains(pos))) {
shape = Qt::PointingHandCursor;
}
folderList->setCursor(shape);
QString AccountSettings::selectedFolderAlias() const
{
const auto selected = _ui->_folderList->selectionModel()->currentIndex();
- if (!selected.isValid())
+ if (!selected.isValid()) {
return "";
+ }
return _model->data(selected, FolderStatusDelegate::FolderAliasRole).toString();
}
// Make sure at least the root items are expanded
for (int i = 0; i < _model->rowCount(); ++i) {
const auto idx = _model->index(i);
- if (!_ui->_folderList->isExpanded(idx))
+ if (!_ui->_folderList->isExpanded(idx)) {
_ui->_folderList->setExpanded(idx, true);
+ }
}
}
job->start();
};
- if (folder->virtualFilesEnabled()
- && folder->vfs().mode() == Vfs::WindowsCfApi) {
+ if (folder->virtualFilesEnabled() && folder->vfs().mode() == Vfs::WindowsCfApi) {
showEnableE2eeWithVirtualFilesWarningDialog(encryptFolder);
return;
}
void AccountSettings::slotEditCurrentIgnoredFiles()
{
const auto folder = FolderMan::instance()->folder(selectedFolderAlias());
- if (!folder)
+ if (!folder) {
return;
+ }
openIgnoredFilesDialog(folder->path());
}
void AccountSettings::slotEditCurrentLocalIgnoredFiles()
{
const auto selected = _ui->_folderList->selectionModel()->currentIndex();
- if (!selected.isValid() || _model->classify(selected) != FolderStatusModel::SubFolder)
+ if (!selected.isValid() || _model->classify(selected) != FolderStatusModel::SubFolder) {
return;
+ }
const auto fileName = _model->data(selected, FolderStatusDelegate::FolderPathRole).toString();
openIgnoredFilesDialog(fileName);
}
dialog->setLayout(layout);
connect(buttonBox, &QDialogButtonBox::clicked, [=](QAbstractButton * button) {
- if (buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
+ if (buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
ignoreListWidget->slotWriteIgnoreFile(ignoreFile);
+ }
dialog->close();
});
- connect(buttonBox, &QDialogButtonBox::rejected,
- dialog, &QDialog::close);
+ connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::close);
dialog->open();
}
ac->setDisabled(Theme::instance()->enforceVirtualFilesSyncFolder());
}
- if (Theme::instance()->showVirtualFilesOption()
- && !folder->virtualFilesEnabled() && Vfs::checkAvailability(folder->path())) {
+ if (Theme::instance()->showVirtualFilesOption() && !folder->virtualFilesEnabled() && Vfs::checkAvailability(folder->path())) {
const auto mode = bestAvailableVfsMode();
if (mode == Vfs::WindowsCfApi || ConfigFile().showExperimentalOptions()) {
ac = menu->addAction(tr("Enable virtual file support %1 …").arg(mode == Vfs::WindowsCfApi ? QString() : tr("(experimental)")));
const auto btnRect = treeView->visualRect(indx);
const auto btnSize = treeView->itemDelegate(indx)->sizeHint(opt, indx);
const auto actual = QStyle::visualRect(opt.direction, btnRect, QRect(btnRect.topLeft(), btnSize));
- if (!actual.contains(pos))
+ if (!actual.contains(pos)) {
return;
+ }
if (indx.flags() & Qt::ItemIsEnabled) {
slotAddFolder();
*/
definition.ignoreHiddenFiles = folderMan->ignoreHiddenFiles();
- if (folderMan->navigationPaneHelper().showInExplorerNavigationPane())
+ if (folderMan->navigationPaneHelper().showInExplorerNavigationPane()) {
definition.navigationPaneClsid = QUuid::createUuid();
+ }
const auto selectiveSyncBlackList = folderWizard->property("selectiveSyncBlackList").toStringList();
const auto folder = folderMan->addFolder(_accountState, definition);
if (folder) {
- if (definition.virtualFilesMode != Vfs::Off && folderWizard->property("useVirtualFiles").toBool())
+ if (definition.virtualFilesMode != Vfs::Off && folderWizard->property("useVirtualFiles").toBool()) {
folder->setRootPinState(PinState::OnlineOnly);
+ }
folder->journalDb()->setSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, selectiveSyncBlackList);
void AccountSettings::slotOpenCurrentLocalSubFolder()
{
const auto selected = _ui->_folderList->selectionModel()->currentIndex();
- if (!selected.isValid() || _model->classify(selected) != FolderStatusModel::SubFolder)
+ if (!selected.isValid() || _model->classify(selected) != FolderStatusModel::SubFolder) {
return;
+ }
const auto fileName = _model->data(selected, FolderStatusDelegate::FolderPathRole).toString();
const auto url = QUrl::fromLocalFile(fileName);
QDesktopServices::openUrl(url);
}
OwncloudWizard::askExperimentalVirtualFilesFeature(this, [folder, this](bool enable) {
- if (!enable || !folder)
+ if (!enable || !folder) {
return;
+ }
// we might need to add or remove the panel entry as cfapi brings this feature out of the box
FolderMan::instance()->navigationPaneHelper().scheduleUpdateCloudStorageRegistry();
// It is unsafe to switch on vfs while a sync is running - wait if necessary.
const auto connection = std::make_shared<QMetaObject::Connection>();
const auto switchVfsOn = [folder, connection, this]() {
- if (*connection)
+ if (*connection) {
QObject::disconnect(*connection);
+ }
qCInfo(lcAccountSettings) << "Enabling vfs support for folder" << folder->path();
msgBox->addButton(tr("Cancel"), QMessageBox::RejectRole);
connect(msgBox, &QMessageBox::finished, msgBox, [this, msgBox, folder, acceptButton] {
msgBox->deleteLater();
- if (msgBox->clickedButton() != acceptButton|| !folder)
+ if (msgBox->clickedButton() != acceptButton|| !folder) {
return;
+ }
// we might need to add or remove the panel entry as cfapi brings this feature out of the box
FolderMan::instance()->navigationPaneHelper().scheduleUpdateCloudStorageRegistry();
// It is unsafe to switch off vfs while a sync is running - wait if necessary.
const auto connection = std::make_shared<QMetaObject::Connection>();
const auto switchVfsOff = [folder, connection, this]() {
- if (*connection)
+ if (*connection) {
QObject::disconnect(*connection);
+ }
qCInfo(lcAccountSettings) << "Disabling vfs support for folder" << folder->path();
if (state != AccountState::Connected) {
/* check if there are expanded root items, if so, close them */
for (auto i = 0; i < _model->rowCount(); ++i) {
- if (_ui->_folderList->isExpanded(_model->index(i)))
+ if (_ui->_folderList->isExpanded(_model->index(i))) {
_ui->_folderList->setExpanded(_model->index(i), false);
+ }
}
} else if (_model->isDirty()) {
// If we connect and have pending changes, show the list.
if (li.count() > 1) {
auto myFolder = li[0];
const auto alias = li[1];
- if (myFolder.endsWith(QLatin1Char('/')))
+ if (myFolder.endsWith(QLatin1Char('/'))) {
myFolder.chop(1);
+ }
// Make sure the folder itself is expanded
const auto folder = FolderMan::instance()->folder(alias);