Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,12 @@ private void CustomHotkeyEdit()
if (window.ShowDialog() is not true) return;

var index = Settings.CustomPluginHotkeys.IndexOf(settingItem);
Settings.CustomPluginHotkeys[index] = new CustomPluginHotkey(window.Hotkey, window.ActionKeyword);
HotKeyMapper.RemoveHotkey(settingItem.Hotkey); // remove origin hotkey
HotKeyMapper.SetCustomQueryHotkey(Settings.CustomPluginHotkeys[index]); // set new hotkey
if (index >= 0 && index < Settings.CustomPluginHotkeys.Count)
{
Settings.CustomPluginHotkeys[index] = new CustomPluginHotkey(window.Hotkey, window.ActionKeyword);
HotKeyMapper.RemoveHotkey(settingItem.Hotkey); // remove origin hotkey
HotKeyMapper.SetCustomQueryHotkey(Settings.CustomPluginHotkeys[index]); // set new hotkey
}
}

[RelayCommand]
Expand Down Expand Up @@ -150,7 +153,10 @@ private void CustomShortcutEdit()
if (window.ShowDialog() is not true) return;

var index = Settings.CustomShortcuts.IndexOf(settingItem);
Settings.CustomShortcuts[index] = new CustomShortcutModel(window.Key, window.Value);
if (index >= 0 && index < Settings.CustomShortcuts.Count)
{
Settings.CustomShortcuts[index] = new CustomShortcutModel(window.Key, window.Value);
}
}

[RelayCommand]
Expand Down
1 change: 1 addition & 0 deletions Plugins/Flow.Launcher.Plugin.WebSearch/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<system:String x:Key="flowlauncher_plugin_websearch_input_url">Please enter a URL</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_action_keyword_exist">Action keyword already exists, please enter a different one</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_succeed">Success</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_edit_failed">Failed to update search source. The item may have been removed.</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_iconpath_hint">Hint: You do not need to place custom images in this directory, if Flow's version is updated they will be lost. Flow will automatically copy any images outside of this directory across to WebSearch's custom image location.</system:String>

<system:String x:Key="flowlauncher_plugin_websearch_plugin_name">Web Searches</system:String>
Expand Down
16 changes: 13 additions & 3 deletions Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,19 @@
_context.API.AddActionKeyword(id, newKeyword);

var index = _searchSources.IndexOf(_oldSearchSource);
_searchSources[index] = _searchSource;

Close();

// Only update if we found the item in the collection
if (index >= 0 && index < _searchSources.Count)
{
_searchSources[index] = _searchSource;
Close();
}
else
{
var warning = _api.GetTranslation("flowlauncher_plugin_websearch_edit_failed");
_context.API.ShowMsgBox(warning);
Close();
}
}
else
{
Expand Down Expand Up @@ -141,7 +151,7 @@
if (!string.IsNullOrEmpty(selectedNewIconImageFullPath))
{
if (_viewModel.ShouldProvideHint(selectedNewIconImageFullPath))
_context.API.ShowMsgBox(_api.GetTranslation("flowlauncher_plugin_websearch_iconpath_hint"));

Check warning on line 154 in Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`iconpath` is not a recognized word. (unrecognized-spelling)

Check warning on line 154 in Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`iconpath` is not a recognized word. (unrecognized-spelling)

imgPreviewIcon.Source = await _viewModel.LoadPreviewIconAsync(selectedNewIconImageFullPath);
}
Expand Down
Loading