mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into quicklook
This commit is contained in:
commit
0c0806ec08
11 changed files with 401 additions and 50 deletions
BIN
Flow.Launcher/Images/Error.png
Normal file
BIN
Flow.Launcher/Images/Error.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
BIN
Flow.Launcher/Images/Exclamation.png
Normal file
BIN
Flow.Launcher/Images/Exclamation.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
Flow.Launcher/Images/Information.png
Normal file
BIN
Flow.Launcher/Images/Information.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
Flow.Launcher/Images/Question.png
Normal file
BIN
Flow.Launcher/Images/Question.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
|
|
@ -204,6 +204,7 @@
|
|||
<system:String x:Key="CycleHistoryUpHotkey">Cycle Previous Query</system:String>
|
||||
<system:String x:Key="CycleHistoryDownHotkey">Cycle Next Query</system:String>
|
||||
<system:String x:Key="OpenContextMenuHotkey">Open Context Menu</system:String>
|
||||
<system:String x:Key="OpenNativeContextMenuHotkey">Open Native Context Menu</system:String>
|
||||
<system:String x:Key="SettingWindowHotkey">Open Setting Window</system:String>
|
||||
<system:String x:Key="CopyFilePathHotkey">Copy File Path</system:String>
|
||||
<system:String x:Key="ToggleGameModeHotkey">Toggle Game Mode</system:String>
|
||||
|
|
@ -348,6 +349,9 @@
|
|||
<system:String x:Key="commonCancel">Cancel</system:String>
|
||||
<system:String x:Key="commonReset">Reset</system:String>
|
||||
<system:String x:Key="commonDelete">Delete</system:String>
|
||||
<system:String x:Key="commonOK">OK</system:String>
|
||||
<system:String x:Key="commonYes">Yes</system:String>
|
||||
<system:String x:Key="commonNo">No</system:String>
|
||||
|
||||
<!-- Crash Reporter -->
|
||||
<system:String x:Key="reportWindow_version">Version</system:String>
|
||||
|
|
|
|||
142
Flow.Launcher/MessageBoxEx.xaml
Normal file
142
Flow.Launcher/MessageBoxEx.xaml
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<Window
|
||||
x:Class="Flow.Launcher.MessageBoxEx"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:Name="MessageBoxWindow"
|
||||
Width="420"
|
||||
Height="Auto"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window.InputBindings>
|
||||
<KeyBinding Key="Escape" Command="Close" />
|
||||
</Window.InputBindings>
|
||||
<Window.CommandBindings>
|
||||
<CommandBinding Command="Close" Executed="cmdEsc_OnPress" />
|
||||
</Window.CommandBindings>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition MinHeight="68" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Grid.Column="4"
|
||||
Click="Button_Cancel"
|
||||
Style="{StaticResource TitleBarCloseButtonStyle}">
|
||||
<Path
|
||||
Width="46"
|
||||
Height="32"
|
||||
Data="M 18,11 27,20 M 18,20 27,11"
|
||||
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
|
||||
StrokeThickness="1">
|
||||
<Path.Style>
|
||||
<Style TargetType="Path">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Path.Style>
|
||||
</Path>
|
||||
</Button>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Margin="30 0 30 24">
|
||||
<Grid Grid.Column="0" Margin="0 0 0 12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Name="Img"
|
||||
Grid.Column="0"
|
||||
Width="18"
|
||||
Height="18"
|
||||
Margin="0 0 0 0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
RenderOptions.BitmapScalingMode="Fant"
|
||||
Stretch="UniformToFill"
|
||||
Visibility="Collapsed" />
|
||||
<TextBlock
|
||||
x:Name="TitleTextBlock"
|
||||
Grid.Column="1"
|
||||
MaxWidth="400"
|
||||
Margin="10 0 26 0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Segoe UI"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
<TextBlock
|
||||
x:Name="DescTextBlock"
|
||||
Grid.Column="1"
|
||||
MaxWidth="400"
|
||||
Margin="0 0 26 0"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontSize="14"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Margin="0 0 0 0"
|
||||
Background="{DynamicResource PopupButtonAreaBGColor}"
|
||||
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
||||
BorderThickness="0 1 0 0">
|
||||
<WrapPanel
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
MinWidth="140"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonCancel}" />
|
||||
<Button
|
||||
x:Name="btnNo"
|
||||
MinWidth="140"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonNo}" />
|
||||
<Button
|
||||
x:Name="btnOk"
|
||||
MinWidth="140"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonOK}" />
|
||||
<Button
|
||||
x:Name="btnYes"
|
||||
MinWidth="140"
|
||||
Margin="5 0 5 0"
|
||||
Click="Button_Click"
|
||||
Content="{DynamicResource commonYes}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
192
Flow.Launcher/MessageBoxEx.xaml.cs
Normal file
192
Flow.Launcher/MessageBoxEx.xaml.cs
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Image;
|
||||
using YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
public partial class MessageBoxEx : Window
|
||||
{
|
||||
public MessageBoxEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public enum MessageBoxType
|
||||
{
|
||||
ConfirmationWithYesNo = 0,
|
||||
ConfirmationWithYesNoCancel,
|
||||
YesNo,
|
||||
Information,
|
||||
Error,
|
||||
Warning
|
||||
}
|
||||
|
||||
public enum MessageBoxImage
|
||||
{
|
||||
Warning = 0,
|
||||
Question,
|
||||
Information,
|
||||
Error,
|
||||
None
|
||||
}
|
||||
|
||||
static MessageBoxEx msgBox;
|
||||
static MessageBoxResult _result = MessageBoxResult.No;
|
||||
|
||||
|
||||
/// 1 parameter
|
||||
public static MessageBoxResult Show(string msg)
|
||||
{
|
||||
return Show(string.Empty, msg, MessageBoxButton.OK, MessageBoxImage.None);
|
||||
}
|
||||
|
||||
// 2 parameter
|
||||
public static MessageBoxResult Show(string caption, string text)
|
||||
{
|
||||
return Show(caption, text, MessageBoxButton.OK, MessageBoxImage.None);
|
||||
}
|
||||
|
||||
/// 3 parameter
|
||||
public static MessageBoxResult Show(string caption, string msg, MessageBoxType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MessageBoxType.ConfirmationWithYesNo:
|
||||
return Show(caption, msg, MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
case MessageBoxType.YesNo:
|
||||
return Show(caption, msg, MessageBoxButton.YesNo,
|
||||
MessageBoxImage.Question);
|
||||
case MessageBoxType.ConfirmationWithYesNoCancel:
|
||||
return Show(caption, msg, MessageBoxButton.YesNoCancel,
|
||||
MessageBoxImage.Question);
|
||||
case MessageBoxType.Information:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Information);
|
||||
case MessageBoxType.Error:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
case MessageBoxType.Warning:
|
||||
return Show(caption, msg, MessageBoxButton.OK,
|
||||
MessageBoxImage.Warning);
|
||||
default:
|
||||
return MessageBoxResult.No;
|
||||
}
|
||||
}
|
||||
|
||||
// 4 parameter, Final Display Message.
|
||||
public static MessageBoxResult Show(string caption, string text, MessageBoxButton button, MessageBoxImage image)
|
||||
{
|
||||
msgBox = new MessageBoxEx();
|
||||
msgBox.TitleTextBlock.Text = text;
|
||||
msgBox.DescTextBlock.Text = caption;
|
||||
msgBox.Title = text;
|
||||
SetVisibilityOfButtons(button);
|
||||
SetImageOfMessageBox(image);
|
||||
msgBox.ShowDialog();
|
||||
return _result;
|
||||
}
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender == btnOk)
|
||||
_result = MessageBoxResult.OK;
|
||||
else if (sender == btnYes)
|
||||
_result = MessageBoxResult.Yes;
|
||||
else if (sender == btnNo)
|
||||
_result = MessageBoxResult.No;
|
||||
else if (sender == btnCancel)
|
||||
_result = MessageBoxResult.Cancel;
|
||||
else
|
||||
_result = MessageBoxResult.None;
|
||||
msgBox.Close();
|
||||
msgBox = null;
|
||||
}
|
||||
|
||||
private static void SetVisibilityOfButtons(MessageBoxButton button)
|
||||
{
|
||||
switch (button)
|
||||
{
|
||||
case MessageBoxButton.OK:
|
||||
msgBox.btnCancel.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnNo.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnYes.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnOk.Focus();
|
||||
break;
|
||||
case MessageBoxButton.OKCancel:
|
||||
msgBox.btnNo.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnYes.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Focus();
|
||||
break;
|
||||
case MessageBoxButton.YesNo:
|
||||
msgBox.btnOk.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnNo.Focus();
|
||||
break;
|
||||
case MessageBoxButton.YesNoCancel:
|
||||
msgBox.btnOk.Visibility = Visibility.Collapsed;
|
||||
msgBox.btnCancel.Focus();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
private static void SetImageOfMessageBox(MessageBoxImage image)
|
||||
{
|
||||
switch (image)
|
||||
{
|
||||
case MessageBoxImage.Warning:
|
||||
msgBox.SetImage("Warning.png");
|
||||
msgBox.Img.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case MessageBoxImage.Question:
|
||||
msgBox.SetImage("Question.png");
|
||||
msgBox.Img.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case MessageBoxImage.Information:
|
||||
msgBox.SetImage("Information.png");
|
||||
msgBox.Img.Visibility = Visibility.Visible;
|
||||
break;
|
||||
case MessageBoxImage.Error:
|
||||
msgBox.SetImage("Error.png");
|
||||
msgBox.Img.Visibility = Visibility.Visible;
|
||||
break;
|
||||
default:
|
||||
msgBox.Img.Visibility = Visibility.Collapsed;
|
||||
break;
|
||||
}
|
||||
}
|
||||
private void SetImage(string imageName)
|
||||
{
|
||||
string uri = Constant.ProgramDirectory + "/Images/" + imageName;
|
||||
var uriSource = new Uri(uri, UriKind.RelativeOrAbsolute);
|
||||
Img.Source = new BitmapImage(uriSource);
|
||||
}
|
||||
private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
DialogResult = false;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Button_Cancel(object sender, RoutedEventArgs e)
|
||||
{
|
||||
msgBox.Close();
|
||||
msgBox = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ using Flow.Launcher.Core.Resource;
|
|||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using static Flow.Launcher.MessageBoxEx;
|
||||
|
||||
namespace Flow.Launcher.SettingPages.ViewModels;
|
||||
|
||||
|
|
@ -62,10 +63,10 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
[RelayCommand]
|
||||
private void AskClearLogFolderConfirmation()
|
||||
{
|
||||
var confirmResult = MessageBox.Show(
|
||||
var confirmResult = MessageBoxEx.Show(
|
||||
InternationalizationManager.Instance.GetTranslation("clearlogfolderMessage"),
|
||||
InternationalizationManager.Instance.GetTranslation("clearlogfolder"),
|
||||
MessageBoxButton.YesNo
|
||||
MessageBoxType.YesNo
|
||||
);
|
||||
|
||||
if (confirmResult == MessageBoxResult.Yes)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
|
||||
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
|
||||
xmlns:viewModels="clr-namespace:Flow.Launcher.SettingPages.ViewModels"
|
||||
Title="Hotkey"
|
||||
d:DataContext="{d:DesignInstance viewModels:SettingsPaneHotkeyViewModel}"
|
||||
|
|
@ -33,9 +33,9 @@
|
|||
Sub="{DynamicResource flowlauncherHotkeyToolTip}">
|
||||
<flowlauncher:HotkeyControl
|
||||
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Alt+Space"
|
||||
Hotkey="{Binding Settings.Hotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="True"
|
||||
WindowTitle="{DynamicResource flowlauncherHotkey}" />
|
||||
</cc:Card>
|
||||
|
|
@ -45,17 +45,15 @@
|
|||
Icon=""
|
||||
Sub="{DynamicResource previewHotkeyToolTip}">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="F1"
|
||||
Hotkey="{Binding Settings.PreviewHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False"
|
||||
WindowTitle="{DynamicResource previewHotkey}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:CardGroup Margin="0 12 0 0">
|
||||
<cc:Card
|
||||
Title="{DynamicResource openResultModifiers}"
|
||||
Sub="{DynamicResource openResultModifiersToolTip}">
|
||||
<cc:Card Title="{DynamicResource openResultModifiers}" Sub="{DynamicResource openResultModifiersToolTip}">
|
||||
<ComboBox
|
||||
Width="120"
|
||||
FontSize="14"
|
||||
|
|
@ -106,9 +104,9 @@
|
|||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Ctrl+I"
|
||||
Hotkey="{Binding Settings.OpenContextMenuHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
|
|
@ -117,15 +115,20 @@
|
|||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Shift+Enter" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card
|
||||
Title="{DynamicResource OpenNativeContextMenuHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Alt+Enter" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource SettingWindowHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Ctrl+I"
|
||||
Hotkey="{Binding Settings.SettingWindowHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
|
|
@ -172,9 +175,9 @@
|
|||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectPrevPageHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
|
|
@ -182,9 +185,9 @@
|
|||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectNextPageHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
|
||||
|
|
@ -217,9 +220,9 @@
|
|||
Sub="{DynamicResource autoCompleteHotkeyToolTip}">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Ctrl+Tab"
|
||||
Hotkey="{Binding Settings.AutoCompleteHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
|
|
@ -227,9 +230,9 @@
|
|||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.AutoCompleteHotkey2}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
|
@ -240,9 +243,9 @@
|
|||
Icon="">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Shift+Tab"
|
||||
Hotkey="{Binding Settings.SelectPrevItemHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
|
|
@ -250,9 +253,9 @@
|
|||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectPrevItemHotkey2}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
|
@ -263,9 +266,9 @@
|
|||
Icon="">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey="Tab"
|
||||
Hotkey="{Binding Settings.SelectNextItemHotkey}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
|
|
@ -273,9 +276,9 @@
|
|||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
HotkeySettings="{Binding Settings}"
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectNextItemHotkey2}"
|
||||
HotkeySettings="{Binding Settings}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
|
@ -435,8 +438,7 @@
|
|||
<GridViewColumn Width="430" Header="{DynamicResource builtinShortcutDescription}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="{x:Type userSettings:BuiltinShortcutModel}">
|
||||
<TextBlock
|
||||
Text="{Binding Description, Converter={StaticResource TranslationConverter}}" />
|
||||
<TextBlock Text="{Binding Description, Converter={StaticResource TranslationConverter}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
|
|
|||
|
|
@ -222,34 +222,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
if (record.Type is ResultType.Volume)
|
||||
return false;
|
||||
|
||||
var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2;
|
||||
var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2;
|
||||
var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter);
|
||||
|
||||
switch (record.Type)
|
||||
{
|
||||
case ResultType.File:
|
||||
{
|
||||
var fileInfos = new FileInfo[]
|
||||
{
|
||||
new(record.FullPath)
|
||||
};
|
||||
|
||||
new Peter.ShellContextMenu().ShowContextMenu(fileInfos, showPosition);
|
||||
break;
|
||||
}
|
||||
case ResultType.Folder:
|
||||
{
|
||||
var directoryInfos = new DirectoryInfo[]
|
||||
{
|
||||
new(record.FullPath)
|
||||
};
|
||||
|
||||
new Peter.ShellContextMenu().ShowContextMenu(directoryInfos, showPosition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ResultManager.ShowNativeContextMenu(record.FullPath, record.Type);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ using System.Windows.Input;
|
|||
using Path = System.IO.Path;
|
||||
using System.Windows.Controls;
|
||||
using Flow.Launcher.Plugin.Explorer.Views;
|
||||
using Peter;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Search
|
||||
{
|
||||
|
|
@ -70,6 +71,27 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
};
|
||||
}
|
||||
|
||||
internal static void ShowNativeContextMenu(string path, ResultType type)
|
||||
{
|
||||
var screenWithMouseCursor = System.Windows.Forms.Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
var xOfScreenCenter = screenWithMouseCursor.WorkingArea.Left + screenWithMouseCursor.WorkingArea.Width / 2;
|
||||
var yOfScreenCenter = screenWithMouseCursor.WorkingArea.Top + screenWithMouseCursor.WorkingArea.Height / 2;
|
||||
var showPosition = new System.Drawing.Point(xOfScreenCenter, yOfScreenCenter);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ResultType.File:
|
||||
var fileInfo = new FileInfo[] { new(path) };
|
||||
new ShellContextMenu().ShowContextMenu(fileInfo, showPosition);
|
||||
break;
|
||||
|
||||
case ResultType.Folder:
|
||||
var folderInfo = new System.IO.DirectoryInfo[] { new(path) };
|
||||
new ShellContextMenu().ShowContextMenu(folderInfo, showPosition);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Result CreateFolderResult(string title, string subtitle, string path, Query query, int score = 0, bool windowsIndexed = false)
|
||||
{
|
||||
return new Result
|
||||
|
|
@ -86,6 +108,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
},
|
||||
Action = c =>
|
||||
{
|
||||
if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt)
|
||||
{
|
||||
ShowNativeContextMenu(path, ResultType.Folder);
|
||||
return false;
|
||||
}
|
||||
// open folder
|
||||
if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))
|
||||
{
|
||||
|
|
@ -226,8 +253,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
IcoPath = folderPath,
|
||||
Score = 500,
|
||||
CopyText = folderPath,
|
||||
Action = _ =>
|
||||
Action = c =>
|
||||
{
|
||||
if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt)
|
||||
{
|
||||
ShowNativeContextMenu(folderPath, ResultType.Folder);
|
||||
return false;
|
||||
}
|
||||
OpenFolder(folderPath);
|
||||
return true;
|
||||
},
|
||||
|
|
@ -261,6 +293,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
PreviewPanel = new Lazy<UserControl>(() => new PreviewPanel(Settings, filePath)),
|
||||
Action = c =>
|
||||
{
|
||||
if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Alt)
|
||||
{
|
||||
ShowNativeContextMenu(filePath, ResultType.File);
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))
|
||||
|
|
|
|||
Loading…
Reference in a new issue