18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <f32file.h> |
20 #include <f32file.h> |
21 #include <calchangecallback.h> |
21 #include <calchangecallback.h> |
22 #include <cntitem.h> |
22 #include <cntitem.h> |
23 #include <CNTFLDST.H> |
23 #include <cntfldst.h> |
24 #include <EPos_CPosLmDatabaseManager.h> |
24 #include <EPos_CPosLmDatabaseManager.h> |
25 #include <lbsposition.h> |
25 #include <lbsposition.h> |
26 #include <bautils.h> |
26 #include <bautils.h> |
27 #include <f32file.h> |
27 #include <f32file.h> |
|
28 #include <locationservicedefines.h> |
28 #include "mylocationsengine.h" |
29 #include "mylocationsengine.h" |
29 #include "mylocationsdefines.h" |
30 #include "mylocationsdefines.h" |
30 #include "geocodeupdate.h" //header for CGeocodeUpdate class |
31 #include "geocodeupdate.h" //header for GeocodeUpdate class |
31 //handle for CMyLocationsHistoryDbObserver class |
32 //handle for CMyLocationsHistoryDbObserver class |
32 #include "mylocationlogger.h" |
33 #include "mylocationlogger.h" |
33 #if ( defined __WINSCW__ ) || ( defined __WINS__ ) |
34 #if ( defined __WINSCW__ ) || ( defined __WINS__ ) |
34 _LIT ( KImageStorageDrive, "C:\\Maptile\\"); |
35 _LIT ( KImageStorageDrive, "C:\\Maptile\\"); |
35 #endif |
36 #endif |
36 _LIT(KFolderName,":\\MapTile\\"); |
37 _LIT(KFolderName,":\\MapTile\\"); |
37 const TInt KImagePathSize=36; |
38 const TInt KImagePathSize=36; |
38 const TInt KBufSize=256; |
|
39 const TInt KDefaultFilePathSize = 20; |
39 const TInt KDefaultFilePathSize = 20; |
40 |
40 |
41 // separator |
41 // separator |
42 _LIT( KSeparator, ","); |
42 _LIT( KSeparator, ","); |
43 _LIT(KContactPrefered, "Contact Prefered"); |
|
44 _LIT(KContactHome, "Contact Home"); |
|
45 _LIT(KContactWork, "Contact Work"); |
|
46 _LIT(KPNGType, ".png"); |
43 _LIT(KPNGType, ".png"); |
47 _LIT(KSingleSpace, " "); |
44 _LIT(KSingleSpace, " "); |
48 |
45 |
49 // ============================ MEMBER FUNCTIONS =============================== |
46 // ============================ MEMBER FUNCTIONS =============================== |
50 |
47 |
94 |
89 |
95 iAddressCompare = CAddressComparision::NewL(); |
90 iAddressCompare = CAddressComparision::NewL(); |
96 |
91 |
97 MYLOCLOGSTRING(" start contact db observation "); |
92 MYLOCLOGSTRING(" start contact db observation "); |
98 StartContactsChangeNotifierL(); |
93 StartContactsChangeNotifierL(); |
99 MYLOCLOGSTRING(" start landmark db observation "); |
|
100 StartLandmarksChangeNotifier(); |
|
101 |
94 |
102 //set the folder path to store maptile |
95 //set the folder path to store maptile |
103 imageFilePath.Zero(); |
96 imageFilePath.Zero(); |
104 SetFolderPathL(); |
97 SetFolderPathL(); |
105 |
98 |
106 TInt status; |
99 TInt status; |
107 iCalSession = CCalSession::NewL(); |
100 iCalSession = CCalSession::NewL(); |
108 NotifyChangeL(status); |
101 NotifyChangeL(status); |
|
102 |
|
103 // Start listening to landmarks db changes |
|
104 StartLandmarksChangeNotifier(); |
109 |
105 |
110 } |
106 } |
111 // ----------------------------------------------------------------------------- |
107 // ----------------------------------------------------------------------------- |
112 // CMyLocationsEngine::SetFolderPath() |
108 // CMyLocationsEngine::SetFolderPath() |
113 // set folder path structure |
109 // set folder path structure |
205 // CMyLocationsEngine::CMyLocationsEngine() |
201 // CMyLocationsEngine::CMyLocationsEngine() |
206 // C++ default constructor can NOT contain any code, that might leave. |
202 // C++ default constructor can NOT contain any code, that might leave. |
207 // ----------------------------------------------------------------------------- |
203 // ----------------------------------------------------------------------------- |
208 // |
204 // |
209 CMyLocationsEngine::CMyLocationsEngine() : |
205 CMyLocationsEngine::CMyLocationsEngine() : |
210 CActive(EPriorityStandard), iCalSession(NULL), iCalView(NULL), iContactsDb( |
206 CActive(EPriorityStandard), |
211 NULL), iContactChangeNotifier(NULL), iLandmarkDb(NULL), |
207 iCalSession(NULL), iCalView(NULL), |
|
208 iContactsDb(NULL), iContactChangeNotifier(NULL), |
|
209 iLandmarkDb(NULL), |
212 iMapTileInterface(NULL), iMyLocationsDatabaseManager(NULL), |
210 iMapTileInterface(NULL), iMyLocationsDatabaseManager(NULL), |
213 iMaptileDatabase(NULL), iAddressCompare(NULL), |
211 iMaptileDatabase(NULL), iAddressCompare(NULL), |
214 iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL) |
212 iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL) |
215 { |
213 { |
216 |
214 |
344 __TRACE_CALLSTACK;// Resume event listening |
341 __TRACE_CALLSTACK;// Resume event listening |
345 iLandmarkDb->NotifyDatabaseEvent(iLmEvent, iStatus); |
342 iLandmarkDb->NotifyDatabaseEvent(iLmEvent, iStatus); |
346 SetActive(); |
343 SetActive(); |
347 } |
344 } |
348 |
345 |
349 |
|
350 // ----------------------------------------------------------------------------- |
346 // ----------------------------------------------------------------------------- |
351 // CMyLocationsEngine::CalChangeNotification() |
347 // CMyLocationsEngine::CalChangeNotification() |
352 // Callback when there is a change in the calendar database. |
348 // Callback when there is a change in the calendar database. |
353 // ----------------------------------------------------------------------------- |
349 // ----------------------------------------------------------------------------- |
354 // |
350 // |
355 |
351 |
356 void CMyLocationsEngine::CalChangeNotification( |
352 void CMyLocationsEngine::CalChangeNotification( |
357 RArray<TCalChangeEntry>& aChangeItems) |
353 RArray<TCalChangeEntry>& aChangeItems) |
358 { |
354 { |
359 __TRACE_CALLSTACK; |
355 __TRACE_CALLSTACK; |
360 |
356 |
361 if(iCalenderNotification) |
357 if(iCalenderNotification) |
362 { |
358 { |
363 delete iCalenderNotification; |
359 delete iCalenderNotification; |
364 iCalenderNotification = NULL; |
360 iCalenderNotification = NULL; |
365 } |
361 } |
394 { |
396 { |
395 TLookupItem lookupItem; |
397 TLookupItem lookupItem; |
396 lookupItem.iSource = ESourceCalendar; |
398 lookupItem.iSource = ESourceCalendar; |
397 lookupItem.iUid = calChangeEntry.iEntryId; |
399 lookupItem.iUid = calChangeEntry.iEntryId; |
398 TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem)); |
400 TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem)); |
|
401 |
|
402 TRAP_IGNORE( UpdateDatabaseL( NULL, |
|
403 calChangeEntry.iEntryId, ESourceCalendar, EEntryDeleted ) ); |
399 break; |
404 break; |
400 } |
405 } |
401 }; |
406 }; |
402 |
407 |
403 } |
408 } |
404 } |
409 } |
405 |
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CMyLocationsEngine::CalenderEntryAddedL() |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
406 void CMyLocationsEngine::CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry) |
415 void CMyLocationsEngine::CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry) |
407 { |
416 { |
408 __TRACE_CALLSTACK; |
417 __TRACE_CALLSTACK; |
409 CCalEntry* calEntry = NULL; |
418 CCalEntry* calEntry = NULL; |
410 calEntry = iCalView->FetchL(aCalChangeEntry.iEntryId); |
419 calEntry = iCalView->FetchL(aCalChangeEntry.iEntryId); |
472 { |
481 { |
473 if (aEvent.iType == EContactDbObserverEventContactChanged) |
482 if (aEvent.iType == EContactDbObserverEventContactChanged) |
474 { |
483 { |
475 // If the contact is a modified one and it might already exist in |
484 // If the contact is a modified one and it might already exist in |
476 // mylocations db, so delete it |
485 // mylocations db, so delete it |
477 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, |
486 UpdateDatabaseL(NULL, |
478 aEvent.iContactId, ESourceContactsPref, |
487 aEvent.iContactId, ESourceContactsPref, |
479 EEntryDeleted); |
488 EEntryDeleted); |
480 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, |
489 UpdateDatabaseL(NULL, |
481 aEvent.iContactId, ESourceContactsWork, |
490 aEvent.iContactId, ESourceContactsWork, |
482 EEntryDeleted); |
491 EEntryDeleted); |
483 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, |
492 UpdateDatabaseL(NULL, |
484 aEvent.iContactId, ESourceContactsHome, |
493 aEvent.iContactId, ESourceContactsHome, |
485 EEntryDeleted); |
494 EEntryDeleted); |
486 } |
495 } |
487 } |
496 } |
488 else |
497 else |
494 ESourceContactsPref, aEvent.iType); |
503 ESourceContactsPref, aEvent.iType); |
495 |
504 |
496 // if home address available, update Mylocations. |
505 // if home address available, update Mylocations. |
497 if (homeAddressLm) |
506 if (homeAddressLm) |
498 { |
507 { |
499 iMyLocationsDatabaseManager->UpdateDatabaseL(homeAddressLm, |
508 UpdateDatabaseL(homeAddressLm, |
500 aEvent.iContactId, ESourceContactsHome, changeType); |
509 aEvent.iContactId, ESourceContactsHome, changeType); |
501 CleanupStack::PopAndDestroy(homeAddressLm); |
510 CleanupStack::PopAndDestroy(homeAddressLm); |
502 } |
511 } |
503 |
512 |
504 // if work address available, update Mylocations. |
513 // if work address available, update Mylocations. |
505 if (workAddressLm) |
514 if (workAddressLm) |
506 { |
515 { |
507 iMyLocationsDatabaseManager->UpdateDatabaseL(workAddressLm, |
516 UpdateDatabaseL(workAddressLm, |
508 aEvent.iContactId, ESourceContactsWork, changeType); |
517 aEvent.iContactId, ESourceContactsWork, changeType); |
509 CleanupStack::PopAndDestroy(workAddressLm); |
518 CleanupStack::PopAndDestroy(workAddressLm); |
510 } |
519 } |
511 |
520 |
512 // if prefered address available, update Mylocations. |
521 // if prefered address available, update Mylocations. |
513 if (preferedAddressLm) |
522 if (preferedAddressLm) |
514 { |
523 { |
515 iMyLocationsDatabaseManager->UpdateDatabaseL( |
524 UpdateDatabaseL( |
516 preferedAddressLm, aEvent.iContactId, |
525 preferedAddressLm, aEvent.iContactId, |
517 ESourceContactsPref, changeType); |
526 ESourceContactsPref, changeType); |
518 CleanupStack::PopAndDestroy(preferedAddressLm); |
527 CleanupStack::PopAndDestroy(preferedAddressLm); |
519 } |
528 } |
520 |
529 |
527 else if (aEvent.iType == EContactDbObserverEventContactDeleted) |
536 else if (aEvent.iType == EContactDbObserverEventContactDeleted) |
528 { |
537 { |
529 // the contact is deleted, so delete the corresponding entries from database. |
538 // the contact is deleted, so delete the corresponding entries from database. |
530 |
539 |
531 // delete prefered address in database |
540 // delete prefered address in database |
532 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId, |
541 UpdateDatabaseL(NULL, aEvent.iContactId, |
533 ESourceContactsPref, EEntryDeleted); |
542 ESourceContactsPref, EEntryDeleted); |
534 |
543 |
535 // delete work address in database |
544 // delete work address in database |
536 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId, |
545 UpdateDatabaseL(NULL, aEvent.iContactId, |
537 ESourceContactsWork, EEntryDeleted); |
546 ESourceContactsWork, EEntryDeleted); |
538 |
547 |
539 // delete home address in database |
548 // delete home address in database |
540 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId, |
549 UpdateDatabaseL(NULL, aEvent.iContactId, |
541 ESourceContactsHome, EEntryDeleted); |
550 ESourceContactsHome, EEntryDeleted); |
542 } |
551 } |
543 } |
552 } |
544 |
553 |
545 // ----------------------------------------------------------------------------- |
554 // ----------------------------------------------------------------------------- |
552 { |
561 { |
553 __TRACE_CALLSTACK; |
562 __TRACE_CALLSTACK; |
554 TLookupItem lookupItem; |
563 TLookupItem lookupItem; |
555 lookupItem.iUid = aEvent.iContactId; |
564 lookupItem.iUid = aEvent.iContactId; |
556 // If contact is deleted delete from mylocations db |
565 // If contact is deleted delete from mylocations db |
557 /* if (aEvent.iType == EContactDbObserverEventContactDeleted) |
566 if (aEvent.iType == EContactDbObserverEventContactDeleted) |
558 { |
567 { |
559 MYLOCLOGSTRING("EContactDbObserverEventContactDeleted" ); |
568 lookupItem.iSource = ESourceContactsPref; |
560 // delete prefered address in database |
569 iMaptileDatabase->DeleteEntryL(lookupItem); |
561 lookupItem.iSource = ESourceContactsPref; |
570 |
562 FindEntryAndDeleteL(lookupItem); |
571 lookupItem.iSource = ESourceContactsWork; |
563 |
572 iMaptileDatabase->DeleteEntryL(lookupItem); |
564 lookupItem.iSource = ESourceContactsWork; |
573 |
565 FindEntryAndDeleteL(lookupItem); |
574 lookupItem.iSource = ESourceContactsHome; |
566 |
575 iMaptileDatabase->DeleteEntryL(lookupItem); |
567 lookupItem.iSource = ESourceContactsHome; |
576 |
568 FindEntryAndDeleteL(lookupItem); |
577 MYLOCLOGSTRING("EContactDbObserverEventContactDeleted "); |
569 }*/ |
578 return; |
|
579 } |
570 |
580 |
571 //Get the contact item |
581 //Get the contact item |
572 iEventType = aEvent.iType; |
582 iEventType = aEvent.iType; |
573 CContactItem* contactItem = iContactsDb->ReadContactL(aEvent.iContactId); |
583 CContactItem* contactItem = iContactsDb->ReadContactL(aEvent.iContactId); |
574 CleanupStack::PushL(contactItem); |
584 CleanupStack::PushL(contactItem); |
707 { |
717 { |
708 iMaptileDatabase->DeleteEntryL(lookupItem); |
718 iMaptileDatabase->DeleteEntryL(lookupItem); |
709 } |
719 } |
710 // } |
720 // } |
711 break; |
721 break; |
712 } |
722 } |
713 case EContactDbObserverEventContactDeleted: |
|
714 { |
|
715 |
|
716 lookupItem.iSource = ESourceContactsPref; |
|
717 iMaptileDatabase->DeleteEntryL(lookupItem); |
|
718 |
|
719 lookupItem.iSource = ESourceContactsWork; |
|
720 iMaptileDatabase->DeleteEntryL(lookupItem); |
|
721 |
|
722 lookupItem.iSource = ESourceContactsHome; |
|
723 iMaptileDatabase->DeleteEntryL(lookupItem); |
|
724 |
|
725 MYLOCLOGSTRING("EContactDbObserverEventContactDeleted "); |
|
726 /* // the contact is deleted, so delete the corresponding entries from database. |
|
727 TLookupItem lookupItem; |
|
728 lookupItem.iUid = aEvent.iContactId; |
|
729 iMaptileDatabase->DeleteEntryL(lookupItem);*/ |
|
730 break; |
|
731 } |
|
732 case EContactDbObserverEventContactAdded: |
723 case EContactDbObserverEventContactAdded: |
733 { |
724 { |
734 MYLOCLOGSTRING("EContactDbObserverEventContactAdded" ); |
725 MYLOCLOGSTRING("EContactDbObserverEventContactAdded" ); |
735 if (preferedAddressLm) |
726 if (preferedAddressLm) |
736 { |
727 { |
1047 aContactItem->CardFields()[sNameInd].TextStorage()->Text(); |
1040 aContactItem->CardFields()[sNameInd].TextStorage()->Text(); |
1048 sName1.Append(sName); |
1041 sName1.Append(sName); |
1049 } |
1042 } |
1050 |
1043 |
1051 TRAP_IGNORE( landmark->SetLandmarkNameL( sName1 ) ); |
1044 TRAP_IGNORE( landmark->SetLandmarkNameL( sName1 ) ); |
1052 |
|
1053 if (aAddressType == EAddressPref) // default/prefered address |
|
1054 { |
|
1055 TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactPrefered) ); |
|
1056 } |
|
1057 else if (aAddressType == EAddressWork) // work address |
|
1058 { |
|
1059 TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactWork) ); |
|
1060 } |
|
1061 else // home address |
|
1062 { |
|
1063 TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactHome) ); |
|
1064 } |
|
1065 |
1045 |
1066 // Set the street |
1046 // Set the street |
1067 TInt adrId = FindContactsField(aContactItem, aAddressType, |
1047 TInt adrId = FindContactsField(aContactItem, aAddressType, |
1068 KUidContactFieldVCardMapADR); |
1048 KUidContactFieldVCardMapADR); |
1069 if (adrId != KErrNotFound) |
1049 if (adrId != KErrNotFound) |
1234 } |
1231 } |
1235 return retVal; |
1232 return retVal; |
1236 } |
1233 } |
1237 |
1234 |
1238 // ----------------------------------------------------------------------------- |
1235 // ----------------------------------------------------------------------------- |
1239 // CMyLocationsEngine::MyLocationsDbManager() |
|
1240 // Gets handle to mylocations database manager. |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // |
|
1243 CMyLocationsDatabaseManager& CMyLocationsEngine::MyLocationsDbManager() |
|
1244 { |
|
1245 __TRACE_CALLSTACK; |
|
1246 return *iMyLocationsDatabaseManager; |
|
1247 } |
|
1248 // ----------------------------------------------------------------------------- |
|
1249 // CMyLocationsEngine::RunL() |
1236 // CMyLocationsEngine::RunL() |
1250 // Handles active object's request completion event. |
1237 // Handles active object's request completion event. |
1251 // ----------------------------------------------------------------------------- |
1238 // ----------------------------------------------------------------------------- |
1252 // |
1239 // |
1253 void CMyLocationsEngine::RunL() |
1240 void CMyLocationsEngine::RunL() |
1254 { |
1241 { |
1255 __TRACE_CALLSTACK; |
1242 __TRACE_CALLSTACK; |
1256 switch (iLmEvent.iEventType) |
1243 switch (iLmEvent.iEventType) |
1257 { |
1244 { |
1258 case EPosLmEventLandmarkCreated: |
1245 case EPosLmEventLandmarkCreated: |
1259 case EPosLmEventLandmarkUpdated: |
1246 case EPosLmEventLandmarkUpdated: |
1260 { |
1247 { |
1261 TBuf<KMaxAddressLength> lmAddress; |
1248 CPosLandmark* readLandmark = iLandmarkDb->ReadLandmarkLC( |
1262 CPosLandmark* readLandmark = iLandmarkDb->ReadLandmarkLC( |
1249 iLmEvent.iLandmarkItemId); |
1263 iLmEvent.iLandmarkItemId); |
1250 |
1264 |
1251 if (readLandmark) |
1265 if (readLandmark) |
1252 { |
1266 { |
1253 // update the entry in database. |
1267 iMyLocationsDatabaseManager->GetLandmarkFullAddress(lmAddress, |
1254 UpdateDatabaseL( readLandmark, |
1268 readLandmark); |
1255 iLmEvent.iLandmarkItemId, ESourceLandmarks, MapChangeType( |
1269 |
1256 ESourceLandmarks, iLmEvent.iEventType ) ); |
1270 CPosLandmark* landmark = CPosLandmark::NewL(); |
1257 |
1271 CleanupStack::PushL(landmark); |
1258 CleanupStack::PopAndDestroy(readLandmark); |
1272 |
1259 } |
1273 TRAP_IGNORE( landmark->SetLandmarkNameL( lmAddress )); |
1260 } |
1274 |
|
1275 TPtrC iconFileName; |
|
1276 TInt iconIndex; |
|
1277 TInt iconMaskIndex; |
|
1278 TInt err = readLandmark->GetIcon(iconFileName, iconIndex, |
|
1279 iconMaskIndex); |
|
1280 |
|
1281 if (err == KErrNone) |
|
1282 { |
|
1283 TRAP_IGNORE( landmark->SetIconL( |
|
1284 iconFileName, iconIndex, iconMaskIndex ) ); |
|
1285 } |
|
1286 |
|
1287 // update the entry in mylocations database. |
|
1288 iMyLocationsDatabaseManager->UpdateDatabaseL(landmark, |
|
1289 iLmEvent.iLandmarkItemId, ESourceLandmarks, MapChangeType( |
|
1290 ESourceLandmarks, iLmEvent.iEventType)); |
|
1291 |
|
1292 CleanupStack::PopAndDestroy(landmark); |
|
1293 CleanupStack::PopAndDestroy(readLandmark); |
|
1294 } |
|
1295 } |
|
1296 break; |
1261 break; |
1297 case EPosLmEventLandmarkDeleted: |
1262 case EPosLmEventLandmarkDeleted: |
1298 { |
1263 { |
1299 // delete the corresponding entries in mylocations database. |
1264 // delete the corresponding entries in mylocations database. |
1300 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, |
1265 UpdateDatabaseL(NULL, |
1301 iLmEvent.iLandmarkItemId, ESourceLandmarks, EEntryDeleted); |
1266 iLmEvent.iLandmarkItemId, ESourceLandmarks, EEntryDeleted); |
1302 } |
1267 } |
1303 break; |
1268 break; |
1304 |
|
1305 case EPosLmEventCategoryCreated: |
|
1306 { |
|
1307 // delete the corresponding entries in mylocations database. |
|
1308 iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, |
|
1309 iLmEvent.iLandmarkItemId, ESourceLandmarksCategory, |
|
1310 MapChangeType(ESourceLandmarksCategory, iLmEvent.iEventType)); |
|
1311 } |
|
1312 break; |
|
1313 |
|
1314 |
1269 |
1315 } |
1270 } |
1316 |
1271 |
1317 // start the change notifier again; |
1272 // start the change notifier again; |
1318 StartLandmarksChangeNotifier(); |
1273 StartLandmarksChangeNotifier(); |
1319 |
1274 |
1320 } |
1275 } |
1321 |
|
1322 // ----------------------------------------------------------------------------- |
1276 // ----------------------------------------------------------------------------- |
1323 // CMyLocationsEngine::DoCancel() |
1277 // CMyLocationsEngine::DoCancel() |
1324 // Implements cancellation of an outstanding request. |
1278 // Implements cancellation of an outstanding request. |
1325 // ----------------------------------------------------------------------------- |
1279 // ----------------------------------------------------------------------------- |
1326 // |
1280 // |
1327 void CMyLocationsEngine::DoCancel() |
1281 void CMyLocationsEngine::DoCancel() |
1328 { |
1282 { |
1329 __TRACE_CALLSTACK; |
1283 __TRACE_CALLSTACK; |
1330 iLandmarkDb->CancelNotifyDatabaseEvent(); |
1284 iLandmarkDb->CancelNotifyDatabaseEvent(); |
1331 } |
|
1332 |
|
1333 // ----------------------------------------------------------------------------- |
|
1334 // CMyLocationsEngine::RunError() |
|
1335 // Implements cancellation of an outstanding request. |
|
1336 // ----------------------------------------------------------------------------- |
|
1337 // |
|
1338 TInt CMyLocationsEngine::RunError(TInt /*aError*/) |
|
1339 { |
|
1340 __TRACE_CALLSTACK; |
|
1341 return KErrNone; |
|
1342 } |
1285 } |
1343 |
1286 |
1344 // ----------------------------------------------------------------------------- |
1287 // ----------------------------------------------------------------------------- |
1345 // CMyLocationsEngine::MapTilefetchingCompleted() |
1288 // CMyLocationsEngine::MapTilefetchingCompleted() |
1346 // Handles the maptile fetching completion event and updates the maptile lookup db. |
1289 // Handles the maptile fetching completion event and updates the maptile lookup db. |
1440 MYLOCLOGSTRING1("No. of iMapTileRequestQueue - %d",iMapTileRequestQueue.Count()); |
1385 MYLOCLOGSTRING1("No. of iMapTileRequestQueue - %d",iMapTileRequestQueue.Count()); |
1441 if (iMapTileRequestQueue.Count() > 0) |
1386 if (iMapTileRequestQueue.Count() > 0) |
1442 { |
1387 { |
1443 switch (iMapTileRequestQueue[0]->iAddressType) |
1388 switch (iMapTileRequestQueue[0]->iAddressType) |
1444 { |
1389 { |
1445 /*//TODO: |
1390 //TODO: |
1446 case ESourceCalendar: |
1391 case ESourceCalendar: |
1447 { |
1392 { |
1448 break; |
1393 |
1449 }*/ |
1394 CPosLandmark *landmark=NULL; |
1450 case ESourceContactsPref: |
1395 landmark=iMapTileInterface->GetLandMarkDetails(); |
1451 case ESourceContactsWork: |
1396 TRAP_IGNORE( UpdateDatabaseL( landmark, iMapTileRequestQueue[0]->iUId, |
1452 case ESourceContactsHome: |
1397 ESourceCalendar, |
1453 { |
1398 MapChangeType( ESourceCalendar, iMapTileRequestQueue[0]->iEventType ) ) ); |
1454 GeocodeUpdate::UpDate(iMapTileRequestQueue[0]->iUId, |
1399 MYLOCLOGSTRING("Geo-codinate updated to calender db"); |
1455 iMapTileRequestQueue[0]->iAddressType, aLatitude, |
1400 break; |
1456 aLongitude); |
1401 } |
1457 MYLOCLOGSTRING("Geo code updated into contact db"); |
1402 case ESourceContactsPref: |
1458 break; |
1403 case ESourceContactsWork: |
1459 } |
1404 case ESourceContactsHome: |
|
1405 { |
|
1406 GeocodeUpdate::updateGeocodeToContactDB( |
|
1407 iMapTileRequestQueue[0]->iUId, |
|
1408 iMapTileRequestQueue[0]->iAddressType, aLatitude, |
|
1409 aLongitude); |
|
1410 MYLOCLOGSTRING("Geo-codinate updated to contact db"); |
|
1411 break; |
|
1412 } |
1460 }; |
1413 }; |
1461 |
1414 |
1462 |
1415 |
1463 } |
1416 } |
1464 |
1417 |
1465 } |
1418 } |
1466 |
1419 |
|
1420 // ----------------------------------------------------------------------------- |
|
1421 // CMyLocationsEngine::UpdateDatabaseL() |
|
1422 // ----------------------------------------------------------------------------- |
|
1423 // |
|
1424 void CMyLocationsEngine::UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid, |
|
1425 const TUint32 aSourceType, const TEntryChangeType aChangeType ) |
|
1426 { |
|
1427 __TRACE_CALLSTACK; |
|
1428 Cancel(); |
|
1429 iMyLocationsDatabaseManager->UpdateDatabaseL( aLandmark, aUid, |
|
1430 aSourceType, aChangeType ); |
|
1431 if( aSourceType != ESourceLandmarks ) |
|
1432 { |
|
1433 StartLandmarksChangeNotifier(); |
|
1434 } |
|
1435 |
|
1436 } |
|
1437 |
1467 //End of file |
1438 //End of file |
|
1439 |