mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[SHELL32] Give opportunity to rename file/folder on its creation (#5139)
* [SHELL32] Fix issue when creating a new file or folder. No chance to rename the displayed name. The CNewMenu::SelectNewItem method starts with a request to notify the View object about a new item by calling SHChangeNotify. After creating and obtaining the new PIDL by calling ILFindLastID, the CDefView::SelectItem method is called. This method fails right from the start when calling LV_FindItemByPidl which returns -1, thus preventing the user from being given the opportunity to change the name displayed by default. This failure is due to the fact that this object has not yet been added to the CDefView::m_ListView list. This is caused by the asynchronous nature of SHChangeNotify. Thanks to Giannis Adamopoulos for the big help.
This commit is contained in:
parent
9b6b1b3513
commit
b8c4d589b1
3 changed files with 2 additions and 3 deletions
|
@ -990,7 +990,6 @@ BOOLEAN CDefView::LV_ProdItem(PCUITEMID_CHILD pidl)
|
|||
lvItem.iImage = SHMapPIDLToSystemImageListIndex(m_pSFParent, pidl, 0);
|
||||
m_ListView.SetItem(&lvItem);
|
||||
m_ListView.Update(nItem);
|
||||
m_ListView.EditLabel(nItem);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -926,7 +926,7 @@ CDefaultContextMenu::DoCreateNewFolder(
|
|||
CComPtr<IShellView> psv;
|
||||
|
||||
/* Notify the view object about the new item */
|
||||
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHW, (LPCVOID)wszName, NULL);
|
||||
SHChangeNotify(SHCNE_MKDIR, SHCNF_PATHW | SHCNF_FLUSH, (LPCVOID)wszName, NULL);
|
||||
|
||||
if (!m_site)
|
||||
return S_OK;
|
||||
|
|
|
@ -418,7 +418,7 @@ HRESULT CNewMenu::SelectNewItem(LONG wEventId, UINT uFlags, LPWSTR pszName, BOOL
|
|||
dwSelectFlags |= SVSI_EDIT;
|
||||
|
||||
/* Notify the view object about the new item */
|
||||
SHChangeNotify(wEventId, uFlags, (LPCVOID) pszName, NULL);
|
||||
SHChangeNotify(wEventId, uFlags | SHCNF_FLUSH, (LPCVOID)pszName, NULL);
|
||||
|
||||
if (!m_pSite)
|
||||
return S_OK;
|
||||
|
|
Loading…
Reference in a new issue