56 #include "unidatamodelplugininterface.h" |
56 #include "unidatamodelplugininterface.h" |
57 #include "ringbc.h" |
57 #include "ringbc.h" |
58 #include "mmsconformancecheck.h" |
58 #include "mmsconformancecheck.h" |
59 #include "msgsettingsview.h" |
59 #include "msgsettingsview.h" |
60 #include "msgaudiofetcherview.h" |
60 #include "msgaudiofetcherview.h" |
|
61 #include "unieditorpluginloader.h" |
|
62 #include "unieditorplugininterface.h" |
61 |
63 |
62 //Item specific menu. |
64 //Item specific menu. |
63 |
65 |
64 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open") |
66 #define LOC_COMMON_OPEN hbTrId("txt_common_menu_open") |
65 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete") |
67 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete") |
67 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download") |
69 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download") |
68 #define LOC_COMMON_SEND hbTrId("txt_common_button_send") |
70 #define LOC_COMMON_SEND hbTrId("txt_common_button_send") |
69 #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") |
71 #define LOC_COMMON_SAVE hbTrId("txt_common_menu_save") |
70 |
72 |
71 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
73 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message") |
|
74 #define LOC_DELETE_SHARED_MESSAGE hbTrId("txt_messaging_dialog_same_message_exists_in_multip") |
72 #define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") |
75 #define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts") |
73 |
76 |
74 //main menu |
77 //main menu |
75 #define LOC_ATTACH hbTrId("txt_messaging_opt_attach") |
78 #define LOC_ATTACH hbTrId("txt_messaging_opt_attach") |
76 #define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo") |
79 #define LOC_PHOTO hbTrId("txt_messaging_opt_attach_sub_photo") |
360 |
363 |
361 |
364 |
362 if( ((direction == ConvergedMessage::Outgoing) && |
365 if( ((direction == ConvergedMessage::Outgoing) && |
363 (messageSubType != ConvergedMessage::VCard))&& |
366 (messageSubType != ConvergedMessage::VCard))&& |
364 ((sendingState == ConvergedMessage::Resend ) || |
367 ((sendingState == ConvergedMessage::Resend ) || |
365 (sendingState == ConvergedMessage::Suspended )|| |
368 |
366 (sendingState == ConvergedMessage::Failed ))) |
369 (sendingState == ConvergedMessage::Failed ))) |
367 { |
370 { |
368 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND); |
371 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SEND); |
369 connect(contextItem, SIGNAL(triggered()),this, SLOT(resendMessage())); |
372 connect(contextItem, SIGNAL(triggered()),this, SLOT(resendMessage())); |
370 } |
373 } |
398 } |
401 } |
399 |
402 |
400 if( ((sendingState == ConvergedMessage::SentState) || |
403 if( ((sendingState == ConvergedMessage::SentState) || |
401 (sendingState == ConvergedMessage::Resend) || |
404 (sendingState == ConvergedMessage::Resend) || |
402 (sendingState == ConvergedMessage::Failed) || |
405 (sendingState == ConvergedMessage::Failed) || |
|
406 (sendingState == ConvergedMessage::Suspended )|| |
403 (direction == ConvergedMessage::Incoming) ) && |
407 (direction == ConvergedMessage::Incoming) ) && |
404 canForwardMessage) |
408 canForwardMessage) |
405 { |
409 { |
406 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD); |
410 HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD); |
407 connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage())); |
411 connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage())); |
729 //--------------------------------------------------------------- |
733 //--------------------------------------------------------------- |
730 // MsgConversationView::deleteItem() |
734 // MsgConversationView::deleteItem() |
731 // Deletes the message |
735 // Deletes the message |
732 //--------------------------------------------------------------- |
736 //--------------------------------------------------------------- |
733 void MsgConversationView::deleteItem() |
737 void MsgConversationView::deleteItem() |
734 { |
738 { |
735 HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)), |
739 QString str = LOC_DELETE_MESSAGE; |
|
740 |
|
741 QModelIndex index = mConversationList->currentIndex(); |
|
742 if(index.isValid()) |
|
743 { |
|
744 int messageType = index.data(MessageType).toInt(); |
|
745 int direction = index.data(Direction).toInt(); |
|
746 |
|
747 if ( direction == ConvergedMessage::Outgoing && |
|
748 messageType == ConvergedMessage::Mms ) |
|
749 { |
|
750 qint32 messageId = index.data(ConvergedMsgId).toLongLong(); |
|
751 |
|
752 if(isSharedMessage(messageId)) |
|
753 { |
|
754 str = LOC_DELETE_SHARED_MESSAGE; |
|
755 } |
|
756 } |
|
757 } |
|
758 |
|
759 |
|
760 HbMessageBox::question(str,this,SLOT(onDialogdeleteMsg(HbAction*)), |
736 HbMessageBox::Delete | HbMessageBox::Cancel); |
761 HbMessageBox::Delete | HbMessageBox::Cancel); |
737 } |
762 } |
738 |
763 |
739 //--------------------------------------------------------------- |
764 //--------------------------------------------------------------- |
740 // MsgConversationView::openItem() |
765 // MsgConversationView::openItem() |
951 } |
976 } |
952 |
977 |
953 // check whether message is in sending progress, then donot launch viewer. |
978 // check whether message is in sending progress, then donot launch viewer. |
954 int location = index.data(MessageLocation).toInt(); |
979 int location = index.data(MessageLocation).toInt(); |
955 int sendingState = index.data(SendingState).toInt(); |
980 int sendingState = index.data(SendingState).toInt(); |
|
981 |
|
982 // For suspended message both short tap and long tap needs to show the same |
|
983 // context menu..... |
|
984 if(direction == ConvergedMessage::Outgoing |
|
985 &&sendingState == ConvergedMessage::Suspended ) |
|
986 { |
|
987 handleShortTap(); |
|
988 return; |
|
989 } |
956 |
990 |
957 //If message is in any other state other than 'Sent' |
991 //If message is in any other state other than 'Sent' |
958 //do not open the message |
992 //do not open the message |
959 if(direction == ConvergedMessage::Outgoing |
993 if(direction == ConvergedMessage::Outgoing |
960 && sendingState != ConvergedMessage::SentState ) |
994 && sendingState != ConvergedMessage::SentState ) |
1444 msgIdList << messageId; |
1478 msgIdList << messageId; |
1445 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
1479 ConversationsEngine::instance()->markMessagesRead(msgIdList); |
1446 } |
1480 } |
1447 } |
1481 } |
1448 } |
1482 } |
|
1483 |
|
1484 //--------------------------------------------------------------- |
|
1485 // MsgConversationView::isSharedMessage |
|
1486 // @see header file |
|
1487 //--------------------------------------------------------------- |
|
1488 bool MsgConversationView::isSharedMessage(qint32 messageId) |
|
1489 { |
|
1490 bool shared = false; |
|
1491 |
|
1492 UniEditorPluginLoader* pluginLoader = new UniEditorPluginLoader(); |
|
1493 |
|
1494 UniEditorPluginInterface* pluginInterface = |
|
1495 pluginLoader->getUniEditorPlugin(ConvergedMessage::Mms); |
|
1496 |
|
1497 ConvergedMessage* msg = pluginInterface->convertFrom(messageId); |
|
1498 if(msg) |
|
1499 { |
|
1500 int count = 0; |
|
1501 count += msg->toAddressList().count(); |
|
1502 count += msg->ccAddressList().count(); |
|
1503 count += msg->bccAddressList().count(); |
|
1504 |
|
1505 if(count > 1) |
|
1506 { |
|
1507 shared = true; |
|
1508 } |
|
1509 |
|
1510 delete msg; |
|
1511 } |
|
1512 |
|
1513 delete pluginLoader; |
|
1514 |
|
1515 return shared; |
|
1516 } |
|
1517 |
1449 // EOF |
1518 // EOF |