mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
add Query.IsForced property
When a plugin is processing a query, it can check the `IsForced` property to decide if the results will be served from cache or not.
This commit is contained in:
parent
fa2c894ac0
commit
0b05e954e5
2 changed files with 13 additions and 5 deletions
|
|
@ -29,6 +29,12 @@ namespace Flow.Launcher.Plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RawQuery { get; internal init; }
|
public string RawQuery { get; internal init; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the query was forced to execute again.
|
||||||
|
/// When this property is true, plugins handling this query should avoid serving cached results.
|
||||||
|
/// </summary>
|
||||||
|
public bool IsForced { get; internal set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Search part of a query.
|
/// Search part of a query.
|
||||||
/// This will not include action keyword if exclusive plugin gets it, otherwise it should be same as RawQuery.
|
/// This will not include action keyword if exclusive plugin gets it, otherwise it should be same as RawQuery.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
@ -512,7 +512,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
else if (reQuery)
|
else if (reQuery)
|
||||||
{
|
{
|
||||||
Query();
|
Query(reQuery: true);
|
||||||
}
|
}
|
||||||
QueryTextCursorMovedToEnd = true;
|
QueryTextCursorMovedToEnd = true;
|
||||||
});
|
});
|
||||||
|
|
@ -612,11 +612,11 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
#region Query
|
#region Query
|
||||||
|
|
||||||
public void Query()
|
public void Query(bool reQuery = false)
|
||||||
{
|
{
|
||||||
if (SelectedIsFromQueryResults())
|
if (SelectedIsFromQueryResults())
|
||||||
{
|
{
|
||||||
QueryResults();
|
QueryResults(reQuery);
|
||||||
}
|
}
|
||||||
else if (ContextMenuSelected())
|
else if (ContextMenuSelected())
|
||||||
{
|
{
|
||||||
|
|
@ -716,7 +716,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
private readonly IReadOnlyList<Result> _emptyResult = new List<Result>();
|
private readonly IReadOnlyList<Result> _emptyResult = new List<Result>();
|
||||||
|
|
||||||
private async void QueryResults()
|
private async void QueryResults(bool reQuery = false)
|
||||||
{
|
{
|
||||||
_updateSource?.Cancel();
|
_updateSource?.Cancel();
|
||||||
|
|
||||||
|
|
@ -747,6 +747,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
if (currentCancellationToken.IsCancellationRequested)
|
if (currentCancellationToken.IsCancellationRequested)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Update the query's IsForced property to true if this is a re-query
|
||||||
|
query.IsForced = reQuery;
|
||||||
|
|
||||||
// handle the exclusiveness of plugin using action keyword
|
// handle the exclusiveness of plugin using action keyword
|
||||||
RemoveOldQueryResults(query);
|
RemoveOldQueryResults(query);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue