From efe65956cc98c97c471b53fb4b4d68e5ba31bd19 Mon Sep 17 00:00:00 2001 From: Koisu Date: Mon, 23 Jun 2025 19:17:38 -0700 Subject: [PATCH] revert bad changes --- Flow.Launcher/HotkeyControlDialog.xaml.cs | 7 - .../Search/ResultManager.cs | 1 - .../Flow.Launcher.Plugin.Explorer/Settings.cs | 205 +++++++----------- .../ViewModels/SettingsViewModel.cs | 2 +- .../Views/ActionKeywordSetting.xaml.cs | 1 - 5 files changed, 78 insertions(+), 138 deletions(-) diff --git a/Flow.Launcher/HotkeyControlDialog.xaml.cs b/Flow.Launcher/HotkeyControlDialog.xaml.cs index 9d6c8a4c3..c7af8c5b8 100644 --- a/Flow.Launcher/HotkeyControlDialog.xaml.cs +++ b/Flow.Launcher/HotkeyControlDialog.xaml.cs @@ -135,12 +135,10 @@ public partial class HotkeyControlDialog : ContentDialog } if (tbMsg == null) - return; if (_hotkeySettings.RegisteredHotkeys.FirstOrDefault(v => v.Hotkey == hotkey) is { } registeredHotkeyData) { - var description = string.Format( App.API.GetTranslation(registeredHotkeyData.DescriptionResourceKey), registeredHotkeyData.DescriptionFormatVariables @@ -148,7 +146,6 @@ public partial class HotkeyControlDialog : ContentDialog Alert.Visibility = Visibility.Visible; if (registeredHotkeyData.RemoveHotkey is not null) { - tbMsg.Text = string.Format( App.API.GetTranslation("hotkeyUnavailableEditable"), description @@ -161,7 +158,6 @@ public partial class HotkeyControlDialog : ContentDialog } else { - tbMsg.Text = string.Format( App.API.GetTranslation("hotkeyUnavailableUneditable"), description @@ -179,7 +175,6 @@ public partial class HotkeyControlDialog : ContentDialog if (!CheckHotkeyAvailability(hotkey.Value, true)) { - tbMsg.Text = App.API.GetTranslation("hotkeyUnavailable"); Alert.Visibility = Visibility.Visible; SaveBtn.IsEnabled = false; @@ -187,12 +182,10 @@ public partial class HotkeyControlDialog : ContentDialog } else { - Alert.Visibility = Visibility.Collapsed; SaveBtn.IsEnabled = true; SaveBtn.Visibility = Visibility.Visible; } - } private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 8c9db37aa..e87d2df97 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -60,7 +60,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search public static Result CreateResult(Query query, SearchResult result) { - return result.Type switch { ResultType.Folder or ResultType.Volume => diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index cf380ee00..77540f3a8 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -1,17 +1,13 @@ -using System; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.IO; -using System.Text.Json.Serialization; -using Flow.Launcher.Plugin.Everything.Everything; +using Flow.Launcher.Plugin.Everything.Everything; using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search.Everything; -using Flow.Launcher.Plugin.Explorer.Search.IProvider; using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks; using Flow.Launcher.Plugin.Explorer.Search.WindowsIndex; -using Flow.Launcher.Plugin.Explorer.ViewModels; -using Flow.Launcher.Plugin.Explorer.Views; - +using System; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Text.Json.Serialization; +using Flow.Launcher.Plugin.Explorer.Search.IProvider; namespace Flow.Launcher.Plugin.Explorer { @@ -21,8 +17,7 @@ namespace Flow.Launcher.Plugin.Explorer public ObservableCollection QuickAccessLinks { get; set; } = new(); - public ObservableCollection IndexSearchExcludedSubdirectoryPaths { get; set; } = - new ObservableCollection(); + public ObservableCollection IndexSearchExcludedSubdirectoryPaths { get; set; } = new ObservableCollection(); public string EditorPath { get; set; } = ""; @@ -48,8 +43,7 @@ namespace Flow.Launcher.Plugin.Explorer public bool SearchActionKeywordEnabled { get; set; } = true; - public string FileContentSearchActionKeyword { get; set; } = - Constants.DefaultContentSearchActionKeyword; + public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword; public bool FileContentSearchKeywordEnabled { get; set; } = true; @@ -64,8 +58,7 @@ namespace Flow.Launcher.Plugin.Explorer public string QuickAccessActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; public bool QuickAccessKeywordEnabled { get; set; } - public string RenameActionKeyword { get; set; } = "re:"; - public bool RenameActionKeywordEnabled { get; set; } = true; + public bool WarnWindowsSearchServiceOff { get; set; } = true; @@ -74,9 +67,10 @@ namespace Flow.Launcher.Plugin.Explorer public bool ShowCreatedDateInPreviewPanel { get; set; } = true; public bool ShowModifiedDateInPreviewPanel { get; set; } = true; - + public bool ShowFileAgeInPreviewPanel { get; set; } = false; + public string PreviewPanelDateFormat { get; set; } = "yyyy-MM-dd"; public string PreviewPanelTimeFormat { get; set; } = "HH:mm"; @@ -86,55 +80,44 @@ namespace Flow.Launcher.Plugin.Explorer #region SearchEngine - private EverythingSearchManager EverythingManagerInstance => - _everythingManagerInstance ??= new EverythingSearchManager(this); - private WindowsIndexSearchManager WindowsIndexSearchManager => - _windowsIndexSearchManager ??= new WindowsIndexSearchManager(this); + private EverythingSearchManager EverythingManagerInstance => _everythingManagerInstance ??= new EverythingSearchManager(this); + private WindowsIndexSearchManager WindowsIndexSearchManager => _windowsIndexSearchManager ??= new WindowsIndexSearchManager(this); - public IndexSearchEngineOption IndexSearchEngine { get; set; } = - IndexSearchEngineOption.WindowsIndex; + + public IndexSearchEngineOption IndexSearchEngine { get; set; } = IndexSearchEngineOption.WindowsIndex; + [JsonIgnore] + public IIndexProvider IndexProvider => IndexSearchEngine switch + { + IndexSearchEngineOption.Everything => EverythingManagerInstance, + IndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager, + _ => throw new ArgumentOutOfRangeException(nameof(IndexSearchEngine)) + }; + + public PathEnumerationEngineOption PathEnumerationEngine { get; set; } = PathEnumerationEngineOption.WindowsIndex; [JsonIgnore] - public IIndexProvider IndexProvider => - IndexSearchEngine switch - { - IndexSearchEngineOption.Everything => EverythingManagerInstance, - IndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager, - _ => throw new ArgumentOutOfRangeException(nameof(IndexSearchEngine)) - }; - - public PathEnumerationEngineOption PathEnumerationEngine { get; set; } = - PathEnumerationEngineOption.WindowsIndex; + public IPathIndexProvider PathEnumerator => PathEnumerationEngine switch + { + PathEnumerationEngineOption.Everything => EverythingManagerInstance, + PathEnumerationEngineOption.WindowsIndex => WindowsIndexSearchManager, + _ => throw new ArgumentOutOfRangeException(nameof(PathEnumerationEngine)) + }; + public ContentIndexSearchEngineOption ContentSearchEngine { get; set; } = ContentIndexSearchEngineOption.WindowsIndex; [JsonIgnore] - public IPathIndexProvider PathEnumerator => - PathEnumerationEngine switch - { - PathEnumerationEngineOption.Everything => EverythingManagerInstance, - PathEnumerationEngineOption.WindowsIndex => WindowsIndexSearchManager, - _ => throw new ArgumentOutOfRangeException(nameof(PathEnumerationEngine)) - }; - - public ContentIndexSearchEngineOption ContentSearchEngine { get; set; } = - ContentIndexSearchEngineOption.WindowsIndex; - - [JsonIgnore] - public IContentIndexProvider ContentIndexProvider => - ContentSearchEngine switch - { - ContentIndexSearchEngineOption.Everything => EverythingManagerInstance, - ContentIndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager, - _ => throw new ArgumentOutOfRangeException(nameof(ContentSearchEngine)) - }; + public IContentIndexProvider ContentIndexProvider => ContentSearchEngine switch + { + ContentIndexSearchEngineOption.Everything => EverythingManagerInstance, + ContentIndexSearchEngineOption.WindowsIndex => WindowsIndexSearchManager, + _ => throw new ArgumentOutOfRangeException(nameof(ContentSearchEngine)) + }; public enum PathEnumerationEngineOption { [Description("plugin_explorer_engine_windows_index")] WindowsIndex, - [Description("plugin_explorer_engine_everything")] Everything, - [Description("plugin_explorer_path_enumeration_engine_none")] DirectEnumeration } @@ -143,7 +126,6 @@ namespace Flow.Launcher.Plugin.Explorer { [Description("plugin_explorer_engine_windows_index")] WindowsIndex, - [Description("plugin_explorer_engine_everything")] Everything, } @@ -152,7 +134,6 @@ namespace Flow.Launcher.Plugin.Explorer { [Description("plugin_explorer_engine_windows_index")] WindowsIndex, - [Description("plugin_explorer_engine_everything")] Everything, } @@ -171,10 +152,9 @@ namespace Flow.Launcher.Plugin.Explorer public bool EnableEverythingContentSearch { get; set; } = false; - public bool EverythingEnabled => - IndexSearchEngine == IndexSearchEngineOption.Everything - || PathEnumerationEngine == PathEnumerationEngineOption.Everything - || ContentSearchEngine == ContentIndexSearchEngineOption.Everything; + public bool EverythingEnabled => IndexSearchEngine == IndexSearchEngineOption.Everything || + PathEnumerationEngine == PathEnumerationEngineOption.Everything || + ContentSearchEngine == ContentIndexSearchEngineOption.Everything; public bool EverythingSearchFullPath { get; set; } = false; public bool EverythingEnableRunCount { get; set; } = true; @@ -187,78 +167,47 @@ namespace Flow.Launcher.Plugin.Explorer PathSearchActionKeyword, FileContentSearchActionKeyword, IndexSearchActionKeyword, - QuickAccessActionKeyword, - + QuickAccessActionKeyword } - internal string GetActionKeyword(ActionKeyword actionKeyword) => - actionKeyword switch - { - ActionKeyword.SearchActionKeyword => SearchActionKeyword, - ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, - ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, - ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword, - ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword, - - _ - => throw new ArgumentOutOfRangeException( - nameof(actionKeyword), - actionKeyword, - "ActionKeyWord property not found" - ) - }; + internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch + { + ActionKeyword.SearchActionKeyword => SearchActionKeyword, + ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword, + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword, + ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") + }; - internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => - _ = actionKeyword switch - { - ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword, - ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, - ActionKeyword.FileContentSearchActionKeyword - => FileContentSearchActionKeyword = keyword, - ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, - ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword = keyword, + internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch + { + ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword, + ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword, + ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword, + ActionKeyword.QuickAccessActionKeyword => QuickAccessActionKeyword = keyword, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyWord property not found") + }; - _ - => throw new ArgumentOutOfRangeException( - nameof(actionKeyword), - actionKeyword, - "ActionKeyWord property not found" - ) - }; + internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => actionKeyword switch + { + ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, + ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, + ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled, + ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") + }; - internal bool GetActionKeywordEnabled(ActionKeyword actionKeyword) => - actionKeyword switch - { - ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled, - ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled, - ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled, - ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled, - ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled, - - _ - => throw new ArgumentOutOfRangeException( - nameof(actionKeyword), - actionKeyword, - "ActionKeyword enabled status not defined" - ) - }; - - internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => - _ = actionKeyword switch - { - ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, - ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, - ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable, - ActionKeyword.FileContentSearchActionKeyword - => FileContentSearchKeywordEnabled = enable, - ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled = enable, - - _ - => throw new ArgumentOutOfRangeException( - nameof(actionKeyword), - actionKeyword, - "ActionKeyword enabled status not defined" - ) - }; + internal void SetActionKeywordEnabled(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch + { + ActionKeyword.SearchActionKeyword => SearchActionKeywordEnabled = enable, + ActionKeyword.PathSearchActionKeyword => PathSearchKeywordEnabled = enable, + ActionKeyword.IndexSearchActionKeyword => IndexSearchKeywordEnabled = enable, + ActionKeyword.FileContentSearchActionKeyword => FileContentSearchKeywordEnabled = enable, + ActionKeyword.QuickAccessActionKeyword => QuickAccessKeywordEnabled = enable, + _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "ActionKeyword enabled status not defined") + }; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index 49e6d41a8..5aa6a13be 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -279,7 +279,7 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels new(Settings.ActionKeyword.IndexSearchActionKeyword, "plugin_explorer_actionkeywordview_indexsearch"), new(Settings.ActionKeyword.QuickAccessActionKeyword, - "plugin_explorer_actionkeywordview_quickaccess"), + "plugin_explorer_actionkeywordview_quickaccess") }; } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs index 247ed5779..829a2feed 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs @@ -98,7 +98,6 @@ namespace Flow.Launcher.Plugin.Explorer.Views } } - private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e) { if (e.DataObject.GetDataPresent(DataFormats.Text))