If a folder is selected on Open then browse into it, otherwise we
should return the path in the edit box whether that be a folder or a file. Don't add extensions to a folder.
This commit is contained in:
parent
7572fd3870
commit
2ea56681ba
|
@ -1712,9 +1712,8 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
|
||||||
*
|
*
|
||||||
* If the function succeeds, the return value is nonzero.
|
* If the function succeeds, the return value is nonzero.
|
||||||
*/
|
*/
|
||||||
#define ONOPEN_BROWSE 1
|
#define ONOPEN_OPEN 1
|
||||||
#define ONOPEN_OPEN 2
|
#define ONOPEN_SEARCH 2
|
||||||
#define ONOPEN_SEARCH 3
|
|
||||||
static void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText)
|
static void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText)
|
||||||
{
|
{
|
||||||
WCHAR strMsgTitle[MAX_PATH];
|
WCHAR strMsgTitle[MAX_PATH];
|
||||||
|
@ -1741,15 +1740,15 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
|
|
||||||
TRACE("hwnd=%p\n", hwnd);
|
TRACE("hwnd=%p\n", hwnd);
|
||||||
|
|
||||||
|
if(BrowseSelectedFolder(hwnd))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* get the files from the edit control */
|
/* get the files from the edit control */
|
||||||
nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed, '\0');
|
nFileCount = FILEDLG95_FILENAME_GetFileNames(hwnd, &lpstrFileList, &sizeUsed, '\0');
|
||||||
|
|
||||||
/* try if the user selected a folder in the shellview */
|
/* try if the user selected a folder in the shellview */
|
||||||
if(nFileCount == 0)
|
if(nFileCount == 0)
|
||||||
{
|
|
||||||
BrowseSelectedFolder(hwnd);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
|
|
||||||
if(nFileCount > 1)
|
if(nFileCount > 1)
|
||||||
{
|
{
|
||||||
|
@ -1810,7 +1809,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
lpstrPathAndFile: cleaned up path
|
lpstrPathAndFile: cleaned up path
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nOpenAction = ONOPEN_BROWSE;
|
nOpenAction = ONOPEN_OPEN;
|
||||||
|
|
||||||
/* don't apply any checks with OFN_NOVALIDATE */
|
/* don't apply any checks with OFN_NOVALIDATE */
|
||||||
{
|
{
|
||||||
|
@ -1943,6 +1942,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
int iPos;
|
int iPos;
|
||||||
LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
|
LPWSTR lpszTemp = PathFindFileNameW(lpstrPathAndFile);
|
||||||
DWORD len;
|
DWORD len;
|
||||||
|
IPersistFolder2 * ppf2;
|
||||||
|
|
||||||
/* replace the current filter */
|
/* replace the current filter */
|
||||||
if(fodInfos->ShellInfos.lpstrCurrentFilter)
|
if(fodInfos->ShellInfos.lpstrCurrentFilter)
|
||||||
|
@ -1954,12 +1954,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
/* set the filter cb to the extension when possible */
|
/* set the filter cb to the extension when possible */
|
||||||
if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
|
if(-1 < (iPos = FILEDLG95_FILETYPE_SearchExt(fodInfos->DlgInfos.hwndFileTypeCB, lpszTemp)))
|
||||||
CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, iPos);
|
CBSetCurSel(fodInfos->DlgInfos.hwndFileTypeCB, iPos);
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
case ONOPEN_BROWSE: /* browse to the highest folder we could bind to */
|
|
||||||
TRACE("ONOPEN_BROWSE\n");
|
|
||||||
{
|
|
||||||
IPersistFolder2 * ppf2;
|
|
||||||
if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
|
if(SUCCEEDED(IShellFolder_QueryInterface( lpsf, &IID_IPersistFolder2, (LPVOID*)&ppf2)))
|
||||||
{
|
{
|
||||||
LPITEMIDLIST pidlCurrent;
|
LPITEMIDLIST pidlCurrent;
|
||||||
|
@ -1969,10 +1964,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
{
|
{
|
||||||
IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE);
|
IShellBrowser_BrowseObject(fodInfos->Shell.FOIShellBrowser, pidlCurrent, SBSP_ABSOLUTE);
|
||||||
}
|
}
|
||||||
else if( nOpenAction == ONOPEN_SEARCH )
|
else
|
||||||
{
|
{
|
||||||
IShellView_Refresh(fodInfos->Shell.FOIShellView);
|
IShellView_Refresh(fodInfos->Shell.FOIShellView);
|
||||||
}
|
}
|
||||||
|
SendCustomDlgNotificationMessage(hwnd, CDN_FOLDERCHANGE);
|
||||||
COMDLG32_SHFree(pidlCurrent);
|
COMDLG32_SHFree(pidlCurrent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1990,8 +1986,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
|
fodInfos->ofnInfos->Flags &= ~OFN_READONLY;
|
||||||
|
|
||||||
/* Attach the file extension with file name*/
|
/* Attach the file extension with file name*/
|
||||||
ext = PathFindExtensionW(lpstrPathAndFile);
|
|
||||||
if (! *ext)
|
if(!PathIsDirectoryW(lpstrPathAndFile))
|
||||||
|
{
|
||||||
|
if((ext = PathFindExtensionW(lpstrPathAndFile)) == NULL)
|
||||||
{
|
{
|
||||||
/* if no extension is specified with file name, then */
|
/* if no extension is specified with file name, then */
|
||||||
/* attach the extension from file filter or default one */
|
/* attach the extension from file filter or default one */
|
||||||
|
@ -2031,6 +2029,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
||||||
else
|
else
|
||||||
fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
|
fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* In Save dialog: check if the file already exists */
|
/* In Save dialog: check if the file already exists */
|
||||||
if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
|
if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
|
||||||
|
|
Loading…
Reference in New Issue