emit itemsChanged(itemRangeList, changedRoles);
if (changedRoles.contains(sortRole())) {
- resortAllItems();
+ m_resortAllItemsTimer->start();
}
}
if (m_requestRole[TypeRole]) {
data.insert(sharedValue("type"), item.mimeComment());
}
+ } else if (m_requestRole[TypeRole] && isDir) {
+ static const QString folderMimeType = item.mimeComment();
+ data.insert(sharedValue("type"), folderMimeType);
}
return data;
QElapsedTimer timer;
timer.start();
foreach (const KFileItem& item, items) { // krazy:exclude=foreach
- item.determineMimeType();
+ // Only determine mime types for files here. For directories,
+ // KFileItem::determineMimeType() reads the .directory file inside to
+ // load the icon, but this is not necessary at all if we just need the
+ // type. Some special code for setting the correct mime type for
+ // directories is in retrieveData().
+ if (!item.isDir()) {
+ item.determineMimeType();
+ }
+
if (timer.elapsed() > timeout) {
// Don't block the user interface, let the remaining items
// be resolved asynchronously.
qDeleteAll(m_textInfo);
m_textInfo.clear();
- delete m_roleEditor;
- delete m_oldRoleEditor;
+ if (m_roleEditor) {
+ m_roleEditor->deleteLater();
+ }
+
+ if (m_oldRoleEditor) {
+ m_oldRoleEditor->deleteLater();
+ }
}
void KStandardItemListWidget::setLayout(Layout layout)
this, SLOT(slotRoleEditingCanceled(QByteArray,QVariant)));
disconnect(m_roleEditor, SIGNAL(roleEditingFinished(QByteArray,QVariant)),
this, SLOT(slotRoleEditingFinished(QByteArray,QVariant)));
+
+ if (m_oldRoleEditor) {
+ m_oldRoleEditor->deleteLater();
+ }
m_oldRoleEditor = m_roleEditor;
m_roleEditor->hide();
m_roleEditor = 0;
}
return;
- } else if (m_oldRoleEditor) {
- // Delete the old editor before constructing the new one to
- // prevent a memory leak.
- m_oldRoleEditor->deleteLater();
- m_oldRoleEditor = 0;
}
Q_ASSERT(!m_roleEditor);
scene()->views()[0]->parentWidget()->setFocus();
}
+ if (m_oldRoleEditor) {
+ m_oldRoleEditor->deleteLater();
+ }
m_oldRoleEditor = m_roleEditor;
m_roleEditor->hide();
m_roleEditor = 0;