mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 16:41:22 +00:00
* Create a IDataObject when cidl == 0 (click on TreeView)
* Handle directories in ISFHelper_fnCopyItems * Should make copying directories work svn path=/trunk/; revision=35450
This commit is contained in:
parent
1d8b6343f6
commit
f1a1cc745a
1 changed files with 60 additions and 19 deletions
|
@ -653,10 +653,17 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
|
||||||
|
|
||||||
if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
|
if (IsEqualIID (riid, &IID_IContextMenu) && (cidl >= 1)) {
|
||||||
hr = CDefFolderMenu_Create2(This->pidlRoot, hwndOwner, cidl, apidl, (IShellFolder*)iface, NULL, 0, NULL, (IContextMenu**)&pObj);
|
hr = CDefFolderMenu_Create2(This->pidlRoot, hwndOwner, cidl, apidl, (IShellFolder*)iface, NULL, 0, NULL, (IContextMenu**)&pObj);
|
||||||
} else if (IsEqualIID (riid, &IID_IDataObject) && (cidl >= 1)) {
|
} else if (IsEqualIID (riid, &IID_IDataObject)){
|
||||||
|
if (cidl >= 1) {
|
||||||
pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner,
|
pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner,
|
||||||
This->pidlRoot, apidl, cidl);
|
This->pidlRoot, apidl, cidl);
|
||||||
hr = S_OK;
|
hr = S_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pObj = (LPUNKNOWN) IDataObject_Constructor (hwndOwner, This->pidlRoot, (LPCITEMIDLIST*)&This->pidlRoot, 1);
|
||||||
|
hr = S_OK;
|
||||||
|
}
|
||||||
} else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
|
} else if (IsEqualIID (riid, &IID_IExtractIconA) && (cidl == 1)) {
|
||||||
pidl = ILCombine (This->pidlRoot, apidl[0]);
|
pidl = ILCombine (This->pidlRoot, apidl[0]);
|
||||||
pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
|
pObj = (LPUNKNOWN) IExtractIconA_Constructor (pidl);
|
||||||
|
@ -1274,9 +1281,9 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
|
||||||
WCHAR szTargetPath[MAX_PATH];
|
WCHAR szTargetPath[MAX_PATH];
|
||||||
SHFILEOPSTRUCTW op;
|
SHFILEOPSTRUCTW op;
|
||||||
LPITEMIDLIST pidl;
|
LPITEMIDLIST pidl;
|
||||||
LPWSTR pszSrc, pszTarget;
|
LPWSTR pszSrc, pszTarget, pszSrcList, pszTargetList;
|
||||||
int res;
|
int res;
|
||||||
|
STRRET strRet;
|
||||||
|
|
||||||
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
IGenericSFImpl *This = impl_from_ISFHelper(iface);
|
||||||
|
|
||||||
|
@ -1290,48 +1297,82 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl,
|
||||||
IPersistFolder2_Release(ppf2);
|
IPersistFolder2_Release(ppf2);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
IPersistFolder2_Release(ppf2);
|
||||||
|
|
||||||
if (!SHGetPathFromIDListW (pidl, szSrcPath))
|
if (FAILED(IShellFolder_GetDisplayNameOf(pSFFrom, pidl, SHGDN_FORPARSING, &strRet)))
|
||||||
{
|
{
|
||||||
SHFree (pidl);
|
SHFree (pidl);
|
||||||
IPersistFolder2_Release (ppf2);
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (FAILED(StrRetToBufW(&strRet, pidl, szSrcPath, MAX_PATH)))
|
||||||
|
{
|
||||||
|
SHFree (pidl);
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
SHFree (pidl);
|
||||||
|
|
||||||
pszSrc = PathAddBackslashW (szSrcPath);
|
pszSrc = PathAddBackslashW (szSrcPath);
|
||||||
|
|
||||||
wcscpy(szTargetPath, This->sPathTarget);
|
wcscpy(szTargetPath, This->sPathTarget);
|
||||||
pszTarget = PathAddBackslashW (szTargetPath);
|
pszTarget = PathAddBackslashW (szTargetPath);
|
||||||
|
|
||||||
pszSrc = build_paths_list(szSrcPath, cidl, apidl);
|
pszSrcList = build_paths_list(szSrcPath, cidl, apidl);
|
||||||
pszTarget = build_paths_list(szTargetPath, cidl, apidl);
|
pszTargetList = build_paths_list(szTargetPath, cidl, apidl);
|
||||||
|
|
||||||
if (!pszSrc || !pszTarget)
|
if (!pszSrcList || !pszTargetList)
|
||||||
{
|
{
|
||||||
if (pszSrc)
|
if (pszSrcList)
|
||||||
HeapFree(GetProcessHeap(), 0, pszSrc);
|
HeapFree(GetProcessHeap(), 0, pszSrcList);
|
||||||
|
|
||||||
if (pszTarget)
|
if (pszTargetList)
|
||||||
HeapFree(GetProcessHeap(), 0, pszTarget);
|
HeapFree(GetProcessHeap(), 0, pszTargetList);
|
||||||
|
|
||||||
SHFree (pidl);
|
SHFree (pidl);
|
||||||
IPersistFolder2_Release (ppf2);
|
IPersistFolder2_Release (ppf2);
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&op, sizeof(op));
|
ZeroMemory(&op, sizeof(op));
|
||||||
|
if (!pszSrcList[0])
|
||||||
|
{
|
||||||
|
/* remove trailing backslash */
|
||||||
|
pszSrc--;
|
||||||
|
pszSrc[0] = L'\0';
|
||||||
|
op.pFrom = szSrcPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
op.pFrom = pszSrcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pszTargetList[0])
|
||||||
|
{
|
||||||
|
/* remove trailing backslash */
|
||||||
|
if (pszTarget - szTargetPath > 3)
|
||||||
|
{
|
||||||
|
pszTarget--;
|
||||||
|
pszTarget[0] = L'\0';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszTarget[1] = L'\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
op.pTo = szTargetPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
op.pTo = pszTargetList;
|
||||||
|
}
|
||||||
op.hwnd = GetActiveWindow();
|
op.hwnd = GetActiveWindow();
|
||||||
op.wFunc = FO_COPY;
|
op.wFunc = FO_COPY;
|
||||||
op.pFrom = pszSrc;
|
op.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMMKDIR;
|
||||||
op.pTo = pszTarget;
|
|
||||||
op.fFlags = FOF_ALLOWUNDO;
|
|
||||||
|
|
||||||
res = SHFileOperationW(&op);
|
res = SHFileOperationW(&op);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, pszSrc);
|
HeapFree(GetProcessHeap(), 0, pszSrc);
|
||||||
HeapFree(GetProcessHeap(), 0, pszTarget);
|
HeapFree(GetProcessHeap(), 0, pszTarget);
|
||||||
|
|
||||||
SHFree (pidl);
|
|
||||||
IPersistFolder2_Release (ppf2);
|
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue