+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>)));
+}
+