Skip to content

Commit

Permalink
Merge pull request #4700 from fatihemreyildiz/popup-delete-crate
Browse files Browse the repository at this point in the history
CrateFeature: add popup to avoid accidental remove of Crate
  • Loading branch information
daschuer authored Mar 22, 2022
2 parents c8107cb + f2644f2 commit 02150fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/library/trackset/crate/cratefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,17 @@ void CrateFeature::slotDeleteCrate() {
// Store sibling id to restore selection after crate was deleted
// to avoid the scroll position being reset to Crate root item.
storePrevSiblingCrateId(crateId);
if (m_pTrackCollection->deleteCrate(crateId)) {
qDebug() << "Deleted crate" << crate;
QMessageBox::StandardButton btn = QMessageBox::question(nullptr,
tr("Confirm Deletion"),
tr("Do you really want to delete this crate?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::No);
if (btn == QMessageBox::Yes) {
if (m_pTrackCollection->deleteCrate(crateId)) {
qDebug() << "Deleted crate" << crate;
return;
}
} else {
return;
}
}
Expand Down

0 comments on commit 02150fa

Please sign in to comment.