[WIP] Add Duplicate feature
Needs ReviewPublic

Authored by ngraham on Oct 8 2017, 6:45 PM.

Details

Summary

Adds a Duplicate feature to Dolphin, showing up as a menu item in the File menu that appears when one or more items are selected and the directory is writable. Duplicated items receive the names of the original files with " copy" appended before the file extension, if any.

Test Plan

Tested in KDE Neon.

Test cases:

  • Try to duplicate when nothing is selected: PASS: menu item is grayed out
  • Try to duplicate anything on a read-only local volume: PASS: menu item is grayed out
  • Try to duplicate anything on a read-only samba share: PASS: menu item is grayed out
  • Duplicate single local file on R/W volume: PASS: item is duplicated and named correctly
  • Duplicate multiple local files on R/W volume: PASS: 3 items are duplicated, named correctly, and selected
  • Duplicate single local directory on R/W volume: PASS: item is duplicated and named correctly, but a rename operation is not initiated
  • Duplicate multiple local directories on R/W volume: PASS: 3 items are duplicated, named correctly, and selected
  • Duplicate single file on R/W samba share: PASS: item is duplicated and correctly
  • Duplicate multiple files on R/W samba share: PASS: 3 items are duplicated, named correctly, and selected
  • Duplicate single directory on R/W samba share: PASS: item is duplicated and named correctly
  • Duplicate multiple directory on R/W samba share: PASS: 3 items are duplicated, named correctly, and selected
  • Try to undo a successful duplication: PASS: operation is undone

This is my first attempt at a big change like this and I'm sure it's full of issues. I will accept any and all suggestions for improvement. :)

Diff Detail

Repository
R318 Dolphin
Branch
arcpatch-D8208
Lint
No Linters Available
Unit
No Unit Test Coverage
ngraham created this revision.Oct 8 2017, 6:45 PM
Restricted Application added a subscriber: Dolphin. · View Herald TranscriptOct 8 2017, 6:45 PM
ngraham updated this revision to Diff 20662.Oct 13 2017, 3:21 AM

Remove rename-after-duplication feature, because I can't get it working right and I don't think it's really necessary anyway

ngraham edited the summary of this revision. (Show Details)Oct 13 2017, 3:23 AM
ngraham edited the test plan for this revision. (Show Details)
ngraham added reviewers: broulik, davidedmundson.

Thanks for this patch, but I don't think we should add another action for something that can be already accomplished in two different ways (copy/paste, CTRL+drop).

I understand that pressing CTRL+D is slightly faster, but not so much faster to justify another entry in the menu. Please also have a look at https://userbase.kde.org/Dolphin#Philosophy

FWIW, My mother is a "Lisa" user, and with macOS Finder, she uses its Duplicate feature *constantly*. I got the idea to add it to Dolphin after watching her file manager workflow in detail 3 months ago.

I think this falls under the umbrella of "Powerful when needed." By default, Dolphin doesn't show the menubar, so this feature is hidden and doesn't clutter up the simple interface. But when you show the menubar, that's an indication that you're a power user with greater needs, and then the feature is visible in the File menu.

This feature may seem a bit superfluous when just duplicating a single file, where you only save a few keystrokes. But try copying-and-pasting multiple files; the UI is a bit of a mess, and it's very confusing. This IMHO is much simpler and clearer for that use case.

I actually find myself quite often using Ctrl+C and then Ctrl+V, I would like a "duplicate" option.

I'm just not sure about just adding "copy" suffix, I usually enter a new name and appreciate that it lets me choose a new one rather than complaining about already existing like other OS do it.

src/views/dolphinview.cpp
741

You might want to look into KIO::suggestName or what it's called but I think this might not be completely suitable for this usecase here

Yes, for single file duplication, I initially tried to implement a rename-on-duplication feature but wasn't able to figure it out. I'll check out KIO::suggestName.

If the main/classic method of copying doesn't work well with many files, imho we should find a way to fix that. So that the use case would be ok for everyone, not just those who have the menubar visible or know the CTRL+D shortcut.

I don't want to get into a big argument. If others would like to see this, please speak up, so we can see how much support (if any) the idea has.

cfeck added a subscriber: cfeck.Oct 16 2017, 2:17 AM

Why would you need two identical copies of the same file in the same folder? I would imagine that people move the duplicate to a different location (usually to a different physical device) afterwards, and they might not understand the difference to a copy that is created at the new location directly. This is especially bad if the source is on SSD. Every unneeded write to SSD should be avoided.

TLDR; add a warning that people can hide forever if they understand the consequences.

fazevedo added a subscriber: fazevedo.EditedApr 22 2018, 11:37 AM

Just saw this updated review - please see my comments in https://phabricator.kde.org/D8206.
Duplicate feature is something very interesting that i would like to see as well available in dolphin.
It's extremely useful for people to create copy so they can safety works on original and not using a version system like git or svn.
To be useful, the feature has to be able to operate on files and folders with one or many selected items in a passive way (ie, don't ask for user a file name).
Please, note that some people don't care of such feature because they don't need it, it does not mean that it is not useful for a lot of other people.

markg added a subscriber: markg.Apr 22 2018, 3:27 PM

(writing it in this revision as well ;))

ngraham updated this revision to Diff 32888.Apr 23 2018, 2:28 PM

Rebase on master in preparation for some refactoring

ngraham updated this revision to Diff 32889.Apr 23 2018, 2:30 PM

Address some review comments

ngraham retitled this revision from Add Duplicate feature to [WIP] Add Duplicate feature.