for (const KFileItem &item : items) {
if (item.url() == currentDir) {
- // #473377: Delay emitting currentDirectoryRemoved() to avoid modifying KCoreDirLister
- // before KCoreDirListerCache::deleteDir() returns.
- QTimer::singleShot(0, this, [this] {
- Q_EMIT currentDirectoryRemoved();
- });
-
+ Q_EMIT currentDirectoryRemoved();
return;
}
connect(m_model, &KFileItemModel::directoryRedirection, this, &DolphinView::slotDirectoryRedirection);
connect(m_model, &KFileItemModel::urlIsFileError, this, &DolphinView::urlIsFileError);
connect(m_model, &KFileItemModel::fileItemsChanged, this, &DolphinView::fileItemsChanged);
- connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved);
+ // #473377: Use a QueuedConnection to avoid modifying KCoreDirLister before KCoreDirListerCache::deleteDir() returns.
+ connect(m_model, &KFileItemModel::currentDirectoryRemoved, this, &DolphinView::currentDirectoryRemoved, Qt::QueuedConnection);
connect(this, &DolphinView::itemCountChanged, this, &DolphinView::updatePlaceholderLabel);
if (items.count() == 1 && GeneralSettings::renameInline()) {
const int index = m_model->index(items.first());
- QMetaObject::Connection *const connection = new QMetaObject::Connection;
- *connection = connect(m_view, &KItemListView::scrollingStopped, this, [=]() {
- QObject::disconnect(*connection);
- delete connection;
-
- m_view->editRole(index, "text");
+ connect(
+ m_view,
+ &KItemListView::scrollingStopped,
+ this,
+ [this, index]() {
+ m_view->editRole(index, "text");
- hideToolTip();
+ hideToolTip();
- connect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
- });
+ connect(m_view, &DolphinItemListView::roleEditingFinished, this, &DolphinView::slotRoleEditingFinished);
+ },
+ Qt::SingleShotConnection);
m_view->scrollToItem(index);
} else {