Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library sidebar: don't allow deleting current history #11235

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/library/trackset/baseplaylistfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
13 changes: 13 additions & 0 deletions src/library/trackset/setlogfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/library/trackset/setlogfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down