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 * Contact maptile service interface |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef _CNTMAPTILESERVICE_H_ |
|
20 #define _CNTMAPTILESERVICE_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 CNTMAPTILESERVICEDLL |
|
36 #define CNTMAPTILESERVICE_EXPORT Q_DECL_EXPORT |
|
37 #else |
|
38 #define CNTMAPTILESERVICE_EXPORT Q_DECL_IMPORT |
|
39 #endif |
|
40 |
|
41 //Forward declaration |
|
42 class TLookupItem; |
|
43 |
|
44 // CLASS DECLARATION |
|
45 |
|
46 /** |
|
47 * Maptile service class, provides interface to get map tile image associated with |
|
48 * contact. Also provides interface to check whether location feature is enabled or disabled. |
|
49 * |
|
50 * Note: Location feature can be enabled or disabled by modifying conf\cntmaptileservice.confml file. |
|
51 */ |
|
52 class CNTMAPTILESERVICE_EXPORT CntMapTileService : public QObject |
|
53 { |
|
54 Q_OBJECT |
|
55 public: |
|
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 |
|
75 /** |
|
76 * Contact address types |
|
77 */ |
|
78 enum ContactAddressType |
|
79 { |
|
80 /** Address Type Pref */ |
|
81 AddressPreference, |
|
82 /** Address type Home */ |
|
83 AddressHome, |
|
84 /** Address type Work */ |
|
85 AddressWork |
|
86 }; |
|
87 |
|
88 |
|
89 /** |
|
90 * Default Constructor |
|
91 */ |
|
92 CntMapTileService(); |
|
93 |
|
94 /** |
|
95 * Destructor |
|
96 */ |
|
97 ~CntMapTileService(); |
|
98 |
|
99 /** |
|
100 * Checks whether location feature enabled or disabled. |
|
101 * |
|
102 * @return Returns true or false based on location feature setting. |
|
103 */ |
|
104 bool isLocationFeatureEnabled(); |
|
105 |
|
106 /** |
|
107 * Gets a maptile image associated with a contact id. Returns a maptile |
|
108 * image path if it is available otherwise returns NULL. |
|
109 * |
|
110 * @param contactId Contact id |
|
111 * @param sourceType Source address type( Preferred, Home , Work address ) |
|
112 * @param imagePath Maptile image path associated with the contact id |
|
113 * @param orientation Application current ui orientation. |
|
114 * |
|
115 * @return Returns the maptile fetching status. |
|
116 */ |
|
117 int getMapTileImage( int Id, |
|
118 ContactAddressType sourceType, |
|
119 QString& imagePath, |
|
120 Qt::Orientations orientation = Qt::Vertical ); |
|
121 |
|
122 public slots: |
|
123 /** |
|
124 * Receives maptile status information and emits the maptilFetchingStatusUpdate |
|
125 * signal. |
|
126 */ |
|
127 void setMaptileStatus(); |
|
128 |
|
129 signals: |
|
130 /** |
|
131 * Signal to update the maptile fetchings status to contact application. |
|
132 * @param id Contact id |
|
133 * @param addressType Source address type( Preferred, Home , Work address ) |
|
134 * @param status Maptile status for the associated address |
|
135 */ |
|
136 void maptileFetchingStatusUpdate( int id, int addressType, int status ); |
|
137 |
|
138 |
|
139 #ifdef CNTMAPTILESERVICE_UNIT_TEST |
|
140 public: |
|
141 #else |
|
142 private: |
|
143 #endif |
|
144 |
|
145 /** |
|
146 * Publishes the contact address information to backend engine |
|
147 * @param id Contact id |
|
148 * @param sourceType Source address type( Preferred, Home , Work address ) |
|
149 * @param addressCount Number of address associated with this contact |
|
150 */ |
|
151 void publishValue( int id, ContactAddressType sourceType, int addressCount ); |
|
152 |
|
153 /** |
|
154 * Reads the contact maptile information from maptile database. |
|
155 * @param id Contact id |
|
156 * @param sourceType Source address type( Preferred, Home , Work address ) |
|
157 * @param aLookupItem Contains the maptile information of a contact entry. |
|
158 * @param aNoOfAddress Number of address associated with this contact. |
|
159 * |
|
160 * @return Returns zero if successful or error. |
|
161 */ |
|
162 int readEntryFromMaptileDataBase( int id, ContactAddressType sourceType, |
|
163 TLookupItem& aLookupItem, int& aNoOfAddress ); |
|
164 |
|
165 #ifdef CNTMAPTILESERVICE_UNIT_TEST |
|
166 public: |
|
167 #else |
|
168 private: |
|
169 #endif |
|
170 |
|
171 //The contact id for which maptile requested |
|
172 int mLastViewedContactId; |
|
173 //Maptile request publisher |
|
174 QValueSpacePublisher *mPublisher; |
|
175 //Maptile status request subscriber |
|
176 QValueSpaceSubscriber *mSubscriber; |
|
177 //Contact information stored as string |
|
178 QString mContactEntryInfo; |
|
179 |
|
180 }; |
|
181 |
|
182 #endif //_CNTMAPTILESERVICE_H_ |
|
183 |
|