Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2ea56681
Commit
2ea56681
authored
Jun 04, 2005
by
Huw Davies
Committed by
Alexandre Julliard
Jun 04, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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.
parent
7572fd38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
47 deletions
+46
-47
filedlg.c
dlls/commdlg/filedlg.c
+46
-47
No files found.
dlls/commdlg/filedlg.c
View file @
2ea56681
...
...
@@ -1712,9 +1712,8 @@ BOOL FILEDLG95_OnOpenMultipleFiles(HWND hwnd, LPWSTR lpstrFileList, UINT nFileCo
*
* If the function succeeds, the return value is nonzero.
*/
#define ONOPEN_BROWSE 1
#define ONOPEN_OPEN 2
#define ONOPEN_SEARCH 3
#define ONOPEN_OPEN 1
#define ONOPEN_SEARCH 2
static
void
FILEDLG95_OnOpenMessage
(
HWND
hwnd
,
int
idCaption
,
int
idText
)
{
WCHAR
strMsgTitle
[
MAX_PATH
];
...
...
@@ -1741,15 +1740,15 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
TRACE
(
"hwnd=%p
\n
"
,
hwnd
);
if
(
BrowseSelectedFolder
(
hwnd
))
return
FALSE
;
/* get the files from the edit control */
nFileCount
=
FILEDLG95_FILENAME_GetFileNames
(
hwnd
,
&
lpstrFileList
,
&
sizeUsed
,
'\0'
);
/* try if the user selected a folder in the shellview */
if
(
nFileCount
==
0
)
{
BrowseSelectedFolder
(
hwnd
);
return
FALSE
;
}
if
(
nFileCount
>
1
)
{
...
...
@@ -1810,7 +1809,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
lpstrPathAndFile: cleaned up path
*/
nOpenAction
=
ONOPEN_
BROWSE
;
nOpenAction
=
ONOPEN_
OPEN
;
/* don't apply any checks with OFN_NOVALIDATE */
{
...
...
@@ -1943,6 +1942,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
int
iPos
;
LPWSTR
lpszTemp
=
PathFindFileNameW
(
lpstrPathAndFile
);
DWORD
len
;
IPersistFolder2
*
ppf2
;
/* replace the current filter */
if
(
fodInfos
->
ShellInfos
.
lpstrCurrentFilter
)
...
...
@@ -1954,12 +1954,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* set the filter cb to the extension when possible */
if
(
-
1
<
(
iPos
=
FILEDLG95_FILETYPE_SearchExt
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
lpszTemp
)))
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
)))
{
LPITEMIDLIST
pidlCurrent
;
...
...
@@ -1969,10 +1964,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{
IShellBrowser_BrowseObject
(
fodInfos
->
Shell
.
FOIShellBrowser
,
pidlCurrent
,
SBSP_ABSOLUTE
);
}
else
if
(
nOpenAction
==
ONOPEN_SEARCH
)
else
{
IShellView_Refresh
(
fodInfos
->
Shell
.
FOIShellView
);
}
SendCustomDlgNotificationMessage
(
hwnd
,
CDN_FOLDERCHANGE
);
COMDLG32_SHFree
(
pidlCurrent
);
}
}
...
...
@@ -1990,48 +1986,51 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
fodInfos
->
ofnInfos
->
Flags
&=
~
OFN_READONLY
;
/* Attach the file extension with file name*/
ext
=
PathFindExtensionW
(
lpstrPathAndFile
);
if
(
!
*
ext
)
if
(
!
PathIsDirectoryW
(
lpstrPathAndFile
)
)
{
/* if no extension is specified with file name, then */
/* attach the extension from file filter or default one */
if
((
ext
=
PathFindExtensionW
(
lpstrPathAndFile
))
==
NULL
)
{
/* 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
};
int
PathLength
=
strlenW
(
lpstrPathAndFile
);
WCHAR
*
filterExt
=
NULL
;
LPWSTR
lpstrFilter
=
NULL
;
static
const
WCHAR
szwDot
[]
=
{
'.'
,
0
};
int
PathLength
=
strlenW
(
lpstrPathAndFile
);
/* Attach the dot*/
strcatW
(
lpstrPathAndFile
,
szwDot
);
/* Attach the dot*/
strcatW
(
lpstrPathAndFile
,
szwDot
);
/*Get the file extension from file type filter*/
lpstrFilter
=
(
LPWSTR
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
fodInfos
->
ofnInfos
->
nFilterIndex
-
1
);
/*Get the file extension from file type filter*/
lpstrFilter
=
(
LPWSTR
)
CBGetItemDataPtr
(
fodInfos
->
DlgInfos
.
hwndFileTypeCB
,
fodInfos
->
ofnInfos
->
nFilterIndex
-
1
);
if
(
lpstrFilter
!=
(
LPWSTR
)
CB_ERR
)
/* control is not empty */
filterExt
=
PathFindExtensionW
(
lpstrFilter
);
if
(
lpstrFilter
!=
(
LPWSTR
)
CB_ERR
)
/* control is not empty */
filterExt
=
PathFindExtensionW
(
lpstrFilter
);
if
(
filterExt
&&
*
filterExt
)
/* attach the file extension from file type filter*/
strcatW
(
lpstrPathAndFile
,
filterExt
+
1
);
else
if
(
fodInfos
->
defext
)
/* attach the default file extension*/
strcatW
(
lpstrPathAndFile
,
fodInfos
->
defext
);
if
(
filterExt
&&
*
filterExt
)
/* attach the file extension from file type filter*/
strcatW
(
lpstrPathAndFile
,
filterExt
+
1
);
else
if
(
fodInfos
->
defext
)
/* attach the default file extension*/
strcatW
(
lpstrPathAndFile
,
fodInfos
->
defext
);
/* In Open dialog: if file does not exist try without extension */
if
(
!
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
)
&&
!
PathFileExistsW
(
lpstrPathAndFile
))
lpstrPathAndFile
[
PathLength
]
=
'\0'
;
/* In Open dialog: if file does not exist try without extension */
if
(
!
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
)
&&
!
PathFileExistsW
(
lpstrPathAndFile
))
lpstrPathAndFile
[
PathLength
]
=
'\0'
;
}
if
(
fodInfos
->
defext
)
/* add default extension */
{
/* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
if
(
*
ext
)
ext
++
;
if
(
!
lstrcmpiW
(
fodInfos
->
defext
,
ext
))
fodInfos
->
ofnInfos
->
Flags
&=
~
OFN_EXTENSIONDIFFERENT
;
else
fodInfos
->
ofnInfos
->
Flags
|=
OFN_EXTENSIONDIFFERENT
;
}
}
if
(
fodInfos
->
defext
)
/* add default extension */
{
/* Set/clear the output OFN_EXTENSIONDIFFERENT flag */
if
(
*
ext
)
ext
++
;
if
(
!
lstrcmpiW
(
fodInfos
->
defext
,
ext
))
fodInfos
->
ofnInfos
->
Flags
&=
~
OFN_EXTENSIONDIFFERENT
;
else
fodInfos
->
ofnInfos
->
Flags
|=
OFN_EXTENSIONDIFFERENT
;
}
/* In Save dialog: check if the file already exists */
if
(
fodInfos
->
DlgInfos
.
dwDlgProp
&
FODPROP_SAVEDLG
&&
fodInfos
->
ofnInfos
->
Flags
&
OFN_OVERWRITEPROMPT
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment