X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=zouba%2Fsrc%2Fgpscontroller_p.cpp;h=c65414607167824585749183734ee0f67b967dbc;hb=c2811396f7936d974eba4d8a2bf454713334a6d1;hp=6c6951edea2e93b23aae0305d36fd6f6a5c5f128;hpb=6c84454f785e44a38aeac218b7505475e73358f0;p=ptas diff --git a/zouba/src/gpscontroller_p.cpp b/zouba/src/gpscontroller_p.cpp index 6c6951e..c654146 100644 --- a/zouba/src/gpscontroller_p.cpp +++ b/zouba/src/gpscontroller_p.cpp @@ -60,7 +60,10 @@ Location *GpsControllerPrivate::currentLocation() void GpsControllerPrivate::setCurrentLocation( Location *location ) { - delete m_currentLocation; + if ( m_currentLocation && m_currentLocation->label() == "livegps" ) { + delete m_currentLocation; + m_currentLocation=0; + } m_currentLocation = location; } @@ -71,14 +74,19 @@ bool GpsControllerPrivate::useFakeLocation() void GpsControllerPrivate::setUseFakeLocation( bool useFake ) { + // delete previous GPS if it was live and we're switching to fake + if ( m_currentLocation && m_currentLocation->label() == "livegps" ) { + delete m_currentLocation; + m_currentLocation = 0; + } m_useFakeLocation = useFake; } void GpsControllerPrivate::updateLocation( QGeoPositionInfo positionInfo ) { - if ( !m_useFakeLocation ) { + if ( m_currentLocation && m_currentLocation->label() == "livegps" ) { delete m_currentLocation; - m_currentLocation = new Location( positionInfo ); } + m_currentLocation = new Location( positionInfo, "livegps" ); }