Bug 437382

Summary: Recent locations and recent files don't update automatically in Dolphin
Product: [Applications] dolphin Reporter: medin <med.medin.2014>
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: admin, hsantanna, kfm-devel, meven29, nate, simon.pfeifer, tbertels
Priority: NOR    
Version: 21.08.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 24.12.0
Sentry Crash Report:

Description medin 2021-05-19 23:08:57 UTC
The Recent Files and Recent Locations in Dolphin are not listing the recent accessed or used files/folders and show old results while the new apps launcher History shows correclty the recent files/folders.
Comment 1 Nate Graham 2021-05-20 15:03:27 UTC
Works for me.
Comment 2 Méven Car 2021-05-20 15:18:47 UTC
Do you mean the results displayed there are not refreshed as new files and folders are accessed ?

Does hitting F5 work as a workaround ?
Comment 3 medin 2021-05-20 15:23:16 UTC
(In reply to Méven Car from comment #2)
> Do you mean the results displayed there are not refreshed as new files and
> folders are accessed ?
> 
> Does hitting F5 work as a workaround ?

Yes, you are right only after pressing f5 it refreshes the view.
Comment 4 medin 2021-05-21 01:25:41 UTC
Even with refresh, some files and folders are not appearing, and what I found is that access time is broken in KDE because it's never updated when a file is accessed. When I sort recent files/folder by access time column they are not correctly sorted.
Comment 5 Méven Car 2021-05-21 04:41:57 UTC
(In reply to medin from comment #4)
> Even with refresh, some files and folders are not appearing, 

The data there is not refreshed dynamically based on access time, that would not be reasonably feasible.
It is fed by apps instead, which means they need to have support.
KDE apps and Gtk apps should have support out of the box.

Did you notice this missing files or folders with a particular app or mimetype ?

> and what I
> found is that access time is broken in KDE because it's never updated when a
> file is accessed.
> When I sort recent files/folder by access time column they
> are not correctly sorted.

Do you have previews turned on ? I am asking this because it will change access time when dolphin generates a new file preview.
Did you check with on disk data compared to recentlyused:// view ?
I don't reproduce this.

Currently we don't support refreshing this view as new data is added.
This is a known limitation.
Comment 6 Simon Pfeifer 2021-05-23 12:06:03 UTC
For me, even with an F5 refresh hit, some files of the same mime-type do not appear in the recent files view in Dolphin whereas they consistently appear in the recent documents view of the app launcher. Same with folders.
Comment 7 Bug Janitor Service 2021-06-07 04:33:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 8 medin 2021-06-07 09:52:43 UTC
With new fresh account it seems to work fine but it always needs pressing F5.
Comment 9 Dominik Kummer 2021-09-21 21:01:00 UTC
Even with a fresh account "Recent Files" and "Recent Locations" does not work for me. "Recent Files/Locations" though does work in Application Launcher, but not in Dolphin neither in KFiledialog. Actually I don't know since when this bug occurs to me, because I activated "remember history" in Activity Settings/Privacy only for testing today. Are "Recent Files" and "Activity History" actually related?
Btw how do I add additional applications to the list in Activity Settings/Privacy?
Comment 10 Méven Car 2021-10-18 10:41:53 UTC
(In reply to Dominik Kummer from comment #9)
> Even with a fresh account "Recent Files" and "Recent Locations" does not
> work for me. "Recent Files/Locations" though does work in Application
> Launcher, but not in Dolphin neither in KFiledialog.

Dolphin and KFiledialog share the same backend it is expected to have the same issues.

> Actually I don't know
> since when this bug occurs to me, because I activated "remember history" in
> Activity Settings/Privacy only for testing today.

Does it means the bug does not occur for you anymore now you turned on "remember history" in Activity Settings?

That would be expected "Recent Files/Locations" in dolphin are using KActivity backend, or at least a prerequist to have this option activated.
You can use instead "recentdocuments:/" but it is a lot useful.

>. Are "Recent Files" and "Activity History" actually related?

"Recent Files/Locations" and "Activity History" are implemented through the same kactivity backend, it saves applications accessed and file access while retaining the activity context.
More details if you are interested at http://www.bivouak.fr/recently-used-ioslave/

> Btw how do I add additional applications to the list in Activity
> Settings/Privacy?

Those applications for which we had received some activity in past. That is they have a recent accessed files list, or, like dolphin and gwenview deeper integration.
If there are not visible there, that means the applications does not expose any activity "hint" or not in a way KActivity supports (it support KDE Apps and GTK Apps currently).

(In reply to Simon Pfeifer from comment #6)
> For me, even with an F5 refresh hit, some files of the same mime-type do not
> appear in the recent files view in Dolphin whereas they consistently appear
> in the recent documents view of the app launcher. Same with folders.

Do you a 30 elements in Recent files ?
You can have virtual folders for mimetype or more files listed by editing the location url or edit your place in the place bar.
More details if you are interested at http://www.bivouak.fr/recently-used-ioslave/
Comment 11 Thomas Bertels 2024-07-17 15:48:35 UTC
About the sorting problem, it may be because Dolphin uses the file / folder access time from the filesystem.
And if the fstab is configured to noatime, the access time may be as old as the creation time.

So I suggest always using the time from the DB for the recent locations and files access time unless the access time from the filesystem is newer.
Comment 12 Méven Car 2024-08-13 08:30:59 UTC
> So I suggest always using the time from the DB for the recent locations and files access time unless the access time from the filesystem is newer.

The access time is set from the DB for the recent locations and files access time currently.
Comment 13 Thomas Bertels 2024-08-13 19:23:55 UTC
(In reply to Méven Car from comment #12)
> The access time is set from the DB for the recent locations and files access
> time currently.

That may be true for the app launcher since they're correctly sorted, but not for Dolphin where the access time column refers to the access time returned by the file system.
Comment 14 Bug Janitor Service 2024-09-13 14:03:20 UTC
A possibly relevant merge request was started @ https://invent.kde.org/system/dolphin/-/merge_requests/825
Comment 15 Méven Car 2024-09-13 14:04:35 UTC
(In reply to Thomas Bertels from comment #13)
> (In reply to Méven Car from comment #12)
> > The access time is set from the DB for the recent locations and files access
> > time currently.
> 
> That may be true for the app launcher since they're correctly sorted, but
> not for Dolphin where the access time column refers to the access time
> returned by the file system.

What I was saying, was about dolphin.
That's what kio-extras recentlyused:/ does.

In dolphin, are you sorting with the "modification time", instead of the "access time", by any chance ?
That would be more evident in the details view.
This is not the default sorting applied to recentlyused:/ but it should be.

I made a MR to change this:
> https://invent.kde.org/system/dolphin/-/merge_requests/825

The KDE file dialog is sorting by modification date though indeed.
That's a separate issue from dolphin.
Comment 16 Thomas Bertels 2024-09-15 08:54:36 UTC
(In reply to Méven Car from comment #15)
> In dolphin, are you sorting with the "modification time", instead of the
> "access time", by any chance ?

No, I'm sorting by "access time", not that it makes a difference because the "access time" is the same as the "modification time" when the filesystem is mounted with noatime.
Comment 17 Méven Car 2024-09-15 09:57:34 UTC
(In reply to Thomas Bertels from comment #16)
> (In reply to Méven Car from comment #15)
> > In dolphin, are you sorting with the "modification time", instead of the
> > "access time", by any chance ?
> 
> No, I'm sorting by "access time", not that it makes a difference because the
> "access time" is the same as the "modification time" when the filesystem is
> mounted with noatime.

Thanks, I didn't pay attention to the `noatime` that would explain, access time can be default filled with modification time, but here we have a provided access time already.
Comment 18 Bug Janitor Service 2024-09-15 10:18:51 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kio-extras/-/merge_requests/373
Comment 19 Méven 2024-09-15 13:53:11 UTC
Git commit b1ac3729bac0a3b1bc489712218ff9d97e20557a by Méven Car.
Committed on 15/09/2024 at 13:51.
Pushed by meven into branch 'master'.

ViewProperties: sort by accesstime for recentlyused

By default.

Since recentlyused:/ fills only access time based on the DB data.

timeline:/ is also included.

M  +4    -2    src/views/viewproperties.cpp

https://invent.kde.org/system/dolphin/-/commit/b1ac3729bac0a3b1bc489712218ff9d97e20557a
Comment 20 Méven 2024-09-15 17:32:25 UTC
Git commit d5808fd0700718b50cf97b50397c1951612aa0ab by Méven Car.
Committed on 15/09/2024 at 13:58.
Pushed by meven into branch 'master'.

recentlyused: override access time date with Backend value

When access time is the same as creation time or modification time.
That probably means the user is using noatime.

M  +6    -2    recentlyused/recentlyused.cpp

https://invent.kde.org/network/kio-extras/-/commit/d5808fd0700718b50cf97b50397c1951612aa0ab