Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Flow.Launcher.Core/Resource/LocalizationConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Reflection;
using System.Windows.Data;

namespace Flow.Launcher.Core
namespace Flow.Launcher.Core.Resource
{
public class LocalizationConverter : IValueConverter
{
Expand Down
3 changes: 1 addition & 2 deletions Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.ComponentModel;
using Flow.Launcher.Core.Resource;

namespace Flow.Launcher.Core
namespace Flow.Launcher.Core.Resource
{
public class LocalizedDescriptionAttribute : DescriptionAttribute
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Flow.Launcher.Core.Resource;

namespace Flow.Launcher.Converters
namespace Flow.Launcher.Core.Resource
{
public class TranlationConverter : IValueConverter
public class TranslationConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
4 changes: 3 additions & 1 deletion Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
<system:String x:Key="copy">Copy</system:String>
<system:String x:Key="cut">Cut</system:String>
<system:String x:Key="paste">Paste</system:String>
<system:String x:Key="undo">Undo</system:String>
<system:String x:Key="selectAll">Select All</system:String>
<system:String x:Key="fileTitle">File</system:String>
<system:String x:Key="folderTitle">Folder</system:String>
<system:String x:Key="textTitle">Text</system:String>
Expand Down Expand Up @@ -68,7 +70,7 @@
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview. </system:String>
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>

<!-- Setting Plugin -->
Expand Down
36 changes: 35 additions & 1 deletion Flow.Launcher/Resources/CustomControlTemplate.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,30 @@
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:ui="http://schemas.modernwpf.com/2019">

<ContextMenu x:Key="TextBoxContextMenu">
<MenuItem Command="ApplicationCommands.Cut" Header="{DynamicResource cut}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c6;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Copy" Header="{DynamicResource copy}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe8c8;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Paste" Header="{DynamicResource paste}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe77f;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.Undo" Header="{DynamicResource undo}">
<MenuItem.Icon>
<ui:FontIcon Glyph="&#xe10e;" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Command="ApplicationCommands.SelectAll" Header="{DynamicResource selectAll}" />
</ContextMenu>


<Style TargetType="{x:Type ContentControl}">
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
Expand Down Expand Up @@ -1357,7 +1381,13 @@
</Setter>
</Style>

<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox" />
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="TextBox">
<Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
</Style>

<Style BasedOn="{StaticResource DefaultPasswordBoxStyle}" TargetType="PasswordBox">
<Setter Property="ContextMenu" Value="{StaticResource TextBoxContextMenu}" />
</Style>

<Style
x:Key="DataGridTextBoxStyle"
Expand Down Expand Up @@ -2969,6 +2999,8 @@
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPressed}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<!-- Hide Disabled Item -->
<Setter TargetName="LayoutRoot" Property="Visibility" Value="Collapsed" />
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundDisabled}" />
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
Expand Down Expand Up @@ -3252,4 +3284,6 @@
</Trigger>
</Style.Triggers>
</Style>


</ResourceDictionary>
5 changes: 4 additions & 1 deletion Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand Down Expand Up @@ -42,7 +43,7 @@
<converters:BorderClipConverter x:Key="BorderClipConverter" />
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:TextConverter x:Key="TextConverter" />
<converters:TranlationConverter x:Key="TranslationConverter" />
<core:TranslationConverter x:Key="TranslationConverter" />
<CollectionViewSource x:Key="SortedFonts" Source="{Binding Source={x:Static Fonts.SystemFontFamilies}}">
<CollectionViewSource.SortDescriptions>
<scm:SortDescription PropertyName="Source" />
Expand Down Expand Up @@ -1038,6 +1039,7 @@
Height="34"
Margin="0,5,26,0"
HorizontalAlignment="Right"
ContextMenu="{StaticResource TextBoxContextMenu}"
DockPanel.Dock="Right"
FontSize="14"
KeyDown="PluginFilterTxb_OnKeyDown"
Expand Down Expand Up @@ -1429,6 +1431,7 @@
Height="34"
Margin="0,0,26,0"
HorizontalAlignment="Right"
ContextMenu="{StaticResource TextBoxContextMenu}"
DockPanel.Dock="Right"
FontSize="14"
KeyDown="PluginStoreFilterTxb_OnKeyDown"
Expand Down
12 changes: 3 additions & 9 deletions Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Flow.Launcher.Core;
using System.ComponentModel;
using Flow.Launcher.Core.Resource;

namespace Flow.Launcher.Plugin.Caculator
{
Expand All @@ -21,4 +15,4 @@ public enum DecimalSeparator
[LocalizedDescription("flowlauncher_plugin_calculator_decimal_seperator_comma")]
Comma
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:calculator="clr-namespace:Flow.Launcher.Plugin.Caculator"
xmlns:core="clr-namespace:Flow.Launcher.Core;assembly=Flow.Launcher.Core"
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="clr-namespace:Flow.Launcher.Infrastructure.UI;assembly=Flow.Launcher.Infrastructure"
Expand Down
46 changes: 23 additions & 23 deletions Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public List<Result> LoadContextMenus(Result selectedResult)
if (record.Type == ResultType.File && !string.IsNullOrEmpty(Settings.EditorPath))
contextMenus.Add(CreateOpenWithEditorResult(record));

if (record.Type == ResultType.Folder && record.WindowsIndexed)
if (record.Type == ResultType.Folder)
{
contextMenus.Add(CreateAddToIndexSearchExclusionListResult(record));
contextMenus.Add(CreateOpenWithShellResult(record));
if (record.WindowsIndexed)
{
contextMenus.Add(CreateAddToIndexSearchExclusionListResult(record));
}
}

contextMenus.Add(CreateOpenContainingFolderResult(record));

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

var icoPath = (record.Type == ResultType.File) ? Constants.FileImagePath : Constants.FolderImagePath;
var fileOrFolder = (record.Type == ResultType.File) ? "file" : "folder";
bool isFile = record.Type == ResultType.File;

if (Settings.QuickAccessLinks.All(x => !x.Path.Equals(record.FullPath, StringComparison.OrdinalIgnoreCase)))
{
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_title"),
SubTitle = string.Format(Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"), fileOrFolder),
SubTitle = Context.API.GetTranslation("plugin_explorer_add_to_quickaccess_subtitle"),
Action = (context) =>
{
Settings.QuickAccessLinks.Add(new AccessLink
Expand All @@ -71,10 +75,8 @@ public List<Result> LoadContextMenus(Result selectedResult)
});

Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess"),
string.Format(
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
fileOrFolder),
Constants.ExplorerIconImageFullPath);
Constants.ExplorerIconImageFullPath);

ViewModel.Save();

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

Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess"),
string.Format(
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
fileOrFolder),
Constants.ExplorerIconImageFullPath);
Constants.ExplorerIconImageFullPath);

ViewModel.Save();

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

contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder") + $" {fileOrFolder}",
SubTitle = $"Copy the {fileOrFolder} to clipboard",
Title = Context.API.GetTranslation("plugin_explorer_copyfilefolder"),
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_copyfile_subtitle") : Context.API.GetTranslation("plugin_explorer_copyfolder_subtitle"),
Action = _ =>
{
try
Expand All @@ -152,7 +152,7 @@ public List<Result> LoadContextMenus(Result selectedResult)
}
catch (Exception e)
{
var message = $"Fail to set {fileOrFolder} in clipboard";
var message = $"Fail to set file/folder in clipboard";
LogException(message, e);
Context.API.ShowMsg(message);
return false;
Expand All @@ -167,35 +167,35 @@ public List<Result> LoadContextMenus(Result selectedResult)
if (record.Type is ResultType.File or ResultType.Folder)
contextMenus.Add(new Result
{
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder") + $" {fileOrFolder}",
SubTitle = Context.API.GetTranslation("plugin_explorer_deletefilefolder_subtitle") + $" {fileOrFolder}",
Title = Context.API.GetTranslation("plugin_explorer_deletefilefolder"),
SubTitle = isFile ? Context.API.GetTranslation("plugin_explorer_deletefile_subtitle") : Context.API.GetTranslation("plugin_explorer_deletefolder_subtitle"),
Action = (context) =>
{
try
{
if (MessageBox.Show(
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"), fileOrFolder),
Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"),
string.Empty,
MessageBoxButton.YesNo,
MessageBoxIcon.Warning)
== DialogResult.No)
return false;

if (record.Type == ResultType.File)
if (isFile)
File.Delete(record.FullPath);
else
Directory.Delete(record.FullPath, true);

_ = Task.Run(() =>
{
Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"),
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), fileOrFolder),
string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), record.FullPath),
Constants.ExplorerIconImageFullPath);
});
}
catch (Exception e)
{
var message = $"Fail to delete {fileOrFolder} at {record.FullPath}";
var message = $"Fail to delete {record.FullPath}";
LogException(message, e);
Context.API.ShowMsgError(message);
return false;
Expand Down Expand Up @@ -382,7 +382,7 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
SubTitle = Context.API.GetTranslation("plugin_explorer_path") + " " + record.FullPath,
Action = _ =>
{
if (!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
if (!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => string.Equals(x.Path, record.FullPath, StringComparison.OrdinalIgnoreCase)))
Settings.IndexSearchExcludedSubdirectoryPaths.Add(new AccessLink
{
Path = record.FullPath
Expand Down
Loading