mirror of
https://github.com/reactos/reactos.git
synced 2025-04-22 13:10:39 +00:00
[BROWSUI]
- Fix CAddressBand::Invoke to correctly detect if an item exists in the list and select the correct item when it does. - Improve CAddressEditBox::Execute to check if the passed pidl is the one that is being displayed. - Also fix it to parse the path if needed. - Directly call CAddressEditBox::Execute when enter is pressed or the Go button is pressed - Should fix most issues with the address bar svn path=/branches/shell-experiments/; revision=65036
This commit is contained in:
parent
dffea1c618
commit
a4feb3fb65
2 changed files with 73 additions and 17 deletions
|
@ -489,12 +489,17 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Invoke(DISPID dispIdMember, REFIID riid,
|
|||
|
||||
oldIndex = SendMessage(m_hWnd, CB_GETCURSEL, 0, 0);
|
||||
|
||||
itemExists = FALSE;
|
||||
pidlPrevious = NULL;
|
||||
|
||||
ZeroMemory(&item, sizeof(item));
|
||||
item.mask = CBEIF_LPARAM;
|
||||
item.iItem = 0;
|
||||
itemExists = SendMessage(m_hWnd, CBEM_GETITEM, 0, reinterpret_cast<LPARAM>(&item));
|
||||
if (itemExists)
|
||||
if (SendMessage(m_hWnd, CBEM_GETITEM, 0, reinterpret_cast<LPARAM>(&item)))
|
||||
{
|
||||
pidlPrevious = reinterpret_cast<LPITEMIDLIST>(item.lParam);
|
||||
if (pidlPrevious)
|
||||
itemExists = TRUE;
|
||||
}
|
||||
|
||||
hr = IUnknown_QueryService(fSite, SID_STopLevelBrowser, IID_PPV_ARG(IBrowserService, &isb));
|
||||
|
@ -520,6 +525,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Invoke(DISPID dispIdMember, REFIID riid,
|
|||
if (itemExists)
|
||||
{
|
||||
result = SendMessage(m_hWnd, CBEM_SETITEM, 0, reinterpret_cast<LPARAM>(&item));
|
||||
oldIndex = 0;
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
|
|
@ -149,30 +149,72 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::Execute(long paramC)
|
|||
{
|
||||
HRESULT hr;
|
||||
|
||||
/*
|
||||
* Parse the path is it wasn't parsed
|
||||
*/
|
||||
if (!pidlLastParsed)
|
||||
ParseNow(0);
|
||||
|
||||
if (!pidlLastParsed)
|
||||
return E_FAIL;
|
||||
|
||||
/*
|
||||
* Get the IShellBrowser and IBrowserService interfaces of the shell browser
|
||||
*/
|
||||
CComPtr<IShellBrowser> pisb;
|
||||
hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pisb));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
CComPtr<IBrowserService> pbs;
|
||||
pisb->QueryInterface(IID_PPV_ARG(IBrowserService, &pbs));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
/*
|
||||
* Get the current pidl of the shellbrowser and check if it is the same with the parsed one
|
||||
*/
|
||||
PIDLIST_ABSOLUTE pidl;
|
||||
hr = pbs->GetPidl(&pidl);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
CComPtr<IShellFolder> psf;
|
||||
hr = SHGetDesktopFolder(&psf);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = psf->CompareIDs(0, pidl, pidlLastParsed);
|
||||
|
||||
SHFree(pidl);
|
||||
if (hr == 0)
|
||||
return S_OK;
|
||||
|
||||
/*
|
||||
* Attempt to browse to the parsed pidl
|
||||
*/
|
||||
hr = pisb->BrowseObject(pidlLastParsed, 0);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = pisb->BrowseObject(pidlLastParsed, 0);
|
||||
if (FAILED_UNEXPECTEDLY(hr))
|
||||
{
|
||||
HWND topLevelWindow;
|
||||
LPCITEMIDLIST pidlChild;
|
||||
CComPtr<IShellFolder> sf;
|
||||
CComPtr<IShellBrowser> pisb;
|
||||
return hr;
|
||||
|
||||
hr = IUnknown_QueryService(fSite, SID_SShellBrowser, IID_PPV_ARG(IShellBrowser, &pisb));
|
||||
/*
|
||||
* Browsing to the pidl failed so it's not a folder. So invoke its defaule command.
|
||||
*/
|
||||
HWND topLevelWindow;
|
||||
hr = IUnknown_GetWindow(pisb, &topLevelWindow);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
IUnknown_GetWindow(pisb, &topLevelWindow);
|
||||
LPCITEMIDLIST pidlChild;
|
||||
CComPtr<IShellFolder> sf;
|
||||
hr = SHBindToParent(pidlLastParsed, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
hr = SHBindToParent(pidlLastParsed, IID_PPV_ARG(IShellFolder, &sf), &pidlChild);
|
||||
hr = SHInvokeDefaultCommand(topLevelWindow, sf, pidlChild);
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
SHInvokeDefaultCommand(topLevelWindow, sf, pidlChild);
|
||||
}
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -194,7 +236,15 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(
|
|||
hdr = (LPNMHDR) lParam;
|
||||
if (hdr->code == CBEN_ENDEDIT)
|
||||
{
|
||||
ParseNow(0);
|
||||
NMCBEENDEDITW *endEdit = (NMCBEENDEDITW*) lParam;
|
||||
if (endEdit->iWhy == CBENF_RETURN)
|
||||
{
|
||||
Execute(0);
|
||||
}
|
||||
else if (endEdit->iWhy == CBENF_ESCAPE)
|
||||
{
|
||||
/* Reset the contents of the combo box */
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue