Bug 131072

Summary: Add support for Undo/Redo across sessions
Product: [Applications] amarok Reporter: Arend van Beelen jr. <arendjr>
Component: Playlists/Saved PlaylistsAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.4.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Arend van Beelen jr. 2006-07-19 15:14:02 UTC
Version:           1.4.0 (using KDE KDE 3.5.2)
Installed from:    SuSE RPMs
OS:                Linux

One of the better features of Amarok is its support for Undo/Redo wrt. playlist actions. However, it would be even cooler if these actions were remembered across sessions. That way you may easily change your playlist often, yet still be able to go back to a cool playlist you had a few days before (without having to save all your playlists). I often have some short playlists that I would like to listen to multiple times, but which stay only fun for a few days. Not having to explicitly save your playlists and still be able to go back to a previous playlist would be really awesome. You might also consider doing it the same way webbrowsers do it, with some option like "Remember history for past [7] days.".

Cheers and keep up the good work!
Arend jr.
Comment 1 Mark Kretschmann 2006-07-19 15:25:58 UTC
I agree, this would be a good feature. I'm missing it too.
Comment 2 Seb Ruiz 2006-09-09 15:24:47 UTC
SVN commit 582462 by seb:

Add support for Undo/Redo across sessions
FEATURE: 131072


 M  +1 -0      ChangeLog  
 M  +10 -6     src/playlist.cpp  


--- trunk/extragear/multimedia/amarok/ChangeLog #582461:582462
@@ -4,6 +4,7 @@
 
 VERSION 1.4.4
   FEATURES:
+    * Undo/Redo functionality is now available over sessions. (BR 131072)
     * Allow the creation of empty playlists in the playlist browser. Available
       either from the Add button in the toolbar or the context menu of a
       playlist folder. (BR 133543)
--- trunk/extragear/multimedia/amarok/src/playlist.cpp #582461:582462
@@ -371,7 +371,16 @@
     connect( ac->action( "favor_tracks" ), SIGNAL( activated( int ) ), SLOT( generateInfo() ) );
     connect( ac->action( "random_mode" ), SIGNAL( activated( int ) ), SLOT( generateInfo() ) );
 
-    m_undoButton->setEnabled( false );
+
+    // undostates are written in chronological order, so this is a clever way to get them back in the correct order :)
+    QStringList undos = m_undoDir.entryList( QString("*.xml"), QDir::Files, QDir::Time );
+
+    foreach( undos )
+        m_undoList.append( m_undoDir.absPath() + "/" + (*it) );
+
+    m_undoCounter = m_undoList.count();
+
+    m_undoButton->setEnabled( !m_undoList.isEmpty() );
     m_redoButton->setEnabled( false );
 
     engineStateChanged( EngineController::engine()->state() ); //initialise state of UI
@@ -423,11 +432,6 @@
 
     if( AmarokConfig::savePlaylist() ) saveXML( defaultPlaylistPath() );
 
-    //clean undo directory
-    QStringList list = m_undoDir.entryList();
-    for( QStringList::ConstIterator it = list.constBegin(), end = list.constEnd(); it != end; ++it )
-        m_undoDir.remove( *it );
-
     //speed up quit a little
     safeClear();   //our implementation is slow
     Amarok::ToolTip::remove( viewport() );