[BROWSEUI] Disable the Up button when we navigate up to the desktop. By Barrett Karish. CORE-8881

svn path=/trunk/; revision=68070
This commit is contained in:
Amine Khaldi 2015-06-08 12:01:53 +00:00
parent 66b9b5427f
commit 073b64f1bc
2 changed files with 23 additions and 0 deletions

View file

@ -798,6 +798,10 @@ HRESULT CInternetToolbar::CommandStateChanged(bool newValue, int commandID)
// back // back
hResult = SetState(&CLSID_CommonButtons, IDM_GOTO_BACK, newValue ? TBSTATE_ENABLED : 0); hResult = SetState(&CLSID_CommonButtons, IDM_GOTO_BACK, newValue ? TBSTATE_ENABLED : 0);
break; break;
case 3:
// up
hResult = SetState(&CLSID_CommonButtons, IDM_GOTO_UPONELEVEL, newValue ? TBSTATE_ENABLED : 0);
break;
} }
return hResult; return hResult;
} }

View file

@ -342,6 +342,7 @@ public:
HRESULT FireCommandStateChange(bool newState, int commandID); HRESULT FireCommandStateChange(bool newState, int commandID);
HRESULT FireCommandStateChangeAll(); HRESULT FireCommandStateChangeAll();
HRESULT UpdateForwardBackState(); HRESULT UpdateForwardBackState();
HRESULT UpdateUpState();
void UpdateGotoMenu(HMENU theMenu); void UpdateGotoMenu(HMENU theMenu);
void UpdateViewMenu(HMENU theMenu); void UpdateViewMenu(HMENU theMenu);
@ -1065,6 +1066,7 @@ HRESULT CShellBrowser::BrowseToPath(IShellFolder *newShellFolder,
FireCommandStateChangeAll(); FireCommandStateChangeAll();
hResult = UpdateForwardBackState(); hResult = UpdateForwardBackState();
hResult = UpdateUpState();
return S_OK; return S_OK;
} }
@ -1193,6 +1195,11 @@ HRESULT CShellBrowser::NavigateToParent()
LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL); LPITEMIDLIST newDirectory = ILClone(fCurrentDirectoryPIDL);
if (newDirectory == NULL) if (newDirectory == NULL)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (_ILIsDesktop(newDirectory))
{
ILFree(newDirectory);
return E_INVALIDARG;
}
ILRemoveLastID(newDirectory); ILRemoveLastID(newDirectory);
HRESULT hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY); HRESULT hResult = BrowseToPIDL(newDirectory, BTP_UPDATE_CUR_HISTORY | BTP_UPDATE_NEXT_HISTORY);
ILFree(newDirectory); ILFree(newDirectory);
@ -1498,6 +1505,18 @@ HRESULT CShellBrowser::UpdateForwardBackState()
return S_OK; 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) void CShellBrowser::UpdateGotoMenu(HMENU theMenu)
{ {
CComPtr<ITravelLog> travelLog; CComPtr<ITravelLog> travelLog;