|
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 * SmfPostProvider |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFPOSTPROVIDER_H |
|
21 #define SMFPOSTPROVIDER_H |
|
22 |
|
23 #include <QObject> |
|
24 #include <qmobilityglobal.h> |
|
25 #include <qgeopositioninfo.h> |
|
26 #include <QTextDocument> |
|
27 #include <smfglobal.h> |
|
28 #include <smfclientglobal.h> |
|
29 #include <smfprovider.h> |
|
30 #include <smfcontact.h> |
|
31 #include <smflocation.h> |
|
32 #include <smfpost.h> |
|
33 |
|
34 class SmfPostProviderPrivate; |
|
35 |
|
36 /** |
|
37 * @ingroup smf_client_group |
|
38 * Interface to post scrap/tweet like info. |
|
39 * Note that branding information for the particular service implementation |
|
40 * is available from getProvider() API. See also: |
|
41 * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description() |
|
42 * |
|
43 * Interface name for SmfPostProvider is org.symbian.smf.client.contact.posts |
|
44 */ |
|
45 class SMFCLIENT_EXPORT SmfPostProvider : public QObject |
|
46 { |
|
47 Q_OBJECT |
|
48 |
|
49 public: |
|
50 /** |
|
51 * Constructs SmfPostProvider. |
|
52 * @param baseProvider The base provider info |
|
53 * Seeing as this is a plug-in implementation, these will realistically |
|
54 * be generated by SMF factory of some kind |
|
55 */ |
|
56 SmfPostProvider(SmfProvider* baseProvider); |
|
57 |
|
58 /** |
|
59 * Destructor |
|
60 */ |
|
61 ~SmfPostProvider(); |
|
62 |
|
63 public: |
|
64 /** |
|
65 * returns maximum no of chars (unicode) that service provider can post without truncation |
|
66 * negative value means no limit |
|
67 */ |
|
68 qint32 maxCharsInPost() const; |
|
69 |
|
70 /** |
|
71 * returns maximum no of items that can be returned in a single query to getPosts |
|
72 * negative value means feature not supported. |
|
73 */ |
|
74 qint32 maxItems() const; |
|
75 |
|
76 /** |
|
77 * returns all the formatting of posts that this service provider supports. |
|
78 * May return 0 items to mean only QString is supported. |
|
79 */ |
|
80 QVector<QTextFormat> supportedFormats () const; |
|
81 |
|
82 /** |
|
83 * returns whether this SP supports Appearence @see SmfAppearenceInfo |
|
84 */ |
|
85 bool supportsAppearence () const; |
|
86 |
|
87 public slots: |
|
88 /** |
|
89 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted |
|
90 * once the post lists are available |
|
91 * @param user user's contact in this SP, omit for self contact |
|
92 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
93 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
94 * @see postsAvailable() |
|
95 */ |
|
96 void posts(SmfContact* user = 0,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); |
|
97 |
|
98 /** |
|
99 * Updates a post to own area, the success of the post can be checked with signal |
|
100 * updatePostFinished() signal |
|
101 * @param postData data to be posted |
|
102 * @param location location data |
|
103 */ |
|
104 void post(SmfPost& postData,SmfLocation& location); |
|
105 |
|
106 /** |
|
107 * Updates the last post to own area with new data, the success of the post can be checked with signal |
|
108 * updatePostFinished() signal |
|
109 * @param postData edited/new data to be posted |
|
110 * @param location location data |
|
111 */ |
|
112 void updatePost(SmfPost& postData); |
|
113 |
|
114 /** |
|
115 * Updates a post to a particular Smf contact. the success of the post can be checked with signal |
|
116 * updatePostFinished() signal. |
|
117 * @param postData data to be posted |
|
118 * @param contact contact to which the post is to be directed |
|
119 * @param location location data |
|
120 */ |
|
121 void postDirected(SmfPost& postData,SmfContact& contact,SmfLocation* location=0); |
|
122 |
|
123 /** |
|
124 * Method to post a comment on a post. |
|
125 * @param aTarget Post on which comment has to be posted |
|
126 * @param aComment comment to be posted |
|
127 * @param aLocation location data |
|
128 */ |
|
129 void commentOnAPost( SmfPost &aTarget, SmfPost &aComment, SmfLocation *aLocation = NULL); |
|
130 |
|
131 /** |
|
132 * Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb |
|
133 * @param appearence user appearance |
|
134 * @see SmfPresenceInfo |
|
135 * @return False on Failure/Not supported |
|
136 */ |
|
137 bool postAppearence(SmfAppearenceInfo appearence, const QString &status); |
|
138 |
|
139 /** |
|
140 * Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook) |
|
141 * emits updatePostFinished() signal when done. |
|
142 * @param postData data to be posted |
|
143 * @param contact contact to which the post belonged |
|
144 * @param bool whether user changed items within the post |
|
145 */ |
|
146 void sharePost(SmfPost& postData,SmfContact& contact,bool edited); |
|
147 |
|
148 /** |
|
149 * Request for a custom operation. |
|
150 * @param operationId OperationId |
|
151 * @param customData Custom data to be sent |
|
152 * Note:-Interpretation of operationId and customData is upto the concerned |
|
153 * plugin and client application. service provider should provide some |
|
154 * serializing-deserializing utilities for these custom data |
|
155 */ |
|
156 void customRequest(const int& operationId,QByteArray* customData); |
|
157 |
|
158 signals: |
|
159 |
|
160 /** |
|
161 * Emitted when a request to getPosts() is finished |
|
162 * Note if number of posts is large, then it can download the list page by page |
|
163 * In that case this signal is emitted multiple times. |
|
164 * @param list list of posts |
|
165 * @param error error string |
|
166 * @param resultPage Page number info |
|
167 */ |
|
168 void postsAvailable(SmfPostList* list, SmfError error, SmfResultPage resultPage); |
|
169 |
|
170 /** |
|
171 * Emitted when update post is finished. |
|
172 * @param success the success of the update |
|
173 */ |
|
174 void postFinished(SmfError success); |
|
175 |
|
176 /** |
|
177 * Emitted when custom data is available |
|
178 * @param operationId Requested operation id |
|
179 * @param customData Custom data received, interpretation is not the responsibility of Smf |
|
180 */ |
|
181 void customDataAvailable(int operationId, QByteArray* customData); |
|
182 |
|
183 private: |
|
184 /** |
|
185 * Gets the base provider info |
|
186 */ |
|
187 SmfProvider* getProvider() const; |
|
188 |
|
189 // Friend Class |
|
190 //friend so that it can directly emit SmfPostProvider's signal |
|
191 friend class SmfPostProviderPrivate; |
|
192 |
|
193 private: |
|
194 SmfProvider* m_baseProvider; |
|
195 SmfPostProviderPrivate* m_private; //private impl wrapper |
|
196 |
|
197 }; |
|
198 |
|
199 SMF_SERVICE_NAME(SmfPostProvider, "org.symbian.smf.client.contact.posts\0.2") |
|
200 |
|
201 #endif // SMFPOSTPROVIDER_H |