summaryrefslogtreecommitdiffstats
path: root/qt-ui/globe.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-03 15:29:40 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-03 11:07:59 -0800
commit80265e4b3f213e0b9e69514ea68049e6bd964062 (patch)
treeb0ca660232e31c36196bba86211a82375b353d08 /qt-ui/globe.cpp
parent49cb75ee0947414b92b6268ee5db8ae312df7cc0 (diff)
downloadsubsurface-80265e4b3f213e0b9e69514ea68049e6bd964062.tar.gz
Fix ignoring empty selections on the globe and code cleanup.
If the 'mouseClicked' didn't get any dives at the click-geolocation, ignore it and do not try to select an empty selection. this was causing a lot of issues when map-navigation. Also, good deal of code cleanup. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/globe.cpp')
-rw-r--r--qt-ui/globe.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp
index d1c23ed33..10ce7058b 100644
--- a/qt-ui/globe.cpp
+++ b/qt-ui/globe.cpp
@@ -132,9 +132,7 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
int idx;
struct dive *dive;
- bool clear = !(QApplication::keyboardModifiers() && Qt::ControlModifier);
- bool toggle = !clear;
- bool first = true;
+ bool clear = !(QApplication::keyboardModifiers() & Qt::ControlModifier);
QList<int> selectedDiveIds;
for_each_dive(idx, dive) {
long lat_diff, lon_diff;
@@ -150,8 +148,9 @@ void GlobeGPS::mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit unit)
continue;
selectedDiveIds.push_back(idx);
- first = false;
}
+ if(selectedDiveIds.empty())
+ return;
if (clear) {
mainWindow()->dive_list()->unselectDives();
clear = false;