|
1 /** |
|
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "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 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The Plugin that fetches contacts from the logged in user's flickr account |
|
17 * |
|
18 */ |
|
19 |
1 #ifndef _FLICKRCONTACTFETCHERPLUGIN_H |
20 #ifndef _FLICKRCONTACTFETCHERPLUGIN_H |
2 #define _FLICKRCONTACTFETCHERPLUGIN_H |
21 #define _FLICKRCONTACTFETCHERPLUGIN_H |
3 |
22 |
4 // Include files |
23 // Include files |
5 #include <smfcontactfetcherplugin.h> |
24 #include <smfcontactfetcherplugin.h> |
8 // Forward declarations |
27 // Forward declarations |
9 class FlickrProviderBase; |
28 class FlickrProviderBase; |
10 class QVariant; |
29 class QVariant; |
11 class QNetworkReply; |
30 class QNetworkReply; |
12 |
31 |
13 // Class declaration |
32 |
|
33 /** |
|
34 * The Plugin that fetches contacts from the logged in user's flickr account |
|
35 */ |
14 class FlickrContactFetcherPlugin : public QObject, public SmfContactFetcherPlugin |
36 class FlickrContactFetcherPlugin : public QObject, public SmfContactFetcherPlugin |
15 { |
37 { |
16 Q_OBJECT |
38 Q_OBJECT |
17 Q_INTERFACES( SmfContactFetcherPlugin SmfPluginBase ) |
39 Q_INTERFACES( SmfContactFetcherPlugin SmfPluginBase ) |
18 |
40 |
19 public: |
41 public: |
|
42 /** |
|
43 * Destructor |
|
44 */ |
20 virtual ~FlickrContactFetcherPlugin( ); |
45 virtual ~FlickrContactFetcherPlugin( ); |
21 |
46 |
22 public: // From SmfContactFetcherPlugin |
47 public: // From SmfContactFetcherPlugin interface |
23 |
48 |
24 /** |
49 /** |
25 * Method to get the list of friends |
50 * Method to get the list of friends |
26 * @param aRequest [out] The request data to be sent to network |
51 * @param aRequest [out] The request data to be sent to network |
27 * @param aPageNum The page to be extracted |
52 * @param aPageNum The page to be extracted |
106 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
131 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
107 */ |
132 */ |
108 SmfPluginError customRequest( SmfPluginRequestData &aRequest, |
133 SmfPluginError customRequest( SmfPluginRequestData &aRequest, |
109 const int &aOperation, QByteArray *aData ); |
134 const int &aOperation, QByteArray *aData ); |
110 |
135 |
111 public: // From SmfPluginBase |
136 public: // From SmfPluginBase interface |
112 /** |
137 /** |
113 * The first method to be called in the plugin that implements this interface. |
138 * The first method to be called in the plugin that implements this interface. |
114 * If this method is not called, plugin may not behave as expected. |
139 * If this method is not called, plugin may not behave as expected. |
115 * Plugins are expected to save the aUtil handle and use and when required. |
140 * Plugins are expected to save the aUtil handle and use and when required. |
116 * @param aUtil The instance of SmfPluginUtil |
141 * @param aUtil The instance of SmfPluginUtil |
123 */ |
148 */ |
124 SmfProviderBase* getProviderInfo( ); |
149 SmfProviderBase* getProviderInfo( ); |
125 |
150 |
126 /** |
151 /** |
127 * Method to get the result for a network request. |
152 * Method to get the result for a network request. |
|
153 * @param aOperation The type of operation to be requested |
128 * @param aTransportResult The result of transport operation |
154 * @param aTransportResult The result of transport operation |
129 * @param aResponse The QByteArray instance containing the network response. |
155 * @param aResponse The QByteArray instance containing the network response. |
130 * The plugins should delete this instance once they have read the |
156 * The plugins should delete this instance once they have read the |
131 * data from it. |
157 * data from it. |
132 * @param aResult [out] An output parameter to the plugin manager.If the |
158 * @param aResult [out] An output parameter to the plugin manager.If the |
138 * postComment(), aResult will be of type bool. |
164 * postComment(), aResult will be of type bool. |
139 * @param aRetType [out] SmfPluginRetType |
165 * @param aRetType [out] SmfPluginRetType |
140 * @param aPageResult [out] The SmfResultPage structure variable |
166 * @param aPageResult [out] The SmfResultPage structure variable |
141 */ |
167 */ |
142 SmfPluginError responseAvailable( |
168 SmfPluginError responseAvailable( |
|
169 const SmfRequestTypeID aOperation, |
143 const SmfTransportResult &aTransportResult, |
170 const SmfTransportResult &aTransportResult, |
144 QByteArray *aResponse, |
171 QByteArray *aResponse, |
145 QVariant* aResult, |
172 QVariant* aResult, |
146 SmfPluginRetType &aRetType, |
173 SmfPluginRetType &aRetType, |
147 SmfResultPage &aPageResult ); |
174 SmfResultPage &aPageResult ); |
150 /** |
177 /** |
151 * Method called by plugins to generate a signature string from a base string |
178 * Method called by plugins to generate a signature string from a base string |
152 * @param aBaseString The base string |
179 * @param aBaseString The base string |
153 * @return The md5 hash of the base string |
180 * @return The md5 hash of the base string |
154 */ |
181 */ |
155 QString generateSignature(const QString aBaseString); |
182 QString generateSignature( const QString aBaseString ); |
156 |
|
157 /** |
|
158 * Method called by plugins for logging |
|
159 * @param log string to be logged |
|
160 */ |
|
161 void writeLog(QString log) const; |
|
162 |
183 |
163 private: |
|
164 /** |
|
165 * Method called by plugins to generate a request data |
|
166 * @param aRequest [out] The request data to be sent to network |
|
167 * @param aOperation The type of http operation |
|
168 * @param aSignatureMethod The signature method to be used |
|
169 * @param aParams A map of parameters to its values |
|
170 * @param aMode The mode of creation of the request |
|
171 * @param aPostData The data to be posted (for HTTP POST |
|
172 * only, else it will be NULL) |
|
173 * @return SmfPluginError Plugin error if any, else SmfPluginErrNone |
|
174 */ |
|
175 SmfPluginError createRequest( SmfPluginRequestData &aRequest, |
|
176 const QNetworkAccessManager::Operation aOperation, |
|
177 const SmfSignatureMethod aSignatureMethod, |
|
178 QMultiMap<QByteArray, QByteArray> &aParams, |
|
179 const SmfParsingMode aMode, |
|
180 QBuffer *aPostData ); |
|
181 |
|
182 private: |
184 private: |
183 FlickrProviderBase *m_provider; |
185 FlickrProviderBase *m_provider; |
184 SmfPluginUtil *m_util; |
186 SmfPluginUtil *m_util; |
185 |
|
186 }; |
187 }; |
187 |
188 |
188 |
189 |
189 // Class declaration |
190 /** |
|
191 * The Plugin class that implements SmfProviderBase for this flickr plugin |
|
192 */ |
190 class FlickrProviderBase : public QObject, public SmfProviderBase |
193 class FlickrProviderBase : public QObject, public SmfProviderBase |
191 { |
194 { |
192 Q_OBJECT |
195 Q_OBJECT |
193 Q_INTERFACES( SmfProviderBase ) |
196 Q_INTERFACES( SmfProviderBase ) |
194 |
197 |
195 public: |
198 public: |
|
199 /** |
|
200 * Destructor |
|
201 */ |
196 virtual ~FlickrProviderBase( ); |
202 virtual ~FlickrProviderBase( ); |
197 |
203 |
198 /** |
204 /** |
199 * Method to get the Localisable name of the service. |
205 * Method to get the Localisable name of the service. |
200 * @return The Localisable name of the service. |
206 * @return The Localisable name of the service. |
228 /** |
234 /** |
229 * Method to get the Icon of the application |
235 * Method to get the Icon of the application |
230 * @return The Icon of the application |
236 * @return The Icon of the application |
231 */ |
237 */ |
232 QImage applicationIcon( ) const; |
238 QImage applicationIcon( ) const; |
|
239 |
|
240 /** |
|
241 * Method to get the list of interfaces that this provider support |
|
242 * @return List of supported Interafces |
|
243 */ |
|
244 QList<QString> supportedInterfaces( ) const; |
|
245 |
|
246 /** |
|
247 * Method to get the list of languages supported by this service provider |
|
248 * @return a QStringList of languages supported by this service |
|
249 * provider in 2 letter ISO 639-1 format. |
|
250 */ |
|
251 QStringList supportedLanguages( ) const; |
233 |
252 |
234 /** |
253 /** |
235 * Method to get the Plugin specific ID |
254 * Method to get the Plugin specific ID |
236 * @return The Plugin specific ID |
255 * @return The Plugin specific ID |
237 */ |
256 */ |
255 * authorised plugins |
274 * authorised plugins |
256 */ |
275 */ |
257 QString smfRegistrationId( ) const; |
276 QString smfRegistrationId( ) const; |
258 |
277 |
259 private: |
278 private: |
|
279 /** |
|
280 * Method that initializes this class. This method should be called |
|
281 * from the initialize() method of the FlickrContactProviderBase class |
|
282 */ |
|
283 void initialize(); |
|
284 |
|
285 private: |
260 friend class FlickrContactFetcherPlugin; |
286 friend class FlickrContactFetcherPlugin; |
261 void initialize(); |
|
262 QString m_serviceName; |
287 QString m_serviceName; |
263 QImage m_serviceIcon; |
288 QImage m_serviceIcon; |
264 QString m_description; |
289 QString m_description; |
265 QUrl m_serviceUrl; |
290 QUrl m_serviceUrl; |
266 QUrl m_applicationUrl; |
291 QUrl m_applicationUrl; |
267 QImage m_applicationIcon; |
292 QImage m_applicationIcon; |
268 QString m_pluginId; |
293 QString m_pluginId; |
269 QString m_authAppId; |
294 QString m_authAppId; |
270 QString m_smfRegToken; |
295 QString m_smfRegToken; |
|
296 QList<QString> m_supportedInterfaces; |
|
297 QStringList m_supportedLangs; |
271 }; |
298 }; |
272 |
299 |
273 #endif /*_FLICKRCONTACTFETCHERPLUGIN_H*/ |
300 #endif /*_FLICKRCONTACTFETCHERPLUGIN_H*/ |