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 |
* 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 SMFCOMMON_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 |
/**
|
|
89 |
* Returns the owner(who posted this message)
|
|
90 |
*/
|
|
91 |
SmfContact owner() const;
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Method to get the title of the post
|
|
95 |
* @return The post's title
|
|
96 |
*/
|
|
97 |
QString title( ) const;
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Method to get the description of the post
|
|
101 |
* @return The post's description
|
|
102 |
*/
|
|
103 |
QString description( ) const;
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Method to get the image of the post
|
|
107 |
* @return The post's image
|
|
108 |
*/
|
|
109 |
QImage image( ) const;
|
|
110 |
|
|
111 |
/**
|
|
112 |
* Method to get the url of the post
|
|
113 |
* @return The post's url
|
|
114 |
*/
|
|
115 |
QUrl url( ) const;
|
|
116 |
|
|
117 |
/**
|
|
118 |
* Method to get the posted date and time of the post
|
|
119 |
* @return The post's date and time of posting
|
|
120 |
*/
|
|
121 |
QDateTime postedDateTime() const;
|
|
122 |
|
|
123 |
/**
|
|
124 |
* Method to get the id of the post
|
|
125 |
* @return The ID value
|
|
126 |
*/
|
|
127 |
QString id( ) const;
|
|
128 |
|
|
129 |
/**
|
|
130 |
* sets the owner of the post
|
|
131 |
*/
|
|
132 |
void setOwner(const SmfContact& aOwner);
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Method to set the title of the post
|
|
136 |
* @param aTitle The post's new title
|
|
137 |
*/
|
|
138 |
void setTitle( const QString &aTitle );
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Method to set the description of the post
|
|
142 |
* @param aDesc The post's new description
|
|
143 |
*/
|
|
144 |
void setDescription( const QString &aDesc );
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Method to set the image of the post
|
|
148 |
* @param aPic The post's image
|
|
149 |
*/
|
|
150 |
void setImage( const QImage& aPic );
|
|
151 |
|
|
152 |
/**
|
|
153 |
* Method to set the url of the post
|
|
154 |
* @param aUrl The post's url
|
|
155 |
*/
|
|
156 |
void setUrl( QUrl& aUrl );
|
|
157 |
|
|
158 |
/**
|
|
159 |
* Method to set the posted date and time of the post
|
|
160 |
* @param aDate The post's date and time of posting
|
|
161 |
*/
|
|
162 |
void setPostedDateTime( QDateTime &aDate );
|
|
163 |
|
|
164 |
/**
|
|
165 |
* Method to get the id of the post
|
|
166 |
*/
|
|
167 |
void setId(QString aPostId);
|
|
168 |
|
|
169 |
private:
|
|
170 |
QSharedDataPointer<SmfPostPrivate> d;
|
|
171 |
|
|
172 |
friend QDataStream &operator<<( QDataStream &aDataStream,
|
|
173 |
const SmfPost &aPost );
|
|
174 |
|
|
175 |
friend QDataStream &operator>>( QDataStream &aDataStream,
|
|
176 |
SmfPost &aPost );
|
|
177 |
|
|
178 |
};
|
|
179 |
|
|
180 |
|
|
181 |
/**
|
|
182 |
* Method for Externalization. Writes the SmfPost object to
|
|
183 |
* the stream and returns a reference to the stream.
|
|
184 |
* @param aDataStream Stream to be written
|
|
185 |
* @param aPost The SmfPost object to be externalized
|
|
186 |
* @return reference to the written stream
|
|
187 |
*/
|
|
188 |
SMFCOMMON_EXPORT QDataStream &operator<<( QDataStream &aDataStream,
|
|
189 |
const SmfPost &aPost );
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Method for Internalization. Reads a SmfPost object from
|
|
193 |
* the stream and returns a reference to the stream.
|
|
194 |
* @param aDataStream Stream to be read
|
|
195 |
* @param aPost The SmfPost object to be internalized
|
|
196 |
* @return reference to the stream
|
|
197 |
*/
|
|
198 |
SMFCOMMON_EXPORT QDataStream &operator>>( QDataStream &aDataStream,
|
|
199 |
SmfPost &aPost);
|
|
200 |
|
|
201 |
typedef QList<SmfPost> SmfPostList;
|
|
202 |
|
|
203 |
// Make the class SmfPost known to QMetaType, so that as to register it.
|
|
204 |
Q_DECLARE_METATYPE(SmfPost)
|
|
205 |
Q_DECLARE_METATYPE(SmfPostList)
|
|
206 |
|
|
207 |
#endif /* SMFPOST_H_ */
|