Skip to content

Commit bc2bb2b

Browse files
author
BRUNER Patrick
committed
fixing #517
1 parent 2c5daec commit bc2bb2b

3 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/LogExpert.Configuration/ConfigManager.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ public void AddToFileHistory (string fileName)
281281
Save(SettingsFlags.FileHistory);
282282
}
283283

284+
public void ClearLastOpenFilesList ()
285+
{
286+
lock (_loadSaveLock)
287+
{
288+
Instance.Settings.LastOpenFilesList.Clear();
289+
}
290+
}
291+
284292
#endregion
285293

286294
#region Private Methods

src/LogExpert.Core/Interface/IConfigManager.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,13 @@ public interface IConfigManager
151151
/// This method is supported only on Windows platforms.</remarks>
152152
/// <param name="fileName">The name of the file to add to the file history list. Comparison is case-insensitive.</param>
153153
void AddToFileHistory (string fileName);
154+
155+
/// <summary>
156+
/// Clears the list of recently opened files.
157+
/// </summary>
158+
/// <remarks>Call this method to remove all entries from the recent files list, typically to reset user
159+
/// history or in response to a privacy-related action. After calling this method, the list of last open files will
160+
/// be empty until new files are opened.</remarks>
161+
162+
void ClearLastOpenFilesList ();
154163
}

src/LogExpert.UI/Dialogs/LogTabWindow/LogTabWindow.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,8 +909,7 @@ private void DestroyBookmarkWindow ()
909909

910910
private void SaveLastOpenFilesList ()
911911
{
912-
ConfigManager.Settings.LastOpenFilesList.Clear();
913-
foreach (DockContent content in dockPanel.Contents)
912+
foreach (DockContent content in dockPanel.Contents.Cast<DockContent>())
914913
{
915914
if (content is LogWindow.LogWindow logWin)
916915
{
@@ -2246,6 +2245,8 @@ private void OnLogTabWindowLoad (object sender, EventArgs e)
22462245
AddFileTab(name, false, null, false, null);
22472246
}
22482247
}
2248+
2249+
ConfigManager.ClearLastOpenFilesList();
22492250
}
22502251

22512252
if (_startupFileNames != null)

0 commit comments

Comments
 (0)