[KFileItemModelRolesUpdater] Avoid duplicate indexes to resolve

This avoids requesting a thumbnail twice for certain files, typically the first or last one in a folder.

Differential Revision: https://phabricator.kde.org/D15404
This commit is contained in:
Kai Uwe Broulik 2018-09-11 09:55:30 +02:00
parent 92a4b5bb62
commit 033eb6b3a3

View file

@ -1165,14 +1165,18 @@ QList<int> KFileItemModelRolesUpdater::indexesToResolve() const
// Add items on the last page.
const int beginLastPage = qMax(qMin(endExtendedVisibleRange + 1, count - 1), count - m_maximumVisibleItems);
for (int i = beginLastPage; i < count; ++i) {
result.append(i);
if (beginLastPage < count - 1) {
for (int i = beginLastPage; i < count; ++i) {
result.append(i);
}
}
// Add items on the first page.
const int endFirstPage = qMin(qMax(beginExtendedVisibleRange - 1, 0), m_maximumVisibleItems);
for (int i = 0; i <= endFirstPage; ++i) {
result.append(i);
if (beginExtendedVisibleRange > 0) {
for (int i = 0; i <= endFirstPage; ++i) {
result.append(i);
}
}
// Continue adding items until ResolveAllItemsLimit is reached.