diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs
index e2c009ee3aa..7fe771253b0 100644
--- a/Flow.Launcher.Core/Plugin/PluginManager.cs
+++ b/Flow.Launcher.Core/Plugin/PluginManager.cs
@@ -274,7 +274,7 @@ public static void AddActionKeyword(string id, string newActionKeyword)
}
///
- /// used to add action keyword for multiple action keyword plugin
+ /// used to remove action keyword for multiple action keyword plugin
/// e.g. web search
///
public static void RemoveActionKeyword(string id, string oldActionkeyword)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index 3a1a1fb0597..71b16f159d6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -22,6 +22,8 @@
Index Search Activation:
Path Explore Activation:
File Content Search:
+ Index Only Search:
+ (Disabled)
Explorer
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 1cb82b75ff5..8082da1dc0d 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -26,6 +26,7 @@ private class PathEqualityComparator : IEqualityComparer
{
private static PathEqualityComparator instance;
public static PathEqualityComparator Instance => instance ??= new PathEqualityComparator();
+
public bool Equals(Result x, Result y)
{
return x.SubTitle == y.SubTitle;
@@ -46,25 +47,39 @@ internal async Task> SearchAsync(Query query, CancellationToken tok
var result = new HashSet(PathEqualityComparator.Instance);
- if (ActionKeywordMatch(query, settings.PathSearchActionKeyword))
+ if (ActionKeywordMatch(query, Settings.ActionKeyword.PathSearchActionKeyword) ||
+ ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword))
{
result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false));
}
- if (ActionKeywordMatch(query, settings.SearchActionKeyword) &&
- querySearch.Length > 0 &&
- !querySearch.IsLocationPathString())
+ if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexOnlySearchActionKeyword) ||
+ ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword)) &&
+ querySearch.Length > 0 &&
+ !querySearch.IsLocationPathString())
{
- result.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token).ConfigureAwait(false));
+ result.UnionWith(await WindowsIndexFilesAndFoldersSearchAsync(query, querySearch, token)
+ .ConfigureAwait(false));
}
return result.ToList();
}
- private bool ActionKeywordMatch(Query query, string actionKeyword)
+ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActionKeyword)
{
- return query.ActionKeyword == actionKeyword ||
- query.ActionKeyword.Length == 0 && actionKeyword == Query.GlobalPluginWildcardSign;
+ var keyword = query.ActionKeyword.Length == 0 ? "*" : query.ActionKeyword;
+
+ return allowedActionKeyword switch
+ {
+ Settings.ActionKeyword.SearchActionKeyword => settings.EnableSearchActionKeyword &&
+ keyword == settings.SearchActionKeyword,
+ Settings.ActionKeyword.PathSearchActionKeyword => settings.EnabledPathSearchKeyword &&
+ keyword == settings.PathSearchActionKeyword,
+ Settings.ActionKeyword.FileContentSearchActionKeyword => keyword ==
+ settings.FileContentSearchActionKeyword,
+ Settings.ActionKeyword.IndexOnlySearchActionKeyword => settings.EnabledIndexOnlySearchKeyword &&
+ keyword == settings.IndexOnlySearchActionKeyword
+ };
}
public async Task> PathSearchAsync(Query query, CancellationToken token = default)
@@ -118,7 +133,8 @@ public async Task> PathSearchAsync(Query query, CancellationToken t
return results.ToList();
}
- private async Task> WindowsIndexFileContentSearchAsync(Query query, string querySearchString, CancellationToken token)
+ private async Task> WindowsIndexFileContentSearchAsync(Query query, string querySearchString,
+ CancellationToken token)
{
var queryConstructor = new QueryConstructor(settings);
@@ -126,11 +142,11 @@ private async Task> WindowsIndexFileContentSearchAsync(Query query,
return new List();
return await IndexSearch.WindowsIndexSearchAsync(querySearchString,
- queryConstructor.CreateQueryHelper().ConnectionString,
- queryConstructor.QueryForFileContentSearch,
- settings.IndexSearchExcludedSubdirectoryPaths,
- query,
- token).ConfigureAwait(false);
+ queryConstructor.CreateQueryHelper().ConnectionString,
+ queryConstructor.QueryForFileContentSearch,
+ settings.IndexSearchExcludedSubdirectoryPaths,
+ query,
+ token).ConfigureAwait(false);
}
public bool IsFileContentSearch(string actionKeyword)
@@ -157,28 +173,30 @@ public async Task> TopLevelDirectorySearchBehaviourAsync(
return await windowsIndexSearch(query, querySearchString, token);
}
- private async Task> WindowsIndexFilesAndFoldersSearchAsync(Query query, string querySearchString, CancellationToken token)
+ private async Task> WindowsIndexFilesAndFoldersSearchAsync(Query query, string querySearchString,
+ CancellationToken token)
{
var queryConstructor = new QueryConstructor(settings);
return await IndexSearch.WindowsIndexSearchAsync(querySearchString,
- queryConstructor.CreateQueryHelper().ConnectionString,
- queryConstructor.QueryForAllFilesAndFolders,
- settings.IndexSearchExcludedSubdirectoryPaths,
- query,
- token).ConfigureAwait(false);
+ queryConstructor.CreateQueryHelper().ConnectionString,
+ queryConstructor.QueryForAllFilesAndFolders,
+ settings.IndexSearchExcludedSubdirectoryPaths,
+ query,
+ token).ConfigureAwait(false);
}
- private async Task> WindowsIndexTopLevelFolderSearchAsync(Query query, string path, CancellationToken token)
+ private async Task> WindowsIndexTopLevelFolderSearchAsync(Query query, string path,
+ CancellationToken token)
{
var queryConstructor = new QueryConstructor(settings);
return await IndexSearch.WindowsIndexSearchAsync(path,
- queryConstructor.CreateQueryHelper().ConnectionString,
- queryConstructor.QueryForTopLevelDirectorySearch,
- settings.IndexSearchExcludedSubdirectoryPaths,
- query,
- token).ConfigureAwait(false);
+ queryConstructor.CreateQueryHelper().ConnectionString,
+ queryConstructor.QueryForTopLevelDirectorySearch,
+ settings.IndexSearchExcludedSubdirectoryPaths,
+ query,
+ token).ConfigureAwait(false);
}
private bool UseWindowsIndexForDirectorySearch(string locationPath)
@@ -189,11 +207,11 @@ private bool UseWindowsIndexForDirectorySearch(string locationPath)
return false;
if (settings.IndexSearchExcludedSubdirectoryPaths
- .Any(x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory)
- .StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)))
+ .Any(x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory)
+ .StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)))
return false;
return IndexSearch.PathIsIndexed(pathToDirectory);
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index e078bca6781..790e57439f0 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -1,6 +1,9 @@
using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
+using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption;
+using System;
using System.Collections.Generic;
+using System.IO;
namespace Flow.Launcher.Plugin.Explorer
{
@@ -18,9 +21,57 @@ public class Settings
public List IndexSearchExcludedSubdirectoryPaths { get; set; } = new List();
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
+ public bool EnableSearchActionKeyword { get; set; } = true;
public string FileContentSearchActionKeyword { get; set; } = Constants.DefaultContentSearchActionKeyword;
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
+
+ public bool EnabledPathSearchKeyword { get; set; }
+
+ public string IndexOnlySearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
+
+ public bool EnabledIndexOnlySearchKeyword { get; set; }
+
+ internal enum ActionKeyword
+ {
+ SearchActionKeyword,
+ PathSearchActionKeyword,
+ FileContentSearchActionKeyword,
+ IndexOnlySearchActionKeyword
+ }
+
+ internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch
+ {
+ ActionKeyword.SearchActionKeyword => SearchActionKeyword,
+ ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
+ ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
+ ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword
+ };
+
+ internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
+ {
+ ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword,
+ ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
+ ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
+ ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword = keyword,
+ _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
+ };
+
+ internal bool? GetActionKeywordEnable(ActionKeyword actionKeyword) => actionKeyword switch
+ {
+ ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword,
+ ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword,
+ ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword,
+ _ => null
+ };
+
+ internal void SetActionKeywordEnable(ActionKeyword actionKeyword, bool enable) => _ = actionKeyword switch
+ {
+ ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword = enable,
+ ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword = enable,
+ ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword = enable,
+ _ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
+ };
}
}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
index 9d4019b9a57..3403fef3f79 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
@@ -41,24 +41,24 @@ internal void OpenWindowsIndexingOptions()
Process.Start(psi);
}
- internal void UpdateActionKeyword(ActionKeywordProperty modifiedActionKeyword, string newActionKeyword, string oldActionKeyword)
+ internal void UpdateActionKeyword(Settings.ActionKeyword modifiedActionKeyword, string newActionKeyword, string oldActionKeyword)
{
- if (Settings.SearchActionKeyword == Settings.PathSearchActionKeyword)
- PluginManager.AddActionKeyword(Context.CurrentPluginMetadata.ID, newActionKeyword);
- else
- PluginManager.ReplaceActionKeyword(Context.CurrentPluginMetadata.ID, oldActionKeyword, newActionKeyword);
+ PluginManager.ReplaceActionKeyword(Context.CurrentPluginMetadata.ID, oldActionKeyword, newActionKeyword);
switch (modifiedActionKeyword)
{
- case ActionKeywordProperty.SearchActionKeyword:
+ case Settings.ActionKeyword.SearchActionKeyword:
Settings.SearchActionKeyword = newActionKeyword;
break;
- case ActionKeywordProperty.PathSearchActionKeyword:
+ case Settings.ActionKeyword.PathSearchActionKeyword:
Settings.PathSearchActionKeyword = newActionKeyword;
break;
- case ActionKeywordProperty.FileContentSearchActionKeyword:
+ case Settings.ActionKeyword.FileContentSearchActionKeyword:
Settings.FileContentSearchActionKeyword = newActionKeyword;
break;
+ case Settings.ActionKeyword.IndexOnlySearchActionKeyword:
+ Settings.IndexOnlySearchActionKeyword = newActionKeyword;
+ break;
}
}
@@ -66,11 +66,4 @@ internal void UpdateActionKeyword(ActionKeywordProperty modifiedActionKeyword, s
internal bool IsNewActionKeywordGlobal(string newActionKeyword) => newActionKeyword == Query.GlobalPluginWildcardSign;
}
-
- public enum ActionKeywordProperty
- {
- SearchActionKeyword,
- PathSearchActionKeyword,
- FileContentSearchActionKeyword
- }
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
index 0e1c7e87265..52df61a5f4d 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
@@ -7,6 +7,7 @@
mc:Ignorable="d"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
+ DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="Action Keyword Setting" Height="200" Width="500">
@@ -16,15 +17,20 @@
+
-
-
-
+ HorizontalAlignment="Left"
+ Text="{Binding CurrentActionKeyword.Keyword}" />
+
+
@@ -33,4 +39,4 @@
Content="Cancel" />
-
+
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
index d1040f746fd..255dd1b3d9c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -1,16 +1,7 @@
using Flow.Launcher.Plugin.Explorer.ViewModels;
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
namespace Flow.Launcher.Plugin.Explorer.Views
{
@@ -21,32 +12,43 @@ public partial class ActionKeywordSetting : Window
{
private SettingsViewModel settingsViewModel;
- private ActionKeywordView currentActionKeyword;
-
+ public ActionKeywordView CurrentActionKeyword { get; set; }
private List actionKeywordListView;
- public ActionKeywordSetting(SettingsViewModel settingsViewModel, List actionKeywordListView, ActionKeywordView selectedActionKeyword)
- {
- InitializeComponent();
+ private Settings settings;
+ public Visibility Visible => CurrentActionKeyword.Enabled is not null ? Visibility.Visible : Visibility.Collapsed;
+
+ public ActionKeywordSetting(SettingsViewModel settingsViewModel,
+ List actionKeywordListView,
+ ActionKeywordView selectedActionKeyword, Settings settings)
+ {
this.settingsViewModel = settingsViewModel;
- currentActionKeyword = selectedActionKeyword;
+ this.settings = settings;
- txtCurrentActionKeyword.Text = selectedActionKeyword.Keyword;
+ CurrentActionKeyword = selectedActionKeyword;
this.actionKeywordListView = actionKeywordListView;
+
+ InitializeComponent();
+
}
private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
{
- var newActionKeyword = txtCurrentActionKeyword.Text;
+ var newActionKeyword = TxtCurrentActionKeyword.Text;
if (string.IsNullOrEmpty(newActionKeyword))
return;
- if (newActionKeyword == currentActionKeyword.Keyword)
+ // reset to global so it does not take up an action keyword when disabled
+ if (!CurrentActionKeyword.Enabled is not null && newActionKeyword != Query.GlobalPluginWildcardSign)
+ settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty,
+ Query.GlobalPluginWildcardSign, CurrentActionKeyword.Keyword);
+
+ if (newActionKeyword == CurrentActionKeyword.Keyword)
{
Close();
@@ -54,18 +56,30 @@ private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
}
if (settingsViewModel.IsNewActionKeywordGlobal(newActionKeyword)
- && currentActionKeyword.KeywordProperty == ActionKeywordProperty.FileContentSearchActionKeyword)
+ && CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword)
{
- MessageBox.Show(settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
+ MessageBox.Show(
+ settingsViewModel.Context.API.GetTranslation("plugin_explorer_globalActionKeywordInvalid"));
return;
}
if (!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
{
- settingsViewModel.UpdateActionKeyword(currentActionKeyword.KeywordProperty, newActionKeyword, currentActionKeyword.Keyword);
+ settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, newActionKeyword,
+ CurrentActionKeyword.Keyword);
+
+ actionKeywordListView.FirstOrDefault(x => x.Description == CurrentActionKeyword.Description).Keyword =
+ newActionKeyword;
+
+ // automatically help users set this to enabled if an action keyword is set and currently disabled
+ if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexOnlySearchActionKeyword
+ && !settings.EnabledIndexOnlySearchKeyword)
+ settings.EnabledIndexOnlySearchKeyword = true;
- actionKeywordListView.FirstOrDefault(x => x.Description == currentActionKeyword.Description).Keyword = newActionKeyword;
+ if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.PathSearchActionKeyword
+ && !settings.EnabledPathSearchKeyword)
+ settings.EnabledPathSearchKeyword = true;
Close();
@@ -82,4 +96,4 @@ private void OnCancelButtonClick(object sender, RoutedEventArgs e)
return;
}
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
index ce6dbba36b0..50171a363d9 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
@@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels"
+ xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
@@ -17,13 +18,16 @@
Text="{Binding Path, Mode=OneTime}"
Margin="0,5,0,5" />
-
+
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
index b8c9a605a28..d5f6386f24f 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
@@ -35,28 +35,20 @@ public ExplorerSettings(SettingsViewModel viewModel)
actionKeywordsListView = new List
{
- new ()
- {
- Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_search"),
- Keyword = this.viewModel.Settings.SearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.SearchActionKeyword
- },
- new ()
- {
- Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch"),
- Keyword = this.viewModel.Settings.FileContentSearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.FileContentSearchActionKeyword
- },
- new ()
- {
- Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path"),
- Keyword = this.viewModel.Settings.PathSearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.PathSearchActionKeyword
- }
+ new(Settings.ActionKeyword.SearchActionKeyword,
+ viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_search")),
+ new(Settings.ActionKeyword.FileContentSearchActionKeyword,
+ viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch")),
+ new(Settings.ActionKeyword.PathSearchActionKeyword,
+ viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path")),
+ new(Settings.ActionKeyword.IndexOnlySearchActionKeyword,
+ viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch"))
};
lbxActionKeywords.ItemsSource = actionKeywordsListView;
+ ActionKeywordView.Init(viewModel.Settings, viewModel.Context.API);
+
RefreshView();
}
@@ -80,8 +72,8 @@ public void RefreshView()
btnEdit.Visibility = Visibility.Visible;
if (lbxAccessLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0
- && btnDelete.Visibility == Visibility.Visible
- && btnEdit.Visibility == Visibility.Visible)
+ && btnDelete.Visibility == Visibility.Visible
+ && btnEdit.Visibility == Visibility.Visible)
{
btnDelete.Visibility = Visibility.Hidden;
btnEdit.Visibility = Visibility.Hidden;
@@ -173,7 +165,8 @@ private void btnDelete_Click(object sender, RoutedEventArgs e)
if (selectedRow != null)
{
- string msg = string.Format(viewModel.Context.API.GetTranslation("plugin_explorer_delete_folder_link"), selectedRow.Path);
+ string msg = string.Format(viewModel.Context.API.GetTranslation("plugin_explorer_delete_folder_link"),
+ selectedRow.Path);
if (MessageBox.Show(msg, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
@@ -199,7 +192,8 @@ private void btnEdit_Click(object sender, RoutedEventArgs e)
{
var selectedActionKeyword = lbxActionKeywords.SelectedItem as ActionKeywordView;
- var actionKeywordWindow = new ActionKeywordSetting(viewModel, actionKeywordsListView, selectedActionKeyword);
+ var actionKeywordWindow = new ActionKeywordSetting(viewModel, actionKeywordsListView,
+ selectedActionKeyword, viewModel.Settings);
actionKeywordWindow.ShowDialog();
@@ -207,7 +201,8 @@ private void btnEdit_Click(object sender, RoutedEventArgs e)
}
else
{
- var selectedRow = lbxAccessLinks.SelectedItem as AccessLink ?? lbxExcludedPaths.SelectedItem as AccessLink;
+ var selectedRow = lbxAccessLinks.SelectedItem as AccessLink ??
+ lbxExcludedPaths.SelectedItem as AccessLink;
if (selectedRow != null)
{
@@ -223,7 +218,8 @@ private void btnEdit_Click(object sender, RoutedEventArgs e)
if (expExcludedPaths.IsExpanded)
{
- var link = viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.First(x => x.Path == selectedRow.Path);
+ var link = viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.First(x =>
+ x.Path == selectedRow.Path);
link.Path = folderBrowserDialog.SelectedPath;
}
}
@@ -243,10 +239,7 @@ private void btnAdd_Click(object sender, RoutedEventArgs e)
var folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
- var newAccessLink = new AccessLink
- {
- Path = folderBrowserDialog.SelectedPath
- };
+ var newAccessLink = new AccessLink {Path = folderBrowserDialog.SelectedPath};
AddAccessLink(newAccessLink);
}
@@ -267,10 +260,7 @@ private void lbxAccessLinks_Drop(object sender, DragEventArgs e)
{
if (Directory.Exists(s))
{
- var newFolderLink = new AccessLink
- {
- Path = s
- };
+ var newFolderLink = new AccessLink {Path = s};
AddAccessLink(newFolderLink);
}
@@ -283,7 +273,7 @@ private void lbxAccessLinks_Drop(object sender, DragEventArgs e)
private void AddAccessLink(AccessLink newAccessLink)
{
if (expAccessLinks.IsExpanded
- && !viewModel.Settings.QuickAccessLinks.Any(x => x.Path == newAccessLink.Path))
+ && !viewModel.Settings.QuickAccessLinks.Any(x => x.Path == newAccessLink.Path))
{
if (viewModel.Settings.QuickAccessLinks == null)
viewModel.Settings.QuickAccessLinks = new List();
@@ -321,9 +311,37 @@ private void btnOpenIndexingOptions_Click(object sender, RoutedEventArgs e)
public class ActionKeywordView
{
- public string Description { get; set; }
+ private static Settings _settings;
+ private static IPublicAPI _api;
+
+ public static void Init(Settings settings, IPublicAPI api)
+ {
+ _settings = settings;
+ _api = api;
+ }
- public ActionKeywordProperty KeywordProperty { get; init; }
- public string Keyword { get; set; }
+ internal ActionKeywordView(Settings.ActionKeyword actionKeyword, string description)
+ {
+ KeywordProperty = actionKeyword;
+ Description = description;
+ }
+
+ public string Description { get; private init; }
+ public string Color => Enabled ?? true ? "Black" : "Gray";
+
+ internal Settings.ActionKeyword KeywordProperty { get; }
+
+ public string Keyword
+ {
+ get => _settings.GetActionKeyword(KeywordProperty);
+ set => _settings.SetActionKeyword(KeywordProperty, value);
+ }
+
+ public bool? Enabled
+ {
+ get => _settings.GetActionKeywordEnable(KeywordProperty);
+ set => _settings.SetActionKeywordEnable(KeywordProperty,
+ value ?? throw new ArgumentException("Unexpected null value"));
+ }
}
-}
+}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
index 6be1ed95d45..0b46f9fd7af 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json
@@ -1,8 +1,10 @@
{
"ID": "572be03c74c642baae319fc283e561a8",
"ActionKeywords": [
- "*",
- "doc:"
+ "*",
+ "doc:",
+ "*",
+ "*"
],
"Name": "Explorer",
"Description": "Search and manage files and folders. Explorer utilises Windows Index Search",