18
|
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
|
25
|
94 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
95 |
* @see postsAvailable()
|
|
96 |
*/
|
25
|
97 |
SmfError posts(SmfContact* user = 0,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE);
|
18
|
98 |
|
|
99 |
/**
|
|
100 |
* Updates a post to own area, the success of the post can be checked with signal
|
|
101 |
* updatePostFinished() signal
|
|
102 |
* @param postData data to be posted
|
|
103 |
* @param location location data
|
25
|
104 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
105 |
*/
|
25
|
106 |
SmfError post(SmfPost& postData,SmfLocation& location);
|
18
|
107 |
|
|
108 |
/**
|
|
109 |
* Updates the last post to own area with new data, the success of the post can be checked with signal
|
|
110 |
* updatePostFinished() signal
|
|
111 |
* @param postData edited/new data to be posted
|
|
112 |
* @param location location data
|
25
|
113 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
114 |
*/
|
25
|
115 |
SmfError updatePost(SmfPost& postData);
|
18
|
116 |
|
|
117 |
/**
|
|
118 |
* Updates a post to a particular Smf contact. the success of the post can be checked with signal
|
|
119 |
* updatePostFinished() signal.
|
|
120 |
* @param postData data to be posted
|
|
121 |
* @param contact contact to which the post is to be directed
|
25
|
122 |
* @param location location data
|
|
123 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
124 |
*/
|
25
|
125 |
SmfError postDirected(SmfPost& postData,SmfContact& contact,SmfLocation* location=0);
|
18
|
126 |
|
|
127 |
/**
|
|
128 |
* Method to post a comment on a post.
|
|
129 |
* @param aTarget Post on which comment has to be posted
|
|
130 |
* @param aComment comment to be posted
|
|
131 |
* @param aLocation location data
|
25
|
132 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
133 |
*/
|
25
|
134 |
SmfError commentOnAPost( SmfPost &aTarget, SmfPost &aComment, SmfLocation *aLocation = NULL);
|
18
|
135 |
|
|
136 |
/**
|
|
137 |
* Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb
|
|
138 |
* @param appearence user appearance
|
|
139 |
* @see SmfPresenceInfo
|
25
|
140 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
141 |
*/
|
25
|
142 |
SmfError postAppearence(SmfAppearenceInfo appearence, const QString &status);
|
18
|
143 |
|
|
144 |
/**
|
|
145 |
* Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook)
|
|
146 |
* emits updatePostFinished() signal when done.
|
|
147 |
* @param postData data to be posted
|
|
148 |
* @param contact contact to which the post belonged
|
|
149 |
* @param bool whether user changed items within the post
|
25
|
150 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
151 |
*/
|
25
|
152 |
SmfError sharePost(SmfPost& postData,SmfContact& contact,bool edited);
|
18
|
153 |
|
|
154 |
/**
|
|
155 |
* Request for a custom operation.
|
|
156 |
* @param operationId OperationId
|
|
157 |
* @param customData Custom data to be sent
|
25
|
158 |
* @return SmfError. SmfNoError if success, else appropriate error code
|
18
|
159 |
* Note:-Interpretation of operationId and customData is upto the concerned
|
|
160 |
* plugin and client application. service provider should provide some
|
|
161 |
* serializing-deserializing utilities for these custom data
|
|
162 |
*/
|
25
|
163 |
SmfError customRequest(const int& operationId,QByteArray* customData);
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Cancels a request generated due to the call to any API which results
|
|
167 |
* into http request. Might return error if no request is currently pending.
|
|
168 |
* Please note that there can be only one request pending at any point of time
|
|
169 |
* @return Appropriate SmfError value
|
|
170 |
*/
|
|
171 |
SmfError cancelRequest ();
|
18
|
172 |
|
|
173 |
signals:
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Emitted when a request to getPosts() is finished
|
|
177 |
* Note if number of posts is large, then it can download the list page by page
|
|
178 |
* In that case this signal is emitted multiple times.
|
|
179 |
* @param list list of posts
|
|
180 |
* @param error error string
|
|
181 |
* @param resultPage Page number info
|
|
182 |
*/
|
|
183 |
void postsAvailable(SmfPostList* list, SmfError error, SmfResultPage resultPage);
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Emitted when update post is finished.
|
|
187 |
* @param success the success of the update
|
|
188 |
*/
|
|
189 |
void postFinished(SmfError success);
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Emitted when custom data is available
|
|
193 |
* @param operationId Requested operation id
|
|
194 |
* @param customData Custom data received, interpretation is not the responsibility of Smf
|
|
195 |
*/
|
|
196 |
void customDataAvailable(int operationId, QByteArray* customData);
|
|
197 |
|
|
198 |
private:
|
|
199 |
/**
|
|
200 |
* Gets the base provider info
|
|
201 |
*/
|
|
202 |
SmfProvider* getProvider() const;
|
|
203 |
|
|
204 |
// Friend Class
|
|
205 |
//friend so that it can directly emit SmfPostProvider's signal
|
|
206 |
friend class SmfPostProviderPrivate;
|
|
207 |
|
|
208 |
private:
|
|
209 |
SmfProvider* m_baseProvider;
|
|
210 |
SmfPostProviderPrivate* m_private; //private impl wrapper
|
|
211 |
|
|
212 |
};
|
|
213 |
|
|
214 |
SMF_SERVICE_NAME(SmfPostProvider, "org.symbian.smf.client.contact.posts\0.2")
|
|
215 |
|
|
216 |
#endif // SMFPOSTPROVIDER_H
|