Author: akhaldi
Date: Mon Jun  8 12:01:53 2015
New Revision: 68070

URL: http://svn.reactos.org/svn/reactos?rev=68070&view=rev
Log:
[BROWSEUI] Disable the Up button when we navigate up to the desktop. By Barrett 
Karish. CORE-8881

Modified:
    trunk/reactos/dll/win32/browseui/internettoolbar.cpp
    trunk/reactos/dll/win32/browseui/shellbrowser.cpp

Modified: trunk/reactos/dll/win32/browseui/internettoolbar.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/internettoolbar.cpp?rev=68070&r1=68069&r2=68070&view=diff
==============================================================================
--- trunk/reactos/dll/win32/browseui/internettoolbar.cpp        [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/browseui/internettoolbar.cpp        [iso-8859-1] 
Mon Jun  8 12:01:53 2015
@@ -797,6 +797,10 @@
         case 2:
             // 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;

Modified: trunk/reactos/dll/win32/browseui/shellbrowser.cpp
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/browseui/shellbrowser.cpp?rev=68070&r1=68069&r2=68070&view=diff
==============================================================================
--- trunk/reactos/dll/win32/browseui/shellbrowser.cpp   [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/browseui/shellbrowser.cpp   [iso-8859-1] Mon Jun  8 
12:01:53 2015
@@ -342,6 +342,7 @@
     HRESULT FireCommandStateChange(bool newState, int commandID);
     HRESULT FireCommandStateChangeAll();
     HRESULT UpdateForwardBackState();
+    HRESULT UpdateUpState();
     void UpdateGotoMenu(HMENU theMenu);
     void UpdateViewMenu(HMENU theMenu);
 
@@ -1065,6 +1066,7 @@
 
     FireCommandStateChangeAll();
     hResult = UpdateForwardBackState();
+    hResult = UpdateUpState();
     return S_OK;
 }
 
@@ -1193,6 +1195,11 @@
     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 @@
     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<ITravelLog>                     travelLog;


Reply via email to