[SHELL32] Fix the toolbar buttons in the file open dialog

CDefView: Make GetItemObject return an IContectMenu after setting itself as the site.
CDefViewBckgrndMenu: Make the inner context menu use the same site. Implement handling CMDSTR_VIEWLISTA and CMDSTR_VIEWDETAILSA.
CDefaultContextMenu: CMDSTR_VIEWLISTA and CMDSTR_VIEWDETAILSA shouldn't be handled in this class.
Fixes CORE-14327 and the two buttons that change the view mode
This commit is contained in:
Giannis Adamopoulos 2018-02-15 00:23:18 +02:00
parent e4aa45f63a
commit b97886ea9f
3 changed files with 25 additions and 15 deletions

View file

@ -126,6 +126,10 @@ WINAPI
CDefViewBckgrndMenu::SetSite(IUnknown *pUnkSite)
{
m_site = pUnkSite;
if(m_folderCM)
IUnknown_SetSite(m_folderCM, pUnkSite);
return S_OK;
}
@ -212,7 +216,16 @@ WINAPI
CDefViewBckgrndMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
{
UINT idCmd = LOWORD(lpcmi->lpVerb);
if(HIWORD(lpcmi->lpVerb) != 0 || idCmd < m_LastFolderCMId)
if (HIWORD(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, CMDSTR_VIEWLISTA))
{
idCmd = FCIDM_SHVIEW_LISTVIEW;
}
else if (HIWORD(lpcmi->lpVerb) && !strcmp(lpcmi->lpVerb, CMDSTR_VIEWDETAILSA))
{
idCmd = FCIDM_SHVIEW_REPORTVIEW;
}
else if(HIWORD(lpcmi->lpVerb) != 0 || idCmd < m_LastFolderCMId)
{
if (m_folderCM)
{
@ -221,9 +234,11 @@ CDefViewBckgrndMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi)
WARN("m_folderCM is NULL!\n");
return E_NOTIMPL;
}
/* The default part of the background menu doesn't have shifted ids so we need to convert the id offset to the real id */
idCmd += m_idCmdFirst;
else
{
/* The default part of the background menu doesn't have shifted ids so we need to convert the id offset to the real id */
idCmd += m_idCmdFirst;
}
/* The commands that are handled by the def view are forwarded to it */
switch (idCmd)