Commit 6d0b7533 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix undo broken when trying to delete all tracks (don't allow it and fix the underlying bug)

BUG: 462228
FIXED-IN: 22.12.0
parent 6dd5d2ca
......@@ -9,6 +9,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include "kdenlivesettings.h"
#include <QIcon>
#include <QPushButton>
#include <utility>
TrackDialog::TrackDialog(std::shared_ptr<TimelineItemModel> model, int trackIndex, QWidget *parent, bool deleteMode, int activeTrackId)
......@@ -85,6 +86,18 @@ void TrackDialog::buildCombo()
}
if (m_deleteMode) {
deleteTracks->setMinimumWidth(deleteTracks->sizeHintForColumn(0));
connect(deleteTracks, &QListWidget::itemChanged, this, [=]() {
// Ensure we cannot check all tracks
int count = deleteTracks->count();
for (int i = 0; i < count; i++) {
if (deleteTracks->item(i)->checkState() == Qt::Unchecked) {
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
return true;
}
}
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
return true;
});
}
}
......
......@@ -798,6 +798,8 @@ void TimelineController::deleteMultipleTracks(int tid)
}
if (result) {
pCore->pushUndo(undo, redo, allIds.count() > 1 ? i18n("Delete Tracks") : i18n("Delete Track"));
} else {
undo();
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment