34 #include <SmlDataProvider.h> |
34 #include <SmlDataProvider.h> |
35 #include <e32property.h> |
35 #include <e32property.h> |
36 #include <DataSyncInternalPSKeys.h> |
36 #include <DataSyncInternalPSKeys.h> |
37 #include <nsmlcontactsdatastoreextension.h> |
37 #include <nsmlcontactsdatastoreextension.h> |
38 #include <NSmlDataModBase.h> |
38 #include <NSmlDataModBase.h> |
39 #include "NSmlContactsDataStore.h" |
39 #include <nsmlcontactsdatastore.h> |
40 #include "nsmldebug.h" |
40 #include "nsmldebug.h" |
41 #include "nsmlconstants.h" |
41 #include "nsmlconstants.h" |
42 #include "nsmldsimpluids.h" |
42 #include "nsmldsimpluids.h" |
43 #include "nsmlsnapshotitem.h" |
43 #include "nsmlsnapshotitem.h" |
44 #include "nsmlchangefinder.h" |
44 #include "nsmlchangefinder.h" |
777 CleanupStack::PushL( tempData ); |
777 CleanupStack::PushL( tempData ); |
778 |
778 |
779 _DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): CContactDatabase::ExportSelectedContactsL() begin"); |
779 _DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): CContactDatabase::ExportSelectedContactsL() begin"); |
780 |
780 |
781 TInt ret = KErrNone; |
781 TInt ret = KErrNone; |
782 TRAP( err, ret = iContactsDataStoreExtension->ExportContactsL( TUid::Uid(aUid), *tempData ) ); |
782 TRAP( err, ret = ExportContactsL( TUid::Uid(aUid), *tempData ) ); |
783 |
783 |
784 _DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): CContactDatabase::ExportSelectedContactsL() end"); |
784 _DBG_FILE("CNSmlContactsDataStore::DoReplaceItemL(): CContactDatabase::ExportSelectedContactsL() end"); |
785 CleanupStack::PopAndDestroy( tempData ); |
785 CleanupStack::PopAndDestroy( tempData ); |
786 |
786 |
787 if ( err || ret ) |
787 if ( err || ret ) |
1344 _DBG_FILE("CNSmlContactsDataStore::FetchItemL(): CContactDatabase::ExportSelectedContactsL() begin"); |
1344 _DBG_FILE("CNSmlContactsDataStore::FetchItemL(): CContactDatabase::ExportSelectedContactsL() begin"); |
1345 |
1345 |
1346 TInt err = KErrNone; |
1346 TInt err = KErrNone; |
1347 TInt ret = KErrNone; |
1347 TInt ret = KErrNone; |
1348 |
1348 |
1349 TRAP( err, ret = iContactsDataStoreExtension->ExportContactsL( TUid::Uid(aUid), aItem ) ); |
1349 TRAP( err, ret = ExportContactsL( TUid::Uid(aUid), aItem ) ); |
1350 |
1350 |
1351 if( ret != KErrNone ) |
1351 if( ret != KErrNone ) |
1352 { |
1352 { |
1353 DBG_ARGS(_S("CNSmlContactsDataStore::FetchItemL(): Error = %d"), ret); |
1353 DBG_ARGS(_S("CNSmlContactsDataStore::FetchItemL(): Error = %d"), ret); |
1354 err = ret; |
1354 err = ret; |
1388 |
1388 |
1389 HBufC8* buf = aItem.AllocLC(); |
1389 HBufC8* buf = aItem.AllocLC(); |
1390 StripPropertyL( buf, KVersitTokenUID() ); |
1390 StripPropertyL( buf, KVersitTokenUID() ); |
1391 |
1391 |
1392 CArrayFixFlat<TUid>* entryArray = NULL; |
1392 CArrayFixFlat<TUid>* entryArray = NULL; |
1393 TRAP( ret, entryArray = iContactsDataStoreExtension->ImportContactsL( *buf ) ); |
1393 TRAP( ret, entryArray = ImportContactsL( *buf ) ); |
1394 |
1394 |
1395 DBG_ARGS(_S("New item to database with return value: '%d'"), ret ); |
1395 DBG_ARGS(_S("New item to database with return value: '%d'"), ret ); |
1396 |
1396 |
1397 if( ret == KErrNone && entryArray != NULL ) |
1397 if( ret == KErrNone && entryArray != NULL ) |
1398 { |
1398 { |
1451 { |
1451 { |
1452 return KErrDiskFull; |
1452 return KErrDiskFull; |
1453 } |
1453 } |
1454 |
1454 |
1455 CArrayFixFlat<TUid>* entryArray = NULL; |
1455 CArrayFixFlat<TUid>* entryArray = NULL; |
1456 TRAP( ret, entryArray = iContactsDataStoreExtension->ImportContactsL( aItems->Ptr(0) ) ); |
1456 TRAP( ret, entryArray = ImportContactsL( aItems->Ptr( 0 ) ) ); |
1457 |
1457 |
1458 DBG_ARGS(_S("New items to database with return value: '%d'"), ret ); |
1458 DBG_ARGS(_S("New items to database with return value: '%d'"), ret ); |
1459 |
1459 |
1460 if( ret == KErrNone && entryArray != NULL) |
1460 if( ret == KErrNone && entryArray != NULL) |
1461 { |
1461 { |
1565 |
1565 |
1566 CleanupStack::PopAndDestroy( endPropBuf ); |
1566 CleanupStack::PopAndDestroy( endPropBuf ); |
1567 |
1567 |
1568 // TODO: Get it reviewed |
1568 // TODO: Get it reviewed |
1569 CArrayFixFlat<TUid>* entryArray = NULL; |
1569 CArrayFixFlat<TUid>* entryArray = NULL; |
1570 TRAP( ret, entryArray = iContactsDataStoreExtension->ImportContactsL( hItemPtr ) ); |
1570 TRAP( ret, entryArray = ImportContactsL( hItemPtr ) ); |
1571 |
1571 |
1572 if( ret == KErrNone && entryArray != NULL) |
1572 if( ret == KErrNone && entryArray != NULL) |
1573 { |
1573 { |
1574 CleanupStack::PushL( entryArray ); |
1574 CleanupStack::PushL( entryArray ); |
1575 if( !entryArray->Count() ) |
1575 if( !entryArray->Count() ) |
2075 |
2075 |
2076 _DBG_FILE("CNSmlContactsDataStore::DoExecuteBufferL(): ERROR end"); |
2076 _DBG_FILE("CNSmlContactsDataStore::DoExecuteBufferL(): ERROR end"); |
2077 return KErrGeneral; // All commands failed |
2077 return KErrGeneral; // All commands failed |
2078 } |
2078 } |
2079 |
2079 |
2080 |
|
2081 // ------------------------------------------------------------------------------------------------ |
|
2082 // CNSmlContactsDataStore::MergeL |
|
2083 // |
|
2084 // ------------------------------------------------------------------------------------------------ |
|
2085 EXPORT_C void CNSmlContactsDataStore::MergeL( CBufBase& aNewItem, CBufBase& aOldItem, TBool aFieldLevel ) |
|
2086 { |
|
2087 iDataMod->MergeRxL( aNewItem, aOldItem, aFieldLevel ); |
|
2088 } |
|
2089 |
|
2090 // ---------------------------------------------------------------------------- |
|
2091 // CNSmlContactsDataStore::StripTxL |
|
2092 // Strips data that is to be transmitted to the sync partner. |
|
2093 // ---------------------------------------------------------------------------- |
|
2094 EXPORT_C void CNSmlContactsDataStore::StripTxL( CBufBase& aItem ) |
|
2095 { |
|
2096 iDataMod->StripTxL( aItem ); |
|
2097 } |
|
2098 |
|
2099 // ------------------------------------------------------------------------------------------------ |
2080 // ------------------------------------------------------------------------------------------------ |
2100 // CNSmlContactsDataStore::FetchModificationsL |
2081 // CNSmlContactsDataStore::FetchModificationsL |
2101 // ------------------------------------------------------------------------------------------------ |
2082 // ------------------------------------------------------------------------------------------------ |
2102 // |
2083 // |
2103 TInt CNSmlContactsDataStore::FetchModificationsL() |
2084 TInt CNSmlContactsDataStore::FetchModificationsL() |
2152 EXPORT_C CNSmlDataModBase& CNSmlContactsDataStore::GetDataMod() |
2133 EXPORT_C CNSmlDataModBase& CNSmlContactsDataStore::GetDataMod() |
2153 { |
2134 { |
2154 return *iDataMod; |
2135 return *iDataMod; |
2155 } |
2136 } |
2156 |
2137 |
|
2138 // ---------------------------------------------------------------------------- |
|
2139 // CNSmlContactsDataStore::ExportContactsL |
|
2140 // ---------------------------------------------------------------------------- |
|
2141 EXPORT_C TInt CNSmlContactsDataStore::ExportContactsL( |
|
2142 const TUid& aUid, CBufBase& aContactBufBase ) |
|
2143 { |
|
2144 return iContactsDataStoreExtension->ExportContactsL( aUid, aContactBufBase ); |
|
2145 } |
|
2146 |
|
2147 // ---------------------------------------------------------------------------- |
|
2148 // CNSmlContactsDataStore::ImportContactsL |
|
2149 // ---------------------------------------------------------------------------- |
|
2150 EXPORT_C CArrayFixFlat<TUid>* CNSmlContactsDataStore::ImportContactsL( |
|
2151 const TDesC8& aContactBufBase ) |
|
2152 { |
|
2153 return iContactsDataStoreExtension->ImportContactsL( aContactBufBase ); |
|
2154 } |
|
2155 |
2157 // End of File |
2156 // End of File |