David Hedberg : comdlg32: Implement filetype filtering for the item dialog.
Alexandre Julliard
julliard at winehq.org
Fri Apr 1 09:41:05 CDT 2011
Module: wine
Branch: master
Commit: 209069ae46343cdf4ee1589774133d648d65c8c2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=209069ae46343cdf4ee1589774133d648d65c8c2
Author: David Hedberg <david.hedberg at gmail.com>
Date: Fri Apr 1 05:52:26 2011 +0200
comdlg32: Implement filetype filtering for the item dialog.
---
dlls/comdlg32/itemdlg.c | 43 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c
index 99e41a6..92ea665 100644
--- a/dlls/comdlg32/itemdlg.c
+++ b/dlls/comdlg32/itemdlg.c
@@ -1746,8 +1746,47 @@ static HRESULT WINAPI ICommDlgBrowser3_fnIncludeObject(ICommDlgBrowser3 *iface,
IShellView *shv, LPCITEMIDLIST pidl)
{
FileDialogImpl *This = impl_from_ICommDlgBrowser3(iface);
- FIXME("Stub: %p (%p, %p)\n", This, shv, pidl);
- return S_OK;
+ IShellItem *psi;
+ LPWSTR filename;
+ LPITEMIDLIST parent_pidl;
+ HRESULT hr;
+ ULONG attr;
+ TRACE("%p (%p, %p)\n", This, shv, pidl);
+
+ if(!This->filterspec_count)
+ return S_OK;
+
+ hr = SHGetIDListFromObject((IUnknown*)shv, &parent_pidl);
+ if(SUCCEEDED(hr))
+ {
+ LPITEMIDLIST full_pidl = ILCombine(parent_pidl, pidl);
+ hr = SHCreateItemFromIDList(full_pidl, &IID_IShellItem, (void**)&psi);
+ ILFree(parent_pidl);
+ ILFree(full_pidl);
+ }
+ if(FAILED(hr))
+ {
+ ERR("Failed to get shellitem (%08x).\n", hr);
+ return S_OK;
+ }
+
+ hr = IShellItem_GetAttributes(psi, SFGAO_FOLDER|SFGAO_LINK, &attr);
+ if(FAILED(hr) || (attr & (SFGAO_FOLDER | SFGAO_LINK)))
+ {
+ IShellItem_Release(psi);
+ return S_OK;
+ }
+
+ hr = S_OK;
+ if(SUCCEEDED(IShellItem_GetDisplayName(psi, SIGDN_PARENTRELATIVEPARSING, &filename)))
+ {
+ if(!PathMatchSpecW(filename, This->filterspecs[This->filetypeindex].pszSpec))
+ hr = S_FALSE;
+ CoTaskMemFree(filename);
+ }
+
+ IShellItem_Release(psi);
+ return hr;
}
static HRESULT WINAPI ICommDlgBrowser3_fnNotify(ICommDlgBrowser3 *iface,
More information about the wine-cvs
mailing list