messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
equal
deleted
inserted
replaced
41 #include <MsgMediaResolver.h> |
41 #include <MsgMediaResolver.h> |
42 |
42 |
43 #include "UniSendingSettings.h" |
43 #include "UniSendingSettings.h" |
44 #include "unidatamodelloader.h" |
44 #include "unidatamodelloader.h" |
45 #include "unidatamodelplugininterface.h" |
45 #include "unidatamodelplugininterface.h" |
46 #include "s60qconversions.h" |
46 #include <xqconversions.h> |
47 #include "debugtraces.h" |
47 #include "debugtraces.h" |
48 #include "UniEditorGenUtils.h" |
48 #include "UniEditorGenUtils.h" |
49 |
49 |
50 // Possible values for mms validity period in seconds |
50 // Possible values for mms validity period in seconds |
51 const TInt32 KUniMmsValidityPeriod1h = 3600; |
51 const TInt32 KUniMmsValidityPeriod1h = 3600; |
165 |
165 |
166 //Populate recipients |
166 //Populate recipients |
167 populateRecipientsL(aMessage); |
167 populateRecipientsL(aMessage); |
168 |
168 |
169 //populate convergedmessage with the subject |
169 //populate convergedmessage with the subject |
170 aMessage.setSubject(S60QConversions::s60DescToQString( |
170 aMessage.setSubject(XQConversions::s60DescToQString( |
171 MmsMtmL()->SubjectL())); |
171 MmsMtmL()->SubjectL())); |
172 |
172 |
173 // Priority |
173 // Priority |
174 TMsvPriority priority = entry.Priority(); |
174 TMsvPriority priority = entry.Priority(); |
175 if( EMsvHighPriority == priority ) |
175 if( EMsvHighPriority == priority ) |
202 // |
202 // |
203 void CUniEditorMmsPluginPrivate::convertFromForwardHandlerL( |
203 void CUniEditorMmsPluginPrivate::convertFromForwardHandlerL( |
204 ConvergedMessage &aMessage) |
204 ConvergedMessage &aMessage) |
205 { |
205 { |
206 QDEBUG_WRITE("Enter convertFromForwardHandlerL"); |
206 QDEBUG_WRITE("Enter convertFromForwardHandlerL"); |
207 |
207 iMessageForwarded = EFalse; |
208 TMsvEntry entry =MmsMtmL()->Entry().Entry(); |
208 TMsvEntry entry = MmsMtmL()->Entry().Entry(); |
209 |
209 |
210 //populate convergedmessage with the subject prepended with FW: |
210 //populate convergedmessage with the subject prepended with FW: |
211 QString subject = LOC_FWD + S60QConversions::s60DescToQString( |
211 QString subject = |
212 MmsMtmL()->SubjectL()); |
212 XQConversions::s60DescToQString(MmsMtmL()->SubjectL()); |
|
213 |
|
214 if (!(entry.Forwarded() || subject.startsWith(LOC_FWD, |
|
215 Qt::CaseInsensitive))) |
|
216 { |
|
217 subject.insert(0, LOC_FWD); |
|
218 iMessageForwarded = ETrue; |
|
219 } |
|
220 |
213 aMessage.setSubject(subject); |
221 aMessage.setSubject(subject); |
214 |
222 |
215 // Priority |
223 // Priority |
216 TMsvPriority priority = entry.Priority(); |
224 TMsvPriority priority = entry.Priority(); |
217 if( EMsvHighPriority == priority ) |
225 if( EMsvHighPriority == priority ) |
266 { |
274 { |
267 if( slideContentList.at(i)->mimetype().contains("text") ) |
275 if( slideContentList.at(i)->mimetype().contains("text") ) |
268 { |
276 { |
269 QString textContent; |
277 QString textContent; |
270 QFile file(slideContentList.at(i)->path()); |
278 QFile file(slideContentList.at(i)->path()); |
271 file.open(QIODevice::ReadOnly); |
279 if (file.open(QIODevice::ReadOnly)) { |
272 textContent = file.readAll(); |
280 textContent = file.readAll(); |
273 aMessage.setBodyText(textContent); |
281 aMessage.setBodyText(textContent); |
274 file.close(); |
282 file.close(); |
|
283 } |
|
284 else { |
|
285 return; |
|
286 } |
275 } |
287 } |
276 else |
288 else |
277 { |
289 { |
278 ConvergedMessageAttachment* attachment = |
290 ConvergedMessageAttachment* attachment = |
279 new ConvergedMessageAttachment( |
291 new ConvergedMessageAttachment( |
380 //Add recipients |
392 //Add recipients |
381 addRecipientsL(aMessage); |
393 addRecipientsL(aMessage); |
382 |
394 |
383 //There is no size check inside plugin as it assumes |
395 //There is no size check inside plugin as it assumes |
384 //we get proper data from editor |
396 //we get proper data from editor |
385 HBufC* sub = S60QConversions::qStringToS60Desc(aMessage->subject()); |
397 entry = MmsMtmL()->Entry().Entry(); |
|
398 if (iMessageForwarded) |
|
399 { |
|
400 entry.SetForwarded(ETrue); |
|
401 iMessageForwarded = EFalse; |
|
402 } |
|
403 HBufC* sub = XQConversions::qStringToS60Desc(aMessage->subject()); |
386 if( sub ) |
404 if( sub ) |
387 { |
405 { |
388 CleanupStack::PushL(sub); |
406 CleanupStack::PushL(sub); |
389 MmsMtmL()->SetSubjectL( *sub ); |
407 MmsMtmL()->SetSubjectL( *sub ); |
390 CleanupStack::PopAndDestroy(sub); |
408 CleanupStack::PopAndDestroy(sub); |
505 } |
523 } |
506 |
524 |
507 //Saving the changes |
525 //Saving the changes |
508 MmsMtmL()->SaveMessageL(); |
526 MmsMtmL()->SaveMessageL(); |
509 |
527 |
|
528 |
510 entry = MmsMtmL()->Entry().Entry(); |
529 entry = MmsMtmL()->Entry().Entry(); |
511 |
|
512 TBuf<KMaxDetailsLength> detailsBuf; |
530 TBuf<KMaxDetailsLength> detailsBuf; |
513 MakeDetailsL( detailsBuf ); |
531 MakeDetailsL( detailsBuf ); |
514 entry.iDetails.Set( detailsBuf ); |
532 entry.iDetails.Set( detailsBuf ); |
515 |
533 |
516 MmsMtmL()->Entry().ChangeL(entry); // commit changes |
534 MmsMtmL()->Entry().ChangeL(entry); // commit changes |
706 if(array[i]->address().isEmpty()) |
724 if(array[i]->address().isEmpty()) |
707 { |
725 { |
708 continue; |
726 continue; |
709 } |
727 } |
710 // convert from QString to HBufC |
728 // convert from QString to HBufC |
711 HBufC* addr = S60QConversions::qStringToS60Desc(array[i]->address()); |
729 HBufC* addr = XQConversions::qStringToS60Desc(array[i]->address()); |
712 |
730 |
713 CleanupStack::PushL(addr); |
731 CleanupStack::PushL(addr); |
714 |
732 |
715 if(TMmsGenUtils::Alias(*addr).Length() > 0) |
733 if(TMmsGenUtils::Alias(*addr).Length() > 0) |
716 { |
734 { |
717 MmsMtmL()->AddAddresseeL(recpType, TMmsGenUtils::PureAddress(*addr), |
735 MmsMtmL()->AddAddresseeL(recpType, TMmsGenUtils::PureAddress(*addr), |
718 TMmsGenUtils::Alias(*addr)); |
736 TMmsGenUtils::Alias(*addr)); |
719 } |
737 } |
720 else |
738 else |
721 { |
739 { |
722 HBufC* displayName = S60QConversions::qStringToS60Desc(array[i]->alias()); |
740 HBufC* displayName = XQConversions::qStringToS60Desc(array[i]->alias()); |
723 if(displayName) |
741 if(displayName) |
724 { |
742 { |
725 CleanupStack::PushL(displayName); |
743 CleanupStack::PushL(displayName); |
726 |
744 |
727 MmsMtmL()->AddAddresseeL(recpType, TMmsGenUtils::PureAddress(*addr), |
745 MmsMtmL()->AddAddresseeL(recpType, TMmsGenUtils::PureAddress(*addr), |
755 |
773 |
756 // extract each address and populate into ConvergedMessageAddress |
774 // extract each address and populate into ConvergedMessageAddress |
757 for (TInt i = 0; i < count; ++i) |
775 for (TInt i = 0; i < count; ++i) |
758 { |
776 { |
759 //Address |
777 //Address |
760 QString address = S60QConversions::s60DescToQString( |
778 QString address = XQConversions::s60DescToQString( |
761 TMmsGenUtils::PureAddress(addresses[i])); |
779 TMmsGenUtils::PureAddress(addresses[i])); |
762 //Alias |
780 //Alias |
763 QString alias = S60QConversions::s60DescToQString( |
781 QString alias = XQConversions::s60DescToQString( |
764 TMmsGenUtils::Alias(addresses[i])); |
782 TMmsGenUtils::Alias(addresses[i])); |
765 |
783 |
766 //add recipient to convergedMessage |
784 //add recipient to convergedMessage |
767 ConvergedMessageAddress messageAddress(address, alias); |
785 ConvergedMessageAddress messageAddress(address, alias); |
768 if (addresses.Type(i) == EMsvRecipientTo) |
786 if (addresses.Type(i) == EMsvRecipientTo) |
806 // ----------------------------------------------------------------------------- |
824 // ----------------------------------------------------------------------------- |
807 // |
825 // |
808 void CUniEditorMmsPluginPrivate::addObjectL(int aSlideNum, const QString& aFilePath) |
826 void CUniEditorMmsPluginPrivate::addObjectL(int aSlideNum, const QString& aFilePath) |
809 { |
827 { |
810 |
828 |
811 HBufC* filePath = S60QConversions::qStringToS60Desc(aFilePath); |
829 HBufC* filePath = XQConversions::qStringToS60Desc(aFilePath); |
812 |
830 |
813 if (filePath) |
831 if (filePath) |
814 { |
832 { |
815 CleanupStack::PushL(filePath); |
833 CleanupStack::PushL(filePath); |
816 RFile file = iUniDataModel->MediaResolver().FileHandleL(*filePath); |
834 RFile file = iUniDataModel->MediaResolver().FileHandleL(*filePath); |
835 // @see Header |
853 // @see Header |
836 // ----------------------------------------------------------------------------- |
854 // ----------------------------------------------------------------------------- |
837 // |
855 // |
838 void CUniEditorMmsPluginPrivate::addAttachmentL(const QString& aFilePath) |
856 void CUniEditorMmsPluginPrivate::addAttachmentL(const QString& aFilePath) |
839 { |
857 { |
840 HBufC * filePath = S60QConversions::qStringToS60Desc(aFilePath); |
858 HBufC * filePath = XQConversions::qStringToS60Desc(aFilePath); |
841 if (filePath) |
859 if (filePath) |
842 { |
860 { |
843 CleanupStack::PushL(filePath); |
861 CleanupStack::PushL(filePath); |
844 |
862 |
845 RFile file = iUniDataModel->MediaResolver().FileHandleL(*filePath); |
863 RFile file = iUniDataModel->MediaResolver().FileHandleL(*filePath); |
870 void CUniEditorMmsPluginPrivate::addTextObjectL(int aSlideNum, const QString& aBodyText) |
888 void CUniEditorMmsPluginPrivate::addTextObjectL(int aSlideNum, const QString& aBodyText) |
871 { |
889 { |
872 delete iEditor; |
890 delete iEditor; |
873 iEditor = NULL; |
891 iEditor = NULL; |
874 |
892 |
875 HBufC* textContent = S60QConversions::qStringToS60Desc(aBodyText); |
893 HBufC* textContent = XQConversions::qStringToS60Desc(aBodyText); |
876 if (textContent) |
894 if (textContent) |
877 { |
895 { |
878 CleanupStack::PushL(textContent); |
896 CleanupStack::PushL(textContent); |
879 |
897 |
880 iEditor = new CEikRichTextEditor; |
898 iEditor = new CEikRichTextEditor; |