31
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "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 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:MsgConversationWidget Widget (aka Bubble Widget).
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MSG_CONVERSATIONWIDGET_H
|
|
19 |
#define MSG_CONVERSATIONWIDGET_H
|
|
20 |
|
|
21 |
// SYSTEM INCLUDES
|
|
22 |
#include <hbwidget.h>
|
|
23 |
|
|
24 |
// FORWORD DECLARATIONS
|
|
25 |
class HbFrameItem;
|
|
26 |
class HbIconItem;
|
|
27 |
class HbTextItem;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* This class represents the custom layouted widget to show
|
|
31 |
* the conversation inside a bubble shape in the conversation view.
|
|
32 |
*/
|
|
33 |
class MsgConversationWidget: public HbWidget
|
|
34 |
{
|
|
35 |
Q_OBJECT
|
|
36 |
|
|
37 |
Q_ENUMS(SendingState)
|
|
38 |
Q_PROPERTY(int priority READ priority WRITE setPriority)
|
|
39 |
Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment)
|
|
40 |
Q_PROPERTY(bool hasImage READ hasImage WRITE setImage)
|
|
41 |
Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio)
|
|
42 |
Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo)
|
|
43 |
Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable)
|
|
44 |
Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
|
|
45 |
Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS)
|
|
46 |
Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification)
|
|
47 |
Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread)
|
|
48 |
Q_PROPERTY(SendingState sendingState READ sendingState WRITE setSendingState)
|
|
49 |
Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState)
|
|
50 |
|
|
51 |
public:
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Constructor
|
|
55 |
* @param parent, reference of QGraphicsItem
|
|
56 |
* default set to 0
|
|
57 |
*/
|
|
58 |
MsgConversationWidget(QGraphicsItem * parent = 0);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor
|
|
62 |
*/
|
|
63 |
virtual ~MsgConversationWidget();
|
|
64 |
|
|
65 |
public:
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Enum defining Message Sending State
|
|
69 |
* @attention This enum can have values from 0 to 255 only.
|
|
70 |
*/
|
|
71 |
enum SendingState
|
|
72 |
{
|
|
73 |
Unknown = 0x00, Sent = 0x01, Sending = 0x02, Pending = 0x03, Failed = 0x04
|
|
74 |
};
|
|
75 |
|
|
76 |
/**
|
|
77 |
* Set subject for this widget
|
|
78 |
* @param QString
|
|
79 |
*/
|
|
80 |
void setSubject(const QString &subject);
|
|
81 |
|
|
82 |
/**
|
|
83 |
* Set body text for this widget
|
|
84 |
* @param QString
|
|
85 |
*/
|
|
86 |
void setBodyText(const QString &bodyText);
|
|
87 |
|
|
88 |
/**
|
|
89 |
* Set preview icon path for this widget
|
|
90 |
* @param QString
|
|
91 |
*/
|
|
92 |
void setPreviewIconPath(const QString& filePath,int msgId);
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Set priority property
|
|
96 |
* @param priority Set high/low/normal priority
|
|
97 |
* @attention Pass high/low/normal priority to this function.
|
|
98 |
* @see ConvergedMessage::Priority
|
|
99 |
*/
|
|
100 |
void setPriority(int priority);
|
|
101 |
|
|
102 |
/**
|
|
103 |
* Get priority property
|
|
104 |
* @return Returns high/low/normal priority.
|
|
105 |
* @see ConvergedMessage::Priority
|
|
106 |
*/
|
|
107 |
int priority();
|
|
108 |
|
|
109 |
/**
|
|
110 |
* Specify if this widget's message has attachment
|
|
111 |
* @param bool
|
|
112 |
*/
|
|
113 |
void setAttachment(bool hasAttachment = true);
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Get to find if this has attachment
|
|
117 |
* @return bool
|
|
118 |
*/
|
|
119 |
bool hasAttachment();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Specify if this widget's message has image
|
|
123 |
* @param bool
|
|
124 |
*/
|
|
125 |
void setImage(bool image = true);
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Get to find if this has image file
|
|
129 |
* @return bool
|
|
130 |
*/
|
|
131 |
bool hasImage();
|
|
132 |
|
|
133 |
/**
|
|
134 |
* Specify if this widget's message has audio
|
|
135 |
* @param bool
|
|
136 |
*/
|
|
137 |
void setAudio(bool hasAudio = true);
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Get to find if this has audio file
|
|
141 |
* @return bool
|
|
142 |
*/
|
|
143 |
bool hasAudio();
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Displays audio icon if audio media is present.
|
|
147 |
*/
|
|
148 |
void displayAudioIcon(const QString &iconPath = QString());
|
|
149 |
|
|
150 |
/**
|
|
151 |
* Specify if this widget's message has video
|
|
152 |
* @param bool
|
|
153 |
*/
|
|
154 |
void setVideo(bool hasVideo = true);
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Get to find if this has video file
|
|
158 |
* @return bool
|
|
159 |
*/
|
|
160 |
bool hasVideo();
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Specify if this widget's message has playable content
|
|
164 |
* @param bool
|
|
165 |
*/
|
|
166 |
void setPlayable(bool playable = true);
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Get to find if this has playable content
|
|
170 |
* @return bool
|
|
171 |
*/
|
|
172 |
bool isPlayable();
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Specify if this widget's message is incoming
|
|
176 |
* @param bool
|
|
177 |
*/
|
|
178 |
void setIncoming(bool incoming = true);
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Get to find if this is incoming message
|
|
182 |
* @return bool
|
|
183 |
*/
|
|
184 |
bool isIncoming();
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Specify if this widget's message is unread
|
|
188 |
* @param bool
|
|
189 |
*/
|
|
190 |
void setUnread(bool unread = true);
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Get to find if this is unread message
|
|
194 |
* @return bool
|
|
195 |
*/
|
|
196 |
bool isUnread();
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Set to know if this widget if of type MMS
|
|
200 |
* @return bool
|
|
201 |
*/
|
|
202 |
void setMMS(bool isMMS = true);
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Get to find if this widget is of type MMS
|
|
206 |
* @return bool
|
|
207 |
*/
|
|
208 |
bool isMMS();
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Set to know if this widget if of type MMS Notification
|
|
212 |
* @return bool
|
|
213 |
*/
|
|
214 |
void setMMSNotification(bool isMMSNotification = true);
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Get to find if this widget is of type MMS Notification
|
|
218 |
* @return bool
|
|
219 |
*/
|
|
220 |
bool isMMSNotification();
|
|
221 |
|
|
222 |
/**
|
|
223 |
* Set the sending state.
|
|
224 |
* Maps ConvergedMessage::SendingState to MessageState.
|
|
225 |
* @see ConvergedMessage::SendingState
|
|
226 |
*/
|
|
227 |
void setSendingState(int state);
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Returns the sending state.
|
|
231 |
* @return Returns one of the states from enum SendingState.
|
|
232 |
*/
|
|
233 |
SendingState sendingState();
|
|
234 |
|
|
235 |
/**
|
|
236 |
* Set the notification state.
|
|
237 |
* Maps ConvergedMessage::NotificationState to MessageState.
|
|
238 |
* @see ConvergedMessage::NotificationState
|
|
239 |
*/
|
|
240 |
void setNotificationState(int state);
|
|
241 |
|
|
242 |
/**
|
|
243 |
* Returns the notification state.
|
|
244 |
* @return Returns one of the states from enum NotificationState.
|
|
245 |
*/
|
|
246 |
int notificationState();
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Sets the Timestamp.
|
|
250 |
* @param timeStamp Timestamp to be set.
|
|
251 |
*/
|
|
252 |
void setTimeStamp(const QString &timeStamp);
|
|
253 |
|
|
254 |
/**
|
|
255 |
* Draws the new message frame.
|
|
256 |
*/
|
|
257 |
void drawNewItemFrame();
|
|
258 |
|
|
259 |
/**
|
|
260 |
* Draws the normal/highlighted state bubble frame.
|
|
261 |
*/
|
|
262 |
void drawBubbleFrame();
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Draws the pressed state bubble frame.
|
|
266 |
*/
|
|
267 |
void drawPressedBubbleFrame();
|
|
268 |
|
|
269 |
/**
|
|
270 |
* Function to receive item pressed events.
|
|
271 |
* @see MsgConversationViewItem::pressStateChanged
|
|
272 |
*/
|
|
273 |
void pressStateChanged(bool pressed, bool animate);
|
|
274 |
|
|
275 |
/**
|
|
276 |
* Function to reset widget items.
|
|
277 |
*/
|
|
278 |
void resetProperties();
|
|
279 |
|
|
280 |
/**
|
|
281 |
* Function to repolish the widget
|
|
282 |
*/
|
|
283 |
void repolishWidget();
|
|
284 |
|
|
285 |
private:
|
|
286 |
|
|
287 |
/**
|
|
288 |
* Initialize the widget.
|
|
289 |
*/
|
|
290 |
void init();
|
|
291 |
|
|
292 |
public:
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Enum defining MMS Notification's Msg State
|
|
296 |
* These are added here so that notification state
|
|
297 |
* can be used inside css in future
|
|
298 |
* @attention This enum can have values from 0 to 255 only
|
|
299 |
* Add any new states only at the bottom of this enum
|
|
300 |
*/
|
|
301 |
enum NotificationState
|
|
302 |
{
|
|
303 |
NotifUnknown = 0x00,
|
|
304 |
NotifReadyForFetching = 0x01,
|
|
305 |
NotifRetrieving = 0x02,
|
|
306 |
NotifExpired = 0x03,
|
|
307 |
NotifFailed = 0x04,
|
|
308 |
};
|
|
309 |
|
|
310 |
private:
|
|
311 |
|
|
312 |
/**
|
|
313 |
* Info if message has attachment.
|
|
314 |
* true if message has attachment else false.
|
|
315 |
*/
|
|
316 |
bool mHasAttachment;
|
|
317 |
|
|
318 |
/**
|
|
319 |
* Info if message has image.
|
|
320 |
* true if message has image else false.
|
|
321 |
*/
|
|
322 |
bool mHasImage;
|
|
323 |
|
|
324 |
/**
|
|
325 |
* Info if message has audio.
|
|
326 |
* true if message has audio else false.
|
|
327 |
*/
|
|
328 |
bool mHasAudio;
|
|
329 |
|
|
330 |
/**
|
|
331 |
* Info if message has video.
|
|
332 |
* true if message has video else false.
|
|
333 |
*/
|
|
334 |
bool mHasVideo;
|
|
335 |
|
|
336 |
/**
|
|
337 |
* Info if message is playable.
|
|
338 |
* true if message is playable else false.
|
|
339 |
*/
|
|
340 |
bool mIsPlayable;
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Info about received or outgoing message.
|
|
344 |
* true if received message else false.
|
|
345 |
*/
|
|
346 |
bool mIncoming;
|
|
347 |
|
|
348 |
/**
|
|
349 |
* Info about message read/unread status.
|
|
350 |
* true if message is unread else false.
|
|
351 |
*/
|
|
352 |
bool mUnread;
|
|
353 |
|
|
354 |
/**
|
|
355 |
* Holds info if this widget is MMS
|
|
356 |
*/
|
|
357 |
bool mIsMMS;
|
|
358 |
|
|
359 |
/**
|
|
360 |
* Holds info if this widget is MMS Notification
|
|
361 |
*/
|
|
362 |
bool mIsMMSNotification;
|
|
363 |
|
|
364 |
/**
|
|
365 |
* Info about message priority.
|
|
366 |
* @attention Stores high/low/normal priority.
|
|
367 |
* @see ConvergedMessage::Priority
|
|
368 |
*/
|
|
369 |
int mPriority;
|
|
370 |
|
|
371 |
/**
|
|
372 |
* Holds sending state information.
|
|
373 |
*/
|
|
374 |
MsgConversationWidget::SendingState mSendingState;
|
|
375 |
|
|
376 |
/**
|
|
377 |
* Holds Notification state information.
|
|
378 |
*/
|
|
379 |
int mNotificationState;
|
|
380 |
|
|
381 |
/**
|
|
382 |
* Graphics Item to hold new message icon.
|
|
383 |
* Owned
|
|
384 |
*/
|
|
385 |
HbFrameItem *mNewFrameItem;
|
|
386 |
|
|
387 |
/**
|
|
388 |
* Graphics Item to hold bubble frame.
|
|
389 |
* Owned
|
|
390 |
*/
|
|
391 |
HbFrameItem *mBubbleFrameItem;
|
|
392 |
|
|
393 |
/**
|
|
394 |
* Graphics Item to hold subject content.
|
|
395 |
* Owned
|
|
396 |
*/
|
|
397 |
HbTextItem *mSubjectTextItem;
|
|
398 |
|
|
399 |
/**
|
|
400 |
* Graphics Item to hold body text content.
|
|
401 |
* Owned
|
|
402 |
*/
|
|
403 |
HbTextItem *mBodyTextItem;
|
|
404 |
|
|
405 |
/**
|
|
406 |
* Graphics Item to hold Time stamp.
|
|
407 |
* Owned
|
|
408 |
*/
|
|
409 |
HbTextItem *mTimeStampTextItem;
|
|
410 |
|
|
411 |
/**
|
|
412 |
* Graphics Item to hold Icon.
|
|
413 |
* Owned
|
|
414 |
*/
|
|
415 |
HbIconItem *mPriorityIconItem;
|
|
416 |
|
|
417 |
/**
|
|
418 |
* Graphics Item to hold Attachment Icon.
|
|
419 |
* Owned
|
|
420 |
*/
|
|
421 |
HbIconItem *mAttachmentIconItem;
|
|
422 |
|
|
423 |
/**
|
|
424 |
* Graphics Item to hold Audio Icon.
|
|
425 |
* Owned
|
|
426 |
*/
|
|
427 |
HbIconItem *mAudioIconItem;
|
|
428 |
|
|
429 |
/**
|
|
430 |
* Graphics Item to hold Video Icon.
|
|
431 |
* Owned
|
|
432 |
*/
|
|
433 |
HbIconItem *mVideoIconItem;
|
|
434 |
|
|
435 |
/**
|
|
436 |
* Graphics Item to hold Play Icon.
|
|
437 |
* Owned
|
|
438 |
*/
|
|
439 |
HbIconItem *mPlayIconItem;
|
|
440 |
|
|
441 |
/**
|
|
442 |
* Graphics Item to hold Preview thumbnail.
|
|
443 |
* Owned
|
|
444 |
*/
|
|
445 |
HbIconItem *mPreviewIconItem;
|
|
446 |
};
|
|
447 |
|
|
448 |
#endif // MSG_CONVERSATIONWIDGET_H
|
|
449 |
// EOF
|