Bug 135744

Summary: tracks queued incorrectly in a run-out dynamic playlist
Product: [Applications] amarok Reporter: richlv
Component: PlaylistAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:

Description richlv 2006-10-16 12:44:42 UTC
Version:           svn 595891 (using KDE KDE 3.5.4)
Installed from:    Slackware Packages
OS:                Linux

create a dynamic playlist, load & populate it. reconfigure so that it's sources are empty, start playing. 
when all tracks have been played, queue additional tracks from context browser.

these tracks are not inserted after already played tracks, but before them.
Comment 1 Alexandre Oliveira 2006-10-19 22:45:09 UTC
SVN commit 597292 by aoliveira:

When queuing tracks that are not on playlist, if queue is empty and there's no current track, add tracks to 
the end of the playlist, instead of adding to the beginning.
BUG: 135744


 M  +7 -3      playlist.cpp  


--- trunk/extragear/multimedia/amarok/src/playlist.cpp #597291:597292
@@ -512,7 +512,10 @@
             }
         } else {
             // We add the track after the last track on queue, or after current if the queue is empty
-            after =  m_nextTracks.isEmpty() ? currentTrack() : m_nextTracks.getLast();
+            after = m_nextTracks.isEmpty() ? currentTrack() : m_nextTracks.getLast();
+            // If there's no tracks on the queue, and there's no current track, fall back to the last item
+            if ( !after )
+                after = lastItem();
 
             // wait until Playlist loader has finished its process, then go to customEvent() to start the queue process.
             m_queueList = list;
@@ -2616,9 +2619,10 @@
         }
     }
 
-    if( !after ) findDrop( e->pos(), parent, after ); //shouldn't happen, but you never know!
+    if( !after )
+        findDrop( e->pos(), parent, after ); //shouldn't happen, but you never know!
 
-        slotEraseMarker();
+    slotEraseMarker();
 
     if ( e->source() == viewport() ) {
         setSorting( NO_SORT ); //disableSorting and saveState()
Comment 2 richlv 2006-10-23 08:47:56 UTC
fix confirmed in revison 598249