Don't clobber path history when running a search
authorGarrett Brown <garbearucla@gmail.com>
Tue, 25 Jun 2013 17:47:35 +0000 (10:47 -0700)
committerGarrett Brown <garbearucla@gmail.com>
Tue, 25 Jun 2013 18:41:33 +0000 (11:41 -0700)
xbmc/filesystem/DirectoryHistory.cpp
xbmc/filesystem/DirectoryHistory.h
xbmc/music/windows/GUIWindowMusicNav.cpp

index 12124c6..6f9fb7c 100644 (file)
@@ -118,6 +118,15 @@ void CDirectoryHistory::ClearPathHistory()
   m_vecPathHistory.clear();
 }
 
+void CDirectoryHistory::ClearSearchHistory()
+{
+  for (vector<CPathHistoryItem>::iterator it = m_vecPathHistory.begin(); it != m_vecPathHistory.end(); ++it)
+  {
+    if (it->GetPath().Left(14) == "musicsearch://")
+      it = m_vecPathHistory.erase(it);
+  }
+}
+
 void CDirectoryHistory::DumpPathHistory()
 {
   // debug log
index 1608718..6f8c6b0 100644 (file)
@@ -59,6 +59,7 @@ public:
   CStdString GetParentPath(bool filter = false);
   CStdString RemoveParentPath(bool filter = false);
   void ClearPathHistory();
+  void ClearSearchHistory();
   void DumpPathHistory();
 
 private:
index bbe1da9..3a2439e 100644 (file)
@@ -772,7 +772,7 @@ void CGUIWindowMusicNav::OnSearchUpdate()
   if (!search.IsEmpty())
   {
     CStdString path = "musicsearch://" + search + "/";
-    m_history.ClearPathHistory();
+    m_history.ClearSearchHistory();
     Update(path);
   }
   else if (m_vecItems->IsVirtualDirectoryRoot())