Commit e4c8abfe authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecate toSet() method

parent 7f405038
......@@ -97,7 +97,11 @@ void RecursiveCollectionFilterProxyModel::addContentMimeTypeInclusionFilter(cons
void RecursiveCollectionFilterProxyModel::addContentMimeTypeInclusionFilters(const QStringList &mimeTypes)
{
Q_D(RecursiveCollectionFilterProxyModel);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
d->includedMimeTypes.unite(mimeTypes.toSet());
#else
d->includedMimeTypes.unite(QSet<QString>(mimeTypes.begin(), mimeTypes.end()));
#endif
d->checker.setWantedMimeTypes(d->includedMimeTypes.values());
invalidateFilter();
}
......@@ -113,7 +117,11 @@ void RecursiveCollectionFilterProxyModel::clearFilters()
void RecursiveCollectionFilterProxyModel::setContentMimeTypeInclusionFilters(const QStringList &mimeTypes)
{
Q_D(RecursiveCollectionFilterProxyModel);
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
d->includedMimeTypes = mimeTypes.toSet();
#else
d->includedMimeTypes = QSet<QString>(mimeTypes.begin(), mimeTypes.end());
#endif
d->checker.setWantedMimeTypes(d->includedMimeTypes.values());
invalidateFilter();
}
......
......@@ -1371,7 +1371,12 @@ public:
const Collection collection = index.data(EntityTreeModel::CollectionRole).value<Collection>();
// The mimetypes that the selected collection can possibly contain
mimeTypes = AgentManager::self()->instance(collection.resource()).type().mimeTypes().toSet();
const auto mimeTypesResult = AgentManager::self()->instance(collection.resource()).type().mimeTypes();
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
mimeTypes = mimeTypesResult.toSet();
#else
mimeTypes = QSet<QString>(mimeTypesResult.begin(), mimeTypesResult.end());
#endif
}
}
......@@ -1395,8 +1400,8 @@ public:
const bool canCreateNewCollections = (collection.rights() & Collection::CanCreateCollection);
const bool canContainCollections = collection.contentMimeTypes().contains(Collection::mimeType()) || collection.contentMimeTypes().contains(Collection::virtualMimeType());
const bool resourceAllowsRequiredMimeTypes = AgentManager::self()->instance(collection.resource()).type().mimeTypes().toSet().contains(mimeTypes);
const bool resourceAllowsRequiredMimeTypes = AgentManager::self()->instance(collection.resource()).type().mimeTypes().toSet().contains(mimeTypes);
const bool isReadOnlyForItems = (isItemAction && (!canCreateNewItems || !canContainRequiredMimeTypes));
const bool isReadOnlyForCollections = (isCollectionAction && (!canCreateNewCollections || !canContainCollections || !resourceAllowsRequiredMimeTypes));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment