Bug 470405

Summary: recently-used.xbel is keep populating even with UseRecent=false
Product: [Frameworks and Libraries] frameworks-kio Reporter: serfreeman1337 <serfreeman1337>
Component: generalAssignee: KIO Bugs <kio-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: kdelibs-bugs-null, meven29, nate, nicolas.fella
Priority: NOR    
Version First Reported In: 5.106.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 6.0.0
Sentry Crash Report:

Description serfreeman1337 2023-05-29 10:23:45 UTC
File ~/.local/share/recently-used.xbel is keep populating even with UseRecent=false in RecentDocuments config group.

I think addToXbel should be after this conditional check:
https://invent.kde.org/frameworks/kio/-/blob/master/src/core/krecentdocument.cpp#L509
Comment 1 Nate Graham 2023-06-05 03:51:19 UTC
Sounds good! Wanna do it? :)
Comment 2 Méven Car 2023-06-23 08:25:34 UTC
This file is not populated only by KDE software.

What was/were the applications that added historic data ?

You will see our implementation does enforce this setting.
https://invent.kde.org/frameworks/kio/-/blob/master/src/core/krecentdocument.cpp#L526

This could be considered a bug about this comment in commit https://invent.kde.org/frameworks/kio/-/commit/16e8d3151c31dd3695f4da2aa3536eb5cd156edc:

> The constraints are enforced at add time, meaning data added by other
libraries (GTK) will not respect those. We still need a daemon to
enforce this. This could be the activitymanagerd daemon, that already monitors the xbel file.
Comment 3 serfreeman1337 2023-06-23 09:58:17 UTC
> You will see our implementation does enforce this setting.
It wasn't before mentioned commit was merged, where addToXbel was executing before any checks:
https://invent.kde.org/frameworks/kio/-/commit/16e8d3151c31dd3695f4da2aa3536eb5cd156edc#05012c7c5abbd196d468a9c8ca973dc68c17c082_495_519

I even see that there was an attempt to backport it kf5, which was reverted:
https://invent.kde.org/frameworks/kio/-/commit/90357ac0394030a607d69a26dca5d6a0a64b42b0#05012c7c5abbd196d468a9c8ca973dc68c17c082_497_483

With KF 5.107.0 opening any file in Dolpin or saving screenshot with Spectacle will result in write to recently-used.xbel.
Comment 4 Méven Car 2023-06-23 10:00:43 UTC
All right, so this a simple to fix KF5bug.