Bug 100532 - Clear Recent Documents does not clear the ones from the dock.
Summary: Clear Recent Documents does not clear the ones from the dock.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 115926 124137 147883 157139 158318 (view as bug list)
Depends on:
Blocks: macOS-UI-polish Recent-Document-List Desktop-Integration
  Show dependency treegraph
 
Reported: 2016-06-21 22:39 UTC by Jim Sewell
Modified: 2023-11-22 12:57 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Attachments
picture of the two recents menus, which should be identical (531.34 KB, image/png)
2018-03-08 20:54 UTC, Ted Lee
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Sewell 2016-06-21 22:39:04 UTC
User-Agent:       Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
Build Identifier: LibreOffice 5.0-34

When I Clear List under Recent Documents it clears that list but not the list that can be obtained from right clicking the CollaboraOffice icon in the Dock.  This is a confidentiality issue for our non-profit.

Reproducible: Always

Steps to Reproduce:
1.Open a document
2.Clear List
3.Right Click on dock - they are still there.
Actual Results:  
My most recent 8 documents were listed.

Expected Results:  
There to be none since they were cleared.

[Information automatically included from LibreOffice]
Locale: en-US
Module: StartModule
[Information guessed from browser]
OS: Mac OS X (All)
OS is 64bit: no


Reset User Profile?Yes, no help.
Comment 1 Alex Thurgood 2016-06-22 09:21:03 UTC
Confirming also on

Version: 5.3.0.0.alpha0+
Build ID: 25537cc4baf0523046485fb0bc2d5e7263d705a8
CPU Threads: 2; OS Version: Mac OS X 10.11.5; UI Render: default; 
Locale: fr-FR (fr.UTF-8)
Comment 2 Telesto 2016-11-14 12:28:36 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2017-11-15 09:15:45 UTC Comment hidden (obsolete)
Comment 4 eisa01 2017-11-18 21:55:47 UTC
Still present

Version: 5.4.3.2
Build ID: 92a7159f7e4af62137622921e809f8546db437e5
CPU threads: 2; OS: Mac OS X 10.12.6; UI render: default; 
Locale: en-GB (en_US.UTF-8); Calc: group
Comment 5 Alex Thurgood 2018-02-22 07:57:32 UTC
*** Bug 115926 has been marked as a duplicate of this bug. ***
Comment 6 Ted Lee 2018-02-22 19:34:26 UTC
I do not think it is an Apple bug.  I don't have a lot of apps that enable/support a contextual recents list in the dock, but I did check several (not an exhaustive test of every app, of course) that do. 

The following ones exhibited the expected ("correct") behavior, i.e. they cleared the recents list in the dock when it was cleared from their "open recent files" (or equivalent) menu entry:

textedit
preview
*vlc
pages

The following ones exhibited the "wrong" behavior, i.e. they did not clear the dock list:

*text wrangler
*neo office
(this one) *libreoffice

* means non-Apple program

All were, I believe, the most recent versions.
So, in the spirit of this thread, if my bug report has gotten lost, I can also report it is still present in LibreOffice 6.0.1.1 as of this date.  I'm sorry I couldn't find the original report when I filed mine, although I did look for one.
Comment 7 Ted Lee 2018-03-08 20:54:57 UTC
Created attachment 140489 [details]
picture of the two recents menus, which should be identical
Comment 8 Ted Lee 2018-03-08 20:56:08 UTC
I think a better description of this bug might be "dock app contextual menu not synchronized with LibreOffice File > Recents menu(s)".  I'm attaching a screen shot of the two menus -- the contextual one from the dock is to the left, the one on the right is what you get by following File > Recent Documents from the dock contextual menu.  If you do File > Recent Documents from the app's menu at the top of the screen, you have the same list.  The menus should of course be the same.  When I created a new document and opened it, it did get added to the bottom of both menus, and the first one on the menu to the left was dropped.  For what it's worth, I dug all around the Application Support / Preferences files and couldn't find any that seem to be where the dock's recent file lists are kept, even though according to some documentation I read they are supposed to be in the com.apple.LSSharedFileList.ApplicationRecentDocuments folder under the appropriate app.  (There is one there for LibreOffice but it doesn't seem to affect anything if I delete it.) So as far as I can tell, there isn't even a simple workaround for resetting the list!  Yes, I tried killing the dock and/or rebooting in safe mode.
Comment 9 Ted Lee 2018-03-09 03:43:17 UTC
Found sort of a work around after all.  It turns out you can delete the properties list that contains the list of recent documents for an app, but to have the deletion take effect you have to log out of the account; for some reason rebooting (safe or normal) doesn't delete whatever cache the Dock's info is kept in.  For LibreOffice the file of interest is ~Library/ Application Support/ com.apple.sharedfilelist/ com.apple.LSSharedFileList.ApplicationRecentDocuments/ org.libreoffice.script.sfl2
(spaces inserted to allow line wrap.)

One interesting thing I discovered is that the files are identified in that file by some kind of unique identifier.  If you change the name of a file, you can still open it via the Dock contextual menu -- but not via the File > Recent Documents menu(s) in LibreOffice.  While I can't figure out the structure of the recent documents file, it is clear the filenames are not in it as plain text strings.  There are about 1,000 bytes per file, most of which appears to the little icon that is displayed next to the file name.

The bug is (obviously?) that when LibreOffice deletes a file from its internal recent file list it doesn't tell the Dock to do so too;  I presume there is some API for that.
Comment 10 Telesto 2018-03-09 08:52:37 UTC
(In reply to Ted Lee from comment #9)
> The bug is (obviously?) that when LibreOffice deletes a file from its
> internal recent file list it doesn't tell the Dock to do so too;  I presume
> there is some API for that.

Maybe something like this: https://developer.apple.com/documentation/appkit/nsdocumentcontroller/1514933-clearrecentdocuments?language=objc
Comment 11 Telesto 2018-03-09 22:16:15 UTC
The Recent Documents implementation is odd ..
1. The regular 'jumplist' in the dock
2. A second - unnecessary? - version under File -> Recent Documents 

-----
1. The regular one
The adding part of the regular 'jumplist' is managed here:
https://opengrok.libreoffice.org/xref/core/vcl/osx/salinst.cxx#936

More specific:
NSDocumentController* pCtrl = [NSDocumentController sharedDocumentController];
[pCtrl noteNewRecentDocumentURL: pURL];

It's possible to clear the Apple Dock document list using something like this:
[pCtrl clearRecentDocuments:nil]

probably in connection with this
https://opengrok.libreoffice.org/xref/core/include/unotools/historyoptions.hxx#73

Only no clue how to do that (not a DEV). 

---
2. The second Recent Documents list is managed in here:
https://opengrok.libreoffice.org/xref/core/sfx2/source/appl/shutdowniconaqua.mm
Comment 12 Telesto 2018-03-09 22:20:14 UTC
@Tor
Thought you might be interested in this one.
Comment 13 QA Administrators 2019-03-11 03:47:41 UTC Comment hidden (obsolete)
Comment 14 V Stuart Foote 2019-03-18 17:27:46 UTC
*** Bug 124137 has been marked as a duplicate of this bug. ***
Comment 15 Robert Blair 2019-03-18 23:55:57 UTC
Still present in version 6.2.1.2. I'm curious as to why this bug has persisted for so long. There are reports for almost three years. It's not as though this is a feature, dock icon recent file list, is unique to LibreOffice but yet it's ongoing. Wow!
Comment 16 Robert Blair 2019-03-20 17:37:59 UTC
(In reply to Ted Lee from comment #9)
> Found sort of a work around after all.  It turns out you can delete the
> properties list that contains the list of recent documents for an app, but
> to have the deletion take effect you have to log out of the account; for
> some reason rebooting (safe or normal) doesn't delete whatever cache the
> Dock's info is kept in.  For LibreOffice the file of interest is ~Library/
> Application Support/ com.apple.sharedfilelist/
> com.apple.LSSharedFileList.ApplicationRecentDocuments/
> org.libreoffice.script.sfl2
> (spaces inserted to allow line wrap.)
> 
> One interesting thing I discovered is that the files are identified in that
> file by some kind of unique identifier.  If you change the name of a file,
> you can still open it via the Dock contextual menu -- but not via the File >
> Recent Documents menu(s) in LibreOffice.  While I can't figure out the
> structure of the recent documents file, it is clear the filenames are not in
> it as plain text strings.  There are about 1,000 bytes per file, most of
> which appears to the little icon that is displayed next to the file name.
> 
> The bug is (obviously?) that when LibreOffice deletes a file from its
> internal recent file list it doesn't tell the Dock to do so too;  I presume
> there is some API for that.

Thanks for providing that solution. Although this is just a very small nuisance; it doesn't make any sense that this couldn't have been addressed already.
I can confirm that moving/renaming this file has worked to remove the recent files list which was persistent in the dock icon menu. Instead of deleting this file; you can rename it with a *.bak extension for preservation in case you ever need to restore it. You will lose the option for recent files to be listed. But, if you're at the point whereby you searched for a solution, then you won't really care. There's probably a more elegant solution with a script or API which would still keep that function. I really don't understand why the developers haven't incorporated this with the remove recent files function.

As Ted Lee stated:
Just navigate to the directory which I used Terminal.
'cd ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/'
Then I renamed the file with 'mv org.libreoffice.script.sfl2 org.libreoffice.script.sfl2.bak'
Comment 17 Robert Blair 2019-03-20 18:10:30 UTC
Did a quick search and here's some information related to the *.sfl2 files. Apple switched the plist file to use NSKeyedArchiver and needs to be opened in a binary editor. Previously, you could edit *.sfl files with a basic text editor. Maybe the python script linked would be of some use.

Python script to parse MRU files
https://github.com/mac4n6/macMRU-Parser

Blog of the developer for the Python script
https://www.mac4n6.com/blog/2016/1/1/manual-analysis-of-nskeyedarchiver-formatted-plist-files-a-review-of-the-new-os-x-1011-recent-items

Eclectic Light Company post on shared lists
https://eclecticlight.co/2017/08/10/recent-items-launch-services-and-sharedfilelists/
Comment 18 Robert Blair 2019-03-21 20:40:47 UTC
The bug is still present.

Version: 6.2.2.2
Build ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d
CPU threads: 8; OS: Mac OS X 10.14.3; UI render: default; VCL: osx; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

BTW. For those using the workaround to either delete/rename the "org.libreoffice.script.sfl2" file, instead of needing to reboot/shutdown, you can just kill the background service.

To reiterate.
0. Open terminal
1. Navigate to the file directory with 'cd ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/'
2. Rename/move/delete the file "org.libreoffice.script.sfl2" with either 'mv' or 'rm'
3. Restart the background service with 'killall sharedfilelistd'
4. Reopen LibreOffice to check the dock icon context menu for no recent files

Just a caveat, the file will be recreated when it's not present and you have began a new session of opening/creating files with LibreOffice. So, removing the file would be better for garbage collection of back ups.
Comment 19 QA Administrators 2021-03-21 04:17:17 UTC Comment hidden (obsolete)
Comment 20 eisa01 2021-04-02 16:20:12 UTC
This is still present

Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 465b8b0e9ad4b0c9c7701dee2820a99c5d00b5bf
CPU threads: 4; OS: Mac OS X 10.14.6; UI render: default; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 21 steve 2022-10-02 15:46:37 UTC
Persisting in Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 2a7fcaf582df3ada57ca519b50e29011973a1b6f
CPU threads: 8; OS: Mac OS X 12.6; UI render: default; VCL: osx
Locale: de-DE (en_DE.UTF-8); UI: en-US
Calc: threaded
Comment 22 steve 2022-10-02 15:50:00 UTC
As per fix for https://bugs.documentfoundation.org/show_bug.cgi?id=55922 the right-click menu "Recent Documents" is gone.

This report however is still valid since clearing recent documents from start center does not remove those documents from showing up when righ-clicking the icon in dock.
Comment 23 Buovjaga 2023-11-22 12:57:45 UTC
*** Bug 147883 has been marked as a duplicate of this bug. ***
Comment 24 Buovjaga 2023-11-22 12:57:50 UTC
*** Bug 157139 has been marked as a duplicate of this bug. ***
Comment 25 Buovjaga 2023-11-22 12:57:57 UTC
*** Bug 158318 has been marked as a duplicate of this bug. ***