syncmlfw/ds/syncagent/src/nsmldscmds.cpp
branchRCL_3
changeset 18 2de6635c154b
parent 11 06f47423ecee
child 24 13d7c31c74e0
--- a/syncmlfw/ds/syncagent/src/nsmldscmds.cpp	Tue May 11 16:59:53 2010 +0300
+++ b/syncmlfw/ds/syncagent/src/nsmldscmds.cpp	Tue May 25 13:36:17 2010 +0300
@@ -52,6 +52,7 @@
 #include "nsmldsbatchbuffer.h"
 #include "nsmldshostclient.h"
 #include "nsmloperatordefines.h"
+#include "NsmlOperatorErrorCRKeys.h"
 
 #ifndef __WINS__
 // This lowers the unnecessary compiler warning (armv5) to remark.
@@ -1712,9 +1713,7 @@
 					}
 				}
 			}
-		CNSmlDSSettings* settings = CNSmlDSSettings::NewLC();
-		settings->StoreSyncType( alertCode );
-		CleanupStack::PopAndDestroy( settings );
+		StoreSyncType( alertCode );
 		}
 		
 	// status 406 is returned if <Filter> is present BUT the session continues
@@ -4812,4 +4811,50 @@
         }
     }
 
+//-----------------------------------------------------------------------------
+// CNSmlDSCmds::StoreSyncType
+// Checks if received Alert Code is a sync type and tries to convert
+// it to Sync Type (TSmlSyncType).
+//-----------------------------------------------------------------------------
+//
+void CNSmlDSCmds::StoreSyncType( const TDes8& aAlertCode )
+    {
+    TInt syncType = KErrNotFound;
+
+    if ( aAlertCode == KNSmlDSTwoWay )
+        {
+        syncType = ESmlTwoWay;
+        }
+    else if ( aAlertCode == KNSmlDSOneWayFromServer )
+        {
+        syncType = ESmlOneWayFromServer;
+        }
+    else if ( aAlertCode == KNSmlDSOneWayFromClient )
+        {
+        syncType = ESmlOneWayFromClient;
+        }
+    else if ( aAlertCode == KNSmlDSSlowSync )
+        {
+        syncType = ESmlSlowSync;
+        }
+    else if ( aAlertCode == KNSmlDSRefreshFromServer )
+        {
+        syncType = ESmlRefreshFromServer;
+        }
+    else if ( aAlertCode == KNSmlDSRefreshFromClient )
+        {
+        syncType = ESmlRefreshFromClient;
+        }
+
+    if ( syncType != KErrNotFound )
+        {
+        CRepository* rep = NULL;
+        TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
+        if ( err == KErrNone )
+            {
+            rep->Set( KNsmlOpDsSyncType, syncType );
+            delete rep;
+            }
+        }
+    }
 // End of File