1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-03 12:47:45 +02:00

* Fixed storing playlists after directly dropping stuff on the PlaylistModel.

This commit is contained in:
Christian Muehlhaeuser
2011-11-28 09:29:55 +01:00
parent 9e23315972
commit 5911b51d05
3 changed files with 8 additions and 6 deletions

View File

@@ -465,7 +465,6 @@ DropJob::handleM3u( const QString& fileUrls )
{ {
tDebug() << Q_FUNC_INFO << "Trying to append contents from" << urls; tDebug() << Q_FUNC_INFO << "Trying to append contents from" << urls;
connect( m, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) ); connect( m, SIGNAL( tracks( QList<Tomahawk::query_ptr> ) ), this, SLOT( onTracksAdded( QList< Tomahawk::query_ptr > ) ) );
} }
m_queryCount++; m_queryCount++;

View File

@@ -62,7 +62,8 @@ public:
enum DropAction { enum DropAction {
Default = 0, Default = 0,
Append, Append,
Create Create,
Move
}; };
/** /**

View File

@@ -331,18 +331,17 @@ PlaylistModel::dropMimeData( const QMimeData* data, Qt::DropAction action, int r
dj->setDropTypes( DropJob::Track | DropJob::Playlist | DropJob::Artist | DropJob::Album ); dj->setDropTypes( DropJob::Track | DropJob::Playlist | DropJob::Artist | DropJob::Album );
dj->setDropAction( DropJob::Append ); dj->setDropAction( DropJob::Append );
/* if ( action & Qt::MoveAction )
dj->setDropAction( DropJob::Move ); */
#ifdef Q_WS_MAC
// On mac, drags from outside the app are still Qt::MoveActions instead of Qt::CopyAction by default // On mac, drags from outside the app are still Qt::MoveActions instead of Qt::CopyAction by default
// so check if the drag originated in this playlist to determine whether or not to copy // so check if the drag originated in this playlist to determine whether or not to copy
#ifdef Q_WS_MAC
if ( !data->hasFormat( "application/tomahawk.playlist.id" ) || if ( !data->hasFormat( "application/tomahawk.playlist.id" ) ||
( !m_playlist.isNull() && data->data( "application/tomahawk.playlist.id" ) != m_playlist->guid() ) ) ( !m_playlist.isNull() && data->data( "application/tomahawk.playlist.id" ) != m_playlist->guid() ) )
{ {
dj->setDropAction( DropJob::Append ); dj->setDropAction( DropJob::Append );
} }
#else
if ( action & Qt::CopyAction )
dj->setDropAction( DropJob::Append );
#endif #endif
connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) ); connect( dj, SIGNAL( tracks( QList< Tomahawk::query_ptr > ) ), SLOT( parsedDroppedTracks( QList< Tomahawk::query_ptr > ) ) );
@@ -373,6 +372,9 @@ PlaylistModel::parsedDroppedTracks( QList< query_ptr > tracks )
beginPlaylistChanges(); beginPlaylistChanges();
insert( tracks, beginRow ); insert( tracks, beginRow );
if ( update && m_dropStorage.action & Qt::CopyAction )
endPlaylistChanges();
} }
m_dropStorage.parent = QPersistentModelIndex(); m_dropStorage.parent = QPersistentModelIndex();