mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 07:19:42 +01:00
* Fixed storing playlists after directly dropping stuff on the PlaylistModel.
This commit is contained in:
parent
9e23315972
commit
5911b51d05
@ -465,7 +465,6 @@ DropJob::handleM3u( const QString& fileUrls )
|
||||
{
|
||||
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 > ) ) );
|
||||
|
||||
}
|
||||
|
||||
m_queryCount++;
|
||||
|
@ -62,7 +62,8 @@ public:
|
||||
enum DropAction {
|
||||
Default = 0,
|
||||
Append,
|
||||
Create
|
||||
Create,
|
||||
Move
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -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->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
|
||||
// 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" ) ||
|
||||
( !m_playlist.isNull() && data->data( "application/tomahawk.playlist.id" ) != m_playlist->guid() ) )
|
||||
{
|
||||
dj->setDropAction( DropJob::Append );
|
||||
}
|
||||
#else
|
||||
if ( action & Qt::CopyAction )
|
||||
dj->setDropAction( DropJob::Append );
|
||||
#endif
|
||||
|
||||
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();
|
||||
|
||||
insert( tracks, beginRow );
|
||||
|
||||
if ( update && m_dropStorage.action & Qt::CopyAction )
|
||||
endPlaylistChanges();
|
||||
}
|
||||
|
||||
m_dropStorage.parent = QPersistentModelIndex();
|
||||
|
Loading…
x
Reference in New Issue
Block a user