Commit 2e25a43f authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

shell32/brsfolder: Add shortcut to rename folders with the F2 key.

parent 1d65be60
......@@ -613,6 +613,32 @@ static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv
return 0;
}
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
{
SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)rename);
SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
return S_OK;
}
static LRESULT BrsFolder_Treeview_Keydown(browse_info *info, LPNMTVKEYDOWN keydown)
{
HTREEITEM selected_item;
/* Old dialog doesn't support those advanced features */
if (!(info->lpBrowseInfo->ulFlags & BIF_NEWDIALOGSTYLE))
return 0;
selected_item = (HTREEITEM)SendMessageW(info->hwndTreeView, TVM_GETNEXTITEM, TVGN_CARET, 0);
switch (keydown->wVKey)
{
case VK_F2:
BrsFolder_Rename(info, selected_item);
break;
}
return 0;
}
static LRESULT BrsFolder_OnNotify( browse_info *info, UINT CtlID, LPNMHDR lpnmh )
{
NMTREEVIEWW *pnmtv = (NMTREEVIEWW *)lpnmh;
......@@ -640,6 +666,9 @@ static LRESULT BrsFolder_OnNotify( browse_info *info, UINT CtlID, LPNMHDR lpnmh
case TVN_ENDLABELEDITW:
return BrsFolder_Treeview_Rename( info, (LPNMTVDISPINFOW)pnmtv );
case TVN_KEYDOWN:
return BrsFolder_Treeview_Keydown( info, (LPNMTVKEYDOWN)pnmtv );
default:
WARN("unhandled (%d)\n", pnmtv->hdr.code);
break;
......@@ -721,13 +750,6 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info *info )
return TRUE;
}
static HRESULT BrsFolder_Rename(browse_info *info, HTREEITEM rename)
{
SendMessageW(info->hwndTreeView, TVM_SELECTITEM, TVGN_CARET, (LPARAM)rename);
SendMessageW(info->hwndTreeView, TVM_EDITLABELW, 0, (LPARAM)rename);
return S_OK;
}
static HRESULT BrsFolder_NewFolder(browse_info *info)
{
DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment