From 267fb6551b2f5d71107ed0efb7f51497d76b2c27 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 1 Sep 2021 21:10:52 +1000 Subject: [PATCH 1/8] add File Content Search Enabled status property --- .../Search/SearchManager.cs | 6 +++--- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index d367eddca..9256a3917 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -75,10 +75,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search keyword == Settings.SearchActionKeyword, Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled && keyword == Settings.PathSearchActionKeyword, - Settings.ActionKeyword.FileContentSearchActionKeyword => keyword == - Settings.FileContentSearchActionKeyword, + Settings.ActionKeyword.FileContentSearchActionKeyword => Settings.FileContentSearchKeywordEnabled && + keyword == Settings.FileContentSearchActionKeyword, Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled && - keyword == Settings.IndexSearchActionKeyword + keyword == Settings.IndexSearchActionKeyword }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 88656a401..e44980b23 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -25,6 +25,8 @@ namespace Flow.Launcher.Plugin.Explorer public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; + public bool FileContentSearchKeywordEnabled { get; set; } = true; + public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public bool PathSearchKeywordEnabled { get; set; } @@ -48,7 +50,8 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeyword, ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, - ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") }; internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch @@ -57,15 +60,16 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, - _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") }; - internal bool? GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch + internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch { ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled, - _ => null + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch @@ -73,7 +77,8 @@ namespace Flow.Launcher.Plugin.Explorer ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable, - _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; } } \ No newline at end of file From 91564e0933945bd297da679f8279080e41861d53 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 1 Sep 2021 21:17:20 +1000 Subject: [PATCH 2/8] remove null state from action keyword Enabled status --- .../Views/ActionKeywordSetting.xaml | 2 +- .../Views/ActionKeywordSetting.xaml.cs | 10 +++++----- .../Views/ExplorerSettings.xaml.cs | 7 +++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml index 19ff624b0..a497d2b26 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -31,7 +31,7 @@ Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}" Width="auto" VerticalAlignment="Center" IsChecked="{Binding Enabled}" - Visibility="{Binding Visible}"/> + Visibility="{Binding EnabledVisibility}"/>