[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Review Request 120573: [OS X] make KDE's trash use the OS X trash
From:       René J.V. Bertin <rjvbertin () gmail ! com>
Date:       2014-10-16 22:35:36
Message-ID: 20141016223536.21223.56506 () probe ! kde ! org
[Download RAW message or body]

--===============6905301314269383118==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit


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

(Updated Oct. 17, 2014, 12:35 a.m.)


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


Changes
-------

New version taking into account the various suggestions. Trash "infrastructure" is \
now created only when really needed (please check if I forgot any cases), which does \
NOT include scanning the trash nor doing something with a trashed file (knowing a \
trashed file by name should mean the infrastruct. exists).


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 (updated)
-----

  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


--===============6905301314269383118==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit




<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">  \
<tr>  <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/120573/">https://git.reviewboard.kde.org/r/120573/</a>
  </td>
    </tr>
   </table>
   <br />





<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;">  <tr>
  <td>

<div>Review request for KDE Software on Mac OS X, KDE Runtime and David Faure.</div>
<div>By René J.V. Bertin.</div>


<p style="color: grey;"><i>Updated Oct. 17, 2014, 12:35 a.m.</i></p>



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">New version taking into account the various suggestions. Trash \
&quot;infrastructure&quot; is now created only when really needed (please check if I \
forgot any cases), which does NOT include scanning the trash nor doing something with \
a trashed file (knowing a trashed file by name should mean the infrastruct. \
exists).</pre>  </td>
 </tr>
</table>







<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kde-runtime
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">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.</p> <p \
style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: \
inherit;">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 \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">~/.Trash</code>. Files deleted from other \
volumes end up in <code style="text-rendering: inherit;color: #4444cc;padding: \
0;white-space: normal;margin: 0;line-height: \
inherit;">/Volumes/volName/.Trashes/uid</code>, 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 <code \
style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: \
0;line-height: inherit;">.Trashes</code> are the same as those expected by KDE.</p> \
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">The kio_trash kioslave appears to support several \
actual trash directory locations, just like OS X. <code style="text-rendering: \
inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">TrashImpl::init()</code> creates a standard trash in <code \
style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: \
0;line-height: inherit;">~/.local/share/Trash</code> (at least under OS X) but also \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">TrashImpl::trashForMountPoint()</code> that \
is used in cases I have not yet encountered.</p> <p style="padding: 0;text-rendering: \
inherit;margin: 0;line-height: inherit;white-space: inherit;">On OS X, my modified \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">TrashImpl::init()</code> sets the standard \
trash directory to <code style="text-rendering: inherit;color: #4444cc;padding: \
0;white-space: normal;margin: 0;line-height: inherit;">~/.Trash/KDE.trash</code> and \
will create the <code style="text-rendering: inherit;color: #4444cc;padding: \
0;white-space: normal;margin: 0;line-height: inherit;">files</code> and <code \
style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: normal;margin: \
0;line-height: inherit;">info</code> subdirectories as required, because they will of \
course be deleted when the user empties the OS X trash. <code style="text-rendering: \
inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">TrashImpl::fileRemoved()</code> has been modifie  d to call a new function, \
<code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">deleteEmptyTrashInfraStructure</code> 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 <code style="text-rendering: \
inherit;color: #4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">deleteEmptyTrashInfraStructure</code> this feature actually works, as \
expected as far as I can tell).</p> <p style="padding: 0;text-rendering: \
                inherit;margin: 0;line-height: inherit;white-space: inherit;">Remains \
                to be done:
- determine in what cases <code style="text-rendering: inherit;color: \
#4444cc;padding: 0;white-space: normal;margin: 0;line-height: \
inherit;">trashForMountPoint()</code> is used, and finish the modifications for it to \
use <code style="text-rendering: inherit;color: #4444cc;padding: 0;white-space: \
normal;margin: 0;line-height: inherit;">/.Trashes/uid/KDE.trash</code></p></pre>  \
</td>  </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">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</p></pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> \
(updated)</h1> <ul style="margin-left: 3em; padding-left: 0;">

 <li>kioslave/trash/kcmtrash.cpp <span style="color: grey">(f4811fd)</span></li>

 <li>kioslave/trash/trashimpl.h <span style="color: grey">(bc68723)</span></li>

 <li>kioslave/trash/trashimpl.cpp <span style="color: grey">(30ee05b)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/120573/diff/" style="margin-left: \
3em;">View Diff</a></p>






  </td>
 </tr>
</table>




  </div>
 </body>
</html>


--===============6905301314269383118==--


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic