[SHELL32] CDefView: Respect item attributes

This commit is contained in:
Mark Jansen 2021-07-15 22:46:20 +02:00
parent 91e63ee0b5
commit d039653959
No known key found for this signature in database
GPG Key ID: B39240EE84BEAE8B

View File

@ -1587,6 +1587,26 @@ LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
if (FAILED_UNEXPECTEDLY( hResult))
goto cleanup;
if (bUseSelection)
{
// FIXME: we should cache this....
SFGAOF rfg = SFGAO_BROWSABLE | SFGAO_CANCOPY | SFGAO_CANLINK | SFGAO_CANMOVE | SFGAO_CANDELETE | SFGAO_CANRENAME | SFGAO_HASPROPSHEET | SFGAO_FILESYSTEM | SFGAO_FOLDER;
hResult = m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &rfg);
if (FAILED_UNEXPECTEDLY(hResult))
return 0;
if (!(rfg & SFGAO_CANMOVE) && uCommand == FCIDM_SHVIEW_CUT)
return 0;
if (!(rfg & SFGAO_CANCOPY) && uCommand == FCIDM_SHVIEW_COPY)
return 0;
if (!(rfg & SFGAO_CANDELETE) && uCommand == FCIDM_SHVIEW_DELETE)
return 0;
if (!(rfg & SFGAO_CANRENAME) && uCommand == FCIDM_SHVIEW_RENAME)
return 0;
if (!(rfg & SFGAO_HASPROPSHEET) && uCommand == FCIDM_SHVIEW_PROPERTIES)
return 0;
}
InvokeContextMenuCommand(uCommand);
cleanup:
@ -1819,6 +1839,9 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHand
case FCIDM_SHVIEW_PROPERTIES:
case FCIDM_SHVIEW_COPYTO:
case FCIDM_SHVIEW_MOVETO:
if (SHRestricted(REST_NOVIEWCONTEXTMENU))
return 0;
return OnExplorerCommand(dwCmdID, TRUE);
case FCIDM_SHVIEW_INSERT: