diff options
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index ab39173da..f9f32d35c 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -757,7 +757,20 @@ void DolphinView::renameSelectedItems() } else { KIO::RenameFileDialog *dialog = new KIO::RenameFileDialog(items, this); - connect(dialog, &KIO::RenameFileDialog::renamingFinished, this, &DolphinView::slotRenameDialogRenamingFinished); + connect(dialog, &KIO::RenameFileDialog::renamingFinished, this, [this, items](const QList<QUrl> &urls) { + // The model may have already been updated, so it's possible that we don't find the old items. + for (int i = 0; i < items.count(); ++i) { + const int index = m_model->index(items[i]); + if (index >= 0) { + QHash<QByteArray, QVariant> data; + data.insert("text", urls[i].fileName()); + m_model->setData(index, data); + } + } + + forceUrlsSelection(urls.first(), urls); + updateSelectionState(); + }); connect(dialog, &KIO::RenameFileDialog::error, this, [this](KJob *job) { KMessageBox::error(this, job->errorString()); }); @@ -2276,11 +2289,6 @@ QUrl DolphinView::viewPropertiesUrl() const return url; } -void DolphinView::slotRenameDialogRenamingFinished(const QList<QUrl> &urls) -{ - forceUrlsSelection(urls.first(), urls); -} - void DolphinView::forceUrlsSelection(const QUrl ¤t, const QList<QUrl> &selected) { clearSelection(); |
