75 #include <eikenv.h> |
75 #include <eikenv.h> |
76 #include <smut.h> |
76 #include <smut.h> |
77 #include <smuthdr.h> |
77 #include <smuthdr.h> |
78 #include <mtuireg.h> // CMtmUiRegistry |
78 #include <mtuireg.h> // CMtmUiRegistry |
79 #include <mtmuibas.h> // CBaseMtmUi |
79 #include <mtmuibas.h> // CBaseMtmUi |
80 #include <SendUiConsts.h> |
|
81 #include <sendui.h> // SendUi API |
|
82 #include <CMessageData.h> //CMessageData |
80 #include <CMessageData.h> //CMessageData |
83 #include <apgcli.h> |
81 #include <apgcli.h> |
84 #include <rsendas.h> |
82 #include <rsendas.h> |
85 #include <rsendasmessage.h> |
83 #include <rsendasmessage.h> |
86 #include <cmsvrecipientlist.h> |
84 #include <cmsvrecipientlist.h> |
91 #include <smscmds.h> |
89 #include <smscmds.h> |
92 |
90 |
93 #include <QTextCodec> |
91 #include <QTextCodec> |
94 #include <messagingutil_p.h> |
92 #include <messagingutil_p.h> |
95 |
93 |
|
94 #ifdef QTHIGHWAYUSED |
|
95 #include <xqaiwdecl.h> |
|
96 #include <xqaiwdeclplat.h> |
|
97 #include <xqaiwrequest.h> |
|
98 #include <xqservicerequest.h> |
|
99 |
|
100 #include <email_services_api.h> |
|
101 #else |
|
102 #include <SendUiConsts.h> |
|
103 #include <sendui.h> // SendUi API |
|
104 #endif |
96 |
105 |
97 QTM_BEGIN_NAMESPACE |
106 QTM_BEGIN_NAMESPACE |
98 |
107 |
99 const TInt KWaitAfterReceivedMessage = 100000; // = 0.1 seconds |
108 const TInt KWaitAfterReceivedMessage = 100000; // = 0.1 seconds |
100 #define KDocumentsEntryIdValue 0x1008 |
109 #define KDocumentsEntryIdValue 0x1008 |
779 } |
788 } |
780 |
789 |
781 return retVal; |
790 return retVal; |
782 } |
791 } |
783 |
792 |
|
793 #ifdef QTHIGHWAYUSED |
|
794 bool CMTMEngine::composeSMSL(const QMessage &message) |
|
795 { |
|
796 bool embedded = false; |
|
797 XQAiwRequest* request = iAiwMgr.create("com.nokia.symbian.IMessageSend", |
|
798 "send(QVariantMap, QString)", |
|
799 embedded); |
|
800 QMap<QString, QVariant> map; |
|
801 foreach (QMessageAddress recipient,message.to()) { |
|
802 map.insert(recipient.addressee(), QString("")); |
|
803 } |
|
804 QList<QVariant> data; |
|
805 data.append(map); |
|
806 data.append(message.textContent()); |
|
807 request->setArguments(data); |
|
808 request->send(); |
|
809 return true; |
|
810 } |
|
811 #else |
784 bool CMTMEngine::composeSMSL(const QMessage &message) |
812 bool CMTMEngine::composeSMSL(const QMessage &message) |
785 { |
813 { |
786 CSendUi *sendUi = CSendUi::NewL(); |
814 CSendUi *sendUi = CSendUi::NewL(); |
787 CleanupStack::PushL(sendUi); |
815 CleanupStack::PushL(sendUi); |
788 CMessageData* messageData = CMessageData::NewLC(); |
816 CMessageData* messageData = CMessageData::NewLC(); |
809 ipRichText->InsertL(pos, ptr); |
837 ipRichText->InsertL(pos, ptr); |
810 messageData->SetBodyTextL(ipRichText); |
838 messageData->SetBodyTextL(ipRichText); |
811 |
839 |
812 sendUi->CreateAndSendMessageL(KSenduiMtmSmsUid, messageData, KNullUid, ETrue); |
840 sendUi->CreateAndSendMessageL(KSenduiMtmSmsUid, messageData, KNullUid, ETrue); |
813 CleanupStack::PopAndDestroy(3); //bd, messageData and sendUi |
841 CleanupStack::PopAndDestroy(3); //bd, messageData and sendUi |
|
842 |
814 return true; |
843 return true; |
815 } |
844 } |
|
845 |
|
846 #endif |
|
847 #ifdef QTHIGHWAYUSED |
|
848 |
|
849 bool CMTMEngine::composeMMSL(const QMessage &message) |
|
850 { |
|
851 bool embedded = false; |
|
852 |
|
853 XQAiwRequest* request = iAiwMgr.create("com.nokia.symbian.IMessageSend", |
|
854 "send(QVariantMap, QString)", |
|
855 embedded); |
|
856 |
|
857 QMap<QString, QVariant> map; |
|
858 |
|
859 foreach (QMessageAddress recipient,message.to()) { |
|
860 map.insert(recipient.addressee(), QString("")); |
|
861 } |
|
862 |
|
863 QList<QVariant> data; |
|
864 data.append(map); |
|
865 data.append(message.textContent()); |
|
866 request->setArguments(data); |
|
867 |
|
868 request->send(); |
|
869 |
|
870 return true; |
|
871 } |
|
872 |
|
873 #else |
816 |
874 |
817 bool CMTMEngine::composeMMSL(const QMessage &message) |
875 bool CMTMEngine::composeMMSL(const QMessage &message) |
818 { |
876 { |
819 CSendUi *sendUi = CSendUi::NewL(); |
877 CSendUi *sendUi = CSendUi::NewL(); |
820 CleanupStack::PushL(sendUi); |
878 CleanupStack::PushL(sendUi); |
882 sendUi->CreateAndSendMessageL(KSenduiMtmMmsUid, messageData, KNullUid, ETrue); |
940 sendUi->CreateAndSendMessageL(KSenduiMtmMmsUid, messageData, KNullUid, ETrue); |
883 CleanupStack::PopAndDestroy(2); //messageData and sendUi |
941 CleanupStack::PopAndDestroy(2); //messageData and sendUi |
884 return true; |
942 return true; |
885 } |
943 } |
886 |
944 |
|
945 #endif |
|
946 #ifdef QTHIGHWAYUSED |
|
947 |
|
948 bool CMTMEngine::composeEmailL(const QMessage &message) |
|
949 { |
|
950 bool embedded = false; |
|
951 |
|
952 XQAiwRequest* request = iAiwMgr.create(XQI_EMAIL_MESSAGE_SEND, |
|
953 "send(QVariant)",//XQOP_EMAIL_MESSAGE_SEND, |
|
954 embedded); |
|
955 |
|
956 QMap<QString,QVariant> map; |
|
957 |
|
958 // Add receivers |
|
959 QStringList toRecipients; |
|
960 QStringList ccRecipients; |
|
961 QStringList bccRecipients; |
|
962 |
|
963 foreach(QMessageAddress address, message.to()) |
|
964 toRecipients.append(address.addressee()); |
|
965 |
|
966 foreach(QMessageAddress address, message.cc()) |
|
967 ccRecipients.append(address.addressee()); |
|
968 |
|
969 foreach(QMessageAddress address, message.bcc()) |
|
970 bccRecipients.append(address.addressee()); |
|
971 |
|
972 map.insert(emailSendToKey, toRecipients); |
|
973 map.insert(emailSendCcKey, ccRecipients); |
|
974 map.insert(emailSendBccKey, bccRecipients); |
|
975 map.insert(emailSendSubjectKey, message.subject()); |
|
976 |
|
977 map.insert(emailSendBodyTextKey, message.textContent()); |
|
978 |
|
979 QList<QVariant> data; |
|
980 data.append(map); |
|
981 request->setArguments(data); |
|
982 |
|
983 bool res = request->send(); |
|
984 |
|
985 return res; |
|
986 } |
|
987 |
|
988 #else |
|
989 |
887 bool CMTMEngine::composeEmailL(const QMessage &message) |
990 bool CMTMEngine::composeEmailL(const QMessage &message) |
888 { |
991 { |
889 CSendUi *sendUi = CSendUi::NewL(); |
992 CSendUi *sendUi = CSendUi::NewL(); |
890 CleanupStack::PushL(sendUi); |
993 CleanupStack::PushL(sendUi); |
891 CMessageData* messageData = CMessageData::NewLC(); |
994 CMessageData* messageData = CMessageData::NewLC(); |
968 |
1071 |
969 sendUi->CreateAndSendMessageL(KSenduiMtmSmtpUid, messageData, KNullUid, ETrue); |
1072 sendUi->CreateAndSendMessageL(KSenduiMtmSmtpUid, messageData, KNullUid, ETrue); |
970 CleanupStack::PopAndDestroy(2); //messageData and sendUi |
1073 CleanupStack::PopAndDestroy(2); //messageData and sendUi |
971 return true; |
1074 return true; |
972 } |
1075 } |
|
1076 |
|
1077 #endif |
973 |
1078 |
974 bool CMTMEngine::retrieve(QMessageServicePrivate& privateService, const QMessageId &messageId, const QMessageContentContainerId& id) |
1079 bool CMTMEngine::retrieve(QMessageServicePrivate& privateService, const QMessageId &messageId, const QMessageContentContainerId& id) |
975 { |
1080 { |
976 TRAPD(err, retrieveL(privateService, messageId, id)); |
1081 TRAPD(err, retrieveL(privateService, messageId, id)); |
977 if (err != KErrNone) |
1082 if (err != KErrNone) |
3761 // Read message sender |
3866 // Read message sender |
3762 ipMmsMtm->SwitchCurrentEntryL(messageId); |
3867 ipMmsMtm->SwitchCurrentEntryL(messageId); |
3763 ipMmsMtm->LoadMessageL(); |
3868 ipMmsMtm->LoadMessageL(); |
3764 message.setFrom(QMessageAddress(QMessageAddress::Phone, QString::fromUtf16(ipMmsMtm->Sender().Ptr(), ipMmsMtm->Sender().Length()))); |
3869 message.setFrom(QMessageAddress(QMessageAddress::Phone, QString::fromUtf16(ipMmsMtm->Sender().Ptr(), ipMmsMtm->Sender().Length()))); |
3765 QMessagePrivate::setSenderName(message, QString::fromUtf16(ipMmsMtm->Sender().Ptr(), ipMmsMtm->Sender().Length())); |
3870 QMessagePrivate::setSenderName(message, QString::fromUtf16(ipMmsMtm->Sender().Ptr(), ipMmsMtm->Sender().Length())); |
|
3871 |
|
3872 // Read message recipients |
|
3873 const CMsvRecipientList& recipients = ipMmsMtm->AddresseeList(); |
|
3874 QMessageAddressList toList; |
|
3875 QMessageAddressList ccList; |
|
3876 QMessageAddressList bccList; |
|
3877 for (int i=0; i < recipients.Count(); i++) { |
|
3878 switch (recipients.Type(i)) { |
|
3879 case EMsvRecipientCc: |
|
3880 ccList.append(QMessageAddress(QMessageAddress::Phone, QString::fromUtf16(recipients[i].Ptr(), recipients[i].Length()))); |
|
3881 break; |
|
3882 case EMsvRecipientBcc: |
|
3883 bccList.append(QMessageAddress(QMessageAddress::Phone, QString::fromUtf16(recipients[i].Ptr(), recipients[i].Length()))); |
|
3884 break; |
|
3885 case EMsvRecipientTo: |
|
3886 default: |
|
3887 toList.append(QMessageAddress(QMessageAddress::Phone, QString::fromUtf16(recipients[i].Ptr(), recipients[i].Length()))); |
|
3888 break; |
|
3889 } |
|
3890 } |
|
3891 message.setTo(toList); |
|
3892 message.setCc(ccList); |
|
3893 message.setBcc(bccList); |
|
3894 |
3766 |
3895 |
3767 // Read message subject |
3896 // Read message subject |
3768 if (receivedEntry.Entry().iDescription.Length() > 0) { |
3897 if (receivedEntry.Entry().iDescription.Length() > 0) { |
3769 message.setSubject(QString::fromUtf16(receivedEntry.Entry().iDescription.Ptr(), |
3898 message.setSubject(QString::fromUtf16(receivedEntry.Entry().iDescription.Ptr(), |
3770 receivedEntry.Entry().iDescription.Length())); |
3899 receivedEntry.Entry().iDescription.Length())); |