Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3ed6413a
Commit
3ed6413a
authored
Apr 09, 2023
by
Jactry Zeng
Committed by
Alexandre Julliard
May 25, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Reimplement IExplorerBrowser_SetFolderSettings() with support of setting flags.
parent
49490f85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
26 deletions
+78
-26
ebrowser.c
dlls/shell32/ebrowser.c
+22
-25
ebrowser.c
dlls/shell32/tests/ebrowser.c
+56
-1
No files found.
dlls/shell32/ebrowser.c
View file @
3ed6413a
...
...
@@ -340,24 +340,6 @@ 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
;
}
static
HRESULT
create_new_shellview
(
ExplorerBrowserImpl
*
This
,
IShellItem
*
psi
)
{
IShellBrowser
*
psb
=
&
This
->
IShellBrowser_iface
;
...
...
@@ -988,17 +970,32 @@ static HRESULT WINAPI IExplorerBrowser_fnSetEmptyText(IExplorerBrowser *iface,
static
HRESULT
WINAPI
IExplorerBrowser_fnSetFolderSettings
(
IExplorerBrowser
*
iface
,
const
FOLDERSETTINGS
*
pfs
)
{
ExplorerBrowserImpl
*
This
=
impl_from_IExplorerBrowser
(
iface
);
TRACE
(
"%p (%p)
\n
"
,
This
,
pfs
);
ExplorerBrowserImpl
*
browser
=
impl_from_IExplorerBrowser
(
iface
);
IFolderView2
*
view
;
HRESULT
hr
;
TRACE
(
"explorer browser %p, settings %p.
\n
"
,
iface
,
pfs
);
if
(
!
pfs
)
if
(
!
pfs
)
return
E_INVALIDARG
;
This
->
fs
.
ViewMode
=
pfs
->
ViewMode
;
This
->
fs
.
fFlags
=
pfs
->
fFlags
|
FWF_NOCLIENTEDGE
;
if
(
pfs
->
ViewMode
)
browser
->
fs
.
ViewMode
=
pfs
->
ViewMode
;
browser
->
fs
.
fFlags
=
pfs
->
fFlags
;
/* Change the settings of the current view, if any. */
return
change_viewmode
(
This
,
This
->
fs
.
ViewMode
);
if
(
!
browser
->
psv
)
return
E_INVALIDARG
;
hr
=
IShellView_QueryInterface
(
browser
->
psv
,
&
IID_IFolderView2
,
(
void
**
)
&
view
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IFolderView2_SetCurrentViewMode
(
view
,
browser
->
fs
.
ViewMode
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
IFolderView2_SetCurrentFolderFlags
(
view
,
~
FWF_NONE
,
browser
->
fs
.
fFlags
);
IFolderView2_Release
(
view
);
}
return
hr
;
}
static
HRESULT
WINAPI
IExplorerBrowser_fnAdvise
(
IExplorerBrowser
*
iface
,
...
...
dlls/shell32/tests/ebrowser.c
View file @
3ed6413a
...
...
@@ -1688,6 +1688,23 @@ static void setup_window(void)
ok
(
hwnd
!=
NULL
,
"Failed to create window for tests.
\n
"
);
}
#define CHECK_SETTINGS(browser,expected) _check_settings(browser, expected, __LINE__)
static
void
_check_settings
(
IExplorerBrowser
*
browser
,
FOLDERSETTINGS
expected
,
int
line
)
{
FOLDERSETTINGS
settings
;
IShellView
*
view
;
HRESULT
hr
;
hr
=
IExplorerBrowser_GetCurrentView
(
browser
,
&
IID_IShellView
,
(
void
**
)
&
view
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
hr
=
IShellView_GetCurrentInfo
(
view
,
&
settings
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
!
memcmp
(
&
settings
,
&
expected
,
sizeof
(
settings
)),
"Got settings {view mode: %d, flags: %#x}, expected {view mode: %d, flags: %#x}.
\n
"
,
settings
.
ViewMode
,
settings
.
fFlags
,
expected
.
ViewMode
,
expected
.
fFlags
);
IShellView_Release
(
view
);
}
static
void
test_folder_settings
(
void
)
{
IExplorerBrowser
*
browser
;
...
...
@@ -1702,7 +1719,45 @@ static void test_folder_settings(void)
settings
.
ViewMode
=
0
;
settings
.
fFlags
=
FWF_NONE
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Got hr %#lx.
\n
"
,
hr
);
settings
.
ViewMode
=
FVM_ICON
;
settings
.
fFlags
=
FWF_SNAPTOGRID
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
E_INVALIDARG
,
"Got hr %#lx.
\n
"
,
hr
);
ebrowser_browse_to_desktop
(
browser
);
settings
.
ViewMode
=
FVM_AUTO
;
settings
.
fFlags
=
FWF_AUTOARRANGE
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
settings
.
ViewMode
==
FVM_AUTO
&&
settings
.
fFlags
==
FWF_AUTOARRANGE
,
"Got view mode %d, flags %#x.
\n
"
,
settings
.
ViewMode
,
settings
.
fFlags
);
settings
.
ViewMode
=
FVM_ICON
;
settings
.
fFlags
=
FWF_AUTOARRANGE
;
CHECK_SETTINGS
(
browser
,
settings
);
settings
.
ViewMode
=
FVM_LIST
;
settings
.
fFlags
=
FWF_AUTOARRANGE
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
settings
.
ViewMode
=
0
;
settings
.
fFlags
=
FWF_SNAPTOGRID
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
settings
.
ViewMode
==
0
&&
settings
.
fFlags
==
FWF_SNAPTOGRID
,
"Got view mode %d, flags %#x.
\n
"
,
settings
.
ViewMode
,
settings
.
fFlags
);
settings
.
ViewMode
=
FVM_LIST
;
CHECK_SETTINGS
(
browser
,
settings
);
settings
.
ViewMode
=
FVM_LAST
+
1
;
settings
.
fFlags
=
FWF_AUTOARRANGE
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
settings
.
ViewMode
=
FVM_LIST
;
CHECK_SETTINGS
(
browser
,
settings
);
settings
.
ViewMode
=
FVM_ICON
;
settings
.
fFlags
=
FWF_NONE
;
hr
=
IExplorerBrowser_SetFolderSettings
(
browser
,
&
settings
);
ok
(
hr
==
S_OK
,
"Got hr %#lx.
\n
"
,
hr
);
ok
(
settings
.
ViewMode
==
FVM_ICON
&&
settings
.
fFlags
==
FWF_NONE
,
"Got view mode %d, flags %#x.
\n
"
,
settings
.
ViewMode
,
settings
.
fFlags
);
CHECK_SETTINGS
(
browser
,
settings
);
IExplorerBrowser_Release
(
browser
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment