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