add File Content Search Enabled status property

This commit is contained in:
Jeremy 2021-09-01 21:10:52 +10:00
parent a87cea7e6f
commit 267fb6551b
2 changed files with 13 additions and 8 deletions

View file

@ -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
};
}

View file

@ -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")
};
}
}