shell32/shlview: Remove redundant message sent on every iteration, fix a helper interface leak.
This commit is contained in:
parent
7ea711964b
commit
fc59d0b2f8
|
@ -1517,23 +1517,15 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
|
||||||
|
|
||||||
case LVN_KEYDOWN:
|
case LVN_KEYDOWN:
|
||||||
{
|
{
|
||||||
/* MSG msg;
|
|
||||||
msg.hwnd = This->hWnd;
|
|
||||||
msg.message = WM_KEYDOWN;
|
|
||||||
msg.wParam = plvKeyDown->wVKey;
|
|
||||||
msg.lParam = 0;
|
|
||||||
msg.time = 0;
|
|
||||||
msg.pt = 0;*/
|
|
||||||
|
|
||||||
LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
|
LPNMLVKEYDOWN plvKeyDown = (LPNMLVKEYDOWN) lpnmh;
|
||||||
|
|
||||||
/* initiate a rename of the selected file or directory */
|
/* initiate a rename of the selected file or directory */
|
||||||
if(plvKeyDown->wVKey == VK_F2)
|
switch (plvKeyDown->wVKey)
|
||||||
{
|
{
|
||||||
/* see how many files are selected */
|
case VK_F2:
|
||||||
int i = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
|
{
|
||||||
|
INT i = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0);
|
||||||
|
|
||||||
/* get selected item */
|
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
{
|
{
|
||||||
/* get selected item */
|
/* get selected item */
|
||||||
|
@ -1543,34 +1535,33 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
|
||||||
SendMessageW(This->hWndList, LVM_EDITLABELW, i, 0);
|
SendMessageW(This->hWndList, LVM_EDITLABELW, i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
break;
|
||||||
TranslateAccelerator(This->hWnd, This->hAccel, &msg)
|
case VK_DELETE:
|
||||||
#endif
|
|
||||||
else if(plvKeyDown->wVKey == VK_DELETE)
|
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i, count;
|
||||||
int item_index;
|
int item_index;
|
||||||
LVITEMA item;
|
LVITEMW item;
|
||||||
LPITEMIDLIST* pItems;
|
LPITEMIDLIST* pItems;
|
||||||
ISFHelper *psfhlp;
|
ISFHelper *psfhlp;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper,
|
hr = IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (void**)&psfhlp);
|
||||||
(LPVOID*)&psfhlp);
|
if (hr != S_OK) return 0;
|
||||||
|
|
||||||
if (psfhlp == NULL)
|
if(!(count = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0)))
|
||||||
break;
|
{
|
||||||
|
ISFHelper_Release(psfhlp);
|
||||||
if(!(i = SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0)))
|
return 0;
|
||||||
break;
|
}
|
||||||
|
|
||||||
/* allocate memory for the pidl array */
|
/* allocate memory for the pidl array */
|
||||||
pItems = HeapAlloc(GetProcessHeap(), 0,
|
pItems = HeapAlloc(GetProcessHeap(), 0, sizeof(LPITEMIDLIST) * count);
|
||||||
sizeof(LPITEMIDLIST) * i);
|
|
||||||
|
|
||||||
/* retrieve all selected items */
|
/* retrieve all selected items */
|
||||||
i = 0;
|
i = 0;
|
||||||
item_index = -1;
|
item_index = -1;
|
||||||
while(SendMessageW(This->hWndList, LVM_GETSELECTEDCOUNT, 0, 0) > i)
|
|
||||||
|
while (count > i)
|
||||||
{
|
{
|
||||||
/* get selected item */
|
/* get selected item */
|
||||||
item_index = SendMessageW(This->hWndList, LVM_GETNEXTITEM, item_index,
|
item_index = SendMessageW(This->hWndList, LVM_GETNEXTITEM, item_index,
|
||||||
|
@ -1587,18 +1578,19 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
|
||||||
|
|
||||||
/* perform the item deletion */
|
/* perform the item deletion */
|
||||||
ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
|
ISFHelper_DeleteItems(psfhlp, i, (LPCITEMIDLIST*)pItems);
|
||||||
|
ISFHelper_Release(psfhlp);
|
||||||
|
|
||||||
/* free pidl array memory */
|
/* free pidl array memory */
|
||||||
HeapFree(GetProcessHeap(), 0, pItems);
|
HeapFree(GetProcessHeap(), 0, pItems);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VK_F5:
|
||||||
/* Initiate a refresh */
|
/* Initiate a refresh */
|
||||||
else if(plvKeyDown->wVKey == VK_F5)
|
|
||||||
{
|
|
||||||
IShellView_Refresh((IShellView*)This);
|
IShellView_Refresh((IShellView*)This);
|
||||||
}
|
break;
|
||||||
|
|
||||||
else if(plvKeyDown->wVKey == VK_BACK)
|
case VK_BACK:
|
||||||
{
|
{
|
||||||
LPSHELLBROWSER lpSb;
|
LPSHELLBROWSER lpSb;
|
||||||
if((lpSb = (LPSHELLBROWSER)SendMessageW(This->hWndParent, CWM_GETISHELLBROWSER, 0, 0)))
|
if((lpSb = (LPSHELLBROWSER)SendMessageW(This->hWndParent, CWM_GETISHELLBROWSER, 0, 0)))
|
||||||
|
@ -1606,10 +1598,12 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn
|
||||||
IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT);
|
IShellBrowser_BrowseObject(lpSb, NULL, SBSP_PARENT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
else
|
default:
|
||||||
FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown->wVKey);
|
FIXME("LVN_KEYDOWN key=0x%08x\n", plvKeyDown->wVKey);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue