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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
new file mode 100644
index 000000000..b9e5373b7
--- /dev/null
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -0,0 +1,76 @@
+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
+{
+ ///
+ /// Interaction logic for ActionKeywordSetting.xaml
+ ///
+ public partial class ActionKeywordSetting : Window
+ {
+ private SettingsViewModel settingsViewModel;
+
+ private ActionKeywordView currentActionKeyword;
+
+ private List actionKeywordListView;
+
+ public ActionKeywordSetting(SettingsViewModel settingsViewModel, List actionKeywordListView, ActionKeywordView selectedActionKeyword)
+ {
+ InitializeComponent();
+
+ this.settingsViewModel = settingsViewModel;
+
+ currentActionKeyword = selectedActionKeyword;
+
+ txtCurrentActionKeyword.Text = selectedActionKeyword.Keyword;
+
+ this.actionKeywordListView = actionKeywordListView;
+ }
+
+ private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
+ {
+ var newActionKeyword = txtCurrentActionKeyword.Text;
+
+ if (string.IsNullOrEmpty(newActionKeyword))
+ return;
+
+ if (newActionKeyword == currentActionKeyword.Keyword)
+ {
+ Close();
+
+ return;
+ }
+
+ if(!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
+ {
+ settingsViewModel.UpdateActionKeyword(newActionKeyword, currentActionKeyword.Keyword);
+
+ actionKeywordListView.Where(x => x.Description == currentActionKeyword.Description).FirstOrDefault().Keyword = newActionKeyword;
+
+ Close();
+
+ return;
+ }
+
+ MessageBox.Show(settingsViewModel.Context.API.GetTranslation("newActionKeywordsHasBeenAssigned"));
+ }
+
+ private void OnCancelButtonClick(object sender, RoutedEventArgs e)
+ {
+ Close();
+
+ return;
+ }
+ }
+}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
index e4f220ed6..3b67b408d 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
@@ -20,6 +20,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public partial class ExplorerSettings
{
private readonly SettingsViewModel viewModel;
+
+ private List actionKeywordsListView;
+
public ExplorerSettings(SettingsViewModel viewModel)
{
InitializeComponent();
@@ -30,10 +33,19 @@ namespace Flow.Launcher.Plugin.Explorer.Views
lbxExcludedPaths.ItemsSource = this.viewModel.Settings.IndexSearchExcludedSubdirectoryPaths;
- var actionKeywordsListView = new List();
-
- 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 });
+ actionKeywordsListView = new List
+ {
+ new ActionKeywordView()
+ {
+ Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_search"),
+ Keyword = this.viewModel.Settings.SearchActionKeyword
+ },
+ new ActionKeywordView()
+ {
+ Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch"),
+ Keyword = this.viewModel.Settings.FileContentSearchActionKeyword
+ }
+ };
lbxActionKeywords.ItemsSource = actionKeywordsListView;
@@ -175,33 +187,46 @@ namespace Flow.Launcher.Plugin.Explorer.Views
private void btnEdit_Click(object sender, RoutedEventArgs e)
{
- var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink;
-
- if (selectedRow != null)
+ if (lbxActionKeywords.SelectedItem is ActionKeywordView)
{
- var folderBrowserDialog = new FolderBrowserDialog();
- folderBrowserDialog.SelectedPath = selectedRow.Path;
- if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
- {
- if (expFolderLinks.IsExpanded)
- {
- var link = viewModel.Settings.QuickFolderAccessLinks.First(x => x.Path == selectedRow.Path);
- link.Path = folderBrowserDialog.SelectedPath;
- }
+ var selectedActionKeyword = lbxActionKeywords.SelectedItem as ActionKeywordView;
- if (expExcludedPaths.IsExpanded)
- {
- var link = viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.First(x => x.Path == selectedRow.Path);
- link.Path = folderBrowserDialog.SelectedPath;
- }
- }
+ var actionKeywordWindow = new ActionKeywordSetting(viewModel, actionKeywordsListView, selectedActionKeyword);
+
+ actionKeywordWindow.ShowDialog();
RefreshView();
}
else
{
- string warning = viewModel.Context.API.GetTranslation("plugin_explorer_select_folder_link_warning");
- MessageBox.Show(warning);
+ var selectedRow = lbxFolderLinks.SelectedItem as FolderLink ?? lbxExcludedPaths.SelectedItem as FolderLink;
+
+ if (selectedRow != null)
+ {
+ var folderBrowserDialog = new FolderBrowserDialog();
+ folderBrowserDialog.SelectedPath = selectedRow.Path;
+ if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
+ {
+ if (expFolderLinks.IsExpanded)
+ {
+ var link = viewModel.Settings.QuickFolderAccessLinks.First(x => x.Path == selectedRow.Path);
+ link.Path = folderBrowserDialog.SelectedPath;
+ }
+
+ if (expExcludedPaths.IsExpanded)
+ {
+ var link = viewModel.Settings.IndexSearchExcludedSubdirectoryPaths.First(x => x.Path == selectedRow.Path);
+ link.Path = folderBrowserDialog.SelectedPath;
+ }
+ }
+
+ RefreshView();
+ }
+ else
+ {
+ string warning = viewModel.Context.API.GetTranslation("plugin_explorer_make_selection_warning");
+ MessageBox.Show(warning);
+ }
}
}