camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_symbian_p.cpp
changeset 51 ccc0e7e3344f
parent 45 24fd82631616
--- a/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_symbian_p.cpp	Fri Jul 23 11:35:41 2010 +0300
+++ b/camerauis/cameraxui/cxengine/src/cxegeotaggingtrail_symbian_p.cpp	Wed Aug 18 14:02:45 2010 +0300
@@ -74,8 +74,8 @@
 {
     CX_DEBUG_ENTER_FUNCTION();
 
-    // stop trail and close location utility session
-    stop(true);
+    // close the location utility session
+    mLocationTrail.Close();
 
     CX_DEBUG_EXIT_FUNCTION();
 }
@@ -113,7 +113,7 @@
 
         if (err) {
             CX_DEBUG(("CxeGeoTaggingTrailPrivate::start <> FAILED: error = %d ", err));
-            stop(true);
+            mLocationTrail.Close();
         }        
     } else {
         // geotagging setting off, do nothing.
@@ -125,9 +125,8 @@
 
 /*!
 * Stop location trail.
-* @ param closeSession, indicates if we are willing to close the location utility session.
 */
-void CxeGeoTaggingTrailPrivate::stop(bool closeSession)
+void CxeGeoTaggingTrailPrivate::stop()
 {
     CX_DEBUG_ENTER_FUNCTION();
 
@@ -143,17 +142,9 @@
             mLocationTrail.StopLocationTrail();
             setState(CxeGeoTaggingTrail::Connected);
         }
-        
-        if (closeSession && state() == CxeGeoTaggingTrail::Connected) {
-            CX_DEBUG(("CxeGeoTaggingTrailPrivate <> disconnect location trail utility"));
-            mLocationTrail.Close();
-            setState(CxeGeoTaggingTrail::NotConnected);
-        }
+
     } else {
         // not ready to stop the location trail, TrailStarted the timer.
-        if (!mPendingStopTrailSession) {
-            mPendingStopTrailSession = closeSession;
-        }
         mStopLocationTrailTimer.start(STOP_TRAIL_INTERVAL);
     }
     
@@ -188,7 +179,7 @@
     CX_DEBUG_ENTER_FUNCTION();
     
     // stop the pending location trail utility
-    stop(mPendingStopTrailSession);
+    stop();
     
     CX_DEBUG_EXIT_FUNCTION();
 }
@@ -228,8 +219,8 @@
                                                               QVariant value)
 {
     CX_DEBUG_ENTER_FUNCTION();
-
-    if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState) {
+    bool stateOk = (state() == CxeGeoTaggingTrail::DataAvailable || state() == CxeGeoTaggingTrail::TrailStarted);
+    if (uid == KPSUidLocationTrail.iUid && key == KLocationTrailState && stateOk) {
         CX_DEBUG(("Location trail: new state = %d ", value.toInt()));
 
         RLocationTrail::TTrailState newState =