diff --git a/src/accounts/spotify/SpotifyAccount.cpp b/src/accounts/spotify/SpotifyAccount.cpp index 4d9ebf081..06ca040cf 100644 --- a/src/accounts/spotify/SpotifyAccount.cpp +++ b/src/accounts/spotify/SpotifyAccount.cpp @@ -382,6 +382,17 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg m_configWidget.data()->loginResponse( success, message ); } } + else if ( msgType == "playlistDeleted" ) + { + const QString plid = msg.value( "playlistid" ).toString(); + + Q_ASSERT( m_updaters.contains( plid ) ); + if ( !m_updaters.contains( plid ) ) + return; + + SpotifyPlaylistUpdater* updater = m_updaters.take( plid ); + updater->remove( false ); + } } diff --git a/src/accounts/spotify/SpotifyPlaylistUpdater.cpp b/src/accounts/spotify/SpotifyPlaylistUpdater.cpp index 7d2a7939c..1b1ce6013 100644 --- a/src/accounts/spotify/SpotifyPlaylistUpdater.cpp +++ b/src/accounts/spotify/SpotifyPlaylistUpdater.cpp @@ -112,6 +112,15 @@ SpotifyPlaylistUpdater::~SpotifyPlaylistUpdater() } +void +SpotifyPlaylistUpdater::remove( bool askToDeletePlaylist ) +{ + if ( !askToDeletePlaylist ) + m_sync = false; + PlaylistUpdaterInterface::remove(); +} + + void SpotifyPlaylistUpdater::removeFromSettings( const QString& group ) const { diff --git a/src/accounts/spotify/SpotifyPlaylistUpdater.h b/src/accounts/spotify/SpotifyPlaylistUpdater.h index 495eaa2bc..bdc517550 100644 --- a/src/accounts/spotify/SpotifyPlaylistUpdater.h +++ b/src/accounts/spotify/SpotifyPlaylistUpdater.h @@ -55,6 +55,7 @@ public: QString spotifyId() const { return m_spotifyId; } + void remove( bool askToDeletePlaylist = true ); public slots: /// Spotify callbacks when we are directly instructed from the resolver void spotifyTracksAdded( const QVariantList& tracks, const QString& startPosId, const QString& newRev, const QString& oldRev );