- if (index > lastVisibleIndex) {
- return;
- }
-
- // If this didn't work before MaxBlockTimeout was reached, at least
- // prevent that the user sees 'unknown' icons.
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
-
- while (index <= lastVisibleIndex) {
- if (!m_model->data(index).contains("iconName")) {
- const KFileItem item = m_model->fileItem(index);
- QHash<QByteArray, QVariant> data;
- data.insert("iconName", item.iconName());
- m_model->setData(index, data);
- }
- ++index;
- }
-
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
-}
-
-void KFileItemModelRolesUpdater::updateAllIconsFast(int timeout)
-{
- if (timeout <= 0) {
- return;
- }
-
- QElapsedTimer timer;
- timer.start();
-
- disconnect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));
-
- const int count = m_model->count();
- while (m_firstIndexWithoutIcon < count && timer.elapsed() < timeout) {
- if (!m_model->data(m_firstIndexWithoutIcon).contains("iconName")) {
- const KFileItem item = m_model->fileItem(m_firstIndexWithoutIcon);
- QHash<QByteArray, QVariant> data;
- data.insert("iconName", item.iconName());
- m_model->setData(m_firstIndexWithoutIcon, data);
- }
- ++m_firstIndexWithoutIcon;
- }
-
- if (m_firstIndexWithoutIcon == count) {
- m_hasUnknownIcons = false;
- }
-
- connect(m_model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
- this, SLOT(slotItemsChanged(KItemRangeList,QSet<QByteArray>)));