Skip to content

Commit c14eda2

Browse files
committed
Revert "Merge pull request #4198 from nilvanlopes/feature/websearch-max-suggestions"
This reverts commit 27c4d35, reversing changes made to 83883c4.
1 parent 118d6e2 commit c14eda2

6 files changed

Lines changed: 24 additions & 71 deletions

File tree

Plugins/Flow.Launcher.Plugin.WebSearch/Flow.Launcher.Plugin.WebSearch.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050
</None>
5151
</ItemGroup>
5252

53-
<ItemGroup>
54-
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.10.2.1" />
55-
</ItemGroup>
56-
5753
<ItemGroup>
5854
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
5955
</ItemGroup>

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
2222
<system:String x:Key="flowlauncher_plugin_websearch_search">Search</system:String>
2323
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion">Use Search Query Autocomplete</system:String>
24-
<system:String x:Key="flowlauncher_plugin_websearch_max_suggestions">Max Suggestions</system:String>
2524
<system:String x:Key="flowlauncher_plugin_websearch_enable_suggestion_provider">Autocomplete Data from:</system:String>
2625
<system:String x:Key="flowlauncher_plugin_websearch_pls_select_web_search">Please select a web search</system:String>
2726
<system:String x:Key="flowlauncher_plugin_websearch_delete_warning">Are you sure you want to delete {0}?</system:String>

Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
@@ -91,7 +91,6 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
9191

9292
if (token.IsCancellationRequested)
9393
return null;
94-
9594
}
9695

9796
return results;
@@ -127,7 +126,7 @@ private async Task<IEnumerable<Result>> SuggestionsAsync(string keyword, string
127126

128127
token.ThrowIfCancellationRequested();
129128

130-
var resultsFromSuggestion = suggestions?.Take(_settings.MaxSuggestions).Select(o => new Result
129+
var resultsFromSuggestion = suggestions?.Select(o => new Result
131130
{
132131
Title = o,
133132
SubTitle = subtitle,

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -205,23 +205,6 @@ public bool EnableSuggestion
205205
}
206206
}
207207

208-
private int maxSuggestions = 1;
209-
public int MaxSuggestions
210-
{
211-
get => maxSuggestions;
212-
set
213-
{
214-
if (value > 0 && value <= 1000)
215-
{
216-
if (maxSuggestions != value)
217-
{
218-
maxSuggestions = value;
219-
OnPropertyChanged();
220-
}
221-
}
222-
}
223-
}
224-
225208
[JsonIgnore]
226209
public SuggestionSource[] Suggestions { get; set; } = {
227210
new Google(),

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6-
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
76
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8-
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
97
xmlns:vm="clr-namespace:Flow.Launcher.Plugin.WebSearch"
108
d:DataContext="{d:DesignInstance vm:SettingsViewModel}"
119
d:DesignHeight="300"
@@ -47,17 +45,17 @@
4745
x:Name="SearchSourcesListView"
4846
Grid.Row="0"
4947
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
50-
AllowDrop="True"
5148
BorderBrush="DarkGray"
5249
BorderThickness="1"
53-
Drop="ListView_Drop"
5450
GridViewColumnHeader.Click="SortByColumn"
5551
ItemsSource="{Binding Settings.SearchSources}"
5652
MouseDoubleClick="MouseDoubleClickItem"
57-
PreviewMouseLeftButtonDown="ListView_PreviewMouseLeftButtonDown"
58-
PreviewMouseMove="ListView_PreviewMouseMove"
5953
SelectedItem="{Binding Settings.SelectedSearchSource}"
6054
SizeChanged="ListView_SizeChanged"
55+
PreviewMouseLeftButtonDown="ListView_PreviewMouseLeftButtonDown"
56+
PreviewMouseMove="ListView_PreviewMouseMove"
57+
AllowDrop="True"
58+
Drop="ListView_Drop"
6159
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
6260
<ListView.View>
6361
<GridView>
@@ -148,43 +146,31 @@
148146

149147
<Separator Grid.Row="2" Style="{StaticResource SettingPanelSeparatorStyle}" />
150148

151-
<WrapPanel Grid.Row="3" HorizontalAlignment="Stretch">
152-
<StackPanel Orientation="Horizontal">
153-
<TextBlock
154-
Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
155-
VerticalAlignment="Center"
156-
Text="{DynamicResource flowlauncher_plugin_websearch_max_suggestions}" />
157-
<ui:NumberBox
158-
Width="120"
159-
MinWidth="120"
160-
Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
161-
Maximum="1000"
162-
Minimum="1"
163-
SmallChange="10"
164-
SpinButtonPlacementMode="Compact"
165-
ValidationMode="InvalidInputOverwritten"
166-
ValueChanged="NumberBox_ValueChanged"
167-
Value="{Binding Settings.MaxSuggestions, Mode=OneWay}" />
168-
</StackPanel>
169-
<CheckBox
170-
Name="EnableSuggestion"
171-
Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
172-
VerticalAlignment="Center"
173-
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
174-
IsChecked="{Binding Settings.EnableSuggestion}" />
175-
<StackPanel Orientation="Horizontal">
176-
<TextBlock
177-
Margin="{StaticResource SettingPanelItemRightTopBottomMargin}"
149+
<DockPanel
150+
Grid.Row="3"
151+
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
152+
HorizontalAlignment="Right">
153+
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
154+
<Label
155+
HorizontalAlignment="Right"
178156
VerticalAlignment="Center"
179-
Text="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
157+
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" />
180158
<ComboBox
181159
Height="30"
182-
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
160+
Margin="{StaticResource SettingPanelItemLeftMargin}"
183161
VerticalAlignment="Center"
162+
FontSize="11"
184163
IsEnabled="{Binding Settings.EnableSuggestion}"
185164
ItemsSource="{Binding Settings.Suggestions}"
186165
SelectedItem="{Binding Settings.SelectedSuggestion}" />
166+
<CheckBox
167+
Name="EnableSuggestion"
168+
Margin="{StaticResource SettingPanelItemLeftMargin}"
169+
HorizontalAlignment="Right"
170+
VerticalAlignment="Center"
171+
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
172+
IsChecked="{Binding Settings.EnableSuggestion}" />
187173
</StackPanel>
188-
</WrapPanel>
174+
</DockPanel>
189175
</Grid>
190176
</UserControl>

Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,15 +240,5 @@ private static T FindAncestor<T>(DependencyObject current) where T : DependencyO
240240
}
241241
return null;
242242
}
243-
244-
// This is used for NumberBox to force its value to be 1 when the user clears the value
245-
private void NumberBox_ValueChanged(iNKORE.UI.WPF.Modern.Controls.NumberBox sender, iNKORE.UI.WPF.Modern.Controls.NumberBoxValueChangedEventArgs args)
246-
{
247-
if (double.IsNaN(args.NewValue))
248-
{
249-
sender.Value = 1;
250-
_settings.MaxSuggestions = (int)sender.Value;
251-
}
252-
}
253243
}
254244
}

0 commit comments

Comments
 (0)