Revision: 201017
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 14 May 2010 15:47:27 +0300
changeset 20 cd10d5b85554
parent 17 0f22fb80ebba
child 22 0ff2917a90c9
child 24 ccec19943943
Revision: 201017 Kit: 201019
location_plat/location_data_harvester_api/inc/locationdatalookupdb.h
location_plat/location_data_harvester_api/inc/locationservicedefines.h
location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h
location_plat/location_data_harvester_api/location_data_harvester_api.pri
locationdataharvester/bwins/geocodeupdateu.def
locationdataharvester/bwins/locationdatalookupdbu.def
locationdataharvester/eabi/geocodeupdateu.def
locationdataharvester/eabi/locationdatalookupdbu.def
locationdataharvester/geocodeupdate/bwins/geocodeupdate.def
locationdataharvester/geocodeupdate/eabi/geocodeupdate.def
locationdataharvester/geocodeupdate/geocodeupdate.pro
locationdataharvester/geocodeupdate/group/bld.inf
locationdataharvester/geocodeupdate/group/geocodeupdate.mmp
locationdataharvester/geocodeupdate/inc/geocodeupdate.h
locationdataharvester/geocodeupdate/src/geocodeupdate.cpp
locationdataharvester/inc/mylocationsdefines.h
locationdataharvester/locationdataharvester.pro
locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp
locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro
locationdataharvester/maptileservice/src/maptileservice.cpp
locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp
locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro
locationdataharvester/mylocationsengine/data/mylocations.rss
locationdataharvester/mylocationsengine/group/bld.inf
locationdataharvester/mylocationsengine/group/mylocationsengine.mmp
locationdataharvester/mylocationsengine/inc/addresscomparision.h
locationdataharvester/mylocationsengine/inc/calendernotification.h
locationdataharvester/mylocationsengine/inc/maptileinterface.h
locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h
locationdataharvester/mylocationsengine/inc/mylocationsengine.h
locationdataharvester/mylocationsengine/inc/mylocationslookupdb.h
locationdataharvester/mylocationsengine/loc/mylocations.loc
locationdataharvester/mylocationsengine/mylocationsengine.pro
locationdataharvester/mylocationsengine/src/appmain.cpp
locationdataharvester/mylocationsengine/src/calendernotification.cpp
locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp
locationdataharvester/mylocationsengine/src/maptileinterface.cpp
locationdataharvester/mylocationsengine/src/mylocationsdatabasemanager.cpp
locationdataharvester/mylocationsengine/src/mylocationsengine.cpp
locationdataharvester/mylocationsengine/src/mylocationslookupdb.cpp
locationdataharvester/rom/mylocations.iby
locationpickerservice/inc/locationpickerappwindow.h
locationpickerservice/inc/locationpickercollectioncontent.h
locationpickerservice/inc/locationpickercollectionlistcontent.h
locationpickerservice/inc/locationpickercontent.h
locationpickerservice/inc/locationpickerdatamanager.h
locationpickerservice/inc/locationpickerdatamanager_p.h
locationpickerservice/inc/locationpickerdocumentloader.h
locationpickerservice/inc/locationpickerlandscapeview.h
locationpickerservice/inc/locationpickerpotraitview.h
locationpickerservice/inc/locationpickerproxymodel.h
locationpickerservice/inc/locationpickersearchview.h
locationpickerservice/inc/locationpickertypes.h
locationpickerservice/locationpickerservice.pro
locationpickerservice/resources/locationpickerlandscape.docml
locationpickerservice/resources/locationpickerpotrait.docml
locationpickerservice/resources/locationpickersearchview.docml
locationpickerservice/src/locationpickerappwindow.cpp
locationpickerservice/src/locationpickercollectioncontent.cpp
locationpickerservice/src/locationpickercollectionlistcontent.cpp
locationpickerservice/src/locationpickercontent.cpp
locationpickerservice/src/locationpickerdatamanager.cpp
locationpickerservice/src/locationpickerdatamanager_p.cpp
locationpickerservice/src/locationpickerdocumentloader.cpp
locationpickerservice/src/locationpickerlandscapeview.cpp
locationpickerservice/src/locationpickerpotraitview.cpp
locationpickerservice/src/locationpickerproxymodel.cpp
locationpickerservice/src/locationpickersearchview.cpp
locationpickerservice/src/locationpickerservice.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/location_plat/location_data_harvester_api/inc/locationdatalookupdb.h	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,231 @@
+/*
+* 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: defines api for lookup database.
+*
+*/
+
+
+#ifndef LOCATIONDATA_LOOKUPDB_H
+#define LOCATIONDATA_LOOKUPDB_H
+
+// DLL_EXPORT macro definition
+#ifdef BUILD_DLL
+#define DLL_EXPORT Q_DECL_EXPORT
+#else
+#define DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+
+
+// INCLUDES
+#include <QObject>
+#include <locationservicedefines.h>
+
+class QSqlDatabase;
+class QSqlQuery;
+
+class QLookupItem
+{
+    
+public:
+    
+    enum IconType
+    {
+        /** Icon type default */
+        EIconTypeDefault,
+        /** Icon type from gallery */
+        EIconTypeGallery,
+        /** Icon type from flicker */
+        EIconTypeFlicker,
+        /** Icon type from contact thumbnail */
+        EIconTypeContactThumbnail,
+        /** Icon type maptile */
+        EIconTypeMapTile
+    };
+    
+public:
+    // unique id of the entry
+    quint32 mId;
+
+    // flag to identify if the entry is a duplicate
+    quint32 mIsDuplicate;
+
+    // Uid of the source entry
+    quint32 mSourceUid;
+
+    // Source type
+    quint32 mSourceType;
+
+    // Dest uid in the landmarks database
+    quint32 mDestId;
+   
+    // name
+    QString mName;
+
+    // Street
+    QString mStreet;
+
+    // Postal code
+    QString mPostalCode;
+
+    // City
+    QString mCity;
+
+    // State
+    QString mState;
+
+    // Country
+    QString mCountry;
+    
+    // latitude
+    double mLatitude;
+    
+    // longitude
+    double mLongitude;
+    
+    // icon type
+    quint32 mIconType;
+    
+    // icon path
+    QString mIconPath;
+
+    // map tile path
+    QString mMapTilePath;
+};
+
+/**
+* Location data lookup database class.
+*/
+class DLL_EXPORT LocationDataLookupDb : public QObject
+{
+	
+public: // Constructor
+
+    /**
+    * Constructor
+    */
+    LocationDataLookupDb( QObject *parent = 0 );	
+
+    /**
+    * Destructor
+    */
+    ~LocationDataLookupDb();  
+
+    /**
+    * Opens the lookup database.
+    */
+    bool 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 createEntry( const QLookupItem& aLookupItem );
+
+    /**
+    * Updates an entry in the lookup table.
+    * The source id and type is used to find the entry in db
+    * @param[in] aLookupItem The lookup item to be updated in the database.
+    */
+    void updateEntryBySourceIdAndType( const QLookupItem& aLookupItem );
+
+    /**
+    * Updates an entry in the lookup table.
+    * The source id and type is used to find the entry in db
+    * @param[in] aLookupItem The lookup item to be updated in the database.
+    */
+    void updateMaptileBySourceIdAndType( quint32 aSourceId, quint32 aSourceType, QString aImagePath );
+
+    /**
+    * Updates an entry in the lookup table.
+    * The id is used to find the entry in db
+    * @param[in] aLookupItem The lookup item to be updated in the database.
+    */
+    void updateEntryById( const QLookupItem& aLookupItem );
+
+    /**
+    * Deletes an entry from the lookup table.
+    * The source id and type is used to find the entry in db
+    * @param[in] aLookupItem The lookup item to be deleted from the database.
+    */
+    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.
+    * @return true if found, else false
+    */
+    bool findEntryBySourceIdAndType( QLookupItem& aLookupItem );
+
+    /**
+    * Finds an entry in the lookup table.
+    * @param[in/out] aLookupItem The lookup item to be found in the database. The id is passed 
+    * in the lookup item. If the entry is found, all other fields are updated in the lookup item.
+    * @return true if found, else false
+    */
+    bool findEntryById( QLookupItem& 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 entries found.  
+    */
+    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 );
+
+
+private:
+	
+    // fills the lookup entry
+    void fillLookupEntry( QSqlQuery &aRecord, QLookupItem &aLookupItem );
+    
+    // Handle to the items database
+    QSqlDatabase *mDb;
+};
+#endif  // LOCATIONDATA_LOOKUPDB_H
+
+// End of file
+    
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/location_plat/location_data_harvester_api/inc/locationservicedefines.h	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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: defines constants and types.
+*
+*/
+
+
+#ifndef LOCATIONSERVICEDEFINES_H
+#define LOCATIONSERVICEDEFINES_H
+
+/** Defines uid source type
+ */
+enum TUidSourceType
+{
+    /** Uid Source type calendar */
+    ESourceCalendar,
+    /** Uid Source type landmarks */
+    ESourceLandmarks,
+    /** Uid Source type maps history */
+    ESourceMapsHistory,
+    /** Uid Source type contacts default/prefered address */
+    ESourceContactsPref,
+    /** 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 */
+    ESourceLandmarksUserCat,
+    /** Uid Source type landmarks 'contacts' category */
+    ESourceLandmarksContactsCat,
+    /** Uid Source type landmarks 'calendar' category */
+    ESourceLandmarksCalendarCat,
+    /** Uid Source type maps history' category */
+    ESourceLandmarksHistoryCat,
+    /** Source type invalid */
+    ESourceInvalid
+};
+
+#endif // QLOCATIONPICKERITEM_H
--- a/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h	Mon May 03 12:27:22 2010 +0300
+++ b/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h	Fri May 14 15:47:27 2010 +0300
@@ -22,7 +22,7 @@
 
 // INCLUDES
 #include <e32base.h>
-#include <LbsPosition.h> 
+#include <lbsposition.h> 
 #include <EPos_CPosLandmark.h>
 
 //Maptile geocoder plugin uid
@@ -42,18 +42,74 @@
     /**
      * Gets the latitude information.
      * 
-     * @param aLatitude latitude value. 
+     * @return aLatitude latitude value. 
      */
-    virtual void GetLatitude( TReal& aLatitude ) = 0;
+    virtual const TReal& GetLatitude( ) = 0;
     
     
     /**
 	 * Gets the longitude information.
 	 * 
-	 * @param aLongitude longitude value. 
+	 * @return aLongitude longitude value. 
 	 */
-    virtual void GetLongitude( TReal& aLongitude ) = 0;
-      
+    virtual const TReal& GetLongitude( ) = 0;
+    
+    /*
+     * Gets the reference to the country name. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the Country Name. 
+     */
+    virtual const TDesC& GetCountryName()= 0;
+    
+    /*
+     * Gets the reference to the State. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the State name. 
+     */
+    virtual const TDesC& GetState()= 0;
+    
+    /*
+     * Gets the reference to the City. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the City Name. 
+     */
+    virtual const TDesC& GetCity()= 0;
+    
+    /*
+     * Gets the reference to the District name. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the District Name. 
+     */
+    virtual const TDesC& GetDistrict()= 0;
+    
+    /*
+     * Gets the reference to the postal code. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the postal code. 
+     */
+    virtual  const TDesC& GetPincode()= 0;
+    
+    /*
+     * Gets the reference to the thoroughfare name. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the thoroughfare name. 
+     */
+    virtual const TDesC& GetThoroughfareName()= 0;
+    
+    /*
+     * Gets the reference to the thoroughfare number. Scope of this returned reference is limited to
+     * this perticular call. User has to store it for their further processing.
+     * 
+     *  @return reference to the String which holds the thoroughfare number. 
+     */
+    virtual const TDesC& GetThoroughfareNumber() = 0;
+         
 };
 
 
--- a/location_plat/location_data_harvester_api/location_data_harvester_api.pri	Mon May 03 12:27:22 2010 +0300
+++ b/location_plat/location_data_harvester_api/location_data_harvester_api.pri	Fri May 14 15:47:27 2010 +0300
@@ -11,8 +11,10 @@
 #
 # Contributors:
 #
-# Description: Location picker service api project file
+# Description: Location data harvester api project file
 #
 
 PLATFORM_HEADERS += location_data_harvester_api\inc\maptilegeocoderplugin.h \
-                    location_data_harvester_api\inc\maptilegeocoderplugin.inl 
\ No newline at end of file
+                    location_data_harvester_api\inc\maptilegeocoderplugin.inl \
+                    location_data_harvester_api\inc\locationdatalookupdb.h \
+                    location_data_harvester_api\inc\locationservicedefines.h
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/bwins/geocodeupdateu.def	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,5 @@
+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)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/bwins/locationdatalookupdbu.def	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +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 &)
+	?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> &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/eabi/geocodeupdateu.def	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN13GeocodeUpdate15createContactdbEv @ 1 NONAME
+	_ZN13GeocodeUpdate24updateGeocodeToContactDBEjidd @ 2 NONAME
+	_ZN13GeocodeUpdate25updateGeocodeToCalenderDBEmdd @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/eabi/locationdatalookupdbu.def	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,23 @@
+EXPORTS
+	_ZN20LocationDataLookupDb10getEntriesER5QListI11QLookupItemEj @ 1 NONAME
+	_ZN20LocationDataLookupDb11createEntryERK11QLookupItem @ 2 NONAME
+	_ZN20LocationDataLookupDb13findEntryByIdER11QLookupItem @ 3 NONAME
+	_ZN20LocationDataLookupDb15deleteEntryByIdERK11QLookupItem @ 4 NONAME
+	_ZN20LocationDataLookupDb15fillLookupEntryER9QSqlQueryR11QLookupItem @ 5 NONAME
+	_ZN20LocationDataLookupDb15updateEntryByIdERK11QLookupItem @ 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
+	_ZN20LocationDataLookupDbC1EP7QObject @ 15 NONAME
+	_ZN20LocationDataLookupDbC2EP7QObject @ 16 NONAME
+	_ZN20LocationDataLookupDbD0Ev @ 17 NONAME
+	_ZN20LocationDataLookupDbD1Ev @ 18 NONAME
+	_ZN20LocationDataLookupDbD2Ev @ 19 NONAME
+	_ZTI20LocationDataLookupDb @ 20 NONAME
+	_ZTV20LocationDataLookupDb @ 21 NONAME
+
--- a/locationdataharvester/geocodeupdate/bwins/geocodeupdate.def	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-EXPORTS
-	?UpDate@GeocodeUpdate@@SAXJJNN@Z @ 1 NONAME ; void GeocodeUpdate::UpDate(long, long, double, double)
-	?CreateContactdb@GeocodeUpdate@@SAXXZ @ 2 NONAME ; void GeocodeUpdate::CreateContactdb(void)
-
--- a/locationdataharvester/geocodeupdate/eabi/geocodeupdate.def	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-EXPORTS
-	_ZN13GeocodeUpdate15CreateContactdbEv @ 1 NONAME
-	_ZN13GeocodeUpdate6UpDateElldd @ 2 NONAME
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/geocodeupdate.pro	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,56 @@
+#
+# 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 = geocodeupdate   
+
+CONFIG += dll
+CONFIG += Qt
+
+DEPENDPATH += .
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+# Input
+HEADERS += ./inc/geocodeupdate.h \
+           ../mylocationlogger/inc \
+           ../inc   
+SOURCES +=./src/geocodeupdate.cpp 
+
+symbian: 
+{ 
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.CAPABILITY = All -Tcb
+    TARGET.UID3 = 0x2002C3A9
+    deploy.path = $$EPOCROOT
+    exportheaders.sources = $$PUBLIC_HEADERS
+    exportheaders.path = epoc32/include
+    DEPLOYMENT += exportheaders
+    
+    qtAddLibrary(QtContacts)
+	LIBS += -lcntmodel \
+	        -lagendainterface \
+		    -leuser  \
+		    -lestor \
+		    -lflogger
+   
+
+}  
+# End of file	--Don't remove this.
\ No newline at end of file
--- a/locationdataharvester/geocodeupdate/group/bld.inf	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +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: 
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-geocodeupdate.mmp
-
-
--- a/locationdataharvester/geocodeupdate/group/geocodeupdate.mmp	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +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: 
-*
-*/
-
-TARGET		  geocodeupdate.dll
-TARGETTYPE	  dll
-UID			  0x1000008d 0x2002C3A9
-SECUREID	  0x2002C3A9
-
-
-
-EPOCALLOWDLLDATA
-USERINCLUDE  ../inc 
-USERINCLUDE  ../../inc
-USERINCLUDE  ../../mylocationlogger/inc
-
-
-
-// Qt Macros
-MACRO		UNICODE
-MACRO		QT_KEYPAD_NAVIGATION
-MACRO		QT_SOFTKEYS_ENABLED
-MACRO		QT_USE_MATH_H_FLOATS
-MACRO		QT_NO_DEBUG
-MACRO		QT_GUI_LIB
-MACRO		QT_CORE_LIB
-
-SYSTEMINCLUDE		/epoc32/include/mw/QtCore
-SYSTEMINCLUDE		/epoc32/include/mw/QtNetwork
-SYSTEMINCLUDE		/epoc32/include/mw/QtGui
-SYSTEMINCLUDE		/epoc32/include/mw
-SYSTEMINCLUDE		/epoc32/include
-SYSTEMINCLUDE		/epoc32/include/stdapis
-SYSTEMINCLUDE		/epoc32/include/stdapis/sys
-SYSTEMINCLUDE		/epoc32/include/platform/mw
-SYSTEMINCLUDE		/epoc32/include/platform
-SYSTEMINCLUDE		/epoc32/include/app
-SYSTEMINCLUDE		/epoc32/include/platform/app
-SYSTEMINCLUDE		/epoc32/include/platform/loc
-SYSTEMINCLUDE		/epoc32/include/platform/mw/loc
-SYSTEMINCLUDE		/epoc32/include/platform/app/loc
-SYSTEMINCLUDE		/epoc32/include/platform/loc/sc
-SYSTEMINCLUDE		/epoc32/include/platform/mw/loc/sc
-SYSTEMINCLUDE		/epoc32/include/platform/app/loc/sc
-SYSTEMINCLUDE		/epoc32/include/stdapis/stlportv5
-
-SOURCEPATH	  ../src
-SOURCE geocodeupdate.cpp
-
-LIBRARY		QtContacts.lib
-LIBRARY		cntmodel.lib
-LIBRARY		euser.lib
-LIBRARY		efsrv.lib
-LIBRARY		edbms.lib
-LIBRARY		bafl.lib
-
-
-
-LIBRARY		QtCore.lib
-LIBRARY		libstdcppv5.lib
-LIBRARY		libc.lib
-LIBRARY		libm.lib
-LIBRARY		libdl.lib
-LIBRARY		cone.lib
-LIBRARY		eikcore.lib
-LIBRARY		mediaclientaudio.lib
-LIBRARY		eikcoctl.lib
-LIBRARY		eiksrv.lib
-LIBRARY		apparc.lib
-LIBRARY		avkon.lib
-LIBRARY		charconv.lib
-LIBRARY		ws32.lib
-LIBRARY		hal.lib
-LIBRARY		gdi.lib
-LIBRARY		apgrfx.lib
-LIBRARY		flogger.lib
-
-nostrictdef
-
-CAPABILITY		All -Tcb 
-
-OPTION CW -wchar_t on
-OPTION ARMCC --visibility_inlines_hidden
-
-VERSION 10.0
-
-PAGED
-
-OPTION_REPLACE ARMCC --export_all_vtbl //-D__QT_NOEFFECTMACRO_DONOTUSE
-
-#if defined(ARMCC) && !defined(ARMCC_2_2) && !defined(ARMCC_3_1)
-OPTION ARMCC --import_all_vtbl
-#endif
-
-STDCPP
-
-DEFFILE geocodeupdate.def
-
--- a/locationdataharvester/geocodeupdate/inc/geocodeupdate.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/geocodeupdate/inc/geocodeupdate.h	Fri May 14 15:47:27 2010 +0300
@@ -19,33 +19,41 @@
 #define __GEOCODEUPDATE_H__
 
 #include <e32def.h> 
+#include <QtCore/qglobal.h>
 
 // CLASS DECLARATION
 
 /**
- * CntGeocodeUpdate, a class to update latitude and longtude into contact database
- * for a perticular contact.
+ * GeocodeUpdate, a class to update latitude and longtude into contact and calender database
  */
 class GeocodeUpdate 
 {
 public:    
     /**
-     * Request to create contactmanager ,
-     * contactmanager will create contact db.    
+     Create contact database   
      */
-    IMPORT_C static void CreateContactdb();
+    IMPORT_C static void createContactdb();
     
     /**
-     * Request to update latitude and longitude.    *
-     * @param aCntId contact unique id
-     * @param aLatitude Latitude to be saved
-     * @param aLongitude longitude to be saved
-     * @return Status code (0 is failure,1 success)
+     * Request to update latitude and longitude into contact db. 
+     * @param contactId contact unique id.
+     * @param addressType contact address type.
+     * @param latitude Latitude to be updated.
+     * @param longitude longitude to be updated.
      */
 
-    IMPORT_C static void UpDate(const TInt32 aCntId,
-            const TInt32 aCntAddressType, const TReal aLatitude,
-            const TReal aLongitude);
+    IMPORT_C static void 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.
+     */
+
+    IMPORT_C static void updateGeocodeToCalenderDB(const ulong calEntryId,
+            const double latitude, const double longitude);
 };
 
 #endif // __GEOCODEUPDATE_H__ 
--- a/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp	Fri May 14 15:47:27 2010 +0300
@@ -19,7 +19,10 @@
 #include <qcontactmanager.h>
 #include <qtcontacts.h>
 #include <cntdef.h>
-#include <qstring>
+#include <agendautil.h>
+#include <agendaentry.h>
+#include <QString>
+#include <locationservicedefines.h>
 
 #include "geocodeupdate.h"
 #include "mylocationsdefines.h"
@@ -27,9 +30,9 @@
 
 using namespace QTM_NAMESPACE;
 // ----------------------------------------------------------------------------
-// CGeocodeUpdate::CreateContactdb()
+// GeocodeUpdate::createContactdb()
 // ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::CreateContactdb()
+EXPORT_C void GeocodeUpdate::createContactdb()
 {
     QContactManager* contactManger = NULL;
     MYLOCLOGSTRING("call to create contactManger object and contactdb as well.");
@@ -38,12 +41,12 @@
 }
 
 // ----------------------------------------------------------------------------
-// CGeocodeUpdate::UpDateL()
-// To update contact db with this latitude and longitude value 
+// CGeocodeUpdate::updateGeocodeToContactDB()
+// Geo-cordinate updation to contact db  
 // ----------------------------------------------------------------------------
-EXPORT_C void GeocodeUpdate::UpDate(const TInt32 aCntId,
-        const TInt32 aCntAddressType, const TReal aLatitude,
-        const TReal aLongitude)
+EXPORT_C void GeocodeUpdate::updateGeocodeToContactDB(const quint32 contactId,
+        const int addressType, const double latitude,
+        const double longitude)
 
 {
     __TRACE_CALLSTACK;
@@ -54,10 +57,10 @@
 
     MYLOCLOGSTRING("contactManger object is not null .");
     QStringList definitionRestrictions;
-    QContact contact = contactManger->contact(aCntId ,definitionRestrictions);
+    QContact contact = contactManger->contact(contactId ,definitionRestrictions);
     QContactGeoLocation location;
 
-    switch (aCntAddressType)
+    switch (addressType)
     {
     case ESourceContactsPref:
     {
@@ -78,12 +81,30 @@
         break;
     }
     }
-    location.setLongitude(aLongitude);
-    location.setLatitude(aLatitude);
+    location.setLongitude(longitude);
+    location.setLatitude(latitude);
     contact.saveDetail(&location);
     contactManger->saveContact(&contact);
     delete contactManger;
 
 }
 
+// ----------------------------------------------------------------------------
+// CGeocodeUpdate::updateGeocodeToCalenderDB()
+// Geo-cordinate updation to contact db  
+// ----------------------------------------------------------------------------
+EXPORT_C void 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);
+}
 //end of line
--- a/locationdataharvester/inc/mylocationsdefines.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/inc/mylocationsdefines.h	Fri May 14 15:47:27 2010 +0300
@@ -40,33 +40,12 @@
     TFileName iFilePath;
 };
 
-/** Defines uid source type
- */
-enum TUidSourceType
-{
-    /** Uid Source type calendar */
-    ESourceCalendar=0,
-    /** Uid Source type landmarks */
-    ESourceLandmarks,
-    /** Uid Source type maps history */
-    ESourceMapsHistory,
-    /** Uid Source type contacts default/prefered address */
-    ESourceContactsPref,
-    /** 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 */
-    ESourceLandmarksUserCat,
-    /** Uid Source type landmarks 'contacts' category */
-    ESourceLandmarksContactsCat,
-    /** Uid Source type landmarks 'calendar' category */
-    ESourceLandmarksCalendarCat,
-    /** Uid Source type maps history' category */
-    ESourceLandmarksHistoryCat
-};
+
+// contacts category in landmarks db
+_LIT( KContactsCategory, "Contacts" );
+
+// calendar category in landmarks db
+_LIT( KCalendarCategory, "Calendar" );
 
 // lookup database folder path
 _LIT( KLookupDbPath, "c:\\mylocations\\" );
@@ -119,6 +98,8 @@
 // source type column number
 const TInt KColumnFilePath = 3;
 
+const TInt KBufSize=256;
+
 #endif  // __MYLOCATIONSDEFINES_H__
 // End of file
 
--- a/locationdataharvester/locationdataharvester.pro	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/locationdataharvester.pro	Fri May 14 15:47:27 2010 +0300
@@ -20,13 +20,9 @@
 
 
 TEMPLATE = subdirs
-SUBDIRS = maptileservice
+SUBDIRS = locationdatalookupdb maptileservice geocodeupdate mylocationsengine
 
-# Build.inf rules
-BLD_INF_RULES.prj_exports += "./mylocationsengine/loc/mylocations.loc   APP_LAYER_LOC_EXPORT_PATH(mylocations.loc)" 
 
-BLD_INF_RULES.prj_mmpfiles = "./geocodeupdate/group/geocodeupdate.mmp" \
-                             "./mylocationsengine/group/mylocationsengine.mmp"
 # Exports
 deploy.path = /
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.cpp	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,485 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Location data lookup db implementation
+*
+*/
+
+// INCLUDE FILES
+#include "locationdatalookupdb.h"
+#include <QSqlDatabase>
+#include <QSqlError>
+#include <QSqlQuery>
+#include <QSqlRecord>
+#include <QVariant>
+#include<locationservicedefines.h>
+
+// database name
+const QString KLocationDataLookupDbName = "c:\\locationdatalookupdb.db"; 
+
+// ================= MEMBER FUNCTIONS =======================
+//
+// ---------------------------------------------------------
+// LocationDataLookupDb::LocationDataLookupDb()
+// Constructor
+// ---------------------------------------------------------
+//
+LocationDataLookupDb::LocationDataLookupDb( QObject *parent) : QObject(parent)
+{
+    mDb = new QSqlDatabase();
+    *mDb = QSqlDatabase::addDatabase( "QSQLITE" );
+    mDb->setDatabaseName( KLocationDataLookupDbName );
+    if (!mDb->open())
+    {
+        delete mDb;
+        mDb = NULL;
+        return;
+    }
+
+    // create lookup table if doesnot exist
+    QSqlQuery query(*mDb);
+    query.exec("create table if not exists lplookup (id INTEGER PRIMARY KEY AUTOINCREMENT,"
+                                             "duplicate int,"
+                                             "sourceid int,"
+                                             "sourcetype int,"
+                                             "destid int,"
+                                             "name varchar(255),"
+                                             "street varchar(255),"
+                                             "postal varchar(50),"
+                                             "city varchar(50),"
+                                             "state varchar(50),"
+                                             "country varchar(50),"
+                                             "latitude double,"
+                                             "longitude double,"
+                                             "icontype int,"
+                                             "iconpath varchar(255),"
+                                             "maptile varchar(255))");
+
+    mDb->close();
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::~LocationDataLookupDb()
+// destructor
+// ---------------------------------------------------------
+LocationDataLookupDb::~LocationDataLookupDb()
+{
+    if( mDb )
+        delete mDb;
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::open()
+// ---------------------------------------------------------
+bool LocationDataLookupDb::open()
+{
+    return mDb->open();
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::close()
+// ---------------------------------------------------------
+void LocationDataLookupDb::close()
+{
+    if( mDb )
+        mDb->close();
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::createEntry()
+// ---------------------------------------------------------
+void LocationDataLookupDb::createEntry( const QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare("INSERT INTO lplookup ("
+                              "id, "
+                              "duplicate, "
+                              "sourceid, "
+                              "sourcetype, "
+                              "destid, "
+                              "name, "
+                              "street, "
+                              "postal, "
+                              "city, "
+                              "state, "
+                              "country, "
+                              "latitude, "
+                              "longitude, "
+                              "icontype, "
+                              "iconpath, "
+                              "maptile) "
+                      "VALUES ("
+                              "NULL, "
+                              ":duplicate, "
+                              ":sourceid, "
+                              ":sourcetype, "
+                              ":destid, "
+                              ":name, "
+                              ":street, "
+                              ":postal, "
+                              ":city, "
+                              ":state, "
+                              ":country, "
+                              ":latitude, "
+                              ":longitude, "
+                              ":icontype, "
+                              ":iconpath, "
+                              ":maptile)" );
+        query.bindValue(":duplicate", aLookupItem.mIsDuplicate);
+        query.bindValue(":sourceid", aLookupItem.mSourceUid);
+        query.bindValue(":sourcetype", aLookupItem.mSourceType);
+        query.bindValue(":destid", aLookupItem.mDestId);
+        query.bindValue(":name", aLookupItem.mName);
+        query.bindValue(":street", aLookupItem.mStreet);
+        query.bindValue(":postal", aLookupItem.mPostalCode);
+        query.bindValue(":city", aLookupItem.mCity);
+        query.bindValue(":state", aLookupItem.mState);
+        query.bindValue(":country", aLookupItem.mCountry);
+        query.bindValue(":latitude", aLookupItem.mLatitude);
+        query.bindValue(":longitude", aLookupItem.mLongitude);
+        query.bindValue(":icontype", aLookupItem.mIconType);
+        query.bindValue(":iconpath", aLookupItem.mIconPath);
+        query.bindValue(":maptile", aLookupItem.mMapTilePath);
+        query.exec();
+    }
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::updateEntryBySourceIdAndType()
+// ---------------------------------------------------------
+void LocationDataLookupDb::updateEntryBySourceIdAndType( const QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare("UPDATE lplookup SET "
+                        "id = ?, "
+                        "duplicate = ?, "
+                        "sourceid = ?, "
+                        "sourcetype = ?, "
+                        "destid = ?, "
+                        "name = ?, "
+                        "street = ?, "
+                        "postal = ?, "
+                        "city = ?, "
+                        "state = ?, "
+                        "country = ?, "
+                        "latitude = ?, "
+                        "longitude = ?, "
+                        "icontype = ?, "
+                        "iconpath = ?, "
+                        "maptile = ? "
+                      "WHERE sourceid = ? AND sourcetype = ?");
+    
+        query.addBindValue( aLookupItem.mId );
+        query.addBindValue( aLookupItem.mIsDuplicate );
+        query.addBindValue( aLookupItem.mSourceUid );
+        query.addBindValue( aLookupItem.mSourceType );
+        query.addBindValue( aLookupItem.mDestId );
+        query.addBindValue( aLookupItem.mName );
+        query.addBindValue( aLookupItem.mStreet );
+        query.addBindValue( aLookupItem.mPostalCode );
+        query.addBindValue( aLookupItem.mCity );
+        query.addBindValue( aLookupItem.mState );
+        query.addBindValue( aLookupItem.mCountry );
+        query.addBindValue( aLookupItem.mLatitude );
+        query.addBindValue( aLookupItem.mLongitude );
+        query.addBindValue( aLookupItem.mIconType );
+        query.addBindValue( aLookupItem.mIconPath );
+        query.addBindValue( aLookupItem.mMapTilePath );
+    
+        query.addBindValue( aLookupItem.mSourceUid );
+        query.addBindValue( aLookupItem.mSourceType );
+    
+        query.exec();
+    }
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::updateMaptileBySourceIdAndType()
+// ---------------------------------------------------------
+void LocationDataLookupDb::updateMaptileBySourceIdAndType( quint32 aSourceId, 
+        quint32 aSourceType, QString aImagePath )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare("UPDATE lplookup SET "
+                        "maptile = ? "
+                      "WHERE sourceid = ? AND sourcetype = ?");
+    
+        query.addBindValue( aImagePath );
+        query.addBindValue( aSourceId );
+        query.addBindValue( aSourceType );
+    
+        query.exec();
+    }
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::updateEntryById()
+// ---------------------------------------------------------
+void LocationDataLookupDb::updateEntryById( const QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare("UPDATE lplookup SET "
+                        "id = ?, "
+                        "duplicate = ?, "
+                        "sourceid = ?, "
+                        "sourcetype = ?, "
+                        "destid = ?, "
+                        "name = ?, "
+                        "street = ?, "
+                        "postal = ?, "
+                        "city = ?, "
+                        "state = ?, "
+                        "country = ?, "
+                        "latitude = ?, "
+                        "longitude = ?, "
+                        "icontype = ?, "
+                        "iconpath = ?, "
+                        "maptile = ? "
+                      "WHERE id = ?");
+    
+        query.addBindValue( aLookupItem.mId );
+        query.addBindValue( aLookupItem.mIsDuplicate );
+        query.addBindValue( aLookupItem.mSourceUid );
+        query.addBindValue( aLookupItem.mSourceType );
+        query.addBindValue( aLookupItem.mDestId );
+        query.addBindValue( aLookupItem.mName );
+        query.addBindValue( aLookupItem.mStreet );
+        query.addBindValue( aLookupItem.mPostalCode );
+        query.addBindValue( aLookupItem.mCity );
+        query.addBindValue( aLookupItem.mState );
+        query.addBindValue( aLookupItem.mCountry );
+        query.addBindValue( aLookupItem.mLatitude );
+        query.addBindValue( aLookupItem.mLongitude );
+        query.addBindValue( aLookupItem.mIconType );
+        query.addBindValue( aLookupItem.mIconPath );
+        query.addBindValue( aLookupItem.mMapTilePath );
+    
+        query.addBindValue( aLookupItem.mId );
+    
+        query.exec();
+    }
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::deleteEntryBySourceIdAndType()
+// ---------------------------------------------------------
+void LocationDataLookupDb::deleteEntryBySourceIdAndType( const QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare( "DELETE FROM lplookup "
+                       "WHERE sourceid = ? AND sourcetype = ?" );
+    
+        query.addBindValue( aLookupItem.mSourceUid );
+        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();
+    }
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::findEntryBySourceIdAndType()
+// ---------------------------------------------------------
+bool LocationDataLookupDb::findEntryBySourceIdAndType( QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare( "SELECT * FROM lplookup "    
+                    "WHERE sourceid = ? AND sourcetype = ?" );
+        query.addBindValue( aLookupItem.mSourceUid );
+        query.addBindValue( aLookupItem.mSourceType );
+    
+        query.exec();
+        
+        if( !query.first() )
+        {
+            return false;
+        }
+    
+        fillLookupEntry( query, aLookupItem );
+        return true;
+    }
+    return false;
+}
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::findEntryById()
+// ---------------------------------------------------------
+bool LocationDataLookupDb::findEntryById( QLookupItem& aLookupItem )
+{
+    if( mDb )
+    {
+        QSqlQuery query(*mDb);
+        query.prepare( "SELECT * FROM lplookup "    
+                    "WHERE id = ?" );
+        query.addBindValue( aLookupItem.mId );
+    
+        query.exec();
+        
+        if( !query.first() )
+        {
+            return false;
+        }
+    
+        fillLookupEntry( query, aLookupItem );    
+        return true;
+    }
+    
+    return false;
+}
+
+
+// ---------------------------------------------------------
+// LocationDataLookupDb::findEntriesByLandmarkId()
+// ---------------------------------------------------------
+void LocationDataLookupDb::findEntriesByLandmarkId( const quint32 aLandmarkId, 
+        QList<QLookupItem>& aLookupItemArray )
+{
+    if( mDb )
+    {
+
+        QSqlQuery query(*mDb);
+        query.prepare( "SELECT * FROM lplookup "    
+                       "WHERE destid = ?" );
+    
+        query.addBindValue( aLandmarkId );
+        query.exec();
+        
+        while( query.next() )
+        {    
+            QLookupItem lookupItem;
+            fillLookupEntry( query, lookupItem );        
+            aLookupItemArray.append( lookupItem );
+        } 
+    }   
+}
+
+// ---------------------------------------------------------
+// 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 )
+    {
+        QSqlQuery query(*mDb);
+        if( aCollectionId == ESourceLandmarksContactsCat )
+        {
+            query.prepare( "SELECT * FROM lplookup " 
+                    "WHERE sourcetype = ? OR sourcetype = ? OR sourcetype = ?" );
+            query.addBindValue( ESourceContactsPref );
+            query.addBindValue( ESourceContactsWork );
+            query.addBindValue( ESourceContactsHome );
+            query.exec();
+        }
+        else if( aCollectionId == ESourceLandmarksCalendarCat )
+        {
+            query.prepare( "SELECT * FROM lplookup " 
+                    "WHERE sourcetype = ?" );
+            query.addBindValue( ESourceCalendar );
+            query.exec();
+           
+        }
+        else if(  aCollectionId == ESourceLandmarks )
+        {
+            query.prepare( "SELECT * FROM lplookup " 
+                    "WHERE sourcetype = ?" );
+            query.addBindValue( ESourceLandmarks );
+            query.exec();
+           
+        }
+        else // all contents
+        {
+            query.prepare( "SELECT * FROM lplookup" );
+            query.exec();
+        }
+        while( query.next() )
+        {    
+            QLookupItem lookupItem;            
+            fillLookupEntry( query, lookupItem );
+            aLookupItemArray.append( lookupItem );
+        }    
+    }
+}
+
+void LocationDataLookupDb::fillLookupEntry( QSqlQuery &aQuery, QLookupItem &aLookupItem )
+{
+    QSqlRecord rec = aQuery.record();
+    aLookupItem.mId = aQuery.value( rec.indexOf("id") ).toUInt();
+    aLookupItem.mIsDuplicate = aQuery.value( rec.indexOf("duplicate") ).toUInt();
+    aLookupItem.mSourceUid = aQuery.value( rec.indexOf("sourceid") ).toUInt();
+    aLookupItem.mSourceType = aQuery.value( rec.indexOf("sourcetype") ).toUInt();
+    aLookupItem.mDestId = aQuery.value( rec.indexOf("destid") ).toUInt();
+    aLookupItem.mName = aQuery.value( rec.indexOf("name") ).toString();
+    aLookupItem.mStreet = aQuery.value( rec.indexOf("street") ).toString();
+    aLookupItem.mPostalCode = aQuery.value( rec.indexOf("postal") ).toString();
+    aLookupItem.mCity = aQuery.value( rec.indexOf("city") ).toString();
+    aLookupItem.mState = aQuery.value( rec.indexOf("state") ).toString();
+    aLookupItem.mCountry = aQuery.value( rec.indexOf("country") ).toString();
+    aLookupItem.mLatitude = aQuery.value( rec.indexOf("latitude") ).toDouble();
+    aLookupItem.mLongitude = aQuery.value( rec.indexOf("longitude") ).toDouble();
+    aLookupItem.mIconType = aQuery.value( rec.indexOf("icontype") ).toUInt();
+    aLookupItem.mIconPath = aQuery.value( rec.indexOf("iconpath") ).toString();
+    aLookupItem.mMapTilePath = aQuery.value( rec.indexOf("maptile") ).toString();
+
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/locationdatalookupdb/locationdatalookupdb.pro	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Location data lookup db project file
+
+TEMPLATE = lib
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# By default Qt adds dependencies to QtCore and QtGui, 
+# QtCore is enough for this example 
+#QT = core
+QT           += sql
+
+#BUILD_DLL macro is used to define export macro
+DEFINES += BUILD_DLL           
+
+           
+SOURCES += locationdatalookupdb.cpp
+
+symbian: {
+    TARGET.UID3 = 0x2002E714
+    TARGET.EPOCALLOWDLLDATA = 1
+TARGET.CAPABILITY = ALL \
+        -TCB
+}    
+
--- a/locationdataharvester/maptileservice/src/maptileservice.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/maptileservice/src/maptileservice.cpp	Fri May 14 15:47:27 2010 +0300
@@ -27,9 +27,6 @@
 const TUid KUidMapTileInterface = { 0x2002E6E8 };
 // Central Repository Key IDs
 const TInt KEnableLocationFeature  = 0x1;
-const TInt KLocationFeatureAppContacts      = 0x1;
-const TInt KLocationFeatureAppCalendar      = 0x2;
-
 
 // -----------------------------------------------------------------------------
 // MapTileService::isLocationFeatureEnabled()
--- a/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp	Fri May 14 15:47:27 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -11,9 +11,10 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: maptile service unit test cases
 *
 */
+
 #include <QtTest/QtTest>
 #include <QtGui>
 #include <QString>
--- a/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro	Fri May 14 15:47:27 2010 +0300
@@ -1,18 +1,19 @@
-#
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
-# which accompanies this distribution, and is available
-# at the URL "http://www.eclipse.org/legal/epl-v10.html".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description: 
-#
+/*
+* 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
--- a/locationdataharvester/mylocationsengine/data/mylocations.rss	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +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 engine registeration file.
-*
-*/
-
-//  INCLUDES
-#include <uikon.rh>
-#include <mylocations.loc>
-
-//  RESOURCE SIGNATURE
-RESOURCE RSS_SIGNATURE { }
-
-//  RESOURCE DEFINITIONS
-RESOURCE LBUF r_locint_list_title_myloc
-    {
-    txt=qtn_locint_list_title_myloc;
-    }
-RESOURCE LBUF r_locint_list_category_history
-    {
-    txt=qtn_locint_list_category_history;
-    }
-RESOURCE LBUF r_locint_list_category_contacts
-    {
-    txt=qtn_locint_list_category_others;
-    }
-RESOURCE LBUF r_locint_list_category_calendar
-    {
-    txt=qtn_locint_list_category_others;
-    }
-    
-//end of file
\ No newline at end of file
--- a/locationdataharvester/mylocationsengine/group/bld.inf	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +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: bld.inf for mylocationengine
-*
-*/
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-../loc/mylocations.loc       APP_LAYER_LOC_EXPORT_PATH(mylocations.loc)
-
-PRJ_MMPFILES
-mylocationsengine.mmp
--- a/locationdataharvester/mylocationsengine/group/mylocationsengine.mmp	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +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 engine mmp file
-*
-*/
-
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-TARGET		  mylocationsengine.exe
-TARGETTYPE	  exe
-UID			  0x2002680A
-CAPABILITY 	  ALL -TCB 
-
-USERINCLUDE	 ../inc
-USERINCLUDE	 ../../inc
-USERINCLUDE  ../../geocodeupdate/inc
-USERINCLUDE  ../../mylocationlogger/inc
-
-SYSTEMINCLUDE	 /epoc32/include 
-APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE	 /epoc32/include/platform/mw
-SYSTEMINCLUDE	 /epoc32/include/platform/app
-SYSTEMINCLUDE	 /epoc32/include/mw
-SYSTEMINCLUDE    /epoc32/include/app
-
-START RESOURCE  ../data/mylocations.rss
-TARGETPATH      APP_RESOURCE_DIR
-HEADER
-LANGUAGE_IDS
-end
-
-SOURCEPATH	  ../src
-SOURCE		  appmain.cpp
-SOURCE		  mylocationsengine.cpp
-SOURCE 		  mylocationslookupdb.cpp 
-SOURCE		  mylocationsdatabasemanager.cpp
-SOURCE            maptileinterface.cpp 
-SOURCE		  lookupmaptiledb.cpp 
-SOURCE        addresscomparision.cpp
-SOURCE        calendernotification.cpp
-
-LIBRARY		  euser.lib
-
- // Dependencies to S60 components
-LIBRARY lbs.lib
-LIBRARY eposlandmarks.lib
-LIBRARY eposlmsearchlib.lib
-LIBRARY eposlmdbmanlib.lib
- 
-//calender DB dependencies
-LIBRARY 	calinterimapi.lib
-
-//contacts DB dependencies
-LIBRARY		cntmodel.lib 
-
-
-//Contact db update with lat and lon field
-LIBRARY geocodeupdate.lib
- 
-
-//RFs
-LIBRARY   efsrv.lib 
-
-//RDbNamedDatabase,RDbView
-LIBRARY   edbms.lib 
-
-// bafl utilities
-LIBRARY   bafl.lib 
-
-// RFileLogger utilities
-LIBRARY flogger.lib
-
-//Ecom library
-LIBRARY ecom.lib
-
-
-#ifdef ENABLE_ABIV2_MODE
-DEBUGGABLE_UDEBONLY
-#endif
-
-EPOCSTACKSIZE 0x6000
--- a/locationdataharvester/mylocationsengine/inc/addresscomparision.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/addresscomparision.h	Fri May 14 15:47:27 2010 +0300
@@ -17,7 +17,7 @@
 
 #ifndef ADDRESSCOMPARISION_H_
 #define ADDRESSCOMPARISION_H_
-#include <epos_cposlandmarkdatabase.h>
+#include <EPos_CPosLandmarkDatabase.h>
 #include "mylocationslookupdb.h"
 class CAddressComparision : public CBase
     {
--- a/locationdataharvester/mylocationsengine/inc/calendernotification.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/calendernotification.h	Fri May 14 15:47:27 2010 +0300
@@ -56,7 +56,7 @@
      * ConstructL.
      * 2nd phase constructor.
      */
-    void ConstructL(MNotifyChange* aNotifyChange);
+    void ConstructL();
     /**
      * CMyLocationsEngine.
      * C++ default constructor. 
@@ -87,3 +87,4 @@
     MNotifyChange& iNotifyChange;
 };
 #endif /* CALENDERNOTIFICATION_H_ */
+//End of file
--- a/locationdataharvester/mylocationsengine/inc/maptileinterface.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/maptileinterface.h	Fri May 14 15:47:27 2010 +0300
@@ -20,7 +20,8 @@
 
 #include <e32std.h> 
 #include <e32base.h>
-
+// Header for landmarks db
+#include<EPos_CPosLandmarkDatabase.h>
 #include <maptilegeocoderplugin.h>
 
 
@@ -89,6 +90,13 @@
             const TDesC& aFilePath, MMapTileObserver* aObserver);
     
     /**
+     * Interface for requesting  for a landmark object.
+     * @return CPosLandmark object.
+     */
+    CPosLandmark* GetLandMarkDetails();
+        
+    
+    /**
      * Constructor
      */
     CMapTileInterface();
@@ -107,6 +115,12 @@
      * @param[in] aLongitude Longitude value
      */
 	void GetMapTileL( TReal aLatitude, TReal aLongitude	);
+	
+    /**
+     * Interface for requesting  for a landmark object.
+     * @param[in] aAddressInfo , geo-code address details
+     */
+    void SetLandMarkDetailsL(MAddressInfo& aAddressInfo);
     
 protected: 
 	
@@ -137,6 +151,8 @@
 	HBufC* iFilePath;
 	//Maptile observer
 	MMapTileObserver* iObserver ;
+	//pointer to landmark  from address information.
+	CPosLandmark  *iLandmark;
 
     };
 #endif // MAPTILEINTERFACE_H
--- a/locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h	Fri May 14 15:47:27 2010 +0300
@@ -20,10 +20,15 @@
 #define __MYLOCATIONSDATABASEMANAGER_H__
 
 // Landmarks
-#include<epos_cposlandmarkdatabase.h>
+#include<EPos_CPosLandmarkDatabase.h>
 #include <EPos_CPosLmCategoryManager.h>
 
-// Lookup database
+#include <locationservicedefines.h>
+
+// lookup database
+#include <locationdatalookupdb.h>
+
+// mylocations lookup db
 #include "mylocationslookupdb.h"
 
 // Maximum string length of landmark address.
@@ -94,17 +99,25 @@
          */      
         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 mylocations and landmarks database. 
-         * Used to add history and others categories.
-         * @param[in] aCategoryType defines the category type to be added.
+         * 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. 
          */
-        void AddMylocationsCategoryL( const TUint32 aCategoryType );
+        TUint32 AddMylocationsCategoryL(  const TDesC&  aCategoryName  );
 
         /**
          * CheckIfDuplicateExistsL.
@@ -156,50 +169,12 @@
        void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
 
        /**
-         * AddToMylocationsDbL.
-         * Adds entry into mylocations db and also updates the lookup table
-         * @param[in] aLandmark Landmark object to be added.
-         * @param[in] aUid Uid of the source entry corresponding to aLandmark..
-         * @param[in] aSourceType source type of the aUid passed.
-        */
-       void AddToMylocationsDbL( CPosLandmark*  aLandmark, const TUint32 aUid, 
-                                 const TUint32 aSourceType );
-
-       /**
-         * ModifyMylocationsDbL.
-         * Updates the entry into mylocations db and also updates the lookup table
+         * HandleLandmarkModificationL.
+         * Handles a landmark modification
          * @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 ModifyMylocationsDbL( CPosLandmark*  aLandmark, const TUint32 aUid, 
-                                  const TUint32 aSourceType );
-
-       /**
-         * DeleteFromMylocationsDbL.
-         * Deletes the entry from mylocations db and also updates the lookup table
-         * @param[in] aUid Uid of the source entry corresponding to aLandmark..
-         * @param[in] aSourceType source type of the aUid passed.
-        */
-       void DeleteFromMylocationsDbL( const TUint32 aUid, const TUint32 aSourceType );
-
-       /**
-         * CreateCategoryL.
-         * Creates a new category in Mylocations Db and adds a corresponding entry in 
-         * mylocations lookup table.
-         * @param[in] aUid Uid of the source category.
-        */
-       void CreateCategoryL( const TUint32 aUid );
-
-       /**
-          * CheckCategoryAvailabilityL.
-          * Checks whether a category is available in database pointed by category manager.
-          * @param[in] aCategoryManager handle to the category manager
-          * @param[in] aCategoryId Id of the category
-         */
-       void CheckCategoryAvailabilityL( CPosLmCategoryManager* aCategoryManager, 
-                                        const TUint32 aCategoryId );
-
+       void HandleLandmarkModificationL( CPosLandmark* aLandmark, const TUint32 aUid );
        /**
           * CheckAndReadLandmarkL.
           * Checks whether a category is available in database pointed by category manager.
@@ -207,36 +182,58 @@
           * @param[in] aLmId Id of the landmark
           * @returns landmark object if found else NULL
          */
-       CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL( 
+       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;
-        
-        // Handle to the mylocations landmark database
-        CPosLandmarkDatabase* iMyLocationsLandmarksDb;
 
-        // Contacts category to be created for contacts and calendar 
-        // related location entries in landmark database
+        // 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 mylocations lookup database.
-        CLookupDatabase*  iMylocationsLookupDb;
-
-        // handle to mylocations category manager
-        CPosLmCategoryManager* iMyLocationsCatManager;
+        // 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	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h	Fri May 14 15:47:27 2010 +0300
@@ -26,10 +26,10 @@
 #include <calentryview.h>
 
 // Header for contact DB
-#include <CNTDB.H>
+#include <cntdb.h>
 
 // Header for landmarks db
-#include<epos_cposlandmarkdatabase.h>
+#include<EPos_CPosLandmarkDatabase.h>
 
 // mylocations database manager
 #include "maptileinterface.h"
@@ -120,6 +120,8 @@
      *
      */      
     void StartLandmarksChangeNotifier();
+
+
     
     /** Maps the source type change type to Mylocations entry change type
     * @param[in] aSrcType Source type of the change
@@ -128,10 +130,6 @@
      */      
     TEntryChangeType MapChangeType( TUidSourceType aSrcType, TUint32 aChangeType );    
  
-    /** Gets the handle to mylocations database manager
-     *
-     */      
-    CMyLocationsDatabaseManager& MyLocationsDbManager();
 
 private:
     
@@ -202,6 +200,7 @@
     */  
 	void HandleMaptileDatabaseL(TInt aEventType ,
 	                             TLookupItem& aLookupItem );
+
     /**
      *  Handles active object's request completion event. 
      */
@@ -213,11 +212,6 @@
     void DoCancel();
  
     /** 
-     * Implements RunError of active object. 
-     */
-    TInt RunError( TInt aError );
-    
-    /** 
      * Requests for map tile image , structure serch.
      * @param aLandmark  Provides information about the address.
      * @param aAddressType Provides information about address type .  
@@ -249,7 +243,14 @@
     /**
     * Calender entry added.
     */
-    void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);
+    void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);    
+
+    /**
+    * Update the mylocations database.
+    */
+    void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid, 
+            const TUint32 aSourceType, const TEntryChangeType aChangeType );
+
 
 public:  //From MMapTileObserver
     
--- a/locationdataharvester/mylocationsengine/inc/mylocationslookupdb.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/inc/mylocationslookupdb.h	Fri May 14 15:47:27 2010 +0300
@@ -23,6 +23,7 @@
 #include <d32dbms.h>  //RDbNamedDatabase,RDbView 
 
 #include "mylocationsdefines.h"
+#include "locationservicedefines.h"
  
 /**
  * CLookupDatabase class.
--- a/locationdataharvester/mylocationsengine/loc/mylocations.loc	Mon May 03 12:27:22 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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 engine loc file
-*
-*/
-
-
-//r:
-//v:
-//i:LOCALISATION_TARGET = s60,s90
-//i:Default mylocation category names, selector dialog title that can be displayed on UI.
-
-// LOCALISATION STRINGS
-
-
-// d:Title of My locations
-// l:title_pane_t2/opt9
-// r:9.2?
-//
-#define qtn_locint_list_title_myloc "My locations"	
-
-//b:-1
-//e:-1
-//f:EDialogLabelFont
-//s:
-//w:
-//d:History category created from My location.
-//l:list_single_graphic_pane_t1
-//
-#define qtn_locint_list_category_history "History"
-
-
-//b:-1
-//e:-1
-//f:EDialogLabelFont
-//s:
-//w:
-//d: Others category created from My location
-//l:list_single_graphic_pane_t1
-//
-#define qtn_locint_list_category_others "Others"
-
-// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/mylocationsengine.pro	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,73 @@
+#
+# 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
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../inc
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../geocodeupdate/inc
+INCLUDEPATH += ../mylocationlogger/inc
+
+symbian: { 
+
+    TARGET.UID3 = 0x2002680A 
+    isEmpty(TARGET.EPOCSTACKSIZE):TARGET.EPOCSTACKSIZE = 0x6000
+    isEmpty(TARGET.EPOCHEAPSIZE):TARGET.EPOCHEAPSIZE = 20480 \
+        16943040
+    TARGET.CAPABILITY = ALL -TCB
+    
+    LIBS += -llbs \
+        -leposlandmarks \
+        -leposlmsearchlib \
+        -leuser \
+        -leposlmdbmanlib \
+        -lcntmodel \
+        -lefsrv \
+        -ledbms \
+        -lbafl \
+        -lflogger \
+        -lQtContacts \
+        -lgeocodeupdate \
+        -lecom \
+	-lcalinterimapi \
+	-llocationdatalookupdb
+
+}
+
+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 
+
+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
+
+
+
+
--- a/locationdataharvester/mylocationsengine/src/appmain.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/appmain.cpp	Fri May 14 15:47:27 2010 +0300
@@ -40,14 +40,8 @@
     // create Mylocations engine object
     CMyLocationsEngine *myLocationsEngine = CMyLocationsEngine::NewL();
     CleanupStack::PushL( myLocationsEngine );
-    // Start listening to calendar db changes
-    //myLocationsEngine->StartCalenderChangeNotifierL();
 
-   
-    // Start listening to landmarks db changes
-    //myLocationsEngine->StartLandmarksChangeNotifier();
-
-    //MYLOCLOGSTRING("Start listening to landmarks db changes.");
+    MYLOCLOGSTRING("myLocationsEngine created.");
     
     RProcess::Rendezvous(KErrNone);
     // Start handling requests
@@ -65,8 +59,7 @@
 // -----------------------------------------------------------------------------
 //
 static TInt Execute()
-{
-   // __UHEAP_MARK;
+{  
     TInt error = KErrNoMemory;
     // Create the cleanup stack
     CTrapCleanup* cleanup = CTrapCleanup::New();
@@ -76,7 +69,6 @@
         TRAP( error, DoExecuteL() );
         delete cleanup;
     }
-   // __UHEAP_MARKEND;
     return error;
 }
 
--- a/locationdataharvester/mylocationsengine/src/calendernotification.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/calendernotification.cpp	Fri May 14 15:47:27 2010 +0300
@@ -42,7 +42,7 @@
     CCalenderNotification* self = new (ELeave) CCalenderNotification(
             aNotifyChange);
     CleanupStack::PushL(self);
-    self->ConstructL(aNotifyChange);
+    self->ConstructL();
     return self;
 }
 
@@ -51,7 +51,7 @@
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void CCalenderNotification::ConstructL(MNotifyChange* aNotifyChange)
+void CCalenderNotification::ConstructL()
 {
     CActiveScheduler::Add(this);
     User::LeaveIfError(iFsession.Connect());
@@ -118,3 +118,5 @@
 {
 }
 
+//End of file
+
--- a/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp	Fri May 14 15:47:27 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <BAUTILS.H>
+#include <bautils.h>
 #include "mylocationlogger.h"
 #include "lookupmaptiledb.h"
 
--- a/locationdataharvester/mylocationsengine/src/maptileinterface.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/maptileinterface.cpp	Fri May 14 15:47:27 2010 +0300
@@ -57,6 +57,8 @@
     delete iFilePath;
     
     delete iMaptileGeocoder;
+    
+    delete iLandmark;
 }    
 
 
@@ -66,7 +68,10 @@
 // -----------------------------------------------------------------------------
 //
 CMapTileInterface::CMapTileInterface() :
-           iMaptileGeocoder( NULL ), iFilePath( NULL ),iObserver(NULL)
+           iMaptileGeocoder( NULL ), 
+           iFilePath( NULL ),
+           iObserver(NULL),
+           iLandmark(NULL)
 {
 }
 
@@ -97,7 +102,8 @@
     iFilePath = NULL;    
     iFilePath = HBufC::NewL(aFilePath.Length());
     iFilePath->Des().Copy(aFilePath);
-    TConnectionOption conn = EInteractive;
+    iStreetAvailable = EFalse;
+    TConnectionOption conn = ESilent;
     iMaptileGeocoder->GetCoordinateByAddressL(aAddressDetails, conn);
 }
 // -----------------------------------------------------------------------------
@@ -116,17 +122,13 @@
     iFilePath->Des().Copy(aFilePath);
 
     TPtrC getStreet;
-
     aLandmark->GetPositionField(EPositionFieldStreet, getStreet);
 
     if (getStreet.Length() > 0)
     {
         iStreetAvailable = ETrue;
     }
-
-    TConnectionOption conn = EInteractive;
-
-
+    TConnectionOption conn = ESilent;
     iMaptileGeocoder->GetCoordinateByAddressL(*aLandmark, conn);
 }
 
@@ -139,18 +141,14 @@
 {
     __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);
-
     iMaptileGeocoder->GetMapTileByGeoCodeL( mapTileparam, *iFilePath );
 }
 
@@ -177,8 +175,8 @@
 {
     __TRACE_CALLSTACK;
     TReal latitude, longitude;
-    aAddressInfo.GetLatitude( latitude );
-    aAddressInfo.GetLongitude( longitude );
+    latitude=aAddressInfo.GetLatitude();
+    longitude=aAddressInfo.GetLongitude();
     
     MYLOCLOGSTRING1("GeocodeCompleted() status-%d",aErrorcode);
     MYLOCLOGSTRING1("GeocodeCompleted() latitude-%f",latitude );
@@ -188,7 +186,8 @@
     {
         if ( latitude != KInvalidLatitudeLongitude
                 && longitude != KInvalidLatitudeLongitude)
-        {
+        {           
+            TRAP_IGNORE( SetLandMarkDetailsL(aAddressInfo) );            
             TRAPD( error, GetMapTileL(latitude, longitude) );
             if ( error != KErrNone )
             {
@@ -209,3 +208,55 @@
     }
 }
 
+// -----------------------------------------------------------------------------
+// CMapTileInterface::GetLandMarkDetails()
+// return pointer to CPosLandmark 
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMapTileInterface::GetLandMarkDetails()
+{
+    return iLandmark;  
+               
+}
+// -----------------------------------------------------------------------------
+// CMapTileInterface::SetLandMarkDetails()
+// create CPosLandmark details from MAddressInfo 
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::SetLandMarkDetailsL(MAddressInfo& aAddressInfo)
+{
+    if(iLandmark)
+    {
+        delete iLandmark;
+        iLandmark=NULL;
+    }
+    TReal latitude,longitude;
+    latitude=aAddressInfo.GetLatitude();
+    longitude=aAddressInfo.GetLongitude();    
+    TLocality position(TCoordinate(latitude,longitude),0);
+    iLandmark=CPosLandmark::NewL();
+    //latitude and longitude
+    iLandmark->SetPositionL(position);
+    
+    //street
+    TPtrC tempText=aAddressInfo.GetThoroughfareName();
+    if(tempText.Length()>0)
+    {
+        iStreetAvailable=ETrue;
+    }
+    iLandmark->SetPositionFieldL(EPositionFieldStreet, tempText);
+    //postal code
+    tempText.Set(aAddressInfo.GetPincode());
+    iLandmark->SetPositionFieldL(EPositionFieldPostalCode, tempText);
+    //city
+    tempText.Set(aAddressInfo.GetCity());
+    iLandmark->SetPositionFieldL(EPositionFieldCity, tempText);
+    //state
+    tempText.Set(aAddressInfo.GetState());
+    iLandmark->SetPositionFieldL(EPositionFieldState, tempText);
+    //country
+    tempText.Set(aAddressInfo.GetCountryName());
+    iLandmark->SetPositionFieldL(EPositionFieldCountry, tempText); 
+    
+}
+//end of line
--- a/locationdataharvester/mylocationsengine/src/mylocationsdatabasemanager.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/mylocationsdatabasemanager.cpp	Fri May 14 15:47:27 2010 +0300
@@ -21,20 +21,30 @@
 #include <EPos_CPosLmTextCriteria.h>
 #include <EPos_CPosLandmarkSearch.h>
 #include <EPos_CPosLmDatabaseManager.h>
+#include <EPos_CPosLmNearestCriteria.h>
+
 #include <lbsposition.h>
-#include <mylocations.rsg>
+//#include <mylocations.rsg>
 #include <barsread.h>
 #include <barsc.h>
+#include <locationservicedefines.h>
 #include "mylocationsdatabasemanager.h"
 #include "mylocationlogger.h"
 #include "mylocationsdefines.h"
-//Custom landmark database for storing the my locations details
-_LIT( KMyLocationsDatabaseUri, "file://c:MyLocationsLandmarks.ldb" );
+
 // 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.
@@ -49,50 +59,22 @@
     // create landmarks lookup database.
     iLandmarksLookupDb = CLookupDatabase::NewL(KLandmarksLookupDatabaseName);
     User::LeaveIfError( iLandmarksLookupDb->Open() );
-    
-    CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager::NewL();
-    CleanupStack::PushL(dbManager);
-
-    //Create custom landmark database for storing my locations data
-    if (!dbManager->DatabaseExistsL(KMyLocationsDatabaseUri))
+ 
+    iLocationAppLookupDb = new LocationDataLookupDb();
+    if( !iLocationAppLookupDb->open() )
     {
-        HPosLmDatabaseInfo* dbInfo = HPosLmDatabaseInfo::NewLC(
-                KMyLocationsDatabaseUri);
-        dbManager->CreateDatabaseL(*dbInfo);
-        CleanupStack::PopAndDestroy(dbInfo);
+        User::Leave( KErrUnknown );
     }
-
-    CleanupStack::PopAndDestroy(dbManager);
-
-    //Open and initialize the custom landmark database
-    iMyLocationsLandmarksDb = CPosLandmarkDatabase::OpenL(
-                                        KMyLocationsDatabaseUri);
-    if (iMyLocationsLandmarksDb->IsInitializingNeeded())
-    {
-        ExecuteAndDeleteLD(iMyLocationsLandmarksDb->InitializeL());
-    }
-
-    // create mylocations lookup database.
-    iMylocationsLookupDb
-            = CLookupDatabase::NewL(KMylocationsLookupDatabaseName);
-
-    // Create category manager for mylocations
-    iMyLocationsCatManager = CPosLmCategoryManager::NewL(
-            *iMyLocationsLandmarksDb);
-
+    
     // Create category manager for landmarks
     iLandmarksCatManager = CPosLmCategoryManager::NewL(*iLandmarkDb);
 
-    //open the lookup database
-    User::LeaveIfError( iMylocationsLookupDb->Open() );
-
     // open file session
     User::LeaveIfError(iFsSession.Connect());
 
-    // Add contacts, calendar and history categories
-    AddMylocationsCategoryL(ESourceLandmarksContactsCat);
-    //close the lookup database
-    iMylocationsLookupDb->Close();
+    // Add contacts and calendar  categories
+    iLmContactsCatId = AddMylocationsCategoryL(KContactsCategory);
+    iLmCalendarCatId = AddMylocationsCategoryL( KCalendarCategory );
 
 }
 
@@ -102,9 +84,8 @@
 // -----------------------------------------------------------------------------
 //
 CMyLocationsDatabaseManager::CMyLocationsDatabaseManager() : iLandmarkDb( NULL ),
-                iMyLocationsLandmarksDb( NULL ), 
                 iLmContactsCatId( 0 ), iLandmarksLookupDb( NULL ), 
-                iMylocationsLookupDb( NULL ), iMyLocationsCatManager( NULL ), 
+                iLocationAppLookupDb( NULL ),
                 iLandmarksCatManager( NULL )
 {
 }
@@ -122,20 +103,16 @@
         iLandmarksLookupDb->Close();
         delete iLandmarksLookupDb;
     }
-    if (iMylocationsLookupDb)
+    if (iLocationAppLookupDb)
     {
-        iMylocationsLookupDb->Close();
-        delete iMylocationsLookupDb;
+        iLocationAppLookupDb->close();
+        delete iLocationAppLookupDb;
     }
 
     delete iLandmarksCatManager;
 
     delete iLandmarkDb;
 
-    delete iMyLocationsCatManager;
-
-    delete iMyLocationsLandmarksDb;
-  
     // close the file session
     iFsSession.Close();
 
@@ -146,107 +123,27 @@
 // Adds the category to the mylocations and landmarks database..
 // -----------------------------------------------------------------------------
 //
-void CMyLocationsDatabaseManager::AddMylocationsCategoryL( const TUint32 aCategoryType )
+TUint32 CMyLocationsDatabaseManager::AddMylocationsCategoryL( const TDesC&  aCategoryName )
 {
     __TRACE_CALLSTACK;//Open the resource file
-    RResourceFile resourceFile;
-    resourceFile.OpenL( iFsSession, KMyLocationsResourceFile );
-    CleanupClosePushL( resourceFile );
     
-    // Get the category name
-    HBufC8* dataBuffer = NULL;
-    if (aCategoryType == ESourceLandmarksContactsCat)
-    {
-        dataBuffer = resourceFile.AllocReadLC(R_LOCINT_LIST_CATEGORY_CONTACTS);
-    }
+    TPosLmItemId catId = 0;
     
-    TResourceReader resReader;
-    resReader.SetBuffer(dataBuffer);
-    TPtrC resData = resReader.ReadTPtrC();
-
-    TLookupItem lookupItem;
-    lookupItem.iLmId = 0;
-    lookupItem.iSource = aCategoryType;
-    lookupItem.iUid = 0;
-
-    RArray<TLookupItem> itemArray;
-    CleanupClosePushL(itemArray);
-    iMylocationsLookupDb->FindEntriesBySourceTypeL(lookupItem.iSource,
-            itemArray);
-
-    // Get the category from mylocations lookup table
-    if (itemArray.Count() == 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)
     {
-        // category not found, so create one.
-        CPosLandmarkCategory *category = CPosLandmarkCategory::NewL();
-        CleanupStack::PushL(category);
-        category->SetCategoryNameL(resData);
-
-        if ( aCategoryType == ESourceLandmarksContactsCat)
-        {
-            TPosLmItemId landmarksCatId = 0;
-            // Add category to landmarks database
-            TRAPD ( error, ( landmarksCatId = iLandmarksCatManager->AddCategoryL( *category ) ) );
-            if (error == KErrNone || error == KErrAlreadyExists)
-            {
-                landmarksCatId = iLandmarksCatManager->GetCategoryL(resData);
-            }
-            lookupItem.iUid = landmarksCatId;
-        }
-
-        // Add the catefory to mylocations database
-        TPosLmItemId myLocationsCatId = 0;
-        // Add category to mylocations database
-        TRAPD ( error, ( myLocationsCatId = iMyLocationsCatManager->AddCategoryL( *category ) ) );
-        if (error == KErrNone || error == KErrAlreadyExists)
-        {
-            myLocationsCatId = iMyLocationsCatManager->GetCategoryL(resData);
-        }
-        // create this entry in mylocations lookup table
-        lookupItem.iSource = aCategoryType;
-        lookupItem.iLmId = myLocationsCatId;
-        iMylocationsLookupDb->CreateEntryL(lookupItem);
-
-        CleanupStack::PopAndDestroy(category);
-    }
-    else
-    {
-        // category found in lookup table,
-        // update the corresponding category in Mylocations and landmarks database with 
-        // current localized string  
-
-
-        lookupItem.iLmId = itemArray[0].iLmId;
-        lookupItem.iUid = itemArray[0].iUid;
-        if ( aCategoryType == ESourceLandmarksContactsCat)
-        {
-            CPosLandmarkCategory *category =
-                    iLandmarksCatManager->ReadCategoryLC(lookupItem.iUid);
-            category->SetCategoryNameL(resData);
-            TRAP_IGNORE ( ( iLandmarksCatManager->UpdateCategoryL( *category ) ) );
-            CleanupStack::PopAndDestroy(category);
-        }
-        // update category in mylocations db
-        CPosLandmarkCategory *category2 =
-                iMyLocationsCatManager->ReadCategoryLC(lookupItem.iLmId);
-        category2->SetCategoryNameL(resData);
-        TRAP_IGNORE ( ( iMyLocationsCatManager->UpdateCategoryL( *category2 ) ) );
-        CleanupStack::PopAndDestroy(category2);
+        catId = iLandmarksCatManager->GetCategoryL( aCategoryName );
     }
 
-    CleanupStack::PopAndDestroy(&itemArray);
+    CleanupStack::PopAndDestroy(category);
 
-    if ( dataBuffer )
-    {
-        CleanupStack::PopAndDestroy(dataBuffer);
-    }
-    
-    if (aCategoryType == ESourceLandmarksContactsCat)
-        iLmContactsCatId = lookupItem.iUid;
-    
-    // Close the resource file
-    CleanupStack::PopAndDestroy( &resourceFile );
-
+    return catId;
 }
 
 // -----------------------------------------------------------------------------
@@ -260,7 +157,6 @@
         const TUint32 aUid, const TUint32 aSourceType, const TEntryChangeType aChangeType)
 {
     __TRACE_CALLSTACK;//open the lookup database
-    User::LeaveIfError(iMylocationsLookupDb->Open());
     switch (aChangeType)
     {
     // if the entry is added
@@ -285,8 +181,6 @@
         break;
     }
     }
-    //close the lookup database
-    iMylocationsLookupDb->Close();
 
 }
 
@@ -306,20 +200,24 @@
 
     // create a search object.
     CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(
-            *iMyLocationsLandmarksDb);
+            *iLandmarkDb);
     CleanupStack::PushL(search);
 
-    TBuf<KMaxAddressLength> lmAddress;
-    GetLandmarkFullAddress(lmAddress, aLandmark);
+    TBuf<KMaxAddressLength> lmAddress1;
+    GetLandmarkFullAddress( lmAddress1, aLandmark );
+    QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
 
-    // Create the search criterion
-    CPosLmTextCriteria* crit = CPosLmTextCriteria::NewLC();
-    crit->SetTextL(lmAddress);
-    crit->SetAttributesToSearch(CPosLandmark::ELandmarkName);
-
+    // 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(*crit));
-    CleanupStack::PopAndDestroy(crit);
+    ExecuteAndDeleteLD( search->StartLandmarkSearchL( *nearestCriteria ) );
+    CleanupStack::PopAndDestroy( nearestCriteria );
 
     // Retrieve an iterator to access the matching landmarks.
     CPosLmItemIterator* iter = search->MatchIteratorL();
@@ -328,24 +226,19 @@
     // Iterate the search matches.
     TPosLmItemId lmId;
 
-    while ((lmId = iter->NextL()) != KPosLmNullItemId)
+    while( ( lmId = iter->NextL() ) != KPosLmNullItemId )
     {
-        //Found duplicate entries.
-        // Get the corresponding id in landmarks db
-        RArray<TLookupItem> itemArray;
-        CleanupClosePushL(itemArray);
-        iMylocationsLookupDb->FindEntriesByLandmarkIdL(lmId, itemArray);
-        if (itemArray.Count())
+        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 )
         {
-            if (itemArray[0].iSource == ESourceLandmarks)
-            {
-                // return id only if the source is from landmarks database.
-                retId = itemArray[0].iUid;
-                CleanupStack::PopAndDestroy(&itemArray);
-                break;
-            }
+            retId = lmId;
+            break;
         }
-        CleanupStack::PopAndDestroy(&itemArray);
     }
 
     CleanupStack::PopAndDestroy(iter);
@@ -361,63 +254,24 @@
 // -----------------------------------------------------------------------------
 //
 TBool CMyLocationsDatabaseManager::CompareLandmarks(
-        const CPosLandmark* aLandmark1, const CPosLandmark* aLandmark2)
+        const CPosLandmark* aLandmark1, const CPosLandmark* aLandmark2 )
 {
-    __TRACE_CALLSTACK;// Compare landmark names
-    TPtrC name1, name2;
-    aLandmark1->GetLandmarkName(name1);
-    aLandmark2->GetLandmarkName(name2);
-    if (name1 != name2)
-    {
-        return EFalse;
-    }
+    __TRACE_CALLSTACK;
 
-    // Compare street info
-    TPtrC street1, street2;
-    aLandmark1->GetPositionField(EPositionFieldStreet, street1);
-    aLandmark2->GetPositionField(EPositionFieldStreet, street2);
-    if (street1 != street2)
-    {
-        return EFalse;
-    }
-
-    // Compare City info
-    TPtrC city1, city2;
-    aLandmark1->GetPositionField(EPositionFieldCity, city1);
-    aLandmark2->GetPositionField(EPositionFieldCity, city2);
-    if (city1 != city2)
-    {
-        return EFalse;
-    }
+    TBuf<KMaxAddressLength> lmAddress1;
+    GetLandmarkFullAddress( lmAddress1, aLandmark1 );
+    QString str1 = QString( (QChar*)lmAddress1.Ptr(), lmAddress1.Length());
 
-    // compare state info
-    TPtrC state1, state2;
-    aLandmark1->GetPositionField(EPositionFieldState, state1);
-    aLandmark2->GetPositionField(EPositionFieldState, state2);
-    if (state1 != state2)
-    {
-        return EFalse;
-    }
+    TBuf<KMaxAddressLength> lmAddress2;
+    GetLandmarkFullAddress( lmAddress2, aLandmark2 );
+    QString str2 = QString( (QChar*)lmAddress2.Ptr(), lmAddress2.Length());
 
-    // compare postal code
-    TPtrC postalCode1, postalCode2;
-    aLandmark1->GetPositionField(EPositionFieldPostalCode, postalCode1);
-    aLandmark2->GetPositionField(EPositionFieldPostalCode, postalCode2);
-    if (postalCode1 != postalCode2)
-    {
+    if( str1 == str2 )
+        return ETrue;
+    else
         return EFalse;
-    }
-
-    // compare country name
-    TPtrC country1, country2;
-    aLandmark1->GetPositionField(EPositionFieldCountry, country1);
-    aLandmark2->GetPositionField(EPositionFieldCountry, country2);
-    if (country1 != country2)
-    {
-        return EFalse;
-    }
-
-    return ETrue;
+    
+    
 }
 
 // -----------------------------------------------------------------------------
@@ -429,58 +283,94 @@
         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 )
     {
-        AddToMylocationsDbL(aLandmark, aUid, aSourceType);
-        return;
-    }
-    if ( aSourceType == ESourceLandmarksCategory )
-    {
-        CreateCategoryL(aUid);
-        return;
+        // 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;
+        }
     }
-    // Create a lookup item
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = aSourceType;
 
+    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)
+    TPosLmItemId dupLmId = CheckIfDuplicateExistsL( aLandmark );
+    if ( dupLmId )
     {
         // landmark already present in db. get the details
         CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(dupLmId);
-        if (dupLandmark)
+        if( dupLandmark )
         {
-            if (aSourceType == ESourceContactsPref || aSourceType
-                    == ESourceContactsWork || aSourceType
-                    == ESourceContactsHome)
-            {
-                dupLandmark->AddCategoryL(iLmContactsCatId);
-            }
+            // add category.
+            dupLandmark->AddCategoryL( catId );
             // update the landmark object in the db
-            iLandmarkDb->UpdateLandmarkL(*dupLandmark);
-            CleanupStack::PopAndDestroy(dupLandmark);
+            iLandmarkDb->UpdateLandmarkL( *dupLandmark );
+            CleanupStack::PopAndDestroy( dupLandmark );
         }
 
         // point the lookup item's landmark uid to the existing landmark.
-        lookupItem.iLmId = dupLmId;
+        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
     {
-        if (aSourceType == ESourceContactsPref || aSourceType
-                == ESourceContactsWork || aSourceType == ESourceContactsHome)
-        {
-            aLandmark->AddCategoryL(iLmContactsCatId);
-        }
+        // 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.iLmId = iLandmarkDb->AddLandmarkL(*aLandmark);
+        lookupItem.mDestId = iLandmarkDb->AddLandmarkL( *aLandmark );
     }
 
     // create the entry in the lookup table.
-    iLandmarksLookupDb->CreateEntryL(lookupItem);
-
+    iLocationAppLookupDb->createEntry( lookupItem );
 }
 
 // -----------------------------------------------------------------------------
@@ -489,164 +379,210 @@
 // -----------------------------------------------------------------------------
 //
 void CMyLocationsDatabaseManager::HandleEntryModificationL(
-        CPosLandmark* aLandmark, const TUint32 aUid, const TUint32 aSourceType)
+        CPosLandmark* aLandmark, const TUint32 aUid, const TUint32 aSourceType )
 {
     __TRACE_CALLSTACK;
     if ( aSourceType == ESourceLandmarks )
     {
-        ModifyMylocationsDbL( aLandmark, aUid, aSourceType );
+        HandleLandmarkModificationL( aLandmark, aUid );
         return;
     }
 
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = aSourceType;
+    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.
 
-    if (aSourceType == ESourceContactsPref || aSourceType
-            == ESourceContactsWork || aSourceType == ESourceContactsHome)
+    // find the entry in the lookup table.
+    if ( iLocationAppLookupDb->findEntryBySourceIdAndType( lookupItem ) )
     {
-        // Behavior: If a contact 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 (iLandmarksLookupDb->FindEntryL(lookupItem))
+        //fill address into lookup item.
+        FillLookupItemAddressDetails( aLandmark, lookupItem );
+        
+        QString locationName = lookupItem.mName;
+    
+        TPosLmItemId catId;
+        
+        if( aSourceType == ESourceCalendar )
         {
-            // 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.iLmId ) ) );
-            CleanupStack::PushL(existingLandmark);
-            if (error == KErrNotFound)
+            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++)
             {
-                // Landmarks item deleted. So delete corresponding lookup entries.
-                RArray<TLookupItem> itemArray;
-                CleanupClosePushL(itemArray);
-                iLandmarksLookupDb->FindEntriesByLandmarkIdL(lookupItem.iLmId,
-                        itemArray);
-                for (TInt i = 0; i < itemArray.Count(); i++)
-                {
-                    iLandmarksLookupDb->DeleteEntryL(itemArray[i]);
-                }
-                CleanupStack::PopAndDestroy(&itemArray);
-
-                // Add the entry into the lookup table and update landmarks db.
-                HandleEntryAdditionL(aLandmark, aUid, aSourceType);
-                
-                CleanupStack::PopAndDestroy(existingLandmark);
-                return;
+                iLocationAppLookupDb->deleteEntryBySourceIdAndType( itemArray[i] );
             }
 
-            if (!CompareLandmarks(existingLandmark, aLandmark))
-            {
-                // landmarks are not same, means location information is modified.
+            // Add the entry into the lookup table and update landmarks db.
+            HandleEntryAdditionL( aLandmark, aUid, aSourceType );
+            
+            CleanupStack::PopAndDestroy( existingLandmark );
+            return;
+        }
 
-                // Check if the new landmark is already in db.
-                TPosLmItemId dupLmId = CheckIfDuplicateExistsL(aLandmark);
-                if (dupLmId)
+        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 )
                 {
-                    // landmark already present in db. get the details
-                    CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(
-                            dupLmId);
-                    if (dupLandmark)
-                    {
-                        // add category.
-                        dupLandmark->AddCategoryL(iLmContactsCatId);
+                    // 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.iLmId = dupLmId;
-                    iLandmarksLookupDb->UpdateEntryL(lookupItem);
+                    // update the landmark object in the db
+                    iLandmarkDb->UpdateLandmarkL( *dupLandmark );
                 }
-                else
+                CleanupStack::PopAndDestroy( dupLandmark );
+
+                // update the lookup item to refer to the newly created landmark.
+                lookupItem.mDestId = dupLmId;
+                if( aSourceType == ESourceCalendar )
                 {
-                    // landmark not already present in db.
-                    // Create a new entry in the db
-                    aLandmark->AddCategoryL(iLmContactsCatId);
-                    lookupItem.iLmId = iLandmarkDb->AddLandmarkL(*aLandmark);
-                    // update the lookup table
-                    iLandmarksLookupDb->UpdateEntryL(lookupItem);
+                    // 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
             {
-                // landmarks are same, means location not modified. So return.
-                CleanupStack::PopAndDestroy(existingLandmark);
-                return;
+                // 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 );
             }
 
-            // delete the existing landmark only if it not being refered by other lookup entries.
+            CleanupStack::PopAndDestroy( existingLandmark );
+            return;
+        }
 
-            // Check if any other entries are refering this landmark.
-            RArray<TLookupItem> itemArray;
-            CleanupClosePushL(itemArray);
-            iLandmarksLookupDb->FindEntriesByLandmarkIdL(
-                    existingLandmark->LandmarkId(), itemArray);
+        // delete the existing landmark only if it not being refered by other lookup entries.
 
-            if (itemArray.Count())
-            {
-                // There are other lookup entries refering this landmark. So do not delete the landmark
+        // Check if any other entries are refering this landmark.
+        QList<QLookupItem> itemArray;
+        iLocationAppLookupDb->findEntriesByLandmarkId(
+                existingLandmark->LandmarkId(), itemArray );
 
-                // If none of these lookup item's source type is contacts, disassociate 'iLmContactsCatId' category
-                // from this landmark.
-                TInt i = 0;
-                while (i < itemArray.Count())
+        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].iSource == ESourceContactsPref
-                            || itemArray[i].iSource == ESourceContactsWork
-                            || itemArray[i].iSource == ESourceContactsHome
-                            )
+                    if ( itemArray[i].mSourceType == aSourceType )
                     {
-                        // a lookup item exists which is from contacts, so 'iLmContactsCatId' is still valid.
+                        // a lookup item exists which is from calendar, so 'catId' is still valid.
                         break;
                     }
-                    i++;
-                }
-                if (i == itemArray.Count())
+                 }
+                else 
                 {
-                    // no lookup items from contacts exists refering this landmark.
-                    // so disassociate 'iLmContactsCatId' from this landmark
-
-                    existingLandmark->RemoveCategory(iLmContactsCatId);
-                    iLandmarkDb->UpdateLandmarkL(*existingLandmark);
+                    // a lookup item exists which is from contacts, so 'catId' is still valid.
+                    break;
                 }
+                i++;
             }
-            else
+            if ( i == itemArray.count() )
             {
-                // no other lookup entry is refering this landmark. 
+                // no lookup items from current source type exists refering this landmark.
+                // so disassociate 'catId' from this landmark
 
-                // check if any other categories is associated with this landmark.
-                // Assume this landmark is associated with a history entry or a user created landmark entry.
-                // there is a chance that this landmark is still valid.
-                // Do not delete the landmark in this case.
-                RArray<TPosLmItemId> categoryIdArray;
-                CleanupClosePushL(categoryIdArray);
-                existingLandmark->GetCategoriesL(categoryIdArray);
-                if (categoryIdArray.Count() == 1)
-                {
-                    // only one category i.e, 'iLmContactsCatId' is associated.
-                    // delete the landmark.
-                    iLandmarkDb->RemoveLandmarkL(existingLandmark->LandmarkId());
-                }
-                CleanupStack::PopAndDestroy(&categoryIdArray);
+                existingLandmark->RemoveCategory( catId );
+                iLandmarkDb->UpdateLandmarkL( *existingLandmark );
             }
-            CleanupStack::PopAndDestroy(&itemArray);
-            CleanupStack::PopAndDestroy(existingLandmark);
-
+        }
+        else
+        {
+            // no other lookup entry is refering this landmark. 
+            // delete the landmark.
+            iLandmarkDb->RemoveLandmarkL( existingLandmark->LandmarkId() );
         }
-        else // entry not present in lookup table
-        {
-            // Add the entry into the lookup table and update landmarks db.
-            HandleEntryAdditionL(aLandmark, aUid, aSourceType);
-        }
+        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 );
     }
 }
 
@@ -659,107 +595,252 @@
                                                 const TUint32 aSourceType)
 {
     __TRACE_CALLSTACK;
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = aSourceType;
-
-    if (aSourceType == ESourceContactsPref || aSourceType
-            == ESourceContactsWork || aSourceType == ESourceContactsHome)
-    {
-        // Behavior: In the context of contacts, if a contact is deleted, the user is not interested in
-        // that contact's data, hence its address as well. So, 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.
+    QLookupItem lookupItem;
+    lookupItem.mSourceUid = aUid;
+    lookupItem.mSourceType = aSourceType;
 
-        // Find the corresponding landmark uid
-        if (iLandmarksLookupDb->FindEntryL(lookupItem))
+    // 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 )
         {
-            // delete the lookup entry.
-            iLandmarksLookupDb->DeleteEntryL(lookupItem);
+            lookupItem.mDestId = aUid;
+        }
+        else
+        {
+            return;
+        }
+    }
+    
+    // Find the corresponding landmark uid
+    
 
-            // Check if any other entries are refering this landmark.
-            RArray<TLookupItem> itemArray;
-            CleanupClosePushL(itemArray);
-            iLandmarksLookupDb->FindEntriesByLandmarkIdL(lookupItem.iLmId,
-                    itemArray);
+    // 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 ( itemArray.count() )
+    {
+    
+        if( aSourceType == ESourceLandmarks )
+        {
+            CPosLandmark* lm = NULL;
+        
+            for( int i = 0; i < itemArray.count(); i++ )
             {
-                // There are other lookup entries refering this landmark. So do not delete the landmark
-
-                // If none of these lookup item's source type is contacts, disassociate 'iLmContactsCatId' category
-                // from this landmark.
-                TInt i = 0;
-                while (i < itemArray.Count())
+                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
                 {
-                    if (itemArray[i].iSource == ESourceContactsPref
-                            || itemArray[i].iSource == ESourceContactsWork
-                            || itemArray[i].iSource == ESourceContactsHome)
+                   // 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 )
                     {
-                        // a lookup item exists which is from contacts/calendar, so 'iLmContactsCatId' is still valid.
-                        break;
+                        itemArray[i].mIsDuplicate = 0;
+                        iLocationAppLookupDb->updateEntryById( itemArray[i] );
                     }
-                    i++;
+                    // a lookup item exists which is from calendar, so 'iLmCalendarCatId' is still valid.
+                    break;
                 }
-                if ( i == itemArray.Count() )
-                {
-                    // no lookup items from contacts exists refering this landmark.
-                    // so disassociate 'iLmContactsCatId' from this landmark
+        
+            }
+            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.iLmId);
-                    landmark->RemoveCategory(iLmContactsCatId);
-                    iLandmarkDb->UpdateLandmarkL(*landmark);
-                    CleanupStack::PopAndDestroy(landmark);
-                }
+            CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC( lookupItem.mDestId );
+            if( aSourceType == ESourceCalendar )
+            {
+                landmark->RemoveCategory( iLmCalendarCatId );
             }
             else
             {
-                // no other lookup entry is refering this landmark. 
-
-                // check if any other categories is associated with this landmark.
-                // Assume this landmark is associated with a history entry or a user created landmark entry.
-                // there is a chance that this landmark is still valid.
-                // Do not delete the landmark in this case.
-                CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(
-                        lookupItem.iLmId);
-                RArray<TPosLmItemId> categoryIdArray;
-                CleanupClosePushL(categoryIdArray);
-                landmark->GetCategoriesL(categoryIdArray);
-                if (categoryIdArray.Count() == 1)
-                {
-                    // only one category i.e, 'iLmCalendarCatId' is associated.
-                    // delete the landmark.
-                    iLandmarkDb->RemoveLandmarkL(lookupItem.iLmId);
-                }
-
-                CleanupStack::PopAndDestroy(&categoryIdArray);
-                CleanupStack::PopAndDestroy(landmark);
+                landmark->RemoveCategory( iLmContactsCatId );
             }
-            CleanupStack::PopAndDestroy(&itemArray);
+            
+            iLandmarkDb->UpdateLandmarkL( *landmark );
+            CleanupStack::PopAndDestroy( landmark );
         }
     }
-
-    else if (aSourceType == ESourceLandmarks)
+    else
     {
-        // Landmarks item deleted. So delete corresponding lookup entries.
-        RArray<TLookupItem> itemArray;
-        CleanupClosePushL(itemArray);
-        iLandmarksLookupDb->FindEntriesByLandmarkIdL(aUid, itemArray);
-        for (TInt i = 0; i < itemArray.Count(); i++)
+        // no other lookup entry is refering this landmark. 
+        // delete the landmark.
+        if ( aSourceType != ESourceLandmarks )
         {
-            iLandmarksLookupDb->DeleteEntryL(itemArray[i]);
+            iLandmarkDb->RemoveLandmarkL( lookupItem.mDestId );
         }
-
-        CleanupStack::PopAndDestroy(&itemArray);
-
-        DeleteFromMylocationsDbL(aUid, aSourceType);
     }
 }
 
+// -----------------------------------------------------------------------------
+// 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.
@@ -772,23 +853,9 @@
     TPtrC tempStr;
     TInt retStatus;
     TBool addressEmtpy = ETrue;
-    retStatus = aLandmark->GetLandmarkName(tempStr);
-    if (retStatus == KErrNone && tempStr.Length())
-    {
-        aLandmarkAddress.Copy(tempStr);
-        addressEmtpy = EFalse;
-    }
-
     retStatus = aLandmark->GetPositionField(EPositionFieldStreet, tempStr);
     if (retStatus == KErrNone && tempStr.Length())
     {
-        if (!addressEmtpy)
-        {
-            aLandmarkAddress.Append(KSeparator);
-            aLandmarkAddress.Append(KSpace);
-            aLandmarkAddress.Append(tempStr);
-        }
-        else
         {
             aLandmarkAddress.Copy(tempStr);
             addressEmtpy = EFalse;
@@ -845,19 +912,6 @@
 }
 
 // -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CheckCategoryAvailabilityL()
-// Checks if given category id is found in the database pointed by category manager.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::CheckCategoryAvailabilityL(
-        CPosLmCategoryManager* aCategoryManager, const TUint32 aCategoryId)
-{
-    __TRACE_CALLSTACK;
-    CPosLandmarkCategory *category = aCategoryManager->ReadCategoryLC(
-            aCategoryId);
-    CleanupStack::PopAndDestroy(category);
-}
-// -----------------------------------------------------------------------------
 // CMyLocationsDatabaseManager::CheckAndReadLandmarkL()
 // Checks if given landmark id is found in the database and returns the read landmark.
 // -----------------------------------------------------------------------------
@@ -870,111 +924,167 @@
     CleanupStack::Pop(lm);    
     return lm;
 }
+
 // -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::AddToMylocationsDbL()
-// Adds the entry into the mylocations database and updates the lookup table.
+// CMyLocationsDatabaseManager::FillLookupItemAddressDetails()
+// Creates a new category in Mylocations Db and adds a corresponding entry in 
+// mylocations lookup table.
 // -----------------------------------------------------------------------------
 //
-void CMyLocationsDatabaseManager::AddToMylocationsDbL(CPosLandmark* aLandmark,
-        const TUint32 aUid, const TUint32 aSourceType)
+void CMyLocationsDatabaseManager::FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem& aLookupItem )
 {
-    __TRACE_CALLSTACK;
-    if (aSourceType == ESourceLandmarks)
+    __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 )
     {
-        CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(aUid);
-        RArray<TPosLmItemId> catArray;
-        CleanupClosePushL( catArray );
-        landmark->GetCategoriesL(catArray);
-       
+        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());
+    }
 
-        // add the categories in the mylocations database for this landmark
-        for (TInt i = 0; i < catArray.Count(); i++)
-        {
-            TLookupItem lItem;
-            lItem.iUid = catArray[i];
-            lItem.iSource = ESourceLandmarksUserCat;
-            lItem.iLmId = 0;
-            if (!iMylocationsLookupDb->FindEntryL(lItem))
-            {
-                lItem.iSource = ESourceLandmarksContactsCat;
-                if (!iMylocationsLookupDb->FindEntryL(lItem))
-                {
-                    // means this is global category, so just add it
-                    lItem.iLmId = lItem.iUid;
-                }
-            }
-            TRAP_IGNORE( aLandmark->AddCategoryL( lItem.iLmId ) );
-        }
+    // get postal code
+    aLookupItem.mPostalCode = "";
+    retStatus = aLandmark->GetPositionField( EPositionFieldPostalCode, tempStr );
+    if( retStatus == KErrNone && tempStr.Length() )
+    {
+        aLookupItem.mPostalCode = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+    }
 
-        CleanupStack::PopAndDestroy( &catArray );       
-        TLookupItem lookupItem;
-        lookupItem.iUid = aUid;
-        lookupItem.iSource = aSourceType;
-        TRAP_IGNORE( lookupItem.iLmId = iMyLocationsLandmarksDb->AddLandmarkL( *aLandmark ) );
-        CleanupStack::PopAndDestroy(landmark);
-        iMylocationsLookupDb->CreateEntryL(lookupItem);
+    // 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::ModifyMylocationsDbL()
-// Adds the entry into the mylocations database and updates the lookup table.
+// CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry()
 // -----------------------------------------------------------------------------
 //
-void CMyLocationsDatabaseManager::ModifyMylocationsDbL(CPosLandmark* aLandmark,
-        const TUint32 aUid, const TUint32 aSourceType)
+void CMyLocationsDatabaseManager::UnsetDuplicateNextCalEntry( quint32 aLandmarkId )
 {
-    __TRACE_CALLSTACK;
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = aSourceType;
-    iMylocationsLookupDb->FindEntryL(lookupItem);
-    iMylocationsLookupDb->DeleteEntryL(lookupItem);
-    iMyLocationsLandmarksDb->RemoveLandmarkL(lookupItem.iLmId);
-    AddToMylocationsDbL(aLandmark, lookupItem.iUid, lookupItem.iSource);
+    // 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::DeleteFromMylocationsDbL()
-// Deletes the entry from the mylocations database and updates the lookup table.
-// -----------------------------------------------------------------------------
-//
-void CMyLocationsDatabaseManager::DeleteFromMylocationsDbL(const TUint32 aUid,
-                                                           const TUint32 aSourceType)
-{
-    __TRACE_CALLSTACK;
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = aSourceType;
-    iMylocationsLookupDb->FindEntryL(lookupItem);
-
-    iMyLocationsLandmarksDb->RemoveLandmarkL(lookupItem.iLmId);
-    iMylocationsLookupDb->DeleteEntryL(lookupItem);
-}
-// -----------------------------------------------------------------------------
-// CMyLocationsDatabaseManager::CreateCategoryL()
-// Creates a new category in Mylocations Db and adds a corresponding entry in 
-// mylocations lookup table.
+// CMyLocationsDatabaseManager::CreateLandmarkItemLC()
 // -----------------------------------------------------------------------------
 //
-void CMyLocationsDatabaseManager::CreateCategoryL(const TUint32 aUid)
+CPosLandmark* CMyLocationsDatabaseManager::CreateLandmarkItemLC( const QLookupItem &aLookupItem )
 {
-    __TRACE_CALLSTACK;// Read the category.
-    CPosLandmarkCategory *category = iLandmarksCatManager->ReadCategoryLC(aUid);
+    __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 ) );
 
-    TLookupItem lookupItem;
-    lookupItem.iUid = aUid;
-    lookupItem.iSource = ESourceLandmarksUserCat;
-    // Add category to landmarks database
-    TRAPD ( err, (lookupItem.iLmId = iMyLocationsCatManager->AddCategoryL( *category ) ) );
+    text.Copy( aLookupItem.mStreet.utf16() );
+    landmark->SetPositionFieldL( EPositionFieldStreet, text );
+    
+    // Set the City
+    text.Copy( aLookupItem.mCity.utf16() );
+    landmark->SetPositionFieldL( EPositionFieldCity, text );
 
-    if (err == KErrNone)
-    {
-        iMylocationsLookupDb->CreateEntryL(lookupItem);
-    }
-    CleanupStack::PopAndDestroy(category);
+    // 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	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp	Fri May 14 15:47:27 2010 +0300
@@ -20,14 +20,15 @@
 #include <f32file.h>
 #include <calchangecallback.h> 
 #include <cntitem.h>
-#include <CNTFLDST.H>
+#include <cntfldst.h>
 #include <EPos_CPosLmDatabaseManager.h>
 #include <lbsposition.h>
 #include <bautils.h>
 #include <f32file.h>
+#include <locationservicedefines.h>
 #include "mylocationsengine.h"
 #include "mylocationsdefines.h"
-#include "geocodeupdate.h" //header for CGeocodeUpdate class
+#include "geocodeupdate.h" //header for GeocodeUpdate class
 //handle for CMyLocationsHistoryDbObserver class
 #include "mylocationlogger.h"
 #if ( defined __WINSCW__ ) || ( defined __WINS__ )
@@ -35,14 +36,10 @@
 #endif
 _LIT(KFolderName,":\\MapTile\\");
 const TInt KImagePathSize=36;
-const TInt KBufSize=256;
 const TInt KDefaultFilePathSize = 20;
 
 // separator
 _LIT( KSeparator, ",");
-_LIT(KContactPrefered, "Contact Prefered");
-_LIT(KContactHome, "Contact Home");
-_LIT(KContactWork, "Contact Work");
 _LIT(KPNGType, ".png");
 _LIT(KSingleSpace, " ");
 
@@ -67,8 +64,6 @@
     __TRACE_CALLSTACK;
     CActiveScheduler::Add(this);
 
-   
-
     //Connection to Landmark DB
     iLandmarkDb = CPosLandmarkDatabase::OpenL();
     ExecuteAndDeleteLD(iLandmarkDb->InitializeL());
@@ -96,8 +91,6 @@
 
     MYLOCLOGSTRING(" start contact db observation ");
     StartContactsChangeNotifierL();
-    MYLOCLOGSTRING(" start landmark db observation ");
-    StartLandmarksChangeNotifier();
 
     //set the folder path to store maptile
     imageFilePath.Zero();
@@ -107,6 +100,9 @@
     iCalSession = CCalSession::NewL();
     NotifyChangeL(status);
 
+    // Start listening to landmarks db changes
+    StartLandmarksChangeNotifier();
+
 }
 // -----------------------------------------------------------------------------
 // CMyLocationsEngine::SetFolderPath()
@@ -207,8 +203,10 @@
 // -----------------------------------------------------------------------------
 //
 CMyLocationsEngine::CMyLocationsEngine() :
-    CActive(EPriorityStandard), iCalSession(NULL), iCalView(NULL), iContactsDb(
-            NULL), iContactChangeNotifier(NULL), iLandmarkDb(NULL),
+            CActive(EPriorityStandard), 
+            iCalSession(NULL), iCalView(NULL), 
+	        iContactsDb(NULL), iContactChangeNotifier(NULL), 
+			iLandmarkDb(NULL),
             iMapTileInterface(NULL), iMyLocationsDatabaseManager(NULL),
             iMaptileDatabase(NULL), iAddressCompare(NULL),
             iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL)
@@ -257,8 +255,7 @@
     __TRACE_CALLSTACK;
     
     TBufC<KDefaultFilePathSize> defaultFile = iCalSession->DefaultFileNameL();
-    TChar drive = defaultFile[0];
-    
+    TChar drive = defaultFile[0];    
     TRAP(aStatus, iCalSession->OpenL( defaultFile ));
     MYLOCLOGSTRING1("iCalSession->OpenL() status-%d",aStatus);
     if ( KErrNone == aStatus )
@@ -328,7 +325,7 @@
 {
     __TRACE_CALLSTACK;
    
-    GeocodeUpdate::CreateContactdb();
+    GeocodeUpdate::createContactdb();
     iContactsDb = CContactDatabase::OpenL();
     // Create CContactChangeNotifier object with 'this' object. 
     iContactChangeNotifier = CContactChangeNotifier::NewL(*iContactsDb,this);
@@ -346,7 +343,6 @@
     SetActive();
 }
 
-
 // -----------------------------------------------------------------------------
 // CMyLocationsEngine::CalChangeNotification()
 // Callback when there is a change in the calendar database.
@@ -357,7 +353,7 @@
         RArray<TCalChangeEntry>& aChangeItems)
 {
     __TRACE_CALLSTACK;
-    
+       
     if(iCalenderNotification)
     {
         delete iCalenderNotification;
@@ -381,7 +377,13 @@
 
         case EChangeModify:
         {
-
+            if (iMapTileRequestQueue.Count() > 0)
+            {
+                if (calChangeEntry.iEntryId == iMapTileRequestQueue[0]->iUId)
+                {
+                    return;
+                }
+            }
             TLookupItem lookupItem;
             lookupItem.iSource = ESourceCalendar;
             lookupItem.iUid = calChangeEntry.iEntryId;
@@ -396,6 +398,9 @@
             lookupItem.iSource = ESourceCalendar;
             lookupItem.iUid = calChangeEntry.iEntryId;
            TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem));
+           
+           TRAP_IGNORE( UpdateDatabaseL( NULL, 
+                              calChangeEntry.iEntryId, ESourceCalendar, EEntryDeleted ) );
             break;
         }
         };
@@ -403,6 +408,10 @@
     }
 }
 
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CalenderEntryAddedL()
+// -----------------------------------------------------------------------------
+//
 void CMyLocationsEngine::CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry)
 {
     __TRACE_CALLSTACK;
@@ -474,13 +483,13 @@
                 {
                     // If the contact is a modified one and it might already exist in
                     // mylocations db, so delete it
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                    UpdateDatabaseL(NULL,
                             aEvent.iContactId, ESourceContactsPref,
                             EEntryDeleted);
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                    UpdateDatabaseL(NULL,
                             aEvent.iContactId, ESourceContactsWork,
                             EEntryDeleted);
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                    UpdateDatabaseL(NULL,
                             aEvent.iContactId, ESourceContactsHome,
                             EEntryDeleted);
                 }
@@ -496,7 +505,7 @@
                 // if home address available, update Mylocations.  
                 if (homeAddressLm)
                 {
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(homeAddressLm,
+                    UpdateDatabaseL(homeAddressLm,
                             aEvent.iContactId, ESourceContactsHome, changeType);
                     CleanupStack::PopAndDestroy(homeAddressLm);
                 }
@@ -504,7 +513,7 @@
                 // if work address available, update Mylocations.  
                 if (workAddressLm)
                 {
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(workAddressLm,
+                    UpdateDatabaseL(workAddressLm,
                             aEvent.iContactId, ESourceContactsWork, changeType);
                     CleanupStack::PopAndDestroy(workAddressLm);
                 }
@@ -512,7 +521,7 @@
                 // if prefered address available, update Mylocations.  
                 if (preferedAddressLm)
                 {
-                    iMyLocationsDatabaseManager->UpdateDatabaseL(
+                    UpdateDatabaseL(
                             preferedAddressLm, aEvent.iContactId,
                             ESourceContactsPref, changeType);
                     CleanupStack::PopAndDestroy(preferedAddressLm);
@@ -529,15 +538,15 @@
         // the contact is deleted, so delete the corresponding entries from database.
 
         // delete prefered address in database
-        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+        UpdateDatabaseL(NULL, aEvent.iContactId,
                 ESourceContactsPref, EEntryDeleted);
 
         // delete work address in database
-        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+        UpdateDatabaseL(NULL, aEvent.iContactId,
                 ESourceContactsWork, EEntryDeleted);
 
         // delete home address in database
-        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+        UpdateDatabaseL(NULL, aEvent.iContactId,
                 ESourceContactsHome, EEntryDeleted);
     }
 }
@@ -554,19 +563,20 @@
     TLookupItem lookupItem;
     lookupItem.iUid = aEvent.iContactId;
     // If contact is deleted delete from mylocations db
-    /*    if (aEvent.iType == EContactDbObserverEventContactDeleted)
+        if (aEvent.iType == EContactDbObserverEventContactDeleted)
      {
-     MYLOCLOGSTRING("EContactDbObserverEventContactDeleted" );
-     // delete prefered address in database
-     lookupItem.iSource = ESourceContactsPref;
-     FindEntryAndDeleteL(lookupItem);
+        lookupItem.iSource = ESourceContactsPref;
+        iMaptileDatabase->DeleteEntryL(lookupItem);
 
-     lookupItem.iSource = ESourceContactsWork;
-     FindEntryAndDeleteL(lookupItem);
+        lookupItem.iSource = ESourceContactsWork;
+        iMaptileDatabase->DeleteEntryL(lookupItem);
 
-     lookupItem.iSource = ESourceContactsHome;
-     FindEntryAndDeleteL(lookupItem);
-     }*/
+        lookupItem.iSource = ESourceContactsHome;
+        iMaptileDatabase->DeleteEntryL(lookupItem);
+
+        MYLOCLOGSTRING("EContactDbObserverEventContactDeleted ");
+        return;
+     }
 
     //Get the contact item
     iEventType = aEvent.iType;
@@ -709,26 +719,7 @@
         }
         // }
         break;
-    }
-    case EContactDbObserverEventContactDeleted:
-    {
-
-        lookupItem.iSource = ESourceContactsPref;
-        iMaptileDatabase->DeleteEntryL(lookupItem);
-
-        lookupItem.iSource = ESourceContactsWork;
-        iMaptileDatabase->DeleteEntryL(lookupItem);
-
-        lookupItem.iSource = ESourceContactsHome;
-        iMaptileDatabase->DeleteEntryL(lookupItem);
-
-        MYLOCLOGSTRING("EContactDbObserverEventContactDeleted ");
-        /*             // the contact is deleted, so delete the corresponding entries from database.
-         TLookupItem lookupItem;
-         lookupItem.iUid = aEvent.iContactId;
-         iMaptileDatabase->DeleteEntryL(lookupItem);*/
-        break;
-    }
+    }    
     case EContactDbObserverEventContactAdded:
     {
         MYLOCLOGSTRING("EContactDbObserverEventContactAdded" );
@@ -850,7 +841,7 @@
 TInt CMyLocationsEngine::RequestExecute( CMapTileRequest* aMapTileRequest)
 {
     __TRACE_CALLSTACK;
-    TInt errorCode;
+    TInt errorCode = KErrNone;
     switch (aMapTileRequest->iAddressType)
     {
         case ESourceCalendar:
@@ -867,6 +858,8 @@
                             aMapTileRequest->iImagePath, this));            
             break;
         }
+        default:
+            break;
     };  
 
     return errorCode;
@@ -1050,19 +1043,6 @@
 
                     TRAP_IGNORE( landmark->SetLandmarkNameL( sName1 ) );
 
-                    if (aAddressType == EAddressPref) // default/prefered address
-                    {
-                        TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactPrefered) );
-                    }
-                    else if (aAddressType == EAddressWork) // work address
-                    {
-                        TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactWork) );
-                    }
-                    else // home address
-                    {
-                        TRAP_IGNORE( landmark->SetLandmarkDescriptionL(KContactHome) );
-                    }
-
                     // Set the street
                     TInt adrId = FindContactsField(aContactItem, aAddressType,
                             KUidContactFieldVCardMapADR);
@@ -1184,6 +1164,23 @@
 
     switch (aSrcType)
     {
+    // if source type is calendar
+    case ESourceCalendar:
+    {
+        switch( aChangeType )
+            {
+            case EChangeAdd:
+                retVal = EEntryAdded;
+                break;
+            case EChangeDelete:
+                retVal =  EEntryDeleted;
+                break;
+            case EChangeModify:
+                retVal =  EEntryModified;
+                break;
+            }
+        break;
+    }
     // if source type is contacts
     case ESourceContactsPref:
     case ESourceContactsWork:
@@ -1236,16 +1233,6 @@
 }
 
 // -----------------------------------------------------------------------------
-// CMyLocationsEngine::MyLocationsDbManager()
-// Gets handle to mylocations database manager.
-// -----------------------------------------------------------------------------
-//
-CMyLocationsDatabaseManager& CMyLocationsEngine::MyLocationsDbManager()
-{
-    __TRACE_CALLSTACK;
-    return *iMyLocationsDatabaseManager;
-}
-// -----------------------------------------------------------------------------
 // CMyLocationsEngine::RunL()
 // Handles active object's request completion event.
 // -----------------------------------------------------------------------------
@@ -1255,70 +1242,37 @@
     __TRACE_CALLSTACK;
     switch (iLmEvent.iEventType)
     {
-    case EPosLmEventLandmarkCreated:
-    case EPosLmEventLandmarkUpdated:
-    {
-        TBuf<KMaxAddressLength> lmAddress;
-        CPosLandmark* readLandmark = iLandmarkDb->ReadLandmarkLC(
-                iLmEvent.iLandmarkItemId);
-
-        if (readLandmark)
+        case EPosLmEventLandmarkCreated:
+        case EPosLmEventLandmarkUpdated:
         {
-            iMyLocationsDatabaseManager->GetLandmarkFullAddress(lmAddress,
-                    readLandmark);
-
-            CPosLandmark* landmark = CPosLandmark::NewL();
-            CleanupStack::PushL(landmark);
-
-            TRAP_IGNORE( landmark->SetLandmarkNameL( lmAddress ));
-
-            TPtrC iconFileName;
-            TInt iconIndex;
-            TInt iconMaskIndex;
-            TInt err = readLandmark->GetIcon(iconFileName, iconIndex,
-                    iconMaskIndex);
-
-            if (err == KErrNone)
-            {
-                TRAP_IGNORE( landmark->SetIconL(
-                                iconFileName, iconIndex, iconMaskIndex ) );
+            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);
             }
-
-            // update the entry in mylocations database.
-            iMyLocationsDatabaseManager->UpdateDatabaseL(landmark,
-                    iLmEvent.iLandmarkItemId, ESourceLandmarks, MapChangeType(
-                            ESourceLandmarks, iLmEvent.iEventType));
-
-            CleanupStack::PopAndDestroy(landmark);
-            CleanupStack::PopAndDestroy(readLandmark);
         }
-    }
         break;
-    case EPosLmEventLandmarkDeleted:
-    {
-        // delete the corresponding entries in mylocations database.
-        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
-                iLmEvent.iLandmarkItemId, ESourceLandmarks, EEntryDeleted);
-    }
+        case EPosLmEventLandmarkDeleted:
+        {
+            // delete the corresponding entries in mylocations database.
+            UpdateDatabaseL(NULL,
+                    iLmEvent.iLandmarkItemId, ESourceLandmarks, EEntryDeleted);
+        }
         break;
 
-    case EPosLmEventCategoryCreated:
-    {
-        // delete the corresponding entries in mylocations database.
-        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
-                iLmEvent.iLandmarkItemId, ESourceLandmarksCategory,
-                MapChangeType(ESourceLandmarksCategory, iLmEvent.iEventType));
-    }
-        break;
-
-
     }
 
     // start the change notifier again;
     StartLandmarksChangeNotifier();
 
 }
-
 // -----------------------------------------------------------------------------
 // CMyLocationsEngine::DoCancel()
 // Implements cancellation of an outstanding request.
@@ -1331,17 +1285,6 @@
 }
 
 // -----------------------------------------------------------------------------
-// CMyLocationsEngine::RunError()
-// Implements cancellation of an outstanding request.
-// -----------------------------------------------------------------------------
-//
-TInt CMyLocationsEngine::RunError(TInt /*aError*/)
-{
-    __TRACE_CALLSTACK;
-    return KErrNone;
-}
-
-// -----------------------------------------------------------------------------
 // CMyLocationsEngine::MapTilefetchingCompleted()
 // Handles the maptile fetching completion event and updates the maptile lookup db.
 // -----------------------------------------------------------------------------
@@ -1425,6 +1368,8 @@
         iMaptileDatabase->CreateEntryL(aLookupItem);
 
     }
+    iMyLocationsDatabaseManager->UpdateMapTilePath( aLookupItem.iUid, aLookupItem.iSource, 
+                                            aLookupItem.iFilePath );    
 }
 
 // -----------------------------------------------------------------------------
@@ -1442,21 +1387,29 @@
     {
         switch (iMapTileRequestQueue[0]->iAddressType)
         {
-            /*//TODO:
-            case ESourceCalendar:
-            {
-                break;
-            }*/
-            case ESourceContactsPref:
-            case ESourceContactsWork:
-            case ESourceContactsHome:
-            {
-                GeocodeUpdate::UpDate(iMapTileRequestQueue[0]->iUId,
-                        iMapTileRequestQueue[0]->iAddressType, aLatitude,
-                        aLongitude);
-                MYLOCLOGSTRING("Geo code updated into contact db");
-                break;
-            }
+        //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");                     
+            break;
+        }
+        case ESourceContactsPref:
+        case ESourceContactsWork:
+        case ESourceContactsHome:
+        {
+            GeocodeUpdate::updateGeocodeToContactDB(
+                    iMapTileRequestQueue[0]->iUId,
+                    iMapTileRequestQueue[0]->iAddressType, aLatitude,
+                    aLongitude);
+            MYLOCLOGSTRING("Geo-codinate updated to contact db");
+            break;
+        }
         };
 
         
@@ -1464,4 +1417,23 @@
 
 }
 
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::UpdateDatabaseL()
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid, 
+        const TUint32 aSourceType, const TEntryChangeType aChangeType )
+{
+    __TRACE_CALLSTACK;
+    Cancel();
+    iMyLocationsDatabaseManager->UpdateDatabaseL( aLandmark, aUid, 
+        aSourceType, aChangeType );
+    if( aSourceType != ESourceLandmarks )
+    {
+        StartLandmarksChangeNotifier();
+    }
+    
+}
+
 //End of file
+
--- a/locationdataharvester/mylocationsengine/src/mylocationslookupdb.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/mylocationslookupdb.cpp	Fri May 14 15:47:27 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <BAUTILS.H>
+#include <bautils.h>
 #include <EPos_CPosLmCategoryManager.h>
 #include "mylocationslookupdb.h"
 #include "mylocationlogger.h"
--- a/locationdataharvester/rom/mylocations.iby	Mon May 03 12:27:22 2010 +0300
+++ b/locationdataharvester/rom/mylocations.iby	Fri May 14 15:47:27 2010 +0300
@@ -11,18 +11,18 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: mylocations iby file
 *
 */
 
 
-
 #ifndef __Mylocations_IBY__
 #define __Mylocations_IBY__
 
 file=ABI_DIR\BUILD_DIR\mylocationsengine.exe PROGRAMS_DIR\mylocationsengine.exe
 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
 
 //Resource file(s) for Mylocations application (mylocations.iby)
 data=DATAZ_\APP_RESOURCE_DIR\mylocations.rsc APP_RESOURCE_DIR\mylocations.rsc
--- a/locationpickerservice/inc/locationpickerappwindow.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerappwindow.h	Fri May 14 15:47:27 2010 +0300
@@ -28,6 +28,7 @@
 class LocationPickerService;
 class LocationPickerProxyModel;
 class LocationPickerLandscapeView;
+class LocationPickerContent;
 
 class LocationPickerAppWindow: public HbMainWindow
 {
@@ -58,15 +59,17 @@
     //activate locationpicker view
     void activateLocationPickerView();
     //changes the orientation
-    void changeOrientation(Qt::Orientation);
+    void changeOrientation( Qt::Orientation );
     //complete the service
     void serviceComplete();
     //sets the category ID during orientation change in collection content
-    void setCategoryID( quint32 acategoryId );
+    void setCategoryId( quint32 acategoryId );
     //handles orientation change in collection list
     void handleCollectionList();
     //handle all List
     void allListHandle();
+    //clear content models
+    void clearContentModels();
 private:
     // search view
     LocationPickerSearchView* mLocationPickerSearchView;
@@ -76,6 +79,8 @@
     LocationPickerPotraitView* mLocationPickerPotraitView;
     //location picker landscape view
     LocationPickerLandscapeView* mLocationPickerLandscapeView;
+	//locationpicker content
+    LocationPickerContent* mLocationPickerContent;
     //location picker service;
     LocationPickerService *mService;
     //View Type
--- a/locationpickerservice/inc/locationpickercollectioncontent.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickercollectioncontent.h	Fri May 14 15:47:27 2010 +0300
@@ -34,14 +34,18 @@
     ~LocationPickerCollectionContent();
     //get proxy model
     LocationPickerProxyModel* getProxyModel();
-    //get LocationPickerDataManager
-    LocationPickerDataManager* getDataManager();
-
+    //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;
+    bool mLocationFound;
 };
 
 #endif // LOCATIONPICKERCOLLECTIONCONTENT_H
--- a/locationpickerservice/inc/locationpickercollectionlistcontent.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickercollectionlistcontent.h	Fri May 14 15:47:27 2010 +0300
@@ -35,8 +35,8 @@
     ~LocationPickerCollectionListContent();
     //get standard model
     QStandardItemModel* getStandardModel();
-    //get LocationPickerDataManager
-    LocationPickerDataManager* getDataManager();
+    // gets the data pointed to by index and copies to the aValue
+    void getData( QModelIndex aIndex, quint32& aValue );
 
 private:
     Qt::Orientation mOrientation;
--- a/locationpickerservice/inc/locationpickercontent.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickercontent.h	Fri May 14 15:47:27 2010 +0300
@@ -34,33 +34,26 @@
 public:
 
     // contructor
-    LocationPickerContent(Qt::Orientation aOrientation );
+    LocationPickerContent();
 
     // destructor
     ~LocationPickerContent();
     
-    // locationsNotFound
-    bool locationsFound();
-    
-    //get proxy model
-    LocationPickerProxyModel* getListProxyModel();
+    //get standard List Model
+    QStandardItemModel* getStandardListModel();
     
-    //get standard Model
-    QStandardItemModel* getStandardModel();
+    //get standard Grid Model
+    QStandardItemModel* getStandardGridModel();
     
-    //get data manager
-    LocationPickerDataManager* getDataManager();
+    void createNoEntryDisplay( QStandardItemModel *aModel );
     
-    //get hbgridview proxy model
-    LocationPickerProxyModel* getGridProxyModel();
+    bool populateModel( Qt::Orientation aOrientation );
 
 private:
     Qt::Orientations mOrientation;
-    LocationPickerProxyModel *mListProxyModel;
-    LocationPickerProxyModel *mProxyGridModel;
     LocationPickerDataManager *mDataManager;
-    QStandardItemModel *mModel;
-    bool mLocationsFound;
+    QStandardItemModel *mListModel;
+    QStandardItemModel *mGridModel;
     
 };
 
--- a/locationpickerservice/inc/locationpickerdatamanager.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdatamanager.h	Fri May 14 15:47:27 2010 +0300
@@ -30,18 +30,17 @@
 class LocationPickerDataManager
 {
 public:
+    static LocationPickerDataManager* getInstance();
+private:
     // constructors
     LocationPickerDataManager();
-    LocationPickerDataManager( QStandardItemModel &aModel, TViewType aViewType );
 
     // destructor
     ~LocationPickerDataManager();
-
+public:
     // populates the model with data
-    bool populateModel(Qt::Orientations aOrientation,quint32 aCollectionId = 0);
-
-    // gets the data pointed to by index and copies to the aValue
-    void getData(int index, quint32& aValue );
+    bool populateModel( QStandardItemModel &aModel, TViewType aViewType, 
+            Qt::Orientations aOrientation,quint32 aCollectionId = 0);
 
     // gets the location item
     void getLocationItem( quint32 aLmId, QLocationPickerItem &aItem );
--- a/locationpickerservice/inc/locationpickerdatamanager_p.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdatamanager_p.h	Fri May 14 15:47:27 2010 +0300
@@ -22,10 +22,8 @@
 #include "locationpickertypes.h"
 #include "qlocationpickeritem.h"
 
-class CPosLmItemIterator;
-class CPosLandmarkDatabase;
-class CPosLmCategoryManager;
-class CPosLandmarkSearch;
+class LocationDataLookupDb;
+class QLookupItem;
 
 /**  Class used for managing the data of model
  *
@@ -33,40 +31,30 @@
 class LocationPickerDataManagerPrivate
 {
 public:
-    // constructors
+    // constructor
     LocationPickerDataManagerPrivate();
-    LocationPickerDataManagerPrivate( QStandardItemModel &aModel, TViewType aViewType );
     
     // destructor
     ~LocationPickerDataManagerPrivate();
     
     // populates the model with data
-    bool populateModel( const Qt::Orientations aOrientation, quint32 aCollectionId = 0 );
-    
-    // gets the data pointed to by index and copies to the aValue
-    void getData(int index, quint32& aValue );
+    bool populateModel( QStandardItemModel &aModel, TViewType aViewType, 
+            const Qt::Orientations aOrientation, quint32 aCollectionId = 0 );
     
     // gets the location item
     void getLocationItem( quint32 aLmId, QLocationPickerItem &aItem );
 
 private:
-    // populates model
-    bool populateModelL( quint32 aCollectionId );
     // populates landmarks
-    void populateLandmarksL();
+    bool populateLandmarks( QList<QLookupItem> &aItemArray );
     // populates collections
-    void populateCollectionsL();
-    // gets the location item
-    void getLocationItemL( quint32 aLmId, QLocationPickerItem &aItem );
+    void populateCollections();
 
 private:
     Qt::Orientations mOrientation;
     QStandardItemModel *mModel;
     TViewType mViewType;
-    CPosLmItemIterator* mIterator;
-    CPosLandmarkDatabase* mLandmarkDb;
-    CPosLmCategoryManager *mLmCategoryManager;
-    CPosLandmarkSearch *mLandmarkSearch;
+    LocationDataLookupDb *mDb; 
     quint32 mCategoryId;
 };
 
--- a/locationpickerservice/inc/locationpickerdocumentloader.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdocumentloader.h	Fri May 14 15:47:27 2010 +0300
@@ -18,7 +18,7 @@
 #ifndef LOCATIONPICKERDOCUMENTLOADER_H_
 #define LOCATIONPICKERDOCUMENTLOADER_H_
 
-#include <hbDocumentLoader>
+#include <HbDocumentLoader>
 
 class LocationPickerDocumentLoader : public HbDocumentLoader
 {
@@ -40,7 +40,7 @@
     /**
      * from base class
      */
-    QObject *createObject(const QString& type, const QString &name);
+    QObject *createObject( const QString& type, const QString &name );
 };
 
 #endif /* LOCATIONPICKERDOCUMENTLOADER_H_ */
--- a/locationpickerservice/inc/locationpickerlandscapeview.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerlandscapeview.h	Fri May 14 15:47:27 2010 +0300
@@ -20,7 +20,7 @@
 
 
 
-#include <hbview>
+#include <HbView>
 #include <hbdocumentloader.h>
 #include "locationpickertypes.h"
 
@@ -28,9 +28,8 @@
 class HbListView;
 class QStandardItemModel;
 class LocationPickerProxyModel;
-class LocationPickerContent;
-class LocationPickerCollectionListContent;
 class LocationPickerCollectionContent;
+class LocatipnPickerProxyModel;
 class HbGridViewItem;
 class HbGridView;
 class HbAction;
@@ -44,15 +43,12 @@
     Q_OBJECT
 public:
     // constructor
-    LocationPickerLandscapeView(HbDocumentLoader* aLoader);
+    LocationPickerLandscapeView( HbDocumentLoader* aLoader );
     // destructor
     ~LocationPickerLandscapeView();
-private:
-    //disable the tabs
-    void disableTabs();
 public:
     //get the items from docml and connect to respective slots
-    void init(Qt::Orientation aOrientation );
+    void init( Qt::Orientation aOrientation, QStandardItemModel *aModel );
     //Set the appropriate model on grid view
     void manageGridView();
     //Create collection list and sets to list view
@@ -62,10 +58,12 @@
     //Get the view type
     TViewType getViewType();
     //set the view type
-    void setViewType(TViewType aViewType);
+    void setViewType( TViewType aViewType );
+    //clear collection content
+    void clearContentModel();
 private slots:
     //slot to handle list item actions     
-    void handleActivated(const QModelIndex &aIndex);
+    void handleActivated( const QModelIndex &aIndex );
     //slots to handle menu action items     
     void sortDescending();
     void sortAscending();
@@ -82,14 +80,14 @@
     void handleCollectionList();
     void selectItem( quint32 aLm );
     void completeService();
-    void sendCategoryID(  quint32 acategoryId  );
+    void sendCategoryID( quint32 acategoryId );
+    void collectionContentExited();
 private:
     //document loader
     HbDocumentLoader* mDocumentLoader;
-    // all view
-    LocationPickerContent* mLocationPickerContent;
-    // collection list content
-    LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
+    //locationPickerProxyModel
+    LocationPickerProxyModel *mProxyModel;
+    QStandardItemModel *mModel;
     //actions
     HbAction *mAllAction;
     HbAction *mCollectionAction;
--- a/locationpickerservice/inc/locationpickerpotraitview.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerpotraitview.h	Fri May 14 15:47:27 2010 +0300
@@ -19,7 +19,7 @@
 #define LOCATIONPICKERPOTRAITVIEW_H
 
 
-#include <hbview>
+#include <HbView>
 #include <hbdocumentloader.h>
 #include "locationpickertypes.h"
 
@@ -27,7 +27,6 @@
 class HbListView;
 class QStandardItemModel;
 class LocationPickerProxyModel;
-class LocationPickerContent;
 class LocationPickerCollectionListContent;
 class LocationPickerCollectionContent;
 class HbListViewItem;
@@ -41,15 +40,14 @@
     Q_OBJECT
 public:
     // constructor
-    LocationPickerPotraitView(HbDocumentLoader* aLoader);
+    LocationPickerPotraitView( HbDocumentLoader* aLoader );
     // destructor
     ~LocationPickerPotraitView();
-private:
+public:
     //disable the tabs
-    void disableTabs();
-public:
+    void disableTabs( QStandardItemModel *aModel );
     //get the items from docml and connect to respective slots
-    void init(Qt::Orientation aOrientation );
+    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
@@ -59,10 +57,12 @@
     //Get the view type
     TViewType getViewType();
     //set the view type
-    void setViewType(TViewType aViewType);
+    void setViewType( TViewType aViewType );
+    //clear collection Model
+    void clearContentModel();
 private slots:
     //slot to handle list item actions     
-    void handleActivated(const QModelIndex &aIndex);
+    void handleActivated( const QModelIndex &aIndex );
     //slots to handle menu action items     
     void sortDescending();
     void sortAscending();
@@ -80,13 +80,16 @@
     void completeService();
     void sendCategoryID( quint32 aCategoryId );
     void handleAllList();
+    void collectionContentExited();
 private:
     //document loader
     HbDocumentLoader* mDocumentLoader;
-    // all view
-    LocationPickerContent* mLocationPickerContent;
     // collection list content
     LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
+    //locationPickerProxyModel
+    LocationPickerProxyModel *mProxyModel;
+	//standard model
+    QStandardItemModel *mModel;
     //actions
     HbAction *mAllAction;
     HbAction *mCollectionAction;
--- a/locationpickerservice/inc/locationpickerproxymodel.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickerproxymodel.h	Fri May 14 15:47:27 2010 +0300
@@ -31,16 +31,16 @@
 
 public:
     // constructor
-    LocationPickerProxyModel(Qt::Orientations aOrientation , QObject *parent = 0);
+    LocationPickerProxyModel( Qt::Orientations aOrientation , QObject *parent = 0 );
 
     // used to
-    void filterParameterChanged(QString aSearchText);
+    void filterParameterChanged( QString aSearchText );
 
 protected:
     // override QSortFilterProxyModel function  to define logic for filter
-    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
+    bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const;
     // override QSortFilterProxyModel function  to define logic for sort
-    bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
+    bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
 
 private:
     // search string
--- a/locationpickerservice/inc/locationpickersearchview.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickersearchview.h	Fri May 14 15:47:27 2010 +0300
@@ -38,14 +38,16 @@
     Q_OBJECT
 public:
     // constructor
-    LocationPickerSearchView(HbDocumentLoader &aLoader);
+    LocationPickerSearchView( HbDocumentLoader &aLoader );
     // destructor
     ~LocationPickerSearchView();
     //initialize the action items and connect to slots
-    void init();
+    void init( QStandardItemModel *aModel );
+private:
+    void getData( QModelIndex aIndex, quint32& aValue );
 private slots:
     // slot to perform search
-    void doSearch(QString aCriteria);
+    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
@@ -64,8 +66,6 @@
     HbListView  *mListView;
     // search panel
     HbSearchPanel *mSearchPanel;
-    // handle to data manager to populate model
-    LocationPickerDataManager *mDataManager;
     //TextItem
     HbTextItem* mEmptyLabel;
     //Graphicslayout
--- a/locationpickerservice/inc/locationpickertypes.h	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/inc/locationpickertypes.h	Fri May 14 15:47:27 2010 +0300
@@ -19,6 +19,7 @@
 #define LOCATIONPICKERTYPES_H
 
 #include <hbglobal.h>
+#include <locationservicedefines.h>
 
 // separator
 const QString KSeparator(",");
@@ -34,9 +35,12 @@
 //Contacts collection icon
 const QString KCollectionsContacts("qtg_small_contacts");
 
-//Contacts collection icon
+//Calendar collection icon
 const QString KCollectionsCalendar("qtg_small_calendar");
 
+//Places collection icon
+const QString KCollectionsPlaces("qtg_small_favorite");
+
 //Contacts type prefered icon
 const QString KContactPrefIcon("qtg_mono_favourites");
 //Contacts type home icon
@@ -44,13 +48,6 @@
 //Contacts type work icon
 const QString KContactWorkIcon("qtg_mono_work");
 
-
-// strings used to differentiate the contact address type
-const QString KContactHome("Contact Home");
-const QString KContactWork("Contact Work");
-const QString KContactsString("Others");
-
-
 /** 
  * Defines view type in location picker
 */
--- a/locationpickerservice/locationpickerservice.pro	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/locationpickerservice.pro	Fri May 14 15:47:27 2010 +0300
@@ -35,15 +35,13 @@
     TARGET.CAPABILITY = ALL \
         -TCB
     
-    LIBS += -llbs \
-        -leposlandmarks \
-        -leposlmsearchlib
 }
 
 # ##### qthighway
 CONFIG += service
 LIBS += -lxqservice \
-    -lxqserviceutil 
+    -lxqserviceutil \
+    -llocationdatalookupdb
 SERVICE.FILE = service_conf.xml
 SERVICE.OPTIONS = embeddable
 SERVICE.OPTIONS += hidden
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/locationpickerlandscape.docml	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,60 @@
+<?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>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/locationpickerpotrait.docml	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,57 @@
+<?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/locationpickersearchview.docml	Fri May 14 15:47:27 2010 +0300
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+    <widget name="LocationPickerSearchView" type="HbView">
+        <widget name="locationPickerSearchView" role="HbView:widget" type="HbWidget">
+            <widget name="container" type="HbWidget">
+                <widget name="SearchListView" type="HbListView">
+                    <widget name="listItemPrototype" role="HbListView:prototype" type="HbListViewItem">
+                        <string name="state" value="normal"/>
+                    </widget>
+                    <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
+                </widget>
+                <widget name="searchPanel" type="HbSearchPanel"/>
+                <real name="z" value="1"/>
+                <sizehint height="23.8806un" type="PREFERRED" width="11.9403un"/>
+                <layout orientation="Vertical" type="linear">
+                    <linearitem itemname="SearchListView"/>
+                    <linearitem itemname="searchPanel"/>
+                </layout>
+            </widget>
+            <layout type="anchor">
+                <anchoritem dst="container" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="container" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="container" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+                <anchoritem dst="container" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+            </layout>
+        </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="SearchListView" section="#common" value="0"/>
+    </metadata>
+</hbdocument>
--- a/locationpickerservice/src/locationpickerappwindow.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerappwindow.cpp	Fri May 14 15:47:27 2010 +0300
@@ -25,21 +25,25 @@
 #include "locationpickerdatamanager.h"
 #include "locationpickerdocumentloader.h"
 #include "locationpickerlandscapeview.h"
+#include "locationpickercontent.h"
 
 // ----------------------------------------------------------------------------
 // LocationPickerAppWindow::LocationPickerAppWindow()
 // ----------------------------------------------------------------------------
-LocationPickerAppWindow::LocationPickerAppWindow(QWidget *parent, Hb::WindowFlags windowFlags)
+LocationPickerAppWindow::LocationPickerAppWindow( QWidget *parent, Hb::WindowFlags windowFlags )
 	:HbMainWindow(parent, windowFlags),
 	mLocationPickerSearchView(NULL),
     mLocationPickerDocumentLoader(NULL),
 	mLocationPickerPotraitView(NULL),
 	mLocationPickerLandscapeView(NULL),
+	mLocationPickerContent(NULL),
     mService(NULL),
 	mviewType(ELocationPickerContent)
 {
     // create the service object;
     mService = new LocationPickerService(this);
+    mLocationPickerContent = new LocationPickerContent();
+    
     //create document loader object
     mLocationPickerDocumentLoader = new LocationPickerDocumentLoader();
    
@@ -51,28 +55,39 @@
     QGraphicsWidget *locationPickerWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerPotraitView");
     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(Qt::Vertical);
+    mLocationPickerPotraitView->init(populated, Qt::Vertical, mLocationPickerContent->getStandardListModel());
     connectPotraitSlots();
-    addView( mLocationPickerPotraitView );
+    if(!populated)
+    {
+        mLocationPickerPotraitView->disableTabs(mLocationPickerContent->getStandardListModel());
+        addView( mLocationPickerPotraitView );
+        setCurrentView(mLocationPickerPotraitView);
+    }
+    else
+    {
+        addView( mLocationPickerPotraitView );
 
-    mLocationPickerDocumentLoader->reset();
+        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);
-    //initialize widgets and connect to respective signals 
-    mLocationPickerLandscapeView->init(Qt::Horizontal);
-    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());
+        //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());
+    }
 }
 
 // ----------------------------------------------------------------------------
@@ -85,6 +100,7 @@
     delete mLocationPickerDocumentLoader;
     delete mLocationPickerPotraitView;
     delete mLocationPickerLandscapeView;
+    delete mLocationPickerContent;
 }
 
 // ----------------------------------------------------------------------------
@@ -93,8 +109,7 @@
 void LocationPickerAppWindow::itemSelected( quint32 aLmid )
 {
     QLocationPickerItem item;
-    LocationPickerDataManager dataManager;
-    dataManager.getLocationItem(aLmid, item);
+    LocationPickerDataManager::getInstance()->getLocationItem(aLmid, item);
     // complete the request
     mService->complete(item);
 }
@@ -124,7 +139,7 @@
         Q_ASSERT_X((mLocationPickerSearchView != 0), "mLocationPickerSearchView", 
             "qobject cast failure");
         //initialize the action items and connect to slots
-        mLocationPickerSearchView->init();
+        mLocationPickerSearchView->init(mLocationPickerContent->getStandardListModel());
         connect(mLocationPickerSearchView,SIGNAL(switchView()),this,SLOT(activateLocationPickerView()));
         connect(mLocationPickerSearchView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
         addView(mLocationPickerSearchView);
@@ -132,6 +147,7 @@
     //set LocationPickerSearchview as current view
     setCurrentView(mLocationPickerSearchView);
     mviewType = ELocationPickerSearchView;
+
 }
 
 // ----------------------------------------------------------------------------
@@ -158,7 +174,7 @@
 // ----------------------------------------------------------------------------
 // LocationPickerAppWindow::changeOrientation()
 // ----------------------------------------------------------------------------
-void LocationPickerAppWindow::changeOrientation(Qt::Orientation)
+void LocationPickerAppWindow::changeOrientation( Qt::Orientation )
 {   
     //check the orientation and load view accordingly 
     if( orientation() == (Qt::Horizontal ))
@@ -214,8 +230,9 @@
      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(sendCategoryID( quint32 )),this,SLOT(setCategoryId( quint32 )));
      connect(mLocationPickerPotraitView,SIGNAL(handleAllList()),this,SLOT(allListHandle()));
+    connect(mLocationPickerPotraitView,SIGNAL(collectionContentExited()),this,SLOT(clearContentModels()));
 }
 
 // ----------------------------------------------------------------------------
@@ -226,14 +243,15 @@
     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(sendCategoryID( quint32 )),this,SLOT(setCategoryId( quint32 )));
     connect(mLocationPickerLandscapeView,SIGNAL(handleCollectionList()),this,SLOT(handleCollectionList()));
+    connect(mLocationPickerLandscapeView,SIGNAL(collectionContentExited()),this,SLOT(clearContentModels()));
 }
 
 // ----------------------------------------------------------------------------
-// LocationPickerAppWindow::setCategoryID()
+// LocationPickerAppWindow::setCategoryId()
 // ----------------------------------------------------------------------------
-void LocationPickerAppWindow::setCategoryID( quint32 acategoryId )
+void LocationPickerAppWindow::setCategoryId( quint32 acategoryId )
 {
     //set the same category id to both views
     mLocationPickerPotraitView->setCategoryID(acategoryId);
@@ -275,4 +293,13 @@
     setCurrentView(mLocationPickerLandscapeView);
 }
 
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::clearContentModels()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::clearContentModels()
+{
+    mLocationPickerLandscapeView->clearContentModel();
+    mLocationPickerPotraitView->clearContentModel();
+}
+
 Q_IMPLEMENT_USER_METATYPE(QLocationPickerItem)
--- a/locationpickerservice/src/locationpickercollectioncontent.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickercollectioncontent.cpp	Fri May 14 15:47:27 2010 +0300
@@ -31,12 +31,14 @@
     :mOrientation(aOrientation),
 	 mProxyModel(NULL),
     mModel(NULL),
-    mDataManager(NULL)
+    mDataManager(NULL),
+	mLocationFound(false)
 {
     // Create a standard model for the view list
     mModel = new QStandardItemModel( this );
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionContent );
-    if( mDataManager->populateModel( mOrientation , aCollectionId ) )
+    // create data manager to manage data in the model
+    mDataManager = LocationPickerDataManager::getInstance();
+    if( mDataManager->populateModel( *mModel, ELocationPickerCollectionContent, mOrientation , aCollectionId ) )
     {
         // Create the proxy model.
         mProxyModel = new LocationPickerProxyModel(mOrientation);
@@ -46,6 +48,7 @@
         mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
         // sort
         mProxyModel->sort(0, Qt::AscendingOrder);
+        mLocationFound = true;
     }
     else
     {
@@ -53,6 +56,7 @@
         QStandardItem *modelItem = new QStandardItem();
         modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
         mModel->appendRow( modelItem );
+        mLocationFound = false;
      }
 }
 
@@ -63,22 +67,39 @@
 {
     delete mProxyModel;
     delete mModel;
-    delete mDataManager;
 }
 
 // ----------------------------------------------------------------
 // LocationPickerCollectionContent::getProxyModel
 // -----------------------------------------------------------------
 LocationPickerProxyModel* LocationPickerCollectionContent::getProxyModel()
-    {
+{
     return mProxyModel;
-    }
-
+}
 
 // ----------------------------------------------------------------
-// LocationPickerCollectionContent::getDataManager
+// LocationPickerCollectionContent::getStandardModel
 // -----------------------------------------------------------------
-LocationPickerDataManager* LocationPickerCollectionContent::getDataManager()
-    {
-    return mDataManager;
-    }
+QStandardItemModel* LocationPickerCollectionContent::getStandardModel()
+{
+    return mModel;
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerCollectionContent::getData()
+// ----------------------------------------------------------------------------
+
+void LocationPickerCollectionContent::getData( QModelIndex aIndex, quint32& aValue )
+{
+    QStandardItem* item = mModel->item( aIndex.row(), aIndex.column() );
+    QVariant var = item->data( Qt::UserRole );
+    aValue = var.toUInt();
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerCollectionContent::locationFound()
+// ----------------------------------------------------------------------------
+bool LocationPickerCollectionContent::locationFound()
+{
+    return mLocationFound;
+}
--- a/locationpickerservice/src/locationpickercollectionlistcontent.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickercollectionlistcontent.cpp	Fri May 14 15:47:27 2010 +0300
@@ -25,16 +25,16 @@
 // ----------------------------------------------------------------------
 // LocationPickerCollectionListContent::LocationPickerCollectionListContent()
 // ----------------------------------------------------------------------
-LocationPickerCollectionListContent::LocationPickerCollectionListContent(Qt::Orientation aOrientation )
+LocationPickerCollectionListContent::LocationPickerCollectionListContent( Qt::Orientation aOrientation )
     :mOrientation(aOrientation),
     mModel(NULL),
     mDataManager(NULL)
 {
     // Create a standard model for the view list
     mModel = new QStandardItemModel( this );
-    
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionListContent );
-    mDataManager->populateModel( mOrientation );
+    // create data manager to manage data in the model
+    mDataManager = LocationPickerDataManager::getInstance();
+    mDataManager->populateModel( *mModel, ELocationPickerCollectionListContent, mOrientation );
 }
 
 // ----------------------------------------------------------------------
@@ -42,8 +42,6 @@
 // ----------------------------------------------------------------------
 LocationPickerCollectionListContent::~LocationPickerCollectionListContent()
 {
-    if( mDataManager )
-        delete mDataManager;
     delete mModel;
 }
 
@@ -55,11 +53,13 @@
     return mModel;
     }
 
-// ----------------------------------------------------------------
-// LocationPickerCollectionListContent::getDataManager
-// -----------------------------------------------------------------
-LocationPickerDataManager* LocationPickerCollectionListContent::getDataManager()
-    {
-    return mDataManager;
-    }
+// ----------------------------------------------------------------------------
+// LocationPickerCollectionListContent::getData()
+// ----------------------------------------------------------------------------
 
+void LocationPickerCollectionListContent::getData( QModelIndex aIndex, quint32& aValue )
+{
+    QStandardItem* item = mModel->item( aIndex.row(), aIndex.column() );
+    QVariant var = item->data( Qt::UserRole );
+    aValue = var.toUInt();
+}
--- a/locationpickerservice/src/locationpickercontent.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickercontent.cpp	Fri May 14 15:47:27 2010 +0300
@@ -27,69 +27,52 @@
 // -----------------------------------------------------------------------------
 // LocationPickerContent::LocationPickerContent()
 // -----------------------------------------------------------------------------
-LocationPickerContent::LocationPickerContent( Qt::Orientation aOrientation )
-	:mOrientation(aOrientation),
-	mListProxyModel(NULL),
-	mProxyGridModel(NULL),
-    mDataManager(NULL),
-	mModel(NULL),
-	mLocationsFound(true)
+LocationPickerContent::LocationPickerContent()
+	:mDataManager(NULL),
+	mListModel(NULL),
+	mGridModel(NULL)
 {
-    // Create a standard model for the list view
-    mModel = new QStandardItemModel( this );
     // create data manager to manage data in the model
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerContent );
-    if(mOrientation == Qt::Vertical)
+    mDataManager = LocationPickerDataManager::getInstance();
+
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::populateModel()
+// -----------------------------------------------------------------------------
+bool LocationPickerContent::populateModel( Qt::Orientation aOrientation )
+{
+    bool locationsFound;
+    if(aOrientation == Qt::Vertical)
     {
-        if( mDataManager->populateModel(mOrientation) )
+        // Create a standard model for the list view
+        mListModel = new QStandardItemModel( this );
+        if( mDataManager->populateModel( *mListModel, ELocationPickerContent, aOrientation) )
         {
-            // Create the proxy model and set source model
-            mListProxyModel = new LocationPickerProxyModel( mOrientation, this );
-            mListProxyModel->setSourceModel(mModel);
-            // set sort properties
-            mListProxyModel->setDynamicSortFilter(TRUE);
-            mListProxyModel->setSortRole(Qt::DisplayRole);
-            mListProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
-
-            // sort in ascending order
-            mListProxyModel->sort(0, Qt::AscendingOrder);    
-            mLocationsFound = true;
+            locationsFound = true;
         }
         else
         {
-            // no locations to display.
-            QStandardItem *modelItem = new QStandardItem();
-            modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
-            mModel->appendRow( modelItem );
-            mLocationsFound = false;
+            createNoEntryDisplay(mListModel);
+            locationsFound = false;
         }
     }
     //for landscape view
     else
     {
-        if( mDataManager->populateModel(mOrientation) )
+        // Create a standard model for the grid view
+        mGridModel = new QStandardItemModel( this );
+        if( mDataManager->populateModel(*mGridModel, ELocationPickerContent, aOrientation) )
         {
-            // Create the proxy model and set source model
-            mProxyGridModel = new LocationPickerProxyModel( mOrientation , this );
-            mProxyGridModel->setSourceModel(mModel);
-            // set sort properties
-            mProxyGridModel->setDynamicSortFilter(TRUE);
-            mProxyGridModel->setSortRole(Qt::DisplayRole);
-            mProxyGridModel->setSortCaseSensitivity(Qt::CaseInsensitive);
-
-            // sort in ascending order
-            mProxyGridModel->sort(0, Qt::AscendingOrder);    
-            mLocationsFound = true;
+            locationsFound = true;
         }
         else
         {
-             // no locations to display.
-             QStandardItem *modelItem = new QStandardItem();
-             modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
-             mModel->appendRow( modelItem );
-             mLocationsFound = false;
+            createNoEntryDisplay(mGridModel);
+            locationsFound = false;
         }
     }
+    return locationsFound;
 }
 
 // -----------------------------------------------------------------------------
@@ -97,50 +80,34 @@
 // -----------------------------------------------------------------------------
 LocationPickerContent::~LocationPickerContent()
 {
-    // delete data manager
-    if( mDataManager )
-        delete mDataManager;
-    delete mProxyGridModel;
-    delete mListProxyModel;
-    delete mModel;
+    delete mListModel;
+    delete mGridModel;
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerContent::locationsFound()
+// LocationPickerContent::getStandardListModel()
 // -----------------------------------------------------------------------------
-bool LocationPickerContent::locationsFound()
+QStandardItemModel* LocationPickerContent::getStandardListModel()
 {
-    return mLocationsFound;
+    return mListModel;
 }
 
 // -----------------------------------------------------------------------------
-// LocationPickerContent::getListProxyModel()
+// LocationPickerContent::getStandardGridModel()
 // -----------------------------------------------------------------------------
-LocationPickerProxyModel* LocationPickerContent::getListProxyModel()
-{   
-    return mListProxyModel;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerContent::getStandardModel()
-// -----------------------------------------------------------------------------
-QStandardItemModel* LocationPickerContent::getStandardModel()
+QStandardItemModel* LocationPickerContent::getStandardGridModel()
 {
-    return mModel;
+    return mGridModel;
 }
 
-// -----------------------------------------------------------------------------
-// LocationPickerContent::getDataManager()
-// -----------------------------------------------------------------------------
-LocationPickerDataManager* LocationPickerContent::getDataManager()
-{
-    return mDataManager;
-}
+// ----------------------------------------------------------------------------
+// LocationPickerContent::createNoEntryDisplay()
+// ----------------------------------------------------------------------------
 
-// -----------------------------------------------------------------------------
-// LocationPickerContent::getGridProxyModel()
-// -----------------------------------------------------------------------------
-LocationPickerProxyModel* LocationPickerContent::getGridProxyModel()
+void LocationPickerContent::createNoEntryDisplay( QStandardItemModel *aModel )
 {
-    return mProxyGridModel;
+    // no locations to display.
+    QStandardItem *modelItem = new QStandardItem();
+    modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
+    aModel->appendRow( modelItem );
 }
--- a/locationpickerservice/src/locationpickerdatamanager.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerdatamanager.cpp	Fri May 14 15:47:27 2010 +0300
@@ -20,21 +20,20 @@
 
 
 // ----------------------------------------------------------------------------
-// LocationPickerDataManager::LocationPickerDataManager()
+// LocationPickerDataManager::getInstance()
 // ----------------------------------------------------------------------------
-
-LocationPickerDataManager::LocationPickerDataManager() :
-    d_ptr( new LocationPickerDataManagerPrivate() )
+LocationPickerDataManager* LocationPickerDataManager::getInstance()
 {
+    static LocationPickerDataManager singletonInstance;
+    return &singletonInstance;
 }
 
 // ----------------------------------------------------------------------------
 // LocationPickerDataManager::LocationPickerDataManager()
 // ----------------------------------------------------------------------------
 
-LocationPickerDataManager::LocationPickerDataManager(
-        QStandardItemModel &aModel, TViewType aViewType ) :
-        d_ptr( new LocationPickerDataManagerPrivate( aModel, aViewType) )
+LocationPickerDataManager::LocationPickerDataManager() :
+    d_ptr( new LocationPickerDataManagerPrivate() )
 {
 }
 
@@ -50,21 +49,11 @@
 // ----------------------------------------------------------------------------
 // LocationPickerDataManager::populateModel()
 // ----------------------------------------------------------------------------
-bool LocationPickerDataManager::populateModel(Qt::Orientations aOrientation, quint32 aCollectionId)
+bool LocationPickerDataManager::populateModel( QStandardItemModel &aModel, TViewType aViewType, 
+        Qt::Orientations aOrientation, quint32 aCollectionId )
 {   
     Q_D( LocationPickerDataManager);
-    return( d->populateModel(aOrientation, aCollectionId) );
-}
-
-
-// ----------------------------------------------------------------------------
-// LocationPickerDataManager::getData()
-// ----------------------------------------------------------------------------
-
-void LocationPickerDataManager::getData( int aIndex, quint32& aValue )
-{
-    Q_D( LocationPickerDataManager);
-    return( d->getData( aIndex, aValue ) );
+    return( d->populateModel( aModel, aViewType, aOrientation, aCollectionId) );
 }
 
 // ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickerdatamanager_p.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerdatamanager_p.cpp	Fri May 14 15:47:27 2010 +0300
@@ -15,18 +15,17 @@
 *
 */
 
-#include <e32base.h>
-#include <e32std.h>
-#include <lbsposition.h>
-#include <EPos_CPosLandmark.h>
-#include <EPos_CPosLandmarkDatabase.h>
-#include <EPos_CPosLmCategoryManager.h>
-#include <EPos_CPosLandmarkCategory.h>
-#include <EPos_CPosLandmarkSearch.h>
-#include <EPos_CPosLmCategoryCriteria.h>
 #include <HbIcon>
+#include <QPixmap>  
+#include <QPainter>
+#include <QIcon>
+#include <locationdatalookupdb.h>
+#include <QFile>
+#include "locationpickerdatamanager_p.h"
 
-#include "locationpickerdatamanager_p.h"
+//constant value used
+const int ASPECTRATIOHEIGHT(3);
+const int ASPECTRATIOWIDTH (4);
 
 
 // ----------------------------------------------------------------------------
@@ -36,25 +35,10 @@
 LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate() :
         mModel( NULL ),
         mViewType( ELocationPickerContent ),
-        mIterator(NULL),
-        mLandmarkDb(NULL),
-        mLmCategoryManager(NULL),
-        mLandmarkSearch(NULL)
+        mDb( NULL )
 {
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate()
-// ----------------------------------------------------------------------------
-
-LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate( QStandardItemModel &aModel, TViewType aViewType ) :
-        mModel( &aModel ),
-        mViewType( aViewType ),
-        mIterator(NULL),
-        mLandmarkDb(NULL),
-        mLmCategoryManager(NULL),
-        mLandmarkSearch(NULL)
-{
+    mDb = new LocationDataLookupDb();
+    mDb->open();
 }
 
 
@@ -64,384 +48,277 @@
 LocationPickerDataManagerPrivate::~LocationPickerDataManagerPrivate()
 {
     // delete the member variables;
-
-    if( mIterator )
-        delete mIterator;
-    if ( mLandmarkDb )
-        delete mLandmarkDb;
-    if( mLmCategoryManager )
-        delete mLmCategoryManager;
-    if( mLandmarkSearch )
-        delete mLandmarkSearch;
+    if( mDb )
+    {
+        mDb->close();
+        delete mDb;
+        mDb = NULL;
+    }
 }
 
 // ----------------------------------------------------------------------------
 // LocationPickerDataManagerPrivate::populateModel()
 // ----------------------------------------------------------------------------
-bool LocationPickerDataManagerPrivate::populateModel( const Qt::Orientations aOrientation, quint32 aCollectionId )
+bool LocationPickerDataManagerPrivate::populateModel(  QStandardItemModel &aModel, 
+        TViewType aViewType, const Qt::Orientations aOrientation, quint32 aCollectionId )
 {
-    bool retValue = false;
+    mModel = &aModel;
+    mViewType = aViewType;
     mOrientation = aOrientation;
-    TRAP_IGNORE( retValue = populateModelL( aCollectionId ) );
-    return retValue;
-}
 
-// ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::populateModel()
-// ----------------------------------------------------------------------------
-bool LocationPickerDataManagerPrivate::populateModelL( quint32 aCollectionId )
-{
-    // Handle to the landmark database
-    mLandmarkDb = NULL;
-    
-    //Open and intialize Landmark DB
-    mLandmarkDb = CPosLandmarkDatabase::OpenL();
-    ExecuteAndDeleteLD( mLandmarkDb->InitializeL() );
+    if( !mDb )
+    {
+        // no items in the landmark database, so return false.
+        return false;
+    }
 
     switch( mViewType )
     {
         case ELocationPickerContent:
         case ELocationPickerSearchView:
              {
-                 // Create an iterator for iterating the landmarks in the database
-                 mIterator = mLandmarkDb->LandmarkIteratorL();
-
-                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
-                 {
-                     // no items in the landmark database, so return false.
-                     return false;
-                 }
-                 CleanupStack::PushL(mIterator);
-                 populateLandmarksL();
-                 CleanupStack::Pop( mIterator );
+                 QList<QLookupItem> itemArray;
+                 mDb->getEntries( itemArray );
+                 return populateLandmarks( itemArray );
              }
-             break;
+             
         case ELocationPickerCollectionListContent:
              {
-
-                 // Create category manager for landmarks
-                 mLmCategoryManager = CPosLmCategoryManager::NewL( *mLandmarkDb );
-
-                 if( !mLmCategoryManager )
-                 {
-                     return false;
-                 }
-                 // Create an iterator for iterating the referenced categories in the database
-                 mIterator = mLmCategoryManager->ReferencedCategoryIteratorL();
-
-                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
-                 {
-                     // no items in the landmark database, so return false.
-                     return false;
-                 }
-                 CleanupStack::PushL(mIterator);
-                 populateCollectionsL();
-                 CleanupStack::Pop( mIterator );
-
+                 populateCollections();
              }
              break;
 
         case ELocationPickerCollectionContent:
              {
-
-                 // create a search object.
-                 mLandmarkSearch = CPosLandmarkSearch::NewL( *mLandmarkDb );
-                 CleanupStack::PushL( mLandmarkSearch );
-
-                 // Create the search criterion
-                 CPosLmCategoryCriteria* criteria = CPosLmCategoryCriteria::NewLC();
-                 criteria->SetCategoryItemId( aCollectionId );
-
-                 // Start the search and execute it at once.
-                 ExecuteAndDeleteLD( mLandmarkSearch->StartLandmarkSearchL( *criteria ) );
-                 CleanupStack::PopAndDestroy( criteria );
-
-                 // Retrieve an iterator to access the matching landmarks.
-                 mIterator = mLandmarkSearch->MatchIteratorL();
-                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
-                 {
-                     // no landmarks in this collection
-                     CleanupStack::Pop(mLandmarkSearch);
+                 QList<QLookupItem> itemArray;
+                 mDb->getEntries( itemArray, aCollectionId );             
+                 if( itemArray.count() == 0 )
                      return false;
-                 }
-                 CleanupStack::PushL( mIterator );
-                 populateLandmarksL();
-                 CleanupStack::Pop( mIterator );
-                 CleanupStack::Pop(mLandmarkSearch);
+                 
+                 return populateLandmarks( itemArray );
              }
-             break;
     }
     return true;
 }
 
 // ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::populateLandmarksL()
+// LocationPickerDataManagerPrivate::populateLandmarks()
 // ----------------------------------------------------------------------------
 
-void LocationPickerDataManagerPrivate::populateLandmarksL()
-{
-    // Read each landmark in the database and copy to the model.
-    TPosLmItemId lmId;
+bool LocationPickerDataManagerPrivate::populateLandmarks( QList<QLookupItem> &aItemArray )
+{    
     mModel->clear();
-    while ( ( lmId = mIterator->NextL() ) != KPosLmNullItemId )
-    {
-        CPosLandmark* readLandmark = mLandmarkDb->ReadLandmarkLC(lmId );
-        
-        if( readLandmark )
-        {
-            QString lmAddressLine1(" ");
-            QString lmAddressLine2("");
 
-            TPtrC tempStr;
-            TInt retStatus;
-
-            // Copy landmark name in string 1
-            retStatus = readLandmark->GetLandmarkName( tempStr );
-            if( retStatus == KErrNone && tempStr.Length() > 0)
+    if( !aItemArray.count() )
+    {
+        return false;
+    }
+    QString lmAddressLine1;
+    QString lmAddressLine2;
+    
+    for( int i = 0; i < aItemArray.count(); i++ )
+    {
+    
+        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() )
             {
-                lmAddressLine1 = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-            }
-
-            // create address line 2
-            bool addressEmtpy = true; // used to check if address line 2 is empty
-
-            // get street
-            retStatus = readLandmark->GetPositionField( EPositionFieldStreet, tempStr );
-            if( retStatus == KErrNone && tempStr.Length() )
-            {
-                lmAddressLine2 = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                lmAddressLine2 = aItemArray[i].mStreet;
                 addressEmtpy = EFalse;
             }
-
-            // Get city
-            retStatus =readLandmark->GetPositionField( EPositionFieldCity, tempStr );
-            if( retStatus == KErrNone && tempStr.Length() )
+            if( !aItemArray[i].mCity.isEmpty() )
             {
                 if( !addressEmtpy )
                 {
                     lmAddressLine2 = lmAddressLine2 + KSeparator;
                     lmAddressLine2 = lmAddressLine2 + KSpace;
-                    lmAddressLine2 = lmAddressLine2 + QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCity;
                 }
                 else
                 {
-                    lmAddressLine2 = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = aItemArray[i].mCity;
                     addressEmtpy = EFalse;
                 }
             }
-            // Get State
-            retStatus =readLandmark->GetPositionField( EPositionFieldState, tempStr );
-            if( retStatus == KErrNone && tempStr.Length() )
+            if( !aItemArray[i].mState.isEmpty() )
             {
                 if( !addressEmtpy )
                 {
                     lmAddressLine2 = lmAddressLine2 + KSeparator;
                     lmAddressLine2 = lmAddressLine2 + KSpace;
-                    lmAddressLine2 = lmAddressLine2 + QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = lmAddressLine2 + aItemArray[i].mState;
                 }
                 else
                 {
-                    lmAddressLine2 = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = aItemArray[i].mState;
                     addressEmtpy = EFalse;
                 }
             }
-
-            // get country
-            retStatus =readLandmark->GetPositionField( EPositionFieldCountry, tempStr );
-            if( retStatus == KErrNone && tempStr.Length() )
+            if( !aItemArray[i].mCountry.isEmpty() )
             {
                 if( !addressEmtpy )
                 {
                     lmAddressLine2 = lmAddressLine2 + KSeparator;
                     lmAddressLine2 = lmAddressLine2 + KSpace;
-                    lmAddressLine2 = lmAddressLine2 + QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = lmAddressLine2 + aItemArray[i].mCountry;
                 }
                 else
                 {
-                    lmAddressLine2 = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
+                    lmAddressLine2 = aItemArray[i].mCountry;
                     addressEmtpy = EFalse;
                 }
             }
-
-            // get contact address type
-            QString contactAddressType;
-            retStatus = readLandmark->GetLandmarkDescription( tempStr );
-            if( retStatus == KErrNone && tempStr.Length() > 0)
-            {
-                contactAddressType = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-            }
-
             // set icons based on contact address type
             QVariantList icons;
-            if( contactAddressType == KContactHome )
+            
+            HbIcon adressTypeIcon;
+        bool adressIconPresent = false;
+        if( aItemArray[i].mSourceType == ESourceContactsHome )
+        {
+            adressTypeIcon = HbIcon(KContactHomeIcon);
+            adressIconPresent = true;
+        }
+        else if( aItemArray[i].mSourceType == ESourceContactsWork )
+        {
+            adressTypeIcon =HbIcon(KContactWorkIcon);
+            adressIconPresent = true;
+        }
+        else if( aItemArray[i].mSourceType == ESourceContactsPref )
+        {
+            adressTypeIcon =HbIcon(KContactPrefIcon);
+            adressIconPresent = true;
+        }
+        
+        // create a list item and set to model
+        QStringList addressData;
+        //create model for grid view in landscape mode
+        if( mOrientation == Qt::Horizontal && ( mViewType == ELocationPickerCollectionContent || 
+                mViewType == ELocationPickerContent ) )
+        {   
+            addressData.clear();
+            
+            HbIcon landscapeIcon;
+            
+            if( QFile::exists( aItemArray[i].mMapTilePath ) )
             {
-                icons << HbIcon(KDummyImage) << HbIcon(KContactHomeIcon);
-            }
-            else if( contactAddressType == KContactWork )
-            {
-                icons << HbIcon(KDummyImage) << HbIcon(KContactWorkIcon);
+                //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 );
             }
             else
             {
-                icons << HbIcon(KDummyImage) << HbIcon(KContactPrefIcon);
+                //draw dummy icon
+                landscapeIcon = HbIcon( KDummyImage );
             }
-            
-            // 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();
+
+                icons<<landscapeIcon;
                 QStandardItem *modelItem = new QStandardItem();
                 addressData << lmAddressLine1;
                 modelItem->setData(QVariant(addressData), Qt::DisplayRole);
                 modelItem->setData( icons[0], Qt::DecorationRole );
-                modelItem->setData(QString("contact"),Qt::UserRole);
+                modelItem->setData( aItemArray[i].mId, Qt::UserRole );
                 mModel->appendRow( modelItem );
             }
             else
             {   
-                //create model for list view in potrai mode
+                //create model for list view in potrait mode
                 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 );
             }
-
-            CleanupStack::PopAndDestroy( readLandmark );
         }
-   }
+    }
+    
+    return true;
 }
 
 // ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::populateCollectionsL()
+// LocationPickerDataManagerPrivate::populateCollections()
 // ----------------------------------------------------------------------------
 
-void LocationPickerDataManagerPrivate::populateCollectionsL()
+void LocationPickerDataManagerPrivate::populateCollections()
 {
-    // Read each categpry in the database and copy to the model.
-    TPosLmItemId lmId;
-    while ((lmId = mIterator->NextL()) != KPosLmNullItemId )
-    {
-        CPosLandmarkCategory* readCategory = mLmCategoryManager->ReadCategoryLC(lmId );
-
-        if( readCategory )
-        {
-            QString categoryName("");
-
-            TPtrC tempStr;
-            TInt retStatus;
+    // add contact collection
+    QStandardItem *modelItemContact = new QStandardItem();
+    QString contactCollectionName( hbTrId("txt_lint_list_contact_addresses") );
+    modelItemContact->setData( QVariant( contactCollectionName ), Qt::DisplayRole );
+    modelItemContact->setData( HbIcon ( KCollectionsContacts ), Qt::DecorationRole );
+    modelItemContact->setData( ESourceLandmarksContactsCat, Qt::UserRole );
+    mModel->appendRow( modelItemContact );
 
-            retStatus = readCategory->GetCategoryName( tempStr );
-            if( retStatus == KErrNone && tempStr.Length() > 0)
-            {
-                categoryName = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-                if(categoryName == KContactsString)
-                {
-                    categoryName = hbTrId("txt_lint_list_contact_addresses");
-                }
-            }
-
-            // create a list item and copy to model
-
-            QString iconPath;
-            QStandardItem *modelItem = new QStandardItem();
-            modelItem->setData(QVariant(categoryName), Qt::DisplayRole);
-            modelItem->setData( HbIcon (KCollectionsContacts), Qt::DecorationRole );
-            mModel->appendRow( modelItem );
-
-            CleanupStack::PopAndDestroy( readCategory );
-        }
-    }
+    QStandardItem *modelItemCalendar = new QStandardItem();
+    QString calendarCollectionName( hbTrId("txt_lint_list_calendar_event_locations") );
+    modelItemCalendar->setData( QVariant( calendarCollectionName ), Qt::DisplayRole );
+    modelItemCalendar->setData( HbIcon ( KCollectionsCalendar ), Qt::DecorationRole );
+    modelItemCalendar->setData( ESourceLandmarksCalendarCat, Qt::UserRole );
+    mModel->appendRow( modelItemCalendar );
+    
+    QStandardItem *modelItemPlaces = new QStandardItem();
+    QString placesCollectionName( hbTrId("txt_lint_list_places") );
+    modelItemPlaces->setData( QVariant( placesCollectionName ), Qt::DisplayRole );
+    modelItemPlaces->setData( HbIcon (KCollectionsPlaces), Qt::DecorationRole );
+    modelItemPlaces->setData( ESourceLandmarks, Qt::UserRole );
+    mModel->appendRow( modelItemPlaces );
 }
 
-// ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::getData()
-// ----------------------------------------------------------------------------
-
-void LocationPickerDataManagerPrivate::getData( int aIndex, quint32& aValue )
-{
-    aValue = 0;
-    RArray<TPosLmItemId> idArray;
-    TRAPD( err, mIterator->GetItemIdsL( idArray, aIndex, 1 ) );
-    if( err == KErrNone)
-        aValue = (quint32) idArray[0];
-}
 
 // ----------------------------------------------------------------------------
 // LocationPickerDataManagerPrivate::getLocationItem()
 // ----------------------------------------------------------------------------
 
-void LocationPickerDataManagerPrivate::getLocationItem( quint32 aLmId, QLocationPickerItem& aItem )
+void LocationPickerDataManagerPrivate::getLocationItem( quint32 aId, QLocationPickerItem& aItem )
 {
-    TRAPD( err, getLocationItemL( aLmId, aItem ) );
-    if( err != KErrNone )
+    QLookupItem item;
+    item.mId = aId;
+    if( mDb->findEntryById( item ) )
+    {
+        aItem.mName = item.mName;
+        aItem.mStreet = item.mStreet;
+        aItem.mPostalCode = item.mPostalCode;
+        aItem.mCity = item.mCity;
+        aItem.mState = item.mState;
+        aItem.mCountry = item.mCountry;
+        aItem.mLatitude = item.mLatitude;
+        aItem.mLongitude = item.mLongitude;
+        aItem.mIsValid = true;
+    }
+    else
+    {
         aItem.mIsValid = false;
+    }
+    
 }
 
-// ----------------------------------------------------------------------------
-// LocationPickerDataManagerPrivate::getLocationItem()
-// ----------------------------------------------------------------------------
-
-void LocationPickerDataManagerPrivate::getLocationItemL( quint32 aLmId, QLocationPickerItem& aItem )
-{
-    //Open and intialize Landmark DB
-    CPosLandmarkDatabase* landmarkDb = NULL;
-    landmarkDb = CPosLandmarkDatabase::OpenL();
-
-    ExecuteAndDeleteLD( landmarkDb->InitializeL() );
-
-    CPosLandmark* readLandmark = landmarkDb->ReadLandmarkLC(aLmId );
-
-    if( readLandmark )
-    {
-        // get position and store
-        TLocality position;
-        readLandmark->GetPosition( position );
-        aItem.mLatitude = position.Latitude();
-        aItem.mLongitude = position.Longitude();
-
-        // get address fields
-        TPtrC tempStr;
-        TInt retStatus;
-
-        // Copy landmark name in string 1
-        retStatus = readLandmark->GetLandmarkName( tempStr );
-        if( retStatus == KErrNone && tempStr.Length() > 0)
-        {
-            aItem.mName = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-        }
-
-        // get street
-        retStatus = readLandmark->GetPositionField( EPositionFieldStreet, tempStr );
-        if( retStatus == KErrNone && tempStr.Length() )
-        {
-            aItem.mStreet = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-        }
-
-        // Get city
-        retStatus =readLandmark->GetPositionField( EPositionFieldCity, tempStr );
-        if( retStatus == KErrNone && tempStr.Length() )
-        {
-            aItem.mCity = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-        }
-        // Get State
-        retStatus =readLandmark->GetPositionField( EPositionFieldState, tempStr );
-        if( retStatus == KErrNone && tempStr.Length() )
-        {
-            aItem.mState = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-        }
-
-        // get country
-        retStatus =readLandmark->GetPositionField( EPositionFieldCountry, tempStr );
-        if( retStatus == KErrNone && tempStr.Length() )
-        {
-              aItem.mCountry = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
-        }
-    }
-    aItem.mIsValid = true;
-    CleanupStack::PopAndDestroy(readLandmark);
-    delete landmarkDb;
-}
--- a/locationpickerservice/src/locationpickerdocumentloader.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerdocumentloader.cpp	Fri May 14 15:47:27 2010 +0300
@@ -40,29 +40,29 @@
 // LocationPickerDocumentLoader::createObject
 // ---------------------------------------------------------------------------
 //
-QObject *LocationPickerDocumentLoader::createObject(const QString& type, const QString &name)
+QObject *LocationPickerDocumentLoader::createObject( const QString& type, const QString &name )
 {   
     //for locationpickerpotraitview
-    if (name == LocationPickerPotraitView::staticMetaObject.className() )
+    if ( name == LocationPickerPotraitView::staticMetaObject.className() )
     {
         QObject *object = new LocationPickerPotraitView(this);
-        object->setObjectName(name);
+        object->setObjectName( name );
         return object;
     }
     //for locationpickerlandscapeview
-    if (name == LocationPickerLandscapeView::staticMetaObject.className())
+    if ( name == LocationPickerLandscapeView::staticMetaObject.className() )
     {
         QObject *object = new LocationPickerLandscapeView(this);
-        object->setObjectName(name);
+        object->setObjectName( name );
         return object;
     }
     //for locationpickersearchview
-    if (name == LocationPickerSearchView::staticMetaObject.className())
+    if ( name == LocationPickerSearchView::staticMetaObject.className() )
     {
         QObject *object = new LocationPickerSearchView(*this);
-        object->setObjectName(name);
+        object->setObjectName( name );
         return object;
     }
     //default case
-    return HbDocumentLoader::createObject(type, name);
+    return HbDocumentLoader::createObject( type, name );
 }
--- a/locationpickerservice/src/locationpickerlandscapeview.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerlandscapeview.cpp	Fri May 14 15:47:27 2010 +0300
@@ -26,7 +26,6 @@
 
 #include "locationpickerproxymodel.h"
 #include "locationpickerdatamanager.h"
-#include "locationpickercontent.h" 
 #include "locationpickercollectionlistcontent.h"
 #include "locationpickercollectioncontent.h"
 
@@ -36,8 +35,6 @@
 // ----------------------------------------------------
 LocationPickerLandscapeView::LocationPickerLandscapeView(HbDocumentLoader* aLoader)
     :mDocumentLoader(aLoader),
-    mLocationPickerContent(NULL),
-    mLocationPickerCollectionListContent(NULL),
     mAllAction(NULL),
     mCollectionAction(NULL),
     mSearchAction(NULL),
@@ -55,7 +52,7 @@
     mGridViewItem->setObjectName("locationgrid");
     
     // create back action
-    mLandscapeBackAction = new HbAction(Hb::BackAction);
+    mLandscapeBackAction = new HbAction(Hb::BackNaviAction);
     setNavigationAction(mLandscapeBackAction);
     connect(mLandscapeBackAction, SIGNAL(triggered()), this,
             SLOT(backButtonTriggered()));
@@ -66,8 +63,6 @@
 LocationPickerLandscapeView::~LocationPickerLandscapeView()
 {
     delete mCollectionContent;
-    delete mLocationPickerContent;
-    delete mLocationPickerCollectionListContent;
     delete mAllAction;
     delete mCollectionAction;
     delete mAscendingAction;
@@ -83,8 +78,7 @@
     if(mViewType == ELocationPickerCollectionContent)
     {
         colectionTabTriggered();
-        delete mCollectionContent;
-        mCollectionContent=NULL; 
+        emit collectionContentExited(); 
     }
     else
     {
@@ -97,12 +91,18 @@
 // ----------------------------------------------------
 // LocationPickerPotraitView::~init()
 // ----------------------------------------------------
-void LocationPickerLandscapeView::init(Qt::Orientation aOrientation )
+void LocationPickerLandscapeView::init(Qt::Orientation aOrientation, QStandardItemModel *aModel )
 {   
-      // Create Collection List Content
-      mLocationPickerCollectionListContent = new LocationPickerCollectionListContent(aOrientation);
-      
-      mLocationPickerContent = new LocationPickerContent(aOrientation);
+      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(
@@ -122,7 +122,14 @@
       {
           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,
@@ -138,48 +145,27 @@
 
 
 void LocationPickerLandscapeView::manageGridView()
-{   
-    // Create Locationpicker Content
-    if (!mLocationPickerContent->locationsFound())
-    {
-        //if no location entries present
-        mGridView->setModel(mLocationPickerContent->getStandardModel(),mGridViewItem); 
-        disableTabs();
-        mViewType = ELocationPickerContent;
-    }
-    else
+{
+    //set the appropriate model
+    switch(mViewType)
     {
-        //set the appropriate model
-        switch(mViewType)
-            {
-                case ELocationPickerContent:
-                {
-                    mGridView->setModel(mLocationPickerContent->getGridProxyModel(),mGridViewItem);
-                    mAllAction->setChecked(true);
-                    mCollectionAction->setChecked(false);
-                }
-                break;
-                case ELocationPickerCollectionContent:
-                {
-                    setCollectionData(mCategoryId);
-                    mCollectionAction->setChecked(true);
-                    mAllAction->setChecked(false);
-                }
-                break;
-            }
+        case ELocationPickerContent:
+        {
+            mGridView->setModel(mProxyModel,mGridViewItem);
+            mAllAction->setChecked(true);
+            mCollectionAction->setChecked(false);
+        }
+        break;
+        case ELocationPickerCollectionContent:
+        {
+            setCollectionData(mCategoryId);
+            mCollectionAction->setChecked(true);
+            mAllAction->setChecked(false);
+        }
+        break;
     }
 }
 
-void LocationPickerLandscapeView::disableTabs()
-{
-    mAllAction->setDisabled(true);
-    mCollectionAction->setDisabled(true);
-    mSearchAction->setDisabled(true);
-    mAscendingAction->setDisabled(true);
-    mDescendingAction->setDisabled(true);
-}
-
-
 // -----------------------------------------------------------------------------
 // LocationPickerLandscapeView::handleActivated()
 // -----------------------------------------------------------------------------
@@ -188,31 +174,29 @@
     //handle the activated signal according to model set
     
        switch(mViewType)
-           {
+       {
            case ELocationPickerContent:
                {
-                   QModelIndex  index = mLocationPickerContent->getGridProxyModel()->mapToSource(
+                QModelIndex  index = mProxyModel->mapToSource(
                                   aIndex);
                 quint32 lm = 0;
-                mLocationPickerContent->getDataManager()->getData(index.row(), lm);
+                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->getDataManager()->getData(
-                       aIndex.row(), mCategoryId);
-               setCollectionData(mCategoryId);
-               emit sendCategoryID(mCategoryId);
-               }
-               break;
-              //default
            case ELocationPickerCollectionContent:
                {
+               if(!mCollectionContent->getProxyModel())
+               {
+               break;
+               }
                QModelIndex   index = mCollectionContent->getProxyModel()->mapToSource(
                                       aIndex);
                quint32 lm = 0;
-               mCollectionContent->getDataManager()->getData(index.row(), lm);
+               mCollectionContent->getData(index, lm);
                emit selectItem(lm);
                }
                break;
@@ -231,7 +215,7 @@
     //check the model set and do sorting accordingly
         if (mViewType == ELocationPickerContent)
         {
-            mLocationPickerContent->getGridProxyModel()->sort(0, Qt::AscendingOrder);
+            mProxyModel->sort(0, Qt::AscendingOrder);
         }
         else
         {
@@ -247,7 +231,7 @@
     //check the model set and do sorting accordingly
         if (mViewType == ELocationPickerContent)
         {
-            mLocationPickerContent->getGridProxyModel()->sort(0, Qt::DescendingOrder);
+            mProxyModel->sort(0, Qt::DescendingOrder);
         }
         else
         {
@@ -263,7 +247,7 @@
     //execute only if tab is not pressed
        if (mAllAction->isChecked())
        {    
-           mGridView->setModel(mLocationPickerContent->getGridProxyModel(),mGridViewItem);
+           mGridView->setModel(mProxyModel,mGridViewItem);
            mAscendingAction->setEnabled(true);
            mDescendingAction->setEnabled(true);
            mCollectionAction->setChecked(false);
@@ -311,9 +295,18 @@
 
 void LocationPickerLandscapeView::setCollectionData( quint32 aCategoryId )
 {   
-    mCollectionContent
-    = new LocationPickerCollectionContent(this->mainWindow()->orientation() , aCategoryId);
-    mGridView->setModel(mCollectionContent->getProxyModel(),mGridViewItem);
+    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);
@@ -344,3 +337,16 @@
 {
     mViewType = aViewType;
 }
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::clearContentModel()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::clearContentModel()
+{
+   if(mCollectionContent)
+   {
+   delete mCollectionContent;
+   mCollectionContent = NULL;
+   }
+}
+
--- a/locationpickerservice/src/locationpickerpotraitview.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerpotraitview.cpp	Fri May 14 15:47:27 2010 +0300
@@ -34,10 +34,10 @@
 // ----------------------------------------------------
 // LocationPickerPotraitView::LocationPickerView()
 // ----------------------------------------------------
-LocationPickerPotraitView::LocationPickerPotraitView(HbDocumentLoader* aLoader)
+LocationPickerPotraitView::LocationPickerPotraitView( HbDocumentLoader* aLoader )
     :mDocumentLoader(aLoader),
-    mLocationPickerContent(NULL),
     mLocationPickerCollectionListContent(NULL),
+    mProxyModel(NULL),
     mAllAction(NULL),
     mCollectionAction(NULL),
     mSearchAction(NULL),
@@ -48,7 +48,7 @@
     mViewType(ELocationPickerContent)
 {   
     // create back action
-    mPotraitBackAction = new HbAction(Hb::BackAction);
+    mPotraitBackAction = new HbAction(Hb::BackNaviAction);
     // add back key action
     setNavigationAction(mPotraitBackAction);
     //connect to slots
@@ -65,7 +65,6 @@
 LocationPickerPotraitView::~LocationPickerPotraitView()
 {
     delete mCollectionContent;
-    delete mLocationPickerContent;
     delete mLocationPickerCollectionListContent;
     delete mAllAction;
     delete mCollectionAction;
@@ -83,8 +82,7 @@
     if(mViewType == ELocationPickerCollectionContent)
     {
         colectionTabTriggered();
-        delete mCollectionContent;
-        mCollectionContent=NULL; 
+        emit collectionContentExited(); 
     }
     else
     {
@@ -97,16 +95,26 @@
 // ----------------------------------------------------
 // LocationPickerPotraitView::init()
 // ----------------------------------------------------
-void LocationPickerPotraitView::init(Qt::Orientation aOrientation )
+void LocationPickerPotraitView::init( bool aPopulated, Qt::Orientation aOrientation, QStandardItemModel *aModel )
 {   
+    mModel = aModel;
+    if(aPopulated)
+    {
     // Create Collection List Content
     mLocationPickerCollectionListContent = new LocationPickerCollectionListContent(aOrientation);
-    mLocationPickerContent = new LocationPickerContent(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")));
-
+                   "ListView")));
     //get the action items from docml
     mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
             "allAction")));
@@ -118,11 +126,11 @@
             QString("ascendingAction")));
     mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
             QString("descendingAction")));
-      if( !mAllAction || !mCollectionAction || !mSearchAction || !mListView || !mAscendingAction || !mDescendingAction)
-      {
-          qFatal("Error Reading Docml");
-      }
-
+    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,
@@ -137,54 +145,46 @@
 }
 
 void LocationPickerPotraitView::manageListView()
-{
-    if (!mLocationPickerContent->locationsFound())
+{   
+    //set the appropriate model
+    switch(mViewType)
     {
-        //if no location entries present
-        mListView->setModel(mLocationPickerContent->getStandardModel(),mListItem);
-        disableTabs();
-    }
-    else
-    {   
-        //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:
         {
-            case ELocationPickerContent:
-            {   
-                mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-                mListView->setModel(mLocationPickerContent->getListProxyModel(),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;
+            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()
+void LocationPickerPotraitView::disableTabs( QStandardItemModel *aModel )
 {
+    //if no location entries present
+    mListView->setModel(aModel,mListItem);
     mAllAction->setDisabled(true);
     mCollectionAction->setDisabled(true);
     mSearchAction->setDisabled(true);
@@ -195,25 +195,31 @@
 // -----------------------------------------------------------------------------
 // LocationPickerView::handleActivated()
 // -----------------------------------------------------------------------------
-void LocationPickerPotraitView::handleActivated(const QModelIndex &aIndex)
+void LocationPickerPotraitView::handleActivated( const QModelIndex &aIndex )
 {   
     //handle the activated signal according to model set
     switch(mViewType)
     {
         case ELocationPickerContent:
-        {
-            QModelIndex   index = mLocationPickerContent->getListProxyModel()->mapToSource(
+        {   
+            if(!mProxyModel)
+            {
+            break;
+            }
+            QModelIndex   index = mProxyModel->mapToSource(
                     aIndex);
             quint32 lm = 0;
-            mLocationPickerContent->getDataManager()->getData(index.row(), lm);
+            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->getDataManager()->getData(
-                    aIndex.row(), mCategoryId);
+            mLocationPickerCollectionListContent->getData(
+                    aIndex, mCategoryId );
             mViewType = ELocationPickerCollectionContent;
             //send categoryID to set the collection content
             emit sendCategoryID(mCategoryId);
@@ -221,10 +227,14 @@
             break;
         case ELocationPickerCollectionContent:
         {
+            if(!mCollectionContent->getProxyModel())
+            {
+                break;
+            }
             QModelIndex  index = mCollectionContent->getProxyModel()->mapToSource(
                         aIndex);
             quint32 lm = 0;
-            mCollectionContent->getDataManager()->getData(index.row(), lm);
+            mCollectionContent->getData(index, lm);
             //item selected, complete request
             emit selectItem(lm);
         }
@@ -242,7 +252,7 @@
     //check the model set and do sorting accordingly
     if (mViewType == ELocationPickerContent)
     {
-        mLocationPickerContent->getListProxyModel()->sort(0, Qt::AscendingOrder);
+        mProxyModel->sort(0, Qt::AscendingOrder);
     }
     else
     {
@@ -258,7 +268,7 @@
     //check the model set and do sorting accordingly
     if (mViewType == ELocationPickerContent)
     {
-        mLocationPickerContent->getListProxyModel()->sort(0, Qt::DescendingOrder);
+        mProxyModel->sort(0, Qt::DescendingOrder);
     }
     else
     {
@@ -283,7 +293,7 @@
         else
         {
             mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-            mListView->setModel(mLocationPickerContent->getListProxyModel(),mListItem);
+            mListView->setModel(mProxyModel,mListItem);
             mCollectionAction->setChecked(false);
         }
         mAscendingAction->setEnabled(true);
@@ -338,10 +348,21 @@
 // -----------------------------------------------------------------------------
 void LocationPickerPotraitView::setCollectionData( quint32 acategoryId )
 {
-    mCollectionContent
-    = new LocationPickerCollectionContent(this->mainWindow()->orientation() , acategoryId);
+    
+    if(!mCollectionContent)
+    {
+        mCollectionContent
+        = new LocationPickerCollectionContent(Qt::Vertical , acategoryId);
+    }
     mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-    mListView->setModel(mCollectionContent->getProxyModel(),mListItem);
+    if(mCollectionContent->locationFound())
+    {
+        mListView->setModel(mCollectionContent->getProxyModel(),mListItem);
+    }
+    else
+    {
+        mListView->setModel(mCollectionContent->getStandardModel(),mListItem);
+    }
     mViewType = ELocationPickerCollectionContent;
     //Enable the options
     mAscendingAction->setEnabled(true);
@@ -372,3 +393,17 @@
 {
     mViewType = aViewType;
 }
+
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::clearContentModel()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::clearContentModel()
+{
+    if(mCollectionContent)
+    {
+    delete mCollectionContent;
+    mCollectionContent = NULL;
+    }
+}
+
--- a/locationpickerservice/src/locationpickerproxymodel.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerproxymodel.cpp	Fri May 14 15:47:27 2010 +0300
@@ -22,7 +22,7 @@
 // LocationPickerProxyModel::LocationPickerProxyModel()
 // ----------------------------------------------------
 
-LocationPickerProxyModel::LocationPickerProxyModel(Qt::Orientations aOrientation , QObject *parent)
+LocationPickerProxyModel::LocationPickerProxyModel( Qt::Orientations aOrientation , QObject *parent )
      :QSortFilterProxyModel(parent),
      mOrientation( aOrientation )
 {
@@ -31,8 +31,8 @@
 // ----------------------------------------------------
 // LocationPickerProxyModel::lessThan()
 // ----------------------------------------------------
- bool LocationPickerProxyModel::lessThan(const QModelIndex &left,
-                                      const QModelIndex &right) const
+ bool LocationPickerProxyModel::lessThan( const QModelIndex &left,
+                                      const QModelIndex &right ) const
 {
      // get left and right items data and implement sort logic
      // return true if left is less than right
@@ -62,8 +62,8 @@
 // LocationPickerProxyModel::filterAcceptsRow()
 // ----------------------------------------------------
 
-bool LocationPickerProxyModel::filterAcceptsRow(int sourceRow,
-        const QModelIndex &sourceParent) const
+bool LocationPickerProxyModel::filterAcceptsRow( int sourceRow,
+        const QModelIndex &sourceParent ) const
 {
     if( mOrientation == Qt::Vertical)
     {
@@ -82,7 +82,7 @@
  // ----------------------------------------------------
 // LocationPickerProxyModel::filterParameterChanged()
 // ----------------------------------------------------
-void LocationPickerProxyModel::filterParameterChanged(QString aSearchText)
+void LocationPickerProxyModel::filterParameterChanged( QString aSearchText )
 {
     mSearchText = " " + aSearchText;
 }
--- a/locationpickerservice/src/locationpickersearchview.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickersearchview.cpp	Fri May 14 15:47:27 2010 +0300
@@ -32,12 +32,11 @@
 // ----------------------------------------------------
 // LocationPickerSearchView::LocationPickerSearchView()
 // ----------------------------------------------------
-LocationPickerSearchView::LocationPickerSearchView(HbDocumentLoader &aLoader)
+LocationPickerSearchView::LocationPickerSearchView( HbDocumentLoader &aLoader )
     :mProxyModel(NULL),
     mModel(NULL),
     mListView(NULL),
     mSearchPanel(NULL),
-    mDataManager(NULL),
     mEmptyLabel(NULL),
     mVerticalLayout(NULL),
     mDocumentLoader(aLoader)
@@ -49,18 +48,16 @@
 // ----------------------------------------------------
 LocationPickerSearchView::~LocationPickerSearchView()
 {
-    if( mDataManager )
-        delete mDataManager;
     delete mProxyModel;
-    delete mModel;
     delete mEmptyLabel;
 }
 
 // ----------------------------------------------------
 // LocationPickerSearchView::init()
 // ----------------------------------------------------
-void LocationPickerSearchView::init()
+void LocationPickerSearchView::init( QStandardItemModel *aModel )
 {   
+    mModel = aModel;
     //get listview from docml
     mListView = qobject_cast<HbListView*>(
             mDocumentLoader.findObject(QString("SearchListView")));
@@ -86,11 +83,6 @@
     hbListItem->setGraphicsSize(HbListViewItem::Thumbnail);
     mListView->setItemPrototype( hbListItem );
 
-    // Create a standard model for the view list
-    mModel = new QStandardItemModel(this);
-    // create a data manager to populate the model
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerSearchView );
-
     // Create the proxy model.
     mProxyModel = new LocationPickerProxyModel( Qt ::Vertical );
     mProxyModel->setSourceModel(mModel);
@@ -100,17 +92,6 @@
     mProxyModel->setDynamicSortFilter(TRUE);
     mProxyModel->setSortRole(Qt::DisplayRole);
     mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
-
-    // populate data
-    bool populated = mDataManager->populateModel(Qt::Vertical);
-    if(!populated)
-    {
-        // no entries to display.
-        QStandardItem *modelItem = new QStandardItem();
-        modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
-        mModel->appendRow( modelItem );
-    }
-
     // sort 
     mProxyModel->sort(0, Qt::AscendingOrder);
 }
@@ -127,7 +108,7 @@
 // ----------------------------------------------------
 // LocationPickerSearchView::doSearch()
 // ----------------------------------------------------
-void LocationPickerSearchView::doSearch(QString aCriteria)
+void LocationPickerSearchView::doSearch( QString aCriteria )
 {
     // use the string to search
     mProxyModel->filterParameterChanged(aCriteria);
@@ -173,12 +154,22 @@
 // ----------------------------------------------------
 // LocationPickerSearchView::handleActivated()
 // ----------------------------------------------------
-void LocationPickerSearchView::handleActivated(const QModelIndex &aIndex)
+void LocationPickerSearchView::handleActivated( const QModelIndex &aIndex )
 {
     QModelIndex index = mProxyModel->mapToSource(aIndex);
     quint32 lm = 0;
-    mDataManager->getData( index.row(), lm );
+    getData( index, lm );
     //emit item is selectedsignal
     emit selectItem( lm );
 }
 
+// ----------------------------------------------------------------------------
+// LocationPickerSearchView::getData()
+// ----------------------------------------------------------------------------
+
+void LocationPickerSearchView::getData( QModelIndex aIndex, quint32& aValue )
+{
+    QStandardItem* item = mModel->item( aIndex.row(), aIndex.column() );
+    QVariant var = item->data( Qt::UserRole );
+    aValue = var.toUInt();
+}
--- a/locationpickerservice/src/locationpickerservice.cpp	Mon May 03 12:27:22 2010 +0300
+++ b/locationpickerservice/src/locationpickerservice.cpp	Fri May 14 15:47:27 2010 +0300
@@ -48,11 +48,11 @@
     {
         mReturn=aLm;
         connect( this, SIGNAL( returnValueDelivered() ), qApp, SLOT( quit() ) );
-        bool ok = completeRequest(mAsyncReqId,mReturn);    
-        mAsyncReqId = 0;
-        if(ok==false)
+        bool ok = completeRequest(mAsyncReqId,mReturn);
+		mAsyncReqId = 0;
+        if(ok == false)
         {
-            qApp->quit();
+        qApp->quit();
         }
     }
 }