mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
Fix web search icon
part of #384 bug introduced in 38cc115c1f9e1efbb2256f6e88168493797adb5c
This commit is contained in:
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@@ -11,7 +11,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
public partial class WebSearchSetting : Window
|
public partial class WebSearchSetting : Window
|
||||||
{
|
{
|
||||||
private string _defaultWebSearchImageDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Images\\websearch");
|
private const string _imageDirectoryName = "Images";
|
||||||
|
private string _pluginDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||||
private readonly WebSearchesSetting _settingWindow;
|
private readonly WebSearchesSetting _settingWindow;
|
||||||
private bool _isUpdate;
|
private bool _isUpdate;
|
||||||
private WebSearch _updateWebSearch;
|
private WebSearch _updateWebSearch;
|
||||||
@@ -50,7 +51,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void ShowIcon(string path)
|
private void ShowIcon(string path)
|
||||||
{
|
{
|
||||||
imgIcon.Source = new BitmapImage(new Uri($"{_defaultWebSearchImageDirectory}\\{path}", UriKind.Absolute));
|
imgIcon.Source = new BitmapImage(new Uri(Path.Combine(_pluginDirectory, path), UriKind.Absolute));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||||
@@ -126,15 +127,15 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void BtnSelectIcon_OnClick(object sender, RoutedEventArgs e)
|
private void BtnSelectIcon_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(_defaultWebSearchImageDirectory))
|
if (!Directory.Exists(_pluginDirectory))
|
||||||
{
|
{
|
||||||
_defaultWebSearchImageDirectory =
|
_pluginDirectory =
|
||||||
Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = new OpenFileDialog
|
var dlg = new OpenFileDialog
|
||||||
{
|
{
|
||||||
InitialDirectory = _defaultWebSearchImageDirectory,
|
InitialDirectory = Path.Combine(_pluginDirectory, _imageDirectoryName),
|
||||||
Filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp"
|
Filter = "Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) |*.jpg; *.jpeg; *.gif; *.png; *.bmp"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -142,8 +143,11 @@ namespace Wox.Plugin.WebSearch
|
|||||||
if (result == true)
|
if (result == true)
|
||||||
{
|
{
|
||||||
string filename = dlg.FileName;
|
string filename = dlg.FileName;
|
||||||
tbIconPath.Text = Path.GetFileName(filename);
|
if (filename != null)
|
||||||
ShowIcon(tbIconPath.Text);
|
{
|
||||||
|
tbIconPath.Text = Path.Combine(_imageDirectoryName, Path.GetFileName(filename));
|
||||||
|
ShowIcon(tbIconPath.Text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
Title = "Google",
|
Title = "Google",
|
||||||
ActionKeyword = "g",
|
ActionKeyword = "g",
|
||||||
IconPath = @"google.png",
|
IconPath = @"Images\google.png",
|
||||||
Url = "https://www.google.com/search?q={q}",
|
Url = "https://www.google.com/search?q={q}",
|
||||||
Enabled = true
|
Enabled = true
|
||||||
};
|
};
|
||||||
@@ -52,7 +52,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
Title = "Wikipedia",
|
Title = "Wikipedia",
|
||||||
ActionKeyword = "wiki",
|
ActionKeyword = "wiki",
|
||||||
IconPath = @"wiki.png",
|
IconPath = @"Images\wiki.png",
|
||||||
Url = "http://en.wikipedia.org/wiki/{q}",
|
Url = "http://en.wikipedia.org/wiki/{q}",
|
||||||
Enabled = true
|
Enabled = true
|
||||||
};
|
};
|
||||||
@@ -62,7 +62,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
Title = "FindIcon",
|
Title = "FindIcon",
|
||||||
ActionKeyword = "findicon",
|
ActionKeyword = "findicon",
|
||||||
IconPath = @"pictures.png",
|
IconPath = @"Images\pictures.png",
|
||||||
Url = "http://findicons.com/search/{q}",
|
Url = "http://findicons.com/search/{q}",
|
||||||
Enabled = true
|
Enabled = true
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,13 @@
|
|||||||
<Compile Include="WebSearchStorage.cs" />
|
<Compile Include="WebSearchStorage.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Images\websearch\pictures.png">
|
<None Include="Images\google.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Images\pictures.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Images\wiki.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<Content Include="Languages\en.xaml">
|
<Content Include="Languages\en.xaml">
|
||||||
@@ -114,16 +120,6 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Images\websearch\google.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="Images\websearch\wiki.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
Reference in New Issue
Block a user