Commit 7df7cdb6 authored by Rolf Kalbermatter's avatar Rolf Kalbermatter Committed by Alexandre Julliard

Introduced some declarations and resources needed for a more complete

implementation of SHFileOperation.
parent 31a7cad4
...@@ -160,13 +160,15 @@ void InitChangeNotifications(void); ...@@ -160,13 +160,15 @@ void InitChangeNotifications(void);
void FreeChangeNotifications(void); void FreeChangeNotifications(void);
/* file operation */ /* file operation */
#define ASK_DELETE_FILE 1 #define ASK_DELETE_FILE 1
#define ASK_DELETE_FOLDER 2 #define ASK_DELETE_FOLDER 2
#define ASK_DELETE_MULTIPLE_ITEM 3 #define ASK_DELETE_MULTIPLE_ITEM 3
#define ASK_CREATE_FOLDER 4
#define ASK_OVERWRITE_FILE 5
BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI); BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI);
BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI); BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI);
BOOL SHELL_WarnItemDelete(int nKindOfDialog, LPCSTR szDir); BOOL SHELL_ConfirmDialog(int nKindOfDialog, LPCSTR szDir);
/* 16-bit functions */ /* 16-bit functions */
void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b); void WINAPI DragAcceptFiles16(HWND16 hWnd, BOOL16 b);
......
...@@ -978,7 +978,7 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC ...@@ -978,7 +978,7 @@ static HRESULT WINAPI ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPC
char tmp[8]; char tmp[8];
snprintf (tmp, sizeof (tmp), "%d", cidl); snprintf (tmp, sizeof (tmp), "%d", cidl);
if (!SHELL_WarnItemDelete (ASK_DELETE_MULTIPLE_ITEM, tmp)) if (!SHELL_ConfirmDialog(ASK_DELETE_MULTIPLE_ITEM, tmp))
return E_FAIL; return E_FAIL;
bConfirm = FALSE; bConfirm = FALSE;
} }
......
...@@ -35,41 +35,39 @@ ...@@ -35,41 +35,39 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
BOOL SHELL_WarnItemDelete (int nKindOfDialog, LPCSTR szDir) BOOL SHELL_ConfirmDialog (int nKindOfDialog, LPCSTR szDir)
{ {
char szCaption[255], szText[255], szBuffer[MAX_PATH + 256]; char szCaption[255], szText[255], szBuffer[MAX_PATH + 256];
UINT caption_resource_id, text_resource_id;
if(nKindOfDialog == ASK_DELETE_FILE)
{ switch(nKindOfDialog) {
LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText,
sizeof(szText)); case ASK_DELETE_FILE:
LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, caption_resource_id = IDS_DELETEITEM_CAPTION;
szCaption, sizeof(szCaption)); text_resource_id = IDS_DELETEITEM_TEXT;
} break;
else if(nKindOfDialog == ASK_DELETE_FOLDER) case ASK_DELETE_FOLDER:
{ caption_resource_id = IDS_DELETEFOLDER_CAPTION;
LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText, text_resource_id = IDS_DELETEITEM_TEXT;
sizeof(szText)); break;
LoadStringA(shell32_hInstance, IDS_DELETEFOLDER_CAPTION, case ASK_DELETE_MULTIPLE_ITEM:
szCaption, sizeof(szCaption)); caption_resource_id = IDS_DELETEITEM_CAPTION;
} text_resource_id = IDS_DELETEMULTIPLE_TEXT;
else if(nKindOfDialog == ASK_DELETE_MULTIPLE_ITEM) break;
{ case ASK_OVERWRITE_FILE:
LoadStringA(shell32_hInstance, IDS_DELETEMULTIPLE_TEXT, szText, caption_resource_id = IDS_OVERWRITEFILE_CAPTION;
sizeof(szText)); text_resource_id = IDS_OVERWRITEFILE_TEXT;
LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION, break;
szCaption, sizeof(szCaption)); default:
} FIXME(" Unhandled nKindOfDialog %d stub\n", nKindOfDialog);
else { return FALSE;
FIXME("Called without a valid nKindOfDialog specified!\n");
LoadStringA(shell32_hInstance, IDS_DELETEITEM_TEXT, szText,
sizeof(szText));
LoadStringA(shell32_hInstance, IDS_DELETEITEM_CAPTION,
szCaption, sizeof(szCaption));
} }
FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, LoadStringA(shell32_hInstance, caption_resource_id, szCaption, sizeof(szCaption));
szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)&szDir); LoadStringA(shell32_hInstance, text_resource_id, szText, sizeof(szText));
FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY,
szText, 0, 0, szBuffer, sizeof(szBuffer), (va_list*)&szDir);
return (IDOK == MessageBoxA(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION)); return (IDOK == MessageBoxA(GetActiveWindow(), szBuffer, szCaption, MB_OKCANCEL | MB_ICONEXCLAMATION));
} }
...@@ -91,7 +89,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) ...@@ -91,7 +89,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI)
PathAddBackslashA(szTemp); PathAddBackslashA(szTemp);
strcat(szTemp, "*.*"); strcat(szTemp, "*.*");
if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FOLDER, pszDir)) if (bShowUI && !SHELL_ConfirmDialog(ASK_DELETE_FOLDER, pszDir))
return FALSE; return FALSE;
if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd))) if(INVALID_HANDLE_VALUE != (hFind = FindFirstFileA(szTemp, &wfd)))
...@@ -124,7 +122,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) ...@@ -124,7 +122,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI)
BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI) BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI)
{ {
if (bShowUI && !SHELL_WarnItemDelete(ASK_DELETE_FILE, pszFile)) if (bShowUI && !SHELL_ConfirmDialog(ASK_DELETE_FILE, pszFile))
return FALSE; return FALSE;
return DeleteFileA(pszFile); return DeleteFileA(pszFile);
......
...@@ -152,6 +152,8 @@ STRINGTABLE DISCARDABLE ...@@ -152,6 +152,8 @@ STRINGTABLE DISCARDABLE
IDS_DELETEFOLDER_CAPTION "Confirm folder delete" IDS_DELETEFOLDER_CAPTION "Confirm folder delete"
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_OVERWRITEFILE_TEXT "OverWrite File %1?"
IDS_OVERWRITEFILE_CAPTION "Confirm File OverWrite"
} }
shv_accel ACCELERATORS shv_accel ACCELERATORS
......
...@@ -46,6 +46,8 @@ ...@@ -46,6 +46,8 @@
#define IDS_DELETEFOLDER_CAPTION 33 #define IDS_DELETEFOLDER_CAPTION 33
#define IDS_DELETEITEM_TEXT 34 #define IDS_DELETEITEM_TEXT 34
#define IDS_DELETEMULTIPLE_TEXT 35 #define IDS_DELETEMULTIPLE_TEXT 35
#define IDS_OVERWRITEFILE_CAPTION 36
#define IDS_OVERWRITEFILE_TEXT 37
/* browse for folder dialog box */ /* browse for folder dialog box */
#define IDD_STATUS 0x3743 #define IDD_STATUS 0x3743
......
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