From 3111271a16898d689b8b7485fadbc45a18ff2db6 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 12 Jul 2020 21:51:30 +1000 Subject: [PATCH 01/16] add file content search unit tests --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index 0a1dece4fc3..cfdafa53888 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -184,6 +184,39 @@ public void GivenTopLevelDirectorySearch_WhenIndexSearchNotRequired_ThenSearchMe $"Actual number of results is {results.Count} {Environment.NewLine}"); } + [TestCase(@"some words", @"FREETEXT('some words')")] + public void GivenWindowsIndexSearch_WhenQueryWhereRestrictionsIsForFileContentSearch_ThenShouldReturnFreeTextString( + string querySearchString, string expectedString) + { + // Given + var queryConstructor = new QueryConstructor(new Settings()); + + //When + var resultString = queryConstructor.QueryWhereRestrictionsForFileContentSearch(querySearchString); + + // Then + Assert.IsTrue(resultString == expectedString, + $"Expected QueryWhereRestrictions string: {expectedString}{Environment.NewLine} " + + $"Actual string was: {resultString}{Environment.NewLine}"); + } + + [TestCase("some words", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType " + + "FROM SystemIndex WHERE FREETEXT('some words') AND scope='file:'")] + public void GivenWindowsIndexSearch_WhenSearchForFileContent_ThenQueryShouldUseExpectedString( + string userSearchString, string expectedString) + { + // Given + var queryConstructor = new QueryConstructor(new Settings()); + + //When + var resultString = queryConstructor.QueryForFileContentSearch(userSearchString); + + // Then + Assert.IsTrue(resultString == expectedString, + $"Expected query string: {expectedString}{Environment.NewLine} " + + $"Actual string was: {resultString}{Environment.NewLine}"); + } + [TestCase(@"c:\\", false)] [TestCase(@"i:\", true)] [TestCase(@"\c:\", false)] From 08bfa8da9c9279e707c55f45b50b01df65968494 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 12 Jul 2020 22:41:01 +1000 Subject: [PATCH 02/16] add unit test for determining file content search --- Flow.Launcher.Test/Plugins/ExplorerTest.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Flow.Launcher.Test/Plugins/ExplorerTest.cs b/Flow.Launcher.Test/Plugins/ExplorerTest.cs index cfdafa53888..2eef1ce7fc8 100644 --- a/Flow.Launcher.Test/Plugins/ExplorerTest.cs +++ b/Flow.Launcher.Test/Plugins/ExplorerTest.cs @@ -217,6 +217,21 @@ public void GivenWindowsIndexSearch_WhenSearchForFileContent_ThenQueryShouldUseE $"Actual string was: {resultString}{Environment.NewLine}"); } + [TestCase("content:some words")] + public void GivenQuery_WhenFileContentSearchHotkeyIsIncluded_ThenShouldReturnTrue(string querySearchString) + { + // Given + var searchManager = new SearchManager(new Settings(), new PluginInitContext()); + + // When + var result = searchManager.IsFileContentSearch(querySearchString); + + // Then + Assert.IsTrue(result, + $"Expected True for file content search. {Environment.NewLine} " + + $"Actual result was: {result}{Environment.NewLine}"); + } + [TestCase(@"c:\\", false)] [TestCase(@"i:\", true)] [TestCase(@"\c:\", false)] From 8abd97d523c4ca853d1207ccd96e91d8523931a5 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 12 Jul 2020 22:43:38 +1000 Subject: [PATCH 03/16] add file content search to Index Search --- .../Search/Constants.cs | 2 ++ .../Search/SearchManager.cs | 27 +++++++++++++++++++ .../Search/WindowsIndex/QueryConstructor.cs | 18 +++++++++++++ 3 files changed, 47 insertions(+) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs index d474fb0e78d..e61165c3d58 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs @@ -25,5 +25,7 @@ internal static class Constants internal const char DirectorySeperator = '\\'; internal const string WindowsIndexingOptions = "srchadmin.dll"; + + internal const string WindowsIndexFileContentSearchHotkey = "content:"; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index f814962ba76..631dd0c318f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -42,6 +42,9 @@ internal List Search(Query query) if (string.IsNullOrEmpty(querySearch)) return results; + if (IsFileContentSearch(querySearch)) + return WindowsIndexFileContentSearch(query, querySearch); + var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch); if (isEnvironmentVariable) @@ -74,6 +77,30 @@ internal List Search(Query query) return results; } + private List WindowsIndexFileContentSearch(Query query, string querySearchString) + { + var queryConstructor = new QueryConstructor(settings); + + var updatedQuerySearchString = querySearchString + .Substring(querySearchString + .IndexOf(Constants.WindowsIndexFileContentSearchHotkey) + + Constants.WindowsIndexFileContentSearchHotkey.Length); + + if (string.IsNullOrEmpty(updatedQuerySearchString)) + return new List(); + + return indexSearch.WindowsIndexSearch(updatedQuerySearchString.TrimStart(), + queryConstructor.CreateQueryHelper().ConnectionString, + queryConstructor.QueryForFileContentSearch, + query); + } + + public bool IsFileContentSearch(string querySearch) + { + return querySearch.StartsWith(Constants.WindowsIndexFileContentSearchHotkey, + StringComparison.OrdinalIgnoreCase); + } + private List DirectoryInfoClassSearch(Query query, string querySearch) { var directoryInfoSearch = new DirectoryInfoSearch(context); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs index f4480eea7a0..393c1514dd5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/QueryConstructor.cs @@ -117,5 +117,23 @@ public string QueryWhereRestrictionsForAllFilesAndFoldersSearch() { return $"scope='file:'"; } + + /// + /// Search will be performed on all indexed file contents for the specified search keywords. + /// + public string QueryForFileContentSearch(string userSearchString) + { + string query = "SELECT TOP " + settings.MaxResult + $" {CreateBaseQuery().QuerySelectColumns} FROM {SystemIndex} WHERE "; + + return query + QueryWhereRestrictionsForFileContentSearch(userSearchString) + " AND " + QueryWhereRestrictionsForAllFilesAndFoldersSearch(); + } + + /// + /// Set the required WHERE clause restriction to search within file content. + /// + public string QueryWhereRestrictionsForFileContentSearch(string searchQuery) + { + return $"FREETEXT('{searchQuery}')"; + } } } From 0f0bde90166a9c49879a4f0d976bac714c4f583c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Mon, 13 Jul 2020 09:03:25 +1000 Subject: [PATCH 04/16] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ac9a3aab30f..b5323a3b486 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Flow Launcher. Dedicated to make your workflow flow more seamlessly. Aimed at be ![The Flow](https://user-images.githubusercontent.com/26427004/82151677-fa9c7100-989f-11ea-9143-81de60aaf07d.gif) - Search everything from applications, files, bookmarks, YouTube, Twitter and more. All from the comfort of your keyboard without ever touching the mouse. +- Search for file contents - Support search using environment variable paths - Run batch and PowerShell commands as Administrator or a different user. - Support languages from Chinese to Italian and more. From ca835266b7e258b99800f3882d095b395d1c93d5 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 15 Jul 2020 05:49:26 +1000 Subject: [PATCH 05/16] version bump Explorer plugin --- Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json index 91b27edb168..061fcfece41 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -4,7 +4,7 @@ "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", - "Version": "1.1.0", + "Version": "1.2.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Explorer.dll", From a1e371b7e85450dc7b28e27dab5d7e648173086c Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 15 Jul 2020 05:50:48 +1000 Subject: [PATCH 06/16] add multi-ActionKeywords for Explorer --- Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 6 ++++++ Plugins/Flow.Launcher.Plugin.Explorer/plugin.json | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs index d4bfdbbfcab..4e62b3cba2a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs @@ -17,5 +17,11 @@ public class Settings [JsonProperty] public List IndexSearchExcludedSubdirectoryPaths { get; set; } = new List(); + + [JsonProperty] + public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign; + + [JsonProperty] + public string FileContentSearchActionKeyword { get; set; } = "doc:"; } } \ 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 061fcfece41..4f5a12496f5 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Explorer/plugin.json @@ -1,6 +1,9 @@ { "ID": "572be03c74c642baae319fc283e561a8", - "ActionKeyword": "*", + "ActionKeywords": [ + "*", + "doc:" + ], "Name": "Explorer", "Description": "Search and manage files and folders. Explorer utilises Windows Index Search", "Author": "Jeremy Wu", From ace9dc7f2ca806edabf60516c2298809bd8cef16 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 15 Jul 2020 05:52:01 +1000 Subject: [PATCH 07/16] update old hotkey trigger to use ActionKeyword --- .../Search/Constants.cs | 2 -- .../Search/SearchManager.cs | 16 +++++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs index 9664ad09ba0..db2eaa72291 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs @@ -28,7 +28,5 @@ internal static class Constants internal static string ExplorerIconImageFullPath => Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString()) + "\\" + ExplorerIconImagePath; - - internal const string WindowsIndexFileContentSearchHotkey = "content:"; } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 631dd0c318f..a2b5cfa1f23 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -42,7 +42,7 @@ internal List Search(Query query) if (string.IsNullOrEmpty(querySearch)) return results; - if (IsFileContentSearch(querySearch)) + if (IsFileContentSearch(query.ActionKeyword)) return WindowsIndexFileContentSearch(query, querySearch); var isEnvironmentVariable = EnvironmentVariables.IsEnvironmentVariableSearch(querySearch); @@ -81,24 +81,18 @@ private List WindowsIndexFileContentSearch(Query query, string querySear { var queryConstructor = new QueryConstructor(settings); - var updatedQuerySearchString = querySearchString - .Substring(querySearchString - .IndexOf(Constants.WindowsIndexFileContentSearchHotkey) - + Constants.WindowsIndexFileContentSearchHotkey.Length); - - if (string.IsNullOrEmpty(updatedQuerySearchString)) + if (string.IsNullOrEmpty(querySearchString)) return new List(); - return indexSearch.WindowsIndexSearch(updatedQuerySearchString.TrimStart(), + return indexSearch.WindowsIndexSearch(querySearchString, queryConstructor.CreateQueryHelper().ConnectionString, queryConstructor.QueryForFileContentSearch, query); } - public bool IsFileContentSearch(string querySearch) + public bool IsFileContentSearch(string actionKeyword) { - return querySearch.StartsWith(Constants.WindowsIndexFileContentSearchHotkey, - StringComparison.OrdinalIgnoreCase); + return actionKeyword == settings.FileContentSearchActionKeyword; } private List DirectoryInfoClassSearch(Query query, string querySearch) From 7ad0071117584a3ba87b750abc4a1590549796d1 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Wed, 15 Jul 2020 06:14:52 +1000 Subject: [PATCH 08/16] quick folder links triggering when search action keyword is used --- Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index a2b5cfa1f23..6c0d186f169 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -36,7 +36,7 @@ internal List Search(Query query) var quickFolderLinks = quickFolderAccess.FolderList(query, settings.QuickFolderAccessLinks, context); - if (quickFolderLinks.Count > 0) + if (quickFolderLinks.Count > 0 && query.ActionKeyword == settings.SearchActionKeyword) return quickFolderLinks; if (string.IsNullOrEmpty(querySearch)) From bad007c00886d405a0c7ab41351079a5f71e406d Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Thu, 16 Jul 2020 21:45:08 +1000 Subject: [PATCH 09/16] show Explorer action keywords on UI --- .../Languages/en.xaml | 4 ++-- .../Views/ExplorerSettings.xaml | 18 +++++++++++++++- .../Views/ExplorerSettings.xaml.cs | 21 +++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 01bd1a60fa1..431a4143841 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -1,4 +1,4 @@ - @@ -13,11 +13,11 @@ Delete Edit Add + Customise Action Keywords Quick Folder Access Paths Index Search Excluded Paths Indexing Options - Explorer Search and manage files and folders. Explorer utilises Windows Index Search diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index 5ba1a063bd9..dc9d8377137 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -17,6 +17,16 @@ Text="{Binding Nickname, Mode=OneTime}" Margin="0,5,0,5" /> + + + + + + @@ -25,8 +35,14 @@ + + + + Expanded="expFolderLinks_Click" Collapsed="expFolderLinks_Click" + Margin="0 10 0 0"> (); + + actionKeywordsListView.Add(new ActionKeywordView() { Description = "Search Activation:", Keyword = this.viewModel.Settings.SearchActionKeyword }); + actionKeywordsListView.Add(new ActionKeywordView() { Description = "File Content Search:", Keyword = this.viewModel.Settings.FileContentSearchActionKeyword }); + + lbxActionKeywords.ItemsSource = actionKeywordsListView; + RefreshView(); } @@ -77,6 +84,13 @@ public void RefreshView() lbxFolderLinks.Items.Refresh(); lbxExcludedPaths.Items.Refresh(); + + lbxActionKeywords.Items.Refresh(); + } + + private void expActionKeywords_Click(object sender, RoutedEventArgs e) + { + } private void expFolderLinks_Click(object sender, RoutedEventArgs e) @@ -242,4 +256,11 @@ private void btnOpenIndexingOptions_Click(object sender, RoutedEventArgs e) viewModel.OpenWindowsIndexingOptions(); } } + + public class ActionKeywordView + { + public string Description { get; set; } + + public string Keyword { get; set; } + } } From fad4f5b5c9f819a4b917c55e9c6ad397cc418401 Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Fri, 17 Jul 2020 21:14:15 +1000 Subject: [PATCH 10/16] fix clicking twice to expand issue event was wired to the same expand method cause calling it twice --- .../Views/ExplorerSettings.xaml | 8 ++++---- .../Views/ExplorerSettings.xaml.cs | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml index dc9d8377137..9d6f4976e9a 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml @@ -1,4 +1,4 @@ - + Expanded="expActionKeywords_Click" Collapsed="expActionKeywords_Collapsed"> Date: Fri, 17 Jul 2020 21:15:00 +1000 Subject: [PATCH 11/16] add behaviour for Customise Action Keyword UI --- .../Views/ExplorerSettings.xaml.cs | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs index 51c0cc90544..e4f220ed68f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs @@ -50,9 +50,14 @@ public void RefreshView() btnEdit.Visibility = Visibility.Hidden; btnAdd.Visibility = Visibility.Hidden; - if (expFolderLinks.IsExpanded || expExcludedPaths.IsExpanded) + if (expFolderLinks.IsExpanded || expExcludedPaths.IsExpanded || expActionKeywords.IsExpanded) { - btnAdd.Visibility = Visibility.Visible; + if (!expActionKeywords.IsExpanded) + btnAdd.Visibility = Visibility.Visible; + + if (expActionKeywords.IsExpanded + && btnEdit.Visibility == Visibility.Hidden) + btnEdit.Visibility = Visibility.Visible; if ((lbxFolderLinks.Items.Count == 0 && lbxExcludedPaths.Items.Count == 0) && btnDelete.Visibility == Visibility.Visible @@ -90,7 +95,16 @@ public void RefreshView() private void expActionKeywords_Click(object sender, RoutedEventArgs e) { + if (expActionKeywords.IsExpanded) + expActionKeywords.Height = 215; + + if (expExcludedPaths.IsExpanded) + expExcludedPaths.IsExpanded = false; + if (expFolderLinks.IsExpanded) + expFolderLinks.IsExpanded = false; + + RefreshView(); } private void expActionKeywords_Collapsed(object sender, RoutedEventArgs e) @@ -102,13 +116,13 @@ private void expActionKeywords_Collapsed(object sender, RoutedEventArgs e) private void expFolderLinks_Click(object sender, RoutedEventArgs e) { if (expFolderLinks.IsExpanded) - expFolderLinks.Height = 235; - - if (!expFolderLinks.IsExpanded) - expFolderLinks.Height = Double.NaN; + expFolderLinks.Height = 215; if (expExcludedPaths.IsExpanded) expExcludedPaths.IsExpanded = false; + + if (expActionKeywords.IsExpanded) + expActionKeywords.IsExpanded = false; RefreshView(); } @@ -127,6 +141,9 @@ private void expExcludedPaths_Click(object sender, RoutedEventArgs e) if (expFolderLinks.IsExpanded) expFolderLinks.IsExpanded = false; + if (expActionKeywords.IsExpanded) + expActionKeywords.IsExpanded = false; + RefreshView(); } From e37d976d04860ac73317dc0560a74cbc07e731ec Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 19 Jul 2020 00:12:11 +1000 Subject: [PATCH 12/16] add option for user to customise Explorer's Action Keywords ui + backend logic --- .../Flow.Launcher.Plugin.Explorer.csproj | 1 + .../Languages/en.xaml | 3 + .../ViewModels/SettingsViewModel.cs | 16 +++- .../Views/ActionKeywordSetting.xaml | 36 +++++++++ .../Views/ActionKeywordSetting.xaml.cs | 76 +++++++++++++++++++ .../Views/ExplorerSettings.xaml.cs | 73 ++++++++++++------ 6 files changed, 180 insertions(+), 25 deletions(-) create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml create mode 100644 Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs 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 bd2a047eb46..efa5339b4d9 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj @@ -104,6 +104,7 @@ + diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 431a4143841..b7710d3324b 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -3,6 +3,7 @@ xmlns:system="clr-namespace:System;assembly=mscorlib"> + Please make a selection first Please select a folder link Are you sure you want to delete {0}? Are you sure you want to permanently delete this {0}? @@ -17,6 +18,8 @@ Quick Folder Access Paths Index Search Excluded Paths Indexing Options + Search Activation: + File Content Search: Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs index a5e81716a63..e14a6ebb54e 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs @@ -1,4 +1,5 @@ -using Flow.Launcher.Infrastructure.Storage; +using Flow.Launcher.Core.Plugin; +using Flow.Launcher.Infrastructure.Storage; using Flow.Launcher.Plugin.Explorer.Search; using Flow.Launcher.Plugin.Explorer.Search.FolderLinks; using System.Diagnostics; @@ -40,5 +41,18 @@ internal void OpenWindowsIndexingOptions() Process.Start(psi); } + + internal void UpdateActionKeyword(string newActionKeyword, string oldActionKeyword) + { + PluginManager.ReplaceActionKeyword(Context.CurrentPluginMetadata.ID, oldActionKeyword, newActionKeyword); + + if (Settings.FileContentSearchActionKeyword == oldActionKeyword) + Settings.FileContentSearchActionKeyword = newActionKeyword; + + if (Settings.SearchActionKeyword == oldActionKeyword) + Settings.SearchActionKeyword = newActionKeyword; + } + + internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword); } } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml new file mode 100644 index 00000000000..0e1c7e87265 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + +