┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorAmol Godbole <[email protected]>2023-11-09 11:17:33 -0600
committerMéven Car <[email protected]>2024-01-14 08:34:58 +0000
commit5a8bd47296e204a68014a60757758c50fa623526 (patch)
treeb595e21caf4c0c51ae2e86f659c3514e89ef4293 /src/views
parentc035e95e1d74fecd8267b08009c616232e2c16b0 (diff)
DolphinView: Use SingleShot and Queued Connections
A minor refactor where Qt::SingleShotConnection has been utilized. Also, signal delay using QTimer has been replaced with a Qt::QueuedConnection.
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinview.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 6b77a46ea..ae0aa903c 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -200,7 +200,8 @@ DolphinView::DolphinView(const QUrl &url, QWidget *parent)
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);
@@ -740,17 +741,18 @@ void DolphinView::renameSelectedItems()
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 {