phonebookengines/cntmaptileservice/inc/cntmaptileservice.h
changeset 46 efe85016a067
parent 25 76a2435edfd4
child 47 7cbcb2896f0e
equal deleted inserted replaced
40:b46a585f6909 46:efe85016a067
    20 #define _CNTMAPTILESERVICE_H_
    20 #define _CNTMAPTILESERVICE_H_
    21 
    21 
    22 
    22 
    23 #include <QString>
    23 #include <QString>
    24 #include <QtGlobal>
    24 #include <QtGlobal>
       
    25 #include <QObject>
       
    26 #include <qmobilityglobal.h>
    25 
    27 
       
    28 QTM_BEGIN_NAMESPACE
       
    29 class QValueSpacePublisher;
       
    30 class QValueSpaceSubscriber;
       
    31 QTM_END_NAMESPACE
       
    32 
       
    33 QTM_USE_NAMESPACE
    26 
    34 
    27 #ifdef  CNTMAPTILESERVICEDLL
    35 #ifdef  CNTMAPTILESERVICEDLL
    28 #define CNTMAPTILESERVICE_EXPORT Q_DECL_EXPORT
    36 #define CNTMAPTILESERVICE_EXPORT Q_DECL_EXPORT
    29 #else
    37 #else
    30 #define CNTMAPTILESERVICE_EXPORT Q_DECL_IMPORT
    38 #define CNTMAPTILESERVICE_EXPORT Q_DECL_IMPORT
    31 #endif
    39 #endif
    32 
    40 
    33 
    41 //Forward declaration
       
    42 class TLookupItem;
    34 
    43 
    35 // CLASS DECLARATION
    44 // CLASS DECLARATION
    36 
    45 
    37 /**
    46 /**
    38 *  Maptile service class,  provides interface to get map tile image associated with 
    47 *  Maptile service class,  provides interface to get map tile image associated with 
    39 *  contact. Also provides interface to check whether location feature is enabled or disabled.
    48 *  contact. Also provides interface to check whether location feature is enabled or disabled.
    40 *
    49 *
    41 *  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
    50 *  Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file.
    42 */
    51 */
    43 class CNTMAPTILESERVICE_EXPORT CntMapTileService 
    52 class CNTMAPTILESERVICE_EXPORT CntMapTileService : public QObject
    44 {
    53 {
    45 
    54     Q_OBJECT
    46 public:
    55 public:
    47 
    56 
       
    57     /** 
       
    58      * Maptile fetching status
       
    59      */
       
    60     enum MapTileStatus
       
    61     {
       
    62         /** Map tile fetching completed */
       
    63         MapTileFetchingCompleted = 0,
       
    64         /** Map tile fetching in progress */
       
    65         MapTileFetchingInProgress,
       
    66         /** Map  tile fetching n/w error */
       
    67         MapTileFetchingNetworkError,
       
    68         /** Map tile fetching invalid address */
       
    69         MapTileFetchingInvalidAddress,
       
    70         /** Map tile fetching unknown erro */
       
    71         MapTileFetchingUnknownError
       
    72     };
       
    73 
       
    74 	
    48     /** 
    75     /** 
    49      * Contact address types
    76      * Contact address types
    50      */
    77      */
    51     enum ContactAddressType      
    78     enum ContactAddressType      
    52     {
    79     {
    53         /** Address Type Pref */
    80         /** Address Type Pref */
    54         AddressPreference,
    81         AddressPreference,
       
    82         /** Address type Home */
       
    83         AddressHome,
    55         /** Address type Work */
    84         /** Address type Work */
    56         AddressWork,
    85         AddressWork
    57         /** Address type Home */
       
    58         AddressHome
       
    59     };
    86     };
    60       
    87     
       
    88     
       
    89    /**
       
    90     * Default Constructor
       
    91     */  
       
    92     CntMapTileService();
       
    93     
       
    94    /**
       
    95     * Destructor
       
    96     */
       
    97     ~CntMapTileService();
       
    98     
    61    /**
    99    /**
    62     * Checks whether location feature enabled or disabled.
   100     * Checks whether location feature enabled or disabled.
    63     * 
   101     * 
    64     * @return Returns true or false based on location feature setting.
   102     * @return Returns true or false based on location feature setting.
    65     */
   103     */
    66     static bool isLocationFeatureEnabled();
   104     bool isLocationFeatureEnabled();
    67             
   105             
    68    /**
   106    /**
    69     * Gets a maptile image associated with a contact id. Returns a maptile 
   107     * Gets a maptile image associated with a contact id. Returns a maptile 
    70     * image path if it is available otherwise returns NULL.
   108     * image path if it is available otherwise returns NULL.
    71     * 
   109     * 
    72     * @param contactId  Contact id     
   110     * @param contactId  Contact id     
    73     * @param sourceType Source address type( Preferred, Home , Work address )
   111     * @param sourceType Source address type( Preferred, Home , Work address )
       
   112     * @param imagePath  Maptile image path associated with the contact id
    74     *      
   113     *      
    75     * @return Returns maptile image path if it is available, else NULL.
   114     * @return Returns the maptile fetching status.
    76     */
   115     */
    77     static QString getMapTileImage( int contactId, ContactAddressType sourceType  );  
   116     int getMapTileImage( int Id, ContactAddressType sourceType, QString& imagePath  );   
    78      	
   117     
       
   118 public slots: 
       
   119     /**
       
   120      * Receives maptile status information and emits the maptilFetchingStatusUpdate
       
   121      * signal.
       
   122      */
       
   123     void setMaptileStatus();
       
   124     
       
   125 signals:
       
   126     /**
       
   127      * Signal to update the maptile fetchings status to contact application.
       
   128      * @param id  Contact id     
       
   129      * @param addressType Source address type( Preferred, Home , Work address )
       
   130      * @param status Maptile status for the associated address
       
   131      */
       
   132      void maptileFetchingStatusUpdate( int id, int addressType, int status );
       
   133     
       
   134 
       
   135 #ifdef CNTMAPTILESERVICE_UNIT_TEST
       
   136 public:
       
   137 #else     
       
   138 private:
       
   139 #endif  
       
   140      
       
   141     /**
       
   142      * Publishes the contact address information to backend engine
       
   143      * @param id  Contact id     
       
   144      * @param sourceType Source address type( Preferred, Home , Work address )
       
   145      * @param addressCount Number of address associated with this contact
       
   146      */ 
       
   147      void publishValue( int id, ContactAddressType sourceType, int addressCount );
       
   148     
       
   149      /**
       
   150       * Reads the contact maptile information from maptile database.
       
   151       * @param id  Contact id     
       
   152       * @param sourceType Source address type( Preferred, Home , Work address )
       
   153       * @param aLookupItem Contains the maptile information of a contact entry.
       
   154       * @param aNoOfAddress Number of address associated with this contact.
       
   155       * 
       
   156       * @return Returns zero if successful or error.
       
   157       */ 
       
   158      int readEntryFromMaptileDataBase( int id, ContactAddressType sourceType,
       
   159                           TLookupItem& aLookupItem, int& aNoOfAddress  );
       
   160 
       
   161 #ifdef CNTMAPTILESERVICE_UNIT_TEST
       
   162 public:
       
   163 #else     
       
   164 private:
       
   165 #endif  
       
   166 
       
   167     //The contact id for which maptile requested
       
   168     int mLastViewedContactId;
       
   169     //Maptile request publisher
       
   170     QValueSpacePublisher *mPublisher;
       
   171     //Maptile status request subscriber
       
   172     QValueSpaceSubscriber *mSubscriber;
       
   173     //Contact information stored as string 
       
   174     QString mContactEntryInfo;
       
   175 
    79 };
   176 };
    80 
   177 
    81 #endif //_CNTMAPTILESERVICE_H_
   178 #endif //_CNTMAPTILESERVICE_H_
    82 
   179