|
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 * Manasij Roy, Nalina Hariharan |
|
14 * |
|
15 * Description: |
|
16 * The SmfContactFetcher class is for fetching SmfContact related info |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFCONTACTHETCHER_H |
|
21 #define SMFCONTACTHETCHER_H |
|
22 |
|
23 #include <QObject> |
|
24 #include <smfglobal.h> |
|
25 #include <smfcontact.h> |
|
26 #include <smflocation.h> |
|
27 #include <smfgroup.h> |
|
28 |
|
29 // Forward declaration |
|
30 class SmfProvider; //base-class for service provider |
|
31 |
|
32 /** |
|
33 * @ingroup smf_client_group |
|
34 * Interface to search for contacts/connections from a service provider. This class |
|
35 * provides basic functionality to allow applications to obtain list of |
|
36 * contacts or friends in a social networking service. |
|
37 * Note that to get the base provider info like service name, icon, description etc |
|
38 * use getProvider(). |
|
39 * See also: |
|
40 * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description() |
|
41 * |
|
42 * All of the functionality described here should be implemented by a service |
|
43 * specific plug-in object. |
|
44 * Interface name:- org.symbian.smf.client.contact.fetcher |
|
45 */ |
|
46 class SMFCLIENT_EXPORT SmfContactFetcher : public QObject |
|
47 { |
|
48 Q_OBJECT |
|
49 |
|
50 public: |
|
51 /** |
|
52 * Constructs the SmfContactFetcher. |
|
53 * @param parent base provider info |
|
54 * Seeing as this is a plug-in implementation, these will realistically |
|
55 * be generated by SMF factory of some kind |
|
56 */ |
|
57 SmfContactFetcher( SmfProvider* baseProvider ); |
|
58 |
|
59 /** |
|
60 * Constructs the SmfContactFetcher. |
|
61 * @param parent base provider info |
|
62 * @param contact Used for searching friends of the given contact |
|
63 * Seeing as this is a plug-in implementation, these will realistically |
|
64 * be generated by SMF factory of some kind |
|
65 */ |
|
66 SmfContactFetcher( SmfProvider* baseProvider, SmfContact* contact ); |
|
67 |
|
68 /** |
|
69 * Destructor |
|
70 */ |
|
71 ~SmfContactFetcher(); |
|
72 |
|
73 public: |
|
74 /** |
|
75 * Get the friend listing asynchronously. The friendsListAvailable() signal |
|
76 * is emitted with SmfContactList once data is arrived. When the list is big, |
|
77 * user can specify the page number and per page item data. If not supplied |
|
78 * by the user default values are used. |
|
79 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
80 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
81 * @return true if success, else false |
|
82 */ |
|
83 bool friends ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
84 |
|
85 /** |
|
86 * Get the list of followers asynchronously. The followersListAvailable() signal |
|
87 * is emitted with SmfContactList once data is arrived. Please note that some |
|
88 * service may not support followers/fans - FALSE is returned if not supported. |
|
89 * When the list is big user can specify the page number and per page item data. |
|
90 * If not supplied by the user default values are used. |
|
91 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
92 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
93 * @return true if success, else false |
|
94 */ |
|
95 bool followers ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
96 |
|
97 /** |
|
98 * Searches for a contact The searchContactFinished() signal |
|
99 * is emitted with SmfContactList once data is arrived. |
|
100 * When the list is big user can specify the page number and per page item data. |
|
101 * If not supplied by the user default values are used. |
|
102 * @param contact The contact to be searched. The serach criteria must be |
|
103 * set as one of its fields. |
|
104 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
105 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
106 */ |
|
107 void search ( SmfContact* contact, int pageNum = SMF_FIRST_PAGE, |
|
108 int perPage = SMF_ITEMS_PER_PAGE ); |
|
109 |
|
110 /** |
|
111 * Searches for a contacts (friends) who are near the user. The signal |
|
112 * searchNearFinished() is emitted with SmfContactList once data is arrived. |
|
113 * Proximity defines accuracy level. When the list is big user can specify |
|
114 * the page number and per page item data. If not supplied by the user |
|
115 * default values are used. |
|
116 * @param location The location information |
|
117 * @param proximity The search boundary criteria |
|
118 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
119 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
120 */ |
|
121 bool searchNear ( SmfLocation* location, |
|
122 SmfLocationSearchBoundary proximity, |
|
123 int pageNum = SMF_FIRST_PAGE, |
|
124 int perPage = SMF_ITEMS_PER_PAGE); |
|
125 |
|
126 /** |
|
127 * Get the list of groups. The groupListAvailable() signal is emitted with |
|
128 * SmfGroupList once data is arrived. False might be returned if this service |
|
129 * doesn't support any mode of grouping (very rare). When the list is big, |
|
130 * user can specify the page number and per page item data. If not supplied |
|
131 * by the user default values are used. |
|
132 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
133 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
134 */ |
|
135 bool groups ( int pageNum = SMF_FIRST_PAGE, int perPage = SMF_ITEMS_PER_PAGE ); |
|
136 |
|
137 /** |
|
138 * Searches for Smf Contacts in an Smf group. The signal searchInGroupFinished() |
|
139 * is emitted with SmfContactList once data is arrived. When the list is big user |
|
140 * can specify the page number and per page item data. If not supplied by the |
|
141 * user default values are used. |
|
142 * @param group The group to be searched in |
|
143 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
144 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
145 * @return true if success, else false |
|
146 */ |
|
147 bool searchInGroup ( SmfGroup group, |
|
148 int pageNum = SMF_FIRST_PAGE, |
|
149 int perPage = SMF_ITEMS_PER_PAGE ); |
|
150 |
|
151 /** |
|
152 * Request for a custom operation. The signal customDataAvailable() is emitted |
|
153 * when the result is available. |
|
154 * @param operationId OperationId |
|
155 * @param customData Custom data to be sent |
|
156 * Note:-Interpretation of operationId and customData is upto the concerned |
|
157 * plugin and client application. service provider should provide some |
|
158 * serializing-deserializing utilities for these custom data |
|
159 */ |
|
160 void customRequest ( const int& operationId, QByteArray* customData ); |
|
161 |
|
162 signals: |
|
163 |
|
164 /** |
|
165 * This signal is emitted when a request to get friends is completed. |
|
166 * Note if number of friends is large, then it can download the list |
|
167 * page by page. In that case this signal is emitted multiple times. |
|
168 * @param list list of friends. Ownership of memory is transferred. |
|
169 * @param error error value |
|
170 * @param resultPage Page number info |
|
171 * @see friends() |
|
172 */ |
|
173 void friendsListAvailable ( SmfContactList* list, |
|
174 SmfError error, SmfResultPage resultPage ); |
|
175 |
|
176 /** |
|
177 * This signal is emitted when a request to get followers is completed |
|
178 * Note if number of followers is large, then it can download the list |
|
179 * page by page. In that case this signal is emitted multiple times. |
|
180 * @param list list of followers. Ownership of memory is transferred. |
|
181 * @param error error value |
|
182 * @param resultPage Page number info |
|
183 * @see followers() |
|
184 */ |
|
185 void followersListAvailable ( SmfContactList* list, |
|
186 SmfError error, SmfResultPage resultPage ); |
|
187 |
|
188 /** |
|
189 * This signal is emitted when search for a contact is finished. |
|
190 * Note if number of contacts in the search is large, then it can download |
|
191 * the list page by page. In that case this signal is emitted multiple times. |
|
192 * @param list List of filtered contacts. Ownership of memory is transferred. |
|
193 * @param resultPage Page number info |
|
194 * @see search() |
|
195 */ |
|
196 void searchContactFinished ( SmfContactList* list, |
|
197 SmfError error, SmfResultPage resultPage ); |
|
198 |
|
199 /** |
|
200 * Emitted when search for contacts who are near a geographic location, is finished. |
|
201 * Note if number of contacts in the search is large, then it can download the list page by page |
|
202 * In that case this signal is emitted multiple times. |
|
203 * @param list List of filtered contacts. Ownership of memory is transferred. |
|
204 * @param resultPage Page number info |
|
205 * @see search() |
|
206 */ |
|
207 void searchNearFinished(SmfContactList* list,SmfError error, SmfResultPage resultPage); |
|
208 |
|
209 /** |
|
210 * This signal is emitted when a request to get groups is completed |
|
211 * Note if number of groups is large, then it can download the list |
|
212 * page by page. In that case this signal is emitted multiple times. |
|
213 * @param list list of groups. Ownership of memory is transferred. |
|
214 * @param error error value |
|
215 * @param resultPage Page number info |
|
216 * @see groups() |
|
217 */ |
|
218 void groupListAvailable ( SmfGroupList* list, |
|
219 SmfError error, SmfResultPage resultPage ); |
|
220 |
|
221 /** |
|
222 * Emitted when search for a contact in a group is finished |
|
223 * Note if number of contacts in the search is large, then it can download the list page by page |
|
224 * In that case this signal is emitted multiple times. |
|
225 * @param list list of filtered contacts. Ownership of memory is transferred. |
|
226 * @param resultPage Page number info |
|
227 * @see searchInGroup() |
|
228 */ |
|
229 void searchInGroupFinished(SmfContactList* list,SmfError error, SmfResultPage resultPage); |
|
230 |
|
231 /** |
|
232 * Emitted when custom data is available |
|
233 * @param operationId Requested operation id |
|
234 * @param customData Custom data received, interpretation is not the responsibility |
|
235 * of Smf. Ownership of memory is transferred. |
|
236 */ |
|
237 void customDataAvailable ( int operationId, QByteArray* customData ); |
|
238 |
|
239 private: |
|
240 /** |
|
241 * Gets the base provider info |
|
242 */ |
|
243 SmfProvider* getProvider() const; |
|
244 |
|
245 // Friend Class declaration |
|
246 //so that private impl can directly call emit |
|
247 friend class SmfContactFetcherPrivate; |
|
248 |
|
249 private: |
|
250 SmfProvider* m_baseProvider; |
|
251 SmfContact* m_frndContact; //used for searching |
|
252 SmfContactFetcherPrivate* m_private; //private impl wrapper |
|
253 |
|
254 }; |
|
255 |
|
256 SMF_SERVICE_NAME(SmfContactFetcher, "org.symbian.smf.client.contact.fetcher\0.2") |
|
257 |
|
258 #endif // SMFCONTACTHETCHER_H |