mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into 250412-ImportThemePreset
This commit is contained in:
commit
d045c49ff7
5 changed files with 81 additions and 25 deletions
|
|
@ -223,11 +223,15 @@ namespace Flow.Launcher.Plugin
|
||||||
Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, Action<double> reportProgress = null, CancellationToken token = default);
|
Task HttpDownloadAsync([NotNull] string url, [NotNull] string filePath, Action<double> reportProgress = null, CancellationToken token = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add ActionKeyword and update action keyword metadata for specific plugin
|
/// Add ActionKeyword and update action keyword metadata for specific plugin.
|
||||||
/// Before adding, please check if action keyword is already assigned by <see cref="ActionKeywordAssigned"/>
|
/// Before adding, please check if action keyword is already assigned by <see cref="ActionKeywordAssigned"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pluginId">ID for plugin that needs to add action keyword</param>
|
/// <param name="pluginId">ID for plugin that needs to add action keyword</param>
|
||||||
/// <param name="newActionKeyword">The actionkeyword that is supposed to be added</param>
|
/// <param name="newActionKeyword">The actionkeyword that is supposed to be added</param>
|
||||||
|
/// <remarks>
|
||||||
|
/// If new action keyword contains any whitespace, FL will still add it but it will not work for users.
|
||||||
|
/// So plugin should check the whitespace before calling this function.
|
||||||
|
/// </remarks>
|
||||||
void AddActionKeyword(string pluginId, string newActionKeyword);
|
void AddActionKeyword(string pluginId, string newActionKeyword);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -280,9 +284,10 @@ namespace Flow.Launcher.Plugin
|
||||||
T LoadSettingJsonStorage<T>() where T : new();
|
T LoadSettingJsonStorage<T>() where T : new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save JsonStorage for current plugin's setting. This is the method used to save settings to json in Flow.Launcher
|
/// Save JsonStorage for current plugin's setting. This is the method used to save settings to json in Flow.
|
||||||
/// This method will save the original instance loaded with LoadJsonStorage.
|
/// This method will save the original instance loaded with LoadJsonStorage.
|
||||||
/// This API call is for manually Save. Flow will automatically save all setting type that has called LoadSettingJsonStorage or SaveSettingJsonStorage previously.
|
/// This API call is for manually Save.
|
||||||
|
/// Flow will automatically save all setting type that has called <see cref="LoadSettingJsonStorage"/> or <see cref="SaveSettingJsonStorage"/> previously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type for Serialization</typeparam>
|
/// <typeparam name="T">Type for Serialization</typeparam>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
@ -424,9 +429,10 @@ namespace Flow.Launcher.Plugin
|
||||||
Task<T> LoadCacheBinaryStorageAsync<T>(string cacheName, string cacheDirectory, T defaultData) where T : new();
|
Task<T> LoadCacheBinaryStorageAsync<T>(string cacheName, string cacheDirectory, T defaultData) where T : new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save BinaryStorage for current plugin's cache. This is the method used to save cache to binary in Flow.Launcher
|
/// Save BinaryStorage for current plugin's cache. This is the method used to save cache to binary in Flow.
|
||||||
/// This method will save the original instance loaded with LoadCacheBinaryStorageAsync.
|
/// This method will save the original instance loaded with LoadCacheBinaryStorageAsync.
|
||||||
/// This API call is for manually Save. Flow will automatically save all cache type that has called LoadCacheBinaryStorageAsync or SaveCacheBinaryStorageAsync previously.
|
/// This API call is for manually Save.
|
||||||
|
/// Flow will automatically save all cache type that has called <see cref="LoadCacheBinaryStorageAsync"/> or <see cref="SaveCacheBinaryStorageAsync"/> previously.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">Type for Serialization</typeparam>
|
/// <typeparam name="T">Type for Serialization</typeparam>
|
||||||
/// <param name="cacheName">Cache file name</param>
|
/// <param name="cacheName">Cache file name</param>
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,7 @@
|
||||||
Width="135"
|
Width="135"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
DataObject.Pasting="TextBox_Pasting"
|
||||||
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
|
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
|
||||||
Text="{Binding ActionKeyword}" />
|
Text="{Binding ActionKeyword}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
@ -85,7 +86,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
DialogResult = false;
|
DialogResult = false;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TxtCurrentActionKeyword_OnKeyDown(object sender, KeyEventArgs e)
|
private void TxtCurrentActionKeyword_OnKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
|
|
@ -94,14 +95,34 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
||||||
OnDoneButtonClick(sender, e);
|
OnDoneButtonClick(sender, e);
|
||||||
e.Handled = true;
|
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;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
private bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
if (EqualityComparer<T>.Default.Equals(field, value))
|
if (EqualityComparer<T>.Default.Equals(field, value))
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,13 @@
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Margin="26,12,26,0">
|
<StackPanel Margin="26 12 26 0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
<StackPanel Grid.Row="0" Margin="0 0 0 12">
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="0,0,0,0"
|
Margin="0 0 0 0"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
Text="{DynamicResource flowlauncher_plugin_websearch_window_title}"
|
Text="{DynamicResource flowlauncher_plugin_websearch_window_title}"
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
TextWrapping="WrapWithOverflow" />
|
TextWrapping="WrapWithOverflow" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Margin="0,12,0,12"
|
Margin="0 12 0 12"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontWeight="SemiBold"
|
FontWeight="SemiBold"
|
||||||
IsReadOnly="True"
|
IsReadOnly="True"
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
TextAlignment="Center"
|
TextAlignment="Center"
|
||||||
TextWrapping="WrapWithOverflow" />
|
TextWrapping="WrapWithOverflow" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="0,0,0,14"
|
Margin="0 0 0 14"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
Text="{DynamicResource flowlauncher_plugin_websearch_guide_3}"
|
Text="{DynamicResource flowlauncher_plugin_websearch_guide_3}"
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="10,10,15,10"
|
Margin="10 10 15 10"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="10,10,15,10"
|
Margin="10 10 15 10"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
|
@ -131,7 +131,7 @@
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
<Button
|
<Button
|
||||||
Height="35"
|
Height="35"
|
||||||
Margin="10,0,0,0"
|
Margin="10 0 0 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Click="OnSelectIconClick"
|
Click="OnSelectIconClick"
|
||||||
Content="{DynamicResource flowlauncher_plugin_websearch_select_icon}" />
|
Content="{DynamicResource flowlauncher_plugin_websearch_select_icon}" />
|
||||||
|
|
@ -139,13 +139,13 @@
|
||||||
Name="imgPreviewIcon"
|
Name="imgPreviewIcon"
|
||||||
Width="24"
|
Width="24"
|
||||||
Height="24"
|
Height="24"
|
||||||
Margin="14,0,0,0"
|
Margin="14 0 0 0"
|
||||||
VerticalAlignment="Center" />
|
VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="10,10,15,10"
|
Margin="10 10 15 10"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
|
@ -160,7 +160,7 @@
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="10,10,15,10"
|
Margin="10 10 15 10"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
|
@ -168,14 +168,16 @@
|
||||||
<TextBox
|
<TextBox
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="10,0,10,0"
|
Margin="10 0 10 0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
DataObject.Pasting="TextBox_Pasting"
|
||||||
|
PreviewKeyDown="TextBox_PreviewKeyDown"
|
||||||
Text="{Binding SearchSource.ActionKeyword}" />
|
Text="{Binding SearchSource.ActionKeyword}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="10,10,15,15"
|
Margin="10 10 15 15"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
|
|
@ -183,7 +185,7 @@
|
||||||
<CheckBox
|
<CheckBox
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="10,10,10,15"
|
Margin="10 10 10 15"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsChecked="{Binding SearchSource.Enabled}" />
|
IsChecked="{Binding SearchSource.Enabled}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
@ -196,16 +198,16 @@
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Background="{DynamicResource PopupButtonAreaBGColor}"
|
Background="{DynamicResource PopupButtonAreaBGColor}"
|
||||||
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
||||||
BorderThickness="0,1,0,0">
|
BorderThickness="0 1 0 0">
|
||||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||||
<Button
|
<Button
|
||||||
MinWidth="140"
|
MinWidth="140"
|
||||||
Margin="10,0,5,0"
|
Margin="10 0 5 0"
|
||||||
Click="OnCancelButtonClick"
|
Click="OnCancelButtonClick"
|
||||||
Content="{DynamicResource flowlauncher_plugin_websearch_cancel}" />
|
Content="{DynamicResource flowlauncher_plugin_websearch_cancel}" />
|
||||||
<Button
|
<Button
|
||||||
MinWidth="140"
|
MinWidth="140"
|
||||||
Margin="5,0,10,0"
|
Margin="5 0 10 0"
|
||||||
Click="OnConfirmButtonClick"
|
Click="OnConfirmButtonClick"
|
||||||
Content="{DynamicResource flowlauncher_plugin_websearch_confirm}"
|
Content="{DynamicResource flowlauncher_plugin_websearch_confirm}"
|
||||||
Style="{DynamicResource AccentButtonStyle}" />
|
Style="{DynamicResource AccentButtonStyle}" />
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
||||||
namespace Flow.Launcher.Plugin.WebSearch
|
namespace Flow.Launcher.Plugin.WebSearch
|
||||||
|
|
@ -145,6 +147,30 @@ namespace Flow.Launcher.Plugin.WebSearch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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
|
public enum Action
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue