refactor: renaming executed history to last opened history

This commit is contained in:
01Dri 2025-10-02 00:09:28 -03:00
parent c0369e6e76
commit bc1f9d3734
6 changed files with 28 additions and 28 deletions

View file

@ -226,25 +226,25 @@ namespace Flow.Launcher.Infrastructure.UserSettings
{
_showHistoryQueryResultsForHomePage = value;
OnPropertyChanged();
if (value && _showHistoryExecutedResultsForHomePage)
if (value && _showHistoryLastOpenedResultsForHomePage)
{
_showHistoryExecutedResultsForHomePage = false;
OnPropertyChanged(nameof(ShowHistoryExecutedResultsForHomePage));
_showHistoryLastOpenedResultsForHomePage = false;
OnPropertyChanged(nameof(ShowHistoryLastOpenedResultsForHomePage));
}
}
}
}
private bool _showHistoryExecutedResultsForHomePage = false;
public bool ShowHistoryExecutedResultsForHomePage
private bool _showHistoryLastOpenedResultsForHomePage = false;
public bool ShowHistoryLastOpenedResultsForHomePage
{
get => _showHistoryExecutedResultsForHomePage;
get => _showHistoryLastOpenedResultsForHomePage;
set
{
if (_showHistoryExecutedResultsForHomePage != value)
if (_showHistoryLastOpenedResultsForHomePage != value)
{
_showHistoryExecutedResultsForHomePage = value;
_showHistoryLastOpenedResultsForHomePage = value;
OnPropertyChanged();
if (value && _showHistoryQueryResultsForHomePage)
{

View file

@ -167,9 +167,9 @@
<system:String x:Key="homePageHistory">Home Page History</system:String>
<system:String x:Key="homePageHistoryTooltip">Choose the type of history to show on the home page</system:String>
<system:String x:Key="queryHistory">Query History</system:String>
<system:String x:Key="executedHistory">Executed History</system:String>
<system:String x:Key="executedHistory">Last Opened History</system:String>
<system:String x:Key="historyQueryResultsForHomePage">Show History Query Results in Home Page</system:String>
<system:String x:Key="historyExecutedResultsForHomePage">Show History Executed Results in Home Page</system:String>
<system:String x:Key="historyLastOpenedResultsForHomePage">Show History Last Opened Results in Home Page</system:String>
<system:String x:Key="historyResultsCountForHomePage">Maximum History Results Shown in Home Page</system:String>
<system:String x:Key="homeToggleBoxToolTip">This can only be edited if plugin supports Home feature and Home Page is enabled.</system:String>
<system:String x:Key="showAtTopmost">Show Search Window at Foremost</system:String>

View file

@ -377,8 +377,8 @@
<StackPanel Margin="15,10,0,0">
<RadioButton GroupName="HistoryType" Content="{DynamicResource historyQueryResultsForHomePage}"
IsChecked="{Binding Settings.ShowHistoryQueryResultsForHomePage}" />
<RadioButton GroupName="HistoryType" Content="{DynamicResource historyExecutedResultsForHomePage}"
IsChecked="{Binding Settings.ShowHistoryExecutedResultsForHomePage}"
<RadioButton GroupName="HistoryType" Content="{DynamicResource historyLastOpenedResultsForHomePage}"
IsChecked="{Binding Settings.ShowHistoryLastOpenedResultsForHomePage}"
Margin="0 0 0 0" />
<cc:Card Title="{DynamicResource historyResultsCountForHomePage}" Type="InsideFit" Margin="0 10 0 0">

View file

@ -8,14 +8,14 @@ using Flow.Launcher.Plugin;
using Flow.Launcher.ViewModel;
namespace Flow.Launcher.Storage;
public class ExecutedHistory
public class LastOpenedHistory
{
[JsonInclude] public List<ExecutedHistoryItem> Items { get; private set; } = [];
[JsonInclude] public List<LastOpenedHistoryItem> Items { get; private set; } = [];
private const int MaxHistory = 300;
public void Add(Result result)
{
var item = new ExecutedHistoryItem
var item = new LastOpenedHistoryItem
{
Title = result.Title,
SubTitle = result.SubTitle,

View file

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Storage;
public class ExecutedHistoryItem
public class LastOpenedHistoryItem
{
public string Title { get; set; } = string.Empty;
public string SubTitle { get; set; } = string.Empty;

View file

@ -41,11 +41,11 @@ namespace Flow.Launcher.ViewModel
private string _ignoredQueryText; // Used to ignore query text change when switching between context menu and query results
private readonly FlowLauncherJsonStorage<History> _historyItemsStorage;
private readonly FlowLauncherJsonStorage<ExecutedHistory> _executedHistoryStorage;
private readonly FlowLauncherJsonStorage<LastOpenedHistory> _lastOpenedHistoryStorage;
private readonly FlowLauncherJsonStorage<UserSelectedRecord> _userSelectedRecordStorage;
private readonly FlowLauncherJsonStorageTopMostRecord _topMostRecord;
private readonly History _history;
private readonly ExecutedHistory _executedHistory;
private readonly LastOpenedHistory _lastOpenedHistory;
private int lastHistoryIndex = 1;
private readonly UserSelectedRecord _userSelectedRecord;
@ -150,11 +150,11 @@ namespace Flow.Launcher.ViewModel
};
_historyItemsStorage = new FlowLauncherJsonStorage<History>();
_executedHistoryStorage = new FlowLauncherJsonStorage<ExecutedHistory>();
_lastOpenedHistoryStorage = new FlowLauncherJsonStorage<LastOpenedHistory>();
_userSelectedRecordStorage = new FlowLauncherJsonStorage<UserSelectedRecord>();
_topMostRecord = new FlowLauncherJsonStorageTopMostRecord();
_history = _historyItemsStorage.Load();
_executedHistory = _executedHistoryStorage.Load();
_lastOpenedHistory = _lastOpenedHistoryStorage.Load();
_userSelectedRecord = _userSelectedRecordStorage.Load();
ContextMenu = new ResultsViewModel(Settings, this)
@ -533,8 +533,8 @@ namespace Flow.Launcher.ViewModel
if (QueryResultsSelected())
{
if(Settings.ShowHistoryExecutedResultsForHomePage)
_executedHistory.Add(result);
if(Settings.ShowHistoryLastOpenedResultsForHomePage)
_lastOpenedHistory.Add(result);
_userSelectedRecord.Add(result);
_history.Add(result.OriginQuery.RawQuery);
@ -1459,9 +1459,9 @@ namespace Flow.Launcher.ViewModel
{
QueryHistoryTask(currentCancellationToken);
}
else if (Settings.ShowHistoryExecutedResultsForHomePage)
else if (Settings.ShowHistoryLastOpenedResultsForHomePage)
{
QueryExecutedHistoryTask(currentCancellationToken);
QueryLastOpenedHistoryTask(currentCancellationToken);
}
}
else
@ -1586,9 +1586,9 @@ namespace Flow.Launcher.ViewModel
}
}
void QueryExecutedHistoryTask(CancellationToken token)
void QueryLastOpenedHistoryTask(CancellationToken token)
{
var historyItems = _executedHistory.Items.TakeLast(Settings.MaxHistoryResultsToShowForHomePage).Reverse();
var historyItems = _lastOpenedHistory.Items.TakeLast(Settings.MaxHistoryResultsToShowForHomePage).Reverse();
var results = new List<Result>();
foreach (var item in historyItems)
@ -1612,7 +1612,7 @@ namespace Flow.Launcher.ViewModel
if (token.IsCancellationRequested) return;
App.API.LogDebug(ClassName, "Update results for executed history");
App.API.LogDebug(ClassName, "Update results for last opened history");
if (!_resultsUpdateChannelWriter.TryWrite(new ResultsForUpdate(results, _historyMetadata, query,
token, reSelect)))
@ -2209,7 +2209,7 @@ namespace Flow.Launcher.ViewModel
public void Save()
{
_historyItemsStorage.Save();
_executedHistoryStorage.Save();
_lastOpenedHistoryStorage.Save();
_userSelectedRecordStorage.Save();
_topMostRecord.Save();
}