messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp
changeset 56 f42d9a78f435
parent 48 4f501b74aeb1
child 67 fc91263aee62
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Wed Aug 18 00:46:12 2010 +0530
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Tue Aug 31 18:53:38 2010 +0530
@@ -329,6 +329,17 @@
 
         //Populate message body
         populateMessageBodyL(aMessage,msvEntry);
+
+        // read flag for reply-via-same-smsc usecase
+        bool replyPath = SmsMtmL()->SmsHeader().Submit().ReplyPath();
+        aMessage->setReplyPath(replyPath);
+        if(replyPath)
+        {
+            // save smsc in the message
+            QString scaddress = XQConversions::s60DescToQString(
+                    SmsMtmL()->SmsHeader().Message().ServiceCenterAddress());
+            aMessage->setOriginatingSC(scaddress);
+        }
     }
     else if(aOperation == UniEditorPluginInterface::Forward)
     {
@@ -368,7 +379,7 @@
                 // set sms data
                 SetSmsDataL( message );
                 // set sms settings
-                SetSmsSettingsL();
+                SetSmsSettingsL( message );
                 // save all changes for the entry
                 SmsMtmL()->SaveMessageL();
         );
@@ -692,7 +703,7 @@
 // SetSmsSettingsL
 // @see header
 // -----------------------------------------------------------------------------
-void UniEditorSmsPluginPrivate::SetSmsSettingsL()
+void UniEditorSmsPluginPrivate::SetSmsSettingsL(ConvergedMessage* message)
     {
     CSmsSettings* sendOptions = CSmsSettings::NewL();
     CleanupStack::PushL( sendOptions );
@@ -728,7 +739,7 @@
     sendOptions->SetDeliveryReport( defaultSettings->DeliveryReport() );
     sendOptions->SetSmsBearer( defaultSettings->SmsBearer() );
     sendOptions->SetValidityPeriod( defaultSettings->ValidityPeriod() );
-    sendOptions->SetReplyPath( defaultSettings->ReplyPath() );
+    sendOptions->SetReplyPath( message->replyPath() );
 
     if (defaultSettings->CharacterSet()
             == TSmsDataCodingScheme::ESmsAlphabetUCS2)
@@ -744,9 +755,16 @@
 
     // Move all the stuff from iSmsHeader::SmsSettings to SmsMtm::SmsHeader::SmsSettings
     SmsMtmL()->SmsHeader( ).SetSmsSettingsL( *sendOptions );
-    //If sc is existant then only set the default service center
-    if(ValidateSCNumberL())
+
+    // if reply-path is present, then lets use it
+    if(message->replyPath())
     {
+    QString scaddress = message->originatingSC();
+    SmsMtmL()->SmsHeader( ).Message( ).
+        SetServiceCenterAddressL( *XQConversions::qStringToS60Desc(scaddress) );
+    }
+    else if(ValidateSCNumberL())
+    {    // Or if default SC is existant then only set the default SC
     SmsMtmL()->SmsHeader( ).Message( ).
         SetServiceCenterAddressL( defaultSettings->GetServiceCenter(defaultSettings->DefaultServiceCenter()).Address() );
     }
@@ -1917,6 +1935,16 @@
             ConvergedMessageAddress messageAddress(addr);
             aMessage->addToRecipient(messageAddress);
             }
+        // read flag for reply-via-same-smsc usecase
+        bool replyPath = SmsMtmL()->SmsHeader().Deliver().ReplyPath();
+        aMessage->setReplyPath(replyPath);
+        if(replyPath)
+            {
+            // save smsc in the message
+            QString scaddress = XQConversions::s60DescToQString(
+                    SmsMtmL()->SmsHeader().Deliver().ServiceCenterAddress());
+            aMessage->setOriginatingSC(scaddress);
+            }
         }
     // else, for outgoing message, populate receiver address in To-field
     else if(smsPduType == CSmsPDU::ESmsSubmit)
@@ -1935,10 +1963,11 @@
             {
             QString alias;
             int count;
-            int localId =
-                    MsgContactHandler::resolveContactDisplayName(
-                            addr->address(), alias, count);
-            addr->setAlias(alias);
+            if(-1 != MsgContactHandler::resolveContactDisplayName(
+                                        addr->address(), alias, count))
+                {
+                addr->setAlias(alias);
+                }
             }
         }
     }