mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
[SHELL32] Fix copyto/moveto actions of Search Results (#5816)
- Extend CDefView::InvokeContextMenuCommand 2nd parameter to LPCSTR. - Add CDefView::_DoCopyToMoveToFolder method. - Use CDefView::_DoCopyToMoveToFolder for FCIDM_SHVIEW_COPYTO and FCIDM_SHVIEW_MOVETO command actions. CORE-18426
This commit is contained in:
parent
4eace8d762
commit
8f6b016963
1 changed files with 38 additions and 9 deletions
|
@ -163,6 +163,7 @@ class CDefView :
|
||||||
INT _FindInsertableIndexFromPoint(POINT pt);
|
INT _FindInsertableIndexFromPoint(POINT pt);
|
||||||
void _HandleStatusBarResize(int width);
|
void _HandleStatusBarResize(int width);
|
||||||
void _ForceStatusBarResize();
|
void _ForceStatusBarResize();
|
||||||
|
void _DoCopyToMoveToFolder(BOOL bCopy);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDefView();
|
CDefView();
|
||||||
|
@ -197,7 +198,7 @@ class CDefView :
|
||||||
void OnDeactivate();
|
void OnDeactivate();
|
||||||
void DoActivate(UINT uState);
|
void DoActivate(UINT uState);
|
||||||
HRESULT drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
HRESULT drag_notify_subitem(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect);
|
||||||
HRESULT InvokeContextMenuCommand(CComPtr<IContextMenu> &pCM, UINT uCommand, POINT* pt);
|
HRESULT InvokeContextMenuCommand(CComPtr<IContextMenu>& pCM, LPCSTR lpVerb, POINT* pt = NULL);
|
||||||
LRESULT OnExplorerCommand(UINT uCommand, BOOL bUseSelection);
|
LRESULT OnExplorerCommand(UINT uCommand, BOOL bUseSelection);
|
||||||
|
|
||||||
// *** IOleWindow methods ***
|
// *** IOleWindow methods ***
|
||||||
|
@ -1513,14 +1514,14 @@ UINT CDefView::GetSelections()
|
||||||
return m_cidl;
|
return m_cidl;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CDefView::InvokeContextMenuCommand(CComPtr<IContextMenu> &pCM, UINT uCommand, POINT* pt)
|
HRESULT CDefView::InvokeContextMenuCommand(CComPtr<IContextMenu>& pCM, LPCSTR lpVerb, POINT* pt)
|
||||||
{
|
{
|
||||||
CMINVOKECOMMANDINFOEX cmi;
|
CMINVOKECOMMANDINFOEX cmi;
|
||||||
|
|
||||||
ZeroMemory(&cmi, sizeof(cmi));
|
ZeroMemory(&cmi, sizeof(cmi));
|
||||||
cmi.cbSize = sizeof(cmi);
|
cmi.cbSize = sizeof(cmi);
|
||||||
cmi.lpVerb = MAKEINTRESOURCEA(uCommand);
|
|
||||||
cmi.hwnd = m_hWnd;
|
cmi.hwnd = m_hWnd;
|
||||||
|
cmi.lpVerb = lpVerb;
|
||||||
|
|
||||||
if (GetKeyState(VK_SHIFT) & 0x8000)
|
if (GetKeyState(VK_SHIFT) & 0x8000)
|
||||||
cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
|
cmi.fMask |= CMIC_MASK_SHIFT_DOWN;
|
||||||
|
@ -1583,7 +1584,7 @@ HRESULT CDefView::OpenSelectedItems()
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvokeContextMenuCommand(pCM, uCommand, NULL);
|
InvokeContextMenuCommand(pCM, MAKEINTRESOURCEA(uCommand), NULL);
|
||||||
|
|
||||||
return hResult;
|
return hResult;
|
||||||
}
|
}
|
||||||
|
@ -1682,7 +1683,7 @@ LRESULT CDefView::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &b
|
||||||
if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
|
if (uCommand == FCIDM_SHVIEW_OPEN && OnDefaultCommand() == S_OK)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
InvokeContextMenuCommand(m_pCM, uCommand - CONTEXT_MENU_BASE_ID, &pt);
|
InvokeContextMenuCommand(m_pCM, MAKEINTRESOURCEA(uCommand - CONTEXT_MENU_BASE_ID), &pt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1731,7 +1732,7 @@ LRESULT CDefView::OnExplorerCommand(UINT uCommand, BOOL bUseSelection)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: We should probably use the objects position?
|
// FIXME: We should probably use the objects position?
|
||||||
InvokeContextMenuCommand(pCM, uCommand, NULL);
|
InvokeContextMenuCommand(pCM, MAKEINTRESOURCEA(uCommand), NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1818,6 +1819,29 @@ void CDefView::DoActivate(UINT uState)
|
||||||
TRACE("--\n");
|
TRACE("--\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDefView::_DoCopyToMoveToFolder(BOOL bCopy)
|
||||||
|
{
|
||||||
|
if (!GetSelections())
|
||||||
|
return;
|
||||||
|
|
||||||
|
SFGAOF rfg = SFGAO_CANCOPY | SFGAO_CANMOVE | SFGAO_FILESYSTEM;
|
||||||
|
HRESULT hr = m_pSFParent->GetAttributesOf(m_cidl, m_apidl, &rfg);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!bCopy && !(rfg & SFGAO_CANMOVE))
|
||||||
|
return;
|
||||||
|
if (bCopy && !(rfg & SFGAO_CANCOPY))
|
||||||
|
return;
|
||||||
|
|
||||||
|
CComPtr<IContextMenu> pCM;
|
||||||
|
hr = m_pSFParent->GetUIObjectOf(m_hWnd, m_cidl, m_apidl, IID_IContextMenu, 0, (void **)&pCM);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
return;
|
||||||
|
|
||||||
|
InvokeContextMenuCommand(pCM, (bCopy ? "copyto" : "moveto"), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************
|
/**********************************************************
|
||||||
* ShellView_OnActivate()
|
* ShellView_OnActivate()
|
||||||
*/
|
*/
|
||||||
|
@ -1954,25 +1978,30 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHand
|
||||||
case FCIDM_SHVIEW_COPY:
|
case FCIDM_SHVIEW_COPY:
|
||||||
case FCIDM_SHVIEW_RENAME:
|
case FCIDM_SHVIEW_RENAME:
|
||||||
case FCIDM_SHVIEW_PROPERTIES:
|
case FCIDM_SHVIEW_PROPERTIES:
|
||||||
case FCIDM_SHVIEW_COPYTO:
|
|
||||||
case FCIDM_SHVIEW_MOVETO:
|
|
||||||
if (SHRestricted(REST_NOVIEWCONTEXTMENU))
|
if (SHRestricted(REST_NOVIEWCONTEXTMENU))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return OnExplorerCommand(dwCmdID, TRUE);
|
return OnExplorerCommand(dwCmdID, TRUE);
|
||||||
|
|
||||||
|
case FCIDM_SHVIEW_COPYTO:
|
||||||
|
case FCIDM_SHVIEW_MOVETO:
|
||||||
|
_DoCopyToMoveToFolder(dwCmdID == FCIDM_SHVIEW_COPYTO);
|
||||||
|
return 0;
|
||||||
|
|
||||||
case FCIDM_SHVIEW_INSERT:
|
case FCIDM_SHVIEW_INSERT:
|
||||||
case FCIDM_SHVIEW_UNDO:
|
case FCIDM_SHVIEW_UNDO:
|
||||||
case FCIDM_SHVIEW_INSERTLINK:
|
case FCIDM_SHVIEW_INSERTLINK:
|
||||||
case FCIDM_SHVIEW_NEWFOLDER:
|
case FCIDM_SHVIEW_NEWFOLDER:
|
||||||
return OnExplorerCommand(dwCmdID, FALSE);
|
return OnExplorerCommand(dwCmdID, FALSE);
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
/* WM_COMMAND messages from the file menu are routed to the CDefView so as to let m_pFileMenu handle the command */
|
/* WM_COMMAND messages from the file menu are routed to the CDefView so as to let m_pFileMenu handle the command */
|
||||||
if (m_pFileMenu && dwCmd == 0)
|
if (m_pFileMenu && dwCmd == 0)
|
||||||
{
|
{
|
||||||
HMENU Dummy = NULL;
|
HMENU Dummy = NULL;
|
||||||
MenuCleanup _(m_pFileMenu, Dummy);
|
MenuCleanup _(m_pFileMenu, Dummy);
|
||||||
InvokeContextMenuCommand(m_pFileMenu, dwCmdID, NULL);
|
InvokeContextMenuCommand(m_pFileMenu, MAKEINTRESOURCEA(dwCmdID), NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue