diff --git a/Plugins/Wox.Plugin.Everything/Languages/en.xaml b/Plugins/Wox.Plugin.Everything/Languages/en.xaml index 46f8bc5225..4e94146604 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/en.xaml @@ -9,6 +9,10 @@ Open parent folder Open with {0} Editor Path + Copy path + Copy + Delete + Can't delete {0} Everything Search on-disk files using Everything diff --git a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml index 9e192172f4..6b57eed286 100644 --- a/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml +++ b/Plugins/Wox.Plugin.Everything/Languages/zh-cn.xaml @@ -9,6 +9,10 @@ 打开所属文件夹 使用{0}打开 编辑器路径 + 拷贝路径 + 拷贝 + 删除 + 无法删除 {0} Everything 利用 Everything 搜索磁盘文件 diff --git a/Plugins/Wox.Plugin.Everything/Main.cs b/Plugins/Wox.Plugin.Everything/Main.cs index f050154d67..7969a079fe 100644 --- a/Plugins/Wox.Plugin.Everything/Main.cs +++ b/Plugins/Wox.Plugin.Everything/Main.cs @@ -211,6 +211,53 @@ namespace Wox.Plugin.Everything } } + var icoPath = (record.Type == ResultType.File) ? "Images\\file.png" : "Images\\folder.png"; + contextMenus.Add(new Result + { + Title = _context.API.GetTranslation("wox_plugin_everything_copy_path"), + Action = (context) => + { + Clipboard.SetText(record.FullPath); + return true; + }, + IcoPath = icoPath + }); + + contextMenus.Add(new Result + { + Title = _context.API.GetTranslation("wox_plugin_everything_copy"), + Action = (context) => + { + Clipboard.SetFileDropList(new System.Collections.Specialized.StringCollection { record.FullPath }); + return true; + }, + IcoPath = icoPath + }); + + if (record.Type == ResultType.File || record.Type == ResultType.Folder) + contextMenus.Add(new Result + { + Title = _context.API.GetTranslation("wox_plugin_everything_delete"), + Action = (context) => + { + try + { + if (record.Type == ResultType.File) + System.IO.File.Delete(record.FullPath); + else + System.IO.Directory.Delete(record.FullPath); + } + catch + { + _context.API.ShowMsg(string.Format(_context.API.GetTranslation("wox_plugin_everything_canot_delete"), record.FullPath), string.Empty, string.Empty); + return false; + } + + return true; + }, + IcoPath = icoPath + }); + return contextMenus; } diff --git a/Plugins/Wox.Plugin.Url/Languages/en.xaml b/Plugins/Wox.Plugin.Url/Languages/en.xaml index eec48e692b..6f408e0ca7 100644 --- a/Plugins/Wox.Plugin.Url/Languages/en.xaml +++ b/Plugins/Wox.Plugin.Url/Languages/en.xaml @@ -8,4 +8,8 @@ URL Open the typed URL from Wox + Please set your browser path: + Choose + Apply + Application(*.exe)|*.exe|All files|*.* \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml b/Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml index d44f845570..e563536251 100644 --- a/Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml +++ b/Plugins/Wox.Plugin.Url/Languages/zh-cn.xaml @@ -8,4 +8,8 @@ URL 从Wox打开链接 + 请设置你的浏览器路径: + 选择 + 应用 + 程序文件(*.exe)|*.exe|所有文件|*.* \ No newline at end of file diff --git a/Plugins/Wox.Plugin.Url/Main.cs b/Plugins/Wox.Plugin.Url/Main.cs index 80758c97fb..6cd486919b 100644 --- a/Plugins/Wox.Plugin.Url/Main.cs +++ b/Plugins/Wox.Plugin.Url/Main.cs @@ -2,10 +2,12 @@ using System.Collections.Generic; using System.Diagnostics; using System.Text.RegularExpressions; +using System.Windows.Controls; +using Wox.Infrastructure.Storage; namespace Wox.Plugin.Url { - public class Main : IPlugin, IPluginI18n + public class Main : ISettingProvider,IPlugin, IPluginI18n, ISavable { //based on https://gist.github.com/dperini/729294 private const string urlPattern = "^" + @@ -42,6 +44,19 @@ namespace Wox.Plugin.Url "$"; Regex reg = new Regex(urlPattern, RegexOptions.Compiled | RegexOptions.IgnoreCase); private PluginInitContext context; + private readonly Settings _settings; + private readonly PluginJsonStorage _storage; + + public Main() + { + _storage = new PluginJsonStorage(); + _settings = _storage.Load(); + } + + public void Save() + { + _storage.Save(); + } public List Query(Query query) { @@ -64,7 +79,15 @@ namespace Wox.Plugin.Url } try { - Process.Start(raw); + if (_settings.BrowserPath.Length == 0) + { + Process.Start(raw); + } + else + { + Process.Start(_settings.BrowserPath,raw); + } + return true; } catch(Exception ex) @@ -79,6 +102,12 @@ namespace Wox.Plugin.Url return new List(0); } + + public Control CreateSettingPanel() + { + return new SettingsControl(context.API,_settings); + } + public bool IsURL(string raw) { raw = raw.ToLower(); diff --git a/Plugins/Wox.Plugin.Url/Settings.cs b/Plugins/Wox.Plugin.Url/Settings.cs new file mode 100644 index 0000000000..8dce1770d7 --- /dev/null +++ b/Plugins/Wox.Plugin.Url/Settings.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Wox.Plugin.Url +{ + public class Settings + { + public string BrowserPath { get; set; } + } +} diff --git a/Plugins/Wox.Plugin.Url/SettingsControl.xaml b/Plugins/Wox.Plugin.Url/SettingsControl.xaml new file mode 100644 index 0000000000..ea607cdc52 --- /dev/null +++ b/Plugins/Wox.Plugin.Url/SettingsControl.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + +