From 649ac1f83a7c2a5254363682c2c7cce9fd680ffe Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 26 Sep 2019 13:37:44 +0200 Subject: Mobile: clear dive data via model Clearing the dive data directly in the core leaves us with an inconsistent model. Therefore, clear via the model. Signed-off-by: Berthold Stoeger --- qt-models/divelistmodel.cpp | 7 +++++++ qt-models/divelistmodel.h | 1 + 2 files changed, 8 insertions(+) (limited to 'qt-models') diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 779e695ab..6f7d69412 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -171,6 +171,13 @@ void DiveListModel::updateDive(int i, dive *d) insertDive(i); } +void DiveListModel::clear() +{ + beginResetModel(); + clear_dive_file_data(); + endResetModel(); +} + void DiveListModel::reload() { beginResetModel(); diff --git a/qt-models/divelistmodel.h b/qt-models/divelistmodel.h index d6eb07463..686dcd1c3 100644 --- a/qt-models/divelistmodel.h +++ b/qt-models/divelistmodel.h @@ -62,6 +62,7 @@ public: QHash roleNames() const; QString startAddDive(); void resetInternalData(); + void clear(); // Clear all dives in core Q_INVOKABLE DiveObjectHelper at(int i); private: static DiveListModel *m_instance; -- cgit v1.2.3-70-g09d2