Skip to content

Commit cc0c198

Browse files
authored
Merge pull request #1695 from VictoriousRaptor/FixText
Fix undefined
2 parents 3ae2ede + b74a8d0 commit cc0c198

File tree

14 files changed

+179
-127
lines changed

14 files changed

+179
-127
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/Languages/en.xaml

Lines changed: 3 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>
@@ -68,7 +70,7 @@
6870
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
6971
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
7072
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
71-
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
73+
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
7274
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
7375

7476
<!-- Setting Plugin -->

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>

Flow.Launcher/SettingWindow.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
6+
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
67
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
78
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
89
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -42,7 +43,7 @@
4243
<converters:BorderClipConverter x:Key="BorderClipConverter" />
4344
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
4445
<converters:TextConverter x:Key="TextConverter" />
45-
<converters:TranlationConverter x:Key="TranslationConverter" />
46+
<core:TranslationConverter x:Key="TranslationConverter" />
4647
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
4748
<CollectionViewSource.SortDescriptions>
4849
<scm:SortDescription PropertyName="Source" />
@@ -1038,6 +1039,7 @@
10381039
Height="34"
10391040
Margin="0,5,26,0"
10401041
HorizontalAlignment="Right"
1042+
ContextMenu="{StaticResource TextBoxContextMenu}"
10411043
DockPanel.Dock="Right"
10421044
FontSize="14"
10431045
KeyDown="PluginFilterTxb_OnKeyDown"
@@ -1429,6 +1431,7 @@
14291431
Height="34"
14301432
Margin="0,0,26,0"
14311433
HorizontalAlignment="Right"
1434+
ContextMenu="{StaticResource TextBoxContextMenu}"
14321435
DockPanel.Dock="Right"
14331436
FontSize="14"
14341437
KeyDown="PluginStoreFilterTxb_OnKeyDown"
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.ComponentModel;
4-
using System.Globalization;
5-
using System.Linq;
6-
using System.Text;
7-
using System.Threading.Tasks;
8-
using Flow.Launcher.Core;
1+
using System.ComponentModel;
2+
using Flow.Launcher.Core.Resource;
93

104
namespace Flow.Launcher.Plugin.Caculator
115
{
@@ -21,4 +15,4 @@ public enum DecimalSeparator
2115
[LocalizedDescription("flowlauncher_plugin_calculator_decimal_seperator_comma")]
2216
Comma
2317
}
24-
}
18+
}

Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:calculator="clr-namespace:Flow.Launcher.Plugin.Caculator"
6-
xmlns:core="clr-namespace:Flow.Launcher.Core;assembly=Flow.Launcher.Core"
6+
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
88
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
99
xmlns:ui="clr-namespace:Flow.Launcher.Infrastructure.UI;assembly=Flow.Launcher.Infrastructure"

Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ public List<Result> LoadContextMenus(Result selectedResult)
4242
if (record.Type == ResultType.File && !string.IsNullOrEmpty(Settings.EditorPath))
4343
contextMenus.Add(CreateOpenWithEditorResult(record));
4444

45-
if (record.Type == ResultType.Folder && record.WindowsIndexed)
45+
if (record.Type == ResultType.Folder)
4646
{
47-
contextMenus.Add(CreateAddToIndexSearchExclusionListResult(record));
4847
contextMenus.Add(CreateOpenWithShellResult(record));
48+
if (record.WindowsIndexed)
49+
{
50+
contextMenus.Add(CreateAddToIndexSearchExclusionListResult(record));
51+
}
4952
}
53+
5054
contextMenus.Add(CreateOpenContainingFolderResult(record));
5155

5256
if (record.WindowsIndexed)
@@ -55,14 +59,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
5559
}
5660

5761
var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath;
58-
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
62+
bool isFile = record.Type == ResultType.File;
5963

6064
if (Settings.QuickAccessLinks.All(x => !x.Path.Equals(record.FullPath, StringComparison.OrdinalIgnoreCase)))
6165
{
6266
contextMenus.Add(new Result
6367
{
6468
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
65-
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"), fileOrFolder),
69+
SubTitle = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"),
6670
Action = (context) =>
6771
{
6872
Settings.QuickAccessLinks.Add(new AccessLink
@@ -71,10 +75,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
7175
});
7276

7377
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
74-
string.Format(
7578
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
76-
fileOrFolder),
77-
Constants.ExplorerIconImageFullPath);
79+
Constants.ExplorerIconImageFullPath);
7880

7981
ViewModel.Save();
8082

@@ -91,16 +93,14 @@ public List<Result> LoadContextMenus(Result selectedResult)
9193
contextMenus.Add(new Result
9294
{
9395
Title = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_title"),
94-
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"), fileOrFolder),
96+
SubTitle = Context.API.GetTranslation("plugin_explorer_remove_from_quickaccess_subtitle"),
9597
Action = (context) =>
9698
{
97-
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => x.Path == record.FullPath));
99+
Settings.QuickAccessLinks.Remove(Settings.QuickAccessLinks.FirstOrDefault(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)));
98100

99101
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
100-
string.Format(
101102
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
102-
fileOrFolder),
103-
Constants.ExplorerIconImageFullPath);
103+
Constants.ExplorerIconImageFullPath);
104104

105105
ViewModel.Save();
106106

@@ -116,7 +116,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
116116
contextMenus.Add(new Result
117117
{
118118
Title = Context.API.GetTranslation("plugin_explorer_copypath"),
119-
SubTitle = $"Copy the current {fileOrFolder} path to clipboard",
119+
SubTitle = Context.API.GetTranslation("plugin_explorer_copypath_subtitle"),
120120
Action = _ =>
121121
{
122122
try
@@ -138,8 +138,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
138138

139139
contextMenus.Add(new Result
140140
{
141-
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder") + $" {fileOrFolder}",
142-
SubTitle = $"Copy the {fileOrFolder} to clipboard",
141+
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder"),
142+
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_copyfile_subtitle") : Context.API.GetTranslation("plugin_explorer_copyfolder_subtitle"),
143143
Action = _ =>
144144
{
145145
try
@@ -152,7 +152,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
152152
}
153153
catch (Exception e)
154154
{
155-
var message = $"Fail to set {fileOrFolder} in clipboard";
155+
var message = $"Fail to set file/folder in clipboard";
156156
LogException(message, e);
157157
Context.API.ShowMsg(message);
158158
return false;
@@ -167,35 +167,35 @@ public List<Result> LoadContextMenus(Result selectedResult)
167167
if (record.Type is ResultType.File or ResultType.Folder)
168168
contextMenus.Add(new Result
169169
{
170-
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder") + $" {fileOrFolder}",
171-
SubTitle = Context.API.GetTranslation("plugin_explorer_deletefilefolder_subtitle") + $" {fileOrFolder}",
170+
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder"),
171+
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_deletefile_subtitle") : Context.API.GetTranslation("plugin_explorer_deletefolder_subtitle"),
172172
Action = (context) =>
173173
{
174174
try
175175
{
176176
if (MessageBox.Show(
177-
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"), fileOrFolder),
177+
Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"),
178178
string.Empty,
179179
MessageBoxButton.YesNo,
180180
MessageBoxIcon.Warning)
181181
== DialogResult.No)
182182
return false;
183183

184-
if (record.Type == ResultType.File)
184+
if (isFile)
185185
File.Delete(record.FullPath);
186186
else
187187
Directory.Delete(record.FullPath, true);
188188

189189
_ = Task.Run(() =>
190190
{
191191
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"),
192-
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), fileOrFolder),
192+
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), record.FullPath),
193193
Constants.ExplorerIconImageFullPath);
194194
});
195195
}
196196
catch (Exception e)
197197
{
198-
var message = $"Fail to delete {fileOrFolder} at {record.FullPath}";
198+
var message = $"Fail to delete {record.FullPath}";
199199
LogException(message, e);
200200
Context.API.ShowMsgError(message);
201201
return false;
@@ -382,7 +382,7 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
382382
SubTitle = Context.API.GetTranslation("plugin_explorer_path") + " " + record.FullPath,
383383
Action = _ =>
384384
{
385-
if (!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
385+
if (!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)))
386386
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new AccessLink
387387
{
388388
Path = record.FullPath

0 commit comments

Comments
 (0)