┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElvis Angelaccio <[email protected]>2018-04-05 23:29:29 +0200
committerElvis Angelaccio <[email protected]>2018-04-05 23:29:29 +0200
commit5413025f0b26e9b195d1117bb483fbfe42e8c8c8 (patch)
tree97e5a54f284a25e4635713c5e7162ced91cd02f6
parente9192259f6fd54c0ca1fcf7bae6db57fa1c8a08a (diff)
parent30349ef1bdcae0ed80f47c168d46c15020b927d3 (diff)
Merge branch 'Applications/18.04'
-rw-r--r--src/views/renamedialog.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp
index 44c0a5a7b..e49f56e2d 100644
--- a/src/views/renamedialog.cpp
+++ b/src/views/renamedialog.cpp
@@ -155,22 +155,29 @@ void RenameDialog::slotAccepted()
widget = this;
}
+ const QList<QUrl> srcList = m_items.urlList();
+ const QString newName = m_lineEdit->text();
KIO::FileUndoManager::CommandType cmdType;
+ KIO::Job *job = nullptr;
if (m_renameOneItem) {
Q_ASSERT(m_items.count() == 1);
cmdType = KIO::FileUndoManager::Rename;
+ const QUrl oldUrl = m_items.constFirst().url();
+ QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
+ newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));
+ m_renamedItems << newUrl;
+ job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo);
} else {
cmdType = KIO::FileUndoManager::BatchRename;
+ job = KIO::batchRename(srcList, newName, m_spinBox->value(), QLatin1Char('#'));
+ connect(qobject_cast<KIO::BatchRenameJob*>(job), &KIO::BatchRenameJob::fileRenamed, this, &RenameDialog::slotFileRenamed);
}
- const QList<QUrl> srcList = m_items.urlList();
- KIO::BatchRenameJob* job = KIO::batchRename(srcList, m_lineEdit->text(), m_spinBox->value(), QLatin1Char('#'));
KJobWidgets::setWindow(job, widget);
const QUrl parentUrl = srcList.first().adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash);
KIO::FileUndoManager::self()->recordJob(cmdType, srcList, parentUrl, job);
- connect(job, &KIO::BatchRenameJob::fileRenamed, this, &RenameDialog::slotFileRenamed);
- connect(job, &KIO::BatchRenameJob::result, this, &RenameDialog::slotResult);
+ connect(job, &KJob::result, this, &RenameDialog::slotResult);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);