mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Ensure history items have valid icons in QueryHistory
Added CheckIcoPathValidity to QueryHistory to set default icons for history items missing IcoPath, addressing legacy data issues. Integrated this check into MainViewModel's RefreshLastOpenedHistoryResults to guarantee icon validity before updating absolute paths.
This commit is contained in:
parent
f22b6449d4
commit
e6a91a9959
2 changed files with 19 additions and 1 deletions
|
|
@ -51,6 +51,24 @@ namespace Flow.Launcher.Storage
|
|||
Items.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks all items in <see cref="LastOpenedHistoryItems"/> for empty IcoPath.
|
||||
/// If found, updates it using the history icon.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We need this because some prereleased version of Flow did not set the IcoPath when adding.
|
||||
/// </remarks>
|
||||
public void CheckIcoPathValidity()
|
||||
{
|
||||
foreach (var item in LastOpenedHistoryItems)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.IcoPath))
|
||||
{
|
||||
item.IcoPath = Constant.HistoryIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Records a result into the last-opened history list (<see cref="LastOpenedHistoryItems"/>).
|
||||
/// This will also update the IcoPath if existing history item has one that is different.
|
||||
|
|
|
|||
|
|
@ -1403,7 +1403,7 @@ namespace Flow.Launcher.ViewModel
|
|||
internal void RefreshLastOpenedHistoryResults()
|
||||
{
|
||||
_history.PopulateHistoryFromLegacyHistory();
|
||||
|
||||
_history.CheckIcoPathValidity();
|
||||
_history.UpdateIcoPathAbsolute();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue