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 post class represents an instance of a post to a SN site |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef SMFPOST_H_ |
|
21 #define SMFPOST_H_ |
|
22 |
|
23 #include <QImage> |
|
24 #include <QUrl> |
|
25 #include <qdatastream.h> |
|
26 #include <QMetaType> |
|
27 #include <QSharedData> |
|
28 #include <QTextDocument> |
|
29 #include <smfclientglobal.h> |
|
30 |
|
31 #include "smfpost_p.h" |
|
32 const int MaxSmfPostSize=1000; |
|
33 /** |
|
34 * Presence info of the user |
|
35 */ |
|
36 enum SmfAppearenceInfo |
|
37 { |
|
38 EAppearanceNotSupported, |
|
39 EOnline, |
|
40 EOffline, |
|
41 EBusy, |
|
42 EDoNotDisturb, |
|
43 EAppearOffline, |
|
44 EOther |
|
45 }; |
|
46 //To sort out conflict betwn client and PM, later should be removed |
|
47 typedef SmfAppearenceInfo SmfPresenceInfo; |
|
48 /** |
|
49 * @ingroup smf_common_group |
|
50 * The post class represents an instance of a post to a SN site |
|
51 */ |
|
52 class SMFCLIENT_EXPORT SmfPost //: public QTextDocument |
|
53 { |
|
54 public: |
|
55 /** |
|
56 * Constructor with default argument |
|
57 * @param text Text |
|
58 */ |
|
59 SmfPost( ); |
|
60 |
|
61 /** |
|
62 * Constructor |
|
63 * @param aOwner Owner of the post(who posted this message) of type SmfContact |
|
64 * @param aText The post's text |
|
65 * @param aImage The post's image |
|
66 * @param aUrl The post's url |
|
67 */ |
|
68 SmfPost(SmfContact aOwner, QString aTitle, QString aDesc, QImage aImage, QUrl aUrl ); |
|
69 |
|
70 /** |
|
71 * Copy Constructor |
|
72 * @param aOther The reference object |
|
73 */ |
|
74 SmfPost( const SmfPost &aOther ); |
|
75 |
|
76 /** |
|
77 * Overloaded = operator |
|
78 * @param aOther The reference object |
|
79 * @return The target reference value |
|
80 */ |
|
81 SmfPost& operator=( const SmfPost &aOther ); |
|
82 |
|
83 /** |
|
84 * Destructor |
|
85 */ |
|
86 ~SmfPost( ); |
|
87 /** |
|
88 * Returns the owner(who posted this message) |
|
89 */ |
|
90 SmfContact owner() const; |
|
91 /** |
|
92 * Method to get the title of the post |
|
93 * @return The post's title |
|
94 */ |
|
95 QString title( ) const; |
|
96 |
|
97 /** |
|
98 * Method to get the description of the post |
|
99 * @return The post's description |
|
100 */ |
|
101 QString description( ) const; |
|
102 |
|
103 /** |
|
104 * Method to get the image of the post |
|
105 * @return The post's image |
|
106 */ |
|
107 QImage image( ) const; |
|
108 |
|
109 /** |
|
110 * Method to get the url of the post |
|
111 * @return The post's url |
|
112 */ |
|
113 QUrl url( ) const; |
|
114 |
|
115 /** |
|
116 * Method to get the id of the post |
|
117 * @return The ID value |
|
118 */ |
|
119 QString id( ) const; |
|
120 /** |
|
121 * sets the owner of the post |
|
122 */ |
|
123 void setOwner(const SmfContact& aOwner); |
|
124 /** |
|
125 * Method to set the title of the post |
|
126 * @param aTitle The post's new title |
|
127 */ |
|
128 void setTitle( const QString &aTitle ); |
|
129 |
|
130 /** |
|
131 * Method to set the description of the post |
|
132 * @param aDesc The post's new description |
|
133 */ |
|
134 void setDescription( const QString &aDesc ); |
|
135 |
|
136 /** |
|
137 * Method to set the image of the post |
|
138 * @param aPic The post's image |
|
139 */ |
|
140 void setImage( const QImage& aPic ); |
|
141 |
|
142 /** |
|
143 * Method to set the url of the post |
|
144 * @param aUrl The post's url |
|
145 */ |
|
146 void setUrl( QUrl& aUrl ); |
|
147 /** |
|
148 * Method to get the id of the post |
|
149 */ |
|
150 void setId(QString aPostId); |
|
151 |
|
152 private: |
|
153 QSharedDataPointer<SmfPostPrivate> d; |
|
154 |
|
155 friend QDataStream &operator<<( QDataStream &aDataStream, |
|
156 const SmfPost &aPost ); |
|
157 |
|
158 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
159 SmfPost &aPost ); |
|
160 |
|
161 }; |
|
162 |
|
163 |
|
164 /** |
|
165 * Method for Externalization. Writes the SmfPost object to |
|
166 * the stream and returns a reference to the stream. |
|
167 * @param aDataStream Stream to be written |
|
168 * @param aPost The SmfPost object to be externalized |
|
169 * @return reference to the written stream |
|
170 */ |
|
171 SMFCLIENT_EXPORT QDataStream &operator<<( QDataStream &aDataStream, |
|
172 const SmfPost &aPost ); |
|
173 |
|
174 /** |
|
175 * Method for Internalization. Reads a SmfPost object from |
|
176 * the stream and returns a reference to the stream. |
|
177 * @param aDataStream Stream to be read |
|
178 * @param aPost The SmfPost object to be internalized |
|
179 * @return reference to the stream |
|
180 */ |
|
181 SMFCLIENT_EXPORT QDataStream &operator>>( QDataStream &aDataStream, |
|
182 SmfPost &aPost); |
|
183 |
|
184 typedef QList<SmfPost> SmfPostList; |
|
185 |
|
186 // Make the class SmfPost known to QMetaType, so that as to register it. |
|
187 Q_DECLARE_METATYPE(SmfPost) |
|
188 Q_DECLARE_METATYPE(SmfPostList) |
|
189 |
|
190 #endif /* SMFPOST_H_ */ |
|