Bug 183403

Summary: when copy pasting a file from trash to dolphin, "0-" is prepended to the filename
Product: [Frameworks and Libraries] kio Reporter: Haris Kouzinopoulos <kouzinopoulos>
Component: trashAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: minor CC: dukat, faure, kde, reeves.87, scarpino, spaz16, virtual.avatar
Priority: VLO    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.10
Attachments: Restore original name when using drag and drop or copy/cut

Description Haris Kouzinopoulos 2009-02-06 10:49:34 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    Ubuntu Packages

Steps to reproduce:

1) open a directory in dolphin

2) create a new test file

3) delete the file

4) click on the wastebin ( a new dolphin window appears )

5) copy the test file from the new window back to the old

Result: the string "0-" was added to the filename of the test file
Comment 1 Nicolas L. 2010-03-30 09:43:30 UTC
reproduced and each time you delete and restore that add a 0-

Btw the "restore" option of the trash doesn't show this bug
Comment 2 Jekyll Wu 2012-01-01 15:05:27 UTC
*** Bug 262881 has been marked as a duplicate of this bug. ***
Comment 3 Squall 2012-01-08 16:44:07 UTC
This problem happens if you restore a file with CUT & PASTE, or drag & drop.

The cut & paste way to restore a file is very important, because we can choose a new folder to paste the restored file.

This problem does not happen on Gnome, LXDE and XFCE, and on Windows.
Comment 4 Squall 2012-01-11 15:55:43 UTC
This bug exists since KDE 4.2.

Another duplicate:
https://bugs.kde.org/show_bug.cgi?id=211004

There are many bug reports for the same problem. One of them has votes.

This report says about copy from trashcan, and copy from trashcan should be forbidden, like on Windows.
What should be fixed is the problem of cut & paste from trashcan.
Comment 5 Anne-Marie Mahfouf 2012-01-13 08:47:38 UTC
*** Bug 211004 has been marked as a duplicate of this bug. ***
Comment 6 michael 2012-01-21 20:28:07 UTC
Created attachment 68076 [details]
Restore original name when using drag and drop or copy/cut

This patch will cause kio_trash to restore the orginal name of the file instead of prepending "0-" to it on copy/paste or drag and drop.
Comment 7 michael 2012-01-21 20:29:13 UTC
Comment on attachment 68076 [details]
Restore original name when using drag and drop or copy/cut

This was made against 4.7.4.
Comment 8 Squall 2012-05-28 02:05:16 UTC
This bug continues on Kubuntu 12.04. It uses KDE 4.8.
How to use this patch? Can it be used for KDE 4.8?

I think that the main topic of this bug should have other title
"when cut/pasting or drag/dropping a file from trash to dolphin, "0-" is prepended to the filename" instead of "copy",
because copy from the trash is not common or may be interpreted as an invalid or senseless command.

Restoration from trash with cut and paste is common.

I observed that when the last file is restored with cut and paste, the trash icon continues being the full trash icon instead of the empty trash icon.

The cut and paste action should work like the restore option with the difference being the destination of the file.
Comment 9 Myriam Schweingruber 2012-05-28 10:05:32 UTC
This is not a bug, you are just doing it the wrong way:

to get back files from trash, use the function "undelete" or "restore", do not just copy it. Copy is definitely not the same action as undelete and restore.
Comment 10 michael 2012-05-28 11:49:15 UTC
Fine, then consider this a request that the behavior be user configurable. The above patch still applies to 4.8 and can be update if there's intrerst. Just leave trash.protocol alone if you want the default to be as it is.
Comment 11 Myriam Schweingruber 2012-05-28 14:53:39 UTC
Did you already submit your patch to http://reviewboard.kde.org?
Comment 12 michael 2012-05-28 16:16:22 UTC
On 05/28/2012 10:53 AM, Myriam Schweingruber wrote:
> https://bugs.kde.org/show_bug.cgi?id=183403
>
> --- Comment #11 from Myriam Schweingruber <myriam@kde.org> ---
> Did you already submit your patch to http://reviewboard.kde.org?
>
Will do. Any particular version it should be based off of?
Comment 13 michael 2012-05-28 17:59:24 UTC
Just to clearify I was thinking about cut/past, drag and drop not copy when I made the patch. Both these operation are move requests. Copy is indead a different opperation. Anyway the review request is here https://git.reviewboard.kde.org/r/105078/.
Comment 14 David Faure 2012-12-14 12:30:07 UTC
Git commit 41d645c1b690eaad04c41396e492d7cf3047eb00 by David Faure.
Committed on 14/12/2012 at 13:23.
Pushed by dfaure into branch 'master'.

Generate nicer-looking display names, no trashId in front (e.g. "0-").
Doesn't fix the behavior on drag-n-drop though, yet.

M  +8    -4    kioslave/trash/kio_trash.cpp
M  +24   -10   kioslave/trash/tests/testtrash.cpp
M  +1    -0    kioslave/trash/tests/testtrash.h

http://commits.kde.org/kde-runtime/41d645c1b690eaad04c41396e492d7cf3047eb00
Comment 15 David Faure 2012-12-14 14:43:25 UTC
Git commit 228e1519c8612d3c6d5cd2f67ac47afa6e368c80 by David Faure.
Committed on 14/12/2012 at 15:42.
Pushed by dfaure into branch 'KDE/4.10'.

Fix listRecursive so that display names get parent dirs prepended too.

The list of names was d1/d2/file, and the list of display-names was just "file",
leading to flattening out directory structures when setting up kioslaves with
fileNameUsedForCopying=DisplayName.

M  +26   -13   kio/kio/job.cpp

http://commits.kde.org/kdelibs/228e1519c8612d3c6d5cd2f67ac47afa6e368c80
Comment 16 David Faure 2012-12-14 15:51:41 UTC
The last part of this fix is http://www.davidfaure.fr/2012/copying_from_trash.diff
but I can't commit that without raising the kdelibs requirement to 4.10, in kde-runtime.

Mail to release-team sent.
Comment 17 David Faure 2012-12-14 17:45:49 UTC
Git commit 017a9e3cd42b9327596185c992dea35715bf8dee by David Faure.
Committed on 14/12/2012 at 18:46.
Pushed by dfaure into branch 'master'.

Switch kio_trash to "use display name for copying", to fix bug 183403.

Increase kdelibs version requirement to 4.10.
FIXED-IN: 4.10

M  +2    -2    CMakeLists.txt
M  +19   -7    kioslave/trash/tests/testtrash.cpp
M  +1    -1    kioslave/trash/trash.protocol

http://commits.kde.org/kde-runtime/017a9e3cd42b9327596185c992dea35715bf8dee