Bug 131072 - Add support for Undo/Redo across sessions
Summary: Add support for Undo/Redo across sessions
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Playlists/Saved Playlists (show other bugs)
Version: 1.4.0
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-19 15:14 UTC by Arend van Beelen jr.
Modified: 2006-09-09 15:24 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 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() );