mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 02:39:42 +00:00
[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:
parent
e4aa45f63a
commit
b97886ea9f
3 changed files with 25 additions and 15 deletions
|
@ -1110,8 +1110,6 @@ HRESULT CDefView::FillFileMenu()
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
IUnknown_SetSite(m_pCM, (IShellView *)this);
|
||||
|
||||
HMENU hmenu = CreatePopupMenu();
|
||||
|
||||
hr = m_pCM->QueryContextMenu(hmenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, 0);
|
||||
|
@ -1274,8 +1272,6 @@ HRESULT CDefView::OpenSelectedItems()
|
|||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
goto cleanup;
|
||||
|
||||
IUnknown_SetSite(m_pCM, (IShellView *)this);
|
||||
|
||||
hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_DEFAULTONLY);
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
goto cleanup;
|
||||
|
@ -1327,8 +1323,6 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
|||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
goto cleanup;
|
||||
|
||||
IUnknown_SetSite(m_pCM, (IShellView *)this);
|
||||
|
||||
/* Use 1 as the first id as we want 0 the mean that the user canceled the menu */
|
||||
hResult = m_pCM->QueryContextMenu(m_hContextMenu, 0, CONTEXT_MENU_BASE_ID, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
||||
if (FAILED_UNEXPECTEDLY(hResult))
|
||||
|
@ -1374,8 +1368,6 @@ LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
|
|||
if (FAILED_UNEXPECTEDLY( hResult))
|
||||
goto cleanup;
|
||||
|
||||
IUnknown_SetSite(m_pCM, (IShellView *)this);
|
||||
|
||||
hResult = m_pCM->QueryContextMenu(hMenu, 0, FCIDM_SHVIEWFIRST, FCIDM_SHVIEWLAST, CMF_NORMAL);
|
||||
if (FAILED_UNEXPECTEDLY( hResult))
|
||||
goto cleanup;
|
||||
|
@ -2287,6 +2279,7 @@ HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
|
|||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
|
||||
}
|
||||
else if (IsEqualIID(riid, IID_IDispatch))
|
||||
{
|
||||
|
@ -2305,6 +2298,10 @@ HRESULT WINAPI CDefView::GetItemObject(UINT uItem, REFIID riid, LPVOID *ppvOut)
|
|||
hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, riid, 0, ppvOut);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
return hr;
|
||||
|
||||
if (IsEqualIID(riid, IID_IContextMenu))
|
||||
IUnknown_SetSite(*((IUnknown**)ppvOut), (IShellView *)this);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
@ -47,9 +47,7 @@ struct _StaticInvokeCommandMap_
|
|||
{ "Print", 0 }, // Unimplemented
|
||||
{ "Preview", 0 }, // Unimplemented
|
||||
{ "Open", FCIDM_SHVIEW_OPEN },
|
||||
{ CMDSTR_NEWFOLDERA, FCIDM_SHVIEW_NEWFOLDER },
|
||||
{ CMDSTR_VIEWLISTA, FCIDM_SHVIEW_LISTVIEW },
|
||||
{ CMDSTR_VIEWDETAILSA, FCIDM_SHVIEW_REPORTVIEW }
|
||||
{ CMDSTR_NEWFOLDERA, FCIDM_SHVIEW_NEWFOLDER }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue