mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:36:15 +00:00
Desktop: Use DiveImportedModel::deleteDeselected()
In DownloadFromDCWidget::on_ok_clicked() deselected dives were directly deleted from the dive table, leaving DiveImportedModel in an inconsistent state. Use the function in DiveImportedModel instead. This also removes code duplication. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
30b384cebd
commit
a24b1a4027
1 changed files with 1 additions and 8 deletions
|
@ -529,14 +529,7 @@ void DownloadFromDCWidget::on_ok_clicked()
|
|||
struct dive_site_table *sites = diveImportedModel->thread.sites();
|
||||
|
||||
// delete non-selected dives
|
||||
int total = table->nr;
|
||||
int j = 0;
|
||||
for (int i = 0; i < total; i++) {
|
||||
if (diveImportedModel->data(diveImportedModel->index(i, 0), Qt::CheckStateRole) == Qt::Checked)
|
||||
j++;
|
||||
else
|
||||
delete_dive_from_table(diveImportedModel->thread.table(), j);
|
||||
}
|
||||
diveImportedModel->deleteDeselected();
|
||||
|
||||
if (table->nr > 0) {
|
||||
auto data = diveImportedModel->thread.data();
|
||||
|
|
Loading…
Add table
Reference in a new issue