Bug 480276 - "Forget Recent [thing]" menu items do not work for some apps
Summary: "Forget Recent [thing]" menu items do not work for some apps
Status: ASSIGNED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: master
Platform: openSUSE Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-01-24 14:31 UTC by rosswzyang
Modified: 2024-08-13 08:53 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rosswzyang 2024-01-24 14:31:00 UTC
SUMMARY
***
forget recent files cannot work in taskmanager
***


STEPS TO REPRODUCE
1. right click on firefox
2. click the "forget the recent files"

OBSERVED RESULT
forget recent files cannot work in taskmanager

EXPECTED RESULT
forget recent files can work in taskmanager

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20240122
KDE Plasma Version: 6.0.80
KDE Frameworks Version: 5.249.0
Qt Version: 6.6.1
Kernel Version: 6.6.11-1-default (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7735HS with Radeon Graphics


ADDITIONAL INFORMATION
Comment 1 rosswzyang 2024-01-24 14:32:36 UTC
(In reply to rosswzyang from comment #0)
> SUMMARY
> ***
> forget recent files cannot work in taskmanager
> ***
> 
> 
> STEPS TO REPRODUCE
> 1. right click on firefox
> 2. click the "forget the recent files"
> 
> OBSERVED RESULT
> forget recent files cannot work in taskmanager
> 
> EXPECTED RESULT
> forget recent files can work in taskmanager
> 
> SOFTWARE/OS VERSIONS
> Operating System: openSUSE Tumbleweed 20240122
> KDE Plasma Version: 6.0.80
> KDE Frameworks Version: 5.249.0
> Qt Version: 6.6.1
> Kernel Version: 6.6.11-1-default (64-bit)
> Graphics Platform: Wayland
> Processors: 16 × AMD Ryzen 7 7735HS with Radeon Graphics
> 
> 
> ADDITIONAL INFORMATION

I mean when firefox is pinned on the task manager, then click the "forget recent files "
Comment 2 Nate Graham 2024-01-24 20:31:16 UTC
Can reproduce in Firefox. Restarting plasmashell does not make them disappear.

Interestingly, it seems to be specific to certain apps or entries. I can always reproduce the issue in Firefox, but it works in Thunderbird, VLC, and Elisa. In Kate "Forget Recent Files" works, but "Forget Recent Connections" does not work.

Another data point: the menu items that do not work are failing to clear entries that have question mark icons. So maybe it's trying to validate that those items before deleting them, and when it fails to, it doesn't remove them?
Comment 3 Nate Graham 2024-01-24 20:33:35 UTC
Ah, in Kate, my "forget recent files" menu item becomes a "Forget recent connections" item because it succeeds in forgetting all the files, and then the one thing that's left is a web URL for some reason. And that's marked with question mark and fails to be forgotten.
Comment 4 Méven Car 2024-01-28 18:32:26 UTC
(In reply to Nate Graham from comment #2)
> Can reproduce in Firefox. Restarting plasmashell does not make them
> disappear.
> 
> Interestingly, it seems to be specific to certain apps or entries. I can
> always reproduce the issue in Firefox, but it works in Thunderbird, VLC, and
> Elisa. In Kate "Forget Recent Files" works, but "Forget Recent Connections"
> does not work.
> 
> Another data point: the menu items that do not work are failing to clear
> entries that have question mark icons. So maybe it's trying to validate that
> those items before deleting them, and when it fails to, it doesn't remove
> them?

I suspect that's because those entries are still in `recently-used.xbel` and re-added by subsequent scans of the file by kactivitymanagerd.

Could anyone confirm the file in `~/.local/share/recently-used.xbel` contains references to the files that have not disappeared/reappeared?
Comment 5 Nate Graham 2024-01-29 17:29:25 UTC
I can pretty much confirm that. In my case all the actual files are cleared properly, but ~/.local/share/recently-used.xbel is full of URLs as well as files. For example one of the entries that won't clear from Firefox's recent items list is listed in the menu as "J27HoZM_PTI", but in recently-used.xbel it's listed thusly:

  <bookmark href="https://youtu.be/J27HoZM_PTI" added="2024-01-29T14:39:55.250000Z" modified="2024-01-29T14:39:55.250000Z" visited="2024-01-29T14:39:55.250000Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="application/octet-stream"/>
        <bookmark:applications>
          <bookmark:application name="firefox" exec="firefox %u" modified="2024-01-29T14:39:55.250000Z" count="1"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>

Seems like it's confusing URLs for files in some cases?
Comment 6 Méven Car 2024-02-20 10:30:29 UTC
(In reply to Nate Graham from comment #5)
> I can pretty much confirm that. In my case all the actual files are cleared
> properly, but ~/.local/share/recently-used.xbel is full of URLs as well as
> files.

So the kactivitymanagerd daemon should clear the entries from recentlyused.xbel as well, which makes sense, since the history there should be equivalent to the data in kactivitystat.

> For example one of the entries that won't clear from Firefox's recent
> items list is listed in the menu as "J27HoZM_PTI", but in recently-used.xbel
> it's listed thusly:
> 
>   <bookmark href="https://youtu.be/J27HoZM_PTI"
> added="2024-01-29T14:39:55.250000Z" modified="2024-01-29T14:39:55.250000Z"
> visited="2024-01-29T14:39:55.250000Z">
>     <info>
>       <metadata owner="http://freedesktop.org">
>         <mime:mime-type type="application/octet-stream"/>
>         <bookmark:applications>
>           <bookmark:application name="firefox" exec="firefox %u"
> modified="2024-01-29T14:39:55.250000Z" count="1"/>
>         </bookmark:applications>
>       </metadata>
>     </info>
>   </bookmark>
> 
> Seems like it's confusing URLs for files in some cases?

Yes, it seems so. file:// seem to work but not https://
This should easy to fix.
Comment 7 Ronald 2024-07-26 04:58:27 UTC
"Forget Recent Connetions" does not forget all connections.
In my case, connetions opened by goldendict-ng can not be forgotten.

Sovled manually as below
1. delete "~/.local/share/recently-used.xbel", it contain the connections that can't be forgotton, but it doesn't solve the problem
2. delete everything in ".local/share/kactivitymanagerd/resources", and reboot, the problem is solved
BTW, not sure if step 2 solves the problem without step 1.
Comment 8 Bug Janitor Service 2024-07-27 08:57:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1670
Comment 9 Bug Janitor Service 2024-07-27 10:15:10 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4560
Comment 10 Méven 2024-08-13 08:53:34 UTC
Git commit fdcf394c61d1a1276a79974b2ab17a97651dd26f by Méven Car.
Committed on 13/08/2024 at 08:41.
Pushed by meven into branch 'master'.

KRecentDocument: add removeApplication and removeUrl

And removeBookmarksModifiedSince.
To be able to clean the history.

M  +86   -2    autotests/krecentdocumenttest.cpp
M  +3    -0    autotests/krecentdocumenttest.h
M  +216  -35   src/core/krecentdocument.cpp
M  +11   -0    src/core/krecentdocument.h

https://invent.kde.org/frameworks/kio/-/commit/fdcf394c61d1a1276a79974b2ab17a97651dd26f