Review Request 120573: [OS X] make KDE's trash use the OS X trash
René J.V. Bertin
rjvbertin at gmail.com
Thu Oct 16 19:47:53 BST 2014
> On Oct. 14, 2014, 9:35 p.m., Thomas Lübking wrote:
> > kioslave/trash/trashimpl.cpp, line 362
> > <https://git.reviewboard.kde.org/r/120573/diff/6/?file=318520#file318520line362>
> >
> > This can only make sense when
> > a) init() created $TRASH/KDE.trash
> > b) deleteEmptyTrashInfraStructure() kicked it
> > c) at some later point $TRASH/KDE.trash is no more writable
> >
> > -> add it to ::copyToTrash() and ::moveToTrash() or ::adaptTrashSize() ?
> >
> > Also, you might want to try returning trashPath to $TRASH/KDE.trash when the trash was so far empty?
>
> René J.V. Bertin wrote:
> I think it does make sense. The KDE.trash/{files,info} infrastructure can be deleted not only when the KDE wastebin is emptied one way or another, but also when the OS X Trash is emptied through the Finder.
> I think the best way to test for its presence and recreate it if necessary is in the functions that return the name of the infrastructural subdir.
>
> I don't understand your "Also" remark, please explain?
>
> Thomas Lübking wrote:
> I was rather pointing out when such test and recreation would be actually required and that should be when you attempt to add files to a (so far) empty (KDE) trash (why I suggested to move the test/creation there)
>
> By the "Also" sentence, I reffered to the fact that you're conditionally chopping the trashpath from "$TRASH/KDE.trash" to "$TRASH" if, for whatever reason, "$TRASH/KDE.trash" originally could be created but no longer can be.
> I assume it therefore would also make sense to attempt to try to create "trashDir + /KDE.trash" (and set "trashDir" to "trashDir + KDE.trash" in case of success) if the trash is empty (you're actually attempting to create a trashDir) and trashDir is currently $TRASH and not $TRASH/KDE.trash
In the original code, the infrastructure is created in `::init`, and it remains there. The rest of the code is thus written with the implicit assumption that `files` and `info` exit. It's evident that errors are raised while attempting to write to or from the trash and those directories don't exist. I'd have to double check if no errors can occur during other operations (simply opening the trash, for instance). I agree it'd be cleaner if the host's Trash remains empty when a KDE app checks an already empty trash for garbage ...
- René J.V.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/120573/#review68412
-----------------------------------------------------------
On Oct. 15, 2014, 6:26 p.m., René J.V. Bertin wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/120573/
> -----------------------------------------------------------
>
> (Updated Oct. 15, 2014, 6:26 p.m.)
>
>
> Review request for KDE Software on Mac OS X, KDE Runtime and David Faure.
>
>
> Repository: kde-runtime
>
>
> Description
> -------
>
> KDE on OS X does not handle the desktop session (no "Plasma") nor can it rely on XDG to obtain the proper paths to use for something like the trash. As a result, all applications that propose to move things they manage to the wastebin (Dolphin, but also digiKam) will store those items in a place that has no particular meaning on OS X, and that will thus tend to fill up.
>
> OS X stores trash in one of several locations. Files trashed from the boot volume (and/or the volume containing $HOME, I don't actually know that) end up in `~/.Trash`. Files deleted from other volumes end up in `/Volumes/volName/.Trashes/uid`, where volName is the volume name (regardless whether it's an external or a remote drive; only mounted NFS shares are handled differently) and uid the numerical user id. Permissions on `.Trashes` are the same as those expected by KDE.
>
> The kio_trash kioslave appears to support several actual trash directory locations, just like OS X. `TrashImpl::init()` creates a standard trash in `~/.local/share/Trash` (at least under OS X) but also `TrashImpl::trashForMountPoint()` that is used in cases I have not yet encountered.
>
> On OS X, my modified `TrashImpl::init()` sets the standard trash directory to `~/.Trash/KDE.trash` and will create the `files` and `info` subdirectories as required, because they will of course be deleted when the user empties the OS X trash. `TrashImpl::fileRemoved()` has been modified to call a new function, `deleteEmptyTrashInfraStructure` to delete the KDE trash's internal infrastructure when the wastebin is empty so that OS X also sees the trash as emptied. (Since implementing `deleteEmptyTrashInfraStructure` this feature actually works, as expected as far as I can tell).
>
> Remains to be done:
> - determine in what cases `trashForMountPoint()` is used, and finish the modifications for it to use `/.Trashes/uid/KDE.trash`
>
>
> Diffs
> -----
>
> kioslave/trash/kcmtrash.cpp f4811fd
> kioslave/trash/trashimpl.h bc68723
> kioslave/trash/trashimpl.cpp 30ee05b
>
> Diff: https://git.reviewboard.kde.org/r/120573/diff/
>
>
> Testing
> -------
>
> On OS X 10.6.8 with kdelibs and kde-runtime git/4.14, using Dolphin. Tested actions are
> - move items to wastebin from $HOME and a directory on a different volume
> - restore items to both places
> - empty wastebin through Dolphin
> - empty OS X trashcan
>
>
> Thanks,
>
> René J.V. Bertin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20141016/6f8aecd7/attachment.htm>
More information about the kde-core-devel
mailing list