Changeset 20f525ce in subsurface


Ignore:
Timestamp:
Apr 16, 2017, 7:43:48 AM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
972819d
Parents:
03b2b854
git-author:
Dirk Hohndel <dirk@…> (04/15/17 19:06:46)
git-committer:
Dirk Hohndel <dirk@…> (04/16/17 07:43:48)
Message:

QML UI: correctly update dive list after editing timestamp

Once we re-inserted the dive in the list we aren't done, quite the
contrary - we now need to make sure that we handle any other changes
and mark the dive list as updated.

Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qmlmanager.cpp

    r03b2b854 r20f525ce  
    907907        // to update
    908908        DiveListModel *dm = DiveListModel::instance();
    909         int oldModelIdx = dm->getDiveIdx(d->id);
     909        int modelIdx = dm->getDiveIdx(d->id);
    910910        int oldIdx = get_idx_by_uniq_id(d->id);
    911911        if (needResort) {
     
    915915                int newIdx = get_idx_by_uniq_id(d->id);
    916916                if (newIdx != oldIdx) {
    917                         DiveListModel::instance()->removeDive(oldModelIdx);
    918                         DiveListModel::instance()->insertDive(oldModelIdx - (newIdx - oldIdx), myDive);
    919                         diveChanged = false; // because we already modified things
     917                        DiveListModel::instance()->removeDive(modelIdx);
     918                        modelIdx += (newIdx - oldIdx);
     919                        DiveListModel::instance()->insertDive(modelIdx, myDive);
     920                        diveChanged = true; // because we already modified things
    920921                }
    921922        }
     
    932933                        d->dc = *fake_dc(&d->dc, true);
    933934                }
    934                 DiveListModel::instance()->updateDive(oldModelIdx, d);
     935                DiveListModel::instance()->updateDive(modelIdx, d);
    935936                invalidate_dive_cache(d);
    936937                mark_divelist_changed(true);
Note: See TracChangeset for help on using the changeset viewer.