From c9062743c48bc83f4786297c9aa42855c25273d6 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sun, 30 Dec 2012 20:38:31 +1300 Subject: [PATCH 1/2] fixed: the auto-addition of '..' when the list is empty did not show up on filtered lists --- xbmc/windows/GUIMediaWindow.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 04dad3254718b..2659bc5896ef9 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -873,18 +873,6 @@ bool CGUIMediaWindow::Update(const CStdString &strDirectory, bool updateFilterPa // filtering on the items, setting thumbs. OnPrepareFileItems(*m_vecItems); - // The idea here is to ensure we have something to focus if our file list - // is empty. As such, this check MUST be last and ignore the hide parent - // fileitems settings. - if (m_vecItems->IsEmpty()) - { - CFileItemPtr pItem(new CFileItem("..")); - pItem->SetPath(m_history.GetParentPath()); - pItem->m_bIsFolder = true; - pItem->m_bIsShareOrDrive = false; - m_vecItems->AddFront(pItem, 0); - } - m_vecItems->FillInDefaultIcons(); m_guiState.reset(CGUIViewState::GetViewState(GetID(), *m_vecItems)); @@ -1768,7 +1756,19 @@ void CGUIMediaWindow::OnFilterItems(const CStdString &filter) } } } - + + // The idea here is to ensure we have something to focus if our file list + // is empty. As such, this check MUST be last and ignore the hide parent + // fileitems settings. + if (m_vecItems->IsEmpty()) + { + CFileItemPtr pItem(new CFileItem("..")); + pItem->SetPath(m_history.GetParentPath()); + pItem->m_bIsFolder = true; + pItem->m_bIsShareOrDrive = false; + m_vecItems->AddFront(pItem, 0); + } + // and update our view control + buttons m_viewControl.SetItems(*m_vecItems); m_viewControl.SetSelectedItem(currentItemPath); From ede31b20a263295f1ab04b8ed715e37900530d7a Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sun, 30 Dec 2012 20:39:15 +1300 Subject: [PATCH 2/2] remove unnecessary toast + parent folder of empty lists after filtering - the '..' item is shown, so this won't be hit anyway --- xbmc/windows/GUIMediaWindow.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index 2659bc5896ef9..6f8c01690e460 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -934,22 +934,9 @@ bool CGUIMediaWindow::Refresh(bool clearCache /* = false */) m_vecItems->RemoveDiscCache(GetID()); // get the original number of items - int oldCount = m_filter.IsEmpty() ? m_vecItems->Size() : m_unfilteredItems->Size(); if (!Update(strCurrentDirectory, false)) return false; - // check if we previously had at least 1 item - // in the list and whether it now went down to 0 - // if there are no more items to show after the update - // we go one level up in the hierachry to not show an - // empty list - if (oldCount > 0 && - (m_filter.IsEmpty() ? m_vecItems->Size() : m_unfilteredItems->Size()) <= 0) - { - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, g_localizeStrings.Get(2080), g_localizeStrings.Get(2081)); - GoParentFolder(); - } - return true; }