locationdataharvester/maptileservice/inc/maptileservice.h
branchRCL_3
changeset 18 870918037e16
parent 17 1fc85118c3ae
equal deleted inserted replaced
17:1fc85118c3ae 18:870918037e16
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *     maptile service interface
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef _MAPTILESERVICE_H_
       
    20 #define _MAPTILESERVICE_H_
       
    21 
       
    22 
       
    23 #include <QString>
       
    24 #include <QtGlobal>
       
    25 #include <QObject>
       
    26 #include <qmobilityglobal.h>
       
    27 
       
    28 QTM_BEGIN_NAMESPACE
       
    29 class QValueSpacePublisher;
       
    30 class QValueSpaceSubscriber;
       
    31 QTM_END_NAMESPACE
       
    32 
       
    33 QTM_USE_NAMESPACE
       
    34 
       
    35 #ifdef  MAPTILESERVICEDLL
       
    36 #define MAPTILESERVICE_EXPORT Q_DECL_EXPORT
       
    37 #else
       
    38 #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT
       
    39 #endif
       
    40 
       
    41 class TLookupItem;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46 *  Maptile service class,  provides interface to get map tile image associated with 
       
    47 *  contact. Also provides interface to check whether location feature is enabled or disabled.
       
    48 *
       
    49 *  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
       
    50 */
       
    51 class MAPTILESERVICE_EXPORT MapTileService : public QObject
       
    52 {
       
    53     Q_OBJECT
       
    54 public:
       
    55 
       
    56     /** 
       
    57      * Maptile fetching status
       
    58      */
       
    59     enum MapTileStatus
       
    60     {
       
    61         /** Map tile fetching completed */
       
    62         MapTileFetchingCompleted = 0,
       
    63         /** Map tile fetching in progress */
       
    64         MapTileFetchingInProgress,
       
    65         /** Map  tile fetching n/w error */
       
    66         MapTileFetchingNetworkError,
       
    67         /** Map tile fetching invalid address */
       
    68         MapTileFetchingInvalidAddress,
       
    69         /** Map tile fetching unknown erro */
       
    70         MapTileFetchingUnknownError
       
    71     };
       
    72 
       
    73     /**
       
    74      * Application types      
       
    75      */
       
    76     enum AppType
       
    77     {
       
    78         /** Contacts application */
       
    79         AppTypeContacts,
       
    80         /** Calendar application */
       
    81         AppTypeCalendar
       
    82     };
       
    83 	
       
    84     /** 
       
    85      * Address types
       
    86      */
       
    87     enum AddressType      
       
    88     {
       
    89         /** Plain Address Type */
       
    90         AddressPlain,
       
    91         /** Address Type Pref */
       
    92         AddressPreference,
       
    93         /** Address type Work */
       
    94         AddressWork,
       
    95         /** Address type Home */
       
    96         AddressHome,
       
    97         /** Address type Unknown */
       
    98         AddressUnknown
       
    99     };
       
   100         
       
   101     MapTileService();
       
   102     
       
   103     ~MapTileService();
       
   104     
       
   105    /**
       
   106     * Checks whether location feature enabled or disabled for specific application.
       
   107     * 
       
   108     * @return Returns true or false based on location feature setting.
       
   109     */
       
   110     bool isLocationFeatureEnabled(AppType appType);
       
   111             
       
   112    /**
       
   113     * Gets a maptile image associated with a id(contact id/calendar id). 
       
   114     * Returns a maptile image path if it is available otherwise returns NULL.
       
   115     * 
       
   116     * @param contactId  app id     
       
   117     * @param sourceType Source address type( Preferred, Home , Work address )
       
   118     * @param imagePath  Maptile image path associated with the app id
       
   119     * @param orientation Application current orientation.   
       
   120     *      
       
   121     * @return Returns the maptile fetching status.
       
   122     */
       
   123     int getMapTileImage( int Id, AddressType sourceType, 
       
   124              QString& imagePath, Qt::Orientations orientation = Qt::Vertical  );  
       
   125     
       
   126 public slots: 
       
   127     /**
       
   128      * Receives maptile status information and emits the maptilFetchingStatusUpdate
       
   129      * signal.
       
   130      */
       
   131     void setMaptileStatus();
       
   132 
       
   133 signals:
       
   134     /**
       
   135      * Signal to update the maptile fetchings status to contact/calendar application.
       
   136      * @param id  app id     
       
   137      * @param addressType Source address type( Preferred, Home , Work address )
       
   138      * @param status Maptile status for the associated address
       
   139      */
       
   140      void maptileFetchingStatusUpdate( int id, int addressType, int status );
       
   141     
       
   142 
       
   143 private:
       
   144 
       
   145     /**
       
   146      * Publish the contact entry id , AddressType and number of address
       
   147      * @param id, Contact id .
       
   148      * @param sourceType, address type( Preferred, Home , Work address )
       
   149      * @param addressCount ,number of address to be published. 
       
   150      */
       
   151     void publishValue(int id, AddressType sourceType, int addressCount );
       
   152     /**
       
   153     * Publish the calendar entry id , AddressType and number of address
       
   154     * @param id, calendar entry id .
       
   155     * @param sourceType, address type( plain) 
       
   156     * @param addressCount ,number of address to be published. 
       
   157     */
       
   158     void publishCalEntry(int id);
       
   159     
       
   160     /**
       
   161     * Read entry from database
       
   162     * @param id, Contact/calendar id .
       
   163     * @param sourceType, address type( plain ,Preferred, Home , Work address )
       
   164     * @param aLookupItem ,entry information
       
   165     * @param aNoOfAddress ,number of address read from databse 
       
   166     */
       
   167     int readEntryFromMaptileDataBase( int id, AddressType sourceType,
       
   168                 TLookupItem& aLookupItem, int& aNoOfAddress  );
       
   169 
       
   170 private:
       
   171     
       
   172     //The contact/calendar id for which maptile requested
       
   173     int mLastViewedEntryId;
       
   174 	
       
   175     //Maptile request publisher
       
   176     QValueSpacePublisher *mPublisher;
       
   177     //Maptile status request subscriber
       
   178     QValueSpaceSubscriber *mSubscriber;
       
   179 	//Calendar Maptile request publisher
       
   180     QValueSpacePublisher *mCalPublisher;
       
   181 };
       
   182 
       
   183 #endif //MAPTILESERVICE_H_
       
   184