messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Tue Jul 06 22:50:16 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp Fri Jul 09 14:46:10 2010 +0530
@@ -62,6 +62,7 @@
#include "UniEditorGenUtils.h"
#include "unidatamodelloader.h"
#include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
#include <hbglobal.h> // for translation support
#include <xqconversions.h>
// resources
@@ -334,6 +335,15 @@
//Populate message body
populateMessageBodyL(aMessage,msvEntry);
}
+ else if(aOperation == UniEditorPluginInterface::Reply)
+ {
+ populateMessageForReplyL(aMessage);
+ }
+ else if(aOperation == UniEditorPluginInterface::ReplyAll)
+ {
+ // control should never reach here for sms
+ User::Leave(KErrArgument);
+ }
//This is required as the switch entry doesnot reset sms headers
//so if we fwd an inbox msg and then try to save that content to drafts
@@ -451,6 +461,7 @@
{
emailFields->AddAddressL( *pureAddr );
appendbuf.Set(pureAddr->Des().Left(appendLen));
+ iRecipients->AppendL( *addr );
}
else
{
@@ -458,6 +469,8 @@
{
SmsMtmL()->AddAddresseeL( *pureAddr, *aliasAddr );
appendbuf.Set(aliasAddr->Des().Left(appendLen));
+ iRecipients->AppendL(
+ *TMmsGenUtils::GenerateAddressL(*pureAddr, *aliasAddr));
}
else
{
@@ -465,11 +478,14 @@
{
SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias );
appendbuf.Set(alt_alias->Des().Left(appendLen));
+ iRecipients->AppendL(
+ *TMmsGenUtils::GenerateAddressL(*pureAddr, *alt_alias));
}
else
{
SmsMtmL()->AddAddresseeL( *pureAddr );
appendbuf.Set(pureAddr->Des().Left(appendLen));
+ iRecipients->AppendL( *addr );
}
}
}
@@ -478,7 +494,6 @@
{
idetailsBuf.Append( appendbuf );
}
- iRecipients->AppendL( *addr );
// cleanup
CleanupStack::PopAndDestroy(2, pureAddr );
@@ -1796,7 +1811,6 @@
aMessage->setSubject(XQConversions::s60DescToQString(
emailFields.Subject()));
}
-
}
// ----------------------------------------------------
@@ -1879,4 +1893,76 @@
// do nothing
}
+// -----------------------------------------------------------------------------
+// UniEditorSmsPluginPrivate::populateMessageForReplyL
+// @see Header
+// -----------------------------------------------------------------------------
+//
+void UniEditorSmsPluginPrivate::populateMessageForReplyL(
+ ConvergedMessage* aMessage)
+ {
+ // find out if the message is incoming or outgoing
+ CSmsPDU::TSmsPDUType smsPduType = SmsMtmL()->SmsHeader().Type();
+
+ // for incoming message, populate sender address in To-field
+ if(smsPduType == CSmsPDU::ESmsDeliver)
+ {
+ QString addr;
+ fromAddress(addr);
+ if(!addr.isEmpty())
+ {
+ ConvergedMessageAddress messageAddress(addr);
+ aMessage->addToRecipient(messageAddress);
+ }
+ }
+ // else, for outgoing message, populate receiver address in To-field
+ else if(smsPduType == CSmsPDU::ESmsSubmit)
+ {
+ populateRecipientsL(aMessage);
+ }
+
+ // resolve to-field contacts
+ ConvergedMessageAddressList addrList = aMessage->toAddressList();
+ int addrCount = addrList.count();
+ for(int i=0; i<addrCount; i++)
+ {
+ ConvergedMessageAddress* addr = addrList.at(i);
+ // resolve contact if alias is empty
+ if(addr->alias().isEmpty())
+ {
+ QString alias;
+ int count;
+ int localId =
+ MsgContactHandler::resolveContactDisplayName(
+ addr->address(), alias, count);
+ addr->setAlias(alias);
+ }
+ }
+ }
+
+//---------------------------------------------------------------
+// UniEditorSmsPluginPrivate::fromAddress
+// @see header
+//---------------------------------------------------------------
+void UniEditorSmsPluginPrivate::fromAddress(
+ QString& messageAddress)
+{
+ CPlainText* pText = CPlainText::NewL();
+ CleanupStack::PushL(pText);
+
+ CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsDeliver, *pText);
+ CleanupStack::PushL(smsHeader);
+
+ CMsvEntry &cEntry = SmsMtmL()->Entry();
+
+ CMsvStore* store = cEntry.ReadStoreL();
+ CleanupStack::PushL(store);
+
+ smsHeader->RestoreL(*store);
+
+ messageAddress
+ = XQConversions::s60DescToQString(smsHeader->FromAddress());
+ CleanupStack::PopAndDestroy(3, pText);
+}
+
// End of File