mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 18:43:41 +00:00
[BROWSEUI]
- CAddressEditBox: Implement handling relative paths in the addressbar of explore in addition to absolute paths. svn path=/trunk/; revision=73130
This commit is contained in:
parent
6cd367f86e
commit
7731fea285
1 changed files with 29 additions and 4 deletions
|
@ -90,16 +90,20 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
|
||||||
ULONG attributes;
|
ULONG attributes;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
HWND topLevelWindow;
|
HWND topLevelWindow;
|
||||||
|
PIDLIST_ABSOLUTE pidlCurrent= NULL;
|
||||||
|
PIDLIST_RELATIVE pidlRelative = NULL;
|
||||||
|
CComPtr<IShellFolder> psfCurrent;
|
||||||
|
|
||||||
CComPtr<IShellBrowser> pisb;
|
CComPtr<IBrowserService> pbs;
|
||||||
hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pisb));
|
hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &pbs));
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hr = IUnknown_GetWindow(pisb, &topLevelWindow);
|
hr = IUnknown_GetWindow(pbs, &topLevelWindow);
|
||||||
if (FAILED_UNEXPECTEDLY(hr))
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
/* Get the path to browse and expand it if needed */
|
||||||
LPWSTR input;
|
LPWSTR input;
|
||||||
int inputLength = fCombobox.GetWindowTextLength() + 2;
|
int inputLength = fCombobox.GetWindowTextLength() + 2;
|
||||||
|
|
||||||
|
@ -124,13 +128,34 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Try to parse a relative path and if it fails, try to browse an absolute path */
|
||||||
CComPtr<IShellFolder> psfDesktop;
|
CComPtr<IShellFolder> psfDesktop;
|
||||||
hr = SHGetDesktopFolder(&psfDesktop);
|
hr = SHGetDesktopFolder(&psfDesktop);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
hr = pbs->GetPidl(&pidlCurrent);
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
hr = psfDesktop->BindToObject(pidlCurrent, NULL, IID_PPV_ARG(IShellFolder, &psfCurrent));
|
||||||
|
if (FAILED_UNEXPECTEDLY(hr))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
hr = psfCurrent->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlRelative, &attributes);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes);
|
pidlLastParsed = ILCombine(pidlCurrent, pidlRelative);
|
||||||
|
ILFree(pidlRelative);
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We couldn't parse a relative path, attempt to parse an absolute path */
|
||||||
|
hr = psfDesktop->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlLastParsed, &attributes);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (pidlCurrent)
|
||||||
|
ILFree(pidlCurrent);
|
||||||
if (address != input)
|
if (address != input)
|
||||||
delete [] address;
|
delete [] address;
|
||||||
delete [] input;
|
delete [] input;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue