From 7d75e41b42f520a4ab0cd61d3e1f7fdd4049fa84 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Wed, 13 Aug 2008 08:45:20 +0000 Subject: [PATCH] - implement deleting file using recyclebin api - play a sound on when requested using the user default for emptying recycle bin - rename shlfldr_mydocuments.c svn path=/trunk/; revision=35301 --- reactos/dll/win32/shell32/shell32.rbuild | 3 +- reactos/dll/win32/shell32/shellord.c | 55 +++++++++++++++++-- ...ldr_mydocuments.c => shfldr_mydocuments.c} | 0 reactos/dll/win32/shell32/shfldr_recyclebin.c | 6 +- 4 files changed, 55 insertions(+), 9 deletions(-) rename reactos/dll/win32/shell32/{shlfldr_mydocuments.c => shfldr_mydocuments.c} (100%) diff --git a/reactos/dll/win32/shell32/shell32.rbuild b/reactos/dll/win32/shell32/shell32.rbuild index 2f79efe89e6..b3de9c6068e 100644 --- a/reactos/dll/win32/shell32/shell32.rbuild +++ b/reactos/dll/win32/shell32/shell32.rbuild @@ -24,6 +24,7 @@ version devmgr winspool + winmm authors.c autocomplete.c brsfolder.c @@ -54,7 +55,7 @@ shfldr_desktop.c shfldr_fs.c shfldr_mycomp.c - shlfldr_mydocuments.c + shfldr_mydocuments.c shfldr_printers.c shlexec.c shlfileop.c diff --git a/reactos/dll/win32/shell32/shellord.c b/reactos/dll/win32/shell32/shellord.c index a221859af01..e43907f2b33 100644 --- a/reactos/dll/win32/shell32/shellord.c +++ b/reactos/dll/win32/shell32/shellord.c @@ -1962,14 +1962,18 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, return FALSE; } - +/************************************************************************* + * SHStartNetConnectionDialog (SHELL32.@) + */ HRESULT WINAPI SHStartNetConnectionDialog(HWND hwnd, LPCSTR pszRemoteName, DWORD dwType) { FIXME("%p, %s, 0x%08x - stub\n", hwnd, debugstr_a(pszRemoteName), dwType); return S_OK; } - +/************************************************************************* + * SHEmptyRecycleBinA (SHELL32.@) + */ HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags) { LPWSTR szRootPathW = NULL; @@ -2001,16 +2005,55 @@ HRESULT WINAPI SHEmptyRecycleBinA(HWND hwnd, LPCSTR pszRootPath, DWORD dwFlags) HRESULT WINAPI SHEmptyRecycleBinW(HWND hwnd, LPCWSTR pszRootPath, DWORD dwFlags) { - BOOL ret; + WCHAR szPath[MAX_PATH] = {0}; + DWORD dwSize, dwType; + LONG ret; TRACE("%p, %s, 0x%08x\n", hwnd, debugstr_w(pszRootPath), dwFlags); - FIXME("0x%08x flags ignored\n", dwFlags); - ret = EmptyRecycleBinW(pszRootPath); + if (!(dwFlags & SHERB_NOCONFIRMATION)) + { + /* FIXME + * enumerate available files + * show confirmation dialog + */ + FIXME("show confirmation dialog\n"); + } + + if (dwFlags & SHERB_NOPROGRESSUI) + { + ret = EmptyRecycleBinW(pszRootPath); + } + else + { + /* FIXME + * show a progress dialog + */ + ret = EmptyRecycleBinW(pszRootPath); + } + if (!ret) return HRESULT_FROM_WIN32(GetLastError()); - /* FIXME: update icon? */ + if (!(dwFlags & SHERB_NOSOUND)) + { + dwSize = sizeof(szPath); + ret = RegGetValueW(HKEY_CURRENT_USER, + L"AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current", + NULL, + RRF_RT_REG_EXPAND_SZ, + &dwType, + (PVOID)szPath, + &dwSize); + if (ret != ERROR_SUCCESS) + return S_OK; + + if (dwType != REG_EXPAND_SZ) /* type dismatch */ + return S_OK; + + szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0'; + PlaySoundW(szPath, NULL, SND_FILENAME); + } return S_OK; } diff --git a/reactos/dll/win32/shell32/shlfldr_mydocuments.c b/reactos/dll/win32/shell32/shfldr_mydocuments.c similarity index 100% rename from reactos/dll/win32/shell32/shlfldr_mydocuments.c rename to reactos/dll/win32/shell32/shfldr_mydocuments.c diff --git a/reactos/dll/win32/shell32/shfldr_recyclebin.c b/reactos/dll/win32/shell32/shfldr_recyclebin.c index 6e5d7e6adff..aae4772cdf5 100644 --- a/reactos/dll/win32/shell32/shfldr_recyclebin.c +++ b/reactos/dll/win32/shell32/shfldr_recyclebin.c @@ -1109,8 +1109,7 @@ static HRESULT WINAPI RecycleBin_IContextMenu2Item_InvokeCommand( } else { - FIXME("implement delete\n"); - CloseRecycleBinHandle(Context.hDeletedFile); + DeleteFileHandleToRecycleBin(Context.hDeletedFile); return E_NOTIMPL; } } @@ -1647,5 +1646,8 @@ TRASH_TrashFile(LPCWSTR wszPath) HRESULT WINAPI SHUpdateRecycleBinIcon(void) { FIXME("stub\n"); + + + return S_OK; }