Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
43f44ffb
Commit
43f44ffb
authored
Sep 14, 2018
by
Fabian Maurer
Committed by
Alexandre Julliard
Sep 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32/brsfolder: Add shortcut to delete folders with the delete key.
Signed-off-by:
Fabian Maurer
<
dark.shadow4@web.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2e25a43f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
brsfolder.c
dlls/shell32/brsfolder.c
+93
-0
No files found.
dlls/shell32/brsfolder.c
View file @
43f44ffb
...
...
@@ -38,6 +38,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
shell
);
#define SHV_CHANGE_NOTIFY (WM_USER + 0x1111)
/* original margins and control size */
typedef
struct
tagLAYOUT_DATA
{
...
...
@@ -53,6 +55,7 @@ typedef struct tagbrowse_info
LPITEMIDLIST
pidlRet
;
LAYOUT_DATA
*
layout
;
/* filled by LayoutInit, used by LayoutUpdate */
SIZE
szMin
;
ULONG
hNotify
;
/* change notification handle */
}
browse_info
;
typedef
struct
tagTV_ITEMDATA
...
...
@@ -635,6 +638,30 @@ static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydo
case
VK_F2
:
BrsFolder_Rename
(
info
,
selected_item
);
break
;
case
VK_DELETE
:
{
const
ITEMIDLIST
*
item_id
;
ISFHelper
*
psfhlp
;
HRESULT
hr
;
TVITEMW
item
;
TV_ITEMDATA
*
item_data
;
item
.
mask
=
TVIF_PARAM
;
item
.
mask
=
TVIF_HANDLE
|
TVIF_PARAM
;
item
.
hItem
=
selected_item
;
SendMessageW
(
info
->
hwndTreeView
,
TVM_GETITEMW
,
0
,
(
LPARAM
)
&
item
);
item_data
=
(
TV_ITEMDATA
*
)
item
.
lParam
;
item_id
=
item_data
->
lpi
;
hr
=
IShellFolder_QueryInterface
(
item_data
->
lpsfParent
,
&
IID_ISFHelper
,
(
void
**
)
&
psfhlp
);
if
(
FAILED
(
hr
))
return
0
;
/* perform the item deletion - tree view gets updated over shell notification */
ISFHelper_DeleteItems
(
psfhlp
,
1
,
&
item_id
);
ISFHelper_Release
(
psfhlp
);
}
break
;
}
return
0
;
}
...
...
@@ -680,6 +707,8 @@ static LRESULT BrsFolder_OnNotify( browse_info *info, UINT CtlID, LPNMHDR lpnmh
static
BOOL
BrsFolder_OnCreate
(
HWND
hWnd
,
browse_info
*
info
)
{
LPITEMIDLIST
computer_pidl
;
SHChangeNotifyEntry
ntreg
;
LPBROWSEINFOW
lpBrowseInfo
=
info
->
lpBrowseInfo
;
info
->
hWnd
=
hWnd
;
...
...
@@ -745,6 +774,14 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
else
ERR
(
"treeview control missing!
\n
"
);
/* Register for change notifications */
SHGetFolderLocation
(
NULL
,
CSIDL_DESKTOP
,
NULL
,
0
,
&
computer_pidl
);
ntreg
.
pidl
=
computer_pidl
;
ntreg
.
fRecursive
=
TRUE
;
info
->
hNotify
=
SHChangeNotifyRegister
(
hWnd
,
SHCNRF_InterruptLevel
,
SHCNE_ALLEVENTS
,
SHV_CHANGE_NOTIFY
,
1
,
&
ntreg
);
browsefolder_callback
(
info
->
lpBrowseInfo
,
hWnd
,
BFFM_INITIALIZED
,
0
);
return
TRUE
;
...
...
@@ -1001,9 +1038,62 @@ static INT BrsFolder_OnDestroy(browse_info *info)
info
->
layout
=
NULL
;
}
SHChangeNotifyDeregister
(
info
->
hNotify
);
return
0
;
}
/* Find a treeview node by recursively walking the treeview */
static
HTREEITEM
BrsFolder_FindItemByPidl
(
browse_info
*
info
,
LPCITEMIDLIST
pidl
,
HTREEITEM
hItem
)
{
TV_ITEMW
item
;
TV_ITEMDATA
*
item_data
;
HRESULT
hr
;
item
.
mask
=
TVIF_HANDLE
|
TVIF_PARAM
;
item
.
hItem
=
hItem
;
SendMessageW
(
info
->
hwndTreeView
,
TVM_GETITEMW
,
0
,
(
LPARAM
)
&
item
);
item_data
=
(
TV_ITEMDATA
*
)
item
.
lParam
;
hr
=
IShellFolder_CompareIDs
(
item_data
->
lpsfParent
,
0
,
item_data
->
lpifq
,
pidl
);
if
(
SUCCEEDED
(
hr
)
&&
!
HRESULT_CODE
(
hr
))
return
hItem
;
hItem
=
(
HTREEITEM
)
SendMessageW
(
info
->
hwndTreeView
,
TVM_GETNEXTITEM
,
TVGN_CHILD
,
(
LPARAM
)
hItem
);
while
(
hItem
)
{
HTREEITEM
newItem
=
BrsFolder_FindItemByPidl
(
info
,
pidl
,
hItem
);
if
(
newItem
)
return
newItem
;
hItem
=
(
HTREEITEM
)
SendMessageW
(
info
->
hwndTreeView
,
TVM_GETNEXTITEM
,
TVGN_NEXT
,
(
LPARAM
)
hItem
);
}
return
NULL
;
}
static
LRESULT
BrsFolder_OnChange
(
browse_info
*
info
,
const
LPCITEMIDLIST
*
pidls
,
LONG
event
)
{
BOOL
ret
=
TRUE
;
TRACE
(
"(%p)->(%p, %p, 0x%08x)
\n
"
,
info
,
pidls
[
0
],
pidls
[
1
],
event
);
switch
(
event
)
{
case
SHCNE_RMDIR
:
case
SHCNE_DELETE
:
{
HTREEITEM
handle_root
=
(
HTREEITEM
)
SendMessageW
(
info
->
hwndTreeView
,
TVM_GETNEXTITEM
,
TVGN_ROOT
,
0
);
HTREEITEM
handle_item
=
BrsFolder_FindItemByPidl
(
info
,
pidls
[
0
],
handle_root
);
if
(
handle_item
)
SendMessageW
(
info
->
hwndTreeView
,
TVM_DELETEITEM
,
0
,
(
LPARAM
)
handle_item
);
break
;
}
}
return
ret
;
}
/*************************************************************************
* BrsFolderDlgProc32 (not an exported API function)
*/
...
...
@@ -1064,6 +1154,9 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
case
BFFM_SETEXPANDED
:
/* unicode only */
return
BrsFolder_OnSetExpanded
(
info
,
(
LPVOID
)
lParam
,
(
BOOL
)
wParam
,
NULL
);
case
SHV_CHANGE_NOTIFY
:
return
BrsFolder_OnChange
(
info
,
(
const
LPCITEMIDLIST
*
)
wParam
,
(
LONG
)
lParam
);
case
WM_DESTROY
:
return
BrsFolder_OnDestroy
(
info
);
}
...
...
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