Opened 11 years ago

Last modified 3 weeks ago

#5247 assigned enhancement

Trash: Ability to see "sent to Trash" date (easy)

Reported by: mmadia Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Applications/Tracker Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Being able to sort Trash's contents by chronological order may be a useful feature. Possibly could be implemented by adding a "Trashed" attribute, which essentially a timestamp.

Change History (15)

comment:1 by stippi, 11 years ago

Awesome idea. Such a simple solution to a problem I had once in a while.

comment:2 by waddlesplash, 6 years ago

Milestone: R1Unscheduled

Moving Tracker enhancement tickets out of R1 milestone -- Tracker's source code comes from BeOS R5, so it already has all the features it did on R5.

comment:3 by axeld, 4 years ago

Owner: changed from axeld to nobody
Status: newassigned

comment:4 by waddlesplash, 2 years ago

Summary: Trash: Ability to see "sent to Trash" dateTrash: Ability to see "sent to Trash" date (easy)

comment:5 by thangdinh1298, 2 years ago

I'm attempting to solve this.

comment:6 by eml, 10 months ago

thangdinh1298 are you still working on it?

in reply to:  6 comment:7 by thaflo, 4 months ago

Replying to eml:

thangdinh1298 are you still working on it?

I don't think so. Would you doing that?

comment:8 by stellarpower, 4 weeks ago

Proposed fix:

  • Add a _trk/date_time_trashed attribute to
  • Get current system date and time, generate and add this attribute when trashing a file
  • Remove this attribute when restoring
  • Add this attribute as a default column visible for trash directories (and original name (path), whilst at it)
    • TODO - work out after completing the above as more complex
    • Edit the Model in Model.cpp????

((Don't think I can assign myself but would happy to be owner of this))

Last edited 4 weeks ago by stellarpower (previous) (diff)

comment:9 by nephele, 4 weeks ago

You don't need to be the ticket owner to work on something, mentioning your intent on the ticket is normally enough :)

Perhaps watching the trash directory and adding the attribute to new entries would be a more comprehensive fix than trying to patch everything that might touch that dir, unless it isn't a directory but a querry, I am unsure about that.

Last edited 4 weeks ago by nephele (previous) (diff)

in reply to:  9 comment:10 by madmax, 4 weeks ago

Replying to nephele:

Perhaps watching the trash directory[...]

And there's already a watcher to update the icon state. I don't know how functional, reliable and immediate they are, or how much work it would be, but maybe the addition and removal of _trk/original_path could also be moved there from both tracker and bin/trash?

comment:11 by stellarpower, 4 weeks ago

I'd have to look in detail, but IIRC I got the impression the watcher was just keeping an eye out to change the icon from empty to containing files. Also we have the problem then that once the item is in the trash, the reference to the original path has been lost - I think it kinda needs to be atomic and there won't be a way around that. However, the idea of refactoring it out I would agree with, as an option at least, in that case bin/trash could reduce down to a very small number of lines, just probably not in the watcher

Edit: sorry, missed the comment above on my phone. I think the trash was kind of like a unison between directories, I don't know if it is a quesy underneath but I saw a mention to being a model aggregating all the trash directories on mounted filesystems. I'd vote for having one unambiguous programmatic way of moving a given entry or set of entries into the trash, presumably as part of the tracker kit, and if needed, refactor anything else to make use of this.

Last edited 4 weeks ago by stellarpower (previous) (diff)

comment:12 by nephele, 4 weeks ago

For the option of using watch directory, that should be immidiete afaik, you would only need to watch the Trash dir(s) for new additions and then set the current time, i don't think the deleted path can be set in the same way since the file is already moved then. Downside to this is that if Tracker closes for whatever reason that this then breaks in an unexpected way.

comment:13 by stellarpower, 4 weeks ago

Were there any particular advantages for putting it in the watcher? Just that to me, it feels probably more robust to have this attribute added or cleared at the point the file is (un)trashed, esp. if this is already done for the path. What would be reasons for favouring putting it in the watcher?

Also, there seems to be quite a mélange of code for working with times in the tracker, I was wondering if there would be a justification to refactor this to use the date/time classes in the support kit. This would be a larger job that could potentially break a lot of things of course, but am wondering if it would be worth it down the line. It seems the Time attribute type is backed by time_t (and not all the *attr utils in /bin seem to support it fully). It might be nice for users to be able to add dates, times, and datetimes to their custom attributes, and even though it's working now, I reckon quite a bit of what is dealing with times currently in tracker could be cleaned up and unified. I'd have to look again specifically, but I saw various calls to strftime and friends that I am guessing could be pulled under the locale kit better.

comment:14 by nephele, 4 weeks ago

A watcher is usefull to cover all cases where something can be moved, in the case of the Trash dir it could be for example.
mv file /boot/trash/
cp file /boot/trash/
cat file | cat > /boot/trash/file

It's not really feasible for us to patch every operation that could end up in the trash, since the intent isn't always clear. But the question would be too if that even matters.
For the tracker code itself, it was released as opensource and came from BeOS directly, some of the code could really use improvements, though I can't personally verify if the date stuff is part of it, if we have proper ICU code to work with dates it probably makes more sense to use that to cover all edge cases ICU already covers.

comment:15 by stellarpower, 3 weeks ago

Gotcha. Are those examples valid use of the Trash? I had assumed it was a system directory and so behaviour would only be agreed if it was left alone and the normal way of doing it used.

Also thought as much with the sources, the copyright date I saw was quite old too. The fix just for this would be quite quick to submit; part of me would be keen to go further with some of the other enhancements regarding dates etc., and part of me thinks if potentially quite a few bits in Tracker could do with an overhaul it may be best to leave it as it is for now rather than kinda leave a dent in the older code.

Note: See TracTickets for help on using tickets.