aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-24 08:20:34 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-24 08:20:34 -0700
commit95466cb245608a92d3e6005f2da577a613914336 (patch)
treeb54e4eca4b1ae74fd1ccc624d3664d9b3fe3b490
parent67e20fb2725d816b2a31e562bafa5fc6c3036834 (diff)
downloadsubsurface-95466cb245608a92d3e6005f2da577a613914336.tar.gz
Sort dive table after adding a dive
The dive might not be the newest dive in the dive list. Fixes #637 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/maintab.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 95143ed11..bf108a9c1 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -646,7 +646,7 @@ void MainTab::acceptChanges()
MainWindow::instance()->dive_list()->unselectDives();
selected_dive = get_divenr(added_dive);
amount_selected = 1;
- } else if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
+ } else if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {
/* now figure out if things have changed */
if (!same_string(displayed_dive.notes, current_dive->divetrip->notes)) {
current_dive->divetrip->notes = strdup(displayed_dive.notes);
@@ -750,6 +750,7 @@ void MainTab::acceptChanges()
// now let's resort the dive list and make sure the newly added dive is still selected
selected_dive = -1;
amount_selected = 0;
+ sort_table(&dive_table);
MainWindow::instance()->dive_list()->reload(DiveTripModel::CURRENT, true);
int newDiveNr = get_divenr(get_dive_by_uniq_id(addedId));
MainWindow::instance()->dive_list()->selectDive(newDiveNr, true);