shell32: Implement IDD_MAKENEWFOLDER.
Jonathan Armond
jon.armond at gmail.com
Thu Mar 26 06:05:38 CDT 2009
Implements the Make New Folder button in the SHBrowseForFolders dialog. NB
renaming of the new folder is still unimplemented.
Jon
---
dlls/shell32/brsfolder.c | 47 ++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index cc8a91d..675c1b6 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -18,7 +18,6 @@
* FIXME:
* - many memory leaks
* - many flags unimplemented
- * - implement new dialog style "make new folder" button
* - implement editbox
*/
@@ -656,7 +655,7 @@ static BOOL BrsFolder_OnCreate( HWND hWnd, browse_info
*info )
}
static BOOL BrsFolder_OnCommand( browse_info *info, UINT id )
-{
+{
LPBROWSEINFOW lpBrowseInfo = info->lpBrowseInfo;
switch (id)
@@ -677,8 +676,48 @@ static BOOL BrsFolder_OnCommand( browse_info *info, UINT
id )
return TRUE;
case IDD_MAKENEWFOLDER:
- FIXME("make new folder not implemented\n");
- return TRUE;
+ if (info->pidlRet == NULL)
+ return FALSE;
+ {
+ static WCHAR newFolderName[] = {'N','e','w',' ','F','o',
+ 'l','d','e','r',0};
+ WCHAR path[MAX_PATH];
+ HTREEITEM hParent;
+ HRESULT hr;
+ LPITEMIDLIST pidlChild;
+ IShellFolder *lpsfDesktop, *lpsfParent;
+
+ hParent = TreeView_GetSelection( info->hwndTreeView );
+ SHGetPathFromIDListW( info->pidlRet, path );
+ PathAppendAW( path, newFolderName );
+ if (SHCreateDirectoryExW( info->hwndTreeView, path, NULL ) !=
ERROR_SUCCESS)
+ {
+ MessageBoxA( info->hwndTreeView,
+ "You cannot create a new folder here. Choose a different
location.",
+ "Invalid location", MB_OK );
+ return FALSE;
+ }
+
+ /* Insert into treeview */
+ hr = SHGetDesktopFolder(&lpsfDesktop);
+ if (FAILED(hr)) {
+ WARN("SHGetDesktopFolder failed! hr = %08x\n", hr);
+ return FALSE;
+ }
+ hr = IShellFolder_BindToObject(lpsfDesktop, info->pidlRet, 0,
&IID_IShellFolder, (LPVOID*)&lpsfParent);
+ if (FAILED(hr)) {
+ WARN("IShellFolder_BindToObject failed! hr = %08x\n", hr);
+ return FALSE;
+ }
+ IShellFolder_Release(lpsfDesktop);
+ pidlChild = ILFindLastID(ILCreateFromPathW(path));
+ InsertTreeViewItem( info, lpsfParent, pidlChild,
+ info->pidlRet, NULL, hParent );
+ ILFree(pidlChild);
+ IShellFolder_Release(lpsfParent);
+
+ return TRUE;
+ }
}
return FALSE;
}
--
1.6.0.4
More information about the wine-patches
mailing list