diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-09 16:31:24 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-17 16:54:36 -0700 |
commit | 6e59ee00d8a71de38b5249e43376ca9dca1cd4fe (patch) | |
tree | ac48b521b90c44772a04fed7b12c26b010b4d09d /qt-models/divetripmodel.cpp | |
parent | 219420bd6e1648596aa4a3324d3f39bb3d791be7 (diff) | |
download | subsurface-6e59ee00d8a71de38b5249e43376ca9dca1cd4fe.tar.gz |
divetripmodel: remove setData() function
The setData() function was used to edit the number of a dive.
However, that doesn't appear to be functional. Therefore, remove
the code. There is a context-menu entry "renumber dives" for that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divetripmodel.cpp')
-rw-r--r-- | qt-models/divetripmodel.cpp | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/qt-models/divetripmodel.cpp b/qt-models/divetripmodel.cpp index 453a93c1e..677be21fb 100644 --- a/qt-models/divetripmodel.cpp +++ b/qt-models/divetripmodel.cpp @@ -508,36 +508,6 @@ Qt::ItemFlags DiveTripModelBase::flags(const QModelIndex &index) const return d && index.column() == NR ? base | Qt::ItemIsEditable : base; } -bool DiveTripModelBase::setData(const QModelIndex &index, const QVariant &value, int role) -{ - // We only support setting of data for dives and there, only the number. - dive *d = diveOrNull(index); - if (!d) - return false; - if (role != Qt::EditRole) - return false; - if (index.column() != NR) - return false; - - int v = value.toInt(); - if (v == 0) - return false; - - // Only accept numbers that are not already in use by other dives. - int i; - struct dive *dive; - for_each_dive (i, dive) { - if (dive->number == v) - return false; - } -#if defined(SUBSURFACE_MOBILE) - d->number = v; -#else - Command::editNumber(v, d); -#endif - return true; -} - // Update visibility status of dive and return dives whose visibility changed. // Attention: the changed dives are removed from the original vector! static ShownChange updateShown(QVector<dive *> &dives) |