1 /* |
1 /** |
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
2 * Copyright (c) 2010 Sasken Communication Technologies Ltd. |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the "{License}" |
5 * under the terms of the "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "{LicenseUrl}". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html" |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
10 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * Manasij Roy, Nalina Hariharan |
14 * Description: |
14 * |
15 * Interface spefication for posting updates to a social site |
15 * Description: |
16 * |
16 * The SmfEvent class represents an event |
17 */ |
17 * |
|
18 */ |
18 #ifndef SMFPOSTPROVIDER_H |
19 #ifndef SMFPOSTPROVIDER_H |
19 #define SMFPOSTPROVIDER_H |
20 #define SMFPOSTPROVIDER_H |
20 |
21 |
21 #include <QObject> |
22 #include <QObject> |
22 #include <qmobilityglobal.h> |
23 #include <qmobilityglobal.h> |
23 #include <qgeopositioninfo.h> |
24 #include <qgeopositioninfo.h> |
24 |
25 #include <QTextDocument> |
|
26 |
|
27 #include "smfglobal.h" |
25 #include "smfprovider.h" |
28 #include "smfprovider.h" |
26 #include "smfcontact.h" |
29 #include "smfcontact.h" |
|
30 #include "smfplace.h" |
27 |
31 |
28 class SmfProvider; //base-class for service provider |
32 class SmfProvider; //base-class for service provider |
29 class SmfContact; //class for Contact in a social network |
33 class SmfContact; //class for Contact in a social network |
30 |
34 |
31 |
35 |
32 |
36 |
33 /** |
37 /** |
34 * Location info |
38 * class for information (text, image and url) contained in post in social network |
35 */ |
39 * This could be changed to contain html data |
36 typedef QtMobility::QGeoPositionInfo SmfLocationInfo ; |
40 * |
37 class SmfPost; //class for information (text, image and url) contained in post in social network |
41 * For those service provider which supports only string format, @see supportedFormats() |
38 class SmfContactModel; |
42 */ |
39 class SmfStatusData; |
43 class SmfPost : public QTextDocument |
|
44 { |
|
45 Q_OBJECT |
|
46 |
|
47 public: |
|
48 SmfPost ( QObject * parent = 0 ); |
|
49 SmfPost ( const QString & text, QObject * parent = 0 ); |
|
50 |
|
51 private: |
|
52 QString* id; |
|
53 SmfProvider* provider; |
|
54 }; |
|
55 |
|
56 /** |
|
57 * Presence info of the user |
|
58 */ |
|
59 enum SmfAppearenceInfo |
|
60 { |
|
61 ENotSupported, |
|
62 EOnline, |
|
63 EOffline, |
|
64 EBusy, |
|
65 EDoNotDisturb, |
|
66 EAppearOffline, |
|
67 EOther |
|
68 }; |
40 |
69 |
41 //Post lists |
70 //Post lists |
42 typedef QList<SmfPost> SmfPostList; |
71 typedef QList<SmfPost> SmfPostList; |
43 /** |
72 |
|
73 /** |
|
74 * @ingroup smf_client_group |
44 * Interface to post scrap/tweet like info. |
75 * Interface to post scrap/tweet like info. |
45 * Note that branding information for the particular service implementation |
76 * Note that branding information for the particular service implementation |
46 * is available from getProvider() API. See also: |
77 * is available from getProvider() API. See also: |
47 * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description() |
78 * SmfProvider::serviceName(), SmfProvider::serviceIcon(), SmfProvider::description() |
48 * |
79 * |
49 * All of the functionality described here should be implemented by a service |
|
50 * specific plug-in object. |
|
51 * Interface name for SmfPostProvider is org.symbian.smf.client.contact.posts |
80 * Interface name for SmfPostProvider is org.symbian.smf.client.contact.posts |
52 */ |
81 */ |
53 class SMFCLIENT_EXPORT SmfPostProvider : public QObject |
82 class SMFCLIENT_EXPORT SmfPostProvider : public QObject |
54 { |
83 { |
55 Q_OBJECT |
84 Q_OBJECT |
56 |
85 |
57 public: |
86 public: |
58 /** |
87 /** |
59 * Constructs SmfPostProvider. |
88 * Constructs SmfPostProvider. |
60 * @param baseProvider The base provider info |
89 * @param baseProvider The base provider info |
61 * Seeing as this is a plug-in implementation, these will realistically |
90 * Seeing as this is a plug-in implementation, these will realistically |
62 * be generated by SMF factory of some kind |
91 * be generated by SMF factory of some kind |
63 */ |
92 */ |
64 SmfPostProvider(SmfProvider* baseProvider = 0); |
93 SmfPostProvider(SmfProvider* baseProvider); |
65 ~SmfPostProvider(); |
94 ~SmfPostProvider(); |
66 |
95 |
67 /** |
|
68 * Presence info of the user |
|
69 */ |
|
70 enum SmfPresenceInfo |
|
71 { |
|
72 ENotSupported, |
|
73 EOnline, |
|
74 EOffline, |
|
75 EBusy, |
|
76 EDoNotDisturb, |
|
77 EAppearOffline, |
|
78 EOther |
|
79 }; |
|
80 |
96 |
81 public: |
97 public: |
82 /** |
98 /** |
83 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted |
99 * returns maximum no of chars (unicode) that service provider can post without truncation |
84 * once the post lists are available |
100 * negative value means no limit |
85 * @see postsAvailable() |
101 */ |
86 */ |
102 qint32 maxCharsInPost() const; |
87 virtual void getPosts(SmfStatusData statusData) = 0; |
103 /** |
88 |
104 * returns maximum no of items that can be returned in a single query to getPosts |
89 /** |
105 * negative value means feature not supported. |
90 * Gets the model |
106 */ |
91 */ |
107 qint32 maxItems() const; |
92 virtual SmfContactModel model() = 0; |
108 |
|
109 /** |
|
110 * returns all the formatting of posts that this service provider supports. |
|
111 * May return 0 items to mean only QString is supported. |
|
112 */ |
|
113 QVector<QTextFormat> supportedFormats () const; |
|
114 |
|
115 /** |
|
116 * returns whether this SP supports Appearence @see SmfAppearenceInfo |
|
117 */ |
|
118 bool supportsAppearence () const; |
93 |
119 |
94 public slots: |
120 public slots: |
95 |
121 /** |
96 /** |
122 * Gets the posts asynchronously. The signal postsAvailable()with SmfPostList is emitted |
97 * Updates a post, the success of the post can be checked with signal |
123 * once the post lists are available |
|
124 * @param user user's contact in this SP, omit for self contact |
|
125 * @param pageNum Page number to download, SMF_FIRST_PAGE denotes fresh query. |
|
126 * @param perPage Item per page, default is SMF_ITEMS_PER_PAGE |
|
127 * @see postsAvailable() |
|
128 */ |
|
129 void posts(SmfContact* user = 0,int pageNum=SMF_FIRST_PAGE,int perPage=SMF_ITEMS_PER_PAGE); |
|
130 |
|
131 /** |
|
132 * Updates a post to own area, the success of the post can be checked with signal |
98 * updatePostFinished() signal |
133 * updatePostFinished() signal |
99 * @param postData data to be posted |
134 * @param postData data to be posted |
100 * @param location location data |
135 * @param location location data |
101 */ |
136 */ |
102 virtual void updatePost(SmfPost& postData,SmfLocationInfo& location) = 0; // list of contact objects |
137 void post(SmfPost& postData,SmfPlace& location) ; |
103 /** |
138 /** |
104 * Updates a post, the success of the post can be checked with signal |
139 * Updates the last post to own area with new data, the success of the post can be checked with signal |
105 * updatePostFinished() signal |
140 * updatePostFinished() signal |
|
141 * @param postData edited/new data to be posted |
|
142 * @param location location data |
|
143 */ |
|
144 void updatePost(SmfPost& postData); |
|
145 |
|
146 /** |
|
147 * Updates a post to a particular Smf contact. the success of the post can be checked with signal |
|
148 * updatePostFinished() signal. |
106 * @param postData data to be posted |
149 * @param postData data to be posted |
|
150 * @param contact contact to which the post is to be directed |
107 * @param location location data |
151 * @param location location data |
108 */ |
152 */ |
109 virtual void updatePost(SmfPost& postData) = 0; // list of contact objects |
153 void postDirected(SmfPost& postData,SmfContact& contact,SmfPlace* location=0); |
110 |
154 |
111 /** |
155 /** |
112 * Updates a post to a particular Smf contact. the success of the post can be checked with signal |
156 * Posts appearance info of the user.e.g. appear offline, busy, do-not-disturb |
113 * updatePostFinished() signal. |
157 * @param appearence user appearance |
114 * @param postData data to be posted |
158 * @see SmfPresenceInfo |
115 * @param contact contact to which the post is to be directed |
159 * @return False on Failure/Not supported |
116 * @param location location data |
160 */ |
117 */ |
161 bool postAppearence(SmfAppearenceInfo appearence); |
118 virtual void updatePostDirected(SmfPost& postData,SmfContact& contact,SmfLocationInfo location) = 0; // list of contact objects |
162 /** |
119 |
163 * Share /a contact's post to user's friends and followers (e.g. retweet in twitter, share on facebook) |
120 /** |
164 * emits updatePostFinished() signal when done. |
121 * Posts appearance info of the user. |
165 * @param postData data to be posted |
122 * @param appearence user appearance |
166 * @param contact contact to which the post belonged |
123 * @see SmfPresenceInfo |
167 * @param bool whether user changed items within the post |
124 */ |
168 */ |
125 virtual QList<SmfContact> postAppearence(SmfPresenceInfo appearence) = 0; // appear offline, busy, do-not-disturb |
169 void sharePost(SmfPost& postData,SmfContact& contact,bool edited); |
126 |
170 |
127 //APIs to get/set base provider info (SmfProvider) |
171 //APIs to get/set base provider info (SmfProvider) |
128 |
172 |
129 /** |
173 /** |
130 * Gets the base provider info |
174 * Gets the base provider info |
131 */ |
175 */ |
132 virtual SmfProvider* getProvider() = 0; |
176 SmfProvider* getProvider() const; |
133 |
177 |
134 /** |
178 signals: |
135 * Sets the base provider info |
179 |
136 */ |
|
137 virtual void setProvider(SmfProvider* provider) = 0; |
|
138 |
|
139 Q_SIGNALS: |
|
140 |
|
141 /** |
180 /** |
142 * Emitted when a request to getPosts() is finished |
181 * Emitted when a request to getPosts() is finished |
143 * Note if number of posts is large, then it can download the list page by page |
182 * Note if number of posts is large, then it can download the list page by page |
144 * In that case this signal is emitted multiple times. |
183 * In that case this signal is emitted multiple times. |
145 * @param list list of posts |
184 * @param list list of posts |
146 * @param error error string |
185 * @param error error string |
147 * @param pageNumber Page number |
186 * @param resultPage Page number info |
148 */ |
187 */ |
149 void postsAvailable(SmfPostList* list, QString error, int pageNumber=0); |
188 void postsAvailable(SmfPostList* list, QString error, SmfResultPage resultPage); |
150 |
189 |
151 /** |
190 /** |
152 * Emitted when update post is finished. |
191 * Emitted when update post is finished. |
153 * @param success the success of the update |
192 * @param success the success of the update |
154 */ |
193 */ |
155 void updatePostFinished(bool success); |
194 void postFinished(bool success); |
156 |
195 |
157 private: |
196 private: |
158 SmfProvider* m_baseProvider; |
197 SmfProvider* m_baseProvider; |
159 }; |
198 }; |
160 |
199 |
161 SMF_GETSERVICES(SmfPostProvider, "org.symbian.smf.client.contact.posts\0.2") |
200 SMF_SERVICE_NAME(SmfPostProvider, "org.symbian.smf.client.contact.posts\0.2") |
162 #endif // SMFPOSTPROVIDER_H |
201 #endif // SMFPOSTPROVIDER_H |