From f13e24bd077ccd556e08e19ab12a0cf750aafacb Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 5 Jun 2021 14:07:13 +1000 Subject: [PATCH] removed obsolete api object, updated search action keyword naming, --- .../Flow.Launcher.Plugin.Explorer/Languages/en.xaml | 7 +++---- .../Search/SearchManager.cs | 6 +++--- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 12 ++++++------ .../ViewModels/SettingsViewModel.cs | 4 ++-- .../Views/ActionKeywordSetting.xaml.cs | 2 +- .../Views/ExplorerSettings.xaml.cs | 8 +++----- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 71b16f159..445326a76 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -19,11 +19,10 @@ Quick Access Links Index Search Excluded Paths Indexing Options - Index Search Activation: - Path Explore Activation: + Search: + Path Search: File Content Search: - Index Only Search: - (Disabled) + Index Search: Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 8082da1dc..8e67277a8 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -53,7 +53,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false)); } - if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexOnlySearchActionKeyword) || + if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexSearchActionKeyword) || ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword)) && querySearch.Length > 0 && !querySearch.IsLocationPathString()) @@ -77,8 +77,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search keyword == settings.PathSearchActionKeyword, Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == settings.FileContentSearchActionKeyword, - Settings.ActionKeyword.IndexOnlySearchActionKeyword => settings.EnabledIndexOnlySearchKeyword && - keyword == settings.IndexOnlySearchActionKeyword + Settings.ActionKeyword.IndexSearchActionKeyword => settings.EnabledIndexOnlySearchKeyword && + keyword == settings.IndexSearchActionKeyword }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 790e57439..bd6fe7e20 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.Explorer public bool EnabledPathSearchKeyword { get; set; } - public string IndexOnlySearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public bool EnabledIndexOnlySearchKeyword { get; set; } @@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer SearchActionKeyword, PathSearchActionKeyword, FileContentSearchActionKeyword, - IndexOnlySearchActionKeyword + IndexSearchActionKeyword } internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch @@ -46,7 +46,7 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, - ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword }; internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch @@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, - ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword = keyword, + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") }; @@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.Explorer { ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword, ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword, - ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword, + ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword, _ => null }; @@ -70,7 +70,7 @@ namespace Flow.Launcher.Plugin.Explorer { ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword = enable, ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword = enable, - ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword = enable, + ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword = enable, _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 3403fef3f..fbf9c325e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -56,8 +56,8 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels case Settings.ActionKeyword.FileContentSearchActionKeyword: Settings.FileContentSearchActionKeyword = newActionKeyword; break; - case Settings.ActionKeyword.IndexOnlySearchActionKeyword: - Settings.IndexOnlySearchActionKeyword = newActionKeyword; + case Settings.ActionKeyword.IndexSearchActionKeyword: + Settings.IndexSearchActionKeyword = newActionKeyword; break; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 255dd1b3d..240605ecd 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -73,7 +73,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views newActionKeyword; // automatically help users set this to enabled if an action keyword is set and currently disabled - if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexOnlySearchActionKeyword + if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexSearchActionKeyword && !settings.EnabledIndexOnlySearchKeyword) settings.EnabledIndexOnlySearchKeyword = true; diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index d5f6386f2..268261659 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -41,13 +41,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch")), new(Settings.ActionKeyword.PathSearchActionKeyword, viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path")), - new(Settings.ActionKeyword.IndexOnlySearchActionKeyword, + new(Settings.ActionKeyword.IndexSearchActionKeyword, viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch")) }; lbxActionKeywords.ItemsSource = actionKeywordsListView; - ActionKeywordView.Init(viewModel.Settings, viewModel.Context.API); + ActionKeywordView.Init(viewModel.Settings); RefreshView(); } @@ -312,12 +312,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views public class ActionKeywordView { private static Settings _settings; - private static IPublicAPI _api; - public static void Init(Settings settings, IPublicAPI api) + public static void Init(Settings settings) { _settings = settings; - _api = api; } internal ActionKeywordView(Settings.ActionKeyword actionKeyword, string description)