diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index d367eddca..6f4a0decd 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.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled && - keyword == Settings.IndexSearchActionKeyword + Settings.ActionKeyword.FileContentSearchActionKeyword => Settings.FileContentSearchKeywordEnabled && + keyword == Settings.FileContentSearchActionKeyword, + Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexSearchKeywordEnabled && + keyword == Settings.IndexSearchActionKeyword }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 88656a401..e27abaa93 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -1,9 +1,7 @@ using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; -using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption; using System; using System.Collections.Generic; -using System.IO; namespace Flow.Launcher.Plugin.Explorer { @@ -25,13 +23,15 @@ 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; } public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; - public bool IndexOnlySearchKeywordEnabled { get; set; } + public bool IndexSearchKeywordEnabled { get; set; } public bool WarnWindowsSearchServiceOff { get; set; } = true; @@ -48,7 +48,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,23 +58,25 @@ 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.IndexSearchActionKeyword => IndexSearchKeywordEnabled, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch { ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, - ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable, - _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property") + ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") }; } } \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml index 19ff624b0..19542dcac 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -30,8 +30,7 @@ + VerticalAlignment="Center" IsChecked="{Binding Enabled}" />