aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <[email protected]>2017-09-08 17:18:05 +0200
committerDaniel Vrátil <[email protected]>2017-09-08 17:18:05 +0200
commit34827a0c872f7989dcb28ad7577d1a926cb78569 (patch)
tree908f692162078e49348056f8b79774b49b36ab37
parenta1d1166df69055975cc98fa35311b1ae39265430 (diff)
LIST: minor optimization
-rw-r--r--src/server/handler/list.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/server/handler/list.cpp b/src/server/handler/list.cpp
index bfe8c6b..c4f69b2 100644
--- a/src/server/handler/list.cpp
+++ b/src/server/handler/list.cpp
@@ -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);