Bug 75150

Summary: shuffle doesn't work once the playlist was sorted by clicking on a list header
Product: [Applications] amarok Reporter: Melchior Franz <mfranz>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description Melchior Franz 2004-02-13 14:17:30 UTC
Version:           cvs/head from today, 2004/2/13 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 3.3.1 (SuSE Linux) 
OS:          Linux

o create a simple playlist
o sort it by clicking on one of the list headers, e.g. "Trackname"
o now try to shuffle this sorted list

-> shuffle refuses to work
Comment 1 Mark Kretschmann 2004-02-13 16:16:23 UTC
CVS commit by markey: 

Fix: Shuffle not working when playlist is in sort-mode (bug #75150)
Please test!

( note to developers: why setSorting( 200 ) instead of setSorting( -1 )? )

CCMAIL: 75150-done@bugs.kde.org


  M +7 -8      playlistwidget.cpp   1.106


--- kdeextragear-1/amarok/amarok/playlistwidget.cpp  #1.105:1.106
@@ -51,4 +50,5 @@
 
 
+static const int NO_SORT = 200;
 
 PlaylistWidget::PlaylistWidget( QWidget *parent, /*KActionCollection *ac,*/ const char *name )
@@ -74,5 +74,5 @@ PlaylistWidget::PlaylistWidget( QWidget 
     setDropVisualizerWidth( 3 );
     setItemsRenameable( true );
-    KListView::setSorting( 200 ); //use base so we don't saveUndoState() too
+    KListView::setSorting( NO_SORT ); //use base so we don't saveUndoState() too
     setAcceptDrops( true );
     setSelectionMode( QListView::Extended );
@@ -358,7 +358,6 @@ void PlaylistWidget::shuffle() //SLOT
     //TODO offer this out as an action in a custom kactioncollection?
 
-    saveUndoState();
+    setSorting( NO_SORT );
 
-    // not evil, but corrrrect :)
     QPtrList<QListViewItem> list;
 
@@ -491,5 +490,5 @@ void PlaylistWidget::insertMediaInternal
     if( loader )
     {
-        setSorting( 200 ); //disable sorting and saveState()
+        setSorting( NO_SORT ); //disable sorting and saveState()
 
         QApplication::postEvent( this, new QCustomEvent( PlaylistLoader::Started ) ); //see customEvent for explanation
@@ -930,5 +929,5 @@ void PlaylistWidget::contentsDropEvent( 
     if( e->source() == viewport() )
     {
-        setSorting( 200 ); //disableSorting and saveState()
+        setSorting( NO_SORT ); //disableSorting and saveState()
         movableDropEvent( parent, after );
     }