--- a/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Fri Jun 11 13:33:47 2010 +0300
+++ b/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Wed Jun 23 18:07:15 2010 +0300
@@ -102,6 +102,9 @@
// map tile path
QString mMapTilePath;
+
+ //One line address
+ QString mSingleLineAddress;
};
/**
@@ -197,8 +200,23 @@
* @param[out] aLookupItemArray List of lookup entries found.
*/
void getEntries( QList<QLookupItem>& aLookupItemArray, const quint32 aCollectionId = ESourceInvalid );
+
+ /**
+ * Gets count of lookup items.
+ * @param[in/out] aCount The number of items in lookup table for the collection id
+ * @param[in] aCollectionId The collection id, whose whose corresponding entries needs to be fetched.
+ * By default all the entries in the lookup db are fetched.
+ */
+ void getCount( QList<int>& aCount,const quint32 aCollectionId = ESourceInvalid );
-
+ /**
+ * Gets single line address
+ * @param mId , id of the entry
+ * @param mSourceType , type of entry
+ * @return QString , address associated with cuurent id and type
+ */
+ QString getAddressDetails( quint32 mId , quint32 mSourceType );
+
private:
// fills the lookup entry
--- a/location_plat/location_data_harvester_api/inc/locationservicedefines.h Fri Jun 11 13:33:47 2010 +0300
+++ b/location_plat/location_data_harvester_api/inc/locationservicedefines.h Wed Jun 23 18:07:15 2010 +0300
@@ -31,10 +31,10 @@
ESourceMapsHistory,
/** Uid Source type contacts default/prefered address */
ESourceContactsPref,
+ /** Uid Source type contacts home address */
+ ESourceContactsHome,
/** Uid Source type contacts work address */
ESourceContactsWork,
- /** Uid Source type contacts home address */
- ESourceContactsHome,
/** Uid Source type landmarks category */
ESourceLandmarksCategory,
/** Uid Source type landmarks user created category */
--- a/location_plat/location_picker_service_api/inc/qlocationpickeritem.h Fri Jun 11 13:33:47 2010 +0300
+++ b/location_plat/location_picker_service_api/inc/qlocationpickeritem.h Wed Jun 23 18:07:15 2010 +0300
@@ -27,7 +27,9 @@
class QLocationPickerItem
{
public:
- QLocationPickerItem():mIsValid(false)
+ QLocationPickerItem():mIsValid(false),
+ mLatitude(200.0),
+ mLongitude(200.0)
{};
~QLocationPickerItem() {};
--- a/locationdataharvester/bwins/geocodeupdateu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/bwins/geocodeupdateu.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,5 +1,19 @@
EXPORTS
- ?updateGeocodeToContactDB@GeocodeUpdate@@SAXIHNN@Z @ 1 NONAME ; void GeocodeUpdate::updateGeocodeToContactDB(unsigned int, int, double, double)
- ?createContactdb@GeocodeUpdate@@SAXXZ @ 2 NONAME ; void GeocodeUpdate::createContactdb(void)
- ?updateGeocodeToCalenderDB@GeocodeUpdate@@SAXKNN@Z @ 3 NONAME ; void GeocodeUpdate::updateGeocodeToCalenderDB(unsigned long, double, double)
+ ?createContactdb@GeocodeUpdate@@QAEXXZ @ 1 NONAME ; void GeocodeUpdate::createContactdb(void)
+ ?trUtf8@GeocodeUpdate@@SA?AVQString@@PBD0@Z @ 2 NONAME ; class QString GeocodeUpdate::trUtf8(char const *, char const *)
+ ?tr@GeocodeUpdate@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString GeocodeUpdate::tr(char const *, char const *, int)
+ ?tr@GeocodeUpdate@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString GeocodeUpdate::tr(char const *, char const *)
+ ??1GeocodeUpdate@@UAE@XZ @ 5 NONAME ; GeocodeUpdate::~GeocodeUpdate(void)
+ ?getStaticMetaObject@GeocodeUpdate@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & GeocodeUpdate::getStaticMetaObject(void)
+ ?updateGeocodeToContactDB@GeocodeUpdate@@QAE_NIHNN@Z @ 7 NONAME ; bool GeocodeUpdate::updateGeocodeToContactDB(unsigned int, int, double, double)
+ ?updateGeocodeToCalenderDB@GeocodeUpdate@@QAE_NKNN@Z @ 8 NONAME ; bool GeocodeUpdate::updateGeocodeToCalenderDB(unsigned long, double, double)
+ ??0GeocodeUpdate@@QAE@XZ @ 9 NONAME ; GeocodeUpdate::GeocodeUpdate(void)
+ ?qt_metacall@GeocodeUpdate@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int GeocodeUpdate::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?eventCompleted@GeocodeUpdate@@IAEXXZ @ 11 NONAME ; void GeocodeUpdate::eventCompleted(void)
+ ??_EGeocodeUpdate@@UAE@I@Z @ 12 NONAME ; GeocodeUpdate::~GeocodeUpdate(unsigned int)
+ ?trUtf8@GeocodeUpdate@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString GeocodeUpdate::trUtf8(char const *, char const *, int)
+ ?staticMetaObject@GeocodeUpdate@@2UQMetaObject@@B @ 14 NONAME ; struct QMetaObject const GeocodeUpdate::staticMetaObject
+ ?metaObject@GeocodeUpdate@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * GeocodeUpdate::metaObject(void) const
+ ?agendautilInstanceCreated@GeocodeUpdate@@AAEXH@Z @ 16 NONAME ; void GeocodeUpdate::agendautilInstanceCreated(int)
+ ?qt_metacast@GeocodeUpdate@@UAEPAXPBD@Z @ 17 NONAME ; void * GeocodeUpdate::qt_metacast(char const *)
--- a/locationdataharvester/bwins/locationdatalookupdbu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/bwins/locationdatalookupdbu.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,17 +1,19 @@
EXPORTS
?updateMaptileBySourceIdAndType@LocationDataLookupDb@@QAEXIIVQString@@@Z @ 1 NONAME ; void LocationDataLookupDb::updateMaptileBySourceIdAndType(unsigned int, unsigned int, class QString)
- ?deleteEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 2 NONAME ; void LocationDataLookupDb::deleteEntryBySourceIdAndType(class QLookupItem const &)
- ?updateEntryBySourceIdAndType@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 3 NONAME ; void LocationDataLookupDb::updateEntryBySourceIdAndType(class QLookupItem const &)
- ?getEntries@LocationDataLookupDb@@QAEXAAV?$QList@VQLookupItem@@@@I@Z @ 4 NONAME ; void LocationDataLookupDb::getEntries(class QList<class QLookupItem> &, unsigned int)
- ?updateEntryById@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 5 NONAME ; void LocationDataLookupDb::updateEntryById(class QLookupItem const &)
- ??0LocationDataLookupDb@@QAE@PAVQObject@@@Z @ 6 NONAME ; LocationDataLookupDb::LocationDataLookupDb(class QObject *)
- ?findEntryBySourceIdAndType@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 7 NONAME ; bool LocationDataLookupDb::findEntryBySourceIdAndType(class QLookupItem &)
- ??1LocationDataLookupDb@@UAE@XZ @ 8 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(void)
- ?findEntriesByLandmarkId@LocationDataLookupDb@@QAEXIAAV?$QList@VQLookupItem@@@@@Z @ 9 NONAME ; void LocationDataLookupDb::findEntriesByLandmarkId(unsigned int, class QList<class QLookupItem> &)
- ?close@LocationDataLookupDb@@QAEXXZ @ 10 NONAME ; void LocationDataLookupDb::close(void)
- ?createEntry@LocationDataLookupDb@@QAEXAAVQLookupItem@@@Z @ 11 NONAME ; void LocationDataLookupDb::createEntry(class QLookupItem &)
- ?findEntryById@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 12 NONAME ; bool LocationDataLookupDb::findEntryById(class QLookupItem &)
- ?fillLookupEntry@LocationDataLookupDb@@AAEXAAVQSqlQuery@@AAVQLookupItem@@@Z @ 13 NONAME ; void LocationDataLookupDb::fillLookupEntry(class QSqlQuery &, class QLookupItem &)
- ?open@LocationDataLookupDb@@QAE_NXZ @ 14 NONAME ; bool LocationDataLookupDb::open(void)
- ??_ELocationDataLookupDb@@UAE@I@Z @ 15 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(unsigned int)
+ ?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<class QLookupItem> &, 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<int> &, 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<class QLookupItem> &)
+ ?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)
--- a/locationdataharvester/bwins/maptileserviceu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/bwins/maptileserviceu.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,4 +1,21 @@
EXPORTS
- ?getMapTileImage@MapTileService@@SA?AVQString@@HW4AddressType@1@@Z @ 1 NONAME ; class QString MapTileService::getMapTileImage(int, enum MapTileService::AddressType)
- ?isLocationFeatureEnabled@MapTileService@@SA_NW4AppType@1@@Z @ 2 NONAME ; bool MapTileService::isLocationFeatureEnabled(enum MapTileService::AppType)
+ ?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@@@Z @ 10 NONAME ; int MapTileService::getMapTileImage(int, enum MapTileService::AddressType, class QString &)
+ ?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)
--- a/locationdataharvester/bwins/mylocationsdatabasemanageru.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/bwins/mylocationsdatabasemanageru.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,7 +1,9 @@
EXPORTS
- ?GetLandmarkFullAddress@CMyLocationsDatabaseManager@@QAEXAAV?$TBuf@$0PP@@@PBVCPosLandmark@@@Z @ 1 NONAME ; void CMyLocationsDatabaseManager::GetLandmarkFullAddress(class TBuf<255> &, class CPosLandmark const *)
- ?ConstructL@CMyLocationsDatabaseManager@@QAEXXZ @ 2 NONAME ; void CMyLocationsDatabaseManager::ConstructL(void)
- ?UpdateMapTilePath@CMyLocationsDatabaseManager@@QAEXKKV?$TBuf@$0BAA@@@@Z @ 3 NONAME ; void CMyLocationsDatabaseManager::UpdateMapTilePath(unsigned long, unsigned long, class TBuf<256>)
- ?UpdateDatabaseL@CMyLocationsDatabaseManager@@QAEXPAVCPosLandmark@@KKK@Z @ 4 NONAME ; void CMyLocationsDatabaseManager::UpdateDatabaseL(class CPosLandmark *, unsigned long, unsigned long, unsigned long)
- ??0CMyLocationsDatabaseManager@@QAE@XZ @ 5 NONAME ; CMyLocationsDatabaseManager::CMyLocationsDatabaseManager(void)
+ ?UpdateMapTilePath@CMyLocationsDatabaseManager@@QAEXKKAAV?$TBuf@$0BAA@@@@Z @ 1 NONAME ; void CMyLocationsDatabaseManager::UpdateMapTilePath(unsigned long, unsigned long, class TBuf<256> &)
+ ?GetLandmarkFullAddress@CMyLocationsDatabaseManager@@QAEXAAV?$TBuf@$0PP@@@PBVCPosLandmark@@@Z @ 2 NONAME ; void CMyLocationsDatabaseManager::GetLandmarkFullAddress(class TBuf<255> &, class CPosLandmark const *)
+ ?ConstructL@CMyLocationsDatabaseManager@@QAEXXZ @ 3 NONAME ; void CMyLocationsDatabaseManager::ConstructL(void)
+ ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVTDesC16@@KW4TUidSourceType@@@Z @ 4 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class TDesC16 const &, unsigned long, enum TUidSourceType)
+ ?UpdateDatabaseL@CMyLocationsDatabaseManager@@QAEXPAVCPosLandmark@@KKK@Z @ 5 NONAME ; void CMyLocationsDatabaseManager::UpdateDatabaseL(class CPosLandmark *, unsigned long, unsigned long, unsigned long)
+ ??0CMyLocationsDatabaseManager@@QAE@XZ @ 6 NONAME ; CMyLocationsDatabaseManager::CMyLocationsDatabaseManager(void)
+ ?CheckIfAddressChanged@CMyLocationsDatabaseManager@@QAEHABVCPosLandmark@@KW4TUidSourceType@@@Z @ 7 NONAME ; int CMyLocationsDatabaseManager::CheckIfAddressChanged(class CPosLandmark const &, unsigned long, enum TUidSourceType)
--- a/locationdataharvester/eabi/geocodeupdateu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/eabi/geocodeupdateu.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,5 +1,19 @@
EXPORTS
- _ZN13GeocodeUpdate15createContactdbEv @ 1 NONAME
- _ZN13GeocodeUpdate24updateGeocodeToContactDBEjidd @ 2 NONAME
- _ZN13GeocodeUpdate25updateGeocodeToCalenderDBEmdd @ 3 NONAME
+ _ZN13GeocodeUpdate11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN13GeocodeUpdate11qt_metacastEPKc @ 2 NONAME
+ _ZN13GeocodeUpdate14eventCompletedEv @ 3 NONAME
+ _ZN13GeocodeUpdate15createContactdbEv @ 4 NONAME
+ _ZN13GeocodeUpdate16staticMetaObjectE @ 5 NONAME DATA 16
+ _ZN13GeocodeUpdate19getStaticMetaObjectEv @ 6 NONAME
+ _ZN13GeocodeUpdate24updateGeocodeToContactDBEjidd @ 7 NONAME
+ _ZN13GeocodeUpdate25agendautilInstanceCreatedEi @ 8 NONAME
+ _ZN13GeocodeUpdate25updateGeocodeToCalenderDBEmdd @ 9 NONAME
+ _ZN13GeocodeUpdateC1Ev @ 10 NONAME
+ _ZN13GeocodeUpdateC2Ev @ 11 NONAME
+ _ZN13GeocodeUpdateD0Ev @ 12 NONAME
+ _ZN13GeocodeUpdateD1Ev @ 13 NONAME
+ _ZN13GeocodeUpdateD2Ev @ 14 NONAME
+ _ZNK13GeocodeUpdate10metaObjectEv @ 15 NONAME
+ _ZTI13GeocodeUpdate @ 16 NONAME
+ _ZTV13GeocodeUpdate @ 17 NONAME
--- a/locationdataharvester/eabi/locationdatalookupdbu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/eabi/locationdatalookupdbu.def Wed Jun 23 18:07:15 2010 +0300
@@ -4,18 +4,20 @@
_ZN20LocationDataLookupDb13findEntryByIdER11QLookupItem @ 3 NONAME
_ZN20LocationDataLookupDb15fillLookupEntryER9QSqlQueryR11QLookupItem @ 4 NONAME
_ZN20LocationDataLookupDb15updateEntryByIdERK11QLookupItem @ 5 NONAME
- _ZN20LocationDataLookupDb23findEntriesByLandmarkIdEjR5QListI11QLookupItemE @ 6 NONAME
- _ZN20LocationDataLookupDb26findEntryBySourceIdAndTypeER11QLookupItem @ 7 NONAME
- _ZN20LocationDataLookupDb28deleteEntryBySourceIdAndTypeERK11QLookupItem @ 8 NONAME
- _ZN20LocationDataLookupDb28updateEntryBySourceIdAndTypeERK11QLookupItem @ 9 NONAME
- _ZN20LocationDataLookupDb30updateMaptileBySourceIdAndTypeEjj7QString @ 10 NONAME
- _ZN20LocationDataLookupDb4openEv @ 11 NONAME
- _ZN20LocationDataLookupDb5closeEv @ 12 NONAME
- _ZN20LocationDataLookupDbC1EP7QObject @ 13 NONAME
- _ZN20LocationDataLookupDbC2EP7QObject @ 14 NONAME
- _ZN20LocationDataLookupDbD0Ev @ 15 NONAME
- _ZN20LocationDataLookupDbD1Ev @ 16 NONAME
- _ZN20LocationDataLookupDbD2Ev @ 17 NONAME
- _ZTI20LocationDataLookupDb @ 18 NONAME
- _ZTV20LocationDataLookupDb @ 19 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
--- a/locationdataharvester/eabi/maptileserviceu.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/eabi/maptileserviceu.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,4 +1,21 @@
EXPORTS
- _ZN14MapTileService15getMapTileImageEiNS_11AddressTypeE @ 1 NONAME
- _ZN14MapTileService24isLocationFeatureEnabledENS_7AppTypeE @ 2 NONAME
+ _ZN14MapTileService11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN14MapTileService11qt_metacastEPKc @ 2 NONAME
+ _ZN14MapTileService12publishValueEiNS_11AddressTypeEi @ 3 NONAME
+ _ZN14MapTileService15getMapTileImageEiNS_11AddressTypeER7QString @ 4 NONAME
+ _ZN14MapTileService15publishCalEntryEi @ 5 NONAME
+ _ZN14MapTileService16setMaptileStatusEv @ 6 NONAME
+ _ZN14MapTileService16staticMetaObjectE @ 7 NONAME DATA 16
+ _ZN14MapTileService19getStaticMetaObjectEv @ 8 NONAME
+ _ZN14MapTileService24isLocationFeatureEnabledENS_7AppTypeE @ 9 NONAME
+ _ZN14MapTileService27maptileFetchingStatusUpdateEiii @ 10 NONAME
+ _ZN14MapTileService28readEntryFromMaptileDataBaseEiNS_11AddressTypeER11TLookupItemRi @ 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
--- a/locationdataharvester/eabi/mylocationsdatabasemanageru.def Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/eabi/mylocationsdatabasemanageru.def Wed Jun 23 18:07:15 2010 +0300
@@ -1,8 +1,10 @@
EXPORTS
_ZN27CMyLocationsDatabaseManager10ConstructLEv @ 1 NONAME
_ZN27CMyLocationsDatabaseManager15UpdateDatabaseLEP12CPosLandmarkmmm @ 2 NONAME
- _ZN27CMyLocationsDatabaseManager17UpdateMapTilePathEmm4TBufILi256EE @ 3 NONAME
- _ZN27CMyLocationsDatabaseManager22GetLandmarkFullAddressER4TBufILi255EEPK12CPosLandmark @ 4 NONAME
- _ZN27CMyLocationsDatabaseManagerC1Ev @ 5 NONAME
- _ZN27CMyLocationsDatabaseManagerC2Ev @ 6 NONAME
+ _ZN27CMyLocationsDatabaseManager17UpdateMapTilePathEmmR4TBufILi256EE @ 3 NONAME
+ _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK12CPosLandmarkm14TUidSourceType @ 4 NONAME
+ _ZN27CMyLocationsDatabaseManager21CheckIfAddressChangedERK7TDesC16m14TUidSourceType @ 5 NONAME
+ _ZN27CMyLocationsDatabaseManager22GetLandmarkFullAddressER4TBufILi255EEPK12CPosLandmark @ 6 NONAME
+ _ZN27CMyLocationsDatabaseManagerC1Ev @ 7 NONAME
+ _ZN27CMyLocationsDatabaseManagerC2Ev @ 8 NONAME
--- a/locationdataharvester/geocodeupdate/geocodeupdate.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/geocodeupdate/geocodeupdate.pro Wed Jun 23 18:07:15 2010 +0300
@@ -25,7 +25,7 @@
CONFIG += Qt
DEPENDPATH += .
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
# Input
# Input
@@ -34,11 +34,16 @@
../inc
SOURCES +=./src/geocodeupdate.cpp
+MOC_DIR = moc
+
+DEFINES += GEOCODEUPDATEDLL
+
symbian:
{
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = All -Tcb
TARGET.UID3 = 0x2002C3A9
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
deploy.path = $$EPOCROOT
exportheaders.sources = $$PUBLIC_HEADERS
exportheaders.path = epoc32/include
@@ -53,4 +58,13 @@
}
+
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE ../eabi/geocodeupdate.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE ../bwins/geocodeupdate.def" \
+ "$${LITERAL_HASH}endif"
+MMP_RULES += defBlock
+
# End of file --Don't remove this.
\ No newline at end of file
--- a/locationdataharvester/geocodeupdate/inc/geocodeupdate.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/geocodeupdate/inc/geocodeupdate.h Wed Jun 23 18:07:15 2010 +0300
@@ -20,19 +20,32 @@
#include <e32def.h>
#include <QtCore/qglobal.h>
+#include <QObject>
+
+#ifdef GEOCODEUPDATEDLL
+#define GEOCODEUPDATE_EXPORT Q_DECL_EXPORT
+#else
+#define GEOCODEUPDATE_EXPORT Q_DECL_IMPORT
+#endif
// CLASS DECLARATION
/**
* GeocodeUpdate, a class to update latitude and longtude into contact and calender database
*/
-class GeocodeUpdate
+class GEOCODEUPDATE_EXPORT GeocodeUpdate: public QObject
{
+ Q_OBJECT
public:
+
+ GeocodeUpdate();
+
+ ~GeocodeUpdate();
+
/**
Create contact database
*/
- IMPORT_C static void createContactdb();
+ void createContactdb();
/**
* Request to update latitude and longitude into contact db.
@@ -42,7 +55,7 @@
* @param longitude longitude to be updated.
*/
- IMPORT_C static void updateGeocodeToContactDB(const quint32 contactId,
+ bool updateGeocodeToContactDB(const quint32 contactId,
const int addressType, const double latitude,
const double longitude);
/**
@@ -52,8 +65,13 @@
* @param longitude longitude to be updated.
*/
- IMPORT_C static void updateGeocodeToCalenderDB(const ulong calEntryId,
+ bool updateGeocodeToCalenderDB(const ulong calEntryId,
const double latitude, const double longitude);
+private slots:
+ void agendautilInstanceCreated(int);
+signals:
+ void eventCompleted();
+
};
#endif // __GEOCODEUPDATE_H__
--- a/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -22,17 +22,36 @@
#include <agendautil.h>
#include <agendaentry.h>
#include <QString>
+#include <QEventLoop>
#include <locationservicedefines.h>
-
#include "geocodeupdate.h"
#include "mylocationsdefines.h"
#include "mylocationlogger.h"
using namespace QTM_NAMESPACE;
+
+
+// ----------------------------------------------------------------------------
+// GeocodeUpdate::GeocodeUpdate()
+// ----------------------------------------------------------------------------
+GeocodeUpdate::GeocodeUpdate()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// GeocodeUpdate::~GeocodeUpdate()
+// ----------------------------------------------------------------------------
+GeocodeUpdate::~GeocodeUpdate()
+{
+ __TRACE_CALLSTACK;
+
+}
+
// ----------------------------------------------------------------------------
// GeocodeUpdate::createContactdb()
// ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::createContactdb()
+void GeocodeUpdate::createContactdb()
{
QContactManager* contactManger = NULL;
MYLOCLOGSTRING("call to create contactManger object and contactdb as well.");
@@ -44,7 +63,7 @@
// CGeocodeUpdate::updateGeocodeToContactDB()
// Geo-cordinate updation to contact db
// ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId,
+bool GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId,
const int addressType, const double latitude,
const double longitude)
@@ -61,49 +80,63 @@
switch (addressType)
{
- case ESourceContactsPref:
- {
- break;
- }
- case ESourceContactsWork:
- {
- location.setContexts(QContactDetail::ContextWork);
- break;
- }
- case ESourceContactsHome:
- {
- location.setContexts(QContactDetail::ContextHome);
- break;
- }
- default:
- {
- break;
- }
+ case ESourceContactsPref:
+ {
+ break;
+ }
+ case ESourceContactsWork:
+ {
+ location.setContexts(QContactDetail::ContextWork);
+ break;
+ }
+ case ESourceContactsHome:
+ {
+ location.setContexts(QContactDetail::ContextHome);
+ break;
+ }
+ default:
+ {
+ return false;
+ }
}
location.setLongitude(longitude);
location.setLatitude(latitude);
contact.saveDetail(&location);
- contactManger->saveContact(&contact);
+ bool ret=false;
+ ret=contactManger->saveContact(&contact);
delete contactManger;
-
+ return ret;
}
// ----------------------------------------------------------------------------
// CGeocodeUpdate::updateGeocodeToCalenderDB()
// Geo-cordinate updation to contact db
// ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::updateGeocodeToCalenderDB(const ulong calEntryId,
+bool GeocodeUpdate::updateGeocodeToCalenderDB(const ulong calEntryId,
const double latitude, const double longitude)
{
__TRACE_CALLSTACK;
- AgendaUtil agendaUtil;
+ AgendaUtil agendaUtil ;
+ connect(&agendaUtil , SIGNAL(instanceViewCreationCompleted(int)) ,this ,SLOT(agendautilInstanceCreated(int)));
+ QEventLoop loop;
+ connect(this,SIGNAL(eventCompleted()),&loop,SLOT(quit()));
+ loop.exec();
AgendaEntry agendaEntry (agendaUtil.fetchById(calEntryId));
MYLOCLOGSTRING("agenda entry created from calender id .");
AgendaGeoValue geoValue;
geoValue.setLatLong(latitude,longitude);
MYLOCLOGSTRING("latitude and longitude set to AgendaGeoValue object.");
agendaEntry.setGeoValue(geoValue);
- agendaUtil.updateEntry(agendaEntry);
+ bool ret=false;
+ ret=agendaUtil.updateEntry(agendaEntry) ;
+ return ret;
+}
+
+void GeocodeUpdate::agendautilInstanceCreated(int status)
+{
+ if (AgendaUtil::NoError == status){
+ emit eventCompleted();
+ }
}
//end of line
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/inc/notification.h Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef __NOTIFICATION_H__
+#define __NOTIFICATION_H__
+
+/**
+ * The observer class gives notification to derive class .
+ * When calender db creates in specific path.
+ */
+class MNotifyChange
+{
+public:
+ //Notification from Calender
+ virtual void NotifyChangeL(TInt &aStatus)=0;
+
+ //Subscribe the value from publisher
+ virtual void GetChangeNotificationL(TInt &aId, TInt &addressType, TInt &addressCount )=0;
+
+ virtual void SubscribeFromCalendarL(TInt aId) =0;
+
+};
+
+
+#endif // __NOTIFICATION_H__
+// End of file
+
--- a/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -67,7 +67,11 @@
"icontype int,"
"iconpath varchar(255),"
"maptile varchar(255))");
-
+
+
+ query.exec("create table if not exists lplookupaddress ("
+ "sourceid int,"
+ "address varchar(255))");
mDb->close();
}
@@ -165,6 +169,21 @@
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();
+
+ }
+
}
}
@@ -216,7 +235,21 @@
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();
+
+ }
}
+
}
// ---------------------------------------------------------
@@ -287,6 +320,17 @@
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();
+ }
}
}
@@ -305,6 +349,15 @@
query.addBindValue( aLookupItem.mSourceType );
query.exec();
+
+ if(aLookupItem.mSourceType==ESourceCalendar)
+ {
+ query.prepare( "DELETE FROM lplookupaddress "
+ "WHERE sourceid = ? " );
+ query.addBindValue( aLookupItem.mSourceUid );
+ query.exec();
+ }
+
}
}
@@ -432,6 +485,9 @@
}
}
+// ---------------------------------------------------------
+// LocationDataLookupDb::getEntfillLookupEntryries()
+// ---------------------------------------------------------
void LocationDataLookupDb::fillLookupEntry( QSqlQuery &aQuery, QLookupItem &aLookupItem )
{
QSqlRecord rec = aQuery.record();
@@ -454,4 +510,156 @@
}
+// ---------------------------------------------------------
+// LocationDataLookupDb::getAddressDetails()
+// ---------------------------------------------------------
+QString LocationDataLookupDb::getAddressDetails( quint32 mId , quint32 mSourceType )
+{
+ QString addressDetails;
+ if (mDbOpen)
+ {
+ QSqlQuery query(*mDb);
+ if (mSourceType == ESourceContactsPref || mSourceType
+ == ESourceContactsWork || mSourceType == ESourceContactsHome)
+ {
+ query.prepare("SELECT * FROM lplookup "
+ "WHERE sourceid = ? AND sourcetype = ?");
+ query.addBindValue(mId);
+ query.addBindValue(mSourceType);
+ query.exec();
+ if (query.first()) {
+ QSqlRecord rec = query.record();
+ QString temp;
+ temp.clear();
+ temp = query.value(rec.indexOf("street")).toString();
+ if (!temp.isEmpty())
+ {
+ addressDetails.append(temp);
+ }
+ temp.clear();
+
+ temp = query.value(rec.indexOf("city")).toString();
+ if (!temp.isEmpty()) {
+ if (!addressDetails.isEmpty())
+ {
+ addressDetails.append(QChar(','));
+ addressDetails.append(QChar(' '));
+ }
+ addressDetails.append(temp);
+
+ }
+ temp.clear();
+ temp = query.value(rec.indexOf("state")).toString();
+ if (!temp.isEmpty()) {
+ if (!addressDetails.isEmpty())
+ {
+ addressDetails.append(QChar(','));
+ addressDetails.append(QChar(' '));
+ }
+ addressDetails.append(temp);
+
+ }
+ temp.clear();
+ temp = query.value(rec.indexOf("country")).toString();
+ if (!temp.isEmpty()) {
+ if (!addressDetails.isEmpty())
+ {
+ addressDetails.append(QChar(','));
+ addressDetails.append(QChar(' '));
+ }
+ addressDetails.append(temp);
+
+ }
+
+ }
+
+ }
+ else if (mSourceType == ESourceCalendar)
+ {
+ query.prepare("SELECT * FROM lplookupaddress "
+ "WHERE sourceid = ? ");
+ query.addBindValue(mId);
+ query.exec();
+ if ( query.first() )
+ {
+ QSqlRecord rec = query.record();
+ addressDetails.append(
+ query.value(rec.indexOf("address")).toString());
+ }
+ }
+ }
+ return addressDetails;
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::getCount()
+// ---------------------------------------------------------
+void LocationDataLookupDb::getCount( QList<int>& aCount, const quint32 /*aCollectionId*/ )
+{
+ if( mDb )
+ {
+ // ESourceLandmarksContactsCat
+ {
+ QSqlQuery query(*mDb);
+ query.prepare( "SELECT * FROM lplookup "
+ "WHERE sourcetype = ? OR sourcetype = ? OR sourcetype = ?" );
+ query.addBindValue( ESourceContactsPref );
+ query.addBindValue( ESourceContactsWork );
+ query.addBindValue( ESourceContactsHome );
+ query.exec();
+
+
+ qDebug("size %d",query.size());
+ int count=0;
+ while( query.next() ) count++;
+ aCount.append(count);
+ }
+
+
+
+ // ESourceLandmarksCalendarCat
+ {
+ QSqlQuery query(*mDb);
+ query.prepare( "SELECT * FROM lplookup "
+ "WHERE sourcetype = ?" );
+ query.addBindValue( ESourceCalendar );
+ query.exec();
+
+ qDebug("size %d",query.size());
+ int count=0;
+ while( query.next() ) count++;
+ aCount.append(count);
+ }
+
+
+
+ // ESourceLandmarks
+ {
+ QSqlQuery query(*mDb);
+ query.prepare( "SELECT * FROM lplookup "
+ "WHERE sourcetype = ?" );
+ query.addBindValue( ESourceLandmarks );
+ query.exec();
+
+ qDebug("size %d",query.size());
+ int count=0;
+ while( query.next() ) count++;
+ aCount.append(count);
+ }
+
+
+ // else // all contents
+ {
+ QSqlQuery query(*mDb);
+ query.prepare( "SELECT * FROM lplookup" );
+ query.exec();
+ int count=0;
+ while( query.next() ) count++;
+ aCount.append(count);
+ }
+
+
+ }
+}
+
// End of file
--- a/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro Wed Jun 23 18:07:15 2010 +0300
@@ -17,6 +17,7 @@
DEPENDPATH += .
INCLUDEPATH += .
+
# By default Qt adds dependencies to QtCore and QtGui,
# QtCore is enough for this example
#QT = core
@@ -33,5 +34,14 @@
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = ALL \
-TCB
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
}
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE ../eabi/locationdatalookupdb.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE ../bwins/locationdatalookupdb.def" \
+ "$${LITERAL_HASH}endif"
+MMP_RULES += defBlock
+
--- a/locationdataharvester/locationdatalookupdb/tsrc/ut_locationdatalookupdb/ut_locationdatalookupdb.cpp Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,307 +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: location data lookup db unit test cases
-*
-*/
-
-#include <QtTest/QtTest>
-#include <QtGui>
-#include <QString>
-
-#include <locationdatalookupdb.h>
-#include <locationservicedefines.h>
-
-
-//Lookup db test interface class
-class LocationDataLookupDbTest: public QObject
-{
- Q_OBJECT
-
-public:
- void fillLookupItem( QLookupItem &aItem );
-
-private slots:
-
- void testLocationDataLookupDb();
- void testNegative();
- void testCase1();
- void testCase2();
- void testFindEntriesByLandmarkId();
- void testGetEntries();
-};
-
-
-//Checks whether location data lookup db created.
-void LocationDataLookupDbTest::testLocationDataLookupDb()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- QVERIFY( lDb != NULL );
- delete lDb;
-}
-
-//Checks the create entry function
-void LocationDataLookupDbTest::testNegative()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- QLookupItem item;
- QList<QLookupItem> itemArray;
- lDb->createEntry( item );
- lDb->updateEntryById( item );
- lDb->updateEntryBySourceIdAndType( item );
- lDb->updateMaptileBySourceIdAndType( item.mSourceUid, item.mSourceType, "" );
- lDb->deleteEntryBySourceIdAndType( item );
- lDb->getEntries( itemArray );
- QVERIFY( itemArray.count() == 0 );
- lDb->findEntriesByLandmarkId( item.mDestId, itemArray );
- QVERIFY( itemArray.count() == 0 );
- bool returnFlag = lDb->findEntryBySourceIdAndType( item );
- QVERIFY( returnFlag == false );
- returnFlag = lDb->findEntryById( item );
- QVERIFY( returnFlag == false );
- lDb->close();
- delete lDb;
-}
-
-// tests open(), createEntry(), findEntryById(), findEntryBySourceIdAndType(),
-// deleteEntryBySourceIdAndType(), close() apis
-void LocationDataLookupDbTest::testCase1()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- bool flag = lDb->open();
- QVERIFY( flag == true );
-
- flag == false;
- flag = lDb->open();
- QVERIFY( flag == true );
-
- QLookupItem item1, item2;
-
- // find a lookup item with invalid id. return value should be false
- item2.mId = 0;
- flag = true;
- flag = lDb->findEntryById( item2 );
- QVERIFY( flag == false );
-
- // find a lookup item using source id and type. Item not found condition verified
- item2.mSourceType = ESourceCalendar;
- item2.mSourceUid = 0;
- flag = true;
- flag = lDb->findEntryBySourceIdAndType( item2 );
- QVERIFY( flag == false );
-
- // add an item1, check the mId is valid
- fillLookupItem( item1 );
- lDb->createEntry( item1 );
- QVERIFY( item1.mId != 0 );
-
- // Find entry by id. Try to find the entry just added.
- item2.mId = item1.mId;
- flag = false;
- flag = lDb->findEntryById( item2 );
- QVERIFY( flag == true );
-
- // Find entry by source id and type. Try to find the entry just added.
- item2.mSourceType = item1.mSourceType;
- item2.mSourceUid = item1.mSourceUid;
- flag = false;
- flag = lDb->findEntryBySourceIdAndType( item2 );
- QVERIFY( flag == true );
-
- // delete the entry just added
- item2.mSourceType = item1.mSourceType;
- item2.mSourceUid = item1.mSourceUid;
- lDb->deleteEntryBySourceIdAndType( item2 );
-
- // verify that the deleted entry is not found.
- flag = true;
- flag = lDb->findEntryById( item1 );
- QVERIFY( flag == false );
-
- lDb->close();
- delete lDb;
-}
-
-// tests updateEntryBySourceIdAndType(), updateEntryById(),
-// updateMaptileBySourceIdAndType() apis
-void LocationDataLookupDbTest::testCase2()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- bool flag = lDb->open();
- QVERIFY( flag == true );
-
- QLookupItem item1, item2;
-
- // add an item1, check the mId is valid
- fillLookupItem( item1 );
- lDb->createEntry( item1 );
- QVERIFY( item1.mId != 0 );
-
- // Find entry by id. Try to find the entry just added.
- item2.mId = item1.mId;
- item2.mName = "new name";
- lDb->updateEntryById( item2 );
- flag = false;
- flag = lDb->findEntryById( item1 );
- QVERIFY( flag == true );
- QVERIFY( item1.mName == "new name" );
-
- item1.mName = "new name2";
- lDb->updateEntryBySourceIdAndType( item1 );
- lDb->updateMaptileBySourceIdAndType( item1.mSourceUid,
- item1.mSourceType, "new maptile" );
-
- flag = false;
- flag = lDb->findEntryById( item2 );
- QVERIFY( flag == true );
- QVERIFY( item2.mName == "new name2" );
- QVERIFY( item2.mMapTilePath == "new maptile" );
-
- // delete the entry just added
- lDb->deleteEntryBySourceIdAndType( item2 );
-
- lDb->close();
- delete lDb;
-}
-
-// tests findEntriesByLandmarkId()
-void LocationDataLookupDbTest::testFindEntriesByLandmarkId()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- bool flag = lDb->open();
- QVERIFY( flag == true );
-
- QLookupItem item1, item2;
-
- // add an item1, check the mId is valid
- item1.mDestId = 10;
- item1.mName = "lm1";
- item1.mSourceType = ESourceCalendar;
- item1.mSourceUid = 1;
-
- item2.mDestId = 10;
- item2.mName = "lm2";
- item2.mSourceType = ESourceCalendar;
- item2.mSourceUid = 2;
-
- lDb->createEntry( item1 );
- lDb->createEntry( item2 );
- QVERIFY( item1.mId != 0 );
- QVERIFY( item2.mId != 0 );
-
- // Find entry by id. Try to find the entry just added.
- QList<QLookupItem> itemArray;
- lDb->findEntriesByLandmarkId( 10, itemArray );
- QVERIFY( itemArray.count() == 2 );
- QVERIFY( itemArray[0].mName == "lm1" );
- QVERIFY( itemArray[1].mName == "lm2" );
-
- // delete the entry just added
- lDb->deleteEntryBySourceIdAndType( item1 );
- lDb->deleteEntryBySourceIdAndType( item2 );
-
- lDb->close();
- delete lDb;
-}
-
-// tests getEntries()
-void LocationDataLookupDbTest::testGetEntries()
-{
- LocationDataLookupDb* lDb = new LocationDataLookupDb();
- bool flag = lDb->open();
- QVERIFY( flag == true );
-
- // Find entry by id. Try to find the entry just added.
- QList<QLookupItem> itemArray;
- lDb->getEntries( itemArray );
- QVERIFY( itemArray.count() == 0 );
-
- itemArray.clear();
-
- QLookupItem item;
-
- // add an item1, check the mId is valid
- item.mDestId = 10;
- item.mName = "contact1";
- item.mSourceType = ESourceContactsHome;
- item.mSourceUid = 1;
- lDb->createEntry( item );
-
- item.mDestId = 11;
- item.mName = "contact2";
- item.mSourceType = ESourceContactsHome;
- item.mSourceUid = 2;
- lDb->createEntry( item );
-
- item.mDestId = 12;
- item.mName = "calendar entry";
- item.mSourceType = ESourceCalendar;
- item.mSourceUid = 2;
- lDb->createEntry( item );
-
-
- item.mDestId = 13;
- item.mName = "landmark";
- item.mSourceType = ESourceLandmarks;
- item.mSourceUid = 13;
- lDb->createEntry( item );
-
- lDb->getEntries( itemArray, ESourceLandmarksContactsCat );
- QVERIFY( itemArray.count() == 2 );
-
- itemArray.clear();
- lDb->getEntries( itemArray, ESourceLandmarksCalendarCat );
- QVERIFY( itemArray.count() == 1 );
- QVERIFY( itemArray[0].mName == "calendar entry" );
-
- itemArray.clear();
- lDb->getEntries( itemArray, ESourceLandmarks );
- QVERIFY( itemArray.count() == 1 );
- QVERIFY( itemArray[0].mName == "landmark" );
-
- itemArray.clear();
- lDb->getEntries( itemArray );
- QVERIFY( itemArray.count() == 4 );
-
- for( int i = 0; i < itemArray.count(); i++ )
- lDb->deleteEntryBySourceIdAndType( itemArray[i] );
-
- lDb->close();
- delete lDb;
-}
-
-
-void LocationDataLookupDbTest::fillLookupItem( QLookupItem &aItem )
-{
- aItem.mId = 0;
- aItem.mCity = "city";
- aItem.mCountry = "country";
- aItem.mDestId = 2;
- aItem.mIconPath = "iconpath";
- aItem.mIconType = QLookupItem::EIconTypeDefault;
- aItem.mIsDuplicate = 0;
- aItem.mLatitude = 0.1;
- aItem.mLongitude = 0.2;
- aItem.mMapTilePath = "maptilepath";
- aItem.mName = "name";
- aItem.mPostalCode = "postalcode";
- aItem.mSourceType = ESourceCalendar;
- aItem.mSourceUid = 3;
- aItem.mState = "state";
- aItem.mStreet = "street";
-}
-
-QTEST_MAIN(LocationDataLookupDbTest)
-#include "ut_locationdatalookupdb.moc"
-
-
--- a/locationdataharvester/locationdatalookupdb/tsrc/ut_locationdatalookupdb/ut_locationdatalookupdb.pro Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +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: location data lookup db unit test case pro file
-#*
-#*/
-
-TEMPLATE = app
-CONFIG += hb
-QT += testlib
-
-symbian:
-{
- SYSTEMINCLUDEPATH += \epoc32\include\stdapis
-}
-
-SOURCES += ut_locationdatalookupdb.cpp
-
-
-LIBS += -llocationdatalookupdb
-
-TARGET.CAPABILITY = ALL -TCB
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/conf/maptilecalpublisher.qcrml Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repository target="RProperty" version="" uidName="repo" uidValue="0x10005901">
+<key ref="/maptilecalpublisher/name" int="0x1"/>
+</repository>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/conf/maptilepublisher.qcrml Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repository target="RProperty" version="" uidName="repo" uidValue="0x20022EF9">
+<key ref="/maptilepublisher/name" int="0x1"/>
+</repository>
\ No newline at end of file
--- a/locationdataharvester/maptileservice/inc/maptiledblookuptable.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/maptileservice/inc/maptiledblookuptable.h Wed Jun 23 18:07:15 2010 +0300
@@ -27,6 +27,7 @@
_LIT( NCntColUid, "cntuid" );
_LIT( NAppColFilePath, "filepath" );
_LIT( NColSource, "source" );
+_LIT( NColMaptileStatus, "fetchingstatus" );
// maptile lookup database name
_LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
@@ -40,9 +41,9 @@
const TInt KColumnUid = 1;
// source type column number
const TInt KColumnSource = 2;
-// source type column number
+// maptile image path column number
const TInt KColumnFilePath = 3;
-
+// maptile status column number
const TInt KColumnMapTileFetchingStatus = 4;
@@ -66,24 +67,9 @@
// File Path
TFileName iFilePath;
+
//MK map tile fetching status
- TUint32 iFetchingStatus;
-};
-
-/**
- * Defines uid source type
- */
-enum TUidSourceType
-{
- /** Uid Source type calendar plain address */
- ESourceCalendar = 0,
- /** Uid Source type contacts default/prefered address */
- ESourceContactsPref = 3,
- /** Uid Source type contacts work address */
- ESourceContactsWork,
- /** Uid Source type contacts home address */
- ESourceContactsHome,
-
+ TUint32 iFetchingStatus;
};
/**
@@ -119,6 +105,13 @@
* The source iUid is passed in the lookup item
*/
void FindEntryL( TLookupItem& 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 );
private:
--- a/locationdataharvester/maptileservice/inc/maptileservice.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/maptileservice/inc/maptileservice.h Wed Jun 23 18:07:15 2010 +0300
@@ -22,7 +22,15 @@
#include <QString>
#include <QtGlobal>
+#include <QObject>
+#include <qmobilityglobal.h>
+QTM_BEGIN_NAMESPACE
+class QValueSpacePublisher;
+class QValueSpaceSubscriber;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
#ifdef MAPTILESERVICEDLL
#define MAPTILESERVICE_EXPORT Q_DECL_EXPORT
@@ -30,7 +38,7 @@
#define MAPTILESERVICE_EXPORT Q_DECL_IMPORT
#endif
-
+class TLookupItem;
// CLASS DECLARATION
@@ -40,10 +48,27 @@
*
* Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
*/
-class MAPTILESERVICE_EXPORT MapTileService
+class MAPTILESERVICE_EXPORT MapTileService : public QObject
{
+ Q_OBJECT
+public:
-public:
+ /**
+ * Maptile fetching status
+ */
+ enum MapTileStatus
+ {
+ /** Map tile fetching completed */
+ MapTileFetchingCompleted = 0,
+ /** Map tile fetching in progress */
+ MapTileFetchingInProgress,
+ /** Map tile fetching n/w error */
+ MapTileFetchingNetworkError,
+ /** Map tile fetching invalid address */
+ MapTileFetchingInvalidAddress,
+ /** Map tile fetching unknown erro */
+ MapTileFetchingUnknownError
+ };
/**
* Application types
@@ -55,6 +80,7 @@
/** Calendar application */
AppTypeCalendar
};
+
/**
* Address types
*/
@@ -67,27 +93,89 @@
/** Address type Work */
AddressWork,
/** Address type Home */
- AddressHome
+ AddressHome,
+ /** Address type Unknown */
+ AddressUnknown
};
-
+
+ MapTileService();
+
+ ~MapTileService();
+
/**
* Checks whether location feature enabled or disabled for specific application.
*
* @return Returns true or false based on location feature setting.
*/
- static bool isLocationFeatureEnabled(AppType appType);
+ bool isLocationFeatureEnabled(AppType appType);
/**
* 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 Contact id
+ * @param contactId app id
* @param sourceType Source address type( Preferred, Home , Work address )
+ * @param imagePath Maptile image path associated with the app id
*
- * @return Returns maptile image path if it is available, else NULL.
+ * @return Returns the maptile fetching status.
*/
- static QString getMapTileImage( int Id, AddressType sourceType );
-
+ int getMapTileImage( int Id, AddressType sourceType, QString& imagePath );
+
+public slots:
+ /**
+ * Receives maptile status information and emits the maptilFetchingStatusUpdate
+ * signal.
+ */
+ void setMaptileStatus();
+
+signals:
+ /**
+ * Signal to update the maptile fetchings status to contact/calendar application.
+ * @param id app id
+ * @param addressType Source address type( Preferred, Home , Work address )
+ * @param status Maptile status for the associated address
+ */
+ void maptileFetchingStatusUpdate( int id, int addressType, int status );
+
+
+private:
+
+ /**
+ * Publish the contact entry id , AddressType and number of address
+ * @param id, Contact id .
+ * @param sourceType, address type( Preferred, Home , Work address )
+ * @param addressCount ,number of address to be published.
+ */
+ void publishValue(int id, AddressType sourceType, int addressCount );
+ /**
+ * Publish the calendar entry id , AddressType and number of address
+ * @param id, calendar entry id .
+ * @param sourceType, address type( plain)
+ * @param addressCount ,number of address to be published.
+ */
+ void publishCalEntry(int id);
+
+ /**
+ * Read entry from database
+ * @param id, Contact/calendar id .
+ * @param sourceType, address type( plain ,Preferred, Home , Work address )
+ * @param aLookupItem ,entry information
+ * @param aNoOfAddress ,number of address read from databse
+ */
+ int readEntryFromMaptileDataBase( int id, AddressType sourceType,
+ TLookupItem& aLookupItem, int& aNoOfAddress );
+
+private:
+
+ //The contact/calendar id for which maptile requested
+ int mLastViewedEntryId;
+
+ //Maptile request publisher
+ QValueSpacePublisher *mPublisher;
+ //Maptile status request subscriber
+ QValueSpaceSubscriber *mSubscriber;
+ //Calendar Maptile request publisher
+ QValueSpacePublisher *mCalPublisher;
};
#endif //MAPTILESERVICE_H_
--- a/locationdataharvester/maptileservice/maptileservice.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/maptileservice/maptileservice.pro Wed Jun 23 18:07:15 2010 +0300
@@ -24,12 +24,13 @@
CONFIG += dll
CONFIG += hb
-
+CONFIG += mobility
+MOBILITY = publishsubscribe
DEPENDPATH += .
INCLUDEPATH += .
INCLUDEPATH += ../inc
-
+INCLUDEPATH += ../mylocationlogger/inc
MOC_DIR = moc
@@ -55,13 +56,23 @@
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = All -Tcb
TARGET.UID3 = 0x2002E6E8
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
LIBS += -ledbms \
-lbafl \
-lcentralrepository \
- -leuser
+ -leuser \
+ -lflogger \
+ -lefsrv
+ myCrml.sources = ./conf/maptilepublisher.qcrml
+ myCrml.path = c:/resource/qt/crml
+ DEPLOYMENT += myCrml
+
+ myCrml1.sources = ./conf/maptilecalpublisher.qcrml
+ myCrml1.path = c:/resource/qt/crml
+ DEPLOYMENT += myCrml1
}
@@ -71,4 +82,13 @@
DEPLOYMENT += exportheaders
# This is for new exporting system coming in garden
-for(header, headers.sources):BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$headers.path/$$basename(header)"
\ No newline at end of file
+for(header, headers.sources):BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$headers.path/$$basename(header)"
+
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE ../eabi/maptileservice.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE ../bwins/maptileservice.def" \
+ "$${LITERAL_HASH}endif"
+MMP_RULES += defBlock
+
--- a/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -17,6 +17,7 @@
*/
#include <bautils.h>
+#include <maptileservice.h>
#include "maptiledblookuptable.h"
// select all from
@@ -32,7 +33,7 @@
_LIT( KStringAnd, " AND " );
-
+_LIT(KQueryByMaptileState,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND ( fetchingstatus = %d OR fetchingstatus = %d )");
// -----------------------------------------------------------------------------
// CLookupMapTileDatabase::CLookupMapTileDatabase()
@@ -108,6 +109,52 @@
}
}
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::FindNumberOfAddressL()
+// find the number of address associated with the aId.
+// -----------------------------------------------------------------------------
+//
+int CLookupMapTileDatabase::FindNumberOfAddressL( 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 ) );
+ }
+
+ 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()
@@ -159,6 +206,7 @@
if( aLookupItem.iUid == myView.ColUint( KColumnUid ) )
{
aLookupItem.iFilePath.Copy( myView.ColDes16( KColumnFilePath ) );
+ aLookupItem.iFetchingStatus = myView.ColUint( KColumnMapTileFetchingStatus );
entryAvailable = ETrue;
}
}
--- a/locationdataharvester/maptileservice/src/maptileservice.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/maptileservice/src/maptileservice.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -18,25 +18,72 @@
#include <centralrepository.h>
+#include <locationservicedefines.h>
+#include <qvaluespacepublisher.h>
+#include <qvaluespacesubscriber.h>
+#include "mylocationlogger.h"
#include "maptileservice.h"
#include "maptiledblookuptable.h"
-
+#include <QVariant>
// CONSTANTS
// Maptile interface uid
const TUid KUidMapTileInterface = { 0x2002E6E8 };
+
// Central Repository Key IDs
const TInt KEnableLocationFeature = 0x1;
+const char *MAPTILE_STATUS_RECEIVER = "/maptilestatuspublisher/name";
+const char *MAPTILE_STATUS_PUBLISHER = "/maptilepublisher";
+const char *MAPTILE_STATUS_CALENDAR_PUBLISHER = "/maptilecalpublisher";
+
+// -----------------------------------------------------------------------------
+// MapTileService::MapTileService()
+// Default constructor
+// -----------------------------------------------------------------------------
+//
+MapTileService::MapTileService():mCalPublisher(0)
+{
+ /* Constructs a QValueSpacePublisher that publishes values under path /mypublisher*/
+ mPublisher = NULL;
+ mSubscriber = new QValueSpaceSubscriber( MAPTILE_STATUS_RECEIVER );
+ //Connect for maptile status change key
+ QObject::connect(mSubscriber, SIGNAL(contentsChanged()), this, SLOT(setMaptileStatus()));
+
+}
+
+// -----------------------------------------------------------------------------
+// MapTileService::~MapTileService()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+MapTileService::~MapTileService()
+{
+ if( mSubscriber )
+ {
+ delete mSubscriber;
+ mSubscriber = NULL;
+ }
+
+ if( mPublisher )
+ {
+ delete mPublisher;
+ mPublisher = NULL;
+ }
+ if( mCalPublisher )
+ {
+ delete mCalPublisher;
+ mCalPublisher = NULL;
+ }
+}
// -----------------------------------------------------------------------------
// MapTileService::isLocationFeatureEnabled()
// Checks whether location feature is enabled or disabled
// -----------------------------------------------------------------------------
//
bool MapTileService::isLocationFeatureEnabled(AppType appType)
-{
-
+{
//Create the centrep with uid 0x2002C3A8
bool iLocationFeatureEnabled = false;
@@ -76,55 +123,243 @@
// Gets the maptile image path associated with a contact.
// -----------------------------------------------------------------------------
//
-QString MapTileService::getMapTileImage( int id, AddressType sourceType )
+int MapTileService::getMapTileImage( int id, AddressType sourceType, QString& imagePath )
{
+ __TRACE_CALLSTACK;
+
+ TLookupItem lookupItem;
+
+ int addressCount = 0;
+ int maptileStatus = MapTileFetchingUnknownError;
+
+ int error = readEntryFromMaptileDataBase( id, sourceType, lookupItem, addressCount );
+
+ //if entry available returns the file path otherwise NULL.
+ if ( KErrNone == error )
+ {
+
+ //Get the image path
+ QString imageFile((QChar*)lookupItem.iFilePath.Ptr(),
+ lookupItem.iFilePath.Length());
+ imagePath = imageFile;
+
+ maptileStatus = lookupItem.iFetchingStatus;
+ MYLOCLOGSTRING1("getMapTileImage maptileStatus - %d ", maptileStatus );
+
+ if( maptileStatus == MapTileFetchingNetworkError ||
+ maptileStatus == MapTileFetchingInProgress )
+ {
+ switch(sourceType)
+ {
+ case AddressHome:
+ case AddressPreference:
+ case AddressWork:
+ {
+ publishValue( id, sourceType, addressCount );
+ break;
+ }
+
+ case AddressPlain:
+ {
+ publishCalEntry( id );
+ break;
+ }
+ default:
+ break;
+ };
+
+ }
+
+
+ }
+ else if ( KErrNotFound == error )
+ {
+ MYLOCLOGSTRING("getMapTileImage entry not found, return MapTileFetchingInProgress" );
+ //If entry is not found , it will be a newly added entry.
+ switch (sourceType) {
+ case AddressHome:
+ case AddressPreference:
+ case AddressWork:
+ {
+ publishValue(id, sourceType, addressCount);
+ break;
+ }
+
+ case AddressPlain:
+ {
+ publishCalEntry(id);
+ break;
+ }
+ default:
+ break;
+ };
+ maptileStatus = MapTileFetchingInProgress;
+ }
+
+ //Return the maptile status
+ MYLOCLOGSTRING("getMapTileImage returns MapTileFetchingUnknownError" );
+ return maptileStatus;
+
+}
+
+// -----------------------------------------------------------------------------
+// MapTileService::setMaptileStatus()
+// Gets call back from location engine , after maptile fetching done ,
+// to set status and emit signal .
+// -----------------------------------------------------------------------------
+//
+void MapTileService::setMaptileStatus()
+{
+ __TRACE_CALLSTACK;
+ QString imagePath;
+ AddressType addressType = AddressUnknown;
+ QStringList subPath = mSubscriber->subPaths();
+ QVariant value = mSubscriber->value(subPath.at(0));
+
+ //Subscriber Protocol : [appid-addresstype-maptilestatus]
+ QStringList text = value.toString().split("-");
+
+ int id = text.at(0).toInt();
+ int status = text.at(2).toInt();
+
+ switch( text.at(1).toInt() )
+ {
+ case ESourceContactsPref:
+ addressType = AddressPreference;
+ break;
+ case ESourceContactsWork:
+ addressType = AddressWork;
+ break;
+ case ESourceContactsHome:
+ addressType = AddressHome;
+ break;
+ case ESourceCalendar:
+ addressType = AddressPlain;
+ break;
+ default:
+ break;
+ }
+
+ //Emit the maptile status signal
+ int type = addressType;
+ MYLOCLOGSTRING1("setMaptileStatus() status - %d ", addressType );
+ if( mLastViewedEntryId == id )
+ {
+ emit maptileFetchingStatusUpdate( mLastViewedEntryId, type , status );
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// MapTileService::publishValue()
+// publish the contact entry
+// -----------------------------------------------------------------------------
+//
+void MapTileService::publishValue( int id, AddressType sourceType, int addressCount )
+{
+ __TRACE_CALLSTACK;
+ mLastViewedEntryId = id;
+
+ int addressType = ESourceInvalid;
+ switch( sourceType )
+ {
+ case AddressPreference:
+ addressType = ESourceContactsPref;
+ break;
+ case AddressWork:
+ addressType = ESourceContactsWork;
+ break;
+ case AddressHome:
+ addressType = ESourceContactsHome;
+ break;
+ }
+
+ if ( !mPublisher )
+ {
+ /* Constructs a QValueSpacePublisher that publishes values under path /mypublisher*/
+ mPublisher = new QValueSpacePublisher( MAPTILE_STATUS_PUBLISHER, this);
+ }
- //Image file to return;
-
+
+ /* Publisher protocol [appid-addresstype-count] */
+ QString addressId;
+ addressId.append( QVariant(id).toString());
+ addressId.append( QChar('-') );
+ addressId.append( QVariant(addressType).toString());
+ addressId.append( QChar('-') );
+ addressId.append( QVariant(addressCount).toString() );
+ mPublisher->setValue("name", addressId.toAscii() );
+ mPublisher->sync();
+
+}
+
+// -----------------------------------------------------------------------------
+// MapTileService::publishValue()
+// publish the calendar entry
+// -----------------------------------------------------------------------------
+//
+void MapTileService::publishCalEntry( int id)
+{
+ __TRACE_CALLSTACK;
+ mLastViewedEntryId = id;
+ if ( NULL ==mCalPublisher )
+ {
+ /* Constructs a QValueSpacePublisher that publishes values under path /mypublisher*/
+ mCalPublisher = new QValueSpacePublisher( MAPTILE_STATUS_CALENDAR_PUBLISHER, this);
+ }
+ mCalPublisher->setValue("name", id);
+ mCalPublisher->sync();
+}
+
+// -----------------------------------------------------------------------------
+// MapTileService::readEntryFromMaptileDataBase()
+// Read all entries from database
+// -----------------------------------------------------------------------------
+//
+int MapTileService::readEntryFromMaptileDataBase(
+ int id, AddressType sourceType, TLookupItem& aLookupItem, int& aNoOfAddress )
+{
+
//Maptile database instance
CLookupMapTileDatabase* mapTileDatabase = NULL;
TRAPD( err, mapTileDatabase = CLookupMapTileDatabase::NewL(
KMapTileLookupDatabaseName ) );
+
if ( KErrNone == err )
- {
- TLookupItem lookupItem;
- lookupItem.iUid = id;
- switch( sourceType )
- {
- case AddressPlain:
- lookupItem.iSource = ESourceCalendar;
- break;
- case AddressPreference:
- lookupItem.iSource = ESourceContactsPref;
- break;
- case AddressWork:
- lookupItem.iSource = ESourceContactsWork;
- break;
- case AddressHome:
- lookupItem.iSource = ESourceContactsHome;
- break;
- default:
- break;
+ {
+ TRAP( err,aNoOfAddress = mapTileDatabase->FindNumberOfAddressL(id) );
+ MYLOCLOGSTRING1("no of address FindNumberOfAddressL returns - %d ", err );
+ if ( KErrNone == err )
+ {
+ 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 );
}
-
- TRAP( err , mapTileDatabase->FindEntryL( lookupItem ) );
-
//delet the database instance
delete mapTileDatabase;
-
- //if entry available returns the file path otherwise NULL.
- if ( KErrNone == err )
- {
- //Get the image path
- QString imageFile((QChar*)lookupItem.iFilePath.Ptr(),
- lookupItem.iFilePath.Length());
- return imageFile;
- }
+
}
- return QString();
+ return err;
}
-
// End of file
-
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/homeaddressmap.png has changed
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/preferredaddressmap.png has changed
--- a/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,271 +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 service unit test cases
-*
-*/
-
-#include <QtTest/QtTest>
-#include <QtGui>
-#include <QString>
-#include <qtcontacts.h>
-#include <qcontactmanager.h>
-
-
-#include "maptileservice.h"
-
-
-//Maximum maptile processing time
-const int KMapTileFetchTime = 150000;
-
-QTM_USE_NAMESPACE
-
-
-//Maptile test interface class
-class MaptileServiceTest: public QObject
-{
- Q_OBJECT
-
-private slots:
-
- void checkLocationFeature();
- void getPreferredAddressMapTilePath();
- void getWorkAddressMapTilePath();
- void getHomeAddressMapTilePath();
- void checkInvalidContactId();
-
-};
-
-
-//Checks whether location feature enabled or disabled
-void MaptileServiceTest::checkLocationFeature()
-{
-
- QVERIFY( CntMapTileService::isLocationFeatureEnabled() == 1 );
-}
-
-//Checks the maptile path retrieval for preferred address
-void MaptileServiceTest::getPreferredAddressMapTilePath()
-{
-
- QContact* contact = new QContact();
-
- //Add contact name
- QContactName* name = new QContactName();
- name->setFirst("Raj");
- contact->saveDetail( name );
-
- //Add address
- QContactAddress* address = new QContactAddress();
- address->setPostOfficeBox("87640");
- address->setStreet("Torstrasse");
- address->setPostcode("12345");
- address->setLocality("Berlin");
- address->setCountry("Germany");
- contact->saveDetail(address);
-
- //Save the contact
- QContactManager* contactManager = NULL;
- contactManager = new QContactManager("symbian");
- contactManager->saveContact( contact );
-
- //Wait till maptile operation complete
- QTest::qWait( KMapTileFetchTime );
-
-
- //Get the saved id
- QContactId savedId = contact->id();
- TUint32 contactId = savedId.localId();
-
- //Get the maptile
- QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressPreference );
-
- //Construct the QPimap from reference bitmap
- QImage referenceBitmap( "c:\\maptiletest\\preferredaddressmap.png" );
-
- //Construct the QPixmap from new retrieved bitmap
- QImage retrievedBitmap( string );
-
-
- //delete the contact
- contactManager->removeContact( contactId );
-
- delete contact;
- delete name;
- delete address;
- delete contactManager;
-
-}
-
-//Checks the maptile path retrieval for work address
-void MaptileServiceTest::getWorkAddressMapTilePath()
-{
-
- QContact* contact = new QContact();
-
- //Set name
- QContactName* name = new QContactName();
- name->setFirst("Mike");
- contact->saveDetail(name);
-
- //Set address
- QContactAddress* address = new QContactAddress();
- address->setPostOfficeBox("2345");
- address->setPostcode("29834");
- address->setStreet("Domlur");
- address->setLocality("Bangalore");
- address->setCountry("India");
- address->setContexts(QContactDetail::ContextWork);
- contact->saveDetail(address);
-
- //Save the contact
- QContactManager* contactManager = NULL;
- contactManager = new QContactManager("symbian");
- contactManager->saveContact( contact );
-
- //Wait till maptile operation complete
- QTest::qWait( KMapTileFetchTime );
-
-
- //Get the saved id
- QContactId savedId = contact->id();
- TUint32 contactId = savedId.localId();
-
- //Get the maptile
- QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressWork );
-
- //Construct the QPimap from already stored bitmap
- QImage referenceBitmap( "c:\\maptiletest\\workaddressmap.png" );
-
- //Construct the QPixmap from new retrieved bitmap
- QImage retrievedBitmap( string );
-
- //check results are same
- QVERIFY( retrievedBitmap == referenceBitmap );
-
-
- contactManager->removeContact( contactId );
-
- delete contact;
- delete name;
- delete address;
- delete contactManager;
-
-}
-
-//Checks the maptile path retrieval for home address
-void MaptileServiceTest::getHomeAddressMapTilePath()
-{
-
- QContact* contact = new QContact();
-
- QContactName* name = new QContactName();
- name->setFirst("first");
- contact->saveDetail(name);
-
- QContactAddress* address = new QContactAddress();
- address->setContexts(QContactDetail::ContextHome);
- address->setPostOfficeBox("81282");
- address->setStreet("Keilalahdentie");
- address->setPostcode("67890");
- address->setLocality("Espoo");
- address->setCountry("Finland");
- contact->saveDetail(address);
-
- //Save the contact
- QContactManager* contactManager = NULL;
- contactManager = new QContactManager("symbian");
- contactManager->saveContact( contact );
-
- //Wait till maptile operation complete
- QTest::qWait( KMapTileFetchTime );
-
- //Get the saved id
- QContactId savedId = contact->id();
- TUint32 contactId = savedId.localId();
-
- //Get the maptile
- QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressHome );
-
- //Construct the QPimap from already stored bitmap
- QImage referenceBitmap( "c:\\maptiletest\\homeaddressmap.png" );
-
- //Construct the QPixmap from new retrieved bitmap
- QImage retrievedBitmap( string );
-
- //comapre the bitmaps
- QVERIFY( retrievedBitmap == referenceBitmap );
-
-
- contactManager->removeContact( contactId );
-
- delete contact;
- delete name;
- delete address;
- delete contactManager;
-
-}
-
-//Checks the maptile path retrieval returns NULL for invalid address
-void MaptileServiceTest::checkInvalidContactId()
-{
-
- QContact* contact = new QContact();
-
- QContactName* name = new QContactName();
- name->setFirst("first");
- contact->saveDetail(name);
-
- //Add some invalid address
- QContactAddress* address = new QContactAddress();
- address->setPostOfficeBox("11111");
- address->setStreet("htrtfdsk");
- address->setPostcode("98989");
- address->setLocality("ghwdxnkwnn");
- address->setCountry("Fbsjwskws");
- contact->saveDetail(address);
-
- //Save the contact
- QContactManager* contactManager = NULL;
- contactManager = new QContactManager("symbian");
- contactManager->saveContact( contact );
-
- //Wait till maptile operation complete
- QTest::qWait( KMapTileFetchTime );
-
-
- //Get the saved id
- QContactId savedId = contact->id();
- TUint32 contactId = savedId.localId();
-
- //Get the maptile
- QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressPreference );
-
- contactManager->removeContact( contactId );
-
- //Maptile path should be NULL for invalid address
- QVERIFY( string.isNull() );
-
- delete contact;
- delete name;
- delete address;
- delete contactManager;
-
-
-}
-
-
-QTEST_MAIN(MaptileServiceTest)
-#include "ut_maptileservice.moc"
-
-
--- a/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +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 service unit test case pro file
-*
-*/
-
-TEMPLATE = app
-QT += testlib
-
-INCLUDEPATH += inc
-INCLUDEPATH += ../inc
-
-symbian:
-{
- :BLD_INF_RULES.prj_exports += "preferredaddressmap.png /epoc32/winscw/c/maptiletest/preferredaddressmap.png"
- :BLD_INF_RULES.prj_exports += "workaddressmap.png /epoc32/winscw/c/maptiletest/workaddressmap.png"
- :BLD_INF_RULES.prj_exports += "homeaddressmap.png /epoc32/winscw/c/maptiletest/homeaddressmap.png"
- SYSTEMINCLUDEPATH += \epoc32\include\stdapis
-}
-
-SOURCES += ut_maptileservice.cpp
-
-
-LIBS += -lmaptileservice \
- -lQtContacts
-
-TARGET.CAPABILITY = ALL -TCB
-
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/workaddressmap.png has changed
--- a/locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h Wed Jun 23 18:07:15 2010 +0300
@@ -89,7 +89,28 @@
* @param[in] aFilePath Maptile file path.
*/
IMPORT_C void UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
- TFileName aFilePath );
+ TFileName& aFilePath );
+
+ /** Compare the address details to lplookupaddres table
+ *
+ * @param aLandmarks , address formed as landmark object
+ * @parama Id , id of entry to be checked in db table
+ * @param aAddressType , type of entry.
+ * @return , true for match case .
+ */
+ IMPORT_C TBool CheckIfAddressChanged(const CPosLandmark& aLandmarks,
+ const TUint32 aId, const TUidSourceType aAddressType);
+
+ /** Compare the address details to lplookupaddres table
+ *
+ * @param aAddress , one line address .
+ * @parama Id , id of entry to be checked in db table
+ * @param aAddressType , type of entry.
+ * @return , true for match case .
+ */
+ IMPORT_C TBool CheckIfAddressChanged(const TDesC& aAddress,
+ const TUint32 aId, const TUidSourceType aAddressType);
+
#ifdef LOCATION_DATA_HARVESTER_UNIT_TEST
public:
--- a/locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro Wed Jun 23 18:07:15 2010 +0300
@@ -29,6 +29,7 @@
INCLUDEPATH += ../inc
INCLUDEPATH += ../mylocationlogger/inc
+
defines += EPOCALLOWDLLDATA
symbian: {
@@ -36,7 +37,8 @@
TARGET.EPOCALLOWDLLDATA = 1
TARGET.CAPABILITY = All -Tcb
TARGET.UID3 = 0x2002FF5C
-
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
LIBS += -llbs \
-leposlandmarks \
-leposlmsearchlib \
@@ -56,6 +58,13 @@
HEADERS += inc/mylocationsdatabasemanager.h
+defBlock = \
+ "$${LITERAL_HASH}if defined(EABI)" \
+ "DEFFILE ../eabi/mylocationsdatabasemanager.def" \
+ "$${LITERAL_HASH}else" \
+ "DEFFILE ../bwins/mylocationsdatabasemanager.def" \
+ "$${LITERAL_HASH}endif"
+MMP_RULES += defBlock
--- a/locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -32,7 +32,7 @@
#include "mylocationsdefines.h"
#include <locationdatalookupdb.h>
-
+#include <QString>
// separator
_LIT( KSeparator, ",");
// space
@@ -288,7 +288,11 @@
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 );
@@ -388,6 +392,10 @@
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.
@@ -740,6 +748,7 @@
void CMyLocationsDatabaseManager::HandleLandmarkModificationL(
CPosLandmark* aLandmark, const TUint32 aUid )
{
+ __TRACE_CALLSTACK;
// logic: if a landmark is modified,
// first update the corresponding landmark lookup entry if present, else create a new entry.
// Check for any contact/calendar entries refering this landmark entry,
@@ -846,6 +855,7 @@
TBuf<KMaxAddressLength>& aLandmarkAddress,
const CPosLandmark* aLandmark)
{
+ __TRACE_CALLSTACK;
TPtrC tempStr;
TInt retStatus;
TBool addressEmtpy = ETrue;
@@ -995,6 +1005,7 @@
//
void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId )
{
+ __TRACE_CALLSTACK;
// get next duplicate item
QList<QLookupItem> itemArray;
iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
@@ -1015,6 +1026,7 @@
//
bool CMyLocationsDatabaseManager::IsDuplicateEntry( quint32 aLandmarkId )
{
+ __TRACE_CALLSTACK;
// get next duplicate item
QList<QLookupItem> itemArray;
iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
@@ -1077,10 +1089,49 @@
// -----------------------------------------------------------------------------
//
EXPORT_C void CMyLocationsDatabaseManager::UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
- TFileName aFilePath )
+ TFileName& aFilePath )
{
+ __TRACE_CALLSTACK;
QString filePath = QString( (QChar*)aFilePath.Ptr(), aFilePath.Length() );
iLocationAppLookupDb->updateMaptileBySourceIdAndType( aSourceId, aSourceType, filePath );
}
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CheckIfAddressChanged()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMyLocationsDatabaseManager::CheckIfAddressChanged(const CPosLandmark& aLandmarks,
+ const TUint32 aId, const TUidSourceType aAddressType)
+{
+ __TRACE_CALLSTACK;
+ QString target = iLocationAppLookupDb->getAddressDetails(aId, aAddressType);
+ TBuf<KMaxAddressLength> lmAddress;
+ GetLandmarkFullAddress(lmAddress, &aLandmarks);
+ QString source = QString((QChar*) lmAddress.Ptr(), lmAddress.Length());
+ if (source == target)
+ {
+ return EFalse;
+ }
+ return ETrue;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CheckIfAddressChanged()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMyLocationsDatabaseManager::CheckIfAddressChanged(const TDesC& aAddress,
+ const TUint32 aId, const TUidSourceType aAddressType)
+{
+ __TRACE_CALLSTACK;
+ TBool compareStatus = ETrue;
+ QString target=iLocationAppLookupDb->getAddressDetails( aId , aAddressType );
+ QString source = QString( (QChar*)aAddress.Ptr(), aAddress.Length());
+ if( source == target )
+ {
+ compareStatus= EFalse;
+ }
+ return compareStatus;
+}
+
// End of file
--- a/locationdataharvester/mylocationsdatabasemanager/tsrc/ut_mylocationsdatabasemanager.cpp Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +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: mylocations database manager unit test cases
-*
-*/
-
-#include <QtTest/QtTest>
-#include <QtGui>
-#include <QString>
-
-#include <mylocationsdatabasemanager.h>
-#include <locationservicedefines.h>
-#include <EPos_CPosLandmark.h>
-#include <lbsposition.h>
-
-
-//Lookup db test interface class
-class CMyLocationsDatabaseManagerTest: public QObject
-{
- Q_OBJECT
-
-private slots:
-
- void testCase1();
- void testCase2();
- void testCase3();
- void testCase4();
-};
-
-
-//Tests basic construction and destruction
-void CMyLocationsDatabaseManagerTest::testCase1()
-{
- // tests just new and delete operation.
- CMyLocationsDatabaseManager* dbm = new CMyLocationsDatabaseManager();
- QVERIFY( dbm != NULL );
- delete dbm;
- dbm = NULL;
-
- // tests ConstructL()
- dbm = new CMyLocationsDatabaseManager();
- dbm->ConstructL();
- QVERIFY( dbm->iLocationAppLookupDb != NULL );
- delete dbm;
-}
-
-//Tests UpdateDatabaseL()
-void CMyLocationsDatabaseManagerTest::testCase2()
-{
- // tests just new and delete operation.
- CMyLocationsDatabaseManager* dbm = new CMyLocationsDatabaseManager();
- QVERIFY( dbm != NULL );
- dbm->ConstructL();
-
- CPosLandmark* lm = CPosLandmark::NewL();
- lm->SetLandmarkNameL(_L("John"));
- lm->SetPositionFieldL( EPositionFieldStreet, _L("MG Road") );
- TLocality loc( TCoordinate( 0.1, 0.2 ), 0 );
- lm->SetPositionL(loc);
-
- // test add
- dbm->UpdateDatabaseL( lm, 1, ESourceContactsPref, EEntryAdded );
- QLookupItem item;
- item.mSourceType = ESourceContactsPref;
- item.mSourceUid = 1;
- bool flag = dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
- QVERIFY( flag == true );
- QVERIFY( item.mStreet == "MG Road" );
-
- // test modify
- lm->SetPositionFieldL( EPositionFieldStreet, _L("Brigade Road") );
- dbm->UpdateDatabaseL( lm, 1, ESourceContactsPref, EEntryModified );
- flag = dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
- QVERIFY( flag == true );
- QVERIFY( item.mStreet == "Brigade Road" );
-
- dbm->UpdateDatabaseL( lm, 1, ESourceContactsPref, EEntryModified );
- flag = dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
- QVERIFY( flag == true );
- QVERIFY( item.mStreet == "Brigade Road" );
-
- // test delete
- dbm->UpdateDatabaseL( NULL, 1, ESourceContactsPref, EEntryDeleted );
- flag = dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
- QVERIFY( flag == false );
-
- // check invalid
- dbm->UpdateDatabaseL( NULL, 1, ESourceContactsPref, EEntryUnknown );
- flag = dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
- QVERIFY( flag == false );
-
- delete lm;
- delete dbm;
-}
-
-//Tests GetLandmarkFullAddress() and FillLookupItemAddressDetails()
-void CMyLocationsDatabaseManagerTest::testCase3()
-{
- CMyLocationsDatabaseManager* dbm = new CMyLocationsDatabaseManager();
- dbm->ConstructL();
- QVERIFY( dbm->iLocationAppLookupDb != NULL );
-
- QLookupItem item;
-
- CPosLandmark* lm = CPosLandmark::NewL();
- TBuf<255> buff;
- dbm->GetLandmarkFullAddress( buff, lm );
- QString str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- QVERIFY( str1 == "" );
-
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( item.mName == "" );
- QVERIFY( item.mStreet == "" );
- QVERIFY( item.mPostalCode == "" );
- QVERIFY( item.mCity == "" );
- QVERIFY( item.mState == "" );
- QVERIFY( item.mCountry == "" );
-
- lm->SetLandmarkNameL( _L("name") );
- lm->SetPositionFieldL( EPositionFieldCountry, _L("india") );
- dbm->GetLandmarkFullAddress( buff, lm );
- str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- QVERIFY( str1 == "india" );
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( item.mName == "name" );
- QVERIFY( item.mCountry == "india" );
-
- lm->SetPositionFieldL( EPositionFieldState, _L("kar") );
- dbm->GetLandmarkFullAddress( buff, lm );
- str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- QVERIFY( str1 == "kar, india" );
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( item.mState == "kar" );
-
- lm->SetPositionFieldL( EPositionFieldCity, _L("blr") );
- dbm->GetLandmarkFullAddress( buff, lm );
- str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- QVERIFY( str1 == "blr, kar, india" );
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( item.mCity == "blr" );
-
- lm->SetPositionFieldL( EPositionFieldPostalCode, _L("postalcode") );
- lm->SetPositionFieldL( EPositionFieldStreet, _L("mg road") );
- dbm->GetLandmarkFullAddress( buff, lm );
- str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- QVERIFY( str1 == "mg road, blr, kar, india" );
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( item.mPostalCode == "postalcode" );
- QVERIFY( item.mStreet == "mg road" );
-
- lm->SetLandmarkNameL(_L(""));
- lm->SetPositionFieldL( EPositionFieldStreet, _L("") );
- lm->SetPositionFieldL( EPositionFieldPostalCode, _L("") );
- lm->SetPositionFieldL( EPositionFieldCity, _L("") );
- lm->SetPositionFieldL( EPositionFieldState, _L("") );
- lm->SetPositionFieldL( EPositionFieldCountry, _L("") );
- dbm->GetLandmarkFullAddress( buff, lm );
- str1 = QString( (QChar*)buff.Ptr(), buff.Length());
- dbm->FillLookupItemAddressDetails( lm, item );
- QVERIFY( str1 == "" );
- QVERIFY( item.mName == "" );
- QVERIFY( item.mStreet == "" );
- QVERIFY( item.mPostalCode == "" );
- QVERIFY( item.mCity == "" );
- QVERIFY( item.mState == "" );
- QVERIFY( item.mCountry == "" );
-
- delete lm;
- delete dbm;
-}
-
-//Tests UpdateMapTilePath()
-void CMyLocationsDatabaseManagerTest::testCase4()
-{
- // tests just new and delete operation.
- CMyLocationsDatabaseManager* dbm = new CMyLocationsDatabaseManager();
- dbm->ConstructL();
- QVERIFY( dbm->iLocationAppLookupDb != NULL );
-
- QLookupItem item;
- item.mSourceType = ESourceCalendar;
- item.mSourceUid = 1;
- dbm->iLocationAppLookupDb->createEntry( item );
- dbm->UpdateMapTilePath( item.mSourceUid, item.mSourceType, _L("maptile.png") );
- dbm->iLocationAppLookupDb->findEntryBySourceIdAndType( item );
-
- QVERIFY( item.mMapTilePath == "maptile.png" );
-
- dbm->iLocationAppLookupDb->deleteEntryBySourceIdAndType( item );
- delete dbm;
-}
-
-QTEST_MAIN(CMyLocationsDatabaseManagerTest)
-#include "ut_mylocationsdatabasemanager.moc"
-
-
--- a/locationdataharvester/mylocationsdatabasemanager/tsrc/ut_mylocationsdatabasemanager.pro Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +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:
-#
-#
-
-TEMPLATE = app
-TARGET = ut_mylocationsdatabasemanager
-
-CONFIG += hb
-QT += testlib
-
-symbian:
-{
- SYSTEMINCLUDEPATH += \epoc32\include\stdapis
-}
-
-DEPENDPATH += .
-INCLUDEPATH += .
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../mylocationlogger/inc
-
-defines += EPOCALLOWDLLDATA
-DEFINES += LOCATION_DATA_HARVESTER_UNIT_TEST
-
-symbian: {
-
- TARGET.EPOCALLOWDLLDATA = 1
- TARGET.CAPABILITY = All -Tcb
-
- LIBS += -llbs \
- -leposlandmarks \
- -leposlmsearchlib \
- -leuser \
- -leposlmdbmanlib \
- -lcntmodel \
- -lefsrv \
- -lflogger \
- -ledbms \
- -lbafl \
- -lcalinterimapi \
- -llocationdatalookupdb
-
-}
-
-SOURCES += ../src/mylocationsdatabasemanager.cpp \
-ut_mylocationsdatabasemanager.cpp
-
-HEADERS += ../inc/mylocationsdatabasemanager.h
-
-
-
-
--- a/locationdataharvester/mylocationsengine/inc/addresscomparision.h Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +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: Address comparison header file implementation.
-*
-*/
-
-#ifndef ADDRESSCOMPARISION_H_
-#define ADDRESSCOMPARISION_H_
-#include <locationservicedefines.h>
-#include <EPos_CPosLandmarkDatabase.h>
-
-
-class CAddressComparision : public CBase
- {
-public:
-
- static CAddressComparision* NewL();
- /**
- * Is edited address changed .
- * @param aLandmarks handle to all type of address
- * @param aCntId contact id.
- * @param aAddressType type of address
- * @return Status code(ETrue address is changed ,EFalse is not changed)
- */
- TBool IsAddressChangedL( const CPosLandmark& aLandmarks, const TInt32 aCntId,
- const TUidSourceType aAddressType );
-
-private:
-
- /**
- * CAdressComparision.
- * C++ default constructor.
- */
- CAddressComparision();
-
- // Handle to landmarks db
- CPosLandmarkDatabase* iLandmarkDb;
-
- };
-#endif /* ADDRESSCOMPARISION_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/calendarsubscriber.h Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,79 @@
+/*
+ * 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: Subscribe notification .
+ *
+ */
+#ifndef CALENDARSUBSCRIBER_H
+#define CALENDARSUBSCRIBER_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32property.h>
+#include "notification.h"
+class CCalendarSubscriber : public CActive
+{
+public:
+ /**
+ * CCalendarSubscriber::NewL()
+ */
+ static CCalendarSubscriber* NewL(MNotifyChange* aNotifyChange);
+
+ /**
+ * CCalendarSubscriber::NewL()
+ */
+ static CCalendarSubscriber* NewLC(MNotifyChange* aNotifyChange);
+ /**
+ * ~CCalendarSubscriber.
+ * Virtual Destructor.
+ */
+ virtual ~ CCalendarSubscriber();
+
+private:
+ /**
+ * ConstructL.
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+ /**
+ * CMyLocationsEngine.
+ * C++ default constructor.
+ */
+ CCalendarSubscriber(MNotifyChange* aNotifyChange);
+
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
+private:
+#endif
+
+ /**
+ * start subscribe for calendar entry
+ */
+ void SubscribeChangeNotiFication();
+
+ /**
+ * Handles active object's request completion event.
+ */
+ void RunL();
+ /**
+ * Implements cancellation of an outstanding request.
+ */
+ void DoCancel();
+private:
+ //observer to provide notification on completion of event
+ MNotifyChange& iNotifyChange;
+ RProperty iProperty;
+};
+#endif // CALENDARSUBSCRIBER_H
--- a/locationdataharvester/mylocationsengine/inc/calendernotification.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/calendernotification.h Wed Jun 23 18:07:15 2010 +0300
@@ -22,16 +22,11 @@
#include <e32base.h>
#include <f32file.h>
-
+#include "notification.h"
/**
* The observer class gives notification to derive class .
* When calender db creates in specific path.
*/
-class MNotifyChange
-{
-public:
- virtual void NotifyChangeL(TInt &aStatus)=0;
-};
class CCalenderNotification : public CActive
{
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/contactsubscriber.h Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+ * 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: Subscribe notification .
+ *
+ */
+#ifndef CONTACTSUBSCRIBER_H
+#define CONTACTSUBSCRIBER_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <e32property.h>
+#include "notification.h"
+class CContactSubscriber : public CActive
+{
+public:
+ /**
+ * CContactSubscriber::NewL()
+ */
+ static CContactSubscriber* NewL(MNotifyChange* aNotifyChange);
+
+ /**
+ * CContactSubscriber::NewL()
+ */
+ static CContactSubscriber* NewLC(MNotifyChange* aNotifyChange);
+ /**
+ * ~CContactSubscriber.
+ * Virtual Destructor.
+ */
+ virtual ~ CContactSubscriber();
+
+private:
+ /**
+ * ConstructL.
+ * 2nd phase constructor.
+ */
+ void ConstructL();
+ /**
+ * CMyLocationsEngine.
+ * C++ default constructor.
+ */
+ CContactSubscriber(MNotifyChange* aNotifyChange);
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
+private:
+#endif
+
+ /**
+ start subscribe for contact entry
+ */
+ void SubscribeChangeNotiFication();
+
+ /**
+ * Handles active object's request completion event.
+ */
+ void RunL();
+ /**
+ * Implements cancellation of an outstanding request.
+ */
+ void DoCancel();
+private:
+ //observer to provide notification on completion of event
+ MNotifyChange& iNotifyChange;
+ RProperty iProperty;
+};
+#endif // CONTACTSUBSCRIBER_H
--- a/locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h Wed Jun 23 18:07:15 2010 +0300
@@ -52,7 +52,7 @@
~CLookupMapTileDatabase();
public:
-
+
/**
* Opens the lookup database.
*/
@@ -105,7 +105,12 @@
void FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState,
RArray<TLookupItem>& aLookupItemArray);
-
+ /**
+ * 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
--- a/locationdataharvester/mylocationsengine/inc/maptileinterface.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/maptileinterface.h Wed Jun 23 18:07:15 2010 +0300
@@ -115,7 +115,11 @@
*/
void GetMapTileL( const TReal& aLatitude, const TReal& aLongitude );
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
/**
* Converts geocoordinates to maptile pixel coordinate and update the
@@ -129,7 +133,11 @@
*/
void SetLandMarkDetailsL(MAddressInfo& aAddressInfo);
-protected:
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
+protected:
+#endif
/**
* Derived from MMaptileGeocoderObserver
@@ -141,14 +149,22 @@
*/
void MapTileFetchingCompleted( TInt aErrorcode, const TDesC& aMapImagePath );
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
/**
* Two phase construction
*/
void ConstructL();
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
//MaptileGeocode plugin interface instance
CMaptileGeocoderPlugin* iMaptileGeocoder;
--- a/locationdataharvester/mylocationsengine/inc/mylocationgeotagtimerao.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/mylocationgeotagtimerao.h Wed Jun 23 18:07:15 2010 +0300
@@ -59,7 +59,11 @@
void StartTimer();
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
protected:
+#endif
/*
* @see CActive::RunL()
*/
--- a/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Wed Jun 23 18:07:15 2010 +0300
@@ -38,10 +38,10 @@
#include "maptileinterface.h"
#include "mylocationsdatabasemanager.h"
#include "lookupmaptiledb.h"
-#include "addresscomparision.h"
#include "calendernotification.h"
#include "mylocationgeotagtimerao.h"
-
+class CContactSubscriber;
+class CCalendarSubscriber;
using namespace QTM_NAMESPACE;
/**
@@ -71,6 +71,18 @@
TInt iEventType;
};
+/**
+ * This class stores the information required for maptile
+ * processing when it is triggered from the application(contact)
+ * viewer.
+ */
+class TAppAddressInfo
+{
+public:
+ TInt iUid;
+ TInt iAddressType;
+};
+
// CLASS DECLARATION
/** Class used to listen on various database change events from applications like calendar,
* contacts, landmarks
@@ -210,7 +222,7 @@
* @param aUId, uid of the event.
*/
void RequestMapTileImageL( CPosLandmark& aLandmark, const TUidSourceType aAddressType,
- const TInt32 aUId );
+ const TInt32 aUId, const TInt aEventType );
/**
* Requests for map tile image , one box serch.
@@ -219,7 +231,7 @@
* @param aUId, uid of the event.
*/
void RequestMapTileImageL(const TDesC& aAddressDetails,
- const TUidSourceType aAddressType, const TInt32 aUId);
+ const TUidSourceType aAddressType, const TInt32 aUId,const TInt aEventType);
/**
* Checks whether contact has a valid geocoordinates.
@@ -249,6 +261,10 @@
void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);
/**
+ * Calender entry modifyied.
+ */
+ void CalenderEntryModifyL(TCalChangeEntry aCalChangeEntry);
+ /**
* Update the mylocations database.
*/
void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid,
@@ -267,7 +283,8 @@
/**
* maptile database manipulation.
*/
- void ManipulateMapTileDataBaseL(TLookupItem aLookupItem);
+ void ManipulateMapTileDataBaseL(TLookupItem& aLookupItem);
+
public: //From MMapTileObserver
/**
@@ -280,11 +297,10 @@
*/
void GeoCodefetchingCompleted( TInt aErrCode, const TReal& aLatitude,
const TReal& aLongitude, const TDesC& aMapTilePath );
-
-
-
public://from MNotifychange
void NotifyChangeL(TInt &aStatus);
+ void GetChangeNotificationL(TInt &aId, TInt &addressType, TInt &addressCount );
+ void SubscribeFromCalendarL(TInt aId);
public: //from MyLocationTimerObserver
/**
@@ -293,7 +309,11 @@
void MyLocationThreeAMTimerExpiredL();
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
// Data member
@@ -327,9 +347,6 @@
//Current event type
TInt iEventType;
- //Address comparison pointer
- CAddressComparision *iAddressCompare;
-
//Maptile image request queue
RArray<CMapTileRequest*> iMapTileRequestQueue;
@@ -348,6 +365,21 @@
//Contact manager instance for retrieving contact info.
QContactManager* iContactManager;
+ //Subscribe from contact
+ CContactSubscriber *iContactSubscriber;
+
+ //Subscribe from calendar
+ CCalendarSubscriber *iCalendarSubscriber;
+
+ //Last viewed contact id
+ TInt iLastContactId;
+
+ //Last viewed calendar id
+ TInt iLastCalendarId;
+
+ //Address information for viewver maptile processing.
+ RArray<TAppAddressInfo*> iAddressInfo;
+
};
#endif // __MYLOCATIONSENGINE_H__
--- a/locationdataharvester/mylocationsengine/mylocationsengine.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/mylocationsengine.pro Wed Jun 23 18:07:15 2010 +0300
@@ -1,7 +1,8 @@
TEMPLATE=app
TARGET=mylocationsengine
-CONFIG += Qt
+CONFIG += Qt mobility
+MOBILITY = publishsubscribe
DEPENDPATH += .
INCLUDEPATH += .
INCLUDEPATH += ../inc
@@ -11,6 +12,7 @@
INCLUDEPATH += ../mylocationsdatabasemanager/inc
INCLUDEPATH += /epoc32/include/app
+
symbian: {
TARGET.UID3 = 0x2002680A
@@ -18,7 +20,8 @@
isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 20480 \
16943040
TARGET.CAPABILITY = ALL -TCB
-
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
LIBS += -llbs \
-leposlandmarks \
-leposlmsearchlib \
@@ -35,24 +38,31 @@
-lcalinterimapi \
-llocationdatalookupdb \
-lmylocationsdatabasemanager
+
+
+ myCrml.sources = ./conf/maptilestatuspublisher.qcrml
+ myCrml.path = c:/resource/qt/crml
+ DEPLOYMENT += myCrml
}
SOURCES += src/appmain.cpp \
src/mylocationsengine.cpp \
src/maptileinterface.cpp \
- src/addresscomparision.cpp \
src/lookupmaptiledb.cpp \
src/calendernotification.cpp \
- src/mylocationgeotagtimerao.cpp
+ src/mylocationgeotagtimerao.cpp \
+ src/contactsubscriber.cpp \
+ src/calendarsubscriber.cpp
HEADERS += inc/appmain.h \
inc/mylocationsengine.h \
inc/maptileinterface.h \
- inc/addresscomparision.h \
inc/lookupmaptiledb.h \
inc/calendernotification.h \
- inc/mylocationgeotagtimerao.h
+ inc/mylocationgeotagtimerao.h \
+ inc/contactsubscriber.h \
+ inc/calendarsubscriber.h
--- a/locationdataharvester/mylocationsengine/src/addresscomparision.cpp Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +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: Address comparison source implementation for maptile
-* service.
-*
-*/
-
-#include "mylocationlogger.h"
-#include "addresscomparision.h"
-
-// -----------------------------------------------------------------------------
-// CAddressComparision::NewL()
-// -----------------------------------------------------------------------------
-//
-CAddressComparision* CAddressComparision::NewL()
-{
- CAddressComparision* self = new (ELeave) CAddressComparision();
- return self;
-}
-// -----------------------------------------------------------------------------
-// CAddressComparision::CAddressComparision()
-// -----------------------------------------------------------------------------
-//
-CAddressComparision::CAddressComparision()
-{
-
-}
-// -----------------------------------------------------------------------------
-// CAddressComparision::IsAddressChangedL()
-// Need to enhance the functionality for address comparison
-// -----------------------------------------------------------------------------
-//
-
-TBool CAddressComparision::IsAddressChangedL(const CPosLandmark& /*aLandmarks*/,
- const TInt32 /*aCntId*/, const TUidSourceType/* aAddressType*/)
-{
- __TRACE_CALLSTACK;
-
-
- TBool addressChanged = ETrue;
- return addressChanged;//addressChanged;
-}
-
-//end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/calendarsubscriber.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,133 @@
+/*
+ * 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: Subscribe source implementation for getting calendar status
+ * notification from publisher .
+ *
+ */
+#include "calendarsubscriber.h"
+#include <locationservicedefines.h>
+#include "mylocationlogger.h"
+const TUid KCalendarPropertyCat={0x10005901};
+enum TMyPropertyKeys {EMyPropertyInteger=0x1};
+
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::NewL()
+// -----------------------------------------------------------------------------
+//
+CCalendarSubscriber* CCalendarSubscriber::NewL(MNotifyChange* aNotifyChange)
+{
+ CCalendarSubscriber* self = CCalendarSubscriber::NewLC(aNotifyChange);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCalendarSubscriber* CCalendarSubscriber::NewLC(
+ MNotifyChange* aNotifyChange)
+{
+ CCalendarSubscriber* self = new (ELeave) CCalendarSubscriber(
+ aNotifyChange);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCalendarSubscriber::ConstructL()
+{
+ __TRACE_CALLSTACK;
+ CActiveScheduler::Add(this);
+ TInt ret = iProperty.Attach(KCalendarPropertyCat, EMyPropertyInteger);
+
+ if (KErrNone == ret)
+ {
+ SubscribeChangeNotiFication();
+
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::SubscribeChangeNotiFication()
+// start subscribe for calendar entry
+// -----------------------------------------------------------------------------
+//
+void CCalendarSubscriber::SubscribeChangeNotiFication()
+{
+ __TRACE_CALLSTACK;
+ Cancel();
+ // resubscribe before processing new value to prevent missing updates
+ iProperty.Subscribe(iStatus);
+ SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::CCalendarSubscriber()
+// Default constructor .
+// -----------------------------------------------------------------------------
+//
+CCalendarSubscriber::CCalendarSubscriber(MNotifyChange* aNotifyChange) :
+ CActive(EPriorityStandard),
+ iNotifyChange(*aNotifyChange)
+
+{
+}
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::~CCalendarSubscriber()
+// default destuctor.
+// -----------------------------------------------------------------------------
+//
+CCalendarSubscriber::~CCalendarSubscriber()
+{
+ __TRACE_CALLSTACK;
+ Cancel();
+ iProperty.Close();
+
+}
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::RunL()
+// Assyncronous request handler , on completion of notification
+// -----------------------------------------------------------------------------
+//
+void CCalendarSubscriber::RunL()
+{
+ __TRACE_CALLSTACK;
+ SubscribeChangeNotiFication();
+ // property updated, get new value
+ TInt value;
+ if ( KErrNone == iProperty.Get( value ) && value > 0)
+ {
+ iNotifyChange.SubscribeFromCalendarL( value );
+ }
+}
+// -----------------------------------------------------------------------------
+// CCalendarSubscriber::DoCancel()
+// Handels the error condition on assynchronous request
+// -----------------------------------------------------------------------------
+//
+void CCalendarSubscriber::DoCancel()
+{
+ __TRACE_CALLSTACK;
+ iProperty.Cancel();
+}
+
+//End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/contactsubscriber.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,156 @@
+/*
+ * 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: Subscribe source implementation for getting contact status
+ * notification from publisher.
+ *
+ */
+#include "contactsubscriber.h"
+#include "mylocationlogger.h"
+#include <locationservicedefines.h>
+
+const TUid KContactPropertyCat={0x20022EF9};
+enum TMyPropertyKeys {EMyPropertyInteger=0x1, EMyPropertyType=0x2};
+const TInt KBufferSize=16;
+
+// -----------------------------------------------------------------------------
+// CContactSubscriber::NewL()
+// -----------------------------------------------------------------------------
+//
+CContactSubscriber* CContactSubscriber::NewL(MNotifyChange* aNotifyChange)
+{
+ CContactSubscriber* self = CContactSubscriber::NewLC(aNotifyChange);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CContactSubscriber::NewLC()
+// -----------------------------------------------------------------------------
+//
+CContactSubscriber* CContactSubscriber::NewLC(
+ MNotifyChange* aNotifyChange)
+{
+ CContactSubscriber* self = new (ELeave) CContactSubscriber(
+ aNotifyChange);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+// -----------------------------------------------------------------------------
+// CContactSubscriber::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CContactSubscriber::ConstructL()
+{
+ __TRACE_CALLSTACK;
+ CActiveScheduler::Add(this);
+ TInt ret = iProperty.Attach(KContactPropertyCat, EMyPropertyInteger);
+ if (KErrNone == ret)
+ {
+ SubscribeChangeNotiFication();
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CContactSubscriber::SubscribeChangeNotiFication()
+// start subscribe for contact entry
+// -----------------------------------------------------------------------------
+//
+void CContactSubscriber::SubscribeChangeNotiFication()
+{
+ __TRACE_CALLSTACK;
+ if (IsActive())
+ {
+ Cancel();
+ }
+ // resubscribe before processing new value to prevent missing updates
+ iProperty.Subscribe(iStatus);
+ SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// CContactSubscriber::CContactSubscriber()
+// Default constructor .
+// -----------------------------------------------------------------------------
+//
+CContactSubscriber::CContactSubscriber(MNotifyChange* aNotifyChange) :
+ CActive(EPriorityStandard),
+ iNotifyChange(*aNotifyChange)
+
+{
+}
+// -----------------------------------------------------------------------------
+// CContactSubscriber::~CContactSubscriber()
+// default destuctor.
+// -----------------------------------------------------------------------------
+//
+CContactSubscriber::~CContactSubscriber()
+{
+ __TRACE_CALLSTACK;
+ Cancel();
+ iProperty.Close();
+
+}
+// -----------------------------------------------------------------------------
+// CContactSubscriber::RunL()
+// Assyncronous request handler , on completion of notification
+// -----------------------------------------------------------------------------
+//
+void CContactSubscriber::RunL()
+{
+ __TRACE_CALLSTACK;
+ SubscribeChangeNotiFication();
+ // property updated, get new value
+ TBuf8 <KBufferSize> value;
+ TPtrC8 id;
+ TPtrC8 sourceType;
+ TPtrC8 addressCount;
+
+ if ( KErrNone == iProperty.Get( value ) )
+ {
+ TInt pos = value.Locate(TChar('-'));
+ id.Set( value.Left(pos) );
+
+ TPtrC8 ptr = value.Right(3);
+ sourceType.Set(ptr.Left(1));
+ addressCount.Set(ptr.Right(1));
+
+ TInt appId = -1, addressType = -1, addressTypeCount = -1;
+ TLex8 lex(id);
+ lex.Val(appId);
+
+ TLex8 lex1(sourceType);
+ lex1.Val( addressType );
+
+ TLex8 lex2(addressCount);
+ lex2.Val(addressTypeCount);
+
+ iNotifyChange.GetChangeNotificationL( appId, addressType,addressTypeCount );
+ }
+}
+// -----------------------------------------------------------------------------
+// CContactSubscriber::DoCancel()
+// Handels the error condition on assynchronous request
+// -----------------------------------------------------------------------------
+//
+void CContactSubscriber::DoCancel()
+{
+ iProperty.Cancel();
+}
+
+//End of file
+
--- a/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -210,6 +210,49 @@
}
// -----------------------------------------------------------------------------
+// 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();
+ Open();
+
+ }
+ 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.
// -----------------------------------------------------------------------------
@@ -235,7 +278,7 @@
myView.EvaluateAll();
myView.FirstL();
-
+
if (myView.AtRow())
{
// found the entry. update it.
@@ -243,12 +286,12 @@
myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK
myView.PutL();
- }
+ }
CleanupStack::PopAndDestroy(&myView); // myView
iItemsDatabase.Commit();
- Close();
+ Close();
}
--- a/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -29,8 +29,8 @@
#include <math.h>
//Invalid latitude & longitude value
-const TReal KInvalidLatitudeLongitude = 200.00;
-const TInt KStreetLvelZoom = 15;
+const TReal KInvalidLatitudeLongitude = 200.0f;
+const TInt KStreetLvelZoom = 16;
const TInt KCityLevelZoom = 11;
const TInt KMapTileWidth= 330;
const TInt KMapTileHeight= 128;
@@ -142,7 +142,7 @@
}
// -----------------------------------------------------------------------------
-// CMapTileInterface::GetMapTileImageL()
+// CMapTileInterface::GetMapTileL()
// Function for Retrieving latitude & longitude information
// -----------------------------------------------------------------------------
//
--- a/locationdataharvester/mylocationsengine/src/mylocationgeotagtimerao.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/mylocationgeotagtimerao.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -47,7 +47,7 @@
CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO()
{
MYLOCLOGSTRING ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), begin");
- DoCancel();
+ Cancel();
MYLOCLOGSTRING ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), end");
}
--- a/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -26,6 +26,9 @@
#include <bautils.h>
#include <f32file.h>
#include <locationservicedefines.h>
+#include <e32property.h>
+#include "contactsubscriber.h"
+#include "calendarsubscriber.h"
#include "mylocationsengine.h"
#include "mylocationsdefines.h"
#include "geocodeupdate.h" //header for GeocodeUpdate class
@@ -37,6 +40,12 @@
_LIT(KFolderName,":\\MapTile\\");
const TInt KImagePathSize=36;
const TInt KDefaultFilePathSize = 20;
+const TUid KMaptileStatusPublish={0x2002680A};
+enum TMaptileStatusKeys {EMaptileStatusInteger=0x1};
+
+//Protocol : [appid-addresstype-maptilestatus]
+_LIT8( KMaptileStatusFormat, "%d-%d-%d" );
+const TInt KProtocolBufferSize = 16;
// ============================ MEMBER FUNCTIONS ===============================
@@ -81,8 +90,6 @@
iMaptileDatabase = CLookupMapTileDatabase::NewL(KMapTileLookupDatabaseName);
MYLOCLOGSTRING("Maptile Db instance created ");
-
- iAddressCompare = CAddressComparision::NewL();
iMyLocationThreeAMTimer = CLocationGeoTagTimerAO::NewL(*this);
@@ -106,6 +113,9 @@
// Start listening to landmarks db changes
StartLandmarksChangeNotifier();
+ iContactSubscriber = CContactSubscriber::NewL(this);
+ iCalendarSubscriber = CCalendarSubscriber::NewL(this);
+ TInt ret = RProperty::Define( KMaptileStatusPublish, EMaptileStatusInteger, RProperty::EByteArray );
}
// -----------------------------------------------------------------------------
@@ -209,14 +219,22 @@
//
CMyLocationsEngine::CMyLocationsEngine() :
CActive(EPriorityStandard),
- iCalSession(NULL), iCalView(NULL),
- iContactsDb(NULL), iContactChangeNotifier(NULL),
+ iCalSession(NULL),
+ iCalView(NULL),
+ iContactsDb(NULL),
+ iContactChangeNotifier(NULL),
iLandmarkDb(NULL),
- iMapTileInterface(NULL), iMyLocationsDatabaseManager(NULL),
- iMaptileDatabase(NULL), iAddressCompare(NULL),
+ iMapTileInterface(NULL),
+ iMyLocationsDatabaseManager(NULL),
+ iMaptileDatabase(NULL),
iMyLocationThreeAMTimer(NULL),
- iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL),
- iContactManager(NULL)
+ iMaptileGeocoderPluginAvailable(EFalse),
+ iCalenderNotification(NULL),
+ iContactManager(NULL),
+ iContactSubscriber(NULL),
+ iCalendarSubscriber(NULL),
+ iLastContactId( -1 ) ,
+ iLastCalendarId( 0 )
{
}
@@ -230,6 +248,8 @@
{
__TRACE_CALLSTACK;// delete the member variables.
+ Cancel();
+
delete iContactChangeNotifier;
delete iMyLocationsDatabaseManager;
@@ -245,15 +265,27 @@
delete iMapTileInterface;
delete iMaptileDatabase;
-
- delete iAddressCompare;
-
+
delete iCalenderNotification;
delete iMyLocationThreeAMTimer;
delete iContactManager;
+ delete iContactSubscriber;
+
+ delete iCalendarSubscriber;
+
+ //free the allocated memory
+ for( TInt index = 0; index < iAddressInfo.Count(); index++ )
+ {
+ delete iAddressInfo[index];
+ iAddressInfo.Remove(index);
+ iAddressInfo.Compress();
+ }
+
+ iAddressInfo.Reset();
+
}
// -----------------------------------------------------------------------------
@@ -287,6 +319,137 @@
}
}
// -----------------------------------------------------------------------------
+// CMyLocationsEngine::GetChangeNoficationL()
+// To get callbacks through publisher from contact context
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::GetChangeNotificationL( TInt &aId, TInt& addressType, TInt& addressCount )
+{
+ __TRACE_CALLSTACK;
+
+ iLastContactId = aId;
+
+ TAppAddressInfo* addressInfo = new (ELeave) TAppAddressInfo;
+ addressInfo->iUid = aId;
+ addressInfo->iAddressType = addressType;
+ //Memory will be freed when the queue is deleted
+ if( iAddressInfo.Append(addressInfo) != KErrNone )
+ {
+ delete addressInfo;
+ }
+
+ //Get all 3 adress
+ if( addressCount > 1 && iAddressInfo.Count() < addressCount )
+ return;
+
+ //If the requested id is already in queue, just return
+ for( TInt index = 0 ; index < iMapTileRequestQueue.Count(); index++ )
+ {
+ if( iLastContactId == iMapTileRequestQueue[index]->iUId )
+ {
+ return;
+ }
+ }
+
+ for( TInt index = 0; index < iAddressInfo.Count(); index++ )
+ {
+ TUidSourceType type = static_cast<TUidSourceType>(iAddressInfo[index]->iAddressType );
+
+ //if type is contact
+ if( type == ESourceContactsPref || type == ESourceContactsWork ||
+ type == ESourceContactsHome )
+ {
+ QContact contactInfo = iContactManager->contact( iAddressInfo[index]->iUid );
+
+ CPosLandmark *contactAddressLm = NULL;
+
+ TInt itemCount = 0;
+
+ foreach ( QContactAddress address, contactInfo.details<QContactAddress>() )
+ {
+ QStringList context = address.contexts();
+ if ( context.isEmpty() && type == ESourceContactsPref ) // no context
+ {
+ contactAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ break;
+ }
+ else if ( !context.isEmpty() && context.first() == QContactAddress::ContextHome &&
+ type == ESourceContactsHome )
+ {
+ contactAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ break;
+ }
+ else if ( !context.isEmpty() && context.first() == QContactAddress::ContextWork &&
+ type == ESourceContactsWork )
+ {
+ contactAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ break;
+ }
+ }
+
+ //Update the entry with inprogress status
+ TLookupItem lookupItem;
+ lookupItem.iUid = iAddressInfo[index]->iUid;
+ lookupItem.iSource = type;
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ iMaptileDatabase->UpdateEntryL( lookupItem );
+
+ //Request for maptile fetching
+ RequestMapTileImageL( *contactAddressLm, type,
+ iAddressInfo[index]->iUid, EContactDbObserverEventContactChanged );
+
+ CleanupStack::PopAndDestroy( itemCount );
+ }
+ }
+ for( TInt index = 0; index < iAddressInfo.Count(); index++ )
+ {
+ //free the allocated memory
+ delete iAddressInfo[index];
+ iAddressInfo.Remove(index);
+ iAddressInfo.Compress();
+ }
+
+ iAddressInfo.Reset();
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::SubscribeFromCalendarL()
+// To get callbacks through publisher from calendar context
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::SubscribeFromCalendarL(TInt aId)
+{
+ __TRACE_CALLSTACK;
+ iLastCalendarId = aId;
+ 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);
+}
+// -----------------------------------------------------------------------------
// CMyLocationsEngine::StartCalenderChangeNotifierL()
// Starts calender change notification method to get callbacks when entries are
// added/modified/deleted in contacts
@@ -336,7 +499,8 @@
{
__TRACE_CALLSTACK;
- GeocodeUpdate::createContactdb();
+ GeocodeUpdate geocodeUpdate;
+ geocodeUpdate.createContactdb();
iContactsDb = CContactDatabase::OpenL();
// Create CContactChangeNotifier object with 'this' object.
iContactChangeNotifier = CContactChangeNotifier::NewL(*iContactsDb,this);
@@ -395,12 +559,7 @@
return;
}
}
- TLookupItem lookupItem;
- lookupItem.iSource = ESourceCalendar;
- lookupItem.iUid = calChangeEntry.iEntryId;
- TRAP_IGNORE(ManipulateMapTileDataBaseL(lookupItem));
- //TODO: comapare address and then delete
- TRAP_IGNORE( CalenderEntryAddedL(calChangeEntry) );
+ TRAP_IGNORE( CalenderEntryModifyL(calChangeEntry) ) ;
break;
}
case EChangeDelete:
@@ -425,22 +584,64 @@
void CMyLocationsEngine::CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry)
{
__TRACE_CALLSTACK;
+
+ TUint32 entryId=0;
+ entryId=aCalChangeEntry.iEntryId;
+ //create entry in the data base and maintain a fetching state.
+ TLookupItem lookupItem;
+ lookupItem.iUid = entryId ;
+ lookupItem.iSource = ESourceCalendar;
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->CreateEntryL(lookupItem) );
CCalEntry* calEntry = NULL;
- calEntry = iCalView->FetchL(aCalChangeEntry.iEntryId);
+ calEntry = iCalView->FetchL( entryId );
+ CleanupStack::PushL(calEntry);
+ TPtrC address(calEntry->LocationL());
+ if (address.Length() > 0)
+ {
+ RequestMapTileImageL( address, ESourceCalendar, entryId , EChangeAdd );
+ }
+ CleanupStack::PopAndDestroy(calEntry);
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CalenderEntryModifyL()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::CalenderEntryModifyL(TCalChangeEntry aCalChangeEntry)
+{
+ __TRACE_CALLSTACK;
+ TUint32 entryId = 0;
+ entryId = aCalChangeEntry.iEntryId;
+ TLookupItem lookupItem;
+ lookupItem.iSource = ESourceCalendar;
+ lookupItem.iUid = entryId;
+ CCalEntry* calEntry = NULL;
+ calEntry = iCalView->FetchL(entryId);
+ CleanupStack::PushL(calEntry);
TPtrC address(calEntry->LocationL());
- if(address.Length()>0)
- {
- //create entry in the data base and maintain a fetching state.
- TLookupItem lookupItem;
- lookupItem.iUid = aCalChangeEntry.iEntryId;
- lookupItem.iSource = ESourceCalendar;
+ if (iMyLocationsDatabaseManager->CheckIfAddressChanged(address, entryId,
+ ESourceCalendar))
+ {
lookupItem.iFilePath.Zero();
lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
- iMaptileDatabase->CreateEntryL(lookupItem);
-
- RequestMapTileImageL(address,ESourceCalendar, aCalChangeEntry.iEntryId);
+ 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);
+ }
+
}
- delete calEntry;
+ CleanupStack::PopAndDestroy(calEntry);
}
// -----------------------------------------------------------------------------
@@ -452,14 +653,13 @@
{
__TRACE_CALLSTACK;
- HandlelandmarkDatabaseL(aEvent);
-
//Forward the event for maptile fetching only if maptile plugin available
if( iMaptileGeocoderPluginAvailable )
{
TriggerMaptileRequestL(aEvent);
}
+ HandlelandmarkDatabaseL(aEvent);
}
// -----------------------------------------------------------------------------
@@ -561,12 +761,14 @@
UpdateDatabaseL(NULL,
aEvent.iContactId, ESourceContactsPref,
EEntryDeleted);
+
+ UpdateDatabaseL(NULL,
+ aEvent.iContactId, ESourceContactsHome,
+ EEntryDeleted);
+
UpdateDatabaseL(NULL,
aEvent.iContactId, ESourceContactsWork,
EEntryDeleted);
- UpdateDatabaseL(NULL,
- aEvent.iContactId, ESourceContactsHome,
- EEntryDeleted);
}
}
else
@@ -577,12 +779,19 @@
TEntryChangeType changeType = MapChangeType(
ESourceContactsPref, aEvent.iType);
+ // if prefered address available, update Mylocations.
+ if (preferedAddressLm)
+ {
+ UpdateDatabaseL(
+ preferedAddressLm, aEvent.iContactId,
+ ESourceContactsPref, changeType);
+ }
// if home address available, update Mylocations.
if (homeAddressLm)
{
UpdateDatabaseL(homeAddressLm,
aEvent.iContactId, ESourceContactsHome, changeType);
- }
+ }
// if work address available, update Mylocations.
if (workAddressLm)
@@ -591,13 +800,6 @@
aEvent.iContactId, ESourceContactsWork, changeType);
}
- // if prefered address available, update Mylocations.
- if (preferedAddressLm)
- {
- UpdateDatabaseL(
- preferedAddressLm, aEvent.iContactId,
- ESourceContactsPref, changeType);
- }
CleanupStack::PopAndDestroy( itemCount );
}
@@ -700,85 +902,118 @@
{
MYLOCLOGSTRING("preferedAddressLm address changed" );
- if (iAddressCompare->IsAddressChangedL(*preferedAddressLm,
- aEvent.iContactId, ESourceContactsPref))
+ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*preferedAddressLm,
+ aEvent.iContactId, ESourceContactsPref) )
{
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) );
+
+ RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
+ aEvent.iContactId, iEventType );
+
+ if ( lookupItem.iFilePath.Length() > 0 )
+ {
+ iMaptileDatabase->DeleteMapTileL(lookupItem);
+ }
//remove entry from database
- TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
- RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
- aEvent.iContactId);
+ //TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
}
}
else
{
TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
- }
+ }
+
+ // if home address available, update Mylocations.
+ lookupItem.iSource = ESourceContactsHome;
+ if (homeAddressLm)
+ {
+ MYLOCLOGSTRING("homeAddressLm address changed" );
+ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*homeAddressLm,
+ aEvent.iContactId, ESourceContactsHome) )
+ {
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) )
+ //remove entry from databse
+ //TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+ RequestMapTileImageL(*homeAddressLm, ESourceContactsHome, aEvent.iContactId,
+ iEventType);
+ if (lookupItem.iFilePath.Length() > 0)
+ {
+ iMaptileDatabase->DeleteMapTileL(lookupItem);
+ }
+ }
+ }
+ else
+ {
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
+ }
+
// if work address available, update Mylocations.
lookupItem.iSource = ESourceContactsWork;
if (workAddressLm)
{
MYLOCLOGSTRING("workAddressLm address changed" );
- if (iAddressCompare->IsAddressChangedL(*workAddressLm,
- aEvent.iContactId, ESourceContactsWork))
- //remove entry from database
+ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*workAddressLm,
+ aEvent.iContactId, ESourceContactsWork) )
{
-
- TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) )
+
+ //remove entry from databse
+ //TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
- aEvent.iContactId);
+ aEvent.iContactId, iEventType);
+ if (lookupItem.iFilePath.Length() > 0)
+ {
+ iMaptileDatabase->DeleteMapTileL(lookupItem);
+ }
}
+
}
else
{
TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
}
-
- // if home address available, update Mylocations.
- lookupItem.iSource = ESourceContactsHome;
- if (homeAddressLm)
- {
- MYLOCLOGSTRING("homeAddressLm address changed" );
-
- if (iAddressCompare->IsAddressChangedL(*homeAddressLm,
- aEvent.iContactId, ESourceContactsHome))
-
- {
- //remove entry from databse
- TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
- RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
- aEvent.iContactId);
- }
-
- }
- else
- {
- TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
-
- }
- // }
break;
}
case EContactDbObserverEventContactAdded:
{
+ TLookupItem lookupItem;
+ lookupItem.iUid = aEvent.iContactId;
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+
MYLOCLOGSTRING("EContactDbObserverEventContactAdded" );
if (preferedAddressLm)
{
+ //create entry in the data base and maintain a fetching state.
+ lookupItem.iSource = ESourceContactsPref;
+ iMaptileDatabase->CreateEntryL(lookupItem);
RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
- aEvent.iContactId);
+ aEvent.iContactId, iEventType);
+ }
+ if (homeAddressLm)
+ {
+ lookupItem.iSource = ESourceContactsHome;
+ iMaptileDatabase->CreateEntryL(lookupItem);
+ RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
+ aEvent.iContactId, iEventType);
}
if (workAddressLm)
{
+ lookupItem.iSource = ESourceContactsWork;
+ iMaptileDatabase->CreateEntryL(lookupItem);
RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
- aEvent.iContactId);
- }
- if (homeAddressLm)
- {
- RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
- aEvent.iContactId);
+ aEvent.iContactId, iEventType);
}
break;
}
@@ -796,7 +1031,7 @@
// -----------------------------------------------------------------------------
//
void CMyLocationsEngine::RequestMapTileImageL(const TDesC& aAddressDetails,
- const TUidSourceType aAddressType, const TInt32 aUId)
+ const TUidSourceType aAddressType, const TInt32 aUId ,const TInt aEventType)
{
__TRACE_CALLSTACK;
SetFolderPathL();
@@ -809,25 +1044,32 @@
mapTileRequest->iAddressDetails = aAddressDetails.AllocL();
mapTileRequest->iUId = aUId;
mapTileRequest->iAddressType = aAddressType;
- mapTileRequest->iEventType = iEventType;
+ mapTileRequest->iEventType = aEventType;
mapTileRequest->iImagePath.Zero();
mapTileRequest->iImagePath.Copy(mImagePath);
+
+ TInt error = KErrNone;
+
if (iMapTileRequestQueue.Count() <= 0)
{
- if ( KErrNone == RequestExecute(mapTileRequest) )
+ error = iMapTileRequestQueue.Append(mapTileRequest);
+ if ( KErrNone == error )
{
- iMapTileRequestQueue.Append(mapTileRequest);
+ error = RequestExecute(mapTileRequest);
}
- else
- {
- delete mapTileRequest;
- }
}
else
{
MYLOCLOGSTRING("Added one more request to request queue" );
- iMapTileRequestQueue.Append(mapTileRequest);
+ error = iMapTileRequestQueue.Append(mapTileRequest);
}
+
+ //If any error , free the allocated memory
+ if( error != KErrNone )
+ {
+ delete mapTileRequest;
+ }
+
}
// -----------------------------------------------------------------------------
// CMyLocationsEngine::RequestMapTileImageL()
@@ -835,7 +1077,8 @@
// -----------------------------------------------------------------------------
//
void CMyLocationsEngine::RequestMapTileImageL(CPosLandmark& aLandmark,
- const TUidSourceType aAddressType, const TInt32 aUId)
+ const TUidSourceType aAddressType, const TInt32 aUId,
+ const TInt aEventType )
{
__TRACE_CALLSTACK;
@@ -848,30 +1091,35 @@
mapTileRequest->iLandmarkInfo = CPosLandmark::NewL(aLandmark);
mapTileRequest->iUId = aUId;
mapTileRequest->iAddressType = aAddressType;
- mapTileRequest->iEventType = iEventType;
+ mapTileRequest->iEventType = aEventType;
mapTileRequest->iImagePath.Zero();
mapTileRequest->iImagePath.Copy(imageFilePath);
MYLOCLOGSTRING1("RequestMapTileImageL() Queue count -%d",iMapTileRequestQueue.Count());
+ TInt error = KErrNone;
+
if (iMapTileRequestQueue.Count() <= 0)
{
-
- if( KErrNone == RequestExecute(mapTileRequest) )
+ error = iMapTileRequestQueue.Append(mapTileRequest);
+ //error = RequestExecute(mapTileRequest);
+ if( KErrNone == error )
{
- iMapTileRequestQueue.Append(mapTileRequest);
+ //error = iMapTileRequestQueue.Append(mapTileRequest);
+ error = RequestExecute(mapTileRequest);
}
- else
- {
- delete mapTileRequest;
- }
+
}
else
{
MYLOCLOGSTRING("Added one more request to request queue" );
- iMapTileRequestQueue.Append(mapTileRequest);
+ error = iMapTileRequestQueue.Append(mapTileRequest);
}
-
+ //If any error, free the memory allocated
+ if( error != KErrNone )
+ {
+ delete mapTileRequest;
+ }
}
// -----------------------------------------------------------------------------
@@ -1093,15 +1341,12 @@
CPosLandmark* readLandmark = iLandmarkDb->ReadLandmarkLC(
iLmEvent.iLandmarkItemId);
- if (readLandmark)
- {
// update the entry in database.
UpdateDatabaseL( readLandmark,
iLmEvent.iLandmarkItemId, ESourceLandmarks, MapChangeType(
ESourceLandmarks, iLmEvent.iEventType ) );
CleanupStack::PopAndDestroy(readLandmark);
- }
}
break;
case EPosLmEventLandmarkDeleted:
@@ -1138,9 +1383,11 @@
const TReal& aLongitude, const TDesC& aMapTilePath )
{
__TRACE_CALLSTACK;
- MYLOCLOGSTRING1("MapTilefetchingCompleted aErrCode - %d ",aErrCode);
+ MYLOCLOGSTRING1("GeoCodefetchingCompleted aErrCode - %d ",aErrCode);
MYLOCLOGSTRING1("iMapTileRequestQueue.Count - %d",iMapTileRequestQueue.Count());
+ TBuf8<KProtocolBufferSize> buffer;
+
if (iMapTileRequestQueue.Count() > 0)
{
MYLOCLOGSTRING1("No.of RequestQueue - %d",iMapTileRequestQueue.Count());
@@ -1163,7 +1410,20 @@
lookupItem.iFilePath.Copy(aMapTilePath);
lookupItem.iFetchingStatus = EMapTileFectchingCompleted;
TRAP_IGNORE( UpdateMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType, lookupItem ) );
-
+ //Publish the maptile status
+ if( iLastContactId == iMapTileRequestQueue[0]->iUId )
+ {
+ buffer.Zero();
+ buffer.Format( KMaptileStatusFormat, iLastContactId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
+ //Publish the maptile status ,if it was from calendar
+ if( iLastCalendarId == iMapTileRequestQueue[0]->iUId )
+ {
+ buffer.Zero();
+ buffer.Format( KMaptileStatusFormat, iLastCalendarId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
MYLOCLOGSTRING("UpdateMaptileDatabaseL handled");
//Process the pending maptile requests
@@ -1195,6 +1455,21 @@
}
TRAP_IGNORE( UpdateMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType,lookupItem ) );
+ //Publish the maptile status
+ if( iLastContactId == iMapTileRequestQueue[0]->iUId )
+ {
+ buffer.Zero();
+ buffer.Format( KMaptileStatusFormat, iLastContactId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
+ //Publish the maptile status ,if it was from calendar
+ if( iLastCalendarId == iMapTileRequestQueue[0]->iUId )
+ {
+ buffer.Zero();
+ buffer.Format( KMaptileStatusFormat, iLastCalendarId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
+
ProcessNextMaptileRequest();
}
}
@@ -1224,16 +1499,18 @@
foreach ( QContactAddress address, contactInfo.details<QContactAddress>() )
{
QStringList context = address.contexts();
- if ( ( context.isEmpty() && iItem.iSource == ESourceContactsPref ) ||
- ( context.first() == QContactAddress::ContextHome && iItem.iSource == ESourceContactsHome ) ||
- ( context.first() == QContactAddress::ContextWork && iItem.iSource == ESourceContactsWork ) )
+ if ( ( context.isEmpty() && iItem.iSource == ESourceContactsPref )
+ ||
+ ( !context.isEmpty() &&
+ ( ( context.first() == QContactAddress::ContextHome && iItem.iSource == ESourceContactsHome ) ||
+ ( context.first() == QContactAddress::ContextWork && iItem.iSource == ESourceContactsWork ) ) ) )
{
// Get the default/prefered address details
addressLm = GetContactAddressDetailsLC( address );
if( addressLm )
{
RequestMapTileImageL( *addressLm,
- ( TUidSourceType )iItem.iSource, iItem.iUid );
+ ( TUidSourceType )iItem.iSource, iItem.iUid, EContactDbObserverEventContactChanged );
CleanupStack::PopAndDestroy( addressLm );
break;
}
@@ -1252,7 +1529,7 @@
TPtrC address(calEntry->LocationL());
if(address.Length()>0)
{
- RequestMapTileImageL( address, ESourceCalendar, iItem.iUid);
+ RequestMapTileImageL( address, ESourceCalendar, iItem.iUid , EChangeModify);
}
CleanupStack::PopAndDestroy(calEntry);
}
@@ -1291,11 +1568,11 @@
TLookupItem lookupItem;
lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType;
lookupItem.iUid = iMapTileRequestQueue[0]->iUId;
-
+
if ( aErrCode == KErrNone )
{
lookupItem.iFilePath.Copy(aMapTilePath);
- lookupItem.iFetchingStatus = EMapTileFectchingCompleted;
+ lookupItem.iFetchingStatus = EMapTileFectchingCompleted;
}
else if ( aErrCode == KErrCouldNotConnect )
@@ -1310,6 +1587,21 @@
}
TRAP_IGNORE( UpdateMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType,lookupItem ) );
+
+ //Publish the maptile status , if it was from contact
+ if( iLastContactId == iMapTileRequestQueue[0]->iUId )
+ {
+ TBuf8<KProtocolBufferSize> buffer;
+ buffer.Format( KMaptileStatusFormat, iLastContactId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
+ //Publish the maptile status ,if it was from calendar
+ if( iLastCalendarId == iMapTileRequestQueue[0]->iUId )
+ {
+ TBuf8<KProtocolBufferSize> buffer;
+ buffer.Format( KMaptileStatusFormat, iLastCalendarId, lookupItem.iSource, lookupItem.iFetchingStatus );
+ RProperty::Set( KMaptileStatusPublish, EMaptileStatusInteger, buffer );
+ }
}
ProcessNextMaptileRequest();
@@ -1367,6 +1659,7 @@
== EChangeModify || aEventType == EContactDbObserverEventContactAdded ||
aEventType == EChangeAdd )
{
+
if (iMaptileDatabase->FindEntryL(aLookupItem))
{
iMaptileDatabase->UpdateEntryL(aLookupItem);
@@ -1397,21 +1690,26 @@
{
//TODO:
case ESourceCalendar:
- {
-
- CPosLandmark *landmark=NULL;
- landmark=iMapTileInterface->GetLandMarkDetails();
- TRAP_IGNORE( UpdateDatabaseL( landmark, iMapTileRequestQueue[0]->iUId,
- ESourceCalendar,
- MapChangeType( ESourceCalendar, iMapTileRequestQueue[0]->iEventType ) ) );
- MYLOCLOGSTRING("Geo-codinate updated to calender db");
+ {
+ CPosLandmark *landmark = NULL;
+ 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 ) ) );
+ }
+ MYLOCLOGSTRING("Geo-codinate updated to calender db");
break;
}
case ESourceContactsPref:
case ESourceContactsWork:
case ESourceContactsHome:
{
- GeocodeUpdate::updateGeocodeToContactDB(
+ GeocodeUpdate geocodeUpdate;
+ geocodeUpdate.updateGeocodeToContactDB(
iMapTileRequestQueue[0]->iUId,
iMapTileRequestQueue[0]->iAddressType, aLatitude,
aLongitude);
@@ -1447,7 +1745,7 @@
// CMyLocationsEngine::ManipulateMapTileDataBaseL()
// -----------------------------------------------------------------------------
//
-void CMyLocationsEngine::ManipulateMapTileDataBaseL(TLookupItem aLookupItem)
+void CMyLocationsEngine::ManipulateMapTileDataBaseL(TLookupItem& aLookupItem)
{
__TRACE_CALLSTACK;
TBool entryAvailable=EFalse;
@@ -1456,8 +1754,8 @@
if (entryAvailable)
{
iMaptileDatabase->DeleteMapTileL(aLookupItem);
- }
-
+ }
}
+
//End of file
--- a/locationdataharvester/rom/mylocations.iby Fri Jun 11 13:33:47 2010 +0300
+++ b/locationdataharvester/rom/mylocations.iby Wed Jun 23 18:07:15 2010 +0300
@@ -27,6 +27,9 @@
//Resource file(s) for Mylocations application (mylocations.iby)
-data=DATAZ_\APP_RESOURCE_DIR\mylocations.rsc APP_RESOURCE_DIR\mylocationsengine.rsc
+data=DATAZ_\APP_RESOURCE_DIR\mylocationsengine.rsc APP_RESOURCE_DIR\mylocationsengine.rsc
+data=\epoc32\data\z\resource\qt\crml\maptilestatuspublisher.qcrml resource\qt\crml\maptilestatuspublisher.qcrml
+data=\epoc32\data\z\resource\qt\crml\maptilepublisher.qcrml resource\qt\crml\maptilepublisher.qcrml
+data=\epoc32\data\z\resource\qt\crml\maptilecalpublisher.qcrml resource\qt\crml\maptilecalpublisher.qcrml
#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/hgwidgetdatamodel.h Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* 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: HgWidgetDataModel implementation
+*
+*/
+
+#ifndef HGWIDGETDATAMODEL_H
+#define HGWIDGETDATAMODEL_H
+
+#include <QAbstractListModel>
+#include <HbIcon>
+
+class LocationPickerProxyModel;
+
+/*!
+ Constructs the data model
+ */
+class HgWidgetDataModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ //ImageType to be set
+ enum TImageType
+ {
+ ETypeQIcon,
+ ETypeHbIcon,
+ ETypeQImage
+ };
+public:
+ //constructor
+ explicit HgWidgetDataModel( LocationPickerProxyModel *aProxyModel, QObject *aParent=0);
+ //destructor
+ virtual ~HgWidgetDataModel();
+ //count of number of items in model
+ int rowCount(const QModelIndex &aParent=QModelIndex()) const;
+ //get the data from QStandardModel for HgWidgetModel
+ QVariant data(const QModelIndex &aIndex, int aRole=Qt::DisplayRole) const;
+ //Set Image Type
+ void setImageDataType(TImageType type);
+ //reset the model with new data
+ void resetModel( LocationPickerProxyModel *aProxyModel );
+
+private:
+ //Image Type
+ TImageType mImageType;
+ //default Image type
+ HbIcon mDefaultImage;
+ //low resolution image
+ bool mUseLowResImages;
+ //proxymodel
+ LocationPickerProxyModel *mProxyModel;
+};
+
+#endif // HgWidgetDataModel_H
+
--- a/locationpickerservice/inc/locationpickercollectionlistcontent.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickercollectionlistcontent.h Wed Jun 23 18:07:15 2010 +0300
@@ -40,7 +40,9 @@
private:
Qt::Orientation mOrientation;
+ //standard Item Model
QStandardItemModel *mModel;
+ //datamanager
LocationPickerDataManager *mDataManager;
};
--- a/locationpickerservice/inc/locationpickercontent.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickercontent.h Wed Jun 23 18:07:15 2010 +0300
@@ -43,7 +43,7 @@
QStandardItemModel* getStandardListModel();
//get standard Grid Model
- QStandardItemModel* getStandardGridModel();
+ QStandardItemModel* getStandardModel();
void createNoEntryDisplay( QStandardItemModel *aModel );
@@ -53,7 +53,7 @@
Qt::Orientations mOrientation;
LocationPickerDataManager *mDataManager;
QStandardItemModel *mListModel;
- QStandardItemModel *mGridModel;
+ QStandardItemModel *mStandardModel;
};
--- a/locationpickerservice/inc/locationpickerdatamanager_p.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdatamanager_p.h Wed Jun 23 18:07:15 2010 +0300
@@ -48,7 +48,7 @@
// populates landmarks
bool populateLandmarks( QList<QLookupItem> &aItemArray );
// populates collections
- void populateCollections();
+ void populateCollections( QList<int>& aCount );
private:
Qt::Orientations mOrientation;
--- a/locationpickerservice/inc/locationpickerlandscapeview.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickerlandscapeview.h Wed Jun 23 18:07:15 2010 +0300
@@ -27,12 +27,20 @@
//forward declarations
class HbListView;
class QStandardItemModel;
+class HbAction;
+class QGraphicsLinearLayout;
+class HbLabel;
+class HgWidgetDataModel;
+class HbTextItem;
+class HgMediawall;
+class QPoint;
+class HbMenu;
+
class LocationPickerProxyModel;
class LocationPickerCollectionContent;
class LocatipnPickerProxyModel;
-class HbGridViewItem;
-class HbGridView;
-class HbAction;
+
+
/**
* Class defines the location picker view
@@ -49,8 +57,8 @@
public:
//get the items from docml and connect to respective slots
void init( Qt::Orientation aOrientation, QStandardItemModel *aModel );
- //Set the appropriate model on grid view
- void manageGridView();
+ //Set the appropriate model on hgwidget
+ void manageHgWidget();
//Create collection list and sets to list view
void setCollectionData( quint32 aCategoryId );
//Set Ctegory ID
@@ -70,6 +78,10 @@
void backButtonTriggered();
//slot to handle search tab
void searchTabTriggered();
+ //launch context menu
+ void launchPopUpMenu(const QModelIndex &aIndex, const QPointF &aPoint);
+ //handle long press
+ void handleLongPress();
public slots:
//slot to handle all tab
void allTabTriggered();
@@ -87,7 +99,7 @@
HbDocumentLoader* mDocumentLoader;
//locationPickerProxyModel
LocationPickerProxyModel *mProxyModel;
- QStandardItemModel *mModel;
+ QStandardItemModel *mStandardModel;
//actions
HbAction *mAllAction;
HbAction *mCollectionAction;
@@ -96,15 +108,23 @@
HbAction *mDescendingAction;
//secondary back action
HbAction *mLandscapeBackAction;
- HbGridView *mGridView;
//collection content
LocationPickerCollectionContent *mCollectionContent;
- HbGridViewItem *mGridViewItem;
//view type
TViewType mViewType ;
//get the collection/category id
quint32 mCategoryId;
-
+ //model for hurriganes
+ HgWidgetDataModel *mModel;
+ //hurriganes
+ HgMediawall *mWidget;
+ //Linear layout
+ QGraphicsLinearLayout *mLayout;
+ //text Item to display No Entry
+ HbTextItem* mEmptyLabel;
+ QModelIndex mIndex;
+ //context menu
+ HbMenu* mLongPressMenu;
};
#endif /* LOCATIONPICKERLANDSCAPEVIEW_H_ */
--- a/locationpickerservice/inc/locationpickerpotraitview.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickerpotraitview.h Wed Jun 23 18:07:15 2010 +0300
@@ -22,6 +22,9 @@
#include <HbView>
#include <hbdocumentloader.h>
#include "locationpickertypes.h"
+#include <QGraphicsLinearLayout>
+
+#include <HbLabel>
//forward declarations
class HbListView;
@@ -31,7 +34,9 @@
class LocationPickerCollectionContent;
class HbListViewItem;
class HbAction;
-
+class HbAbstractViewItem;
+class HbMenu;
+class QPoint;
/**
* Class defines the location picker view
*/
@@ -63,13 +68,16 @@
private slots:
//slot to handle list item actions
void handleActivated( const QModelIndex &aIndex );
- void changeModel();
//slots to handle menu action items
void sortDescending();
void sortAscending();
void backTriggered();
//slot to handle search tab
void searchTabTriggered();
+ //launch context menu
+ void launchPopUpMenu(HbAbstractViewItem *aItem, const QPointF &aPoint);
+ //handle long press
+ void handleLongPress();
public slots:
//slot to handle all tab
void allTabTriggered();
@@ -109,8 +117,14 @@
TViewType mViewType ;
// get the collection/category id
quint32 mCategoryId;
- // model Index
+ //label to show current view
QModelIndex mIndex;
+ //linear Layout
+ QGraphicsLinearLayout *mLinerLayout;
+ //label to show detail of view
+ HbLabel *mColllabel;
+ //context menu
+ HbMenu* mLongPressMenu;
};
--- a/locationpickerservice/inc/locationpickersearchview.h Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/inc/locationpickersearchview.h Wed Jun 23 18:07:15 2010 +0300
@@ -29,6 +29,9 @@
class HbDocumentLoader;
class HbTextItem;
class QGraphicsLinearLayout;
+class HbAbstractViewItem;
+class QPoint;
+class HbMenu;
/**
* Class defines the search view of location picker
@@ -52,6 +55,10 @@
void handleActivated(const QModelIndex &aIndex);
// slot to handle backbutton on search panel
void handleExit();
+ //launch context menu
+ void launchPopUpMenu(HbAbstractViewItem *aItem, const QPointF &aPoint);
+ //handle long press
+ void handleLongPress();
signals:
//signals to switch current view
void switchView();
@@ -72,6 +79,9 @@
QGraphicsLinearLayout* mVerticalLayout;
//Documentloader
HbDocumentLoader &mDocumentLoader;
+ QModelIndex mIndex;
+ //context menu
+ HbMenu* mLongPressMenu;
};
--- a/locationpickerservice/locationpickerservice.pro Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/locationpickerservice.pro Wed Jun 23 18:07:15 2010 +0300
@@ -34,6 +34,8 @@
16943040
TARGET.CAPABILITY = ALL \
-TCB
+
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
}
@@ -41,6 +43,8 @@
CONFIG += service
LIBS += -lxqservice \
-lxqserviceutil \
+ -lganeswidgets.dll \
+ -lthumbnailmanagerqt.dll \
-llocationdatalookupdb
SERVICE.FILE = service_conf.xml
SERVICE.OPTIONS = embeddable
@@ -64,7 +68,9 @@
src/locationpickerdatamanager_p.cpp \
src/locationpickerpotraitview.cpp \
src/locationpickerlandscapeview.cpp \
- src/locationpickerdocumentloader.cpp
+ src/locationpickerdocumentloader.cpp \
+ src/hgwidgetdatamodel.cpp
+
@@ -80,5 +86,6 @@
inc/locationpickerdatamanager_p.h \
inc/locationpickerpotraitview.h \
inc/locationpickerlandscapeview.h \
- inc/locationpickerdocumentloader.h
+ inc/locationpickerdocumentloader.h \
+ inc/hgwidgetdatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/location.hgmediawall.css Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,69 @@
+HgMediawall#location[scrollBarPolicy="ScrollBarAlwaysOff"]
+{
+ layout:layout-noscrollbar;
+ front-cover-elevation-factor:0.7;
+}
+
+HgMediawall#location[!scrollBarPolicy="ScrollBarAlwaysOff"]
+{
+ layout:layout-scrollbar;
+ front-cover-elevation-factor:0.7;
+}
+
+HgMediawall#location::title
+{
+ font-variant:primary;
+ text-align: center center;
+ left:-var(hb-param-margin-gene-screen);
+ right:var(hb-param-margin-gene-screen);
+ top:-var(hb-param-margin-gene-middle-vertical);
+ bottom:0un;
+ text-line-count-min:1;
+ text-line-count-max:1;
+ zvalue: 2;
+ size-policy: preferred preferred;
+}
+
+HgMediawall#location::description
+{
+ font-variant:primary-small;
+ text-align: center center;
+ left:-var(hb-param-margin-gene-screen);
+ right:var(hb-param-margin-gene-screen);
+ top:-var(hb-param-margin-gene-middle-vertical);
+ bottom:0un;
+ text-line-count-min:1;
+ text-line-count-max:1;
+ zvalue: 2;
+ size-policy: preferred preferred;
+}
+
+HgMediawall#location::scrollbar-vertical
+{
+ left:-var(hb-param-margin-gene-screen);
+ right:var(hb-param-margin-gene-screen);
+ top:-var(hb-param-margin-gene-top);
+ bottom:0.5 un;
+ zvalue: 2;
+ size-policy: preferred preferred;
+}
+
+HgMediawall#location::content
+{
+ size-policy: minimum-expanding minimum-expanding;
+ left:0un;
+ right:0un;
+ top:0un;
+ bottom:0un;
+ zvalue: 0;
+}
+
+HgMediawall#location::centeritem
+{
+ size-policy: minimum-expanding minimum-expanding;
+ left:-var(hb-param-touch-area-gene-primary-medium);
+ right:var(hb-param-touch-area-gene-primary-medium);
+ top:0un;
+ bottom:1un;
+ zvalue: 2;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/location.hgmediawall.widgetml Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,31 @@
+<hbwidget version="0.1" type="HgMediawall">
+ <layout name="layout-scrollbar" type="mesh">
+ <meshitem src="content" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+ <meshitem src="content" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="content" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="content" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="scrollbar-horizontal" srcEdge="BOTTOM" dst="content" dstEdge="BOTTOM" />
+ <meshitem src="scrollbar-horizontal" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
+ <meshitem src="scrollbar-horizontal" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ <meshitem src="title" srcEdge="TOP" dst="content" dstEdge="TOP" />
+ <meshitem src="title" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="centeritem" srcEdge="BOTTOM" dst="scrollbar-horizontal" dstEdge="TOP" />
+ <meshitem src="centeritem" srcEdge="TOP" dst="title" dstEdge="BOTTOM" />
+ <meshitem src="centeritem" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
+ <meshitem src="centeritem" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ </layout>
+ <layout name="layout-noscrollbar" type="mesh">
+ <meshitem src="content" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+ <meshitem src="content" srcEdge="TOP" dst="" dstEdge="TOP" />
+ <meshitem src="content" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ <meshitem src="content" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+ <meshitem src="description" srcEdge="BOTTOM" dst="content" dstEdge="BOTTOM" />
+ <meshitem src="description" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="title" srcEdge="BOTTOM" dst="description" dstEdge="TOP" />
+ <meshitem src="title" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="centeritem" srcEdge="BOTTOM" dst="title" dstEdge="TOP" />
+ <meshitem src="centeritem" srcEdge="TOP" dst="content" dstEdge="TOP" />
+ <meshitem src="centeritem" srcEdge="RIGHT" dst="content" dstEdge="RIGHT" />
+ <meshitem src="centeritem" srcEdge="LEFT" dst="content" dstEdge="LEFT" />
+ </layout>
+</hbwidget>
--- a/locationpickerservice/resources/locationgrid.css Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-HbGridViewItem#locationgrid
-{
- layout:layout-1;
-}
-HbGridViewItem#locationgrid::icon{
- fixed-width: 24.375un;
- fixed-height: 32.5un;
-}
-
-HbGridViewItem#locationgrid::text{
- text-height: var(hb-param-text-height-tiny);
- font-variant: primary;
- text-align: center center;
- color: qtc_grid;
- text-line-count-min: 1;
- text-line-count-max: 2;
-}
-
-HbGridViewItem#locationgrid::selection-icon{
- fixed-width: 3.0un;
- fixed-height: 3.0un;
-}
-
-HbGridViewItem#locationgrid::multiselection-toucharea{
- fixed-width: 9.0un;
- fixed-height: 9.0un;
-}
-
-HbGridViewItem#locationgrid::frame{
- border-width: var(hb-param-background-grid-main);
-}
--- a/locationpickerservice/resources/locationgrid.hbgridviewitem.widgetml Fri Jun 11 13:33:47 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<hbwidget version="0.1" type="HbGridViewItem">
- <layout name="layout-1" type="mesh">
-
- <meshitem src="text" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-center-align)" />
- <meshitem src="text" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-center-align)" />
- <meshitem src="text" srcEdge="TOP" dst="" dstEdge="TOP" spacing= "1.5 un" />
-
- <meshitem src="icon" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-center-align)" />
- <meshitem src="icon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-center-align)" />
- <meshitem src="icon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="1.5 un" />
- <meshitem src="icon" srcEdge="TOP" dst="text" dstEdge="BOTTOM" spacing="-1.5 un" />
-
-
- <meshitem src="selection-icon" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="selection-icon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
- <meshitem src="frame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
- <meshitem src="frame" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="frame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="frame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
- <meshitem src="background" srcEdge="LEFT" dst="" dstEdge="LEFT" />
- <meshitem src="background" srcEdge="TOP" dst="" dstEdge="TOP" />
- <meshitem src="background" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
- <meshitem src="background" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
- <meshitem src="multiselection-toucharea" srcEdge="TOP" dst="selection-icon" dstEdge="TOP" />
- <meshitem src="multiselection-toucharea" srcEdge="RIGHT" dst="selection-icon" dstEdge="RIGHT" />
- </layout>
-</hbwidget>
--- a/locationpickerservice/resources/locationpicker.qrc Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/resources/locationpicker.qrc Wed Jun 23 18:07:15 2010 +0300
@@ -3,7 +3,7 @@
<file>locationpickerpotrait.docml</file>
<file>locationpickerlandscape.docml</file>
<file>locationpickersearchview.docml</file>
- <file>locationgrid.css</file>
- <file>locationgrid.hbgridviewitem.widgetml</file>
+ <file>location.hgmediawall.widgetml</file>
+ <file>location.hgmediawall.css</file>
</qresource>
</RCC>
--- a/locationpickerservice/resources/locationpickerlandscape.docml Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/resources/locationpickerlandscape.docml Wed Jun 23 18:07:15 2010 +0300
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.9">
+<hbdocument version="1.0">
<object name="allAction" type="HbAction">
<bool name="checkable" value="TRUE"/>
<icon iconName="qtg_mono_location" name="icon"/>
- <string name="text" value=""/>
+ <string name="text"/>
</object>
<object name="collectionAction" type="HbAction">
<bool name="checkable" value="TRUE"/>
<icon iconName="qtg_mono_location_collection" name="icon"/>
- <string name="text" value=""/>
+ <string name="text"/>
</object>
<object name="searchAction" type="HbAction">
<icon iconName="qtg_mono_search" name="icon"/>
- <string name="text" value=""/>
+ <string name="text"/>
</object>
<object name="ascendingAction" type="HbAction">
<string name="iconText" value="txt_lint_list_ascending‘txt_lint_list_ascending’"/>
@@ -24,19 +24,16 @@
</object>
<widget name="LocationPickerLandscapeView" type="HbView">
<widget name="content" role="HbView:widget" type="HbWidget">
- <widget name="gridView" type="HbGridView">
- <enums name="scrollDirections" value="Horizontal|Vertical"/>
+ <widget name="vertical" type="HbWidget">
<real name="z" value="1"/>
- <integer name="columnCount" value="1"/>
- <sizehint height="59.70149un" type="PREFERRED" width="53.28358un"/>
- <bool name="iconVisible" value="TRUE"/>
- <integer name="rowCount" value="3"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="11.9403un"/>
+ <layout orientation="Vertical" type="linear"/>
</widget>
<layout type="anchor">
- <anchoritem dst="gridView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
- <anchoritem dst="gridView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
- <anchoritem dst="gridView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
- <anchoritem dst="gridView" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="vertical" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="vertical" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="vertical" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="vertical" dstEdge="BOTTOM" spacing="expr(-var(hb-param-margin-gene-screen) /2)" src="" srcEdge="BOTTOM"/>
</layout>
</widget>
<widget name="viewMenu" role="HbView:menu" type="HbMenu">
@@ -50,6 +47,5 @@
</widget>
<metadata activeUIState="Common ui state" display="NHD landscape" unit="un">
<uistate name="Common ui state" sections="#common"/>
- <dummydata objectName="gridView" section="#common" value="app_grid_template2"/>
</metadata>
</hbdocument>
--- a/locationpickerservice/resources/locationpickerpotrait.docml Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/resources/locationpickerpotrait.docml Wed Jun 23 18:07:15 2010 +0300
@@ -29,11 +29,8 @@
<real name="z" value="1"/>
<sizehint height="48.0597un" type="PREFERRED" width="35.8209un"/>
</widget>
- <layout type="anchor">
- <anchoritem dst="ListView" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
- <anchoritem dst="ListView" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
- <anchoritem dst="ListView" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
- <anchoritem dst="ListView" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="ListView"/>
</layout>
</widget>
<widget name="viewMenu" role="HbView:menu" type="HbMenu">
@@ -45,7 +42,7 @@
</widget>
<string locid="txt_lint_title_select_location" name="title"/>
</widget>
- <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+ <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
<uistate name="Common ui state" sections="#common"/>
<dummydata objectName="ListView" section="#common" value="0"/>
</metadata>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/hgwidgetdatamodel.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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: HgWidgetDataModel implementation
+*
+*/
+
+#include <QBrush>
+#include <HbIcon>
+#include <hgwidgets/hgwidgets.h>
+#include <QPainter>
+
+#include "locationpickertypes.h"
+#include "hgwidgetdatamodel.h"
+#include "locationpickerproxymodel.h"
+
+const int MAPSTROKE(3);
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::HgWidgetDataModel()
+// ----------------------------------------------------------------------------
+HgWidgetDataModel::HgWidgetDataModel( LocationPickerProxyModel *aProxyModel, QObject *aParent )
+ : QAbstractListModel(aParent),
+ mImageType(ETypeHbIcon),
+ mDefaultImage(KDummyImage),
+ mUseLowResImages(false),
+ mProxyModel(NULL)
+{
+ mProxyModel = aProxyModel;
+
+}
+
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::resetModel()
+// ----------------------------------------------------------------------------
+void HgWidgetDataModel::resetModel( LocationPickerProxyModel *aProxyModel )
+{
+ //reset and update
+ mProxyModel = aProxyModel;
+ reset();
+ emit beginResetModel();
+ emit endResetModel();
+}
+
+
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::~HgWidgetDataModel()
+// ----------------------------------------------------------------------------
+HgWidgetDataModel::~HgWidgetDataModel()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::rowCount()
+// ----------------------------------------------------------------------------
+int HgWidgetDataModel::rowCount( const QModelIndex &aParent ) const
+{
+ Q_UNUSED(aParent);
+
+ return mProxyModel->rowCount(QModelIndex());
+
+}
+
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::data()
+// ----------------------------------------------------------------------------
+QVariant HgWidgetDataModel::data(const QModelIndex &aIndex, int aRole) const
+{
+ Q_ASSERT(aIndex.row()>=0);
+ int row= aIndex.row();
+ int col = aIndex.column();
+ //get proxy model index
+ QModelIndex proxyModelIndex = mProxyModel->index(row,col);
+ QVariant returnValue = QVariant();
+ if ( !aIndex.isValid() )
+ {
+ return returnValue;
+ }
+
+ if( row >= mProxyModel->rowCount(QModelIndex()) )
+ {
+ return returnValue;
+ }
+
+ switch ( aRole )
+ {
+ case HgWidget::HgVisibilityRole:
+ {
+ returnValue = true;
+ }
+ break;
+ case Qt::DisplayRole:
+ {
+ QStringList displayText;
+ QString adressDetail = mProxyModel->data(proxyModelIndex,Qt::DisplayRole).toString();
+ QString text("");
+ displayText <<adressDetail<<text;
+ returnValue = displayText;
+ break;
+ }
+ case Qt::DecorationRole:
+ {
+ //get icon name from data model
+ QString iconName = mProxyModel->data(proxyModelIndex,Qt::DecorationRole).toString();
+ if (iconName.isNull())
+ {
+ returnValue = mDefaultImage;
+ }
+ else
+ {
+ QString adressType = mProxyModel->data(proxyModelIndex,Qt::UserRole+1).toString();
+ QPixmap mapPixmap(iconName);
+ int mapWidth = mapPixmap.width();
+ int mapHeight = mapPixmap.height();
+ QBrush brush(Qt::black,Qt::SolidPattern);
+ QPainter painter;
+ painter.begin(&mapPixmap);
+ HbIcon adressTypeIcon(adressType);
+ //draw the adressType Icon over mapTile Icon
+ QPixmap adressTypePixmap = adressTypeIcon.pixmap();
+ painter.drawPixmap( (mapPixmap.width()-adressTypePixmap.width()),0,adressTypePixmap );
+ painter.fillRect(QRect(0,0,mapWidth,MAPSTROKE),brush);
+ painter.fillRect(QRect(0,mapHeight-MAPSTROKE,mapWidth,(mapHeight-MAPSTROKE)),brush);
+ painter.fillRect(QRect(0,0,MAPSTROKE,mapPixmap.height()),brush);
+ painter.fillRect(QRect((mapWidth-MAPSTROKE),0,mapWidth,mapHeight),brush);
+ painter.end();
+ QIcon landscape( mapPixmap );
+ HbIcon landscapeIcon(landscape);
+ returnValue = landscapeIcon;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return returnValue;
+}
+
+
+// ----------------------------------------------------------------------------
+// HgWidgetDataModel::setImageDataType()
+// ----------------------------------------------------------------------------
+void HgWidgetDataModel::setImageDataType(TImageType type)
+{
+ mImageType = type;
+}
+
+
+
--- a/locationpickerservice/src/locationpickerappwindow.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickerappwindow.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -80,11 +80,11 @@
mLocationPickerLandscapeView = qobject_cast<LocationPickerLandscapeView*>(locationPickerWidget);
mLocationPickerContent->populateModel(Qt::Horizontal);
//initialize widgets and connect to respective signals
- mLocationPickerLandscapeView->init(Qt::Horizontal, mLocationPickerContent->getStandardGridModel());
+ mLocationPickerLandscapeView->init(Qt::Horizontal, mLocationPickerContent->getStandardModel());
connectLandscapeSlots();
addView(mLocationPickerLandscapeView);
//connect to orientationChanged signal
- connect(this, SIGNAL(orientationChanged(Qt::Orientation)),this, SLOT(changeOrientation(Qt::Orientation)));
+ connect(this, SIGNAL(orientationChanged(Qt::Orientation)),this, SLOT(changeOrientation(Qt::Orientation)));
//launch the view in current orientation
changeOrientation(this->orientation());
}
@@ -147,7 +147,6 @@
//set LocationPickerSearchview as current view
setCurrentView(mLocationPickerSearchView);
mviewType = ELocationPickerSearchView;
-
}
// ----------------------------------------------------------------------------
@@ -160,7 +159,7 @@
if(this->orientation() == Qt::Horizontal)
{
mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
- mLocationPickerLandscapeView->manageGridView();
+ mLocationPickerLandscapeView->manageHgWidget();
setCurrentView(mLocationPickerLandscapeView);
}
else
@@ -216,7 +215,7 @@
//load landscape for all content except collectionlistcontent
if(mLocationPickerPotraitView->getViewType() != ELocationPickerCollectionListContent)
{
- mLocationPickerLandscapeView->manageGridView();
+ mLocationPickerLandscapeView->manageHgWidget();
setCurrentView(mLocationPickerLandscapeView);
}
}
@@ -289,7 +288,7 @@
{
//all list after collection list in horizontal orientation
mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
- mLocationPickerLandscapeView->manageGridView();
+ mLocationPickerLandscapeView->manageHgWidget();
setCurrentView(mLocationPickerLandscapeView);
}
--- a/locationpickerservice/src/locationpickercollectioncontent.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickercollectioncontent.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -36,28 +36,31 @@
{
// Create a standard model for the view list
mModel = new QStandardItemModel( this );
- // create data manager to manage data in the model
- mDataManager = LocationPickerDataManager::getInstance();
- if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
+ if(mModel)
{
- // Create the proxy model.
- mProxyModel = new LocationPickerProxyModel(mOrientation);
- mProxyModel->setSourceModel(mModel);
- mProxyModel->setDynamicSortFilter(TRUE);
- mProxyModel->setSortRole(Qt::DisplayRole);
- mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
- // sort
- mProxyModel->sort(0, Qt::AscendingOrder);
- mLocationFound = true;
+ // create data manager to manage data in the model
+ mDataManager = LocationPickerDataManager::getInstance();
+ if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
+ {
+ // Create the proxy model.
+ mProxyModel = new LocationPickerProxyModel(mOrientation);
+ mProxyModel->setSourceModel(mModel);
+ mProxyModel->setDynamicSortFilter(TRUE);
+ mProxyModel->setSortRole(Qt::DisplayRole);
+ mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
+ // sort
+ mProxyModel->sort(0, Qt::AscendingOrder);
+ mLocationFound = true;
+ }
+ else
+ {
+ // no locations to display.
+ QStandardItem *modelItem = new QStandardItem();
+ modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
+ mModel->appendRow( modelItem );
+ mLocationFound = false;
+ }
}
- else
- {
- // no locations to display.
- QStandardItem *modelItem = new QStandardItem();
- modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
- mModel->appendRow( modelItem );
- mLocationFound = false;
- }
}
// ----------------------------------------------------------------
--- a/locationpickerservice/src/locationpickercollectionlistcontent.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickercollectionlistcontent.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -32,9 +32,16 @@
{
// Create a standard model for the view list
mModel = new QStandardItemModel( this );
- // create data manager to manage data in the model
- mDataManager = LocationPickerDataManager::getInstance();
- mDataManager->populateModel( *mModel, ELocationPickerCollectionListContent, mOrientation );
+ if(mModel)
+ {
+ // create data manager to manage data in the model
+ mDataManager = LocationPickerDataManager::getInstance();
+ bool populated = mDataManager->populateModel( *mModel, ELocationPickerCollectionListContent, mOrientation );
+ if(!populated)
+ {
+ qFatal("Error creating collection");
+ }
+ }
}
// ----------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickercontent.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickercontent.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -30,7 +30,7 @@
LocationPickerContent::LocationPickerContent()
:mDataManager(NULL),
mListModel(NULL),
- mGridModel(NULL)
+ mStandardModel(NULL)
{
// create data manager to manage data in the model
mDataManager = LocationPickerDataManager::getInstance();
@@ -60,15 +60,15 @@
//for landscape view
else
{
- // Create a standard model for the grid view
- mGridModel = new QStandardItemModel( this );
- if( mDataManager->populateModel(*mGridModel, ELocationPickerContent, aOrientation) )
+ // Create a standard model for the landscape view
+ mStandardModel = new QStandardItemModel( this );
+ if( mDataManager->populateModel(*mStandardModel, ELocationPickerContent, aOrientation) )
{
locationsFound = true;
}
else
{
- createNoEntryDisplay(mGridModel);
+ createNoEntryDisplay(mStandardModel);
locationsFound = false;
}
}
@@ -81,7 +81,7 @@
LocationPickerContent::~LocationPickerContent()
{
delete mListModel;
- delete mGridModel;
+ delete mStandardModel;
}
// -----------------------------------------------------------------------------
@@ -93,11 +93,11 @@
}
// -----------------------------------------------------------------------------
-// LocationPickerContent::getStandardGridModel()
+// LocationPickerContent::getStandardModel()
// -----------------------------------------------------------------------------
-QStandardItemModel* LocationPickerContent::getStandardGridModel()
+QStandardItemModel* LocationPickerContent::getStandardModel()
{
- return mGridModel;
+ return mStandardModel;
}
// ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickerdatamanager_p.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickerdatamanager_p.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -23,10 +23,6 @@
#include <QFile>
#include "locationpickerdatamanager_p.h"
-//constant value used
-const int ASPECTRATIOHEIGHT(3);
-const int ASPECTRATIOWIDTH (4);
-
// ----------------------------------------------------------------------------
// LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate()
@@ -84,10 +80,11 @@
case ELocationPickerCollectionListContent:
{
- populateCollections();
+ QList<int> aCount;
+ mDb->getCount(aCount, aCollectionId);
+ populateCollections(aCount);
+ return true;
}
- break;
-
case ELocationPickerCollectionContent:
{
QList<QLookupItem> itemArray;
@@ -122,41 +119,60 @@
if( !aItemArray[i].mIsDuplicate )
{
lmAddressLine1 = aItemArray[i].mName;
- if( lmAddressLine1.isEmpty() )
- lmAddressLine1 = KSpace;
bool addressEmtpy = true; // used to check if address line 2 is empty
if( !aItemArray[i].mStreet.isEmpty() )
{
- lmAddressLine2 = aItemArray[i].mStreet;
- addressEmtpy = EFalse;
+ if( lmAddressLine1.isEmpty() )
+ {
+ lmAddressLine1 = aItemArray[i].mStreet;
+ }
+ else
+ {
+ lmAddressLine2 = aItemArray[i].mStreet;
+ addressEmtpy = EFalse;
+ }
}
if( !aItemArray[i].mCity.isEmpty() )
{
- if( !addressEmtpy )
+ if( lmAddressLine1.isEmpty() )
{
- lmAddressLine2 = lmAddressLine2 + KSeparator;
- lmAddressLine2 = lmAddressLine2 + KSpace;
- lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCity;
+ lmAddressLine1 = aItemArray[i].mCity;
}
else
{
- lmAddressLine2 = aItemArray[i].mCity;
- addressEmtpy = EFalse;
+ if( !addressEmtpy )
+ {
+ lmAddressLine2 = lmAddressLine2 + KSeparator;
+ lmAddressLine2 = lmAddressLine2 + KSpace;
+ lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCity;
+ }
+ else
+ {
+ lmAddressLine2 = aItemArray[i].mCity;
+ addressEmtpy = EFalse;
+ }
}
}
if( !aItemArray[i].mState.isEmpty() )
{
- if( !addressEmtpy )
+ if( lmAddressLine1.isEmpty() )
{
- lmAddressLine2 = lmAddressLine2 + KSeparator;
- lmAddressLine2 = lmAddressLine2 + KSpace;
- lmAddressLine2 = lmAddressLine2 + aItemArray[i].mState;
+ lmAddressLine1 = aItemArray[i].mState;
}
else
{
- lmAddressLine2 = aItemArray[i].mState;
- addressEmtpy = EFalse;
+ if( !addressEmtpy )
+ {
+ lmAddressLine2 = lmAddressLine2 + KSeparator;
+ lmAddressLine2 = lmAddressLine2 + KSpace;
+ lmAddressLine2 = lmAddressLine2 + aItemArray[i].mState;
+ }
+ else
+ {
+ lmAddressLine2 = aItemArray[i].mState;
+ addressEmtpy = EFalse;
+ }
}
}
if( !aItemArray[i].mCountry.isEmpty() )
@@ -176,70 +192,56 @@
// set icons based on contact address type
QVariantList icons;
- HbIcon adressTypeIcon;
- bool adressIconPresent = false;
- if( aItemArray[i].mSourceType == ESourceContactsHome )
- {
- adressTypeIcon = HbIcon(KContactHomeIcon);
- adressIconPresent = true;
- }
- else if( aItemArray[i].mSourceType == ESourceContactsWork )
- {
- adressTypeIcon =HbIcon(KContactWorkIcon);
- adressIconPresent = true;
- }
- else if( aItemArray[i].mSourceType == ESourceContactsPref )
- {
- adressTypeIcon =HbIcon(KContactPrefIcon);
- adressIconPresent = true;
- }
-
- // create a list item and set to model
- QStringList addressData;
- //create model for grid view in landscape mode
- if( mOrientation == Qt::Horizontal && ( mViewType == ELocationPickerCollectionContent ||
- mViewType == ELocationPickerContent ) )
- {
- addressData.clear();
-
- HbIcon landscapeIcon;
-
- if( QFile::exists( aItemArray[i].mMapTilePath ) )
+ QString adressType;
+ bool adressIconPresent = false;
+ if( aItemArray[i].mSourceType == ESourceContactsHome )
+ {
+ adressType = KContactHomeIcon;
+ adressIconPresent = true;
+ }
+ else if( aItemArray[i].mSourceType == ESourceContactsWork )
+ {
+ adressType = KContactWorkIcon;
+ adressIconPresent = true;
+ }
+ else if( aItemArray[i].mSourceType == ESourceContactsPref )
{
- //draw maptile Icon
- QPainter painter;
- QPixmap sourcePixmap;
- sourcePixmap = QPixmap( QString(aItemArray[i].mMapTilePath) );
- int mapHeight = (sourcePixmap.height()/ASPECTRATIOHEIGHT)*ASPECTRATIOHEIGHT;
- int mapWidth = mapHeight*ASPECTRATIOWIDTH/ASPECTRATIOHEIGHT;
- QPixmap mapPixmap(mapWidth, mapHeight);
- painter.begin( &mapPixmap );
- painter.drawPixmap( 0,0,sourcePixmap,(((sourcePixmap.width()-mapWidth))/2),
- ((sourcePixmap.height()-mapHeight)/2),mapWidth,mapHeight );
- painter.end();
- if(adressIconPresent)
+ adressType = KContactPrefIcon;
+ adressIconPresent = true;
+ }
+
+ // create a list item and set to model
+ QStringList addressData;
+ //create model for grid view in landscape mode
+ if( mOrientation == Qt::Horizontal && ( mViewType == ELocationPickerCollectionContent ||
+ mViewType == ELocationPickerContent ) )
+ {
+ addressData.clear();
+
+ QString landscapeIconPath;
+
+ if( QFile::exists( aItemArray[i].mMapTilePath ) )
+ {
+ //draw maptile Icon
+
+ landscapeIconPath = QString( QString( aItemArray[i].mMapTilePath ) );
+ }
+ else
{
- //draw the adressType Icon over mapTile Icon
- QPixmap adressTypePixmap = adressTypeIcon.pixmap();
- painter.begin( &mapPixmap );
- painter.drawPixmap( (mapPixmap.width()-adressTypePixmap.width()),0,adressTypePixmap );
- painter.end();
+ //draw dummy icon
+ landscapeIconPath = QString("");
}
- QIcon landscape( mapPixmap );
- landscapeIcon = HbIcon( landscape );
- }
- else
- {
- //draw dummy icon
- landscapeIcon = HbIcon( KDummyImage );
- }
- icons<<landscapeIcon;
+ icons<<landscapeIconPath;
QStandardItem *modelItem = new QStandardItem();
- addressData << lmAddressLine1;
+ lmAddressLine1 = lmAddressLine1.append(KSeparator);
+ lmAddressLine1 = lmAddressLine1.append(KSpace);
+ QString landMark = lmAddressLine1.append(lmAddressLine2);
+ addressData <<landMark;
modelItem->setData(QVariant(addressData), Qt::DisplayRole);
modelItem->setData( icons[0], Qt::DecorationRole );
modelItem->setData( aItemArray[i].mId, Qt::UserRole );
+ modelItem->setData(adressType,Qt::UserRole+1);
mModel->appendRow( modelItem );
}
else
@@ -247,11 +249,11 @@
//create model for list view in potrait mode
addressData.clear();
HbIcon potraitIcon( KDummyImage );
- icons<<potraitIcon;
- if(adressIconPresent)
- {
- icons<<adressTypeIcon;
- }
+ icons<<potraitIcon;
+ if(adressIconPresent)
+ {
+ icons<<adressType;
+ }
QStandardItem *modelItem = new QStandardItem();
addressData << lmAddressLine1 << lmAddressLine2;
modelItem->setData(QVariant(addressData), Qt::DisplayRole);
@@ -259,8 +261,8 @@
modelItem->setData( aItemArray[i].mId, Qt::UserRole );
mModel->appendRow( modelItem );
}
- }
- }
+ }
+ }
return true;
}
@@ -269,26 +271,55 @@
// LocationPickerDataManagerPrivate::populateCollections()
// ----------------------------------------------------------------------------
-void LocationPickerDataManagerPrivate::populateCollections()
+void LocationPickerDataManagerPrivate::populateCollections(QList<int>& aCount)
{
// add contact collection
QStandardItem *modelItemContact = new QStandardItem();
+ int conNum = aCount.value(0);
+ QString contactCollectionNum;
+ contactCollectionNum.setNum(conNum);
+ contactCollectionNum.append(" items");
QString contactCollectionName( hbTrId("txt_lint_list_contact_addresses") );
- modelItemContact->setData( QVariant( contactCollectionName ), Qt::DisplayRole );
+
+ if( mOrientation == Qt::Vertical)
+ {
+ QStringList contact = (QStringList()<<contactCollectionName<<contactCollectionNum);
+ modelItemContact->setData( QVariant( contact ), Qt::DisplayRole );
+ }
+ else
+ {
+ QString contact = contactCollectionName.append(contactCollectionNum);
+ modelItemContact->setData( QVariant( contact ), Qt::DisplayRole );
+ }
+
modelItemContact->setData( HbIcon ( KCollectionsContacts ), Qt::DecorationRole );
modelItemContact->setData( ESourceLandmarksContactsCat, Qt::UserRole );
mModel->appendRow( modelItemContact );
-
+
+ //txt_lint_list_calender_addresses
+ int calNum = aCount.value(1);
+ QString calendarCollectionNum;
+ calendarCollectionNum.setNum(calNum);
+ calendarCollectionNum.append(" items");
+ QString calendarCollectionName( hbTrId("txt_lint_list_calendar_event_locations") );
+ QStringList calender = (QStringList()<<calendarCollectionName<<calendarCollectionNum);
+
QStandardItem *modelItemCalendar = new QStandardItem();
- QString calendarCollectionName( hbTrId("txt_lint_list_calendar_event_locations") );
- modelItemCalendar->setData( QVariant( calendarCollectionName ), Qt::DisplayRole );
+ modelItemCalendar->setData( QVariant( calender ), Qt::DisplayRole );
modelItemCalendar->setData( HbIcon ( KCollectionsCalendar ), Qt::DecorationRole );
modelItemCalendar->setData( ESourceLandmarksCalendarCat, Qt::UserRole );
mModel->appendRow( modelItemCalendar );
-
+
+ //txt_lint_list_places_addresses
+ int placNum = aCount.value(2);
+ QString placesCollectionNum;
+ placesCollectionNum.setNum(placNum);
+ placesCollectionNum.append(" items");
+ QString placesCollectionName( hbTrId("txt_lint_list_places") );
+ QStringList places = (QStringList()<<placesCollectionName<<placesCollectionNum);
+
QStandardItem *modelItemPlaces = new QStandardItem();
- QString placesCollectionName( hbTrId("txt_lint_list_places") );
- modelItemPlaces->setData( QVariant( placesCollectionName ), Qt::DisplayRole );
+ modelItemPlaces->setData( QVariant( places ), Qt::DisplayRole );
modelItemPlaces->setData( HbIcon (KCollectionsPlaces), Qt::DecorationRole );
modelItemPlaces->setData( ESourceLandmarks, Qt::UserRole );
mModel->appendRow( modelItemPlaces );
--- a/locationpickerservice/src/locationpickerlandscapeview.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickerlandscapeview.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -19,18 +19,23 @@
#include <qstandarditemmodel.h>
#include <HbMainWindow>
-#include <HbGridViewItem>
-#include <HbGridView>
#include <HbStyleLoader>
#include <HbAction>
+#include <HbMenu>
#include <HbToolBar>
+#include <QGraphicsLinearLayout>
+#include <HbLabel>
+#include <HbTextItem>
+#include <hgwidgets/hgmediawall.h>
+#include "hgwidgetdatamodel.h"
#include "locationpickerproxymodel.h"
#include "locationpickerdatamanager.h"
#include "locationpickercollectionlistcontent.h"
#include "locationpickercollectioncontent.h"
+
// ----------------------------------------------------
// LocationPickerLandscapeView::LocationPickerLandscapeView()
// ----------------------------------------------------
@@ -41,25 +46,24 @@
mSearchAction(NULL),
mAscendingAction(NULL),
mDescendingAction(NULL),
- mGridView(NULL),
mCollectionContent(NULL),
- mGridViewItem(NULL),
- mViewType(ELocationPickerContent)
-{
- HbStyleLoader::registerFilePath(":/locationgrid.css");
- HbStyleLoader::registerFilePath(":/locationgrid.hbgridviewitem.widgetml");
- //create grid view item
- mGridViewItem = new HbGridViewItem();
- mGridViewItem->setObjectName("locationgrid");
-
+ mViewType(ELocationPickerContent),
+ mModel(NULL),
+ mWidget(NULL),
+ mLayout(NULL),
+ mEmptyLabel(NULL),
+ mLongPressMenu(NULL)
+{
// create back action
mLandscapeBackAction = new HbAction(Hb::BackNaviAction);
setNavigationAction(mLandscapeBackAction);
connect(mLandscapeBackAction, SIGNAL(triggered()), this,
SLOT(backButtonTriggered()));
+
+
}
// ----------------------------------------------------
-// LocationPickerPotraitView::~LocationPickerLandscapeView()
+// LocationPickerLandscapeView::~LocationPickerLandscapeView()
// ----------------------------------------------------
LocationPickerLandscapeView::~LocationPickerLandscapeView()
{
@@ -68,10 +72,13 @@
delete mCollectionAction;
delete mAscendingAction;
delete mDescendingAction;
+ delete mWidget;
+ delete mModel;
+ delete mLongPressMenu;
}
// ----------------------------------------------------------------------------
-// LocationPickerPotraitView::backButtonTriggered()
+// LocationPickerLandscapeView::backButtonTriggered()
// ----------------------------------------------------------------------------
void LocationPickerLandscapeView::backButtonTriggered()
{
@@ -90,11 +97,11 @@
// ----------------------------------------------------
-// LocationPickerPotraitView::~init()
+// LocationPickerLandscapeView::init()
// ----------------------------------------------------
void LocationPickerLandscapeView::init(Qt::Orientation aOrientation, QStandardItemModel *aModel )
{
- mModel = aModel;
+ mStandardModel = aModel;
//create proxy model
mProxyModel = new LocationPickerProxyModel( aOrientation , this );
mProxyModel->setSourceModel(aModel);
@@ -106,8 +113,6 @@
mProxyModel->sort(0, Qt::AscendingOrder);
//Get HbAction items
- mGridView = qobject_cast<HbGridView*> (mDocumentLoader->findObject(QString(
- "gridView")));
HbToolBar* toolbar = new HbToolBar();
//Create Action Items
mAllAction = new HbAction();
@@ -128,18 +133,11 @@
QString("ascendingAction")));
mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
QString("descendingAction")));
- if( !mAllAction || !mCollectionAction || !mSearchAction || !mGridView || !mAscendingAction || !mDescendingAction)
+ if( !mAllAction || !mCollectionAction || !mSearchAction || !mAscendingAction || !mDescendingAction)
{
qFatal("Error Reading Docml");
}
-
- if(this->mainWindow()->orientation() == Qt::Horizontal)
- {
- int rowCount = mGridView->rowCount();
- int columnCount = mGridView->columnCount();
- mGridView->setRowCount(columnCount);
- mGridView->setColumnCount(rowCount);
- }
+
//connect to slots
connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
connect(mDescendingAction, SIGNAL(triggered()), this,
@@ -150,20 +148,48 @@
connect(mSearchAction, SIGNAL(triggered()), this,
SLOT(searchTabTriggered()));
- connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
+ //hurrriganes widget
+ QGraphicsWidget *widget = NULL;
+ widget = mDocumentLoader->findWidget(QString("vertical"));
+ mLayout = static_cast<QGraphicsLinearLayout*>(widget->layout());
+
+ mModel = new HgWidgetDataModel( mProxyModel, this );
+ mModel->setImageDataType(HgWidgetDataModel::ETypeQImage);
+ //create MediaWall Object
+ mWidget = new HgMediawall();
+ HbIcon defaultIcon(KDummyImage);
+ QImage defaultImage = defaultIcon.pixmap().toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ mWidget->setDefaultImage(defaultImage);
+ mWidget->setObjectName("location");
+ HbStyleLoader::registerFilePath(":/location.hgmediawall.widgetml");
+ HbStyleLoader::registerFilePath(":/location.hgmediawall.css");
+ mWidget->enableReflections(false);
+ mWidget->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ mWidget->setItemSize(QSize(4.6,2));
+ connect(this->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),mWidget,
+ SLOT(orientationChanged(Qt::Orientation)));
+
+ mWidget->setAcceptTouchEvents(true);
+ 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 &)));
+ mLayout->addItem(mWidget);
+ mWidget->setModel(mModel);
+ mWidget->setLongPressEnabled(true);
+ mWidget->scrollTo(mWidget->currentIndex());
}
// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::manageGridView()
+// LocationPickerLandscapeView::manageHgWidget()
// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::manageGridView()
+void LocationPickerLandscapeView::manageHgWidget()
{
//set the appropriate model
switch(mViewType)
{
case ELocationPickerContent:
- {
- mGridView->setModel(mProxyModel,mGridViewItem);
+ {
+ mModel->resetModel(mProxyModel);
mAllAction->setChecked(true);
mCollectionAction->setChecked(false);
}
@@ -184,37 +210,40 @@
void LocationPickerLandscapeView::handleActivated(const QModelIndex &aIndex)
{
//handle the activated signal according to model set
-
- switch(mViewType)
- {
- case ELocationPickerContent:
- {
- QModelIndex index = mProxyModel->mapToSource(
- aIndex);
- quint32 lm = 0;
- QStandardItem* item = mModel->item( index.row(), index.column() );
- QVariant var = item->data( Qt::UserRole );
- lm = var.toUInt();
- //item selected, complete request
- emit selectItem( lm );
- }
- break;
- case ELocationPickerCollectionContent:
- {
- if(!mCollectionContent->getProxyModel())
- {
- break;
- }
- QModelIndex index = mCollectionContent->getProxyModel()->mapToSource(
- aIndex);
- quint32 lm = 0;
- mCollectionContent->getData(index, lm);
- emit selectItem(lm);
- }
- break;
- default:
- break;
- }
+ int row= aIndex.row();
+ int col = aIndex.column();
+ switch(mViewType)
+ {
+ case ELocationPickerContent:
+ {
+ QModelIndex proxyModelIndex = mProxyModel->index(row,col);
+ QModelIndex index = mProxyModel->mapToSource(
+ proxyModelIndex);
+ quint32 lm = 0;
+ QStandardItem* item = mStandardModel->item( index.row(), index.column() );
+ QVariant var = item->data( Qt::UserRole );
+ lm = var.toUInt();
+ //item selected, complete request
+ emit selectItem( lm );
+ }
+ break;
+ case ELocationPickerCollectionContent:
+ {
+ if(!mCollectionContent->getProxyModel())
+ {
+ break;
+ }
+ QModelIndex proxyModelIndex = mCollectionContent->getProxyModel()->index(row,col);
+ QModelIndex index = mCollectionContent->getProxyModel()->mapToSource(
+ proxyModelIndex);
+ quint32 lm = 0;
+ mCollectionContent->getData(index, lm);
+ emit selectItem(lm);
+ }
+ break;
+ default:
+ break;
+ }
}
@@ -225,30 +254,35 @@
void LocationPickerLandscapeView::sortAscending()
{
//check the model set and do sorting accordingly
- if (mViewType == ELocationPickerContent)
- {
- mProxyModel->sort(0, Qt::AscendingOrder);
- }
- else
- {
- mCollectionContent->getProxyModel()->sort(0, Qt::AscendingOrder);
- }
+ if (mViewType == ELocationPickerContent)
+ {
+ mProxyModel->sort(0,Qt::AscendingOrder);
+ mModel->resetModel(mProxyModel);
+ }
+ else
+ {
+ mCollectionContent->getProxyModel()->sort(0,Qt::AscendingOrder);
+ mModel->resetModel(mCollectionContent->getProxyModel());
+ }
+
}
// -----------------------------------------------------------------------------
// LocationPickerLandscapeView::sortDescending()
// -----------------------------------------------------------------------------
void LocationPickerLandscapeView::sortDescending()
-{
+{
//check the model set and do sorting accordingly
- if (mViewType == ELocationPickerContent)
- {
- mProxyModel->sort(0, Qt::DescendingOrder);
- }
- else
- {
- mCollectionContent->getProxyModel()->sort(0, Qt::DescendingOrder);
- }
+ if (mViewType == ELocationPickerContent)
+ {
+ mProxyModel->sort(0,Qt::DescendingOrder);
+ mModel->resetModel(mProxyModel);
+ }
+ else
+ {
+ mCollectionContent->getProxyModel()->sort(0,Qt::DescendingOrder);
+ mModel->resetModel(mCollectionContent->getProxyModel());
+ }
}
// -----------------------------------------------------------------------------
@@ -257,26 +291,35 @@
void LocationPickerLandscapeView::allTabTriggered()
{
//execute only if tab is not pressed
- if (mAllAction->isChecked())
- {
- mGridView->setModel(mProxyModel,mGridViewItem);
- mAscendingAction->setEnabled(true);
- mDescendingAction->setEnabled(true);
- mCollectionAction->setChecked(false);
- mViewType = ELocationPickerContent;
- //delete mCollectionContent if coming back from collectioncontent
- if (mCollectionContent)
- {
- delete mCollectionContent;
- mCollectionContent = NULL;
- }
- }
- else
- {
- //Keep the tab pressed
- mAllAction->setChecked(true);
- }
-
+ if (mAllAction->isChecked())
+ {
+ if(mEmptyLabel)
+ {
+ mLayout->removeItem(mEmptyLabel);
+ mEmptyLabel->hide();
+ mLayout->insertItem(0,mWidget);
+ mWidget->setVisible(true);
+ delete mEmptyLabel;
+ mEmptyLabel = NULL;
+ }
+ mModel->resetModel(mProxyModel);
+ }
+ mAscendingAction->setEnabled(true);
+ mDescendingAction->setEnabled(true);
+ mCollectionAction->setChecked(false);
+ mViewType = ELocationPickerContent;
+ //delete mCollectionContent if coming back from collectioncontent
+ if (mCollectionContent)
+ {
+ delete mCollectionContent;
+ mCollectionContent = NULL;
+ }
+ else
+ {
+ //Keep the tab pressed
+ mAllAction->setChecked(true);
+ }
+
}
// -----------------------------------------------------------------------------
@@ -287,6 +330,8 @@
//execute only if tab is not pressed
if (mCollectionAction->isChecked())
{
+ mAscendingAction->setDisabled(true);
+ mDescendingAction->setDisabled(true);
mViewType = ELocationPickerCollectionListContent;
emit handleCollectionList();
}
@@ -307,21 +352,39 @@
void LocationPickerLandscapeView::setCollectionData( quint32 aCategoryId )
{
+ if(mEmptyLabel)
+ {
+ mLayout->removeItem(mEmptyLabel);
+ mEmptyLabel->hide();
+ mLayout->insertItem(0,mWidget);
+ mWidget->show();
+ delete mEmptyLabel;
+ mEmptyLabel = NULL;
+ }
if(!mCollectionContent)
{
mCollectionContent = new LocationPickerCollectionContent(Qt::Horizontal , aCategoryId);
}
if(mCollectionContent->locationFound())
{
- mGridView->setModel(mCollectionContent->getProxyModel(),mGridViewItem);
+ mModel->resetModel(mCollectionContent->getProxyModel());
//Enable the options
mAscendingAction->setEnabled(true);
mDescendingAction->setEnabled(true);
}
else
{
- mGridView->setModel(mCollectionContent->getStandardModel(),mGridViewItem);
+ if(!mEmptyLabel)
+ {
+ mEmptyLabel = new HbTextItem(hbTrId("txt_lint_list_no_location_entries_present"));
}
+ mEmptyLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ mEmptyLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ mLayout->removeItem(mWidget);
+ mWidget->setVisible(false);
+ mLayout->insertItem(0, mEmptyLabel);
+ }
+
mViewType = ELocationPickerCollectionContent;
mCollectionAction->setChecked(true);
@@ -363,3 +426,24 @@
}
}
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::launchPopUpMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::launchPopUpMenu(const QModelIndex &aIndex, const QPointF &aPoint)
+{
+ mLongPressMenu = new HbMenu();
+ mLongPressMenu->setTimeout(HbMenu::NoTimeout);
+ HbAction* selectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ mIndex = aIndex;
+ connect(selectAction, SIGNAL(triggered()), this, SLOT(handleLongPress()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ mLongPressMenu->open();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::handleLongPress()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::handleLongPress()
+{
+ handleActivated(mIndex);
+}
--- a/locationpickerservice/src/locationpickerpotraitview.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickerpotraitview.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -22,8 +22,9 @@
#include <HbListView>
#include <HbListViewItem>
#include <HbAction>
-#include <QTimer>
+#include <HbMenu>
#include <HbToolBar>
+#include <QGraphicsLinearLayout>
#include "locationpickerproxymodel.h"
#include "locationpickerdatamanager.h"
@@ -47,7 +48,10 @@
mDescendingAction(NULL),
mListView(NULL),
mCollectionContent(NULL),
- mViewType(ELocationPickerContent)
+ mViewType(ELocationPickerContent),
+ mLinerLayout(NULL),
+ mColllabel(NULL),
+ mLongPressMenu(NULL)
{
// create back action
mPotraitBackAction = new HbAction(Hb::BackNaviAction);
@@ -73,6 +77,7 @@
delete mAscendingAction;
delete mDescendingAction;
delete mListView;
+ delete mLongPressMenu;
}
// ----------------------------------------------------------------------------
@@ -91,6 +96,13 @@
//complete the service
emit completeService();
}
+ if (mLinerLayout && mColllabel)
+ {
+ mColllabel->setPlainText("");
+ mLinerLayout->removeItem(mColllabel);
+ mLinerLayout->updateGeometry();
+ update();
+ }
}
@@ -140,6 +152,8 @@
{
qFatal("Error Reading Docml");
}
+
+ mColllabel = new HbLabel();
//connect to slots
connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
@@ -152,8 +166,13 @@
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(longPressed(HbAbstractViewItem*, const QPointF &)),this,
+ SLOT(launchPopUpMenu(HbAbstractViewItem*, const QPointF &)));
}
+// ----------------------------------------------------
+// LocationPickerPotraitView::manageListView()
+// ----------------------------------------------------
void LocationPickerPotraitView::manageListView()
{
//set the appropriate model
@@ -174,6 +193,11 @@
mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
mCollectionAction->setChecked(true);
mAllAction->setChecked(false);
+ if(mAscendingAction->isEnabled())
+ {
+ mAscendingAction->setDisabled(true);
+ mDescendingAction->setDisabled(true);
+ }
mViewType = ELocationPickerCollectionListContent;
}
break;
@@ -190,7 +214,9 @@
}
}
-
+// -----------------------------------------------------------------------------
+// LocationPickerPotraitView::disableTabs()
+// -----------------------------------------------------------------------------
void LocationPickerPotraitView::disableTabs( QStandardItemModel *aModel )
{
//if no location entries present
@@ -203,19 +229,10 @@
}
// -----------------------------------------------------------------------------
-// LocationPickerView::handleActivated()
+// LocationPickerPotraitView::handleActivated()
// -----------------------------------------------------------------------------
void LocationPickerPotraitView::handleActivated(const QModelIndex &aIndex)
{
- mIndex = aIndex;
- QTimer::singleShot(0, this, SLOT(changeModel()));
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerPotraitView::changeModel()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::changeModel()
-{
//handle the activated signal according to model set
switch(mViewType)
{
@@ -226,7 +243,7 @@
break;
}
QModelIndex index = mProxyModel->mapToSource(
- mIndex);
+ aIndex);
quint32 lm = 0;
QStandardItem* item = mModel->item( index.row(), index.column() );
QVariant var = item->data( Qt::UserRole );
@@ -238,7 +255,7 @@
case ELocationPickerCollectionListContent:
{
mLocationPickerCollectionListContent->getData(
- mIndex, mCategoryId );
+ aIndex, mCategoryId );
mViewType = ELocationPickerCollectionContent;
//send categoryID to set the collection content
emit sendCategoryID(mCategoryId);
@@ -251,7 +268,7 @@
break;
}
QModelIndex index = mCollectionContent->getProxyModel()->mapToSource(
- mIndex);
+ aIndex);
quint32 lm = 0;
mCollectionContent->getData(index, lm);
//item selected, complete request
@@ -300,6 +317,13 @@
// -----------------------------------------------------------------------------
void LocationPickerPotraitView::allTabTriggered()
{
+ if (mLinerLayout && mColllabel)
+ {
+ mColllabel->setPlainText("");
+ mLinerLayout->removeItem(mColllabel);
+ mLinerLayout->updateGeometry();
+ update();
+ }
//execute only if tab is not pressed
if (mAllAction->isChecked())
{
@@ -337,6 +361,13 @@
// -----------------------------------------------------------------------------
void LocationPickerPotraitView::colectionTabTriggered()
{
+ if (mLinerLayout && (mViewType != ELocationPickerCollectionContent) && mColllabel )
+ {
+ mColllabel->setPlainText("");
+ mLinerLayout->removeItem(mColllabel);
+ mLinerLayout->updateGeometry();
+ update();
+ }
//execute only if tab is not pressed
if (mCollectionAction->isChecked())
{
@@ -367,7 +398,19 @@
// -----------------------------------------------------------------------------
void LocationPickerPotraitView::setCollectionData( quint32 acategoryId )
{
+ QString categoryname;
+ switch(acategoryId)
+ {
+
+ case 1: categoryname = "Landmarks";
+ break;
+ case 8: categoryname = "Contacts";
+ break;
+ case 9: categoryname = "Calender";
+ break;
+
+ }
if(!mCollectionContent)
{
mCollectionContent
@@ -388,6 +431,15 @@
mViewType = ELocationPickerCollectionContent;
mCollectionAction->setChecked(true);
+ mLinerLayout = static_cast<QGraphicsLinearLayout*>(widget()->layout());
+
+ if(mColllabel)
+ {
+ mLinerLayout->insertItem(0,mColllabel);
+ mColllabel->setPlainText(categoryname);
+ mLinerLayout->updateGeometry();
+ update();
+ }
}
// -----------------------------------------------------------------------------
@@ -427,3 +479,24 @@
}
}
+// -----------------------------------------------------------------------------
+// LocationPickerPotraitView::launchPopUpMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::launchPopUpMenu(HbAbstractViewItem *aItem, const QPointF &aPoint)
+{
+ mLongPressMenu = new HbMenu();
+ mLongPressMenu->setTimeout(HbMenu::NoTimeout);
+ HbAction* selectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ mIndex = aItem->modelIndex();
+ connect(selectAction, SIGNAL(triggered()), this, SLOT(handleLongPress()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ mLongPressMenu->open();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerPotraitView::handleLongPress()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::handleLongPress()
+{
+ handleActivated(mIndex);
+}
--- a/locationpickerservice/src/locationpickersearchview.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickersearchview.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -22,6 +22,8 @@
#include <HbTextItem>
#include <HbDocumentLoader>
#include <QGraphicsLinearLayout>
+#include <HbMenu>
+#include <HbAction>
#include "locationpickerproxymodel.h"
#include "locationpickersearchview.h"
@@ -39,7 +41,8 @@
mSearchPanel(NULL),
mEmptyLabel(NULL),
mVerticalLayout(NULL),
- mDocumentLoader(aLoader)
+ mDocumentLoader(aLoader),
+ mLongPressMenu(NULL)
{
}
@@ -50,6 +53,7 @@
{
delete mProxyModel;
delete mEmptyLabel;
+ delete mLongPressMenu;
}
// ----------------------------------------------------
@@ -61,20 +65,18 @@
//get listview from docml
mListView = qobject_cast<HbListView*>(
mDocumentLoader.findObject(QString("SearchListView")));
- if(mListView == NULL)
+ if(!mListView)
{
qFatal("Error Reading Docml");
}
//get search panel from docml
mSearchPanel = qobject_cast<HbSearchPanel*>(
mDocumentLoader.findObject(QString("searchPanel")));
- if(mListView == NULL)
- {
- qFatal("Error Reading Docml");
- }
//conect to respective slots
connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated
(const QModelIndex &)));
+ connect(mListView,SIGNAL(longPressed(HbAbstractViewItem*, const QPointF &)),this,
+ SLOT(launchPopUpMenu(HbAbstractViewItem*, const QPointF &)));
connect(mSearchPanel, SIGNAL(exitClicked()),this, SLOT(handleExit()));
connect(mSearchPanel,SIGNAL(criteriaChanged(QString)),this,SLOT(doSearch(QString)));
@@ -120,12 +122,8 @@
{
QGraphicsWidget *widget = NULL;
widget = mDocumentLoader.findWidget(QString("container"));
- if(widget == NULL)
- {
- qFatal("Error Reading Docml");
- }
mVerticalLayout = static_cast<QGraphicsLinearLayout*>(widget->layout());
- if(mVerticalLayout == NULL)
+ if(!widget || !mVerticalLayout)
{
qFatal("Error Reading Docml");
}
@@ -173,3 +171,26 @@
QVariant var = item->data( Qt::UserRole );
aValue = var.toUInt();
}
+
+
+// -----------------------------------------------------------------------------
+// LocationPickerSearchView::launchPopUpMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerSearchView::launchPopUpMenu(HbAbstractViewItem *aItem, const QPointF &aPoint)
+{
+ mLongPressMenu = new HbMenu();
+ mLongPressMenu->setTimeout(HbMenu::NoTimeout);
+ HbAction* selectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ mIndex = aItem->modelIndex();
+ connect(selectAction, SIGNAL(triggered()),this, SLOT(handleLongPress()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ mLongPressMenu->open();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerSearchView::handleLongPress()
+// -----------------------------------------------------------------------------
+void LocationPickerSearchView::handleLongPress()
+{
+ handleActivated(mIndex);
+}
--- a/locationpickerservice/src/locationpickerservice.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/locationpickerservice.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -50,10 +50,11 @@
connect( this, SIGNAL( returnValueDelivered() ), qApp, SLOT( quit() ) );
bool ok = completeRequest(mAsyncReqId,mReturn);
mAsyncReqId = 0;
- if(ok == false)
- {
+ }
+ else
+ {
qApp->quit();
- }
+
}
}
// ----------------------------------------------------------------------------
--- a/locationpickerservice/src/main.cpp Fri Jun 11 13:33:47 2010 +0300
+++ b/locationpickerservice/src/main.cpp Wed Jun 23 18:07:15 2010 +0300
@@ -25,6 +25,7 @@
HbTranslator translator("lilpicker");
app.setApplicationName( hbTrId("txt_lint_title_select_location") );
LocationPickerAppWindow mainWindow;
+ mainWindow.viewport()->grabGesture(Qt::TapGesture);
mainWindow.show();
return app.exec();
}