--- a/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Fri Jun 11 16:23:56 2010 +0100
+++ b/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h Thu Jul 22 16:31:43 2010 +0100
@@ -102,6 +102,9 @@
// map tile path
QString mMapTilePath;
+
+ //One line address
+ QString mSingleLineAddress;
};
/**
@@ -136,7 +139,7 @@
* Creates an entry in the lookup table.
* @param[in] aLookupItem The lookup item to be created in the database.
*/
- void createEntry( const QLookupItem& aLookupItem );
+ void createEntry( QLookupItem& aLookupItem );
/**
* Updates an entry in the lookup table.
@@ -167,13 +170,6 @@
void deleteEntryBySourceIdAndType( const QLookupItem& aLookupItem );
/**
- * Deletes an entry from the lookup table.
- * The id is used to find the entry in db
- * @param[in] aLookupItem The lookup item to be deleted from the database.
- */
- void deleteEntryById( const QLookupItem& aLookupItem );
-
- /**
* Finds an entry in the lookup table.
* @param[in/out] aLookupItem The lookup item to be found in the database. The source id and source type
* is passed in the lookup item. If the entry is found, all other fields are updated in the lookup item.
@@ -197,24 +193,30 @@
void findEntriesByLandmarkId( const quint32 aLandmarkId,
QList<QLookupItem>& aLookupItemArray );
- /**
- * Finds list of lookup items given a source type.
- * @param[in] aSourceType The source type to be found in the lookup database.
- * @param[out] aLookupItemArray List of lookup entries found.
- */
- void findEntriesBySourceType( const quint32 aSourceType,
- QList<QLookupItem>& aLookupItemArray );
-
-
- /**
+ /**
* Gets list of lookup items.
* @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.
* @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
@@ -222,6 +224,9 @@
// Handle to the items database
QSqlDatabase *mDb;
+
+ // Flag to indicate if db is open
+ bool mDbOpen;
};
#endif // LOCATIONDATA_LOOKUPDB_H
--- a/location_plat/location_data_harvester_api/inc/locationservicedefines.h Fri Jun 11 16:23:56 2010 +0100
+++ b/location_plat/location_data_harvester_api/inc/locationservicedefines.h Thu Jul 22 16:31:43 2010 +0100
@@ -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 */
@@ -49,4 +49,19 @@
ESourceInvalid
};
+/** Defines entry change type
+*/
+enum TEntryChangeType
+ {
+ /** Entry added */
+ EEntryAdded,
+ /** Entry modified */
+ EEntryModified,
+ /** Entry deleted */
+ EEntryDeleted,
+ /** Entry change unknown */
+ EEntryUnknown
+ };
+
+
#endif // QLOCATIONPICKERITEM_H
--- a/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h Fri Jun 11 16:23:56 2010 +0100
+++ b/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h Thu Jul 22 16:31:43 2010 +0100
@@ -133,8 +133,9 @@
* @param aSize requested maptile size
*
*/
- TMapTileParam( const TReal aLatitude, const TReal aLongitude, const TInt aZoom, const TInt aSize ):
- iLattitude( aLatitude ), iLongitude( aLongitude ), iZoomLevel( aZoom ), iSize( aSize )
+ TMapTileParam( const TReal aLatitude, const TReal aLongitude,
+ const TInt aZoom, const TInt aWidth, const TInt aHeight ): iLattitude( aLatitude ),
+ iLongitude( aLongitude ), iZoomLevel( aZoom ), iWidth( aWidth ), iHeight( aHeight )
{
}
@@ -155,8 +156,10 @@
TReal iLongitude;
//Zoom level
TInt iZoomLevel;
- //Required image size
- TInt iSize;
+ //Required image width
+ TInt iWidth;
+ //Required image height
+ TInt iHeight;
};
--- a/location_plat/location_picker_service_api/inc/qlocationpickeritem.h Fri Jun 11 16:23:56 2010 +0100
+++ b/location_plat/location_picker_service_api/inc/qlocationpickeritem.h Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/bwins/geocodeupdateu.def Thu Jul 22 16:31:43 2010 +0100
@@ -1,5 +1,20 @@
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_NABKABN1@Z @ 8 NONAME ; bool GeocodeUpdate::updateGeocodeToCalenderDB(unsigned long const &, double const &, double const &)
+ ??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 *)
+ ?isGeocodeNotAvailable@GeocodeUpdate@@QAE_NABK@Z @ 18 NONAME ; bool GeocodeUpdate::isGeocodeNotAvailable(unsigned long const &)
--- a/locationdataharvester/bwins/locationdatalookupdbu.def Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/bwins/locationdatalookupdbu.def Thu Jul 22 16:31:43 2010 +0100
@@ -1,19 +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 &)
- ?deleteEntryById@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 3 NONAME ; void LocationDataLookupDb::deleteEntryById(class QLookupItem const &)
+ ?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 *)
- ?findEntryBySourceIdAndType@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 8 NONAME ; bool LocationDataLookupDb::findEntryBySourceIdAndType(class QLookupItem &)
- ??1LocationDataLookupDb@@UAE@XZ @ 9 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(void)
- ?findEntriesByLandmarkId@LocationDataLookupDb@@QAEXIAAV?$QList@VQLookupItem@@@@@Z @ 10 NONAME ; void LocationDataLookupDb::findEntriesByLandmarkId(unsigned int, class QList<class QLookupItem> &)
- ?close@LocationDataLookupDb@@QAEXXZ @ 11 NONAME ; void LocationDataLookupDb::close(void)
- ?findEntryById@LocationDataLookupDb@@QAE_NAAVQLookupItem@@@Z @ 12 NONAME ; bool LocationDataLookupDb::findEntryById(class QLookupItem &)
- ?createEntry@LocationDataLookupDb@@QAEXABVQLookupItem@@@Z @ 13 NONAME ; void LocationDataLookupDb::createEntry(class QLookupItem const &)
- ?fillLookupEntry@LocationDataLookupDb@@AAEXAAVQSqlQuery@@AAVQLookupItem@@@Z @ 14 NONAME ; void LocationDataLookupDb::fillLookupEntry(class QSqlQuery &, class QLookupItem &)
- ?open@LocationDataLookupDb@@QAE_NXZ @ 15 NONAME ; bool LocationDataLookupDb::open(void)
- ??_ELocationDataLookupDb@@UAE@I@Z @ 16 NONAME ; LocationDataLookupDb::~LocationDataLookupDb(unsigned int)
- ?findEntriesBySourceType@LocationDataLookupDb@@QAEXIAAV?$QList@VQLookupItem@@@@@Z @ 17 NONAME ; void LocationDataLookupDb::findEntriesBySourceType(unsigned int, class QList<class QLookupItem> &)
+ ?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 16:23:56 2010 +0100
+++ b/locationdataharvester/bwins/maptileserviceu.def Thu Jul 22 16:31:43 2010 +0100
@@ -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@@V?$QFlags@W4Orientation@Qt@@@@@Z @ 10 NONAME ; int MapTileService::getMapTileImage(int, enum MapTileService::AddressType, class QString &, class QFlags<enum Qt::Orientation>)
+ ?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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/bwins/mylocationsdatabasemanageru.def Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+ ?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 16:23:56 2010 +0100
+++ b/locationdataharvester/eabi/geocodeupdateu.def Thu Jul 22 16:31:43 2010 +0100
@@ -1,5 +1,20 @@
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
+ _ZN13GeocodeUpdate21isGeocodeNotAvailableERKm @ 7 NONAME
+ _ZN13GeocodeUpdate24updateGeocodeToContactDBEjidd @ 8 NONAME
+ _ZN13GeocodeUpdate25agendautilInstanceCreatedEi @ 9 NONAME
+ _ZN13GeocodeUpdate25updateGeocodeToCalenderDBERKmRKdS3_ @ 10 NONAME
+ _ZN13GeocodeUpdateC1Ev @ 11 NONAME
+ _ZN13GeocodeUpdateC2Ev @ 12 NONAME
+ _ZN13GeocodeUpdateD0Ev @ 13 NONAME
+ _ZN13GeocodeUpdateD1Ev @ 14 NONAME
+ _ZN13GeocodeUpdateD2Ev @ 15 NONAME
+ _ZNK13GeocodeUpdate10metaObjectEv @ 16 NONAME
+ _ZTI13GeocodeUpdate @ 17 NONAME
+ _ZTV13GeocodeUpdate @ 18 NONAME
--- a/locationdataharvester/eabi/locationdatalookupdbu.def Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/eabi/locationdatalookupdbu.def Thu Jul 22 16:31:43 2010 +0100
@@ -1,18 +1,18 @@
EXPORTS
_ZN20LocationDataLookupDb10getEntriesER5QListI11QLookupItemEj @ 1 NONAME
- _ZN20LocationDataLookupDb11createEntryERK11QLookupItem @ 2 NONAME
+ _ZN20LocationDataLookupDb11createEntryER11QLookupItem @ 2 NONAME
_ZN20LocationDataLookupDb13findEntryByIdER11QLookupItem @ 3 NONAME
- _ZN20LocationDataLookupDb15deleteEntryByIdERK11QLookupItem @ 4 NONAME
- _ZN20LocationDataLookupDb15fillLookupEntryER9QSqlQueryR11QLookupItem @ 5 NONAME
- _ZN20LocationDataLookupDb15updateEntryByIdERK11QLookupItem @ 6 NONAME
+ _ZN20LocationDataLookupDb15fillLookupEntryER9QSqlQueryR11QLookupItem @ 4 NONAME
+ _ZN20LocationDataLookupDb15updateEntryByIdERK11QLookupItem @ 5 NONAME
+ _ZN20LocationDataLookupDb17getAddressDetailsEjj @ 6 NONAME
_ZN20LocationDataLookupDb23findEntriesByLandmarkIdEjR5QListI11QLookupItemE @ 7 NONAME
- _ZN20LocationDataLookupDb23findEntriesBySourceTypeEjR5QListI11QLookupItemE @ 8 NONAME
- _ZN20LocationDataLookupDb26findEntryBySourceIdAndTypeER11QLookupItem @ 9 NONAME
- _ZN20LocationDataLookupDb28deleteEntryBySourceIdAndTypeERK11QLookupItem @ 10 NONAME
- _ZN20LocationDataLookupDb28updateEntryBySourceIdAndTypeERK11QLookupItem @ 11 NONAME
- _ZN20LocationDataLookupDb30updateMaptileBySourceIdAndTypeEjj7QString @ 12 NONAME
- _ZN20LocationDataLookupDb4openEv @ 13 NONAME
- _ZN20LocationDataLookupDb5closeEv @ 14 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
--- a/locationdataharvester/eabi/maptileserviceu.def Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/eabi/maptileserviceu.def Thu Jul 22 16:31:43 2010 +0100
@@ -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_11AddressTypeER7QString6QFlagsIN2Qt11OrientationEE @ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/eabi/mylocationsdatabasemanageru.def Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,10 @@
+EXPORTS
+ _ZN27CMyLocationsDatabaseManager10ConstructLEv @ 1 NONAME
+ _ZN27CMyLocationsDatabaseManager15UpdateDatabaseLEP12CPosLandmarkmmm @ 2 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 16:23:56 2010 +0100
+++ b/locationdataharvester/geocodeupdate/geocodeupdate.pro Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/geocodeupdate/inc/geocodeupdate.h Thu Jul 22 16:31:43 2010 +0100
@@ -20,19 +20,33 @@
#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 AgendaUtil;
// 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.
@@ -40,20 +54,41 @@
* @param addressType contact address type.
* @param latitude Latitude to be updated.
* @param longitude longitude to be updated.
+ *
+ * @return Returns true if successfule otherwise false.
*/
- IMPORT_C static void updateGeocodeToContactDB(const quint32 contactId,
- const int addressType, const double latitude,
- const double longitude);
+ bool updateGeocodeToContactDB(const quint32 contactId, const int addressType,
+ const double latitude, const double longitude);
/**
* Request to update latitude and longitude into calender db.
* @param calEntryId calender entry unique id
* @param latitude Latitude to be updated.
* @param longitude longitude to be updated.
+ *
+ * @return Returns true if successfule otherwise false.
*/
- IMPORT_C static void updateGeocodeToCalenderDB(const ulong calEntryId,
- const double latitude, const double longitude);
+ bool updateGeocodeToCalenderDB(const ulong& calEntryId, const double& latitude,
+ const double& longitude);
+
+ /**
+ * Request to check if geo-cordinate available or not.
+ * @param calEntryId calender entry unique id
+ * @return true, if available otherwise false.
+ */
+ bool isGeocodeNotAvailable(const ulong& calEntryId);
+
+private slots:
+ void agendautilInstanceCreated(int);
+
+signals:
+ void eventCompleted();
+
+private:
+
+ AgendaUtil *mAgendaUtil;
+ bool mUtilInstanceCreated;
};
#endif // __GEOCODEUPDATE_H__
--- a/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -1,19 +1,19 @@
/*
-* 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:
-*
-*/
+ * 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:
+ *
+ */
#include <qcontactgeolocation.h>
#include <qcontactmanager.h>
@@ -22,17 +22,41 @@
#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() :
+ mAgendaUtil(NULL), mUtilInstanceCreated(false)
+{
+ mAgendaUtil = new AgendaUtil();
+ connect(mAgendaUtil, SIGNAL(instanceViewCreationCompleted(int)), this,
+ SLOT(agendautilInstanceCreated(int)));
+}
+
+// ----------------------------------------------------------------------------
+// GeocodeUpdate::~GeocodeUpdate()
+// ----------------------------------------------------------------------------
+GeocodeUpdate::~GeocodeUpdate()
+{
+ __TRACE_CALLSTACK;
+ if (mUtilInstanceCreated) {
+ delete mAgendaUtil;
+ }
+}
+
// ----------------------------------------------------------------------------
// GeocodeUpdate::createContactdb()
// ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::createContactdb()
+void GeocodeUpdate::createContactdb()
{
QContactManager* contactManger = NULL;
MYLOCLOGSTRING("call to create contactManger object and contactdb as well.");
@@ -44,9 +68,8 @@
// CGeocodeUpdate::updateGeocodeToContactDB()
// Geo-cordinate updation to contact db
// ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId,
- const int addressType, const double latitude,
- const double longitude)
+bool GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId, const int addressType,
+ const double latitude, const double longitude)
{
__TRACE_CALLSTACK;
@@ -56,55 +79,86 @@
MYLOCLOGSTRING("contactManger object created .");
MYLOCLOGSTRING("contactManger object is not null .");
- QStringList definitionRestrictions;
- QContact contact = contactManger->contact(contactId ,definitionRestrictions);
+ QContact contact = contactManger->contact(contactId);
QContactGeoLocation location;
- switch (addressType)
- {
- case ESourceContactsPref:
- {
- break;
- }
- case ESourceContactsWork:
- {
- location.setContexts(QContactDetail::ContextWork);
- break;
- }
- case ESourceContactsHome:
- {
- location.setContexts(QContactDetail::ContextHome);
- break;
- }
- default:
- {
- break;
- }
+ switch (addressType) {
+ 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,
- const double latitude, const double longitude)
+bool GeocodeUpdate::updateGeocodeToCalenderDB(const ulong& calEntryId, const double& latitude,
+ const double& longitude)
{
__TRACE_CALLSTACK;
- AgendaUtil agendaUtil;
- 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;
+ if (mUtilInstanceCreated) {
+ AgendaEntry agendaEntry(mAgendaUtil->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);
+ ret = mAgendaUtil->updateEntry(agendaEntry);
+ }
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+// CGeocodeUpdate::isGeocodeNotAvailable()
+// check if geo-cordinate are available for this specific entry id.
+// return true , for available otherwise false.
+// ----------------------------------------------------------------------------
+bool GeocodeUpdate::isGeocodeNotAvailable(const ulong& calEntryId)
+{
+ __TRACE_CALLSTACK;
+ bool ret = false;
+ if (mUtilInstanceCreated) {
+ AgendaEntry agendaEntry(mAgendaUtil->fetchById(calEntryId));
+ const AgendaGeoValue &geoValue = agendaEntry.geoValue();
+ ret = geoValue.isNull();
+ }
+ return ret;
+}
+
+// ----------------------------------------------------------------------------
+// CGeocodeUpdate::agendautilInstanceCreated()
+// call back on agendautil instance creation
+// ----------------------------------------------------------------------------
+void GeocodeUpdate::agendautilInstanceCreated(int status)
+{
+ if (AgendaUtil::NoError == status) {
+ mUtilInstanceCreated = true;
+ emit eventCompleted();
+ }
}
//end of line
--- a/locationdataharvester/inc/mylocationsdefines.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/inc/mylocationsdefines.h Thu Jul 22 16:31:43 2010 +0100
@@ -38,9 +38,27 @@
// File Path
TFileName iFilePath;
+
+ //MK map tile fetching status
+ TUint32 iFetchingStatus;
};
+/** Defines map tile fetching states.
+ */
+enum TMapTileFetchingState
+ {
+ /** Map tile fetching completed */
+ EMapTileFectchingCompleted,
+ /** Map tile fetching in progress */
+ EMapTileFetchingInProgress,
+ /** Map tile fetching n/w error */
+ EMapTileFetchingNetworkError,
+ /** Map tile fetching invalid address */
+ EMapTileFetchingInvalidAddress,
+ /** Map tile fetching unknown erro */
+ EMapTileFetchingUnknownError
+ };
// contacts category in landmarks db
_LIT( KContactsCategory, "Contacts" );
@@ -79,6 +97,7 @@
// maptile database column names
_LIT( NCntColUid, "cntuid" );
_LIT( NCntColFilePath, "filepath" );
+_LIT( MapTileFetchingStatus, "fetchingstatus" );
// database table name
_LIT( KLookupTable, "lookuptable" );
@@ -97,9 +116,30 @@
const TInt KColumncntUid = 1;
// source type column number
const TInt KColumnFilePath = 3;
+// fetching state column number
+const TInt KColumnMapTileFetchingStatus = 4;
const TInt KBufSize=256;
+//Different Maptile sizes for different applications
+const int MapTileWidth = 614;
+const int MapTileHeight = 250;
+const int MaptilePortraitWidth = 334;
+const int MaptilePortraitHeight = 250;
+const int MaptileContactLandscapeWidth = 382;
+const int MaptileContactLandscapeHeight = 128;
+const int MaptileCalendarLandscapeWidth = 614;
+const int MaptileCalendarLandscapeHeight = 202;
+const int MaptileHurriganesWidth = 228;
+const int MaptileHurriganesHeight = 170;
+
+static const char* MAPTILE_IMAGE_PORTRAIT = "_Vertical";
+static const char* MAPTILE_IMAGE_LANDSCAPE = "_Horizontal";
+static const char* MAPTILE_IMAGE_CALENDAR = "_Calendar";
+static const char* MAPTILE_IMAGE_CONTACT = "_Contact";
+static const char* MAPTILE_IMAGE_HURRIGANES = "_Hurriganes";
+static const char* MAPTILE_IMAGE_TYPE = "PNG";
+
#endif // __MYLOCATIONSDEFINES_H__
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/inc/notification.h Thu Jul 22 16:31:43 2010 +0100
@@ -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/locationdataharvester.pro Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/locationdataharvester.pro Thu Jul 22 16:31:43 2010 +0100
@@ -20,7 +20,7 @@
TEMPLATE = subdirs
-SUBDIRS = locationdatalookupdb maptileservice geocodeupdate mylocationsengine
+SUBDIRS = locationdatalookupdb maptileservice geocodeupdate mylocationsdatabasemanager mylocationsengine
# Exports
--- a/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -25,7 +25,12 @@
#include<locationservicedefines.h>
// database name
+#ifdef LOCPICKER_UNIT_TEST
+const QString KLocationDataLookupDbName = "c:\\locationdatalookuptestdb.db";
+#else
const QString KLocationDataLookupDbName = "c:\\locationdatalookupdb.db";
+#endif
+
// ================= MEMBER FUNCTIONS =======================
//
@@ -34,7 +39,10 @@
// Constructor
// ---------------------------------------------------------
//
-LocationDataLookupDb::LocationDataLookupDb( QObject *parent) : QObject(parent)
+LocationDataLookupDb::LocationDataLookupDb( QObject *parent) :
+ QObject( parent ),
+ mDb( NULL ),
+ mDbOpen( false )
{
mDb = new QSqlDatabase();
*mDb = QSqlDatabase::addDatabase( "QSQLITE" );
@@ -64,7 +72,11 @@
"icontype int,"
"iconpath varchar(255),"
"maptile varchar(255))");
-
+
+
+ query.exec("create table if not exists lplookupaddress ("
+ "sourceid int,"
+ "address varchar(255))");
mDb->close();
}
@@ -83,7 +95,11 @@
// ---------------------------------------------------------
bool LocationDataLookupDb::open()
{
- return mDb->open();
+ if( !mDbOpen )
+ {
+ mDbOpen = mDb->open();
+ }
+ return mDbOpen;
}
// ---------------------------------------------------------
@@ -91,16 +107,17 @@
// ---------------------------------------------------------
void LocationDataLookupDb::close()
{
- if( mDb )
+ if( mDbOpen )
mDb->close();
+ mDbOpen = false;
}
// ---------------------------------------------------------
// LocationDataLookupDb::createEntry()
// ---------------------------------------------------------
-void LocationDataLookupDb::createEntry( const QLookupItem& aLookupItem )
+void LocationDataLookupDb::createEntry( QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare("INSERT INTO lplookup ("
@@ -153,6 +170,25 @@
query.bindValue(":iconpath", aLookupItem.mIconPath);
query.bindValue(":maptile", aLookupItem.mMapTilePath);
query.exec();
+
+ 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();
+
+ }
+
}
}
@@ -161,7 +197,7 @@
// ---------------------------------------------------------
void LocationDataLookupDb::updateEntryBySourceIdAndType( const QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare("UPDATE lplookup SET "
@@ -204,7 +240,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();
+
+ }
}
+
}
// ---------------------------------------------------------
@@ -213,7 +263,7 @@
void LocationDataLookupDb::updateMaptileBySourceIdAndType( quint32 aSourceId,
quint32 aSourceType, QString aImagePath )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare("UPDATE lplookup SET "
@@ -233,7 +283,7 @@
// ---------------------------------------------------------
void LocationDataLookupDb::updateEntryById( const QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare("UPDATE lplookup SET "
@@ -275,6 +325,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();
+ }
}
}
@@ -283,7 +344,7 @@
// ---------------------------------------------------------
void LocationDataLookupDb::deleteEntryBySourceIdAndType( const QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare( "DELETE FROM lplookup "
@@ -293,22 +354,15 @@
query.addBindValue( aLookupItem.mSourceType );
query.exec();
- }
-}
-
-// ---------------------------------------------------------
-// LocationDataLookupDb::deleteEntryById()
-// ---------------------------------------------------------
-void LocationDataLookupDb::deleteEntryById( const QLookupItem& aLookupItem )
-{
- if( mDb )
- {
- QSqlQuery query(*mDb);
- query.prepare( "DELETE FROM lplookup "
- "WHERE id = ?" );
-
- query.addBindValue( aLookupItem.mId );
- query.exec();
+
+ if(aLookupItem.mSourceType==ESourceCalendar)
+ {
+ query.prepare( "DELETE FROM lplookupaddress "
+ "WHERE sourceid = ? " );
+ query.addBindValue( aLookupItem.mSourceUid );
+ query.exec();
+ }
+
}
}
@@ -317,7 +371,7 @@
// ---------------------------------------------------------
bool LocationDataLookupDb::findEntryBySourceIdAndType( QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare( "SELECT * FROM lplookup "
@@ -343,7 +397,7 @@
// ---------------------------------------------------------
bool LocationDataLookupDb::findEntryById( QLookupItem& aLookupItem )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
query.prepare( "SELECT * FROM lplookup "
@@ -371,7 +425,7 @@
void LocationDataLookupDb::findEntriesByLandmarkId( const quint32 aLandmarkId,
QList<QLookupItem>& aLookupItemArray )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
@@ -389,36 +443,12 @@
}
}
}
-
-// ---------------------------------------------------------
-// LocationDataLookupDb::findEntriesBySourceType()
-// ---------------------------------------------------------
-void LocationDataLookupDb::findEntriesBySourceType( const quint32 aSourceType,
- QList<QLookupItem>& aLookupItemArray )
-{
- if( mDb )
- {
- QSqlQuery query(*mDb);
- query.prepare( "SELECT * FROM lplookup "
- "WHERE sourceType = ?" );
- query.addBindValue( aSourceType );
- query.exec();
-
- while( query.next() )
- {
- QLookupItem lookupItem;
- fillLookupEntry( query, lookupItem );
- aLookupItemArray.append( lookupItem );
- }
- }
-}
-
// ---------------------------------------------------------
// LocationDataLookupDb::getEntries()
// ---------------------------------------------------------
void LocationDataLookupDb::getEntries( QList<QLookupItem>& aLookupItemArray, const quint32 aCollectionId )
{
- if( mDb )
+ if( mDbOpen )
{
QSqlQuery query(*mDb);
if( aCollectionId == ESourceLandmarksContactsCat )
@@ -460,6 +490,9 @@
}
}
+// ---------------------------------------------------------
+// LocationDataLookupDb::getEntfillLookupEntryries()
+// ---------------------------------------------------------
void LocationDataLookupDb::fillLookupEntry( QSqlQuery &aQuery, QLookupItem &aLookupItem )
{
QSqlRecord rec = aQuery.record();
@@ -482,4 +515,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 16:23:56 2010 +0100
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro Thu Jul 22 16:31:43 2010 +0100
@@ -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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/conf/maptilecalpublisher.qcrml Thu Jul 22 16:31:43 2010 +0100
@@ -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 Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/maptileservice/inc/maptiledblookuptable.h Thu Jul 22 16:31:43 2010 +0100
@@ -23,65 +23,7 @@
#include <f32file.h> //RFs
#include <d32dbms.h> //RDbNamedDatabase,RDbView
-// maptile database column names
-_LIT( NCntColUid, "cntuid" );
-_LIT( NAppColFilePath, "filepath" );
-_LIT( NColSource, "source" );
-
-// maptile lookup database name
-_LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
-
-// maptile database table name
-_LIT( KMapTileLookupTable, "cntmaptilelookuptable" );
-
-_LIT( KLookupDbPath, "c:\\mylocations\\" );
-
-// uid column number
-const TInt KColumnUid = 1;
-// source type column number
-const TInt KColumnSource = 2;
-// source type column number
-const TInt KColumnFilePath = 3;
-
-
-/**
- * Maptile database lookup entry
- */
-class TLookupItem
-{
-public:
- // Uid of the source entry
- TUint32 iUid;
-
- // Source type
- TUint32 iSource;
-
- // Landmark uid in the landmarks database
- TUint32 iLmId;
-
- // Uid of the Application
- TUint32 iAppUid;
-
- // File Path
- TFileName iFilePath;
-};
-
-/**
- * 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,
-
-};
-
+#include "mylocationsdefines.h"
/**
* CLookupMapTileDatabase class.
* This class handles all the operations related to maptile lookup database.
@@ -115,6 +57,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 16:23:56 2010 +0100
+++ b/locationdataharvester/maptileservice/inc/maptileservice.h Thu Jul 22 16:31:43 2010 +0100
@@ -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,91 @@
/** 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
+ * @param orientation Application current orientation.
*
- * @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, Qt::Orientations orientation = Qt::Vertical );
+
+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 16:23:56 2010 +0100
+++ b/locationdataharvester/maptileservice/maptileservice.pro Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -17,6 +17,7 @@
*/
#include <bautils.h>
+#include <maptileservice.h>
#include "maptiledblookuptable.h"
// select all from
@@ -32,6 +33,8 @@
_LIT( KStringAnd, " AND " );
+_LIT(KQueryByMaptileState,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND ( fetchingstatus = %d OR fetchingstatus = %d )");
+
// -----------------------------------------------------------------------------
// CLookupMapTileDatabase::CLookupMapTileDatabase()
// Default constructor.
@@ -106,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()
@@ -157,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 16:23:56 2010 +0100
+++ b/locationdataharvester/maptileservice/src/maptileservice.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -18,24 +18,73 @@
#include <centralrepository.h>
+#include <locationservicedefines.h>
+#include <qvaluespacepublisher.h>
+#include <qvaluespacesubscriber.h>
+#include <qfile.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;
@@ -75,55 +124,271 @@
// 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, Qt::Orientations orientation )
{
+ __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 )
+ {
+
+ maptileStatus = lookupItem.iFetchingStatus;
+ MYLOCLOGSTRING1("getMapTileImage maptileStatus - %d ", maptileStatus );
+
+ if( maptileStatus == MapTileFetchingCompleted )
+ {
+ //Get the image path
+ QString imageFile((QChar*)lookupItem.iFilePath.Ptr(),
+ lookupItem.iFilePath.Length());
+ imagePath = imageFile;
+
+ if( orientation == Qt::Vertical )
+ {
+ imagePath.append( MAPTILE_IMAGE_PORTRAIT );
+ }
+ else
+ {
+ if( sourceType == AddressPlain )
+ {
+ imagePath.append( MAPTILE_IMAGE_CALENDAR );
+ }
+ else if ( sourceType == AddressHome ||
+ sourceType == AddressPreference || sourceType == AddressWork )
+ {
+ imagePath.append( MAPTILE_IMAGE_CONTACT );
+ }
+ imagePath.append( MAPTILE_IMAGE_LANDSCAPE );
+ }
+
+ //Check if file exist
+ if( !QFile::exists( imagePath ) )
+ {
+ imagePath.clear();
+ maptileStatus = MapTileFetchingUnknownError;
+ }
+ }
+ else 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 16:23:56 2010 +0100
+++ /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 16:23:56 2010 +0100
+++ /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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsdatabasemanager/inc/mylocationsdatabasemanager.h Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,249 @@
+/*
+* 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: Database manager implementation
+*
+*/
+
+#ifndef __MYLOCATIONSDATABASEMANAGER_H__
+#define __MYLOCATIONSDATABASEMANAGER_H__
+
+
+#include <EPos_CPosLandmark.h>
+
+#include <locationservicedefines.h>
+// lookup database
+#include <locationdatalookupdb.h>
+
+
+class CPosLandmarkDatabase;
+class CPosLmCategoryManager;
+
+
+/**
+ * CMyLocationsDatabaseManager class.
+ * This class handles all the operations related to mylocations landmark database.
+ *
+ */
+class CMyLocationsDatabaseManager : public CBase
+ {
+ public:
+
+ // Constructors and destructor
+
+ /**
+ * CMyLocationsDatabaseManager.
+ * C++ default constructor.
+ */
+ IMPORT_C CMyLocationsDatabaseManager();
+
+ /**
+ * ConstructL.
+ * 2nd phase constructor.
+ */
+ IMPORT_C void ConstructL();
+
+ /**
+ * ~CMyLocationsDatabaseManager.
+ * Virtual Destructor.
+ */
+ virtual ~CMyLocationsDatabaseManager();
+
+ public:
+ /**
+ * UpdateDatabaseL.
+ * Updates the location into the landmark database and lookup table.
+ * Based on the entry source type and the entry change type the updation can be
+ * addition/modification/deletion.
+ *
+ * @param[in] aLandmark Landmark object to be updated in the database.
+ * @param[in] aUid Uid of the changed source entry.
+ * @param[in] aSourceType Source type of the aUid.
+ * @param[in] aChangeType Type of change to the entry ( added/modified/deleted )
+ */
+ IMPORT_C void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid,
+ const TUint32 aSourceType, const TUint32 aChangeType );
+
+ /** Gets the full address from a given landmark object
+ *
+ * @param[out] aLandmarkAddress comma separated landmark's full address
+ * @param[in] aLandmark landmark object whose address needs to be found.
+ */
+ IMPORT_C void GetLandmarkFullAddress( TBuf<255>& aLandmarkAddress,
+ const CPosLandmark* aLandmark );
+
+ /** Update the maptile path to mylocation lookup table
+ *
+ * @param[in] aSourceId Uid of the changed source entry.
+ * @param[in] aSourceType Source type of the aSourceId.
+ * @param[in] aFilePath Maptile file path.
+ */
+ IMPORT_C void UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
+ 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:
+#else
+private:
+#endif
+
+ /**
+ * AddMylocationsCategory.
+ * Adds the category to landmarks database.
+ * Used to add location picker specific categories.
+ * @param[in] aCategoryName defines the category name to be added.
+ * @returns The category id.
+ */
+ TUint32 AddMylocationsCategoryL( const TDesC& aCategoryName );
+
+ /**
+ * CheckIfDuplicateExistsL.
+ * Checks if this landmark is already present in database.
+ * If present returns the landmark id, else 0.
+ * @param[in] aLandmark A landmark object to be checked for.
+ * @returns If no duplicate is found in database returns 0
+ * else returns the id of the found landmark.
+ */
+ TPosLmItemId CheckIfDuplicateExistsL( const CPosLandmark* aLandmark );
+
+ /**
+ * CompareLandmarks.
+ * Compares two landmarks. Only the text fields, landmark name,
+ * street, city, state country and postal code are compared.
+ * @param[in] aLandmark1 First landmark object to be compared.
+ * @param[in] aLandmark2 Second landmark object to be compared.
+ * @returns ETrue if the landmarks are same, else returns EFalse.
+ */
+ TBool CompareLandmarks( const CPosLandmark* alandmark1,
+ const CPosLandmark* alandmark2 );
+
+ /**
+ * HandleEntryAdditionL.
+ * Handles the entry addition in lookup table and landmarks db
+ * @param[in] aLandmark Landmark object added.
+ * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+ * @param[in] aSourceType source type of the aUid passed.
+ */
+ void HandleEntryAdditionL( CPosLandmark* aLandmark, const TUint32 aUid,
+ const TUint32 aSourceType );
+
+ /**
+ * HandleEntryModificationL.
+ * Handles the entry modification in lookup table and landmarks db
+ * @param[in] aLandmark Landmark object modified.
+ * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+ * @param[in] aSourceType source type of the aUid passed.
+ */
+ void HandleEntryModificationL( CPosLandmark* aLandmark, const TUint32 aUid,
+ const TUint32 aSourceType );
+
+ /**
+ * HandleEntryDeletionL.
+ * Handles the entry deletion in lookup table and landmarks db
+ * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+ * @param[in] aSourceType source type of the aUid passed.
+ */
+ void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
+
+ /**
+ * HandleLandmarkModificationL.
+ * Handles a landmark modification
+ * @param[in] aLandmark Landmark object modified.
+ * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+ */
+ void HandleLandmarkModificationL( CPosLandmark* aLandmark, const TUint32 aUid );
+ /**
+ * CheckAndReadLandmarkL.
+ * Checks whether a category is available in database pointed by category manager.
+ * @param[in] CPosLandmarkDatabase handle to the database manager
+ * @param[in] aLmId Id of the landmark
+ * @returns landmark object if found else NULL
+ */
+ CPosLandmark* CheckAndReadLandmarkL(
+ CPosLandmarkDatabase* aDb, const TUint32 aLmId );
+ /**
+ * FillLookupItemAddressDetails.
+ * Fills address details into QLookupItem from CPosLandmark.
+ * @param[in] aLandmark a landmark object
+ * @param[out] aLookupItem, a lookup item in which the address details are filled
+ */
+ void FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem &aLookupItem );
+
+ /**
+ * UnsetDuplicateNextCalEntry.
+ * Finds a calendar lookup entry whose detination id is aLandmarkId
+ * and unsets it duplcate flag.
+ * @param[in] aLandmarkId a landmark id.
+ */
+ void UnsetDuplicateNextCalEntry( quint32 aLandmarkId );
+
+ /**
+ * IsDuplicateCalEntry.
+ * Checks if there is a duplicate entry present whose destination id
+ * is aLandmarkId
+ * @param[in] aLandmarkId a landmark id.
+ */
+ bool IsDuplicateEntry( quint32 aLandmarkId );
+
+ /**
+ * CreateLandmarkItemLC.
+ * Creates a landmark from a QLookupItem
+ * @param[in] aLookupItem a lookup item.
+ * @returns CPosLandmark a newly created landmark.
+ */
+ CPosLandmark* CreateLandmarkItemLC( const QLookupItem &aLookupItem );
+
+#ifdef LOCATION_DATA_HARVESTER_UNIT_TEST
+public:
+#else
+private:
+#endif
+ // Handle to the landmark database
+ CPosLandmarkDatabase* iLandmarkDb;
+
+ // Calendar category to be created for calendar related location entries in landmark database
+ TPosLmItemId iLmCalendarCatId;
+ // Contacts category to be created for contacts related location entries in landmark database
+ TPosLmItemId iLmContactsCatId;
+
+ // handle to the location app lookup database.
+ LocationDataLookupDb* iLocationAppLookupDb;
+
+ // handle to landmarks category manager
+ CPosLmCategoryManager* iLandmarksCatManager;
+
+ // handle to the file session
+ RFs iFsSession;
+ };
+#endif // __MYLOCATIONSDATABASEMANAGER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsdatabasemanager/mylocationsdatabasemanager.pro Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,70 @@
+#
+# 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 = lib
+TARGET = mylocationsdatabasemanager
+
+CONFIG += dll
+CONFIG += Qt
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../inc
+INCLUDEPATH += ../mylocationlogger/inc
+
+
+defines += EPOCALLOWDLLDATA
+
+symbian: {
+
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.CAPABILITY = All -Tcb
+ TARGET.UID3 = 0x2002FF5C
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+ LIBS += -llbs \
+ -leposlandmarks \
+ -leposlmsearchlib \
+ -leuser \
+ -leposlmdbmanlib \
+ -lcntmodel \
+ -lefsrv \
+ -lflogger \
+ -ledbms \
+ -lbafl \
+ -lcalinterimapi \
+ -llocationdatalookupdb
+
+}
+
+SOURCES += src/mylocationsdatabasemanager.cpp
+
+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
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsdatabasemanager/src/mylocationsdatabasemanager.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,1137 @@
+/*
+* 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: Database manager implementation
+*
+*/
+
+#include <EPos_CPosLandmarkCategory.h>
+#include <EPos_CPosLmTextCriteria.h>
+#include <EPos_CPosLandmarkSearch.h>
+#include <EPos_CPosLmDatabaseManager.h>
+#include <EPos_CPosLmNearestCriteria.h>
+#include <EPos_CPosLandmarkDatabase.h>
+#include <EPos_CPosLmCategoryManager.h>
+
+#include <lbsposition.h>
+#include <barsread.h>
+#include <barsc.h>
+#include <locationservicedefines.h>
+#include "mylocationsdatabasemanager.h"
+#include "mylocationlogger.h"
+#include "mylocationsdefines.h"
+
+#include <locationdatalookupdb.h>
+#include <QString>
+// separator
+_LIT( KSeparator, ",");
+// space
+_LIT( KSpace, " ");
+
+// QString separator
+const QString KQStringSeparator = ",";
+// QString space
+const QString KQStringSpace = " ";
+
+// Used to set nearest landmarks search distance criteria
+const TUint32 KSearchCriteriaDistance = 100;
+
+// Maximum string length of landmark address.
+const TUint32 KMaxAddressLength = 255;
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::ConstructL()
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMyLocationsDatabaseManager::ConstructL()
+{
+ __TRACE_CALLSTACK;//Open and intialize Landmark DB
+ iLandmarkDb = CPosLandmarkDatabase::OpenL();
+ ExecuteAndDeleteLD(iLandmarkDb->InitializeL());
+
+ iLocationAppLookupDb = new LocationDataLookupDb();
+ if( !iLocationAppLookupDb->open() )
+ {
+ User::Leave( KErrUnknown );
+ }
+
+ // Create category manager for landmarks
+ iLandmarksCatManager = CPosLmCategoryManager::NewL(*iLandmarkDb);
+
+ // open file session
+ User::LeaveIfError(iFsSession.Connect());
+
+ // Add contacts and calendar categories
+ iLmContactsCatId = AddMylocationsCategoryL(KContactsCategory);
+ iLmCalendarCatId = AddMylocationsCategoryL( KCalendarCategory );
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CMyLocationsDatabaseManager()
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMyLocationsDatabaseManager::CMyLocationsDatabaseManager() : iLandmarkDb( NULL ),
+ iLmContactsCatId( 0 ), //iLandmarksLookupDb( NULL ),
+ iLocationAppLookupDb( NULL ),
+ iLandmarksCatManager( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::_CMyLocationsDatabaseManager()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsDatabaseManager::~CMyLocationsDatabaseManager()
+{
+ __TRACE_CALLSTACK;// delete member variables.
+
+ if (iLocationAppLookupDb)
+ {
+ iLocationAppLookupDb->close();
+ delete iLocationAppLookupDb;
+ }
+
+ delete iLandmarksCatManager;
+
+ delete iLandmarkDb;
+
+ // close the file session
+ iFsSession.Close();
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::AddMylocationsCategoryL()
+// Adds the category to the mylocations and landmarks database..
+// -----------------------------------------------------------------------------
+//
+TUint32 CMyLocationsDatabaseManager::AddMylocationsCategoryL( const TDesC& aCategoryName )
+{
+ __TRACE_CALLSTACK;//Open the resource file
+
+ TPosLmItemId catId = 0;
+
+ //create category
+ CPosLandmarkCategory *category = CPosLandmarkCategory::NewL();
+ CleanupStack::PushL(category);
+ category->SetCategoryNameL( aCategoryName );
+
+ // Add category to landmarks database
+ TRAPD ( error, ( catId = iLandmarksCatManager->AddCategoryL( *category ) ) );
+ if (error == KErrNone || error == KErrAlreadyExists)
+ {
+ catId = iLandmarksCatManager->GetCategoryL( aCategoryName );
+ }
+
+ CleanupStack::PopAndDestroy(category);
+
+ return catId;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::UpdateDatabaseL()
+// Updates the location into the landmark database and lookup table. Based on
+// the entry source type and the entry change type the updation can be
+// addition/modification/deletion.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMyLocationsDatabaseManager::UpdateDatabaseL(CPosLandmark* aLandmark,
+ const TUint32 aUid, const TUint32 aSourceType, const TUint32 aChangeType)
+{
+ __TRACE_CALLSTACK;//open the lookup database
+ switch (aChangeType)
+ {
+ // if the entry is added
+ case EEntryAdded:
+ {
+ // Handle this entry in the lookup table and update landmarks db.
+ HandleEntryAdditionL(aLandmark, aUid, aSourceType);
+ break;
+ }
+ // if the entry is modified
+ case EEntryModified:
+ {
+ // Handle this entry in the lookup table and update landmarks db.
+ HandleEntryModificationL(aLandmark, aUid, aSourceType);
+ break;
+ }
+ // if the entry is deleted
+ case EEntryDeleted:
+ {
+ // Handle this entry in the lookup table and update landmarks db.
+ HandleEntryDeletionL(aUid, aSourceType);
+ break;
+ }
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CheckIfDuplicateExistsL()
+// Checks if this landmark is already present in database. If present returns the landmark id, else 0
+// -----------------------------------------------------------------------------
+//
+TPosLmItemId CMyLocationsDatabaseManager::CheckIfDuplicateExistsL(
+ const CPosLandmark* aLandmark)
+{
+ __TRACE_CALLSTACK;// Stores the found duplicate landmark's id.
+ TPosLmItemId retId = 0;
+
+ // Initially filter only the landmarks which are nearer to the current landmark.
+ // Then we can make a duplicate check on each of the found landmarks.
+
+ // create a search object.
+ CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(
+ *iLandmarkDb);
+ CleanupStack::PushL(search);
+
+ TBuf<KMaxAddressLength> lmAddress1;
+ GetLandmarkFullAddress( lmAddress1, aLandmark );
+ QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
+
+ // create nearest search criteria object
+ TLocality position( TCoordinate( 0, 0), 0 );
+ aLandmark->GetPosition( position );
+ CPosLmNearestCriteria* nearestCriteria =
+ CPosLmNearestCriteria::NewLC(
+ TCoordinate( position.Latitude(), position.Longitude() ) );
+ nearestCriteria->SetMaxDistance( KSearchCriteriaDistance );
+
+ // Start the search and execute it at once.
+ ExecuteAndDeleteLD( search->StartLandmarkSearchL( *nearestCriteria ) );
+ CleanupStack::PopAndDestroy( nearestCriteria );
+
+ // Retrieve an iterator to access the matching landmarks.
+ CPosLmItemIterator* iter = search->MatchIteratorL();
+ CleanupStack::PushL(iter);
+
+ // Iterate the search matches.
+ TPosLmItemId lmId;
+
+ while( ( lmId = iter->NextL() ) != KPosLmNullItemId )
+ {
+ CPosLandmark* lm = iLandmarkDb->ReadLandmarkLC( lmId );
+ TBuf<KMaxAddressLength> lmAddress2;
+ GetLandmarkFullAddress( lmAddress2, lm );
+ QString str2 = QString( (QChar*)lmAddress2.Ptr(), lmAddress2.Length());
+ CleanupStack::PopAndDestroy( lm );
+
+ if( str1 == str2 )
+ {
+ retId = lmId;
+ break;
+ }
+ }
+
+ CleanupStack::PopAndDestroy(iter);
+ CleanupStack::PopAndDestroy(search);
+
+ return retId;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CompareLandmarks()
+// Compares two landmarks. Only the text fields, landmark name, street, city, state country and
+// postal code are compared.
+// -----------------------------------------------------------------------------
+//
+TBool CMyLocationsDatabaseManager::CompareLandmarks(
+ const CPosLandmark* aLandmark1, const CPosLandmark* aLandmark2 )
+{
+ __TRACE_CALLSTACK;
+
+ TBuf<KMaxAddressLength> lmAddress1;
+ GetLandmarkFullAddress( lmAddress1, aLandmark1 );
+ QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
+
+ TBuf<KMaxAddressLength> lmAddress2;
+ GetLandmarkFullAddress( lmAddress2, aLandmark2 );
+ QString str2 = QString( (QChar*)lmAddress2.Ptr(), lmAddress2.Length());
+
+ if( str1 == str2 )
+ return ETrue;
+ else
+ return EFalse;
+
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryAdditionL()
+// Handles the entry addition in lookup table and landmarks db
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryAdditionL(CPosLandmark* aLandmark,
+ const TUint32 aUid, const TUint32 aSourceType)
+{
+ __TRACE_CALLSTACK;
+ // Create a lookup item
+ QLookupItem lookupItem;
+ lookupItem.mSourceUid = aUid;
+ lookupItem.mSourceType = aSourceType;
+ lookupItem.mDestId = 0;
+ lookupItem.mIconType = QLookupItem::EIconTypeDefault;
+ 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 );
+
+ if ( aSourceType == ESourceLandmarks )
+ {
+ // Logic: check if the entry is already present in lookupdb.
+ // If present, it means the landmark corresponds to a contact/calendar. So ignore it.
+ // If not present, it means the landmark is created directly into the landmarks db. So add
+ // it in lookupdb as well.
+
+ // check if the entry is already present in lookup db.
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( aUid, itemArray );
+ if( itemArray.count() )
+ {
+ return;
+ }
+ else
+ {
+ lookupItem.mDestId = aUid;
+ iLocationAppLookupDb->createEntry( lookupItem );
+ return;
+ }
+ }
+
+ TPosLmItemId catId;
+ if( aSourceType == ESourceCalendar )
+ {
+ // category id to calendar
+ catId = iLmCalendarCatId;
+ }
+ else
+ {
+ // remove landmark name, which is basically contact's name.
+ aLandmark->SetLandmarkNameL( KNullDesC );
+ // category id to contacts
+ catId = iLmContactsCatId;
+ }
+ // check if this landmark is already present in database
+ TPosLmItemId dupLmId = CheckIfDuplicateExistsL( aLandmark );
+ if ( dupLmId )
+ {
+ // landmark already present in db. get the details
+ CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(dupLmId);
+ if( dupLandmark )
+ {
+ // add category.
+ dupLandmark->AddCategoryL( catId );
+ // update the landmark object in the db
+ iLandmarkDb->UpdateLandmarkL( *dupLandmark );
+ CleanupStack::PopAndDestroy( dupLandmark );
+ }
+
+ // point the lookup item's landmark uid to the existing landmark.
+ lookupItem.mDestId = dupLmId;
+ if( aSourceType == ESourceCalendar )
+ {
+ // set duplicate flag to true. only if it is calendar entry.
+ // for contacts duplicate doesnot hold good as the location name is the contact name.
+
+ // set duplicate only if there are calendar entries already pointing to this landmark.
+ if( IsDuplicateEntry( dupLmId ) )
+ {
+ lookupItem.mIsDuplicate = 1;
+ }
+ }
+ }
+ else // it is a new entry, so add into the database
+ {
+ // add category.
+ aLandmark->AddCategoryL( catId );
+ // add the landmark into the db.
+ // point the lookup item's landmark uid to the newly created landmark in the db.
+ lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *aLandmark );
+ }
+
+ // create the entry in the lookup table.
+ iLocationAppLookupDb->createEntry( lookupItem );
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryModificationL()
+// Handles the entry modification in the lookup table and landmarks db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryModificationL(
+ CPosLandmark* aLandmark, const TUint32 aUid, const TUint32 aSourceType )
+{
+ __TRACE_CALLSTACK;
+ if ( aSourceType == ESourceLandmarks )
+ {
+ HandleLandmarkModificationL( aLandmark, aUid );
+ return;
+ }
+
+ QLookupItem lookupItem;
+ 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.
+ // If this entry is already present in lookup table, check if the location info is modified or not.
+ // If the location info is modified, delete the landmark from db and add the new landmark
+ // into the db.
+ // Before deletion make sure that the landmark is not being refered by other lookup entries.
+
+ // find the entry in the lookup table.
+ if ( iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem ) )
+ {
+ //fill address into lookup item.
+ FillLookupItemAddressDetails( aLandmark, lookupItem );
+
+ QString locationName = lookupItem.mName;
+
+ TPosLmItemId catId;
+
+ if( aSourceType == ESourceCalendar )
+ {
+ catId = iLmCalendarCatId;
+ }
+ else
+ {
+ // remove landmark name, which is basically contact's name.
+ aLandmark->SetLandmarkNameL( KNullDesC );
+
+ // category id to contacts
+ catId = iLmContactsCatId;
+ }
+
+
+ // check if the location info is modified by comparing the new landmark with the existing landmark
+ CPosLandmark* existingLandmark = NULL;
+ TRAPD( error, ( existingLandmark =
+ CheckAndReadLandmarkL( iLandmarkDb, lookupItem.mDestId ) ) );
+ CleanupStack::PushL( existingLandmark );
+ if ( error == KErrNotFound )
+ {
+ // Landmarks item deleted. So delete corresponding lookup entries.
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
+ for ( int i = 0; i < itemArray.count(); i++)
+ {
+ iLocationAppLookupDb->deleteEntryBySourceIdAndType( itemArray[i] );
+ }
+
+ // Add the entry into the lookup table and update landmarks db.
+ HandleEntryAdditionL( aLandmark, aUid, aSourceType );
+
+ CleanupStack::PopAndDestroy( existingLandmark );
+ return;
+ }
+
+ if ( !CompareLandmarks( existingLandmark, aLandmark ) )
+ {
+ // landmarks are not same, means location information is modified.
+
+ // Check if the new landmark is already in db.
+ TPosLmItemId dupLmId = CheckIfDuplicateExistsL( aLandmark );
+ if ( dupLmId )
+ {
+ // landmark already present in db. get the details
+ CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC( dupLmId );
+ if ( dupLandmark )
+ {
+ // add category.
+ dupLandmark->AddCategoryL( catId );
+
+ // update the landmark object in the db
+ iLandmarkDb->UpdateLandmarkL( *dupLandmark );
+ }
+ CleanupStack::PopAndDestroy( dupLandmark );
+
+ // update the lookup item to refer to the newly created landmark.
+ lookupItem.mDestId = dupLmId;
+ if( aSourceType == ESourceCalendar )
+ {
+ // for contacts duplicate doesnot hold good as the location name is the contact name.
+ if( !lookupItem.mIsDuplicate )
+ {
+ // if current lookup item duplicate property is 0, then remove next corresponding
+ // calendar lookup entry duplicate property.
+ // this is required because the current entry will be pointing to a new landmark.
+ UnsetDuplicateNextCalEntry( existingLandmark->LandmarkId() );
+ }
+
+ // set duplicate only if there are calendar entries already pointing to this landmark.
+ if( IsDuplicateEntry( dupLmId ) )
+ {
+ lookupItem.mIsDuplicate = 1;
+ }
+
+ }
+
+ iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
+ }
+ else
+ {
+ // landmark not already present in db.
+ // Create a new entry in the db
+ aLandmark->AddCategoryL( catId );
+ lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *aLandmark );
+ if( aSourceType == ESourceCalendar )
+ {
+ // for contacts duplicate doesnot hold good as the location name is the contact name.
+ if( !lookupItem.mIsDuplicate )
+ {
+ // if current lookup item duplicate property is 0, then remove next corresponding
+ // calendar lookup entry duplicate property.
+ // this is required because the current entry will be pointing to a new landmark.
+ UnsetDuplicateNextCalEntry( existingLandmark->LandmarkId() );
+ }
+ }
+
+ lookupItem.mIsDuplicate = 0;
+ // update the lookup table
+ iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
+ }
+ }
+ else
+ {
+ // landmarks are same, means location not modified. So return.
+ if( aSourceType == ESourceContactsPref
+ || aSourceType == ESourceContactsWork
+ || aSourceType == ESourceContactsHome
+ )
+ {
+ // in case of contacts, there is a chance that contact name is modified.
+ // so update the lookup database entry with that name.
+ lookupItem.mName = locationName;
+ iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
+ }
+
+ CleanupStack::PopAndDestroy( existingLandmark );
+ return;
+ }
+
+ // delete the existing landmark only if it not being refered by other lookup entries.
+
+ // Check if any other entries are refering this landmark.
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId(
+ existingLandmark->LandmarkId(), itemArray );
+
+ if ( itemArray.count() )
+ {
+ // There are other lookup entries refering this landmark. So do not delete the landmark
+
+ // If none of these lookup item's source type is current source type, disassociate 'catId' category
+ // from this landmark.
+ TInt i = 0;
+ while ( i < itemArray.count() )
+ {
+ if( aSourceType == ESourceCalendar )
+ {
+ if ( itemArray[i].mSourceType == aSourceType )
+ {
+ // a lookup item exists which is from calendar, so 'catId' is still valid.
+ break;
+ }
+ }
+ else
+ {
+ // a lookup item exists which is from contacts, so 'catId' is still valid.
+ break;
+ }
+ i++;
+ }
+ if ( i == itemArray.count() )
+ {
+ // no lookup items from current source type exists refering this landmark.
+ // so disassociate 'catId' from this landmark
+
+ existingLandmark->RemoveCategory( catId );
+ iLandmarkDb->UpdateLandmarkL( *existingLandmark );
+ }
+ }
+ else
+ {
+ // no other lookup entry is refering this landmark.
+ // delete the landmark.
+ iLandmarkDb->RemoveLandmarkL( existingLandmark->LandmarkId() );
+ }
+ CleanupStack::PopAndDestroy( existingLandmark );
+
+ }
+ else // entry not present in lookup table
+ {
+ // Add the entry into the lookup table and update landmarks db.
+ HandleEntryAdditionL( aLandmark, aUid, aSourceType );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryDeletionL()
+// Handles the entry deletion in lookup table and landmarks db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryDeletionL(const TUint32 aUid,
+ const TUint32 aSourceType)
+{
+ __TRACE_CALLSTACK;
+ QLookupItem lookupItem;
+ lookupItem.mSourceUid = aUid;
+ lookupItem.mSourceType = aSourceType;
+
+ // Behavior: if an entry is deleted, delete the corresponding entries from
+ // both lookup table and iLandmarkDb.
+ // Before deleting the entry from iLandmarkDb, make sure that this entry is not being refered by
+ // other entries of the lookup table. If it is being refered by other entries in lookup table, then
+ // do not delete the landmark.
+
+ if ( !iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem ) )
+ {
+ if( aSourceType == ESourceLandmarks )
+ {
+ lookupItem.mDestId = aUid;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ // Find the corresponding landmark uid
+
+
+ // delete the lookup entry.
+ iLocationAppLookupDb->deleteEntryBySourceIdAndType( lookupItem );
+
+ // Check if any other entries are refering this landmark.
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
+
+ if ( itemArray.count() )
+ {
+
+ if( aSourceType == ESourceLandmarks )
+ {
+ CPosLandmark* lm = NULL;
+
+ for( int i = 0; i < itemArray.count(); i++ )
+ {
+ if( itemArray[i].mSourceType == ESourceCalendar )
+ {
+ // add landmark entry since a calendar item is present with this location.
+ if( !lm )
+ {
+ lm = CreateLandmarkItemLC( itemArray[i] );
+ }
+ lm->AddCategoryL( iLmCalendarCatId );
+ }
+ else
+ {
+ // add landmark entry since a contact item is present with this location.
+ if( !lm )
+ {
+ QString tempStr = itemArray[i].mName;
+ itemArray[i].mName = "";
+ lm = CreateLandmarkItemLC( itemArray[i] );
+ itemArray[i].mName = tempStr;
+ }
+ lm->AddCategoryL( iLmCalendarCatId );
+ }
+ }
+
+ lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *lm );
+ CleanupStack::PopAndDestroy( lm );
+
+ bool dupUnset = false;
+ for( int i=0; i<itemArray.count(); i++ )
+ {
+ itemArray[i].mDestId = lookupItem.mDestId;
+ if( itemArray[i].mSourceType == ESourceCalendar && dupUnset == false )
+ {
+ dupUnset = true;
+ itemArray[i].mIsDuplicate = 0;
+ }
+ iLocationAppLookupDb->updateEntryById( itemArray[i] );
+ }
+
+ return;
+ }
+
+ // There are other lookup entries refering this landmark. So do not delete the landmark
+
+ // If none of these lookup item's source type is current source type, disassociate current source category
+ // from this landmark.
+ TInt i = 0;
+ while ( i < itemArray.count() )
+ {
+ if( aSourceType == ESourceCalendar )
+ {
+ if( itemArray[i].mSourceType == aSourceType )
+ {
+ if( lookupItem.mIsDuplicate == 0 )
+ {
+ itemArray[i].mIsDuplicate = 0;
+ iLocationAppLookupDb->updateEntryById( itemArray[i] );
+ }
+ // a lookup item exists which is from calendar, so 'iLmCalendarCatId' is still valid.
+ break;
+ }
+
+ }
+ else if ( itemArray[i].mSourceType == ESourceContactsPref
+ || itemArray[i].mSourceType == ESourceContactsWork
+ || itemArray[i].mSourceType == ESourceContactsHome)
+ {
+ // a lookup item exists which is from contacts, so 'iLmContactsCatId' is still valid.
+ break;
+ }
+ i++;
+ }
+ if ( i == itemArray.count() )
+ {
+ // no lookup items from current source type exists refering this landmark.
+ // so disassociate current source category from this landmark
+
+ CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC( lookupItem.mDestId );
+ if( aSourceType == ESourceCalendar )
+ {
+ landmark->RemoveCategory( iLmCalendarCatId );
+ }
+ else
+ {
+ landmark->RemoveCategory( iLmContactsCatId );
+ }
+
+ iLandmarkDb->UpdateLandmarkL( *landmark );
+ CleanupStack::PopAndDestroy( landmark );
+ }
+ }
+ else
+ {
+ // no other lookup entry is refering this landmark.
+ // delete the landmark.
+ if ( aSourceType != ESourceLandmarks )
+ {
+ iLandmarkDb->RemoveLandmarkL( lookupItem.mDestId );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleLandmarkModificationL()
+// -----------------------------------------------------------------------------
+//
+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,
+ // if exists, create a new landmark entry with that location details and update all those
+ // lookup entry's destid with the newly created landmark id.
+
+ QLookupItem lookupItem;
+ lookupItem.mSourceUid = aUid;
+ lookupItem.mSourceType = ESourceLandmarks;
+ lookupItem.mIconType = QLookupItem::EIconTypeDefault;
+
+ bool found = iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem );
+ //fill address into lookup item.
+ FillLookupItemAddressDetails( aLandmark, lookupItem );
+ lookupItem.mDestId = aUid;
+ lookupItem.mIsDuplicate = 0;
+ lookupItem.mIconType = QLookupItem::EIconTypeDefault;
+ lookupItem.mIconPath = "";
+ lookupItem.mMapTilePath = "";
+
+ // update entry in lookup table.
+ if ( found )
+ {
+ iLocationAppLookupDb->updateEntryById( lookupItem );
+ }
+ else
+ {
+ iLocationAppLookupDb->createEntry( lookupItem );
+ }
+
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
+
+ if( itemArray.count() == 1 )
+ {
+ //only one entry ie the entry corresponding to landmark db is present.
+ return;
+ }
+
+ CPosLandmark* lm = NULL;
+
+ for( int i = 0; i < itemArray.count(); i++ )
+ {
+ if( itemArray[i].mSourceType != ESourceLandmarks )
+ {
+ if( itemArray[i].mSourceType == ESourceCalendar )
+ {
+ // add landmark entry since a calendar item is present with this location.
+ if( !lm )
+ {
+ lm = CreateLandmarkItemLC( itemArray[i] );
+ }
+ lm->AddCategoryL( iLmCalendarCatId );
+ }
+ else
+ {
+ // add landmark entry since a calendar item is present with this location.
+ if( !lm )
+ {
+ QString tempStr = itemArray[i].mName;
+ itemArray[i].mName = "";
+ lm = CreateLandmarkItemLC( itemArray[i] );
+ itemArray[i].mName = tempStr;
+ }
+ lm->AddCategoryL( iLmCalendarCatId );
+ }
+ }
+ }
+
+ // add the entry to landmarks db
+ quint32 newDestId = iLandmarkDb->AddLandmarkL( *lm );
+ CleanupStack::PopAndDestroy( lm );
+
+ bool calDuplicateUnset = false;
+ // update all the lookup entries with new landmark id
+ for( int i = 0; i < itemArray.count(); i++ )
+ {
+ if( itemArray[i].mSourceType != ESourceLandmarks )
+ {
+ itemArray[i].mDestId = newDestId;
+
+ if( itemArray[i].mSourceType == ESourceCalendar )
+ {
+ if( !calDuplicateUnset )
+ {
+ itemArray[i].mIsDuplicate = 0;
+ calDuplicateUnset = true;
+ }
+ else
+ {
+ itemArray[i].mIsDuplicate = 1;
+ }
+ }
+ iLocationAppLookupDb->updateEntryById( itemArray[i] );
+ }
+ }
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::GetLandmarkFullAddress()
+// Gets the comma separated full address of the given landmark.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMyLocationsDatabaseManager::GetLandmarkFullAddress(
+ TBuf<KMaxAddressLength>& aLandmarkAddress,
+ const CPosLandmark* aLandmark)
+{
+ __TRACE_CALLSTACK;
+ TPtrC tempStr;
+ TInt retStatus;
+ TBool addressEmtpy = ETrue;
+ retStatus = aLandmark->GetPositionField(EPositionFieldStreet, tempStr);
+ if (retStatus == KErrNone && tempStr.Length())
+ {
+ {
+ aLandmarkAddress.Copy(tempStr);
+ addressEmtpy = EFalse;
+ }
+ }
+
+ retStatus = aLandmark->GetPositionField(EPositionFieldCity, tempStr);
+ if (retStatus == KErrNone && tempStr.Length())
+ {
+ if (!addressEmtpy)
+ {
+ aLandmarkAddress.Append(KSeparator);
+ aLandmarkAddress.Append(KSpace);
+ aLandmarkAddress.Append(tempStr);
+ }
+ else
+ {
+ aLandmarkAddress.Copy(tempStr);
+ addressEmtpy = EFalse;
+ }
+ }
+
+ retStatus = aLandmark->GetPositionField(EPositionFieldState, tempStr);
+ if (retStatus == KErrNone && tempStr.Length())
+ {
+ if (!addressEmtpy)
+ {
+ aLandmarkAddress.Append(KSeparator);
+ aLandmarkAddress.Append(KSpace);
+ aLandmarkAddress.Append(tempStr);
+ }
+ else
+ {
+ aLandmarkAddress.Copy(tempStr);
+ addressEmtpy = EFalse;
+ }
+ }
+
+ retStatus = aLandmark->GetPositionField(EPositionFieldCountry, tempStr);
+ if (retStatus == KErrNone && tempStr.Length())
+ {
+ if (!addressEmtpy)
+ {
+ aLandmarkAddress.Append(KSeparator);
+ aLandmarkAddress.Append(KSpace);
+ aLandmarkAddress.Append(tempStr);
+ }
+ else
+ {
+ aLandmarkAddress.Copy(tempStr);
+ addressEmtpy = EFalse;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CheckAndReadLandmarkL()
+// Checks if given landmark id is found in the database and returns the read landmark.
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL(
+ CPosLandmarkDatabase* aDb, const TUint32 aLmId)
+{
+ __TRACE_CALLSTACK;
+ CPosLandmark* lm = aDb->ReadLandmarkLC(aLmId);
+ CleanupStack::Pop(lm);
+ return lm;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::FillLookupItemAddressDetails()
+// Creates a new category in Mylocations Db and adds a corresponding entry in
+// mylocations lookup table.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem& aLookupItem )
+{
+ __TRACE_CALLSTACK;// Read the category.
+
+ // fill geo-coordinates
+ TLocality position;
+ aLandmark->GetPosition( position );
+ aLookupItem.mLatitude = position.Latitude();
+ aLookupItem.mLongitude = position.Longitude();
+
+ TPtrC tempStr;
+ TInt retStatus;
+
+ // Copy landmark name in address 1
+ retStatus = aLandmark->GetLandmarkName( tempStr );
+ aLookupItem.mName = "";
+ if( retStatus == KErrNone && tempStr.Length() > 0 )
+ {
+ aLookupItem.mName = QString( (QChar*)tempStr.Ptr(), tempStr.Length() );
+ }
+
+ // get street
+ aLookupItem.mStreet = "";
+ retStatus = aLandmark->GetPositionField( EPositionFieldStreet, tempStr );
+ if( retStatus == KErrNone && tempStr.Length() )
+ {
+ aLookupItem.mStreet = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+ }
+
+ // get postal code
+ aLookupItem.mPostalCode = "";
+ retStatus = aLandmark->GetPositionField( EPositionFieldPostalCode, tempStr );
+ if( retStatus == KErrNone && tempStr.Length() )
+ {
+ aLookupItem.mPostalCode = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+ }
+
+ // get city
+ aLookupItem.mCity = "";
+ retStatus = aLandmark->GetPositionField( EPositionFieldCity, tempStr );
+ if( retStatus == KErrNone && tempStr.Length() )
+ {
+ aLookupItem.mCity = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+ }
+
+ // get State
+ aLookupItem.mState = "";
+ retStatus = aLandmark->GetPositionField( EPositionFieldState, tempStr );
+ if( retStatus == KErrNone && tempStr.Length() )
+ {
+ aLookupItem.mState = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+ }
+
+ // get country
+ aLookupItem.mCountry = "";
+ retStatus = aLandmark->GetPositionField( EPositionFieldCountry, tempStr );
+ if( retStatus == KErrNone && tempStr.Length() )
+ {
+ aLookupItem.mCountry = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId )
+{
+ __TRACE_CALLSTACK;
+ // get next duplicate item
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
+ for ( int i = 0; i < itemArray.count(); i++)
+ {
+ if( itemArray[i].mSourceType == ESourceCalendar )
+ {
+ itemArray[i].mIsDuplicate = 0;
+ iLocationAppLookupDb->updateEntryById( itemArray[i] );
+ break;
+ }
+ }
+
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::IsDuplicateEntry()
+// -----------------------------------------------------------------------------
+//
+bool CMyLocationsDatabaseManager::IsDuplicateEntry( quint32 aLandmarkId )
+{
+ __TRACE_CALLSTACK;
+ // get next duplicate item
+ QList<QLookupItem> itemArray;
+ iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
+ for ( int i = 0; i < itemArray.count(); i++)
+ {
+ if( itemArray[i].mSourceType == ESourceCalendar ||
+ itemArray[i].mSourceType == ESourceLandmarks )
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CreateLandmarkItemLC()
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMyLocationsDatabaseManager::CreateLandmarkItemLC( const QLookupItem &aLookupItem )
+{
+ __TRACE_CALLSTACK;//return value
+ CPosLandmark *landmark = NULL;
+ TLocality loc( TCoordinate( aLookupItem.mLatitude, aLookupItem.mLongitude ), 0 );
+
+ landmark = CPosLandmark::NewL();
+ CleanupStack::PushL( landmark );
+
+ // Fill the location details into the landmark object
+ landmark->SetPositionL( loc );
+
+ // Set the landmark name as contact name
+ TBuf<KBufSize> text( aLookupItem.mName.utf16() );
+ TRAP_IGNORE( landmark->SetLandmarkNameL( text ) );
+
+ text.Copy( aLookupItem.mStreet.utf16() );
+ landmark->SetPositionFieldL( EPositionFieldStreet, text );
+
+ // Set the City
+ text.Copy( aLookupItem.mCity.utf16() );
+ landmark->SetPositionFieldL( EPositionFieldCity, text );
+
+ // Set the state/region
+ text.Copy( aLookupItem.mState.utf16() );
+ landmark->SetPositionFieldL( EPositionFieldState, text );
+
+ // Set the Postal code
+ text.Copy( aLookupItem.mPostalCode.utf16() );
+ landmark->SetPositionFieldL( EPositionFieldPostalCode, text );
+
+ // Set the country
+ text.Copy( aLookupItem.mCountry.utf16() );
+ landmark->SetPositionFieldL( EPositionFieldCountry, text );
+
+ return landmark;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::UpdateMapTilePath()
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMyLocationsDatabaseManager::UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/conf/maptilestatuspublisher.qcrml Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<repository target="RProperty" version="" uidName="repo" uidValue="0x2002680A">
+<key ref="/maptilestatuspublisher/name" int="0x1"/>
+</repository>
\ No newline at end of file
--- a/locationdataharvester/mylocationsengine/inc/addresscomparision.h Fri Jun 11 16:23:56 2010 +0100
+++ /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 <EPos_CPosLandmarkDatabase.h>
-#include "mylocationslookupdb.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;
-
- // Handle to the My locations database manager
- CLookupDatabase *iLookUpDatabase;
- };
-#endif /* ADDRESSCOMPARISION_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/calendarsubscriber.h Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/inc/calendernotification.h Thu Jul 22 16:31:43 2010 +0100
@@ -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 Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h Thu Jul 22 16:31:43 2010 +0100
@@ -52,7 +52,7 @@
~CLookupMapTileDatabase();
public:
-
+
/**
* Opens the lookup database.
*/
@@ -79,7 +79,13 @@
* Deletes an entry from the lookup table.
* @param[in] aLookupItem The lookup item to be deleted from the database.
*/
- void DeleteEntryL( const TLookupItem& aLookupItem );
+ void DeleteEntryL( TLookupItem& aLookupItem );
+
+ /**
+ * Deletes maptile from the repository if the ref to that maptile in the db reaches one
+ * @param[in] aLookupItem The lookup item containing the path to the maptile
+ */
+ void DeleteMapTileL( const TLookupItem& aLookupItem );
/**
* Finds an entry in the lookup table.
@@ -88,9 +94,23 @@
* @return ETrue if found, else EFalse
*/
TBool FindEntryL( TLookupItem& aLookupItem);
-
+
+ /**
+ * Finds an entry in the lookup table for the given maptile name.
+ * @param[in] aFilePath The lookup item to be found in the database. maptile file path is passed
+ * @return ETrue if found, else EFalse
+ */
+ TBool FindEntryByFilePathL(const TDesC& aFilePath);
+ void FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState,
+ RArray<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 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/inc/maptileinterface.h Thu Jul 22 16:31:43 2010 +0100
@@ -43,13 +43,16 @@
*/
virtual void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath ) = 0;
- /** Informs once geocoding completed
- *
- * @param[in] aLatitude converted latitude value
- * @param[in] aLongitude converted longitude value
- *
- */
- virtual void RestGeoCodeCompleted( TReal aLatitude,TReal aLongitude ) = 0;
+ /** Informs once geo coordinates retrived from the REST server
+ *
+ * @param[in] aErrCode Error code
+ * @param[in] aMapTilePath Path where the maptile image staroed
+ *
+ */
+ virtual void GeoCodefetchingCompleted( TInt aErrCode, const TReal& aLatitude,
+ const TReal& aLongitude, const TDesC& aMapTilePath ) = 0;
+
+
};
@@ -70,23 +73,24 @@
static CMapTileInterface* NewL();
/**
- * Interface for requesting maptile image for a landmark object
+ * Interface for requesting GEO fields a landmark object containing address
*
* @param[in] aLandmark Landmark containing address details
* @param[in] aFilePath Path where the maptile image to be stored
* @param[in] aObserver Observer for callback notification
+ *
*/
- void GetMapTileImageL( CPosLandmark* aLandmark ,
- const TDesC& aFilePath, MMapTileObserver* aObserver );
+ void GetGeoCodeFromAddressL( CPosLandmark* aLandmark ,
+ const TDesC& aFilePath, MMapTileObserver* aObserver );
/**
- * Interface for requesting maptile image for a landmark object
+ * Interface for requesting GEO fields for the address
*
* @param[in] aAddressDetails containing address details
* @param[in] aFilePath Path where the maptile image to be stored
* @param[in] aObserver Observer for callback notification
*/
- void GetMapTileImageL(const TDesC& aAddressDetails,
+ void GetGeoCodeFromAddressL(const TDesC& aAddressDetails,
const TDesC& aFilePath, MMapTileObserver* aObserver);
/**
@@ -105,16 +109,23 @@
* Destructor
*/
~CMapTileInterface();
-
-private:
-
+
/**
- * Function for Retrieving latitude & longitude information
- *
- * @param[in] aLatitude latitude value
- * @param[in] aLongitude Longitude value
+ * Function for Retrieving maptile
*/
- void GetMapTileL( TReal aLatitude, TReal aLongitude );
+ 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
+ * image saving file path to MaptileFolder\RowCol.png
+ */
+ void UpdateFilePathL( const TReal& aLatitude, const TReal& aLongitude );
/**
* Interface for requesting for a landmark object.
@@ -122,7 +133,11 @@
*/
void SetLandMarkDetailsL(MAddressInfo& aAddressInfo);
-protected:
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
+protected:
+#endif
/**
* Derived from MMaptileGeocoderObserver
@@ -134,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;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/mylocationgeotagtimerao.h Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 3AM geo tagger handler
+*
+*/
+
+#ifndef __MYLOCATIONGEOTAGTIMERAO_H__
+#define __MYLOCATIONGEOTAGTIMERAO_H__
+
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+/*
+ * MyLocationTimerObserver class
+ * observer class to notify the mylocation engine about the 3AM timer expiry.
+ */
+class MyLocationTimerObserver
+{
+public:
+ virtual void MyLocationThreeAMTimerExpiredL() = 0;
+};
+
+/*
+ * CLocationGeoTagTimerAO class
+ * Class to handle 3AM timer expiry.
+ */
+class CLocationGeoTagTimerAO : public CTimer
+{
+
+public:
+ /**
+ * 1st phase constructor.
+ * @param aObserver, 3AM timer observer
+ */
+ static CLocationGeoTagTimerAO* NewL(
+ MyLocationTimerObserver& aObserver );
+
+ /**
+ * Destructor
+ */
+ ~CLocationGeoTagTimerAO();
+
+ /**
+ * Start 3AM timer
+ */
+ void StartTimer();
+
+
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
+protected:
+#endif
+ /*
+ * @see CActive::RunL()
+ */
+ void RunL();
+
+ /**
+ * 2nd Phase constructor
+ */
+ void ConstructL();
+
+ /**
+ * CLocationGeoTagTimerAO
+ * Constructor
+ * @param aObserver, 3AM timer observer
+ */
+ CLocationGeoTagTimerAO( MyLocationTimerObserver& aObserver );
+
+private:
+ MyLocationTimerObserver* iTimerObserver;
+};
+
+
+#endif /*__MYLOCATIONGEOTAGTIMERAO_H__*/
+
+// End of file
--- a/locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,239 +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: Database manager implementation for location picker and
-* maptile service.
-*
-*/
-
-#ifndef __MYLOCATIONSDATABASEMANAGER_H__
-#define __MYLOCATIONSDATABASEMANAGER_H__
-
-// Landmarks
-#include<EPos_CPosLandmarkDatabase.h>
-#include <EPos_CPosLmCategoryManager.h>
-
-#include <locationservicedefines.h>
-
-// lookup database
-#include <locationdatalookupdb.h>
-
-// mylocations lookup db
-#include "mylocationslookupdb.h"
-
-// Maximum string length of landmark address.
-const TUint32 KMaxAddressLength = 255;
-
-/** Defines entry change type
-*/
-enum TEntryChangeType
- {
- /** Entry added */
- EEntryAdded,
- /** Entry modified */
- EEntryModified,
- /** Entry deleted */
- EEntryDeleted,
- /** Entry change unknown */
- EEntryUnknown
- };
-
-
-/**
- * CMyLocationsDatabaseManager class.
- * This class handles all the operations related to mylocations landmark database.
- *
- */
-class CMyLocationsDatabaseManager : public CBase
- {
- public:
- // Constructors and destructor
-
- /**
- * ConstructL.
- * 2nd phase constructor.
- */
- void ConstructL();
-
- /**
- * CMyLocationsDatabaseManager.
- * C++ default constructor.
- */
- CMyLocationsDatabaseManager();
-
- /**
- * ~CMyLocationsDatabaseManager.
- * Virtual Destructor.
- */
- virtual ~CMyLocationsDatabaseManager();
-
- public:
- /**
- * UpdateDatabaseL.
- * Updates the location into the landmark database and lookup table.
- * Based on the entry source type and the entry change type the updation can be
- * addition/modification/deletion.
- *
- * @param[in] aLandmark Landmark object to be updated in the database.
- * @param[in] aUid Uid of the changed source entry.
- * @param[in] aSourceType Source type of the aUid.
- * @param[in] aChangeType Type of change to the entry ( added/modified/deleted )
- */
- void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid,
- const TUint32 aSourceType, const TEntryChangeType aChangeType );
-
- /** Gets the full address from a given landmark object
- *
- * @param[out] aLandmarkAddress comma separated landmark's full address
- * @param[in] aLandmark landmark object whose address needs to be found.
- */
- void GetLandmarkFullAddress( TBuf<KMaxAddressLength>& aLandmarkAddress,
- const CPosLandmark* aLandmark );
-
- /** Update the maptile path to mylocation lookup table
- *
- * @param[in] aSourceId Uid of the changed source entry.
- * @param[in] aSourceType Source type of the aSourceId.
- * @param[in] aFilePath Maptile file path.
- */
- void UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
- TFileName aFilePath );
- private:
-
- /**
- * AddMylocationsCategory.
- * Adds the category to landmarks database.
- * Used to add location picker specific categories.
- * @param[in] aCategoryName defines the category name to be added.
- * @returns The category id.
- */
- TUint32 AddMylocationsCategoryL( const TDesC& aCategoryName );
-
- /**
- * CheckIfDuplicateExistsL.
- * Checks if this landmark is already present in database.
- * If present returns the landmark id, else 0.
- * @param[in] aLandmark A landmark object to be checked for.
- * @returns If no duplicate is found in database returns 0
- * else returns the id of the found landmark.
- */
- TPosLmItemId CheckIfDuplicateExistsL( const CPosLandmark* aLandmark );
-
- /**
- * CompareLandmarks.
- * Compares two landmarks. Only the text fields, landmark name,
- * street, city, state country and postal code are compared.
- * @param[in] aLandmark1 First landmark object to be compared.
- * @param[in] aLandmark2 Second landmark object to be compared.
- * @returns ETrue if the landmarks are same, else returns EFalse.
- */
- TBool CompareLandmarks( const CPosLandmark* alandmark1,
- const CPosLandmark* alandmark2 );
-
- /**
- * HandleEntryAdditionL.
- * Handles the entry addition in lookup table and landmarks db
- * @param[in] aLandmark Landmark object added.
- * @param[in] aUid Uid of the source entry corresponding to aLandmark..
- * @param[in] aSourceType source type of the aUid passed.
- */
- void HandleEntryAdditionL( CPosLandmark* aLandmark, const TUint32 aUid,
- const TUint32 aSourceType );
-
- /**
- * HandleEntryModificationL.
- * Handles the entry modification in lookup table and landmarks db
- * @param[in] aLandmark Landmark object modified.
- * @param[in] aUid Uid of the source entry corresponding to aLandmark..
- * @param[in] aSourceType source type of the aUid passed.
- */
- void HandleEntryModificationL( CPosLandmark* aLandmark, const TUint32 aUid,
- const TUint32 aSourceType );
-
- /**
- * HandleEntryDeletionL.
- * Handles the entry deletion in lookup table and landmarks db
- * @param[in] aUid Uid of the source entry corresponding to aLandmark..
- * @param[in] aSourceType source type of the aUid passed.
- */
- void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
-
- /**
- * HandleLandmarkModificationL.
- * Handles a landmark modification
- * @param[in] aLandmark Landmark object modified.
- * @param[in] aUid Uid of the source entry corresponding to aLandmark..
- */
- void HandleLandmarkModificationL( CPosLandmark* aLandmark, const TUint32 aUid );
- /**
- * CheckAndReadLandmarkL.
- * Checks whether a category is available in database pointed by category manager.
- * @param[in] CPosLandmarkDatabase handle to the database manager
- * @param[in] aLmId Id of the landmark
- * @returns landmark object if found else NULL
- */
- CPosLandmark* CheckAndReadLandmarkL(
- CPosLandmarkDatabase* aDb, const TUint32 aLmId );
- /**
- * FillLookupItemAddressDetails.
- * Fills address details into QLookupItem from CPosLandmark.
- * @param[in] aLandmark a landmark object
- * @param[out] aLookupItem, a lookup item in which the address details are filled
- */
- void FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem &aLookupItem );
-
- /**
- * UnsetDuplicateNextCalEntry.
- * Finds a calendar lookup entry whose detination id is aLandmarkId
- * and unsets it duplcate flag.
- * @param[in] aLandmarkId a landmark id.
- */
- void UnsetDuplicateNextCalEntry( quint32 aLandmarkId );
-
- /**
- * IsDuplicateCalEntry.
- * Checks if there is a duplicate entry present whose destination id
- * is aLandmarkId
- * @param[in] aLandmarkId a landmark id.
- */
- bool IsDuplicateEntry( quint32 aLandmarkId );
-
- /**
- * CreateLandmarkItemLC.
- * Creates a landmark from a QLookupItem
- * @param[in] aLookupItem a lookup item.
- * @returns CPosLandmark a newly created landmark.
- */
- CPosLandmark* CreateLandmarkItemLC( const QLookupItem &aLookupItem );
-
- private:
- // Handle to the landmark database
- CPosLandmarkDatabase* iLandmarkDb;
-
- // Calendar category to be created for calendar related location entries in landmark database
- TPosLmItemId iLmCalendarCatId;
- // Contacts category to be created for contacts related location entries in landmark database
- TPosLmItemId iLmContactsCatId;
- // handle to landmarks lookup database.
- CLookupDatabase* iLandmarksLookupDb;
-
- // handle to the location app lookup database.
- LocationDataLookupDb* iLocationAppLookupDb;
-
- // handle to landmarks category manager
- CPosLmCategoryManager* iLandmarksCatManager;
-
- // handle to the file session
- RFs iFsSession;
- };
-#endif // __MYLOCATIONSDATABASEMANAGER_H__
--- a/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h Thu Jul 22 16:31:43 2010 +0100
@@ -20,7 +20,6 @@
#define __MYLOCATIONSENGINE_H__
// INCLUDES
-
// calendar related headers
#include <calsession.h>
#include <calentryview.h>
@@ -28,6 +27,10 @@
// Header for contact DB
#include <cntdb.h>
+//Qt contacts mobility apis
+#include <qtcontacts.h>
+#include <qcontactmanager.h>
+
// Header for landmarks db
#include<EPos_CPosLandmarkDatabase.h>
@@ -35,8 +38,12 @@
#include "maptileinterface.h"
#include "mylocationsdatabasemanager.h"
#include "lookupmaptiledb.h"
-#include "addresscomparision.h"
#include "calendernotification.h"
+#include "mylocationgeotagtimerao.h"
+class GeocodeUpdate;
+class CContactSubscriber;
+class CCalendarSubscriber;
+using namespace QTM_NAMESPACE;
/**
* This class contains the required data for maptile image processing.
@@ -55,7 +62,7 @@
CPosLandmark* iLandmarkInfo;
//single row address.
HBufC* iAddressDetails;
- //Contact id
+ //entry id
TInt32 iUId;
//Address type
TInt32 iAddressType;
@@ -65,6 +72,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
@@ -74,7 +93,8 @@
* This process starts on phone bootup and always runs in the background.
*/
class CMyLocationsEngine : public CActive, public MCalChangeCallBack2,
- public MContactDbObserver, public MMapTileObserver,public MNotifyChange
+ public MContactDbObserver, public MMapTileObserver,public MNotifyChange,
+ public MyLocationTimerObserver
{
@@ -130,8 +150,11 @@
*/
TEntryChangeType MapChangeType( TUidSourceType aSrcType, TUint32 aChangeType );
-
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
/**
* ConstructL.
@@ -146,30 +169,11 @@
CMyLocationsEngine();
/** Creates a landmark object from contact item's location details and checks whether address available.
- * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
+ * @param[in] aContactAddress A contact address whose location details needs to be used to create landmark object.
+ * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
*/
- CPosLandmark* GetContactAddressDetailsLC( const CContactItem *aContactItem,
- TContactAddressType aAddressType );
+ CPosLandmark* GetContactAddressDetailsLC( QContactAddress& aContactAddress );
- /** Creates a landmark object from contact item's location details
- * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
- */
- CPosLandmark* GetContactLocationDetailsLC( const CContactItem *aContactItem,
- TContactAddressType aAddressType );
-
- /** Finds the contact's field type id
- * @param[in] aContactItem A contact item whose field details needs to found.
- * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
- * @param[in] aField The field type of interest.
- * @return If found, the index of the field within the field set, or KErrNotFound if not found.
- */
- TInt FindContactsField( const CContactItem *aContactItem, TContactAddressType aAddressType,
- TUid aField );
-
/**
* A call back function for calendar change notification
* @param aChangeItems List of changes since the last notification.
@@ -189,18 +193,13 @@
void TriggerMaptileRequestL( TContactDbObserverEvent& aEvent );
/**
- * Process the contact database event and updates the landmark database
- * @param aEvent Provides information about the change event.
- */
- void HandlelandmarkDatabaseL( TContactDbObserverEvent& aEvent );
- /**
* Process the maptile database event and updates the maptile database
* @param aEventType Provides information about the type of request address.
* @param aLookupItem Provides information about single address of contact.
*/
- void HandleMaptileDatabaseL(TInt aEventType ,
+ void UpdateMaptileDatabaseL(TInt aEventType ,
TLookupItem& aLookupItem );
-
+
/**
* Handles active object's request completion event.
*/
@@ -211,6 +210,7 @@
*/
void DoCancel();
+
/**
* Requests for map tile image , structure serch.
* @param aLandmark Provides information about the address.
@@ -218,7 +218,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.
@@ -227,7 +227,18 @@
* @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.
+ * @param aContact Provides all the required information about the contact.
+ * @param aAddressType Provides information about address type .
+ * @param aLatitude, Latitude information.
+ * @param aLongitude, Longitude information.
+ * @return If geocoordinate available returns TRUE otherwise FALSE
+ */
+ TBool IsGeoCoordinateAvailable( QContact& aContact,
+ QString aAddressType, double& aLatitude , double& aLongitude );
/**
* Add to maptile request queue.
@@ -246,12 +257,41 @@
void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);
/**
+ * Calender entry modifyied.
+ */
+ void CalenderEntryModifyL(TCalChangeEntry aCalChangeEntry);
+ /**
* Update the mylocations database.
*/
void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid,
const TUint32 aSourceType, const TEntryChangeType aChangeType );
-
-
+
+ /**
+ * Informs the geocode completion
+ */
+ void UpdateGeoCodeToAppDataBase( TReal latitude,TReal longitude );
+
+ /**
+ * Process the pending maptile requests
+ */
+ void ProcessNextMaptileRequest();
+
+ /**
+ * maptile database manipulation.
+ */
+ void ManipulateMapTileDataBaseL(TLookupItem& aLookupItem);
+
+ /**
+ * Crop and create multiple maptile images for different applications requirements.
+ */
+ void CreateMultipleMaptiles( const TDesC& aMaptilePath );
+
+ /**
+ * Crop the maptile image and save the different files.
+ */
+ void CropAndSaveImage( QString filePath, int width,
+ int height, QString appType, QString orientationType );
+
public: //From MMapTileObserver
/**
@@ -259,15 +299,28 @@
*/
void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath );
- /**
- * Informs the geocode completion
+ /**
+ * Informs the geo codes fetching completion
*/
- void RestGeoCodeCompleted( TReal latitude,TReal longitude);
-
+ 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
+ /**
+ * Notifies the timer expiry when 3AM timer was started to notify.
+ */
+ void MyLocationThreeAMTimerExpiredL();
+
+#ifdef MYLOCATIONENGINE_UNIT_TEST
+public:
+#else
private:
+#endif
// Data member
@@ -301,20 +354,42 @@
//Current event type
TInt iEventType;
- //Address comparison pointer
- CAddressComparision *iAddressCompare;
-
//Maptile image request queue
RArray<CMapTileRequest*> iMapTileRequestQueue;
+ // 3am Timer
+ CLocationGeoTagTimerAO *iMyLocationThreeAMTimer;
+
//Flag to check maptilegeocoder plugin availability
TBool iMaptileGeocoderPluginAvailable;
//Maptile image path
TFileName imageFilePath;
+
//Object to listen calender db create notification.
CCalenderNotification *iCalenderNotification;
+ //Contact manager instance for retrieving contact info.
+ QContactManager* iContactManager;
+
+ //Subscribe from contact
+ CContactSubscriber *iContactSubscriber;
+
+ //Subscribe from calendar
+ CCalendarSubscriber *iCalendarSubscriber;
+
+ //Geo-code class instance
+ GeocodeUpdate *iGeocodeUpdate;
+
+ //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/inc/mylocationslookupdb.h Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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: Header file for mylocation database lookup table.
-*
-*/
-
-#ifndef __MYLOCATIONSLOOKUPDB_H__
-#define __MYLOCATIONSLOOKUPDB_H__
-
-//Headers needed
-#include <f32file.h> //RFs
-#include <d32dbms.h> //RDbNamedDatabase,RDbView
-
-#include "mylocationsdefines.h"
-#include "locationservicedefines.h"
-
-/**
- * CLookupDatabase class.
- * This class handles all the operations related to mylocations lookup database.
- *
- */
-
-class CLookupDatabase : public CBase
-{
-public:
- // Two phase constructors
-
- /**
- * This is a static function, which creates and returns an instance of this class.
- */
- static CLookupDatabase* NewL( const TDesC& aLookupTableName );
-
- /**
- * This is a static function, which creates and returns an instance of this class. Pushes the created object
- * to the cleanup stack.
- */
- static CLookupDatabase* NewLC( const TDesC& aLookupTableName );
-
- /**
- * Destructor
- */
- ~CLookupDatabase();
-
-public:
-
- /**
- * Opens the lookup database.
- */
- TInt Open();
-
- /**
- * Closes the lookup database.
- */
- void Close();
-
- /**
- * Creates an entry in the lookup table.
- * @param[in] aLookupItem The lookup item to be created in the database.
- */
- void CreateEntryL( const TLookupItem& aLookupItem );
-
- /**
- * Updates an entry in the lookup table.
- * @param[in] aLookupItem The lookup item to be updated in the database.
- */
- void UpdateEntryL( const TLookupItem& aLookupItem );
-
- /**
- * Deletes an entry from the lookup table.
- * @param[in] aLookupItem The lookup item to be deleted from the database.
- */
- void DeleteEntryL( const TLookupItem& aLookupItem );
-
- /**
- * Finds an entry in the lookup table.
- * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid and source type
- * iSource is passed in the lookup item, if the entry is found, then the iLmId is copied to the lookup item
- * @return ETrue if found, else EFalse
- */
- TBool FindEntryL( TLookupItem& aLookupItem );
-
- /**
- * Finds list of lookup items given a landmark id.
- * @param[in] aLandmarkId The landmark id to be found in the lookup database.
- * @param[out] aLookupItemArray List of lookup entried found.
- */
- void FindEntriesByLandmarkIdL( const TUint32 aLandmarkId,
- RArray<TLookupItem>& aLookupItemArray );
-
- /**
- * Finds list of lookup items given a source type.
- * @param[in] aSourceType The source type to be found in the lookup database.
- * @param[out] aLookupItemArray List of lookup entried found.
- */
- void FindEntriesBySourceTypeL( const TUint32 aSourceType,
- RArray<TLookupItem>& aLookupItemArray );
-
-
-
-private:
-
- // default constructor
- CLookupDatabase();
-
- // Second phase constructor
- void ConstructL( const TDesC& aLookupTableName );
-
- // Creates a lookup table in the lookup database.
- void CreateTableL(RDbDatabase& aDatabase);
-
-private:
-
- // Handle to the items database
- RDbNamedDatabase iItemsDatabase;
-
- // handle to the file session
- RFs iFsSession;
-
- // holds the database file name
- TFileName iDbFileName;
-
-};
-
-
-#endif // __MYLOCATIONSLOOKUP_H__
-
-// End of file
-
--- a/locationdataharvester/mylocationsengine/mylocationsengine.pro Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/mylocationsengine.pro Thu Jul 22 16:31:43 2010 +0100
@@ -1,37 +1,27 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
TEMPLATE=app
TARGET=mylocationsengine
-CONFIG += Qt
+CONFIG += Qt mobility
+MOBILITY = publishsubscribe
DEPENDPATH += .
INCLUDEPATH += .
INCLUDEPATH += ../inc
INCLUDEPATH += ../../inc
INCLUDEPATH += ../geocodeupdate/inc
INCLUDEPATH += ../mylocationlogger/inc
+INCLUDEPATH += ../mylocationsdatabasemanager/inc
+INCLUDEPATH += /epoc32/include/app
+
symbian: {
TARGET.UID3 = 0x2002680A
- isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x6000
+ isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x8000
isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 20480 \
16943040
TARGET.CAPABILITY = ALL -TCB
-
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
LIBS += -llbs \
-leposlandmarks \
-leposlmsearchlib \
@@ -46,27 +36,33 @@
-lgeocodeupdate \
-lecom \
-lcalinterimapi \
- -llocationdatalookupdb
+ -llocationdatalookupdb \
+ -lmylocationsdatabasemanager
+
+
+ myCrml.sources = ./conf/maptilestatuspublisher.qcrml
+ myCrml.path = c:/resource/qt/crml
+ DEPLOYMENT += myCrml
}
SOURCES += src/appmain.cpp \
src/mylocationsengine.cpp \
- src/mylocationsdatabasemanager.cpp \
- src/mylocationslookupdb.cpp \
src/maptileinterface.cpp \
- src/addresscomparision.cpp \
src/lookupmaptiledb.cpp \
- src/calendernotification.cpp
+ src/calendernotification.cpp \
+ src/mylocationgeotagtimerao.cpp \
+ src/contactsubscriber.cpp \
+ src/calendarsubscriber.cpp
HEADERS += inc/appmain.h \
inc/mylocationsengine.h \
- inc/mylocationslookupdb.h \
- inc/mylocationsdatabasemanager.h \
inc/maptileinterface.h \
- inc/addresscomparision.h \
inc/lookupmaptiledb.h \
- inc/calendernotification.h
+ inc/calendernotification.h \
+ inc/mylocationgeotagtimerao.h \
+ inc/contactsubscriber.h \
+ inc/calendarsubscriber.h
--- a/locationdataharvester/mylocationsengine/src/addresscomparision.cpp Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +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* CAddressComparision::NewL()
-{
- CAddressComparision* self = new (ELeave) CAddressComparision();
- return self;
-}
-
-CAddressComparision::CAddressComparision()
-{
-
-}
-
-// 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;
- CLookupDatabase* lookupdb = NULL;
- lookupdb = CLookupDatabase::NewLC(KMylocationsLookupDatabaseName);
-
- TLookupItem lookupItem;
- lookupItem.iUid = aCntId;
- lookupItem.iSource = aAddressType;
- User::LeaveIfError(lookupdb->Open());
- addressChanged=lookupdb->FindEntryL(lookupItem);
- addressChanged=ETrue;
- lookupdb->Close();
- CleanupStack::PopAndDestroy(lookupdb);
- return addressChanged;//addressChanged;
-}
-
-//end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/calendarsubscriber.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -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
+
--- a/locationdataharvester/mylocationsengine/src/calendernotification.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/src/calendernotification.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -89,10 +89,7 @@
//
CCalenderNotification::~CCalenderNotification()
{
- if (IsActive())
- {
- Cancel();
- }
+ Cancel();
iFsession.Close();
}
// -----------------------------------------------------------------------------
@@ -104,10 +101,6 @@
{
TInt status;
iNotifyChange.NotifyChangeL( status );
- if ( KErrNone == status )
- {
- iFsession.NotifyChangeCancel();
- }
}
// -----------------------------------------------------------------------------
// CMyLocationsEngine::DoCancel()
@@ -116,6 +109,7 @@
//
void CCalenderNotification::DoCancel()
{
+ iFsession.NotifyChangeCancel();
}
//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/contactsubscriber.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -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 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -14,6 +14,8 @@
* Description: Maptile database lookup table source implementation.
*
*/
+#include <QString>
+#include <QFile>
#include <bautils.h>
#include "mylocationlogger.h"
@@ -21,6 +23,14 @@
_LIT( KSelectAllFrom, "SELECT * FROM " );
_LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d");
+_LIT( KSelectfilepathFrom, "SELECT filepath FROM " );
+_LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'");
+// string 'where'
+_LIT( KStringWhere, " WHERE " );
+// string ' = '
+_LIT( KStringEqual, " = " );
+
+_LIT(KQueryByMaptileFetchingState,"SELECT * FROM cntmaptilelookuptable WHERE fetchingstatus = %d");
// -----------------------------------------------------------------------------
// CLookupMapTileDatabase::CLookupMapTileDatabase()
@@ -148,6 +158,11 @@
// add file path type column
columns->AddL(TDbCol(NCntColFilePath, EDbColText16));
+
+ //MK
+ // add map tile fetching status to the db
+ columns->AddL(TDbCol(MapTileFetchingStatus, EDbColUint32));
+
// Create a table
User::LeaveIfError(aDatabase.CreateTable(KMapTileLookupTable, *columns));
@@ -187,6 +202,7 @@
myView.SetColL(KColumncntUid, aLookupItem.iUid);
myView.SetColL(KColumnSource, aLookupItem.iSource);
myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
+ myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK
myView.PutL();
@@ -196,6 +212,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.
// -----------------------------------------------------------------------------
@@ -221,19 +280,20 @@
myView.EvaluateAll();
myView.FirstL();
-
+
if (myView.AtRow())
{
// found the entry. update it.
myView.UpdateL();
myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
+ myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK
myView.PutL();
- }
+ }
CleanupStack::PopAndDestroy(&myView); // myView
iItemsDatabase.Commit();
- Close();
+ Close();
}
@@ -242,7 +302,7 @@
// Deletes an entry from the lookup table.
// -----------------------------------------------------------------------------
//
-void CLookupMapTileDatabase::DeleteEntryL(const TLookupItem& aLookupItem)
+void CLookupMapTileDatabase::DeleteEntryL(TLookupItem& aLookupItem)
{
__TRACE_CALLSTACK;// Create the query to find the row to be deleted.
@@ -274,7 +334,8 @@
myView.GetL();
if (aLookupItem.iUid == myView.ColUint(KColumncntUid))
{
- ret = iFsSession.Delete(myView.ColDes16(KColumnFilePath));
+ aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath));
+
}
myView.DeleteL();
}
@@ -288,6 +349,113 @@
}
// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::DeleteMapTileL()
+// Deletes an maptile if there's no reference to maptile in lookupdb
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::DeleteMapTileL( const TLookupItem& aLookupItem)
+{
+ __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
+
+ TFileName queryBuffer;
+ queryBuffer.Format(KQueryMaptile, &aLookupItem.iFilePath);
+
+ TInt ret = Open();
+ if (ret != KErrNone)
+ {
+ Close();
+ Open();
+ }
+
+ iItemsDatabase.Begin();
+
+ RDbView myView;
+ // query buffer finds only the selected item row.
+ myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+ CleanupClosePushL(myView);
+
+ myView.EvaluateAll();
+
+ // positions the cursor on the first row of the rowset
+ myView.FirstL();
+
+ // Delete if no reference to maptile
+ if (!myView.AtRow())
+ {
+ QString filePath = QString::fromUtf16( aLookupItem.iFilePath.Ptr(), aLookupItem.iFilePath.Length() );
+ //delete all releted maptile
+ QString temp=filePath;
+ temp.append(MAPTILE_IMAGE_PORTRAIT);
+ QFile file;
+ file.remove(temp);
+
+ temp=filePath;
+ temp.append(MAPTILE_IMAGE_CONTACT);
+ temp.append(MAPTILE_IMAGE_LANDSCAPE);
+ file.remove(temp);
+
+ temp=filePath;
+ temp.append(MAPTILE_IMAGE_CALENDAR);
+ temp.append(MAPTILE_IMAGE_LANDSCAPE);
+ file.remove(temp);
+
+ temp=filePath;
+ temp.append(MAPTILE_IMAGE_HURRIGANES);
+ file.remove(temp);
+
+ // ret = iFsSession.Delete(aLookupItem.iFilePath);
+ }
+
+ CleanupStack::PopAndDestroy(&myView); // myView
+
+ Close();
+}
+
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::FindEntriesByMapTileFetchingStatusL()
+// Finds a list of lookup items given a landmark uid.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState,
+ RArray<TLookupItem>& aLookupItemArray)
+{
+ __TRACE_CALLSTACK;// Create a query to find the item.
+ TFileName queryBuffer;
+ queryBuffer.Format(KQueryByMaptileFetchingState,aFetchingState);
+
+ TInt ret = Open();
+ if (ret != KErrNone)
+ {
+ Close();
+ ret= Open();
+
+ }
+ iItemsDatabase.Begin();
+
+
+ // Create a view of the table with the above query.
+ RDbView myView;
+ myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+ CleanupClosePushL(myView);
+ myView.EvaluateAll();
+ myView.FirstL();
+
+ while (myView.AtRow())
+ {
+ // Item found. get the details.
+ myView.GetL();
+ TLookupItem newItem;
+ newItem.iUid = myView.ColUint(KColumnUid);
+ newItem.iSource = myView.ColUint(KColumnSource);
+ aLookupItemArray.Append(newItem);
+ myView.NextL();
+ }
+
+ CleanupStack::PopAndDestroy(&myView); // myView
+}
+
+// -----------------------------------------------------------------------------
// CLookupMapTileDatabase::FindEntryL()
// Finds an entry in the lookup table.
// -----------------------------------------------------------------------------
@@ -320,10 +488,6 @@
{
// Item found. get the details.
myView.GetL();
- if (aLookupItem.iUid == myView.ColUint(KColumncntUid))
- {
- aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath));
- }
retVal = ETrue;
}
@@ -331,5 +495,57 @@
Close();
return retVal;
}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::FindEntryByFIlePathLL()
+// Finds an entry in the lookup table for maptile image file
+// -----------------------------------------------------------------------------
+//
+TBool CLookupMapTileDatabase::FindEntryByFilePathL(const TDesC& aFilePath)
+{
+ __TRACE_CALLSTACK;// used to store return value
+ TBool retVal = EFalse;
+
+ TInt ret = Open();
+ if (ret != KErrNone)
+ {
+ Close();
+ Open();
+
+ }
+
+ iItemsDatabase.Begin();
+
+ // Create a query to find the item.
+ TFileName queryBuffer;
+ _LIT(KFormatSpec, "%S%S%S%S%S'%S'");
+
+ queryBuffer.Format(KFormatSpec,
+ &KSelectfilepathFrom(),
+ &KMapTileLookupTable(),
+ &KStringWhere(),
+ &NCntColFilePath(),
+ &KStringEqual(),
+ &aFilePath);
+
+ // Create a view of the table with the above query.
+ RDbView myView;
+ TInt retPrep = myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+ CleanupClosePushL(myView);
+ myView.EvaluateAll();
+ myView.FirstL();
+
+ if (myView.AtRow())
+ {
+ // Item found, return true
+ retVal = ETrue;
+ }
+
+ CleanupStack::PopAndDestroy(&myView); // myView
+ Close();
+
+ return retVal;
+}
+
// End of file
--- a/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/src/maptileinterface.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -24,12 +24,17 @@
#include <bautils.h>
#include "maptileinterface.h"
#include "mylocationlogger.h"
+#include "mylocationsdefines.h"
+#include "lookupmaptiledb.h"
+#include <math.h>
//Invalid latitude & longitude value
-const TReal KInvalidLatitudeLongitude = 200.00;
-const TInt KStreetLvelZoom = 14;
-const TInt KCityLevelZoom = 7;
-const TInt KMapTileSize= 256;
+const TReal KInvalidLatitudeLongitude = 200.0f;
+const TInt KStreetLvelZoom = 16;
+const TInt KCityLevelZoom = 11;
+const TInt KImagePathSize=36;
+const TInt KMapTileWidthHeight = 256 ;
+_LIT(KFileExtn, ".png");
// -----------------------------------------------------------------------------
// CMapTileInterface::NewL()
@@ -89,11 +94,11 @@
iMaptileGeocoder->SetMaptileGeocoderObserver( *this );
}
// -----------------------------------------------------------------------------
-// CMapTileInterface::GetMapTileImageL()
-// Interface for requesting maptile image for a landmark object
+// CMapTileInterface::GetGeoCodeFromAddressL()
+// Interface for requesting GEO fields for the given address
// -----------------------------------------------------------------------------
//
-void CMapTileInterface::GetMapTileImageL(const TDesC& aAddressDetails,
+void CMapTileInterface::GetGeoCodeFromAddressL(const TDesC& aAddressDetails,
const TDesC& aFilePath, MMapTileObserver* aObserver)
{
__TRACE_CALLSTACK;
@@ -103,15 +108,15 @@
iFilePath = HBufC::NewL(aFilePath.Length());
iFilePath->Des().Copy(aFilePath);
iStreetAvailable = EFalse;
- TConnectionOption conn = ESilent;
- iMaptileGeocoder->GetCoordinateByAddressL(aAddressDetails, conn);
+ iMaptileGeocoder->GetCoordinateByAddressL(aAddressDetails, ESilent);
+
}
// -----------------------------------------------------------------------------
-// CMapTileInterface::GetMapTileImageL()
-// Interface for requesting maptile image for a landmark object
+// CMapTileInterface::GetGeoCodeFromAddressL()
+// Interface for requesting GEO fields for the given landmark adress
// -----------------------------------------------------------------------------
//
-void CMapTileInterface::GetMapTileImageL(CPosLandmark* aLandmark,
+void CMapTileInterface::GetGeoCodeFromAddressL(CPosLandmark* aLandmark,
const TDesC& aFilePath, MMapTileObserver* aObserver)
{
__TRACE_CALLSTACK;
@@ -121,34 +126,34 @@
iFilePath = HBufC::NewL(aFilePath.Length());
iFilePath->Des().Copy(aFilePath);
+ //Reset the street level available flag
+ iStreetAvailable = EFalse;
+
TPtrC getStreet;
aLandmark->GetPositionField(EPositionFieldStreet, getStreet);
if (getStreet.Length() > 0)
- {
+ {
iStreetAvailable = ETrue;
}
- TConnectionOption conn = ESilent;
- iMaptileGeocoder->GetCoordinateByAddressL(*aLandmark, conn);
+ iMaptileGeocoder->GetCoordinateByAddressL(*aLandmark, ESilent);
}
// -----------------------------------------------------------------------------
-// CMapTileInterface::GetMapTileImageL()
+// CMapTileInterface::GetMapTileL()
// Function for Retrieving latitude & longitude information
// -----------------------------------------------------------------------------
//
-void CMapTileInterface::GetMapTileL(TReal aLatitude, TReal aLongitude)
+void CMapTileInterface::GetMapTileL( const TReal& aLatitude, const TReal& aLongitude)
{
__TRACE_CALLSTACK;//Notification to observer , to update contact db,
- iObserver->RestGeoCodeCompleted(aLatitude, aLongitude);
TInt zoom = KCityLevelZoom;
- TInt size = KMapTileSize;
if (iStreetAvailable)
{
zoom = KStreetLvelZoom;
}
iStreetAvailable = EFalse;
- TMapTileParam mapTileparam(aLatitude, aLongitude, zoom, size);
+ TMapTileParam mapTileparam(aLatitude, aLongitude, zoom, MapTileWidth,MapTileHeight );
iMaptileGeocoder->GetMapTileByGeoCodeL( mapTileparam, *iFilePath );
}
@@ -162,7 +167,46 @@
__TRACE_CALLSTACK;
MYLOCLOGSTRING1("MapComplete() status-%d ",aErrCode );
iObserver->MapTilefetchingCompleted( aErrCode, aMapTilePath );
+}
+// ----------------------------------------------------------------------------
+// CMapTileInterface::UpdateFilePathL()
+// Converts the geocoordinate to maptile pixel coordinate and updates the
+// file path to Maptilefolder\RowCol.png
+// ----------------------------------------------------------------------------
+//
+void CMapTileInterface::UpdateFilePathL( const TReal& aLatitude, const TReal& aLongitude )
+{
+ TInt iZoomLvl = KCityLevelZoom;
+ if ( iStreetAvailable )
+ iZoomLvl = KStreetLvelZoom;
+
+ TInt totalTilesHorizontal = 1 << iZoomLvl;
+ TInt totalTilesVertical = 1 << iZoomLvl;
+
+ TInt totalMapWidth = totalTilesHorizontal * KMapTileWidthHeight;
+ TInt totalMapHeight = totalTilesVertical * KMapTileWidthHeight;
+
+ TReal pi = 3.14159265;
+
+ TInt convertedx = (( aLongitude + 180.0) * totalMapWidth)
+ / 360.0;
+ TReal convertedtemp = log(tan(( aLatitude + 90) * pi
+ / 360.0));
+ int convertedy = (1 - convertedtemp / pi) * totalMapHeight / 2.0;
+
+ //Get the image row,col
+ TInt iMapTileImageRow = convertedy / 256.0;
+ TInt iMapTileImageCol = convertedx / 256.0;
+
+ TBuf<KImagePathSize> mImagePath;
+
+ mImagePath.AppendNum(iMapTileImageRow);
+ mImagePath.AppendNum(iMapTileImageCol);
+ mImagePath.Append(KFileExtn);
+
+ iFilePath = iFilePath->ReAllocL(iFilePath->Length() + mImagePath.Length() );
+ iFilePath->Des().Append(mImagePath);
}
// -----------------------------------------------------------------------------
@@ -187,24 +231,22 @@
if ( latitude != KInvalidLatitudeLongitude
&& longitude != KInvalidLatitudeLongitude)
{
- TRAP_IGNORE( SetLandMarkDetailsL(aAddressInfo) );
- TRAPD( error, GetMapTileL(latitude, longitude) );
- if ( error != KErrNone )
- {
- //Log error message
- MYLOCLOGSTRING1("GetMapTileL() status-%d",error);
- iObserver->MapTilefetchingCompleted(error, KNullDesC);
- }
+ TRAP_IGNORE( SetLandMarkDetailsL(aAddressInfo) );
+ TRAP_IGNORE( UpdateFilePathL( latitude, longitude ) );
+
+ iObserver->GeoCodefetchingCompleted(KErrNone, latitude, longitude, iFilePath->Des());
+
}
else
{
- iObserver->MapTilefetchingCompleted(KErrGeneral, KNullDesC);
- }
+ iObserver->GeoCodefetchingCompleted(KErrGeneral,
+ KInvalidLatitudeLongitude, KInvalidLatitudeLongitude, KNullDesC);
+ }
}
else
{
- iObserver->MapTilefetchingCompleted(aErrorcode, KNullDesC);
-
+ iObserver->GeoCodefetchingCompleted(aErrorcode,
+ KInvalidLatitudeLongitude, KInvalidLatitudeLongitude, KNullDesC );
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/mylocationgeotagtimerao.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2009-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: Implements geotagging 3AM timer
+*
+*/
+
+#include "mylocationgeotagtimerao.h"
+#include <mylocationlogger.h>
+#include <aknappui.h>
+#include <aknnotewrappers.h>
+#include <avkon.hrh>
+
+//Time at which the geotagging should be triggered( 3.00 AM )
+const TInt GEOTAGGING_TIME_IN_HOURS = 3;
+//Hour specified in minutes
+const TInt HOUR_VALUE_IN_MINUTES = 60;
+//Hour specified in seconds
+const TInt HOUR_VALUE_IN_SECONDS = 3600;
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::CLocationGeoTagTimerAO
+// --------------------------------------------------------------------------
+//
+CLocationGeoTagTimerAO::CLocationGeoTagTimerAO( MyLocationTimerObserver& aObserver ):
+ CTimer(EPriorityStandard ),
+ iTimerObserver(&aObserver)
+{
+
+}
+
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO
+// --------------------------------------------------------------------------
+//
+CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO()
+{
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), begin");
+ Cancel();
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::~CLocationGeoTagTimerAO(), end");
+}
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::NewL
+// --------------------------------------------------------------------------
+//
+CLocationGeoTagTimerAO* CLocationGeoTagTimerAO::NewL( MyLocationTimerObserver& aObserver )
+{
+ CLocationGeoTagTimerAO* self =
+ new( ELeave ) CLocationGeoTagTimerAO( aObserver);
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::ConstructL
+// --------------------------------------------------------------------------
+//
+void CLocationGeoTagTimerAO::ConstructL()
+{
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::ConstructL(), begin");
+ CActiveScheduler::Add(this);
+ CTimer::ConstructL();
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::ConstructL(), end");
+}
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::StartTimer
+// --------------------------------------------------------------------------
+//
+void CLocationGeoTagTimerAO::StartTimer()
+{
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::StartTimer(), begin");
+ if(!IsActive())
+ {
+ TTime hometime;
+ hometime.HomeTime();
+
+ //Get the current time in Hour,Minute, Second
+ TDateTime currentDateTime = hometime.DateTime();
+ TInt currentHr = currentDateTime.Hour();
+ TInt currentMin = currentDateTime.Minute();
+ TInt currentSec = currentDateTime.Second();
+
+ //3 AM in seconds
+ TInt targetTimeInSeconds = GEOTAGGING_TIME_IN_HOURS * HOUR_VALUE_IN_SECONDS;
+ TInt timeDifference;
+
+ //Find the time difference in seconds between current time to 3.00 AM
+ //Either on same day or next day.
+ if ( currentHr < GEOTAGGING_TIME_IN_HOURS )
+ {
+ timeDifference = targetTimeInSeconds -
+ ( ( currentHr * HOUR_VALUE_IN_SECONDS ) + ( currentMin * HOUR_VALUE_IN_MINUTES ) + currentSec );
+ }
+ else
+ {
+ timeDifference = ( 24 * HOUR_VALUE_IN_SECONDS - (
+ ( currentHr * HOUR_VALUE_IN_SECONDS ) + ( currentMin * HOUR_VALUE_IN_MINUTES ) + currentSec ) ) +
+ targetTimeInSeconds ;
+ }
+
+ //Add the time difference to current time to set the target time ( 3.00 AM )
+ TTimeIntervalSeconds interval( timeDifference );
+ TTime timeToSet;
+ timeToSet.HomeTime();
+ timeToSet+= interval;
+
+ At( timeToSet );
+ }
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::StartTimer(), end");
+}
+
+
+// --------------------------------------------------------------------------
+// CLocationGeoTagTimerAO::RunL
+// --------------------------------------------------------------------------
+//
+void CLocationGeoTagTimerAO::RunL( )
+{
+ MYLOCLOGSTRING ("CLocationGeoTagTimerAO::RunL(), begin");
+ TInt status = iStatus.Int();
+
+ switch( status )
+ {
+ case KErrNone:
+ //Trigger the reverse geocoding and start the timer again
+ //Create the instance of geotagger class
+ iTimerObserver->MyLocationThreeAMTimerExpiredL();
+
+ break;
+ default:
+ StartTimer();
+ break;
+ }
+ MYLOCLOGSTRING ( "CLocationGeoTagTimerAO::RunL(), end" );
+}
+
+// End of file
+
--- a/locationdataharvester/mylocationsengine/src/mylocationsdatabasemanager.cpp Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1090 +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: Database manager implementation for location picker and
-* maptile service.
-*
-*/
-
-#include <EPos_CPosLandmark.h>
-#include <EPos_CPosLandmarkCategory.h>
-#include <EPos_CPosLmTextCriteria.h>
-#include <EPos_CPosLandmarkSearch.h>
-#include <EPos_CPosLmDatabaseManager.h>
-#include <EPos_CPosLmNearestCriteria.h>
-
-#include <lbsposition.h>
-//#include <mylocations.rsg>
-#include <barsread.h>
-#include <barsc.h>
-#include <locationservicedefines.h>
-#include "mylocationsdatabasemanager.h"
-#include "mylocationlogger.h"
-#include "mylocationsdefines.h"
-
-// separator
-_LIT( KSeparator, ",");
-// space
-_LIT( KSpace, " ");
-
-// QString separator
-const QString KQStringSeparator = ",";
-// QString space
-const QString KQStringSpace = " ";
-
-// Used to set nearest landmarks search distance criteria
-const TUint32 KSearchCriteriaDistance = 100;
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::ConstructL()
-// 2nd phase constructor.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::ConstructL()
-{
- __TRACE_CALLSTACK;//Open and intialize Landmark DB
- iLandmarkDb = CPosLandmarkDatabase::OpenL();
- ExecuteAndDeleteLD(iLandmarkDb->InitializeL());
-
- // create landmarks lookup database.
- iLandmarksLookupDb = CLookupDatabase::NewL(KLandmarksLookupDatabaseName);
- User::LeaveIfError( iLandmarksLookupDb->Open() );
-
- iLocationAppLookupDb = new LocationDataLookupDb();
- if( !iLocationAppLookupDb->open() )
- {
- User::Leave( KErrUnknown );
- }
-
- // Create category manager for landmarks
- iLandmarksCatManager = CPosLmCategoryManager::NewL(*iLandmarkDb);
-
- // open file session
- User::LeaveIfError(iFsSession.Connect());
-
- // Add contacts and calendar categories
- iLmContactsCatId = AddMylocationsCategoryL(KContactsCategory);
- iLmCalendarCatId = AddMylocationsCategoryL( KCalendarCategory );
-
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CMyLocationsDatabaseManager()
-// Default constructor.
-// -----------------------------------------------------------------------------
-//
-CMyLocationsDatabaseManager::CMyLocationsDatabaseManager() : iLandmarkDb( NULL ),
- iLmContactsCatId( 0 ), iLandmarksLookupDb( NULL ),
- iLocationAppLookupDb( NULL ),
- iLandmarksCatManager( NULL )
-{
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::_CMyLocationsDatabaseManager()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CMyLocationsDatabaseManager::~CMyLocationsDatabaseManager()
-{
- __TRACE_CALLSTACK;// delete member variables.
- if (iLandmarksLookupDb)
- {
- iLandmarksLookupDb->Close();
- delete iLandmarksLookupDb;
- }
- if (iLocationAppLookupDb)
- {
- iLocationAppLookupDb->close();
- delete iLocationAppLookupDb;
- }
-
- delete iLandmarksCatManager;
-
- delete iLandmarkDb;
-
- // close the file session
- iFsSession.Close();
-
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::AddMylocationsCategoryL()
-// Adds the category to the mylocations and landmarks database..
-// -----------------------------------------------------------------------------
-//
-TUint32 CMyLocationsDatabaseManager::AddMylocationsCategoryL( const TDesC& aCategoryName )
-{
- __TRACE_CALLSTACK;//Open the resource file
-
- TPosLmItemId catId = 0;
-
- //create category
- CPosLandmarkCategory *category = CPosLandmarkCategory::NewL();
- CleanupStack::PushL(category);
- category->SetCategoryNameL( aCategoryName );
-
- // Add category to landmarks database
- TRAPD ( error, ( catId = iLandmarksCatManager->AddCategoryL( *category ) ) );
- if (error == KErrNone || error == KErrAlreadyExists)
- {
- catId = iLandmarksCatManager->GetCategoryL( aCategoryName );
- }
-
- CleanupStack::PopAndDestroy(category);
-
- return catId;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::UpdateDatabaseL()
-// Updates the location into the landmark database and lookup table. Based on
-// the entry source type and the entry change type the updation can be
-// addition/modification/deletion.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::UpdateDatabaseL(CPosLandmark* aLandmark,
- const TUint32 aUid, const TUint32 aSourceType, const TEntryChangeType aChangeType)
-{
- __TRACE_CALLSTACK;//open the lookup database
- switch (aChangeType)
- {
- // if the entry is added
- case EEntryAdded:
- {
- // Handle this entry in the lookup table and update landmarks db.
- HandleEntryAdditionL(aLandmark, aUid, aSourceType);
- break;
- }
- // if the entry is modified
- case EEntryModified:
- {
- // Handle this entry in the lookup table and update landmarks db.
- HandleEntryModificationL(aLandmark, aUid, aSourceType);
- break;
- }
- // if the entry is deleted
- case EEntryDeleted:
- {
- // Handle this entry in the lookup table and update landmarks db.
- HandleEntryDeletionL(aUid, aSourceType);
- break;
- }
- }
-
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CheckIfDuplicateExistsL()
-// Checks if this landmark is already present in database. If present returns the landmark id, else 0
-// -----------------------------------------------------------------------------
-//
-TPosLmItemId CMyLocationsDatabaseManager::CheckIfDuplicateExistsL(
- const CPosLandmark* aLandmark)
-{
- __TRACE_CALLSTACK;// Stores the found duplicate landmark's id.
- TPosLmItemId retId = 0;
-
- // Initially filter only the landmarks which are nearer to the current landmark.
- // Then we can make a duplicate check on each of the found landmarks.
-
- // create a search object.
- CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(
- *iLandmarkDb);
- CleanupStack::PushL(search);
-
- TBuf<KMaxAddressLength> lmAddress1;
- GetLandmarkFullAddress( lmAddress1, aLandmark );
- QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
-
- // create nearest search criteria object
- TLocality position( TCoordinate( 0, 0), 0 );
- aLandmark->GetPosition( position );
- CPosLmNearestCriteria* nearestCriteria =
- CPosLmNearestCriteria::NewLC(
- TCoordinate( position.Latitude(), position.Longitude() ) );
- nearestCriteria->SetMaxDistance( KSearchCriteriaDistance );
-
- // Start the search and execute it at once.
- ExecuteAndDeleteLD( search->StartLandmarkSearchL( *nearestCriteria ) );
- CleanupStack::PopAndDestroy( nearestCriteria );
-
- // Retrieve an iterator to access the matching landmarks.
- CPosLmItemIterator* iter = search->MatchIteratorL();
- CleanupStack::PushL(iter);
-
- // Iterate the search matches.
- TPosLmItemId lmId;
-
- while( ( lmId = iter->NextL() ) != KPosLmNullItemId )
- {
- CPosLandmark* lm = iLandmarkDb->ReadLandmarkLC( lmId );
- TBuf<KMaxAddressLength> lmAddress2;
- GetLandmarkFullAddress( lmAddress2, lm );
- QString str2 = QString( (QChar*)lmAddress2.Ptr(), lmAddress2.Length());
- CleanupStack::PopAndDestroy( lm );
-
- if( str1 == str2 )
- {
- retId = lmId;
- break;
- }
- }
-
- CleanupStack::PopAndDestroy(iter);
- CleanupStack::PopAndDestroy(search);
-
- return retId;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CompareLandmarks()
-// Compares two landmarks. Only the text fields, landmark name, street, city, state country and
-// postal code are compared.
-// -----------------------------------------------------------------------------
-//
-TBool CMyLocationsDatabaseManager::CompareLandmarks(
- const CPosLandmark* aLandmark1, const CPosLandmark* aLandmark2 )
-{
- __TRACE_CALLSTACK;
-
- TBuf<KMaxAddressLength> lmAddress1;
- GetLandmarkFullAddress( lmAddress1, aLandmark1 );
- QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
-
- TBuf<KMaxAddressLength> lmAddress2;
- GetLandmarkFullAddress( lmAddress2, aLandmark2 );
- QString str2 = QString( (QChar*)lmAddress2.Ptr(), lmAddress2.Length());
-
- if( str1 == str2 )
- return ETrue;
- else
- return EFalse;
-
-
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::HandleEntryAdditionL()
-// Handles the entry addition in lookup table and landmarks db
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::HandleEntryAdditionL(CPosLandmark* aLandmark,
- const TUint32 aUid, const TUint32 aSourceType)
-{
- __TRACE_CALLSTACK;
- // Create a lookup item
- QLookupItem lookupItem;
- lookupItem.mSourceUid = aUid;
- lookupItem.mSourceType = aSourceType;
- lookupItem.mDestId = 0;
- lookupItem.mIconType = QLookupItem::EIconTypeDefault;
- lookupItem.mIsDuplicate = 0;
- lookupItem.mIconPath = "";
- lookupItem.mMapTilePath = "";
-
- //fill address into lookup item.
- FillLookupItemAddressDetails( aLandmark, lookupItem );
-
- if ( aSourceType == ESourceLandmarks )
- {
- // Logic: check if the entry is already present in lookupdb.
- // If present, it means the landmark corresponds to a contact/calendar. So ignore it.
- // If not present, it means the landmark is created directly into the landmarks db. So add
- // it in lookupdb as well.
-
- // check if the entry is already present in lookup db.
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( aUid, itemArray );
- if( itemArray.count() )
- {
- return;
- }
- else
- {
- lookupItem.mDestId = aUid;
- iLocationAppLookupDb->createEntry( lookupItem );
- return;
- }
- }
-
- TPosLmItemId catId;
- if( aSourceType == ESourceCalendar )
- {
- // category id to calendar
- catId = iLmCalendarCatId;
- }
- else
- {
- // remove landmark name, which is basically contact's name.
- aLandmark->SetLandmarkNameL( KNullDesC );
- // category id to contacts
- catId = iLmContactsCatId;
- }
- // check if this landmark is already present in database
- TPosLmItemId dupLmId = CheckIfDuplicateExistsL( aLandmark );
- if ( dupLmId )
- {
- // landmark already present in db. get the details
- CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(dupLmId);
- if( dupLandmark )
- {
- // add category.
- dupLandmark->AddCategoryL( catId );
- // update the landmark object in the db
- iLandmarkDb->UpdateLandmarkL( *dupLandmark );
- CleanupStack::PopAndDestroy( dupLandmark );
- }
-
- // point the lookup item's landmark uid to the existing landmark.
- lookupItem.mDestId = dupLmId;
- if( aSourceType == ESourceCalendar )
- {
- // set duplicate flag to true. only if it is calendar entry.
- // for contacts duplicate doesnot hold good as the location name is the contact name.
-
- // set duplicate only if there are calendar entries already pointing to this landmark.
- if( IsDuplicateEntry( dupLmId ) )
- {
- lookupItem.mIsDuplicate = 1;
- }
- }
- }
- else // it is a new entry, so add into the database
- {
- // add category.
- aLandmark->AddCategoryL( catId );
- // add the landmark into the db.
- // point the lookup item's landmark uid to the newly created landmark in the db.
- lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *aLandmark );
- }
-
- // create the entry in the lookup table.
- iLocationAppLookupDb->createEntry( lookupItem );
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::HandleEntryModificationL()
-// Handles the entry modification in the lookup table and landmarks db.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::HandleEntryModificationL(
- CPosLandmark* aLandmark, const TUint32 aUid, const TUint32 aSourceType )
-{
- __TRACE_CALLSTACK;
- if ( aSourceType == ESourceLandmarks )
- {
- HandleLandmarkModificationL( aLandmark, aUid );
- return;
- }
-
- QLookupItem lookupItem;
- lookupItem.mSourceUid = aUid;
- lookupItem.mSourceType = aSourceType;
- lookupItem.mIconType = QLookupItem::EIconTypeDefault;
-
- // Behavior: If an entry is modified,
- // If this entry is not present in lookup table. add the entry and update the landmarks db.
- // If this entry is already present in lookup table, check if the location info is modified or not.
- // If the location info is modified, delete the landmark from db and add the new landmark
- // into the db.
- // Before deletion make sure that the landmark is not being refered by other lookup entries.
-
- // find the entry in the lookup table.
- if ( iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem ) )
- {
- //fill address into lookup item.
- FillLookupItemAddressDetails( aLandmark, lookupItem );
-
- QString locationName = lookupItem.mName;
-
- TPosLmItemId catId;
-
- if( aSourceType == ESourceCalendar )
- {
- catId = iLmCalendarCatId;
- }
- else
- {
- // remove landmark name, which is basically contact's name.
- aLandmark->SetLandmarkNameL( KNullDesC );
-
- // category id to contacts
- catId = iLmContactsCatId;
- }
-
-
- // check if the location info is modified by comparing the new landmark with the existing landmark
- CPosLandmark* existingLandmark = NULL;
- TRAPD( error, ( existingLandmark =
- CheckAndReadLandmarkL( iLandmarkDb, lookupItem.mDestId ) ) );
- CleanupStack::PushL( existingLandmark );
- if ( error == KErrNotFound )
- {
- // Landmarks item deleted. So delete corresponding lookup entries.
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
- for ( int i = 0; i < itemArray.count(); i++)
- {
- iLocationAppLookupDb->deleteEntryBySourceIdAndType( itemArray[i] );
- }
-
- // Add the entry into the lookup table and update landmarks db.
- HandleEntryAdditionL( aLandmark, aUid, aSourceType );
-
- CleanupStack::PopAndDestroy( existingLandmark );
- return;
- }
-
- if ( !CompareLandmarks( existingLandmark, aLandmark ) )
- {
- // landmarks are not same, means location information is modified.
-
- // Check if the new landmark is already in db.
- TPosLmItemId dupLmId = CheckIfDuplicateExistsL( aLandmark );
- if ( dupLmId )
- {
- // landmark already present in db. get the details
- CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC( dupLmId );
- if ( dupLandmark )
- {
- // add category.
- dupLandmark->AddCategoryL( catId );
-
- // update the landmark object in the db
- iLandmarkDb->UpdateLandmarkL( *dupLandmark );
- }
- CleanupStack::PopAndDestroy( dupLandmark );
-
- // update the lookup item to refer to the newly created landmark.
- lookupItem.mDestId = dupLmId;
- if( aSourceType == ESourceCalendar )
- {
- // for contacts duplicate doesnot hold good as the location name is the contact name.
- if( !lookupItem.mIsDuplicate )
- {
- // if current lookup item duplicate property is 0, then remove next corresponding
- // calendar lookup entry duplicate property.
- // this is required because the current entry will be pointing to a new landmark.
- UnsetDuplicateNextCalEntry( existingLandmark->LandmarkId() );
- }
-
- // set duplicate only if there are calendar entries already pointing to this landmark.
- if( IsDuplicateEntry( dupLmId ) )
- {
- lookupItem.mIsDuplicate = 1;
- }
-
- }
-
- iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
- }
- else
- {
- // landmark not already present in db.
- // Create a new entry in the db
- aLandmark->AddCategoryL( catId );
- lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *aLandmark );
- if( aSourceType == ESourceCalendar )
- {
- // for contacts duplicate doesnot hold good as the location name is the contact name.
- if( !lookupItem.mIsDuplicate )
- {
- // if current lookup item duplicate property is 0, then remove next corresponding
- // calendar lookup entry duplicate property.
- // this is required because the current entry will be pointing to a new landmark.
- UnsetDuplicateNextCalEntry( existingLandmark->LandmarkId() );
- }
- }
-
- lookupItem.mIsDuplicate = 0;
- // update the lookup table
- iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
- }
- }
- else
- {
- // landmarks are same, means location not modified. So return.
- if( aSourceType == ESourceContactsPref
- || aSourceType == ESourceContactsWork
- || aSourceType == ESourceContactsHome
- )
- {
- // in case of contacts, there is a chance that contact name is modified.
- // so update the lookup database entry with that name.
- lookupItem.mName = locationName;
- iLocationAppLookupDb->updateEntryBySourceIdAndType( lookupItem );
- }
-
- CleanupStack::PopAndDestroy( existingLandmark );
- return;
- }
-
- // delete the existing landmark only if it not being refered by other lookup entries.
-
- // Check if any other entries are refering this landmark.
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId(
- existingLandmark->LandmarkId(), itemArray );
-
- if ( itemArray.count() )
- {
- // There are other lookup entries refering this landmark. So do not delete the landmark
-
- // If none of these lookup item's source type is current source type, disassociate 'catId' category
- // from this landmark.
- TInt i = 0;
- while ( i < itemArray.count() )
- {
- if( aSourceType == ESourceCalendar )
- {
- if ( itemArray[i].mSourceType == aSourceType )
- {
- // a lookup item exists which is from calendar, so 'catId' is still valid.
- break;
- }
- }
- else
- {
- // a lookup item exists which is from contacts, so 'catId' is still valid.
- break;
- }
- i++;
- }
- if ( i == itemArray.count() )
- {
- // no lookup items from current source type exists refering this landmark.
- // so disassociate 'catId' from this landmark
-
- existingLandmark->RemoveCategory( catId );
- iLandmarkDb->UpdateLandmarkL( *existingLandmark );
- }
- }
- else
- {
- // no other lookup entry is refering this landmark.
- // delete the landmark.
- iLandmarkDb->RemoveLandmarkL( existingLandmark->LandmarkId() );
- }
- CleanupStack::PopAndDestroy( existingLandmark );
-
- }
- else // entry not present in lookup table
- {
- // Add the entry into the lookup table and update landmarks db.
- HandleEntryAdditionL( aLandmark, aUid, aSourceType );
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::HandleEntryDeletionL()
-// Handles the entry deletion in lookup table and landmarks db.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::HandleEntryDeletionL(const TUint32 aUid,
- const TUint32 aSourceType)
-{
- __TRACE_CALLSTACK;
- QLookupItem lookupItem;
- lookupItem.mSourceUid = aUid;
- lookupItem.mSourceType = aSourceType;
-
- // Behavior: if an entry is deleted, delete the corresponding entries from
- // both lookup table and iLandmarkDb.
- // Before deleting the entry from iLandmarkDb, make sure that this entry is not being refered by
- // other entries of the lookup table. If it is being refered by other entries in lookup table, then
- // do not delete the landmark.
-
- if ( !iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem ) )
- {
- if( aSourceType == ESourceLandmarks )
- {
- lookupItem.mDestId = aUid;
- }
- else
- {
- return;
- }
- }
-
- // Find the corresponding landmark uid
-
-
- // delete the lookup entry.
- iLocationAppLookupDb->deleteEntryBySourceIdAndType( lookupItem );
-
- // Check if any other entries are refering this landmark.
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
-
- if ( itemArray.count() )
- {
-
- if( aSourceType == ESourceLandmarks )
- {
- CPosLandmark* lm = NULL;
-
- for( int i = 0; i < itemArray.count(); i++ )
- {
- if( itemArray[i].mSourceType == ESourceCalendar )
- {
- // add landmark entry since a calendar item is present with this location.
- if( !lm )
- {
- lm = CreateLandmarkItemLC( itemArray[i] );
- }
- lm->AddCategoryL( iLmCalendarCatId );
- }
- else
- {
- // add landmark entry since a contact item is present with this location.
- if( !lm )
- {
- QString tempStr = itemArray[i].mName;
- itemArray[i].mName = "";
- lm = CreateLandmarkItemLC( itemArray[i] );
- itemArray[i].mName = tempStr;
- }
- lm->AddCategoryL( iLmCalendarCatId );
- }
- }
-
- lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *lm );
- CleanupStack::PopAndDestroy( lm );
-
- bool dupUnset = false;
- for( int i=0; i<itemArray.count(); i++ )
- {
- itemArray[i].mDestId = lookupItem.mDestId;
- if( itemArray[i].mSourceType == ESourceCalendar && dupUnset == false )
- {
- dupUnset = true;
- itemArray[i].mIsDuplicate = 0;
- }
- iLocationAppLookupDb->updateEntryById( itemArray[i] );
- }
-
- return;
- }
-
- // There are other lookup entries refering this landmark. So do not delete the landmark
-
- // If none of these lookup item's source type is current source type, disassociate current source category
- // from this landmark.
- TInt i = 0;
- while ( i < itemArray.count() )
- {
- if( aSourceType == ESourceCalendar )
- {
- if( itemArray[i].mSourceType == aSourceType )
- {
- if( lookupItem.mIsDuplicate == 0 )
- {
- itemArray[i].mIsDuplicate = 0;
- iLocationAppLookupDb->updateEntryById( itemArray[i] );
- }
- // a lookup item exists which is from calendar, so 'iLmCalendarCatId' is still valid.
- break;
- }
-
- }
- else if ( itemArray[i].mSourceType == ESourceContactsPref
- || itemArray[i].mSourceType == ESourceContactsWork
- || itemArray[i].mSourceType == ESourceContactsHome)
- {
- // a lookup item exists which is from contacts, so 'iLmContactsCatId' is still valid.
- break;
- }
- i++;
- }
- if ( i == itemArray.count() )
- {
- // no lookup items from current source type exists refering this landmark.
- // so disassociate current source category from this landmark
-
- CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC( lookupItem.mDestId );
- if( aSourceType == ESourceCalendar )
- {
- landmark->RemoveCategory( iLmCalendarCatId );
- }
- else
- {
- landmark->RemoveCategory( iLmContactsCatId );
- }
-
- iLandmarkDb->UpdateLandmarkL( *landmark );
- CleanupStack::PopAndDestroy( landmark );
- }
- }
- else
- {
- // no other lookup entry is refering this landmark.
- // delete the landmark.
- if ( aSourceType != ESourceLandmarks )
- {
- iLandmarkDb->RemoveLandmarkL( lookupItem.mDestId );
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::HandleLandmarkModificationL()
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::HandleLandmarkModificationL(
- CPosLandmark* aLandmark, const TUint32 aUid )
-{
- // 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,
- // if exists, create a new landmark entry with that location details and update all those
- // lookup entry's destid with the newly created landmark id.
-
- QLookupItem lookupItem;
- lookupItem.mSourceUid = aUid;
- lookupItem.mSourceType = ESourceLandmarks;
- lookupItem.mIconType = QLookupItem::EIconTypeDefault;
-
- bool found = iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem );
- //fill address into lookup item.
- FillLookupItemAddressDetails( aLandmark, lookupItem );
- lookupItem.mDestId = aUid;
- lookupItem.mIsDuplicate = 0;
- lookupItem.mIconType = QLookupItem::EIconTypeDefault;
- lookupItem.mIconPath = "";
- lookupItem.mMapTilePath = "";
-
- // update entry in lookup table.
- if ( found )
- {
- iLocationAppLookupDb->updateEntryById( lookupItem );
- }
- else
- {
- iLocationAppLookupDb->createEntry( lookupItem );
- }
-
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( lookupItem.mDestId, itemArray );
-
- if( itemArray.count() == 1 )
- {
- //only one entry ie the entry corresponding to landmark db is present.
- return;
- }
-
- CPosLandmark* lm = NULL;
-
- for( int i = 0; i < itemArray.count(); i++ )
- {
- if( itemArray[i].mSourceType != ESourceLandmarks )
- {
- if( itemArray[i].mSourceType == ESourceCalendar )
- {
- // add landmark entry since a calendar item is present with this location.
- if( !lm )
- {
- lm = CreateLandmarkItemLC( itemArray[i] );
- }
- lm->AddCategoryL( iLmCalendarCatId );
- }
- else
- {
- // add landmark entry since a calendar item is present with this location.
- if( !lm )
- {
- QString tempStr = itemArray[i].mName;
- itemArray[i].mName = "";
- lm = CreateLandmarkItemLC( itemArray[i] );
- itemArray[i].mName = tempStr;
- }
- lm->AddCategoryL( iLmCalendarCatId );
- }
- }
- }
-
- // add the entry to landmarks db
- quint32 newDestId = iLandmarkDb->AddLandmarkL( *lm );
- CleanupStack::PopAndDestroy( lm );
-
- bool calDuplicateUnset = false;
- // update all the lookup entries with new landmark id
- for( int i = 0; i < itemArray.count(); i++ )
- {
- if( itemArray[i].mSourceType != ESourceLandmarks )
- {
- itemArray[i].mDestId = newDestId;
-
- if( itemArray[i].mSourceType == ESourceCalendar )
- {
- if( !calDuplicateUnset )
- {
- itemArray[i].mIsDuplicate = 0;
- calDuplicateUnset = true;
- }
- else
- {
- itemArray[i].mIsDuplicate = 1;
- }
- }
- iLocationAppLookupDb->updateEntryById( itemArray[i] );
- }
- }
-}
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::GetLandmarkFullAddress()
-// Gets the comma separated full address of the given landmark.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::GetLandmarkFullAddress(
- TBuf<KMaxAddressLength>& aLandmarkAddress,
- const CPosLandmark* aLandmark)
-{
- TPtrC tempStr;
- TInt retStatus;
- TBool addressEmtpy = ETrue;
- retStatus = aLandmark->GetPositionField(EPositionFieldStreet, tempStr);
- if (retStatus == KErrNone && tempStr.Length())
- {
- {
- aLandmarkAddress.Copy(tempStr);
- addressEmtpy = EFalse;
- }
- }
-
- retStatus = aLandmark->GetPositionField(EPositionFieldCity, tempStr);
- if (retStatus == KErrNone && tempStr.Length())
- {
- if (!addressEmtpy)
- {
- aLandmarkAddress.Append(KSeparator);
- aLandmarkAddress.Append(KSpace);
- aLandmarkAddress.Append(tempStr);
- }
- else
- {
- aLandmarkAddress.Copy(tempStr);
- addressEmtpy = EFalse;
- }
- }
-
- retStatus = aLandmark->GetPositionField(EPositionFieldState, tempStr);
- if (retStatus == KErrNone && tempStr.Length())
- {
- if (!addressEmtpy)
- {
- aLandmarkAddress.Append(KSeparator);
- aLandmarkAddress.Append(KSpace);
- aLandmarkAddress.Append(tempStr);
- }
- else
- {
- aLandmarkAddress.Copy(tempStr);
- addressEmtpy = EFalse;
- }
- }
-
- retStatus = aLandmark->GetPositionField(EPositionFieldCountry, tempStr);
- if (retStatus == KErrNone && tempStr.Length())
- {
- if (!addressEmtpy)
- {
- aLandmarkAddress.Append(KSeparator);
- aLandmarkAddress.Append(KSpace);
- aLandmarkAddress.Append(tempStr);
- }
- else
- {
- aLandmarkAddress.Copy(tempStr);
- addressEmtpy = EFalse;
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CheckAndReadLandmarkL()
-// Checks if given landmark id is found in the database and returns the read landmark.
-// -----------------------------------------------------------------------------
-//
-CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL(
- CPosLandmarkDatabase* aDb, const TUint32 aLmId)
-{
- __TRACE_CALLSTACK;
- CPosLandmark* lm = aDb->ReadLandmarkLC(aLmId);
- CleanupStack::Pop(lm);
- return lm;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::FillLookupItemAddressDetails()
-// Creates a new category in Mylocations Db and adds a corresponding entry in
-// mylocations lookup table.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem& aLookupItem )
-{
- __TRACE_CALLSTACK;// Read the category.
-
- // fill geo-coordinates
- TLocality position;
- aLandmark->GetPosition( position );
- aLookupItem.mLatitude = position.Latitude();
- aLookupItem.mLongitude = position.Longitude();
-
- TPtrC tempStr;
- TInt retStatus;
-
- // Copy landmark name in address 1
- retStatus = aLandmark->GetLandmarkName( tempStr );
- aLookupItem.mName = "";
- if( retStatus == KErrNone && tempStr.Length() > 0 )
- {
- aLookupItem.mName = QString( (QChar*)tempStr.Ptr(), tempStr.Length() );
- }
-
- // get street
- aLookupItem.mStreet = "";
- retStatus = aLandmark->GetPositionField( EPositionFieldStreet, tempStr );
- if( retStatus == KErrNone && tempStr.Length() )
- {
- aLookupItem.mStreet = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
- }
-
- // get postal code
- aLookupItem.mPostalCode = "";
- retStatus = aLandmark->GetPositionField( EPositionFieldPostalCode, tempStr );
- if( retStatus == KErrNone && tempStr.Length() )
- {
- aLookupItem.mPostalCode = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
- }
-
- // get city
- aLookupItem.mCity = "";
- retStatus = aLandmark->GetPositionField( EPositionFieldCity, tempStr );
- if( retStatus == KErrNone && tempStr.Length() )
- {
- aLookupItem.mCity = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
- }
-
- // get State
- aLookupItem.mState = "";
- retStatus = aLandmark->GetPositionField( EPositionFieldState, tempStr );
- if( retStatus == KErrNone && tempStr.Length() )
- {
- aLookupItem.mState = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
- }
-
- // get country
- aLookupItem.mCountry = "";
- retStatus = aLandmark->GetPositionField( EPositionFieldCountry, tempStr );
- if( retStatus == KErrNone && tempStr.Length() )
- {
- aLookupItem.mCountry = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry()
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId )
-{
- // get next duplicate item
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
- for ( int i = 0; i < itemArray.count(); i++)
- {
- if( itemArray[i].mSourceType == ESourceCalendar )
- {
- itemArray[i].mIsDuplicate = 0;
- iLocationAppLookupDb->updateEntryById( itemArray[i] );
- break;
- }
- }
-
-}
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::IsDuplicateEntry()
-// -----------------------------------------------------------------------------
-//
-bool CMyLocationsDatabaseManager::IsDuplicateEntry( quint32 aLandmarkId )
-{
- // get next duplicate item
- QList<QLookupItem> itemArray;
- iLocationAppLookupDb->findEntriesByLandmarkId( aLandmarkId, itemArray );
- for ( int i = 0; i < itemArray.count(); i++)
- {
- if( itemArray[i].mSourceType == ESourceCalendar ||
- itemArray[i].mSourceType == ESourceLandmarks )
- {
- return true;
- }
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CreateLandmarkItemLC()
-// -----------------------------------------------------------------------------
-//
-CPosLandmark* CMyLocationsDatabaseManager::CreateLandmarkItemLC( const QLookupItem &aLookupItem )
-{
- __TRACE_CALLSTACK;//return value
- CPosLandmark *landmark = NULL;
- TLocality loc( TCoordinate( aLookupItem.mLatitude, aLookupItem.mLongitude ), 0 );
-
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL( landmark );
-
- // Fill the location details into the landmark object
- landmark->SetPositionL( loc );
-
- // Set the landmark name as contact name
- TBuf<KBufSize> text( aLookupItem.mName.utf16() );
- TRAP_IGNORE( landmark->SetLandmarkNameL( text ) );
-
- text.Copy( aLookupItem.mStreet.utf16() );
- landmark->SetPositionFieldL( EPositionFieldStreet, text );
-
- // Set the City
- text.Copy( aLookupItem.mCity.utf16() );
- landmark->SetPositionFieldL( EPositionFieldCity, text );
-
- // Set the state/region
- text.Copy( aLookupItem.mState.utf16() );
- landmark->SetPositionFieldL( EPositionFieldState, text );
-
- // Set the Postal code
- text.Copy( aLookupItem.mPostalCode.utf16() );
- landmark->SetPositionFieldL( EPositionFieldPostalCode, text );
-
- // Set the country
- text.Copy( aLookupItem.mCountry.utf16() );
- landmark->SetPositionFieldL( EPositionFieldCountry, text );
-
- return landmark;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::UpdateMapTilePath()
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType,
- TFileName aFilePath )
-{
- QString filePath = QString( (QChar*)aFilePath.Ptr(), aFilePath.Length() );
- iLocationAppLookupDb->updateMaptileBySourceIdAndType( aSourceId, aSourceType, filePath );
-}
-
-// End of file
--- a/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -17,6 +17,7 @@
*/
// INCLUDE FILES
+#include <QFile>
#include <f32file.h>
#include <calchangecallback.h>
#include <cntitem.h>
@@ -26,22 +27,25 @@
#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
//handle for CMyLocationsHistoryDbObserver class
#include "mylocationlogger.h"
#if ( defined __WINSCW__ ) || ( defined __WINS__ )
-_LIT ( KImageStorageDrive, "C:\\Maptile\\");
+_LIT ( KImageStorageDrive, "C:\\MapTile\\");
#endif
_LIT(KFolderName,":\\MapTile\\");
const TInt KImagePathSize=36;
const TInt KDefaultFilePathSize = 20;
+const TUid KMaptileStatusPublish={0x2002680A};
+enum TMaptileStatusKeys {EMaptileStatusInteger=0x1};
-// separator
-_LIT( KSeparator, ",");
-_LIT(KPNGType, ".png");
-_LIT(KSingleSpace, " ");
+//Protocol : [appid-addresstype-maptilestatus]
+_LIT8( KMaptileStatusFormat, "%d-%d-%d" );
+const TInt KProtocolBufferSize = 16;
// ============================ MEMBER FUNCTIONS ===============================
@@ -86,8 +90,16 @@
iMaptileDatabase = CLookupMapTileDatabase::NewL(KMapTileLookupDatabaseName);
MYLOCLOGSTRING("Maptile Db instance created ");
+
+ iGeocodeUpdate = new GeocodeUpdate();
+ iMyLocationThreeAMTimer = CLocationGeoTagTimerAO::NewL(*this);
+
+ iMyLocationThreeAMTimer->StartTimer();
- iAddressCompare = CAddressComparision::NewL();
+ MYLOCLOGSTRING(" iMyLocationThreeAMTimer = CLocationGeoTagTimerAO::NewL(this)");
+
+ //Create instance of contact manager
+ iContactManager = new QContactManager();
MYLOCLOGSTRING(" start contact db observation ");
StartContactsChangeNotifierL();
@@ -96,12 +108,15 @@
imageFilePath.Zero();
SetFolderPathL();
- TInt status;
+ TInt status = KErrNone;
iCalSession = CCalSession::NewL();
NotifyChangeL(status);
// Start listening to landmarks db changes
- StartLandmarksChangeNotifier();
+ StartLandmarksChangeNotifier();
+ iContactSubscriber = CContactSubscriber::NewL(this);
+ iCalendarSubscriber = CCalendarSubscriber::NewL(this);
+ TInt ret = RProperty::Define( KMaptileStatusPublish, EMaptileStatusInteger, RProperty::EByteArray );
}
// -----------------------------------------------------------------------------
@@ -114,6 +129,7 @@
__TRACE_CALLSTACK;
RFs session;
User::LeaveIfError(session.Connect());
+
if ( imageFilePath.Length() > 0 && BaflUtils::FolderExists(session, imageFilePath))
{
session.Close();
@@ -204,12 +220,23 @@
//
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),
- iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL)
+ iMapTileInterface(NULL),
+ iMyLocationsDatabaseManager(NULL),
+ iMaptileDatabase(NULL),
+ iMyLocationThreeAMTimer(NULL),
+ iMaptileGeocoderPluginAvailable(EFalse),
+ iCalenderNotification(NULL),
+ iContactManager(NULL),
+ iContactSubscriber(NULL),
+ iCalendarSubscriber(NULL),
+ iGeocodeUpdate(NULL),
+ iLastContactId( -1 ) ,
+ iLastCalendarId( 0 )
{
}
@@ -223,6 +250,8 @@
{
__TRACE_CALLSTACK;// delete the member variables.
+ Cancel();
+
delete iContactChangeNotifier;
delete iMyLocationsDatabaseManager;
@@ -238,10 +267,27 @@
delete iMapTileInterface;
delete iMaptileDatabase;
+
+ delete iCalenderNotification;
+
+ delete iMyLocationThreeAMTimer;
+
+ delete iContactManager;
+
+ delete iContactSubscriber;
- delete iAddressCompare;
+ delete iCalendarSubscriber;
+
+ delete iGeocodeUpdate;
- delete iCalenderNotification;
+ for( TInt index = 0; index < iAddressInfo.Count(); index++ )
+ {
+ delete iAddressInfo[index];
+ iAddressInfo.Remove(index);
+ iAddressInfo.Compress();
+ }
+
+ iAddressInfo.Reset();
}
@@ -276,6 +322,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
@@ -325,7 +502,7 @@
{
__TRACE_CALLSTACK;
- GeocodeUpdate::createContactdb();
+ iGeocodeUpdate->createContactdb();
iContactsDb = CContactDatabase::OpenL();
// Create CContactChangeNotifier object with 'this' object.
iContactChangeNotifier = CContactChangeNotifier::NewL(*iContactsDb,this);
@@ -384,12 +561,7 @@
return;
}
}
- TLookupItem lookupItem;
- lookupItem.iSource = ESourceCalendar;
- lookupItem.iUid = calChangeEntry.iEntryId;
- //TODO: comapare address and then delete
- TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem) );
- TRAP_IGNORE( CalenderEntryAddedL(calChangeEntry) );
+ TRAP_IGNORE( CalenderEntryModifyL(calChangeEntry) ) ;
break;
}
case EChangeDelete:
@@ -397,9 +569,8 @@
TLookupItem lookupItem;
lookupItem.iSource = ESourceCalendar;
lookupItem.iUid = calChangeEntry.iEntryId;
- TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem));
-
- TRAP_IGNORE( UpdateDatabaseL( NULL,
+ TRAP_IGNORE(ManipulateMapTileDataBaseL(lookupItem));
+ TRAP_IGNORE( UpdateDatabaseL( NULL,
calChangeEntry.iEntryId, ESourceCalendar, EEntryDeleted ) );
break;
}
@@ -415,14 +586,67 @@
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);
- TPtrC address(calEntry->LocationL());
- if(address.Length()>0)
+ 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);
+ if(iGeocodeUpdate->isGeocodeNotAvailable(entryId))
{
- RequestMapTileImageL(address,ESourceCalendar, aCalChangeEntry.iEntryId);
- }
- delete calEntry;
+ TPtrC address(calEntry->LocationL());
+ if (iMyLocationsDatabaseManager->CheckIfAddressChanged(address, entryId,
+ ESourceCalendar))
+ {
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) );
+ if (address.Length() > 0)
+ {
+ RequestMapTileImageL(address, ESourceCalendar, entryId , EChangeModify);
+ }
+ else
+ {
+ UpdateDatabaseL(NULL, entryId, ESourceCalendar, EEntryDeleted);
+ }
+ if ( lookupItem.iFilePath.Length() > 0 )
+ {
+ iMaptileDatabase->DeleteMapTileL(lookupItem);
+ }
+
+ }
+ }
+ CleanupStack::PopAndDestroy(calEntry);
}
// -----------------------------------------------------------------------------
@@ -434,359 +658,289 @@
{
__TRACE_CALLSTACK;
- HandlelandmarkDatabaseL(aEvent);
-
//Forward the event for maptile fetching only if maptile plugin available
if( iMaptileGeocoderPluginAvailable )
{
TriggerMaptileRequestL(aEvent);
}
-
}
+
// -----------------------------------------------------------------------------
-// CMyLocationsEngine::HandlelandmarkDatabaseL()
-// Process the contact database event and updates the landmark database
+// CMyLocationsEngine::TriggerMaptileRequestL()
+// Process the contact address information for fetching maptile.
// -----------------------------------------------------------------------------
//
-void CMyLocationsEngine::HandlelandmarkDatabaseL(
- TContactDbObserverEvent& aEvent)
+void CMyLocationsEngine::TriggerMaptileRequestL(TContactDbObserverEvent& aEvent)
{
- __TRACE_CALLSTACK;// If contact is modified or added, update the mylocations db
- if (aEvent.iType == EContactDbObserverEventContactChanged || aEvent.iType
- == EContactDbObserverEventContactAdded)
- {
- //Get the contact item
- CContactItem* contactItem =
- iContactsDb->ReadContactL(aEvent.iContactId);
+ __TRACE_CALLSTACK;
+ TLookupItem lookupItem;
+ lookupItem.iUid = aEvent.iContactId;
+ // If contact is deleted delete from mylocations db
+ if (aEvent.iType == EContactDbObserverEventContactDeleted)
+ {
+ //Delete the entries from maptile database
+ lookupItem.iSource = ESourceContactsPref;
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
- if (contactItem)
- {
- CleanupStack::PushL(contactItem);
+ lookupItem.iSource = ESourceContactsWork;
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
+ lookupItem.iSource = ESourceContactsHome;
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
+ // Delete entries from mylocation database
+ TRAP_IGNORE( UpdateDatabaseL( NULL, aEvent.iContactId,
+ ESourceContactsPref, EEntryDeleted ));
+
+ TRAP_IGNORE( UpdateDatabaseL( NULL, aEvent.iContactId,
+ ESourceContactsHome, EEntryDeleted ));
- // Get the default/prefered address details
- CPosLandmark *preferedAddressLm = GetContactLocationDetailsLC(
- contactItem, EAddressPref);
+ TRAP_IGNORE( UpdateDatabaseL( NULL, aEvent.iContactId,
+ ESourceContactsWork, EEntryDeleted ) );
+
+ MYLOCLOGSTRING("EContactDbObserverEventContactDeleted ");
+ return;
+ }
- // Get the work address details
- CPosLandmark *workAddressLm = GetContactLocationDetailsLC(
- contactItem, EAddressWork);
+ //Get the contact item
+ iEventType = aEvent.iType;
+ QContact contactInfo = iContactManager->contact( aEvent.iContactId );
+
+ //Get the contact name details
+ QContactName name = contactInfo.detail( QContactName::DefinitionName );
+ QString firstName = name.firstName();
+ QString lastName = name.lastName();
+ TPtrC16 tempPtr1(reinterpret_cast<const TUint16*>(firstName.utf16()));
+ TPtrC16 tempPtr2( reinterpret_cast <const TUint16*>(lastName.utf16()));
+
+ TBuf<KBufSize> landmarkName;
+ landmarkName.Append( tempPtr1 );
+ landmarkName.Append( tempPtr2 );
+
+ CPosLandmark *preferedAddressLm = NULL;
+ CPosLandmark *workAddressLm = NULL;
+ CPosLandmark *homeAddressLm = NULL;
+
+ TInt itemCount = 0;
+
+ foreach ( QContactAddress address, contactInfo.details<QContactAddress>() )
+ {
+ QStringList context = address.contexts();
+ if ( context.isEmpty() ) // no context
+ {
+ preferedAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ }
+ else if ( context.first() == QContactAddress::ContextHome )
+ {
+ homeAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ }
+ else if ( context.first() == QContactAddress::ContextWork )
+ {
+ workAddressLm = GetContactAddressDetailsLC( address );
+ itemCount++;
+ }
+ }
+
+ switch (aEvent.iType)
+ {
+ case EContactDbObserverEventContactChanged:
+ {
+ MYLOCLOGSTRING("EContactDbObserverEventContactChanged" );
+ MYLOCLOGSTRING1("iMapTileRequestQueue.Count()-%d",iMapTileRequestQueue.Count() );
- // Get the home address details
- CPosLandmark *homeAddressLm = GetContactLocationDetailsLC(
- contactItem, EAddressHome);
-
- // if the contact item has no validated address (preferef, home or work)
- if (!preferedAddressLm && !workAddressLm && !homeAddressLm)
+ if (iMapTileRequestQueue.Count() > 0)
{
- if (aEvent.iType == EContactDbObserverEventContactChanged)
+ if (iMapTileRequestQueue[0]->iUId == aEvent.iContactId)
{
- // If the contact is a modified one and it might already exist in
- // mylocations db, so delete it
- UpdateDatabaseL(NULL,
- aEvent.iContactId, ESourceContactsPref,
- EEntryDeleted);
- UpdateDatabaseL(NULL,
- aEvent.iContactId, ESourceContactsWork,
- EEntryDeleted);
- UpdateDatabaseL(NULL,
- aEvent.iContactId, ESourceContactsHome,
- EEntryDeleted);
+ CleanupStack::PopAndDestroy( itemCount );
+ MYLOCLOGSTRING("retrun from geolocation callback" );
+ return;
+ }
+ }
+
+ // if default address available, update Mylocations.
+ lookupItem.iSource = ESourceContactsPref;
+ if (preferedAddressLm)
+ {
+ preferedAddressLm->SetLandmarkNameL( landmarkName );
+ MYLOCLOGSTRING("preferedAddressLm address changed" );
+
+ 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));
}
}
else
{
- // There is atleast one valid address present.
-
- // Get the TEntryChangeType for contacts.
- TEntryChangeType changeType = MapChangeType(
- ESourceContactsPref, aEvent.iType);
-
- // if home address available, update Mylocations.
- if (homeAddressLm)
- {
- UpdateDatabaseL(homeAddressLm,
- aEvent.iContactId, ESourceContactsHome, changeType);
- CleanupStack::PopAndDestroy(homeAddressLm);
- }
-
- // if work address available, update Mylocations.
- if (workAddressLm)
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
+ }
+
+ // if home address available, update Mylocations.
+ lookupItem.iSource = ESourceContactsHome;
+ if (homeAddressLm)
+ {
+ homeAddressLm->SetLandmarkNameL( landmarkName );
+ MYLOCLOGSTRING("homeAddressLm address changed" );
+ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*homeAddressLm,
+ aEvent.iContactId, ESourceContactsHome) )
{
- UpdateDatabaseL(workAddressLm,
- aEvent.iContactId, ESourceContactsWork, changeType);
- CleanupStack::PopAndDestroy(workAddressLm);
+ 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);
+ }
}
-
- // if prefered address available, update Mylocations.
- if (preferedAddressLm)
- {
- UpdateDatabaseL(
- preferedAddressLm, aEvent.iContactId,
- ESourceContactsPref, changeType);
- CleanupStack::PopAndDestroy(preferedAddressLm);
- }
-
}
-
- // Pop and destroy the contactItem
- CleanupStack::PopAndDestroy(contactItem);
- }
- }
- else if (aEvent.iType == EContactDbObserverEventContactDeleted)
- {
- // the contact is deleted, so delete the corresponding entries from database.
+ else
+ {
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
+ }
+
- // delete prefered address in database
- UpdateDatabaseL(NULL, aEvent.iContactId,
- ESourceContactsPref, EEntryDeleted);
-
- // delete work address in database
- UpdateDatabaseL(NULL, aEvent.iContactId,
- ESourceContactsWork, EEntryDeleted);
-
- // delete home address in database
- UpdateDatabaseL(NULL, aEvent.iContactId,
- ESourceContactsHome, EEntryDeleted);
- }
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsEngine::TriggerMaptileRequestL()
-// Callback that provides information about the contact database change event.
-// -----------------------------------------------------------------------------
-//
-
-void CMyLocationsEngine::TriggerMaptileRequestL(TContactDbObserverEvent& aEvent)
-{
- __TRACE_CALLSTACK;
- TLookupItem lookupItem;
- lookupItem.iUid = aEvent.iContactId;
- // If contact is deleted delete from mylocations db
- if (aEvent.iType == EContactDbObserverEventContactDeleted)
- {
- lookupItem.iSource = ESourceContactsPref;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- lookupItem.iSource = ESourceContactsWork;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- lookupItem.iSource = ESourceContactsHome;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- MYLOCLOGSTRING("EContactDbObserverEventContactDeleted ");
- return;
- }
-
- //Get the contact item
- iEventType = aEvent.iType;
- CContactItem* contactItem = iContactsDb->ReadContactL(aEvent.iContactId);
- CleanupStack::PushL(contactItem);
+ // if work address available, update Mylocations.
+ lookupItem.iSource = ESourceContactsWork;
+ if (workAddressLm)
+ {
+ workAddressLm->SetLandmarkNameL( landmarkName );
+ MYLOCLOGSTRING("workAddressLm address changed" );
+ if ( iMyLocationsDatabaseManager->CheckIfAddressChanged(*workAddressLm,
+ aEvent.iContactId, ESourceContactsWork) )
+ {
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+ TRAP_IGNORE( iMaptileDatabase->ReSetEntryL(lookupItem) )
- CPosLandmark *preferedAddressLm = NULL;
- CPosLandmark *workAddressLm = NULL;
- CPosLandmark *homeAddressLm = NULL;
-
- // If contact is modified or added, update the mylocations db
- /* if (contactItem)
- {
- CleanupStack::PushL(contactItem);
- */
- // Get the home address details
- homeAddressLm = GetContactAddressDetailsLC(contactItem, EAddressHome);
-
- // Get the work address details
- workAddressLm = GetContactAddressDetailsLC(contactItem, EAddressWork);
-
- // Get the default/prefered address details
- preferedAddressLm = GetContactAddressDetailsLC(contactItem, EAddressPref);
-
- // iContactUid = aEvent.iContactId;
- switch (aEvent.iType)
- {
- case EContactDbObserverEventContactChanged:
- {
- MYLOCLOGSTRING("EContactDbObserverEventContactChanged" );MYLOCLOGSTRING1("iMapTileRequestQueue.Count()-%d",iMapTileRequestQueue.Count() );
-
- if (iMapTileRequestQueue.Count() > 0)
- {
- if (iMapTileRequestQueue[0]->iUId == aEvent.iContactId)
- {
- if (preferedAddressLm)
- {
- CleanupStack::PopAndDestroy(preferedAddressLm);
- }
- if (workAddressLm)
- {
- CleanupStack::PopAndDestroy(workAddressLm);
- }
- if (homeAddressLm)
- {
- CleanupStack::PopAndDestroy(homeAddressLm);
+ //remove entry from databse
+ //TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+ RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
+ aEvent.iContactId, iEventType);
+ if (lookupItem.iFilePath.Length() > 0)
+ {
+ iMaptileDatabase->DeleteMapTileL(lookupItem);
+ }
}
-
- CleanupStack::PopAndDestroy(contactItem);
- MYLOCLOGSTRING("retrun from geolocation callback" );
- return;
+
+ }
+ else
+ {
+ TRAP_IGNORE( ManipulateMapTileDataBaseL(lookupItem));
+
}
- }
- /*
- // if the contact item has no validated address (preferef, home or work)
- if (!preferedAddressLm && !workAddressLm && !homeAddressLm)
- {
- MYLOCLOGSTRING("Contact changed no address" );
- //Delete the entries from maptile lookup table
- lookupItem.iSource = ESourceContactsPref;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- lookupItem.iSource = ESourceContactsWork;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- lookupItem.iSource = ESourceContactsHome;
- iMaptileDatabase->DeleteEntryL(lookupItem);
-
- }*/
- /* else
- {*/
- MYLOCLOGSTRING("Contact address changed" );
-
- // if default address available, update Mylocations.
- lookupItem.iSource = ESourceContactsPref;
- if (preferedAddressLm)
+ break;
+ }
+ case EContactDbObserverEventContactAdded:
{
- MYLOCLOGSTRING("preferedAddressLm address changed" );
-
- if (iAddressCompare->IsAddressChangedL(*preferedAddressLm,
- aEvent.iContactId, ESourceContactsPref))
-
+ TLookupItem lookupItem;
+ lookupItem.iUid = aEvent.iContactId;
+ lookupItem.iFilePath.Zero();
+ lookupItem.iFetchingStatus = EMapTileFetchingInProgress;
+
+ MYLOCLOGSTRING("EContactDbObserverEventContactAdded" );
+ if (preferedAddressLm)
{
- //remove entry from database
- iMaptileDatabase->DeleteEntryL(lookupItem);
+ preferedAddressLm->SetLandmarkNameL( landmarkName );
+ //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)
+ {
+ homeAddressLm->SetLandmarkNameL( landmarkName );
+ lookupItem.iSource = ESourceContactsHome;
+ iMaptileDatabase->CreateEntryL(lookupItem);
+ RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
+ aEvent.iContactId, iEventType);
}
-
- CleanupStack::PopAndDestroy(preferedAddressLm);
-
- }
- else
- {
- iMaptileDatabase->DeleteEntryL(lookupItem);
+ if (workAddressLm)
+ {
+ workAddressLm->SetLandmarkNameL( landmarkName );
+ lookupItem.iSource = ESourceContactsWork;
+ iMaptileDatabase->CreateEntryL(lookupItem);
+ RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
+ aEvent.iContactId, iEventType);
+ }
+ break;
}
- // 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
- {
- iMaptileDatabase->DeleteEntryL(lookupItem);
- RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
- aEvent.iContactId);
- }
-
- CleanupStack::PopAndDestroy(workAddressLm);
-
- }
- else
- {
- iMaptileDatabase->DeleteEntryL(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
- iMaptileDatabase->DeleteEntryL(lookupItem);
- RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
- aEvent.iContactId);
- }
- CleanupStack::PopAndDestroy(homeAddressLm);
- }
- else
- {
- iMaptileDatabase->DeleteEntryL(lookupItem);
- }
- // }
- break;
- }
- case EContactDbObserverEventContactAdded:
- {
- MYLOCLOGSTRING("EContactDbObserverEventContactAdded" );
- if (preferedAddressLm)
- {
- RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
- aEvent.iContactId);
- CleanupStack::PopAndDestroy(preferedAddressLm);
- }
- if (workAddressLm)
- {
- RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
- aEvent.iContactId);
- CleanupStack::PopAndDestroy(workAddressLm);
- }
- if (homeAddressLm)
- {
- RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
- aEvent.iContactId);
- CleanupStack::PopAndDestroy(homeAddressLm);
- }
- break;
}
-
- };
- CleanupStack::PopAndDestroy(contactItem);
- //}
+
+ CleanupStack::PopAndDestroy( itemCount );
}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RequestMapTileImageL()
+// Request to get maptiel
+// -----------------------------------------------------------------------------
+//
void CMyLocationsEngine::RequestMapTileImageL(const TDesC& aAddressDetails,
- const TUidSourceType aAddressType, const TInt32 aUId)
+ const TUidSourceType aAddressType, const TInt32 aUId ,const TInt aEventType)
{
__TRACE_CALLSTACK;
SetFolderPathL();
TBuf<KImagePathSize> mImagePath;
-
- //mImagePath.Append(KImageStorageDrive);
mImagePath.Copy(imageFilePath);
- mImagePath.AppendNum(aUId);
- mImagePath.AppendNum(aAddressType);
- mImagePath.Append(KPNGType);
+
CMapTileRequest* mapTileRequest = new (ELeave) CMapTileRequest;
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()
@@ -794,59 +948,66 @@
// -----------------------------------------------------------------------------
//
void CMyLocationsEngine::RequestMapTileImageL(CPosLandmark& aLandmark,
- const TUidSourceType aAddressType, const TInt32 aUId)
+ const TUidSourceType aAddressType, const TInt32 aUId,
+ const TInt aEventType )
{
__TRACE_CALLSTACK;
MYLOCLOGSTRING("check folder path existance!");
SetFolderPathL();
- TBuf<KImagePathSize> mImagePath;
-
- //mImagePath.Append(KImageStorageDrive);
- mImagePath.Copy(imageFilePath);
- mImagePath.AppendNum(aUId);
- mImagePath.AppendNum(aAddressType);
- mImagePath.Append(KPNGType);
+
CMapTileRequest* mapTileRequest = new (ELeave) CMapTileRequest;
mapTileRequest->iLandmarkInfo = CPosLandmark::NewL(aLandmark);
mapTileRequest->iUId = aUId;
mapTileRequest->iAddressType = aAddressType;
- mapTileRequest->iEventType = iEventType;
+ mapTileRequest->iEventType = aEventType;
mapTileRequest->iImagePath.Zero();
- mapTileRequest->iImagePath.Copy(mImagePath);
+ mapTileRequest->iImagePath.Copy(imageFilePath);
MYLOCLOGSTRING1("RequestMapTileImageL() Queue count -%d",iMapTileRequestQueue.Count());
+ TInt error = KErrNone;
+
if (iMapTileRequestQueue.Count() <= 0)
{
- // iMapTileRequestQueue.Append(mapTileRequest);
- 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;
+ }
}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RequestExecute()
+// Executes the maptile image processing request
+// -----------------------------------------------------------------------------
+//
TInt CMyLocationsEngine::RequestExecute( CMapTileRequest* aMapTileRequest)
{
__TRACE_CALLSTACK;
TInt errorCode = KErrNone;
+ MYLOCLOGSTRING1("Request address type - %d ",aMapTileRequest->iAddressType);
switch (aMapTileRequest->iAddressType)
{
case ESourceCalendar:
{
- TRAP(errorCode,iMapTileInterface->GetMapTileImageL(aMapTileRequest->iAddressDetails->Des(),
+ TRAP(errorCode,iMapTileInterface->GetGeoCodeFromAddressL(*(aMapTileRequest->iAddressDetails),
aMapTileRequest->iImagePath, this ));
break;
}
@@ -854,7 +1015,7 @@
case ESourceContactsWork:
case ESourceContactsHome:
{
- TRAP(errorCode, iMapTileInterface->GetMapTileImageL(aMapTileRequest->iLandmarkInfo,
+ TRAP(errorCode, iMapTileInterface->GetGeoCodeFromAddressL(aMapTileRequest->iLandmarkInfo,
aMapTileRequest->iImagePath, this));
break;
}
@@ -870,285 +1031,43 @@
// get locatin details
// -----------------------------------------------------------------------------
//
-CPosLandmark* CMyLocationsEngine::GetContactAddressDetailsLC(
- const CContactItem *aContactItem, TContactAddressType aAddressType)
+CPosLandmark* CMyLocationsEngine::GetContactAddressDetailsLC(
+ QContactAddress& aContactAddress )
{
__TRACE_CALLSTACK;
CPosLandmark *landmark = NULL;
-
- // Set the street
- TInt adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapADR);
-
- if (adrId != KErrNotFound)
- {
- TPtrC tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- if (!landmark)
- {
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
- }
-
- landmark->SetPositionFieldL(EPositionFieldStreet, tempText);
- }
- }
-
- // Set the City
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapLOCALITY);
- if (adrId != KErrNotFound)
+
+ QString country = aContactAddress.country();
+ QString locality = aContactAddress.locality();
+ QString street = aContactAddress.street();
+ QString region = aContactAddress.region();
+ QString postalcode = aContactAddress.postcode();
+
+ landmark = CPosLandmark::NewL();
+ CleanupStack::PushL(landmark);
+
+ if ( !country.isEmpty() )
{
- TPtrC tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- if (!landmark)
- {
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
- }
- landmark->SetPositionFieldL(EPositionFieldCity, tempText);
- }
+ TPtrC16 tempText(reinterpret_cast<const TUint16*>(country.utf16()));
+ landmark->SetPositionFieldL( EPositionFieldCountry, tempText );
}
-
- // Set the state/region
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapREGION);
- if (adrId != KErrNotFound)
+ if ( !locality.isEmpty() )
{
- TPtrC tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- if (!landmark)
- {
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
- }
- landmark->SetPositionFieldL(EPositionFieldState, tempText);
- }
+ TPtrC16 tempText(reinterpret_cast<const TUint16*>(locality.utf16()));
+ landmark->SetPositionFieldL(EPositionFieldCity, tempText);
}
-
- // Set the Postal code
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapPOSTCODE);
- if (adrId != KErrNotFound)
+ if ( !street.isEmpty() )
+ {
+ TPtrC16 tempText(reinterpret_cast<const TUint16*>(street.utf16()));
+ landmark->SetPositionFieldL(EPositionFieldStreet, tempText);
+ }
+ if ( !postalcode.isEmpty() )
{
- TPtrC tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- if (!landmark)
- {
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
- }
- landmark->SetPositionFieldL(EPositionFieldPostalCode, tempText);
- }
+ TPtrC16 tempText(reinterpret_cast<const TUint16*>(postalcode.utf16()));
+ landmark->SetPositionFieldL(EPositionFieldPostalCode, tempText);
}
- // Set the country
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapCOUNTRY);
- if (adrId != KErrNotFound)
- {
- TPtrC tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- if (!landmark)
- {
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
- }
- landmark->SetPositionFieldL(EPositionFieldCountry, tempText);
- }
- }
-
- return landmark;
-
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsEngine::GetContactLocationDetailsLC()
-// Finds the contact's location details
-// -----------------------------------------------------------------------------
-//
-CPosLandmark* CMyLocationsEngine::GetContactLocationDetailsLC(
- const CContactItem *aContactItem, TContactAddressType aAddressType)
-{
- __TRACE_CALLSTACK;//return value
- CPosLandmark *landmark = NULL;
- // Get the geo field
- TInt addrInd = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapGEO);
- if (addrInd != KErrNotFound)
- {
- // Geo field present.
-
- TPtrC addrText =
- aContactItem->CardFields()[addrInd].TextStorage()->Text();
- if (addrText.Length() > 0)
- {
- //Parse the addresstext to get the latitude and longitude
- TInt separator = addrText.Find(KSeparator);
- if (separator != KErrNotFound)
- {
- TReal64 latitude = 0;
- TReal64 longitude = 0;
- TLex lexLatitude(addrText.Left(addrText.Length() - separator));
- TLex lexLongitude(addrText.Right(addrText.Length() - separator
- - 1));
- if (lexLatitude.Val(latitude) == KErrNone && lexLongitude.Val(
- longitude) == KErrNone)
- {
- TLocality loc(TCoordinate(latitude, longitude), 0);
-
- landmark = CPosLandmark::NewL();
- CleanupStack::PushL(landmark);
-
- // Fill the location details into the landmark object
- landmark->SetPositionL(loc);
-
- // Set the landmark name as contact name
- TBuf<KBufSize> sName1;
- TBool nameEmpty = ETrue;
- //get the second name and
- TInt sNameInd = aContactItem->CardFields().Find(
- KUidContactFieldGivenName);
- if (sNameInd != KErrNotFound)
- {
- TPtrC sName =
- aContactItem->CardFields()[sNameInd].TextStorage()->Text();
- sName1.Copy(sName);
- nameEmpty = EFalse;
- }
-
- sNameInd = aContactItem->CardFields().Find(
- KUidContactFieldFamilyName);
- if (sNameInd != KErrNotFound)
- {
- if (!nameEmpty)
- {
- sName1.Append(KSingleSpace);
- }
- TPtrC
- sName =
- aContactItem->CardFields()[sNameInd].TextStorage()->Text();
- sName1.Append(sName);
- }
-
- TRAP_IGNORE( landmark->SetLandmarkNameL( sName1 ) );
-
- // Set the street
- TInt adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapADR);
- if (adrId != KErrNotFound)
- {
- TPtrC
- tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- landmark->SetPositionFieldL(EPositionFieldStreet,
- tempText);
- }
- }
-
- // Set the City
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapLOCALITY);
- if (adrId != KErrNotFound)
- {
- TPtrC
- tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- landmark->SetPositionFieldL(EPositionFieldCity,
- tempText);
- }
- }
-
- // Set the state/region
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapREGION);
- if (adrId != KErrNotFound)
- {
- TPtrC
- tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- landmark->SetPositionFieldL(EPositionFieldState,
- tempText);
- }
- }
-
- // Set the Postal code
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapPOSTCODE);
- if (adrId != KErrNotFound)
- {
- TPtrC
- tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- landmark->SetPositionFieldL(
- EPositionFieldPostalCode, tempText);
- }
- }
-
- // Set the country
- adrId = FindContactsField(aContactItem, aAddressType,
- KUidContactFieldVCardMapCOUNTRY);
- if (adrId != KErrNotFound)
- {
- TPtrC
- tempText =
- aContactItem->CardFields()[adrId].TextStorage()->Text();
- if (tempText.Length() > 0)
- {
- landmark->SetPositionFieldL(EPositionFieldCountry,
- tempText);
- }
- }
- }
- }
- }
- }
-
- return landmark;
-}
-
-// -----------------------------------------------------------------------------
-// CMyLocationsEngine::FindContactsField()
-// Finds the contact's field type id
-// -----------------------------------------------------------------------------
-//
-
-TInt CMyLocationsEngine::FindContactsField(const CContactItem *aContactItem,
- TContactAddressType aAddressType, TUid aField)
-{
- __TRACE_CALLSTACK;
- if (aAddressType == EAddressPref) // default/prefered address
- {
- return aContactItem->CardFields().Find(aField);
- }
- else if (aAddressType == EAddressWork) // work address
- {
- return aContactItem->CardFields().Find(KUidContactFieldVCardMapWORK,
- aField);
- }
- else // home address
- {
- return aContactItem->CardFields().Find(KUidContactFieldVCardMapHOME,
- aField);
- }
+ return landmark;
}
// -----------------------------------------------------------------------------
@@ -1232,6 +1151,51 @@
return retVal;
}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::IsGeoCoordinateAvailable()
+// Checks whether geocoordinate available in the contact detail.
+// -----------------------------------------------------------------------------
+//
+TBool CMyLocationsEngine::IsGeoCoordinateAvailable( QContact& aContact,
+ QString aAddressType, double& aLatitude , double& aLongitude )
+
+{
+ TBool geoFieldAvailable = EFalse;
+ QContactGeoLocation geoLocation;
+
+ foreach( geoLocation, aContact.details<QContactGeoLocation>() )
+ {
+ if( !geoLocation.isEmpty())
+ {
+ QStringList context = geoLocation.contexts();
+ if ( context.isEmpty() )
+ {
+ if ( aAddressType.isEmpty() )
+ {
+ geoFieldAvailable = ETrue;
+ break;
+ }
+ }
+ else if( context.first() == aAddressType )
+ {
+ geoFieldAvailable = ETrue;
+ break;
+ }
+
+ }
+
+ }
+ if( geoFieldAvailable )
+ {
+ aLatitude = geoLocation.latitude();
+ aLongitude = geoLocation.longitude();
+ }
+ return geoFieldAvailable;
+}
+
+
+
// -----------------------------------------------------------------------------
// CMyLocationsEngine::RunL()
// Handles active object's request completion event.
@@ -1248,15 +1212,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:
@@ -1285,6 +1246,201 @@
}
// -----------------------------------------------------------------------------
+// CMyLocationsEngine::GeoCodefetchingCompleted()
+// Handles the maptile fetching completion event and updates the maptile lookup db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::GeoCodefetchingCompleted( TInt aErrCode, const TReal& aLatitude,
+ const TReal& aLongitude, const TDesC& aMapTilePath )
+{
+ __TRACE_CALLSTACK;
+ 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());
+
+ TLookupItem lookupItem;
+ lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType;
+ lookupItem.iUid = iMapTileRequestQueue[0]->iUId;
+
+ if (aErrCode == KErrNone)
+ {
+ UpdateGeoCodeToAppDataBase( aLatitude, aLongitude );
+
+ TBool flag = EFalse;
+ TRAP_IGNORE( flag = iMaptileDatabase->FindEntryByFilePathL(aMapTilePath) );
+ if ( flag )
+ {
+ MYLOCLOGSTRING1("%S - found in the DB",&aMapTilePath);
+
+
+ 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
+ ProcessNextMaptileRequest();
+
+ }
+ else
+ {
+ TRAPD( error, iMapTileInterface->GetMapTileL( aLatitude, aLongitude ) );
+ if ( error != KErrNone )
+ {
+ //Log error message
+ MYLOCLOGSTRING1("iMapTileInterface->GetMapTileL() status-%d",error);
+ MapTilefetchingCompleted(error, KNullDesC);
+ }
+ }
+ }
+ else
+ {
+ if ( aErrCode == KErrCouldNotConnect )
+ {
+ lookupItem.iFetchingStatus = EMapTileFetchingNetworkError;
+ iMyLocationThreeAMTimer->StartTimer();
+
+ }
+ else
+ {
+ lookupItem.iFetchingStatus = EMapTileFetchingUnknownError;
+ }
+ 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();
+ }
+ }
+}
+
+
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::MyLocationThreeAMTimerExpiredL()
+// Triggers the maptile fetching at 3.00 for the network failure cases.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::MyLocationThreeAMTimerExpiredL()
+{
+ //Forward the event for maptile fetching only if maptile plugin available
+ if( iMaptileGeocoderPluginAvailable )
+ {
+ RArray<TLookupItem> iLookupItems;
+ iMaptileDatabase->FindEntriesByMapTileFetchingStateL((TUint32)EMapTileFetchingNetworkError,
+ iLookupItems);
+ for( TUint32 i = 0; i < iLookupItems.Count(); i++ )
+ {
+ TLookupItem iItem = iLookupItems[i];
+ switch( iItem.iSource )
+ {
+ // Get the home address details
+ case ESourceContactsHome:
+ case ESourceContactsWork:
+ case ESourceContactsPref:
+ {
+ QContact contactInfo = iContactManager->contact( iItem.iUid );
+
+ //Get the contact name details
+ QContactName name = contactInfo.detail( QContactName::DefinitionName );
+ QString firstName = name.firstName();
+ QString lastName = name.lastName();
+ TPtrC16 tempPtr1(reinterpret_cast<const TUint16*>(firstName.utf16()));
+ TPtrC16 tempPtr2( reinterpret_cast <const TUint16*>(lastName.utf16()));
+
+ TBuf<KBufSize> landmarkName;
+ landmarkName.Append( tempPtr1 );
+ landmarkName.Append( tempPtr2 );
+
+ CPosLandmark *addressLm = NULL;
+
+ foreach ( QContactAddress address, contactInfo.details<QContactAddress>() )
+ {
+ QStringList context = address.contexts();
+ 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 )
+ {
+ addressLm->SetLandmarkNameL( landmarkName );
+ RequestMapTileImageL( *addressLm,
+ ( TUidSourceType )iItem.iSource, iItem.iUid, EContactDbObserverEventContactChanged );
+ CleanupStack::PopAndDestroy( addressLm );
+ break;
+ }
+ }
+ }
+ }
+ break;
+
+ case ESourceCalendar:
+ {
+ CCalEntry* calEntry = NULL;
+ calEntry = iCalView->FetchL(iItem.iUid);
+ if( calEntry )
+ {
+ CleanupStack::PushL(calEntry);
+ TPtrC address(calEntry->LocationL());
+ if(address.Length()>0)
+ {
+ RequestMapTileImageL( address, ESourceCalendar, iItem.iUid , EChangeModify);
+ }
+ CleanupStack::PopAndDestroy(calEntry);
+ }
+ else
+ {
+ iMaptileDatabase->DeleteEntryL( iItem );
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+ }// end for
+ }
+}
+
+
+// -----------------------------------------------------------------------------
// CMyLocationsEngine::MapTilefetchingCompleted()
// Handles the maptile fetching completion event and updates the maptile lookup db.
// -----------------------------------------------------------------------------
@@ -1296,63 +1452,107 @@
MYLOCLOGSTRING1("MapTilefetchingCompleted aErrCode - %d ",aErrCode);
MYLOCLOGSTRING1("iMapTileRequestQueue.Count - %d",iMapTileRequestQueue.Count());
- if (iMapTileRequestQueue.Count() > 0)
+ if ( iMapTileRequestQueue.Count() > 0 )
{
MYLOCLOGSTRING1("No.of RequestQueue - %d",iMapTileRequestQueue.Count());
- if (aErrCode == KErrNone )
+ TLookupItem lookupItem;
+ lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType;
+ lookupItem.iUid = iMapTileRequestQueue[0]->iUId;
+
+ if ( aErrCode == KErrNone )
{
- TLookupItem lookupItem;
- lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType;
- lookupItem.iUid = iMapTileRequestQueue[0]->iUId;
+ CreateMultipleMaptiles( aMapTilePath );
lookupItem.iFilePath.Copy(aMapTilePath);
- TRAP_IGNORE( HandleMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType,lookupItem ) );
+ lookupItem.iFetchingStatus = EMapTileFectchingCompleted;
+
}
+ else if ( aErrCode == KErrCouldNotConnect )
+ {
+ lookupItem.iFetchingStatus = EMapTileFetchingNetworkError;
+ iMyLocationThreeAMTimer->StartTimer();
+
+ }
+ else
+ {
+ lookupItem.iFetchingStatus = EMapTileFetchingUnknownError;
+ }
+
+ TRAP_IGNORE( UpdateMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType,lookupItem ) );
- delete iMapTileRequestQueue[0];
- iMapTileRequestQueue.Remove(0);
- iMapTileRequestQueue.Compress();
+ //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();
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::ProcessNextMaptileRequest()
+// Process the next maptile request if any pending.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::ProcessNextMaptileRequest()
+{
+ //Process the next request if it is pending
+ if ( iMapTileRequestQueue.Count() > 0)
+ {
+ //Remove the current top request
+ delete iMapTileRequestQueue[0];
+ iMapTileRequestQueue.Remove(0);
+ iMapTileRequestQueue.Compress();
- //Process the next request
- if (iMapTileRequestQueue.Count() > 0)
- {
+ //Process the next request in queue
MYLOCLOGSTRING1("MapTile fetch completed request-%d",iMapTileRequestQueue.Count());
for (TInt cnt = 0; cnt < iMapTileRequestQueue.Count(); cnt++)
{
- if ( KErrNone == RequestExecute(iMapTileRequestQueue[0]) )
+ if ( KErrNone == RequestExecute( iMapTileRequestQueue[0]) )
{
- break;
+ break;
}
else
{
- delete iMapTileRequestQueue[0];
- iMapTileRequestQueue.Remove(0);
- iMapTileRequestQueue.Compress();
+ //Process the next request in queue
+ ProcessNextMaptileRequest();
+
}
}
}
else
{
- MYLOCLOGSTRING("MapTile fetch completed no request in queue");
- iMapTileRequestQueue.Reset();
- }
+ MYLOCLOGSTRING("MapTile fetch completed no request in queue");
+ iMapTileRequestQueue.Reset();
+ }
+}
-}
// -----------------------------------------------------------------------------
// CMyLocationsEngine::HandleMaptileDatabaseL()
// Handle maptile database(find/create/update/delete).
// -----------------------------------------------------------------------------
//
-void CMyLocationsEngine::HandleMaptileDatabaseL(
+void CMyLocationsEngine::UpdateMaptileDatabaseL(
TInt aEventType, TLookupItem& aLookupItem)
{
__TRACE_CALLSTACK;
if (aEventType == EContactDbObserverEventContactChanged || aEventType
- == EChangeModify)
+ == EChangeModify || aEventType == EContactDbObserverEventContactAdded ||
+ aEventType == EChangeAdd )
{
+
if (iMaptileDatabase->FindEntryL(aLookupItem))
{
iMaptileDatabase->UpdateEntryL(aLookupItem);
@@ -1362,14 +1562,27 @@
iMaptileDatabase->CreateEntryL(aLookupItem);
}
}
- else if (aEventType == EContactDbObserverEventContactAdded || aEventType
- == EChangeAdd)
+ if (aLookupItem.iFetchingStatus == EMapTileFetchingUnknownError
+ || aLookupItem.iFetchingStatus == EMapTileFetchingNetworkError)
{
- iMaptileDatabase->CreateEntryL(aLookupItem);
+ TRAP_IGNORE( UpdateDatabaseL( NULL,
+ aLookupItem.iUid, aLookupItem.iSource, EEntryDeleted ) );
}
- iMyLocationsDatabaseManager->UpdateMapTilePath( aLookupItem.iUid, aLookupItem.iSource,
- aLookupItem.iFilePath );
+ else
+ {
+ TPtrC8 ptr(reinterpret_cast<const TUint8*>(MAPTILE_IMAGE_HURRIGANES));
+ HBufC* buffer = NULL;
+ buffer=HBufC::NewLC(ptr.Length());
+ buffer->Des().Copy(ptr);
+ if(buffer)
+ {
+ aLookupItem.iFilePath.Append(*buffer);
+ }
+ CleanupStack::PopAndDestroy(buffer);
+ iMyLocationsDatabaseManager->UpdateMapTilePath(aLookupItem.iUid,
+ aLookupItem.iSource, aLookupItem.iFilePath);
+ }
}
// -----------------------------------------------------------------------------
@@ -1378,7 +1591,7 @@
// started lat and lon field updation into contact db.
// -----------------------------------------------------------------------------
//
-void CMyLocationsEngine::RestGeoCodeCompleted(TReal aLatitude, TReal aLongitude)
+void CMyLocationsEngine::UpdateGeoCodeToAppDataBase( TReal aLatitude, TReal aLongitude )
{
__TRACE_CALLSTACK;
@@ -1389,30 +1602,43 @@
{
//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");
+ {
+ iGeocodeUpdate->updateGeocodeToCalenderDB(iMapTileRequestQueue[0]->iUId,
+ aLatitude,aLongitude);
+ 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(
+ iGeocodeUpdate->updateGeocodeToContactDB(
iMapTileRequestQueue[0]->iUId,
iMapTileRequestQueue[0]->iAddressType, aLatitude,
aLongitude);
+ //Update mylocation database
+ TRAP_IGNORE( UpdateDatabaseL(
+ iMapTileRequestQueue[0]->iLandmarkInfo,
+ iMapTileRequestQueue[0]->iUId,
+ iMapTileRequestQueue[0]->iAddressType,
+ MapChangeType(
+ static_cast<TUidSourceType>( iMapTileRequestQueue[0]->iAddressType ),
+ iMapTileRequestQueue[0]->iEventType )));
+
MYLOCLOGSTRING("Geo-codinate updated to contact db");
break;
}
};
-
-
}
}
@@ -1435,5 +1661,87 @@
}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::ManipulateMapTileDataBaseL()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::ManipulateMapTileDataBaseL(TLookupItem& aLookupItem)
+{
+ __TRACE_CALLSTACK;
+ TBool entryAvailable=EFalse;
+ entryAvailable = iMaptileDatabase->FindEntryL(aLookupItem);
+ iMaptileDatabase->DeleteEntryL(aLookupItem);
+ if (entryAvailable)
+ {
+ iMaptileDatabase->DeleteMapTileL(aLookupItem);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CreateMultipleMaptiles()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::CreateMultipleMaptiles( const TDesC& aMaptilePath )
+{
+ __TRACE_CALLSTACK;
+ QString filePath = QString::fromUtf16( aMaptilePath.Ptr(), aMaptilePath.Length() );
+
+ //Portrait image , common for contacts/calendar/context menu
+ CropAndSaveImage( filePath,
+ MaptilePortraitWidth,
+ MaptilePortraitHeight,
+ QString(),
+ QString( MAPTILE_IMAGE_PORTRAIT ) );
+
+ //Landscape image for contacts
+ CropAndSaveImage( filePath,
+ MaptileContactLandscapeWidth,
+ MaptileContactLandscapeHeight,
+ QString( MAPTILE_IMAGE_CONTACT ),
+ QString( MAPTILE_IMAGE_LANDSCAPE ) );
+
+ //Ladscape image for calendar
+ CropAndSaveImage( filePath,
+ MaptileCalendarLandscapeWidth,
+ MaptileCalendarLandscapeHeight,
+ QString( MAPTILE_IMAGE_CALENDAR ),
+ QString( MAPTILE_IMAGE_LANDSCAPE ) );
+
+ //Image for hurriganes
+ CropAndSaveImage( filePath,
+ MaptileHurriganesWidth,
+ MaptileHurriganesHeight,
+ QString( MAPTILE_IMAGE_HURRIGANES ),
+ QString() );
+ QFile file(filePath);
+ file.remove();
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CropAndSaveImage()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::CropAndSaveImage( QString filePath, int width,
+ int height, QString appType, QString orientationType )
+{
+ __TRACE_CALLSTACK;
+ QImage SourcePNG( filePath );
+ QImage sourcePixmap( SourcePNG.convertToFormat(QImage::Format_Indexed8));
+ QImage targetPixmap( sourcePixmap.copy(
+ ( MapTileWidth - width )/2,
+ ( MapTileHeight - height )/2 ,
+ width,
+ height ) );
+
+ QString targetImage;
+ targetImage.append( filePath );
+ targetImage.append( appType );
+ targetImage.append( orientationType );
+ targetPixmap.save( targetImage, MAPTILE_IMAGE_TYPE );
+
+}
+
//End of file
--- a/locationdataharvester/mylocationsengine/src/mylocationslookupdb.cpp Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,410 +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: Mylocation database lookup table implementation.
-*
-*/
-
-#include <bautils.h>
-#include <EPos_CPosLmCategoryManager.h>
-#include "mylocationslookupdb.h"
-#include "mylocationlogger.h"
-// select all from
-_LIT( KSelectAllFrom, "SELECT * FROM " );
-// string 'where'
-_LIT( KStringWhere, " WHERE " );
-// string ' = '
-_LIT( KStringEqual, " = " );
-// string 'And'
-_LIT( KStringAnd, " AND " );
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::CLookupDatabase()
-// Default constructor.
-// -----------------------------------------------------------------------------
-//
-CLookupDatabase::CLookupDatabase()
-{
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::~CLookupDatabase()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CLookupDatabase::~CLookupDatabase()
-{
- __TRACE_CALLSTACK;// close the database
- iItemsDatabase.Close();
- // close the file session
- iFsSession.Close();
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::~CLookupDatabase()
-// Creates an object of this class and pushes to cleanup stack.
-// -----------------------------------------------------------------------------
-//
-CLookupDatabase* CLookupDatabase::NewLC(const TDesC& aLookupTableName)
-{
- CLookupDatabase* self = new (ELeave) CLookupDatabase;
- CleanupStack::PushL(self);
- self->ConstructL(aLookupTableName);
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::NewL()
-// Creates an object of this class.
-// -----------------------------------------------------------------------------
-//
-CLookupDatabase* CLookupDatabase::NewL(const TDesC& aLookupTableName)
-{
- CLookupDatabase* self = CLookupDatabase::NewLC(aLookupTableName);
- CleanupStack::Pop(self);
- return self;
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::ConstructL()
-// 2nd phase contructor.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::ConstructL(const TDesC& aLookupTableName)
-{
- __TRACE_CALLSTACK;
- User::LeaveIfError(iFsSession.Connect());
-
- //create private path
- User::LeaveIfError(iFsSession.CreatePrivatePath(RFs::GetSystemDrive()));
- // private path with no drive on it
- iFsSession.PrivatePath(iDbFileName);
-
- TFindFile PrivFolder(iFsSession);
- // find out the drive
- if (KErrNone == PrivFolder.FindByDir(iDbFileName, KNullDesC))
- {
- iFsSession.MkDir(KLookupDbPath);
- iDbFileName.Copy(KLookupDbPath);
- iDbFileName.Append(aLookupTableName);
-
- if (!BaflUtils::FileExists(iFsSession, iDbFileName))
- { // no database exists so we make one
- User::LeaveIfError(iItemsDatabase.Create(iFsSession, iDbFileName));
- // and will create the only table needed for it
- CreateTableL(iItemsDatabase);
-
- //close the database
- iItemsDatabase.Close();
- }
- }
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::Open()
-// Opens the lookup database.
-// -----------------------------------------------------------------------------
-//
-TInt CLookupDatabase::Open()
-{
- __TRACE_CALLSTACK;
- return iItemsDatabase.Open(iFsSession, iDbFileName);
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::Close()
-// Closes the lookup database.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::Close()
-{
- __TRACE_CALLSTACK;
- iItemsDatabase.Close();
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::CreateTableL()
-// Creates a lookup table.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::CreateTableL(RDbDatabase& aDatabase)
-{
- __TRACE_CALLSTACK;// Create a table definition
- CDbColSet* columns = CDbColSet::NewLC();
-
- // Add Columns
-
- // Add uid column
- columns->AddL(TDbCol(NColUid, EDbColUint32));
-
- // add source type column
- columns->AddL(TDbCol(NColSource, EDbColUint32));
-
- // add landmark uid column
- columns->AddL(TDbCol(NColLmUid, EDbColUint32));
-
- // Create a table
- User::LeaveIfError(aDatabase.CreateTable(KLookupTable, *columns));
-
- // cleanup the column set
- CleanupStack::PopAndDestroy(columns);
-}
-
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::CreateEntryL()
-// Creates an entry in the lookup table.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::CreateEntryL(const TLookupItem& aLookupItem)
-{
- __TRACE_CALLSTACK;// create a query for the view
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
-
- iItemsDatabase.Begin();
-
- RDbView myView;
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
-
- // Inert the item
- myView.InsertL();
-
- // set the fields
- myView.SetColL(KColumnUid, aLookupItem.iUid);
- myView.SetColL(KColumnSource, aLookupItem.iSource);
- myView.SetColL(KColumnLmkUid, aLookupItem.iLmId);
-
- myView.PutL();
-
- CleanupStack::PopAndDestroy(&myView); // myView
- iItemsDatabase.Commit();
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::UpdateEntryL()
-// Updates an entry in the lookup table.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::UpdateEntryL(const TLookupItem& aLookupItem)
-{
- __TRACE_CALLSTACK;// Create the query to find the row to be updated.
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
- queryBuffer.Append(KStringWhere);
- queryBuffer.Append(NColUid);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iUid);
- queryBuffer.Append(KStringAnd);
- queryBuffer.Append(NColSource);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iSource);
-
- iItemsDatabase.Begin();
-
- // Create a view of the table based on the query created.
- RDbView myView;
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
-
- myView.EvaluateAll();
- myView.FirstL();
-
- if (myView.AtRow())
- {
- // found the entry. update it.
- myView.UpdateL();
- myView.SetColL(KColumnLmkUid, aLookupItem.iLmId);
- myView.PutL();
- }
-
- CleanupStack::PopAndDestroy(&myView); // myView
- iItemsDatabase.Commit();
-
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::DeleteEntryL()
-// Deletes an entry from the lookup table.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::DeleteEntryL(const TLookupItem& aLookupItem)
-{
- __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
- queryBuffer.Append(KStringWhere);
- queryBuffer.Append(NColUid);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iUid);
- queryBuffer.Append(KStringAnd);
- queryBuffer.Append(NColSource);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iSource);
-
- iItemsDatabase.Begin();
-
- RDbView myView;
- // query buffer finds only the selected item row.
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
-
- myView.EvaluateAll();
-
- // positions the cursor on the first row of the rowset
- myView.FirstL();
-
- // Delete the entry found.
- if (myView.AtRow())
- {
- myView.GetL();
- myView.DeleteL();
- }
-
- CleanupStack::PopAndDestroy(&myView); // myView
- iItemsDatabase.Commit();
- // compacts the databse, by physicaly removing deleted data.
- iItemsDatabase.Compact();
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::FindEntryL()
-// Finds an entry in the lookup table.
-// -----------------------------------------------------------------------------
-//
-TBool CLookupDatabase::FindEntryL(TLookupItem& aLookupItem)
-{
- __TRACE_CALLSTACK;// used to store return value
- TBool retVal = EFalse;
-
- // Create a query to find the item.
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
- queryBuffer.Append(KStringWhere);
- queryBuffer.Append(NColUid);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iUid);
- queryBuffer.Append(KStringAnd);
- queryBuffer.Append(NColSource);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLookupItem.iSource);
-
- // Create a view of the table with the above query.
- RDbView myView;
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
- myView.EvaluateAll();
- myView.FirstL();
-
- if (myView.AtRow())
- {
- // Item found. get the details.
- myView.GetL();
-
- aLookupItem.iUid = myView.ColUint(KColumnUid);
- aLookupItem.iSource = myView.ColUint(KColumnSource);
- aLookupItem.iLmId = myView.ColUint(KColumnLmkUid);
- retVal = ETrue;
- }
-
- CleanupStack::PopAndDestroy(&myView); // myView
-
- return retVal;
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::FindEntriesByLandmarkIdL()
-// Finds a list of lookup items given a landmark uid.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::FindEntriesByLandmarkIdL(const TUint32 aLandmarkId,
- RArray<TLookupItem>& aLookupItemArray)
-{
- __TRACE_CALLSTACK;// Create a query to find the item.
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
- queryBuffer.Append(KStringWhere);
- queryBuffer.Append(NColLmUid);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aLandmarkId);
-
- // Create a view of the table with the above query.
- RDbView myView;
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
- myView.EvaluateAll();
- myView.FirstL();
-
- while (myView.AtRow())
- {
- // Item found. get the details.
- myView.GetL();
- TLookupItem newItem;
- newItem.iUid = myView.ColUint(KColumnUid);
- newItem.iSource = myView.ColUint(KColumnSource);
- newItem.iLmId = myView.ColUint(KColumnLmkUid);
- aLookupItemArray.Append(newItem);
- myView.NextL();
- }
-
- CleanupStack::PopAndDestroy(&myView); // myView
-}
-
-// -----------------------------------------------------------------------------
-// CLookupDatabase::FindEntriesByLandmarkIdL()
-// Finds a list of lookup items given a landmark uid.
-// -----------------------------------------------------------------------------
-//
-void CLookupDatabase::FindEntriesBySourceTypeL(const TUint32 aSourceType,
- RArray<TLookupItem>& aLookupItemArray)
-{
- __TRACE_CALLSTACK;// Create a query to find the item.
- TFileName queryBuffer;
- queryBuffer.Copy(KSelectAllFrom);
- queryBuffer.Append(KLookupTable);
- queryBuffer.Append(KStringWhere);
- queryBuffer.Append(NColSource);
- queryBuffer.Append(KStringEqual);
- queryBuffer.AppendNum(aSourceType);
-
- // Create a view of the table with the above query.
- RDbView myView;
- myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
- CleanupClosePushL(myView);
- myView.EvaluateAll();
- myView.FirstL();
-
- while (myView.AtRow())
- {
- // Item found. get the details.
- myView.GetL();
-
- TLookupItem newItem;
- newItem.iUid = myView.ColUint(KColumnUid);
- newItem.iSource = myView.ColUint(KColumnSource);
- newItem.iLmId = myView.ColUint(KColumnLmkUid);
- aLookupItemArray.Append(newItem);
- myView.NextL();
- }
-
- CleanupStack::PopAndDestroy(&myView); // myView
-}
-
-// End of file
-
--- a/locationdataharvester/rom/mylocations.iby Fri Jun 11 16:23:56 2010 +0100
+++ b/locationdataharvester/rom/mylocations.iby Thu Jul 22 16:31:43 2010 +0100
@@ -23,8 +23,13 @@
file=ABI_DIR\BUILD_DIR\geocodeupdate.dll PROGRAMS_DIR\geocodeupdate.dll
file=ABI_DIR\BUILD_DIR\maptileservice.dll PROGRAMS_DIR\maptileservice.dll
file=ABI_DIR\BUILD_DIR\locationdatalookupdb.dll PROGRAMS_DIR\locationdatalookupdb.dll
+file=ABI_DIR\BUILD_DIR\mylocationsdatabasemanager.dll PROGRAMS_DIR\mylocationsdatabasemanager.dll
+
//Resource file(s) for Mylocations application (mylocations.iby)
-data=DATAZ_\APP_RESOURCE_DIR\mylocations.rsc APP_RESOURCE_DIR\mylocations.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 Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,70 @@
+/*
+* 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 );
+
+#ifdef LOCPICKER_UNIT_TEST
+public:
+#else
+private:
+#endif
+ //Image Type
+ TImageType mImageType;
+ //default Image type
+ HbIcon mDefaultImage;
+ //low resolution image
+ bool mUseLowResImages;
+ //proxymodel
+ LocationPickerProxyModel *mProxyModel;
+};
+
+#endif // HgWidgetDataModel_H
+
--- a/locationpickerservice/inc/locationpickerappwindow.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickerappwindow.h Thu Jul 22 16:31:43 2010 +0100
@@ -24,10 +24,9 @@
// Forward declarations
class LocationPickerSearchView;
class LocationPickerDocumentLoader;
-class LocationPickerPotraitView;
+class LocationPickerView;
class LocationPickerService;
class LocationPickerProxyModel;
-class LocationPickerLandscapeView;
class LocationPickerContent;
class LocationPickerAppWindow: public HbMainWindow
@@ -41,19 +40,22 @@
// destructor
~LocationPickerAppWindow();
-private:
- //Loads the Potrait View
- void loadPotrait();
- //Loads landscape View
- void loadLandscape();
+#ifdef LOCPICKER_UNIT_TEST
+public slots:
+#else
+private slots:
+#endif
//Connect the slots for Potrait view
- void connectPotraitSlots();
- //Connect the slots for Landscape view
- void connectLandscapeSlots();
+ void connectSlots();
public slots:
// a list item is selected
void itemSelected( quint32 aLm );
+#ifdef LOCPICKER_UNIT_TEST
+public slots:
+#else
private slots:
+#endif
+
//activate search view
void activateSearchView();
//activate locationpicker view
@@ -62,28 +64,23 @@
void changeOrientation( Qt::Orientation );
//complete the service
void serviceComplete();
- //sets the category ID during orientation change in collection content
- void setCategoryId( quint32 acategoryId );
- //handles orientation change in collection list
- void handleCollectionList();
- //handle all List
- void allListHandle();
- //clear content models
- void clearContentModels();
+ //slot to close details dialog (if open)
+ void closeDetailsDialog();
+
+#ifdef LOCPICKER_UNIT_TEST
+public:
+#else
private:
+#endif
// search view
LocationPickerSearchView* mLocationPickerSearchView;
//document loader
LocationPickerDocumentLoader* mLocationPickerDocumentLoader;
//location picker potrait view
- LocationPickerPotraitView* mLocationPickerPotraitView;
- //location picker landscape view
- LocationPickerLandscapeView* mLocationPickerLandscapeView;
+ LocationPickerView* mLocationPickerView;
//locationpicker content
LocationPickerContent* mLocationPickerContent;
//location picker service;
LocationPickerService *mService;
- //View Type
- TViewType mviewType;
};
#endif // LOCATIONPICKERAPPWINDOW_H
--- a/locationpickerservice/inc/locationpickercollectioncontent.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickercollectioncontent.h Thu Jul 22 16:31:43 2010 +0100
@@ -29,19 +29,16 @@
{
public:
// constructor
- LocationPickerCollectionContent( Qt::Orientations aOrientation , quint32 aCollectionid );
+ LocationPickerCollectionContent( quint32 aCollectionid );
//Destructor
~LocationPickerCollectionContent();
//get proxy model
LocationPickerProxyModel* getProxyModel();
- //get standard model
- QStandardItemModel* getStandardModel();
// gets the data pointed to by index and copies to the aValue
void getData( QModelIndex aIndex, quint32& aValue );
//return true if location entry is found
bool locationFound();
private:
- Qt::Orientations mOrientation;
LocationPickerProxyModel *mProxyModel;
QStandardItemModel *mModel;
LocationPickerDataManager *mDataManager;
--- a/locationpickerservice/inc/locationpickercollectionlistcontent.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickercollectionlistcontent.h Thu Jul 22 16:31:43 2010 +0100
@@ -29,7 +29,7 @@
public:
// constructor
- LocationPickerCollectionListContent( Qt::Orientation aOrientation );
+ LocationPickerCollectionListContent();
// destructor
~LocationPickerCollectionListContent();
@@ -39,8 +39,9 @@
void getData( QModelIndex aIndex, quint32& aValue );
private:
- Qt::Orientation mOrientation;
+ //standard Item Model
QStandardItemModel *mModel;
+ //datamanager
LocationPickerDataManager *mDataManager;
};
--- a/locationpickerservice/inc/locationpickercontent.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickercontent.h Thu Jul 22 16:31:43 2010 +0100
@@ -39,21 +39,17 @@
// destructor
~LocationPickerContent();
- //get standard List Model
- QStandardItemModel* getStandardListModel();
-
//get standard Grid Model
- QStandardItemModel* getStandardGridModel();
+ QStandardItemModel* getStandardModel();
void createNoEntryDisplay( QStandardItemModel *aModel );
- bool populateModel( Qt::Orientation aOrientation );
+ bool populateModel();
private:
Qt::Orientations mOrientation;
LocationPickerDataManager *mDataManager;
- QStandardItemModel *mListModel;
- QStandardItemModel *mGridModel;
+ QStandardItemModel *mStandardModel;
};
--- a/locationpickerservice/inc/locationpickerdatamanager.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickerdatamanager.h Thu Jul 22 16:31:43 2010 +0100
@@ -40,7 +40,7 @@
public:
// populates the model with data
bool populateModel( QStandardItemModel &aModel, TViewType aViewType,
- Qt::Orientations aOrientation,quint32 aCollectionId = 0);
+ quint32 aCollectionId = 0);
// gets the location item
void getLocationItem( quint32 aLmId, QLocationPickerItem &aItem );
--- a/locationpickerservice/inc/locationpickerdatamanager_p.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickerdatamanager_p.h Thu Jul 22 16:31:43 2010 +0100
@@ -39,7 +39,7 @@
// populates the model with data
bool populateModel( QStandardItemModel &aModel, TViewType aViewType,
- const Qt::Orientations aOrientation, quint32 aCollectionId = 0 );
+ quint32 aCollectionId = 0 );
// gets the location item
void getLocationItem( quint32 aLmId, QLocationPickerItem &aItem );
@@ -48,10 +48,9 @@
// populates landmarks
bool populateLandmarks( QList<QLookupItem> &aItemArray );
// populates collections
- void populateCollections();
+ void populateCollections( QList<int>& aCount );
private:
- Qt::Orientations mOrientation;
QStandardItemModel *mModel;
TViewType mViewType;
LocationDataLookupDb *mDb;
--- a/locationpickerservice/inc/locationpickerlandscapeview.h Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +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: LocationPickerLandscapeView declaration
-*
-*/
-
-#ifndef LOCATIONPICKERLANDSCAPEVIEW_H_
-#define LOCATIONPICKERLANDSCAPEVIEW_H_
-
-
-
-#include <HbView>
-#include <hbdocumentloader.h>
-#include "locationpickertypes.h"
-
-//forward declarations
-class HbListView;
-class QStandardItemModel;
-class LocationPickerProxyModel;
-class LocationPickerCollectionContent;
-class LocatipnPickerProxyModel;
-class HbGridViewItem;
-class HbGridView;
-class HbAction;
-
-/**
- * Class defines the location picker view
- */
-class LocationPickerLandscapeView : public HbView
-{
-
- Q_OBJECT
-public:
- // constructor
- LocationPickerLandscapeView( HbDocumentLoader* aLoader );
- // destructor
- ~LocationPickerLandscapeView();
-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();
- //Create collection list and sets to list view
- void setCollectionData( quint32 aCategoryId );
- //Set Ctegory ID
- void setCategoryID( quint32 aCategoryId );
- //Get the view type
- TViewType getViewType();
- //set the view type
- void setViewType( TViewType aViewType );
- //clear collection content
- void clearContentModel();
-private slots:
- //slot to handle list item actions
- void handleActivated( const QModelIndex &aIndex );
- //slots to handle menu action items
- void sortDescending();
- void sortAscending();
- void backButtonTriggered();
- //slot to handle search tab
- void searchTabTriggered();
-public slots:
- //slot to handle all tab
- void allTabTriggered();
- //slot to handle collection tab
- void colectionTabTriggered();
-signals:
- void switchToSearchView();
- void handleCollectionList();
- void selectItem( quint32 aLm );
- void completeService();
- void sendCategoryID( quint32 acategoryId );
- void collectionContentExited();
-private:
- //document loader
- HbDocumentLoader* mDocumentLoader;
- //locationPickerProxyModel
- LocationPickerProxyModel *mProxyModel;
- QStandardItemModel *mModel;
- //actions
- HbAction *mAllAction;
- HbAction *mCollectionAction;
- HbAction *mSearchAction;
- HbAction *mAscendingAction;
- 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;
-
-};
-
-#endif /* LOCATIONPICKERLANDSCAPEVIEW_H_ */
--- a/locationpickerservice/inc/locationpickerpotraitview.h Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +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: LocationPickerPotraitView declaration
-*
-*/
-
-#ifndef LOCATIONPICKERPOTRAITVIEW_H
-#define LOCATIONPICKERPOTRAITVIEW_H
-
-
-#include <HbView>
-#include <hbdocumentloader.h>
-#include "locationpickertypes.h"
-
-//forward declarations
-class HbListView;
-class QStandardItemModel;
-class LocationPickerProxyModel;
-class LocationPickerCollectionListContent;
-class LocationPickerCollectionContent;
-class HbListViewItem;
-class HbAction;
-
-/**
- * Class defines the location picker view
- */
-class LocationPickerPotraitView : public HbView
-{
- Q_OBJECT
-public:
- // constructor
- LocationPickerPotraitView( HbDocumentLoader* aLoader );
- // destructor
- ~LocationPickerPotraitView();
-public:
- //disable the tabs
- void disableTabs( QStandardItemModel *aModel );
- //get the items from docml and connect to respective slots
- void init( bool aPopulated, Qt::Orientation aOrientation, QStandardItemModel *aModel );
- //Set the appropriate model on list view
- void manageListView();
- //Create collection list and sets to list view
- void setCollectionData( quint32 acategoryId );
- //Set Ctegory ID
- void setCategoryID( quint32 acategoryId );
- //Get the view type
- TViewType getViewType();
- //set the view type
- void setViewType( TViewType aViewType );
- //clear collection Model
- void clearContentModel();
-private slots:
- //slot to handle list item actions
- void handleActivated( const QModelIndex &aIndex );
- //slots to handle menu action items
- void sortDescending();
- void sortAscending();
- void backTriggered();
- //slot to handle search tab
- void searchTabTriggered();
-public slots:
- //slot to handle all tab
- void allTabTriggered();
- //slot to handle collection tab
- void colectionTabTriggered();
-signals:
- void switchToSearchView();
- void selectItem( quint32 aLm );
- void completeService();
- void sendCategoryID( quint32 aCategoryId );
- void handleAllList();
- void collectionContentExited();
-private:
- //document loader
- HbDocumentLoader* mDocumentLoader;
- // collection list content
- LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
- //locationPickerProxyModel
- LocationPickerProxyModel *mProxyModel;
- //standard model
- QStandardItemModel *mModel;
- //actions
- HbAction *mAllAction;
- HbAction *mCollectionAction;
- HbAction *mSearchAction;
- HbAction *mAscendingAction;
- HbAction *mDescendingAction;
- //secondary back action
- HbAction *mPotraitBackAction;
- // list view
- HbListView *mListView;
- //list item
- HbListViewItem *mListItem;
- //collection content
- LocationPickerCollectionContent *mCollectionContent;
- //ViewType
- TViewType mViewType ;
- // get the collection/category id
- quint32 mCategoryId;
-};
-
-
-#endif // LOCATIONPICKERPOTRAITVIEW_H
--- a/locationpickerservice/inc/locationpickerproxymodel.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickerproxymodel.h Thu Jul 22 16:31:43 2010 +0100
@@ -31,7 +31,7 @@
public:
// constructor
- LocationPickerProxyModel( Qt::Orientations aOrientation , QObject *parent = 0 );
+ LocationPickerProxyModel( QObject *parent = 0 );
// used to
void filterParameterChanged( QString aSearchText );
@@ -45,7 +45,6 @@
private:
// search string
QString mSearchText;
- Qt::Orientations mOrientation;
};
--- a/locationpickerservice/inc/locationpickersearchview.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickersearchview.h Thu Jul 22 16:31:43 2010 +0100
@@ -29,6 +29,9 @@
class HbDocumentLoader;
class HbTextItem;
class QGraphicsLinearLayout;
+class HbAbstractViewItem;
+class QPoint;
+class HbMenu;
/**
* Class defines the search view of location picker
@@ -45,19 +48,33 @@
void init( QStandardItemModel *aModel );
private:
void getData( QModelIndex aIndex, quint32& aValue );
+#ifdef LOCPICKER_UNIT_TEST
+public slots:
+#else
private slots:
+#endif
// slot to perform search
void doSearch( QString aCriteria );
// slot to handle select event on a list item
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();
+ //delete context menu
+ void deleteMenu();
signals:
//signals to switch current view
void switchView();
//signals when any item is selected
void selectItem( quint32 aLm );
+#ifdef LOCPICKER_UNIT_TEST
+public:
+#else
private:
+#endif
//proxymodel used for sort and filter
LocationPickerProxyModel *mProxyModel;
// model for the view
@@ -72,6 +89,11 @@
QGraphicsLinearLayout* mVerticalLayout;
//Documentloader
HbDocumentLoader &mDocumentLoader;
+ QModelIndex mIndex;
+ //context menu
+ HbMenu* mLongPressMenu;
+ //select action
+ HbAction* mSelectAction;
};
--- a/locationpickerservice/inc/locationpickertypes.h Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/inc/locationpickertypes.h Thu Jul 22 16:31:43 2010 +0100
@@ -41,8 +41,6 @@
//Places collection icon
const QString KCollectionsPlaces("qtg_small_favorite");
-//Contacts type prefered icon
-const QString KContactPrefIcon("qtg_mono_favourites");
//Contacts type home icon
const QString KContactHomeIcon("qtg_mono_home");
//Contacts type work icon
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickerview.h Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,171 @@
+/*
+* 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: LocationPickerView declaration
+*
+*/
+
+#ifndef LOCATIONPICKERVIEW_H
+#define LOCATIONPICKERVIEW_H
+
+
+#include <HbView>
+#include <hbdocumentloader.h>
+#include "locationpickertypes.h"
+#include <QGraphicsLinearLayout>
+#include <hgwidgets/hgmediawall.h>
+
+#include <HbLabel>
+#include <HbTextItem>
+//forward declarations
+class HbListView;
+class QStandardItemModel;
+class LocationPickerProxyModel;
+class LocationPickerCollectionListContent;
+class LocationPickerCollectionContent;
+class HgWidgetDataModel;
+class HbListViewItem;
+class HbAction;
+class HbAbstractViewItem;
+class QPoint;
+class HbDialog;
+class HbLabel;
+/**
+ * Class defines the location picker view
+ */
+class LocationPickerView : public HbView
+{
+ Q_OBJECT
+public:
+ // constructor
+ LocationPickerView( HbDocumentLoader* aLoader );
+ // destructor
+ ~LocationPickerView();
+public:
+ //disable the tabs
+ void disableTabs();
+ //get the items from docml and connect to respective slots
+ void init( Qt::Orientation aOrientation, QStandardItemModel *aModel );
+ //Set the appropriate model on list view
+ void manageListView();
+ //create hurriganes widget
+ void createHurriganesWidget();
+ //manage hurriganes view
+ void manageHgWidget();
+ //Create collection list and sets to list view
+ void setCollectionData( quint32 acategoryId );
+ //Get the view type
+ TViewType getViewType();
+ //set the view type
+ void setViewType( TViewType aViewType );
+ //clear collection Model
+ void clearContentModel();
+ void removeDetailsLabel();
+ //close the popupdialog
+ void closeDetailsDialog();
+#ifdef LOCPICKER_UNIT_TEST
+public:
+#else
+private:
+#endif
+ void displayNoEntries();
+#ifdef LOCPICKER_UNIT_TEST
+public slots:
+#else
+private slots:
+#endif
+ //slot to handle list item actions
+ void handleActivated( const QModelIndex &aIndex );
+ //slots to handle menu action items
+ void sortDescending();
+ void sortAscending();
+ //handle secondary back action
+ void backTriggered();
+ //slot to handle search tab
+ void searchTabTriggered();
+ //context menu
+ void launchPopUpMenu( HbAbstractViewItem *aItem, const QPointF &aPoint );
+ //launch context menu
+ void launchPopUpMenu( const QModelIndex &aIndex, const QPointF &aPoint );
+ //handle select event
+ void handleSelect();
+ //handle details event
+ void handleDetails();
+ //slot to handle all tab
+ void allTabTriggered();
+ //slot to handle collection tab
+ void colectionTabTriggered();
+ //delete context menu
+ void deleteMenu();
+signals:
+ void switchToSearchView();
+ void selectItem( quint32 aLm );
+ void completeService();
+#ifdef LOCPICKER_UNIT_TEST
+public:
+#else
+private:
+#endif
+ //document loader
+ HbDocumentLoader* mDocumentLoader;
+ // collection list content
+ LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
+ //locationPickerProxyModel
+ LocationPickerProxyModel *mProxyModel;
+ //standard model
+ QStandardItemModel *mModel;
+ //actions
+ HbAction *mAllAction;
+ HbAction *mCollectionAction;
+ HbAction *mSearchAction;
+ HbAction *mAscendingAction;
+ HbAction *mDescendingAction;
+ //secondary back action
+ HbAction *mBackAction;
+ // list view
+ HbListView *mListView;
+ //list item
+ HbListViewItem *mListItem;
+ //collection content
+ LocationPickerCollectionContent *mCollectionContent;
+ //ViewType
+ TViewType mViewType ;
+ // get the collection/category id
+ quint32 mCategoryId;
+ //label to show current view
+ QModelIndex mIndex;
+ //linear Layout
+ QGraphicsLinearLayout *mLinerLayout;
+ //model for hurriganes
+ HgWidgetDataModel *mHgModel;
+ //hurriganes
+ HgWidget *mWidget;
+ // label to show view details
+ HbLabel *mColllabel;
+ //text item to show no entries
+ HbTextItem* mEmptyLabel;
+ //pop up dialog to show details
+ HbDialog* mDialog;
+ HbLabel* mMapIconLabel;
+ HbLabel* mTitleLabel;
+ HbLabel* mAddressMiddle;
+ HbLabel* mAddressBottom;
+ HbAction* mDone;
+ HbMenu* mLongPressMenu;
+ HbAction* mSelectAction;
+ HbAction* mDetailsAction;
+ bool mPopulated;
+};
+
+
+#endif // LOCATIONPICKERVIEW_H
--- a/locationpickerservice/locationpickerservice.pro Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/locationpickerservice.pro Thu Jul 22 16:31:43 2010 +0100
@@ -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
@@ -62,9 +66,10 @@
src/locationpickerservice.cpp \
src/locationpickerdatamanager.cpp \
src/locationpickerdatamanager_p.cpp \
- src/locationpickerpotraitview.cpp \
- src/locationpickerlandscapeview.cpp \
- src/locationpickerdocumentloader.cpp
+ src/locationpickerview.cpp \
+ src/locationpickerdocumentloader.cpp \
+ src/hgwidgetdatamodel.cpp
+
@@ -78,7 +83,7 @@
inc/locationpickerservice.h \
inc/locationpickerdatamanager.h \
inc/locationpickerdatamanager_p.h \
- inc/locationpickerpotraitview.h \
- inc/locationpickerlandscapeview.h \
- inc/locationpickerdocumentloader.h
+ inc/locationpickerview.h \
+ inc/locationpickerdocumentloader.h \
+ inc/hgwidgetdatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/location.hgmediawall.css Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,69 @@
+HgMediawall#location[scrollBarPolicy="ScrollBarAlwaysOff"]
+{
+ layout:layout-noscrollbar;
+ front-cover-elevation-factor:0.5;
+}
+
+HgMediawall#location[!scrollBarPolicy="ScrollBarAlwaysOff"]
+{
+ layout:layout-scrollbar;
+ front-cover-elevation-factor:0.5;
+}
+
+HgMediawall#location::title
+{
+ font-variant:secondary;
+ 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 Thu Jul 22 16:31:43 2010 +0100
@@ -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="TOP" dst="content" dstEdge="TOP" />
+ <meshitem src="title" srcEdge="CENTERH" dst="content" dstEdge="CENTERH" />
+ <meshitem src="centeritem" srcEdge="BOTTOM" dst="content" dstEdge="BOTTOM" />
+ <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>
+</hbwidget>
--- a/locationpickerservice/resources/locationgrid.css Fri Jun 11 16:23:56 2010 +0100
+++ /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 16:23:56 2010 +0100
+++ /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 16:23:56 2010 +0100
+++ b/locationpickerservice/resources/locationpicker.qrc Thu Jul 22 16:31:43 2010 +0100
@@ -1,9 +1,9 @@
<RCC>
<qresource>
- <file>locationpickerpotrait.docml</file>
- <file>locationpickerlandscape.docml</file>
+ <file>locationpickerview.docml</file>
<file>locationpickersearchview.docml</file>
- <file>locationgrid.css</file>
- <file>locationgrid.hbgridviewitem.widgetml</file>
+ <file>popupdialog.docml</file>
+ <file>location.hgmediawall.widgetml</file>
+ <file>location.hgmediawall.css</file>
</qresource>
</RCC>
--- a/locationpickerservice/resources/locationpickerlandscape.docml Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.9">
- <object name="allAction" type="HbAction">
- <bool name="checkable" value="TRUE"/>
- <icon iconName="qtg_mono_location" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="collectionAction" type="HbAction">
- <bool name="checkable" value="TRUE"/>
- <icon iconName="qtg_mono_location_collection" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="searchAction" type="HbAction">
- <icon iconName="qtg_mono_search" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="ascendingAction" type="HbAction">
- <string name="iconText" value="txt_lint_list_ascending‘txt_lint_list_ascending’"/>
- <string locid="txt_lint_list_ascending" name="text" value="Ascending"/>
- <string name="toolTip" value="txt_lint_list_ascending‘txt_lint_list_ascending’"/>
- </object>
- <object name="descendingAction" type="HbAction">
- <string locid="txt_lint_list_descending" name="text" value="Descending"/>
- </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"/>
- <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"/>
- </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"/>
- </layout>
- </widget>
- <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
- <ref object="allAction" role="HbToolBar:addAction"/>
- <ref object="collectionAction" role="HbToolBar:addAction"/>
- <ref object="searchAction" role="HbToolBar:addAction"/>
- </widget>
- <widget name="viewMenu" role="HbView:menu" type="HbMenu">
- <widget name="sortByMenu" role="HbMenu:menu" type="HbMenu">
- <ref object="ascendingAction" role="HbMenu:addAction"/>
- <ref object="descendingAction" role="HbMenu:addAction"/>
- <string locid="txt_lint_list_sort_by" name="title" value="Sort By"/>
- </widget>
- </widget>
- <string locid="txt_lint_title_select_location" name="title" value="Select Location"/>
- </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 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.9">
- <object name="allAction" type="HbAction">
- <bool name="checkable" value="TRUE"/>
- <icon iconName="qtg_mono_location" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="collectionAction" type="HbAction">
- <bool name="checkable" value="TRUE"/>
- <icon iconName="qtg_mono_location_collection" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="searchAction" type="HbAction">
- <icon iconName="qtg_mono_search" name="icon"/>
- <string name="text" value=""/>
- </object>
- <object name="ascendingAction" type="HbAction">
- <string locid="txt_lint_list_ascending" name="text" value="Ascending"/>
- </object>
- <object name="descendingAction" type="HbAction">
- <string locid="txt_lint_list_descending" name="text" value="Descending"/>
- </object>
- <widget name="LocationPickerPotraitView" type="HbView">
- <widget name="content" role="HbView:widget" type="HbWidget">
- <widget name="ListView" type="HbListView">
- <widget name="listItemPrototype" role="HbListView:prototype" type="HbListViewItem">
- <string name="state" value="normal"/>
- </widget>
- <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>
- </widget>
- <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
- <ref object="allAction" role="HbToolBar:addAction"/>
- <ref object="collectionAction" role="HbToolBar:addAction"/>
- <ref object="searchAction" role="HbToolBar:addAction"/>
- </widget>
- <widget name="viewMenu" role="HbView:menu" type="HbMenu">
- <widget name="sortByMenu" role="HbMenu:menu" type="HbMenu">
- <ref object="ascendingAction" role="HbMenu:addAction"/>
- <ref object="descendingAction" role="HbMenu:addAction"/>
- <string locid="txt_lint_list_sort_by" name="title" value="Sort By"/>
- </widget>
- </widget>
- <string locid="txt_lint_title_select_location" name="title"/>
- </widget>
- <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
- <uistate name="Common ui state" sections="#common"/>
- <dummydata objectName="ListView" section="#common" value="0"/>
- </metadata>
-</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/locationpickerview.docml Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+ <object name="allAction" type="HbAction">
+ <bool name="checkable" value="TRUE"/>
+ <icon iconName="qtg_mono_location" name="icon"/>
+ <string name="text" value=""/>
+ </object>
+ <object name="collectionAction" type="HbAction">
+ <bool name="checkable" value="TRUE"/>
+ <icon iconName="qtg_mono_location_collection" name="icon"/>
+ <string name="text" value=""/>
+ </object>
+ <object name="searchAction" type="HbAction">
+ <icon iconName="qtg_mono_search" name="icon"/>
+ <string name="text" value=""/>
+ </object>
+ <object name="ascendingAction" type="HbAction">
+ <string locid="txt_lint_list_ascending" name="text" value="Ascending"/>
+ </object>
+ <object name="descendingAction" type="HbAction">
+ <string locid="txt_lint_list_descending" name="text" value="Descending"/>
+ </object>
+ <widget name="LocationPickerView" type="HbView">
+ <widget name="content" role="HbView:widget" type="HbWidget">
+ <layout orientation="Vertical" type="linear"/>
+ </widget>
+ <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
+ <ref object="allAction" role="HbToolBar:addAction"/>
+ <ref object="collectionAction" role="HbToolBar:addAction"/>
+ <ref object="searchAction" role="HbToolBar:addAction"/>
+ </widget>
+ <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+ <widget name="sortByMenu" role="HbMenu:menu" type="HbMenu">
+ <ref object="ascendingAction" role="HbMenu:addAction"/>
+ <ref object="descendingAction" role="HbMenu:addAction"/>
+ <string locid="txt_lint_list_sort_by" name="title" value="Sort By"/>
+ </widget>
+ </widget>
+ <string locid="txt_lint_title_select_location" name="title"/>
+ </widget>
+ <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/popupdialog.docml Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.0">
+ <object name="action" type="HbAction">
+ <string name="role" value="HbDialog:primaryAction"/>
+ <string locid="txt_lint_button_done" name="text"/>
+ </object>
+ <widget name="dialog" type="HbDialog">
+ <widget name="container" role="HbDialog:contentWidget" type="HbWidget">
+ <widget name="mapLabel" type="HbLabel">
+ <real name="z" value="3"/>
+ <sizepolicy horizontalPolicy="Fixed" horizontalStretch="0" verticalPolicy="Fixed" verticalStretch="0"/>
+ <sizehint height="expr((var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))*3/4)" type="FIXED" width="expr(var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))"/>
+ <sizehint height="expr((var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))*3/4)" type="MINIMUM" width="expr(var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))"/>
+ <sizehint height="expr((var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))*3/4)" type="MAXIMUM" width="expr(var(hb-param-screen-width)-(2*var(hb-param-margin-gene-popup))-(2*var(hb-param-margin-gene-screen)))"/>
+ <bool name="visible" value="TRUE"/>
+ </widget>
+ <widget name="titleLabel" type="HbLabel">
+ <string name="plainText"/>
+ </widget>
+ <widget name="addressMiddle" type="HbLabel">
+ <string name="plainText"/>
+ </widget>
+ <widget name="addressBottom" type="HbLabel">
+ <string name="plainText"/>
+ </widget>
+ <real name="z" value="0"/>
+ <layout spacing="var(hb-param-margin-gene-popup)" type="grid">
+ <contentsmargins bottom="var(hb-param-margin-gene-popup)" left="var(hb-param-margin-gene-popup)" right="var(hb-param-margin-gene-popup)" top="var(hb-param-margin-gene-popup)"/>
+ <griditem column="0" itemname="mapLabel" row="0"/>
+ <griditem column="0" itemname="titleLabel" row="1"/>
+ <griditem column="0" itemname="addressMiddle" row="2"/>
+ <griditem column="0" itemname="addressBottom" row="3"/>
+ </layout>
+ </widget>
+ <rect height="67.31343un" name="geometry" width="46.71642un" x="3.28358un" y="14.02985un"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <ref object="action" role="HbDialog:primaryAction"/>
+ </widget>
+ <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- a/locationpickerservice/rom/locationpickerservice.iby Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/rom/locationpickerservice.iby Thu Jul 22 16:31:43 2010 +0100
@@ -22,5 +22,7 @@
file=ABI_DIR/BUILD_DIR/locationpickerservice.exe PROGRAMS_DIR/locationpickerservice.exe
data=ZPRIVATE/10003a3f/import/apps/locationpickerservice_reg.rsc /private/10003a3f/import/apps/locationpickerservice_reg.rsc
data=DATAZ_/resource/apps/locationpickerservice.rsc /resource/apps/locationpickerservice.rsc
+// Localizations
+data=DATAZ_\QT_TRANSLATIONS_DIR\lilpicker_en.qm QT_TRANSLATIONS_DIR\lilpicker_en.qm
#endif // __LOCATION_PICKER_SERVICE_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/hgwidgetdatamodel.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -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
+{
+ 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;
+ QStringList adressDetail = mProxyModel->data(proxyModelIndex,Qt::DisplayRole).toStringList();
+ QString displayString = adressDetail[0]+KSeparator+KSpace+adressDetail[1];
+ QString text("");
+ displayText <<displayString<<text;
+ returnValue = displayText;
+ break;
+ }
+ case Qt::DecorationRole:
+ {
+ //get icon name from data model
+ QString iconName = mProxyModel->data(proxyModelIndex,Qt::UserRole+1).toString();
+ if (iconName.isEmpty())
+ {
+ returnValue = mDefaultImage;
+ }
+ else
+ {
+ QString adressType = mProxyModel->data(proxyModelIndex,Qt::UserRole+2).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 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerappwindow.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -20,11 +20,10 @@
#include "qlocationpickeritem.h"
#include "locationpickersearchview.h"
-#include "locationpickerpotraitview.h"
+#include "locationpickerview.h"
#include "locationpickerservice.h"
#include "locationpickerdatamanager.h"
#include "locationpickerdocumentloader.h"
-#include "locationpickerlandscapeview.h"
#include "locationpickercontent.h"
// ----------------------------------------------------------------------------
@@ -34,11 +33,9 @@
:HbMainWindow(parent, windowFlags),
mLocationPickerSearchView(NULL),
mLocationPickerDocumentLoader(NULL),
- mLocationPickerPotraitView(NULL),
- mLocationPickerLandscapeView(NULL),
+ mLocationPickerView(NULL),
mLocationPickerContent(NULL),
- mService(NULL),
- mviewType(ELocationPickerContent)
+ mService(NULL)
{
// create the service object;
mService = new LocationPickerService(this);
@@ -46,47 +43,32 @@
//create document loader object
mLocationPickerDocumentLoader = new LocationPickerDocumentLoader();
-
bool ok = false;
- //load the Locationpicker portrait view
- mLocationPickerDocumentLoader->load(":/locationpickerpotrait.docml", &ok);
+ //load the Locationpicker view
+ mLocationPickerDocumentLoader->load(":/locationpickerview.docml", &ok);
Q_ASSERT_X(ok, "locationpickerservice", "invalid DocML file");
//find graphics location picker potrait view
- QGraphicsWidget *locationPickerWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerPotraitView");
+ QGraphicsWidget *locationPickerWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerView");
Q_ASSERT_X((locationPickerWidget != 0), "locationpickerservice", "invalid DocML file");
- mLocationPickerPotraitView = qobject_cast<LocationPickerPotraitView*>(locationPickerWidget);
- bool populated = mLocationPickerContent->populateModel(Qt::Vertical);
- //initialize potrait widgets and connect to respective signals
- mLocationPickerPotraitView->init(populated, Qt::Vertical, mLocationPickerContent->getStandardListModel());
- connectPotraitSlots();
+ mLocationPickerView = qobject_cast<LocationPickerView*>(locationPickerWidget);
+ bool populated = mLocationPickerContent->populateModel();
+ connectSlots();
if(!populated)
{
- mLocationPickerPotraitView->disableTabs(mLocationPickerContent->getStandardListModel());
- addView( mLocationPickerPotraitView );
- setCurrentView(mLocationPickerPotraitView);
+ mLocationPickerView->disableTabs();
+ addView(mLocationPickerView);
+ setCurrentView(mLocationPickerView);
}
else
- {
- addView( mLocationPickerPotraitView );
-
- mLocationPickerDocumentLoader->reset();
-
- //load the Locationpicker landscape view
- mLocationPickerDocumentLoader->load(":/locationpickerlandscape.docml", &ok);
- Q_ASSERT_X(ok, "locationpickerservice", "invalid DocML file");
- //find graphics location picker landscape view
- locationPickerWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerLandscapeView");
- Q_ASSERT_X((locationPickerWidget != 0), "locationpickerservice", "invalid DocML file");
- mLocationPickerLandscapeView = qobject_cast<LocationPickerLandscapeView*>(locationPickerWidget);
- mLocationPickerContent->populateModel(Qt::Horizontal);
- //initialize widgets and connect to respective signals
- mLocationPickerLandscapeView->init(Qt::Horizontal, mLocationPickerContent->getStandardGridModel());
- connectLandscapeSlots();
- addView(mLocationPickerLandscapeView);
- //connect to orientationChanged signal
- connect(this, SIGNAL(orientationChanged(Qt::Orientation)),this, SLOT(changeOrientation(Qt::Orientation)));
- //launch the view in current orientation
- changeOrientation(this->orientation());
+ {
+ //initialize potrait widgets and connect to respective signals
+ mLocationPickerView->init( this->orientation(), mLocationPickerContent->getStandardModel());
+ addView( mLocationPickerView );
+ setCurrentView(mLocationPickerView);
+ //connect to orientationChanged signal
+ connect(this, SIGNAL(orientationChanged(Qt::Orientation)),this, SLOT(changeOrientation(Qt::Orientation)));
+ connect(this, SIGNAL(aboutToChangeOrientation()),this, SLOT(closeDetailsDialog()));
+
}
}
@@ -98,8 +80,7 @@
delete mService;
delete mLocationPickerSearchView;
delete mLocationPickerDocumentLoader;
- delete mLocationPickerPotraitView;
- delete mLocationPickerLandscapeView;
+ delete mLocationPickerView;
delete mLocationPickerContent;
}
@@ -139,36 +120,33 @@
Q_ASSERT_X((mLocationPickerSearchView != 0), "mLocationPickerSearchView",
"qobject cast failure");
//initialize the action items and connect to slots
- mLocationPickerSearchView->init(mLocationPickerContent->getStandardListModel());
+ mLocationPickerSearchView->init(mLocationPickerContent->getStandardModel());
connect(mLocationPickerSearchView,SIGNAL(switchView()),this,SLOT(activateLocationPickerView()));
connect(mLocationPickerSearchView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
addView(mLocationPickerSearchView);
}
//set LocationPickerSearchview as current view
setCurrentView(mLocationPickerSearchView);
- mviewType = ELocationPickerSearchView;
+
+}
-}
// ----------------------------------------------------------------------------
// LocationPickerAppWindow::activateLocationPickerView()
// ----------------------------------------------------------------------------
void LocationPickerAppWindow::activateLocationPickerView()
{
- mviewType = ELocationPickerContent;
+ mLocationPickerView->setViewType( ELocationPickerContent );
//check the orientation and load view accordingly
if(this->orientation() == Qt::Horizontal)
{
- mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
- mLocationPickerLandscapeView->manageGridView();
- setCurrentView(mLocationPickerLandscapeView);
+ mLocationPickerView->manageHgWidget();
}
else
{
- mLocationPickerPotraitView->setViewType( ELocationPickerContent );
- mLocationPickerPotraitView->manageListView();
- setCurrentView( mLocationPickerPotraitView );
+ mLocationPickerView->manageListView();
}
+ setCurrentView(mLocationPickerView);
}
// ----------------------------------------------------------------------------
@@ -177,129 +155,38 @@
void LocationPickerAppWindow::changeOrientation( Qt::Orientation )
{
//check the orientation and load view accordingly
- if( orientation() == (Qt::Horizontal ))
- {
- loadLandscape();
- }
- else
+ if(mLocationPickerView->getViewType()== ELocationPickerCollectionContent ||
+ mLocationPickerView->getViewType()== ELocationPickerContent )
{
- loadPotrait();
- }
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::loadPotrait()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::loadPotrait()
-{
- //load potrait view except for search view
- if(mviewType != ELocationPickerSearchView)
- {
- if(mLocationPickerLandscapeView->getViewType() == ELocationPickerContent)
- {
- mLocationPickerPotraitView->setViewType(ELocationPickerContent);
- }
- mLocationPickerPotraitView->manageListView();
- setCurrentView( mLocationPickerPotraitView );
+ if(this->orientation() == Qt::Vertical)
+ {
+ mLocationPickerView->manageListView();
+
+ }
+
+ else if(this->orientation() == Qt::Horizontal)
+ {
+ mLocationPickerView->manageHgWidget();
+ }
}
}
// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::loadLandscape()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::loadLandscape()
-{
- if(mviewType != ELocationPickerSearchView)
- {
- //load landscape view in current potrait content
- mLocationPickerLandscapeView->setViewType( mLocationPickerPotraitView->getViewType() );
- //load landscape for all content except collectionlistcontent
- if(mLocationPickerPotraitView->getViewType() != ELocationPickerCollectionListContent)
- {
- mLocationPickerLandscapeView->manageGridView();
- setCurrentView(mLocationPickerLandscapeView);
- }
- }
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::loadLandscape()
+// LocationPickerAppWindow::closeDetailsDialog()
// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::connectPotraitSlots()
+void LocationPickerAppWindow::closeDetailsDialog()
{
- connect(mLocationPickerPotraitView,SIGNAL(switchToSearchView()),this,SLOT(activateSearchView()));
- connect(mLocationPickerPotraitView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
- connect(mLocationPickerPotraitView,SIGNAL(completeService()),this,SLOT(serviceComplete()));
- connect(mLocationPickerPotraitView,SIGNAL(sendCategoryID( quint32 )),this,SLOT(setCategoryId( quint32 )));
- connect(mLocationPickerPotraitView,SIGNAL(handleAllList()),this,SLOT(allListHandle()));
- connect(mLocationPickerPotraitView,SIGNAL(collectionContentExited()),this,SLOT(clearContentModels()));
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::loadLandscape()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::connectLandscapeSlots()
-{
- connect(mLocationPickerLandscapeView,SIGNAL(switchToSearchView()),this,SLOT(activateSearchView()));
- connect(mLocationPickerLandscapeView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
- connect(mLocationPickerLandscapeView,SIGNAL(completeService()),this,SLOT(serviceComplete()));
- connect(mLocationPickerLandscapeView,SIGNAL(sendCategoryID( quint32 )),this,SLOT(setCategoryId( quint32 )));
- connect(mLocationPickerLandscapeView,SIGNAL(handleCollectionList()),this,SLOT(handleCollectionList()));
- connect(mLocationPickerLandscapeView,SIGNAL(collectionContentExited()),this,SLOT(clearContentModels()));
+ mLocationPickerView->closeDetailsDialog();
}
// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::setCategoryId()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::setCategoryId( quint32 acategoryId )
-{
- //set the same category id to both views
- mLocationPickerPotraitView->setCategoryID(acategoryId);
- mLocationPickerLandscapeView->setCategoryID(acategoryId);
- //Load the collectioncontent in appropriate orientation
- if(orientation() == Qt::Vertical)
- {
- mviewType = ELocationPickerCollectionContent;
- mLocationPickerPotraitView->manageListView();
- setCurrentView( mLocationPickerPotraitView );
- }
- else
- {
- mviewType = ELocationPickerCollectionContent;
- loadLandscape();
- }
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::handleCollectionList()
+// LocationPickerAppWindow::connectSlots()
// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::handleCollectionList()
-{
- //In collection List both view should look same(list)
- mLocationPickerPotraitView->setViewType( ELocationPickerCollectionListContent );
- mviewType = ELocationPickerCollectionListContent;
- mLocationPickerPotraitView->manageListView();
- setCurrentView( mLocationPickerPotraitView );
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::allListHandle()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::allListHandle()
+void LocationPickerAppWindow::connectSlots()
{
- //all list after collection list in horizontal orientation
- mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
- mLocationPickerLandscapeView->manageGridView();
- setCurrentView(mLocationPickerLandscapeView);
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::clearContentModels()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::clearContentModels()
-{
- mLocationPickerLandscapeView->clearContentModel();
- mLocationPickerPotraitView->clearContentModel();
+ connect(mLocationPickerView,SIGNAL(switchToSearchView()),this,SLOT(activateSearchView()));
+ connect(mLocationPickerView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
+ connect(mLocationPickerView,SIGNAL(completeService()),this,SLOT(serviceComplete()));
}
Q_IMPLEMENT_USER_METATYPE(QLocationPickerItem)
--- a/locationpickerservice/src/locationpickercollectioncontent.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickercollectioncontent.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -27,9 +27,8 @@
// ----------------------------------------------------------------
// LocationPickerCollectionContent::LocationPickerCollectionContent()
// -----------------------------------------------------------------
-LocationPickerCollectionContent::LocationPickerCollectionContent( Qt::Orientations aOrientation , quint32 aCollectionId )
- :mOrientation(aOrientation),
- mProxyModel(NULL),
+LocationPickerCollectionContent::LocationPickerCollectionContent( quint32 aCollectionId )
+ :mProxyModel(NULL),
mModel(NULL),
mDataManager(NULL),
mLocationFound(false)
@@ -38,10 +37,10 @@
mModel = new QStandardItemModel( this );
// create data manager to manage data in the model
mDataManager = LocationPickerDataManager::getInstance();
- if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
+ if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, aCollectionId ) )
{
// Create the proxy model.
- mProxyModel = new LocationPickerProxyModel(mOrientation);
+ mProxyModel = new LocationPickerProxyModel();
mProxyModel->setSourceModel(mModel);
mProxyModel->setDynamicSortFilter(TRUE);
mProxyModel->setSortRole(Qt::DisplayRole);
@@ -77,14 +76,6 @@
return mProxyModel;
}
-// ----------------------------------------------------------------
-// LocationPickerCollectionContent::getStandardModel
-// -----------------------------------------------------------------
-QStandardItemModel* LocationPickerCollectionContent::getStandardModel()
-{
- return mModel;
-}
-
// ----------------------------------------------------------------------------
// LocationPickerCollectionContent::getData()
// ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickercollectionlistcontent.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickercollectionlistcontent.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -25,16 +25,22 @@
// ----------------------------------------------------------------------
// LocationPickerCollectionListContent::LocationPickerCollectionListContent()
// ----------------------------------------------------------------------
-LocationPickerCollectionListContent::LocationPickerCollectionListContent( Qt::Orientation aOrientation )
- :mOrientation(aOrientation),
- mModel(NULL),
+LocationPickerCollectionListContent::LocationPickerCollectionListContent()
+ :mModel(NULL),
mDataManager(NULL)
{
// 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);
+ if(!populated)
+ {
+ qFatal("Error creating collection");
+ }
+ }
}
// ----------------------------------------------------------------------
@@ -49,9 +55,9 @@
// LocationPickerCollectionListContent::getStandardModel
// -----------------------------------------------------------------
QStandardItemModel* LocationPickerCollectionListContent::getStandardModel()
- {
+{
return mModel;
- }
+}
// ----------------------------------------------------------------------------
// LocationPickerCollectionListContent::getData()
--- a/locationpickerservice/src/locationpickercontent.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickercontent.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -29,8 +29,7 @@
// -----------------------------------------------------------------------------
LocationPickerContent::LocationPickerContent()
:mDataManager(NULL),
- mListModel(NULL),
- mGridModel(NULL)
+ mStandardModel(NULL)
{
// create data manager to manage data in the model
mDataManager = LocationPickerDataManager::getInstance();
@@ -40,37 +39,19 @@
// -----------------------------------------------------------------------------
// LocationPickerContent::populateModel()
// -----------------------------------------------------------------------------
-bool LocationPickerContent::populateModel( Qt::Orientation aOrientation )
+bool LocationPickerContent::populateModel()
{
bool locationsFound;
- if(aOrientation == Qt::Vertical)
+ // Create a standard model for the list view
+ mStandardModel = new QStandardItemModel( this );
+ if( mDataManager->populateModel( *mStandardModel, ELocationPickerContent ) )
{
- // Create a standard model for the list view
- mListModel = new QStandardItemModel( this );
- if( mDataManager->populateModel( *mListModel, ELocationPickerContent, aOrientation) )
- {
- locationsFound = true;
- }
- else
- {
- createNoEntryDisplay(mListModel);
- locationsFound = false;
- }
+ locationsFound = true;
}
- //for landscape view
else
{
- // Create a standard model for the grid view
- mGridModel = new QStandardItemModel( this );
- if( mDataManager->populateModel(*mGridModel, ELocationPickerContent, aOrientation) )
- {
- locationsFound = true;
- }
- else
- {
- createNoEntryDisplay(mGridModel);
- locationsFound = false;
- }
+ createNoEntryDisplay(mStandardModel);
+ locationsFound = false;
}
return locationsFound;
}
@@ -80,24 +61,16 @@
// -----------------------------------------------------------------------------
LocationPickerContent::~LocationPickerContent()
{
- delete mListModel;
- delete mGridModel;
+ delete mStandardModel;
}
+
// -----------------------------------------------------------------------------
-// LocationPickerContent::getStandardListModel()
+// LocationPickerContent::getStandardModel()
// -----------------------------------------------------------------------------
-QStandardItemModel* LocationPickerContent::getStandardListModel()
+QStandardItemModel* LocationPickerContent::getStandardModel()
{
- return mListModel;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerContent::getStandardGridModel()
-// -----------------------------------------------------------------------------
-QStandardItemModel* LocationPickerContent::getStandardGridModel()
-{
- return mGridModel;
+ return mStandardModel;
}
// ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickerdatamanager.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerdatamanager.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -50,10 +50,10 @@
// LocationPickerDataManager::populateModel()
// ----------------------------------------------------------------------------
bool LocationPickerDataManager::populateModel( QStandardItemModel &aModel, TViewType aViewType,
- Qt::Orientations aOrientation, quint32 aCollectionId )
+ quint32 aCollectionId )
{
Q_D( LocationPickerDataManager);
- return( d->populateModel( aModel, aViewType, aOrientation, aCollectionId) );
+ return( d->populateModel( aModel, aViewType, aCollectionId) );
}
// ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickerdatamanager_p.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerdatamanager_p.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -16,17 +16,10 @@
*/
#include <HbIcon>
-#include <QPixmap>
-#include <QPainter>
-#include <QIcon>
#include <locationdatalookupdb.h>
#include <QFile>
#include "locationpickerdatamanager_p.h"
-//constant value used
-const int ASPECTRATIOHEIGHT(3);
-const int ASPECTRATIOWIDTH (4);
-
// ----------------------------------------------------------------------------
// LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate()
@@ -60,11 +53,10 @@
// LocationPickerDataManagerPrivate::populateModel()
// ----------------------------------------------------------------------------
bool LocationPickerDataManagerPrivate::populateModel( QStandardItemModel &aModel,
- TViewType aViewType, const Qt::Orientations aOrientation, quint32 aCollectionId )
+ TViewType aViewType, quint32 aCollectionId )
{
mModel = &aModel;
mViewType = aViewType;
- mOrientation = aOrientation;
if( !mDb )
{
@@ -84,10 +76,11 @@
case ELocationPickerCollectionListContent:
{
- populateCollections();
+ QList<int> aCount;
+ mDb->getCount(aCount, aCollectionId);
+ populateCollections(aCount);
+ return true;
}
- break;
-
case ELocationPickerCollectionContent:
{
QList<QLookupItem> itemArray;
@@ -115,50 +108,76 @@
}
QString lmAddressLine1;
QString lmAddressLine2;
+ QString contextAddress;
+ QString contextAddressCountry;
for( int i = 0; i < aItemArray.count(); i++ )
{
+ contextAddress.clear();
+ contextAddressCountry.clear();
+ lmAddressLine1.clear();
+ lmAddressLine2.clear();
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;
+ }
}
}
+ contextAddress = lmAddressLine2;
if( !aItemArray[i].mCountry.isEmpty() )
{
if( !addressEmtpy )
@@ -172,95 +191,61 @@
lmAddressLine2 = aItemArray[i].mCountry;
addressEmtpy = EFalse;
}
+ contextAddressCountry = aItemArray[i].mCountry;
}
// 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;
- }
+ QString adressType;
+ bool adressIconPresent = false;
+ if( aItemArray[i].mSourceType == ESourceContactsHome )
+ {
+ adressTypeIcon = HbIcon(KContactHomeIcon);
+ adressType = KContactHomeIcon;
+ adressIconPresent = true;
+ }
+ else if( aItemArray[i].mSourceType == ESourceContactsWork )
+ {
+ adressTypeIcon = HbIcon(KContactWorkIcon);
+ adressType = KContactWorkIcon;
+ 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;
-
+ // create a list item and set to model
+ QStringList addressData;
+ QString landscapeIconPath;
+
if( QFile::exists( aItemArray[i].mMapTilePath ) )
- {
- //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)
- {
- //draw the adressType Icon over mapTile Icon
- QPixmap adressTypePixmap = adressTypeIcon.pixmap();
- painter.begin( &mapPixmap );
- painter.drawPixmap( (mapPixmap.width()-adressTypePixmap.width()),0,adressTypePixmap );
- painter.end();
- }
- QIcon landscape( mapPixmap );
- landscapeIcon = HbIcon( landscape );
+ {
+ //draw maptile Icon
+ landscapeIconPath = QString( aItemArray[i].mMapTilePath );
}
else
{
//draw dummy icon
- landscapeIcon = HbIcon( KDummyImage );
+ landscapeIconPath = QString("");
}
-
- icons<<landscapeIcon;
- QStandardItem *modelItem = new QStandardItem();
- addressData << lmAddressLine1;
- modelItem->setData(QVariant(addressData), Qt::DisplayRole);
- modelItem->setData( icons[0], Qt::DecorationRole );
- modelItem->setData( aItemArray[i].mId, Qt::UserRole );
- mModel->appendRow( modelItem );
- }
- else
- {
- //create model for list view in potrait mode
- addressData.clear();
- HbIcon potraitIcon( KDummyImage );
+ addressData.clear();
+ HbIcon potraitIcon( KDummyImage );
icons<<potraitIcon;
if(adressIconPresent)
{
icons<<adressTypeIcon;
}
- QStandardItem *modelItem = new QStandardItem();
- addressData << lmAddressLine1 << lmAddressLine2;
- modelItem->setData(QVariant(addressData), Qt::DisplayRole);
- modelItem->setData( icons, Qt::DecorationRole );
- modelItem->setData( aItemArray[i].mId, Qt::UserRole );
- mModel->appendRow( modelItem );
- }
- }
- }
+ QStringList contextList;
+ contextList<<lmAddressLine1<<contextAddress<<contextAddressCountry;
+ QStandardItem *modelItem = new QStandardItem();
+ addressData << lmAddressLine1 << lmAddressLine2;
+ modelItem->setData(QVariant(addressData), Qt::DisplayRole);
+ modelItem->setData( icons, Qt::DecorationRole );
+ modelItem->setData( aItemArray[i].mId, Qt::UserRole );
+ modelItem->setData(landscapeIconPath,Qt::UserRole+1);
+ modelItem->setData(adressType,Qt::UserRole+2);
+ modelItem->setData(QVariant(contextList), Qt::UserRole+3);
+
+ mModel->appendRow( modelItem );
+ }
+ }
return true;
}
@@ -269,26 +254,48 @@
// 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 );
+
+
+ QStringList contact = (QStringList()<<contactCollectionName<<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/locationpickerdocumentloader.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerdocumentloader.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -16,9 +16,8 @@
*/
#include "locationpickerdocumentloader.h"
-#include "locationpickerpotraitview.h"
+#include "locationpickerview.h"
#include "locationpickersearchview.h"
-#include "locationpickerlandscapeview.h"
// ---------------------------------------------------------------------------
// LocationPickerDocumentLoader::LocationPickerDocumentLoader()
@@ -42,17 +41,10 @@
//
QObject *LocationPickerDocumentLoader::createObject( const QString& type, const QString &name )
{
- //for locationpickerpotraitview
- if ( name == LocationPickerPotraitView::staticMetaObject.className() )
+ //for locationpickerview
+ if ( name == LocationPickerView::staticMetaObject.className() )
{
- QObject *object = new LocationPickerPotraitView(this);
- object->setObjectName( name );
- return object;
- }
- //for locationpickerlandscapeview
- if ( name == LocationPickerLandscapeView::staticMetaObject.className() )
- {
- QObject *object = new LocationPickerLandscapeView(this);
+ QObject *object = new LocationPickerView(this);
object->setObjectName( name );
return object;
}
--- a/locationpickerservice/src/locationpickerlandscapeview.cpp Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,352 +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: LocationPickerLandscapeView implementation
-*
-*/
-
-#include "locationpickerlandscapeview.h"
-
-#include <qstandarditemmodel.h>
-#include <HbMainWindow>
-#include <HbGridViewItem>
-#include <HbGridView>
-#include <HbStyleLoader>
-#include <HbAction>
-
-#include "locationpickerproxymodel.h"
-#include "locationpickerdatamanager.h"
-#include "locationpickercollectionlistcontent.h"
-#include "locationpickercollectioncontent.h"
-
-
-// ----------------------------------------------------
-// LocationPickerLandscapeView::LocationPickerLandscapeView()
-// ----------------------------------------------------
-LocationPickerLandscapeView::LocationPickerLandscapeView(HbDocumentLoader* aLoader)
- :mDocumentLoader(aLoader),
- mAllAction(NULL),
- mCollectionAction(NULL),
- 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");
-
- // create back action
- mLandscapeBackAction = new HbAction(Hb::BackNaviAction);
- setNavigationAction(mLandscapeBackAction);
- connect(mLandscapeBackAction, SIGNAL(triggered()), this,
- SLOT(backButtonTriggered()));
-}
-// ----------------------------------------------------
-// LocationPickerPotraitView::~LocationPickerLandscapeView()
-// ----------------------------------------------------
-LocationPickerLandscapeView::~LocationPickerLandscapeView()
-{
- delete mCollectionContent;
- delete mAllAction;
- delete mCollectionAction;
- delete mAscendingAction;
- delete mDescendingAction;
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerPotraitView::backButtonTriggered()
-// ----------------------------------------------------------------------------
-void LocationPickerLandscapeView::backButtonTriggered()
-{
- //if current model is collection content, go back to collectionlist content
- if(mViewType == ELocationPickerCollectionContent)
- {
- colectionTabTriggered();
- emit collectionContentExited();
- }
- else
- {
- //complete the service
- emit completeService();
- }
-}
-
-
-// ----------------------------------------------------
-// LocationPickerPotraitView::~init()
-// ----------------------------------------------------
-void LocationPickerLandscapeView::init(Qt::Orientation aOrientation, QStandardItemModel *aModel )
-{
- mModel = aModel;
- //create proxy model
- mProxyModel = new LocationPickerProxyModel( aOrientation , this );
- mProxyModel->setSourceModel(aModel);
- // set sort properties
- mProxyModel->setDynamicSortFilter(TRUE);
- mProxyModel->setSortRole(Qt::DisplayRole);
- mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
- // sort in ascending order
- mProxyModel->sort(0, Qt::AscendingOrder);
-
- //Get HbAction items
- mGridView = qobject_cast<HbGridView*> (mDocumentLoader->findObject(QString(
- "gridView")));
- //get the action items from docml
- mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
- "allAction")));
- mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("collectionAction")));
- mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
- "searchAction")));
- mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("ascendingAction")));
- mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("descendingAction")));
- if( !mAllAction || !mCollectionAction || !mSearchAction || !mGridView || !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,
- SLOT(sortDescending()));
- //connect all action Items to respective slots
- connect(mAllAction, SIGNAL(triggered()), this, SLOT(allTabTriggered()));
- connect(mCollectionAction, SIGNAL(triggered()), this,SLOT(colectionTabTriggered()));
- connect(mSearchAction, SIGNAL(triggered()), this,
- SLOT(searchTabTriggered()));
-
- connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-}
-
-
-void LocationPickerLandscapeView::manageGridView()
-{
- //set the appropriate model
- switch(mViewType)
- {
- case ELocationPickerContent:
- {
- mGridView->setModel(mProxyModel,mGridViewItem);
- mAllAction->setChecked(true);
- mCollectionAction->setChecked(false);
- }
- break;
- case ELocationPickerCollectionContent:
- {
- setCollectionData(mCategoryId);
- mCollectionAction->setChecked(true);
- mAllAction->setChecked(false);
- }
- break;
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::handleActivated()
-// -----------------------------------------------------------------------------
-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;
- }
-}
-
-
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::sortAscending()
-// -----------------------------------------------------------------------------
-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);
- }
-}
-
-// -----------------------------------------------------------------------------
-// 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);
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::handleAllTab()
-// -----------------------------------------------------------------------------
-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);
- }
-
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::handleCollectionTab()
-// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::colectionTabTriggered()
-{
- //execute only if tab is not pressed
- if (mCollectionAction->isChecked())
- {
- mViewType = ELocationPickerCollectionListContent;
- emit handleCollectionList();
- }
- else
- {
- //Keep the tab pressed
- mCollectionAction->setChecked(true);
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::searchTabTriggered()
-// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::searchTabTriggered()
-{
- emit switchToSearchView();
-}
-
-void LocationPickerLandscapeView::setCollectionData( quint32 aCategoryId )
-{
- if(!mCollectionContent)
- {
- mCollectionContent = new LocationPickerCollectionContent(Qt::Horizontal , aCategoryId);
- }
- if(mCollectionContent->locationFound())
- {
- mGridView->setModel(mCollectionContent->getProxyModel(),mGridViewItem);
- }
- else
- {
- mGridView->setModel(mCollectionContent->getStandardModel(),mGridViewItem);
- }
- mViewType = ELocationPickerCollectionContent;
- //Enable the options
- mAscendingAction->setEnabled(true);
- mDescendingAction->setEnabled(true);
- mCollectionAction->setChecked(true);
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::setCategoryID()
-// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::setCategoryID( quint32 aCategoryId )
-{
- mCategoryId = aCategoryId;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::getViewType()
-// -----------------------------------------------------------------------------
-TViewType LocationPickerLandscapeView::getViewType()
-{
- return mViewType;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::setViewType()
-// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::setViewType(TViewType aViewType)
-{
- mViewType = aViewType;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerLandscapeView::clearContentModel()
-// -----------------------------------------------------------------------------
-void LocationPickerLandscapeView::clearContentModel()
-{
- if(mCollectionContent)
- {
- delete mCollectionContent;
- mCollectionContent = NULL;
- }
-}
-
--- a/locationpickerservice/src/locationpickerpotraitview.cpp Fri Jun 11 16:23:56 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,409 +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: LocationPickerView implementation
-*
-*/
-
-#include "locationpickerpotraitview.h"
-
-#include <HbMainWindow>
-#include <qstandarditemmodel.h>
-#include <HbListView>
-#include <HbListViewItem>
-#include <HbAction>
-
-#include "locationpickerproxymodel.h"
-#include "locationpickerdatamanager.h"
-#include "locationpickercontent.h"
-#include "locationpickercollectionlistcontent.h"
-#include "locationpickercollectioncontent.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ----------------------------------------------------
-// LocationPickerPotraitView::LocationPickerView()
-// ----------------------------------------------------
-LocationPickerPotraitView::LocationPickerPotraitView( HbDocumentLoader* aLoader )
- :mDocumentLoader(aLoader),
- mLocationPickerCollectionListContent(NULL),
- mProxyModel(NULL),
- mAllAction(NULL),
- mCollectionAction(NULL),
- mSearchAction(NULL),
- mAscendingAction(NULL),
- mDescendingAction(NULL),
- mListView(NULL),
- mCollectionContent(NULL),
- mViewType(ELocationPickerContent)
-{
- // create back action
- mPotraitBackAction = new HbAction(Hb::BackNaviAction);
- // add back key action
- setNavigationAction(mPotraitBackAction);
- //connect to slots
- connect(mPotraitBackAction, SIGNAL(triggered()), this,
- SLOT(backTriggered()));
- //create list item
- mListItem = new HbListViewItem();
- //set the graphics size
- mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-}
-// ----------------------------------------------------
-// LocationPickerPotraitView::~LocationPickerView()
-// ----------------------------------------------------
-LocationPickerPotraitView::~LocationPickerPotraitView()
-{
- delete mCollectionContent;
- delete mLocationPickerCollectionListContent;
- delete mAllAction;
- delete mCollectionAction;
- delete mAscendingAction;
- delete mDescendingAction;
- delete mListView;
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerPotraitView::backButtonTriggered()
-// ----------------------------------------------------------------------------
-void LocationPickerPotraitView::backTriggered()
-{
- //if current model is collection content, go back to collectionlist content
- if(mViewType == ELocationPickerCollectionContent)
- {
- colectionTabTriggered();
- emit collectionContentExited();
- }
- else
- {
- //complete the service
- emit completeService();
- }
-}
-
-
-// ----------------------------------------------------
-// LocationPickerPotraitView::init()
-// ----------------------------------------------------
-void LocationPickerPotraitView::init( bool aPopulated, Qt::Orientation aOrientation, QStandardItemModel *aModel )
-{
- mModel = aModel;
- if(aPopulated)
- {
- // Create Collection List Content
- mLocationPickerCollectionListContent = new LocationPickerCollectionListContent(aOrientation);
- //create proxy model
- mProxyModel = new LocationPickerProxyModel( aOrientation , this );
- mProxyModel->setSourceModel(aModel);
- // set sort properties
- mProxyModel->setDynamicSortFilter(TRUE);
- mProxyModel->setSortRole(Qt::DisplayRole);
- mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
- // sort in ascending order
- mProxyModel->sort(0, Qt::AscendingOrder);
- }
- //Get HbAction items
- mListView = qobject_cast<HbListView*> (mDocumentLoader->findObject(QString(
- "ListView")));
- //get the action items from docml
- mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
- "allAction")));
- mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("collectionAction")));
- mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
- "searchAction")));
- mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("ascendingAction")));
- mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
- QString("descendingAction")));
- if( !mAllAction || !mCollectionAction || !mSearchAction || !mAscendingAction || !mDescendingAction || !mListView)
- {
- qFatal("Error Reading Docml");
- }
-
- //connect to slots
- connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(mDescendingAction, SIGNAL(triggered()), this,
- SLOT(sortDescending()));
- //connect all action Items to respective slots
- connect(mAllAction, SIGNAL(triggered()), this, SLOT(allTabTriggered()));
- connect(mCollectionAction, SIGNAL(triggered()), this,SLOT(colectionTabTriggered()));
- connect(mSearchAction, SIGNAL(triggered()), this,
- SLOT(searchTabTriggered()));
- // connect the signal of the list activated to a slot.
- connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-}
-
-void LocationPickerPotraitView::manageListView()
-{
- //set the appropriate model
- switch(mViewType)
- {
- case ELocationPickerContent:
- {
- mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
- mListView->setModel(mProxyModel,mListItem);
- mAllAction->setChecked(true);
- mCollectionAction->setChecked(false);
- mViewType = ELocationPickerContent;
- }
- break;
- case ELocationPickerCollectionListContent:
- {
- mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
- mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
- mCollectionAction->setChecked(true);
- mAllAction->setChecked(false);
- mViewType = ELocationPickerCollectionListContent;
- }
- break;
- case ELocationPickerCollectionContent:
- {
- setCollectionData(mCategoryId);
- mCollectionAction->setChecked(true);
- mAllAction->setChecked(false);
- mViewType = ELocationPickerCollectionContent;
- }
- break;
- default:
- break;
- }
-}
-
-
-void LocationPickerPotraitView::disableTabs( QStandardItemModel *aModel )
-{
- //if no location entries present
- mListView->setModel(aModel,mListItem);
- mAllAction->setDisabled(true);
- mCollectionAction->setDisabled(true);
- mSearchAction->setDisabled(true);
- mAscendingAction->setDisabled(true);
- mDescendingAction->setDisabled(true);
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::handleActivated()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::handleActivated( const QModelIndex &aIndex )
-{
- //handle the activated signal according to model set
- switch(mViewType)
- {
- case ELocationPickerContent:
- {
- if(!mProxyModel)
- {
- break;
- }
- 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 ELocationPickerCollectionListContent:
- {
- mLocationPickerCollectionListContent->getData(
- aIndex, mCategoryId );
- mViewType = ELocationPickerCollectionContent;
- //send categoryID to set the collection content
- emit sendCategoryID(mCategoryId);
- }
- break;
- case ELocationPickerCollectionContent:
- {
- if(!mCollectionContent->getProxyModel())
- {
- break;
- }
- QModelIndex index = mCollectionContent->getProxyModel()->mapToSource(
- aIndex);
- quint32 lm = 0;
- mCollectionContent->getData(index, lm);
- //item selected, complete request
- emit selectItem(lm);
- }
- break;
- default:
- break;
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::sortAscending()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::sortAscending()
-{
- //check the model set and do sorting accordingly
- if (mViewType == ELocationPickerContent)
- {
- mProxyModel->sort(0, Qt::AscendingOrder);
- }
- else
- {
- mCollectionContent->getProxyModel()->sort(0, Qt::AscendingOrder);
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::sortDescending()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::sortDescending()
-{
- //check the model set and do sorting accordingly
- if (mViewType == ELocationPickerContent)
- {
- mProxyModel->sort(0, Qt::DescendingOrder);
- }
- else
- {
- mCollectionContent->getProxyModel()->sort(0, Qt::DescendingOrder);
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::handleAllTab()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::allTabTriggered()
-{
- //execute only if tab is not pressed
- if (mAllAction->isChecked())
- {
- mViewType = ELocationPickerContent;
- if(this->mainWindow()->orientation() == Qt::Horizontal)
- {
- //if in landscape send signal to launch grid view
- emit handleAllList();
- }
- else
- {
- mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
- mListView->setModel(mProxyModel,mListItem);
- mCollectionAction->setChecked(false);
- }
- mAscendingAction->setEnabled(true);
- mDescendingAction->setEnabled(true);
- //delete mCollectionContent if coming back from collectioncontent
- if (mCollectionContent)
- {
- delete mCollectionContent;
- mCollectionContent = NULL;
- }
- }
- else
- {
- //Keep the tab pressed
- mAllAction->setChecked(true);
- }
-
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::handleCollectionTab()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::colectionTabTriggered()
-{
- //execute only if tab is not pressed
- if (mCollectionAction->isChecked())
- {
- mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
- mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
- mAscendingAction->setDisabled(true);
- mDescendingAction->setDisabled(true);
- mAllAction->setChecked(false);
- mViewType = ELocationPickerCollectionListContent;
- }
- else
- {
- //Keep the tab pressed
- mCollectionAction->setChecked(true);
- }
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::searchTabTriggered()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::searchTabTriggered()
-{
- emit switchToSearchView();
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::setCollectionData()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::setCollectionData( quint32 acategoryId )
-{
-
- if(!mCollectionContent)
- {
- mCollectionContent
- = new LocationPickerCollectionContent(Qt::Vertical , acategoryId);
- }
- mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
- if(mCollectionContent->locationFound())
- {
- mListView->setModel(mCollectionContent->getProxyModel(),mListItem);
- }
- else
- {
- mListView->setModel(mCollectionContent->getStandardModel(),mListItem);
- }
- mViewType = ELocationPickerCollectionContent;
- //Enable the options
- mAscendingAction->setEnabled(true);
- mDescendingAction->setEnabled(true);
- mCollectionAction->setChecked(true);
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::setCategoryID()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::setCategoryID( quint32 aCategoryId )
-{
- mCategoryId = aCategoryId;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::getViewType()
-// -----------------------------------------------------------------------------
-TViewType LocationPickerPotraitView::getViewType()
-{
- return mViewType;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::setViewType()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::setViewType(TViewType aViewType)
-{
- mViewType = aViewType;
-}
-
-
-// -----------------------------------------------------------------------------
-// LocationPickerView::clearContentModel()
-// -----------------------------------------------------------------------------
-void LocationPickerPotraitView::clearContentModel()
-{
- if(mCollectionContent)
- {
- delete mCollectionContent;
- mCollectionContent = NULL;
- }
-}
-
--- a/locationpickerservice/src/locationpickerproxymodel.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerproxymodel.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -22,9 +22,8 @@
// LocationPickerProxyModel::LocationPickerProxyModel()
// ----------------------------------------------------
-LocationPickerProxyModel::LocationPickerProxyModel( Qt::Orientations aOrientation , QObject *parent )
- :QSortFilterProxyModel(parent),
- mOrientation( aOrientation )
+LocationPickerProxyModel::LocationPickerProxyModel( QObject *parent )
+ :QSortFilterProxyModel(parent)
{
}
@@ -36,26 +35,16 @@
{
// get left and right items data and implement sort logic
// return true if left is less than right
- QVariant leftData = sourceModel()->data(left);
+ QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
- if( mOrientation == Qt::Vertical )
- {
- QStringList leftStringList = leftData.toStringList();
+ QStringList leftStringList = leftData.toStringList();
- QStringList rightStringList = rightData.toStringList();
+ QStringList rightStringList = rightData.toStringList();
- return QString::compare( QString( leftStringList[0] + " " + leftStringList[1] ),
- QString( rightStringList[0] + " " + rightStringList[1] ), Qt::CaseInsensitive ) < 0;
- }
- else
- {
- QString leftString = leftData.toString();
+ return QString::compare( QString( leftStringList[0] + " " + leftStringList[1] ),
+ QString( rightStringList[0] + " " + rightStringList[1] ), Qt::CaseInsensitive ) < 0;
- QString rightString = rightData.toString();
-
- return QString::compare( leftString, rightString, Qt::CaseInsensitive ) < 0;
- }
}
// ----------------------------------------------------
@@ -65,8 +54,7 @@
bool LocationPickerProxyModel::filterAcceptsRow( int sourceRow,
const QModelIndex &sourceParent ) const
{
- if( mOrientation == Qt::Vertical)
- {
+
// implement logic for search.
QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
@@ -74,9 +62,7 @@
QString fullString = " " + stringList[0] + " " + stringList[1];
return (fullString.contains(mSearchText, Qt::CaseInsensitive));
- }
- else
- return true;
+
}
// ----------------------------------------------------
--- a/locationpickerservice/src/locationpickersearchview.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickersearchview.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -22,6 +22,8 @@
#include <HbTextItem>
#include <HbDocumentLoader>
#include <QGraphicsLinearLayout>
+#include <HbMenu>
+#include <HbAction>
#include "locationpickerproxymodel.h"
#include "locationpickersearchview.h"
@@ -39,7 +41,9 @@
mSearchPanel(NULL),
mEmptyLabel(NULL),
mVerticalLayout(NULL),
- mDocumentLoader(aLoader)
+ mDocumentLoader(aLoader),
+ mLongPressMenu(NULL),
+ mSelectAction(NULL)
{
}
@@ -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)));
@@ -84,7 +86,7 @@
mListView->setItemPrototype( hbListItem );
// Create the proxy model.
- mProxyModel = new LocationPickerProxyModel( Qt ::Vertical );
+ mProxyModel = new LocationPickerProxyModel();
mProxyModel->setSourceModel(mModel);
mListView->setModel(mProxyModel);
@@ -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,37 @@
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);
+ mSelectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ mIndex = aItem->modelIndex();
+ connect(mSelectAction, SIGNAL(triggered()),this, SLOT(handleLongPress()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
+ mLongPressMenu->open();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerSearchView::handleLongPress()
+// -----------------------------------------------------------------------------
+void LocationPickerSearchView::handleLongPress()
+{
+ handleActivated(mIndex);
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerSearchView::deleteMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerSearchView::deleteMenu()
+{
+ mLongPressMenu->deleteLater();
+ mLongPressMenu = NULL;
+ mSelectAction->deleteLater();
+ mSelectAction = NULL;
+}
--- a/locationpickerservice/src/locationpickerservice.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/locationpickerservice.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -50,10 +50,6 @@
connect( this, SIGNAL( returnValueDelivered() ), qApp, SLOT( quit() ) );
bool ok = completeRequest(mAsyncReqId,mReturn);
mAsyncReqId = 0;
- if(ok == false)
- {
- qApp->quit();
- }
}
}
// ----------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickerview.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -0,0 +1,770 @@
+/*
+* 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: LocationPickerView implementation
+*
+*/
+
+#include "locationpickerview.h"
+
+#include <HbMainWindow>
+#include <qstandarditemmodel.h>
+#include <HbListView>
+#include <HbListViewItem>
+#include <HbAction>
+#include <HbMenu>
+#include <HbToolBar>
+#include <HbStyleLoader>
+#include <QGraphicsLinearLayout>
+#include <HbDialog>
+
+#include "hgwidgetdatamodel.h"
+#include "locationpickerproxymodel.h"
+#include "locationpickerdatamanager.h"
+#include "locationpickercontent.h"
+#include "locationpickercollectionlistcontent.h"
+#include "locationpickercollectioncontent.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ----------------------------------------------------
+// LocationPickerView::LocationPickerView()
+// ----------------------------------------------------
+LocationPickerView::LocationPickerView( HbDocumentLoader* aLoader )
+ :mDocumentLoader(aLoader),
+ mLocationPickerCollectionListContent(NULL),
+ mProxyModel(NULL),
+ mAllAction(NULL),
+ mCollectionAction(NULL),
+ mSearchAction(NULL),
+ mAscendingAction(NULL),
+ mDescendingAction(NULL),
+ mListView(NULL),
+ mCollectionContent(NULL),
+ mViewType(ELocationPickerContent),
+ mLinerLayout(NULL),
+ mColllabel(NULL),
+ mEmptyLabel(NULL),
+ mDialog(NULL),
+ mMapIconLabel(NULL),
+ mTitleLabel(NULL),
+ mAddressMiddle(NULL),
+ mAddressBottom(NULL),
+ mLongPressMenu(NULL),
+ mSelectAction(NULL),
+ mDetailsAction(NULL),
+ mPopulated(false)
+{
+ //Create Action Items
+ mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+ QString("allAction")));
+ mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+ QString("collectionAction")));
+ mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+ QString("searchAction")));
+ mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+ QString("ascendingAction")));
+ mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+ QString("descendingAction")));
+ if( !mAllAction || !mCollectionAction || !mSearchAction || !mAscendingAction || !mDescendingAction )
+ {
+ qFatal("Error Reading Docml");
+ }
+ // create back action
+ mBackAction = new HbAction(Hb::BackNaviAction);
+ // add back key action
+ setNavigationAction(mBackAction);
+ //connect to slots
+ connect(mBackAction, SIGNAL(triggered()), this,
+ SLOT(backTriggered()));
+ //create list item
+ mListItem = new HbListViewItem();
+ //set the graphics size
+ mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+}
+// ----------------------------------------------------
+// LocationPickerView::~LocationPickerView()
+// ----------------------------------------------------
+LocationPickerView::~LocationPickerView()
+{
+ delete mListItem;
+ delete mBackAction;
+ if(mPopulated)
+ {
+ mLinerLayout->removeItem(mListView);
+ mLinerLayout->removeItem(mWidget);
+ delete mCollectionContent;
+ delete mLocationPickerCollectionListContent;
+ delete mListView;
+ delete mWidget;
+ delete mHgModel;
+ delete mProxyModel;
+ delete mColllabel;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerView::backButtonTriggered()
+// ----------------------------------------------------------------------------
+void LocationPickerView::backTriggered()
+{
+ //if current model is collection content, go back to collectionlist content
+ if(mViewType == ELocationPickerCollectionContent)
+ {
+ removeDetailsLabel();
+ colectionTabTriggered();
+ clearContentModel();
+ }
+ else
+ {
+ //complete the service
+ emit completeService();
+ }
+
+}
+
+
+// ----------------------------------------------------
+// LocationPickerView::init()
+// ----------------------------------------------------
+void LocationPickerView::init( Qt::Orientation aOrientation, QStandardItemModel *aModel )
+{
+ mPopulated = true;
+ // Create Collection List Content
+ mLocationPickerCollectionListContent = new LocationPickerCollectionListContent();
+ mModel = aModel;
+ // Create Collection List Content
+ mLocationPickerCollectionListContent = new LocationPickerCollectionListContent();
+ //create proxy model
+ mProxyModel = new LocationPickerProxyModel( this );
+ mProxyModel->setSourceModel(aModel);
+ // set sort properties
+ mProxyModel->setDynamicSortFilter(TRUE);
+ mProxyModel->setSortRole(Qt::DisplayRole);
+ mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
+ // sort in ascending order
+ mProxyModel->sort(0, Qt::AscendingOrder);
+ mLinerLayout = static_cast<QGraphicsLinearLayout*>(widget()->layout());
+ //Get HbAction items
+ mListView = new HbListView();
+ mColllabel = new HbLabel();
+ createHurriganesWidget();
+ mWidget->setModel(mHgModel);
+ //connect to slots
+ connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+ connect(mDescendingAction, SIGNAL(triggered()), this,
+ SLOT(sortDescending()));
+ //connect all action Items to respective slots
+ connect(mAllAction, SIGNAL(triggered()), this, SLOT(allTabTriggered()));
+ connect(mCollectionAction, SIGNAL(triggered()), this,SLOT(colectionTabTriggered()));
+ connect(mSearchAction, SIGNAL(triggered()), this,
+ SLOT(searchTabTriggered()));
+ // connect the signal of the list activated to a slot.
+ connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
+ connect(mListView,SIGNAL(longPressed(HbAbstractViewItem*, const QPointF &)),this,
+ SLOT(launchPopUpMenu(HbAbstractViewItem*, const QPointF &)));
+ //set widget according to orientation
+ if(aOrientation == Qt::Horizontal)
+ {
+ manageHgWidget();
+ }
+ else
+ {
+ manageListView();
+ }
+}
+
+
+void LocationPickerView::createHurriganesWidget()
+{
+ //hurrriganes widget
+ mHgModel = new HgWidgetDataModel( mProxyModel, this );
+ mHgModel->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);
+ HgMediawall* mediawall = qobject_cast<HgMediawall*>( mWidget );
+ mediawall->setObjectName("location");
+ HbStyleLoader::registerFilePath(":/location.hgmediawall.widgetml");
+ HbStyleLoader::registerFilePath(":/location.hgmediawall.css");
+ mediawall->enableReflections(false);
+ mediawall->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ mediawall->setItemSize(QSize(4,3));
+ 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 &)));
+ mWidget->setLongPressEnabled(true);
+ mWidget->scrollTo(mWidget->currentIndex());
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::manageHgWidget()
+// -----------------------------------------------------------------------------
+void LocationPickerView::manageHgWidget()
+{
+ removeDetailsLabel();
+ mLinerLayout->removeItem(mListView);
+ mListView->hide();
+ mWidget->show();
+ mLinerLayout->updateGeometry();
+ //set the appropriate model
+ switch(mViewType)
+ {
+ case ELocationPickerContent:
+ {
+ mHgModel->resetModel(mProxyModel);
+ mAllAction->setChecked(true);
+ mCollectionAction->setChecked(false);
+ mLinerLayout->insertItem(1,mWidget);
+ }
+ break;
+ case ELocationPickerCollectionContent:
+ {
+ setCollectionData(mCategoryId);
+ mCollectionAction->setChecked(true);
+ mAllAction->setChecked(false);
+ }
+ break;
+ }
+}
+
+// ----------------------------------------------------
+// LocationPickerView::manageListView()
+// ----------------------------------------------------
+void LocationPickerView::manageListView()
+{
+ if(mEmptyLabel)
+ {
+ removeDetailsLabel();
+ }
+ else
+ {
+ mLinerLayout->removeItem(mWidget);
+ mWidget->hide();
+ }
+ mLinerLayout->insertItem(1,mListView);
+ mListView->show();
+ //set the appropriate model
+ switch(mViewType)
+ {
+ case ELocationPickerContent:
+ {
+ mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+ mListView->setModel(mProxyModel,mListItem);
+ mAllAction->setChecked(true);
+ mCollectionAction->setChecked(false);
+ mViewType = ELocationPickerContent;
+ }
+ break;
+ case ELocationPickerCollectionListContent:
+ {
+ mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
+ mCollectionAction->setChecked(true);
+ mAllAction->setChecked(false);
+ if(mAscendingAction->isEnabled())
+ {
+ mAscendingAction->setDisabled(true);
+ mDescendingAction->setDisabled(true);
+ }
+ mViewType = ELocationPickerCollectionListContent;
+ }
+ break;
+ case ELocationPickerCollectionContent:
+ {
+ mCollectionAction->setChecked(true);
+ mAllAction->setChecked(false);
+ mViewType = ELocationPickerCollectionContent;
+ setCollectionData(mCategoryId);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::disableTabs()
+// -----------------------------------------------------------------------------
+void LocationPickerView::disableTabs()
+{
+ //if no location entries present
+ mLinerLayout = static_cast<QGraphicsLinearLayout*>(widget()->layout());
+ mEmptyLabel = new HbTextItem( hbTrId( "txt_lint_list_no_location_entries_present" ) );
+ mEmptyLabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
+ mEmptyLabel->setFontSpec( HbFontSpec( HbFontSpec::Primary ) );
+ mEmptyLabel->setAlignment( Qt::AlignCenter );
+ mLinerLayout->insertItem( 1, mEmptyLabel );
+ mAllAction->setDisabled( true );
+ mCollectionAction->setDisabled( true );
+ mSearchAction->setDisabled( true );
+ mAscendingAction->setDisabled( true );
+ mDescendingAction->setDisabled( true );
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleActivated()
+// -----------------------------------------------------------------------------
+void LocationPickerView::handleActivated( const QModelIndex &aIndex )
+{
+ QModelIndex index;
+ QStandardItem* item;
+ int row= aIndex.row();
+ int col = aIndex.column();
+ //handle the activated signal according to model set
+ switch(mViewType)
+ {
+ case ELocationPickerContent:
+ {
+ if(mainWindow()->orientation() == Qt::Vertical)
+ {
+ index = mProxyModel->mapToSource(
+ aIndex);
+ item = mModel->item( index.row(), index.column() );
+ }
+ else
+ {
+ QModelIndex proxyModelIndex = mProxyModel->index(row,col);
+ index = mProxyModel->mapToSource(
+ proxyModelIndex);
+ item = mModel->item( index.row(), index.column() );
+ }
+ QVariant var = item->data( Qt::UserRole );
+ quint32 lm = var.toUInt();
+ //item selected, complete request
+ emit selectItem( lm );
+ }
+ break;
+ case ELocationPickerCollectionListContent:
+ {
+ mLocationPickerCollectionListContent->getData(
+ aIndex, mCategoryId );
+ setCollectionData(mCategoryId);
+ mViewType = ELocationPickerCollectionContent;
+ }
+ break;
+ case ELocationPickerCollectionContent:
+ {
+ if(mainWindow()->orientation() == Qt::Vertical)
+ {
+ index = mCollectionContent->getProxyModel()->mapToSource(
+ aIndex);
+ }
+ else
+ {
+ QModelIndex proxyModelIndex = mCollectionContent->getProxyModel()->index(row,col);
+ index = mCollectionContent->getProxyModel()->mapToSource(
+ proxyModelIndex);
+ }
+ quint32 lm = 0;
+ mCollectionContent->getData(index, lm);
+ //item selected, complete request
+ emit selectItem(lm);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::sortAscending()
+// -----------------------------------------------------------------------------
+void LocationPickerView::sortAscending()
+{
+ //check the model set and do sorting accordingly
+ if (mViewType == ELocationPickerContent)
+ {
+ mProxyModel->sort( 0, Qt::AscendingOrder );
+ if(mainWindow()->orientation()==Qt::Horizontal)
+ mHgModel->resetModel(mProxyModel);
+ }
+ else
+ {
+ mCollectionContent->getProxyModel()->sort( 0, Qt::AscendingOrder );
+ if(mainWindow()->orientation()==Qt::Horizontal)
+ mHgModel->resetModel(mCollectionContent->getProxyModel());
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::sortDescending()
+// -----------------------------------------------------------------------------
+void LocationPickerView::sortDescending()
+{
+ //check the model set and do sorting accordingly
+ if (mViewType == ELocationPickerContent)
+ {
+ mProxyModel->sort(0, Qt::DescendingOrder);
+ if(mainWindow()->orientation()==Qt::Horizontal)
+ mHgModel->resetModel(mProxyModel);
+ }
+ else
+ {
+ mCollectionContent->getProxyModel()->sort( 0, Qt::DescendingOrder );
+ if(mainWindow()->orientation()==Qt::Horizontal)
+ mHgModel->resetModel(mCollectionContent->getProxyModel());
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::allTabTriggered()
+// -----------------------------------------------------------------------------
+void LocationPickerView::allTabTriggered()
+{
+ removeDetailsLabel();
+ //execute only if tab is not pressed
+ if (mAllAction->isChecked())
+ {
+ mViewType = ELocationPickerContent;
+ mCollectionAction->setChecked(false);
+ mAscendingAction->setEnabled(true);
+ mDescendingAction->setEnabled(true);
+ //delete mCollectionContent if coming back from collectioncontent
+ if (mCollectionContent)
+ {
+ delete mCollectionContent;
+ mCollectionContent = NULL;
+ }
+ if(mainWindow()->orientation() == Qt::Vertical)
+ {
+ manageListView();
+ }
+ else
+ {
+ manageHgWidget();
+ }
+ }
+ else
+ {
+ //Keep the tab pressed
+ mAllAction->setChecked(true);
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::colectionTabTriggered()
+// -----------------------------------------------------------------------------
+void LocationPickerView::colectionTabTriggered()
+{
+ mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
+ removeDetailsLabel();
+ //execute only if tab is not pressed
+ if (mCollectionAction->isChecked())
+ {
+ mAscendingAction->setDisabled(true);
+ mDescendingAction->setDisabled(true);
+ mAllAction->setChecked(false);
+ mViewType = ELocationPickerCollectionListContent;
+ manageListView();
+ }
+ else
+ {
+ //Keep the tab pressed
+ mCollectionAction->setChecked(true);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::searchTabTriggered()
+// -----------------------------------------------------------------------------
+void LocationPickerView::searchTabTriggered()
+{
+ emit switchToSearchView();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::setCollectionData()
+// -----------------------------------------------------------------------------
+void LocationPickerView::setCollectionData( quint32 acategoryId )
+{
+ if(!mCollectionContent)
+ {
+ mCollectionContent
+ = new LocationPickerCollectionContent( acategoryId );
+ }
+
+ if(mainWindow()->orientation() == Qt::Vertical)
+ {
+ QString categoryname;
+ removeDetailsLabel();
+ switch(acategoryId)
+ {
+
+ case 1: categoryname = "Landmarks";
+ break;
+ case 8: categoryname = "Contacts";
+ break;
+ case 9: categoryname = "Calender";
+ break;
+ }
+ if(mCollectionContent->locationFound())
+ {
+ mListView->setModel( mCollectionContent->getProxyModel(),mListItem );
+ //Enable the options
+ mAscendingAction->setEnabled(true);
+ mDescendingAction->setEnabled(true);
+ mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+ }
+ else
+ {
+ displayNoEntries();
+ }
+ mCollectionAction->setChecked(true);
+
+ if(mColllabel)
+ {
+ mLinerLayout->insertItem(0,mColllabel);
+ mColllabel->setPlainText(categoryname);
+ mColllabel->show();
+ }
+ }
+ else
+ {
+ if(mCollectionContent->locationFound())
+ {
+ mHgModel->resetModel( mCollectionContent->getProxyModel() );
+ //Enable the options
+ mAscendingAction->setEnabled(true);
+ mDescendingAction->setEnabled(true);
+ mLinerLayout->removeItem(mListView);
+ mListView->hide();
+ mLinerLayout->insertItem(1,mWidget);
+ mWidget->show();
+ mLinerLayout->updateGeometry();
+ }
+ else
+ {
+ displayNoEntries();
+ }
+ }
+ mViewType = ELocationPickerCollectionContent;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::getViewType()
+// -----------------------------------------------------------------------------
+TViewType LocationPickerView::getViewType()
+{
+ return mViewType;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::setViewType()
+// -----------------------------------------------------------------------------
+void LocationPickerView::setViewType( TViewType aViewType )
+{
+ mViewType = aViewType;
+}
+
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::clearContentModel()
+// -----------------------------------------------------------------------------
+void LocationPickerView::clearContentModel()
+{
+ if(mCollectionContent)
+ {
+ delete mCollectionContent;
+ mCollectionContent = NULL;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::launchPopUpMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerView::launchPopUpMenu( HbAbstractViewItem *aItem, const QPointF &aPoint )
+{
+ mLongPressMenu = new HbMenu();
+ mLongPressMenu->setTimeout(HbMenu::NoTimeout);
+ connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
+ mSelectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ if( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent )
+ {
+ mDetailsAction = mLongPressMenu->addAction(hbTrId("txt_lint_list_details"));
+ connect(mDetailsAction, SIGNAL(triggered()), this, SLOT(handleDetails()));
+ }
+ mIndex = aItem->modelIndex();
+ connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ mLongPressMenu->open();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::launchPopUpMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerView::launchPopUpMenu( const QModelIndex &aIndex, const QPointF &aPoint )
+{
+ mLongPressMenu = new HbMenu();
+ mLongPressMenu->setTimeout(HbMenu::NoTimeout);
+ connect(mLongPressMenu,SIGNAL(aboutToClose ()),this,SLOT(deleteMenu()));
+ mSelectAction = mLongPressMenu->addAction(hbTrId("Select"));
+ mIndex = aIndex;
+ connect(mSelectAction, SIGNAL(triggered()), this, SLOT(handleSelect()));
+ mLongPressMenu->setPreferredPos(aPoint);
+ mLongPressMenu->open();
+}
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleSelect()
+// -----------------------------------------------------------------------------
+void LocationPickerView::handleSelect()
+{
+ handleActivated(mIndex);
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::deleteMenu()
+// -----------------------------------------------------------------------------
+void LocationPickerView::deleteMenu()
+{
+ mLongPressMenu->deleteLater();
+ mLongPressMenu = NULL;
+ mSelectAction->deleteLater();
+ mSelectAction = NULL;
+ mDetailsAction->deleteLater();
+ mDetailsAction = NULL;
+
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleSelect()
+// -----------------------------------------------------------------------------
+void LocationPickerView::handleDetails()
+{
+ HbDocumentLoader* loader = new HbDocumentLoader();
+
+ bool ok = false;
+ //load the popup dialog
+ loader->load(":/popupdialog.docml", &ok);
+ Q_ASSERT_X(ok,"locationpickerservice","invalid DocML file");
+ //find graphics popup dialog
+ QGraphicsWidget *popUpDialog = loader->findWidget("dialog");
+ Q_ASSERT_X((popUpDialog != 0), "locationpickerservice", "invalid DocML file");
+ mDialog = qobject_cast<HbDialog*>(popUpDialog);
+ mMapIconLabel = qobject_cast<HbLabel*>(loader->findWidget("mapLabel"));
+ mTitleLabel = qobject_cast<HbLabel*>(loader->findWidget("titleLabel"));
+ mAddressMiddle = qobject_cast<HbLabel*>(loader->findWidget("addressMiddle"));
+ mAddressBottom = qobject_cast<HbLabel*>(loader->findWidget("addressBottom"));
+ mDone = qobject_cast<HbAction*>(loader->findObject(QString("action")));
+ mTitleLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ mDialog->setDismissPolicy(HbDialog::NoDismiss);
+ mDialog->setTimeout(HbDialog::NoTimeout);
+ connect(mDone, SIGNAL(triggered()), this, SLOT(closeDetailsDialog()));
+ QStringList adressDetail;
+ QString iconName;
+ mMapIconLabel->setAlignment(Qt::AlignCenter);
+ if(mViewType == ELocationPickerContent)
+ {
+ adressDetail = mProxyModel->data(mIndex,Qt::UserRole+3).toStringList();
+ iconName = mProxyModel->data(mIndex,Qt::UserRole+1).toString();
+ }
+ else
+ {
+ adressDetail = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+3).toStringList();
+ iconName = mCollectionContent->getProxyModel()->data(mIndex,Qt::UserRole+1).toString();
+ }
+ if(iconName.isEmpty())
+ {
+ mMapIconLabel->setIcon(KDummyImage);
+ }
+ else
+ {
+ mMapIconLabel->setIcon(HbIcon(iconName));
+ }
+
+ if(adressDetail[0].isEmpty() && adressDetail[1].isEmpty())
+ {
+ mTitleLabel->setPlainText(adressDetail[2]);
+ mAddressMiddle->setPlainText(QString(""));
+ mAddressBottom->setPlainText(QString(""));
+ }
+ else if(adressDetail[0].isEmpty())
+ {
+ mTitleLabel->setPlainText(adressDetail[1]);
+ mAddressMiddle->setPlainText(adressDetail[2]);
+ mAddressBottom->setPlainText(QString(""));
+ }
+ else if (adressDetail[1].isEmpty())
+ {
+ mTitleLabel->setPlainText(adressDetail[0]);
+ mAddressMiddle->setPlainText(adressDetail[2]);
+ mAddressBottom->setPlainText(QString(""));
+ }
+ else
+ {
+ mTitleLabel->setPlainText(adressDetail[0]);
+ mAddressMiddle->setPlainText(adressDetail[1]);
+ mAddressBottom->setPlainText(adressDetail[2]);
+ }
+
+ mDialog->open();
+ delete loader;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::closeDetailsDialog()
+// -----------------------------------------------------------------------------
+void LocationPickerView::closeDetailsDialog()
+{
+ if(mDialog)
+ {
+ mDialog->close();
+ delete mDialog;
+ mDialog = NULL;
+ }
+}
+// -----------------------------------------------------------------------------
+// LocationPickerView::displayNoEntries()
+// -----------------------------------------------------------------------------
+void LocationPickerView::displayNoEntries()
+{
+ if(!mEmptyLabel)
+ {
+ mEmptyLabel = new HbTextItem(hbTrId("txt_lint_list_no_location_entries_present"));
+ mEmptyLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+ mEmptyLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+ mEmptyLabel->setAlignment(Qt::AlignCenter);
+ mLinerLayout->removeItem(mListView);
+ mListView->hide();
+ mWidget->setVisible(false);
+ mLinerLayout->insertItem(0, mEmptyLabel);
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::removeDetailsLabel()
+// -----------------------------------------------------------------------------
+void LocationPickerView::removeDetailsLabel()
+{
+ if (mLinerLayout && mColllabel)
+ {
+ mColllabel->setPlainText("");
+ mLinerLayout->removeItem(mColllabel);
+ mColllabel->hide();
+ }
+ if(mEmptyLabel)
+ {
+ mLinerLayout->removeItem(mEmptyLabel);
+ mEmptyLabel->hide();
+ delete mEmptyLabel;
+ mEmptyLabel = NULL;
+ }
+}
+
--- a/locationpickerservice/src/main.cpp Fri Jun 11 16:23:56 2010 +0100
+++ b/locationpickerservice/src/main.cpp Thu Jul 22 16:31:43 2010 +0100
@@ -16,22 +16,16 @@
*/
#include <HbApplication>
-#include <QTranslator>
-#include <QLocale>
+#include <HbTranslator>
#include "locationpickerappwindow.h"
-#include "locationpickertypes.h"
int main(int argc, char *argv[])
{
- HbApplication app(argc, argv);
-
- QTranslator translator;
- QString lang = QLocale::system().name();
- translator.load("lilpicker_" + lang);
- app.installTranslator(&translator);
-
+ HbApplication app(argc, argv);
+ HbTranslator translator("lilpicker");
app.setApplicationName( hbTrId("txt_lint_title_select_location") );
LocationPickerAppWindow mainWindow;
+ mainWindow.viewport()->grabGesture(Qt::TapGesture);
mainWindow.show();
return app.exec();
}