diff options
author | Guido Lerch <guido.lerch@gmail.com> | 2015-10-20 21:03:53 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-11-03 08:31:40 -0800 |
commit | 8ce471c2f537c2e73bbcd514a9b5c2b7ae61813d (patch) | |
tree | 9d8c6480a32775ea96f0fc0cf31ab7c35e58eb16 /qt-models/divepicturemodel.cpp | |
parent | 3c3523f9b8af25a2eb28042e0de3c527c33506eb (diff) | |
download | subsurface-8ce471c2f537c2e73bbcd514a9b5c2b7ae61813d.tar.gz |
Context menu for images: change DivePicture model
Altering DivePicture model to allow deleting images
from the QListView without immediate updating of the
list. Updating is determined by an additioanl parameter
Signed-off-by: Guido Lerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divepicturemodel.cpp')
-rw-r--r-- | qt-models/divepicturemodel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp index 1f37423e2..bb5db33b7 100644 --- a/qt-models/divepicturemodel.cpp +++ b/qt-models/divepicturemodel.cpp @@ -111,12 +111,14 @@ QVariant DivePictureModel::data(const QModelIndex &index, int role) const return ret; } -void DivePictureModel::removePicture(const QString &fileUrl) +void DivePictureModel::removePicture(const QString &fileUrl, bool last) { dive_remove_picture(fileUrl.toUtf8().data()); - copy_dive(current_dive, &displayed_dive); - updateDivePictures(); - mark_divelist_changed(true); + if (last) { + copy_dive(current_dive, &displayed_dive); + updateDivePictures(); + mark_divelist_changed(true); + } } int DivePictureModel::rowCount(const QModelIndex &parent) const |