removed obsolete api object, updated search action keyword naming,

This commit is contained in:
Jeremy 2021-06-05 14:07:13 +10:00
parent 002c27fc12
commit f13e24bd07
6 changed files with 18 additions and 21 deletions

View file

@ -19,11 +19,10 @@
<system:String x:Key="plugin_explorer_quickaccesslinks_header">Quick Access Links</system:String>
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_search">Index Search Activation:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_path">Path Explore Activation:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_search">Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_path">Path Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_filecontentsearch">File Content Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_indexonlysearch">Index Only Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_brackets_disabled">(Disabled)</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_indexonlysearch">Index Search:</system:String>
<!--Plugin Infos-->
<system:String x:Key="plugin_explorer_plugin_name">Explorer</system:String>

View file

@ -53,7 +53,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false));
}
if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexOnlySearchActionKeyword) ||
if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexSearchActionKeyword) ||
ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword)) &&
querySearch.Length > 0 &&
!querySearch.IsLocationPathString())
@ -77,8 +77,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
keyword == settings.PathSearchActionKeyword,
Settings.ActionKeyword.FileContentSearchActionKeyword => keyword ==
settings.FileContentSearchActionKeyword,
Settings.ActionKeyword.IndexOnlySearchActionKeyword => settings.EnabledIndexOnlySearchKeyword &&
keyword == settings.IndexOnlySearchActionKeyword
Settings.ActionKeyword.IndexSearchActionKeyword => settings.EnabledIndexOnlySearchKeyword &&
keyword == settings.IndexSearchActionKeyword
};
}

View file

@ -29,7 +29,7 @@ namespace Flow.Launcher.Plugin.Explorer
public bool EnabledPathSearchKeyword { get; set; }
public string IndexOnlySearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public string IndexSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
public bool EnabledIndexOnlySearchKeyword { get; set; }
@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer
SearchActionKeyword,
PathSearchActionKeyword,
FileContentSearchActionKeyword,
IndexOnlySearchActionKeyword
IndexSearchActionKeyword
}
internal string GetActionKeyword(ActionKeyword actionKeyword) => actionKeyword switch
@ -46,7 +46,7 @@ namespace Flow.Launcher.Plugin.Explorer
ActionKeyword.SearchActionKeyword => SearchActionKeyword,
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword,
ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword
};
internal void SetActionKeyword(ActionKeyword actionKeyword, string keyword) => _ = actionKeyword switch
@ -54,7 +54,7 @@ namespace Flow.Launcher.Plugin.Explorer
ActionKeyword.SearchActionKeyword => SearchActionKeyword = keyword,
ActionKeyword.PathSearchActionKeyword => PathSearchActionKeyword = keyword,
ActionKeyword.FileContentSearchActionKeyword => FileContentSearchActionKeyword = keyword,
ActionKeyword.IndexOnlySearchActionKeyword => IndexOnlySearchActionKeyword = keyword,
ActionKeyword.IndexSearchActionKeyword => IndexSearchActionKeyword = keyword,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
};
@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword,
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword,
ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword,
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword,
_ => null
};
@ -70,7 +70,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
ActionKeyword.SearchActionKeyword => EnableSearchActionKeyword = enable,
ActionKeyword.PathSearchActionKeyword => EnabledPathSearchKeyword = enable,
ActionKeyword.IndexOnlySearchActionKeyword => EnabledIndexOnlySearchKeyword = enable,
ActionKeyword.IndexSearchActionKeyword => EnabledIndexOnlySearchKeyword = enable,
_ => throw new ArgumentOutOfRangeException(nameof(actionKeyword), actionKeyword, "Unexpected property")
};
}

View file

@ -56,8 +56,8 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
case Settings.ActionKeyword.FileContentSearchActionKeyword:
Settings.FileContentSearchActionKeyword = newActionKeyword;
break;
case Settings.ActionKeyword.IndexOnlySearchActionKeyword:
Settings.IndexOnlySearchActionKeyword = newActionKeyword;
case Settings.ActionKeyword.IndexSearchActionKeyword:
Settings.IndexSearchActionKeyword = newActionKeyword;
break;
}
}

View file

@ -73,7 +73,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
newActionKeyword;
// automatically help users set this to enabled if an action keyword is set and currently disabled
if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexOnlySearchActionKeyword
if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexSearchActionKeyword
&& !settings.EnabledIndexOnlySearchKeyword)
settings.EnabledIndexOnlySearchKeyword = true;

View file

@ -41,13 +41,13 @@ namespace Flow.Launcher.Plugin.Explorer.Views
viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch")),
new(Settings.ActionKeyword.PathSearchActionKeyword,
viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path")),
new(Settings.ActionKeyword.IndexOnlySearchActionKeyword,
new(Settings.ActionKeyword.IndexSearchActionKeyword,
viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch"))
};
lbxActionKeywords.ItemsSource = actionKeywordsListView;
ActionKeywordView.Init(viewModel.Settings, viewModel.Context.API);
ActionKeywordView.Init(viewModel.Settings);
RefreshView();
}
@ -312,12 +312,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public class ActionKeywordView
{
private static Settings _settings;
private static IPublicAPI _api;
public static void Init(Settings settings, IPublicAPI api)
public static void Init(Settings settings)
{
_settings = settings;
_api = api;
}
internal ActionKeywordView(Settings.ActionKeyword actionKeyword, string description)