Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -80,6 +80,7 @@
Width="135"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DataObject.Pasting="TextBox_Pasting"
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
Text="{Binding ActionKeyword}" />
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;
Expand Down Expand Up @@ -93,7 +94,27 @@ private void TxtCurrentActionKeyword_OnKeyDown(object sender, KeyEventArgs e)
OnDoneButtonClick(sender, e);
e.Handled = true;
}
if (e.Key == Key.Space)
{
e.Handled = true;
}
}
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(DataFormats.Text))
{
string text = e.DataObject.GetData(DataFormats.Text) as string;
if (!string.IsNullOrEmpty(text) && text.Any(char.IsWhiteSpace))
{
e.CancelCommand();
}
}
else
{
e.CancelCommand();
}
}

public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
Expand Down
36 changes: 19 additions & 17 deletions Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,12,26,0">
<StackPanel Margin="26 12 26 0">
<Grid>
<StackPanel>
<StackPanel Grid.Row="0" Margin="0,0,0,12">
<StackPanel Grid.Row="0" Margin="0 0 0 12">
<TextBlock
Grid.Column="0"
Margin="0,0,0,0"
Margin="0 0 0 0"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncher_plugin_websearch_window_title}"
Expand All @@ -75,15 +75,15 @@
TextAlignment="Left"
TextWrapping="WrapWithOverflow" />
<TextBox
Margin="0,12,0,12"
Margin="0 12 0 12"
FontSize="14"
FontWeight="SemiBold"
IsReadOnly="True"
Text="{DynamicResource flowlauncher_plugin_websearch_guide_2}"
TextAlignment="Center"
TextWrapping="WrapWithOverflow" />
<TextBlock
Margin="0,0,0,14"
Margin="0 0 0 14"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_websearch_guide_3}"
TextAlignment="Left"
Expand All @@ -105,7 +105,7 @@
<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="10,10,15,10"
Margin="10 10 15 10"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
FontSize="14"
Expand All @@ -120,7 +120,7 @@
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="10,10,15,10"
Margin="10 10 15 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Expand All @@ -131,21 +131,21 @@
Orientation="Horizontal">
<Button
Height="35"
Margin="10,0,0,0"
Margin="10 0 0 0"
VerticalAlignment="Center"
Click="OnSelectIconClick"
Content="{DynamicResource flowlauncher_plugin_websearch_select_icon}" />
<Image
Name="imgPreviewIcon"
Width="24"
Height="24"
Margin="14,0,0,0"
Margin="14 0 0 0"
VerticalAlignment="Center" />
</StackPanel>
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="10,10,15,10"
Margin="10 10 15 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Expand All @@ -160,30 +160,32 @@
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="10,10,15,10"
Margin="10 10 15 10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_websearch_action_keyword}" />
<TextBox
Grid.Row="3"
Grid.Column="1"
Margin="10,0,10,0"
Margin="10 0 10 0"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
DataObject.Pasting="TextBox_Pasting"
PreviewKeyDown="TextBox_PreviewKeyDown"
Text="{Binding SearchSource.ActionKeyword}" />
<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="10,10,15,15"
Margin="10 10 15 15"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource flowlauncher_plugin_websearch_enabled_label}" />
<CheckBox
Grid.Row="4"
Grid.Column="1"
Margin="10,10,10,15"
Margin="10 10 10 15"
VerticalAlignment="Center"
IsChecked="{Binding SearchSource.Enabled}" />
</Grid>
Expand All @@ -196,16 +198,16 @@
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
BorderThickness="0 1 0 0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
MinWidth="140"
Margin="10,0,5,0"
Margin="10 0 5 0"
Click="OnCancelButtonClick"
Content="{DynamicResource flowlauncher_plugin_websearch_cancel}" />
<Button
MinWidth="140"
Margin="5,0,10,0"
Margin="5 0 10 0"
Click="OnConfirmButtonClick"
Content="{DynamicResource flowlauncher_plugin_websearch_confirm}"
Style="{DynamicResource AccentButtonStyle}" />
Expand Down
26 changes: 26 additions & 0 deletions Plugins/Flow.Launcher.Plugin.WebSearch/SearchSourceSetting.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using Microsoft.Win32;

namespace Flow.Launcher.Plugin.WebSearch
Expand Down Expand Up @@ -143,6 +145,30 @@ private async void OnSelectIconClick(object sender, RoutedEventArgs e)
}
}
}

//Block Space Input
private void TextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Space)
{
e.Handled = true;
}
}
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(DataFormats.Text))
{
string text = e.DataObject.GetData(DataFormats.Text) as string;
if (!string.IsNullOrEmpty(text) && text.Any(char.IsWhiteSpace))
{
e.CancelCommand();
}
}
else
{
e.CancelCommand();
}
}
}

public enum Action
Expand Down
Loading