syncmlfw/ds/hostserver/dshostclient/src/fakeclient.cpp
changeset 0 b497e44ab2fc
equal deleted inserted replaced
-1:000000000000 0:b497e44ab2fc
       
     1 /*
       
     2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Client module of DS Host Servers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <e32math.h>
       
    20 #include <vtoken.h>
       
    21 #include <f32file.h>
       
    22 #include "nsmldbcaps.h"
       
    23 #include "nsmlfilter.h"
       
    24 //#include "nsmlconstants.h"
       
    25 
       
    26 const TInt KItemSize( 128 );
       
    27 const TInt KNSmlMaxObjSize( 786432 );
       
    28 const TSmlDbItemUid KFailDeleteUid = 13;
       
    29 const TSmlDbItemUid KFailReplaceUid = 13;
       
    30 const TSmlDbItemUid KFailMoveUid = 13;
       
    31 const TSmlDbItemUid KInvalidParent = 113;
       
    32 const TSmlDbItemUid KFieldLevelReplace = 14;
       
    33 const TInt KMakeBatchFail = 5;
       
    34 
       
    35 const TUid KContacts = { 0x101F6DDD };
       
    36 const TUid KAgenda   = { 0x101F6DDE };
       
    37 const TUid KEmpty1 = { 0x101F6FFF };
       
    38 const TUid KEmpty2 = { 0x101F6FFE };
       
    39 const TUid KUidNotValid = { 0x101F6FFD };
       
    40 
       
    41 _LIT( KNSmlUnicodeContactsLocalDbName, "C:\\System\\Data\\Contacts.cdb" );
       
    42 _LIT( KNSmlUnicodeAgenda1LocalDbName, "C:\\System\\Data\\Agenda1.cdb" );
       
    43 _LIT( KNSmlUnicodeAgenda2LocalDbName, "C:\\System\\Data\\Agenda2.cdb" );
       
    44 _LIT( KNSmlUnicodeEmpty1LocalDbName, "C:\\System\\Data\\Empty1.cdb" );
       
    45 _LIT( KNSmlUnicodeEmpty2LocalDbName, "C:\\System\\Data\\Empty2.cdb" );
       
    46 _LIT( KReceivedDataFile, "C:\ReceivedData.txt" );
       
    47 
       
    48 _LIT8( KWriteSeparator, "\r\n==============================================\r\n" );
       
    49 _LIT8( KNSmlContactsLocalDbName, "C:\\System\\Data\\Contacts.cdb" );
       
    50 _LIT8( KNSmlAgenda1LocalDbName, "C:\\System\\Data\\Agenda1.cdb" );
       
    51 _LIT8( KNSmlAgenda2LocalDbName, "C:\\System\\Data\\Agenda2.cdb" );
       
    52 _LIT8( KNSmlEmpty1LocalDbName, "C:\\System\\Data\\Empty1.cdb" );
       
    53 _LIT8( KNSmlEmpty2LocalDbName, "C:\\System\\Data\\Empty21.cdb" );
       
    54 _LIT8( KNSmlvCard30Name, "text/vcard" );
       
    55 _LIT8( KNSmlvCard30Ver, "3.0" );
       
    56 _LIT8( KNSmlvCard21Name, "text/x-vcard" );
       
    57 _LIT8( KNSmlvCard21Ver, "2.1" );
       
    58 
       
    59 _LIT8( KVersitTokenHOME, "HOME"  );
       
    60 _LIT8( KVersitTokenWORK, "WORK"  );
       
    61 _LIT8( KVersitTokenCELL, "CELL"  );
       
    62 _LIT8( KVersitTokenPAGER,"PAGER" );
       
    63 _LIT8( KVersitTokenFAX,  "FAX"   );
       
    64 _LIT8( KVersitTokenVOICE,"VOICE" );
       
    65 
       
    66 _LIT8( KNSmlvCalendar, "text/x-vcalendar" );
       
    67 _LIT8( KNSmlvCalendarVer, "1.0" );
       
    68 #define KNSmlvCalendarVersion TVersion(1,0,0);
       
    69 
       
    70 _LIT8( KNSmliCalendar, "text/calendar" );
       
    71 _LIT8( KNSmliCalendarVer, "2.0" );
       
    72 #define KNSmliCalendarVersion TVersion(2,0,0);
       
    73 
       
    74 _LIT8( KVersitVarTokenVCALENDAR8, "VCALENDAR");
       
    75 _LIT8( KVersitVarTokenVEVENT8, "VEVENT");
       
    76 _LIT8( KVersitVarTokenVTODO8, "VTODO");
       
    77 _LIT8( KVersitVarTokenXEPOCSOUND, "TYPE" );
       
    78 _LIT8( KVersitVarTokenXEPOCAGENDAENTRYTYPE, "X-EPOCAGENDAENTRYTYPE" );
       
    79 _LIT8( KVCalTokenPUBLIC8,"PUBLIC" );
       
    80 _LIT8( KVCalTokenPRIVATE8,"PRIVATE" );
       
    81 _LIT8( KVCalTokenCONFIDENTIAL8,"CONFIDENTIAL" );
       
    82 
       
    83 // ------------------------------------------------------------------------------------------------
       
    84 // CNSmlDSHostClient::CNSmlDSHostClient
       
    85 // C++ constructor.
       
    86 // ------------------------------------------------------------------------------------------------
       
    87 CNSmlDSHostClient::CNSmlDSHostClient()
       
    88 	{
       
    89 	iBatchMode = EFalse;
       
    90 	iBatchCount = 0;
       
    91 	iReadCount = 0;
       
    92 	}
       
    93 
       
    94 // ------------------------------------------------------------------------------------------------
       
    95 // CNSmlDSHostClient::ConstrucL
       
    96 // ConstrucL
       
    97 // ------------------------------------------------------------------------------------------------
       
    98 void CNSmlDSHostClient::ConstructL()
       
    99 	{
       
   100 	}
       
   101 
       
   102 // ------------------------------------------------------------------------------------------------
       
   103 // CNSmlDSHostClient::SessionForDataProvider
       
   104 // Return session to correct server that has current Data Provider.
       
   105 // ------------------------------------------------------------------------------------------------
       
   106 TInt CNSmlDSHostClient::SessionForDataProvider( const TSmlDataProviderId /*aId*/ ) const
       
   107 	{	
       
   108 	return 0;
       
   109 	}
       
   110 
       
   111 // ------------------------------------------------------------------------------------------------
       
   112 // CNSmlDSHostClient - public methods
       
   113 // ------------------------------------------------------------------------------------------------
       
   114 // ------------------------------------------------------------------------------------------------
       
   115 // CNSmlDSHostClient::NewL
       
   116 // Creates new instance of CNSmlDSHostClient based class.
       
   117 // ------------------------------------------------------------------------------------------------
       
   118 EXPORT_C CNSmlDSHostClient* CNSmlDSHostClient::NewL()
       
   119 	{
       
   120 	CNSmlDSHostClient* self = NewLC();
       
   121 	CleanupStack::Pop();
       
   122 	return self;
       
   123 	}
       
   124 
       
   125 // ------------------------------------------------------------------------------------------------
       
   126 // CNSmlDSHostClient::NewLC
       
   127 // Creates new instance of CNSmlDSHostClient based class.
       
   128 // ------------------------------------------------------------------------------------------------
       
   129 EXPORT_C CNSmlDSHostClient* CNSmlDSHostClient::NewLC()
       
   130 	{
       
   131 	CNSmlDSHostClient* self = new (ELeave) CNSmlDSHostClient();
       
   132 	CleanupStack::PushL( self );
       
   133 	self->ConstructL();
       
   134 	return self;
       
   135 	}
       
   136 	
       
   137 // ------------------------------------------------------------------------------------------------
       
   138 // CNSmlDSHostClient::~CNSmlDSHostClient
       
   139 // C++ Destructor.
       
   140 // ------------------------------------------------------------------------------------------------
       
   141 EXPORT_C CNSmlDSHostClient::~CNSmlDSHostClient()
       
   142 	{
       
   143 	iBatchResults.Close();
       
   144 	}
       
   145 
       
   146 // ------------------------------------------------------------------------------------------------
       
   147 // CNSmlDSHostClient::CreateDataProvidersL
       
   148 // Creates Data Providers.
       
   149 // ------------------------------------------------------------------------------------------------
       
   150 EXPORT_C void CNSmlDSHostClient::CreateDataProvidersL( const RArray<TSmlDataProviderId>& aIds, RArray<TInt>& aResultArray )
       
   151 	{
       
   152 	for ( TInt i = 0; i < aIds.Count(); i++ )
       
   153 		{
       
   154 		aResultArray.Append( KErrNone )	;
       
   155 		}
       
   156 	}
       
   157 	
       
   158 // ------------------------------------------------------------------------------------------------
       
   159 // CNSmlDSHostClient::CreateAllDataProvidersL
       
   160 // Creates all possible Data Providers.
       
   161 // ------------------------------------------------------------------------------------------------
       
   162 EXPORT_C void CNSmlDSHostClient::CreateAllDataProvidersL( RArray<TSmlDataProviderId>& aIds )
       
   163 	{
       
   164 	aIds.Append( KContacts.iUid );
       
   165 	aIds.Append( KAgenda.iUid );
       
   166 	aIds.Append( KEmpty1.iUid );
       
   167 	aIds.Append( KEmpty2.iUid );
       
   168 	}
       
   169 
       
   170 // ------------------------------------------------------------------------------------------------
       
   171 // CNSmlDSHostClient::SupportsOperationL
       
   172 // Asks if Data Provider supports some operation.
       
   173 // ------------------------------------------------------------------------------------------------
       
   174 EXPORT_C TBool CNSmlDSHostClient::SupportsOperationL( TUid aOpId, TSmlDataProviderId aId, TInt& aResultCode ) const
       
   175 	{
       
   176 	aResultCode = KErrNone;
       
   177 	
       
   178 	if ( aId == KContacts.iUid )
       
   179 		{
       
   180 		if ( aOpId == KUidSmlSupportTransaction )
       
   181 			{
       
   182 			return ETrue;		
       
   183 			}
       
   184 
       
   185 		if ( aOpId == KUidSmlSupportSuspendResume )
       
   186 			{
       
   187 			return EFalse;		
       
   188 			}
       
   189 
       
   190 		if ( aOpId == KUidSmlSupportBatch )
       
   191 			{
       
   192 			return ETrue;		
       
   193 			}
       
   194 		}
       
   195 	else if ( aId == KAgenda.iUid )
       
   196 		{
       
   197 		if ( aOpId == KUidSmlSupportTransaction )
       
   198 			{
       
   199 			return EFalse;		
       
   200 			}
       
   201 
       
   202 		if ( aOpId == KUidSmlSupportSuspendResume )
       
   203 			{
       
   204 			return EFalse;		
       
   205 			}
       
   206 
       
   207 		if ( aOpId == KUidSmlSupportBatch )
       
   208 			{
       
   209 			return EFalse;		
       
   210 			}
       
   211 		}
       
   212 
       
   213 	return EFalse;
       
   214 	}
       
   215 
       
   216 // ------------------------------------------------------------------------------------------------
       
   217 // CNSmlDSHostClient::StoreFormatL
       
   218 // Creates Data Store format of Data Provider.
       
   219 // ------------------------------------------------------------------------------------------------
       
   220 EXPORT_C CNSmlDbCaps* CNSmlDSHostClient::StoreFormatL( const TSmlDataProviderId aId, TInt& aResultCode )
       
   221 	{
       
   222 	CNSmlDbCaps* dbCaps = CNSmlDbCaps::NewLC();
       
   223 	
       
   224 	if ( aId == KContacts.iUid || aId == KEmpty1.iUid || aId == KEmpty2.iUid )
       
   225 		{
       
   226 		dbCaps->SetSourceRefL( KNSmlContactsLocalDbName );
       
   227 		dbCaps->SetSyncType( CNSmlDbCaps::EAllTypes );
       
   228 		dbCaps->SetRxPrefL (KNSmlvCard21Name(), KNSmlvCard21Ver() );
       
   229 		dbCaps->AddRxL( KNSmlvCard30Name(), KNSmlvCard30Ver() );
       
   230 		dbCaps->SetTxPrefL( KNSmlvCard21Name(), KNSmlvCard21Ver() );
       
   231 		dbCaps->SetSupportHierarchicalSyncL();
       
   232 		
       
   233 		TInt pc( 0 );
       
   234 		CNSmlCtCap* cap = dbCaps->AddCtCapLC(); ++pc;
       
   235 		cap->SetCtTypeL( KNSmlvCard21Name() );
       
   236 		cap->SetVerCtL( KNSmlvCard21Ver() );
       
   237 		CNSmlDevInfProp* pr = cap->AddDevInfPropLC( KVersitTokenBEGIN() ); ++pc;
       
   238 		pr->AddValEnumL( KVersitTokenVCARD() );
       
   239 		pr = cap->AddDevInfPropLC( KVersitTokenEND() ); ++pc;
       
   240 		pr->AddValEnumL( KVersitTokenVCARD() );
       
   241 		pr = cap->AddDevInfPropLC( KVersitTokenVERSION() ); ++pc;
       
   242 		pr->AddValEnumL( KNSmlvCard21Ver() );
       
   243 
       
   244 		cap->AddDevInfPropLC( KVersitTokenREV() ); ++pc;
       
   245 		cap->AddDevInfPropLC( KVersitTokenN() ); ++pc;
       
   246 
       
   247 		pr = cap->AddDevInfPropLC( KVersitTokenADR() ); ++pc;
       
   248 		pr->AddParamLC( KVersitTokenHOME() ); ++pc;
       
   249 		pr->AddParamLC( KVersitTokenWORK() ); ++pc;
       
   250 
       
   251 		pr = cap->AddDevInfPropLC( KVersitTokenTEL() ); ++pc;
       
   252 		pr->AddParamLC( KVersitTokenHOME() ); ++pc;
       
   253 		pr->AddParamLC( KVersitTokenWORK() ); ++pc;
       
   254 		pr->AddParamLC( KVersitTokenCELL() ); ++pc;
       
   255 		pr->AddParamLC( KVersitTokenPAGER() ); ++pc;
       
   256 		pr->AddParamLC( KVersitTokenFAX() ); ++pc;
       
   257 
       
   258 		cap->AddDevInfPropLC( KVersitTokenFN() ); ++pc;
       
   259 
       
   260 		pr = cap->AddDevInfPropLC( KVersitTokenEMAIL() ); ++pc;
       
   261 		pr->AddParamLC( KVersitTokenINTERNET() ); ++pc;
       
   262 		pr->AddParamLC( KVersitTokenHOME() ); ++pc;
       
   263 		pr->AddParamLC( KVersitTokenWORK() ); ++pc;
       
   264 
       
   265 		pr = cap->AddDevInfPropLC( KVersitTokenURL() ); ++pc;
       
   266 		pr->AddParamLC( KVersitTokenHOME() ); ++pc;
       
   267 		pr->AddParamLC( KVersitTokenWORK() ); ++pc;
       
   268 
       
   269 		cap->AddDevInfPropLC( KVersitTokenNOTE() ); ++pc;
       
   270 
       
   271 		cap->AddDevInfPropLC( KVersitTokenTITLE() ); ++pc;
       
   272 		cap->AddDevInfPropLC( KVersitTokenORG() ); ++pc;
       
   273 
       
   274 		cap->AddDevInfPropLC( KVersitTokenPHOTO() ); ++pc;
       
   275 		cap->AddDevInfPropLC( KVersitTokenBDAY() ); ++pc;
       
   276 
       
   277 		CleanupStack::PopAndDestroy( pc );
       
   278 		}
       
   279 	else
       
   280 		{
       
   281 		dbCaps->SetSourceRefL( KNSmlAgenda1LocalDbName );
       
   282 		dbCaps->SetSyncType( CNSmlDbCaps::EAllTypes );
       
   283 		dbCaps->SetRxPrefL(KNSmlvCalendar(), KNSmlvCalendarVer() );
       
   284 		dbCaps->AddRxL( KNSmliCalendar(), KNSmliCalendarVer() );
       
   285 		dbCaps->SetTxPrefL( KNSmlvCalendar(), KNSmlvCalendarVer() );	
       
   286 		
       
   287         TInt pc( 0 );
       
   288         CNSmlCtCap* cap = dbCaps->AddCtCapLC(); pc++;
       
   289         cap->SetCtTypeL( KNSmlvCalendar() );
       
   290         cap->SetVerCtL( KNSmlvCalendarVer() );
       
   291         CNSmlDevInfProp* pr = cap->AddDevInfPropLC(KVersitTokenBEGIN()); pc++;
       
   292         pr->AddValEnumL(KVersitVarTokenVCALENDAR8());
       
   293         pr->AddValEnumL(KVersitVarTokenVEVENT8());
       
   294         pr->AddValEnumL(KVersitVarTokenVTODO8());
       
   295         pr = cap->AddDevInfPropLC(KVersitTokenEND()); pc++;
       
   296         pr->AddValEnumL(KVersitVarTokenVCALENDAR8());
       
   297         pr->AddValEnumL(KVersitVarTokenVEVENT8());
       
   298         pr->AddValEnumL(KVersitVarTokenVTODO8());
       
   299 
       
   300         pr = cap->AddDevInfPropLC(KVersitTokenVERSION()); pc++;
       
   301         pr->AddValEnumL( KNSmlvCalendarVer() );
       
   302 
       
   303         cap->AddDevInfPropLC(KVersitTokenUID()); pc++;
       
   304         cap->AddDevInfPropLC(KVersitTokenSUMMARY()); pc++;
       
   305         cap->AddDevInfPropLC(KVersitTokenDESCRIPTION()); pc++;
       
   306         cap->AddDevInfPropLC(KVersitTokenDTEND()); pc++;
       
   307         cap->AddDevInfPropLC(KVersitTokenDTSTART()); pc++;
       
   308 
       
   309         pr = cap->AddDevInfPropLC(KVersitTokenAALARM()); pc++;
       
   310 
       
   311         pr = cap->AddDevInfPropLC(KVersitTokenCLASS()); pc++;
       
   312         pr->AddValEnumL(KVCalTokenPUBLIC8());
       
   313         pr->AddValEnumL(KVCalTokenPRIVATE8());
       
   314         pr->AddValEnumL(KVCalTokenCONFIDENTIAL8());
       
   315 
       
   316         cap->AddDevInfPropLC(KVersitTokenCOMPLETED()); pc++;
       
   317         cap->AddDevInfPropLC(KVersitTokenLOCATION()); pc++;
       
   318         cap->AddDevInfPropLC(KVersitTokenDCREATED()); pc++;
       
   319         cap->AddDevInfPropLC(KVersitTokenLASTMODIFIED()); pc++;
       
   320         cap->AddDevInfPropLC(KVersitTokenPRIORITY()); pc++;
       
   321         cap->AddDevInfPropLC(KVersitTokenSTATUS()); pc++;
       
   322         cap->AddDevInfPropLC(KVersitTokenRRULE()); pc++;
       
   323         cap->AddDevInfPropLC(KVersitTokenDUE()); pc++;
       
   324         cap->AddDevInfPropLC(KVersitTokenEXDATE()); pc++;
       
   325         cap->AddDevInfPropLC(KVersitVarTokenXEPOCAGENDAENTRYTYPE()); pc++;
       
   326         
       
   327         CleanupStack::PopAndDestroy( pc );
       
   328 		}
       
   329 		
       
   330 	aResultCode = KErrNone;
       
   331 	CleanupStack::Pop(); // dbCaps
       
   332 	
       
   333 	return dbCaps;
       
   334 	}
       
   335 	
       
   336 // ------------------------------------------------------------------------------------------------
       
   337 // CNSmlDSHostClient::ListStoresL
       
   338 // Creates list of Data Store names of Data Provider.
       
   339 // ------------------------------------------------------------------------------------------------	
       
   340 EXPORT_C void CNSmlDSHostClient::ListStoresL( CDesCArray* aNameList, const TSmlDataProviderId aId, TInt& aResultCode )
       
   341 	{
       
   342 	if ( aId == KContacts.iUid )
       
   343 		{
       
   344 		aNameList->AppendL( KNSmlUnicodeContactsLocalDbName );
       
   345 		}
       
   346 	else if ( aId == KAgenda.iUid )
       
   347 		{
       
   348 		aNameList->AppendL( KNSmlUnicodeAgenda1LocalDbName );
       
   349 		aNameList->AppendL( KNSmlUnicodeAgenda2LocalDbName );
       
   350 		}
       
   351 	else if ( aId == KEmpty1.iUid )
       
   352 		{
       
   353 		aNameList->AppendL( KNSmlUnicodeEmpty1LocalDbName );
       
   354 		}
       
   355 	else 
       
   356 		{
       
   357 		aNameList->AppendL( KNSmlUnicodeEmpty2LocalDbName );
       
   358 		}
       
   359 		
       
   360 	aResultCode = KErrNone;
       
   361 	}
       
   362 
       
   363 // ------------------------------------------------------------------------------------------------
       
   364 // CNSmlDSHostClient::DefaultStoreL
       
   365 // Creates default name for Data Store of Data Provider.
       
   366 // ------------------------------------------------------------------------------------------------	
       
   367 EXPORT_C HBufC* CNSmlDSHostClient::DefaultStoreL( const TSmlDataProviderId aId, TInt& aResultCode )
       
   368 	{
       
   369 	HBufC* storeName;
       
   370 	
       
   371 	if ( aId == KContacts.iUid )
       
   372 		{
       
   373 		storeName = KNSmlUnicodeContactsLocalDbName().AllocL();
       
   374 		}
       
   375 	else if ( aId == KAgenda.iUid )
       
   376 		{
       
   377 		storeName = KNSmlUnicodeAgenda1LocalDbName().AllocL();
       
   378 		}
       
   379 	else if ( aId == KEmpty1.iUid )
       
   380 		{
       
   381 		storeName = KNSmlUnicodeEmpty1LocalDbName().AllocL();
       
   382 		}
       
   383 	else
       
   384 		{
       
   385 		storeName = KNSmlUnicodeEmpty2LocalDbName().AllocL();
       
   386 		}
       
   387 		
       
   388 	aResultCode = KErrNone;
       
   389 	
       
   390 	return storeName;
       
   391 	}
       
   392 
       
   393 // ------------------------------------------------------------------------------------------------
       
   394 // CNSmlDSHostClient::SupportedServerFiltersL
       
   395 // This method returns the set of filters that can be used to send to the Sync Partner.
       
   396 // ------------------------------------------------------------------------------------------------	
       
   397 EXPORT_C const RPointerArray<RSmlFilterDef> CNSmlDSHostClient::SupportedServerFiltersL( const TSmlDataProviderId /*aId*/, TInt& aResultCode ) const
       
   398 	{
       
   399 	aResultCode = KErrNone;
       
   400 	}
       
   401 
       
   402 // ------------------------------------------------------------------------------------------------
       
   403 // CNSmlDSHostClient::SupportedServerFiltersL
       
   404 // This method returns the set of filters that can be used to send to the Sync Partner.
       
   405 // ------------------------------------------------------------------------------------------------	
       
   406 EXPORT_C const RPointerArray<RSmlFilterDef> CNSmlDSHostClient::SupportedServerFiltersL( const CNSmlDbCaps& /*aServerDataStoreFormat*/, const TSmlDataProviderId /*aId*/, TInt& aResultCode ) const
       
   407 	{
       
   408 	aResultCode = KErrNone;
       
   409 	}
       
   410 	
       
   411 // ------------------------------------------------------------------------------------------------
       
   412 // CNSmlDSHostClient::GenerateRecordFilterQueryLC
       
   413 // This method generates a record filter query to be sent to the SyncML server for the provided filter.
       
   414 // ------------------------------------------------------------------------------------------------	
       
   415 EXPORT_C HBufC* CNSmlDSHostClient::GenerateRecordFilterQueryLC( const RSmlFilter& /*aFilter*/, TDes& /*aFilterMimeType*/, TDes& /*aFilterMimeVersion*/, const TSmlDataProviderId /*aId*/, TInt& aResultCode ) const
       
   416 	{
       
   417 	aResultCode = KErrNone;
       
   418 	}
       
   419 
       
   420 // ------------------------------------------------------------------------------------------------
       
   421 // CNSmlDSHostClient::GenerateFieldFilterQueryL
       
   422 // This method generates a field filter query to be sent to the SyncML server for the provided filter.
       
   423 // ------------------------------------------------------------------------------------------------	
       
   424 EXPORT_C void CNSmlDSHostClient::GenerateFieldFilterQueryL( const RSmlFilter& /*aFilter*/, RPointerArray<CSmlDataProperty>& /*aProperties*/, const TSmlDataProviderId /*aId*/, TInt& aResultCode ) const
       
   425 	{
       
   426 	aResultCode = KErrNone;
       
   427 	}
       
   428 
       
   429 EXPORT_C void CNSmlDSHostClient::GetFilterL( const TSmlDataProviderId aId, const TDesC& aStoreName, const RPointerArray<CSyncMLFilter>& aFilterArray, CNSmlFilter*& aFilter, TSyncMLFilterMatchType aMatchType, TInt& aResultCode )
       
   430     {
       
   431     aFilter->SetFilterMetaTypeL( _L8( "METATYPE" ) );
       
   432     aFilter->SetFilterTypeL( _L8( "EXCLUSIVE" ) );
       
   433     aFilter->SetRecordL( _L8( "RECORD METATYPE" ) , _L8( "RECORD DATA" ) );
       
   434     aFilter->SetFieldMetaTypeL( _L8( "FIELD METATYPE" ) );
       
   435     
       
   436     aResultCode = KErrNone;    
       
   437     }
       
   438 
       
   439 // ------------------------------------------------------------------------------------------------
       
   440 // CNSmlDSHostClient::OpenL
       
   441 // Opens the data store specified by aStoreName asynchronously.
       
   442 // ------------------------------------------------------------------------------------------------	
       
   443 EXPORT_C void CNSmlDSHostClient::OpenL( const TSmlDataProviderId aId, const TDesC& /*aStoreName*/, const TDesC& /*aServerId*/, const TDesC& /*aRemoteDB*/, TInt& aResultCode )
       
   444 	{
       
   445 	if ( aId == KUidNotValid.iUid )
       
   446 		{
       
   447 		aResultCode = KErrNotFound;
       
   448 		}
       
   449 	else
       
   450 		{
       
   451 		aResultCode = KErrNone;
       
   452 		}
       
   453 	}
       
   454 
       
   455 // ------------------------------------------------------------------------------------------------
       
   456 // CNSmlDSHostClient::CancelRequestL
       
   457 // Cancel the current asynchronous request.
       
   458 // ------------------------------------------------------------------------------------------------	
       
   459 IMPORT_C void CNSmlDSHostClient::CancelRequestL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   460 	{
       
   461 	aResultCode = KErrNone;
       
   462 	}
       
   463 
       
   464 // ------------------------------------------------------------------------------------------------
       
   465 // CNSmlDSHostClient::BeginTransactionL
       
   466 // Starts the transaction mode.
       
   467 // ------------------------------------------------------------------------------------------------	
       
   468 EXPORT_C void CNSmlDSHostClient::BeginTransactionL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   469 	{
       
   470 	aResultCode = KErrNone;
       
   471 	}
       
   472 
       
   473 // ------------------------------------------------------------------------------------------------
       
   474 // CNSmlDSHostClient::CommitTransactionL
       
   475 // Method will be called at the end of a successful transaction.
       
   476 // ------------------------------------------------------------------------------------------------	
       
   477 EXPORT_C void CNSmlDSHostClient::CommitTransactionL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   478 	{
       
   479 	aResultCode = KErrNone;
       
   480 	}
       
   481 
       
   482 // ------------------------------------------------------------------------------------------------
       
   483 // CNSmlDSHostClient::RevertTransactionL
       
   484 // Method will be called to abort an ongoing transaction.
       
   485 // ------------------------------------------------------------------------------------------------	
       
   486 EXPORT_C void CNSmlDSHostClient::RevertTransactionL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   487 	{
       
   488 	aResultCode = KErrNone;
       
   489 	}
       
   490 
       
   491 // ------------------------------------------------------------------------------------------------
       
   492 // CNSmlDSHostClient::BeginBatchL
       
   493 // Starts the batch mode.
       
   494 // ------------------------------------------------------------------------------------------------	
       
   495 EXPORT_C void CNSmlDSHostClient::BeginBatchL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   496 	{
       
   497 	aResultCode = KErrNone;
       
   498 	iBatchMode = ETrue;
       
   499 	}
       
   500 	
       
   501 // ------------------------------------------------------------------------------------------------
       
   502 // CNSmlDSHostClient::CommitBatchL
       
   503 // Method will be called at the end of the batch mode.
       
   504 // ------------------------------------------------------------------------------------------------	
       
   505 EXPORT_C void CNSmlDSHostClient::CommitBatchL( RArray<TInt>& aResultArray, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   506 	{	
       
   507 	iBatchMode = EFalse;
       
   508 	TBool lastOpSucceeded( EFalse );
       
   509 	
       
   510 	// make batch fail
       
   511 	if ( iBatchCount == KMakeBatchFail )
       
   512 		{
       
   513 		aResultCode = KErrGeneral;
       
   514 		return;
       
   515 		}
       
   516 	
       
   517 	for ( TInt i = 0; i < iBatchCount; i++ )
       
   518 		{
       
   519 /*		TTime time;
       
   520 		time.HomeTime();
       
   521 		TInt64 seed = time.Int64();
       
   522 		
       
   523 		TInt result = Math::Rand( seed ) % 2 + 1;
       
   524 		aResultArray.Append( result );*/
       
   525 /*		if ( lastOpSucceeded )
       
   526 			{
       
   527 			aResultArray.Append( KErrNotFound );
       
   528 			lastOpSucceeded = EFalse;
       
   529 			}
       
   530 		else
       
   531 			{
       
   532 			aResultArray.Append( KErrNone );
       
   533 			lastOpSucceeded = ETrue;
       
   534 			}*/
       
   535 			aResultArray.Append( iBatchResults[i] );
       
   536 		}
       
   537 		
       
   538 	iBatchMode = EFalse;
       
   539 	iBatchResults.Reset();
       
   540 	
       
   541 	aResultCode = KErrNone;
       
   542 	}
       
   543 
       
   544 // ------------------------------------------------------------------------------------------------
       
   545 // CNSmlDSHostClient::CancelBatchL
       
   546 // Method will be called to abort an ongoing batch mode.
       
   547 // ------------------------------------------------------------------------------------------------	
       
   548 EXPORT_C void CNSmlDSHostClient::CancelBatchL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   549 	{
       
   550 	aResultCode = KErrNone;
       
   551 	iBatchMode = EFalse;
       
   552 	iBatchResults.Reset();
       
   553 	}
       
   554 	
       
   555 // ------------------------------------------------------------------------------------------------
       
   556 // CNSmlDSHostClient::SetRemoteDataStoreFormatL
       
   557 // Sets the Sync Partner Data Format.
       
   558 // ------------------------------------------------------------------------------------------------	
       
   559 EXPORT_C void CNSmlDSHostClient::SetRemoteDataStoreFormatL( const CNSmlDbCaps& /*aServerDataStoreFormat*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   560 	{
       
   561 	aResultCode = KErrNone;
       
   562 	}
       
   563 	
       
   564 // ------------------------------------------------------------------------------------------------
       
   565 // CNSmlDSHostClient::SetRemoteMaxObjectSizeL
       
   566 // Sets the SyncML server Sync Partner maximum object size.
       
   567 // ------------------------------------------------------------------------------------------------	
       
   568 EXPORT_C void CNSmlDSHostClient::SetRemoteMaxObjectSizeL( TInt /*aServerMaxObjectSize*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   569 	{
       
   570 	aResultCode = KErrNone;
       
   571 	}
       
   572 	
       
   573 // ------------------------------------------------------------------------------------------------
       
   574 // CNSmlDSHostClient::MaxObjectSizeL
       
   575 // Gets the Data Store maximum object size which is reported to the SyncML partner.
       
   576 // ------------------------------------------------------------------------------------------------	
       
   577 EXPORT_C TInt CNSmlDSHostClient::MaxObjectSizeL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   578 	{
       
   579 	aResultCode = KErrNone;
       
   580 	return KNSmlMaxObjSize;
       
   581 	}	
       
   582 
       
   583 // ------------------------------------------------------------------------------------------------
       
   584 // CNSmlDSHostClient::OpenItemL
       
   585 // Opens item at Data Store.
       
   586 // ------------------------------------------------------------------------------------------------	
       
   587 EXPORT_C void CNSmlDSHostClient::OpenItemL( TSmlDbItemUid aUid, TBool& aFieldChange, TInt& aSize, TSmlDbItemUid& aParent, HBufC8*& aMimeType, HBufC8*& aMimeVer, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   588 	{
       
   589 	if ( aUid == KContacts.iUid )
       
   590 		{
       
   591 		aFieldChange = EFalse;	
       
   592 		aSize = KItemSize;
       
   593 		aParent = KNullDataItemId;
       
   594 		aMimeType = KNSmlvCard21Name().AllocL();
       
   595 		aMimeVer = KNSmlvCard21Ver().AllocL();
       
   596 		}
       
   597 	else
       
   598 		{
       
   599 		aFieldChange = EFalse;	
       
   600 		aSize = KItemSize;
       
   601 		aParent = KNullDataItemId;
       
   602 		aMimeType = KNSmlvCalendar().AllocL();
       
   603 		aMimeVer = KNSmlvCalendarVer().AllocL();
       
   604 		}
       
   605 	
       
   606 	aResultCode = KErrNone;
       
   607 	}
       
   608 
       
   609 // ------------------------------------------------------------------------------------------------
       
   610 // CNSmlDSHostClient::CreateItemL
       
   611 // Creates new item to Data Store.
       
   612 // ------------------------------------------------------------------------------------------------	
       
   613 EXPORT_C void CNSmlDSHostClient::CreateItemL( TSmlDbItemUid& aUid, TInt /*aSize*/, TSmlDbItemUid aParent, const TDesC8& aMimeType, const TDesC8& /*aMimeVer*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   614 	{
       
   615 	
       
   616 	if ( aMimeType.Find( _L8("invalid") ) != KErrNotFound )
       
   617 		{
       
   618 		aResultCode = KErrNotSupported;
       
   619 		return;
       
   620 		}
       
   621 		
       
   622 	if ( aParent == KInvalidParent )
       
   623 		{
       
   624 		aResultCode = KErrPathNotFound;
       
   625 		return;
       
   626 		}
       
   627 		
       
   628 	TTime time;
       
   629 	time.HomeTime();
       
   630 	TInt64 seed = time.Int64();
       
   631 	
       
   632 	aUid = Math::Rand( seed ) % 4096 + 1;
       
   633 	
       
   634 	if ( iBatchMode )
       
   635 		{
       
   636 		++iBatchCount;
       
   637 		aResultCode = KErrNone;
       
   638 		
       
   639 		if ( aParent == KInvalidParent )
       
   640 			{
       
   641 			iBatchResults.Append( KErrPathNotFound );
       
   642 			}
       
   643 		else
       
   644 			{
       
   645 			iBatchResults.Append( KErrNone );
       
   646 			}
       
   647 		}
       
   648 	else
       
   649 		{
       
   650 		if ( aParent == KInvalidParent )
       
   651 			{
       
   652 			aResultCode = KErrPathNotFound;
       
   653 			}
       
   654 		else
       
   655 			{
       
   656 			aResultCode = KErrNone;
       
   657 			}
       
   658 		}
       
   659 	}
       
   660 	
       
   661 // ------------------------------------------------------------------------------------------------
       
   662 // CNSmlDSHostClient::ReplaceItemL
       
   663 // Replaces old item at Data Store.
       
   664 // ------------------------------------------------------------------------------------------------	
       
   665 EXPORT_C void CNSmlDSHostClient::ReplaceItemL( TSmlDbItemUid aUid, TInt /*aSize*/, TSmlDbItemUid aParent, TBool aFieldChange, TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   666 	{
       
   667 	if ( iBatchMode )
       
   668 		{
       
   669 		++iBatchCount;
       
   670 		
       
   671 		if ( aUid == KFailReplaceUid )
       
   672 			{
       
   673 			iBatchResults.Append( KErrNotFound );
       
   674 			}
       
   675 		else if ( aUid == KFieldLevelReplace && !aFieldChange )
       
   676 			{
       
   677 			iBatchResults.Append( KErrNotFound );
       
   678 			}
       
   679 		else if ( aUid != KFieldLevelReplace && aFieldChange )
       
   680 			{
       
   681 			iBatchResults.Append( KErrNotFound );
       
   682 			}
       
   683 		else
       
   684 			{
       
   685 			iBatchResults.Append( KErrNone );
       
   686 			}
       
   687 
       
   688 		aResultCode = KErrNone;
       
   689 		
       
   690 		return;
       
   691 		}
       
   692 
       
   693 	// make replace to fail for testing purposes
       
   694 	if ( aUid == KFailReplaceUid )
       
   695 		{
       
   696 		aResultCode = KErrNotFound;
       
   697 		}
       
   698 	else if ( aUid == KFieldLevelReplace && !aFieldChange )
       
   699 		{
       
   700 		aResultCode = KErrNotFound;
       
   701 		}
       
   702 	else if ( aUid != KFieldLevelReplace && aFieldChange )
       
   703 		{
       
   704 		aResultCode = KErrNotFound;
       
   705 		}
       
   706 	else
       
   707 		{
       
   708 		if ( aParent == KInvalidParent )
       
   709 			{
       
   710 			aResultCode = KErrPathNotFound;
       
   711 			}
       
   712 		else
       
   713 			{
       
   714 			aResultCode = KErrNone;
       
   715 			}
       
   716 		}				
       
   717 	}
       
   718 
       
   719 // ------------------------------------------------------------------------------------------------
       
   720 // CNSmlDSHostClient::ReadItemL
       
   721 // Reads data from item at Data Store. Item must be opened before this method can be called.
       
   722 // This method is called until aBuffer is not used totally or method leaves with KErrEof.
       
   723 // ------------------------------------------------------------------------------------------------	
       
   724 EXPORT_C void CNSmlDSHostClient::ReadItemL( TDes8& aBuffer, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   725 	{
       
   726 	for ( TInt i = 0; i < aBuffer.MaxSize(); i++ )
       
   727 		{
       
   728 		if ( iReadCount == 0 )
       
   729 			{
       
   730 			aBuffer.Append( 'X' );
       
   731 			}
       
   732 		else
       
   733 			{
       
   734 			aBuffer.Append( 'Y' );
       
   735 			}
       
   736 		}
       
   737 		
       
   738 	++iReadCount;
       
   739 	aResultCode = KErrNone;
       
   740 	}
       
   741 		
       
   742 // ------------------------------------------------------------------------------------------------
       
   743 // CNSmlDSHostClient::WriteItemL
       
   744 // Writes data to item to Data Provider. CreateItemL or ReplaceItemL method must be called before
       
   745 // this method can be called. This method is called until all data to current item is written.
       
   746 // ------------------------------------------------------------------------------------------------	
       
   747 EXPORT_C void CNSmlDSHostClient::WriteItemL( const TDesC8& aData, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   748 	{
       
   749 	RFs fSession;
       
   750 	RFile file;
       
   751 	
       
   752 	User::LeaveIfError( fSession.Connect() );
       
   753 	TInt result = file.Open( fSession, KReceivedDataFile, EFileWrite|EFileShareAny );
       
   754 	
       
   755 	if ( result == KErrNotFound )
       
   756 		{
       
   757 		file.Create( fSession, KReceivedDataFile, EFileWrite|EFileShareAny );
       
   758 		}
       
   759 
       
   760 	TInt pos( 0 );
       
   761 	file.Seek( ESeekEnd, pos );
       
   762 	file.Write( KWriteSeparator );
       
   763 	file.Write( aData );
       
   764 			
       
   765 	file.Close();
       
   766 	fSession.Close();
       
   767 	
       
   768 	if ( iBatchMode )
       
   769 		{
       
   770 		++iBatchCount;
       
   771 		iBatchResults.Append( KErrNone );
       
   772 		}
       
   773 		
       
   774 	aResultCode = KErrNone;
       
   775 	}
       
   776 	
       
   777 // ------------------------------------------------------------------------------------------------
       
   778 // CNSmlDSHostClient::CommitItemL
       
   779 // After item is written to Data Provider it can be saved to the Data Store.
       
   780 // This method can be called just after WriteItemL method.
       
   781 // ------------------------------------------------------------------------------------------------	
       
   782 EXPORT_C void CNSmlDSHostClient::CommitItemL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   783 	{
       
   784 	if ( iBatchMode )
       
   785 		{
       
   786 		++iBatchCount;
       
   787 		iBatchResults.Append( KErrNone );
       
   788 		}
       
   789 
       
   790 	aResultCode = KErrNone;
       
   791 	}
       
   792 	
       
   793 // ------------------------------------------------------------------------------------------------
       
   794 // CNSmlDSHostClient::CloseItemL
       
   795 // Closes opened item.
       
   796 // ------------------------------------------------------------------------------------------------	
       
   797 EXPORT_C void CNSmlDSHostClient::CloseItemL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   798 	{
       
   799 	aResultCode = KErrNone;
       
   800 	}
       
   801 	
       
   802 // ------------------------------------------------------------------------------------------------
       
   803 // CNSmlDSHostClient::MoveItemL
       
   804 // Moves item to new location.
       
   805 // ------------------------------------------------------------------------------------------------	
       
   806 EXPORT_C void CNSmlDSHostClient::MoveItemL( TSmlDbItemUid aUid, TSmlDbItemUid aNewParent, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   807 	{
       
   808 	if ( iBatchMode )
       
   809 		{
       
   810 		++iBatchCount;
       
   811 		
       
   812 		if ( aUid == KFailMoveUid )
       
   813 			{
       
   814 			iBatchResults.Append( KErrNotFound );
       
   815 			}
       
   816 		else
       
   817 			{
       
   818 			iBatchResults.Append( KErrNone );
       
   819 			}
       
   820 			
       
   821 		aResultCode = KErrNone;
       
   822 
       
   823 		return;
       
   824 		}
       
   825 		
       
   826 	// make move to fail for testing purposes
       
   827 	if ( aUid == KFailMoveUid )
       
   828 		{
       
   829 		aResultCode = KErrNotFound;
       
   830 		}
       
   831 	else
       
   832 		{
       
   833 		if ( aNewParent == KInvalidParent )
       
   834 			{
       
   835 			aResultCode = KErrPathNotFound;
       
   836 			}
       
   837 		else
       
   838 			{
       
   839 			aResultCode = KErrNone;
       
   840 			}
       
   841 		}
       
   842 	}
       
   843 		
       
   844 // ------------------------------------------------------------------------------------------------
       
   845 // CNSmlDSHostClient::DeleteItemL
       
   846 // Deletes one item at Data Store permanently.
       
   847 // ------------------------------------------------------------------------------------------------	
       
   848 EXPORT_C void CNSmlDSHostClient::DeleteItemL( TSmlDbItemUid aUid, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   849 	{
       
   850 	if ( iBatchMode )
       
   851 		{
       
   852 		++iBatchCount;
       
   853 		
       
   854 		if ( aUid == KFailDeleteUid )
       
   855 			{
       
   856 			iBatchResults.Append( KErrNotFound );
       
   857 			}
       
   858 		else
       
   859 			{
       
   860 			iBatchResults.Append( KErrNone );
       
   861 			}
       
   862 
       
   863 		aResultCode = KErrNone;
       
   864 		
       
   865 		return;
       
   866 		}
       
   867 
       
   868 	// make delete to fail for testing purposes
       
   869 	if ( aUid == KFailDeleteUid )
       
   870 		{
       
   871 		aResultCode = KErrNotFound;
       
   872 		}
       
   873 	else
       
   874 		{
       
   875 		aResultCode = KErrNone;
       
   876 		}
       
   877 	}
       
   878 	
       
   879 // ------------------------------------------------------------------------------------------------
       
   880 // CNSmlDSHostClient::SoftDeleteItemL
       
   881 // Soft deletes one item at Data Store.
       
   882 // ------------------------------------------------------------------------------------------------	
       
   883 EXPORT_C void CNSmlDSHostClient::SoftDeleteItemL( TSmlDbItemUid /*aUid*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   884 	{
       
   885 	if ( iBatchMode )
       
   886 		{
       
   887 		++iBatchCount;
       
   888 		iBatchResults.Append( KErrNone );
       
   889 		}
       
   890 
       
   891 	aResultCode = KErrNone;
       
   892 	}
       
   893 	
       
   894 // ------------------------------------------------------------------------------------------------
       
   895 // CNSmlDSHostClient::DeleteAllItemsL
       
   896 // Deletes all items at Data Store permanently.
       
   897 // ------------------------------------------------------------------------------------------------	
       
   898 EXPORT_C void CNSmlDSHostClient::DeleteAllItemsL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   899 	{
       
   900 	aResultCode = KErrNone;
       
   901 	}
       
   902 
       
   903 // ------------------------------------------------------------------------------------------------
       
   904 // CNSmlDSHostClient::HasSyncHistoryL
       
   905 // Checks if the Data Store has sync history. If not then slow sync is proposed to Sync Partner.
       
   906 // ------------------------------------------------------------------------------------------------	
       
   907 EXPORT_C TBool CNSmlDSHostClient::HasSyncHistoryL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   908 	{
       
   909 	aResultCode = KErrNone;
       
   910 	return EFalse;
       
   911 	}
       
   912 	
       
   913 // ------------------------------------------------------------------------------------------------
       
   914 // CNSmlDSHostClient::AddedItemsL
       
   915 // The Data Provider returns UIDs of items that are added after previous synchronization.
       
   916 // If the Data Provider uses hierarchical synchronization then added folders must be placed
       
   917 // first (from root to leaves) to UID set and finally items.
       
   918 // ------------------------------------------------------------------------------------------------	
       
   919 EXPORT_C void CNSmlDSHostClient::AddedItemsL( RNSmlDbItemModificationSet& /*aUidSet*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   920 	{
       
   921 	aResultCode = KErrNone;
       
   922 	}
       
   923 	
       
   924 // ------------------------------------------------------------------------------------------------
       
   925 // CNSmlDSHostClient::DeletedItemsL
       
   926 // The Data Provider returns UIDs of items that are deleted after previous synchronization.
       
   927 // If the Data Provider uses hierarchical synchronization then deleted items must be placed
       
   928 // first to UID set and folders after items (from leaves to root).
       
   929 // ------------------------------------------------------------------------------------------------	
       
   930 EXPORT_C void CNSmlDSHostClient::DeletedItemsL( RNSmlDbItemModificationSet& /*aUidSet*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   931 	{
       
   932 	aResultCode = KErrNone;
       
   933 	}
       
   934 
       
   935 // ------------------------------------------------------------------------------------------------
       
   936 // CNSmlDSHostClient::SoftDeleteItemsL
       
   937 // The Data Provider returns UIDs of items that are soft deleted after previous synchronization.
       
   938 // If the Data Provider uses hierarchical synchronization then soft deleted items must be placed
       
   939 // first to UID set and folders after items (from leaves to root).
       
   940 // ------------------------------------------------------------------------------------------------	
       
   941 EXPORT_C void CNSmlDSHostClient::SoftDeleteItemsL( RNSmlDbItemModificationSet& /*aUidSet*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   942 	{
       
   943 	aResultCode = KErrNone;
       
   944 	}
       
   945 
       
   946 // ------------------------------------------------------------------------------------------------
       
   947 // CNSmlDSHostClient::ModifiedItemsL
       
   948 // The Data Provider returns UIDs of items that are modified after previous synchronization.
       
   949 // If the Data Provider uses hierarchical synchronization then modified folders must be placed
       
   950 // first (from root to leaves) to UID set and finally items.
       
   951 // ------------------------------------------------------------------------------------------------	
       
   952 EXPORT_C void CNSmlDSHostClient::ModifiedItemsL( RNSmlDbItemModificationSet& /*aUidSet*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   953 	{
       
   954 	aResultCode = KErrNone;
       
   955 	}
       
   956 
       
   957 // ------------------------------------------------------------------------------------------------
       
   958 // CNSmlDSHostClient::MovedItemsL
       
   959 // The Data Provider returns UIDs of items that are moved after previous synchronization.
       
   960 // If the Data Provider uses hierarchical synchronization then moved folders must be placed
       
   961 // first (from root to leaves) to UID set and finally items.
       
   962 // ------------------------------------------------------------------------------------------------	
       
   963 EXPORT_C void CNSmlDSHostClient::MovedItemsL( RNSmlDbItemModificationSet& /*aUidSet*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode ) const
       
   964 	{
       
   965 	aResultCode = KErrNone;
       
   966 	}
       
   967 
       
   968 // ------------------------------------------------------------------------------------------------
       
   969 // CNSmlDSHostClient::AllItemsL
       
   970 // The Data Provider returns UIDs of items that are added, deleted, modified, softdeleted
       
   971 // or moved after previous synchronization.
       
   972 // ------------------------------------------------------------------------------------------------	
       
   973 EXPORT_C void CNSmlDSHostClient::AllItemsL( RNSmlDbItemModificationSet& aUidSet, const TSmlDataProviderId aId, const TDesC& aStoreName, TInt& aResultCode ) const
       
   974 	{
       
   975 	if ( aId == KAgenda.iUid )
       
   976 		{
       
   977 		if ( aStoreName == KNSmlUnicodeAgenda1LocalDbName )
       
   978 			{
       
   979 			TNSmlDbItemModification modification( 1, TNSmlDbItemModification::ENSmlDbItemAdd );
       
   980 			aUidSet.AddItem ( modification );
       
   981 			}
       
   982 		}
       
   983 
       
   984 	aResultCode = KErrNone;
       
   985 	}
       
   986 
       
   987 // ------------------------------------------------------------------------------------------------
       
   988 // CNSmlDSHostClient::ResetChangeInfoL
       
   989 // Reset change info from the Data Provider. The result of this method is that the Data Provider
       
   990 // sends just ADD commands to Sync Partner.
       
   991 // ------------------------------------------------------------------------------------------------	
       
   992 EXPORT_C void CNSmlDSHostClient::ResetChangeInfoL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
   993 	{
       
   994 	aResultCode = KErrNone;
       
   995 	}
       
   996 		
       
   997 // ------------------------------------------------------------------------------------------------
       
   998 // CNSmlDSHostClient::CommitChangeInfoL
       
   999 // This method is called after some changes are synchronized to Sync Partner. If some changes
       
  1000 // were synchronized correctly then those UIDs are included to aItems.
       
  1001 // ------------------------------------------------------------------------------------------------	
       
  1002 EXPORT_C void CNSmlDSHostClient::CommitChangeInfoL( MSmlDataItemUidSet& /*aItems*/, const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
  1003 	{
       
  1004 	aResultCode = KErrNone;
       
  1005 	}
       
  1006 
       
  1007 // ------------------------------------------------------------------------------------------------
       
  1008 // CNSmlDSHostClient::CommitChangeInfoL
       
  1009 // This method is called after some changes are synchronized to Sync Partner. This method is used if
       
  1010 // all changes were synchronized correctly.
       
  1011 // ------------------------------------------------------------------------------------------------	
       
  1012 EXPORT_C void CNSmlDSHostClient::CommitChangeInfoL( const TSmlDataProviderId /*aId*/, const TDesC& /*aStoreName*/, TInt& aResultCode )
       
  1013 	{
       
  1014 	aResultCode = KErrNone;
       
  1015 	}
       
  1016 
       
  1017 EXPORT_C TNSmlDPInformation* CNSmlDSHostClient::DataProviderInformationL( const TSmlDataProviderId /*aId*/, TInt& /*aResultCode*/ ) const
       
  1018 	{
       
  1019 	return NULL;
       
  1020 	}
       
  1021