If you try to open a document from the mentioned pick list, you may get the message that the file does not exist. There is no option to delete the entry from the list.
If the start-center is shown, the mentioned pick list is not available, but the main area of the view shows links to the entries. If you now click on the link to a deleted, moved, or renamed file, you also get the error message, but now the link (“thumbnail”) has a sensitive area (top right) clickable with the effect that the entry is removed.
Most time during a LibreOffice session the start-center will not be visible.
How to remove a dead link now?
I’m specifically interested in a way to do it by user code.
Thanks to all who answered and commented.
Concerning the download I simply was too silly. Please still bear with me.
Concerning the suggested extension I spent some time trying to understand it.
M. Marcelly surely has great knowledge, and he used means in ways I didn’t know of. Very interesting.
But I think I understood that he fears inconsistencies of the ‘History’, be they already found, or induced by a (his?) user program. However, deleting and rebuilding the lists seems to me to be a very radical workaround. I do not want to follow that. To care for the consistency of the recent documents history (and all the registrymodifications) is an original responsibility of the application.
Despite my appreciation for the extension, I will not use it. I also don’t really like the main dialog, and extending the functionality of the ‘Load URL’ dropdown only worked for me (under LibO 7.5.0.3) on the first try.
Special thanks to @sokol92. Yes. I often disregarded the Tools library. Let’s see if I’m still capable of learning.
Concerning the background: I am on the CC for an old enhancement request. Now the solution was announced. 56696 – No option to make recent documents list show items for just the currently active LibO module
Thanks for the hint. But…
Last version from 2009.
Download offered only using a service closed since 2016.
All the stuff I saw in French.
If you have the code (oxt) I’m interested, However, I suppose the extension needs to tamper with the registrymodifications.xcu
, and that may be dangerous to the stability.
Well, there seems to be no sufficiently supporting service, and the ways I can imagine would need a lot of tampering with …
We can try like this:
Option Explicit
Sub CleanHistory()
Dim oNode As Object, ItemList As Object, OrderList As Object, oItem As Object, SFA
Dim i As Long, j As Long, n As Long, fileName As String, nDeleted As Long, s As String
SFA = CreateUnoService("com.sun.star.ucb.SimpleFileAccess")
With GlobalScope.Basiclibraries
If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools")
End With
On Error GoTo ErrLabel
oNode=GetRegistryKeyContent("org.openoffice.Office.Histories/Histories/PickList", True)
OrderList=oNode.OrderList
ItemList=oNode.ItemList
On Error GoTo 0
j=-1
For i=0 To UBound(OrderList.ElementNames)
oItem=OrderList.getByName(Cstr(i))
fileName=oItem.HistoryItemRef
If Not SFA.exists(fileName) Then
nDeleted=nDeleted+1
DeleteFromItemList ItemList,fileName
s=IIf(s="", "", s & Chr(10)) & ConvertFromUrl(FileName)
Else
j=j+1
If j<i Then ' replace OrderList[j] with OrderList[i]
OrderList.getByName(Cstr(j)).HistoryItemRef=FileName
End If
End If
Next i
For i=j+1 To UBound(OrderList.ElementNames) ' delete Items
OrderList.removeByName Cstr(i)
Next i
If ndeleted=0 Then
Msgbox "The list of recently opened files is up to date"
Else
If Msgbox("Recently opened files that don't exist:" & Chr(10) & s & Chr(10) & Chr(10) & _
"Remove these files from the List?", MB_YESNO + MB_ICONQUESTION) = IDYES Then
oNode.commitChanges
End If
End If
Exit Sub
ErrLabel:
Msgbox "An error occurred while executing the CleanHistory function", MB_ICONSTOP
End Sub
Sub DeleteFromItemList(Byval ItemList as Object, ByVal fileName As String)
On Error GoTo ErrLabel
ItemList.RemovebyName fileName
ErrLabel:
End Sub