Enhanced Trash functionality

Jens Nordenbro d98jeno at stud.hh.se
Thu Nov 27 02:49:16 EET 2003


This sounds interesting; I just sat a couple of days ago, thinking about
what a thrash-bin directory-layout should look like.
I understand that you are into creating ONE large database that includes
metadata to all deleted files.
I for one would like to add some of my thoughts.
Instead of renaming the file (by enumeration), and adding it to the trashbin
along with an entry in the central DB, I suggest creating a new directory
(named by enumeration perhaps) in which the deleted file is moved. Within
this directory, also create a metadata-file containing informtaion about
where this file came from, file-name, size etc. (the parameters you
suggested doing in your document).
There will thus be no central registry that could be corrupted or
misstakenly deleted.
The API you have specified will of course enter every directory, parsing the
files and present the content of the trashbin nicely to the user. The main
advantage of this approach would be that the directory-structure is manually
browsable (from bash, konqueror or whatever) and no informtaion is lost if
the central register is corrupted.
Naturally a central database could be generated to act as a cache to all
individual files and there configurations respectively.

Once again...In conclusion:
My suggestion of the file/directory-layout solves two problems:
1. Minimized/No damage of corrupted/deleted central DB
2. Manual listing/deleting of files in trashbin is enabled

Cost:
1. Extra space needed ( not much though) 1 directory + 1 short metadatafile
per directory

Future benefits:
In the future replace the word directory with archive, where archive equals
any of { directory, zip-file, ... } and the files in the trashbin could be
compressed ...



What do U think about this ?


regards,
Jens Nordenbro





----- Original Message ----- 
From: "Jonathan Hunt" <jhuntnz at users.sourceforge.net>
To: <xdg-list at freedesktop.org>
Sent: Monday, November 24, 2003 10:47 AM
Subject: Fwd: Re: Enhanced Trash functionality


> Hi,
>
> I have just been mentioning creating an enhance trashbin with KDE folks. I
> wonder if anyone here would mind reading thru my (admittedly long 2
emails)
> for any suggestions of how I could make this project useful to others
besides
> KDE (perhaps read the lower email first).
>
> Thanx for your time,
> Jonathan
>
> ----------  Forwarded Message  ----------
>
> Subject: Re: Enhanced Trash functionality
> Date: Mon, 24 Nov 2003 10:44 pm
> From: Jonathan Hunt <jhuntnz at users.sourceforge.net>
> To: kde-devel at kde.org
>
> Thanx for the positive feedback - it sounds as though enhance trash is
worth
> doing.
> Some questions: I am planning to standard C++ with Standard Template
>  Libraries for the library interface (ie not dependant on KDE) and for the
>  command line util. Interface would be as follows (a C++ class).
>
> namespace Trash {
> class TrashIterator {...}
> class TrashBin {
> public:
> TrashBin (const char *dir = "~/.Trash");
>
> void trash(const char *filename); // throws exceptions
> TrashIterator getFirstItem();
> TrashIterator getLastItem();
> }
>
>
> class TrashItem
> {
> void restore();
> string getfilename();
> date getdatedeletion();
> string getpointer(); // Returns  a string pointing to a file that can be
>  used to access read-only the trash item while it is deleted
> string getoriginalpath();
> string getfilesize();
> ...
> }
>
> Does this sound like a agreeable interface. The only other library besides
>  Std C++ and STL I think I would make it dependable on is some common
>  database library for keeping track of the files. I'd love to hear any
>  suggestions about what I would use here (I'm looking for something small,
>  common or at least portable that can handle at least a moderately sized
DB
>  (I never delete my trash so I want something that can easily scale to >
1000
>  files etc.), stable. Most common solutions seem to need a daemon running
(eg
>  MySQL) which is something I'd rather not bother with in the interests of
>  easy setup and self-containment etc. I'd rather not write something like
>  this myself just cause it seems like reinventing the wheel but it is an
>  option (just a flat file that gets compacted occasionally).
>  Suggestions/advice welcome.
>
> Thanx 4 your time,
> Jonathan
>
> On Mon, 24 Nov 2003 7:10 pm, you wrote:
> > Jonathan Hunt wrote:
> > > Hi,
> > >
> > > One of the things I really like about MS Windows is it's recycle bin.
> > > Konqeror under Linux has something similar but it seems much more
> > > limited. It cannot do things like hold more than 1 file that has the
same
> > > name (without renaming) or remember where a file came from and restore
> > > it.
> > > I am a uni student currently on holiday. I am considering spending
some
> > > time writing an improved trash bin for linux. The reason I am not
going
> > > with something like libtrash
> > > (http://www.gnu.org/directory/libs/libtrash.html) is because it
doesn't
> > > seem to solve this problem of having multiple files with the same name
> > > and a user friendly restore etc. and also it intercepts all attempts
to
> > > remove a file - not just "Trash" in Konqeror etc.
> > > Anyways I was planning on writing a C++ terminal application (named
tra
> > > for lack of a better name) using a standalone library libtra that
would
> > > allow one to us tra just like rm only it would move files to the trash
> > > bin (probably make it ~/.Trash). But it would rename the files to be
> > > numbered 0, 1 etc. and keep an entry in a database file about date
> > > deleted, original name etc. so that tra could have a restore option
where
> > > u type the name of a file and it goes thru its DB and finds it etc. I
> > > would write this using fairly common C++ (no Qt etc.) and a common
> > > database library (suggestions here??). Most of the work would be done
by
> > > libtra so that it can easily be called by other applications etc.
> > > KDE comes into it because after I had done this I would like to
> > > incorporate it into Konqeuror (Trash function) etc. and also write
either
> > > a plugin to konqeror or a standalone KDE app that would run when u
click
> > > on the Trash bin that would be similar in functionality to MS Recycle
Bin
> > > this would use the libtra library.
> > > So I am writing to see how interested KDE project would be in
something
> > > like this, if there is already a similar effort underway and also for
> > > suggestions of a Database library to use that is fast and stable and
> > > common on POSIX platforms (or at least portable across them).
>
>
> --
> Jonathan Hunt (The Real Jonathan Hunt) <jhuntnz at users.sourceforge.net>
> Jabber at jhuntnz at jabber.org
> "He is no fool who gives what he cannot keep to gain what he cannot lose."
> Jim Elliot
>
> -------------------------------------------------------
>
> -- 
> Jonathan Hunt (The Real Jonathan Hunt) <jhuntnz at users.sourceforge.net>
> Jabber at jhuntnz at jabber.org
> "He is no fool who gives what he cannot keep to gain what he cannot lose."
> Jim Elliot
>
> _______________________________________________
> Xdg-list mailing list
> Xdg-list at freedesktop.org
> https://www.redhat.com/mailman/listinfo/xdg-list
>




More information about the xdg mailing list