Implement WebSearch feature.

This commit is contained in:
qianlifeng
2014-02-02 16:15:34 +08:00
parent 76fa97e0a0
commit 495e0ce89b
8 changed files with 122 additions and 42 deletions

View File

@@ -17,14 +17,14 @@ namespace Wox.Plugin.System
if (string.IsNullOrEmpty(query.ActionName)) return results;
WebSearch webSearch =
CommonStorage.Instance.UserSetting.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName);
CommonStorage.Instance.UserSetting.WebSearches.FirstOrDefault(o => o.ActionWord == query.ActionName && o.Enabled);
if (webSearch != null)
{
string keyword = query.ActionParameters.Count > 0 ? query.RawQuery.Substring(query.RawQuery.IndexOf(' ') + 1) : "";
results.Add(new Result()
{
Title = string.Format("Search {0} for {1}", webSearch.Title, keyword),
Title = string.Format("Search {0} for \"{1}\"", webSearch.Title, keyword),
IcoPath = webSearch.IconPath,
Action = () => Process.Start(webSearch.Url.Replace("{q}", keyword))
});