mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2874 from Ishmaeel/ishmaeel_2873
Pass MaxResult setting to EverythingApi
This commit is contained in:
commit
7d55d972d0
5 changed files with 48 additions and 3 deletions
|
|
@ -66,6 +66,8 @@
|
|||
<system:String x:Key="plugin_explorer_Open_Window_Index_Option">Open Windows Index Option</system:String>
|
||||
<system:String x:Key="plugin_explorer_Excluded_File_Types">Excluded File Types (comma seperated)</system:String>
|
||||
<system:String x:Key="plugin_explorer_Excluded_File_Types_Tooltip">For example: exe,jpg,png</system:String>
|
||||
<system:String x:Key="plugin_explorer_Maximum_Results">Maximum results</system:String>
|
||||
<system:String x:Key="plugin_explorer_Maximum_Results_Tooltip">The maximum number of results requested from active search engine</system:String>
|
||||
|
||||
<!-- Plugin Infos -->
|
||||
<system:String x:Key="plugin_explorer_plugin_name">Explorer</system:String>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
if (token.IsCancellationRequested)
|
||||
yield break;
|
||||
|
||||
var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount);
|
||||
var option = new EverythingSearchOption(search,
|
||||
Settings.SortOption,
|
||||
MaxCount: Settings.MaxResult,
|
||||
IsFullPathSearch: Settings.EverythingSearchFullPath,
|
||||
IsRunCounterEnabled: Settings.EverythingEnableRunCount);
|
||||
|
||||
await foreach (var result in EverythingApi.SearchAsync(option, token))
|
||||
yield return result;
|
||||
|
|
@ -96,6 +100,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
Settings.SortOption,
|
||||
IsContentSearch: true,
|
||||
ContentSearchKeyword: contentSearch,
|
||||
MaxCount: Settings.MaxResult,
|
||||
IsFullPathSearch: Settings.EverythingSearchFullPath,
|
||||
IsRunCounterEnabled: Settings.EverythingEnableRunCount);
|
||||
|
||||
|
|
@ -116,6 +121,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.Everything
|
|||
Settings.SortOption,
|
||||
ParentPath: path,
|
||||
IsRecursive: recursive,
|
||||
MaxCount: Settings.MaxResult,
|
||||
IsFullPathSearch: Settings.EverythingSearchFullPath,
|
||||
IsRunCounterEnabled: Settings.EverythingEnableRunCount);
|
||||
|
||||
|
|
|
|||
|
|
@ -525,6 +525,19 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public int MaxResultLowerLimit => 100;
|
||||
public int MaxResultUpperLimit => 100000;
|
||||
|
||||
public int MaxResult
|
||||
{
|
||||
get => Settings.MaxResult;
|
||||
set
|
||||
{
|
||||
Settings.MaxResult = Math.Clamp(value, MaxResultLowerLimit, MaxResultUpperLimit);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region Everything FastSortWarning
|
||||
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@
|
|||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
|
|
@ -348,6 +349,24 @@
|
|||
Margin="0,9,0,6"
|
||||
ToolTip="{DynamicResource plugin_explorer_Excluded_File_Types_Tooltip}"
|
||||
Text="{Binding ExcludedFileTypes}" />
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
Margin="0 15 20 0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{DynamicResource plugin_explorer_Maximum_Results}"
|
||||
TextBlock.Foreground="{DynamicResource Color05B}" />
|
||||
<TextBox
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
MinWidth="350"
|
||||
Margin="0,9,0,6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
PreviewTextInput="AllowOnlyNumericInput"
|
||||
MaxLength="6"
|
||||
Text="{Binding MaxResult}"
|
||||
ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
|
||||
{
|
||||
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
|
@ -94,5 +94,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
{
|
||||
AccessLinkDragDrop("IndexSearchExcludedPath", e);
|
||||
}
|
||||
|
||||
private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue