Skip to content

Commit

Permalink
[FileExplorer]Adds PerceivedType to SVG and QOI thumbnails (microsoft…
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrolamas authored Nov 20, 2023
1 parent c095cdd commit d7f0d0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/common/utils/modulesRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring in
L"SvgThumbnailProvider",
L"Svg Thumbnail Provider",
NonLocalizable::ExtSVG,
L"image",
L"Picture");
}

Expand Down Expand Up @@ -222,7 +223,9 @@ inline registry::ChangeSet getQoiThumbnailHandlerChangeSet(const std::wstring in
(fs::path{ installationDir } / LR"d(PowerToys.QoiThumbnailProviderCpp.dll)d").wstring(),
L"QoiThumbnailProvider",
L"Qoi Thumbnail Provider",
NonLocalizable::ExtQOI);
NonLocalizable::ExtQOI,
L"image",
L"Picture");
}

inline registry::ChangeSet getRegistryPreviewSetDefaultAppChangeSet(const std::wstring installationDir, const bool perUser)
Expand Down
10 changes: 7 additions & 3 deletions src/common/utils/registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ namespace registry
std::wstring className,
std::wstring displayName,
std::vector<std::wstring> fileTypes,
std::wstring perceivedType = L"",
std::wstring fileKindType = L"")
{
const HKEY scope = perUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE;
Expand Down Expand Up @@ -436,9 +437,8 @@ namespace registry

for (const auto& fileType : fileTypes)
{
std::wstring fileAssociationPath = L"Software\\Classes\\";
fileAssociationPath += fileType;
fileAssociationPath += L"\\shellex\\";
std::wstring fileTypePath = L"Software\\Classes\\" + fileType;
std::wstring fileAssociationPath = fileTypePath + L"\\shellex\\";
fileAssociationPath += handlerType == PreviewHandlerType::preview ? IPREVIEW_HANDLER_CLSID : ITHUMBNAIL_PROVIDER_CLSID;
changes.push_back({ scope, fileAssociationPath, std::nullopt, handlerClsid });
if (!fileKindType.empty())
Expand All @@ -448,6 +448,10 @@ namespace registry
std::wstring kindMapPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\KindMap";
changes.push_back({ HKEY_LOCAL_MACHINE, kindMapPath, fileType, fileKindType, false});
}
if (!perceivedType.empty())
{
changes.push_back({ scope, fileTypePath, L"PerceivedType", perceivedType });
}
if (handlerType == PreviewHandlerType::preview && fileType == L".reg")
{
// this regfile registry key has precedence over Software\Classes\.reg for .reg files
Expand Down

0 comments on commit d7f0d0e

Please sign in to comment.