[PowerRename][ImageResizer]Fallback for tier 1 menus (#19195)

* [PowerRename][ImageResizer]fallback for tier 1 menus

* Simplify logic
This commit is contained in:
Jaime Bernardo
2022-07-07 15:56:14 +01:00
committed by GitHub
parent d4b62d8118
commit e887b3b395
6 changed files with 19 additions and 31 deletions

View File

@@ -1,5 +1,6 @@
#include "pch.h"
#include "PowerRenameExt.h"
#include "PowerRenameConstants.h"
#include <trace.h>
#include <Helpers.h>
#include <common/themes/icon_helpers.h>
@@ -64,29 +65,17 @@ HRESULT CPowerRenameMenu::QueryContextMenu(HMENU hMenu, UINT index, UINT uIDFirs
if (!CSettingsInstance().GetEnabled())
return E_FAIL;
// Win11 context menu can't distinguish between extended and default menu, so use this one
if (package::IsWin11OrGreater())
{
if (CSettingsInstance().GetExtendedContextMenuOnly() && (uFlags & CMF_EXTENDEDVERBS))
{
// continue
}
else
{
return E_FAIL;
}
}
else
{
// Check if we should only be on the extended context menu
if (CSettingsInstance().GetExtendedContextMenuOnly() && (!(uFlags & CMF_EXTENDEDVERBS)))
return E_FAIL;
}
// Check if at least one of the selected items is actually renamable.
if (!DataObjectContainsRenamableItem(m_spdo))
return E_FAIL;
if (package::IsWin11OrGreater() && package::IsPackageRegistered(PowerRenameConstants::ModulePackageDisplayName))
return E_FAIL;
// Check if we should only be on the extended context menu
if (CSettingsInstance().GetExtendedContextMenuOnly() && (!(uFlags & CMF_EXTENDEDVERBS)))
return E_FAIL;
HRESULT hr = E_UNEXPECTED;
if (m_spdo && !(uFlags & (CMF_DEFAULTONLY | CMF_VERBSONLY | CMF_OPTIMIZEFORINVOKE)))
{