From e37d976d04860ac73317dc0560a74cbc07e731ec Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sun, 19 Jul 2020 00:12:11 +1000 Subject: [PATCH] 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 bd2a047eb..efa5339b4 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 431a41438..b7710d332 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 a5e81716a..e14a6ebb5 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 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels 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 000000000..0e1c7e872 --- /dev/null +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + +