From a07d6aa1e7616063f93e7dc23f5c802c300ac96d Mon Sep 17 00:00:00 2001 From: bao-qian Date: Wed, 4 Nov 2015 22:49:40 +0000 Subject: [PATCH] Enable multiple action keywords See issue #352 --- Plugins/Wox.Plugin.CMD/CMD.cs | 7 +---- .../Wox.Plugin.WebSearch/Languages/en.xaml | 2 +- Plugins/Wox.Plugin.WebSearch/WebSearch.cs | 2 +- .../{WebQueryPlugin.cs => WebSearchPlugin.cs} | 20 ++----------- .../WebSearchSetting.xaml.cs | 10 +++---- .../Wox.Plugin.WebSearch/WebSearchStorage.cs | 6 ++-- .../WebSearchesSetting.xaml | 2 +- .../Wox.Plugin.WebSearch.csproj | 5 ++-- Plugins/Wox.Plugin.WebSearch/plugin.json | 2 +- Wox.Core/Plugin/PluginConfig.cs | 9 ++++-- Wox.Core/Plugin/PluginManager.cs | 29 +++++-------------- .../UserSettings/CustomizedPluginConfig.cs | 3 +- Wox.Plugin/Feature.cs | 2 ++ Wox.Plugin/PluginMetadata.cs | 4 +++ Wox.Plugin/Query.cs | 16 +++++----- ...ActionKeyword.xaml => ActionKeywords.xaml} | 6 ++-- ...Keyword.xaml.cs => ActionKeywords.xaml.cs} | 20 ++++++++----- Wox/App.xaml.cs | 2 +- Wox/Languages/en.xaml | 8 ++--- Wox/Languages/ru.xaml | 8 ++--- Wox/Languages/zh-cn.xaml | 8 ++--- Wox/Languages/zh-tw.xaml | 8 ++--- Wox/SettingWindow.xaml | 4 +-- Wox/SettingWindow.xaml.cs | 15 +++++----- Wox/Wox.csproj | 9 +++--- 25 files changed, 95 insertions(+), 112 deletions(-) rename Plugins/Wox.Plugin.WebSearch/{WebQueryPlugin.cs => WebSearchPlugin.cs} (87%) rename Wox/{ActionKeyword.xaml => ActionKeywords.xaml} (94%) rename Wox/{ActionKeyword.xaml.cs => ActionKeywords.xaml.cs} (71%) diff --git a/Plugins/Wox.Plugin.CMD/CMD.cs b/Plugins/Wox.Plugin.CMD/CMD.cs index de76413c52..0cd255bc37 100644 --- a/Plugins/Wox.Plugin.CMD/CMD.cs +++ b/Plugins/Wox.Plugin.CMD/CMD.cs @@ -12,7 +12,7 @@ using Control = System.Windows.Controls.Control; namespace Wox.Plugin.CMD { - public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery, IContextMenu + public class CMD : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IContextMenu { private PluginInitContext context; private bool WinRStroked; @@ -202,11 +202,6 @@ namespace Wox.Plugin.CMD public bool IsInstantQuery(string query) => false; - public bool IsExclusiveQuery(Query query) - { - return query.Search.StartsWith(">"); - } - public List LoadContextMenus(Result selectedResult) { return new List() diff --git a/Plugins/Wox.Plugin.WebSearch/Languages/en.xaml b/Plugins/Wox.Plugin.WebSearch/Languages/en.xaml index 5d8eae569f..65fadfbc23 100644 --- a/Plugins/Wox.Plugin.WebSearch/Languages/en.xaml +++ b/Plugins/Wox.Plugin.WebSearch/Languages/en.xaml @@ -23,7 +23,7 @@ Please input title Please input action keyword Please input URL - ActionWord has existed, please input a new one + ActionKeyword has existed, please input a new one Succeed Web Searches diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearch.cs b/Plugins/Wox.Plugin.WebSearch/WebSearch.cs index b05870cb0f..f92c580c76 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearch.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearch.cs @@ -6,7 +6,7 @@ namespace Wox.Plugin.WebSearch public class WebSearch { public string Title { get; set; } - public string ActionWord { get; set; } + public string ActionKeyword { get; set; } public string IconPath { get; set; } public string Url { get; set; } public bool Enabled { get; set; } diff --git a/Plugins/Wox.Plugin.WebSearch/WebQueryPlugin.cs b/Plugins/Wox.Plugin.WebSearch/WebSearchPlugin.cs similarity index 87% rename from Plugins/Wox.Plugin.WebSearch/WebQueryPlugin.cs rename to Plugins/Wox.Plugin.WebSearch/WebSearchPlugin.cs index 9fc1b9ec45..d4ee840df0 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebQueryPlugin.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchPlugin.cs @@ -8,7 +8,7 @@ using Wox.Plugin.WebSearch.SuggestionSources; namespace Wox.Plugin.WebSearch { - public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery, IExclusiveQuery + public class WebSearchPlugin : IPlugin, ISettingProvider, IPluginI18n, IInstantQuery { private PluginInitContext context; private IDisposable suggestionTimer; @@ -16,17 +16,12 @@ namespace Wox.Plugin.WebSearch public List Query(Query query) { List results = new List(); - if (!query.Search.Contains(' ')) - { - return results; - } - WebSearch webSearch = - WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionWord == query.FirstSearch.Trim() && o.Enabled); + WebSearchStorage.Instance.WebSearches.FirstOrDefault(o => o.ActionKeyword == query.ActionKeyword && o.Enabled); if (webSearch != null) { - string keyword = query.SecondToEndSearch; + string keyword = query.ActionKeyword; string title = keyword; string subtitle = context.API.GetTranslation("wox_plugin_websearch_search") + " " + webSearch.Title; if (string.IsNullOrEmpty(keyword)) @@ -122,14 +117,5 @@ namespace Wox.Plugin.WebSearch public bool IsInstantQuery(string query) => false; - public bool IsExclusiveQuery(Query query) - { - var strings = query.RawQuery.Split(' '); - if (strings.Length > 1) - { - return WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == strings[0] && o.Enabled); - } - return false; - } } } diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs b/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs index 7573689dc7..e0a8eea541 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchSetting.xaml.cs @@ -42,7 +42,7 @@ namespace Wox.Plugin.WebSearch cbEnable.IsChecked = webSearch.Enabled; tbTitle.Text = webSearch.Title; tbUrl.Text = webSearch.Url; - tbActionword.Text = webSearch.ActionWord; + tbActionword.Text = webSearch.ActionKeyword; } private void ShowIcon(string path) @@ -90,7 +90,7 @@ namespace Wox.Plugin.WebSearch if (!update) { - if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action)) + if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionKeyword == action)) { string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist"); MessageBox.Show(warning); @@ -98,7 +98,7 @@ namespace Wox.Plugin.WebSearch } WebSearchStorage.Instance.WebSearches.Add(new WebSearch() { - ActionWord = action, + ActionKeyword = action, Enabled = cbEnable.IsChecked ?? false, IconPath = tbIconPath.Text, Url = url, @@ -109,13 +109,13 @@ namespace Wox.Plugin.WebSearch } else { - if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch)) + if (WebSearchStorage.Instance.WebSearches.Exists(o => o.ActionKeyword == action && o != updateWebSearch)) { string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist"); MessageBox.Show(warning); return; } - updateWebSearch.ActionWord = action; + updateWebSearch.ActionKeyword = action; updateWebSearch.IconPath = tbIconPath.Text; updateWebSearch.Enabled = cbEnable.IsChecked ?? false; updateWebSearch.Url = url; diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs b/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs index a91a59198e..db5d0616bd 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchStorage.cs @@ -40,7 +40,7 @@ namespace Wox.Plugin.WebSearch WebSearch googleWebSearch = new WebSearch() { Title = "Google", - ActionWord = "g", + ActionKeyword = "g", IconPath = @"Images\websearch\google.png", Url = "https://www.google.com/search?q={q}", Enabled = true @@ -51,7 +51,7 @@ namespace Wox.Plugin.WebSearch WebSearch wikiWebSearch = new WebSearch() { Title = "Wikipedia", - ActionWord = "wiki", + ActionKeyword = "wiki", IconPath = @"Images\websearch\wiki.png", Url = "http://en.wikipedia.org/wiki/{q}", Enabled = true @@ -61,7 +61,7 @@ namespace Wox.Plugin.WebSearch WebSearch findIcon = new WebSearch() { Title = "FindIcon", - ActionWord = "findicon", + ActionKeyword = "findicon", IconPath = @"Images\websearch\pictures.png", Url = "http://findicons.com/search/{q}", Enabled = true diff --git a/Plugins/Wox.Plugin.WebSearch/WebSearchesSetting.xaml b/Plugins/Wox.Plugin.WebSearch/WebSearchesSetting.xaml index 0a823dc7cd..8b3de73c8a 100644 --- a/Plugins/Wox.Plugin.WebSearch/WebSearchesSetting.xaml +++ b/Plugins/Wox.Plugin.WebSearch/WebSearchesSetting.xaml @@ -22,7 +22,7 @@ - + diff --git a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj index 905e83a141..32a1b26e4a 100644 --- a/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj +++ b/Plugins/Wox.Plugin.WebSearch/Wox.Plugin.WebSearch.csproj @@ -59,7 +59,7 @@ WebSearchesSetting.xaml - + WebSearchSetting.xaml @@ -135,5 +135,4 @@ --> - - + \ No newline at end of file diff --git a/Plugins/Wox.Plugin.WebSearch/plugin.json b/Plugins/Wox.Plugin.WebSearch/plugin.json index 5132ec9e49..6b0182734e 100644 --- a/Plugins/Wox.Plugin.WebSearch/plugin.json +++ b/Plugins/Wox.Plugin.WebSearch/plugin.json @@ -1,6 +1,6 @@ { "ID":"565B73353DBF4806919830B9202EE3BF", - "ActionKeyword":"*", + "ActionKeywords": ["g", "wiki", "findicon"], "Name":"Web Searches", "Description":"Provide the web search ability", "Author":"qianlifeng", diff --git a/Wox.Core/Plugin/PluginConfig.cs b/Wox.Core/Plugin/PluginConfig.cs index 2b89a9653e..128d192495 100644 --- a/Wox.Core/Plugin/PluginConfig.cs +++ b/Wox.Core/Plugin/PluginConfig.cs @@ -72,6 +72,10 @@ namespace Wox.Core.Plugin { metadata = JsonConvert.DeserializeObject(File.ReadAllText(configPath)); metadata.PluginDirectory = pluginDirectory; + // for plugins which doesn't has ActionKeywords key + metadata.ActionKeywords = metadata.ActionKeywords ?? new[] {metadata.ActionKeyword}; + // for plugin still use old ActionKeyword + metadata.ActionKeyword = metadata.ActionKeywords?[0]; } catch (System.Exception) { @@ -112,9 +116,10 @@ namespace Wox.Core.Plugin //replace action keyword if user customized it. var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadata.ID); - if (customizedPluginConfig != null && !string.IsNullOrEmpty(customizedPluginConfig.Actionword)) + if (customizedPluginConfig?.ActionKeywords?.Length > 0) { - metadata.ActionKeyword = customizedPluginConfig.Actionword; + metadata.ActionKeywords = customizedPluginConfig.ActionKeywords; + metadata.ActionKeyword = customizedPluginConfig.ActionKeywords[0]; //todo reenable } return metadata; diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index aba4299a5d..6ae8492b24 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Threading; -using System.Windows.Documents; using Wox.Core.Exception; using Wox.Core.i18n; using Wox.Core.UI; @@ -110,7 +108,6 @@ namespace Wox.Core.Plugin ThreadPool.QueueUserWorkItem(o => { instantQueryPlugins = GetPlugins(); - exclusiveSearchPlugins = GetPlugins(); contextMenuPlugins = GetPlugins(); }); } @@ -123,8 +120,8 @@ namespace Wox.Core.Plugin public static Query QueryInit(string text) //todo is that possible to move it into type Query? { // replace multiple white spaces with one white space - var terms = text.Split(new[] { Query.Seperater }, StringSplitOptions.RemoveEmptyEntries); - var rawQuery = string.Join(Query.Seperater, terms.ToArray()); + var terms = text.Split(new[] { Query.TermSeperater }, StringSplitOptions.RemoveEmptyEntries); + var rawQuery = string.Join(Query.TermSeperater, terms.ToArray()); var actionKeyword = string.Empty; var search = rawQuery; IEnumerable actionParameters = terms; @@ -136,7 +133,7 @@ namespace Wox.Core.Plugin if (!string.IsNullOrEmpty(actionKeyword)) { actionParameters = terms.Skip(1); - search = string.Join(Query.Seperater, actionParameters.ToArray()); + search = string.Join(Query.TermSeperater, actionParameters.ToArray()); } return new Query { @@ -204,7 +201,7 @@ namespace Wox.Core.Plugin private static bool IsVailldActionKeyword(string actionKeyword) { if (string.IsNullOrEmpty(actionKeyword) || actionKeyword == Query.WildcardSign) return false; - PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == actionKeyword); + PluginPair pair = AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeywords.Contains(actionKeyword)); if (pair == null) return false; var customizedPluginConfig = UserSettingStorage.Instance. CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pair.Metadata.ID); @@ -213,7 +210,7 @@ namespace Wox.Core.Plugin public static bool IsSystemPlugin(PluginMetadata metadata) { - return metadata.ActionKeyword == Query.WildcardSign; + return metadata.ActionKeywords.Contains(Query.WildcardSign); } private static bool IsInstantQueryPlugin(PluginPair plugin) @@ -239,21 +236,11 @@ namespace Wox.Core.Plugin return AllPlugins.Where(p => p.Plugin is T); } - private static PluginPair GetExclusivePlugin(Query query) - { - return exclusiveSearchPlugins.FirstOrDefault(p => ((IExclusiveQuery)p.Plugin).IsExclusiveQuery(query)); - } - - private static PluginPair GetActionKeywordPlugin(Query query) - { - //if a query doesn't contain a vaild action keyword, it should not be a action keword plugin query - if (string.IsNullOrEmpty(query.ActionKeyword)) return null; - return AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == query.ActionKeyword); - } - private static PluginPair GetNonSystemPlugin(Query query) { - return GetExclusivePlugin(query) ?? GetActionKeywordPlugin(query); + //if a query doesn't contain a vaild action keyword, it should be a query for system plugin + if (string.IsNullOrEmpty(query.ActionKeyword)) return null; + return AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeywords.Contains(query.ActionKeyword)); } private static List GetSystemPlugins() diff --git a/Wox.Core/UserSettings/CustomizedPluginConfig.cs b/Wox.Core/UserSettings/CustomizedPluginConfig.cs index c8e224f89d..7bb40c60e3 100644 --- a/Wox.Core/UserSettings/CustomizedPluginConfig.cs +++ b/Wox.Core/UserSettings/CustomizedPluginConfig.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; namespace Wox.Core.UserSettings { @@ -9,7 +10,7 @@ namespace Wox.Core.UserSettings public string Name { get; set; } - public string Actionword { get; set; } + public string[] ActionKeywords { get; set; } public bool Disabled { get; set; } } diff --git a/Wox.Plugin/Feature.cs b/Wox.Plugin/Feature.cs index 6a1e753684..3a1cbff222 100644 --- a/Wox.Plugin/Feature.cs +++ b/Wox.Plugin/Feature.cs @@ -10,8 +10,10 @@ namespace Wox.Plugin List LoadContextMenus(Result selectedResult); } + [Obsolete("If a plugin has a action keyword, then it is exclusive. This interface will be remove in v1.3.0")] public interface IExclusiveQuery : IFeatures { + [Obsolete("If a plugin has a action keyword, then it is exclusive. This method will be remove in v1.3.0")] bool IsExclusiveQuery(Query query); } diff --git a/Wox.Plugin/PluginMetadata.cs b/Wox.Plugin/PluginMetadata.cs index 7607fda04f..ad27a8ea3e 100644 --- a/Wox.Plugin/PluginMetadata.cs +++ b/Wox.Plugin/PluginMetadata.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Collections.Generic; namespace Wox.Plugin { @@ -23,8 +24,11 @@ namespace Wox.Plugin public string PluginDirectory { get; set; } + [Obsolete("Use ActionKeywords instead, because Wox now support multiple action keywords. This will be remove in v1.3.0")] public string ActionKeyword { get; set; } + public string[] ActionKeywords { get; set; } + public string IcoPath { get; set; } public override string ToString() diff --git a/Wox.Plugin/Query.cs b/Wox.Plugin/Query.cs index 08422896f4..89d8030a00 100644 --- a/Wox.Plugin/Query.cs +++ b/Wox.Plugin/Query.cs @@ -25,14 +25,15 @@ namespace Wox.Plugin /// internal string[] Terms { private get; set; } - public const string Seperater = " "; + public const string TermSeperater = " "; + public const string ActionKeywordSeperater = ";"; /// /// * is used for System Plugin /// public const string WildcardSign = "*"; - internal string ActionKeyword { get; set; } + public string ActionKeyword { get; set; } /// /// Return first search split by space if it has @@ -46,8 +47,8 @@ namespace Wox.Plugin { get { - var index = String.IsNullOrEmpty(ActionKeyword) ? 1 : 2; - return String.Join(Seperater, Terms.Skip(index).ToArray()); + var index = string.IsNullOrEmpty(ActionKeyword) ? 1 : 2; + return string.Join(TermSeperater, Terms.Skip(index).ToArray()); } } @@ -65,18 +66,17 @@ namespace Wox.Plugin { try { - return String.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1]; + return string.IsNullOrEmpty(ActionKeyword) ? Terms[index] : Terms[index + 1]; } catch (IndexOutOfRangeException) { - return String.Empty; + return string.Empty; } } public override string ToString() => RawQuery; - [Obsolete("Use Search instead, A plugin developer shouldn't care about action name, as it may changed by users. " + - "this property will be removed in v1.3.0")] + [Obsolete("Use ActionKeyword, this property will be removed in v1.3.0")] public string ActionName { get; internal set; } [Obsolete("Use Search instead, this property will be removed in v1.3.0")] diff --git a/Wox/ActionKeyword.xaml b/Wox/ActionKeywords.xaml similarity index 94% rename from Wox/ActionKeyword.xaml rename to Wox/ActionKeywords.xaml index bdc7b6000a..6f505062ef 100644 --- a/Wox/ActionKeyword.xaml +++ b/Wox/ActionKeywords.xaml @@ -1,7 +1,7 @@ - - Old ActionKeyword: + Old ActionKeywords: diff --git a/Wox/ActionKeyword.xaml.cs b/Wox/ActionKeywords.xaml.cs similarity index 71% rename from Wox/ActionKeyword.xaml.cs rename to Wox/ActionKeywords.xaml.cs index 03beac0ee0..25a11c992f 100644 --- a/Wox/ActionKeyword.xaml.cs +++ b/Wox/ActionKeywords.xaml.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; using System.Windows; using Wox.Core.i18n; using Wox.Core.Plugin; @@ -7,11 +8,11 @@ using Wox.Plugin; namespace Wox { - public partial class ActionKeyword : Window + public partial class ActionKeywords : Window { private PluginMetadata pluginMetadata; - public ActionKeyword(string pluginId) + public ActionKeywords(string pluginId) { InitializeComponent(); PluginPair plugin = PluginManager.GetPlugin(pluginId); @@ -27,7 +28,7 @@ namespace Wox private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e) { - tbOldActionKeyword.Text = pluginMetadata.ActionKeyword; + tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, pluginMetadata.ActionKeywords); tbAction.Focus(); } @@ -44,15 +45,18 @@ namespace Wox return; } + var actionKeywords = tbAction.Text.Trim().Split(new[] { Query.ActionKeywordSeperater }, StringSplitOptions.RemoveEmptyEntries).ToArray(); //check new action keyword didn't used by other plugin - if (tbAction.Text.Trim() != Query.WildcardSign && PluginManager.AllPlugins.Any(o => o.Metadata.ActionKeyword == tbAction.Text.Trim())) + if (actionKeywords[0] != Query.WildcardSign && PluginManager.AllPlugins. + SelectMany(p => p.Metadata.ActionKeywords). + Any(k => actionKeywords.Contains(k))) { MessageBox.Show(InternationalizationManager.Instance.GetTranslation("newActionKeywordHasBeenAssigned")); return; } - pluginMetadata.ActionKeyword = tbAction.Text.Trim(); + pluginMetadata.ActionKeywords = actionKeywords; var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == pluginMetadata.ID); if (customizedPluginConfig == null) { @@ -61,12 +65,12 @@ namespace Wox Disabled = false, ID = pluginMetadata.ID, Name = pluginMetadata.Name, - Actionword = tbAction.Text.Trim() + ActionKeywords = actionKeywords }); } else { - customizedPluginConfig.Actionword = tbAction.Text.Trim(); + customizedPluginConfig.ActionKeywords = actionKeywords; } UserSettingStorage.Instance.Save(); MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 3c6ea28abd..dc9d159461 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -6,7 +6,7 @@ using System.Windows; using Wox.CommandArgs; using Wox.Core.Plugin; using Wox.Helper; -using Wox.Infrastructure; +using Stopwatch = Wox.Infrastructure.Stopwatch; namespace Wox { diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index fe252ebb98..28e0a4830d 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -77,13 +77,13 @@ You have activated Wox {0} times - Old Action Keyword - New Action Keyword + Old Action Keyword + New Action Keyword Cancel Done Can't find specified plugin - New Action Keyword can't be empty - New ActionKeyword has been assigned to other plugin, please assign another new action keyword + New Action Keyword can't be empty + New ActionKeywords has been assigned to other plugin, please assign another new action keyword Succeed Use * if you don't want to specify a action keyword diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml index e09aa9bc73..a5f5520475 100644 --- a/Wox/Languages/ru.xaml +++ b/Wox/Languages/ru.xaml @@ -77,13 +77,13 @@ Вы воспользовались Wox уже {0} раз - Текущая горячая клавиша - Новая горячая клавиша + Текущая горячая клавиша + Новая горячая клавиша Отменить Подтвердить Не удалось найти заданный плагин - Новая горячая клавиша не может быть пустой - Новая горячая клавиша уже используется другим плагином. Пожалуйста, зайдайте новую + Новая горячая клавиша не может быть пустой + Новая горячая клавиша уже используется другим плагином. Пожалуйста, зайдайте новую Сохранено Используйте * в случае, если вы не хотите задавать конкретную горячую клавишу diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index 7e00547603..d75714e9f9 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -77,13 +77,13 @@ 你已经激活了Wox {0} 次 - 旧触发关键字 - 新触发关键字 + 旧触发关键字 + 新触发关键字 取消 确定 找不到指定的插件 - 新触发关键字不能为空 - 新触发关键字已经被指派给其他插件了,请重新选择一个关键字 + 新触发关键字不能为空 + 新触发关键字已经被指派给其他插件了,请重新选择一个关键字 成功 如果你不想设置触发关键字,可以使用*代替 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index 0f1ab8f9c4..22562e170b 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -77,13 +77,13 @@ 你已經激活了Wox {0} 次 - 舊觸發關鍵字 - 新觸發關鍵字 + 舊觸發關鍵字 + 新觸發關鍵字 取消 確定 找不到指定的插件 - 新觸發關鍵字不能為空 - 新觸發關鍵字已經被指派給其他插件了,請重新選擇一個關鍵字 + 新觸發關鍵字不能為空 + 新觸發關鍵字已經被指派給其他插件了,請重新選擇一個關鍵字 成功 如果你不想設置觸發關鍵字,可以使用*代替 diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index b322cf16d5..5d5384101f 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -109,7 +109,7 @@ - + @@ -234,7 +234,7 @@ - + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index e8f316a574..297d9bb6d4 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -527,7 +527,7 @@ namespace Wox { provider = pair.Plugin as ISettingProvider; pluginAuthor.Visibility = Visibility.Visible; - pluginActionKeyword.Visibility = Visibility.Visible; + pluginActionKeywords.Visibility = Visibility.Visible; pluginInitTime.Text = string.Format(InternationalizationManager.Instance.GetTranslation("plugin_init_time"), pair.InitTime); pluginQueryTime.Text = @@ -536,7 +536,7 @@ namespace Wox tbOpenPluginDirecoty.Visibility = Visibility.Visible; pluginTitle.Text = pair.Metadata.Name; pluginTitle.Cursor = Cursors.Hand; - pluginActionKeyword.Text = pair.Metadata.ActionKeyword; + pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords); pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author; pluginSubTitle.Text = pair.Metadata.Description; pluginId = pair.Metadata.ID; @@ -578,12 +578,13 @@ namespace Wox var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == id); if (customizedPluginConfig == null) { + // todo when this part will be invoked UserSettingStorage.Instance.CustomizedPluginConfigs.Add(new CustomizedPluginConfig() { Disabled = cbDisabled.IsChecked ?? true, ID = id, Name = name, - Actionword = string.Empty + ActionKeywords = null }); } else @@ -593,7 +594,7 @@ namespace Wox UserSettingStorage.Instance.Save(); } - private void PluginActionKeyword_OnMouseUp(object sender, MouseButtonEventArgs e) + private void PluginActionKeywords_OnMouseUp(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) { @@ -602,10 +603,10 @@ namespace Wox { //third-party plugin string id = pair.Metadata.ID; - ActionKeyword changeKeywordWindow = new ActionKeyword(id); - changeKeywordWindow.ShowDialog(); + ActionKeywords changeKeywordsWindow = new ActionKeywords(id); + changeKeywordsWindow.ShowDialog(); PluginPair plugin = PluginManager.GetPlugin(id); - if (plugin != null) pluginActionKeyword.Text = plugin.Metadata.ActionKeyword; + if (plugin != null) pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords); } } } diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj index bcf2772d78..ff6ac6882c 100644 --- a/Wox/Wox.csproj +++ b/Wox/Wox.csproj @@ -126,8 +126,8 @@ MSBuild:Compile Designer - - ActionKeyword.xaml + + ActionKeywords.xaml @@ -160,7 +160,7 @@ SettingWindow.xaml - + Designer MSBuild:Compile @@ -374,5 +374,4 @@ cd "$(TargetDir)Plugins" & del /s /q WindowsInput.dll --> - - + \ No newline at end of file