From d7f0d0e5c14affd52038472f2cb4d9e20e10ad67 Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Mon, 20 Nov 2023 12:12:09 +0000 Subject: [PATCH] [FileExplorer]Adds PerceivedType to SVG and QOI thumbnails (#29848) --- src/common/utils/modulesRegistry.h | 5 ++++- src/common/utils/registry.h | 10 +++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/common/utils/modulesRegistry.h b/src/common/utils/modulesRegistry.h index f736f43f7a3a..fce782847d6b 100644 --- a/src/common/utils/modulesRegistry.h +++ b/src/common/utils/modulesRegistry.h @@ -170,6 +170,7 @@ inline registry::ChangeSet getSvgThumbnailHandlerChangeSet(const std::wstring in L"SvgThumbnailProvider", L"Svg Thumbnail Provider", NonLocalizable::ExtSVG, + L"image", L"Picture"); } @@ -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) diff --git a/src/common/utils/registry.h b/src/common/utils/registry.h index 57507e36b193..059589352d20 100644 --- a/src/common/utils/registry.h +++ b/src/common/utils/registry.h @@ -395,6 +395,7 @@ namespace registry std::wstring className, std::wstring displayName, std::vector fileTypes, + std::wstring perceivedType = L"", std::wstring fileKindType = L"") { const HKEY scope = perUser ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; @@ -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()) @@ -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