mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 09:19:41 +01:00
Ask to delete a playlist on spotify side when deleting a synced playlist
This commit is contained in:
parent
6a24d8ebf5
commit
c1a7c63f03
@ -182,14 +182,14 @@ SpotifyAccount::syncActionTriggered( bool checked )
|
||||
}
|
||||
|
||||
Q_ASSERT( info );
|
||||
if ( info )
|
||||
info->sync = !updater->sync();
|
||||
|
||||
if ( m_configWidget.data() )
|
||||
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists );
|
||||
|
||||
if ( !updater->sync() )
|
||||
{
|
||||
if ( info )
|
||||
info->sync = true;
|
||||
if ( m_configWidget.data() )
|
||||
m_configWidget.data()->setPlaylists( m_allSpotifyPlaylists );
|
||||
|
||||
startPlaylistSync( info );
|
||||
}
|
||||
else
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "SpotifyAccount.h"
|
||||
#include "utils/tomahawkutils.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
using namespace Tomahawk;
|
||||
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/sync" ).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
|
||||
SpotifyPlaylistUpdater::saveToSettings( const QString& group ) const
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
void spotifyTracksRemoved( 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 );
|
||||
|
||||
protected:
|
||||
virtual void removeFromSettings(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 onTracksRemovedReturn( const QString& msgType, const QVariantMap& msg );
|
||||
|
||||
void checkDeleteDialog() const;
|
||||
private:
|
||||
void init();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user