Revision: 201037
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 00:13:15 +0300
changeset 72 6f657153cbc5
parent 70 a15d9966050f
Revision: 201037 Kit: 201039
email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF
email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF
email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h
email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h
email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp
email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp
email/imap4mtm/imapservermtm/inc/cimap4servermtm.h
email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp
email/imap4mtm/imapsession/inc/cimapatomparser.h
email/imap4mtm/imapsession/src/cimapatomparser.cpp
layers.sysdef.xml
messagingapp/conf/CI_messaging.confml
messagingapp/conf/messaging.confml
messagingapp/conf/messaging_101F87EB.crml
messagingapp/conf/messaging_101F87EC.crml
messagingapp/conf/messaging_101F87ED.crml
messagingapp/conf/messaging_101F87EE.crml
messagingapp/conf/messaging_101F8873.crml
messagingapp/conf/messaging_101F8F28.crml
messagingapp/conf/messaging_102072E2.crml
messagingapp/conf/messaging_102824A0.crml
messagingapp/conf/messaging_1028281E.crml
messagingapp/conf/messaging_conf.pro
messagingapp/msgappfw/client/group/csserverclientapi.mmp
messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp
messagingapp/msgappfw/client/src/ccsrequesthandler.cpp
messagingapp/msgappfw/msghistory/msghistory.pro
messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro
messagingapp/msgappfw/plugins/msgplugin/group/csmsg.mmp
messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp
messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp
messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp
messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp
messagingapp/msgappfw/server/server.pro
messagingapp/msgappfw/server/src/ccssession.cpp
messagingapp/msgappfw/utils/group/csutils.mmp
messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro
messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro
messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h
messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro
messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp
messagingapp/msgnotifications/msgnotifier/msgnotifier.pro
messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro
messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/testmmsplugin.pro
messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h
messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h
messagingapp/msgservices/msgserviceapp/msgserviceapp.pro
messagingapp/msgservices/msgserviceapp/src/main.cpp
messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp
messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp
messagingapp/msgsettings/msginit/msginit.pro
messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro
messagingapp/msgsettings/settingsview/settingsview.pro
messagingapp/msgui/appengine/appengine.pro
messagingapp/msgui/appengine/src/conversationsengine.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro
messagingapp/msgui/bwins/msguiutilsu.def
messagingapp/msgui/conversationview/conversationview.pro
messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h
messagingapp/msgui/conversationview/inc/msgconversationviewitem.h
messagingapp/msgui/conversationview/inc/msgconversationwidget.h
messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp
messagingapp/msgui/conversationview/src/msgconversationview.cpp
messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp
messagingapp/msgui/conversationview/src/msgconversationwidget.cpp
messagingapp/msgui/conversationview/src/msgeditorwidget.cpp
messagingapp/msgui/eabi/msguiutilsu.def
messagingapp/msgui/msgapp/inc/msgapplication.h
messagingapp/msgui/msgapp/inc/msglistviewitem.h
messagingapp/msgui/msgapp/inc/msgmainwindow.h
messagingapp/msgui/msgapp/msgapp.pro
messagingapp/msgui/msgapp/src/draftslistview.cpp
messagingapp/msgui/msgapp/src/main.cpp
messagingapp/msgui/msgapp/src/msgapplication.cpp
messagingapp/msgui/msgapp/src/msglistview.cpp
messagingapp/msgui/msgapp/src/msglistviewitem.cpp
messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro
messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h
messagingapp/msgui/msguiutils/inc/msgcontactsutil.h
messagingapp/msgui/msguiutils/inc/msgmediautil.h
messagingapp/msgui/msguiutils/inc/msgsendutil.h
messagingapp/msgui/msguiutils/msguiutils.pro
messagingapp/msgui/msguiutils/src/msgsendutil.cpp
messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h
messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h
messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h
messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h
messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h
messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h
messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp
messagingapp/msgui/unifiededitor/unifiededitor.pro
messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h
messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h
messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h
messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
messagingapp/msgui/unifiedviewer/unifiedviewer.pro
messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro
messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/mmstestbed.pro
messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/testconvergedmessageutils.pro
messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp
messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro
messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/testunidatamodelloader/testunidatamodelloader.pro
messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro
messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro
messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/testunieditorpluginloader.pro
messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/mmstestbed.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/testmmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testunieditorsmsplugin/testunieditorsmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro
messagingapp/shareui/shareui.pro
messagingapp/shareui/tsrc/testshareui/testshareui.pro
messagingapp/smartmessaging/ringbc/ringbc.pro
messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp
messagingappbase/msgmedia/group/MsgMedia.mmp
messagingappbase/mtmregistry/mtmregistry.mmp
mmsengine/applicationadapter/bld/mmsapplicationadapter.mmp
mmsengine/clientmtm/bld/mmsclient.mmp
mmsengine/genutils/bld/mmsgenutils.mmp
mmsengine/genutils/src/mmsattachmenthandler.cpp
mmsengine/mmscodec/bld/mmscodec.mmp
mmsengine/mmscodec/src/mmsdecode.cpp
mmsengine/mmscodec/src/mmsencode.cpp
mmsengine/mmscodecclient/bld/mmscodecclient.mmp
mmsengine/mmsconninit/bld/mmsconninit.mmp
mmsengine/mmshttptransport/bld/mmstransport.mmp
mmsengine/mmsmessage/bld/mmsmessage.mmp
mmsengine/mmspushhandler/bld/mmspushhandler.mmp
mmsengine/mmsserver/bld/mmsserver.mmp
mmsengine/mmsserver/src/mmsbaseoperation.cpp
mmsengine/mmsserver/src/mmsserver.cpp
mmsengine/mmsserversettings/bld/mmsserversettings.mmp
mmsengine/mmswatcher/bld/mmswatcher.mmp
mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h
mobilemessaging/smsmtm/servermtm/group/SMSS.rss
msg_plat/messaging_media_resolver_api/tsrc/group/MediaResolverAPITest.mmp
msg_plat/mms_application_api/tsrc/group/MmsApplicationTest.mmp
msg_plat/mms_codec_client_api/tsrc/group/MmsCodecClientApiTest.mmp
msg_plat/mms_conformance_api/tsrc/group/MMSConformanceAPITest.mmp
msg_plat/mms_server_settings_api/tsrc/group/MmsServerSettingsTest.mmp
msg_pub/mms_client_mtm_api/tsrc/bc/group/MMSClientMTMBCTester.mmp
msg_pub/mms_client_mtm_api/tsrc/group/MmsClientMtmApiTest.mmp
package_definition.xml
--- a/email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/bwins/impapprotocolcontrollerU.DEF	Mon Oct 04 00:13:15 2010 +0300
@@ -32,4 +32,5 @@
 	?WaitForBackground@CImapProtocolController@@QAEXAAVTRequestStatus@@@Z @ 31 NONAME ; void CImapProtocolController::WaitForBackground(class TRequestStatus &)
 	?GetAccessPointIdForConnection@CImapProtocolController@@QBEHAAK@Z @ 32 NONAME ; int CImapProtocolController::GetAccessPointIdForConnection(unsigned long &) const
 	?UpdateFlagL@CImapProtocolController@@QAEXAAVTRequestStatus@@@Z @ 33 NONAME ; void CImapProtocolController::UpdateFlagL(class TRequestStatus &)
+	?UpdateEntriesFlagL@CImapProtocolController@@QAEXAAVTRequestStatus@@ABVCMsvEntrySelection@@H@Z @ 34 NONAME ; void CImapProtocolController::UpdateEntriesFlagL(class TRequestStatus &, class CMsvEntrySelection const &, int)
 
--- a/email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/eabi/impapprotocolcontrollerU.DEF	Mon Oct 04 00:13:15 2010 +0300
@@ -77,4 +77,5 @@
 	_ZTVN4Meta13TMetaVarLen16I6RBuf16EE @ 76 NONAME ABSENT
 	_ZNK23CImapProtocolController29GetAccessPointIdForConnectionERm @ 77 NONAME
 	_ZN23CImapProtocolController11UpdateFlagLER14TRequestStatus @ 78 NONAME
+	_ZN23CImapProtocolController18UpdateEntriesFlagLER14TRequestStatusRK18CMsvEntrySelectioni @ 79 NONAME
 
--- a/email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/inc/cimapprotocolcontroller.h	Mon Oct 04 00:13:15 2010 +0300
@@ -115,6 +115,7 @@
 	IMPORT_C TImap4CompoundProgress Progress();
 	IMPORT_C void CancelAndCleanup();
 	IMPORT_C void UpdateFlagL(TRequestStatus& aStatus);
+	IMPORT_C void UpdateEntriesFlagL(TRequestStatus& aStatus,const CMsvEntrySelection& aSourceSel, TBool aFlagChanged);
 
 	// mobility API from MImMobileServer
 	void PrepareForNewCarrier(TImMobilityAction aAction, TBool aIsSeamless);
--- a/email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/inc/cimapupdateflagoperation.h	Mon Oct 04 00:13:15 2010 +0300
@@ -43,6 +43,12 @@
 						 			  CMsvServerEntry& aServerEntry,
 						 			  CImapSettings& aImapSettings
 						 			  );
+	static CImapUpdateFlagOperation* NewL(CImapSyncManager& aSyncManager,
+	                                      CMsvServerEntry& aServerEntry,
+	                                      CImapSettings& aImapSettings,
+	                                      const CMsvEntrySelection& aSourceSel,
+	                                      TBool aFlagChanged
+	                                      );
 	virtual void StartOperation(TRequestStatus& aStatus, CImapSession& aSession);
 	
 ////////////	virtual void StartOperation(TRequestStatus& aStatus);//
@@ -56,6 +62,7 @@
 						 CImapSettings& aImapSettings
 						 );
 	void ConstructL();
+	void ConstructL(const CMsvEntrySelection& aSourceSel,TBool aFlagChanged);
 
 	TBool DoRunLoopL();
 	void DoCancel();
@@ -67,6 +74,13 @@
 	RArray<TUint> iMessageUids;
 	
 	RArrayMessageFlagInfo iFlagInfoResponseArray;
+	
+	CMsvEntrySelection* iSourceSel;
+	TBool iMarkFlag;
+	TBool iEntrySelection;
+	TInt iProgressMsgsToDo;
+	TInt iProgressMsgsDone;
+
 	};
 
 #endif	// __CIMAPUPDATEFLAGOPERATION_H__
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapprotocolcontroller.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -3510,17 +3510,49 @@
 	__LOG_TEXT(KDefaultLog, "CImapProtocolController::UpdateFlagL()");
 	__ASSERT_DEBUG(iImapCompound==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECreateCompoundIsNotNull));
 	ResetProgress();
-	if (!CompleteIfBackgroundOpInProgress(aStatus))	
-		{
-		iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager,
-												   iEntry,
-												   *iImapSettings
-												   );
-		iRequestedOp = EUpdateFlag;
-		StartPrimaryOperation();
-		Queue(aStatus);
-		SetActive();
-		}
-	}
 	
-
+    if (!CompleteIfBackgroundOpInProgress(aStatus)) 
+            {
+        
+            iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager,
+                                                       iEntry,
+                                                       *iImapSettings
+                                                       );
+            
+            iRequestedOp = EUpdateFlag;
+            StartPrimaryOperation();
+            Queue(aStatus);
+            SetActive();
+            }
+
+	    }	
+
+
+
+/**
+Updates  the selection of  messages read/unread status from the remote server.
+@param aStatus
+*/  
+EXPORT_C void CImapProtocolController::UpdateEntriesFlagL( TRequestStatus& aStatus,const CMsvEntrySelection& aSourceSel ,TBool aFlagChanged)
+ 
+    {
+    __LOG_TEXT(KDefaultLog, "CImapProtocolController::UpdateEntriesFlagL()");
+    __ASSERT_DEBUG(iImapCompound==NULL, TImapServerPanic::ImapPanic(TImapServerPanic::ECreateCompoundIsNotNull));
+    ResetProgress();
+    
+   if (!CompleteIfBackgroundOpInProgress(aStatus)) 
+        {
+    
+        iImapCompound = CImapUpdateFlagOperation::NewL(*iImapSyncManager,
+                                                   iEntry,
+                                                   *iImapSettings,
+                                                   aSourceSel,
+                                                   aFlagChanged);
+        iRequestedOp = EUpdateFlag;
+        StartPrimaryOperation();
+        Queue(aStatus);
+        SetActive();
+        }
+        
+    }   
+
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapupdateflagoperation.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -39,8 +39,7 @@
 
 CImapUpdateFlagOperation::~CImapUpdateFlagOperation()
 	{
-	
-
+    delete iSourceSel;
 	iMessageUids.Reset();
 	iFlagInfoResponseArray.Reset();
 	}
@@ -66,6 +65,40 @@
 	CActiveScheduler::Add(this);
 	}
 
+// NewL for Selection
+CImapUpdateFlagOperation* CImapUpdateFlagOperation::NewL(CImapSyncManager& aSyncManager,
+                                                         CMsvServerEntry& aServerEntry,
+                                                         CImapSettings& aImapSettings, 
+                                                         const CMsvEntrySelection& aSourceSel , TBool aFlagChanged)
+
+    {
+    
+    CImapUpdateFlagOperation* self = new (ELeave) CImapUpdateFlagOperation(aSyncManager,
+                                                                     aServerEntry,
+                                                                     aImapSettings);
+    CleanupStack::PushL(self);
+    self->ConstructL(aSourceSel,aFlagChanged);
+    CleanupStack::Pop(self);
+    return self;
+    }
+//// ConstructL for Selection   
+void CImapUpdateFlagOperation::ConstructL(const CMsvEntrySelection& aSourceSel, TBool aFlagChanged)
+    {
+  
+    iSourceSel=new (ELeave) CMsvEntrySelection;
+    CheckSelectionL(aSourceSel, iSourceSel, ETrue, EFalse, EFalse, ETrue);
+
+    // Initialise the progress counters 
+    iProgressMsgsToDo=iSourceSel->Count();
+    iProgressMsgsDone=0;
+    iMarkFlag = aFlagChanged;
+    iEntrySelection = ETrue;
+    // Add to the active scheduler
+    CActiveScheduler::Add(this);
+    }
+
+
+
 void CImapUpdateFlagOperation::StartOperation(TRequestStatus& aStatus, CImapSession& aSession)
 //void CImapUpdateFlagOperation::StartOperation(TRequestStatus& aStatus)
 	{
@@ -87,39 +120,80 @@
 	SetCurrentStep();
 	switch (iCurrentStep)
 		{
+	case EUpdateFlag:
+		{
+		HBufC8* uidSeq = NULL;
+        if(!iEntrySelection) //Entry iMarkFlag is Flase
+            {
+            TMsvEmailEntry entry = iServerEntry.Entry();
+            TUint id = entry.UID();
+            iMessageUids.AppendL(id);
+            if(entry.Unread())
+                {
+                entry.SetSeenIMAP4Flag(EFalse);
+                }
+            else
+                {
+                entry.SetSeenIMAP4Flag(ETrue);	
+                }
+                    
+                    
+            User::LeaveIfError(iServerEntry.ChangeEntry(entry));
+    
+            uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids);
+    
+            // finished with the UID array. Clear it.
+            iMessageUids.Reset();
+            if(entry.SeenIMAP4Flag())
+                {
+                // issue the store command
+                iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
+                
+                }
+            else
+                {
+                // issue the store command
+                iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
+                }
+            }
+        else  //Selection iMarkFlag is Trure
+            {
+            TMsvEntry *aNewEntry1;
+			
+			TInt  count = iSourceSel->Count();
+			while (count--)
+				{
+				iServerEntry.GetEntryFromId(iSourceSel->At(count), aNewEntry1);
+				TMsvEmailEntry entry(*aNewEntry1);
+				iMessageUids.AppendL(entry.UID());
+					
+				if(iMarkFlag) // True  means  Unread
+					 {
+					 entry.SetSeenIMAP4Flag(EFalse);
+					 }
+				 else
+					 {
+					 entry.SetSeenIMAP4Flag(ETrue);  
+					 }
+				SetEntryL((*iSourceSel)[count]);
+				User::LeaveIfError(iServerEntry.ChangeEntry(entry));
+				}// end of while
+
+			uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids);
 	
-	case EUpdateFlag:
-		{		
-		TMsvEmailEntry entry = iServerEntry.Entry();
-		TUint id = entry.UID();
-		iMessageUids.AppendL(id);
-		if(entry.Unread())
-			{
-			entry.SetSeenIMAP4Flag(EFalse);
-			}
-		else
-			{
-			entry.SetSeenIMAP4Flag(ETrue);	
-			}
-				
-				
-		User::LeaveIfError(iServerEntry.ChangeEntry(entry));
-
-		HBufC8* uidSeq = CImapSession::CreateSequenceSetLC(iMessageUids);
-
-		// finished with the UID array. Clear it.
-		iMessageUids.Reset();
-		if(entry.SeenIMAP4Flag())
-			{
-			// issue the store command
-			iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
-			
-			}
-		else
-			{
-			// issue the store command
-			iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
-			}
+			// finished with the UID array. Clear it.
+			iMessageUids.Reset();
+			if(!iMarkFlag) //read
+				{
+				// issue the store command
+				iSession->StoreL(iStatus, uidSeq->Des(), KImapAddFlags, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
+				}
+			else   //Unread
+				{
+				// issue the store command
+				iSession->StoreL(iStatus, uidSeq->Des(), KStoreFlagsClearCommand, KImapFlagSeen, ETrue, iFlagInfoResponseArray);
+				}
+             } //End of else (Selection)
 	
 		iProgressState = TImap4GenericProgress::EBusy;
 		CleanupStack::PopAndDestroy(uidSeq);
--- a/email/imap4mtm/imapservermtm/inc/cimap4servermtm.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapservermtm/inc/cimap4servermtm.h	Mon Oct 04 00:13:15 2010 +0300
@@ -119,7 +119,7 @@
 						TRequestStatus& aStatus );
 	TBool CommandExpected();
 	const TDesC8& Progress();
-	
+	TInt ChangeEntriesL(const CMsvEntrySelection& aSelection, TInt aMark, TRequestStatus& aStatus);
 protected:
 	IMPORT_C TInt Extension_(TUint aExtensionId, TAny *&a0, TAny *a1);
 
--- a/email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapservermtm/src/cimap4servermtm.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -504,6 +504,65 @@
 
 
 /**
+ChangeEntriesL update the message read/Unread status in  Local and remote, 
+using the IMAP COPY command.
+
+@param aSelection The selection of message TMsvIds that are changed.
+@param aMark The selection marked as read  or unread.If 1 is Unread 0 for read.
+@param aStatus The request status to be completed when the operation has finished.
+*/
+
+TInt CImap4ServerMtm::ChangeEntriesL( const CMsvEntrySelection& aSelection, TInt aMark, TRequestStatus& aStatus ) 
+    {
+    __LOG_TEXT(KDefaultLog, "CImap4ServerMtm::ChangeEntriesL()");
+   
+    TMsvEntry* aNewEntry1 = new (ELeave) TMsvEntry;
+    CleanupStack::PushL(aNewEntry1);
+    
+    TBool flagChanged;
+    
+    if(aMark ==  0) 
+        flagChanged = EFalse; //Selection to update as Read.
+    else
+        flagChanged = ETrue; ////Selection to update as UnRead.
+    
+    TInt count  = aSelection.Count();
+    while(count--)
+        { 
+        iServerEntry->GetEntryFromId(aSelection[count],aNewEntry1);
+        TMsvEmailEntry entry(*aNewEntry1);
+        if(flagChanged)
+             {
+            entry.SetSeenIMAP4Flag(EFalse);
+             }
+         else
+             {
+             entry.SetSeenIMAP4Flag(ETrue);  
+             }
+        //Local Updation.
+        User::LeaveIfError(iServerEntry->SetEntry(entry.Id()));
+        User::LeaveIfError(iServerEntry->ChangeEntry(entry));
+        }
+     //if not offline
+     if (iImapProtocolController->Connected())
+        {
+        //to update read/unread flags at remote server
+        iImapProtocolController->UpdateEntriesFlagL(iStatus,aSelection,flagChanged);    
+        iState= EMtmStateUpdateFlag;
+        Queue(aStatus);
+        SetActive(); 
+        }
+    else
+        {
+        Queue(aStatus);
+        User::RequestComplete(iRequest, KErrNone);
+        }
+    CleanupStack::PopAndDestroy(1); //aNewEntry1
+	return KErrNone;
+    }
+
+
+/**
 Performs the IMAP specific MTM commands.
 
 @param aSelection A selection of messages. The use is dependant upon 
--- a/email/imap4mtm/imapsession/inc/cimapatomparser.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapsession/inc/cimapatomparser.h	Mon Oct 04 00:13:15 2010 +0300
@@ -137,6 +137,7 @@
 	Log id of owning session
 	*/
 	TInt iLogId;
+	TInt iAttachmentLength;
 	};
 
 #endif // __CIMAPATOMPARSER_H__
--- a/email/imap4mtm/imapsession/src/cimapatomparser.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/email/imap4mtm/imapsession/src/cimapatomparser.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -125,6 +125,7 @@
 // Add to the parsed buffer
 void CImapAtomParser::BufferAppendL(const TChar aChar)
 	{
+    ++iAttachmentLength;
 	// Check for internal programming error
 	__ASSERT_DEBUG(iBuffer != NULL, TImapServerPanic::ImapPanic(TImapServerPanic::EAtomParserBufferIsNull));
 	
@@ -337,6 +338,13 @@
 						// Note that the CRLF will already have been stripped out by CImapSession
 						// so we are treating a CR on its own as whitespace
 						{
+						// if white space is there in the attched file's name,it will add to the buffer.
+						if( iAttachmentLength < iLiteralLength)
+						    {
+                            BufferAppendL(octet);
+                            break;
+						    }
+						    
 						AddAtomL();
 					
 						// Either go back to looking for an atom, or a LF
@@ -445,6 +453,7 @@
 			// Skipping...
 			if (--iLiteralSkip==0)
 				{
+                    iAttachmentLength = 0;
 				// Is literal 0 bytes long?
 				if (iLiteralLength==0)
 					{
--- a/layers.sysdef.xml	Fri Sep 17 08:28:39 2010 +0300
+++ b/layers.sysdef.xml	Mon Oct 04 00:13:15 2010 +0300
@@ -13,8 +13,18 @@
               bldFile="&layer_real_source_path;"
               name="messaging"
               proFile="messaging.pro"
-              qmakeArgs="-r" />
+              qmakeArgs="-r" />        
+      <unit unitID="mmssettings" bldFile="&layer_real_source_path;/mmsengine/mmssettings/group" mrp="mmsengine/mmssettings/group/messaging_mmssettings.mrp" name="mmssettings"/>
+    	<unit unitID="mmsconf" bldFile="&layer_real_source_path;/mmsengine/mmsconf" mrp="mmsengine/mmsconf/messaging_mmssettings-config.mrp" name="mmsconf"/>
+      <unit unitID="messagingappbase" bldFile="&layer_real_source_path;/messagingappbase/smilparser/GROUP" mrp="messagingappbase/smilparser/GROUP/messaging_gmxml.mrp" name="messagingappbase"/>
+      <unit unitID="pop3andsmtpmtm" bldFile="&layer_real_source_path;/email/pop3andsmtpmtm/group" mrp="email/pop3andsmtpmtm/group/messaging_email.mrp" name="pop3andsmtpmtm"/>
+      <unit unitID="imap4mtm" bldFile="&layer_real_source_path;/email/imap4mtm/group" mrp="email/imap4mtm/group/messaging_email_imap.mrp" name="imap4mtm"/>
+      <unit unitID="obexmtms" bldFile="&layer_real_source_path;/messagingappbase/obexmtms/Group" mrp="messagingappbase/obexmtms/Group/messaging_obex.mrp" name="obexmtms"/>
+      <unit unitID="smsmtm" bldFile="&layer_real_source_path;/mobilemessaging/smsmtm/group" mrp="mobilemessaging/smsmtm/group/messaging_sms.mrp" name="smsmtm"/>
+
+
       </module>
+     
     </layer>
   </systemModel>
 </SystemDefinition>
Binary file messagingapp/conf/CI_messaging.confml has changed
Binary file messagingapp/conf/messaging.confml has changed
Binary file messagingapp/conf/messaging_101F87EB.crml has changed
Binary file messagingapp/conf/messaging_101F87EC.crml has changed
Binary file messagingapp/conf/messaging_101F87ED.crml has changed
Binary file messagingapp/conf/messaging_101F87EE.crml has changed
Binary file messagingapp/conf/messaging_101F8873.crml has changed
Binary file messagingapp/conf/messaging_101F8F28.crml has changed
Binary file messagingapp/conf/messaging_102072E2.crml has changed
Binary file messagingapp/conf/messaging_102824A0.crml has changed
Binary file messagingapp/conf/messaging_1028281E.crml has changed
--- a/messagingapp/conf/messaging_conf.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/conf/messaging_conf.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -23,19 +23,12 @@
 symbian{
 		BLD_INF_RULES.prj_exports += \
     "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "messaging.confml APP_LAYER_CONFML(messaging.confml)" \    
+    "messaging.confml APP_LAYER_CONFML(messaging.confml)" \
 		"messaging_101F87EB.crml APP_LAYER_CRML(messaging_101F87EB.crml)" \
-		"messaging_101F87EC.crml APP_LAYER_CRML(messaging_101F87EC.crml)" \
-		"messaging_101F87ED.crml APP_LAYER_CRML(messaging_101F87ED.crml)" \
-		"messaging_101F87EE.crml APP_LAYER_CRML(messaging_101F87EE.crml)" \
+		"messaging_101F87ED.crml APP_LAYER_CRML(messaging_101F87ED.crml)" \		
 		"messaging_101F87EF.crml APP_LAYER_CRML(messaging_101F87EF.crml)" \
-		"messaging_101F8873.crml APP_LAYER_CRML(messaging_101F8873.crml)" \
 		"messaging_102071F2.crml APP_LAYER_CRML(messaging_102071F2.crml)" \
-		"messaging_102072E2.crml APP_LAYER_CRML(messaging_102072E2.crml)" \
 		"messaging_102072E5.crml APP_LAYER_CRML(messaging_102072E5.crml)" \
-		"messaging_102824A0.crml APP_LAYER_CRML(messaging_102824A0.crml)" \
-		"messaging_1028281E.crml APP_LAYER_CRML(messaging_1028281E.crml)" \
-		"messaging_101F8F28.crml APP_LAYER_CRML(messaging_101F8F28.crml)" \
 		"backup_registration.xml z:/private/2001FE79/backup_registration.xml"
 		}
 
--- a/messagingapp/msgappfw/client/group/csserverclientapi.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/client/group/csserverclientapi.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -45,3 +45,6 @@
 LIBRARY       csutils.lib
 LIBRARY       eCom.lib
 
+
+
+SMPSAFE
--- a/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -189,7 +189,8 @@
         delete iNotificationBuffer;
         iNotificationBuffer = NULL;
         }
-    iNotificationBuffer = HBufC8::NewL(KBufferMaxLen);
+    // coverity[size_error][buffer_alloc]
+	iNotificationBuffer = HBufC8::NewL(KBufferMaxLen);
     
     if ( iNextReqIDBuffer )
         {
--- a/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -602,7 +602,9 @@
         delete iListResultsBuffer;
         iListResultsBuffer = NULL;
         }
-    iListResultsBuffer = HBufC8::NewL(KBufferMaxLen);
+    
+	// coverity[size_error][buffer_alloc]
+	iListResultsBuffer = HBufC8::NewL(KBufferMaxLen);
     
     // Send the ASYNC request
     iSession.GetConversationListL(iListResultsBuffer->Des(), 
--- a/messagingapp/msgappfw/msghistory/msghistory.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/msghistory.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -62,3 +62,6 @@
 LIBS += -lcsserverclientapi \
         -lcsutils \
         -lxqutils
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -75,3 +75,6 @@
 
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgappfw/plugins/msgplugin/group/csmsg.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/plugins/msgplugin/group/csmsg.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -55,3 +55,6 @@
 LIBRARY         gsmu.lib
 LIBRARY         etext.lib
 LIBRARY         msgs.lib
+
+
+SMPSAFE
--- a/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -76,8 +76,8 @@
 APP_LAYER_SYSTEMINCLUDE
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY efsrv.lib
 
 
@@ -95,4 +95,9 @@
 LANG            SC
 
 
+
+
+
+SMPSAFE
+
 // End of File
--- a/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -66,4 +66,5 @@
 LIBRARY         charconv.lib
 LIBRARY         centralrepository.lib
 LIBRARY         MsgMedia.lib
-LIBRARY         imageconversion.lib
\ No newline at end of file
+LIBRARY         imageconversion.lib
+SMPSAFE
--- a/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -881,7 +881,7 @@
     CleanupClosePushL(file);
 
     //read file contents to buffer
-    TInt length;
+    TInt length = 0;
     file.Size(length);
     HBufC8* bodyText = HBufC8::NewLC(length);
     TPtr8 textBuffer = bodyText->Des();
--- a/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -99,8 +99,8 @@
 LIBRARY                         estor.lib 
 LIBRARY                         euser.lib
 LIBRARY                         flogger.lib
-LIBRARY                         stiftestinterface.lib
-LIBRARY                         stiftestengine.lib
+LIBRARY                         StifTestInterface.lib
+LIBRARY                         StifTestEngine.lib
 LIBRARY                         imcm.lib
 LIBRARY                         msgs.lib
 LIBRARY                         charconv.lib
@@ -119,3 +119,6 @@
 LIBRARY         centralrepository.lib
 LIBRARY         MsgMedia.lib
 
+
+
+SMPSAFE
--- a/messagingapp/msgappfw/server/server.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/server/server.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -91,3 +91,6 @@
         -lxqutils 
         
         
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgappfw/server/src/ccssession.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccssession.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -843,6 +843,7 @@
             }
         }
 
+		// coverity[size_error][buffer_alloc]
         HBufC8* buffer = HBufC8::NewLC(4);
         TPtr8 cntPtr(buffer->Des());
         _LIT8(KFormat,"%d");
--- a/messagingapp/msgappfw/utils/group/csutils.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgappfw/utils/group/csutils.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -39,3 +39,6 @@
 LIBRARY       estor.lib
 //LIBRARY       VPbkEng.lib
 LIBRARY         flogger.lib
+
+
+SMPSAFE
--- a/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -37,4 +37,6 @@
 
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
                              ".\rom\msgerrornotifier.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgerrornotifier.iby)"
-                             
\ No newline at end of file
+                             
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -56,3 +56,6 @@
  		 -lcsserverclientapi \
          -lcsutils \
          -lxqutils
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/inc/msgnotificationdialogwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -29,8 +29,10 @@
 /**
  * Class for sending service request
  */
-class ServiceRequestSenderTask : public QRunnable
+class ServiceRequestSenderTask :public QObject,public QRunnable
 {
+    Q_OBJECT
+    
 public:
     /**
      * Constructor
@@ -47,6 +49,26 @@
      */
      void run();
 
+private slots:
+
+    /**
+     * Slot invoked after Conversation view is launched.
+     */
+     void onRequestCompleted(const QVariant& value);
+     
+    /**
+     * Slot invoked if error occurred during launch of CV.
+     */
+     void onRequestError(int errorCode, const QString& errorMessage);
+          
+signals:
+
+	/**
+	* Signal is emitted to indicate that Notification Dialog 
+	* can now be closed.
+	*/
+     void serviceRequestCompleted();
+     
 private: 
      qint64 mConvId;
 };
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -46,3 +46,6 @@
   "rom/msgnotificationdialogplugin.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(msgnotificationdialogplugin.iby)"
   
 LIBS += -lxqservice
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -38,6 +38,8 @@
 
 static const char NEW_MSG_ICON[] = "qtg_large_new_message";
 
+bool serviceTaskLaunched = false; 
+
 // ----------------------------------------------------------------------------
 // ServiceRequestSenderTask::ServiceRequestSenderTask
 // @see msgnotificationdialogwidget.h
@@ -71,12 +73,33 @@
          {
          return;       
          }
+     connect(request,SIGNAL(requestOk(const QVariant&)),
+             this,SLOT(onRequestCompleted(const QVariant&)));
+     
+     connect(request,SIGNAL(requestError(int, const QString&)),
+             this,SLOT(onRequestError(int, const QString&)));
+     
      args << QVariant(mConvId);
      request->setArguments(args);
+     request->setSynchronous(true);
      request->send();
      delete request;
      }
 
+void ServiceRequestSenderTask::onRequestCompleted(const QVariant& value)
+    {
+	Q_UNUSED(value);
+    serviceTaskLaunched = false;
+    emit serviceRequestCompleted();
+    }
+
+void ServiceRequestSenderTask::onRequestError(int errorCode, const QString& errorMessage)
+    {
+    Q_UNUSED(errorCode);
+    Q_UNUSED(errorMessage);
+    serviceTaskLaunched = false;
+    emit serviceRequestCompleted();
+    }
 
 // ----------------------------------------------------------------------------
 // MsgNotificationDialogWidget::MsgNotificationDialogWidget
@@ -170,12 +193,16 @@
     // Close device dialog
     Q_UNUSED(byClient);
     close();
-    // If show event has been received, close is signalled from hide event. If not,
-    // hide event does not come and close is signalled from here.
-    if (!mShowEventReceived) {
-        emit deviceDialogClosed();
-    }
-    
+
+    if (serviceTaskLaunched == false)
+        {
+        // If show event has been received, close is signalled from hide event. If not,
+        // hide event does not come and close is signalled from here.
+        if (!mShowEventReceived)
+            {
+            emit deviceDialogClosed();
+            }
+        }
 }
 
 // ----------------------------------------------------------------------------
@@ -196,7 +223,10 @@
 void MsgNotificationDialogWidget::hideEvent(QHideEvent *event)
 {
     HbNotificationDialog::hideEvent(event);
-    emit deviceDialogClosed();
+    if (serviceTaskLaunched == false)
+        {
+        emit deviceDialogClosed();
+        }
 }
 
 // ----------------------------------------------------------------------------
@@ -214,10 +244,15 @@
 // @see msgnotificationdialogwidget.h
 // ----------------------------------------------------------------------------
 void MsgNotificationDialogWidget::widgetActivated()
-{
-QThreadPool::globalInstance()->start(
-        	new ServiceRequestSenderTask(mConversationId));
-    enableTouchActivation(false);  
+{           
+    ServiceRequestSenderTask* task = 
+            new ServiceRequestSenderTask(mConversationId);
+    connect(task,SIGNAL(serviceRequestCompleted()),
+            this,SIGNAL(deviceDialogClosed()));
+    serviceTaskLaunched = true;
+    QThreadPool::globalInstance()->start(task);
+    enableTouchActivation(false);
+    
 }
 
 // ----------------------------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -78,3 +78,6 @@
 	    -lssmcmn \
 	    -lhwrmvibraclient
         
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/mmstestbed/mmstestbed.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -95,3 +95,6 @@
         -llogwrap \
         -lapgrfx \
         -lapmime
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/testmmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/unittest_mmsplugin/testmmsplugin/testmmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -176,3 +176,5 @@
 
 
 }
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h	Mon Oct 04 00:13:15 2010 +0300
@@ -116,10 +116,35 @@
     void switchToMsgSettings(const QVariantList& data);
 
     /**
-     * Handle sms and mms messge
-     * @param msgId message id
+     * Show information popup dialog
+     * @param dispText, text to be displayed
+     */
+    void showPopup(const QString& dispText);
+
+    /**
+     * Handle Draft messages
+     * @param msgId, message id
+     * @param msgType, type of message e.g. sms or mms etc
      */
-    void handleSmsMmsMsg(int msgId,int msgType);
+    void handleDraftMsg(int msgId, int msgType);
+
+    /**
+     * Handle Business Card messages (for view)
+     * @param msgId, message id
+     */
+    void handleVCardMsg(int msgId);
+
+    /**
+     * Handle sms and mms message
+     * @param msgId, message id
+     */
+    void handleSmsMmsMsg(int msgId);
+
+    /**
+     * Handle MMS notification message
+     * @param msgId, message id
+     */
+    void handleMmsNotification(int msgId);
 
     /**
      * Handle ringtone message
@@ -138,7 +163,7 @@
      * @param msgId message id
      */
     void handleBTMessage(int msgId);
-    
+
     /**
      * Start a custom effect animation
      * e.g. editor's send effect
@@ -167,7 +192,7 @@
      * @return QString, animation definition file path
      */
     QString getAnimationFile(QString effectEvent);
-    
+
 private slots:
     /**
      * This slot is called on mainwindows back action.
@@ -179,18 +204,12 @@
      * @param data data required to switch the views.
      */
     void switchView(const QVariantList& data);
-    
-	/**
-     * This slot is called delete message dialog launched.
-     * @param action selected action (yes or no).
-     */
-    void onDialogDeleteMsg(HbAction* action);
 
     /**
-     * This slot is called save tone dialog launched.
-     * @param action selected action (yes or no)
+     * This slot sets the current view on view-ready signal of mainwindow.
+     * This is needed to show the default transitions correctly.
      */
-    void onDialogSaveTone(HbAction* action);
+    void showOnViewReady();
     
     /**
      * Handle a custom effect animation complete signal
@@ -239,12 +258,7 @@
     /**
      * Current view value.
      */
-    int mCurrentView;
-    
-	/**
-	 * message Id
-	 */
-    int mMessageId;    
+    int mCurrentView;    
 };
 
 #endif /* MSGSERVICEVIEWMANAGER_H_ */
--- a/messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h	Mon Oct 04 00:13:15 2010 +0300
@@ -20,7 +20,16 @@
 
 // INCLUDE FILES
 #include <msvapi.h>
+#include <ccsdefs.h>
 
+// FORWARD DECLARATIONS
+class CMmsNotificationClientMtm;
+class CClientMtmRegistry;
+
+/**
+ * Class MsgStoreHandler
+ * Reads message information from message store.
+ */
 class MsgStoreHandler : public MMsvSessionObserver
     {
 public:
@@ -34,24 +43,22 @@
      */
     virtual ~MsgStoreHandler();
     
-public :
     /**
-     * @see MMsvSessionObserver
+     * Mark message as read
+     * @param messageId  message Id 
      */
-    void HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
-            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
-    
-public:
+    void markAsRead(int msgId);
+ 
     /**
-     * Mark message as read and get the message type
-     * @param messageId  message Id 
+     * Get message's type (msgtype and msgsubtype) info
+     * @param messageId  message Id
      * @param msgType message type is written to this.
-     * @param msgType message sub type is written to this.
+     * @param msgSubType message sub type is written to this.
      */
-    void markAsReadAndGetType(int msgId,
-                              int& msgType,
-                              int& msgSubType);
- 
+    void getMsgTypeInfo(int msgId,
+                        int& msgType,
+                        int& msgSubType);
+
     /**
      * Delete message.
      * @param msgId id of the message to be deleted.
@@ -64,29 +71,128 @@
      * @return true if it is a draft message,else false
      */
     bool isDraftMessage(int msgId);
+
+    /**
+     * Check if the message is locked to avoid viewing
+     * e.g. Outbox messages should not be opened in viewer
+     * @param msgId id of the message to be checked.
+     * @return bool, true if it is locked
+     */
+    bool locked(int msgId);
+
+    /**
+     * Checks if a message exists or not
+     * @param msgId, message id
+     * @return bool, true if message exists
+     */
+    bool exists(int msgId);
+
+    /**
+     * Sets content to message id
+     * @param msgId, message id
+     * @return int, status of setting context to message id
+     */
+    int setNotificationMessageId(int msgId);
+
+    /**
+     * Seeker method for getting mms notification's subject line
+     * @return QString, subject of mms notification
+     */
+    QString notificationSubject();
+
+    /**
+     * Seeker method for getting mms notification estimated msg size
+     * @return formatted string for msg size in KB
+     */
+    QString notificationMsgSize();
     
+    /**
+     * Seeker method for getting mms notification class type
+     * @return Notification Class type string
+     */
+    QString notificationClass();
+    
+    /**
+     * Seeker method for message status and error string
+     * mms notification's download state
+     * @param [OUT] status, msg status
+     * @param [OUT] statusStr, localized string of msg status
+     */
+    void notificationStatus(int& status,
+                     QString& statusStr);
+    
+    /**
+     * Seeker method getting expiry info of a notification msg
+     * @return formatted string of notification's expiry time
+     */
+    QString notificationExpiryDate();
+
 private:
     /**
+     * @see MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
+            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
+    
+    /**
      * Does all initilaizations
      */
     void InitL();
-    
+
+    /**
+     * Location (parent dir) of the message e.g. Draft, Inbox etc
+     * @param aMsgId, message id
+     * @return TMsvId, parent directory of the message
+     */
+    TMsvId MessageLocation( TMsvId aMsgId ) const;
+
+    /**
+     * Sets content to messageId
+     * @param messageId, Message Id content
+     */
+    void SetNotificationMessageIdL( TMsvId aMsgId );
+
     /**
-     * Extrcats the message type from TMsvEntry
-     * @param aEntry message entry.
-     * @param msgType message type is written to this.
-     * @param msgType message sub type is written to this.
+     * Get max receive size limit (for MMS) from settings
+     */
+    TInt MaxReceiveSizeLimitL();
+
+    /**
+     * Get MMS notification status.
+     * @param aMsvId MMS notification status.
      */
-    void extractMsgType(const TMsvEntry& aEntry,
-                        int& msgType,
-                        int& msgSubType);
-    
+    TCsMmsNotificationMsgState MmsNotificationStatus( TInt aMsvId );
+
+    /**
+     * verifys the current operation status
+     *@param aEntry, TMsvEntry
+     */
+    TBool OperationFinished( const TMsvEntry& aEntry ) const;
+
+    /**
+     * verifys the current operation status
+     * @param aEntry, TMsvEntry
+     */
+    TBool OperationOngoing( const TMsvEntry& aEntry ) const;
+
 private:
     /**
      * Session
      * Owned.
      */
-    CMsvSession* iMsvSession;     
+    CMsvSession* iMsvSession;
+    
+    /**
+     * Notification client mtm
+     * Owned.
+     */
+    CMmsNotificationClientMtm* iNotificationClient;
+
+    /**
+     * Mtm Registry
+     * Owned.
+     */
+    CClientMtmRegistry* iMtmReg;
     };
 
 #endif // __MSG_STORE_HANDLER_H__
--- a/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -62,7 +62,11 @@
         -lunidatamodelloader \
         -lunifiedviewer \
         -lunifiededitor \
-        -lsettingsview
+        -lsettingsview \
+        -lmmsserversettings \
+        -lxqutils \
+        -lQtContacts \
+        -lQtVersit
 	
 
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
@@ -71,3 +75,6 @@
     "resources/messagingsendservice.docml /epoc32/data/z/resource/hb/splashml/messagingsendservice.docml" \
     "resources/messagingviewservice.splashml /epoc32/data/z/resource/hb/splashml/messagingviewservice.splashml" \
     "resources/messagingviewservice.docml /epoc32/data/z/resource/hb/splashml/messagingviewservice.docml"
+    
+symbian:MMP_RULES += SMPSAFE
+
--- a/messagingapp/msgservices/msgserviceapp/src/main.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/main.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -78,10 +78,11 @@
 
 int main(int argc, char **argv)
 {
-    // if else loop to launch the splash screen based on the service called.
-    
+    // Need splashScreen at construction time itself?
+    bool needImmdSplashScreen = true;
+
+    // Decision logic to launch the splash screen based on the service called
     QString serviceName = XQServiceUtil::interfaceName( argc, argv);
-    
     if( !serviceName.compare( QString( "com.nokia.symbian.IMessageSend") ) )
         {
         HbSplashScreen::setScreenId( "sendservice" );
@@ -89,11 +90,14 @@
     else if ( !serviceName.compare( "com.nokia.symbian.IMessageView") )
         {
         HbSplashScreen::setScreenId( "viewservice" );
+        needImmdSplashScreen = false;
         }
-    
-    HbApplication app( argc, argv );
-    
-   //installing translator.
+
+    // Appropriate HbApplication initialization
+    HbApplication app( argc, argv,
+            needImmdSplashScreen? Hb::DefaultApplicationFlags : Hb::NoSplash);
+
+    // Install translator.
     QString locale = QLocale::system().name();
     QTranslator translator;
     QTranslator translator_comm;
@@ -101,12 +105,13 @@
     translator_comm.load(TRANSLATOR_FILE_PATH + QString("common_") + locale);
     app.installTranslator(&translator);
     app.installTranslator(&translator_comm);
+    app.setApplicationName(LOC_TITLE);
 
-    app.setApplicationName(LOC_TITLE);
-    
+    // Create mainwindow, but don't show it just yet.
+    // We shall show the mainwindow at appropriate places later in the code.
     QPointer<MsgServiceWindow> window = new MsgServiceWindow();
-    window->show();
-    
+
+    // Start event-loop
     int rv = app.exec();
     delete window;
     return rv;
--- a/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -17,11 +17,16 @@
 
 #include "msgserviceviewmanager.h"
 
+#include <QFileInfo>
+#include <QDir>
+#include <QFile>
 #include <QPixmap>
 #include <HbMainWindow>
 #include <HbAction>
 #include <HbApplication>
-#include <hbmessagebox.h>
+#include <HbMessageBox>
+#include <HbDeviceMessageBox>
+#include <HbSplashScreen>
 
 #include <xqserviceutil.h>
 #include <xqappmgr.h>
@@ -29,12 +34,12 @@
 #include "msgunieditorview.h"
 #include "unifiedviewer.h"
 #include "msgstorehandler.h"
-
 #include "msgsettingsview.h"
 #include "convergedmessageid.h"
 #include "ringbc.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
 
 // CONSTANTS
 static const char SEND_EFFECT[] = "sendeffect";
@@ -42,7 +47,10 @@
 
 // LOCALIZATION
 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
-#define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
+// TODO: LOC
+#define LOC_DELETED_MESSAGE "Message is deleted"
+#define LOC_CANNOT_OPEN_MESSAGE "Message in outbox. Cannot be opened"
+#define LOC_UNKNOWN_MSG_TYPE "Unknown Message Type"
 
 //----------------------------------------------------------------------------
 // MsgViewInterface::MsgViewInterface
@@ -52,7 +60,7 @@
         HbMainWindow* mainWindow, QObject* parent) :
         QObject(parent), mMainWindow(mainWindow), mUniEditor(NULL),
         mUniViewer(NULL), mSettingsView(NULL), mBackAction(NULL),
-        mStoreHandler(storeHandler),mMessageId(-1)
+        mStoreHandler(storeHandler)
     {
     //creating back action.
     mBackAction = new HbAction(Hb::BackNaviAction, this);
@@ -146,7 +154,6 @@
             switchToUniEditor(editorData);
             break;
             }
-
         case MsgBaseView::MSGSETTINGS:
             {
             switchToMsgSettings(data);
@@ -177,6 +184,7 @@
         const QString displayName)
     {
     Q_UNUSED(contactId);
+    mMainWindow->show();
     ConvergedMessage message;
     ConvergedMessageAddress address;
     address.setAddress(phoneNumber);
@@ -204,6 +212,7 @@
         const QString alias, 
         const QString bodyText)
     {
+    mMainWindow->show();
     ConvergedMessage message;
     ConvergedMessageAddress address;
     address.setAddress(phoneNumber);
@@ -231,10 +240,9 @@
 void MsgServiceViewManager::send(const QVariantMap addressList, 
               const QString bodyText)
     {
-    QStringList phoneNumList = addressList.keys();
- 
-    ConvergedMessageAddressList addrList; 
-	
+    mMainWindow->show();
+    QStringList phoneNumList = addressList.keys(); 
+    ConvergedMessageAddressList addrList;
     int count = phoneNumList.count();
     for( int i = 0; i < count; ++ i )
         {
@@ -267,6 +275,7 @@
 //----------------------------------------------------------------------------
 void MsgServiceViewManager::send(QVariant data)
     {
+    mMainWindow->show();
     ConvergedMessage message;
     ConvergedMessageAttachmentList attachmentList;
     // handle multiple files from sendUI
@@ -298,17 +307,15 @@
 // @see header
 //----------------------------------------------------------------------------
 void MsgServiceViewManager::switchToUniEditor(const QVariantList& editorData)
-    {
+{
     // construct
-    if (!mUniEditor) {
-    mUniEditor = new MsgUnifiedEditorView();
-    mMainWindow->addView(mUniEditor);
-    mUniEditor->setNavigationAction(mBackAction);
-    connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
-            SLOT(switchView(const QVariantList&)));
-    // construct completion : viewReady() signal was not called when 
-    // editor is constructed first time.
-   // mUniEditor->doDelayedConstruction();
+    if (!mUniEditor)
+    {
+        mUniEditor = new MsgUnifiedEditorView();
+        mMainWindow->addView(mUniEditor);
+        mUniEditor->setNavigationAction(mBackAction);
+        connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
+                SLOT(switchView(const QVariantList&)));
     }
     
     // populate
@@ -317,77 +324,131 @@
     // set current view as editor
     mMainWindow->setCurrentView(mUniEditor);
     mCurrentView = MsgBaseView::UNIEDITOR;
-    }
+}
 
 //----------------------------------------------------------------------------
 // MsgServiceViewManager::switchToMsgSettings
 // @see header
 //----------------------------------------------------------------------------
 void MsgServiceViewManager::switchToMsgSettings(const QVariantList& data)
-    {
+{
     MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
     
     if (mCurrentView == MsgBaseView::UNIEDITOR)
     {
         view = (MsgSettingsView::SettingsView)data.at(2).toInt();
     }
-    
+
     mCurrentView = MsgBaseView::MSGSETTINGS;
 
-    if (!mSettingsView) {        
-    mSettingsView = new MsgSettingsView(view);
-    mSettingsView->setNavigationAction(mBackAction);
-    mMainWindow->addView(mSettingsView);
+    if (!mSettingsView)
+    {        
+        mSettingsView = new MsgSettingsView(view);
+        mSettingsView->setNavigationAction(mBackAction);
+        mMainWindow->addView(mSettingsView);
     }
     mMainWindow->setCurrentView(mSettingsView);
-    }
+}
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::showPopup
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::showPopup(const QString& dispText)
+{
+    HbDeviceMessageBox msgbox;
+    msgbox.setMessageBoxType(HbMessageBox::MessageTypeInformation);
+    msgbox.setText(dispText);
+    msgbox.setAction(NULL, HbDeviceMessageBox::AcceptButtonRole);
+    msgbox.exec();
+    msgbox.close();
+}
 
 //----------------------------------------------------------------------------
 // MsgServiceViewManager::view
 // @see header
 //----------------------------------------------------------------------------
 void MsgServiceViewManager::view(int msgId)
+{
+    // Check if the message is present in store
+    if(!mStoreHandler->exists(msgId))
     {
+        showPopup(LOC_DELETED_MESSAGE);
+        HbApplication::quit();
+        return;
+    }
+
+    // Check if the given message is locked for viewing
+    if(mStoreHandler->locked(msgId))
+    {
+        // if locked, then show info-note and exit
+        showPopup(LOC_CANNOT_OPEN_MESSAGE);
+        HbApplication::quit();
+        return;
+    }
+
+    // Mark as read and get message type
     int msgType;
-    int msgSubType;
-   
-    mMessageId = msgId;
-    // Mark as read and get message type
-    mStoreHandler->markAsReadAndGetType(msgId,msgType,msgSubType);
-    
-    switch (msgType) {
+    int msgSubType;   
+    mStoreHandler->markAsRead(msgId);
+    mStoreHandler->getMsgTypeInfo(msgId,msgType,msgSubType);
+
+    // Open draft message in editor
+    if(mStoreHandler->isDraftMessage(msgId))
+    {
+        handleDraftMsg(msgId,msgType);
+        return;
+    }
+
+    switch (msgType) 
+    {
         case ConvergedMessage::Sms:
         case ConvergedMessage::Mms:
-        case ConvergedMessage::MmsNotification:
+        {
+            if (msgSubType == ConvergedMessage::VCard)
             {
-            handleSmsMmsMsg(msgId,msgType);
-            break;
+                handleVCardMsg(msgId);
             }
-        case ConvergedMessage::BioMsg:
+            else
             {
-            if (msgSubType == ConvergedMessage::RingingTone) {
-            handleRingtoneMsg(msgId);
-            }
-            else if (msgSubType == ConvergedMessage::Provisioning) {
-            handleProvisoningMsg(msgId);
+                handleSmsMmsMsg(msgId);    
             }
             break;
+        }
+        case ConvergedMessage::MmsNotification:
+        {
+            handleMmsNotification(msgId);
+            break;
+        }
+        case ConvergedMessage::BioMsg:
+        {
+            if (msgSubType == ConvergedMessage::RingingTone)
+            {
+                handleRingtoneMsg(msgId);
             }
+            else if (msgSubType == ConvergedMessage::Provisioning)
+            {
+                handleProvisoningMsg(msgId);
+            }
+            else if (msgSubType == ConvergedMessage::VCard)
+            {
+                handleVCardMsg(msgId);
+            }
+            break;
+        }
         case ConvergedMessage::BT:
-            {
+        {
             handleBTMessage(msgId);
             break;
-            }
+        }
         default:
-            {
-            // for un supported message show delete option
-            HbMessageBox::question(LOC_DELETE_MESSAGE, 
-                                   this,SLOT(onDialogDeleteMsg(HbAction*)),    
-                                   HbMessageBox::Delete | HbMessageBox::Cancel);
-            break;
-            }
+        {
+            // For all remaining unsupported messages, show delete option
+            showPopup(LOC_UNKNOWN_MSG_TYPE);
+            HbApplication::quit();
+        }
     }
-    }
+}
 
 // ----------------------------------------------------------------------------
 // MsgServiceViewManager::handleKeyEvent
@@ -404,66 +465,196 @@
 }
 
 // ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleDraftMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleDraftMsg(int msgId, int msgType)
+{
+    // show the splash-screen
+    // TODO: This causes cancellation of view switching effects
+//    HbSplashScreen::start();
+    connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(showOnViewReady()));
+    mCurrentView = MsgBaseView::UNIEDITOR;
+
+    // construct editor instance (keep it minimal)
+    if (!mUniEditor)
+    {
+        mUniEditor = new MsgUnifiedEditorView();
+        mMainWindow->addView(mUniEditor);
+        mUniEditor->setNavigationAction(mBackAction);
+        connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
+                SLOT(switchView(const QVariantList&)));
+    }
+
+    // prepare data for unieditor
+    ConvergedMessage message;
+    ConvergedMessageId convergedMsgId = ConvergedMessageId(msgId);
+    message.setMessageType((ConvergedMessage::MessageType) msgType);
+    message.setMessageId(convergedMsgId);
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    QVariantList editorData;
+    editorData << dataArray;
+
+    mMainWindow->show();
+    // populate data into editor
+    mUniEditor->openDraftsMessage(editorData);
+}
+
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleVCardMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleVCardMsg(int msgId)
+{
+    // Extract vCard filepath
+    QString filepath;
+    UniDataModelLoader* pluginLoader = new UniDataModelLoader();
+    UniDataModelPluginInterface* pluginInterface = 
+                    pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+    pluginInterface->setMessageId(msgId);
+
+    // Get attachment list
+    UniMessageInfoList attachments = pluginInterface->attachmentList();
+    if(attachments.count() > 0)
+    {
+        filepath = attachments.at(0)->path();    
+    }
+
+    // Cleanup
+    foreach(UniMessageInfo* attachmentInfo,attachments)
+    {
+        delete attachmentInfo;
+    }
+    delete pluginLoader;
+
+    // Get vCard display name
+    QString displayName = MsgContactHandler::getVCardDisplayName(filepath);
+    // TODO: use displayname to create a localized string to show in dialog
+    QString loc_str = QString("Save to contacts: ").append(displayName);
+    bool viewVCard = HbDeviceMessageBox::question(loc_str,
+                         HbMessageBox::Ok|HbMessageBox::Cancel);
+    if(!viewVCard)
+    {
+        HbApplication::quit();
+        return;
+    }
+
+    // copy private-vCard file to public location for contacts access
+    QDir tempDir;
+    QString sharedFilePath(QDir::toNativeSeparators(tempDir.tempPath()));
+    sharedFilePath.append(QDir::separator());
+    QFileInfo fInfo(filepath);
+    sharedFilePath.append(fInfo.fileName());
+    QFile::copy(filepath, sharedFilePath);
+
+    // Launch vCard viewer service
+    QString service("phonebookservices");
+    QString interface("com.nokia.symbian.IContactsEdit");
+    QString operation("editCreateNewFromVCard(QString)");
+    XQApplicationManager appManager;
+    // embedded launch
+    XQAiwRequest* request = 
+            appManager.create(service, interface, operation, true);
+    if(request)
+    {
+        QList<QVariant> args;
+        args << sharedFilePath;
+        request->setArguments(args);
+        QVariant retValue;
+        bool res = request->send(retValue);
+        delete request;
+    }
+
+    // Delete shared file now
+    QFile::remove(sharedFilePath);
+    HbApplication::quit();
+}
+
+// ----------------------------------------------------------------------------
 // MsgServiceViewManager::handleSmsMmsMsg
 // @see header
 // ----------------------------------------------------------------------------
-void MsgServiceViewManager::handleSmsMmsMsg(int msgId,int msgType)
+void MsgServiceViewManager::handleSmsMmsMsg(int msgId)
 {
-    if(mStoreHandler->isDraftMessage(msgId))
+    // show the splash-screen
+    // TODO: This causes cancellation of view switching effects
+//    HbSplashScreen::start();
+    connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(showOnViewReady()));
+    mCurrentView = MsgBaseView::UNIVIEWER;
+
+    // construct viewer instance (keep it minimal)
+    if(!mUniViewer)
     {
-        ConvergedMessageId convergedMsgId = ConvergedMessageId(msgId);
-        ConvergedMessage message;
-        message.setMessageType((ConvergedMessage::MessageType) msgType);
-        message.setMessageId(convergedMsgId);
+        mUniViewer = new UnifiedViewer(msgId);
+        mMainWindow->addView(mUniViewer);
+        mUniViewer->setNavigationAction(mBackAction);
+        connect(mUniViewer, SIGNAL(switchView(const QVariantList&)),
+                        this, SLOT(switchView(const QVariantList&)));
+    }
+
+    // populate the viewer
+    mUniViewer->populateContent(msgId, true, 1);
+    mMainWindow->show();
+}
+
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleMmsNotification
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleMmsNotification(int msgId)
+{
+    // set context to current entry
+    if( KErrNone != mStoreHandler->setNotificationMessageId(msgId))
+    {
+        return;
+    }
 
-        // Launch uni-editor view
-        QByteArray dataArray;
-        QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
-        message.serialize(messageStream);
+    // notification state e.g. waiting, retrieving etc
+    QString statusStr;
+    int status;
+    mStoreHandler->notificationStatus(status, statusStr);
 
-        QVariantList params;
-        params << MsgBaseView::UNIEDITOR; // target view
-        params << MsgBaseView::SERVICE; // source view
+    QString displayTxt;
+    displayTxt.append(mStoreHandler->notificationSubject());
+    displayTxt.append(QChar::LineSeparator);
+    displayTxt.append(mStoreHandler->notificationMsgSize());
+    displayTxt.append(QChar::LineSeparator);
+    displayTxt.append(mStoreHandler->notificationClass());
+    displayTxt.append(QChar::LineSeparator);
+    displayTxt.append(mStoreHandler->notificationExpiryDate());
+    if(!statusStr.isEmpty())
+    {
+        displayTxt.append(QChar::LineSeparator);
+        displayTxt.append(statusStr);
+    }    
+    HbDeviceMessageBox::information(displayTxt);
+    HbApplication::quit();
+}
 
-        params << dataArray;
-        
-        // except first 2 parameters pass other parameters
-        QVariantList editorData;
-        for(int a = 2; a < params.length(); ++a)
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::showOnViewReady
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::showOnViewReady()
+{
+    switch(mCurrentView)
+    {
+        case MsgBaseView::UNIVIEWER:
         {
-            editorData << params.at(a);
+            mMainWindow->setCurrentView(mUniViewer);
+            break;
         }
-        // construct
-          if (!mUniEditor) {
-          mUniEditor = new MsgUnifiedEditorView();
-          mMainWindow->addView(mUniEditor);
-          mUniEditor->setNavigationAction(mBackAction);
-          connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
-                  SLOT(switchView(const QVariantList&)));
-          }
-          
-          // check if additional data for unieditor's consumption is available
-          mUniEditor->openDraftsMessage(editorData);
-
-          mMainWindow->setCurrentView(mUniEditor);
-          mCurrentView = MsgBaseView::UNIEDITOR;
+        case MsgBaseView::UNIEDITOR:
+        {
+            mMainWindow->setCurrentView(mUniEditor);
+            break;
+        }
+        default:
+            break;
     }
-    else
-    {
-        if (!mUniViewer) {
-            mUniViewer = new UnifiedViewer(msgId);
-            mUniViewer->setNavigationAction(mBackAction);
-            mMainWindow->addView(mUniViewer);
-            connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
-                SLOT(switchView(const QVariantList&)));
-        }
-        mUniViewer->populateContent(msgId, true, 1);
-
-        mMainWindow->setCurrentView(mUniViewer);
-
-        // set current view as viewer
-        mCurrentView = MsgBaseView::UNIVIEWER;
-    }
+    disconnect(mMainWindow, SIGNAL(viewReady()), this, SLOT(showOnViewReady()));
 }
 
 // ----------------------------------------------------------------------------
@@ -471,12 +662,41 @@
 // @see header
 // ----------------------------------------------------------------------------
 void MsgServiceViewManager::handleRingtoneMsg(int msgId)
+{
+    // Extract rintone filepath
+    UniDataModelLoader* pluginLoader = new UniDataModelLoader();
+    UniDataModelPluginInterface* pluginInterface = 
+                        pluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+    pluginInterface->setMessageId(msgId);
+
+    // Get attachment list
+    UniMessageInfoList attachments = pluginInterface->attachmentList();
+    QString filepath;
+    if(attachments.count() > 0)
     {
-    mMessageId = msgId;
-    HbMessageBox::question(LOC_DLG_SAVE_RINGTONE, this,
-                           SLOT(onDialogSaveTone(HbAction*)),
-                           HbMessageBox::Save | HbMessageBox::Cancel);
+        filepath = attachments.at(0)->path();
+    }
+
+    // Cleanup
+    foreach(UniMessageInfo* attachmentInfo,attachments)
+    {
+        delete attachmentInfo;
     }
+    delete pluginLoader;
+
+    RingBc* ringBc = new RingBc();
+    QString filename = ringBc->toneTitle(filepath);
+    // TODO: use filename to create a localized string to show in dialog
+    QString loc_str = QString("Save ringtone? ").append(filename);
+    bool save = HbDeviceMessageBox::question(loc_str,
+                    HbMessageBox::Save | HbMessageBox::Cancel);
+    if(save)
+    {
+        ringBc->saveTone(filepath);
+    }
+    delete ringBc;
+    HbApplication::quit();
+}
 
 // ----------------------------------------------------------------------------
 // MsgServiceViewManager::handleProvisoningMsg
@@ -541,53 +761,6 @@
     }
 
 //-----------------------------------------------------------------------------
-//MsgServiceViewManager::onDialogDeleteMsg()
-//@see header
-//-----------------------------------------------------------------------------
-void MsgServiceViewManager::onDialogDeleteMsg(HbAction* action)
-{
-    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
-    if (action == dlg->actions().at(0)) {
-        mStoreHandler->deleteMessage(mMessageId);
-    }
-    HbApplication::quit(); // exit after handling
-}
-
-//-----------------------------------------------------------------------------
-//MsgServiceViewManager::onDialogSaveTone()
-//@see header
-//-----------------------------------------------------------------------------
-
-void MsgServiceViewManager::onDialogSaveTone(HbAction* action)
-    {
-        HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
-        if (action == dlg->actions().at(0)) {
-
-            UniDataModelLoader* pluginLoader = new UniDataModelLoader();
-            UniDataModelPluginInterface* pluginInterface = pluginLoader->getDataModelPlugin(
-                ConvergedMessage::BioMsg);
-            pluginInterface->setMessageId(mMessageId);
-            UniMessageInfoList attachments = pluginInterface->attachmentList();
-
-            QString attachmentPath = attachments.at(0)->path();
-
-            RingBc* ringBc = new RingBc();
-            ringBc->saveTone(attachmentPath);
-
-            // clear attachement list : its allocated at data model
-            while (!attachments.isEmpty()) {
-                delete attachments.takeFirst();
-            }
-
-            delete ringBc;
-            delete pluginLoader;
-        }
-
-        // close the application once its handled
-        HbApplication::quit();
-}
-
-//-----------------------------------------------------------------------------
 //MsgServiceViewManager::startAnimation
 //@see header
 //-----------------------------------------------------------------------------
@@ -715,10 +888,10 @@
 
 void MsgServiceViewManager::send(ConvergedMessage message)
     {
+    mMainWindow->show();    
     QVariantList param;
     QByteArray dataArray;
     QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
-    
     message.serialize(messageStream);
     param << dataArray;
 
--- a/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -16,99 +16,175 @@
  */
 
 #include <msvids.h>
+#include <msvstd.h>
 #include <mmsconst.h>
 #include <SendUiConsts.h>
+#include <mtclreg.h>    // for CClientMtmRegistry
+#include <mmsnotificationclient.h>
+#include <mmssettings.h>
+#include <xqconversions.h> // from xqutils
+#include <mmsconst.h>
+#include <QDateTime>
+#include <hbglobal.h>
 
 #include "msgstorehandler.h"
 #include "msgbiouids.h"
 #include "convergedmessage.h"
 
+// CONSTANTS
+_LIT(KUnixEpoch, "19700000:000000.000000");
+#define BYTES_TO_KBYTES_FACTOR 1024
+
+// LOCALIZATION
+// TODO : use dialog localizations
+#define LOC_MESSAGE_SIZE hbTrId("txt_messaging_list_size")
+#define LOC_CLASS_ADVERTISEMENT hbTrId("txt_messaging_list_advertisement")
+#define LOC_CLASS_INFORMATIONAL hbTrId("txt_messaging_list_informational")
+#define LOC_CLASS_PERSONAL hbTrId("txt_messaging_list_personal")
+#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
+#define LOC_MMS_NOTIF_EXPIRED hbTrId("txt_messaging_list_message_expired")  
+#define LOC_MMS_WAITING hbTrId("txt_wireframe_list_multimedia_message_waiting")
+#define LOC_MMS_RETRIEVING hbTrId("txt_messaging_list_retrieving_message")   
+#define LOC_MMS_EXPIRY_DATE hbTrId("txt_messaging_list_expiry_date")
+
 //----------------------------------------------------------------------------
 // MsgStoreHandler::MsgStoreHandler
 // @see header
 //----------------------------------------------------------------------------
 MsgStoreHandler::MsgStoreHandler():
-iMsvSession(NULL)
-        {
-        InitL();
-        }
+iMsvSession(NULL), iNotificationClient(NULL), iMtmReg(NULL)
+{
+    InitL();
+}
 
 //----------------------------------------------------------------------------
 // MsgStoreHandler::~MsgStoreHandler
 // @see header
 //----------------------------------------------------------------------------
 MsgStoreHandler::~MsgStoreHandler()
+{
+    if(iNotificationClient)
     {
-    if(iMsvSession)
-        {
-        delete iMsvSession;
-        iMsvSession = NULL;
-        }
-    }
-
-//----------------------------------------------------------------------------
-// MsgStoreHandler::InitL
-// @see header
-//----------------------------------------------------------------------------
-void MsgStoreHandler::InitL( )
-    {
-    iMsvSession = CMsvSession::OpenSyncL(*this);
+        delete iNotificationClient;
+        iNotificationClient = NULL;
     }
 
-//----------------------------------------------------------------------------
-// MsgStoreHandler::markAsReadAndGetType
-// @see header
-//----------------------------------------------------------------------------
-void MsgStoreHandler::markAsReadAndGetType(int msgId,
-                                          int& msgType,
-                                          int& msgSubType)
+    if(iMtmReg)
     {
-    msgType = ConvergedMessage::None;
-    
-    CMsvEntry* cEntry = NULL;
-    TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
-    if ( err == KErrNone)
-        {
-        TMsvEntry entry = cEntry->Entry();
-        if ( entry.Unread() ) 
-            {
-            // Mark the entry as read
-            entry.SetUnread( EFalse );
-            cEntry->ChangeL( entry );
-            }
-        // extract message type
-        extractMsgType(entry,msgType,msgSubType);
-        }
-    
-    delete cEntry;
+        delete iMtmReg;
+        iMtmReg = NULL;
     }
 
+    if(iMsvSession)
+    {
+        delete iMsvSession;
+        iMsvSession = NULL;
+    }
+}
+
 //----------------------------------------------------------------------------
 // MsgStoreHandler::HandleSessionEventL
 // @see header
 //----------------------------------------------------------------------------
 void MsgStoreHandler::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
         TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
-    {
+{
     // Nothing to do
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::InitL
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::InitL()
+{
+    TInt err = KErrNone;
+    TRAP(err,iMsvSession = CMsvSession::OpenSyncL(*this));
+    if(err != KErrNone)
+    {
+        iMsvSession = NULL;
+        return;
     }
 
+    TRAP(err,iMtmReg = CClientMtmRegistry::NewL(*iMsvSession));
+    if(err != KErrNone)
+    {
+        iMtmReg = NULL;
+        return;
+    }
+}
+
 //----------------------------------------------------------------------------
-// MsgStoreHandler::extractMsgType
+// MsgStoreHandler::MessageLocation
+// @see header
+//----------------------------------------------------------------------------
+TMsvId MsgStoreHandler::MessageLocation( TMsvId aMsgId ) const
+{
+    TMsvId parent = NULL;
+    CMsvEntry* cEntry = NULL;
+    TRAPD(err, cEntry = iMsvSession->GetEntryL(aMsgId));
+    if(err == KErrNone)
+    {
+        TMsvEntry msvEntry = cEntry->Entry();
+        parent = msvEntry.Parent();
+    }
+    delete cEntry;
+    return parent;
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::markAsRead
 // @see header
 //----------------------------------------------------------------------------
-void MsgStoreHandler::extractMsgType(const TMsvEntry& entry,
-                                    int& msgType,
-                                    int& msgSubType)
+void MsgStoreHandler::markAsRead(int msgId)
+{
+    CMsvEntry* cEntry = NULL;
+    TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
+    if(err == KErrNone)
     {
+        TMsvEntry entry = cEntry->Entry();
+        if ( entry.Unread() ) 
+        {
+            // Mark the entry as read
+            entry.SetUnread( EFalse );
+            cEntry->ChangeL( entry );
+        }
+    }
+    delete cEntry;
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::getMsgTypeInfo
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::getMsgTypeInfo(int msgId,
+                                     int& msgType,
+                                     int& msgSubType)
+{
     msgType = ConvergedMessage::None;
     msgSubType = ConvergedMessage::None;
 
+    CMsvEntry* cEntry = NULL;
+    TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
+    if(err != KErrNone)
+    {
+        // error in getting the entry, return back
+        delete cEntry;
+        return;
+    }
+
+    TMsvEntry entry = cEntry->Entry();
     switch(entry.iMtm.iUid)   
+    {
+        case KSenduiMtmSmsUidValue:
         {
-        case KSenduiMtmSmsUidValue:            
             msgType = ConvergedMessage::Sms;
+            if (entry.iBioType == KMsgBioUidVCard.iUid)
+            {
+                msgSubType = ConvergedMessage::VCard;
+            }
             break;
+        }
         case KSenduiMtmBtUidValue:
             msgType = ConvergedMessage::BT;
             break;
@@ -119,78 +195,426 @@
             msgType = ConvergedMessage::MmsNotification;
             break;
         case KSenduiMtmBioUidValue:
-            { 
-        if (entry.iMtmData1 == KSenduiMtmBtUidValue) 
-		{
-            msgType = ConvergedMessage::BT;
+        {
+            if (entry.iMtmData1 == KSenduiMtmBtUidValue) 
+            {
+                msgType = ConvergedMessage::BT;
+                if (entry.iBioType == KMsgBioUidVCard.iUid) 
+                {
+                    msgSubType = ConvergedMessage::VCard;
+                }
+                else if (entry.iBioType == KMsgBioUidVCalendar.iUid) 
+                {
+                    msgSubType = ConvergedMessage::VCal;
+                }
+                break;
+            }
 
-            if (entry.iBioType == KMsgBioUidVCard.iUid) 
-			{
+            msgType = ConvergedMessage::BioMsg;
+            // based on the biotype uid set message type
+            if(entry.iBioType == KMsgBioUidRingingTone.iUid)
+            {
+                msgSubType = ConvergedMessage::RingingTone;
+            }
+            else if(entry.iBioType == KMsgBioProvisioningMessage.iUid)
+            {
+                msgSubType = ConvergedMessage::Provisioning;
+            }     
+            else if (entry.iBioType == KMsgBioUidVCard.iUid)
+            {
                 msgSubType = ConvergedMessage::VCard;
             }
-            else if (entry.iBioType == KMsgBioUidVCalendar.iUid) 
-			{
+            else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
+            {
                 msgSubType = ConvergedMessage::VCal;
-            }
-
+            }        
             break;
         }
-            msgType = ConvergedMessage::BioMsg; 
-
-            // based on the biotype uid set message type
-            if(entry.iBioType == KMsgBioUidRingingTone.iUid)
-                {
-                msgSubType = ConvergedMessage::RingingTone;
-                }
-            else if(entry.iBioType == KMsgBioProvisioningMessage.iUid)
-                {
-                msgSubType = ConvergedMessage::Provisioning;
-                }     
-            else if (entry.iBioType == KMsgBioUidVCard.iUid)
-                {
-                msgSubType = ConvergedMessage::VCard;
-                }
-            else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
-                {
-                msgSubType = ConvergedMessage::VCal;
-                }        
-            }
-            break;
         default:
             msgType = ConvergedMessage::None;       
             break;
-        }
     }
+    delete cEntry;
+}
 
 //----------------------------------------------------------------------------
 // MsgStoreHandler::deleteMessage
 // @see header
 //----------------------------------------------------------------------------
 void MsgStoreHandler::deleteMessage(int msgId)
-    {
+{
     iMsvSession->RemoveEntry(msgId);
-    }
+}
 
 //----------------------------------------------------------------------------
 // MsgStoreHandler::isDraftMessage
 // @see header
 //----------------------------------------------------------------------------
 bool MsgStoreHandler::isDraftMessage(int msgId)
-{       
-    bool draftmsg = false;
+{
+    return (KMsvDraftEntryIdValue == MessageLocation(msgId));
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::locked
+// @see header
+//----------------------------------------------------------------------------
+bool MsgStoreHandler::locked(int msgId)
+{
+    bool msglocked = false;
+    CMsvEntry* cEntry = NULL;
+    TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
+    if(err != KErrNone)
+    {
+        // error in getting the entry e.g. already deleted message
+        msglocked = true;
+    }
+    else
+    {
+        // Outbox messages are locked and hence cann't be viewed.
+        // However, make an exception for failed messages.
+        TMsvEntry entry = cEntry->Entry();
+        if( (KMsvGlobalOutBoxIndexEntryIdValue == entry.Parent()) && 
+            (KMsvSendStateFailed != entry.SendingState()) )
+        {
+            msglocked = true;
+        }
+    }
+    delete cEntry;
+    return msglocked;
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::exists
+// @see header
+//----------------------------------------------------------------------------
+bool MsgStoreHandler::exists(int msgId)
+{
+    bool msgexists = true;
     CMsvEntry* cEntry = NULL;
     TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
-    if ( err == KErrNone)
+    if(err != KErrNone)
+    {
+        // error in getting the entry e.g. already deleted message
+        msgexists = false;
+    }
+    delete cEntry;
+    return msgexists;
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::setNotificationMessageId
+// @see header
+//----------------------------------------------------------------------------
+int MsgStoreHandler::setNotificationMessageId(int msgId)
+{
+    TRAPD(err, SetNotificationMessageIdL(msgId));
+    return err;
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::SetNotificationMessageIdL
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::SetNotificationMessageIdL( TMsvId aMsgId )
+{
+    // get MMS Notification client mtm & set the content to current entry
+    if(iNotificationClient)
+    {
+        delete iNotificationClient;
+        iNotificationClient = NULL;
+    }
+    iNotificationClient = static_cast<CMmsNotificationClientMtm*>( 
+                    iMtmReg->NewMtmL( KUidMsgMMSNotification ));
+    iNotificationClient->SwitchCurrentEntryL(aMsgId);
+    iNotificationClient->LoadMessageL();
+}
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::MaxReceiveSizeLimitL
+// @see header
+//----------------------------------------------------------------------------
+TInt MsgStoreHandler::MaxReceiveSizeLimitL()
+{
+    CMmsSettings* settings = CMmsSettings::NewL();
+    CleanupStack::PushL( settings );
+    iNotificationClient->RestoreSettingsL();
+    settings->CopyL( iNotificationClient->MmsSettings() );
+    TInt maxSize = static_cast<TInt>(settings->MaximumReceiveSize() );
+    CleanupStack::PopAndDestroy( settings );
+    return maxSize;
+}
+
+// ---------------------------------------------------------
+// MsgStoreHandler::MmsNotificationStatus
+// @see header
+// ---------------------------------------------------------
+TCsMmsNotificationMsgState 
+MsgStoreHandler::MmsNotificationStatus( TInt aMsvId )
+{
+    TMsvId dummy = 0x0;
+
+    TMsvEntry entry;
+    iMsvSession->GetEntry(aMsvId, dummy, entry);
+
+    TCsMmsNotificationMsgState status = EMsgStatusNull;
+
+    TTime currentTime;
+    currentTime.HomeTime( );
+    TTime expiryTime = iNotificationClient->ExpiryDate( );
+    TLocale locale;
+    expiryTime += locale.UniversalTimeOffset();
+    if (locale.QueryHomeHasDaylightSavingOn())          
     {
-        TMsvEntry msvEntry = cEntry->Entry();
-        TMsvId parent = msvEntry.Parent();
-        if(parent == KMsvDraftEntryIdValue)
+        TTimeIntervalHours daylightSaving(1);          
+        expiryTime += daylightSaving;
+    }
+
+    // operationMask includes operation type. It is not bitmap but ordinal number. 
+    // It does not include operation status and result
+    TInt operationMask = (entry.iMtmData2 & KMmsOperationIdentifier) ;
+
+    // Note! Ongoing operation resets every bit of operation type, operation status
+    // and result. E.g. If message has been forwarded and then fetching starts, 
+    // information about forwarding is lost
+
+    if( ( entry.iMtmData1 & KMmsMessageTypeMask ) == KMmsMessageMNotificationInd )
         {
-            draftmsg = true;  
+        if(     operationMask == KMmsOperationFetch 
+                &&  OperationOngoing( entry ) )
+            { 
+            // It's in retrieving state
+            status = EMsgStatusRetrieving;
+            }
+        else if(    operationMask == KMmsOperationForward
+                &&  OperationOngoing( entry ) )
+            { 
+            // It's in forwarding state
+            status = EMsgStatusForwarding;
+            }
+        else if(    operationMask == KMmsOperationForward
+                &&  OperationFinished( entry )
+                &&  !( entry.iMtmData2 & KMmsOperationResult ) )
+            { 
+            // It's been forwarded succesfully
+            status = EMsgStatusForwarded;
+            }
+        else if(    operationMask == KMmsOperationFetch 
+                &&  OperationFinished( entry )
+                &&   (  entry.iMtmData2 & KMmsOperationResult 
+                ||  entry.iError ) )
+            { 
+            // Fetch has been failed
+            status = EMsgStatusFailed;
+            }
+        else if(    operationMask == KMmsOperationDelete
+                &&  OperationFinished( entry )
+                &&  !( entry.iMtmData2 & KMmsOperationResult ) )
+            { 
+            // It's been deleted succesfully
+            status = EMsgStatusDeleted;
+            }
+        else if( currentTime > expiryTime )
+            {
+            status = EMsgStatusExpired;
+            }
+        else 
+            {   // Normal waiting state
+            status = EMsgStatusReadyForFetching;
+            }
+        }
+
+    return status;
+}
+
+// ---------------------------------------------------------
+// MsgStoreHandler::OperationOngoing
+// @see header
+// ---------------------------------------------------------
+TBool MsgStoreHandler::OperationOngoing( 
+        const TMsvEntry& aEntry ) const
+    {
+    return (    aEntry.iMtmData2 & KMmsOperationOngoing 
+            &&  !( aEntry.iMtmData2 & KMmsOperationFinished ) );
+    }
+
+// ---------------------------------------------------------
+// MsgStoreHandler::OperationFinished
+// @see header
+// ---------------------------------------------------------
+TBool MsgStoreHandler::OperationFinished( 
+    const TMsvEntry& aEntry ) const
+    {
+    return (    aEntry.iMtmData2 & KMmsOperationFinished
+            &&  !( aEntry.iMtmData2 & KMmsOperationOngoing ) );
+    }
+
+//---------------------------------------------------------------
+// MsgStoreHandler::notificationSubject
+// @see header
+//---------------------------------------------------------------
+QString MsgStoreHandler::notificationSubject()
+{
+    QString subject;
+    if(iNotificationClient)
+    {
+        TPtrC sub =  iNotificationClient->SubjectL();
+        subject = XQConversions::s60DescToQString(sub);
+    }
+    return subject;
+}
+//---------------------------------------------------------------
+// MsgStoreHandler::notificationMsgSize
+// @see header
+//---------------------------------------------------------------
+QString MsgStoreHandler::notificationMsgSize()
+{
+    // Null check
+    if(!iNotificationClient)
+    {
+        return LOC_MESSAGE_SIZE.arg(0);
+    }
+
+    // Size of message.
+    TInt size = iNotificationClient->MessageTransferSize();
+
+    // read max receive size limit from settings
+    TInt maxSize = 0;
+    TRAP_IGNORE(maxSize = MaxReceiveSizeLimitL());
+
+    // apply max size limit rule
+    if( maxSize > 0 )
+    {
+        if( size > maxSize )
+        {
+            size = maxSize;
         }
     }
 
-    delete cEntry;
-    return draftmsg;
+    TInt fileSize = size / BYTES_TO_KBYTES_FACTOR;
+    if ( size % BYTES_TO_KBYTES_FACTOR )
+    {
+        fileSize++;
+    }
+
+    return LOC_MESSAGE_SIZE.arg(fileSize);
+}
+
+//---------------------------------------------------------------
+// MsgStoreHandler::notificationClass
+// @see header
+//---------------------------------------------------------------
+QString MsgStoreHandler::notificationClass()
+{
+    QString notificationClass;
+    // Null Check
+    if(!iNotificationClient)
+    {
+        return notificationClass;
+    }
+
+    TInt msgClass = iNotificationClient->MessageClass( );
+    switch( msgClass )
+    {
+        case EMmsClassPersonal:
+        {
+            notificationClass = LOC_CLASS_PERSONAL;
+            break;
+        }
+        case EMmsClassAdvertisement:
+        {
+            notificationClass = LOC_CLASS_ADVERTISEMENT;
+            break;
+        }
+        case EMmsClassInformational:
+        {
+            notificationClass = LOC_CLASS_INFORMATIONAL;
+            break;
+        }
+        default:
+        {   // In case no class is returned (0), don't add the field
+            break;
+        }
+    }
+    return notificationClass;
 }
+
+//---------------------------------------------------------------
+// MsgStoreHandler::notificationStatus
+// @see header
+//---------------------------------------------------------------
+void MsgStoreHandler::notificationStatus(
+        int& status,
+        QString& statusStr)
+{
+    // Null Check
+    if(!iNotificationClient)
+    {
+        return;
+    }
+
+    // fetch mms notification status from store handler
+    // and map as per our UI requirements
+    TMsvEntry entry = iNotificationClient->Entry().Entry();
+    status = MmsNotificationStatus(entry.Id());
+    switch(status)
+    {
+        case ConvergedMessage::NotifFailed:
+        {
+            statusStr = LOC_MMS_RETRIEVAL_FAILED;
+            break;
+        }
+        case ConvergedMessage::NotifExpired:
+        {
+            statusStr = LOC_MMS_NOTIF_EXPIRED;
+            break;
+        }
+        case ConvergedMessage::NotifReadyForFetching:
+        {
+            statusStr = LOC_MMS_WAITING;
+            break;
+        }
+        case ConvergedMessage::NotifWaiting:
+        case ConvergedMessage::NotifRetrieving:
+        {
+            statusStr = LOC_MMS_RETRIEVING;
+            break;
+        }
+        default:
+        {
+            // not handled, do nothing
+            break;
+        }
+    }
+}
+
+//---------------------------------------------------------------
+// MsgStoreHandler::notificationExpiryDate
+// @see header
+//---------------------------------------------------------------
+QString MsgStoreHandler::notificationExpiryDate()
+{
+    // Null Check
+    if(!iNotificationClient)
+    {
+        return QString();
+    }
+
+    // get expiry time from entry
+    TTime expiryTime = iNotificationClient->ExpiryDate( );
+    TLocale locale;
+    expiryTime += locale.UniversalTimeOffset();
+    if (locale.QueryHomeHasDaylightSavingOn())          
+    {
+        TTimeIntervalHours daylightSaving(1);          
+        expiryTime += daylightSaving;
+    }
+    
+    // create formatted string for the expiry time
+    TTime unixEpoch(KUnixEpoch);
+    TTimeIntervalSeconds seconds;
+    expiryTime.SecondsFrom(unixEpoch, seconds);
+    return LOC_MMS_EXPIRY_DATE.arg(seconds.Int());
+}
+
 // End of file
--- a/messagingapp/msgsettings/msginit/msginit.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgsettings/msginit/msginit.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -83,3 +83,6 @@
         -letel \
         -lmuiuutils
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgsettings/settingsserviceapp/settingsserviceapp.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -48,3 +48,6 @@
 
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
                              ".\rom\settingsserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(settingsserviceapp.iby)"
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgsettings/settingsview/settingsview.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/settingsview.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -65,4 +65,5 @@
     -lmmsserversettings \
     -lmmsgenericsettings \
     -lxqutils
-    
\ No newline at end of file
+    
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/appengine/appengine.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/appengine/appengine.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -101,3 +101,6 @@
         -lmsguiutils
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/appengine/src/conversationsengine.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -180,7 +180,7 @@
 //---------------------------------------------------------------
 bool ConversationsEngine::markConversationRead(qint64 conversationId)
 {
-    int error;
+    int error = 0;
     TRAP(error,d_ptr->markConversationReadL(conversationId));
     return (error!=KErrNone) ? false : true; 
 }
--- a/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -104,3 +104,6 @@
 	-lringbc \
 	-lmsguiutils \
 	-lcsserverclientapi
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/bwins/msguiutilsu.def	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/bwins/msguiutilsu.def	Mon Oct 04 00:13:15 2010 +0300
@@ -29,18 +29,19 @@
 	?send@MsgSendUtil@@QAEHAAVConvergedMessage@@@Z @ 28 NONAME ; int MsgSendUtil::send(class ConvergedMessage &)
 	?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 29 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *, int)
 	?checkMaxRecipientCount@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 30 NONAME ; bool MsgSendUtil::checkMaxRecipientCount(class ConvergedMessage &)
-	?copyVCardToTemp@MsgContactsUtil@@CA?AVQString@@ABV2@@Z @ 31 NONAME ; class QString MsgContactsUtil::copyVCardToTemp(class QString const &)
-	?getMmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 32 NONAME ; int MsgSendUtil::getMmsMsgSize(class ConvergedMessage &)
-	?onDialogInsertMedia@MmsConformanceCheck@@AAEXPAVHbAction@@@Z @ 33 NONAME ; void MmsConformanceCheck::onDialogInsertMedia(class HbAction *)
-	?checkModeForInsert@MmsConformanceCheck@@QAEHABVQString@@_N@Z @ 34 NONAME ; int MmsConformanceCheck::checkModeForInsert(class QString const &, bool)
-	?qt_metacast@MmsConformanceCheck@@UAEPAXPBD@Z @ 35 NONAME ; void * MmsConformanceCheck::qt_metacast(char const *)
-	?tr@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 36 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *)
-	?staticMetaObject@MmsConformanceCheck@@2UQMetaObject@@B @ 37 NONAME ; struct QMetaObject const MmsConformanceCheck::staticMetaObject
-	?tr@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 38 NONAME ; class QString MsgSendUtil::tr(char const *, char const *)
-	?saveToDrafts@MsgSendUtil@@QAEJAAVConvergedMessage@@@Z @ 39 NONAME ; long MsgSendUtil::saveToDrafts(class ConvergedMessage &)
-	?launchVCardViewer@MsgContactsUtil@@SA_NABVQString@@@Z @ 40 NONAME ; bool MsgContactsUtil::launchVCardViewer(class QString const &)
-	?mediaDuration@MsgMediaUtil@@QAE?AVQString@@ABV2@@Z @ 41 NONAME ; class QString MsgMediaUtil::mediaDuration(class QString const &)
-	??_EMmsConformanceCheck@@UAE@I@Z @ 42 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(unsigned int)
-	??1MsgSendUtil@@UAE@XZ @ 43 NONAME ; MsgSendUtil::~MsgSendUtil(void)
-	?qt_metacall@MsgSendUtil@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 44 NONAME ; int MsgSendUtil::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?isValidAddress@MsgSendUtil@@QAE_NABVQString@@@Z @ 31 NONAME ; bool MsgSendUtil::isValidAddress(class QString const &)
+	?copyVCardToTemp@MsgContactsUtil@@CA?AVQString@@ABV2@@Z @ 32 NONAME ; class QString MsgContactsUtil::copyVCardToTemp(class QString const &)
+	?getMmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 33 NONAME ; int MsgSendUtil::getMmsMsgSize(class ConvergedMessage &)
+	?onDialogInsertMedia@MmsConformanceCheck@@AAEXPAVHbAction@@@Z @ 34 NONAME ; void MmsConformanceCheck::onDialogInsertMedia(class HbAction *)
+	?checkModeForInsert@MmsConformanceCheck@@QAEHABVQString@@_N@Z @ 35 NONAME ; int MmsConformanceCheck::checkModeForInsert(class QString const &, bool)
+	?qt_metacast@MmsConformanceCheck@@UAEPAXPBD@Z @ 36 NONAME ; void * MmsConformanceCheck::qt_metacast(char const *)
+	?tr@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 37 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *)
+	?staticMetaObject@MmsConformanceCheck@@2UQMetaObject@@B @ 38 NONAME ; struct QMetaObject const MmsConformanceCheck::staticMetaObject
+	?tr@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 39 NONAME ; class QString MsgSendUtil::tr(char const *, char const *)
+	?saveToDrafts@MsgSendUtil@@QAEJAAVConvergedMessage@@@Z @ 40 NONAME ; long MsgSendUtil::saveToDrafts(class ConvergedMessage &)
+	?launchVCardViewer@MsgContactsUtil@@SA_NABVQString@@@Z @ 41 NONAME ; bool MsgContactsUtil::launchVCardViewer(class QString const &)
+	?mediaDuration@MsgMediaUtil@@QAE?AVQString@@ABV2@@Z @ 42 NONAME ; class QString MsgMediaUtil::mediaDuration(class QString const &)
+	??_EMmsConformanceCheck@@UAE@I@Z @ 43 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(unsigned int)
+	??1MsgSendUtil@@UAE@XZ @ 44 NONAME ; MsgSendUtil::~MsgSendUtil(void)
+	?qt_metacall@MsgSendUtil@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 45 NONAME ; int MsgSendUtil::qt_metacall(enum QMetaObject::Call, int, void * *)
 
--- a/messagingapp/msgui/conversationview/conversationview.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/conversationview.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -106,3 +106,5 @@
     -lmsgaudiofetcher \
     -lmsgs
 
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -84,6 +84,13 @@
      */
     void clearContent();
 
+    /**
+     * Checks if the address displayed in valid
+     * phone number or email id.
+     * @return true if valid else false
+     */
+    bool isValidAddress();
+
 signals:
 
     /**
--- a/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h	Mon Oct 04 00:13:15 2010 +0300
@@ -114,15 +114,7 @@
      * @return Timestamp string to be set.
      */
     QString getMsgTimeStamp(const QModelIndex& index);
-
-private slots:    
-
-    /*
-     * Handler for orientation changed
-     * @param orientation Qt::Orientation
-     */
-    void orientationchanged(Qt::Orientation orientation);
-    
+  
 protected:
 
     /**
--- a/messagingapp/msgui/conversationview/inc/msgconversationwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -278,11 +278,6 @@
      */
     void resetProperties();
 
-    /**
-     * Function to repolish widget.
-     */
-    void repolishWidget();
-
 protected:
     
     /*
@@ -290,14 +285,6 @@
      */
     virtual void polish(HbStyleParameters &params);
     
-private slots:
-	
-    /*
-     * Handler for orientation changed
-     * @param orientation Qt::Orientation
-     */
-	void orientationchanged(Qt::Orientation orientation);
-		
 private:
 
     /**
--- a/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -42,6 +42,7 @@
 #include "conversationsengine.h"
 #include "convergedmessage.h"
 #include "msgcontacthandler.h"
+#include "msgsendutil.h"
 
 // LOCAL CONSTANTS
 const QString DEFAULT_AVATAR_ICON("qtg_large_avatar");
@@ -225,6 +226,16 @@
 }
 
 //---------------------------------------------------------------
+// MsgContactCardWidget::isValidAddress
+// @see header file
+//---------------------------------------------------------------
+bool MsgContactCardWidget::isValidAddress()
+{
+    QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil());
+    return sendUtil->isValidAddress(mContactNumber);
+}
+
+//---------------------------------------------------------------
 // MsgContactCardWidget::gestureEvent
 // @see header file
 //---------------------------------------------------------------
--- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -23,7 +23,6 @@
 #include <HbAction>
 #include <HbListView>
 #include <HbMessageBox>
-#include <HbNotificationDialog>
 #include <HbFrameBackground>
 #include <HbStaticVkbHost>
 #include <HbStyleLoader>
@@ -136,7 +135,9 @@
 MsgConversationView::~MsgConversationView()
 {
     //delete the popup dialog
-    delete mDialog;
+    if (mDialog) {
+        delete mDialog;
+    }
 }
 //---------------------------------------------------------------
 // MsgConversationView::setupView
@@ -151,6 +152,7 @@
     }
     mConversationList->setLayoutName("custom");
     mConversationList->setItemRecycling(true);
+	mConversationList->setItemPixmapCacheEnabled(true);
     MsgConversationViewItem *item = new MsgConversationViewItem(this);
     HbFrameBackground defaultBackground;
     defaultBackground.setFrameGraphicsName(QString(""));
@@ -158,7 +160,6 @@
     mConversationList->setItemPrototype(item);
     mConversationList->setSelectionMode(HbListView::NoSelection);
     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
-    mConversationList->setScrollingStyle(HbScrollArea::PanOrFlick);
 
     mMessageModel = ConversationsEngine::instance()->getConversationsModel();
     
@@ -218,7 +219,7 @@
     // Just create dummy menu.
     // Actual menu will be created in menuAboutToShow()
     HbMenu *mainMenu = this->menu();
-    HbAction* clearConversation = mainMenu->addAction(QString());
+    mainMenu->addAction(QString());
     connect(mainMenu, SIGNAL(aboutToShow()), this, SLOT(menuAboutToShow()));
 }
 
@@ -243,17 +244,17 @@
     // Hide editor in case of BT conversations.
     qint64 convId = ConversationsEngine::instance()->getCurrentConversationId();
     if (INVALID_CONVID != convId) {
-        if (KBluetoothMsgsConversationId == convId) {
+        mContactCardWidget->updateContents();
+        if (KBluetoothMsgsConversationId == convId || !(mContactCardWidget->isValidAddress())) {
             mMainLayout->removeItem(mEditorWidget);
             mEditorWidget->hide();
             mEditorWidget->setParent(this);
         }
         else {
             mMainLayout->addItem(mEditorWidget);
-            TRAP_IGNORE(mEditorWidget->setEncodingSettingsL());
             mEditorWidget->show();
         }
-        mContactCardWidget->updateContents();
+        TRAP_IGNORE(mEditorWidget->setEncodingSettingsL());
     }
 }
 
@@ -984,23 +985,22 @@
     // For suspended message both short tap and long tap needs to show the same
     // context menu.....
     if(direction == ConvergedMessage::Outgoing 
-        	&& ((sendingState == ConvergedMessage::Suspended) || (sendingState == ConvergedMessage::Failed)))
+        	&& (sendingState == ConvergedMessage::Suspended))
     {
         handleShortTap();
         return;
     }
     
-    //If message is in any other state other than 'Sent'
+    //If message is in any state other than 'Sent' or 'Failed'
     //do not open the message
     if(direction == ConvergedMessage::Outgoing 
-            && sendingState != ConvergedMessage::SentState )
+            && sendingState != ConvergedMessage::SentState 
+            && sendingState != ConvergedMessage::Failed)
            
     {
         return;
     }
 
-   
-    
     // contact Id
     qint32 contactId = index.data(ContactId).toLongLong();  
 	    
@@ -1195,7 +1195,7 @@
         }
     
     this->setMaximumHeight(appRect.height()- cardHeight - spacing);
-    mConversationList->adjustSize();
+
     
     disconnect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
 
@@ -1212,7 +1212,7 @@
     scrollToBottom();
     
     this->setMaximumHeight(-1);
-    mConversationList->adjustSize();    
+    
     
     connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
 }
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -131,7 +131,6 @@
             << index.data(ConvergedMsgId).toInt();
 #endif
 
-    repolish();
     HbListViewItem::updateChildItems();
     }
 
@@ -184,9 +183,6 @@
         bodyText.replace('\r', QChar::LineSeparator);
         mConversation->setBodyText(bodyText);
         }
-    
-    //repolish
-    mConversation->repolishWidget();
     }
 
 //---------------------------------------------------------------
@@ -377,8 +373,6 @@
         mConversation->setBodyText(bodyText);
         }
     
-    //repolish widget
-    mConversation->repolishWidget();
     }
 
 //---------------------------------------------------------------
@@ -433,6 +427,8 @@
 void MsgConversationViewItem::setMessageStateIcon(int messageState)
 {
     HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator();
+	// Register for animation progressed signal to update the pixmap cache 
+	connect (&iconAnimator, SIGNAL(animationProgressed()), this, SLOT(updatePixmapCache()));
 
     switch (messageState)
     {
@@ -479,6 +475,8 @@
 void MsgConversationViewItem::setNotificationStateIcon(int notificationState)
 {
     HbIconAnimator& iconAnimator = mIncomingMsgStateIconItem->animator();
+	// Register for animation progressed signal to update the pixmap cache 
+	connect (&iconAnimator, SIGNAL(animationProgressed()), this, SLOT(updatePixmapCache()));
     HbIconAnimationManager* iconAnimationManager =
             HbIconAnimationManager::global();
     switch (notificationState)
@@ -532,9 +530,6 @@
 
     HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
 
-    connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this,
-        SLOT(orientationchanged(Qt::Orientation)), Qt::UniqueConnection);
-
     // Force polish to get all the sub-item properties right.
     polishEvent();
 }
@@ -568,18 +563,4 @@
     return msgTimeStamp;
 }
 
-//---------------------------------------------------------------
-// MsgConversationViewItem::orientationchanged
-// @see header file
-//---------------------------------------------------------------
-void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
-{
-    Q_UNUSED(orientation)
-    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.")
-
-    repolish();
-
-    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged end.")
-}
-
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -144,8 +144,7 @@
     HbStyle::setItemName(headerContainer, "headerItem");
     
     HbMainWindow *mainWindow = this->mainWindow();
-    connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, 
-			SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection);
+    
     polishEvent();
     }
 
@@ -663,20 +662,6 @@
     	}
 
 //---------------------------------------------------------------
-// MsgConversationWidget::orientationchanged
-// @see header file
-//---------------------------------------------------------------
-void MsgConversationWidget::orientationchanged(Qt::Orientation orientation)
-{
-    Q_UNUSED(orientation)
-    QDEBUG_WRITE("MsgConversationWidget:orientationchanged start.")
-            
-    repolish();
-    
-    QDEBUG_WRITE("MsgConversationWidget:orientationchanged end.")    
-}
-
-//---------------------------------------------------------------
 // MsgConversationWidget::polish
 // @see header file
 //---------------------------------------------------------------
@@ -716,14 +701,4 @@
     HbStyle::setItemName(mPlayIconItem, playIconOrig);
 }
 
-//---------------------------------------------------------------
-// MsgConversationWidget::repolishWidget
-// @see header file
-//---------------------------------------------------------------
-void MsgConversationWidget::repolishWidget()
-    	{
-    	repolish();
-    	}
-
-
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -65,8 +65,8 @@
 // @see header
 //---------------------------------------------------------------
 MsgEditorWidget::MsgEditorWidget(QGraphicsItem *parent) :
-    HbWidget(parent), mMsgEditor(NULL),
-    mSendButton(NULL),mPluginLoader(NULL)
+    HbWidget(parent), mMsgEditor(0), mSendButton(0), mPluginInterface(0), mPluginLoader(0),
+        mSmsCharLimitReached(false)
 {
     //setting background.
     HbFrameItem* backGround = new HbFrameItem(this);
@@ -200,9 +200,9 @@
     
     //Check done for optimization
     //Only if content is deleted we need to call encodingsettings again
-    if(mPrevBuffer.isEmpty() || str.size() <= mPrevBuffer.size())
+    if (mPrevBuffer.isEmpty() || str.size() <= mPrevBuffer.size())
     {
-    mPluginInterface->setEncodingSettings(EFalse,ESmsEncodingNone,mCharSupportType);
+        mPluginInterface->setEncodingSettings(EFalse,ESmsEncodingNone,mCharSupportType);
     }
     
     TInt numOfRemainingChars;
--- a/messagingapp/msgui/eabi/msguiutilsu.def	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/eabi/msguiutilsu.def	Mon Oct 04 00:13:15 2010 +0300
@@ -4,45 +4,46 @@
 	_ZN11MsgSendUtil12saveToDraftsER16ConvergedMessage @ 3 NONAME
 	_ZN11MsgSendUtil13getMmsMsgSizeER16ConvergedMessage @ 4 NONAME
 	_ZN11MsgSendUtil13getSmsMsgSizeER16ConvergedMessage @ 5 NONAME
-	_ZN11MsgSendUtil15validateServiceEP24UniEditorPluginInterfaceb @ 6 NONAME
-	_ZN11MsgSendUtil16staticMetaObjectE @ 7 NONAME DATA 16
-	_ZN11MsgSendUtil17checkEmailOverSmsER16ConvergedMessageRb @ 8 NONAME
-	_ZN11MsgSendUtil19getStaticMetaObjectEv @ 9 NONAME
-	_ZN11MsgSendUtil20checkMaxMsgSizeLimitER16ConvergedMessage @ 10 NONAME
-	_ZN11MsgSendUtil22checkMaxRecipientCountER16ConvergedMessage @ 11 NONAME
-	_ZN11MsgSendUtil23longestEmailAddressSizeE5QListIP23ConvergedMessageAddressE @ 12 NONAME
-	_ZN11MsgSendUtil4sendER16ConvergedMessage @ 13 NONAME
-	_ZN11MsgSendUtilC1EP7QObject @ 14 NONAME
-	_ZN11MsgSendUtilC2EP7QObject @ 15 NONAME
-	_ZN11MsgSendUtilD0Ev @ 16 NONAME
-	_ZN11MsgSendUtilD1Ev @ 17 NONAME
-	_ZN11MsgSendUtilD2Ev @ 18 NONAME
-	_ZN12MsgMediaUtil13mediaDurationERK7QString @ 19 NONAME
-	_ZN12MsgMediaUtil14mediaDurationLERK7TDesC16 @ 20 NONAME
-	_ZN12MsgMediaUtilC1Ev @ 21 NONAME
-	_ZN12MsgMediaUtilC2Ev @ 22 NONAME
-	_ZN12MsgMediaUtilD1Ev @ 23 NONAME
-	_ZN12MsgMediaUtilD2Ev @ 24 NONAME
-	_ZN15MsgContactsUtil15copyVCardToTempERK7QString @ 25 NONAME
-	_ZN15MsgContactsUtil17launchVCardViewerERK7QString @ 26 NONAME
-	_ZN15MsgContactsUtil19deleteVCardFromTempERK7QString @ 27 NONAME
-	_ZN19MmsConformanceCheck11qt_metacallEN11QMetaObject4CallEiPPv @ 28 NONAME
-	_ZN19MmsConformanceCheck11qt_metacastEPKc @ 29 NONAME
-	_ZN19MmsConformanceCheck16staticMetaObjectE @ 30 NONAME DATA 16
-	_ZN19MmsConformanceCheck18checkModeForInsertERK7QStringb @ 31 NONAME
-	_ZN19MmsConformanceCheck19getStaticMetaObjectEv @ 32 NONAME
-	_ZN19MmsConformanceCheck19onDialogInsertMediaEP8HbAction @ 33 NONAME
-	_ZN19MmsConformanceCheck21validateMsgForForwardEi @ 34 NONAME
-	_ZN19MmsConformanceCheck9showPopupERK7QString @ 35 NONAME
-	_ZN19MmsConformanceCheckC1Ev @ 36 NONAME
-	_ZN19MmsConformanceCheckC2Ev @ 37 NONAME
-	_ZN19MmsConformanceCheckD0Ev @ 38 NONAME
-	_ZN19MmsConformanceCheckD1Ev @ 39 NONAME
-	_ZN19MmsConformanceCheckD2Ev @ 40 NONAME
-	_ZNK11MsgSendUtil10metaObjectEv @ 41 NONAME
-	_ZNK19MmsConformanceCheck10metaObjectEv @ 42 NONAME
-	_ZTI11MsgSendUtil @ 43 NONAME
-	_ZTI19MmsConformanceCheck @ 44 NONAME
-	_ZTV11MsgSendUtil @ 45 NONAME
-	_ZTV19MmsConformanceCheck @ 46 NONAME
+	_ZN11MsgSendUtil14isValidAddressERK7QString @ 6 NONAME
+	_ZN11MsgSendUtil15validateServiceEP24UniEditorPluginInterfaceb @ 7 NONAME
+	_ZN11MsgSendUtil16staticMetaObjectE @ 8 NONAME DATA 16
+	_ZN11MsgSendUtil17checkEmailOverSmsER16ConvergedMessageRb @ 9 NONAME
+	_ZN11MsgSendUtil19getStaticMetaObjectEv @ 10 NONAME
+	_ZN11MsgSendUtil20checkMaxMsgSizeLimitER16ConvergedMessage @ 11 NONAME
+	_ZN11MsgSendUtil22checkMaxRecipientCountER16ConvergedMessage @ 12 NONAME
+	_ZN11MsgSendUtil23longestEmailAddressSizeE5QListIP23ConvergedMessageAddressE @ 13 NONAME
+	_ZN11MsgSendUtil4sendER16ConvergedMessage @ 14 NONAME
+	_ZN11MsgSendUtilC1EP7QObject @ 15 NONAME
+	_ZN11MsgSendUtilC2EP7QObject @ 16 NONAME
+	_ZN11MsgSendUtilD0Ev @ 17 NONAME
+	_ZN11MsgSendUtilD1Ev @ 18 NONAME
+	_ZN11MsgSendUtilD2Ev @ 19 NONAME
+	_ZN12MsgMediaUtil13mediaDurationERK7QString @ 20 NONAME
+	_ZN12MsgMediaUtil14mediaDurationLERK7TDesC16 @ 21 NONAME
+	_ZN12MsgMediaUtilC1Ev @ 22 NONAME
+	_ZN12MsgMediaUtilC2Ev @ 23 NONAME
+	_ZN12MsgMediaUtilD1Ev @ 24 NONAME
+	_ZN12MsgMediaUtilD2Ev @ 25 NONAME
+	_ZN15MsgContactsUtil15copyVCardToTempERK7QString @ 26 NONAME
+	_ZN15MsgContactsUtil17launchVCardViewerERK7QString @ 27 NONAME
+	_ZN15MsgContactsUtil19deleteVCardFromTempERK7QString @ 28 NONAME
+	_ZN19MmsConformanceCheck11qt_metacallEN11QMetaObject4CallEiPPv @ 29 NONAME
+	_ZN19MmsConformanceCheck11qt_metacastEPKc @ 30 NONAME
+	_ZN19MmsConformanceCheck16staticMetaObjectE @ 31 NONAME DATA 16
+	_ZN19MmsConformanceCheck18checkModeForInsertERK7QStringb @ 32 NONAME
+	_ZN19MmsConformanceCheck19getStaticMetaObjectEv @ 33 NONAME
+	_ZN19MmsConformanceCheck19onDialogInsertMediaEP8HbAction @ 34 NONAME
+	_ZN19MmsConformanceCheck21validateMsgForForwardEi @ 35 NONAME
+	_ZN19MmsConformanceCheck9showPopupERK7QString @ 36 NONAME
+	_ZN19MmsConformanceCheckC1Ev @ 37 NONAME
+	_ZN19MmsConformanceCheckC2Ev @ 38 NONAME
+	_ZN19MmsConformanceCheckD0Ev @ 39 NONAME
+	_ZN19MmsConformanceCheckD1Ev @ 40 NONAME
+	_ZN19MmsConformanceCheckD2Ev @ 41 NONAME
+	_ZNK11MsgSendUtil10metaObjectEv @ 42 NONAME
+	_ZNK19MmsConformanceCheck10metaObjectEv @ 43 NONAME
+	_ZTI11MsgSendUtil @ 44 NONAME
+	_ZTI19MmsConformanceCheck @ 45 NONAME
+	_ZTV11MsgSendUtil @ 46 NONAME
+	_ZTV19MmsConformanceCheck @ 47 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/inc/msgapplication.h	Mon Oct 04 00:13:15 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   ?Description
+*
+*/
+
+#ifndef MSGAPPLICATION_H_
+#define MSGAPPLICATION_H_
+
+#include <hbApplication.h>
+
+class MsgApplication: public HbApplication
+{
+
+Q_OBJECT
+	
+public:
+	
+	/**
+	 * Constructor
+	 */
+	MsgApplication( int &argc, char *argv[] );
+	
+	/**
+	 * Destructor
+	 */
+	virtual ~MsgApplication();
+	
+	/**
+	 * initMattiAutomation
+	 * connects viewReady signal to handleAppReady slot
+	 */
+	void initViewReady();
+	
+private slots:
+	void handleAppReady();
+
+signals:
+	void applicationReady();
+};
+    
+#endif // MSGAPPLICATION_H_
--- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h	Mon Oct 04 00:13:15 2010 +0300
@@ -72,16 +72,8 @@
      * @return bool
      */
     bool hasUnReadMsg();    
-   
-private slots:    
-
-    /*
-     * Handler for orientation changed
-     * @param orientation Qt::Orientation
-     */
-    void orientationchanged(Qt::Orientation orientation);
-    
-private:
+ 
+ private:
 
     /**
      * Create permanent items.
--- a/messagingapp/msgui/msgapp/inc/msgmainwindow.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgmainwindow.h	Mon Oct 04 00:13:15 2010 +0300
@@ -66,6 +66,14 @@
     MsgServiceInterface* mMsgSI;
     MsgSendServiceInterface* mMsgSendSI;
     MsgViewManager* mViewManager;
+    
+    /**
+     * Unit Testing
+     */
+    #ifdef MSGUI_UNIT_TEST
+      friend class TestMsgMainWindow;
+    #endif
+    
 };
 
 #endif // MSG_MAIN_WINDOW_H
--- a/messagingapp/msgui/msgapp/msgapp.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/msgapp.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -69,7 +69,8 @@
      msgbaseview.h \
      msgsendserviceinterface.h \
      msgserviceinterface.h \
-     msgactivityhandler.h
+     msgactivityhandler.h \
+     msgapplication.h
 
 SOURCES += main.cpp \
      msgmainwindow.cpp \
@@ -80,7 +81,8 @@
      msgviewmanager.cpp \
      msgsendserviceinterface.cpp \
      msgserviceinterface.cpp \
-     msgactivityhandler.cpp
+     msgactivityhandler.cpp \
+     msgapplication.cpp
 
 RESOURCES += msgapp.qrc
 
@@ -104,3 +106,6 @@
         -lafservice \
         -lunidatamodelloader 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/msgapp/src/draftslistview.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -98,9 +98,9 @@
     QAbstractItemModel *model = mListView->model();
 
     // Menu items are added/removed based on the item count.
-    connect(mListView->model(), SIGNAL(rowsInserted(QModelIndex, int, int)), this,
+    connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), this,
         SLOT(handleModelChanged()), Qt::UniqueConnection);
-    connect(mListView->model(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
+    connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), this,
         SLOT(handleModelChanged()), Qt::UniqueConnection);
 }
 
@@ -158,7 +158,6 @@
         // Create List View.
         mListView = new HbListView(this);
 
-        mListView->setScrollingStyle(HbScrollArea::PanOrFlick);
         mListView->setItemRecycling(true);
         mListView->setUniformItemSizes(true);
         mListView->setClampingStyle(HbScrollArea::BounceBackClamping);
--- a/messagingapp/msgui/msgapp/src/main.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/main.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -26,6 +26,7 @@
 
 #include "msgmainwindow.h"
 #include "msgactivityhandler.h"
+#include "msgapplication.h"
 
 //Localised constants
 #define LOC_TITLE hbTrId("txt_messaging_title_messaging")
@@ -96,7 +97,10 @@
     }
     
     // Application
-    HbApplication app(argc, argv);
+    //MsgApplication class dervied from HbApplication is create in order to 
+    //emit applicationReady signal for Matti tool
+    MsgApplication app(argc, argv);
+    
 
     //TODO: Uncomment the lines when actual translation files are available in sdk and remove loading locally.
     QString locale = QLocale::system().name();
@@ -140,6 +144,7 @@
      
     // Main window
     QPointer<MsgMainWindow> mainWindow = new MsgMainWindow(serviceRequest,activityMsgId);
+    app.initViewReady();
     // Set the main window pointer to activity handler.
     activityHandler->setMainWindow(mainWindow);
     mainWindow->show();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/src/msgapplication.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   ?Description
+*
+*/
+
+//include
+#include <hbmainwindow.h>
+#include <hbinstance.h>
+
+//userinclude
+#include "msgapplication.h"
+#include "debugtraces.h"
+
+MsgApplication::MsgApplication( int &argc, char *argv[] )
+    : HbApplication( argc, argv)
+	{
+	
+	}
+
+MsgApplication::~MsgApplication()
+	{
+	
+	}
+
+void MsgApplication::initViewReady()
+	{	
+	HbMainWindow *window = hbInstance->allMainWindows().first();
+	connect(window, SIGNAL(viewReady()),this,SLOT(handleAppReady()));
+	}
+
+void MsgApplication::handleAppReady()
+	{
+	QDEBUG_WRITE("MsgApplication::handleAppReady:applicationReady signal is emited")
+	emit applicationReady();
+	HbMainWindow *window = hbInstance->allMainWindows().first();
+	disconnect(window, SIGNAL(viewReady()),this,SLOT(handleAppReady()));
+	}
--- a/messagingapp/msgui/msgapp/src/msglistview.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistview.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -263,11 +263,11 @@
     HbStyleLoader::registerFilePath(":/clv");
 
     mMsgList = new HbListView(this);
-    mMsgList->setScrollingStyle(HbScrollArea::PanOrFlick);
     mMsgList->setClampingStyle(HbScrollArea::BounceBackClamping);
 
     mMsgList->setLayoutName("custom");
     mMsgList->setItemRecycling(true);
+	mMsgList->setItemPixmapCacheEnabled(true);
     mMsgList->setUniformItemSizes(true);
 
     MsgListViewItem *prototype = new MsgListViewItem(this);
--- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -335,7 +335,6 @@
             mUnReadMsg = true;
             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
                     NEW_ITEM_FRAME);
-            repolish();
             // Needed for colour group changes to be visible
             QCoreApplication::postEvent(this, new HbEvent(
                     HbEvent::ThemeChanged));
@@ -348,7 +347,6 @@
             mUnReadMsg = false;
             mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(
                     QString());
-            repolish();
             // Needed for colour group changes to be visible
             QCoreApplication::postEvent(this, new HbEvent(
                     HbEvent::ThemeChanged));
@@ -367,14 +365,4 @@
         mMsgCommonIndicatorItem->show();
     }
 
-//---------------------------------------------------------------
-// MsgListViewItem::orientationchanged
-// @see header file
-//---------------------------------------------------------------
-void MsgListViewItem::orientationchanged(Qt::Orientation orientation)
-{
-    Q_UNUSED(orientation)
-    repolish();
-}
-
 //EOF
--- a/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -75,3 +75,6 @@
         -lecom \
         -lxqservice \
         -lapgrfx
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h	Mon Oct 04 00:13:15 2010 +0300
@@ -23,10 +23,14 @@
 #include <MsgMediaInfo.h>
 #include <qstring.h>
 
+#ifdef MSGUI_UNIT_TEST
+ #define MSGUI_UTILS_DLL_EXPORT
+#else
 #ifdef BUILD_MSGUI_UTILS_DLL
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
 #else
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+#endif
 #endif
 
 class CMmsConformance;
@@ -110,6 +114,12 @@
      * Conformance status
      */
     TUint32 iConfStatus;
-
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMmsConformanceCheck;
+#endif    
 };
 #endif //MMS_CONFORMANCE_CHECK_OPERATION_H
--- a/messagingapp/msgui/msguiutils/inc/msgcontactsutil.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/inc/msgcontactsutil.h	Mon Oct 04 00:13:15 2010 +0300
@@ -19,10 +19,14 @@
 #ifndef MSGCONTACTSUTIL_H_
 #define MSGCONTACTSUTIL_H_
 
+#ifdef MSGUI_UNIT_TEST
+ #define MSGUI_UTILS_DLL_EXPORT
+#else
 #ifdef BUILD_MSGUI_UTILS_DLL
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
 #else
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+#endif
 #endif
 
 /**
@@ -38,6 +42,13 @@
 private:
     static QString copyVCardToTemp(const QString& filepath);
     static void deleteVCardFromTemp(const QString& filepath);
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgContactsUtil;
+#endif
 };
 
 #endif /* MSGCONTACTSUTIL_H_ */
--- a/messagingapp/msgui/msguiutils/inc/msgmediautil.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/inc/msgmediautil.h	Mon Oct 04 00:13:15 2010 +0300
@@ -18,10 +18,14 @@
 #ifndef MSG_MEDIA_UTIL_H
 #define MSG_MEDIA_UTIL_H
 
+#ifdef MSGUI_UNIT_TEST
+ #define MSGUI_UTILS_DLL_EXPORT
+#else
 #ifdef BUILD_MSGUI_UTILS_DLL
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
 #else
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+#endif
 #endif
 
 /**
@@ -57,6 +61,13 @@
      * @return media duration in miliseconds
      */
     TInt mediaDurationL(const TDesC& mediaFile);
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgMediaUtil;
+#endif
     };
     
 #endif // MSG_MEDIA_UTIL_H
--- a/messagingapp/msgui/msguiutils/inc/msgsendutil.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/inc/msgsendutil.h	Mon Oct 04 00:13:15 2010 +0300
@@ -22,10 +22,14 @@
 #include <QObject>
 #include "convergedmessage.h"
 
+#ifdef MSGUI_UNIT_TEST
+ #define MSGUI_UTILS_DLL_EXPORT
+#else
 #ifdef BUILD_MSGUI_UTILS_DLL
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
 #else
-#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+ #define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+#endif
 #endif
 
 
@@ -68,6 +72,13 @@
      */
     int send(ConvergedMessage& msg);
 
+    /**
+     * Checks for valid phone number and email address.
+     * @param address Address to be checked.
+     * @return true if valid address else false.
+     */
+    bool isValidAddress(const QString &address);
+
 private:
     /**
      * Check if email over sms is supported and change msgtype appropriately.
@@ -133,6 +144,13 @@
      * Own
      */
     UniEditorGenUtils* mUniEditorGenUtils;
+
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgSendUtil;
+#endif    
 };
 
 #endif // MSG_SEND_UTIL_H
--- a/messagingapp/msgui/msguiutils/msguiutils.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/msguiutils.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -69,6 +69,7 @@
     -leditorgenutils \
     -lconvergedmessageutils \
     -lcentralrepository \
+    -lcommonengine \
     -lDRMHelper \
     -lmsgmedia \
     -lapmime \
@@ -77,3 +78,6 @@
     -lefsrv
     
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/msguiutils/src/msgsendutil.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/msgsendutil.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -23,6 +23,8 @@
 // general editor utilities
 #include "UniEditorGenUtils.h"
 
+#include <xqconversions.h>
+#include <commonphoneparser.h> // commonengine
 
 //---------------------------------------------------------------
 // MsgSendUtil::MsgSendUtil
@@ -104,6 +106,32 @@
 }
 
 //---------------------------------------------------------------
+// MsgSendUtil::isValidAddress
+// @see header file
+//--------------------------------------------------------------
+bool MsgSendUtil::isValidAddress(const QString &address)
+{
+    bool isValid = false;
+    if (!address.isEmpty()) {
+
+        HBufC *tempAddr = XQConversions::qStringToS60Desc(address);
+
+        // 1. perform number validation
+        isValid = CommonPhoneParser::IsValidPhoneNumber(*tempAddr, CommonPhoneParser::ESMSNumber);
+
+        // 2. if number validity fails, then perform email addr validation
+        if (!isValid) {
+            // additional check for MMS only
+            UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
+            isValid = genUtils->IsValidEmailAddress(*tempAddr);
+            delete genUtils;
+        }
+        delete tempAddr;
+    }
+    return isValid;
+}
+
+//---------------------------------------------------------------
 // MsgSendUtil::checkEmailOverSms
 // @see header file
 //--------------------------------------------------------------
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h	Mon Oct 04 00:13:15 2010 +0300
@@ -158,13 +158,6 @@
      * Reset the addresslist to previous list
      */
     void resetToPrevious();
-    
-    /**
-     * checks if the passed sting is a valid address or not.
-     * @param addr
-     * @retunr true/false based on valid/invalid.
-     */
-    bool checkValidAddress(const QString& addr);
 
 private:
 
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h	Mon Oct 04 00:13:15 2010 +0300
@@ -172,6 +172,13 @@
      */
     MsgUnifiedEditorUtils *mEditorUtils;
 
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgUnifiedEditorAttachment;
+#endif
+
     };
 
 typedef QList<MsgUnifiedEditorAttachment*> MsgUnifiedEditorAttachmentList;
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -121,6 +121,13 @@
      * True if valid media duration else false.
      */
     bool mValidMediaDuration;
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgUniFiedEditorAudioWidget;
+#endif
 };
 
 #endif //MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h	Mon Oct 04 00:13:15 2010 +0300
@@ -105,9 +105,9 @@
     /**
      * from MUniEditorProcessImageOperationObserver  
      * @see MUniEditorProcessImageOperationObserver
-     */
+     */ 
     void EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent,
-                               TFileName aFileName );
+                               TFileName& aFileName );
     /**
 	 * Function which tells whether the image resize process is in progress
 	 */
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -119,6 +119,13 @@
      * Pixmap file path being set.
      */
     QString mPixmapPath;
+
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestMsgUnifiedEditorPixmapWidget;
+#endif
 };
 
 #endif /* MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H */
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h	Mon Oct 04 00:13:15 2010 +0300
@@ -61,7 +61,7 @@
         */
         virtual void EditorOperationEvent( 
             TUniEditorProcessImageOperationEvent aEvent,
-            TFileName aFileName) = 0;
+            TFileName& aFileName) = 0;
     };
 
 /**
--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -27,8 +27,6 @@
 #include <telconfigcrkeys.h>        // KCRUidTelephonyConfiguration
 #include <centralrepository.h>
 #include <HbNotificationDialog>
-#include <commonphoneparser.h>      // Common phone number validity checker
-#include <xqconversions.h>
 #include <HbEditorInterface>
 
 // USER INCLUDES
@@ -37,6 +35,7 @@
 #include "msgunieditorlineedit.h"
 #include "msgunieditormonitor.h"
 #include "UniEditorGenUtils.h"
+#include "msgsendutil.h"
 
 const QString PBK_ICON("qtg_mono_contacts");
 const QString REPLACEMENT_STR("; ");
@@ -246,7 +245,8 @@
         bool isValid = false;
         if(!aSkipCheck)
         {
-            isValid = checkValidAddress(addrlist.at(i)->address());
+            QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil());
+            isValid = sendUtil->isValidAddress(addrlist.at(i)->address());
         }
         else
         {
@@ -528,7 +528,6 @@
 // ----------------------------------------------------------------------------
 bool MsgUnifiedEditorAddress::validateContacts()
 {
-    UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
 
     // sync-up map to account for user-actions on address-field
     syncDeletionsToMap();
@@ -544,7 +543,8 @@
         // (i.e. user-inserted)
         if(mAddressMap.contains(addr))
         {
-        isValid = checkValidAddress(addr);
+            QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil());
+            isValid = sendUtil->isValidAddress(addr);
             if(!isValid)
             {
                 mAddressEdit->highlightInvalidString(addr);
@@ -563,32 +563,6 @@
 
     return isValid;
 }
-// ----------------------------------------------------------------------------
-// MsgUnifiedEditorAddress::checkValidAddress
-// @see header
-// ----------------------------------------------------------------------------
-bool MsgUnifiedEditorAddress::checkValidAddress(const QString& addr)
-    {
-    bool isValid = false;
-    
-    HBufC *tempAddr = XQConversions::qStringToS60Desc(addr);
-    	
-    // 1. perform number validation
-    isValid = CommonPhoneParser::IsValidPhoneNumber(
-            *tempAddr,
-            CommonPhoneParser::ESMSNumber );
-
-    // 2. if number validity fails, then perform email addr validation
-    UniEditorGenUtils* genUtils = q_check_ptr(new UniEditorGenUtils);
-    if(!isValid)
-        { // additional check for MMS only
-        isValid = genUtils->IsValidEmailAddress(
-                    *tempAddr );
-        } 
-    delete genUtils;
-    delete tempAddr;
-    return isValid;
-    }
 
 void MsgUnifiedEditorAddress::handleInvalidContactDialog(
         HbAction* act)
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -641,10 +641,10 @@
 }
 
 void MsgUnifiedEditorBody::EditorOperationEvent(
-    TUniEditorProcessImageOperationEvent aEvent, TFileName aFileName)
+    TUniEditorProcessImageOperationEvent aEvent, TFileName& aFileName)
 {
     delete mImageInfo;
-    mImageInfo = NULL;
+    mImageInfo = NULL; 
 
     if (aEvent == EUniEditorProcessImageOperationComplete && 
             aFileName.Length() > 0)
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -75,6 +75,10 @@
 const QString ATTACH_ICON("qtg_mono_attach");
 // temporary folder for unieditor
 const QString UNIFIED_EDITOR_TEMP_FOLDER("unifiededitor");
+// invalid chars in vcard
+const QString INVALID_FILENAME_CHARS("[?*<>/\"|\\:]");
+// replacement char for invalid char
+const QChar REPLACE_CHAR('_');
 
 const int INVALID_MSGID = -1;
 // vcard file extn.
@@ -1346,7 +1350,10 @@
         {
             // generate file name
             QString displayLabel = contactList.at(i).displayLabel();
+            displayLabel.replace(QRegExp(INVALID_FILENAME_CHARS), REPLACE_CHAR);
             QString filepath = generateFileName(displayLabel);
+            
+            // create file
             QFile file(filepath);
             if(file.open(QIODevice::WriteOnly))
             {
--- a/messagingapp/msgui/unifiededitor/unifiededitor.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/unifiededitor.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -112,4 +112,5 @@
         -lefsrv \
         -lmsgaudiofetcher
 
-        
\ No newline at end of file
+        
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -150,6 +150,13 @@
      * Mime type of media.
      */
     QString mMimeType;
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestUniViewerAttachmentWidget;
+#endif
 };
 
 #endif // UNI_VIEWER_ATTACHMENT_WIDGET_H
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -116,6 +116,13 @@
      * True if valid media duration else false.
      */
     bool mValidMediaDuration;
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestUniViewerAudioWidget;
+#endif
 };
 
 #endif //UNI_VIEWER_AUDIO_WIDGET_H
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h	Mon Oct 04 00:13:15 2010 +0300
@@ -151,6 +151,13 @@
      * Pixmap file path being set.
      */
     QString mPixmapPath;
+    
+#ifdef MSGUI_UNIT_TEST
+    /**
+     * Unit Testing
+     */
+    friend class TestUniViewerPixmapWidget;
+#endif
 };
 
 #endif /* UNI_VIEWER_PIXMAP_WIDGET_H */
--- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -29,6 +29,7 @@
 #include <ccsdefs.h>
 #include <xqappmgr.h>
 #include <xqaiwrequest.h>
+#include <xqserviceutil.h>
 #include <sqldb.h>
 
 // USER INCLUDES
@@ -43,6 +44,7 @@
 #include "debugtraces.h"
 #include "nativemessageconsts.h"
 #include "mmsconformancecheck.h"
+#include "msgsendutil.h"
 
 // LOCAL CONSTANTS
 const QString REPLY_ICON("qtg_mono_reply");
@@ -114,16 +116,17 @@
 
     int sendingState = mViewFeeder->sendingState();
 
-    if (mViewFeeder->sendingState() == ConvergedMessage::Failed)
-    {
-        toolbar->addAction(HbIcon(SEND_ICON), "");
-    }
-    else
+    if(mViewFeeder->sendingState() != ConvergedMessage::Failed)
     {
         // do not show reply option for multi recipient outgoing message
         if(!(!mViewFeeder->isIncoming() && mViewFeeder->recipientCount()>1))
         {
-            toolbar->addAction(HbIcon(REPLY_ICON), "", this, SLOT(handleReplyAction()));
+            QString from, alias;
+            mViewFeeder->fromAddressAndAlias(from, alias);
+            QScopedPointer<MsgSendUtil> sendUtil(new MsgSendUtil());
+            if (!(mViewFeeder->isIncoming() && !(sendUtil->isValidAddress(from)))) {
+                toolbar->addAction(HbIcon(REPLY_ICON), "", this, SLOT(handleReplyAction()));
+            }
         }
 
         if (mViewFeeder->recipientCount() > 1)
@@ -137,7 +140,12 @@
         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
     }
 
-    toolbar->addAction(HbIcon(DELETE_ICON), "", this, SLOT(handleDeleteAction()));
+    // No delete action for viewer when launched as a service
+    if(!XQServiceUtil::isService())
+    {
+        toolbar->addAction(HbIcon(DELETE_ICON), "",
+                this, SLOT(handleDeleteAction()));
+    }
 }
 
 //---------------------------------------------------------------
--- a/messagingapp/msgui/unifiedviewer/unifiedviewer.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -108,3 +108,5 @@
        -lthumbnailmanagerqt \
        -lxqserviceutil \
        -lsqldb
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -64,3 +64,6 @@
 	TARGET.EPOCALLOWDLLDATA = 1
 }
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/mmstestbed.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/mmstestbed/mmstestbed.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -95,3 +95,6 @@
         -llogwrap \
         -lapgrfx \
         -lapmime
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/testconvergedmessageutils.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/convergedmessageutils/tsrc/testconvergedmessageutilsapp/testconvergedmessageutils/testconvergedmessageutils.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -132,4 +132,6 @@
 	addFile1.path = C:/data/
 	DEPLOYMENT += addFile1
 	}
-	
\ No newline at end of file
+	
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -268,7 +268,8 @@
 
     // Create smil node
     TPtrC name( KSMILWREleSmil );
-    CMDXMLElement* root = CMDXMLElement::NewLC( ETrue, dom, name );
+    // coverity[size_error][buffer_alloc]
+	CMDXMLElement* root = CMDXMLElement::NewLC( ETrue, dom, name );
     // Append
     dom->DocumentElement()->AppendChild( root ); // Ownership to dom
     CleanupStack::Pop( root );
@@ -1318,7 +1319,8 @@
 
     TPtrC name( KSMILWREleHead );
     // Create Head node
-    CMDXMLElement* ele = CMDXMLElement::NewLC( ETrue, aDom, name );
+    // coverity[size_error][buffer_alloc]
+	CMDXMLElement* ele = CMDXMLElement::NewLC( ETrue, aDom, name );
     // Append Head in Root node
     aRoot->AppendChild( ele );
 
@@ -1483,6 +1485,7 @@
     // Create Layout node
     if ( !aLayout )
         {
+		// coverity[size_error][buffer_alloc]
         aLayout = CMDXMLElement::NewLC( ETrue, aDom, name );
         // Append Layout in Head
         aRoot->InsertBefore( NULL, aLayout );
@@ -1986,6 +1989,7 @@
     {
     TPtrC name( KSMILWREleBody );
     // Create Body node
+	// coverity[size_error][buffer_alloc]
     CMDXMLElement* body = CMDXMLElement::NewLC( ETrue, aDom, name );
     // Append
     aRoot->AppendChild( body );
--- a/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -127,3 +127,6 @@
     -lQtCore \
     -leditorgenutils
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/testunidatamodelloader/testunidatamodelloader.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/tsrc/testunidatamodelloader/testunidatamodelloader.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -97,4 +97,5 @@
 	addP2.path = C:/data/
 	DEPLOYMENT += addP2	
 	}
-	
\ No newline at end of file
+	
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -63,3 +63,6 @@
     
 LIBS += -lQtCore
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby	Mon Oct 04 00:13:15 2010 +0300
@@ -43,9 +43,6 @@
 data=DATAZ_\BIOFILE_DIR\cbcp.rsc                                  BIOFILE_DIR\cbcp.rsc
 data=DATAZ_\BIOFILE_DIR\cbcp.mbm                                  BIOFILE_DIR\cbcp.mbm
 
-data=DATAZ_\BIOFILE_DIR\olp.rsc                                  BIOFILE_DIR\olp.rsc
-data=DATAZ_\BIOFILE_DIR\olp.mbm                                  BIOFILE_DIR\olp.mbm
-
 
 #endif // __UNI_VCAL_DATA_PLUGIN_IBY__
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -133,7 +133,7 @@
 
     QString path;
     QString mimetype;
-    int size;
+    int size = 0;
 
     TFileName fullName;
     qt_symbian_throwIfError(file.FullName(fullName));
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -106,3 +106,6 @@
 	-lbifu
 	
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -67,3 +67,6 @@
 DEPLOYMENT += plugin
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -89,4 +89,5 @@
 	addFile1.path = C:/data/
 	DEPLOYMENT += addFile1
 	}
-	
\ No newline at end of file
+	
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -74,3 +74,6 @@
 DEPLOYMENT += plugin
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -89,4 +89,7 @@
 	-lmsgs \
 	-lunidatamodelloader\
 	-lQtCore
-	
\ No newline at end of file
+	
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -61,3 +61,6 @@
 DEPLOYMENT += plugin
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -68,3 +68,6 @@
     -lavkon \
     -lefsrv 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/testunieditorpluginloader.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/tsrc/testunieditorpluginloader/testunieditorpluginloader.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -72,4 +72,5 @@
 	addFile1.path = C:/data/
 	DEPLOYMENT += addFile1
 	}
-	
\ No newline at end of file
+	
+symbian:MMP_RULES += SMPSAFE
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -58,3 +58,6 @@
              "$${LITERAL_HASH}endif"
 	
 MMP_RULES += defBlock
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/mmstestbed.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/mmstestbed/mmstestbed.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -95,3 +95,6 @@
         -llogwrap \
         -lapgrfx \
         -lapmime
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/testmmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgpluginapp/testmmsplugin/testmmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -136,4 +136,5 @@
 	addFile2.path = C:/data/
 	DEPLOYMENT += addFile2
 	}
-	
\ No newline at end of file
+	
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -73,3 +73,6 @@
 DEPLOYMENT += plugin
 
 
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -1471,7 +1471,7 @@
 // ----------------------------------------------------------------------------
 void UniEditorSmsPluginPrivate::CreateVCardSMSL( RFile& aFile )
     {
-    TInt fileSize;
+    TInt fileSize = 0;
     TInt err ( aFile.Size( fileSize ) );
     User::LeaveIfError(err);
 
@@ -1503,7 +1503,7 @@
 void UniEditorSmsPluginPrivate::CreateVCalSMSL( RFile& aFile )
     {
     TInt err (KErrNone);
-    TInt fileSize;
+    TInt fileSize = 0;
     err = aFile.Size( fileSize );
     User::LeaveIfError(err);
 
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testunieditorsmsplugin/testunieditorsmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testunieditorsmsplugin/testunieditorsmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -123,4 +123,5 @@
 	addFile3.path = C:/data/
 	DEPLOYMENT += addFile3
 	}
-	
\ No newline at end of file
+	
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -73,3 +73,6 @@
 plugin.sources = unieditorsmsplugin.dll
 plugin.path = \resource\qt\plugins\messaging\editorplugins
 DEPLOYMENT += plugin
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/shareui/shareui.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/shareui/shareui.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -60,3 +60,6 @@
 
 LIBS += -lxqservice \
         -lxqserviceutil
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/shareui/tsrc/testshareui/testshareui.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/shareui/tsrc/testshareui/testshareui.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -47,3 +47,6 @@
 
 # Libs
 LIBS += -lshareui		
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/smartmessaging/ringbc/ringbc.pro	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/ringbc.pro	Mon Oct 04 00:13:15 2010 +0300
@@ -69,3 +69,6 @@
         -lxqutils \
         -lefsrv
 		     
+
+
+symbian:MMP_RULES += SMPSAFE
--- a/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -20,6 +20,7 @@
 #include <pathinfo.h>
 #include <f32file.h>
 #include <hbmessagebox.h>
+#include <HbDeviceMessageBox>
 
 // USER INCLUDES
 #include "ringbc_p.h"
@@ -27,9 +28,12 @@
 #include <xqconversions.h>
 #include "debugtraces.h"
 
-//CONSTANTS 
-_LIT(KRingingToneFileExtension,".rng");
-
+// LOCALIZATION
+// TODO: Get localized strings
+#define LOC_RINGTONE_CORRUPTED "Ringing Tone Corrupted"
+#define LOC_OUT_OF_MEMORY "No memory to save"
+#define LOC_RINGTONE_SAVING_ERROR "Error in Saving"
+#define LOC_RINGTONE_SAVED "Saved succesfully"
 
 // ----------------------------------------------------------------------------
 // RingBcPrivate::RingBcPrivate
@@ -77,36 +81,38 @@
 void RingBcPrivate::saveTone(const QString &path)
     {
     QDEBUG_WRITE("RingBcPrivate::saveTone : Enter")
-
-    int error(KErrNone);
-
-    TRAP(error, saveToneL(path));
+    QString statusStr;
+    TRAPD(error, saveToneL(path));
     if (error)
         {
         QDEBUG_WRITE_FORMAT("RingBcPrivate::saveTone Error code =",error)
-        
         if(error == KErrCorrupt)
             {
-            HbMessageBox::information("Ringing Tone Corrupted", 0, 0, HbMessageBox::Ok);
+            statusStr = LOC_RINGTONE_CORRUPTED;
             QDEBUG_WRITE("RingBcPrivate::saveTone : Ringing tone corrupted")
             }
         else if(error == KErrNoMemory || error == KErrDiskFull)
             {
-            HbMessageBox::information("No memory to save", 0, 0, HbMessageBox::Ok);
+            statusStr = LOC_OUT_OF_MEMORY;
             QDEBUG_WRITE("RingBcPrivate::saveTone : Low memory")
             }
         else
             {
-            HbMessageBox::information("Error in Saving", 0, 0, HbMessageBox::Ok);
+            statusStr = LOC_RINGTONE_SAVING_ERROR;
             QDEBUG_WRITE("RingBcPrivate::saveTone : Error in Saving")
             }
         }
     else
         {
-        HbMessageBox::information("Saved succesfully", 0, 0, HbMessageBox::Ok);
+        statusStr = LOC_RINGTONE_SAVED;
         QDEBUG_WRITE("RingBcPrivate::saveTone : Ringing tone saved successfully")
         }
-
+    
+    HbDeviceMessageBox msgbox;
+    msgbox.setMessageBoxType(HbMessageBox::MessageTypeInformation);
+    msgbox.setText(statusStr);
+    msgbox.setAction(NULL, HbDeviceMessageBox::AcceptButtonRole);
+    msgbox.show();
     QDEBUG_WRITE("RingBcPrivate::saveTone : Exit")
     }
 
@@ -133,7 +139,7 @@
             EFileShareReadersOnly));
 
     CleanupClosePushL(file);
-    TInt size;
+    TInt size=0;
     User::LeaveIfError(file.Size(size));
     
     HBufC8* dataBuf = HBufC8::NewLC(size);
@@ -217,7 +223,7 @@
         if (error == KErrNone)
             {
             CleanupClosePushL(file);
-            TInt size;
+            TInt size=0;
             User::LeaveIfError(file.Size(size));
             if (size)
                 {
--- a/messagingappbase/msgmedia/group/MsgMedia.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingappbase/msgmedia/group/MsgMedia.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -24,7 +24,7 @@
 //...LOGGING...
 //MACRO           __MSGMEDIA_DEBUG    // Logging
 //MACRO           USE_RDEBUG    // RDebug vs. file logging
-//LIBRARY         Flogger.lib   // RFileLogger, debug logging
+//LIBRARY         flogger.lib   // RFileLogger, debug logging
 //...LOGGING...
 
 TARGET          MsgMedia.dll
@@ -70,9 +70,9 @@
 LIBRARY         cone.lib
 LIBRARY         charconv.lib
 LIBRARY         centralrepository.lib
-LIBRARY         ImageConversion.lib
-LIBRARY         MediaClientAudio.lib
-LIBRARY         MediaClientVideo.lib
+LIBRARY         imageconversion.lib
+LIBRARY         mediaclientaudio.lib
+LIBRARY         mediaclientvideo.lib
 LIBRARY         ws32.lib
 LIBRARY         FeatMgr.lib
 LIBRARY         DRMHelper.lib
@@ -87,4 +87,8 @@
 deffile         ./marm.def
 #endif
 
+
+
+SMPSAFE
+
 /* End of File */
--- a/messagingappbase/mtmregistry/mtmregistry.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/messagingappbase/mtmregistry/mtmregistry.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -48,4 +48,8 @@
 LANGUAGE_IDS
 END
 
+
+
+SMPSAFE
+
 //  End of File
--- a/mmsengine/applicationadapter/bld/mmsapplicationadapter.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/applicationadapter/bld/mmsapplicationadapter.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -58,3 +58,6 @@
 #elif defined( MARM )
 deffile ../bmarm/mmsapplicationadapter.def
 #endif
+
+
+SMPSAFE
--- a/mmsengine/clientmtm/bld/mmsclient.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/clientmtm/bld/mmsclient.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -67,3 +67,6 @@
 #elif defined( MARM )
 deffile ../bmarm/marm.def
 #endif
+
+
+SMPSAFE
--- a/mmsengine/genutils/bld/mmsgenutils.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/genutils/bld/mmsgenutils.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -59,3 +59,6 @@
 #elif defined( WINS )
 DEFFILE       ../bwins/wins.def
 #endif
+
+
+SMPSAFE
--- a/mmsengine/genutils/src/mmsattachmenthandler.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/genutils/src/mmsattachmenthandler.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -330,6 +330,7 @@
         }
     
     const TInt KMmsMaxBytesPerCharacter = 4;    
+	// coverity[incorrect_multiplication][buffer_alloc]
     HBufC8* buffer = HBufC8::NewL( text.Length() * KMmsMaxBytesPerCharacter ); // paranoid.
     CleanupStack::PushL( buffer );
     TPtr8 buf8 = buffer->Des();
--- a/mmsengine/mmscodec/bld/mmscodec.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmscodec/bld/mmscodec.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -90,4 +90,5 @@
 DEFFILE       ../bmarm/mmscodec.def
 #endif
 
+SMPSAFE
 //  End of File
--- a/mmsengine/mmscodec/src/mmsdecode.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmscodec/src/mmsdecode.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -2146,6 +2146,8 @@
         // (includes empty strings)
         // Keep quote because these are strange strings that may contain any
         // number of quotes all over the place
+
+		// coverity[size_error][buffer_alloc]
         buffer = GetSimpleTextStringL( ETrue );
         // check if this looks like it needs decoding of MIME stuff (RFC2047)
         if ( buffer->Des().FindF( KEqualsQuestion16 ) == KErrNotFound )
@@ -2281,7 +2283,8 @@
         }
 
     stringLength--; // remove the terminating zero
-    buffer = HBufC16::NewL( stringLength * KMms2 );
+    // coverity[incorrect_multiplication][buffer_alloc]
+	buffer = HBufC16::NewL( stringLength * KMms2 );
 
     if ( stringLength == 0 )
         {
@@ -3404,7 +3407,7 @@
             {
             // I hope this is a simple text string. we cannot handle
             // different character sets in this context.
-
+			// coverity[size_error][buffer_alloc]
             buffer = GetSimpleTextStringL(); // we might try to convert from utf8 to unicode
             CleanupStack::PushL( buffer );
             iMimeHeaders->SetContentLocationL( buffer->Des() );
@@ -4379,7 +4382,8 @@
                     }
                 else
                     {
-                    CBufFlat* shortBuffer = CBufFlat::NewL( KMms2 );
+                    // coverity[size_error][buffer_alloc]
+					CBufFlat* shortBuffer = CBufFlat::NewL( KMms2 );
                     CleanupStack::PushL( shortBuffer );
                     shortBuffer->ResizeL( KMms2 );
                     // no need to put it into cleanupstack... we don't leave before we delete it
@@ -6297,7 +6301,8 @@
         }
     TUint endPosition = iPosition + size;
     HBufC16* buffer = NULL;
-    buffer = GetSimpleTextStringL(); // I hope this is correct.
+    // coverity[size_error][buffer_alloc]
+	buffer = GetSimpleTextStringL(); // I hope this is correct.
     CleanupStack::PushL( buffer );
     iMmsHeaders->ElementDescriptorL().SetContentReferenceL( buffer->Des() );
 #ifndef _NO_MMSS_LOGGING_
@@ -6356,6 +6361,7 @@
     HBufC16* buffer = NULL;
     byteString.Set( GetUtf8String() );
     // There will be at most one unicode character per one utf-8 character
+	// coverity[incorrect_multiplication][buffer_alloc]
     buffer = HBufC16::NewL( byteString.Length() * KMms2 );
     TPtr16 pointer16 = buffer->Des();
     CleanupStack::PushL( buffer );
@@ -6378,7 +6384,8 @@
 void CMmsDecode::DecodeExtNotifEolL()
     {
     HBufC16* buffer = NULL;
-    buffer = GetSimpleTextStringL();
+	// coverity[size_error][buffer_alloc]
+	buffer = GetSimpleTextStringL();
     CleanupStack::PushL( buffer );
     iMmsHeaders->SetMessageComplete( ( buffer->Des() )[0] );
 #ifndef _NO_MMSS_LOGGING_
@@ -6474,6 +6481,8 @@
 void CMmsDecode::DecodeApplicationIdL()
     {
     HBufC16* buffer = NULL;
+	
+	// coverity[size_error][buffer_alloc]
     buffer = GetSimpleTextStringL();
     CleanupStack::PushL( buffer );
     iMmsHeaders->SetApplicIdL( buffer->Des() );
@@ -6492,7 +6501,9 @@
 void CMmsDecode::DecodeReplyApplicationIdL()
     {
     HBufC16* buffer = NULL;
-    buffer = GetSimpleTextStringL();
+	
+	// coverity[size_error][buffer_alloc]
+	buffer = GetSimpleTextStringL();
     CleanupStack::PushL( buffer );
     iMmsHeaders->SetReplyApplicIdL( buffer->Des() );
 #ifndef _NO_MMSS_LOGGING_
--- a/mmsengine/mmscodec/src/mmsencode.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmscodec/src/mmsencode.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -1517,6 +1517,7 @@
             // Using non-ascii characters in filename parameter is allowed
             // The filename must be encoded either using base64 or quoted printable
             HBufC8* temp = NULL;
+			// coverity[size_error][buffer_alloc]
             temp = CnvUtfConverter::ConvertFromUnicodeToUtf8L( originalName );
             CleanupStack::PushL( temp );
             // Now we have the filename in utf-8.
@@ -3332,7 +3333,8 @@
         // we must convert to utf-8
         
         //one ucs-2 character should never produce more than 4 bytes when converted to utf-8
-        HBufC8* buffer = HBufC8::NewL( aString.Length() * KMms4 ); // paranoid.
+        // coverity[incorrect_multiplication][buffer_alloc]
+		HBufC8* buffer = HBufC8::NewL( aString.Length() * KMms4 ); // paranoid.
         // we don't leave while we need buffer
         TPtr8 buf8 = buffer->Des();
 
@@ -3545,6 +3547,7 @@
             // must be added
         
             // one ucs-2 character will not produce more than 4 bytes when converted to utf-8
+			// coverity[incorrect_multiplication][buffer_alloc]
             HBufC8* buffer = HBufC8::NewL( aSender.Length() * KMms4 ); // paranoid.
             // we don't need to push buffer onto cleanup stack, as we don't
             // leave while we are using it
@@ -4896,7 +4899,7 @@
         return EFalse;
         }
 
-    TInt maxLength;
+    TInt maxLength=0;
     error = attachFile.Size(maxLength);
     if( error != KErrNone || maxLength == 0 )
         {
--- a/mmsengine/mmscodecclient/bld/mmscodecclient.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmscodecclient/bld/mmscodecclient.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -62,3 +62,6 @@
 
 
 
+
+
+SMPSAFE
--- a/mmsengine/mmsconninit/bld/mmsconninit.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsconninit/bld/mmsconninit.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -56,4 +56,8 @@
 DEBUGLIBRARY    flogger.lib
 #endif
 
+
+
+SMPSAFE
+
 //  End of File
--- a/mmsengine/mmshttptransport/bld/mmstransport.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmshttptransport/bld/mmstransport.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -79,4 +79,8 @@
 deffile         ../bwinscw/mmstransport.def
 #endif
 
+
+
+SMPSAFE
+
 // End of File
--- a/mmsengine/mmsmessage/bld/mmsmessage.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsmessage/bld/mmsmessage.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -74,4 +74,8 @@
 DEFFILE       ../bwins/wins.def
 #endif
 
+
+
+SMPSAFE
+
 //  End of File
--- a/mmsengine/mmspushhandler/bld/mmspushhandler.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmspushhandler/bld/mmspushhandler.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -54,3 +54,6 @@
 LIBRARY         efsrv.lib
 LIBRARY		estor.lib
 DEBUGLIBRARY    flogger.lib
+
+
+SMPSAFE
--- a/mmsengine/mmsserver/bld/mmsserver.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsserver/bld/mmsserver.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -102,4 +102,7 @@
 DEFFILE         ../bmarm/mmsserver.def
 #endif
 
+SMPSAFE
+
+
 // End of File
--- a/mmsengine/mmsserver/src/mmsbaseoperation.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsserver/src/mmsbaseoperation.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -124,6 +124,7 @@
     // expand size is arbitrary. It is not used, we
     // always allocate the amount we need
     iEncodeBuffer = CBufFlat::NewL( 0x100 );
+	// coverity[size_error][buffer_alloc]
     iMmsSession = CMmsSession::NewL( KMmsActiveObjectPriority, iSocketServ, iConnection );
     iRemoteParties = new ( ELeave )CDesCArrayFlat( KMmsArrayAllocationNumber );
     // observe backup/restore event ends
--- a/mmsengine/mmsserver/src/mmsserver.cpp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsserver/src/mmsserver.cpp	Mon Oct 04 00:13:15 2010 +0300
@@ -2671,6 +2671,7 @@
                 // attaData must point to the text
                 // buffer long enough for conversion
                 const TInt KMmsConversionMultiplier = 5;
+				// coverity[incorrect_multiplication][buffer_alloc]
                 HBufC8* dataContent = HBufC8::NewL(
                     iMmsHeaders->ExtendedNotification().Length() * KMmsConversionMultiplier );
                 CleanupStack::PushL( dataContent );
@@ -3862,7 +3863,7 @@
     HBufC8* bufferPointer = HBufC8::NewL( KMaxFileName );
     CleanupStack::PushL( bufferPointer );
     TPtr8 buffer = bufferPointer->Des();
-
+// coverity[assign_zero]
     CDir* fileList = NULL;
 
     // create notifications for local messages:
@@ -3927,6 +3928,7 @@
 #endif
         for (i = 0; i < count; i++ )
             {
+			// coverity[var_deref_model]
             iParse.Set( ( ( *fileList )[i] ).iName, &fileNamePtr, NULL );
             buffer.Copy( iParse.FullName() );
 
--- a/mmsengine/mmsserversettings/bld/mmsserversettings.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmsserversettings/bld/mmsserversettings.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -56,4 +56,7 @@
 deffile         ../bwinscw/mmsserversettings.def
 #endif
 
+
+SMPSAFE
+
 //  End of File
--- a/mmsengine/mmswatcher/bld/mmswatcher.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/mmsengine/mmswatcher/bld/mmswatcher.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -91,4 +91,7 @@
 TARGET		mmswatcher.rsc
 end
 
+SMPSAFE
+
+
 // End of file
--- a/mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h	Fri Sep 17 08:28:39 2010 +0300
+++ b/mobilemessaging/smsmtm/clientmtm/inc/tmsvsmsentry.h	Mon Oct 04 00:13:15 2010 +0300
@@ -23,6 +23,7 @@
 #define __TMSVSMSENTRY_H__
 
 #include <gsmuelem.h>
+#include <smutset.h>
 
 /**
 A specialisation of the message server index class for SMS message entries.
--- a/mobilemessaging/smsmtm/servermtm/group/SMSS.rss	Fri Sep 17 08:28:39 2010 +0300
+++ b/mobilemessaging/smsmtm/servermtm/group/SMSS.rss	Mon Oct 04 00:13:15 2010 +0300
@@ -64,7 +64,12 @@
 				
 				//SMS Errors
 				SEND_ERROR { error = -4814; },	// KErrGsmSMSOperationNotAllowed
-				SEND_ERROR { error = -5252; }	// KPKIErrKeyStoreEmpty
+				SEND_ERROR { error = -5252; },	// KPKIErrKeyStoreEmpty
+				SEND_ERROR { error = -4533; },  // KErrGsmSMSShortMessageTransferRejected
+				SEND_ERROR { error = -4540; },  // KErrGsmSMSUnidentifiedSubscriber
+				SEND_ERROR { error = -4542; },  // KErrGsmSMSUnknownSubscriber
+				SEND_ERROR { error = -4550; },  // KErrGsmSMSNetworkOutOfOrder
+				SEND_ERROR { error = -4608; }   // KErrGsmSMSInvalidMandatoryInformation
 				};
 			},
 		SEND_ERROR_ACTION
--- a/msg_plat/messaging_media_resolver_api/tsrc/group/MediaResolverAPITest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_plat/messaging_media_resolver_api/tsrc/group/MediaResolverAPITest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -47,8 +47,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY			MsgMedia.lib
 LIBRARY			apmime.lib
 LIBRARY			efsrv.lib
@@ -77,4 +77,7 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+
+SMPSAFE
+
 // End of File
--- a/msg_plat/mms_application_api/tsrc/group/MmsApplicationTest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_plat/mms_application_api/tsrc/group/MmsApplicationTest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -49,8 +49,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY         mmsappadapter.lib msgs.lib mmscli.lib
 LIBRARY         mmsserversettings.lib
 
@@ -78,4 +78,7 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+SMPSAFE
+
+
 // End of File
--- a/msg_plat/mms_codec_client_api/tsrc/group/MmsCodecClientApiTest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_plat/mms_codec_client_api/tsrc/group/MmsCodecClientApiTest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -50,8 +50,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib 
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib 
 LIBRARY         msgs.lib
 LIBRARY         mmscodecclient.lib
 LIBRARY         efsrv.lib
@@ -81,4 +81,7 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+SMPSAFE
+
+
 // End of File
--- a/msg_plat/mms_conformance_api/tsrc/group/MMSConformanceAPITest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_plat/mms_conformance_api/tsrc/group/MMSConformanceAPITest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -47,8 +47,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY			efsrv.lib
 LIBRARY         apmime.lib
 LIBRARY			MsgMedia.lib
@@ -77,4 +77,8 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+
+SMPSAFE
+
 // End of File
+
--- a/msg_plat/mms_server_settings_api/tsrc/group/MmsServerSettingsTest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_plat/mms_server_settings_api/tsrc/group/MmsServerSettingsTest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -47,8 +47,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY         mmsserversettings.lib
 LIBRARY         centralrepository.lib
 LIBRARY         mmsappadapter.lib
@@ -81,4 +81,7 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+
+SMPSAFE
+
 // End of File
--- a/msg_pub/mms_client_mtm_api/tsrc/bc/group/MMSClientMTMBCTester.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_pub/mms_client_mtm_api/tsrc/bc/group/MMSClientMTMBCTester.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -56,7 +56,7 @@
 
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
+LIBRARY         StifTestInterface.lib
 LIBRARY			msgs.lib
 LIBRARY			efsrv.lib
 LIBRARY			charconv.lib
@@ -72,4 +72,8 @@
 LANG            SC
 
 
+
+SMPSAFE
+
+
 // End of file: MMSClientMTMBCTester.mmp
--- a/msg_pub/mms_client_mtm_api/tsrc/group/MmsClientMtmApiTest.mmp	Fri Sep 17 08:28:39 2010 +0300
+++ b/msg_pub/mms_client_mtm_api/tsrc/group/MmsClientMtmApiTest.mmp	Mon Oct 04 00:13:15 2010 +0300
@@ -48,8 +48,8 @@
 //RESOURCE        resource_file2
 
 LIBRARY         euser.lib
-LIBRARY         stiftestinterface.lib
-LIBRARY         stiftestengine.lib
+LIBRARY         StifTestInterface.lib
+LIBRARY         StifTestEngine.lib
 LIBRARY         msgs.lib
 LIBRARY         mmscli.lib
 
@@ -77,4 +77,7 @@
 // DEFFILE ?filename
 // AIF ?filename
 
+SMPSAFE
+
+
 // End of File
--- a/package_definition.xml	Fri Sep 17 08:28:39 2010 +0300
+++ b/package_definition.xml	Mon Oct 04 00:13:15 2010 +0300
@@ -60,7 +60,7 @@
    </component>
   </collection>
   <collection id="mobilemessaging" name="Mobile Messaging" level="plugin">
-   <component id="smsmtm" name="SMS MTM" purpose="optional" class="plugin">
+   <component id="smsmtm" name="SMS MTM" purpose="optional" class="plugin" filter="s60">
     <unit bldFile="mobilemessaging/smsmtm/group" mrp="mobilemessaging/smsmtm/group/messaging_sms.mrp"/>
    </component>
   </collection>
@@ -72,10 +72,10 @@
    <component id="msgmedia" filter="s60" name="Message Media">
       <unit base="messagingappbase/msgmedia"/>
    </component>
-   <component id="smilparser" name="SMIL Parser" introduced="7.0s" purpose="optional">
+   <component id="smilparser" name="SMIL Parser" introduced="7.0s" purpose="optional" filter="s60">
     <unit bldFile="messagingappbase/smilparser/GROUP" mrp="messagingappbase/smilparser/GROUP/messaging_gmxml.mrp"/>
    </component>
-   <component id="obexmtms" name="OBEX MTMs" introduced="7.0s" purpose="optional" class="plugin">
+   <component id="obexmtms" name="OBEX MTMs" introduced="7.0s" purpose="optional" class="plugin" filter="s60">
     <unit bldFile="messagingappbase/obexmtms/Group" mrp="messagingappbase/obexmtms/Group/messaging_obex.mrp"/>
    </component>
   </collection>
@@ -116,10 +116,10 @@
    <component id="mmscodecclient" filter="s60" name="MMS Codec Client">
     <unit bldFile="mmsengine/mmscodecclient/bld"/>
    </component>
-   <component id="mmssettings" name="MMS Settings" introduced="9.2" purpose="optional">
+   <component id="mmssettings" name="MMS Settings" introduced="9.2" purpose="optional" filter="s60">
     <unit bldFile="mmsengine/mmssettings/group" mrp="mmsengine/mmssettings/group/messaging_mmssettings.mrp"/>
    </component>
-   <component id="mmsconf" name="MMS Configuration" purpose="optional">
+   <component id="mmsconf" name="MMS Configuration" purpose="optional" filter="s60">
     <unit bldFile="mmsengine/mmsconf" mrp="mmsengine/mmsconf/messaging_mmssettings-config.mrp"/>
    </component>
    <component id="mmsengine_build" filter="s60" name="MMS Engine Build">
@@ -157,10 +157,10 @@
   </collection>
   <collection id="email" name="Email" level="plugin">
    <!-- use commonemail instead -->
-   <component id="pop3andsmtpmtm" name="POP3 and SMTP MTM" purpose="optional" class="plugin" deprecated="^3">
+   <component id="pop3andsmtpmtm" name="POP3 and SMTP MTM" purpose="optional" class="plugin" deprecated="^3" filter="s60">
     <unit bldFile="email/pop3andsmtpmtm/group" mrp="email/pop3andsmtpmtm/group/messaging_email.mrp"/>
    </component>
-   <component id="imap4mtm" name="IMAP4 MTM" introduced="9.2" purpose="optional" class="plugin" deprecated="^3">
+   <component id="imap4mtm" name="IMAP4 MTM" introduced="9.2" purpose="optional" class="plugin" deprecated="^3" filter="s60">
     <unit bldFile="email/imap4mtm/group" mrp="email/imap4mtm/group/messaging_email_imap.mrp"/>
    </component>
   </collection>