From 478f404b8abf924a0e3e21bbf1dd49aefbe47672 Mon Sep 17 00:00:00 2001 From: Emirald Mateli Date: Sun, 17 Sep 2017 11:07:44 +0200 Subject: Keep renamed file(s) in view When renaming a file, if its new name causes it to scroll out of view, Dolphin will not scroll to the location of the new file. This patch aims to address that. This affects all view modes. CCBUG: 354330 Test Plan: 1. Have many files in a directory (or several files, just zoom in a lot) 2. Rename a file so that it will move out of view Differential Revision: https://phabricator.kde.org/D6312 --- src/views/renamedialog.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/views/renamedialog.cpp') diff --git a/src/views/renamedialog.cpp b/src/views/renamedialog.cpp index df4827b3a..6309bfbdf 100644 --- a/src/views/renamedialog.cpp +++ b/src/views/renamedialog.cpp @@ -162,6 +162,11 @@ void RenameDialog::renameItem(const KFileItem &item, const QString& newName) KIO::Job * job = KIO::moveAs(oldUrl, newUrl, KIO::HideProgressInfo); KJobWidgets::setWindow(job, widget); KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Rename, {oldUrl}, newUrl, job); + + if (!job->error()) { + m_renamedItems << newUrl; + } + job->uiDelegate()->setAutoErrorHandlingEnabled(true); } @@ -223,6 +228,10 @@ void RenameDialog::renameItems() renameItem(item, newName); } } + + if (!m_items.empty()) { + emit renamingFinished(m_renamedItems); + } } QString RenameDialog::indexedName(const QString& name, int index, const QChar& indexPlaceHolder) -- cgit v1.3