20 #define _MAPTILESERVICE_H_ |
20 #define _MAPTILESERVICE_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 MAPTILESERVICEDLL |
35 #ifdef MAPTILESERVICEDLL |
28 #define MAPTILESERVICE_EXPORT Q_DECL_EXPORT |
36 #define MAPTILESERVICE_EXPORT Q_DECL_EXPORT |
29 #else |
37 #else |
30 #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT |
38 #define MAPTILESERVICE_EXPORT Q_DECL_IMPORT |
31 #endif |
39 #endif |
32 |
40 |
33 |
41 class TLookupItem; |
34 |
42 |
35 // CLASS DECLARATION |
43 // CLASS DECLARATION |
36 |
44 |
37 /** |
45 /** |
38 * Maptile service class, provides interface to get map tile image associated with |
46 * 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. |
47 * contact. Also provides interface to check whether location feature is enabled or disabled. |
40 * |
48 * |
41 * Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file. |
49 * Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file. |
42 */ |
50 */ |
43 class MAPTILESERVICE_EXPORT MapTileService |
51 class MAPTILESERVICE_EXPORT MapTileService : public QObject |
44 { |
52 { |
|
53 Q_OBJECT |
|
54 public: |
45 |
55 |
46 public: |
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 }; |
47 |
72 |
48 /** |
73 /** |
49 * Application types |
74 * Application types |
50 */ |
75 */ |
51 enum AppType |
76 enum AppType |
65 /** Address Type Pref */ |
91 /** Address Type Pref */ |
66 AddressPreference, |
92 AddressPreference, |
67 /** Address type Work */ |
93 /** Address type Work */ |
68 AddressWork, |
94 AddressWork, |
69 /** Address type Home */ |
95 /** Address type Home */ |
70 AddressHome |
96 AddressHome, |
|
97 /** Address type Unknown */ |
|
98 AddressUnknown |
71 }; |
99 }; |
72 |
100 |
|
101 MapTileService(); |
|
102 |
|
103 ~MapTileService(); |
|
104 |
73 /** |
105 /** |
74 * Checks whether location feature enabled or disabled for specific application. |
106 * Checks whether location feature enabled or disabled for specific application. |
75 * |
107 * |
76 * @return Returns true or false based on location feature setting. |
108 * @return Returns true or false based on location feature setting. |
77 */ |
109 */ |
78 static bool isLocationFeatureEnabled(AppType appType); |
110 bool isLocationFeatureEnabled(AppType appType); |
79 |
111 |
80 /** |
112 /** |
81 * Gets a maptile image associated with a id(contact id/calendar id). |
113 * Gets a maptile image associated with a id(contact id/calendar id). |
82 * Returns a maptile image path if it is available otherwise returns NULL. |
114 * Returns a maptile image path if it is available otherwise returns NULL. |
83 * |
115 * |
84 * @param contactId Contact id |
116 * @param contactId app id |
85 * @param sourceType Source address type( Preferred, Home , Work address ) |
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. |
86 * |
120 * |
87 * @return Returns maptile image path if it is available, else NULL. |
121 * @return Returns the maptile fetching status. |
88 */ |
122 */ |
89 static QString getMapTileImage( int Id, AddressType sourceType ); |
123 int getMapTileImage( int Id, AddressType sourceType, |
90 |
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; |
91 }; |
181 }; |
92 |
182 |
93 #endif //MAPTILESERVICE_H_ |
183 #endif //MAPTILESERVICE_H_ |
94 |
184 |