*
* FIXME: add to recent docs
*
- * FIXME: flags not implemented: OFN_CREATEPROMPT, OFN_DONTADDTORECENT,
+ * FIXME: flags not implemented: OFN_DONTADDTORECENT,
* OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING,
* OFN_NODEREFERENCELINKS, OFN_NOREADONLYRETURN,
* OFN_NOTESTFILECREATE, OFN_USEMONIKERS
#include "windef.h"
#include "winbase.h"
-#include "winreg.h"
#include "winternl.h"
#include "winnls.h"
#include "wingdi.h"
-#include "winuser.h"
#include "winreg.h"
+#include "winuser.h"
#include "commdlg.h"
#include "dlgs.h"
#include "cdlg.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
#define UNIMPLEMENTED_FLAGS \
-(OFN_CREATEPROMPT | OFN_DONTADDTORECENT |\
+(OFN_DONTADDTORECENT |\
OFN_ENABLEINCLUDENOTIFY | OFN_ENABLESIZING |\
OFN_NODEREFERENCELINKS | OFN_NOREADONLYRETURN |\
OFN_NOTESTFILECREATE /*| OFN_USEMONIKERS*/)
fodInfos->ofnInfos->hwndOwner,
FileOpenDlgProc95,
(LPARAM) fodInfos);
- if (SUCCEEDED(hr))
+ if (SUCCEEDED(hr))
OleUninitialize();
/* Unable to create the dialog */
static BOOL COMDLG32_GetDisplayNameOf(LPCITEMIDLIST pidl, LPWSTR pwszPath) {
LPSHELLFOLDER psfDesktop;
STRRET strret;
-
+
if (FAILED(SHGetDesktopFolder(&psfDesktop)))
return FALSE;
However, if there is a static text component with the stc32 id, a special case happens.
The x and y coordinates of stc32 indicate the top left corner where to place the standard file dialog box
in the window and the cx and cy indicate how to size the window.
- Moreover, if the new component's coordinates are on the left of the stc32 , it is placed on the left
+ Moreover, if the new component's coordinates are on the left of the stc32 , it is placed on the left
of the standard file dialog box. If they are above the stc32 component, it is placed above and so on....
-
+
*/
GetClientRect(hwndParentDlg, &rectParent);
else
{
LPSTR bufA = buffer;
- total = WideCharToMultiByte(CP_ACP, 0, lpstrCurrentDir, -1,
+ total = WideCharToMultiByte(CP_ACP, 0, lpstrCurrentDir, -1,
NULL, 0, NULL, NULL);
- total += WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
+ total += WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
NULL, 0, NULL, NULL);
/* Prepend the current path */
- n = WideCharToMultiByte(CP_ACP, 0, lpstrCurrentDir, -1,
+ n = WideCharToMultiByte(CP_ACP, 0, lpstrCurrentDir, -1,
bufA, size, NULL, NULL);
if(n<size)
{
/* 'n' includes trailing \0 */
bufA[n-1] = '\\';
- WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
+ WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
&bufA[n], size-n, NULL, NULL);
}
case CDM_GETFOLDERPATH:
TRACE("CDM_GETFOLDERPATH:\n");
COMDLG32_GetDisplayNameOf(fodInfos->ShellInfos.pidlAbsCurrent, lpstrPath);
- if (lParam)
+ if (lParam)
{
if (fodInfos->unicode)
lstrcpynW((LPWSTR)lParam, lpstrPath, (int)wParam);
else
- WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
+ WideCharToMultiByte(CP_ACP, 0, lpstrPath, -1,
(LPSTR)lParam, (int)wParam, NULL, NULL);
- }
+ }
retval = lstrlenW(lpstrPath);
break;
TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_w(lpszTemp), lpsf);
/* append a backslash to drive letters */
- if(lstrlenW(lpwstrTemp)==2 && lpwstrTemp[1] == ':' &&
+ if(lstrlenW(lpwstrTemp)==2 && lpwstrTemp[1] == ':' &&
((lpwstrTemp[0] >= 'a' && lpwstrTemp[0] <= 'z') ||
- (lpwstrTemp[0] >= 'A' && lpwstrTemp[0] <= 'Z')))
+ (lpwstrTemp[0] >= 'A' && lpwstrTemp[0] <= 'Z')))
{
PathAddBackslashW(lpwstrTemp);
}
{
/* if no extension is specified with file name, then */
/* attach the extension from file filter or default one */
-
+
WCHAR *filterExt = NULL;
LPWSTR lpstrFilter = NULL;
static const WCHAR szwDot[] = {'.',0};
/* Attach the dot*/
lstrcatW(lpstrPathAndFile, szwDot);
-
+
/*Get the file extension from file type filter*/
lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
fodInfos->ofnInfos->nFilterIndex-1);
}
}
+ /* In Open dialog: check if it should be created if it doesn't exist */
+ if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG)
+ && fodInfos->ofnInfos->Flags & OFN_CREATEPROMPT
+ && !PathFileExistsW(lpstrPathAndFile))
+ {
+ WCHAR lpstrCreate[100];
+ int answer;
+
+ LoadStringW(COMDLG32_hInstance, IDS_CREATEFILE, lpstrCreate, 100);
+ answer = MessageBoxW(hwnd, lpstrCreate, fodInfos->title,
+ MB_YESNO | MB_ICONEXCLAMATION);
+ if (answer == IDNO)
+ {
+ ret = FALSE;
+ goto ret;
+ }
+ }
+
/* Check that the size of the file does not exceed buffer size.
(Allow for extra \0 if OFN_MULTISELECT is set.) */
if(lstrlenW(lpstrPathAndFile) < fodInfos->ofnInfos->nMaxFile -
* Initialisation of the look in combo box
*/
-/* Small helper function, to determine if the unixfs shell extension is rooted
- * at the desktop. Copied from dlls/shell32/shfldr_unixfs.c.
+/* Small helper function, to determine if the unixfs shell extension is rooted
+ * at the desktop. Copied from dlls/shell32/shfldr_unixfs.c.
*/
static inline BOOL FILEDLG95_unixfs_is_rooted_at_desktop(void) {
HKEY hKey;
'N','a','m','e','S','p','a','c','e','\\','{','9','D','2','0','A','A','E','8',
'-','0','6','2','5','-','4','4','B','0','-','9','C','A','7','-',
'7','1','8','8','9','C','2','2','5','4','D','9','}',0 };
-
+
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRootedAtDesktop, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
return FALSE;
-
+
RegCloseKey(hKey);
return TRUE;
}
/* set item height for both text field and listbox */
CBSetItemHeight(hwndCombo,-1,GetSystemMetrics(SM_CYSMICON));
CBSetItemHeight(hwndCombo,0,GetSystemMetrics(SM_CYSMICON));
-
+
/* Turn on the extended UI for the combo box like Windows does */
CBSetExtendedUI(hwndCombo, TRUE);
FILEDLG95_LOOKIN_AddItem(hwndCombo, pidlTmp,LISTEND);
/* If the unixfs extension is rooted, we don't expand the drives by default */
- if (!FILEDLG95_unixfs_is_rooted_at_desktop())
+ if (!FILEDLG95_unixfs_is_rooted_at_desktop())
{
/* special handling for CSIDL_DRIVES */
if (COMDLG32_PIDL_ILIsEqual(pidlTmp, pidlDrives))
}
}
SetWindowTextW( fodInfos->DlgInfos.hwndFileName, lpstrAllFile );
-
- /* Select the file name like Windows does */
+
+ /* Select the file name like Windows does */
SendMessageW(fodInfos->DlgInfos.hwndFileName, EM_SETSEL, 0, (LPARAM)-1);
}
HeapFree(GetProcessHeap(),0, lpstrAllFile );
if (!doSelected)
return NULL;
-
+
/* Set the FORMATETC structure*/
SETDefFormatEtc(formatetc, RegisterClipboardFormatA(CFSTR_SHELLIDLIST), TYMED_HGLOBAL);