Commit 5803b168 authored by Alexandre Julliard's avatar Alexandre Julliard

shell32: Reimplement trash support using Win32 APIs.

parent 0cdb12ae
......@@ -49,9 +49,7 @@ C_SRCS = \
shlview.c \
shlview_cmenu.c \
shpolicy.c \
systray.c \
trash.c \
xdg.c
systray.c
RC_SRCS = shell32.rc
......
......@@ -56,6 +56,9 @@ HRESULT SHELL32_BindToChild (LPCITEMIDLIST pidlRoot, const CLSID *clsidChild,
HRESULT SHELL32_CompareIDs(IShellFolder2 *iface, LPARAM lParam, LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2) DECLSPEC_HIDDEN;
LPITEMIDLIST SHELL32_CreatePidlFromBindCtx(IBindCtx *pbc, LPCWSTR path) DECLSPEC_HIDDEN;
BOOL is_trash_available(void) DECLSPEC_HIDDEN;
BOOL trash_file( const WCHAR *path ) DECLSPEC_HIDDEN;
static inline int SHELL32_GUIDToStringA (REFGUID guid, LPSTR str)
{
return sprintf(str, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
......
......@@ -27,6 +27,7 @@
#define COBJMACROS
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
......@@ -42,9 +43,9 @@
#define NO_SHLWAPI_STREAM
#include "shlwapi.h"
#include "shell32_main.h"
#include "shfldr.h"
#include "undocshell.h"
#include "wine/debug.h"
#include "xdg.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
......@@ -1345,8 +1346,7 @@ static int delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom)
return ERROR_SUCCESS;
/* Windows also checks only the first item */
bTrash = (lpFileOp->fFlags & FOF_ALLOWUNDO)
&& TRASH_CanTrashFile(flFrom->feFiles[0].szFullPath);
bTrash = (lpFileOp->fFlags & FOF_ALLOWUNDO) && is_trash_available();
if (!(lpFileOp->fFlags & FOF_NOCONFIRMATION) || (!bTrash && lpFileOp->fFlags & FOF_WANTNUKEWARNING))
if (!confirm_delete_list(lpFileOp->hwnd, lpFileOp->fFlags, bTrash, flFrom))
......@@ -1366,7 +1366,7 @@ static int delete_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom)
if (bTrash)
{
BOOL bDelete;
if (TRASH_TrashFile(fileEntry->szFullPath))
if (trash_file(fileEntry->szFullPath))
continue;
/* Note: Windows silently deletes the file in such a situation, we show a dialog */
......
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __XDG_H__
#define __XDG_H__
/*
* XDG directories access
*/
#define XDG_DATA_HOME 0
#define XDG_CONFIG_HOME 1
#define XDG_DATA_DIRS 2
#define XDG_CONFIG_DIRS 3
#define XDG_CACHE_HOME 4
char *XDG_BuildPath(int root_id, const char *subpath) DECLSPEC_HIDDEN;
int XDG_MakeDirs(const char *path) DECLSPEC_HIDDEN;
#define XDG_URLENCODE 0x1
BOOL XDG_WriteDesktopStringEntry(int fd, const char *keyName, DWORD dwFlags, const char *value) DECLSPEC_HIDDEN;
typedef struct tagXDG_PARSED_FILE XDG_PARSED_FILE;
XDG_PARSED_FILE *XDG_ParseDesktopFile(int fd) DECLSPEC_HIDDEN;
char *XDG_GetStringValue(XDG_PARSED_FILE *file, const char *group_name, const char *value_name, DWORD dwFlags) DECLSPEC_HIDDEN;
void XDG_FreeParsedFile(XDG_PARSED_FILE *file) DECLSPEC_HIDDEN;
BOOL TRASH_CanTrashFile(LPCWSTR wszPath) DECLSPEC_HIDDEN;
BOOL TRASH_TrashFile(LPCWSTR wszPath) DECLSPEC_HIDDEN;
HRESULT TRASH_UnpackItemID(LPCSHITEMID id, WIN32_FIND_DATAW *data) DECLSPEC_HIDDEN;
HRESULT TRASH_EnumItems(const WCHAR *path, LPITEMIDLIST **pidls, int *count) DECLSPEC_HIDDEN;
HRESULT TRASH_RestoreItem(LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
HRESULT TRASH_EraseItem(LPCITEMIDLIST pidl) DECLSPEC_HIDDEN;
#endif /* ndef __XDG_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment