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 * Manasij Roy |
13 * Manasij Roy, Nalina Hariharan |
14 * Description: |
14 * |
15 * Interface spefication for sfm service provider |
15 * Description: |
16 * |
16 * The post class represents an instance of a post to a SN site |
17 */ |
17 * |
|
18 */ |
18 |
19 |
19 #ifndef SMFPOST_H_ |
20 #ifndef SMFPOST_H_ |
20 #define SMFPOST_H_ |
21 #define SMFPOST_H_ |
21 #include "SmfClientGlobal.h" |
22 |
|
23 #include <QImage> |
|
24 #include <QUrl> |
|
25 #include <qdatastream.h> |
|
26 #include <QSharedData> |
|
27 #include <QTextDocument> |
|
28 #include <smfclientglobal.h> |
|
29 |
|
30 class SmfPostPrivate; |
|
31 |
|
32 |
22 /** |
33 /** |
23 * class for post, later may be we need to add media. |
34 * @ingroup smf_common_group |
24 * Post consists of a title and description |
35 * The post class represents an instance of a post to a SN site |
25 */ |
36 */ |
26 |
37 class SMFCLIENT_EXPORT SmfPost : public QTextDocument |
27 class SMFCLIENT_EXPORT SmfPost : public QObject |
|
28 { |
38 { |
29 Q_OBJECT |
39 Q_OBJECT |
30 public: |
40 public: |
31 /** |
41 /** |
32 * Constructs a post |
42 * Constructor with default argument |
|
43 * @param text Text |
|
44 * @param aParent The parent object |
33 */ |
45 */ |
34 SmfPost(QObject* provider=0); |
46 SmfPost( QString text,QObject *aParent = 0 ); |
35 |
47 |
36 /** |
48 /** |
37 * Constructs a post with text,image and url |
49 * Constructor |
|
50 * @param aText The post's text |
|
51 * @param aImage The post's image |
|
52 * @param aUrl The post's url |
38 */ |
53 */ |
39 SmfPost(QString text,QPixmap image, QString url); |
54 SmfPost( QString aTitle, QString aDesc, QImage aImage, QUrl aUrl ); |
40 ~SmfPost(); |
55 |
|
56 /** |
|
57 * Copy Constructor |
|
58 * @param aOther The reference object |
|
59 */ |
|
60 SmfPost( const SmfPost &aOther ); |
41 |
61 |
42 /** |
62 /** |
43 * Gets post title |
63 * Destructor |
44 */ |
64 */ |
45 QString* getTitle(); |
65 ~SmfPost( ); |
46 |
66 |
47 /** |
67 /** |
48 * Gets post text |
68 * Method to get the title of the post |
|
69 * @return The post's title |
49 */ |
70 */ |
50 QString* getDescription(); |
71 QString title( ) const; |
51 |
72 |
52 /** |
73 /** |
53 * Sets post title |
74 * Method to get the description of the post |
|
75 * @return The post's description |
54 */ |
76 */ |
55 void setTitle(QString* title); |
77 QString description( ) const; |
56 |
78 |
57 /** |
79 /** |
58 * Sets post text |
80 * Method to get the image of the post |
|
81 * @return The post's image |
59 */ |
82 */ |
60 void setDescription(QString* desc); |
83 QImage image( ) const; |
|
84 |
|
85 /** |
|
86 * Method to get the url of the post |
|
87 * @return The post's url |
|
88 */ |
|
89 QUrl url( ) const; |
|
90 |
|
91 /** |
|
92 * Method to get the id of the post |
|
93 * @return The ID value |
|
94 */ |
|
95 QString id( ) const; |
|
96 |
|
97 /** |
|
98 * Method to set the title of the post |
|
99 * @param aTitle The post's new title |
|
100 */ |
|
101 void setTitle( const QString &aTitle ); |
|
102 |
|
103 /** |
|
104 * Method to set the description of the post |
|
105 * @param aDesc The post's new description |
|
106 */ |
|
107 void setDescription( const QString &aDesc ); |
|
108 |
|
109 /** |
|
110 * Method to set the image of the post |
|
111 * @param aPic The post's image |
|
112 */ |
|
113 void setImage( const QImage& aPic ); |
|
114 |
|
115 /** |
|
116 * Method to set the url of the post |
|
117 * @param aUrl The post's url |
|
118 */ |
|
119 void setUrl( QUrl& aUrl ); |
|
120 |
|
121 private: |
|
122 QSharedDataPointer<SmfPostPrivate> d; |
61 |
123 |
62 private: |
124 friend QDataStream &operator<<( QDataStream &aDataStream, |
63 QString m_text; |
125 const SmfPost &aPost ); |
64 QPixmap m_image; |
126 |
65 QString m_url; |
127 friend QDataStream &operator>>( QDataStream &aDataStream, |
|
128 SmfPost &aPost ); |
|
129 |
66 }; |
130 }; |
|
131 |
|
132 |
67 /** |
133 /** |
68 * Externalization |
134 * Method for Externalization. Writes the SmfPost object to |
69 */ |
135 * the stream and returns a reference to the stream. |
70 QDataStream &operator<<(QDataStream &, const SmfPost&); |
136 * @param aDataStream Stream to be written |
|
137 * @param aPost The SmfPost object to be externalized |
|
138 * @return reference to the written stream |
|
139 */ |
|
140 QDataStream &operator<<( QDataStream &aDataStream, |
|
141 const SmfPost &aPost ); |
|
142 |
71 /** |
143 /** |
72 * Internalization |
144 * Method for Internalization. Reads a SmfPost object from |
|
145 * the stream and returns a reference to the stream. |
|
146 * @param aDataStream Stream to be read |
|
147 * @param aPost The SmfPost object to be internalized |
|
148 * @return reference to the stream |
73 */ |
149 */ |
74 QDataStream &operator>>(QDataStream &, SmfPost&); |
150 QDataStream &operator>>( QDataStream &aDataStream, |
|
151 SmfPost &aPost); |
|
152 |
75 #endif /* SMFPOST_H_ */ |
153 #endif /* SMFPOST_H_ */ |