Skip to content

Commit d386735

Browse files
committed
Merge remote-tracking branch 'origin/dev' into add_nodejs_env
2 parents 5af272a + 5a5d407 commit d386735

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+478
-217
lines changed

Flow.Launcher.Core/Resource/LocalizationConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Reflection;
55
using System.Windows.Data;
66

7-
namespace Flow.Launcher.Core
7+
namespace Flow.Launcher.Core.Resource
88
{
99
public class LocalizationConverter : IValueConverter
1010
{

Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.ComponentModel;
2-
using Flow.Launcher.Core.Resource;
32

4-
namespace Flow.Launcher.Core
3+
namespace Flow.Launcher.Core.Resource
54
{
65
public class LocalizedDescriptionAttribute : DescriptionAttribute
76
{

Flow.Launcher/Converters/TranslationConverter.cs renamed to Flow.Launcher.Core/Resource/TranslationConverter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using System;
22
using System.Globalization;
33
using System.Windows.Data;
4-
using Flow.Launcher.Core.Resource;
54

6-
namespace Flow.Launcher.Converters
5+
namespace Flow.Launcher.Core.Resource
76
{
8-
public class TranlationConverter : IValueConverter
7+
public class TranslationConverter : IValueConverter
98
{
109
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1110
{

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ public CustomBrowserViewModel CustomBrowser
147147
/// </summary>
148148
public bool ShouldUsePinyin { get; set; } = false;
149149
public bool AlwaysPreview { get; set; } = false;
150+
public bool AlwaysStartEn { get; set; } = false;
150151

151152
[JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))]
152153
public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular;
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
using System.Windows.Input;
5+
6+
namespace Flow.Launcher.Converters
7+
{
8+
internal class BoolToIMEConversionModeConverter : IValueConverter
9+
{
10+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
11+
{
12+
if (value is bool v)
13+
{
14+
if (v)
15+
{
16+
return ImeConversionModeValues.Alphanumeric;
17+
}
18+
else
19+
{
20+
return ImeConversionModeValues.DoNotCare;
21+
}
22+
}
23+
return ImeConversionModeValues.DoNotCare;
24+
}
25+
26+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
27+
{
28+
throw new NotImplementedException();
29+
}
30+
}
31+
32+
internal class BoolToIMEStateConverter : IValueConverter
33+
{
34+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
35+
{
36+
if (value is bool v)
37+
{
38+
if (v)
39+
{
40+
return InputMethodState.Off;
41+
}
42+
else
43+
{
44+
return InputMethodState.DoNotCare;
45+
}
46+
}
47+
return InputMethodState.DoNotCare;
48+
}
49+
50+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
51+
{
52+
throw new NotImplementedException();
53+
}
54+
}
55+
}

Flow.Launcher/CustomShortcutSetting.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
<TextBlock
6565
Grid.Column="0"
6666
Margin="0,0,0,0"
67-
FontFamily="Segoe UI"
6867
FontSize="20"
6968
FontWeight="SemiBold"
7069
Text="{DynamicResource customQueryShortcut}"

Flow.Launcher/Languages/en.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<system:String x:Key="copy">Copy</system:String>
1919
<system:String x:Key="cut">Cut</system:String>
2020
<system:String x:Key="paste">Paste</system:String>
21+
<system:String x:Key="undo">Undo</system:String>
22+
<system:String x:Key="selectAll">Select All</system:String>
2123
<system:String x:Key="fileTitle">File</system:String>
2224
<system:String x:Key="folderTitle">Folder</system:String>
2325
<system:String x:Key="textTitle">Text</system:String>
@@ -59,6 +61,8 @@
5961
<system:String x:Key="nodeFilePath">Node.js Path</system:String>
6062
<system:String x:Key="selectNodeExecutable">Please select the Node.js executable</system:String>
6163
<system:String x:Key="selectPythonExecutable">Please select pythonw.exe</system:String>
64+
<system:String x:Key="typingStartEn">Always Start Typing in English Mode</system:String>
65+
<system:String x:Key="typingStartEnTooltip">Temporarily change your input method to English mode when activating Flow.</system:String>
6266
<system:String x:Key="autoUpdates">Auto Update</system:String>
6367
<system:String x:Key="select">Select</system:String>
6468
<system:String x:Key="hideOnStartup">Hide Flow Launcher on startup</system:String>
@@ -69,7 +73,7 @@
6973
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
7074
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
7175
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
72-
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
76+
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
7377
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
7478

7579
<!-- Setting Plugin -->

Flow.Launcher/MainWindow.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
1010
xmlns:ui="http://schemas.modernwpf.com/2019"
1111
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
12+
d:DataContext="{d:DesignInstance Type=vm:MainViewModel}"
1213
Name="FlowMainWindow"
1314
Title="Flow Launcher"
1415
MinWidth="{Binding MainWindowWidth, Mode=OneWay}"
@@ -37,6 +38,8 @@
3738
<converters:QuerySuggestionBoxConverter x:Key="QuerySuggestionBoxConverter" />
3839
<converters:BorderClipConverter x:Key="BorderClipConverter" />
3940
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
41+
<converters:BoolToIMEConversionModeConverter x:Key="BoolToIMEConversionModeConverter"/>
42+
<converters:BoolToIMEStateConverter x:Key="BoolToIMEStateConverter"/>
4043
</Window.Resources>
4144
<Window.InputBindings>
4245
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
@@ -204,6 +207,8 @@
204207
PreviewKeyUp="QueryTextBox_KeyUp"
205208
Style="{DynamicResource QueryBoxStyle}"
206209
Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
210+
InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}"
211+
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
207212
Visibility="Visible">
208213
<TextBox.CommandBindings>
209214
<CommandBinding Command="ApplicationCommands.Copy" Executed="OnCopy" />
@@ -244,6 +249,7 @@
244249
</TextBox>
245250
</Grid>
246251
</Border>
252+
247253
<StackPanel
248254
x:Name="ClockPanel"
249255
IsHitTestVisible="False"

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,10 @@
2020
using System.Windows.Media;
2121
using Flow.Launcher.Infrastructure.Hotkey;
2222
using Flow.Launcher.Plugin.SharedCommands;
23-
using System.Text;
24-
using DataObject = System.Windows.DataObject;
25-
using System.Diagnostics;
26-
using Microsoft.AspNetCore.Http;
27-
using System.IO;
2823
using System.Windows.Threading;
2924
using System.Windows.Data;
3025
using ModernWpf.Controls;
31-
using System.Drawing;
32-
using System.Windows.Forms.Design.Behavior;
33-
using System.Security.Cryptography;
34-
using System.Runtime.CompilerServices;
35-
using Microsoft.VisualBasic.Devices;
36-
using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames;
26+
using Key = System.Windows.Input.Key;
3727

3828
namespace Flow.Launcher
3929
{

Flow.Launcher/Resources/CustomControlTemplate.xaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@
44
xmlns:system="clr-namespace:System;assembly=mscorlib"
55
xmlns:ui="http://schemas.modernwpf.com/2019">
66

7+
<ContextMenu x:Key="TextBoxContextMenu">
8+
<MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}">
9+
<MenuItem.Icon>
10+
<ui:FontIcon Glyph="&#xe8c6;" />
11+
</MenuItem.Icon>
12+
</MenuItem>
13+
<MenuItem Command="ApplicationCommands.Copy" Header="{DynamicResource copy}">
14+
<MenuItem.Icon>
15+
<ui:FontIcon Glyph="&#xe8c8;" />
16+
</MenuItem.Icon>
17+
</MenuItem>
18+
<MenuItem Command="ApplicationCommands.Paste" Header="{DynamicResource paste}">
19+
<MenuItem.Icon>
20+
<ui:FontIcon Glyph="&#xe77f;" />
21+
</MenuItem.Icon>
22+
</MenuItem>
23+
<MenuItem Command="ApplicationCommands.Undo" Header="{DynamicResource undo}">
24+
<MenuItem.Icon>
25+
<ui:FontIcon Glyph="&#xe10e;" />
26+
</MenuItem.Icon>
27+
</MenuItem>
28+
<MenuItem Command="ApplicationCommands.SelectAll" Header="{DynamicResource selectAll}" />
29+
</ContextMenu>
30+
731

832
<Style TargetType="{x:Type ContentControl}">
933
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
@@ -1357,7 +1381,13 @@
13571381
</Setter>
13581382
</Style>
13591383

1360-
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox" />
1384+
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox">
1385+
<Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
1386+
</Style>
1387+
1388+
<Style BasedOn="{StaticResource DefaultPasswordBoxStyle}" TargetType="PasswordBox">
1389+
<Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
1390+
</Style>
13611391

13621392
<Style
13631393
x:Key="DataGridTextBoxStyle"
@@ -2969,6 +2999,8 @@
29692999
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPressed}" />
29703000
</Trigger>
29713001
<Trigger Property="IsEnabled" Value="False">
3002+
<!-- Hide Disabled Item -->
3003+
<Setter TargetName="LayoutRoot" Property="Visibility" Value="Collapsed" />
29723004
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundDisabled}" />
29733005
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
29743006
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
@@ -3252,4 +3284,6 @@
32523284
</Trigger>
32533285
</Style.Triggers>
32543286
</Style>
3287+
3288+
32553289
</ResourceDictionary>

0 commit comments

Comments
 (0)