@@ -273,7 +273,8 @@ class CDefView :
273273 CComPtr<IContextMenu> m_pFileMenu;
274274
275275 BOOL m_isEditing;
276- BOOL m_isParentFolderSpecial;
276+ signed char m_SpecialFolder;
277+ bool m_isFullStatusBar;
277278 bool m_ScheduledStatusbarUpdate;
278279 bool m_HasCutItems;
279280
@@ -294,6 +295,12 @@ class CDefView :
294295 void _DoCopyToMoveToFolder (BOOL bCopy);
295296 BOOL IsDesktop () const { return m_FolderSettings.fFlags & FWF_DESKTOP; }
296297
298+ inline BOOL IsSpecialFolder (int &csidl) const
299+ {
300+ csidl = m_SpecialFolder;
301+ return m_SpecialFolder >= 0 ;
302+ }
303+
297304public:
298305 CDefView ();
299306 ~CDefView ();
@@ -302,6 +309,7 @@ class CDefView :
302309 HRESULT OnDefaultCommand ();
303310 HRESULT OnStateChange (UINT uFlags);
304311 void UpdateStatusbar ();
312+ void UpdateStatusbarLocation ();
305313 void CheckToolbar ();
306314 BOOL CreateList ();
307315 void UpdateListColors ();
@@ -601,7 +609,8 @@ CDefView::CDefView() :
601609 m_iDragOverItem(0 ),
602610 m_cScrollDelay(0 ),
603611 m_isEditing(FALSE ),
604- m_isParentFolderSpecial(FALSE ),
612+ m_SpecialFolder(-1 ),
613+ m_isFullStatusBar(true ),
605614 m_ScheduledStatusbarUpdate(false ),
606615 m_HasCutItems(false ),
607616 m_Destroyed(FALSE )
@@ -721,8 +730,8 @@ void CDefView::CheckToolbar()
721730
722731void CDefView::UpdateStatusbar ()
723732{
724- WCHAR szFormat[MAX_PATH] = { 0 } ;
725- WCHAR szPartText[MAX_PATH] = { 0 } ;
733+ WCHAR szFormat[MAX_PATH];
734+ WCHAR szPartText[MAX_PATH];
726735 UINT cSelectedItems;
727736
728737 if (!m_ListView)
@@ -744,11 +753,10 @@ void CDefView::UpdateStatusbar()
744753 m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETTEXT, 0 , (LPARAM)szPartText, &lResult);
745754
746755 // Don't bother with the extra processing if we only have one StatusBar part
747- if (!m_isParentFolderSpecial )
756+ if (m_isFullStatusBar )
748757 {
749758 UINT64 uTotalFileSize = 0 ;
750759 WORD uFileFlags = LVNI_ALL;
751- LPARAM pIcon = NULL ;
752760 INT nItem = -1 ;
753761 bool bIsOnlyFoldersSelected = true ;
754762
@@ -773,25 +781,11 @@ void CDefView::UpdateStatusbar()
773781 // Don't show the file size text if there is 0 bytes in the folder
774782 // OR we only have folders selected
775783 if ((cSelectedItems && !bIsOnlyFoldersSelected) || uTotalFileSize)
776- {
777784 StrFormatByteSizeW (uTotalFileSize, szPartText, _countof (szPartText));
778- }
779785 else
780- {
781786 *szPartText = 0 ;
782- }
783787
784788 m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETTEXT, 1 , (LPARAM)szPartText, &lResult);
785-
786- // If we are in a Recycle Bin then show no text for the location part
787- if (!_ILIsBitBucket (m_pidlParent))
788- {
789- LoadStringW (shell32_hInstance, IDS_MYCOMPUTER, szPartText, _countof (szPartText));
790- pIcon = (LPARAM)m_hMyComputerIcon;
791- }
792-
793- m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETICON, 2 , pIcon, &lResult);
794- m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETTEXT, 2 , (LPARAM)szPartText, &lResult);
795789 }
796790
797791 SFGAOF att = 0 ;
@@ -806,6 +800,32 @@ void CDefView::UpdateStatusbar()
806800 m_pShellBrowser->SendControlMsg (FCW_TOOLBAR, TB_ENABLEBUTTON, FCIDM_SHVIEW_MOVETO, (att & SFGAO_CANMOVE) != 0 , &lResult);
807801}
808802
803+ void CDefView::UpdateStatusbarLocation ()
804+ {
805+ LRESULT lResult;
806+ LPARAM pIcon = NULL ;
807+ WCHAR szPartText[MAX_PATH];
808+ *szPartText = 0 ;
809+ if (m_isFullStatusBar)
810+ {
811+ // If we are in a Recycle Bin then show no text for the location part
812+ int csidl;
813+ if (!IsSpecialFolder (csidl) || (csidl != CSIDL_NETWORK && csidl != CSIDL_BITBUCKET))
814+ {
815+ LoadStringW (shell32_hInstance, IDS_MYCOMPUTER, szPartText, _countof (szPartText));
816+ pIcon = (LPARAM)m_hMyComputerIcon;
817+ }
818+ /* else if (csidl == CSIDL_NETWORK) // TODO: Figure out the type of share (My Computer/Local Intranet/Internet?)
819+ {
820+ ImageList_GetIconSize(ListView_GetImageList(m_ListView, LVSIL_SMALL), &x, &y);
821+ pIcon = (LPARAM)LoadImage(shell32_hInstance, MAKEINTRESOURCEW(IDI_SHELL_MY_NETWORK_PLACES),
822+ IMAGE_ICON, x, y, LR_SHARED);
823+ }*/
824+ }
825+ m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETICON, 2 , pIcon, &lResult);
826+ m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETTEXT, 2 , (LPARAM)szPartText, &lResult);
827+ }
828+
809829LRESULT CDefView::OnUpdateStatusbar (UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
810830{
811831 m_ScheduledStatusbarUpdate = false ;
@@ -1555,7 +1575,7 @@ HRESULT CDefView::FillList(BOOL IsRefreshCommand)
15551575 // copy the items into the array
15561576 while ((S_OK == pEnumIDList->Next (1 , &pidl, &dwFetched)) && dwFetched)
15571577 {
1558- if (DPA_InsertPtr (hdpa, 0x7fff , pidl) == -1 )
1578+ if (DPA_AppendPtr (hdpa, pidl) == -1 )
15591579 {
15601580 SHFree (pidl);
15611581 }
@@ -1605,6 +1625,9 @@ HRESULT CDefView::FillList(BOOL IsRefreshCommand)
16051625 m_ListView.InvalidateRect (NULL , TRUE );
16061626 }
16071627
1628+ if (IsRefreshCommand)
1629+ UpdateStatusbarLocation ();
1630+
16081631 _DoFolderViewCB (SFVM_LISTREFRESHED, 0 , 0 );
16091632
16101633 return S_OK;
@@ -1793,22 +1816,27 @@ LRESULT CDefView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandl
17931816
17941817 m_hAccel = LoadAcceleratorsW (shell32_hInstance, MAKEINTRESOURCEW (IDA_SHELLVIEW));
17951818
1796- BOOL bPreviousParentSpecial = m_isParentFolderSpecial;
1797-
1798- // A folder is special if it is the Desktop folder,
1799- // a network folder, or a Control Panel folder
1800- m_isParentFolderSpecial = IsDesktop () || _ILIsNetHood (m_pidlParent)
1801- || _ILIsControlPanel (ILFindLastID (m_pidlParent));
1802-
1803- // Only force StatusBar part refresh if the state
1804- // changed from the previous folder
1805- if (bPreviousParentSpecial != m_isParentFolderSpecial)
1819+ int bForceFullStatusBar = false ;
1820+ BOOL bIsFileSystem = SHGetAttributes (NULL , m_pidlParent, SFGAO_FILESYSTEM) & SFGAO_FILESYSTEM;
1821+ m_SpecialFolder = bIsFileSystem ? -1 : 0x7f ; // FS folder or "generic" CSIDL
1822+ if (_ILIsDesktop (m_pidlParent))
18061823 {
1807- // This handles changing StatusBar parts
1808- _ForceStatusBarResize ();
1824+ m_SpecialFolder = CSIDL_DESKTOP;
18091825 }
1810-
1826+ else if (IsEqualPersistClassID (ppf2, CLSID_RecycleBin))
1827+ {
1828+ m_SpecialFolder = bForceFullStatusBar = CSIDL_BITBUCKET;
1829+ }
1830+ else if (bIsFileSystem)
1831+ {
1832+ CComHeapPtr<ITEMIDLIST> pidlNet (SHCloneSpecialIDList (NULL , CSIDL_NETWORK, FALSE ));
1833+ if (ILIsParent (pidlNet, m_pidlParent, FALSE ) && ILGetSize (pidlNet) < ILGetSize (m_pidlParent))
1834+ m_SpecialFolder = CSIDL_NETWORK;
1835+ }
1836+ m_isFullStatusBar = bIsFileSystem || bForceFullStatusBar;
1837+ _ForceStatusBarResize (); // This handles changing StatusBar parts
18111838 UpdateStatusbar ();
1839+ UpdateStatusbarLocation ();
18121840
18131841 return S_OK;
18141842}
@@ -4474,7 +4502,7 @@ void CDefView::_HandleStatusBarResize(int nWidth)
44744502{
44754503 LRESULT lResult;
44764504
4477- if (m_isParentFolderSpecial )
4505+ if (!m_isFullStatusBar )
44784506 {
44794507 int nPartArray[] = {-1 };
44804508 m_pShellBrowser->SendControlMsg (FCW_STATUS, SB_SETPARTS, _countof (nPartArray), (LPARAM)nPartArray, &lResult);
0 commit comments