[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    extragear/multimedia/amarok/src
From:       Nikolaj Hald Nielsen <nhnFreespirit () gmail ! com>
Date:       2009-07-14 20:13:12
Message-ID: 1247602392.928382.26844.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 996747 by nhnielsen:

Save browser location on shutdown and restore it on startup. Works for all \
categories, except for scripted servies which might not yet have been loaded this \
                early in the startup process.
BUG: 200113


 M  +11 -0     MainWindow.cpp  
 M  +23 -6     browsers/BrowserCategoryList.cpp  


--- trunk/extragear/multimedia/amarok/src/MainWindow.cpp #996746:996747
@@ -151,6 +151,12 @@
     setPlainCaption( i18n( AMAROK_CAPTION ) );
 
     init();  // We could as well move the code from init() here, but meh.. getting a \
tad long +
+    //restore active category ( as well as filters and levels and whatnot.. )
+    const QString path = config.readEntry( "Browser Path", QString() );
+    if ( !path.isEmpty() )
+        browserWidget()->list()->navigate( path );
+    
 }
 
 MainWindow::~MainWindow()
@@ -161,6 +167,11 @@
     config.writeEntry( "MainWindow Size", size() );
     config.writeEntry( "MainWindow Position", pos() );
 
+    //save currently active category
+    
+    config.writeEntry( "Browser Path", browserWidget()->list()->path() );
+    
+
     QList<int> sPanels;
 
     //foreach( int a, m_splitter->saveState() )
--- trunk/extragear/multimedia/amarok/src/browsers/BrowserCategoryList.cpp \
#996746:996747 @@ -257,10 +257,27 @@
     if ( categories.size() == 0 )
         return QString();
 
+    //remove our own name if present, before passing on...
+    if ( categories.at( 0 ) == name() )
+    {
+        debug() << "removing own name (" << categories.at( 0 ) << ") from path";
+        categories.removeFirst();
+
+        if ( categories.size() == 0 )
+        {
+            //nothing else left, make sure this category is visible
+            home();
+            return QString();
+        }
+    }
+
     QString childName = categories.at( 0 );
+    debug() << "looking for child category " << childName;
     if ( !m_categories.contains( childName ) )
         return target;
 
+
+    debug() << "got it!";
     showCategory( childName );
 
     //check if this category is also BrowserCategoryList.target
@@ -268,6 +285,7 @@
 
     if ( childList == 0 )
     {
+        debug() << "child is not a list...";
         if ( categories.size() > 1 )
         {
             categories.removeFirst();
@@ -281,18 +299,17 @@
     //check if there are more arguments in the navigate string.
     if ( categories.size() == 1 )
     {
+        debug() << "Child is a list but path ends here...";
         //only one name, but since the category we switched to is also
-        //a category lsit, make sure that it is reset to home
+        //a category list, make sure that it is reset to home
         childList->home();
         return QString();
     }
 
-    int firstArgLength = childName.length() + 1;
-    QString subTarget = target;
-    subTarget.remove( 0 , firstArgLength );
+    categories.removeFirst();
+    debug() << "passing remaining path to child: " << categories.join( "/" );
+    return childList->navigate( categories.join( "/" ) );
 
-    return childList->navigate( subTarget );
-
 }
 
 QString BrowserCategoryList::path()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic