diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1491,17 +1491,10 @@ void DolphinView::slotRenamingResult(KJob* job) { - if (job->error()) { - KIO::CopyJob *copyJob = qobject_cast(job); - Q_ASSERT(copyJob); - const QUrl newUrl = copyJob->destUrl(); - const int index = m_model->index(newUrl); - if (index >= 0) { - QHash data; - const QUrl oldUrl = copyJob->srcUrls().at(0); - data.insert("text", oldUrl.fileName()); - m_model->setData(index, data); - } + if (job->error() == 0) { + // Nothing to do + } else if (job->error() != KIO::ERR_USER_CANCELED) { + emit errorMessage(job->errorString()); } } @@ -1618,30 +1611,10 @@ } #endif - const bool newNameExistsAlready = (m_model->index(newUrl) >= 0); - if (!newNameExistsAlready) { - // Only change the data in the model if no item with the new name - // is in the model yet. If there is an item with the new name - // already, calling KIO::CopyJob will open a dialog - // asking for a new name, and KFileItemModel will update the - // data when the dir lister signals that the file name has changed. - QHash data; - data.insert(role, value); - m_model->setData(index, data); - } - KIO::Job * job = KIO::moveAs(oldUrl, newUrl); KJobWidgets::setWindow(job, this); KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job); - job->uiDelegate()->setAutoErrorHandlingEnabled(true); - - forceUrlsSelection(newUrl, {newUrl}); - - if (!newNameExistsAlready) { - // Only connect the result signal if there is no item with the new name - // in the model yet, see bug 328262. - connect(job, &KJob::result, this, &DolphinView::slotRenamingResult); - } + connect(job, &KJob::result, this, &DolphinView::slotRenamingResult); } } }