# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1286140256 -10800 # Node ID b3dd5ec3089d2e55d23ab60ce9ef64157e532a48 # Parent 793f76d9ab0c091d2ec24828d5d395cfc8c5d893 Revision: 201037 Kit: 201039 diff -r 793f76d9ab0c -r b3dd5ec3089d location_plat/location_data_harvester_api/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/location_plat/location_data_harvester_api/bld.inf Mon Oct 04 00:10:56 2010 +0300 @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Location data harvester api build file +* +*/ + + +#include + +PRJ_EXPORTS +inc\maptilegeocoderplugin.h APP_LAYER_PLATFORM_EXPORT_PATH(maptilegeocoderplugin.h) +inc\maptilegeocoderplugin.inl APP_LAYER_PLATFORM_EXPORT_PATH(maptilegeocoderplugin.inl) +inc\locationdatalookupdb.h APP_LAYER_PLATFORM_EXPORT_PATH(locationdatalookupdb.h) +inc\locationservicedefines.h APP_LAYER_PLATFORM_EXPORT_PATH(locationservicedefines.h) \ No newline at end of file diff -r 793f76d9ab0c -r b3dd5ec3089d location_plat/location_data_harvester_api/inc/locationdatalookupdb.h --- a/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Thu Sep 02 20:20:42 2010 +0300 +++ b/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Mon Oct 04 00:10:56 2010 +0300 @@ -108,6 +108,18 @@ }; /** +* Location data for calendar specific. +*/ +class QCalendarLocationDetails +{ +public: + // Uid of the source entry + quint32 mSourceUid; + //One line address + QString mOnelineLocation; +}; + +/** * Location data lookup database class. */ class DLL_EXPORT LocationDataLookupDb : public QObject @@ -218,13 +230,31 @@ QString getAddressDetails( quint32 mId , quint32 mSourceType ); /** - * Gets single line address + * Updates the entry name * @param id , id of the entry * @param sourceType , type of entry * @param name , name of entry */ void updateEntryNameByIdAndType(quint32 id, quint32 sourceType , QString name); + /** + * Updates the calendar entry + * @param id , id of the calendar entry + * @param location , location + */ + void updateCalendarLocationById(quint32 id,QString location); + + /** + * Delete the calendar entry + * @param id , id of the calendar entry + */ + void deleteCalendarEntry(quint32 id); + /** + * gets all the calendar entry + * @param lookupItemArray , refference to all entry + */ + void getAllCalendarEntry(QList& lookupItemArray); + private: // fills the lookup entry diff -r 793f76d9ab0c -r b3dd5ec3089d location_plat/location_data_harvester_api/inc/locationservicedefines.h --- a/location_plat/location_data_harvester_api/inc/locationservicedefines.h Thu Sep 02 20:20:42 2010 +0300 +++ b/location_plat/location_data_harvester_api/inc/locationservicedefines.h Mon Oct 04 00:10:56 2010 +0300 @@ -18,6 +18,31 @@ #ifndef LOCATIONSERVICEDEFINES_H #define LOCATIONSERVICEDEFINES_H +#include + +/** + * MaptileLookupItem struct. + * This structure defines a maptile lookup item. + */ + +class MaptileLookupItem +{ +public: + // Uid of the source entry + quint32 iUid; + + // Source type + quint32 iSource; + + // File Path + QString iFilePath; + + // map tile fetching status + quint32 iFetchingStatus; + + // user setting status + bool iUserSetting; +}; /** Defines uid source type */ diff -r 793f76d9ab0c -r b3dd5ec3089d location_plat/location_picker_service_api/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/location_plat/location_picker_service_api/bld.inf Mon Oct 04 00:10:56 2010 +0300 @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Location picker service api build file +* +*/ + + +#include + +PRJ_EXPORTS +inc/qlocationpickeritem.h APP_LAYER_PLATFORM_EXPORT_PATH(qlocationpickeritem.h) diff -r 793f76d9ab0c -r b3dd5ec3089d location_plat/location_plat.pro --- a/location_plat/location_plat.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/location_plat/location_plat.pro Mon Oct 04 00:10:56 2010 +0300 @@ -27,3 +27,6 @@ #BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include \"group/bld.inf\"" + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/bwins/locationdatalookupdbu.def --- a/locationdataharvester/bwins/locationdatalookupdbu.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/bwins/locationdatalookupdbu.def Mon Oct 04 00:10:56 2010 +0300 @@ -1,20 +1,23 @@ EXPORTS ?updateMaptileBySourceIdAndType@LocationDataLookupDb@@QAEXIIVQString@@@Z @ 1 NONAME ; void LocationDataLookupDb::updateMaptileBySourceIdAndType(unsigned int, unsigned int, class QString) - ?getAddressDetails@LocationDataLookupDb@@QAE?AVQString@@II@Z @ 2 NONAME ; class QString LocationDataLookupDb::getAddressDetails(unsigned int, unsigned int) - ?deleteEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 3 NONAME ; void LocationDataLookupDb::deleteEntryBySourceIdAndType(class QLookupItem const &) - ?updateEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 4 NONAME ; void LocationDataLookupDb::updateEntryBySourceIdAndType(class QLookupItem const &) - ?getEntries@LocationDataLookupDb@@QAEXAAV?$QList@VQLookupItem@@@@I@Z @ 5 NONAME ; void LocationDataLookupDb::getEntries(class QList &, unsigned int) - ?updateEntryById@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 6 NONAME ; void LocationDataLookupDb::updateEntryById(class QLookupItem const &) - ??0LocationDataLookupDb@@QAE@PAVQObject@@@Z @ 7 NONAME ; LocationDataLookupDb::LocationDataLookupDb(class QObject *) - ?getCount@LocationDataLookupDb@@QAEXAAV?$QList@H@@I@Z @ 8 NONAME ; void LocationDataLookupDb::getCount(class QList &, unsigned int) - ?findEntryBySourceIdAndType@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 9 NONAME ; bool LocationDataLookupDb::findEntryBySourceIdAndType(class QLookupItem &) - ??1LocationDataLookupDb@@UAE@XZ @ 10 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(void) - ?findEntriesByLandmarkId@LocationDataLookupDb@@QAEXIAAV?$QList@VQLookupItem@@@@@Z @ 11 NONAME ; void LocationDataLookupDb::findEntriesByLandmarkId(unsigned int, class QList &) - ?close@LocationDataLookupDb@@QAEXXZ @ 12 NONAME ; void LocationDataLookupDb::close(void) - ?createEntry@LocationDataLookupDb@@QAEXAAVQLookupItem@@@Z @ 13 NONAME ; void LocationDataLookupDb::createEntry(class QLookupItem &) - ?findEntryById@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 14 NONAME ; bool LocationDataLookupDb::findEntryById(class QLookupItem &) - ?fillLookupEntry@LocationDataLookupDb@@AAEXAAVQSqlQuery@@AAVQLookupItem@@@Z @ 15 NONAME ; void LocationDataLookupDb::fillLookupEntry(class QSqlQuery &, class QLookupItem &) - ?open@LocationDataLookupDb@@QAE_NXZ @ 16 NONAME ; bool LocationDataLookupDb::open(void) - ??_ELocationDataLookupDb@@UAE@I@Z @ 17 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(unsigned int) - ?updateEntryNameByIdAndType@LocationDataLookupDb@@QAEXIIVQString@@@Z @ 18 NONAME ; void LocationDataLookupDb::updateEntryNameByIdAndType(unsigned int, unsigned int, class QString) + ?getEntries@LocationDataLookupDb@@QAEXAAV?$QList@VQLookupItem@@@@I@Z @ 2 NONAME ; void LocationDataLookupDb::getEntries(class QList &, unsigned int) + ?updateEntryById@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 3 NONAME ; void LocationDataLookupDb::updateEntryById(class QLookupItem const &) + ?updateCalendarLocationById@LocationDataLookupDb@@QAEXIVQString@@@Z @ 4 NONAME ; void LocationDataLookupDb::updateCalendarLocationById(unsigned int, class QString) + ?findEntriesByLandmarkId@LocationDataLookupDb@@QAEXIAAV?$QList@VQLookupItem@@@@@Z @ 5 NONAME ; void LocationDataLookupDb::findEntriesByLandmarkId(unsigned int, class QList &) + ?deleteCalendarEntry@LocationDataLookupDb@@QAEXI@Z @ 6 NONAME ; void LocationDataLookupDb::deleteCalendarEntry(unsigned int) + ?fillLookupEntry@LocationDataLookupDb@@AAEXAAVQSqlQuery@@AAVQLookupItem@@@Z @ 7 NONAME ; void LocationDataLookupDb::fillLookupEntry(class QSqlQuery &, class QLookupItem &) + ?open@LocationDataLookupDb@@QAE_NXZ @ 8 NONAME ; bool LocationDataLookupDb::open(void) + ?deleteEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 9 NONAME ; void LocationDataLookupDb::deleteEntryBySourceIdAndType(class QLookupItem const &) + ?getAddressDetails@LocationDataLookupDb@@QAE?AVQString@@II@Z @ 10 NONAME ; class QString LocationDataLookupDb::getAddressDetails(unsigned int, unsigned int) + ?updateEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 11 NONAME ; void LocationDataLookupDb::updateEntryBySourceIdAndType(class QLookupItem const &) + ??0LocationDataLookupDb@@QAE@PAVQObject@@@Z @ 12 NONAME ; LocationDataLookupDb::LocationDataLookupDb(class QObject *) + ?findEntryBySourceIdAndType@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 13 NONAME ; bool LocationDataLookupDb::findEntryBySourceIdAndType(class QLookupItem &) + ?getCount@LocationDataLookupDb@@QAEXAAV?$QList@H@@I@Z @ 14 NONAME ; void LocationDataLookupDb::getCount(class QList &, unsigned int) + ??1LocationDataLookupDb@@UAE@XZ @ 15 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(void) + ?createEntry@LocationDataLookupDb@@QAEXAAVQLookupItem@@@Z @ 16 NONAME ; void LocationDataLookupDb::createEntry(class QLookupItem &) + ?close@LocationDataLookupDb@@QAEXXZ @ 17 NONAME ; void LocationDataLookupDb::close(void) + ?findEntryById@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 18 NONAME ; bool LocationDataLookupDb::findEntryById(class QLookupItem &) + ??_ELocationDataLookupDb@@UAE@I@Z @ 19 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(unsigned int) + ?updateEntryNameByIdAndType@LocationDataLookupDb@@QAEXIIVQString@@@Z @ 20 NONAME ; void LocationDataLookupDb::updateEntryNameByIdAndType(unsigned int, unsigned int, class QString) + ?getAllCalendarEntry@LocationDataLookupDb@@QAEXAAV?$QList@VQCalendarLocationDetails@@@@@Z @ 21 NONAME ; void LocationDataLookupDb::getAllCalendarEntry(class QList &) diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/bwins/maptileserviceu.def --- a/locationdataharvester/bwins/maptileserviceu.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/bwins/maptileserviceu.def Mon Oct 04 00:10:56 2010 +0300 @@ -1,21 +1,39 @@ EXPORTS - ?qt_metacast@MapTileService@@UAEPAXPBD@Z @ 1 NONAME ; void * MapTileService::qt_metacast(char const *) - ?publishCalEntry@MapTileService@@AAEXH@Z @ 2 NONAME ; void MapTileService::publishCalEntry(int) - ?isLocationFeatureEnabled@MapTileService@@QAE_NW4AppType@1@@Z @ 3 NONAME ; bool MapTileService::isLocationFeatureEnabled(enum MapTileService::AppType) - ??_EMapTileService@@UAE@I@Z @ 4 NONAME ; MapTileService::~MapTileService(unsigned int) - ?tr@MapTileService@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString MapTileService::tr(char const *, char const *) - ?getStaticMetaObject@MapTileService@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & MapTileService::getStaticMetaObject(void) - ?trUtf8@MapTileService@@SA?AVQString@@PBD0H@Z @ 7 NONAME ; class QString MapTileService::trUtf8(char const *, char const *, int) - ??1MapTileService@@UAE@XZ @ 8 NONAME ; MapTileService::~MapTileService(void) - ??0MapTileService@@QAE@XZ @ 9 NONAME ; MapTileService::MapTileService(void) - ?getMapTileImage@MapTileService@@QAEHHW4AddressType@1@AAVQString@@V?$QFlags@W4Orientation@Qt@@@@@Z @ 10 NONAME ; int MapTileService::getMapTileImage(int, enum MapTileService::AddressType, class QString &, class QFlags) - ?metaObject@MapTileService@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * MapTileService::metaObject(void) const - ?setMaptileStatus@MapTileService@@QAEXXZ @ 12 NONAME ; void MapTileService::setMaptileStatus(void) - ?tr@MapTileService@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString MapTileService::tr(char const *, char const *, int) - ?qt_metacall@MapTileService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 14 NONAME ; int MapTileService::qt_metacall(enum QMetaObject::Call, int, void * *) - ?readEntryFromMaptileDataBase@MapTileService@@AAEHHW4AddressType@1@AAVTLookupItem@@AAH@Z @ 15 NONAME ; int MapTileService::readEntryFromMaptileDataBase(int, enum MapTileService::AddressType, class TLookupItem &, int &) - ?trUtf8@MapTileService@@SA?AVQString@@PBD0@Z @ 16 NONAME ; class QString MapTileService::trUtf8(char const *, char const *) - ?staticMetaObject@MapTileService@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const MapTileService::staticMetaObject - ?maptileFetchingStatusUpdate@MapTileService@@IAEXHHH@Z @ 18 NONAME ; void MapTileService::maptileFetchingStatusUpdate(int, int, int) - ?publishValue@MapTileService@@AAEXHW4AddressType@1@H@Z @ 19 NONAME ; void MapTileService::publishValue(int, enum MapTileService::AddressType, int) + ?deleteEntry@LookupMapTileDatabase@@QAEXAAVMaptileLookupItem@@@Z @ 1 NONAME ; void LookupMapTileDatabase::deleteEntry(class MaptileLookupItem &) + ?createEntry@LookupMapTileDatabase@@QAEXABVMaptileLookupItem@@@Z @ 2 NONAME ; void LookupMapTileDatabase::createEntry(class MaptileLookupItem const &) + ?tr@MapTileService@@SA?AVQString@@PBD0@Z @ 3 NONAME ; class QString MapTileService::tr(char const *, char const *) + ?readEntryFromMaptileDataBase@MapTileService@@AAEHHW4AddressType@1@AAVMaptileLookupItem@@AAH@Z @ 4 NONAME ; int MapTileService::readEntryFromMaptileDataBase(int, enum MapTileService::AddressType, class MaptileLookupItem &, int &) + ?getStaticMetaObject@MapTileService@@SAABUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const & MapTileService::getStaticMetaObject(void) + ?maptileFetchingStatusUpdate@MapTileService@@IAEXHHH@Z @ 6 NONAME ; void MapTileService::maptileFetchingStatusUpdate(int, int, int) + ?getAllCalendarIds@LookupMapTileDatabase@@QAEXAAV?$QList@I@@@Z @ 7 NONAME ; void LookupMapTileDatabase::getAllCalendarIds(class QList &) + ?qt_metacast@MapTileService@@UAEPAXPBD@Z @ 8 NONAME ; void * MapTileService::qt_metacast(char const *) + ??_ELookupMapTileDatabase@@UAE@I@Z @ 9 NONAME ; LookupMapTileDatabase::~LookupMapTileDatabase(unsigned int) + ?isLocationFeatureEnabled@MapTileService@@QAE_NW4AppType@1@@Z @ 10 NONAME ; bool MapTileService::isLocationFeatureEnabled(enum MapTileService::AppType) + ?resetEntry@LookupMapTileDatabase@@QAEXAAVMaptileLookupItem@@@Z @ 11 NONAME ; void LookupMapTileDatabase::resetEntry(class MaptileLookupItem &) + ?deleteMapTile@LookupMapTileDatabase@@QAEXABVMaptileLookupItem@@@Z @ 12 NONAME ; void LookupMapTileDatabase::deleteMapTile(class MaptileLookupItem const &) + ?trUtf8@MapTileService@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString MapTileService::trUtf8(char const *, char const *, int) + ??0MapTileService@@QAE@XZ @ 14 NONAME ; MapTileService::MapTileService(void) + ?tr@MapTileService@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString MapTileService::tr(char const *, char const *, int) + ?close@LookupMapTileDatabase@@QAEXXZ @ 16 NONAME ; void LookupMapTileDatabase::close(void) + ?findEntryByFilePath@LookupMapTileDatabase@@QAE_NABVQString@@@Z @ 17 NONAME ; bool LookupMapTileDatabase::findEntryByFilePath(class QString const &) + ?publishValue@MapTileService@@AAEXHW4AddressType@1@H@Z @ 18 NONAME ; void MapTileService::publishValue(int, enum MapTileService::AddressType, int) + ?findEntriesByMapTileFetchingState@LookupMapTileDatabase@@QAEXIAAV?$QList@VMaptileLookupItem@@@@@Z @ 19 NONAME ; void LookupMapTileDatabase::findEntriesByMapTileFetchingState(unsigned int, class QList &) + ?publishCalEntry@MapTileService@@AAEXH@Z @ 20 NONAME ; void MapTileService::publishCalEntry(int) + ?findNumberOfAddress@LookupMapTileDatabase@@QAEHAAH@Z @ 21 NONAME ; int LookupMapTileDatabase::findNumberOfAddress(int &) + ??_EMapTileService@@UAE@I@Z @ 22 NONAME ; MapTileService::~MapTileService(unsigned int) + ?getEntry@LookupMapTileDatabase@@QAE_NAAVMaptileLookupItem@@@Z @ 23 NONAME ; bool LookupMapTileDatabase::getEntry(class MaptileLookupItem &) + ??1MapTileService@@UAE@XZ @ 24 NONAME ; MapTileService::~MapTileService(void) + ?staticMetaObject@MapTileService@@2UQMetaObject@@B @ 25 NONAME ; struct QMetaObject const MapTileService::staticMetaObject + ??0LookupMapTileDatabase@@QAE@PAVQObject@@@Z @ 26 NONAME ; LookupMapTileDatabase::LookupMapTileDatabase(class QObject *) + ?open@LookupMapTileDatabase@@QAE_NXZ @ 27 NONAME ; bool LookupMapTileDatabase::open(void) + ??1LookupMapTileDatabase@@UAE@XZ @ 28 NONAME ; LookupMapTileDatabase::~LookupMapTileDatabase(void) + ?updateEntry@LookupMapTileDatabase@@QAEXABVMaptileLookupItem@@@Z @ 29 NONAME ; void LookupMapTileDatabase::updateEntry(class MaptileLookupItem const &) + ?findEntry@LookupMapTileDatabase@@QAE_NABVMaptileLookupItem@@@Z @ 30 NONAME ; bool LookupMapTileDatabase::findEntry(class MaptileLookupItem const &) + ?metaObject@MapTileService@@UBEPBUQMetaObject@@XZ @ 31 NONAME ; struct QMetaObject const * MapTileService::metaObject(void) const + ?getMapTileImage@MapTileService@@QAEHHW4AddressType@1@AAVQString@@V?$QFlags@W4Orientation@Qt@@@@@Z @ 32 NONAME ; int MapTileService::getMapTileImage(int, enum MapTileService::AddressType, class QString &, class QFlags) + ?setMaptileStatus@MapTileService@@QAEXXZ @ 33 NONAME ; void MapTileService::setMaptileStatus(void) + ?qt_metacall@MapTileService@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 34 NONAME ; int MapTileService::qt_metacall(enum QMetaObject::Call, int, void * *) + ?trUtf8@MapTileService@@SA?AVQString@@PBD0@Z @ 35 NONAME ; class QString MapTileService::trUtf8(char const *, char const *) + ?updateUserSetting@LookupMapTileDatabase@@QAEXABVMaptileLookupItem@@@Z @ 36 NONAME ; void LookupMapTileDatabase::updateUserSetting(class MaptileLookupItem const &) + ?keepExistingLocation@MapTileService@@QAEXHW4AddressType@1@_N@Z @ 37 NONAME ; void MapTileService::keepExistingLocation(int, enum MapTileService::AddressType, bool) diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/bwins/mylocationsdatabasemanageru.def --- a/locationdataharvester/bwins/mylocationsdatabasemanageru.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/bwins/mylocationsdatabasemanageru.def Mon Oct 04 00:10:56 2010 +0300 @@ -1,10 +1,12 @@ EXPORTS - ?UpdateMapTilePath@CMyLocationsDatabaseManager@@QAEXKKAAV?$TBuf@$0BAA@@@@Z @ 1 NONAME ; void CMyLocationsDatabaseManager::UpdateMapTilePath(unsigned long, unsigned long, class TBuf<256> &) - ?UpdateEntryName@CMyLocationsDatabaseManager@@QAEXKW4TUidSourceType@@ABVTDesC16@@@Z @ 2 NONAME ; void CMyLocationsDatabaseManager::UpdateEntryName(unsigned long, enum TUidSourceType, class TDesC16 const &) - ?GetLandmarkFullAddress@CMyLocationsDatabaseManager@@QAEXAAV?$TBuf@$0PP@@@PBVCPosLandmark@@@Z @ 3 NONAME ; void CMyLocationsDatabaseManager::GetLandmarkFullAddress(class TBuf<255> &, class CPosLandmark const *) - ?ConstructL@CMyLocationsDatabaseManager@@QAEXXZ @ 4 NONAME ; void CMyLocationsDatabaseManager::ConstructL(void) - ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVTDesC16@@KW4TUidSourceType@@@Z @ 5 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class TDesC16 const &, unsigned long, enum TUidSourceType) - ?UpdateDatabaseL@CMyLocationsDatabaseManager@@QAEXPAVCPosLandmark@@KKK@Z @ 6 NONAME ; void CMyLocationsDatabaseManager::UpdateDatabaseL(class CPosLandmark *, unsigned long, unsigned long, unsigned long) - ??0CMyLocationsDatabaseManager@@QAE@XZ @ 7 NONAME ; CMyLocationsDatabaseManager::CMyLocationsDatabaseManager(void) - ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVCPosLandmark@@KW4TUidSourceType@@@Z @ 8 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class CPosLandmark const &, unsigned long, enum TUidSourceType) + ?GetLandmarkFullAddress@CMyLocationsDatabaseManager@@QAEXAAV?$TBuf@$0PP@@@PBVCPosLandmark@@@Z @ 1 NONAME ; void CMyLocationsDatabaseManager::GetLandmarkFullAddress(class TBuf<255> &, class CPosLandmark const *) + ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVTDesC16@@KW4TUidSourceType@@@Z @ 2 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class TDesC16 const &, unsigned long, enum TUidSourceType) + ?UpdateCalendarLocationById@CMyLocationsDatabaseManager@@QAEXKKABVTDesC16@@@Z @ 3 NONAME ; void CMyLocationsDatabaseManager::UpdateCalendarLocationById(unsigned long, unsigned long, class TDesC16 const &) + ??0CMyLocationsDatabaseManager@@QAE@XZ @ 4 NONAME ; CMyLocationsDatabaseManager::CMyLocationsDatabaseManager(void) + ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVCPosLandmark@@KW4TUidSourceType@@@Z @ 5 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class CPosLandmark const &, unsigned long, enum TUidSourceType) + ?UpdateMapTilePath@CMyLocationsDatabaseManager@@QAEXKKAAV?$TBuf@$0BAA@@@@Z @ 6 NONAME ; void CMyLocationsDatabaseManager::UpdateMapTilePath(unsigned long, unsigned long, class TBuf<256> &) + ?UpdateEntryName@CMyLocationsDatabaseManager@@QAEXKW4TUidSourceType@@ABVTDesC16@@@Z @ 7 NONAME ; void CMyLocationsDatabaseManager::UpdateEntryName(unsigned long, enum TUidSourceType, class TDesC16 const &) + ?ConstructL@CMyLocationsDatabaseManager@@QAEXXZ @ 8 NONAME ; void CMyLocationsDatabaseManager::ConstructL(void) + ?GetAllCalendarEntry@CMyLocationsDatabaseManager@@QAEXAAV?$QList@VQCalendarLocationDetails@@@@@Z @ 9 NONAME ; void CMyLocationsDatabaseManager::GetAllCalendarEntry(class QList &) + ?UpdateDatabaseL@CMyLocationsDatabaseManager@@QAEXPAVCPosLandmark@@KKK@Z @ 10 NONAME ; void CMyLocationsDatabaseManager::UpdateDatabaseL(class CPosLandmark *, unsigned long, unsigned long, unsigned long) diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/eabi/locationdatalookupdbu.def --- a/locationdataharvester/eabi/locationdatalookupdbu.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/eabi/locationdatalookupdbu.def Mon Oct 04 00:10:56 2010 +0300 @@ -5,20 +5,23 @@ _ZN20LocationDataLookupDb15fillLookupEntryER9QSqlQueryR11QLookupItem @ 4 NONAME _ZN20LocationDataLookupDb15updateEntryByIdERK11QLookupItem @ 5 NONAME _ZN20LocationDataLookupDb17getAddressDetailsEjj @ 6 NONAME - _ZN20LocationDataLookupDb23findEntriesByLandmarkIdEjR5QListI11QLookupItemE @ 7 NONAME - _ZN20LocationDataLookupDb26findEntryBySourceIdAndTypeER11QLookupItem @ 8 NONAME - _ZN20LocationDataLookupDb28deleteEntryBySourceIdAndTypeERK11QLookupItem @ 9 NONAME - _ZN20LocationDataLookupDb28updateEntryBySourceIdAndTypeERK11QLookupItem @ 10 NONAME - _ZN20LocationDataLookupDb30updateMaptileBySourceIdAndTypeEjj7QString @ 11 NONAME - _ZN20LocationDataLookupDb4openEv @ 12 NONAME - _ZN20LocationDataLookupDb5closeEv @ 13 NONAME - _ZN20LocationDataLookupDb8getCountER5QListIiEj @ 14 NONAME - _ZN20LocationDataLookupDbC1EP7QObject @ 15 NONAME - _ZN20LocationDataLookupDbC2EP7QObject @ 16 NONAME - _ZN20LocationDataLookupDbD0Ev @ 17 NONAME - _ZN20LocationDataLookupDbD1Ev @ 18 NONAME - _ZN20LocationDataLookupDbD2Ev @ 19 NONAME - _ZTI20LocationDataLookupDb @ 20 NONAME - _ZTV20LocationDataLookupDb @ 21 NONAME - _ZN20LocationDataLookupDb26updateEntryNameByIdAndTypeEjj7QString @ 22 NONAME + _ZN20LocationDataLookupDb19deleteCalendarEntryEj @ 7 NONAME + _ZN20LocationDataLookupDb19getAllCalendarEntryER5QListI24QCalendarLocationDetailsE @ 8 NONAME + _ZN20LocationDataLookupDb23findEntriesByLandmarkIdEjR5QListI11QLookupItemE @ 9 NONAME + _ZN20LocationDataLookupDb26findEntryBySourceIdAndTypeER11QLookupItem @ 10 NONAME + _ZN20LocationDataLookupDb26updateCalendarLocationByIdEj7QString @ 11 NONAME + _ZN20LocationDataLookupDb26updateEntryNameByIdAndTypeEjj7QString @ 12 NONAME + _ZN20LocationDataLookupDb28deleteEntryBySourceIdAndTypeERK11QLookupItem @ 13 NONAME + _ZN20LocationDataLookupDb28updateEntryBySourceIdAndTypeERK11QLookupItem @ 14 NONAME + _ZN20LocationDataLookupDb30updateMaptileBySourceIdAndTypeEjj7QString @ 15 NONAME + _ZN20LocationDataLookupDb4openEv @ 16 NONAME + _ZN20LocationDataLookupDb5closeEv @ 17 NONAME + _ZN20LocationDataLookupDb8getCountER5QListIiEj @ 18 NONAME + _ZN20LocationDataLookupDbC1EP7QObject @ 19 NONAME + _ZN20LocationDataLookupDbC2EP7QObject @ 20 NONAME + _ZN20LocationDataLookupDbD0Ev @ 21 NONAME + _ZN20LocationDataLookupDbD1Ev @ 22 NONAME + _ZN20LocationDataLookupDbD2Ev @ 23 NONAME + _ZTI20LocationDataLookupDb @ 24 NONAME + _ZTV20LocationDataLookupDb @ 25 NONAME diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/eabi/maptileserviceu.def --- a/locationdataharvester/eabi/maptileserviceu.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/eabi/maptileserviceu.def Mon Oct 04 00:10:56 2010 +0300 @@ -9,13 +9,35 @@ _ZN14MapTileService19getStaticMetaObjectEv @ 8 NONAME _ZN14MapTileService24isLocationFeatureEnabledENS_7AppTypeE @ 9 NONAME _ZN14MapTileService27maptileFetchingStatusUpdateEiii @ 10 NONAME - _ZN14MapTileService28readEntryFromMaptileDataBaseEiNS_11AddressTypeER11TLookupItemRi @ 11 NONAME + _ZN14MapTileService28readEntryFromMaptileDataBaseEiNS_11AddressTypeER17MaptileLookupItemRi @ 11 NONAME _ZN14MapTileServiceC1Ev @ 12 NONAME _ZN14MapTileServiceC2Ev @ 13 NONAME _ZN14MapTileServiceD0Ev @ 14 NONAME _ZN14MapTileServiceD1Ev @ 15 NONAME _ZN14MapTileServiceD2Ev @ 16 NONAME - _ZNK14MapTileService10metaObjectEv @ 17 NONAME - _ZTI14MapTileService @ 18 NONAME - _ZTV14MapTileService @ 19 NONAME + _ZN21LookupMapTileDatabase10resetEntryER17MaptileLookupItem @ 17 NONAME + _ZN21LookupMapTileDatabase11createEntryERK17MaptileLookupItem @ 18 NONAME + _ZN21LookupMapTileDatabase11deleteEntryER17MaptileLookupItem @ 19 NONAME + _ZN21LookupMapTileDatabase11updateEntryERK17MaptileLookupItem @ 20 NONAME + _ZN21LookupMapTileDatabase13deleteMapTileERK17MaptileLookupItem @ 21 NONAME + _ZN21LookupMapTileDatabase17getAllCalendarIdsER5QListIjE @ 22 NONAME + _ZN21LookupMapTileDatabase19findEntryByFilePathERK7QString @ 23 NONAME + _ZN21LookupMapTileDatabase19findNumberOfAddressERi @ 24 NONAME + _ZN21LookupMapTileDatabase33findEntriesByMapTileFetchingStateEjR5QListI17MaptileLookupItemE @ 25 NONAME + _ZN21LookupMapTileDatabase4openEv @ 26 NONAME + _ZN21LookupMapTileDatabase5closeEv @ 27 NONAME + _ZN21LookupMapTileDatabase8getEntryER17MaptileLookupItem @ 28 NONAME + _ZN21LookupMapTileDatabase9findEntryERK17MaptileLookupItem @ 29 NONAME + _ZN21LookupMapTileDatabaseC1EP7QObject @ 30 NONAME + _ZN21LookupMapTileDatabaseC2EP7QObject @ 31 NONAME + _ZN21LookupMapTileDatabaseD0Ev @ 32 NONAME + _ZN21LookupMapTileDatabaseD1Ev @ 33 NONAME + _ZN21LookupMapTileDatabaseD2Ev @ 34 NONAME + _ZNK14MapTileService10metaObjectEv @ 35 NONAME + _ZTI14MapTileService @ 36 NONAME + _ZTI21LookupMapTileDatabase @ 37 NONAME + _ZTV14MapTileService @ 38 NONAME + _ZTV21LookupMapTileDatabase @ 39 NONAME + _ZN14MapTileService20keepExistingLocationEiNS_11AddressTypeEb @ 40 NONAME + _ZN21LookupMapTileDatabase17updateUserSettingERK17MaptileLookupItem @ 41 NONAME diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/eabi/mylocationsdatabasemanageru.def --- a/locationdataharvester/eabi/mylocationsdatabasemanageru.def Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/eabi/mylocationsdatabasemanageru.def Mon Oct 04 00:10:56 2010 +0300 @@ -3,9 +3,11 @@ _ZN27CMyLocationsDatabaseManager15UpdateDatabaseLEP12CPosLandmarkmmm @ 2 NONAME _ZN27CMyLocationsDatabaseManager15UpdateEntryNameEm14TUidSourceTypeRK7TDesC16 @ 3 NONAME _ZN27CMyLocationsDatabaseManager17UpdateMapTilePathEmmR4TBufILi256EE @ 4 NONAME - _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK12CPosLandmarkm14TUidSourceType @ 5 NONAME - _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK7TDesC16m14TUidSourceType @ 6 NONAME - _ZN27CMyLocationsDatabaseManager22GetLandmarkFullAddressER4TBufILi255EEPK12CPosLandmark @ 7 NONAME - _ZN27CMyLocationsDatabaseManagerC1Ev @ 8 NONAME - _ZN27CMyLocationsDatabaseManagerC2Ev @ 9 NONAME + _ZN27CMyLocationsDatabaseManager19GetAllCalendarEntryER5QListI24QCalendarLocationDetailsE @ 5 NONAME + _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK12CPosLandmarkm14TUidSourceType @ 6 NONAME + _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK7TDesC16m14TUidSourceType @ 7 NONAME + _ZN27CMyLocationsDatabaseManager22GetLandmarkFullAddressER4TBufILi255EEPK12CPosLandmark @ 8 NONAME + _ZN27CMyLocationsDatabaseManager26UpdateCalendarLocationByIdEmmRK7TDesC16 @ 9 NONAME + _ZN27CMyLocationsDatabaseManagerC1Ev @ 10 NONAME + _ZN27CMyLocationsDatabaseManagerC2Ev @ 11 NONAME diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/geocodeupdate/geocodeupdate.pro --- a/locationdataharvester/geocodeupdate/geocodeupdate.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/geocodeupdate/geocodeupdate.pro Mon Oct 04 00:10:56 2010 +0300 @@ -67,4 +67,6 @@ "$${LITERAL_HASH}endif" MMP_RULES += defBlock -# End of file --Don't remove this. \ No newline at end of file +# End of file --Don't remove this. + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/geocodeupdate/src/geocodeupdate.cpp --- a/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -47,10 +47,8 @@ // ---------------------------------------------------------------------------- GeocodeUpdate::~GeocodeUpdate() { - __TRACE_CALLSTACK; - if (mUtilInstanceCreated) { - delete mAgendaUtil; - } + __TRACE_CALLSTACK; + delete mAgendaUtil; } // ---------------------------------------------------------------------------- @@ -78,9 +76,11 @@ contactManger = new QContactManager("symbian"); MYLOCLOGSTRING("contactManger object created ."); + MYLOCLOGSTRING("contactManger object is not null ."); QContact contact = contactManger->contact(contactId); - QContactGeoLocation location; + QContactGeoLocation *location=NULL; + location=new QContactGeoLocation(); switch (addressType) { case ESourceContactsPref: @@ -89,22 +89,26 @@ } case ESourceContactsWork: { - location.setContexts(QContactDetail::ContextWork); + location->setContexts(QContactDetail::ContextWork); break; } case ESourceContactsHome: { - location.setContexts(QContactDetail::ContextHome); + location->setContexts(QContactDetail::ContextHome); break; } default: { + delete location; + delete contactManger; return false; } } - location.setLongitude(longitude); - location.setLatitude(latitude); - contact.saveDetail(&location); + location->setLongitude(longitude); + location->setLatitude(latitude); + contact.saveDetail(location); + delete location; + location=NULL; bool ret = false; ret = contactManger->saveContact(&contact); delete contactManger; diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/inc/mylocationsdefines.h --- a/locationdataharvester/inc/mylocationsdefines.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/inc/mylocationsdefines.h Mon Oct 04 00:10:56 2010 +0300 @@ -19,29 +19,7 @@ #ifndef __MYLOCATIONSDEFINES_H__ #define __MYLOCATIONSDEFINES_H__ -/** - * TLookupItem struct. - * This structure defines a single lookup item. - */ - -class TLookupItem -{ -public: - // Uid of the source entry - TUint32 iUid; - - // Source type - TUint32 iSource; - - // Landmark uid in the landmarks database - TUint32 iLmId; - - // File Path - TFileName iFilePath; - - //MK map tile fetching status - TUint32 iFetchingStatus; -}; +#include /** Defines map tile fetching states. */ @@ -49,7 +27,7 @@ enum TMapTileFetchingState { /** Map tile fetching completed */ - EMapTileFectchingCompleted, + EMapTileFectchingCompleted=0, /** Map tile fetching in progress */ EMapTileFetchingInProgress, /** Map tile fetching n/w error */ @@ -68,56 +46,11 @@ // lookup database folder path _LIT( KLookupDbPath, "c:\\mylocations\\" ); -//Mylocations resource file -_LIT(KMyLocationsResourceFile, "z:\\resource\\apps\\mylocations.rsc"); - -// My locations landmarks database uri. -_LIT( KMylocationsDatabaseUri, "file://c:MyLocationsLandmarks.ldb" ); - -// maptile database uri. -_LIT( KMaptileDatabaseUri, "file://c:MyLocationsMaptile.ldb" ); - -// History landmarks database uri. -_LIT( KMapsHistoryUri, "file://c:MapsHistoryLandmarks.ldb" ); - -// mylocations lookup database name -_LIT( KMylocationsLookupDatabaseName, "mylocationslookup.db" ); - -// maptile lookup database name -_LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" ); - -// landmarks lookup database name -_LIT( KLandmarksLookupDatabaseName, "landmarkslookup.db" ); - -// database column names -_LIT( NColUid, "uid" ); -_LIT( NColSource, "source" ); -_LIT( NColLmUid, "lmuid" ); - -// maptile database column names -_LIT( NCntColUid, "cntuid" ); -_LIT( NCntColFilePath, "filepath" ); -_LIT( MapTileFetchingStatus, "fetchingstatus" ); - -// database table name -_LIT( KLookupTable, "lookuptable" ); - -// maptile database table name -_LIT( KMapTileLookupTable, "cntmaptilelookuptable" ); - -// uid column number -const TInt KColumnUid = 1; -// source type column number -const TInt KColumnSource = 2; -// landmark uid column number -const TInt KColumnLmkUid = 3; - -// uid column number -const TInt KColumncntUid = 1; -// source type column number -const TInt KColumnFilePath = 3; -// fetching state column number -const TInt KColumnMapTileFetchingStatus = 4; +#ifdef LOCPICKER_UNIT_TEST +const QString KLocationDataLookupDbName = "c:\\locationdatalookuptestdb.db"; +#else +const QString KLocationDataLookupDbName = "c:\\locationdatalookupdb.db"; +#endif const TInt KBufSize=256; @@ -126,8 +59,8 @@ const int MapTileHeight = 250; const int MaptilePortraitWidth = 334; const int MaptilePortraitHeight = 250; -const int MaptileContactLandscapeWidth = 409; -const int MaptileContactLandscapeHeight = 128; +const int MaptileContactLandscapeWidth = 382; +const int MaptileContactLandscapeHeight = 168; const int MaptileCalendarLandscapeWidth = 614; const int MaptileCalendarLandscapeHeight = 202; const int MaptileHurriganesWidth = 228; diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/locationdataharvester.pro --- a/locationdataharvester/locationdataharvester.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/locationdataharvester.pro Mon Oct 04 00:10:56 2010 +0300 @@ -33,3 +33,6 @@ for(iby, iby.sources):BLD_INF_RULES.prj_exports += "./rom/$$iby $$deploy.path$$iby.path/$$iby" + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp --- a/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -22,14 +22,8 @@ #include #include #include -#include - -// database name -#ifdef LOCPICKER_UNIT_TEST -const QString KLocationDataLookupDbName = "c:\\locationdatalookuptestdb.db"; -#else -const QString KLocationDataLookupDbName = "c:\\locationdatalookupdb.db"; -#endif +#include +#include // ================= MEMBER FUNCTIONS ======================= @@ -74,7 +68,7 @@ "maptile varchar(255))"); - query.exec("create table if not exists lplookupaddress (" + query.exec("create table if not exists calendarlocation (" "sourceid int," "address varchar(255))"); mDb->close(); @@ -173,22 +167,7 @@ QVariant var = query.lastInsertId(); aLookupItem.mId = var.toInt(); - - if(aLookupItem.mSourceType==ESourceCalendar) - { - query.prepare("INSERT INTO lplookupaddress (" - "sourceid ," - "address )" - "VALUES (" - ":sourceid, " - ":address) " ); - - query.bindValue(":sourceid", aLookupItem.mSourceUid); - query.bindValue(":address", aLookupItem.mSingleLineAddress); - query.exec(); - - } - + } } @@ -240,19 +219,7 @@ query.addBindValue( aLookupItem.mSourceType ); query.exec(); - - if(aLookupItem.mSourceType==ESourceCalendar) - { - query.prepare("UPDATE lplookupaddress SET " - "address = ? " - "WHERE sourceid = ? "); - - - query.addBindValue( aLookupItem.mSingleLineAddress); - query.addBindValue( aLookupItem.mSourceUid); - query.exec(); - - } + } } @@ -325,17 +292,7 @@ query.addBindValue( aLookupItem.mId ); query.exec(); - - if(aLookupItem.mSourceType==ESourceCalendar) - { - query.prepare("UPDATE lplookupaddress SET " - "address = ? " - "WHERE sourceid = ?"); - - query.addBindValue( aLookupItem.mSingleLineAddress); - query.addBindValue( aLookupItem.mSourceUid ); - query.exec(); - } + } } @@ -376,15 +333,7 @@ query.addBindValue( aLookupItem.mSourceType ); query.exec(); - - if(aLookupItem.mSourceType==ESourceCalendar) - { - query.prepare( "DELETE FROM lplookupaddress " - "WHERE sourceid = ? " ); - query.addBindValue( aLookupItem.mSourceUid ); - query.exec(); - } - + } } @@ -603,7 +552,7 @@ } else if (aSourceType == ESourceCalendar) { - query.prepare("SELECT * FROM lplookupaddress " + query.prepare("SELECT * FROM calendarlocation " "WHERE sourceid = ? "); query.addBindValue( aId ); query.exec(); @@ -692,4 +641,68 @@ } } +// --------------------------------------------------------- +// LocationDataLookupDb::updateCalendarLocationById() +// --------------------------------------------------------- +void LocationDataLookupDb::updateCalendarLocationById(quint32 id , QString location) +{ + QSqlQuery query(*mDb); + query.prepare("SELECT * FROM calendarlocation " + "WHERE sourceid = ? "); + query.addBindValue(id); + query.exec(); + if (query.first()) { + + query.prepare("UPDATE calendarlocation SET " + "address = ? " + "WHERE sourceid = ?"); + query.addBindValue( location ); + query.addBindValue( id); + + } + else { + query.prepare("INSERT INTO calendarlocation (" + "sourceid ," + "address )" + "VALUES (" + ":sourceid, " + ":address) "); + query.bindValue(":sourceid", id); + query.bindValue(":address", location); + + } + query.exec(); + +} + +// --------------------------------------------------------- +// LocationDataLookupDb::deleteCalendarEntry() +// --------------------------------------------------------- +void LocationDataLookupDb::deleteCalendarEntry(quint32 id) +{ + QSqlQuery query(*mDb); + query.prepare( "DELETE FROM calendarlocation " + "WHERE sourceid = ? " ); + query.addBindValue( id ); + query.exec(); + +} +// --------------------------------------------------------- +// LocationDataLookupDb::getAllCalendarEntry() +// --------------------------------------------------------- +void LocationDataLookupDb::getAllCalendarEntry(QList& lookupItemArray) +{ + + QSqlQuery query(*mDb); + query.prepare( "SELECT * FROM calendarlocation "); + query.exec(); + while( query.next() ) { + QCalendarLocationDetails calendarEntry; + QSqlRecord rec = query.record(); + calendarEntry.mSourceUid = query.value( rec.indexOf("sourceid") ).toUInt(); + calendarEntry.mOnelineLocation = query.value( rec.indexOf("address") ).toString(); + lookupItemArray.append(calendarEntry); + } + +} // End of file diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro --- a/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro Mon Oct 04 00:10:56 2010 +0300 @@ -16,6 +16,7 @@ TEMPLATE = lib DEPENDPATH += . INCLUDEPATH += . +INCLUDEPATH += ..\inc # By default Qt adds dependencies to QtCore and QtGui, @@ -45,3 +46,6 @@ "$${LITERAL_HASH}endif" MMP_RULES += defBlock + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/conf/maptileservice.confml Binary file locationdataharvester/maptileservice/conf/maptileservice.confml has changed diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/conf/maptileservice_2002E6E8.crml Binary file locationdataharvester/maptileservice/conf/maptileservice_2002E6E8.crml has changed diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/inc/maptiledblookuptable.h --- a/locationdataharvester/maptileservice/inc/maptiledblookuptable.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/maptileservice/inc/maptiledblookuptable.h Mon Oct 04 00:10:56 2010 +0300 @@ -19,73 +19,142 @@ #ifndef __MAPTILEDBLOOKUPTABLE_H__ #define __MAPTILEDBLOOKUPTABLE_H__ -//Headers needed -#include //RFs -#include //RDbNamedDatabase,RDbView +// DLL_EXPORT macro definition +#ifdef MAPTILESERVICEDLL +#define MAPTILESERVICE_EXPORT Q_DECL_EXPORT +#else +#define MAPTILESERVICE_EXPORT Q_DECL_IMPORT +#endif -#include "mylocationsdefines.h" +#include + +// forward declarations +class QSqlDatabase; + + + /** - * CLookupMapTileDatabase class. + * LookupMapTileDatabase class. * This class handles all the operations related to maptile lookup database. * */ -class CLookupMapTileDatabase : public CBase +class MAPTILESERVICE_EXPORT LookupMapTileDatabase : public QObject { public: /** - * This is a static function, which creates and returns an instance of this class. + * Constructor */ - static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName ); - - /** - * This is a static function, which creates and returns an instance of this class. - * Pushes the created object to the cleanup stack. - */ - static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName ); + LookupMapTileDatabase( QObject *parent = 0 ); /** * Destructor */ - ~CLookupMapTileDatabase(); + ~LookupMapTileDatabase(); + + /** + * Opens the lookup database. + */ + bool open(); + + /** + * Closes the lookup database. + */ + void close(); + public: + + + /** + * Creates an entry in the lookup table. + * @param[in] aLookupItem The lookup item to be created in the database. + */ + void createEntry( const MaptileLookupItem& aLookupItem ); + + /** + * Updates an entry in the lookup table. + * @param[in] aLookupItem The lookup item to be updated in the database. + */ + void updateEntry( const MaptileLookupItem& aLookupItem ); + + /** + * Updates the user setting of an calendar entry in the lookup table. + * @param[in] aLookupItem The lookup item to be updated in the database. + */ + void updateUserSetting( const MaptileLookupItem& aLookupItem ); + /** + * Deletes an entry from the lookup table. + * @param[in] aLookupItem The lookup item to be deleted from the database. + */ + void deleteEntry( MaptileLookupItem& aLookupItem ); + + /** + * Deletes maptile from the repository if the ref to that maptile in the db reaches one + * @param[in] aLookupItem The lookup item containing the path to the maptile + */ + void deleteMapTile( const MaptileLookupItem& aLookupItem ); + + + /** + * Gets an entry from the lookup table. + * @param[in/out] aLookupItem The lookup item to be fetched from the database. + * The source iUid and type is passed in the lookup item. If the item is found the aLookupItem remaining fields are updated. + * @return true if the item is found. + */ + bool getEntry( MaptileLookupItem& aLookupItem ); + + /** + * Gets the list of calendar ids. + * @param[out] aIdArray Calendar id list + */ + void getAllCalendarIds( QList& aIdArray ); + + /** + * ReSet the entry in the lookup table , with null value + * @param aLookupItem The lookup item entry to be reseted in the database, + * get the used maptile path as part of lookupItem filepath , to free the resource + */ + void resetEntry( MaptileLookupItem &aLookupItem ); /** * Finds an entry in the lookup table. - * @param[in/out] aLookupItem The lookup item to be found in the database. - * The source iUid is passed in the lookup item + * @param[in] aLookupItem The lookup item to be found in the database. + * The source iUid and type is passed in the lookup item + * @return true if the item is found. */ - void FindEntryL( TLookupItem& aLookupItem ); + bool findEntry( const MaptileLookupItem& aLookupItem ); /** * Finds the number of address present in db associated with the aId. * @param id, entry (calendar/contact) uid. * @return Number of address a contact has. */ - int FindNumberOfAddressL( int& aId ); + int findNumberOfAddress( int& aId ); -private: - - // default constructor - CLookupMapTileDatabase(); - - // Second phase constructor - void ConstructL( const TDesC& aLookupTableName ); + /** + * Finds an entry in the lookup table for the given maptile name. + * @param[in] aFilePath The lookup item to be found in the database. maptile file path is passed + * @return ETrue if found, else EFalse + */ + bool findEntryByFilePath(const QString& aFilePath); + + /** + * Get all the entries in the lookup table for a given fetching status. + * @param[in] aFetchingState The fetching status to be found in the database. + * @param[out] aLookupItemArray List of lookup items having the fetching status as aFetchingState. + */ + void findEntriesByMapTileFetchingState(const quint32 aFetchingState, + QList& aLookupItemArray); private: // Handle to the items database - RDbNamedDatabase iItemsDatabase; - - // handle to the file session - RFs iFsSession; - - // holds the database file name - TFileName iDbFileName; - - // holds the info about database existence. - TBool iDatabaseExists; + QSqlDatabase *mDb; + + + // Flag to indicate if db is open + bool mDbOpen; }; diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/inc/maptileservice.h --- a/locationdataharvester/maptileservice/inc/maptileservice.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/maptileservice/inc/maptileservice.h Mon Oct 04 00:10:56 2010 +0300 @@ -24,6 +24,7 @@ #include #include #include +#include QTM_BEGIN_NAMESPACE class QValueSpacePublisher; @@ -38,7 +39,6 @@ #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT #endif -class TLookupItem; // CLASS DECLARATION @@ -113,16 +113,24 @@ * Gets a maptile image associated with a id(contact id/calendar id). * Returns a maptile image path if it is available otherwise returns NULL. * - * @param contactId app id - * @param sourceType Source address type( Preferred, Home , Work address ) + * @param id, entry id + * @param sourceType , Source address type( Preferred, Home , Work address ) * @param imagePath Maptile image path associated with the app id * @param orientation Application current orientation. * * @return Returns the maptile fetching status. */ - int getMapTileImage( int Id, AddressType sourceType, + int getMapTileImage( int id, AddressType sourceType, QString& imagePath, Qt::Orientations orientation = Qt::Vertical ); + /** + * keep existing location as per user confirmation . + * @param id ,entry id + * @param sourceType Source address type( Preferred, Home , Work address ) + * @param value ,true if user confirm as yes otherwise false. + */ + void keepExistingLocation(int id ,AddressType sourceType, bool value); + public slots: /** * Receives maptile status information and emits the maptilFetchingStatusUpdate @@ -165,7 +173,7 @@ * @param aNoOfAddress ,number of address read from databse */ int readEntryFromMaptileDataBase( int id, AddressType sourceType, - TLookupItem& aLookupItem, int& aNoOfAddress ); + MaptileLookupItem& aLookupItem, int& aNoOfAddress ); private: diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/maptileservice.pro --- a/locationdataharvester/maptileservice/maptileservice.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/maptileservice/maptileservice.pro Mon Oct 04 00:10:56 2010 +0300 @@ -26,12 +26,14 @@ CONFIG += hb CONFIG += mobility MOBILITY = publishsubscribe +QT += sql DEPENDPATH += . INCLUDEPATH += . INCLUDEPATH += ../inc INCLUDEPATH += ../mylocationlogger/inc + MOC_DIR = moc DEFINES += MAPTILESERVICEDLL @@ -92,3 +94,7 @@ "$${LITERAL_HASH}endif" MMP_RULES += defBlock + + +symbian:MMP_RULES += SMPSAFE + diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/src/maptiledblookuptable.cpp --- a/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -16,211 +16,474 @@ * */ -#include +#include +#include +#include +#include +#include +#include +#include #include +#include "mylocationsdefines.h" #include "maptiledblookuptable.h" // select all from -_LIT( KSelectAllFrom, "SELECT * FROM " ); +const QString KSelectAllFrom( "SELECT * FROM " ); // string 'where' -_LIT( KStringWhere, " WHERE " ); +const QString KWhere( " WHERE " ); // string ' = ' -_LIT( KStringEqual, " = " ); +const QString KEqual( " = " ); + +// string 'AND' +const QString KAnd( " AND " ); +// string 'OR' +const QString KOr( " OR " ); + +// string '( ' +const QString KOpenBrace( "( " ); +// string ' )' +const QString KCloseBrace( " )" ); -// string 'And' -_LIT( KStringAnd, " AND " ); +// Maptile table name +const QString KMaptileLookupTable( "maptilelookup " ); +// column source id +const QString KSourceId( "sourceid" ); +// column source type +const QString KSourceType( "sourcetype" ); +// column maptile path +const QString KFilePath( "filepath" ); +// column fetching status +const QString KStatus( "fetchingstatus" ); - -_LIT(KQueryByMaptileState,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND ( fetchingstatus = %d OR fetchingstatus = %d )"); +// column user setting status +const QString KUserSetting( "usersetting" ); // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::CLookupMapTileDatabase() +// LookupMapTileDatabase::LookupMapTileDatabase() // Default constructor. // ----------------------------------------------------------------------------- // -CLookupMapTileDatabase::CLookupMapTileDatabase() +LookupMapTileDatabase::LookupMapTileDatabase( QObject *parent ) : + QObject( parent ), + mDb( NULL ), + mDbOpen( false ) { + mDb = new QSqlDatabase(); + *mDb = QSqlDatabase::addDatabase( "QSQLITE" ); + mDb->setDatabaseName( KLocationDataLookupDbName ); + if (!mDb->open()) + { + return; + } + + // create lookup table if doesnot exist + QSqlQuery query( *mDb ); + QString queryString; + QTextStream ( &queryString ) << "create table if not exists " << KMaptileLookupTable << KOpenBrace << + KSourceId << " int," << + KSourceType << " int," << + KFilePath << " varchar(255)," << + KStatus << " int ," << + KUserSetting << " bool " << "default 0" << KCloseBrace; + + + query.exec( queryString ); + + mDb->close(); } // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::~CLookupMapTileDatabase() +// LookupMapTileDatabase::~LookupMapTileDatabase() // Destructor. // ----------------------------------------------------------------------------- // -CLookupMapTileDatabase::~CLookupMapTileDatabase() +LookupMapTileDatabase::~LookupMapTileDatabase() { - - // close the database - iItemsDatabase.Close(); - - // close the file session - iFsSession.Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::~CLookupMapTileDatabase() -// Creates an object of this class and pushes to cleanup stack. -// ----------------------------------------------------------------------------- -// -CLookupMapTileDatabase* CLookupMapTileDatabase::NewLC( const TDesC& aLookupTableName ) -{ - - CLookupMapTileDatabase* self = new (ELeave) CLookupMapTileDatabase; - CleanupStack::PushL(self); - self->ConstructL( aLookupTableName ); - return self; + close(); + delete mDb; } +// --------------------------------------------------------- +// LookupMapTileDatabase::open() +// --------------------------------------------------------- +bool LookupMapTileDatabase::open() +{ + if( !mDbOpen ) + { + mDbOpen = mDb->open(); + } + return mDbOpen; +} + +// --------------------------------------------------------- +// LookupMapTileDatabase::close() +// --------------------------------------------------------- +void LookupMapTileDatabase::close() +{ + if( mDbOpen ) + mDb->close(); + mDbOpen = false; +} // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::NewL() -// Creates an object of this class. +// LookupMapTileDatabase::createEntry() +// Creates an entry in the lookup table. // ----------------------------------------------------------------------------- // -CLookupMapTileDatabase* CLookupMapTileDatabase::NewL( const TDesC& aLookupTableName ) +void LookupMapTileDatabase::createEntry( const MaptileLookupItem& aLookupItem ) { - CLookupMapTileDatabase* self = CLookupMapTileDatabase::NewLC( aLookupTableName ); - CleanupStack::Pop( self ); - return self; + if( mDbOpen ) + { + QString queryString; + QTextStream ( &queryString ) << + "INSERT INTO " << KMaptileLookupTable << + KOpenBrace << KSourceId << ", " << KSourceType << ", " << KFilePath << ", " << KStatus << KCloseBrace << + " VALUES " << + KOpenBrace << ":sid" << ", " << ":stype" << ", " << ":path" << ", " << ":status" << KCloseBrace; + + + QSqlQuery query(*mDb); + query.prepare( queryString ); + + query.bindValue(":sid", aLookupItem.iUid); + query.bindValue(":stype", aLookupItem.iSource); + query.bindValue(":path", aLookupItem.iFilePath); + query.bindValue(":status", aLookupItem.iFetchingStatus); + query.exec(); + } } - // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::ConstructL() -// 2nd phase contructor. +// LookupMapTileDatabase::updateEntry() +// Updates an entry in the lookup table. // ----------------------------------------------------------------------------- // -void CLookupMapTileDatabase::ConstructL( const TDesC& aLookupTableName ) +void LookupMapTileDatabase::updateEntry( const MaptileLookupItem& aLookupItem ) { - - User::LeaveIfError( iFsSession.Connect() ); + if( mDbOpen ) + { + QString queryString; //UPDATE maptilelookup SET filepath = ?, status = ? WHERE sourceid = ? AND sourcetype = ?" + QTextStream ( &queryString ) << + "UPDATE " << KMaptileLookupTable << " SET " << + KFilePath << " = ?, " << KStatus << " = ? ," << KUserSetting << " = ? " << + KWhere << + KSourceId << " = ? " << KAnd << KSourceType << " = ? "; + + QSqlQuery query(*mDb); + query.prepare( queryString ); - iDbFileName.Copy( KLookupDbPath ); - iDbFileName.Append( aLookupTableName ); - - iDatabaseExists = EFalse; - - if( BaflUtils::FileExists( iFsSession, iDbFileName ) ) - { - // database exists - iDatabaseExists = ETrue; + query.addBindValue( aLookupItem.iFilePath ); + query.addBindValue( aLookupItem.iFetchingStatus ); + query.addBindValue( false ); + query.addBindValue( aLookupItem.iUid ); + query.addBindValue( aLookupItem.iSource ); + query.exec(); } } // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::FindNumberOfAddressL() +// LookupMapTileDatabase::deleteEntry() +// Deletes an entry from the lookup table. +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::deleteEntry(MaptileLookupItem& aLookupItem) +{ + if( mDbOpen ) + { + QString queryString; // DELETE FROM lplookup WHERE sourceid = ? AND sourcetype = ?" + QTextStream ( &queryString ) << + "DELETE FROM " << KMaptileLookupTable << + KWhere << + KSourceId << " = ? " << KAnd << KSourceType << " = ? "; + + QSqlQuery query(*mDb); + query.prepare( queryString ); + + query.addBindValue( aLookupItem.iUid ); + query.addBindValue( aLookupItem.iSource ); + + query.exec(); + } +} + + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::deleteMapTile() +// Deletes an maptile if there's no reference to maptile in lookupdb +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::deleteMapTile( const MaptileLookupItem& aLookupItem) +{ + if( mDbOpen ) + { + QString queryString; // "SELECT filepath FROM maptilelookuptable WHERE filepath = ?" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KFilePath << KEqual << " ? " ; + QSqlQuery query(*mDb); + query.prepare( queryString ); + query.addBindValue( aLookupItem.iFilePath ); + + query.exec(); + + // Delete if no reference to maptile + if ( !query.first() ) + { + //delete all releted maptile + QString temp = aLookupItem.iFilePath; + temp.append(MAPTILE_IMAGE_PORTRAIT); + QFile file; + file.remove(temp); + + temp = aLookupItem.iFilePath; + temp.append(MAPTILE_IMAGE_CONTACT); + temp.append(MAPTILE_IMAGE_LANDSCAPE); + file.remove(temp); + + temp = aLookupItem.iFilePath; + temp.append(MAPTILE_IMAGE_CALENDAR); + temp.append(MAPTILE_IMAGE_LANDSCAPE); + file.remove(temp); + + temp = aLookupItem.iFilePath; + temp.append(MAPTILE_IMAGE_HURRIGANES); + file.remove(temp); + + } + } +} + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::findEntriesByMapTileFetchingStatus() +// Finds a list of lookup items given a fetching status. +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::findEntriesByMapTileFetchingState(const quint32 aFetchingState, + QList& aLookupItemArray) +{ + if( mDbOpen ) + { + QString queryString; // "SELECT * FROM maptilelookuptable WHERE fetchingstatus = %d" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KStatus << KEqual << " ? " ; + QSqlQuery query(*mDb); + query.prepare( queryString ); + query.addBindValue( aFetchingState ); + + query.exec(); + + while( query.next() ) + { + QSqlRecord rec = query.record(); + MaptileLookupItem lookupItem; + lookupItem.iUid = query.value( rec.indexOf( KSourceId ) ).toUInt(); + lookupItem.iSource = query.value( rec.indexOf( KSourceType ) ).toUInt(); + lookupItem.iFilePath = query.value( rec.indexOf( KFilePath ) ).toString(); + lookupItem.iFetchingStatus = query.value( rec.indexOf( KStatus ) ).toUInt(); + lookupItem.iUserSetting = query.value( rec.indexOf( KUserSetting ) ).toBool(); + aLookupItemArray.append( lookupItem ); + } + } +} + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::getAllCalendarIds() +// Gets the list of calendar ids . +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::getAllCalendarIds( QList& aIdArray ) +{ + if( mDbOpen ) + { + QString queryString; // "SELECT cntuid FROM maptilelookuptable WHERE sourcetype = %d"); + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KSourceType << KEqual << " ? " ; + QSqlQuery query(*mDb); + query.prepare( queryString ); + query.addBindValue( ESourceCalendar ); + + query.exec(); + + while( query.next() ) + { + QSqlRecord rec = query.record(); + quint32 id = query.value( rec.indexOf( KSourceId ) ).toUInt(); + aIdArray.append( id ); + } + } +} + + + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::resetEntry() +// Reset the entry with null value and get the used maptile path as part of aLookupItem. +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::resetEntry(MaptileLookupItem &aLookupItem) +{ + if( mDbOpen ) + { + // getEntry will replace the fetching status. so copy fetching status to temparory variable. + quint32 tempStatus = aLookupItem.iFetchingStatus; + + if( getEntry( aLookupItem ) ) + { + // set file path to nullstring + aLookupItem.iFilePath = ""; + aLookupItem.iFetchingStatus = tempStatus; + // update entry in db + updateEntry( aLookupItem ); + } + } +} + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::findNumberOfAddress() // find the number of address associated with the aId. // ----------------------------------------------------------------------------- // -int CLookupMapTileDatabase::FindNumberOfAddressL( int& aId ) +int LookupMapTileDatabase::findNumberOfAddress( int& aId ) { int count = 0; - - // Create a query to find the item. - TFileName queryBuffer; - queryBuffer.Format( KQueryByMaptileState,aId, - MapTileService::MapTileFetchingInProgress, - MapTileService::MapTileFetchingNetworkError ); - - TInt ret = iItemsDatabase.Open( iFsSession, iDbFileName ); - - if( ret != KErrNone ) - { - //if already opened , close and open again - iItemsDatabase.Close(); - User::LeaveIfError( iItemsDatabase.Open( iFsSession, iDbFileName ) ); + + if( mDbOpen ) + { + QString queryString; // "SELECT * FROM maptilelookup WHERE sourceid = aId AND ( fetchingstatus = MapTileFetchingInProgress OR fetchingstatus = MapTileFetchingNetworkError )" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KSourceId << KEqual << aId << + KAnd << + KOpenBrace << KStatus << KEqual << MapTileService::MapTileFetchingInProgress << + KOr << KStatus << KEqual << MapTileService::MapTileFetchingNetworkError << KCloseBrace ; + QSqlQuery query(*mDb); + query.exec( queryString ); + while( query.next() ) count++; } - User::LeaveIfError( iItemsDatabase.Begin() ); - // Create a view of the table with the above query. - RDbView myView; - myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) ); - CleanupClosePushL( myView ); - myView.EvaluateAll(); - myView.FirstL(); - - - while (myView.AtRow()) - { - count++; - myView.NextL(); - } - - CleanupStack::PopAndDestroy( &myView ); // myView - - //Close the database - iItemsDatabase.Close(); - return count; } // ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::FindEntryL() +// LookupMapTileDatabase::findEntry() // Finds an entry in the lookup table. // ----------------------------------------------------------------------------- // -void CLookupMapTileDatabase::FindEntryL( TLookupItem& aLookupItem ) +bool LookupMapTileDatabase::findEntry( const MaptileLookupItem& aLookupItem ) { - - // used to check whether entry available or not - TBool entryAvailable = EFalse; - - if ( iDatabaseExists ) + if( mDbOpen ) { + QString queryString; // "SELECT * FROM maptilelookup WHERE sourceid = aLookupItem.iUid AND sourcetype = aLookupItem.iSource" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KSourceId << KEqual << aLookupItem.iUid << + KAnd << + KSourceType << KEqual << aLookupItem.iSource ; + QSqlQuery query(*mDb); + query.exec( queryString ); + + if ( query.first() ) + { + return true; + } + } + return false; +} - // Create a query to find the item. - TFileName queryBuffer; - queryBuffer.Copy( KSelectAllFrom ); - queryBuffer.Append( KMapTileLookupTable ); - queryBuffer.Append( KStringWhere ); - queryBuffer.Append( NCntColUid ); - queryBuffer.Append( KStringEqual ); - queryBuffer.AppendNum( aLookupItem.iUid ); - queryBuffer.Append( KStringAnd ); - queryBuffer.Append( NColSource ); - queryBuffer.Append( KStringEqual ); - queryBuffer.AppendNum( aLookupItem.iSource ); +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::getEntry() +// Gets a lookup item from the lookup table using source id and type. +// ----------------------------------------------------------------------------- +// +bool LookupMapTileDatabase::getEntry( MaptileLookupItem& aLookupItem ) +{ + if( mDbOpen ) + { + QString queryString; // "SELECT * FROM maptilelookup WHERE sourceid = aLookupItem.iUid AND sourcetype = aLookupItem.iSource" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KSourceId << KEqual << aLookupItem.iUid << + KAnd << + KSourceType << KEqual << aLookupItem.iSource ; + QSqlQuery query(*mDb); + query.exec( queryString ); - TInt ret = iItemsDatabase.Open( iFsSession, iDbFileName ); - - if( ret != KErrNone ) - { - //if already opened , close and open again - iItemsDatabase.Close(); - User::LeaveIfError( iItemsDatabase.Open( iFsSession, iDbFileName ) ); + if ( query.first() ) + { + QSqlRecord rec = query.record(); + aLookupItem.iFilePath = query.value( rec.indexOf( KFilePath ) ).toString(); + aLookupItem.iFetchingStatus = query.value( rec.indexOf( KStatus ) ).toUInt(); + aLookupItem.iUserSetting = query.value( rec.indexOf( KUserSetting ) ).toBool(); + return true; + } - User::LeaveIfError( iItemsDatabase.Begin() ); - // Create a view of the table with the above query. - RDbView myView; - myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) ); - CleanupClosePushL( myView ); - myView.EvaluateAll(); - myView.FirstL(); + } + return false; +} + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::findEntryByFilePath() +// Finds an entry in the lookup table for maptile image file +// ----------------------------------------------------------------------------- +// +bool LookupMapTileDatabase::findEntryByFilePath( const QString& aFilePath ) +{ + if( mDbOpen ) + { + QString queryString; // "SELECT filepath FROM maptilelookuptable WHERE filepath = ?" + QTextStream ( &queryString ) << + KSelectAllFrom << KMaptileLookupTable << + KWhere << + KFilePath << KEqual << " ? " ; + QSqlQuery query(*mDb); + query.prepare( queryString ); + query.addBindValue( aFilePath ); + + query.exec(); + + if( query.first() ) + { + return true; + } + } - if( myView.AtRow() ) - { - // Item found. get the details. - myView.GetL(); - if( aLookupItem.iUid == myView.ColUint( KColumnUid ) ) - { - aLookupItem.iFilePath.Copy( myView.ColDes16( KColumnFilePath ) ); - aLookupItem.iFetchingStatus = myView.ColUint( KColumnMapTileFetchingStatus ); - entryAvailable = ETrue; - } - } - - CleanupStack::PopAndDestroy( &myView ); // myView - - //Close the database - iItemsDatabase.Close(); - } - - //No entry found - if( !entryAvailable ) + return false; +} + +// ----------------------------------------------------------------------------- +// LookupMapTileDatabase::updateUserSetting() +// Updates an entry in the lookup table. +// ----------------------------------------------------------------------------- +// +void LookupMapTileDatabase::updateUserSetting( const MaptileLookupItem& aLookupItem ) +{ + if( mDbOpen ) { - User::Leave( KErrNotFound ); + + QString queryString; + QTextStream ( &queryString ) << + "UPDATE " << KMaptileLookupTable << " SET " << + KStatus << " = ? ," << KUserSetting << " = ? " << + KWhere << + KSourceId << " = ? " << KAnd << KSourceType << " = ? "; + + QSqlQuery query(*mDb); + query.prepare( queryString ); + query.addBindValue( aLookupItem.iFetchingStatus ); + query.addBindValue( aLookupItem.iUserSetting ); + query.addBindValue( aLookupItem.iUid ); + query.addBindValue( aLookupItem.iSource ); + query.exec(); } } diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/maptileservice/src/maptileservice.cpp --- a/locationdataharvester/maptileservice/src/maptileservice.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/maptileservice/src/maptileservice.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -25,6 +25,7 @@ #include "mylocationlogger.h" #include "maptileservice.h" +#include "mylocationsdefines.h" #include "maptiledblookuptable.h" #include // CONSTANTS @@ -33,6 +34,7 @@ // Central Repository Key IDs const TInt KEnableLocationFeature = 0x1; +const TInt KMaptileDbSyncState = 0x2; const char *MAPTILE_STATUS_RECEIVER = "/maptilestatuspublisher/name"; const char *MAPTILE_STATUS_PUBLISHER = "/maptilecontactpublisher"; @@ -129,12 +131,25 @@ { __TRACE_CALLSTACK; - TLookupItem lookupItem; + if ( sourceType == AddressPlain ){ + CRepository* centralRepository = NULL; + TRAP_IGNORE( centralRepository = CRepository::NewL( KUidMapTileInterface ) ); + int repValue=0; + if(centralRepository){ + centralRepository->Get( KMaptileDbSyncState , repValue ); + delete centralRepository; + if(repValue == 1){ + publishCalEntry( id ); + return MapTileFetchingInProgress; + } + } + } + MaptileLookupItem lookupItem; int addressCount = 0; int maptileStatus = MapTileFetchingUnknownError; - - int error = readEntryFromMaptileDataBase( id, sourceType, lookupItem, addressCount ); + int error; + error = readEntryFromMaptileDataBase( id, sourceType, lookupItem, addressCount ); //if entry available returns the file path otherwise NULL. if ( KErrNone == error ) @@ -146,8 +161,7 @@ if( maptileStatus == MapTileFetchingCompleted ) { //Get the image path - QString imageFile((QChar*)lookupItem.iFilePath.Ptr(), - lookupItem.iFilePath.Length()); + QString imageFile(lookupItem.iFilePath); imagePath = imageFile; if( orientation == Qt::Vertical ) @@ -346,43 +360,45 @@ // ----------------------------------------------------------------------------- // int MapTileService::readEntryFromMaptileDataBase( - int id, AddressType sourceType, TLookupItem& aLookupItem, int& aNoOfAddress ) + int id, AddressType sourceType, MaptileLookupItem& aLookupItem, int& aNoOfAddress ) { + TInt err = KErrUnknown; + //Maptile database instance - CLookupMapTileDatabase* mapTileDatabase = NULL; - - TRAPD( err, mapTileDatabase = CLookupMapTileDatabase::NewL( - KMapTileLookupDatabaseName ) ); + LookupMapTileDatabase* mapTileDatabase = new LookupMapTileDatabase(); - if ( KErrNone == err ) + if ( mapTileDatabase ) { - TRAP( err,aNoOfAddress = mapTileDatabase->FindNumberOfAddressL(id) ); - MYLOCLOGSTRING1("no of address FindNumberOfAddressL returns - %d ", err ); - if ( KErrNone == err ) + if( mapTileDatabase->open() ) { - aLookupItem.iUid = id; - switch (sourceType) - { - case AddressPlain: - aLookupItem.iSource = ESourceCalendar; - break; - case AddressPreference: - aLookupItem.iSource = ESourceContactsPref; - break; - case AddressWork: - aLookupItem.iSource = ESourceContactsWork; - break; - case AddressHome: - aLookupItem.iSource = ESourceContactsHome; - break; - default: - break; - } - - TRAP( err , mapTileDatabase->FindEntryL( aLookupItem ) ); - - MYLOCLOGSTRING1("getMapTileImage FindEntryL returns - %d ", err ); + err = KErrNone; + aNoOfAddress = mapTileDatabase->findNumberOfAddress(id); + aLookupItem.iUid = id; + switch (sourceType) + { + case AddressPlain: + aLookupItem.iSource = ESourceCalendar; + break; + case AddressPreference: + aLookupItem.iSource = ESourceContactsPref; + break; + case AddressWork: + aLookupItem.iSource = ESourceContactsWork; + break; + case AddressHome: + aLookupItem.iSource = ESourceContactsHome; + break; + default: + break; + } + + if( !mapTileDatabase->getEntry( aLookupItem ) ) + { + err = KErrNotFound; + } + + MYLOCLOGSTRING1("getMapTileImage getEntry returns - %d ", err ); } //delet the database instance delete mapTileDatabase; @@ -391,4 +407,38 @@ return err; } + +// ----------------------------------------------------------------------------- +// MapTileService::keepExistingLocation() +// update the map tile table user setting status according to user setting status +// ----------------------------------------------------------------------------- +// +void MapTileService::keepExistingLocation(int id ,AddressType sourceType, bool value) +{ + //Maptile database instance + LookupMapTileDatabase mapTileDatabase ; + switch(sourceType) + { + case AddressPlain: + { + if( mapTileDatabase.open() ) + { + MaptileLookupItem lookupItem; + lookupItem.iUid=id; + lookupItem.iSource=sourceType; + mapTileDatabase.getEntry(lookupItem); + lookupItem.iUserSetting=value; + if(!value) + { + lookupItem.iFetchingStatus=MapTileFetchingInProgress; + } + mapTileDatabase.updateUserSetting(lookupItem); + } + break; + } + default: + break; + } + +} // End of file diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h --- a/locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h Mon Oct 04 00:10:56 2010 +0300 @@ -119,8 +119,21 @@ * @return , true for match case . */ IMPORT_C TBool CheckIfAddressChanged(const TDesC& aAddress, - const TUint32 aId, const TUidSourceType aAddressType); + const TUint32 aId, const TUidSourceType aAddressType); + /** + * Updates the calendar entry + * @param aId , id of the caleentry + * @param aChangeType , changetype of the calendar entry + * @param aLocation , location details of the calendar entry + */ + IMPORT_C void UpdateCalendarLocationById(const TUint32 aUid, const TUint32 aChangeType,const TDesC& aLocation); + + /** + * gets all the calendar entry + * @param aCalEntryArray , refference to all entry + */ + IMPORT_C void GetAllCalendarEntry(QList& aCalEntryArray); #ifdef LOCATION_DATA_HARVESTER_UNIT_TEST public: diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro --- a/locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro Mon Oct 04 00:10:56 2010 +0300 @@ -68,3 +68,6 @@ + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp --- a/locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -33,6 +33,7 @@ #include #include +#include // separator _LIT( KSeparator, ","); // space @@ -288,11 +289,6 @@ lookupItem.mIsDuplicate = 0; lookupItem.mIconPath = ""; lookupItem.mMapTilePath = ""; - lookupItem.mSingleLineAddress=""; - TPtrC16 dataPtr; - aLandmark->GetPositionField(EPositionFieldComment ,dataPtr); - lookupItem.mSingleLineAddress=QString::fromUtf16(dataPtr.Ptr(), - dataPtr.Length()); //fill address into lookup item. FillLookupItemAddressDetails( aLandmark, lookupItem ); @@ -392,10 +388,6 @@ lookupItem.mSourceUid = aUid; lookupItem.mSourceType = aSourceType; lookupItem.mIconType = QLookupItem::EIconTypeDefault; - TPtrC16 dataPtr; - aLandmark->GetPositionField(EPositionFieldComment ,dataPtr); - lookupItem.mSingleLineAddress=QString::fromUtf16(dataPtr.Ptr(), - dataPtr.Length()); // Behavior: If an entry is modified, // If this entry is not present in lookup table. add the entry and update the landmarks db. @@ -1146,7 +1138,46 @@ { compareStatus= EFalse; } + else + { + iLocationAppLookupDb->updateCalendarLocationById(aId,source); + } return compareStatus; } +// ----------------------------------------------------------------------------- +// CMyLocationsDatabaseManager::UpdateCalendarLocationById() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMyLocationsDatabaseManager::UpdateCalendarLocationById(const TUint32 aUid, const TUint32 aChangeType,const TDesC& aLocation) +{ + + + switch (aChangeType) + { + case EEntryAdded: + case EEntryModified: + + { + QString location = QString( (QChar*)aLocation.Ptr(), aLocation.Length()); + iLocationAppLookupDb->updateCalendarLocationById(aUid,location); + break; + } + case EEntryDeleted: + { + iLocationAppLookupDb->deleteCalendarEntry(aUid); + break; + } + } +} + +// ----------------------------------------------------------------------------- +// CMyLocationsDatabaseManager::GetAllCalendarEntry() +// ----------------------------------------------------------------------------- +// +EXPORT_C void CMyLocationsDatabaseManager::GetAllCalendarEntry(QList& aCalEntryArray) +{ + iLocationAppLookupDb->getAllCalendarEntry(aCalEntryArray); +} + // End of file diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h --- a/locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h Thu Sep 02 20:20:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Maptile database lookup table header. -* -*/ - -#ifndef __LOOKUPMAPTILEDB_H__ -#define __LOOKUPMAPTILEDB_H__ - -//Headers needed -#include //RFs -#include //RDbNamedDatabase,RDbView - -#include "mylocationsdefines.h" - -/** - * CLookupMapTileDatabase class. - * This class handles all the operations related to maptile lookup database. - * - */ - -class CLookupMapTileDatabase : public CBase -{ -public: - // Two phase constructors - - /** - * This is a static function, which creates and returns an instance of this class. - */ - static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName ); - - /** - * This is a static function, which creates and returns an instance of this class. Pushes the created object - * to the cleanup stack. - */ - static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName ); - - /** - * Destructor - */ - ~CLookupMapTileDatabase(); - -public: - - /** - * Opens the lookup database. - */ - TInt Open(); - - /** - * Closes the lookup database. - */ - void Close(); - - /** - * Creates an entry in the lookup table. - * @param[in] aLookupItem The lookup item to be created in the database. - */ - void CreateEntryL( const TLookupItem& aLookupItem ); - - /** - * Updates an entry in the lookup table. - * @param[in] aLookupItem The lookup item to be updated in the database. - */ - void UpdateEntryL( const TLookupItem& aLookupItem ); - - /** - * Deletes an entry from the lookup table. - * @param[in] aLookupItem The lookup item to be deleted from the database. - */ - void DeleteEntryL( TLookupItem& aLookupItem ); - - /** - * Deletes maptile from the repository if the ref to that maptile in the db reaches one - * @param[in] aLookupItem The lookup item containing the path to the maptile - */ - void DeleteMapTileL( const TLookupItem& aLookupItem ); - - /** - * Finds an entry in the lookup table. - * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid is passed - * in the lookup item - * @return ETrue if found, else EFalse - */ - TBool FindEntryL( TLookupItem& aLookupItem); - - /** - * Finds an entry in the lookup table for the given maptile name. - * @param[in] aFilePath The lookup item to be found in the database. maptile file path is passed - * @return ETrue if found, else EFalse - */ - TBool FindEntryByFilePathL(const TDesC& aFilePath); - - void FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState, - RArray& aLookupItemArray); - - /** - * Gets the list of calendar ids. - * @param[out] aIdArray Calendar id list - */ - void GetAllCalendarIdsL( RArray& aIdArray ); - - /** - * ReSet the entry in the lookup table , with null value - * @param aLookupItem The lookup item entry to be reseted in the database, - * get the used maptile path as part of lookupItem filepath , to free the resource - */ - void ReSetEntryL( TLookupItem &aLookupItem ); -private: - - // default constructor - CLookupMapTileDatabase(); - - // Second phase constructor - void ConstructL( const TDesC& aLookupTableName ); - - // Creates a lookup table in the lookup database. - void CreateTableL(RDbDatabase& aDatabase); - -private: - - // Handle to the items database - RDbNamedDatabase iItemsDatabase; - - // handle to the file session - RFs iFsSession; - - // holds the database file name - TFileName iDbFileName; - -}; - - -#endif // __LOOKUPMAPTILEDB_H__ - -// End of file - diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/inc/mylocationsengine.h --- a/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Mon Oct 04 00:10:56 2010 +0300 @@ -35,9 +35,9 @@ #include // mylocations database manager +#include "maptiledblookuptable.h" #include "maptileinterface.h" #include "mylocationsdatabasemanager.h" -#include "lookupmaptiledb.h" #include "calendernotification.h" #include "mylocationgeotagtimerao.h" class GeocodeUpdate; @@ -156,6 +156,15 @@ private: #endif + //cenrep setting for db in sync state. + enum TCenrepSetting + { + //get the value + EMapTileDbStatusGet=0, + //set the value + EMapTileDbStatusSet + }; + /** * ConstructL. * 2nd phase constructor. @@ -198,7 +207,7 @@ * @param aLookupItem Provides information about single address of contact. */ void UpdateMaptileDatabaseL(TInt aEventType , - TLookupItem& aLookupItem ); + MaptileLookupItem& aLookupItem ); /** * Handles active object's request completion event. @@ -259,6 +268,11 @@ void RefreshCalendarEntryListL(); /** + * Deletes invalid calendar entries from mylocation databases. + */ + void DeleteInvalidCalendarEntriesL(); + + /** * Returns True if a calendar entry is available for a given id. */ TBool IsCalendarEntryValidL( TUint32 aId ); @@ -291,7 +305,7 @@ /** * maptile database manipulation. */ - void ManipulateMapTileDataBaseL(TLookupItem& aLookupItem); + void ManipulateMapTileDataBaseL(MaptileLookupItem& aLookupItem); /** * Crop and create multiple maptile images for different applications requirements. @@ -307,6 +321,20 @@ /**Get the contact name for this perticular id. */ void GetContactName( TInt32 iUId , TDes& aName ); + + /** + * Publishing the entry after maptile db modification. + * @param aUid, entry id + * @param aLookupItem, all entry details + */ + void PublishEntry(TInt32 aUId, MaptileLookupItem& aLookupItem); + + /** + * Get/Set the maptile db status + * @param aSettingType, Type of setting + * @param aValue, Value for the key + */ + void MaptileDbSyncStatusL(const TCenrepSetting& aSettingType, TInt& aValue); public: //From MMapTileObserver @@ -365,7 +393,7 @@ CMyLocationsDatabaseManager* iMyLocationsDatabaseManager; //maptiledb - CLookupMapTileDatabase* iMaptileDatabase; + LookupMapTileDatabase* iMaptileDatabase; //Current event type TInt iEventType; diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/mylocationsengine.pro --- a/locationdataharvester/mylocationsengine/mylocationsengine.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsengine/mylocationsengine.pro Mon Oct 04 00:10:56 2010 +0300 @@ -1,3 +1,19 @@ +//==== +# +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# TEMPLATE=app TARGET=mylocationsengine @@ -10,6 +26,7 @@ INCLUDEPATH += ../geocodeupdate/inc INCLUDEPATH += ../mylocationlogger/inc INCLUDEPATH += ../mylocationsdatabasemanager/inc +INCLUDEPATH += ../maptileservice/inc INCLUDEPATH += /epoc32/include/app @@ -35,9 +52,11 @@ -lQtContacts \ -lgeocodeupdate \ -lecom \ + -lcentralrepository \ -lcalinterimapi \ -llocationdatalookupdb \ - -lmylocationsdatabasemanager + -lmylocationsdatabasemanager \ + -lmaptileservice myCrml.sources = ./conf/maptilestatuspublisher.qcrml @@ -49,7 +68,6 @@ SOURCES += src/appmain.cpp \ src/mylocationsengine.cpp \ src/maptileinterface.cpp \ - src/lookupmaptiledb.cpp \ src/calendernotification.cpp \ src/mylocationgeotagtimerao.cpp \ src/contactsubscriber.cpp \ @@ -58,7 +76,6 @@ HEADERS += inc/appmain.h \ inc/mylocationsengine.h \ inc/maptileinterface.h \ - inc/lookupmaptiledb.h \ inc/calendernotification.h \ inc/mylocationgeotagtimerao.h \ inc/contactsubscriber.h \ @@ -67,3 +84,6 @@ + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp --- a/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp Thu Sep 02 20:20:42 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,607 +0,0 @@ -/* -* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Maptile database lookup table source implementation. -* -*/ -#include -#include - -#include -#include -#include "mylocationlogger.h" -#include "lookupmaptiledb.h" - -_LIT( KSelectAllFrom, "SELECT * FROM " ); -_LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d"); -_LIT(KQueryGetCalendaIds,"SELECT cntuid FROM cntmaptilelookuptable WHERE source = %d"); -_LIT( KSelectfilepathFrom, "SELECT filepath FROM " ); -_LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'"); -// string 'where' -_LIT( KStringWhere, " WHERE " ); -// string ' = ' -_LIT( KStringEqual, " = " ); - -_LIT(KQueryByMaptileFetchingState,"SELECT * FROM cntmaptilelookuptable WHERE fetchingstatus = %d"); - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::CLookupMapTileDatabase() -// Default constructor. -// ----------------------------------------------------------------------------- -// -CLookupMapTileDatabase::CLookupMapTileDatabase() -{ -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::~CLookupMapTileDatabase() -// Destructor. -// ----------------------------------------------------------------------------- -// -CLookupMapTileDatabase::~CLookupMapTileDatabase() -{ - __TRACE_CALLSTACK;// close the database - iItemsDatabase.Close(); - // close the file session - iFsSession.Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::~CLookupMapTileDatabase() -// Creates an object of this class and pushes to cleanup stack. -// ----------------------------------------------------------------------------- -// -CLookupMapTileDatabase* CLookupMapTileDatabase::NewLC( - const TDesC& aLookupTableName) -{ - CLookupMapTileDatabase* self = new (ELeave) CLookupMapTileDatabase; - CleanupStack::PushL(self); - self->ConstructL(aLookupTableName); - return self; -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::NewL() -// Creates an object of this class. -// ----------------------------------------------------------------------------- -// -CLookupMapTileDatabase* CLookupMapTileDatabase::NewL( - const TDesC& aLookupTableName) -{ - CLookupMapTileDatabase* self = CLookupMapTileDatabase::NewLC( - aLookupTableName); - CleanupStack::Pop(self); - return self; -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::ConstructL() -// 2nd phase contructor. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::ConstructL(const TDesC& aLookupTableName) -{ - __TRACE_CALLSTACK; - User::LeaveIfError(iFsSession.Connect()); - - //create private path - User::LeaveIfError(iFsSession.CreatePrivatePath(RFs::GetSystemDrive())); - // private path with no drive on it - iFsSession.PrivatePath(iDbFileName); - - TFindFile PrivFolder(iFsSession); - // find out the drive - if (KErrNone == PrivFolder.FindByDir(iDbFileName, KNullDesC)) - { - iFsSession.MkDir(KLookupDbPath); - iDbFileName.Copy(KLookupDbPath); - iDbFileName.Append(aLookupTableName); - - if (!BaflUtils::FileExists(iFsSession, iDbFileName)) - { // no database exists so we make one - User::LeaveIfError(iItemsDatabase.Create(iFsSession, iDbFileName)); - // and will create the only table needed for it - CreateTableL(iItemsDatabase); - - //close the database - iItemsDatabase.Close(); - } - } -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::Open() -// Opens the lookup database. -// ----------------------------------------------------------------------------- -// -TInt CLookupMapTileDatabase::Open() -{ - __TRACE_CALLSTACK; - return iItemsDatabase.Open(iFsSession, iDbFileName); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::Close() -// Closes the lookup database. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::Close() -{ - __TRACE_CALLSTACK; - iItemsDatabase.Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::CreateTableL() -// Creates a lookup table. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::CreateTableL(RDbDatabase& aDatabase) -{ - __TRACE_CALLSTACK;// Create a table definition - CDbColSet* columns = CDbColSet::NewLC(); - - // Add Columns - - // Add uid column - columns->AddL(TDbCol(NCntColUid, EDbColUint32)); - - columns->AddL(TDbCol(NColSource, EDbColUint32)); - - // add file path type column - columns->AddL(TDbCol(NCntColFilePath, EDbColText16)); - - //MK - // add map tile fetching status to the db - columns->AddL(TDbCol(MapTileFetchingStatus, EDbColUint32)); - - - // Create a table - User::LeaveIfError(aDatabase.CreateTable(KMapTileLookupTable, *columns)); - - // cleanup the column set - CleanupStack::PopAndDestroy(columns); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::CreateEntryL() -// Creates an entry in the lookup table. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::CreateEntryL(const TLookupItem& aLookupItem) -{ - __TRACE_CALLSTACK;// create a query for the view - TFileName queryBuffer; - queryBuffer.Copy(KSelectAllFrom); - queryBuffer.Append(KMapTileLookupTable); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - - } - iItemsDatabase.Begin(); - - RDbView myView; - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - - // Inert the item - myView.InsertL(); - // set the fields - myView.SetColL(KColumncntUid, aLookupItem.iUid); - myView.SetColL(KColumnSource, aLookupItem.iSource); - myView.SetColL(KColumnFilePath, aLookupItem.iFilePath); - myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK - - myView.PutL(); - - CleanupStack::PopAndDestroy(&myView); // myView - iItemsDatabase.Commit(); - Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::ReSetEntryL() -// Reset the entry with null value and get the used maptile path as part of aLookupItem. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::ReSetEntryL(TLookupItem &aLookupItem) -{ - TFileName queryBuffer; - queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource); - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - iItemsDatabase.Begin(); - - // Create a view of the table based on the query created. - RDbView myView; - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - - myView.EvaluateAll(); - myView.FirstL(); - - if (myView.AtRow()) - { - myView.GetL(); - aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath)); - // found the entry. update it. - myView.UpdateL(); - myView.SetColL(KColumnFilePath, KNullDesC); - myView.SetColL(KColumnMapTileFetchingStatus, - aLookupItem.iFetchingStatus); //MK - myView.PutL(); - } - - CleanupStack::PopAndDestroy(&myView); // myView - iItemsDatabase.Commit(); - - Close(); -} -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::UpdateEntryL() -// Updates an entry in the lookup table. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::UpdateEntryL(const TLookupItem& aLookupItem) -{ - __TRACE_CALLSTACK;// Create the query to find the row to be updated. - TFileName queryBuffer; - queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource); - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - iItemsDatabase.Begin(); - - // Create a view of the table based on the query created. - RDbView myView; - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - - myView.EvaluateAll(); - myView.FirstL(); - - if (myView.AtRow()) - { - // found the entry. update it. - myView.UpdateL(); - myView.SetColL(KColumnFilePath, aLookupItem.iFilePath); - myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK - myView.PutL(); - } - - CleanupStack::PopAndDestroy(&myView); // myView - iItemsDatabase.Commit(); - - Close(); - -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::DeleteEntryL() -// Deletes an entry from the lookup table. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::DeleteEntryL(TLookupItem& aLookupItem) -{ - __TRACE_CALLSTACK;// Create the query to find the row to be deleted. - - TFileName queryBuffer; - queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - iItemsDatabase.Begin(); - - RDbView myView; - // query buffer finds only the selected item row. - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - - myView.EvaluateAll(); - - // positions the cursor on the first row of the rowset - myView.FirstL(); - - // Delete the entry found. - if (myView.AtRow()) - { - myView.GetL(); - if (aLookupItem.iUid == myView.ColUint(KColumncntUid)) - { - aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath)); - - } - myView.DeleteL(); - } - - CleanupStack::PopAndDestroy(&myView); // myView - iItemsDatabase.Commit(); - // compacts the databse, by physicaly removing deleted data. - iItemsDatabase.Compact(); - - Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::DeleteMapTileL() -// Deletes an maptile if there's no reference to maptile in lookupdb -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::DeleteMapTileL( const TLookupItem& aLookupItem) -{ - __TRACE_CALLSTACK;// Create the query to find the row to be deleted. - - TFileName queryBuffer; - queryBuffer.Format(KQueryMaptile, &aLookupItem.iFilePath); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - - iItemsDatabase.Begin(); - - RDbView myView; - // query buffer finds only the selected item row. - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - - myView.EvaluateAll(); - - // positions the cursor on the first row of the rowset - myView.FirstL(); - - // Delete if no reference to maptile - if (!myView.AtRow()) - { - QString filePath = QString::fromUtf16( aLookupItem.iFilePath.Ptr(), aLookupItem.iFilePath.Length() ); - //delete all releted maptile - QString temp=filePath; - temp.append(MAPTILE_IMAGE_PORTRAIT); - QFile file; - file.remove(temp); - - temp=filePath; - temp.append(MAPTILE_IMAGE_CONTACT); - temp.append(MAPTILE_IMAGE_LANDSCAPE); - file.remove(temp); - - temp=filePath; - temp.append(MAPTILE_IMAGE_CALENDAR); - temp.append(MAPTILE_IMAGE_LANDSCAPE); - file.remove(temp); - - temp=filePath; - temp.append(MAPTILE_IMAGE_HURRIGANES); - file.remove(temp); - - // ret = iFsSession.Delete(aLookupItem.iFilePath); - } - - CleanupStack::PopAndDestroy(&myView); // myView - - Close(); -} - - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::FindEntriesByMapTileFetchingStatusL() -// Finds a list of lookup items given a landmark uid. -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState, - RArray& aLookupItemArray) -{ - __TRACE_CALLSTACK;// Create a query to find the item. - TFileName queryBuffer; - queryBuffer.Format(KQueryByMaptileFetchingState,aFetchingState); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - iItemsDatabase.Begin(); - - - // Create a view of the table with the above query. - RDbView myView; - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - myView.EvaluateAll(); - myView.FirstL(); - - while (myView.AtRow()) - { - // Item found. get the details. - myView.GetL(); - TLookupItem newItem; - newItem.iUid = myView.ColUint(KColumnUid); - newItem.iSource = myView.ColUint(KColumnSource); - aLookupItemArray.Append(newItem); - myView.NextL(); - } - - CleanupStack::PopAndDestroy(&myView); // myView -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::GetAllCalendarIdsL() -// Gets the list of calendar ids . -// ----------------------------------------------------------------------------- -// -void CLookupMapTileDatabase::GetAllCalendarIdsL( RArray& aIdArray ) -{ - __TRACE_CALLSTACK;// Create a query to find the item. - TFileName queryBuffer; - queryBuffer.Format( KQueryGetCalendaIds, ESourceCalendar ); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return; - } - iItemsDatabase.Begin(); - - - // Create a view of the table with the above query. - RDbView myView; - myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) ); - CleanupClosePushL( myView ); - myView.EvaluateAll(); - myView.FirstL(); - - while( myView.AtRow() ) - { - // Item found. get the details. - myView.GetL(); - TUint32 id; - id = myView.ColUint( KColumnUid ); - aIdArray.Append( id ); - myView.NextL(); - } - - CleanupStack::PopAndDestroy( &myView ); // myView - Close(); -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::FindEntryL() -// Finds an entry in the lookup table. -// ----------------------------------------------------------------------------- -// -TBool CLookupMapTileDatabase::FindEntryL(TLookupItem& aLookupItem) -{ - __TRACE_CALLSTACK;// used to store return value - TBool retVal = EFalse; - // Create a query to find the item. - TFileName queryBuffer; - queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource); - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return EFalse; - - } - iItemsDatabase.Begin(); - - // Create a view of the table with the above query. - RDbView myView; - myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - myView.EvaluateAll(); - myView.FirstL(); - - if (myView.AtRow()) - { - // Item found. get the details. - myView.GetL(); - retVal = ETrue; - } - - CleanupStack::PopAndDestroy(&myView); // myView - Close(); - return retVal; -} - -// ----------------------------------------------------------------------------- -// CLookupMapTileDatabase::FindEntryByFIlePathLL() -// Finds an entry in the lookup table for maptile image file -// ----------------------------------------------------------------------------- -// -TBool CLookupMapTileDatabase::FindEntryByFilePathL(const TDesC& aFilePath) -{ - __TRACE_CALLSTACK;// used to store return value - TBool retVal = EFalse; - - TInt ret = Open(); - if (ret != KErrNone) - { - Close(); - ret = Open(); - if( ret != KErrNone ) - return EFalse; - } - - iItemsDatabase.Begin(); - - // Create a query to find the item. - TFileName queryBuffer; - _LIT(KFormatSpec, "%S%S%S%S%S'%S'"); - - queryBuffer.Format(KFormatSpec, - &KSelectfilepathFrom(), - &KMapTileLookupTable(), - &KStringWhere(), - &NCntColFilePath(), - &KStringEqual(), - &aFilePath); - - // Create a view of the table with the above query. - RDbView myView; - TInt retPrep = myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); - CleanupClosePushL(myView); - myView.EvaluateAll(); - myView.FirstL(); - - if (myView.AtRow()) - { - // Item found, return true - retVal = ETrue; - } - - CleanupStack::PopAndDestroy(&myView); // myView - Close(); - - return retVal; -} - -// End of file - diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/src/maptileinterface.cpp --- a/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -25,7 +25,6 @@ #include "maptileinterface.h" #include "mylocationlogger.h" #include "mylocationsdefines.h" -#include "lookupmaptiledb.h" #include //Invalid latitude & longitude value diff -r 793f76d9ab0c -r b3dd5ec3089d locationdataharvester/mylocationsengine/src/mylocationsengine.cpp --- a/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -28,9 +29,11 @@ #include #include #include +#include #include "contactsubscriber.h" #include "calendarsubscriber.h" #include "mylocationsengine.h" +#include "mylocationsdefines.h" #include "geocodeupdate.h" //header for GeocodeUpdate class //handle for CMyLocationsHistoryDbObserver class #include "mylocationlogger.h" @@ -46,7 +49,13 @@ //Protocol : [appid-addresstype-maptilestatus] _LIT8( KMaptileStatusFormat, "%d-%d-%d" ); const TInt KProtocolBufferSize = 16; +static const TInt startDateArray[2] = { 1900, 1}; +static const TInt endDateArray[2] = { 2100, 1}; +// Maptile interface uid +const TUid KUidMapTileInterface = { 0x2002E6E8 }; +// Central Repository Key IDs +const TInt KMaptileDbSyncState = 0x2; const QString KSpace(" "); // ============================ MEMBER FUNCTIONS =============================== @@ -89,7 +98,11 @@ MYLOCLOGSTRING("iMapTileInterface = CMapTileInterface::NewL()"); //Maptile Db instance - iMaptileDatabase = CLookupMapTileDatabase::NewL(KMapTileLookupDatabaseName); + iMaptileDatabase = new LookupMapTileDatabase(); + if( !iMaptileDatabase->open() ) + { + User::Leave( KErrUnknown ); + } MYLOCLOGSTRING("Maptile Db instance created "); @@ -311,6 +324,12 @@ // create a calendar entry view with the opened session iCalView = CCalEntryView::NewL(*iCalSession); StartCalenderChangeNotifierL(); + TInt value=0; + MaptileDbSyncStatusL(EMapTileDbStatusGet, value); + if(value==1) + { + RefreshCalendarEntryListL(); + } } else { @@ -398,12 +417,12 @@ } //Update the entry with inprogress status - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iUid = iAddressInfo[index]->iUid; lookupItem.iSource = type; - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - iMaptileDatabase->UpdateEntryL( lookupItem ); + iMaptileDatabase->updateEntry( lookupItem ); //Request for maptile fetching if( contactAddressLm ) @@ -434,30 +453,28 @@ void CMyLocationsEngine::SubscribeFromCalendarL(TInt aId) { __TRACE_CALLSTACK; + if( !iMaptileGeocoderPluginAvailable ) + { + return; + } iLastCalendarId = aId; + TInt repValue=0; + MaptileDbSyncStatusL(EMapTileDbStatusGet , repValue); + if ( repValue == 1 ) + { + return; + } for ( int index =0;iMapTileRequestQueue.Count()>index ;index++) { - if( iLastCalendarId == iMapTileRequestQueue[index]->iUId ) - { - return; - } - } - - CCalEntry* calEntry = NULL; - calEntry = iCalView->FetchL(aId); - CleanupStack::PushL(calEntry); - TPtrC address(calEntry->LocationL()); - if( address.Length()>0 ) - { - TLookupItem lookupItem; - lookupItem.iUid = aId; - lookupItem.iSource = ESourceCalendar; - lookupItem.iFilePath.Zero(); - lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - iMaptileDatabase->UpdateEntryL( lookupItem ); - RequestMapTileImageL( address, ESourceCalendar, aId , EChangeModify ); - } - CleanupStack::PopAndDestroy(calEntry); + if( iLastCalendarId == iMapTileRequestQueue[index]->iUId ) + { + return; + } + } + TCalChangeEntry calChangeEntry ; + calChangeEntry.iEntryId=aId; + calChangeEntry.iChangeType=MCalChangeCallBack2::EChangeModify; + CalenderEntryModifyL(calChangeEntry); } // ----------------------------------------------------------------------------- // CMyLocationsEngine::StartCalenderChangeNotifierL() @@ -471,31 +488,28 @@ // fall under the timeframe one year past and one year ahead of the current time. if (iCalSession) { - MYLOCLOGSTRING("iCalSession is not null"); - TTime currentTime; - currentTime.HomeTime(); - - TTime startTime = currentTime - TTimeIntervalYears(1); - TTime endTime = currentTime + TTimeIntervalYears(1); - - TCalTime calStartTime; - calStartTime.SetTimeLocalL(startTime); + // Subscribe for notification on changes in the opened session (file). + TCalTime startDate; + TCalTime endDate; + TDateTime startTime = TDateTime( + startDateArray[0], static_cast(startDateArray[1]), + 0, 0, 0, 0, 0); + TDateTime endTime = TDateTime( + endDateArray[0], static_cast(endDateArray[1]), + 0, 0, 0, 0, 0); - MYLOCLOGSTRING("SetTimeLocalL(startTime)"); - - TCalTime calEndTime; - calEndTime.SetTimeLocalL(endTime); + startDate.SetTimeUtcL(startTime); + endDate.SetTimeUtcL(endTime); + CalCommon::TCalTimeRange searchTimeRange(startDate, endDate); - MYLOCLOGSTRING("SetTimeLocalL(endTime)"); - - // set the filter for modification tracking - CCalChangeNotificationFilter *filter = - CCalChangeNotificationFilter::NewL( - MCalChangeCallBack2::EChangeEntryAll, ETrue, - CalCommon::TCalTimeRange(calStartTime, calEndTime)); - MYLOCLOGSTRING(" CCalChangeNotificationFilter::NewL()"); - // 'this' object implements MCalChangeCallBack + CCalChangeNotificationFilter* filter = NULL; + filter = CCalChangeNotificationFilter::NewL( + MCalChangeCallBack2::EChangeEntryAll, true, searchTimeRange); + iCalSession->StartChangeNotification(*this, *filter); + + // Cleanup. + delete filter; } } @@ -543,7 +557,10 @@ delete iCalenderNotification; iCalenderNotification = NULL; } - + if( !iMaptileGeocoderPluginAvailable ) + { + return; + } // get entries associated with this UID for (int i = 0; i < aChangeItems.Count(); i++) { @@ -551,8 +568,9 @@ // Check if this is some undefined change in calendar db. if( aChangeItems[0].iChangeType == EChangeUndefined && aChangeItems[0].iEntryType == EChangeEntryAll ) { + MYLOCLOGSTRING("Refresh the calendar for EChangeUndefined "); // Refresh the calendar related entries in the location and maptiledb. - RefreshCalendarEntryListL(); + RefreshCalendarEntryListL(); break; } TCalChangeEntry calChangeEntry = aChangeItems[i]; @@ -579,8 +597,10 @@ break; } case EChangeDelete: - { - TLookupItem lookupItem; + { + + iMyLocationsDatabaseManager->UpdateCalendarLocationById(calChangeEntry.iEntryId,EEntryDeleted,KNullDesC); + MaptileLookupItem lookupItem; lookupItem.iSource = ESourceCalendar; lookupItem.iUid = calChangeEntry.iEntryId; TRAP_IGNORE(ManipulateMapTileDataBaseL(lookupItem)); @@ -599,15 +619,66 @@ // void CMyLocationsEngine::RefreshCalendarEntryListL() { + __TRACE_CALLSTACK; + TInt repValue=1; + MaptileDbSyncStatusL(EMapTileDbStatusSet , repValue); + // Deletes all the invalid calendar entries from location and maptile lookup db. + DeleteInvalidCalendarEntriesL(); + + CCalIter* calIter = CCalIter::NewL(*iCalSession); + CleanupStack::PushL( calIter ); + TPtrC8 iterUid = calIter->FirstL(); + while ( iterUid != KNullDesC8 ) + { + + MYLOCLOGSTRING("while ( iterUid != KNullDesC8 )"); + RPointerArray entryArray; + iCalView->FetchL( iterUid, entryArray ); + MYLOCLOGSTRING1("iCalView->FetchL :entryArray.Count()->%d",entryArray.Count()); + // get entries associated with this UID + for( int i =0; iLocalUidL() ; + MaptileLookupItem lookupItem; + lookupItem.iUid = entryArray[i]->LocalUidL() ; + lookupItem.iSource = ESourceCalendar; + if( iMaptileDatabase->findEntry(lookupItem ) ) + { + calChangeEntry.iChangeType = EChangeModify; + TRAP_IGNORE( CalenderEntryModifyL(calChangeEntry) ) ; + } + else + { + calChangeEntry.iChangeType = EChangeAdd; + TRAP_IGNORE(CalenderEntryAddedL(calChangeEntry)); + } + } + iterUid.Set(calIter->NextL()); + entryArray.ResetAndDestroy(); + } + CleanupStack::PopAndDestroy( calIter ); + repValue=0; + MaptileDbSyncStatusL(EMapTileDbStatusSet , repValue); +} + +// ----------------------------------------------------------------------------- +// CMyLocationsEngine::DeleteInvalidCalendarEntriesL() +// ----------------------------------------------------------------------------- +// +void CMyLocationsEngine::DeleteInvalidCalendarEntriesL() +{ + __TRACE_CALLSTACK; //Get all the calendar ids and check its validity. //Delete if they are no more valid. - RArray ids; - iMaptileDatabase->GetAllCalendarIdsL( ids ); - for( TInt i = 0; i < ids.Count(); i++ ) + QList ids; + iMaptileDatabase->getAllCalendarIds( ids ); + for( TInt i = 0; i < ids.count(); i++ ) { if( !IsCalendarEntryValidL( ids[i] ) ) { - TLookupItem lookupItem; + iMyLocationsDatabaseManager->UpdateCalendarLocationById(ids[i],EEntryDeleted,KNullDesC); + MaptileLookupItem lookupItem; lookupItem.iSource = ESourceCalendar; lookupItem.iUid = ids[i]; TRAP_IGNORE( ManipulateMapTileDataBaseL( lookupItem ) ); @@ -624,8 +695,44 @@ // TBool CMyLocationsEngine::IsCalendarEntryValidL( TUint32 aId ) { + __TRACE_CALLSTACK; return ( ( iCalView->FetchL( aId ) == NULL ) ? EFalse:ETrue ); } + +// ----------------------------------------------------------------------------- +// CMyLocationsEngine::MaptileDbSyncStatusL() +// ----------------------------------------------------------------------------- +// +void CMyLocationsEngine::MaptileDbSyncStatusL(const TCenrepSetting& aSettingType , TInt& aValue) +{ + __TRACE_CALLSTACK; + CRepository* centralRepository = NULL; + centralRepository = CRepository::NewL( KUidMapTileInterface ) ; + CleanupStack::PushL( centralRepository ); + switch(aSettingType) + { + case EMapTileDbStatusGet: + { + centralRepository->Get( KMaptileDbSyncState , aValue ); + break; + } + case EMapTileDbStatusSet: + { + centralRepository->Set( KMaptileDbSyncState , aValue ); + MaptileLookupItem item; + item.iSource = ESourceCalendar; + item.iUid = iLastCalendarId; + iMaptileDatabase->getEntry(item); + if(iLastCalendarId >0) + { + PublishEntry(iLastCalendarId,item); + } + break; + } + } + CleanupStack::PopAndDestroy(centralRepository); +} + // ----------------------------------------------------------------------------- // CMyLocationsEngine::CalenderEntryAddedL() // ----------------------------------------------------------------------------- @@ -635,23 +742,27 @@ __TRACE_CALLSTACK; TUint32 entryId=0; - entryId=aCalChangeEntry.iEntryId; + entryId=aCalChangeEntry.iEntryId; //create entry in the data base and maintain a fetching state. - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iUid = entryId ; lookupItem.iSource = ESourceCalendar; - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - TRAP_IGNORE( iMaptileDatabase->CreateEntryL(lookupItem) ); + iMaptileDatabase->createEntry(lookupItem) ; CCalEntry* calEntry = NULL; calEntry = iCalView->FetchL( entryId ); - CleanupStack::PushL(calEntry); - TPtrC address(calEntry->LocationL()); - if (address.Length() > 0) + if(calEntry!=NULL) { - RequestMapTileImageL( address, ESourceCalendar, entryId , EChangeAdd ); - } - CleanupStack::PopAndDestroy(calEntry); + CleanupStack::PushL(calEntry); + TPtrC address(calEntry->LocationL()); + iMyLocationsDatabaseManager->UpdateCalendarLocationById(entryId,EEntryAdded,address); + if (address.Length() > 0) + { + RequestMapTileImageL( address, ESourceCalendar, entryId , EChangeAdd ); + } + CleanupStack::PopAndDestroy(calEntry); + } } // ----------------------------------------------------------------------------- @@ -663,39 +774,115 @@ __TRACE_CALLSTACK; TUint32 entryId = 0; entryId = aCalChangeEntry.iEntryId; - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iSource = ESourceCalendar; - lookupItem.iUid = entryId; + lookupItem.iUid = entryId; + iMaptileDatabase->getEntry(lookupItem); + QString maptilePath= lookupItem.iFilePath; CCalEntry* calEntry = NULL; calEntry = iCalView->FetchL(entryId); CleanupStack::PushL(calEntry); - if(iGeocodeUpdate->isGeocodeNotAvailable(entryId)) - { - TPtrC address(calEntry->LocationL()); - if (iMyLocationsDatabaseManager->CheckIfAddressChanged(address, entryId, - ESourceCalendar)) - { - lookupItem.iFilePath.Zero(); - lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) ); - if (address.Length() > 0) - { - RequestMapTileImageL(address, ESourceCalendar, entryId , EChangeModify); - } - else - { - UpdateDatabaseL(NULL, entryId, ESourceCalendar, EEntryDeleted); - } - if ( lookupItem.iFilePath.Length() > 0 ) - { - iMaptileDatabase->DeleteMapTileL(lookupItem); - } + TPtrC address(calEntry->LocationL()); + TBool retGeo=EFalse; + retGeo=iGeocodeUpdate->isGeocodeNotAvailable(entryId); + TBool addressChanged=EFalse; + addressChanged=iMyLocationsDatabaseManager->CheckIfAddressChanged(address, entryId, + ESourceCalendar); + // retGeo , true if geo-code not available otherwise false. + if(!retGeo ) + { + if( lookupItem.iUserSetting && addressChanged ) + { + //sync to local db + //reset the user setting flag + //update maptile all previous status + //return; + iMaptileDatabase->updateEntry(lookupItem); + iLastCalendarId=entryId; + PublishEntry(entryId,lookupItem); + //TRAP_IGNORE(iMyLocationsDatabaseManager->UpdateCalendarLocationL( address, entryId, + // ESourceCalendar) ); + } + else if(lookupItem.iFetchingStatus==EMapTileFetchingInProgress || lookupItem.iFetchingStatus==EMapTileFetchingNetworkError) + { + //normal scenario , + // go for geo-coding + //return; + lookupItem.iFilePath.clear(); + lookupItem.iFetchingStatus = EMapTileFetchingInProgress; + iMaptileDatabase->updateEntry(lookupItem) ; + TRAP_IGNORE( UpdateDatabaseL( NULL, + entryId, ESourceCalendar, EEntryDeleted ) ); + if (maptilePath.length() > 0) + { + lookupItem.iFilePath=maptilePath; + iMaptileDatabase->deleteMapTile(lookupItem); + } + RequestMapTileImageL(address, ESourceCalendar, entryId, EChangeModify); + } + else + { + PublishEntry(entryId,lookupItem); + } + } + else + { + if(addressChanged) + { + // go for geo-coding + // return; + lookupItem.iFilePath.clear(); + lookupItem.iFetchingStatus = EMapTileFetchingInProgress; + iMaptileDatabase->updateEntry(lookupItem); + TRAP_IGNORE( UpdateDatabaseL( NULL, + entryId, ESourceCalendar, EEntryDeleted ) ); + if (maptilePath.length() > 0) + { + lookupItem.iFilePath = maptilePath; + iMaptileDatabase->deleteMapTile(lookupItem); + } + RequestMapTileImageL(address, ESourceCalendar, entryId, + EChangeModify); + } + else + { + // dont do anything + QLookupItem locationItem; + LocationDataLookupDb lookupDb; + if(lookupDb.findEntryBySourceIdAndType(locationItem)) + { + MYLOCLOGSTRING("entry found in loocation lookupdb "); + iGeocodeUpdate->updateGeocodeToCalenderDB(entryId,locationItem.mLatitude,locationItem.mLongitude); + } + iLastCalendarId=entryId; + PublishEntry(entryId,lookupItem); + + //return; + } + + } + CleanupStack::PopAndDestroy(calEntry); - } - } - CleanupStack::PopAndDestroy(calEntry); } - +// ----------------------------------------------------------------------------- +// CMyLocationsEngine::PublishEntry() +// maptile db updated, publishing the calendar entry. +// ----------------------------------------------------------------------------- +// +void CMyLocationsEngine::PublishEntry(TInt32 aEntryId, MaptileLookupItem& aLookupItem) +{ + __TRACE_CALLSTACK; + //Publish the maptile status ,if it was from calendar + if (iLastCalendarId == aEntryId) + { + TBuf8 buffer; + buffer.Zero(); + buffer.Format(KMaptileStatusFormat, iLastCalendarId, + aLookupItem.iSource, aLookupItem.iFetchingStatus); + RProperty::Set(KMaptileStatusPublish, EMaptileStatusInteger, + buffer); + } +} // ----------------------------------------------------------------------------- // CMyLocationsEngine::HandleDatabaseEventL() // Callback that provides information about the contact database change event. @@ -721,7 +908,7 @@ void CMyLocationsEngine::TriggerMaptileRequestL(TContactDbObserverEvent& aEvent) { __TRACE_CALLSTACK; - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iUid = aEvent.iContactId; // If contact is deleted delete from mylocations db if ( aEvent.iType == EContactDbObserverEventContactDeleted || aEvent.iType == EContactDbObserverEventOwnCardDeleted ) @@ -812,16 +999,16 @@ aEvent.iContactId, ESourceContactsPref) ) { - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) ); + iMaptileDatabase->resetEntry(lookupItem); RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref, aEvent.iContactId, iEventType ); - if ( lookupItem.iFilePath.Length() > 0 ) + if ( lookupItem.iFilePath.isEmpty() != false ) { - iMaptileDatabase->DeleteMapTileL(lookupItem); + iMaptileDatabase->deleteMapTile(lookupItem); } } @@ -844,15 +1031,15 @@ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*homeAddressLm, aEvent.iContactId, ESourceContactsHome) ) { - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) ) + iMaptileDatabase->resetEntry(lookupItem); //remove entry from databse RequestMapTileImageL(*homeAddressLm, ESourceContactsHome, aEvent.iContactId, iEventType); - if (lookupItem.iFilePath.Length() > 0) + if (lookupItem.iFilePath.isEmpty() != false ) { - iMaptileDatabase->DeleteMapTileL(lookupItem); + iMaptileDatabase->deleteMapTile(lookupItem); } } } @@ -876,15 +1063,15 @@ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*workAddressLm, aEvent.iContactId, ESourceContactsWork) ) { - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; - TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) ) + iMaptileDatabase->resetEntry(lookupItem); RequestMapTileImageL(*workAddressLm, ESourceContactsWork, aEvent.iContactId, iEventType); - if (lookupItem.iFilePath.Length() > 0) + if (lookupItem.iFilePath.isEmpty() != false ) { - iMaptileDatabase->DeleteMapTileL(lookupItem); + iMaptileDatabase->deleteMapTile(lookupItem); } } } @@ -899,9 +1086,9 @@ } case EContactDbObserverEventContactAdded: { - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iUid = aEvent.iContactId; - lookupItem.iFilePath.Zero(); + lookupItem.iFilePath.clear(); lookupItem.iFetchingStatus = EMapTileFetchingInProgress; MYLOCLOGSTRING("EContactDbObserverEventContactAdded" ); @@ -909,21 +1096,21 @@ { //create entry in the data base and maintain a fetching state. lookupItem.iSource = ESourceContactsPref; - iMaptileDatabase->CreateEntryL(lookupItem); + iMaptileDatabase->createEntry(lookupItem); RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref, aEvent.iContactId, iEventType); } if (homeAddressLm) { lookupItem.iSource = ESourceContactsHome; - iMaptileDatabase->CreateEntryL(lookupItem); + iMaptileDatabase->createEntry(lookupItem); RequestMapTileImageL(*homeAddressLm, ESourceContactsHome, aEvent.iContactId, iEventType); } if (workAddressLm) { lookupItem.iSource = ESourceContactsWork; - iMaptileDatabase->CreateEntryL(lookupItem); + iMaptileDatabase->createEntry(lookupItem); RequestMapTileImageL(*workAddressLm, ESourceContactsWork, aEvent.iContactId, iEventType); } @@ -1304,7 +1491,7 @@ { MYLOCLOGSTRING1("No.of RequestQueue - %d",iMapTileRequestQueue.Count()); - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType; lookupItem.iUid = iMapTileRequestQueue[0]->iUId; @@ -1313,13 +1500,12 @@ UpdateGeoCodeToAppDataBase( aLatitude, aLongitude ); TBool flag = EFalse; - TRAP_IGNORE( flag = iMaptileDatabase->FindEntryByFilePathL(aMapTilePath) ); + QString str = QString( (QChar*)aMapTilePath.Ptr(), aMapTilePath.Length()); + flag = iMaptileDatabase->findEntryByFilePath( str ); if ( flag ) { MYLOCLOGSTRING1("%S - found in the DB",&aMapTilePath); - - - lookupItem.iFilePath.Copy(aMapTilePath); + lookupItem.iFilePath = QString( (QChar*)aMapTilePath.Ptr(), aMapTilePath.Length()); lookupItem.iFetchingStatus = EMapTileFectchingCompleted; TRAP_IGNORE( UpdateMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType, lookupItem ) ); //Publish the maptile status @@ -1400,12 +1586,12 @@ //Forward the event for maptile fetching only if maptile plugin available if( iMaptileGeocoderPluginAvailable ) { - RArray iLookupItems; - iMaptileDatabase->FindEntriesByMapTileFetchingStateL((TUint32)EMapTileFetchingNetworkError, + QList iLookupItems; + iMaptileDatabase->findEntriesByMapTileFetchingState((quint32)EMapTileFetchingNetworkError, iLookupItems); - for( TUint32 i = 0; i < iLookupItems.Count(); i++ ) + for( TUint32 i = 0; i < iLookupItems.count(); i++ ) { - TLookupItem iItem = iLookupItems[i]; + MaptileLookupItem iItem = iLookupItems[i]; switch( iItem.iSource ) { // Get the home address details @@ -1456,7 +1642,7 @@ } else { - iMaptileDatabase->DeleteEntryL( iItem ); + iMaptileDatabase->deleteEntry( iItem ); } } break; @@ -1486,27 +1672,23 @@ MYLOCLOGSTRING1("No.of RequestQueue - %d",iMapTileRequestQueue.Count()); - TLookupItem lookupItem; + MaptileLookupItem lookupItem; lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType; lookupItem.iUid = iMapTileRequestQueue[0]->iUId; if ( aErrCode == KErrNone ) { CreateMultipleMaptiles( aMapTilePath ); - lookupItem.iFilePath.Copy(aMapTilePath); + lookupItem.iFilePath = QString( (QChar*)aMapTilePath.Ptr(), aMapTilePath.Length()); lookupItem.iFetchingStatus = EMapTileFectchingCompleted; } - else if ( aErrCode == KErrCouldNotConnect ) + else { lookupItem.iFetchingStatus = EMapTileFetchingNetworkError; iMyLocationThreeAMTimer->StartTimer(); - } - else - { - lookupItem.iFetchingStatus = EMapTileFetchingUnknownError; - } + } TRAP_IGNORE( UpdateMaptileDatabaseL( iMapTileRequestQueue[0]->iEventType,lookupItem ) ); @@ -1592,7 +1774,7 @@ // ----------------------------------------------------------------------------- // void CMyLocationsEngine::UpdateMaptileDatabaseL( - TInt aEventType, TLookupItem& aLookupItem) + TInt aEventType, MaptileLookupItem& aLookupItem) { __TRACE_CALLSTACK; if (aEventType == EContactDbObserverEventContactChanged || aEventType @@ -1600,17 +1782,17 @@ aEventType == EChangeAdd ) { - if (iMaptileDatabase->FindEntryL(aLookupItem)) + if ( iMaptileDatabase->findEntry(aLookupItem) ) { - iMaptileDatabase->UpdateEntryL(aLookupItem); + iMaptileDatabase->updateEntry(aLookupItem); } else { - iMaptileDatabase->CreateEntryL(aLookupItem); + iMaptileDatabase->createEntry(aLookupItem); } } - if (aLookupItem.iFetchingStatus == EMapTileFetchingUnknownError - || aLookupItem.iFetchingStatus == EMapTileFetchingNetworkError) + if ( aLookupItem.iFetchingStatus == EMapTileFetchingUnknownError + || aLookupItem.iFetchingStatus == EMapTileFetchingNetworkError ) { TRAP_IGNORE( UpdateDatabaseL( NULL, aLookupItem.iUid, aLookupItem.iSource, EEntryDeleted ) ); @@ -1624,11 +1806,13 @@ buffer->Des().Copy(ptr); if(buffer) { - aLookupItem.iFilePath.Append(*buffer); + QString str = QString( (QChar*)buffer->Ptr(), buffer->Length()); + aLookupItem.iFilePath.append( str ); } CleanupStack::PopAndDestroy(buffer); - iMyLocationsDatabaseManager->UpdateMapTilePath(aLookupItem.iUid, - aLookupItem.iSource, aLookupItem.iFilePath); + TBuf filePath( aLookupItem.iFilePath.utf16() ); + iMyLocationsDatabaseManager->UpdateMapTilePath( aLookupItem.iUid, + aLookupItem.iSource, filePath ); } } @@ -1656,8 +1840,6 @@ landmark = iMapTileInterface->GetLandMarkDetails(); if (NULL != landmark) { - TRAP_IGNORE( landmark->SetPositionFieldL(EPositionFieldComment, - iMapTileRequestQueue[0]->iAddressDetails->Des() ) ); TRAP_IGNORE( UpdateDatabaseL( landmark, iMapTileRequestQueue[0]->iUId, ESourceCalendar, MapChangeType( ESourceCalendar, iMapTileRequestQueue[0]->iEventType ) ) ); @@ -1747,15 +1929,17 @@ // CMyLocationsEngine::ManipulateMapTileDataBaseL() // ----------------------------------------------------------------------------- // -void CMyLocationsEngine::ManipulateMapTileDataBaseL(TLookupItem& aLookupItem) +void CMyLocationsEngine::ManipulateMapTileDataBaseL(MaptileLookupItem& aLookupItem) { __TRACE_CALLSTACK; TBool entryAvailable=EFalse; - entryAvailable = iMaptileDatabase->FindEntryL(aLookupItem); - iMaptileDatabase->DeleteEntryL(aLookupItem); + quint32 tempStatus = aLookupItem.iFetchingStatus; + entryAvailable = iMaptileDatabase->getEntry( aLookupItem ); + iMaptileDatabase->deleteEntry(aLookupItem); + aLookupItem.iFetchingStatus = tempStatus; if (entryAvailable) { - iMaptileDatabase->DeleteMapTileL(aLookupItem); + iMaptileDatabase->deleteMapTile(aLookupItem); } } diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/inc/locationpickersearchview.h --- a/locationpickerservice/inc/locationpickersearchview.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/inc/locationpickersearchview.h Mon Oct 04 00:10:56 2010 +0300 @@ -65,11 +65,15 @@ void handleLongPress(); //delete context menu void deleteMenu(); + //handle secondary back action + void backTriggered(); signals: //signals to switch current view void switchView(); //signals when any item is selected void selectItem( quint32 aLm ); + //signal to send service complete + void completeService(); #ifdef LOCPICKER_UNIT_TEST public: #else @@ -94,6 +98,8 @@ HbMenu* mLongPressMenu; //select action HbAction* mSelectAction; + //back action + HbAction *mBackAction; }; diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/inc/locationpickertypes.h --- a/locationpickerservice/inc/locationpickertypes.h Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/inc/locationpickertypes.h Mon Oct 04 00:10:56 2010 +0300 @@ -27,6 +27,9 @@ // space const QString KSpace(" "); +//colon +const QString KTitleSeparator(":"); + //Icon Paths // dummy image for a LandMarks diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/locationpickerservice.pro --- a/locationpickerservice/locationpickerservice.pro Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/locationpickerservice.pro Mon Oct 04 00:10:56 2010 +0300 @@ -26,7 +26,8 @@ # Build.inf rules BLD_INF_RULES.prj_exports += \ "$${LITERAL_HASH}include " \ - "rom/locationpickerservice.iby CORE_APP_LAYER_IBY_EXPORT_PATH(locationpickerservice.iby)" + "rom/locationpickerservice.iby CORE_APP_LAYER_IBY_EXPORT_PATH(locationpickerservice.iby)" \ + "rom/locationpickerservice_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(locationpickerservice_resources.iby)" TARGET.UID3 = 0x2002C3AA isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x14000 @@ -87,3 +88,6 @@ inc/locationpickerdocumentloader.h \ inc/hgwidgetdatamodel.h + + +symbian:MMP_RULES += SMPSAFE diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/resources/location.hgmediawall.widgetml --- a/locationpickerservice/resources/location.hgmediawall.widgetml Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/resources/location.hgmediawall.widgetml Mon Oct 04 00:10:56 2010 +0300 @@ -2,27 +2,30 @@ - + - + - - + + + - + - + - + + - + + diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/rom/locationpickerservice.iby --- a/locationpickerservice/rom/locationpickerservice.iby Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/rom/locationpickerservice.iby Mon Oct 04 00:10:56 2010 +0300 @@ -22,7 +22,5 @@ file=ABI_DIR/BUILD_DIR/locationpickerservice.exe PROGRAMS_DIR/locationpickerservice.exe data=ZPRIVATE/10003a3f/import/apps/locationpickerservice_reg.rsc /private/10003a3f/import/apps/locationpickerservice_reg.rsc data=DATAZ_/resource/apps/locationpickerservice.rsc /resource/apps/locationpickerservice.rsc -// Localizations -data=DATAZ_\QT_TRANSLATIONS_DIR\lilpicker_en.qm QT_TRANSLATIONS_DIR\lilpicker_en.qm #endif // __LOCATION_PICKER_SERVICE_IBY__ diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/rom/locationpickerservice_resources.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/locationpickerservice/rom/locationpickerservice_resources.iby Mon Oct 04 00:10:56 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The locationpickerservice_resources iby file. +* +*/ + +#include + +#ifndef __LOCATION_PICKER_SERVICE_RESOURCES_IBY__ +#define __LOCATION_PICKER_SERVICE_RESOURCES_IBY__ + +// ---- locationpickerservice_resources -------------------------------------------------------- + +data=DATAZ_/resource/apps/locationpickerservice.rsc /resource/apps/locationpickerservice.rsc +// Localizations +data=DATAZ_\QT_TRANSLATIONS_DIR\lilpicker.qm QT_TRANSLATIONS_DIR\lilpicker.qm + +#endif // __LOCATION_PICKER_SERVICE_RESOURCES_IBY__ diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/src/hgwidgetdatamodel.cpp --- a/locationpickerservice/src/hgwidgetdatamodel.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/src/hgwidgetdatamodel.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -101,15 +101,21 @@ case Qt::DisplayRole: { QStringList displayText; - QStringList adressDetail = mProxyModel->data(proxyModelIndex,Qt::DisplayRole).toStringList(); + QStringList adressDetail = mProxyModel->data(proxyModelIndex,Qt::DisplayRole). + toStringList(); QString displayString; if(!adressDetail[0].isEmpty()) { - displayString = adressDetail[0]+KSeparator+KSpace+adressDetail[1]; + displayString = adressDetail[0]+KSpace+KTitleSeparator+KSpace+ + adressDetail[1]+KSpace+KSeparator+adressDetail[2]; + } + else if (!adressDetail[1].isEmpty()) + { + displayString = adressDetail[1]+KSpace+KSeparator+adressDetail[2]; } else { - displayString = adressDetail[1]; + displayString = adressDetail[2]; } QString text(""); displayText <load(":/locationpickersearchview.docml", &ok); Q_ASSERT_X(ok, "locationpickerService", "invalid DocML file"); //find the LocationPickerSearchView - QGraphicsWidget *locationPickerSearchWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerSearchView"); + QGraphicsWidget *locationPickerSearchWidget = + mLocationPickerDocumentLoader->findWidget("LocationPickerSearchView"); Q_ASSERT_X((locationPickerSearchWidget != 0), "locationpickerService", "invalid DocML file"); mLocationPickerSearchView = qobject_cast(locationPickerSearchWidget); Q_ASSERT_X((mLocationPickerSearchView != 0), "mLocationPickerSearchView", "qobject cast failure"); //initialize the action items and connect to slots mLocationPickerSearchView->init(mLocationPickerContent->getStandardModel()); - connect(mLocationPickerSearchView,SIGNAL(switchView()),this,SLOT(activateLocationPickerView())); - connect(mLocationPickerSearchView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 ))); + connect(mLocationPickerSearchView,SIGNAL(switchView()), + this,SLOT(activateLocationPickerView())); + connect(mLocationPickerSearchView,SIGNAL(selectItem( quint32 )), + this,SLOT(itemSelected( quint32 ))); + connect(mLocationPickerSearchView,SIGNAL(completeService()), + this,SLOT(serviceComplete())); addView(mLocationPickerSearchView); } //set LocationPickerSearchview as current view diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/src/locationpickerdatamanager_p.cpp --- a/locationpickerservice/src/locationpickerdatamanager_p.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/src/locationpickerdatamanager_p.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -108,6 +108,7 @@ } QString lmAddressLine1; QString lmAddressLine2; + QString lmAddressLine3; QString contextAddress; QString contextAddressCountry; @@ -117,6 +118,7 @@ contextAddressCountry.clear(); lmAddressLine1.clear(); lmAddressLine2.clear(); + lmAddressLine3.clear(); if( !aItemArray[i].mIsDuplicate ) { @@ -127,68 +129,68 @@ { if( lmAddressLine1.isEmpty() ) { - lmAddressLine1 = aItemArray[i].mStreet; + lmAddressLine2 = aItemArray[i].mStreet; } else { - lmAddressLine2 = aItemArray[i].mStreet; + lmAddressLine3 = aItemArray[i].mStreet; addressEmtpy = EFalse; - } + } } if( !aItemArray[i].mCity.isEmpty() ) { - if( lmAddressLine1.isEmpty() ) + if( lmAddressLine2.isEmpty() ) { - lmAddressLine1 = aItemArray[i].mCity; + lmAddressLine2 = aItemArray[i].mCity; } else { if( !addressEmtpy ) { - lmAddressLine2 = lmAddressLine2 + KSeparator; - lmAddressLine2 = lmAddressLine2 + KSpace; - lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCity; + lmAddressLine3 = lmAddressLine3 + KSeparator; + lmAddressLine3 = lmAddressLine3 + KSpace; + lmAddressLine3 = lmAddressLine3 + aItemArray[i].mCity; } else { - lmAddressLine2 = aItemArray[i].mCity; + lmAddressLine3 = aItemArray[i].mCity; addressEmtpy = EFalse; } } } if( !aItemArray[i].mState.isEmpty() ) { - if( lmAddressLine1.isEmpty() ) + if( lmAddressLine2.isEmpty() ) { - lmAddressLine1 = aItemArray[i].mState; + lmAddressLine2 = aItemArray[i].mState; } else { if( !addressEmtpy ) { - lmAddressLine2 = lmAddressLine2 + KSeparator; - lmAddressLine2 = lmAddressLine2 + KSpace; - lmAddressLine2 = lmAddressLine2 + aItemArray[i].mState; + lmAddressLine3 = lmAddressLine3 + KSeparator; + lmAddressLine3 = lmAddressLine3 + KSpace; + lmAddressLine3 = lmAddressLine3 + aItemArray[i].mState; } else { - lmAddressLine2 = aItemArray[i].mState; + lmAddressLine3 = aItemArray[i].mState; addressEmtpy = EFalse; } } } - contextAddress = lmAddressLine2; + contextAddress = lmAddressLine3; if( !aItemArray[i].mCountry.isEmpty() ) { if( !addressEmtpy ) { - lmAddressLine2 = lmAddressLine2 + KSeparator; - lmAddressLine2 = lmAddressLine2 + KSpace; - lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCountry; + lmAddressLine3 = lmAddressLine3 + KSeparator; + lmAddressLine3 = lmAddressLine3 + KSpace; + lmAddressLine3 = lmAddressLine3 + aItemArray[i].mCountry; } else { - lmAddressLine2 = aItemArray[i].mCountry; + lmAddressLine3 = aItemArray[i].mCountry; addressEmtpy = EFalse; } contextAddressCountry = aItemArray[i].mCountry; @@ -249,7 +251,7 @@ QStringList contextList; contextList<setData(QVariant(addressData), Qt::DisplayRole); modelItem->setData( icons, Qt::DecorationRole ); modelItem->setData( aItemArray[i].mId, Qt::UserRole ); @@ -273,7 +275,9 @@ // add contact collection QStandardItem *modelItemContact = new QStandardItem(); int conNum = aCount.value(0); - QString contactCollectionNum(hbTrId("txt_lint_list_ln_items",conNum)); + QString contactCollectionNum; + contactCollectionNum.setNum(conNum); + contactCollectionNum.append(" items"); QString contactCollectionName( hbTrId("txt_lint_list_contact_addresses") ); @@ -286,7 +290,9 @@ //txt_lint_list_calender_addresses int calNum = aCount.value(1); - QString calendarCollectionNum(hbTrId("txt_lint_list_ln_items",calNum)); + QString calendarCollectionNum; + calendarCollectionNum.setNum(calNum); + calendarCollectionNum.append(" items"); QString calendarCollectionName( hbTrId("txt_lint_list_calendar_locations") ); QStringList calender = (QStringList()<setTimeout(HbMenu::NoTimeout); - mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_list_select")); + mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_menu_select")); mIndex = aItem->modelIndex(); connect(mSelectAction, SIGNAL(triggered()),this, SLOT(handleLongPress())); mLongPressMenu->setPreferredPos(aPoint); @@ -205,3 +214,15 @@ mSelectAction->deleteLater(); mSelectAction = NULL; } + +// ---------------------------------------------------------------------------- +// LocationPickerSearchView::backButtonTriggered() +// ---------------------------------------------------------------------------- +void LocationPickerSearchView::backTriggered() +{ + + //complete the service + emit completeService(); + + +} diff -r 793f76d9ab0c -r b3dd5ec3089d locationpickerservice/src/locationpickerview.cpp --- a/locationpickerservice/src/locationpickerview.cpp Thu Sep 02 20:20:42 2010 +0300 +++ b/locationpickerservice/src/locationpickerview.cpp Mon Oct 04 00:10:56 2010 +0300 @@ -76,7 +76,8 @@ QString("ascendingAction"))); mDescendingAction = qobject_cast (mDocumentLoader->findObject( QString("descendingAction"))); - if( !mAllAction || !mCollectionAction || !mSearchAction || !mAscendingAction || !mDescendingAction ) + if( !mAllAction || !mCollectionAction || !mSearchAction || + !mAscendingAction || !mDescendingAction ) { qFatal("Error Reading Docml"); } @@ -176,7 +177,8 @@ connect(mSearchAction, SIGNAL(triggered()), this, SLOT(searchTabTriggered())); // connect the signal of the list activated to a slot. - connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &))); + connect(mListView, SIGNAL(activated(const QModelIndex &)), + this, SLOT(handleActivated(const QModelIndex &))); connect(mListView,SIGNAL(longPressed(HbAbstractViewItem*, const QPointF &)),this, SLOT(launchPopUpMenu(HbAbstractViewItem*, const QPointF &))); //set widget according to orientation @@ -216,7 +218,8 @@ SLOT(orientationChanged(Qt::Orientation))); mWidget->setAcceptTouchEvents(true); - connect(mWidget, SIGNAL(activated(const QModelIndex &)),this, SLOT(handleActivated(const QModelIndex &))); + connect(mWidget, SIGNAL(activated(const QModelIndex &)), + this, SLOT(handleActivated(const QModelIndex &))); connect(mWidget, SIGNAL(longPressed(const QModelIndex &, const QPointF &)),this, SLOT(launchPopUpMenu(const QModelIndex &, const QPointF &))); mWidget->setLongPressEnabled(true); @@ -284,7 +287,8 @@ break; case ELocationPickerCollectionListContent: { - mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem); + mListView->setModel(mLocationPickerCollectionListContent->getStandardModel() + ,mListItem); mCollectionAction->setChecked(true); mAllAction->setChecked(false); if(mAscendingAction->isEnabled()) @@ -502,6 +506,11 @@ // ----------------------------------------------------------------------------- void LocationPickerView::searchTabTriggered() { + if (mCollectionContent) + { + delete mCollectionContent; + mCollectionContent = NULL; + } mWidget->hide(); emit switchToSearchView(); } @@ -611,7 +620,7 @@ mLongPressMenu = new HbMenu(); mLongPressMenu->setTimeout(HbMenu::NoTimeout); connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu())); - mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_list_select")); + mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_menu_select")); if( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent ) { mDetailsAction = mLongPressMenu->addAction(hbTrId("txt_lint_menu_details")); @@ -631,7 +640,7 @@ mLongPressMenu = new HbMenu(); mLongPressMenu->setTimeout(HbMenu::NoTimeout); connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu())); - mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_list_select")); + mSelectAction = mLongPressMenu->addAction(hbTrId("txt_lint_menu_select")); mIndex = aIndex; connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect())); mLongPressMenu->setPreferredPos(aPoint); @@ -693,8 +702,10 @@ } else { - adressDetail = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+3).toStringList(); - iconName = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+1).toString(); + adressDetail = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+3). + toStringList(); + iconName = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+1). + toString(); } if(iconName.isEmpty()) { @@ -757,7 +768,8 @@ mEmptyLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); mEmptyLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary)); mEmptyLabel->setAlignment(Qt::AlignCenter); - mLinerLayout->removeItem(mListView); + mListView->reset(); + mLinerLayout->removeItem(mListView); mListView->hide(); mWidget->setVisible(false); mLinerLayout->insertItem(0, mEmptyLabel); diff -r 793f76d9ab0c -r b3dd5ec3089d package_definition.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_definition.xml Mon Oct 04 00:10:56 2010 +0300 @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 793f76d9ab0c -r b3dd5ec3089d package_map.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/package_map.xml Mon Oct 04 00:10:56 2010 +0300 @@ -0,0 +1,1 @@ +