diff options
-rw-r--r-- | divelist.c | 2 | ||||
-rw-r--r-- | divelist.h | 1 | ||||
-rw-r--r-- | qt-ui/maintab.cpp | 5 | ||||
-rw-r--r-- | qt-ui/models.cpp | 5 |
4 files changed, 11 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c index 9a1ab017f..36f43e4fc 100644 --- a/divelist.c +++ b/divelist.c @@ -600,7 +600,7 @@ static void delete_trip(dive_trip_t *trip) free(trip); } -static void find_new_trip_start_time(dive_trip_t *trip) +void find_new_trip_start_time(dive_trip_t *trip) { struct dive *dive = trip->dives; timestamp_t when = dive->when; diff --git a/divelist.h b/divelist.h index 627cb575c..109c61aef 100644 --- a/divelist.h +++ b/divelist.h @@ -30,6 +30,7 @@ extern struct dive *merge_two_dives(struct dive *a, struct dive *b); extern bool consecutive_selected(); extern void select_dive(int idx); extern void deselect_dive(int idx); +void find_new_trip_start_time(dive_trip_t *trip); #ifdef DEBUG_TRIP extern void dump_selection(void); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 16c0a1f14..763c61ec5 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -13,6 +13,7 @@ #include "globe.h" #include "completionmodels.h" #include "diveplanner.h" +#include "divelist.h" #include "qthelper.h" #include <QLabel> @@ -499,6 +500,10 @@ void MainTab::acceptChanges() } } + if (current_dive->divetrip) { + current_dive->divetrip->when = current_dive->when; + find_new_trip_start_time(current_dive->divetrip); + } if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) { // clean up the dive data (get duration, depth information from samples) fixup_dive(current_dive); diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 2a0f9e98e..d0c244917 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -929,7 +929,10 @@ QVariant TripItem::data(int column, int role) const if (role == Qt::DisplayRole) { switch (column) { case DiveTripModel::NR: - ret = QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives); + if (trip->location && *trip->location) + ret = QString(trip->location) + ", " + get_trip_date_string(trip->when, trip->nrdives); + else + ret = get_trip_date_string(trip->when, trip->nrdives); break; } } |