Maintain the selection when aborting "dive add"

We remember what was selected before and restore it. Maybe there's a more
"Qt way" of doing this, but my implementation appears to work :-)

Also remove unconditional debug output that snuck into an earlier commit.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-14 17:52:03 +09:00
parent 179615f3a9
commit dfd17c7a7f
5 changed files with 40 additions and 9 deletions

View file

@ -65,12 +65,13 @@ MainWindow::MainWindow() : helpView(0)
}
// this gets called after we download dives from a divecomputer
void MainWindow::refreshDisplay()
void MainWindow::refreshDisplay(bool recreateDiveList)
{
ui.InfoWidget->reload();
ui.ProfileWidget->refresh();
ui.globe->reload();
ui.ListWidget->reload(DiveTripModel::CURRENT);
if (recreateDiveList)
ui.ListWidget->reload(DiveTripModel::CURRENT);
ui.ListWidget->setFocus();
WSInfoModel *wsim = WSInfoModel::instance();
wsim->updateInfo();
@ -282,8 +283,7 @@ void MainWindow::on_actionAddDive_triggered()
QMessageBox::warning(this, tr("Warning"), "First finish the current edition before trying to do another." );
return;
}
// clear the selection
dive_list()->rememberSelection();
dive_list()->unselectDives();
disableDcShortcuts();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::ADD);