diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 18fc33675..0bc9d4437 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -66,6 +66,8 @@ Open Windows Index Option Excluded File Types (comma seperated) For example: exe,jpg,png + Maximum results + The maximum number of results requested from active search engine Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs index 7186acff5..6c9155539 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchManager.cs @@ -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); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 729e05ba0..309f7a6f7 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -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 diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index caad341c8..001859caa 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -282,6 +282,7 @@ + + + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index d0483ea8d..b7f5efc3c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -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)); + } } }