syncmlfw/ds/syncagent/src/nsmldscmds.cpp
branchRCL_3
changeset 18 2de6635c154b
parent 11 06f47423ecee
child 24 13d7c31c74e0
equal deleted inserted replaced
16:915074efc433 18:2de6635c154b
    50 #include "nsmlfilter.h"
    50 #include "nsmlfilter.h"
    51 #include "nsmldssettings.h"
    51 #include "nsmldssettings.h"
    52 #include "nsmldsbatchbuffer.h"
    52 #include "nsmldsbatchbuffer.h"
    53 #include "nsmldshostclient.h"
    53 #include "nsmldshostclient.h"
    54 #include "nsmloperatordefines.h"
    54 #include "nsmloperatordefines.h"
       
    55 #include "NsmlOperatorErrorCRKeys.h"
    55 
    56 
    56 #ifndef __WINS__
    57 #ifndef __WINS__
    57 // This lowers the unnecessary compiler warning (armv5) to remark.
    58 // This lowers the unnecessary compiler warning (armv5) to remark.
    58 // "Warning:  #174-D: expression has no effect..." is caused by 
    59 // "Warning:  #174-D: expression has no effect..." is caused by 
    59 // DBG_ARGS8 macro in no-debug builds.
    60 // DBG_ARGS8 macro in no-debug builds.
  1710 					SwitchAlertCode( alertCode );
  1711 					SwitchAlertCode( alertCode );
  1711 					iDSContent.SetSyncTypeL( alertCode );
  1712 					iDSContent.SetSyncTypeL( alertCode );
  1712 					}
  1713 					}
  1713 				}
  1714 				}
  1714 			}
  1715 			}
  1715 		CNSmlDSSettings* settings = CNSmlDSSettings::NewLC();
  1716 		StoreSyncType( alertCode );
  1716 		settings->StoreSyncType( alertCode );
       
  1717 		CleanupStack::PopAndDestroy( settings );
       
  1718 		}
  1717 		}
  1719 		
  1718 		
  1720 	// status 406 is returned if <Filter> is present BUT the session continues
  1719 	// status 406 is returned if <Filter> is present BUT the session continues
  1721 	if (  aAlert->itemList && aAlert->itemList->item )
  1720 	if (  aAlert->itemList && aAlert->itemList->item )
  1722 	    {
  1721 	    {
  4810         CleanupStack::PopAndDestroy( dsSettings );
  4809         CleanupStack::PopAndDestroy( dsSettings );
  4811         CleanupStack::PopAndDestroy( operatorSettingsCenrep );
  4810         CleanupStack::PopAndDestroy( operatorSettingsCenrep );
  4812         }
  4811         }
  4813     }
  4812     }
  4814 
  4813 
       
  4814 //-----------------------------------------------------------------------------
       
  4815 // CNSmlDSCmds::StoreSyncType
       
  4816 // Checks if received Alert Code is a sync type and tries to convert
       
  4817 // it to Sync Type (TSmlSyncType).
       
  4818 //-----------------------------------------------------------------------------
       
  4819 //
       
  4820 void CNSmlDSCmds::StoreSyncType( const TDes8& aAlertCode )
       
  4821     {
       
  4822     TInt syncType = KErrNotFound;
       
  4823 
       
  4824     if ( aAlertCode == KNSmlDSTwoWay )
       
  4825         {
       
  4826         syncType = ESmlTwoWay;
       
  4827         }
       
  4828     else if ( aAlertCode == KNSmlDSOneWayFromServer )
       
  4829         {
       
  4830         syncType = ESmlOneWayFromServer;
       
  4831         }
       
  4832     else if ( aAlertCode == KNSmlDSOneWayFromClient )
       
  4833         {
       
  4834         syncType = ESmlOneWayFromClient;
       
  4835         }
       
  4836     else if ( aAlertCode == KNSmlDSSlowSync )
       
  4837         {
       
  4838         syncType = ESmlSlowSync;
       
  4839         }
       
  4840     else if ( aAlertCode == KNSmlDSRefreshFromServer )
       
  4841         {
       
  4842         syncType = ESmlRefreshFromServer;
       
  4843         }
       
  4844     else if ( aAlertCode == KNSmlDSRefreshFromClient )
       
  4845         {
       
  4846         syncType = ESmlRefreshFromClient;
       
  4847         }
       
  4848 
       
  4849     if ( syncType != KErrNotFound )
       
  4850         {
       
  4851         CRepository* rep = NULL;
       
  4852         TRAPD ( err, rep = CRepository::NewL( KCRUidOperatorDatasyncErrorKeys ) );
       
  4853         if ( err == KErrNone )
       
  4854             {
       
  4855             rep->Set( KNsmlOpDsSyncType, syncType );
       
  4856             delete rep;
       
  4857             }
       
  4858         }
       
  4859     }
  4815 // End of File
  4860 // End of File