+ if (itemCount * 10 > rowCount) {
+ // Algorithm 1: The number of items is > 10 % of the row count. Parse all rows
+ // and check whether the received row is part of the item list.
+ for (int row = 0; row < rowCount; ++row) {
+ const QModelIndex proxyIndex = m_proxyModel->index(row, 0);
+ const QRect itemRect = m_view->visualRect(proxyIndex);
+ const QModelIndex dirIndex = m_proxyModel->mapToSource(proxyIndex);
+
+ KFileItem item = m_dolphinModel->itemForIndex(dirIndex); // O(1)
+ const KUrl url = item.url();
+
+ // check whether the item is part of the item list 'items'
+ int index = -1;
+ for (int i = 0; i < itemCount; ++i) {
+ if (items[i].url() == url) {
+ index = i;
+ break;
+ }
+ }