syncmlfw/dm/syncagent/src/nsmldmagent.cpp
changeset 22 19fb38abab1d
parent 0 b497e44ab2fc
child 27 2c8580950a26
equal deleted inserted replaced
5:3f7d9dbe57c8 22:19fb38abab1d
  1372 	if(iSyncLog)
  1372 	if(iSyncLog)
  1373 		{
  1373 		{
  1374 		TTime now;
  1374 		TTime now;
  1375 		//now.HomeTime();//previously using
  1375 		//now.HomeTime();//previously using
  1376 		now.UniversalTime();
  1376 		now.UniversalTime();
       
  1377 		if(iError)
  1377 		iSyncLog->SetResult(now, iError->SyncLogErrorCode());
  1378 		iSyncLog->SetResult(now, iError->SyncLogErrorCode());
       
  1379 		else
       
  1380 		iSyncLog->SetResult(now, KErrGeneral);   
  1378 
  1381 
  1379 			CNSmlDMSettings* settings = CNSmlDMSettings::NewLC();
  1382 			CNSmlDMSettings* settings = CNSmlDMSettings::NewLC();
  1380 			CNSmlDMProfile* profile = settings->ProfileL( iProfileID );
  1383 			CNSmlDMProfile* profile = settings->ProfileL( iProfileID );
  1381 			if(!profile)
  1384 			if(!profile)
  1382 			    {
  1385 			    {
  1383 			    iSyncLog = NULL;
  1386 			    iSyncLog = NULL;
  1384 			    CleanupStack::PopAndDestroy();  //setttings
  1387 			    CleanupStack::PopAndDestroy();  //setttings
  1385 			      return;
  1388 			      return;
  1386 			    }
  1389 			    }
  1387 			CleanupStack::PushL( profile );
  1390 			CleanupStack::PushL( profile );
       
  1391 		  if( iError )
       
  1392 		  {
  1388            if(iError->SyncLogErrorCode() == KErrNone)
  1393            if(iError->SyncLogErrorCode() == KErrNone)
  1389            {
  1394            {
  1390            RWriteStream& LastSyncStream = profile->LastSyncWriteStreamL();
  1395            RWriteStream& LastSyncStream = profile->LastSyncWriteStreamL();
  1391            CleanupClosePushL( LastSyncStream );
  1396            CleanupClosePushL( LastSyncStream );
  1392            TPckgBuf<TTime> lastsynctime(now);
  1397            TPckgBuf<TTime> lastsynctime(now);
  1408 	        SyncSuccessTime = lastsynctime().Int64();
  1413 	        SyncSuccessTime = lastsynctime().Int64();
  1409 	        iSyncLog->SetLastSyncResult(SyncSuccessTime);
  1414 	        iSyncLog->SetLastSyncResult(SyncSuccessTime);
  1410 	        CleanupStack::PopAndDestroy();	
  1415 	        CleanupStack::PopAndDestroy();	
  1411 			}
  1416 			}
  1412           } 
  1417           } 
       
  1418         }
  1413 			CNSmlHistoryArray* array = CNSmlHistoryArray::NewL();
  1419 			CNSmlHistoryArray* array = CNSmlHistoryArray::NewL();
  1414 			CleanupStack::PushL( array );
  1420 			CleanupStack::PushL( array );
  1415 			array->SetOwnerShip( ETrue );
  1421 			array->SetOwnerShip( ETrue );
  1416 
  1422 
  1417 			RReadStream& readStream = profile->LogReadStreamL();
  1423 			RReadStream& readStream = profile->LogReadStreamL();
  1830         { 
  1836         { 
  1831         iDataItem = new (ELeave) RArray<CNSmlDMAlertItem>();   // new (ELeave) RArray<TDes8<255> > ();  
  1837         iDataItem = new (ELeave) RArray<CNSmlDMAlertItem>();   // new (ELeave) RArray<TDes8<255> > ();  
  1832 
  1838 
  1833         for(TInt i =0; i< count ; i++)
  1839         for(TInt i =0; i< count ; i++)
  1834             {    
  1840             {    
  1835             CNSmlDMAlertItem* iItem = new (ELeave) CNSmlDMAlertItem ;
  1841             CNSmlDMAlertItem* tempItem = new (ELeave) CNSmlDMAlertItem ;
  1836             iItem->iSource = ((*aItemList)[i].iSource)->AllocL();
  1842             CleanupStack::PushL( tempItem );
  1837             iItem->iTarget = ((*aItemList)[i].iTarget)->AllocL();
  1843             tempItem->iSource = ((*aItemList)[i].iSource)->AllocL();
  1838             iItem->iMetaType = ((*aItemList)[i].iMetaType)->AllocL();
  1844             tempItem->iTarget = ((*aItemList)[i].iTarget)->AllocL();
  1839             iItem->iMetaFormat = ((*aItemList)[i].iMetaFormat)->AllocL();
  1845             tempItem->iMetaType = ((*aItemList)[i].iMetaType)->AllocL();
  1840             iItem->iMetaMark = ((*aItemList)[i].iMetaMark)->AllocL();
  1846             tempItem->iMetaFormat = ((*aItemList)[i].iMetaFormat)->AllocL();
  1841             iItem->iData = ((*aItemList)[i].iData)->AllocL();
  1847             tempItem->iMetaMark = ((*aItemList)[i].iMetaMark)->AllocL();
  1842             iDataItem->AppendL(*iItem);
  1848             tempItem->iData = ((*aItemList)[i].iData)->AllocL();
       
  1849             iDataItem->AppendL(*tempItem);
       
  1850             CleanupStack::PopAndDestroy( tempItem );
  1843             }
  1851             }
  1844         }   
  1852         }   
  1845 
  1853 
  1846     }
  1854     }
  1847 
  1855