From f8327ed51bc2298e2c7ef69a1ef0f82509e8d8d4 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 23 Nov 2018 15:18:59 +0100 Subject: Core: move autogroup() into divelist.c After loading or importing, the caller usually called autogroup() to autogroup dives if so wished by the user. This has already led to bugs, when autogroup() was forgotten. Instead, call autogroup() directly in the process_loaded_dives() and process_imported_dives() functions. Not only does this prevent forgetting the call - it also means that autogrouping can be changed without changing every caller. Signed-off-by: Berthold Stoeger --- desktop-widgets/divelogimportdialog.cpp | 1 - desktop-widgets/downloadfromdivecomputer.cpp | 1 - desktop-widgets/mainwindow.cpp | 3 --- 3 files changed, 5 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp index f4f9311ff..eb551217e 100644 --- a/desktop-widgets/divelogimportdialog.cpp +++ b/desktop-widgets/divelogimportdialog.cpp @@ -1011,7 +1011,6 @@ void DiveLogImportDialog::on_buttonBox_accepted() } process_imported_dives(&table, false, false); - autogroup_dives(); Command::clear(); MainWindow::instance()->refreshDisplay(); } diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index f92fdbb70..4221f5bf4 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -525,7 +525,6 @@ void DownloadFromDCWidget::on_ok_clicked() // first new dive) and select it again after processing all the dives int uniqId = table->dives[table->nr - 1]->id; process_imported_dives(table, preferDownloaded(), true); - autogroup_dives(); Command::clear(); // after process_imported_dives does any merging or resorting needed, we need // to recreate the model for the dive list so we can select the newest dive diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index d836e8e61..d53d4f97e 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -617,7 +617,6 @@ void MainWindow::on_actionCloudstorageopen_triggered() if (!parse_file(fileNamePtr.data(), &dive_table)) setCurrentFile(fileNamePtr.data()); process_loaded_dives(); - autogroup_dives(); Command::clear(); hideProgressBar(); refreshDisplay(); @@ -1715,7 +1714,6 @@ void MainWindow::importFiles(const QStringList fileNames) parse_file(fileNamePtr.data(), &table); } process_imported_dives(&table, false, false); - autogroup_dives(); Command::clear(); refreshDisplay(); } @@ -1739,7 +1737,6 @@ void MainWindow::loadFiles(const QStringList fileNames) hideProgressBar(); updateRecentFiles(); process_loaded_dives(); - autogroup_dives(); Command::clear(); refreshDisplay(); -- cgit v1.2.3-70-g09d2