Skip to content

Commit 267fb65

Browse files
committed
add File Content Search Enabled status property
1 parent a87cea7 commit 267fb65

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActio
7575
keyword == Settings.SearchActionKeyword,
7676
Settings.ActionKeyword.PathSearchActionKeyword => Settings.PathSearchKeywordEnabled &&
7777
keyword == Settings.PathSearchActionKeyword,
78-
Settings.ActionKeyword.FileContentSearchActionKeyword => keyword ==
79-
Settings.FileContentSearchActionKeyword,
78+
Settings.ActionKeyword.FileContentSearchActionKeyword => Settings.FileContentSearchKeywordEnabled &&
79+
keyword == Settings.FileContentSearchActionKeyword,
8080
Settings.ActionKeyword.IndexSearchActionKeyword => Settings.IndexOnlySearchKeywordEnabled &&
81-
keyword == Settings.IndexSearchActionKeyword
81+
keyword == Settings.IndexSearchActionKeyword
8282
};
8383
}
8484

Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class Settings
2525

2626
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
2727

28+
public bool FileContentSearchKeywordEnabled { get; set; } = true;
29+
2830
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
2931

3032
public bool PathSearchKeywordEnabled { get; set; }
@@ -48,7 +50,8 @@ internal enum ActionKeyword
4850
ActionKeyword.SearchActionKeyword => SearchActionKeyword,
4951
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
5052
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
51-
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword
53+
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword,
54+
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
5255
};
5356

5457
internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
@@ -57,23 +60,25 @@ internal enum ActionKeyword
5760
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
5861
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
5962
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword,
60-
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
63+
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found")
6164
};
6265

63-
internal bool? GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch
66+
internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch
6467
{
6568
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled,
6669
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled,
6770
ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled,
68-
_ => null
71+
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled,
72+
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
6973
};
7074

7175
internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
7276
{
7377
ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable,
7478
ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable,
7579
ActionKeyword.IndexSearchActionKeyword => IndexOnlySearchKeywordEnabled = enable,
76-
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
80+
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable,
81+
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined")
7782
};
7883
}
7984
}

0 commit comments

Comments
 (0)