diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2017-12-15 17:13:15 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-12-15 09:03:24 -0800 |
commit | ef543da5aff296e4e4996a87e22165cf43ef2e87 (patch) | |
tree | 13fc86132781743eae55968f98bf44bafc7bf575 /mobile-widgets | |
parent | 9e165602c4ecb4b8b5206e33597be19e2978131b (diff) | |
download | subsurface-ef543da5aff296e4e4996a87e22165cf43ef2e87.tar.gz |
mobile: clear internal data when edit/add dive is finished
When editing (or adding) a dive, the internal data containing the
attributes on the edit page was not cleared when editing was
finished (in any way, by saving the edit or by cancelling it).
As long as the user only edits existing dives, all this poses
no problem, as at the start of a dive edit, the data is filled
from the dive to be edited. However, when adding a dive, data
coming from previous edits shows up. This not clearing data
also causes the strange effect as written in issue #950: adding
a dive, deleting it, and adding a dive again, added the first
added dive data, without the edit screen being shown.
All this can be solved by clearing the data from the edit when
editing is done.
Fixes: #950
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 1 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveDetailsEdit.qml | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 41e7f50be..2a6398816 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -207,6 +207,7 @@ Kirigami.Page { state = "view"; focus = false; Qt.inputMethod.hide(); + detailsEdit.clearDetailsEdit(); } function startEditMode() { diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index e369e5ab3..e680e1734 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -39,6 +39,24 @@ Item { property int rating property int visibility + function clearDetailsEdit() { + detailsEdit.dive_id = 0 + detailsEdit.number = 0 + detailsEdit.dateText = "" + detailsEdit.locationText = "" + detailsEdit.durationText = "" + detailsEdit.depthText = "" + detailsEdit.airtempText = "" + detailsEdit.watertempText = "" + suitBox.currentIndex = -1 + buddyBox.currentIndex = -1 + divemasterBox.currentIndex = -1 + cylinderBox.currentIndex = -1 + detailsEdit.notesText = "" + detailsEdit.rating = 0 + detailsEdit.visibility = 0 + } + function saveData() { diveDetailsPage.state = "view" // run the transition // apply the changes to the dive_table @@ -71,6 +89,7 @@ Item { Qt.inputMethod.hide() // now make sure we directly show the saved dive (this may be a new dive, or it may have moved) showDiveIndex(newIdx) + clearDetailsEdit() } height: editArea.height |