Bug 230562 - Media sources Bookmark does not save "show years" and "show covers"
Summary: Media sources Bookmark does not save "show years" and "show covers"
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 2.2.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-13 13:23 UTC by Kilian Lackhove
Modified: 2010-03-15 13:25 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kilian Lackhove 2010-03-13 13:23:12 UTC
Version:           2.2.2 (using KDE 4.4.1)
OS:                Linux
Installed from:    Archlinux Packages

In the Media Sources view the bookmarks dont save the status of the "show years" and "show covers" options. Everything else is saved and restored correctly.
Comment 1 Nikolaj Hald Nielsen 2010-03-15 13:25:39 UTC
commit 70c304a416adf93770eeb586037d06554cf74a84
Author: Nikolaj Hald Nielsen <nhn@kde.org>
Date:   Mon Mar 15 13:20:53 2010 +0100

    When bookmarking a view in the local collection category, also store (and restore when the bookmark is activated) the state of "show cover" and "show year"
    
    BUG: 230562

diff --git a/src/amarokurls/NavigationUrlGenerator.cpp b/src/amarokurls/NavigationUrlGenerator.cpp
index 5e75a16..e38a947 100644
--- a/src/amarokurls/NavigationUrlGenerator.cpp
+++ b/src/amarokurls/NavigationUrlGenerator.cpp
@@ -15,6 +15,7 @@
  ****************************************************************************************/
  
 #include "NavigationUrlGenerator.h"
+#include <amarokconfig.h>
 #include "AmarokUrl.h"
 #include "AmarokUrlHandler.h"
 #include "Debug.h"
@@ -103,6 +104,23 @@ AmarokUrl NavigationUrlGenerator::CreateAmarokUrl()
         url.appendArg( "levels", sortMode );
 
 
+    //if in the local collection view, also store "show covers" and "show years"
+    if( url.path().endsWith( "collections", Qt::CaseInsensitive ) )
+    {
+        debug() << "bookmarking in local collection";
+
+        if( AmarokConfig::showAlbumArt() )
+            url.appendArg( "show_cover", "true" );
+        else
+            url.appendArg( "show_cover", "false" );
+
+        if(  AmarokConfig::showYears() )
+            url.appendArg( "show_years", "true" );
+        else
+            url.appendArg( "show_years", "false" );
+    }
+
+
     //come up with a default name for this url..
     QString name = The::mainWindow()->browserWidget()->list()->activeCategoryRecursive()->prettyName();
     url.setName( name );
diff --git a/src/amarokurls/NavigationUrlRunner.cpp b/src/amarokurls/NavigationUrlRunner.cpp
index a5f3b8d..cff35b6 100644
--- a/src/amarokurls/NavigationUrlRunner.cpp
+++ b/src/amarokurls/NavigationUrlRunner.cpp
@@ -16,6 +16,7 @@
 
 #include "NavigationUrlRunner.h"
 
+#include <amarokconfig.h>
 #include "Debug.h"
 
 #include "AmarokUrlHandler.h"
@@ -75,6 +76,28 @@ NavigationUrlRunner::run( AmarokUrl url )
 
     }
 
+
+    //if we are activating the local collection, check if we need to restore "show cover" and "show year"
+        //if in the local collection view, also store "show covers" and "show years"
+    if( url.path().endsWith( "collections", Qt::CaseInsensitive ) )
+    {
+        if ( args.keys().contains( "show_cover" ) )
+        {
+            if( args.value( "show_cover" ).compare( "true", Qt::CaseInsensitive ) == 0 )
+                AmarokConfig::setShowAlbumArt( true );
+            else if( args.value( "show_cover" ).compare( "false", Qt::CaseInsensitive ) == 0 )
+                AmarokConfig::setShowAlbumArt( false );
+        }
+
+        if ( args.keys().contains( "show_years" ) )
+        {
+            if( args.value( "show_years" ).compare( "true", Qt::CaseInsensitive ) == 0 )
+                AmarokConfig::setShowYears( true );
+            else if( args.value( "show_years" ).compare( "false", Qt::CaseInsensitive ) == 0 )
+                AmarokConfig::setShowYears( false );
+        }
+    }
+
     if ( args.keys().contains( "filter" ) )
         active->setFilter( args.value( "filter" ) );