diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-05-25 12:12:24 +0300 |
---|---|---|
committer | Hannah von Reth <vonreth@kde.org> | 2021-06-15 14:18:34 +0300 |
commit | ed3969dce7e23875a5c296f98ef10b1f41841673 (patch) | |
tree | 4e32087fe691fef0b468032e2a69222eda36c61a /src/gui/selectivesyncdialog.cpp | |
parent | 66ee75ed1285d2f5dc8a1a44ff76397811396b01 (diff) |
Fix exclude filtering in selective sync dialog
Fixes: #8648
Diffstat (limited to 'src/gui/selectivesyncdialog.cpp')
-rw-r--r-- | src/gui/selectivesyncdialog.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/gui/selectivesyncdialog.cpp b/src/gui/selectivesyncdialog.cpp index 3d6052614..1a2920f19 100644 --- a/src/gui/selectivesyncdialog.cpp +++ b/src/gui/selectivesyncdialog.cpp @@ -184,27 +184,17 @@ void SelectiveSyncWidget::recursiveInsert(QTreeWidgetItem *parent, QStringList p void SelectiveSyncWidget::slotUpdateDirectories(QStringList list) { auto job = qobject_cast<LsColJob *>(sender()); - QScopedValueRollback<bool> isInserting(_inserting); - _inserting = true; + QScopedValueRollback<bool> isInserting(_inserting, true); SelectiveSyncTreeViewItem *root = static_cast<SelectiveSyncTreeViewItem *>(_folderTree->topLevelItem(0)); - QUrl url = _account->davUrl(); - QString pathToRemove = url.path(); - if (!pathToRemove.endsWith('/')) { - pathToRemove.append('/'); - } - pathToRemove.append(_folderPath); - if (!_folderPath.isEmpty()) - pathToRemove.append('/'); + const QString pathToRemove = Utility::concatUrlPath(_account->davUrl(), _folderPath).path(); // Check for excludes. - QMutableListIterator<QString> it(list); - while (it.hasNext()) { - it.next(); - if (_excludedFiles.isExcluded(it.value(), pathToRemove, FolderMan::instance()->ignoreHiddenFiles())) - it.remove(); - } + list.erase(std::remove_if(list.begin(), list.end(), [&pathToRemove, this](const QString &it) { + return _excludedFiles.isExcludedRemote(it, pathToRemove, ItemTypeDirectory); + }), + list.end()); // Since / cannot be in the blacklist, expand it to the actual // list of top-level folders as soon as possible. @@ -282,11 +272,7 @@ void SelectiveSyncWidget::slotItemExpanded(QTreeWidgetItem *item) QString dir = item->data(0, Qt::UserRole).toString(); if (dir.isEmpty()) return; - QString prefix; - if (!_folderPath.isEmpty()) { - prefix = _folderPath + QLatin1Char('/'); - } - LsColJob *job = new LsColJob(_account, prefix + dir, this); + LsColJob *job = new LsColJob(_account, _folderPath + dir, this); job->setProperties(QList<QByteArray>() << "resourcetype" << "http://owncloud.org/ns:size"); connect(job, &LsColJob::directoryListingSubfolders, |