mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16: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();
|
struct dive_site_table *sites = diveImportedModel->thread.sites();
|
||||||
|
|
||||||
// delete non-selected dives
|
// delete non-selected dives
|
||||||
int total = table->nr;
|
diveImportedModel->deleteDeselected();
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (table->nr > 0) {
|
if (table->nr > 0) {
|
||||||
auto data = diveImportedModel->thread.data();
|
auto data = diveImportedModel->thread.data();
|
||||||
|
|
Loading…
Add table
Reference in a new issue