summaryrefslogtreecommitdiffstats
path: root/qt-ui/downloadfromdivecomputer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/downloadfromdivecomputer.cpp')
-rw-r--r--qt-ui/downloadfromdivecomputer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/qt-ui/downloadfromdivecomputer.cpp b/qt-ui/downloadfromdivecomputer.cpp
index abc6fff91..465d19a42 100644
--- a/qt-ui/downloadfromdivecomputer.cpp
+++ b/qt-ui/downloadfromdivecomputer.cpp
@@ -405,6 +405,9 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
void DownloadFromDCWidget::on_ok_clicked()
{
+ // remove all unselected dives from the dive-list.
+ diveImportedModel->removeUnused();
+
int uniqId, idx;
// remember the last downloaded dive (on most dive computers this will be the chronologically
// first new dive) and select it again after processing all the dives
@@ -573,3 +576,18 @@ void DiveImportedModel::setImportedDivesIndexes(int first, int last)
memset(checkStates, true, last-first);
endInsertRows();
}
+
+void DiveImportedModel::removeUnused() {
+ beginRemoveRows(QModelIndex(), 0, rowCount()-1);
+ endRemoveRows();
+
+ for(int i = lastIndex; i >= firstIndex; i-- ){
+ if(!checkStates[firstIndex - i]) {
+ delete_single_dive(i);
+ }
+ }
+
+ lastIndex = 0;
+ firstIndex = 0;
+ delete[] checkStates;
+}