Commit da77f501 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Simplify code in ThumbnailProvider::appendItems

KFileItem supports hashing so we can construct a set directly from
mItems rather than needing to insert things manually.
parent c7ccb617
...@@ -214,13 +214,10 @@ void ThumbnailProvider::setThumbnailGroup(ThumbnailGroup::Enum group) ...@@ -214,13 +214,10 @@ void ThumbnailProvider::setThumbnailGroup(ThumbnailGroup::Enum group)
void ThumbnailProvider::appendItems(const KFileItemList& items) void ThumbnailProvider::appendItems(const KFileItemList& items)
{ {
if (!mItems.isEmpty()) { if (!mItems.isEmpty()) {
QSet<QString> itemSet; QSet<KFileItem> itemSet{mItems.begin(), mItems.end()};
for (const KFileItem & item : qAsConst(mItems)) {
itemSet.insert(item.url().url());
}
for (const KFileItem & item : items) { for (const KFileItem & item : items) {
if (!itemSet.contains(item.url().url())) { if (!itemSet.contains(item)) {
mItems.append(item); mItems.append(item);
} }
} }
......
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