summaryrefslogtreecommitdiffstats
path: root/qt-models/divelistmodel.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-08-14 18:09:17 +0200
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2019-09-14 13:20:59 +0200
commit0026aa395599489c09be3b7892b96923c670b7cf (patch)
treedf1afd69466092143472ef5411d86cf141945e57 /qt-models/divelistmodel.cpp
parent57b77c90b9dad6a114a13fe08b8ae7b986039de8 (diff)
downloadsubsurface-0026aa395599489c09be3b7892b96923c670b7cf.tar.gz
Mobile: replace clear()/addAllDives() pairs by reload()
The clear()/addAllDives() pair was bogus as the former didn't clear the model (this is not possible anymore - the model represents the core dive list) and the latter readded all dives again. Replace this by a reload() function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r--qt-models/divelistmodel.cpp25
1 files changed, 3 insertions, 22 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index 79a901282..ef384f4cd 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -71,10 +71,10 @@ int DiveListSortModel::getIdxForId(int id)
return -1;
}
-void DiveListSortModel::clear()
+void DiveListSortModel::reload()
{
DiveListModel *mySourceModel = qobject_cast<DiveListModel *>(sourceModel());
- mySourceModel->clear();
+ mySourceModel->reload();
}
// In QML, section headings can only be strings. To identify dives that
@@ -136,25 +136,6 @@ DiveListModel::DiveListModel(QObject *parent) : QAbstractListModel(parent)
m_instance = this;
}
-void DiveListModel::addDive(const QList<dive *> &listOfDives)
-{
- if (listOfDives.isEmpty())
- return;
- beginInsertRows(QModelIndex(), rowCount(), rowCount() + listOfDives.count() - 1);
- endInsertRows();
-}
-
-void DiveListModel::addAllDives()
-{
- QList<dive *>listOfDives;
- int i;
- struct dive *d;
- for_each_dive (i, d)
- listOfDives.append(d);
- addDive(listOfDives);
-
-}
-
void DiveListModel::insertDive(int i, DiveObjectHelper *)
{
beginInsertRows(QModelIndex(), i, i);
@@ -185,7 +166,7 @@ void DiveListModel::updateDive(int i, dive *d)
insertDive(i, nullptr); // TODO: DiveObjectHelper not needed anymore - remove second argument
}
-void DiveListModel::clear()
+void DiveListModel::reload()
{
beginResetModel();
endResetModel();