Skip to content

Commit 24fe5a1

Browse files
committed
prevent user from using global action keyword for content search
would bring up too many results
1 parent b2b9833 commit 24fe5a1

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<system:String x:Key="plugin_explorer_deletefilefolderconfirm">Are you sure you want to permanently delete this {0}?</system:String>
1010
<system:String x:Key="plugin_explorer_deletefilefoldersuccess">Deletion successful</system:String>
1111
<system:String x:Key="plugin_explorer_deletefilefoldersuccess_detail">Successfully deleted the {0}</system:String>
12+
<system:String x:Key="plugin_explorer_globalActionKeywordInvalid">Assigning the global action keyword could bring up too many results during search. Please choose a specific action keyword</system:String>
1213

1314
<!--Controls-->
1415
<system:String x:Key="plugin_explorer_delete">Delete</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@ internal void UpdateActionKeyword(string newActionKeyword, string oldActionKeywo
5454
}
5555

5656
internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
57+
58+
internal bool IsNewActionKeywordGlobal(string newActionKeyword) => newActionKeyword == Query.GlobalPluginWildcardSign;
5759
}
5860
}

Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,17 @@ private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
5151

5252
return;
5353
}
54+
55+
if (settingsViewModel.IsNewActionKeywordGlobal(newActionKeyword)
56+
&& currentActionKeyword.Description
57+
== settingsViewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch"))
58+
{
59+
MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
60+
61+
return;
62+
}
5463

55-
if(!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
64+
if (!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
5665
{
5766
settingsViewModel.UpdateActionKeyword(newActionKeyword, currentActionKeyword.Keyword);
5867

0 commit comments

Comments
 (0)