X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c5238c9946805c8aef69f4b52689ba5a700c913e..fdf854bd81d9e42df2d8672d49a0b7fcdb7443a5:/src/views/dolphinview.cpp diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 17023ae5f..0c5ebb1df 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -375,9 +375,8 @@ void DolphinView::setGroupedSorting(bool grouped) ViewProperties props(viewPropertiesUrl()); props.setGroupedSorting(grouped); - props.save(); - m_container->controller()->model()->setGroupedSorting(grouped); + m_model->setGroupedSorting(grouped); Q_EMIT groupedSortingChanged(grouped); } @@ -757,7 +756,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 &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 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()); }); @@ -2032,6 +2044,7 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray &role, con if (!newNameExistsAlready) { forceUrlsSelection(newUrl, {newUrl}); + updateSelectionState(); // Only connect the result signal if there is no item with the new name // in the model yet, see bug 328262. @@ -2275,11 +2288,6 @@ QUrl DolphinView::viewPropertiesUrl() const return url; } -void DolphinView::slotRenameDialogRenamingFinished(const QList &urls) -{ - forceUrlsSelection(urls.first(), urls); -} - void DolphinView::forceUrlsSelection(const QUrl ¤t, const QList &selected) { clearSelection();