From f7d9331e9fbebeb218619e00bd86be5bd85ad93f Mon Sep 17 00:00:00 2001
From: Pasha Golovko <mythtv@golovko.org>
Date: Wed, 20 Jan 2010 14:31:11 -0800
Subject: [PATCH] Fixes #7425. Update tree position remmeber functionality for post-MythUI changes.

---
 mythplugins/mythvideo/mythvideo/videodlg.cpp |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/mythplugins/mythvideo/mythvideo/videodlg.cpp b/mythplugins/mythvideo/mythvideo/videodlg.cpp
index 24a6c1a..066cf85 100644
--- a/mythplugins/mythvideo/mythvideo/videodlg.cpp
+++ b/mythplugins/mythvideo/mythvideo/videodlg.cpp
@@ -1432,6 +1432,7 @@ class VideoDialogPrivate
 
         if (m_rememberPosition && m_lastTreeNodePath.length())
         {
+            VERBOSE(VB_GENERAL, QString("Saving tree position: %1").arg(m_lastTreeNodePath));
             gContext->SaveSetting("mythvideo.VideoTreeLastActive",
                     m_lastTreeNodePath);
         }
@@ -1797,9 +1798,14 @@ void VideoDialog::loadData()
 
             if (m_d->m_rememberPosition)
             {
-                QStringList route =
-                        gContext->GetSetting("mythvideo.VideoTreeLastActive",
-                                "").split("\n");
+                /*
+                 * We need to remove first element of the route since it is the name of the
+                 * root 'Video Home' element
+                 */
+                m_d->m_lastTreeNodePath = gContext->GetSetting("mythvideo.VideoTreeLastActive", "");
+                QStringList route = m_d->m_lastTreeNodePath.split("\n");
+                route.removeFirst(); 
+                VERBOSE(VB_GENERAL, QString("Setting tree position: %1").arg(route.join("->")));
                 m_videoButtonTree->SetNodeByString(route);
             }
         }
@@ -2916,6 +2922,7 @@ void VideoDialog::UpdateText(MythUIButtonListItem *item)
 
     if (m_d->m_currentNode)
         CheckedSet(m_crumbText, m_d->m_currentNode->getRouteByString().join(" > "));
+    m_d->m_lastTreeNodePath = m_d->m_currentNode->getRouteByString().join("\n");
 
     if (node && node->getInt() == kSubFolder)
         CheckedSet(this, "childcount",
-- 
1.6.0.4


