locationdataharvester/mylocationsengine/inc/mylocationsdatabasemanager.h
changeset 20 cd10d5b85554
parent 17 0f22fb80ebba
equal deleted inserted replaced
17:0f22fb80ebba 20:cd10d5b85554
    18 
    18 
    19 #ifndef __MYLOCATIONSDATABASEMANAGER_H__
    19 #ifndef __MYLOCATIONSDATABASEMANAGER_H__
    20 #define __MYLOCATIONSDATABASEMANAGER_H__
    20 #define __MYLOCATIONSDATABASEMANAGER_H__
    21 
    21 
    22 // Landmarks
    22 // Landmarks
    23 #include<epos_cposlandmarkdatabase.h>
    23 #include<EPos_CPosLandmarkDatabase.h>
    24 #include <EPos_CPosLmCategoryManager.h>
    24 #include <EPos_CPosLmCategoryManager.h>
    25 
    25 
    26 // Lookup database
    26 #include <locationservicedefines.h>
       
    27 
       
    28 // lookup database
       
    29 #include <locationdatalookupdb.h>
       
    30 
       
    31 // mylocations lookup db
    27 #include "mylocationslookupdb.h"
    32 #include "mylocationslookupdb.h"
    28 
    33 
    29 // Maximum string length of landmark address.
    34 // Maximum string length of landmark address.
    30 const TUint32 KMaxAddressLength = 255; 
    35 const TUint32 KMaxAddressLength = 255; 
    31 
    36 
    92          * @param[out] aLandmarkAddress comma separated landmark's full address
    97          * @param[out] aLandmarkAddress comma separated landmark's full address
    93          * @param[in] aLandmark landmark object whose address needs to be found.
    98          * @param[in] aLandmark landmark object whose address needs to be found.
    94          */      
    99          */      
    95         void GetLandmarkFullAddress( TBuf<KMaxAddressLength>& aLandmarkAddress, 
   100         void GetLandmarkFullAddress( TBuf<KMaxAddressLength>& aLandmarkAddress, 
    96                                      const CPosLandmark* aLandmark );
   101                                      const CPosLandmark* aLandmark );
    97 
   102        
    98         
   103 	    /** Update the maptile path to mylocation lookup table
       
   104          *
       
   105          * @param[in] aSourceId Uid of the changed source entry.
       
   106 		 * @param[in] aSourceType Source type of the aSourceId.
       
   107          * @param[in] aFilePath Maptile file path.
       
   108          */                               
       
   109         void UpdateMapTilePath( TUint32 aSourceId, TUint32 aSourceType, 
       
   110                                             TFileName aFilePath );
    99     private:
   111     private:
   100         
   112         
   101         /**
   113         /**
   102          * AddMylocationsCategory.
   114          * AddMylocationsCategory.
   103          * Adds the category to mylocations and landmarks database. 
   115          * Adds the category to landmarks database. 
   104          * Used to add history and others categories.
   116          * Used to add location picker specific categories.
   105          * @param[in] aCategoryType defines the category type to be added.
   117          * @param[in] aCategoryName defines the category name to be added.
   106          */
   118          * @returns The category id. 
   107         void AddMylocationsCategoryL( const TUint32 aCategoryType );
   119          */
       
   120         TUint32 AddMylocationsCategoryL(  const TDesC&  aCategoryName  );
   108 
   121 
   109         /**
   122         /**
   110          * CheckIfDuplicateExistsL.
   123          * CheckIfDuplicateExistsL.
   111          * Checks if this landmark is already present in database. 
   124          * Checks if this landmark is already present in database. 
   112          * If present returns the landmark id, else 0.
   125          * If present returns the landmark id, else 0.
   154          * @param[in] aSourceType source type of the aUid passed.
   167          * @param[in] aSourceType source type of the aUid passed.
   155         */
   168         */
   156        void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
   169        void HandleEntryDeletionL( const TUint32 aUid, const TUint32 aSourceType );
   157 
   170 
   158        /**
   171        /**
   159          * AddToMylocationsDbL.
   172          * HandleLandmarkModificationL.
   160          * Adds entry into mylocations db and also updates the lookup table
   173          * Handles a landmark modification
   161          * @param[in] aLandmark Landmark object to be added.
       
   162          * @param[in] aUid Uid of the source entry corresponding to aLandmark..
       
   163          * @param[in] aSourceType source type of the aUid passed.
       
   164         */
       
   165        void AddToMylocationsDbL( CPosLandmark*  aLandmark, const TUint32 aUid, 
       
   166                                  const TUint32 aSourceType );
       
   167 
       
   168        /**
       
   169          * ModifyMylocationsDbL.
       
   170          * Updates the entry into mylocations db and also updates the lookup table
       
   171          * @param[in] aLandmark Landmark object modified.
   174          * @param[in] aLandmark Landmark object modified.
   172          * @param[in] aUid Uid of the source entry corresponding to aLandmark..
   175          * @param[in] aUid Uid of the source entry corresponding to aLandmark..
   173          * @param[in] aSourceType source type of the aUid passed.
   176         */
   174         */
   177        void HandleLandmarkModificationL( CPosLandmark* aLandmark, const TUint32 aUid );
   175        void ModifyMylocationsDbL( CPosLandmark*  aLandmark, const TUint32 aUid, 
       
   176                                   const TUint32 aSourceType );
       
   177 
       
   178        /**
       
   179          * DeleteFromMylocationsDbL.
       
   180          * Deletes the entry from mylocations db and also updates the lookup table
       
   181          * @param[in] aUid Uid of the source entry corresponding to aLandmark..
       
   182          * @param[in] aSourceType source type of the aUid passed.
       
   183         */
       
   184        void DeleteFromMylocationsDbL( const TUint32 aUid, const TUint32 aSourceType );
       
   185 
       
   186        /**
       
   187          * CreateCategoryL.
       
   188          * Creates a new category in Mylocations Db and adds a corresponding entry in 
       
   189          * mylocations lookup table.
       
   190          * @param[in] aUid Uid of the source category.
       
   191         */
       
   192        void CreateCategoryL( const TUint32 aUid );
       
   193 
       
   194        /**
       
   195           * CheckCategoryAvailabilityL.
       
   196           * Checks whether a category is available in database pointed by category manager.
       
   197           * @param[in] aCategoryManager handle to the category manager
       
   198           * @param[in] aCategoryId Id of the category
       
   199          */
       
   200        void CheckCategoryAvailabilityL( CPosLmCategoryManager* aCategoryManager, 
       
   201                                         const TUint32 aCategoryId );
       
   202 
       
   203        /**
   178        /**
   204           * CheckAndReadLandmarkL.
   179           * CheckAndReadLandmarkL.
   205           * Checks whether a category is available in database pointed by category manager.
   180           * Checks whether a category is available in database pointed by category manager.
   206           * @param[in] CPosLandmarkDatabase handle to the database manager
   181           * @param[in] CPosLandmarkDatabase handle to the database manager
   207           * @param[in] aLmId Id of the landmark
   182           * @param[in] aLmId Id of the landmark
   208           * @returns landmark object if found else NULL
   183           * @returns landmark object if found else NULL
   209          */
   184          */
   210        CPosLandmark* CMyLocationsDatabaseManager::CheckAndReadLandmarkL( 
   185        CPosLandmark* CheckAndReadLandmarkL( 
   211                        CPosLandmarkDatabase* aDb, const TUint32 aLmId );
   186                        CPosLandmarkDatabase* aDb, const TUint32 aLmId );
       
   187         /**
       
   188           * FillLookupItemAddressDetails.
       
   189           * Fills address details into QLookupItem from CPosLandmark.
       
   190           * @param[in] aLandmark a landmark object
       
   191           * @param[out] aLookupItem, a lookup item in which the address details are filled
       
   192          */
       
   193        void FillLookupItemAddressDetails( CPosLandmark* aLandmark, QLookupItem &aLookupItem );
       
   194 
       
   195         /**
       
   196           * UnsetDuplicateNextCalEntry.
       
   197           * Finds a calendar lookup entry whose detination id  is aLandmarkId
       
   198 		  * and unsets it duplcate flag.
       
   199           * @param[in] aLandmarkId a landmark id.
       
   200          */
       
   201        void UnsetDuplicateNextCalEntry( quint32 aLandmarkId );
       
   202 
       
   203         /**
       
   204           * IsDuplicateCalEntry.
       
   205           * Checks if there is a duplicate entry present whose destination id 
       
   206 		  * is aLandmarkId
       
   207           * @param[in] aLandmarkId a landmark id.
       
   208          */
       
   209        bool IsDuplicateEntry( quint32 aLandmarkId );
       
   210 
       
   211         /**
       
   212           * CreateLandmarkItemLC.
       
   213           * Creates a landmark from a QLookupItem
       
   214           * @param[in] aLookupItem a lookup item.
       
   215           * @returns CPosLandmark a newly created landmark.
       
   216          */
       
   217        CPosLandmark* CreateLandmarkItemLC( const QLookupItem &aLookupItem );
   212        
   218        
   213     private:
   219     private:
   214         
       
   215         // Handle to the landmark database
   220         // Handle to the landmark database
   216         CPosLandmarkDatabase* iLandmarkDb;
   221         CPosLandmarkDatabase* iLandmarkDb;
   217         
   222 
   218         // Handle to the mylocations landmark database
   223         // Calendar category to be created for calendar related location entries in landmark database
   219         CPosLandmarkDatabase* iMyLocationsLandmarksDb;
   224         TPosLmItemId iLmCalendarCatId;  
   220 
   225         // Contacts category to be created for contacts related location entries in landmark database
   221         // Contacts category to be created for contacts and calendar 
       
   222         // related location entries in landmark database
       
   223         TPosLmItemId iLmContactsCatId;  
   226         TPosLmItemId iLmContactsCatId;  
   224         
       
   225         // handle to landmarks lookup database.
   227         // handle to landmarks lookup database.
   226         CLookupDatabase*  iLandmarksLookupDb;
   228         CLookupDatabase*  iLandmarksLookupDb;
   227 
   229 
   228         // handle to mylocations lookup database.
   230         // handle to the location app lookup database.
   229         CLookupDatabase*  iMylocationsLookupDb;
   231         LocationDataLookupDb*  iLocationAppLookupDb;
   230 
       
   231         // handle to mylocations category manager
       
   232         CPosLmCategoryManager* iMyLocationsCatManager;
       
   233 
   232 
   234         // handle to landmarks category manager
   233         // handle to landmarks category manager
   235         CPosLmCategoryManager* iLandmarksCatManager;
   234         CPosLmCategoryManager* iLandmarksCatManager;
   236         
   235 
   237         // handle to the file session
   236         // handle to the file session
   238         RFs iFsSession;
   237         RFs iFsSession;
   239        
       
   240     };
   238     };
   241 
       
   242 #endif  // __MYLOCATIONSDATABASEMANAGER_H__
   239 #endif  // __MYLOCATIONSDATABASEMANAGER_H__