[PATCH 2/2] comdlg32: Implement calling IFileDialogEvents::OnTypeChange(). (resend)
David Hedberg
david.hedberg at gmail.com
Sun Aug 31 11:47:15 CDT 2014
Resend of (unlabeled) try 2. I'll resend the rest of the patches later.
---
dlls/comdlg32/itemdlg.c | 20 ++++++++++++++++++++
dlls/comdlg32/tests/itemdlg.c | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 2d4f188..c3197ab 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -202,6 +202,18 @@ static void events_OnSelectionChange(FileDialogImpl *This)
}
}
+static void events_OnTypeChange(FileDialogImpl *This)
+{
+ events_client *cursor;
+ TRACE("%p\n", This);
+
+ LIST_FOR_EACH_ENTRY(cursor, &This->events_clients, events_client, entry)
+ {
+ TRACE("Notifying %p\n", cursor);
+ IFileDialogEvents_OnTypeChange(cursor->pfde, (IFileDialog*)&This->IFileDialog2_iface);
+ }
+}
+
static inline HRESULT get_cctrl_event(IFileDialogEvents *pfde, IFileDialogControlEvents **pfdce)
{
return IFileDialogEvents_QueryInterface(pfde, &IID_IFileDialogControlEvents, (void**)pfdce);
@@ -1542,6 +1554,9 @@ static LRESULT on_wm_initdialog(HWND hwnd, LPARAM lParam)
update_control_text(This);
update_layout(This);
+ if(This->filterspec_count)
+ events_OnTypeChange(This);
+
return TRUE;
}
@@ -1652,6 +1667,11 @@ static LRESULT on_command_filetype(FileDialogImpl *This, WPARAM wparam, LPARAM l
}
CoTaskMemFree(filename);
}
+
+ /* The documentation claims that OnTypeChange is called only
+ * when the dialog is opened, but this is obviously not the
+ * case. */
+ events_OnTypeChange(This);
}
return FALSE;
diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c
index ecbbe63..6a6c450 100644
--- a/dlls/comdlg32/tests/itemdlg.c
+++ b/dlls/comdlg32/tests/itemdlg.c
@@ -1197,7 +1197,7 @@ static void test_events(void)
/* pfdeimpl->OnSelectionChange too unreliable to test. Can be 0, 1 or even 2. */
pfdeimpl->OnSelectionChange = 0;
/* Called once just by showing the dialog */
- todo_wine ok(pfdeimpl->OnTypeChange == 1, "Got %d\n", pfdeimpl->OnTypeChange);
+ ok(pfdeimpl->OnTypeChange == 1, "Got %d\n", pfdeimpl->OnTypeChange);
pfdeimpl->OnTypeChange = 0;
ensure_zero_events(pfdeimpl);
--
1.9.1
More information about the wine-patches
mailing list