From 8f69b9b6808f0e3c679d5bab6363a4742ac08166 Mon Sep 17 00:00:00 2001
From: Jeff Mitchell <tomahawk@jefferai.org>
Date: Sun, 19 Jun 2011 16:28:50 -0400
Subject: [PATCH] Fix catch-up functionality

---
 src/libtomahawk/audio/audioengine.cpp     | 2 +-
 src/libtomahawk/sourceplaylistinterface.h | 1 +
 src/sourcetree/sourcetreeview.cpp         | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libtomahawk/audio/audioengine.cpp b/src/libtomahawk/audio/audioengine.cpp
index 497df58bb..38333189a 100644
--- a/src/libtomahawk/audio/audioengine.cpp
+++ b/src/libtomahawk/audio/audioengine.cpp
@@ -188,7 +188,7 @@ AudioEngine::next()
         {
             //it's a catch-up -- if they're trying to catch-up in the same track, don't do anything
             //so that you don't repeat the track and/or cause the retry timer to fire
-            if ( !m_currentTrack.isNull() &&
+            if ( !m_currentTrack.isNull() && !sourcepi->hasNextSong() &&
                   m_currentTrack->id() == sourcepi->currentItem()->id() )
                     return;
         }
diff --git a/src/libtomahawk/sourceplaylistinterface.h b/src/libtomahawk/sourceplaylistinterface.h
index f57fe5cd5..43d2d37bb 100644
--- a/src/libtomahawk/sourceplaylistinterface.h
+++ b/src/libtomahawk/sourceplaylistinterface.h
@@ -58,6 +58,7 @@ public:
 
     virtual Tomahawk::source_ptr source() const { return m_source; }
 
+    virtual bool hasNextSong() { return m_gotNextSong; }
     virtual void reset();
 
 public slots:
diff --git a/src/sourcetree/sourcetreeview.cpp b/src/sourcetree/sourcetreeview.cpp
index 817105f1d..09b9adbfc 100644
--- a/src/sourcetree/sourcetreeview.cpp
+++ b/src/sourcetree/sourcetreeview.cpp
@@ -353,7 +353,7 @@ SourceTreeView::latchOn()
         {
             //it's a catch-up -- if they're trying to catch-up in the same track, don't do anything
             //so that you don't repeat the track and/or cause the retry timer to fire
-            if ( !AudioEngine::instance()->currentTrack().isNull() &&
+            if ( !AudioEngine::instance()->currentTrack().isNull() && !sourcepi->hasNextSong() &&
                   AudioEngine::instance()->currentTrack()->id() == sourcepi->currentItem()->id() )
                     return;
         }