Use BatchRenameJob to rename multiple files in Dolphin
ClosedPublic

Authored by chinmoyr on Jan 12 2018, 7:42 AM.

Details

Summary

Use KIO::BatchRenameJob in Dolphin::RenameDialog to rename multiple files.
With this viewing progress of rename operation and undo is possible.

See D9103 and D9107.

Diff Detail

Repository
R318 Dolphin
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
chinmoyr requested review of this revision.Jan 12 2018, 7:42 AM
chinmoyr created this revision.
broulik added inline comments.
src/views/renamedialog.cpp
168

KFileItemList has a urlList() method that does that

174

Do we need QUrl::StripTrailingSlash here? At least most other places in KIO that use RemoveFileName set it

179

The job is async, so by the time you end up here the job hasn't even started yet, your handling should be in slotFileRenamed or rather connect to result signal?

chinmoyr updated this revision to Diff 25243.Jan 12 2018, 5:11 PM
  1. Used urlList() method
  2. Set QUrl::StripTrailingSlash
  3. Used KIO::Job::result signal
chinmoyr marked 3 inline comments as done.Jan 12 2018, 5:15 PM
chinmoyr added inline comments.
src/views/renamedialog.cpp
174

When undoing BatchRename parentUrl is not used. So IMO setting QUrl::StripTrailingSlash won't make any difference.
I have set it just in case I am wrong.

chinmoyr marked an inline comment as done.Jan 17 2018, 1:36 AM

ping. anyone from dolphin?

Nice. Tested, and it works as expected, including undo, as advertised. So that's nice. +1 from me, but I'll wait for someone more experienced to do a code review.

elvisangelaccio requested changes to this revision.Jan 21 2018, 10:17 AM
elvisangelaccio added a subscriber: elvisangelaccio.

Looks good, but please bump the minimum KF5 version in CMakeLists.txt to 5.42

src/views/renamedialog.cpp
204–205

Nitpick, semicolon not necessary.

This revision now requires changes to proceed.Jan 21 2018, 10:17 AM

@chinmoyr Friendly ping! If we can get this in before tomorrow, I'll be able to highlight it in my weekly Usability and Productivity status report. :)

chinmoyr updated this revision to Diff 26048.Jan 27 2018, 11:52 AM

removed semicolon

Can you also bump the minimum KF5 version in CMakeLists.txt to 5.42?

elvisangelaccio accepted this revision.Jan 27 2018, 11:57 AM

Can you also bump the minimum KF5 version in CMakeLists.txt to 5.42?

No longer necessary, I already bumped it to 5.43

This revision is now accepted and ready to land.Jan 27 2018, 11:57 AM
This revision was automatically updated to reflect the committed changes.