shell32: Show a confirmation before deleting files with syscalls.

This commit is contained in:
Mikołaj Zalewski 2006-07-06 20:46:21 +02:00 committed by Alexandre Julliard
parent 4485bf0b61
commit ea0a102d55
5 changed files with 12 additions and 0 deletions

View File

@ -164,6 +164,7 @@ STRINGTABLE DISCARDABLE
IDS_DELETEFOLDER_CAPTION "Confirm folder deletion" IDS_DELETEFOLDER_CAPTION "Confirm folder deletion"
IDS_DELETEITEM_TEXT "Are you sure you want to delete '%1'?" IDS_DELETEITEM_TEXT "Are you sure you want to delete '%1'?"
IDS_DELETEMULTIPLE_TEXT "Are you sure you want to delete these %1 items?" IDS_DELETEMULTIPLE_TEXT "Are you sure you want to delete these %1 items?"
IDS_DELETESELECTED_TEXT "Are you sure you want to delete the selected item(s)?"
IDS_OVERWRITEFILE_TEXT "OverWrite File %1?" IDS_OVERWRITEFILE_TEXT "OverWrite File %1?"
IDS_OVERWRITEFILE_CAPTION "Confirm File OverWrite" IDS_OVERWRITEFILE_CAPTION "Confirm File OverWrite"

View File

@ -147,6 +147,7 @@ void FreeChangeNotifications(void);
#define ASK_DELETE_MULTIPLE_ITEM 3 #define ASK_DELETE_MULTIPLE_ITEM 3
#define ASK_CREATE_FOLDER 4 #define ASK_CREATE_FOLDER 4
#define ASK_OVERWRITE_FILE 5 #define ASK_OVERWRITE_FILE 5
#define ASK_DELETE_SELECTED 6
BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pwszDir, BOOL bShowUI); BOOL SHELL_DeleteDirectoryW(HWND hwnd, LPCWSTR pwszDir, BOOL bShowUI);
BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir); BOOL SHELL_ConfirmDialogW(HWND hWnd, int nKindOfDialog, LPCWSTR szDir);

View File

@ -1825,8 +1825,12 @@ static HRESULT UNIXFS_delete_with_shfileop(UnixFolder *This, UINT cidl, LPCITEMI
static HRESULT UNIXFS_delete_with_syscalls(UnixFolder *This, UINT cidl, LPCITEMIDLIST *apidl) static HRESULT UNIXFS_delete_with_syscalls(UnixFolder *This, UINT cidl, LPCITEMIDLIST *apidl)
{ {
char szAbsolute[FILENAME_MAX], *pszRelative; char szAbsolute[FILENAME_MAX], *pszRelative;
static const WCHAR empty[] = {0};
int i; int i;
if (!SHELL_ConfirmDialogW(GetActiveWindow(), ASK_DELETE_SELECTED, empty))
return S_OK;
lstrcpyA(szAbsolute, This->m_pszPath); lstrcpyA(szAbsolute, This->m_pszPath);
pszRelative = szAbsolute + lstrlenA(szAbsolute); pszRelative = szAbsolute + lstrlenA(szAbsolute);

View File

@ -91,6 +91,11 @@ static BOOL SHELL_ConfirmIDs(int nKindOfDialog, SHELL_ConfirmIDstruc *ids)
ids->caption_resource_id = IDS_DELETEITEM_CAPTION; ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT; ids->text_resource_id = IDS_DELETEMULTIPLE_TEXT;
return TRUE; return TRUE;
case ASK_DELETE_SELECTED:
ids->icon_resource_id = IDI_SHELL_CONFIRM_DELETE;
ids->caption_resource_id = IDS_DELETEITEM_CAPTION;
ids->text_resource_id = IDS_DELETESELECTED_TEXT;
return TRUE;
case ASK_OVERWRITE_FILE: case ASK_OVERWRITE_FILE:
ids->hIconInstance = NULL; ids->hIconInstance = NULL;
ids->icon_resource_id = IDI_WARNING; ids->icon_resource_id = IDI_WARNING;

View File

@ -52,6 +52,7 @@
#define IDS_DELETEMULTIPLE_TEXT 35 #define IDS_DELETEMULTIPLE_TEXT 35
#define IDS_OVERWRITEFILE_CAPTION 36 #define IDS_OVERWRITEFILE_CAPTION 36
#define IDS_OVERWRITEFILE_TEXT 37 #define IDS_OVERWRITEFILE_TEXT 37
#define IDS_DELETESELECTED_TEXT 38
#define IDS_RESTART_TITLE 40 #define IDS_RESTART_TITLE 40
#define IDS_RESTART_PROMPT 41 #define IDS_RESTART_PROMPT 41