[SHELL32] DefView must set CMF_EXTENDEDVERBS, CMF_CANRENAME and CMF_EXPLORE (#6776)

The caller of IContextMenu::QueryContextMenu must set these flags when needed, not CDefaultContextMenu.

Notes:
- CMF_CANRENAME is always set by DefView because it always supports rename in its current form. CDefaultContextMenu verifies that SFGAO_CANRENAME is also set on the items. All other callers are expected to not know how to rename unless they also set CMF_CANRENAME. This fixes the bug that the Rename item is present in the TreeView context menu even though the TreeView in ROS Explorer does not handle renaming.
- While DefView now tries to set CMF_EXPLORE correctly, the flag is never actually set because BROWSEUI does not handle FCW_TREE yet.
- This also fixes the bug where the File menu is missing the menu items when there is no selection.
This commit is contained in:
Whindmar Saksit 2024-04-28 16:00:03 +02:00 committed by GitHub
parent c9864da823
commit f9325370f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 10 deletions

View file

@ -603,9 +603,7 @@ CDefaultContextMenu::AddStaticContextMenusToMenu(
if (hkVerb)
{
// FIXME: GetAsyncKeyState should not be called here, clients
// need to be updated to set the CMF_EXTENDEDVERBS flag.
if (!(uFlags & CMF_EXTENDEDVERBS) && GetAsyncKeyState(VK_SHIFT) >= 0)
if (!(uFlags & CMF_EXTENDEDVERBS))
hide = RegValueExists(hkVerb, L"Extended");
if (!hide)
@ -807,7 +805,7 @@ CDefaultContextMenu::QueryContextMenu(
DeleteMenu(hmenuDefault, IDM_CREATELINK, MF_BYCOMMAND);
if (!(rfg & SFGAO_CANDELETE))
DeleteMenu(hmenuDefault, IDM_DELETE, MF_BYCOMMAND);
if (!(rfg & SFGAO_CANRENAME))
if (!(rfg & SFGAO_CANRENAME) || !(uFlags & CMF_CANRENAME))
DeleteMenu(hmenuDefault, IDM_RENAME, MF_BYCOMMAND);
if (!(rfg & SFGAO_HASPROPSHEET))
DeleteMenu(hmenuDefault, IDM_PROPERTIES, MF_BYCOMMAND);