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.
Tested in KDE Neon.
- 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. :)
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.
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
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.
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.
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.