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

128 lines
7.7 KiB
Text
Raw Normal View History

2020-04-21 09:12:17 +00:00
<UserControl x:Class="Flow.Launcher.Plugin.WebSearch.SettingsControl"
2014-03-29 08:13:36 +00:00
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
2020-04-21 09:12:17 +00:00
xmlns:vm="clr-namespace:Flow.Launcher.Plugin.WebSearch"
mc:Ignorable="d"
Background="White"
d:DataContext="{d:DesignInstance vm:SettingsViewModel}"
2015-01-07 10:45:55 +00:00
d:DesignHeight="300" d:DesignWidth="500">
2020-05-04 04:49:32 +00:00
<UserControl.Resources>
<Style TargetType="TextBox" x:Key="BrowserPathBoxStyle">
<Setter Property="Height" Value="28"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
2021-05-19 08:55:29 +00:00
<DataTemplate x:Key="HeaderTemplateArrowUp">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
<Path x:Name="arrow"
StrokeThickness = "1"
Fill = "gray"
Data = "M 5,10 L 15,10 L 10,5 L 5,10"/>
</DockPanel>
</DataTemplate>
<DataTemplate x:Key="HeaderTemplateArrowDown">
<DockPanel>
<TextBlock HorizontalAlignment="Center" Text="{Binding }"/>
<Path x:Name="arrow"
StrokeThickness = "1"
Fill = "gray"
Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
</DockPanel>
</DataTemplate>
2020-05-04 04:49:32 +00:00
</UserControl.Resources>
<Grid Margin="14 14 14 0">
2014-03-29 08:13:36 +00:00
<Grid.RowDefinitions>
<RowDefinition Height="48" />
<RowDefinition Height="40" />
<RowDefinition />
<RowDefinition Height="56"/>
2020-05-04 04:49:32 +00:00
<RowDefinition Height="50" />
2014-03-29 08:13:36 +00:00
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" HorizontalAlignment="Left" Orientation="Horizontal" Margin="14 0 0 0">
<Label Content="{DynamicResource flowlauncher_plugin_websearch_open_search_in}" Margin="0 15 20 0"/>
<RadioButton Name="NewWindowBrowser" GroupName="OpenSearchBehaviour" Content="{DynamicResource flowlauncher_plugin_websearch_new_window}" Click="OnNewBrowserWindowClick"
2020-05-04 04:49:32 +00:00
Margin="0 0 20 0"/>
<RadioButton Name="NewTabInBrowser" GroupName="OpenSearchBehaviour" Content="{DynamicResource flowlauncher_plugin_websearch_new_tab}" Click="OnNewTabClick" />
2020-05-04 04:49:32 +00:00
</StackPanel>
<StackPanel Grid.Row="1" HorizontalAlignment="Left" Margin="14 3 0 0" Orientation="Horizontal">
<Label Content="{DynamicResource flowlaucnher_plugin_websearch_set_browser_path}" Margin="0 0 10 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<TextBox x:Name="browserPathBox" HorizontalAlignment="Left" Margin="0,0,0,0" TextChanged="OnBrowserPathTextChanged"
Width="250" Style="{StaticResource BrowserPathBoxStyle}"/>
<Button x:Name="viewButton" HorizontalAlignment="Left" Margin="10,0,0,0"
Click="OnChooseClick" FontSize="13" Content="{DynamicResource flowlauncher_plugin_websearch_choose}" Width="80"/>
</StackPanel>
<ListView Margin="0 18 0 0" ItemsSource="{Binding Settings.SearchSources}"
SelectedItem="{Binding Settings.SelectedSearchSource}"
2021-05-19 08:55:29 +00:00
x:Name="SearchSourcesListView"
Grid.Row="2"
2020-05-04 04:49:32 +00:00
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}"
BorderBrush="DarkGray"
2021-05-19 08:55:29 +00:00
BorderThickness="1"
GridViewColumnHeader.Click="SortByColumn"
MouseDoubleClick="MouseDoubleClickItem">
2014-03-29 08:13:36 +00:00
<ListView.View>
<GridView>
2021-10-30 23:09:12 +00:00
<GridViewColumn Width="50">
2014-03-29 08:13:36 +00:00
<GridViewColumn.CellTemplate>
<DataTemplate>
2021-10-30 23:09:12 +00:00
<Image Source="{Binding Path=IconPath}" Width="20" Height="20" Margin="6 0 0 0"/>
2014-03-29 08:13:36 +00:00
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
2021-10-30 23:09:12 +00:00
2021-05-19 08:55:29 +00:00
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_websearch_action_keyword}"
2021-05-20 02:57:48 +00:00
DisplayMemberBinding="{Binding ActionKeyword}"
2021-10-30 23:09:12 +00:00
Width="130">
2014-03-29 08:13:36 +00:00
<GridViewColumn.CellTemplate>
<DataTemplate>
2021-05-19 08:55:29 +00:00
<TextBlock Text="{Binding ActionKeyword}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
2021-10-30 23:09:12 +00:00
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_websearch_title}"
DisplayMemberBinding="{Binding Title}" Width="350">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_websearch_enable}"
DisplayMemberBinding="{Binding Enabled}"
Width="80">
2021-05-19 08:55:29 +00:00
<GridViewColumn.CellTemplate>
<DataTemplate>
2021-10-30 23:09:12 +00:00
<TextBlock Text="{Binding Enabled}"/>
2014-03-29 08:13:36 +00:00
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel Grid.Row="3" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Click="OnDeleteSearchSearchClick" Width="100" Margin="10"
2020-04-21 12:54:41 +00:00
Content="{DynamicResource flowlauncher_plugin_websearch_delete}" />
<Button Click="OnEditSearchSourceClick" Width="100" Margin="10"
2020-04-21 12:54:41 +00:00
Content="{DynamicResource flowlauncher_plugin_websearch_edit}" />
<Button Click="OnAddSearchSearchClick" Width="100" Margin="10 10 0 10"
2020-04-21 12:54:41 +00:00
Content="{DynamicResource flowlauncher_plugin_websearch_add}" />
2014-03-29 08:13:36 +00:00
</StackPanel>
<Border BorderThickness="0 1 0 0" Grid.Row="4" Margin="0 0 0 0" BorderBrush="#cecece" HorizontalAlignment="Stretch">
<DockPanel HorizontalAlignment="Right" Margin="0 14 0 0">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
<Label Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion_provider}" Margin="14 0 10 0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<ComboBox ItemsSource="{Binding Settings.Suggestions}" VerticalAlignment="Center"
SelectedItem="{Binding Settings.SelectedSuggestion}"
IsEnabled="{Binding ElementName=EnableSuggestion, Path=IsChecked}" Margin="0 0 20 0" FontSize="11" Height="30"/>
<Label Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}" Margin="0 0 10 0" HorizontalAlignment="Right" VerticalAlignment="Center"/>
<CheckBox IsChecked="{Binding Settings.EnableSuggestion}"
Margin="0 0 0 0"
Name="EnableSuggestion"/>
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSaerchSuggestion is not working -->
</DockPanel>
</Border>
2014-03-29 08:13:36 +00:00
</Grid>
</UserControl>