From 1037c15b98bf9e2e4734e9e6ee2d5c6387f131a9 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 15 Dec 2020 16:10:08 +0100 Subject: mobile: remove DiveObjectHelper code When editing a dive, a DiveObjectHelper of the unmodified dive was created to compare the edited with the old values. Since the DiveObjectHelper is used here only as a pointless wrapper around the formatting functions, call these functions directly. However, note that the code is in principle wrong since the change to the mobile-models, which do not use the DiveObjectHelper. The real fix would be to reload the data from the model to prevent going out-of-sync with respect to the formatting routines! Signed-off-by: Berthold Stoeger --- qt-models/divetripmodel.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'qt-models') diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 6d9bd8de4..a0385822c 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -197,11 +197,7 @@ QVariant DiveTripModelBase::diveData(const struct dive *d, int column, int role) // We have to return a QString as trip-id, because that will be used as section // variable in the QtQuick list view. That has to be a string because it will try // to do locale-aware sorting. And amazingly this can't be changed. - case MobileListModel::DateTimeRole: { - QDateTime localTime = timestampToDateTime(d->when); - return QStringLiteral("%1 %2").arg(localTime.date().toString(prefs.date_format_short), - localTime.time().toString(prefs.time_format)); - } + case MobileListModel::DateTimeRole: return formatDiveDateTime(d); case MobileListModel::IdRole: return d->id; case MobileListModel::NumberRole: return d->number; case MobileListModel::LocationRole: return get_dive_location(d); -- cgit v1.2.3-70-g09d2