50 #include "debugtraces.h" |
54 #include "debugtraces.h" |
51 #include "unidatamodelloader.h" |
55 #include "unidatamodelloader.h" |
52 #include "unidatamodelplugininterface.h" |
56 #include "unidatamodelplugininterface.h" |
53 #include "ringbc.h" |
57 #include "ringbc.h" |
54 #include "mmsconformancecheck.h" |
58 #include "mmsconformancecheck.h" |
|
59 #include "msgsettingsview.h" |
|
60 #include "msgaudiofetcherview.h" |
55 |
61 |
56 //Item specific menu. |
62 //Item specific menu. |
57 |
63 |
58 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open") |
64 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open") |
59 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete") |
65 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete") |
60 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward") |
66 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward") |
61 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download") |
67 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download") |
62 #define LOC_COMMON_SEND hbTrId("txt_common_menu_send") |
68 #define LOC_COMMON_SEND hbTrId("txt_common_button_send") |
63 |
69 #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") |
64 #define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete") |
|
65 #define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel") |
|
66 #define LOC_BUTTON_OK hbTrId("txt_common_button_ok") |
|
67 |
70 |
68 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
71 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
|
72 #define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") |
69 |
73 |
70 //main menu |
74 //main menu |
71 #define LOC_ATTACH hbTrId("txt_messaging_opt_attach") |
75 #define LOC_ATTACH hbTrId("txt_messaging_opt_attach") |
72 #define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo") |
76 #define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo") |
73 #define LOC_SOUND hbTrId("txt_messaging_opt_attach_sub_sound") |
77 #define LOC_SOUND hbTrId("txt_messaging_opt_attach_sub_sound") |
74 #define LOC_VCARD hbTrId("txt_messaging_list_business_card") |
78 #define LOC_VCARD hbTrId("txt_messaging_list_business_card") |
75 #define LOC_ADD_RECIPIENTS hbTrId("txt_messaging_opt_add_recipients") |
79 #define LOC_ADD_RECIPIENTS hbTrId("txt_messaging_opt_add_recipients") |
76 #define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject") |
80 #define LOC_ADD_SUBJECT hbTrId("txt_messaging_opt_add_subject") |
77 |
81 |
78 #define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed") |
82 #define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dialog_message_sending_failed") |
79 |
83 #define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_settings_incomplete") |
80 |
84 #define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone") |
81 const QString PLUGINPATH("conversationviewplugin.dll"); |
85 |
82 |
86 |
83 const int INVALID_MSGID = -1; |
87 const int INVALID_MSGID = -1; |
84 const int INVALID_CONVID = -1; |
88 const int INVALID_CONVID = -1; |
85 const int CONTACT_INSERTION_MODE = 1; |
89 const int CONTACT_INSERTION_MODE = 1; |
86 const int VCARD_INSERTION_MODE = 0; |
90 const int VCARD_INSERTION_MODE = 0; |
95 mConversationList(NULL), |
99 mConversationList(NULL), |
96 mMessageModel(NULL), |
100 mMessageModel(NULL), |
97 mEditorWidget(NULL), |
101 mEditorWidget(NULL), |
98 mContactCardWidget(contactCardWidget), |
102 mContactCardWidget(contactCardWidget), |
99 mSendUtil(NULL), |
103 mSendUtil(NULL), |
100 mItemLongPressed(false), |
|
101 mVkbHost(NULL), |
104 mVkbHost(NULL), |
102 mVkbopened(false) |
105 mVkbopened(false), |
103 { |
106 mVisibleIndex() |
|
107 { |
|
108 connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(onViewReady())); |
104 //create send utils |
109 //create send utils |
105 mSendUtil = new MsgSendUtil(this); |
110 mSendUtil = new MsgSendUtil(this); |
106 //initialize view |
111 //initialize view |
107 setupView(); |
112 setupView(); |
108 setupMenu(); |
113 setupMenu(); |
|
114 |
|
115 connect(ConversationsEngine::instance(), |
|
116 SIGNAL(conversationModelUpdated()), |
|
117 this, |
|
118 SLOT(scrollToBottom())); |
|
119 |
|
120 connect(ConversationsEngine::instance(), |
|
121 SIGNAL(conversationViewEmpty()), |
|
122 this, |
|
123 SLOT(onConversationViewEmpty())); |
109 } |
124 } |
110 |
125 |
111 //--------------------------------------------------------------- |
126 //--------------------------------------------------------------- |
112 // MsgConversationView::~MsgConversationView |
127 // MsgConversationView::~MsgConversationView |
113 // @see header file |
128 // @see header file |
122 //--------------------------------------------------------------- |
137 //--------------------------------------------------------------- |
123 void MsgConversationView::setupView() |
138 void MsgConversationView::setupView() |
124 { |
139 { |
125 // Create HbListView and set properties |
140 // Create HbListView and set properties |
126 mConversationList = new HbListView(); |
141 mConversationList = new HbListView(); |
127 style()->registerPlugin(PLUGINPATH); |
142 if (!HbStyleLoader::registerFilePath(":/layouts")) { |
|
143 QDEBUG_WRITE("ERROR: ConversationView -> HbStyleLoader::registerFilePath"); |
|
144 } |
128 mConversationList->setLayoutName("custom"); |
145 mConversationList->setLayoutName("custom"); |
129 mConversationList->setItemRecycling(true); |
146 mConversationList->setItemRecycling(true); |
130 MsgConversationViewItem *item = new MsgConversationViewItem(this); |
147 MsgConversationViewItem *item = new MsgConversationViewItem(this); |
|
148 HbFrameBackground defaultBackground; |
|
149 defaultBackground.setFrameGraphicsName(QString("")); |
|
150 item->setDefaultFrame(defaultBackground); |
131 mConversationList->setItemPrototype(item); |
151 mConversationList->setItemPrototype(item); |
132 mConversationList->setSelectionMode(HbListView::NoSelection); |
152 mConversationList->setSelectionMode(HbListView::NoSelection); |
133 mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping); |
153 mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping); |
134 mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick); |
154 mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick); |
135 |
155 |
140 this, |
160 this, |
141 SLOT(populateConversationsView())); |
161 SLOT(populateConversationsView())); |
142 |
162 |
143 connect(mConversationList, SIGNAL(activated(QModelIndex)), |
163 connect(mConversationList, SIGNAL(activated(QModelIndex)), |
144 this, SLOT(openItem(QModelIndex))); |
164 this, SLOT(openItem(QModelIndex))); |
|
165 connect(this->mainWindow(), SIGNAL(aboutToChangeOrientation()), |
|
166 this, SLOT(onOrientationAboutToBeChanged())); |
|
167 |
|
168 connect(this->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)), |
|
169 this, SLOT(onOrientationChanged(Qt::Orientation))); |
145 |
170 |
146 // Long tap list item |
171 // Long tap list item |
147 connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)), |
172 connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)), |
148 this, SLOT(longPressed(HbAbstractViewItem*, QPointF))); |
173 this, SLOT(longPressed(HbAbstractViewItem*, QPointF))); |
149 |
174 |
222 const int rowCnt = mMessageModel->rowCount(); |
247 const int rowCnt = mMessageModel->rowCount(); |
223 mConversationList->scrollTo( |
248 mConversationList->scrollTo( |
224 mMessageModel->index(rowCnt - 1, 0)); |
249 mMessageModel->index(rowCnt - 1, 0)); |
225 } |
250 } |
226 |
251 |
|
252 void MsgConversationView::onConversationViewEmpty() |
|
253 { |
|
254 QVariantList param; |
|
255 param << MsgBaseView::CLV; // target view |
|
256 param << MsgBaseView::CV; // source view |
|
257 emit switchView(param); |
|
258 } |
|
259 |
227 //--------------------------------------------------------------- |
260 //--------------------------------------------------------------- |
228 // MsgConversationView::longPressed |
261 // MsgConversationView::longPressed |
229 // @see header file |
262 // @see header file |
230 //--------------------------------------------------------------- |
263 //--------------------------------------------------------------- |
231 void MsgConversationView::longPressed(HbAbstractViewItem* viewItem, |
264 void MsgConversationView::longPressed(HbAbstractViewItem* viewItem, |
232 const QPointF& point) |
265 const QPointF& point) |
233 { |
266 { |
234 mItemLongPressed = true; |
|
235 |
|
236 MsgConversationViewItem* item = qgraphicsitem_cast< |
267 MsgConversationViewItem* item = qgraphicsitem_cast< |
237 MsgConversationViewItem *> (viewItem); |
268 MsgConversationViewItem *> (viewItem); |
238 |
269 |
239 // Show the item-specific menu |
270 // Show the item-specific menu |
240 if (this->isVisible()) |
271 if (this->isVisible()) |
241 { |
272 { |
242 //If message is in Sending state or is Scheduled to be sent later, |
273 //If message is in Sending state or is Scheduled to be sent later, |
243 //do not allow any operations on the message |
274 //do not allow any operations on the message |
244 int sendingState = item->modelIndex().data(SendingState).toInt(); |
275 int sendingState = item->modelIndex().data(SendingState).toInt(); |
|
276 if(sendingState == ConvergedMessage::Scheduled || |
|
277 sendingState == ConvergedMessage::Sending || |
|
278 sendingState == ConvergedMessage::Waiting) |
|
279 { |
|
280 return; |
|
281 } |
245 // Create new menu |
282 // Create new menu |
246 HbMenu* contextMenu = new HbMenu(); |
283 HbMenu* contextMenu = new HbMenu(); |
|
284 contextMenu->setAttribute(Qt::WA_DeleteOnClose); |
|
285 contextMenu->setPreferredPos(point); |
247 setContextMenu(item, contextMenu, sendingState); |
286 setContextMenu(item, contextMenu, sendingState); |
248 |
287 contextMenu->show(); |
249 //Before showing menu reset the flag |
288 |
250 mItemLongPressed = false; |
289 } |
251 contextMenu->exec(point); |
290 |
252 // Cleanup |
|
253 delete contextMenu; |
|
254 |
|
255 } |
|
256 else |
|
257 { |
|
258 // For cases where the long tap check failed |
|
259 mItemLongPressed = false; |
|
260 } |
|
261 } |
291 } |
262 |
292 |
263 //--------------------------------------------------------------- |
293 //--------------------------------------------------------------- |
264 // MsgConversationView::setContextMenu |
294 // MsgConversationView::setContextMenu |
265 // @see header |
295 // @see header |
269 { |
299 { |
270 addOpenItemToContextMenu(item , contextMenu,sendingState); |
300 addOpenItemToContextMenu(item , contextMenu,sendingState); |
271 addResendItemToContextMenu(item, contextMenu, sendingState); |
301 addResendItemToContextMenu(item, contextMenu, sendingState); |
272 addForwardItemToContextMenu(item, contextMenu, sendingState); |
302 addForwardItemToContextMenu(item, contextMenu, sendingState); |
273 addDownloadItemToContextMenu(item, contextMenu); |
303 addDownloadItemToContextMenu(item, contextMenu); |
274 addDeleteItemToContextMenu(item, contextMenu, sendingState); |
304 addDeleteItemToContextMenu(item, contextMenu, sendingState); |
|
305 addSaveItemToContextMenu(item , contextMenu,sendingState); |
|
306 } |
|
307 |
|
308 |
|
309 //--------------------------------------------------------------- |
|
310 // MsgEditorPrivate::addSaveItemToContextMenu |
|
311 // @see header |
|
312 //--------------------------------------------------------------- |
|
313 void MsgConversationView::addSaveItemToContextMenu(MsgConversationViewItem* item, |
|
314 HbMenu* contextMenu, int sendingState) |
|
315 { |
|
316 Q_UNUSED(sendingState) |
|
317 |
|
318 int messageSubType = item->modelIndex().data(MessageSubType).toInt(); |
|
319 int direction = item->modelIndex().data(Direction).toInt(); |
|
320 if ((messageSubType == ConvergedMessage::RingingTone) && |
|
321 (direction == ConvergedMessage::Incoming)) { |
|
322 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SAVE); |
|
323 connect(contextItem, SIGNAL(triggered()), this, SLOT(saveRingingTone())); |
|
324 } |
275 } |
325 } |
276 |
326 |
277 //--------------------------------------------------------------- |
327 //--------------------------------------------------------------- |
278 // MsgEditorPrivate::addOpenItemToContextMenu |
328 // MsgEditorPrivate::addOpenItemToContextMenu |
279 // @see header |
329 // @see header |
289 (messageSubType == ConvergedMessage::RingingTone) || |
339 (messageSubType == ConvergedMessage::RingingTone) || |
290 (messageType == ConvergedMessage::MmsNotification)) |
340 (messageType == ConvergedMessage::MmsNotification)) |
291 { |
341 { |
292 return; |
342 return; |
293 } |
343 } |
294 |
344 if ((messageSubType == ConvergedMessage::VCard) && |
|
345 (direction == ConvergedMessage::Incoming)) |
|
346 { |
|
347 HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS); |
|
348 connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem())); |
|
349 return; |
|
350 } |
295 if( (sendingState == ConvergedMessage::SentState ) || |
351 if( (sendingState == ConvergedMessage::SentState ) || |
296 (sendingState == ConvergedMessage::Resend ) || |
|
297 (sendingState == ConvergedMessage::Failed ) || |
|
298 (direction == ConvergedMessage::Incoming)) |
352 (direction == ConvergedMessage::Incoming)) |
299 { |
353 { |
300 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN); |
354 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN); |
301 connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem())); |
355 connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem())); |
302 } |
356 } |
341 { |
395 { |
342 return; |
396 return; |
343 } |
397 } |
344 |
398 |
345 qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt(); |
399 qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt(); |
|
400 qint32 messageProperty = item->modelIndex().data(MessageProperty).toInt(); |
|
401 |
|
402 bool canForwardMessage = true; |
|
403 if (messageType == ConvergedMessage::Mms){ |
|
404 canForwardMessage = (messageProperty & EPreviewForward)? true:false; |
|
405 } |
346 |
406 |
347 if( ((sendingState == ConvergedMessage::SentState) || |
407 if( ((sendingState == ConvergedMessage::SentState) || |
348 (sendingState == ConvergedMessage::Resend) || |
408 (sendingState == ConvergedMessage::Resend) || |
349 (sendingState == ConvergedMessage::Failed) || |
409 (sendingState == ConvergedMessage::Failed) || |
350 (direction == ConvergedMessage::Incoming) ) && |
410 (direction == ConvergedMessage::Incoming) ) && |
351 (validateMsgForForward(messageType,messageId)) ) |
411 canForwardMessage) |
352 { |
412 { |
353 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD); |
413 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD); |
354 connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage())); |
414 connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage())); |
355 } |
415 } |
356 |
416 |
513 // MsgConversationView::fetchImages |
565 // MsgConversationView::fetchImages |
514 // @see header file |
566 // @see header file |
515 //--------------------------------------------------------------- |
567 //--------------------------------------------------------------- |
516 void MsgConversationView::fetchImages() |
568 void MsgConversationView::fetchImages() |
517 { |
569 { |
518 QString interface("Image"); |
570 QString service("photos"); |
519 QString operation("fetch(QVariantMap,QVariant)"); |
571 QString interface("com.nokia.symbian.IImageFetch"); |
|
572 QString operation("fetch()"); |
520 XQAiwRequest* request = NULL; |
573 XQAiwRequest* request = NULL; |
521 XQApplicationManager appManager; |
574 XQApplicationManager appManager; |
522 request = appManager.create(interface, operation, true);//embedded |
575 request = appManager.create(service,interface, operation, true); // embedded |
|
576 request->setSynchronous(true); // synchronous |
523 if(!request) |
577 if(!request) |
524 { |
578 { |
525 QDEBUG_WRITE("AIW-ERROR: NULL request"); |
579 QDEBUG_WRITE("AIW-ERROR: NULL request"); |
526 return; |
580 return; |
527 } |
581 } |
528 |
582 |
529 connect(request, SIGNAL(requestOk(const QVariant&)), |
583 connect(request, SIGNAL(requestOk(const QVariant&)), |
530 this, SLOT(imagesFetched(const QVariant&))); |
584 this, SLOT(imagesFetched(const QVariant&))); |
531 connect(request, SIGNAL(requestError(int,const QString&)), |
585 connect(request, SIGNAL(requestError(int,const QString&)), |
532 this, SLOT(serviceRequestError(int,const QString&))); |
586 this, SLOT(serviceRequestError(int,const QString&))); |
533 |
587 |
534 // Make the request |
588 // Make the request |
535 if (!request->send()) |
589 if (!request->send()) |
536 { |
590 { |
537 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError()); |
591 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed:" , request->lastError()); |
538 } |
592 } |
543 // MsgConversationView::fetchAudio |
597 // MsgConversationView::fetchAudio |
544 // @see header file |
598 // @see header file |
545 //--------------------------------------------------------------- |
599 //--------------------------------------------------------------- |
546 void MsgConversationView::fetchAudio() |
600 void MsgConversationView::fetchAudio() |
547 { |
601 { |
548 QString service("Music Fetcher"); |
602 // Launch Audio fetcher view |
549 QString interface("com.nokia.services.media.Music"); |
603 QVariantList params; |
550 QString operation("fetch(QString)"); |
604 QByteArray dataArray; |
551 XQAiwRequest* request = NULL; |
605 QDataStream messageStream |
552 XQApplicationManager appManager; |
606 (&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
553 request = appManager.create(service, interface, operation, true); //embedded |
607 |
554 if(!request) |
608 ConvergedMessage message; |
555 { |
609 message.setBodyText(mEditorWidget->content()); |
556 QDEBUG_WRITE("AIW-ERROR: NULL request"); |
610 // add address from contact-card to to-field |
557 return; |
611 ConvergedMessageAddress address; |
558 } |
612 address.setAlias(mContactCardWidget->address().at(0)->alias()); |
559 |
613 address.setAddress(mContactCardWidget->address().at(0)->address()); |
560 connect(request, SIGNAL(requestOk(const QVariant&)), |
614 message.addToRecipient(address); |
561 this, SLOT(audiosFetched(const QVariant&))); |
615 message.serialize(messageStream); |
562 connect(request, SIGNAL(requestError(int,const QString&)), |
616 |
563 this, SLOT(serviceRequestError(int,const QString&))); |
617 params << MsgBaseView::AUDIOFETCHER; // target view |
564 |
618 params << MsgBaseView::CV; // source view |
565 // Make the request |
619 params << dataArray; |
566 if (!request->send()) |
620 emit switchView(params); |
567 { |
|
568 QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed ",request->lastError()); |
|
569 } |
|
570 delete request; |
|
571 } |
621 } |
572 |
622 |
573 //--------------------------------------------------------------- |
623 //--------------------------------------------------------------- |
574 // MsgConversationView::contactsFetched |
624 // MsgConversationView::contactsFetched |
575 // @see header file |
625 // @see header file |
576 //--------------------------------------------------------------- |
626 //--------------------------------------------------------------- |
577 void MsgConversationView::contactsFetched(const QVariant& value) |
627 void MsgConversationView::contactsFetched(const QVariant& value) |
578 { |
628 { |
579 CntServicesContactList contactList; |
629 CntServicesContactList contactList = |
580 contactList = qVariantValue<CntServicesContactList>(value); |
630 qVariantValue<CntServicesContactList>(value); |
581 ConvergedMessageAddressList addresses; |
|
582 int count = contactList.count(); |
631 int count = contactList.count(); |
583 if(count > 0) |
632 if(count > 0) |
584 { |
633 { |
585 ConvergedMessageAddress* address = new ConvergedMessageAddress; |
634 QVariantList params; |
586 address->setAlias(mContactCardWidget->address().at(0)->alias()); |
635 params << MsgBaseView::ADD_RECIPIENTS; |
587 address->setAddress(mContactCardWidget->address().at(0)->address()); |
636 params << value; |
588 addresses.append(address); |
637 launchUniEditor(params); |
589 for(int i = 0; i < contactList.count(); i++ ) |
638 } |
590 { |
|
591 ConvergedMessageAddress* address = new ConvergedMessageAddress; |
|
592 address->setAlias(contactList[i].mDisplayName); |
|
593 address->setAddress(contactList[i].mPhoneNumber); |
|
594 addresses.append(address); |
|
595 } |
|
596 |
|
597 ConvergedMessage message; |
|
598 message.setBodyText(mEditorWidget->content()); |
|
599 message.addToRecipients(addresses);//takes the ownership of list elements |
|
600 QByteArray dataArray; |
|
601 QDataStream messageStream |
|
602 (&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
|
603 message.serialize(messageStream); |
|
604 QVariantList params; |
|
605 params << MsgBaseView::UNIEDITOR; // target view |
|
606 params << MsgBaseView::CV; // source view |
|
607 params << dataArray; |
|
608 clearEditors(); |
|
609 emit switchView(params); |
|
610 } |
|
611 } |
639 } |
612 |
640 |
613 //--------------------------------------------------------------- |
641 //--------------------------------------------------------------- |
614 // MsgConversationView::imagesFetched() |
642 // MsgConversationView::imagesFetched() |
615 // @see header file |
643 // @see header file |
729 // MsgConversationView::deleteItem() |
737 // MsgConversationView::deleteItem() |
730 // Deletes the message |
738 // Deletes the message |
731 //--------------------------------------------------------------- |
739 //--------------------------------------------------------------- |
732 void MsgConversationView::deleteItem() |
740 void MsgConversationView::deleteItem() |
733 { |
741 { |
734 QModelIndex index = mConversationList->currentIndex(); |
742 HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)), |
735 int count = mMessageModel->rowCount(); |
743 HbMessageBox::Delete | HbMessageBox::Cancel); |
736 //delete message |
|
737 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
|
738 |
|
739 bool result = HbMessageBox::question(LOC_DELETE_MESSAGE, |
|
740 LOC_BUTTON_DELETE, |
|
741 LOC_BUTTON_CANCEL); |
|
742 if(result) |
|
743 { |
|
744 if (messageId) |
|
745 { |
|
746 QList<int> msgIdList; |
|
747 msgIdList.append(messageId); |
|
748 ConversationsEngine::instance()->deleteMessages(msgIdList); |
|
749 //switch view |
|
750 if (count == 1) |
|
751 { |
|
752 QVariantList param; |
|
753 param << MsgBaseView::CLV; // target view |
|
754 param << MsgBaseView::CV; // source view |
|
755 emit switchView(param); |
|
756 } |
|
757 } |
|
758 } |
|
759 } |
744 } |
760 |
745 |
761 //--------------------------------------------------------------- |
746 //--------------------------------------------------------------- |
762 // MsgConversationView::openItem() |
747 // MsgConversationView::openItem() |
763 // Opens the message |
748 // Opens the message |
828 //--------------------------------------------------------------- |
813 //--------------------------------------------------------------- |
829 void MsgConversationView::launchBtDisplayService(const QModelIndex & index) |
814 void MsgConversationView::launchBtDisplayService(const QModelIndex & index) |
830 { |
815 { |
831 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
816 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
832 |
817 |
833 QString interface("com.nokia.services.btmsgdispservices.displaymsg"); |
818 QList<QVariant> args; |
|
819 QString serviceName("com.nokia.services.btmsgdispservices"); |
834 QString operation("displaymsg(int)"); |
820 QString operation("displaymsg(int)"); |
835 |
821 XQAiwRequest* request; |
836 XQServiceRequest request(interface, operation, false); |
822 XQApplicationManager appManager; |
837 |
823 request = appManager.create(serviceName, "displaymsg", operation, true); // embedded |
838 request << messageId; |
824 |
839 |
825 if ( request == NULL ) |
840 bool result = request.send(); |
826 { |
|
827 return; |
|
828 } |
|
829 |
|
830 args << QVariant(messageId); |
|
831 |
|
832 request->setArguments(args); |
|
833 request->send(); |
|
834 delete request; |
841 } |
835 } |
842 |
836 |
843 //--------------------------------------------------------------- |
837 //--------------------------------------------------------------- |
844 // MsgConversationView::menuAboutToShow() |
838 // MsgConversationView::menuAboutToShow() |
845 // @See header |
839 // @See header |
875 //--------------------------------------------------------------- |
869 //--------------------------------------------------------------- |
876 //MsgConversationView::openItem |
870 //MsgConversationView::openItem |
877 //@see header |
871 //@see header |
878 //--------------------------------------------------------------- |
872 //--------------------------------------------------------------- |
879 void MsgConversationView::openItem(const QModelIndex & index) |
873 void MsgConversationView::openItem(const QModelIndex & index) |
880 { |
874 { |
881 // Return if invalid index. |
875 // Return if invalid index. |
882 if (!index.isValid() || mVkbopened) |
876 if (!index.isValid() || mVkbopened) |
883 { |
877 { |
884 return; |
878 return; |
885 } |
879 } |
886 |
|
887 if(mItemLongPressed) |
|
888 return; |
|
889 |
880 |
890 int messageType = index.data(MessageType).toInt(); |
881 int messageType = index.data(MessageType).toInt(); |
891 int messageSubType = index.data(MessageSubType).toInt(); |
882 int messageSubType = index.data(MessageSubType).toInt(); |
892 |
883 int messageId = index.data(ConvergedMsgId).toInt(); |
893 if (ConvergedMessage::BioMsg == messageType) { |
884 |
894 if (ConvergedMessage::RingingTone == messageSubType) { |
885 if (ConvergedMessage::BioMsg == messageType) |
895 if (RingBc::askSaveQuery()) { |
886 { |
896 saveRingingTone(); |
887 if (ConvergedMessage::RingingTone == messageSubType) |
|
888 { |
|
889 HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this, |
|
890 SLOT(onDialogSaveTone(HbAction*)), |
|
891 HbMessageBox::Save | HbMessageBox::Cancel); |
|
892 return; |
|
893 } |
|
894 else if(ConvergedMessage::Provisioning == messageSubType) |
|
895 { |
|
896 int messageId = index.data(ConvergedMsgId).toInt(); |
|
897 handleProvisoningMsg(messageId); |
|
898 QList<int> msgIdList; |
|
899 if(index.data(UnReadStatus).toInt()) |
|
900 { |
|
901 msgIdList.clear(); |
|
902 msgIdList << messageId; |
|
903 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
897 } |
904 } |
898 return; |
905 return; |
899 } |
906 } |
900 // Unsupported messages |
907 else if(ConvergedMessage::VCard == messageSubType) |
901 else if (ConvergedMessage::VCard == messageSubType |
908 { |
902 || ConvergedMessage::VCal == messageSubType |
909 QString filepath = index.data(Attachments).toStringList().at(0); |
903 || ConvergedMessage::Provisioning == messageSubType) { |
910 bool result = MsgContactsUtil::launchVCardViewer(filepath); |
|
911 if(result) |
|
912 { |
|
913 |
|
914 int messageId = index.data(ConvergedMsgId).toInt(); |
|
915 QList<int> msgIdList; |
|
916 if(index.data(UnReadStatus).toInt()) |
|
917 { |
|
918 msgIdList.clear(); |
|
919 msgIdList << messageId; |
|
920 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
|
921 } |
|
922 } |
904 return; |
923 return; |
905 } |
924 } |
906 } |
925 else if(ConvergedMessage::VCal == messageSubType) |
907 else if (ConvergedMessage::BT == messageType) { |
926 { |
|
927 return; |
|
928 } |
|
929 } |
|
930 else if (ConvergedMessage::BT == messageType) |
|
931 { |
908 launchBtDisplayService(index); |
932 launchBtDisplayService(index); |
|
933 QList<int> msgIdList; |
|
934 if(index.data(UnReadStatus).toInt()) |
|
935 { |
|
936 msgIdList.clear(); |
|
937 msgIdList << messageId; |
|
938 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
|
939 } |
909 return; |
940 return; |
910 } |
941 } |
911 else if(ConvergedMessage::MmsNotification == messageType) |
942 else if(ConvergedMessage::MmsNotification == messageType) |
912 { |
943 { |
913 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
944 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
921 return; |
952 return; |
922 } |
953 } |
923 else |
954 else |
924 { |
955 { |
925 //TODO: use logical str name |
956 //TODO: use logical str name |
926 if(HbMessageBox::question("Download Message?", |
957 HbMessageBox::question("Download Message?",this, |
927 LOC_COMMON_DOWNLOAD, |
958 SLOT(onDialogDownLoadMsg(HbAction*)), |
928 LOC_BUTTON_CANCEL)) |
959 HbMessageBox::Yes | HbMessageBox::Cancel); |
929 { |
|
930 downloadMessage(); |
|
931 } |
|
932 return; |
960 return; |
933 } |
961 } |
934 } |
962 } |
935 |
963 |
936 ConvergedMessage message; |
964 int direction = index.data(Direction).toInt(); |
|
965 |
|
966 if (direction == ConvergedMessage::Outgoing && ConvergedMessage::Sms == messageType |
|
967 && ConversationsEngine::instance()->getMsgSubType(messageId)== ConvergedMessage::NokiaService) |
|
968 { |
|
969 return; |
|
970 } |
|
971 |
937 // check whether message is in sending progress, then donot launch viewer. |
972 // check whether message is in sending progress, then donot launch viewer. |
938 int location = index.data(MessageLocation).toInt(); |
973 int location = index.data(MessageLocation).toInt(); |
939 int sendingState = index.data(SendingState).toInt(); |
974 int sendingState = index.data(SendingState).toInt(); |
940 |
975 |
941 //If message is in Sending state or is Scheduled to be sent later, |
976 //If message is in any other state other than 'Sent' |
942 //do not open the message |
977 //do not open the message |
943 if(sendingState == ConvergedMessage::Suspended || |
978 if(direction == ConvergedMessage::Outgoing |
944 sendingState == ConvergedMessage::Scheduled || |
979 && sendingState != ConvergedMessage::SentState ) |
945 sendingState == ConvergedMessage::Sending || |
980 |
946 sendingState == ConvergedMessage::Waiting) |
|
947 { |
981 { |
948 return; |
982 return; |
949 } |
983 } |
950 |
984 |
951 //TODO: sendingState check should be removed once msg |
985 |
952 // movement lock issue is resolved from mw |
986 |
953 if( !((location == ConvergedMessage::Inbox) || |
987 // contact Id |
954 (location == ConvergedMessage::Sent) || |
988 qint32 contactId = index.data(ContactId).toLongLong(); |
955 (sendingState == ConvergedMessage::SentState)|| |
989 |
956 (sendingState == ConvergedMessage::Failed) || |
990 //if message unread, mark as read before opening view |
957 (sendingState == ConvergedMessage::Resend))) |
991 QList<int> msgIdList; |
958 {// do not launch viewer, show a note |
992 if(index.data(UnReadStatus).toInt()) |
959 HbNotificationDialog* dlg = new HbNotificationDialog(); |
993 { |
960 dlg->setFocusPolicy(Qt::NoFocus); |
|
961 QString text(tr("Message Locked")); |
|
962 dlg->setText(text); |
|
963 dlg->setDismissPolicy(HbPopup::TapAnywhere); |
|
964 dlg->setAttribute(Qt::WA_DeleteOnClose, true); |
|
965 dlg->show(); |
|
966 return; |
|
967 } |
|
968 |
|
969 // message id |
|
970 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
|
971 ConvergedMessageId msgId(messageId); |
|
972 message.setMessageId(msgId); |
|
973 |
|
974 // contact Id |
|
975 qint32 contactId = index.data(ContactId).toLongLong(); |
|
976 |
|
977 // message type |
|
978 |
|
979 message.setMessageType((ConvergedMessage::MessageType) messageType); |
|
980 message.setMessageSubType((ConvergedMessage::MessageSubType) messageSubType); |
|
981 |
|
982 if (messageType == ConvergedMessage::Mms) |
|
983 { |
|
984 message.setSubject(index.data(Subject).toString()); |
|
985 message.setPriority((ConvergedMessage::Priority) index.data( |
|
986 MessagePriority).toInt()); |
|
987 } |
|
988 else if (messageType == ConvergedMessage::IM) |
|
989 { |
|
990 // add body text and send to the message for IM case |
|
991 message.setBodyText(index.data(BodyText).toString()); |
|
992 } |
|
993 |
|
994 // time stamp |
|
995 message.setTimeStamp(index.data(TimeStamp).toLongLong()); |
|
996 |
|
997 //Message direction |
|
998 message.setDirection((ConvergedMessage::Direction)index.data(Direction).toInt()); |
|
999 |
|
1000 // conatct name as address |
|
1001 ConvergedMessageAddress address; |
|
1002 address.setAlias(mContactCardWidget->address().at(0)->alias()); |
|
1003 address.setAddress(mContactCardWidget->address().at(0)->address()); |
|
1004 message.addToRecipient(address); |
|
1005 |
|
1006 // Mark this message as read if its unread |
|
1007 QByteArray dataArray; |
|
1008 QDataStream messageStream |
|
1009 (&dataArray, QIODevice::WriteOnly | QIODevice::Append); |
|
1010 message.serialize(messageStream); |
|
1011 //if message unread, mark as read before opening view |
|
1012 QList<int> msgIdList; |
|
1013 if(index.data(UnReadStatus).toInt()) |
|
1014 { |
|
1015 msgIdList.clear(); |
994 msgIdList.clear(); |
1016 msgIdList << messageId; |
995 msgIdList << messageId; |
1017 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
996 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
1018 } |
997 } |
1019 |
998 |
1020 //switch view |
999 qint32 messageProperty = index.data(MessageProperty).toInt(); |
1021 QVariantList param; |
1000 |
1022 param << MsgBaseView::UNIVIEWER; // target view |
1001 bool canForwardMessage = true; |
1023 param << MsgBaseView::CV; // source view |
1002 if (messageType == ConvergedMessage::Mms){ |
1024 |
1003 canForwardMessage = (messageProperty & EPreviewForward)? true:false; |
1025 param << contactId; |
1004 } |
1026 param << dataArray; |
1005 |
1027 param << mMessageModel->rowCount(); |
1006 //switch view |
1028 |
1007 QVariantList param; |
1029 emit switchView(param); |
1008 param << MsgBaseView::UNIVIEWER; // target view |
|
1009 param << MsgBaseView::CV; // source view |
|
1010 |
|
1011 param << contactId; |
|
1012 param << messageId; |
|
1013 param << mMessageModel->rowCount(); |
|
1014 if (canForwardMessage == true) |
|
1015 { |
|
1016 param << 1; |
|
1017 } |
|
1018 else |
|
1019 { |
|
1020 param << 0; |
|
1021 } |
|
1022 emit switchView(param); |
1030 } |
1023 } |
1031 |
1024 |
1032 //--------------------------------------------------------------- |
1025 //--------------------------------------------------------------- |
1033 // MsgConversationView::launchUniEditor |
1026 // MsgConversationView::launchUniEditor |
1034 // @see header file |
1027 // @see header file |
1075 { |
1069 { |
1076 // filepath is not sent in cases like VCards & recipients |
1070 // filepath is not sent in cases like VCards & recipients |
1077 // instead, we will get a list of contacts. Pass it as it is. |
1071 // instead, we will get a list of contacts. Pass it as it is. |
1078 data2 = data.at(1); |
1072 data2 = data.at(1); |
1079 } |
1073 } |
|
1074 else if(editorOperation == MsgBaseView::ADD_RECIPIENTS) |
|
1075 { |
|
1076 ConvergedMessageAddressList addresses; |
|
1077 CntServicesContactList contactList = |
|
1078 qVariantValue<CntServicesContactList>(data.at(1)); |
|
1079 // now add fetched contacts from contact selection dialog |
|
1080 for(int i = 0; i < contactList.count(); i++ ) |
|
1081 { |
|
1082 ConvergedMessageAddress* address = new ConvergedMessageAddress; |
|
1083 address->setAlias(contactList[i].mDisplayName); |
|
1084 if(!contactList[i].mPhoneNumber.isEmpty()) |
|
1085 { |
|
1086 address->setAddress(contactList[i].mPhoneNumber); |
|
1087 } |
|
1088 else |
|
1089 { |
|
1090 address->setAddress(contactList[i].mEmailAddress); |
|
1091 } |
|
1092 addresses.append(address); |
|
1093 } |
|
1094 message.addToRecipients(addresses); |
|
1095 } |
1080 } |
1096 } |
1081 else |
1097 else |
1082 { |
1098 { |
1083 qint32 msgId = (qint32)data.at(1).toInt(); |
1099 qint32 msgId = (qint32)data.at(1).toInt(); |
1084 int msgType = data.at(2).toInt(); |
1100 int msgType = data.at(2).toInt(); |
1160 params << MsgBaseView::ADD_OTHERS; |
1171 params << MsgBaseView::ADD_OTHERS; |
1161 launchUniEditor(params); |
1172 launchUniEditor(params); |
1162 } |
1173 } |
1163 |
1174 |
1164 //--------------------------------------------------------------- |
1175 //--------------------------------------------------------------- |
1165 // MsgConversationView::validateMsgForForward |
|
1166 // @see header file |
|
1167 //--------------------------------------------------------------- |
|
1168 bool MsgConversationView::validateMsgForForward(int &messageType, |
|
1169 qint32 &messageId) |
|
1170 { |
|
1171 bool retValue = true; |
|
1172 if (messageType == ConvergedMessage::Mms) |
|
1173 { |
|
1174 //Validate if the mms msg can be forwarded or not |
|
1175 MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck; |
|
1176 retValue = mmsConformanceCheck->validateMsgForForward(messageId); |
|
1177 |
|
1178 delete mmsConformanceCheck; |
|
1179 } |
|
1180 |
|
1181 return retValue; |
|
1182 } |
|
1183 |
|
1184 //--------------------------------------------------------------- |
|
1185 // MsgConversationView::vkbOpened |
1176 // MsgConversationView::vkbOpened |
1186 // @see header file |
1177 // @see header file |
1187 //--------------------------------------------------------------- |
1178 //--------------------------------------------------------------- |
1188 void MsgConversationView::vkbOpened() |
1179 void MsgConversationView::vkbOpened() |
1189 { |
1180 { |
1190 mVkbopened = true; |
1181 mVkbopened = true; |
1191 |
1182 |
1192 mContactCardWidget->connectSignals(false); |
1183 emit vkbOpened(true); |
1193 |
|
1194 emit hideChrome(true); |
|
1195 |
1184 |
1196 QRectF appRect = mVkbHost->applicationArea(); |
1185 QRectF appRect = mVkbHost->applicationArea(); |
1197 qreal spacing = 0.0; |
1186 qreal spacing = 0.0; |
1198 qreal cardHeight = 0.0; |
1187 qreal cardHeight = 0.0; |
1199 if(mContactCardWidget->isVisible()) |
1188 if(mContactCardWidget->isVisible()) |
1235 } |
1224 } |
1236 |
1225 |
1237 //--------------------------------------------------------------- |
1226 //--------------------------------------------------------------- |
1238 // MsgConversationView::activateInputBlocker |
1227 // MsgConversationView::activateInputBlocker |
1239 // @see header file |
1228 // @see header file |
|
1229 //--------------------------------------------------------------- |
|
1230 void MsgConversationView::activateInputBlocker() |
|
1231 { |
|
1232 mainWindow()->setInteractive(false); |
|
1233 } |
|
1234 |
|
1235 //--------------------------------------------------------------- |
|
1236 // MsgConversationView::deactivateInputBlocker |
|
1237 // @see header file |
|
1238 //--------------------------------------------------------------- |
|
1239 void MsgConversationView::deactivateInputBlocker() |
|
1240 { |
|
1241 mainWindow()->setInteractive(true); |
|
1242 } |
|
1243 |
|
1244 //--------------------------------------------------------------- |
|
1245 // MsgConversationView::handleProvisoningMsg |
|
1246 // @see header file |
|
1247 //--------------------------------------------------------------- |
|
1248 void MsgConversationView::handleProvisoningMsg(int msgId) |
|
1249 { |
|
1250 QString messageId; |
|
1251 messageId.setNum(msgId); |
|
1252 |
|
1253 XQApplicationManager* aiwMgr = new XQApplicationManager(); |
|
1254 |
|
1255 XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", |
|
1256 "Provisioning", |
|
1257 "ProcessMessage(QString)", true); // embedded |
|
1258 |
|
1259 if (request) { |
|
1260 QList<QVariant> args; |
|
1261 args << QVariant(messageId); |
|
1262 request->setArguments(args); |
|
1263 |
|
1264 // Send the request |
|
1265 bool res = request->send(); |
|
1266 |
|
1267 // Cleanup |
|
1268 delete request; |
|
1269 } |
|
1270 |
|
1271 delete aiwMgr; |
|
1272 } |
|
1273 |
|
1274 //--------------------------------------------------------------- |
|
1275 // MsgConversationView::onDialogSettingsLaunch |
|
1276 // @see header file |
|
1277 //--------------------------------------------------------------- |
|
1278 void MsgConversationView::onDialogSettingsLaunch(HbAction* action) |
|
1279 { |
|
1280 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
|
1281 if (action == dlg->actions().at(0)) { |
|
1282 //switch to settings view |
|
1283 QVariantList param; |
|
1284 param << MsgBaseView::MSGSETTINGS; |
|
1285 param << MsgBaseView::CV; |
|
1286 param << MsgSettingsView::SMSView; |
|
1287 emit switchView(param); |
|
1288 } |
|
1289 |
|
1290 } |
|
1291 |
|
1292 //--------------------------------------------------------------- |
|
1293 // MsgConversationView::onDialogdeleteMsg |
|
1294 // @see header file |
|
1295 //--------------------------------------------------------------- |
|
1296 void MsgConversationView::onDialogdeleteMsg(HbAction* action) |
|
1297 { |
|
1298 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
|
1299 if (action == dlg->actions().at(0)) { |
|
1300 QModelIndex index = mConversationList->currentIndex(); |
|
1301 if (index.isValid()) { |
|
1302 int count = mMessageModel->rowCount(); |
|
1303 //delete message |
|
1304 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
|
1305 if (messageId) { |
|
1306 QList<int> msgIdList; |
|
1307 msgIdList.append(messageId); |
|
1308 ConversationsEngine::instance()->deleteMessages(msgIdList); |
|
1309 //switch view |
|
1310 if (count == 1) { |
|
1311 QVariantList param; |
|
1312 param << MsgBaseView::CLV; // target view |
|
1313 param << MsgBaseView::CV; // source view |
|
1314 emit switchView(param); |
|
1315 } |
|
1316 } |
|
1317 } |
|
1318 |
|
1319 } |
|
1320 |
|
1321 } |
|
1322 |
|
1323 //--------------------------------------------------------------- |
|
1324 // MsgConversationView::onDialogDownLoadMsg |
|
1325 // @see header file |
1240 //-------------------------------------------------------------- |
1326 //-------------------------------------------------------------- |
1241 void MsgConversationView::activateInputBlocker() |
1327 void MsgConversationView::onDialogDownLoadMsg(HbAction* action) |
1242 { |
1328 { |
1243 this->grabMouse(); |
1329 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
1244 this->grabKeyboard(); |
1330 if (action == dlg->actions().at(0)) { |
1245 } |
1331 downloadMessage(); |
1246 |
1332 } |
1247 //--------------------------------------------------------------- |
1333 } |
1248 // MsgConversationView::deactivateInputBlocker |
1334 |
|
1335 //--------------------------------------------------------------- |
|
1336 // MsgConversationView::onDialogSaveTone |
1249 // @see header file |
1337 // @see header file |
1250 //-------------------------------------------------------------- |
1338 //-------------------------------------------------------------- |
1251 void MsgConversationView::deactivateInputBlocker() |
1339 void MsgConversationView::onDialogSaveTone(HbAction* action) |
1252 { |
1340 { |
1253 this->ungrabKeyboard(); |
1341 HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); |
1254 this->ungrabMouse(); |
1342 if (action == dlg->actions().at(0)) { |
1255 } |
1343 saveRingingTone(); |
1256 |
1344 } |
1257 |
1345 } |
|
1346 |
|
1347 //--------------------------------------------------------------- |
|
1348 // MsgConversationView::onOrientationChanged |
|
1349 // @see header file |
|
1350 //--------------------------------------------------------------- |
|
1351 void MsgConversationView::onOrientationChanged(Qt::Orientation newOrientation) |
|
1352 { |
|
1353 Q_UNUSED(newOrientation) |
|
1354 |
|
1355 // On orientation change always make the preserved index(last visible item) to be visible |
|
1356 if(mVisibleIndex.isValid()) |
|
1357 { |
|
1358 mConversationList->scrollTo(mVisibleIndex, HbAbstractItemView::PositionAtBottom); |
|
1359 mVisibleIndex = QModelIndex(); |
|
1360 } |
|
1361 } |
|
1362 |
|
1363 //--------------------------------------------------------------- |
|
1364 // MsgConversationView::onOrientationAboutToBeChanged |
|
1365 // @see header file |
|
1366 //--------------------------------------------------------------- |
|
1367 void MsgConversationView::onOrientationAboutToBeChanged() |
|
1368 { |
|
1369 // Preserve the model index of the last visible item to be scrolled on orientation change |
|
1370 QList<HbAbstractViewItem *>items = mConversationList->visibleItems(); |
|
1371 if (items.count() > 0) { |
|
1372 mVisibleIndex = items.last()->modelIndex(); |
|
1373 } |
|
1374 } |
|
1375 |
|
1376 //--------------------------------------------------------------- |
|
1377 // MsgConversationView::onViewReady |
|
1378 // @see header file |
|
1379 //--------------------------------------------------------------- |
|
1380 void MsgConversationView::onViewReady() |
|
1381 { |
|
1382 //Disconnect list View's signals, for avoiding execution of the default implementaion |
|
1383 disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0); |
|
1384 disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0); |
|
1385 } |
1258 // EOF |
1386 // EOF |