Revision: 201015
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:27:22 +0300
changeset 17 0f22fb80ebba
parent 15 13ae750350c9
child 18 9cb5557eea6b
child 20 cd10d5b85554
Revision: 201015 Kit: 201018
location.pro
location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h
location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.inl
location_plat/location_data_harvester_api/location_data_harvester_api.pri
location_plat/location_plat.pro
locationdataharvester/bwins/maptileserviceu.def
locationdataharvester/eabi/maptileserviceu.def
locationdataharvester/geocodeupdate/bwins/geocodeupdate.def
locationdataharvester/geocodeupdate/eabi/geocodeupdate.def
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/maptileservice/conf/2002E6E8.txt
locationdataharvester/maptileservice/conf/maptileservice.confml
locationdataharvester/maptileservice/conf/maptileservice_2002E6E8.crml
locationdataharvester/maptileservice/inc/maptiledblookuptable.h
locationdataharvester/maptileservice/inc/maptileservice.h
locationdataharvester/maptileservice/maptileservice.pro
locationdataharvester/maptileservice/src/maptiledblookuptable.cpp
locationdataharvester/maptileservice/src/maptileservice.cpp
locationdataharvester/maptileservice/tsrc/ut_maptileservice/homeaddressmap.png
locationdataharvester/maptileservice/tsrc/ut_maptileservice/preferredaddressmap.png
locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp
locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro
locationdataharvester/maptileservice/tsrc/ut_maptileservice/workaddressmap.png
locationdataharvester/mylocationlogger/inc/mylocationlogger.h
locationdataharvester/mylocationlogger/inc/mylocloggingconfiguration.h
locationdataharvester/mylocationsengine/data/mylocations.rss
locationdataharvester/mylocationsengine/group/bld.inf
locationdataharvester/mylocationsengine/group/mylocationsengine.mmp
locationdataharvester/mylocationsengine/inc/addresscomparision.h
locationdataharvester/mylocationsengine/inc/appmain.h
locationdataharvester/mylocationsengine/inc/calendernotification.h
locationdataharvester/mylocationsengine/inc/lookupmaptiledb.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/src/addresscomparision.cpp
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/locationpickerallview.h
locationpickerservice/inc/locationpickerappwindow.h
locationpickerservice/inc/locationpickercollectioncontent.h
locationpickerservice/inc/locationpickercollectionlistcontent.h
locationpickerservice/inc/locationpickercollectionlistview.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/locationpickertoolbar.h
locationpickerservice/inc/locationpickertypes.h
locationpickerservice/locationpickerservice.pro
locationpickerservice/resources/locationgrid.css
locationpickerservice/resources/locationgrid.hbgridviewitem.widgetml
locationpickerservice/resources/locationpicker.qrc
locationpickerservice/resources/qtg_large_maps.png
locationpickerservice/resources/qtg_mono_favourites.png
locationpickerservice/resources/qtg_mono_home.png
locationpickerservice/resources/qtg_mono_location.png
locationpickerservice/resources/qtg_mono_location_collection.png
locationpickerservice/resources/qtg_mono_search.png
locationpickerservice/resources/qtg_mono_work.png
locationpickerservice/resources/qtg_small_calendar.png
locationpickerservice/resources/qtg_small_contacts.png
locationpickerservice/rom/locationpickerservice.iby
locationpickerservice/src/locationpickerallview.cpp
locationpickerservice/src/locationpickerappwindow.cpp
locationpickerservice/src/locationpickercollectioncontent.cpp
locationpickerservice/src/locationpickercollectionlistcontent.cpp
locationpickerservice/src/locationpickercollectionlistview.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
locationpickerservice/src/locationpickertoolbar.cpp
locationpickerservice/src/main.cpp
--- a/location.pro	Fri Apr 16 14:54:12 2010 +0300
+++ b/location.pro	Mon May 03 12:27:22 2010 +0300
@@ -16,6 +16,7 @@
 TEMPLATE = subdirs
 
 SUBDIRS  = location_plat \
-	   locationpickerservice 
+	   locationpickerservice \
+	   locationdataharvester
 
 CONFIG += ordered
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:	The header file for MaptileGeocoderPlugin that provides the Geocoding
+*               and Maptile  interfaces.
+*
+*/
+
+
+#ifndef __MAPTILEGEOCODERPLUGIN_H__
+#define __MAPTILEGEOCODERPLUGIN_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <LbsPosition.h> 
+#include <EPos_CPosLandmark.h>
+
+//Maptile geocoder plugin uid
+const TUid KMaptileGeoCoderPluginUid = { 0x2002E6BE };
+
+
+/**
+ * Data class to get the address details. An handle to this type will be given to the
+ * user through MMaptileGeocoderObserver::GeocodingCompleted callback, through which
+ * user can retrieve the address details using the following interfaces.
+ *
+ */
+class MAddressInfo
+{
+public:
+	
+    /**
+     * Gets the latitude information.
+     * 
+     * @param aLatitude latitude value. 
+     */
+    virtual void GetLatitude( TReal& aLatitude ) = 0;
+    
+    
+    /**
+	 * Gets the longitude information.
+	 * 
+	 * @param aLongitude longitude value. 
+	 */
+    virtual void GetLongitude( TReal& aLongitude ) = 0;
+      
+};
+
+
+
+/**
+ * TMapTileParam
+ * Data class containing the information required for  fetching the map tile. 
+ *
+ */
+class TMapTileParam
+{
+
+public:
+
+    /**
+     * Parameterized constructor.
+     *
+     * @param aLatitude latitude value
+     * @param aLongitude longitude value
+     * @param aZoom  maptile zoom level
+     * @param aSize requested maptile size
+     *
+     */
+    TMapTileParam( const TReal aLatitude, const TReal aLongitude, const TInt aZoom, const TInt aSize ):
+        iLattitude( aLatitude ), iLongitude( aLongitude ), iZoomLevel( aZoom ), iSize( aSize )
+    {
+    }
+		
+    
+    /**
+     * Default constructor
+     */
+    TMapTileParam()
+    {
+    }
+	
+
+public:
+
+    // Latitude
+    TReal iLattitude;
+    //Longitude
+    TReal iLongitude;
+    //Zoom level
+    TInt iZoomLevel;
+    //Required image size
+    TInt iSize;
+};
+
+
+/**
+ * TConnectionOption
+ * Data class containing the connection options.
+ *
+ */
+enum TConnectionOption
+{
+    //Interactive connection
+    EInteractive = 0,
+    //Silent connection
+    ESilent
+};
+
+
+/**
+ * Observer class which exposes callbacks to notify the completion of geocoding 
+ * and maptile fetching events.
+ *
+ */
+class MMaptileGeocoderObserver
+{
+public:
+
+    /**
+     * Callback function which notifys the completion of geocoding service. 
+     * This signals the completion of the asynchronous function 
+     * CMaptileGeocoderPlugin::GetCoordinateByAddressL.
+     * 
+     *  @param aErrorcode Error status KErrNone in case of success or other system 
+     *                    specific errorcodes in case of failures.
+     *                       
+     *  @param aAddressInfo refrence to the address stucture, through which user can 
+     *                      access the coordinate information. 
+     */
+    virtual void GeocodingCompleted( TInt aErrorcode, MAddressInfo& aAddressInfo ) = 0;
+
+
+	
+    /**
+     * Callback function which notifys the completion of Maptile fetching event. 
+     * This signals the completion of the asynchronous function 
+     * CMaptileGeocoderPlugin::GetMapTileByGeoCode.
+     * 
+     * @param aErrorcode Error status KErrNone in case of success or other system 
+     *                   specific errorcodes in case of failures.
+     *						
+     * @param aMapImagePath Maptile image path
+     *					   
+     */
+    virtual void MapTileFetchingCompleted( TInt aErrorcode, const TDesC& aMapImagePath ) = 0;
+	
+};
+
+
+
+
+
+/**
+ * CMaptileGeocoderPlugin
+ *
+ * An interface of the CMaptileGeocoderPlugin encapsulates the goecoding  and 
+ * maptile fetching functionality. It acts as a base, for a concrete implementation 
+ * class to provide all the functionality that a client requires from a 
+ * CMaptileGeocoderPlugin implementation.
+ *
+ */
+ 
+class CMaptileGeocoderPlugin : public CBase
+{
+public:
+	
+    /**
+	 * Create instance of CMaptileGeocoderPlugin concrete implementation. 
+	 * @return: Instance of this class.
+	 */
+    static CMaptileGeocoderPlugin* NewL();
+
+    /**
+	 * Destructor.
+  	 */
+    virtual ~CMaptileGeocoderPlugin();
+
+
+public:
+	
+    /**
+	 * Initializes the ReverseGeoCodeObserver
+	 * @param: aObserver The observer class instance that is to be notified when 
+	 *         geocoding and maptile fetching service completes.
+	 * 
+	 */
+    virtual void SetMaptileGeocoderObserver( MMaptileGeocoderObserver& aObserver ) = 0;
+	
+    /**
+     * Gets the geo-coordinate information for the given address. This is an 
+     * asynchronous function whose completion will be notified by the 
+     * MMaptileGeocoderObserver::GeocodingCompleted callback.
+     * 
+     * @param aLandmark Landmark containing the address informations.
+     * @param aOption  OCC setting option
+     *
+     */
+	virtual void GetCoordinateByAddressL( const CPosLandmark& aLandmark,  
+                       const TConnectionOption aOption = EInteractive ) = 0;
+         
+    /**
+     * Gets the geo-coordinate information for the given address. This is an 
+     * asynchronous function whose completion will be notified by the 
+     * MMaptileGeocoderObserver::GeocodingCompleted callback.
+     * 
+     * @param aAddressDetails , containing the address informations.
+     * @param aOption  OCC setting option
+     *
+     */                   
+    virtual void GetCoordinateByAddressL( const TDesC& aAddressDetails,  
+	                       const TConnectionOption aOption = EInteractive ) = 0;
+	
+    /**
+     * Gets the maptile image path for the given geocordinates. This is an 
+     * asynchronous function whose completion will be notified by the 
+     * MMaptileGeocoderObserver::MapTileFetchingCompleted callback.
+     * 
+     * @param aMapTileParam Object containing the geocoordinate, zoom level 
+     *        informations.
+     * @param aFilePath  Path where the maptile image should  be stored.
+     *
+     */
+    virtual void GetMapTileByGeoCodeL( TMapTileParam& aMapTileParam,
+                                       const TDesC& aFilePath ) = 0;
+
+private:
+	
+    /**
+	 * iDtorKey
+	 * Identification of the plugin on cleanup
+ 	 */
+    TUid iDtorKey;
+};
+
+#include "maptilegeocoderplugin.inl"
+
+#endif //__MAPTILEGEOCODERPLUGIN_H__
+
+//End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/location_plat/location_data_harvester_api/inc/maptilegeocoderplugin.inl	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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: This is partial interface implementation which is 
+*              used by plugins. 
+* 
+*/
+
+
+
+// INCLUDE FILES
+
+#include <ecom/ecom.h>       // declares E-com framework classes
+
+
+// -----------------------------------------------------------------------------
+// CMaptileGeocoderPlugin::~CMaptileGeocoderPlugin()
+// Destroys the plugin implementation
+// -----------------------------------------------------------------------------
+//
+inline CMaptileGeocoderPlugin::~CMaptileGeocoderPlugin()
+{
+    REComSession::DestroyedImplementation( iDtorKey );
+}
+
+
+// -----------------------------------------------------------------------------
+// CMaptileGeocoderPlugin::NewL()
+// Creates the instance of CMaptileGeocoderPlugin concrete implementation.
+// -----------------------------------------------------------------------------
+//
+inline CMaptileGeocoderPlugin* CMaptileGeocoderPlugin::NewL()
+{
+    CMaptileGeocoderPlugin* self = reinterpret_cast<CMaptileGeocoderPlugin*>(
+        REComSession::CreateImplementationL(
+            KMaptileGeoCoderPluginUid, _FOFF( CMaptileGeocoderPlugin,iDtorKey ) ) );
+
+    return self;
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/location_plat/location_data_harvester_api/location_data_harvester_api.pri	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,18 @@
+#
+# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Location picker service api project file
+#
+
+PLATFORM_HEADERS += location_data_harvester_api\inc\maptilegeocoderplugin.h \
+                    location_data_harvester_api\inc\maptilegeocoderplugin.inl 
\ No newline at end of file
--- a/location_plat/location_plat.pro	Fri Apr 16 14:54:12 2010 +0300
+++ b/location_plat/location_plat.pro	Mon May 03 12:27:22 2010 +0300
@@ -18,6 +18,8 @@
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>"
 
 include(location_picker_service_api/location_picker_service_api.pri)
+include(location_data_harvester_api/location_data_harvester_api.pri)
+
 
 for(filename,PLATFORM_HEADERS){
     BLD_INF_RULES.prj_exports *= "$$filename APP_LAYER_PLATFORM_EXPORT_PATH($$basename(filename))"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/bwins/maptileserviceu.def	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?getMapTileImage@MapTileService@@SA?AVQString@@HW4AddressType@1@@Z @ 1 NONAME ; class QString MapTileService::getMapTileImage(int, enum MapTileService::AddressType)
+	?isLocationFeatureEnabled@MapTileService@@SA_NW4AppType@1@@Z @ 2 NONAME ; bool MapTileService::isLocationFeatureEnabled(enum MapTileService::AppType)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/eabi/maptileserviceu.def	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN14MapTileService15getMapTileImageEiNS_11AddressTypeE @ 1 NONAME
+	_ZN14MapTileService24isLocationFeatureEnabledENS_7AppTypeE @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/bwins/geocodeupdate.def	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?UpDate@GeocodeUpdate@@SAXJJNN@Z @ 1 NONAME ; void GeocodeUpdate::UpDate(long, long, double, double)
+	?CreateContactdb@GeocodeUpdate@@SAXXZ @ 2 NONAME ; void GeocodeUpdate::CreateContactdb(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/eabi/geocodeupdate.def	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN13GeocodeUpdate15CreateContactdbEv @ 1 NONAME
+	_ZN13GeocodeUpdate6UpDateElldd @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/group/bld.inf	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/group/geocodeupdate.mmp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/inc/geocodeupdate.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef __GEOCODEUPDATE_H__
+#define __GEOCODEUPDATE_H__
+
+#include <e32def.h> 
+
+// CLASS DECLARATION
+
+/**
+ * CntGeocodeUpdate, a class to update latitude and longtude into contact database
+ * for a perticular contact.
+ */
+class GeocodeUpdate 
+{
+public:    
+    /**
+     * Request to create contactmanager ,
+     * contactmanager will create contact db.    
+     */
+    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)
+     */
+
+    IMPORT_C static void UpDate(const TInt32 aCntId,
+            const TInt32 aCntAddressType, const TReal aLatitude,
+            const TReal aLongitude);
+};
+
+#endif // __GEOCODEUPDATE_H__ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/geocodeupdate/src/geocodeupdate.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#include <qcontactgeolocation.h>
+#include <qcontactmanager.h>
+#include <qtcontacts.h>
+#include <cntdef.h>
+#include <qstring>
+
+#include "geocodeupdate.h"
+#include "mylocationsdefines.h"
+#include "mylocationlogger.h"
+
+using namespace QTM_NAMESPACE;
+// ----------------------------------------------------------------------------
+// CGeocodeUpdate::CreateContactdb()
+// ----------------------------------------------------------------------------
+EXPORT_C void GeocodeUpdate::CreateContactdb()
+{
+    QContactManager* contactManger = NULL;
+    MYLOCLOGSTRING("call to create contactManger object and contactdb as well.");
+    contactManger = new QContactManager("symbian");
+    delete contactManger;
+}
+
+// ----------------------------------------------------------------------------
+// CGeocodeUpdate::UpDateL()
+// To update contact db with this latitude and longitude value 
+// ----------------------------------------------------------------------------
+EXPORT_C void GeocodeUpdate::UpDate(const TInt32 aCntId,
+        const TInt32 aCntAddressType, const TReal aLatitude,
+        const TReal aLongitude)
+
+{
+    __TRACE_CALLSTACK;
+    QContactManager* contactManger = NULL;
+    MYLOCLOGSTRING("call to create contactManger object .");
+    contactManger = new QContactManager("symbian");
+    MYLOCLOGSTRING("contactManger object created .");
+
+    MYLOCLOGSTRING("contactManger object is not null .");
+    QStringList definitionRestrictions;
+    QContact contact = contactManger->contact(aCntId ,definitionRestrictions);
+    QContactGeoLocation location;
+
+    switch (aCntAddressType)
+    {
+    case ESourceContactsPref:
+    {
+        break;
+    }
+    case ESourceContactsWork:
+    {
+        location.setContexts(QContactDetail::ContextWork);
+        break;
+    }
+    case ESourceContactsHome:
+    {
+        location.setContexts(QContactDetail::ContextHome);
+        break;
+    }
+    default:
+    {
+        break;
+    }
+    }
+    location.setLongitude(aLongitude);
+    location.setLatitude(aLatitude);
+    contact.saveDetail(&location);
+    contactManger->saveContact(&contact);
+    delete contactManger;
+
+}
+
+//end of line
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/inc/mylocationsdefines.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef __MYLOCATIONSDEFINES_H__
+#define __MYLOCATIONSDEFINES_H__
+
+/**
+ * TLookupItem struct.
+ * This structure defines a single lookup item.
+ */
+
+class TLookupItem
+{
+public:
+    // Uid of the source entry
+    TUint32 iUid;
+
+    // Source type
+    TUint32 iSource;
+
+    // Landmark uid in the landmarks database
+    TUint32 iLmId;
+   
+    // File Path
+    TFileName iFilePath;
+};
+
+/** 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
+};
+
+// lookup database folder path
+_LIT( KLookupDbPath, "c:\\mylocations\\" );
+
+//Mylocations resource file
+_LIT(KMyLocationsResourceFile, "z:\\resource\\apps\\mylocations.rsc");
+
+// My locations landmarks database uri.
+_LIT( KMylocationsDatabaseUri, "file://c:MyLocationsLandmarks.ldb" );
+
+// maptile database uri.
+_LIT( KMaptileDatabaseUri, "file://c:MyLocationsMaptile.ldb" );
+
+// History landmarks database uri.
+_LIT( KMapsHistoryUri, "file://c:MapsHistoryLandmarks.ldb" );
+
+// mylocations lookup database name
+_LIT( KMylocationsLookupDatabaseName, "mylocationslookup.db" );
+
+// maptile lookup database name
+_LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
+
+// landmarks lookup database name
+_LIT( KLandmarksLookupDatabaseName, "landmarkslookup.db" );
+
+// database column names
+_LIT( NColUid, "uid" );
+_LIT( NColSource, "source" );
+_LIT( NColLmUid, "lmuid" );
+
+// maptile database column names
+_LIT( NCntColUid, "cntuid" );
+_LIT( NCntColFilePath, "filepath" );
+
+// database table name
+_LIT( KLookupTable, "lookuptable" );
+
+// maptile database table name
+_LIT( KMapTileLookupTable, "cntmaptilelookuptable" );
+
+// uid column number
+const TInt KColumnUid = 1;
+// source type column number
+const TInt KColumnSource = 2;
+// landmark uid column number
+const TInt KColumnLmkUid = 3;
+
+// uid column number
+const TInt KColumncntUid = 1;
+// source type column number
+const TInt KColumnFilePath = 3;
+
+#endif  // __MYLOCATIONSDEFINES_H__
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/locationdataharvester.pro	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,39 @@
+#
+# 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 = subdirs
+SUBDIRS = maptileservice
+
+# 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 = /
+
+# IBY files
+iby.path = epoc32/rom/include/core/app
+iby.sources = mylocations.iby
+
+for(iby, iby.sources):BLD_INF_RULES.prj_exports += "./rom/$$iby $$deploy.path$$iby.path/$$iby"
+
+
Binary file locationdataharvester/maptileservice/conf/2002E6E8.txt has changed
Binary file locationdataharvester/maptileservice/conf/maptileservice.confml has changed
Binary file locationdataharvester/maptileservice/conf/maptileservice_2002E6E8.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/inc/maptiledblookuptable.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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: 
+*     Retrieving maptile path from lookup db
+*
+*/
+
+#ifndef __MAPTILEDBLOOKUPTABLE_H__
+#define __MAPTILEDBLOOKUPTABLE_H__
+
+//Headers needed
+#include <f32file.h> //RFs
+#include <d32dbms.h>  //RDbNamedDatabase,RDbView 
+
+// maptile database column names
+_LIT( NCntColUid, "cntuid" );
+_LIT( NAppColFilePath, "filepath" );
+_LIT( NColSource, "source" );
+
+// maptile lookup database name
+_LIT( KMapTileLookupDatabaseName, "mylocationsmaptilelookup.db" );
+
+// maptile database table name
+_LIT( KMapTileLookupTable, "cntmaptilelookuptable" );
+
+_LIT( KLookupDbPath, "c:\\mylocations\\" );
+
+// uid column number
+const TInt KColumnUid = 1;
+// source type column number
+const TInt KColumnSource = 2;
+// source type column number
+const TInt KColumnFilePath = 3;
+
+
+/**
+ *  Maptile database lookup entry
+ */
+class TLookupItem                            
+{
+public:
+    // Uid of the source entry
+    TUint32 iUid; 
+    
+    // Source type
+    TUint32 iSource;
+    
+    // Landmark uid in the landmarks database
+    TUint32 iLmId;
+    
+    // Uid of the Application
+    TUint32 iAppUid; 
+    
+    // File Path
+    TFileName iFilePath;
+};
+
+/**
+ *  Defines uid source type
+ */
+enum TUidSourceType
+{    
+    /** Uid Source type calendar plain address */
+    ESourceCalendar = 0,
+    /** Uid Source type contacts default/prefered address */
+    ESourceContactsPref = 3,
+    /** Uid Source type contacts work address */
+    ESourceContactsWork,
+    /** Uid Source type contacts home address */
+    ESourceContactsHome,
+    
+};
+
+/**
+ * CLookupMapTileDatabase class.
+ * This class handles all the operations related to maptile lookup database.
+ *
+ */
+class CLookupMapTileDatabase : public CBase
+{
+public:
+ 
+    /**
+    * This is a static function, which creates and returns an instance of this class.
+    */
+    static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
+
+    /**
+    * This is a static function, which creates and returns an instance of this class. 
+    * Pushes the created object to the cleanup stack.
+    */
+    static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
+
+    /**
+    * Destructor
+    */
+    ~CLookupMapTileDatabase();
+
+public:
+  
+   /**
+    * Finds an entry in the lookup table.
+    * @param[in/out] aLookupItem The lookup item to be found in the database.
+    * The source iUid is passed in the lookup item
+    */
+    void FindEntryL( TLookupItem& aLookupItem );
+
+private:
+    
+    // default constructor
+    CLookupMapTileDatabase();
+    
+    // Second phase constructor
+    void ConstructL( const TDesC& aLookupTableName );
+
+private:
+    
+    // Handle to the items database
+    RDbNamedDatabase iItemsDatabase;
+    
+    // handle to the file session
+    RFs iFsSession;
+        
+    // holds the database file name
+    TFileName iDbFileName;
+    
+    // holds the info about database existence.
+    TBool iDatabaseExists;
+
+};
+
+
+#endif  // __MAPTILEDBLOOKUPTABLE_H__`
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/inc/maptileservice.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* 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 interface
+*
+*/
+
+#ifndef _MAPTILESERVICE_H_
+#define _MAPTILESERVICE_H_
+
+
+#include <QString>
+#include <QtGlobal>
+
+
+#ifdef  MAPTILESERVICEDLL
+#define MAPTILESERVICE_EXPORT Q_DECL_EXPORT
+#else
+#define MAPTILESERVICE_EXPORT Q_DECL_IMPORT
+#endif
+
+
+
+// CLASS DECLARATION
+
+/**
+*  Maptile service class,  provides interface to get map tile image associated with 
+*  contact. Also provides interface to check whether location feature is enabled or disabled.
+*
+*  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
+*/
+class MAPTILESERVICE_EXPORT MapTileService 
+{
+
+public:
+
+    /**
+     * Application types      
+     */
+    enum AppType
+    {
+        /** Contacts application */
+        AppTypeContacts,
+        /** Calendar application */
+        AppTypeCalendar
+    };
+    /** 
+     * Address types
+     */
+    enum AddressType      
+    {
+        /** Plain Address Type */
+        AddressPlain,
+        /** Address Type Pref */
+        AddressPreference,
+        /** Address type Work */
+        AddressWork,
+        /** Address type Home */
+        AddressHome
+    };
+      
+   /**
+    * Checks whether location feature enabled or disabled for specific application.
+    * 
+    * @return Returns true or false based on location feature setting.
+    */
+    static bool isLocationFeatureEnabled(AppType appType);
+            
+   /**
+    * Gets a maptile image associated with a id(contact id/calendar id). 
+    * Returns a maptile image path if it is available otherwise returns NULL.
+    * 
+    * @param contactId  Contact id     
+    * @param sourceType Source address type( Preferred, Home , Work address )
+    *      
+    * @return Returns maptile image path if it is available, else NULL.
+    */
+    static QString getMapTileImage( int Id, AddressType sourceType  );  
+     	
+};
+
+#endif //MAPTILESERVICE_H_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/maptileservice.pro	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,74 @@
+#
+# 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 = maptileservice   
+
+CONFIG += dll
+CONFIG += hb
+    
+
+DEPENDPATH += .
+INCLUDEPATH += .
+INCLUDEPATH += ../inc
+
+
+MOC_DIR = moc
+
+DEFINES += MAPTILESERVICEDLL
+
+INTERNAL_PUBLIC_HEADERS +=  inc/maptileservice.h        
+
+# Input
+HEADERS +=  $$INTERNAL_PUBLIC_HEADERS \
+           ./inc/maptiledblookuptable.h  
+           
+               
+    
+SOURCES += ./src/maptileservice.cpp ./src/maptiledblookuptable.cpp
+
+symbian: 
+{
+
+    :BLD_INF_RULES.prj_exports += "conf/maptileservice.confml APP_LAYER_CONFML(maptileservice.confml)"
+    :BLD_INF_RULES.prj_exports += "conf/maptileservice_2002E6E8.crml APP_LAYER_CRML(maptileservice_2002E6E8.crml)"
+    :BLD_INF_RULES.prj_exports += "conf/2002E6E8.txt /epoc32/winscw/c/private/10202be9/2002E6E8.txt"
+    
+    TARGET.EPOCALLOWDLLDATA = 1
+    TARGET.CAPABILITY = All -Tcb
+    TARGET.UID3 = 0x2002E6E8
+
+    
+   LIBS += -ledbms  \
+           -lbafl \
+           -lcentralrepository \
+           -leuser
+   
+
+}  
+
+deploy.path = /
+headers.sources = $$INTERNAL_PUBLIC_HEADERS
+headers.path = epoc32/include/app
+DEPLOYMENT += exportheaders
+
+# This is for new exporting system coming in garden
+for(header, headers.sources):BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$headers.path/$$basename(header)"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/src/maptiledblookuptable.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* 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: 
+*     Retrieving maptile path from lookup db implementation
+*
+*/
+
+#include <bautils.h>
+#include "maptiledblookuptable.h"
+
+// select all from
+_LIT( KSelectAllFrom, "SELECT * FROM " );
+
+// string 'where'
+_LIT( KStringWhere, " WHERE " );
+
+// string ' = '
+_LIT( KStringEqual, " = " );
+
+// string 'And'
+_LIT( KStringAnd, " AND " );
+
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::CLookupMapTileDatabase()
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase::CLookupMapTileDatabase()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::~CLookupMapTileDatabase()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase::~CLookupMapTileDatabase()
+{
+
+    // close the database
+	iItemsDatabase.Close();
+	
+	// close the file session
+	iFsSession.Close();
+}
+ 
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::~CLookupMapTileDatabase()
+// Creates an object of this class and pushes to cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase* CLookupMapTileDatabase::NewLC( const TDesC& aLookupTableName )
+{
+    
+    CLookupMapTileDatabase* self = new (ELeave) CLookupMapTileDatabase;
+    CleanupStack::PushL(self);
+    self->ConstructL( aLookupTableName );
+    return self;
+}
+
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::NewL()
+// Creates an object of this class.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase* CLookupMapTileDatabase::NewL( const TDesC& aLookupTableName )
+{
+    CLookupMapTileDatabase* self = CLookupMapTileDatabase::NewLC( aLookupTableName );
+    CleanupStack::Pop( self );
+    return self;
+}
+ 
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::ConstructL()
+// 2nd phase contructor.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::ConstructL( const TDesC& aLookupTableName )
+{
+   
+    User::LeaveIfError( iFsSession.Connect() );
+    
+    iDbFileName.Copy( KLookupDbPath );
+    iDbFileName.Append( aLookupTableName );
+    
+    iDatabaseExists = EFalse; 
+
+    if( BaflUtils::FileExists( iFsSession, iDbFileName ) )
+    {	
+        // database exists 
+        iDatabaseExists = ETrue; 
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::FindEntryL()
+// Finds an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::FindEntryL( TLookupItem& aLookupItem )
+{ 
+   
+    // used to check whether entry available or not
+    TBool entryAvailable = EFalse;
+  
+    if ( iDatabaseExists )
+    {
+
+        // Create a query to find the item.
+        TFileName queryBuffer;
+        queryBuffer.Copy( KSelectAllFrom );
+        queryBuffer.Append( KMapTileLookupTable );
+        queryBuffer.Append( KStringWhere );
+        queryBuffer.Append( NCntColUid );
+        queryBuffer.Append( KStringEqual );
+        queryBuffer.AppendNum( aLookupItem.iUid );
+        queryBuffer.Append( KStringAnd );
+        queryBuffer.Append( NColSource );
+        queryBuffer.Append( KStringEqual );
+        queryBuffer.AppendNum( aLookupItem.iSource );
+        
+        TInt ret = iItemsDatabase.Open( iFsSession, iDbFileName );
+        
+        if( ret != KErrNone )
+        {          
+            //if already opened , close and open again
+            iItemsDatabase.Close();          
+            User::LeaveIfError( iItemsDatabase.Open( iFsSession, iDbFileName ) );
+        }
+        User::LeaveIfError( iItemsDatabase.Begin() );       
+        // Create a view of the table with the above query.
+        RDbView myView;
+        myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) );
+        CleanupClosePushL( myView );
+        myView.EvaluateAll();
+        myView.FirstL();
+    
+        if( myView.AtRow() ) 
+        {  
+            // Item found. get the details.
+            myView.GetL();      
+            if( aLookupItem.iUid == myView.ColUint( KColumnUid ) )
+            {               
+                aLookupItem.iFilePath.Copy( myView.ColDes16( KColumnFilePath ) );
+                entryAvailable = ETrue;
+            }      
+        } 
+    
+        CleanupStack::PopAndDestroy( &myView ); // myView
+        
+        //Close the database
+        iItemsDatabase.Close();
+    }
+   
+    //No entry found 
+    if( !entryAvailable )
+    {
+        User::Leave( KErrNotFound );
+    }
+}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/src/maptileservice.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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 implementation
+*
+*/
+
+
+#include <centralrepository.h> 
+
+#include "maptileservice.h"
+#include "maptiledblookuptable.h"
+
+// CONSTANTS
+// Maptile interface uid
+const TUid KUidMapTileInterface = { 0x2002E6E8 };
+// Central Repository Key IDs
+const TInt KEnableLocationFeature  = 0x1;
+const TInt KLocationFeatureAppContacts      = 0x1;
+const TInt KLocationFeatureAppCalendar      = 0x2;
+
+
+// -----------------------------------------------------------------------------
+// MapTileService::isLocationFeatureEnabled()
+// Checks whether location feature is enabled or disabled
+// -----------------------------------------------------------------------------
+//
+bool MapTileService::isLocationFeatureEnabled(AppType appType)
+{ 
+   
+    //Create the centrep with uid 0x2002C3A8
+    bool iLocationFeatureEnabled = false;
+    
+    CRepository* centralRepository = NULL;  
+     
+    TRAPD( err, centralRepository = CRepository::NewL( KUidMapTileInterface ) );
+    if ( KErrNone == err )
+    {
+        TInt repValue;
+      
+        //Get the Location feature flag
+        int ret=0;
+        if ( appType == AppTypeContacts )
+        {
+            ret = centralRepository->Get( KEnableLocationFeature , repValue );
+        }
+        else if ( appType == AppTypeCalendar )
+        {
+             ret = centralRepository->Get( KEnableLocationFeature , repValue );
+        }
+      
+        if ( ret == KErrNone && repValue == 1 )
+        {
+            iLocationFeatureEnabled  = true;
+        }
+           
+         delete centralRepository;
+    }
+           
+    return iLocationFeatureEnabled;
+    
+}
+
+
+// -----------------------------------------------------------------------------
+// MapTileService::getMapTileImage()
+// Gets the maptile image path associated with a contact.
+// -----------------------------------------------------------------------------
+//
+QString MapTileService::getMapTileImage( int id, AddressType sourceType )    
+{
+   
+    //Image file to return;
+   
+    //Maptile database  instance
+    CLookupMapTileDatabase* mapTileDatabase = NULL;
+   
+    TRAPD( err, mapTileDatabase = CLookupMapTileDatabase::NewL(
+            KMapTileLookupDatabaseName ) );
+    if ( KErrNone == err )
+    {
+        TLookupItem lookupItem;
+        lookupItem.iUid = id;
+        switch( sourceType )
+        {
+            case AddressPlain:
+                lookupItem.iSource = ESourceCalendar;
+                break;
+           case AddressPreference:
+               lookupItem.iSource = ESourceContactsPref;
+               break;
+           case AddressWork:
+               lookupItem.iSource = ESourceContactsWork;
+               break;
+           case AddressHome:
+               lookupItem.iSource = ESourceContactsHome;
+               break;
+           default: 
+               break;
+        }
+       
+        TRAP( err , mapTileDatabase->FindEntryL( lookupItem ) );
+       
+        //delet the database instance
+        delete mapTileDatabase;
+       
+        //if entry available returns the file path otherwise NULL. 
+        if ( KErrNone == err  )
+        {
+           //Get the image path
+            QString imageFile((QChar*)lookupItem.iFilePath.Ptr(),
+                    lookupItem.iFilePath.Length());
+            return imageFile;
+        }
+    }
+    
+    return QString();
+}
+
+// End of file
+
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/homeaddressmap.png has changed
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/preferredaddressmap.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,270 @@
+/*
+* 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: 
+*
+*/
+#include <QtTest/QtTest>
+#include <QtGui>
+#include <QString>
+#include <qtcontacts.h>
+#include <qcontactmanager.h>
+
+
+#include "maptileservice.h"
+
+
+//Maximum maptile processing time
+const int KMapTileFetchTime  = 150000;
+
+QTM_USE_NAMESPACE
+
+
+//Maptile test interface class
+class MaptileServiceTest: public QObject
+{
+    Q_OBJECT
+    
+private slots:
+    
+    void checkLocationFeature();
+    void getPreferredAddressMapTilePath();
+    void getWorkAddressMapTilePath();
+    void getHomeAddressMapTilePath();
+    void checkInvalidContactId();
+ 
+};
+
+
+//Checks whether location feature enabled or disabled
+void MaptileServiceTest::checkLocationFeature()
+{
+   
+    QVERIFY( CntMapTileService::isLocationFeatureEnabled() == 1 );
+}
+
+//Checks the maptile path retrieval for preferred address
+void MaptileServiceTest::getPreferredAddressMapTilePath()
+{
+    
+    QContact* contact = new QContact();
+    
+    //Add contact name   
+    QContactName* name = new QContactName();
+    name->setFirst("Raj");
+    contact->saveDetail( name );
+    
+    //Add address
+    QContactAddress* address = new QContactAddress();
+    address->setPostOfficeBox("87640");
+    address->setStreet("Torstrasse");
+    address->setPostcode("12345");
+    address->setLocality("Berlin");
+    address->setCountry("Germany");
+    contact->saveDetail(address);
+    
+    //Save the contact
+    QContactManager* contactManager = NULL;
+    contactManager = new QContactManager("symbian");
+    contactManager->saveContact( contact );
+    
+    //Wait till maptile operation complete
+    QTest::qWait( KMapTileFetchTime );
+    
+   
+    //Get the saved id
+    QContactId savedId = contact->id();
+    TUint32 contactId = savedId.localId();
+    
+    //Get the maptile 
+    QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressPreference );
+    
+    //Construct the QPimap from reference bitmap
+    QImage referenceBitmap( "c:\\maptiletest\\preferredaddressmap.png" );
+    
+    //Construct the QPixmap from new retrieved bitmap
+    QImage retrievedBitmap( string );
+    
+      
+    //delete the contact
+    contactManager->removeContact( contactId );
+    
+    delete contact;
+    delete name;
+    delete address;
+    delete contactManager;
+    
+}
+
+//Checks the maptile path retrieval for work address
+void MaptileServiceTest::getWorkAddressMapTilePath()
+{
+    
+    QContact* contact = new QContact();
+    
+    //Set name
+    QContactName* name = new QContactName();
+    name->setFirst("Mike");
+    contact->saveDetail(name);
+    
+    //Set address
+    QContactAddress* address = new QContactAddress();
+    address->setPostOfficeBox("2345");
+    address->setPostcode("29834");
+    address->setStreet("Domlur");
+    address->setLocality("Bangalore");
+    address->setCountry("India");
+    address->setContexts(QContactDetail::ContextWork);
+    contact->saveDetail(address);
+    
+    //Save the contact
+    QContactManager* contactManager = NULL;
+    contactManager = new QContactManager("symbian");
+    contactManager->saveContact( contact );
+      
+    //Wait till maptile operation complete
+    QTest::qWait( KMapTileFetchTime );
+    
+     
+    //Get the saved id
+    QContactId savedId = contact->id();
+    TUint32 contactId = savedId.localId();
+    
+    //Get the maptile 
+    QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressWork );
+    
+    //Construct the QPimap from already stored bitmap
+    QImage referenceBitmap( "c:\\maptiletest\\workaddressmap.png" );
+    
+    //Construct the QPixmap from new retrieved bitmap
+    QImage retrievedBitmap( string );
+    
+    //check results are same
+    QVERIFY( retrievedBitmap == referenceBitmap );
+    
+        
+    contactManager->removeContact( contactId );
+    
+    delete contact;
+    delete name;
+    delete address;
+    delete contactManager;
+    
+}
+
+//Checks the maptile path retrieval for home address
+void MaptileServiceTest::getHomeAddressMapTilePath()
+{
+    
+    QContact* contact = new QContact();
+        
+    QContactName* name = new QContactName();
+    name->setFirst("first");
+    contact->saveDetail(name);
+    
+    QContactAddress* address = new QContactAddress();
+    address->setContexts(QContactDetail::ContextHome);
+    address->setPostOfficeBox("81282");
+    address->setStreet("Keilalahdentie");
+    address->setPostcode("67890");
+    address->setLocality("Espoo");
+    address->setCountry("Finland");
+    contact->saveDetail(address);
+    
+    //Save the contact
+    QContactManager* contactManager = NULL;
+    contactManager = new QContactManager("symbian");
+    contactManager->saveContact( contact );
+    
+    //Wait till maptile operation complete
+    QTest::qWait( KMapTileFetchTime );
+    
+    //Get the saved id
+    QContactId savedId = contact->id();
+    TUint32 contactId = savedId.localId();
+    
+    //Get the maptile 
+    QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressHome );
+    
+    //Construct the QPimap from already stored bitmap
+    QImage referenceBitmap( "c:\\maptiletest\\homeaddressmap.png" );
+    
+    //Construct the QPixmap from new retrieved bitmap
+    QImage retrievedBitmap( string );
+    
+    //comapre the bitmaps
+    QVERIFY( retrievedBitmap == referenceBitmap );
+    
+      
+    contactManager->removeContact( contactId );
+    
+    delete contact;
+    delete name;
+    delete address;
+    delete contactManager;
+    
+}
+
+//Checks the maptile path retrieval returns NULL for invalid address
+void  MaptileServiceTest::checkInvalidContactId()
+{
+    
+    QContact* contact = new QContact();
+   
+    QContactName* name = new QContactName();
+    name->setFirst("first");
+    contact->saveDetail(name);
+    
+    //Add some invalid address
+    QContactAddress* address = new QContactAddress();
+    address->setPostOfficeBox("11111");
+    address->setStreet("htrtfdsk");
+    address->setPostcode("98989");
+    address->setLocality("ghwdxnkwnn");
+    address->setCountry("Fbsjwskws");
+    contact->saveDetail(address);
+    
+    //Save the contact
+    QContactManager* contactManager = NULL;
+    contactManager = new QContactManager("symbian");
+    contactManager->saveContact( contact );
+    
+    //Wait till maptile operation complete
+    QTest::qWait( KMapTileFetchTime );
+    
+     
+    //Get the saved id
+    QContactId savedId = contact->id();
+    TUint32 contactId = savedId.localId();
+    
+    //Get the maptile 
+    QString string = CntMapTileService::getMapTileImage( contactId, CntMapTileService::AddressPreference );
+    
+    contactManager->removeContact( contactId );
+    
+    //Maptile path should be NULL for invalid address
+    QVERIFY( string.isNull() );
+    
+    delete contact;
+    delete name;
+    delete address;
+    delete contactManager;
+    
+  
+}
+
+
+QTEST_MAIN(MaptileServiceTest)
+#include "ut_maptileservice.moc"
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/maptileservice/tsrc/ut_maptileservice/ut_maptileservice.pro	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,38 @@
+#
+# 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
+QT += testlib
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../inc
+
+symbian:
+{
+   :BLD_INF_RULES.prj_exports += "preferredaddressmap.png /epoc32/winscw/c/maptiletest/preferredaddressmap.png"
+   :BLD_INF_RULES.prj_exports += "workaddressmap.png /epoc32/winscw/c/maptiletest/workaddressmap.png"
+   :BLD_INF_RULES.prj_exports += "homeaddressmap.png /epoc32/winscw/c/maptiletest/homeaddressmap.png"
+   SYSTEMINCLUDEPATH += \epoc32\include\stdapis
+}
+
+SOURCES += ut_maptileservice.cpp
+
+
+LIBS += -lmaptileservice \
+        -lQtContacts 
+
+TARGET.CAPABILITY = ALL -TCB    
+
Binary file locationdataharvester/maptileservice/tsrc/ut_maptileservice/workaddressmap.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationlogger/inc/mylocationlogger.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+#ifndef MYLOCATIONLOGGER_H
+#define MYLOCATIONLOGGER_H
+#include <e32base.h> 
+#include <e32std.h> 
+#include <e32des8.h>
+#include <e32svr.h>
+#include "mylocloggingconfiguration.h"
+_LIT( KLogsDir, "Mylocation");
+_LIT( KLogFileName, "Mylocation.log");
+
+/*
+ We have 3 possible logging methods:
+
+ set MYLOC_LOGGING_METHOD to 0 to get no logging at all
+ set MYLOC_LOGGING_METHOD to 1 to get logging via RDebug::Print
+ set MYLOC_LOGGING_METHOD to 2 to get logging to log file
+
+ Switching on/off is done in the Configuration file (MyLocLoggingConfiguration.h)
+ */
+
+#if ( defined (_MYLOCLOGGING) )
+#if ( defined (_MYLOC_LOGGING_TO_FILE))
+#define MYLOC_LOGGING_METHOD 2
+#else
+#define MYLOC_LOGGING_METHOD 1
+#endif
+#else
+#define MYLOC_LOGGING_METHOD 0
+#endif
+
+#if (MYLOC_LOGGING_METHOD==0)
+#define MYLOCLOGSTRING(C)
+#define MYLOCLOGSTRING1(C, X)
+#define MYLOCLOGSTRING2(C, X, Y)
+#define MYLOCLOGSTRING3(C, X, Y, Z)
+#define MYLOCLOGSTRING4(C, X, Y, Z, A)
+#endif
+#if (MYLOC_LOGGING_METHOD==1)
+#define MYLOCLOGSTRING(C)                RDebug::Print(_L(C));
+#define MYLOCLOGSTRING1(C, X)            RDebug::Print(_L(C),X);
+#define MYLOCLOGSTRING2(C, X, Y)         RDebug::Print(_L(C),X, Y);
+#define MYLOCLOGSTRING3(C, X, Y, Z)      RDebug::Print(_L(C),X, Y, Z);
+#define MYLOCLOGSTRING4(C, X, Y, Z, A)   RDebug::Print(_L(C),X, Y, Z, A);
+#endif
+#if (MYLOC_LOGGING_METHOD==2)
+#ifndef __COMMSDEBUGUTILITY_H__
+#define __COMMSDEBUGUTILITY_H__
+#include <flogger.h>
+#endif
+
+
+#define MYLOCLOGSTRING(C)                {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, tempLogDes());}
+#define MYLOCLOGSTRING1(C, X)            {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X);}
+#define MYLOCLOGSTRING2(C, X, Y)         {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y);}
+#define MYLOCLOGSTRING3(C, X, Y, Z)      {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z);}
+#define MYLOCLOGSTRING4(C, X, Y, Z, A)   {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z,A);}
+#endif
+
+/*
+ *Trace implementation
+ * Description:
+ * Macro definition file for logging.
+ */
+
+#if !(MYLOC_LOGGING_METHOD == 0)
+#ifdef __cplusplus
+
+// define the following macro to enable call stack trace.
+#define FUNCTION_ETRY_EXIT
+
+const TInt KMaxLogLength = 256;
+class CLogFunctionEntryExit : public CBase
+{
+public:
+    CLogFunctionEntryExit(const char* aFunctionName, const TInt aLineNo) :
+        iFunctionName(aFunctionName)
+    {
+    #if (MYLOC_LOGGING_METHOD == 2)
+            iBuffer = HBufC8::New(KMaxLogLength);
+            if (iBuffer != NULL)
+            {
+                TPtr8 buf = iBuffer->Des();
+                buf.Copy((const TUint8 *) aFunctionName);
+                _LIT8(KFormat,"=> %S [%02d])");
+                RFileLogger::WriteFormat(KLogsDir(), KLogFileName(),
+                        EFileLoggingModeAppend, TRefByValue<const TDesC8> (
+                                KFormat()), &buf, aLineNo);
+            }
+    #else                
+            RDebug::Printf("=> %s [%02d])", iFunctionName, aLineNo);
+    #endif                
+        }
+        ~CLogFunctionEntryExit()
+        {
+    #if (MYLOC_LOGGING_METHOD == 2)
+            TPtr8 buf = iBuffer->Des();
+            _LIT8(KFormat,"<= %S");
+            RFileLogger::WriteFormat(KLogsDir(), KLogFileName(),
+                    EFileLoggingModeAppend, TRefByValue<const TDesC8> (KFormat()),
+                    &buf);
+            delete iBuffer;
+    #else            
+            RDebug::Printf("<= %s", iFunctionName);
+    #endif            
+        }
+private:
+        const char* iFunctionName;
+    #if (MYLOC_LOGGING_METHOD == 2)
+        HBufC8* iBuffer;
+    #endif
+};
+
+#ifdef FUNCTION_ETRY_EXIT
+// track
+#pragma message ("MyLocation Call stack trace - ENABLE")
+#define __TRACE_CALLSTACK CLogFunctionEntryExit functionEtryExit(__PRETTY_FUNCTION__,__LINE__)
+#endif
+#endif // __cplusplus
+#endif //
+#ifndef __TRACE_CALLSTACK
+// don't track function enter and exit
+#pragma message ("MyLocation Call stack trace - DISABLE")
+#define __TRACE_CALLSTACK
+#endif
+
+#endif //MYLOCATIONLOGGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationlogger/inc/mylocloggingconfiguration.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+#ifndef MYLOCCONFIGURATION_H
+#define MYLOCCONFIGURATION_H
+
+//#ifdef _DEBUG // logging to file in debug only
+
+/**
+* Have this line active if you want to have logging for this component.
+* Comment this line out if you don't want any logging for this component.
+*/
+#define _MYLOCLOGGING
+
+/**
+* Have this line active if you want to have logging to file.
+* Comment this line out if you want to have logging via RDebug::Print.
+*/
+#define _MYLOC_LOGGING_TO_FILE
+
+/**
+* Have this line active in case you want to have plugin loading performance
+* measurements activated.
+*/
+//#define _MYLOC_PERFORMANCE_TRACES
+
+//#endif // _DEBUG
+
+#endif // MYLOCCONFIGURATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/data/mylocations.rss	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/group/bld.inf	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: bld.inf for mylocationengine
+*
+*/
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mylocations.loc       APP_LAYER_LOC_EXPORT_PATH(mylocations.loc)
+
+PRJ_MMPFILES
+mylocationsengine.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/group/mylocationsengine.mmp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/addresscomparision.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Address comparison header file implementation.
+*
+*/
+
+#ifndef ADDRESSCOMPARISION_H_
+#define ADDRESSCOMPARISION_H_
+#include <epos_cposlandmarkdatabase.h>
+#include "mylocationslookupdb.h"
+class CAddressComparision : public CBase
+    {
+public:
+  
+    static CAddressComparision* NewL(); 
+    /**
+        * Is edited address changed .
+        * @param aLandmarks handle to all type of address
+        * @param aCntId contact id.
+        * @param aAddressType type of address
+        * @return Status code(ETrue address is  changed ,EFalse is not changed)
+        */
+    TBool IsAddressChangedL( const CPosLandmark& aLandmarks, const TInt32 aCntId,
+                             const TUidSourceType aAddressType );
+    
+private:
+    
+    /**
+     * CAdressComparision.
+     * C++ default constructor. 
+     */
+    CAddressComparision();
+       
+    // Handle to landmarks db
+    CPosLandmarkDatabase* iLandmarkDb;
+
+    // Handle to the My locations database manager
+    CLookupDatabase *iLookUpDatabase;
+    };
+#endif /* ADDRESSCOMPARISION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/appmain.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* 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: Application main header.
+*
+*/
+
+#ifndef __APPMAIN_H__
+#define __APPMAIN_H__
+
+//  Include Files
+
+#include <e32base.h>
+
+//  Function Prototypes
+
+GLDEF_C TInt E32Main();
+
+#endif  // __APPMAIN_H__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/calendernotification.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,89 @@
+/*
+ * 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: calender db create notification .
+ *
+ */
+
+#ifndef CALENDERNOTIFICATION_H_
+#define CALENDERNOTIFICATION_H_
+
+// INCLUDES
+
+#include <e32base.h>
+#include <f32file.h>
+
+/**  
+ * The observer class gives notification to derive class .
+ * When calender db creates in specific path.
+ */
+class MNotifyChange
+{
+public:
+    virtual void NotifyChangeL(TInt &aStatus)=0;
+};
+
+class CCalenderNotification : public CActive
+{
+public:
+    /** 
+     * CCalenderNotification::NewL()
+     */
+    static CCalenderNotification* NewL(MNotifyChange* aNotifyChange);
+
+    /** 
+     * CCalenderNotification::NewL()
+     */
+    static CCalenderNotification* NewLC(MNotifyChange* aNotifyChange);
+    /**
+     * ~CCalenderNotification.
+     * Virtual Destructor.
+     */
+    virtual ~ CCalenderNotification();
+
+private:
+    /**
+     * ConstructL.
+     * 2nd phase constructor.
+     */
+    void ConstructL(MNotifyChange* aNotifyChange);
+    /**
+     * CMyLocationsEngine.
+     * C++ default constructor. 
+     */
+    CCalenderNotification(MNotifyChange* aNotifyChange);
+    
+public:
+    
+    /**
+     * CheckCalenderDbFileStructure.
+     * Observes the calendar db file structure changes. 
+     */
+    void CheckCalenderDbFileStructure( TChar aDrive );
+
+    /**
+     *  Handles active object's request completion event. 
+     */
+    void RunL();
+    /** 
+     * Implements cancellation of an outstanding request. 
+     */
+    void DoCancel();
+private:
+    //data member
+    //file server 
+    RFs iFsession;
+    //observer to provide notification on completion of event
+    MNotifyChange& iNotifyChange;
+};
+#endif /* CALENDERNOTIFICATION_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/lookupmaptiledb.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Maptile database lookup table header.
+*
+*/
+
+#ifndef __LOOKUPMAPTILEDB_H__
+#define __LOOKUPMAPTILEDB_H__
+
+//Headers needed
+#include <f32file.h> //RFs
+#include <d32dbms.h>  //RDbNamedDatabase,RDbView 
+
+#include "mylocationsdefines.h"
+ 
+/**
+ * CLookupMapTileDatabase class.
+ * This class handles all the operations related to maptile lookup database.
+ *
+ */
+ 
+class CLookupMapTileDatabase : public CBase
+{
+public:
+    // Two phase constructors
+ 
+    /**
+    * This is a static function, which creates and returns an instance of this class.
+    */
+    static CLookupMapTileDatabase* NewL( const TDesC& aLookupTableName );
+
+    /**
+    * This is a static function, which creates and returns an instance of this class. Pushes the created object 
+    * to the cleanup stack.
+    */
+    static CLookupMapTileDatabase* NewLC( const TDesC& aLookupTableName );
+
+    /**
+    * Destructor
+    */
+    ~CLookupMapTileDatabase();
+
+public:
+
+    /**
+    * Opens the lookup database.
+    */
+    TInt Open();
+
+    /**
+    * Closes the lookup database.
+    */
+    void Close();
+
+    /**
+    * Creates an entry in the lookup table.
+    * @param[in] aLookupItem The lookup item to be created in the database.
+    */
+    void CreateEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Updates an entry in the lookup table.
+    * @param[in] aLookupItem The lookup item to be updated in the database.
+    */
+    void UpdateEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Deletes an entry from the lookup table.
+    * @param[in] aLookupItem The lookup item to be deleted from the database.
+    */
+    void DeleteEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Finds an entry in the lookup table.
+    * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid is passed
+    * in the lookup item
+    * @return ETrue if found, else EFalse
+    */
+    TBool FindEntryL( TLookupItem& aLookupItem);
+
+
+
+private:
+    
+    // default constructor
+    CLookupMapTileDatabase();
+    
+    // Second phase constructor
+    void ConstructL( const TDesC& aLookupTableName );
+    
+    // Creates a lookup table in the lookup database.
+    void CreateTableL(RDbDatabase& aDatabase);
+          
+private:
+    
+    // Handle to the items database
+    RDbNamedDatabase iItemsDatabase;
+    
+    // handle to the file session
+    RFs iFsSession;
+        
+    // holds the database file name
+    TFileName iDbFileName;
+
+};
+
+
+#endif  // __LOOKUPMAPTILEDB_H__
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/maptileinterface.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,143 @@
+/*
+* 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 interface header implementation.
+*
+*/
+
+#ifndef __MAPTILEINTERFACE_H__
+#define __MAPTIlEINTERFACE_H__
+
+#include <e32std.h> 
+#include <e32base.h>
+
+#include <maptilegeocoderplugin.h>
+
+
+ 
+/**
+ * MMapTileObserver class.
+ * Observer class for notifying the maptile related events 
+ *
+ */
+class MMapTileObserver
+    {
+public:   
+    
+   /** Informs once maptile is retrived from the REST server
+    * 
+    * @param[in] aErrCode Error code
+    * @param[in] aMapTilePath Path where the maptile image staroed
+    * 
+    */    
+    virtual void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath ) = 0;
+    
+    /** Informs once geocoding completed 
+     * 
+     * @param[in] aLatitude converted latitude value
+     * @param[in] aLongitude converted longitude value
+     * 
+     */       
+    virtual void RestGeoCodeCompleted( TReal aLatitude,TReal aLongitude ) = 0;
+    
+    };
+
+
+
+/** 
+ * Class used for interacting with maptile and geocoder components .
+ * This class raises the request for geocoding service and maptile
+ * fetching service.
+ */
+class CMapTileInterface : public CBase, MMaptileGeocoderObserver
+{
+public:
+
+   /**
+    * Factory method
+    */
+    static CMapTileInterface* NewL(); 
+    
+    /**
+     * Interface for requesting maptile image for a landmark object
+     * 
+     * @param[in] aLandmark Landmark containing address details
+     * @param[in] aFilePath Path where the maptile image to be stored
+     * @param[in] aObserver Observer for callback notification
+     */
+    void GetMapTileImageL(  CPosLandmark*  aLandmark , 
+            const TDesC& aFilePath,   MMapTileObserver* aObserver  );
+    
+    /**
+     * Interface for requesting maptile image for a landmark object
+     * 
+     * @param[in] aAddressDetails containing address details
+     * @param[in] aFilePath Path where the maptile image to be stored
+     * @param[in] aObserver Observer for callback notification
+     */
+    void GetMapTileImageL(const TDesC& aAddressDetails,
+            const TDesC& aFilePath, MMapTileObserver* aObserver);
+    
+    /**
+     * Constructor
+     */
+    CMapTileInterface();
+    
+    /**
+     * Destructor
+     */
+    ~CMapTileInterface();
+
+private:
+
+    /**
+     * Function for Retrieving latitude & longitude information
+     * 
+     * @param[in] aLatitude latitude value
+     * @param[in] aLongitude Longitude value
+     */
+	void GetMapTileL( TReal aLatitude, TReal aLongitude	);
+    
+protected: 
+	
+    /**
+     * Derived from MMaptileGeocoderObserver
+     */
+    void GeocodingCompleted( TInt aErrorcode, MAddressInfo& aAddressInfo );
+    
+    /**
+     * Derived from MMaptileGeocoderObserver
+     */
+    void MapTileFetchingCompleted( TInt aErrorcode, const TDesC& aMapImagePath );
+    
+private:
+    
+    /**
+     * Two phase construction
+     */
+    void ConstructL();
+    
+private:
+	
+    //MaptileGeocode plugin interface instance
+    CMaptileGeocoderPlugin* iMaptileGeocoder;
+    //Flag to check street availability
+    TBool iStreetAvailable;
+    //Maptile image path
+	HBufC* iFilePath;
+	//Maptile observer
+	MMapTileObserver* iObserver ;
+
+    };
+#endif // MAPTILEINTERFACE_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,242 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Database manager implementation for location picker and
+*              maptile service.
+*
+*/
+
+#ifndef __MYLOCATIONSDATABASEMANAGER_H__
+#define __MYLOCATIONSDATABASEMANAGER_H__
+
+// Landmarks
+#include<epos_cposlandmarkdatabase.h>
+#include <EPos_CPosLmCategoryManager.h>
+
+// Lookup database
+#include "mylocationslookupdb.h"
+
+// Maximum string length of landmark address.
+const TUint32 KMaxAddressLength = 255; 
+
+/** Defines entry change type
+*/
+enum TEntryChangeType
+    {
+    /** Entry added */
+    EEntryAdded,
+    /** Entry modified */
+    EEntryModified,
+    /** Entry deleted */
+    EEntryDeleted,
+    /** Entry change unknown */
+    EEntryUnknown
+    };
+
+
+/**
+ * CMyLocationsDatabaseManager class.
+ *  This class handles all the operations related to mylocations landmark database.
+ *
+ */
+class CMyLocationsDatabaseManager : public CBase
+    {
+    public:
+        // Constructors and destructor
+    
+        /**
+         * ConstructL.
+         * 2nd phase constructor.
+         */
+        void ConstructL();
+    
+        /**
+         * CMyLocationsDatabaseManager.
+         * C++ default constructor. 
+         */
+        CMyLocationsDatabaseManager();
+    
+        /**
+         * ~CMyLocationsDatabaseManager.
+         * Virtual Destructor.
+         */
+        virtual ~CMyLocationsDatabaseManager();
+        
+    public:
+        /**
+         * UpdateDatabaseL.
+         * Updates the location into the landmark database and lookup table. 
+         * Based on the entry source type and the entry change type the updation can be 
+         * addition/modification/deletion.
+         * 
+         * @param[in] aLandmark Landmark object to be updated in the database.
+         * @param[in] aUid Uid of the changed source entry.
+         * @param[in] aSourceType Source type of the aUid.
+         * @param[in] aChangeType Type of change to the entry ( added/modified/deleted )
+         */
+        void UpdateDatabaseL( CPosLandmark* aLandmark, const TUint32 aUid, 
+                              const TUint32 aSourceType, const TEntryChangeType aChangeType );
+        
+        /** Gets the full address from a given landmark object
+         *
+         * @param[out] aLandmarkAddress comma separated landmark's full address
+         * @param[in] aLandmark landmark object whose address needs to be found.
+         */      
+        void GetLandmarkFullAddress( TBuf<KMaxAddressLength>& aLandmarkAddress, 
+                                     const CPosLandmark* aLandmark );
+
+        
+    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.
+         */
+        void AddMylocationsCategoryL( const TUint32 aCategoryType );
+
+        /**
+         * CheckIfDuplicateExistsL.
+         * Checks if this landmark is already present in database. 
+         * If present returns the landmark id, else 0.
+         * @param[in] aLandmark A landmark object to be checked for.
+         * @returns If no duplicate is found in database returns 0 
+         * else returns the id of the found landmark.
+         */
+        TPosLmItemId CheckIfDuplicateExistsL( const CPosLandmark* aLandmark );
+        
+        /**
+         * CompareLandmarks.
+         * Compares two landmarks. Only the text fields, landmark name, 
+         * street, city, state country and postal code are compared. 
+         * @param[in] aLandmark1 First landmark object to be compared.
+         * @param[in] aLandmark2 Second landmark object to be compared.
+         * @returns ETrue if the landmarks are same, else returns EFalse.
+         */
+       TBool CompareLandmarks( const CPosLandmark* alandmark1, 
+                               const CPosLandmark* alandmark2 );
+        
+       /**
+         * HandleEntryAdditionL.
+         * Handles the entry addition in lookup table and landmarks db
+         * @param[in] aLandmark Landmark object added.
+         * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+         * @param[in] aSourceType source type of the aUid passed.
+        */
+       void HandleEntryAdditionL( CPosLandmark*  aLandmark, const TUint32 aUid,
+                                  const TUint32 aSourceType );
+
+       /**
+         * HandleEntryModificationL.
+         * Handles the entry modification in lookup table and landmarks db
+         * @param[in] aLandmark Landmark object modified.
+         * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+         * @param[in] aSourceType source type of the aUid passed.
+        */
+       void HandleEntryModificationL( CPosLandmark*  aLandmark, const TUint32 aUid,
+                                      const TUint32 aSourceType );
+
+       /**
+         * HandleEntryDeletionL.
+         * Handles the entry deletion in lookup table and landmarks db
+         * @param[in] aUid Uid of the source entry corresponding to aLandmark..
+         * @param[in] aSourceType source type of the aUid passed.
+        */
+       void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
+
+       /**
+         * 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
+         * @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 );
+
+       /**
+          * CheckAndReadLandmarkL.
+          * Checks whether a category is available in database pointed by category manager.
+          * @param[in] CPosLandmarkDatabase handle to the database manager
+          * @param[in] aLmId Id of the landmark
+          * @returns landmark object if found else NULL
+         */
+       CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL( 
+                       CPosLandmarkDatabase* aDb, const TUint32 aLmId );
+       
+    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
+        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 landmarks category manager
+        CPosLmCategoryManager* iLandmarksCatManager;
+        
+        // handle to the file session
+        RFs iFsSession;
+       
+    };
+
+#endif  // __MYLOCATIONSDATABASEMANAGER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/mylocationsengine.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,320 @@
+/*
+* 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 header implementation.
+*
+*/
+
+
+#ifndef __MYLOCATIONSENGINE_H__
+#define __MYLOCATIONSENGINE_H__
+
+// INCLUDES
+
+// calendar related headers
+#include <calsession.h>
+#include <calentryview.h>
+
+// Header for contact DB
+#include <CNTDB.H>
+
+// Header for landmarks db
+#include<epos_cposlandmarkdatabase.h>
+
+// mylocations database manager
+#include "maptileinterface.h"
+#include "mylocationsdatabasemanager.h"
+#include "lookupmaptiledb.h"
+#include "addresscomparision.h"
+#include "calendernotification.h"
+
+/**  
+ * This class contains the required data  for maptile image  processing.
+ * Each  address added/modified in contact database will be added as queue
+ * using this class for maptile processing.
+ */
+class CMapTileRequest: public CBase
+{
+public:
+    //Consturctor
+    CMapTileRequest():iLandmarkInfo(NULL),iAddressDetails(NULL){};
+    //Destrucotr
+    ~CMapTileRequest(){delete iLandmarkInfo;delete iAddressDetails;};
+public:
+    //Landmark contains address details
+    CPosLandmark* iLandmarkInfo;
+    //single row address.
+    HBufC* iAddressDetails;
+    //Contact id
+    TInt32 iUId;
+    //Address type 
+    TInt32 iAddressType;
+    //Image path 
+    TFileName iImagePath;
+    //Event type    
+    TInt iEventType;
+};
+
+// CLASS DECLARATION
+/**  Class used to listen on various database change events from applications like calendar, 
+ * contacts, landmarks
+ * 
+ * This class listens on database change events from applications like contacts, calendar, landmarks
+ * and triggers updating the Mylocations database accordingly. 
+ * This process starts on phone bootup and always runs in the background.
+ */
+class CMyLocationsEngine : public CActive, public MCalChangeCallBack2,
+				 public MContactDbObserver, public MMapTileObserver,public MNotifyChange
+			
+{
+    
+public:
+    
+    /** 
+     * Contact address types
+     */
+    enum TContactAddressType
+        {
+        /** Address Type Pref */
+        EAddressPref,
+        /** Address type Work */
+        EAddressWork,
+        /** Address type Home */
+        EAddressHome,
+        };
+
+public:
+
+    /** 
+     * CMyLocationsEngine::NewL()
+     */
+    static CMyLocationsEngine* CMyLocationsEngine::NewL();
+    
+    /**
+     * ~CMyLocationsEngine.
+     * Virtual Destructor.
+     */
+    virtual ~CMyLocationsEngine();
+    
+    /** Starts calender change notification method to get callbacks when entries are added/modified/deleted in calender
+     *
+     */      
+    void StartCalenderChangeNotifierL();
+
+    /** Starts contacts change notification method to get callbacks when entries are added/modified/deleted in contacts
+     *
+     */      
+    void StartContactsChangeNotifierL();
+
+    /** Starts landmarks change notification method to get callbacks when entries are added/modified/deleted in landmarks
+     *
+     */      
+    void StartLandmarksChangeNotifier();
+    
+    /** Maps the source type change type to Mylocations entry change type
+    * @param[in] aSrcType Source type of the change
+    * @param[in] aChangeType Type of change ( added/modified/deleted ).
+    * @return The mylocations entry change type value.
+     */      
+    TEntryChangeType MapChangeType( TUidSourceType aSrcType, TUint32 aChangeType );    
+ 
+    /** Gets the handle to mylocations database manager
+     *
+     */      
+    CMyLocationsDatabaseManager& MyLocationsDbManager();
+
+private:
+    
+    /**
+     * ConstructL.
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+    /**
+     * CMyLocationsEngine.
+     * C++ default constructor. 
+     */
+    CMyLocationsEngine();
+    
+    /** Creates a landmark object from contact item's location details and checks whether address available.
+    * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
+    * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
+    * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
+     */      
+    CPosLandmark* GetContactAddressDetailsLC( const CContactItem *aContactItem, 
+            TContactAddressType aAddressType );
+            
+    /** Creates a landmark object from contact item's location details
+    * @param[in] aContactItem A contact item whose location details needs to be used to create landmark object.
+    * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
+    * @returns A valid landmark object if location in the contact item is validated, NULL otherwise.
+    */    
+    CPosLandmark* GetContactLocationDetailsLC( const CContactItem *aContactItem, 
+           TContactAddressType aAddressType );
+
+    /** Finds the contact's field type id
+    * @param[in] aContactItem A contact item whose field details needs to found.
+    * @param[in] aAddressType Mentions the address type ( prefered/work/home ) of the contact item to be used.
+    * @param[in] aField The field type of interest.
+    * @return If found, the index of the field within the field set, or KErrNotFound if not found.
+    */      
+    TInt FindContactsField( const CContactItem *aContactItem, TContactAddressType aAddressType, 
+            TUid aField );
+
+    /**
+     *  A call back function for calendar change notification
+	 *	@param aChangeItems  List of changes since the last notification.	
+	 */      
+    virtual void CalChangeNotification( RArray<TCalChangeEntry>& aChangeItems );
+    
+    /** Tests the contact database observer event type and handles it. The ID of a 
+    * contact affected by the change event, if relevant, can be retrieved via TContactDbObserverEvent::iContactId.
+    * @param aEvent Provides information about the change event. 
+    */
+    virtual void HandleDatabaseEventL( TContactDbObserverEvent aEvent );
+    
+    /** 
+     * Triggers the maptile processing for complete address
+     * @param aEvent  Provides information about the change event.   
+     */      
+	void TriggerMaptileRequestL(  TContactDbObserverEvent& aEvent  );
+			
+    /** 
+     * Process the contact database event and updates the landmark database
+     * @param aEvent  Provides information about the change event.   
+     */      
+	void HandlelandmarkDatabaseL( TContactDbObserverEvent& aEvent );
+    /** 
+    * Process the maptile database event and updates the maptile database
+    * @param aEventType  Provides information about the type of request address.
+    * @param aLookupItem Provides information about single address of contact.  
+    */  
+	void HandleMaptileDatabaseL(TInt aEventType ,
+	                             TLookupItem& aLookupItem );
+    /**
+     *  Handles active object's request completion event. 
+     */
+    void RunL();
+
+    /** 
+     * Implements cancellation of an outstanding request. 
+     */
+    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 .  
+     * @param aUId, uid of the event.
+     */
+    void RequestMapTileImageL( CPosLandmark&  aLandmark, const TUidSourceType aAddressType,
+                               const TInt32 aUId  );
+    
+    /** 
+     * Requests for map tile image , one box serch.
+     * @param aAddressDetails  Provides information about the address.
+     * @param aAddressType Provides information about address type .  
+     * @param aUId, uid of the event.
+     */
+    void RequestMapTileImageL(const TDesC& aAddressDetails,
+            const TUidSourceType aAddressType, const TInt32 aUId);
+    
+    /** 
+     * Add to maptile request queue.
+     * @param mapTileRequest, request queue.
+     * @return If successful, retrun KErrNone, or return some systemwide error.
+     */
+    TInt RequestExecute( CMapTileRequest* aMapTileRequest);
+	/**
+    * SetFolderPath.
+    * Sets the maptile storing path.
+    */
+    void SetFolderPathL();
+    /**
+    * Calender entry added.
+    */
+    void CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry);
+
+public:  //From MMapTileObserver
+    
+    /**
+     *  Informs the maptile fetching completion  
+     */ 
+    void MapTilefetchingCompleted( TInt aErrCode,const TDesC& aMapTilePath );
+    
+    /** 
+     * Informs the geocode completion
+     */
+    void RestGeoCodeCompleted( TReal latitude,TReal longitude);
+    
+public://from MNotifychange
+    void NotifyChangeL(TInt &aStatus);
+    
+private:
+
+    // Data member
+    
+    //handle to timer class
+    //calendar session handle
+    CCalSession *iCalSession;
+    
+    // calendar view
+    CCalEntryView *iCalView;   
+
+    // Handle to the contacts database
+    CContactDatabase* iContactsDb;
+    
+    // Receives events reporting changes to a contact database.
+    CContactChangeNotifier *iContactChangeNotifier;
+    
+    // Handle to landmarks db
+    CPosLandmarkDatabase* iLandmarkDb;
+    
+    // landmark change event type.
+    TPosLmEvent iLmEvent;
+   
+    //Handle to maptile interface
+    CMapTileInterface* iMapTileInterface;
+    
+    CMyLocationsDatabaseManager*  iMyLocationsDatabaseManager;
+    
+    //maptiledb 
+    CLookupMapTileDatabase* iMaptileDatabase;
+
+    //Current event type
+    TInt iEventType;
+    
+    //Address comparison pointer
+    CAddressComparision *iAddressCompare;
+    
+    //Maptile image request queue
+    RArray<CMapTileRequest*> iMapTileRequestQueue;
+    
+    //Flag to check maptilegeocoder plugin availability
+    TBool iMaptileGeocoderPluginAvailable;
+	
+	//Maptile image path
+    TFileName imageFilePath;
+    //Object to listen calender db create notification.    
+    CCalenderNotification  *iCalenderNotification;
+    
+};
+
+#endif // __MYLOCATIONSENGINE_H__
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/inc/mylocationslookupdb.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Header file for mylocation database lookup table.
+*
+*/
+
+#ifndef __MYLOCATIONSLOOKUPDB_H__
+#define __MYLOCATIONSLOOKUPDB_H__
+
+//Headers needed
+#include <f32file.h> //RFs
+#include <d32dbms.h>  //RDbNamedDatabase,RDbView 
+
+#include "mylocationsdefines.h"
+ 
+/**
+ * CLookupDatabase class.
+ * This class handles all the operations related to mylocations lookup database.
+ *
+ */
+ 
+class CLookupDatabase : public CBase
+{
+public:
+    // Two phase constructors
+ 
+    /**
+    * This is a static function, which creates and returns an instance of this class.
+    */
+    static CLookupDatabase* NewL( const TDesC& aLookupTableName );
+
+    /**
+    * This is a static function, which creates and returns an instance of this class. Pushes the created object 
+    * to the cleanup stack.
+    */
+    static CLookupDatabase* NewLC( const TDesC& aLookupTableName );
+
+    /**
+    * Destructor
+    */
+    ~CLookupDatabase();
+
+public:
+
+    /**
+    * Opens the lookup database.
+    */
+    TInt Open();
+
+    /**
+    * Closes the lookup database.
+    */
+    void Close();
+
+    /**
+    * Creates an entry in the lookup table.
+    * @param[in] aLookupItem The lookup item to be created in the database.
+    */
+    void CreateEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Updates an entry in the lookup table.
+    * @param[in] aLookupItem The lookup item to be updated in the database.
+    */
+    void UpdateEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Deletes an entry from the lookup table.
+    * @param[in] aLookupItem The lookup item to be deleted from the database.
+    */
+    void DeleteEntryL( const TLookupItem& aLookupItem );
+
+    /**
+    * Finds an entry in the lookup table.
+    * @param[in/out] aLookupItem The lookup item to be found in the database. The source iUid and source type 
+    * iSource is passed in the lookup item, if the entry is found, then the iLmId is copied to the lookup item
+    * @return ETrue if found, else EFalse
+    */
+    TBool FindEntryL( TLookupItem& aLookupItem );
+
+    /**
+    * Finds list of lookup items given a landmark id.
+    * @param[in] aLandmarkId The landmark id to be found in the lookup database.  
+    * @param[out] aLookupItemArray List of lookup entried found.  
+    */
+    void FindEntriesByLandmarkIdL( const TUint32 aLandmarkId, 
+            RArray<TLookupItem>& aLookupItemArray );
+
+    /**
+    * Finds list of lookup items given a source type.
+    * @param[in] aSourceType The source type to be found in the lookup database.  
+    * @param[out] aLookupItemArray List of lookup entried found.  
+    */
+    void FindEntriesBySourceTypeL( const TUint32 aSourceType, 
+            RArray<TLookupItem>& aLookupItemArray );
+
+
+
+private:
+    
+    // default constructor
+    CLookupDatabase();
+    
+    // Second phase constructor
+    void ConstructL( const TDesC& aLookupTableName );
+    
+    // Creates a lookup table in the lookup database.
+    void CreateTableL(RDbDatabase& aDatabase);
+    
+private:
+    
+    // Handle to the items database
+    RDbNamedDatabase iItemsDatabase;
+    
+    // handle to the file session
+    RFs iFsSession;
+        
+    // holds the database file name
+    TFileName iDbFileName;
+
+};
+
+
+#endif  // __MYLOCATIONSLOOKUP_H__
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/loc/mylocations.loc	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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/src/addresscomparision.cpp	Mon May 03 12:27:22 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: Address comparison source implementation for maptile
+*              service.
+*
+*/
+
+#include "mylocationlogger.h"
+#include "addresscomparision.h"
+
+
+CAddressComparision* CAddressComparision::NewL()
+{
+    CAddressComparision* self = new (ELeave) CAddressComparision();
+    return self;
+}
+
+CAddressComparision::CAddressComparision()
+{
+
+}
+
+// Need to enhance the functionality for address comparison
+TBool CAddressComparision::IsAddressChangedL(const CPosLandmark& /*aLandmarks*/,
+        const TInt32 aCntId, const TUidSourceType aAddressType)
+{
+    __TRACE_CALLSTACK;
+    
+    
+    TBool addressChanged = ETrue;
+    CLookupDatabase* lookupdb = NULL;
+    lookupdb = CLookupDatabase::NewLC(KMylocationsLookupDatabaseName);
+
+    TLookupItem lookupItem;
+    lookupItem.iUid = aCntId;
+    lookupItem.iSource = aAddressType;
+    User::LeaveIfError(lookupdb->Open());
+    addressChanged=lookupdb->FindEntryL(lookupItem);
+	addressChanged=ETrue;
+    lookupdb->Close();
+    CleanupStack::PopAndDestroy(lookupdb);
+    return addressChanged;//addressChanged;
+}
+
+//end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/appmain.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* 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: Application startup main implementation.
+*
+*/
+
+//  Include Files  
+#include "mylocationlogger.h"
+#include "appmain.h"
+#include "mylocationsengine.h"
+#include <e32base.h>
+#include <e32std.h>
+
+//  Local Functions
+// -----------------------------------------------------------------------------
+// DoExecuteL()
+// 
+// -----------------------------------------------------------------------------
+//
+static void DoExecuteL()
+{
+    __TRACE_CALLSTACK;// Create and install active scheduler
+    CActiveScheduler* scheduler = NULL;
+
+    scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL(scheduler);
+    CActiveScheduler::Install(scheduler);
+    
+    // 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.");
+    
+    RProcess::Rendezvous(KErrNone);
+    // Start handling requests
+    CActiveScheduler::Start();
+
+    CleanupStack::PopAndDestroy(myLocationsEngine);
+    // Pop and destroy the scheduler
+    CleanupStack::PopAndDestroy(scheduler);
+   
+}
+
+// -----------------------------------------------------------------------------
+// Execute()
+// 
+// -----------------------------------------------------------------------------
+//
+static TInt Execute()
+{
+   // __UHEAP_MARK;
+    TInt error = KErrNoMemory;
+    // Create the cleanup stack
+    CTrapCleanup* cleanup = CTrapCleanup::New();
+    if (cleanup)
+    {
+        // Initialize and start the server
+        TRAP( error, DoExecuteL() );
+        delete cleanup;
+    }
+   // __UHEAP_MARKEND;
+    return error;
+}
+
+GLDEF_C TInt E32Main()
+{
+    return Execute();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/calendernotification.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,120 @@
+/*
+ * 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 source implementation for calender db path observation.
+ *
+ */
+
+#include <calendernotification.h>
+
+_LIT( KCalendarDbPath, ":\\private\\10003a5b\\" );
+
+const TInt KMaxFilePtahSize = 256;
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::NewL()
+// -----------------------------------------------------------------------------
+//
+CCalenderNotification* CCalenderNotification::NewL(MNotifyChange* aNotifyChange)
+{
+    CCalenderNotification* self = CCalenderNotification::NewLC(aNotifyChange);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::NewLC()
+// -----------------------------------------------------------------------------
+//
+CCalenderNotification* CCalenderNotification::NewLC(
+        MNotifyChange* aNotifyChange)
+{
+    CCalenderNotification* self = new (ELeave) CCalenderNotification(
+            aNotifyChange);
+    CleanupStack::PushL(self);
+    self->ConstructL(aNotifyChange);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CCalenderNotification::ConstructL(MNotifyChange* aNotifyChange)
+{
+    CActiveScheduler::Add(this);
+    User::LeaveIfError(iFsession.Connect());
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CheckCalenderDbFileStructure()
+// Observes the calendar db file structure changes.
+// -----------------------------------------------------------------------------
+//
+void CCalenderNotification::CheckCalenderDbFileStructure( TChar aDrive )
+{
+    TBuf<KMaxFilePtahSize> filePath;
+    filePath.Append( aDrive );
+    filePath.Append( KCalendarDbPath );
+    iFsession.NotifyChange(ENotifyEntry, iStatus, filePath );
+    SetActive();
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CCalenderNotification()
+// Default constructor .
+// -----------------------------------------------------------------------------
+//
+CCalenderNotification::CCalenderNotification(MNotifyChange* aNotifyChange) :
+    CActive(EPriorityStandard), iNotifyChange(*aNotifyChange)
+{
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::~CCalenderNotification()
+// default destuctor.
+// -----------------------------------------------------------------------------
+//
+CCalenderNotification::~CCalenderNotification()
+{
+    if (IsActive())
+    {
+        Cancel();
+    }
+    iFsession.Close();
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RunL()
+// Assyncronous request handler , on completion of notification
+// -----------------------------------------------------------------------------
+//
+void CCalenderNotification::RunL()
+{
+    TInt status;
+    iNotifyChange.NotifyChangeL( status );
+    if ( KErrNone == status )
+    {
+        iFsession.NotifyChangeCancel();
+    }
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::DoCancel()
+// Handels the error condition on assynchronous request
+// -----------------------------------------------------------------------------
+//
+void CCalenderNotification::DoCancel()
+{
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,335 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Maptile database lookup table source implementation.
+*
+*/
+
+#include <BAUTILS.H>
+#include "mylocationlogger.h"
+#include "lookupmaptiledb.h"
+
+_LIT( KSelectAllFrom, "SELECT * FROM " );
+_LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d");
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::CLookupMapTileDatabase()
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase::CLookupMapTileDatabase()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::~CLookupMapTileDatabase()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase::~CLookupMapTileDatabase()
+{
+    __TRACE_CALLSTACK;// close the database
+    iItemsDatabase.Close();
+    // close the file session
+    iFsSession.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::~CLookupMapTileDatabase()
+// Creates an object of this class and pushes to cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase* CLookupMapTileDatabase::NewLC(
+        const TDesC& aLookupTableName)
+{
+    CLookupMapTileDatabase* self = new (ELeave) CLookupMapTileDatabase;
+    CleanupStack::PushL(self);
+    self->ConstructL(aLookupTableName);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::NewL()
+// Creates an object of this class.
+// -----------------------------------------------------------------------------
+//
+CLookupMapTileDatabase* CLookupMapTileDatabase::NewL(
+        const TDesC& aLookupTableName)
+{
+    CLookupMapTileDatabase* self = CLookupMapTileDatabase::NewLC(
+            aLookupTableName);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::ConstructL()
+// 2nd phase contructor.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::ConstructL(const TDesC& aLookupTableName)
+{
+    __TRACE_CALLSTACK;
+    User::LeaveIfError(iFsSession.Connect());
+
+    //create private path
+    User::LeaveIfError(iFsSession.CreatePrivatePath(RFs::GetSystemDrive()));
+    // private path with no drive on it
+    iFsSession.PrivatePath(iDbFileName);
+
+    TFindFile PrivFolder(iFsSession);
+    // find out the drive
+    if (KErrNone == PrivFolder.FindByDir(iDbFileName, KNullDesC))
+    {
+        iFsSession.MkDir(KLookupDbPath);
+        iDbFileName.Copy(KLookupDbPath);
+        iDbFileName.Append(aLookupTableName);
+
+        if (!BaflUtils::FileExists(iFsSession, iDbFileName))
+        { // no database exists so we make one
+            User::LeaveIfError(iItemsDatabase.Create(iFsSession, iDbFileName));
+            // and will create the only table needed for it
+            CreateTableL(iItemsDatabase);
+
+            //close the database
+            iItemsDatabase.Close();
+        }        
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::Open()
+// Opens the lookup database.
+// -----------------------------------------------------------------------------
+//
+TInt CLookupMapTileDatabase::Open()
+{
+    __TRACE_CALLSTACK;
+    return iItemsDatabase.Open(iFsSession, iDbFileName);
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::Close()
+// Closes the lookup database.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::Close()
+{
+    __TRACE_CALLSTACK;
+    iItemsDatabase.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::CreateTableL()
+// Creates a lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::CreateTableL(RDbDatabase& aDatabase)
+{
+    __TRACE_CALLSTACK;// Create a table definition
+    CDbColSet* columns = CDbColSet::NewLC();
+
+    // Add Columns
+
+    // Add uid column
+    columns->AddL(TDbCol(NCntColUid, EDbColUint32));
+
+    columns->AddL(TDbCol(NColSource, EDbColUint32));
+
+    // add file path type column
+    columns->AddL(TDbCol(NCntColFilePath, EDbColText16));
+
+    // Create a table
+    User::LeaveIfError(aDatabase.CreateTable(KMapTileLookupTable, *columns));
+
+    // cleanup the column set
+    CleanupStack::PopAndDestroy(columns);
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::CreateEntryL()
+// Creates an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::CreateEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// create a query for the view
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KMapTileLookupTable);
+
+    TInt ret = Open();
+    if (ret != KErrNone)
+    {
+		Close();
+        Open();
+       
+    }
+	 iItemsDatabase.Begin();
+    
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    // Inert the item
+    myView.InsertL();
+    // set the fields
+    myView.SetColL(KColumncntUid, aLookupItem.iUid);
+    myView.SetColL(KColumnSource, aLookupItem.iSource);
+    myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
+
+    myView.PutL();
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+    Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::UpdateEntryL()
+// Updates an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::UpdateEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// Create the query to find the row to be updated.
+    TFileName queryBuffer;
+    queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
+    TInt ret = Open();
+    if (ret != KErrNone)
+    {
+		Close();
+        Open();
+       
+    }
+	 iItemsDatabase.Begin();
+
+    // Create a view of the table based on the query created.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    if (myView.AtRow())
+    {
+        // found the entry. update it.
+        myView.UpdateL();
+        myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
+        myView.PutL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+
+    Close();
+
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::DeleteEntryL()
+// Deletes an entry from the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::DeleteEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
+
+    TFileName queryBuffer;
+    queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
+
+    TInt ret = Open();
+    if (ret != KErrNone)
+    {
+		Close();
+        Open();
+       
+    }
+	 iItemsDatabase.Begin();
+
+    RDbView myView;
+    // query buffer finds only the selected item row.
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    myView.EvaluateAll();
+
+    // positions the cursor on the first row of the rowset
+    myView.FirstL();
+
+    // Delete the entry found.
+    if (myView.AtRow())
+    {
+        myView.GetL();
+        if (aLookupItem.iUid == myView.ColUint(KColumncntUid))
+        {
+            ret = iFsSession.Delete(myView.ColDes16(KColumnFilePath));
+        }
+        myView.DeleteL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+    // compacts the databse, by physicaly removing deleted data.
+    iItemsDatabase.Compact();
+
+    Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::FindEntryL()
+// Finds an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+TBool CLookupMapTileDatabase::FindEntryL(TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// used to store return value
+    TBool retVal = EFalse;
+    // Create a query to find the item.
+    TFileName queryBuffer;
+    queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
+
+   TInt ret = Open();
+    if (ret != KErrNone)
+    {
+		Close();
+        Open();
+       
+    }
+	 iItemsDatabase.Begin();
+
+    // Create a view of the table with the above query.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    if (myView.AtRow())
+    {
+        // Item found. get the details.
+        myView.GetL();
+        if (aLookupItem.iUid == myView.ColUint(KColumncntUid))
+        {
+            aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath));
+        }
+        retVal = ETrue;
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    Close();
+    return retVal;
+}
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/maptileinterface.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* 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 interface source implementation for maptile
+*              service.
+*
+*/
+
+#include <EPos_CPosLandmark.h>
+#include <EPos_CPosLandmarkDatabase.h>
+#include <EPos_CPosLmItemIterator.h>
+#include <EPos_CPosLmOperation.h>
+#include <f32file.h>
+#include <bautils.h>
+#include "maptileinterface.h"
+#include "mylocationlogger.h"
+
+//Invalid latitude & longitude value
+const TReal KInvalidLatitudeLongitude = 200.00;
+const TInt KStreetLvelZoom = 14;
+const TInt KCityLevelZoom = 7;
+const TInt KMapTileSize= 256;
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::NewL()
+// Creates and returns the instance of CMapTileInterface
+// -----------------------------------------------------------------------------
+//
+CMapTileInterface* CMapTileInterface::NewL()
+{
+    CMapTileInterface* self = new (ELeave) CMapTileInterface();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::~CMapTileInterface()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CMapTileInterface::~CMapTileInterface()
+{
+    __TRACE_CALLSTACK;
+   
+    delete iFilePath;
+    
+    delete iMaptileGeocoder;
+}    
+
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::CMapTileInterface()
+// Constructor
+// -----------------------------------------------------------------------------
+//
+CMapTileInterface::CMapTileInterface() :
+           iMaptileGeocoder( NULL ), iFilePath( NULL ),iObserver(NULL)
+{
+}
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::ConstructL()
+// Two phase constructor
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::ConstructL()
+{
+    __TRACE_CALLSTACK;
+
+    iMaptileGeocoder = CMaptileGeocoderPlugin::NewL();
+    
+    iMaptileGeocoder->SetMaptileGeocoderObserver( *this );
+}
+// -----------------------------------------------------------------------------
+// CMapTileInterface::GetMapTileImageL()
+// Interface for requesting maptile image for a landmark object
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::GetMapTileImageL(const TDesC& aAddressDetails,
+        const TDesC& aFilePath, MMapTileObserver* aObserver)
+{
+    __TRACE_CALLSTACK;
+    iObserver = aObserver;
+    delete iFilePath;
+    iFilePath = NULL;    
+    iFilePath = HBufC::NewL(aFilePath.Length());
+    iFilePath->Des().Copy(aFilePath);
+    TConnectionOption conn = EInteractive;
+    iMaptileGeocoder->GetCoordinateByAddressL(aAddressDetails, conn);
+}
+// -----------------------------------------------------------------------------
+// CMapTileInterface::GetMapTileImageL()
+// Interface for requesting maptile image for a landmark object
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::GetMapTileImageL(CPosLandmark* aLandmark,
+        const TDesC& aFilePath, MMapTileObserver* aObserver)
+{
+    __TRACE_CALLSTACK;
+    iObserver = aObserver;
+    delete iFilePath;
+    iFilePath = NULL;    
+    iFilePath = HBufC::NewL(aFilePath.Length());
+    iFilePath->Des().Copy(aFilePath);
+
+    TPtrC getStreet;
+
+    aLandmark->GetPositionField(EPositionFieldStreet, getStreet);
+
+    if (getStreet.Length() > 0)
+    {
+        iStreetAvailable = ETrue;
+    }
+
+    TConnectionOption conn = EInteractive;
+
+
+    iMaptileGeocoder->GetCoordinateByAddressL(*aLandmark, conn);
+}
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::GetMapTileImageL()
+// Function for Retrieving latitude & longitude information
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::GetMapTileL(TReal aLatitude, TReal aLongitude)
+{
+    __TRACE_CALLSTACK;//Notification to observer , to update contact db,
+    iObserver->RestGeoCodeCompleted(aLatitude, aLongitude);
+
+    TInt zoom = KCityLevelZoom;
+    TInt size = KMapTileSize;
+    if (iStreetAvailable)
+    {
+        zoom = KStreetLvelZoom;
+    }
+
+    iStreetAvailable = EFalse;
+
+    TMapTileParam mapTileparam(aLatitude, aLongitude, zoom, size);
+
+    iMaptileGeocoder->GetMapTileByGeoCodeL( mapTileparam, *iFilePath );
+}
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::MapComplete()
+// Maptile retrievel notification
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::MapTileFetchingCompleted( TInt aErrCode, const TDesC& aMapTilePath )
+{
+    __TRACE_CALLSTACK;
+    MYLOCLOGSTRING1("MapComplete() status-%d ",aErrCode );
+    iObserver->MapTilefetchingCompleted( aErrCode, aMapTilePath );
+
+}
+
+// -----------------------------------------------------------------------------
+// CMapTileInterface::GeocodeComplete()
+// Geocode completion  notification
+// -----------------------------------------------------------------------------
+//
+void CMapTileInterface::GeocodingCompleted(TInt aErrorcode,
+        MAddressInfo& aAddressInfo)
+{
+    __TRACE_CALLSTACK;
+    TReal latitude, longitude;
+    aAddressInfo.GetLatitude( latitude );
+    aAddressInfo.GetLongitude( longitude );
+    
+    MYLOCLOGSTRING1("GeocodeCompleted() status-%d",aErrorcode);
+    MYLOCLOGSTRING1("GeocodeCompleted() latitude-%f",latitude );
+    MYLOCLOGSTRING1("GeocodeCompleted() longitude-%f",longitude );
+	
+    if (aErrorcode == KErrNone)
+    {
+        if ( latitude != KInvalidLatitudeLongitude
+                && longitude != KInvalidLatitudeLongitude)
+        {
+            TRAPD( error, GetMapTileL(latitude, longitude) );
+            if ( error != KErrNone )
+            {
+                //Log error message
+				 MYLOCLOGSTRING1("GetMapTileL() status-%d",error);
+				 iObserver->MapTilefetchingCompleted(error, KNullDesC);
+            }
+        }
+        else
+        {
+            iObserver->MapTilefetchingCompleted(KErrGeneral, KNullDesC);
+        }
+    }
+    else
+    {
+        iObserver->MapTilefetchingCompleted(aErrorcode, KNullDesC);
+
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/mylocationsdatabasemanager.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,980 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Database manager implementation for location picker and
+*              maptile service.
+*
+*/
+
+#include <EPos_CPosLandmark.h>
+#include <EPos_CPosLandmarkCategory.h>
+#include <EPos_CPosLmTextCriteria.h>
+#include <EPos_CPosLandmarkSearch.h>
+#include <EPos_CPosLmDatabaseManager.h>
+#include <lbsposition.h>
+#include <mylocations.rsg>
+#include <barsread.h>
+#include <barsc.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, " ");
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::ConstructL()
+// 2nd phase constructor.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::ConstructL()
+{
+    __TRACE_CALLSTACK;//Open and intialize Landmark DB
+    iLandmarkDb = CPosLandmarkDatabase::OpenL();
+    ExecuteAndDeleteLD(iLandmarkDb->InitializeL());
+
+    // create landmarks lookup database.
+    iLandmarksLookupDb = CLookupDatabase::NewL(KLandmarksLookupDatabaseName);
+    User::LeaveIfError( iLandmarksLookupDb->Open() );
+    
+    CPosLmDatabaseManager* dbManager = CPosLmDatabaseManager::NewL();
+    CleanupStack::PushL(dbManager);
+
+    //Create custom landmark database for storing my locations data
+    if (!dbManager->DatabaseExistsL(KMyLocationsDatabaseUri))
+    {
+        HPosLmDatabaseInfo* dbInfo = HPosLmDatabaseInfo::NewLC(
+                KMyLocationsDatabaseUri);
+        dbManager->CreateDatabaseL(*dbInfo);
+        CleanupStack::PopAndDestroy(dbInfo);
+    }
+
+    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();
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CMyLocationsDatabaseManager()
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsDatabaseManager::CMyLocationsDatabaseManager() : iLandmarkDb( NULL ),
+                iMyLocationsLandmarksDb( NULL ), 
+                iLmContactsCatId( 0 ), iLandmarksLookupDb( NULL ), 
+                iMylocationsLookupDb( NULL ), iMyLocationsCatManager( NULL ), 
+                iLandmarksCatManager( NULL )
+{
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::_CMyLocationsDatabaseManager()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsDatabaseManager::~CMyLocationsDatabaseManager()
+{
+    __TRACE_CALLSTACK;// delete member variables.
+    if (iLandmarksLookupDb)
+    {
+        iLandmarksLookupDb->Close();
+        delete iLandmarksLookupDb;
+    }
+    if (iMylocationsLookupDb)
+    {
+        iMylocationsLookupDb->Close();
+        delete iMylocationsLookupDb;
+    }
+
+    delete iLandmarksCatManager;
+
+    delete iLandmarkDb;
+
+    delete iMyLocationsCatManager;
+
+    delete iMyLocationsLandmarksDb;
+  
+    // close the file session
+    iFsSession.Close();
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::AddMylocationsCategoryL()
+// Adds the category to the mylocations and landmarks database..
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::AddMylocationsCategoryL( const TUint32 aCategoryType )
+{
+    __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);
+    }
+    
+    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)
+    {
+        // 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);
+    }
+
+    CleanupStack::PopAndDestroy(&itemArray);
+
+    if ( dataBuffer )
+    {
+        CleanupStack::PopAndDestroy(dataBuffer);
+    }
+    
+    if (aCategoryType == ESourceLandmarksContactsCat)
+        iLmContactsCatId = lookupItem.iUid;
+    
+    // Close the resource file
+    CleanupStack::PopAndDestroy( &resourceFile );
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::UpdateDatabaseL()
+// Updates the location into the landmark database and lookup table. Based on 
+// the entry source type and the entry change type the updation can be 
+// addition/modification/deletion.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::UpdateDatabaseL(CPosLandmark* aLandmark,
+        const TUint32 aUid, const TUint32 aSourceType, const TEntryChangeType aChangeType)
+{
+    __TRACE_CALLSTACK;//open the lookup database
+    User::LeaveIfError(iMylocationsLookupDb->Open());
+    switch (aChangeType)
+    {
+    // if the entry is added
+    case EEntryAdded:
+    {
+        // Handle this entry in the lookup table and update landmarks db.
+        HandleEntryAdditionL(aLandmark, aUid, aSourceType);
+        break;
+    }
+        // if the entry is modified
+    case EEntryModified:
+    {
+        // Handle this entry in the lookup table and update landmarks db.
+        HandleEntryModificationL(aLandmark, aUid, aSourceType);
+        break;
+    }
+        // if the entry is deleted
+    case EEntryDeleted:
+    {
+        // Handle this entry in the lookup table and update landmarks db.
+        HandleEntryDeletionL(aUid, aSourceType);
+        break;
+    }
+    }
+    //close the lookup database
+    iMylocationsLookupDb->Close();
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CheckIfDuplicateExistsL()
+// Checks if this landmark is already present in database. If present returns the landmark id, else 0
+// -----------------------------------------------------------------------------
+//
+TPosLmItemId CMyLocationsDatabaseManager::CheckIfDuplicateExistsL(
+                                    const CPosLandmark* aLandmark)
+{
+    __TRACE_CALLSTACK;// Stores the found duplicate landmark's id. 
+    TPosLmItemId retId = 0;
+
+    // Initially filter only the landmarks which are nearer to the current landmark.
+    // Then we can make a duplicate check on each of the found landmarks.
+
+    // create a search object.
+    CPosLandmarkSearch* search = CPosLandmarkSearch::NewL(
+            *iMyLocationsLandmarksDb);
+    CleanupStack::PushL(search);
+
+    TBuf<KMaxAddressLength> lmAddress;
+    GetLandmarkFullAddress(lmAddress, aLandmark);
+
+    // Create the search criterion
+    CPosLmTextCriteria* crit = CPosLmTextCriteria::NewLC();
+    crit->SetTextL(lmAddress);
+    crit->SetAttributesToSearch(CPosLandmark::ELandmarkName);
+
+    // Start the search and execute it at once.
+    ExecuteAndDeleteLD(search->StartLandmarkSearchL(*crit));
+    CleanupStack::PopAndDestroy(crit);
+
+    // Retrieve an iterator to access the matching landmarks.
+    CPosLmItemIterator* iter = search->MatchIteratorL();
+    CleanupStack::PushL(iter);
+
+    // Iterate the search matches.
+    TPosLmItemId lmId;
+
+    while ((lmId = iter->NextL()) != KPosLmNullItemId)
+    {
+        //Found duplicate entries.
+        // Get the corresponding id in landmarks db
+        RArray<TLookupItem> itemArray;
+        CleanupClosePushL(itemArray);
+        iMylocationsLookupDb->FindEntriesByLandmarkIdL(lmId, itemArray);
+        if (itemArray.Count())
+        {
+            if (itemArray[0].iSource == ESourceLandmarks)
+            {
+                // return id only if the source is from landmarks database.
+                retId = itemArray[0].iUid;
+                CleanupStack::PopAndDestroy(&itemArray);
+                break;
+            }
+        }
+        CleanupStack::PopAndDestroy(&itemArray);
+    }
+
+    CleanupStack::PopAndDestroy(iter);
+    CleanupStack::PopAndDestroy(search);
+
+    return retId;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::CompareLandmarks()
+// Compares two landmarks. Only the text fields, landmark name, street, city, state country and 
+// postal code are compared.
+// -----------------------------------------------------------------------------
+//
+TBool CMyLocationsDatabaseManager::CompareLandmarks(
+        const CPosLandmark* aLandmark1, const CPosLandmark* aLandmark2)
+{
+    __TRACE_CALLSTACK;// Compare landmark names
+    TPtrC name1, name2;
+    aLandmark1->GetLandmarkName(name1);
+    aLandmark2->GetLandmarkName(name2);
+    if (name1 != name2)
+    {
+        return EFalse;
+    }
+
+    // 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;
+    }
+
+    // compare state info
+    TPtrC state1, state2;
+    aLandmark1->GetPositionField(EPositionFieldState, state1);
+    aLandmark2->GetPositionField(EPositionFieldState, state2);
+    if (state1 != state2)
+    {
+        return EFalse;
+    }
+
+    // compare postal code
+    TPtrC postalCode1, postalCode2;
+    aLandmark1->GetPositionField(EPositionFieldPostalCode, postalCode1);
+    aLandmark2->GetPositionField(EPositionFieldPostalCode, postalCode2);
+    if (postalCode1 != postalCode2)
+    {
+        return EFalse;
+    }
+
+    // compare country name
+    TPtrC country1, country2;
+    aLandmark1->GetPositionField(EPositionFieldCountry, country1);
+    aLandmark2->GetPositionField(EPositionFieldCountry, country2);
+    if (country1 != country2)
+    {
+        return EFalse;
+    }
+
+    return ETrue;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryAdditionL()
+// Handles the entry addition in lookup table and landmarks db
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryAdditionL(CPosLandmark* aLandmark,
+        const TUint32 aUid, const TUint32 aSourceType)
+{
+    __TRACE_CALLSTACK;
+    if ( aSourceType == ESourceLandmarks )
+    {
+        AddToMylocationsDbL(aLandmark, aUid, aSourceType);
+        return;
+    }
+    if ( aSourceType == ESourceLandmarksCategory )
+    {
+        CreateCategoryL(aUid);
+        return;
+    }
+    // Create a lookup item
+    TLookupItem lookupItem;
+    lookupItem.iUid = aUid;
+    lookupItem.iSource = aSourceType;
+
+    // check if this landmark is already present in database
+    TPosLmItemId dupLmId = CheckIfDuplicateExistsL(aLandmark);
+    if (dupLmId)
+    {
+        // landmark already present in db. get the details
+        CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(dupLmId);
+        if (dupLandmark)
+        {
+            if (aSourceType == ESourceContactsPref || aSourceType
+                    == ESourceContactsWork || aSourceType
+                    == ESourceContactsHome)
+            {
+                dupLandmark->AddCategoryL(iLmContactsCatId);
+            }
+            // update the landmark object in the db
+            iLandmarkDb->UpdateLandmarkL(*dupLandmark);
+            CleanupStack::PopAndDestroy(dupLandmark);
+        }
+
+        // point the lookup item's landmark uid to the existing landmark.
+        lookupItem.iLmId = dupLmId;
+    }
+    else // it is a new entry, so add into the database
+    {
+        if (aSourceType == ESourceContactsPref || aSourceType
+                == ESourceContactsWork || aSourceType == ESourceContactsHome)
+        {
+            aLandmark->AddCategoryL(iLmContactsCatId);
+        }
+        // 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);
+    }
+
+    // create the entry in the lookup table.
+    iLandmarksLookupDb->CreateEntryL(lookupItem);
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryModificationL()
+// Handles the entry modification in the lookup table and landmarks db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryModificationL(
+        CPosLandmark* aLandmark, const TUint32 aUid, const TUint32 aSourceType)
+{
+    __TRACE_CALLSTACK;
+    if ( aSourceType == ESourceLandmarks )
+    {
+        ModifyMylocationsDbL( aLandmark, aUid, aSourceType );
+        return;
+    }
+
+    TLookupItem lookupItem;
+    lookupItem.iUid = aUid;
+    lookupItem.iSource = aSourceType;
+
+
+    if (aSourceType == ESourceContactsPref || aSourceType
+            == ESourceContactsWork || aSourceType == ESourceContactsHome)
+    {
+        // 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))
+        {
+            // 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)
+            {
+                // 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;
+            }
+
+            if (!CompareLandmarks(existingLandmark, aLandmark))
+            {
+                // landmarks are not same, means location information is modified.
+
+                // Check if the new landmark is already in db.
+                TPosLmItemId dupLmId = CheckIfDuplicateExistsL(aLandmark);
+                if (dupLmId)
+                {
+                    // landmark already present in db. get the details
+                    CPosLandmark* dupLandmark = iLandmarkDb->ReadLandmarkLC(
+                            dupLmId);
+                    if (dupLandmark)
+                    {
+                        // add category.
+                        dupLandmark->AddCategoryL(iLmContactsCatId);
+
+                        // 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);
+                }
+                else
+                {
+                    // 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);
+                }
+            }
+            else
+            {
+                // landmarks are same, means location not modified. So return.
+                CleanupStack::PopAndDestroy(existingLandmark);
+                return;
+            }
+
+            // delete the existing landmark only if it not being refered by other lookup entries.
+
+            // Check if any other entries are refering this landmark.
+            RArray<TLookupItem> itemArray;
+            CleanupClosePushL(itemArray);
+            iLandmarksLookupDb->FindEntriesByLandmarkIdL(
+                    existingLandmark->LandmarkId(), itemArray);
+
+            if (itemArray.Count())
+            {
+                // There are other lookup entries refering this landmark. So do not delete the landmark
+
+                // If none of these lookup item's source type is contacts, disassociate 'iLmContactsCatId' category
+                // from this landmark.
+                TInt i = 0;
+                while (i < itemArray.Count())
+                {
+                    if (itemArray[i].iSource == ESourceContactsPref
+                            || itemArray[i].iSource == ESourceContactsWork
+                            || itemArray[i].iSource == ESourceContactsHome
+                            )
+                    {
+                        // a lookup item exists which is from contacts, so 'iLmContactsCatId' is still valid.
+                        break;
+                    }
+                    i++;
+                }
+                if (i == itemArray.Count())
+                {
+                    // no lookup items from contacts exists refering this landmark.
+                    // so disassociate 'iLmContactsCatId' from this landmark
+
+                    existingLandmark->RemoveCategory(iLmContactsCatId);
+                    iLandmarkDb->UpdateLandmarkL(*existingLandmark);
+                }
+            }
+            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.
+                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);
+            }
+            CleanupStack::PopAndDestroy(&itemArray);
+            CleanupStack::PopAndDestroy(existingLandmark);
+
+        }
+        else // entry not present in lookup table
+        {
+            // Add the entry into the lookup table and update landmarks db.
+            HandleEntryAdditionL(aLandmark, aUid, aSourceType);
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::HandleEntryDeletionL()
+// Handles the entry deletion in lookup table and landmarks db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::HandleEntryDeletionL(const TUint32 aUid,
+                                                const TUint32 aSourceType)
+{
+    __TRACE_CALLSTACK;
+    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.
+
+        // Find the corresponding landmark uid
+        if (iLandmarksLookupDb->FindEntryL(lookupItem))
+        {
+            // delete the lookup entry.
+            iLandmarksLookupDb->DeleteEntryL(lookupItem);
+
+            // Check if any other entries are refering this landmark.
+            RArray<TLookupItem> itemArray;
+            CleanupClosePushL(itemArray);
+            iLandmarksLookupDb->FindEntriesByLandmarkIdL(lookupItem.iLmId,
+                    itemArray);
+
+            if (itemArray.Count())
+            {
+                // There are other lookup entries refering this landmark. So do not delete the landmark
+
+                // If none of these lookup item's source type is contacts, disassociate 'iLmContactsCatId' category
+                // from this landmark.
+                TInt i = 0;
+                while (i < itemArray.Count())
+                {
+                    if (itemArray[i].iSource == ESourceContactsPref
+                            || itemArray[i].iSource == ESourceContactsWork
+                            || itemArray[i].iSource == ESourceContactsHome)
+                    {
+                        // a lookup item exists which is from contacts/calendar, so 'iLmContactsCatId' is still valid.
+                        break;
+                    }
+                    i++;
+                }
+                if ( i == itemArray.Count() )
+                {
+                    // no lookup items from contacts exists refering this landmark.
+                    // so disassociate 'iLmContactsCatId' from this landmark
+
+                    CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(
+                            lookupItem.iLmId);
+                    landmark->RemoveCategory(iLmContactsCatId);
+                    iLandmarkDb->UpdateLandmarkL(*landmark);
+                    CleanupStack::PopAndDestroy(landmark);
+                }
+            }
+            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);
+            }
+            CleanupStack::PopAndDestroy(&itemArray);
+        }
+    }
+
+    else if (aSourceType == ESourceLandmarks)
+    {
+        // 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++)
+        {
+            iLandmarksLookupDb->DeleteEntryL(itemArray[i]);
+        }
+
+        CleanupStack::PopAndDestroy(&itemArray);
+
+        DeleteFromMylocationsDbL(aUid, aSourceType);
+    }
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::GetLandmarkFullAddress()
+// Gets the comma separated full address of the given landmark.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::GetLandmarkFullAddress(
+        TBuf<KMaxAddressLength>& aLandmarkAddress,
+        const CPosLandmark* aLandmark)
+{
+    TPtrC tempStr;
+    TInt retStatus;
+    TBool addressEmtpy = ETrue;
+    retStatus = aLandmark->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;
+        }
+    }
+
+    retStatus = aLandmark->GetPositionField(EPositionFieldCity, tempStr);
+    if (retStatus == KErrNone && tempStr.Length())
+    {
+        if (!addressEmtpy)
+        {
+            aLandmarkAddress.Append(KSeparator);
+            aLandmarkAddress.Append(KSpace);
+            aLandmarkAddress.Append(tempStr);
+        }
+        else
+        {
+            aLandmarkAddress.Copy(tempStr);
+            addressEmtpy = EFalse;
+        }
+    }
+
+    retStatus = aLandmark->GetPositionField(EPositionFieldState, tempStr);
+    if (retStatus == KErrNone && tempStr.Length())
+    {
+        if (!addressEmtpy)
+        {
+            aLandmarkAddress.Append(KSeparator);
+            aLandmarkAddress.Append(KSpace);
+            aLandmarkAddress.Append(tempStr);
+        }
+        else
+        {
+            aLandmarkAddress.Copy(tempStr);
+            addressEmtpy = EFalse;
+        }
+    }
+
+    retStatus = aLandmark->GetPositionField(EPositionFieldCountry, tempStr);
+    if (retStatus == KErrNone && tempStr.Length())
+    {
+        if (!addressEmtpy)
+        {
+            aLandmarkAddress.Append(KSeparator);
+            aLandmarkAddress.Append(KSpace);
+            aLandmarkAddress.Append(tempStr);
+        }
+        else
+        {
+            aLandmarkAddress.Copy(tempStr);
+            addressEmtpy = EFalse;
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::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.
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL(
+        CPosLandmarkDatabase* aDb, const TUint32 aLmId)
+{
+    __TRACE_CALLSTACK;
+    CPosLandmark* lm = aDb->ReadLandmarkLC(aLmId);
+    CleanupStack::Pop(lm);    
+    return lm;
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::AddToMylocationsDbL()
+// Adds the entry into the mylocations database and updates the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::AddToMylocationsDbL(CPosLandmark* aLandmark,
+        const TUint32 aUid, const TUint32 aSourceType)
+{
+    __TRACE_CALLSTACK;
+    if (aSourceType == ESourceLandmarks)
+    {
+        CPosLandmark* landmark = iLandmarkDb->ReadLandmarkLC(aUid);
+        RArray<TPosLmItemId> catArray;
+        CleanupClosePushL( catArray );
+        landmark->GetCategoriesL(catArray);
+       
+
+        // 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 ) );
+        }
+
+        CleanupStack::PopAndDestroy( &catArray );       
+        TLookupItem lookupItem;
+        lookupItem.iUid = aUid;
+        lookupItem.iSource = aSourceType;
+        TRAP_IGNORE( lookupItem.iLmId = iMyLocationsLandmarksDb->AddLandmarkL( *aLandmark ) );
+        CleanupStack::PopAndDestroy(landmark);
+        iMylocationsLookupDb->CreateEntryL(lookupItem);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsDatabaseManager::ModifyMylocationsDbL()
+// Adds the entry into the mylocations database and updates the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::ModifyMylocationsDbL(CPosLandmark* aLandmark,
+        const TUint32 aUid, const TUint32 aSourceType)
+{
+    __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);
+}
+
+// -----------------------------------------------------------------------------
+// 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.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsDatabaseManager::CreateCategoryL(const TUint32 aUid)
+{
+    __TRACE_CALLSTACK;// Read the category.
+    CPosLandmarkCategory *category = iLandmarksCatManager->ReadCategoryLC(aUid);
+
+    TLookupItem lookupItem;
+    lookupItem.iUid = aUid;
+    lookupItem.iSource = ESourceLandmarksUserCat;
+    // Add category to landmarks database
+    TRAPD ( err, (lookupItem.iLmId = iMyLocationsCatManager->AddCategoryL( *category ) ) );
+
+    if (err == KErrNone)
+    {
+        iMylocationsLookupDb->CreateEntryL(lookupItem);
+    }
+    CleanupStack::PopAndDestroy(category);
+
+}
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/mylocationsengine.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,1467 @@
+/*
+* 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 source implementation for location picker
+*              and maptile service.
+*
+*/
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <calchangecallback.h> 
+#include <cntitem.h>
+#include <CNTFLDST.H>
+#include <EPos_CPosLmDatabaseManager.h>
+#include <lbsposition.h>
+#include <bautils.h>
+#include <f32file.h>
+#include "mylocationsengine.h"
+#include "mylocationsdefines.h"
+#include "geocodeupdate.h" //header for CGeocodeUpdate class
+//handle for CMyLocationsHistoryDbObserver class
+#include "mylocationlogger.h"
+#if ( defined __WINSCW__ ) || ( defined __WINS__ )
+_LIT ( KImageStorageDrive, "C:\\Maptile\\");
+#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, " ");
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CMyLocationsEngine* CMyLocationsEngine::NewL()
+{
+    CMyLocationsEngine* self = new (ELeave) CMyLocationsEngine();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::ConstructL()
+{
+    __TRACE_CALLSTACK;
+    CActiveScheduler::Add(this);
+
+   
+
+    //Connection to Landmark DB
+    iLandmarkDb = CPosLandmarkDatabase::OpenL();
+    ExecuteAndDeleteLD(iLandmarkDb->InitializeL());
+
+    MYLOCLOGSTRING("Connection to Landmark DB.");
+    // create CMyLocationsDatabaseManager instance
+    iMyLocationsDatabaseManager = new (ELeave) CMyLocationsDatabaseManager;
+    iMyLocationsDatabaseManager->ConstructL();
+    
+    MYLOCLOGSTRING("create CMyLocationsDatabaseManager instance");
+
+    TRAPD( error , iMapTileInterface = CMapTileInterface::NewL());
+    if( error == KErrNone )
+    {
+        iMaptileGeocoderPluginAvailable = ETrue;	
+    }
+    
+    MYLOCLOGSTRING("iMapTileInterface = CMapTileInterface::NewL()");
+    //Maptile Db instance
+    iMaptileDatabase = CLookupMapTileDatabase::NewL(KMapTileLookupDatabaseName);
+
+    MYLOCLOGSTRING("Maptile Db instance created ");
+    
+    iAddressCompare = CAddressComparision::NewL();
+
+    MYLOCLOGSTRING(" start contact db observation ");
+    StartContactsChangeNotifierL();
+    MYLOCLOGSTRING(" start landmark db observation ");
+    StartLandmarksChangeNotifier();
+
+    //set the folder path to store maptile
+    imageFilePath.Zero();
+    SetFolderPathL();
+
+    TInt status;
+    iCalSession = CCalSession::NewL();
+    NotifyChangeL(status);
+
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::SetFolderPath()
+// set folder path structure
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::SetFolderPathL()
+{
+    __TRACE_CALLSTACK;
+    RFs session;
+    User::LeaveIfError(session.Connect());
+    if ( imageFilePath.Length() > 0 && BaflUtils::FolderExists(session, imageFilePath))
+    {
+        session.Close();
+        MYLOCLOGSTRING("Image folder path exists");
+        return;
+    }
+    const TUint EMediaMemoryCard = 0x000014;
+    imageFilePath.Zero();
+#if ( defined __WINSCW__ ) || ( defined __WINS__ )
+    imageFilePath.Copy(KImageStorageDrive);
+    MYLOCLOGSTRING("using in  debug mode");
+#else        
+    TVolumeInfo vol;
+    TInt driveNumber = EDriveE;
+    TChar driveLetter;
+    TDriveInfo driveInfo;
+    TInt error( KErrNone );
+    error=session.Volume(vol, driveNumber);
+    MYLOCLOGSTRING1("E drive volume info status -%d",error);
+    if (error == KErrNone)
+    {
+        error = session.Drive(driveInfo, driveNumber);
+        MYLOCLOGSTRING1("E driveinfo status -%d",error);
+        switch(driveInfo.iType)
+        {
+            case EMediaFlash:
+            case EMediaHardDisk:
+            case EMediaNANDFlash:
+            case EMediaMemoryCard:
+            case EMediaCdRom:
+            {
+                MYLOCLOGSTRING(" E drive match case");
+                session.DriveToChar( driveNumber , driveLetter );
+                imageFilePath.Append(driveLetter);
+                imageFilePath.Append(KFolderName);
+                break;
+            }
+            default:
+            break;
+
+        };
+    }
+
+    if (!imageFilePath.Length() > 0)
+    {
+        driveNumber = EDriveF;
+        error = session.Volume(vol, driveNumber);
+        MYLOCLOGSTRING1("F drive volume info status -%d",error);
+
+        if (error == KErrNone)
+        {
+            error = session.Drive(driveInfo, driveNumber);
+            MYLOCLOGSTRING1("F drive info status-%d", error);
+
+            switch (driveInfo.iMediaAtt)
+            {
+                /** Solid-state media. */
+                case EMediaFlash:
+                case EMediaHardDisk:
+                case EMediaNANDFlash:
+                case EMediaMemoryCard:
+                {
+                    MYLOCLOGSTRING("F drive exist as this type");
+                    session.DriveToChar(driveNumber, driveLetter);
+                    imageFilePath.Append(driveLetter);
+                    imageFilePath.Append(KFolderName);
+                    break;
+                }
+
+                default:
+                break;
+
+            };
+        }
+    }
+#endif
+    if (imageFilePath.Length()>0 && !BaflUtils::FolderExists(session, imageFilePath))
+    {
+        session.MkDirAll(imageFilePath);
+        MYLOCLOGSTRING("folder path does not exist , created ");
+    }
+    session.Close();
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CMyLocationsEngine()
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsEngine::CMyLocationsEngine() :
+    CActive(EPriorityStandard), iCalSession(NULL), iCalView(NULL), iContactsDb(
+            NULL), iContactChangeNotifier(NULL), iLandmarkDb(NULL),
+            iMapTileInterface(NULL), iMyLocationsDatabaseManager(NULL),
+            iMaptileDatabase(NULL), iAddressCompare(NULL),
+            iMaptileGeocoderPluginAvailable(EFalse),iCalenderNotification(NULL)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::~CMyLocationsEngine()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsEngine::~CMyLocationsEngine()
+{
+    __TRACE_CALLSTACK;// delete the member variables.
+   
+    delete iContactChangeNotifier;
+
+    delete iMyLocationsDatabaseManager;
+
+    delete iLandmarkDb;
+
+    delete iContactsDb;
+   
+    delete iCalView;
+	
+    delete iCalSession;
+	 
+	delete iMapTileInterface;
+
+    delete iMaptileDatabase;
+
+    delete iAddressCompare;
+    
+    delete iCalenderNotification;
+    
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::NotifyChangeL()
+// Starts calender db create notification to get callbacks. 
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::NotifyChangeL(TInt &aStatus)
+{
+    __TRACE_CALLSTACK;
+    
+    TBufC<KDefaultFilePathSize> defaultFile = iCalSession->DefaultFileNameL();
+    TChar drive = defaultFile[0];
+    
+    TRAP(aStatus, iCalSession->OpenL( defaultFile ));
+    MYLOCLOGSTRING1("iCalSession->OpenL() status-%d",aStatus);
+    if ( KErrNone == aStatus )
+    {
+        // create a calendar entry view with the opened session
+        iCalView = CCalEntryView::NewL(*iCalSession);
+        StartCalenderChangeNotifierL();
+    }
+    else
+    {
+        if( !iCalenderNotification )
+        {
+            iCalenderNotification = CCalenderNotification::NewL( this );
+        }
+        
+        
+        iCalenderNotification->CheckCalenderDbFileStructure( drive );
+    }
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::StartCalenderChangeNotifierL()
+// Starts calender change notification method to get callbacks when entries are 
+// added/modified/deleted in contacts
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::StartCalenderChangeNotifierL()
+{
+    __TRACE_CALLSTACK;// Get the current time and set Calendar filter to consider entries whose start time
+    // fall under the timeframe one year past and one year ahead of the current time.
+    if (iCalSession)
+    {
+        MYLOCLOGSTRING("iCalSession is not null");
+        TTime currentTime;
+        currentTime.HomeTime();
+
+        TTime startTime = currentTime - TTimeIntervalYears(1);
+        TTime endTime = currentTime + TTimeIntervalYears(1);
+
+        TCalTime calStartTime;
+        calStartTime.SetTimeLocalL(startTime);
+        
+        MYLOCLOGSTRING("SetTimeLocalL(startTime)");
+
+        TCalTime calEndTime;
+        calEndTime.SetTimeLocalL(endTime);
+        
+        MYLOCLOGSTRING("SetTimeLocalL(endTime)");
+
+        // set the filter for modification tracking
+        CCalChangeNotificationFilter *filter =
+                CCalChangeNotificationFilter::NewL(
+                        MCalChangeCallBack2::EChangeEntryAll, ETrue,
+                        CalCommon::TCalTimeRange(calStartTime, calEndTime));
+        MYLOCLOGSTRING(" CCalChangeNotificationFilter::NewL()");
+        // 'this' object implements MCalChangeCallBack
+        iCalSession->StartChangeNotification(*this, *filter);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::StartContactsChangeNotifierL()
+// Starts contacts change notification method to get callbacks when entries are 
+// added/modified/deleted in contacts
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::StartContactsChangeNotifierL()
+{
+    __TRACE_CALLSTACK;
+   
+    GeocodeUpdate::CreateContactdb();
+    iContactsDb = CContactDatabase::OpenL();
+    // Create CContactChangeNotifier object with 'this' object. 
+    iContactChangeNotifier = CContactChangeNotifier::NewL(*iContactsDb,this);
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::StartLandmarksChangeNotifier()
+// Starts landmarks change notification method to get callbacks when entries are added/modified/deleted in landmarks
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::StartLandmarksChangeNotifier()
+{
+    __TRACE_CALLSTACK;// Resume event listening
+    iLandmarkDb->NotifyDatabaseEvent(iLmEvent, iStatus);
+    SetActive();
+}
+
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::CalChangeNotification()
+// Callback when there is a change in the calendar database.
+// -----------------------------------------------------------------------------
+//
+
+void CMyLocationsEngine::CalChangeNotification(
+        RArray<TCalChangeEntry>& aChangeItems)
+{
+    __TRACE_CALLSTACK;
+    
+    if(iCalenderNotification)
+    {
+        delete iCalenderNotification;
+        iCalenderNotification = NULL;
+    }
+    
+    // get entries associated with this UID
+    for (int i = 0; i < aChangeItems.Count(); i++)
+    {
+
+        TCalChangeEntry calChangeEntry = aChangeItems[i];
+        iEventType = calChangeEntry.iChangeType;
+        switch (calChangeEntry.iChangeType)
+        {
+        case EChangeAdd:
+        {
+            
+            TRAP_IGNORE(CalenderEntryAddedL(calChangeEntry));
+            break;
+        }
+
+        case EChangeModify:
+        {
+
+            TLookupItem lookupItem;
+            lookupItem.iSource = ESourceCalendar;
+            lookupItem.iUid = calChangeEntry.iEntryId;
+            //TODO: comapare address and then delete 
+            TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem) );
+            TRAP_IGNORE( CalenderEntryAddedL(calChangeEntry) );
+            break;
+        }
+        case EChangeDelete:
+        {
+            TLookupItem lookupItem;
+            lookupItem.iSource = ESourceCalendar;
+            lookupItem.iUid = calChangeEntry.iEntryId;
+           TRAP_IGNORE( iMaptileDatabase->DeleteEntryL(lookupItem));
+            break;
+        }
+        };
+
+    }
+}
+
+void CMyLocationsEngine::CalenderEntryAddedL(TCalChangeEntry aCalChangeEntry)
+{
+    __TRACE_CALLSTACK;
+    CCalEntry* calEntry = NULL;
+    calEntry = iCalView->FetchL(aCalChangeEntry.iEntryId);
+    TPtrC address(calEntry->LocationL());
+    if(address.Length()>0)
+    {        
+        RequestMapTileImageL(address,ESourceCalendar, aCalChangeEntry.iEntryId);
+    }
+    delete calEntry;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::HandleDatabaseEventL()
+// Callback that provides information about the contact database change event.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::HandleDatabaseEventL(TContactDbObserverEvent aEvent)
+{
+    __TRACE_CALLSTACK;
+    
+    HandlelandmarkDatabaseL(aEvent);
+    
+    //Forward the event for maptile fetching only if maptile plugin available
+    if( iMaptileGeocoderPluginAvailable )
+    {
+        TriggerMaptileRequestL(aEvent);
+    }
+    
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::HandlelandmarkDatabaseL()
+// Process the contact database event and updates the landmark database
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::HandlelandmarkDatabaseL(
+        TContactDbObserverEvent& aEvent)
+{
+    __TRACE_CALLSTACK;// If contact is modified or added, update the mylocations db
+    if (aEvent.iType == EContactDbObserverEventContactChanged || aEvent.iType
+            == EContactDbObserverEventContactAdded)
+    {
+        //Get the contact item
+        CContactItem* contactItem =
+                iContactsDb->ReadContactL(aEvent.iContactId);
+
+        if (contactItem)
+        {
+            CleanupStack::PushL(contactItem);
+
+            // Get the default/prefered address details
+            CPosLandmark *preferedAddressLm = GetContactLocationDetailsLC(
+                    contactItem, EAddressPref);
+
+            // Get the work address details
+            CPosLandmark *workAddressLm = GetContactLocationDetailsLC(
+                    contactItem, EAddressWork);
+
+            // Get the home address details
+            CPosLandmark *homeAddressLm = GetContactLocationDetailsLC(
+                    contactItem, EAddressHome);
+
+            // if the contact item has no validated address (preferef, home or work)
+            if (!preferedAddressLm && !workAddressLm && !homeAddressLm)
+            {
+                if (aEvent.iType == EContactDbObserverEventContactChanged)
+                {
+                    // If the contact is a modified one and it might already exist in
+                    // mylocations db, so delete it
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                            aEvent.iContactId, ESourceContactsPref,
+                            EEntryDeleted);
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                            aEvent.iContactId, ESourceContactsWork,
+                            EEntryDeleted);
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(NULL,
+                            aEvent.iContactId, ESourceContactsHome,
+                            EEntryDeleted);
+                }
+            }
+            else
+            {
+                // There is atleast one valid address present.       
+
+                // Get the TEntryChangeType for contacts.
+                TEntryChangeType changeType = MapChangeType(
+                        ESourceContactsPref, aEvent.iType);
+
+                // if home address available, update Mylocations.  
+                if (homeAddressLm)
+                {
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(homeAddressLm,
+                            aEvent.iContactId, ESourceContactsHome, changeType);
+                    CleanupStack::PopAndDestroy(homeAddressLm);
+                }
+
+                // if work address available, update Mylocations.  
+                if (workAddressLm)
+                {
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(workAddressLm,
+                            aEvent.iContactId, ESourceContactsWork, changeType);
+                    CleanupStack::PopAndDestroy(workAddressLm);
+                }
+
+                // if prefered address available, update Mylocations.  
+                if (preferedAddressLm)
+                {
+                    iMyLocationsDatabaseManager->UpdateDatabaseL(
+                            preferedAddressLm, aEvent.iContactId,
+                            ESourceContactsPref, changeType);
+                    CleanupStack::PopAndDestroy(preferedAddressLm);
+                }
+
+            }
+
+            // Pop and destroy the contactItem
+            CleanupStack::PopAndDestroy(contactItem);
+        }
+    }
+    else if (aEvent.iType == EContactDbObserverEventContactDeleted)
+    {
+        // the contact is deleted, so delete the corresponding entries from database.
+
+        // delete prefered address in database
+        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+                ESourceContactsPref, EEntryDeleted);
+
+        // delete work address in database
+        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+                ESourceContactsWork, EEntryDeleted);
+
+        // delete home address in database
+        iMyLocationsDatabaseManager->UpdateDatabaseL(NULL, aEvent.iContactId,
+                ESourceContactsHome, EEntryDeleted);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::TriggerMaptileRequestL()
+// Callback that provides information about the contact database change event.
+// -----------------------------------------------------------------------------
+//
+
+void CMyLocationsEngine::TriggerMaptileRequestL(TContactDbObserverEvent& aEvent)
+{
+    __TRACE_CALLSTACK;
+    TLookupItem lookupItem;
+    lookupItem.iUid = aEvent.iContactId;
+    // If contact is deleted delete from mylocations db
+    /*    if (aEvent.iType == EContactDbObserverEventContactDeleted)
+     {
+     MYLOCLOGSTRING("EContactDbObserverEventContactDeleted" );
+     // delete prefered address in database
+     lookupItem.iSource = ESourceContactsPref;
+     FindEntryAndDeleteL(lookupItem);
+
+     lookupItem.iSource = ESourceContactsWork;
+     FindEntryAndDeleteL(lookupItem);
+
+     lookupItem.iSource = ESourceContactsHome;
+     FindEntryAndDeleteL(lookupItem);
+     }*/
+
+    //Get the contact item
+    iEventType = aEvent.iType;
+    CContactItem* contactItem = iContactsDb->ReadContactL(aEvent.iContactId);
+    CleanupStack::PushL(contactItem);
+
+    CPosLandmark *preferedAddressLm = NULL;
+    CPosLandmark *workAddressLm = NULL;
+    CPosLandmark *homeAddressLm = NULL;
+
+    // If contact is modified or added, update the mylocations db
+    /* if (contactItem)
+     {
+     CleanupStack::PushL(contactItem);
+     */
+    // Get the home address details
+    homeAddressLm = GetContactAddressDetailsLC(contactItem, EAddressHome);
+
+    // Get the work address details
+    workAddressLm = GetContactAddressDetailsLC(contactItem, EAddressWork);
+
+    // Get the default/prefered address details
+    preferedAddressLm = GetContactAddressDetailsLC(contactItem, EAddressPref);
+
+    // iContactUid = aEvent.iContactId;
+    switch (aEvent.iType)
+    {
+    case EContactDbObserverEventContactChanged:
+    {
+        MYLOCLOGSTRING("EContactDbObserverEventContactChanged" );MYLOCLOGSTRING1("iMapTileRequestQueue.Count()-%d",iMapTileRequestQueue.Count() );
+
+        if (iMapTileRequestQueue.Count() > 0)
+        {
+            if (iMapTileRequestQueue[0]->iUId == aEvent.iContactId)
+            {
+                if (preferedAddressLm)
+                {
+                    CleanupStack::PopAndDestroy(preferedAddressLm);
+                }
+                if (workAddressLm)
+                {
+                    CleanupStack::PopAndDestroy(workAddressLm);
+                }
+                if (homeAddressLm)
+                {
+                    CleanupStack::PopAndDestroy(homeAddressLm);
+                }
+
+                CleanupStack::PopAndDestroy(contactItem);
+                MYLOCLOGSTRING("retrun from geolocation callback" );
+                return;
+            }
+        }
+        /*
+         // if the contact item has no validated address (preferef, home or work)
+         if (!preferedAddressLm && !workAddressLm && !homeAddressLm)
+         {
+         MYLOCLOGSTRING("Contact changed no  address" );
+         //Delete the entries from maptile lookup table
+         lookupItem.iSource = ESourceContactsPref;
+         iMaptileDatabase->DeleteEntryL(lookupItem);
+
+         lookupItem.iSource = ESourceContactsWork;
+         iMaptileDatabase->DeleteEntryL(lookupItem);
+
+         lookupItem.iSource = ESourceContactsHome;
+         iMaptileDatabase->DeleteEntryL(lookupItem);
+
+         }*/
+        /* else
+         {*/
+        MYLOCLOGSTRING("Contact address changed" );
+
+        // if default address available, update Mylocations. 
+        lookupItem.iSource = ESourceContactsPref;
+        if (preferedAddressLm)
+        {
+            MYLOCLOGSTRING("preferedAddressLm address changed" );
+
+            if (iAddressCompare->IsAddressChangedL(*preferedAddressLm,
+                    aEvent.iContactId, ESourceContactsPref))
+
+            {
+                //remove entry from database
+                iMaptileDatabase->DeleteEntryL(lookupItem);
+                RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
+                        aEvent.iContactId);
+            }
+
+            CleanupStack::PopAndDestroy(preferedAddressLm);
+
+        }
+        else
+        {
+            iMaptileDatabase->DeleteEntryL(lookupItem);
+        }
+
+        // if work address available, update Mylocations.
+        lookupItem.iSource = ESourceContactsWork;
+        if (workAddressLm)
+        {
+            MYLOCLOGSTRING("workAddressLm address changed" );
+            if (iAddressCompare->IsAddressChangedL(*workAddressLm,
+                    aEvent.iContactId, ESourceContactsWork))
+            //remove entry from database
+            {
+                iMaptileDatabase->DeleteEntryL(lookupItem);
+                RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
+                        aEvent.iContactId);
+            }
+
+            CleanupStack::PopAndDestroy(workAddressLm);
+
+        }
+        else
+        {
+            iMaptileDatabase->DeleteEntryL(lookupItem);
+        }
+
+        // if home address available, update Mylocations.
+        lookupItem.iSource = ESourceContactsHome;
+        if (homeAddressLm)
+        {
+            MYLOCLOGSTRING("homeAddressLm address changed" );
+
+            if (iAddressCompare->IsAddressChangedL(*homeAddressLm,
+                    aEvent.iContactId, ESourceContactsHome))
+
+            {
+                //remove entry from databse
+                iMaptileDatabase->DeleteEntryL(lookupItem);
+                RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
+                        aEvent.iContactId);
+            }
+            CleanupStack::PopAndDestroy(homeAddressLm);
+        }
+        else
+        {
+            iMaptileDatabase->DeleteEntryL(lookupItem);
+        }
+        // }
+        break;
+    }
+    case 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" );
+        if (preferedAddressLm)
+        {
+            RequestMapTileImageL(*preferedAddressLm, ESourceContactsPref,
+                    aEvent.iContactId);
+            CleanupStack::PopAndDestroy(preferedAddressLm);
+        }
+        if (workAddressLm)
+        {
+            RequestMapTileImageL(*workAddressLm, ESourceContactsWork,
+                    aEvent.iContactId);
+            CleanupStack::PopAndDestroy(workAddressLm);
+        }
+        if (homeAddressLm)
+        {
+            RequestMapTileImageL(*homeAddressLm, ESourceContactsHome,
+                    aEvent.iContactId);
+            CleanupStack::PopAndDestroy(homeAddressLm);
+        }
+        break;
+    }
+
+    };
+    CleanupStack::PopAndDestroy(contactItem);
+    //}
+
+}
+
+void CMyLocationsEngine::RequestMapTileImageL(const TDesC& aAddressDetails,
+        const TUidSourceType aAddressType, const TInt32 aUId)
+{
+    __TRACE_CALLSTACK;
+    SetFolderPathL();
+    TBuf<KImagePathSize> mImagePath;
+
+    //mImagePath.Append(KImageStorageDrive);
+    mImagePath.Copy(imageFilePath);
+    mImagePath.AppendNum(aUId);
+    mImagePath.AppendNum(aAddressType);
+    mImagePath.Append(KPNGType);
+
+    CMapTileRequest* mapTileRequest = new (ELeave) CMapTileRequest;
+
+    mapTileRequest->iAddressDetails = aAddressDetails.AllocL();
+    mapTileRequest->iUId = aUId;
+    mapTileRequest->iAddressType = aAddressType;
+    mapTileRequest->iEventType = iEventType;
+    mapTileRequest->iImagePath.Zero();
+    mapTileRequest->iImagePath.Copy(mImagePath);
+    if (iMapTileRequestQueue.Count() <= 0)
+    {
+        if ( KErrNone == RequestExecute(mapTileRequest) )
+        {
+            iMapTileRequestQueue.Append(mapTileRequest);
+        }
+        else
+        {
+            delete mapTileRequest;
+        }       
+    }
+    else
+    {
+        MYLOCLOGSTRING("Added one more request to request queue" );
+        iMapTileRequestQueue.Append(mapTileRequest);
+    }
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RequestMapTileImageL()
+// Request to get maptiel
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::RequestMapTileImageL(CPosLandmark& aLandmark,
+        const TUidSourceType aAddressType, const TInt32 aUId)
+{
+    __TRACE_CALLSTACK;
+
+    MYLOCLOGSTRING("check folder path existance!");
+    SetFolderPathL();
+    TBuf<KImagePathSize> mImagePath;
+
+    //mImagePath.Append(KImageStorageDrive);
+    mImagePath.Copy(imageFilePath);
+    mImagePath.AppendNum(aUId);
+    mImagePath.AppendNum(aAddressType);
+    mImagePath.Append(KPNGType);
+
+    CMapTileRequest* mapTileRequest = new (ELeave) CMapTileRequest;
+
+    mapTileRequest->iLandmarkInfo = CPosLandmark::NewL(aLandmark);
+    mapTileRequest->iUId = aUId;
+    mapTileRequest->iAddressType = aAddressType;
+    mapTileRequest->iEventType = iEventType;
+    mapTileRequest->iImagePath.Zero();
+    mapTileRequest->iImagePath.Copy(mImagePath);
+    MYLOCLOGSTRING1("RequestMapTileImageL() Queue count -%d",iMapTileRequestQueue.Count());
+
+    if (iMapTileRequestQueue.Count() <= 0)
+       {
+          // iMapTileRequestQueue.Append(mapTileRequest);
+           if( KErrNone == RequestExecute(mapTileRequest) )
+           {
+               iMapTileRequestQueue.Append(mapTileRequest);
+           }
+           else
+           {
+               delete mapTileRequest;
+           }          
+       }
+       else
+       {
+           MYLOCLOGSTRING("Added one more request to request queue" );
+           iMapTileRequestQueue.Append(mapTileRequest);
+       }
+    
+   
+}
+TInt CMyLocationsEngine::RequestExecute( CMapTileRequest* aMapTileRequest)
+{
+    __TRACE_CALLSTACK;
+    TInt errorCode;
+    switch (aMapTileRequest->iAddressType)
+    {
+        case ESourceCalendar:
+        {
+            TRAP(errorCode,iMapTileInterface->GetMapTileImageL(aMapTileRequest->iAddressDetails->Des(),
+                            aMapTileRequest->iImagePath, this ));        
+            break;
+        }
+        case ESourceContactsPref:
+        case ESourceContactsWork:
+        case ESourceContactsHome:
+        {
+            TRAP(errorCode, iMapTileInterface->GetMapTileImageL(aMapTileRequest->iLandmarkInfo,
+                            aMapTileRequest->iImagePath, this));            
+            break;
+        }
+    };  
+
+    return errorCode;
+}
+ 
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::GetLocationDetailsLC()
+// get locatin details
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMyLocationsEngine::GetContactAddressDetailsLC(
+        const CContactItem *aContactItem, TContactAddressType aAddressType)
+{
+    __TRACE_CALLSTACK;
+    CPosLandmark *landmark = NULL;
+
+    // Set the street
+    TInt adrId = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapADR);
+
+    if (adrId != KErrNotFound)
+    {
+        TPtrC tempText =
+                aContactItem->CardFields()[adrId].TextStorage()->Text();
+        if (tempText.Length() > 0)
+        {
+            if (!landmark)
+            {
+                landmark = CPosLandmark::NewL();
+                CleanupStack::PushL(landmark);
+            }
+
+            landmark->SetPositionFieldL(EPositionFieldStreet, tempText);
+        }
+    }
+
+    // Set the City
+    adrId = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapLOCALITY);
+    if (adrId != KErrNotFound)
+    {
+        TPtrC tempText =
+                aContactItem->CardFields()[adrId].TextStorage()->Text();
+        if (tempText.Length() > 0)
+        {
+            if (!landmark)
+            {
+                landmark = CPosLandmark::NewL();
+                CleanupStack::PushL(landmark);
+            }
+            landmark->SetPositionFieldL(EPositionFieldCity, tempText);
+        }
+    }
+
+    // Set the state/region
+    adrId = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapREGION);
+    if (adrId != KErrNotFound)
+    {
+        TPtrC tempText =
+                aContactItem->CardFields()[adrId].TextStorage()->Text();
+        if (tempText.Length() > 0)
+        {
+            if (!landmark)
+            {
+                landmark = CPosLandmark::NewL();
+                CleanupStack::PushL(landmark);
+            }
+            landmark->SetPositionFieldL(EPositionFieldState, tempText);
+        }
+    }
+
+    // Set the Postal code
+    adrId = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapPOSTCODE);
+    if (adrId != KErrNotFound)
+    {
+        TPtrC tempText =
+                aContactItem->CardFields()[adrId].TextStorage()->Text();
+        if (tempText.Length() > 0)
+        {
+            if (!landmark)
+            {
+                landmark = CPosLandmark::NewL();
+                CleanupStack::PushL(landmark);
+            }
+            landmark->SetPositionFieldL(EPositionFieldPostalCode, tempText);
+        }
+    }
+
+    // Set the country
+    adrId = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapCOUNTRY);
+    if (adrId != KErrNotFound)
+    {
+        TPtrC tempText =
+                aContactItem->CardFields()[adrId].TextStorage()->Text();
+        if (tempText.Length() > 0)
+        {
+            if (!landmark)
+            {
+                landmark = CPosLandmark::NewL();
+                CleanupStack::PushL(landmark);
+            }
+            landmark->SetPositionFieldL(EPositionFieldCountry, tempText);
+        }
+    }
+       
+    return landmark;
+
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::GetContactLocationDetailsLC()
+// Finds the contact's location details
+// -----------------------------------------------------------------------------
+//
+CPosLandmark* CMyLocationsEngine::GetContactLocationDetailsLC(
+        const CContactItem *aContactItem, TContactAddressType aAddressType)
+{
+    __TRACE_CALLSTACK;//return value
+    CPosLandmark *landmark = NULL;
+    // Get the geo field
+    TInt addrInd = FindContactsField(aContactItem, aAddressType,
+            KUidContactFieldVCardMapGEO);
+    if (addrInd != KErrNotFound)
+    {
+        // Geo field present. 
+
+        TPtrC addrText =
+                aContactItem->CardFields()[addrInd].TextStorage()->Text();
+        if (addrText.Length() > 0)
+        {
+            //Parse the addresstext to get the latitude and longitude
+            TInt separator = addrText.Find(KSeparator);
+            if (separator != KErrNotFound)
+            {
+                TReal64 latitude = 0;
+                TReal64 longitude = 0;
+                TLex lexLatitude(addrText.Left(addrText.Length() - separator));
+                TLex lexLongitude(addrText.Right(addrText.Length() - separator
+                        - 1));
+                if (lexLatitude.Val(latitude) == KErrNone && lexLongitude.Val(
+                        longitude) == KErrNone)
+                {
+                    TLocality loc(TCoordinate(latitude, longitude), 0);
+
+                    landmark = CPosLandmark::NewL();
+                    CleanupStack::PushL(landmark);
+
+                    // Fill the location details into the landmark object
+                    landmark->SetPositionL(loc);
+
+                    // Set the landmark name as contact name
+                    TBuf<KBufSize> sName1;
+                    TBool nameEmpty = ETrue;
+                    //get the second name and
+                    TInt sNameInd = aContactItem->CardFields().Find(
+                            KUidContactFieldGivenName);
+                    if (sNameInd != KErrNotFound)
+                    {
+                        TPtrC      sName =
+                                        aContactItem->CardFields()[sNameInd].TextStorage()->Text();
+                        sName1.Copy(sName);
+                        nameEmpty = EFalse;
+                    }
+
+                    sNameInd = aContactItem->CardFields().Find(
+                            KUidContactFieldFamilyName);
+                    if (sNameInd != KErrNotFound)
+                    {
+                        if (!nameEmpty)
+                        {
+                            sName1.Append(KSingleSpace);
+                        }
+                        TPtrC
+                                sName =
+                                        aContactItem->CardFields()[sNameInd].TextStorage()->Text();
+                        sName1.Append(sName);
+                    }
+
+                    TRAP_IGNORE( landmark->SetLandmarkNameL( sName1 ) );
+
+                    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);
+                    if (adrId != KErrNotFound)
+                    {
+                        TPtrC
+                                tempText =
+                                        aContactItem->CardFields()[adrId].TextStorage()->Text();
+                        if (tempText.Length() > 0)
+                        {
+                            landmark->SetPositionFieldL(EPositionFieldStreet,
+                                    tempText);
+                        }
+                    }
+
+                    // Set the City
+                    adrId = FindContactsField(aContactItem, aAddressType,
+                            KUidContactFieldVCardMapLOCALITY);
+                    if (adrId != KErrNotFound)
+                    {
+                        TPtrC
+                                tempText =
+                                        aContactItem->CardFields()[adrId].TextStorage()->Text();
+                        if (tempText.Length() > 0)
+                        {
+                            landmark->SetPositionFieldL(EPositionFieldCity,
+                                    tempText);
+                        }
+                    }
+
+                    // Set the state/region
+                    adrId = FindContactsField(aContactItem, aAddressType,
+                            KUidContactFieldVCardMapREGION);
+                    if (adrId != KErrNotFound)
+                    {
+                        TPtrC
+                                tempText =
+                                        aContactItem->CardFields()[adrId].TextStorage()->Text();
+                        if (tempText.Length() > 0)
+                        {
+                            landmark->SetPositionFieldL(EPositionFieldState,
+                                    tempText);
+                        }
+                    }
+
+                    // Set the Postal code
+                    adrId = FindContactsField(aContactItem, aAddressType,
+                            KUidContactFieldVCardMapPOSTCODE);
+                    if (adrId != KErrNotFound)
+                    {
+                        TPtrC
+                                tempText =
+                                        aContactItem->CardFields()[adrId].TextStorage()->Text();
+                        if (tempText.Length() > 0)
+                        {
+                            landmark->SetPositionFieldL(
+                                    EPositionFieldPostalCode, tempText);
+                        }
+                    }
+
+                    // Set the country
+                    adrId = FindContactsField(aContactItem, aAddressType,
+                            KUidContactFieldVCardMapCOUNTRY);
+                    if (adrId != KErrNotFound)
+                    {
+                        TPtrC
+                                tempText =
+                                        aContactItem->CardFields()[adrId].TextStorage()->Text();
+                        if (tempText.Length() > 0)
+                        {
+                            landmark->SetPositionFieldL(EPositionFieldCountry,
+                                    tempText);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    return landmark;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::FindContactsField()
+// Finds the contact's field type id
+// -----------------------------------------------------------------------------
+//
+
+TInt CMyLocationsEngine::FindContactsField(const CContactItem *aContactItem,
+        TContactAddressType aAddressType, TUid aField)
+{
+    __TRACE_CALLSTACK;
+    if (aAddressType == EAddressPref) // default/prefered address
+    {
+        return aContactItem->CardFields().Find(aField);
+    }
+    else if (aAddressType == EAddressWork) // work address
+    {
+        return aContactItem->CardFields().Find(KUidContactFieldVCardMapWORK,
+                aField);
+    }
+    else // home address
+    {
+        return aContactItem->CardFields().Find(KUidContactFieldVCardMapHOME,
+                aField);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::MapsChangeType()
+// Maps the source's change type to Mylocations entry change type
+// -----------------------------------------------------------------------------
+//
+TEntryChangeType CMyLocationsEngine::MapChangeType(TUidSourceType aSrcType,
+        TUint32 aChangeType)
+{
+    __TRACE_CALLSTACK;// return value
+    TEntryChangeType retVal = EEntryUnknown;
+
+    switch (aSrcType)
+    {
+    // if source type is contacts
+    case ESourceContactsPref:
+    case ESourceContactsWork:
+    case ESourceContactsHome:
+    {
+        switch (aChangeType)
+        {
+        case EContactDbObserverEventContactAdded:
+            retVal = EEntryAdded;
+            break;
+        case EContactDbObserverEventContactDeleted:
+            retVal = EEntryDeleted;
+            break;
+        case EContactDbObserverEventContactChanged:
+            retVal = EEntryModified;
+            break;
+        }
+        break;
+    }
+
+        // if source type is landmarks or maps history
+    case ESourceLandmarks:
+    {
+        switch (aChangeType)
+        {
+        case EPosLmEventLandmarkCreated:
+            retVal = EEntryAdded;
+            break;
+        case EPosLmEventLandmarkDeleted:
+            retVal = EEntryDeleted;
+            break;
+        case EPosLmEventLandmarkUpdated:
+            retVal = EEntryModified;
+            break;
+        }
+        break;
+    }
+    case ESourceLandmarksCategory:
+    {
+        switch (aChangeType)
+        {
+        case EPosLmEventCategoryCreated:
+            retVal = EEntryAdded;
+            break;
+        }
+    }
+        break;
+    }
+    return retVal;
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::MyLocationsDbManager()
+// Gets handle to mylocations database manager.
+// -----------------------------------------------------------------------------
+//
+CMyLocationsDatabaseManager& CMyLocationsEngine::MyLocationsDbManager()
+{
+    __TRACE_CALLSTACK;
+    return *iMyLocationsDatabaseManager;
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RunL()
+// Handles active object's request completion event.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::RunL()
+{
+    __TRACE_CALLSTACK;
+    switch (iLmEvent.iEventType)
+    {
+    case EPosLmEventLandmarkCreated:
+    case EPosLmEventLandmarkUpdated:
+    {
+        TBuf<KMaxAddressLength> lmAddress;
+        CPosLandmark* readLandmark = iLandmarkDb->ReadLandmarkLC(
+                iLmEvent.iLandmarkItemId);
+
+        if (readLandmark)
+        {
+            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 ) );
+            }
+
+            // 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);
+    }
+        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.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::DoCancel()
+{
+    __TRACE_CALLSTACK;
+    iLandmarkDb->CancelNotifyDatabaseEvent();
+}
+
+// -----------------------------------------------------------------------------
+// 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.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::MapTilefetchingCompleted(TInt aErrCode,
+        const TDesC& aMapTilePath)
+{
+    __TRACE_CALLSTACK;
+    MYLOCLOGSTRING1("MapTilefetchingCompleted aErrCode - %d ",aErrCode);
+    MYLOCLOGSTRING1("iMapTileRequestQueue.Count - %d",iMapTileRequestQueue.Count());
+
+    if (iMapTileRequestQueue.Count() > 0)
+    {
+
+        MYLOCLOGSTRING1("No.of RequestQueue - %d",iMapTileRequestQueue.Count());
+
+        if (aErrCode == KErrNone )
+        {           
+            TLookupItem lookupItem;
+            lookupItem.iSource = iMapTileRequestQueue[0]->iAddressType;
+            lookupItem.iUid = iMapTileRequestQueue[0]->iUId;
+            lookupItem.iFilePath.Copy(aMapTilePath);
+            TRAP_IGNORE( HandleMaptileDatabaseL(iMapTileRequestQueue[0]->iEventType,lookupItem ) );
+        }
+
+            delete iMapTileRequestQueue[0];
+            iMapTileRequestQueue.Remove(0);
+            iMapTileRequestQueue.Compress();
+    }
+    
+    
+    //Process the next request
+    if (iMapTileRequestQueue.Count() > 0)
+    {
+        MYLOCLOGSTRING1("MapTile fetch completed request-%d",iMapTileRequestQueue.Count());
+        for (TInt cnt = 0; cnt < iMapTileRequestQueue.Count(); cnt++)
+        {          
+            if ( KErrNone == RequestExecute(iMapTileRequestQueue[0]) )
+            {
+                break;
+            }
+            else
+            {
+                delete iMapTileRequestQueue[0];
+                iMapTileRequestQueue.Remove(0);
+                iMapTileRequestQueue.Compress();
+            }
+        }
+    }
+    else
+    {
+        MYLOCLOGSTRING("MapTile fetch completed no request in queue");
+        iMapTileRequestQueue.Reset();
+    }
+
+}
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::HandleMaptileDatabaseL()
+// Handle maptile database(find/create/update/delete).
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::HandleMaptileDatabaseL(
+        TInt aEventType, TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;
+    if (aEventType == EContactDbObserverEventContactChanged || aEventType
+            == EChangeModify)
+    {
+        if (iMaptileDatabase->FindEntryL(aLookupItem))
+        {
+            iMaptileDatabase->UpdateEntryL(aLookupItem);
+        }
+        else
+        {
+            iMaptileDatabase->CreateEntryL(aLookupItem);
+        }
+    }
+    else if (aEventType == EContactDbObserverEventContactAdded || aEventType
+            == EChangeAdd)
+    {
+        iMaptileDatabase->CreateEntryL(aLookupItem);
+
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CMyLocationsEngine::RestGeoCodeCompleted()
+// observed when rest geo codeing completed.
+// started lat and lon field updation into contact db.
+// -----------------------------------------------------------------------------
+//
+void CMyLocationsEngine::RestGeoCodeCompleted(TReal aLatitude, TReal aLongitude)
+{
+    __TRACE_CALLSTACK;
+
+    MYLOCLOGSTRING1("No. of iMapTileRequestQueue - %d",iMapTileRequestQueue.Count());
+    if (iMapTileRequestQueue.Count() > 0)
+    {
+        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;
+            }
+        };
+
+        
+    }
+
+}
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/mylocationsengine/src/mylocationslookupdb.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,410 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Mylocation database lookup table implementation.
+*
+*/
+
+#include <BAUTILS.H>
+#include <EPos_CPosLmCategoryManager.h>
+#include "mylocationslookupdb.h"
+#include "mylocationlogger.h"
+// select all from
+_LIT( KSelectAllFrom, "SELECT * FROM " );
+// string 'where'
+_LIT( KStringWhere, " WHERE " );
+// string ' = '
+_LIT( KStringEqual, " = " );
+// string 'And'
+_LIT( KStringAnd, " AND " );
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::CLookupDatabase()
+// Default constructor.
+// -----------------------------------------------------------------------------
+//
+CLookupDatabase::CLookupDatabase()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::~CLookupDatabase()
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CLookupDatabase::~CLookupDatabase()
+{
+    __TRACE_CALLSTACK;// close the database
+    iItemsDatabase.Close();
+    // close the file session
+    iFsSession.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::~CLookupDatabase()
+// Creates an object of this class and pushes to cleanup stack.
+// -----------------------------------------------------------------------------
+//
+CLookupDatabase* CLookupDatabase::NewLC(const TDesC& aLookupTableName)
+{
+    CLookupDatabase* self = new (ELeave) CLookupDatabase;
+    CleanupStack::PushL(self);
+    self->ConstructL(aLookupTableName);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::NewL()
+// Creates an object of this class.
+// -----------------------------------------------------------------------------
+//
+CLookupDatabase* CLookupDatabase::NewL(const TDesC& aLookupTableName)
+{
+    CLookupDatabase* self = CLookupDatabase::NewLC(aLookupTableName);
+    CleanupStack::Pop(self);
+    return self;
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::ConstructL()
+// 2nd phase contructor.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::ConstructL(const TDesC& aLookupTableName)
+{
+    __TRACE_CALLSTACK;
+    User::LeaveIfError(iFsSession.Connect());
+
+    //create private path
+    User::LeaveIfError(iFsSession.CreatePrivatePath(RFs::GetSystemDrive()));
+    // private path with no drive on it
+    iFsSession.PrivatePath(iDbFileName);
+
+    TFindFile PrivFolder(iFsSession);
+    // find out the drive
+    if (KErrNone == PrivFolder.FindByDir(iDbFileName, KNullDesC))
+    {
+        iFsSession.MkDir(KLookupDbPath);
+        iDbFileName.Copy(KLookupDbPath);
+        iDbFileName.Append(aLookupTableName);
+
+        if (!BaflUtils::FileExists(iFsSession, iDbFileName))
+        { // no database exists so we make one
+            User::LeaveIfError(iItemsDatabase.Create(iFsSession, iDbFileName));
+            // and will create the only table needed for it
+            CreateTableL(iItemsDatabase);
+
+            //close the database
+            iItemsDatabase.Close();
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::Open()
+// Opens the lookup database.
+// -----------------------------------------------------------------------------
+//
+TInt CLookupDatabase::Open()
+{
+    __TRACE_CALLSTACK;
+    return iItemsDatabase.Open(iFsSession, iDbFileName);
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::Close()
+// Closes the lookup database.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::Close()
+{
+    __TRACE_CALLSTACK;
+    iItemsDatabase.Close();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::CreateTableL()
+// Creates a lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::CreateTableL(RDbDatabase& aDatabase)
+{
+    __TRACE_CALLSTACK;// Create a table definition
+    CDbColSet* columns = CDbColSet::NewLC();
+
+    // Add Columns
+
+    // Add uid column
+    columns->AddL(TDbCol(NColUid, EDbColUint32));
+
+    // add source type column
+    columns->AddL(TDbCol(NColSource, EDbColUint32));
+
+    // add landmark uid column
+    columns->AddL(TDbCol(NColLmUid, EDbColUint32));
+
+    // Create a table
+    User::LeaveIfError(aDatabase.CreateTable(KLookupTable, *columns));
+
+    // cleanup the column set
+    CleanupStack::PopAndDestroy(columns);
+}
+
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::CreateEntryL()
+// Creates an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::CreateEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// create a query for the view
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+
+    iItemsDatabase.Begin();
+
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    // Inert the item
+    myView.InsertL();
+
+    // set the fields
+    myView.SetColL(KColumnUid, aLookupItem.iUid);
+    myView.SetColL(KColumnSource, aLookupItem.iSource);
+    myView.SetColL(KColumnLmkUid, aLookupItem.iLmId);
+
+    myView.PutL();
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::UpdateEntryL()
+// Updates an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::UpdateEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// Create the query to find the row to be updated.
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+    queryBuffer.Append(KStringWhere);
+    queryBuffer.Append(NColUid);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iUid);
+    queryBuffer.Append(KStringAnd);
+    queryBuffer.Append(NColSource);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iSource);
+
+    iItemsDatabase.Begin();
+
+    // Create a view of the table based on the query created.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    if (myView.AtRow())
+    {
+        // found the entry. update it.
+        myView.UpdateL();
+        myView.SetColL(KColumnLmkUid, aLookupItem.iLmId);
+        myView.PutL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::DeleteEntryL()
+// Deletes an entry from the lookup table.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::DeleteEntryL(const TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+    queryBuffer.Append(KStringWhere);
+    queryBuffer.Append(NColUid);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iUid);
+    queryBuffer.Append(KStringAnd);
+    queryBuffer.Append(NColSource);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iSource);
+
+    iItemsDatabase.Begin();
+
+    RDbView myView;
+    // query buffer finds only the selected item row.
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+
+    myView.EvaluateAll();
+
+    // positions the cursor on the first row of the rowset
+    myView.FirstL();
+
+    // Delete the entry found.
+    if (myView.AtRow())
+    {
+        myView.GetL();
+        myView.DeleteL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+    iItemsDatabase.Commit();
+    // compacts the databse, by physicaly removing deleted data.
+    iItemsDatabase.Compact();
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::FindEntryL()
+// Finds an entry in the lookup table.
+// -----------------------------------------------------------------------------
+//
+TBool CLookupDatabase::FindEntryL(TLookupItem& aLookupItem)
+{
+    __TRACE_CALLSTACK;// used to store return value
+    TBool retVal = EFalse;
+
+    // Create a query to find the item.
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+    queryBuffer.Append(KStringWhere);
+    queryBuffer.Append(NColUid);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iUid);
+    queryBuffer.Append(KStringAnd);
+    queryBuffer.Append(NColSource);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLookupItem.iSource);
+
+    // Create a view of the table with the above query.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    if (myView.AtRow())
+    {
+        // Item found. get the details.
+        myView.GetL();
+
+        aLookupItem.iUid = myView.ColUint(KColumnUid);
+        aLookupItem.iSource = myView.ColUint(KColumnSource);
+        aLookupItem.iLmId = myView.ColUint(KColumnLmkUid);
+        retVal = ETrue;
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+
+    return retVal;
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::FindEntriesByLandmarkIdL()
+// Finds a list of lookup items given a landmark uid.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::FindEntriesByLandmarkIdL(const TUint32 aLandmarkId,
+        RArray<TLookupItem>& aLookupItemArray)
+{
+    __TRACE_CALLSTACK;// Create a query to find the item.
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+    queryBuffer.Append(KStringWhere);
+    queryBuffer.Append(NColLmUid);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aLandmarkId);
+
+    // Create a view of the table with the above query.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    while (myView.AtRow())
+    {
+        // Item found. get the details.
+        myView.GetL();
+        TLookupItem newItem;
+        newItem.iUid = myView.ColUint(KColumnUid);
+        newItem.iSource = myView.ColUint(KColumnSource);
+        newItem.iLmId = myView.ColUint(KColumnLmkUid);
+        aLookupItemArray.Append(newItem);
+        myView.NextL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+}
+
+// -----------------------------------------------------------------------------
+// CLookupDatabase::FindEntriesByLandmarkIdL()
+// Finds a list of lookup items given a landmark uid.
+// -----------------------------------------------------------------------------
+//
+void CLookupDatabase::FindEntriesBySourceTypeL(const TUint32 aSourceType,
+        RArray<TLookupItem>& aLookupItemArray)
+{
+    __TRACE_CALLSTACK;// Create a query to find the item.
+    TFileName queryBuffer;
+    queryBuffer.Copy(KSelectAllFrom);
+    queryBuffer.Append(KLookupTable);
+    queryBuffer.Append(KStringWhere);
+    queryBuffer.Append(NColSource);
+    queryBuffer.Append(KStringEqual);
+    queryBuffer.AppendNum(aSourceType);
+
+    // Create a view of the table with the above query.
+    RDbView myView;
+    myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
+    CleanupClosePushL(myView);
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    while (myView.AtRow())
+    {
+        // Item found. get the details.
+        myView.GetL();
+
+        TLookupItem newItem;
+        newItem.iUid = myView.ColUint(KColumnUid);
+        newItem.iSource = myView.ColUint(KColumnSource);
+        newItem.iLmId = myView.ColUint(KColumnLmkUid);
+        aLookupItemArray.Append(newItem);
+        myView.NextL();
+    }
+
+    CleanupStack::PopAndDestroy(&myView); // myView
+}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationdataharvester/rom/mylocations.iby	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+#ifndef __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
+
+//Resource file(s) for Mylocations application (mylocations.iby)
+data=DATAZ_\APP_RESOURCE_DIR\mylocations.rsc APP_RESOURCE_DIR\mylocations.rsc
+
+#endif
--- a/locationpickerservice/inc/locationpickerallview.h	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +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: LocationPickerAllView declaration
-*
-*/
-
-#ifndef LOCATIONPICKERALLVIEW_H
-#define LOCATIONPICKERALLVIEW_H
-
-#include <HbView>
-#include "locationpickerproxymodel.h"
-
-//forward declaration
-class HbListView;
-class HbAction;
-class QStandardItemModel;
-class LocationPickerAppWindow;
-class LocationPickerDataManager;
-
-/**  Class for handling a 'All' view of location picker
- *
- */
-class LocationPickerAllView : public HbView
-{
-    Q_OBJECT
-public:
-
-    // contructor
-    LocationPickerAllView( LocationPickerAppWindow *aWindow, QGraphicsItem* aParent = 0 );
-
-    // destructor
-    ~LocationPickerAllView();
-    
-    // locationsNotFound
-    bool locationsFound();
-
-private slots:
-    // slot triggered when sort by ascending is selected in menu
-    void sortAscending();
-    // slot triggered when sort by descending is selected in menu
-    void sortDescending();
-    
-    // slot to handle select event on a list item
-    void handleActivated( const QModelIndex &aIndex );
-
-private:
-    // used to construct a menu for the view
-    void constructMenu();
-
-private:
-    HbListView  *mListView;
-    LocationPickerProxyModel *mProxyModel;
-    QStandardItemModel *mModel;
-    LocationPickerAppWindow *mWindow;
-    LocationPickerDataManager *mDataManager;
-    bool mLocationsFound;
-    HbAction *mSecondaryBackAction;
-};
-
-
-#endif // LOCATIONPICKERALLVIEW_H
--- a/locationpickerservice/inc/locationpickerappwindow.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickerappwindow.h	Mon May 03 12:27:22 2010 +0300
@@ -18,48 +18,67 @@
 #ifndef LOCATIONPICKERAPPWINDOW_H
 #define LOCATIONPICKERAPPWINDOW_H
 #include <HbMainWindow>
-#include <HbAction>
 
-#include "qlocationpickeritem.h"
+#include "locationpickertypes.h"
 
 // Forward declarations
-class LocationPickerAllView;
 class LocationPickerSearchView;
-class LocationPickerCollectionListView;
+class LocationPickerDocumentLoader;
+class LocationPickerPotraitView;
 class LocationPickerService;
+class LocationPickerProxyModel;
+class LocationPickerLandscapeView;
 
 class LocationPickerAppWindow: public HbMainWindow
 {
     Q_OBJECT
 public:
-
     // constructor
-    LocationPickerAppWindow( QWidget* aParent = 0 );
+    LocationPickerAppWindow(QWidget *parent=0, Hb::WindowFlags 
+            windowFlags=Hb::WindowFlagNone);
     
     // destructor
     ~LocationPickerAppWindow();
-	
-	// deletes the collection content view
-    void deleteCollectionContentView();
-
-public slots:
-    // a list item is selected
-    void itemSelected( quint32 aLm);
-
-public slots:
-	// slot used for back action on the top right corner
-    void backButtonTriggered();
 
 private:
-    // all view
-    LocationPickerAllView* mLocationPickerAllView;
+    //Loads the Potrait View
+    void loadPotrait();
+    //Loads landscape View
+    void loadLandscape();
+    //Connect the slots for Potrait view
+    void connectPotraitSlots();
+    //Connect the slots for Landscape view
+    void connectLandscapeSlots();
+public slots:
+    // a list item is selected
+    void itemSelected( quint32 aLm );
+private slots:
+    //activate search view
+    void activateSearchView();
+    //activate locationpicker view
+    void activateLocationPickerView();
+    //changes the orientation
+    void changeOrientation(Qt::Orientation);
+    //complete the service
+    void serviceComplete();
+    //sets the category ID during orientation change in collection content
+    void setCategoryID( quint32 acategoryId );
+    //handles orientation change in collection list
+    void handleCollectionList();
+    //handle all List
+    void allListHandle();
+private:
     // search view
     LocationPickerSearchView* mLocationPickerSearchView;
-    // collection list view
-    LocationPickerCollectionListView* mLocationPickerCollectionListView;
-
-    // location picker service;
+    //document loader
+    LocationPickerDocumentLoader* mLocationPickerDocumentLoader;
+    //location picker potrait view
+    LocationPickerPotraitView* mLocationPickerPotraitView;
+    //location picker landscape view
+    LocationPickerLandscapeView* mLocationPickerLandscapeView;
+    //location picker service;
     LocationPickerService *mService;
-
+    //View Type
+    TViewType mviewType;
 };
 #endif // LOCATIONPICKERAPPWINDOW_H
--- a/locationpickerservice/inc/locationpickercollectioncontent.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickercollectioncontent.h	Mon May 03 12:27:22 2010 +0300
@@ -11,53 +11,37 @@
 *
 * Contributors:
 *
-* Description: LocationPickerCollectionListView declaration
+* Description: LocationPickerCollectionContent declaration
 *
 */
 
 #ifndef LOCATIONPICKERCOLLECTIONCONTENT_H
 #define LOCATIONPICKERCOLLECTIONCONTENT_H
 
-#include <HbView>
-
-class HbListView;
-class HbAction;
 class QStandardItemModel;
 class LocationPickerProxyModel;
 class LocationPickerDataManager;
-class LocationPickerAppWindow;
 
-/**  Class for handling a view collection content
- *
+/**  
+ * Class for handling collection content
  */
-class LocationPickerCollectionContent : public HbView
+class LocationPickerCollectionContent : public QObject
 {
-    Q_OBJECT
 public:
     // constructor
-    LocationPickerCollectionContent( LocationPickerAppWindow *aWindow,
-                                     quint32 aCollectionid, QGraphicsItem* aParent = 0);
+    LocationPickerCollectionContent( Qt::Orientations aOrientation , quint32 aCollectionid );
+    //Destructor
     ~LocationPickerCollectionContent();
-private slots:
-    // slot triggered when sort ascending is selected in menu
-    void sortAscending();
-    // slot triggered when sort descending is selected in menu
-    void sortDescending();
-
-    // slot used to handle when a location is selected in list view
-    void handleActivated(const QModelIndex &aIndex);
+    //get proxy model
+    LocationPickerProxyModel* getProxyModel();
+    //get LocationPickerDataManager
+    LocationPickerDataManager* getDataManager();
 
 private:
-    // constructs a menu for the view
-    void constructMenu();
-
-private:
-    HbListView  *mListView;
+    Qt::Orientations mOrientation;
     LocationPickerProxyModel *mProxyModel;
     QStandardItemModel *mModel;
     LocationPickerDataManager *mDataManager;
-    LocationPickerAppWindow* mWindow;
-    HbAction *mSecondaryBackAction;
 };
 
 #endif // LOCATIONPICKERCOLLECTIONCONTENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickercollectionlistcontent.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: LocationPickerCollectionListContent declaration
+*
+*/
+
+#ifndef LOCATIONPICKERCOLLECTIONLISTCONTENT_H
+#define LOCATIONPICKERCOLLECTIONLISTCONTENT_H
+
+class QStandardItemModel;
+class LocationPickerDataManager;
+
+/**  
+ * Class for handling Collections content of location picker
+ */
+class LocationPickerCollectionListContent : public QObject
+{
+public:
+
+    // constructor
+    LocationPickerCollectionListContent( Qt::Orientation aOrientation );
+
+    // destructor
+    ~LocationPickerCollectionListContent();
+    //get standard model
+    QStandardItemModel* getStandardModel();
+    //get LocationPickerDataManager
+    LocationPickerDataManager* getDataManager();
+
+private:
+    Qt::Orientation mOrientation;
+    QStandardItemModel *mModel;
+    LocationPickerDataManager *mDataManager;
+};
+
+#endif // LOCATIONPICKERCOLLECTIONLISTCONTENT_H
--- a/locationpickerservice/inc/locationpickercollectionlistview.h	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +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: LocationPickerCollectionListView declaration
-*
-*/
-
-#ifndef LOCATIONPICKERCOLLECTIONLISTVIEW_H
-#define LOCATIONPICKERCOLLECTIONLISTVIEW_H
-
-#include <HbView>
-
-class HbListView;
-class HbAction;
-class QStandardItemModel;
-class LocationPickerCollectionContent;
-class LocationPickerAppWindow;
-class LocationPickerDataManager;
-
-/**  Class for handling Collections view of location picker
- *
- */
-class LocationPickerCollectionListView : public HbView
-{
-    Q_OBJECT
-public:
-
-    // constructor
-    LocationPickerCollectionListView( LocationPickerAppWindow *aWindow, QGraphicsItem* aParent = 0);
-
-    // destructor
-    ~LocationPickerCollectionListView();
-	
-	// slot used to delete the child view, ie collection content view.
-    void deleteCollectionContentView();
-
-
-private slots:
-
-    // slot to handle event when a collection is selected
-    void handleActivated( const QModelIndex &aIndex );
-    	
-private:
-    HbListView  *mListView;
-    QStandardItemModel *mModel;
-    LocationPickerCollectionContent *mCollectionContentView;
-
-    LocationPickerAppWindow *mWindow;
-    LocationPickerDataManager *mDataManager;
-    HbAction *mSecondaryBackAction;
-};
-
-#endif // LOCATIONPICKERCOLLECTIONLISTVIEW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickercontent.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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: LocationPickerContent declaration
+*
+*/
+
+#ifndef LOCATIONPICKERCONTENT_H
+#define LOCATIONPICKERCONTENT_H
+
+
+#include "locationpickerproxymodel.h"
+
+//forward declaration
+class QStandardItemModel;
+class LocationPickerDataManager;
+
+/**  
+ *Class to create model for Location Picker
+ */
+class LocationPickerContent : public QObject
+{
+    Q_OBJECT
+public:
+
+    // contructor
+    LocationPickerContent(Qt::Orientation aOrientation );
+
+    // destructor
+    ~LocationPickerContent();
+    
+    // locationsNotFound
+    bool locationsFound();
+    
+    //get proxy model
+    LocationPickerProxyModel* getListProxyModel();
+    
+    //get standard Model
+    QStandardItemModel* getStandardModel();
+    
+    //get data manager
+    LocationPickerDataManager* getDataManager();
+    
+    //get hbgridview proxy model
+    LocationPickerProxyModel* getGridProxyModel();
+
+private:
+    Qt::Orientations mOrientation;
+    LocationPickerProxyModel *mListProxyModel;
+    LocationPickerProxyModel *mProxyGridModel;
+    LocationPickerDataManager *mDataManager;
+    QStandardItemModel *mModel;
+    bool mLocationsFound;
+    
+};
+
+
+#endif // LOCATIONPICKERCONTENT_H
--- a/locationpickerservice/inc/locationpickerdatamanager.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdatamanager.h	Mon May 03 12:27:22 2010 +0300
@@ -38,7 +38,7 @@
     ~LocationPickerDataManager();
 
     // populates the model with data
-    bool populateModel( quint32 aCollectionId = 0 );
+    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 );
--- a/locationpickerservice/inc/locationpickerdatamanager_p.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickerdatamanager_p.h	Mon May 03 12:27:22 2010 +0300
@@ -41,7 +41,7 @@
     ~LocationPickerDataManagerPrivate();
     
     // populates the model with data
-    bool populateModel( quint32 aCollectionId = 0 );
+    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 );
@@ -60,7 +60,7 @@
     void getLocationItemL( quint32 aLmId, QLocationPickerItem &aItem );
 
 private:
-	
+    Qt::Orientations mOrientation;
     QStandardItemModel *mModel;
     TViewType mViewType;
     CPosLmItemIterator* mIterator;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickerdocumentloader.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: LocationPickerDocumentLoader declaration
+*
+*/
+
+#ifndef LOCATIONPICKERDOCUMENTLOADER_H_
+#define LOCATIONPICKERDOCUMENTLOADER_H_
+
+#include <hbDocumentLoader>
+
+class LocationPickerDocumentLoader : public HbDocumentLoader
+{
+
+public:
+
+    /**
+     * Constructor.
+     */
+    LocationPickerDocumentLoader();
+
+    /**
+     * Destructor.   
+     */
+    ~LocationPickerDocumentLoader();
+
+public:
+
+    /**
+     * from base class
+     */
+    QObject *createObject(const QString& type, const QString &name);
+};
+
+#endif /* LOCATIONPICKERDOCUMENTLOADER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickerlandscapeview.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocationPickerLandscapeView declaration
+*
+*/
+
+#ifndef LOCATIONPICKERLANDSCAPEVIEW_H_
+#define LOCATIONPICKERLANDSCAPEVIEW_H_
+
+
+
+#include <hbview>
+#include <hbdocumentloader.h>
+#include "locationpickertypes.h"
+
+//forward declarations
+class HbListView;
+class QStandardItemModel;
+class LocationPickerProxyModel;
+class LocationPickerContent;
+class LocationPickerCollectionListContent;
+class LocationPickerCollectionContent;
+class HbGridViewItem;
+class HbGridView;
+class HbAction;
+
+/**  
+ * Class defines the location picker view
+ */
+class LocationPickerLandscapeView : public HbView
+{
+
+    Q_OBJECT
+public:
+    // constructor
+    LocationPickerLandscapeView(HbDocumentLoader* aLoader);
+    // destructor
+    ~LocationPickerLandscapeView();
+private:
+    //disable the tabs
+    void disableTabs();
+public:
+    //get the items from docml and connect to respective slots
+    void init(Qt::Orientation aOrientation );
+    //Set the appropriate model on grid view
+    void manageGridView();
+    //Create collection list and sets to list view
+    void setCollectionData( quint32 aCategoryId );
+    //Set Ctegory ID
+    void setCategoryID( quint32 aCategoryId  );
+    //Get the view type
+    TViewType getViewType();
+    //set the view type
+    void setViewType(TViewType aViewType);
+private slots:
+    //slot to handle list item actions     
+    void handleActivated(const QModelIndex &aIndex);
+    //slots to handle menu action items     
+    void sortDescending();
+    void sortAscending();
+    void backButtonTriggered();
+    //slot to handle search tab
+    void searchTabTriggered();
+public slots:
+    //slot to handle all tab
+    void allTabTriggered();
+    //slot to handle collection tab
+    void colectionTabTriggered();
+signals:
+    void switchToSearchView();
+    void handleCollectionList();
+    void selectItem( quint32 aLm );
+    void completeService();
+    void sendCategoryID(  quint32 acategoryId  );
+private:
+    //document loader
+    HbDocumentLoader* mDocumentLoader;
+    // all view
+    LocationPickerContent* mLocationPickerContent;
+    // collection list content
+    LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
+    //actions
+    HbAction *mAllAction;
+    HbAction *mCollectionAction;
+    HbAction *mSearchAction;
+    HbAction *mAscendingAction;
+    HbAction *mDescendingAction;
+    //secondary back action
+    HbAction *mLandscapeBackAction;
+    HbGridView *mGridView;
+    //collection content 
+    LocationPickerCollectionContent *mCollectionContent;
+    HbGridViewItem *mGridViewItem;
+    //view type
+    TViewType mViewType ;
+    //get the collection/category id
+    quint32 mCategoryId;
+
+};
+
+#endif /* LOCATIONPICKERLANDSCAPEVIEW_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/inc/locationpickerpotraitview.h	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocationPickerPotraitView declaration
+*
+*/
+
+#ifndef LOCATIONPICKERPOTRAITVIEW_H
+#define LOCATIONPICKERPOTRAITVIEW_H
+
+
+#include <hbview>
+#include <hbdocumentloader.h>
+#include "locationpickertypes.h"
+
+//forward declarations
+class HbListView;
+class QStandardItemModel;
+class LocationPickerProxyModel;
+class LocationPickerContent;
+class LocationPickerCollectionListContent;
+class LocationPickerCollectionContent;
+class HbListViewItem;
+class HbAction;
+
+/**  
+ * Class defines the location picker view
+ */
+class LocationPickerPotraitView : public HbView
+{
+    Q_OBJECT
+public:
+    // constructor
+    LocationPickerPotraitView(HbDocumentLoader* aLoader);
+    // destructor
+    ~LocationPickerPotraitView();
+private:
+    //disable the tabs
+    void disableTabs();
+public:
+    //get the items from docml and connect to respective slots
+    void init(Qt::Orientation aOrientation );
+    //Set the appropriate model on list view
+    void manageListView();
+    //Create collection list and sets to list view
+    void setCollectionData( quint32 acategoryId );
+    //Set Ctegory ID
+    void setCategoryID( quint32 acategoryId  );
+    //Get the view type
+    TViewType getViewType();
+    //set the view type
+    void setViewType(TViewType aViewType);
+private slots:
+    //slot to handle list item actions     
+    void handleActivated(const QModelIndex &aIndex);
+    //slots to handle menu action items     
+    void sortDescending();
+    void sortAscending();
+    void backTriggered();
+    //slot to handle search tab
+    void searchTabTriggered();
+public slots:
+    //slot to handle all tab
+    void allTabTriggered();
+    //slot to handle collection tab
+    void colectionTabTriggered();
+signals:
+    void switchToSearchView();
+    void selectItem( quint32 aLm );
+    void completeService();
+    void sendCategoryID( quint32 aCategoryId );
+    void handleAllList();
+private:
+    //document loader
+    HbDocumentLoader* mDocumentLoader;
+    // all view
+    LocationPickerContent* mLocationPickerContent;
+    // collection list content
+    LocationPickerCollectionListContent* mLocationPickerCollectionListContent;
+    //actions
+    HbAction *mAllAction;
+    HbAction *mCollectionAction;
+    HbAction *mSearchAction;
+    HbAction *mAscendingAction;
+    HbAction *mDescendingAction;
+    //secondary back action
+    HbAction *mPotraitBackAction;
+    // list view
+    HbListView  *mListView;
+    //list item
+    HbListViewItem *mListItem;
+    //collection content 
+    LocationPickerCollectionContent *mCollectionContent;
+    //ViewType
+    TViewType mViewType ;
+    // get the collection/category id
+    quint32 mCategoryId;
+};
+
+
+#endif // LOCATIONPICKERPOTRAITVIEW_H
--- a/locationpickerservice/inc/locationpickerproxymodel.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickerproxymodel.h	Mon May 03 12:27:22 2010 +0300
@@ -31,7 +31,7 @@
 
 public:
     // constructor
-    LocationPickerProxyModel(QObject *parent = 0);
+    LocationPickerProxyModel(Qt::Orientations aOrientation , QObject *parent = 0);
 
     // used to
     void filterParameterChanged(QString aSearchText);
@@ -45,6 +45,7 @@
 private:
     // search string
     QString mSearchText;
+    Qt::Orientations mOrientation;
 };
  
  
--- a/locationpickerservice/inc/locationpickersearchview.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickersearchview.h	Mon May 03 12:27:22 2010 +0300
@@ -21,51 +21,57 @@
 
 #include <HbView>
 
-//forward declarations
 class HbListView;
-class HbAction;
-class QGraphicsLinearLayout;
 class QStandardItemModel;
 class HbSearchPanel;
-class LocationPickerAppWindow;
 class LocationPickerDataManager;
 class LocationPickerProxyModel;
+class HbDocumentLoader;
+class HbTextItem;
+class QGraphicsLinearLayout;
 
-/**  Class defines the search view of location picker
- *
+/**  
+ * Class defines the search view of location picker
  */
 class LocationPickerSearchView : public HbView
 {
     Q_OBJECT
 public:
     // constructor
-    LocationPickerSearchView( LocationPickerAppWindow *aWindow, QGraphicsItem* aParent = 0 );
+    LocationPickerSearchView(HbDocumentLoader &aLoader);
     // destructor
     ~LocationPickerSearchView();
-
+    //initialize the action items and connect to slots
+    void init();
 private slots:
     // slot to perform search
     void doSearch(QString aCriteria);
     // slot to handle select event on a list item
     void handleActivated(const QModelIndex &aIndex);
-
+    // slot to handle backbutton on search panel
+    void handleExit();
+signals:
+    //signals to switch current view
+    void switchView();
+    //signals when any item is selected
+    void selectItem( quint32 aLm );
 private:
-
     //proxymodel used for sort and filter
     LocationPickerProxyModel *mProxyModel;
     // model for the view
     QStandardItemModel *mModel;
-    // graphics linear layout for list items and search panel
-    QGraphicsLinearLayout* mLayout;
     // list view
     HbListView  *mListView;
     // search panel
     HbSearchPanel *mSearchPanel;
-    // handle to main window
-    LocationPickerAppWindow *mWindow;
     // handle to data manager to populate model
     LocationPickerDataManager *mDataManager;
-    HbAction *mSecondaryBackAction;
+    //TextItem
+    HbTextItem* mEmptyLabel;
+    //Graphicslayout
+    QGraphicsLinearLayout* mVerticalLayout;
+    //Documentloader
+    HbDocumentLoader &mDocumentLoader;
 };
 
 
--- a/locationpickerservice/inc/locationpickertoolbar.h	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +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: LocationPickerToolBar declaration
-*
-*/
-
-#ifndef LOCATIONPICKERTOOLBAR_H
-#define LOCATIONPICKERTOOLBAR_H
-
-#include <HbToolBar>
-
-// forward declarations
-class HbAction;
-class LocationPickerAppWindow;
-
-/**  Class used to create toolbar for location picker
- *
- */
-class LocationPickerToolBar : public HbToolBar
-{
-    Q_OBJECT
-public:
-
-    /** Constructor
-      */
-    LocationPickerToolBar( LocationPickerAppWindow *aWindow, QGraphicsItem *aParent = 0 );
-    
-    /** disable tabs if no locations
-     */
-    void disableTabs();
-
-private slots:
-
-    /** Slot triggered when All tab is selected
-      */
-    void AllTabTriggered();
-
-    /** Slot triggered when Collection tab is selected
-      */
-    void CollectionTabTriggered();
-
-    /** Slot triggered when Search tab is selected
-      */
-    void SearchTabTriggered();
-
-private:
-    // Actions defined for the tabs
-    HbAction *mAllAction;
-    HbAction *mCollectionAction;
-    HbAction *mSearchAction;
-
-    // pointer to the main window
-    LocationPickerAppWindow* mWindow;
-};
-
-
-#endif // LOCATIONPICKERTOOLBAR_H
--- a/locationpickerservice/inc/locationpickertypes.h	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/inc/locationpickertypes.h	Mon May 03 12:27:22 2010 +0300
@@ -18,8 +18,7 @@
 #ifndef LOCATIONPICKERTYPES_H
 #define LOCATIONPICKERTYPES_H
 
-// Defines total number of main views ( all, collectionlist, search )
-const int KNumberOfMainViews = 3;
+#include <hbglobal.h>
 
 // separator
 const QString KSeparator(",");
@@ -27,64 +26,44 @@
 // space
 const QString KSpace(" ");
 
-// Application Title
-const QString KApplicationTitle("Select Location");
-
-// Application Title
-const QString KNoLocations("No Location entries present");
-
-// space
-const QString KContactCollection("Contact addresses");
-
-// strings used to differentiate the contact address type
-const QString KContactPrefered("Contact Prefered");
-const QString KContactHome("Contact Home");
-const QString KContactWork("Contact Work");
-const QString KContactsString("Others");
-const QString KContactsCollection("Contact addresses");
-const QString KSortBy("Sort by");
-const QString KAscend("Ascending");
-const QString KDescend("Descending");
-
 //Icon Paths
 
 // dummy image for a location
-const QString KDummyImage(":/qtg_large_maps.png");
-
-//All tab icon
-const QString KAllTab(":/qtg_mono_location.png.png");
+const QString KDummyImage("qtg_large_maps");
 
-//COllection tab icon
-const QString KCollectionTab(":/qtg_mono_location_collection.png");
-
-//Search tab icon
-const QString KSearchTab(":/qtg_mono_search.png");
+//Contacts collection icon
+const QString KCollectionsContacts("qtg_small_contacts");
 
 //Contacts collection icon
-const QString KCollectionsContacts(":/qtg_small_contacts.png");
-
-//Contacts collection icon
-const QString KCollectionsCalendar(":/qtg_small_calendar.png");
+const QString KCollectionsCalendar("qtg_small_calendar");
 
 //Contacts type prefered icon
-const QString KContactPrefIcon(":/qtg_mono_favourites.png");
+const QString KContactPrefIcon("qtg_mono_favourites");
 //Contacts type home icon
-const QString KContactHomeIcon(":/qtg_mono_home.png");
+const QString KContactHomeIcon("qtg_mono_home");
 //Contacts type work icon
-const QString KContactWorkIcon(":/qtg_mono_work.png");
+const QString KContactWorkIcon("qtg_mono_work");
+
 
-/** Defines view type in location picker
+// 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
 */
 enum TViewType
 {
-    /** All View */
-    ELocationPickerAllView,
-    /** Collection list view */
-    ELocationPickerCollectionListView,
+    /** LocationPicker Content */
+    ELocationPickerContent,
+    /** Collection list Content*/
+    ELocationPickerCollectionListContent,
     /** Search View */
     ELocationPickerSearchView,
-    /** Collection content view */
-    ELocationPickerCollectionContentView
+    /** Collection content */
+    ELocationPickerCollectionContent
 };
 
 
--- a/locationpickerservice/locationpickerservice.pro	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/locationpickerservice.pro	Mon May 03 12:27:22 2010 +0300
@@ -43,40 +43,44 @@
 # ##### qthighway
 CONFIG += service
 LIBS += -lxqservice \
-    -lxqserviceutil \
-    -lflogger
+    -lxqserviceutil 
 SERVICE.FILE = service_conf.xml
 SERVICE.OPTIONS = embeddable
 SERVICE.OPTIONS += hidden
 
 # #### /qthighway
 
-RESOURCES += .\resources\locationpicker.qrc 
+RESOURCES += ./resources/locationpicker.qrc 
 
+TRANSLATIONS += lilpicker.ts
 
 SOURCES += src/main.cpp \
-    src/locationpickerallview.cpp \
+    src/locationpickercontent.cpp \
     src/locationpickerappwindow.cpp \
-    src/locationpickertoolbar.cpp \
     src/locationpickersearchview.cpp \
     src/locationpickerproxymodel.cpp \
-    src/locationpickercollectionlistview.cpp \
+    src/locationpickercollectionlistcontent.cpp \
     src/locationpickercollectioncontent.cpp \
     src/locationpickerservice.cpp \
     src/locationpickerdatamanager.cpp \
-    src/locationpickerdatamanager_p.cpp 
+    src/locationpickerdatamanager_p.cpp \
+    src/locationpickerpotraitview.cpp \
+    src/locationpickerlandscapeview.cpp \
+    src/locationpickerdocumentloader.cpp
     
     
 
-HEADERS += inc/locationpickerallview.h \
+HEADERS += inc/locationpickercontent.h \
     inc/locationpickerappwindow.h \
-    inc/locationpickertoolbar.h \
     inc/locationpickersearchview.h \
     inc/locationpickerproxymodel.h \
-    inc/locationpickercollectionlistview.h \
+    inc/locationpickercollectionlistcontent.h \
     inc/locationpickercollectioncontent.h \
     inc/locationpickertypes.h \
     inc/locationpickerservice.h \
     inc/locationpickerdatamanager.h \
-    inc/locationpickerdatamanager_p.h
+    inc/locationpickerdatamanager_p.h \
+    inc/locationpickerpotraitview.h \
+    inc/locationpickerlandscapeview.h \
+    inc/locationpickerdocumentloader.h
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/locationgrid.css	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,31 @@
+HbGridViewItem#locationgrid
+{
+    layout:layout-1;
+}
+HbGridViewItem#locationgrid::icon{
+	fixed-width: 24.375un;
+	fixed-height: 32.5un;
+}
+
+HbGridViewItem#locationgrid::text{
+    text-height: var(hb-param-text-height-tiny);
+    font-variant: primary;
+    text-align: center center;
+    color: qtc_grid;
+	text-line-count-min: 1;
+	text-line-count-max: 2;
+}
+
+HbGridViewItem#locationgrid::selection-icon{
+    fixed-width: 3.0un;
+    fixed-height: 3.0un;
+}
+
+HbGridViewItem#locationgrid::multiselection-toucharea{
+    fixed-width: 9.0un;
+    fixed-height: 9.0un;
+}
+
+HbGridViewItem#locationgrid::frame{
+	border-width: var(hb-param-background-grid-main);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/resources/locationgrid.hbgridviewitem.widgetml	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,30 @@
+<hbwidget version="0.1" type="HbGridViewItem">
+  <layout name="layout-1" type="mesh">
+
+    <meshitem src="text" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-center-align)" />
+    <meshitem src="text" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-center-align)" />
+    <meshitem src="text" srcEdge="TOP" dst="" dstEdge="TOP" spacing= "1.5 un" />
+
+    <meshitem src="icon" srcEdge="LEFT" dst="" dstEdge="LEFT" spacing="-var(hb-param-margin-gene-center-align)" />
+    <meshitem src="icon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" spacing="var(hb-param-margin-gene-center-align)" />
+    <meshitem src="icon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" spacing="1.5 un" />
+    <meshitem src="icon" srcEdge="TOP" dst="text" dstEdge="BOTTOM" spacing="-1.5 un" />
+
+      
+    <meshitem src="selection-icon" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="selection-icon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+    <meshitem src="frame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="frame" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="frame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="frame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+    <meshitem src="background" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="background" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="background" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="background" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+    <meshitem src="multiselection-toucharea" srcEdge="TOP" dst="selection-icon" dstEdge="TOP" />
+    <meshitem src="multiselection-toucharea" srcEdge="RIGHT" dst="selection-icon" dstEdge="RIGHT" />
+  </layout>
+</hbwidget>
--- a/locationpickerservice/resources/locationpicker.qrc	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/resources/locationpicker.qrc	Mon May 03 12:27:22 2010 +0300
@@ -1,13 +1,9 @@
 <RCC>
     <qresource>
-        <file>qtg_large_maps.png</file>
-        <file>qtg_mono_favourites.png</file>
-        <file>qtg_mono_home.png</file>
-        <file>qtg_mono_location.png</file>
-        <file>qtg_mono_location_collection.png</file>
-        <file>qtg_mono_search.png</file>
-        <file>qtg_mono_work.png</file>
-        <file>qtg_small_calendar.png</file>
-        <file>qtg_small_contacts.png</file>
+        <file>locationpickerpotrait.docml</file>
+        <file>locationpickerlandscape.docml</file>
+        <file>locationpickersearchview.docml</file>
+        <file>locationgrid.css</file>
+        <file>locationgrid.hbgridviewitem.widgetml</file>
     </qresource>
 </RCC>
Binary file locationpickerservice/resources/qtg_large_maps.png has changed
Binary file locationpickerservice/resources/qtg_mono_favourites.png has changed
Binary file locationpickerservice/resources/qtg_mono_home.png has changed
Binary file locationpickerservice/resources/qtg_mono_location.png has changed
Binary file locationpickerservice/resources/qtg_mono_location_collection.png has changed
Binary file locationpickerservice/resources/qtg_mono_search.png has changed
Binary file locationpickerservice/resources/qtg_mono_work.png has changed
Binary file locationpickerservice/resources/qtg_small_calendar.png has changed
Binary file locationpickerservice/resources/qtg_small_contacts.png has changed
--- a/locationpickerservice/rom/locationpickerservice.iby	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/rom/locationpickerservice.iby	Mon May 03 12:27:22 2010 +0300
@@ -14,7 +14,6 @@
 * Description:  The locationpickerservice iby file.
 *
 */
-
 #ifndef __LOCATION_PICKER_SERVICE_IBY__
 #define __LOCATION_PICKER_SERVICE_IBY__
 
--- a/locationpickerservice/src/locationpickerallview.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,162 +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: LocationPickerAllView implementation
-*
-*/
-
-#include <HbMenu>
-#include <HbListViewItem>
-#include <HbAction>
-#include <HbListView>
-#include <QStandardItemModel>
-
-#include "locationpickerallview.h"
-#include "locationpickerproxymodel.h"
-#include "locationpickertypes.h"
-#include "locationpickerappwindow.h"
-#include "locationpickerdatamanager.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::LocationPickerAllView()
-// -----------------------------------------------------------------------------
-LocationPickerAllView::LocationPickerAllView( LocationPickerAppWindow *aWindow, QGraphicsItem* aParent )
-        : HbView( aParent )
-{
-    mWindow = aWindow;
-    
-    // Create a standard model for the view list
-    mModel = new QStandardItemModel( this );
-
-    // create the list view and connect the signal
-    mListView=new HbListView( this );
-
-    // create data manager to manage data in the model
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerAllView );
-    if( mDataManager->populateModel() )
-    {
-        // connect the signal of the list activated to a slot.
-        connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-
-        //Creation of List View
-        //Set grahics size for the list items.
-        HbListViewItem *hbListItem = new HbListViewItem();
-        hbListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-
-        // Create the proxy model and set source model
-        mProxyModel = new LocationPickerProxyModel( this );
-        mProxyModel->setSourceModel(mModel);
-
-        // set proxymodel with list view
-        mListView->setModel(mProxyModel, hbListItem);
-
-        // set sort properties
-        mProxyModel->setDynamicSortFilter(TRUE);
-        mProxyModel->setSortRole(Qt::DisplayRole);
-        mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
-
-        // sort in ascending order
-        mProxyModel->sort(0, Qt::AscendingOrder);
-
-        // construct menu for the view
-        constructMenu();
-        
-        mLocationsFound = true;
-    }
-
-    else
-    {
-        // no locations to display.
-        QStandardItem *modelItem = new QStandardItem();
-        modelItem->setData(QVariant(KNoLocations), Qt::DisplayRole);
-        mModel->appendRow( modelItem );
-        mListView->setModel(mModel);
-        mLocationsFound = false;
-    }
-
-    // set the listview as the view's widget
-    setWidget(mListView);
-    
-    // create back action
-    mSecondaryBackAction = new HbAction( Hb::BackAction, this );
-    // add back key action
-    setNavigationAction( mSecondaryBackAction );
-    connect(mSecondaryBackAction, SIGNAL(triggered()), mWindow,
-                                SLOT(backButtonTriggered()));
-
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::LocationPickerAllView()
-// -----------------------------------------------------------------------------
-LocationPickerAllView::~LocationPickerAllView()
-{
-    // delete data manager
-    if( mDataManager )
-        delete mDataManager;
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::locationsFound()
-// -----------------------------------------------------------------------------
-bool LocationPickerAllView::locationsFound()
-{
-    return mLocationsFound;
-}
-
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::constructMenu()
-// -----------------------------------------------------------------------------
-void LocationPickerAllView::constructMenu()
-{
-    HbMenu *menu = this->menu();
-    HbMenu *subMenu = menu->addMenu(KSortBy);
-    HbAction *act;
-
-    act = new HbAction(KAscend, this );
-    subMenu->addAction(act);
-    connect(act,SIGNAL(triggered()),this,SLOT(sortAscending()));
-
-    act = subMenu->addAction( KDescend );
-    connect(act, SIGNAL(triggered()), SLOT(sortDescending()));
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::sortAscending()
-// -----------------------------------------------------------------------------
-void LocationPickerAllView::sortAscending()
-{
-    mProxyModel->sort(0, Qt::AscendingOrder);
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::sortDescending()
-// -----------------------------------------------------------------------------
-void LocationPickerAllView::sortDescending()
-{
-    mProxyModel->sort(0, Qt::DescendingOrder);
-}
-
-// -----------------------------------------------------------------------------
-// LocationPickerAllView::handleActivated()
-// -----------------------------------------------------------------------------
-void LocationPickerAllView::handleActivated( const QModelIndex &aIndex)
-{
-    QModelIndex index = mProxyModel->mapToSource(aIndex);
-    quint32 lm = 0;
-    mDataManager->getData( index.row(), lm );
-    mWindow->itemSelected( lm );
-}
--- a/locationpickerservice/src/locationpickerappwindow.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickerappwindow.cpp	Mon May 03 12:27:22 2010 +0300
@@ -16,87 +16,75 @@
 */
 
 #include "locationpickerappwindow.h"
-#include "locationpickertoolbar.h"
-#include "locationpickerallview.h"
+
+#include "qlocationpickeritem.h"
+
 #include "locationpickersearchview.h"
-#include "locationpickercollectionlistview.h"
+#include "locationpickerpotraitview.h"
 #include "locationpickerservice.h"
-#include "locationpickertypes.h"
-#include "locationpickertypes.h"
 #include "locationpickerdatamanager.h"
- 
+#include "locationpickerdocumentloader.h"
+#include "locationpickerlandscapeview.h"
+
 // ----------------------------------------------------------------------------
 // LocationPickerAppWindow::LocationPickerAppWindow()
 // ----------------------------------------------------------------------------
-LocationPickerAppWindow::LocationPickerAppWindow(
-        QWidget* aParent ):
-        HbMainWindow( aParent )
+LocationPickerAppWindow::LocationPickerAppWindow(QWidget *parent, Hb::WindowFlags windowFlags)
+	:HbMainWindow(parent, windowFlags),
+	mLocationPickerSearchView(NULL),
+    mLocationPickerDocumentLoader(NULL),
+	mLocationPickerPotraitView(NULL),
+	mLocationPickerLandscapeView(NULL),
+    mService(NULL),
+	mviewType(ELocationPickerContent)
 {
     // create the service object;
-    mService = new LocationPickerService( this );
-  
-    LocationPickerToolBar *toolBar = new LocationPickerToolBar( this );
+    mService = new LocationPickerService(this);
+    //create document loader object
+    mLocationPickerDocumentLoader = new LocationPickerDocumentLoader();
+   
+    bool ok = false;
+    //load the Locationpicker portrait view
+    mLocationPickerDocumentLoader->load(":/locationpickerpotrait.docml", &ok);
+    Q_ASSERT_X(ok, "locationpickerservice", "invalid DocML file");
+    //find graphics location picker potrait view
+    QGraphicsWidget *locationPickerWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerPotraitView");
+    Q_ASSERT_X((locationPickerWidget != 0), "locationpickerservice", "invalid DocML file");
+    mLocationPickerPotraitView = qobject_cast<LocationPickerPotraitView*>(locationPickerWidget);
+    //initialize potrait widgets and connect to respective signals 
+    mLocationPickerPotraitView->init(Qt::Vertical);
+    connectPotraitSlots();
+    addView( mLocationPickerPotraitView );
 
-    // Create 'all' view, set the tool bar and add the view to main window
-    mLocationPickerAllView = new LocationPickerAllView( this ); 
-    if( !mLocationPickerAllView->locationsFound() )
-    {
-        toolBar->disableTabs();
-    }
-    mLocationPickerAllView->setToolBar(toolBar);
-    addView(mLocationPickerAllView);
-    setCurrentView(mLocationPickerAllView);
+    mLocationPickerDocumentLoader->reset();
 
-    // Create 'search' view, set the tool bar and add the view to main window
-    mLocationPickerSearchView = new LocationPickerSearchView( this );
-    mLocationPickerSearchView->setToolBar(toolBar);
-    addView(mLocationPickerSearchView);
-
-    // Create 'collection' view, set the tool bar and add the view to main window
-    mLocationPickerCollectionListView = new LocationPickerCollectionListView( this );
-    mLocationPickerCollectionListView->setToolBar(toolBar);
-    addView(mLocationPickerCollectionListView);
-    
+    //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());
 }
 
-
 // ----------------------------------------------------------------------------
 // LocationPickerAppWindow::~LocationPickerAppWindow()
 // ----------------------------------------------------------------------------
 LocationPickerAppWindow::~LocationPickerAppWindow()
 {
     delete mService;
-}
-
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::backButtonTriggered()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::backButtonTriggered()
-{
-    if( currentViewIndex() > KNumberOfMainViews-1 )
-    {
-        //the current view is collection content view.
-        //so come back to collection list view
-        setCurrentView(mLocationPickerCollectionListView);
-        deleteCollectionContentView();
-    }
-    else
-    {
-		// Other views request complete with a invalid location picker item
-		QLocationPickerItem item;
-		item.mIsValid = false;
-        mService->complete(item);
-    }
-}
-
-// ----------------------------------------------------------------------------
-// LocationPickerAppWindow::deleteCollectionContentView()
-// ----------------------------------------------------------------------------
-void LocationPickerAppWindow::deleteCollectionContentView()
-{
-	// call collection view's deleteCollectionContentView()
-    mLocationPickerCollectionListView->deleteCollectionContentView();
+    delete mLocationPickerSearchView;
+    delete mLocationPickerDocumentLoader;
+    delete mLocationPickerPotraitView;
+    delete mLocationPickerLandscapeView;
 }
 
 // ----------------------------------------------------------------------------
@@ -105,14 +93,186 @@
 void LocationPickerAppWindow::itemSelected( quint32 aLmid )
 {
     QLocationPickerItem item;
-    
     LocationPickerDataManager dataManager;
-    dataManager.getLocationItem( aLmid, item );
-
+    dataManager.getLocationItem(aLmid, item);
     // complete the request
     mService->complete(item);
-   
+}
+
+void LocationPickerAppWindow::serviceComplete()
+{
+    // Other views request complete with a valid location picker item
+    QLocationPickerItem item;
+    item.mIsValid = false;
+    mService->complete(item);
+}
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::activateSearchView()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::activateSearchView()
+{   
+    //load the LocationPickerSearchView
+    bool ok = false;
+    if(!mLocationPickerSearchView)
+    {
+        mLocationPickerDocumentLoader->load(":/locationpickersearchview.docml", &ok);
+        Q_ASSERT_X(ok, "locationpickerService", "invalid DocML file");
+        //find the LocationPickerSearchView
+        QGraphicsWidget *locationPickerSearchWidget = mLocationPickerDocumentLoader->findWidget("LocationPickerSearchView");
+        Q_ASSERT_X((locationPickerSearchWidget != 0), "locationpickerService", "invalid DocML file");
+        mLocationPickerSearchView = qobject_cast<LocationPickerSearchView*>(locationPickerSearchWidget);
+        Q_ASSERT_X((mLocationPickerSearchView != 0), "mLocationPickerSearchView", 
+            "qobject cast failure");
+        //initialize the action items and connect to slots
+        mLocationPickerSearchView->init();
+        connect(mLocationPickerSearchView,SIGNAL(switchView()),this,SLOT(activateLocationPickerView()));
+        connect(mLocationPickerSearchView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
+        addView(mLocationPickerSearchView);
+    }
+    //set LocationPickerSearchview as current view
+    setCurrentView(mLocationPickerSearchView);
+    mviewType = ELocationPickerSearchView;
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::activateLocationPickerView()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::activateLocationPickerView()
+{ 
+    mviewType = ELocationPickerContent;
+    //check the orientation and load view accordingly 
+    if(this->orientation() == Qt::Horizontal)
+    {
+        mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
+        mLocationPickerLandscapeView->manageGridView();
+        setCurrentView(mLocationPickerLandscapeView);
+    }
+    else
+    { 
+        mLocationPickerPotraitView->setViewType( ELocationPickerContent );
+        mLocationPickerPotraitView->manageListView();
+        setCurrentView( mLocationPickerPotraitView );
+    }
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::changeOrientation()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::changeOrientation(Qt::Orientation)
+{   
+    //check the orientation and load view accordingly 
+    if( orientation() == (Qt::Horizontal ))
+    {
+        loadLandscape();
+    }
+    else
+    {
+        loadPotrait();
+    }
 }
 
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::loadPotrait()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::loadPotrait()
+{   
+	//load potrait view except for search view
+    if(mviewType != ELocationPickerSearchView)
+	  {
+        if(mLocationPickerLandscapeView->getViewType() == ELocationPickerContent)
+        {
+        mLocationPickerPotraitView->setViewType(ELocationPickerContent);
+        }
+    	mLocationPickerPotraitView->manageListView();
+    	setCurrentView( mLocationPickerPotraitView );
+    }
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::loadLandscape()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::loadLandscape()
+{   
+    if(mviewType != ELocationPickerSearchView)
+	 {
+         //load landscape view in current potrait content
+         mLocationPickerLandscapeView->setViewType( mLocationPickerPotraitView->getViewType() );
+         //load landscape for all content except collectionlistcontent
+    	 if(mLocationPickerPotraitView->getViewType() != ELocationPickerCollectionListContent)
+    	 {
+             mLocationPickerLandscapeView->manageGridView();
+    		 setCurrentView(mLocationPickerLandscapeView);
+		 }
+	 }
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::loadLandscape()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::connectPotraitSlots()
+{
+     connect(mLocationPickerPotraitView,SIGNAL(switchToSearchView()),this,SLOT(activateSearchView()));
+     connect(mLocationPickerPotraitView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
+     connect(mLocationPickerPotraitView,SIGNAL(completeService()),this,SLOT(serviceComplete()));
+     connect(mLocationPickerPotraitView,SIGNAL(sendCategoryID( quint32 )),this,SLOT(setCategoryID( quint32 )));
+     connect(mLocationPickerPotraitView,SIGNAL(handleAllList()),this,SLOT(allListHandle()));
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::loadLandscape()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::connectLandscapeSlots()
+{   
+    connect(mLocationPickerLandscapeView,SIGNAL(switchToSearchView()),this,SLOT(activateSearchView()));
+    connect(mLocationPickerLandscapeView,SIGNAL(selectItem( quint32 )),this,SLOT(itemSelected( quint32 )));
+    connect(mLocationPickerLandscapeView,SIGNAL(completeService()),this,SLOT(serviceComplete()));
+    connect(mLocationPickerLandscapeView,SIGNAL(sendCategoryID( quint32 )),this,SLOT(setCategoryID( quint32 )));
+    connect(mLocationPickerLandscapeView,SIGNAL(handleCollectionList()),this,SLOT(handleCollectionList()));
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::setCategoryID()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::setCategoryID( quint32 acategoryId )
+{
+    //set the same category id to both views
+    mLocationPickerPotraitView->setCategoryID(acategoryId);
+    mLocationPickerLandscapeView->setCategoryID(acategoryId);
+    //Load the collectioncontent in appropriate orientation
+    if(orientation() == Qt::Vertical)
+    {
+        mviewType = ELocationPickerCollectionContent;
+        mLocationPickerPotraitView->manageListView();
+        setCurrentView( mLocationPickerPotraitView );
+    }
+    else
+    {   
+        mviewType = ELocationPickerCollectionContent;
+        loadLandscape();        
+    }
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::handleCollectionList()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::handleCollectionList()
+{  
+    //In collection List both view should look same(list)
+    mLocationPickerPotraitView->setViewType( ELocationPickerCollectionListContent );
+    mviewType = ELocationPickerCollectionListContent;
+    mLocationPickerPotraitView->manageListView();
+    setCurrentView( mLocationPickerPotraitView );
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerAppWindow::allListHandle()
+// ----------------------------------------------------------------------------
+void LocationPickerAppWindow::allListHandle()
+{
+    //all list after collection list in horizontal orientation
+    mLocationPickerLandscapeView->setViewType( ELocationPickerContent );
+    mLocationPickerLandscapeView->manageGridView();
+    setCurrentView(mLocationPickerLandscapeView);
+}
 
 Q_IMPLEMENT_USER_METATYPE(QLocationPickerItem)
--- a/locationpickerservice/src/locationpickercollectioncontent.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickercollectioncontent.cpp	Mon May 03 12:27:22 2010 +0300
@@ -15,81 +15,45 @@
 *
 */
 
-#include <HbListView>
 #include <QStandardItemModel>
-#include <HbMenu>
-#include <HbListViewItem>
-#include <HbAction>
 
 #include "locationpickerproxymodel.h"
 #include "locationpickercollectioncontent.h"
 #include "locationpickerdatamanager.h"
 #include "locationpickertypes.h"
-#include "locationpickerappwindow.h"
 
 // ======== MEMBER FUNCTIONS ========
 
 // ----------------------------------------------------------------
 // LocationPickerCollectionContent::LocationPickerCollectionContent()
 // -----------------------------------------------------------------
-LocationPickerCollectionContent::LocationPickerCollectionContent(
-        LocationPickerAppWindow *aWindow, quint32 aCollectionId, QGraphicsItem* aParent):
-        HbView( aParent )
-
+LocationPickerCollectionContent::LocationPickerCollectionContent( Qt::Orientations aOrientation , quint32 aCollectionId )
+    :mOrientation(aOrientation),
+	 mProxyModel(NULL),
+    mModel(NULL),
+    mDataManager(NULL)
 {
-    // inditialize window
-    mWindow = aWindow;
     // Create a standard model for the view list
     mModel = new QStandardItemModel( this );
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionContentView );
-    mListView = new HbListView( this );
-
-
-    if( mDataManager->populateModel( aCollectionId ) )
+    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionContent );
+    if( mDataManager->populateModel( mOrientation , aCollectionId ) )
     {
-        // connect the activated signal of list view item
-        connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-        //Creation of List View
-        //Set graphics size for the list items.
-        HbListViewItem *hbListItem = new HbListViewItem();
-        hbListItem->setGraphicsSize(HbListViewItem::Thumbnail);
-
         // Create the proxy model.
-        mProxyModel = new LocationPickerProxyModel();
+        mProxyModel = new LocationPickerProxyModel(mOrientation);
         mProxyModel->setSourceModel(mModel);
-
-        // set the model
-        mListView->setModel( mProxyModel, hbListItem );
         mProxyModel->setDynamicSortFilter(TRUE);
         mProxyModel->setSortRole(Qt::DisplayRole);
         mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
-
         // sort
         mProxyModel->sort(0, Qt::AscendingOrder);
-
-        // construct menu for the view
-        constructMenu();
     }
-
     else
     {
         // no locations to display.
         QStandardItem *modelItem = new QStandardItem();
-        modelItem->setData(QVariant(KNoLocations), Qt::DisplayRole);
+        modelItem->setData(QVariant(hbTrId("txt_lint_list_no_location_entries_present")), Qt::DisplayRole);
         mModel->appendRow( modelItem );
-        mListView->setModel(mModel);
-    }
-
-    setWidget(mListView);
-
-    
-    // create back action
-    mSecondaryBackAction = new HbAction( Hb::BackAction, this );
-    // add back key action
-    setNavigationAction( mSecondaryBackAction );
-    connect(mSecondaryBackAction, SIGNAL(triggered()), mWindow,
-                                SLOT(backButtonTriggered()));
-
+     }
 }
 
 // ----------------------------------------------------------------
@@ -97,50 +61,24 @@
 // -----------------------------------------------------------------
 LocationPickerCollectionContent::~LocationPickerCollectionContent()
 {
-    if( mDataManager )
-        delete mDataManager;
+    delete mProxyModel;
+    delete mModel;
+    delete mDataManager;
 }
 
 // ----------------------------------------------------------------
-// LocationPickerCollectionContent::constructMenu()
+// LocationPickerCollectionContent::getProxyModel
 // -----------------------------------------------------------------
-void LocationPickerCollectionContent::constructMenu()
-{
-    HbMenu *menu = this->menu();
-    HbMenu *subMenu = menu->addMenu(KSortBy);
-    HbAction *act;
-
-    act = new HbAction(QString(KAscend), this);
-    subMenu->addAction(act);
-    connect(act,SIGNAL(triggered()),this,SLOT(sortAscending()));
-
-    act = subMenu->addAction( KDescend );
-    connect(act, SIGNAL(triggered()), SLOT(sortDescending()));
-}
+LocationPickerProxyModel* LocationPickerCollectionContent::getProxyModel()
+    {
+    return mProxyModel;
+    }
 
 
 // ----------------------------------------------------------------
-// LocationPickerCollectionContent::sortAscending()
-// -----------------------------------------------------------------
-void LocationPickerCollectionContent::sortAscending()
-{
-    mProxyModel->sort(0, Qt::AscendingOrder);
-}
-// ----------------------------------------------------------------
-// LocationPickerCollectionContent::sortDescending()
+// LocationPickerCollectionContent::getDataManager
 // -----------------------------------------------------------------
-void LocationPickerCollectionContent::sortDescending()
-{
-    mProxyModel->sort(0, Qt::DescendingOrder);
-}
-
-// ----------------------------------------------------------------
-// LocationPickerCollectionContent::handleActivated()
-// -----------------------------------------------------------------
-void LocationPickerCollectionContent::handleActivated(const QModelIndex &aIndex)
-{
-    QModelIndex index = mProxyModel->mapToSource(aIndex);
-    quint32 lm = 0;
-    mDataManager->getData( index.row(), lm );
-    mWindow->itemSelected( lm );
-}
+LocationPickerDataManager* LocationPickerCollectionContent::getDataManager()
+    {
+    return mDataManager;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickercollectionlistcontent.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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: LocationPickerCollectionListContent implementation
+*
+*/
+
+#include <QStandardItemModel>
+
+#include "locationpickercollectionlistcontent.h"
+#include "locationpickerdatamanager.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ----------------------------------------------------------------------
+// LocationPickerCollectionListContent::LocationPickerCollectionListContent()
+// ----------------------------------------------------------------------
+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 );
+}
+
+// ----------------------------------------------------------------------
+// LocationPickerCollectionListContent::~LocationPickerCollectionListContent()
+// ----------------------------------------------------------------------
+LocationPickerCollectionListContent::~LocationPickerCollectionListContent()
+{
+    if( mDataManager )
+        delete mDataManager;
+    delete mModel;
+}
+
+// ----------------------------------------------------------------
+// LocationPickerCollectionListContent::getStandardModel
+// -----------------------------------------------------------------
+QStandardItemModel* LocationPickerCollectionListContent::getStandardModel()
+    {
+    return mModel;
+    }
+
+// ----------------------------------------------------------------
+// LocationPickerCollectionListContent::getDataManager
+// -----------------------------------------------------------------
+LocationPickerDataManager* LocationPickerCollectionListContent::getDataManager()
+    {
+    return mDataManager;
+    }
+
--- a/locationpickerservice/src/locationpickercollectionlistview.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +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: LocationPickerCollectionListView implementation
-*
-*/
-
-#include <HbListView>
-#include <QStandardItemModel>
-#include <HbListViewItem>
-
-#include "locationpickercollectionlistview.h"
-#include "locationpickercollectioncontent.h"
-#include "locationpickertoolbar.h"
-#include "locationpickerappwindow.h"
-#include "locationpickerdatamanager.h"
-#include "locationpickertypes.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// ----------------------------------------------------------------------
-// LocationPickerCollectionListView::LocationPickerCollectionListView()
-// ----------------------------------------------------------------------
-LocationPickerCollectionListView::LocationPickerCollectionListView(
-        LocationPickerAppWindow *aWindow, QGraphicsItem* aParent )
-        :HbView( aParent )
-
-{
-    mWindow = aWindow;
-    //Creation of List View
-    mListView=new HbListView( this );
-    connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-
-    //Set grahics size for the list items.
-    HbListViewItem *hbListItem = new HbListViewItem();
-    hbListItem->setGraphicsSize(HbListViewItem::MediumIcon);
-
-    // Create a standard model for the view list
-    mModel = new QStandardItemModel( this );
-    mListView->setModel( mModel, hbListItem );
-    
-    mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerCollectionListView );
-    mDataManager->populateModel();
-
-    setWidget( mListView );
-    
-    
-    // create back action
-    mSecondaryBackAction = new HbAction( Hb::BackAction, this );
-    // add back key action
-    setNavigationAction( mSecondaryBackAction );
-    connect(mSecondaryBackAction, SIGNAL(triggered()), mWindow,
-                                SLOT(backButtonTriggered()));
-
-}
-
-// ----------------------------------------------------------------------
-// LocationPickerCollectionListView::~LocationPickerCollectionListView()
-// ----------------------------------------------------------------------
-LocationPickerCollectionListView::~LocationPickerCollectionListView()
-{
-    if( mDataManager )
-        delete mDataManager;
-}
-
-
-// ----------------------------------------------------------------------
-// LocationPickerCollectionListView::handleActivated()
-// ----------------------------------------------------------------------
-void LocationPickerCollectionListView::handleActivated( const QModelIndex &aIndex )
-{
-    // get the collection/category id
-    quint32 categoryId = 0;
-    mDataManager->getData( aIndex.row(), categoryId );
-
-    // Create a content view of the selected collection
-    LocationPickerToolBar *toolBar = new LocationPickerToolBar( mWindow, this );
-    mCollectionContentView = new LocationPickerCollectionContent( mWindow, categoryId );
-    mCollectionContentView->setToolBar(toolBar);
-
-    // switch to the content view
-    mWindow->addView( mCollectionContentView );
-    mWindow->setCurrentView( mCollectionContentView );
-}
-
-// ----------------------------------------------------------------------
-// LocationPickerCollectionListView::deleteCollectionContentView()
-// ----------------------------------------------------------------------
-void LocationPickerCollectionListView::deleteCollectionContentView()
-{
-    // delete the content view
-    mWindow->removeView(mCollectionContentView);
-    delete mCollectionContentView;
-    mCollectionContentView = NULL;
-}
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickercontent.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* 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: LocationPickerContent implementation
+*
+*/
+
+#include <QStandardItemModel>
+
+#include "locationpickercontent.h"
+#include "locationpickerproxymodel.h"
+#include "locationpickertypes.h"
+#include "locationpickerdatamanager.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::LocationPickerContent()
+// -----------------------------------------------------------------------------
+LocationPickerContent::LocationPickerContent( Qt::Orientation aOrientation )
+	:mOrientation(aOrientation),
+	mListProxyModel(NULL),
+	mProxyGridModel(NULL),
+    mDataManager(NULL),
+	mModel(NULL),
+	mLocationsFound(true)
+{
+    // 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)
+    {
+        if( mDataManager->populateModel(mOrientation) )
+        {
+            // 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;
+        }
+        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;
+        }
+    }
+    //for landscape view
+    else
+    {
+        if( mDataManager->populateModel(mOrientation) )
+        {
+            // 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;
+        }
+        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;
+        }
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::LocationPickerContent()
+// -----------------------------------------------------------------------------
+LocationPickerContent::~LocationPickerContent()
+{
+    // delete data manager
+    if( mDataManager )
+        delete mDataManager;
+    delete mProxyGridModel;
+    delete mListProxyModel;
+    delete mModel;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::locationsFound()
+// -----------------------------------------------------------------------------
+bool LocationPickerContent::locationsFound()
+{
+    return mLocationsFound;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::getListProxyModel()
+// -----------------------------------------------------------------------------
+LocationPickerProxyModel* LocationPickerContent::getListProxyModel()
+{   
+    return mListProxyModel;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::getStandardModel()
+// -----------------------------------------------------------------------------
+QStandardItemModel* LocationPickerContent::getStandardModel()
+{
+    return mModel;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::getDataManager()
+// -----------------------------------------------------------------------------
+LocationPickerDataManager* LocationPickerContent::getDataManager()
+{
+    return mDataManager;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerContent::getGridProxyModel()
+// -----------------------------------------------------------------------------
+LocationPickerProxyModel* LocationPickerContent::getGridProxyModel()
+{
+    return mProxyGridModel;
+}
--- a/locationpickerservice/src/locationpickerdatamanager.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickerdatamanager.cpp	Mon May 03 12:27:22 2010 +0300
@@ -50,10 +50,10 @@
 // ----------------------------------------------------------------------------
 // LocationPickerDataManager::populateModel()
 // ----------------------------------------------------------------------------
-bool LocationPickerDataManager::populateModel( quint32 aCollectionId )
-{
+bool LocationPickerDataManager::populateModel(Qt::Orientations aOrientation, quint32 aCollectionId)
+{   
     Q_D( LocationPickerDataManager);
-    return( d->populateModel( aCollectionId ) );
+    return( d->populateModel(aOrientation, aCollectionId) );
 }
 
 
--- a/locationpickerservice/src/locationpickerdatamanager_p.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickerdatamanager_p.cpp	Mon May 03 12:27:22 2010 +0300
@@ -35,7 +35,7 @@
 
 LocationPickerDataManagerPrivate::LocationPickerDataManagerPrivate() :
         mModel( NULL ),
-        mViewType( ELocationPickerAllView ),
+        mViewType( ELocationPickerContent ),
         mIterator(NULL),
         mLandmarkDb(NULL),
         mLmCategoryManager(NULL),
@@ -78,9 +78,10 @@
 // ----------------------------------------------------------------------------
 // LocationPickerDataManagerPrivate::populateModel()
 // ----------------------------------------------------------------------------
-bool LocationPickerDataManagerPrivate::populateModel( quint32 aCollectionId )
+bool LocationPickerDataManagerPrivate::populateModel( const Qt::Orientations aOrientation, quint32 aCollectionId )
 {
     bool retValue = false;
+    mOrientation = aOrientation;
     TRAP_IGNORE( retValue = populateModelL( aCollectionId ) );
     return retValue;
 }
@@ -92,20 +93,20 @@
 {
     // Handle to the landmark database
     mLandmarkDb = NULL;
-
+    
     //Open and intialize Landmark DB
     mLandmarkDb = CPosLandmarkDatabase::OpenL();
     ExecuteAndDeleteLD( mLandmarkDb->InitializeL() );
 
     switch( mViewType )
     {
-        case ELocationPickerAllView:
+        case ELocationPickerContent:
         case ELocationPickerSearchView:
              {
                  // Create an iterator for iterating the landmarks in the database
                  mIterator = mLandmarkDb->LandmarkIteratorL();
 
-                 if( ( mIterator == NULL ) || (mIterator->NumOfItemsL() == 0) )
+                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
                  {
                      // no items in the landmark database, so return false.
                      return false;
@@ -115,7 +116,7 @@
                  CleanupStack::Pop( mIterator );
              }
              break;
-        case ELocationPickerCollectionListView:
+        case ELocationPickerCollectionListContent:
              {
 
                  // Create category manager for landmarks
@@ -128,7 +129,7 @@
                  // Create an iterator for iterating the referenced categories in the database
                  mIterator = mLmCategoryManager->ReferencedCategoryIteratorL();
 
-                 if( ( mIterator == NULL ) || (mIterator->NumOfItemsL() == 0) )
+                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
                  {
                      // no items in the landmark database, so return false.
                      return false;
@@ -140,7 +141,7 @@
              }
              break;
 
-        case ELocationPickerCollectionContentView:
+        case ELocationPickerCollectionContent:
              {
 
                  // create a search object.
@@ -157,7 +158,7 @@
 
                  // Retrieve an iterator to access the matching landmarks.
                  mIterator = mLandmarkSearch->MatchIteratorL();
-                 if( ( mIterator == NULL ) || (mIterator->NumOfItemsL() == 0) )
+                 if( ( !mIterator ) || (mIterator->NumOfItemsL() == 0) )
                  {
                      // no landmarks in this collection
                      CleanupStack::Pop(mLandmarkSearch);
@@ -181,10 +182,11 @@
 {
     // Read each landmark in the database and copy to the model.
     TPosLmItemId lmId;
-    while ((lmId = mIterator->NextL()) != KPosLmNullItemId )
+    mModel->clear();
+    while ( ( lmId = mIterator->NextL() ) != KPosLmNullItemId )
     {
         CPosLandmark* readLandmark = mLandmarkDb->ReadLandmarkLC(lmId );
-
+        
         if( readLandmark )
         {
             QString lmAddressLine1(" ");
@@ -270,7 +272,7 @@
             }
 
             // set icons based on contact address type
-            QVariantList icons;;
+            QVariantList icons;
             if( contactAddressType == KContactHome )
             {
                 icons << HbIcon(KDummyImage) << HbIcon(KContactHomeIcon);
@@ -283,15 +285,30 @@
             {
                 icons << HbIcon(KDummyImage) << HbIcon(KContactPrefIcon);
             }
-
-
+            
             // create a list item and set to model
             QStringList addressData;
-            addressData << lmAddressLine1 << lmAddressLine2;
-            QStandardItem *modelItem = new QStandardItem();
-            modelItem->setData(QVariant(addressData), Qt::DisplayRole);
-            modelItem->setData( icons, Qt::DecorationRole );
-            mModel->appendRow( modelItem );
+            //create model for grid view in landscape mode
+            if(mOrientation == Qt::Horizontal && ( mViewType == ELocationPickerCollectionContent || mViewType == ELocationPickerContent) )
+            {   
+                addressData.clear();
+                QStandardItem *modelItem = new QStandardItem();
+                addressData << lmAddressLine1;
+                modelItem->setData(QVariant(addressData), Qt::DisplayRole);
+                modelItem->setData( icons[0], Qt::DecorationRole );
+                modelItem->setData(QString("contact"),Qt::UserRole);
+                mModel->appendRow( modelItem );
+            }
+            else
+            {   
+                //create model for list view in potrai mode
+                addressData.clear();
+                QStandardItem *modelItem = new QStandardItem();
+                addressData << lmAddressLine1 << lmAddressLine2;
+                modelItem->setData(QVariant(addressData), Qt::DisplayRole);
+                modelItem->setData( icons, Qt::DecorationRole );
+                mModel->appendRow( modelItem );
+            }
 
             CleanupStack::PopAndDestroy( readLandmark );
         }
@@ -323,7 +340,7 @@
                 categoryName = QString( (QChar*)tempStr.Ptr(), tempStr.Length());
                 if(categoryName == KContactsString)
                 {
-                    categoryName = KContactsCollection;
+                    categoryName = hbTrId("txt_lint_list_contact_addresses");
                 }
             }
 
@@ -332,7 +349,7 @@
             QString iconPath;
             QStandardItem *modelItem = new QStandardItem();
             modelItem->setData(QVariant(categoryName), Qt::DisplayRole);
-            modelItem->setData( QIcon (KCollectionsContacts), Qt::DecorationRole );
+            modelItem->setData( HbIcon (KCollectionsContacts), Qt::DecorationRole );
             mModel->appendRow( modelItem );
 
             CleanupStack::PopAndDestroy( readCategory );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickerdocumentloader.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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: locationpickerdocumentloader implementation
+*
+*/
+
+#include "locationpickerdocumentloader.h"
+#include "locationpickerpotraitview.h"
+#include "locationpickersearchview.h"
+#include "locationpickerlandscapeview.h"
+
+// ---------------------------------------------------------------------------
+// LocationPickerDocumentLoader::LocationPickerDocumentLoader()
+// ---------------------------------------------------------------------------
+//
+LocationPickerDocumentLoader::LocationPickerDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// LocationPickerDocumentLoader::~LocationPickerDocumentLoader()
+// ---------------------------------------------------------------------------
+//
+LocationPickerDocumentLoader::~LocationPickerDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// LocationPickerDocumentLoader::createObject
+// ---------------------------------------------------------------------------
+//
+QObject *LocationPickerDocumentLoader::createObject(const QString& type, const QString &name)
+{   
+    //for locationpickerpotraitview
+    if (name == LocationPickerPotraitView::staticMetaObject.className() )
+    {
+        QObject *object = new LocationPickerPotraitView(this);
+        object->setObjectName(name);
+        return object;
+    }
+    //for locationpickerlandscapeview
+    if (name == LocationPickerLandscapeView::staticMetaObject.className())
+    {
+        QObject *object = new LocationPickerLandscapeView(this);
+        object->setObjectName(name);
+        return object;
+    }
+    //for locationpickersearchview
+    if (name == LocationPickerSearchView::staticMetaObject.className())
+    {
+        QObject *object = new LocationPickerSearchView(*this);
+        object->setObjectName(name);
+        return object;
+    }
+    //default case
+    return HbDocumentLoader::createObject(type, name);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickerlandscapeview.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,346 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocationPickerLandscapeView implementation
+*
+*/
+
+#include "locationpickerlandscapeview.h"
+
+#include <qstandarditemmodel.h>
+#include <HbMainWindow>
+#include <HbGridViewItem>
+#include <HbGridView>
+#include <HbStyleLoader>
+#include <HbAction>
+
+#include "locationpickerproxymodel.h"
+#include "locationpickerdatamanager.h"
+#include "locationpickercontent.h" 
+#include "locationpickercollectionlistcontent.h"
+#include "locationpickercollectioncontent.h"
+
+
+// ----------------------------------------------------
+// LocationPickerLandscapeView::LocationPickerLandscapeView()
+// ----------------------------------------------------
+LocationPickerLandscapeView::LocationPickerLandscapeView(HbDocumentLoader* aLoader)
+    :mDocumentLoader(aLoader),
+    mLocationPickerContent(NULL),
+    mLocationPickerCollectionListContent(NULL),
+    mAllAction(NULL),
+    mCollectionAction(NULL),
+    mSearchAction(NULL),
+    mAscendingAction(NULL),
+    mDescendingAction(NULL),
+    mGridView(NULL),
+    mCollectionContent(NULL),
+    mGridViewItem(NULL),
+    mViewType(ELocationPickerContent)
+{   
+    HbStyleLoader::registerFilePath(":/locationgrid.css"); 
+    HbStyleLoader::registerFilePath(":/locationgrid.hbgridviewitem.widgetml");
+    //create grid view item
+    mGridViewItem = new HbGridViewItem();
+    mGridViewItem->setObjectName("locationgrid");
+    
+    // create back action
+    mLandscapeBackAction = new HbAction(Hb::BackAction);
+    setNavigationAction(mLandscapeBackAction);
+    connect(mLandscapeBackAction, SIGNAL(triggered()), this,
+            SLOT(backButtonTriggered()));
+}
+// ----------------------------------------------------
+// LocationPickerPotraitView::~LocationPickerLandscapeView()
+// ----------------------------------------------------
+LocationPickerLandscapeView::~LocationPickerLandscapeView()
+{
+    delete mCollectionContent;
+    delete mLocationPickerContent;
+    delete mLocationPickerCollectionListContent;
+    delete mAllAction;
+    delete mCollectionAction;
+    delete mAscendingAction;
+    delete mDescendingAction;
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerPotraitView::backButtonTriggered()
+// ----------------------------------------------------------------------------
+void LocationPickerLandscapeView::backButtonTriggered()
+{
+    //if current model is collection content, go back to collectionlist content  
+    if(mViewType == ELocationPickerCollectionContent)
+    {
+        colectionTabTriggered();
+        delete mCollectionContent;
+        mCollectionContent=NULL; 
+    }
+    else
+    {
+        //complete the service
+        emit completeService();
+    } 
+}
+
+
+// ----------------------------------------------------
+// LocationPickerPotraitView::~init()
+// ----------------------------------------------------
+void LocationPickerLandscapeView::init(Qt::Orientation aOrientation )
+{   
+      // Create Collection List Content
+      mLocationPickerCollectionListContent = new LocationPickerCollectionListContent(aOrientation);
+      
+      mLocationPickerContent = new LocationPickerContent(aOrientation);
+      
+     //Get HbAction items
+	 mGridView = qobject_cast<HbGridView*> (mDocumentLoader->findObject(QString(
+                  "gridView")));
+      //get the action items from docml
+      mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
+              "allAction")));
+      mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+              QString("collectionAction")));
+      mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
+              "searchAction")));
+      mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+              QString("ascendingAction")));
+      mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+              QString("descendingAction")));
+      if( !mAllAction || !mCollectionAction || !mSearchAction || !mGridView || !mAscendingAction || !mDescendingAction)
+      {
+          qFatal("Error Reading Docml");
+      }
+
+      //connect to slots
+      connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+      connect(mDescendingAction, SIGNAL(triggered()), this,
+              SLOT(sortDescending()));
+      //connect all action Items to respective slots
+      connect(mAllAction, SIGNAL(triggered()), this, SLOT(allTabTriggered()));
+      connect(mCollectionAction, SIGNAL(triggered()), this,SLOT(colectionTabTriggered()));
+      connect(mSearchAction, SIGNAL(triggered()), this,
+              SLOT(searchTabTriggered()));
+      
+      connect(mGridView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
+}
+
+
+void LocationPickerLandscapeView::manageGridView()
+{   
+    // 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)
+            {
+                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;
+            }
+    }
+}
+
+void LocationPickerLandscapeView::disableTabs()
+{
+    mAllAction->setDisabled(true);
+    mCollectionAction->setDisabled(true);
+    mSearchAction->setDisabled(true);
+    mAscendingAction->setDisabled(true);
+    mDescendingAction->setDisabled(true);
+}
+
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::handleActivated()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::handleActivated(const QModelIndex &aIndex)
+{   
+    //handle the activated signal according to model set
+    
+       switch(mViewType)
+           {
+           case ELocationPickerContent:
+               {
+                   QModelIndex  index = mLocationPickerContent->getGridProxyModel()->mapToSource(
+                                  aIndex);
+                quint32 lm = 0;
+                mLocationPickerContent->getDataManager()->getData(index.row(), lm);
+                emit selectItem( lm );
+               }
+           break;
+           case ELocationPickerCollectionListContent:
+               {
+               mLocationPickerCollectionListContent->getDataManager()->getData(
+                       aIndex.row(), mCategoryId);
+               setCollectionData(mCategoryId);
+               emit sendCategoryID(mCategoryId);
+               }
+               break;
+              //default
+           case ELocationPickerCollectionContent:
+               {
+               QModelIndex   index = mCollectionContent->getProxyModel()->mapToSource(
+                                      aIndex);
+               quint32 lm = 0;
+               mCollectionContent->getDataManager()->getData(index.row(), lm);
+               emit selectItem(lm);
+               }
+               break;
+           default:
+               break;
+     }
+}
+
+
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::sortAscending()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::sortAscending()
+{   
+    //check the model set and do sorting accordingly
+        if (mViewType == ELocationPickerContent)
+        {
+            mLocationPickerContent->getGridProxyModel()->sort(0, Qt::AscendingOrder);
+        }
+        else
+        {
+            mCollectionContent->getProxyModel()->sort(0, Qt::AscendingOrder);
+        }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::sortDescending()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::sortDescending()
+{
+    //check the model set and do sorting accordingly
+        if (mViewType == ELocationPickerContent)
+        {
+            mLocationPickerContent->getGridProxyModel()->sort(0, Qt::DescendingOrder);
+        }
+        else
+        {
+            mCollectionContent->getProxyModel()->sort(0, Qt::DescendingOrder);
+        }   
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::handleAllTab()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::allTabTriggered()
+{
+    //execute only if tab is not pressed
+       if (mAllAction->isChecked())
+       {    
+           mGridView->setModel(mLocationPickerContent->getGridProxyModel(),mGridViewItem);
+           mAscendingAction->setEnabled(true);
+           mDescendingAction->setEnabled(true);
+           mCollectionAction->setChecked(false);
+           mViewType = ELocationPickerContent;
+		   //delete mCollectionContent if coming back from collectioncontent
+           if (mCollectionContent)
+           {
+               delete mCollectionContent;
+               mCollectionContent = NULL;
+           }
+       }
+       else
+       {
+	       //Keep the tab pressed
+           mAllAction->setChecked(true);
+       }
+    
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::handleCollectionTab()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::colectionTabTriggered()
+{
+    //execute only if tab is not pressed
+    if (mCollectionAction->isChecked())
+    {   
+        mViewType = ELocationPickerCollectionListContent;
+    	emit handleCollectionList();
+    }
+    else
+    {
+	    //Keep the tab pressed
+        mCollectionAction->setChecked(true);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::searchTabTriggered()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::searchTabTriggered()
+{
+    emit switchToSearchView();
+}
+
+void LocationPickerLandscapeView::setCollectionData( quint32 aCategoryId )
+{   
+    mCollectionContent
+    = new LocationPickerCollectionContent(this->mainWindow()->orientation() , aCategoryId);
+    mGridView->setModel(mCollectionContent->getProxyModel(),mGridViewItem);
+    mViewType = ELocationPickerCollectionContent;
+    //Enable the options
+    mAscendingAction->setEnabled(true);
+    mDescendingAction->setEnabled(true);
+    mCollectionAction->setChecked(true);
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::setCategoryID()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::setCategoryID( quint32 aCategoryId  )
+{
+    mCategoryId = aCategoryId;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::getViewType()
+// -----------------------------------------------------------------------------
+TViewType LocationPickerLandscapeView::getViewType()
+{
+    return mViewType;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerLandscapeView::setViewType()
+// -----------------------------------------------------------------------------
+void LocationPickerLandscapeView::setViewType(TViewType aViewType)
+{
+    mViewType = aViewType;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/locationpickerservice/src/locationpickerpotraitview.cpp	Mon May 03 12:27:22 2010 +0300
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: LocationPickerView implementation
+*
+*/
+
+#include "locationpickerpotraitview.h"
+
+#include <HbMainWindow>
+#include <qstandarditemmodel.h>
+#include <HbListView>
+#include <HbListViewItem>
+#include <HbAction>
+
+#include "locationpickerproxymodel.h"
+#include "locationpickerdatamanager.h"
+#include "locationpickercontent.h" 
+#include "locationpickercollectionlistcontent.h"
+#include "locationpickercollectioncontent.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ----------------------------------------------------
+// LocationPickerPotraitView::LocationPickerView()
+// ----------------------------------------------------
+LocationPickerPotraitView::LocationPickerPotraitView(HbDocumentLoader* aLoader)
+    :mDocumentLoader(aLoader),
+    mLocationPickerContent(NULL),
+    mLocationPickerCollectionListContent(NULL),
+    mAllAction(NULL),
+    mCollectionAction(NULL),
+    mSearchAction(NULL),
+    mAscendingAction(NULL),
+    mDescendingAction(NULL),
+    mListView(NULL),
+    mCollectionContent(NULL),
+    mViewType(ELocationPickerContent)
+{   
+    // create back action
+    mPotraitBackAction = new HbAction(Hb::BackAction);
+    // add back key action
+    setNavigationAction(mPotraitBackAction);
+    //connect to slots
+     connect(mPotraitBackAction, SIGNAL(triggered()), this,
+            SLOT(backTriggered()));     
+    //create list item  
+    mListItem = new HbListViewItem();
+    //set the graphics size
+    mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+}
+// ----------------------------------------------------
+// LocationPickerPotraitView::~LocationPickerView()
+// ----------------------------------------------------
+LocationPickerPotraitView::~LocationPickerPotraitView()
+{
+    delete mCollectionContent;
+    delete mLocationPickerContent;
+    delete mLocationPickerCollectionListContent;
+    delete mAllAction;
+    delete mCollectionAction;
+    delete mAscendingAction;
+    delete mDescendingAction;
+    delete mListView;
+}
+
+// ----------------------------------------------------------------------------
+// LocationPickerPotraitView::backButtonTriggered()
+// ----------------------------------------------------------------------------
+void LocationPickerPotraitView::backTriggered()
+{
+    //if current model is collection content, go back to collectionlist content  
+    if(mViewType == ELocationPickerCollectionContent)
+    {
+        colectionTabTriggered();
+        delete mCollectionContent;
+        mCollectionContent=NULL; 
+    }
+    else
+    {
+        //complete the service
+        emit completeService();
+    } 
+}
+
+
+// ----------------------------------------------------
+// LocationPickerPotraitView::init()
+// ----------------------------------------------------
+void LocationPickerPotraitView::init(Qt::Orientation aOrientation )
+{   
+    // Create Collection List Content
+    mLocationPickerCollectionListContent = new LocationPickerCollectionListContent(aOrientation);
+    mLocationPickerContent = new LocationPickerContent(aOrientation);
+
+    //Get HbAction items
+    mListView = qobject_cast<HbListView*> (mDocumentLoader->findObject(QString(
+            "ListView")));
+
+    //get the action items from docml
+    mAllAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
+            "allAction")));
+    mCollectionAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+            QString("collectionAction")));
+    mSearchAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(QString(
+            "searchAction")));
+    mAscendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+            QString("ascendingAction")));
+    mDescendingAction = qobject_cast<HbAction*> (mDocumentLoader->findObject(
+            QString("descendingAction")));
+      if( !mAllAction || !mCollectionAction || !mSearchAction || !mListView || !mAscendingAction || !mDescendingAction)
+      {
+          qFatal("Error Reading Docml");
+      }
+
+    //connect to slots
+    connect(mAscendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
+    connect(mDescendingAction, SIGNAL(triggered()), this,
+            SLOT(sortDescending()));
+    //connect all action Items to respective slots
+    connect(mAllAction, SIGNAL(triggered()), this, SLOT(allTabTriggered()));
+    connect(mCollectionAction, SIGNAL(triggered()), this,SLOT(colectionTabTriggered()));
+    connect(mSearchAction, SIGNAL(triggered()), this,
+            SLOT(searchTabTriggered()));
+    // connect the signal of the list activated to a slot.
+    connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
+}
+
+void LocationPickerPotraitView::manageListView()
+{
+    if (!mLocationPickerContent->locationsFound())
+    {
+        //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(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;
+        }
+        
+    }
+}
+
+
+void LocationPickerPotraitView::disableTabs()
+{
+    mAllAction->setDisabled(true);
+    mCollectionAction->setDisabled(true);
+    mSearchAction->setDisabled(true);
+    mAscendingAction->setDisabled(true);
+    mDescendingAction->setDisabled(true);
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleActivated()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::handleActivated(const QModelIndex &aIndex)
+{   
+    //handle the activated signal according to model set
+    switch(mViewType)
+    {
+        case ELocationPickerContent:
+        {
+            QModelIndex   index = mLocationPickerContent->getListProxyModel()->mapToSource(
+                    aIndex);
+            quint32 lm = 0;
+            mLocationPickerContent->getDataManager()->getData(index.row(), lm);
+            //item selected, complete request
+            emit selectItem( lm );
+        }
+            break;
+        case ELocationPickerCollectionListContent:
+        {
+            mLocationPickerCollectionListContent->getDataManager()->getData(
+                    aIndex.row(), mCategoryId);
+            mViewType = ELocationPickerCollectionContent;
+            //send categoryID to set the collection content
+            emit sendCategoryID(mCategoryId);
+        }
+            break;
+        case ELocationPickerCollectionContent:
+        {
+            QModelIndex  index = mCollectionContent->getProxyModel()->mapToSource(
+                        aIndex);
+            quint32 lm = 0;
+            mCollectionContent->getDataManager()->getData(index.row(), lm);
+            //item selected, complete request
+            emit selectItem(lm);
+        }
+            break;
+        default:
+            break;
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::sortAscending()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::sortAscending()
+{   
+    //check the model set and do sorting accordingly
+    if (mViewType == ELocationPickerContent)
+    {
+        mLocationPickerContent->getListProxyModel()->sort(0, Qt::AscendingOrder);
+    }
+    else
+    {
+        mCollectionContent->getProxyModel()->sort(0, Qt::AscendingOrder);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::sortDescending()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::sortDescending()
+{
+    //check the model set and do sorting accordingly
+    if (mViewType == ELocationPickerContent)
+    {
+        mLocationPickerContent->getListProxyModel()->sort(0, Qt::DescendingOrder);
+    }
+    else
+    {
+        mCollectionContent->getProxyModel()->sort(0, Qt::DescendingOrder);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleAllTab()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::allTabTriggered()
+{
+    //execute only if tab is not pressed
+    if (mAllAction->isChecked())
+    {    
+        mViewType = ELocationPickerContent;
+        if(this->mainWindow()->orientation() == Qt::Horizontal)
+        {
+            //if in landscape send signal to launch grid view
+            emit handleAllList();
+        }
+        else
+        {
+            mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+            mListView->setModel(mLocationPickerContent->getListProxyModel(),mListItem);
+            mCollectionAction->setChecked(false);
+        }
+        mAscendingAction->setEnabled(true);
+        mDescendingAction->setEnabled(true);
+        //delete mCollectionContent if coming back from collectioncontent
+        if (mCollectionContent)
+        {
+            delete mCollectionContent;
+            mCollectionContent = NULL;
+        }
+    }
+    else
+    {
+        //Keep the tab pressed
+        mAllAction->setChecked(true);
+    }
+    
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::handleCollectionTab()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::colectionTabTriggered()
+{
+    //execute only if tab is not pressed
+    if (mCollectionAction->isChecked())
+    {   
+        mListItem->setGraphicsSize(HbListViewItem::MediumIcon);
+        mListView->setModel(mLocationPickerCollectionListContent->getStandardModel(),mListItem);
+        mAscendingAction->setDisabled(true);
+        mDescendingAction->setDisabled(true);
+        mAllAction->setChecked(false);
+        mViewType = ELocationPickerCollectionListContent;
+    }
+    else
+    {
+        //Keep the tab pressed
+        mCollectionAction->setChecked(true);
+    }
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::searchTabTriggered()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::searchTabTriggered()
+{
+    emit switchToSearchView();
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::setCollectionData()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::setCollectionData( quint32 acategoryId )
+{
+    mCollectionContent
+    = new LocationPickerCollectionContent(this->mainWindow()->orientation() , acategoryId);
+    mListItem->setGraphicsSize(HbListViewItem::Thumbnail);
+    mListView->setModel(mCollectionContent->getProxyModel(),mListItem);
+    mViewType = ELocationPickerCollectionContent;
+    //Enable the options
+    mAscendingAction->setEnabled(true);
+    mDescendingAction->setEnabled(true);
+    mCollectionAction->setChecked(true);
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::setCategoryID()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::setCategoryID( quint32 aCategoryId  )
+{
+    mCategoryId = aCategoryId;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::getViewType()
+// -----------------------------------------------------------------------------
+TViewType LocationPickerPotraitView::getViewType()
+{
+    return mViewType;
+}
+
+// -----------------------------------------------------------------------------
+// LocationPickerView::setViewType()
+// -----------------------------------------------------------------------------
+void LocationPickerPotraitView::setViewType(TViewType aViewType)
+{
+    mViewType = aViewType;
+}
--- a/locationpickerservice/src/locationpickerproxymodel.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickerproxymodel.cpp	Mon May 03 12:27:22 2010 +0300
@@ -22,8 +22,9 @@
 // LocationPickerProxyModel::LocationPickerProxyModel()
 // ----------------------------------------------------
 
-LocationPickerProxyModel::LocationPickerProxyModel(QObject *parent)
-     : QSortFilterProxyModel(parent)
+LocationPickerProxyModel::LocationPickerProxyModel(Qt::Orientations aOrientation , QObject *parent)
+     :QSortFilterProxyModel(parent),
+     mOrientation( aOrientation )
 {
 }
 
@@ -33,18 +34,28 @@
  bool LocationPickerProxyModel::lessThan(const QModelIndex &left,
                                       const QModelIndex &right) const
 {
-    // get left and right items data and implement sort logic
+     // get left and right items data and implement sort logic
      // return true if left is less than right
-    QVariant leftData = sourceModel()->data(left);
-    QVariant rightData = sourceModel()->data(right);
+	 QVariant leftData = sourceModel()->data(left);
+     QVariant rightData = sourceModel()->data(right);
+
+    if( mOrientation == Qt::Vertical )
+    {
+        QStringList leftStringList = leftData.toStringList();
+
+        QStringList rightStringList = rightData.toStringList();
 
-    QStringList leftStringList = leftData.toStringList();
-
-    QStringList rightStringList = rightData.toStringList();
+        return QString::compare( QString( leftStringList[0] + " " + leftStringList[1] ),
+                                            QString( rightStringList[0] + " " + rightStringList[1] ), Qt::CaseInsensitive ) < 0;
+    }
+    else
+    {
+        QString leftString = leftData.toString();
 
-    return QString::compare( QString( leftStringList[0] + " " + leftStringList[1] ),
-                                            QString( rightStringList[0] + " " + rightStringList[1] ), Qt::CaseInsensitive ) < 0;
+        QString rightString = rightData.toString();
 
+        return QString::compare( leftString, rightString, Qt::CaseInsensitive ) < 0;
+    }
 }
 
  // ----------------------------------------------------
@@ -54,13 +65,18 @@
 bool LocationPickerProxyModel::filterAcceptsRow(int sourceRow,
         const QModelIndex &sourceParent) const
 {
-     // implement logic for search.
+    if( mOrientation == Qt::Vertical)
+    {
+    // implement logic for search.
     QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
 
     QStringList stringList = sourceModel()->data(index0).toStringList();
     QString fullString = " " + stringList[0] + " " + stringList[1];
 
     return (fullString.contains(mSearchText, Qt::CaseInsensitive));
+    }
+    else
+    return true;
 }
 
  // ----------------------------------------------------
--- a/locationpickerservice/src/locationpickersearchview.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickersearchview.cpp	Mon May 03 12:27:22 2010 +0300
@@ -16,47 +16,83 @@
 */
 
 #include <HbListViewItem>
-#include <QGraphicsLinearLayout>
 #include <QStandardItemModel>
 #include <HbSearchPanel>
 #include <HbListView>
+#include <HbTextItem>
+#include <HbDocumentLoader>
+#include <QGraphicsLinearLayout>
 
 #include "locationpickerproxymodel.h"
 #include "locationpickersearchview.h"
 #include "locationpickerdatamanager.h"
-#include "locationpickerappwindow.h"
 
 // ======== MEMBER FUNCTIONS ========
 
 // ----------------------------------------------------
 // LocationPickerSearchView::LocationPickerSearchView()
 // ----------------------------------------------------
-LocationPickerSearchView::LocationPickerSearchView( LocationPickerAppWindow *aWindow, QGraphicsItem* aParent ):
-        HbView( aParent ),
-        mSearchPanel(new HbSearchPanel(this))
+LocationPickerSearchView::LocationPickerSearchView(HbDocumentLoader &aLoader)
+    :mProxyModel(NULL),
+    mModel(NULL),
+    mListView(NULL),
+    mSearchPanel(NULL),
+    mDataManager(NULL),
+    mEmptyLabel(NULL),
+    mVerticalLayout(NULL),
+    mDocumentLoader(aLoader)
+{
+
+}
+// ----------------------------------------------------
+// LocationPickerSearchView::~LocationPickerSearchView()
+// ----------------------------------------------------
+LocationPickerSearchView::~LocationPickerSearchView()
+{
+    if( mDataManager )
+        delete mDataManager;
+    delete mProxyModel;
+    delete mModel;
+    delete mEmptyLabel;
+}
 
-{
+// ----------------------------------------------------
+// LocationPickerSearchView::init()
+// ----------------------------------------------------
+void LocationPickerSearchView::init()
+{   
+    //get listview from docml
+    mListView = qobject_cast<HbListView*>(
+            mDocumentLoader.findObject(QString("SearchListView")));
+    if(mListView == NULL)
+    {
+        qFatal("Error Reading Docml");   
+    }
+    //get search panel from docml
+    mSearchPanel = qobject_cast<HbSearchPanel*>(
+            mDocumentLoader.findObject(QString("searchPanel")));
+    if(mListView == NULL)
+    {
+        qFatal("Error Reading Docml");
+    }
+    //conect to respective slots
+    connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated
+    (const QModelIndex &)));
+    connect(mSearchPanel, SIGNAL(exitClicked()),this, SLOT(handleExit()));
+    connect(mSearchPanel,SIGNAL(criteriaChanged(QString)),this,SLOT(doSearch(QString)));
     
-    mWindow = aWindow;
-    //Create a linear layout
-    mLayout = new QGraphicsLinearLayout(Qt::Vertical);
-
-    // create the list view
-    mListView=new HbListView();
-    connect(mListView, SIGNAL(activated(const QModelIndex &)), this, SLOT(handleActivated(const QModelIndex &)));
-
     //Set graphics size for the list items.
     HbListViewItem *hbListItem = new HbListViewItem();
     hbListItem->setGraphicsSize(HbListViewItem::Thumbnail);
     mListView->setItemPrototype( hbListItem );
 
     // Create a standard model for the view list
-    mModel = new QStandardItemModel();
+    mModel = new QStandardItemModel(this);
     // create a data manager to populate the model
     mDataManager = new LocationPickerDataManager( *mModel, ELocationPickerSearchView );
 
     // Create the proxy model.
-    mProxyModel = new LocationPickerProxyModel();
+    mProxyModel = new LocationPickerProxyModel( Qt ::Vertical );
     mProxyModel->setSourceModel(mModel);
     mListView->setModel(mProxyModel);
 
@@ -66,43 +102,26 @@
     mProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
 
     // populate data
-    mDataManager->populateModel();
-
-    // sort
-    mProxyModel->sort(0, Qt::AscendingOrder);
-
-    // add the list view to layout
-    mLayout->addItem(mListView);
-
-    // create search panel
-    mSearchPanel->setProgressive(true);
-    mSearchPanel->setSearchOptionsEnabled(false);
-    connect(mSearchPanel,SIGNAL(criteriaChanged(QString)),this,SLOT(doSearch(QString)));
-
-    // add search panel to the layout
-    mLayout->addItem(mSearchPanel);
+    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 );
+    }
 
-    // setlayout for the view
-    setLayout(mLayout);
-    
-    
-    // create back action
-    mSecondaryBackAction = new HbAction( Hb::BackAction, this );
-    // add back key action
-    setNavigationAction( mSecondaryBackAction );
-    connect(mSecondaryBackAction, SIGNAL(triggered()), mWindow,
-                                SLOT(backButtonTriggered()));
+    // sort 
+    mProxyModel->sort(0, Qt::AscendingOrder);
+}
 
-
-}
 // ----------------------------------------------------
-// LocationPickerSearchView::~LocationPickerSearchView()
+// LocationPickerSearchView::handleExit()
 // ----------------------------------------------------
-LocationPickerSearchView::~LocationPickerSearchView()
-{
-    // delete mDataManager
-    if( mDataManager )
-        delete mDataManager;
+void LocationPickerSearchView::handleExit()
+{   
+    //emit signal to switch the current view
+    emit switchView();
 }
 
 // ----------------------------------------------------
@@ -113,6 +132,42 @@
     // use the string to search
     mProxyModel->filterParameterChanged(aCriteria);
     mProxyModel->setFilterFixedString(aCriteria);
+    //if no entries presentdisplay empty text item
+    if (!mProxyModel->rowCount() )
+    {
+        if(!mEmptyLabel)
+        {    
+            QGraphicsWidget *widget = NULL;
+            widget = mDocumentLoader.findWidget(QString("container"));
+            if(widget == NULL)
+            {
+                qFatal("Error Reading Docml"); 
+            }
+            mVerticalLayout = static_cast<QGraphicsLinearLayout*>(widget->layout());
+            if(mVerticalLayout == NULL)
+            {
+                qFatal("Error Reading Docml"); 
+            }
+            mVerticalLayout->removeItem(mListView);
+            mListView->setVisible(false);
+            mEmptyLabel = new HbTextItem(hbTrId("txt_lint_list_no_results"));
+            mEmptyLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+            mEmptyLabel->setFontSpec(HbFontSpec(HbFontSpec::Primary));
+            mEmptyLabel->setAlignment(Qt::AlignCenter);
+            mVerticalLayout->insertItem(0, mEmptyLabel);
+            mEmptyLabel->setVisible(true);
+        }
+    }
+    //else display the result
+    else if (mEmptyLabel)
+    {   
+        mVerticalLayout->removeItem(mEmptyLabel);
+        mEmptyLabel->setVisible(false);
+        delete mEmptyLabel;
+        mEmptyLabel=NULL;
+        mVerticalLayout->insertItem(0, mListView);
+        mListView->setVisible(true);
+    }
 }
 
 // ----------------------------------------------------
@@ -123,6 +178,7 @@
     QModelIndex index = mProxyModel->mapToSource(aIndex);
     quint32 lm = 0;
     mDataManager->getData( index.row(), lm );
-    mWindow->itemSelected( lm );
+    //emit item is selectedsignal
+    emit selectItem( lm );
 }
 
--- a/locationpickerservice/src/locationpickerservice.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/locationpickerservice.cpp	Mon May 03 12:27:22 2010 +0300
@@ -48,8 +48,12 @@
     {
         mReturn=aLm;
         connect( this, SIGNAL( returnValueDelivered() ), qApp, SLOT( quit() ) );
-        completeRequest(mAsyncReqId,mReturn);    
+        bool ok = completeRequest(mAsyncReqId,mReturn);    
         mAsyncReqId = 0;
+        if(ok==false)
+        {
+            qApp->quit();
+        }
     }
 }
 // ----------------------------------------------------------------------------
--- a/locationpickerservice/src/locationpickertoolbar.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +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: LocationPickerToolBar implementation
-*
-*/
-
-#include "locationpickertoolbar.h"
-#include "locationpickertypes.h"
-#include "locationpickerappwindow.h"
-
-
-// --------------------------------------------------
-// LocationPickerToolBar::LocationPickerToolBar()
-// --------------------------------------------------
-LocationPickerToolBar::LocationPickerToolBar( LocationPickerAppWindow* aWindow, QGraphicsItem* aParent ):
-        HbToolBar( aParent )
-{
-    mWindow = aWindow;
-
-    // Add all tab and connect to the slot
-    mAllAction = addAction(HbIcon(KAllTab),QString(""));
-    connect(mAllAction, SIGNAL(triggered()), this, SLOT(AllTabTriggered()));
-
-    // Add collection tab and connect to the slot
-    mCollectionAction = addAction(HbIcon(KCollectionTab),QString(""));
-    connect(mCollectionAction, SIGNAL(triggered()), this, SLOT(CollectionTabTriggered()));
-
-     // Add search tab and connect to the slot
-    mSearchAction = addAction(HbIcon(KSearchTab),QString(""));
-    connect(mSearchAction, SIGNAL(triggered()), this, SLOT(SearchTabTriggered()));
-}
-
-// --------------------------------------------------
-//  LocationPickerToolBar::disableTabs()
-// --------------------------------------------------
-void LocationPickerToolBar::disableTabs()
-{
-    mAllAction->setDisabled( true );
-    mCollectionAction->setDisabled( true );
-    mSearchAction->setDisabled( true );
-}
-// --------------------------------------------------
-//  LocationPickerToolBar::AllTabTriggered()
-// --------------------------------------------------
-void LocationPickerToolBar::AllTabTriggered()
-{
-    int viewIndex = mWindow->currentViewIndex();
-    mWindow->setCurrentViewIndex(0);
-
-    if( viewIndex > KNumberOfMainViews-1 )
-    {
-        // the current view is collection view, so delete before switching to another view
-        mWindow->deleteCollectionContentView();
-    }
-}
-
-// --------------------------------------------------
-// LocationPickerToolBar::CollectionTabTriggered()
-// --------------------------------------------------
-void LocationPickerToolBar::CollectionTabTriggered()
-{
-    int viewIndex = mWindow->currentViewIndex();
-    mWindow->setCurrentViewIndex(2);
-   
-    if( viewIndex > KNumberOfMainViews-1 )
-    {
-        // the current view is collection view, so delete before switching to another view
-        mWindow->deleteCollectionContentView();
-    }
-}
-
-// --------------------------------------------------
-// LocationPickerToolBar::SearchTabTriggered()
-// --------------------------------------------------
-void LocationPickerToolBar::SearchTabTriggered()
-{
-    int viewIndex = mWindow->currentViewIndex();
-    mWindow->setCurrentViewIndex(1);
-    
-    if( viewIndex > KNumberOfMainViews-1 )
-    {
-        // the current view is collection view, so delete before switching to another view
-        mWindow->deleteCollectionContentView();
-    }
-}
--- a/locationpickerservice/src/main.cpp	Fri Apr 16 14:54:12 2010 +0300
+++ b/locationpickerservice/src/main.cpp	Mon May 03 12:27:22 2010 +0300
@@ -15,14 +15,22 @@
 *
 */
 
-#include <hbapplication.h>
+#include <HbApplication>
+#include <QTranslator>
+#include <QLocale>
 #include "locationpickerappwindow.h"
 #include "locationpickertypes.h"
 
 int main(int argc, char *argv[])
 {
     HbApplication app(argc, argv);
-    app.setApplicationName( KApplicationTitle );
+    
+    QTranslator translator;
+    QString lang = QLocale::system().name();
+    translator.load("lilpicker_" + lang);
+    app.installTranslator(&translator);
+    
+    app.setApplicationName( hbTrId("txt_lint_title_select_location") );
     LocationPickerAppWindow mainWindow;
     mainWindow.show();
     return app.exec();