mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 08:53:02 +00:00
[BROWSEUI] Set AddressBand Go button checkbox state correctly in menu (#7771)
CORE-20018
This commit is contained in:
parent
5461abeeba
commit
5af47c9baf
6 changed files with 43 additions and 10 deletions
|
@ -37,6 +37,9 @@ TODO:
|
||||||
Implement Save
|
Implement Save
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Unique GUID of the DLL where this CAddressBand is implemented so we can tell if it's really us
|
||||||
|
static const GUID THISMODULE_GUID = { 0x60ebab6e, 0x2e4b, 0x42f6, { 0x8a,0xbc,0x80,0x73,0x1c,0xa6,0x42,0x02} };
|
||||||
|
|
||||||
CAddressBand::CAddressBand()
|
CAddressBand::CAddressBand()
|
||||||
{
|
{
|
||||||
fEditControl = NULL;
|
fEditControl = NULL;
|
||||||
|
@ -49,6 +52,20 @@ CAddressBand::~CAddressBand()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL CAddressBand::ShouldShowGoButton()
|
||||||
|
{
|
||||||
|
return SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL CAddressBand::IsGoButtonVisible(IUnknown *pUnkBand)
|
||||||
|
{
|
||||||
|
CComPtr<IAddressBand> pAB;
|
||||||
|
IUnknown_QueryService(pUnkBand, THISMODULE_GUID, IID_PPV_ARG(IAddressBand, &pAB));
|
||||||
|
if (pAB)
|
||||||
|
return static_cast<CAddressBand*>(pAB.p)->fGoButtonShown;
|
||||||
|
return ShouldShowGoButton(); // We don't know, return the global state
|
||||||
|
}
|
||||||
|
|
||||||
void CAddressBand::FocusChange(BOOL bFocus)
|
void CAddressBand::FocusChange(BOOL bFocus)
|
||||||
{
|
{
|
||||||
// m_bFocus = bFocus;
|
// m_bFocus = bFocus;
|
||||||
|
@ -168,7 +185,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::SetSite(IUnknown *pUnkSite)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
fGoButtonShown = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
fGoButtonShown = ShouldShowGoButton();
|
||||||
if (fGoButtonShown)
|
if (fGoButtonShown)
|
||||||
CreateGoButton();
|
CreateGoButton();
|
||||||
|
|
||||||
|
@ -365,7 +382,7 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if (wParam == IDM_TOOLBARS_GOBUTTON)
|
if (wParam == IDM_TOOLBARS_GOBUTTON)
|
||||||
{
|
{
|
||||||
fGoButtonShown = !SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", FALSE, TRUE);
|
fGoButtonShown = !IsGoButtonVisible(static_cast<IAddressBand*>(this));
|
||||||
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", REG_SZ, fGoButtonShown ? (LPVOID)L"yes" : (LPVOID)L"no", fGoButtonShown ? 8 : 6, SHREGSET_FORCE_HKCU);
|
SHRegSetUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main", L"ShowGoButton", REG_SZ, fGoButtonShown ? (LPVOID)L"yes" : (LPVOID)L"no", fGoButtonShown ? 8 : 6, SHREGSET_FORCE_HKCU);
|
||||||
if (!fGoButton)
|
if (!fGoButton)
|
||||||
CreateGoButton();
|
CreateGoButton();
|
||||||
|
@ -421,6 +438,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::Refresh(long param8)
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE CAddressBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
HRESULT STDMETHODCALLTYPE CAddressBand::QueryService(REFGUID guidService, REFIID riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
|
if (guidService == THISMODULE_GUID)
|
||||||
|
return QueryInterface(riid, ppvObject);
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ private:
|
||||||
void FocusChange(BOOL bFocus);
|
void FocusChange(BOOL bFocus);
|
||||||
void CreateGoButton();
|
void CreateGoButton();
|
||||||
public:
|
public:
|
||||||
|
static BOOL ShouldShowGoButton();
|
||||||
|
static BOOL IsGoButtonVisible(IUnknown *pUnkBand);
|
||||||
|
|
||||||
// *** IDeskBand methods ***
|
// *** IDeskBand methods ***
|
||||||
STDMETHOD(GetBandInfo)(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override;
|
STDMETHOD(GetBandInfo)(DWORD dwBandID, DWORD dwViewMode, DESKBANDINFO *pdbi) override;
|
||||||
|
|
||||||
|
|
|
@ -658,6 +658,16 @@ HRESULT CInternetToolbar::EnumBands(UINT Index, int *pBandId, IUnknown **ppUnkBa
|
||||||
return *ppUnkBand ? S_OK : S_FALSE;
|
return *ppUnkBand ? S_OK : S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT CInternetToolbar::QIBand(int BandID, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
IUnknown *pUnk; // Not ref. counted
|
||||||
|
int temp = (UINT) SendMessageW(fMainReBar, RB_IDTOINDEX, BandID, 0);
|
||||||
|
if (EnumBands(temp, &temp, &pUnk) == S_OK)
|
||||||
|
return pUnk->QueryInterface(riid, ppv);
|
||||||
|
*ppv = NULL;
|
||||||
|
return E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
|
HRESULT CInternetToolbar::ReserveBorderSpace(LONG maxHeight)
|
||||||
{
|
{
|
||||||
CComPtr<IDockingWindowSite> dockingWindowSite;
|
CComPtr<IDockingWindowSite> dockingWindowSite;
|
||||||
|
@ -1746,6 +1756,7 @@ LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
RBHITTESTINFO hitTestInfo;
|
RBHITTESTINFO hitTestInfo;
|
||||||
REBARBANDINFOW rebarBandInfo;
|
REBARBANDINFOW rebarBandInfo;
|
||||||
int bandID;
|
int bandID;
|
||||||
|
CComPtr<IAddressBand> pAddress;
|
||||||
|
|
||||||
clickLocation.x = LOWORD(lParam);
|
clickLocation.x = LOWORD(lParam);
|
||||||
clickLocation.y = HIWORD(lParam);
|
clickLocation.y = HIWORD(lParam);
|
||||||
|
@ -1780,6 +1791,8 @@ LRESULT CInternetToolbar::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||||
case ITBBID_ADDRESSBAND: // navigation band
|
case ITBBID_ADDRESSBAND: // navigation band
|
||||||
DeleteMenu(contextMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
|
DeleteMenu(contextMenu, IDM_TOOLBARS_CUSTOMIZE, MF_BYCOMMAND);
|
||||||
DeleteMenu(contextMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
|
DeleteMenu(contextMenu, IDM_TOOLBARS_TEXTLABELS, MF_BYCOMMAND);
|
||||||
|
QIBand(ITBBID_ADDRESSBAND, IID_PPV_ARG(IAddressBand, &pAddress));
|
||||||
|
pSettings->fShowGoButton = CAddressBand::IsGoButtonVisible(pAddress);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
virtual ~CInternetToolbar();
|
virtual ~CInternetToolbar();
|
||||||
void AddDockItem(IUnknown *newItem, int bandID, int flags);
|
void AddDockItem(IUnknown *newItem, int bandID, int flags);
|
||||||
HRESULT EnumBands(UINT Index, int *pBandId, IUnknown **ppUnkBand);
|
HRESULT EnumBands(UINT Index, int *pBandId, IUnknown **ppUnkBand);
|
||||||
|
HRESULT QIBand(int BandID, REFIID riid, void **ppv);
|
||||||
HRESULT ReserveBorderSpace(LONG maxHeight = -1);
|
HRESULT ReserveBorderSpace(LONG maxHeight = -1);
|
||||||
HRESULT CreateMenuBar(IShellMenu **menuBar);
|
HRESULT CreateMenuBar(IShellMenu **menuBar);
|
||||||
HRESULT CreateToolsBar(IUnknown **toolsBar);
|
HRESULT CreateToolsBar(IUnknown **toolsBar);
|
||||||
|
|
|
@ -26,8 +26,7 @@ void ShellSettings::Load()
|
||||||
fStatusBarVisible = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
|
fStatusBarVisible = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
|
||||||
L"StatusBarOther", FALSE, TRUE);
|
L"StatusBarOther", FALSE, TRUE);
|
||||||
|
|
||||||
fShowGoButton = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Main",
|
fShowGoButton = CAddressBand::ShouldShowGoButton();
|
||||||
L"ShowGoButton", FALSE, TRUE);
|
|
||||||
|
|
||||||
fLocked = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar",
|
fLocked = SHRegGetBoolUSValueW(L"Software\\Microsoft\\Internet Explorer\\Toolbar",
|
||||||
L"Locked", FALSE, TRUE);
|
L"Locked", FALSE, TRUE);
|
||||||
|
|
|
@ -1196,11 +1196,8 @@ HRESULT CShellBrowser::GetMenuBand(REFIID riid, void **shellMenu)
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
if (FAILED_UNEXPECTEDLY(hResult))
|
||||||
return hResult;
|
return hResult;
|
||||||
|
|
||||||
hResult = bandSite->QueryBand(1, &deskBand, NULL, NULL, 0);
|
hResult = bandSite->QueryBand(ITBBID_MENUBAND, &deskBand, NULL, NULL, 0);
|
||||||
if (FAILED_UNEXPECTEDLY(hResult))
|
return FAILED(hResult) ? hResult : deskBand->QueryInterface(riid, shellMenu); // It is expected that this might fail during WM_DESTROY
|
||||||
return hResult;
|
|
||||||
|
|
||||||
return deskBand->QueryInterface(riid, shellMenu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
|
HRESULT CShellBrowser::GetBaseBar(bool vertical, REFIID riid, void **theBaseBar)
|
||||||
|
@ -2097,7 +2094,7 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::QueryStatus(const GUID *pguidCmdGroup,
|
||||||
{
|
{
|
||||||
case IDM_GOTO_UPONELEVEL:
|
case IDM_GOTO_UPONELEVEL:
|
||||||
prgCmds->cmdf = OLECMDF_SUPPORTED;
|
prgCmds->cmdf = OLECMDF_SUPPORTED;
|
||||||
if (fCurrentDirectoryPIDL->mkid.cb != 0)
|
if (!_ILIsDesktop(fCurrentDirectoryPIDL))
|
||||||
prgCmds->cmdf |= OLECMDF_ENABLED;
|
prgCmds->cmdf |= OLECMDF_ENABLED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3696,6 +3693,7 @@ LRESULT CShellBrowser::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &
|
||||||
|
|
||||||
fCurrentShellFolder.Release();
|
fCurrentShellFolder.Release();
|
||||||
ILFree(fCurrentDirectoryPIDL);
|
ILFree(fCurrentDirectoryPIDL);
|
||||||
|
fCurrentDirectoryPIDL = NULL;
|
||||||
::DestroyWindow(fStatusBar);
|
::DestroyWindow(fStatusBar);
|
||||||
DestroyMenu(fCurrentMenuBar);
|
DestroyMenu(fCurrentMenuBar);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue