mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
parent
7b50febba3
commit
af7beb2c34
12 changed files with 48 additions and 19 deletions
|
|
@ -230,7 +230,7 @@ namespace Wox.Plugin.PluginManagement
|
|||
List<Result> results = new List<Result>();
|
||||
foreach (PluginMetadata plugin in context.API.GetAllPlugins().Select(o => o.Metadata))
|
||||
{
|
||||
string actionKeywordString = string.Join(" or ", plugin.ActionKeywords);
|
||||
string actionKeywordString = string.Join(" or ", plugin.ActionKeywords.ToArray());
|
||||
results.Add(new Result
|
||||
{
|
||||
Title = $"{plugin.Name} - Action Keywords: {actionKeywordString}",
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ namespace Wox.Plugin.WebSearch
|
|||
Url = url,
|
||||
Title = title
|
||||
});
|
||||
context.CurrentPluginMetadata.ActionKeywords.Add(action);
|
||||
string msg = context.API.GetTranslation("wox_plugin_websearch_succeed");
|
||||
MessageBox.Show(msg);
|
||||
}
|
||||
|
|
@ -120,10 +121,12 @@ namespace Wox.Plugin.WebSearch
|
|||
updateWebSearch.Enabled = cbEnable.IsChecked ?? false;
|
||||
updateWebSearch.Url = url;
|
||||
updateWebSearch.Title= title;
|
||||
context.CurrentPluginMetadata.ActionKeywords.Add(action);
|
||||
string msg = context.API.GetTranslation("wox_plugin_websearch_succeed");
|
||||
MessageBox.Show(msg);
|
||||
}
|
||||
WebSearchStorage.Instance.Save();
|
||||
|
||||
settingWindow.ReloadWebSearchView();
|
||||
Close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ namespace Wox.Core.Plugin
|
|||
metadata = JsonConvert.DeserializeObject<PluginMetadata>(File.ReadAllText(configPath));
|
||||
metadata.PluginDirectory = pluginDirectory;
|
||||
// for plugins which doesn't has ActionKeywords key
|
||||
metadata.ActionKeywords = metadata.ActionKeywords ?? new[] {metadata.ActionKeyword};
|
||||
metadata.ActionKeywords = metadata.ActionKeywords ?? new List<string> {metadata.ActionKeyword};
|
||||
// for plugin still use old ActionKeyword
|
||||
metadata.ActionKeyword = metadata.ActionKeywords?[0];
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ namespace Wox.Core.Plugin
|
|||
|
||||
//replace action keyword if user customized it.
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadata.ID);
|
||||
if (customizedPluginConfig?.ActionKeywords?.Length > 0)
|
||||
if (customizedPluginConfig?.ActionKeywords?.Count > 0)
|
||||
{
|
||||
metadata.ActionKeywords = customizedPluginConfig.ActionKeywords;
|
||||
metadata.ActionKeyword = customizedPluginConfig.ActionKeywords[0];
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace Wox.Core.UserSettings
|
|||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string[] ActionKeywords { get; set; }
|
||||
public List<string> ActionKeywords { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace Wox.Plugin
|
|||
[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 List<string> ActionKeywords { get; set; }
|
||||
|
||||
public string IcoPath { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Wox
|
|||
|
||||
private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, pluginMetadata.ActionKeywords);
|
||||
tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, pluginMetadata.ActionKeywords.ToArray());
|
||||
tbAction.Focus();
|
||||
}
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ namespace Wox
|
|||
return;
|
||||
}
|
||||
|
||||
var actionKeywords = tbAction.Text.Trim().Split(new[] { Query.ActionKeywordSeperater }, StringSplitOptions.RemoveEmptyEntries).ToArray();
|
||||
var actionKeywords = tbAction.Text.Trim().Split(new[] { Query.ActionKeywordSeperater }, StringSplitOptions.RemoveEmptyEntries).ToList();
|
||||
//check new action keyword didn't used by other plugin
|
||||
if (actionKeywords[0] != Query.GlobalPluginWildcardSign && PluginManager.AllPlugins.
|
||||
SelectMany(p => p.Metadata.ActionKeywords).
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<system:String x:Key="plugin">Plugin</system:String>
|
||||
<system:String x:Key="browserMorePlugins">Browse more plugins</system:String>
|
||||
<system:String x:Key="disable">Disable</system:String>
|
||||
<system:String x:Key="actionKeyword">Action keyword</system:String>
|
||||
<system:String x:Key="actionKeywords">Action keywords</system:String>
|
||||
<system:String x:Key="pluginDirectory">Plugin Directory</system:String>
|
||||
<system:String x:Key="author">Author</system:String>
|
||||
<system:String x:Key="plugin_init_time">Init time: {0}ms</system:String>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<system:String x:Key="plugin">Плагины</system:String>
|
||||
<system:String x:Key="browserMorePlugins">Найти больше плагинов</system:String>
|
||||
<system:String x:Key="disable">Отключить</system:String>
|
||||
<system:String x:Key="actionKeyword">Ключевое слово</system:String>
|
||||
<system:String x:Key="actionKeywords">Ключевое слово</system:String>
|
||||
<system:String x:Key="pluginDirectory">Папка</system:String>
|
||||
<system:String x:Key="author">Автор</system:String>
|
||||
<system:String x:Key="plugin_init_time">Инициализация: {0}ms</system:String>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<system:String x:Key="plugin">插件</system:String>
|
||||
<system:String x:Key="browserMorePlugins">浏览更多插件</system:String>
|
||||
<system:String x:Key="disable">禁用</system:String>
|
||||
<system:String x:Key="actionKeyword">触发关键字</system:String>
|
||||
<system:String x:Key="actionKeywords">触发关键字</system:String>
|
||||
<system:String x:Key="pluginDirectory">插件目录</system:String>
|
||||
<system:String x:Key="author">作者</system:String>
|
||||
<system:String x:Key="plugin_init_time">加载耗时 {0}ms</system:String>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<system:String x:Key="plugin">插件</system:String>
|
||||
<system:String x:Key="browserMorePlugins">瀏覽更多插件</system:String>
|
||||
<system:String x:Key="disable">禁用</system:String>
|
||||
<system:String x:Key="actionKeyword">觸發關鍵字</system:String>
|
||||
<system:String x:Key="actionKeywords">觸發關鍵字</system:String>
|
||||
<system:String x:Key="pluginDirectory">插件目錄</system:String>
|
||||
<system:String x:Key="author">作者</system:String>
|
||||
<system:String x:Key="plugin_init_time">加載耗時:{0}ms</system:String>
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@
|
|||
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">
|
||||
<TextBlock Text="{DynamicResource disable}"></TextBlock>
|
||||
</CheckBox>
|
||||
<TextBlock x:Name="pluginActionKeywordTitle" Margin="20 0 0 0">
|
||||
<TextBlock Text="{DynamicResource actionKeyword}"></TextBlock>
|
||||
<TextBlock x:Name="pluginActionKeywordsTitle" Margin="20 0 0 0">
|
||||
<TextBlock Text="{DynamicResource actionKeywords}"></TextBlock>
|
||||
</TextBlock>
|
||||
<TextBlock Margin="5 0 0 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeywords_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeywords"></TextBlock>
|
||||
<TextBlock Margin="5 0 0 0" ToolTip="Change Action Keywords" Cursor="Hand" MouseUp="PluginActionKeywords_OnMouseUp" Foreground="Blue" Text="keys" x:Name="pluginActionKeywords"></TextBlock>
|
||||
<TextBlock Margin="10 0 0 0" Text="Init time: 0ms" x:Name="pluginInitTime"></TextBlock>
|
||||
<TextBlock Margin="10 0 0 0" Text="Query time: 0ms" x:Name="pluginQueryTime"></TextBlock>
|
||||
<TextBlock HorizontalAlignment="Right" Cursor="Hand" MouseUp="tbOpenPluginDirecoty_MouseUp" Foreground="Blue" Text="{DynamicResource pluginDirectory}" x:Name="tbOpenPluginDirecoty"></TextBlock>
|
||||
|
|
|
|||
|
|
@ -117,7 +117,8 @@ namespace Wox
|
|||
cbEnableProxy.Unchecked += (o, e) => DisableProxy();
|
||||
cbEnableProxy.IsChecked = UserSettingStorage.Instance.ProxyEnabled;
|
||||
tbProxyServer.Text = UserSettingStorage.Instance.ProxyServer;
|
||||
if (UserSettingStorage.Instance.ProxyPort != 0) {
|
||||
if (UserSettingStorage.Instance.ProxyPort != 0)
|
||||
{
|
||||
tbProxyPort.Text = UserSettingStorage.Instance.ProxyPort.ToString();
|
||||
}
|
||||
tbProxyUserName.Text = UserSettingStorage.Instance.ProxyUserName;
|
||||
|
|
@ -187,6 +188,23 @@ namespace Wox
|
|||
{
|
||||
OnHotkeyTabSelected();
|
||||
}
|
||||
|
||||
// save multiple action keywords settings, todo: this hack is ugly
|
||||
var tab = e.RemovedItems.Count > 0 ? e.RemovedItems[0] : null;
|
||||
if (ReferenceEquals(tab, tabPlugin))
|
||||
{
|
||||
var metadata = (lbPlugins.SelectedItem as PluginPair)?.Metadata;
|
||||
if (metadata != null)
|
||||
{
|
||||
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadata.ID);
|
||||
if (customizedPluginConfig != null && !customizedPluginConfig.Disabled)
|
||||
{
|
||||
customizedPluginConfig.ActionKeywords = metadata.ActionKeywords;
|
||||
UserSettingStorage.Instance.Save();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region General
|
||||
|
|
@ -527,16 +545,24 @@ namespace Wox
|
|||
{
|
||||
provider = pair.Plugin as ISettingProvider;
|
||||
pluginAuthor.Visibility = Visibility.Visible;
|
||||
pluginActionKeywords.Visibility = Visibility.Visible;
|
||||
pluginInitTime.Text =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_init_time"), pair.InitTime);
|
||||
pluginQueryTime.Text =
|
||||
string.Format(InternationalizationManager.Instance.GetTranslation("plugin_query_time"), pair.AvgQueryTime);
|
||||
pluginActionKeywordTitle.Visibility = Visibility.Visible;
|
||||
if (pair.Metadata.ActionKeywords.Count > 0)
|
||||
{
|
||||
pluginActionKeywordsTitle.Visibility = Visibility.Collapsed;
|
||||
pluginActionKeywords.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
pluginActionKeywordsTitle.Visibility = Visibility.Visible;
|
||||
pluginActionKeywords.Visibility = Visibility.Visible;
|
||||
}
|
||||
tbOpenPluginDirecoty.Visibility = Visibility.Visible;
|
||||
pluginTitle.Text = pair.Metadata.Name;
|
||||
pluginTitle.Cursor = Cursors.Hand;
|
||||
pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords);
|
||||
pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords.ToArray());
|
||||
pluginAuthor.Text = InternationalizationManager.Instance.GetTranslation("author") + ": " + pair.Metadata.Author;
|
||||
pluginSubTitle.Text = pair.Metadata.Description;
|
||||
pluginId = pair.Metadata.ID;
|
||||
|
|
@ -606,7 +632,7 @@ namespace Wox
|
|||
ActionKeywords changeKeywordsWindow = new ActionKeywords(id);
|
||||
changeKeywordsWindow.ShowDialog();
|
||||
PluginPair plugin = PluginManager.GetPluginForId(id);
|
||||
if (plugin != null) pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords);
|
||||
if (plugin != null) pluginActionKeywords.Text = string.Join(Query.ActionKeywordSeperater, pair.Metadata.ActionKeywords.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue