Add file type icon images

This commit is contained in:
Jeremy Wu 2020-05-19 18:46:42 +10:00
parent ac2d318412
commit 107fc75d97
9 changed files with 40 additions and 6 deletions

View file

@ -24,7 +24,7 @@ namespace Flow.Launcher.Test.Plugins
$"Actual: {result}{Environment.NewLine}");
}
[TestCase("C:\\Dropbox", "SELECT TOP 100 System.FileName, System.ItemPathDisplay FROM SystemIndex WHERE directory='file:C:\\Dropbox'")]
[TestCase("C:\\Dropbox", "SELECT TOP 100 System.FileName, System.ItemPathDisplay, System.ItemType FROM SystemIndex WHERE directory='file:C:\\Dropbox'")]
public void GivenWindowsIndexSearch_WhenSearchTypeIsSearchTopFolderLevel_ThenQueryShouldUseExpectedString(string folderPath, string expectedString)
{
// Given
@ -52,7 +52,7 @@ namespace Flow.Launcher.Test.Plugins
$"Actual string was: {resultString}{Environment.NewLine}");
}
[TestCase("flow.launcher.sln", "SELECT TOP 100 \"System.FileName\", \"System.ItemPathDisplay\" " +
[TestCase("flow.launcher.sln", "SELECT TOP 100 \"System.FileName\", \"System.ItemPathDisplay\", \"System.ItemType\" " +
"FROM \"SystemIndex\" WHERE (System.FileName LIKE 'flow.launcher.sln%' " +
"OR CONTAINS(System.FileName,'\"flow.launcher.sln*\"',1033)) AND scope='file:'")]
public void GivenWindowsIndexSearch_WhenSearchAllFoldersAndFiles_ThenQueryShouldUseExpectedString(

View file

@ -27,6 +27,22 @@
<None Include="Images\explorer.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\copy.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Images\deletefilefolder.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="Images\file.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Include="Images\folder.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

View file

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Flow.Launcher.Plugin.Explorer.Search
{
public static class Constants
{
public const string FolderImagePath = "Images\\folder.png";
public const string FileImagePath = "Images\\file.png";
public const string DeleteFileFolderImagePath = "Images\\deletefilefolder.png";
public const string CopyImagePath = "Images\\copy.png";
public const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
}
}

View file

@ -46,7 +46,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
{
if (dataReaderResults.GetValue(0) != DBNull.Value && dataReaderResults.GetValue(1) != DBNull.Value)
{
results.Add(CreateResult(dataReaderResults.GetString(0), dataReaderResults.GetString(1)));
results.Add(CreateResult(dataReaderResults.GetString(0),
dataReaderResults.GetString(1),
dataReaderResults.GetString(2)));
}
}
}
@ -66,13 +68,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
return results;
}
private Result CreateResult(string filename, string path)
private Result CreateResult(string filename, string path, string fileType)
{
return new Result
{
Title = filename,
SubTitle = path,
IcoPath = "Images\\Explorer.png",//<------CHANGE
IcoPath = fileType == "Directory" ? Constants.FolderImagePath : Constants.FileImagePath,
Action = c =>
{
try

View file

@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
baseQuery.QueryMaxResults = _settings.MaxResult;
// Set list of columns we want to display, getting the path presently
baseQuery.QuerySelectColumns = "System.FileName, System.ItemPathDisplay";
baseQuery.QuerySelectColumns = "System.FileName, System.ItemPathDisplay, System.ItemType";
// Filter based on file name
baseQuery.QueryContentProperties = "System.FileName";