From 270845d3dda70d7e0ea30f77c99370c90a52f120 Mon Sep 17 00:00:00 2001 From: David Hedberg Date: Mon, 23 Aug 2010 12:55:19 +0200 Subject: [PATCH] shell32: Implement IExplorerBrowser::SetFolderSettings. --- dlls/shell32/ebrowser.c | 33 +++++++++++++++++++++++++++++++-- dlls/shell32/tests/ebrowser.c | 16 ++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/dlls/shell32/ebrowser.c b/dlls/shell32/ebrowser.c index 2f770639fc6..e4e132ba0ce 100644 --- a/dlls/shell32/ebrowser.c +++ b/dlls/shell32/ebrowser.c @@ -45,6 +45,7 @@ typedef struct _ExplorerBrowserImpl { HWND hwnd_sv; EXPLORER_BROWSER_OPTIONS eb_options; + FOLDERSETTINGS fs; IShellView *psv; RECT sv_rc; @@ -70,6 +71,24 @@ static void size_panes(ExplorerBrowserImpl *This) TRUE); } +static HRESULT change_viewmode(ExplorerBrowserImpl *This, UINT viewmode) +{ + IFolderView *pfv; + HRESULT hr; + + if(!This->psv) + return E_FAIL; + + hr = IShellView_QueryInterface(This->psv, &IID_IFolderView, (void*)&pfv); + if(SUCCEEDED(hr)) + { + hr = IFolderView_SetCurrentViewMode(pfv, This->fs.ViewMode); + IFolderView_Release(pfv); + } + + return hr; +} + /************************************************************************** * Main window related functions. */ @@ -210,6 +229,9 @@ static HRESULT WINAPI IExplorerBrowser_fnInitialize(IExplorerBrowser *iface, return E_FAIL; } + This->fs.ViewMode = pfs ? pfs->ViewMode : FVM_DETAILS; + This->fs.fFlags = pfs ? (pfs->fFlags | FWF_NOCLIENTEDGE) : FWF_NOCLIENTEDGE; + return S_OK; } @@ -275,9 +297,16 @@ static HRESULT WINAPI IExplorerBrowser_fnSetFolderSettings(IExplorerBrowser *ifa const FOLDERSETTINGS *pfs) { ExplorerBrowserImpl *This = (ExplorerBrowserImpl*)iface; - FIXME("stub, %p (%p)\n", This, pfs); + TRACE("%p (%p)\n", This, pfs); - return E_NOTIMPL; + if(!pfs) + return E_INVALIDARG; + + This->fs.ViewMode = pfs->ViewMode; + This->fs.fFlags = pfs->fFlags | FWF_NOCLIENTEDGE; + + /* Change the settings of the current view, if any. */ + return change_viewmode(This, This->fs.ViewMode); } static HRESULT WINAPI IExplorerBrowser_fnAdvise(IExplorerBrowser *iface, diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c index 8486645ab8d..3397eb7ee09 100644 --- a/dlls/shell32/tests/ebrowser.c +++ b/dlls/shell32/tests/ebrowser.c @@ -276,6 +276,7 @@ static void test_basics(void) { IExplorerBrowser *peb; IShellBrowser *psb; + FOLDERSETTINGS fs; ULONG lres; DWORD flags; HDWP hdwp; @@ -357,6 +358,21 @@ static void test_basics(void) ok(flags == 0xDEADBEEF, "got (0x%08x)\n", flags); ok(hr == S_OK, "got (0x%08x)\n", hr); + IExplorerBrowser_Destroy(peb); + IExplorerBrowser_Release(peb); + + ebrowser_instantiate(&peb); + ebrowser_initialize(peb); + + /* SetFolderSettings */ + hr = IExplorerBrowser_SetFolderSettings(peb, NULL); + ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr); + fs.ViewMode = 0; fs.fFlags = 0; + hr = IExplorerBrowser_SetFolderSettings(peb, &fs); + todo_wine ok(hr == E_INVALIDARG, "got (0x%08x)\n", hr); + + /* TODO: Test after browsing somewhere. */ + IExplorerBrowser_Destroy(peb); lres = IExplorerBrowser_Release(peb); ok(lres == 0, "Got %d\n", lres);