mirror of
https://invent.kde.org/system/dolphin
synced 2024-11-05 18:47:12 +00:00
Merge remote-tracking branch 'origin/KDE/4.11'
This commit is contained in:
commit
596db782c2
2 changed files with 27 additions and 9 deletions
|
@ -972,7 +972,7 @@ void KFileItemModel::slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >&
|
|||
emit itemsChanged(itemRangeList, changedRoles);
|
||||
|
||||
if (changedRoles.contains(sortRole())) {
|
||||
resortAllItems();
|
||||
m_resortAllItemsTimer->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1405,6 +1405,9 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
|
|||
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;
|
||||
|
@ -2011,7 +2014,15 @@ void KFileItemModel::determineMimeTypes(const KFileItemList& items, int timeout)
|
|||
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.
|
||||
|
|
|
@ -204,8 +204,13 @@ KStandardItemListWidget::~KStandardItemListWidget()
|
|||
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)
|
||||
|
@ -649,16 +654,15 @@ void KStandardItemListWidget::editedRoleChanged(const QByteArray& current, const
|
|||
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);
|
||||
|
@ -1302,6 +1306,9 @@ void KStandardItemListWidget::closeRoleEditor()
|
|||
scene()->views()[0]->parentWidget()->setFocus();
|
||||
}
|
||||
|
||||
if (m_oldRoleEditor) {
|
||||
m_oldRoleEditor->deleteLater();
|
||||
}
|
||||
m_oldRoleEditor = m_roleEditor;
|
||||
m_roleEditor->hide();
|
||||
m_roleEditor = 0;
|
||||
|
|
Loading…
Reference in a new issue