Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
16 changes: 11 additions & 5 deletions Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{
public class Settings : BaseModel
{
private bool enableSuggestion;

public Settings()
{
SelectedSuggestion = Suggestions[0];
Expand All @@ -22,7 +24,7 @@
{
Title = "Google",
ActionKeyword = "*",
Icon = "google.png",

Check warning on line 27 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
Url = "https://www.google.com/search?q={q}",
Enabled = true
},
Expand All @@ -30,7 +32,7 @@
{
Title = "Google Scholar",
ActionKeyword = "sc",
Icon = "google.png",

Check warning on line 35 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
Url = "https://scholar.google.com/scholar?q={q}",
Enabled = true
},
Expand Down Expand Up @@ -70,7 +72,7 @@
{
Title = "Google Maps",
ActionKeyword = "maps",
Icon = "google_maps.png",

Check warning on line 75 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
Url = "https://maps.google.com/maps?q={q}",
Enabled = true
},
Expand All @@ -78,7 +80,7 @@
{
Title = "Google Translate",
ActionKeyword = "translate",
Icon = "google_translate.png",

Check warning on line 83 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
Url = "https://translate.google.com/#auto|en|{q}",
Enabled = true
},
Expand Down Expand Up @@ -118,7 +120,7 @@
{
Title = "Google Drive",
ActionKeyword = "drive",
Icon = "google_drive.png",

Check warning on line 123 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`google` is not a recognized word. (unrecognized-spelling)
Url = "https://drive.google.com/?hl=en&tab=bo#search/{q}",
Enabled = true
},
Expand Down Expand Up @@ -151,7 +153,7 @@
Title = "Google Images",
ActionKeyword = "image",
Icon = "google.png",
Url = "https://www.google.com/search?q={q}&tbm=isch",

Check warning on line 156 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

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

Check warning on line 156 in Plugins/Flow.Launcher.Plugin.WebSearch/Settings.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`tbm` is not a recognized word. (unrecognized-spelling)
Enabled = true
},
new SearchSource
Expand Down Expand Up @@ -191,7 +193,15 @@
[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; } = {
Expand Down Expand Up @@ -221,9 +231,5 @@
}
}
}

public string BrowserPath { get; set; }

public bool OpenInNewBrowser { get; set; } = true;
}
}
7 changes: 1 addition & 6 deletions Plugins/Flow.Launcher.Plugin.WebSearch/SettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
mc:Ignorable="d">

<UserControl.Resources>
<Style x:Key="BrowserPathBoxStyle" TargetType="TextBox">
<Setter Property="Height" Value="28" />
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<DataTemplate x:Key="HeaderTemplateArrowUp">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding}" />
Expand Down Expand Up @@ -138,7 +134,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}" />
<CheckBox
Expand All @@ -149,7 +145,6 @@
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}"
IsChecked="{Binding Settings.EnableSuggestion}" />
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSearchSuggestion is not working -->
</DockPanel>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Flow.Launcher.Plugin.WebSearch/setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@
"Enabled": true
}
],
"EnableWebSearchSuggestion": false,
"WebSearchSuggestionSource": "Google"
"EnableSuggestion": false,
"Suggestion": "Google"
}
Loading