From 15b874728071c9ce62ccaa71669731cff551392e Mon Sep 17 00:00:00 2001 From: zoltanvi Date: Sat, 9 Aug 2025 11:51:12 +0200 Subject: [PATCH 1/3] Fix IsEnabled binding for suggestion combobox --- Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs | 12 +++++++++++- .../SettingsControl.xaml | 3 +-- Plugins/Flow.Launcher.Plugin.WebSearch/setting.json | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs index f0e5ac32744..04112f965fb 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs @@ -7,6 +7,8 @@ namespace Flow.Launcher.Plugin.WebSearch { public class Settings : BaseModel { + private bool enableSuggestion; + public Settings() { SelectedSuggestion = Suggestions[0]; @@ -191,7 +193,15 @@ public Settings() [JsonIgnore] public SearchSource SelectedSearchSource { get; set; } - public bool EnableSuggestion { get; set; } + public bool EnableSuggestion + { + get => enableSuggestion; + set + { + enableSuggestion = value; + OnPropertyChanged(nameof(EnableSuggestion)); + } + } [JsonIgnore] public SuggestionSource[] Suggestions { get; set; } = { diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml index 1ce9b70b4a0..bee13349670 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml @@ -138,7 +138,7 @@ Margin="{StaticResource SettingPanelItemLeftMargin}" VerticalAlignment="Center" FontSize="11" - IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}" + IsEnabled="{Binding Settings.EnableSuggestion}" ItemsSource="{Binding Settings.Suggestions}" SelectedItem="{Binding Settings.SelectedSuggestion}" /> - \ No newline at end of file diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json index 533b894b8dc..a10ea6f3366 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/setting.json @@ -141,6 +141,6 @@ "Enabled": true } ], - "EnableWebSearchSuggestion": false, - "WebSearchSuggestionSource": "Google" + "EnableSuggestion": false, + "Suggestion": "Google" } \ No newline at end of file From 09d8cefcef770fa02f5d196bdfaf99e7fc7c5481 Mon Sep 17 00:00:00 2001 From: zoltanvi Date: Sat, 9 Aug 2025 11:56:13 +0200 Subject: [PATCH 2/3] Remove unused properties --- Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs | 4 ---- Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml | 4 ---- .../Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs | 3 ++- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs index 04112f965fb..1682a9a4bf5 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs @@ -231,9 +231,5 @@ public string Suggestion } } } - - public string BrowserPath { get; set; } - - public bool OpenInNewBrowser { get; set; } = true; } } diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml index bee13349670..79d6265fe2e 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml @@ -11,10 +11,6 @@ mc:Ignorable="d"> - diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs index e53f4ec7517..71dc6ece71c 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs @@ -94,7 +94,8 @@ private void SortByColumn(object sender, RoutedEventArgs e) var columnBinding = headerClicked.Column.DisplayMemberBinding as Binding; var sortBy = columnBinding?.Path.Path ?? headerClicked.Column.Header as string; - if(sortBy != null) { + if (sortBy != null) + { Sort(sortBy, direction); if (direction == ListSortDirection.Ascending) From cc2df8d680bb0d2861732e527442e91110027e64 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 12 Aug 2025 17:31:26 +0800 Subject: [PATCH 3/3] Improve code quality --- Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs index 1682a9a4bf5..0c0ac4b8453 100644 --- a/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs @@ -7,8 +7,6 @@ namespace Flow.Launcher.Plugin.WebSearch { public class Settings : BaseModel { - private bool enableSuggestion; - public Settings() { SelectedSuggestion = Suggestions[0]; @@ -193,13 +191,17 @@ public Settings() [JsonIgnore] public SearchSource SelectedSearchSource { get; set; } + private bool enableSuggestion; public bool EnableSuggestion { get => enableSuggestion; set { - enableSuggestion = value; - OnPropertyChanged(nameof(EnableSuggestion)); + if (enableSuggestion != value) + { + enableSuggestion = value; + OnPropertyChanged(nameof(EnableSuggestion)); + } } }