From 4d31eac5f615b2ab99e8a7ccc50e5ee23fe8b2fb Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 5 Aug 2011 11:57:42 -0400 Subject: [PATCH] Emit trackCountChanged when dropping tracks in a playlist. Handle Qt/Mac bug where drops from outside the app are Qt::MoveAction not Qt::CopyAction --- src/libtomahawk/playlist/playlistmodel.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/playlistmodel.cpp b/src/libtomahawk/playlist/playlistmodel.cpp index 82a31316c..43cd42b00 100644 --- a/src/libtomahawk/playlist/playlistmodel.cpp +++ b/src/libtomahawk/playlist/playlistmodel.cpp @@ -420,8 +420,18 @@ PlaylistModel::parsedDroppedTracks( QList< query_ptr > tracks ) } emit endInsertRows(); - if ( m_dropStorage.action == Qt::CopyAction ) + // Work around Qt-on-mac bug where drags from outside the app are Qt::MoveAction + // instead of Qt::CopyAction +#ifdef Q_OS_MAC + if ( m_dropStorage.action & Qt::CopyAction || m_dropStorage.action & Qt::MoveAction ) +#else + if ( m_dropStorage.action & Qt::CopyAction ) +#endif + { onPlaylistChanged( true ); + emit trackCountChanged( rowCount( QModelIndex() ) ); + } + } m_dropStorage.parent = QPersistentModelIndex();