30 #include "mylocationsdatabasemanager.h" |
30 #include "mylocationsdatabasemanager.h" |
31 #include "mylocationlogger.h" |
31 #include "mylocationlogger.h" |
32 #include "mylocationsdefines.h" |
32 #include "mylocationsdefines.h" |
33 |
33 |
34 #include <locationdatalookupdb.h> |
34 #include <locationdatalookupdb.h> |
35 |
35 #include <QString> |
36 // separator |
36 // separator |
37 _LIT( KSeparator, ","); |
37 _LIT( KSeparator, ","); |
38 // space |
38 // space |
39 _LIT( KSpace, " "); |
39 _LIT( KSpace, " "); |
40 |
40 |
286 lookupItem.mDestId = 0; |
286 lookupItem.mDestId = 0; |
287 lookupItem.mIconType = QLookupItem::EIconTypeDefault; |
287 lookupItem.mIconType = QLookupItem::EIconTypeDefault; |
288 lookupItem.mIsDuplicate = 0; |
288 lookupItem.mIsDuplicate = 0; |
289 lookupItem.mIconPath = ""; |
289 lookupItem.mIconPath = ""; |
290 lookupItem.mMapTilePath = ""; |
290 lookupItem.mMapTilePath = ""; |
291 |
291 lookupItem.mSingleLineAddress=""; |
|
292 TPtrC16 dataPtr; |
|
293 aLandmark->GetPositionField(EPositionFieldComment ,dataPtr); |
|
294 lookupItem.mSingleLineAddress=QString::fromUtf16(dataPtr.Ptr(), |
|
295 dataPtr.Length()); |
292 //fill address into lookup item. |
296 //fill address into lookup item. |
293 FillLookupItemAddressDetails( aLandmark, lookupItem ); |
297 FillLookupItemAddressDetails( aLandmark, lookupItem ); |
294 |
298 |
295 if ( aSourceType == ESourceLandmarks ) |
299 if ( aSourceType == ESourceLandmarks ) |
296 { |
300 { |
386 |
390 |
387 QLookupItem lookupItem; |
391 QLookupItem lookupItem; |
388 lookupItem.mSourceUid = aUid; |
392 lookupItem.mSourceUid = aUid; |
389 lookupItem.mSourceType = aSourceType; |
393 lookupItem.mSourceType = aSourceType; |
390 lookupItem.mIconType = QLookupItem::EIconTypeDefault; |
394 lookupItem.mIconType = QLookupItem::EIconTypeDefault; |
|
395 TPtrC16 dataPtr; |
|
396 aLandmark->GetPositionField(EPositionFieldComment ,dataPtr); |
|
397 lookupItem.mSingleLineAddress=QString::fromUtf16(dataPtr.Ptr(), |
|
398 dataPtr.Length()); |
391 |
399 |
392 // Behavior: If an entry is modified, |
400 // Behavior: If an entry is modified, |
393 // If this entry is not present in lookup table. add the entry and update the landmarks db. |
401 // If this entry is not present in lookup table. add the entry and update the landmarks db. |
394 // If this entry is already present in lookup table, check if the location info is modified or not. |
402 // If this entry is already present in lookup table, check if the location info is modified or not. |
395 // If the location info is modified, delete the landmark from db and add the new landmark |
403 // If the location info is modified, delete the landmark from db and add the new landmark |
738 // ----------------------------------------------------------------------------- |
746 // ----------------------------------------------------------------------------- |
739 // |
747 // |
740 void CMyLocationsDatabaseManager::HandleLandmarkModificationL( |
748 void CMyLocationsDatabaseManager::HandleLandmarkModificationL( |
741 CPosLandmark* aLandmark, const TUint32 aUid ) |
749 CPosLandmark* aLandmark, const TUint32 aUid ) |
742 { |
750 { |
|
751 __TRACE_CALLSTACK; |
743 // logic: if a landmark is modified, |
752 // logic: if a landmark is modified, |
744 // first update the corresponding landmark lookup entry if present, else create a new entry. |
753 // first update the corresponding landmark lookup entry if present, else create a new entry. |
745 // Check for any contact/calendar entries refering this landmark entry, |
754 // Check for any contact/calendar entries refering this landmark entry, |
746 // if exists, create a new landmark entry with that location details and update all those |
755 // if exists, create a new landmark entry with that location details and update all those |
747 // lookup entry's destid with the newly created landmark id. |
756 // lookup entry's destid with the newly created landmark id. |
844 // |
853 // |
845 EXPORT_C void CMyLocationsDatabaseManager::GetLandmarkFullAddress( |
854 EXPORT_C void CMyLocationsDatabaseManager::GetLandmarkFullAddress( |
846 TBuf<KMaxAddressLength>& aLandmarkAddress, |
855 TBuf<KMaxAddressLength>& aLandmarkAddress, |
847 const CPosLandmark* aLandmark) |
856 const CPosLandmark* aLandmark) |
848 { |
857 { |
|
858 __TRACE_CALLSTACK; |
849 TPtrC tempStr; |
859 TPtrC tempStr; |
850 TInt retStatus; |
860 TInt retStatus; |
851 TBool addressEmtpy = ETrue; |
861 TBool addressEmtpy = ETrue; |
852 retStatus = aLandmark->GetPositionField(EPositionFieldStreet, tempStr); |
862 retStatus = aLandmark->GetPositionField(EPositionFieldStreet, tempStr); |
853 if (retStatus == KErrNone && tempStr.Length()) |
863 if (retStatus == KErrNone && tempStr.Length()) |
993 // CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry() |
1003 // CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry() |
994 // ----------------------------------------------------------------------------- |
1004 // ----------------------------------------------------------------------------- |
995 // |
1005 // |
996 void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId ) |
1006 void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId ) |
997 { |
1007 { |
|
1008 __TRACE_CALLSTACK; |
998 // get next duplicate item |
1009 // get next duplicate item |
999 QList<QLookupItem> itemArray; |
1010 QList<QLookupItem> itemArray; |
1000 iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray ); |
1011 iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray ); |
1001 for ( int i = 0; i < itemArray.count(); i++) |
1012 for ( int i = 0; i < itemArray.count(); i++) |
1002 { |
1013 { |
1013 // CMyLocationsDatabaseManager::IsDuplicateEntry() |
1024 // CMyLocationsDatabaseManager::IsDuplicateEntry() |
1014 // ----------------------------------------------------------------------------- |
1025 // ----------------------------------------------------------------------------- |
1015 // |
1026 // |
1016 bool CMyLocationsDatabaseManager::IsDuplicateEntry( quint32 aLandmarkId ) |
1027 bool CMyLocationsDatabaseManager::IsDuplicateEntry( quint32 aLandmarkId ) |
1017 { |
1028 { |
|
1029 __TRACE_CALLSTACK; |
1018 // get next duplicate item |
1030 // get next duplicate item |
1019 QList<QLookupItem> itemArray; |
1031 QList<QLookupItem> itemArray; |
1020 iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray ); |
1032 iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray ); |
1021 for ( int i = 0; i < itemArray.count(); i++) |
1033 for ( int i = 0; i < itemArray.count(); i++) |
1022 { |
1034 { |
1075 // ----------------------------------------------------------------------------- |
1087 // ----------------------------------------------------------------------------- |
1076 // CMyLocationsDatabaseManager::UpdateMapTilePath() |
1088 // CMyLocationsDatabaseManager::UpdateMapTilePath() |
1077 // ----------------------------------------------------------------------------- |
1089 // ----------------------------------------------------------------------------- |
1078 // |
1090 // |
1079 EXPORT_C void CMyLocationsDatabaseManager::UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType, |
1091 EXPORT_C void CMyLocationsDatabaseManager::UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType, |
1080 TFileName aFilePath ) |
1092 TFileName& aFilePath ) |
1081 { |
1093 { |
|
1094 __TRACE_CALLSTACK; |
1082 QString filePath = QString( (QChar*)aFilePath.Ptr(), aFilePath.Length() ); |
1095 QString filePath = QString( (QChar*)aFilePath.Ptr(), aFilePath.Length() ); |
1083 iLocationAppLookupDb->updateMaptileBySourceIdAndType( aSourceId, aSourceType, filePath ); |
1096 iLocationAppLookupDb->updateMaptileBySourceIdAndType( aSourceId, aSourceType, filePath ); |
1084 } |
1097 } |
1085 |
1098 |
|
1099 // ----------------------------------------------------------------------------- |
|
1100 // CMyLocationsDatabaseManager::CheckIfAddressChanged() |
|
1101 // ----------------------------------------------------------------------------- |
|
1102 // |
|
1103 EXPORT_C TBool CMyLocationsDatabaseManager::CheckIfAddressChanged(const CPosLandmark& aLandmarks, |
|
1104 const TUint32 aId, const TUidSourceType aAddressType) |
|
1105 { |
|
1106 __TRACE_CALLSTACK; |
|
1107 QString target = iLocationAppLookupDb->getAddressDetails(aId, aAddressType); |
|
1108 TBuf<KMaxAddressLength> lmAddress; |
|
1109 GetLandmarkFullAddress(lmAddress, &aLandmarks); |
|
1110 QString source = QString((QChar*) lmAddress.Ptr(), lmAddress.Length()); |
|
1111 if (source == target) |
|
1112 { |
|
1113 return EFalse; |
|
1114 } |
|
1115 return ETrue; |
|
1116 |
|
1117 } |
|
1118 |
|
1119 // ----------------------------------------------------------------------------- |
|
1120 // CMyLocationsDatabaseManager::CheckIfAddressChanged() |
|
1121 // ----------------------------------------------------------------------------- |
|
1122 // |
|
1123 EXPORT_C TBool CMyLocationsDatabaseManager::CheckIfAddressChanged(const TDesC& aAddress, |
|
1124 const TUint32 aId, const TUidSourceType aAddressType) |
|
1125 { |
|
1126 __TRACE_CALLSTACK; |
|
1127 TBool compareStatus = ETrue; |
|
1128 QString target=iLocationAppLookupDb->getAddressDetails( aId , aAddressType ); |
|
1129 QString source = QString( (QChar*)aAddress.Ptr(), aAddress.Length()); |
|
1130 if( source == target ) |
|
1131 { |
|
1132 compareStatus= EFalse; |
|
1133 } |
|
1134 return compareStatus; |
|
1135 } |
|
1136 |
1086 // End of file |
1137 // End of file |