[KDE/Mac] Review Request 126125: [OS X] make KDE's trash use the OS X trash

René J.V. Bertin rjvbertin at gmail.com
Sat Nov 21 17:57:09 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/126125/
-----------------------------------------------------------

(Updated Nov. 21, 2015, 6:57 p.m.)


Review request for KDE Software on Mac OS X, KDE Frameworks and David Faure.


Changes
-------

Resolves David's last open issue.

I looked at removing the ifdefs around `createInfrastructure()`, but that function cannot be a stub elsewhere but on OS X. So one would either have to add an argument with a platform-dependent default value, or else accept that the infrastructure is checked each time the function is called (even when it's unlikely to be discarded "behind our backs).

Since the topic came up, I've also taken the liberty to convert certain qDebug() calls to qWarning(), and comment most of the remaining ones. It's only on OS X that that output goes into a system log (I hope), and I think this workaround still leaves plenty to discuss on a future RR ;)


Repository: kio


Description
-------

This is a "backport" of the [kde-runtime modification reviewed here](https://git.reviewboard.kde.org/r/120573/) that makes the trash ioslave use a subdirectory in the OS X trashcan.

>From the original review:
*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 patch from KDE4 was straightforward to apply as the trash implementation has only had what seem to be cosmetic changes and "Qt4 -> Qt5" adaptations.
Therefore, I have ported my code "as is", so as not to change anything that was discussed and negotiated during the rather lengthy previous review process. The only place where I've had to introduce a small additional change is in `trashForMountPoint`, where KF5 made `trashDir` a const. Appending the KDE trash-subdir in the `trashDir` declaration might seem the appropriate approach, but since there is no guarantee at that point that the subdirectory actually (still) exists, the `QT_LSTAT` test could fail, and the the appending has to be done after the check on the actual host trash directory.

I have also introduced a small change in `testtrash.cpp` allowing it to run instead of failing because the 1st location returned `trashDirectories()` doesn't match the one determined from QSP.


Diffs (updated)
-----

  src/ioslaves/trash/CMakeLists.txt 05161cd 
  src/ioslaves/trash/kcmtrash.cpp 79c2ca7 
  src/ioslaves/trash/tests/CMakeLists.txt 3e138f7 
  src/ioslaves/trash/tests/testtrash.cpp 339aa19 
  src/ioslaves/trash/trashimpl.h 9886011 
  src/ioslaves/trash/trashimpl.cpp 26d9ea8 

Diff: https://git.reviewboard.kde.org/r/126125/diff/


Testing
-------

OS X 10.9 with Qt 5.5.1 and KF5rameworks 5.16.0 . The code builds, and the unittests from testtrash succeed (with the Trash open in the Finder one sees the `KDE.trash` directory show up while the test runs, and disappear afterwards).


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20151121/cdfeec86/attachment.html>


More information about the kde-mac mailing list