60 |
60 |
61 #include "MuiuOperationWait.h" |
61 #include "MuiuOperationWait.h" |
62 #include "UniEditorGenUtils.h" |
62 #include "UniEditorGenUtils.h" |
63 #include "unidatamodelloader.h" |
63 #include "unidatamodelloader.h" |
64 #include "unidatamodelplugininterface.h" |
64 #include "unidatamodelplugininterface.h" |
|
65 #include "msgcontacthandler.h" |
65 #include <hbglobal.h> // for translation support |
66 #include <hbglobal.h> // for translation support |
66 #include <xqconversions.h> |
67 #include <xqconversions.h> |
67 // resources |
68 // resources |
68 |
69 |
69 // CONSTANTS |
70 // CONSTANTS |
332 else if(aOperation == UniEditorPluginInterface::Forward) |
333 else if(aOperation == UniEditorPluginInterface::Forward) |
333 { |
334 { |
334 //Populate message body |
335 //Populate message body |
335 populateMessageBodyL(aMessage,msvEntry); |
336 populateMessageBodyL(aMessage,msvEntry); |
336 } |
337 } |
|
338 else if(aOperation == UniEditorPluginInterface::Reply) |
|
339 { |
|
340 populateMessageForReplyL(aMessage); |
|
341 } |
|
342 else if(aOperation == UniEditorPluginInterface::ReplyAll) |
|
343 { |
|
344 // control should never reach here for sms |
|
345 User::Leave(KErrArgument); |
|
346 } |
337 |
347 |
338 //This is required as the switch entry doesnot reset sms headers |
348 //This is required as the switch entry doesnot reset sms headers |
339 //so if we fwd an inbox msg and then try to save that content to drafts |
349 //so if we fwd an inbox msg and then try to save that content to drafts |
340 //we see some issue |
350 //we see some issue |
341 delete iSmsMtm; |
351 delete iSmsMtm; |
449 TPtrC appendbuf; |
459 TPtrC appendbuf; |
450 if ( IsEmailAddress( *pureAddr ) ) |
460 if ( IsEmailAddress( *pureAddr ) ) |
451 { |
461 { |
452 emailFields->AddAddressL( *pureAddr ); |
462 emailFields->AddAddressL( *pureAddr ); |
453 appendbuf.Set(pureAddr->Des().Left(appendLen)); |
463 appendbuf.Set(pureAddr->Des().Left(appendLen)); |
|
464 iRecipients->AppendL( *addr ); |
454 } |
465 } |
455 else |
466 else |
456 { |
467 { |
457 if(aliasAddr->Length() > 0) |
468 if(aliasAddr->Length() > 0) |
458 { |
469 { |
459 SmsMtmL()->AddAddresseeL( *pureAddr, *aliasAddr ); |
470 SmsMtmL()->AddAddresseeL( *pureAddr, *aliasAddr ); |
460 appendbuf.Set(aliasAddr->Des().Left(appendLen)); |
471 appendbuf.Set(aliasAddr->Des().Left(appendLen)); |
|
472 iRecipients->AppendL( |
|
473 *TMmsGenUtils::GenerateAddressL(*pureAddr, *aliasAddr)); |
461 } |
474 } |
462 else |
475 else |
463 { |
476 { |
464 if(alt_alias->Length() > 0) |
477 if(alt_alias->Length() > 0) |
465 { |
478 { |
466 SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias ); |
479 SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias ); |
467 appendbuf.Set(alt_alias->Des().Left(appendLen)); |
480 appendbuf.Set(alt_alias->Des().Left(appendLen)); |
|
481 iRecipients->AppendL( |
|
482 *TMmsGenUtils::GenerateAddressL(*pureAddr, *alt_alias)); |
468 } |
483 } |
469 else |
484 else |
470 { |
485 { |
471 SmsMtmL()->AddAddresseeL( *pureAddr ); |
486 SmsMtmL()->AddAddresseeL( *pureAddr ); |
472 appendbuf.Set(pureAddr->Des().Left(appendLen)); |
487 appendbuf.Set(pureAddr->Des().Left(appendLen)); |
|
488 iRecipients->AppendL( *addr ); |
473 } |
489 } |
474 } |
490 } |
475 } |
491 } |
476 // copy the append-buffer to form idetails |
492 // copy the append-buffer to form idetails |
477 if(appendLen > 0) |
493 if(appendLen > 0) |
478 { |
494 { |
479 idetailsBuf.Append( appendbuf ); |
495 idetailsBuf.Append( appendbuf ); |
480 } |
496 } |
481 iRecipients->AppendL( *addr ); |
|
482 |
497 |
483 // cleanup |
498 // cleanup |
484 CleanupStack::PopAndDestroy(2, pureAddr ); |
499 CleanupStack::PopAndDestroy(2, pureAddr ); |
485 if(alt_alias->Length() > 0) |
500 if(alt_alias->Length() > 0) |
486 { |
501 { |
1794 if( emailFields.Subject( ).Length( ) ) |
1809 if( emailFields.Subject( ).Length( ) ) |
1795 { // If email subject exists -> copy it |
1810 { // If email subject exists -> copy it |
1796 aMessage->setSubject(XQConversions::s60DescToQString( |
1811 aMessage->setSubject(XQConversions::s60DescToQString( |
1797 emailFields.Subject())); |
1812 emailFields.Subject())); |
1798 } |
1813 } |
1799 |
|
1800 } |
1814 } |
1801 |
1815 |
1802 // ---------------------------------------------------- |
1816 // ---------------------------------------------------- |
1803 // UniEditorSmsPluginPrivate::populateMessageBodyL() |
1817 // UniEditorSmsPluginPrivate::populateMessageBodyL() |
1804 // @see header |
1818 // @see header |
1877 TAny* /*aArg2*/, TAny* /*aArg3*/) |
1891 TAny* /*aArg2*/, TAny* /*aArg3*/) |
1878 { |
1892 { |
1879 // do nothing |
1893 // do nothing |
1880 } |
1894 } |
1881 |
1895 |
|
1896 // ----------------------------------------------------------------------------- |
|
1897 // UniEditorSmsPluginPrivate::populateMessageForReplyL |
|
1898 // @see Header |
|
1899 // ----------------------------------------------------------------------------- |
|
1900 // |
|
1901 void UniEditorSmsPluginPrivate::populateMessageForReplyL( |
|
1902 ConvergedMessage* aMessage) |
|
1903 { |
|
1904 // find out if the message is incoming or outgoing |
|
1905 CSmsPDU::TSmsPDUType smsPduType = SmsMtmL()->SmsHeader().Type(); |
|
1906 |
|
1907 // for incoming message, populate sender address in To-field |
|
1908 if(smsPduType == CSmsPDU::ESmsDeliver) |
|
1909 { |
|
1910 QString addr; |
|
1911 fromAddress(addr); |
|
1912 if(!addr.isEmpty()) |
|
1913 { |
|
1914 ConvergedMessageAddress messageAddress(addr); |
|
1915 aMessage->addToRecipient(messageAddress); |
|
1916 } |
|
1917 } |
|
1918 // else, for outgoing message, populate receiver address in To-field |
|
1919 else if(smsPduType == CSmsPDU::ESmsSubmit) |
|
1920 { |
|
1921 populateRecipientsL(aMessage); |
|
1922 } |
|
1923 |
|
1924 // resolve to-field contacts |
|
1925 ConvergedMessageAddressList addrList = aMessage->toAddressList(); |
|
1926 int addrCount = addrList.count(); |
|
1927 for(int i=0; i<addrCount; i++) |
|
1928 { |
|
1929 ConvergedMessageAddress* addr = addrList.at(i); |
|
1930 // resolve contact if alias is empty |
|
1931 if(addr->alias().isEmpty()) |
|
1932 { |
|
1933 QString alias; |
|
1934 int count; |
|
1935 int localId = |
|
1936 MsgContactHandler::resolveContactDisplayName( |
|
1937 addr->address(), alias, count); |
|
1938 addr->setAlias(alias); |
|
1939 } |
|
1940 } |
|
1941 } |
|
1942 |
|
1943 //--------------------------------------------------------------- |
|
1944 // UniEditorSmsPluginPrivate::fromAddress |
|
1945 // @see header |
|
1946 //--------------------------------------------------------------- |
|
1947 void UniEditorSmsPluginPrivate::fromAddress( |
|
1948 QString& messageAddress) |
|
1949 { |
|
1950 CPlainText* pText = CPlainText::NewL(); |
|
1951 CleanupStack::PushL(pText); |
|
1952 |
|
1953 CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText); |
|
1954 CleanupStack::PushL(smsHeader); |
|
1955 |
|
1956 CMsvEntry &cEntry = SmsMtmL()->Entry(); |
|
1957 |
|
1958 CMsvStore* store = cEntry.ReadStoreL(); |
|
1959 CleanupStack::PushL(store); |
|
1960 |
|
1961 smsHeader->RestoreL(*store); |
|
1962 |
|
1963 messageAddress |
|
1964 = XQConversions::s60DescToQString(smsHeader->FromAddress()); |
|
1965 CleanupStack::PopAndDestroy(3, pText); |
|
1966 } |
|
1967 |
1882 // End of File |
1968 // End of File |