Dont set coordinates when two or more dives are selected

If a trip is selected (or for other reasons more than one dive), this
would change the GPS coordinates of the whole selection which almost
certainly isn't what the user wanted.
Instead, only allow changes of the coordinates on the globe if exactly one
dive is selected.

[Dirk Hohndel: massively rewritten and extended - but I didn't want to
               simply "steal" the commit from Tomaz...
	       This now maintains the "zoom out mode" for dives without
	       GPS coordinates and deals with edits of multiple dives that
	       are initiated the "normal way" by starting to edit other
	       data as well.]

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-05-01 14:47:52 -03:00 committed by Dirk Hohndel
parent 7f3b487c77
commit 4243fcb915
3 changed files with 37 additions and 21 deletions

View file

@ -251,7 +251,8 @@ void MainTab::enableEdition(EditMode newEditMode)
return;
}
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->globe()->prepareForGetDiveCoordinates();
if (amount_selected == 1)
MainWindow::instance()->globe()->prepareForGetDiveCoordinates(current_dive);
// We may be editing one or more dives here. backup everything.
notesBackup.clear();
if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) {