From ffa6583be154d88bc8636381b6da85c1674648db Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Tue, 8 Feb 2011 18:10:04 -0500 Subject: [PATCH] Queue up the next track in a station if the user manually removes the last one --- src/libtomahawk/playlist/dynamic/DynamicModel.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/playlist/dynamic/DynamicModel.cpp b/src/libtomahawk/playlist/dynamic/DynamicModel.cpp index a3fbda26d..9822ff89a 100644 --- a/src/libtomahawk/playlist/dynamic/DynamicModel.cpp +++ b/src/libtomahawk/playlist/dynamic/DynamicModel.cpp @@ -141,15 +141,18 @@ DynamicModel::newTrackLoading() } void -DynamicModel::removeIndex(const QModelIndex& index, bool moreToCome) +DynamicModel::removeIndex(const QModelIndex& idx, bool moreToCome) { if ( m_playlist->mode() == Static && isReadOnly() ) return; - if( m_playlist->mode() == OnDemand ) - TrackModel::removeIndex( index ); - else - PlaylistModel::removeIndex( index, moreToCome ); + if( m_playlist->mode() == OnDemand ) { + if( !moreToCome && idx == index( rowCount( QModelIndex() ) - 1, 0, QModelIndex() ) ) { // if the user is manually removing the last one, re-add as we're a station + newTrackLoading(); + } + TrackModel::removeIndex( idx ); + } else + PlaylistModel::removeIndex( idx, moreToCome ); // don't call onPlaylistChanged. if( !moreToCome )