mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into plugin_store_item_vm_null
This commit is contained in:
commit
a9486362a8
32 changed files with 474 additions and 250 deletions
15
.github/actions/spelling/expect.txt
vendored
15
.github/actions/spelling/expect.txt
vendored
|
|
@ -1,3 +1,5 @@
|
|||
# This file should contain names of products, companies, or individuals that aren't in a standard dictionary (e.g., GitHub, Keptn, VSCode).
|
||||
|
||||
crowdin
|
||||
DWM
|
||||
workflows
|
||||
|
|
@ -34,7 +36,6 @@ mscorlib
|
|||
pythonw
|
||||
dotnet
|
||||
winget
|
||||
jjw24
|
||||
wolframalpha
|
||||
gmail
|
||||
duckduckgo
|
||||
|
|
@ -49,7 +50,6 @@ srchadmin
|
|||
EWX
|
||||
dlgtext
|
||||
CMD
|
||||
appref-ms
|
||||
appref
|
||||
TSource
|
||||
runas
|
||||
|
|
@ -57,7 +57,6 @@ dpi
|
|||
popup
|
||||
ptr
|
||||
pluginindicator
|
||||
TobiasSekan
|
||||
img
|
||||
resx
|
||||
bak
|
||||
|
|
@ -68,9 +67,6 @@ dlg
|
|||
ddd
|
||||
dddd
|
||||
clearlogfolder
|
||||
ACCENT_ENABLE_TRANSPARENTGRADIENT
|
||||
ACCENT_ENABLE_BLURBEHIND
|
||||
WCA_ACCENT_POLICY
|
||||
HGlobal
|
||||
dopusrt
|
||||
firefox
|
||||
|
|
@ -91,22 +87,15 @@ keyevent
|
|||
KListener
|
||||
requery
|
||||
vkcode
|
||||
čeština
|
||||
Polski
|
||||
Srpski
|
||||
Português
|
||||
Português (Brasil)
|
||||
Italiano
|
||||
Slovenský
|
||||
quicklook
|
||||
Tiếng Việt
|
||||
Droplex
|
||||
Preinstalled
|
||||
errormetadatafile
|
||||
noresult
|
||||
pluginsmanager
|
||||
alreadyexists
|
||||
JsonRPC
|
||||
JsonRPCV2
|
||||
Softpedia
|
||||
img
|
||||
|
|
|
|||
12
.github/actions/spelling/patterns.txt
vendored
12
.github/actions/spelling/patterns.txt
vendored
|
|
@ -1,4 +1,6 @@
|
|||
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
|
||||
# This file should contain strings that contain a mix of letters and numbers, or specific symbols
|
||||
|
||||
|
||||
# Questionably acceptable forms of `in to`
|
||||
# Personally, I prefer `log into`, but people object
|
||||
|
|
@ -121,3 +123,13 @@
|
|||
|
||||
# version suffix <word>v#
|
||||
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))
|
||||
|
||||
\bjjw24\b
|
||||
\bappref-ms\b
|
||||
\bTobiasSekan\b
|
||||
\bJsonRPC\b
|
||||
\bJsonRPCV2\b
|
||||
\bTiếng Việt\b
|
||||
\bPortuguês (Brasil)\b
|
||||
\bčeština\b
|
||||
\bPortuguês\b
|
||||
|
|
|
|||
|
|
@ -1,16 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Flow.Launcher.Core.Plugin;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
|
||||
namespace Flow.Launcher.Core.Resource
|
||||
{
|
||||
|
|
@ -29,13 +30,12 @@ namespace Flow.Launcher.Core.Resource
|
|||
private readonly Settings _settings;
|
||||
private readonly List<string> _languageDirectories = new();
|
||||
private readonly List<ResourceDictionary> _oldResources = new();
|
||||
private readonly string SystemLanguageCode;
|
||||
private static string SystemLanguageCode;
|
||||
|
||||
public Internationalization(Settings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
AddFlowLauncherLanguageDirectory();
|
||||
SystemLanguageCode = GetSystemLanguageCodeAtStartup();
|
||||
}
|
||||
|
||||
private void AddFlowLauncherLanguageDirectory()
|
||||
|
|
@ -44,7 +44,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
_languageDirectories.Add(directory);
|
||||
}
|
||||
|
||||
private static string GetSystemLanguageCodeAtStartup()
|
||||
public static void InitSystemLanguageCode()
|
||||
{
|
||||
var availableLanguages = AvailableLanguages.GetAvailableLanguages();
|
||||
|
||||
|
|
@ -65,11 +65,11 @@ namespace Flow.Launcher.Core.Resource
|
|||
string.Equals(languageCode, threeLetterCode, StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(languageCode, fullName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return languageCode;
|
||||
SystemLanguageCode = languageCode;
|
||||
}
|
||||
}
|
||||
|
||||
return DefaultLanguageCode;
|
||||
SystemLanguageCode = DefaultLanguageCode;
|
||||
}
|
||||
|
||||
private void AddPluginLanguageDirectories()
|
||||
|
|
@ -173,15 +173,33 @@ namespace Flow.Launcher.Core.Resource
|
|||
LoadLanguage(language);
|
||||
}
|
||||
|
||||
// Culture of main thread
|
||||
// Use CreateSpecificCulture to preserve possible user-override settings in Windows, if Flow's language culture is the same as Windows's
|
||||
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
|
||||
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
|
||||
// Change culture info
|
||||
ChangeCultureInfo(language.LanguageCode);
|
||||
|
||||
// Raise event for plugins after culture is set
|
||||
await Task.Run(UpdatePluginMetadataTranslations);
|
||||
}
|
||||
|
||||
public static void ChangeCultureInfo(string languageCode)
|
||||
{
|
||||
// Culture of main thread
|
||||
// Use CreateSpecificCulture to preserve possible user-override settings in Windows, if Flow's language culture is the same as Windows's
|
||||
CultureInfo currentCulture;
|
||||
try
|
||||
{
|
||||
currentCulture = CultureInfo.CreateSpecificCulture(languageCode);
|
||||
}
|
||||
catch (CultureNotFoundException)
|
||||
{
|
||||
currentCulture = CultureInfo.CreateSpecificCulture(SystemLanguageCode);
|
||||
}
|
||||
CultureInfo.CurrentCulture = currentCulture;
|
||||
CultureInfo.CurrentUICulture = currentCulture;
|
||||
var thread = Thread.CurrentThread;
|
||||
thread.CurrentCulture = currentCulture;
|
||||
thread.CurrentUICulture = currentCulture;
|
||||
}
|
||||
|
||||
public bool PromptShouldUsePinyin(string languageCodeToSet)
|
||||
{
|
||||
var languageToSet = GetLanguageByLanguageCode(languageCodeToSet);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,13 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
|
||||
public void Initialize()
|
||||
{
|
||||
// Initialize dependency injection instances after Ioc.Default is created
|
||||
_stringMatcher = Ioc.Default.GetRequiredService<StringMatcher>();
|
||||
|
||||
// Initialize application resources after application is created
|
||||
var settingWindowFont = new FontFamily(SettingWindowFont);
|
||||
Application.Current.Resources["SettingWindowFont"] = settingWindowFont;
|
||||
Application.Current.Resources["ContentControlThemeFontFamily"] = settingWindowFont;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
|
|
@ -119,8 +125,11 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
{
|
||||
_settingWindowFont = value;
|
||||
OnPropertyChanged();
|
||||
Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
|
||||
Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(value);
|
||||
if (Application.Current != null)
|
||||
{
|
||||
Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
|
||||
Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ namespace Flow.Launcher
|
|||
private static readonly string ClassName = nameof(App);
|
||||
|
||||
private static bool _disposed;
|
||||
private static Settings _settings;
|
||||
private static MainWindow _mainWindow;
|
||||
private readonly MainViewModel _mainVM;
|
||||
private readonly Settings _settings;
|
||||
|
||||
// To prevent two disposals running at the same time.
|
||||
private static readonly object _disposingLock = new();
|
||||
|
|
@ -55,18 +55,7 @@ namespace Flow.Launcher
|
|||
public App()
|
||||
{
|
||||
// Initialize settings
|
||||
try
|
||||
{
|
||||
var storage = new FlowLauncherJsonStorage<Settings>();
|
||||
_settings = storage.Load();
|
||||
_settings.SetStorage(storage);
|
||||
_settings.WMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ShowErrorMsgBoxAndFailFast("Cannot load setting storage, please check local data directory", e);
|
||||
return;
|
||||
}
|
||||
_settings.WMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();
|
||||
|
||||
// Configure the dependency injection container
|
||||
try
|
||||
|
|
@ -123,16 +112,6 @@ namespace Flow.Launcher
|
|||
ShowErrorMsgBoxAndFailFast("Cannot initialize api and settings, please open new issue in Flow.Launcher", e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Local function
|
||||
static void ShowErrorMsgBoxAndFailFast(string message, Exception e)
|
||||
{
|
||||
// Firstly show users the message
|
||||
MessageBox.Show(e.ToString(), message, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
// Flow cannot construct its App instance, so ensure Flow crashes w/ the exception info.
|
||||
Environment.FailFast(message, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -142,6 +121,29 @@ namespace Flow.Launcher
|
|||
[STAThread]
|
||||
public static void Main()
|
||||
{
|
||||
// Initialize settings so that we can get language code
|
||||
try
|
||||
{
|
||||
var storage = new FlowLauncherJsonStorage<Settings>();
|
||||
_settings = storage.Load();
|
||||
_settings.SetStorage(storage);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ShowErrorMsgBoxAndFailFast("Cannot load setting storage, please check local data directory", e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize system language before changing culture info
|
||||
Internationalization.InitSystemLanguageCode();
|
||||
|
||||
// Change culture info before application creation to localize WinForm windows
|
||||
if (_settings.Language != Constant.SystemLanguageCode)
|
||||
{
|
||||
Internationalization.ChangeCultureInfo(_settings.Language);
|
||||
}
|
||||
|
||||
// Start the application as a single instance
|
||||
if (SingleInstance<App>.InitializeAsFirstInstance())
|
||||
{
|
||||
using var application = new App();
|
||||
|
|
@ -152,6 +154,19 @@ namespace Flow.Launcher
|
|||
|
||||
#endregion
|
||||
|
||||
#region Fail Fast
|
||||
|
||||
private static void ShowErrorMsgBoxAndFailFast(string message, Exception e)
|
||||
{
|
||||
// Firstly show users the message
|
||||
MessageBox.Show(e.ToString(), message, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
// Flow cannot construct its App instance, so ensure Flow crashes w/ the exception info.
|
||||
Environment.FailFast(message, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region App Events
|
||||
|
||||
#pragma warning disable VSTHRD100 // Avoid async void methods
|
||||
|
|
|
|||
|
|
@ -118,24 +118,26 @@
|
|||
FontSize="14"
|
||||
Text="{DynamicResource customShortcutExpansion}" />
|
||||
|
||||
<DockPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
LastChildFill="True">
|
||||
<Button
|
||||
x:Name="btnTestShortcut"
|
||||
Margin="0 0 10 0"
|
||||
Padding="10 5 10 5"
|
||||
Click="BtnTestShortcut_OnClick"
|
||||
Content="{DynamicResource preview}"
|
||||
DockPanel.Dock="Right" />
|
||||
<Grid Grid.Row="1" Grid.Column="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox
|
||||
x:Name="tbExpand"
|
||||
Grid.Column="0"
|
||||
Margin="10 0 10 0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Value}" />
|
||||
</DockPanel>
|
||||
<Button
|
||||
x:Name="btnTestShortcut"
|
||||
Grid.Column="1"
|
||||
Margin="0 0 10 0"
|
||||
Padding="10 5 10 5"
|
||||
Click="BtnTestShortcut_OnClick"
|
||||
Content="{DynamicResource preview}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,23 @@
|
|||
using Microsoft.Win32;
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace Flow.Launcher.Helper;
|
||||
|
||||
internal static class WindowsMediaPlayerHelper
|
||||
{
|
||||
private static readonly string ClassName = nameof(WindowsMediaPlayerHelper);
|
||||
|
||||
internal static bool IsWindowsMediaPlayerInstalled()
|
||||
{
|
||||
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MediaPlayer");
|
||||
return key?.GetValue("Installation Directory") != null;
|
||||
try
|
||||
{
|
||||
using var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MediaPlayer");
|
||||
return key?.GetValue("Installation Directory") != null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
App.API.LogException(ClassName, "Failed to check if Windows Media Player is installed", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,31 +189,46 @@ namespace Flow.Launcher
|
|||
var releases = JsonSerializer.Deserialize<List<GitHubReleaseInfo>>(releaseNotesJSON);
|
||||
|
||||
// Get the latest releases
|
||||
var latestReleases = releases.OrderByDescending(release => release.PublishedDate).Take(3);
|
||||
var latestReleases = releases.OrderByDescending(release => release.PublishedDate).Take(3).ToList();
|
||||
|
||||
// Build the release notes in Markdown format
|
||||
var releaseNotesHtmlBuilder = new StringBuilder(string.Empty);
|
||||
foreach (var release in latestReleases)
|
||||
|
||||
for (int i = 0; i < latestReleases.Count; i++)
|
||||
{
|
||||
var release = latestReleases[i];
|
||||
releaseNotesHtmlBuilder.AppendLine("# " + release.Name);
|
||||
|
||||
// Because MdXaml.Html package cannot correctly render images without units,
|
||||
// We need to manually add unit for images
|
||||
// E.g. Replace <img src="..." width="500"> with <img src="..." width="500px">
|
||||
var notes = ImageUnitRegex().Replace(release.ReleaseNotes, m =>
|
||||
{
|
||||
var prefix = m.Groups[1].Value;
|
||||
var widthValue = m.Groups[2].Value;
|
||||
var quote = m.Groups[3].Value;
|
||||
var suffix = m.Groups[4].Value;
|
||||
// Only replace if width is number like 500 without units like 500px
|
||||
if (IsNumber(widthValue))
|
||||
return $"{prefix}{widthValue}px{quote}{suffix}";
|
||||
return m.Value;
|
||||
});
|
||||
{
|
||||
var prefix = m.Groups[1].Value;
|
||||
var widthValue = m.Groups[2].Value;
|
||||
var quote = m.Groups[3].Value;
|
||||
var suffix = m.Groups[4].Value;
|
||||
// Only replace if width is number like 500 without units like 500px
|
||||
if (IsNumber(widthValue))
|
||||
return $"{prefix}{widthValue}px{quote}{suffix}";
|
||||
return m.Value;
|
||||
});
|
||||
|
||||
releaseNotesHtmlBuilder.AppendLine(notes);
|
||||
releaseNotesHtmlBuilder.AppendLine();
|
||||
|
||||
// Add separator if it is not last release note
|
||||
if (i < latestReleases.Count - 1)
|
||||
{
|
||||
releaseNotesHtmlBuilder.Append("<br />");
|
||||
releaseNotesHtmlBuilder.Append("\n\n");
|
||||
|
||||
releaseNotesHtmlBuilder.AppendLine("---");
|
||||
|
||||
releaseNotesHtmlBuilder.Append("\n\n");
|
||||
releaseNotesHtmlBuilder.Append("<br />");
|
||||
releaseNotesHtmlBuilder.Append("\n\n");
|
||||
}
|
||||
}
|
||||
|
||||
return releaseNotesHtmlBuilder.ToString();
|
||||
|
|
|
|||
|
|
@ -38,21 +38,21 @@
|
|||
<Setter Property="Background" Value="Transparent" />
|
||||
</DataTrigger>
|
||||
|
||||
<DataTrigger Binding="{Binding (local:CardGroup.Position), RelativeSource={RelativeSource AncestorType=local:Card}}" Value="First">
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:Card}}" Value="First">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</DataTrigger>
|
||||
|
||||
<DataTrigger Binding="{Binding (local:CardGroup.Position), RelativeSource={RelativeSource AncestorType=local:Card}}" Value="Middle">
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:Card}}" Value="Middle">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="0 1 0 0" />
|
||||
</DataTrigger>
|
||||
|
||||
<DataTrigger Binding="{Binding (local:CardGroup.Position), RelativeSource={RelativeSource AncestorType=local:Card}}" Value="Last">
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:Card}}" Value="Last">
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@ namespace Flow.Launcher.Resources.Controls
|
|||
{
|
||||
Default,
|
||||
Inside,
|
||||
InsideFit
|
||||
InsideFit,
|
||||
First,
|
||||
Middle,
|
||||
Last
|
||||
}
|
||||
|
||||
public Card()
|
||||
|
|
|
|||
|
|
@ -170,7 +170,8 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
"dddd dd', 'MMMM",
|
||||
"dd', 'MMMM",
|
||||
"dd.MM.yy",
|
||||
"dd.MM.yyyy"
|
||||
"dd.MM.yyyy",
|
||||
"dd MMMM yyyy"
|
||||
};
|
||||
|
||||
public string TimeFormat
|
||||
|
|
|
|||
|
|
@ -91,7 +91,10 @@
|
|||
</cc:Card>
|
||||
|
||||
<cc:CardGroup Margin="0 4 0 0">
|
||||
<cc:Card Title="{DynamicResource SearchWindowPosition}" Icon="">
|
||||
<cc:Card
|
||||
Title="{DynamicResource SearchWindowPosition}"
|
||||
Icon=""
|
||||
Type="First">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ComboBox
|
||||
MinWidth="220"
|
||||
|
|
@ -116,6 +119,7 @@
|
|||
<cc:Card
|
||||
Title="{DynamicResource SearchWindowAlign}"
|
||||
Icon=""
|
||||
Type="Last"
|
||||
Visibility="{ext:CollapsedWhen {Binding Settings.SearchWindowScreen},
|
||||
IsEqualTo={x:Static userSettings:SearchWindowScreens.RememberLastLaunchLocation}}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
|
@ -196,7 +200,10 @@
|
|||
</cc:Card>
|
||||
|
||||
<cc:CardGroup Margin="0 14 0 0">
|
||||
<cc:Card Title="{DynamicResource querySearchPrecision}" Sub="{DynamicResource querySearchPrecisionToolTip}">
|
||||
<cc:Card
|
||||
Title="{DynamicResource querySearchPrecision}"
|
||||
Sub="{DynamicResource querySearchPrecisionToolTip}"
|
||||
Type="First">
|
||||
<ComboBox
|
||||
MaxWidth="200"
|
||||
DisplayMemberPath="Display"
|
||||
|
|
@ -205,7 +212,10 @@
|
|||
SelectedValuePath="Value" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource lastQueryMode}" Sub="{DynamicResource lastQueryModeToolTip}">
|
||||
<cc:Card
|
||||
Title="{DynamicResource lastQueryMode}"
|
||||
Sub="{DynamicResource lastQueryModeToolTip}"
|
||||
Type="Last">
|
||||
<ComboBox
|
||||
MinWidth="210"
|
||||
DisplayMemberPath="Display"
|
||||
|
|
@ -397,7 +407,8 @@
|
|||
<cc:Card
|
||||
Title="{DynamicResource KoreanImeRegistry}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource KoreanImeRegistryTooltip}">
|
||||
Sub="{DynamicResource KoreanImeRegistryTooltip}"
|
||||
Type="First">
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding LegacyKoreanIMEEnabled}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
|
|
@ -406,7 +417,8 @@
|
|||
<cc:Card
|
||||
Title="{DynamicResource KoreanImeOpenLink}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource KoreanImeOpenLinkToolTip}">
|
||||
Sub="{DynamicResource KoreanImeOpenLinkToolTip}"
|
||||
Type="Last">
|
||||
<Button Command="{Binding OpenImeSettingsCommand}" Content="{DynamicResource KoreanImeOpenLinkButton}" />
|
||||
</cc:Card>
|
||||
</cc:CardGroup>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,10 @@
|
|||
</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}"
|
||||
Type="First">
|
||||
<ComboBox
|
||||
Width="120"
|
||||
FontSize="14"
|
||||
|
|
@ -59,7 +62,10 @@
|
|||
SelectedValue="{Binding Settings.OpenResultModifiers}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource showOpenResultHotkey}" Sub="{DynamicResource showOpenResultHotkeyToolTip}">
|
||||
<cc:Card
|
||||
Title="{DynamicResource showOpenResultHotkey}"
|
||||
Sub="{DynamicResource showOpenResultHotkeyToolTip}"
|
||||
Type="Last">
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding Settings.ShowOpenResultHotkey}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
|
|
|
|||
|
|
@ -32,35 +32,35 @@
|
|||
TextAlignment="left" />
|
||||
|
||||
<cc:CardGroup>
|
||||
<cc:Card Title="{DynamicResource enableProxy}">
|
||||
<cc:Card Title="{DynamicResource enableProxy}" Type="First">
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding Settings.Proxy.Enabled}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource server}">
|
||||
<cc:Card Title="{DynamicResource server}" Type="Middle">
|
||||
<TextBox
|
||||
Width="300"
|
||||
IsEnabled="{Binding Settings.Proxy.Enabled}"
|
||||
Text="{Binding Settings.Proxy.Server}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource port}">
|
||||
<cc:Card Title="{DynamicResource port}" Type="Middle">
|
||||
<TextBox
|
||||
Width="100"
|
||||
IsEnabled="{Binding Settings.Proxy.Enabled}"
|
||||
Text="{Binding Settings.Proxy.Port, TargetNullValue={x:Static sys:String.Empty}}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource userName}">
|
||||
<cc:Card Title="{DynamicResource userName}" Type="Middle">
|
||||
<TextBox
|
||||
Width="200"
|
||||
IsEnabled="{Binding Settings.Proxy.Enabled}"
|
||||
Text="{Binding Settings.Proxy.UserName}" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource password}">
|
||||
<cc:Card Title="{DynamicResource password}" Type="Last">
|
||||
<TextBox
|
||||
Width="200"
|
||||
IsEnabled="{Binding Settings.Proxy.Enabled}"
|
||||
|
|
|
|||
|
|
@ -489,7 +489,8 @@
|
|||
Title="{DynamicResource BackdropType}"
|
||||
Margin="0 0 0 0"
|
||||
Icon=""
|
||||
Sub="{Binding BackdropSubText}">
|
||||
Sub="{Binding BackdropSubText}"
|
||||
Type="First">
|
||||
<ComboBox
|
||||
MinWidth="160"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -505,7 +506,8 @@
|
|||
<cc:Card
|
||||
Title="{DynamicResource queryWindowShadowEffect}"
|
||||
Margin="0 0 0 0"
|
||||
Icon="">
|
||||
Icon=""
|
||||
Type="Last">
|
||||
<ui:ToggleSwitch
|
||||
IsEnabled="{Binding IsDropShadowEnabled}"
|
||||
IsOn="{Binding DropShadowEffect}"
|
||||
|
|
@ -546,7 +548,10 @@
|
|||
|
||||
<!-- Time and date -->
|
||||
<cc:CardGroup Margin="0 14 0 0">
|
||||
<cc:Card Title="{DynamicResource Clock}" Icon="">
|
||||
<cc:Card
|
||||
Title="{DynamicResource Clock}"
|
||||
Icon=""
|
||||
Type="First">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -567,7 +572,10 @@
|
|||
</StackPanel>
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card Title="{DynamicResource Date}" Icon="">
|
||||
<cc:Card
|
||||
Title="{DynamicResource Date}"
|
||||
Icon=""
|
||||
Type="Last">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
using System.Windows;
|
||||
using Flow.Launcher.Plugin.BrowserBookmark.Models;
|
||||
using System.Windows.Input;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Flow.Launcher.Plugin.BrowserBookmark.Models;
|
||||
|
||||
namespace Flow.Launcher.Plugin.BrowserBookmark.Views;
|
||||
|
||||
public partial class SettingsControl : INotifyPropertyChanged
|
||||
[INotifyPropertyChanged]
|
||||
public partial class SettingsControl
|
||||
{
|
||||
public Settings Settings { get; }
|
||||
public CustomBrowser SelectedCustomBrowser { get; set; }
|
||||
|
|
@ -53,12 +54,10 @@ public partial class SettingsControl : INotifyPropertyChanged
|
|||
set
|
||||
{
|
||||
Settings.OpenInNewBrowserWindow = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(OpenInNewBrowserWindow)));
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private void NewCustomBrowser(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var newBrowser = new CustomBrowser();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace Flow.Launcher.Plugin.Calculator
|
|||
@"bin2dec|hex2dec|oct2dec|" +
|
||||
@"factorial|sign|isprime|isinfty|" +
|
||||
@"==|~=|&&|\|\||(?:\<|\>)=?|" +
|
||||
@"[ei]|[0-9]|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||
@"[ei]|[0-9]|0x[\da-fA-F]+|[\+\%\-\*\/\^\., ""]|[\(\)\|\!\[\]]" +
|
||||
@")+$", RegexOptions.Compiled);
|
||||
private static readonly Regex RegBrackets = new Regex(@"[\(\)\[\]]", RegexOptions.Compiled);
|
||||
private static Engine MagesEngine;
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
"ID": "CEA0FDFC6D3B4085823D60DC76F28855",
|
||||
"ActionKeyword": "*",
|
||||
"Name": "Calculator",
|
||||
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
|
||||
"Description": "Perform mathematical calculations (including hexadecimal values)",
|
||||
"Author": "cxfksword",
|
||||
"Version": "1.0.0",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.Calculator.dll",
|
||||
"IcoPath": "Images\\calculator.png"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,8 +98,11 @@
|
|||
<system:String x:Key="plugin_explorer_deletefilefolder">Delete</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefile_subtitle">Permanently delete current file</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefolder_subtitle">Permanently delete current folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_path">Path:</system:String>
|
||||
<system:String x:Key="plugin_explorer_name">Name:</system:String>
|
||||
<system:String x:Key="plugin_explorer_name">Name</system:String>
|
||||
<system:String x:Key="plugin_explorer_type">Type</system:String>
|
||||
<system:String x:Key="plugin_explorer_path">Path</system:String>
|
||||
<system:String x:Key="plugin_explorer_file">File</system:String>
|
||||
<system:String x:Key="plugin_explorer_folder">Folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_deletefilefolder_subtitle">Delete the selected</system:String>
|
||||
<system:String x:Key="plugin_explorer_runasdifferentuser">Run as different user</system:String>
|
||||
<system:String x:Key="plugin_explorer_runasdifferentuser_subtitle">Run the selected using a different user account</system:String>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
{
|
||||
internal static PluginInitContext Context { get; set; }
|
||||
|
||||
internal Settings Settings;
|
||||
internal static Settings Settings { get; set; }
|
||||
|
||||
private SettingsViewModel viewModel;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
|||
{
|
||||
internal static class QuickAccess
|
||||
{
|
||||
private const int quickAccessResultScore = 100;
|
||||
private const int QuickAccessResultScore = 100;
|
||||
|
||||
internal static List<Result> AccessLinkListMatched(Query query, IEnumerable<AccessLink> accessLinks)
|
||||
{
|
||||
|
|
@ -19,8 +19,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
|||
.ThenBy(x => x.Name)
|
||||
.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
||||
ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore),
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
})
|
||||
.ToList();
|
||||
|
|
@ -32,8 +33,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
|
|||
.ThenBy(x => x.Name)
|
||||
.Select(l => l.Type switch
|
||||
{
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
|
||||
ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore),
|
||||
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore),
|
||||
ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
}).ToList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,17 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
};
|
||||
}
|
||||
|
||||
internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score)
|
||||
{
|
||||
return CreateDriveSpaceDisplayResult(path, actionKeyword, score, SearchManager.UseIndexSearch(path));
|
||||
}
|
||||
|
||||
internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, bool windowsIndexed = false)
|
||||
{
|
||||
return CreateDriveSpaceDisplayResult(path, actionKeyword, 500, windowsIndexed);
|
||||
}
|
||||
|
||||
private static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score, bool windowsIndexed = false)
|
||||
{
|
||||
var progressBarColor = "#26a0da";
|
||||
var title = string.Empty; // hide title when use progress bar,
|
||||
|
|
@ -197,7 +207,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
SubTitle = subtitle,
|
||||
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
|
||||
IcoPath = path,
|
||||
Score = 500,
|
||||
Score = score,
|
||||
ProgressBar = progressValue,
|
||||
ProgressBarColor = progressBarColor,
|
||||
Preview = new Result.PreviewInfo
|
||||
|
|
|
|||
|
|
@ -246,6 +246,18 @@ namespace Flow.Launcher.Plugin.Explorer.Search
|
|||
|
||||
public bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
|
||||
|
||||
public static bool UseIndexSearch(string path)
|
||||
{
|
||||
if (Main.Settings.IndexSearchEngine is not Settings.IndexSearchEngineOption.WindowsIndex)
|
||||
return false;
|
||||
|
||||
// Check if the path is using windows index search
|
||||
var pathToDirectory = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path);
|
||||
|
||||
return !Main.Settings.IndexSearchExcludedSubdirectoryPaths.Any(
|
||||
x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory).StartsWith(x.Path, StringComparison.OrdinalIgnoreCase))
|
||||
&& WindowsIndex.WindowsIndex.PathIsIndexed(pathToDirectory);
|
||||
}
|
||||
|
||||
private bool UseWindowsIndexForDirectorySearch(string locationPath)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,16 +1,11 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
#nullable enable
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Views
|
||||
namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
||||
{
|
||||
public class ActionKeywordModel : INotifyPropertyChanged
|
||||
public partial class ActionKeywordModel : BaseModel
|
||||
{
|
||||
private static Settings _settings = null!;
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
public static void Init(Settings settings)
|
||||
{
|
||||
_settings = settings;
|
||||
|
|
@ -28,13 +23,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
|
||||
internal Settings.ActionKeyword KeywordProperty { get; }
|
||||
|
||||
private void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private string? keyword;
|
||||
|
||||
public string Keyword
|
||||
{
|
||||
get => keyword ??= _settings.GetActionKeyword(KeywordProperty);
|
||||
|
|
@ -45,8 +34,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
private bool? enabled;
|
||||
|
||||
private bool? enabled;
|
||||
public bool Enabled
|
||||
{
|
||||
get => enabled ??= _settings.GetActionKeywordEnabled(KeywordProperty);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ActionKeywordSetting.xaml
|
||||
/// </summary>
|
||||
public partial class ActionKeywordSetting : INotifyPropertyChanged
|
||||
[INotifyPropertyChanged]
|
||||
public partial class ActionKeywordSetting
|
||||
{
|
||||
private ActionKeywordModel CurrentActionKeyword { get; }
|
||||
|
||||
|
|
@ -21,14 +18,14 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
{
|
||||
// Set Enable to be true if user change ActionKeyword
|
||||
KeywordEnabled = true;
|
||||
_ = SetField(ref actionKeyword, value);
|
||||
_ = SetProperty(ref actionKeyword, value);
|
||||
}
|
||||
}
|
||||
|
||||
public bool KeywordEnabled
|
||||
{
|
||||
get => _keywordEnabled;
|
||||
set => SetField(ref _keywordEnabled, value);
|
||||
set => _ = SetProperty(ref _keywordEnabled, value);
|
||||
}
|
||||
|
||||
private string actionKeyword;
|
||||
|
|
@ -116,20 +113,5 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
e.CancelCommand();
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
private bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value))
|
||||
return false;
|
||||
field = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
xmlns:qa="clr-namespace:Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels"
|
||||
xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
|
||||
d:DataContext="{d:DesignInstance viewModels:SettingsViewModel}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
|
|
@ -18,7 +17,7 @@
|
|||
<DataTemplate x:Key="ListViewTemplateAccessLinks" DataType="qa:AccessLink">
|
||||
<TextBlock Margin="0 5 0 5" Text="{Binding Path, Mode=OneTime}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="ListViewActionKeywords" DataType="{x:Type views:ActionKeywordModel}">
|
||||
<DataTemplate x:Key="ListViewActionKeywords" DataType="{x:Type viewModels:ActionKeywordModel}">
|
||||
<Grid>
|
||||
<TextBlock
|
||||
Margin="0 5 0 0"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.ComponentModel;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
|
@ -11,12 +10,14 @@ using System.Windows.Controls;
|
|||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Views;
|
||||
|
||||
#nullable enable
|
||||
|
||||
public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
||||
[INotifyPropertyChanged]
|
||||
public partial class PreviewPanel : UserControl
|
||||
{
|
||||
private static readonly string ClassName = nameof(PreviewPanel);
|
||||
|
||||
|
|
@ -327,11 +328,4 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
return yearsDiff == 1 ? Main.Context.API.GetTranslation("OneYearAgo") :
|
||||
string.Format(Main.Context.API.GetTranslation("YearsAgo"), yearsDiff);
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,23 @@
|
|||
<Window x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
|
||||
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.Plugin.Explorer.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
Width="Auto"
|
||||
Height="255"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Width"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Window
|
||||
x:Class="Flow.Launcher.Plugin.Explorer.Views.QuickAccessLinkSettings"
|
||||
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.Plugin.Explorer.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
Width="Auto"
|
||||
Height="300"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Width"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
|
|
@ -58,55 +59,91 @@
|
|||
<StackPanel Margin="26 0 26 0">
|
||||
<StackPanel Margin="0 0 0 12">
|
||||
<TextBlock
|
||||
Margin="0 0 0 0"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource plugin_explorer_manage_quick_access_links_header}"
|
||||
TextAlignment="Left" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="100" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Name -->
|
||||
<TextBlock
|
||||
MinWidth="150"
|
||||
Margin="0 10 15 10"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_name}" />
|
||||
<TextBox
|
||||
Margin="10 0 0 0"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="10 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Width="250"
|
||||
Text="{Binding SelectedName, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0 10 0 0" Orientation="Horizontal">
|
||||
|
||||
<!-- Type -->
|
||||
<TextBlock
|
||||
MinWidth="150"
|
||||
Margin="0 10 15 10"
|
||||
HorizontalAlignment="Left"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_type}" />
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<RadioButton
|
||||
Margin="10 10 0 0"
|
||||
Content="{DynamicResource plugin_explorer_file}"
|
||||
GroupName="PathType"
|
||||
IsChecked="{Binding IsFileSelected}" />
|
||||
<RadioButton
|
||||
Margin="10 10 0 0"
|
||||
Content="{DynamicResource plugin_explorer_folder}"
|
||||
GroupName="PathType"
|
||||
IsChecked="{Binding IsFolderSelected}" />
|
||||
</StackPanel>
|
||||
<!-- Path -->
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
Margin="0 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource plugin_explorer_path}" />
|
||||
|
||||
|
||||
<TextBox
|
||||
Margin="10 0 0 0"
|
||||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Width="250"
|
||||
Margin="10 10 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Width="250"
|
||||
Text="{Binding SelectedPath, Mode=TwoWay}"
|
||||
IsReadOnly="True" />
|
||||
IsReadOnly="True"
|
||||
Text="{Binding SelectedPath, Mode=TwoWay}" />
|
||||
<Button
|
||||
Width="80"
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
Height="Auto"
|
||||
Margin="10 0 0 0"
|
||||
MinWidth="80"
|
||||
Margin="10 10 0 0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
Content="{DynamicResource select}"
|
||||
Click="SelectPath_OnClick" />
|
||||
</StackPanel>
|
||||
|
||||
Click="SelectPath_OnClick"
|
||||
Content="{DynamicResource select}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Border
|
||||
|
|
@ -118,15 +155,15 @@
|
|||
<Button
|
||||
x:Name="btnCancel"
|
||||
Width="145"
|
||||
Height="30"
|
||||
Margin="0 0 5 0"
|
||||
Height="34"
|
||||
Margin="0 0 5 1"
|
||||
Click="BtnCancel_OnClick"
|
||||
Content="{DynamicResource cancel}" />
|
||||
<Button
|
||||
Name="DownButton"
|
||||
Width="145"
|
||||
Height="30"
|
||||
Margin="5 0 0 0"
|
||||
Height="34"
|
||||
Margin="5 0 0 1"
|
||||
Click="OnDoneButtonClick"
|
||||
Style="{StaticResource AccentButtonStyle}">
|
||||
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
|
||||
|
|
@ -134,4 +171,4 @@
|
|||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
|
|
@ -2,15 +2,17 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Flow.Launcher.Plugin.Explorer.Helper;
|
||||
using Flow.Launcher.Plugin.Explorer.Search;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Explorer.Views;
|
||||
|
||||
public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
||||
[INotifyPropertyChanged]
|
||||
public partial class QuickAccessLinkSettings
|
||||
{
|
||||
private string _selectedPath;
|
||||
public string SelectedPath
|
||||
|
|
@ -25,6 +27,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
if (string.IsNullOrEmpty(_selectedName))
|
||||
{
|
||||
SelectedName = _selectedPath.GetPathName();
|
||||
_accessLinkType = GetResultType(_selectedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -47,11 +50,16 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
}
|
||||
}
|
||||
|
||||
public bool IsFileSelected { get; set; }
|
||||
public bool IsFolderSelected { get; set; } = true; // Default to Folder
|
||||
|
||||
private bool IsEdit { get; }
|
||||
private AccessLink SelectedAccessLink { get; }
|
||||
|
||||
|
||||
public ObservableCollection<AccessLink> QuickAccessLinks { get; }
|
||||
|
||||
|
||||
private ResultType _accessLinkType = ResultType.Folder; // Default to Folder
|
||||
|
||||
public QuickAccessLinkSettings(ObservableCollection<AccessLink> quickAccessLinks)
|
||||
{
|
||||
IsEdit = false;
|
||||
|
|
@ -64,6 +72,9 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
IsEdit = true;
|
||||
_selectedName = selectedAccessLink.Name;
|
||||
_selectedPath = selectedAccessLink.Path;
|
||||
_accessLinkType = GetResultType(_selectedPath); // Initialize link type
|
||||
IsFileSelected = selectedAccessLink.Type == ResultType.File; // Initialize default selection
|
||||
IsFolderSelected = !IsFileSelected;
|
||||
SelectedAccessLink = selectedAccessLink;
|
||||
QuickAccessLinks = quickAccessLinks;
|
||||
InitializeComponent();
|
||||
|
|
@ -96,30 +107,42 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
}
|
||||
|
||||
// If editing, update the existing link
|
||||
if (IsEdit)
|
||||
if (IsEdit)
|
||||
{
|
||||
if (SelectedAccessLink == null) return;
|
||||
|
||||
var index = QuickAccessLinks.IndexOf(SelectedAccessLink);
|
||||
if (index >= 0)
|
||||
if (SelectedAccessLink != null)
|
||||
{
|
||||
var updatedLink = new AccessLink
|
||||
var index = QuickAccessLinks.IndexOf(SelectedAccessLink);
|
||||
if (index >= 0)
|
||||
{
|
||||
Name = SelectedName,
|
||||
Type = SelectedAccessLink.Type,
|
||||
Path = SelectedPath
|
||||
};
|
||||
QuickAccessLinks[index] = updatedLink;
|
||||
var updatedLink = new AccessLink
|
||||
{
|
||||
Name = SelectedName,
|
||||
Type = _accessLinkType,
|
||||
Path = SelectedPath
|
||||
};
|
||||
QuickAccessLinks[index] = updatedLink;
|
||||
}
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
// Add a new one if the selected access link is null (should not happen in edit mode, but just in case)
|
||||
else
|
||||
{
|
||||
AddNewAccessLink();
|
||||
}
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
// Otherwise, add a new one
|
||||
else
|
||||
{
|
||||
AddNewAccessLink();
|
||||
}
|
||||
|
||||
void AddNewAccessLink()
|
||||
{
|
||||
var newAccessLink = new AccessLink
|
||||
{
|
||||
Name = SelectedName,
|
||||
Type = _accessLinkType,
|
||||
Path = SelectedPath
|
||||
};
|
||||
QuickAccessLinks.Add(newAccessLink);
|
||||
|
|
@ -130,18 +153,59 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
|
||||
private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e)
|
||||
{
|
||||
var folderBrowserDialog = new FolderBrowserDialog();
|
||||
// Open file or folder selection dialog based on the selected radio button
|
||||
if (IsFileSelected)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog
|
||||
{
|
||||
Multiselect = false,
|
||||
CheckFileExists = true,
|
||||
CheckPathExists = true
|
||||
};
|
||||
|
||||
if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
|
||||
return;
|
||||
if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK ||
|
||||
string.IsNullOrEmpty(openFileDialog.FileName))
|
||||
return;
|
||||
|
||||
SelectedPath = folderBrowserDialog.SelectedPath;
|
||||
SelectedPath = openFileDialog.FileName;
|
||||
}
|
||||
else // Folder selection
|
||||
{
|
||||
var folderBrowserDialog = new FolderBrowserDialog
|
||||
{
|
||||
ShowNewFolderButton = true
|
||||
};
|
||||
|
||||
if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK ||
|
||||
string.IsNullOrEmpty(folderBrowserDialog.SelectedPath))
|
||||
return;
|
||||
|
||||
SelectedPath = folderBrowserDialog.SelectedPath;
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
private static ResultType GetResultType(string path)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
// Check if the path is a file or folder
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
return ResultType.File;
|
||||
}
|
||||
else if (System.IO.Directory.Exists(path))
|
||||
{
|
||||
if (string.Equals(System.IO.Path.GetPathRoot(path), path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ResultType.Volume;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ResultType.Folder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// This should not happen, but just in case, we assume it's a folder
|
||||
return ResultType.Folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,10 +194,13 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
var workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
||||
var runAsAdministratorArg = !runAsAdministrator && !_settings.RunAsAdministrator ? "" : "runas";
|
||||
|
||||
ProcessStartInfo info = new()
|
||||
var info = new ProcessStartInfo()
|
||||
{
|
||||
Verb = runAsAdministratorArg, WorkingDirectory = workingDirectory,
|
||||
Verb = runAsAdministratorArg,
|
||||
WorkingDirectory = workingDirectory,
|
||||
};
|
||||
var notifyStr = Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close");
|
||||
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
|
||||
switch (_settings.Shell)
|
||||
{
|
||||
case Shell.Cmd:
|
||||
|
|
@ -211,8 +214,19 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
{
|
||||
info.FileName = "cmd.exe";
|
||||
}
|
||||
|
||||
info.ArgumentList.Add($"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command} {(_settings.CloseShellAfterPress ? $"&& echo {Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")} && pause > nul /c" : "")}");
|
||||
if (_settings.LeaveShellOpen)
|
||||
{
|
||||
info.ArgumentList.Add("/k");
|
||||
}
|
||||
else
|
||||
{
|
||||
info.ArgumentList.Add("/c");
|
||||
}
|
||||
info.ArgumentList.Add(
|
||||
$"{command}" +
|
||||
$"{(_settings.CloseShellAfterPress ?
|
||||
$" && echo {notifyStr} && pause > nul /c" :
|
||||
"")}");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -220,7 +234,6 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
{
|
||||
// Using just a ; doesn't work with wt, as it's used to create a new tab for the terminal window
|
||||
// \\ must be escaped for it to work properly, or breaking it into multiple arguments
|
||||
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
|
||||
if (_settings.UseWindowsTerminal)
|
||||
{
|
||||
info.FileName = "wt.exe";
|
||||
|
|
@ -238,7 +251,11 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
else
|
||||
{
|
||||
info.ArgumentList.Add("-Command");
|
||||
info.ArgumentList.Add($"{command}{addedCharacter}; {(_settings.CloseShellAfterPress ? $"Write-Host '{Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" : "")}");
|
||||
info.ArgumentList.Add(
|
||||
$"{command}{addedCharacter};" +
|
||||
$"{(_settings.CloseShellAfterPress ?
|
||||
$" Write-Host '{notifyStr}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" :
|
||||
"")}");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -247,7 +264,6 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
{
|
||||
// Using just a ; doesn't work with wt, as it's used to create a new tab for the terminal window
|
||||
// \\ must be escaped for it to work properly, or breaking it into multiple arguments
|
||||
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
|
||||
if (_settings.UseWindowsTerminal)
|
||||
{
|
||||
info.FileName = "wt.exe";
|
||||
|
|
@ -262,7 +278,11 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
info.ArgumentList.Add("-NoExit");
|
||||
}
|
||||
info.ArgumentList.Add("-Command");
|
||||
info.ArgumentList.Add($"{command}{addedCharacter}; {(_settings.CloseShellAfterPress ? $"Write-Host '{Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" : "")}");
|
||||
info.ArgumentList.Add(
|
||||
$"{command}{addedCharacter};" +
|
||||
$"{(_settings.CloseShellAfterPress ?
|
||||
$" Write-Host '{notifyStr}'{addedCharacter}; [System.Console]::ReadKey(){addedCharacter}; exit" :
|
||||
"")}");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
12
appveyor.yml
12
appveyor.yml
|
|
@ -69,7 +69,17 @@ deploy:
|
|||
- provider: GitHub
|
||||
repository: Flow-Launcher/Prereleases
|
||||
release: v$(prereleaseTag)
|
||||
description: 'This is the early access build of our upcoming release. All changes contained here are reviewed, tested and stable to use.\n\nSee our [release](https://github.com/Flow-Launcher/Flow.Launcher/pulls?q=is%3Aopen+is%3Apr+label%3Arelease) Pull Request for details.\n\nFor latest production release visit [here](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)\n\nPlease report any bugs or issues over at the [main repository](https://github.com/Flow-Launcher/Flow.Launcher/issues)'
|
||||
description: |
|
||||
This is the early access build of our upcoming release.
|
||||
All changes contained here are reviewed, tested and stable to use.
|
||||
|
||||
This build includes new changes from commit:
|
||||
$(APPVEYOR_REPO_COMMIT_MESSAGE)
|
||||
|
||||
See all changes in this early access by going to the [milstones](https://github.com/Flow-Launcher/Flow.Launcher/milestones?sort=title&direction=asc) section and choosing the upcoming milestone.
|
||||
For latest production release visit [here](https://github.com/Flow-Launcher/Flow.Launcher/releases/latest)
|
||||
|
||||
Please report any bugs or issues over at the [main repository](https://github.com/Flow-Launcher/Flow.Launcher/issues)'
|
||||
auth_token:
|
||||
secure: ij4UeXUYQBDJxn2YRAAhUOjklOGVKDB87Hn5J8tKIzj13yatoI7sLM666QDQFEgv
|
||||
artifact: Squirrel Installer, Portable Version, Squirrel nupkg, Squirrel RELEASES
|
||||
|
|
|
|||
Loading…
Reference in a new issue