Module: wine Branch: master Commit: 0a32123d106284a5678f90182926af4acaa1363a URL: http://source.winehq.org/git/wine.git/?a=commit;h=0a32123d106284a5678f901829...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Tue Mar 23 03:30:04 2010 +0300
shell32: Add IShellFolderView::RemoveObject for IShellView.
---
dlls/shell32/shlview.c | 73 ++++++++++++++++++++++------------------- dlls/shell32/tests/shlview.c | 6 +++ 2 files changed, 45 insertions(+), 34 deletions(-)
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 13b7c92..3049c1b 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -585,19 +585,6 @@ static BOOLEAN LV_AddItem(IShellViewImpl * This, LPCITEMIDLIST pidl) }
/********************************************************** -* LV_DeleteItem() -*/ -static BOOLEAN LV_DeleteItem(IShellViewImpl * This, LPCITEMIDLIST pidl) -{ - int nIndex; - - TRACE("(%p)(pidl=%p)\n", This, pidl); - - nIndex = LV_FindItemByPidl(This, ILFindLastID(pidl)); - return (-1==SendMessageW(This->hWndList, LVM_DELETEITEM, nIndex, 0))? FALSE: TRUE; -} - -/********************************************************** * LV_RenameItem() */ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCITEMIDLIST pidlNew ) @@ -1608,28 +1595,33 @@ static LRESULT ShellView_OnNotify(IShellViewImpl * This, UINT CtlID, LPNMHDR lpn * ShellView_OnChange() */
-static LRESULT ShellView_OnChange(IShellViewImpl * This, const LPCITEMIDLIST * Pidls, LONG wEventId) +static LRESULT ShellView_OnChange(IShellViewImpl * This, const LPCITEMIDLIST *pidls, LONG event) { + BOOL ret = TRUE;
- TRACE("(%p)(%p,%p,0x%08x)\n", This, Pidls[0], Pidls[1], wEventId); - switch(wEventId) - { - case SHCNE_MKDIR: - case SHCNE_CREATE: - LV_AddItem(This, Pidls[0]); - break; - case SHCNE_RMDIR: - case SHCNE_DELETE: - LV_DeleteItem(This, Pidls[0]); - break; - case SHCNE_RENAMEFOLDER: - case SHCNE_RENAMEITEM: - LV_RenameItem(This, Pidls[0], Pidls[1]); - break; - case SHCNE_UPDATEITEM: + TRACE("(%p)->(%p, %p, 0x%08x)\n", This, pidls[0], pidls[1], event); + + switch (event) + { + case SHCNE_MKDIR: + case SHCNE_CREATE: + LV_AddItem(This, pidls[0]); + break; + case SHCNE_RMDIR: + case SHCNE_DELETE: + { + INT i = LV_FindItemByPidl(This, ILFindLastID(pidls[0])); + ret = SendMessageW(This->hWndList, LVM_DELETEITEM, i, 0); + break; + } + case SHCNE_RENAMEFOLDER: + case SHCNE_RENAMEITEM: + LV_RenameItem(This, pidls[0], pidls[1]); + break; + case SHCNE_UPDATEITEM: break; - } - return TRUE; + } + return ret; } /********************************************************** * ShellView_WndProc @@ -2989,8 +2981,21 @@ static HRESULT WINAPI IShellFolderView_fnRemoveObject( UINT *item) { IShellViewImpl *This = impl_from_IShellFolderView(iface); - FIXME("(%p)->(%p %p) stub\n", This, pidl, item); - return E_NOTIMPL; + + TRACE("(%p)->(%p %p)\n", This, pidl, item); + + if (pidl) + { + *item = LV_FindItemByPidl(This, ILFindLastID(pidl)); + SendMessageW(This->hWndList, LVM_DELETEITEM, *item, 0); + } + else + { + *item = 0; + SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0); + } + + return S_OK; }
static HRESULT WINAPI IShellFolderView_fnGetObjectCount( diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c index f3d3809..35b001a 100644 --- a/dlls/shell32/tests/shlview.c +++ b/dlls/shell32/tests/shlview.c @@ -581,6 +581,12 @@ static void test_IShellFolderView(void) ok(hr == S_OK, "got (0x%08x)\n", hr); ok(i == 0xdeadbeef, "got %d\n", i);
+ /* ::RemoveObject */ + i = 0xdeadbeef; + hr = IShellFolderView_RemoveObject(folderview, NULL, &i); + ok(hr == S_OK, "got (0x%08x)\n", hr); + ok(i == 0, "got %d\n", i); + IShellFolderView_Release(folderview);
IShellView_Release(view);