Author: janderwald Date: Thu Nov 1 01:56:24 2007 New Revision: 30029
URL: http://svn.reactos.org/svn/reactos?rev=30029&view=rev Log: - refresh folder when deleting an item - does not work for items placed on desktop yet because the desktop folder doesnot implement IPersistFolder2 interface - avoid using ISFHelper interface
Modified: trunk/reactos/dll/win32/shell32/shfldr_fs.c trunk/reactos/dll/win32/shell32/shv_item_cmenu.c
Modified: trunk/reactos/dll/win32/shell32/shfldr_fs.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shfldr_fs... ============================================================================== --- trunk/reactos/dll/win32/shell32/shfldr_fs.c (original) +++ trunk/reactos/dll/win32/shell32/shfldr_fs.c Thu Nov 1 01:56:24 2007 @@ -1170,7 +1170,7 @@ * Builds a list of paths like the one used in SHFileOperation from a table of * PIDLs relative to the given base folder */ -static WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls) +WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls) { WCHAR *wszPathsList; WCHAR *wszListPos;
Modified: trunk/reactos/dll/win32/shell32/shv_item_cmenu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shv_item_... ============================================================================== --- trunk/reactos/dll/win32/shell32/shv_item_cmenu.c (original) +++ trunk/reactos/dll/win32/shell32/shv_item_cmenu.c Thu Nov 1 01:56:24 2007 @@ -23,7 +23,7 @@ #define COBJMACROS #define NONAMELESSUNION #define NONAMELESSSTRUCT -//#define YDEBUG +#define YDEBUG #include "winerror.h" #include "wine/debug.h"
@@ -64,6 +64,7 @@
UINT SH_EnumerateDynamicContextHandlerForKey(LPWSTR szFileClass, ItemCmImpl *This, IDataObject * pDataObj, LPITEMIDLIST pidlFolder); +WCHAR *build_paths_list(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls);
static const IContextMenu2Vtbl cmvt;
@@ -510,17 +511,61 @@ * * deletes the currently selected items */ -static void DoDelete(IContextMenu2 *iface) +static void DoDelete(IContextMenu2 *iface, HWND hwnd) { ItemCmImpl *This = (ItemCmImpl *)iface; - ISFHelper * psfhlp; - - IShellFolder_QueryInterface(This->pSFParent, &IID_ISFHelper, (LPVOID*)&psfhlp); - if (psfhlp) - { - ISFHelper_DeleteItems(psfhlp, This->cidl, (LPCITEMIDLIST *)This->apidl); - ISFHelper_Release(psfhlp); - } + WCHAR szPath[MAX_PATH]; + WCHAR * szTarget; + SHFILEOPSTRUCTW op; + LPSHELLBROWSER lpSB; + LPSHELLVIEW lpSV; + IPersistFolder3 * psf; + LPITEMIDLIST pidl; + STRRET strTemp; + + if (IShellFolder2_QueryInterface(This->pSFParent, &IID_IPersistFolder2, (LPVOID*)&psf) != S_OK) + { + ERR("Failed to get interface IID_IPersistFolder2\n"); + return; + } + if (IPersistFolder2_GetCurFolder(psf, &pidl) != S_OK) + { + ERR("IPersistFolder2_GetCurFolder failed\n"); + IShellFolder2_Release(psf); + return; + } + + if (IShellFolder2_GetDisplayNameOf(This->pSFParent, pidl, SHGDN_FORPARSING, &strTemp) != S_OK) + { + ERR("IShellFolder_GetDisplayNameOf failed\n"); + IShellFolder2_Release(psf); + return; + } + StrRetToBufW(&strTemp, pidl, szPath, MAX_PATH); + IShellFolder2_Release(psf); + + szTarget = build_paths_list(szPath, This->cidl, This->apidl); + + if (pidl) + { + if (SHGetPathFromIDListW(pidl, szPath)) + { + ZeroMemory(&op, sizeof(op)); + op.hwnd = GetActiveWindow(); + op.wFunc = FO_DELETE; + op.pFrom = szTarget; + op.fFlags = FOF_ALLOWUNDO; + SHFileOperationW(&op); + } + } + + if ((lpSB = (LPSHELLBROWSER)SendMessageA(hwnd, CWM_GETISHELLBROWSER,0,0))) + { + if (SUCCEEDED(IShellBrowser_QueryActiveShellView(lpSB, &lpSV))) + { + IShellView_Refresh(lpSV); + } + } }
/************************************************************************** @@ -673,7 +718,7 @@ break; case FCIDM_SHVIEW_DELETE: TRACE("Verb FCIDM_SHVIEW_DELETE\n"); - DoDelete(iface); + DoDelete(iface, lpcmi->hwnd); break; case FCIDM_SHVIEW_COPY: TRACE("Verb FCIDM_SHVIEW_COPY\n"); @@ -690,7 +735,7 @@ default: if (LOWORD(lpcmi->lpVerb) >= This->iIdSHEFirst && LOWORD(lpcmi->lpVerb) <= This->iIdSHELast) { - return DoShellExtensions(iface, lpcmi); + return DoShellExtensions(This, lpcmi); } FIXME("Unhandled Verb %xl\n",LOWORD(lpcmi->lpVerb)); } @@ -699,7 +744,7 @@ { TRACE("Verb is %s\n",debugstr_a(lpcmi->lpVerb)); if (strcmp(lpcmi->lpVerb,"delete")==0) - DoDelete(iface); + DoDelete(iface, lpcmi->hwnd); else FIXME("Unhandled string verb %s\n",debugstr_a(lpcmi->lpVerb)); }