[PowerRename] Add PowerRename to directory background context menu (#24522)

* Add PowerRename to directory background context menu

* Fix analyzer error

* Add more checks
This commit is contained in:
Stefan Markovic
2023-03-08 14:51:33 +01:00
committed by GitHub
parent 65378200c6
commit 58015feb3a
5 changed files with 37 additions and 26 deletions

View File

@@ -93,12 +93,6 @@ public:
{
*cmdState = ECS_ENABLED;
// We've observed that it's possible that a null gets passed instead of an empty array. Just don't show the context menu in this case.
if (nullptr == selection) {
*cmdState = ECS_HIDDEN;
return S_OK;
}
if (!CSettingsInstance().GetEnabled())
{
*cmdState = ECS_HIDDEN;
@@ -112,6 +106,12 @@ public:
return S_OK;
}
// When right clicking directory background, selection is empty. This prevents checking if there
// are renamable items, but internal PowerRename logic will prevent renaming non-renamable items anyway.
if (nullptr == selection) {
return S_OK;
}
// Check if at least one of the selected items is actually renamable.
if (!ShellItemArrayContainsRenamableItem(selection))
{