David Hedberg : comdlg32: Improve handling of file extension changes in the Item Dialog.
Alexandre Julliard
julliard at winehq.org
Wed May 25 11:28:16 CDT 2011
Module: wine
Branch: master
Commit: 0d96d26f0d1f1a4d27b28ad00b9927966f3b8feb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0d96d26f0d1f1a4d27b28ad00b9927966f3b8feb
Author: David Hedberg <david.hedberg at gmail.com>
Date: Tue May 24 21:09:51 2011 +0200
comdlg32: Improve handling of file extension changes in the Item Dialog.
---
dlls/comdlg32/itemdlg.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 80b0d86..11db9c9 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -872,16 +872,39 @@ static LRESULT on_command_filetype(FileDialogImpl *This, WPARAM wparam, LPARAM l
{
IShellView *psv;
HRESULT hr;
+ LPWSTR filename;
+ UINT prev_index = This->filetypeindex;
This->filetypeindex = SendMessageW((HWND)lparam, CB_GETCURSEL, 0, 0);
TRACE("File type selection changed to %d.\n", This->filetypeindex);
+ if(prev_index == This->filetypeindex)
+ return FALSE;
+
hr = IExplorerBrowser_GetCurrentView(This->peb, &IID_IShellView, (void**)&psv);
if(SUCCEEDED(hr))
{
IShellView_Refresh(psv);
IShellView_Release(psv);
}
+
+ if(This->dlg_type == ITEMDLG_TYPE_SAVE && get_file_name(This, &filename))
+ {
+ WCHAR buf[MAX_PATH], extbuf[MAX_PATH], *ext;
+
+ ext = get_first_ext_from_spec(extbuf, This->filterspecs[This->filetypeindex].pszSpec);
+ if(ext)
+ {
+ lstrcpyW(buf, filename);
+
+ if(PathMatchSpecW(buf, This->filterspecs[prev_index].pszSpec))
+ PathRemoveExtensionW(buf);
+
+ lstrcatW(buf, ext);
+ set_file_name(This, buf);
+ }
+ CoTaskMemFree(filename);
+ }
}
return FALSE;
More information about the wine-cvs
mailing list