author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 11 Jun 2010 13:35:48 +0300 | |
changeset 34 | 84197e66a4bd |
parent 31 | ebfee66fde93 |
child 43 | 35b64624a9e7 |
permissions | -rw-r--r-- |
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:Message chat View for the messaging application. |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#ifndef MSG_CONVERSATION_VIEW_H |
|
19 |
#define MSG_CONVERSATION_VIEW_H |
|
20 |
||
21 |
// INCLUDES |
|
22 |
#include "msgbaseview.h" |
|
23 |
#include "convergedmessage.h" |
|
24 |
||
25 |
//Forward declarations |
|
26 |
class HbListView; |
|
27 |
class HbAbstractViewItem; |
|
28 |
class MsgSendUtil; |
|
29 |
class QStandardItemModel; |
|
30 |
class MsgEditorWidget; |
|
31 |
class MsgContactCardWidget; |
|
32 |
class MsgConversationViewItem; |
|
33 |
class HbStaticVkbHost; |
|
34 |
class QGraphicsLinearLayout; |
|
35 |
class HbAction; |
|
36 |
//Defines |
|
37 |
#define INVALID_MSG_ID -1 |
|
38 |
||
39 |
/** |
|
40 |
* This class provides the message chat view for the messaging application. |
|
41 |
* Data source for this view is the conversation model. |
|
42 |
*/ |
|
43 |
class MsgConversationView : public MsgBaseView |
|
44 |
{ |
|
45 |
Q_OBJECT |
|
46 |
||
47 |
public: |
|
48 |
||
49 |
/** |
|
50 |
* Constructor |
|
51 |
*/ |
|
52 |
MsgConversationView(MsgContactCardWidget *contactCardWidget, |
|
53 |
QGraphicsItem *parent = 0); |
|
54 |
||
55 |
/** |
|
56 |
* Destructor |
|
57 |
*/ |
|
58 |
~MsgConversationView(); |
|
59 |
||
60 |
||
61 |
/** |
|
62 |
* Clear editors |
|
63 |
* clear message and address editors |
|
64 |
*/ |
|
65 |
void clearEditors(); |
|
66 |
||
67 |
/** |
|
68 |
* Save the content inside editor to drafts |
|
69 |
* @return true if save is success else false. |
|
70 |
*/ |
|
71 |
bool saveContentToDrafts(); |
|
72 |
||
73 |
private slots: |
|
74 |
||
75 |
/** |
|
76 |
* Slot is called when menu is about to be shown. |
|
77 |
* Populates the menu with relevant actions. |
|
78 |
*/ |
|
79 |
void menuAboutToShow(); |
|
80 |
||
81 |
/** |
|
82 |
* This slot is called when settings dialog is launched. |
|
83 |
* @param action selected action (yes or no). |
|
84 |
*/ |
|
85 |
void onDialogSettingsLaunch(HbAction* action); |
|
86 |
||
87 |
/** |
|
88 |
* This slot is called when delete message centre dialog is launched. |
|
89 |
* @param action selected action (yes or no). |
|
90 |
*/ |
|
91 |
void onDialogdeleteMsg(HbAction* action); |
|
92 |
||
93 |
/** |
|
94 |
* This slot is called when download message centre dialog is launched. |
|
95 |
* @param action selected action (yes or no). |
|
96 |
*/ |
|
97 |
void onDialogDownLoadMsg(HbAction* action); |
|
98 |
||
99 |
/** |
|
100 |
* This slot is called when save tone dialog is launched. |
|
101 |
* @param action selected action (yes or no). |
|
102 |
*/ |
|
103 |
void onDialogSaveTone(HbAction* action); |
|
104 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
105 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
106 |
* This slot is called when the orientation is changed |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
107 |
* @param newOrientation orientation |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
108 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
109 |
void onOrientationChanged(Qt::Orientation newOrientation); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
110 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
111 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
112 |
* This slot is called when the orientation is about to bechanged |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
113 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
114 |
void onOrientationAboutToBeChanged(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
115 |
|
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
116 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
117 |
* This slot is called when the view is successfully added to main window |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
118 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
119 |
void onViewReady(); |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
120 |
|
31 | 121 |
private: |
122 |
||
123 |
/** |
|
124 |
* View initialization function. |
|
125 |
*/ |
|
126 |
void setupView(); |
|
127 |
||
128 |
/** |
|
129 |
* Setup view menu items. |
|
130 |
*/ |
|
131 |
void setupMenu(); |
|
132 |
||
133 |
/** |
|
134 |
* Populates ConvergedMessage for sending. |
|
135 |
* @param ConvergedMessage to be populated |
|
136 |
* @see ConvergedMessage::MessageType |
|
137 |
*/ |
|
138 |
void populateForSending(ConvergedMessage &message); |
|
139 |
||
140 |
/** |
|
141 |
* Adds context menu entries to context menu |
|
142 |
* @param HbMenu context menu |
|
143 |
* @param int sendingstate. |
|
144 |
* @see ConvergedMessage::MessageType |
|
145 |
*/ |
|
146 |
void setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
147 |
||
148 |
/** |
|
149 |
* Adds context menu entry to context menu for saving items |
|
150 |
* @param MsgConversationViewItem* item whose information is needed. |
|
151 |
* @param HbMenu context menu |
|
152 |
* @param int sendingstate. |
|
153 |
* @see ConvergedMessage::MessageType |
|
154 |
*/ |
|
155 |
void addSaveItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
156 |
||
157 |
/** |
|
158 |
* Adds context menu entry to context menu for Opening items |
|
159 |
* @param MsgConversationViewItem* item whose information is needed. |
|
160 |
* @param HbMenu context menu |
|
161 |
* @param int sendingstate. |
|
162 |
* @see ConvergedMessage::MessageType |
|
163 |
*/ |
|
164 |
void addOpenItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
165 |
||
166 |
/** |
|
167 |
* Adds context menu entry to context menu for Resending items |
|
168 |
* @param MsgConversationViewItem* item whose information is needed. |
|
169 |
* @param HbMenu context menu |
|
170 |
* @param int sendingstate. |
|
171 |
* @see ConvergedMessage::MessageType |
|
172 |
*/ |
|
173 |
void addResendItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
174 |
||
175 |
/** |
|
176 |
* Adds context menu entry to context menu for Forwarding items |
|
177 |
* @param MsgConversationViewItem* item whose information is needed. |
|
178 |
* @param HbMenu context menu |
|
179 |
* @param int sendingstate. |
|
180 |
* @see ConvergedMessage::MessageType |
|
181 |
*/ |
|
182 |
void addForwardItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
183 |
||
184 |
/** |
|
185 |
* Adds context menu entry to context menu for Deleting items |
|
186 |
* @param MsgConversationViewItem* item whose information is needed. |
|
187 |
* @param HbMenu context menu |
|
188 |
* @param int sendingstate. |
|
189 |
* @see ConvergedMessage::MessageType |
|
190 |
*/ |
|
191 |
void addDeleteItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState); |
|
192 |
||
193 |
/** |
|
194 |
* Adds context menu entry to context menu for Downloading items |
|
195 |
* @param MsgConversationViewItem* item whose information is needed. |
|
196 |
* @param HbMenu context menu |
|
197 |
* @see ConvergedMessage::MessageType |
|
198 |
*/ |
|
199 |
void addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu); |
|
200 |
||
201 |
/** |
|
202 |
* Launches the BT message display service. |
|
203 |
* @param index Index of the item activated/touched |
|
204 |
*/ |
|
205 |
void launchBtDisplayService(const QModelIndex & index); |
|
206 |
||
207 |
public slots: |
|
208 |
/** |
|
209 |
* Refreshes all widgets in the conversation view according to latest model |
|
210 |
* data |
|
211 |
*/ |
|
212 |
void refreshView(); |
|
213 |
||
214 |
private slots: |
|
215 |
||
216 |
/** |
|
217 |
* Utility method to scroll the list to show the bottom most item |
|
218 |
*/ |
|
219 |
void scrollToBottom(); |
|
220 |
||
221 |
/** |
|
222 |
* Handler for long tap of a list item. |
|
223 |
* @param viewItem Long tapped view item |
|
224 |
* @param point X and Y co-ordinates of long tap |
|
225 |
*/ |
|
226 |
void longPressed(HbAbstractViewItem* viewItem, const QPointF& point); |
|
227 |
||
228 |
/** |
|
229 |
* Handler for short tap/direct touch of a list item. |
|
230 |
* @param index index of the item activated/touched |
|
231 |
*/ |
|
232 |
void openItem(const QModelIndex & index); |
|
233 |
||
234 |
/** |
|
235 |
* Sends the message |
|
236 |
*/ |
|
237 |
void send(); |
|
238 |
||
239 |
// ----------------------------- View Specific Menu Slots--------------------// |
|
240 |
||
241 |
||
242 |
/** |
|
243 |
* Fetch images |
|
244 |
*/ |
|
245 |
void fetchImages(); |
|
246 |
||
247 |
/** |
|
248 |
* Fectch conatcts |
|
249 |
*/ |
|
250 |
void fetchContacts(); |
|
251 |
||
252 |
/** |
|
253 |
* Fectch audio |
|
254 |
*/ |
|
255 |
void fetchAudio(); |
|
256 |
||
257 |
/* |
|
258 |
* Get the photos and launch editor |
|
259 |
*/ |
|
260 |
void imagesFetched(const QVariant& result ); |
|
261 |
||
262 |
/** |
|
263 |
* slot to receive fetched contacts for addition |
|
264 |
*/ |
|
265 |
void contactsFetched(const QVariant& value); |
|
266 |
||
267 |
/* |
|
268 |
* Get audio files from audio-fetcher and launch editor |
|
269 |
*/ |
|
270 |
void audiosFetched(const QVariant& result ); |
|
271 |
||
272 |
/** |
|
273 |
* slot to receive fetched contacts for vcard addition |
|
274 |
*/ |
|
275 |
void contactsFetchedForVCards(const QVariant& value); |
|
276 |
||
277 |
/* |
|
278 |
* Adds subject file to editor. |
|
279 |
*/ |
|
280 |
void addSubject(); |
|
281 |
||
282 |
||
283 |
//----------------------Item Specific menu slots ---------------------// |
|
284 |
||
285 |
/** |
|
286 |
* Forwards the message |
|
287 |
*/ |
|
288 |
void forwardMessage(); |
|
289 |
||
290 |
/** |
|
291 |
* Deletes the item |
|
292 |
*/ |
|
293 |
void deleteItem(); |
|
294 |
||
295 |
/** |
|
296 |
* Resends the item. This is only valid in the failed message case. |
|
297 |
*/ |
|
298 |
void resendMessage(); |
|
299 |
||
300 |
/** |
|
301 |
* Download the specified message |
|
302 |
*/ |
|
303 |
void downloadMessage(); |
|
304 |
||
305 |
/** |
|
306 |
* Open the item |
|
307 |
*/ |
|
308 |
void openItem(); |
|
309 |
||
310 |
/** |
|
311 |
* Set model to the view |
|
312 |
*/ |
|
313 |
void populateConversationsView(); |
|
314 |
||
315 |
/** |
|
316 |
* Save ringing tone |
|
317 |
*/ |
|
318 |
void saveRingingTone(); |
|
319 |
||
320 |
/** |
|
321 |
* Launch Editor since sms character limit reached |
|
322 |
*/ |
|
323 |
void handleSmsCharLimitReached(); |
|
324 |
||
325 |
signals: |
|
326 |
/** |
|
327 |
* Signal emitted to inform close the conversation view. |
|
328 |
* When Conversation view has opened in send mode, after sending |
|
329 |
* the message, this signal is emitted. |
|
330 |
*/ |
|
331 |
void closeConversationView(); |
|
332 |
||
333 |
/** |
|
334 |
* Emitted when editor is tapped to reply. |
|
335 |
*/ |
|
336 |
void replyStarted(); |
|
337 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
338 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
339 |
* This signal is emitted when vkb is open/closed. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
340 |
* @param state True if keypad is opened else false. |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
341 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
342 |
void vkbOpened(bool state); |
31 | 343 |
|
344 |
private slots: |
|
345 |
/** |
|
346 |
* Resizes the view when VKB is opened. |
|
347 |
* This slot is triggered when user taps on the CV editor |
|
348 |
*/ |
|
349 |
void vkbOpened(); |
|
350 |
||
351 |
/** |
|
352 |
* Resizes the view when VKB is closed. |
|
353 |
* This slot is triggered when VKB focus is lost. |
|
354 |
*/ |
|
355 |
void vkbClosed(); |
|
356 |
||
357 |
private: |
|
358 |
/** |
|
359 |
* launch editor when attachment is inserted |
|
360 |
* @params data used for launching editor with pre-populated content |
|
361 |
*/ |
|
362 |
void launchUniEditor(const QVariantList& data); |
|
363 |
||
364 |
/** |
|
365 |
* Signal emitted when an error is generated. |
|
366 |
* @param errorCode Error code. |
|
367 |
* @param errorMessage Error description. |
|
368 |
*/ |
|
369 |
void serviceRequestError(int errorCode, const QString& errorMessage); |
|
370 |
||
371 |
/** |
|
372 |
* Activate Input Blocker |
|
373 |
*/ |
|
374 |
void activateInputBlocker(); |
|
375 |
||
376 |
/** |
|
377 |
* Deactivate Input Blocker |
|
378 |
*/ |
|
379 |
void deactivateInputBlocker(); |
|
380 |
||
381 |
/** |
|
382 |
* Handle provisioning message |
|
383 |
* @param msgId message id |
|
384 |
*/ |
|
385 |
void handleProvisoningMsg(int msgId); |
|
386 |
||
387 |
private: |
|
388 |
||
389 |
/** |
|
390 |
* List to hold the conversations |
|
391 |
* Owned |
|
392 |
*/ |
|
393 |
HbListView *mConversationList; |
|
394 |
||
395 |
/** |
|
396 |
* Model to facilitate filtering and sorting |
|
397 |
* Owned |
|
398 |
*/ |
|
399 |
QStandardItemModel *mMessageModel; |
|
400 |
||
401 |
/** |
|
402 |
* Instance of messaged editor widget. |
|
403 |
*/ |
|
404 |
MsgEditorWidget *mEditorWidget; |
|
405 |
||
406 |
/** |
|
407 |
* Instance of Contact Card widget. |
|
408 |
*/ |
|
409 |
MsgContactCardWidget* mContactCardWidget; |
|
410 |
||
411 |
/** |
|
412 |
* Send utils instance |
|
413 |
*/ |
|
414 |
MsgSendUtil *mSendUtil; |
|
415 |
||
416 |
/** |
|
417 |
* Instance of the main layout. |
|
418 |
*/ |
|
419 |
QGraphicsLinearLayout *mMainLayout; |
|
420 |
||
421 |
/* |
|
422 |
* Instance of VKB |
|
423 |
*/ |
|
424 |
HbStaticVkbHost* mVkbHost; |
|
425 |
||
426 |
/** |
|
427 |
* Flag to check it vkb is open. |
|
428 |
*/ |
|
429 |
bool mVkbopened; |
|
430 |
||
34
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
431 |
/** |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
432 |
* variable holding the visible model index |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
433 |
*/ |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
434 |
QModelIndex mVisibleIndex; |
84197e66a4bd
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
31
diff
changeset
|
435 |
|
31 | 436 |
}; |
437 |
||
438 |
#endif // MSG_CONVERSATION_VIEW_H |
|
439 |
// EOF |