mirror of
https://github.com/reactos/reactos.git
synced 2026-05-31 08:17:09 +08:00
[BROWSEUI] Accept relative path on Address Bar (#8633)
Improve usability of Address Bar. JIRA issue: CORE-19704 - Modify CAddressEditBox::ParseNow to accept relative path. - Add SBSP_SAMEBROWSER | SBSP_ABSOLUTE flags for IShellBrowser::BrowseObject.
This commit is contained in:
committed by
GitHub
parent
6350669667
commit
9e64b600f9
@@ -184,7 +184,7 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
|
||||
CComPtr<IShellFolder> psfCurrent;
|
||||
HRESULT hr;
|
||||
|
||||
ATLASSERT(!m_pidlLastParsed);
|
||||
m_pidlLastParsed.Free();
|
||||
|
||||
CComPtr<IBrowserService> pbs;
|
||||
hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IBrowserService, &pbs));
|
||||
@@ -220,15 +220,33 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::ParseNow(long paramC)
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
goto parseabsolute;
|
||||
|
||||
hr = psfDesktop->BindToObject(pidlCurrent, NULL, IID_PPV_ARG(IShellFolder, &psfCurrent));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
goto parseabsolute;
|
||||
if (!pidlCurrent->mkid.cb)
|
||||
{
|
||||
psfCurrent = psfDesktop;
|
||||
}
|
||||
else
|
||||
{
|
||||
hr = psfDesktop->BindToObject(pidlCurrent, NULL, IID_PPV_ARG(IShellFolder, &psfCurrent));
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
goto parseabsolute;
|
||||
|
||||
hr = psfCurrent->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlRelative, &attributes);
|
||||
WCHAR szPath[MAX_PATH], szFullPath[MAX_PATH];
|
||||
if (PathIsRelativeW(address) && SHGetPathFromIDListW(pidlCurrent, szPath))
|
||||
{
|
||||
PathAppendW(szPath, address);
|
||||
if (GetFullPathNameW(szPath, _countof(szFullPath), szFullPath, NULL))
|
||||
{
|
||||
address.Free();
|
||||
SHStrDupW(szFullPath, &address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = psfCurrent->ParseDisplayName(topLevelWindow, NULL, address, &eaten, &pidlRelative, &attributes);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_pidlLastParsed.Attach(ILCombine(pidlCurrent, pidlRelative));
|
||||
return hr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
parseabsolute:
|
||||
@@ -271,6 +289,7 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
|
||||
|
||||
if (!m_pidlLastParsed)
|
||||
return E_FAIL;
|
||||
|
||||
bParsedForExec = TRUE;
|
||||
}
|
||||
|
||||
@@ -304,7 +323,7 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
|
||||
/*
|
||||
* Attempt to browse to the parsed pidl
|
||||
*/
|
||||
hr = pisb->BrowseObject(m_pidlLastParsed, 0);
|
||||
hr = pisb->BrowseObject(m_pidlLastParsed, SBSP_SAMEBROWSER | SBSP_ABSOLUTE);
|
||||
if (SUCCEEDED(hr))
|
||||
return hr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user