revert bad changes

This commit is contained in:
Koisu 2025-06-23 19:17:38 -07:00
parent e12c2be419
commit efe65956cc
5 changed files with 78 additions and 138 deletions

View file

@ -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)

View file

@ -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 =>

View file

@ -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<AccessLink> QuickAccessLinks { get; set; } = new();
public ObservableCollection<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } =
new ObservableCollection<AccessLink>();
public ObservableCollection<AccessLink> IndexSearchExcludedSubdirectoryPaths { get; set; } = new ObservableCollection<AccessLink>();
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")
};
}
}

View file

@ -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")
};
}

View file

@ -98,7 +98,6 @@ namespace Flow.Launcher.Plugin.Explorer.Views
}
}
private void TextBox_Pasting(object sender, DataObjectPastingEventArgs e)
{
if (e.DataObject.GetDataPresent(DataFormats.Text))