mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Ask to delete a playlist on spotify side when deleting a synced playlist
This commit is contained in:
@@ -182,14 +182,14 @@ SpotifyAccount::syncActionTriggered( bool checked )
|
|||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT( info );
|
Q_ASSERT( info );
|
||||||
|
if ( info )
|
||||||
|
info->sync = !updater->sync();
|
||||||
|
|
||||||
|
if ( m_configWidget.data() )
|
||||||
|
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists );
|
||||||
|
|
||||||
if ( !updater->sync() )
|
if ( !updater->sync() )
|
||||||
{
|
{
|
||||||
if ( info )
|
|
||||||
info->sync = true;
|
|
||||||
if ( m_configWidget.data() )
|
|
||||||
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists );
|
|
||||||
|
|
||||||
startPlaylistSync( info );
|
startPlaylistSync( info );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include "SpotifyAccount.h"
|
#include "SpotifyAccount.h"
|
||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
using namespace Accounts;
|
using namespace Accounts;
|
||||||
|
|
||||||
@@ -114,9 +116,38 @@ SpotifyPlaylistUpdater::removeFromSettings( const QString& group ) const
|
|||||||
TomahawkSettings::instance()->remove( QString( "%1/latestrev" ).arg( group ) );
|
TomahawkSettings::instance()->remove( QString( "%1/latestrev" ).arg( group ) );
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/sync" ).arg( group ) );
|
TomahawkSettings::instance()->remove( QString( "%1/sync" ).arg( group ) );
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/spotifyId" ).arg( group ) );
|
TomahawkSettings::instance()->remove( QString( "%1/spotifyId" ).arg( group ) );
|
||||||
|
|
||||||
|
if ( m_sync )
|
||||||
|
{
|
||||||
|
if ( QThread::currentThread() != QApplication::instance()->thread() )
|
||||||
|
QMetaObject::invokeMethod( const_cast<SpotifyPlaylistUpdater*>(this), "checkDeleteDialog", Qt::BlockingQueuedConnection );
|
||||||
|
else
|
||||||
|
checkDeleteDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SpotifyPlaylistUpdater::checkDeleteDialog() const
|
||||||
|
{
|
||||||
|
// Ask if we should delete the playlist on the spotify side as well
|
||||||
|
QMessageBox askDelete( QMessageBox::Question, tr( "Delete in Spotify?" ), tr( "Would you like to delete the corresponding Spotify playlist as well?" ), QMessageBox::Yes | QMessageBox::No, 0 );
|
||||||
|
int ret = askDelete.exec();
|
||||||
|
if ( ret == QMessageBox::Yes )
|
||||||
|
{
|
||||||
|
if ( m_spotify.isNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// User wants to delete it!
|
||||||
|
QVariantMap msg;
|
||||||
|
msg[ "_msgtype" ] = "deletePlaylist";
|
||||||
|
msg[ "playlistid" ] = m_spotifyId;
|
||||||
|
m_spotify.data()->sendMessage( msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpotifyPlaylistUpdater::saveToSettings( const QString& group ) const
|
SpotifyPlaylistUpdater::saveToSettings( const QString& group ) const
|
||||||
{
|
{
|
||||||
|
@@ -58,6 +58,7 @@ public:
|
|||||||
void spotifyTracksRemoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
|
void spotifyTracksRemoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
|
||||||
void spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
|
void spotifyTracksMoved( const QVariantList& tracks, const QString& newRev, const QString& oldRev );
|
||||||
void spotifyPlaylistRenamed( const QString& title, const QString& newRev, const QString& oldRev );
|
void spotifyPlaylistRenamed( const QString& title, const QString& newRev, const QString& oldRev );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void removeFromSettings(const QString& group) const;
|
virtual void removeFromSettings(const QString& group) const;
|
||||||
virtual void saveToSettings(const QString& group) const;
|
virtual void saveToSettings(const QString& group) const;
|
||||||
@@ -70,6 +71,7 @@ private slots:
|
|||||||
void onTracksInsertedReturn( const QString& msgType, const QVariantMap& msg );
|
void onTracksInsertedReturn( const QString& msgType, const QVariantMap& msg );
|
||||||
void onTracksRemovedReturn( const QString& msgType, const QVariantMap& msg );
|
void onTracksRemovedReturn( const QString& msgType, const QVariantMap& msg );
|
||||||
|
|
||||||
|
void checkDeleteDialog() const;
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user