Changeset ef543da5 in subsurface


Ignore:
Timestamp:
Dec 15, 2017, 9:03:24 AM (6 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
2890be9
Parents:
9e16560
git-author:
Jan Mulder <jlmulder@…> (12/15/17 08:13:15)
git-committer:
Dirk Hohndel <dirk@…> (12/15/17 09:03:24)
Message:

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@…>

Location:
mobile-widgets/qml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qml/DiveDetails.qml

    re9bcca9 ref543da5  
    208208                focus = false;
    209209                Qt.inputMethod.hide();
     210                detailsEdit.clearDetailsEdit();
    210211        }
    211212
  • mobile-widgets/qml/DiveDetailsEdit.qml

    r806c707 ref543da5  
    4040        property int visibility
    4141
     42        function clearDetailsEdit() {
     43                detailsEdit.dive_id = 0
     44                detailsEdit.number = 0
     45                detailsEdit.dateText = ""
     46                detailsEdit.locationText = ""
     47                detailsEdit.durationText = ""
     48                detailsEdit.depthText = ""
     49                detailsEdit.airtempText = ""
     50                detailsEdit.watertempText = ""
     51                suitBox.currentIndex = -1
     52                buddyBox.currentIndex = -1
     53                divemasterBox.currentIndex = -1
     54                cylinderBox.currentIndex = -1
     55                detailsEdit.notesText = ""
     56                detailsEdit.rating = 0
     57                detailsEdit.visibility = 0
     58        }
     59
    4260        function saveData() {
    4361                diveDetailsPage.state = "view" // run the transition
     
    7290                // now make sure we directly show the saved dive (this may be a new dive, or it may have moved)
    7391                showDiveIndex(newIdx)
     92                clearDetailsEdit()
    7493        }
    7594
Note: See TracChangeset for help on using the changeset viewer.