diff --git a/src/library/trackset/baseplaylistfeature.h b/src/library/trackset/baseplaylistfeature.h index 6e5d89906c2..813093e6485 100644 --- a/src/library/trackset/baseplaylistfeature.h +++ b/src/library/trackset/baseplaylistfeature.h @@ -63,7 +63,7 @@ class BasePlaylistFeature : public BaseTrackSetFeature { void deleteItem(const QModelIndex& index) override; protected slots: - void slotDeletePlaylist(); + virtual void slotDeletePlaylist(); void slotDuplicatePlaylist(); void slotAddToAutoDJ(); void slotAddToAutoDJTop(); diff --git a/src/library/trackset/setlogfeature.cpp b/src/library/trackset/setlogfeature.cpp index c2af49459fd..6695108426a 100644 --- a/src/library/trackset/setlogfeature.cpp +++ b/src/library/trackset/setlogfeature.cpp @@ -103,6 +103,19 @@ void SetlogFeature::deleteAllUnlockedPlaylistsWithFewerTracks() { transaction.commit(); } +void SetlogFeature::slotDeletePlaylist() { + if (!m_lastRightClickedIndex.isValid()) { + return; + } + int playlistId = playlistIdFromIndex(m_lastRightClickedIndex); + if (playlistId == m_playlistId) { + // the current setlog must not be deleted + return; + } + // regular setlog, call the base implementation + BasePlaylistFeature::slotDeletePlaylist(); +} + void SetlogFeature::onRightClick(const QPoint& globalPos) { Q_UNUSED(globalPos); m_lastRightClickedIndex = QModelIndex(); diff --git a/src/library/trackset/setlogfeature.h b/src/library/trackset/setlogfeature.h index b66c0145e26..d0cf14ca246 100644 --- a/src/library/trackset/setlogfeature.h +++ b/src/library/trackset/setlogfeature.h @@ -27,6 +27,7 @@ class SetlogFeature : public BasePlaylistFeature { void onRightClick(const QPoint& globalPos) override; void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override; void slotJoinWithPrevious(); + void slotDeletePlaylist() override; void slotGetNewPlaylist(); void activate() override;