From: Amine Khaldi Date: Mon, 8 Jun 2015 12:01:53 +0000 (+0000) Subject: [BROWSEUI] Disable the Up button when we navigate up to the desktop. By Barrett Karis... X-Git-Tag: backups/colins-printing-for-freedom@73041~15^2~154 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=073b64f1bc4c1100b67b2c8550bff8b62f33560c;ds=sidebyside [BROWSEUI] Disable the Up button when we navigate up to the desktop. By Barrett Karish. CORE-8881 svn path=/trunk/; revision=68070 --- diff --git a/reactos/dll/win32/browseui/internettoolbar.cpp b/reactos/dll/win32/browseui/internettoolbar.cpp index 167c3d4aab7..969382a4c93 100644 --- a/reactos/dll/win32/browseui/internettoolbar.cpp +++ b/reactos/dll/win32/browseui/internettoolbar.cpp @@ -798,6 +798,10 @@ HRESULT CInternetToolbar::CommandStateChanged(bool newValue, int commandID) // back hResult = SetState(&CLSID_CommonButtons, IDM_GOTO_BACK, newValue ? TBSTATE_ENABLED : 0); break; + case 3: + // up + hResult = SetState(&CLSID_CommonButtons, IDM_GOTO_UPONELEVEL, newValue ? TBSTATE_ENABLED : 0); + break; } return hResult; } diff --git a/reactos/dll/win32/browseui/shellbrowser.cpp b/reactos/dll/win32/browseui/shellbrowser.cpp index a30e87fb27a..ef41f836a72 100644 --- a/reactos/dll/win32/browseui/shellbrowser.cpp +++ b/reactos/dll/win32/browseui/shellbrowser.cpp @@ -342,6 +342,7 @@ public: HRESULT FireCommandStateChange(bool newState, int commandID); HRESULT FireCommandStateChangeAll(); HRESULT UpdateForwardBackState(); + HRESULT UpdateUpState(); void UpdateGotoMenu(HMENU theMenu); void UpdateViewMenu(HMENU theMenu); @@ -1065,6 +1066,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder, FireCommandStateChangeAll(); hResult = UpdateForwardBackState(); + hResult = UpdateUpState(); return S_OK; } @@ -1193,6 +1195,11 @@ HRESULT CShellBrowser::NavigateToParent() LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL); if (newDirectory == NULL) return E_OUTOFMEMORY; + if (_ILIsDesktop(newDirectory)) + { + ILFree(newDirectory); + return E_INVALIDARG; + } ILRemoveLastID(newDirectory); HRESULT hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY); ILFree(newDirectory); @@ -1498,6 +1505,18 @@ HRESULT CShellBrowser::UpdateForwardBackState() return S_OK; } +HRESULT CShellBrowser::UpdateUpState() +{ + bool canGoUp; + HRESULT hResult; + + canGoUp = true; + if (_ILIsDesktop(fCurrentDirectoryPIDL)) + canGoUp = false; + hResult = FireCommandStateChange(canGoUp, 3); + return S_OK; +} + void CShellBrowser::UpdateGotoMenu(HMENU theMenu) { CComPtr travelLog;