David Hedberg : comdlg32: Implement calling IFileDialogEvents:: OnTypeChange().

Alexandre Julliard julliard at wine.codeweavers.com
Wed Sep 3 15:09:21 CDT 2014


Module: wine
Branch: master
Commit: befe0f7b6991f620e2d4c53effc979740205701e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=befe0f7b6991f620e2d4c53effc979740205701e

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Sun Aug 31 18:47:15 2014 +0200

comdlg32: Implement calling IFileDialogEvents::OnTypeChange().

---

 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);




More information about the wine-cvs mailing list