Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 34827a0c authored by Daniel Vrátil's avatar Daniel Vrátil 🤖

LIST: minor optimization

parent a1d1166d
......@@ -362,19 +362,17 @@ void List::retrieveCollections(const Collection &topParent, int depth)
QVariantList mimeTypeIds;
QVariantList attributeIds;
QVariantList ancestorIds;
mimeTypeIds.reserve(mCollections.size());
attributeIds.reserve(mCollections.size());
for (auto it = mCollections.cbegin(), end = mCollections.cend(); it != end; ++it) {
mimeTypeIds << it.key();
attributeIds << it.key();
}
QVariantList ancestorIds;
//We'd only require the non-leaf collections, but we don't know which those are, so we take all.
ancestorIds.reserve(mCollections.size());
for (auto it = mCollections.cbegin(), end = mCollections.cend(); it != end; ++it) {
mimeTypeIds << it.key();
attributeIds << it.key();
ancestorIds << it.key();
}
if (mAncestorDepth > 0 && topParent.isValid()) {
//unless depth is 0 the base collection is not part of the listing
mAncestors.insert(topParent.id(), topParent);
......
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