From 8aa36f38c82a388c386d7e3d86c44798dad632ad Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 13 May 2025 21:50:13 +0800 Subject: [PATCH 001/155] Add ShowAtTopmost in settings --- .../UserSettings/Settings.cs | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 34bf4f90e..3f382c276 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -59,8 +59,11 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _language; set { - _language = value; - OnPropertyChanged(); + if (_language != value) + { + _language = value; + OnPropertyChanged(); + } } } public string Theme @@ -68,7 +71,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _theme; set { - if (value != _theme) + if (_theme != value) { _theme = value; OnPropertyChanged(); @@ -283,9 +286,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _querySearchPrecision; set { - _querySearchPrecision = value; - if (_stringMatcher != null) - _stringMatcher.UserSettingSearchPrecision = value; + if (_querySearchPrecision != value) + { + _querySearchPrecision = value; + if (_stringMatcher != null) + _stringMatcher.UserSettingSearchPrecision = value; + } } } @@ -348,12 +354,28 @@ namespace Flow.Launcher.Infrastructure.UserSettings get => _hideNotifyIcon; set { - _hideNotifyIcon = value; - OnPropertyChanged(); + if (_hideNotifyIcon != value) + { + _hideNotifyIcon = value; + OnPropertyChanged(); + } } } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; + private bool _showAtTopmost; + public bool ShowAtTopmost + { + get => _showAtTopmost; + set + { + if (_showAtTopmost != value) + { + _showAtTopmost = value; + OnPropertyChanged(); + } + } + } public bool SearchQueryResultsWithDelay { get; set; } public int SearchDelayTime { get; set; } = 150; From 587ab629aa9b831ba8ed684eb2039dbba6b28ff1 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 13 May 2025 21:54:03 +0800 Subject: [PATCH 002/155] Support changing ShowAtTopmost --- Flow.Launcher/MainWindow.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 46eeb2adc..72a990ada 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -84,6 +84,8 @@ namespace Flow.Launcher _viewModel = Ioc.Default.GetRequiredService(); DataContext = _viewModel; + Topmost = _settings.ShowAtTopmost; + InitializeComponent(); UpdatePosition(); @@ -283,6 +285,9 @@ namespace Flow.Launcher _viewModel.QueryResults(); } break; + case nameof(Settings.ShowAtTopmost): + Topmost = _settings.ShowAtTopmost; + break; } }; From 4e88ce3f48b9eae47dc57c595acfe7862b540476 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 13 May 2025 22:01:36 +0800 Subject: [PATCH 003/155] Set ShowAtTopmost default to true --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 3f382c276..7cd3821dc 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -363,7 +363,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; - private bool _showAtTopmost; + private bool _showAtTopmost = true; public bool ShowAtTopmost { get => _showAtTopmost; From b8f743eb4c2ad44bc89366698a6ee8543d1d5343 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 13 May 2025 22:06:04 +0800 Subject: [PATCH 004/155] Add ui in general setting page --- Flow.Launcher/Languages/en.xaml | 2 ++ .../SettingPages/Views/SettingsPaneGeneral.xaml | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 22ab2016c..f728f1095 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -131,6 +131,8 @@ Show History Results in Home Page Maximum History Results Shown in Home Page This can only be edited if plugin supports Home feature and Home Page is enabled. + Show Search Window at Topmost + Show search window above other windows Search Plugin diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml index c0c5613de..fba1b3d86 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml @@ -77,6 +77,17 @@ OnContent="{DynamicResource enable}" /> + + + + From b636f253e65114639dca2aa7d14271d013a993a6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 13 May 2025 22:52:06 +0800 Subject: [PATCH 005/155] Add blank line --- Flow.Launcher.Infrastructure/UserSettings/Settings.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 7cd3821dc..8dc48f7f2 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -363,6 +363,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings } public bool LeaveCmdOpen { get; set; } public bool HideWhenDeactivated { get; set; } = true; + private bool _showAtTopmost = true; public bool ShowAtTopmost { From 5bae2020313e836ed8c15699cb007f260dce67be Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 02:34:24 -0300 Subject: [PATCH 006/155] Columns - Path and Name --- .../Views/ExplorerSettings.xaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 4302e721a..3ef61573d 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -718,9 +718,27 @@ BorderThickness="1" DragEnter="lbxAccessLinks_DragEnter" Drop="LbxAccessLinks_OnDrop" - ItemTemplate="{StaticResource ListViewTemplateAccessLinks}" ItemsSource="{Binding Settings.QuickAccessLinks}" - SelectedItem="{Binding SelectedQuickAccessLink}" /> + SelectedItem="{Binding SelectedQuickAccessLink, Mode=TwoWay}"> + + + + + + + + + + + + + + + + + + + Date: Sun, 25 May 2025 02:34:48 -0300 Subject: [PATCH 007/155] AccessLink Refactor --- .../Search/QuickAccessLinks/AccessLink.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs index 1975211f9..8650b4c4c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/AccessLink.cs @@ -9,21 +9,20 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks public string Path { get; set; } public ResultType Type { get; set; } = ResultType.Folder; - - [JsonIgnore] - public string Name + + public string Name { get; set; } + + private string GetPathName() { - get - { - var path = Path.EndsWith(Constants.DirectorySeparator) ? Path[0..^1] : Path; + var path = Path.EndsWith(Constants.DirectorySeparator) ? Path[0..^1] : Path; - if (path.EndsWith(':')) - return path[0..^1] + " Drive"; + if (path.EndsWith(':')) + return path[0..^1] + " Drive"; - return path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None) - .Last(); - } + return path.Split(new[] { System.IO.Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); } + } } From 179babe31371c27e55108c42e4e216ad595c6643 Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 02:35:09 -0300 Subject: [PATCH 008/155] New window to add/edit quick access link --- .../Languages/en.xaml | 1 + .../Views/QuickAccessLinkSettings.xaml | 136 ++++++++++++++++++ .../Views/QuickAccessLinkSettings.xaml.cs | 114 +++++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index eefd6f4eb..960373ef1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -92,6 +92,7 @@ Permanently delete current file Permanently delete current folder Path: + Name: Delete the selected Run as different user Run the selected using a different user account diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml new file mode 100644 index 000000000..e6ad44e4e --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs new file mode 100644 index 000000000..9d2c54e2d --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -0,0 +1,114 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Forms; +using Flow.Launcher.Plugin.Explorer.Search; +using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; + +namespace Flow.Launcher.Plugin.Explorer.Views; + +public partial class QuickAccessLinkSettings : INotifyPropertyChanged +{ + + private string _selectedPath; + public string SelectedPath + { + get => _selectedPath; + set + { + if (_selectedPath != value) + { + _selectedPath = value; + OnPropertyChanged(); + SelectedName = GetPathName(); + } + } + } + + + private string _selectedName; + public string SelectedName + { + get => _selectedName; + set + { + if (_selectedName != value) + { + _selectedName = value; + OnPropertyChanged(); + } + } + } + + + public QuickAccessLinkSettings() + { + InitializeComponent(); + } + + + + private void BtnCancel_OnClick(object sender, RoutedEventArgs e) + { + DialogResult = false; + Close(); + } + + private void OnDoneButtonClick(object sender, RoutedEventArgs e) + { + var container = Settings.QuickAccessLinks; + + + // Lembrar de colocar uma logica pra evitar path e name vazios + var newAccessLink = new AccessLink + { + Name = SelectedName, + Path = SelectedPath + }; + container.Add(newAccessLink); + DialogResult = false; + Close(); + } + + private void SelectPath_OnClick(object commandParameter, RoutedEventArgs e) + { + var folderBrowserDialog = new FolderBrowserDialog(); + + if (folderBrowserDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) + return; + + SelectedPath = folderBrowserDialog.SelectedPath; + } + + private string GetPathName() + { + if (string.IsNullOrEmpty(SelectedPath)) return ""; + var path = SelectedPath.EndsWith(Constants.DirectorySeparator) ? SelectedPath[0..^1] : SelectedPath; + + if (path.EndsWith(':')) + return path[0..^1] + " Drive"; + + return path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.None) + .Last(); + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + protected bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) + { + if (EqualityComparer.Default.Equals(field, value)) return false; + field = value; + OnPropertyChanged(propertyName); + return true; + } +} + From 3777e2b6d86bfa2f689c942ee9bbf186dc50138d Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 02:36:55 -0300 Subject: [PATCH 009/155] Changing QuickAccessLinks property to static This change is necessary for quick access settings window --- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index 4f83fc72e..2380a1ec9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -15,7 +15,7 @@ namespace Flow.Launcher.Plugin.Explorer { public int MaxResult { get; set; } = 100; - public ObservableCollection QuickAccessLinks { get; set; } = new(); + public static ObservableCollection QuickAccessLinks { get; set; } = new(); public ObservableCollection IndexSearchExcludedSubdirectoryPaths { get; set; } = new ObservableCollection(); From 61aca7409668890b1a55a14457ec02f0414d1209 Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 02:41:17 -0300 Subject: [PATCH 010/155] Separating add commands between QuickAccessLink and IndexSearchExcludedPaths --- .../ViewModels/SettingsViewModel.cs | 27 ++++++++++--------- .../Views/ExplorerSettings.xaml | 4 +-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index fb33dacab..508e20893 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -365,27 +365,28 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels } [RelayCommand] - private void AddLink(object commandParameter) + private void AddQuickAccessLink(object commandParameter) { - var container = commandParameter switch - { - "QuickAccessLink" => Settings.QuickAccessLinks, - "IndexSearchExcludedPaths" => Settings.IndexSearchExcludedSubdirectoryPaths, - _ => throw new ArgumentOutOfRangeException(nameof(commandParameter)) - }; - - ArgumentNullException.ThrowIfNull(container); - + var quickAccessLinkSettings = new QuickAccessLinkSettings(); + quickAccessLinkSettings.ShowDialog(); + } + + + [RelayCommand] + private void AddIndexSearchExcludePaths(object commandParameter) + { + var container = Settings.IndexSearchExcludedSubdirectoryPaths; + var folderBrowserDialog = new FolderBrowserDialog(); - + if (folderBrowserDialog.ShowDialog() != DialogResult.OK) return; - + var newAccessLink = new AccessLink { Path = folderBrowserDialog.SelectedPath }; - + container.Add(newAccessLink); } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 3ef61573d..07f05b1c1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -762,7 +762,7 @@ From bc2648c216b4ee485c584bd81e1abb3ada9ba3cb Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 16:05:26 -0300 Subject: [PATCH 018/155] Code quality --- .../ViewModels/SettingsViewModel.cs | 4 ++-- .../Views/QuickAccessLinkSettings.xaml.cs | 23 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 447e72736..6237deabb 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -383,14 +383,14 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels return; } - var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings,SelectedQuickAccessLink); + var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks,SelectedQuickAccessLink); quickAccessLinkSettings.ShowDialog(); } [RelayCommand] private void AddQuickAccessLink(object commandParameter) { - var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings); + var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks); quickAccessLinkSettings.ShowDialog(); } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index 5eda62558..28cd68bad 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; @@ -53,20 +54,21 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged private bool IsEdit { get; set; } [CanBeNull] private AccessLink SelectedAccessLink { get; set; } - private Settings Settings { get; } - public QuickAccessLinkSettings(Settings settings) + public ObservableCollection QuickAccessLinks { get; set; } + + public QuickAccessLinkSettings(ObservableCollection quickAccessLinks) { - Settings = settings; + QuickAccessLinks = quickAccessLinks; InitializeComponent(); } - public QuickAccessLinkSettings(Settings settings,AccessLink selectedAccessLink) + public QuickAccessLinkSettings(ObservableCollection quickAccessLinks,AccessLink selectedAccessLink) { IsEdit = true; _selectedName = selectedAccessLink.Name; _selectedPath = selectedAccessLink.Path; SelectedAccessLink = selectedAccessLink; - Settings = settings; + QuickAccessLinks = quickAccessLinks; InitializeComponent(); } @@ -88,7 +90,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged return; } - if (Settings.QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName)) + if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName)) { var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder"); Main.Context.API.ShowMsgBox(warning); @@ -99,9 +101,8 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged EditAccessLink(); return; } - var container = Settings.QuickAccessLinks; var newAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath }; - container.Add(newAccessLink); + QuickAccessLinks.Add(newAccessLink); DialogResult = false; Close(); } @@ -120,12 +121,12 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged { if (SelectedAccessLink == null)throw new ArgumentException("Access Link object is null"); - var obj = Settings.QuickAccessLinks.FirstOrDefault(x => x.GetHashCode() == SelectedAccessLink.GetHashCode()); - int index = Settings.QuickAccessLinks.IndexOf(obj); + var obj = QuickAccessLinks.FirstOrDefault(x => x.GetHashCode() == SelectedAccessLink.GetHashCode()); + int index = QuickAccessLinks.IndexOf(obj); if (index >= 0) { SelectedAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath }; - Settings.QuickAccessLinks[index] = SelectedAccessLink; + QuickAccessLinks[index] = SelectedAccessLink; } DialogResult = false; IsEdit = false; From cd62e7b5dc4695a83339d2a02c9682603d775479 Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 16:11:03 -0300 Subject: [PATCH 019/155] uP --- .../Helper/{FolderPathHelper.cs => PathHelper.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Plugins/Flow.Launcher.Plugin.Explorer/Helper/{FolderPathHelper.cs => PathHelper.cs} (94%) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/FolderPathHelper.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs similarity index 94% rename from Plugins/Flow.Launcher.Plugin.Explorer/Helper/FolderPathHelper.cs rename to Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs index 74e23be3a..36b098d1e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Helper/FolderPathHelper.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Helper/PathHelper.cs @@ -5,7 +5,7 @@ using Flow.Launcher.Plugin.Explorer.Search; namespace Flow.Launcher.Plugin.Explorer.Helper; -public static class FolderPathHelper +public static class PathHelper { public static string GetPathName(this string selectedPath) { From 29831d61bb2b496b88ecd8588c0518e506d7ea3e Mon Sep 17 00:00:00 2001 From: 01Dri Date: Sun, 25 May 2025 16:48:20 -0300 Subject: [PATCH 020/155] AI Review Refactor suggestion --- .../Languages/en.xaml | 2 +- .../ViewModels/SettingsViewModel.cs | 10 ++++---- .../Views/QuickAccessLinkSettings.xaml.cs | 23 ++++++++++--------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index ef55a4088..cc6b58e42 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -6,7 +6,7 @@ Please make a selection first Please select a folder path. - Please choose a different name or folder path. + Please choose a different name or folder path. Please select a folder link Are you sure you want to delete {0}? Are you sure you want to permanently delete this file? diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 6237deabb..d6effb4e2 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Windows; using System.Windows.Forms; using CommunityToolkit.Mvvm.Input; +using Flow.Launcher.Plugin.Explorer.Helper; using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search.Everything; using Flow.Launcher.Plugin.Explorer.Search.Everything.Exceptions; @@ -352,7 +353,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels collection.Remove(SelectedIndexSearchExcludedPath); collection.Add(new AccessLink { - Path = path, Type = selectedType, + Path = path, Type = selectedType, Name = path.GetPathName() }); } @@ -368,10 +369,12 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels var newAccessLink = new AccessLink { + Name = folderBrowserDialog.SelectedPath.GetPathName(), Path = folderBrowserDialog.SelectedPath }; container.Add(newAccessLink); + Save(); } [RelayCommand] @@ -382,16 +385,15 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels ShowUnselectedMessage(); return; } - var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks,SelectedQuickAccessLink); - quickAccessLinkSettings.ShowDialog(); + if (quickAccessLinkSettings.ShowDialog() == true) Save(); } [RelayCommand] private void AddQuickAccessLink(object commandParameter) { var quickAccessLinkSettings = new QuickAccessLinkSettings(Settings.QuickAccessLinks); - quickAccessLinkSettings.ShowDialog(); + if (quickAccessLinkSettings.ShowDialog() == true) Save(); } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs index 28cd68bad..388fc2c91 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/QuickAccessLinkSettings.xaml.cs @@ -52,9 +52,9 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged } private bool IsEdit { get; set; } - [CanBeNull] private AccessLink SelectedAccessLink { get; set; } + [CanBeNull] private AccessLink SelectedAccessLink { get; } - public ObservableCollection QuickAccessLinks { get; set; } + public ObservableCollection QuickAccessLinks { get; } public QuickAccessLinkSettings(ObservableCollection quickAccessLinks) { @@ -89,10 +89,12 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged Main.Context.API.ShowMsgBox(warning); return; } - - if (QuickAccessLinks.Any(x => x.Path == SelectedPath && x.Name == SelectedName)) + + if (QuickAccessLinks.Any(x => + x.Path.Equals(SelectedPath, StringComparison.OrdinalIgnoreCase) && + x.Name.Equals(SelectedName, StringComparison.OrdinalIgnoreCase))) { - var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_select_different_folder"); + var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_path_already_exists"); Main.Context.API.ShowMsgBox(warning); return; } @@ -103,7 +105,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged } var newAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath }; QuickAccessLinks.Add(newAccessLink); - DialogResult = false; + DialogResult = true; Close(); } @@ -121,14 +123,13 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged { if (SelectedAccessLink == null)throw new ArgumentException("Access Link object is null"); - var obj = QuickAccessLinks.FirstOrDefault(x => x.GetHashCode() == SelectedAccessLink.GetHashCode()); - int index = QuickAccessLinks.IndexOf(obj); + var index = QuickAccessLinks.IndexOf(SelectedAccessLink); if (index >= 0) { - SelectedAccessLink = new AccessLink { Name = SelectedName, Path = SelectedPath }; - QuickAccessLinks[index] = SelectedAccessLink; + var updatedLink = new AccessLink { Name = SelectedName, Path = SelectedPath }; + QuickAccessLinks[index] = updatedLink; } - DialogResult = false; + DialogResult = true; IsEdit = false; Close(); } From 4a50eec281e6013301efd5b56eb5c601d3921565 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 30 May 2025 10:59:22 +0800 Subject: [PATCH 021/155] Remove TranslationConverter & project reference in Explorer plugin --- .../Resource/TranslationConverter.cs | 25 ------------------- .../UserSettings/CustomShortcutModel.cs | 8 ++++++ .../Resources/SettingWindowStyle.xaml | 1 - .../Views/SettingsPaneHotkey.xaml | 2 +- .../Flow.Launcher.Plugin.Explorer.csproj | 3 +-- .../ViewModels/ActionKeywordModel.cs | 2 ++ .../Views/ExplorerSettings.xaml | 6 ++--- 7 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 Flow.Launcher.Core/Resource/TranslationConverter.cs diff --git a/Flow.Launcher.Core/Resource/TranslationConverter.cs b/Flow.Launcher.Core/Resource/TranslationConverter.cs deleted file mode 100644 index eb0032758..000000000 --- a/Flow.Launcher.Core/Resource/TranslationConverter.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Globalization; -using System.Windows.Data; -using CommunityToolkit.Mvvm.DependencyInjection; -using Flow.Launcher.Plugin; - -namespace Flow.Launcher.Core.Resource -{ - public class TranslationConverter : IValueConverter - { - // We should not initialize API in static constructor because it will create another API instance - private static IPublicAPI api = null; - private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService(); - - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) - { - var key = value.ToString(); - if (string.IsNullOrEmpty(key)) return key; - return API.GetTranslation(key); - } - - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => - throw new InvalidOperationException(); - } -} diff --git a/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs index 2d15b54c5..2603d4675 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs @@ -1,6 +1,8 @@ using System; using System.Text.Json.Serialization; using System.Threading.Tasks; +using CommunityToolkit.Mvvm.DependencyInjection; +using Flow.Launcher.Plugin; namespace Flow.Launcher.Infrastructure.UserSettings { @@ -53,6 +55,12 @@ namespace Flow.Launcher.Infrastructure.UserSettings { public string Description { get; set; } + public string LocalizedDescription => API.GetTranslation(Description); + + // We should not initialize API in static constructor because it will create another API instance + private static IPublicAPI api = null; + private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService(); + public BaseBuiltinShortcutModel(string key, string description) { Key = key; diff --git a/Flow.Launcher/Resources/SettingWindowStyle.xaml b/Flow.Launcher/Resources/SettingWindowStyle.xaml index fc9246aa3..3ebd22c74 100644 --- a/Flow.Launcher/Resources/SettingWindowStyle.xaml +++ b/Flow.Launcher/Resources/SettingWindowStyle.xaml @@ -6,7 +6,6 @@ - F1 M512,512z M0,0z M448,256C448,150,362,64,256,64L256,448C362,448,448,362,448,256z M0,256A256,256,0,1,1,512,256A256,256,0,1,1,0,256z diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml index b1d72ede5..861e9d294 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml @@ -424,7 +424,7 @@ - + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj index 98164f489..93691814a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -46,6 +46,7 @@ + @@ -53,8 +54,6 @@ - - diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs index d4cd1348e..745032d2c 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs @@ -24,6 +24,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views public string Description { get; private init; } + public string LocalizedDescription => Main.Context.API.GetTranslation(Description); + internal Settings.ActionKeyword KeywordProperty { get; } private void OnPropertyChanged([CallerMemberName] string propertyName = "") diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 4302e721a..c034ac0e1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -3,7 +3,6 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:Flow.Launcher.Plugin.Explorer.Views.Converters" - 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:qa="clr-namespace:Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks" @@ -109,7 +108,7 @@ + Text="{Binding LocalizedDescription, Mode=OneTime}"> + - @@ -163,653 +79,685 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + + + + + + + + + + + + + + - + + + + + + + + + \ No newline at end of file diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml.cs b/Flow.Launcher/ReleaseNotesWindow.xaml.cs new file mode 100644 index 000000000..18c67ac5b --- /dev/null +++ b/Flow.Launcher/ReleaseNotesWindow.xaml.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; +using Flow.Launcher.Infrastructure.Http; + +namespace Flow.Launcher +{ + public partial class ReleaseNotesWindow : Window + { + public ReleaseNotesWindow() + { + InitializeComponent(); + } + + #region Window Events + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")] + private async void Window_Loaded(object sender, RoutedEventArgs e) + { + RefreshMaximizeRestoreButton(); + MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync(); + } + + private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) + { + Close(); + } + + #endregion + + #region Window Custom TitleBar + + private void OnMinimizeButtonClick(object sender, RoutedEventArgs e) + { + WindowState = WindowState.Minimized; + } + + private void OnMaximizeRestoreButtonClick(object sender, RoutedEventArgs e) + { + WindowState = WindowState switch + { + WindowState.Maximized => WindowState.Normal, + _ => WindowState.Maximized + }; + } + + private void OnCloseButtonClick(object sender, RoutedEventArgs e) + { + Close(); + } + + private void RefreshMaximizeRestoreButton() + { + if (WindowState == WindowState.Maximized) + { + MaximizeButton.Visibility = Visibility.Hidden; + RestoreButton.Visibility = Visibility.Visible; + } + else + { + MaximizeButton.Visibility = Visibility.Visible; + RestoreButton.Visibility = Visibility.Hidden; + } + } + + private void Window_StateChanged(object sender, EventArgs e) + { + RefreshMaximizeRestoreButton(); + } + + #endregion + + #region Release Notes + + private static async Task GetReleaseNotesMarkdownAsync() + { + var releaseNotesJSON = await Http.GetStringAsync("https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases"); + var releases = JsonSerializer.Deserialize>(releaseNotesJSON); + + // Get the latest releases + var latestReleases = releases.OrderByDescending(release => release.PublishedDate).Take(3); + + // Build the release notes in Markdown format + var releaseNotesHtmlBuilder = new StringBuilder(string.Empty); + foreach (var release in latestReleases) + { + releaseNotesHtmlBuilder.AppendLine("# " + release.Name); + + // Add unit for images: Replace with + 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; + }); + + releaseNotesHtmlBuilder.AppendLine(notes); + releaseNotesHtmlBuilder.AppendLine(" "); + } + + return releaseNotesHtmlBuilder.ToString(); + } + + private static bool IsNumber(string input) + { + if (string.IsNullOrEmpty(input)) + return false; + + foreach (char c in input) + { + if (!char.IsDigit(c)) + return false; + } + return true; + } + + private sealed class GitHubReleaseInfo + { + [JsonPropertyName("published_at")] + public DateTimeOffset PublishedDate { get; set; } + + [JsonPropertyName("name")] + public string Name { get; set; } + + [JsonPropertyName("tag_name")] + public string TagName { get; set; } + + [JsonPropertyName("body")] + public string ReleaseNotes { get; set; } + } + + [GeneratedRegex("(]*width\\s*=\\s*[\"']?)(\\d+)([\"']?)([^>]*>)", RegexOptions.IgnoreCase, "en-GB")] + private static partial Regex ImageUnitRegex(); + + #endregion + } +} From 7117ba05ee4ef544f4bc0c7c648fa3e5f8c25971 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 6 Jun 2025 23:08:41 +0800 Subject: [PATCH 102/155] Test release notes window --- Flow.Launcher/MainWindow.xaml.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index a77d6471c..b266d3dc0 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -132,6 +132,9 @@ namespace Flow.Launcher welcomeWindow.Show(); } + var releaseNotesWindow = new ReleaseNotesWindow(); + releaseNotesWindow.Show(); + // Initialize place holder SetupPlaceholderText(); _viewModel.PlaceholderText = _settings.PlaceholderText; From c241d21a4a9259a3ce1eb50f21b0624c6780cba0 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 6 Jun 2025 23:51:26 +0800 Subject: [PATCH 103/155] Fix height --- Flow.Launcher/ReleaseNotesWindow.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml b/Flow.Launcher/ReleaseNotesWindow.xaml index 132de63c8..e61986aea 100644 --- a/Flow.Launcher/ReleaseNotesWindow.xaml +++ b/Flow.Launcher/ReleaseNotesWindow.xaml @@ -157,7 +157,7 @@ Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="5" - MaxHeight="510" + Height="510" Margin="15 0 20 0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" From af0e1180a5cbc18cba3090f10595e58ab12e7ac6 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Fri, 6 Jun 2025 23:52:34 +0800 Subject: [PATCH 104/155] Use loaded event & Add style --- Flow.Launcher/ReleaseNotesWindow.xaml | 3 ++- Flow.Launcher/ReleaseNotesWindow.xaml.cs | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml b/Flow.Launcher/ReleaseNotesWindow.xaml index e61986aea..7b2e5f7e7 100644 --- a/Flow.Launcher/ReleaseNotesWindow.xaml +++ b/Flow.Launcher/ReleaseNotesWindow.xaml @@ -161,7 +161,8 @@ Margin="15 0 20 0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" - ClickAction="SafetyDisplayWithRelativePath" /> + ClickAction="SafetyDisplayWithRelativePath" + Loaded="MarkdownViewer_Loaded" /> diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml.cs b/Flow.Launcher/ReleaseNotesWindow.xaml.cs index 18c67ac5b..4f0c1a9ce 100644 --- a/Flow.Launcher/ReleaseNotesWindow.xaml.cs +++ b/Flow.Launcher/ReleaseNotesWindow.xaml.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using Flow.Launcher.Infrastructure.Http; +using MdXaml; namespace Flow.Launcher { @@ -21,11 +22,9 @@ namespace Flow.Launcher #region Window Events - [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")] - private async void Window_Loaded(object sender, RoutedEventArgs e) + private void Window_Loaded(object sender, RoutedEventArgs e) { RefreshMaximizeRestoreButton(); - MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync(); } private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) @@ -82,6 +81,11 @@ namespace Flow.Launcher private static async Task GetReleaseNotesMarkdownAsync() { var releaseNotesJSON = await Http.GetStringAsync("https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases"); + + if (string.IsNullOrEmpty(releaseNotesJSON)) + { + return string.Empty; + } var releases = JsonSerializer.Deserialize>(releaseNotesJSON); // Get the latest releases @@ -145,5 +149,12 @@ namespace Flow.Launcher private static partial Regex ImageUnitRegex(); #endregion + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "")] + private async void MarkdownViewer_Loaded(object sender, RoutedEventArgs e) + { + MarkdownViewer.MarkdownStyle = MarkdownStyle.GithubLike; + MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync(); + } } } From 02496214ea2cabbd0037bc83f3e9e03125311222 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sat, 7 Jun 2025 00:07:44 +0800 Subject: [PATCH 105/155] Add progress ring --- Flow.Launcher/ReleaseNotesWindow.xaml | 23 ++++++++++++++++ Flow.Launcher/ReleaseNotesWindow.xaml.cs | 34 +++++++++++++++++++++--- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher/ReleaseNotesWindow.xaml b/Flow.Launcher/ReleaseNotesWindow.xaml index 7b2e5f7e7..f70fa6f5c 100644 --- a/Flow.Launcher/ReleaseNotesWindow.xaml +++ b/Flow.Launcher/ReleaseNotesWindow.xaml @@ -163,6 +163,29 @@ VerticalAlignment="Stretch" ClickAction="SafetyDisplayWithRelativePath" Loaded="MarkdownViewer_Loaded" /> + + + + +