delete should move files to the trash

Bug #628561 reported by Martin Pool
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bazaar Explorer
Fix Released
Low
Alexander Belchenko

Bug Description

I've talked to a lot of users who have all deleted files by mistake and we all wondered why they weren't moved to the Recycle Bin instead of deleted permanently.

Cheers

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote :

The question is: do we have a cross-platform way to delete file into Recycle Bin via Qt/PyQt or Linux/MaxOSX have no idea of trash folder? That said I can find a way to delete to Recycle Bin on Windows using Win32 API, but I don't know how to do it on other OSes.

Revision history for this message
Martin Pool (mbp) wrote : Re: [Bug 628561] Re: delete should move files to the trash

On 3 September 2010 01:17, Alexander Belchenko <email address hidden> wrote:
> The question is: do we have a cross-platform way to delete file into
> Recycle Bin via Qt/PyQt or Linux/MaxOSX have no idea of trash folder?
> That said I can find a way to delete to Recycle Bin on Windows using
> Win32 API, but I don't know how to do it on other OSes.

On Linux and Mac OS X there are standard directories you can move
things in to, eg ~/.local/shared/trash (I think) on Linux. I don't
know if there is a Python API to tell you the location, or to handle
things not on the home filesystem.

--
Martin

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

On Thu, Sep 2, 2010 at 4:48 PM, Martin Pool <email address hidden> wrote:
> On 3 September 2010 01:17, Alexander Belchenko <email address hidden> wrote:
>> The question is: do we have a cross-platform way to delete file into
>> Recycle Bin via Qt/PyQt or Linux/MaxOSX have no idea of trash folder?
>> That said I can find a way to delete to Recycle Bin on Windows using
>> Win32 API, but I don't know how to do it on other OSes.
>
> On Linux and Mac OS X there are standard directories you can move
> things in to, eg ~/.local/shared/trash (I think) on Linux.  I don't
> know if there is a Python API to tell you the location, or to handle
> things not on the home filesystem.

It's not necessarily ~/.local/shared/trash, but $XDG_DATA_HOME/Trash

See the Freedesktop Spec: http://freedesktop.org/wiki/Specifications/trash-spec

PyXDG should work to tell you the location:

http://packages.ubuntu.com/maverick/python-xdg

Revision history for this message
Greg (gregspecialsource) wrote :
Changed in bzr-explorer:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Alexander Belchenko (bialix) wrote :

OK, I've implemented this feature using cross-platform send2trash library. Now by default we delete to trash.
If there is problems with Linux behavior, then please make sure they fixed upstream, don't blame explorer if it does not conform your distributive stadards. On Windows (and I suppose on Mac too) it works very nice.

For reference: http://pypi.python.org/pypi/Send2Trash/1.2.0
I've bundled copy of this library into explorer with modifications to get python 2.4-2.5 compatibility.

Changed in bzr-explorer:
assignee: nobody → Alexander Belchenko (bialix)
milestone: none → 1.1.3
status: Confirmed → Fix Committed
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.