201025
authorhgs
Fri, 25 Jun 2010 15:47:40 +0530
changeset 37 518b245aa84c
parent 25 84d9eb65b26f
child 38 4e4b6adb1024
201025
email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp
email/imap4mtm/imapsession/inc/cimapfetchbody.h
email/imap4mtm/imapsession/src/cimapfetchbody.cpp
email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp
email/pop3andsmtpmtm/clientmtms/group/IMCM.rss
email/pop3andsmtpmtm/clientmtms/group/bld.inf
email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H
email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h
email/pop3andsmtpmtm/clientmtms/loc/imcm.loc
email/pop3andsmtpmtm/clientmtms/loc/imcm_default_charset.loc
email/pop3andsmtpmtm/clientmtms/rom/gtemailmtm.hby
email/pop3andsmtpmtm/clientmtms/rom/gtemailmtmResources.iby
email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP
email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp
email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP
email/pop3andsmtpmtm/clientmtms/test/data/RFCT_IMCM06/Entry_Structure.txt
email/pop3andsmtpmtm/group/emailerr.ra
email/pop3andsmtpmtm/imapservermtm/test/data/rfc_0001.txt
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_02_18.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_04.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_05.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_06.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_07.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_08.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_09.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_10.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_11.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_12.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_13.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_14.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_15.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_19.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_21.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_22.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_23.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_24.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_25.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_27.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_28.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_30.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_31.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_32.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_33.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_34.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_35.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_36.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_37.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_38.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_39.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_40.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_41.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_42.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_45_61_62.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_47_48.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_49_50.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_51.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_52.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_54.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_55.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_56.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_57.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_58.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_64.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_65_66.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_67_68.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_70.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_71.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_73to75.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_76.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_77.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_78.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_79_80.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_empty.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_no_synch.out
email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_uid_refresh.out
email/pop3andsmtpmtm/popservermtm/test/data/connect.out
email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit.out
email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit1.out
email/pop3andsmtpmtm/popservermtm/test/data/delete_all.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all1.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all10.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all2.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all3.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all4.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all5.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all6.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all7.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all8.out
email/pop3andsmtpmtm/popservermtm/test/data/download_all9.out
email/pop3andsmtpmtm/popservermtm/test/data/download_large_param.out
email/pop3andsmtpmtm/popservermtm/test/data/download_two.out
email/pop3andsmtpmtm/popservermtm/test/data/missing_fields_download.out
email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_copy.out
email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit.out
email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit1.out
email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_top.out
email/pop3andsmtpmtm/popservermtm/test/data/tpops5_second_delete.out
email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/ASCIIEntry_822Headers.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/NoneEntry_822Headers.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UTF7Entry_822Headers.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UnknownEntry_822Headers.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/Charset_UTF7_Info_ImcvSendOutputText.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/None_Info_ImcvSendOutputText.txt
email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/Service_UTF7_Info_ImcvSendOutputText.txt
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_helo.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_hostname.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_quit_if_tls_on.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_cram_md5.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_login.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_no_smtp_auth_on_server.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_plain.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_password.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_username.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_cram.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_login.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth.out
email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth_on_server.out
inc/convergedmessage.h
inc/conversationidpsconsts.h
inc/msgbiouids.h
inc/msgcontacthandler.h
inc/unidatamodelplugininterface.h
inc/unidatamodelplugininterface.inl
messagingapp/conf/backup_registration.xml
messagingapp/conf/messaging_101F87EB.crml
messagingapp/conf/messaging_101F87EC.crml
messagingapp/conf/messaging_101F87ED.crml
messagingapp/conf/messaging_101F87EE.crml
messagingapp/conf/messaging_101F87EF.crml
messagingapp/conf/messaging_101F8873.crml
messagingapp/conf/messaging_101F8F28.crml
messagingapp/conf/messaging_102071F2.crml
messagingapp/conf/messaging_102072E2.crml
messagingapp/conf/messaging_102072E5.crml
messagingapp/conf/messaging_102824A0.crml
messagingapp/conf/messaging_1028281E.crml
messagingapp/conf/messaging_conf.pro
messagingapp/messagingapp.pro
messagingapp/msgappfw/client/bwins/csserverclientapiu.def
messagingapp/msgappfw/client/eabi/csserverclientapiu.def
messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp
messagingapp/msgappfw/client/src/ccsrequesthandler.cpp
messagingapp/msgappfw/client/src/rcssession.cpp
messagingapp/msgappfw/msgappfw.pro
messagingapp/msgappfw/msghistory/msghistory.pro
messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp
messagingapp/msgappfw/msghistory/src/msgitem.cpp
messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp
messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp
messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp
messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp
messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro
messagingapp/msgappfw/plugin/group/csmsg.mmp
messagingapp/msgappfw/plugin/inc/ccsmsg.h
messagingapp/msgappfw/plugin/inc/ccsmsghandler.h
messagingapp/msgappfw/plugin/inc/ccsmsgpluginutility.h
messagingapp/msgappfw/plugin/inc/mcsmsgobserver.h
messagingapp/msgappfw/plugin/plugin.pro
messagingapp/msgappfw/plugin/rom/csmsg.iby
messagingapp/msgappfw/plugin/rss/csmsg.rss
messagingapp/msgappfw/plugin/src/ccsmsg.cpp
messagingapp/msgappfw/plugin/src/ccsmsghandler.cpp
messagingapp/msgappfw/plugin/src/ccsmsgpluginutility.cpp
messagingapp/msgappfw/plugin/src/proxy.cpp
messagingapp/msgappfw/plugins/msgplugin/group/csmsg.mmp
messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsg.h
messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsghandler.h
messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsgpluginutility.h
messagingapp/msgappfw/plugins/msgplugin/inc/mcsmsgobserver.h
messagingapp/msgappfw/plugins/msgplugin/msgplugin.pro
messagingapp/msgappfw/plugins/msgplugin/rom/csmsg.iby
messagingapp/msgappfw/plugins/msgplugin/rss/csmsg.rss
messagingapp/msgappfw/plugins/msgplugin/src/ccsmsg.cpp
messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp
messagingapp/msgappfw/plugins/msgplugin/src/ccsmsgpluginutility.cpp
messagingapp/msgappfw/plugins/msgplugin/src/proxy.cpp
messagingapp/msgappfw/plugins/msgplugin/tsrc/conf/test_plugin.cfg
messagingapp/msgappfw/plugins/msgplugin/tsrc/group/bld.inf
messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp
messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.pkg
messagingapp/msgappfw/plugins/msgplugin/tsrc/inc/test_plugin.h
messagingapp/msgappfw/plugins/msgplugin/tsrc/init/TestFramework.ini
messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_plugin.cpp
messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_pluginblocks.cpp
messagingapp/msgappfw/plugins/plugins.pro
messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp
messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewplugin.h
messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h
messagingapp/msgappfw/plugins/previewplugin/previewplugin.pro
messagingapp/msgappfw/plugins/previewplugin/rom/cspreviewplugin.iby
messagingapp/msgappfw/plugins/previewplugin/rss/cspreviewplugin.rss
messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewplugin.cpp
messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp
messagingapp/msgappfw/plugins/previewplugin/src/proxy.cpp
messagingapp/msgappfw/plugins/previewplugin/tsrc/.cproject
messagingapp/msgappfw/plugins/previewplugin/tsrc/.project
messagingapp/msgappfw/plugins/previewplugin/tsrc/Makefile
messagingapp/msgappfw/plugins/previewplugin/tsrc/conf/test_pluginpreview.cfg
messagingapp/msgappfw/plugins/previewplugin/tsrc/group/bld.inf
messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp
messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg
messagingapp/msgappfw/plugins/previewplugin/tsrc/inc/test_pluginpreview.h
messagingapp/msgappfw/plugins/previewplugin/tsrc/init/TestFramework.ini
messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreview.cpp
messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreviewblocks.cpp
messagingapp/msgappfw/server/backup_registration.xml
messagingapp/msgappfw/server/inc/ccsbackuphandler.h
messagingapp/msgappfw/server/inc/ccscontactsmanager.h
messagingapp/msgappfw/server/inc/ccsconversation.h
messagingapp/msgappfw/server/inc/ccsconversationcache.h
messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h
messagingapp/msgappfw/server/inc/ccsconversationevent.h
messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h
messagingapp/msgappfw/server/inc/ccsserver.h
messagingapp/msgappfw/server/inc/ccssession.h
messagingapp/msgappfw/server/inc/mcsconversationdeleteobserver.h
messagingapp/msgappfw/server/inc/mcsconversationmarkreadobserver.h
messagingapp/msgappfw/server/rom/csserver.iby
messagingapp/msgappfw/server/server.pro
messagingapp/msgappfw/server/src/ccsbackuphandler.cpp
messagingapp/msgappfw/server/src/ccscontactsmanager.cpp
messagingapp/msgappfw/server/src/ccscontactsresolver.cpp
messagingapp/msgappfw/server/src/ccsconversation.cpp
messagingapp/msgappfw/server/src/ccsconversationcache.cpp
messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp
messagingapp/msgappfw/server/src/ccsconversationcontact.cpp
messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp
messagingapp/msgappfw/server/src/ccsconversationevent.cpp
messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp
messagingapp/msgappfw/server/src/ccsserver.cpp
messagingapp/msgappfw/server/src/ccssession.cpp
messagingapp/msgappfw/sis/conversation_server.pkg
messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg
messagingapp/msgappfw/sis/messaging_armv5_urel.pkg
messagingapp/msgappfw/sis/rd-key.pem
messagingapp/msgappfw/sis/rd.cer
messagingapp/msgappfw/utils/src/ccsconversationentry.cpp
messagingapp/msgappfw/utils/src/ccsdebug.cpp
messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h
messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro
messagingapp/msgnotifications/msgerrornotifier/src/main.cpp
messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp
messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicatorplugin.h
messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro
messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp
messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp
messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp
messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro
messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.qrc
messagingapp/msgnotifications/msgnotificationdialogplugin/resources/mms.svg
messagingapp/msgnotifications/msgnotificationdialogplugin/resources/ringingtone.svg
messagingapp/msgnotifications/msgnotificationdialogplugin/resources/sms.svg
messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp
messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h
messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h
messagingapp/msgnotifications/msgnotifier/msgnotifier.pro
messagingapp/msgnotifications/msgnotifier/src/main.cpp
messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp
messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp
messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp
messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def
messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp
messagingapp/msgservices/msgserviceapp/inc/msgsendinterface.h
messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h
messagingapp/msgservices/msgserviceapp/inc/msgservicewindow.h
messagingapp/msgservices/msgserviceapp/inc/msgshareuiinterface.h
messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h
messagingapp/msgservices/msgserviceapp/inc/msgviewinterface.h
messagingapp/msgservices/msgserviceapp/msgserviceapp.pro
messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc
messagingapp/msgservices/msgserviceapp/resources/messaging_en_GB
messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby
messagingapp/msgservices/msgserviceapp/service_conf.xml
messagingapp/msgservices/msgserviceapp/src/main.cpp
messagingapp/msgservices/msgserviceapp/src/msgsendinterface.cpp
messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp
messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp
messagingapp/msgservices/msgserviceapp/src/msgshareuiinterface.cpp
messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp
messagingapp/msgservices/msgserviceapp/src/msgviewinterface.cpp
messagingapp/msgservices/msgservices.pro
messagingapp/msgsettings/bwins/settingsviewu.def
messagingapp/msgsettings/eabi/settingsviewu.def
messagingapp/msgsettings/msginit/msginit.pro
messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp
messagingapp/msgsettings/settingsview/inc/msgsettingengine.h
messagingapp/msgsettings/settingsview/inc/msgsettingsform.h
messagingapp/msgsettings/settingsview/inc/msgsettingsview.h
messagingapp/msgsettings/settingsview/inc/msgsmscentersettingsform.h
messagingapp/msgsettings/settingsview/rom/settingsview.iby
messagingapp/msgsettings/settingsview/settingsview.pro
messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp
messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp
messagingapp/msgsettings/settingsview/src/msgsettingsdataformcustomitem.cpp
messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp
messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp
messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp
messagingapp/msgsettings/settingsview/src/msgsmscenterview.cpp
messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg
messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.sis
messagingapp/msgui/appengine/appengine.pro
messagingapp/msgui/appengine/inc/conversationlistchangehandler.h
messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h
messagingapp/msgui/appengine/inc/conversationsengine.h
messagingapp/msgui/appengine/inc/conversationsengine_p.h
messagingapp/msgui/appengine/inc/conversationsenginedefines.h
messagingapp/msgui/appengine/inc/conversationsengineutility.h
messagingapp/msgui/appengine/inc/conversationsmodel.h
messagingapp/msgui/appengine/inc/conversationssummarymodel.h
messagingapp/msgui/appengine/src/conversationchangehandler.cpp
messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp
messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp
messagingapp/msgui/appengine/src/conversationsengine.cpp
messagingapp/msgui/appengine/src/conversationsengine_p.cpp
messagingapp/msgui/appengine/src/conversationsengineutility.cpp
messagingapp/msgui/appengine/src/conversationsmodel.cpp
messagingapp/msgui/appengine/src/conversationssummarymodel.cpp
messagingapp/msgui/appengine/src/draftsmodel.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationengine.h
messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationenginestub.h
messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h
messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationupdatehandler.h
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationupdatehandler.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/src/testrcssession.cpp
messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro
messagingapp/msgui/bwins/appengineu.def
messagingapp/msgui/bwins/conversationviewu.def
messagingapp/msgui/bwins/msgaudiofetcheru.def
messagingapp/msgui/bwins/msgsettingsu.def
messagingapp/msgui/bwins/msguiutilsu.def
messagingapp/msgui/bwins/unifiededitoru.def
messagingapp/msgui/bwins/unifiedvieweru.def
messagingapp/msgui/conversationview/conversationview.pro
messagingapp/msgui/conversationview/conversationview.qrc
messagingapp/msgui/conversationview/inc/msgcharcounter.h
messagingapp/msgui/conversationview/inc/msgcharcounter_p.h
messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h
messagingapp/msgui/conversationview/inc/msgconversationbaseview.h
messagingapp/msgui/conversationview/inc/msgconversationview.h
messagingapp/msgui/conversationview/inc/msgconversationviewitem.h
messagingapp/msgui/conversationview/inc/msgconversationwidget.h
messagingapp/msgui/conversationview/inc/msgeditorwidget.h
messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.css
messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.widgetml
messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget_color.css
messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.css
messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.widgetml
messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css
messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml
messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget_color.css
messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.css
messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.widgetml
messagingapp/msgui/conversationview/src/msgcharcounter.cpp
messagingapp/msgui/conversationview/src/msgcharcounter_p.cpp
messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp
messagingapp/msgui/conversationview/src/msgconversationbaseview.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/conversationview/src/msgviewutils.cpp
messagingapp/msgui/conversationview/tsrc/tsrc.pro
messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h
messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h
messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp
messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro
messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro
messagingapp/msgui/eabi/appengineu.def
messagingapp/msgui/eabi/conversationviewu.def
messagingapp/msgui/eabi/msgaudiofetcheru.def
messagingapp/msgui/eabi/msgsettingsu.def
messagingapp/msgui/eabi/msguiutilsu.def
messagingapp/msgui/eabi/unifiededitoru.def
messagingapp/msgui/eabi/unifiedvieweru.def
messagingapp/msgui/inc/msgbaseview.h
messagingapp/msgui/layoutplugins/conversationviewplugin/conversationviewplugin.pro
messagingapp/msgui/layoutplugins/conversationviewplugin/conversationviewplugin.qrc
messagingapp/msgui/layoutplugins/conversationviewplugin/inc/conversationviewplugin.h
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgcontactcardwidget.css
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgcontactcardwidget.widgetml
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationviewitem.css
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationviewitem.widgetml
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationwidget.css
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationwidget.widgetml
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgeditorwidget.css
messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgeditorwidget.widgetml
messagingapp/msgui/layoutplugins/conversationviewplugin/rom/conversationviewplugin.iby
messagingapp/msgui/layoutplugins/conversationviewplugin/src/conversationviewplugin.cpp
messagingapp/msgui/layoutplugins/layoutplugins.pro
messagingapp/msgui/layoutplugins/msglistviewitemplugin/inc/msglistviewitemplugin.h
messagingapp/msgui/layoutplugins/msglistviewitemplugin/msglistviewitemplugin.pro
messagingapp/msgui/layoutplugins/msglistviewitemplugin/msglistviewitemplugin.qrc
messagingapp/msgui/layoutplugins/msglistviewitemplugin/resources/msglistviewitemwidget.css
messagingapp/msgui/layoutplugins/msglistviewitemplugin/resources/msglistviewitemwidget.widgetml
messagingapp/msgui/layoutplugins/msglistviewitemplugin/rom/msglistviewitemplugin.iby
messagingapp/msgui/layoutplugins/msglistviewitemplugin/src/msglistviewitemplugin.cpp
messagingapp/msgui/layoutplugins/unifiededitorplugin/inc/unifiededitorplugin.h
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitoraddress.css
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitoraddress.widgetml
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorattachment.css
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorattachment.widgetml
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorbody.css
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorbody.widgetml
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorsubject.css
messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorsubject.widgetml
messagingapp/msgui/layoutplugins/unifiededitorplugin/rom/unifiededitorplugin.iby
messagingapp/msgui/layoutplugins/unifiededitorplugin/src/unifiededitorplugin.cpp
messagingapp/msgui/layoutplugins/unifiededitorplugin/unifiededitorplugin.pro
messagingapp/msgui/layoutplugins/unifiededitorplugin/unifiededitorplugin.qrc
messagingapp/msgui/layoutplugins/unifiedviewerplugin/inc/unifiedviewerplugin.h
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univieweraddresswidget.css
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univieweraddresswidget.widgetml
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerbodywidget.css
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerbodywidget.widgetml
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerdetailswidget.css
messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerdetailswidget.widgetml
messagingapp/msgui/layoutplugins/unifiedviewerplugin/rom/unifiededitorplugin.iby
messagingapp/msgui/layoutplugins/unifiedviewerplugin/src/unifiedviewerplugin.cpp
messagingapp/msgui/layoutplugins/unifiedviewerplugin/unifiedviewerplugin.pro
messagingapp/msgui/layoutplugins/unifiedviewerplugin/unifiedviewerplugin.qrc
messagingapp/msgui/msgapp/inc/draftslistview.h
messagingapp/msgui/msgapp/inc/msgactivityhandler.h
messagingapp/msgui/msgapp/inc/msglistview.h
messagingapp/msgui/msgapp/inc/msglistviewitem.h
messagingapp/msgui/msgapp/inc/msgmainwindow.h
messagingapp/msgui/msgapp/inc/msgserviceinterface.h
messagingapp/msgui/msgapp/inc/msgviewmanager.h
messagingapp/msgui/msgapp/msgapp.pro
messagingapp/msgui/msgapp/msgapp.qrc
messagingapp/msgui/msgapp/resources/icons/qtg_large_message.svg
messagingapp/msgui/msgapp/resources/xml/messaging101.docml
messagingapp/msgui/msgapp/resources/xml/messaging101.splashml
messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.docml
messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.splashml
messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css
messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml
messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css
messagingapp/msgui/msgapp/rom/msgapp.iby
messagingapp/msgui/msgapp/src/draftslistview.cpp
messagingapp/msgui/msgapp/src/main.cpp
messagingapp/msgui/msgapp/src/msgactivityhandler.cpp
messagingapp/msgui/msgapp/src/msglistview.cpp
messagingapp/msgui/msgapp/src/msglistviewitem.cpp
messagingapp/msgui/msgapp/src/msgmainwindow.cpp
messagingapp/msgui/msgapp/src/msgserviceinterface.cpp
messagingapp/msgui/msgapp/src/msgviewmanager.cpp
messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetchermodel.h
messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h
messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h
messagingapp/msgui/msgaudiofetcher/inc/msgaudiopreview.h
messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h
messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro
messagingapp/msgui/msgaudiofetcher/rom/msgaudiofetcher.iby
messagingapp/msgui/msgaudiofetcher/src/msgaudiofetchermodel.cpp
messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp
messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp
messagingapp/msgui/msgaudiofetcher/src/msgaudiopreview.cpp
messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp
messagingapp/msgui/msgui.pro
messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h
messagingapp/msgui/msguiutils/inc/msgcontactsutil.h
messagingapp/msgui/msguiutils/msguiutils.pro
messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp
messagingapp/msgui/msguiutils/src/msgcontactsutil.cpp
messagingapp/msgui/msguiutils/src/msgmediautil.cpp
messagingapp/msgui/unifiededitor/inc/mmssettingsdefs.h
messagingapp/msgui/unifiededitor/inc/msgattachmentcontainer.h
messagingapp/msgui/unifiededitor/inc/msgmonitor.h
messagingapp/msgui/unifiededitor/inc/msgmonitor.inl
messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h
messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h
messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h
messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h
messagingapp/msgui/unifiededitor/inc/msgunieditorbasewidget.h
messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h
messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h
messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h
messagingapp/msgui/unifiededitor/inc/msgunieditormmssettingsdefs.h
messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.h
messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.inl
messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h
messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h
messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h
messagingapp/msgui/unifiededitor/inc/msgunieditorutils.h
messagingapp/msgui/unifiededitor/inc/msgunieditorview.h
messagingapp/msgui/unifiededitor/inc/msgunifiededitorlineedit.h
messagingapp/msgui/unifiededitor/resources/animation.axml
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitoraddress.css
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitoraddress.widgetml
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.css
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.widgetml
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment_color.css
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.css
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorsubject.css
messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorsubject.widgetml
messagingapp/msgui/unifiededitor/resources/qtg_anim_loading.axml
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_1.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_2.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_3.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_4.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_5.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_6.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_7.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_8.svg
messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_9.svg
messagingapp/msgui/unifiededitor/src/msgattachmentcontainer.cpp
messagingapp/msgui/unifiededitor/src/msgmonitor.cpp
messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp
messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorlineedit.cpp
messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorutils.cpp
messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp
messagingapp/msgui/unifiededitor/src/msgunifiededitorlineedit.cpp
messagingapp/msgui/unifiededitor/unifiededitor.pro
messagingapp/msgui/unifiededitor/unifiededitor.qrc
messagingapp/msgui/unifiedviewer/inc/unicontentswidget.h
messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h
messagingapp/msgui/unifiedviewer/inc/unihighlighter.h
messagingapp/msgui/unifiedviewer/inc/uniscrollarea.h
messagingapp/msgui/unifiedviewer/inc/unitexteditor.h
messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h
messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h
messagingapp/msgui/unifiedviewer/inc/univiewerattachmentcontainer.h
messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h
messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h
messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h
messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h
messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h
messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h
messagingapp/msgui/unifiedviewer/inc/univiewermediawidget.h
messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h
messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h
messagingapp/msgui/unifiedviewer/inc/univiewerutils.h
messagingapp/msgui/unifiedviewer/inc/univiewslidewidget.h
messagingapp/msgui/unifiedviewer/resources/layouts/univieweraddresswidget.css
messagingapp/msgui/unifiedviewer/resources/layouts/univieweraddresswidget.widgetml
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.widgetml
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget_color.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget_color.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.css
messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.widgetml
messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget_color.css
messagingapp/msgui/unifiedviewer/src/unicontentswidget.cpp
messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp
messagingapp/msgui/unifiedviewer/src/unihighlighter.cpp
messagingapp/msgui/unifiedviewer/src/uniscrollarea.cpp
messagingapp/msgui/unifiedviewer/src/unitexteditor.cpp
messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp
messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewerattachmentcontainer.cpp
messagingapp/msgui/unifiedviewer/src/univiewerattachmentwidget.cpp
messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp
messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp
messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp
messagingapp/msgui/unifiedviewer/src/univiewermediawidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp
messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp
messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp
messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp
messagingapp/msgui/unifiedviewer/unifiedviewer.pro
messagingapp/msgui/unifiedviewer/unifiedviewer.qrc
messagingapp/msgutils/bwins/s60qconversionsu.def
messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro
messagingapp/msgutils/eabi/s60qconversionsu.def
messagingapp/msgutils/msgutils.pro
messagingapp/msgutils/s60qconversions/bwins/s60qconversionsu.def
messagingapp/msgutils/s60qconversions/inc/s60qconversiondefines.h
messagingapp/msgutils/s60qconversions/inc/s60qconversions.h
messagingapp/msgutils/s60qconversions/rom/s60qconversions.iby
messagingapp/msgutils/s60qconversions/s60qconversions.pro
messagingapp/msgutils/s60qconversions/src/s60qconversions.cpp
messagingapp/msgutils/s60qconversions/tsrc/ut/bwins/t_s60qconversionsu.def
messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.cpp
messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.h
messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.pro
messagingapp/msgutils/unidatautils/unidatamodel/inc/UniDataModel.inl
messagingapp/msgutils/unidatautils/unidatamodel/inc/UniSmilModel.inl
messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataModel.cpp
messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp
messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp
messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp
messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp
messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.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/src/unibiomessagedataplugin_p.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro
messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro
messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def
messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def
messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro
messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h
messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp
messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/bwins/test_mms_pluginu.def
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/mms.rsc
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/not.rsc
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.ini
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmsg.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro
messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro
messagingapp/shareui/inc/shareuiprivate.h
messagingapp/shareui/rom/shareui.iby
messagingapp/shareui/shareui.pro
messagingapp/shareui/sis/shareui.pkg
messagingapp/shareui/sis/shareui_stub.pkg
messagingapp/shareui/sis/shareui_stub.sis
messagingapp/shareui/src/shareuiprivate.cpp
messagingapp/shareui/tsrc/testshareui/inc/testshareuimainwindow.h
messagingapp/shareui/tsrc/testshareui/inc/testshareuiview.h
messagingapp/shareui/tsrc/testshareui/main.cpp
messagingapp/shareui/tsrc/testshareui/rom/testshareui.iby
messagingapp/shareui/tsrc/testshareui/sis/testshareui.pkg
messagingapp/shareui/tsrc/testshareui/sis/testshareui.sisx
messagingapp/shareui/tsrc/testshareui/src/main.cpp
messagingapp/shareui/tsrc/testshareui/src/testshareuimainwindow.cpp
messagingapp/shareui/tsrc/testshareui/src/testshareuiview.cpp
messagingapp/shareui/tsrc/testshareui/testshareui.pro
messagingapp/shareui/tsrc/testshareui/testshareuimainwindow.cpp
messagingapp/shareui/tsrc/testshareui/testshareuimainwindow.h
messagingapp/shareui/tsrc/testshareui/testshareuiview.cpp
messagingapp/shareui/tsrc/testshareui/testshareuiview.h
messagingapp/smartmessaging/bwins/ringbcu.def
messagingapp/smartmessaging/eabi/ringbcu.def
messagingapp/smartmessaging/ringbc/inc/ringbc.h
messagingapp/smartmessaging/ringbc/inc/ringbc_p.h
messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h
messagingapp/smartmessaging/ringbc/ringbc.pro
messagingapp/smartmessaging/ringbc/src/ringbc.cpp
messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp
messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp
messagingappbase/msgmedia/src/MsgMediaResolver.cpp
messagingappbase/msgmedia/src/MsgVideoInfo.cpp
messagingappbase/obexmtms/Rom/obex.hby
messagingappbase/obexmtms/Rom/obex.iby
messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/BLD.INF
messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/bld.inf
messagingappbase/obexmtms/TObexMTM/testutils/msgth/group/BLD.INF
messagingappbase/obexmtms/TObexMTM/testutils/msgth/group/bld.inf
messagingappbase/obexmtms/btmtm/btclient/group/BLD.INF
messagingappbase/obexmtms/btmtm/btclient/group/bld.inf
messagingappbase/obexmtms/btmtm/btserver/group/BLD.INF
messagingappbase/obexmtms/btmtm/btserver/group/bld.inf
messagingappbase/obexmtms/irmtm/irclient/group/BLD.INF
messagingappbase/obexmtms/irmtm/irclient/group/bld.inf
messagingappbase/obexmtms/irmtm/irserver/group/BLD.INF
messagingappbase/obexmtms/irmtm/irserver/group/bld.inf
messagingappbase/obexmtms/obexmtm/obexclient/group/BLD.INF
messagingappbase/obexmtms/obexmtm/obexclient/group/bld.inf
messagingappbase/obexmtms/obexmtm/obexserver/group/BLD.INF
messagingappbase/obexmtms/obexmtm/obexserver/group/bld.inf
messagingappbase/obexmtms/obexmtm/obexutil/group/BLD.INF
messagingappbase/obexmtms/obexmtm/obexutil/group/bld.inf
messagingappbase/smilparser/Rom/BLD.INF
messagingappbase/smilparser/Rom/bld.inf
messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (2) of meta_att_2.txt
messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (3) of meta_att_2.txt
messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (4) of meta_att_2.txt
messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (5) of meta_att_2.txt
messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy of meta_att_2.txt
mmsengine/conf/mmsengine.confml
mmsengine/mmscodec/src/mmsencode.cpp
mmsengine/mmsengine.pro
mmsengine/mmsserversettings/src/mmssettings.cpp
mmsengine/mmswatcher/src/10005948.rss
mobilemessaging/smsmtm/clientmtm/group/smcm.mmp
mobilemessaging/smsmtm/clientmtm/inc/smut.h
mobilemessaging/smsmtm/clientmtm/src/smut.cpp
msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h
msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h
msg_plat/conversation_services_client_api/inc/rcssession.h
msg_plat/conversation_services_utilities_api/inc/ccsdefs.h
msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h
msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl
msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h
msg_plat/mms_conformance_api/tsrc/data/mmc/mmsconformancedata/testcorrupt.amr
msg_plat/shareui_api/inc/shareui.h
--- a/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/email/imap4mtm/imapprotocolcontroller/src/cimapopfetchbody.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -167,7 +167,12 @@
 void CImapOpFetchBody::FetchBodyL(TRequestStatus& aRequestStatus, const TMsvId aPart, const TImImap4GetPartialMailInfo& aGetPartialMailInfo)
 	{
 	__LOG_TEXT(iSession->LogId(), "CImapOpFetchBody::FetchBodyL(): fetching message");
-
+	
+	if(IsActive())
+	{
+	    Cancel();
+	}
+	
 	iRequestedPart=aPart;
 	iGetPartialMailInfo=aGetPartialMailInfo;
 	Queue(aRequestStatus);
@@ -1408,6 +1413,7 @@
 		{
 		// Set vCard flag in message
 		aMessage.SetVCard(ETrue);
+		aMessage.iType=KUidMsvEmailTextEntry;
 		}
 	// text/x-vcalendar
 	else if (aMime.ContentSubType().CompareF(KMIME_VCALENDAR)==0)
@@ -1415,6 +1421,7 @@
 		// Set vCalendar flag in message
 		aMessage.SetVCalendar(ETrue);
 		iIsVCalendar = ETrue;
+		aMessage.iType=KUidMsvEmailTextEntry;
 		}
 	// text/calendar
 	else if (aMime.ContentSubType().CompareF(KMIME_ICALENDAR)==0)
@@ -1422,6 +1429,7 @@
 		// Set iCalendar flag in message
 		aMessage.SetICalendar(ETrue);
 		iIsICalendar = ETrue;
+		aMessage.iType=KUidMsvEmailTextEntry;
 		}
 	else
 		aMessage.iType=KUidMsvEmailTextEntry;
@@ -1502,6 +1510,7 @@
 	TPtrC8 dispositionName = aBodyStructure->ExtDispositionName();
 	if (dispositionName.Size() != 0)
 		{
+		aMime.SetContentDispositionL(dispositionName);	
 		__LOG_FORMAT((iSession->LogId(), "    adding disp name: %S", &dispositionName));
 		aMime.ContentDispositionParams().AppendL(dispositionName);
 		aMime.ContentDispositionParams().AppendL(KNullDesC8);
--- a/email/imap4mtm/imapsession/inc/cimapfetchbody.h	Mon May 03 12:29:07 2010 +0300
+++ b/email/imap4mtm/imapsession/inc/cimapfetchbody.h	Fri Jun 25 15:47:40 2010 +0530
@@ -182,6 +182,7 @@
 	TBool iSendFetch;
 	// When server responses with no body length, iUnexpectedFormat is set to ETrue.
 	TBool iUnexpectedFormat;
+	TBool iCancelled;
 	};
 
 #endif // __CIMAPFETCHBODY_H__
--- a/email/imap4mtm/imapsession/src/cimapfetchbody.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/email/imap4mtm/imapsession/src/cimapfetchbody.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -66,7 +66,8 @@
 	iImapMailStore(aImapMailStore),
 	iParent(aParent),
 	iFetchBodyResponse(aFetchBodyResponse),
-	iSendFetch(ETrue)
+	iSendFetch(ETrue),
+	iCancelled(EFalse)
 	{
 	}
 	
@@ -86,7 +87,7 @@
 void CImapFetchBody::Cancel()
 	{
 	__LOG_TEXT(iLogId, "CImapFetchBody::Cancel()"); // Overrides CImapCommand::Cancel()
-	
+	iCancelled = ETrue;
 	iImapMailStore.CancelRequest(*this);
 	CImapCommand::Cancel();
 	}
@@ -226,6 +227,10 @@
 	{	
 	iOutStream=&aStream;
 	
+	if(iCancelled)
+	{
+	   return; 
+	}
 #if (defined SYMBIAN_EMAIL_CAPABILITY_SUPPORT)		
 	// check for BINARY capability
 	const CImapCapabilityInfo& capabilityInfo = iParent.CapabilityInfo();
--- a/email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/group/IMCM.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,6 +19,7 @@
 /**
  @file
 */
+#include <platform_paths.hrh>
 
 TARGET                  imcm.dll
 TARGETPATH              /system/libs
@@ -47,10 +48,10 @@
 LIBRARY			centralrepository.lib tzclient.lib numberconversion.lib
 
 SOURCEPATH              .
-START RESOURCE	IMCM.rss
-TARGETPATH resource/messaging
+START RESOURCE  imcm.rss
 LANG	SC
 HEADER
+TARGETPATH      resource/messaging
 END
 
 #include                "../../../../../../mw/messagingmw/messagingfw/msgtests/group/msgopt.mph"
@@ -70,7 +71,7 @@
 #endif	
 
 
-
+OS_LAYER_SYSTEMINCLUDE
 
 
 
--- a/email/pop3andsmtpmtm/clientmtms/group/IMCM.rss	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/group/IMCM.rss	Fri Jun 25 15:47:40 2010 +0530
@@ -16,6 +16,8 @@
 //
 
 #include "imcm.rls"
+#include <imcm.loc>
+#include <imcm_default_charset.loc>
 
 #define PARABREAK	8233
 #define TABCHAR		9
@@ -37,12 +39,12 @@
 
 RESOURCE LBUF forward_formatting_string
 	{
-	buffer=STRING_forward_formatting_string1;
+	buffer=qtn_mail_fwd"%S";
 	}
 
 RESOURCE LBUF reply_formatting_string
 	{
-	buffer=STRING_reply_formatting_string1;
+	buffer=qtn_mail_re"%S";
 	}
 
 RESOURCE LBUF receipt_formatting_string
@@ -52,17 +54,17 @@
 
 RESOURCE LBUF email_address_formatting_string
 	{
-	buffer=STRING_email_address_formatting_string1;
+	buffer="%S <%S>";//STRING_email_address_formatting_string1;
 	}        
 
 // Headers used in Body for Forwarded/Replyed message
 
 RESOURCE LBUF forward_body_header
 	{
-	buffer=STRING_forward_body_header1
-			STRING_forward_body_header2
-			STRING_forward_body_header3
-			STRING_forward_body_header4;
+	buffer=<PARABREAK><PARABREAK>qtn_mail_forward_separator<PARABREAK>
+			qtn_mail_copy_subject" %S"<PARABREAK>
+			qtn_mail_copy_sender" %S"<PARABREAK>
+			qtn_mail_copy_date" %S"<PARABREAK>;
 	}
 
 RESOURCE LBUF forward_body_header_toonly
@@ -95,10 +97,10 @@
 
 RESOURCE LBUF reply_body_header
 	{
-	buffer=STRING_reply_body_header1
-			STRING_reply_body_header2
-			STRING_reply_body_header3
-			STRING_reply_body_header4;
+	buffer=<PARABREAK><PARABREAK>qtn_mail_reply_separator<PARABREAK>
+			qtn_mail_copy_subject" %S"<PARABREAK>
+			qtn_mail_copy_sender" %S"<PARABREAK>
+			qtn_mail_copy_date" %S"<PARABREAK>;
 	}
 
 RESOURCE LBUF reply_body_header_toonly
@@ -174,28 +176,29 @@
 	}
 
 // List of available character sets in Charconv.h
+// at some point flags should be removed and only qtn_default_charset be used for all builds.
 RESOURCE L8BUF default_system_charset
-	{
-	buffer=STRING_default_system_charset;
-	}
+    {
+    buffer = qtn_default_email_charset;
+    }
 
 // If this value is set to 1, 8 bit body text data and character set information will be stored
 // when downloaded via IMPS and POPS.  The body text will be decoded to the correct character set
 // when opened.  If this value is set to 0, the body text is decoded and stored when downloading.
 RESOURCE INT8 store_8bit_body_text
 	{
-	value = 0;
+	value = 1;
 	}
 
 // Used for localised date time formatting for email forward and reply body headers
 RESOURCE LBUF body_header_datetime_format
 	{
-	buffer=STRING_body_header_datetime_format;
+	buffer="%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:3%+B"; //STRING_body_header_datetime_format;
 	}
 
 RESOURCE LBUF partial_download_footer_message
 	{
-	buffer=STRING_partial_download_footer_message;
+	buffer=qtn_mail_rest_of_mail_not_fetched;
 	}
 
 // If this value is set to 1,body text data  will be stored when downloaded via IMPS and POPS using chunk storage option.  
@@ -203,5 +206,5 @@
 
 RESOURCE INT8 store_plain_body_text
 	{
-	value = 1;
+	value = 0;
 	}
--- a/email/pop3andsmtpmtm/clientmtms/group/bld.inf	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -14,6 +14,7 @@
 // bld.inf
 //
 
+#include <platform_paths.hrh>
 PRJ_EXPORTS
 
 ../inc/MIUTHDR.H 	SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(miuthdr.h)
@@ -64,6 +65,13 @@
 #endif
 
 
+//IBY exports
+../rom/gtemailmtmResources.iby  LANGUAGE_OS_LAYER_IBY_EXPORT_PATH(gtemailmtmResources.iby)
+../rom/gtemailmtm.hby  CORE_OS_LAYER_IBY_EXPORT_PATH(gtemailmtm.hby)
+
+// export localised loc file
+../loc/imcm.loc  OS_LAYER_LOC_EXPORT_PATH(imcm.loc)
+../loc/imcm_default_charset.loc  OS_LAYER_LOC_EXPORT_PATH(imcm_default_charset.loc)
 PRJ_MMPFILES
 
 IMCM.mmp
--- a/email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/inc/MIUTRSLV.H	Fri Jun 25 15:47:40 2010 +0530
@@ -130,6 +130,7 @@
 private:
 	void DoRunL();
 	void DoComplete(TInt& );
+	void DoCancel();
 
 	void CheckCurrentEntryL();
 	inline TBool CheckContentDetailsL(const TDesC& aContentLocation, const TDesC& aContentId);
@@ -210,6 +211,7 @@
 
 	void DoRunL();
 	void DoComplete(TInt& );
+	void DoCancel();
 	inline void SetStartParameterL();
 private:
 	CMsvEntry& iCurrentEntry;
--- a/email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/inc/cimfinder.h	Fri Jun 25 15:47:40 2010 +0530
@@ -57,7 +57,7 @@
 
 private:
 	void DoRunL();
-
+	void DoCancel();
 	virtual void AddChildEntriesL() = 0;
 	virtual TBool IsRequiredEntryType(TUid aEntryType) const = 0;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/email/pop3andsmtpmtm/clientmtms/loc/imcm.loc	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2002 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:  
+*     This is a localisation file for imcm.dll
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined. 
+* >>>
+* The text between >>> and <<< is just to document the syntax and
+* you can remove it if you like.
+*
+*/
+
+
+
+
+// LOCALISATION STRINGS
+
+// d: Added in the beginning of the subject line when replying
+// l: mce_header_field_pane_t1
+#define qtn_mail_re         "RE: "
+
+// d: Added in the beginning of the subject line when forwarding
+// l: mce_header_field_pane_t1
+#define qtn_mail_fwd         "FWD: "
+
+// d: Text to be inserted into a message when replying
+// d: Inerted in the beginning of the original message
+// l: msg_header_pane_t2
+#define qtn_mail_reply_separator "--- original message ---"
+
+// d: Text to be inserted into a message when forwarding
+// d: Inserted in the beginning of the original message
+// l: msg_header_pane_t2
+#define qtn_mail_forward_separator "--- original message ---"
+
+// d: Text to be inserted into a message when forwarding or replying
+// d: Inserted in the beginning of the original message
+// l: msg_header_pane_t2
+#define qtn_mail_copy_subject "Subject:"
+
+// d: Text to be inserted into a message when forwarding or replying
+// d: Inserted in the beginning of the original message
+// l: msg_header_pane_t2
+#define qtn_mail_copy_sender "Sender:"
+
+// d: Text to be inserted into a message when forwarding or replying
+// d: Inserted in the beginning of the original message
+// l: msg_header_pane_t2
+#define qtn_mail_copy_date "Date:"
+
+// d: Text to be inserted into a message body if part of message body is filtered out
+// l:none
+#define qtn_mail_rest_of_mail_not_fetched "- - - Retrieve total mail selecting Retrieve from Options list. - - -"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/email/pop3andsmtpmtm/clientmtms/loc/imcm_default_charset.loc	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2002 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:  
+*		!!!!!!!LOCALISATION INSTRUCTIONS, IMPORTANT!!!!!!!
+*		These default charsets are used to define correct default charsets for different builds.
+*
+*/
+
+
+
+// d: This is not visible to the user!
+// l: None
+#define qtn_default_email_charset "ISO-8859-1"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/email/pop3andsmtpmtm/clientmtms/rom/gtemailmtm.hby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,9 @@
+#ifndef __GTEMAILMTM_HBY__
+#define __GTEMAILMTM_HBY__
+
+//
+// Moved to gtemailmtmResources.iby
+//
+//data=MULTI_LINGUIFY(RSC DATAZ_\resource\messaging\imcm	resource\messaging\imcm)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/email/pop3andsmtpmtm/clientmtms/rom/gtemailmtmResources.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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:  gtemailmtmResources.iby*
+*/
+
+#ifndef __GTEMAILMTM_RESOURCES_IBY__
+#define __GTEMAILMTM_RESOURCES_IBY__
+
+// Refer to gtemailmtm.hby
+data=DATAZ_\resource\messaging\imcm.rsc                                   resource\messaging\imcm.rsc
+
+#endif
\ No newline at end of file
--- a/email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/src/CACHEMAN.CPP	Fri Jun 25 15:47:40 2010 +0530
@@ -122,6 +122,12 @@
 		}
 	}
 
+void CImFinder::DoCancel()
+    {   
+    CMsgActive::DoCancel();   
+    }
+
+
 CImFinder::CImFinder(CMsvEntry& aEntry) : CMsgActive(EPriorityStandard), 	iCurrentEntry(aEntry)
 	{
 	}
--- a/email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/src/CIMPLAINBODYTEXT.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -468,4 +468,5 @@
 void CImPlainBodyText::DoCancel()
 	{
 	iPlainTextArray[iIndex]->Cancel();
+	CMsgActive::DoCancel();
 	}
--- a/email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/clientmtms/src/MIUTRSLV.CPP	Fri Jun 25 15:47:40 2010 +0530
@@ -462,6 +462,12 @@
 			}
 		}
 	}
+	
+	
+void CImMhtmlChildEntrySearcher::DoCancel()
+	{
+	CMsgActive::DoCancel();
+	}	
 
 void CImMhtmlChildEntrySearcher::DoComplete(TInt& )
 	{
@@ -1043,7 +1049,10 @@
 		}
 	}
 
-
+void CImMhtmlFirstPageFinder::DoCancel()
+	{
+		CMsgActive::DoCancel();
+	}
 
 
 // The following class implements a class for parsing and combining URI's.
Binary file email/pop3andsmtpmtm/clientmtms/test/data/RFCT_IMCM06/Entry_Structure.txt has changed
--- a/email/pop3andsmtpmtm/group/emailerr.ra	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/group/emailerr.ra	Fri Jun 25 15:47:40 2010 +0530
@@ -1,228 +1,228 @@
-// Copyright (c) 1999-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:
-//
-
-#include <errors/generic/emailerr.rls>
-
-RESOURCE ARRAY r_error_res_email_pop3_errors
-	{
-	items=
-		{
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_cannot_connect;			// -170
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_invalid_user;				// -171
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_invalid_login;			// -172
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_apop_login_string;		// -173
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_problem_remote;			// -174
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -175
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -176
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -177
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_top_unsupported;			// -178
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -179
-			}
-		};
-	}
-
-RESOURCE TBUF r_error_res_pop3_cannot_connect		{ buf=STRING_r_error_res_pop3_cannot_connect	; }
-RESOURCE TBUF r_error_res_pop3_invalid_user			{ buf=STRING_r_error_res_pop3_invalid_user		; }
-RESOURCE TBUF r_error_res_pop3_invalid_login		{ buf=STRING_r_error_res_pop3_invalid_login	; }
-RESOURCE TBUF r_error_res_pop3_apop_login_string	{ buf=STRING_r_error_res_pop3_apop_login_string; }
-RESOURCE TBUF r_error_res_pop3_problem_remote		{ buf=STRING_r_error_res_pop3_problem_remote	; }
-RESOURCE TBUF r_error_res_pop3_top_unsupported		{ buf=STRING_r_error_res_pop3_top_unsupported	; }
-
-RESOURCE ARRAY r_error_res_email_imsk_errors
-	{
-	items=
-		{
-		SINGLE_ERROR
-			{
-			text=r_error_res_imsk_dns_not_found;			// -180
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imsk_control_panel_locked;		// -181
-			},		
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -182
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imsk_wrong_active_settings;	// -183
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -184
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_TLS_Negotiation_failed;		// -185
-			}
-		};
-	}
-
-RESOURCE TBUF r_error_res_imsk_dns_not_found			{ buf=STRING_r_error_res_imsk_dns_not_found		; }
-RESOURCE TBUF r_error_res_imsk_control_panel_locked		{ buf=STRING_r_error_res_imsk_control_panel_locked	; }
-RESOURCE TBUF r_error_res_imsk_wrong_active_settings	{ buf=STRING_r_error_res_imsk_wrong_active_settings; }
-RESOURCE TBUF r_error_res_TLS_Negotiation_failed			{ buf=STRING_r_error_res_TLS_Negotiation_failed; }
-
-RESOURCE ARRAY r_error_res_email_imap_errors
-	{
-	items=
-		{
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_connect_fail;				// -200
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_server_fail;				// -201
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -202
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_server_busy;				// -203
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_server_version;			// -204
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_send_fail;				// -205
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_bad_logon;				// -206
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					// -207
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_wrong_folder;				// -208
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_no_security;				// -209
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					//-210				
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_TLS_failed;				// -211
-			},
-		SINGLE_ERROR
-			{
-			flags=EErrorResPanicErrorFlag;					//-212				
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_imap_Invalid_Server_Response;			// -213
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_pop3_Server_Already_Connected;			// -214
-			}
-		};
-	}
-
-RESOURCE TBUF r_error_res_imap_connect_fail			{ buf=STRING_r_error_res_imap_connect_fail		; }
-RESOURCE TBUF r_error_res_imap_server_fail			{ buf=STRING_r_error_res_imap_server_fail		; }
-RESOURCE TBUF r_error_res_imap_server_busy			{ buf=STRING_r_error_res_imap_server_busy		; }
-RESOURCE TBUF r_error_res_imap_server_version		{ buf=STRING_r_error_res_imap_server_version	; }
-RESOURCE TBUF r_error_res_imap_send_fail			{ buf=STRING_r_error_res_imap_send_fail		; }
-RESOURCE TBUF r_error_res_imap_bad_logon			{ buf=STRING_r_error_res_imap_bad_logon		; }
-RESOURCE TBUF r_error_res_imap_wrong_folder			{ buf=STRING_r_error_res_imap_wrong_folder		; }
-RESOURCE TBUF r_error_res_imap_no_security			{ buf=STRING_r_error_res_imap_no_security; }
-RESOURCE TBUF r_error_res_imap_TLS_failed			{ buf=STRING_r_error_res_imap_TLS_failed; }
-RESOURCE TBUF r_error_res_imap_Invalid_Server_Response		{ buf=STRING_r_error_res_imap_Invalid_Server_Response; }
-RESOURCE TBUF r_error_res_pop3_Server_Already_Connected		{ buf=STRING_r_error_res_pop3_Server_Already_Connected; }
-
-RESOURCE ARRAY r_error_res_email_smtp_errors
-	{
-	items=
-		{
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_no_mail_from;				// -240
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_unknown;		// -241
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_bad_from_address;			// -242
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_bad_to_address;			// -243
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_login_refusal;			// -244
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_wrong_account;			// -245
-			},
-		SINGLE_ERROR
-			{
-			text=r_error_res_smtp_no_TLS;					// -246
-			}
-		};
-	}
-
-RESOURCE TBUF r_error_res_smtp_no_mail_from			{ buf=STRING_r_error_res_smtp_no_mail_from		; }
-RESOURCE TBUF r_error_res_smtp_unknown				{ buf=STRING_r_error_res_smtp_unknown			; }
-RESOURCE TBUF r_error_res_smtp_bad_from_address		{ buf=STRING_r_error_res_smtp_bad_from_address	; }
-RESOURCE TBUF r_error_res_smtp_bad_to_address		{ buf=STRING_r_error_res_smtp_bad_to_address	; }
-RESOURCE TBUF r_error_res_smtp_login_refusal		{ buf=STRING_r_error_res_smtp_login_refusal	; }
-RESOURCE TBUF r_error_res_smtp_wrong_account		{ buf=STRING_r_error_res_smtp_wrong_account	; }
-RESOURCE TBUF r_error_res_smtp_no_TLS				{ buf=STRING_r_error_res_smtp_no_TLS; }
+// Copyright (c) 1999-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:
+//
+
+#include <errors/generic/emailerr.rls>
+
+RESOURCE ARRAY r_error_res_email_pop3_errors
+	{
+	items=
+		{
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_cannot_connect;			// -170
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_invalid_user;				// -171
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_invalid_login;			// -172
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_apop_login_string;		// -173
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_problem_remote;			// -174
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -175
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -176
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -177
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_top_unsupported;			// -178
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -179
+			}
+		};
+	}
+
+RESOURCE TBUF r_error_res_pop3_cannot_connect		{ buf=STRING_r_error_res_pop3_cannot_connect	; }
+RESOURCE TBUF r_error_res_pop3_invalid_user			{ buf=STRING_r_error_res_pop3_invalid_user		; }
+RESOURCE TBUF r_error_res_pop3_invalid_login		{ buf=STRING_r_error_res_pop3_invalid_login	; }
+RESOURCE TBUF r_error_res_pop3_apop_login_string	{ buf=STRING_r_error_res_pop3_apop_login_string; }
+RESOURCE TBUF r_error_res_pop3_problem_remote		{ buf=STRING_r_error_res_pop3_problem_remote	; }
+RESOURCE TBUF r_error_res_pop3_top_unsupported		{ buf=STRING_r_error_res_pop3_top_unsupported	; }
+
+RESOURCE ARRAY r_error_res_email_imsk_errors
+	{
+	items=
+		{
+		SINGLE_ERROR
+			{
+			text=r_error_res_imsk_dns_not_found;			// -180
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imsk_control_panel_locked;		// -181
+			},		
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -182
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imsk_wrong_active_settings;	// -183
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -184
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_TLS_Negotiation_failed;		// -185
+			}
+		};
+	}
+
+RESOURCE TBUF r_error_res_imsk_dns_not_found			{ buf=STRING_r_error_res_imsk_dns_not_found		; }
+RESOURCE TBUF r_error_res_imsk_control_panel_locked		{ buf=STRING_r_error_res_imsk_control_panel_locked	; }
+RESOURCE TBUF r_error_res_imsk_wrong_active_settings	{ buf=STRING_r_error_res_imsk_wrong_active_settings; }
+RESOURCE TBUF r_error_res_TLS_Negotiation_failed			{ buf=STRING_r_error_res_TLS_Negotiation_failed; }
+
+RESOURCE ARRAY r_error_res_email_imap_errors
+	{
+	items=
+		{
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_connect_fail;				// -200
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_server_fail;				// -201
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -202
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_server_busy;				// -203
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_server_version;			// -204
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_send_fail;				// -205
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_bad_logon;				// -206
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					// -207
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_wrong_folder;				// -208
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_no_security;				// -209
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					//-210				
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_TLS_failed;				// -211
+			},
+		SINGLE_ERROR
+			{
+			flags=EErrorResPanicErrorFlag;					//-212				
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_imap_Invalid_Server_Response;			// -213
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_pop3_Server_Already_Connected;			// -214
+			}
+		};
+	}
+
+RESOURCE TBUF r_error_res_imap_connect_fail			{ buf=STRING_r_error_res_imap_connect_fail		; }
+RESOURCE TBUF r_error_res_imap_server_fail			{ buf=STRING_r_error_res_imap_server_fail		; }
+RESOURCE TBUF r_error_res_imap_server_busy			{ buf=STRING_r_error_res_imap_server_busy		; }
+RESOURCE TBUF r_error_res_imap_server_version		{ buf=STRING_r_error_res_imap_server_version	; }
+RESOURCE TBUF r_error_res_imap_send_fail			{ buf=STRING_r_error_res_imap_send_fail		; }
+RESOURCE TBUF r_error_res_imap_bad_logon			{ buf=STRING_r_error_res_imap_bad_logon		; }
+RESOURCE TBUF r_error_res_imap_wrong_folder			{ buf=STRING_r_error_res_imap_wrong_folder		; }
+RESOURCE TBUF r_error_res_imap_no_security			{ buf=STRING_r_error_res_imap_no_security; }
+RESOURCE TBUF r_error_res_imap_TLS_failed			{ buf=STRING_r_error_res_imap_TLS_failed; }
+RESOURCE TBUF r_error_res_imap_Invalid_Server_Response		{ buf=STRING_r_error_res_imap_Invalid_Server_Response; }
+RESOURCE TBUF r_error_res_pop3_Server_Already_Connected		{ buf=STRING_r_error_res_pop3_Server_Already_Connected; }
+
+RESOURCE ARRAY r_error_res_email_smtp_errors
+	{
+	items=
+		{
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_no_mail_from;				// -240
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_unknown;		// -241
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_bad_from_address;			// -242
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_bad_to_address;			// -243
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_login_refusal;			// -244
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_wrong_account;			// -245
+			},
+		SINGLE_ERROR
+			{
+			text=r_error_res_smtp_no_TLS;					// -246
+			}
+		};
+	}
+
+RESOURCE TBUF r_error_res_smtp_no_mail_from			{ buf=STRING_r_error_res_smtp_no_mail_from		; }
+RESOURCE TBUF r_error_res_smtp_unknown				{ buf=STRING_r_error_res_smtp_unknown			; }
+RESOURCE TBUF r_error_res_smtp_bad_from_address		{ buf=STRING_r_error_res_smtp_bad_from_address	; }
+RESOURCE TBUF r_error_res_smtp_bad_to_address		{ buf=STRING_r_error_res_smtp_bad_to_address	; }
+RESOURCE TBUF r_error_res_smtp_login_refusal		{ buf=STRING_r_error_res_smtp_login_refusal	; }
+RESOURCE TBUF r_error_res_smtp_wrong_account		{ buf=STRING_r_error_res_smtp_wrong_account	; }
+RESOURCE TBUF r_error_res_smtp_no_TLS				{ buf=STRING_r_error_res_smtp_no_TLS; }
--- a/email/pop3andsmtpmtm/imapservermtm/test/data/rfc_0001.txt	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/imapservermtm/test/data/rfc_0001.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -1,8 +1,8 @@
 Subject: Test: MHTML 1 image
 Date: Wed, 26 Apr 2000 11:43:25 +0100
 Message-ID: <NDBBIFEJDMIMAHCMBDJPOEFECBAA.simon.middleton@ant.co.uk>
-MIME-Version: 1.0
-Content-Type: multipart/related;
+MIME-Version: 1.0
+Content-Type: multipart/related;
 	boundary="----=_NextPart_000_0051_01BFB923.AACFEB10"
 X-Priority: 3 (Normal)
 X-MSMail-Priority: Normal
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_02_18.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_02_18.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_04.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_04.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_05.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_05.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_06.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_06.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 6 1
-TOP 5 1
+STAT
+LIST
+UIDL
+CAPA
+TOP 6 1
+TOP 5 1
 QUIT
\ No newline at end of file
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_07.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_07.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_08.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_08.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-DELE 2
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+DELE 2
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_09.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_09.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_10.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_10.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-STAT
+STAT
 QUIT
\ No newline at end of file
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_11.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_11.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_12.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_12.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,8 +1,8 @@
-STAT
-LIST
-UIDL
-CAPA
-RETR 4
-RETR 2
-RETR 5
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+RETR 4
+RETR 2
+RETR 5
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_13.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_13.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
+STAT
+LIST
+UIDL
+CAPA
 QUIT
\ No newline at end of file
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_14.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_14.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-RETR 1
-RETR 2
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+RETR 1
+RETR 2
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_15.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_15.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_19.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_19.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_21.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_21.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_22.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_22.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 6 1
-TOP 5 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 6 1
+TOP 5 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_23.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_23.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_24.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_24.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,11 +1,11 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_25.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_25.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_27.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_27.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,15 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 5
-RETR 4
-RETR 3
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 5
+RETR 4
+RETR 3
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_28.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_28.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,11 +1,11 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_30.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_30.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,15 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_31.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_31.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_32.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_32.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_33.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_33.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,14 +1,14 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-RETR 12
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+RETR 12
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_34.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_34.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_35.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_35.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_36.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_36.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 20 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 20 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_37.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_37.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,20 +1,20 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_38.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_38.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,1 +1,1 @@
-QUIT
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_39.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_39.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_40.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_40.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-RETR 1
-QUIT
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_41.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_41.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,1 +1,1 @@
-QUIT
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_42.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_42.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-DELE 2
-QUIT
+DELE 2
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_45_61_62.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_45_61_62.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_47_48.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_47_48.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_49_50.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_49_50.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,11 +1,11 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
+STAT
+LIST
+UIDL
+CAPA
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
 QUIT
\ No newline at end of file
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_51.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_51.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,11 +1,11 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-DELE 2
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+DELE 2
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_52.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_52.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_54.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_54.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_55.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_55.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,13 +1,13 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 2
-RETR 3
-RETR 4
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 2
+RETR 3
+RETR 4
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_56.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_56.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_57.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_57.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,9 +1,9 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 2 1
-TOP 1 1
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 2 1
+TOP 1 1
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_58.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_58.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_64.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_64.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_65_66.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_65_66.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,11 +1,11 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_67_68.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_67_68.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,16 +1,16 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_70.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_70.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,15 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 5
-RETR 4
-RETR 3
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 5
+RETR 4
+RETR 3
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_71.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_71.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,16 +1,16 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 11 1 
-TOP 10 1
-TOP 9 1 
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 11 1 
+TOP 10 1
+TOP 9 1 
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_73to75.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_73to75.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,17 +1,17 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 12 1 
-TOP 11 1
-TOP 10 1 
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 12 1 
+TOP 11 1
+TOP 10 1 
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_76.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_76.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,26 +1,26 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1 
-TOP 11 1
-TOP 10 1 
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 12
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1 
+TOP 11 1
+TOP 10 1 
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 12
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_77.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_77.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,25 +1,25 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1 
-TOP 11 1
-TOP 10 1 
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1 
+TOP 11 1
+TOP 10 1 
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_78.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_78.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,24 +1,24 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1 
-TOP 11 1
-TOP 10 1 
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1 
+TOP 11 1
+TOP 10 1 
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_79_80.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_79_80.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,25 +1,25 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1 
-TOP 11 1
-TOP 10 1 
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1 
+TOP 11 1
+TOP 10 1 
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_empty.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_empty.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-STAT
+STAT
 QUIT
\ No newline at end of file
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_no_synch.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_no_synch.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,1 +1,1 @@
-QUIT
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_uid_refresh.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/Synchronise/t_pops_synchronise_uid_refresh.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/connect.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/connect.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,45 +1,45 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 40 1
-TOP 39 1
-TOP 38 1
-TOP 37 1
-TOP 36 1
-TOP 35 1
-TOP 34 1
-TOP 33 1
-TOP 32 1
-TOP 31 1
-TOP 30 1
-TOP 29 1
-TOP 28 1
-TOP 27 1
-TOP 26 1
-TOP 25 1
-TOP 24 1
-TOP 23 1
-TOP 22 1
-TOP 21 1
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 40 1
+TOP 39 1
+TOP 38 1
+TOP 37 1
+TOP 36 1
+TOP 35 1
+TOP 34 1
+TOP 33 1
+TOP 32 1
+TOP 31 1
+TOP 30 1
+TOP 29 1
+TOP 28 1
+TOP 27 1
+TOP 26 1
+TOP 25 1
+TOP 24 1
+TOP 23 1
+TOP 22 1
+TOP 21 1
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,43 +1,43 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-TOP 37 1
-TOP 36 1
-TOP 35 1
-TOP 34 1
-TOP 33 1
-TOP 32 1
-TOP 31 1
-TOP 30 1
-TOP 29 1
-TOP 28 1
-TOP 27 1
-TOP 26 1
-TOP 25 1
-TOP 24 1
-TOP 23 1
-TOP 22 1
-TOP 21 1
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+TOP 37 1
+TOP 36 1
+TOP 35 1
+TOP 34 1
+TOP 33 1
+TOP 32 1
+TOP 31 1
+TOP 30 1
+TOP 29 1
+TOP 28 1
+TOP 27 1
+TOP 26 1
+TOP 25 1
+TOP 24 1
+TOP 23 1
+TOP 22 1
+TOP 21 1
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit1.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/connect_and_quit1.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/delete_all.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/delete_all.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,43 +1,43 @@
-STAT
-LIST
-UIDL
-CAPA
-DELE 38
-DELE 37
-DELE 36
-DELE 35
-DELE 34
-DELE 33
-DELE 32
-DELE 31
-DELE 30
-DELE 29
-DELE 28
-DELE 27
-DELE 26
-DELE 25
-DELE 24
-DELE 23
-DELE 22
-DELE 21
-DELE 20
-DELE 19
-DELE 18
-DELE 17
-DELE 16
-DELE 15
-DELE 14
-DELE 13
-DELE 12
-DELE 11
-DELE 10
-DELE 9
-DELE 8
-DELE 7
-DELE 6
-DELE 5
-DELE 4
-DELE 3
-DELE 2
-DELE 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+DELE 38
+DELE 37
+DELE 36
+DELE 35
+DELE 34
+DELE 33
+DELE 32
+DELE 31
+DELE 30
+DELE 29
+DELE 28
+DELE 27
+DELE 26
+DELE 25
+DELE 24
+DELE 23
+DELE 22
+DELE 21
+DELE 20
+DELE 19
+DELE 18
+DELE 17
+DELE 16
+DELE 15
+DELE 14
+DELE 13
+DELE 12
+DELE 11
+DELE 10
+DELE 9
+DELE 8
+DELE 7
+DELE 6
+DELE 5
+DELE 4
+DELE 3
+DELE 2
+DELE 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all1.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all1.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,81 +1,81 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-TOP 37 1
-TOP 36 1
-TOP 35 1
-TOP 34 1
-TOP 33 1
-TOP 32 1
-TOP 31 1
-TOP 30 1
-TOP 29 1
-TOP 28 1
-TOP 27 1
-TOP 26 1
-TOP 25 1
-TOP 24 1
-TOP 23 1
-TOP 22 1
-TOP 21 1
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 38
-RETR 37
-RETR 36
-RETR 35
-RETR 34
-RETR 33
-RETR 32
-RETR 31
-RETR 30
-RETR 29
-RETR 28
-RETR 27
-RETR 26
-RETR 25
-RETR 24
-RETR 23
-RETR 22
-RETR 21
-RETR 20
-RETR 19
-RETR 18
-RETR 17
-RETR 16
-RETR 15
-RETR 14
-RETR 13
-RETR 12
-RETR 11
-RETR 10
-RETR 9
-RETR 8
-RETR 7
-RETR 6
-RETR 5
-RETR 4
-RETR 3
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+TOP 37 1
+TOP 36 1
+TOP 35 1
+TOP 34 1
+TOP 33 1
+TOP 32 1
+TOP 31 1
+TOP 30 1
+TOP 29 1
+TOP 28 1
+TOP 27 1
+TOP 26 1
+TOP 25 1
+TOP 24 1
+TOP 23 1
+TOP 22 1
+TOP 21 1
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 38
+RETR 37
+RETR 36
+RETR 35
+RETR 34
+RETR 33
+RETR 32
+RETR 31
+RETR 30
+RETR 29
+RETR 28
+RETR 27
+RETR 26
+RETR 25
+RETR 24
+RETR 23
+RETR 22
+RETR 21
+RETR 20
+RETR 19
+RETR 18
+RETR 17
+RETR 16
+RETR 15
+RETR 14
+RETR 13
+RETR 12
+RETR 11
+RETR 10
+RETR 9
+RETR 8
+RETR 7
+RETR 6
+RETR 5
+RETR 4
+RETR 3
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all10.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all10.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,45 +1,45 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-TOP 37 1
-TOP 36 1
-TOP 35 1
-TOP 34 1
-TOP 33 1
-TOP 32 1
-TOP 31 1
-TOP 30 1
-TOP 29 1
-TOP 28 1
-TOP 27 1
-TOP 26 1
-TOP 25 1
-TOP 24 1
-TOP 23 1
-TOP 22 1
-TOP 21 1
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 38
-RETR 37
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+TOP 37 1
+TOP 36 1
+TOP 35 1
+TOP 34 1
+TOP 33 1
+TOP 32 1
+TOP 31 1
+TOP 30 1
+TOP 29 1
+TOP 28 1
+TOP 27 1
+TOP 26 1
+TOP 25 1
+TOP 24 1
+TOP 23 1
+TOP 22 1
+TOP 21 1
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 38
+RETR 37
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all2.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all2.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,1 +1,1 @@
-USER Psion7
+USER Psion7
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all3.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all3.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,1 +1,1 @@
-QUIT
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all4.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all4.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-STAT
-QUIT
+STAT
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all5.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all5.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,3 +1,3 @@
-STAT
-LIST
-QUIT
+STAT
+LIST
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all6.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all6.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all7.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all7.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all8.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all8.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-TOP 37 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+TOP 37 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_all9.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_all9.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,44 +1,44 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 38 1
-TOP 37 1
-TOP 36 1
-TOP 35 1
-TOP 34 1
-TOP 33 1
-TOP 32 1
-TOP 31 1
-TOP 30 1
-TOP 29 1
-TOP 28 1
-TOP 27 1
-TOP 26 1
-TOP 25 1
-TOP 24 1
-TOP 23 1
-TOP 22 1
-TOP 21 1
-TOP 20 1
-TOP 19 1
-TOP 18 1
-TOP 17 1
-TOP 16 1
-TOP 15 1
-TOP 14 1
-TOP 13 1
-TOP 12 1
-TOP 11 1
-TOP 10 1
-TOP 9 1
-TOP 8 1
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 38
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 38 1
+TOP 37 1
+TOP 36 1
+TOP 35 1
+TOP 34 1
+TOP 33 1
+TOP 32 1
+TOP 31 1
+TOP 30 1
+TOP 29 1
+TOP 28 1
+TOP 27 1
+TOP 26 1
+TOP 25 1
+TOP 24 1
+TOP 23 1
+TOP 22 1
+TOP 21 1
+TOP 20 1
+TOP 19 1
+TOP 18 1
+TOP 17 1
+TOP 16 1
+TOP 15 1
+TOP 14 1
+TOP 13 1
+TOP 12 1
+TOP 11 1
+TOP 10 1
+TOP 9 1
+TOP 8 1
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 38
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_large_param.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_large_param.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,9 +1,9 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 2 1
-TOP 1 1
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 2 1
+TOP 1 1
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/download_two.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/download_two.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,9 +1,9 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 2 1
-TOP 1 1
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 2 1
+TOP 1 1
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/missing_fields_download.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/missing_fields_download.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-RETR 9
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+RETR 9
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_copy.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_copy.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,19 +1,19 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 7 1
-TOP 6 1
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-RETR 7
-RETR 6
-RETR 5
-RETR 4
-RETR 3
-RETR 2
-RETR 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 7 1
+TOP 6 1
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+RETR 7
+RETR 6
+RETR 5
+RETR 4
+RETR 3
+RETR 2
+RETR 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,12 +1,12 @@
-STAT
-LIST
-UIDL
-CAPA
-DELE 7
-DELE 6
-DELE 5
-DELE 4
-DELE 3
-DELE 2
-DELE 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+DELE 7
+DELE 6
+DELE 5
+DELE 4
+DELE 3
+DELE 2
+DELE 1
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit1.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_quit1.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,5 +1,5 @@
-STAT
-LIST
-UIDL
-CAPA
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_top.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_connect_top.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,15 @@
-STAT
-LIST
-UIDL
-CAPA
-TOP 5 1
-TOP 4 1
-TOP 3 1
-TOP 2 1
-TOP 1 1
-TOP 5 64
-TOP 4 64
-TOP 3 64
-TOP 2 64
-TOP 1 64
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+TOP 5 1
+TOP 4 1
+TOP 3 1
+TOP 2 1
+TOP 1 1
+TOP 5 64
+TOP 4 64
+TOP 3 64
+TOP 2 64
+TOP 1 64
+QUIT
--- a/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_second_delete.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/popservermtm/test/data/tpops5_second_delete.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,6 +1,6 @@
-STAT
-LIST
-UIDL
-CAPA
-DELE 1
-QUIT
+STAT
+LIST
+UIDL
+CAPA
+DELE 1
+QUIT
--- a/email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/src/IMCVCODC.CPP	Fri Jun 25 15:47:40 2010 +0530
@@ -1469,14 +1469,14 @@
 
 	// Intermediate buffer for decoding, prior to converting
 
-      HBufC8* decodeBuf8 = HBufC8::NewLC(aBufOut.MaxLength());
+    HBufC8* decodeBuf8 = HBufC8::NewLC(aBufOut.MaxLength());
 
 	decodeBuf8->Des().Copy( aBufIn.Mid(i+1, j -i-1));
 
    	// Depending on type of encoding Q or B, decode.
 
 	TPtr8 dataPtr8(dataBuf8->Des());
-
+	TPtr8 decodePtr8(decodeBuf8->Des());
 	switch (iEncodingInfo.EncodingType())
 		{
 		case TImHeaderEncodingInfo::EBase64 :
@@ -1484,14 +1484,13 @@
 			break;
 		case TImHeaderEncodingInfo::EQP :
 			// Replace all underscores in text with SPACE.
-			iQPCodec.Decode( *decodeBuf8, dataPtr8 );
-
-			i=dataPtr8.Length();
+			i=decodePtr8.Length();
 			while (i--)
 				{
-				if (dataPtr8[i] == KImcvUnderScore)
-					dataPtr8[i] = KImcvSpaceChar;	
+				if (decodePtr8[i] == KImcvUnderScore)
+				    decodePtr8[i] = KImcvSpaceChar;
 				}
+            iQPCodec.Decode( *decodeBuf8, dataPtr8 );
 			break;
 		default:
 			dataBuf8->Des().Copy(*decodeBuf8); 
--- a/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/ASCIIEntry_822Headers.txt	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/ASCIIEntry_822Headers.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -1,39 +1,39 @@
 *** 00100000 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100002 ************* Rfc822 Header ****************
 Size >>> 111
-Subject: simple simple
-From: "HEEMEE" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: simple simple
+From: "HEEMEE" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 00100004 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100009 ************* Rfc822 Header ****************
 Size >>> 130
-Subject: Fw: UTF7 message 
-From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: Fw: UTF7 message 
+From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 0010000b ************* Rfc822 Header ****************
 Size >>> 172
-Subject: 4 text parts. some default charset, some specified
-From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
-To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+Subject: 4 text parts. some default charset, some specified
+From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
 
 ******************** end of RFC822 header **************
--- a/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/NoneEntry_822Headers.txt	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/NoneEntry_822Headers.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -1,39 +1,39 @@
 *** 00100000 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100002 ************* Rfc822 Header ****************
 Size >>> 111
-Subject: simple simple
-From: "HEEMEE" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: simple simple
+From: "HEEMEE" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 00100004 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100009 ************* Rfc822 Header ****************
 Size >>> 130
-Subject: Fw: UTF7 message 
-From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: Fw: UTF7 message 
+From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 0010000b ************* Rfc822 Header ****************
 Size >>> 172
-Subject: 4 text parts. some default charset, some specified
-From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
-To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+Subject: 4 text parts. some default charset, some specified
+From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
 
 ******************** end of RFC822 header **************
--- a/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UTF7Entry_822Headers.txt	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UTF7Entry_822Headers.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -1,39 +1,39 @@
 *** 00100000 ************* Rfc822 Header ****************
 Size >>> 216
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100002 ************* Rfc822 Header ****************
 Size >>> 192
-Subject: simple simple
-From: "HEEMEE" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: simple simple
+From: "HEEMEE" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 00100004 ************* Rfc822 Header ****************
 Size >>> 216
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100009 ************* Rfc822 Header ****************
 Size >>> 249
-Subject: Fw: UTF7 message 
-From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: Fw: UTF7 message 
+From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 0010000b ************* Rfc822 Header ****************
 Size >>> 350
-Subject: 4 text parts. some default charset, some specified
-From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
-To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+Subject: 4 text parts. some default charset, some specified
+From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
 
 ******************** end of RFC822 header **************
--- a/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UnknownEntry_822Headers.txt	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Receive/UnknownEntry_822Headers.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -1,39 +1,39 @@
 *** 00100000 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100002 ************* Rfc822 Header ****************
 Size >>> 111
-Subject: simple simple
-From: "HEEMEE" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: simple simple
+From: "HEEMEE" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 00100004 ************* Rfc822 Header ****************
 Size >>> 123
-Subject: +ANwgIAGS-
-From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk> +ANwgIAGS-
+Subject: +ANwgIAGS-
+From: "+ANwgIAGS-" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk> +ANwgIAGS-
 
 ******************** end of RFC822 header **************
 *** 00100009 ************* Rfc822 Header ****************
 Size >>> 130
-Subject: Fw: UTF7 message 
-From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
-ID: 002401c026f6$7c055b30$330e970a@INTRA
-To:<test@psion7.demon.co.uk>
+Subject: Fw: UTF7 message 
+From: "psion7.demon.co.uk" <ibrahim.rahman@symbian.com>
+ID: 002401c026f6$7c055b30$330e970a@INTRA
+To:<test@psion7.demon.co.uk>
 
 ******************** end of RFC822 header **************
 *** 0010000b ************* Rfc822 Header ****************
 Size >>> 172
-Subject: 4 text parts. some default charset, some specified
-From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
-To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+Subject: 4 text parts. some default charset, some specified
+From: "Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
+To:"Keval Pindoria" <keval.pindoria@internet-test.plc.psion.com>
 
 ******************** end of RFC822 header **************
Binary file email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/Charset_UTF7_Info_ImcvSendOutputText.txt has changed
Binary file email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/None_Info_ImcvSendOutputText.txt has changed
Binary file email/pop3andsmtpmtm/servermtmutils/test/data/imcv/Transform_Send/Service_UTF7_Info_ImcvSendOutputText.txt has changed
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,4966 +1,4966 @@
-EHLO []
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
-Subject: Test message No.9 
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This msg should be sent 4 times=20
-  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
-
-  should not appear in the msg header.
-
- -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
-the 'To' & 'Cc'
-  recipients.  All 'Bcc' recipients should not appear in the header except =
-the one to=20
-  whom the mail is addressed to.
-
-
-End of message.
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
-Bcc: recyclebin@lon-msgtest06.intra
-Subject: Test message No.9 
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-2>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This msg should be sent 4 times=20
-  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
-
-  should not appear in the msg header.
-
- -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
-the 'To' & 'Cc'
-  recipients.  All 'Bcc' recipients should not appear in the header except =
-the one to=20
-  whom the mail is addressed to.
-
-
-End of message.
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
-Bcc: recyclebin@lon-msgtest06.intra
-Subject: Test message No.9 
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-3>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This msg should be sent 4 times=20
-  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
-
-  should not appear in the msg header.
-
- -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
-the 'To' & 'Cc'
-  recipients.  All 'Bcc' recipients should not appear in the header except =
-the one to=20
-  whom the mail is addressed to.
-
-
-End of message.
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
-Bcc: recyclebin@lon-msgtest06.intra
-Subject: Test message No.9 
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-4>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This msg should be sent 4 times=20
-  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
-
-  should not appear in the msg header.
-
- -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
-the 'To' & 'Cc'
-  recipients.  All 'Bcc' recipients should not appear in the header except =
-the one to=20
-  whom the mail is addressed to.
-
-
-End of message.
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: <recyclebin@lon-msgtest06.intra>
-Subject: Test message No.8 - Long message (206KB)
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-5>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-INTRODUCTION
-
-1. The Industrial Revolution and its consequences have been a disaster for =
-the human race. They have=20
-greatly increased the life-expectancy of those of us who live in "advanced" =
-countries, but they have=20
-destabilized society, have made life unfulfilling, have subjected human =
-beings to indignities, have led to=20
-widespread psychological suffering (in the Third World to physical =
-suffering as well) and have inflicted=20
-severe damage on the natural world. The continued development of technology =
-will worsen the situation. It=20
-will certainly subject human beings to greater indignities and inflict =
-greater damage on the natural world, it=20
-will probably lead to greater social disruption and psychological =
-suffering, and it may lead to increased=20
-physical suffering even in "advanced" countries.=20
-
-2. The industrial-technological system may survive or it may break down. If =
-it survives, it MAY eventually=20
-achieve a low level of physical and psychological suffering, but only after =
-passing through a long and very=20
-painful period of adjustment and only at the cost of permanently reducing =
-human beings and many other=20
-living organisms to engineered products and mere cogs in the social =
-machine. Furthermore, if the system=20
-survives, the consequences will be inevitable: There is no way of reforming =
-or modifying the system so as=20
-to prevent it from depriving people of dignity and autonomy.=20
-
-3. If the system breaks down the consequences will still be very painful. =
-But the bigger the system grows=20
-the more disastrous the results of its breakdown will be, so if it is to =
-break down it had best break down=20
-sooner rather than later.=20
-
-4. We therefore advocate a revolution against the industrial system. This =
-revolution may or may not make=20
-use of violence: it may be sudden or it may be a relatively gradual process =
-spanning a few decades. We=20
-can't predict any of that. But we do outline in a very general way the =
-measures that those who hate the=20
-industrial system should take in order to prepare the way for a revolution =
-against that form of society. This=20
-is not to be a POLITICAL revolution. Its object will be to overthrow not =
-governments but the economic=20
-and technological basis of the present society.=20
-
-5. In this article we give attention to only some of the negative =
-developments that have grown out of the=20
-industrial-technological system. Other such developments we mention only =
-briefly or ignore altogether.=20
-This does not mean that we regard these other developments as unimportant. =
-For practical reasons we have=20
-to confine our discussion to areas that have received insufficient public =
-attention or in which we have=20
-something new to say. For example, since there are well-developed =
-environmental and wilderness=20
-movements, we have written very little about environmental degradation or =
-the destruction of wild nature,=20
-even though we consider these to be highly important.=20
-
-THE PSYCHOLOGY OF MODERN LEFTISM
-
-6. Almost everyone will agree that we live in a deeply troubled society. =
-One of the most widespread=20
-manifestations of the craziness of our world is leftism, so a discussion of =
-the psychology of leftism can=20
-serve as an introduction to the discussion of the problems of modern =
-society in general.=20
-
-7. But what is leftism? During the first half of the 20th century leftism =
-could have been practically=20
-identified with socialism. Today the movement is fragmented and it is not =
-clear who can properly be called=20
-a leftist. When we speak of leftists in this article we have in mind mainly =
-socialists, collectivists,=20
-"politically correct" types, feminists, gay and disability activists, =
-animal rights activists and the like. But=20
-not everyone who is associated with one of these movements is a leftist. =
-What we are trying to get at in=20
-discussing leftism is not so much a movement or an ideology as a =
-psychological type, or rather a collection=20
-of related types. Thus, what we mean by "leftism" will emerge more clearly =
-in the course of our discussion=20
-of leftist psychology (Also, see paragraphs 227-230.)=20
-
-8. Even so, our conception of leftism will remain a good deal less clear =
-than we would wish, but there=20
-doesn't seem to be any remedy for this. All we are trying to do is indicate =
-in a rough and approximate way=20
-the two psychological tendencies that we believe are the main driving force =
-of modern leftism. We by no=20
-means claim to be telling the WHOLE truth about leftist psychology. Also, =
-our discussion is meant to=20
-apply to modern leftism only. We leave open the question of the extent to =
-which our discussion could be=20
-applied to the leftists of the 19th and early 20th century.=20
-
-9. The two psychological tendencies that underlie modern leftism we call =
-"feelings of inferiority" and=20
-"oversocialization." Feelings of inferiority are characteristic of modern =
-leftism as a whole, while=20
-oversocialization is characteristic only of a certain segment of modern =
-leftism; but this segment is highly=20
-influential.=20
-
-FEELINGS OF INFERIORITY
-
-10. By "feelings of inferiority" we mean not only inferiority feelings in =
-the strictest sense but a whole=20
-spectrum of related traits: low self-esteem, feelings of powerlessness, =
-depressive tendencies, defeatism,=20
-guilt, self-hatred, etc. We argue that modern leftists tend to have such =
-feelings (possibly more or less=20
-repressed) and that these feelings are decisive in determining the =
-direction of modern leftism.=20
-
-11. When someone interprets as derogatory almost anything that is said =
-about him (or about groups with=20
-whom he identifies) we conclude that he has inferiority feelings or low =
-self-esteem. This tendency is=20
-pronounced among minority rights advocates, whether or not they belong to =
-the minority groups whose=20
-rights they defend. They are hypersensitive about the words used to =
-designate minorities. The terms=20
-"negro," "oriental," "handicapped" or "chick" for an African, an Asian, a =
-disabled person or a woman=20
-originally had no derogatory connotation. "Broad" and "chick" were merely =
-the feminine equivalents of=20
-"guy," "dude" or "fellow." The negative connotations have been attached to =
-these terms by the activists=20
-themselves. Some animal rights advocates have gone so far as to reject the =
-word "pet" and=20
-insist on its replacement by "animal companion." Leftist anthropologists go =
-to great lengths to avoid saying=20
-anything about primitive peoples that could conceivably be interpreted as =
-negative. They want to replace=20
-the word "primitive" by "nonliterate." They seem almost paranoid about =
-anything that might suggest that=20
-any primitive culture is inferior to our own. (We do not mean to imply that =
-primitive cultures ARE inferior=20
-to ours. We merely point out the hypersensitivity of leftish =
-anthropologists.)=20
-
-12. Those who are most sensitive about "politically incorrect" terminology =
-are not the average black=20
-ghetto-dweller, Asian immigrant, abused woman or disabled person, but a =
-minority of activists, many of=20
-whom do not even belong to any "oppressed" group but come from privileged =
-strata of society. Political=20
-correctness has its stronghold among university professors, who have secure =
-employment with comfortable=20
-salaries, and the majority of whom are heterosexual, white males from =
-middle-class families.=20
-
-13. Many leftists have an intense identification with the problems of =
-groups that have an image of being=20
-weak (women), defeated (American Indians), repellent (homosexuals), or =
-otherwise inferior. The leftists=20
-themselves feel that these groups are inferior. They would never admit it =
-to themselves that they have such=20
-feelings, but it is precisely because they do see these groups as inferior =
-that they identify with their=20
-problems. (We do not suggest that women, Indians, etc., ARE inferior; we =
-are only making a point about=20
-leftist psychology).=20
-
-14. Feminists are desperately anxious to prove that women are as strong as =
-capable as men. Clearly they=20
-are nagged by a fear that women may NOT be as strong and as capable as men. =
-
-
-15. Leftists tend to hate anything that has an image of being strong, good =
-and successful. They hate=20
-America, they hate Western civilization, they hate white males, they hate =
-rationality. The reasons that=20
-leftists give for hating the West, etc. clearly do not correspond with =
-their real motives. They SAY they hate=20
-the West because it is warlike, imperialistic, sexist, ethnocentric and so =
-forth, but where these same faults=20
-appear in socialist countries or in primitive cultures, the leftist finds =
-excuses for them, or at best he=20
-GRUDGINGLY admits that they exist; whereas he ENTHUSIASTICALLY points out =
-(and often greatly=20
-exaggerates) these faults where they appear in Western civilization. Thus =
-it is clear that these faults are not=20
-the leftist's real motive for hating America and the West.
- He hates America and the West because they are strong and successful. =
-
-
-16. Words like "self-confidence," "self-reliance," "initiative", =
-"enterprise," "optimism," etc. play little role=20
-in the liberal and leftist vocabulary. The leftist is anti-individualistic, =
-pro-collectivist. He wants society to=20
-solve everyone's needs for them, take care of them. He is not the sort of =
-person who has an inner sense of=20
-confidence in his own ability to solve his own problems and satisfy his own =
-needs. The leftist is=20
-antagonistic to the concept of competition because, deep inside, he feels =
-like a loser.=20
-
-17. Art forms that appeal to modern leftist intellectuals tend to focus on =
-sordidness, defeat and despair, or=20
-else they take an orgiastic tone, throwing off rational control as if there =
-were no hope of accomplishing=20
-anything through rational calculation and all that was left was to immerse =
-oneself in the sensations of the=20
-moment.=20
-
-18. Modern leftist philosophers tend to dismiss reason, science, objective =
-reality and to insist that=20
-everything is culturally relative. It is true that one can ask serious =
-questions about the foundations of=20
-scientific knowledge and about how, if at all, the concept of objective =
-reality can be defined. But it is=20
-obvious that modern leftist philosophers are not simply cool-headed =
-logicians systematically analyzing the=20
-foundations of knowledge. They are deeply involved emotionally in their =
-attack on truth and reality. They=20
-attack these concepts because of their own psychological needs. For one =
-thing, their attack is an outlet for=20
-hostility, and, to the extent that it is successful, it satisfies the drive =
-for power. More importantly, the leftist=20
-hates science and rationality because=20
-they classify certain beliefs as true (i.e., successful, superior) and =
-other beliefs as false (i.e. failed, inferior).=20
-The leftist's feelings of inferiority run so deep that he cannot tolerate =
-any classification of some things as=20
-successful or superior and other things as failed or inferior. This also =
-underlies the rejection by many=20
-leftists of the concept of mental illness and of the utility of IQ tests. =
-Leftists are antagonistic to genetic=20
-explanations of human abilities or behavior because such explanations tend =
-to make some persons appear=20
-superior or inferior to others. Leftists prefer to give society the credit =
-or blame for an individual's ability or=20
-lack of it. Thus if a person is "inferior" it is not his fault, but =
-society's, because he has not been brought up=20
-properly.=20
-
-19. The leftist is not typically the kind of person whose feelings of =
-inferiority make him a braggart, an=20
-egotist, a bully, a self-promoter, a ruthless competitor. This kind of =
-person has not wholly lost faith in=20
-himself. He has a deficit in his sense of power and self-worth, but he can =
-still conceive of himself as having=20
-the capacity to be strong, and his efforts to make himself strong produce =
-his unpleasant behavior. [1] But=20
-the leftist is too far gone for that. His feelings of inferiority are so =
-ingrained that he cannot conceive of=20
-himself as individually strong and valuable. Hence the collectivism of the =
-leftist. He can feel strong only as=20
-a member of a large organization or a mass movement with which he =
-identifies himself.=20
-
-20. Notice the masochistic tendency of leftist tactics. Leftists protest by =
-lying down in front of vehicles,=20
-they intentionally provoke police or racists to abuse them, etc. These =
-tactics may often be effective, but=20
-many leftists use them not as a means to an end but because they PREFER =
-masochistic tactics. Self-hatred=20
-is a leftist trait.=20
-
-21. Leftists may claim that their activism is motivated by compassion or by =
-moral principle, and moral=20
-principle does play a role for the leftist of the oversocialized type. But =
-compassion and moral principle=20
-cannot be the main motives for leftist activism. Hostility is too prominent =
-a component of leftist behavior;=20
-so is the drive for power. Moreover, much leftist behavior is not =
-rationally calculated to be of benefit to the=20
-people whom the leftists claim to be trying to help. For example, if one =
-believes that affirmative action is=20
-good for black people, does it make sense to demand affirmative action in =
-hostile or dogmatic terms?=20
-Obviously it would be more productive to take a diplomatic and conciliatory =
-approach that would make at=20
-least verbal and symbolic concessions to white people who think that =
-
-affirmative action discriminates against them. But leftist activists do not =
-take such an approach because it=20
-would not satisfy their emotional needs. Helping black people is not their =
-real goal. Instead, race problems=20
-serve as an excuse for them to express their own hostility and frustrated =
-need for power. In doing so they=20
-actually harm black people, because the activists' hostile attitude toward =
-the white majority tends to=20
-intensify race hatred.=20
-
-22. If our society had no social problems at all, the leftists would have =
-to INVENT problems in order to=20
-provide themselves with an excuse for making a fuss.=20
-
-23. We emphasize that the foregoing does not pretend to be an accurate =
-description of everyone who might=20
-be considered a leftist. It is only a rough indication of a general =
-tendency of leftism.=20
-
-OVERSOCIALIZATION
-
-24. Psychologists use the term "socialization" to designate the process by =
-which children are trained to=20
-think and act as society demands. A person is said to be well socialized if =
-he believes in and obeys the=20
-moral code of his society and fits in well as a functioning part of that =
-society. It may seem senseless to say=20
-that many leftists are over-socialized, since the leftist is perceived as a =
-rebel. Nevertheless, the position can=20
-be defended. Many leftists are not such rebels as they seem.=20
-
-25. The moral code of our society is so demanding that no one can think, =
-feel and act in a completely moral=20
-way. For example, we are not supposed to hate anyone, yet almost everyone =
-hates somebody at some time=20
-or other, whether he admits it to himself or not. Some people are so highly =
-socialized that the attempt to=20
-think, feel and act morally imposes a severe burden on them. In order to =
-avoid feelings of guilt, they=20
-continually have to deceive themselves about their own motives and find =
-moral explanations for feelings=20
-and actions that in reality have a non-moral origin. We use the term =
-"oversocialized" to describe such=20
-people. [2]=20
-
-26. Oversocialization can lead to low self-esteem, a sense of =
-powerlessness, defeatism, guilt, etc. One of=20
-the most important means by which our society socializes children is by =
-making them feel ashamed of=20
-behavior or speech that is contrary to society's expectations. If this is =
-overdone, or if a particular child is=20
-especially susceptible to such feelings, he ends by feeling ashamed of =
-HIMSELF. Moreover the thought=20
-and the behavior of the oversocialized person are more restricted by =
-society's expectations than are those of=20
-the lightly socialized person. The majority of people engage in a =
-significant amount of naughty behavior.=20
-They lie, they commit petty thefts, they break traffic laws, they goof off =
-at work, they hate someone, they=20
-say spiteful things or they use some underhanded trick to get ahead of the =
-
-other guy. The oversocialized person cannot do these things, or if he does =
-do them he generates in himself=20
-a sense of shame and self-hatred. The oversocialized person cannot even =
-experience, without guilt,=20
-thoughts or feelings that are contrary to the accepted morality; he cannot =
-think "unclean" thoughts. And=20
-socialization is not just a matter of morality; we are socialized to =
-confirm to many norms of behavior that=20
-do not fall under the heading of morality. Thus the oversocialized person =
-is kept on a psychological leash=20
-and spends his life running on rails that society has laid down for him. In =
-many oversocialized people this=20
-results in a sense of constraint and powerlessness that can be a severe =
-hardship. We suggest that=20
-oversocialization is among the more serious cruelties that human beings =
-inflict on one another.=20
-
-27. We argue that a very important and influential segment of the modern =
-left is oversocialized and that=20
-their oversocialization is of great importance in determining the direction =
-of modern leftism. Leftists of the=20
-oversocialized type tend to be intellectuals or members of the upper-middle =
-class. Notice that university=20
-intellectuals (3) constitute the most highly socialized segment of our =
-society and also the most left-wing=20
-segment.=20
-
-28. The leftist of the oversocialized type tries to get off his =
-psychological leash and assert his autonomy by=20
-rebelling. But usually he is not strong enough to rebel against the most =
-basic values of society. Generally=20
-speaking, the goals of today's leftists are NOT in conflict with the =
-accepted morality. On the contrary, the=20
-left takes an accepted moral principle, adopts it as its own, and then =
-accuses mainstream society of=20
-violating that principle. Examples: racial equality, equality of the sexes, =
-helping poor people, peace as=20
-opposed to war, nonviolence generally, freedom of expression, kindness to =
-animals. More fundamentally,=20
-the duty of the individual to serve society and the duty of society to take =
-care of the individual. All these=20
-have been deeply rooted values of our society (or at least of its middle =
-and=20
-upper classes (4) for a long time. These values are explicitly or =
-implicitly expressed or presupposed in most=20
-of the material presented to us by the mainstream communications media and =
-the educational system.=20
-Leftists, especially those of the oversocialized type, usually do not rebel =
-against these principles but justify=20
-their hostility to society by claiming (with some degree of truth) that =
-society is not living up to these=20
-principles.=20
-
-29. Here is an illustration of the way in which the oversocialized leftist =
-shows his real attachment to the=20
-conventional attitudes of our society while pretending to be in rebellion =
-against it. Many leftists push for=20
-affirmative action, for moving black people into high-prestige jobs, for =
-improved education in black=20
-schools and more money for such schools; the way of life of the black =
-"underclass" they regard as a social=20
-disgrace. They want to integrate the black man into the system, make him a =
-business executive, a lawyer, a=20
-scientist just like upper-middle-class white people. The leftists will =
-reply that the last thing they want is to=20
-make the black man into a copy of the white man; instead, they want to =
-preserve African American culture.=20
-But in what does this preservation of African American culture consist? =
-
-It can hardly consist in anything more than eating black-style food, =
-listening to black-style music, wearing=20
-black-style clothing and going to a black-style church or mosque. In other =
-words, it can express itself only=20
-in superficial matters. In all ESSENTIAL respects more leftists of the =
-oversocialized type want to make the=20
-black man conform to white, middle-class ideals. They want to make him =
-study technical subjects, become=20
-an executive or a scientist, spend his life climbing the status ladder to =
-prove that black people are as good=20
-as white. They want to make black fathers "responsible." they want black =
-gangs to become nonviolent, etc.=20
-But these are exactly the values of the industrial-technological system. =
-The system couldn't care less what=20
-kind of music a man listens to, what kind of clothes he wears or what =
-
-religion he believes in as long as he studies in school, holds a =
-respectable job, climbs the status ladder, is a=20
-"responsible" parent, is nonviolent and so forth. In effect, however much =
-he may deny it, the oversocialized=20
-leftist wants to integrate the black man into the system and make him adopt =
-its values.=20
-
-30. We certainly do not claim that leftists, even of the oversocialized =
-type, NEVER rebel against the=20
-fundamental values of our society. Clearly they sometimes do. Some =
-oversocialized leftists have gone so=20
-far as to rebel against one of modern society's most important principles =
-by engaging in physical violence.=20
-By their own account, violence is for them a form of "liberation." In other =
-words, by committing violence=20
-they break through the psychological restraints that have been trained into =
-them. Because they are=20
-oversocialized these restraints have been more confining for them than for =
-others; hence their need to break=20
-free of them. But they usually justify their rebellion in terms of =
-mainstream values. If they engage in=20
-violence they claim to be fighting against racism or the like.=20
-
-31. We realize that many objections could be raised to the foregoing =
-thumb-nail sketch of leftist=20
-psychology. The real situation is complex, and anything like a complete =
-description of it would take=20
-several volumes even if the necessary data were available. We claim only to =
-have indicated very roughly=20
-the two most important tendencies in the psychology of modern leftism. =
-
-
-32. The problems of the leftist are indicative of the problems of our =
-society as a whole. Low self-esteem,=20
-depressive tendencies and defeatism are not restricted to the left. Though =
-they are especially noticeable in=20
-the left, they are widespread in our society. And today's society tries to =
-socialize us to a greater extent than=20
-any previous society. We are even told by experts how to eat, how to =
-exercise, how to make love, how to=20
-raise our kids and so forth.=20
-
-THE POWER PROCESS
-
-33. Human beings have a need (probably based in biology) for something that =
-we will call the "power=20
-process." This is closely related to the need for power (which is widely =
-recognized) but is not quite the=20
-same thing. The power process has four elem ents. The three most clear-cut =
-of these we call goal, effort=20
-and attainment of goal. (Everyone needs to have goals whose attainment =
-requires effort, and needs to=20
-succeed in attaining at least some of his goals.) The fourth element is =
-more difficult to define and may not=20
-be necessary for everyone . We call it autonomy and will discuss it l ater =
-(paragraphs 42-44).=20
-
-34. Consider the hypothetical case of a man who can have anything he wants =
-just by wishing for it. Such a=20
-man has power, but he will develop serious psychological problems. At first =
-he will have a lot of fun, but=20
-by and by he will become acutely bor ed and demoralized. Eventually he may =
-becom e clinically=20
-depressed. History shows that leisured aristocracies tend to become =
-decadent. This is not true of fighting=20
-aristocracies that have to struggle to maintain their power. But leisured, =
-secure aristocracies that have no=20
-need to exert themselve s usually become bored, hedonistic and demor =
-alized, even though they have=20
-power. This shows that power is not enough. One must have goals toward =
-which to exercise one's power.=20
-
-35. Everyone has goals; if nothing else, to obtain the physical necessities =
-of life: food, water and whatever=20
-clothing and shelter are made necessary by the climate. But the leisured =
-aristocrat obtains these things=20
-without effort. Hence his boredom and demoralization.=20
-
-36. Nonattainment of important goals results in death if the goals are =
-physical necessities, and in frustration=20
-if nonattainment of the goals is compatible with survival. Consistent =
-failure to attain goals throughout life=20
-results in defeatism, low se lf-esteem or depression.=20
-
-37. Thus, in order to avoid serious psychological problems, a human being =
-needs goals whose attainment=20
-requires effort, and he must have a reasonable rate of success in attaining =
-his goals.=20
-
-SURROGATE ACTIVITIES
-
-38. But not every leisured aristocrat becomes bored and demoralized. For =
-example, the emperor Hirohito,=20
-instead of sinking into decadent hedonism, devoted himself to marine =
-biology, a field in which he became=20
-distinguished. When people do not have t o exert themselves to satisfy =
-their physical needs they often set=20
-up artificial goals for themselves. In many cases they then pursue these =
-goals with the same energy and=20
-emotional involvement that they otherwise would have put into the search =
-for physical necessities. Thus the=20
-aristocrats of the Roman Empire had their literary pretentions; many =
-European aristocrats a few centuries=20
-ago invested tremendous time and energy in hunting, though they certainly =
-didn't need the meat; other=20
-aristocracies have competed for status through elaborate displays of =
-wealth;=20
-and a few aristocrats, like Hiroh ito, have turned to science.=20
-
-39. We use the term "surrogate activity" to designate an activity that is =
-directed toward an artificial goal=20
-that people set up for themselves merely in order to have some goal to work =
-toward, or let us say, merely=20
-for the sake of the "fulfillment" th at they get from pursuing the goal. =
-Here is a rule of thumb for the=20
-identification of surrogate activities. Given a person who devotes much =
-time and energy to the pursuit of=20
-goal X, ask yourself this: If he had to devote most of his time and energy =
-to satisfying his biological needs,=20
-and if that effort required him to use his physical and mental facilities =
-in a varied and interesting way,=20
-would he feel seriously deprived because he did not attain goal X? If the =
-answer is no, then the person's=20
-pursuit of a goal X is a surrogate activity. Hirohito's studies=20
-in marine biology clearly constituted a surrogate activity, since it is =
-pretty certain that if Hirohito had had=20
-to spend his time working at interesting non-scientific tasks in order to =
-obtain the necessities of life, he=20
-would not have felt deprived because he didn't know all about the anatomy =
-and life-cycles of marine=20
-animals. On the other hand the pursuit of sex and love (for example) is not =
-a surrogate activity, because=20
-most people, even if their existence were otherwise satisfactory, would =
-feel deprived if they passed their=20
-lives without ever having a relationship with a member of the opposite sex. =
-(But pursuit of an excessive=20
-amount of sex, more than one really needs, can be a surrogate activity.) =
-
-
-40. In modern industrial society only minimal effort is necessary to =
-satisfy one's physical needs. It is=20
-enough to go through a training program to acquire some petty technical =
-skill, then come to work on time=20
-and exert very modest effort needed to hold a job. The only requirements =
-are a moderate amount of=20
-intelligence, and most of all, simple OBEDIENCE. If one has those, society =
-takes care of one from cradle=20
-to grave. (Yes, there is an underclass that cannot take physical =
-necessities for granted, but we are speaking=20
-here of mainstream society.) Thus it is not surprising that modern society =
-is full of surrogate activities.=20
-These include scientific work, athletic achievement, humanitarian work, =
-artistic and literary creation,=20
-climbing the corporate ladder, acquisition of money and material goods far =
-
-beyond the point at which they cease to give any additional physical =
-satisfaction, and social activism when=20
-it addresses issues that are not important for the activist personally, as =
-in the case of white activists who=20
-work for the rights of nonwhite minorities. These are not always pure =
-surrogate activities, since for many=20
-people they may be motivated in part by needs other than the need to have =
-some goal to pursue. Scientific=20
-work may be motivated in part by a drive for prestige, artistic creation by =
-a need to express feelings,=20
-militant social activism by hostility. But for most people who pursue them, =
-these activities are in large part=20
-surrogate activities. For example, the majority of scientists will probably =
-agree that the "fulfillment" they=20
-get from their work is more important than the money and prestige they =
-earn.=20
-
-41. For many if not most people, surrogate activities are less satisfying =
-than the pursuit of real goals ( that=20
-is, goals that people would want to attain even if their need for the power =
-process were already fulfilled).=20
-One indication of this is the fact that, in many or most cases, people who =
-are deeply involved in surrogate=20
-activities are never satisfied, never at rest. Thus the money-maker =
-constantly strives for more and more=20
-wealth. The scientist no sooner solves one problem than he moves on to the =
-next. The long-distance runner=20
-drives himself to run always farther and faster. Many people who pursue =
-surrogate activities will say that=20
-they get far more fulfillment from these activities than they do from the =
-"mundane" business of satisfying=20
-their biological needs, but that it is because in our society the effort =
-
-needed to satisfy the biological needs has been reduced to triviality. More =
-importantly, in our society=20
-people do not satisfy their biological needs AUTONOMOUSLY but by =
-functioning as parts of an immense=20
-social machine. In contrast, people generally have a great deal of autonomy =
-in pursuing their surrogate=20
-activities. have a great deal of autonomy in pursuing their surrogate =
-activities.=20
-
-AUTONOMY
-
-42. Autonomy as a part of the power process may not be necessary for every =
-individual. But most people=20
-need a greater or lesser degree of autonomy in working toward their goals. =
-Their efforts must be=20
-undertaken on their own initiative and must be under their own direction =
-and control. Yet most people do=20
-not have to exert this initiative, direction and control as single =
-individuals. It is usually enough to act as a=20
-member of a SMALL group. Thus if half a dozen people discuss a goal among =
-themselves and make a=20
-successful joint effort to attain that goal, their need for the power =
-process will be served. But if they work=20
-under rigid orders handed down from above that leave them no room for =
-autonomous decision and=20
-initiative, then their need for the power process will not be served. =
-
-The same is true when decisions are made on a collective bases if the group =
-making the collective decision=20
-is so large that the role of each individual is insignificant [5]=20
-
-43. It is true that some individuals seem to have little need for autonomy. =
-Either their drive for power is=20
-weak or they satisfy it by identifying themselves with some powerful =
-organization to which they belong.=20
-And then there are unthinking, animal types who seem to be satisfied with a =
-purely physical sense of=20
-power(the good combat soldier, who gets his sense of power by developing =
-fighting skills that he is quite=20
-content to use in blind obedience to his superiors).=20
-
-44. But for most people it is through the power process-having a goal, =
-making an AUTONOMOUS effort=20
-and attaining t the goal-that self-esteem, self-confidence and a sense of =
-power are acquired. When one does=20
-not have adequate opportunity to go throughout the power process the =
-consequences are (depending on the=20
-individual and on the way the power process is disrupted) boredom, =
-demoralization, low self-esteem,=20
-inferiority feelings, defeatism, depression, anxiety, guilt, frustration, =
-hostility, spouse or child abuse,=20
-insatiable hedonism, abnormal sexual behavior, sleep disorders, eating =
-disorders, etc. [6]=20
-
-SOURCES OF SOCIAL PROBLEMS
-
-45. Any of the foregoing symptoms can occur in any society, but in modern =
-industrial society they are=20
-present on a massive scale. We aren't the first to mention that the world =
-today seems to be going crazy.=20
-This sort of thing is not normal for human societies. There is good reason =
-to believe that primitive man=20
-suffered from less stress and frustration and was better satisfied with his =
-way of life than modern man is. It=20
-is true that not all was sweetness and light in primitive societies. Abuse =
-of women and common among the=20
-Australian aborigines, transexuality was fairly common among some of the =
-American Indian tribes. But is=20
-does appear that GENERALLY SPEAKING the kinds of problems that we have =
-listed in the preceding=20
-paragraph were far less common among primitive peoples than they are in =
-modern society.=20
-
-46. We attribute the social and psychological problems of modern society to =
-the fact that that society=20
-requires people to live under conditions radically different from those =
-under which the human race evolved=20
-and to behave in ways that conflict with the patterns of behavior that the =
-human race developed while=20
-living under the earlier conditions. It is clear from what we have already =
-written that we consider lack of=20
-opportunity to properly experience the power process as the most important =
-of the abnormal conditions to=20
-which modern society subjects people. But it is not the only one. Before =
-dealing with disruption of the=20
-power process as a source of social problems we will discuss some of the =
-other sources.=20
-
-47. Among the abnormal conditions present in modern industrial society are =
-excessive density of=20
-population, isolation of man from nature, excessive rapidity of social =
-change and the break-down of natural=20
-small-scale communities such as the extended family, the village or the =
-tribe.=20
-
-48. It is well known that crowding increases stress and aggression. The =
-degree of crowding that exists=20
-today and the isolation of man from nature are consequences of =
-technological progress. All pre-industrial=20
-societies were predominantly rural. The industrial Revolution vastly =
-increased the size of cities and the=20
-proportion of the population that lives in them, and modern agricultural =
-technology has made it possible for=20
-the Earth to support a far denser population than it ever did before. =
-(Also, technology exacerbates the=20
-effects of crowding because it puts increased disruptive powers in people's =
-hands. For example, a variety of=20
-noise-making devices: power mowers, radios, motorcycles, etc. If the use of =
-these devices is unrestricted,=20
-people who want peace and quiet are frustrated by the noise.=20
-If their use is restricted, people who use the devices are frustrated by =
-the regulations... But if these=20
-machines had never been invented there would have been no conflict and no =
-frustration generated by=20
-them.)=20
-
-49. For primitive societies the natural world (which usually changes only =
-slowly) provided a stable=20
-framework and therefore a sense of security. In the modern world it is =
-human society that dominates nature=20
-rather than the other way around, and modern society changes very rapidly =
-owing to technological change.=20
-Thus there is no stable framework.=20
-
-50. The conservatives are fools: They whine about the decay of traditional =
-values, yet they enthusiastically=20
-support technological progress and economic growth. Apparently it never =
-occurs to them that you can't=20
-make rapid, drastic changes in the technology and the economy of a society =
-with out causing rapid changes=20
-in all other aspects of the society as well, and that such rapid changes =
-inevitably break down traditional=20
-values.=20
-
-51.The breakdown of traditional values to some extent implies the breakdown =
-of the bonds that hold=20
-together traditional small-scale social groups. The disintegration of =
-small-scale social groups is also=20
-promoted by the fact that modern conditions often require or tempt =
-individuals to move to new locations,=20
-separating themselves from their communities. Beyond that, a technological =
-society HAS TO weaken=20
-family ties and local communities if it is to function efficiently. In =
-modern society an individual's loyalty=20
-must be first to the system and only secondarily to a small-scale =
-community, because if the internal=20
-loyalties of small-scale small-scale communities were stronger than loyalty =
-to the system, such=20
-communities would pursue their own advantage at the expense of the system. =
-
-
-52. Suppose that a public official or a corporation executive appoints his =
-cousin, his friend or his co-
-religionist to a position rather than appointing the person best qualified =
-for the job. He has permitted=20
-personal loyalty to supersede his loyalty to the system, and that is =
-"nepotism" or "discrimination," both of=20
-which are terrible sins in modern society. Would-be industrial societies =
-that have done a poor job of=20
-subordinating personal or local loyalties to loyalty to the system are =
-usually very inefficient. (Look at Latin=20
-America.) Thus an advanced industrial society can tolerate only those =
-small-scale communities that are=20
-emasculated, tamed and made into tools of the system. [7]=20
-
-53. Crowding, rapid change and the breakdown of communities have been =
-widely recognized as sources of=20
-social problems. but we do not believe they are enough to account for the =
-extent of the problems that are=20
-seen today.=20
-
-54. A few pre-industrial cities were very large and crowded, yet their =
-inhabitants do not seem to have=20
-suffered from psychological problems to the same extent as modern man. In =
-America today there still are=20
-uncrowded rural areas, and we find there the same problems as in urban =
-areas, though the problems tend to=20
-be less acute in the rural areas. Thus crowding does not seem to be the =
-decisive factor.=20
-
-55. On the growing edge of the American frontier during the 19th century, =
-the mobility of the population=20
-probably broke down extended families and small-scale social groups to at =
-least the same extent as these=20
-are broken down today. In fact, many nuclear families lived by choice in =
-such isolation, having no=20
-neighbors within several miles, that they belonged to no community at all, =
-yet they do not seem to have=20
-developed problems as a result.=20
-
-56.Furthermore, change in American frontier society was very rapid and =
-deep. A man might be born and=20
-raised in a log cabin, outside the reach of law and order and fed largely =
-on wild meat; and by the time he=20
-arrived at old age he might be working at a regular job and living in an =
-ordered community with effective=20
-law enforcement. This was a deeper change that that which typically occurs =
-in the life of a modern=20
-individual, yet it does not seem to have led to psychological problems. In =
-fact, 19th century American=20
-society had an optimistic and self-confident tone, quite unlike that of =
-today's society. [8]=20
-
-57. The difference, we argue, is that modern man has the sense (largely =
-justified) that change is IMPOSED=20
-on him, whereas the 19th century frontiersman had the sense (also largely =
-justified) that he created change=20
-himself, by his own choice. Thus a pioneer settled on a piece of land of =
-his own choosing and made it into=20
-a farm through his own effort. In those days an entire county might have =
-only a couple of hundred=20
-inhabitants and was a far more isolated and autonomous entity than a modern =
-county is. Hence the pioneer=20
-farmer participated as a member of a relatively small group in the creation =
-of a new, ordered community.=20
-One may well question whether the creation of this community was an =
-improvement, but at any rate it=20
-satisfied the pioneer's need for the power process.=20
-
-58. It would be possible to give other examples of societies in which there =
-has been rapid change and/or=20
-lack of close community ties without he kind of massive behavioral =
-aberration that is seen in today's=20
-industrial society. We contend that the most important cause of social and =
-psychological problems in=20
-modern society is the fact that people have insufficient opportunity to go =
-through the power process in a=20
-normal way. We don't mean to say that modern society is the only one in =
-which the power process has been=20
-disrupted. Probably most if not all civilized societies have interfered =
-with the power ' process to a greater or=20
-lesser extent. But in modern industrial society the problem has become =
-particularly acute. Leftism, at least=20
-in its recent=20
-(mid-to-late -20th century) form, is in part a symptom of deprivation with =
-respect to the power process.=20
-
-DISRUPTION OF THE POWER PROCESS IN MODERN SOCIETY
-
-59. We divide human drives into three groups: (1) those drives that can be =
-satisfied with minimal effort; (2)=20
-those that can be satisfied but only at the cost of serious effort; (3) =
-those that cannot be adequately satisfied=20
-no matter how much effort one makes. The power process is the process of =
-satisfying the drives of the=20
-second group. The more drives there are in the third group, the more there =
-is frustration, anger, eventually=20
-defeatism, depression, etc.=20
-
-60. In modern industrial society natural human drives tend to be pushed =
-into the first and third groups, and=20
-the second group tends to consist increasingly of artificially created =
-drives.=20
-
-61. In primitive societies, physical necessities generally fall into group =
-2: They can be obtained, but only at=20
-the cost of serious effort. But modern society tends to guaranty the =
-physical necessities to everyone [9] in=20
-exchange for only minimal effort, hence physical needs are pushed into =
-group 1. (There may be=20
-disagreement about whether the effort needed to hold a job is "minimal"; =
-but usually, in lower- to middle-
-level jobs, whatever effort is required is merely that of obedience. You =
-sit or stand where you are told to sit=20
-or stand and do what you are told to do in the way you are told to do it. =
-Seldom do you have to exert=20
-yourself seriously, and in any case you have hardly any autonomy in work, =
-so that the need for the power=20
-process is not well served.)=20
-
-62. Social needs, such as sex, love and status, often remain in group 2 in =
-modern society, depending on the=20
-situation of the individual. [10] But, except for people who have a =
-particularly strong drive for status, the=20
-effort required to fulfill the social drives is insufficient to satisfy =
-adequately the need for the power process.=20
-
-63. So certain artificial needs have been created that fall into group 2, =
-hence serve the need for the power=20
-process. Advertising and marketing techniques have been developed that make =
-many people feel they need=20
-things that their grandparents never desired or even dreamed of. It =
-requires serious effort to earn enough=20
-money to satisfy these artificial needs, hence they fall into group 2. (But =
-see paragraphs 80-82.) Modern=20
-man must satisfy his need for the power process largely through pursuit of =
-the artificial needs created by=20
-the advertising and marketing industry [11], and through surrogate =
-activities.=20
-
-64. It seems that for many people, maybe the majority, these artificial =
-forms of the power process are=20
-insufficient. A theme that appears repeatedly in the writings of the social =
-critics of the second half of the=20
-20th century is the sense of purposelessness that afflicts many people in =
-modern society. (This=20
-purposelessness is often called by other names such as "anomic" or =
-"middle-class vacuity.") We suggest=20
-that the so-called "identity crisis" is actually a search for a sense of =
-purpose, often for commitment to a=20
-suitable surrogate activity. It may be that existentialism is in large part =
-a response to the purposelessness of=20
-modern life. [12] Very widespread in modern society is the search for =
-"fulfillment." But we think that for=20
-the majority of people an activity whose main goal is fulfillment=20
-(that is, a surrogate activity) does not bring completely satisfactory =
-fulfillment. In other words, it does not=20
-fully satisfy the need for the power process. (See paragraph 41.) That need =
-can be fully satisfied only=20
-through activities that have some external goal, such as physical =
-necessities, sex, love, status, revenge, etc.=20
-
-65. Moreover, where goals are pursued through earning money, climbing the =
-status ladder or functioning=20
-as part of the system in some other way, most people are not in a position =
-to pursue their goals=20
-AUTONOMOUSLY. Most workers are someone else's employee as, as we pointed =
-out in paragraph 61,=20
-must spend their days doing what they are told to do in the way they are =
-told to do it. Even most people=20
-who are in business for themselves have only limited autonomy. It is a =
-chronic complaint of small-business=20
-persons and entrepreneurs that their hands are tied by excessive government =
-regulation. Some of these=20
-regulations are doubtless unnecessary, but for the most part government =
-regulations are essential and=20
-inevitable parts of our extremely complex society. A large portion of small =
-business today operates on the=20
-franchise system.=20
-It was reported in the Wall Street Journal a few years ago that many of the =
-franchise-granting companies=20
-require applicants for franchises to take a personality test that is =
-designed to EXCLUDE those who have=20
-creativity and initiative, because such persons are not sufficiently docile =
-to go along obediently with the=20
-franchise system. This excludes from small business many of the people who =
-most need autonomy.=20
-
-66. Today people live more by virtue of what the system does FOR them or TO =
-them than by virtue of=20
-what they do for themselves. And what they do for themselves is done more =
-and more along channels laid=20
-down by the system. Opportunities tend to be those that the system =
-provides, the opportunities must be=20
-exploited in accord with the rules and regulations [13], and techniques =
-prescribed by experts must be=20
-followed if there is to be a chance of success.=20
-
-67. Thus the power process is disrupted in our society through a deficiency =
-of real goals and a deficiency=20
-of autonomy in pursuit of goals. But it is also disrupted because of those =
-human drives that fall into group=20
-3: the drives that one cannot adequately satisfy no matter how much effort =
-one makes. One of these drives=20
-is the need for security. Our lives depend on decisions made by other =
-people; we have no control over these=20
-decisions and usually we do not even know the people who make them. ("We =
-live in a world in which=20
-relatively few people - maybe 500 or 1,00 - make the important decisions" - =
-Philip B. Heymann of Harvard=20
-Law School, quoted by Anthony Lewis, New York Times, April 21, 1995.) Our =
-lives depend on whether=20
-safety standards at a nuclear power plant are properly maintained;=20
-on how much pesticide is allowed to get into our food or how much pollution =
-into our air; on how skillful=20
-(or incompetent) our doctor is; whether we lose or get a job may depend on =
-decisions made by government=20
-economists or corporation executives; and so forth. Most individuals are =
-not in a position to secure=20
-themselves against these threats to more [than] a very limited extent. The =
-individual's search for security is=20
-therefore frustrated, which leads to a sense of powerlessness.=20
-
-68. It may be objected that primitive man is physically less secure than =
-modern man, as is shown by his=20
-shorter life expectancy; hence modern man suffers from less, not more than =
-the amount of insecurity that is=20
-normal for human beings. but psychological security does not closely =
-correspond with physical security.=20
-What makes us FEEL secure is not so much objective security as a sense of =
-confidence in our ability to=20
-take care of ourselves. Primitive man, threatened by a fierce animal or by =
-hunger, can fight in self-defense=20
-or travel in search of food. He has no certainty of success in these =
-efforts, but he is by no means helpless=20
-against the things that threaten him. The modern individual on the other =
-hand is threatened by many things=20
-against which he is helpless;=20
-nuclear accidents, carcinogens in food, environmental pollution, war, =
-increasing taxes, invasion of his=20
-privacy by large organizations, nation-wide social or economic phenomena =
-that may disrupt his way of=20
-life.=20
-
-69. It is true that primitive man is powerless against some of the things =
-that threaten him; disease for=20
-example. But he can accept the risk of disease stoically. It is part of the =
-nature of things, it is no one's fault,=20
-unless is the fault of some imaginary, impersonal demon. But threats to the =
-modern individual tend to be=20
-MAN-MADE. They are not the results of chance but are IMPOSED on him by =
-other persons whose=20
-decisions he, as an individual, is unable to influence. Consequently he =
-feels frustrated, humiliated and=20
-angry.=20
-
-70. Thus primitive man for the most part has his security in his own hands =
-(either as an individual or as a=20
-member of a SMALL group) whereas the security of modern man is in the hands =
-of persons or=20
-organizations that are too remote or too large for him to be able =
-personally to influence them. So modern=20
-man's drive for security tends to fall into groups 1 and 3; in some areas =
-(food, shelter, etc.) his security is=20
-assured at the cost of only trivial effort, whereas in other areas he =
-CANNOT attain security. (The foregoing=20
-greatly simplifies the real situation, but it does indicate in a rough, =
-general way how the condition of=20
-modern man differs from that of primitive man.)=20
-
-71. People have many transitory drives or impulses that are necessary =
-frustrated in modern life, hence fall=20
-into group 3. One may become angry, but modern society cannot permit =
-fighting. In many situations it=20
-does not even permit verbal aggression. When going somewhere one may be in =
-a hurry, or one may be in a=20
-mood to travel slowly, but one generally has no choice but to move with the =
-flow of traffic and obey the=20
-traffic signals. One may want to do one's work in a different way, but =
-usually one can work only according=20
-to the rules laid down by one's employer. In many other ways as well, =
-modern man is strapped down by a=20
-network of rules and regulations (explicit or implicit) that frustrate many =
-of his impulses and thus interfere=20
-with the power process. Most of these regulations cannot be disposed with, =
-
-because the are necessary for the functioning of industrial society. =
-
-
-72. Modern society is in certain respects extremely permissive. In matters =
-that are irrelevant to the=20
-functioning of the system we can generally do what we please. We can =
-believe in any religion we like (as=20
-long as it does not encourage behavior that is dangerous to the system). We =
-can go to bed with anyone we=20
-like (as long as we practice "safe sex"). We can do anything we like as =
-long as it is UNIMPORTANT. But=20
-in all IMPORTANT matters the system tends increasingly to regulate our =
-behavior.=20
-
-73. Behavior is regulated not only through explicit rules and not only by =
-the government. Control is often=20
-exercised through indirect coercion or through psychological pressure or =
-manipulation, and by=20
-organizations other than the government, or by the system as a whole. Most =
-large organizations use some=20
-form of propaganda [14] to manipulate public attitudes or behavior. =
-Propaganda is not limited to=20
-"commercials" and advertisements, and sometimes it is not even consciously =
-intended as propaganda by=20
-the people who make it. For instance, the content of entertainment =
-programming is a powerful form of=20
-propaganda. An example of indirect coercion: There is no law that says we =
-have to go to work every day=20
-and follow our employer's orders. Legally there is=20
-nothing to prevent us from going to live in the wild like primitive people =
-or from going into business for=20
-ourselves. But in practice there is very little wild country left, and =
-there is room in the economy for only a=20
-limited number of small business owners. Hence most of us can survive only =
-as someone else's employee.=20
-
-74. We suggest that modern man's obsession with longevity, and with =
-maintaining physical vigor and=20
-sexual attractiveness to an advanced age, is a symptom of unfulfillment =
-resulting from deprivation with=20
-respect to the power process. The "mid-life crisis" also is such a symptom. =
-So is the lack of interest in=20
-having children that is fairly common in modern society but almost =
-unheard-of in primitive societies.=20
-
-75. In primitive societies life is a succession of stages. The needs and =
-purposes of one stage having been=20
-fulfilled, there is no particular reluctance about passing on to the next =
-stage. A young man goes through the=20
-power process by becoming a hunter, hunting not for sport or for =
-fulfillment but to get meat that is=20
-necessary for food. (In young women the process is more complex, with =
-greater emphasis on social power;=20
-we won't discuss that here.) This phase having been successfully passed =
-through, the young man has no=20
-reluctance about settling down to the responsibilities of raising a family. =
-(In contrast, some modern people=20
-indefinitely postpone having children because they are too busy seeking =
-some kind of "fulfillment." We=20
-suggest that the=20
-fulfillment they need is adequate experience of the power process -- with =
-real goals instead of the artificial=20
-goals of surrogate activities.) Again, having successfully raised his =
-children, going through the power=20
-process by providing them with the physi cal necessities, the primitive man =
-feels tha t his work is done and=20
-he is prepared to accept old age (if he survives that long) and death. Many =
-modern people, on the other=20
-hand, are disturbed by the prospect of death, as is shown by the amount of =
-effort they expend trying to=20
-maintain their physical condition, appearance and health. We argue t hat =
-this is due to unfulfillment=20
-resulting from the fact that they have never put their physical powers to =
-any use, have never gone through=20
-the power process using their bodies in a serious way.=20
-It is not the primitive man, who has used his body daily for practical =
-purposes, who fears the deteriora tion=20
-of age, but the modern man, who has never had a practical use for his body =
-beyond walking from his car to=20
-his house. It is the man whose need for the power process has been =
-satisfied during his life who is best=20
-prepared to accept the end of that life .=20
-
-76. In response to the arguments of this section someone will say, "Society =
-must find a way to give people=20
-the opportunity to go through the power process." For such people the value =
-of the opportunity is destroyed=20
-by the very fact that society gives i t to them. What they need is to find =
-or make their own opportunities. As=20
-long as the system GIVES them their opportunities it still has them on a =
-leash. To attain autonomy they=20
-must get off that leash. Manifesto Contents=20
-
-
-
-HOW SOME PEOPLE ADJUST
-
-77. Not everyone in industrial-technological society suffers from =
-psychological problems. Some people=20
-even profess to be quite satisfied with society as it is. We now discuss =
-some of the reasons why people=20
-differ so greatly in their response to modern society.=20
-
-78. First, there doubtless are differences in the strength of the drive for =
-power. Individuals with a weak=20
-drive for power may have relatively little need to go through the power =
-process, or at least relatively little=20
-need for autonomy in the power pro cess. These are docile types who would =
-have been happy as plantation=20
-darkies in the Old South. (We don't mean to sneer at "plantation darkies" =
-of the Old South. To their credit,=20
-most of the slaves were NOT content with their servitude. We do sneer at =
-people who ARE content with=20
-servitude.)=20
-
-79. Some people may have some exceptional drive, in pursuing which they =
-satisfy their need for the power=20
-process. For example, those who have an unusually strong drive for social =
-status may spend their whole=20
-lives climbing the status ladder without ev er getting bored with that =
-game.=20
-
-80. People vary in their susceptibility to advertising and marketing =
-techniques. Some people are so=20
-susceptible that, even if they make a great deal of money, they cannot =
-satisfy their constant craving for the=20
-shiny new toys that the marketing industry dangles before their eyes. So =
-they always f eel hard-pressed=20
-financially even if their income is large, and their cravings are =
-frustrated.=20
-
-81. Some people have low susceptibility to advertising and marketing =
-techniques. These are the people=20
-who aren't interested in money. Material acquisition does not serve their =
-need for the power process.=20
-
-82. People who have medium susceptibility to advertising and marketing =
-techniques are able to earn=20
-enough money to satisfy their craving for goods and services, but only at =
-the cost of serious effort (putting=20
-in overtime, taking a second job, earning p romotions, etc.) Thus material =
-acquisition s erves their need for=20
-the power process. But it does not necessarily follow that their need is =
-fully satisfied. They may have=20
-insufficient autonomy in the power process (their work may consist of =
-following orders) and some of their=20
-drives may be frustrated (e.g., security, aggression). (We are guilt y of =
-oversimplification in paragraphs 80-
-82 because we have assumed that the desire for material acquisition is =
-entirely a creation of the advertising=20
-and marketing industry. Of course it's not that simple.=20
-
-83. Some people partly satisfy their need for power by identifying =
-themselves with a powerful organization=20
-or mass movement. An individual lacking goals or power joins a movement or =
-an organization, adopts its=20
-goals as his own, then works toward these goals. When some of the goals are =
-attained, the individual, even=20
-though his personal efforts have played only an insignificant part in the =
-attainment of the goals, feels=20
-(through his identification with the movement or organization) as if he had =
-gone through the power=20
-process. This phenomenon was e xploited by the fascists, nazis and communis =
-ts. Our society uses it, too,=20
-though less crudely. Example: Manuel Noriega was an irritant to the U.S. =
-(goal: punish Noriega). The U.S.=20
-invaded Panama (effort) and punished Noriega (attainment of goal).=20
-The U.S. went through the power process and many Ame ricans, because of =
-their identification with the=20
-U.S., experienced the power process vicariously. Hence the widespread =
-public approval of the Panama=20
-invasion; it gave people a sense of power. [15] We see the same phenomenon =
-in armies, corporations,=20
-political parties, humanitarian organizations, rel igious or ideological =
-movements. In particul ar, leftist=20
-movements tend to attract people who are seeking to satisfy their need for =
-power. But for most people=20
-identification with a large organization or a mass movement does not fully =
-satisfy the need for power.=20
-
-84. Another way in which people satisfy their need for the power process is =
-through surrogate activities. As=20
-we explained in paragraphs 38-40, a surrogate activity that is directed =
-toward an artificial goal that the=20
-individual pursues for the sake of t he "fulfillment" that he gets from =
-pursuing the goal, not because he=20
-needs to attain the goal itself. For instance, there is no practical motive =
-for building enormous muscles,=20
-hitting a little ball into a hole or acquiring a complete series of postage =
-stamps. Yet many people in our=20
-society devote t hemselves with passion to bodybuilding, golf or stamp =
-collecting. Some people are more=20
-"other-directed" than others, and therefore will more readily attack =
-importance to a surrogate activity=20
-simply because the people around them treat it as important=20
-or because society tells them it is important. T hat is why some people get =
-very serious abou t essentially=20
-trivial activities such as sports, or bridge, or chess, or arcane scholarly =
-pursuits, whereas others who are=20
-more clear-sighted never see these things as anything but the surrogate =
-activities that they are, and=20
-consequently never attach enou gh importance to them to satisfy their need =
-for the power process in that=20
-way. It only remains to point out that in many cases a person's way of =
-earning a living is also a surrogate=20
-activity. Not a PURE surrogate activity, since part of the motive for the =
-activity is to gain the physical=20
-necessitie s and (for some people) social status and th e luxuries that =
-advertising makes them want. But=20
-many people put into their=20
-work far more effort than is necessary to earn whatever money and status =
-they require, and this extra effort=20
-constitutes a surrogate activity. This extra effort, together with the =
-emotional investment that accompanies=20
-it, i s one of the most potent forces acting toward the continual =
-development and perfecting of the system,=20
-with negative consequences for individual freedom (see paragraph 131). =
-Especially, for the most creative=20
-scientists and engineers, work tends to be large ly a surrogate activity. =
-This point is so im portant that is=20
-deserves a separate discussion, which we shall give in a moment (paragraphs =
-87-92).=20
-
-85. In this section we have explained how many people in modern society do =
-satisfy their need for the=20
-power process to a greater or lesser extent. But we think that for the =
-majority of people the need for the=20
-power process is not fully satisfied. In th e first place, those who have =
-an insatiable drive for status, or who=20
-get firmly "hooked" or a surrogate activity, or who identify strongly =
-enough with a movement or=20
-organization to satisfy their need for power in that way, are exceptional =
-personalities. Others are not fully=20
-satisfied with surrogate activities or by identification with an org =
-anization (see paragraphs 41, 64). In the=20
-second place, too much control is imposed by the system through explicit =
-regulation or through=20
-socialization,=20
-which results in a deficiency of autonomy, and in frustration due to the =
-impossibility of attaining cer tain=20
-goals and the necessity of restraining too many impulses.=20
-
-86. But even if most people in industrial-technological society were well =
-satisfied, we (FC) would still be=20
-opposed to that form of society, because (among other reasons) we consider =
-it demeaning to fulfill one's=20
-need for the power process through surr ogate activities or through =
-identification w ith an organization,=20
-rather then through pursuit of real goals.=20
-
-THE MOTIVES OF SCIENTISTS
-
-87. Science and technology provide the most important examples of surrogate =
-activities. Some scientists=20
-claim that they are motivated by "curiosity," that notion is simply absurd. =
-Most scientists work on highly=20
-specialized problem that are not the obje ct of any normal curiosity. For =
-example, is an astronomer, a=20
-mathematician or an entomologist curious about the properties of =
-isopropyltrimethylmethane? Of course=20
-not. Only a chemist is curious about such a thing, and he is curious about =
-it only because chemistry is his=20
-surrogate activity. Is the c hemist curious about the appropriate classif =
-ication of a new species of beetle?=20
-No. That question is of interest only to the entomologist, and he is =
-interested in it only because entomology=20
-is his surrogate activity.=20
-If the chemist and the entomologist had to exert themselves seriously to =
-obtain th e physical necessities,=20
-and if that effort e xercised their abilities in an interesting way but in =
-some nonscientific pursuit, then they=20
-couldn't giver a damn about isopropyltrimethylmethane or the classification =
-of beetles. Suppose that lack of=20
-funds for postgraduate education had led the chemist t o become an =
-insurance broker instead of a ch emist.=20
-In that case he would have been very interested in insurance matters but =
-would have cared nothing about=20
-isopropyltrimethylmethane. In any case it is not normal to put into the =
-satisfaction of mere curiosity the=20
-amount of time and effort that scient ists put into their work. The =
-"curiosity" ex planation for the scientists'=20
-motive just doesn't stand up.=20
-
-88. The "benefit of humanity" explanation doesn't work any better. Some =
-scientific work has no=20
-conceivable relation to the welfare of the human race - most of archaeology =
-or comparative linguistics for=20
-example. Some other areas of science present obvio usly dangerous =
-possibilities. Yet scientists in these=20
-areas are just as enthusiastic about their work as those who develop =
-vaccines or study air pollution.=20
-Consider the case of Dr. Edward Teller, who had an obvious emotional =
-involvement in promoting nuclear=20
-power plants. Did this involvement stem f rom a desire to benefit humanity? =
-If so, the n why didn't Dr.=20
-Teller get emotional about other "humanitarian" causes? If he was such a =
-humanitarian then why did he=20
-help to develop the H-bomb? As with many other scientific achievements, =
-
-it is very much open to question whether nuclear power plants ac tually do =
-benefit humanity. Does the=20
-cheap e lectricity outweigh the accumulating waste and risk of accidents? =
-Dr. Teller saw only one side of=20
-the question. Clearly his emotional involvement with nuclear power arose =
-not from a desire to "benefit=20
-humanity" but from a personal fulfillment he got from his work and from =
-seeing it put to practical use.=20
-
-89. The same is true of scientists generally. With possible rare =
-exceptions, their motive is neither curiosity=20
-nor a desire to benefit humanity but the need to go through the power =
-process: to have a goal (a scientific=20
-problem to solve), to make an eff ort (research) and to attain the goal =
-(solut ion of the problem.) Science is=20
-a surrogate activity because scientists work mainly for the fulfillment =
-they get out of the work itself.=20
-
-90. Of course, it's not that simple. Other motives do play a role for many =
-scientists. Money and status for=20
-example. Some scientists may be persons of the type who have an insatiable =
-drive for status (see paragraph=20
-79) and this may provide much of the motivation for their work. No doubt =
-the majo rity of scientists, like=20
-the majority of the general population, are more or less susceptible to =
-advertising and marketing techniques=20
-and need money to satisfy their craving for goods and services. Thus =
-science is not a PURE surrogate=20
-activity. But it is in large part a surrogate activity.=20
-
-91. Also, science and technology constitute a mass power movement, and many =
-scientists gratify their need=20
-for power through identification with this mass movement (see paragraph =
-83).=20
-
-92. Thus science marches on blindly, without regard to the real welfare of =
-the human race or to any other=20
-standard, obedient only to the psychological needs of the scientists and of =
-the government officials and=20
-corporation executives who provide the fu nds for research.=20
-
-THE NATURE OF FREEDOM
-
-93. We are going to argue that industrial-technological society cannot be =
-reformed in such a way as to=20
-prevent it from progressively narrowing the sphere of human freedom. But =
-because "freedom" is a word=20
-that can be interpreted in many ways, we must fi rst make clear what kind =
-of freedom we are c oncerned=20
-with.=20
-
-94. By "freedom" we mean the opportunity to go through the power process, =
-with real goals not the=20
-artificial goals of surrogate activities, and without interference, =
-manipulation or supervision from anyone,=20
-especially from any large organization. Freed om means being in control =
-(either as an indi vidual or as a=20
-member of a SMALL group) of the life-and-death issues of one's existence; =
-food, clothing, shelter and=20
-defense against whatever threats there may be in one's environment. Freedom =
-means having power; not the=20
-power to control other people but the power to control the circumstances of =
-on e's own life. One does not=20
-have freedom if anyone else (especially a large organization) has power =
-over one, no matter how=20
-benevolently, tolerantly and permissively that power may be exercised. =
-
-It is important not to confuse freedom with mere permissivene ss (see =
-paragraph 72).=20
-
-95. It is said that we live in a free society because we have a certain =
-number of constitutionally guaranteed=20
-rights. But these are not as important as they seem. The degree of personal =
-freedom that exists in a society=20
-is determined more by the economi c and technological structure of the =
-society than by its laws or its form=20
-of government. [16] Most of the Indian nations of New England were =
-monarchies, and many of the cities=20
-of the Italian Renaissance were controlled by dictators. But in reading =
-about these societies one gets the=20
-impression that they allowed far more personal freedom than out society =
-does. In part this was because=20
-they lacked efficient mechanisms for enforcing the ruler's will: There were =
-no modern, well-organized=20
-police forces, no rapid long-distance communications,=20
-no surveillance cameras, no dossiers of information abou t the lives of =
-average citizens. Hence it wa s=20
-relatively easy to evade control.=20
-
-96. As for our constitutional rights, consider for example that of freedom =
-of the press. We certainly don't=20
-mean to knock that right: it is very important tool for limiting =
-concentration of political power and for=20
-keeping those who do have political po wer in line by publicly exposing any =
-misbeha vior on their part.=20
-But freedom of the press is of very little use to the average citizen as an =
-individual. The mass media are=20
-mostly under the control of large organizations that are integrated into =
-the system. Anyone who has a little=20
-money can have some thing printed, or can distribute it on the I nternet or =
-in some such way, but what he=20
-has to say will be swamped by the vast volume of material put out by the =
-media, hence it will have no=20
-practical effect.=20
-To make an impression on society with words is therefore almost impossible =
-for most individual s and=20
-small groups. Take us (FC) for example . If we had never done anything =
-violent and had submitted the=20
-present writings to a publisher, they probably would not have been =
-accepted. If they had been accepted and=20
-published, they probably would not have attracted many readers, because =
-it's more fun to watch the=20
-entertainment put out by the me dia than to read a sober essay. Even if =
-these writings had had many=20
-readers, most of these readers would soon have forgotten what they had read =
-as their minds were flooded=20
-by the mass of material to which the media expose them. In order to get our =
-message before the public with=20
-some chance of makin g a lasting impression, we've had to kill people. =
-
-
-97. Constitutional rights are useful up to a point, but they do not serve =
-to guarantee much more than what=20
-could be called the bourgeois conception of freedom. According to the =
-bourgeois conception, a "free" man=20
-is essentially an element of a social ma chine and has only a certain set =
-of prescrib ed and delimited=20
-freedoms; freedoms that are designed to serve the needs of the social =
-machine more than those of the=20
-individual. Thus the bourgeois's "free" man has economic freedom because =
-that promotes growth and=20
-progress; he has freedom of the press b ecause public criticism restrains =
-misbehavio r by political leaders;=20
-he has a rights to a fair trial because imprisonment at the whim of the =
-powerful would be bad for the=20
-system. This was clearly the attitude of Simon Bolivar.=20
-To him, people deserved liberty only if they used it to promote progress =
-(progress as conceived by the=20
-bourgeois). Ot her bourgeois thinkers have taken a similar view of freedom =
-as a mere means to collective=20
-ends. Chester C. Tan, "Chinese Political Thought in the Twentieth Century," =
-page 202, explains the=20
-philosophy of the Kuomintang leader Hu Han-min: "An individual is granted =
-rights because he is a=20
-member of soc iety and his community life requires such rights. By =
-community Hu meant the whole=20
-society of the nation." And on page 259 Tan states that according to Carsum =
-Chang (Chang Chun-mai,=20
-head of the State Socialist Party in China) freedom had to be used in the =
-interest of the state and of the=20
-people as a whole. But what kind of freedom does one have if one can use it =
-only as someone else=20
-prescribes?=20
-FC's conception of freedom is not that of Bolivar, Hu, Chang or other =
-bourgeois theorists. The trouble with=20
-such theorists is that they have made the develop ment and application of =
-social theories thei r surrogate=20
-activity. Consequently the theories are designed to serve the needs of the =
-theorists more than the needs of=20
-any people who may be unlucky enough to live in a society on which the =
-theories are imposed.=20
-
-98. One more point to be made in this section: It should not be assumed =
-that a person has enough freedom=20
-just because he SAYS he has enough. Freedom is restricted in part by =
-psychological control of which=20
-people are unconscious, and moreover many peopl e's ideas of what =
-constitutes freedom are go verned=20
-more by social convention than by their real needs. For example, it's =
-likely that many leftists of the=20
-oversocialized type would say that most people, including themselves are =
-socialized too little rather than=20
-too much, yet the oversocialized lefti st pays a heavy psychological price =
-for his high level of socialization.=20
-
-SOME PRINCIPLES OF HISTORY
-
-99. Think of history as being the sum of two components: an erratic =
-component that consists of=20
-unpredictable events that follow no discernible pattern, and a regular =
-component that consists of long-term=20
-historical trends. Here we are concerned with the long-term trends. =
-
-
-100. FIRST PRINCIPLE. If a SMALL change is made that affects a long-term =
-historical trend, then the=20
-effect of that change will almost always be transitory - the trend will =
-soon revert to its original state.=20
-(Example: A reform movement designed to clean up political corruption in a =
-society rarely has more than a=20
-short-term effect; sooner or later the reformers relax and corruption =
-creeps back in. The level of political=20
-corruption in a given society tends to remain constant, or to change only =
-slowly with the evolution of the=20
-society. Normally, a p olitical cleanup will be permanent only if a =
-ccompanied by widespread social=20
-changes; a SMALL change in the society won't be enough.) If a small change =
-in a long-term historical=20
-trend appears to be permanent, i
-t is only because the change acts in the direction in which the trend is =
-already moving, s o that the trend is=20
-not altered but only pus hed a step ahead.=20
-
-101. The first principle is almost a tautology. If a trend were not stable =
-with respect to small changes, it=20
-would wander at random rather than following a definite direction; in other =
-words it would not be a long-
-term trend at all.=20
-
-102. SECOND PRINCIPLE. If a change is made that is sufficiently large to =
-alter permanently a long-term=20
-historical trend, than it will alter the society as a whole. In other =
-words, a society is a system in which all=20
-parts are interrelated, and you can't permanently change any important part =
-witho ut change all the other=20
-parts as well.=20
-
-103. THIRD PRINCIPLE. If a change is made that is large enough to alter =
-permanently a long-term trend,=20
-then the consequences for the society as a whole cannot be predicted in =
-advance. (Unless various other=20
-societies have passed through the same change and have all experienced the =
-same consequenc es, in which=20
-case one can predict on empirical grounds that another society that passes =
-through the same change will be=20
-like to experience similar consequences.)=20
-
-104. FOURTH PRINCIPLE. A new kind of society cannot be designed on paper. =
-That is, you cannot plan=20
-out a new form of society in advance, then set it up and expect it to =
-function as it was designed to.=20
-
-105. The third and fourth principles result from the complexity of human =
-societies. A change in human=20
-behavior will affect the economy of a society and its physical environment; =
-the economy will affect the=20
-environment and vice versa, and the changes in the economy and the =
-environment will affec t human=20
-behavior in complex, unpredictable ways; and so forth. The network of =
-causes and effects is far too=20
-complex to be untangled and understood.=20
-
-106. FIFTH PRINCIPLE. People do not consciously and rationally choose the =
-form of their society.=20
-Societies develop through processes of social evolution that are not under =
-rational human control.=20
-
-107. The fifth principle is a consequence of the other four.=20
-
-108. To illustrate: By the first principle, generally speaking an attempt =
-at social reform either acts in the=20
-direction in which the society is developing anyway (so that it merely =
-accelerates a change that would have=20
-occurred in any case) or else it o nly has a transitory effect, so that the =
-soc iety soon slips back into its old=20
-groove. To make a lasting change in the direction of development of any =
-important aspect of a society,=20
-reform is insufficient and revolution is required. (A revolution does not =
-necessarily involve an armed=20
-uprising or the overthrow of a government.) By the second p rinciple, a =
-revolution never changes only one=20
-aspect of a society; and by the third principle changes occur that were =
-never expected or desired by the=20
-revolutionaries.=20
-By the fourth principle, when revolutionaries or utopians set up a new kind =
-of society, it never works out as=20
-planned.=20
-
-109. The American Revolution does not provide a counterexample. The =
-American "Revolution" was not a=20
-revolution in our sense of the word, but a war of independence followed by =
-a rather far-reaching political=20
-reform. The Founding Fathers did not change t he direction of development =
-of American soci ety, nor did=20
-they aspire to do so. They only freed the development of American society =
-from the retarding effect of=20
-British rule. Their political reform did not change any basic trend, but =
-only pushed American political=20
-culture along its natural direction of development. British society, of =
-which A merican society was an off-
-shoot, had been moving for a long time in the direction of representative =
-democracy. And prior to the War=20
-of Independence the Americans were already practicing a significant =
-
-degree of representative democracy in the colonial ass emblies. The =
-political system established by the=20
-Constitution was modeled on the British system and on the colonial =
-assemblies. With major alteration, to=20
-be sure - there is no doubt that the Founding Fathers took a very important =
-step. But it was a step along the=20
-road the English-speaking world was already traveling. The proof is that =
-Britai n and all of its colonies that=20
-were populated predominantly by people of British descent ended up with =
-systems of representative=20
-democracy essentially similar to that of the United States. If the Founding =
-Fathers had lost their nerve and=20
-declined to sign the Declaration of Independence, our way of life today =
-would not have been significantly=20
-different.=20
-Maybe we would have had somewhat closer ties to Britain, and would have had =
-a Parliament and Prime=20
-Minister instead of a Congress and President. No big deal. Thus the =
-American Revolution provides not a=20
-counterexample to our principles but a go od illustration of them.=20
-
-110. Still, one has to use common sense in applying the principles. They =
-are expressed in imprecise=20
-language that allows latitude for interpretation, and exceptions to them =
-can be found. So we present these=20
-principles not as inviolable laws but as rule s of thumb, or guides to =
-thinking, that may provide a partial=20
-antidote to naive ideas about the future of society. The principles should =
-be borne constantly in mind, and=20
-whenever one reaches a conclusion that conflicts with them one should =
-carefully reexamine one's thinking=20
-and retain the conclusio n only if one has good, solid reasons for do ing =
-so.=20
-
-INDUSTRIAL-TECHNOLOGICAL SOCIETY CANNOT BE REFORMED
-
-111. The foregoing principles help to show how hopelessly difficult it =
-would be to reform the industrial=20
-system in such a way as to prevent it from progressively narrowing our =
-sphere of freedom. There has been=20
-a consistent tendency, going back at least to the Industrial Revolution for =
-technology to strengthen the=20
-system at a high cost in individual freedom and local autonomy. Hence any =
-change designed to protect=20
-freedom from technology would be contrary to a fundamental trend in the =
-development of our society.=20
-
-Consequently, such a change either would be a transitory one -- soon =
-swamped by the tide of history -- or,=20
-if large enough to be permanent would alter the nature of our whole =
-society. This by the first and second=20
-principles. Moreover, since society wo uld be altered in a way that could =
-not be pr edicted in advance (third=20
-principle) there would be great risk. Changes large enough to make a =
-lasting difference in favor of freedom=20
-would not be initiated because it would realized that they would gravely =
-disrupt the system. So any=20
-attempts at reform w ould be too timid to be effective. Even if c hanges =
-large enough to make a lasting=20
-difference were initiated, they would be retracted when their disruptive =
-effects became apparent. Thus,=20
-permanent changes=20
-in favor of freedom could be brought about only by persons prepared to =
-accept radical, dangero us and=20
-unpredictable alteration of the entir e system. In other words, by =
-revolutionaries, not reformers.=20
-
-112. People anxious to rescue freedom without sacrificing the supposed =
-benefits of technology will suggest=20
-naive schemes for some new form of society that would reconcile freedom =
-with technology. Apart from the=20
-fact that people who make suggestions sel dom propose any practical means =
-by which the new form of=20
-society could be set up in the first place, it follows from the fourth =
-principle that even if the new form of=20
-society could be once established, it either would collapse or would give =
-results very different from those=20
-expected.=20
-
-113. So even on very general grounds it seems highly improbably that any =
-way of changing society could=20
-be found that would reconcile freedom with modern technology. In the next =
-few sections we will give more=20
-specific reasons for concluding that freedo m and technological progress =
-are incompatibl e.=20
-
-
-
-RESTRICTION OF FREEDOM IS UNAVOIDABLE IN INDUSTRIAL SOCIETY
-
-
-
-114. As explained in paragraph 65-67, 70-73, modern man is strapped down by =
-a network of rules and=20
-regulations, and his fate depends on the actions of persons remote from him =
-whose decisions he cannot=20
-influence. This is not accidental or a result of t he arbitrariness of =
-arrogant bureaucrats. I t is necessary and=20
-inevitable in any technologically advanced society. The system HAS TO =
-regulate human behavior closely=20
-in order to function. At work, people have to do what they are told to do, =
-otherwise production would be=20
-thrown into chaos. Bureaucra cies HAVE TO be run according to rigid rules . =
-To allow any substantial=20
-personal discretion to lower-level bureaucrats would disrupt the system and =
-lead to charges of unfairness=20
-due to differences in the way individual bureaucrats exercised their =
-discretion.=20
-It is true that some restrictions on our freedom could be eliminated, but =
-GENERALLY S PEAKING the=20
-regulation of our lives by large organizations is necessary for the =
-functioning of industrial-technological=20
-society. The result is a sense of powerlessness on the part of the average =
-person. It may be, however, that=20
-formal regulations will ten d increasingly to be replaced by psychologic al =
-tools that make us want to do=20
-what the system requires of us. (Propaganda [14], educational techniques, =
-"mental health" programs, etc.)=20
-
-115. The system HAS TO force people to behave in ways that are increasingly =
-remote from the natural=20
-pattern of human behavior. For example, the system needs scientists, =
-mathematicians and engineers. It can't=20
-function without them. So heavy pressure is put on children to excel in =
-these fields. It isn't natural for an=20
-adolescent human being to spend the bulk of his time sitting at a desk =
-absorbed in study. A normal=20
-adolescent wants to spend his time in active contact with the real world. =
-Among primitive peoples the=20
-things that children are trained to do are in natural harmony with natural =
-h uman impulses. Among the=20
-American Indians, for example, boys were trained in active outdoor pursuits =
--- just the sort of things that=20
-boys like. But in our society children are pushed into studying technical =
-subjects,=20
-which most do grudgingly.=20
-
-117. In any technologically advanced society the individual's fate MUST =
-depend on decisions that he=20
-personally cannot influence to any great extent. A technological society =
-cannot be broken down into small,=20
-autonomous communities, because production de pends on the cooperation of =
-very large numbe rs of=20
-people. When a decision affects, say, a million people, then each of the =
-affected individuals has, on the=20
-average, only a one-millionth share in making the decision. What usually =
-happens in practice is that=20
-decisions are made by public officials or corporation executives, or by =
-technical spe cialists, but even when=20
-the public votes on a decision the number of voters ordinarily is too large =
-for the vote of any one individual=20
-to be significant. [17]=20
-Thus most individuals are unable to influence measurably the major =
-decisions that affect their l ives. Their=20
-is no conceivable way to remedy this in a technologically advanced society. =
-The system tries to "solve" this=20
-problem by using propaganda to make people WANT the decisions that have =
-been made for them, but even=20
-if this "solution" were completely successful in making people feel better, =
-it would be demeaning.=20
-
-118 Conservatives and some others advocate more "local autonomy." Local =
-communities once did have=20
-autonomy, but such autonomy becomes less and less possible as local =
-communities become more=20
-enmeshed with and dependent on large-scale systems like public utilities, =
-computer networks, highway=20
-syste ms, the mass communications media, the modern health care system. =
-Also operating against=20
-autonomy is the fact that technology applied in one location often affects =
-people at other locations far=20
-away. Thus pesticide or chemical use near a creek may contam inate the =
-water supply hundreds of miles=20
-dow nstream, and the greenhouse effect affects the whole world.=20
-
-119. The system does not and cannot exist to satisfy human needs. Instead, =
-it is human behavior that has to=20
-be modified to fit the needs of the system. This has nothing to do with the =
-political or social ideology that=20
-may pretend to guide the technolog ical system. It is the fault of =
-technology, because the system is guided=20
-not by ideology but by technical necessity. [18] Of course the system does =
-satisfy many human needs, but=20
-generally speaking it does this only to the extent that it is to the =
-advantage of the system to do it. It is the=20
-needs of the system that are paramount, not those of the human being. For =
-example, the system provides=20
-people with food because the system couldn't function if everyone starved; =
-
-it attends to people's psychological needs whenever it can CONVENIENTLY do =
-so, because it couldn't=20
-function if too many people be came depressed or rebellious. But the system =
-, for good, solid, practical=20
-reasons, must exert constant pressure on people to mold their behavior to =
-the needs of the system. Too=20
-much waste accumulating? The government, the media, the educational system, =
-environmentalists,=20
-everyone inundates us with a mass of propaganda about recycling. Need mo re =
-technical personnel? A=20
-chorus of voices exhorts kids to study science. No one stops to ask whether =
-it is inhumane to force=20
-adolescents to spend the bulk of their time studying subjects most of them =
-hate. When skilled workers are=20
-put out of a job by tec hnical advances and have to undergo "retrain ing," =
-no one asks=20
-whether it is humiliating for them to be pushed around in this way. It is =
-simply taken for granted that=20
-everyone must bow to technical necessity and for good reason: If human =
-needs were put before technical=20
-necessity there would be econo mic problems, unemployment, shortages or wor =
-se. The concept of "mental=20
-health" in our society is defined largely by the extent to which an =
-individual behaves in accord with the=20
-needs of the system and does so without showing signs of stress.=20
-
-120. Efforts to make room for a sense of purpose and for autonomy within =
-the system are no better than a=20
-joke. For example, one company, instead of having each of its employees =
-assemble only one section of a=20
-catalogue, had each assemble a whole catalog ue, and this was supposed to =
-give them a sen se of purpose=20
-and achievement. Some companies have tried to give their employees more =
-autonomy in their work, but for=20
-practical reasons this usually can be done only to a very limited extent, =
-and in any case employees are=20
-never given autonomy as to ultima te goals -- their "autonomous" efforts =
-can n ever be directed toward=20
-goals that they select personally, but only toward their employer's goals, =
-such as the survival and growth of=20
-the company. Any company would=20
-soon go out of business if it permitted its employees to act otherwise. =
-Similarly, in any enterprise within a=20
-socialist system, worker s must direct their efforts toward the goals of =
-the enterprise, otherwise the=20
-enterprise will not serve its purpose as part of the system. Once again, =
-for purely technical reasons it is not=20
-possible for most individuals or small groups to have much autono my in =
-industrial society. Even the=20
-small-bus iness owner commonly has only limited autonomy. Apart from the =
-necessity of government=20
-regulation, he is restricted by the fact that he must fit into the economic =
-system and conform to its=20
-requirements. For instance, when someone develops a new technology , the =
-small-business person often=20
-has to use that technology whether he wants to or not, in order to remain =
-competitive.=20
-
-
-
-THE 'BAD' PARTS OF TECHNOLOGY CANNOT BE SEPARATED FROM THE 'GOOD' =
-PARTS
-
-
-
-121. A further reason why industrial society cannot be reformed in favor of =
-freedom is that modern=20
-technology is a unified system in which all parts are dependent on one =
-another. You can't get rid of the=20
-"bad" parts of technology and retain only the "g ood" parts. Take modern =
-medicine, for exampl e. Progress=20
-in medical science depends on progress in chemistry, physics, biology, =
-computer science and other fields.=20
-Advanced medical treatments require expensive, high-tech equipment that can =
-be made available only by a=20
-technologically progressive, econ omically rich society. Clearly you can't =
-hav e much progress in medicine=20
-without the whole technological system and everything that goes with it. =
-
-
-122. Even if medical progress could be maintained without the rest of the =
-technological system, it would by=20
-itself bring certain evils. Suppose for example that a cure for diabetes is =
-discovered. People with a genetic=20
-tendency to diabetes will then be able to survive and reproduce as well as =
-an yone else. Natural selection=20
-against genes for diabetes will cease and such genes will spread throughout =
-the population. (This may be=20
-occurring to some extent already, since diabetes, while not curable, can be =
-controlled through the use of=20
-insulin.) The s ame thing will happen with many other diseas es =
-susceptibility to which is affected by=20
-genetic degradation of the population. The only solution will be some sort =
-of eugenics program or=20
-extensive genetic engineering of human beings,=20
-so that man in the future will no longer be a creation of nature, or of =
-chance, or of God (depending on your=20
-rel igious or philosophical opinions), but a manufactured product.=20
-
-123. If you think that big government interferes in your life too much NOW, =
-just wait till the government=20
-starts regulating the genetic constitution of your children. Such =
-regulation will inevitably follow the=20
-introduction of genetic engineering of hum an beings, because the =
-consequences of unreg ulated genetic=20
-engineering would be disastrous. [19]=20
-
-124. The usual response to such concerns is to talk about "medical ethics." =
-But a code of ethics would not=20
-serve to protect freedom in the face of medical progress; it would only =
-make matters worse. A code of=20
-ethics applicable to genetic engineering wo uld be in effect a means of =
-regulating the g enetic constitution=20
-of human beings. Somebody (probably the upper-middle class, mostly) would =
-decide that such and such=20
-applications of genetic engineering were "ethical" and others were not, so =
-that in effect they would be=20
-imposing their own values on th e genetic constitution of the population at =
-large. Even if a code of ethics=20
-were chosen on a completely democratic basis, the majority would be =
-imposing their own values on any=20
-minorities who might have a=20
-different idea of what constituted an "ethical" use of genetic engineering. =
-The only code of e thics that=20
-would truly protect freedom would be one that prohibited ANY genetic =
-engineering of human beings, and=20
-you can be sure that no such code will ever be applied in a technological =
-society. No code that reduced=20
-genetic engineering to a minor role could stand up for long, because the =
-temptatio n presented by the=20
-immense power of biotechn ology would be irresistible, especially since to =
-the majority of people many of=20
-its applications will seem obviously and unequivocally good (eliminating =
-physical and mental diseases,=20
-giving people the abilities they need to get along in today's world). In =
-evitably, genetic engineering will be=20
-used e xtensively, but only in ways consistent with the needs of the =
-industrial-technological system. [20]=20
-
-TECHNOLOGY IS A MORE POWERFUL SOCIAL FORCE THAN THE ASPIRATION FOR=20
-FREEDOM
-
-125. It is not possible to make a LASTING compromise between technology and =
-freedom, because=20
-technology is by far the more powerful social force and continually =
-encroaches on freedom through=20
-REPEATED compromises. Imagine the case of two neighbors, each of whom at =
-the outset owns the same=20
-amount of land, but one of whom is more powerful than the other. The =
-powerful one demands a piece of=20
-the other's land. The weak one refuses. The powerful one says, "OK, let's =
-compromise. Give me half of=20
-what I asked." The weak one has little choice but to give in. Some time =
-later the powerful neighbor demand=20
-s another piece of land, again there is a compromise, and so forth. By =
-forcing a long series of compromises=20
-on the weaker man, the powerful one eventually gets all of his land. So it =
-goes in the conflict between=20
-technology and freedom.=20
-
-126. Let us explain why technology is a more powerful social force than the =
-aspiration for freedom.=20
-
-127. A technological advance that appears not to threaten freedom often =
-turns out to threaten freedom often=20
-turns out to threaten it very seriously later on. For example, consider =
-motorized transport. A walking man=20
-formerly could go where he pleased, g o at his own pace without observing =
-any traf fic regulations, and=20
-was independent of technological support-systems. When motor vehicles were =
-introduced they appeared to=20
-increase man's freedom. They took no freedom away from the walking man, no =
-one had to have an=20
-automobile if he didn't want one, and anyone who did choose to buy an =
-automobile could travel much=20
-faster than the walking man. But the introduction of motorized transport =
-soon changed society in such a=20
-way as to restrict greatly man's freedom of locomotion. When automobiles =
-became numerous,=20
-it became necessary to regulate their use e xtensively. In a car, =
-especially in densely populated areas, one=20
-cannot just go where one likes at one's own pace one's movement is governed =
-by the flow of traffic and by=20
-various traffic laws. One is tied down by various obligations: license =
-requirements, driver test, renewing=20
-registration, insuran ce, maintenance required for safety, monthly payments =
-on purchase price. Moreover,=20
-the use of motorized transport is no longer optional. Since the =
-introduction of motorized transport the=20
-arrangement of our cities has changed in such a way that the majority of =
-people no longer live within=20
-walking di stance of their place of employment, shoppin g areas and =
-recreational opportunities, so that they=20
-HAVE TO depend on the automobile for transportation.=20
-Or else they must use public transportation, in which case they have even =
-less control over their own=20
-movement than when driving a car. Even the wal ker's freedom is now greatly =
-restricted. In the city he=20
-continually has to stop and wait for traffic lights that are designed =
-mainly to serve auto traffic. In the=20
-country, motor traffic makes it dangerous and unpleasant to walk along the =
-highway. (Note the important=20
-point we have illustrated with t he case of motorized transport: When a new =
-i tem of technology is=20
-introduced as an option that an individual can accept or not as he chooses, =
-it does not necessarily REMAIN=20
-optional. In many cases the new technology changes society in such a way =
-that people eventually find=20
-themselves FORCED to use i t.)=20
-
-128. While technological progress AS A WHOLE continually narrows our sphere =
-of freedom, each new=20
-technical advance CONSIDERED BY ITSELF appears to be desirable. =
-Electricity, indoor plumbing, rapid=20
-long-distance communications . . . how could one argue against any of these =
-things, or against any other of=20
-the innumerable technical advances that have made modern society? It would =
-have been absurd to resist the=20
-introduction of the telephone, for example. It offered many advantages and =
-no disadvantages. Yet as we=20
-explained in paragraphs 59-76, all th ese technical advances taken together =
-have c reated world in which=20
-the average man's fate is no longer in his own hands or in the hands of his =
-neighbors and friends, but in=20
-those of politicians, corporation executives and remote, anonymous =
-technicians=20
-and bureaucrats whom he as an individual has no power to influence. [21] =
-The same process wi ll continue=20
-in the future. Take genetic engineering, for example. Few people will =
-resist the introduction of a genetic=20
-technique that eliminates a hereditary disease It does no apparent harm and =
-prevents much suffering. Yet a=20
-large number of genetic impr ovements taken together will make the human =
-being into an engineered=20
-product rather than a free creation of chance (or of God, or whatever, =
-depending on your religious beliefs).=20
-
-129 Another reason why technology is such a powerful social force is that, =
-within the context of a given=20
-society, technological progress marches in only one direction; it can never =
-be reversed. Once a technical=20
-innovation has been introduced, people us ually become dependent on it, =
-unless it is r eplaced by some still=20
-more advanced innovation. Not only do people become dependent as =
-individuals on a new item of=20
-technology, but, even more, the system as a whole becomes dependent on it. =
-(Imagine what would happen=20
-to the system today if computers, for example, were eliminated.) Thus the =
-system can move in only one=20
-direction, toward greater technologization. Technology repeatedly forces =
-freedom to take a step back --=20
-short of the overthrow of the whole technological system.=20
-
-130. Technology advances with great rapidity and threatens freedom at many =
-different points at the same=20
-time (crowding, rules and regulations, increasing dependence of individuals =
-on large organizations,=20
-propaganda and other psychological techniques, g enetic engineering, =
-invasion of privacy thro ugh=20
-surveillance devices and computers, etc.) To hold back any ONE of the =
-threats to freedom would require a=20
-long different social struggle. Those who want to protect freedom are =
-overwhelmed by the sheer number of=20
-new attacks and the rapidity with which t hey develop, hence they become =
-pathetic and no longer resist. To=20
-fight each of the threats separately would be futile. Success can be hoped =
-for only by fighting the=20
-technological system as a whole; but that is revolution not reform. =
-
-
-131. Technicians (we use this term in its broad sense to describe all those =
-who perform a specialized task=20
-that requires training) tend to be so involved in their work (their =
-surrogate activity) that when a conflict=20
-arises between their technical work and freedom, they almost always decide =
-in fa vor of their technical=20
-work. This is obvious in the case of scientists, but it also appears =
-elsewhere: Educators, humanitarian=20
-groups, conservation organizations do not hesitate to use propaganda or =
-other psychological techniques to=20
-help them achieve thei r laudable ends. Corporations and government =
-agencies, when they find it useful, do=20
-not hesitate to collect information about individuals without regard to =
-their privacy. Law enforcement=20
-agencies are=20
-frequently inconvenienced by the constitutional rights of suspects and =
-often of completely innocent=20
-persons, and they do whatever they can do l egally (or sometimes illegally) =
-to restrict or circumvent those=20
-rights. Most of these educators, government officials and law officers =
-believe in freedom, privacy and=20
-constitutional rights, but when these conflict with their work, they =
-usually feel that t heir work is more=20
-important.=20
-
-132. It is well known that people generally work better and more =
-persistently when striving for a reward=20
-than when attempting to avoid a punishment or negative outcome. Scientists =
-and other technicians are=20
-motivated mainly by the rewards they get throu gh their work. But those who =
-oppose technilo giccal=20
-invasions of freedom are working to avoid a negative outcome, consequently =
-there are a few who work=20
-persistently and well at this discouraging task. If reformers ever achieved =
-a signal victory that seemed to set=20
-up a solid barrier against further e rosion of freedom through =
-technological prog ress, most would tend to=20
-relax and turn their attention to more agreeable pursuits. But the =
-scientists would remain busy in their=20
-laboratories, and technology as it progresses would find ways,=20
-in spite of any barriers, to exert more and more control over individuals =
-and make them always more=20
-depend ent on the system.=20
-
-133. No social arrangements, whether laws, institutions, customs or ethical =
-codes, can provide permanent=20
-protection against technology. History shows that all social arrangements =
-are transitory; they all change or=20
-break down eventually. But technologic al advances are permanent within the =
-context of a given=20
-civilization. Suppose for example that it were possible to arrive at some =
-social arrangements that would=20
-prevent genetic engineering from being applied to human beings, or prevent =
-it from being applied in such a=20
-ways as to threaten freedom and dignity. Still, the technology would remain =
-waiting. Sooner or later the=20
-social arrangement would break down. Probably sooner, given that pace of =
-change in our society. Then=20
-genetic engineering would begin to invade our=20
-sphere of freedom, and this invasion would be irreversible (short of a =
-breakdo wn of technological=20
-civilization itself). An y illusions about achieving anything permanent =
-through social arrangements should=20
-be dispelled by what is currently happening with environmental legislation. =
-A few years ago it seemed that=20
-there were secure legal barriers preventing at least SOME of the w orst =
-forms of environmental=20
-degradation. A c hange in the political wind, and those barriers begin to =
-crumble.=20
-
-134. For all of the foregoing reasons, technology is a more powerful social =
-force than the aspiration for=20
-freedom. But this statement requires an important qualification. It appears =
-that during the next several=20
-decades the industrial-technological syst em will be undergoing severe =
-stresses due to economic and=20
-environmental problems, and especially due to problems of human behavior =
-(alienation, rebellion, hostility,=20
-a variety of social and psychological difficulties). We hope that the =
-stresses through which the system is=20
-likely to pass will cause it to break down, or at least weaken it suff =
-iciently so that a revolution occurs and=20
-is successful, then at that particular moment the aspiration for freedom =
-will have proved more powerful=20
-than technology.=20
-
-135. In paragraph 125 we used an analogy of a weak neighbor who is left =
-destitute by a strong neighbor=20
-who takes all his land by forcing on him a series of compromises. But =
-suppose now that the strong=20
-neighbor gets sick, so that he is unable to defend himself. The weak =
-neighbor can force the str ong one to=20
-give him his land back, or he can kill him. If he lets the strong man =
-survive and only forces him to give his=20
-land back, he is a fool, because when the strong man gets well he will =
-again take all the land for himself.=20
-The only sensible alternat ive for the weaker man is to kill the strong one =
-while he has the chance. In the=20
-same way, while the industrial system is sick we must destroy it. If we =
-compromise with it and let it=20
-recover from its sickness, it will eventually wipe out all of our freedom. =
-
-
-SIMPLER SOCIAL PROBLEMS HAVE PROVED INTRACTABLE
-
-136. If anyone still imagines that it would be possible to reform the =
-system in such a way as to protect=20
-freedom from technology, let him consider how clumsily and for the most =
-part unsuccessfully our society=20
-has dealt with other social problems that a re far more simple and =
-straightforward. Amon g other things, the=20
-system has failed to stop environmental degradation, political corruption, =
-drug trafficking or domestic=20
-abuse.=20
-
-137. Take our environmental problems, for example. Here the conflict of =
-values is straightforward:=20
-economic expedience now versus saving some of our natural resources for our =
-grandchildren [22] But on=20
-this subject we get only a lot of blather and obfus cation from the people =
-who have power, and n othing=20
-like a clear, consistent line of action, and we keep on piling up =
-environmental problems that our=20
-grandchildren will have to live with. Attempts to resolve the environmental =
-issue consist of struggles and=20
-compromises between different factions, som e of which are ascendant at one =
-moment, othe rs at another=20
-moment. The line of struggle changes with the shifting currents of public =
-opinion. This is not a rational=20
-process, or is it one that is likely to lead to a timely and successful =
-solution to the problem.=20
-Major social problems, if they get "so lved" at all, are rarely or never =
-solved thr ough any rational,=20
-comprehensive plan. They just work themselves out through a process in =
-which various competing groups=20
-pursing their own usually short-term) self-interest [23] arrive (mainly by =
-luck) at some more or less stable=20
-modus vivendi. In fact, t he principles we formulated in paragraphs 10 =
-0-106 make it seem doubtful that=20
-rational, long-term social planning can EVER be successful. 138. Thus it is =
-clear that the human race has at=20
-best a very limited capacity for solving even relatively straightforward =
-social problems. How then is it=20
-going to solve the far more difficult and subtle problem of reconciling =
-freedom with technology?=20
-Technology presents clear-cut material advantages,=20
-whereas freedom is an abstraction that means different things to different =
-people, and its loss is easily=20
-obscured by propaganda and fancy talk.=20
-
-139. And note this important difference: It is conceivable that our =
-environmental problems (for example)=20
-may some day be settled through a rational, comprehensive plan, but if this =
-happens it will be only because=20
-it is in the long-term interest of the system to solve these problems. But =
-it is NOT in the interest of the=20
-system to preserve freedom or small-group autonomy. On the contrary, it is =
-in the interest of the system to=20
-bring human behavior under control to the greatest possible extent. Thus, =
-while practical considerations=20
-may eventually force the system to take a rational, prudent approach to =
-environmental problems, equally=20
-practical considerations will force the system to regulate human behavior =
-ever more closely (preferably by=20
-indirect means that will disguise the encroachment on freedom.)=20
-This isn't just our opinion. Eminent social scientists (e.g. James Q. =
-Wilson) have stressed the importance of=20
-"socializing" people more effectively.
-
-
-
-REVOLUTION IS EASIER THAN REFORM
-
-140. We hope we have convinced the reader that the system cannot be =
-reformed in a such a way as to=20
-reconcile freedom with technology. The only way out is to dispense with the =
-industrial-technological=20
-system altogether. This implies revolution, not necessarily an armed =
-uprising, but certainly a radical and=20
-fundamental change in the nature of society.=20
-
-141. People tend to assume that because a revolution involves a much =
-greater change than reform does, it is=20
-more difficult to bring about than reform is. Actually, under certain =
-circumstances revolution is much=20
-easier than reform. The reason is that a revolutionary movement can inspire =
-an intensity of commitment=20
-that a reform movement cannot inspire. A reform movement merely offers to =
-solve a particular social=20
-problem A revolutionary movement offers to solve all problems at one stroke =
-and create a whole new=20
-world; it provides the kind of ideal for which people will take great risks =
-and make great sacrifices. For this=20
-reasons it would be much easier to overthrow the whole technological system =
-than to put effective,=20
-permanent restraints on the development of application of any one segment =
-of technology, s
-uch as genetic engineering, but under suitable conditions large numbers of =
-people may devote themselves=20
-passionately=20
-to a revolution against the industrial-technological system. As we noted in =
-paragraph 132, reformers=20
-seeking to limite certain aspects of technology would be working to avoid a =
-negative outcome. But=20
-revolutionaries work to gain a powerful reward -- fulfillment of their =
-revolutionary vision -- and therefore=20
-work harder and more persistently than reformers do.=20
-
-142. Reform is always restrainde by the fear of painful consequences if =
-changes go too far. But once a=20
-revolutionary fever has taken hold of a society, people are willing to =
-undergo unlimited hardships for the=20
-sake of their revolution. This was clearly shown in the French and Russian =
-Revolutions. It may be that in=20
-such cases only a minority of the population is really committed to the =
-revolution, but this minority is=20
-sufficiently large and active so that it becomes the dominant force in =
-society. We will have more to say=20
-about revolution in paragraphs 180-205.=20
-
-
-
-CONTROL OF HUMAN BEHAVIOR
-
-143. Since the beginning of civilization, organized societies have had to =
-put pressures on human beings of=20
-the sake of the functioning of the social organism. The kinds of pressures =
-vary greatly from one society to=20
-another. Some of the pressures are physical (poor diet, excessive labor, =
-environmental pollution), some are=20
-psychological (noise, crowding, forcing humans behavior into the mold that =
-society requires). In the past,=20
-human nature has been approximately constant, or at any rate has varied =
-only within certain bounds.=20
-Consequently, societies have been able to push people only up to certain =
-limits. When the limit of human=20
-endurance has been passed, things start going rong: rebellion, or crime, or =
-corruption, or evasion of work,=20
-or depression and other mental problems,=20
-or an elevated death rate, or a declining birth rate or something else, so =
-that either the society breaks down,=20
-or its functioning becomes too inefficient and it is (quickly or gradually, =
-through conquest, attrition or=20
-evolution) replaces by some more efficient form of society.
-
-[25]=20
-
-144. Thus human nature has in the past put certain limits on the =
-development of societies. People coud be=20
-pushed only so far and no farther. But today this may be changing, because =
-modern technology is=20
-developing way of modifying human beings.
-
-145. Imagine a society that subjects people to conditions that amke them =
-terribley unhappy, then gives=20
-them the drugs to take away their unhappiness. Science fiction? It is =
-already happening to some extent in=20
-our own society. It is well known that the rate of clinical depression had =
-been greatly increasing in recent=20
-decades. We believe that this is due to disruption fo the power process, as =
-explained in paragraphs 59-76.=20
-But even if we are wrong, the increasing rate of depression is certainly =
-the result of SOME conditions that=20
-exist in today's society. Instead of removing the conditions that make =
-people depressed, modern society=20
-gives them antidepressant drugs. In effect, antidepressants area a means of =
-modifying an individual's=20
-internal state in such a way as to=20
-enable him to toelrate social conditions that he would otherwise find =
-intolerable. (Yes, we know that=20
-depression is often of purely genetic origin. We are referring here to =
-those cases in which environment=20
-plays the predominant role.)=20
-
-146. Drugs that affect the mind are only one example of the methods of =
-controlling human behavior that=20
-modern society is developing. Let us look at some of the other methods. =
-
-
-147. To start with, there are the techniques of surveillance. Hidden video =
-cameras are now used in most=20
-stores and in many other places, computers are used to collect and process =
-vast amounts of information=20
-about individuals. Information so obtained greatly increases the =
-effectiveness of physical coercion (i.e., law=20
-enforcement).[26] Then there are the methods of propaganda, for which the =
-mass communication media=20
-provide effective vehicles. Efficient techniques have been developed for =
-winning elections, selling=20
-products, influencing public opinion. The entertainment industry serves as =
-an important psychological tool=20
-of the system, possibly even when it is dishing out large amounts of sex =
-and violence. Entertainment=20
-provides modern man with an essential means of escape.=20
-While absorbed in television, videos, etc., he can forget stress, anxiety, =
-frustration, dissatisfaction. Many=20
-primitive peoples, when they don't have work to do, are quite content to =
-sit for hours at a time doing=20
-nothing at all, because they are at peace with themselves and their world. =
-But most modern people must be=20
-contantly occupied or entertained, otherwise the get "bored," i.e., they =
-get fidgety, uneasy, irritable.=20
-
-148. Other techniques strike deeper that the foregoing. Education is no =
-longer a simple affair of paddling a=20
-kid's behind when he doesn't know his lessons and patting him on the head =
-when he does know them. It is=20
-becoming a scientific technique for controlling the child's development. =
-Sylvan Learning Centers, for=20
-example, have had great success in motivating children to study, and =
-psychological techniques are also=20
-used with more or less success in many conventional schools. "Parenting" =
-techniques that are taught to=20
-parents are designed to make children accept fundamental values of the =
-system and behave in ways that the=20
-system finds desirable. "Mental health" programs, "intervention" =
-techniques, psychotherapy and so forth=20
-are ostensibly designed to benefit individuals,=20
-but in practice they usually serve as methods for inducing individuals to =
-think and behave as the system=20
-requires. (There is no contradiction here; an individual whose attitudes or =
-behavior bring him into conflict=20
-with the system is up against a force that is too powerful for him to =
-conquer or escape from, hence he is=20
-likely to suffer from stress, frustration, defeat. His path will be much =
-easier if he thinks and behaves as the=20
-system requires. In that sense the system is acting for the benefit of the =
-individual when it brainwashes him=20
-into conformity.) Child abuse in its gross and obvious forms is disapproved =
-in most if not all cultures.=20
-Tormenting a child for a trivial reason or no reason at all is something =
-that appalls almost everyone.=20
-But many psychologists interpret the concept of abuse much more broadly. Is =
-spanking, when used as part=20
-of a rational and consistent system of discipline, a form of abuse? The =
-question will ultimately be decided=20
-by whether or not spanking tends to produce behavior that makes a person =
-fit in well with the existing=20
-system of society. In practice, the word "abuse" tends to be interpreted to =
-include any method of child-
-rearing that produces behavior inconvenient for the system. Thus, when they =
-go beyond the prevention of=20
-obvious, senseless cruelty, programs for preventing "child abuse" are =
-directed toward the control of human=20
-behavior of the system.=20
-
-149. Presumably, research will continue to increas the effectiveness of =
-psychological techniques for=20
-controlling human behavior. But we think it is unlikely that psychological =
-techniques alone will be=20
-sufficient to adjust human beings to the kind of society that technology is =
-creating. Biological methods=20
-probably will have to be used. We have already mentiond the use of drugs in =
-this connection. Neurology=20
-may provide other avenues of modifying the human mind. Genetic engineering =
-of human beings is already=20
-beginning to occur in the form of "gene therapy," and there is no reason to =
-assume the such methods will=20
-not eventually be used to modify those aspects of the body that affect =
-mental funtioning.=20
-
-150. As we mentioned in paragraph 134, industrial society seems likely to =
-be entering a period of severe=20
-stress, due in part to problems of human behavior and in part to economic =
-and environmental problems.=20
-And a considerable proportion of the system's economic and environmental =
-problems result from the way=20
-human beings behave. Alienation, low self-esteem, depression, hostility, =
-rebellion; children who won't=20
-study, youth gangs, illegal drug use, rape, child abuse , other crimes, =
-unsafe sex, teen pregnancy,=20
-population growth, political corruption, race hatred, ethnic rivalry, =
-bitter ideological conflict (i.e., pro-
-choice vs. pro-life), political extremism, terrorism, sabotage, =
-anti-government groups, hate groups. All=20
-these threaten the very survival of the system.=20
-The system will be FORCED to use every practical means of controlling human =
-behavior.=20
-
-151. The social disruption that we see today is certainly not the result of =
-mere chance. It can only be a=20
-result fo the conditions of life that the system imposes on people. (We =
-have argued that the most important=20
-of these conditions is disruption of the power process.) If the systems =
-succeeds in imposing sufficient=20
-control over human behavior to assure itw own survival, a new watershed in =
-human history will have=20
-passed. Whereas formerly the limits of human endurance have imposed limits =
-on the development of=20
-societies (as we explained in paragraphs 143, 144), =
-industrial-technological society will be able to pass=20
-those limits by modifying human beings, whether by psychological methods or =
-biological methods or both.=20
-In the future, social systems will not be adjusted to suit the needs of =
-human beings.=20
-Instead, human being will be adjusted to suit the needs of the =
-system.
-
-[27] 152. Generally speaking, technological control over human behavior =
-will probably not be introduced=20
-with a totalitarian intention or even through a conscious desire to =
-restrict human freedom. [28] Each new=20
-step in the assertion of control over the human mind will be taken as a =
-rational response to a problem that=20
-faces society, such as curing alcoholism, reducing the crime rate or =
-inducing young people to study science=20
-and engineering. In many cases, there will be humanitarian justification. =
-For example, when a psychiatrist=20
-prescribes an anti-depressant for a depressed patient, he is clearly doing =
-that individual a favor. It would be=20
-inhumane to withhold the drug from someone who needs it. When parents send =
-their children to Sylvan=20
-Learning Centers to have them manipulated into becoming enthusiastic about =
-their studies,=20
-they do so from concern for their children's welfare. It may be that some =
-of these parents wish that one=20
-didn't have to have specialized training to get a job and that their kid =
-didn't have to be brainwashed into=20
-becoming a computer nerd. But what can they do? They can't change society, =
-and their child may be=20
-unemployable if he doesn't have certain skills. So they send him to Sylvan. =
-
-
-153. Thus control over human behavior will be introduced not by a =
-calculated decision of the authorities=20
-but through a process of social evolution (RAPID evolution, however). The =
-process will be impossible to=20
-resist, because each advance, considered by itself, will appear to be =
-beneficial, or at least the evil involved=20
-in making the advance will appear to be beneficial, or at least the evil =
-involved in making the advance will=20
-seem to be less than that which would result from not making it (see =
-paragraph 127). Propaganda for=20
-example is used for many good purposes, such as discouraging child abuse or =
-race hatred. [14] Sex=20
-education is obviously useful, yet the effect of sex education (to the =
-extent that it is successful) is to take=20
-the shaping of sexual attitudes=20
-away from the family and put it into the hands of the state as represented =
-by the public school system.=20
-
-154. Suppose a biological trait is discovered that increases the likelihood =
-that a child will grow up to be a=20
-criminal and suppose some sort of gene therapy can remove this trait. [29] =
-Of course most parents whose=20
-children possess the trait will have them undergo the therapy. It would be =
-inhumane to do otherwise, since=20
-the child would probably have a miserable life if he grew up to be a =
-criminal. But many or most primitive=20
-societies have a low crime rate in comparison with that of our society, =
-even though they have neither high-
-tech methods of child-rearing nor harsh systems of punishment. Since there =
-is no reason to suppose that=20
-more modern men than primitive men have innate predatory tendencies, the =
-high crime rate of our society=20
-must be due to the pressures that modern conditions put on people,=20
-to which many cannot or will not adjust. Thus a treatment designed to =
-remove potential criminal tendencies=20
-is at least in part a way of re-engineering people so that they suit the =
-requirements of the system.=20
-
-155. Our society tends to regard as a "sickness" any mode of thought or =
-behavior that is inconvenient for=20
-the system, and this is plausible because when an individual doesn't fit =
-into the system it causes pain to the=20
-individual as well as problems for the system. Thus the manipulation of an =
-individual to adjust him to the=20
-system is seen as a "cure" for a "sickness" and therefore as good.=20
-
-156. In paragraph 127 we pointed out that if the use of a new item of =
-technology is INITIALLY optional, it=20
-does not necessarily REMAIN optional, because the new technology tends to =
-change society in such a way=20
-that it becomes difficult or impossible for an individual to function =
-without using that technology. This=20
-applies also to the technology of human behavior. In a world in which most =
-children are put through a=20
-program to make them enthusiastic about studying, a parent will almost be =
-forced to put his kid through=20
-such a program, because if he does not, then the kid will grow up to be, =
-comparatively speaking, an=20
-ignoramus and therefore unemployable. Or suppose a biological treatment is =
-discovered that, without=20
-undesirable side-effects,=20
-will greatly reduce the psychological stress from which so many people =
-suffer in our society. If large=20
-numbers of people choose to undergo the treatment, then the general level =
-of stress in society will be=20
-reduced, so that it will be possible for the system to increase the =
-stress-producing pressures. In fact,=20
-something like this seems to have happened already with one of our =
-society's most important psychological=20
-tools for enabling people to reduce (or at least temporarily escape from) =
-stress, namely, mass entertainment=20
-(see paragraph 147). Our use of mass entertainment is "optional": No law =
-requires us to watch television,=20
-listen to the radio, read magazines. Yet mass entertainment is a means of =
-escape and stress-reduction on=20
-which most of us have become dependent.=20
-Everyone complains about the trashiness of television, but almost everyone =
-watches it. A few have kicked=20
-the TV habit, but it would be a rare person who could get along today =
-without using ANY form of mass=20
-entertainment. (Yet until quite recently in human history most people got =
-along very nicely with no other=20
-entertainment than that which each local community created for itself.) =
-Without the entertainment industry=20
-the system probably would not have been able to get away with putting as =
-much stress-producing pressure=20
-on us as it does.=20
-
-157. Assuming that industrial society survives, it is likely that =
-technology will eventually acquire=20
-something approaching complete control over human behavior. It has been =
-established beyond any rational=20
-doubt that human thought and behavior have a largely biological basis. As =
-experimenters have=20
-demonstrated, feelings such as hunger, pleasure, anger and fear can be =
-turned on and off by electrical=20
-stimulation of appropriate parts of the brain. Memories can be destroyed by =
-damaging parts of the brain or=20
-they can be brought to the surface by electrical stimulation. =
-Hallucinations can be induced or moods=20
-changed by drugs. There may or may not be an immaterial human soul, but if =
-there is one it clearly is less=20
-powerful that the biological mechanisms of human behavior.=20
-For if that were not the case then researchers would not be able so easily =
-to manipulate human feelings and=20
-behavior with drugs and electrical currents.=20
-
-158. It presumably would be impractical for all people to have electrodes =
-inserted in their heads so that=20
-they could be controlled by the authorities. But the fact that human =
-thoughts and feelings are so open to=20
-biological intervention shows that the problem of controlling human =
-behavior is mainly a technical=20
-problem; a problem of neurons, hormones and complex molecules; the kind of =
-problem that is accessible to=20
-scientific attack. Given the outstanding record of our society in solving =
-technical problems, it is=20
-overwhelmingly probable that great advances will be made in the control of =
-human behavior.=20
-
-159. Will public resistance prevent the introduction of technological =
-control of human behavior? It=20
-certainly would if an attempt were made to introduce such control all at =
-once. But since technological=20
-control will be introduced through a long sequence of small advances, there =
-will be no rational and=20
-effective public resistance. (See paragraphs 127,132, 153.)=20
-
-160. To those who think that all this sounds like science fiction, we point =
-out that yesterday's science=20
-fiction is today's fact. The Industrial Revolution has radically altered =
-man's environment and way of life,=20
-and it is only to be expected that as technology is increasingly applied to =
-the human body and mind, man=20
-himself will be altered as radically as his environment and way of life =
-have been.=20
-
-
-
-HUMAN RACE AT A CROSSROADS
-
-161. But we have gotten ahead of our story. It is one thing to develop in =
-the laboratory a series of=20
-psychological or biological techniques for manipulating human behavior and =
-quite another to integrate=20
-these techniques into a functioning social system. The latter problem is =
-the more difficult of the two. For=20
-example, while the techniques of educational psychology doubtless work =
-quite well in the "lab schools"=20
-where they are developed, it is not necessarily easy to apply them =
-effectively throughout our educational=20
-system. We all know what many of our schools are like. The teachers are too =
-busy taking knives and guns=20
-away from the kids to subject them to the latest techniques for making them =
-into computer nerds. Thus, in=20
-spite of all its technical advances relating=20
-to human behavior the system to date has not been impressively successful =
-in controlling human beings.=20
-The people whose behavior is fairly well under the control of the system =
-are those of the type that might be=20
-called "bourgeois." But there are growing numbers of people who in one way =
-or another are rebels against=20
-the system: welfare leaches, youth gangs cultists, satanists, nazis, =
-radical environmentalists, militiamen,=20
-etc..=20
-
-162. The system is currently engaged in a desperate struggle to overcome =
-certain problems that threaten its=20
-survival, among which the problems of human behavior are the most =
-important. If the system succeeds in=20
-acquiring sufficient control over human behavior quickly enough, it will =
-probably survive. Otherwise it=20
-will break down. We think the issue will most likely be resolved within the =
-next several decades, say 40 to=20
-100 years.=20
-
-163. Suppose the system survives the crisis of the next several decades. By =
-that time it will have to have=20
-solved, or at least brought under control, the principal problems that =
-confront it, in particular that of=20
-"socializing" human beings; that is, making people sufficiently docile so =
-that their behavior no longer=20
-threatens the system. That being accomplished, it does not appear that =
-there would be any further obstacle=20
-to the development of technology, and it would presumably advance toward =
-its logical conclusion, which is=20
-complete control over everything on Earth, including human beings and all =
-other important organisms. The=20
-system may become a unitary, monolithic organization, or it may be more or =
-less fragmented and consist of=20
-a number of organizations coexisting=20
-in a relationship that includes elements of both cooperation and =
-competition, just as today the government,=20
-the corporations and other large organizations both cooperate and compete =
-with one another. Human=20
-freedom mostly will have vanished, because individuals and small groups =
-will be impotent vis-a-vis large=20
-organizations armed with supertechnology and an arsenal of advanced =
-psychological and biological tools=20
-for manipulating human beings, besides instruments of surveillance and =
-physical coercion. Only a small=20
-number of people will have any real power, and even these probably will =
-have only very limited freedom,=20
-because their behavior too will be regulated; just as today our politicians =
-and corporation executives can=20
-retain their positions of power only as long=20
-as their behavior remains within certain fairly narrow limits.=20
-
-164. Don't imagine that the systems will stop developing further techniques =
-for controlling human beings=20
-and nature once the crisis of the next few decades is over and increasing =
-control is no longer necessary for=20
-the system's survival. On the contrary, once the hard times are over the =
-system will increase its control over=20
-people and nature more rapidly, because it will no longer be hampered by =
-difficulties of the kind that it is=20
-currently experiencing. Survival is not the principal motive for extending =
-control. As we explained in=20
-paragraphs 87-90, technicians and scientists carry on their work largely as =
-a surrogate activity; that is, they=20
-satisfy their need for power by solving technical problems. They will =
-continue to do this with unabated=20
-enthusiasm,=20
-and among the most interesting and challenging problems for them to solve =
-will be those of understanding=20
-the human body and mind and intervening in their development. For the "good =
-of humanity," of course.=20
-
-165. But suppose on the other hand that the stresses of the coming decades =
-prove to be too much for the=20
-system. If the system breaks down there may be a period of chaos, a "time =
-of troubles" such as those that=20
-history has recorded: at various epochs in the past. It is impossible to =
-predict what would emerge from such=20
-a time of troubles, but at any rate the human race would be given a new =
-chance. The greatest danger is that=20
-industrial society may begin to reconstitute itself within the first few =
-years after the breakdown. Certainly=20
-there will be many people (power-hungry types especially) who will be =
-anxious to get the factories running=20
-again.=20
-
-166. Therefore two tasks confront those who hate the servitude to which the =
-industrial system is reducing=20
-the human race. First, we must work to heighten the social stresses within =
-the system so as to increase the=20
-likelihood that it will break down or be weakened sufficiently so that a =
-revolution against it becomes=20
-possible. Second, it is necessary to develop and propagate an ideology that =
-opposes technology and the=20
-industrial society if and when the system becomes sufficiently weakened. =
-And such an ideology will help=20
-to assure that, if and when industrial society breaks down, its remnants =
-will be smashed beyond repair, so=20
-that the system cannot be reconstituted. The factories should be destroyed, =
-technical books burned, etc.=20
-
-
-
-HUMAN SUFFERING
-
-167. The industrial system will not break down purely as a result of =
-revolutionary action. It will not be=20
-vulnerable to revolutionary attack unless its own internal problems of =
-development lead it into very serious=20
-difficulties. So if the system breaks down it will do so either =
-spontaneously, or through a process that is in=20
-part spontaneous but helped along by revolutionaries. If the breakdown is =
-sudden, many people will die,=20
-since the world's population has become so overblown that it cannot even =
-feed itself any longer without=20
-advanced technology. Even if the breakdown is gradual enough so that =
-reduction of the population can=20
-occur more through lowering of the birth rate than through elevation of the =
-death rate, the process of de-
-industrialization probably will=20
-be very chaotic and involve much suffering. It is naive to think it likely =
-that technology can be phased out=20
-in a smoothly managed orderly way, especially since the technophiles will =
-fight stubbornly at every step. Is=20
-it therefore cruel to work for the breakdown of the system? Maybe, but =
-maybe not. In the first place,=20
-revolutionaries will not be able to break the system down unless it is =
-already in deep trouble so that there=20
-would be a good chance of its eventually breaking down by itself anyway; =
-and the bigger the system=20
-grows, the more disastrous the consequences of its breakdown will be; so it =
-may be that revolutionaries, by=20
-hastening the onset of the breakdown will be reducing the extent of the =
-disaster.=20
-
-168. In the second place, one has to balance the struggle and death against =
-the loss of freedom and dignity.=20
-To many of us, freedom and dignity are more important than a long life or =
-avoidance of physical pain.=20
-Besides, we all have to die some time, and it may be better to die fighting =
-for survival, or for a cause, than=20
-to live a long but empty and purposeless life.=20
-
-169. In the third place, it is not all certain that the survival of the =
-system will lead to less suffering than the=20
-breakdown of the system would. The system has already caused, and is =
-continuing to cause , immense=20
-suffering all over the world. Ancient cultures, that for hundreds of years =
-gave p eople a satisfactory=20
-relationship with each other and their environment, have been shattered by =
-contact with industrial society,=20
-and the result has been a whole catalogue of economic, environmental, =
-social and psychological problems.=20
-One of the effects o f the intrusion of industrial society has be en that =
-over much of the world traditional=20
-controls on population have been thrown out of balance. Hence the =
-population explosion, with all that it=20
-implies.=20
-Then there is the psychological suffering that is widespread throughout the =
-supposedly fortunate countries=20
-of the West (see paragraphs 44, 4 5). No one knows what will happen as a =
-result of ozone depletion, the=20
-greenhouse effect and other environmental problems that cannot yet be =
-foreseen. And, as nuclear=20
-proliferation has shown, new technology cannot be kept out of the hands of =
-dictators an d irresponsible=20
-Third World nations. Would you like to speculate abut what Iraq or North =
-Korea will do with genetic=20
-engineering?=20
-
-170. "Oh!" say the technophiles, "Science is going to fix all that! We will =
-conquer famine, eliminate=20
-psychological suffering, make everybody healthy and happy!" Yeah, sure. =
-That's what they said 200 years=20
-ago. The Industrial Revolution was supposed to eliminate poverty, make =
-everybody happy, etc. The actual=20
-result has been quite different. The technophiles are hopelessly naive (or =
-self-deceiving) in their=20
-understanding of social problems. They are unaware of (or choose to ignore) =
-the fact that when large=20
-changes, even seemingly beneficial ones, are introduced into a society, =
-they le ad to a long sequence of=20
-other changes, most of which are impossible to predict (paragraph 103). The =
-result is disruption of the=20
-society. So it is very probable that=20
-in their attempt to end poverty and disease, engineer docile, happy =
-personalities and s o forth, the=20
-technophiles will create socia l systems that are terribly troubled, even =
-more so that the present one. For=20
-example, the scientists boast that they will end famine by creating new, =
-genetically engineered food plants.=20
-But this will allow the human population to keep expanding indefini tely, =
-and it is well known that=20
-crowding lea ds to increased stress and aggression. This is merely one =
-example of the PREDICTABLE=20
-problems that will arise. We emphasize that, as past experience has shown, =
-technical progress will lead to=20
-other new problems for society far more rapidly that it has b een solving =
-old ones. Thus it will take a l ong=20
-difficult period of=20
-trial and error for the technophiles to work the bugs out of their Brave =
-New World (if they ever do). In the=20
-meantime there will be great suffering. So it is not all clear that the =
-survival of industrial society would=20
-involve les s suffering than the breakdown of that socie ty would. =
-Technology has gotten the human race=20
-into a fix from which there is not likely to be any easy escape.=20
-
-
-
-THE FUTURE
-
-171. But suppose now that industrial society does survive the next several =
-decade and that the bugs do=20
-eventually get worked out of the system, so that it functions smoothly. =
-What kind of system will it be? We=20
-will consider several possibilities.=20
-
-172. First let us postulate that the computer scientists succeed in =
-developing intelligent machines that can=20
-do all things better that human beings can do them. In that case presumably =
-all work will be done by vast,=20
-highly organized systems of machines and no human effort will be necessary. =
-Eith er of two cases might=20
-occur. The machines might be permitted to make all of their own decisions =
-without human oversight, or=20
-else human control over the machines might be retained.=20
-
-173. If the machines are permitted to make all their own decisions, we =
-can't make any conjectures as to the=20
-results, because it is impossible to guess how such machines might behave. =
-We only point out that the fate=20
-of the human race would be at the merc y of the machines. It might be =
-argued that the human race would=20
-never be foolish enough to hand over all the power to the machines. But we =
-are suggesting neither that the=20
-human race would voluntarily turn power over to the machines nor that the =
-machines would willfully seize=20
-power. What we do su ggest is that the human race might easily pe rmit =
-itself to drift into a position of such=20
-dependence on the machines that it would have no practical choice but to =
-accept all of the machines=20
-decisions.=20
-As society and the problems that face it become more and more complex and =
-machines become more and=20
-more intelligent, people will let machines make more of their decision for =
-them, simply because machine-
-made decisions will bring better result than man-made ones. Eventually a =
-stage may be reached at which=20
-the decisions necessary to keep the system running will be so complex that =
-human beings wi ll be incapable=20
-of making them intelligently . At that stage the machines will be in =
-effective control. People won't be able=20
-to just turn the machines off, because they will be so dependent on them =
-that turning them off would=20
-amount to suicide.=20
-
-174. On the other hand it is possible that human control over the machines =
-may be retained. In that case the=20
-average man may have control over certain private machines of his own, such =
-as his car of his personal=20
-computer, but control over large systems of machines will be in the hands =
-of a tiny e lite -- just as it is=20
-today, but with two difference. Due to improved techniques the elite will =
-have greater control over the=20
-masses; and because human work will no longer be necessary the masses will =
-be superfluous, a useless=20
-burden on the system. If t he elite is ruthless the may simply decide t o =
-exterminate the mass of humanity.=20
-If they are humane they may use propaganda or other psychological or =
-biological techniques to reduce the=20
-birth rate until=20
-the mass of humanity becomes extinct, leaving the world to the elite. Or, =
-if the elite consist of soft-hearted=20
-liberals, they may decide to play the role of good shepherds to the rest of =
-the human race. They will see to=20
-it that everyone's physical needs are satisfied, that all children are =
-raised under psychologically hygienic=20
-conditions, that everyone has a wholesome hobby to keep him busy , and that =
-anyone who may become=20
-dissatisfie d undergoes "treatment" to cure his "problem." Of course, life =
-will be so purposeless that people=20
-will have to be biologically or psychologically engineered either to remove =
-their need for the power=20
-process or to make them "sublimate" their drive for pow er into some =
-harmless hobby. These engineer ed=20
-human beings=20
-may be happy in such a society, but they most certainly will not be free. =
-They will have been reduced to=20
-the status of domestic animals.=20
-
-175. But suppose now that the computer scientists do not succeed in =
-developing artificial intelligence, so=20
-that human work remains necessary. Even so, machines will take care of more =
-and more of the simpler=20
-tasks so that there will be an increasing surp lus of human workers at the =
-lower levels of ability. (We see=20
-this happening already. There are many people who find it difficult or =
-impossible to get work, because for=20
-intellectual or psychological reasons they cannot acquire the level of =
-training necessary to make themselves=20
-useful in the presen t system.) On those who are employed, ever- increasing =
-demands will be placed; They=20
-will need more and m ore training, more and more ability, and will have to =
-be ever more reliable,=20
-conforming and docile,=20
-because they will be more and more like cells of a giant organism. Their =
-tasks will be incre asingly=20
-specialized so that their work will be, in a sense, out of touch with the =
-real world, being concentrated on=20
-one tiny slice of reality. The system will have to use any means that I =
-can, whether psychological or=20
-biological, to engineer people to be docile, to have the abilities that the =
-syst em requires and to "sublimate"=20
-their drive f or power into some specialized task. But the statement that =
-the people of such a society will=20
-have to be docile may require qualification. The society may find =
-competitiveness useful, provided that=20
-ways are found of directing competitiveness into channe ls that serve that =
-needs of the system. We can=20
-imagine=20
-into channels that serve the needs of the system. We can imagine a future =
-society in which there is endless=20
-competition for positions of prestige an power. But no more than a very few =
-people will ever reach the top,=20
-where the only real power is (see end of paragraph 163). Very repell ent is =
-a society in which a person can=20
-satisfy his needs for power only by pushing large numbers of other people =
-out of the way and depriving=20
-them of THEIR opportunity for power.=20
-
-176. Once can envision scenarios that incorporate aspects of more than one =
-of the possibilities that we have=20
-just discussed. For instance, it may be that machines will take over most =
-of the work that is of real,=20
-practical importance, but that human bei ngs will be kept busy by being =
-given relativ ely unimportant=20
-work. It has been suggested, for example, that a great development of the =
-service of industries might=20
-provide work for human beings. Thus people will would spend their time =
-shinning each others shoes,=20
-driving each other around inn taxica b, making handicrafts for one another, =
-waiti ng on each other's tables,=20
-etc. This seems to us a thoroughly contemptible way for the human race to =
-end up, and we doubt that many=20
-people would find=20
-fulfilling lives in such pointless busy-work. They would seek other, =
-dangerous outlets (drugs, , crime,=20
-"cults," hate groups) unless they were biol ogical or psychologically =
-engineered to adapt them to such a=20
-way of life.=20
-
-177. Needless to day, the scenarios outlined above do not exhaust all the =
-possibilities. They only indicate=20
-the kinds of outcomes that seem to us mots likely. But wee can envision no =
-plausible scenarios that are any=20
-more palatable that the ones we've j ust described. It is overwhelmingly =
-probabl e that if the industrial-
-technological system survives the next 40 to 100 years, it will by that =
-time have developed certain general=20
-characteristics: Individuals (at least those of the "bourgeois" type, who =
-are integrated into the system and=20
-make it run, and who therefore have all the power) will b e more dependent =
-than ever on large=20
-organizations; they will be more "socialized" that ever and their physical =
-and mental qualities to a=20
-significant=20
-extent (possibly to a very great extent ) will be those that are engineered =
-into them rather than being th e=20
-results of chance (or of God's will, or wh atever); and whatever may be =
-left of wild nature will be reduced=20
-to remnants preserved for scientific study and kept under the supervision =
-and management of scientists=20
-(hence it will no longer be truly wild). In the long run (say a few =
-centuries from no w) it is it is likely that=20
-neither the human race nor any other important organisms will exist as we =
-know them today, because once=20
-you start modifying organisms through genetic engineering there is no =
-reason to stop at any particular=20
-point, so that the modifications will probably continue until man and other =
-organisms have been utterly=20
-trans formed.=20
-
-178. Whatever else may be the case, it is certain that technology is =
-creating for human begins a new=20
-physical and social environment radically different from the spectrum of =
-environments to which natural=20
-selection has adapted the human race physically an d psychological. If man =
-is not adjust to th is new=20
-environment by being artificially re-engineered, then he will be adapted to =
-it through a long an painful=20
-process of natural selection. The former is far more likely that the =
-latter.=20
-
-179. It would be better to dump the whole stinking system and take the =
-consequences.=20
-
-STRATEGY
-
-180. The technophiles are taking us all on an utterly reckless ride into =
-the unknown. Many people=20
-understand something of what technological progress is doing to us yet take =
-a passive attitude toward it=20
-because they think it is inevitable. But we (FC) don't think it is =
-inevitable. We think it c an be stopped, and=20
-we will give here some indications of how to go about stopping it.=20
-
-181. As we stated in paragraph 166, the two main tasks for the present are =
-to promote social stress and=20
-instability in industrial society and to develop and propagate an ideology =
-that opposes technology and the=20
-industrial system. When the system become s sufficiently stressed and =
-unstable, a revo lution against=20
-technology may be possible. The pattern would be similar to that of the =
-French and Russian Revolutions.=20
-French society and Russian society, for several decades prior to their =
-respective revolutions, showed=20
-increasing signs of stress and w eakness. Meanwhile, ideologies were being =
-d eveloped that offered a new=20
-world view that was quite different from the old one. In the Russian case, =
-revolutionaries were actively=20
-working to undermine=20
-the old order. Then, when the old system was put under sufficient =
-additional stress (by financial c risis in=20
-France, by military defeat in Russi a) it was swept away by revolution. =
-What we propose in something=20
-along the same lines.=20
-
-182. It will be objected that the French and Russian Revolutions were =
-failures. But most revolutions have=20
-two goals. One is to destroy an old form of society and the other is to set =
-up the new form of society=20
-envisioned by the revolutionaries. The Fre nch and Russian revolutionaries =
-failed (fort unately!) to create=20
-the new kind of society of which they dreamed, but they were quite =
-successful in destroying the existing=20
-form of society.=20
-
-183. But an ideology, in order to gain enthusiastic support, must have a =
-positive ideals well as a negative=20
-one; it must be FOR something as well as AGAINST something. The positive =
-ideal that we propose is=20
-Nature. That is , WILD nature; those aspects o f the functioning of the =
-Earth and its livin g things that are=20
-independent of human management and free of human interference and control. =
-And with wild nature we=20
-include human nature, by which we mean those aspects of the functioning of =
-the human individual that are=20
-not subject to regulation by o rganized society but are products of chance, =
-or free will, or God (depending=20
-on your religious or philosophical opinions).=20
-
-184. Nature makes a perfect counter-ideal to technology for several =
-reasons. Nature (that which is outside=20
-the power of the system) is the opposite of technology (which seeks to =
-expand indefinitely the power of the=20
-system). Most people will agree that nature is beautiful; certainly it has =
-treme ndous popular appeal. The=20
-radical environmentalists ALREADY hold an ideology that exalts nature and =
-opposes technology. [30] It is=20
-not necessary for the sake of nature to set up some chimerical utopia or =
-any new kind of social order.=20
-Nature takes care of itself: It was a spontaneous creation th at existed =
-long before any human society, and=20
-for countless centuries many different kinds of human societies coexisted =
-with nature without doing it an=20
-excessive amount of damage. Only with the Industrial Revolution did the =
-effect of human society on nat=20
-ure become really devastating. To relieve t he pressure on nature it is not =
-necessary to create a special kind=20
-of social system, it is only necessary to get rid of industrial society. =
-Granted, this will not solve all=20
-problems. Industrial society has already done tremendous damage to nature =
-and i t will take a very long=20
-time for the scars t o heal. Besides, even pre-industrial societies can do =
-significant damage to nature.=20
-Nevertheless, getting rid of industrial society will accomplish a great =
-deal. It will relieve the worst of the=20
-pressure on nature so that the scars can begin to heal. It will remove the =
-capacity of organized soc iety=20
-to keep increasing its control over nature (including human nature). =
-Whatever kind of society may exist=20
-after the demise of the industrial system, it is certain that most people =
-will live close to nature, because in=20
-the absence of advanced technolog y there is not other way that people CAN =
-liv e. To feed themselves they=20
-must be peasants or herdsmen or fishermen or hunter, etc., And, generally =
-speaking, local autonomy should=20
-tend to increase, because lack of advanced technology and rapid =
-communications will limit the capacity of=20
-governments o r other large organizations to control local communities. =
-
-
-185. As for the negative consequences of eliminating industrial society -- =
-well, you can't eat your cake and=20
-have it too. To gain one thing you have to sacrifice another.=20
-
-186. Most people hate psychological conflict. For this reason they avoid =
-doing any serious thinking about=20
-difficult social issues, and they like to have such issues presented to =
-them in simple, black-and-white terms:=20
-THIS is all good and THAT is all bad. The revolutionary ideology should =
-therefore be developed on two=20
-levels.=20
-
-187. On the more sophisticated level the ideology should address itself to =
-people who are intelligent,=20
-thoughtful and rational. The object should be to create a core of people =
-who will be opposed to the=20
-industrial system on a rational, thought-out basis, with full appreciation =
-of the problems and ambiguities=20
-involved, and of the price that has to be paid for getting rid of the =
-system. It is particularly important to=20
-attract people of this type, as they are capable people and will be =
-instrumental in influencing others. These=20
-people should be addres sed on as rational a level as possible. Fact s =
-should never intentionally be distorted=20
-and intemperate language should be avoided. This does not mean that no =
-appeal can be made to the=20
-emotions,=20
-but in making such appeal care should be taken to avoid misrepresenting the =
-truth or doing anything else t=20
-hat would destroy the intellectual respectab ility of the ideology. =
-
-
-188. On a second level, the ideology should be propagated in a simplified =
-form that will enable the=20
-unthinking majority to see the conflict of technology vs. nature in =
-unambiguous terms. But even on this=20
-second level the ideology should not be expressed in language that is so =
-cheap, intemperate or irrational=20
-that it alienates people of the thoughtful and rational type. Cheap, =
-intemperate propaganda sometimes=20
-achieves impressive short-term gains, but it will be more advantageous in =
-the long run to keep the loyalty=20
-of a small number of intelligently committed people than to arouse the =
-passion s of an unthinking, fickle=20
-mob who will change their attitude as soon as someone comes along with a =
-better propaganda gimmick.=20
-However, propaganda of the=20
-rabble-rousing type may be necessary when the system is nearing the point =
-of collapse and there is a final=20
-struggle between rival ideologies to d etermine which will become dominant =
-when the old world-view goes=20
-under.=20
-
-189. Prior to that final struggle, the revolutionaries should not expect to =
-have a majority of people on their=20
-side. History is made by active, determined minorities, not by the =
-majority, which seldom has a clear and=20
-consistent idea of what it really wan ts. Until the time comes for the =
-final push toward revolution [31], the=20
-task of revolutionaries will be less to win the shallow support of the =
-majority than to build a small core of=20
-deeply committed people. As for the majority, it will be enough to make =
-them aware of the existence of the=20
-new ideolo gy and remind them of it frequently; though of course it will be =
-desirable to get majority=20
-support to the extent that this can be done without weakening the core of =
-seriously committed people.=20
-
-190. Any kind of social conflict helps to destabilize the system, but one =
-should be careful about what kind=20
-of conflict one encourages. The line of conflict should be drawn between =
-the mass of the people and the=20
-power-holding elite of industrial society ( politicians, scientists, =
-upper-level busines s executives,=20
-government officials, etc..). It should NOT be drawn between the =
-revolutionaries and the mass of the=20
-people. For example, it would be bad strategy for the revolutionaries to =
-condemn Americans for their=20
-habits of consumption. Instead, the ave rage American should be portrayed =
-as a victi m of the advertising=20
-and marketing industry, which has suckered him into buying a lot of junk =
-that he doesn't need and that is=20
-very poor compensation
-for his lost freedom. Either approach is consistent with the facts. It is =
-merely a matter of attitude whether=20
-you blame the advertising industry for manipulating the public or blame the =
-public for allowing itself to be=20
-manipulated. As a matter of strategy one should generally avoid blaming the =
-public.=20
-
-191. One should think twice before encouraging any other social conflict =
-than that between the power-
-holding elite (which wields technology) and the general public (over which =
-technology exerts its power).=20
-For one thing, other conflicts tend to distract attention from the =
-important conflicts (betw een power-elite=20
-and ordinary people, between technology and nature); for another thing, =
-other conflicts may actually tend=20
-to encourage technologization, because each side in such a conflict wants =
-to use technological power to=20
-gain advantages over its adve rsary. This is clearly seen in rivalries bet =
-ween nations. It also appears in=20
-ethnic conflicts within nations. For example, in America many black leaders =
-are anxious to gain power for=20
-African=20
-Americans by placing back individuals in the technological power-elite. =
-They want there to be many black=20
-gov ernment officials, scientists, corporation e xecutives and so forth. In =
-this way they are helping to=20
-absorb the African American subculture into the technological system. =
-Generally speaking, one should=20
-encourage only those social conflicts that can be fitted into the framework =
-of the conflicts of po wer--elite=20
-vs. ordinary people, technology v s nature.=20
-
-192. But the way to discourage ethnic conflict is NOT through militant =
-advocacy of minority rights (see=20
-paragraphs 21, 29). Instead, the revolutionaries should emphasize that =
-although minorities do suffer more=20
-or less disadvantage, this disadvantage is o f peripheral significance. Our =
-real enemy is the industrial-
-technological system, and in the struggle against the system, ethnic =
-distinctions are of no importance.=20
-
-193. The kind of revolution we have in mind will not necessarily involve an =
-armed uprising against any=20
-government. It may or may not involve physical violence, but it will not be =
-a POLITICAL revolution. Its=20
-focus will be on technology and economics, not politics. [32]=20
-
-194. Probably the revolutionaries should even AVOID assuming political =
-power, whether by legal or=20
-illegal means, until the industrial system is stressed to the danger point =
-and has proved itself to be a failure=20
-in the eyes of most people. Suppose for exa mple that some "green" party =
-should win cont rol of the United=20
-States Congress in an election. In order to avoid betraying or watering =
-down their own ideology they would=20
-have to take vigorous measures to turn economic growth into economic =
-shrinkage. To the average man the=20
-results would appear disast rous: There would be massive unemployment, s =
-hortages of commodities, etc.=20
-Even if the grosser ill effects could be avoided through superhumanly =
-skillful management, still people=20
-would have=20
-to begin giving up the luxuries to which they have become addicted. =
-Dissatisfaction would grow, the=20
-"green" pa rty would be voted out of of fice and the re volutionaries would =
-have suffered a severe setback.=20
-For this reason the revolutionaries should not try to acquire political =
-power until the system has gotten=20
-itself into such a mess that any hardships will be seen as resulting from =
-the failures of the ind ustrial system=20
-itself and not from the polic ies of the revolutionaries. The revolution =
-against technology will probably=20
-have to be a revolution by outsiders, a revolution from below and not from =
-above.=20
-
-195. The revolution must be international and worldwide. It cannot be =
-carried out on a nation-by-nation=20
-basis. Whenever it is suggested that the United States, for example, should =
-cut back on technological=20
-progress or economic growth, people get hysteric al and start screaming =
-that if we fall behin d in=20
-technology the Japanese will get ahead of us. Holy robots The world will =
-fly off its orbit if the Japanese=20
-ever sell more cars than we do! (Nationalism is a great promoter of =
-technology.) More reasonably, it is=20
-argued that if the relatively democrati c nations of the world fall behind =
-in techno logy while nasty,=20
-dictatorial nations like China, Vietnam and North Korea continue to =
-progress, eventually the dictators may=20
-come to dominate the world.=20
-That is why the industrial system should be attacked in all nations =
-simultaneously, to the extent that this=20
-may be possible. True, there is no ass urance that the industrial system =
-can be destroyed at approximately=20
-the same time all over the world, and it is even conceivable that the =
-attempt to overthrow the system could=20
-lead instead to the domination of the system by dictators. That is a risk =
-that has to be taken. And it is worth=20
-taking, sin ce the difference between a "democratic" industrial system and =
-one controlled by dictators is=20
-small compared with the difference between an industrial system and a =
-non-industrial one. [33] It might=20
-even be argued that an industrial system controlled by di ctators would be =
-preferable, because dictato=20
-r-controlled systems usually have proved inefficient, hence they are =
-presumably more likely to break down.=20
-Look at Cuba.=20
-
-196. Revolutionaries might consider favoring measures that tend to bind the =
-world economy into a unified=20
-whole. Free trade agreements like NAFTA and GATT are probably harmful to =
-the environment in the short=20
-run, but in the long run they may perhaps be ad vantageous because they =
-foster economic inte rdependence=20
-between nations. I will be eaier to destroy the industrial system on a =
-worldwide basis if he world economy=20
-is so unified that its breakdown in any on major nation will lead to its =
-breakdwon in al industrialized=20
-nations.=20
-
-the long run they may perhaps be advantageous because they foster economic =
-interdependence between=20
-nations. It will be easier to destroy the industrial system on a worldwide =
-basis if the world economy is so=20
-unified that its breakdown in any one major nat ion will lead to its =
-breakdown in all indust rialized nations.
-
-197. Some people take the line that modern man has too much power, too much =
-control over nature; they=20
-argue for a more passive attitude on the part of the human race. At best =
-these people are expressing=20
-themselves unclearly, because they fail to distingu ish between power for =
-LARGE ORGANIZATIONS an=20
-d power for INDIVIDUALS and SMALL GROUPS. It is a mistake to argue for =
-powerlessness and=20
-passivity, because people NEED power. Modern man as a collective =
-entity--that is, the industrial system--
-has immense power over nature, and we (FC) regard this as e vil. But modern =
-INDIVIDUALS and=20
-SMALL GROUP S OF INDIVIDUALS have far less power than primitive man ever =
-did. Generally=20
-speaking, the vast power of "modern man" over nature is exercised not =
-
-by individuals or small groups but by large organizations. To the extent =
-that the average modern=20
-INDIVIDUAL can wield the power of technology, he is pe rmitted to do so =
-only within narrow limits and=20
-only under the supervision and control of the system. (You need a license =
-for everything and with the=20
-license come rules and regulations). The individual has only those =
-technological powers with which the s=20
-ystem chooses to provide him. His PERSONAL power over nature is =
-slight.
-
-198. Primitive INDIVIDUALS and SMALL GROUPS actually had considerable power =
-over nature; or=20
-maybe it would be better to say power WITHIN nature. When primitive man =
-needed food he knew how to=20
-find and prepare edible roots, how to track game and take it wi th homemade =
-weapons. He knew how to=20
-protect himself from heat, cold, rain, dangerous animals, etc. But =
-primitive man did relatively little damage=20
-to nature because the COLLECTIVE power of primitive society was negligible =
-compared to the=20
-COLLECTIVE power of industrial society.
-
-199. Instead of arguing for powerlessness and passivity, one should argue =
-that the power of the=20
-INDUSTRIAL SYSTEM should be broken, and that this will greatly INCREASE the =
-power and freedom=20
-of INDIVIDUALS and SMALL GROUPS.
-
-200. Until the industrial system has been thoroughly wrecked, the =
-destruction of that system must be the=20
-revolutionaries' ONLY goal. Other goals would distract attention and energy =
-from the main goal. More=20
-importantly, if the revolutionaries permit themse lves to have any other =
-goal than the destruc tion of=20
-technology, they will be tempted to use technology as a tool for reaching =
-that other goal. If they give in to=20
-that temptation, they will fall right back into the technological trap, =
-because modern technology is a=20
-unified, tightly organized system, so that, in order to retain SOME =
-technology , one finds oneself obliged=20
-to retain MOST technology, hence one ends up sacrificing only token amounts =
-of technology.
-
-201. Suppose for example that the revolutionaries took "social justice" as =
-a goal. Human nature being what=20
-it is, social justice would not come about spontaneously; it would have to =
-be enforced. In order to enforce it=20
-the revolutionaries would have to ret ain central organization and control. =
-For th at they would need rapid=20
-long-distance transportation and communication, and therefore all the =
-technology needed to support the=20
-transportation and communication systems. To feed and clothe poor people =
-they would have to use=20
-agricultural and manufacturing technology. And so forth. So that the attemp =
-t to insure social justice would=20
-force them to retain most parts of the technological system. Not that we =
-have anything against social=20
-justice,=20
-but it must not be allowed to interfere with the effort to get rid of the =
-technological system.
-
-202. It would be hopeless for revolutionaries to try to attack the system =
-without using SOME modern=20
-technology. If nothing else they must use the communications media to =
-spread their message. But they=20
-should use modern technology for only ONE purpose: to attack the =
-technological system.
-
-203. Imagine an alcoholic sitting with a barrel of wine in front of him. =
-Suppose he starts saying to himself,=20
-"Wine isn't bad for you if used in moderation. Why, they say small amounts =
-of wine are even good for you!=20
-It won't do me any harm if I take just one little drink..." Well you know =
-what is g oing to happen. Never=20
-forget that the human race with technology is just like an alcoholic with a =
-barrel of wine.
-
-204. Revolutionaries should have as many children as they can. There is =
-strong scientific evidence that=20
-social attitudes are to a significant extent inherited. No one suggests =
-that a social attitude is a direct=20
-outcome of a person's genetic constitution, but it appears that personality =
-traits tend , within the context of=20
-our society, to make a person more likely to hold this or that social =
-attitude. Objections to these findings=20
-have been raised, but objections are feeble and seem to be ideologically =
-motivated. In any event, no one=20
-denies that child ren tend on the average to hold social attit udes similar =
-to those of their parents. From our=20
-point of view it doesn't matter all that much whether the attitudes are =
-passed on genetically or through=20
-childhood training. In either case the ARE passed on.
-
-205. The trouble is that many of the people who are inclined to rebel =
-against the industrial system are also=20
-concerned about the population problems, hence they are apt to have few or =
-no children. In this way they=20
-may be handing the world over to the sort of people who support or at least =
-accept th e industrial system.=20
-To insure the strength of the next generation of revolutionaries the =
-present generation must reproduce itself=20
-abundantly. In doing so they will be worsening the population problem only =
-slightly. And the most=20
-important problem is to ge t rid of the industrial system, because once the =
-industrial system is gone the=20
-world's population necessarily will decrease (see paragraph 167); whereas, =
-if the industrial system survives,=20
-it will continue developing new techniques of food production that may =
-enable the world's population to=20
-keep i ncreasing almost indefinitely.
-
-206. With regard to revolutionary strategy, the only points on which we =
-absolutely insist are that the single=20
-overriding goal must be the elimination of modern technology, and that no =
-other goal can be allowed to=20
-compete with this one. For the rest, revol utionaries should take an =
-empirical approach . If experience=20
-indicates that some of the recommendations made in the foregoing paragraphs =
-are not going to give good=20
-results, then those recommendations should be discarded.
-
-
-
-TWO KINDS OF TECHNOLOGY
-
-207. An argument likely to be raised against our proposed revolution is =
-that it is bound to fail, because (it is=20
-claimed) throughout history technology has always progressed, never =
-regressed, hence technological=20
-regression is impossible. But this claim is false.
-
-208. We distinguish between two kinds of technology, which we will call =
-small-scale technology and=20
-organization-dependent technology. Small-scale technology is technology =
-that can be used by small-scale=20
-communities without outside assistance. Organization -dependent technology =
-is technology that de pends=20
-on large-scale social organization. We are aware of no significant cases of =
-regression in small-scale=20
-technology. But organization-dependent technology DOES regress when the =
-social organization on which=20
-it depends breaks down. Example: When the Roma n Empire fell apart the =
-Romans' small-scale technology=20
-survived because any clever village craftsman could build, for instance, a =
-water wheel, any skilled smith=20
-could make steel by Roman methods,=20
-and so forth. But the Romans' organization-dependent technology DID =
-regress. Their aqueducts fell into=20
-disrepair and were never rebuilt.=20
-Their tech niques of road construction were lost. The Roman system of urban =
-sanitation was forgotten, so=20
-that until rather recent times did the sanitation of European cities that =
-of Ancient Rome.
-
-209. The reason why technology has seemed always to progress is that, until =
-perhaps a century or two=20
-before the Industrial Revolution, most technology was small-scale =
-technology. But most of the technology=20
-developed since the Industrial Revolution is orga nization-dependent =
-technology. Take the refr igerator for=20
-example. Without factory-made parts or the facilities of a post-industrial =
-machine shop it would be=20
-virtually impossible for a handful of local craftsmen to build a =
-refrigerator. If by some miracle they did=20
-succeed in building one it would be useless to them without a reliable =
-source o f electric power. So they=20
-would have to dam a stream and build a generator. Generators require large =
-amounts of copper wire.=20
-Imagine trying to make that=20
-wire without modern machinery. And where would they get a gas suitable for =
-refrigeration? It would be=20
-much easier to build an icehouse or preserve food by drying or picking, as =
-was done before the invention=20
-of the refrigerator.
-
-210. So it is clear that if the industrial system were once thoroughly =
-broken down, refrigeration technology=20
-would quickly be lost. The same is true of other organization-dependent =
-technology. And once this=20
-technology had been lost for a generation or so it would take centuries to =
-rebuild it, just as it took centuries=20
-to build it the first time around. Surviving technical books would be few =
-and scattered. An industrial=20
-society, if built from scratch without outside help, can only be built in a =
-series of stages: You need tools to=20
-make tools to make tools to make tools ... . A long process of economic =
-development and progress in social=20
-organization is required. And, even in the absence of an ideology opposed =
-to technology, there is no reason=20
-to believe that anyone would be interested in rebuilding industrial =
-society. The enthusiasm for "progre ss"=20
-is a phenomenon particular to the modern form of society, and it seems not =
-to have existed prior to the 17th=20
-century or thereabouts.
-
-211. In the late Middle Ages there were four main civilizations that were =
-about equally "advanced":=20
-Europe, the Islamic world, India, and the Far East (China, Japan, Korea). =
-Three of those civilizations=20
-remained more or less stable, and only Europe became dynamic. No one knows =
-why Europe became dyn=20
-amic at that time; historians have their theories but these are only =
-speculation. At any rate, it is clear that=20
-rapid development toward a technological form of society occurs only under =
-special conditions. So there is=20
-no reason to assume that long-lastin g technological regression cannot be =
-brought about.
-
-212. Would society EVENTUALLY develop again toward an =
-industrial-technological form? Maybe, but=20
-there is no use in worrying about it, since we can't predict or control =
-events 500 or 1,000 years in the=20
-future. Those problems must be dealt with by the peopl e who will live at =
-that time.
-
-
-
-THE DANGER OF LEFTISM
-
-213. Because of their need for rebellion and for membership in a movement, =
-leftists or persons of similar=20
-psychological type are often unattracted to a rebellious or activist =
-movement whose goals and membership=20
-are not initially leftist. The resulting inf lux of leftish types can =
-easily turn a non-l eftist movement into a=20
-leftist one, so that leftist goals replace or distort the original goals of =
-the movement.
-
-214. To avoid this, a movement that exalts nature and opposes technology =
-must take a resolutely anti-leftist=20
-stance and must avoid all collaboration with leftists. Leftism is in the =
-long run inconsistent with wild=20
-nature, with human freedom and with the e limination of modern technology. =
-Leftism is collectivist; it=20
-seeks to bind together the entire world (both nature and the human race) =
-into a unified whole. But this=20
-implies management of nature and of human life by organized society, and it =
-requires advanced=20
-technology. You can't have a united worl d without rapid transportation and =
-communica tion, you can't=20
-make all people love one another without sophisticated psychological =
-techniques, you can't have a=20
-"planned society" without the necessary technological base.=20
-Above all, leftism is driven by the need for power, and the leftist seeks =
-power o n a collective basis,=20
-through identification with a mass movement or an organization. Leftism is =
-unlikely ever to give up=20
-technology, because technology is too valuable a source of collective =
-power.=20
-
-215. The anarchist [34] too seeks power, but he seeks it on an individual =
-or small-group basis; he wants=20
-individuals and small groups to be able to control the circumstances of =
-their own lives. He opposes=20
-technology because it makes small groups dependent on large =
-organizations.
-
-216. Some leftists may seem to oppose technology, but they will oppose it =
-only so long as they are=20
-outsiders and the technological system is controlled by non-leftists. If =
-leftism ever becomes dominant in=20
-society, so that the technological system becomes a tool in the hands of =
-leftists, they will e nthusiastically=20
-use it and promote its growth. In doing this they will be repeating a =
-pattern that leftism has shown again=20
-and again in the past. When the Bolsheviks in Russia were outsiders, they =
-vigorously opposed censorship=20
-and the secret police, they advocated self-determination for ethnic mino =
-rities, and so forth;=20
-but as soon as they came into power themselves, they imposed a tighter =
-censorship and created a more=20
-ruthless secret police than any that had existed under the tsars, and they =
-oppressed ethnic minorities at least=20
-as much as the tsars had done. In the United States, a couple of decades =
-ago when leftists were a minority=20
-in our universities, leftist professors were vigorous proponents of =
-academic freedom, but today, in those=20
-universities where leftists have become dominant, they have shown =
-themselves ready to take away from=20
-every one else's academic freedom. (This is "polit ical correctness.") The =
-same will happen with leftists and=20
-technology: They will use it to oppress everyone else if they ever get it =
-under their own control.
-
-217. In earlier revolutions, leftists of the most power-hungry type, =
-repeatedly, have first cooperated with=20
-non-leftist revolutionaries, as well as with leftists of a more libertarian =
-inclination, and later have double-
-crossed them to seize power for them selves. Robespierre did this in the =
-French R evolution, the Bolsheviks=20
-did it in the Russian Revolution, the communists did it in Spain in 1938 =
-and Castro and his followers did it=20
-in Cuba. Given the past history of leftism, it would be utterly foolish for =
-non-leftist revolutionaries today to=20
-collabo rate with leftists.
-
-218. Various thinkers have pointed out that leftism is a kind of religion. =
-Leftism is not a religion in the=20
-strict sense because leftist doctrine does not postulate the existence of =
-any supernatural being. But for the=20
-leftist, leftism plays a psychologica l role much like that which religion =
-plays f or some people. The leftist=20
-NEEDS to believe in leftism; it plays a vital role in his psychological =
-economy. His beliefs are not easily=20
-modified by logic or facts. He has a deep conviction that leftism is =
-morally Right with a capital R, and that=20
-he has no t only a right but a duty to impose leftist morality on everyone. =
-(However, many of the people we=20
-are referring to as "leftists" do not think of themselves as leftists and =
-would not describe=20
-their system of beliefs as leftism. We use the term "leftism" because we =
-don't know of any better words to=20
-d esignate the spectrum of related creeds that includes the feminist, gay =
-rights, political correctness, etc.,=20
-movements, and because these movements have a strong affinity with the old =
-left. See paragraphs 227-
-230.)
-
-219. Leftism is totalitarian force. Wherever leftism is in a position of =
-power it tends to invade every private=20
-corner and force every thought into a leftist mold. In part this is because =
-of the quasi-religious character of=20
-leftism; everything contrary to leftists beliefs represents Sin. More impor =
-tantly, leftism is a totalitarian=20
-force because of the leftists' drive for power. The leftist seeks to =
-satisfy his need for power through=20
-identification with a social movement and he tries to go through the power =
-process by helping to pursue=20
-and attain th e goals of the movement (see paragraph 83). But no matter how =
-far the movement has gone in=20
-attaining its goals the leftist is never satisfied, because his activism is =
-a surrogate activity (see paragraph=20
-41).=20
-That is, the leftist's real motive is not to attain the ostensible goals of =
-leftism; in rea lity he is motivated by=20
-the sense of power h e gets from struggling for and then reaching a social =
-goal.[35]
-
-Consequently the leftist is never satisfied with the goals he has already =
-attained; his need for the power=20
-process leads him always to pursue some new goal. The leftist wants equal =
-opportunities for minorities.=20
-When that is attained he insists on statisti cal equality of achievement by =
-minorities. A nd as long as=20
-anyone harbors in some corner of his mind a negative attitude toward some =
-minority, the leftist has to=20
-re-educated him. And ethnic minorities are not enough; no one can be =
-allowed to have a negative attitude=20
-toward homosexuals, disabled peop le, fat people, old people, ugly people, =
-and on and on and on. It's not=20
-enough that the public should be informed about the hazards of smoking; a =
-warning has to be stamped on=20
-every package of cigarettes.=20
-Then cigarette advertising has to be restricted if not banned. The =
-activists will never be sati sfied until=20
-tobacco is outlawed, and after t hat it will be alco hot then junk food, =
-etc. Activists have fought gross child=20
-abuse, which is reasonable. But now they want to stop all spanking. When =
-they have done that they will=20
-want to ban something else they consider unwholesome, then another thing =
-and then another. They will=20
-never be satisfi ed until they have complete control over all child rearing =
-practices. And then they will=20
-move on to another cause.=20
-
-220. Suppose you asked leftists to make a list of ALL the things that were =
-wrong with society, and then=20
-suppose you instituted EVERY social change that they demanded. It is safe =
-to say that within a couple of=20
-years the majority of leftists would find some thing new to complain about, =
-some new social "evil" to=20
-correct because, once again, the leftist is motivated less by distress at =
-society's ills than by the need to=20
-satisfy his drive for power by imposing his solutions on society.=20
-
-221. Because of the restrictions placed on their thoughts and behavior by =
-their high level of socialization,=20
-many leftists of the over-socialized type cannot pursue power in the ways =
-that other people do. For them=20
-the drive for power has only one morally acceptable outlet, and that is in =
-the strugg le to impose their=20
-morality on everyone.=20
-
-222. Leftists, especially those of the oversocialized type, are True =
-Believers in the sense of Eric Hoffer's=20
-book, "The True Believer." But not all True Believers are of the same =
-psychological type as leftists.=20
-Presumably a truebelieving nazi, for instanc e is very different =
-psychologically from a t ruebelieving leftist.=20
-Because of their capacity for single-minded devotion to a cause, True =
-Believers are a useful, perhaps a=20
-necessary, ingredient of any revolutionary movement. This presents a =
-problem with which we must admit=20
-we don't know how to deal. We aren't sure how to harness the energies o f =
-the True Believer to a revolution=20
-against technology. At present all we can say is that no True Believer will =
-make a safe recruit to the=20
-revolution=20
-unless his commitment is exclusively to the destruction of technology. If =
-he is committed also to another=20
-ideal, he may want to use technology as a t ool for pursuing that other =
-ideal (see paragraphs 220, 221).
-
-223. Some readers may say, "This stuff about leftism is a lot of crap. I =
-know John and Jane who are leftish=20
-types and they don't have all these totalitarian tendencies." It's quite =
-true that many leftists, possibly even a=20
-numerical majority, are decent pe ople who sincerely believe in tolerating =
-oth ers' values (up to a point) and=20
-wouldn't want to use high-handed methods to reach their social goals. Our =
-remarks about leftism are not=20
-meant to apply to every individual leftist but to describe the general =
-character of leftism as a movement.=20
-And the gene ral character of a movement is not necessari ly determined by =
-the numerical proportions of=20
-the various kinds of people involved in the movement.=20
-
-224. The people who rise to positions of power in leftist movements tend to =
-be leftists of the most power-
-hungry type because power-hungry people are those who strive hardest to get =
-into positions of power.=20
-Once the power-hungry types have captured contro l of the movement, there =
-are many leftists o f a gentler=20
-breed who inwardly disapprove of many of the actions of the leaders, but =
-cannot bring themselves to=20
-oppose them. They NEED their faith in the movement, and because they cannot =
-give up this faith they go=20
-along with the leaders. True, SOME lefti sts do have the guts to oppose the =
-totalitar ian tendencies that=20
-emerge, but they generally lose, because the power-hungry types are better =
-organized, are more ruthless=20
-and Machiavellian and have taken care to build themselves a strong power =
-base.=20
-
-225. These phenomena appeared clearly in Russia and other countries that =
-were taken over by leftists.=20
-Similarly, before the breakdown of communism in the USSR, leftish types in =
-the West would seldom=20
-criticize that country. If prodded they would admit that the USSR did many =
-wrong things, but then th ey=20
-would try to find excuses for the communists and begin talking about the =
-faults of the West. They always=20
-opposed Western military resistance to communist aggression. Leftish types =
-all over the world vigorously=20
-protested the U.S. military action in Viet nam, but when the USSR invaded =
-Afghanistan t hey did nothing.=20
-Not that they approved of the Soviet actions; but because of their leftist =
-faith, they just couldn't bear to put=20
-themselves in opposition to communism.=20
-Today, in those of our universities where "political correctness" has =
-become dominant, there are probably=20
-many leftish types who p rivately disapprove of the suppression of academic =
-freedom, but they go along=20
-with it anyway.=20
-
-226. Thus the fact that many individual leftists are personally mild and =
-fairly tolerant people by no means=20
-prevents leftism as a whole form having a totalitarian tendency.=20
-
-227. Our discussion of leftism has a serious weakness. It is still far from =
-clear what we mean by the word=20
-"leftist." There doesn't seem to be much we can do about this. Today =
-leftism is fragmented into a whole=20
-spectrum of activist movements. Yet not all activist movements are leftist, =
-and some act ivist movements=20
-(e.g.., radical environmentalism) seem to include both personalities of the =
-leftist type and personalities of=20
-thoroughly un-leftist types who ought to know better than to collaborate =
-with leftists. Varieties of leftists=20
-fade out gradually into varieties of non-leftists and we oursel ves would =
-often be hard-pressed to decide=20
-whether a given individual is or is not a leftist. To the extent that it is =
-defined at all, our conception of=20
-leftism=20
-is defined by the discussion of it that we have given in this article, and =
-we can only advise t he reader to=20
-use his own judgment in decidin g who is a leftist.=20
-
-228. But it will be helpful to list some criteria for diagnosing leftism. =
-These criteria cannot be applied in a=20
-cut and dried manner. Some individuals may meet some of the criteria =
-without being leftists, some leftists=20
-may not meet any of the criteria. Ag ain, you just have to use your =
-judgment.
-
-229. The leftist is oriented toward largescale collectivism. He emphasizes =
-the duty of the individual to=20
-serve society and the duty of society to take care of the individual. He =
-has a negative attitude toward=20
-individualism. He often takes a moralistic ton e. He tends to be for gun =
-control, for sex e ducation and=20
-other psychologically "enlightened" educational methods, for planning, for =
-affirmative action, for=20
-multiculturalism. He tends to identify with victims. He tends to be against =
-competition and against=20
-violence, but he often finds excuses for th ose leftists who do commit =
-violence. He is f ond of using the=20
-common catch-phrases of the left like "racism, " "sexism, " "homophobia, " =
-"capitalism," "imperialism,"=20
-"neocolonialism " "genocide,"=20
-"social change," "social justice," "social responsibility." Maybe the best =
-diagnostic trait of the leftist is his=20
-tendency to sympathize with the following movements: feminism, gay rights, =
-ethnic rights, disabi lity=20
-rights, animal rights political correct ness. Anyone who strongly =
-sympathizes with ALL of these=20
-movements is almost certainly a leftist. [36]=20
-
-230. The more dangerous leftists, that is, those who are most power-hungry, =
-are often characterized by=20
-arrogance or by a dogmatic approach to ideology. However, the most =
-dangerous leftists of all may be=20
-certain oversocialized types who avoid irritating di splays of =
-aggressiveness and refrain from ad vertising=20
-their leftism, but work quietly and unobtrusively to promote collectivist =
-values, "enlightened"=20
-psychological techniques for socializing children, dependence of the =
-individual on the system, and so forth.=20
-These crypto-leftists (as we may call th em) approximate certain bourgeois =
-types as f ar as practical action=20
-is concerned, but differ from them in psychology, ideology and motivation. =
-The ordinary bourgeois tries to=20
-bring people under control=20
-of the system in order to protect his way of life, or he does so simply =
-because his attitudes are=20
-conventional. The crypto-leftist tries to br ing people under control of =
-the system because he is a True=20
-Believer in a collectivistic ideology. The crypto-leftist is differentiated =
-from the average leftist of the=20
-oversocialized type by the fact that his rebellious impulse is weaker and =
-he is more se curely socialized. He=20
-is differentiated from the ordinary well-socialized bourgeois by the fact =
-that there is some deep lack within=20
-him that makes it necessary for him to devote himself to a cause and =
-immerse himself in a collectivity. And=20
-maybe his (well-sublimated) drive for power is stronger tha n that of the =
-average bourgeois.
-
-FINAL NOTE
-
-231. Throughout this article we've made imprecise statements and statements =
-that ought to have had all=20
-sorts of qualifications and reservations attached to them; and some of our =
-statements may be flatly false.=20
-Lack of sufficient information and the need f or brevity made it impossible =
-for us to fomu late our=20
-assertions more precisely or add all the necessary qualifications. And of =
-course in a discussion of this=20
-
-kind one must rely heavily on intuitive judgment, and that can sometimes be =
-wrong. So we don't claim that=20
-this article expresses more than a crude approximation to the truth. =
-
-
-232. All the same we are reasonably confident that the general outlines of =
-the picture we have painted here=20
-are roughly correct. We have portrayed leftism in its modern form as a =
-phenomenon peculiar to our time=20
-and as a symptom of the disruption of the power process. But we might =
-possibly be wrong about this.=20
-Oversocialized types who try to satisfy their drive for power by imposing =
-their morality on everyone have=20
-certainly been around for a long time. But we THINK that the decisive role =
-played by feelings of=20
-inferiority, low self-esteem, powerlessness, identification with victims by =
-people who are not themselves=20
-victims, is a peculiarity of modern leftism. Identification with victims by =
-people not themselves victims can=20
-be seen to some extent in=20
-19th century leftism and early Christianity but as far as we can make out, =
-symptoms of low self-esteem,=20
-etc., were not nearly so evident in these movements, or in any other =
-movements, as they are in modern=20
-leftism. But we are not in a position to assert confidently that no such =
-movements have existed prior to=20
-modern leftism. This is a significant question to which historians ought to =
-give their attention.=20
-
-NOTES=20
-
-1. (Paragraph 19) We are asserting that ALL, or even most, bullies and =
-ruthless competitors suffer from=20
-feelings of inferiority.=20
-
-2. (Paragraph 25) During the Victorian period many oversocialized people =
-suffered from serious=20
-psychological problems as a result of repressing or trying to repress their =
-sexual feelings. Freud apparently=20
-based his theories on people of this type. Today the focus of socialization =
-has shifted from sex to=20
-aggression.=20
-
-3. (Paragraph 27) Not necessarily including specialists in engineering =
-"hard" sciences.=20
-
-4. (Paragraph 28) There are many individuals of the middle and upper =
-classes who resist some of these=20
-values, but usually their resistance is more or less covert. Such =
-resistance appears in the mass media only to=20
-a very limited extent. The main thrust of propaganda in our society is in =
-favor of the stated values.=20
-
-The main reasons why these values have become, so to speak, the official =
-values of our society is that they=20
-are useful to the industrial system. Violence is discouraged because it =
-disrupts the functioning of the=20
-system. Racism is discouraged because ethnic conflicts also disrupt the =
-system, and discrimination wastes=20
-the talent of minority-group members who could be useful to the system. =
-Poverty must be "cured" because=20
-the underclass causes problems for the system and contact with the =
-underclass lowers the moral of the other=20
-classes. Women are encouraged to have careers because their talents are =
-useful to the system and, more=20
-importantly because by having regular jobs women become better integrated =
-into the system and tied=20
-directly to it rather than to their families.=20
-This helps to weaken family solidarity. (The leaders of the system say they =
-want to strengthen the family,=20
-but they really mean is that they want the family to serve as an effective =
-tool for socializing children in=20
-accord with the needs of the system. We argue in paragraphs 51,52 that the =
-system cannot afford to let the=20
-family or other small-scale social groups be strong or autonomous.) =
-
-
-5. (Paragraph 42) It may be argued that the majority of people don't want =
-to make their own decisions but=20
-want leaders to do their thinking for them. There is an element of truth in =
-this. People like to make their=20
-own decisions in small matters, but making decisions on difficult, =
-fundamental questions require facing up=20
-to psychological conflict, and most people hate psychological conflict. =
-Hence they tend to lean on others in=20
-making difficult decisions. The majority of people are natural followers, =
-not leaders, but they like to have=20
-direct personal access to their leaders and participate to some extent in =
-making difficult decisions. At least=20
-to that degree they need autonomy.=20
-
-6. (Paragraph 44) Some of the symptoms listed are similar to those shown by =
-caged animals.=20
-
-To explain how these symptoms arise from deprivation with respect to the =
-power process:=20
-
-Common-sense understanding of human nature tells one that lack of goals =
-whose attainment requires effort=20
-leads to boredom and that boredom, long continued, often leads eventually =
-to depression. Failure to obtain=20
-goals leads to frustration and lowering of self-esteem. Frustration leads =
-to anger, anger to aggression, often=20
-in the form of spouse or child abuse. It has been shown that long-continued =
-frustration commonly leads to=20
-depression and that depression tends to cause guilt, sleep disorders, =
-eating disorders and bad feelings about=20
-oneself. Those who are tending toward depression seek pleasure as an =
-antidote; hence insatiable hedonism=20
-and excessive sex, with perversions as a means of getting new kicks. =
-Boredom too tends to cause excessive=20
-pleasure-seeking since,=20
-lacking other goals, people often use pleasure as a goal. See accompanying =
-diagram. The foregoing is a=20
-simplification. Reality is more complex, and of course deprivation with =
-respect to the power process is not=20
-the ONLY cause of the symptoms described. By the way, when we mention =
-depression we do not=20
-necessarily mean depression that is severe enough to be treated by a =
-psychiatrist. Often only mild forms of=20
-depression are involved. And when we speak of goals we do not necessarily =
-mean long-term, thought out=20
-goals. For many or most people through much of human history, the goals of =
-a hand-to-mouth existence=20
-(merely providing oneself and one's family with food from day to day) have =
-been quite sufficient.=20
-
-7. (Paragraph 52) A partial exception may be made for a few passive, inward =
-looking groups, such as the=20
-Amish, which have little effect on the wider society. Apart from these, =
-some genuine small-scale=20
-communities do exist in America today. For instance, youth gangs and =
-"cults". Everyone regards them as=20
-dangerous, and so they are, because the members of these groups are loyal =
-primarily to one another rather=20
-than to the system, hence the system cannot control them. Or take the =
-gypsies. The gypsies commonly get=20
-away with theft and fraud because their loyalties are such that they can =
-always get other gypsies to give=20
-testimony that "proves" their innocence. Obviously the system would be in =
-serious trouble if too many=20
-people belonged to such groups. Some of the=20
-early-20th century Chinese thinkers who were concerned with modernizing =
-China recognized the necessity=20
-of breaking down small-scale social groups such as the family: "(According =
-to Sun Yat-sen) The Chinese=20
-people needed a new surge of patriotism, which would lead to a transfer of =
-loyalty from the family to the=20
-state. . .(According to Li Huang) traditional attachments, particularly to =
-the family had to be abandoned if=20
-nationalism were to develop to China." (Chester C. Tan, Chinese Political =
-Thought in the Twentieth=20
-Century," page 125, page 297.)=20
-
-8. (Paragraph 56) Yes, we know that 19th century America had its problems, =
-and serious ones, but for the=20
-sake of breviety we have to express ourselves in simplified terms.=20
-
-9. (Paragraph 61) We leave aside the underclass. We are speaking of the =
-mainstream.=20
-
-10. (Paragraph 62) Some social scientists, educators, "mental health" =
-professionals and the like are doing=20
-their best to push the social drives into group 1 by trying to see to it =
-that everyone has a satisfactory social=20
-life.=20
-
-11. (Paragraphs 63, 82) Is the drive for endless material acquisition =
-really an artificial creation of the=20
-advertising and marketing industry? Certainly there is no innate human =
-drive for material acquisition.=20
-There have been many cultures in which people have desired little material =
-wealth beyond what was=20
-necessary to satisfy their basic physical needs (Australian aborigines, =
-traditional Mexican peasant culture,=20
-some African cultures). On the other hand there have also been many =
-pre-industrial cultures in which=20
-material acquisition has played an important role. So we can't claim that =
-today's acquisition-oriented=20
-culture is exclusively a creation of the advertising and marketing =
-industry. But it is clear that the=20
-advertising and marketing industry has had an=20
-important part in creating that culture. The big corporations that spend =
-millions on advertising wouldn't be=20
-spending that kind of money without solid proof that they were getting it =
-back in increased sales. One=20
-member of FC met a sales manager a couple of years ago who was frank enough =
-to tell him, "Our job is to=20
-make people buy things they don't want and don't need." He then described =
-how an untrained novice could=20
-present people with the facts about a product, and make no sales at all, =
-while a trained and experienced=20
-professional salesman would make lots of sales to the same people. This =
-shows that people are manipulated=20
-into buying things they don't really want.=20
-
-12. (Paragraph 64) The problem of purposelessness seems to have become less =
-serious during the last 15=20
-years or so, because people now feel less secure physically and =
-economically than they did earlier, and the=20
-need for security provides them with a goal. But purposelessness has been =
-replaced by frustration over the=20
-difficulty of attaining security. We emphasize the problem of =
-purposelessness because the liberals and=20
-leftists would wish to solve our social problems by having society =
-guarantee everyone's security; but if that=20
-could be done it would only bring back the problem of purposelessness. The =
-real issue is not whether=20
-society provides well or poorly for people's security; the trouble is that =
-people are dependent on the system=20
-for=20
-their security rather than having it in their own hands. This, by the way, =
-is part of the reason why some=20
-people get worked up about the right to bear arms; possession of a gun puts =
-that aspect of their security in=20
-their own hands.=20
-
-13. (Paragraph 66) Conservatives' efforts to decrease the amount of =
-government regulation are of little=20
-benefit to the average man. For one thing, only a fraction of the =
-regulations can be eliminated because most=20
-regulations are necessary. For another thing, most of the deregulation =
-affects business rather than the=20
-average individual, so that its main effect is to take power from the =
-government and give it to private=20
-corporations. What this means for the average man is that government =
-interference in his life is replaced by=20
-interference from big corporations, which may be permitted, for e xample, =
-to dump more chemicals that=20
-get into his water supply and give him cancer. The conservatives are just =
-taking the average man for a=20
-sucker, exploiting his resentment of Big Government to promote the power of =
-Big Business.=20
-
-14. (Paragraph 73) When someone approves of the purpose for which =
-propaganda is being used in a given=20
-case, he generally calls it "education" or applies to it some similar =
-euphemism. But propaganda is=20
-propaganda regardless of the purpose for which it i s used.=20
-
-15. (Paragraph 83) We are not expressing approval or disapproval of the =
-Panama invasion. We only use it=20
-to illustrate a point.=20
-
-16. (Paragraph 95) When the American colonies were under British rule there =
-were fewer and less effective=20
-legal guarantees of freedom than there were after the American Constitution =
-went into effect, yet there was=20
-more personal freedom in pre-industria l America, both before and after the =
-War of Independence, than=20
-there was after the Industrial Revolution took hold in this country. We =
-quote from "Violence in America:=20
-Historical and Comparative perspectives," edited by Hugh Davis Graham and =
-Ted Robert Gurr, Chapter 12=20
-by Roger Lane, pages 476-478: "The progressive heightening of standards o f =
-property, and with it the=20
-increasing reliance on official law enforcement (in 19th century America). =
-.. .were common to the whole=20
-society. . .[T]he change in social behavior=20
-is so long term and so widespread as to suggest a connection with the most =
-funda mental of contemporary=20
-social processes; tha t of industrial urbanization itself. . =
-.."Massachusetts in 1835 had a population of some=20
-660,940, 81 percent rural, overwhelmingly preindustrial and native born. =
-It's citizens were used to=20
-considerable personal freedom. Whether teamsters, farmers or artisa ns, =
-they were all accustomed to setting=20
-thei r own schedules, and the nature of their work made them physically =
-dependent on each other. .=20
-..Individual problems, sins or even crimes, were not generally cause for =
-wider social concern. . ."But the=20
-impact of the twin movements to the city and to the fac tory, both just =
-gathering force in 1835, had a=20
-progressive effect on personal behavior=20
-throughout the 19th century and into the 20th. The factory demanded =
-regularity of behavior, a life=20
-governed by obedience to the rhythms of clock and calendar, the demands of =
-foreman and supervisor. In=20
-the city or town, the needs of living in closely packed neighborhoods =
-inhibited many actions previously=20
-unobjectionable.=20
-
-Both blue- and white-collar employees in larger establishments were =
-mutually dependent on their fellows.=20
-as one man's work fit into another's, so one man's business was no longer =
-his own. "The results of the new=20
-organization of life and work were appar ent by 1900, when some 76 percent =
-of the 2,8 05,346 inhabitants=20
-of Massachusetts were classified as urbanites. Much violent or irregular =
-behavior which had been tolerable=20
-in a casual, independent society was no longer acceptable in the more =
-formalized, cooperative atmosphere=20
-of the later period. . . The move to the cities had, in short, produc ed a =
-more tractable, more socialized,=20
-more 'civilized' generation than its predecessors."=20
-
-17. (Paragraph 117) Apologists for the system are fond of citing cases in =
-which elections have been=20
-decided by one or two votes, but such cases are rare.=20
-
-18. (Paragraph 119) "Today, in technologically advanced lands, men live =
-very similar lives in spite of=20
-geographical, religious and political differences. The daily lives of a =
-Christian bank clerk in Chicago, a=20
-Buddhist bank clerk in Tokyo, a Communist bank clerk in Moscow are far more =
-alike than the life any one=20
-of them is like that of any single man who lived a thousand years ago. =
-These similarities are the result of a=20
-common technology. . ." L. Sprague de Camp, "The Ancient Engineers," =
-Ballentine edition, page 17.=20
-
-The lives of the three bank clerks are not IDENTICAL. Ideology does have =
-SOME effect. But all=20
-technological societies, in order to survive, must evolve along =
-APPROXIMATELY the same trajectory.=20
-
-19. (Paragraph 123) Just think an irresponsible genetic engineer might =
-create a lot of terrorists.=20
-
-20. (Paragraph 124) For a further example of undesirable consequences of =
-medical progress, suppose a=20
-reliable cure for cancer is discovered. Even if the treatment is too =
-expensive to be available to any but the=20
-elite, it will greatly reduce their incen tive to stop the escape of =
-carcinogens into the environment.=20
-
-21. (Paragraph 128) Since many people may find paradoxical the notion that =
-a large number of good things=20
-can add up to a bad thing, we will illustrate with an analogy. Suppose Mr. =
-A is playing chess with Mr. B.=20
-Mr. C, a Grand Master, is looking over Mr . A's shoulder. Mr. A of course =
-wants to win his game, so if Mr.=20
-C points out a good move for him to make, he is doing Mr. A a favor. But =
-suppose now that Mr. C tells Mr.=20
-A how to make ALL of his moves. In each particular instance he does Mr. A a =
-favor by showing him his=20
-best move, but by making AL L of his moves for him he spoils the game, s =
-ince there is not point in Mr.=20
-A's playing the game at all if someone else makes all his moves.=20
-
-The situation of modern man is analogous to that of Mr. A. The system makes =
-an individual's life easier for=20
-him in innumerable ways, but in doing so it deprives him of control over =
-his own fate.=20
-
-22. (Paragraph 137) Here we are considering only the conflict of values =
-within the mainstream. For the=20
-sake of simplicity we leave out of the picture "outsider" values like the =
-idea that wild nature is more=20
-important than human economic welfare.=20
-
-23. (Paragraph 137) Self-interest is not necessarily MATERIAL =
-self-interest. It can consist in fulfillment of=20
-some psychological need, for example, by promoting one's own ideology or =
-religion.=20
-
-24. (Paragraph 139) A qualification: It is in the interest of the system to =
-permit a certain prescribed degree=20
-of freedom in some areas. For example, economic freedom (with suitable =
-limitations and restraints) has=20
-proved effective in promoting economic growth. But only planned, =
-circumscribed, li mited freedom is in=20
-the interest of the system. The individual must always be kept on a leash, =
-even if the leash is sometimes=20
-long( see paragraphs 94, 97).=20
-
-25. (Paragraph 143) We don't mean to suggest that the efficiency or the =
-potential for survival of a society=20
-has always been inversely proportional to the amount of pressure or =
-discomfort to which the society=20
-subjects people. That is certainly not the c ase. There is good reason to =
-believe that ma ny primitive=20
-societies subjected people to less pressure than the European society did, =
-but European society proved far=20
-more efficient than any primitive society and always won out in conflicts =
-with such societies because of the=20
-advantages conferred by te chnology.=20
-
-26. (Paragraph 147) If you think that more effective law enforcement is =
-unequivocally good because it=20
-suppresses crime, then remember that crime as defined by the system is not =
-necessarily what YOU would=20
-call crime. Today, smoking marijuana is a "crime ," and, in some places in =
-the U.S.., so is p ossession of=20
-ANY firearm, registered or not, may be made a crime, and the same thing may =
-happen with disapproved=20
-methods of child-rearing, such as spanking. In some countries, expression =
-of dissident political opinions is=20
-a crime, and there is no certaint y that this will never happen in the =
-U.S., s ince no constitution or political=20
-system lasts forever.=20
-
-If a society needs a large, powerful law enforcement establishment, then =
-there is something gravely wrong=20
-with that society; it must be subjecting people to severe pressures if so =
-many refuse to follow the rules, or=20
-follow them only because forced. Man y societies in the past have gotten by =
-with little or no formal law-
-enforcement.=20
-
-27. (Paragraph 151) To be sure, past societies have had means of =
-influencing behavior, but these have been=20
-primitive and of low effectiveness compared with the technological means =
-that are now being developed.=20
-
-28. (Paragraph 152) However, some psychologists have publicly expressed =
-opinions indicating their=20
-contempt for human freedom. And the mathematician Claude Shannon was quoted =
-in Omni (August 1987)=20
-as saying, "I visualize a time when we will be to robots what dogs are to =
-humans, and I'm rooting fo r the=20
-machines."=20
-
-29. (Paragraph 154) This is no science fiction! After writing paragraph 154 =
-we came across an article in=20
-Scientific American according to which scientists are actively developing =
-techniques for identifying=20
-possible future criminals and for treating the m by a combination of =
-biological and psychol ogical means.=20
-Some scientists advocate compulsory application of the treatment, which may =
-be available in the near=20
-future. (See "Seeking the Criminal Element", by W. Wayt Gibbs, Scientific =
-American, March 1995.)=20
-Maybe you think this is OK because the trea tment would be applied to those =
-who might be come drunk=20
-drivers (they endanger human life too), then perhaps to peel who spank =
-their children, then to=20
-environmentalists who sabotage logging equipment,=20
-eventually to anyone whose behavior is inconvenient for the system. =
-
-
-30. (Paragraph 184) A further advantage of nature as a counter-ideal to =
-technology is that, in many people,=20
-nature inspires the kind of reverence that is associated with religion, so =
-that nature could perhaps be=20
-idealized on a religious basis. It is tr ue that in many societies religion =
-has serve d as a support and=20
-justification for the established order, but it is also true that religion =
-has often provided a basis for=20
-rebellion. Thus it may be useful to introduce a religious element into the =
-rebellion against technology, the=20
-more so because Weste rn society today has no strong religious fou ndation. =
-
-
-Religion, nowadays either is used as cheap and transparent support for =
-narrow, short-sighted selfishness=20
-(some conservatives use it this way), or even is cynically exploited to =
-make easy money (by many=20
-evangelists), or has degenerated into crude irrati onalism (fundamentalist =
-Protestant sects, "c ults"), or is=20
-simply stagnant (Catholicism, main-line Protestantism). The nearest thing =
-to a strong, widespread, dynamic=20
-religion that the West has seen in recent times has been the quasi-religion =
-of leftism, but leftism today is=20
-fragmented and has no cle ar, unified inspiring goal.=20
-
-Thus there is a religious vaccuum in our society that could perhaps be =
-filled by a religion focused on nature=20
-in opposition to technology. But it would be a mistake to try to concoct =
-artificially a religion to fill this=20
-role. Such an invented religion would probably be a failure. Take the =
-"Gaia" religion for example. Do its=20
-adherents REALLY believe in it or are they just play-acting? If they are =
-just play-acting their religion will=20
-be a flop in the end.=20
-
-It is probably best not to try to introduce religion into the conflict of =
-nature vs. technology unless you=20
-REALLY believe in that religion yourself and find that it arouses a deep, =
-strong, genuine response in many=20
-other people.=20
-
-31. (Paragraph 189) Assuming that such a final push occurs. Conceivably the =
-industrial system might be=20
-eliminated in a somewhat gradual or piecemeal fashion. (see paragraphs 4, =
-167 and Note 4).=20
-
-32. (Paragraph 193) It is even conceivable (remotely) that the revolution =
-might consist only of a massive=20
-change of attitudes toward technology resulting in a relatively gradual and =
-painless disintegration of the=20
-industrial system. But if this happens we'll be very lucky. It's far more =
-probably that the transition to a=20
-nontechnological society will be very difficult and full of conflicts and =
-disasters.=20
-
-33. (Paragraph 195) The economic and technological structure of a society =
-are far more important than its=20
-political structure in determining the way the average man lives (see =
-paragraphs 95, 119 and Notes 16, 18).=20
-
-34. (Paragraph 215) This statement refers to our particular brand of =
-anarchism. A wide variety of social=20
-attitudes have been called "anarchist," and it may be that many who =
-consider themselves anarchists would=20
-not accept our statement of paragraph 215. It should be noted, by the way, =
-that there is a nonviolent=20
-anarchist movement whose members probably would not accept FC as anarchist =
-and certainly would not=20
-approve of FC's violent methods.=20
-
-35. (Paragraph 219) Many leftists are motivated also by hostility, but the =
-hostility probably results in part=20
-from a frustrated need for power.=20
-
-36. (Paragraph 229) It is important to understand that we mean someone who =
-sympathizes with these=20
-MOVEMENTS as they exist today in our society. One who believes that women, =
-homosexuals, etc., should=20
-have equal rights is not necessarily a leftist. The f eminist, gay rights, =
-etc., movements that ex ist in our=20
-society have the particular ideological tone that characterizes leftism, =
-and if one believes, for example, that=20
-women should have equal rights it does not necessarily follow that one must =
-sympathize with the feminist=20
-movement as it exists today .=20
-
-If copyright problems make it impossible for this long quotation to be =
-printed, then please change Note 16=20
-to read as follows:=20
-
-16. (Paragraph 95) When the American colonies were under British rule there =
-were fewer and less effective=20
-legal guarantees of freedom than there were after the American Constitution =
-went into effect, yet there was=20
-more personal freedom in pre-industria l America, both before and after the =
-War of Independence, than=20
-there was after the Industrial Revolution took hold in this country. In =
-"Violence in America: Historical and=20
-Comparative Perspectives," edited by Hugh Davis Graham and Ted Robert Gurr, =
-Chapter 12 by Roger=20
-Lane, it is explained how in pr e-industrial America the average person had =
-greater independence and=20
-autonomy than he does today, and how the process of industrialization =
-necessarily led to the restriction of=20
-personal freedom.
-
-
-End of message.
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No. 7 - MIME text and attachment
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-6>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: multipart/mixed;
-  boundary="boundary-replacement-string-1"
-
-This is a MIME Message
-
---boundary-replacement-string-1
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Disposition: inline
-Content-Transfer-Encoding: quoted-printable
-
-here is some text
-
---boundary-replacement-string-1
-Content-Description: deisl1.isu
-Content-Type: application/octet-stream
-Content-Disposition: attachment;
-	filename="deisl1.isu"
-Content-Transfer-Encoding: base64
-
-cagAAAECqE4CACkAU3RpcmxpbmcgVGVjaG5vbG9naWVzLCBJbmMuIChjKSAx
-OTkwLTE5OTUeANzQzSjj0Mwm6tDMJvHQzib40Dsr/9AhJwbRzCafhygA3tDP
-JjAjGCjq0MyJ9dDMifzQzIv/08x7WBzOJg3RIysU0SMrG9EwJ4AAAAD/AAD/
-AAAA//8A/wAAAP8A/wD//wAA////AHd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3
-d3d3d3d3d3d3d3d3d3AAAAAAAAAAB3d3d3d3d3d4d3d3d3d3dwd3d3d3d3d3
-eP////////cHd3d3d3d3d3j////////3B3d3d3d3d3d4////////9wd3d3d3
-d3d3eP////////cHd3d3d3d3d3j4AAAAD//3B3d3d3d3d3d4+HgI9w//9wd3
-d3d3d3d3ePh4iIcP//cHd3d3d3d3d3j4d3d3ARERF3d3d3d3d3d4+H//9wzM
-zMd3d3d3d3d3ePh///cP//cHd3d3d3d3d3j4f//3D//3B3d3d3d3d3d494iI
-iP//9wd3d3d3d3d3eP////////cHd3d3d3d3d3j////////3B3d3d3d3d3d4
-//////+IiAd3d3d3d3d3eP//////j3h3d3d3d3d3d3j//////4eHd3d3d3d3
-d3d4//////+Id3d3d3d3d3d3eIiIiIiIh3d3d3d3d3d3d3d3d3d3d3d3d3d3
-d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3dwAAAAd3d3d3d3d3d3d3d3cIiIgHd3
-d3d3d3d3d3d3d3CIiIB3d3d3d3d3d3d3d3dwiIiAd3d3d3d3d3d3d3d3cIiI
-gHd3d3d3d3d3d3dwAACIiIAAAHd3d3d3d3d3cIiIiIiIiIB3d3d3d3d3d3cI
-iIiIiIgHd3d3d3d3d3d3cIiIiIiAd3d3d3d3d3d3d3cIiIiIB3d3d3d3d3d3
-d3d3cIiIgHd3d3d3d3d3d3d3d3cIiAd3d3d3d3d3d3d3d3d3cIB3d3d3d3d3
-d3d3d3d3d3cHd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3
-d3d3d3d3AAAAAAAAAAAAAAAHd3d3eDMzMzMzMzMzMzMzMHd3d3i3t7e3t7e3
-t7e3tzAHd3eIe3t7e3t7e3t7e3swB3d3h7e3t7e3t7e3t7e3AAd3d4t7e3t7
-e3t7e3t7eAMHd3eHt7e3t7e3t7e3t7gDB3d4e3t7e3t7e3t7e3twgwd3eLe3
-t7e3t7e3t7e3sIMHd3h7e3t7e3t7e3t7e4CzB3d4t7e3t7e3t7e3t7eAcwd3
-eP//////////////CLMHd3eId3d3d3d3d3d3d3tzB3d3d4+3t7e3t7e3t7e3
-swd3d3ePe3t7e3t7e3t7e3MHd3d3j7e3t7e3t7e3t7ezB3d3d497e3t7e3t7
-////8Hd3d3ePt7e3t7e3uIiIiId3d3d3j/t7e3t7ewoA3NDMJkfRzSafhwoA
-3NDMJkjRzSafhz0A5NAgnFU/PZBVNs4mItHMJ/jS1CZTRj+Vdjo4jBnRQJyG
-Pz2Qhjb7i5o23iZ9Rj+VoDo4jHs2NpWxRRiMAA==
-
---boundary-replacement-string-1
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Disposition: inline
-Content-Transfer-Encoding: quoted-printable
-
-Here is some more text. The attachment is above.
---=20
-The curator
-
---boundary-replacement-string-1--
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.6 - Encoded "=" characters
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-7>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The following line contains 5 "equals" characters. These should
-arrive MIME-encoded.
-
-=3D=3D=3D=3D=3D
-
-End of message.
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.5 - Empty message body
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-8>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.4 - Trailing spaces and tab characters
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-9>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This line has 1 trailing space character >=20
-This line has 2 trailing space characters> =20
-This line has 3 trailing space characters>  =20
-This line has 4 trailing space characters>   =20
-
-This line has 1 trailing TAB character >=09
-This line has 2 trailing TAB characters>	=09
-This line has 3 trailing TAB characters>		=09
-This line has 4 trailing TAB characters>			=09
-
-End of message.
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.3 - Wrapped lines
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-10>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This message contains a series of lines - which
-range between 90 and 70 characters in length.
-
-
-90CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-78901234567890
-
-89CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789
-
-88CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-789012345678
-
-87CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-78901234567
-
-86CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456
-
-85CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-789012345
-
-84CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-78901234
-
-83CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-7890123
-
-82CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-789012
-
-81CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-78901
-
-80CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-7890
-
-79CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-789
-
-78CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-78
-
-77CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-7
-
-76CHARS890123456789012345678901234567890123456789012345678901234567890123456=
-
-
-75CHARS89012345678901234567890123456789012345678901234567890123456789012345
-
-74CHARS8901234567890123456789012345678901234567890123456789012345678901234
-
-73CHARS890123456789012345678901234567890123456789012345678901234567890123
-
-72CHARS89012345678901234567890123456789012345678901234567890123456789012
-
-71CHARS8901234567890123456789012345678901234567890123456789012345678901
-
-70CHARS890123456789012345678901234567890123456789012345678901234567890
-
-End of message.
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.2 - Dot stuffing test
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-11>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-This message contains a block of dot characters,=20
-arranged into the shape of a triangle. There are=20
-four rows in the triangle; the first row contains
-4 dots, the last row contains 1 dot.
-
-.....
-....
-...
-..
-
-..This line should contain a "dot" as its first character.
-
-End of message.
-
-.
-RSET
-MAIL FROM:<test@psion9.demon.co.uk>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP Test1" <test@psion9.demon.co.uk>
-Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-12>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
+Subject: Test message No.9 
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This msg should be sent 4 times=20
+  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
+
+  should not appear in the msg header.
+
+ -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
+the 'To' & 'Cc'
+  recipients.  All 'Bcc' recipients should not appear in the header except =
+the one to=20
+  whom the mail is addressed to.
+
+
+End of message.
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
+Bcc: recyclebin@lon-msgtest06.intra
+Subject: Test message No.9 
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-2>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This msg should be sent 4 times=20
+  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
+
+  should not appear in the msg header.
+
+ -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
+the 'To' & 'Cc'
+  recipients.  All 'Bcc' recipients should not appear in the header except =
+the one to=20
+  whom the mail is addressed to.
+
+
+End of message.
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
+Bcc: recyclebin@lon-msgtest06.intra
+Subject: Test message No.9 
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-3>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This msg should be sent 4 times=20
+  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
+
+  should not appear in the msg header.
+
+ -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
+the 'To' & 'Cc'
+  recipients.  All 'Bcc' recipients should not appear in the header except =
+the one to=20
+  whom the mail is addressed to.
+
+
+End of message.
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Cc: recyclebin@lon-msgtest06.intra, recyclebin@lon-msgtest06.intra
+Bcc: recyclebin@lon-msgtest06.intra
+Subject: Test message No.9 
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-4>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This msg should be sent 4 times=20
+  -Send one msg to 'To' & 'Cc' recipients. In this case 'Bcc' recipients =
+
+  should not appear in the msg header.
+
+ -Send one Msg per 'Bcc' recipient, in each msg the header will show all =
+the 'To' & 'Cc'
+  recipients.  All 'Bcc' recipients should not appear in the header except =
+the one to=20
+  whom the mail is addressed to.
+
+
+End of message.
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: <recyclebin@lon-msgtest06.intra>
+Subject: Test message No.8 - Long message (206KB)
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-5>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+INTRODUCTION
+
+1. The Industrial Revolution and its consequences have been a disaster for =
+the human race. They have=20
+greatly increased the life-expectancy of those of us who live in "advanced" =
+countries, but they have=20
+destabilized society, have made life unfulfilling, have subjected human =
+beings to indignities, have led to=20
+widespread psychological suffering (in the Third World to physical =
+suffering as well) and have inflicted=20
+severe damage on the natural world. The continued development of technology =
+will worsen the situation. It=20
+will certainly subject human beings to greater indignities and inflict =
+greater damage on the natural world, it=20
+will probably lead to greater social disruption and psychological =
+suffering, and it may lead to increased=20
+physical suffering even in "advanced" countries.=20
+
+2. The industrial-technological system may survive or it may break down. If =
+it survives, it MAY eventually=20
+achieve a low level of physical and psychological suffering, but only after =
+passing through a long and very=20
+painful period of adjustment and only at the cost of permanently reducing =
+human beings and many other=20
+living organisms to engineered products and mere cogs in the social =
+machine. Furthermore, if the system=20
+survives, the consequences will be inevitable: There is no way of reforming =
+or modifying the system so as=20
+to prevent it from depriving people of dignity and autonomy.=20
+
+3. If the system breaks down the consequences will still be very painful. =
+But the bigger the system grows=20
+the more disastrous the results of its breakdown will be, so if it is to =
+break down it had best break down=20
+sooner rather than later.=20
+
+4. We therefore advocate a revolution against the industrial system. This =
+revolution may or may not make=20
+use of violence: it may be sudden or it may be a relatively gradual process =
+spanning a few decades. We=20
+can't predict any of that. But we do outline in a very general way the =
+measures that those who hate the=20
+industrial system should take in order to prepare the way for a revolution =
+against that form of society. This=20
+is not to be a POLITICAL revolution. Its object will be to overthrow not =
+governments but the economic=20
+and technological basis of the present society.=20
+
+5. In this article we give attention to only some of the negative =
+developments that have grown out of the=20
+industrial-technological system. Other such developments we mention only =
+briefly or ignore altogether.=20
+This does not mean that we regard these other developments as unimportant. =
+For practical reasons we have=20
+to confine our discussion to areas that have received insufficient public =
+attention or in which we have=20
+something new to say. For example, since there are well-developed =
+environmental and wilderness=20
+movements, we have written very little about environmental degradation or =
+the destruction of wild nature,=20
+even though we consider these to be highly important.=20
+
+THE PSYCHOLOGY OF MODERN LEFTISM
+
+6. Almost everyone will agree that we live in a deeply troubled society. =
+One of the most widespread=20
+manifestations of the craziness of our world is leftism, so a discussion of =
+the psychology of leftism can=20
+serve as an introduction to the discussion of the problems of modern =
+society in general.=20
+
+7. But what is leftism? During the first half of the 20th century leftism =
+could have been practically=20
+identified with socialism. Today the movement is fragmented and it is not =
+clear who can properly be called=20
+a leftist. When we speak of leftists in this article we have in mind mainly =
+socialists, collectivists,=20
+"politically correct" types, feminists, gay and disability activists, =
+animal rights activists and the like. But=20
+not everyone who is associated with one of these movements is a leftist. =
+What we are trying to get at in=20
+discussing leftism is not so much a movement or an ideology as a =
+psychological type, or rather a collection=20
+of related types. Thus, what we mean by "leftism" will emerge more clearly =
+in the course of our discussion=20
+of leftist psychology (Also, see paragraphs 227-230.)=20
+
+8. Even so, our conception of leftism will remain a good deal less clear =
+than we would wish, but there=20
+doesn't seem to be any remedy for this. All we are trying to do is indicate =
+in a rough and approximate way=20
+the two psychological tendencies that we believe are the main driving force =
+of modern leftism. We by no=20
+means claim to be telling the WHOLE truth about leftist psychology. Also, =
+our discussion is meant to=20
+apply to modern leftism only. We leave open the question of the extent to =
+which our discussion could be=20
+applied to the leftists of the 19th and early 20th century.=20
+
+9. The two psychological tendencies that underlie modern leftism we call =
+"feelings of inferiority" and=20
+"oversocialization." Feelings of inferiority are characteristic of modern =
+leftism as a whole, while=20
+oversocialization is characteristic only of a certain segment of modern =
+leftism; but this segment is highly=20
+influential.=20
+
+FEELINGS OF INFERIORITY
+
+10. By "feelings of inferiority" we mean not only inferiority feelings in =
+the strictest sense but a whole=20
+spectrum of related traits: low self-esteem, feelings of powerlessness, =
+depressive tendencies, defeatism,=20
+guilt, self-hatred, etc. We argue that modern leftists tend to have such =
+feelings (possibly more or less=20
+repressed) and that these feelings are decisive in determining the =
+direction of modern leftism.=20
+
+11. When someone interprets as derogatory almost anything that is said =
+about him (or about groups with=20
+whom he identifies) we conclude that he has inferiority feelings or low =
+self-esteem. This tendency is=20
+pronounced among minority rights advocates, whether or not they belong to =
+the minority groups whose=20
+rights they defend. They are hypersensitive about the words used to =
+designate minorities. The terms=20
+"negro," "oriental," "handicapped" or "chick" for an African, an Asian, a =
+disabled person or a woman=20
+originally had no derogatory connotation. "Broad" and "chick" were merely =
+the feminine equivalents of=20
+"guy," "dude" or "fellow." The negative connotations have been attached to =
+these terms by the activists=20
+themselves. Some animal rights advocates have gone so far as to reject the =
+word "pet" and=20
+insist on its replacement by "animal companion." Leftist anthropologists go =
+to great lengths to avoid saying=20
+anything about primitive peoples that could conceivably be interpreted as =
+negative. They want to replace=20
+the word "primitive" by "nonliterate." They seem almost paranoid about =
+anything that might suggest that=20
+any primitive culture is inferior to our own. (We do not mean to imply that =
+primitive cultures ARE inferior=20
+to ours. We merely point out the hypersensitivity of leftish =
+anthropologists.)=20
+
+12. Those who are most sensitive about "politically incorrect" terminology =
+are not the average black=20
+ghetto-dweller, Asian immigrant, abused woman or disabled person, but a =
+minority of activists, many of=20
+whom do not even belong to any "oppressed" group but come from privileged =
+strata of society. Political=20
+correctness has its stronghold among university professors, who have secure =
+employment with comfortable=20
+salaries, and the majority of whom are heterosexual, white males from =
+middle-class families.=20
+
+13. Many leftists have an intense identification with the problems of =
+groups that have an image of being=20
+weak (women), defeated (American Indians), repellent (homosexuals), or =
+otherwise inferior. The leftists=20
+themselves feel that these groups are inferior. They would never admit it =
+to themselves that they have such=20
+feelings, but it is precisely because they do see these groups as inferior =
+that they identify with their=20
+problems. (We do not suggest that women, Indians, etc., ARE inferior; we =
+are only making a point about=20
+leftist psychology).=20
+
+14. Feminists are desperately anxious to prove that women are as strong as =
+capable as men. Clearly they=20
+are nagged by a fear that women may NOT be as strong and as capable as men. =
+
+
+15. Leftists tend to hate anything that has an image of being strong, good =
+and successful. They hate=20
+America, they hate Western civilization, they hate white males, they hate =
+rationality. The reasons that=20
+leftists give for hating the West, etc. clearly do not correspond with =
+their real motives. They SAY they hate=20
+the West because it is warlike, imperialistic, sexist, ethnocentric and so =
+forth, but where these same faults=20
+appear in socialist countries or in primitive cultures, the leftist finds =
+excuses for them, or at best he=20
+GRUDGINGLY admits that they exist; whereas he ENTHUSIASTICALLY points out =
+(and often greatly=20
+exaggerates) these faults where they appear in Western civilization. Thus =
+it is clear that these faults are not=20
+the leftist's real motive for hating America and the West.
+ He hates America and the West because they are strong and successful. =
+
+
+16. Words like "self-confidence," "self-reliance," "initiative", =
+"enterprise," "optimism," etc. play little role=20
+in the liberal and leftist vocabulary. The leftist is anti-individualistic, =
+pro-collectivist. He wants society to=20
+solve everyone's needs for them, take care of them. He is not the sort of =
+person who has an inner sense of=20
+confidence in his own ability to solve his own problems and satisfy his own =
+needs. The leftist is=20
+antagonistic to the concept of competition because, deep inside, he feels =
+like a loser.=20
+
+17. Art forms that appeal to modern leftist intellectuals tend to focus on =
+sordidness, defeat and despair, or=20
+else they take an orgiastic tone, throwing off rational control as if there =
+were no hope of accomplishing=20
+anything through rational calculation and all that was left was to immerse =
+oneself in the sensations of the=20
+moment.=20
+
+18. Modern leftist philosophers tend to dismiss reason, science, objective =
+reality and to insist that=20
+everything is culturally relative. It is true that one can ask serious =
+questions about the foundations of=20
+scientific knowledge and about how, if at all, the concept of objective =
+reality can be defined. But it is=20
+obvious that modern leftist philosophers are not simply cool-headed =
+logicians systematically analyzing the=20
+foundations of knowledge. They are deeply involved emotionally in their =
+attack on truth and reality. They=20
+attack these concepts because of their own psychological needs. For one =
+thing, their attack is an outlet for=20
+hostility, and, to the extent that it is successful, it satisfies the drive =
+for power. More importantly, the leftist=20
+hates science and rationality because=20
+they classify certain beliefs as true (i.e., successful, superior) and =
+other beliefs as false (i.e. failed, inferior).=20
+The leftist's feelings of inferiority run so deep that he cannot tolerate =
+any classification of some things as=20
+successful or superior and other things as failed or inferior. This also =
+underlies the rejection by many=20
+leftists of the concept of mental illness and of the utility of IQ tests. =
+Leftists are antagonistic to genetic=20
+explanations of human abilities or behavior because such explanations tend =
+to make some persons appear=20
+superior or inferior to others. Leftists prefer to give society the credit =
+or blame for an individual's ability or=20
+lack of it. Thus if a person is "inferior" it is not his fault, but =
+society's, because he has not been brought up=20
+properly.=20
+
+19. The leftist is not typically the kind of person whose feelings of =
+inferiority make him a braggart, an=20
+egotist, a bully, a self-promoter, a ruthless competitor. This kind of =
+person has not wholly lost faith in=20
+himself. He has a deficit in his sense of power and self-worth, but he can =
+still conceive of himself as having=20
+the capacity to be strong, and his efforts to make himself strong produce =
+his unpleasant behavior. [1] But=20
+the leftist is too far gone for that. His feelings of inferiority are so =
+ingrained that he cannot conceive of=20
+himself as individually strong and valuable. Hence the collectivism of the =
+leftist. He can feel strong only as=20
+a member of a large organization or a mass movement with which he =
+identifies himself.=20
+
+20. Notice the masochistic tendency of leftist tactics. Leftists protest by =
+lying down in front of vehicles,=20
+they intentionally provoke police or racists to abuse them, etc. These =
+tactics may often be effective, but=20
+many leftists use them not as a means to an end but because they PREFER =
+masochistic tactics. Self-hatred=20
+is a leftist trait.=20
+
+21. Leftists may claim that their activism is motivated by compassion or by =
+moral principle, and moral=20
+principle does play a role for the leftist of the oversocialized type. But =
+compassion and moral principle=20
+cannot be the main motives for leftist activism. Hostility is too prominent =
+a component of leftist behavior;=20
+so is the drive for power. Moreover, much leftist behavior is not =
+rationally calculated to be of benefit to the=20
+people whom the leftists claim to be trying to help. For example, if one =
+believes that affirmative action is=20
+good for black people, does it make sense to demand affirmative action in =
+hostile or dogmatic terms?=20
+Obviously it would be more productive to take a diplomatic and conciliatory =
+approach that would make at=20
+least verbal and symbolic concessions to white people who think that =
+
+affirmative action discriminates against them. But leftist activists do not =
+take such an approach because it=20
+would not satisfy their emotional needs. Helping black people is not their =
+real goal. Instead, race problems=20
+serve as an excuse for them to express their own hostility and frustrated =
+need for power. In doing so they=20
+actually harm black people, because the activists' hostile attitude toward =
+the white majority tends to=20
+intensify race hatred.=20
+
+22. If our society had no social problems at all, the leftists would have =
+to INVENT problems in order to=20
+provide themselves with an excuse for making a fuss.=20
+
+23. We emphasize that the foregoing does not pretend to be an accurate =
+description of everyone who might=20
+be considered a leftist. It is only a rough indication of a general =
+tendency of leftism.=20
+
+OVERSOCIALIZATION
+
+24. Psychologists use the term "socialization" to designate the process by =
+which children are trained to=20
+think and act as society demands. A person is said to be well socialized if =
+he believes in and obeys the=20
+moral code of his society and fits in well as a functioning part of that =
+society. It may seem senseless to say=20
+that many leftists are over-socialized, since the leftist is perceived as a =
+rebel. Nevertheless, the position can=20
+be defended. Many leftists are not such rebels as they seem.=20
+
+25. The moral code of our society is so demanding that no one can think, =
+feel and act in a completely moral=20
+way. For example, we are not supposed to hate anyone, yet almost everyone =
+hates somebody at some time=20
+or other, whether he admits it to himself or not. Some people are so highly =
+socialized that the attempt to=20
+think, feel and act morally imposes a severe burden on them. In order to =
+avoid feelings of guilt, they=20
+continually have to deceive themselves about their own motives and find =
+moral explanations for feelings=20
+and actions that in reality have a non-moral origin. We use the term =
+"oversocialized" to describe such=20
+people. [2]=20
+
+26. Oversocialization can lead to low self-esteem, a sense of =
+powerlessness, defeatism, guilt, etc. One of=20
+the most important means by which our society socializes children is by =
+making them feel ashamed of=20
+behavior or speech that is contrary to society's expectations. If this is =
+overdone, or if a particular child is=20
+especially susceptible to such feelings, he ends by feeling ashamed of =
+HIMSELF. Moreover the thought=20
+and the behavior of the oversocialized person are more restricted by =
+society's expectations than are those of=20
+the lightly socialized person. The majority of people engage in a =
+significant amount of naughty behavior.=20
+They lie, they commit petty thefts, they break traffic laws, they goof off =
+at work, they hate someone, they=20
+say spiteful things or they use some underhanded trick to get ahead of the =
+
+other guy. The oversocialized person cannot do these things, or if he does =
+do them he generates in himself=20
+a sense of shame and self-hatred. The oversocialized person cannot even =
+experience, without guilt,=20
+thoughts or feelings that are contrary to the accepted morality; he cannot =
+think "unclean" thoughts. And=20
+socialization is not just a matter of morality; we are socialized to =
+confirm to many norms of behavior that=20
+do not fall under the heading of morality. Thus the oversocialized person =
+is kept on a psychological leash=20
+and spends his life running on rails that society has laid down for him. In =
+many oversocialized people this=20
+results in a sense of constraint and powerlessness that can be a severe =
+hardship. We suggest that=20
+oversocialization is among the more serious cruelties that human beings =
+inflict on one another.=20
+
+27. We argue that a very important and influential segment of the modern =
+left is oversocialized and that=20
+their oversocialization is of great importance in determining the direction =
+of modern leftism. Leftists of the=20
+oversocialized type tend to be intellectuals or members of the upper-middle =
+class. Notice that university=20
+intellectuals (3) constitute the most highly socialized segment of our =
+society and also the most left-wing=20
+segment.=20
+
+28. The leftist of the oversocialized type tries to get off his =
+psychological leash and assert his autonomy by=20
+rebelling. But usually he is not strong enough to rebel against the most =
+basic values of society. Generally=20
+speaking, the goals of today's leftists are NOT in conflict with the =
+accepted morality. On the contrary, the=20
+left takes an accepted moral principle, adopts it as its own, and then =
+accuses mainstream society of=20
+violating that principle. Examples: racial equality, equality of the sexes, =
+helping poor people, peace as=20
+opposed to war, nonviolence generally, freedom of expression, kindness to =
+animals. More fundamentally,=20
+the duty of the individual to serve society and the duty of society to take =
+care of the individual. All these=20
+have been deeply rooted values of our society (or at least of its middle =
+and=20
+upper classes (4) for a long time. These values are explicitly or =
+implicitly expressed or presupposed in most=20
+of the material presented to us by the mainstream communications media and =
+the educational system.=20
+Leftists, especially those of the oversocialized type, usually do not rebel =
+against these principles but justify=20
+their hostility to society by claiming (with some degree of truth) that =
+society is not living up to these=20
+principles.=20
+
+29. Here is an illustration of the way in which the oversocialized leftist =
+shows his real attachment to the=20
+conventional attitudes of our society while pretending to be in rebellion =
+against it. Many leftists push for=20
+affirmative action, for moving black people into high-prestige jobs, for =
+improved education in black=20
+schools and more money for such schools; the way of life of the black =
+"underclass" they regard as a social=20
+disgrace. They want to integrate the black man into the system, make him a =
+business executive, a lawyer, a=20
+scientist just like upper-middle-class white people. The leftists will =
+reply that the last thing they want is to=20
+make the black man into a copy of the white man; instead, they want to =
+preserve African American culture.=20
+But in what does this preservation of African American culture consist? =
+
+It can hardly consist in anything more than eating black-style food, =
+listening to black-style music, wearing=20
+black-style clothing and going to a black-style church or mosque. In other =
+words, it can express itself only=20
+in superficial matters. In all ESSENTIAL respects more leftists of the =
+oversocialized type want to make the=20
+black man conform to white, middle-class ideals. They want to make him =
+study technical subjects, become=20
+an executive or a scientist, spend his life climbing the status ladder to =
+prove that black people are as good=20
+as white. They want to make black fathers "responsible." they want black =
+gangs to become nonviolent, etc.=20
+But these are exactly the values of the industrial-technological system. =
+The system couldn't care less what=20
+kind of music a man listens to, what kind of clothes he wears or what =
+
+religion he believes in as long as he studies in school, holds a =
+respectable job, climbs the status ladder, is a=20
+"responsible" parent, is nonviolent and so forth. In effect, however much =
+he may deny it, the oversocialized=20
+leftist wants to integrate the black man into the system and make him adopt =
+its values.=20
+
+30. We certainly do not claim that leftists, even of the oversocialized =
+type, NEVER rebel against the=20
+fundamental values of our society. Clearly they sometimes do. Some =
+oversocialized leftists have gone so=20
+far as to rebel against one of modern society's most important principles =
+by engaging in physical violence.=20
+By their own account, violence is for them a form of "liberation." In other =
+words, by committing violence=20
+they break through the psychological restraints that have been trained into =
+them. Because they are=20
+oversocialized these restraints have been more confining for them than for =
+others; hence their need to break=20
+free of them. But they usually justify their rebellion in terms of =
+mainstream values. If they engage in=20
+violence they claim to be fighting against racism or the like.=20
+
+31. We realize that many objections could be raised to the foregoing =
+thumb-nail sketch of leftist=20
+psychology. The real situation is complex, and anything like a complete =
+description of it would take=20
+several volumes even if the necessary data were available. We claim only to =
+have indicated very roughly=20
+the two most important tendencies in the psychology of modern leftism. =
+
+
+32. The problems of the leftist are indicative of the problems of our =
+society as a whole. Low self-esteem,=20
+depressive tendencies and defeatism are not restricted to the left. Though =
+they are especially noticeable in=20
+the left, they are widespread in our society. And today's society tries to =
+socialize us to a greater extent than=20
+any previous society. We are even told by experts how to eat, how to =
+exercise, how to make love, how to=20
+raise our kids and so forth.=20
+
+THE POWER PROCESS
+
+33. Human beings have a need (probably based in biology) for something that =
+we will call the "power=20
+process." This is closely related to the need for power (which is widely =
+recognized) but is not quite the=20
+same thing. The power process has four elem ents. The three most clear-cut =
+of these we call goal, effort=20
+and attainment of goal. (Everyone needs to have goals whose attainment =
+requires effort, and needs to=20
+succeed in attaining at least some of his goals.) The fourth element is =
+more difficult to define and may not=20
+be necessary for everyone . We call it autonomy and will discuss it l ater =
+(paragraphs 42-44).=20
+
+34. Consider the hypothetical case of a man who can have anything he wants =
+just by wishing for it. Such a=20
+man has power, but he will develop serious psychological problems. At first =
+he will have a lot of fun, but=20
+by and by he will become acutely bor ed and demoralized. Eventually he may =
+becom e clinically=20
+depressed. History shows that leisured aristocracies tend to become =
+decadent. This is not true of fighting=20
+aristocracies that have to struggle to maintain their power. But leisured, =
+secure aristocracies that have no=20
+need to exert themselve s usually become bored, hedonistic and demor =
+alized, even though they have=20
+power. This shows that power is not enough. One must have goals toward =
+which to exercise one's power.=20
+
+35. Everyone has goals; if nothing else, to obtain the physical necessities =
+of life: food, water and whatever=20
+clothing and shelter are made necessary by the climate. But the leisured =
+aristocrat obtains these things=20
+without effort. Hence his boredom and demoralization.=20
+
+36. Nonattainment of important goals results in death if the goals are =
+physical necessities, and in frustration=20
+if nonattainment of the goals is compatible with survival. Consistent =
+failure to attain goals throughout life=20
+results in defeatism, low se lf-esteem or depression.=20
+
+37. Thus, in order to avoid serious psychological problems, a human being =
+needs goals whose attainment=20
+requires effort, and he must have a reasonable rate of success in attaining =
+his goals.=20
+
+SURROGATE ACTIVITIES
+
+38. But not every leisured aristocrat becomes bored and demoralized. For =
+example, the emperor Hirohito,=20
+instead of sinking into decadent hedonism, devoted himself to marine =
+biology, a field in which he became=20
+distinguished. When people do not have t o exert themselves to satisfy =
+their physical needs they often set=20
+up artificial goals for themselves. In many cases they then pursue these =
+goals with the same energy and=20
+emotional involvement that they otherwise would have put into the search =
+for physical necessities. Thus the=20
+aristocrats of the Roman Empire had their literary pretentions; many =
+European aristocrats a few centuries=20
+ago invested tremendous time and energy in hunting, though they certainly =
+didn't need the meat; other=20
+aristocracies have competed for status through elaborate displays of =
+wealth;=20
+and a few aristocrats, like Hiroh ito, have turned to science.=20
+
+39. We use the term "surrogate activity" to designate an activity that is =
+directed toward an artificial goal=20
+that people set up for themselves merely in order to have some goal to work =
+toward, or let us say, merely=20
+for the sake of the "fulfillment" th at they get from pursuing the goal. =
+Here is a rule of thumb for the=20
+identification of surrogate activities. Given a person who devotes much =
+time and energy to the pursuit of=20
+goal X, ask yourself this: If he had to devote most of his time and energy =
+to satisfying his biological needs,=20
+and if that effort required him to use his physical and mental facilities =
+in a varied and interesting way,=20
+would he feel seriously deprived because he did not attain goal X? If the =
+answer is no, then the person's=20
+pursuit of a goal X is a surrogate activity. Hirohito's studies=20
+in marine biology clearly constituted a surrogate activity, since it is =
+pretty certain that if Hirohito had had=20
+to spend his time working at interesting non-scientific tasks in order to =
+obtain the necessities of life, he=20
+would not have felt deprived because he didn't know all about the anatomy =
+and life-cycles of marine=20
+animals. On the other hand the pursuit of sex and love (for example) is not =
+a surrogate activity, because=20
+most people, even if their existence were otherwise satisfactory, would =
+feel deprived if they passed their=20
+lives without ever having a relationship with a member of the opposite sex. =
+(But pursuit of an excessive=20
+amount of sex, more than one really needs, can be a surrogate activity.) =
+
+
+40. In modern industrial society only minimal effort is necessary to =
+satisfy one's physical needs. It is=20
+enough to go through a training program to acquire some petty technical =
+skill, then come to work on time=20
+and exert very modest effort needed to hold a job. The only requirements =
+are a moderate amount of=20
+intelligence, and most of all, simple OBEDIENCE. If one has those, society =
+takes care of one from cradle=20
+to grave. (Yes, there is an underclass that cannot take physical =
+necessities for granted, but we are speaking=20
+here of mainstream society.) Thus it is not surprising that modern society =
+is full of surrogate activities.=20
+These include scientific work, athletic achievement, humanitarian work, =
+artistic and literary creation,=20
+climbing the corporate ladder, acquisition of money and material goods far =
+
+beyond the point at which they cease to give any additional physical =
+satisfaction, and social activism when=20
+it addresses issues that are not important for the activist personally, as =
+in the case of white activists who=20
+work for the rights of nonwhite minorities. These are not always pure =
+surrogate activities, since for many=20
+people they may be motivated in part by needs other than the need to have =
+some goal to pursue. Scientific=20
+work may be motivated in part by a drive for prestige, artistic creation by =
+a need to express feelings,=20
+militant social activism by hostility. But for most people who pursue them, =
+these activities are in large part=20
+surrogate activities. For example, the majority of scientists will probably =
+agree that the "fulfillment" they=20
+get from their work is more important than the money and prestige they =
+earn.=20
+
+41. For many if not most people, surrogate activities are less satisfying =
+than the pursuit of real goals ( that=20
+is, goals that people would want to attain even if their need for the power =
+process were already fulfilled).=20
+One indication of this is the fact that, in many or most cases, people who =
+are deeply involved in surrogate=20
+activities are never satisfied, never at rest. Thus the money-maker =
+constantly strives for more and more=20
+wealth. The scientist no sooner solves one problem than he moves on to the =
+next. The long-distance runner=20
+drives himself to run always farther and faster. Many people who pursue =
+surrogate activities will say that=20
+they get far more fulfillment from these activities than they do from the =
+"mundane" business of satisfying=20
+their biological needs, but that it is because in our society the effort =
+
+needed to satisfy the biological needs has been reduced to triviality. More =
+importantly, in our society=20
+people do not satisfy their biological needs AUTONOMOUSLY but by =
+functioning as parts of an immense=20
+social machine. In contrast, people generally have a great deal of autonomy =
+in pursuing their surrogate=20
+activities. have a great deal of autonomy in pursuing their surrogate =
+activities.=20
+
+AUTONOMY
+
+42. Autonomy as a part of the power process may not be necessary for every =
+individual. But most people=20
+need a greater or lesser degree of autonomy in working toward their goals. =
+Their efforts must be=20
+undertaken on their own initiative and must be under their own direction =
+and control. Yet most people do=20
+not have to exert this initiative, direction and control as single =
+individuals. It is usually enough to act as a=20
+member of a SMALL group. Thus if half a dozen people discuss a goal among =
+themselves and make a=20
+successful joint effort to attain that goal, their need for the power =
+process will be served. But if they work=20
+under rigid orders handed down from above that leave them no room for =
+autonomous decision and=20
+initiative, then their need for the power process will not be served. =
+
+The same is true when decisions are made on a collective bases if the group =
+making the collective decision=20
+is so large that the role of each individual is insignificant [5]=20
+
+43. It is true that some individuals seem to have little need for autonomy. =
+Either their drive for power is=20
+weak or they satisfy it by identifying themselves with some powerful =
+organization to which they belong.=20
+And then there are unthinking, animal types who seem to be satisfied with a =
+purely physical sense of=20
+power(the good combat soldier, who gets his sense of power by developing =
+fighting skills that he is quite=20
+content to use in blind obedience to his superiors).=20
+
+44. But for most people it is through the power process-having a goal, =
+making an AUTONOMOUS effort=20
+and attaining t the goal-that self-esteem, self-confidence and a sense of =
+power are acquired. When one does=20
+not have adequate opportunity to go throughout the power process the =
+consequences are (depending on the=20
+individual and on the way the power process is disrupted) boredom, =
+demoralization, low self-esteem,=20
+inferiority feelings, defeatism, depression, anxiety, guilt, frustration, =
+hostility, spouse or child abuse,=20
+insatiable hedonism, abnormal sexual behavior, sleep disorders, eating =
+disorders, etc. [6]=20
+
+SOURCES OF SOCIAL PROBLEMS
+
+45. Any of the foregoing symptoms can occur in any society, but in modern =
+industrial society they are=20
+present on a massive scale. We aren't the first to mention that the world =
+today seems to be going crazy.=20
+This sort of thing is not normal for human societies. There is good reason =
+to believe that primitive man=20
+suffered from less stress and frustration and was better satisfied with his =
+way of life than modern man is. It=20
+is true that not all was sweetness and light in primitive societies. Abuse =
+of women and common among the=20
+Australian aborigines, transexuality was fairly common among some of the =
+American Indian tribes. But is=20
+does appear that GENERALLY SPEAKING the kinds of problems that we have =
+listed in the preceding=20
+paragraph were far less common among primitive peoples than they are in =
+modern society.=20
+
+46. We attribute the social and psychological problems of modern society to =
+the fact that that society=20
+requires people to live under conditions radically different from those =
+under which the human race evolved=20
+and to behave in ways that conflict with the patterns of behavior that the =
+human race developed while=20
+living under the earlier conditions. It is clear from what we have already =
+written that we consider lack of=20
+opportunity to properly experience the power process as the most important =
+of the abnormal conditions to=20
+which modern society subjects people. But it is not the only one. Before =
+dealing with disruption of the=20
+power process as a source of social problems we will discuss some of the =
+other sources.=20
+
+47. Among the abnormal conditions present in modern industrial society are =
+excessive density of=20
+population, isolation of man from nature, excessive rapidity of social =
+change and the break-down of natural=20
+small-scale communities such as the extended family, the village or the =
+tribe.=20
+
+48. It is well known that crowding increases stress and aggression. The =
+degree of crowding that exists=20
+today and the isolation of man from nature are consequences of =
+technological progress. All pre-industrial=20
+societies were predominantly rural. The industrial Revolution vastly =
+increased the size of cities and the=20
+proportion of the population that lives in them, and modern agricultural =
+technology has made it possible for=20
+the Earth to support a far denser population than it ever did before. =
+(Also, technology exacerbates the=20
+effects of crowding because it puts increased disruptive powers in people's =
+hands. For example, a variety of=20
+noise-making devices: power mowers, radios, motorcycles, etc. If the use of =
+these devices is unrestricted,=20
+people who want peace and quiet are frustrated by the noise.=20
+If their use is restricted, people who use the devices are frustrated by =
+the regulations... But if these=20
+machines had never been invented there would have been no conflict and no =
+frustration generated by=20
+them.)=20
+
+49. For primitive societies the natural world (which usually changes only =
+slowly) provided a stable=20
+framework and therefore a sense of security. In the modern world it is =
+human society that dominates nature=20
+rather than the other way around, and modern society changes very rapidly =
+owing to technological change.=20
+Thus there is no stable framework.=20
+
+50. The conservatives are fools: They whine about the decay of traditional =
+values, yet they enthusiastically=20
+support technological progress and economic growth. Apparently it never =
+occurs to them that you can't=20
+make rapid, drastic changes in the technology and the economy of a society =
+with out causing rapid changes=20
+in all other aspects of the society as well, and that such rapid changes =
+inevitably break down traditional=20
+values.=20
+
+51.The breakdown of traditional values to some extent implies the breakdown =
+of the bonds that hold=20
+together traditional small-scale social groups. The disintegration of =
+small-scale social groups is also=20
+promoted by the fact that modern conditions often require or tempt =
+individuals to move to new locations,=20
+separating themselves from their communities. Beyond that, a technological =
+society HAS TO weaken=20
+family ties and local communities if it is to function efficiently. In =
+modern society an individual's loyalty=20
+must be first to the system and only secondarily to a small-scale =
+community, because if the internal=20
+loyalties of small-scale small-scale communities were stronger than loyalty =
+to the system, such=20
+communities would pursue their own advantage at the expense of the system. =
+
+
+52. Suppose that a public official or a corporation executive appoints his =
+cousin, his friend or his co-
+religionist to a position rather than appointing the person best qualified =
+for the job. He has permitted=20
+personal loyalty to supersede his loyalty to the system, and that is =
+"nepotism" or "discrimination," both of=20
+which are terrible sins in modern society. Would-be industrial societies =
+that have done a poor job of=20
+subordinating personal or local loyalties to loyalty to the system are =
+usually very inefficient. (Look at Latin=20
+America.) Thus an advanced industrial society can tolerate only those =
+small-scale communities that are=20
+emasculated, tamed and made into tools of the system. [7]=20
+
+53. Crowding, rapid change and the breakdown of communities have been =
+widely recognized as sources of=20
+social problems. but we do not believe they are enough to account for the =
+extent of the problems that are=20
+seen today.=20
+
+54. A few pre-industrial cities were very large and crowded, yet their =
+inhabitants do not seem to have=20
+suffered from psychological problems to the same extent as modern man. In =
+America today there still are=20
+uncrowded rural areas, and we find there the same problems as in urban =
+areas, though the problems tend to=20
+be less acute in the rural areas. Thus crowding does not seem to be the =
+decisive factor.=20
+
+55. On the growing edge of the American frontier during the 19th century, =
+the mobility of the population=20
+probably broke down extended families and small-scale social groups to at =
+least the same extent as these=20
+are broken down today. In fact, many nuclear families lived by choice in =
+such isolation, having no=20
+neighbors within several miles, that they belonged to no community at all, =
+yet they do not seem to have=20
+developed problems as a result.=20
+
+56.Furthermore, change in American frontier society was very rapid and =
+deep. A man might be born and=20
+raised in a log cabin, outside the reach of law and order and fed largely =
+on wild meat; and by the time he=20
+arrived at old age he might be working at a regular job and living in an =
+ordered community with effective=20
+law enforcement. This was a deeper change that that which typically occurs =
+in the life of a modern=20
+individual, yet it does not seem to have led to psychological problems. In =
+fact, 19th century American=20
+society had an optimistic and self-confident tone, quite unlike that of =
+today's society. [8]=20
+
+57. The difference, we argue, is that modern man has the sense (largely =
+justified) that change is IMPOSED=20
+on him, whereas the 19th century frontiersman had the sense (also largely =
+justified) that he created change=20
+himself, by his own choice. Thus a pioneer settled on a piece of land of =
+his own choosing and made it into=20
+a farm through his own effort. In those days an entire county might have =
+only a couple of hundred=20
+inhabitants and was a far more isolated and autonomous entity than a modern =
+county is. Hence the pioneer=20
+farmer participated as a member of a relatively small group in the creation =
+of a new, ordered community.=20
+One may well question whether the creation of this community was an =
+improvement, but at any rate it=20
+satisfied the pioneer's need for the power process.=20
+
+58. It would be possible to give other examples of societies in which there =
+has been rapid change and/or=20
+lack of close community ties without he kind of massive behavioral =
+aberration that is seen in today's=20
+industrial society. We contend that the most important cause of social and =
+psychological problems in=20
+modern society is the fact that people have insufficient opportunity to go =
+through the power process in a=20
+normal way. We don't mean to say that modern society is the only one in =
+which the power process has been=20
+disrupted. Probably most if not all civilized societies have interfered =
+with the power ' process to a greater or=20
+lesser extent. But in modern industrial society the problem has become =
+particularly acute. Leftism, at least=20
+in its recent=20
+(mid-to-late -20th century) form, is in part a symptom of deprivation with =
+respect to the power process.=20
+
+DISRUPTION OF THE POWER PROCESS IN MODERN SOCIETY
+
+59. We divide human drives into three groups: (1) those drives that can be =
+satisfied with minimal effort; (2)=20
+those that can be satisfied but only at the cost of serious effort; (3) =
+those that cannot be adequately satisfied=20
+no matter how much effort one makes. The power process is the process of =
+satisfying the drives of the=20
+second group. The more drives there are in the third group, the more there =
+is frustration, anger, eventually=20
+defeatism, depression, etc.=20
+
+60. In modern industrial society natural human drives tend to be pushed =
+into the first and third groups, and=20
+the second group tends to consist increasingly of artificially created =
+drives.=20
+
+61. In primitive societies, physical necessities generally fall into group =
+2: They can be obtained, but only at=20
+the cost of serious effort. But modern society tends to guaranty the =
+physical necessities to everyone [9] in=20
+exchange for only minimal effort, hence physical needs are pushed into =
+group 1. (There may be=20
+disagreement about whether the effort needed to hold a job is "minimal"; =
+but usually, in lower- to middle-
+level jobs, whatever effort is required is merely that of obedience. You =
+sit or stand where you are told to sit=20
+or stand and do what you are told to do in the way you are told to do it. =
+Seldom do you have to exert=20
+yourself seriously, and in any case you have hardly any autonomy in work, =
+so that the need for the power=20
+process is not well served.)=20
+
+62. Social needs, such as sex, love and status, often remain in group 2 in =
+modern society, depending on the=20
+situation of the individual. [10] But, except for people who have a =
+particularly strong drive for status, the=20
+effort required to fulfill the social drives is insufficient to satisfy =
+adequately the need for the power process.=20
+
+63. So certain artificial needs have been created that fall into group 2, =
+hence serve the need for the power=20
+process. Advertising and marketing techniques have been developed that make =
+many people feel they need=20
+things that their grandparents never desired or even dreamed of. It =
+requires serious effort to earn enough=20
+money to satisfy these artificial needs, hence they fall into group 2. (But =
+see paragraphs 80-82.) Modern=20
+man must satisfy his need for the power process largely through pursuit of =
+the artificial needs created by=20
+the advertising and marketing industry [11], and through surrogate =
+activities.=20
+
+64. It seems that for many people, maybe the majority, these artificial =
+forms of the power process are=20
+insufficient. A theme that appears repeatedly in the writings of the social =
+critics of the second half of the=20
+20th century is the sense of purposelessness that afflicts many people in =
+modern society. (This=20
+purposelessness is often called by other names such as "anomic" or =
+"middle-class vacuity.") We suggest=20
+that the so-called "identity crisis" is actually a search for a sense of =
+purpose, often for commitment to a=20
+suitable surrogate activity. It may be that existentialism is in large part =
+a response to the purposelessness of=20
+modern life. [12] Very widespread in modern society is the search for =
+"fulfillment." But we think that for=20
+the majority of people an activity whose main goal is fulfillment=20
+(that is, a surrogate activity) does not bring completely satisfactory =
+fulfillment. In other words, it does not=20
+fully satisfy the need for the power process. (See paragraph 41.) That need =
+can be fully satisfied only=20
+through activities that have some external goal, such as physical =
+necessities, sex, love, status, revenge, etc.=20
+
+65. Moreover, where goals are pursued through earning money, climbing the =
+status ladder or functioning=20
+as part of the system in some other way, most people are not in a position =
+to pursue their goals=20
+AUTONOMOUSLY. Most workers are someone else's employee as, as we pointed =
+out in paragraph 61,=20
+must spend their days doing what they are told to do in the way they are =
+told to do it. Even most people=20
+who are in business for themselves have only limited autonomy. It is a =
+chronic complaint of small-business=20
+persons and entrepreneurs that their hands are tied by excessive government =
+regulation. Some of these=20
+regulations are doubtless unnecessary, but for the most part government =
+regulations are essential and=20
+inevitable parts of our extremely complex society. A large portion of small =
+business today operates on the=20
+franchise system.=20
+It was reported in the Wall Street Journal a few years ago that many of the =
+franchise-granting companies=20
+require applicants for franchises to take a personality test that is =
+designed to EXCLUDE those who have=20
+creativity and initiative, because such persons are not sufficiently docile =
+to go along obediently with the=20
+franchise system. This excludes from small business many of the people who =
+most need autonomy.=20
+
+66. Today people live more by virtue of what the system does FOR them or TO =
+them than by virtue of=20
+what they do for themselves. And what they do for themselves is done more =
+and more along channels laid=20
+down by the system. Opportunities tend to be those that the system =
+provides, the opportunities must be=20
+exploited in accord with the rules and regulations [13], and techniques =
+prescribed by experts must be=20
+followed if there is to be a chance of success.=20
+
+67. Thus the power process is disrupted in our society through a deficiency =
+of real goals and a deficiency=20
+of autonomy in pursuit of goals. But it is also disrupted because of those =
+human drives that fall into group=20
+3: the drives that one cannot adequately satisfy no matter how much effort =
+one makes. One of these drives=20
+is the need for security. Our lives depend on decisions made by other =
+people; we have no control over these=20
+decisions and usually we do not even know the people who make them. ("We =
+live in a world in which=20
+relatively few people - maybe 500 or 1,00 - make the important decisions" - =
+Philip B. Heymann of Harvard=20
+Law School, quoted by Anthony Lewis, New York Times, April 21, 1995.) Our =
+lives depend on whether=20
+safety standards at a nuclear power plant are properly maintained;=20
+on how much pesticide is allowed to get into our food or how much pollution =
+into our air; on how skillful=20
+(or incompetent) our doctor is; whether we lose or get a job may depend on =
+decisions made by government=20
+economists or corporation executives; and so forth. Most individuals are =
+not in a position to secure=20
+themselves against these threats to more [than] a very limited extent. The =
+individual's search for security is=20
+therefore frustrated, which leads to a sense of powerlessness.=20
+
+68. It may be objected that primitive man is physically less secure than =
+modern man, as is shown by his=20
+shorter life expectancy; hence modern man suffers from less, not more than =
+the amount of insecurity that is=20
+normal for human beings. but psychological security does not closely =
+correspond with physical security.=20
+What makes us FEEL secure is not so much objective security as a sense of =
+confidence in our ability to=20
+take care of ourselves. Primitive man, threatened by a fierce animal or by =
+hunger, can fight in self-defense=20
+or travel in search of food. He has no certainty of success in these =
+efforts, but he is by no means helpless=20
+against the things that threaten him. The modern individual on the other =
+hand is threatened by many things=20
+against which he is helpless;=20
+nuclear accidents, carcinogens in food, environmental pollution, war, =
+increasing taxes, invasion of his=20
+privacy by large organizations, nation-wide social or economic phenomena =
+that may disrupt his way of=20
+life.=20
+
+69. It is true that primitive man is powerless against some of the things =
+that threaten him; disease for=20
+example. But he can accept the risk of disease stoically. It is part of the =
+nature of things, it is no one's fault,=20
+unless is the fault of some imaginary, impersonal demon. But threats to the =
+modern individual tend to be=20
+MAN-MADE. They are not the results of chance but are IMPOSED on him by =
+other persons whose=20
+decisions he, as an individual, is unable to influence. Consequently he =
+feels frustrated, humiliated and=20
+angry.=20
+
+70. Thus primitive man for the most part has his security in his own hands =
+(either as an individual or as a=20
+member of a SMALL group) whereas the security of modern man is in the hands =
+of persons or=20
+organizations that are too remote or too large for him to be able =
+personally to influence them. So modern=20
+man's drive for security tends to fall into groups 1 and 3; in some areas =
+(food, shelter, etc.) his security is=20
+assured at the cost of only trivial effort, whereas in other areas he =
+CANNOT attain security. (The foregoing=20
+greatly simplifies the real situation, but it does indicate in a rough, =
+general way how the condition of=20
+modern man differs from that of primitive man.)=20
+
+71. People have many transitory drives or impulses that are necessary =
+frustrated in modern life, hence fall=20
+into group 3. One may become angry, but modern society cannot permit =
+fighting. In many situations it=20
+does not even permit verbal aggression. When going somewhere one may be in =
+a hurry, or one may be in a=20
+mood to travel slowly, but one generally has no choice but to move with the =
+flow of traffic and obey the=20
+traffic signals. One may want to do one's work in a different way, but =
+usually one can work only according=20
+to the rules laid down by one's employer. In many other ways as well, =
+modern man is strapped down by a=20
+network of rules and regulations (explicit or implicit) that frustrate many =
+of his impulses and thus interfere=20
+with the power process. Most of these regulations cannot be disposed with, =
+
+because the are necessary for the functioning of industrial society. =
+
+
+72. Modern society is in certain respects extremely permissive. In matters =
+that are irrelevant to the=20
+functioning of the system we can generally do what we please. We can =
+believe in any religion we like (as=20
+long as it does not encourage behavior that is dangerous to the system). We =
+can go to bed with anyone we=20
+like (as long as we practice "safe sex"). We can do anything we like as =
+long as it is UNIMPORTANT. But=20
+in all IMPORTANT matters the system tends increasingly to regulate our =
+behavior.=20
+
+73. Behavior is regulated not only through explicit rules and not only by =
+the government. Control is often=20
+exercised through indirect coercion or through psychological pressure or =
+manipulation, and by=20
+organizations other than the government, or by the system as a whole. Most =
+large organizations use some=20
+form of propaganda [14] to manipulate public attitudes or behavior. =
+Propaganda is not limited to=20
+"commercials" and advertisements, and sometimes it is not even consciously =
+intended as propaganda by=20
+the people who make it. For instance, the content of entertainment =
+programming is a powerful form of=20
+propaganda. An example of indirect coercion: There is no law that says we =
+have to go to work every day=20
+and follow our employer's orders. Legally there is=20
+nothing to prevent us from going to live in the wild like primitive people =
+or from going into business for=20
+ourselves. But in practice there is very little wild country left, and =
+there is room in the economy for only a=20
+limited number of small business owners. Hence most of us can survive only =
+as someone else's employee.=20
+
+74. We suggest that modern man's obsession with longevity, and with =
+maintaining physical vigor and=20
+sexual attractiveness to an advanced age, is a symptom of unfulfillment =
+resulting from deprivation with=20
+respect to the power process. The "mid-life crisis" also is such a symptom. =
+So is the lack of interest in=20
+having children that is fairly common in modern society but almost =
+unheard-of in primitive societies.=20
+
+75. In primitive societies life is a succession of stages. The needs and =
+purposes of one stage having been=20
+fulfilled, there is no particular reluctance about passing on to the next =
+stage. A young man goes through the=20
+power process by becoming a hunter, hunting not for sport or for =
+fulfillment but to get meat that is=20
+necessary for food. (In young women the process is more complex, with =
+greater emphasis on social power;=20
+we won't discuss that here.) This phase having been successfully passed =
+through, the young man has no=20
+reluctance about settling down to the responsibilities of raising a family. =
+(In contrast, some modern people=20
+indefinitely postpone having children because they are too busy seeking =
+some kind of "fulfillment." We=20
+suggest that the=20
+fulfillment they need is adequate experience of the power process -- with =
+real goals instead of the artificial=20
+goals of surrogate activities.) Again, having successfully raised his =
+children, going through the power=20
+process by providing them with the physi cal necessities, the primitive man =
+feels tha t his work is done and=20
+he is prepared to accept old age (if he survives that long) and death. Many =
+modern people, on the other=20
+hand, are disturbed by the prospect of death, as is shown by the amount of =
+effort they expend trying to=20
+maintain their physical condition, appearance and health. We argue t hat =
+this is due to unfulfillment=20
+resulting from the fact that they have never put their physical powers to =
+any use, have never gone through=20
+the power process using their bodies in a serious way.=20
+It is not the primitive man, who has used his body daily for practical =
+purposes, who fears the deteriora tion=20
+of age, but the modern man, who has never had a practical use for his body =
+beyond walking from his car to=20
+his house. It is the man whose need for the power process has been =
+satisfied during his life who is best=20
+prepared to accept the end of that life .=20
+
+76. In response to the arguments of this section someone will say, "Society =
+must find a way to give people=20
+the opportunity to go through the power process." For such people the value =
+of the opportunity is destroyed=20
+by the very fact that society gives i t to them. What they need is to find =
+or make their own opportunities. As=20
+long as the system GIVES them their opportunities it still has them on a =
+leash. To attain autonomy they=20
+must get off that leash. Manifesto Contents=20
+
+
+
+HOW SOME PEOPLE ADJUST
+
+77. Not everyone in industrial-technological society suffers from =
+psychological problems. Some people=20
+even profess to be quite satisfied with society as it is. We now discuss =
+some of the reasons why people=20
+differ so greatly in their response to modern society.=20
+
+78. First, there doubtless are differences in the strength of the drive for =
+power. Individuals with a weak=20
+drive for power may have relatively little need to go through the power =
+process, or at least relatively little=20
+need for autonomy in the power pro cess. These are docile types who would =
+have been happy as plantation=20
+darkies in the Old South. (We don't mean to sneer at "plantation darkies" =
+of the Old South. To their credit,=20
+most of the slaves were NOT content with their servitude. We do sneer at =
+people who ARE content with=20
+servitude.)=20
+
+79. Some people may have some exceptional drive, in pursuing which they =
+satisfy their need for the power=20
+process. For example, those who have an unusually strong drive for social =
+status may spend their whole=20
+lives climbing the status ladder without ev er getting bored with that =
+game.=20
+
+80. People vary in their susceptibility to advertising and marketing =
+techniques. Some people are so=20
+susceptible that, even if they make a great deal of money, they cannot =
+satisfy their constant craving for the=20
+shiny new toys that the marketing industry dangles before their eyes. So =
+they always f eel hard-pressed=20
+financially even if their income is large, and their cravings are =
+frustrated.=20
+
+81. Some people have low susceptibility to advertising and marketing =
+techniques. These are the people=20
+who aren't interested in money. Material acquisition does not serve their =
+need for the power process.=20
+
+82. People who have medium susceptibility to advertising and marketing =
+techniques are able to earn=20
+enough money to satisfy their craving for goods and services, but only at =
+the cost of serious effort (putting=20
+in overtime, taking a second job, earning p romotions, etc.) Thus material =
+acquisition s erves their need for=20
+the power process. But it does not necessarily follow that their need is =
+fully satisfied. They may have=20
+insufficient autonomy in the power process (their work may consist of =
+following orders) and some of their=20
+drives may be frustrated (e.g., security, aggression). (We are guilt y of =
+oversimplification in paragraphs 80-
+82 because we have assumed that the desire for material acquisition is =
+entirely a creation of the advertising=20
+and marketing industry. Of course it's not that simple.=20
+
+83. Some people partly satisfy their need for power by identifying =
+themselves with a powerful organization=20
+or mass movement. An individual lacking goals or power joins a movement or =
+an organization, adopts its=20
+goals as his own, then works toward these goals. When some of the goals are =
+attained, the individual, even=20
+though his personal efforts have played only an insignificant part in the =
+attainment of the goals, feels=20
+(through his identification with the movement or organization) as if he had =
+gone through the power=20
+process. This phenomenon was e xploited by the fascists, nazis and communis =
+ts. Our society uses it, too,=20
+though less crudely. Example: Manuel Noriega was an irritant to the U.S. =
+(goal: punish Noriega). The U.S.=20
+invaded Panama (effort) and punished Noriega (attainment of goal).=20
+The U.S. went through the power process and many Ame ricans, because of =
+their identification with the=20
+U.S., experienced the power process vicariously. Hence the widespread =
+public approval of the Panama=20
+invasion; it gave people a sense of power. [15] We see the same phenomenon =
+in armies, corporations,=20
+political parties, humanitarian organizations, rel igious or ideological =
+movements. In particul ar, leftist=20
+movements tend to attract people who are seeking to satisfy their need for =
+power. But for most people=20
+identification with a large organization or a mass movement does not fully =
+satisfy the need for power.=20
+
+84. Another way in which people satisfy their need for the power process is =
+through surrogate activities. As=20
+we explained in paragraphs 38-40, a surrogate activity that is directed =
+toward an artificial goal that the=20
+individual pursues for the sake of t he "fulfillment" that he gets from =
+pursuing the goal, not because he=20
+needs to attain the goal itself. For instance, there is no practical motive =
+for building enormous muscles,=20
+hitting a little ball into a hole or acquiring a complete series of postage =
+stamps. Yet many people in our=20
+society devote t hemselves with passion to bodybuilding, golf or stamp =
+collecting. Some people are more=20
+"other-directed" than others, and therefore will more readily attack =
+importance to a surrogate activity=20
+simply because the people around them treat it as important=20
+or because society tells them it is important. T hat is why some people get =
+very serious abou t essentially=20
+trivial activities such as sports, or bridge, or chess, or arcane scholarly =
+pursuits, whereas others who are=20
+more clear-sighted never see these things as anything but the surrogate =
+activities that they are, and=20
+consequently never attach enou gh importance to them to satisfy their need =
+for the power process in that=20
+way. It only remains to point out that in many cases a person's way of =
+earning a living is also a surrogate=20
+activity. Not a PURE surrogate activity, since part of the motive for the =
+activity is to gain the physical=20
+necessitie s and (for some people) social status and th e luxuries that =
+advertising makes them want. But=20
+many people put into their=20
+work far more effort than is necessary to earn whatever money and status =
+they require, and this extra effort=20
+constitutes a surrogate activity. This extra effort, together with the =
+emotional investment that accompanies=20
+it, i s one of the most potent forces acting toward the continual =
+development and perfecting of the system,=20
+with negative consequences for individual freedom (see paragraph 131). =
+Especially, for the most creative=20
+scientists and engineers, work tends to be large ly a surrogate activity. =
+This point is so im portant that is=20
+deserves a separate discussion, which we shall give in a moment (paragraphs =
+87-92).=20
+
+85. In this section we have explained how many people in modern society do =
+satisfy their need for the=20
+power process to a greater or lesser extent. But we think that for the =
+majority of people the need for the=20
+power process is not fully satisfied. In th e first place, those who have =
+an insatiable drive for status, or who=20
+get firmly "hooked" or a surrogate activity, or who identify strongly =
+enough with a movement or=20
+organization to satisfy their need for power in that way, are exceptional =
+personalities. Others are not fully=20
+satisfied with surrogate activities or by identification with an org =
+anization (see paragraphs 41, 64). In the=20
+second place, too much control is imposed by the system through explicit =
+regulation or through=20
+socialization,=20
+which results in a deficiency of autonomy, and in frustration due to the =
+impossibility of attaining cer tain=20
+goals and the necessity of restraining too many impulses.=20
+
+86. But even if most people in industrial-technological society were well =
+satisfied, we (FC) would still be=20
+opposed to that form of society, because (among other reasons) we consider =
+it demeaning to fulfill one's=20
+need for the power process through surr ogate activities or through =
+identification w ith an organization,=20
+rather then through pursuit of real goals.=20
+
+THE MOTIVES OF SCIENTISTS
+
+87. Science and technology provide the most important examples of surrogate =
+activities. Some scientists=20
+claim that they are motivated by "curiosity," that notion is simply absurd. =
+Most scientists work on highly=20
+specialized problem that are not the obje ct of any normal curiosity. For =
+example, is an astronomer, a=20
+mathematician or an entomologist curious about the properties of =
+isopropyltrimethylmethane? Of course=20
+not. Only a chemist is curious about such a thing, and he is curious about =
+it only because chemistry is his=20
+surrogate activity. Is the c hemist curious about the appropriate classif =
+ication of a new species of beetle?=20
+No. That question is of interest only to the entomologist, and he is =
+interested in it only because entomology=20
+is his surrogate activity.=20
+If the chemist and the entomologist had to exert themselves seriously to =
+obtain th e physical necessities,=20
+and if that effort e xercised their abilities in an interesting way but in =
+some nonscientific pursuit, then they=20
+couldn't giver a damn about isopropyltrimethylmethane or the classification =
+of beetles. Suppose that lack of=20
+funds for postgraduate education had led the chemist t o become an =
+insurance broker instead of a ch emist.=20
+In that case he would have been very interested in insurance matters but =
+would have cared nothing about=20
+isopropyltrimethylmethane. In any case it is not normal to put into the =
+satisfaction of mere curiosity the=20
+amount of time and effort that scient ists put into their work. The =
+"curiosity" ex planation for the scientists'=20
+motive just doesn't stand up.=20
+
+88. The "benefit of humanity" explanation doesn't work any better. Some =
+scientific work has no=20
+conceivable relation to the welfare of the human race - most of archaeology =
+or comparative linguistics for=20
+example. Some other areas of science present obvio usly dangerous =
+possibilities. Yet scientists in these=20
+areas are just as enthusiastic about their work as those who develop =
+vaccines or study air pollution.=20
+Consider the case of Dr. Edward Teller, who had an obvious emotional =
+involvement in promoting nuclear=20
+power plants. Did this involvement stem f rom a desire to benefit humanity? =
+If so, the n why didn't Dr.=20
+Teller get emotional about other "humanitarian" causes? If he was such a =
+humanitarian then why did he=20
+help to develop the H-bomb? As with many other scientific achievements, =
+
+it is very much open to question whether nuclear power plants ac tually do =
+benefit humanity. Does the=20
+cheap e lectricity outweigh the accumulating waste and risk of accidents? =
+Dr. Teller saw only one side of=20
+the question. Clearly his emotional involvement with nuclear power arose =
+not from a desire to "benefit=20
+humanity" but from a personal fulfillment he got from his work and from =
+seeing it put to practical use.=20
+
+89. The same is true of scientists generally. With possible rare =
+exceptions, their motive is neither curiosity=20
+nor a desire to benefit humanity but the need to go through the power =
+process: to have a goal (a scientific=20
+problem to solve), to make an eff ort (research) and to attain the goal =
+(solut ion of the problem.) Science is=20
+a surrogate activity because scientists work mainly for the fulfillment =
+they get out of the work itself.=20
+
+90. Of course, it's not that simple. Other motives do play a role for many =
+scientists. Money and status for=20
+example. Some scientists may be persons of the type who have an insatiable =
+drive for status (see paragraph=20
+79) and this may provide much of the motivation for their work. No doubt =
+the majo rity of scientists, like=20
+the majority of the general population, are more or less susceptible to =
+advertising and marketing techniques=20
+and need money to satisfy their craving for goods and services. Thus =
+science is not a PURE surrogate=20
+activity. But it is in large part a surrogate activity.=20
+
+91. Also, science and technology constitute a mass power movement, and many =
+scientists gratify their need=20
+for power through identification with this mass movement (see paragraph =
+83).=20
+
+92. Thus science marches on blindly, without regard to the real welfare of =
+the human race or to any other=20
+standard, obedient only to the psychological needs of the scientists and of =
+the government officials and=20
+corporation executives who provide the fu nds for research.=20
+
+THE NATURE OF FREEDOM
+
+93. We are going to argue that industrial-technological society cannot be =
+reformed in such a way as to=20
+prevent it from progressively narrowing the sphere of human freedom. But =
+because "freedom" is a word=20
+that can be interpreted in many ways, we must fi rst make clear what kind =
+of freedom we are c oncerned=20
+with.=20
+
+94. By "freedom" we mean the opportunity to go through the power process, =
+with real goals not the=20
+artificial goals of surrogate activities, and without interference, =
+manipulation or supervision from anyone,=20
+especially from any large organization. Freed om means being in control =
+(either as an indi vidual or as a=20
+member of a SMALL group) of the life-and-death issues of one's existence; =
+food, clothing, shelter and=20
+defense against whatever threats there may be in one's environment. Freedom =
+means having power; not the=20
+power to control other people but the power to control the circumstances of =
+on e's own life. One does not=20
+have freedom if anyone else (especially a large organization) has power =
+over one, no matter how=20
+benevolently, tolerantly and permissively that power may be exercised. =
+
+It is important not to confuse freedom with mere permissivene ss (see =
+paragraph 72).=20
+
+95. It is said that we live in a free society because we have a certain =
+number of constitutionally guaranteed=20
+rights. But these are not as important as they seem. The degree of personal =
+freedom that exists in a society=20
+is determined more by the economi c and technological structure of the =
+society than by its laws or its form=20
+of government. [16] Most of the Indian nations of New England were =
+monarchies, and many of the cities=20
+of the Italian Renaissance were controlled by dictators. But in reading =
+about these societies one gets the=20
+impression that they allowed far more personal freedom than out society =
+does. In part this was because=20
+they lacked efficient mechanisms for enforcing the ruler's will: There were =
+no modern, well-organized=20
+police forces, no rapid long-distance communications,=20
+no surveillance cameras, no dossiers of information abou t the lives of =
+average citizens. Hence it wa s=20
+relatively easy to evade control.=20
+
+96. As for our constitutional rights, consider for example that of freedom =
+of the press. We certainly don't=20
+mean to knock that right: it is very important tool for limiting =
+concentration of political power and for=20
+keeping those who do have political po wer in line by publicly exposing any =
+misbeha vior on their part.=20
+But freedom of the press is of very little use to the average citizen as an =
+individual. The mass media are=20
+mostly under the control of large organizations that are integrated into =
+the system. Anyone who has a little=20
+money can have some thing printed, or can distribute it on the I nternet or =
+in some such way, but what he=20
+has to say will be swamped by the vast volume of material put out by the =
+media, hence it will have no=20
+practical effect.=20
+To make an impression on society with words is therefore almost impossible =
+for most individual s and=20
+small groups. Take us (FC) for example . If we had never done anything =
+violent and had submitted the=20
+present writings to a publisher, they probably would not have been =
+accepted. If they had been accepted and=20
+published, they probably would not have attracted many readers, because =
+it's more fun to watch the=20
+entertainment put out by the me dia than to read a sober essay. Even if =
+these writings had had many=20
+readers, most of these readers would soon have forgotten what they had read =
+as their minds were flooded=20
+by the mass of material to which the media expose them. In order to get our =
+message before the public with=20
+some chance of makin g a lasting impression, we've had to kill people. =
+
+
+97. Constitutional rights are useful up to a point, but they do not serve =
+to guarantee much more than what=20
+could be called the bourgeois conception of freedom. According to the =
+bourgeois conception, a "free" man=20
+is essentially an element of a social ma chine and has only a certain set =
+of prescrib ed and delimited=20
+freedoms; freedoms that are designed to serve the needs of the social =
+machine more than those of the=20
+individual. Thus the bourgeois's "free" man has economic freedom because =
+that promotes growth and=20
+progress; he has freedom of the press b ecause public criticism restrains =
+misbehavio r by political leaders;=20
+he has a rights to a fair trial because imprisonment at the whim of the =
+powerful would be bad for the=20
+system. This was clearly the attitude of Simon Bolivar.=20
+To him, people deserved liberty only if they used it to promote progress =
+(progress as conceived by the=20
+bourgeois). Ot her bourgeois thinkers have taken a similar view of freedom =
+as a mere means to collective=20
+ends. Chester C. Tan, "Chinese Political Thought in the Twentieth Century," =
+page 202, explains the=20
+philosophy of the Kuomintang leader Hu Han-min: "An individual is granted =
+rights because he is a=20
+member of soc iety and his community life requires such rights. By =
+community Hu meant the whole=20
+society of the nation." And on page 259 Tan states that according to Carsum =
+Chang (Chang Chun-mai,=20
+head of the State Socialist Party in China) freedom had to be used in the =
+interest of the state and of the=20
+people as a whole. But what kind of freedom does one have if one can use it =
+only as someone else=20
+prescribes?=20
+FC's conception of freedom is not that of Bolivar, Hu, Chang or other =
+bourgeois theorists. The trouble with=20
+such theorists is that they have made the develop ment and application of =
+social theories thei r surrogate=20
+activity. Consequently the theories are designed to serve the needs of the =
+theorists more than the needs of=20
+any people who may be unlucky enough to live in a society on which the =
+theories are imposed.=20
+
+98. One more point to be made in this section: It should not be assumed =
+that a person has enough freedom=20
+just because he SAYS he has enough. Freedom is restricted in part by =
+psychological control of which=20
+people are unconscious, and moreover many peopl e's ideas of what =
+constitutes freedom are go verned=20
+more by social convention than by their real needs. For example, it's =
+likely that many leftists of the=20
+oversocialized type would say that most people, including themselves are =
+socialized too little rather than=20
+too much, yet the oversocialized lefti st pays a heavy psychological price =
+for his high level of socialization.=20
+
+SOME PRINCIPLES OF HISTORY
+
+99. Think of history as being the sum of two components: an erratic =
+component that consists of=20
+unpredictable events that follow no discernible pattern, and a regular =
+component that consists of long-term=20
+historical trends. Here we are concerned with the long-term trends. =
+
+
+100. FIRST PRINCIPLE. If a SMALL change is made that affects a long-term =
+historical trend, then the=20
+effect of that change will almost always be transitory - the trend will =
+soon revert to its original state.=20
+(Example: A reform movement designed to clean up political corruption in a =
+society rarely has more than a=20
+short-term effect; sooner or later the reformers relax and corruption =
+creeps back in. The level of political=20
+corruption in a given society tends to remain constant, or to change only =
+slowly with the evolution of the=20
+society. Normally, a p olitical cleanup will be permanent only if a =
+ccompanied by widespread social=20
+changes; a SMALL change in the society won't be enough.) If a small change =
+in a long-term historical=20
+trend appears to be permanent, i
+t is only because the change acts in the direction in which the trend is =
+already moving, s o that the trend is=20
+not altered but only pus hed a step ahead.=20
+
+101. The first principle is almost a tautology. If a trend were not stable =
+with respect to small changes, it=20
+would wander at random rather than following a definite direction; in other =
+words it would not be a long-
+term trend at all.=20
+
+102. SECOND PRINCIPLE. If a change is made that is sufficiently large to =
+alter permanently a long-term=20
+historical trend, than it will alter the society as a whole. In other =
+words, a society is a system in which all=20
+parts are interrelated, and you can't permanently change any important part =
+witho ut change all the other=20
+parts as well.=20
+
+103. THIRD PRINCIPLE. If a change is made that is large enough to alter =
+permanently a long-term trend,=20
+then the consequences for the society as a whole cannot be predicted in =
+advance. (Unless various other=20
+societies have passed through the same change and have all experienced the =
+same consequenc es, in which=20
+case one can predict on empirical grounds that another society that passes =
+through the same change will be=20
+like to experience similar consequences.)=20
+
+104. FOURTH PRINCIPLE. A new kind of society cannot be designed on paper. =
+That is, you cannot plan=20
+out a new form of society in advance, then set it up and expect it to =
+function as it was designed to.=20
+
+105. The third and fourth principles result from the complexity of human =
+societies. A change in human=20
+behavior will affect the economy of a society and its physical environment; =
+the economy will affect the=20
+environment and vice versa, and the changes in the economy and the =
+environment will affec t human=20
+behavior in complex, unpredictable ways; and so forth. The network of =
+causes and effects is far too=20
+complex to be untangled and understood.=20
+
+106. FIFTH PRINCIPLE. People do not consciously and rationally choose the =
+form of their society.=20
+Societies develop through processes of social evolution that are not under =
+rational human control.=20
+
+107. The fifth principle is a consequence of the other four.=20
+
+108. To illustrate: By the first principle, generally speaking an attempt =
+at social reform either acts in the=20
+direction in which the society is developing anyway (so that it merely =
+accelerates a change that would have=20
+occurred in any case) or else it o nly has a transitory effect, so that the =
+soc iety soon slips back into its old=20
+groove. To make a lasting change in the direction of development of any =
+important aspect of a society,=20
+reform is insufficient and revolution is required. (A revolution does not =
+necessarily involve an armed=20
+uprising or the overthrow of a government.) By the second p rinciple, a =
+revolution never changes only one=20
+aspect of a society; and by the third principle changes occur that were =
+never expected or desired by the=20
+revolutionaries.=20
+By the fourth principle, when revolutionaries or utopians set up a new kind =
+of society, it never works out as=20
+planned.=20
+
+109. The American Revolution does not provide a counterexample. The =
+American "Revolution" was not a=20
+revolution in our sense of the word, but a war of independence followed by =
+a rather far-reaching political=20
+reform. The Founding Fathers did not change t he direction of development =
+of American soci ety, nor did=20
+they aspire to do so. They only freed the development of American society =
+from the retarding effect of=20
+British rule. Their political reform did not change any basic trend, but =
+only pushed American political=20
+culture along its natural direction of development. British society, of =
+which A merican society was an off-
+shoot, had been moving for a long time in the direction of representative =
+democracy. And prior to the War=20
+of Independence the Americans were already practicing a significant =
+
+degree of representative democracy in the colonial ass emblies. The =
+political system established by the=20
+Constitution was modeled on the British system and on the colonial =
+assemblies. With major alteration, to=20
+be sure - there is no doubt that the Founding Fathers took a very important =
+step. But it was a step along the=20
+road the English-speaking world was already traveling. The proof is that =
+Britai n and all of its colonies that=20
+were populated predominantly by people of British descent ended up with =
+systems of representative=20
+democracy essentially similar to that of the United States. If the Founding =
+Fathers had lost their nerve and=20
+declined to sign the Declaration of Independence, our way of life today =
+would not have been significantly=20
+different.=20
+Maybe we would have had somewhat closer ties to Britain, and would have had =
+a Parliament and Prime=20
+Minister instead of a Congress and President. No big deal. Thus the =
+American Revolution provides not a=20
+counterexample to our principles but a go od illustration of them.=20
+
+110. Still, one has to use common sense in applying the principles. They =
+are expressed in imprecise=20
+language that allows latitude for interpretation, and exceptions to them =
+can be found. So we present these=20
+principles not as inviolable laws but as rule s of thumb, or guides to =
+thinking, that may provide a partial=20
+antidote to naive ideas about the future of society. The principles should =
+be borne constantly in mind, and=20
+whenever one reaches a conclusion that conflicts with them one should =
+carefully reexamine one's thinking=20
+and retain the conclusio n only if one has good, solid reasons for do ing =
+so.=20
+
+INDUSTRIAL-TECHNOLOGICAL SOCIETY CANNOT BE REFORMED
+
+111. The foregoing principles help to show how hopelessly difficult it =
+would be to reform the industrial=20
+system in such a way as to prevent it from progressively narrowing our =
+sphere of freedom. There has been=20
+a consistent tendency, going back at least to the Industrial Revolution for =
+technology to strengthen the=20
+system at a high cost in individual freedom and local autonomy. Hence any =
+change designed to protect=20
+freedom from technology would be contrary to a fundamental trend in the =
+development of our society.=20
+
+Consequently, such a change either would be a transitory one -- soon =
+swamped by the tide of history -- or,=20
+if large enough to be permanent would alter the nature of our whole =
+society. This by the first and second=20
+principles. Moreover, since society wo uld be altered in a way that could =
+not be pr edicted in advance (third=20
+principle) there would be great risk. Changes large enough to make a =
+lasting difference in favor of freedom=20
+would not be initiated because it would realized that they would gravely =
+disrupt the system. So any=20
+attempts at reform w ould be too timid to be effective. Even if c hanges =
+large enough to make a lasting=20
+difference were initiated, they would be retracted when their disruptive =
+effects became apparent. Thus,=20
+permanent changes=20
+in favor of freedom could be brought about only by persons prepared to =
+accept radical, dangero us and=20
+unpredictable alteration of the entir e system. In other words, by =
+revolutionaries, not reformers.=20
+
+112. People anxious to rescue freedom without sacrificing the supposed =
+benefits of technology will suggest=20
+naive schemes for some new form of society that would reconcile freedom =
+with technology. Apart from the=20
+fact that people who make suggestions sel dom propose any practical means =
+by which the new form of=20
+society could be set up in the first place, it follows from the fourth =
+principle that even if the new form of=20
+society could be once established, it either would collapse or would give =
+results very different from those=20
+expected.=20
+
+113. So even on very general grounds it seems highly improbably that any =
+way of changing society could=20
+be found that would reconcile freedom with modern technology. In the next =
+few sections we will give more=20
+specific reasons for concluding that freedo m and technological progress =
+are incompatibl e.=20
+
+
+
+RESTRICTION OF FREEDOM IS UNAVOIDABLE IN INDUSTRIAL SOCIETY
+
+
+
+114. As explained in paragraph 65-67, 70-73, modern man is strapped down by =
+a network of rules and=20
+regulations, and his fate depends on the actions of persons remote from him =
+whose decisions he cannot=20
+influence. This is not accidental or a result of t he arbitrariness of =
+arrogant bureaucrats. I t is necessary and=20
+inevitable in any technologically advanced society. The system HAS TO =
+regulate human behavior closely=20
+in order to function. At work, people have to do what they are told to do, =
+otherwise production would be=20
+thrown into chaos. Bureaucra cies HAVE TO be run according to rigid rules . =
+To allow any substantial=20
+personal discretion to lower-level bureaucrats would disrupt the system and =
+lead to charges of unfairness=20
+due to differences in the way individual bureaucrats exercised their =
+discretion.=20
+It is true that some restrictions on our freedom could be eliminated, but =
+GENERALLY S PEAKING the=20
+regulation of our lives by large organizations is necessary for the =
+functioning of industrial-technological=20
+society. The result is a sense of powerlessness on the part of the average =
+person. It may be, however, that=20
+formal regulations will ten d increasingly to be replaced by psychologic al =
+tools that make us want to do=20
+what the system requires of us. (Propaganda [14], educational techniques, =
+"mental health" programs, etc.)=20
+
+115. The system HAS TO force people to behave in ways that are increasingly =
+remote from the natural=20
+pattern of human behavior. For example, the system needs scientists, =
+mathematicians and engineers. It can't=20
+function without them. So heavy pressure is put on children to excel in =
+these fields. It isn't natural for an=20
+adolescent human being to spend the bulk of his time sitting at a desk =
+absorbed in study. A normal=20
+adolescent wants to spend his time in active contact with the real world. =
+Among primitive peoples the=20
+things that children are trained to do are in natural harmony with natural =
+h uman impulses. Among the=20
+American Indians, for example, boys were trained in active outdoor pursuits =
+-- just the sort of things that=20
+boys like. But in our society children are pushed into studying technical =
+subjects,=20
+which most do grudgingly.=20
+
+117. In any technologically advanced society the individual's fate MUST =
+depend on decisions that he=20
+personally cannot influence to any great extent. A technological society =
+cannot be broken down into small,=20
+autonomous communities, because production de pends on the cooperation of =
+very large numbe rs of=20
+people. When a decision affects, say, a million people, then each of the =
+affected individuals has, on the=20
+average, only a one-millionth share in making the decision. What usually =
+happens in practice is that=20
+decisions are made by public officials or corporation executives, or by =
+technical spe cialists, but even when=20
+the public votes on a decision the number of voters ordinarily is too large =
+for the vote of any one individual=20
+to be significant. [17]=20
+Thus most individuals are unable to influence measurably the major =
+decisions that affect their l ives. Their=20
+is no conceivable way to remedy this in a technologically advanced society. =
+The system tries to "solve" this=20
+problem by using propaganda to make people WANT the decisions that have =
+been made for them, but even=20
+if this "solution" were completely successful in making people feel better, =
+it would be demeaning.=20
+
+118 Conservatives and some others advocate more "local autonomy." Local =
+communities once did have=20
+autonomy, but such autonomy becomes less and less possible as local =
+communities become more=20
+enmeshed with and dependent on large-scale systems like public utilities, =
+computer networks, highway=20
+syste ms, the mass communications media, the modern health care system. =
+Also operating against=20
+autonomy is the fact that technology applied in one location often affects =
+people at other locations far=20
+away. Thus pesticide or chemical use near a creek may contam inate the =
+water supply hundreds of miles=20
+dow nstream, and the greenhouse effect affects the whole world.=20
+
+119. The system does not and cannot exist to satisfy human needs. Instead, =
+it is human behavior that has to=20
+be modified to fit the needs of the system. This has nothing to do with the =
+political or social ideology that=20
+may pretend to guide the technolog ical system. It is the fault of =
+technology, because the system is guided=20
+not by ideology but by technical necessity. [18] Of course the system does =
+satisfy many human needs, but=20
+generally speaking it does this only to the extent that it is to the =
+advantage of the system to do it. It is the=20
+needs of the system that are paramount, not those of the human being. For =
+example, the system provides=20
+people with food because the system couldn't function if everyone starved; =
+
+it attends to people's psychological needs whenever it can CONVENIENTLY do =
+so, because it couldn't=20
+function if too many people be came depressed or rebellious. But the system =
+, for good, solid, practical=20
+reasons, must exert constant pressure on people to mold their behavior to =
+the needs of the system. Too=20
+much waste accumulating? The government, the media, the educational system, =
+environmentalists,=20
+everyone inundates us with a mass of propaganda about recycling. Need mo re =
+technical personnel? A=20
+chorus of voices exhorts kids to study science. No one stops to ask whether =
+it is inhumane to force=20
+adolescents to spend the bulk of their time studying subjects most of them =
+hate. When skilled workers are=20
+put out of a job by tec hnical advances and have to undergo "retrain ing," =
+no one asks=20
+whether it is humiliating for them to be pushed around in this way. It is =
+simply taken for granted that=20
+everyone must bow to technical necessity and for good reason: If human =
+needs were put before technical=20
+necessity there would be econo mic problems, unemployment, shortages or wor =
+se. The concept of "mental=20
+health" in our society is defined largely by the extent to which an =
+individual behaves in accord with the=20
+needs of the system and does so without showing signs of stress.=20
+
+120. Efforts to make room for a sense of purpose and for autonomy within =
+the system are no better than a=20
+joke. For example, one company, instead of having each of its employees =
+assemble only one section of a=20
+catalogue, had each assemble a whole catalog ue, and this was supposed to =
+give them a sen se of purpose=20
+and achievement. Some companies have tried to give their employees more =
+autonomy in their work, but for=20
+practical reasons this usually can be done only to a very limited extent, =
+and in any case employees are=20
+never given autonomy as to ultima te goals -- their "autonomous" efforts =
+can n ever be directed toward=20
+goals that they select personally, but only toward their employer's goals, =
+such as the survival and growth of=20
+the company. Any company would=20
+soon go out of business if it permitted its employees to act otherwise. =
+Similarly, in any enterprise within a=20
+socialist system, worker s must direct their efforts toward the goals of =
+the enterprise, otherwise the=20
+enterprise will not serve its purpose as part of the system. Once again, =
+for purely technical reasons it is not=20
+possible for most individuals or small groups to have much autono my in =
+industrial society. Even the=20
+small-bus iness owner commonly has only limited autonomy. Apart from the =
+necessity of government=20
+regulation, he is restricted by the fact that he must fit into the economic =
+system and conform to its=20
+requirements. For instance, when someone develops a new technology , the =
+small-business person often=20
+has to use that technology whether he wants to or not, in order to remain =
+competitive.=20
+
+
+
+THE 'BAD' PARTS OF TECHNOLOGY CANNOT BE SEPARATED FROM THE 'GOOD' =
+PARTS
+
+
+
+121. A further reason why industrial society cannot be reformed in favor of =
+freedom is that modern=20
+technology is a unified system in which all parts are dependent on one =
+another. You can't get rid of the=20
+"bad" parts of technology and retain only the "g ood" parts. Take modern =
+medicine, for exampl e. Progress=20
+in medical science depends on progress in chemistry, physics, biology, =
+computer science and other fields.=20
+Advanced medical treatments require expensive, high-tech equipment that can =
+be made available only by a=20
+technologically progressive, econ omically rich society. Clearly you can't =
+hav e much progress in medicine=20
+without the whole technological system and everything that goes with it. =
+
+
+122. Even if medical progress could be maintained without the rest of the =
+technological system, it would by=20
+itself bring certain evils. Suppose for example that a cure for diabetes is =
+discovered. People with a genetic=20
+tendency to diabetes will then be able to survive and reproduce as well as =
+an yone else. Natural selection=20
+against genes for diabetes will cease and such genes will spread throughout =
+the population. (This may be=20
+occurring to some extent already, since diabetes, while not curable, can be =
+controlled through the use of=20
+insulin.) The s ame thing will happen with many other diseas es =
+susceptibility to which is affected by=20
+genetic degradation of the population. The only solution will be some sort =
+of eugenics program or=20
+extensive genetic engineering of human beings,=20
+so that man in the future will no longer be a creation of nature, or of =
+chance, or of God (depending on your=20
+rel igious or philosophical opinions), but a manufactured product.=20
+
+123. If you think that big government interferes in your life too much NOW, =
+just wait till the government=20
+starts regulating the genetic constitution of your children. Such =
+regulation will inevitably follow the=20
+introduction of genetic engineering of hum an beings, because the =
+consequences of unreg ulated genetic=20
+engineering would be disastrous. [19]=20
+
+124. The usual response to such concerns is to talk about "medical ethics." =
+But a code of ethics would not=20
+serve to protect freedom in the face of medical progress; it would only =
+make matters worse. A code of=20
+ethics applicable to genetic engineering wo uld be in effect a means of =
+regulating the g enetic constitution=20
+of human beings. Somebody (probably the upper-middle class, mostly) would =
+decide that such and such=20
+applications of genetic engineering were "ethical" and others were not, so =
+that in effect they would be=20
+imposing their own values on th e genetic constitution of the population at =
+large. Even if a code of ethics=20
+were chosen on a completely democratic basis, the majority would be =
+imposing their own values on any=20
+minorities who might have a=20
+different idea of what constituted an "ethical" use of genetic engineering. =
+The only code of e thics that=20
+would truly protect freedom would be one that prohibited ANY genetic =
+engineering of human beings, and=20
+you can be sure that no such code will ever be applied in a technological =
+society. No code that reduced=20
+genetic engineering to a minor role could stand up for long, because the =
+temptatio n presented by the=20
+immense power of biotechn ology would be irresistible, especially since to =
+the majority of people many of=20
+its applications will seem obviously and unequivocally good (eliminating =
+physical and mental diseases,=20
+giving people the abilities they need to get along in today's world). In =
+evitably, genetic engineering will be=20
+used e xtensively, but only in ways consistent with the needs of the =
+industrial-technological system. [20]=20
+
+TECHNOLOGY IS A MORE POWERFUL SOCIAL FORCE THAN THE ASPIRATION FOR=20
+FREEDOM
+
+125. It is not possible to make a LASTING compromise between technology and =
+freedom, because=20
+technology is by far the more powerful social force and continually =
+encroaches on freedom through=20
+REPEATED compromises. Imagine the case of two neighbors, each of whom at =
+the outset owns the same=20
+amount of land, but one of whom is more powerful than the other. The =
+powerful one demands a piece of=20
+the other's land. The weak one refuses. The powerful one says, "OK, let's =
+compromise. Give me half of=20
+what I asked." The weak one has little choice but to give in. Some time =
+later the powerful neighbor demand=20
+s another piece of land, again there is a compromise, and so forth. By =
+forcing a long series of compromises=20
+on the weaker man, the powerful one eventually gets all of his land. So it =
+goes in the conflict between=20
+technology and freedom.=20
+
+126. Let us explain why technology is a more powerful social force than the =
+aspiration for freedom.=20
+
+127. A technological advance that appears not to threaten freedom often =
+turns out to threaten freedom often=20
+turns out to threaten it very seriously later on. For example, consider =
+motorized transport. A walking man=20
+formerly could go where he pleased, g o at his own pace without observing =
+any traf fic regulations, and=20
+was independent of technological support-systems. When motor vehicles were =
+introduced they appeared to=20
+increase man's freedom. They took no freedom away from the walking man, no =
+one had to have an=20
+automobile if he didn't want one, and anyone who did choose to buy an =
+automobile could travel much=20
+faster than the walking man. But the introduction of motorized transport =
+soon changed society in such a=20
+way as to restrict greatly man's freedom of locomotion. When automobiles =
+became numerous,=20
+it became necessary to regulate their use e xtensively. In a car, =
+especially in densely populated areas, one=20
+cannot just go where one likes at one's own pace one's movement is governed =
+by the flow of traffic and by=20
+various traffic laws. One is tied down by various obligations: license =
+requirements, driver test, renewing=20
+registration, insuran ce, maintenance required for safety, monthly payments =
+on purchase price. Moreover,=20
+the use of motorized transport is no longer optional. Since the =
+introduction of motorized transport the=20
+arrangement of our cities has changed in such a way that the majority of =
+people no longer live within=20
+walking di stance of their place of employment, shoppin g areas and =
+recreational opportunities, so that they=20
+HAVE TO depend on the automobile for transportation.=20
+Or else they must use public transportation, in which case they have even =
+less control over their own=20
+movement than when driving a car. Even the wal ker's freedom is now greatly =
+restricted. In the city he=20
+continually has to stop and wait for traffic lights that are designed =
+mainly to serve auto traffic. In the=20
+country, motor traffic makes it dangerous and unpleasant to walk along the =
+highway. (Note the important=20
+point we have illustrated with t he case of motorized transport: When a new =
+i tem of technology is=20
+introduced as an option that an individual can accept or not as he chooses, =
+it does not necessarily REMAIN=20
+optional. In many cases the new technology changes society in such a way =
+that people eventually find=20
+themselves FORCED to use i t.)=20
+
+128. While technological progress AS A WHOLE continually narrows our sphere =
+of freedom, each new=20
+technical advance CONSIDERED BY ITSELF appears to be desirable. =
+Electricity, indoor plumbing, rapid=20
+long-distance communications . . . how could one argue against any of these =
+things, or against any other of=20
+the innumerable technical advances that have made modern society? It would =
+have been absurd to resist the=20
+introduction of the telephone, for example. It offered many advantages and =
+no disadvantages. Yet as we=20
+explained in paragraphs 59-76, all th ese technical advances taken together =
+have c reated world in which=20
+the average man's fate is no longer in his own hands or in the hands of his =
+neighbors and friends, but in=20
+those of politicians, corporation executives and remote, anonymous =
+technicians=20
+and bureaucrats whom he as an individual has no power to influence. [21] =
+The same process wi ll continue=20
+in the future. Take genetic engineering, for example. Few people will =
+resist the introduction of a genetic=20
+technique that eliminates a hereditary disease It does no apparent harm and =
+prevents much suffering. Yet a=20
+large number of genetic impr ovements taken together will make the human =
+being into an engineered=20
+product rather than a free creation of chance (or of God, or whatever, =
+depending on your religious beliefs).=20
+
+129 Another reason why technology is such a powerful social force is that, =
+within the context of a given=20
+society, technological progress marches in only one direction; it can never =
+be reversed. Once a technical=20
+innovation has been introduced, people us ually become dependent on it, =
+unless it is r eplaced by some still=20
+more advanced innovation. Not only do people become dependent as =
+individuals on a new item of=20
+technology, but, even more, the system as a whole becomes dependent on it. =
+(Imagine what would happen=20
+to the system today if computers, for example, were eliminated.) Thus the =
+system can move in only one=20
+direction, toward greater technologization. Technology repeatedly forces =
+freedom to take a step back --=20
+short of the overthrow of the whole technological system.=20
+
+130. Technology advances with great rapidity and threatens freedom at many =
+different points at the same=20
+time (crowding, rules and regulations, increasing dependence of individuals =
+on large organizations,=20
+propaganda and other psychological techniques, g enetic engineering, =
+invasion of privacy thro ugh=20
+surveillance devices and computers, etc.) To hold back any ONE of the =
+threats to freedom would require a=20
+long different social struggle. Those who want to protect freedom are =
+overwhelmed by the sheer number of=20
+new attacks and the rapidity with which t hey develop, hence they become =
+pathetic and no longer resist. To=20
+fight each of the threats separately would be futile. Success can be hoped =
+for only by fighting the=20
+technological system as a whole; but that is revolution not reform. =
+
+
+131. Technicians (we use this term in its broad sense to describe all those =
+who perform a specialized task=20
+that requires training) tend to be so involved in their work (their =
+surrogate activity) that when a conflict=20
+arises between their technical work and freedom, they almost always decide =
+in fa vor of their technical=20
+work. This is obvious in the case of scientists, but it also appears =
+elsewhere: Educators, humanitarian=20
+groups, conservation organizations do not hesitate to use propaganda or =
+other psychological techniques to=20
+help them achieve thei r laudable ends. Corporations and government =
+agencies, when they find it useful, do=20
+not hesitate to collect information about individuals without regard to =
+their privacy. Law enforcement=20
+agencies are=20
+frequently inconvenienced by the constitutional rights of suspects and =
+often of completely innocent=20
+persons, and they do whatever they can do l egally (or sometimes illegally) =
+to restrict or circumvent those=20
+rights. Most of these educators, government officials and law officers =
+believe in freedom, privacy and=20
+constitutional rights, but when these conflict with their work, they =
+usually feel that t heir work is more=20
+important.=20
+
+132. It is well known that people generally work better and more =
+persistently when striving for a reward=20
+than when attempting to avoid a punishment or negative outcome. Scientists =
+and other technicians are=20
+motivated mainly by the rewards they get throu gh their work. But those who =
+oppose technilo giccal=20
+invasions of freedom are working to avoid a negative outcome, consequently =
+there are a few who work=20
+persistently and well at this discouraging task. If reformers ever achieved =
+a signal victory that seemed to set=20
+up a solid barrier against further e rosion of freedom through =
+technological prog ress, most would tend to=20
+relax and turn their attention to more agreeable pursuits. But the =
+scientists would remain busy in their=20
+laboratories, and technology as it progresses would find ways,=20
+in spite of any barriers, to exert more and more control over individuals =
+and make them always more=20
+depend ent on the system.=20
+
+133. No social arrangements, whether laws, institutions, customs or ethical =
+codes, can provide permanent=20
+protection against technology. History shows that all social arrangements =
+are transitory; they all change or=20
+break down eventually. But technologic al advances are permanent within the =
+context of a given=20
+civilization. Suppose for example that it were possible to arrive at some =
+social arrangements that would=20
+prevent genetic engineering from being applied to human beings, or prevent =
+it from being applied in such a=20
+ways as to threaten freedom and dignity. Still, the technology would remain =
+waiting. Sooner or later the=20
+social arrangement would break down. Probably sooner, given that pace of =
+change in our society. Then=20
+genetic engineering would begin to invade our=20
+sphere of freedom, and this invasion would be irreversible (short of a =
+breakdo wn of technological=20
+civilization itself). An y illusions about achieving anything permanent =
+through social arrangements should=20
+be dispelled by what is currently happening with environmental legislation. =
+A few years ago it seemed that=20
+there were secure legal barriers preventing at least SOME of the w orst =
+forms of environmental=20
+degradation. A c hange in the political wind, and those barriers begin to =
+crumble.=20
+
+134. For all of the foregoing reasons, technology is a more powerful social =
+force than the aspiration for=20
+freedom. But this statement requires an important qualification. It appears =
+that during the next several=20
+decades the industrial-technological syst em will be undergoing severe =
+stresses due to economic and=20
+environmental problems, and especially due to problems of human behavior =
+(alienation, rebellion, hostility,=20
+a variety of social and psychological difficulties). We hope that the =
+stresses through which the system is=20
+likely to pass will cause it to break down, or at least weaken it suff =
+iciently so that a revolution occurs and=20
+is successful, then at that particular moment the aspiration for freedom =
+will have proved more powerful=20
+than technology.=20
+
+135. In paragraph 125 we used an analogy of a weak neighbor who is left =
+destitute by a strong neighbor=20
+who takes all his land by forcing on him a series of compromises. But =
+suppose now that the strong=20
+neighbor gets sick, so that he is unable to defend himself. The weak =
+neighbor can force the str ong one to=20
+give him his land back, or he can kill him. If he lets the strong man =
+survive and only forces him to give his=20
+land back, he is a fool, because when the strong man gets well he will =
+again take all the land for himself.=20
+The only sensible alternat ive for the weaker man is to kill the strong one =
+while he has the chance. In the=20
+same way, while the industrial system is sick we must destroy it. If we =
+compromise with it and let it=20
+recover from its sickness, it will eventually wipe out all of our freedom. =
+
+
+SIMPLER SOCIAL PROBLEMS HAVE PROVED INTRACTABLE
+
+136. If anyone still imagines that it would be possible to reform the =
+system in such a way as to protect=20
+freedom from technology, let him consider how clumsily and for the most =
+part unsuccessfully our society=20
+has dealt with other social problems that a re far more simple and =
+straightforward. Amon g other things, the=20
+system has failed to stop environmental degradation, political corruption, =
+drug trafficking or domestic=20
+abuse.=20
+
+137. Take our environmental problems, for example. Here the conflict of =
+values is straightforward:=20
+economic expedience now versus saving some of our natural resources for our =
+grandchildren [22] But on=20
+this subject we get only a lot of blather and obfus cation from the people =
+who have power, and n othing=20
+like a clear, consistent line of action, and we keep on piling up =
+environmental problems that our=20
+grandchildren will have to live with. Attempts to resolve the environmental =
+issue consist of struggles and=20
+compromises between different factions, som e of which are ascendant at one =
+moment, othe rs at another=20
+moment. The line of struggle changes with the shifting currents of public =
+opinion. This is not a rational=20
+process, or is it one that is likely to lead to a timely and successful =
+solution to the problem.=20
+Major social problems, if they get "so lved" at all, are rarely or never =
+solved thr ough any rational,=20
+comprehensive plan. They just work themselves out through a process in =
+which various competing groups=20
+pursing their own usually short-term) self-interest [23] arrive (mainly by =
+luck) at some more or less stable=20
+modus vivendi. In fact, t he principles we formulated in paragraphs 10 =
+0-106 make it seem doubtful that=20
+rational, long-term social planning can EVER be successful. 138. Thus it is =
+clear that the human race has at=20
+best a very limited capacity for solving even relatively straightforward =
+social problems. How then is it=20
+going to solve the far more difficult and subtle problem of reconciling =
+freedom with technology?=20
+Technology presents clear-cut material advantages,=20
+whereas freedom is an abstraction that means different things to different =
+people, and its loss is easily=20
+obscured by propaganda and fancy talk.=20
+
+139. And note this important difference: It is conceivable that our =
+environmental problems (for example)=20
+may some day be settled through a rational, comprehensive plan, but if this =
+happens it will be only because=20
+it is in the long-term interest of the system to solve these problems. But =
+it is NOT in the interest of the=20
+system to preserve freedom or small-group autonomy. On the contrary, it is =
+in the interest of the system to=20
+bring human behavior under control to the greatest possible extent. Thus, =
+while practical considerations=20
+may eventually force the system to take a rational, prudent approach to =
+environmental problems, equally=20
+practical considerations will force the system to regulate human behavior =
+ever more closely (preferably by=20
+indirect means that will disguise the encroachment on freedom.)=20
+This isn't just our opinion. Eminent social scientists (e.g. James Q. =
+Wilson) have stressed the importance of=20
+"socializing" people more effectively.
+
+
+
+REVOLUTION IS EASIER THAN REFORM
+
+140. We hope we have convinced the reader that the system cannot be =
+reformed in a such a way as to=20
+reconcile freedom with technology. The only way out is to dispense with the =
+industrial-technological=20
+system altogether. This implies revolution, not necessarily an armed =
+uprising, but certainly a radical and=20
+fundamental change in the nature of society.=20
+
+141. People tend to assume that because a revolution involves a much =
+greater change than reform does, it is=20
+more difficult to bring about than reform is. Actually, under certain =
+circumstances revolution is much=20
+easier than reform. The reason is that a revolutionary movement can inspire =
+an intensity of commitment=20
+that a reform movement cannot inspire. A reform movement merely offers to =
+solve a particular social=20
+problem A revolutionary movement offers to solve all problems at one stroke =
+and create a whole new=20
+world; it provides the kind of ideal for which people will take great risks =
+and make great sacrifices. For this=20
+reasons it would be much easier to overthrow the whole technological system =
+than to put effective,=20
+permanent restraints on the development of application of any one segment =
+of technology, s
+uch as genetic engineering, but under suitable conditions large numbers of =
+people may devote themselves=20
+passionately=20
+to a revolution against the industrial-technological system. As we noted in =
+paragraph 132, reformers=20
+seeking to limite certain aspects of technology would be working to avoid a =
+negative outcome. But=20
+revolutionaries work to gain a powerful reward -- fulfillment of their =
+revolutionary vision -- and therefore=20
+work harder and more persistently than reformers do.=20
+
+142. Reform is always restrainde by the fear of painful consequences if =
+changes go too far. But once a=20
+revolutionary fever has taken hold of a society, people are willing to =
+undergo unlimited hardships for the=20
+sake of their revolution. This was clearly shown in the French and Russian =
+Revolutions. It may be that in=20
+such cases only a minority of the population is really committed to the =
+revolution, but this minority is=20
+sufficiently large and active so that it becomes the dominant force in =
+society. We will have more to say=20
+about revolution in paragraphs 180-205.=20
+
+
+
+CONTROL OF HUMAN BEHAVIOR
+
+143. Since the beginning of civilization, organized societies have had to =
+put pressures on human beings of=20
+the sake of the functioning of the social organism. The kinds of pressures =
+vary greatly from one society to=20
+another. Some of the pressures are physical (poor diet, excessive labor, =
+environmental pollution), some are=20
+psychological (noise, crowding, forcing humans behavior into the mold that =
+society requires). In the past,=20
+human nature has been approximately constant, or at any rate has varied =
+only within certain bounds.=20
+Consequently, societies have been able to push people only up to certain =
+limits. When the limit of human=20
+endurance has been passed, things start going rong: rebellion, or crime, or =
+corruption, or evasion of work,=20
+or depression and other mental problems,=20
+or an elevated death rate, or a declining birth rate or something else, so =
+that either the society breaks down,=20
+or its functioning becomes too inefficient and it is (quickly or gradually, =
+through conquest, attrition or=20
+evolution) replaces by some more efficient form of society.
+
+[25]=20
+
+144. Thus human nature has in the past put certain limits on the =
+development of societies. People coud be=20
+pushed only so far and no farther. But today this may be changing, because =
+modern technology is=20
+developing way of modifying human beings.
+
+145. Imagine a society that subjects people to conditions that amke them =
+terribley unhappy, then gives=20
+them the drugs to take away their unhappiness. Science fiction? It is =
+already happening to some extent in=20
+our own society. It is well known that the rate of clinical depression had =
+been greatly increasing in recent=20
+decades. We believe that this is due to disruption fo the power process, as =
+explained in paragraphs 59-76.=20
+But even if we are wrong, the increasing rate of depression is certainly =
+the result of SOME conditions that=20
+exist in today's society. Instead of removing the conditions that make =
+people depressed, modern society=20
+gives them antidepressant drugs. In effect, antidepressants area a means of =
+modifying an individual's=20
+internal state in such a way as to=20
+enable him to toelrate social conditions that he would otherwise find =
+intolerable. (Yes, we know that=20
+depression is often of purely genetic origin. We are referring here to =
+those cases in which environment=20
+plays the predominant role.)=20
+
+146. Drugs that affect the mind are only one example of the methods of =
+controlling human behavior that=20
+modern society is developing. Let us look at some of the other methods. =
+
+
+147. To start with, there are the techniques of surveillance. Hidden video =
+cameras are now used in most=20
+stores and in many other places, computers are used to collect and process =
+vast amounts of information=20
+about individuals. Information so obtained greatly increases the =
+effectiveness of physical coercion (i.e., law=20
+enforcement).[26] Then there are the methods of propaganda, for which the =
+mass communication media=20
+provide effective vehicles. Efficient techniques have been developed for =
+winning elections, selling=20
+products, influencing public opinion. The entertainment industry serves as =
+an important psychological tool=20
+of the system, possibly even when it is dishing out large amounts of sex =
+and violence. Entertainment=20
+provides modern man with an essential means of escape.=20
+While absorbed in television, videos, etc., he can forget stress, anxiety, =
+frustration, dissatisfaction. Many=20
+primitive peoples, when they don't have work to do, are quite content to =
+sit for hours at a time doing=20
+nothing at all, because they are at peace with themselves and their world. =
+But most modern people must be=20
+contantly occupied or entertained, otherwise the get "bored," i.e., they =
+get fidgety, uneasy, irritable.=20
+
+148. Other techniques strike deeper that the foregoing. Education is no =
+longer a simple affair of paddling a=20
+kid's behind when he doesn't know his lessons and patting him on the head =
+when he does know them. It is=20
+becoming a scientific technique for controlling the child's development. =
+Sylvan Learning Centers, for=20
+example, have had great success in motivating children to study, and =
+psychological techniques are also=20
+used with more or less success in many conventional schools. "Parenting" =
+techniques that are taught to=20
+parents are designed to make children accept fundamental values of the =
+system and behave in ways that the=20
+system finds desirable. "Mental health" programs, "intervention" =
+techniques, psychotherapy and so forth=20
+are ostensibly designed to benefit individuals,=20
+but in practice they usually serve as methods for inducing individuals to =
+think and behave as the system=20
+requires. (There is no contradiction here; an individual whose attitudes or =
+behavior bring him into conflict=20
+with the system is up against a force that is too powerful for him to =
+conquer or escape from, hence he is=20
+likely to suffer from stress, frustration, defeat. His path will be much =
+easier if he thinks and behaves as the=20
+system requires. In that sense the system is acting for the benefit of the =
+individual when it brainwashes him=20
+into conformity.) Child abuse in its gross and obvious forms is disapproved =
+in most if not all cultures.=20
+Tormenting a child for a trivial reason or no reason at all is something =
+that appalls almost everyone.=20
+But many psychologists interpret the concept of abuse much more broadly. Is =
+spanking, when used as part=20
+of a rational and consistent system of discipline, a form of abuse? The =
+question will ultimately be decided=20
+by whether or not spanking tends to produce behavior that makes a person =
+fit in well with the existing=20
+system of society. In practice, the word "abuse" tends to be interpreted to =
+include any method of child-
+rearing that produces behavior inconvenient for the system. Thus, when they =
+go beyond the prevention of=20
+obvious, senseless cruelty, programs for preventing "child abuse" are =
+directed toward the control of human=20
+behavior of the system.=20
+
+149. Presumably, research will continue to increas the effectiveness of =
+psychological techniques for=20
+controlling human behavior. But we think it is unlikely that psychological =
+techniques alone will be=20
+sufficient to adjust human beings to the kind of society that technology is =
+creating. Biological methods=20
+probably will have to be used. We have already mentiond the use of drugs in =
+this connection. Neurology=20
+may provide other avenues of modifying the human mind. Genetic engineering =
+of human beings is already=20
+beginning to occur in the form of "gene therapy," and there is no reason to =
+assume the such methods will=20
+not eventually be used to modify those aspects of the body that affect =
+mental funtioning.=20
+
+150. As we mentioned in paragraph 134, industrial society seems likely to =
+be entering a period of severe=20
+stress, due in part to problems of human behavior and in part to economic =
+and environmental problems.=20
+And a considerable proportion of the system's economic and environmental =
+problems result from the way=20
+human beings behave. Alienation, low self-esteem, depression, hostility, =
+rebellion; children who won't=20
+study, youth gangs, illegal drug use, rape, child abuse , other crimes, =
+unsafe sex, teen pregnancy,=20
+population growth, political corruption, race hatred, ethnic rivalry, =
+bitter ideological conflict (i.e., pro-
+choice vs. pro-life), political extremism, terrorism, sabotage, =
+anti-government groups, hate groups. All=20
+these threaten the very survival of the system.=20
+The system will be FORCED to use every practical means of controlling human =
+behavior.=20
+
+151. The social disruption that we see today is certainly not the result of =
+mere chance. It can only be a=20
+result fo the conditions of life that the system imposes on people. (We =
+have argued that the most important=20
+of these conditions is disruption of the power process.) If the systems =
+succeeds in imposing sufficient=20
+control over human behavior to assure itw own survival, a new watershed in =
+human history will have=20
+passed. Whereas formerly the limits of human endurance have imposed limits =
+on the development of=20
+societies (as we explained in paragraphs 143, 144), =
+industrial-technological society will be able to pass=20
+those limits by modifying human beings, whether by psychological methods or =
+biological methods or both.=20
+In the future, social systems will not be adjusted to suit the needs of =
+human beings.=20
+Instead, human being will be adjusted to suit the needs of the =
+system.
+
+[27] 152. Generally speaking, technological control over human behavior =
+will probably not be introduced=20
+with a totalitarian intention or even through a conscious desire to =
+restrict human freedom. [28] Each new=20
+step in the assertion of control over the human mind will be taken as a =
+rational response to a problem that=20
+faces society, such as curing alcoholism, reducing the crime rate or =
+inducing young people to study science=20
+and engineering. In many cases, there will be humanitarian justification. =
+For example, when a psychiatrist=20
+prescribes an anti-depressant for a depressed patient, he is clearly doing =
+that individual a favor. It would be=20
+inhumane to withhold the drug from someone who needs it. When parents send =
+their children to Sylvan=20
+Learning Centers to have them manipulated into becoming enthusiastic about =
+their studies,=20
+they do so from concern for their children's welfare. It may be that some =
+of these parents wish that one=20
+didn't have to have specialized training to get a job and that their kid =
+didn't have to be brainwashed into=20
+becoming a computer nerd. But what can they do? They can't change society, =
+and their child may be=20
+unemployable if he doesn't have certain skills. So they send him to Sylvan. =
+
+
+153. Thus control over human behavior will be introduced not by a =
+calculated decision of the authorities=20
+but through a process of social evolution (RAPID evolution, however). The =
+process will be impossible to=20
+resist, because each advance, considered by itself, will appear to be =
+beneficial, or at least the evil involved=20
+in making the advance will appear to be beneficial, or at least the evil =
+involved in making the advance will=20
+seem to be less than that which would result from not making it (see =
+paragraph 127). Propaganda for=20
+example is used for many good purposes, such as discouraging child abuse or =
+race hatred. [14] Sex=20
+education is obviously useful, yet the effect of sex education (to the =
+extent that it is successful) is to take=20
+the shaping of sexual attitudes=20
+away from the family and put it into the hands of the state as represented =
+by the public school system.=20
+
+154. Suppose a biological trait is discovered that increases the likelihood =
+that a child will grow up to be a=20
+criminal and suppose some sort of gene therapy can remove this trait. [29] =
+Of course most parents whose=20
+children possess the trait will have them undergo the therapy. It would be =
+inhumane to do otherwise, since=20
+the child would probably have a miserable life if he grew up to be a =
+criminal. But many or most primitive=20
+societies have a low crime rate in comparison with that of our society, =
+even though they have neither high-
+tech methods of child-rearing nor harsh systems of punishment. Since there =
+is no reason to suppose that=20
+more modern men than primitive men have innate predatory tendencies, the =
+high crime rate of our society=20
+must be due to the pressures that modern conditions put on people,=20
+to which many cannot or will not adjust. Thus a treatment designed to =
+remove potential criminal tendencies=20
+is at least in part a way of re-engineering people so that they suit the =
+requirements of the system.=20
+
+155. Our society tends to regard as a "sickness" any mode of thought or =
+behavior that is inconvenient for=20
+the system, and this is plausible because when an individual doesn't fit =
+into the system it causes pain to the=20
+individual as well as problems for the system. Thus the manipulation of an =
+individual to adjust him to the=20
+system is seen as a "cure" for a "sickness" and therefore as good.=20
+
+156. In paragraph 127 we pointed out that if the use of a new item of =
+technology is INITIALLY optional, it=20
+does not necessarily REMAIN optional, because the new technology tends to =
+change society in such a way=20
+that it becomes difficult or impossible for an individual to function =
+without using that technology. This=20
+applies also to the technology of human behavior. In a world in which most =
+children are put through a=20
+program to make them enthusiastic about studying, a parent will almost be =
+forced to put his kid through=20
+such a program, because if he does not, then the kid will grow up to be, =
+comparatively speaking, an=20
+ignoramus and therefore unemployable. Or suppose a biological treatment is =
+discovered that, without=20
+undesirable side-effects,=20
+will greatly reduce the psychological stress from which so many people =
+suffer in our society. If large=20
+numbers of people choose to undergo the treatment, then the general level =
+of stress in society will be=20
+reduced, so that it will be possible for the system to increase the =
+stress-producing pressures. In fact,=20
+something like this seems to have happened already with one of our =
+society's most important psychological=20
+tools for enabling people to reduce (or at least temporarily escape from) =
+stress, namely, mass entertainment=20
+(see paragraph 147). Our use of mass entertainment is "optional": No law =
+requires us to watch television,=20
+listen to the radio, read magazines. Yet mass entertainment is a means of =
+escape and stress-reduction on=20
+which most of us have become dependent.=20
+Everyone complains about the trashiness of television, but almost everyone =
+watches it. A few have kicked=20
+the TV habit, but it would be a rare person who could get along today =
+without using ANY form of mass=20
+entertainment. (Yet until quite recently in human history most people got =
+along very nicely with no other=20
+entertainment than that which each local community created for itself.) =
+Without the entertainment industry=20
+the system probably would not have been able to get away with putting as =
+much stress-producing pressure=20
+on us as it does.=20
+
+157. Assuming that industrial society survives, it is likely that =
+technology will eventually acquire=20
+something approaching complete control over human behavior. It has been =
+established beyond any rational=20
+doubt that human thought and behavior have a largely biological basis. As =
+experimenters have=20
+demonstrated, feelings such as hunger, pleasure, anger and fear can be =
+turned on and off by electrical=20
+stimulation of appropriate parts of the brain. Memories can be destroyed by =
+damaging parts of the brain or=20
+they can be brought to the surface by electrical stimulation. =
+Hallucinations can be induced or moods=20
+changed by drugs. There may or may not be an immaterial human soul, but if =
+there is one it clearly is less=20
+powerful that the biological mechanisms of human behavior.=20
+For if that were not the case then researchers would not be able so easily =
+to manipulate human feelings and=20
+behavior with drugs and electrical currents.=20
+
+158. It presumably would be impractical for all people to have electrodes =
+inserted in their heads so that=20
+they could be controlled by the authorities. But the fact that human =
+thoughts and feelings are so open to=20
+biological intervention shows that the problem of controlling human =
+behavior is mainly a technical=20
+problem; a problem of neurons, hormones and complex molecules; the kind of =
+problem that is accessible to=20
+scientific attack. Given the outstanding record of our society in solving =
+technical problems, it is=20
+overwhelmingly probable that great advances will be made in the control of =
+human behavior.=20
+
+159. Will public resistance prevent the introduction of technological =
+control of human behavior? It=20
+certainly would if an attempt were made to introduce such control all at =
+once. But since technological=20
+control will be introduced through a long sequence of small advances, there =
+will be no rational and=20
+effective public resistance. (See paragraphs 127,132, 153.)=20
+
+160. To those who think that all this sounds like science fiction, we point =
+out that yesterday's science=20
+fiction is today's fact. The Industrial Revolution has radically altered =
+man's environment and way of life,=20
+and it is only to be expected that as technology is increasingly applied to =
+the human body and mind, man=20
+himself will be altered as radically as his environment and way of life =
+have been.=20
+
+
+
+HUMAN RACE AT A CROSSROADS
+
+161. But we have gotten ahead of our story. It is one thing to develop in =
+the laboratory a series of=20
+psychological or biological techniques for manipulating human behavior and =
+quite another to integrate=20
+these techniques into a functioning social system. The latter problem is =
+the more difficult of the two. For=20
+example, while the techniques of educational psychology doubtless work =
+quite well in the "lab schools"=20
+where they are developed, it is not necessarily easy to apply them =
+effectively throughout our educational=20
+system. We all know what many of our schools are like. The teachers are too =
+busy taking knives and guns=20
+away from the kids to subject them to the latest techniques for making them =
+into computer nerds. Thus, in=20
+spite of all its technical advances relating=20
+to human behavior the system to date has not been impressively successful =
+in controlling human beings.=20
+The people whose behavior is fairly well under the control of the system =
+are those of the type that might be=20
+called "bourgeois." But there are growing numbers of people who in one way =
+or another are rebels against=20
+the system: welfare leaches, youth gangs cultists, satanists, nazis, =
+radical environmentalists, militiamen,=20
+etc..=20
+
+162. The system is currently engaged in a desperate struggle to overcome =
+certain problems that threaten its=20
+survival, among which the problems of human behavior are the most =
+important. If the system succeeds in=20
+acquiring sufficient control over human behavior quickly enough, it will =
+probably survive. Otherwise it=20
+will break down. We think the issue will most likely be resolved within the =
+next several decades, say 40 to=20
+100 years.=20
+
+163. Suppose the system survives the crisis of the next several decades. By =
+that time it will have to have=20
+solved, or at least brought under control, the principal problems that =
+confront it, in particular that of=20
+"socializing" human beings; that is, making people sufficiently docile so =
+that their behavior no longer=20
+threatens the system. That being accomplished, it does not appear that =
+there would be any further obstacle=20
+to the development of technology, and it would presumably advance toward =
+its logical conclusion, which is=20
+complete control over everything on Earth, including human beings and all =
+other important organisms. The=20
+system may become a unitary, monolithic organization, or it may be more or =
+less fragmented and consist of=20
+a number of organizations coexisting=20
+in a relationship that includes elements of both cooperation and =
+competition, just as today the government,=20
+the corporations and other large organizations both cooperate and compete =
+with one another. Human=20
+freedom mostly will have vanished, because individuals and small groups =
+will be impotent vis-a-vis large=20
+organizations armed with supertechnology and an arsenal of advanced =
+psychological and biological tools=20
+for manipulating human beings, besides instruments of surveillance and =
+physical coercion. Only a small=20
+number of people will have any real power, and even these probably will =
+have only very limited freedom,=20
+because their behavior too will be regulated; just as today our politicians =
+and corporation executives can=20
+retain their positions of power only as long=20
+as their behavior remains within certain fairly narrow limits.=20
+
+164. Don't imagine that the systems will stop developing further techniques =
+for controlling human beings=20
+and nature once the crisis of the next few decades is over and increasing =
+control is no longer necessary for=20
+the system's survival. On the contrary, once the hard times are over the =
+system will increase its control over=20
+people and nature more rapidly, because it will no longer be hampered by =
+difficulties of the kind that it is=20
+currently experiencing. Survival is not the principal motive for extending =
+control. As we explained in=20
+paragraphs 87-90, technicians and scientists carry on their work largely as =
+a surrogate activity; that is, they=20
+satisfy their need for power by solving technical problems. They will =
+continue to do this with unabated=20
+enthusiasm,=20
+and among the most interesting and challenging problems for them to solve =
+will be those of understanding=20
+the human body and mind and intervening in their development. For the "good =
+of humanity," of course.=20
+
+165. But suppose on the other hand that the stresses of the coming decades =
+prove to be too much for the=20
+system. If the system breaks down there may be a period of chaos, a "time =
+of troubles" such as those that=20
+history has recorded: at various epochs in the past. It is impossible to =
+predict what would emerge from such=20
+a time of troubles, but at any rate the human race would be given a new =
+chance. The greatest danger is that=20
+industrial society may begin to reconstitute itself within the first few =
+years after the breakdown. Certainly=20
+there will be many people (power-hungry types especially) who will be =
+anxious to get the factories running=20
+again.=20
+
+166. Therefore two tasks confront those who hate the servitude to which the =
+industrial system is reducing=20
+the human race. First, we must work to heighten the social stresses within =
+the system so as to increase the=20
+likelihood that it will break down or be weakened sufficiently so that a =
+revolution against it becomes=20
+possible. Second, it is necessary to develop and propagate an ideology that =
+opposes technology and the=20
+industrial society if and when the system becomes sufficiently weakened. =
+And such an ideology will help=20
+to assure that, if and when industrial society breaks down, its remnants =
+will be smashed beyond repair, so=20
+that the system cannot be reconstituted. The factories should be destroyed, =
+technical books burned, etc.=20
+
+
+
+HUMAN SUFFERING
+
+167. The industrial system will not break down purely as a result of =
+revolutionary action. It will not be=20
+vulnerable to revolutionary attack unless its own internal problems of =
+development lead it into very serious=20
+difficulties. So if the system breaks down it will do so either =
+spontaneously, or through a process that is in=20
+part spontaneous but helped along by revolutionaries. If the breakdown is =
+sudden, many people will die,=20
+since the world's population has become so overblown that it cannot even =
+feed itself any longer without=20
+advanced technology. Even if the breakdown is gradual enough so that =
+reduction of the population can=20
+occur more through lowering of the birth rate than through elevation of the =
+death rate, the process of de-
+industrialization probably will=20
+be very chaotic and involve much suffering. It is naive to think it likely =
+that technology can be phased out=20
+in a smoothly managed orderly way, especially since the technophiles will =
+fight stubbornly at every step. Is=20
+it therefore cruel to work for the breakdown of the system? Maybe, but =
+maybe not. In the first place,=20
+revolutionaries will not be able to break the system down unless it is =
+already in deep trouble so that there=20
+would be a good chance of its eventually breaking down by itself anyway; =
+and the bigger the system=20
+grows, the more disastrous the consequences of its breakdown will be; so it =
+may be that revolutionaries, by=20
+hastening the onset of the breakdown will be reducing the extent of the =
+disaster.=20
+
+168. In the second place, one has to balance the struggle and death against =
+the loss of freedom and dignity.=20
+To many of us, freedom and dignity are more important than a long life or =
+avoidance of physical pain.=20
+Besides, we all have to die some time, and it may be better to die fighting =
+for survival, or for a cause, than=20
+to live a long but empty and purposeless life.=20
+
+169. In the third place, it is not all certain that the survival of the =
+system will lead to less suffering than the=20
+breakdown of the system would. The system has already caused, and is =
+continuing to cause , immense=20
+suffering all over the world. Ancient cultures, that for hundreds of years =
+gave p eople a satisfactory=20
+relationship with each other and their environment, have been shattered by =
+contact with industrial society,=20
+and the result has been a whole catalogue of economic, environmental, =
+social and psychological problems.=20
+One of the effects o f the intrusion of industrial society has be en that =
+over much of the world traditional=20
+controls on population have been thrown out of balance. Hence the =
+population explosion, with all that it=20
+implies.=20
+Then there is the psychological suffering that is widespread throughout the =
+supposedly fortunate countries=20
+of the West (see paragraphs 44, 4 5). No one knows what will happen as a =
+result of ozone depletion, the=20
+greenhouse effect and other environmental problems that cannot yet be =
+foreseen. And, as nuclear=20
+proliferation has shown, new technology cannot be kept out of the hands of =
+dictators an d irresponsible=20
+Third World nations. Would you like to speculate abut what Iraq or North =
+Korea will do with genetic=20
+engineering?=20
+
+170. "Oh!" say the technophiles, "Science is going to fix all that! We will =
+conquer famine, eliminate=20
+psychological suffering, make everybody healthy and happy!" Yeah, sure. =
+That's what they said 200 years=20
+ago. The Industrial Revolution was supposed to eliminate poverty, make =
+everybody happy, etc. The actual=20
+result has been quite different. The technophiles are hopelessly naive (or =
+self-deceiving) in their=20
+understanding of social problems. They are unaware of (or choose to ignore) =
+the fact that when large=20
+changes, even seemingly beneficial ones, are introduced into a society, =
+they le ad to a long sequence of=20
+other changes, most of which are impossible to predict (paragraph 103). The =
+result is disruption of the=20
+society. So it is very probable that=20
+in their attempt to end poverty and disease, engineer docile, happy =
+personalities and s o forth, the=20
+technophiles will create socia l systems that are terribly troubled, even =
+more so that the present one. For=20
+example, the scientists boast that they will end famine by creating new, =
+genetically engineered food plants.=20
+But this will allow the human population to keep expanding indefini tely, =
+and it is well known that=20
+crowding lea ds to increased stress and aggression. This is merely one =
+example of the PREDICTABLE=20
+problems that will arise. We emphasize that, as past experience has shown, =
+technical progress will lead to=20
+other new problems for society far more rapidly that it has b een solving =
+old ones. Thus it will take a l ong=20
+difficult period of=20
+trial and error for the technophiles to work the bugs out of their Brave =
+New World (if they ever do). In the=20
+meantime there will be great suffering. So it is not all clear that the =
+survival of industrial society would=20
+involve les s suffering than the breakdown of that socie ty would. =
+Technology has gotten the human race=20
+into a fix from which there is not likely to be any easy escape.=20
+
+
+
+THE FUTURE
+
+171. But suppose now that industrial society does survive the next several =
+decade and that the bugs do=20
+eventually get worked out of the system, so that it functions smoothly. =
+What kind of system will it be? We=20
+will consider several possibilities.=20
+
+172. First let us postulate that the computer scientists succeed in =
+developing intelligent machines that can=20
+do all things better that human beings can do them. In that case presumably =
+all work will be done by vast,=20
+highly organized systems of machines and no human effort will be necessary. =
+Eith er of two cases might=20
+occur. The machines might be permitted to make all of their own decisions =
+without human oversight, or=20
+else human control over the machines might be retained.=20
+
+173. If the machines are permitted to make all their own decisions, we =
+can't make any conjectures as to the=20
+results, because it is impossible to guess how such machines might behave. =
+We only point out that the fate=20
+of the human race would be at the merc y of the machines. It might be =
+argued that the human race would=20
+never be foolish enough to hand over all the power to the machines. But we =
+are suggesting neither that the=20
+human race would voluntarily turn power over to the machines nor that the =
+machines would willfully seize=20
+power. What we do su ggest is that the human race might easily pe rmit =
+itself to drift into a position of such=20
+dependence on the machines that it would have no practical choice but to =
+accept all of the machines=20
+decisions.=20
+As society and the problems that face it become more and more complex and =
+machines become more and=20
+more intelligent, people will let machines make more of their decision for =
+them, simply because machine-
+made decisions will bring better result than man-made ones. Eventually a =
+stage may be reached at which=20
+the decisions necessary to keep the system running will be so complex that =
+human beings wi ll be incapable=20
+of making them intelligently . At that stage the machines will be in =
+effective control. People won't be able=20
+to just turn the machines off, because they will be so dependent on them =
+that turning them off would=20
+amount to suicide.=20
+
+174. On the other hand it is possible that human control over the machines =
+may be retained. In that case the=20
+average man may have control over certain private machines of his own, such =
+as his car of his personal=20
+computer, but control over large systems of machines will be in the hands =
+of a tiny e lite -- just as it is=20
+today, but with two difference. Due to improved techniques the elite will =
+have greater control over the=20
+masses; and because human work will no longer be necessary the masses will =
+be superfluous, a useless=20
+burden on the system. If t he elite is ruthless the may simply decide t o =
+exterminate the mass of humanity.=20
+If they are humane they may use propaganda or other psychological or =
+biological techniques to reduce the=20
+birth rate until=20
+the mass of humanity becomes extinct, leaving the world to the elite. Or, =
+if the elite consist of soft-hearted=20
+liberals, they may decide to play the role of good shepherds to the rest of =
+the human race. They will see to=20
+it that everyone's physical needs are satisfied, that all children are =
+raised under psychologically hygienic=20
+conditions, that everyone has a wholesome hobby to keep him busy , and that =
+anyone who may become=20
+dissatisfie d undergoes "treatment" to cure his "problem." Of course, life =
+will be so purposeless that people=20
+will have to be biologically or psychologically engineered either to remove =
+their need for the power=20
+process or to make them "sublimate" their drive for pow er into some =
+harmless hobby. These engineer ed=20
+human beings=20
+may be happy in such a society, but they most certainly will not be free. =
+They will have been reduced to=20
+the status of domestic animals.=20
+
+175. But suppose now that the computer scientists do not succeed in =
+developing artificial intelligence, so=20
+that human work remains necessary. Even so, machines will take care of more =
+and more of the simpler=20
+tasks so that there will be an increasing surp lus of human workers at the =
+lower levels of ability. (We see=20
+this happening already. There are many people who find it difficult or =
+impossible to get work, because for=20
+intellectual or psychological reasons they cannot acquire the level of =
+training necessary to make themselves=20
+useful in the presen t system.) On those who are employed, ever- increasing =
+demands will be placed; They=20
+will need more and m ore training, more and more ability, and will have to =
+be ever more reliable,=20
+conforming and docile,=20
+because they will be more and more like cells of a giant organism. Their =
+tasks will be incre asingly=20
+specialized so that their work will be, in a sense, out of touch with the =
+real world, being concentrated on=20
+one tiny slice of reality. The system will have to use any means that I =
+can, whether psychological or=20
+biological, to engineer people to be docile, to have the abilities that the =
+syst em requires and to "sublimate"=20
+their drive f or power into some specialized task. But the statement that =
+the people of such a society will=20
+have to be docile may require qualification. The society may find =
+competitiveness useful, provided that=20
+ways are found of directing competitiveness into channe ls that serve that =
+needs of the system. We can=20
+imagine=20
+into channels that serve the needs of the system. We can imagine a future =
+society in which there is endless=20
+competition for positions of prestige an power. But no more than a very few =
+people will ever reach the top,=20
+where the only real power is (see end of paragraph 163). Very repell ent is =
+a society in which a person can=20
+satisfy his needs for power only by pushing large numbers of other people =
+out of the way and depriving=20
+them of THEIR opportunity for power.=20
+
+176. Once can envision scenarios that incorporate aspects of more than one =
+of the possibilities that we have=20
+just discussed. For instance, it may be that machines will take over most =
+of the work that is of real,=20
+practical importance, but that human bei ngs will be kept busy by being =
+given relativ ely unimportant=20
+work. It has been suggested, for example, that a great development of the =
+service of industries might=20
+provide work for human beings. Thus people will would spend their time =
+shinning each others shoes,=20
+driving each other around inn taxica b, making handicrafts for one another, =
+waiti ng on each other's tables,=20
+etc. This seems to us a thoroughly contemptible way for the human race to =
+end up, and we doubt that many=20
+people would find=20
+fulfilling lives in such pointless busy-work. They would seek other, =
+dangerous outlets (drugs, , crime,=20
+"cults," hate groups) unless they were biol ogical or psychologically =
+engineered to adapt them to such a=20
+way of life.=20
+
+177. Needless to day, the scenarios outlined above do not exhaust all the =
+possibilities. They only indicate=20
+the kinds of outcomes that seem to us mots likely. But wee can envision no =
+plausible scenarios that are any=20
+more palatable that the ones we've j ust described. It is overwhelmingly =
+probabl e that if the industrial-
+technological system survives the next 40 to 100 years, it will by that =
+time have developed certain general=20
+characteristics: Individuals (at least those of the "bourgeois" type, who =
+are integrated into the system and=20
+make it run, and who therefore have all the power) will b e more dependent =
+than ever on large=20
+organizations; they will be more "socialized" that ever and their physical =
+and mental qualities to a=20
+significant=20
+extent (possibly to a very great extent ) will be those that are engineered =
+into them rather than being th e=20
+results of chance (or of God's will, or wh atever); and whatever may be =
+left of wild nature will be reduced=20
+to remnants preserved for scientific study and kept under the supervision =
+and management of scientists=20
+(hence it will no longer be truly wild). In the long run (say a few =
+centuries from no w) it is it is likely that=20
+neither the human race nor any other important organisms will exist as we =
+know them today, because once=20
+you start modifying organisms through genetic engineering there is no =
+reason to stop at any particular=20
+point, so that the modifications will probably continue until man and other =
+organisms have been utterly=20
+trans formed.=20
+
+178. Whatever else may be the case, it is certain that technology is =
+creating for human begins a new=20
+physical and social environment radically different from the spectrum of =
+environments to which natural=20
+selection has adapted the human race physically an d psychological. If man =
+is not adjust to th is new=20
+environment by being artificially re-engineered, then he will be adapted to =
+it through a long an painful=20
+process of natural selection. The former is far more likely that the =
+latter.=20
+
+179. It would be better to dump the whole stinking system and take the =
+consequences.=20
+
+STRATEGY
+
+180. The technophiles are taking us all on an utterly reckless ride into =
+the unknown. Many people=20
+understand something of what technological progress is doing to us yet take =
+a passive attitude toward it=20
+because they think it is inevitable. But we (FC) don't think it is =
+inevitable. We think it c an be stopped, and=20
+we will give here some indications of how to go about stopping it.=20
+
+181. As we stated in paragraph 166, the two main tasks for the present are =
+to promote social stress and=20
+instability in industrial society and to develop and propagate an ideology =
+that opposes technology and the=20
+industrial system. When the system become s sufficiently stressed and =
+unstable, a revo lution against=20
+technology may be possible. The pattern would be similar to that of the =
+French and Russian Revolutions.=20
+French society and Russian society, for several decades prior to their =
+respective revolutions, showed=20
+increasing signs of stress and w eakness. Meanwhile, ideologies were being =
+d eveloped that offered a new=20
+world view that was quite different from the old one. In the Russian case, =
+revolutionaries were actively=20
+working to undermine=20
+the old order. Then, when the old system was put under sufficient =
+additional stress (by financial c risis in=20
+France, by military defeat in Russi a) it was swept away by revolution. =
+What we propose in something=20
+along the same lines.=20
+
+182. It will be objected that the French and Russian Revolutions were =
+failures. But most revolutions have=20
+two goals. One is to destroy an old form of society and the other is to set =
+up the new form of society=20
+envisioned by the revolutionaries. The Fre nch and Russian revolutionaries =
+failed (fort unately!) to create=20
+the new kind of society of which they dreamed, but they were quite =
+successful in destroying the existing=20
+form of society.=20
+
+183. But an ideology, in order to gain enthusiastic support, must have a =
+positive ideals well as a negative=20
+one; it must be FOR something as well as AGAINST something. The positive =
+ideal that we propose is=20
+Nature. That is , WILD nature; those aspects o f the functioning of the =
+Earth and its livin g things that are=20
+independent of human management and free of human interference and control. =
+And with wild nature we=20
+include human nature, by which we mean those aspects of the functioning of =
+the human individual that are=20
+not subject to regulation by o rganized society but are products of chance, =
+or free will, or God (depending=20
+on your religious or philosophical opinions).=20
+
+184. Nature makes a perfect counter-ideal to technology for several =
+reasons. Nature (that which is outside=20
+the power of the system) is the opposite of technology (which seeks to =
+expand indefinitely the power of the=20
+system). Most people will agree that nature is beautiful; certainly it has =
+treme ndous popular appeal. The=20
+radical environmentalists ALREADY hold an ideology that exalts nature and =
+opposes technology. [30] It is=20
+not necessary for the sake of nature to set up some chimerical utopia or =
+any new kind of social order.=20
+Nature takes care of itself: It was a spontaneous creation th at existed =
+long before any human society, and=20
+for countless centuries many different kinds of human societies coexisted =
+with nature without doing it an=20
+excessive amount of damage. Only with the Industrial Revolution did the =
+effect of human society on nat=20
+ure become really devastating. To relieve t he pressure on nature it is not =
+necessary to create a special kind=20
+of social system, it is only necessary to get rid of industrial society. =
+Granted, this will not solve all=20
+problems. Industrial society has already done tremendous damage to nature =
+and i t will take a very long=20
+time for the scars t o heal. Besides, even pre-industrial societies can do =
+significant damage to nature.=20
+Nevertheless, getting rid of industrial society will accomplish a great =
+deal. It will relieve the worst of the=20
+pressure on nature so that the scars can begin to heal. It will remove the =
+capacity of organized soc iety=20
+to keep increasing its control over nature (including human nature). =
+Whatever kind of society may exist=20
+after the demise of the industrial system, it is certain that most people =
+will live close to nature, because in=20
+the absence of advanced technolog y there is not other way that people CAN =
+liv e. To feed themselves they=20
+must be peasants or herdsmen or fishermen or hunter, etc., And, generally =
+speaking, local autonomy should=20
+tend to increase, because lack of advanced technology and rapid =
+communications will limit the capacity of=20
+governments o r other large organizations to control local communities. =
+
+
+185. As for the negative consequences of eliminating industrial society -- =
+well, you can't eat your cake and=20
+have it too. To gain one thing you have to sacrifice another.=20
+
+186. Most people hate psychological conflict. For this reason they avoid =
+doing any serious thinking about=20
+difficult social issues, and they like to have such issues presented to =
+them in simple, black-and-white terms:=20
+THIS is all good and THAT is all bad. The revolutionary ideology should =
+therefore be developed on two=20
+levels.=20
+
+187. On the more sophisticated level the ideology should address itself to =
+people who are intelligent,=20
+thoughtful and rational. The object should be to create a core of people =
+who will be opposed to the=20
+industrial system on a rational, thought-out basis, with full appreciation =
+of the problems and ambiguities=20
+involved, and of the price that has to be paid for getting rid of the =
+system. It is particularly important to=20
+attract people of this type, as they are capable people and will be =
+instrumental in influencing others. These=20
+people should be addres sed on as rational a level as possible. Fact s =
+should never intentionally be distorted=20
+and intemperate language should be avoided. This does not mean that no =
+appeal can be made to the=20
+emotions,=20
+but in making such appeal care should be taken to avoid misrepresenting the =
+truth or doing anything else t=20
+hat would destroy the intellectual respectab ility of the ideology. =
+
+
+188. On a second level, the ideology should be propagated in a simplified =
+form that will enable the=20
+unthinking majority to see the conflict of technology vs. nature in =
+unambiguous terms. But even on this=20
+second level the ideology should not be expressed in language that is so =
+cheap, intemperate or irrational=20
+that it alienates people of the thoughtful and rational type. Cheap, =
+intemperate propaganda sometimes=20
+achieves impressive short-term gains, but it will be more advantageous in =
+the long run to keep the loyalty=20
+of a small number of intelligently committed people than to arouse the =
+passion s of an unthinking, fickle=20
+mob who will change their attitude as soon as someone comes along with a =
+better propaganda gimmick.=20
+However, propaganda of the=20
+rabble-rousing type may be necessary when the system is nearing the point =
+of collapse and there is a final=20
+struggle between rival ideologies to d etermine which will become dominant =
+when the old world-view goes=20
+under.=20
+
+189. Prior to that final struggle, the revolutionaries should not expect to =
+have a majority of people on their=20
+side. History is made by active, determined minorities, not by the =
+majority, which seldom has a clear and=20
+consistent idea of what it really wan ts. Until the time comes for the =
+final push toward revolution [31], the=20
+task of revolutionaries will be less to win the shallow support of the =
+majority than to build a small core of=20
+deeply committed people. As for the majority, it will be enough to make =
+them aware of the existence of the=20
+new ideolo gy and remind them of it frequently; though of course it will be =
+desirable to get majority=20
+support to the extent that this can be done without weakening the core of =
+seriously committed people.=20
+
+190. Any kind of social conflict helps to destabilize the system, but one =
+should be careful about what kind=20
+of conflict one encourages. The line of conflict should be drawn between =
+the mass of the people and the=20
+power-holding elite of industrial society ( politicians, scientists, =
+upper-level busines s executives,=20
+government officials, etc..). It should NOT be drawn between the =
+revolutionaries and the mass of the=20
+people. For example, it would be bad strategy for the revolutionaries to =
+condemn Americans for their=20
+habits of consumption. Instead, the ave rage American should be portrayed =
+as a victi m of the advertising=20
+and marketing industry, which has suckered him into buying a lot of junk =
+that he doesn't need and that is=20
+very poor compensation
+for his lost freedom. Either approach is consistent with the facts. It is =
+merely a matter of attitude whether=20
+you blame the advertising industry for manipulating the public or blame the =
+public for allowing itself to be=20
+manipulated. As a matter of strategy one should generally avoid blaming the =
+public.=20
+
+191. One should think twice before encouraging any other social conflict =
+than that between the power-
+holding elite (which wields technology) and the general public (over which =
+technology exerts its power).=20
+For one thing, other conflicts tend to distract attention from the =
+important conflicts (betw een power-elite=20
+and ordinary people, between technology and nature); for another thing, =
+other conflicts may actually tend=20
+to encourage technologization, because each side in such a conflict wants =
+to use technological power to=20
+gain advantages over its adve rsary. This is clearly seen in rivalries bet =
+ween nations. It also appears in=20
+ethnic conflicts within nations. For example, in America many black leaders =
+are anxious to gain power for=20
+African=20
+Americans by placing back individuals in the technological power-elite. =
+They want there to be many black=20
+gov ernment officials, scientists, corporation e xecutives and so forth. In =
+this way they are helping to=20
+absorb the African American subculture into the technological system. =
+Generally speaking, one should=20
+encourage only those social conflicts that can be fitted into the framework =
+of the conflicts of po wer--elite=20
+vs. ordinary people, technology v s nature.=20
+
+192. But the way to discourage ethnic conflict is NOT through militant =
+advocacy of minority rights (see=20
+paragraphs 21, 29). Instead, the revolutionaries should emphasize that =
+although minorities do suffer more=20
+or less disadvantage, this disadvantage is o f peripheral significance. Our =
+real enemy is the industrial-
+technological system, and in the struggle against the system, ethnic =
+distinctions are of no importance.=20
+
+193. The kind of revolution we have in mind will not necessarily involve an =
+armed uprising against any=20
+government. It may or may not involve physical violence, but it will not be =
+a POLITICAL revolution. Its=20
+focus will be on technology and economics, not politics. [32]=20
+
+194. Probably the revolutionaries should even AVOID assuming political =
+power, whether by legal or=20
+illegal means, until the industrial system is stressed to the danger point =
+and has proved itself to be a failure=20
+in the eyes of most people. Suppose for exa mple that some "green" party =
+should win cont rol of the United=20
+States Congress in an election. In order to avoid betraying or watering =
+down their own ideology they would=20
+have to take vigorous measures to turn economic growth into economic =
+shrinkage. To the average man the=20
+results would appear disast rous: There would be massive unemployment, s =
+hortages of commodities, etc.=20
+Even if the grosser ill effects could be avoided through superhumanly =
+skillful management, still people=20
+would have=20
+to begin giving up the luxuries to which they have become addicted. =
+Dissatisfaction would grow, the=20
+"green" pa rty would be voted out of of fice and the re volutionaries would =
+have suffered a severe setback.=20
+For this reason the revolutionaries should not try to acquire political =
+power until the system has gotten=20
+itself into such a mess that any hardships will be seen as resulting from =
+the failures of the ind ustrial system=20
+itself and not from the polic ies of the revolutionaries. The revolution =
+against technology will probably=20
+have to be a revolution by outsiders, a revolution from below and not from =
+above.=20
+
+195. The revolution must be international and worldwide. It cannot be =
+carried out on a nation-by-nation=20
+basis. Whenever it is suggested that the United States, for example, should =
+cut back on technological=20
+progress or economic growth, people get hysteric al and start screaming =
+that if we fall behin d in=20
+technology the Japanese will get ahead of us. Holy robots The world will =
+fly off its orbit if the Japanese=20
+ever sell more cars than we do! (Nationalism is a great promoter of =
+technology.) More reasonably, it is=20
+argued that if the relatively democrati c nations of the world fall behind =
+in techno logy while nasty,=20
+dictatorial nations like China, Vietnam and North Korea continue to =
+progress, eventually the dictators may=20
+come to dominate the world.=20
+That is why the industrial system should be attacked in all nations =
+simultaneously, to the extent that this=20
+may be possible. True, there is no ass urance that the industrial system =
+can be destroyed at approximately=20
+the same time all over the world, and it is even conceivable that the =
+attempt to overthrow the system could=20
+lead instead to the domination of the system by dictators. That is a risk =
+that has to be taken. And it is worth=20
+taking, sin ce the difference between a "democratic" industrial system and =
+one controlled by dictators is=20
+small compared with the difference between an industrial system and a =
+non-industrial one. [33] It might=20
+even be argued that an industrial system controlled by di ctators would be =
+preferable, because dictato=20
+r-controlled systems usually have proved inefficient, hence they are =
+presumably more likely to break down.=20
+Look at Cuba.=20
+
+196. Revolutionaries might consider favoring measures that tend to bind the =
+world economy into a unified=20
+whole. Free trade agreements like NAFTA and GATT are probably harmful to =
+the environment in the short=20
+run, but in the long run they may perhaps be ad vantageous because they =
+foster economic inte rdependence=20
+between nations. I will be eaier to destroy the industrial system on a =
+worldwide basis if he world economy=20
+is so unified that its breakdown in any on major nation will lead to its =
+breakdwon in al industrialized=20
+nations.=20
+
+the long run they may perhaps be advantageous because they foster economic =
+interdependence between=20
+nations. It will be easier to destroy the industrial system on a worldwide =
+basis if the world economy is so=20
+unified that its breakdown in any one major nat ion will lead to its =
+breakdown in all indust rialized nations.
+
+197. Some people take the line that modern man has too much power, too much =
+control over nature; they=20
+argue for a more passive attitude on the part of the human race. At best =
+these people are expressing=20
+themselves unclearly, because they fail to distingu ish between power for =
+LARGE ORGANIZATIONS an=20
+d power for INDIVIDUALS and SMALL GROUPS. It is a mistake to argue for =
+powerlessness and=20
+passivity, because people NEED power. Modern man as a collective =
+entity--that is, the industrial system--
+has immense power over nature, and we (FC) regard this as e vil. But modern =
+INDIVIDUALS and=20
+SMALL GROUP S OF INDIVIDUALS have far less power than primitive man ever =
+did. Generally=20
+speaking, the vast power of "modern man" over nature is exercised not =
+
+by individuals or small groups but by large organizations. To the extent =
+that the average modern=20
+INDIVIDUAL can wield the power of technology, he is pe rmitted to do so =
+only within narrow limits and=20
+only under the supervision and control of the system. (You need a license =
+for everything and with the=20
+license come rules and regulations). The individual has only those =
+technological powers with which the s=20
+ystem chooses to provide him. His PERSONAL power over nature is =
+slight.
+
+198. Primitive INDIVIDUALS and SMALL GROUPS actually had considerable power =
+over nature; or=20
+maybe it would be better to say power WITHIN nature. When primitive man =
+needed food he knew how to=20
+find and prepare edible roots, how to track game and take it wi th homemade =
+weapons. He knew how to=20
+protect himself from heat, cold, rain, dangerous animals, etc. But =
+primitive man did relatively little damage=20
+to nature because the COLLECTIVE power of primitive society was negligible =
+compared to the=20
+COLLECTIVE power of industrial society.
+
+199. Instead of arguing for powerlessness and passivity, one should argue =
+that the power of the=20
+INDUSTRIAL SYSTEM should be broken, and that this will greatly INCREASE the =
+power and freedom=20
+of INDIVIDUALS and SMALL GROUPS.
+
+200. Until the industrial system has been thoroughly wrecked, the =
+destruction of that system must be the=20
+revolutionaries' ONLY goal. Other goals would distract attention and energy =
+from the main goal. More=20
+importantly, if the revolutionaries permit themse lves to have any other =
+goal than the destruc tion of=20
+technology, they will be tempted to use technology as a tool for reaching =
+that other goal. If they give in to=20
+that temptation, they will fall right back into the technological trap, =
+because modern technology is a=20
+unified, tightly organized system, so that, in order to retain SOME =
+technology , one finds oneself obliged=20
+to retain MOST technology, hence one ends up sacrificing only token amounts =
+of technology.
+
+201. Suppose for example that the revolutionaries took "social justice" as =
+a goal. Human nature being what=20
+it is, social justice would not come about spontaneously; it would have to =
+be enforced. In order to enforce it=20
+the revolutionaries would have to ret ain central organization and control. =
+For th at they would need rapid=20
+long-distance transportation and communication, and therefore all the =
+technology needed to support the=20
+transportation and communication systems. To feed and clothe poor people =
+they would have to use=20
+agricultural and manufacturing technology. And so forth. So that the attemp =
+t to insure social justice would=20
+force them to retain most parts of the technological system. Not that we =
+have anything against social=20
+justice,=20
+but it must not be allowed to interfere with the effort to get rid of the =
+technological system.
+
+202. It would be hopeless for revolutionaries to try to attack the system =
+without using SOME modern=20
+technology. If nothing else they must use the communications media to =
+spread their message. But they=20
+should use modern technology for only ONE purpose: to attack the =
+technological system.
+
+203. Imagine an alcoholic sitting with a barrel of wine in front of him. =
+Suppose he starts saying to himself,=20
+"Wine isn't bad for you if used in moderation. Why, they say small amounts =
+of wine are even good for you!=20
+It won't do me any harm if I take just one little drink..." Well you know =
+what is g oing to happen. Never=20
+forget that the human race with technology is just like an alcoholic with a =
+barrel of wine.
+
+204. Revolutionaries should have as many children as they can. There is =
+strong scientific evidence that=20
+social attitudes are to a significant extent inherited. No one suggests =
+that a social attitude is a direct=20
+outcome of a person's genetic constitution, but it appears that personality =
+traits tend , within the context of=20
+our society, to make a person more likely to hold this or that social =
+attitude. Objections to these findings=20
+have been raised, but objections are feeble and seem to be ideologically =
+motivated. In any event, no one=20
+denies that child ren tend on the average to hold social attit udes similar =
+to those of their parents. From our=20
+point of view it doesn't matter all that much whether the attitudes are =
+passed on genetically or through=20
+childhood training. In either case the ARE passed on.
+
+205. The trouble is that many of the people who are inclined to rebel =
+against the industrial system are also=20
+concerned about the population problems, hence they are apt to have few or =
+no children. In this way they=20
+may be handing the world over to the sort of people who support or at least =
+accept th e industrial system.=20
+To insure the strength of the next generation of revolutionaries the =
+present generation must reproduce itself=20
+abundantly. In doing so they will be worsening the population problem only =
+slightly. And the most=20
+important problem is to ge t rid of the industrial system, because once the =
+industrial system is gone the=20
+world's population necessarily will decrease (see paragraph 167); whereas, =
+if the industrial system survives,=20
+it will continue developing new techniques of food production that may =
+enable the world's population to=20
+keep i ncreasing almost indefinitely.
+
+206. With regard to revolutionary strategy, the only points on which we =
+absolutely insist are that the single=20
+overriding goal must be the elimination of modern technology, and that no =
+other goal can be allowed to=20
+compete with this one. For the rest, revol utionaries should take an =
+empirical approach . If experience=20
+indicates that some of the recommendations made in the foregoing paragraphs =
+are not going to give good=20
+results, then those recommendations should be discarded.
+
+
+
+TWO KINDS OF TECHNOLOGY
+
+207. An argument likely to be raised against our proposed revolution is =
+that it is bound to fail, because (it is=20
+claimed) throughout history technology has always progressed, never =
+regressed, hence technological=20
+regression is impossible. But this claim is false.
+
+208. We distinguish between two kinds of technology, which we will call =
+small-scale technology and=20
+organization-dependent technology. Small-scale technology is technology =
+that can be used by small-scale=20
+communities without outside assistance. Organization -dependent technology =
+is technology that de pends=20
+on large-scale social organization. We are aware of no significant cases of =
+regression in small-scale=20
+technology. But organization-dependent technology DOES regress when the =
+social organization on which=20
+it depends breaks down. Example: When the Roma n Empire fell apart the =
+Romans' small-scale technology=20
+survived because any clever village craftsman could build, for instance, a =
+water wheel, any skilled smith=20
+could make steel by Roman methods,=20
+and so forth. But the Romans' organization-dependent technology DID =
+regress. Their aqueducts fell into=20
+disrepair and were never rebuilt.=20
+Their tech niques of road construction were lost. The Roman system of urban =
+sanitation was forgotten, so=20
+that until rather recent times did the sanitation of European cities that =
+of Ancient Rome.
+
+209. The reason why technology has seemed always to progress is that, until =
+perhaps a century or two=20
+before the Industrial Revolution, most technology was small-scale =
+technology. But most of the technology=20
+developed since the Industrial Revolution is orga nization-dependent =
+technology. Take the refr igerator for=20
+example. Without factory-made parts or the facilities of a post-industrial =
+machine shop it would be=20
+virtually impossible for a handful of local craftsmen to build a =
+refrigerator. If by some miracle they did=20
+succeed in building one it would be useless to them without a reliable =
+source o f electric power. So they=20
+would have to dam a stream and build a generator. Generators require large =
+amounts of copper wire.=20
+Imagine trying to make that=20
+wire without modern machinery. And where would they get a gas suitable for =
+refrigeration? It would be=20
+much easier to build an icehouse or preserve food by drying or picking, as =
+was done before the invention=20
+of the refrigerator.
+
+210. So it is clear that if the industrial system were once thoroughly =
+broken down, refrigeration technology=20
+would quickly be lost. The same is true of other organization-dependent =
+technology. And once this=20
+technology had been lost for a generation or so it would take centuries to =
+rebuild it, just as it took centuries=20
+to build it the first time around. Surviving technical books would be few =
+and scattered. An industrial=20
+society, if built from scratch without outside help, can only be built in a =
+series of stages: You need tools to=20
+make tools to make tools to make tools ... . A long process of economic =
+development and progress in social=20
+organization is required. And, even in the absence of an ideology opposed =
+to technology, there is no reason=20
+to believe that anyone would be interested in rebuilding industrial =
+society. The enthusiasm for "progre ss"=20
+is a phenomenon particular to the modern form of society, and it seems not =
+to have existed prior to the 17th=20
+century or thereabouts.
+
+211. In the late Middle Ages there were four main civilizations that were =
+about equally "advanced":=20
+Europe, the Islamic world, India, and the Far East (China, Japan, Korea). =
+Three of those civilizations=20
+remained more or less stable, and only Europe became dynamic. No one knows =
+why Europe became dyn=20
+amic at that time; historians have their theories but these are only =
+speculation. At any rate, it is clear that=20
+rapid development toward a technological form of society occurs only under =
+special conditions. So there is=20
+no reason to assume that long-lastin g technological regression cannot be =
+brought about.
+
+212. Would society EVENTUALLY develop again toward an =
+industrial-technological form? Maybe, but=20
+there is no use in worrying about it, since we can't predict or control =
+events 500 or 1,000 years in the=20
+future. Those problems must be dealt with by the peopl e who will live at =
+that time.
+
+
+
+THE DANGER OF LEFTISM
+
+213. Because of their need for rebellion and for membership in a movement, =
+leftists or persons of similar=20
+psychological type are often unattracted to a rebellious or activist =
+movement whose goals and membership=20
+are not initially leftist. The resulting inf lux of leftish types can =
+easily turn a non-l eftist movement into a=20
+leftist one, so that leftist goals replace or distort the original goals of =
+the movement.
+
+214. To avoid this, a movement that exalts nature and opposes technology =
+must take a resolutely anti-leftist=20
+stance and must avoid all collaboration with leftists. Leftism is in the =
+long run inconsistent with wild=20
+nature, with human freedom and with the e limination of modern technology. =
+Leftism is collectivist; it=20
+seeks to bind together the entire world (both nature and the human race) =
+into a unified whole. But this=20
+implies management of nature and of human life by organized society, and it =
+requires advanced=20
+technology. You can't have a united worl d without rapid transportation and =
+communica tion, you can't=20
+make all people love one another without sophisticated psychological =
+techniques, you can't have a=20
+"planned society" without the necessary technological base.=20
+Above all, leftism is driven by the need for power, and the leftist seeks =
+power o n a collective basis,=20
+through identification with a mass movement or an organization. Leftism is =
+unlikely ever to give up=20
+technology, because technology is too valuable a source of collective =
+power.=20
+
+215. The anarchist [34] too seeks power, but he seeks it on an individual =
+or small-group basis; he wants=20
+individuals and small groups to be able to control the circumstances of =
+their own lives. He opposes=20
+technology because it makes small groups dependent on large =
+organizations.
+
+216. Some leftists may seem to oppose technology, but they will oppose it =
+only so long as they are=20
+outsiders and the technological system is controlled by non-leftists. If =
+leftism ever becomes dominant in=20
+society, so that the technological system becomes a tool in the hands of =
+leftists, they will e nthusiastically=20
+use it and promote its growth. In doing this they will be repeating a =
+pattern that leftism has shown again=20
+and again in the past. When the Bolsheviks in Russia were outsiders, they =
+vigorously opposed censorship=20
+and the secret police, they advocated self-determination for ethnic mino =
+rities, and so forth;=20
+but as soon as they came into power themselves, they imposed a tighter =
+censorship and created a more=20
+ruthless secret police than any that had existed under the tsars, and they =
+oppressed ethnic minorities at least=20
+as much as the tsars had done. In the United States, a couple of decades =
+ago when leftists were a minority=20
+in our universities, leftist professors were vigorous proponents of =
+academic freedom, but today, in those=20
+universities where leftists have become dominant, they have shown =
+themselves ready to take away from=20
+every one else's academic freedom. (This is "polit ical correctness.") The =
+same will happen with leftists and=20
+technology: They will use it to oppress everyone else if they ever get it =
+under their own control.
+
+217. In earlier revolutions, leftists of the most power-hungry type, =
+repeatedly, have first cooperated with=20
+non-leftist revolutionaries, as well as with leftists of a more libertarian =
+inclination, and later have double-
+crossed them to seize power for them selves. Robespierre did this in the =
+French R evolution, the Bolsheviks=20
+did it in the Russian Revolution, the communists did it in Spain in 1938 =
+and Castro and his followers did it=20
+in Cuba. Given the past history of leftism, it would be utterly foolish for =
+non-leftist revolutionaries today to=20
+collabo rate with leftists.
+
+218. Various thinkers have pointed out that leftism is a kind of religion. =
+Leftism is not a religion in the=20
+strict sense because leftist doctrine does not postulate the existence of =
+any supernatural being. But for the=20
+leftist, leftism plays a psychologica l role much like that which religion =
+plays f or some people. The leftist=20
+NEEDS to believe in leftism; it plays a vital role in his psychological =
+economy. His beliefs are not easily=20
+modified by logic or facts. He has a deep conviction that leftism is =
+morally Right with a capital R, and that=20
+he has no t only a right but a duty to impose leftist morality on everyone. =
+(However, many of the people we=20
+are referring to as "leftists" do not think of themselves as leftists and =
+would not describe=20
+their system of beliefs as leftism. We use the term "leftism" because we =
+don't know of any better words to=20
+d esignate the spectrum of related creeds that includes the feminist, gay =
+rights, political correctness, etc.,=20
+movements, and because these movements have a strong affinity with the old =
+left. See paragraphs 227-
+230.)
+
+219. Leftism is totalitarian force. Wherever leftism is in a position of =
+power it tends to invade every private=20
+corner and force every thought into a leftist mold. In part this is because =
+of the quasi-religious character of=20
+leftism; everything contrary to leftists beliefs represents Sin. More impor =
+tantly, leftism is a totalitarian=20
+force because of the leftists' drive for power. The leftist seeks to =
+satisfy his need for power through=20
+identification with a social movement and he tries to go through the power =
+process by helping to pursue=20
+and attain th e goals of the movement (see paragraph 83). But no matter how =
+far the movement has gone in=20
+attaining its goals the leftist is never satisfied, because his activism is =
+a surrogate activity (see paragraph=20
+41).=20
+That is, the leftist's real motive is not to attain the ostensible goals of =
+leftism; in rea lity he is motivated by=20
+the sense of power h e gets from struggling for and then reaching a social =
+goal.[35]
+
+Consequently the leftist is never satisfied with the goals he has already =
+attained; his need for the power=20
+process leads him always to pursue some new goal. The leftist wants equal =
+opportunities for minorities.=20
+When that is attained he insists on statisti cal equality of achievement by =
+minorities. A nd as long as=20
+anyone harbors in some corner of his mind a negative attitude toward some =
+minority, the leftist has to=20
+re-educated him. And ethnic minorities are not enough; no one can be =
+allowed to have a negative attitude=20
+toward homosexuals, disabled peop le, fat people, old people, ugly people, =
+and on and on and on. It's not=20
+enough that the public should be informed about the hazards of smoking; a =
+warning has to be stamped on=20
+every package of cigarettes.=20
+Then cigarette advertising has to be restricted if not banned. The =
+activists will never be sati sfied until=20
+tobacco is outlawed, and after t hat it will be alco hot then junk food, =
+etc. Activists have fought gross child=20
+abuse, which is reasonable. But now they want to stop all spanking. When =
+they have done that they will=20
+want to ban something else they consider unwholesome, then another thing =
+and then another. They will=20
+never be satisfi ed until they have complete control over all child rearing =
+practices. And then they will=20
+move on to another cause.=20
+
+220. Suppose you asked leftists to make a list of ALL the things that were =
+wrong with society, and then=20
+suppose you instituted EVERY social change that they demanded. It is safe =
+to say that within a couple of=20
+years the majority of leftists would find some thing new to complain about, =
+some new social "evil" to=20
+correct because, once again, the leftist is motivated less by distress at =
+society's ills than by the need to=20
+satisfy his drive for power by imposing his solutions on society.=20
+
+221. Because of the restrictions placed on their thoughts and behavior by =
+their high level of socialization,=20
+many leftists of the over-socialized type cannot pursue power in the ways =
+that other people do. For them=20
+the drive for power has only one morally acceptable outlet, and that is in =
+the strugg le to impose their=20
+morality on everyone.=20
+
+222. Leftists, especially those of the oversocialized type, are True =
+Believers in the sense of Eric Hoffer's=20
+book, "The True Believer." But not all True Believers are of the same =
+psychological type as leftists.=20
+Presumably a truebelieving nazi, for instanc e is very different =
+psychologically from a t ruebelieving leftist.=20
+Because of their capacity for single-minded devotion to a cause, True =
+Believers are a useful, perhaps a=20
+necessary, ingredient of any revolutionary movement. This presents a =
+problem with which we must admit=20
+we don't know how to deal. We aren't sure how to harness the energies o f =
+the True Believer to a revolution=20
+against technology. At present all we can say is that no True Believer will =
+make a safe recruit to the=20
+revolution=20
+unless his commitment is exclusively to the destruction of technology. If =
+he is committed also to another=20
+ideal, he may want to use technology as a t ool for pursuing that other =
+ideal (see paragraphs 220, 221).
+
+223. Some readers may say, "This stuff about leftism is a lot of crap. I =
+know John and Jane who are leftish=20
+types and they don't have all these totalitarian tendencies." It's quite =
+true that many leftists, possibly even a=20
+numerical majority, are decent pe ople who sincerely believe in tolerating =
+oth ers' values (up to a point) and=20
+wouldn't want to use high-handed methods to reach their social goals. Our =
+remarks about leftism are not=20
+meant to apply to every individual leftist but to describe the general =
+character of leftism as a movement.=20
+And the gene ral character of a movement is not necessari ly determined by =
+the numerical proportions of=20
+the various kinds of people involved in the movement.=20
+
+224. The people who rise to positions of power in leftist movements tend to =
+be leftists of the most power-
+hungry type because power-hungry people are those who strive hardest to get =
+into positions of power.=20
+Once the power-hungry types have captured contro l of the movement, there =
+are many leftists o f a gentler=20
+breed who inwardly disapprove of many of the actions of the leaders, but =
+cannot bring themselves to=20
+oppose them. They NEED their faith in the movement, and because they cannot =
+give up this faith they go=20
+along with the leaders. True, SOME lefti sts do have the guts to oppose the =
+totalitar ian tendencies that=20
+emerge, but they generally lose, because the power-hungry types are better =
+organized, are more ruthless=20
+and Machiavellian and have taken care to build themselves a strong power =
+base.=20
+
+225. These phenomena appeared clearly in Russia and other countries that =
+were taken over by leftists.=20
+Similarly, before the breakdown of communism in the USSR, leftish types in =
+the West would seldom=20
+criticize that country. If prodded they would admit that the USSR did many =
+wrong things, but then th ey=20
+would try to find excuses for the communists and begin talking about the =
+faults of the West. They always=20
+opposed Western military resistance to communist aggression. Leftish types =
+all over the world vigorously=20
+protested the U.S. military action in Viet nam, but when the USSR invaded =
+Afghanistan t hey did nothing.=20
+Not that they approved of the Soviet actions; but because of their leftist =
+faith, they just couldn't bear to put=20
+themselves in opposition to communism.=20
+Today, in those of our universities where "political correctness" has =
+become dominant, there are probably=20
+many leftish types who p rivately disapprove of the suppression of academic =
+freedom, but they go along=20
+with it anyway.=20
+
+226. Thus the fact that many individual leftists are personally mild and =
+fairly tolerant people by no means=20
+prevents leftism as a whole form having a totalitarian tendency.=20
+
+227. Our discussion of leftism has a serious weakness. It is still far from =
+clear what we mean by the word=20
+"leftist." There doesn't seem to be much we can do about this. Today =
+leftism is fragmented into a whole=20
+spectrum of activist movements. Yet not all activist movements are leftist, =
+and some act ivist movements=20
+(e.g.., radical environmentalism) seem to include both personalities of the =
+leftist type and personalities of=20
+thoroughly un-leftist types who ought to know better than to collaborate =
+with leftists. Varieties of leftists=20
+fade out gradually into varieties of non-leftists and we oursel ves would =
+often be hard-pressed to decide=20
+whether a given individual is or is not a leftist. To the extent that it is =
+defined at all, our conception of=20
+leftism=20
+is defined by the discussion of it that we have given in this article, and =
+we can only advise t he reader to=20
+use his own judgment in decidin g who is a leftist.=20
+
+228. But it will be helpful to list some criteria for diagnosing leftism. =
+These criteria cannot be applied in a=20
+cut and dried manner. Some individuals may meet some of the criteria =
+without being leftists, some leftists=20
+may not meet any of the criteria. Ag ain, you just have to use your =
+judgment.
+
+229. The leftist is oriented toward largescale collectivism. He emphasizes =
+the duty of the individual to=20
+serve society and the duty of society to take care of the individual. He =
+has a negative attitude toward=20
+individualism. He often takes a moralistic ton e. He tends to be for gun =
+control, for sex e ducation and=20
+other psychologically "enlightened" educational methods, for planning, for =
+affirmative action, for=20
+multiculturalism. He tends to identify with victims. He tends to be against =
+competition and against=20
+violence, but he often finds excuses for th ose leftists who do commit =
+violence. He is f ond of using the=20
+common catch-phrases of the left like "racism, " "sexism, " "homophobia, " =
+"capitalism," "imperialism,"=20
+"neocolonialism " "genocide,"=20
+"social change," "social justice," "social responsibility." Maybe the best =
+diagnostic trait of the leftist is his=20
+tendency to sympathize with the following movements: feminism, gay rights, =
+ethnic rights, disabi lity=20
+rights, animal rights political correct ness. Anyone who strongly =
+sympathizes with ALL of these=20
+movements is almost certainly a leftist. [36]=20
+
+230. The more dangerous leftists, that is, those who are most power-hungry, =
+are often characterized by=20
+arrogance or by a dogmatic approach to ideology. However, the most =
+dangerous leftists of all may be=20
+certain oversocialized types who avoid irritating di splays of =
+aggressiveness and refrain from ad vertising=20
+their leftism, but work quietly and unobtrusively to promote collectivist =
+values, "enlightened"=20
+psychological techniques for socializing children, dependence of the =
+individual on the system, and so forth.=20
+These crypto-leftists (as we may call th em) approximate certain bourgeois =
+types as f ar as practical action=20
+is concerned, but differ from them in psychology, ideology and motivation. =
+The ordinary bourgeois tries to=20
+bring people under control=20
+of the system in order to protect his way of life, or he does so simply =
+because his attitudes are=20
+conventional. The crypto-leftist tries to br ing people under control of =
+the system because he is a True=20
+Believer in a collectivistic ideology. The crypto-leftist is differentiated =
+from the average leftist of the=20
+oversocialized type by the fact that his rebellious impulse is weaker and =
+he is more se curely socialized. He=20
+is differentiated from the ordinary well-socialized bourgeois by the fact =
+that there is some deep lack within=20
+him that makes it necessary for him to devote himself to a cause and =
+immerse himself in a collectivity. And=20
+maybe his (well-sublimated) drive for power is stronger tha n that of the =
+average bourgeois.
+
+FINAL NOTE
+
+231. Throughout this article we've made imprecise statements and statements =
+that ought to have had all=20
+sorts of qualifications and reservations attached to them; and some of our =
+statements may be flatly false.=20
+Lack of sufficient information and the need f or brevity made it impossible =
+for us to fomu late our=20
+assertions more precisely or add all the necessary qualifications. And of =
+course in a discussion of this=20
+
+kind one must rely heavily on intuitive judgment, and that can sometimes be =
+wrong. So we don't claim that=20
+this article expresses more than a crude approximation to the truth. =
+
+
+232. All the same we are reasonably confident that the general outlines of =
+the picture we have painted here=20
+are roughly correct. We have portrayed leftism in its modern form as a =
+phenomenon peculiar to our time=20
+and as a symptom of the disruption of the power process. But we might =
+possibly be wrong about this.=20
+Oversocialized types who try to satisfy their drive for power by imposing =
+their morality on everyone have=20
+certainly been around for a long time. But we THINK that the decisive role =
+played by feelings of=20
+inferiority, low self-esteem, powerlessness, identification with victims by =
+people who are not themselves=20
+victims, is a peculiarity of modern leftism. Identification with victims by =
+people not themselves victims can=20
+be seen to some extent in=20
+19th century leftism and early Christianity but as far as we can make out, =
+symptoms of low self-esteem,=20
+etc., were not nearly so evident in these movements, or in any other =
+movements, as they are in modern=20
+leftism. But we are not in a position to assert confidently that no such =
+movements have existed prior to=20
+modern leftism. This is a significant question to which historians ought to =
+give their attention.=20
+
+NOTES=20
+
+1. (Paragraph 19) We are asserting that ALL, or even most, bullies and =
+ruthless competitors suffer from=20
+feelings of inferiority.=20
+
+2. (Paragraph 25) During the Victorian period many oversocialized people =
+suffered from serious=20
+psychological problems as a result of repressing or trying to repress their =
+sexual feelings. Freud apparently=20
+based his theories on people of this type. Today the focus of socialization =
+has shifted from sex to=20
+aggression.=20
+
+3. (Paragraph 27) Not necessarily including specialists in engineering =
+"hard" sciences.=20
+
+4. (Paragraph 28) There are many individuals of the middle and upper =
+classes who resist some of these=20
+values, but usually their resistance is more or less covert. Such =
+resistance appears in the mass media only to=20
+a very limited extent. The main thrust of propaganda in our society is in =
+favor of the stated values.=20
+
+The main reasons why these values have become, so to speak, the official =
+values of our society is that they=20
+are useful to the industrial system. Violence is discouraged because it =
+disrupts the functioning of the=20
+system. Racism is discouraged because ethnic conflicts also disrupt the =
+system, and discrimination wastes=20
+the talent of minority-group members who could be useful to the system. =
+Poverty must be "cured" because=20
+the underclass causes problems for the system and contact with the =
+underclass lowers the moral of the other=20
+classes. Women are encouraged to have careers because their talents are =
+useful to the system and, more=20
+importantly because by having regular jobs women become better integrated =
+into the system and tied=20
+directly to it rather than to their families.=20
+This helps to weaken family solidarity. (The leaders of the system say they =
+want to strengthen the family,=20
+but they really mean is that they want the family to serve as an effective =
+tool for socializing children in=20
+accord with the needs of the system. We argue in paragraphs 51,52 that the =
+system cannot afford to let the=20
+family or other small-scale social groups be strong or autonomous.) =
+
+
+5. (Paragraph 42) It may be argued that the majority of people don't want =
+to make their own decisions but=20
+want leaders to do their thinking for them. There is an element of truth in =
+this. People like to make their=20
+own decisions in small matters, but making decisions on difficult, =
+fundamental questions require facing up=20
+to psychological conflict, and most people hate psychological conflict. =
+Hence they tend to lean on others in=20
+making difficult decisions. The majority of people are natural followers, =
+not leaders, but they like to have=20
+direct personal access to their leaders and participate to some extent in =
+making difficult decisions. At least=20
+to that degree they need autonomy.=20
+
+6. (Paragraph 44) Some of the symptoms listed are similar to those shown by =
+caged animals.=20
+
+To explain how these symptoms arise from deprivation with respect to the =
+power process:=20
+
+Common-sense understanding of human nature tells one that lack of goals =
+whose attainment requires effort=20
+leads to boredom and that boredom, long continued, often leads eventually =
+to depression. Failure to obtain=20
+goals leads to frustration and lowering of self-esteem. Frustration leads =
+to anger, anger to aggression, often=20
+in the form of spouse or child abuse. It has been shown that long-continued =
+frustration commonly leads to=20
+depression and that depression tends to cause guilt, sleep disorders, =
+eating disorders and bad feelings about=20
+oneself. Those who are tending toward depression seek pleasure as an =
+antidote; hence insatiable hedonism=20
+and excessive sex, with perversions as a means of getting new kicks. =
+Boredom too tends to cause excessive=20
+pleasure-seeking since,=20
+lacking other goals, people often use pleasure as a goal. See accompanying =
+diagram. The foregoing is a=20
+simplification. Reality is more complex, and of course deprivation with =
+respect to the power process is not=20
+the ONLY cause of the symptoms described. By the way, when we mention =
+depression we do not=20
+necessarily mean depression that is severe enough to be treated by a =
+psychiatrist. Often only mild forms of=20
+depression are involved. And when we speak of goals we do not necessarily =
+mean long-term, thought out=20
+goals. For many or most people through much of human history, the goals of =
+a hand-to-mouth existence=20
+(merely providing oneself and one's family with food from day to day) have =
+been quite sufficient.=20
+
+7. (Paragraph 52) A partial exception may be made for a few passive, inward =
+looking groups, such as the=20
+Amish, which have little effect on the wider society. Apart from these, =
+some genuine small-scale=20
+communities do exist in America today. For instance, youth gangs and =
+"cults". Everyone regards them as=20
+dangerous, and so they are, because the members of these groups are loyal =
+primarily to one another rather=20
+than to the system, hence the system cannot control them. Or take the =
+gypsies. The gypsies commonly get=20
+away with theft and fraud because their loyalties are such that they can =
+always get other gypsies to give=20
+testimony that "proves" their innocence. Obviously the system would be in =
+serious trouble if too many=20
+people belonged to such groups. Some of the=20
+early-20th century Chinese thinkers who were concerned with modernizing =
+China recognized the necessity=20
+of breaking down small-scale social groups such as the family: "(According =
+to Sun Yat-sen) The Chinese=20
+people needed a new surge of patriotism, which would lead to a transfer of =
+loyalty from the family to the=20
+state. . .(According to Li Huang) traditional attachments, particularly to =
+the family had to be abandoned if=20
+nationalism were to develop to China." (Chester C. Tan, Chinese Political =
+Thought in the Twentieth=20
+Century," page 125, page 297.)=20
+
+8. (Paragraph 56) Yes, we know that 19th century America had its problems, =
+and serious ones, but for the=20
+sake of breviety we have to express ourselves in simplified terms.=20
+
+9. (Paragraph 61) We leave aside the underclass. We are speaking of the =
+mainstream.=20
+
+10. (Paragraph 62) Some social scientists, educators, "mental health" =
+professionals and the like are doing=20
+their best to push the social drives into group 1 by trying to see to it =
+that everyone has a satisfactory social=20
+life.=20
+
+11. (Paragraphs 63, 82) Is the drive for endless material acquisition =
+really an artificial creation of the=20
+advertising and marketing industry? Certainly there is no innate human =
+drive for material acquisition.=20
+There have been many cultures in which people have desired little material =
+wealth beyond what was=20
+necessary to satisfy their basic physical needs (Australian aborigines, =
+traditional Mexican peasant culture,=20
+some African cultures). On the other hand there have also been many =
+pre-industrial cultures in which=20
+material acquisition has played an important role. So we can't claim that =
+today's acquisition-oriented=20
+culture is exclusively a creation of the advertising and marketing =
+industry. But it is clear that the=20
+advertising and marketing industry has had an=20
+important part in creating that culture. The big corporations that spend =
+millions on advertising wouldn't be=20
+spending that kind of money without solid proof that they were getting it =
+back in increased sales. One=20
+member of FC met a sales manager a couple of years ago who was frank enough =
+to tell him, "Our job is to=20
+make people buy things they don't want and don't need." He then described =
+how an untrained novice could=20
+present people with the facts about a product, and make no sales at all, =
+while a trained and experienced=20
+professional salesman would make lots of sales to the same people. This =
+shows that people are manipulated=20
+into buying things they don't really want.=20
+
+12. (Paragraph 64) The problem of purposelessness seems to have become less =
+serious during the last 15=20
+years or so, because people now feel less secure physically and =
+economically than they did earlier, and the=20
+need for security provides them with a goal. But purposelessness has been =
+replaced by frustration over the=20
+difficulty of attaining security. We emphasize the problem of =
+purposelessness because the liberals and=20
+leftists would wish to solve our social problems by having society =
+guarantee everyone's security; but if that=20
+could be done it would only bring back the problem of purposelessness. The =
+real issue is not whether=20
+society provides well or poorly for people's security; the trouble is that =
+people are dependent on the system=20
+for=20
+their security rather than having it in their own hands. This, by the way, =
+is part of the reason why some=20
+people get worked up about the right to bear arms; possession of a gun puts =
+that aspect of their security in=20
+their own hands.=20
+
+13. (Paragraph 66) Conservatives' efforts to decrease the amount of =
+government regulation are of little=20
+benefit to the average man. For one thing, only a fraction of the =
+regulations can be eliminated because most=20
+regulations are necessary. For another thing, most of the deregulation =
+affects business rather than the=20
+average individual, so that its main effect is to take power from the =
+government and give it to private=20
+corporations. What this means for the average man is that government =
+interference in his life is replaced by=20
+interference from big corporations, which may be permitted, for e xample, =
+to dump more chemicals that=20
+get into his water supply and give him cancer. The conservatives are just =
+taking the average man for a=20
+sucker, exploiting his resentment of Big Government to promote the power of =
+Big Business.=20
+
+14. (Paragraph 73) When someone approves of the purpose for which =
+propaganda is being used in a given=20
+case, he generally calls it "education" or applies to it some similar =
+euphemism. But propaganda is=20
+propaganda regardless of the purpose for which it i s used.=20
+
+15. (Paragraph 83) We are not expressing approval or disapproval of the =
+Panama invasion. We only use it=20
+to illustrate a point.=20
+
+16. (Paragraph 95) When the American colonies were under British rule there =
+were fewer and less effective=20
+legal guarantees of freedom than there were after the American Constitution =
+went into effect, yet there was=20
+more personal freedom in pre-industria l America, both before and after the =
+War of Independence, than=20
+there was after the Industrial Revolution took hold in this country. We =
+quote from "Violence in America:=20
+Historical and Comparative perspectives," edited by Hugh Davis Graham and =
+Ted Robert Gurr, Chapter 12=20
+by Roger Lane, pages 476-478: "The progressive heightening of standards o f =
+property, and with it the=20
+increasing reliance on official law enforcement (in 19th century America). =
+.. .were common to the whole=20
+society. . .[T]he change in social behavior=20
+is so long term and so widespread as to suggest a connection with the most =
+funda mental of contemporary=20
+social processes; tha t of industrial urbanization itself. . =
+.."Massachusetts in 1835 had a population of some=20
+660,940, 81 percent rural, overwhelmingly preindustrial and native born. =
+It's citizens were used to=20
+considerable personal freedom. Whether teamsters, farmers or artisa ns, =
+they were all accustomed to setting=20
+thei r own schedules, and the nature of their work made them physically =
+dependent on each other. .=20
+..Individual problems, sins or even crimes, were not generally cause for =
+wider social concern. . ."But the=20
+impact of the twin movements to the city and to the fac tory, both just =
+gathering force in 1835, had a=20
+progressive effect on personal behavior=20
+throughout the 19th century and into the 20th. The factory demanded =
+regularity of behavior, a life=20
+governed by obedience to the rhythms of clock and calendar, the demands of =
+foreman and supervisor. In=20
+the city or town, the needs of living in closely packed neighborhoods =
+inhibited many actions previously=20
+unobjectionable.=20
+
+Both blue- and white-collar employees in larger establishments were =
+mutually dependent on their fellows.=20
+as one man's work fit into another's, so one man's business was no longer =
+his own. "The results of the new=20
+organization of life and work were appar ent by 1900, when some 76 percent =
+of the 2,8 05,346 inhabitants=20
+of Massachusetts were classified as urbanites. Much violent or irregular =
+behavior which had been tolerable=20
+in a casual, independent society was no longer acceptable in the more =
+formalized, cooperative atmosphere=20
+of the later period. . . The move to the cities had, in short, produc ed a =
+more tractable, more socialized,=20
+more 'civilized' generation than its predecessors."=20
+
+17. (Paragraph 117) Apologists for the system are fond of citing cases in =
+which elections have been=20
+decided by one or two votes, but such cases are rare.=20
+
+18. (Paragraph 119) "Today, in technologically advanced lands, men live =
+very similar lives in spite of=20
+geographical, religious and political differences. The daily lives of a =
+Christian bank clerk in Chicago, a=20
+Buddhist bank clerk in Tokyo, a Communist bank clerk in Moscow are far more =
+alike than the life any one=20
+of them is like that of any single man who lived a thousand years ago. =
+These similarities are the result of a=20
+common technology. . ." L. Sprague de Camp, "The Ancient Engineers," =
+Ballentine edition, page 17.=20
+
+The lives of the three bank clerks are not IDENTICAL. Ideology does have =
+SOME effect. But all=20
+technological societies, in order to survive, must evolve along =
+APPROXIMATELY the same trajectory.=20
+
+19. (Paragraph 123) Just think an irresponsible genetic engineer might =
+create a lot of terrorists.=20
+
+20. (Paragraph 124) For a further example of undesirable consequences of =
+medical progress, suppose a=20
+reliable cure for cancer is discovered. Even if the treatment is too =
+expensive to be available to any but the=20
+elite, it will greatly reduce their incen tive to stop the escape of =
+carcinogens into the environment.=20
+
+21. (Paragraph 128) Since many people may find paradoxical the notion that =
+a large number of good things=20
+can add up to a bad thing, we will illustrate with an analogy. Suppose Mr. =
+A is playing chess with Mr. B.=20
+Mr. C, a Grand Master, is looking over Mr . A's shoulder. Mr. A of course =
+wants to win his game, so if Mr.=20
+C points out a good move for him to make, he is doing Mr. A a favor. But =
+suppose now that Mr. C tells Mr.=20
+A how to make ALL of his moves. In each particular instance he does Mr. A a =
+favor by showing him his=20
+best move, but by making AL L of his moves for him he spoils the game, s =
+ince there is not point in Mr.=20
+A's playing the game at all if someone else makes all his moves.=20
+
+The situation of modern man is analogous to that of Mr. A. The system makes =
+an individual's life easier for=20
+him in innumerable ways, but in doing so it deprives him of control over =
+his own fate.=20
+
+22. (Paragraph 137) Here we are considering only the conflict of values =
+within the mainstream. For the=20
+sake of simplicity we leave out of the picture "outsider" values like the =
+idea that wild nature is more=20
+important than human economic welfare.=20
+
+23. (Paragraph 137) Self-interest is not necessarily MATERIAL =
+self-interest. It can consist in fulfillment of=20
+some psychological need, for example, by promoting one's own ideology or =
+religion.=20
+
+24. (Paragraph 139) A qualification: It is in the interest of the system to =
+permit a certain prescribed degree=20
+of freedom in some areas. For example, economic freedom (with suitable =
+limitations and restraints) has=20
+proved effective in promoting economic growth. But only planned, =
+circumscribed, li mited freedom is in=20
+the interest of the system. The individual must always be kept on a leash, =
+even if the leash is sometimes=20
+long( see paragraphs 94, 97).=20
+
+25. (Paragraph 143) We don't mean to suggest that the efficiency or the =
+potential for survival of a society=20
+has always been inversely proportional to the amount of pressure or =
+discomfort to which the society=20
+subjects people. That is certainly not the c ase. There is good reason to =
+believe that ma ny primitive=20
+societies subjected people to less pressure than the European society did, =
+but European society proved far=20
+more efficient than any primitive society and always won out in conflicts =
+with such societies because of the=20
+advantages conferred by te chnology.=20
+
+26. (Paragraph 147) If you think that more effective law enforcement is =
+unequivocally good because it=20
+suppresses crime, then remember that crime as defined by the system is not =
+necessarily what YOU would=20
+call crime. Today, smoking marijuana is a "crime ," and, in some places in =
+the U.S.., so is p ossession of=20
+ANY firearm, registered or not, may be made a crime, and the same thing may =
+happen with disapproved=20
+methods of child-rearing, such as spanking. In some countries, expression =
+of dissident political opinions is=20
+a crime, and there is no certaint y that this will never happen in the =
+U.S., s ince no constitution or political=20
+system lasts forever.=20
+
+If a society needs a large, powerful law enforcement establishment, then =
+there is something gravely wrong=20
+with that society; it must be subjecting people to severe pressures if so =
+many refuse to follow the rules, or=20
+follow them only because forced. Man y societies in the past have gotten by =
+with little or no formal law-
+enforcement.=20
+
+27. (Paragraph 151) To be sure, past societies have had means of =
+influencing behavior, but these have been=20
+primitive and of low effectiveness compared with the technological means =
+that are now being developed.=20
+
+28. (Paragraph 152) However, some psychologists have publicly expressed =
+opinions indicating their=20
+contempt for human freedom. And the mathematician Claude Shannon was quoted =
+in Omni (August 1987)=20
+as saying, "I visualize a time when we will be to robots what dogs are to =
+humans, and I'm rooting fo r the=20
+machines."=20
+
+29. (Paragraph 154) This is no science fiction! After writing paragraph 154 =
+we came across an article in=20
+Scientific American according to which scientists are actively developing =
+techniques for identifying=20
+possible future criminals and for treating the m by a combination of =
+biological and psychol ogical means.=20
+Some scientists advocate compulsory application of the treatment, which may =
+be available in the near=20
+future. (See "Seeking the Criminal Element", by W. Wayt Gibbs, Scientific =
+American, March 1995.)=20
+Maybe you think this is OK because the trea tment would be applied to those =
+who might be come drunk=20
+drivers (they endanger human life too), then perhaps to peel who spank =
+their children, then to=20
+environmentalists who sabotage logging equipment,=20
+eventually to anyone whose behavior is inconvenient for the system. =
+
+
+30. (Paragraph 184) A further advantage of nature as a counter-ideal to =
+technology is that, in many people,=20
+nature inspires the kind of reverence that is associated with religion, so =
+that nature could perhaps be=20
+idealized on a religious basis. It is tr ue that in many societies religion =
+has serve d as a support and=20
+justification for the established order, but it is also true that religion =
+has often provided a basis for=20
+rebellion. Thus it may be useful to introduce a religious element into the =
+rebellion against technology, the=20
+more so because Weste rn society today has no strong religious fou ndation. =
+
+
+Religion, nowadays either is used as cheap and transparent support for =
+narrow, short-sighted selfishness=20
+(some conservatives use it this way), or even is cynically exploited to =
+make easy money (by many=20
+evangelists), or has degenerated into crude irrati onalism (fundamentalist =
+Protestant sects, "c ults"), or is=20
+simply stagnant (Catholicism, main-line Protestantism). The nearest thing =
+to a strong, widespread, dynamic=20
+religion that the West has seen in recent times has been the quasi-religion =
+of leftism, but leftism today is=20
+fragmented and has no cle ar, unified inspiring goal.=20
+
+Thus there is a religious vaccuum in our society that could perhaps be =
+filled by a religion focused on nature=20
+in opposition to technology. But it would be a mistake to try to concoct =
+artificially a religion to fill this=20
+role. Such an invented religion would probably be a failure. Take the =
+"Gaia" religion for example. Do its=20
+adherents REALLY believe in it or are they just play-acting? If they are =
+just play-acting their religion will=20
+be a flop in the end.=20
+
+It is probably best not to try to introduce religion into the conflict of =
+nature vs. technology unless you=20
+REALLY believe in that religion yourself and find that it arouses a deep, =
+strong, genuine response in many=20
+other people.=20
+
+31. (Paragraph 189) Assuming that such a final push occurs. Conceivably the =
+industrial system might be=20
+eliminated in a somewhat gradual or piecemeal fashion. (see paragraphs 4, =
+167 and Note 4).=20
+
+32. (Paragraph 193) It is even conceivable (remotely) that the revolution =
+might consist only of a massive=20
+change of attitudes toward technology resulting in a relatively gradual and =
+painless disintegration of the=20
+industrial system. But if this happens we'll be very lucky. It's far more =
+probably that the transition to a=20
+nontechnological society will be very difficult and full of conflicts and =
+disasters.=20
+
+33. (Paragraph 195) The economic and technological structure of a society =
+are far more important than its=20
+political structure in determining the way the average man lives (see =
+paragraphs 95, 119 and Notes 16, 18).=20
+
+34. (Paragraph 215) This statement refers to our particular brand of =
+anarchism. A wide variety of social=20
+attitudes have been called "anarchist," and it may be that many who =
+consider themselves anarchists would=20
+not accept our statement of paragraph 215. It should be noted, by the way, =
+that there is a nonviolent=20
+anarchist movement whose members probably would not accept FC as anarchist =
+and certainly would not=20
+approve of FC's violent methods.=20
+
+35. (Paragraph 219) Many leftists are motivated also by hostility, but the =
+hostility probably results in part=20
+from a frustrated need for power.=20
+
+36. (Paragraph 229) It is important to understand that we mean someone who =
+sympathizes with these=20
+MOVEMENTS as they exist today in our society. One who believes that women, =
+homosexuals, etc., should=20
+have equal rights is not necessarily a leftist. The f eminist, gay rights, =
+etc., movements that ex ist in our=20
+society have the particular ideological tone that characterizes leftism, =
+and if one believes, for example, that=20
+women should have equal rights it does not necessarily follow that one must =
+sympathize with the feminist=20
+movement as it exists today .=20
+
+If copyright problems make it impossible for this long quotation to be =
+printed, then please change Note 16=20
+to read as follows:=20
+
+16. (Paragraph 95) When the American colonies were under British rule there =
+were fewer and less effective=20
+legal guarantees of freedom than there were after the American Constitution =
+went into effect, yet there was=20
+more personal freedom in pre-industria l America, both before and after the =
+War of Independence, than=20
+there was after the Industrial Revolution took hold in this country. In =
+"Violence in America: Historical and=20
+Comparative Perspectives," edited by Hugh Davis Graham and Ted Robert Gurr, =
+Chapter 12 by Roger=20
+Lane, it is explained how in pr e-industrial America the average person had =
+greater independence and=20
+autonomy than he does today, and how the process of industrialization =
+necessarily led to the restriction of=20
+personal freedom.
+
+
+End of message.
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No. 7 - MIME text and attachment
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-6>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: multipart/mixed;
+  boundary="boundary-replacement-string-1"
+
+This is a MIME Message
+
+--boundary-replacement-string-1
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+
+here is some text
+
+--boundary-replacement-string-1
+Content-Description: deisl1.isu
+Content-Type: application/octet-stream
+Content-Disposition: attachment;
+	filename="deisl1.isu"
+Content-Transfer-Encoding: base64
+
+cagAAAECqE4CACkAU3RpcmxpbmcgVGVjaG5vbG9naWVzLCBJbmMuIChjKSAx
+OTkwLTE5OTUeANzQzSjj0Mwm6tDMJvHQzib40Dsr/9AhJwbRzCafhygA3tDP
+JjAjGCjq0MyJ9dDMifzQzIv/08x7WBzOJg3RIysU0SMrG9EwJ4AAAAD/AAD/
+AAAA//8A/wAAAP8A/wD//wAA////AHd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3
+d3d3d3d3d3d3d3d3d3AAAAAAAAAAB3d3d3d3d3d4d3d3d3d3dwd3d3d3d3d3
+eP////////cHd3d3d3d3d3j////////3B3d3d3d3d3d4////////9wd3d3d3
+d3d3eP////////cHd3d3d3d3d3j4AAAAD//3B3d3d3d3d3d4+HgI9w//9wd3
+d3d3d3d3ePh4iIcP//cHd3d3d3d3d3j4d3d3ARERF3d3d3d3d3d4+H//9wzM
+zMd3d3d3d3d3ePh///cP//cHd3d3d3d3d3j4f//3D//3B3d3d3d3d3d494iI
+iP//9wd3d3d3d3d3eP////////cHd3d3d3d3d3j////////3B3d3d3d3d3d4
+//////+IiAd3d3d3d3d3eP//////j3h3d3d3d3d3d3j//////4eHd3d3d3d3
+d3d4//////+Id3d3d3d3d3d3eIiIiIiIh3d3d3d3d3d3d3d3d3d3d3d3d3d3
+d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3dwAAAAd3d3d3d3d3d3d3d3cIiIgHd3
+d3d3d3d3d3d3d3CIiIB3d3d3d3d3d3d3d3dwiIiAd3d3d3d3d3d3d3d3cIiI
+gHd3d3d3d3d3d3dwAACIiIAAAHd3d3d3d3d3cIiIiIiIiIB3d3d3d3d3d3cI
+iIiIiIgHd3d3d3d3d3d3cIiIiIiAd3d3d3d3d3d3d3cIiIiIB3d3d3d3d3d3
+d3d3cIiIgHd3d3d3d3d3d3d3d3cIiAd3d3d3d3d3d3d3d3d3cIB3d3d3d3d3
+d3d3d3d3d3cHd3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3
+d3d3d3d3AAAAAAAAAAAAAAAHd3d3eDMzMzMzMzMzMzMzMHd3d3i3t7e3t7e3
+t7e3tzAHd3eIe3t7e3t7e3t7e3swB3d3h7e3t7e3t7e3t7e3AAd3d4t7e3t7
+e3t7e3t7eAMHd3eHt7e3t7e3t7e3t7gDB3d4e3t7e3t7e3t7e3twgwd3eLe3
+t7e3t7e3t7e3sIMHd3h7e3t7e3t7e3t7e4CzB3d4t7e3t7e3t7e3t7eAcwd3
+eP//////////////CLMHd3eId3d3d3d3d3d3d3tzB3d3d4+3t7e3t7e3t7e3
+swd3d3ePe3t7e3t7e3t7e3MHd3d3j7e3t7e3t7e3t7ezB3d3d497e3t7e3t7
+////8Hd3d3ePt7e3t7e3uIiIiId3d3d3j/t7e3t7ewoA3NDMJkfRzSafhwoA
+3NDMJkjRzSafhz0A5NAgnFU/PZBVNs4mItHMJ/jS1CZTRj+Vdjo4jBnRQJyG
+Pz2Qhjb7i5o23iZ9Rj+VoDo4jHs2NpWxRRiMAA==
+
+--boundary-replacement-string-1
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Disposition: inline
+Content-Transfer-Encoding: quoted-printable
+
+Here is some more text. The attachment is above.
+--=20
+The curator
+
+--boundary-replacement-string-1--
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.6 - Encoded "=" characters
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-7>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The following line contains 5 "equals" characters. These should
+arrive MIME-encoded.
+
+=3D=3D=3D=3D=3D
+
+End of message.
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.5 - Empty message body
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-8>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.4 - Trailing spaces and tab characters
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-9>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This line has 1 trailing space character >=20
+This line has 2 trailing space characters> =20
+This line has 3 trailing space characters>  =20
+This line has 4 trailing space characters>   =20
+
+This line has 1 trailing TAB character >=09
+This line has 2 trailing TAB characters>	=09
+This line has 3 trailing TAB characters>		=09
+This line has 4 trailing TAB characters>			=09
+
+End of message.
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.3 - Wrapped lines
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-10>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This message contains a series of lines - which
+range between 90 and 70 characters in length.
+
+
+90CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+78901234567890
+
+89CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789
+
+88CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+789012345678
+
+87CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+78901234567
+
+86CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456
+
+85CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+789012345
+
+84CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+78901234
+
+83CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+7890123
+
+82CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+789012
+
+81CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+78901
+
+80CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+7890
+
+79CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+789
+
+78CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+78
+
+77CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+7
+
+76CHARS890123456789012345678901234567890123456789012345678901234567890123456=
+
+
+75CHARS89012345678901234567890123456789012345678901234567890123456789012345
+
+74CHARS8901234567890123456789012345678901234567890123456789012345678901234
+
+73CHARS890123456789012345678901234567890123456789012345678901234567890123
+
+72CHARS89012345678901234567890123456789012345678901234567890123456789012
+
+71CHARS8901234567890123456789012345678901234567890123456789012345678901
+
+70CHARS890123456789012345678901234567890123456789012345678901234567890
+
+End of message.
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.2 - Dot stuffing test
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-11>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+This message contains a block of dot characters,=20
+arranged into the shape of a triangle. There are=20
+four rows in the triangle; the first row contains
+4 dots, the last row contains 1 dot.
+
+.....
+....
+...
+..
+
+..This line should contain a "dot" as its first character.
+
+End of message.
+
+.
+RSET
+MAIL FROM:<test@psion9.demon.co.uk>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP Test1" <test@psion9.demon.co.uk>
+Reply-to: "SMTP Test1" <test@psion9.demon.co.uk>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-12>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_helo.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_helo.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,78 +1,78 @@
-EHLO []
-RSET
-HELO []
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+RSET
+HELO []
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_hostname.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_conitnue_with_hostname.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,82 +1,82 @@
-EHLO []
-RSET
-EHLO []
-RSET
-HELO []
-RSET
-HELO []
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+RSET
+EHLO []
+RSET
+HELO []
+RSET
+HELO []
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_quit_if_tls_on.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_ehlo_fail_quit_if_tls_on.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
-EHLO []
-QUIT
+EHLO []
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_cram_md5.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_cram_md5.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,78 +1,78 @@
-EHLO []
-AUTH CRAM-MD5
-c210cC1iYWQgYWM0ODIyZWIyYTkyZjRiOGFhMWE0YmE3ZGU1ZTRkNWY=
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+AUTH CRAM-MD5
+c210cC1iYWQgYWM0ODIyZWIyYTkyZjRiOGFhMWE0YmE3ZGU1ZTRkNWY=
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_login.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_login.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,79 +1,79 @@
-EHLO []
-AUTH LOGIN
-c210cC1iYWQ=
-cGFzc3dvcmQtYmFk
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+AUTH LOGIN
+c210cC1iYWQ=
+cGFzc3dvcmQtYmFk
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_no_smtp_auth_on_server.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_no_smtp_auth_on_server.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,76 +1,76 @@
-EHLO []
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_plain.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_plain.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,77 +1,77 @@
-EHLO []
-AUTH PLAIN AHNtdHAtYmFkAHBhc3N3b3JkLWJhZA==
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+AUTH PLAIN AHNtdHAtYmFkAHBhc3N3b3JkLWJhZA==
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_password.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_password.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,78 +1,78 @@
-EHLO []
-AUTH CRAM-MD5
-c210cC1iYWQgMmMyZjZmOGQ4YTJhZWI3ZjBkMjgxNzI4NTVmNzVkMDM=
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+AUTH CRAM-MD5
+c210cC1iYWQgMmMyZjZmOGQ4YTJhZWI3ZjBkMjgxNzI4NTVmNzVkMDM=
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_username.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_no_tls_wrong_username.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,78 +1,78 @@
-EHLO []
-AUTH CRAM-MD5
-c210cC1iYWQgMGRhOTgzZjQxYzgzMmMzZGJjMTVlOTVmZmExNTUwOTI=
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+AUTH CRAM-MD5
+c210cC1iYWQgMGRhOTgzZjQxYzgzMmMzZGJjMTVlOTVmZmExNTUwOTI=
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_cram.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_cram.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,79 +1,79 @@
-EHLO []
-STARTTLS
-EHLO []
-AUTH CRAM-MD5
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+STARTTLS
+EHLO []
+AUTH CRAM-MD5
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_login.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_login.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,81 +1,81 @@
-EHLO []
-STARTTLS
-EHLO []
-AUTH LOGIN
-c210cC1iYWQ=
-cGFzc3dvcmQtYmFk
-RSET
-MAIL FROM:<smtp@lon-msgtest06.intra>
-RCPT TO:<recyclebin@lon-msgtest06.intra>
-DATA
-From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
-To: recyclebin@lon-msgtest06.intra
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
+EHLO []
+STARTTLS
+EHLO []
+AUTH LOGIN
+c210cC1iYWQ=
+cGFzc3dvcmQtYmFk
+RSET
+MAIL FROM:<smtp@lon-msgtest06.intra>
+RCPT TO:<recyclebin@lon-msgtest06.intra>
+DATA
+From: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+Reply-to: "SMTP AUTH" <smtp@lon-msgtest06.intra>
+To: recyclebin@lon-msgtest06.intra
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,79 +1,79 @@
-EHLO []
-STARTTLS
-EHLO []
-RSET
-MAIL FROM:<test@dummy.test.com>
-RCPT TO:<testrcpt@dummy.rcpt.test.com>
-DATA
-From: SMTP AUTH <test@dummy.test.com>
-Reply-to: SMTP AUTH <test@dummy.test.com>
-To: <testrcpt@dummy.rcpt.test.com>
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
-
+EHLO []
+STARTTLS
+EHLO []
+RSET
+MAIL FROM:<test@dummy.test.com>
+RCPT TO:<testrcpt@dummy.rcpt.test.com>
+DATA
+From: SMTP AUTH <test@dummy.test.com>
+Reply-to: SMTP AUTH <test@dummy.test.com>
+To: <testrcpt@dummy.rcpt.test.com>
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
+
--- a/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth_on_server.out	Mon May 03 12:29:07 2010 +0300
+++ b/email/pop3andsmtpmtm/smtpservermtm/test/data/imsk25_tls_no_smtp_auth_on_server.out	Fri Jun 25 15:47:40 2010 +0530
@@ -1,79 +1,79 @@
-EHLO []
-STARTTLS
-EHLO []
-RSET
-MAIL FROM:<test@dummy.test.com>
-RCPT TO:<testrcpt@dummy.test.rcpt.com>
-DATA
-From: SMTP AUTH <test@dummy.test.com>
-Reply-to: SMTP AUTH <test@dummy.test.com>
-To: <testrcpt@dummy.test.rcpt.com>
-Subject: Test message No.1 - 1000 character line in message
-Date: date-replacement-string-
-Message-ID: <message-id-replacement-string-1>
-X-Mailer: EPOC Email Version 2.10
-MIME-Version: 1.0
-Content-Language: i-default
-Content-Type: text/plain; charset=ISO-8859-1
-Content-Transfer-Encoding: quoted-printable
-
-The line in the following 3 paragraphs each contain 1000 characters: =
-
-the maximum limit of linelength for SMTP mail. Each should arrive as
-one wrapped paragraph in the received message. The dot-stuffed
-paragraph is the absolute maximum line length permissable in SMTP
-protocol - although in practice IMCV wraps the data into shorter
-lines before it is actually sent.
-
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567890
-
-The following paragraph will be dot stuffed into 1001 characters:
-
-..123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-8901234567890123456789012345678901234567890123456789012345678901234567890123=
-4567890123456789012345678901234567890123456789012345678901234567890123456789=
-0123456789012345678901234567890123456789012345678901234567890123456789012345=
-6789012345678901234567890123456789012345678901234567890123456789012345678901=
-2345678901234567890123456789012345678901234567890123456789012345678901234567=
-890123456789
-
-Start67890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-9012345678901234567890123456789012345678901234567890123456789012345678901234=
-5678901234567890123456789012345678901234567890123456789012345678901234567890=
-1234567890123456789012345678901234567890123456789012345678901234567890123456=
-7890123456789012345678901234567890123456789012345678901234567890123456789012=
-3456789012345678901234567890123456789012345678901234567890123456789012345678=
-901234567End
-
-End of message.
-
-.
-QUIT
-
+EHLO []
+STARTTLS
+EHLO []
+RSET
+MAIL FROM:<test@dummy.test.com>
+RCPT TO:<testrcpt@dummy.test.rcpt.com>
+DATA
+From: SMTP AUTH <test@dummy.test.com>
+Reply-to: SMTP AUTH <test@dummy.test.com>
+To: <testrcpt@dummy.test.rcpt.com>
+Subject: Test message No.1 - 1000 character line in message
+Date: date-replacement-string-
+Message-ID: <message-id-replacement-string-1>
+X-Mailer: EPOC Email Version 2.10
+MIME-Version: 1.0
+Content-Language: i-default
+Content-Type: text/plain; charset=ISO-8859-1
+Content-Transfer-Encoding: quoted-printable
+
+The line in the following 3 paragraphs each contain 1000 characters: =
+
+the maximum limit of linelength for SMTP mail. Each should arrive as
+one wrapped paragraph in the received message. The dot-stuffed
+paragraph is the absolute maximum line length permissable in SMTP
+protocol - although in practice IMCV wraps the data into shorter
+lines before it is actually sent.
+
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567890
+
+The following paragraph will be dot stuffed into 1001 characters:
+
+..123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+8901234567890123456789012345678901234567890123456789012345678901234567890123=
+4567890123456789012345678901234567890123456789012345678901234567890123456789=
+0123456789012345678901234567890123456789012345678901234567890123456789012345=
+6789012345678901234567890123456789012345678901234567890123456789012345678901=
+2345678901234567890123456789012345678901234567890123456789012345678901234567=
+890123456789
+
+Start67890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+9012345678901234567890123456789012345678901234567890123456789012345678901234=
+5678901234567890123456789012345678901234567890123456789012345678901234567890=
+1234567890123456789012345678901234567890123456789012345678901234567890123456=
+7890123456789012345678901234567890123456789012345678901234567890123456789012=
+3456789012345678901234567890123456789012345678901234567890123456789012345678=
+901234567End
+
+End of message.
+
+.
+QUIT
+
--- a/inc/convergedmessage.h	Mon May 03 12:29:07 2010 +0300
+++ b/inc/convergedmessage.h	Fri Jun 25 15:47:40 2010 +0530
@@ -64,7 +64,8 @@
         Provisioning = 0x01,
         VCard = 0x02,
         VCal = 0x03,
-        Audio = 0x04
+        Audio = 0x04,
+        NokiaService = 0x08        
     };
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/conversationidpsconsts.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,28 @@
+/*
+ * 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: Publish and subscribe constants used to publish 
+ *              conversation id for hiding notification.
+ *
+ */
+
+#ifndef CONVERSATIONID_PS_CONSTS_H
+#define CONVERSATIONID_PS_CONSTS_H
+
+const qint32 KMsgCVIdProperty = {0x2002E678}; // same as msgnotifier's UID
+const quint32 KMsgCVIdKey = 0x00000001;
+
+// msgapp UId
+const TUid KMsgAppUid ={0x2001FE79};
+
+#endif // CONVERSATIONID_PS_CONSTS_H
--- a/inc/msgbiouids.h	Mon May 03 12:29:07 2010 +0300
+++ b/inc/msgbiouids.h	Fri Jun 25 15:47:40 2010 +0530
@@ -63,6 +63,10 @@
 /// UID for the Provisioning Message type for BIO database
 const TUid KMsgBioProvisioningMessage = {0x101F84D1};
 
+const TUid KMsgBioNokiaServiceMessage = {0x102832EA};
+
+const TUid KMsgBioNokiaServiceSentMessage = {0x20022FE6};
+
 //// PoC
 const TUid KMsgBioUidPoC			= {0x101FD869};
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/msgcontacthandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,207 @@
+/*
+ * 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: This header handles the phonebook manager resolve number static
+ *              functions.
+ *
+ */
+
+#ifndef MSGCONTACTHANDLER_H_
+#define MSGCONTACTHANDLER_H_
+
+#include <qmobilityglobal.h>
+
+#include <qtcontacts.h>
+#include <qcontactfilter.h>
+#include <qcontactdetailfilter.h>
+#include <QFile>
+#include <qversitcontactimporter.h>
+#include <qversitdocument.h>
+#include <qversitreader.h>
+
+QTM_BEGIN_NAMESPACE
+class QContactManager;
+QTM_END_NAMESPACE
+
+QTM_USE_NAMESPACE
+
+class MsgContactHandler
+{
+    
+public:
+
+    /**
+     * This shall resolve contact number with display name
+     * @param contactNumber number to resolve
+     * @param displayName resolved name
+     * @param countPhoneNumber specifies number of contacts inside 
+     * the resolved contact ex mobile, home, office etc
+     * @return contacts unique localId
+     */
+    static int resolveContactDisplayName(const QString& contactNumber,
+                                         QString& displayName,
+                                         int& countPhoneNumber)
+    {
+        QContactManager phonebookManager;
+        QVariant address(contactNumber);
+
+        // apply filter on phone number field
+        QContactDetailFilter phoneFilter;
+        phoneFilter.setDetailDefinitionName(
+                QContactPhoneNumber::DefinitionName,
+                QContactPhoneNumber::FieldNumber);
+
+        phoneFilter.setValue(address);
+        phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+        QList<QContact> matchingContacts =
+                phonebookManager.contacts(phoneFilter);
+        if (matchingContacts.count() > 0)
+        {
+            // Fill the contact details
+            QContact match = matchingContacts.at(0);
+
+            displayName = match.displayLabel();
+            QList<QContactPhoneNumber> numbers =
+                    match.details<QContactPhoneNumber> ();
+            countPhoneNumber = numbers.count();
+            return match.localId();
+        }
+
+        // apply filter on email address field
+        QContactDetailFilter emailFilter;
+        emailFilter.setDetailDefinitionName(
+                QContactEmailAddress::DefinitionName,
+                QContactEmailAddress::FieldEmailAddress);
+
+        emailFilter.setValue(address);
+        emailFilter.setMatchFlags(QContactFilter::MatchExactly);
+        matchingContacts = phonebookManager.contacts(emailFilter);
+        if ( matchingContacts.count() > 0 )
+        {
+            // Fill the contact details
+            QContact match = matchingContacts.at(0);
+
+            displayName = match.displayLabel();
+            QList<QContactEmailAddress> numbers =
+                    match.details<QContactEmailAddress> ();
+            countPhoneNumber = numbers.count();
+            return match.localId();
+        }
+
+        // no matching contact
+        displayName = contactNumber;
+        return -1;
+    }
+
+    /**
+     * This shall resolve contact number with display name
+     * @param contactNumber number to resolve
+     * @param fieldName specifies filter name
+     * @param fieldType specifies filter type
+     * @return contact unique local id
+     */
+    static int resolveContactDisplayName(const QString& contactNumber,
+                                         const QString& fieldName,
+                                         const QString& fieldType)
+    {
+        int contactId = -1;
+
+        QContactManager phonebookManager("symbian");
+
+        QContactDetailFilter phoneFilter;
+        phoneFilter.setDetailDefinitionName(fieldName, fieldType);
+        phoneFilter.setValue(contactNumber);
+        phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+
+        QList<QContact>
+                matchingContacts = phonebookManager.contacts(phoneFilter);
+
+        if (matchingContacts.count() > 0)
+        {
+            contactId = matchingContacts.at(0).localId();
+        }
+        return contactId;
+    }
+
+    //---------------------------------------------------------------
+    // findContactList
+    // Finds the contact matching the phone number.
+    // @param phoneNumber Phone number to be matchned.
+    // @return List of matching contacts.
+    //---------------------------------------------------------------
+    static QList<QContact> findContactList(const QString &phoneNumber)
+    {
+        QContactManager phonebookManager("symbian");
+
+        QContactDetailFilter phoneFilter;
+        phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName,
+            QContactPhoneNumber::FieldNumber);
+        phoneFilter.setValue(phoneNumber);
+        phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+        
+        QList<QContact> matchingContacts = phonebookManager.contacts(phoneFilter);
+
+        return matchingContacts;
+    }
+    
+    /**
+     * Get display-name of a contact from VCard.
+     * @param filePath, VCard file-path
+     * @return display-name
+     */
+
+    static QString getVCardDisplayName(QString& filePath)
+    {
+        QString displayName = QString("");
+        //open file for parsing
+        QFile file(filePath);
+        if (!file.open(QIODevice::ReadOnly))
+        {
+            return displayName;
+        }
+        // parse contents
+        QVersitReader reader;
+        reader.setDevice(&file);
+        if (reader.startReading())
+        {
+            if (reader.waitForFinished())
+            {
+                QList<QVersitDocument> versitDocuments = reader.results();
+                // Use the resulting document
+                if (versitDocuments.count() > 0)
+                {
+                    QVersitContactImporter importer;
+                    bool import_docs = importer.importDocuments(versitDocuments);
+                    if(import_docs)
+                    {
+                       QList<QContact> contacts = importer.contacts();
+                       // get display-name
+                       if (contacts.count() > 0)
+                       {
+                          //resolveSynthesizedDisplayLabel
+                          QContactManager* contactManager =
+                                new QContactManager("symbian");
+                          displayName
+                                = contactManager->synthesizedDisplayLabel(contacts[0]);
+                          delete contactManager;
+                       }
+                    }
+                }
+            }
+        }
+        file.close();
+        return displayName;
+    }
+};
+
+#endif /* MSGCONTACTHANDLER_H_ */
--- a/inc/unidatamodelplugininterface.h	Mon May 03 12:29:07 2010 +0300
+++ b/inc/unidatamodelplugininterface.h	Fri Jun 25 15:47:40 2010 +0530
@@ -84,6 +84,30 @@
     inline const QString& mimetype();
 
     /**
+     * isProtected
+     * @return true if DRM protected object else false.
+     */
+    inline bool isProtected() const;
+
+    /**
+     * setProtected
+     * @param isProtected true if DRM protected object else false.
+     */
+    inline void setProtected(bool isProtected);
+
+    /**
+     * isCorrupted
+     * @return true if object is corrupted else false.
+     */
+    inline bool isCorrupted() const;
+
+    /**
+     * setCorrupted
+     * @param corrupted true if object is corrupted else false.
+     */
+    inline void setCorrupted(bool corrupted);
+
+    /**
      * Serialize the data memebers into the stream.
      * @param stream data stream to which data is serialized.
      */
@@ -97,8 +121,10 @@
 
 private:
     QString mPath;
+    QString mMimeType;
     int mSize;
-    QString mMimeType;
+    bool mProtected;
+    bool mCorrupt;
 
 };
 
--- a/inc/unidatamodelplugininterface.inl	Mon May 03 12:29:07 2010 +0300
+++ b/inc/unidatamodelplugininterface.inl	Fri Jun 25 15:47:40 2010 +0530
@@ -18,9 +18,8 @@
 // UniMessageInfo::UniMessageInfo
 // @see header
 //----------------------------------------------------------------
- UniMessageInfo::UniMessageInfo( const QString& filepath,
-                                const int size,
-                                const QString& mimetype ) : mPath (filepath), mSize(size), mMimeType(mimetype)
+UniMessageInfo::UniMessageInfo(const QString& filepath, const int size, const QString& mimetype) :
+    mPath(filepath), mMimeType(mimetype), mSize(size), mProtected(false), mCorrupt(false)
     {
     
     
@@ -89,6 +88,42 @@
     }
 
 //----------------------------------------------------------------
+// UniMessageInfo::isProtected
+// @see header
+//----------------------------------------------------------------
+inline bool UniMessageInfo::isProtected() const
+    {
+    return mProtected;
+    }
+
+//----------------------------------------------------------------
+// UniMessageInfo::setProtected
+// @see header
+//----------------------------------------------------------------
+inline void UniMessageInfo::setProtected(bool isProtected)
+   {
+   mProtected = isProtected;
+   }
+
+//----------------------------------------------------------------
+// UniMessageInfo::isCorrupted
+// @see header
+//----------------------------------------------------------------
+inline bool UniMessageInfo::isCorrupted() const
+    {
+    return mCorrupt;
+    }
+
+//----------------------------------------------------------------
+// UniMessageInfo::setCorrupted
+// @see header
+//----------------------------------------------------------------
+inline void UniMessageInfo::setCorrupted(bool corrupted)
+    {
+    mCorrupt = corrupted;
+    }
+
+//----------------------------------------------------------------
 // UniMessageInfo::serialize
 // @see header
 //----------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/conf/backup_registration.xml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "no"/>
+</backup_registration>
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_101F87EF.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_102071F2.crml has changed
Binary file messagingapp/conf/messaging_102072E2.crml has changed
Binary file messagingapp/conf/messaging_102072E5.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	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/conf/messaging_conf.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -35,6 +35,7 @@
 		"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)"
+		"messaging_101F8F28.crml APP_LAYER_CRML(messaging_101F8F28.crml)" \
+		"backup_registration.xml z:/private/2001FE79/backup_registration.xml"
 		}
 
--- a/messagingapp/messagingapp.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/messagingapp.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -29,3 +29,4 @@
 SUBDIRS += smartmessaging/smartmessaging.pro
 SUBDIRS += shareui/shareui.pro
 SUBDIRS += msgui/msgui.pro
+SUBDIRS += msgservices/msgservices.pro
--- a/messagingapp/msgappfw/client/bwins/csserverclientapiu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/client/bwins/csserverclientapiu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -24,4 +24,5 @@
 	?GetConversationIdL@CCSRequestHandler@@QAEHH@Z @ 23 NONAME ; int CCSRequestHandler::GetConversationIdL(int)
 	?NewL@CCSRequestHandler@@SAPAV1@XZ @ 24 NONAME ; class CCSRequestHandler * CCSRequestHandler::NewL(void)
 	?GetConversationFromMessageIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 25 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromMessageIdL(int)
+	?GetConversationFromConversationIdL@CCSRequestHandler@@QAEPAVCCsClientConversation@@H@Z @ 26 NONAME ; class CCsClientConversation * CCSRequestHandler::GetConversationFromConversationIdL(int)
 
--- a/messagingapp/msgappfw/client/eabi/csserverclientapiu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/client/eabi/csserverclientapiu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -30,4 +30,5 @@
 	_ZTV17CCSRequestHandler @ 29 NONAME
 	_ZTV22CCsNotificationHandler @ 30 NONAME
 	_ZTV29CCsConversationChangeObserver @ 31 NONAME
+	_ZN17CCSRequestHandler34GetConversationFromConversationIdLEi @ 32 NONAME
 
--- a/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/client/src/ccsnotificationhandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -126,7 +126,11 @@
         case EModifyConversationListEvent:
             iRequestHandler->HandleModifyConversationList(iNotificationBuffer);
             break;
-
+            
+        case EPartialDeleteConversationListEvent:
+            iRequestHandler->HandlePartialDeleteConversationList(iNotificationBuffer);
+            break;
+            
         case EAddConversationEvent:
             iRequestHandler->HandleAddConversation(iNotificationBuffer);
             break;
--- a/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/client/src/ccsrequesthandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -59,13 +59,13 @@
 // CCSRequestHandler::NewLC()
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
-EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC(/*CVPbkContactManager* aVPbkContactManager*/)
+EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC()
     {
     PRINT ( _L("Enter CCSRequestHandler::NewLC") );
 
     CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler();
     CleanupStack::PushL( self );
-    self->ConstructL(/*aVPbkContactManager*/);
+    self->ConstructL();
 
     PRINT ( _L("End CCSRequestHandler::NewLC") );
 
@@ -178,6 +178,12 @@
         //call panic
         }
     
+    // Speed up the allocation
+    if( listCount > 0 )
+        {
+        clientConversationList.Reserve(listCount);
+        }
+
     for (TInt iloop = 0 ; iloop < listCount; iloop++)
         {
         TRAP(error,
@@ -240,7 +246,12 @@
         {
         //call panic
         }
-
+    // Speed up the allocation
+    if( conversationEntryCount > 0 )
+        {
+        ConversationEntryList.Reserve(conversationEntryCount);
+        }
+    
     PRINT1 ( _L("Number of conversation entries = %d"), conversationEntryCount );
 
     // conversation entries
@@ -319,8 +330,11 @@
     stream.Close();
 
     // Delete and recreate the results buffer
-    delete iListResultsBuffer;
-    iListResultsBuffer = NULL;
+    if ( iListResultsBuffer)
+        {
+        delete iListResultsBuffer;
+        iListResultsBuffer = NULL;
+        }
 
     // Buffer created for the new size
     TRAP(error, 
@@ -370,8 +384,11 @@
     stream.Close();
 
     // Delete and recreate the results buffer
-    delete iConvResultsBuffer;
-    iConvResultsBuffer = NULL;
+    if ( iConvResultsBuffer )
+        {
+        delete iConvResultsBuffer;
+        iConvResultsBuffer = NULL;
+        }
 
     // Buffer created for the new size
     TRAP(error, 
@@ -429,10 +446,14 @@
 EXPORT_C void CCSRequestHandler::RemoveConversationListChangeEventL(
         MCsConversationListChangeObserver* /*aObserver*/)
     {
-    iConversationListChangeObserver = NULL;
-
-    // De-register from the server           
-    iNotificationHandler->RemoveConversationListChangeEventL();   
+    // Before removing observer, make sure it was added earlier.
+    if( iConversationListChangeObserver )
+        {
+        iConversationListChangeObserver = NULL;
+    
+        // De-register from the server           
+        iNotificationHandler->RemoveConversationListChangeEventL();  
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -466,11 +487,12 @@
         {
         delete iConversationChangeObserver;
         iConversationChangeObserver = NULL;
-        }
-
-    iNotificationHandler->RemoveConversationChangeEventL(aClientConversation);
+        if(aClientConversation)
+            {
+            iNotificationHandler->RemoveConversationChangeEventL(aClientConversation);
+            }
+         }
     }
-
 // -----------------------------------------------------------------------------
 // CCSRequestHandler::RequestCachingStatusEventL()
 // Add caching status Observer
@@ -895,6 +917,50 @@
     }
 
 // -----------------------------------------------------------------------------
+// CCSRequestHandler::HandlePartialDeleteConversationList()
+// Process partial delete conversation lsit event received from server
+// -----------------------------------------------------------------------------
+
+void CCSRequestHandler::HandlePartialDeleteConversationList(HBufC8* aResultsBuffer)
+{
+    PRINT( _L("Enter CCSRequestHandler::HandlePartialDeleteConversationList") );
+
+    TInt error = KErrNone;
+
+    // perpare client conversation
+    CCsClientConversation* clientConversation = NULL;
+    RDesReadStream resultStream(aResultsBuffer->Des());
+
+    TRAP(error,
+        resultStream.PushL();
+        clientConversation = CCsClientConversation::NewL();
+        CleanupStack::PushL(clientConversation);
+        clientConversation->InternalizeL(resultStream);
+        CleanupStack::Pop(clientConversation);
+        resultStream.Pop());
+
+    if ( error != KErrNone )
+        {
+        // Ignore this conversation
+        }
+
+    // Cleanup
+    resultStream.Close();
+    
+    // Pass the results to the observer
+    if ( iConversationListChangeObserver )
+        {
+        CleanupStack::PushL( clientConversation );
+        iConversationListChangeObserver->
+        PartialDeleteConversationList(*clientConversation);
+        }
+    
+    CleanupStack::PopAndDestroy();// clientConversation*/
+
+    PRINT( _L("End CCSRequestHandler::HandlePartialDeleteConversationList") );
+}
+
+// -----------------------------------------------------------------------------
 // CCSRequestHandler::HandleModifyConversationList
 // Process modify conversation lsit event received from server
 // -----------------------------------------------------------------------------
@@ -1198,6 +1264,39 @@
     }
 	
 // -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationFromConversationIdL()
+// -----------------------------------------------------------------------------
+EXPORT_C CCsClientConversation* CCSRequestHandler::GetConversationFromConversationIdL(TInt aConversationId)
+{
+    // Create a buffer to store the results.
+    if(iResultsBuffer)
+    {
+        delete iResultsBuffer;
+        iResultsBuffer = NULL;
+    }
+    iResultsBuffer = HBufC8::NewL(KBigIpcBuffer);
+
+    // Send the request
+    iSession.GetConversationFromConversationIdL(aConversationId, iResultsBuffer->Des());
+
+    // Parse the results
+    RDesReadStream resultStream(iResultsBuffer->Des());
+    resultStream.PushL();
+    CCsClientConversation* clientConversation = CCsClientConversation::NewL();
+    CleanupStack::PushL(clientConversation);
+    clientConversation->InternalizeL(resultStream);
+    CleanupStack::Pop(clientConversation);
+
+    // Cleanup
+    delete iResultsBuffer;
+    iResultsBuffer = NULL;
+    resultStream.Pop();
+    resultStream.Close();
+
+    return clientConversation;
+}
+
+// -----------------------------------------------------------------------------
 // CCSRequestHandler::GetConversationFromMessageIdL()
 // -----------------------------------------------------------------------------
 EXPORT_C CCsClientConversation* CCSRequestHandler::GetConversationFromMessageIdL(TInt aMessageId)        
--- a/messagingapp/msgappfw/client/src/rcssession.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/client/src/rcssession.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -397,6 +397,20 @@
     }
 	
 // ----------------------------------------------------------------------------
+// RCsSession::GetConversationFromConversationIdL
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationFromConversationIdL(TInt aConversationId, TPtr8 aResultsBuffer)
+    {
+    PRINT( _L("Enter RCsSession::GetConversationFromConversationIdL") );
+
+    TIpcArgs args(aConversationId, &aResultsBuffer);
+
+    // Initiate the request
+    User::LeaveIfError (SendReceive(EGetConversationFromConversationId, args ) );
+    PRINT( _L("End RCsSession::GetConversationFromConversationIdL") );
+    }
+
+// ----------------------------------------------------------------------------
 // RCsSession::GetConversationFromMessageIdL
 // ----------------------------------------------------------------------------
 void RCsSession::GetConversationFromMessageIdL(TInt aMessageId, TPtr8 aResultsBuffer)
--- a/messagingapp/msgappfw/msgappfw.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msgappfw.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -22,4 +22,4 @@
 # Platforms
 SYMBIAN_PLATFORMS = WINSCW ARMV5
 
-SUBDIRS += utils server client plugin msghistory
+SUBDIRS += utils server client plugins msghistory
--- a/messagingapp/msgappfw/msghistory/msghistory.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/msghistory.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,6 @@
 TARGET = msghistory
 DEPENDPATH += . inc src
 INCLUDEPATH += .
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += MSGHISTORY_DLL
@@ -51,8 +50,15 @@
 				 src/msghistoryprivate.cpp \
 				 src/msgitem.cpp
 
-
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/msghistory.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/msghistory.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
 
 LIBS += -lcsserverclientapi \
         -lcsutils \
-        -ls60qconversions 
\ No newline at end of file
+        -lxqutils
--- a/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/src/msghistoryprivate.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,7 @@
 #include <ccsrequesthandler.h>
 #include <ccsconversationentry.h>
 #include <ccsclientconversation.h>
-#include <s60qconversions.h>
+#include <xqconversions.h>
 
 //USER INCLUDES
 #include "msghistoryprivate.h"
@@ -101,6 +101,9 @@
             conversationId = handler->GetConversationIdL(aContactId));
     CCsClientConversation* clientConversation = CCsClientConversation::NewL();
     clientConversation->SetConversationEntryId(conversationId);
+    // set the contact id, which will be used in case when the 
+    // conversation entry id is -1.
+    clientConversation->SetContactId(aContactId);
     //set dummy entry
     CCsConversationEntry *entry = CCsConversationEntry::NewL();
     clientConversation->SetConversationEntryL(entry);
@@ -125,6 +128,9 @@
             conversationId = handler->GetConversationIdL(aContactId));
     CCsClientConversation* clientConversation = CCsClientConversation::NewL();
     clientConversation->SetConversationEntryId(conversationId);
+    // set the contact id, which will be used in case when the 
+    // conversation entry id is -1.
+    clientConversation->SetContactId(aContactId);
     //set dummy entry
     CCsConversationEntry *entry = CCsConversationEntry::NewL();
     clientConversation->SetConversationEntryL(entry);
@@ -230,7 +236,7 @@
     HBufC* description = entry.Description();    
     if( description && description->Length())
         {
-        item.setBody(S60QConversions::s60DescToQString(*description)); 
+        item.setBody(XQConversions::s60DescToQString(*description)); 
         }
 
     // time stamp 
@@ -244,7 +250,7 @@
     HBufC* contact = entry.Contact();
     if( contact && contact->Length())
         {
-        item.setPhoneNumber(S60QConversions::s60DescToQString(*contact));      
+        item.setPhoneNumber(XQConversions::s60DescToQString(*contact));      
         }
 
     //sending state
--- a/messagingapp/msgappfw/msghistory/src/msgitem.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/src/msgitem.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,6 +22,7 @@
 // ---------------------------------------------------------------------------
 MsgItem::MsgItem()
     {
+    mAttributes = MsgAttributeNone;
     }
 
 // ---------------------------------------------------------------------------
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengine.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,7 @@
 #include "debugtraces.h"
 #include <msghistory.h>
 #include <msgitem.h>
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 const int ViewableLimit = 160;
 //---------------------------------------------------------------
@@ -137,7 +137,7 @@
 
     // description
     QString descr = item.body();
-    HBufC* description = S60QConversions::qStringToS60Desc(descr);
+    HBufC* description = XQConversions::qStringToS60Desc(descr);
     entry->SetDescriptionL(description->Des());
     delete description;
 
@@ -147,7 +147,7 @@
 
     //contact details
     QString details = item.phoneNumber();
-    HBufC* d_details = S60QConversions::qStringToS60Desc(details);
+    HBufC* d_details = XQConversions::qStringToS60Desc(details);
     entry->SetContactL(d_details->Des());
     delete d_details;
 
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsengineutility.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -32,7 +32,7 @@
 #include "smilxmlreader.h"
 #include "smilliterals.h"
 #include "msgmimetypes.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 // CONSTANTS
 #define KForwardSlash '/'
@@ -78,7 +78,7 @@
     {
         //get smilfile's handle to parse
         RFile smilfile;
-        HBufC* path = S60QConversions::qStringToS60Desc(ismilfilepath);
+        HBufC* path = XQConversions::qStringToS60Desc(ismilfilepath);
 
         RFs fsSession;
         User::LeaveIfError(fsSession.Connect());
@@ -241,7 +241,7 @@
             qDebug() << " Exit CNativeMmsUtility::getSmilFileL";
 #endif
 
-            return S60QConversions::s60DescToQString(attachment->FilePath());
+            return XQConversions::s60DescToQString(attachment->FilePath());
         }
     }
 
@@ -285,7 +285,7 @@
                     //because media source is relative to it.
                     QString smildirpath = fileDir(ismilfilepath);
                     QString mfilename =
-                            S60QConversions::s60DescToQString(attrvalptr);
+                            XQConversions::s60DescToQString(attrvalptr);
                     filepath = smildirpath.append(mfilename);
                 }
                 readFileIntoBuffer(filepath, returnbuf);
@@ -321,7 +321,7 @@
                 == 0)
         {
             QString filepath =
-                    S60QConversions::s60DescToQString(attachment->FilePath());
+                    XQConversions::s60DescToQString(attachment->FilePath());
             readFileIntoBuffer(filepath, returnbuf);
             break;
         }
@@ -371,7 +371,7 @@
                     //because media source is relative to it.
                     QString smildirpath = fileDir(ismilfilepath);
                     QString mfilename =
-                            S60QConversions::s60DescToQString(attrvalptr);
+                            XQConversions::s60DescToQString(attrvalptr);
                     filepath = smildirpath.append(mfilename);
                 }
                 // converting directory separators from native to
@@ -409,7 +409,7 @@
         CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i);
         TPtrC8 mimetype = attachment->MimeType();
         QString filepath =
-                S60QConversions::s60DescToQString(attachment->FilePath());
+                XQConversions::s60DescToQString(attachment->FilePath());
         // converting directory separators from native to
         // universal (QT) format
         filepath.replace(KBackwardSlash, KForwardSlash);
@@ -476,7 +476,7 @@
         CMsvAttachment *attachment = iattachmanager->GetAttachmentInfoL(i);
         TPtrC8 mimetype = attachment->MimeType();
         QString filepath =
-                S60QConversions::s60DescToQString(attachment->FilePath());
+                XQConversions::s60DescToQString(attachment->FilePath());
         // converting directory separators from native to
         // universal (QT) format
         filepath.replace(KBackwardSlash, KForwardSlash);
@@ -577,7 +577,7 @@
         qDebug() << " Exit CNativeMmsUtility::getByUrlL";
 #endif
 
-        return S60QConversions::s60DescToQString(targetattachment->FilePath());
+        return XQConversions::s60DescToQString(targetattachment->FilePath());
     }
     else
     {
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationsmodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,7 @@
 #include "conversationsenginedefines.h"
 #include "conversationmsgstorehandler.h"
 #include "convergedmessage.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "conversationsengineutility.h"
 #include <ccsconversationentry.h>
 
@@ -251,7 +251,7 @@
     QString subject("");
     if( description && description->Length())
         {
-        subject = (S60QConversions::s60DescToQString(*description));
+        subject = (XQConversions::s60DescToQString(*description));
         item.setData(subject, Subject); 
         }
     
@@ -266,7 +266,7 @@
     HBufC* contact = entry.Contact();
     if( contact && contact->Length())
         {
-        item.setData(S60QConversions::s60DescToQString(*contact), ConversationAddress);      
+        item.setData(XQConversions::s60DescToQString(*contact), ConversationAddress);      
         }
 
     // message type.        
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/src/conversationssummarymodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,7 @@
 #include "conversationssummarymodel.h"
 #include "conversationsenginedefines.h"
 #include "conversationsengineutility.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "convergedmessage.h"
 
 #include <ccsclientconversation.h>
@@ -214,7 +214,7 @@
     HBufC* body = conEntry->Description();
     if( body && body->Length())
         {     
-        QString bodytext(S60QConversions::s60DescToQString(*body));
+        QString bodytext(XQConversions::s60DescToQString(*body));
         item.setData(bodytext, BodyText); 
         item.setData(bodytext, Subject );
         }
@@ -235,20 +235,20 @@
     //first name
     if(firstname && firstname->Length())
         {
-    displayName = S60QConversions::s60DescToQString(*firstname);
+    displayName = XQConversions::s60DescToQString(*firstname);
     item.setData(displayName,FirstName); 
         }
     //last name
     HBufC* lastname = conversation.GetLastName();
     if( lastname &&  lastname->Length())
         {          
-    item.setData(S60QConversions::s60DescToQString(*lastname),LastName);
+    item.setData(XQConversions::s60DescToQString(*lastname),LastName);
         }
     //nick name
     HBufC* nickname = conversation.GetNickName();
     if (nickname && nickname->Length())
     {
-        item.setData(S60QConversions::s60DescToQString(*nickname), NickName);
+        item.setData(XQConversions::s60DescToQString(*nickname), NickName);
     }
 
     //item.setData(displayName, NickName);
@@ -258,7 +258,7 @@
     QString contactNumber("");
     if ( contactno && contactno->Length() )
         {
-        contactNumber = S60QConversions::s60DescToQString(*contactno);                  
+        contactNumber = XQConversions::s60DescToQString(*contactno);                  
         }        
     item.setData(contactNumber, ConversationAddress);
 
--- a/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/msghistory/tsrc/test_appengine/test_appengine.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -20,7 +20,6 @@
 DEPENDPATH += . src
 
 INCLUDEPATH += ../../../inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_DLL
@@ -64,7 +63,7 @@
 
 LIBS += -lcsserverclientapi \
         -lcsutils \
-        -ls60qconversions \
+        -lxqutils \
         -lconvergedmessageutils \
         -lmsgs \
   	    -lInetProtUtil \
--- a/messagingapp/msgappfw/plugin/group/csmsg.mmp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
-* Copyright (c) 2006-2007 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:  CS Msg Plugin
-*
-*/
-#include <data_caging_paths.hrh>
-#include <platform_paths.hrh>
-
-CAPABILITY      CAP_ECOM_PLUGIN 
-VENDORID        VID_DEFAULT
-TARGET          csmsg.dll
-TARGETTYPE      PLUGIN
-UID             0x10009D8D 0x2002A546
-
-VERSION 	1.0
-
-PAGED
-
-// RESOURCE
-START RESOURCE ../rss/csmsg.rss
-TARGET csmsg.rsc
-END
-
-SOURCEPATH      ../src
-
-SOURCE          proxy.cpp
-SOURCE 		ccsmsg.cpp
-SOURCE 		ccsmsgpluginutility.cpp
-SOURCE 		ccsmsghandler.cpp
-
-USERINCLUDE     ../inc
-USERINCLUDE     ../../server/inc
-USERINCLUDE     ../../utils/inc
-USERINCLUDE     ../../../../inc
-APP_LAYER_SYSTEMINCLUDE
-
-LIBRARY         euser.lib
-LIBRARY         eCom.lib
-LIBRARY         csutils.lib
-DEBUGLIBRARY    flogger.lib
-
-// Msg Server
-LIBRARY         Smcm.lib
-LIBRARY         gsmu.lib
-LIBRARY         etext.lib
-LIBRARY         msgs.lib
--- a/messagingapp/msgappfw/plugin/inc/ccsmsg.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,136 +0,0 @@
-/*
-* Copyright (c) 2007 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:  Message Plugin main class
- *
-*/
-
-
-#ifndef _C_CS_MSG_H_
-#define _C_CS_MSG_H_
-
-// INCLUDE FILES
-
-// SYSTEM INCLUDES
-
-// USER INCLUDES
-#include "ccsplugin.h"
-#include "mcsmsgobserver.h"
-#include "ccsdebug.h"
-#include "ccsdefs.h"
-
-// FORWARD DECLARATION
-class MCsPluginEventObserver;
-class MCsMsgObserver;
-class CCsConversationEntry;
-class CCsMsgHandler;
-
-/**
- *  Message plugin class
- *  This class interacts with MsvServer to fetch the message data.
- */
-class CCsMsg : public CCsPlugin, public MCsMsgObserver
-    {
-public: 
-
-    /**
-     * Two phase construction
-     */
-    static CCsMsg* NewL( MCsPluginEventObserver* aMCsPluginEventObserver);
-
-    /**
-     * Destructor
-     */
-    virtual ~CCsMsg();
-
-
-public: // From base class CCsPlugin
-    /**
-     *  GetConversationsL
-     *  This function starts the state machine to fetch msg data from msvserver
-     */        
-    void GetConversationsL();
-
-public: //MCsMsgObserver
-    /**
-     *  HandleReadCompleteL
-     *  Sends the CCsConversationEntry array to Conversation Server
-     *  @param aConversationEntryLists The object to be used to handle updates 
-     *  from the plugin
-     */
-    void HandleReadCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
-
-    /**
-     *  HandleUpdateCompleteL
-     *  Sends the CCsConversationEntry array to Conversation Server
-     *  @param aConversationEntryLists The object to be used to handle updates 
-     *  from the plugin
-     */
-    void HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
-
-    /**
-     *  HandleDeleteCompleteL
-     *  Sends the CCsConversationEntry array to Conversation Server
-     *  @param aConversationEntryLists The object to be used to handle updates 
-     *  from the plugin
-     */
-    void HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
-
-    /**
-     * HandleRefreshCompleteL
-     * Notify conversation server to refresh the conversations from this plugin.
-     */
-    void HandleRefreshCompleteL();
-    
-    /**
-     *  HandleCachingCompleted
-     *  Sends the cache completed status to server
-     */
-    void HandleCachingCompleted();
-
-    /**
-     *  HandleCachingError
-     *  Sends the error occured during the caching to server
-     */
-    void HandleCachingError(const TInt aError);
-    
-private:
-
-    /**
-     * Constructor
-     */
-    CCsMsg(MCsPluginEventObserver* aObserver);
-
-    /**
-     * 2nd phase construtor
-     */
-    void ConstructL();
-
-private: //Data
-
-    /**
-     * The msg plugin class which sends the initial set of conversation 
-     * entries upon bootup to conversations server.
-     * and notifies the conversations server about the new MsvServer events
-     */
-    CCsMsgHandler* iMsgHandler;  
-
-    /**
-     * iPluginEventObserver
-     * Plugin event observer
-     * Not Own.
-     */
-    MCsPluginEventObserver* iPluginEventObserver;
-    };
-
-#endif // _C_CS_MSG_H_
--- a/messagingapp/msgappfw/plugin/inc/ccsmsghandler.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,266 +0,0 @@
-/*
-* Copyright (c) 2007 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:  Request Handler plugin
- *
-*/
-
-
-#ifndef _C_CS_MSG_REQUEST_HANDLER_H_
-#define _C_CS_MSG_REQUEST_HANDLER_H_
-
-//SYSTEM INCLUDES
-#include <msvapi.h>
-
-//USER INCLUDES
-#include "ccsmsg.h"
-#include "ccsmsgpluginutility.h"
-
-
-// FORWARD DECLARATION
-class CCsPlugin;
-class CMsvSession;
-class MCsPluginEventObserver;
-class MMsvSessionObserver;
-class CCsConversationEntry;
-class CCsMsg;
-class CCsMsgPluginUtility;
-class CClientMtmRegistry;
-class CSmsClientMtm;
-class CMmsClientMtm;
-
-/**
- * Operation Type
- */  
-enum TEventType
-    {
-    ERead,
-    EUpdate,
-    EDelete
-    };
-
-/**
- * States
- */
-enum TMsgHandlerState
-    {
-    EReadInbox,
-    EReadSent,
-    EProcessDraft,
-    EReadOutbox,
-    ESortEntries,
-    EProcessEntries,
-    EComplete
-    };
-
-/**
- *  Message plugin Request Handler Class
- *  This class interacts with MsvServer to fetch message data
- */
-class CCsMsgHandler : public CBase, public MMsvSessionObserver
-    {
-
-public: 
-
-    /**
-     * Two phase construction
-     * @param aMsgObserver MCsMsgObserver interface
-     */
-    static CCsMsgHandler* NewL(MCsMsgObserver *aMsgObserver);
-
-    /**
-     * Destructor
-     */
-    virtual ~CCsMsgHandler();
-
-    /**
-     *  Start
-     *  This function starts the state machine to fetch msg data from msvserver
-     */        
-    void StartL();
-
-public://MMsvSessionObserver
-    /**
-     * Handles the MsvServer updates. Implemented for MMsvSessionObserver
-     */
-    void HandleSessionEventL(TMsvSessionEvent aEvent, 
-            TAny* aArg1, 
-            TAny* aArg2, 
-            TAny* aArg3);
-
-private:
-
-    /**
-     * CIdle callback
-     */
-    static TInt UploadMsg(TAny* arg);
-
-    /**
-     * State handler to read all messages 
-     */
-    TInt UploadMsgL();
-
-    /**
-     * Checks if the MTM type supported
-     */
-    TBool IsMtmSupported(long uid);
-
-private:
-
-    /**
-     * Constructor   
-     */
-    CCsMsgHandler();
-
-    /**
-     * 2nd phase construtor
-     * @param aMsgPlugin The main message plugin object
-     */
-    void ConstructL(MCsMsgObserver *aMsgPlugin);
-
-    /**
-     * ProcessResultsL fetches results and updates the CCsServer
-     * with the fetched data
-     */    
-    void ProcessResultsL(TMsvEntry aEntry);
-
-    /**
-     * Create CCsConversationEntry and adds to the list     
-     * @param aContact, Contact details
-     * @param aDescription, message body
-     * @param aEntry, TMsvEntry
-     */
-    void CreateAndAddEntryL(const TDesC& aContact,
-            const TDesC& aDescription,
-            const TMsvEntry& aEntry);
-
-    /**
-     * Process each entry
-     * @param aEvent Read, Update, Delete
-     * @param aContact (From/To) Field
-     * @param aDescription, message body
-     * @param aEntry, Message entry
-     */
-    void ProcessEntryL(TEventType aEvent, 
-            const TDesC& aContact,
-            const TDesC& aDescription,
-            const TMsvEntry& aEntry);
-
-    /**
-     * Process each entry
-     *@param aSelection, CMsvEntrySelections
-     *@param aParent, parent id if TMsvEntry
-     */    
-    void HandleEventL(CMsvEntrySelection* aSelection, TMsvId aParent);
-
-    /**
-     * Extracts the addresses in the to field and updates them to server
-     *@param aEntry, TMsvEntry
-     *@param aEvent Read, Update, Delete
-     *@param aFromAddress, from address of the message
-     */    
-    void ExtractAddressesL( 
-            TMsvEntry aEntry , 
-            TEventType aEvent,
-            RPointerArray<HBufC>& addressList);
-
-    /**
-     * Cleanup
-     */
-    void CleanupL();
-
-    /**
-     * Extracts the Message type based on the MTM value 
-     * @param aEntry, TMsvEntry
-     */
-    TCsType ExtractCsType( const TMsvEntry& aEntry);
-
-	
-private: //Data
-
-    /**
-     * MsvServer session object
-     */
-    CMsvSession* iSession;
-
-    /**
-     * Utility object
-     */
-    CCsMsgPluginUtility* iMsgPluginUtility;
-
-    /**
-     * iConverstationEntryList
-     * ConversationEntry list
-     * Own.
-     */    
-    RPointerArray<CCsConversationEntry> *iConverstationEntryList;
-
-    /**
-     * iMsgObserver
-     * The Observer interface
-     * Not Own.
-     */        
-    MCsMsgObserver *iMsgObserver;
-
-    /**
-     * Mtm registry object
-     */
-    CClientMtmRegistry* iMtmRegistry;
-
-    /**
-     * SMS client mtm object
-     */
-    CSmsClientMtm* iSmsMtm;
-
-    /**
-     * Mms client mtm object
-     */
-    CMmsClientMtm* iMmsMtm;
-
-    /**
-     * Previous entry, used for comparing with new entry received    
-     */
-    TMsvEntry iPrevEntry;
-
-    /**
-     * Root entry
-     */
-    CMsvEntry* iRootEntry;
-
-    /**
-     * Mesage count
-     */
-    TInt iMessageCount;
-
-    /**
-     * Messages under root entry
-     */
-    CMsvEntrySelection* iMessages;
-
-    /**
-     * Master array for holding all the messages 
-     */
-   RArray<TMsvId>* iMessageArray;
-
-    /**
-     * State
-     */
-    TMsgHandlerState iState;
-
-    /**
-     * Active object
-     */
-    CIdle* iIdle;
-    };
-
-#endif // _C_CS_MSG_REQUEST_HANDLER_H_
--- a/messagingapp/msgappfw/plugin/inc/ccsmsgpluginutility.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-/*
-* Copyright (c) 2007 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:  Utility class
- *
-*/
-
-
-#ifndef _C_CS_MSG_PLUGIN_UTILITY_H_
-#define _C_CS_MSG_PLUGIN_UTILITY_H_
-
-// SYSTEM INCLUDES
-#include <msvapi.h>
-#include <smuthdr.h>                    // CSmsHeader
-#include <txtetext.h>
-#include <msvids.h>
-#include <ccsdefs.h>
-#include <ccsconversationentry.h>
-
-// FORWARD DECLARATION
-class CCsConversationEntry;
-
-/**
- *  Message plugin Utility Class
- *  This class provides some utility methods
- */
-class CCsMsgPluginUtility: public CBase
-    {
-
-public:
-
-    /**
-     * Two phase construction
-     */
-    static CCsMsgPluginUtility* NewL();
-
-    /**
-     * Destructor
-     */
-    virtual ~CCsMsgPluginUtility();
-
-    /**
-     * Creates CCsConversationEntry using input parameters
-     *
-     * @since S60
-     * @param aContact Conatct details
-     * @param aEnryId Unique Id 
-     * @param aTimeStamp time stamp details
-     * @param aDir TMsvId of Parent
-     * @param aDescription description of the body message
-     * @param aSendState TCsSendState enum value
-     * @param aMsgAttribs TCsAttribute enum value
-     * @return  CCsConversationEntry object
-     */
-    CCsConversationEntry* CreateConversationEntryL(
-            const HBufC* aContact,
-            TMsvId aEnryId,
-            TInt64 aTimeStamp,
-            TMsvId aDir,
-            const HBufC* aDescription,
-            TCsSendState aSendState,
-            TCsAttribute aMsgAttribs,
-            TCsType aCsType) const ;
-
-    /**
-     * Map the call direction to TCsDirection.
-     *
-     * @since S60
-     * @param aDir The direction string which needs to be mapped
-     * @return TCsDirection enum value
-     */
-    TCsDirection MapDirection( TMsvId aDir ) const;
-
-    /**
-     * Returns the message attributes as a bitmask of TCsAttribute values.
-     *
-     * @param aEntry Message entry.
-     * @return A bitmask of TCsAttribute values.
-     * @see TCsAttribute
-     */
-    TUint16 GetMsgAttributes( const TMsvEntry& aEntry );
-
-    /**
-     * Returns the send status.
-     *
-     * @param aContext Message entry.
-     * @return send status like failed, sent, suspended etc.
-     * @see TCsSendState
-     */
-    TCsSendState GetSendState( const TMsvEntry& aContext );
-
-    /**
-     * Create the Contact (From/To) of the message
-     *
-     * @param aSession Message Server session
-     * @param aEntry Message entry
-     * @param addressList List from extracted from/to addresses
-     */
-    void CreateContactL( CMsvSession* aSession,
-                         const TMsvEntry& aEntry,
-                         RPointerArray<HBufC>& addressList);
-
-    /**
-     * Compare previous entry with new entry
-     *
-     * @param aOldContext previous Message entry
-     * @param aNewContext new Message entry
-     * @param aDir entry folder
-     * @return  ETrue/EFalse for same/different
-     */
-    TBool CompareEntry( const TMsvEntry& aOldContext,
-                        const TMsvEntry& aNewContext, 
-                        TMsvId aDir ) const;
-
-    /**
-     * Extracts name and address from the aMsvAddress
-     * which is of the form name<address>
-     * @param aMsvAddress which is of the form name<address>
-     * @param aName  extracted name
-     * @param aAddress extracted address
-     */
-    void NameAndAddress( const TPtrC& aMsvAddress, 
-                         TPtrC& aName, 
-                         TPtrC& aAddress );
-
-    /**
-     * Extract the address part for MMS ignoring the alias
-     */
-    TPtrC PureAddress(const TDesC& aAddress);
-
-private:
-    /**
-     * Constructor
-     */
-    CCsMsgPluginUtility();
-
-    };
-
-#endif // _C_CS_MSG_PLUGIN_UTILITY_H_
--- a/messagingapp/msgappfw/plugin/inc/mcsmsgobserver.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2007 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:  The observer interface which handles the completion of 
- *                reading message entries. 
- *
-*/
-
-
-#ifndef __M_CS_MSG_OBSERVER__ 
-#define __M_CS_MSG_OBSERVER__
-
-// INCLUDE FILES
-#include  "ccsdefs.h"
-
-// FORWARD DECLARATION
-class CCsConversationEntry;
-
-// CLASS DECLARATION
-/**
- *  MCsMsgObserver
- *  Mixin class.
- *  Observer which handles message read completion.
- */
-class MCsMsgObserver
-    {
-public:
-    /**
-     * HandleConverastions.
-     * Handle Conversation event from Plugins
-     * 
-     * @param aConversationEntryLists    List of conversation entries.
-     */
-    virtual void HandleReadCompleteL(const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
-
-    /**
-     *  HandleUpdateCompleteL
-     *  Sends the CCsConversationEntry array to Conversation Server
-     *  @param aConversationEntryLists The object to be used to handle updates 
-     *  from the plugin
-     */
-    virtual void HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
-
-    /**
-     *  HandleDeleteCompleteL
-     *  Sends the CCsConversationEntry array to Conversation Server
-     *  @param aConversationEntryLists The object to be used to handle updates 
-     *  from the plugin
-     */
-    virtual void HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
-
-    /**
-     * HandleRefreshCompleteL
-     * Notify conversation server to refresh the conversations from this plugin.
-     */
-    virtual void HandleRefreshCompleteL() = 0;
-    
-    /**
-     *  HandleCachingCompleted
-     *  Sends the cache completed status to server
-     */
-    virtual void HandleCachingCompleted() = 0;
-
-    /**
-     *  HandleCachingError
-     *  Sends the error occured during the caching to server
-     */
-    virtual void HandleCachingError(const TInt aError) = 0;
-
-    };
-
-#endif // __M_CS_MSG_OBSERVER__
-
-// End of File
--- a/messagingapp/msgappfw/plugin/plugin.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = subdirs
-
-QT -= gui
-
-# Platforms
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Build.inf rules
-
-symbian {
-    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "./rom/csmsg.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(csmsg.iby)"
-}
-
-symbian {
-BLD_INF_RULES.prj_mmpfiles = "./group/csmsg.mmp"
-}
--- a/messagingapp/msgappfw/plugin/rom/csmsg.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-/*
-* 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: 
-*
-*/
-#ifndef __CSMSG_IBY__
-#define __CSMSG_IBY__
-
-ECOM_PLUGIN(csmsg.dll, csmsg.rsc)
-
-// csmsg plugin resource
-data=DATAZ_\RESOURCE_FILES_DIR\plugins\csmsg.rsc    RESOURCE_FILES_DIR\plugins\csmsg.rsc
-
-
-#endif // __CSMSG_IBY__
--- a/messagingapp/msgappfw/plugin/rss/csmsg.rss	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2007 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:  
-*
-*/
-
-
-#include <ecom/registryinfo.rh>
-
-RESOURCE REGISTRY_INFO theInfo
-{
-	// UID for the DLL
-	dll_uid = 0x2002A546;
-	
-	// Declare array of interface info
-	interfaces = 
-		{
-		INTERFACE_INFO
-			{
-			
-			// UID of interface that is implemented
-			interface_uid = 0x2002A545;
-			
-			implementations = 
-				{
-				
-				// Info for all implementations					
-				IMPLEMENTATION_INFO
-					{
-					implementation_uid = 0x2002A5B7;
-					version_no         = 1;
-					display_name       = "Message Plugin";
-					default_data       = "CS Plugin";    
-					opaque_data        = ""; 
-					}
-					
-				};
-			}
-		};
-}
-	
--- a/messagingapp/msgappfw/plugin/src/ccsmsg.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
-* Copyright (c) 2007 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:  CS Message Plugin main class
- *
-*/
-
-
-// SYSTEM INCLUDES
-#include <mcsplugineventobserver.h>
-
-// USER INCLUDES
-#include "ccsmsg.h"
-#include "ccsmsghandler.h"
-
-// ============================== MEMBER FUNCTIONS ============================
-// ----------------------------------------------------------------------------
-// CCsMsg::NewL
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-CCsMsg* CCsMsg::NewL(MCsPluginEventObserver* aObserver)
-    {
-    PRINT ( _L("Enter CCsMsg::NewL") );
-
-    CCsMsg* self = new ( ELeave ) CCsMsg(aObserver);
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-
-    PRINT ( _L("End CCsMsg::NewL") );
-
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsg::CCsMsg
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-CCsMsg::CCsMsg(MCsPluginEventObserver* aObserver):iPluginEventObserver (aObserver)
-            {
-            }
-
-// ----------------------------------------------------------------------------
-// CCsMsg::ConstructL
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-void CCsMsg::ConstructL()
-    {
-    PRINT ( _L("Enter CCsMsg::ConstructL") );
-    iMsgHandler=CCsMsgHandler::NewL(this);
-    PRINT ( _L("Exit CCsMsg::ConstructL") );
-    }
-// ----------------------------------------------------------------------------
-// CCsMsg::~CCsMsg
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CCsMsg::~CCsMsg()
-    {
-    PRINT ( _L("Enter CCsMsg::~CCsMsg") );
-
-    if(iMsgHandler)
-        delete iMsgHandler;
-    iMsgHandler = NULL;
-
-    PRINT ( _L("End CCsMsg::~CCsMsg") );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleReadCompleteL()
-// Sends the CCsConversationEntry array to Conversation Server
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleReadCompleteL( const RPointerArray<CCsConversationEntry>
-*aConversationEntryLists)
-    {
-    iPluginEventObserver->AddConversations( *aConversationEntryLists );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleUpdateCompleteL()
-// Sends the CCsConversationEntry array to Conversation Server
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry>
-*aConversationEntryLists)
-    {
-    iPluginEventObserver->ModifyConversations( *aConversationEntryLists );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleDeleteCompleteL()
-// Sends the CCsConversationEntry array to Conversation Server
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry>
-*aConversationEntryLists)
-    {
-    iPluginEventObserver->DeleteConversations( *aConversationEntryLists );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleCachingCompleted
-// Sends the cache completed status to server
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleCachingCompleted()
-    {
-    iPluginEventObserver->CachingCompleted();
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleCachingError
-// Sends the error occured during the caching to server
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleCachingError(const TInt aError)
-    {
-    iPluginEventObserver->CachingError(aError);
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::GetConversationsL()
-// This function starts the state machine to fetch msg data from msvserver
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::GetConversationsL()
-    {
-    PRINT ( _L("Enter CCsMsg::GetConversationsL") );
-    //start handler
-    iMsgHandler->StartL();
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsg::HandleRefreshCompleteL
-// Notify server to refresh conversations.
-// -----------------------------------------------------------------------------
-//
-void CCsMsg::HandleRefreshCompleteL()
-    {
-    iPluginEventObserver->RefreshConversations();
-    }
-
-// End of file
--- a/messagingapp/msgappfw/plugin/src/ccsmsghandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,836 +0,0 @@
-/*
-* Copyright (c) 2007 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:  CS Message Handler, This class caches the conversation server
- *                with the message data and also sends run-time updates to the
- *                server with the message data
- *
-*/
-
-
-// USER INCLUDES
-#include "ccsmsghandler.h"
-#include "msgbiouids.h"
-
-// SYSTEM INCLUDES
-#include <smsclnt.h>                   
-#include <mmsclient.h>
-#include <mtclreg.h>
-#include <csmsemailfields.h>
-#include <txtrich.h>
-#include <msvids.h>
-#include <e32const.h>
-#include <SendUiConsts.h>
-#include <pushentry.h> // For services messages
-#include <e32cmn.h>
-
-
-//CONSTANTS
-const TInt KMessageArrayGranularity = 50;
-
-// NOTE:- DRAFT ENTRIES ARE NOT HANDLED IN THE PLUGIN
-
-// ============================== MEMBER FUNCTIONS ============================
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::NewL
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-CCsMsgHandler* CCsMsgHandler::NewL(MCsMsgObserver *aMsgObserver)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::NewL") );
-
-    CCsMsgHandler* self = new ( ELeave ) CCsMsgHandler();
-    CleanupStack::PushL( self );
-    self->ConstructL(aMsgObserver);
-    CleanupStack::Pop( self );
-
-    PRINT ( _L("End CCsMsgHandler::NewL") );
-
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::~CCsMsgHandler
-// Destructor
-// ----------------------------------------------------------------------------
-//
-CCsMsgHandler::~CCsMsgHandler()
-    {
-    PRINT ( _L("Enter CCsMsgHandler::~CCsMsgHandler") );
-
-    if(iMsgPluginUtility)
-        {
-        delete iMsgPluginUtility;
-        iMsgPluginUtility = NULL;
-        }
-
-    if(iConverstationEntryList)
-        {
-        iConverstationEntryList->ResetAndDestroy();
-        iConverstationEntryList->Close();
-        delete iConverstationEntryList;
-        iConverstationEntryList = NULL;
-        }
-
-    if(iSmsMtm)
-        {
-        delete iSmsMtm;
-        iSmsMtm = NULL;
-        }
-
-    if(iMmsMtm)
-        {
-        delete iMmsMtm;
-        iMmsMtm = NULL;
-        }
-
-    if(iMtmRegistry)
-        {
-        delete iMtmRegistry;
-        iMtmRegistry = NULL;
-        }
-
-    if(iSession)
-        {
-        delete iSession;
-        iSession = NULL;
-        }
-
-    if ( iRootEntry )
-        {
-        delete iRootEntry;
-        iRootEntry = NULL;
-        }
-
-    if ( iMessages )
-        {
-	    iMessages->Reset();
-        delete iMessages;
-        iMessages = NULL;
-        }
-    
-    if(iMessageArray)
-    {
-        iMessageArray->Reset();
-        iMessageArray->Close();
-        delete iMessageArray;
-        iMessageArray = NULL;
-    }
-
-    PRINT ( _L("End CCsMsgHandler::~CCsMsgHandler") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::ConstructL
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-void CCsMsgHandler::ConstructL(MCsMsgObserver *aMsgObserver)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::ConstructL") );
-
-    iMsgObserver = aMsgObserver;
-
-    iSession = CMsvSession::OpenSyncL(*this);
-
-    iMsgPluginUtility = CCsMsgPluginUtility::NewL();
-
-    iConverstationEntryList = new(ELeave)RPointerArray<CCsConversationEntry>();
-
-    iMtmRegistry = CClientMtmRegistry::NewL( *iSession );
-
-    iSmsMtm = static_cast<CSmsClientMtm*>( iMtmRegistry->
-            NewMtmL( KSenduiMtmSmsUid ) );
-
-    iMmsMtm = static_cast<CMmsClientMtm*>( iMtmRegistry->
-            NewMtmL( KSenduiMtmMmsUid ) );
-
-    iState = EReadInbox;
-
-    iMessageArray = new (ELeave)RArray <TMsvId>(KMessageArrayGranularity);
-
-    iMessageCount = 0;
-
-    PRINT ( _L("End CCsMsgHandler::ConstructL") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::CCsMsgHandler
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-//
-CCsMsgHandler::CCsMsgHandler()
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::ProcessResultsL()
-// ProcessResultsL fetches results for the searchsort query and
-// updates the CCsServer with the fetched data
-// -----------------------------------------------------------------------------
-//
-void CCsMsgHandler::ProcessResultsL(TMsvEntry entry)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::ProcessResultsL"));
-
-    // Cleanup the conversationEntry List initially.
-    // So that the previous entries not cleaned up in
-    // the event of Leave have been clean up.
-    iConverstationEntryList->ResetAndDestroy();
-
-    RPointerArray<HBufC> addressList;
-
-    // Ignore hidden items during upload
-    if ( entry.Visible() == EFalse )
-        {
-        return;
-        }
-    
-    if ( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ||
-         entry.Parent() == KMsvSentEntryIdValue ||
-         entry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
-        {
-        iMsgPluginUtility->CreateContactL(iSession, entry, addressList);
-
-        //process entry
-        ExtractAddressesL(entry, ERead, addressList);
-
-        addressList.ResetAndDestroy();	
-        }
-
-    PRINT ( _L("Exit CCsMsgHandler::ProcessResultsL") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::HandleSessionEventL
-// Implemented for MMsvSessionObserver
-// ----------------------------------------------------------------------------
-//
-void CCsMsgHandler::HandleSessionEventL( TMsvSessionEvent aEvent,
-        TAny* aArg1,
-        TAny* aArg2,
-        TAny* /*aArg3*/)
-    {
-    PRINT1 ( _L("Enter CCsMsgHandler::HandleSessionEventL aEvent=%d"),aEvent );
-
-    CMsvEntrySelection* selection=NULL;
-    TMsvId parent;
-
-    //args
-    if(aArg1 == NULL || aArg2 == NULL)
-        {
-        PRINT ( _L("Enter CCsMsgHandler::HandleSessionEventL arguments invalid"));
-        return;
-        }
-
-    //start, processing the event
-    selection= (CMsvEntrySelection*)aArg1;
-    parent = *(TMsvId*)aArg2;
-
-    // Cleanup the conversationEntry List initially.
-    iConverstationEntryList->ResetAndDestroy();
-
-    switch( aEvent )
-        {
-        case EMsvEntriesChanged:
-        case EMsvEntriesMoved:
-            {
-            HandleEventL(selection,parent);
-            }
-            break;
-            
-        case EMsvEntriesDeleted:
-            {
-            if ( parent == KMsvGlobalInBoxIndexEntryIdValue || 
-                 parent == KMsvSentEntryIdValue ||
-                 parent == KMsvGlobalOutBoxIndexEntryIdValue)
-                {
-                for( TInt i=0 ; i < selection->Count() ; i++ )
-                    {
-                    TMsvId id = selection->At( i );
-
-                    //use utility to create conversation entry
-                    CCsConversationEntry *conversationEntry = 
-                    iMsgPluginUtility->CreateConversationEntryL(
-                            NULL,
-                            id,
-                            0,
-                            parent,
-                            NULL,
-                            ECsSendStateUnknown,
-                            ECsAttributeNone,
-                            0);
-                    CleanupStack::PushL(conversationEntry);
-                    iConverstationEntryList->AppendL( conversationEntry );
-                    CleanupStack::Pop(conversationEntry);
-
-                    // call observer interface for each entry
-                    iMsgObserver->HandleDeleteCompleteL(iConverstationEntryList);
-
-                    //cleanup before next iteration
-                    iConverstationEntryList->ResetAndDestroy();
-                    }
-                }
-            }
-            break;
-            
-        case EMsvMediaChanged:
-            iMsgObserver->HandleRefreshCompleteL();
-            break;
-        }
-
-    // Cleanup the conversationEntry List before function exits.
-    iConverstationEntryList->ResetAndDestroy();
-    PRINT ( _L("Exit CCsMsgHandler::HandleSessionEventL") );
-    }
-
-// ---------------------------------------------------------------------
-// CCsMsgHandler::HandleEvent
-// Handle events
-// ---------------------------------------------------------------------
-//
-void CCsMsgHandler::HandleEventL(CMsvEntrySelection* aSelection, TMsvId aParent)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::HandleEvent") );
-    TMsvEntry entry;
-    TMsvId service;
-    TInt error= KErrNone;
-    RPointerArray<HBufC> addressList;
-
-    for( TInt i=0 ; i < aSelection->Count() ; i++ )
-        {
-        error = iSession->GetEntry(aSelection->At(i),service,entry);
-        
-        if ( entry.Visible() == EFalse )
-            {
-            // Do a delete if entry becomes invisible.
-            // e.g) My Nokia registration messages.
-            RPointerArray<CCsConversationEntry>* hiddenEntries =  
-                    new (ELeave) RPointerArray<CCsConversationEntry>();
-            
-            CCsConversationEntry *conversationEntry = 
-                    iMsgPluginUtility->CreateConversationEntryL ( 
-                            NULL,
-                            entry.Id(),
-                            0,
-                            aParent,
-                            NULL,
-                            ECsSendStateUnknown,
-                            ECsAttributeNone,
-                            0 );  
-            CleanupStack::PushL(conversationEntry);
-            hiddenEntries->AppendL( conversationEntry );
-            CleanupStack::Pop(conversationEntry);
-            
-            // Delete at server
-            iMsgObserver->HandleDeleteCompleteL(hiddenEntries);
-            hiddenEntries->ResetAndDestroy();
-            hiddenEntries->Close();
-            delete hiddenEntries;
-            
-            break;
-            }
-        
-        if ( (KErrNone == error) && (IsMtmSupported(entry.iMtm.iUid) ) )
-            {
-            // sent/inbox/Outbox entry
-            if ( aParent == KMsvSentEntryIdValue ||
-                 aParent == KMsvGlobalInBoxIndexEntryIdValue )
-                {
-                // currently server needs number, so getting it from header
-                iMsgPluginUtility->CreateContactL(iSession, entry,
-                        addressList);
-
-                //process entry
-                // entry created in sent already exists, hence an update
-                ExtractAddressesL(entry, EUpdate, addressList);
-
-                addressList.ResetAndDestroy();
-                }  
-                
-            //for drafts and outbox, the entry changes multiple times,
-            // so making a check if entry has changed
-            else if(aParent == KMsvGlobalOutBoxIndexEntryIdValue)
-                {
-                //outbox
-                if(!(iMsgPluginUtility->CompareEntry(iPrevEntry,entry,aParent)))
-                    {
-                    TUint sendState = entry.SendingState();
-                    
-                    // if the entry state is sent, we dont need to process it
-                    // as it is going to appear in sent items
-                    if( ECsSendStateSent != iMsgPluginUtility->GetSendState(entry) )
-                        {
-                        // currently server needs number, so getting it from header
-                        iMsgPluginUtility->CreateContactL(iSession, entry,
-                                addressList);
-                        
-                        //process entry
-                        // entry created in sent already exists, hence an update
-                        ExtractAddressesL(entry, EUpdate, addressList);
-                        
-                        iPrevEntry = entry;
-                        
-                        addressList.ResetAndDestroy();
-                        }
-                    }//end check changed entry
-                }
-            }
-        }//end for loop
-
-    PRINT ( _L("Exit CCsMsgHandler::HandleEvent") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::CreateAndAddEntryL
-// Creates CCsConversationEntry and adds to the list
-// ----------------------------------------------------------------------------
-//
-void CCsMsgHandler::CreateAndAddEntryL(const TDesC& aContact, 
-        const TDesC& aDescription, 
-        const TMsvEntry& aEntry)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::CreateAndAddEntryL") );
-
-    HBufC* contact = NULL;
-    HBufC* sDescription = NULL;
-
-    if (aContact.Length()>0)
-        {
-        contact = aContact.AllocL();
-        CleanupStack::PushL(contact);
-        }
-    if (aDescription.Length()>0)
-        {
-        sDescription = aDescription.AllocL();
-        CleanupStack::PushL(sDescription);
-        }
-
-    //use utility to create conversation entry
-    CCsConversationEntry *conversationEntry = iMsgPluginUtility->CreateConversationEntryL(
-            contact,
-            aEntry.Id(),
-            aEntry.iDate.Int64(),
-            aEntry.Parent(),
-            sDescription,
-            iMsgPluginUtility->GetSendState(aEntry),
-            iMsgPluginUtility->GetMsgAttributes(aEntry),
-            ExtractCsType(aEntry));
-    CleanupStack::PushL(conversationEntry);
-
-    //add to the list
-    iConverstationEntryList->AppendL( conversationEntry );
-    CleanupStack::Pop(conversationEntry);
-
-    // cleanup
-    if (sDescription)
-        {
-        CleanupStack::PopAndDestroy(sDescription);
-        }
-    if (contact)
-        {
-        CleanupStack::PopAndDestroy(contact);
-        }
-
-    PRINT ( _L("Exit CCsMsgHandler::CreateAndAddEntryL") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::ProcessEntryL
-// Creates CCsConversationEntry and adds to the list
-// ----------------------------------------------------------------------------
-//
-void CCsMsgHandler::ProcessEntryL( TEventType aEvent, const TDesC& aContact, 
-        const TDesC& aDescription, const TMsvEntry& aEntry)
-    {
-    PRINT ( _L("Enter CCsMsgHandler::ProcessEntryL") );
-
-    // create and add entry to the list
-    CreateAndAddEntryL(aContact,aDescription,aEntry);
-
-    // call cs observer interface for each entry
-    switch(aEvent)
-        {
-        case ERead:
-            {
-            iMsgObserver->HandleReadCompleteL(iConverstationEntryList);
-            }
-            break;
-        case EUpdate:
-            {
-            iMsgObserver->HandleUpdateCompleteL(iConverstationEntryList);
-            }
-            break;
-        }
-
-    // Cleanup the conversationEntry List, as we are just sending one entry at a time
-    iConverstationEntryList->ResetAndDestroy();
-
-    PRINT ( _L("Exit CCsMsgHandler::ProcessEntryL") );
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgHandler::ExtractAddressL
-// Extracts the addresses in the to field and updates them to server
-// ----------------------------------------------------------------------------
-//
-void CCsMsgHandler::ExtractAddressesL( 
-        TMsvEntry aEntry, 
-        TEventType aEvent, 
-        RPointerArray<HBufC>& addressList )
-    {
-    PRINT ( _L("Enter CCsMsgHandler::ExtractAddressesL") );
-
-    // For SMS read the whole body.
-    // For bio type SMS read the iDescription
-    // For other message types read the iDescription
-    // Note: After the LoadMessageL() the iDescription is getting 
-    // deleted so need to make a copy before that.
-    TPtrC description;
-    HBufC* tmpBuffer = NULL;
-
-    if ( (aEntry.iBioType && 
-	      aEntry.iBioType != KUidMsgSubTypeMmsAudioMsg.iUid ) || 
-		  aEntry.iMtm == KSenduiMtmBtUid ) 
-        {
-        tmpBuffer = aEntry.iDescription.AllocL();
-        description.Set( tmpBuffer->Des() );         
-        }    
-    else if ( aEntry.iMtm == KSenduiMtmSmsUid )  
-        {
-        iSmsMtm->SwitchCurrentEntryL( aEntry.Id() );
-        iSmsMtm->LoadMessageL();
-            
-        CRichText& body = iSmsMtm->Body();
-        TInt smsLength = body.DocumentLength();      
-        tmpBuffer = HBufC::NewL(smsLength);
-        TPtr ptr(tmpBuffer->Des());
-        body.Extract(ptr, 0);
-        description.Set( tmpBuffer->Des() );  
-        }
-    else if ( aEntry.iMtm == KSenduiMtmMmsUid  || 
-	          aEntry.iMtm == KSenduiMMSNotificationUid)  
-        {
-        tmpBuffer = aEntry.iDescription.AllocL();
-        description.Set( tmpBuffer->Des() );         
-
-        iMmsMtm->SwitchCurrentEntryL( aEntry.Id() );
-        iMmsMtm->LoadMessageL();
-
-        // Handle addresses
-        if ( aEntry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
-            {
-            HBufC* address = iMmsMtm->Sender().AllocL();
-            addressList.Append(address);
-            }
-        else if ( aEntry.Parent() == KMsvSentEntryIdValue ||
-                  aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
-            {
-            const CMsvRecipientList& addresses = iMmsMtm->AddresseeList();
-            TInt count = addresses.Count();
-
-            for( TInt i = 0; i < count; i++)
-                {
-                HBufC* address = addresses[i].AllocL();
-                TPtrC pureAddress = iMsgPluginUtility->PureAddress(*address);
-                HBufC* address1 = pureAddress.AllocL();
-                addressList.Append(address1);
-                delete address;
-                }
-            }
-        }
-    else
-        {
-        return;
-        }
-
-    if ( addressList.Count() > 0 )
-        {
-        for ( int i = 0; i < addressList.Count(); i++ )
-            {
-            HBufC* address = addressList[i];
-            ProcessEntryL(aEvent, *address, description, aEntry);
-            }
-        }
-    else
-        {
-        // Unknown
-        ProcessEntryL(aEvent, KNullDesC, description, aEntry);       
-        }
-
-    delete tmpBuffer;
-
-    PRINT ( _L("Exit CCsMsgHandler::ExtractAddressesL") );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::CompareOrder()
-// Method for determining the sorting behaviour of RArray of TMsvId's  
-// -----------------------------------------------------------------------------
-//
-static TInt CompareOrder(const TMsvId& aFirst, const TMsvId& aSecond)
-    {
-    return aSecond - aFirst;
-    }
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::UploadMsgL()
-// State machine to upload all messages 
-// -----------------------------------------------------------------------------
-//
-TInt CCsMsgHandler::UploadMsgL() 
-{
-    switch ( iState ) 
-    {
-        case EReadInbox:
-        {
-            iRootEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
-
-            // Set sort order
-            TMsvSelectionOrdering order;
-            order.SetSorting(EMsvSortById);
-            iRootEntry->SetSortTypeL(order);
-
-            iMessages = iRootEntry->ChildrenL();
-            iMessageCount = iRootEntry->Count();
-            if(iMessageCount)
-            {
-                for(int i = 0; i < iMessageCount; i ++)
-                {
-                    iMessageArray->Append(iMessages->At(i));
-                }
-            }
-
-            iState = EReadSent;
-            CleanupL();              
-
-            return 1;
-        }
-
-        case EReadSent:
-        {
-            iRootEntry = iSession->GetEntryL(KMsvSentEntryId);
-
-            // Set sort order
-            TMsvSelectionOrdering order;
-            order.SetSorting(EMsvSortById);
-            iRootEntry->SetSortTypeL(order);
-
-            iMessages = iRootEntry->ChildrenL();    
-            iMessageCount = iRootEntry->Count();
-            if(iMessageCount)
-            {
-                for(int i = 0; i < iMessageCount; i++ )
-                {
-                    iMessageArray->Append(iMessages->At(i));
-                }
-            }
-
-            iState = EReadOutbox;
-            CleanupL();
-
-            return 1;
-        }
-
-        case EReadOutbox:
-        {
-            iRootEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
-
-            // Set sort order
-            TMsvSelectionOrdering order;
-            order.SetSorting(EMsvSortById);
-            iRootEntry->SetSortTypeL(order);
-
-            iMessages = iRootEntry->ChildrenL();  
-            iMessageCount = iRootEntry->Count();
-
-            if(iMessageCount)
-            {
-                for(int i = 0; i < iMessageCount; i ++)
-                {
-                    iMessageArray->Append(iMessages->At(i));
-                }
-                iMessageCount=0;
-            }
-            iState = ESortEntries;
-            CleanupL();
-
-            return 1;
-        }
-        case ESortEntries:
-        {
-             //Sort the elements in the array by descending order of TMsvId's
-            TLinearOrder<TMsvId> order(CompareOrder);
-            iMessageArray->Sort(order);
-            iState = EProcessEntries;
-            return 1;
-        }
-        
-        case EProcessEntries:
-        { 
-            //Process one entry at a time in sequence
-            //Process the first element in the array on each call, till the end
-            if(iMessageArray->Count())
-            {
-                ProcessResultsL(iSession->GetEntryL(iMessageArray->operator[](0))->Entry());
-                iMessageArray->Remove(0);
-            }
-            else
-            {
-                iMsgObserver->HandleCachingCompleted();
-                return 0; //DONE 
-            }
-
-            iState = EProcessEntries;
-            return 1; 
-        }
-    }
-    return 0;    
-}
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::UploadMsg()
-// CIdle callback 
-// -----------------------------------------------------------------------------
-//
-TInt CCsMsgHandler::UploadMsg(TAny* aArg)
-    {
-    CCsMsgHandler* handler = (CCsMsgHandler*) aArg; 
-    TInt ok = 0;
-    TRAPD(err, ok = handler->UploadMsgL());
-    return ((err == KErrNone) && ok);
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::StartL()
-// This function starts the state machine to fetch sms data from msvserver
-// -----------------------------------------------------------------------------
-//
-void CCsMsgHandler::StartL()
-    {
-    PRINT ( _L("Enter CCsMsgHandler::Start") );
-
-    iState = EReadInbox;
-    TCallBack callback = TCallBack(UploadMsg, (TAny*) this);
-    iIdle = CIdle::NewL(CActive::EPriorityLow);
-    iIdle->Start(callback);
-
-    PRINT ( _L("End CCsMsgHandler::Start") );
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::CleanupL()
-// Helper function for state machine cleanup
-// -----------------------------------------------------------------------------
-//
-void CCsMsgHandler::CleanupL()
-    {
-    if ( iRootEntry )
-        {
-        delete iRootEntry;
-        iRootEntry = NULL;
-        }
-
-    if ( iMessages )
-        {
-	    iMessages->Reset();
-        delete iMessages;
-        iMessages = NULL;
-        }
-
-    iMessageCount = 0;     
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::IsMtmSupported()
-// 
-// -----------------------------------------------------------------------------
-//
-TBool CCsMsgHandler::IsMtmSupported(long uid)	
-    {
-    if ( KSenduiMtmSmsUidValue == uid || \
-         KSenduiMtmBtUidValue == uid || \
-         KSenduiMtmMmsUidValue == uid || \
-         KSenduiMtmBioUidValue == uid  || \
-         KSenduiMMSNotificationUidValue == uid || \
-         KUidMtmWapPush ==  TUid::Uid(uid) )
-        {
-        return ETrue;
-        }	
-    return EFalse;
-    }
-
-// -----------------------------------------------------------------------------
-// CCsMsgHandler::ExtractCsType()
-// Extracts the Message type based on the MTM Uid 
-// -----------------------------------------------------------------------------
-//
-TCsType CCsMsgHandler::ExtractCsType( const TMsvEntry& aEntry)
-    {
-    TCsType type = ECsUnknown;
-    switch(aEntry.iMtm.iUid)
-        {
-        case KSenduiMtmSmsUidValue:            
-            type = ECsSMS;
-            if (aEntry.iBioType == KMsgBioUidVCard.iUid)
-                {
-                type = ECsBioMsg_VCard;
-                }
-            break;
-        case KSenduiMtmBtUidValue:
-            type = ECsBlueTooth;
-            break;
-        case KSenduiMtmMmsUidValue:        
-           if(aEntry.iBioType == KUidMsgSubTypeMmsAudioMsg.iUid)
-                {
-                type = ECsAudio;
-                }
-            else
-                {
-                type = ECsMMS;
-                }
-            break;
-        case KSenduiMMSNotificationUidValue:            
-            type = ECsMmsNotification;
-            break;
-        case KSenduiMtmBioUidValue:
-            { 
-            type = ECsBioMsg; 
-            
-            // based on the biotype uid set message type
-            if(aEntry.iBioType == KMsgBioUidRingingTone.iUid)
-                {
-                type = ECsRingingTone;
-                }
-            else if(aEntry.iBioType == KMsgBioProvisioningMessage.iUid)
-                {
-                type = ECsProvisioning;
-                }
-		    else if (aEntry.iBioType == KMsgBioUidVCard.iUid)
-                {
-                type = ECsBioMsg_VCard;
-                }
-            else if (aEntry.iBioType == KMsgBioUidVCalendar.iUid)
-                {
-                type = ECsBioMsg_VCal;
-                }            
-            }
-            break;
-        default:
-            type = ECsUnknown;           
-	    	break;
-        }
-    return (type);  
-    }
-// End of file
-
--- a/messagingapp/msgappfw/plugin/src/ccsmsgpluginutility.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,462 +0,0 @@
-/*
-* Copyright (c) 2007 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:  CS Msg Plugin Utility class
- *
-*/
-
-
-// USER INCLUDES
-#include "ccsmsgpluginutility.h"
-#include "ccsdebug.h"
-
-//SYSTEM INCLUDES
-#include <csmsemailfields.h>
-#include <e32cmn.h>
-#include <SendUiConsts.h>
-#include <pushentry.h>
-#include <msvids.h>
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::NewL
-// Two Phase Construction
-// ----------------------------------------------------------------------------
-CCsMsgPluginUtility* CCsMsgPluginUtility::NewL( )
-    {
-    CCsMsgPluginUtility* self = new ( ELeave ) CCsMsgPluginUtility();
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::~CCsMsgPluginUtility
-// Destructor
-// ----------------------------------------------------------------------------
-CCsMsgPluginUtility::~CCsMsgPluginUtility()
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// Constructor
-// ----------------------------------------------------------------------------
-CCsMsgPluginUtility::CCsMsgPluginUtility()
-    {
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::CreateConversationEntryL
-// Creates CCsConversationEntry
-// ----------------------------------------------------------------------------
-//
-CCsConversationEntry* CCsMsgPluginUtility::CreateConversationEntryL(
-        const HBufC* aContact,
-        TMsvId aEnryId,
-        TInt64 aTimeStamp,
-        TMsvId aDir,
-        const HBufC* aDescription,
-        TCsSendState aSendState,
-        TCsAttribute aMsgAttribs,
-        TCsType aCsType) const 
-    {
-    // create CCsConversationEntry
-    CCsConversationEntry *conversationEntry = CCsConversationEntry::NewL();
-    CleanupStack::PushL(conversationEntry);
-        
-    //set the values
-    conversationEntry->SetContactL( *aContact );
-    conversationEntry->SetEntryId( aEnryId );
-    conversationEntry->SetTimeStampL( aTimeStamp );
-    conversationEntry->SetDescriptionL( *aDescription );
-    conversationEntry->SetConversationDir( MapDirection( aDir ) );
-    conversationEntry->SetSendState( aSendState );
-    conversationEntry->ChangeAttributes( aMsgAttribs, ECsAttributeNone );
-    conversationEntry->SetType(aCsType);
-        
-    //pop and return
-    CleanupStack::Pop(conversationEntry);
-    return conversationEntry;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::MapDirection
-// Map the msg direction to TCsDirection
-// ----------------------------------------------------------------------------
-//
-TCsDirection CCsMsgPluginUtility::MapDirection( TMsvId aDir ) const
-    {
-    TCsDirection direction = ECsDirectionUnknown;    
-    switch(aDir)
-        {
-        case KMsvSentEntryIdValue:
-        case KMsvGlobalOutBoxIndexEntryIdValue:  // Fall-through
-        case KMsvDraftEntryIdValue:
-            {
-            direction = ECsDirectionOutgoing;
-            break;
-            }
-        case KMsvGlobalInBoxIndexEntryIdValue:
-            {
-            direction = ECsDirectionIncoming;
-            break;
-            }
-        }
-    return direction;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::GetMsgAttributes
-// Returns the message attributes as a bitmask of TCsAttribute values.
-// ----------------------------------------------------------------------------
-//
-TUint16 CCsMsgPluginUtility::GetMsgAttributes( const TMsvEntry& aEntry )
-    {
-    TUint16 msgAttributes = ECsAttributeNone;
-    TMsvId parent = aEntry.Parent();
-
-    // New
-    if( aEntry.New() )
-        {
-        msgAttributes |= ECsAttributeNew;
-        }
-
-    // Drafts
-    if( KMsvDraftEntryIdValue == parent )
-        {
-        msgAttributes |= ECsAttributeDraft;
-        }
-
-    // Attachments
-    if( aEntry.Attachment() )
-        {
-        msgAttributes |= ECsAttributeAttachment;
-        }
-
-    // Priority
-    TMsvPriority priority = aEntry.Priority();
-    if( EMsvHighPriority == priority )
-        {
-        msgAttributes |= ECsAttributeHighPriority;
-        }
-    else if( EMsvLowPriority == priority )
-        {
-        msgAttributes |= ECsAttributeLowPriority;
-        }
-
-    // Read/Unread
-    if( KMsvGlobalInBoxIndexEntryIdValue == parent )
-        {
-        if( EFalse == aEntry.Unread() )
-            {
-            // Read
-            msgAttributes &= ~ECsAttributeUnread;
-            }
-        else
-            {
-            // Unread
-            msgAttributes |= ECsAttributeUnread;
-            }
-        }
-
-    // Sent
-    if( KMsvSentEntryIdValue == parent )
-        {
-        msgAttributes |= ECsAttributeSent;
-        }
-
-    return msgAttributes;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::GetSendState
-// Returns the send status.
-// ----------------------------------------------------------------------------
-//
-TCsSendState CCsMsgPluginUtility::GetSendState( const TMsvEntry& aContext )
-    {
-    TUint sendingState = aContext.SendingState();
-    TCsSendState convSendState = ECsSendStateUnknown;
-
-    switch( sendingState )
-        {
-        case KMsvSendStateUponRequest:
-            {
-            convSendState = ECsSendStateUponRequest;
-            break;
-            }
-        case KMsvSendStateWaiting:
-            {
-            convSendState = ECsSendStateWaiting;
-            break;
-            }
-        case KMsvSendStateSending:
-            {
-            convSendState = ECsSendStateSending;
-            break;
-            }
-        case KMsvSendStateScheduled:
-            {
-            convSendState = ECsSendStateScheduled;
-            break;
-            }
-        case KMsvSendStateResend:
-            {
-            convSendState = ECsSendStateResend;
-            break;
-            }
-        case KMsvSendStateSuspended:
-            {
-            convSendState = ECsSendStateSuspended;
-            break;
-            }
-        case KMsvSendStateFailed:
-            {
-            convSendState = ECsSendStateFailed;
-            break;
-            }
-        case KMsvSendStateSent:
-            {
-            convSendState = ECsSendStateSent;
-            break;
-            }
-        case KMsvSendStateNotApplicable:
-            {
-            convSendState = ECsSendStateNotApplicable;
-            break;
-            }
-        }
-    return convSendState;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::GetContact
-// Get the Contact (From/To) of the message
-// ----------------------------------------------------------------------------
-//
-void CCsMsgPluginUtility::CreateContactL(CMsvSession* aSession,
-					const TMsvEntry& aEntry,
-					RPointerArray<HBufC>& addressList)
-	{
-    if ( aEntry.iMtm.iUid == KSenduiMtmSmsUidValue )      
-        {
-        CPlainText* nullString = CPlainText::NewL();
-        CleanupStack::PushL( nullString );
-    
-        CSmsHeader* smsHeader = NULL;
-        if ( aEntry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) 
-            {
-            smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *nullString );
-            }
-        else if ( aEntry.Parent() == KMsvSentEntryIdValue || 
-                  aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
-            {
-            smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *nullString );
-            }
-        else
-            {
-            CleanupStack::PopAndDestroy(nullString);
-            return;
-            }
-        CleanupStack::PushL( smsHeader );
-    
-        CMsvEntry *cEntry = CMsvEntry::NewL(*aSession,aEntry.Id(),
-            TMsvSelectionOrdering() );
-        CleanupStack::PushL( cEntry );
-    
-        CMsvStore* store = cEntry->ReadStoreL();
-        CleanupStack::PushL(store);
-    
-        TRAPD(err, smsHeader->RestoreL( *store ));    
-        if ( err == KErrNone )
-            {
-            if ( aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue ||
-                 aEntry.Parent() == KMsvSentEntryIdValue )
-                {
-                const CArrayPtrFlat<CSmsNumber>& rcpts = smsHeader->Recipients();
-                const CSmsNumber& rcpt = *rcpts.At(0);
-
-                HBufC* fromAddress = (rcpt.Address()).AllocL();
-                addressList.Append(fromAddress);
-                }
-            else
-                {
-                // Check and add if any email addresses                
-                const CSmsEmailFields& emailFields = smsHeader->EmailFields();
-                if( emailFields.HasAddress() )
-                    {                  
-                    TPtrC name;
-                    TPtrC address;
-
-                    const MDesCArray& emailRecipients = emailFields.Addresses();
-                    for( TInt id = 0; id < emailRecipients.MdcaCount(); id++ )
-                        {
-                        NameAndAddress( emailRecipients.MdcaPoint( id ), name, address);
-                        
-                        // Add address to list
-                        HBufC* addressBuf = HBufC::NewL( address.Length() );
-                        TPtr addressPtr( 0, 0 );
-                        addressPtr.Set( addressBuf->Des() );
-                        addressPtr.Copy( address );
-                        addressList.Append(addressBuf);
-                        }
-                    }
-                else
-                    { 
-                    HBufC* fromAddress = (smsHeader->FromAddress()).AllocL();   
-                    
-                    // Try iDetails if empty
-                    if ( fromAddress->Length() == 0 )
-                        fromAddress = aEntry.iDetails.AllocL();
-                    
-                    addressList.Append(fromAddress);
-                    }
-                }
-            }
-        
-        // Cleanup 
-        CleanupStack::PopAndDestroy(store);
-        CleanupStack::PopAndDestroy(cEntry);
-        CleanupStack::PopAndDestroy(smsHeader);
-        CleanupStack::PopAndDestroy(nullString);
-        }
-    else if ( aEntry.iMtm.iUid == KSenduiMtmBtUidValue  ||  
-			  aEntry.iMtm.iUid == KSenduiMtmBioUidValue ||
-			  aEntry.iMtm == KUidMtmWapPush )
-        {
-        HBufC* fromAddress = aEntry.iDetails.AllocL();
-        addressList.Append(fromAddress);
-        }
-    }
-
-// ---------------------------------------------------------
-// CCsMsgPluginUtility::CompareEntry
-//
-// ---------------------------------------------------------
-TBool CCsMsgPluginUtility::CompareEntry( const TMsvEntry& aOldContext,  
-	const TMsvEntry& aNewContext, TMsvId aDir ) const
-    {
-    if(	(aOldContext.Id() == aNewContext.Id()) 
-        &&   (aOldContext.Parent() == aNewContext.Parent())
-        &&   (0 == aOldContext.iDescription.Compare(aNewContext.iDescription)) )
-    {
-    // incase of outbox, check sending state also
-    if(aDir == KMsvGlobalOutBoxIndexEntryIdValue)
-        {
-        if(aOldContext.SendingState() == aNewContext.SendingState())
-            return ETrue;
-        else
-            return EFalse;
-        }
-    return ETrue;
-    }
-
-    return EFalse;
-    }
-
-// ----------------------------------------------------------------------------
-// CCsMsgPluginUtility::NameAndAddress
-// Extracts name and address from the aMsvAddress
-// which is of the form name<address>
-// ----------------------------------------------------------------------------
-void CCsMsgPluginUtility::NameAndAddress( const TPtrC& aMsvAddress, 
-				TPtrC& aName, 
-				TPtrC& aAddress )
-    {
-    // For address information separation (start)
-    const TUint KMsgSmsAddressStartChar         ('<');
-
-    // For address information separation (end)
-    const TUint KMsgSmsAddressEndChar           ('>');
-
-    TInt addressStart = aMsvAddress.LocateReverse( KMsgSmsAddressStartChar );
-    TInt addressEnd = aMsvAddress.LocateReverse( KMsgSmsAddressEndChar );
-
-    if ( addressStart != KErrNotFound && addressEnd != KErrNotFound
-            && addressEnd > addressStart )
-        {
-        // verified address, will be used as selected from contacts manager
-        aName.Set( aMsvAddress.Ptr(), addressStart );
-        aAddress.Set(
-                aMsvAddress.Mid( addressStart + 1 ).Ptr(),
-                ( addressEnd - addressStart ) -1 );
-        if ( !aAddress.Length())
-            {
-            aAddress.Set( aName );
-            aName.Set( KNullDesC ); // empty string
-            }
-        }
-    else
-        {
-        // unverified string, will be used as entered in the header field
-        aName.Set( KNullDesC ); // empty string
-        aAddress.Set( aMsvAddress.Ptr(), aMsvAddress.Length() ); // a whole string to address
-        }
-
-    if ( aName.CompareF( aAddress ) == 0 )
-        {
-        aName.Set( KNullDesC ); // empty string
-        }
-    }
-
-// ---------------------------------------------------------
-// CCsMsgPluginUtility::PureAddress
-// Extract the phone number for MMS
-// ---------------------------------------------------------
-//
-TPtrC CCsMsgPluginUtility::PureAddress( const TDesC& aAddress )
-    {
-    _LIT( KOpen, "<" );
-    _LIT( KClose, ">" );
-	
-    // syntax is :
-    // <alias><separator1><pure_address><separator2> |
-    // <pure_address>
-    TInt firstPos = 0;
-    TInt lastPos = 0;
-    TInt length = aAddress.Length();
-    TInt sepaLen1 = KOpen().Length();
-    TInt sepaLen2 = KClose().Length();
-    TInt firstSeparatorPosition = 0;
-
-    while( firstSeparatorPosition >= 0 )
-        {
-        firstSeparatorPosition = aAddress.Mid( firstPos ).Find( KOpen );
-        if ( firstSeparatorPosition >= 0 )
-            {
-            firstPos += firstSeparatorPosition + sepaLen1;
-            }
-        }
-    if ( firstPos <= 0 )
-        {
-        // No alias
-        return aAddress;
-        }
-
-    // Check if the second separator ends the address
-    TPtrC last = aAddress.Right( sepaLen2 );
-    lastPos = length - sepaLen2;
-
-    if ( !last.Compare( KClose ) )
-        {
-        // Alias part found
-        if ( lastPos > firstPos )
-            {
-            return aAddress.Mid( firstPos, lastPos - firstPos );
-            }
-        }
-    // No alias defined - return the original string as pure address
-    // If syntax is weird, namely 
-    // alias <>
-    // with nothing between the separators, we return the original string as is
-    return aAddress;
-    }
-
-//End of File
--- a/messagingapp/msgappfw/plugin/src/proxy.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2007 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:  ECOM Plugin proxy details
- *
-*/
-
-
-// INCLUDES
-#include <e32std.h>
-#include <ecom/implementationproxy.h>
-#include "ccsmsg.h"
-
-// Provides a key value pair table, this is used to identify
-// the correct construction function for the requested interface.
-const TImplementationProxy ImplementationTable[] =
-{
-        IMPLEMENTATION_PROXY_ENTRY(0x2002A5B7, CCsMsg::NewL )
-};
-
-// Function used to return an instance of the proxy table.
-EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
-    {
-    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
-    return ImplementationTable;
-    }
-
-// End of file
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/group/csmsg.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006-2007 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:  CS Msg Plugin
+*
+*/
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+CAPABILITY      CAP_ECOM_PLUGIN 
+VENDORID        VID_DEFAULT
+TARGET          csmsg.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x2002A546
+
+VERSION 	1.0
+
+PAGED
+
+// RESOURCE
+START RESOURCE ../rss/csmsg.rss
+TARGET csmsg.rsc
+END
+
+SOURCEPATH      ../src
+
+SOURCE          proxy.cpp
+SOURCE 		ccsmsg.cpp
+SOURCE 		ccsmsgpluginutility.cpp
+SOURCE 		ccsmsghandler.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../server/inc
+USERINCLUDE     ../../../utils/inc
+USERINCLUDE     ../../../../../inc
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         eCom.lib
+LIBRARY         csutils.lib
+DEBUGLIBRARY    flogger.lib
+
+// Msg Server
+LIBRARY         Smcm.lib
+LIBRARY         gsmu.lib
+LIBRARY         etext.lib
+LIBRARY         msgs.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsg.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2007 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:  Message Plugin main class
+ *
+*/
+
+
+#ifndef _C_CS_MSG_H_
+#define _C_CS_MSG_H_
+
+// INCLUDE FILES
+
+// SYSTEM INCLUDES
+
+// USER INCLUDES
+#include "ccsplugin.h"
+#include "mcsmsgobserver.h"
+#include "ccsdebug.h"
+#include "ccsdefs.h"
+
+// FORWARD DECLARATION
+class MCsPluginEventObserver;
+class MCsMsgObserver;
+class CCsConversationEntry;
+class CCsMsgHandler;
+
+/**
+ *  Message plugin class
+ *  This class interacts with MsvServer to fetch the message data.
+ */
+class CCsMsg : public CCsPlugin, public MCsMsgObserver
+    {
+public: 
+
+    /**
+     * Two phase construction
+     */
+    static CCsMsg* NewL( MCsPluginEventObserver* aMCsPluginEventObserver);
+
+    /**
+     * Destructor
+     */
+    virtual ~CCsMsg();
+
+
+public: // From base class CCsPlugin
+    /**
+     *  GetConversationsL
+     *  This function starts the state machine to fetch msg data from msvserver
+     */        
+    void GetConversationsL();
+
+public: //MCsMsgObserver
+    /**
+     *  HandleReadCompleteL
+     *  Sends the CCsConversationEntry array to Conversation Server
+     *  @param aConversationEntryLists The object to be used to handle updates 
+     *  from the plugin
+     */
+    void HandleReadCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
+
+    /**
+     *  HandleUpdateCompleteL
+     *  Sends the CCsConversationEntry array to Conversation Server
+     *  @param aConversationEntryLists The object to be used to handle updates 
+     *  from the plugin
+     */
+    void HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
+
+    /**
+     *  HandleDeleteCompleteL
+     *  Sends the CCsConversationEntry array to Conversation Server
+     *  @param aConversationEntryLists The object to be used to handle updates 
+     *  from the plugin
+     */
+    void HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists);
+
+    /**
+     * HandleRefreshCompleteL
+     * Notify conversation server to refresh the conversations from this plugin.
+     */
+    void HandleRefreshCompleteL();
+    
+    /**
+     *  HandleCachingCompleted
+     *  Sends the cache completed status to server
+     */
+    void HandleCachingCompleted();
+
+    /**
+     *  HandleCachingError
+     *  Sends the error occured during the caching to server
+     */
+    void HandleCachingError(const TInt aError);
+    
+private:
+
+    /**
+     * Constructor
+     */
+    CCsMsg(MCsPluginEventObserver* aObserver);
+
+    /**
+     * 2nd phase construtor
+     */
+    void ConstructL();
+
+private: //Data
+
+    /**
+     * The msg plugin class which sends the initial set of conversation 
+     * entries upon bootup to conversations server.
+     * and notifies the conversations server about the new MsvServer events
+     */
+    CCsMsgHandler* iMsgHandler;  
+
+    /**
+     * iPluginEventObserver
+     * Plugin event observer
+     * Not Own.
+     */
+    MCsPluginEventObserver* iPluginEventObserver;
+    };
+
+#endif // _C_CS_MSG_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsghandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,251 @@
+/*
+* Copyright (c) 2007 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:  Request Handler plugin
+ *
+*/
+
+
+#ifndef _C_CS_MSG_REQUEST_HANDLER_H_
+#define _C_CS_MSG_REQUEST_HANDLER_H_
+
+//SYSTEM INCLUDES
+#include <msvapi.h>
+
+//USER INCLUDES
+#include "ccsmsg.h"
+#include "ccsmsgpluginutility.h"
+
+
+// FORWARD DECLARATION
+class CCsPlugin;
+class CMsvSession;
+class MCsPluginEventObserver;
+class MMsvSessionObserver;
+class CCsConversationEntry;
+class CCsMsg;
+class CCsMsgPluginUtility;
+class CClientMtmRegistry;
+class CSmsClientMtm;
+class CMmsClientMtm;
+
+/**
+ * Operation Type
+ */  
+enum TEventType
+    {
+    ERead,
+    EUpdate,
+    EDelete
+    };
+
+/**
+ * States
+ */
+enum TMsgHandlerState
+    {
+    EReadInbox,
+    EReadSent,
+    EProcessDraft,
+    EReadOutbox,
+    ESortEntries,
+    EProcessEntries,
+    EComplete
+    };
+
+/**
+ *  Message plugin Request Handler Class
+ *  This class interacts with MsvServer to fetch message data
+ */
+class CCsMsgHandler : public CBase, public MMsvSessionObserver
+    {
+
+public: 
+
+    /**
+     * Two phase construction
+     * @param aMsgObserver MCsMsgObserver interface
+     */
+    static CCsMsgHandler* NewL(MCsMsgObserver *aMsgObserver);
+
+    /**
+     * Destructor
+     */
+    virtual ~CCsMsgHandler();
+
+    /**
+     *  Start
+     *  This function starts the state machine to fetch msg data from msvserver
+     */        
+    void StartL();
+
+public://MMsvSessionObserver
+    /**
+     * Handles the MsvServer updates. Implemented for MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent aEvent, 
+            TAny* aArg1, 
+            TAny* aArg2, 
+            TAny* aArg3);
+
+private:
+
+    /**
+     * CIdle callback
+     */
+    static TInt UploadMsg(TAny* arg);
+
+    /**
+     * State handler to read all messages 
+     */
+    TInt UploadMsgL();
+
+    /**
+     * Checks if the MTM type supported
+     */
+    TBool IsMtmSupported(long uid);
+    
+    /**
+     * Read all message Id in iMessageArray
+     * @aFolderId - Folder Id whose message need to be sync.
+     */
+    void UpdateMessageArrayL(const TMsvId& aFolderId);
+    
+private:
+
+    /**
+     * Constructor   
+     */
+    CCsMsgHandler();
+
+    /**
+     * 2nd phase construtor
+     * @param aMsgPlugin The main message plugin object
+     */
+    void ConstructL(MCsMsgObserver *aMsgPlugin);
+
+    /**
+     * ProcessResultsL fetches results and updates the CCsServer
+     * with the fetched data
+     */    
+    void ProcessResultsL(TMsvEntry aEntry);
+
+    /**
+     * Create CCsConversationEntry and adds to the list     
+     * @param aContact, Contact details
+     * @param aDescription, message body
+     * @param aEntry, TMsvEntry
+     */
+    void CreateAndAddEntryL(const TDesC& aContact,
+            const TDesC& aDescription,
+            const TMsvEntry& aEntry);
+
+    /**
+     * Process each entry
+     * @param aEvent Read, Update, Delete
+     * @param aContact (From/To) Field
+     * @param aDescription, message body
+     * @param aEntry, Message entry
+     */
+    void ProcessEntryL(TEventType aEvent, 
+            const TDesC& aContact,
+            const TDesC& aDescription,
+            const TMsvEntry& aEntry);
+
+    /**
+     * Process each entry
+     *@param aSelection, CMsvEntrySelections
+     *@param aParent, parent id if TMsvEntry
+     */    
+    void HandleEventL(CMsvEntrySelection* aSelection, TMsvId aParent);
+
+    /**
+     * Extracts the addresses in the to field and updates them to server
+     *@param aEntry, TMsvEntry
+     *@param aEvent Read, Update, Delete
+     *@param aFromAddress, from address of the message
+     */    
+    void ExtractAddressesL( 
+            TMsvEntry aEntry , 
+            TEventType aEvent,
+            RPointerArray<HBufC>& addressList);
+
+    /**
+     * Extracts the Message type based on the MTM value 
+     * @param aEntry, TMsvEntry
+     */
+    TCsType ExtractCsType( const TMsvEntry& aEntry);
+	
+private: //Data
+
+    /**
+     * MsvServer session object
+     */
+    CMsvSession* iSession;
+
+    /**
+     * Utility object
+     */
+    CCsMsgPluginUtility* iMsgPluginUtility;
+
+    /**
+     * iConverstationEntryList
+     * ConversationEntry list
+     * Own.
+     */    
+    RPointerArray<CCsConversationEntry> *iConverstationEntryList;
+
+    /**
+     * iMsgObserver
+     * The Observer interface
+     * Not Own.
+     */        
+    MCsMsgObserver *iMsgObserver;
+
+    /**
+     * Mtm registry object
+     */
+    CClientMtmRegistry* iMtmRegistry;
+
+    /**
+     * SMS client mtm object
+     */
+    CSmsClientMtm* iSmsMtm;
+
+    /**
+     * Mms client mtm object
+     */
+    CMmsClientMtm* iMmsMtm;
+
+    /**
+     * Previous entry, used for comparing with new entry received    
+     */
+    TMsvEntry iPrevEntry;
+
+    /**
+     * Master array for holding all the messages 
+     */
+   RArray<TMsvId>* iMessageArray;
+
+    /**
+     * State
+     */
+    TMsgHandlerState iState;
+
+    /**
+     * Active object
+     */
+    CIdle* iIdle;
+    };
+
+#endif // _C_CS_MSG_REQUEST_HANDLER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/inc/ccsmsgpluginutility.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2007 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:  Utility class
+ *
+*/
+
+
+#ifndef _C_CS_MSG_PLUGIN_UTILITY_H_
+#define _C_CS_MSG_PLUGIN_UTILITY_H_
+
+// SYSTEM INCLUDES
+#include <msvapi.h>
+#include <smuthdr.h>                    // CSmsHeader
+#include <txtetext.h>
+#include <msvids.h>
+#include <ccsdefs.h>
+#include <ccsconversationentry.h>
+
+// FORWARD DECLARATION
+class CCsConversationEntry;
+
+/**
+ *  Message plugin Utility Class
+ *  This class provides some utility methods
+ */
+class CCsMsgPluginUtility: public CBase
+    {
+
+public:
+
+    /**
+     * Two phase construction
+     */
+    static CCsMsgPluginUtility* NewL();
+
+    /**
+     * Destructor
+     */
+    virtual ~CCsMsgPluginUtility();
+
+    /**
+     * Creates CCsConversationEntry using input parameters
+     *
+     * @since S60
+     * @param aContact Conatct details
+     * @param aEnryId Unique Id 
+     * @param aTimeStamp time stamp details
+     * @param aDir TMsvId of Parent
+     * @param aDescription description of the body message
+     * @param aSendState TCsSendState enum value
+     * @param aMsgAttribs TCsAttribute enum value
+     * @return  CCsConversationEntry object
+     */
+    CCsConversationEntry* CreateConversationEntryL(
+            const HBufC* aContact,
+            TMsvId aEnryId,
+            TInt64 aTimeStamp,
+            TMsvId aDir,
+            const HBufC* aDescription,
+            TCsSendState aSendState,
+            TCsAttribute aMsgAttribs,
+            TCsType aCsType) const ;
+
+    /**
+     * Map the call direction to TCsDirection.
+     *
+     * @since S60
+     * @param aDir The direction string which needs to be mapped
+     * @return TCsDirection enum value
+     */
+    TCsDirection MapDirection( TMsvId aDir ) const;
+
+    /**
+     * Returns the message attributes as a bitmask of TCsAttribute values.
+     *
+     * @param aEntry Message entry.
+     * @return A bitmask of TCsAttribute values.
+     * @see TCsAttribute
+     */
+    TUint16 GetMsgAttributes( const TMsvEntry& aEntry );
+
+    /**
+     * Returns the send status.
+     *
+     * @param aContext Message entry.
+     * @return send status like failed, sent, suspended etc.
+     * @see TCsSendState
+     */
+    TCsSendState GetSendState( const TMsvEntry& aContext );
+
+    /**
+     * Create the Contact (From/To) of the message
+     *
+     * @param aSession Message Server session
+     * @param aEntry Message entry
+     * @param addressList List from extracted from/to addresses
+     */
+    void CreateContactL( CMsvSession* aSession,
+                         const TMsvEntry& aEntry,
+                         RPointerArray<HBufC>& addressList);
+
+    /**
+     * Compare previous entry with new entry
+     *
+     * @param aOldContext previous Message entry
+     * @param aNewContext new Message entry
+     * @param aDir entry folder
+     * @return  ETrue/EFalse for same/different
+     */
+    TBool CompareEntry( const TMsvEntry& aOldContext,
+                        const TMsvEntry& aNewContext, 
+                        TMsvId aDir ) const;
+
+    /**
+     * Extracts name and address from the aMsvAddress
+     * which is of the form name<address>
+     * @param aMsvAddress which is of the form name<address>
+     * @param aName  extracted name
+     * @param aAddress extracted address
+     */
+    void NameAndAddress( const TPtrC& aMsvAddress, 
+                         TPtrC& aName, 
+                         TPtrC& aAddress );
+
+    /**
+     * Extract the address part for MMS ignoring the alias
+     */
+    TPtrC PureAddress(const TDesC& aAddress);
+
+private:
+    /**
+     * Constructor
+     */
+    CCsMsgPluginUtility();
+
+    };
+
+#endif // _C_CS_MSG_PLUGIN_UTILITY_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/inc/mcsmsgobserver.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2007 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:  The observer interface which handles the completion of 
+ *                reading message entries. 
+ *
+*/
+
+
+#ifndef __M_CS_MSG_OBSERVER__ 
+#define __M_CS_MSG_OBSERVER__
+
+// INCLUDE FILES
+#include  "ccsdefs.h"
+
+// FORWARD DECLARATION
+class CCsConversationEntry;
+
+// CLASS DECLARATION
+/**
+ *  MCsMsgObserver
+ *  Mixin class.
+ *  Observer which handles message read completion.
+ */
+class MCsMsgObserver
+    {
+public:
+    /**
+     * HandleConverastions.
+     * Handle Conversation event from Plugins
+     * 
+     * @param aConversationEntryLists    List of conversation entries.
+     */
+    virtual void HandleReadCompleteL(const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
+
+    /**
+     *  HandleUpdateCompleteL
+     *  Sends the CCsConversationEntry array to Conversation Server
+     *  @param aConversationEntryLists The object to be used to handle updates 
+     *  from the plugin
+     */
+    virtual void HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
+
+    /**
+     *  HandleDeleteCompleteL
+     *  Sends the CCsConversationEntry array to Conversation Server
+     *  @param aConversationEntryLists The object to be used to handle updates 
+     *  from the plugin
+     */
+    virtual void HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry> *aConversationEntryLists) = 0;
+
+    /**
+     * HandleRefreshCompleteL
+     * Notify conversation server to refresh the conversations from this plugin.
+     */
+    virtual void HandleRefreshCompleteL() = 0;
+    
+    /**
+     *  HandleCachingCompleted
+     *  Sends the cache completed status to server
+     */
+    virtual void HandleCachingCompleted() = 0;
+
+    /**
+     *  HandleCachingError
+     *  Sends the error occured during the caching to server
+     */
+    virtual void HandleCachingError(const TInt aError) = 0;
+
+    };
+
+#endif // __M_CS_MSG_OBSERVER__
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/msgplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,31 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+# Build.inf rules
+
+symbian {
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+    "./rom/csmsg.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(csmsg.iby)"
+}
+
+symbian {
+BLD_INF_RULES.prj_mmpfiles = "./group/csmsg.mmp"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/rom/csmsg.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,26 @@
+/*
+* 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: 
+*
+*/
+#ifndef __CSMSG_IBY__
+#define __CSMSG_IBY__
+
+ECOM_PLUGIN(csmsg.dll, csmsg.rsc)
+
+// csmsg plugin resource
+data=DATAZ_\RESOURCE_FILES_DIR\plugins\csmsg.rsc    RESOURCE_FILES_DIR\plugins\csmsg.rsc
+
+
+#endif // __CSMSG_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/rss/csmsg.rss	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 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:  
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+{
+	// UID for the DLL
+	dll_uid = 0x2002A546;
+	
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			
+			// UID of interface that is implemented
+			interface_uid = 0x2002A545;
+			
+			implementations = 
+				{
+				
+				// Info for all implementations					
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002A5B7;
+					version_no         = 1;
+					display_name       = "Message Plugin";
+					default_data       = "CS Plugin";    
+					opaque_data        = ""; 
+					}
+					
+				};
+			}
+		};
+}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsg.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2007 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:  CS Message Plugin main class
+ *
+*/
+
+
+// SYSTEM INCLUDES
+#include <mcsplugineventobserver.h>
+
+// USER INCLUDES
+#include "ccsmsg.h"
+#include "ccsmsghandler.h"
+
+// ============================== MEMBER FUNCTIONS ============================
+// ----------------------------------------------------------------------------
+// CCsMsg::NewL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsMsg* CCsMsg::NewL(MCsPluginEventObserver* aObserver)
+    {
+    PRINT ( _L("Enter CCsMsg::NewL") );
+
+    CCsMsg* self = new ( ELeave ) CCsMsg(aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    PRINT ( _L("End CCsMsg::NewL") );
+
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsg::CCsMsg
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsMsg::CCsMsg(MCsPluginEventObserver* aObserver):iPluginEventObserver (aObserver)
+            {
+            }
+
+// ----------------------------------------------------------------------------
+// CCsMsg::ConstructL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+void CCsMsg::ConstructL()
+    {
+    PRINT ( _L("Enter CCsMsg::ConstructL") );
+    iMsgHandler=CCsMsgHandler::NewL(this);
+    PRINT ( _L("Exit CCsMsg::ConstructL") );
+    }
+// ----------------------------------------------------------------------------
+// CCsMsg::~CCsMsg
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCsMsg::~CCsMsg()
+    {
+    PRINT ( _L("Enter CCsMsg::~CCsMsg") );
+
+    if(iMsgHandler)
+        delete iMsgHandler;
+    iMsgHandler = NULL;
+
+    PRINT ( _L("End CCsMsg::~CCsMsg") );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleReadCompleteL()
+// Sends the CCsConversationEntry array to Conversation Server
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleReadCompleteL( const RPointerArray<CCsConversationEntry>
+*aConversationEntryLists)
+    {
+    iPluginEventObserver->AddConversations( *aConversationEntryLists );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleUpdateCompleteL()
+// Sends the CCsConversationEntry array to Conversation Server
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleUpdateCompleteL( const RPointerArray<CCsConversationEntry>
+*aConversationEntryLists)
+    {
+    iPluginEventObserver->ModifyConversations( *aConversationEntryLists );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleDeleteCompleteL()
+// Sends the CCsConversationEntry array to Conversation Server
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleDeleteCompleteL( const RPointerArray<CCsConversationEntry>
+*aConversationEntryLists)
+    {
+    iPluginEventObserver->DeleteConversations( *aConversationEntryLists );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleCachingCompleted
+// Sends the cache completed status to server
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleCachingCompleted()
+    {
+    iPluginEventObserver->CachingCompleted();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleCachingError
+// Sends the error occured during the caching to server
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleCachingError(const TInt aError)
+    {
+    iPluginEventObserver->CachingError(aError);
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::GetConversationsL()
+// This function starts the state machine to fetch msg data from msvserver
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::GetConversationsL()
+    {
+    PRINT ( _L("Enter CCsMsg::GetConversationsL") );
+    //start handler
+    iMsgHandler->StartL();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsg::HandleRefreshCompleteL
+// Notify server to refresh conversations.
+// -----------------------------------------------------------------------------
+//
+void CCsMsg::HandleRefreshCompleteL()
+    {
+    iPluginEventObserver->RefreshConversations();
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsghandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,806 @@
+/*
+* Copyright (c) 2007 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:  CS Message Handler, This class caches the conversation server
+ *                with the message data and also sends run-time updates to the
+ *                server with the message data
+ *
+*/
+
+
+// USER INCLUDES
+#include "ccsmsghandler.h"
+#include "msgbiouids.h"
+#include "ccsdefs.h"
+
+// SYSTEM INCLUDES
+#include <smsclnt.h>                   
+#include <mmsclient.h>
+#include <mtclreg.h>
+#include <csmsemailfields.h>
+#include <txtrich.h>
+#include <msvids.h>
+#include <e32const.h>
+#include <SendUiConsts.h>
+#include <pushentry.h> // For services messages
+#include <e32cmn.h>
+
+
+//CONSTANTS
+const TInt KMessageArrayGranularity = 50;
+
+// NOTE:- DRAFT ENTRIES ARE NOT HANDLED IN THE PLUGIN
+
+// ============================== MEMBER FUNCTIONS ============================
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::NewL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsMsgHandler* CCsMsgHandler::NewL(MCsMsgObserver *aMsgObserver)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::NewL") );
+
+    CCsMsgHandler* self = new ( ELeave ) CCsMsgHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL(aMsgObserver);
+    CleanupStack::Pop( self );
+
+    PRINT ( _L("End CCsMsgHandler::NewL") );
+
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::~CCsMsgHandler
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCsMsgHandler::~CCsMsgHandler()
+    {
+    PRINT ( _L("Enter CCsMsgHandler::~CCsMsgHandler") );
+    if(iIdle)
+        {
+        iIdle->Cancel();
+        delete iIdle;
+        iIdle=NULL;
+        }
+    if(iMsgPluginUtility)
+        {
+        delete iMsgPluginUtility;
+        iMsgPluginUtility = NULL;
+        }
+
+    if(iConverstationEntryList)
+        {
+        iConverstationEntryList->ResetAndDestroy();
+        iConverstationEntryList->Close();
+        delete iConverstationEntryList;
+        iConverstationEntryList = NULL;
+        }
+
+    if(iSmsMtm)
+        {
+        delete iSmsMtm;
+        iSmsMtm = NULL;
+        }
+
+    if(iMmsMtm)
+        {
+        delete iMmsMtm;
+        iMmsMtm = NULL;
+        }
+
+    if(iMtmRegistry)
+        {
+        delete iMtmRegistry;
+        iMtmRegistry = NULL;
+        }
+
+    if(iSession)
+        {
+        delete iSession;
+        iSession = NULL;
+        }
+
+    if(iMessageArray)
+    {
+        iMessageArray->Reset();
+        iMessageArray->Close();
+        delete iMessageArray;
+        iMessageArray = NULL;
+    }
+
+    PRINT ( _L("End CCsMsgHandler::~CCsMsgHandler") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::ConstructL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+void CCsMsgHandler::ConstructL(MCsMsgObserver *aMsgObserver)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::ConstructL") );
+
+    iMsgObserver = aMsgObserver;
+
+    iSession = CMsvSession::OpenSyncL(*this);
+
+    iMsgPluginUtility = CCsMsgPluginUtility::NewL();
+
+    iConverstationEntryList = new(ELeave) RPointerArray<CCsConversationEntry>(1);
+
+    iMtmRegistry = CClientMtmRegistry::NewL( *iSession );
+
+    iSmsMtm = static_cast<CSmsClientMtm*>( iMtmRegistry->
+            NewMtmL( KSenduiMtmSmsUid ) );
+
+    iMmsMtm = static_cast<CMmsClientMtm*>( iMtmRegistry->
+            NewMtmL( KSenduiMtmMmsUid ) );
+
+    iState = EReadInbox;
+
+    iMessageArray = new (ELeave)RArray <TMsvId>(KMessageArrayGranularity);
+
+    PRINT ( _L("End CCsMsgHandler::ConstructL") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::CCsMsgHandler
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsMsgHandler::CCsMsgHandler()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::ProcessResultsL()
+// ProcessResultsL fetches results for the searchsort query and
+// updates the CCsServer with the fetched data
+// -----------------------------------------------------------------------------
+//
+void CCsMsgHandler::ProcessResultsL(TMsvEntry entry)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::ProcessResultsL"));
+
+    // Cleanup the conversationEntry List initially.
+    // So that the previous entries not cleaned up in
+    // the event of Leave have been clean up.
+    iConverstationEntryList->ResetAndDestroy();
+
+    RPointerArray<HBufC> addressList;
+
+    // Ignore hidden items during upload
+    if ( entry.Visible() == EFalse )
+        {
+        return;
+        }
+    
+    if ( entry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ||
+         entry.Parent() == KMsvSentEntryIdValue ||
+         entry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
+        {
+        CleanupResetAndDestroyPushL(addressList);
+        
+        iMsgPluginUtility->CreateContactL(iSession, entry, addressList);
+
+        //process entry
+        ExtractAddressesL(entry, ERead, addressList);
+        
+        // Cleanup addressList
+        CleanupStack::PopAndDestroy(&addressList);
+        }
+
+    PRINT ( _L("Exit CCsMsgHandler::ProcessResultsL") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::HandleSessionEventL
+// Implemented for MMsvSessionObserver
+// ----------------------------------------------------------------------------
+//
+void CCsMsgHandler::HandleSessionEventL( TMsvSessionEvent aEvent,
+        TAny* aArg1,
+        TAny* aArg2,
+        TAny* /*aArg3*/)
+    {
+    PRINT1 ( _L("Enter CCsMsgHandler::HandleSessionEventL aEvent=%d"),aEvent );
+
+    CMsvEntrySelection* selection=NULL;
+    TMsvId parent;
+
+    //args
+    if(aArg1 == NULL || aArg2 == NULL)
+        {
+        PRINT ( _L("Enter CCsMsgHandler::HandleSessionEventL arguments invalid"));
+        return;
+        }
+
+    //start, processing the event
+    selection= (CMsvEntrySelection*)aArg1;
+    parent = *(TMsvId*)aArg2;
+
+    // Cleanup the conversationEntry List initially.
+    iConverstationEntryList->ResetAndDestroy();
+
+    switch( aEvent )
+        {
+        case EMsvEntriesChanged:
+        case EMsvEntriesMoved:
+            {
+            HandleEventL(selection,parent);
+            }
+            break;
+            
+        case EMsvEntriesDeleted:
+            {
+            if ( parent == KMsvGlobalInBoxIndexEntryIdValue || 
+                 parent == KMsvSentEntryIdValue ||
+                 parent == KMsvGlobalOutBoxIndexEntryIdValue)
+                {
+                for( TInt i=0 ; i < selection->Count() ; i++ )
+                    {
+                    TMsvId id = selection->At( i );
+
+                    //use utility to create conversation entry
+                    CCsConversationEntry *conversationEntry = 
+                    iMsgPluginUtility->CreateConversationEntryL(
+                            NULL,
+                            id,
+                            0,
+                            parent,
+                            NULL,
+                            ECsSendStateUnknown,
+                            ECsAttributeNone,
+                            0);
+                    CleanupStack::PushL(conversationEntry);
+                    iConverstationEntryList->AppendL( conversationEntry );
+                    CleanupStack::Pop(conversationEntry);
+
+                    // call observer interface for each entry
+                    iMsgObserver->HandleDeleteCompleteL(iConverstationEntryList);
+
+                    //cleanup before next iteration
+                    iConverstationEntryList->ResetAndDestroy();
+                    }
+                }
+            }
+            break;
+            
+        case EMsvMediaChanged:
+            iMsgObserver->HandleRefreshCompleteL();
+            break;
+        }
+
+    // Cleanup the conversationEntry List before function exits.
+    iConverstationEntryList->ResetAndDestroy();
+    PRINT ( _L("Exit CCsMsgHandler::HandleSessionEventL") );
+    }
+
+// ---------------------------------------------------------------------
+// CCsMsgHandler::HandleEvent
+// Handle events
+// ---------------------------------------------------------------------
+//
+void CCsMsgHandler::HandleEventL(CMsvEntrySelection* aSelection, TMsvId aParent)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::HandleEvent") );
+    TMsvEntry entry;
+    TMsvId service;
+    TInt error= KErrNone;
+    RPointerArray<HBufC> addressList;
+
+    for( TInt i=0 ; i < aSelection->Count() ; i++ )
+        {
+        error = iSession->GetEntry(aSelection->At(i),service,entry);
+        
+        if ( entry.Visible() == EFalse )
+            {
+            // Do a delete if entry becomes invisible.
+            // e.g) My Nokia registration messages.
+            RPointerArray<CCsConversationEntry>* hiddenEntries =  
+                    new (ELeave) RPointerArray<CCsConversationEntry>();
+            
+            CCsConversationEntry *conversationEntry = 
+                    iMsgPluginUtility->CreateConversationEntryL ( 
+                            NULL,
+                            entry.Id(),
+                            0,
+                            aParent,
+                            NULL,
+                            ECsSendStateUnknown,
+                            ECsAttributeNone,
+                            0 );  
+            CleanupStack::PushL(conversationEntry);
+            hiddenEntries->AppendL( conversationEntry );
+            CleanupStack::Pop(conversationEntry);
+            
+            // Delete at server
+            iMsgObserver->HandleDeleteCompleteL(hiddenEntries);
+            hiddenEntries->ResetAndDestroy();
+            hiddenEntries->Close();
+            delete hiddenEntries;
+            
+            break;
+            }
+        
+        if ( (KErrNone == error) && (IsMtmSupported(entry.iMtm.iUid) ) )
+            {
+            // sent/inbox/Outbox entry
+            if ( aParent == KMsvSentEntryIdValue ||
+                 aParent == KMsvGlobalInBoxIndexEntryIdValue )
+                {
+                CleanupResetAndDestroyPushL(addressList);
+                // currently server needs number, so getting it from header
+                iMsgPluginUtility->CreateContactL(iSession, entry,
+                        addressList);
+
+                //process entry
+                // entry created in sent already exists, hence an update
+                ExtractAddressesL(entry, EUpdate, addressList);
+
+                CleanupStack::PopAndDestroy(&addressList);
+                }  
+                
+            //for drafts and outbox, the entry changes multiple times,
+            // so making a check if entry has changed
+            else if(aParent == KMsvGlobalOutBoxIndexEntryIdValue)
+                {
+                //outbox
+                if(!(iMsgPluginUtility->CompareEntry(iPrevEntry,entry,aParent)))
+                    {
+                    TUint sendState = entry.SendingState();
+                    
+                    // if the entry state is sent, we dont need to process it
+                    // as it is going to appear in sent items
+                    if( ECsSendStateSent != iMsgPluginUtility->GetSendState(entry) )
+                        {
+                         CleanupResetAndDestroyPushL(addressList);
+                        // currently server needs number, so getting it from header
+                        iMsgPluginUtility->CreateContactL(iSession, entry,
+                                addressList);
+                        
+                        //process entry
+                        // entry created in sent already exists, hence an update
+                        ExtractAddressesL(entry, EUpdate, addressList);
+                        
+                        iPrevEntry = entry;
+                        
+                        CleanupStack::PopAndDestroy(&addressList);
+                        }
+                    }//end check changed entry
+                }
+            }
+        }//end for loop
+
+    PRINT ( _L("Exit CCsMsgHandler::HandleEvent") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::CreateAndAddEntryL
+// Creates CCsConversationEntry and adds to the list
+// ----------------------------------------------------------------------------
+//
+void CCsMsgHandler::CreateAndAddEntryL(const TDesC& aContact, 
+        const TDesC& aDescription, 
+        const TMsvEntry& aEntry)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::CreateAndAddEntryL") );
+
+    HBufC* contact = NULL;
+    HBufC* sDescription = NULL;
+
+    if (aContact.Length()>0)
+        {
+        contact = aContact.AllocLC();
+        }
+    if (aDescription.Length()>0)
+        {
+        sDescription = aDescription.AllocLC();
+        }
+
+    //use utility to create conversation entry
+    CCsConversationEntry *conversationEntry = iMsgPluginUtility->CreateConversationEntryL(
+            contact,
+            aEntry.Id(),
+            aEntry.iDate.Int64(),
+            aEntry.Parent(),
+            sDescription,
+            iMsgPluginUtility->GetSendState(aEntry),
+            iMsgPluginUtility->GetMsgAttributes(aEntry),
+            ExtractCsType(aEntry));
+    CleanupStack::PushL(conversationEntry);
+
+    //add to the list
+    iConverstationEntryList->AppendL( conversationEntry );
+    CleanupStack::Pop(conversationEntry);
+
+    // cleanup
+    if (sDescription)
+        {
+        CleanupStack::PopAndDestroy(sDescription);
+        }
+    if (contact)
+        {
+        CleanupStack::PopAndDestroy(contact);
+        }
+
+    PRINT ( _L("Exit CCsMsgHandler::CreateAndAddEntryL") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::ProcessEntryL
+// Creates CCsConversationEntry and adds to the list
+// ----------------------------------------------------------------------------
+//
+void CCsMsgHandler::ProcessEntryL( TEventType aEvent, const TDesC& aContact, 
+        const TDesC& aDescription, const TMsvEntry& aEntry)
+    {
+    PRINT ( _L("Enter CCsMsgHandler::ProcessEntryL") );
+
+    // create and add entry to the list
+    CreateAndAddEntryL(aContact,aDescription,aEntry);
+
+    // call cs observer interface for each entry
+    switch(aEvent)
+        {
+        case ERead:
+            {
+            iMsgObserver->HandleReadCompleteL(iConverstationEntryList);
+            }
+            break;
+        case EUpdate:
+            {
+            iMsgObserver->HandleUpdateCompleteL(iConverstationEntryList);
+            }
+            break;
+        }
+
+    // Cleanup the conversationEntry List, as we are just sending one entry at a time
+    iConverstationEntryList->ResetAndDestroy();
+
+    PRINT ( _L("Exit CCsMsgHandler::ProcessEntryL") );
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::ExtractAddressL
+// Extracts the addresses in the to field and updates them to server
+// ----------------------------------------------------------------------------
+//
+void CCsMsgHandler::ExtractAddressesL( 
+        TMsvEntry aEntry, 
+        TEventType aEvent, 
+        RPointerArray<HBufC>& addressList )
+    {
+    PRINT ( _L("Enter CCsMsgHandler::ExtractAddressesL") );
+
+    // For SMS read the whole body.
+    // For bio type SMS read the iDescription
+    // For other message types read the iDescription
+    // Note: After the LoadMessageL() the iDescription is getting 
+    // deleted so need to make a copy before that.
+    TPtrC description;
+    HBufC* tmpBuffer = NULL;
+
+    if ( (aEntry.iBioType && 
+	      aEntry.iBioType != KUidMsgSubTypeMmsAudioMsg.iUid ) || 
+		  aEntry.iMtm == KSenduiMtmBtUid ) 
+        {
+        tmpBuffer = aEntry.iDescription.AllocLC();
+        description.Set( tmpBuffer->Des() );         
+        }    
+    else if ( aEntry.iMtm == KSenduiMtmSmsUid )  
+        {
+        iSmsMtm->SwitchCurrentEntryL( aEntry.Id() );
+        iSmsMtm->LoadMessageL();
+            
+        CRichText& body = iSmsMtm->Body();
+        TInt smsLength = body.DocumentLength();      
+        tmpBuffer = HBufC::NewLC(smsLength);
+        TPtr ptr(tmpBuffer->Des());
+        body.Extract(ptr, 0);
+        description.Set( tmpBuffer->Des() );  
+        }
+    else if ( aEntry.iMtm == KSenduiMtmMmsUid  || 
+	          aEntry.iMtm == KSenduiMMSNotificationUid)  
+        {
+        tmpBuffer = aEntry.iDescription.AllocLC();
+        description.Set( tmpBuffer->Des() );         
+
+        iMmsMtm->SwitchCurrentEntryL( aEntry.Id() );
+        iMmsMtm->LoadMessageL();
+
+        // Handle addresses
+        if ( aEntry.Parent() == KMsvGlobalInBoxIndexEntryIdValue )
+            {
+            HBufC* address = iMmsMtm->Sender().AllocL();
+            addressList.Append(address);
+            }
+        else if ( aEntry.Parent() == KMsvSentEntryIdValue ||
+                  aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
+            {
+            const CMsvRecipientList& addresses = iMmsMtm->AddresseeList();
+            TInt count = addresses.Count();
+
+            for( TInt i = 0; i < count; i++)
+                {
+                HBufC* address = addresses[i].AllocL();
+                TPtrC pureAddress = iMsgPluginUtility->PureAddress(*address);
+                HBufC* address1 = pureAddress.AllocL();
+                addressList.Append(address1);
+                delete address;
+                }
+            }
+        }
+    else
+        {
+        return;
+        }
+
+    if ( addressList.Count() > 0 )
+        {
+        for ( int i = 0; i < addressList.Count(); i++ )
+            {
+            HBufC* address = addressList[i];
+            ProcessEntryL(aEvent, *address, description, aEntry);
+            }
+        }
+    else
+        {
+        // Unknown
+        ProcessEntryL(aEvent, KNullDesC, description, aEntry);       
+        }
+    
+    //Cleanup tmpBuffer
+    if ( tmpBuffer )
+        {
+		 CleanupStack::PopAndDestroy();
+        }
+
+    PRINT ( _L("Exit CCsMsgHandler::ExtractAddressesL") );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::CompareOrder()
+// Method for determining the sorting behaviour of RArray of TMsvId's  
+// -----------------------------------------------------------------------------
+//
+static TInt CompareOrder(const TMsvId& aFirst, const TMsvId& aSecond)
+    {
+    return aSecond - aFirst;
+    }
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::UploadMsgL()
+// State machine to upload all messages 
+// -----------------------------------------------------------------------------
+//
+TInt CCsMsgHandler::UploadMsgL() 
+    {
+    //Release scheduler for scheduling.    
+    User::After(1);
+    
+    switch ( iState ) 
+        {
+        case EReadInbox:
+            {
+            UpdateMessageArrayL(KMsvGlobalInBoxIndexEntryId);
+            iState = EReadSent;
+            return 1;
+            }
+
+        case EReadSent:
+            {
+            UpdateMessageArrayL(KMsvSentEntryId);
+            iState = EReadOutbox;
+            return 1;
+            }
+
+        case EReadOutbox:
+            {
+            UpdateMessageArrayL(KMsvGlobalOutBoxIndexEntryId);
+            iState = ESortEntries;            
+            return 1;
+            }
+        case ESortEntries:
+            {
+            //Sort the elements in the array by descending order of TMsvId's
+            TLinearOrder<TMsvId> order(CompareOrder);
+            iMessageArray->Sort(order);
+            iState = EProcessEntries;
+            return 1;
+            }            
+        case EProcessEntries:
+            { 
+            //Process one entry at a time in sequence
+            //Process the first element in the array on each call, till the end
+            if(iMessageArray->Count())
+                {
+                CMsvEntry* msvEntry= iSession->
+                        GetEntryL(iMessageArray->operator[](0));
+                CleanupStack::PushL(msvEntry);
+                ProcessResultsL(msvEntry->Entry());
+                CleanupStack::PopAndDestroy(msvEntry);
+                iMessageArray->Remove(0);
+                }
+            else
+                {
+                iMessageArray->Reset();
+                iMsgObserver->HandleCachingCompleted();
+                return 0; //DONE 
+                }            
+            iState = EProcessEntries;
+            return 1; 
+        }
+    }
+    return 0;    
+}
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::UploadMsg()
+// CIdle callback 
+// -----------------------------------------------------------------------------
+//
+TInt CCsMsgHandler::UploadMsg(TAny* aArg)
+    {
+    CCsMsgHandler* handler = (CCsMsgHandler*) aArg; 
+    TInt ok = 0;
+    TRAPD(err, ok = handler->UploadMsgL());
+    return ((err == KErrNone) && ok);
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::StartL()
+// This function starts the state machine to fetch sms data from msvserver
+// -----------------------------------------------------------------------------
+//
+void CCsMsgHandler::StartL()
+    {
+    PRINT ( _L("Enter CCsMsgHandler::Start") );
+
+    iState = EReadInbox;
+    TCallBack callback = TCallBack(UploadMsg, (TAny*) this);
+    
+    if(iIdle)
+        {
+        delete iIdle;
+        iIdle = NULL;
+        }
+    iIdle = CIdle::NewL(CActive::EPriorityIdle);
+    iIdle->Start(callback);
+
+    PRINT ( _L("End CCsMsgHandler::Start") );
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::IsMtmSupported()
+// 
+// -----------------------------------------------------------------------------
+//
+TBool CCsMsgHandler::IsMtmSupported(long uid)	
+    {
+    if ( KSenduiMtmSmsUidValue == uid || \
+         KSenduiMtmBtUidValue == uid || \
+         KSenduiMtmMmsUidValue == uid || \
+         KSenduiMtmBioUidValue == uid  || \
+         KSenduiMMSNotificationUidValue == uid || \
+         KUidMtmWapPush ==  TUid::Uid(uid) )
+        {
+        return ETrue;
+        }	
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CCsMsgHandler::ExtractCsType()
+// Extracts the Message type based on the MTM Uid 
+// -----------------------------------------------------------------------------
+//
+TCsType CCsMsgHandler::ExtractCsType( const TMsvEntry& aEntry)
+    {
+    TCsType type = ECsUnknown;
+    switch(aEntry.iMtm.iUid)
+        {
+        case KSenduiMtmSmsUidValue:            
+            type = ECsSMS;
+            if (aEntry.iBioType == KMsgBioUidVCard.iUid)
+                {
+                type = ECsBioMsg_VCard;
+                }
+            break;
+        case KSenduiMtmBtUidValue:
+            type = ECsBlueTooth;
+            break;
+        case KSenduiMtmMmsUidValue:        
+           if(aEntry.iBioType == KUidMsgSubTypeMmsAudioMsg.iUid)
+                {
+                type = ECsAudio;
+                }
+            else
+                {
+                type = ECsMMS;
+                }
+            break;
+        case KSenduiMMSNotificationUidValue:            
+            type = ECsMmsNotification;
+            break;
+        case KSenduiMtmBioUidValue:
+            { 
+            type = ECsBioMsg; 
+            
+            // based on the biotype uid set message type
+            if(aEntry.iBioType == KMsgBioUidRingingTone.iUid)
+                {
+                type = ECsRingingTone;
+                }
+            else if(aEntry.iBioType == KMsgBioProvisioningMessage.iUid)
+                {
+                type = ECsProvisioning;
+                }
+		    else if (aEntry.iBioType == KMsgBioUidVCard.iUid)
+                {
+                type = ECsBioMsg_VCard;
+                }
+            else if (aEntry.iBioType == KMsgBioUidVCalendar.iUid)
+                {
+                type = ECsBioMsg_VCal;
+       		 }
+       		 else if (aEntry.iBioType == KMsgBioNokiaServiceMessage.iUid) {
+            	type = ECsBioMgs_NokiaService;
+        }
+    }
+        break;
+    default:
+        type = ECsUnknown;
+        break;
+    }
+    return (type);
+}
+// -----------------------------------------------------------------------------
+// void CCsMsgHandler::UpdateMessageArrayL(const TMsvId& aFolderId)
+// Update iMessageArray with the message ID before upload message to csserver. 
+// -----------------------------------------------------------------------------
+//
+void CCsMsgHandler::UpdateMessageArrayL(const TMsvId& aFolderId)
+    {
+    CMsvEntry* msvEntry = iSession->GetEntryL(aFolderId);
+    CleanupStack::PushL(msvEntry);
+    // Set sort order
+    TMsvSelectionOrdering order;
+    order.SetSorting(EMsvSortById);
+    msvEntry->SetSortTypeL(order);
+
+    CMsvEntrySelection* messages = msvEntry->ChildrenL();  
+    // Cleanup msvEntry
+    CleanupStack::PopAndDestroy(msvEntry);
+    CleanupStack::PushL(messages);
+
+    TInt messageCount = messages->Count();
+    
+    // In case of large number of message caching
+    // to avoid multiple reallocation alloc memory
+    // one shot.
+    if( messageCount > KMessageArrayGranularity)
+        iMessageArray->Reserve(messageCount);
+    
+    for(int i = 0; i < messageCount; i ++)
+        {
+        TMsvId msgId=messages->At(i);
+        iMessageArray->Append(msgId);
+        }
+    // Cleanup messages
+    CleanupStack::PopAndDestroy(messages); 
+    }
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/src/ccsmsgpluginutility.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,465 @@
+/*
+* Copyright (c) 2007 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:  CS Msg Plugin Utility class
+ *
+*/
+
+
+// USER INCLUDES
+#include "ccsmsgpluginutility.h"
+#include "ccsdebug.h"
+
+//SYSTEM INCLUDES
+#include <csmsemailfields.h>
+#include <e32cmn.h>
+#include <SendUiConsts.h>
+#include <pushentry.h>
+#include <msvids.h>
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::NewL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+CCsMsgPluginUtility* CCsMsgPluginUtility::NewL( )
+    {
+    CCsMsgPluginUtility* self = new ( ELeave ) CCsMsgPluginUtility();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::~CCsMsgPluginUtility
+// Destructor
+// ----------------------------------------------------------------------------
+CCsMsgPluginUtility::~CCsMsgPluginUtility()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+CCsMsgPluginUtility::CCsMsgPluginUtility()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::CreateConversationEntryL
+// Creates CCsConversationEntry
+// ----------------------------------------------------------------------------
+//
+CCsConversationEntry* CCsMsgPluginUtility::CreateConversationEntryL(
+        const HBufC* aContact,
+        TMsvId aEnryId,
+        TInt64 aTimeStamp,
+        TMsvId aDir,
+        const HBufC* aDescription,
+        TCsSendState aSendState,
+        TCsAttribute aMsgAttribs,
+        TCsType aCsType) const 
+    {
+    // create CCsConversationEntry
+    CCsConversationEntry *conversationEntry = CCsConversationEntry::NewL();
+    CleanupStack::PushL(conversationEntry);
+        
+    //set the values
+    if(aContact)
+        conversationEntry->SetContactL( *aContact );
+    conversationEntry->SetEntryId( aEnryId );
+    conversationEntry->SetTimeStampL( aTimeStamp );
+    if (aDescription) {
+    conversationEntry->SetDescriptionL( *aDescription );
+    }
+    conversationEntry->SetConversationDir( MapDirection( aDir ) );
+    conversationEntry->SetSendState( aSendState );
+    conversationEntry->ChangeAttributes( aMsgAttribs, ECsAttributeNone );
+    conversationEntry->SetType(aCsType);
+        
+    //pop and return
+    CleanupStack::Pop(conversationEntry);
+    return conversationEntry;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::MapDirection
+// Map the msg direction to TCsDirection
+// ----------------------------------------------------------------------------
+//
+TCsDirection CCsMsgPluginUtility::MapDirection( TMsvId aDir ) const
+    {
+    TCsDirection direction = ECsDirectionUnknown;    
+    switch(aDir)
+        {
+        case KMsvSentEntryIdValue:
+        case KMsvGlobalOutBoxIndexEntryIdValue:  // Fall-through
+        case KMsvDraftEntryIdValue:
+            {
+            direction = ECsDirectionOutgoing;
+            break;
+            }
+        case KMsvGlobalInBoxIndexEntryIdValue:
+            {
+            direction = ECsDirectionIncoming;
+            break;
+            }
+        }
+    return direction;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::GetMsgAttributes
+// Returns the message attributes as a bitmask of TCsAttribute values.
+// ----------------------------------------------------------------------------
+//
+TUint16 CCsMsgPluginUtility::GetMsgAttributes( const TMsvEntry& aEntry )
+    {
+    TUint16 msgAttributes = ECsAttributeNone;
+    TMsvId parent = aEntry.Parent();
+
+    // New
+    if( aEntry.New() )
+        {
+        msgAttributes |= ECsAttributeNew;
+        }
+
+    // Drafts
+    if( KMsvDraftEntryIdValue == parent )
+        {
+        msgAttributes |= ECsAttributeDraft;
+        }
+
+    // Attachments
+    if( aEntry.Attachment() )
+        {
+        msgAttributes |= ECsAttributeAttachment;
+        }
+
+    // Priority
+    TMsvPriority priority = aEntry.Priority();
+    if( EMsvHighPriority == priority )
+        {
+        msgAttributes |= ECsAttributeHighPriority;
+        }
+    else if( EMsvLowPriority == priority )
+        {
+        msgAttributes |= ECsAttributeLowPriority;
+        }
+
+    // Read/Unread
+    if( KMsvGlobalInBoxIndexEntryIdValue == parent )
+        {
+        if( EFalse == aEntry.Unread() )
+            {
+            // Read
+            msgAttributes &= ~ECsAttributeUnread;
+            }
+        else
+            {
+            // Unread
+            msgAttributes |= ECsAttributeUnread;
+            }
+        }
+
+    // Sent
+    if( KMsvSentEntryIdValue == parent )
+        {
+        msgAttributes |= ECsAttributeSent;
+        }
+
+    return msgAttributes;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::GetSendState
+// Returns the send status.
+// ----------------------------------------------------------------------------
+//
+TCsSendState CCsMsgPluginUtility::GetSendState( const TMsvEntry& aContext )
+    {
+    TUint sendingState = aContext.SendingState();
+    TCsSendState convSendState = ECsSendStateUnknown;
+
+    switch( sendingState )
+        {
+        case KMsvSendStateUponRequest:
+            {
+            convSendState = ECsSendStateUponRequest;
+            break;
+            }
+        case KMsvSendStateWaiting:
+            {
+            convSendState = ECsSendStateWaiting;
+            break;
+            }
+        case KMsvSendStateSending:
+            {
+            convSendState = ECsSendStateSending;
+            break;
+            }
+        case KMsvSendStateScheduled:
+            {
+            convSendState = ECsSendStateScheduled;
+            break;
+            }
+        case KMsvSendStateResend:
+            {
+            convSendState = ECsSendStateResend;
+            break;
+            }
+        case KMsvSendStateSuspended:
+            {
+            convSendState = ECsSendStateSuspended;
+            break;
+            }
+        case KMsvSendStateFailed:
+            {
+            convSendState = ECsSendStateFailed;
+            break;
+            }
+        case KMsvSendStateSent:
+            {
+            convSendState = ECsSendStateSent;
+            break;
+            }
+        case KMsvSendStateNotApplicable:
+            {
+            convSendState = ECsSendStateNotApplicable;
+            break;
+            }
+        }
+    return convSendState;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::GetContact
+// Get the Contact (From/To) of the message
+// ----------------------------------------------------------------------------
+//
+void CCsMsgPluginUtility::CreateContactL(CMsvSession* aSession,
+					const TMsvEntry& aEntry,
+					RPointerArray<HBufC>& addressList)
+	{
+    if ( aEntry.iMtm.iUid == KSenduiMtmSmsUidValue )      
+        {
+        CPlainText* nullString = CPlainText::NewL();
+        CleanupStack::PushL( nullString );
+    
+        CSmsHeader* smsHeader = NULL;
+        if ( aEntry.Parent() == KMsvGlobalInBoxIndexEntryIdValue ) 
+            {
+            smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *nullString );
+            }
+        else if ( aEntry.Parent() == KMsvSentEntryIdValue || 
+                  aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue )
+            {
+            smsHeader = CSmsHeader::NewL( CSmsPDU::ESmsSubmit, *nullString );
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy(nullString);
+            return;
+            }
+        CleanupStack::PushL( smsHeader );
+    
+        CMsvEntry *cEntry = CMsvEntry::NewL(*aSession,aEntry.Id(),
+            TMsvSelectionOrdering() );
+        CleanupStack::PushL( cEntry );
+    
+        CMsvStore* store = cEntry->ReadStoreL();
+        CleanupStack::PushL(store);
+    
+        TRAPD(err, smsHeader->RestoreL( *store ));    
+        if ( err == KErrNone )
+            {
+            if ( aEntry.Parent() == KMsvGlobalOutBoxIndexEntryIdValue ||
+                 aEntry.Parent() == KMsvSentEntryIdValue )
+                {
+                const CArrayPtrFlat<CSmsNumber>& rcpts = smsHeader->Recipients();
+                const CSmsNumber& rcpt = *rcpts.At(0);
+
+                HBufC* fromAddress = (rcpt.Address()).AllocL();
+                addressList.Append(fromAddress);
+                }
+            else
+                {
+                // Check and add if any email addresses                
+                const CSmsEmailFields& emailFields = smsHeader->EmailFields();
+                if( emailFields.HasAddress() )
+                    {                  
+                    TPtrC name;
+                    TPtrC address;
+
+                    const MDesCArray& emailRecipients = emailFields.Addresses();
+                    for( TInt id = 0; id < emailRecipients.MdcaCount(); id++ )
+                        {
+                        NameAndAddress( emailRecipients.MdcaPoint( id ), name, address);
+                        
+                        // Add address to list
+                        HBufC* addressBuf = HBufC::NewL( address.Length() );
+                        TPtr addressPtr( 0, 0 );
+                        addressPtr.Set( addressBuf->Des() );
+                        addressPtr.Copy( address );
+                        addressList.Append(addressBuf);
+                        }
+                    }
+                else
+                    { 
+                    HBufC* fromAddress = (smsHeader->FromAddress()).AllocL();   
+                    
+                    // Try iDetails if empty
+                    if ( fromAddress->Length() == 0 )
+                        fromAddress = aEntry.iDetails.AllocL();
+                    
+                    addressList.Append(fromAddress);
+                    }
+                }
+            }
+        
+        // Cleanup 
+        CleanupStack::PopAndDestroy(store);
+        CleanupStack::PopAndDestroy(cEntry);
+        CleanupStack::PopAndDestroy(smsHeader);
+        CleanupStack::PopAndDestroy(nullString);
+        }
+    else if ( aEntry.iMtm.iUid == KSenduiMtmBtUidValue  ||  
+			  aEntry.iMtm.iUid == KSenduiMtmBioUidValue ||
+			  aEntry.iMtm == KUidMtmWapPush )
+        {
+        HBufC* fromAddress = aEntry.iDetails.AllocL();
+        addressList.Append(fromAddress);
+        }
+    }
+
+// ---------------------------------------------------------
+// CCsMsgPluginUtility::CompareEntry
+//
+// ---------------------------------------------------------
+TBool CCsMsgPluginUtility::CompareEntry( const TMsvEntry& aOldContext,  
+	const TMsvEntry& aNewContext, TMsvId aDir ) const
+    {
+    if(	(aOldContext.Id() == aNewContext.Id()) 
+        &&   (aOldContext.Parent() == aNewContext.Parent())
+        &&   (0 == aOldContext.iDescription.Compare(aNewContext.iDescription)) )
+    {
+    // incase of outbox, check sending state also
+    if(aDir == KMsvGlobalOutBoxIndexEntryIdValue)
+        {
+        if(aOldContext.SendingState() == aNewContext.SendingState())
+            return ETrue;
+        else
+            return EFalse;
+        }
+    return ETrue;
+    }
+
+    return EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsMsgPluginUtility::NameAndAddress
+// Extracts name and address from the aMsvAddress
+// which is of the form name<address>
+// ----------------------------------------------------------------------------
+void CCsMsgPluginUtility::NameAndAddress( const TPtrC& aMsvAddress, 
+				TPtrC& aName, 
+				TPtrC& aAddress )
+    {
+    // For address information separation (start)
+    const TUint KMsgSmsAddressStartChar         ('<');
+
+    // For address information separation (end)
+    const TUint KMsgSmsAddressEndChar           ('>');
+
+    TInt addressStart = aMsvAddress.LocateReverse( KMsgSmsAddressStartChar );
+    TInt addressEnd = aMsvAddress.LocateReverse( KMsgSmsAddressEndChar );
+
+    if ( addressStart != KErrNotFound && addressEnd != KErrNotFound
+            && addressEnd > addressStart )
+        {
+        // verified address, will be used as selected from contacts manager
+        aName.Set( aMsvAddress.Ptr(), addressStart );
+        aAddress.Set(
+                aMsvAddress.Mid( addressStart + 1 ).Ptr(),
+                ( addressEnd - addressStart ) -1 );
+        if ( !aAddress.Length())
+            {
+            aAddress.Set( aName );
+            aName.Set( KNullDesC ); // empty string
+            }
+        }
+    else
+        {
+        // unverified string, will be used as entered in the header field
+        aName.Set( KNullDesC ); // empty string
+        aAddress.Set( aMsvAddress.Ptr(), aMsvAddress.Length() ); // a whole string to address
+        }
+
+    if ( aName.CompareF( aAddress ) == 0 )
+        {
+        aName.Set( KNullDesC ); // empty string
+        }
+    }
+
+// ---------------------------------------------------------
+// CCsMsgPluginUtility::PureAddress
+// Extract the phone number for MMS
+// ---------------------------------------------------------
+//
+TPtrC CCsMsgPluginUtility::PureAddress( const TDesC& aAddress )
+    {
+    _LIT( KOpen, "<" );
+    _LIT( KClose, ">" );
+	
+    // syntax is :
+    // <alias><separator1><pure_address><separator2> |
+    // <pure_address>
+    TInt firstPos = 0;
+    TInt lastPos = 0;
+    TInt length = aAddress.Length();
+    TInt sepaLen1 = KOpen().Length();
+    TInt sepaLen2 = KClose().Length();
+    TInt firstSeparatorPosition = 0;
+
+    while( firstSeparatorPosition >= 0 )
+        {
+        firstSeparatorPosition = aAddress.Mid( firstPos ).Find( KOpen );
+        if ( firstSeparatorPosition >= 0 )
+            {
+            firstPos += firstSeparatorPosition + sepaLen1;
+            }
+        }
+    if ( firstPos <= 0 )
+        {
+        // No alias
+        return aAddress;
+        }
+
+    // Check if the second separator ends the address
+    TPtrC last = aAddress.Right( sepaLen2 );
+    lastPos = length - sepaLen2;
+
+    if ( !last.Compare( KClose ) )
+        {
+        // Alias part found
+        if ( lastPos > firstPos )
+            {
+            return aAddress.Mid( firstPos, lastPos - firstPos );
+            }
+        }
+    // No alias defined - return the original string as pure address
+    // If syntax is weird, namely 
+    // alias <>
+    // with nothing between the separators, we return the original string as is
+    return aAddress;
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/src/proxy.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 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:  ECOM Plugin proxy details
+ *
+*/
+
+
+// INCLUDES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "ccsmsg.h"
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+        IMPLEMENTATION_PROXY_ENTRY(0x2002A5B7, CCsMsg::NewL )
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/conf/test_plugin.cfg	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,72 @@
+/*
+* ==============================================================================
+*  Name        : test_plugin.cfg
+*  Part of     : plugin / test_plugin
+*  Description : plugin related test cases
+*  Version:    : % version:1 %
+*
+*  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.
+*
+* ============================================================================
+*/
+
+[Test]
+title 1. CreateCcsPluginL
+create test_plugin testplugin
+testplugin CreateCcsPluginL 
+delete testplugin
+[Endtest] 
+
+
+[Test]
+title 2. CreateCCsMsgL
+create test_plugin testplugin
+testplugin CreateCCsMsgL 
+delete testplugin 
+[Endtest]
+
+
+[Test]
+title 3. CacheFromCcsPluginL
+create  test_plugin testplugin
+testplugin CacheFromCcsPluginL
+delete testplugin
+[Endtest] 
+
+[Test]
+title 4. SmsMsgPluginValidationL
+create test_plugin testplugin
+testplugin SmsMsgPluginValidationL 
+delete testplugin 
+[Endtest] 
+
+
+[Test]
+title 5. SendCcsMessageL
+create test_plugin testplugin
+testplugin SendCcsMessageL 
+delete testplugin 
+[Endtest] 
+
+
+[Test]
+title 6. MmsMsgPluginValidationL 
+create test_plugin testplugin
+testplugin MmsMsgPluginValidationL 
+delete testplugin 
+[Endtest] 
+
+[Test]
+title 7. BioMsgPluginValidationL
+create test_plugin testplugin
+testplugin BioMsgPluginValidationL 
+delete testplugin 
+[Endtest]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,36 @@
+/*
+* 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
+*
+*/
+
+#define BLD_INF_GROUP_0496D339
+
+
+prj_platforms
+
+WINSCW GCCE ARMV5 ARMV6
+
+prj_testmmpfiles
+
+test_plugin.mmp
+
+prj_extensions
+
+
+#if defined(WINSCW)
+#else
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,98 @@
+/*TYPE TESTCLASS*//*
+* 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
+*
+*/
+
+
+// To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+
+TARGET          test_plugin.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E4
+
+CAPABILITY      ALL -TCB
+
+//TARGETPATH      ?target_path
+DEFFILE         test_plugin.def
+
+#ifdef SBSV2
+	USERINCLUDE     ../inc 
+
+	#if defined(__S60_)
+	   
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+	USERINCLUDE     ..\inc 
+
+	#if defined(__S60_)
+	    OSEXT_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   \epoc32\include 
+	    SYSTEMINCLUDE   \epoc32\include\internal
+	#endif // __S60_
+
+	SOURCEPATH      ..\src
+#endif // SBSV2
+
+SOURCEPATH        ../src
+SOURCE            test_plugin.cpp
+SOURCE            test_pluginblocks.cpp  
+SOURCE            ..\..\src\proxy.cpp
+SOURCE 		  ..\..\src\ccsmsg.cpp
+SOURCE 		  ..\..\src\ccsmsgpluginutility.cpp
+SOURCE 		  ..\..\src\ccsmsghandler.cpp
+
+USERINCLUDE     ..\inc 
+USERINCLUDE     ..\..\inc
+USERINCLUDE     ..\..\..\..\..\conversationserver\csserver\inc
+USERINCLUDE     ..\..\..\..\..\conversationserver\csutils\inc
+USERINCLUDE     ..\..\..\..\..\..\..\os\buildtools\devlib\devlibhelp\examples\SysLibs\CentRepExample
+USERINCLUDE     ..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC
+USERINCLUDE     ..\..\..\..\..\..\inc  
+USERINCLUDE     ..\..\..\..\utils\inc 
+USERINCLUDE     ..\..\..\..\..\..\..\..\mw\messagingmw\messagingfw\msgtest\testutils\sms\inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY efsrv.lib
+
+
+LIBRARY         eCom.lib
+DEBUGLIBRARY   flogger.lib
+
+LIBRARY         csutils.lib
+// Msg Server
+LIBRARY         Smcm.lib
+LIBRARY         gsmu.lib
+LIBRARY         etext.lib
+LIBRARY         msgs.lib
+LIBRARY         sendas2.lib
+
+LANG            SC
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/group/test_plugin.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,41 @@
+;
+; 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:
+;
+;Header
+#{"TestPlugin"}, (0x101FB3E3), 1, 2, 3, TYPE=SP
+
+;Language - standard language definitions
+&EN
+
+;Vendor ID
+:"Nokia Corporation"
+
+;Localised vendor
+%{"Vendor-EN"}
+
+;Supports Series 60 v 0.9
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
+
+;INI FILE
+"..\init\test_plugin.ini"        			-"c:\Testframework\testframework.ini"
+
+;CFG FILES
+"..\conf\test_plugin.cfg"        			-"c:\Testframework\test_plugin.cfg"
+
+
+"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" 	-"!:\sys\bin\test_plugin.dll"
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/inc/test_plugin.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,244 @@
+/*
+#
+# 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:   Main test class header for CS Message Plugin
+#*/
+
+#ifndef TEST_PLUGIN_H_
+#define TEST_PLUGIN_H_
+
+//  INCLUDES
+#include <badesca.h>
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+// USER INCLUDES
+#include <mcsplugineventobserver.h>
+#include <ccsmsg.h>
+#include <ccsmsghandler.h>
+#include <ccsdefs.h>
+#include <ccsconversationentry.h>
+#include <ccsmsgpluginutility.h>
+#include <smsclnt.h>
+#include <mmsclient.h>
+#include <cmsvmimeheaders.h>
+#include <mmsvattachmentmanager.h>
+#include <CAsyncWaiter.h>
+#include <mtclreg.h>
+#include <biouids.h>
+#include <msgbiouids.h>
+
+
+// Logging path
+_LIT( KTestPluginLogPath, "\\logs\\testframework\\test_plugin\\" ); 
+// Log file
+_LIT( KTestPluginTestLogFile, "test_plugin.txt" ); 
+_LIT( KTestPluginTestLogFileWithTitle, "test_plugin_[%S].txt" );
+
+// FORWARD DECLARATIONS
+class CCsMsg; 
+class CCsMsgHandler;
+class CCsMsgPluginUtility;
+class MCsMsgObserver; 
+class CCsConversationEntry;
+class CCsMsgPluginUtility;
+class CMsvSession;
+class CClientMtmRegistry;
+class CSmsClientMtm;
+class CMmsClientMtm;
+class CMsvMimeHeaders;
+class CAsyncWaiter;
+class CMmsSettings;
+
+/**
+ *  Message plugin class
+ **/
+
+NONSHARABLE_CLASS(Ctest_plugin) : public CScriptBase,public MCsPluginEventObserver,public MMsvSessionObserver
+    {
+    private:
+
+            /**
+            * C++ default constructor.
+            */
+            Ctest_plugin(CTestModuleIf& aTestModuleIf );
+
+            /**
+            * By default Symbian 2nd phase constructor is private.
+            */
+            void ConstructL();
+
+            // Prohibit copy constructor if not deriving from CBase.
+            // ?classname( const ?classname& );
+            // Prohibit assigment operator if not deriving from CBase.
+            // ?classname& operator=( const ?classname& );
+
+            /**
+            * Frees all resources allocated from test methods.
+            * @since ?Series60_version
+            */
+            void Delete();
+
+            /**
+                    * Example test method.
+                    * @since ?Series60_version
+                    * @param aItem Script line containing parameters.
+                    * @return Symbian OS error code.
+                    */
+            virtual TInt ExampleL( CStifItemParser& aItem );            
+
+    public:  // Constructors and destructor
+
+            /**
+             * Two-phased constructor.
+             */
+            static Ctest_plugin* NewL( CTestModuleIf& aTestModuleIf );
+
+			/**
+			 * From CScriptBase Runs a script line.
+			 * @since ?Series60_version
+			 * @param aItem Script line containing method name and parameters
+			 * @return Symbian OS error code
+			 *         */        
+            virtual TInt RunMethodL( CStifItemParser& aItem );
+			/**
+			 * Destructor.
+			 */
+            virtual ~Ctest_plugin();
+            
+    private:    // Data
+            
+        	CCsMsg* iPlugin;
+        
+            /**
+             * MsvServer session object
+             */
+            CMsvSession* iSession;
+
+            /**
+             * Mtm registry object
+             */   
+            CClientMtmRegistry* iMtmRegistry;
+
+            /**
+             * Sms Client mtm object
+             */
+            CSmsClientMtm* iSmsClientMtm;
+            
+            /**
+             * MMS Client mtm object
+             */
+            CMmsClientMtm* iMmsClientMtm;
+         
+           	/**
+            * List contains the CCsConversationEntry objects that needs to be 
+        	* verified with the list obtained from sms plugin
+        	*/    
+        	RPointerArray<CCsConversationEntry> iTestConversationEntryList;
+
+        	/**
+        	* List obtained from sms plugin 
+        	*/    
+        	RPointerArray<CCsConversationEntry> iResultConversationEntryList;
+       
+        	
+    public://Mcsplugineventobserver
+            /**
+             * AddConversations.
+             * Handle Conversation event from Plugins
+             * @param aConversationEntryLists    List of conversation entries.
+             */
+          void AddConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
+
+            /**
+             * ModifyConversations.
+             * Update Conversation event from Plugins
+             * @param aConversationEntryLists    List of conversation entries.
+             */
+          void ModifyConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
+
+            /**
+             * DeleteConversations.
+             * Delete Conversation event from Plugins
+             * @param aConversationEntryLists    List of conversation entries.
+             */
+           void DeleteConversations(const RPointerArray<CCsConversationEntry>& aConversationEntryLists);
+            /**
+             * CachingCompleted.
+             * Caching complete event from Plugins
+             */
+            void CachingCompleted();
+
+            /**
+             * CachingError.
+             * Caching error event from Plugins
+             * @param aError    Caching Error infomation.
+             */
+            void CachingError(const TInt aError) ;
+            
+            /**
+                     * RefreshConversations
+                     * Refresh all data from this plugin.
+                     */
+            void RefreshConversations();
+
+    public://from MmsvSessionObserver
+            /**
+             * Handles the MsvServer updates. Implemented for MMsvSessionObserver
+             */
+            void HandleSessionEventL(TMsvSessionEvent aEvent, TAny *aArg1, TAny *aArg2, TAny *aArg3);        
+    	
+    public: 
+           
+            virtual TInt CreateCCsMsgL( CStifItemParser& aItem );    	
+            virtual TInt SendCcsMessageL( CStifItemParser& /*aItem*/ );
+            virtual TInt CacheFromCcsPluginL( CStifItemParser& /*aItem*/ );
+            virtual TInt CreateCcsPluginL( CStifItemParser& /*aItem*/ );
+            virtual TInt SmsMsgPluginValidationL( CStifItemParser& aItem );
+            virtual TInt MmsMsgPluginValidationL( CStifItemParser& aItem );
+            virtual TInt BioMsgPluginValidationL( CStifItemParser& aItem );
+            
+            TInt Compare(CCsConversationEntry *aResult, CCsConversationEntry *aTest);
+            /** 
+                     * Cleans messages from all foldes
+                     */        
+             void CleanAllFoldersL();
+
+             /** 
+                     * Populates the messages in different folders which are used 
+                     * to verify the caching logic of ccs plugin 
+                     */                
+             void CreateInitialCacheL();
+             
+             /** 
+                      * Cleans messages from the specified folder
+                      * @param aBoxId , folder from where messages has to be deleted
+                      * @param aDeleteOne , if set only one message is deleted
+                      */
+            void CleanMessagesInFolderL(TMsvId aBoxId ,TBool aDeleteOne = EFalse); 
+
+            /** 
+             * Creates messages in the different folders and populates
+             * the iTestConversationEntryList 
+             * @param aFolderId , the folder in which message is to be created
+             * @param aUnReadFlag , Used while creating message in inbox folder
+             */
+            void CreateMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse); 
+            void CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse);
+            void HandleAttachementL(CMsvStore* store,TFileName& sourceFileName );
+            void CreateSmartMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse);
+    };
+
+#endif /* TEST_PLUGIN_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/init/TestFramework.ini	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,44 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\test_plugin.cfg
+[End_Module]
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_plugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,149 @@
+/*
+#
+# 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: Test class for CS Message Plugin
+#
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "test_plugin.h"
+#include <SettingServerClient.h>
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::Ctest_plugin
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+
+Ctest_plugin::Ctest_plugin( CTestModuleIf& aTestModuleIf ) : CScriptBase( aTestModuleIf )
+            {
+            }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_plugin::ConstructL()
+    {
+	 //Read logger settings to check whether test case name is to be
+	    //appended to log file name.
+	   RSettingServer settingServer;  
+	   TInt ret = settingServer.Connect();
+	   if(ret != KErrNone)
+	        {
+	        User::Leave(ret);
+	        }
+	    // Struct to StifLogger settigs.
+	    TLoggerSettings loggerSettings; 
+	    // Parse StifLogger defaults from STIF initialization file.
+	    ret = settingServer.GetLoggerSettings(loggerSettings);
+	    if(ret != KErrNone)
+	        {
+	        User::Leave(ret);
+	        } 
+	    // Close Setting server session
+	    settingServer.Close();
+
+	    TFileName logFileName;
+	    
+	    if(loggerSettings.iAddTestCaseTitle)
+	        {
+	        TName title;
+	        TestModuleIf().GetTestCaseTitleL(title);
+	        logFileName.Format(KTestPluginTestLogFileWithTitle, &title);
+	        }
+	    else
+	        {
+	        logFileName.Copy(KTestPluginTestLogFile);
+	        }
+
+	    iLog = CStifLogger::NewL( KTestPluginLogPath, 
+	                          logFileName,
+	                          CStifLogger::ETxt,
+	                          CStifLogger::EFile,
+	                          EFalse );
+	    
+	    iSession = CMsvSession::OpenSyncL( *this);
+	    iMtmRegistry = CClientMtmRegistry::NewL( *iSession );
+	    iSmsClientMtm = STATIC_CAST( CSmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeSMS ));
+	    
+	    iMmsClientMtm = STATIC_CAST( CMmsClientMtm*, iMtmRegistry->NewMtmL( KUidMsgTypeMultimedia ));
+	    iPlugin = NULL;
+	    
+	    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Ctest_plugin* Ctest_plugin::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+	Ctest_plugin* self = new (ELeave) Ctest_plugin( aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::~Cimcache_test
+// Destructor
+// -----------------------------------------------------------------------------
+//
+Ctest_plugin::~Ctest_plugin()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// ----------------------------------------------------------------------------
+       // Ctest_plugin::HandleSessionEventL
+       // Implemented for MMsvSessionObserver
+       // ----------------------------------------------------------------------------
+       //
+void Ctest_plugin::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
+               TAny */*aArg1*/, 
+               TAny */*aArg2*/, 
+               TAny */*aArg3*/)
+           {
+
+           }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+    return ( CScriptBase* ) Ctest_plugin::NewL( aTestModuleIf );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/msgplugin/tsrc/src/test_pluginblocks.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,985 @@
+/*
+#
+# 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:   Main test class for CS Message Plugin
+#*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <msvsearchsortoperation.h>
+#include <msvsearchsortquery.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include <TXTRICH.H>
+#include <SMUTHDR.H>
+#include <smut.h>
+#include <msvstd.h>
+#include <rsendas.h>
+#include <rsendasmessage.h>
+#include <ecom\ECom.h>
+#include "test_plugin.h"
+#include "CCsPlugin.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::Delete
+//  
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::Delete() 
+    {          
+	iResultConversationEntryList.ResetAndDestroy();
+	iResultConversationEntryList.Close();
+
+	 iTestConversationEntryList.ResetAndDestroy();
+	 iTestConversationEntryList.Close();
+
+	 if( iPlugin )
+		 {
+			 delete iPlugin;
+			 iPlugin = NULL;
+		 }
+	 
+	 if (iSession)
+		 {
+			 delete iSession;
+			 iSession = NULL;
+		 }
+	}
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::RunMethodL
+// 
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::RunMethodL( CStifItemParser& aItem ) 
+    {
+    TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        		
+        ENTRY( "Example", Ctest_plugin::ExampleL ),
+        ENTRY( "CacheFromCcsPluginL", Ctest_plugin::CacheFromCcsPluginL ),
+        ENTRY( "CreateCCsMsgL", Ctest_plugin::CreateCCsMsgL ),		
+        
+        ENTRY( "CreateCcsPluginL", Ctest_plugin::CreateCcsPluginL ),
+        ENTRY( "SendCcsMessageL", Ctest_plugin::SendCcsMessageL ),
+        ENTRY( "SmsMsgPluginValidationL", Ctest_plugin::SmsMsgPluginValidationL),
+        ENTRY( "MmsMsgPluginValidationL",Ctest_plugin::MmsMsgPluginValidationL),
+        ENTRY( "BioMsgPluginValidationL",Ctest_plugin::BioMsgPluginValidationL)
+              
+        };
+
+    const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
+    return RunInternalL( KFunctions, count, aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// Ctestsmsplugin::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::ExampleL( CStifItemParser& aItem )
+    {
+	
+    // Print to UI
+    _LIT( Ktestplugin, "testplugin" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, Ktestplugin, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, Ktestplugin,
+                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateCCsMsgL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::CreateCCsMsgL( CStifItemParser& /*aItem*/ )
+	{
+	
+	// Print to UI
+    _LIT( Ktestplugin, "CreateCCsMsgL" );
+    _LIT( KFunction, "In CreateCCsMsgL" );
+    TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+	// Print to log file
+	iLog->Log( KFunction );
+	iPlugin = CCsMsg::NewL(this);
+	iPlugin->GetConversationsL();
+	
+    return KErrNone;
+ 	 
+	} 
+ 
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CacheFromCcsPluginL
+// Creates the ccs plugin and initiates the caching
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::CacheFromCcsPluginL( CStifItemParser& /*aItem*/ )
+    {
+	// Print to UI
+	_LIT( Ktestplugin, "CacheFromCcsPluginL" );
+	_LIT( KFunction, "In CacheFromCcsPluginL" );
+	TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+		// Print to log file
+	iLog->Log( KFunction );
+
+    iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+    
+    iPlugin = CCsMsg::NewL(this);
+    iPlugin->GetConversationsL();
+     
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateCcsPluginL
+// Creates ccs plugin.
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::CreateCcsPluginL( CStifItemParser& /*aItem*/ )
+    {
+	// Print to UI
+	_LIT( Ktestplugin, "CreateCcsPluginL" );
+	_LIT( KFunction, "In CreateCcsPluginL" );
+	TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+			// Print to log file
+	iLog->Log( KFunction );
+
+    iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+    
+    iPlugin = CCsMsg::NewL(this);
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctestsmsplugin::SendCcsMessageL
+// Send ccs message using RSendAs api
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::SendCcsMessageL( CStifItemParser& /*aItem*/ )
+    {
+	// Print to UI
+	_LIT( Ktestplugin, "SendCcsMessageL" );
+	_LIT( KFunction, "In SendCcsMessageL" );
+	TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+	// Print to log file
+	iLog->Log( KFunction );
+
+    iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+
+    RSendAs sendas;
+    CleanupClosePushL(sendas);
+    TInt res = sendas.Connect();
+    User::LeaveIfError(res);
+    
+    RSendAsMessage message;
+    CleanupClosePushL(message);
+    TRAP(res, message.CreateL(sendas, KUidMsgTypeSMS));
+    User::LeaveIfError(res);
+
+    TBuf<512> MsgText;
+    MsgText.Copy(_L("Message being sent"));
+    message.SetBodyTextL(MsgText);
+    TBuf<15> RecAdd;
+    RecAdd.Copy(_L("123456789"));
+    message.AddRecipientL(RecAdd,RSendAsMessage::ESendAsRecipientTo );
+
+
+    message.SendMessageAndCloseL();
+    CleanupStack::Pop(1); // RMessage
+    CleanupStack::PopAndDestroy(1); // RSendAs
+
+    return KErrNone;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateMmsMessageL
+// Creates messages in the different folders and populates the
+// iTestConversationEntryList
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::CreateMmsMessageL(const TMsvId aFolderId,
+        TBool aUnReadFlag)
+	{
+		
+	// create a new object to access an existing entry
+	CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
+	CleanupStack::PushL(msvEntry);
+	
+	TMsvId defaultServiceId = 0;
+	defaultServiceId = iMmsClientMtm->DefaultServiceL();
+	
+	_LIT( KMMSBody, " Hi !!!");
+	
+	CleanupStack::Pop(msvEntry);
+	iMmsClientMtm->SetCurrentEntryL(msvEntry);
+	iMmsClientMtm->CreateMessageL(defaultServiceId);
+	iMmsClientMtm->SetSubjectL(KMMSBody);
+	
+	// set some mms defaults
+	iMmsClientMtm->SetMessageClass(EMmsClassPersonal);
+	iMmsClientMtm->SetExpiryInterval(86400);
+	iMmsClientMtm->SetDeliveryTimeInterval(3600);
+	iMmsClientMtm->SetMessagePriority(EMmsPriorityLow);
+	iMmsClientMtm->SetSenderVisibility(EMmsMaximumSenderVisibility);
+	iMmsClientMtm->SetDeliveryReport(EMmsDeliveryReportYes);
+	iMmsClientMtm->SetReadReply(EMmsReadReplyYes);        
+	
+	_LIT(KPhoneNumberString,"234567");
+	TBuf<15> phoneNumberString;
+	phoneNumberString.Copy(KPhoneNumberString);
+	_LIT(KPhoneNumberString1,"mine<98450>");
+	_LIT(KResultPhoneNumberString,"98450");
+	
+	if (aFolderId == KMsvGlobalInBoxIndexEntryId)
+		{
+	iMmsClientMtm->SetSenderL(KResultPhoneNumberString);
+		}
+	
+	iMmsClientMtm->AddAddresseeL(KResultPhoneNumberString);
+	
+	CMsvStore* store = msvEntry->EditStoreL();
+	CleanupStack::PushL(store);
+	
+	// set body as an attachment
+	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+	CleanupStack::PushL(mimeHeaders);
+	mimeHeaders->SetContentTypeL( _L8("text") );
+	mimeHeaders->SetContentSubTypeL( _L8("plain") );
+	mimeHeaders->SetMimeCharset( KMmsUtf8 );
+	mimeHeaders->SetSuggestedFilenameL( _L("body.txt") );    
+	         
+	MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred
+	CleanupStack::PushL(attachmentInfo);
+	attachmentInfo->SetAttachmentNameL( _L("body.txt") );
+	attachmentInfo->SetMimeTypeL( _L8("text/plain") );
+	mimeHeaders->StoreL( *attachmentInfo );
+	    
+	RFile textFile;
+
+	CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC();
+	attachMan.CreateAttachmentL(_L("body.txt"), textFile, attachmentInfo, waiter->iStatus );
+	CleanupStack::Pop(); // waiter
+	CleanupStack::Pop(); // attachmentInfo
+	CleanupStack::PushL(waiter);
+	waiter->Start();
+	CleanupStack::PopAndDestroy(waiter);    
+	
+	HBufC8* tempBuf = HBufC8::NewLC( 10 );
+	tempBuf->Des().Copy( KMMSBody );
+	textFile.Write( tempBuf->Des() );        
+	textFile.Close();
+	CleanupStack::PopAndDestroy(); //tempBuf
+	    
+	CleanupStack::PopAndDestroy(); //mimeHeaders
+
+	// get the entry of the message
+	 TMsvEntry messageEntry = iMmsClientMtm->Entry().Entry();        
+	
+	 // set the description field same as the message subject
+	 messageEntry.iDescription.Set( KMMSBody );
+
+	// save the changes done above
+	iMmsClientMtm->Entry().ChangeL(messageEntry); 
+	
+	TFileName attachmentFile( _L("c:\\pictures\\picture123.txt") );	
+	HandleAttachementL(store,attachmentFile );
+	
+	// save the changes made to the message store
+	store->CommitL();
+	CleanupStack::PopAndDestroy(store);   
+	               
+	// save the message      
+	iMmsClientMtm->SaveMessageL();
+	   
+	   // final fine tuning
+	messageEntry.SetAttachment(ETrue);
+	messageEntry.iDate.HomeTime();
+	messageEntry.SetVisible(ETrue);
+	messageEntry.SetInPreparation(EFalse);
+	
+	if( aUnReadFlag )
+      {
+		  messageEntry.SetUnread(ETrue);
+	      messageEntry.SetNew(ETrue);
+	   }
+	  else
+	  {
+		  messageEntry.SetUnread(EFalse);
+		  messageEntry.SetNew(EFalse);
+	  }
+	  messageEntry.SetComplete(ETrue);
+	  messageEntry.iServiceId = defaultServiceId;
+	  messageEntry.iRelatedId = 0;
+	      
+	  if (aFolderId == KMsvDraftEntryId) 
+	          messageEntry.SetReadOnly(EFalse);
+	  else
+	          messageEntry.SetReadOnly(ETrue);
+     
+	  messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated;
+	  	
+	  iMmsClientMtm->Entry().ChangeL(messageEntry);
+	      
+	  }
+
+void Ctest_plugin:: HandleAttachementL(CMsvStore* store,TFileName& sourceFileName )
+	{
+    
+	// attachment settings
+	MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred
+	CleanupStack::PushL(attachmentInfo);
+	attachmentInfo->SetAttachmentNameL( sourceFileName);        
+	attachmentInfo->SetMimeTypeL(_L8("text") );
+
+	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+    CleanupStack::PushL(mimeHeaders);
+    mimeHeaders->SetContentTypeL( _L8("text") );
+    mimeHeaders->SetContentSubTypeL( _L8("plain") );
+    mimeHeaders->SetMimeCharset( KMmsUtf8 );
+    mimeHeaders->StoreL( *attachmentInfo );
+    CleanupStack::PopAndDestroy( mimeHeaders );
+	 
+	CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC();
+	TInt err;
+	TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus ));
+	if (err == KErrNone)
+	{
+		 waiter->Start();
+	     CleanupStack::PopAndDestroy(waiter);
+	     CleanupStack::Pop(); // attachmentInfo, the ownership is transferred
+	 }	
+	 else
+	 {
+		 CleanupStack::PopAndDestroy(waiter);
+	     CleanupStack::PopAndDestroy(); // attachmentInfo, ownership is not transferred (leave occurs)
+	     _LIT( Ktestplugin, "HandleAttachment" );
+	     _LIT( KFunction, "In HandleAttachment::Failed" );
+	 }
+		
+	 }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateSmartMessageL
+// Creates messages in the different folders and populates the
+// iTestConversationEntryList
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::CreateSmartMessageL(const TMsvId aFolderId,TBool aUnReadFlag)
+{
+
+    // create a new object to access an existing entry
+    CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
+    CleanupStack::PushL(msvEntry);
+
+    TMsvId defaultServiceId = 0;
+    defaultServiceId = iSmsClientMtm->DefaultServiceL();
+
+   // mtm takes ownership of entry context	
+    CleanupStack::Pop(msvEntry);
+    iSmsClientMtm->SetCurrentEntryL(msvEntry);    
+    
+    // create a new message
+    iSmsClientMtm->CreateMessageL(defaultServiceId);
+    
+    // Add addressee
+    _LIT(KPhoneNumberString,"234567");
+    TBuf<15> phoneNumberString;
+    phoneNumberString.Copy(KPhoneNumberString);
+
+    _LIT(KPhoneNumberString1,"mine<98450>");
+    _LIT(KResultPhoneNumberString,"98450");
+    
+    // set the from field to sms header
+    if (aFolderId == KMsvGlobalInBoxIndexEntryId)
+    {
+		CSmsHeader& smsHeader = iSmsClientMtm->SmsHeader();
+		smsHeader.SetFromAddressL(KResultPhoneNumberString);
+    }
+    
+    // set body, the BIO message itself
+    iSmsClientMtm->Body().Reset();
+    iSmsClientMtm->Body().InsertL(0, _L("Business Card\nTester Mike\nThe Company Ltd.\nSoftware Engineer\ntel +358 66 1234567\n")); 
+
+    // get the entry of the message
+    TMsvEntry messageEntry = iSmsClientMtm->Entry().Entry();
+
+    // TO-DO: Add support for all BIO messages, currently just insert a business card message ... :
+    // set the message type
+    // parameters.iBIOMessageType ...
+    iSmsClientMtm->BioTypeChangedL(KMsgBioUidVCard);
+    messageEntry.iBioType = KMsgBioUidVCard.iUid;
+    
+    if (aFolderId == KMsvGlobalInBoxIndexEntryId)
+    {
+        iMmsClientMtm->SetSenderL(KResultPhoneNumberString);
+    }
+    
+    _LIT( KBioBody, " Hi !!!");
+ 
+    messageEntry.iDescription.Set(KBioBody);
+    
+    // set correct MTM type
+    messageEntry.iMtm= KUidBIOMessageTypeMtm;
+
+   // save the changes done above
+   iSmsClientMtm->Entry().ChangeL(messageEntry);
+
+    // save the message     
+   iSmsClientMtm->SaveMessageL();
+        	
+   // final fine tuning
+   messageEntry.SetAttachment(EFalse);
+   messageEntry.iDate.HomeTime();
+   messageEntry.SetVisible(ETrue);
+   messageEntry.SetInPreparation(EFalse);
+   
+   if( aUnReadFlag )
+   	{
+   		  messageEntry.SetUnread(ETrue);
+   	      messageEntry.SetNew(ETrue);
+   	 }
+   else
+   	 {
+   		  messageEntry.SetUnread(EFalse);
+   		  messageEntry.SetNew(EFalse);
+   	  }
+
+   messageEntry.SetComplete(ETrue);
+   messageEntry.iServiceId = defaultServiceId;
+   messageEntry.iRelatedId = 0;
+   iSmsClientMtm->Entry().ChangeL(messageEntry);
+  
+
+}
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateMessageL
+// Creates messages in the different folders and populates the
+// iTestConversationEntryList
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::CreateMessageL(const TMsvId aFolderId,
+        TBool aUnReadFlag)
+    {
+    CCsConversationEntry *conversationEntry = CCsConversationEntry::NewL();
+    CleanupStack::PushL(conversationEntry);
+
+    //Create entry from this index entry
+    iSmsClientMtm->SwitchCurrentEntryL( aFolderId );
+    iSmsClientMtm->CreateMessageL(KUidMsgTypeSMS.iUid);
+
+    TMsvEntry indexEntry = iSmsClientMtm->Entry().Entry();
+
+    indexEntry.SetInPreparation(ETrue);
+    indexEntry.iMtm = KUidMsgTypeSMS;
+    indexEntry.iType = KUidMsvMessageEntry;
+    indexEntry.iServiceId = iSmsClientMtm->ServiceId();
+    indexEntry.iDate.HomeTime();
+
+    //AddBody
+    _LIT( KSMSBody, " Hi,Hello Phone Owner !!!");
+    TBuf<160> shortDescription;
+    shortDescription.Append(KSMSBody);
+    CRichText& body = iSmsClientMtm->Body();
+    body.Reset();
+    body.InsertL( 0, KSMSBody );
+    indexEntry.iDescription.Set(KSMSBody);
+
+    // Add addressee
+    _LIT(KPhoneNumberString,"234567");
+    TBuf<15> phoneNumberString;
+    phoneNumberString.Copy(KPhoneNumberString);
+
+    _LIT(KPhoneNumberString1,"mine<98450>");
+    _LIT(KResultPhoneNumberString,"98450");
+
+    if( aFolderId == KMsvDraftEntryId )
+        {
+        iSmsClientMtm->AddAddresseeL(KPhoneNumberString,TPtrC());
+        iSmsClientMtm->AddAddresseeL(KPhoneNumberString1,TPtrC());
+
+        CCsConversationEntry *conversationEntry1 = CCsConversationEntry::NewL();
+        conversationEntry->SetContactL(KPhoneNumberString);
+        conversationEntry->SetEntryId( indexEntry.Id());
+        conversationEntry->SetTimeStampL( indexEntry.iDate.Int64());
+        conversationEntry->SetDescriptionL(shortDescription);
+        conversationEntry->ChangeAttributes(ECsAttributeDraft, ECsAttributeNone);
+        conversationEntry->SetConversationDir(ECsDirectionOutgoing);
+        conversationEntry->SetSendState( ECsSendStateUnknown );
+        conversationEntry->SetType( ECsSMS );
+
+        conversationEntry1->SetContactL(KResultPhoneNumberString);
+        conversationEntry1->SetEntryId( indexEntry.Id());
+        conversationEntry1->SetTimeStampL( indexEntry.iDate.Int64());
+        conversationEntry1->SetDescriptionL(shortDescription);
+        conversationEntry1->ChangeAttributes(ECsAttributeDraft, ECsAttributeNone);
+        conversationEntry1->SetConversationDir(ECsDirectionOutgoing);
+        conversationEntry1->SetSendState( ECsSendStateUnknown );
+        conversationEntry1->SetType( ECsSMS );
+
+        CleanupStack::PushL(conversationEntry1);
+        iTestConversationEntryList.AppendL(conversationEntry);
+        iTestConversationEntryList.AppendL(conversationEntry1);
+        CleanupStack::Pop(conversationEntry1);
+        }
+    else if( aFolderId == KMsvGlobalOutBoxIndexEntryId )
+        {
+        iSmsClientMtm->AddAddresseeL(KPhoneNumberString,TPtrC());
+        indexEntry.SetSendingState( KMsvSendStateWaiting );
+
+        conversationEntry->SetContactL(KPhoneNumberString);
+        conversationEntry->SetEntryId( indexEntry.Id());
+        conversationEntry->SetTimeStampL( indexEntry.iDate.Int64());
+        conversationEntry->SetDescriptionL(shortDescription);
+        conversationEntry->SetConversationDir(ECsDirectionOutgoing);
+        conversationEntry->SetSendState( ECsSendStateWaiting );
+        conversationEntry->SetType( ECsSMS );
+
+        iTestConversationEntryList.AppendL(conversationEntry);
+        }
+    else if( aFolderId == KMsvSentEntryId )
+        {
+        CSmsHeader&  smsHeader = iSmsClientMtm->SmsHeader();
+        smsHeader.SetFromAddressL(KPhoneNumberString);
+        indexEntry.iDetails.Set( KPhoneNumberString );
+
+        conversationEntry->SetContactL(KPhoneNumberString);
+        conversationEntry->SetEntryId( indexEntry.Id());
+        conversationEntry->SetTimeStampL( indexEntry.iDate.Int64());
+        conversationEntry->SetDescriptionL(shortDescription);
+        conversationEntry->SetConversationDir(ECsDirectionOutgoing);
+        conversationEntry->SetSendState( ECsSendStateUnknown );
+        conversationEntry->SetType( ECsSMS );
+
+        iTestConversationEntryList.AppendL(conversationEntry);
+        }
+    // final fine tuning
+    indexEntry.SetAttachment(EFalse);
+
+    indexEntry.SetVisible(ETrue);
+    indexEntry.SetInPreparation(EFalse);
+
+    if ( aFolderId == KMsvGlobalInBoxIndexEntryId )
+        {
+        CSmsHeader&  smsHeader = iSmsClientMtm->SmsHeader();
+        smsHeader.SetFromAddressL(KPhoneNumberString);
+        indexEntry.iDetails.Set( KPhoneNumberString );
+
+        if( aUnReadFlag )
+            {
+            indexEntry.SetUnread(ETrue);
+            conversationEntry->SetSendState( ECsSendStateUnknown );
+            conversationEntry->ChangeAttributes( ECsAttributeUnread, ECsAttributeNone );
+            }
+        else
+            {
+            conversationEntry->SetSendState( ECsSendStateUnknown );
+            conversationEntry->ChangeAttributes( ECsAttributeNone, ECsAttributeUnread );
+            }
+        conversationEntry->SetContactL(KPhoneNumberString);
+        conversationEntry->SetEntryId( indexEntry.Id());
+        conversationEntry->SetTimeStampL( indexEntry.iDate.Int64());
+        conversationEntry->SetDescriptionL(shortDescription);
+        conversationEntry->SetConversationDir(ECsDirectionIncoming);
+        conversationEntry->SetType( ECsSMS );
+
+        iTestConversationEntryList.AppendL(conversationEntry);
+
+        indexEntry.SetNew(ETrue);
+        }
+
+    indexEntry.SetComplete(ETrue);
+    iSmsClientMtm->Entry().ChangeL(indexEntry);
+    iSmsClientMtm->SaveMessageL();
+
+    if ( iTestConversationEntryList.Count() == 0 )
+        {
+    	CleanupStack::PopAndDestroy(conversationEntry);
+        }
+    else
+        {
+        CleanupStack::Pop(conversationEntry);
+        }
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CacheFromCcsPluginValidationL
+// Validates the initial Caching of sms plugin
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::SmsMsgPluginValidationL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT(Ktestplugin, "CacheFromCcsPluginValidationL" );
+    _LIT( KFunction, "In CacheFromCcsPluginValidationL" );
+    TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+    // Print to log file
+    iLog->Log( KFunction );
+
+    CleanAllFoldersL();
+    CreateInitialCacheL();
+
+    iPlugin = CCsMsg::NewL(this);
+    iPlugin->GetConversationsL();
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::MmsPluginValidationL
+// Validates the initial Caching of sms plugin
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT(Ktestplugin, "MmsPluginValidationL" );
+    _LIT( KFunction, "In MmsPluginValidationL" );
+    TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+    // Print to log file
+    iLog->Log( KFunction );
+
+    CleanAllFoldersL();
+   
+    iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+    
+    CreateMmsMessageL(KMsvGlobalInBoxIndexEntryId);
+    CreateMmsMessageL(KMsvSentEntryId);
+    CreateMmsMessageL(KMsvDraftEntryId);
+    CreateMmsMessageL(KMsvGlobalOutBoxIndexEntryId);;
+
+    iPlugin = CCsMsg::NewL(this);
+    iPlugin->GetConversationsL();
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::BioMsgPluginValidationL
+// Validates the initial Caching of sms plugin
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_plugin::BioMsgPluginValidationL( CStifItemParser& /*aItem*/ )
+    {
+    // Print to UI
+    _LIT(Ktestplugin, "BioMsgPluginValidationL" );
+    _LIT( KFunction, "In BioMsgPluginValidationL" );
+    TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+    // Print to log file
+    iLog->Log( KFunction );
+
+    CleanAllFoldersL();
+   
+    iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+    
+    CreateSmartMessageL(KMsvGlobalOutBoxIndexEntryId);
+    CreateSmartMessageL(KMsvSentEntryId);
+    CreateSmartMessageL(KMsvDraftEntryId);
+    CreateSmartMessageL(KMsvGlobalOutBoxIndexEntryId);
+    
+    iPlugin = CCsMsg::NewL(this);
+    iPlugin->GetConversationsL();
+
+    return KErrNone;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CleanAllFoldersL
+// Cleans messages from all folders
+// -----------------------------------------------------------------------------
+void Ctest_plugin::CleanAllFoldersL()
+    {
+    CleanMessagesInFolderL(KMsvGlobalInBoxIndexEntryId);
+    CleanMessagesInFolderL(KMsvGlobalOutBoxIndexEntryId);
+    CleanMessagesInFolderL(KMsvDraftEntryId);
+ // CleanMessagesInFolderL(KMsvSentEntryId);
+    }
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CreateInitialCacheL
+// Populates the messages in different folders which are used
+// to verify the caching logic of ccs plugin
+// -----------------------------------------------------------------------------
+void Ctest_plugin::CreateInitialCacheL()
+    {
+	
+	iTestConversationEntryList.ResetAndDestroy();
+    iResultConversationEntryList.ResetAndDestroy();
+    
+    CreateMessageL(KMsvGlobalInBoxIndexEntryId);
+    CreateMessageL(KMsvSentEntryId);
+    CreateMessageL(KMsvDraftEntryId);
+    CreateMessageL(KMsvGlobalOutBoxIndexEntryId);
+       
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CleanMessagesInFolderL
+// Cleans messages from the specified folder
+// -----------------------------------------------------------------------------
+void Ctest_plugin::CleanMessagesInFolderL(TMsvId aBoxId,TBool aDeleteOne)
+    {
+    iLog->Log(_L("In CleanMessagesInFolderL"));
+    TInt count;
+    CMsvEntry* cEntry = NULL;
+    // delete messages from the specified box
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    // show invisible entries
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeSMS);
+    CleanupStack::PushL(msvEntrySelection);
+
+    if( aDeleteOne )
+        {
+        count =1;
+        }
+    else
+        {
+        count = msvEntrySelection->Count();
+        }
+
+    for ( int i = 0; i < count ; i++ )
+        {
+        CMsvEntry* entry = iSession->GetEntryL( msvEntrySelection->At(i) );
+        CleanupStack::PushL( entry );
+        TMsvEntry tEntry = entry->Entry();
+        tEntry.SetReadOnly(EFalse);
+        entry->ChangeL(tEntry);
+        cEntry->DeleteL( msvEntrySelection->At(i) );
+        CleanupStack::PopAndDestroy( entry );
+        }
+
+    CleanupStack::PopAndDestroy(msvEntrySelection);
+    CleanupStack::PopAndDestroy(cEntry);
+    iLog->Log(_L("End of CleanMessagesInFolderL"));
+    }
+
+
+
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CachingCompleted.
+// Caching error event from Plugins
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::CachingError(const TInt /*aError*/)
+    {
+    Signal(KErrGeneral);
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::CachingCompleted.
+// Caching complete event from Plugins
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::CachingCompleted()
+    {
+    if( iTestConversationEntryList.Count() == 0 )
+        {
+        Signal(KErrNone);
+        return;
+        }
+    if( iResultConversationEntryList.Count() != iTestConversationEntryList.Count() )
+        {
+        // Delete();
+        Signal(KErrCancel);
+        }
+    else
+        {
+        TInt i;
+        for( i=0; i < iResultConversationEntryList.Count() ; i++ )
+            {
+            if( Compare(iResultConversationEntryList[i],iTestConversationEntryList[i] )!=0 )
+                {
+                break;
+                }
+            }
+        if( i == iResultConversationEntryList.Count() )
+            {
+            iTestConversationEntryList.ResetAndDestroy();
+            iResultConversationEntryList.ResetAndDestroy();
+            Signal(KErrNone);
+            }
+        else
+            {
+            Signal(KErrNotFound);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::Compare
+// Compares the conversation entry stored conversation entry with
+// the conversation entry returned from sms plugin
+// -----------------------------------------------------------------------------
+TInt Ctest_plugin::Compare(CCsConversationEntry *aResult, CCsConversationEntry *aTest)
+    {
+    TInt comparison = 0;
+
+    if( aResult->Contact()->Des().Compare(aTest->Contact()->Des()) )
+        comparison++;
+
+    if( aResult->EntryId() != aTest->EntryId() )
+        comparison ++;
+
+    if( aResult->TimeStamp() != aTest->TimeStamp() )
+        comparison++;
+
+    if( aResult->ConversationDir() != aTest->ConversationDir() )
+        comparison++;
+
+    if( aResult->GetSendState() != aTest->GetSendState() )
+        comparison++;
+
+    if( aResult->GetType() != aTest->GetType() )
+        comparison++;
+
+    return comparison;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::AddConversations.
+// Handle Conversation event from Plugins
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::AddConversations(
+        const RPointerArray<CCsConversationEntry>& aConversationEntryLists)
+    {
+    CCsConversationEntry *conversationEntry ;
+   
+    for ( TInt i=0; i < aConversationEntryLists.Count(); i++ )
+        {
+        TRAP_IGNORE(
+                conversationEntry = aConversationEntryLists[i]->CloneL();
+                iResultConversationEntryList.AppendL(conversationEntry);
+        );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::ModifyConversations.
+// Update Conversation event from Plugins
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::ModifyConversations(
+        const RPointerArray<CCsConversationEntry>& aConversationEntryLists)
+    {
+    if( iTestConversationEntryList.Count() == 0 )
+        {
+        Signal(KErrNone);
+        return;
+        }
+    //Expecting update for one entry at a time
+    TInt i;
+    for( i=0; i < aConversationEntryLists.Count() ; i++ )
+        {
+        if( Compare(aConversationEntryLists[i],iTestConversationEntryList[i] )!=0 )
+            {
+            break;
+            }
+        }
+    if( i == aConversationEntryLists.Count() )
+        {
+        iTestConversationEntryList.ResetAndDestroy();
+        iResultConversationEntryList.ResetAndDestroy();
+        Signal(KErrNone);
+        }
+    else
+        {
+        Signal(KErrNotFound);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::DeleteConversations.
+// Delete Conversation event from Plugins
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_plugin::DeleteConversations(
+        const RPointerArray<CCsConversationEntry>& aConversationEntryLists)
+    {
+    if( iTestConversationEntryList.Count() == 0 )
+        {
+        Signal(KErrNone);
+        return;
+        }
+    //Expecting update for one entry at a time
+    TInt i;
+    for( i=0; i < aConversationEntryLists.Count() ; i++ )
+        {
+        if( aConversationEntryLists[i]->EntryId() != iTestConversationEntryList[i]->EntryId() )
+            {
+            break;
+            }
+        }
+    if( i == aConversationEntryLists.Count() )
+        {
+        iTestConversationEntryList.ResetAndDestroy();
+        iResultConversationEntryList.ResetAndDestroy();
+        Signal(KErrNone);
+        }
+    else
+        {
+        Signal(KErrNotFound);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_plugin::RefreshConversations
+// Notify server to refresh conversations.
+// -----------------------------------------------------------------------------
+//
+void Ctest_plugin::RefreshConversations()
+    {
+	
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/plugins.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,24 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+# Build.inf rules
+
+SUBDIRS += msgplugin previewplugin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/group/cspreviewplugin.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006-2007 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:  CS Preview Plugin
+*
+*/
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+CAPABILITY      CAP_ECOM_PLUGIN 
+VENDORID        VID_DEFAULT
+TARGET          cspreviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x20026F49
+
+VERSION 	1.0
+
+PAGED
+
+// RESOURCE
+START RESOURCE ../rss/cspreviewplugin.rss
+TARGET cspreviewplugin.rsc
+END
+
+SOURCEPATH      ../src
+
+SOURCE    proxy.cpp
+SOURCE    ccspreviewplugin.cpp
+SOURCE    ccspreviewpluginhandler.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../server/inc
+USERINCLUDE     ../../../utils/inc
+USERINCLUDE     ../../../../../inc
+USERINCLUDE     ../../../../msgutils/unidatautils/unidatamodel/inc
+APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         eCom.lib
+LIBRARY         csutils.lib
+LIBRARY         efsrv.lib 
+
+DEBUGLIBRARY    flogger.lib
+
+// Msg Server
+LIBRARY         Smcm.lib
+LIBRARY         gsmu.lib
+LIBRARY         etext.lib
+LIBRARY         msgs.lib
+LIBRARY         sqldb.lib 
+LIBRARY         thumbnailmanager.lib
+LIBRARY         fbscli.lib 
+LIBRARY         estor.lib 
+LIBRARY         unidatamodel.lib
+LIBRARY         charconv.lib
+LIBRARY         centralrepository.lib
+LIBRARY         MsgMedia.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewplugin.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2007 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:  Preview Plugin main class
+ *
+*/
+
+
+#ifndef _C_CS_PREVIEW_PLUGIN_H_
+#define _C_CS_PREVIEW_PLUGIN_H_
+
+// INCLUDE FILES
+
+// SYSTEM INCLUDES
+
+// USER INCLUDES
+#include "ccsplugin.h"
+#include "ccsdebug.h"
+#include "ccsdefs.h"
+
+// FORWARD DECLARATION
+class MCsPluginEventObserver;
+class CCsConversationEntry;
+class CCsPreviewPluginHandler;
+
+/**
+ *  Preview plugin class
+ *
+ */
+class CCsPreviewPlugin : public CCsPlugin
+    {
+public: 
+
+    /**
+     * Two phase construction
+     */
+    static CCsPreviewPlugin* NewL( MCsPluginEventObserver* aMCsPluginEventObserver);
+
+    /**
+     * Destructor
+     */
+    virtual ~CCsPreviewPlugin();
+
+
+public: // From base class CCsPlugin
+    /**
+     *  GetConversationsL
+     *  This function starts the state machine to fetch msg data from msvserver
+     */        
+    void GetConversationsL();
+
+public: 
+    
+    /**
+     *  HandleCachingCompleted
+     *  Sends the cache completed status to server
+     */
+    void HandleCachingCompleted();
+
+    /**
+     *  HandleCachingError
+     *  Sends the error occured during the caching to server
+     */
+    void HandleCachingError(const TInt aError);
+    
+private:
+
+    /**
+     * Constructor
+     */
+    CCsPreviewPlugin(MCsPluginEventObserver* aObserver);
+
+    /**
+     * 2nd phase construtor
+     */
+    void ConstructL();
+
+private: //Data
+
+    /**
+     * MMS Preview Handler
+     * Own
+     */
+    CCsPreviewPluginHandler* iPreviewPluginHandler;  
+
+    /**
+     * iPluginEventObserver
+     * Plugin event observer
+     * Not Own.
+     */
+    MCsPluginEventObserver* iPluginEventObserver;
+    };
+
+#endif // _C_CS_PREVIEW_PLUGIN_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/inc/ccspreviewpluginhandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2007 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:  Message Preview Handler
+ *
+ */
+
+#ifndef _C_CS_PREVIEW_PLUGIN_HANDLER_H_
+#define _C_CS_PREVIEW_PLUGIN_HANDLER_H_
+
+//SYSTEM INCLUDES
+#include <msvapi.h>
+#include <f32file.h>
+#include <thumbnailmanager.h>
+#include <thumbnailmanagerobserver.h>
+#include <thumbnaildata.h>
+#include <sqldb.h>
+
+//USER INCLUDES
+#include <ccsdefs.h>
+#include "ccspreviewplugin.h"
+#include "UniDataModel.h"
+
+// FORWARD DECLARATION
+class CCsPlugin;
+class CMsvSession;
+class MCsPluginEventObserver;
+class MMsvSessionObserver;
+class CCsConversationEntry;
+class CCsPreviewPlugin;
+class CClientMtmRegistry;
+class CMmsClientMtm;
+class CUniDataModel;
+class MMsvAttachmentManager;
+
+enum MmsConformanceCheckErrors
+{
+    EInsertSuccess = 0, EInsertQueryAbort, EInsertNotSupported
+};
+
+/*
+ * Thumbnail Request Data
+ */
+struct ThumbnailRequestData
+    {
+    /*
+     * Request Id
+     */
+    TThumbnailRequestId iRequestId;
+
+    /*
+     * Message Id
+     */
+    TMsvId iMsgId;
+    };
+
+/**
+ *  This class interacts with MsvServer to fetch message data
+ */
+class CCsPreviewPluginHandler : public CBase,
+        public MMsvSessionObserver,
+        public MUniDataModelObserver,
+        public MThumbnailManagerObserver
+    {
+
+public:
+
+    /**
+     * Two phase construction
+     */
+    static CCsPreviewPluginHandler* NewL(CCsPreviewPlugin *aMsgObserver);
+
+    /**
+     * Destructor
+     */
+    virtual ~CCsPreviewPluginHandler();
+
+public:
+    //MMsvSessionObserver
+    /**
+     * Handles the MsvServer updates. Implemented for MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+            TAny* aArg2, TAny* aArg3);
+
+public:
+    //MUniDataModelObserver
+    /**
+     */
+    void RestoreReady(TInt aParseResult, TInt aError);
+
+public:
+    // Callbacks from MThumbnailManagerObserver for getting thumbnails
+    void ThumbnailPreviewReady(MThumbnailData& aThumbnail,
+            TThumbnailRequestId aId);
+
+    void ThumbnailReady(TInt aError, MThumbnailData& aThumbnail,
+            TThumbnailRequestId aId);
+
+public:
+
+    /*
+     * Compare by request Id.
+     */
+    static TBool CompareByRequestId(const ThumbnailRequestData& aFirst,
+            const ThumbnailRequestData& aSecond);
+
+private:
+
+    /**
+     * Constructor   
+     */
+    CCsPreviewPluginHandler();
+
+    /**
+     * 2nd phase construtor
+     */
+    void ConstructL(CCsPreviewPlugin *aMsgPlugin);
+
+    /**
+     * Process each entry
+     *@param aSelection, CMsvEntrySelections
+     */
+    void HandleEventL(CMsvEntrySelection* aSelection);
+
+    /**
+     * Bind bodytext to sql statement.
+     *@param sqlStmt, RSqlStatement
+     *@param attachmentId, TMsvAttachmentId
+     */
+    void BindBodyText(RSqlStatement& sqlStmt, TMsvAttachmentId attachmentId);
+
+    /**
+     * Get Thumbnail data from attachment
+     *@param attachmentId, TMsvAttachmentId
+     *@param mimeType, 
+     *@param msgId, message id
+     */
+    void GetThumbNailL(TMsvAttachmentId attachmentId, TDesC8& mimeType,
+            TMsvId msgId);
+
+    /*
+     * Process Thumbnail data
+     * @param aThumbnail MThumbnailData
+     * @param aId TThumbnailRequestId
+     */
+    void HandleThumbnailReadyL(MThumbnailData& aThumbnail,
+            TThumbnailRequestId aId);
+
+    /**
+     * Validates if message can be forwarded
+     * The validation checks include slide count check,MMS size check and
+     * media conformance checks and this fucntion should be called only for mms
+     * @param aUniDataModel, instance of unidatamodel
+     * @return true if message can be forwarded
+     *         false if message cant be forwarded
+     */
+    TBool ValidateMsgForForward(CUniDataModel* aUniDataModel);
+
+    /**
+     * This shall return the particular slide attachments ids
+     * @param aSlideNum slide count
+     * @param aUniDataModel instance of unidatamodel
+     * @return array of attachment id's
+     */
+    RArray<TMsvAttachmentId>* GetSlideAttachmentIds(
+            TInt aSlideNum,
+            CUniDataModel* aUniDataModel);
+
+    /**
+     * This shall return list of attachment id's
+     * @param aUniDataModel instance of unidatamodel
+     * @return array of attachment id's
+     */
+    RArray<TMsvAttachmentId>* GetAttachmentIdList(
+            CUniDataModel* aUniDataModel);
+
+    /**
+     * This shall check the insert mode for the attachment file
+     * @param aFileHandle instance of file handle
+     * @return enum MmsConformanceCheckErrors
+     */
+    TInt CheckModeForInsertL(RFile aFileHandle);
+    
+    /**
+     * Finds the message's processing state
+     * @param aMsgId, message id
+     * @return, TInt from TCsPreviewMsgProcessingState enum
+     */
+    TInt msgProcessingState(TMsvId aMsgId);
+    
+    /**
+     * Sets message under processing to true
+     * @param aMsgId, message id
+     * @param aState, TInt from TCsPreviewMsgProcessingState enum
+     */
+    void setMsgProcessingState(TMsvId aMsgId, TInt aState);
+
+private:
+    //Data
+
+    /**
+     * MsvServer session object
+     * Own
+     */
+    CMsvSession* iSession;
+
+    /**
+     * iMsgObserver
+     * The Observer interface
+     * Not Own.
+     */
+    CCsPreviewPlugin *iMsgObserver;
+
+    /**
+     * Mtm registry object
+     * Own
+     */
+    CClientMtmRegistry* iMtmRegistry;
+
+    /**
+     * Mms client mtm object
+     * Own.
+     */
+    CMmsClientMtm* iMmsMtm;
+
+    /*
+     * File session
+     */
+    RFs ifsSession;
+
+    /*
+     * Thumbnail request array.
+     * Own
+     */
+    RArray<ThumbnailRequestData> iThumbnailRequestArray;
+
+    /*
+     * Thumbnail manager.
+     * Own
+     */
+    CThumbnailManager* iThumbnailManager;
+
+    /*
+     * Sqlite DB Handle
+     */
+    RSqlDatabase iSqlDb;
+
+    /**
+     * Max MMS Size
+    */
+    TInt iMaxMmsSize;
+
+    /*
+     * Mms creation mode
+     */
+    TInt iCreationMode;
+
+    /**
+     * Conformance status
+     */
+    TUint32 iConfStatus;
+
+};
+
+#endif // _C_CS_PREVIEW_PLUGIN_HANDLER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/previewplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,31 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+# Build.inf rules
+
+symbian {
+    BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+    "./rom/cspreviewplugin.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(cspreviewplugin.iby)"
+}
+
+symbian {
+BLD_INF_RULES.prj_mmpfiles = "./group/cspreviewplugin.mmp"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/rom/cspreviewplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,27 @@
+/*
+* 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: 
+*
+*/
+#ifndef __CS_PREVIEW_PLUGIN_IBY__
+#define __CS_PREVIEW_PLUGIN_IBY__
+
+ECOM_PLUGIN(cspreviewplugin.dll, cspreviewplugin.rsc)
+
+// csmsg plugin resource
+data=DATAZ_\RESOURCE_FILES_DIR\plugins\cspreviewplugin.rsc    RESOURCE_FILES_DIR\plugins\cspreviewplugin.rsc
+
+
+#endif // __CS_PREVIEW_PLUGIN_IBY__
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/rss/cspreviewplugin.rss	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 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:  
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+{
+	// UID for the DLL
+	dll_uid = 0x20026F49;
+	
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			
+			// UID of interface that is implemented
+			interface_uid = 0x2002A545;
+			
+			implementations = 
+				{
+				
+				// Info for all implementations					
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x20024329;
+					version_no         = 1;
+					display_name       = "Preview Plugin";
+					default_data       = "CS Plugin";    
+					opaque_data        = ""; 
+					}
+					
+				};
+			}
+		};
+}
+	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2007 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:  Message Preview Plugin main class
+ *
+*/
+
+
+// SYSTEM INCLUDES
+#include <mcsplugineventobserver.h>
+
+// USER INCLUDES
+#include "ccspreviewplugin.h"
+#include "ccspreviewpluginhandler.h"
+
+// ============================== MEMBER FUNCTIONS ============================
+// ----------------------------------------------------------------------------
+// CCsPreviewPlugin::NewL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPlugin* CCsPreviewPlugin::NewL(MCsPluginEventObserver* aObserver)
+    {
+    PRINT ( _L("Enter CCsPreviewPlugin::NewL") );
+
+    CCsPreviewPlugin* self = new ( ELeave ) CCsPreviewPlugin(aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    PRINT ( _L("End CCsPreviewPlugin::NewL") );
+
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CCsPreviewPlugin::CCsPreviewPlugin
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPlugin::CCsPreviewPlugin(MCsPluginEventObserver* aObserver):iPluginEventObserver (aObserver)
+            {
+            }
+
+// ----------------------------------------------------------------------------
+// CCsPreviewPlugin::ConstructL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+void CCsPreviewPlugin::ConstructL()
+    {
+    PRINT ( _L("Enter CCsPreviewPlugin::ConstructL") );
+    iPreviewPluginHandler=CCsPreviewPluginHandler::NewL(this);
+    PRINT ( _L("Exit CCsPreviewPlugin::ConstructL") );
+    }
+// ----------------------------------------------------------------------------
+// CCsPreviewPlugin::~CCsPreviewPlugin
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPlugin::~CCsPreviewPlugin()
+    {
+    PRINT ( _L("Enter CCsPreviewPlugin::~CCsPreviewPlugin") );
+
+    if(iPreviewPluginHandler)
+        delete iPreviewPluginHandler;
+    iPreviewPluginHandler = NULL;
+
+    PRINT ( _L("End CCsPreviewPlugin::~CCsPreviewPlugin") );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPlugin::HandleCachingCompleted
+// Sends the cache completed status to server
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPlugin::HandleCachingCompleted()
+    {
+    iPluginEventObserver->CachingCompleted();
+    }
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPlugin::HandleCachingError
+// Sends the error occured during the caching to server
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPlugin::HandleCachingError(const TInt aError)
+    {
+    iPluginEventObserver->CachingError(aError);
+    }
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPlugin::GetConversationsL()
+// This function starts the state machine to fetch msg data from msvserver
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPlugin::GetConversationsL()
+    {
+    PRINT ( _L("Enter CCsPreviewPlugin::GetConversationsL") );
+    //THE initial caching is yet to be handled
+    HandleCachingCompleted();
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/ccspreviewpluginhandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,898 @@
+/*
+ * Copyright (c) 2007 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:  CS Preview Plugin Handler, This class creates and updates sqlite based db
+ *                with the message-preview data.
+ *
+ */
+// USER INCLUDES
+#include "ccspreviewpluginhandler.h"
+#include "UniObject.h"
+// SYSTEM INCLUDES
+#include <mmsclient.h>
+#include <mtclreg.h>
+#include <msvids.h>
+#include <e32const.h>
+#include <SendUiConsts.h>
+#include <utf.h>
+#include <centralrepository.h>
+#include <MmsConformance.h>
+#include <mmsconst.h>
+#include <msgmediainfo.h>
+#include <MsgMediaResolver.h>
+#include <fileprotectionresolver.h>
+#include <MmsEngineInternalCRKeys.h>
+//CONSTANTS
+//DB-file
+_LIT(KDbFileName, "c:[2002A542]conversations.db");
+//Encoding
+_LIT(KEncodingStmnt,"PRAGMA encoding=\"UTF-8\"");
+//Size
+_LIT(KCacheSizeStmnt,"PRAGMA default_cache_size = 1024");
+// Create table query statement
+_LIT(KSqlCreateStmt, "CREATE TABLE IF NOT EXISTS conversation_messages ( message_id  INTEGER PRIMARY KEY, msg_processingstate INTEGER DEFAULT 0, subject TEXT(100), body_text TEXT(160), preview_path TEXT, msg_property INTEGER, preview_icon BLOB DEFAULT NULL ) " );
+//Create an empty record for the given message id
+_LIT(KSqlBasicInsertStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id ) VALUES( :message_id )");
+//Insert without bitmap query
+_LIT(KSqlInsertStmt, "INSERT OR REPLACE INTO conversation_messages ( message_id, msg_processingstate, subject, body_text, preview_path, msg_property ) VALUES( :message_id, :msg_processingstate, :subject, :body_text, :preview_path,  :msg_property )");
+//update processing-state flag of a message
+_LIT(KSqlUpdateProcessingStateStmt, "UPDATE conversation_messages SET msg_processingstate=:msg_processingstate WHERE message_id=:message_id " );
+//update with bitmap query
+_LIT(KSqlUpdateBitmapStmt, "UPDATE conversation_messages SET preview_icon=:preview_icon WHERE message_id=:message_id " );
+// query to see if msg is under process at the moment
+_LIT(KSelectProcessingStateStmt, " SELECT message_id, msg_processingstate FROM conversation_messages WHERE message_id=:message_id ");
+// Remove record from conversation_messages table.
+_LIT(KRemoveMsgStmnt,"DELETE FROM conversation_messages WHERE message_id=:message_id");
+
+const TInt KDefaultMaxSize = 300 * 1024;
+//Preview thumbnail size
+const TInt KWidth = 9.5 * 6.7;
+const TInt KHeight = 9.5 * 6.7;
+
+// NOTE:- DRAFTS ENTRIES ARE NOT HANDLED IN THE PLUGIN
+
+// ============================== MEMBER FUNCTIONS ============================
+// ----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::NewL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPluginHandler* CCsPreviewPluginHandler::NewL(
+    CCsPreviewPlugin *aMsgObserver)
+{
+    PRINT ( _L("Enter CCsMsgHandler::NewL") );
+
+    CCsPreviewPluginHandler* self = new (ELeave) CCsPreviewPluginHandler();
+    CleanupStack::PushL(self);
+    self->ConstructL(aMsgObserver);
+    CleanupStack::Pop(self);
+
+    PRINT ( _L("End CCsPreviewPluginHandler::NewL") );
+
+    return self;
+}
+
+// ----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::~CCsPreviewPluginHandler
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPluginHandler::~CCsPreviewPluginHandler()
+{
+    PRINT ( _L("Enter CCsPreviewPluginHandler::~CCsPreviewPluginHandler") );
+
+    iSqlDb.Close();
+    iThumbnailRequestArray.Close();
+    ifsSession.Close();
+
+    if (iMmsMtm)
+    {
+        delete iMmsMtm;
+        iMmsMtm = NULL;
+    }
+
+    if (iMtmRegistry)
+    {
+        delete iMtmRegistry;
+        iMtmRegistry = NULL;
+    }
+
+    if (iSession)
+    {
+        delete iSession;
+        iSession = NULL;
+    }
+
+    if (iThumbnailManager)
+    {
+        delete iThumbnailManager;
+        iThumbnailManager = NULL;
+    }
+
+    PRINT ( _L("End CCsPreviewPluginHandler::~CCsPreviewPluginHandler") );
+}
+
+// ----------------------------------------------------------------------------
+// CCsMsgHandler::ConstructL
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::ConstructL(CCsPreviewPlugin *aMsgObserver)
+{
+    PRINT ( _L("Enter CCsPreviewPluginHandler::ConstructL") );
+
+    iMsgObserver = aMsgObserver;
+
+    //file session connect
+    User::LeaveIfError(ifsSession.Connect());
+
+    //create msv session
+    iSession = CMsvSession::OpenSyncL(*this);
+
+    //create mtm registry
+    iMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+
+    //create mms client mtm
+    iMmsMtm = static_cast<CMmsClientMtm*> (iMtmRegistry-> NewMtmL(
+        KSenduiMtmMmsUid));
+
+    //create thumbnail manager
+    iThumbnailManager = CThumbnailManager::NewL(*this);
+
+    // open DB
+    TInt error = iSqlDb.Open(KDbFileName);
+
+    PRINT1 ( _L("End CCsPreviewPluginHandler::ConstructL open DB file error=%d"), error );
+
+    // if not found, create DB
+    if (error == KErrNotFound)
+    {
+        //create sqlite-DB
+        TSecurityPolicy defaultPolicy(TSecurityPolicy::EAlwaysPass);
+        RSqlSecurityPolicy securityPolicy;
+        securityPolicy.Create(defaultPolicy);
+
+        // TODO, setting UID security policy
+        //TSecurityPolicy readPolicy(ECapabilityReadUserData);  
+        //securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, readPolicy);
+
+        iSqlDb.Create(KDbFileName, securityPolicy);
+
+        //Create the table inside DB
+        iSqlDb.Exec(KSqlCreateStmt);
+        iSqlDb.Exec(KEncodingStmnt);
+        iSqlDb.Exec(KCacheSizeStmnt);
+    }
+    else
+    {
+        User::LeaveIfError(error);
+    }
+
+    //get the max size of mms from the repository
+    TRAP_IGNORE(
+            CRepository* repository = CRepository::NewL(KCRUidMmsEngine);
+            CleanupStack::PushL(repository);
+
+            //Fetch and set max mms composition size
+            TInt maxSize = KDefaultMaxSize;
+            repository->Get( KMmsEngineMaximumSendSize, maxSize );
+            iMaxMmsSize = maxSize;
+
+            //Fetch and set creation mode
+            TInt creationMode = EMmsCreationModeRestricted;
+            repository->Get(KMmsEngineCreationMode, creationMode);
+            iCreationMode = creationMode;
+
+            CleanupStack::PopAndDestroy(repository);
+    );
+    PRINT ( _L("End CCsPreviewPluginHandler::ConstructL") );
+}
+
+// ----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::CCsPreviewPluginHandler
+// Two Phase Construction
+// ----------------------------------------------------------------------------
+//
+CCsPreviewPluginHandler::CCsPreviewPluginHandler()
+{
+}
+
+// ----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleSessionEventL
+// Implemented for MMsvSessionObserver
+// ----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleSessionEventL(TMsvSessionEvent aEvent,
+    TAny* aArg1, TAny* aArg2, TAny* /*aArg3*/)
+{
+    PRINT1 ( _L("Enter CCsPreviewPluginHandler::HandleSessionEventL aEvent=%d"),aEvent );
+
+    CMsvEntrySelection* selection = NULL;
+    TMsvId parent;
+
+    //args
+    if (aArg1 == NULL || aArg2 == NULL)
+    {
+        PRINT ( _L("Enter CCsPreviewPluginHandler::HandleSessionEventL arguments invalid"));
+        return;
+    }
+
+    //start, processing the event
+    selection = (CMsvEntrySelection*) aArg1;
+    parent = *(TMsvId*) aArg2;
+
+    //Drafts not handled
+    if (KMsvDraftEntryIdValue == parent)
+    {
+        return;
+    }
+
+    switch (aEvent)
+    {
+        case EMsvEntriesChanged:
+        case EMsvEntriesMoved:
+        {
+            HandleEventL(selection);
+        }
+        break;
+
+        case EMsvEntriesDeleted:
+        {
+            for (TInt i = 0; i < selection->Count(); i++)
+            {
+                RSqlStatement sqlDeleteStmt;
+                CleanupClosePushL(sqlDeleteStmt);
+                sqlDeleteStmt.PrepareL(iSqlDb, KRemoveMsgStmnt);
+
+                TInt messageIdIndex = sqlDeleteStmt.ParameterIndex(_L(
+                    ":message_id"));
+                User::LeaveIfError(sqlDeleteStmt.BindInt(messageIdIndex, selection->At(i)));
+
+                User::LeaveIfError(sqlDeleteStmt.Exec());
+                CleanupStack::PopAndDestroy(&sqlDeleteStmt);
+            }
+        }
+        break;
+    }
+
+    PRINT ( _L("Exit CCsPreviewPluginHandler::HandleSessionEventL") );
+}
+
+// ---------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleEvent
+// Handle events
+// ---------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleEventL(CMsvEntrySelection* aSelection)
+{
+    PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent") );
+
+    TMsvEntry entry;
+    TMsvId service;
+    TInt error = KErrNone;
+
+    for (TInt i = 0; i < aSelection->Count(); i++)
+    {
+        error = iSession->GetEntry(aSelection->At(i), service, entry);
+
+        if ( (KErrNone == error) && !entry.InPreparation() && entry.Visible()
+                && (KSenduiMtmMmsUidValue == entry.iMtm.iUid))
+        {
+            PRINT ( _L("Enter CCsPreviewPluginHandler::HandleEvent for loop started.") );
+
+            TInt msgId = entry.Id();
+
+            // check if the msg is already under processing Or processed
+            if( EPreviewMsgNotProcessed != msgProcessingState(msgId) )
+            {
+                // skip processing this event for the given message
+                continue;
+            }
+            else
+            {
+                // start processing message, set flag
+                setMsgProcessingState(msgId, EPreviewMsgProcessing);
+            }
+
+            // update db with message preview data
+            RSqlStatement sqlInsertStmt;
+            CleanupClosePushL(sqlInsertStmt);
+            sqlInsertStmt.PrepareL(iSqlDb, KSqlInsertStmt);
+            
+            // parse message
+            iMmsMtm->SwitchCurrentEntryL(msgId);
+            iMmsMtm->LoadMessageL();
+
+            CUniDataModel* iUniDataModel = CUniDataModel::NewL(ifsSession,
+                *iMmsMtm);
+            CleanupStack::PushL(iUniDataModel);
+            iUniDataModel->RestoreL(*this, ETrue);
+
+            //msg property
+            TInt msgProperty = 0;
+            if (iUniDataModel->AttachmentList().Count() > 0)
+            {
+                msgProperty |= EPreviewAttachment;
+            }
+
+            //check for msg forward
+            //Validate if the mms msg can be forwarded or not
+            if (ValidateMsgForForward(iUniDataModel))
+            {
+                msgProperty |= EPreviewForward;
+            }
+
+            TPtrC videoPath;
+            TPtrC imagePath;
+           
+            // preview parsing
+            TInt slideCount = iUniDataModel->SmilModel().SlideCount();
+            TBool isBodyTextSet = EFalse;
+            TBool isImageSet = EFalse;
+            TBool isAudioSet = EFalse;
+            TBool isVideoSet = EFalse;
+
+            for (int i = 0; i < slideCount; i++)
+            {
+                int slideobjcount =
+                        iUniDataModel->SmilModel().SlideObjectCount(i);
+                for (int j = 0; j < slideobjcount; j++)
+                {
+                    CUniObject *obj =
+                            iUniDataModel->SmilModel(). GetObjectByIndex(i, j);
+                    CMsgMediaInfo *mediaInfo = obj->MediaInfo();
+
+                    TPtrC8 mimetype = obj->MimeType();
+                    TMsvAttachmentId attachId = obj->AttachmentId();
+
+                    //bodytext
+                    if (!isBodyTextSet && (mimetype.Find(_L8("text"))
+                            != KErrNotFound))
+                    {
+                        //bind bodytext into statement
+                        BindBodyText(sqlInsertStmt, attachId);
+                        isBodyTextSet = ETrue;
+                    }
+
+                    //image parsing
+                    if (!isVideoSet && !isImageSet && (mimetype.Find(_L8("image"))
+                            != KErrNotFound))
+                    {
+                        //get thumbnail for this image
+                        isImageSet = ETrue;
+                        imagePath.Set(mediaInfo->FullFilePath());
+                        msgProperty |= EPreviewImage;
+
+                        if (EFileProtNoProtection != mediaInfo->Protection())
+                        {
+                            msgProperty |= EPreviewProtectedImage;
+                        }
+                        if (mediaInfo->Corrupt())
+                        {
+                            msgProperty |= EPreviewCorruptedImage;
+                        }
+
+                        if (!(EPreviewProtectedImage & msgProperty) &&
+                            !(EPreviewCorruptedImage & msgProperty))
+                        {
+                            //Generate thumbnail for non protected,
+                            //non corrupted image.
+                            GetThumbNailL(attachId, mimetype, msgId);
+                        }
+                    }
+
+                    //audio content
+                    if (!isVideoSet && !isAudioSet && (mimetype.Find(_L8("audio"))
+                            != KErrNotFound))
+                    {
+                        isAudioSet = ETrue;
+                        msgProperty |= EPreviewAudio;
+                        if (EFileProtNoProtection != mediaInfo->Protection())
+                        {
+                            msgProperty |= EPreviewProtectedAudio;
+                        }
+                        if (mediaInfo->Corrupt())
+                        {
+                            msgProperty |= EPreviewCorruptedAudio;
+                        }
+                    }
+
+                    //video content
+                    if (!( isImageSet || isAudioSet) && !isVideoSet && (mimetype.Find(_L8("video"))
+                            != KErrNotFound))
+                    {
+                        videoPath.Set(mediaInfo->FullFilePath());
+                        isVideoSet = ETrue;
+                        msgProperty |= EPreviewVideo;
+                        if (EFileProtNoProtection != mediaInfo->Protection())
+                        {
+                            msgProperty |= EPreviewProtectedVideo;
+                        }
+                        if (mediaInfo->Corrupt())
+                        {
+                            msgProperty |= EPreviewCorruptedVideo;
+                        }
+                    }
+                }
+            }
+
+            //set preview path
+            TInt previewPathIndex = sqlInsertStmt.ParameterIndex(_L(
+                ":preview_path"));
+            if (isVideoSet)
+            {
+                User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
+                    videoPath));
+            }
+            else if (isImageSet)
+            {
+                User::LeaveIfError(sqlInsertStmt.BindText(previewPathIndex,
+                    imagePath));
+            }
+
+            //msg_id
+            TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+            User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+            //subjext
+            TInt subjectIndex = sqlInsertStmt.ParameterIndex(_L(":subject"));
+            User::LeaveIfError(sqlInsertStmt.BindText(subjectIndex,
+                iMmsMtm->SubjectL()));
+
+            //msg_property
+            TInt msgPropertyIndex = sqlInsertStmt.ParameterIndex(_L(
+                ":msg_property"));
+            User::LeaveIfError(sqlInsertStmt.BindInt(msgPropertyIndex,
+                msgProperty));
+
+            //msg_processingstate
+            TInt msgProcessingStateIndex = sqlInsertStmt.ParameterIndex(_L(":msg_processingstate"));
+            User::LeaveIfError(sqlInsertStmt.BindInt(msgProcessingStateIndex, EPreviewMsgProcessed));
+
+            //execute sql stament
+            User::LeaveIfError(sqlInsertStmt.Exec());
+
+            //cleanup
+            CleanupStack::PopAndDestroy(2, &sqlInsertStmt);
+        }
+}//end for loop
+
+PRINT ( _L("Exit CCsPreviewPluginHandler::HandleEvent") );
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::RestoreReady()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::RestoreReady(TInt /*aParseResult*/, TInt /*aError*/)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::ThumbnailReady()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::ThumbnailReady(TInt aError,
+    MThumbnailData& aThumbnail, TThumbnailRequestId aId)
+{
+    // This function must not leave.
+    if (!aError)
+    {
+        PRINT ( _L("CCsPreviewPluginHandler::ThumbnailReady received.") );
+        TInt err;
+        TRAP(err, HandleThumbnailReadyL(aThumbnail, aId));
+        PRINT1 ( _L("CCsPreviewPluginHandler::ThumbnailReady handling error= %d."), err );
+    }
+    else
+    {
+        // An error occurred while getting the thumbnail.
+        PRINT1 ( _L("End CCsPreviewPluginHandler::ThumbnailReady error= %d."), aError );
+    }
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::ThumbnailPreviewReady()
+// callback
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::ThumbnailPreviewReady(
+    MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::HandleThumbnailReadyL()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::HandleThumbnailReadyL(MThumbnailData& aThumbnail,
+    TThumbnailRequestId aId)
+{
+    //match response to request
+    ThumbnailRequestData tempObj;
+    tempObj.iRequestId = aId;
+
+    TInt index = iThumbnailRequestArray.Find(tempObj,
+        CCsPreviewPluginHandler::CompareByRequestId);
+    if (index < 0)
+    {
+        PRINT ( _L("End CCsPreviewPluginHandler::HandleThumbnailReady request match not found.") );
+        return;
+    }
+
+    // get msg-id corresponding to the request-id
+    TInt msgId = iThumbnailRequestArray[index].iMsgId;
+    //remove the request from requestarray
+    iThumbnailRequestArray.Remove(index);
+
+    // get bitmap
+    CFbsBitmap* bitmap = aThumbnail.Bitmap();
+
+    // sql-statment to set preview-icon
+    RSqlStatement sqlInsertStmt;
+    CleanupClosePushL(sqlInsertStmt);
+    sqlInsertStmt.PrepareL(iSqlDb, KSqlUpdateBitmapStmt);
+
+    TInt msgIdIndex = sqlInsertStmt.ParameterIndex(_L(":message_id"));
+    TInt previewIconIndex = sqlInsertStmt.ParameterIndex(_L(":preview_icon"));
+
+    User::LeaveIfError(sqlInsertStmt.BindInt(msgIdIndex, msgId));
+
+    RSqlParamWriteStream previewIconStream;
+    CleanupClosePushL(previewIconStream);
+
+    //bind data
+    User::LeaveIfError(previewIconStream.BindBinary(sqlInsertStmt, previewIconIndex));
+    bitmap->ExternalizeL(previewIconStream);
+    previewIconStream.CommitL();
+
+    //execute the statent
+    User::LeaveIfError(sqlInsertStmt.Exec());
+
+    CleanupStack::PopAndDestroy(2,&sqlInsertStmt);//sqlInsertStmt,previewIconStream
+}
+
+TBool CCsPreviewPluginHandler::ValidateMsgForForward(CUniDataModel* aUniDataModel)
+{
+    TBool retValue = ETrue;
+
+    //1. Check the slide count more than 1
+    if (aUniDataModel->SmilModel().SlideCount() > 1)
+    {
+        retValue = EFalse;
+        return retValue;
+    }
+
+    //2. message sixe check
+    //Fetch and set max mms composition size
+    if (iMmsMtm->MessageSize() > iMaxMmsSize)
+    {
+        retValue = EFalse;
+        return retValue;
+    }
+
+    //3. If there is restricted content then return false
+    RArray<TMsvAttachmentId>* pathList = GetSlideAttachmentIds(
+            0, 
+            aUniDataModel);
+    
+    CleanupStack::PushL(pathList);
+
+    for (int i = 0; i < pathList->Count(); i++)
+    {
+        TMsvAttachmentId aId = (*pathList)[i];
+        CMsvStore * store = iMmsMtm->Entry().ReadStoreL();
+        CleanupStack::PushL(store);
+        MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+        RFile fileHandle = attachMan.GetAttachmentFileL(aId);
+        //close the store
+        CleanupStack::PopAndDestroy(store);
+
+        if (CheckModeForInsertL(fileHandle) != EInsertSuccess)
+        {
+            retValue = EFalse;
+            break;
+        }
+    }
+
+    if (retValue == EFalse)
+    {
+        CleanupStack::PopAndDestroy(pathList);
+        return retValue;
+    }
+
+    CleanupStack::Pop(pathList);
+    delete pathList;
+    pathList = NULL;
+
+    //4. check the same case for all attachments
+    pathList = GetAttachmentIdList(aUniDataModel);
+    CleanupStack::PushL(pathList);
+
+    for (int i = 0; i < pathList->Count(); i++)
+    {
+        TMsvAttachmentId aId = (*pathList)[i];
+        CMsvStore * store = iMmsMtm->Entry().ReadStoreL();
+        CleanupStack::PushL(store);
+        MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+        RFile fileHandle = attachMan.GetAttachmentFileL(aId);
+        //close the store
+        CleanupStack::PopAndDestroy(store);
+        
+        if (CheckModeForInsertL(fileHandle) != EInsertSuccess)
+        {
+            retValue = EFalse;
+            break;
+        }
+    }
+
+    CleanupStack::PopAndDestroy(pathList);
+    return retValue;
+}
+
+RArray<TMsvAttachmentId>*
+CCsPreviewPluginHandler::GetSlideAttachmentIds(TInt aSlideNum,
+                                        CUniDataModel* aUniDataModel)
+{
+    TInt slideObjectCount =
+            aUniDataModel->SmilModel().SlideObjectCount(aSlideNum);
+
+    RArray<TMsvAttachmentId> *attachmentIdList = new (ELeave) RArray<
+            TMsvAttachmentId> ();
+    for (TInt i = 0; i < slideObjectCount; i++)
+    {
+        CUniObject *obj =
+                aUniDataModel->SmilModel().GetObjectByIndex(aSlideNum, i);
+        attachmentIdList->Append(obj->AttachmentId());
+    }
+    return attachmentIdList;
+}
+
+RArray<TMsvAttachmentId>*
+CCsPreviewPluginHandler::GetAttachmentIdList(CUniDataModel* aUniDataModel)
+{
+    TInt attcount = aUniDataModel->AttachmentList().Count();
+    RArray<TMsvAttachmentId> *attachmentIdList = new (ELeave) RArray<
+            TMsvAttachmentId> ();
+
+    for (TInt i = 0; i < attcount; i++)
+    {
+        CUniObject *obj = aUniDataModel->AttachmentList().GetByIndex(i);
+
+        attachmentIdList->AppendL(obj->AttachmentId());
+    }
+    return attachmentIdList;
+}
+
+TInt CCsPreviewPluginHandler::CheckModeForInsertL(RFile aFileHandle)
+{
+    CleanupClosePushL(aFileHandle);
+
+    CMmsConformance* mmsConformance = CMmsConformance::NewL();
+    mmsConformance->CheckCharacterSet(EFalse);
+
+    CleanupStack::PushL(mmsConformance);
+
+    CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL();
+    mediaResolver->SetCharacterSetRecognition(EFalse);
+
+    CleanupStack::PushL(mediaResolver);
+
+    CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(aFileHandle);
+    mediaResolver->ParseInfoDetailsL(info, aFileHandle);
+
+    TMmsConformance conformance = mmsConformance->MediaConformance(*info);
+    iConfStatus = conformance.iConfStatus;
+
+    CleanupStack::PopAndDestroy(3);
+
+    // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
+    if (iCreationMode != EMmsCreationModeRestricted)
+    {
+        TInt i = EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
+                | EMmsConfNokTooBig;
+        TInt j = ~ (EMmsConfNokFreeModeOnly | EMmsConfNokScalingNeeded
+                | EMmsConfNokTooBig);
+
+        // If user answers yes to Guided mode confirmation query he/she moves to free mode
+        if ( (iConfStatus & i) && ! (iConfStatus & j))
+        {
+            if (iCreationMode == EMmsCreationModeFree || info->Protection()
+                    & EFileProtSuperDistributable)
+            {
+                // SuperDistribution not checked here
+                // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
+                iConfStatus &= ~EMmsConfNokFreeModeOnly;
+                iConfStatus &= ~EMmsConfNokScalingNeeded;
+            }
+            else
+            {
+                delete info;
+                //query not accepted. Stop insertion.
+                return EInsertQueryAbort;
+            }
+        }
+    }
+    else if (iConfStatus & EMmsConfNokDRM || iConfStatus
+            & EMmsConfNokNotEnoughInfo || iConfStatus & EMmsConfNokNotSupported
+            || iConfStatus & EMmsConfNokFreeModeOnly || iConfStatus
+            & EMmsConfNokCorrupt)
+    {
+        delete info;
+        return EInsertNotSupported;
+    }
+
+    delete info;
+    return EInsertSuccess;
+}
+
+//-----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::CompareByRequestId
+// Compare to conversation entry object based on Entry Ids
+//----------------------------------------------------------------------------
+TBool CCsPreviewPluginHandler::CompareByRequestId(
+    const ThumbnailRequestData& aFirst, const ThumbnailRequestData& aSecond)
+{
+    if (aFirst.iRequestId == aSecond.iRequestId)
+        return ETrue;
+
+    return EFalse;
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::BindBodyText()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::BindBodyText(RSqlStatement& sqlStmt,
+    TMsvAttachmentId attachmentId)
+{
+    //get file handle from attachmnet manager.
+    CMsvStore * store = iMmsMtm->Entry().ReadStoreL();
+    CleanupStack::PushL(store);
+    MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+    RFile file = attachMan.GetAttachmentFileL(attachmentId);
+    CleanupClosePushL(file);
+
+    //read file contents to buffer
+    TInt length;
+    file.Size(length);
+    HBufC8* bodyText = HBufC8::NewLC(length);
+    TPtr8 textBuffer = bodyText->Des();
+    file.Read(textBuffer);
+
+    // convert from HBufC8 to HBufC16
+    HBufC16 *text16 = HBufC16::NewLC(textBuffer.Length());
+    TPtr16 textPtr16 = text16->Des();
+    CnvUtfConverter::ConvertToUnicodeFromUtf8(textPtr16, textBuffer);
+
+    //set bodytext in the sql statement
+    TInt bodyTextIndex = sqlStmt.ParameterIndex(_L(":body_text"));
+    sqlStmt.BindText(bodyTextIndex, textPtr16);
+
+    CleanupStack::PopAndDestroy(4, store); //store,file, bodyText, text16
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::GetThumbNailL()
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::GetThumbNailL(TMsvAttachmentId attachmentId,
+    TDesC8& mimeType, TMsvId msgId)
+{
+    //Scale the image
+    iThumbnailManager->SetFlagsL(CThumbnailManager::ECropToAspectRatio);
+
+    //TODO replace with hb-param-graphic-size-image-portrait * value of un in pixcels
+    iThumbnailManager->SetThumbnailSizeL(TSize(KWidth, KHeight)); 
+    
+    //optimize for performace
+    iThumbnailManager->SetQualityPreferenceL(
+        CThumbnailManager::EOptimizeForPerformance);
+
+    // Create Thumbnail object source representing a path to a file
+    HBufC* mimeInfo = HBufC::NewLC(mimeType.Length());
+    mimeInfo->Des().Copy(mimeType);
+
+    CMsvStore * store = iMmsMtm->Entry().ReadStoreL();
+    CleanupStack::PushL(store);
+
+    //get file handle from attachment manager.
+    MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+    RFile file = attachMan.GetAttachmentFileL(attachmentId);
+    CleanupClosePushL(file);
+
+    CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(
+        (RFile64&) file, mimeInfo->Des());
+
+    // Issue the request for thumbnail creation
+    ThumbnailRequestData reqObject;
+    reqObject.iMsgId = msgId;
+    reqObject.iRequestId = iThumbnailManager->GetThumbnailL(*source);
+    iThumbnailRequestArray.Append(reqObject);
+
+    CleanupStack::PopAndDestroy(4, mimeInfo);//mimeInfo,store,file,source
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::msgProcessingState
+// 
+// -----------------------------------------------------------------------------
+//
+TInt CCsPreviewPluginHandler::msgProcessingState(TMsvId aMsgId)
+{
+    TInt retState = EPreviewMsgNotProcessed;
+
+    // sql-statement to check if msg's under processing flag is set or not
+    RSqlStatement sqlSelectStmt;
+    CleanupClosePushL(sqlSelectStmt);
+    sqlSelectStmt.PrepareL(iSqlDb,KSelectProcessingStateStmt);
+
+    TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id"));
+    User::LeaveIfError(sqlSelectStmt.BindInt(msgIdIndex, aMsgId));
+
+    // read the flag
+    TInt msgProcessingStateIndex = sqlSelectStmt.ColumnIndex(_L("msg_processingstate"));
+    if (sqlSelectStmt.Next() == KSqlAtRow)
+    {
+         retState = static_cast<TInt>(sqlSelectStmt.ColumnInt(msgProcessingStateIndex));
+    }
+    else
+    {
+        // this is first event for this msgid, hence record doesn't exist
+        // create an empty record, so that we can set & use flags
+        RSqlStatement sqlBasicInsertStmt;
+        CleanupClosePushL(sqlBasicInsertStmt);
+        sqlBasicInsertStmt.PrepareL(iSqlDb, KSqlBasicInsertStmt);
+        TInt index_msgid = sqlBasicInsertStmt.ParameterIndex(_L(":message_id"));
+        User::LeaveIfError(sqlBasicInsertStmt.BindInt(index_msgid, aMsgId));
+        User::LeaveIfError(sqlBasicInsertStmt.Exec());
+        CleanupStack::PopAndDestroy(&sqlBasicInsertStmt);
+    }
+    // cleanup
+    CleanupStack::PopAndDestroy(&sqlSelectStmt);
+    return retState;
+}
+
+// -----------------------------------------------------------------------------
+// CCsPreviewPluginHandler::setMsgProcessingState
+// 
+// -----------------------------------------------------------------------------
+//
+void CCsPreviewPluginHandler::setMsgProcessingState(TMsvId aMsgId, TInt aState)
+{
+    // sql-statment to set/reset msg's under processing flag
+    RSqlStatement sqlUpdateStmt;
+    CleanupClosePushL(sqlUpdateStmt);
+    sqlUpdateStmt.PrepareL(iSqlDb, KSqlUpdateProcessingStateStmt);
+
+    TInt msgIdIndex = sqlUpdateStmt.ParameterIndex(_L(":message_id"));
+    User::LeaveIfError(sqlUpdateStmt.BindInt(msgIdIndex, aMsgId));
+
+    // bind data
+    TInt msgProcessingStateIndex = sqlUpdateStmt.ParameterIndex(_L(":msg_processingstate"));
+    User::LeaveIfError(sqlUpdateStmt.BindInt(msgProcessingStateIndex, aState));
+
+    // execute the statement
+    User::LeaveIfError(sqlUpdateStmt.Exec());
+    // cleanup
+    CleanupStack::PopAndDestroy(&sqlUpdateStmt);
+}
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/src/proxy.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2007 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:  ECOM Plugin proxy details
+ *
+*/
+
+
+// INCLUDES
+#include <e32std.h>
+#include <ecom/implementationproxy.h>
+#include "ccspreviewplugin.h"
+
+// Provides a key value pair table, this is used to identify
+// the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+        IMPLEMENTATION_PROXY_ENTRY(0x20024329, CCsPreviewPlugin::NewL ) //temp Uid
+};
+
+// Function used to return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
+    {
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/.cproject	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?>
+
+<cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+<storageModule buildFromInf="true" buildingTestComps="true" cleanLevel="0" concurrentBuildJobs="4" defaultMMPChangedAction="0" extraSBSv2Args="" infBuildComponents="" infFileLocation="group\bld.inf" macrosFile="" makeEngineToUse="make" manageDependencies="true" moduleId="com.nokia.carbide.cdt.builder.carbideCPPBuilder" overrideMakeEngine="false" overrideWorkspaceSettings="false" promptForMMPChangedAction="true" useConcurrentBuilding="true" useDebugMode="false" useIncrementalBuilder="false" useKeepGoing="false" useMMPMacros="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.settings">
+<cconfiguration id="Emulator Debug (WINSCW) [week20]">
+<storageModule buildSystemId="com.nokia.carbide.cdt.builder.CarbideConfigurationDataProvider" id="Emulator Debug (WINSCW) [week20]" moduleId="org.eclipse.cdt.core.settings" name="Emulator Debug (WINSCW) [week20]">
+<externalSettings/>
+<extensions>
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.cdt.debug.cw.symbian.SymbianE32" point="org.eclipse.cdt.core.BinaryParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.CarbideMakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.SBSv2ErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.RCOMPErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MWCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+<extension id="com.nokia.carbide.cdt.builder.MakeDefErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+</extensions>
+</storageModule>
+<storageModule moduleId="CarbideConfigurationDataProvider">
+<ENV_VAR_DATA_ID/>
+<ARGUMENTS_DATA_ID ABLDFREEZEARGSSTORAGE="-r"/>
+<ROM_BUILDER_DATA_ID ROMBUILDWORKINGDIRECTORYSTORAGE="R:\epoc32\rom\"/>
+</storageModule>
+<storageModule filesCache="R:\epoc32\include\data_caging_paths_strings.hrh;R:\sf\app\messaging\messagingapp\msgappfw\plugins\previewplugin\tsrc\group\bld.inf;R:\epoc32\include\platform_paths.hrh;R:\sf\app\messaging\messagingapp\msgappfw\plugins\previewplugin\tsrc\group\test_pluginpreview.mmp;" includesCache="R:/sf/app/messaging/messagingapp/msgappfw/plugins/previewplugin/tsrc/inc[LOCAL];R:/sf/app/messaging/messagingapp/msgappfw/plugins/previewplugin/inc[LOCAL];R:/sf/app/messaging/messagingapp/msgutils/unidatautils/unidatamodel/inc[LOCAL];R:/sf/app/messaging/messagingappbase/obexmtms/TObexMTM/INC[LOCAL];R:/epoc32/include;R:/epoc32/include/mw;R:/epoc32/include/platform/mw;R:/epoc32/include/platform;R:/epoc32/include/app;R:/epoc32/include/platform/app;R:/epoc32/include/platform/loc;R:/epoc32/include/platform/mw/loc;R:/epoc32/include/platform/app/loc;R:/epoc32/include/platform/loc/sc;R:/epoc32/include/platform/mw/loc/sc;R:/epoc32/include/platform/app/loc/sc;R:/epoc32/include/internal;" macrosCache="__DLL__;_UNICODE;__SYMBIAN32__;__SUPPORT_CPP_EXCEPTIONS__;__CW32__;__WINS__;__WINSCW__;_DEBUG;" moduleId="configDataCache" sourcesCache="" timestampCache="1275040763364" useMmpMacrosCache="true"/>
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+</cconfiguration>
+</storageModule>
+</cproject>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/.project	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>test_pluginpreview</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.nokia.carbide.cdt.builder.carbideCPPBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.cdt.core.cnature</nature>
+		<nature>org.eclipse.cdt.core.ccnature</nature>
+		<nature>com.nokia.carbide.cdt.builder.carbideCPPBuilderNature</nature>
+		<nature>com.nokia.carbide.cdt.builder.carbideSBSv2BuilderNature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/Makefile	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,90 @@
+# ==============================================================================
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Apr 16 15:48:22 2010
+# This file is generated by qmake and should not be modified by the
+# user.
+#  Name        : Makefile
+#  Description : Wrapper Makefile for calling Symbian build tools
+#
+# ==============================================================================
+
+
+MAKEFILE          = Makefile
+QMAKE             = r:\epoc32\tools\qt\qmake.exe
+DEL_FILE          = del
+DEL_DIR           = rmdir
+MOVE              = move
+DEBUG_PLATFORMS   = winscw armv5
+RELEASE_PLATFORMS = armv5
+MAKE              = make
+SBS               = sbs
+
+DEFINES	 = -DSYMBIAN -DUNICODE -DQT_KEYPAD_NAVIGATION -DQT_SOFTKEYS_ENABLED -DQT_USE_MATH_H_FLOATS -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
+INCPATH	 =  -I"R:/epoc32/include/mw/QtCore"  -I"R:/epoc32/include/mw/QtGui"  -I"R:/epoc32/include/mw"  -I"R:/sf/mw/qt/mkspecs/common/symbian"  -I"R:/epoc32/include"  -I"R:/epoc32/include/stdapis"  -I"R:/epoc32/include/stdapis/sys"  -I"R:/epoc32/include/platform/mw"  -I"R:/epoc32/include/platform"  -I"R:/epoc32/include/platform/loc"  -I"R:/epoc32/include/platform/mw/loc"  -I"R:/epoc32/include/platform/loc/sc"  -I"R:/epoc32/include/platform/mw/loc/sc"  -I"R:/epoc32/include/app"  -I"R:/epoc32/include/platform/app"  -I"R:/epoc32/include/platform/app/loc"  -I"R:/epoc32/include/platform/app/loc/sc"  -I"R:/sf/app/messaging/messagingapp/msgappfw/plugin/tsrc"  -I"R:/epoc32/include/stdapis/stlportv5" 
+first: default
+default: debug-winscw
+all: debug release
+
+qmake:
+	$(QMAKE) -spec symbian-sbsv2 -o "bld.inf" "R:/sf/app/messaging/messagingapp/msgappfw/plugin/tsrc/test_plugin.pro"
+
+bld.inf:
+	$(QMAKE)
+
+debug: bld.inf
+	$(SBS) -c winscw_udeb.mwccinc -c armv5_udeb
+release: bld.inf
+	$(SBS) -c armv5_urel
+debug-winscw: bld.inf
+	$(SBS) -c winscw_udeb.mwccinc
+debug-armv5: bld.inf
+	$(SBS) -c armv5_udeb
+release-armv5: bld.inf
+	$(SBS) -c armv5_urel
+
+export: bld.inf
+	$(SBS) export
+
+cleanexport: bld.inf
+	$(SBS) cleanexport
+
+
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+FORCE:
+
+-include .make.cache
+
+sis:
+	$(if $(wildcard test_plugin_template.pkg),$(if $(wildcard .make.cache),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(if $(QT_SIS_TARGET),$(MAKE) -s -f $(MAKEFILE) ok_sis,$(MAKE) -s -f $(MAKEFILE) fail_sis_nocache)),$(MAKE) -s -f $(MAKEFILE) fail_sis_nopkg)
+
+ok_sis:
+	createpackage.bat $(QT_SIS_OPTIONS) test_plugin_template.pkg $(QT_SIS_TARGET) $(QT_SIS_CERTIFICATE) $(QT_SIS_KEY) $(QT_SIS_PASSPHRASE)
+
+fail_sis_nopkg:
+	$(error PKG file does not exist, 'SIS' target is only supported for executables or projects with DEPLOYMENT statement)
+
+fail_sis_nocache:
+	$(error Project has to be built or QT_SIS_TARGET environment variable has to be set before calling 'SIS' target)
+
+dodistclean:
+	-@ if EXIST "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\Makefile" $(DEL_FILE)  "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\Makefile"
+	-@ if EXIST "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\bld.inf" $(DEL_FILE)  "r:\sf\app\messaging\messagingapp\msgappfw\plugin\tsrc\bld.inf"
+
+distclean: clean dodistclean
+
+clean: bld.inf
+	-$(SBS) reallyclean
+
+clean-debug: bld.inf
+	$(SBS) reallyclean -c winscw_udeb -c armv5_udeb
+clean-release: bld.inf
+	$(SBS) reallyclean -c armv5_urel
+clean-debug-winscw: bld.inf
+	$(SBS) reallyclean -c winscw_udeb
+clean-debug-armv5: bld.inf
+	$(SBS) reallyclean -c armv5_udeb
+clean-release-armv5: bld.inf
+	$(SBS) reallyclean -c armv5_urel
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/conf/test_pluginpreview.cfg	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,43 @@
+/*
+* ==============================================================================
+*  Name        : test_pluginpreview.cfg
+*  Part of     : plugin / test_plugin
+*  Description : plugin related test cases
+*  Version:    : % version:1 %
+*
+*  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.
+*
+* ============================================================================
+*/
+
+[Test]
+title 1. CreateCCsPreviewPluginL
+create test_pluginpreview testplugin
+testplugin CreateCCsPreviewPluginL 
+delete testplugin
+[Endtest] 
+
+
+[Test]
+title 2. MmsMsgPluginValidationL
+create test_pluginpreview testplugin
+testplugin MmsMsgPluginValidationL 
+delete testplugin 
+[Endtest]
+
+
+[Test]
+title 3. SendMmsMessageL
+create  test_pluginpreview testplugin
+testplugin SendMmsMessageL
+delete testplugin
+[Endtest] 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,36 @@
+/*
+* 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
+*
+*/
+
+#define BLD_INF_GROUP_0496D339
+
+
+prj_platforms
+
+WINSCW GCCE ARMV5 ARMV6
+
+prj_testmmpfiles
+
+test_pluginpreview.mmp
+
+prj_extensions
+
+
+#if defined(WINSCW)
+#else
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,119 @@
+/*
+* 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
+*
+*/
+
+
+// To get the OSEXT_LAYER_SYSTEMINCLUDE-definition
+#include <platform_paths.hrh>
+#include <data_caging_paths_strings.hrh>
+
+
+TARGET          test_pluginpreview.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3D3
+
+CAPABILITY      ALL -TCB
+
+//TARGETPATH      ?target_path
+DEFFILE         test_plugin.def
+
+#ifdef SBSV2
+	USERINCLUDE     ../inc 
+
+	#if defined(__S60_)
+	   
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   /epoc32/include 
+	    SYSTEMINCLUDE   /epoc32/include/internal
+	#endif // __S60_
+
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+	USERINCLUDE     ..\inc 
+
+	#if defined(__S60_)
+	    OSEXT_LAYER_SYSTEMINCLUDE
+	#else // __S60_ not defined
+	    SYSTEMINCLUDE   \epoc32\include 
+	    SYSTEMINCLUDE   \epoc32\include\internal
+	#endif // __S60_
+
+	SOURCEPATH      ..\src
+#endif // SBSV2
+
+SOURCEPATH        ../src
+SOURCE            test_pluginpreview.cpp
+SOURCE            test_pluginpreviewblocks.cpp  
+SOURCE            ..\..\src\ccspreviewplugin.cpp
+SOURCE 		  ..\..\src\ccspreviewpluginhandler.cpp
+SOURCE 		  ..\..\src\proxy.cpp
+
+USERINCLUDE     ..\inc 
+USERINCLUDE     ..\..\inc
+USERINCLUDE     ..\..\..\..\..\msgutils\unidatautils\unidatamodel\inc
+USERINCLUDE     ..\..\..\..\..\..\messagingappbase\obexmtms\TObexMTM\INC
+
+APP_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         eCom.lib
+LIBRARY         csutils.lib
+LIBRARY         efsrv.lib 
+
+DEBUGLIBRARY    flogger.lib
+
+// Msg Server
+LIBRARY         Smcm.lib
+LIBRARY         gsmu.lib
+LIBRARY         etext.lib
+LIBRARY         msgs.lib
+LIBRARY         sqldb.lib 
+LIBRARY         thumbnailmanager.lib
+LIBRARY         fbscli.lib 
+LIBRARY         estor.lib 
+LIBRARY         unidatamodel.lib
+LIBRARY         charconv.lib
+LIBRARY         sendas2.lib
+
+SYSTEMINCLUDE   \epoc32\include\internal
+
+LIBRARY                         cone.lib 
+LIBRARY                         ecom.lib
+LIBRARY                         bafl.lib
+LIBRARY                         estor.lib 
+LIBRARY                         euser.lib
+LIBRARY                         flogger.lib
+LIBRARY                         stiftestinterface.lib
+LIBRARY                         stiftestengine.lib
+LIBRARY                         imcm.lib
+LIBRARY                         msgs.lib
+LIBRARY                         charconv.lib
+
+// Msg Server
+LIBRARY         Smcm.lib
+LIBRARY         gsmu.lib
+LIBRARY         etext.lib
+LIBRARY         msgs.lib
+LIBRARY         sqldb.lib 
+LIBRARY         thumbnailmanager.lib
+LIBRARY         fbscli.lib 
+LIBRARY         estor.lib 
+LIBRARY         unidatamodel.lib
+LIBRARY         charconv.lib
+LIBRARY         centralrepository.lib
+LIBRARY         MsgMedia.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/group/test_pluginpreview.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,41 @@
+;
+; 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:
+;
+;Header
+#{"Testcache"}, (0x101FB3E3), 1, 2, 3, TYPE=SP
+
+;Language - standard language definitions
+&EN
+
+;Vendor ID
+:"Nokia Corporation"
+
+;Localised vendor
+%{"Vendor-EN"}
+
+;Supports Series 60 v 0.9
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;rom will not allow to update it if name is testframework, after install need to rename it to testframework.ini
+
+;INI FILE
+"..\init\test_plugin.ini"        			-"c:\Testframework\testframework.ini"
+
+;CFG FILES
+"..\conf\test_plugin.cfg"        			-"c:\Testframework\test_plugin.cfg"
+
+
+"\EPOC32\RELEASE\ARMV5\UREL\test_plugin.dll" 	-"!:\sys\bin\test_plugin.dll"
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/inc/test_pluginpreview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,232 @@
+
+/*
+#
+# 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:   Main test class header for CS Preview Plugin
+#*/
+
+#ifndef TEST_PLUGINPREVIEW_H_
+#define TEST_PLUGINPREVIEW_H_
+
+//  INCLUDES
+#include <badesca.h>
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+//  USER INCLUDE
+#include <UniDataModel.h>
+//#include <thumbnailmanagerobserver.h>
+#include <thumbnailmanager.h>
+#include <mcsplugineventobserver.h>
+#include <mmsvattachmentmanager.h>
+#include <CAsyncWaiter.h>
+#include <cmsvmimeheaders.h>
+#include <mmsclient.h>
+#include <mtclreg.h>
+#include <SendUiConsts.h>
+
+
+#include <ccspreviewplugin.h>
+#include <ccspreviewpluginhandler.h>
+
+// Logging path
+_LIT( KTestPluginLogPath, "\\logs\\testframework\\test_pluginpreview\\" ); 
+// Log file
+_LIT( KTestPluginTestLogFile, "test_pluginpreview.txt" ); 
+_LIT( KTestPluginTestLogFileWithTitle, "test_pluginpreview_[%S].txt" );
+
+
+// FORWARD DECLARATION
+class CCsPlugin;
+class CMsvSession;
+class MCsPluginEventObserver;
+class MMsvSessionObserver;
+class CCsConversationEntry;
+class CCsPreviewPlugin;
+class CClientMtmRegistry;
+class CMmsClientMtm;
+class MCsPluginEventObserver;
+class CCsPreviewPluginHandler;
+
+/**
+ *  Message plugin class
+ **/
+
+NONSHARABLE_CLASS(Ctest_pluginpreview) : public CScriptBase,public MMsvSessionObserver,public MThumbnailManagerObserver,public 					 MCsPluginEventObserver,public MUniDataModelObserver
+{
+	
+	private:
+
+		/**
+		* C++ default constructor.
+		*/
+		Ctest_pluginpreview(CTestModuleIf& aTestModuleIf );
+
+		/**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );            
+
+    	public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static Ctest_pluginpreview* NewL( CTestModuleIf& aTestModuleIf );
+
+		/**
+		* From CScriptBase Runs a script line.
+		* @since ?Series60_version
+		* @param aItem Script line containing method name and parameters
+		* @return Symbian OS error code
+		* */        
+
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+		/**
+		* Destructor.
+		*/
+        virtual ~Ctest_pluginpreview();
+            
+    	private:    
+
+        CCsPreviewPlugin* iPlugin;
+        
+        /**
+        * MsvServer session object
+        * Own
+        */
+        CMsvSession* iSession;
+
+        /**
+        * Mtm registry object
+        * Own
+        */
+         CClientMtmRegistry* iMtmRegistry;
+
+         /**
+         * Mms client mtm object
+         * Own.
+         */
+         CMmsClientMtm* iMmsMtm;
+         CThumbnailManager* iThumbnailManager;        	
+    
+        public: 
+    	
+  		  /**
+  		  *  HandleCachingCompleted
+   		  *  Sends the cache completed status to server
+   		  */
+   		 void HandleCachingCompleted();
+
+   		 /**
+    	 *  HandleCachingError
+         *  Sends the error occured during the caching to server
+         */
+   		 void HandleCachingError(const TInt aError);
+
+        public:
+  		  //MMsvSessionObserver
+ 		   /**
+   		  * Handles the MsvServer updates. Implemented for MMsvSessionObserver
+    		  */
+   		 void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+           	  TAny* aArg2, TAny* aArg3);
+
+	public:
+   		 //MUniDataModelObserver
+    		/**
+   		  */
+ 		   void RestoreReady(TInt aParseResult, TInt aError);
+ 		   
+	public://Mcsplugineventobserver
+	         /**
+	         * AddConversations.
+	         * Handle Conversation event from Plugins
+	         * @param aConversationEntryLists    List of conversation entries.
+	         */
+	          void AddConversations(const RPointerArray<CCsConversationEntry>& /*aConversationEntryLists*/){}
+
+	         /**
+	         * ModifyConversations.
+	         * Update Conversation event from Plugins
+	         * @param aConversationEntryLists    List of conversation entries.
+	         */
+	         void ModifyConversations(const RPointerArray<CCsConversationEntry>& /*aConversationEntryLists*/){}
+
+	         /**
+	         * DeleteConversations.
+	         * Delete Conversation event from Plugins
+	         * @param aConversationEntryLists    List of conversation entries.
+	         */
+	          void DeleteConversations(const RPointerArray<CCsConversationEntry>& /*aConversationEntryLists*/){}
+	          /**
+	           * CachingCompleted.
+	           * Caching complete event from Plugins
+	          */
+	          void CachingCompleted(){}
+
+	          /**
+	            * CachingError.
+	            * Caching error event from Plugins
+	            * @param aError    Caching Error infomation.
+	            */
+	            void CachingError(const TInt /*aError*/) {}
+	            
+	            /**
+	             * RefreshConversations
+	             * Refresh all data from this plugin.
+	             */
+	            void RefreshConversations(){}
+	            
+	public:
+  		       // Callbacks from MThumbnailManagerObserver for getting thumbnails
+  		      void ThumbnailPreviewReady(MThumbnailData& aThumbnail,
+       		     TThumbnailRequestId aId);
+
+    		  void ThumbnailReady(TInt aError, MThumbnailData& aThumbnail,
+           	     TThumbnailRequestId aId);
+    public: 
+           
+               virtual TInt CreateCCsPreviewPluginL( CStifItemParser& /*aItem*/ );    
+		       virtual TInt MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ );
+               virtual TInt SendMmsMessageL( CStifItemParser& /*aItem*/ );
+ 
+               void CleanAllFoldersL(); 
+               void CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag = EFalse);
+		       void HandleAttachementL(CMsvStore* store,TFileName& sourceFileName );
+		       void CleanMessagesInFolderL(TMsvId aBoxId ,TBool aDeleteOne = EFalse); 
+		       // void CreateInitialCacheL();
+    };
+
+#endif /* test_pluginpreview_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/init/TestFramework.ini	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,44 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= C:\testframework\test_pluginpreview.cfg
+[End_Module]
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+[Logger_Defaults]
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,155 @@
+/*
+#
+# 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: Test class for CS Preview Plugin
+#
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "test_pluginpreview.h"
+#include <SettingServerClient.h>
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::Ctest_pluginpreview
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+
+Ctest_pluginpreview::Ctest_pluginpreview( CTestModuleIf& aTestModuleIf ) : CScriptBase( aTestModuleIf )
+            {
+            }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_pluginpreview::ConstructL()
+    {
+	 //Read logger settings to check whether test case name is to be
+	    //appended to log file name.
+	   RSettingServer settingServer;  
+	   TInt ret = settingServer.Connect();
+	   if(ret != KErrNone)
+	        {
+	        User::Leave(ret);
+	        }
+	    // Struct to StifLogger settigs.
+	    TLoggerSettings loggerSettings; 
+	    // Parse StifLogger defaults from STIF initialization file.
+	    ret = settingServer.GetLoggerSettings(loggerSettings);
+	    if(ret != KErrNone)
+	        {
+	        User::Leave(ret);
+	        } 
+	    // Close Setting server session
+	    settingServer.Close();
+
+	    TFileName logFileName;
+	    
+	    if(loggerSettings.iAddTestCaseTitle)
+	        {
+	        TName title;
+	        TestModuleIf().GetTestCaseTitleL(title);
+	        logFileName.Format(KTestPluginTestLogFileWithTitle, &title);
+	        }
+	    else
+	        {
+	        logFileName.Copy(KTestPluginTestLogFile);
+	        }
+
+	    iLog = CStifLogger::NewL( KTestPluginLogPath, 
+	                          logFileName,
+	                          CStifLogger::ETxt,
+	                          CStifLogger::EFile,
+	                          EFalse );
+	    
+	     //create msv session
+   	       iSession = CMsvSession::OpenSyncL(*this);
+	    
+	    //create mtm registry
+    iMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+
+           //create mms client mtm
+            iMmsMtm = static_cast<CMmsClientMtm*> (iMtmRegistry-> NewMtmL(KSenduiMtmMmsUid));
+ 
+          //create thumbnail manager
+          // iThumbnailManager = CThumbnailManager::NewL(*this);
+
+      
+	    TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles );  
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+Ctest_pluginpreview* Ctest_pluginpreview::NewL( CTestModuleIf& aTestModuleIf )
+    {
+	Ctest_pluginpreview* self = new ( ELeave ) Ctest_pluginpreview( aTestModuleIf );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::~Ctest_pluginpreview
+// Destructor
+// -----------------------------------------------------------------------------
+//
+Ctest_pluginpreview::~Ctest_pluginpreview()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+// ----------------------------------------------------------------------------
+       // Ctest_pluginpreview::HandleSessionEventL
+       // Implemented for MMsvSessionObserver
+       // ----------------------------------------------------------------------------
+       //
+void Ctest_pluginpreview::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, 
+               TAny */*aArg1*/, 
+               TAny */*aArg2*/, 
+               TAny */*aArg3*/)
+           {
+
+           }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+    return ( CScriptBase* ) Ctest_pluginpreview::NewL( aTestModuleIf );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/plugins/previewplugin/tsrc/src/test_pluginpreviewblocks.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,482 @@
+/*
+#
+# 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:   Main test class for CS Preview Plugin
+#*/
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <msvsearchsortoperation.h>
+#include <msvsearchsortquery.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include <TXTRICH.H>
+#include <SMUTHDR.H>
+#include <smut.h>
+#include <msvstd.h>
+#include <rsendas.h>
+#include <rsendasmessage.h>
+#include <ecom\ECom.h>
+#include "test_pluginpreview.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::Delete
+//  
+// -----------------------------------------------------------------------------
+//
+void Ctest_pluginpreview::Delete() 
+    {          
+	
+	
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::RunMethodL
+// 
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_pluginpreview::RunMethodL( CStifItemParser& aItem ) 
+    {
+    TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        		
+        ENTRY( "Example", Ctest_pluginpreview::ExampleL ),
+        ENTRY( "CreateCCsPreviewPluginL",Ctest_pluginpreview::CreateCCsPreviewPluginL),
+	    ENTRY( "MmsMsgPluginValidationL", Ctest_pluginpreview::MmsMsgPluginValidationL),
+	    ENTRY( "SendMmsMessageL", Ctest_pluginpreview::SendMmsMessageL)
+              
+        };
+
+    const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo );
+    return RunInternalL( KFunctions, count, aItem );
+    }
+
+// -----------------------------------------------------------------------------
+// Ctestsmsplugin::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_pluginpreview::ExampleL( CStifItemParser& aItem )
+    {
+	
+    // Print to UI
+    _LIT( Ktestplugin, "testpluginpreview" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, Ktestplugin, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, Ktestplugin,
+                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::CreateCCsPreviewPluginL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_pluginpreview::CreateCCsPreviewPluginL( CStifItemParser& /*aItem*/ )
+	{
+	
+	 // Print to UI
+ 	 _LIT( Ktestplugin, "CreateCCsPreviewPlugin" );
+   	 _LIT( KFunction, "In CreateCCsPreviewPlugin" );
+     TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+	 // Print to log file
+	 iLog->Log( KFunction );
+	 iPlugin = CCsPreviewPlugin::NewL(this);
+	 iPlugin->GetConversationsL();
+     return KErrNone;
+ 	 
+	}
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::ThumbnailPreviewReady()
+// callback
+// -----------------------------------------------------------------------------
+//
+void Ctest_pluginpreview::ThumbnailPreviewReady(MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/)
+	{
+
+	}
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::ThumbnailReady()
+// 
+// -----------------------------------------------------------------------------
+//
+void Ctest_pluginpreview::ThumbnailReady(TInt aError,MThumbnailData& aThumbnail, TThumbnailRequestId aId)
+	{
+	    
+	}
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::RestoreReady()
+// 
+// -----------------------------------------------------------------------------
+//
+void Ctest_pluginpreview::RestoreReady(TInt /*aParseResult*/, TInt /*aError*/)
+	{
+
+	}
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::HandleCachingError
+// Caching error event from Plugins
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_pluginpreview::HandleCachingError(const TInt /*aError*/)
+	{
+    		Signal(KErrGeneral);
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::HandleCachingCompleted
+// Caching complete event from Plugins
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_pluginpreview::HandleCachingCompleted()
+       {
+   
+	
+   
+       }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::MmsMsgPluginValidationL
+// Validates the initial Caching of sms plugin
+// -----------------------------------------------------------------------------
+//
+TInt Ctest_pluginpreview::MmsMsgPluginValidationL( CStifItemParser& /*aItem*/ )
+    {
+	// Print to UI
+	_LIT(Ktestplugin, "MmsPluginValidationL" );
+	_LIT( KFunction, "In MmsPluginValidationL" );
+	TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+	// Print to log file
+	iLog->Log( KFunction );
+
+	CleanAllFoldersL();
+    CreateMmsMessageL(KMsvGlobalInBoxIndexEntryId);
+    CreateMmsMessageL(KMsvSentEntryId);
+    CreateMmsMessageL(KMsvDraftEntryId);
+    CreateMmsMessageL(KMsvGlobalOutBoxIndexEntryId);;
+
+    iPlugin = CCsPreviewPlugin::NewL(this);
+    iPlugin->GetConversationsL();
+
+    return KErrNone;
+    
+    }
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::CleanAllFoldersL
+// Cleans messages from all folders
+// -----------------------------------------------------------------------------
+
+void Ctest_pluginpreview::CleanAllFoldersL()
+    {
+	CleanMessagesInFolderL(KMsvGlobalInBoxIndexEntryId);
+	CleanMessagesInFolderL(KMsvGlobalOutBoxIndexEntryId);
+	CleanMessagesInFolderL(KMsvDraftEntryId);
+ 	// CleanMessagesInFolderL(KMsvSentEntryId);
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::CreateMmsMessageL
+// Creates message 
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_pluginpreview::CreateMmsMessageL(const TMsvId aFolderId,TBool aUnReadFlag)
+	{
+		
+	// create a new object to access an existing entry
+	CMsvEntry* msvEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, TMsvSelectionOrdering());
+	CleanupStack::PushL(msvEntry);
+	
+	TMsvId defaultServiceId = 0;
+	defaultServiceId = iMmsMtm->DefaultServiceL();
+	
+	_LIT( KMMSBody, " HELLO !!!");
+	
+	CleanupStack::Pop(msvEntry);
+	iMmsMtm->SetCurrentEntryL(msvEntry);
+	iMmsMtm->CreateMessageL(defaultServiceId);
+	iMmsMtm->SetSubjectL(KMMSBody);
+	
+	// set some mms defaults
+	iMmsMtm->SetMessageClass(EMmsClassPersonal);
+	iMmsMtm->SetExpiryInterval(86400);
+	iMmsMtm->SetDeliveryTimeInterval(3600);
+	iMmsMtm->SetMessagePriority(EMmsPriorityLow);
+	iMmsMtm->SetSenderVisibility(EMmsMaximumSenderVisibility);
+	iMmsMtm->SetDeliveryReport(EMmsDeliveryReportYes);
+	iMmsMtm->SetReadReply(EMmsReadReplyYes);        
+	
+	_LIT(KPhoneNumberString,"234567");
+	TBuf<15> phoneNumberString;
+	phoneNumberString.Copy(KPhoneNumberString);
+	_LIT(KPhoneNumberString1,"mine<98450>");
+	_LIT(KResultPhoneNumberString,"98450");
+	
+	if (aFolderId == KMsvGlobalInBoxIndexEntryId)
+	{
+		iMmsMtm->SetSenderL(KResultPhoneNumberString);
+	}
+	
+	iMmsMtm->AddAddresseeL(KResultPhoneNumberString);
+	
+	CMsvStore* store = msvEntry->EditStoreL();
+	CleanupStack::PushL(store);
+	
+	// set body as an attachment
+	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+	CleanupStack::PushL(mimeHeaders);
+	mimeHeaders->SetContentTypeL( _L8("image/jpg") );
+	mimeHeaders->SetContentSubTypeL( _L8("image/jpg") );
+	mimeHeaders->SetMimeCharset( KMmsUtf8 );
+	mimeHeaders->SetSuggestedFilenameL( _L("body.jpg") );    
+	         
+	MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred
+	CleanupStack::PushL(attachmentInfo);
+	attachmentInfo->SetAttachmentNameL( _L("body.txt") );
+	attachmentInfo->SetMimeTypeL( _L8("image/jpg") );
+	mimeHeaders->StoreL( *attachmentInfo );
+	    
+	RFile textFile;
+
+	CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC();
+	attachMan.CreateAttachmentL(_L("body.jpg"), textFile, attachmentInfo, waiter->iStatus );
+	CleanupStack::Pop(); // waiter
+	CleanupStack::Pop(); // attachmentInfo
+	CleanupStack::PushL(waiter);
+	waiter->Start();
+	CleanupStack::PopAndDestroy(waiter);    
+	
+	HBufC8* tempBuf = HBufC8::NewLC( 10 );
+	tempBuf->Des().Copy( KMMSBody );
+	textFile.Write( tempBuf->Des() );        
+	textFile.Close();
+	CleanupStack::PopAndDestroy(); //tempBuf
+	    
+	CleanupStack::PopAndDestroy(); //mimeHeaders
+
+	// get the entry of the message
+	 TMsvEntry messageEntry = iMmsMtm->Entry().Entry();        
+	
+	 // set the description field same as the message subject
+	 messageEntry.iDescription.Set( KMMSBody );
+
+	// save the changes done above
+	iMmsMtm->Entry().ChangeL(messageEntry); 
+	
+	TFileName attachmentFile( _L("c:\\pictures\\picture123.jpg") );	
+	HandleAttachementL(store,attachmentFile );
+	
+	// save the changes made to the message store
+	store->CommitL();
+	CleanupStack::PopAndDestroy(store);   
+	               
+	// save the message      
+	iMmsMtm->SaveMessageL();
+	   
+	// final fine tuning
+	messageEntry.SetAttachment(ETrue);
+	messageEntry.iDate.HomeTime();
+	messageEntry.SetVisible(ETrue);
+	messageEntry.SetInPreparation(EFalse);
+	
+	if( aUnReadFlag )
+    {
+	      messageEntry.SetUnread(ETrue);
+	      messageEntry.SetNew(ETrue);
+	}
+	else
+	{
+		  messageEntry.SetUnread(EFalse);
+		  messageEntry.SetNew(EFalse);
+	}
+	messageEntry.SetComplete(ETrue);
+	messageEntry.iServiceId = defaultServiceId;
+	messageEntry.iRelatedId = 0;
+	      
+	if (aFolderId == KMsvDraftEntryId) 
+	          messageEntry.SetReadOnly(EFalse);
+	else
+	          messageEntry.SetReadOnly(ETrue);
+     
+	messageEntry.iMtmData1 = KMmsMessageMRetrieveConf | KMmsMessageMobileTerminated;
+	  	
+	iMmsMtm->Entry().ChangeL(messageEntry);
+	      
+	}
+
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::CreateMmsMessageL
+// Creates message 
+// -----------------------------------------------------------------------------
+//
+
+void Ctest_pluginpreview:: HandleAttachementL(CMsvStore* store,TFileName& sourceFileName )
+	{
+    
+	// attachment settings
+	MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+	CMsvAttachment* attachmentInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile); // ownership of attachmentInfo will be transferred
+	CleanupStack::PushL(attachmentInfo);
+	attachmentInfo->SetAttachmentNameL( sourceFileName);        
+	attachmentInfo->SetMimeTypeL(_L8("image/jpg") );
+
+	CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+	CleanupStack::PushL(mimeHeaders);
+    mimeHeaders->SetContentTypeL( _L8("image/jpg") );
+    mimeHeaders->SetContentSubTypeL( _L8("image/jpg") );
+    mimeHeaders->SetMimeCharset( KMmsUtf8 );
+    mimeHeaders->StoreL( *attachmentInfo );
+    CleanupStack::PopAndDestroy( mimeHeaders );
+	 
+	CMsvOperationActiveSchedulerWait* waiter = CMsvOperationActiveSchedulerWait::NewLC();
+	TInt err;
+	TRAP(err, attachMan.AddAttachmentL(sourceFileName, attachmentInfo, waiter->iStatus ));
+	if (err == KErrNone)
+	{
+	     	waiter->Start();
+	     	CleanupStack::PopAndDestroy(waiter);
+	     	CleanupStack::Pop(); // attachmentInfo, the ownership is transferred
+	 }	
+	 else
+	 {
+		 CleanupStack::PopAndDestroy(waiter);
+	     CleanupStack::PopAndDestroy(); // attachmentInfo, ownership is not transferred (leave occurs)
+	     _LIT( Ktestplugin, "HandleAttachment" );
+	     _LIT( KFunction, "In HandleAttachment::Failed" );
+	 }
+		
+	 }
+
+// -----------------------------------------------------------------------------
+// Ctestsmsplugin::SendMmsMessageL
+// Send ccs message using RSendAs api
+// -----------------------------------------------------------------------------
+//
+
+TInt Ctest_pluginpreview::SendMmsMessageL( CStifItemParser& /*aItem*/ )
+    {
+	// Print to UI
+	_LIT( Ktestplugin, "SendCcsMessageL" );
+	_LIT( KFunction, "In SendCcsMessageL" );
+	TestModuleIf().Printf( 0, Ktestplugin, KFunction );
+	// Print to log file
+	iLog->Log( KFunction );
+	
+	RSendAs sendas;
+    CleanupClosePushL(sendas);
+    TInt res = sendas.Connect();
+    User::LeaveIfError(res);
+    
+   	RSendAsMessage message;
+    CleanupClosePushL(message);
+    TRAP(res, message.CreateL(sendas,KUidMsgTypeMultimedia));
+    User::LeaveIfError(res);
+
+   // TBuf<512> MsgText;
+    //MsgText.Copy(_L("Message being sent"));
+    //message.SetBodyTextL(MsgText);
+    TBuf<15> RecAdd;
+    RecAdd.Copy(_L("123456789"));
+    message.AddRecipientL(RecAdd,RSendAsMessage::ESendAsRecipientTo );
+
+   	message.SendMessageAndCloseL();
+   	CleanupStack::Pop(1); // RMessage
+   	CleanupStack::PopAndDestroy(1); // RSendAs
+
+   	return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Ctest_pluginpreview::CleanMessagesInFolderL
+// Cleans messages from the specified folder
+// -----------------------------------------------------------------------------
+
+void Ctest_pluginpreview::CleanMessagesInFolderL(TMsvId aBoxId,TBool aDeleteOne)
+    {
+
+    iLog->Log(_L("In CleanMessagesInFolderL"));
+    TInt count;
+    CMsvEntry* cEntry = NULL;
+    // delete messages from the specified box
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    // show invisible entries
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeSMS);
+    CleanupStack::PushL(msvEntrySelection);
+
+    if( aDeleteOne )
+       {
+        	count =1;
+       }
+    else
+        {
+       		count = msvEntrySelection->Count();
+        }
+
+    for ( int i = 0; i < count ; i++ )
+        {
+        	CMsvEntry* entry = iSession->GetEntryL( msvEntrySelection->At(i) );
+        	CleanupStack::PushL( entry );
+        	TMsvEntry tEntry = entry->Entry();
+        	tEntry.SetReadOnly(EFalse);
+        	entry->ChangeL(tEntry);
+        	cEntry->DeleteL( msvEntrySelection->At(i) );
+        	CleanupStack::PopAndDestroy( entry );
+        }
+
+    CleanupStack::PopAndDestroy(msvEntrySelection);
+    CleanupStack::PopAndDestroy(cEntry);
+    iLog->Log(_L("End of CleanMessagesInFolderL"));
+
+    }
+
+
+
Binary file messagingapp/msgappfw/server/backup_registration.xml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/server/inc/ccsbackuphandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 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:
+//
+
+
+#include <babackup.h>
+#include <f32file.h>
+
+class CCsServer;
+
+class CCsBackUpHandler: public CBase, public MBackupObserver
+{
+public:
+    static CCsBackUpHandler* NewL(CCsServer& aServer);
+    ~CCsBackUpHandler();
+    // from MBackupObserver
+    virtual void ChangeFileLockL(const TDesC& aFileAffected, TFileLockFlags aFlags);
+
+private:
+    void ConstructL();
+    CCsBackUpHandler(CCsServer& aServer);
+    void CloseConversationsDbL();
+    void OpenConversationsDbL();
+
+private:
+    CBaBackupSessionWrapper* iBackup;  
+    TFileName iFileName;
+    CCsServer& iServer;
+};
+
--- a/messagingapp/msgappfw/server/inc/ccscontactsmanager.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccscontactsmanager.h	Fri Jun 25 15:47:40 2010 +0530
@@ -19,6 +19,7 @@
 
 // SYSTEM INCLUDES
 #include <QObject>
+#include <qtcontacts.h>
 #include "qtcontactsglobal.h"
 // USER INCLUDES
 #include "mcscontactsmanagerobserver.h"
--- a/messagingapp/msgappfw/server/inc/ccsconversation.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversation.h	Fri Jun 25 15:47:40 2010 +0530
@@ -139,7 +139,7 @@
      */
     void AddContactDetailsL(
             TInt32 aContactId, 
-            const TDesC& aDisplayName);
+            const HBufC* aDisplayName);
 
     /**
      * AddContactDetailsL
--- a/messagingapp/msgappfw/server/inc/ccsconversationcache.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversationcache.h	Fri Jun 25 15:47:40 2010 +0530
@@ -148,8 +148,9 @@
      * 
      * @param aConversationId Conversation Id.
      * @param aDeleted ETrue if conversation is being deleted else EFalse
+	 * @param aCount = 0, count of messages in sending-state/not-deleted
      */
-    void MarkConversationAsDeleted(TInt aConversationId, TBool aDeleted);
+    void MarkConversationAsDeleted(TInt aConversationId, TBool aDeleted, TInt aCount = 0);
 
     /**
      * IsDeleted
@@ -188,6 +189,8 @@
      */
     TInt GetConversationIdFromAddressL(TDesC& aContactAddress);
     
+    CCsClientConversation* GetConversationFromConversationIdL(TInt aConversationId);
+
     /**
      * Get conversation from message-id
      * @param aMessageId Message id
--- a/messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversationdeletehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,6 @@
 class MMsvSessionObserver;
 class CConversationCache;
 class CCsConversationEntry;
-class MCsConversationDeleteObserver;
 
 /**
  * Delete handler states
@@ -48,8 +47,7 @@
     /**
      * Two phase construction
      */
-    static CCsConversationDeleteHandler* NewL(CCsConversationCache* aCache,
-            MCsConversationDeleteObserver* aObserver);
+    static CCsConversationDeleteHandler* NewL(CCsConversationCache* aCache);
 
     /**
      * Destructor
@@ -74,8 +72,7 @@
 		
 private:    
     CCsConversationDeleteHandler();
-    void ConstructL(CCsConversationCache* aCache,
-            MCsConversationDeleteObserver* aObserver);
+    void ConstructL(CCsConversationCache* aCache);
     void IssueRequest();
     void DeleteOneMessage();
     
@@ -86,13 +83,6 @@
     CMsvSession* iSession;
     
     /**
-     * iObserverList
-     * List of observers
-     * Own.
-    */
-    MCsConversationDeleteObserver* iObserver;
-    
-    /**
      * State
      */
     TDeleteHandlerState iState;
@@ -116,6 +106,13 @@
      * Conversation Id currently being deleted.
      */
     TInt iConversationId;
+    
+    /**
+     *  Number of Messages in Sending state that are not deleted
+     */
+    TInt iSendStateMsgs;
+    
+    
     };
 
 #endif // __C_CS_CONVERSATION_DELETE_HANDLER_H__
--- a/messagingapp/msgappfw/server/inc/ccsconversationevent.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversationevent.h	Fri Jun 25 15:47:40 2010 +0530
@@ -115,6 +115,12 @@
      */
     TBool IsDeleteConversationListEventSet() const;
     
+	/**
+	 * Is partial delete conversation event set in this object
+	 * @ retrun TBool
+	 */
+    TBool IsPartialDeleteConversationListEventSet() const;
+    
     /**
      * Is new conversation event set in this object 
      * 
--- a/messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsconversationmarkreadhandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -22,11 +22,9 @@
 
 // FORWARD DECLARATIONS
 class CMsvSession;
-class MMsvSessionObserver;
 class CConversationCache;
 class CCsConversationEntry;
-class MCsConversationMarkReadObserver;
-
+class MMsvSessionObserver;
 /**
  * Mark read handler states
  */
@@ -41,15 +39,13 @@
 /**
  * This class handles mark read of messages from messaging store.
  */
-class CCsConversationMarkReadHandler : public CActive, 
-public MMsvSessionObserver 
-    {
+class CCsConversationMarkReadHandler : public CActive, public MMsvSessionObserver
+{
 public:
     /**
      * Two phase construction
      */
-    static CCsConversationMarkReadHandler* NewL(CCsConversationCache* aCache,
-            MCsConversationMarkReadObserver* aObserver);
+    static CCsConversationMarkReadHandler* NewL(CCsConversationCache* aCache);
 
     /**
      * Destructor
@@ -75,8 +71,7 @@
 
 private:    
     CCsConversationMarkReadHandler();
-    void ConstructL(CCsConversationCache* aCache,
-            MCsConversationMarkReadObserver* aObserver);
+    void ConstructL(CCsConversationCache* aCache);
     void IssueRequest();
     void MarkReadOneMessageL();
     
@@ -87,12 +82,6 @@
     CMsvSession* iSession;
     
     /**
-     * iObserver
-     * Own.
-    */
-    MCsConversationMarkReadObserver* iObserver;
-    
-    /**
      * State
      */
     TMarkReadHandlerState iState;
--- a/messagingapp/msgappfw/server/inc/ccsserver.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccsserver.h	Fri Jun 25 15:47:40 2010 +0530
@@ -30,6 +30,7 @@
 class CCsSession;
 class CCsContactsManager;
 class CCsClientConversation;
+class CCsBackUpHandler;
 
 // CLASS DECLARATION
 /** 
@@ -131,7 +132,18 @@
     {
     }
     ;
-
+    
+	/**
+	 * Reload the plugins, once they are unloaded after a 
+	 * backup/ restore
+	 */
+    void LoadPlugins();
+	
+	/**
+	 * Unload the plugins, for backup/ restore
+	 */
+    void DeletePlugins();
+    
 public:
 
     /**
@@ -183,6 +195,11 @@
      * Caching status
      */
     TUint8 iCsCachingStatus;
+    
+    /**
+     * The backup handler class
+     */
+    CCsBackUpHandler* iBackUpHandler;
 };
 
 #endif // __C_CS_SERVER_H
--- a/messagingapp/msgappfw/server/inc/ccssession.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/inc/ccssession.h	Fri Jun 25 15:47:40 2010 +0530
@@ -18,17 +18,11 @@
 #ifndef __C_CS_SESSION_H
 #define __C_CS_SESSION_H
 
-// USER INCLUDE FILES
-#include "mcsconversationdeleteobserver.h"
-#include "mcsconversationmarkreadobserver.h"
-
 // FORWARD DECLARATIONS
 class CCsServer;
 class CCsPluginInterface;
 class CCsClientConversation;
 class CCsConversationEvent;
-class CCsConversationDeleteHandler;
-class CCsConversationMarkReadHandler;
 
 // CLASS DECLARATIONS
 
@@ -36,9 +30,7 @@
  * Represents a session (version 2) for a client thread on 
  * the server side
  */
-class CCsSession : public CSession2,
-public MCsConversationDeleteObserver,
-public MCsConversationMarkReadObserver
+class CCsSession : public CSession2
     {
 public:
 
@@ -100,6 +92,13 @@
     void HandleModifyConversationListEventL(
             CCsClientConversation* aClientConversation);      
 
+	/**
+	 * HandlePartialDeleteConversationListEvent
+	 * Handles the partial delete conversation event from cache
+	 */
+    void HandlePartialDeleteConversationListEvent(
+            CCsClientConversation* aClientConversation);
+    
     /**
      * HandleNewConversationEventL
      * Handles the new conversation event received from cache
@@ -152,15 +151,7 @@
      */
     void HandleRefreshConversationL();
 
-public:
-    // From MCsConversationDeleteObserver
-    void DeleteComplete(CCsConversationDeleteHandler* aHandler);
-    void DeleteInProgress(CCsConversationDeleteHandler* aHandler);
-
-public:
-    // From MCsConversationMarkReadObserver
-    void MarkReadComplete(CCsConversationMarkReadHandler* aHandler);
-    
+   
 private:
 
     /**
@@ -345,6 +336,8 @@
      * @param aMessage RMessage instance
      */
     void GetConversationIdfromAddressL(const RMessage2& aMessage);
+
+    void GetConversationFromConversationIdL(const RMessage2& aMessage);
 	
 	/**
      * GetConversationFromMessageIdL
@@ -374,7 +367,7 @@
      * Buf for doing IPC
      * Own
      */
-    HBufC8* des;
+    HBufC8*  iDes;
 
     /**
      * iEventList
--- a/messagingapp/msgappfw/server/inc/mcsconversationdeleteobserver.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2007 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:  Conversation delete observer interface.
- *
-*/
-
-#ifndef MCSCONVERSATIONDELETEOBSERVER_H_
-#define MCSCONVERSATIONDELETEOBSERVER_H_
-
-class CCsConversationDeleteHandler;
-
-class MCsConversationDeleteObserver 
-    {
-public:
-    /**
-     * Callback that notifies delete is already in progress
-     */
-    virtual void DeleteInProgress(CCsConversationDeleteHandler* handler) = 0;
-        
-    /**
-     * Callback that notifies delete is complete
-     */
-    virtual void DeleteComplete(CCsConversationDeleteHandler* handler) = 0;
-    };
-
-#endif /* MCSCONVERSATIONDELETEOBSERVER_H_ */
--- a/messagingapp/msgappfw/server/inc/mcsconversationmarkreadobserver.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* Copyright (c) 2007 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:  Conversation mark read observer interface.
- *
-*/
-
-#ifndef MCSCONVERSATIONREADOBSERVER_H_
-#define MCSCONVERSATIONREADOBSERVER_H_
-
-class CCsConversationMarkReadHandler;
-
-class MCsConversationMarkReadObserver 
-    {
-public:
-    /**
-     * Callback that notifies mark read is complete
-     */
-    virtual void MarkReadComplete(CCsConversationMarkReadHandler* handler) = 0;
-    };
-
-#endif /* MCSCONVERSATIONREADOBSERVER_H_ */
--- a/messagingapp/msgappfw/server/rom/csserver.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/rom/csserver.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -21,9 +21,6 @@
 data=DATAZ_\system\install\csserver_stub.sis			system\install\csserver_stub.sis
 
 file=ABI_DIR\BUILD_DIR\csserver.exe            				PROGRAMS_DIR\csserver.exe
-
-data=DATAZ_\RESOURCE_FILES_DIR\cscontacts.rsc					RESOURCE_FILES_DIR\cscontacts.rsc
-
-
+data=EPOCROOT##epoc32\data\Z\private\2002A542\backup_registration.xml		private\2002A542\backup_registration.xml
 
 #endif // __CSSERVER_IBY__
--- a/messagingapp/msgappfw/server/server.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/server.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -23,10 +23,8 @@
 
 INCLUDEPATH += ./inc \
                ./../utils/inc \
-               ./../../msgutils/s60qconversions/inc \
                ./../../../mmsengine/inc
 
-INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 SYMBIAN_PLATFORMS = WINSCW ARMV5
@@ -34,9 +32,9 @@
 symbian {
     TARGET.UID3 =  0x2002A542
     TARGET.CAPABILITY = CAP_SERVER
-    TARGET.EPOCSTACKSIZE = 0x8000
+    TARGET.EPOCSTACKSIZE = 0x14000
     VENDORID =  VID_DEFAULT
-    TARGET.EPOCHEAPSIZE = 0x100000 0x500000
+    TARGET.EPOCHEAPSIZE = 0x100000 0x1000000
     VERSION = 1.0
 }
 
@@ -51,7 +49,8 @@
            ccsconversationevent.h \
            ccsconversationcontact.h \                     
            ccsconversationdeletehandler.h \
-           ccsconversationmarkreadhandler.h
+           ccsconversationmarkreadhandler.h \
+           ccsbackuphandler.h
 
 SOURCES += ccsstartup.cpp \
            ccsserver.cpp \
@@ -65,14 +64,16 @@
            ccsconversationevent.cpp \
            ccsconversationcontact.cpp \                      
            ccsconversationdeletehandler.cpp \
-           ccsconversationmarkreadhandler.cpp
+           ccsconversationmarkreadhandler.cpp \
+           ccsbackuphandler.cpp
 
 # Build.inf rules
 BLD_INF_RULES.prj_exports += \
      "$${LITERAL_HASH}include <platform_paths.hrh>" \
      "$${LITERAL_HASH}include <data_caging_paths.hrh>" \
      "rom/csserver.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(csserver.iby)" \
-     "stub_sis/csserver_stub.sis   /epoc32/data/z/system/install/csserver_stub.sis"
+     "stub_sis/csserver_stub.sis   /epoc32/data/z/system/install/csserver_stub.sis" \
+     "backup_registration.xml z:/private/2002A542/backup_registration.xml"
      
 LIBS += -leuser \
         -lcone \
@@ -88,6 +89,6 @@
         -lcentralrepository \
         -limcm \
         -lQtContacts \
-        -ls60qconversions
+        -lxqutils 
         
-        
\ No newline at end of file
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgappfw/server/src/ccsbackuphandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,123 @@
+// Copyright (c) 2010 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:
+//
+#include "ccsbackuphandler.h"
+#include <e32base.h>
+#include <e32property.h>
+#include <connect/sbdefs.h>
+#include "ccsserver.h"
+#include "ccsdebug.h"
+
+_LIT(KDbFileNamePath,"c:\\private\\10281e17\\[2002A542]conversations.db");
+
+
+// ========================== Member Functions ===============================
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::NewL 
+// ----------------------------------------------------------------------------
+CCsBackUpHandler* CCsBackUpHandler::NewL(CCsServer& aServer)
+{
+    PRINT ( _L("Enter CCsBackUpHandler::NewL") );
+    CCsBackUpHandler* self = new (ELeave) CCsBackUpHandler(aServer);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    PRINT ( _L("Exit CCsBackUpHandler::NewL") );
+    return (self);
+    
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::CCsBackUpHandler 
+// ----------------------------------------------------------------------------
+CCsBackUpHandler::CCsBackUpHandler(CCsServer& aServer): iServer(aServer)
+{
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::~CCsBackUpHandler 
+// destructor
+// ----------------------------------------------------------------------------
+CCsBackUpHandler::~CCsBackUpHandler()
+{
+    // Unregister ourselves with backup server
+    if (iBackup) 
+    {
+        iBackup->DeregisterFile(iFileName);
+        delete iBackup;
+    }
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::ConstructL 
+// The 2-phase constructor
+// ----------------------------------------------------------------------------
+void CCsBackUpHandler::ConstructL()
+{
+    PRINT ( _L("Enter CCsBackUpHandler::ConstructL") );
+    iFileName = KDbFileNamePath;
+    // Create backup session
+    iBackup = CBaBackupSessionWrapper::NewL();
+    // Register with the backup server
+    iBackup->RegisterFileL(iFileName, *this);
+    PRINT ( _L("Exit  CCsBackUpHandler::ConstructL 2") );
+    PRINT1 ( _L("KDbFileNamePath: %S"), &iFileName);
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::ChangeFileLockL 
+// Call back from the backup engine observer when a backup/restore is taking place
+// ----------------------------------------------------------------------------
+void CCsBackUpHandler::ChangeFileLockL(const TDesC& aFileAffected, TFileLockFlags aFlags)
+{
+    PRINT1 ( _L("ChangeFileLockL: %d"), aFlags);
+    PRINT1 ( _L("ChangeFileLockL affected file : %S"), &aFileAffected);
+    switch (aFlags) {
+    case ETakeLock:
+    {
+        OpenConversationsDbL();
+        break;
+    }
+    case EReleaseLockNoAccess:    
+    case EReleaseLockReadOnly:
+    {
+        CloseConversationsDbL();
+        break;
+    }
+    default:
+    {
+        __ASSERT_DEBUG(EFalse,User::Invariant());
+        break;
+    }
+    }
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::CloseConversationsDbL 
+// Unloads the plugins, so that the DB handle is closed
+// ----------------------------------------------------------------------------
+void CCsBackUpHandler::CloseConversationsDbL()
+{
+    iServer.DeletePlugins();
+}
+
+// ----------------------------------------------------------------------------
+// CCsBackUpHandler::OpenConversationsDbL 
+// Loads the plugins, so that the DB handle is again opened
+// ----------------------------------------------------------------------------
+void CCsBackUpHandler::OpenConversationsDbL()
+{
+    iServer.LoadPlugins();
+}
--- a/messagingapp/msgappfw/server/src/ccscontactsmanager.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccscontactsmanager.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,7 +16,6 @@
  */
 
 // System includes
-#include "qtcontacts.h" 
 #include <QList>
 // User includes
 #include "ccscontactsmanager.h"
--- a/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccscontactsresolver.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,7 +16,7 @@
  */
 
 // SYSTEM INCLUDES
-#include "qtcontacts.h" 
+#include "qtcontacts.h"
 #include "qcontactdetailfilter.h"
 #include <QList>
 
@@ -50,25 +50,37 @@
         const QString &address,
         CCsContactDetail &contactDetail)
     {
+    // apply filter on phone number field
     QContactDetailFilter phoneFilter;
     phoneFilter.setDetailDefinitionName(
-            QContactPhoneNumber::DefinitionName, 
+            QContactPhoneNumber::DefinitionName,
             QContactPhoneNumber::FieldNumber);
-    
+
     phoneFilter.setValue(address);
     phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+    QList<QContact> matchingContacts = mPhonebookManager->contacts(phoneFilter);
+    if ( matchingContacts.count() > 0 ) {
+        QContact match = matchingContacts.at(0);
+        // Fill the contact details
+        contactDetail.contactId = match.localId();
+        contactDetail.displayName = match.displayLabel();
+        return true;
+    }
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = mPhonebookManager->contacts(
-                                                phoneFilter,
-                                                sortOrder,
-                                                QStringList());
+    // apply filter on email address field
+    QContactDetailFilter emailFilter;
+    emailFilter.setDetailDefinitionName(
+            QContactEmailAddress::DefinitionName,
+            QContactEmailAddress::FieldEmailAddress);
 
-    if ( matchingContacts.count() > 0 ) {	        
+    emailFilter.setValue(address);
+    emailFilter.setMatchFlags(QContactFilter::MatchExactly);
+    matchingContacts = mPhonebookManager->contacts(emailFilter);
+    if ( matchingContacts.count() > 0 ) {
         QContact match = matchingContacts.at(0);
-        // Fill the contact details        
+        // Fill the contact details
         contactDetail.contactId = match.localId();
-        contactDetail.displayName = match.displayLabel();   
+        contactDetail.displayName = match.displayLabel();
         return true;
     }
     return false;
@@ -80,14 +92,14 @@
 // ----------------------------------------------------------------------------
 void CCsContactsResolver::resolveContactId(
         const quint32 &contactId,
-        CCsContactDetail &contactDetail)	
+        CCsContactDetail &contactDetail)
     {
     // Fetch back the persisted contact
     QContact contact = mPhonebookManager->contact(contactId);
-    contactDetail.contactId = contact.localId(); 
-    
+    contactDetail.contactId = contact.localId();
+
     contactDetail.displayName = contact.displayLabel();
-        
+
     QList<QContactPhoneNumber> numbers = contact.details<QContactPhoneNumber>();
     int numberCount = numbers.count();
 
@@ -95,7 +107,16 @@
         {
         QString phoneNumber= numbers.at(a).number();
         contactDetail.addressList.append(phoneNumber);
-        }    
+        }
+
+    QList<QContactEmailAddress> emailAddresses = contact.details<QContactEmailAddress>();
+    int emailCount = emailAddresses.count();
+
+    for ( int a=0; a<emailCount ;++a)
+        {
+        QString emailAddr= emailAddresses.at(a).emailAddress();
+        contactDetail.addressList.append(emailAddr);
+        }
     }
 
 // EOF
--- a/messagingapp/msgappfw/server/src/ccsconversation.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversation.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -253,9 +253,12 @@
 void
 CCsConversation::AddContactDetailsL(
         TInt32  aContactId,
-        const TDesC& aDisplayName)
+        const HBufC* aDisplayName)
     {
-    iContact->SetDisplayNameL(aDisplayName);
+    if(aDisplayName)
+    {
+        iContact->SetDisplayNameL(*aDisplayName);    
+    }
     iContact->SetContactId (aContactId);    
     }
 
--- a/messagingapp/msgappfw/server/src/ccsconversationcache.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcache.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,7 @@
 #include <ccsdefs.h>
 #include <telconfigcrkeys.h>        // KCRUidTelephonyConfiguration
 #include <centralrepository.h>
-
+#include <xqconversions.h>
 // USER INCLUDE FILES
 #include "ccsconversationcache.h"
 #include "ccsconversationcachehelper.h"
@@ -35,7 +35,6 @@
 #include "ccscontactsresolver.h"
 #include "ccsconversationevent.h"
 #include "ccsserver.h"
-#include "s60qconversions.h"
 #include "ccsdebug.h"
 
 // ============================== MEMBER FUNCTIONS ============================
@@ -406,6 +405,20 @@
         CleanupStack::PopAndDestroy(clientConv);
     }
 
+    // send all CV entry delete events, required in case CV is open
+    // Notify client of conversation change
+    TInt totalEntryCount = conversation->GetEntryCount();
+    for (TInt entryCounter = totalEntryCount - 1; entryCounter >= 0;
+            entryCounter--)
+    {
+        CCsConversationEntry* entryInConversation =
+                conversation->GetEntryL(entryCounter);
+        CCsClientConversation * clientConv =
+                CreateClientConvLC(conversation, entryInConversation);
+        NotifyL(clientConv, KConversationEventDelete);
+        CleanupStack::PopAndDestroy(clientConv);
+    }
+
     iConversationList->Remove(aIndex);
     entryList.ResetAndDestroy();
 
@@ -437,7 +450,7 @@
 // CCsConversationCache::MarkConversationAsDeleted
 // ----------------------------------------------------------------------------
 void CCsConversationCache::MarkConversationAsDeleted(TInt aConversationId,
-                                                     TBool aDeleted)
+                                                     TBool aDeleted, TInt aCount)
 {
     TInt conversationCount = iConversationList->Count();
 
@@ -450,6 +463,14 @@
         if (id == aConversationId)
         {
             conversation->MarkDeleted(aDeleted);
+            if( aCount )
+                {
+                CCsClientConversation* clientConversation =
+                                    CreateClientConvLC(conversation,
+                                                       conversation->GetLatestEntryL());
+                NotifyL(clientConversation, KConversationListEventPartialDelete);
+                CleanupStack::PopAndDestroy();// clientConversation
+                }
             break;
         }
     }
@@ -513,7 +534,7 @@
     {
         QString phoneNumber = phoneNumberList.at(i);
         HBufC* phoneNumber_s60 = 
-            S60QConversions::qStringToS60Desc(phoneNumber);
+            XQConversions::qStringToS60Desc(phoneNumber);
         TInt cIndex = FindConversation(*phoneNumber_s60);
         if (cIndex != KErrNotFound)
         {
@@ -553,7 +574,7 @@
     {
         QString phoneNumber = phoneNumberList.at(i);
         HBufC* phoneNumber_s60 = 
-                    S60QConversions::qStringToS60Desc(phoneNumber);
+                    XQConversions::qStringToS60Desc(phoneNumber);
                 
         TInt cIndex = FindConversation(*phoneNumber_s60);
         if ( cIndex != KErrNotFound )
@@ -640,6 +661,29 @@
     }
 
 // ----------------------------------------------------------------------------
+// CCsConversationCache::GetConversationFromConversationId
+// ----------------------------------------------------------------------------
+CCsClientConversation* CCsConversationCache::GetConversationFromConversationIdL(TInt aConversationId)
+    {
+
+    CCsClientConversation* clientConv = NULL;
+
+    for ( TInt loop = 0; loop < iConversationList->Count(); ++loop )
+       {
+        CCsConversation* conversation =
+            static_cast<CCsConversation*>((*iConversationList)[loop]);
+
+            if (aConversationId == conversation->GetConversationId())
+              {
+                clientConv = CreateClientConvLC(conversation, conversation->GetLatestEntryL());
+                CleanupStack::Pop();
+                break;
+              }
+       }
+    return clientConv;
+    }
+
+// ----------------------------------------------------------------------------
 // CCsConversationCache::GetConversationFromMessageIdL
 // ---------------------------------------------------------------------------
 CCsClientConversation* CCsConversationCache::GetConversationFromMessageIdL(TInt aMessageId)
--- a/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcachehelper.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -29,7 +29,7 @@
 #include "ccsconversationevent.h"
 #include "ccscontactsmanager.h"
 #include "ccscontactsresolver.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "ccsdebug.h"
 
 // ============================== MEMBER FUNCTIONS ============================
@@ -331,7 +331,7 @@
         if (Contact)
         {
             QString contactAddress =
-                    S60QConversions::s60DescToQString(Contact->Des());
+                    XQConversions::s60DescToQString(Contact->Des());
 
             iConversationCache->ContactsManager()->resolver()->resolveContact(contactAddress,
                                                                               contactDetail);
@@ -345,7 +345,7 @@
                 HBufC* displayName = NULL;
                 if(!contactDetail.displayName.isEmpty())
                 {
-                    displayName=S60QConversions::qStringToS60Desc(contactDetail.displayName);
+                    displayName=XQConversions::qStringToS60Desc(contactDetail.displayName);
                 }
                 TRAPD(error, AddNewConversationL( aConverastionEvent->
                                 ClientConversation()->GetConversationEntry(),
@@ -539,10 +539,11 @@
             if (conversation->GetEntryCount() == 0
                     && !conversation->IsSpecialConversation())
             {
-                conversationList->Remove(loop);
-                delete conversation;
-                //reset the counters
-                loop -= 1;
+            
+            conversationList->Remove(loop);
+            delete conversation;
+            //reset the counters
+            loop -= 1;
             }
 
             // Stop searching    
@@ -572,8 +573,9 @@
     conversation->AddEntryL(aConversationEntry);
 
     // fill firstname and lastname and contact Id
-    conversation->AddContactDetailsL(aContactId,
-                                     *aDisplayName);
+    if(aDisplayName)
+   		conversation->AddContactDetailsL(aContactId,
+                                     aDisplayName);
 
     // fill the phone number
     if (aConversationEntry->Contact())
@@ -598,6 +600,9 @@
         }
 
     iConversationCache->NotifyL(clientConv, KConversationListEventNew);
+    // send the new conversation event as well, so that if there are nay listeners for the cv
+    // then they will get the notification.
+    iConversationCache->NotifyL(clientConv, KConversationEventNew);
     CleanupStack::PopAndDestroy(clientConv);
 
     CleanupStack::Pop(conversation);
--- a/messagingapp/msgappfw/server/src/ccsconversationcontact.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationcontact.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -100,8 +100,6 @@
 CCsConversationContact::SetDisplayNameL(
         const TDesC& aDisplayName)
     {
-    if( &aDisplayName )
-        {
         TRAPD(error, iDisplayName = aDisplayName.AllocL());
         if(error != KErrNone)
             {
@@ -110,7 +108,7 @@
             PRINT1 ( _L("CCsConversationContact::SetFirstNameL - Error:%d"),
                     error );
             }
-        }
+  
     }
 
 // ----------------------------------------------------------------------------
--- a/messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationdeletehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,19 +19,18 @@
 #include <ccsconversationentry.h>
 #include "ccsconversationcache.h"
 #include "ccsconversationdeletehandler.h"
-#include "mcsconversationdeleteobserver.h"
 
 // ----------------------------------------------------------------------------
 // CCsConversationDeleteHandler::NewL
 // Two Phase Construction
 // ----------------------------------------------------------------------------
 CCsConversationDeleteHandler* CCsConversationDeleteHandler::
-NewL(CCsConversationCache* aCache, MCsConversationDeleteObserver* aObserver)
+NewL(CCsConversationCache* aCache)
     {
     CCsConversationDeleteHandler* self = 
             new (ELeave) CCsConversationDeleteHandler();
     CleanupStack::PushL(self);
-    self->ConstructL(aCache, aObserver);
+    self->ConstructL(aCache);
     CleanupStack::Pop(self); // self
     return self;
     }
@@ -40,7 +39,9 @@
 // Constructor
 // ----------------------------------------------------------------------------
 CCsConversationDeleteHandler::CCsConversationDeleteHandler():
-        CActive(CActive::EPriorityLow)
+        CActive(CActive::EPriorityLow),
+        iState(EIdle),
+        iConversationEntryList(NULL)
     {
     CActiveScheduler::Add( this );
     }
@@ -48,14 +49,9 @@
 // ----------------------------------------------------------------------------
 // Constructor
 // ----------------------------------------------------------------------------
-void CCsConversationDeleteHandler::ConstructL(CCsConversationCache* aCache,
-        MCsConversationDeleteObserver* aObserver)
+void CCsConversationDeleteHandler::ConstructL(CCsConversationCache* aCache)
     {
     iCache = aCache;
-    iState = EIdle;
-    iObserver = aObserver;
-    
-    iConversationEntryList = new (ELeave)RPointerArray<CCsConversationEntry> ();  
     iSession = CMsvSession::OpenSyncL(*this);
     }
 
@@ -63,13 +59,24 @@
 // Destructor
 // ----------------------------------------------------------------------------
 CCsConversationDeleteHandler::~CCsConversationDeleteHandler()
-    {
+{
+    // Make sure Aync request cancel.
+    Cancel();
+    
     if(iSession)
         {
         delete iSession;
         iSession = NULL;
         }
+    
+    if (iConversationEntryList)
+    {
+        iConversationEntryList->ResetAndDestroy();
+        iConversationEntryList->Close();
+        delete iConversationEntryList;
+        iConversationEntryList = NULL;
     }
+}
 
 // ----------------------------------------------------------------------------
 // Delete set of messages
@@ -79,7 +86,8 @@
     // Check if delete in progress
     if ( iCache->IsDeleted(aConversationId) )
         {
-        iObserver->DeleteInProgress(this);
+        // Deletion is in progress for this conversation, so clean up this AO
+        delete this;
         return;
         }
     
@@ -99,6 +107,7 @@
     iCache->MarkConversationAsDeleted(iConversationId, ETrue);
     
     iDeletedCount = 0;
+    iSendStateMsgs = 0;
     
     // Cleanup  
     CleanupStack::PopAndDestroy(clientConversation);
@@ -121,6 +130,10 @@
         {
         iSession->RemoveEntry(id);
         }
+    else
+        {
+        iSendStateMsgs++;
+        }
     }
 
 // ----------------------------------------------------------------------------
@@ -160,17 +173,8 @@
             break;
             
         case EDeleteComplete:
-            // Mark delete complete.
-            iCache->MarkConversationAsDeleted(iConversationId, EFalse);
-            // Cleanup
-            iDeletedCount = 0;
-            iConversationEntryList->ResetAndDestroy();
-            iConversationEntryList->Close();
-            delete iConversationEntryList;
-            iConversationEntryList = NULL;  
-            
-            // Notify observers
-            iObserver->DeleteComplete(this);
+            iCache->MarkConversationAsDeleted(iConversationId, EFalse, iSendStateMsgs );
+            delete this;
             break;
         }
     }
--- a/messagingapp/msgappfw/server/src/ccsconversationevent.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationevent.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -31,6 +31,8 @@
 // Default constructor
 // ----------------------------------------------------------------------------
 CCsConversationEvent::CCsConversationEvent()
+    :iClientConversation(NULL),
+    iEvent(KConversationEventNone)
     {
     }
 
@@ -40,8 +42,6 @@
 // ----------------------------------------------------------------------------
 void CCsConversationEvent::ConstructL()
     {
-    iClientConversation = NULL;
-    iEvent = KConversationEventNone;
     }
 
 // ----------------------------------------------------------------------------
@@ -164,6 +164,13 @@
     }
 
 // ----------------------------------------------------------------------------
+// CCsConversationEvent::IsPartialDeleteConversationListEventSet
+// ----------------------------------------------------------------------------
+TBool CCsConversationEvent::IsPartialDeleteConversationListEventSet() const
+    {
+    return iEvent & KConversationListEventPartialDelete;
+    }
+// ----------------------------------------------------------------------------
 // CCsNotifyConversationEvent::IsNewConversationEventSet
 // ----------------------------------------------------------------------------
 TBool CCsConversationEvent::IsNewConversationEventSet() const
--- a/messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsconversationmarkreadhandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,6 @@
 #include <ccsconversationentry.h>
 #include "ccsconversationcache.h"
 #include "ccsconversationmarkreadhandler.h"
-#include "mcsconversationmarkreadobserver.h"
 #include <mmsconst.h>
 
 // ----------------------------------------------------------------------------
@@ -27,12 +26,12 @@
 // Two Phase Construction
 // ----------------------------------------------------------------------------
 CCsConversationMarkReadHandler* CCsConversationMarkReadHandler::
-NewL(CCsConversationCache* aCache, MCsConversationMarkReadObserver* aObserver)
+NewL(CCsConversationCache* aCache)
     {
     CCsConversationMarkReadHandler* self = 
             new (ELeave) CCsConversationMarkReadHandler();
     CleanupStack::PushL(self);
-    self->ConstructL(aCache, aObserver);
+    self->ConstructL(aCache);
     CleanupStack::Pop(self); // self
     return self;
     }
@@ -49,13 +48,11 @@
 // ----------------------------------------------------------------------------
 // Constructor
 // ----------------------------------------------------------------------------
-void CCsConversationMarkReadHandler::ConstructL(CCsConversationCache* aCache,
-        MCsConversationMarkReadObserver* aObserver)
+void CCsConversationMarkReadHandler::ConstructL(CCsConversationCache* aCache)
     {
     iCache = aCache;
     iState = EMarkReadIdle;
-    iObserver = aObserver;
-    
+       
     iConversationEntryList = new (ELeave)RPointerArray<CCsConversationEntry> ();  
     iSession = CMsvSession::OpenSyncL(*this);
     }
@@ -64,9 +61,19 @@
 // Destructor
 // ----------------------------------------------------------------------------
 CCsConversationMarkReadHandler::~CCsConversationMarkReadHandler()
+{
+    Cancel();
+    if (iConversationEntryList)
     {
-    if(iSession)
-        {
+		iConversationEntryList->ResetAndDestroy();
+        iConversationEntryList->Close();
+        delete iConversationEntryList;
+        iConversationEntryList = NULL;
+        
+    }
+
+    if (iSession)
+    {
         delete iSession;
         iSession = NULL;
         }
@@ -81,10 +88,7 @@
     CCsClientConversation* clientConversation = CCsClientConversation::NewL();
     clientConversation->SetConversationEntryId(aConversationId);
     CleanupStack::PushL(clientConversation);
-    
-    // Create entry list
-    iConversationEntryList = new (ELeave)RPointerArray<CCsConversationEntry> ();  
-    
+
     // Get conversationlist for given client conversation
     iCache->GetConversationsL (clientConversation, iConversationEntryList);
     
@@ -123,8 +127,8 @@
             if(entry.iMtm != KUidMsgTypeMultimedia)
             {
                 entry.SetUnread( EFalse );
+                cEntry->ChangeL( entry );
             }
-           cEntry->ChangeL( entry );
            }
         CleanupStack::PopAndDestroy(cEntry);
         }
@@ -167,30 +171,17 @@
             break;
             
         case EMarkReadComplete:
-            // Cleanup
-            iMarkReadCount = 0;
-            iConversationEntryList->ResetAndDestroy();
-            iConversationEntryList->Close();
-            delete iConversationEntryList;
-            iConversationEntryList = NULL;  
-            
-            // Notify observers
-            iObserver->MarkReadComplete(this);
+            // Cleanup, this is the last call RunL is not activated again.
+            delete this;
             break;
     }
 }
 
-TInt CCsConversationMarkReadHandler::RunError(TInt aError)
+TInt CCsConversationMarkReadHandler::RunError(TInt /*aError*/)
 {
-  iMarkReadCount = 0;
-  iConversationEntryList->ResetAndDestroy();
-  iConversationEntryList->Close();
-  delete iConversationEntryList;
-  iConversationEntryList = NULL;  
-            
-  // Notify observer
-  iObserver->MarkReadComplete(this);
-  return KErrNone;
+    // RunL left so stop processing the AO and clean it.
+    delete this;                     
+    return KErrNone;
 }
 
 // ----------------------------------------------------------------------------
--- a/messagingapp/msgappfw/server/src/ccsserver.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccsserver.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -29,7 +29,7 @@
 #include "ccsconversationevent.h"
 #include "ccsconversationcache.h"
 #include "ccscontactsmanager.h"
-
+#include "ccsbackuphandler.h"
 //Costant Declaration
 
 // ============================== MEMBER FUNCTIONS ============================
@@ -66,6 +66,33 @@
 }
 
 // ----------------------------------------------------------------------------
+// CCsServer::DeletePlugins
+// Unload the plugins for backup/restore
+// ----------------------------------------------------------------------------
+void CCsServer::DeletePlugins()
+{
+    if (iConversationPlugin) {
+        delete iConversationPlugin;
+        iConversationPlugin = NULL;
+    }
+}
+
+// ----------------------------------------------------------------------------
+// CCsServer::LoadPlugins
+// Load the plugins after a backup/restore
+// ----------------------------------------------------------------------------
+
+void CCsServer::LoadPlugins()
+{
+    iConversationPlugin = CCsPluginInterface::NewL();
+    // Create the plugin for the required entries
+    iConversationPlugin->InstantiatePluginL(this);
+    //fetch all initial set of messages
+    iConversationPlugin->GetConversationsL();
+    RefreshConversations();
+}
+
+// ----------------------------------------------------------------------------
 // CCsServer::ConstructL
 // Second phase constructor
 // ----------------------------------------------------------------------------
@@ -88,7 +115,9 @@
     iConversationCache = CCsConversationCache::NewL(iContactsManager, this);
 
     iCsCachingStatus = KCachingStatusUnknown;
-
+	
+    iBackUpHandler = CCsBackUpHandler::NewL(*this);
+    
     PRINT ( _L("End CCsServer::ConstructL") );
 }
 
@@ -121,6 +150,11 @@
         iContactsManager = NULL;
     }
 
+	if(iBackUpHandler)
+	{
+		delete iBackUpHandler;
+		iBackUpHandler = NULL;
+	}
     REComSession::FinalClose();
 
     PRINT ( _L("End CCsServer::~CCsServer") );
--- a/messagingapp/msgappfw/server/src/ccssession.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/server/src/ccssession.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -58,7 +58,16 @@
 // Construtor
 // ----------------------------------------------------------------------------
 CCsSession::CCsSession(CCsServer* aServer) :
-    iServer(aServer)
+    iServer(aServer),
+	    iDes(NULL),
+	    iMonitoredConversation(NULL),
+	    iBufferOverflow(EFalse),
+	    iGetConversationBufferOverflow( EFalse),
+	    iNotifyHandling(EFalse),
+	    iConversationListChangeObserver(EFalse),
+	    iConversationChangeObserver(EFalse),
+	    iCachingChangeObserver(EFalse),
+	    iReqCnt(1) //Let's start the event ID from 1    
 {
 }
 
@@ -70,21 +79,10 @@
 {
     PRINT ( _L("Enter CCsSession::ConstructL") );
 
-    iBufferOverflow = EFalse;
-    iGetConversationBufferOverflow = EFalse;
-    des = NULL;
-
-    iNotifyHandling = EFalse;
-    iConversationListChangeObserver = EFalse;
-    iConversationChangeObserver = EFalse;
-    iCachingChangeObserver = EFalse;
-    iMonitoredConversation = NULL;
 
     // initialize the event List
     iEventList = new (ELeave) RPointerArray<CCsConversationEvent> ();
 
-    iReqCnt = 1; //Let's start the event ID from 1
-
     PRINT ( _L("End CCsSession::ConstructL") );
 }
 
@@ -96,14 +94,14 @@
 {
     PRINT ( _L("Enter CCsSession::~CCsSession") );
 
-    if (des)
-    {
-        delete des;
-        des = NULL;
-    }
-
-    if (iEventList)
-    {
+    if ( iDes )
+        {
+        delete iDes;
+        iDes = NULL;
+        }
+		
+    if ( iEventList )
+        {
         iEventList->ResetAndDestroy();
         iEventList->Close();
         delete iEventList;
@@ -133,6 +131,12 @@
     // Check the error status returned
     if (errStatus != KErrNone)
     {
+        // Free memory.
+        if(iDes)
+            {
+            delete iDes;
+            iDes=NULL;
+            }
         aMessage.Complete(errStatus);
     }
 }
@@ -228,6 +232,11 @@
             PRINT ( _L("Received function EGetConversationIdFromAddress") )
             GetConversationIdfromAddressL(aMessage);
             break;
+
+        case EGetConversationFromConversationId:
+            PRINT ( _L("Received function EGetConversationFromConversationId") )
+            GetConversationFromConversationIdL(aMessage);
+            break;
 			
 		case EGetConversationFromMessageId:
             PRINT ( _L("Received function EGetConversationFromMessageId") )
@@ -249,6 +258,11 @@
 // ----------------------------------------------------------------------------
 void CCsSession::ServiceError(const RMessage2& aMessage, TInt aError)
 {
+    if(iDes)
+        {
+        delete iDes;
+        iDes=NULL;
+        }
     aMessage.Complete(aError);
 }
 
@@ -267,14 +281,13 @@
     {
         RPointerArray<CCsClientConversation>* ClientConversationList =
                 new (ELeave) RPointerArray<CCsClientConversation> ();
-
+        CleanupResetAndDestroyPushL(ClientConversationList);
         // get cache pointer
         CCsConversationCache* cache = iServer->ConversationCacheInterface();
 
         // Call cache function to get recent conversation entry list
         // with dispaly name for all stored conversation entry ID
         cache->GetConversationListL(ClientConversationList);
-        CleanupStack::PushL(ClientConversationList);
 
         //write all list data into stream
         // create a new buffer for writing into stream
@@ -309,24 +322,19 @@
 
         // --------------------------------------------------------------
         // Create a heap descriptor from the buffer
-        des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
-        TPtr8 ptr(des->Des());
+        iDes = HBufC8::NewL(buf->Size());
+        TPtr8 ptr(iDes->Des());
         buf->Read(0, ptr, buf->Size());
 
-        // cleanup
+        // Cleanup
         CleanupStack::PopAndDestroy(2, buf); // writestream, buf
-        CleanupStack::Pop(ClientConversationList);
-
-        // destroy objects inside list
-        ClientConversationList->ResetAndDestroy();
-        ClientConversationList->Close();
-        delete ClientConversationList;
-        ClientConversationList = NULL;
-    }
+        
+        // Cleanup ClientConversationList
+        CleanupStack::PopAndDestroy(ClientConversationList);
+        }
 
     TInt rcevdBufferSize = aMessage.GetDesMaxLength(1);
-    TInt reqdBufferSize = des->Size();
+    TInt reqdBufferSize  = iDes->Size();
 
     PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize );
     PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize );
@@ -349,13 +357,13 @@
         PRINT ( _L("Adequate buffer received") );
         PRINT ( _L("Packing the results in response") )
 
-        aMessage.Write(1, *des);
+        aMessage.Write(1, *iDes);
         aMessage.Complete(EGetConversationListOperationComplete);
         iBufferOverflow = EFalse;
-        delete des;
-        des = NULL;
-    }
-
+        delete iDes;
+        iDes = NULL;
+        }
+    
     PRINT_TIMESTAMP ("End CCsSession::GetConversationListL");
     PRINT ( _L("End CCsSession::GetConversationListL") );
 }
@@ -375,7 +383,7 @@
         {
         RPointerArray<CCsClientConversation>* ClientConversationList =
                 new (ELeave) RPointerArray<CCsClientConversation> ();
-
+        CleanupResetAndDestroyPushL(ClientConversationList);
         // get cache pointer
         CCsConversationCache* cache = iServer->ConversationCacheInterface();
 
@@ -383,8 +391,6 @@
         // with dispaly name for all stored conversation entry ID
         cache->GetConversationUnreadListL(ClientConversationList);
 
-        CleanupStack::PushL(ClientConversationList);
-
         //write all list data into stream
         // create a new buffer for writing into stream
         CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
@@ -417,24 +423,18 @@
 
         // --------------------------------------------------------------
         // Create a heap descriptor from the buffer
-        des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
-        TPtr8 ptr(des->Des());
+        iDes = HBufC8::NewL(buf->Size());
+        TPtr8 ptr(iDes->Des());
         buf->Read(0, ptr, buf->Size());
 
         // cleanup
         CleanupStack::PopAndDestroy(2, buf); // writestream, buf
-        CleanupStack::Pop(ClientConversationList);
+        CleanupStack::PopAndDestroy(ClientConversationList);
 
-        // destroy objects inside list
-        ClientConversationList->ResetAndDestroy();
-        ClientConversationList->Close();
-        delete ClientConversationList;
-        ClientConversationList = NULL;
         }
 
     TInt rcevdBufferSize = aMessage.GetDesMaxLength(1);
-    TInt reqdBufferSize  = des->Size();
+    TInt reqdBufferSize  = iDes->Size();
 
     PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize );
     PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize );
@@ -458,11 +458,11 @@
 
         TPckgC<TInt> overflowPackage(EFalse);
         aMessage.WriteL(0, overflowPackage);
-        aMessage.Write(1, *des);
+        aMessage.Write(1, *iDes);
         aMessage.Complete(KErrNone);
         iBufferOverflow = EFalse;
-        delete des;
-        des = NULL;
+        delete iDes;
+        iDes = NULL;
         }
 
     PRINT_TIMESTAMP ("End CCsSession::GetConversationUnreadListL");
@@ -502,9 +502,9 @@
         CleanupStack::PopAndDestroy(2, buffer);//stream, buffer
 
         CleanupStack::PushL(ClientConversation);
-        RPointerArray<CCsConversationEntry>* conversationEntryList =
-                new (ELeave) RPointerArray<CCsConversationEntry> ();
-        CleanupStack::PushL(conversationEntryList);
+        RPointerArray<CCsConversationEntry>* conversationEntryList=
+                new (ELeave) RPointerArray<CCsConversationEntry>(10);
+        CleanupResetAndDestroyPushL(conversationEntryList);
 
         // get conversationlist for given ClientConversation 
         cache->GetConversationsL(ClientConversation, conversationEntryList);
@@ -535,24 +535,19 @@
 
         // --------------------------------------------------------------
         // Create a heap descriptor from the buffer
-        des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
-        TPtr8 ptr(des->Des());
+        iDes = HBufC8::NewL(buf->Size());
+        TPtr8 ptr(iDes->Des());
         buf->Read(0, ptr, buf->Size());
 
         CleanupStack::PopAndDestroy(2, buf); // writestream, buf
-        CleanupStack::Pop(conversationEntryList);
-
+     
         // Cleanup
-        conversationEntryList->ResetAndDestroy();
-        conversationEntryList->Close();
-        delete conversationEntryList;
-        conversationEntryList = NULL;
+        CleanupStack::PopAndDestroy(conversationEntryList);
         CleanupStack::PopAndDestroy(ClientConversation);
     }
 
     TInt rcevdBufferSize = aMessage.GetDesMaxLength(1);
-    TInt reqdBufferSize = des->Size();
+    TInt reqdBufferSize  = iDes->Size();
 
     PRINT1 ( _L("Received buffer size = %d"), rcevdBufferSize );
     PRINT1 ( _L("Required buffer size = %d"), reqdBufferSize );
@@ -574,12 +569,12 @@
         PRINT ( _L("Adequate buffer received") );
         PRINT ( _L("Packing the results in response") )
 
-        aMessage.Write(1, *des);
+        aMessage.Write(1, *iDes);
         aMessage.Complete(EGetConversationOperationComplete);
         iGetConversationBufferOverflow = EFalse;
-        delete des;
-        des = NULL;
-    }
+        delete iDes;
+        iDes = NULL;
+        }
 
     PRINT ( _L("End CCsSession::GetConversationsL") );
 }
@@ -701,6 +696,57 @@
 }
 
 // ----------------------------------------------------------------------------
+// CCsSession::HandlePartialDeleteConversationListEventL
+// Notify client about partial delete conversation event
+// ----------------------------------------------------------------------------
+
+void CCsSession::HandlePartialDeleteConversationListEvent(
+                                                    CCsClientConversation* aClientConversation)
+{
+    PRINT ( _L("Enter CCsSession::HandlePartialDeleteConversationListEvent") );
+
+    if (!iConversationListChangeObserver)
+        return;
+    
+    if (! (iNotifyHandling))
+    {
+        //append in notify list
+        CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL();
+        conversationEvent->SetClientConversationL(*aClientConversation);
+        CleanupStack::PushL(conversationEvent);
+        conversationEvent->SetEvent(KConversationListEventPartialDelete);
+        iEventList->AppendL(conversationEvent);
+        CleanupStack::Pop(conversationEvent);
+    }
+    else
+    {
+        // create a new buffer for writing into stream
+        CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
+        CleanupStack::PushL(buf);
+
+        RBufWriteStream writeStream(*buf);
+        writeStream.PushL();
+
+        //externalize ClientConversation
+        aClientConversation->ExternalizeL(writeStream);
+
+        // Results are already packed in the stream
+        writeStream.CommitL();
+
+        // --------------------------------------------------------------
+        // Create a heap descriptor from the buffer
+        HBufC8* notifyDes = HBufC8::NewLC(buf->Size());
+        TPtr8 ptr(notifyDes->Des());
+        buf->Read(0, ptr, buf->Size());
+
+        iAsyncReqRMessage.Write(1, *notifyDes);
+        iAsyncReqRMessage.Complete(EPartialDeleteConversationListEvent);
+        CleanupStack::PopAndDestroy(3, buf); // notifyDes, writestream, buf
+        iNotifyHandling = EFalse;
+    }
+}
+
+// ----------------------------------------------------------------------------
 // CCsSession::HandleModifyConversationListEventL
 // Notify client about update conversation event
 // ----------------------------------------------------------------------------
@@ -865,8 +911,7 @@
     // --------------------------------------------------------------
 
     // Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewLC(buf->Size());
-    CleanupStack::Pop(des);
+    HBufC8* des = HBufC8::NewL(buf->Size());
     TPtr8 ptr(des->Des());
     buf->Read(0, ptr, buf->Size());
 
@@ -904,8 +949,7 @@
     // --------------------------------------------------------------
 
     // Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewLC(buf->Size());
-    CleanupStack::Pop(des);
+    HBufC8* des = HBufC8::NewL(buf->Size());
     TPtr8 ptr(des->Des());
     buf->Read(0, ptr, buf->Size());
 
@@ -1043,50 +1087,58 @@
     if (!iConversationChangeObserver)
         return;
 
-    if (aClientConversation->GetConversationEntryId()
-            != iMonitoredConversation->GetConversationEntryId())
-        return;
-
-    if (! (iNotifyHandling))
+    //this is check to send notif to clients for a new message
+    //1. if the client is subscribed with contact id ==> then send
+    //2. if the client is subscribed with conv id ---> then send
+    // else dont send
+    
+    if ((aClientConversation->GetContactId() == 
+            iMonitoredConversation->GetContactId() && 
+            aClientConversation->GetContactId() != -1)
+            ||(aClientConversation->GetConversationEntryId() == 
+                    iMonitoredConversation->GetConversationEntryId()))
     {
-        //append in notify list
-        CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL();
-        CleanupStack::PushL(conversationEvent);
-        conversationEvent->SetClientConversationL(*aClientConversation);
-        conversationEvent->SetEvent(KConversationEventNew);
-        iEventList->AppendL(conversationEvent);
-        CleanupStack::Pop(conversationEvent);
-    }
-    else
-    {
-        // create a new buffer for writing into stream
-        CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
-        CleanupStack::PushL(buf);
 
-        RBufWriteStream writeStream(*buf);
-        writeStream.PushL();
-
-        //externalize ClientConversation
-        aClientConversation->ExternalizeL(writeStream);
-
-        // Results are already packed in the stream
-        writeStream.CommitL();
-        // --------------------------------------------------------------
-
-        // Create a heap descriptor from the buffer
-        HBufC8* des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
-        TPtr8 ptr(des->Des());
-        buf->Read(0, ptr, buf->Size());
-
-        CleanupStack::PopAndDestroy(2, buf); // writestream, buf
-
-        iAsyncReqRMessage.Write(1, *des);
-        iAsyncReqRMessage.Complete(EAddConversationEvent);
-        delete des;
-        iNotifyHandling = EFalse;
+        if (! (iNotifyHandling))
+        {
+            //append in notify list
+            CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL();
+            CleanupStack::PushL(conversationEvent);
+            conversationEvent->SetClientConversationL(*aClientConversation);
+            conversationEvent->SetEvent(KConversationEventNew);
+            iEventList->AppendL(conversationEvent);
+            CleanupStack::Pop(conversationEvent);
+        }
+        else
+        {
+            // create a new buffer for writing into stream
+            CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
+            CleanupStack::PushL(buf);
+    
+            RBufWriteStream writeStream(*buf);
+            writeStream.PushL();
+    
+            //externalize ClientConversation
+            aClientConversation->ExternalizeL(writeStream);
+    
+            // Results are already packed in the stream
+            writeStream.CommitL();
+            // --------------------------------------------------------------
+    
+            // Create a heap descriptor from the buffer
+            HBufC8* des = HBufC8::NewLC(buf->Size());
+            CleanupStack::Pop(des);
+            TPtr8 ptr(des->Des());
+            buf->Read(0, ptr, buf->Size());
+    
+            CleanupStack::PopAndDestroy(2, buf); // writestream, buf
+    
+            iAsyncReqRMessage.Write(1, *des);
+            iAsyncReqRMessage.Complete(EAddConversationEvent);
+            delete des;
+            iNotifyHandling = EFalse;
+        }
     }
-
     PRINT ( _L("End CCsSession::HandleNewConversationEventL") );
 }
 
@@ -1103,8 +1155,11 @@
     if (!iConversationChangeObserver)
         return;
 
-    if (aClientConversation->GetConversationEntryId()
-            != iMonitoredConversation->GetConversationEntryId())
+    if ((aClientConversation->GetContactId()
+               != iMonitoredConversation->GetContactId()) &&
+               (aClientConversation->GetConversationEntryId()
+               != iMonitoredConversation->GetConversationEntryId())
+                 )
         return;
 
     if (! (iNotifyHandling))
@@ -1134,8 +1189,8 @@
         // --------------------------------------------------------------
 
         // Create a heap descriptor from the buffer
-        HBufC8* des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
+        HBufC8* des = HBufC8::NewL(buf->Size());
+
         TPtr8 ptr(des->Des());
         buf->Read(0, ptr, buf->Size());
 
@@ -1163,50 +1218,57 @@
     if (!iConversationChangeObserver)
         return;
 
-    if (aClientConversation->GetConversationEntryId()
-            != iMonitoredConversation->GetConversationEntryId())
-        return;
-
-    if (! (iNotifyHandling))
-    {
-        //append in notify list
-        CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL();
-        CleanupStack::PushL(conversationEvent);
-        conversationEvent->SetClientConversationL(*aClientConversation);
-        conversationEvent->SetEvent(KConversationEventUpdate);
-        iEventList->AppendL(conversationEvent);
-        CleanupStack::Pop(conversationEvent);
-    }
-    else
+    //this is check to send notif to clients for a new message
+    //1. if the client is subscribed with contact id ==> then send
+    //2. if the client is subscribed with conv id ---> then send
+    // else dont send
+    
+    if ((aClientConversation->GetContactId() == 
+                iMonitoredConversation->GetContactId() && 
+                aClientConversation->GetContactId() != -1)
+                ||(aClientConversation->GetConversationEntryId() == 
+                        iMonitoredConversation->GetConversationEntryId()))
     {
-        // create a new buffer for writing into stream
-        CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
-        CleanupStack::PushL(buf);
-
-        RBufWriteStream writeStream(*buf);
-        writeStream.PushL();
-
-        //externalize ClientConversation
-        aClientConversation->ExternalizeL(writeStream);
-
-        // Results are already packed in the stream
-        writeStream.CommitL();
-        // --------------------------------------------------------------
-
-        // Create a heap descriptor from the buffer
-        HBufC8* des = HBufC8::NewLC(buf->Size());
-        CleanupStack::Pop(des);
-        TPtr8 ptr(des->Des());
-        buf->Read(0, ptr, buf->Size());
-
-        CleanupStack::PopAndDestroy(2, buf); // writestream, buf
-
-        iAsyncReqRMessage.Write(1, *des);
-        iAsyncReqRMessage.Complete(EModifyConversationEvent);
-        delete des;
-        iNotifyHandling = EFalse;
+    
+        if (! (iNotifyHandling))
+        {
+            //append in notify list
+            CCsConversationEvent* conversationEvent = CCsConversationEvent::NewL();
+            CleanupStack::PushL(conversationEvent);
+            conversationEvent->SetClientConversationL(*aClientConversation);
+            conversationEvent->SetEvent(KConversationEventUpdate);
+            iEventList->AppendL(conversationEvent);
+            CleanupStack::Pop(conversationEvent);
+        }
+        else
+        {
+            // create a new buffer for writing into stream
+            CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
+            CleanupStack::PushL(buf);
+    
+            RBufWriteStream writeStream(*buf);
+            writeStream.PushL();
+    
+            //externalize ClientConversation
+            aClientConversation->ExternalizeL(writeStream);
+    
+            // Results are already packed in the stream
+            writeStream.CommitL();
+            // --------------------------------------------------------------
+    
+            // Create a heap descriptor from the buffer
+            HBufC8* des = HBufC8::NewL(buf->Size());
+            TPtr8 ptr(des->Des());
+            buf->Read(0, ptr, buf->Size());
+    
+            CleanupStack::PopAndDestroy(2, buf); // writestream, buf
+    
+            iAsyncReqRMessage.Write(1, *des);
+            iAsyncReqRMessage.Complete(EModifyConversationEvent);
+            delete des;
+            iNotifyHandling = EFalse;
+        }
     }
-
     PRINT ( _L("End CCsSession::HandleModifyConversationEventL") );
 }
 
@@ -1228,6 +1290,10 @@
     {
         iAsyncReqRMessage.Complete(EModifyConversationListEvent);
     }
+    else if(aConversationEvent->IsPartialDeleteConversationListEventSet())
+    {
+        iAsyncReqRMessage.Complete(EPartialDeleteConversationListEvent);
+    }
     else if (aConversationEvent->IsNewConversationEventSet())
     {
         iAsyncReqRMessage.Complete(EAddConversationEvent);
@@ -1269,6 +1335,10 @@
     {
         HandleDeleteConversationListEventL(aConversation);
     }
+    else if(aEvent & KConversationListEventPartialDelete)
+    {
+        HandlePartialDeleteConversationListEvent(aConversation);
+    }
     else if (aEvent & KConversationEventNew)
     {
         HandleNewConversationEventL(aConversation);
@@ -1303,7 +1373,7 @@
     // Delete handler
     CCsConversationCache* cache = iServer->ConversationCacheInterface();
     CCsConversationDeleteHandler* deleteHandler =
-            CCsConversationDeleteHandler::NewL(cache, this);
+            CCsConversationDeleteHandler::NewL(cache);
 
     deleteHandler->DeleteL(conversationId);
     aMessage.Complete(EUserDeleteConversationComplete);
@@ -1312,22 +1382,6 @@
 }
 
 // ----------------------------------------------------------------------------
-// CCsSession::DeleteComplete
-// ----------------------------------------------------------------------------
-void CCsSession::DeleteComplete(CCsConversationDeleteHandler* aHandler)
-{
-    delete aHandler;
-}
-
-// ----------------------------------------------------------------------------
-// CCsSession::DeleteInProgress
-// ----------------------------------------------------------------------------
-void CCsSession::DeleteInProgress(CCsConversationDeleteHandler* aHandler)
-{
-    delete aHandler;
-}
-
-// ----------------------------------------------------------------------------
 // CCsSession::HandleRefreshConversationListL
 // ----------------------------------------------------------------------------
 void CCsSession::HandleRefreshConversationListL()
@@ -1399,8 +1453,7 @@
     writeStream.CommitL();
 
     // Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewLC(buf->Size());
-    CleanupStack::Pop(des);
+    HBufC8* des = HBufC8::NewL(buf->Size());
     TPtr8 ptr(des->Des());
     buf->Read(0, ptr, buf->Size());
 
@@ -1411,6 +1464,57 @@
     delete des;
 }
 
+void CCsSession::GetConversationFromConversationIdL(const RMessage2& aMessage)
+{
+    // create a new buffer for writing into stream
+    CBufFlat* buf = CBufFlat::NewL(KBigBuffer);
+    CleanupStack::PushL(buf);
+
+    RBufWriteStream writeStream(*buf);
+    writeStream.PushL();
+
+    // Get the conversation id
+    TInt conversationId = aMessage.Int0();
+    CCsConversationCache* cache = iServer->ConversationCacheInterface();
+    CCsClientConversation* clientConv = cache->GetConversationFromConversationIdL(conversationId);
+
+    // if no conversation exists for given message-id,
+    // create a dummy conversation and complete response
+    if(clientConv == NULL)
+    {
+        //create dummy conversation
+        clientConv = CCsClientConversation::NewL();
+        CleanupStack::PushL(clientConv);
+        clientConv->SetConversationEntryId(-1);
+        CCsConversationEntry* entry = CCsConversationEntry::NewL();
+        CleanupStack::PushL(entry);
+        entry->SetEntryId(-1);
+        clientConv->SetConversationEntryL(entry); // clone
+        CleanupStack::PopAndDestroy(entry);
+    }
+    else
+    {
+        CleanupStack::PushL(clientConv);
+    }
+
+    // Externalize
+    clientConv->ExternalizeL(writeStream);
+
+    // Results are already packed in the stream
+    writeStream.CommitL();
+
+    // Create a heap descriptor from the buffer
+    HBufC8* des = HBufC8::NewL(buf->Size());
+    TPtr8 ptr(des->Des());
+    buf->Read(0, ptr, buf->Size());
+
+    CleanupStack::PopAndDestroy(3, buf); // clientConv, writestream, buf
+
+    aMessage.Write(1, *des);
+    aMessage.Complete(EGetConversationFromConversationIdComplete);
+    delete des;
+}
+
 // ----------------------------------------------------------------------------
 // GetConversationFromMessageIdL
 // ----------------------------------------------------------------------------
@@ -1454,8 +1558,7 @@
     writeStream.CommitL();
     
     // Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewLC(buf->Size());
-    CleanupStack::Pop(des);
+    HBufC8* des = HBufC8::NewL(buf->Size());
     TPtr8 ptr(des->Des());
     buf->Read(0, ptr, buf->Size());
     
@@ -1497,8 +1600,7 @@
     writeStream.CommitL();
 
     // Create a heap descriptor from the buffer
-    HBufC8* des = HBufC8::NewLC(buf->Size());
-    CleanupStack::Pop(des);
+    HBufC8* des = HBufC8::NewL(buf->Size());
     TPtr8 ptr(des->Des());
     buf->Read(0, ptr, buf->Size());
  
@@ -1521,8 +1623,7 @@
 
     // Mark read handler
     CCsConversationCache* cache = iServer->ConversationCacheInterface();
-    CCsConversationMarkReadHandler* markHandler = 
-        CCsConversationMarkReadHandler::NewL(cache, this);
+    CCsConversationMarkReadHandler* markHandler = CCsConversationMarkReadHandler::NewL(cache);
 
     markHandler->MarkReadL(conversationId);
     
@@ -1530,13 +1631,4 @@
 
     PRINT ( _L("End CCsSession::MarkConversationReadL") );
 }
-
-// ----------------------------------------------------------------------------
-// CCsSession::MarkReadComplete
-// ----------------------------------------------------------------------------
-void CCsSession::MarkReadComplete(CCsConversationMarkReadHandler* aHandler)
-{
-    delete aHandler;
-}
-
 //EOF
--- a/messagingapp/msgappfw/sis/conversation_server.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/sis/conversation_server.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -20,7 +20,6 @@
 
 ; Conversation Server
 "\epoc32\release\armv5\urel\csserver.exe" 	- "!:\sys\bin\csserver.exe"
-"\epoc32\data\z\resource\cscontacts.rsc" 	- "!:\resource\cscontacts.rsc"
 "\epoc32\release\armv5\urel\csserverclientapi.dll" 	- "!:\sys\bin\csserverclientapi.dll"
 "\epoc32\release\armv5\urel\csutils.dll" 		- "!:\sys\bin\csutils.dll"
 
--- a/messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/sis/messaging_armv5_udeb.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -49,6 +49,5 @@
 
 ; Conversation Server
 "\epoc32\release\armv5\udeb\csserver.exe" 		- "!:\sys\bin\csserver.exe"
-"\epoc32\data\z\resource\cscontacts.rsc" 		- "!:\resource\cscontacts.rsc"
 "\epoc32\release\armv5\udeb\csserverclientapi.dll" 	- "!:\sys\bin\csserverclientapi.dll"
 "\epoc32\release\armv5\udeb\csutils.dll" 		- "!:\sys\bin\csutils.dll"
--- a/messagingapp/msgappfw/sis/messaging_armv5_urel.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/sis/messaging_armv5_urel.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,6 @@
 
 ; Conversation Server
 "\epoc32\release\armv5\urel\csserver.exe" 	- "!:\sys\bin\csserver.exe"
-"\epoc32\data\z\resource\cscontacts.rsc" 	- "!:\resource\cscontacts.rsc"
 "\epoc32\release\armv5\urel\csserverclientapi.dll" 	- "!:\sys\bin\csserverclientapi.dll"
 "\epoc32\release\armv5\urel\csutils.dll" 		- "!:\sys\bin\csutils.dll"
 
--- a/messagingapp/msgappfw/sis/rd-key.pem	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/sis/rd-key.pem	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,15 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4
-6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh
-7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB
-gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX
-pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB
-yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j
-KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003
-iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3
-2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+
-9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0
-aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO
-TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8
-mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ=
------END RSA PRIVATE KEY-----
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4
+6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh
+7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB
+gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX
+pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB
+yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j
+KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003
+iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3
+2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+
+9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0
+aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO
+TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8
+mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ=
+-----END RSA PRIVATE KEY-----
--- a/messagingapp/msgappfw/sis/rd.cer	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/sis/rd.cer	Fri Jun 25 15:47:40 2010 +0530
@@ -1,17 +1,17 @@
------BEGIN CERTIFICATE-----
-MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD
-ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z
-NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl
-cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT
-rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa
-gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI
-f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL
-BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud
-IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD
-ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd
-IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE
-IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G
-CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9
-Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT
-7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR
------END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z
+NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl
+cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT
+rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa
+gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI
+f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL
+BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud
+IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd
+IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE
+IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G
+CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9
+Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT
+7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR
+-----END CERTIFICATE-----
--- a/messagingapp/msgappfw/utils/src/ccsconversationentry.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/utils/src/ccsconversationentry.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -135,12 +135,9 @@
 // Sets the Conversation contact of this object
 // ----------------------------------------------------------------------------
 EXPORT_C void CCsConversationEntry::SetContactL(const TDesC& aContact)
-    {
-    if((&aContact))
-        {
-        iContact = aContact.AllocL();
-        }
-    }
+{
+    iContact = aContact.AllocL();
+}
 
 // ----------------------------------------------------------------------------
 // CCsConversationEntry::ConversationDir
@@ -211,17 +208,15 @@
 // Sets the Conversation description of this object
 // ----------------------------------------------------------------------------
 EXPORT_C void CCsConversationEntry::SetDescriptionL(const TDesC& aDescription)
-    {
-    if((&aDescription))
-        {
-        TInt descrLength = aDescription.Length();
-        if ( descrLength > KMaxDescrSize )
-            descrLength = KMaxDescrSize;
-        
-        iDescription = HBufC::NewL(descrLength);
-        iDescription->Des().Copy(aDescription.Left(descrLength));
-        }
-    }
+{
+
+    TInt descrLength = aDescription.Length();
+    if (descrLength > KMaxDescrSize)
+        descrLength = KMaxDescrSize;
+    iDescription = HBufC::NewL(descrLength);
+    iDescription->Des().Copy(aDescription.Left(descrLength));
+
+}
 
 // ----------------------------------------------------------------------------
 // CCsConversationEntry::ChangeAttributes
@@ -255,13 +250,16 @@
     CCsConversationEntry* cloneObject = CCsConversationEntry::NewL();
     CleanupStack::PushL(cloneObject);
 
-    cloneObject->SetContactL(*iContact);
+    if (iContact)
+        cloneObject->SetContactL(*iContact);
+
     cloneObject->SetConversationDir(iConversationDir);
     cloneObject->SetType(iConversationType);
     cloneObject->SetEntryId(iEntryID);
     cloneObject->SetSendState(iConversationStatus);
     cloneObject->ChangeAttributes(iConversationAttrib, ECsAttributeNone);
-    cloneObject->SetDescriptionL(*iDescription);
+    if(iDescription)
+        cloneObject->SetDescriptionL(*iDescription);
     cloneObject->SetTimeStampL(iTimeStamp);
 
     CleanupStack::Pop(cloneObject);
--- a/messagingapp/msgappfw/utils/src/ccsdebug.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgappfw/utils/src/ccsdebug.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -69,19 +69,14 @@
 	  	dbgArr = static_cast<CCsDebugArr*>( Dll::Tls() );
 	}
 
-    if ( dbgArr->IsEmpty() )
-    {
-        delete dbgArr;
-        Dll::SetTls( NULL );
-    }
-    else
+    if ( dbgArr && !(dbgArr->IsEmpty()) )
     {
     	CCsDebug* dbg = dbgArr->Pop();
 		dbg->UnMark(str);
 		delete dbg;			  	
     }
     
-    if ( !dbgArr && dbgArr->IsEmpty() )
+    if ( dbgArr && dbgArr->IsEmpty() )
     {
         delete dbgArr;
         Dll::SetTls( NULL );
--- a/messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgerrornotifier/inc/msgerrornotifiersvc.h	Fri Jun 25 15:47:40 2010 +0530
@@ -21,6 +21,9 @@
 #include <xqserviceprovider.h>
 #include <qvariant.h>
 
+//Forward Declaration
+class XQSystemToneService;
+
 class MsgErrorNotifierSvc: public XQServiceProvider
 {
 
@@ -46,6 +49,12 @@
      */
     void displayErrorNote(QVariantList displayParams);
 
+private:
+    
+    /**
+     * Object to handle audio alerts
+     */
+    XQSystemToneService* mSts;
 };
 
 #endif /* MSGERRORNOTIFIERSVC_H_ */
--- a/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgerrornotifier/msgerrornotifier.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,8 @@
            src/msgerrornotifiersvc.cpp
            
 LIBS += -lxqservice \
-	    -lxqserviceutil
+	    -lxqserviceutil \
+	    -lxqsystemtoneservice
 
 SERVICE.FILE = service_conf.xml
 SERVICE.OPTIONS = embeddable
@@ -33,6 +34,7 @@
 
 symbian:TARGET.UID3 = 0x2001FE74
 
+TRANSLATIONS = messaging.ts
 
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
                              ".\rom\msgerrornotifier.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgerrornotifier.iby)"
--- a/messagingapp/msgnotifications/msgerrornotifier/src/main.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgerrornotifier/src/main.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -14,14 +14,30 @@
  * Description: 
  *
  */
+#include <QTranslator>
+#include <QLocale>
+#include <QFile>
+#include <hbapplication.h>
 
 #include "msgerrornotifier.h"
 
-#include <hbapplication.h>
+#define LOC_TITLE hbTrId("")
 
 int main(int argc, char *argv[])
 {
-    HbApplication a(argc, argv);
+    HbApplication app(argc, argv);
+    QString locale = QLocale::system().name();
+    QString path = "z:/resource/qt/translations/";
+    QTranslator translator;
+    QTranslator translator_comm;
+    translator.load(path + QString("messaging_") + locale);
+    translator_comm.load(path + QString("common_") + locale);
+    //translator.load( "messaging_en_GB", ":/translations" );
+    app.installTranslator(&translator);
+    app.installTranslator(&translator_comm);
+
+    app.setApplicationName(LOC_TITLE);
+    
     MsgErrorNotifier w;
-    return a.exec();
+    return app.exec();
 }
--- a/messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgerrornotifier/src/msgerrornotifiersvc.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,17 +25,20 @@
 #include <xqaiwrequest.h>
 #include <xqappmgr.h>
 #include <ccsdefs.h>
+#include <qaction.h>
+#include <xqsystemtoneservice.h>
 
 #define LOC_VIEW hbTrId("txt_messaging_button_view")
 #define LOC_CANCEL hbTrId("txt_common_button_cancel")
 #define LOC_SEND_FAILURE hbTrId("txt_messaging_list_message_sending_failed")
-
+#define LOC_MMS_RETRIEVAL_FAILED hbTrId("txt_messaging_dialog_mms_retrieval_failed")
 //---------------------------------------------------------
 // Constructor
 //---------------------------------------------------------
 MsgErrorNotifierSvc::MsgErrorNotifierSvc(QObject* parent) :
     XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.MsgErrorNotifier"), parent)
 {
+    mSts = new XQSystemToneService();
     publishAll();
 
 }
@@ -44,7 +47,11 @@
 //---------------------------------------------------------
 MsgErrorNotifierSvc::~MsgErrorNotifierSvc()
 {
-
+    if(mSts)
+        {
+        delete mSts;
+        mSts = NULL;
+        }
 }
 
 //---------------------------------------------------------
@@ -66,7 +73,7 @@
     int msgType = third.toInt();
     if (msgType == ECsMmsNotification)
     {
-        errorNote.append("Message Retrieval Failed!");//TODO: use logical str name
+        errorNote.append(LOC_MMS_RETRIEVAL_FAILED);
     }
     else
     {
@@ -79,19 +86,22 @@
     
     messageBox.setTimeout(HbPopup::NoTimeout);
     messageBox.setText(errorNote);
-    HbAction* actionView = new HbAction(LOC_VIEW);
-    messageBox.setPrimaryAction(actionView);
+    QAction* actionView = new QAction(LOC_VIEW,this);
+    messageBox.setAction(actionView,HbDeviceMessageBox::AcceptButtonRole);
 
-    HbAction* actionQuit = new HbAction(LOC_CANCEL);
-    actionQuit->setCommandRole(HbAction::QuitRole);
-    messageBox.setSecondaryAction(actionQuit);
+    QAction* actionQuit = new QAction(LOC_CANCEL,this);
+    messageBox.setAction(actionQuit,HbDeviceMessageBox::RejectButtonRole);
 
     setCurrentRequestAsync();
 
-    HbAction* result = messageBox.exec();
-
-    // TODO: use XQAiwrequest
-    if (result->commandRole() != HbAction::QuitRole) {
+    //Play audio alert when error notification is shown
+    mSts->playTone(XQSystemToneService::MessageSendFailureTone);
+    
+    // launch Messagebox
+    const QAction* result = messageBox.exec();
+  
+    // if accepted launch view else quit
+    if (messageBox.isAcceptAction(result)) {
         QList<QVariant> args;
         QString serviceName("com.nokia.services.hbserviceprovider");
         QString operation("open(qint64)");
--- a/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicatorplugin.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/inc/msgindicatorplugin.h	Fri Jun 25 15:47:40 2010 +0530
@@ -54,7 +54,7 @@
      * @see HbIndicatorPluginInterface
      */
     bool accessAllowed(const QString &indicatorType,
-                               const HbSecurityInfo *securityInfo) const;   
+        const QVariantMap& securityInfo) const;   
     /**
      * @see HbIndicatorPluginInterface
      */
--- a/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/msgindicatorplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,7 @@
 DEPENDPATH += .
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 INCLUDEPATH += ../../../inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
+
 
 
 HEADERS += inc/msgindicatorplugin.h \
@@ -53,5 +53,5 @@
   
  LIBS += -lxqservice \
  		 -lcsserverclientapi \
-         -ls60qconversions \
-         -lcsutils
+         -lcsutils \
+         -lxqutils
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -41,7 +41,8 @@
 #define LOC_FAILED_MULTIPLE_MESSAGES hbTrId("Failed Messages")
 #define LOC_OUTGOING_SINGLE_MESSAGE hbTrId("Outgoing Message")
 #define LOC_OUTGOING_MULTIPLE_MESSAGES hbTrId("Outgoing Messages")
-
+#define STATUS_MONO_NEW_MESSAGE QString("qtg_status_new_message")
+#define LOC_BUSINESSCARD hbTrId("Business card")
 /**
  * The number of indicators.
  */
@@ -116,7 +117,7 @@
 // @see msgindicator.h
 // ----------------------------------------------------------------------------
 MsgIndicator::MsgIndicator(const QString &indicatorType) :
-    HbIndicatorInterface(indicatorType, HbIndicatorInterface::GroupPriorityHigh,
+    HbIndicatorInterface(indicatorType, HbIndicatorInterface::NotificationCategory,
         InteractionActivated),
 		mIndicatorType(NULL)
 {
@@ -165,8 +166,18 @@
     }
     case DecorationNameRole:
     {
-        return IndicatorInfo[mIndicatorType].icon;
-
+        return IndicatorInfo[mIndicatorType].icon;        
+    }
+    case MonoDecorationNameRole:
+    {
+        if (NewIndicatorPlugin == mIndicatorType) {
+            return STATUS_MONO_NEW_MESSAGE;
+        }
+        else {
+            // Don't show status-bar icons for indications other 
+			// than new-message
+            return QVariant();
+        }
     }
     default:
         return QVariant();
@@ -309,6 +320,9 @@
                 QFileInfo fname(secondaryText);
                 secondaryText = fname.fileName();
             }
+            else if(ECsBioMsg_VCard == info.mMessageType) {
+            secondaryText = LOC_BUSINESSCARD;
+            }
         }
         else {
             info.mConversationId = -100;
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicator_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,7 +22,7 @@
 #include "msgindicator_p.h"  
 #include "msgindicator.h"
 #include "debugtraces.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 #define LOC_RECEIVED_FILES hbTrId("Received Files")
 
@@ -98,7 +98,7 @@
             // Only take the description from convEntry when there is one entry.
             // description will contain the name list when there are more entries.
             QString descText;
-            descText = S60QConversions::s60DescToQString(*description);
+            descText = XQConversions::s60DescToQString(*description);
             descText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
             descText.replace('\r', QChar::LineSeparator);
             indicatorData.mDescription = descText;
@@ -116,10 +116,10 @@
             HBufC* number = convEntry->Contact();
 
             if (displayName) {
-                nameList.append(S60QConversions::s60DescToQString(*displayName));
+                nameList.append(XQConversions::s60DescToQString(*displayName));
             }
             else if (number) {
-                nameList.append(S60QConversions::s60DescToQString(*number));
+                nameList.append(XQConversions::s60DescToQString(*number));
             }
         }
     }
@@ -134,7 +134,7 @@
         indicatorData.mDescription = nameList.join(QString(", "));
         indicatorData.mMessageType = ECsSMS;
     }
-    else{
+    else if (nameList.count() == 1){
         // only 1 sender.
         // displayname will have the name of the sender.
         // description will contain latest message if more than 1 message
--- a/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgindicatorplugin/src/msgindicatorplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -23,7 +23,6 @@
 #include <QtPlugin>
 #include <QVariant>
 
-Q_EXPORT_PLUGIN(MsgIndicatorPlugin)
 
 // ----------------------------------------------------------------------------
 // MsgIndicatorPlugin::MsgIndicatorPlugin
@@ -62,7 +61,7 @@
 // @see msgindicatorplugin.h
 // ----------------------------------------------------------------------------
 bool MsgIndicatorPlugin::accessAllowed(const QString &indicatorType,
-    const HbSecurityInfo *securityInfo) const
+    const QVariantMap& securityInfo) const
 {
     Q_UNUSED(indicatorType)
     Q_UNUSED(securityInfo)
@@ -109,3 +108,5 @@
     }
     return -1;
 }
+
+Q_EXPORT_PLUGIN2(msgindicatorplugin,MsgIndicatorPlugin)
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -32,8 +32,6 @@
 SOURCES += src/msgnotificationdialogplugin.cpp
 SOURCES += src/msgnotificationdialogwidget.cpp
 
-RESOURCES += msgnotificationdialogplugin.qrc
-
 symbian: {
     TARGET.EPOCALLOWDLLDATA = 1
     TARGET.CAPABILITY = CAP_GENERAL_DLL
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/msgnotificationdialogplugin.qrc	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<RCC>
-    <qresource prefix="/" >
-        <file alias="sms.svg" >resources/sms.svg</file>
-        <file alias="mms.svg" >resources/mms.svg</file>  
-        <file alias="ringingtone.svg" >resources/ringingtone.svg</file> 
-    </qresource>
-</RCC>
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/mms.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg width="60" height="80" viewBox="0 0 60 80">
-<linearGradient id="_16" gradientUnits="userSpaceOnUse" x1="29.07" y1="41.3" x2="44.55" y2="71.79">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_16)" d="M49.016,37.091c0.002-0.243,0.18-14.048,0.18-14.048s-13.2-2.759-13.444-2.81 c-0.146-0.191-3.754-4.769-3.754-4.769s-3.308,3.02-3.552,3.242c-0.341-0.071-12.516-2.615-12.516-2.615L13,16.895 c0,0,0.193,4.464,0.236,5.455c-0.487-0.268-1.092-0.601-1.092-0.601c-2.808-1.516-5.711-3.083-6.703-6.004l-0.094-0.277 L3.418,15.76L2.31,16.677c0,0,7.204,21.364,7.46,22.125c-0.023,0.003-0.091,0.011-0.091,0.011 c-2.993,0.54-5.909,3.611-6.502,6.846c-0.072,0.392-0.108,0.774-0.108,1.143c0,1.214,0.385,2.272,1.114,3.005 c0.866,0.87,2.125,1.209,3.544,0.955c1.581-0.285,3.172-1.313,4.425-2.76c0.089,1.518,0.754,12.864,0.754,12.864l34.567,9.214 l2.23-2.29l1.248-28.238C50.952,39.552,49.156,37.27,49.016,37.091z M12.067,34.596c0.014,0.248,0.062,1.048,0.062,1.048 l-0.681,0.132L8.188,26.1l0.466-0.02c2.116-0.089,3.901,0.234,5.307,0.96l0.18,0.093l0.232,5.357 C14.373,32.492,12.286,34.396,12.067,34.596z"/>
-<linearGradient id="_17" gradientUnits="userSpaceOnUse" x1="31.15" y1="21.14" x2="31.15" y2="52.27">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<polygon fill="url(#_17)" points="50.598,39.666 48.663,37.21 48.841,23.327 46.32,24.611 46.262,34.159 31.949,15.976 11.708,34.45 29.276,59.111 "/>
-<linearGradient id="_18" gradientUnits="userSpaceOnUse" x1="9.88" y1="14.78" x2="50.13" y2="25.08">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_18)" points="46.32,24.611 48.841,23.327 15.934,16.451 13.534,17.135 "/>
-<linearGradient id="_19" gradientUnits="userSpaceOnUse" x1="44.2" y1="53.45" x2="25.56" y2="27.32">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_19)" points="44.98,52.053 15.814,42.759 14.786,18.917 45.296,25.875 "/>
-<linearGradient id="_20" gradientUnits="userSpaceOnUse" x1="42.72" y1="62.47" x2="25.68" y2="41.62">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_20)" d="M15.698,39.176c2.905,1.69,8.717,4.592,8.717,4.592l10.229,1.852 c6.33-1.096,9.934,2.101,9.934,2.101L44.57,55.99l-28.473-9.07L15.698,39.176z"/>
-<path fill="#FFFFFF" d="M14.698,25.884l12.66,3.574c0,0,0.498-4.445,0.514-4.448c-1.134-3.994-5.332-3.909-6.059-2.261 c-2.441-2.681-4.211,0.478-4.211,0.478l-3.105-0.808L14.698,25.884z"/>
-<linearGradient id="_21" gradientUnits="userSpaceOnUse" x1="69.49" y1="77.01" x2="12.49" y2="17.68">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<path fill="url(#_21)" d="M13.36,17.158l1.343,31.076L46.004,58.2l0.346-33.523L13.36,17.158z M44.502,55.311l-28.479-9.062 l-0.954-26.913l29.71,6.763L44.502,55.311z"/>
-<path fill="#115B7E" d="M37.396,41.982c0,0-14.091-2.843-16.311-2.398l3.277,2.841C26.026,43.034,34,44.227,34,44.227 L37.396,41.982z"/>
-<polygon fill="#BFDAE1" points="26.558,40.739 28.2,40.902 31.15,43.898 29.417,43.736 "/>
-<path fill="#298595" d="M24.368,42.408l-3.275-2.861c-0.738,4.539,6.156,6.268,8.631,6.871c5.781,1.275,7.03-1.984,7.668-4.45 C35.027,45.823,25.01,42.932,24.368,42.408z"/>
-<path fill="#CFECFF" d="M21.09,39.568l3.275,2.907c9.263,3.502,11.865,1.424,13.027-0.507 C34.404,41.021,23.302,39.122,21.09,39.568z M24.622,42.031l-2.455-2.148c1.853-0.195,12.074,1.387,14.62,2.193 C35.422,43.964,31.639,44.707,24.622,42.031z"/>
-<linearGradient id="_22" gradientUnits="userSpaceOnUse" x1="28.28" y1="32.08" x2="17.62" y2="31.3">
-<stop stop-color="#2B98A0" offset="0"/>
-<stop stop-color="#0A4A60" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_22)" points="28.434,41.582 28.821,22.619 20.849,36.979 "/>
-<polygon fill="#2F8E9A" points="29.49,42.729 28.971,26.357 34.188,42.412 "/>
-<linearGradient id="_23" gradientUnits="userSpaceOnUse" x1="48.98" y1="41.75" x2="48.98" y2="77.75">
-<stop stop-color="#DEE9F3" offset="0"/>
-<stop stop-color="#235487" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_23)" points="47.365,69.689 49.359,67.643 50.598,39.666 47.848,41.723 "/>
-<linearGradient id="_24" gradientUnits="userSpaceOnUse" x1="14.35" y1="22.25" x2="34.6" y2="43.5">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_24)" points="47.848,41.723 33.469,50.964 28.481,49.768 11.708,34.447 27.026,51.219 32.658,52.456 "/>
-<linearGradient id="_25" gradientUnits="userSpaceOnUse" x1="41.79" y1="6.95" x2="19.04" y2="90.7">
-<stop stop-color="#FFFFFF" offset="0.15"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_25)" points="47.848,41.723 32.441,52.41 26.95,50.989 11.708,34.45 13.241,60.593 47.365,69.689 "/>
-<linearGradient id="_26" gradientUnits="userSpaceOnUse" x1="5.62" y1="67.79" x2="25.37" y2="51.04">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.53"/>
-<stop stop-color="#6C83BB" offset="0.87"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_26)" points="13.255,60.582 25.621,49.561 26.919,50.98 "/>
-<linearGradient id="_27" gradientUnits="userSpaceOnUse" x1="49.93" y1="73.86" x2="35.68" y2="54.87">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.53"/>
-<stop stop-color="#6C83BB" offset="0.87"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<polygon fill="url(#_27)" points="47.384,69.659 34.361,51.236 32.441,52.41 "/>
-<linearGradient id="_28" gradientUnits="userSpaceOnUse" x1="20.65" y1="0.35" x2="1.28" y2="57.72">
-<stop stop-color="#E6EEF4" offset="0"/>
-<stop stop-color="#A3740A" offset="0.44"/>
-<stop stop-color="#474105" offset="0.94"/>
-</linearGradient>
-<path fill="url(#_28)" d="M18.344,27.406C16.046,22.166,7.092,21.7,5.107,15.857c0-0.001-0.916,0.818-0.916,0.818 l7.613,22.598l2.155,2.863l-6.151-18.26l9.799,4.177c0,0,0.716,10.753,0.708,10.754l0.507-0.613 C19.839,34.412,19.658,29.728,18.344,27.406z"/>
-<polygon fill="#6D5607" points="2.719,16.793 4.183,16.679 5.106,15.858 3.566,16.091 "/>
-<path fill="#6D5607" d="M17.695,28.032c-3.77-6.2-10.994-4.212-13.51-11.337l-1.467,0.099l7.516,22.292l1.569,0.189L7.505,26.499 c9.891-1.063,10.806,6.229,9.826,12.022l0.992,0.286C19.276,35.021,19.036,30.337,17.695,28.032z"/>
-<radialGradient id="_29" gradientUnits="userSpaceOnUse" cx="8.12" cy="44.13" r="4.15">
-<stop stop-color="#E6EEF4" offset="0"/>
-<stop stop-color="#A3740A" offset="0.44"/>
-<stop stop-color="#474105" offset="0.94"/>
-</radialGradient>
-<path fill="url(#_29)" d="M13.886,43.857c-0.572,3.104-3.355,6.041-6.22,6.56c-2.86,0.513-4.717-1.59-4.144-4.694 c0.57-3.104,3.355-6.048,6.22-6.563C12.602,38.646,14.459,40.745,13.886,43.857z"/>
-<linearGradient id="_30" gradientUnits="userSpaceOnUse" x1="11" y1="25.7" x2="6.63" y2="3.59">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_30)" d="M14.016,32.378l-0.2-5.026c-2.068-1.156-5.16-0.934-5.16-0.934l3.136,9.274l-0.083-1.242 L14.016,32.378z M9.186,26.812c0,0,2.604-0.188,4.347,0.787l0.168,4.58l-2.042,1.868L9.186,26.812z"/>
-</svg>
\ No newline at end of file
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/ringingtone.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg width="84" height="58" viewBox="0 0 84 58">
-<linearGradient id="_63" gradientUnits="userSpaceOnUse" x1="58.89" y1="32.29" x2="47.46" y2="54.8">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_63)" d="M50.352,2.42l-0.033,0.031h-0.021c-5.285,0.285-9.418,11.98-9.418,26.625 c0,14.652,3.979,26.092,9.34,26.643h4.996c2.131,0,4.117-1.807,5.758-5.184c0.346-0.199,11.242-6.574,11.441-6.697 c0.359,0.002,3.687,0.006,4.562,0.006c1.478,0,3.543-0.817,5.007-4.725c0.941-2.527,1.467-5.91,1.467-9.523 c0-6.525-1.715-13.109-5.547-13.109c0,0-4.617-0.059-5.055-0.064C72.563,16.205,60.8,7.319,60.8,7.319 c-1.607-3.166-3.521-4.902-5.59-4.902C55.211,2.416,50.352,2.42,50.352,2.42z M71.582,42.778l-0.012-0.005 c0,0,0.014-0.013,0.016-0.013C71.584,42.768,71.584,42.773,71.582,42.778z"/>
-<linearGradient id="_64" gradientUnits="userSpaceOnUse" x1="23.27" y1="39.8" x2="29.04" y2="51.16">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_64)" d="M17.562,28.336c0,0,0.029,15.633,0.029,17.166c-2.504-0.234-5.418,1.236-6.758,3.471 c-0.734,1.229-0.873,2.525-0.377,3.566c0.467,1,1.451,1.66,2.746,1.858c2.557,0.392,5.662-1.121,7.057-3.444 c0.439-0.729,0.66-1.488,0.66-2.215c0-0.105,0-9.92,0.004-10.86c0.828-0.254,8.742-2.697,10.209-3.144 c0.006,1.358,0.025,6.089,0.029,7.347c-2.527-0.289-5.496,1.203-6.854,3.457c-0.732,1.223-0.877,2.526-0.385,3.564 c0.469,1.005,1.449,1.662,2.742,1.859c2.564,0.397,5.672-1.117,7.061-3.445c0.475-0.791,0.705-1.629,0.654-2.426 c0.027,0.082,0.031-21.328,0.031-21.328L17.562,28.336z M20.912,33.031l0.037-1.875l10.15-3l0.037,1.969L20.912,33.031z"/>
-<linearGradient id="_65" gradientUnits="userSpaceOnUse" x1="8.43" y1="17.5" x2="13.41" y2="27.31">
-<stop stop-color="#A2C2DD" offset="0.1"/>
-<stop stop-color="#6C83BB" offset="0.71"/>
-<stop stop-color="#003D6D" offset="0.99"/>
-</linearGradient>
-<path fill="url(#_65)" d="M10.357,4.115c0,0,0.059,15.676,0.066,17.59c-0.09-0.043-0.285-0.129-0.285-0.129 c-2.498-0.621-5.703,0.594-7.293,2.768c-0.832,1.143-1.09,2.414-0.699,3.486c0.375,1.03,1.277,1.771,2.543,2.088 c2.496,0.621,5.699-0.594,7.291-2.764c0.529-0.719,0.822-1.512,0.861-2.299v-0.014l0.035,0.047c0,0,0.02-9.523,0.027-11.434 c1.617,0.777,2.738,1.641,3.152,2.742c0.164,0.43,0.235,0.906,0.246,1.426c0.05,2.549-1.719,5.125-1.719,5.125l1.664,1.191 l0.383-0.674c5.229-8.719-1.746-13.855-1.746-13.855c-1.194-1.27-2.147-2.294-2.209-4.645l-0.016-0.697L10.357,4.115z"/>
-<linearGradient id="_66" gradientUnits="userSpaceOnUse" x1="74.45" y1="14.49" x2="80.52" y2="55.82">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_66)" d="M76.977,43.148c-3.813,0,1.066-0.009-4.766-0.009c4.779-16.506-0.037-26.047-0.037-26.047 s0.111,0.068,5.729,0.094C84.465,17.188,84.563,43.148,76.977,43.148z"/>
-<linearGradient id="_67" gradientUnits="userSpaceOnUse" x1="50.98" y1="-8.01" x2="61.11" y2="70.44">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_67)" d="M50.219,55.023h4.611c0.057,0,0.311,0,0.385,0c4.922,0,8.918-11.62,8.918-25.95 c0-14.334-3.992-25.958-8.918-25.958c-0.049,0-0.098,0.02-0.146,0.023C55.033,3.134,55,3.115,54.963,3.115h-4.615 C49.453,3.115,49.32,55.028,50.219,55.023z"/>
-<linearGradient id="_68" gradientUnits="userSpaceOnUse" x1="44.01" y1="3.76" x2="54.2" y2="43.53">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<ellipse fill="url(#_68)" cx="50.498" cy="29.072" rx="8.92" ry="25.951"/>
-<linearGradient id="_69" gradientUnits="userSpaceOnUse" x1="17.85" y1="19.4" x2="53.78" y2="29.8">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<ellipse fill="url(#_69)" cx="50.25" cy="28.776" rx="7.582" ry="22.063"/>
-<linearGradient id="_70" gradientUnits="userSpaceOnUse" x1="48.39" y1="29.87" x2="64.59" y2="29.87">
-<stop stop-color="#FFFFFF" offset="0"/>
-<stop stop-color="#A2C2DD" offset="0.35"/>
-<stop stop-color="#6C83BB" offset="0.7"/>
-<stop stop-color="#003D6D" offset="1"/>
-</linearGradient>
-<path fill="url(#_70)" d="M57.133,19.283c-10.832,2.801-10.906,17.543-0.467,21.167 C57.445,36.153,58.727,28.428,57.133,19.283z"/>
-<linearGradient id="_71" gradientUnits="userSpaceOnUse" x1="60.77" y1="1.82" x2="67.04" y2="35.32">
-<stop stop-color="#FFFFFF" offset="0.05"/>
-<stop stop-color="#A2C2DD" offset="1"/>
-</linearGradient>
-<path fill="url(#_71)" d="M72.174,43.172c-4.053,2.31-5.025,3.236-11.775,6.889c7.934-22.026,0-42.171,0-42.171 l12.182,9.205C72.578,17.094,77.602,29.258,72.174,43.172z"/>
-<path fill="#58A015" d="M11.131,23.658l-0.07-18.859l0.924-0.02c0.064,2.68,1.224,3.856,2.394,5.106 c2.654,2.84,5.955,5.496,1.652,13.033l-0.537-0.385c3.109-5.91,1.119-8.543-3.293-10.238c0,0-0.027,10.623-0.027,12.594 C11.732,23.776,11.131,23.658,11.131,23.658z"/>
-<path fill="#A15EB6" d="M33.701,45.18c-0.008-2.008,0.004-20.498,0.004-20.498l-15.441,4.191l0.031,18.166 c0,0,1.158-0.227,1.928,1.471c0-1.998,0-11.146,0-11.146l11.604-3.578l0.039,9.86C31.857,43.646,32.838,43.371,33.701,45.18z M20.223,34.066v-3.474l11.604-3.217v3.279L20.223,34.066z"/>
-<radialGradient id="_72" gradientUnits="userSpaceOnUse" cx="7.81" cy="25.18" r="3.46">
-<stop stop-color="#DCE8E4" offset="0"/>
-<stop stop-color="#43910A" offset="1"/>
-</radialGradient>
-<path fill="url(#_72)" d="M11.424,26.74c-1.414,1.928-4.344,3.047-6.555,2.499c-2.207-0.549-2.855-2.556-1.445-4.482 c1.41-1.927,4.344-3.051,6.549-2.5C12.178,22.803,12.834,24.817,11.424,26.74z"/>
-<radialGradient id="_73" gradientUnits="userSpaceOnUse" cx="15.45" cy="48.88" r="3.31">
-<stop stop-color="#DEDEED" offset="0"/>
-<stop stop-color="#9646AC" offset="1"/>
-</radialGradient>
-<path fill="url(#_73)" d="M19.658,50.596c-1.242,2.066-4.082,3.459-6.355,3.115c-2.273-0.348-3.107-2.301-1.871-4.375 c1.238-2.066,4.086-3.461,6.359-3.117C20.059,46.569,20.896,48.528,19.658,50.596z"/>
-<radialGradient id="_74" gradientUnits="userSpaceOnUse" cx="30.34" cy="45.16" r="3.27">
-<stop stop-color="#DEDEED" offset="0"/>
-<stop stop-color="#9646AC" offset="1"/>
-</radialGradient>
-<path fill="url(#_74)" d="M33.123,47.162c-1.238,2.066-4.086,3.463-6.359,3.114c-2.266-0.349-3.105-2.306-1.859-4.375 c1.232-2.063,4.078-3.464,6.355-3.116C33.529,43.133,34.365,45.094,33.123,47.162z"/>
-</svg>
\ No newline at end of file
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/resources/sms.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" height="40px" version="1.1" viewBox="0 0 30 40" width="30px" x="0px" y="0px">
-<g>
-<path d="M27.458,17.31l-0.81-0.416l0.81-0.418c0.624-0.317,0.62-1.024,0.405-1.392l-0.881-1.512   c-0.251-0.43-0.877-0.683-1.406-0.336l-0.748,0.484l0.051-0.892c0.025-0.453-0.309-1.056-0.998-1.056h-1.764   c-0.57,0-1.031,0.48-0.998,1.056l0.051,0.892l-0.748-0.484c-0.402-0.263-1.08-0.22-1.406,0.336l-0.879,1.512   c-0.219,0.376-0.126,0.735-0.049,0.916H6C4.346,16,3,17.345,3,19v12c0,1.621,1.293,2.944,2.901,2.997v2.695   c0,1.407,1.723,2.251,2.869,1.029l3.063-3.723h11.165C24.654,33.999,26,32.653,26,31V20.706c0.185,0.031,0.699-0.003,0.982-0.487   l0.881-1.516C28.278,17.989,27.701,17.435,27.458,17.31z" fill-opacity="0.2" stroke-opacity="0.2"/>
-<path d="M27,15.588l-0.882-1.512c0,1.023-6.239,1.58-6.239,0L19,15.588l7.118,4.126L27,18.199l-2.536-1.305   L27,15.588z" fill-opacity="0.5" stroke-opacity="0.5"/>
-<path d="M4,26.718V31c0,1.101,0.9,2,2,2h0.901v3.692c0,0.517,0.646,0.86,1.098,0.394L11.362,33H23c1.1,0,2-0.899,2-2   v-4.282c0-0.004-0.001-0.007-0.001-0.011L4,26.718z" fill-opacity="0.5" stroke-opacity="0.5"/>
-<linearGradient gradientTransform="matrix(1 0 0 1 -1530 0)" gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="1544.5" x2="1544.5" y1="13.4609" y2="38.8497">
-<stop offset="0" style="stop-color:#FFE23D"/>
-<stop offset="0.2239" style="stop-color:#FAD337"/>
-<stop offset="0.6537" style="stop-color:#EFAB26"/>
-<stop offset="1" style="stop-color:#E48717"/>
-</linearGradient>
-<path d="M23,16H6c-1.1,0-2,0.9-2,2v12c0,1.101,0.9,2,2,2h0.901v3.692c0,0.438,0.599,0.907,1.098,0.394   L11.362,32H23c1.1,0,2-0.899,2-2V18C25,16.9,24.1,16,23,16z" fill="url(#SVGID_1_)"/>
-<rect fill="#A55B11" height="1" width="10" x="9.5" y="20.5"/>
-<rect fill="#A55B11" height="1" width="10" x="9.5" y="23.5"/>
-<rect fill="#A55B11" height="1" width="6.25" x="9.5" y="26.5"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="14.7773" x2="14.7773" y1="17" y2="32.9845">
-<stop offset="0" style="stop-color:#FFE23D"/>
-<stop offset="0.2239" style="stop-color:#FAD337"/>
-<stop offset="0.6537" style="stop-color:#EFAB26"/>
-<stop offset="1" style="stop-color:#E48717"/>
-</linearGradient>
-<path d="M25,18c0-0.572-0.243-1.089-0.631-1.454l-0.706,0.705C23.869,17.435,24,17.702,24,18   v11.999c0,0.554-0.5,1.002-1,1.002H10.891l-2.989,3.627v-3.627H6c-0.263,0-0.499-0.107-0.678-0.274   c0.009,0.009,0.013,0.021,0.022,0.03l-0.79,0.616C4.92,31.757,5.432,32,6,32h0.901v3.692c0.005,0.61,0.755,0.782,1.098,0.394   L11.362,32H23c1.172,0,2-0.947,2-2V18z" fill="url(#SVGID_2_)" fill-opacity="0.2" stroke-opacity="0.2"/>
-<path d="M7.901,34.628v-3.627l-1,0.999v3.692c0,0.262,0.164,0.494,0.411,0.583L7.901,34.628z" fill="#FFFFFF" fill-opacity="0.2" stroke-opacity="0.2"/>
-<path d="M5.345,30.757c-0.212-0.184-0.347-0.455-0.347-0.758V18c0-0.552,0.449-1.001,1.002-1.001h17   c0.254,0,0.457,0.069,0.663,0.252l0.706-0.705C24.011,16.208,23.528,16,23,16H6c-1.1,0-2,0.9-2,2v12   c0,0.532,0.211,1.017,0.552,1.376L5.345,30.757z" fill="#FFFFFF" fill-opacity="0.4" stroke-opacity="0.4"/>
-<path d="M7.901,31.001H6c-0.263,0-0.499-0.107-0.678-0.274c0.009,0.009,0.013,0.021,0.022,0.03l-0.79,0.616   C4.92,31.757,5.432,32,6,32h0.901L7.901,31.001z" fill-opacity="0.2" stroke-opacity="0.2"/>
-<path d="M25,18c0-0.572-0.243-1.089-0.631-1.454l-0.706,0.705C23.869,17.435,24,17.702,24,18v11.999   c0,0.585-0.562,1.002-1,1.002H10.891l-2.989,3.627l-0.589,1.647c0.067,0.024,0.422,0.105,0.687-0.189L11.362,32H23   c0.984,0,2-0.775,2-2V18z" fill-opacity="0.2" stroke-opacity="0.2"/>
-<path d="M25,16.619L24.25,16h-5.518c0.014,0.009,1.713,0.894,1.713,0.894l-1.675,0.86   c-0.317,0.205-0.271,0.577-0.204,0.694l0.879,1.515c0.352,0.402,0.623,0.224,0.705,0.171l1.574-1.017l-0.105,1.856   c0.021,0.438,0.361,0.527,0.498,0.527h1.764c0.4,0,0.508-0.391,0.498-0.527l-0.104-1.856L25,19.587V16.619z" fill-opacity="0.3" stroke-opacity="0.3"/>
-<polygon fill="#EA2227" points="27,17.199 26.118,18.714 23.722,17.162 23.881,20 22.117,20 22.277,17.162 19.879,18.714    19,17.199 21.537,15.895 19,14.588 19.879,13.076 22.277,14.625 22.117,11.771 23.881,11.771 23.722,14.625 26.118,13.076    27,14.588 24.464,15.895  "/>
-<rect fill="none" height="40" width="30"/>
-</g>
-</svg>
--- a/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotificationdialogplugin/src/msgnotificationdialogwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -39,7 +39,7 @@
 const QString BT_ICON("qtg_large_bluetooth");
 const QString SMS_ICON("qtg_large_new_message");
 const QString MMS_ICON("qtg_large_new_message");
-const QString RINGTONE_ICON("qtg_large_tone");
+const QString RINGTONE_ICON("qtg_large_new_message");
 const QString VCARD_ICON("qtg_large_new_message");
 // ----------------------------------------------------------------------------
 // ServiceRequestSenderTask::ServiceRequestSenderTask
@@ -247,7 +247,8 @@
 void MsgNotificationDialogWidget::widgetActivated()
 {
 QThreadPool::globalInstance()->start(
-        	new ServiceRequestSenderTask(mConversationId));  
+        	new ServiceRequestSenderTask(mConversationId));
+    enableTouchActivation(false);  
 }
 
 // ----------------------------------------------------------------------------
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgnotifier_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,6 +25,9 @@
 class MsgNotifier;
 class CCSRequestHandler;
 class MsgStoreHandler;
+class XQSettingsManager;
+class XQPublishAndSubscribeUtils;
+class XQSystemToneService;
 
 /**
  * @class MsgNotifierPrivate
@@ -63,6 +66,16 @@
      */
     void DeleteConversationList(
             const CCsClientConversation& aClientConversation);
+    
+	/**
+	 * PartialDeleteConversationList
+	 * This is for handling partial delete of conversation event
+	 * Asynchronous
+	 * @param aClientConversation CCsClientConversation - The conversation object
+	 */
+    void PartialDeleteConversationList(
+            const CCsClientConversation& aClientConversation);
+
 
     /**  
      * ModifyConversationList
@@ -124,7 +137,14 @@
      * @param bootup, true, if called on bootup else false
      */
     void updateUnreadIndications(bool bootup = false);
-
+   
+    /**
+     * Show notification or not
+     * @param receivedMsgConvId received message conversation id.
+     * @return true if the received conversation id is not same as 
+     * published conversation id ( opened conversation id) else false
+     */
+    bool showNotification(int receivedMsgConvId);
 private:
 
     /**
@@ -141,6 +161,23 @@
      * Pointer to Conversation Msg Store Handler.
      */
     MsgStoreHandler* iMsgStoreHandler;
+    
+    /**
+     * Settings manager 
+     * Owned.
+     */
+    XQSettingsManager* mSettingsManager;
+
+    /**
+     * Publish and subscribe utils.
+     * Owned.
+     */
+    XQPublishAndSubscribeUtils* mPSUtils;
+    
+    /**
+     * Object to handle audio alert when new message is received
+     */
+    XQSystemToneService* mSts;
     };
 
 #endif // MSGNOTIFIER_PRIVATE_H
--- a/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/inc/msgstorehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -140,12 +140,8 @@
     /**
      * List of messages in Fialed states
      */
-    CMsvEntrySelection* iFailedMessages;
-    
-    /**
-     * List of messages for which failed note shown
-     */
-    CMsvEntrySelection* iFailedNotes;
+    CMsvEntrySelection* iFailedMessages;   
+   
 };
 
 #endif // MSG_STORE_HANDLER_H
--- a/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/msgnotifier.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -21,7 +21,6 @@
 DEPENDPATH += . src
 HEADERS += $$PUBLIC_HEADERS
 INCLUDEPATH += . inc ../../../inc 
-INCLUDEPATH +=../../msgutils/s60qconversions/inc
 INCLUDEPATH += ../../msgsettings/msginit/inc
 INCLUDEPATH += ../inc
 INCLUDEPATH += $$APP_LAYER_INCLUDEPATH
@@ -42,6 +41,7 @@
 QT -= gui
 CONFIG += NO_ICON hb
 
+TRANSLATIONS = messaging.ts
 # Input
 SOURCES += 	src/main.cpp \
 			src/msgnotifier.cpp \
@@ -53,18 +53,22 @@
   		    inc/msgstorehandler.h 
 
 LIBS += -lcsserverclientapi \
-        -ls60qconversions \
         -lcsutils \
         -lmsginit \
         -lmsgs \
         -letext \
         -lsmcm \
-        -ls60qconversions \
         -lmmsmessage \
         -lmmsserversettings \
         -lmmscli \
         -lxqservice \
         -lQtContacts \
         -lQtVersit \
-        -lunidatamodelloader 
+        -lunidatamodelloader \
+	-lxqsettingsmanager \
+        -apgrfx.lib \
+        -lxqutils \
+        -lws32 \
+        -lapgrfx \
+	-lxqsystemtoneservice
         
--- a/messagingapp/msgnotifications/msgnotifier/src/main.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/main.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -17,6 +17,8 @@
 
 //SYSTEM INCLUDES
 #include <QCoreApplication>
+#include <QTranslator>
+#include <QLocale>
 #include <QFile>
 #include <QDateTime>
 #include <QPointer>
@@ -70,7 +72,15 @@
 int main(int argc, char *argv[])
 {
     QCoreApplication app(argc, argv);
-
+    QString locale = QLocale::system().name();
+    QString path = "z:/resource/qt/translations/";
+    QTranslator translator;
+    QTranslator translator_comm;
+    translator.load(path + QString("messaging_") + locale);
+    translator_comm.load(path + QString("common_") + locale);
+    app.installTranslator(&translator);
+    app.installTranslator(&translator_comm);
+    
 #ifdef _DEBUG_TRACES_
     //Debug Logs
     QFile ofile;
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -20,10 +20,7 @@
 #include <hbdevicedialog.h>
 #include <hbindicator.h>
 #include <qfileinfo.h>
-#include <qversitcontactimporter.h>
-#include <qversitreader.h>
-#include <qtcontacts.h>
-QTM_USE_NAMESPACE
+
 //USER INCLUDES
 #include "msgnotifier.h"
 #include "msgnotifier_p.h"
@@ -33,6 +30,8 @@
 #include "ccsdefs.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
+
 #include "debugtraces.h"
 
 // LOCALIZATION CONSTANTS
@@ -114,7 +113,8 @@
             QString attachmentPath = attList[0]->path();
             description = LOC_BUSINESS_CARD;
             description.append(CARD_SEPERATOR);
-            description.append(getVcardDisplayName(attachmentPath));
+            description.append(
+                    MsgContactHandler::getVCardDisplayName(attachmentPath));
             } 
         delete pluginLoader;
         }
@@ -197,39 +197,4 @@
     QDEBUG_WRITE("MsgNotifier::updateOutboxIndications  Exit")
 }
 
-//---------------------------------------------------------------
-// MsgNotifier::getVcardDisplayName
-// @see header
-//---------------------------------------------------------------
-QString MsgNotifier::getVcardDisplayName(const QString& filePath)
-{
-    QString displayName;
-    //open file for parsing
-    QFile file(filePath);
-    if (!file.open(QIODevice::ReadOnly)) {
-        return displayName;
-    }
-    // parse contents
-    QVersitReader reader;
-    reader.setDevice(&file);
-    if (reader.startReading()) {
-        if (reader.waitForFinished()) {
-            QList<QVersitDocument> versitDocuments = reader.results();
-            // Use the resulting document
-            if (versitDocuments.count() > 0) {
-                QVersitContactImporter importer;
-                QList<QContact> contacts = importer.importContacts(versitDocuments);
-                // get display-name
-                if (contacts.count() > 0) {
-                    QContactManager* contactManager = new QContactManager("symbian");
-                    displayName = contactManager->synthesizedDisplayLabel(contacts[0]);
-                    delete contactManager;
-                }
-            }
-        }
-    }
-    file.close();
-    return displayName;
-}
-
 //EOF
--- a/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgnotifier_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -23,26 +23,28 @@
 #include <ccsconversationentry.h>
 #include <xqservicerequest.h>
 #include <QString>
+#include <w32std.h>
+#include <apgtask.h> 
+#include <XQSettingsManager>
+#include <xqpublishandsubscribeutils.h>
+#include <xqsystemtoneservice.h>
+#include <xqconversions.h>
 
 //USER INCLUDES
 #include "msgnotifier.h"
 #include "msgnotifier_p.h"
-#include "s60qconversions.h"
 #include "msgstorehandler.h"
 #include "msginfodefs.h"
-#include <QtDebug>
-
-#define QDEBUG_WRITE(str) {qDebug() << str;}
-#define QDEBUG_WRITE_FORMAT(str, val) {qDebug() << str << val;}
-#define QCRITICAL_WRITE(str) {qCritical() << str;}
-#define QCRITICAL_WRITE_FORMAT(str, val) {qCritical() << str << val;}
+#include "conversationidpsconsts.h"
+#include "debugtraces.h"
 
 // ----------------------------------------------------------------------------
 // MsgNotifierPrivate::MsgNotifierPrivate
 // @see MsgNotifierPrivate.h
 // ----------------------------------------------------------------------------
 MsgNotifierPrivate::MsgNotifierPrivate(MsgNotifier* MsgNotifier) :
-    q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL)
+    q_ptr(MsgNotifier), mCvServer(NULL), iMsgStoreHandler(NULL),
+    mSettingsManager(NULL),mPSUtils(NULL)
 {
     QDEBUG_WRITE("MsgNotifierPrivate::MsgNotifierPrivate : Enter")
 
@@ -67,6 +69,23 @@
         delete iMsgStoreHandler;
         iMsgStoreHandler = NULL;
     }
+    
+    if(mPSUtils)
+        {
+        delete mPSUtils;
+        }
+    
+    if(mSettingsManager)
+        {
+        delete mSettingsManager;
+        }
+    
+    if(mSts)
+        {
+        delete mSts;
+        mSts = NULL;
+        }
+    
     QDEBUG_WRITE("MsgNotifierPrivate::~MsgNotifierPrivate : Exit")
 }
 
@@ -84,6 +103,26 @@
     updateUnreadIndications(true); 
     updateOutboxIndications();
 
+    mSettingsManager = new XQSettingsManager();
+    
+    // define property
+    mPSUtils = new XQPublishAndSubscribeUtils(*mSettingsManager);
+    XQPublishAndSubscribeSettingsKey convIdKey(
+            KMsgCVIdProperty, KMsgCVIdKey);
+    bool success = mPSUtils->defineProperty(convIdKey, 
+                            XQSettingsManager::TypeInt);
+    
+    QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
+                        "property creation ret value",success)
+    
+    // write -1 initially 
+    success = mSettingsManager->writeItemValue(convIdKey,-1);
+    
+    QDEBUG_WRITE_FORMAT("MsgNotifierPrivate::initL "
+                           "writing ret value",success)
+    
+    mSts = new XQSystemToneService();
+    
     QDEBUG_WRITE("MsgNotifierPrivate::initL : Exit")
 }
 
@@ -174,20 +213,28 @@
         if(displayName)
             {
             notifData.mDisplayName = 
-                                S60QConversions::s60DescToQString(*displayName);
+                                XQConversions::s60DescToQString(*displayName);
             }        
         if(number)
             {
-            notifData.mContactNum =  S60QConversions::s60DescToQString(*number);
+            notifData.mContactNum =  XQConversions::s60DescToQString(*number);
             }
         if(descrp)
             {
-            notifData.mDescription = S60QConversions::s60DescToQString(*descrp);
+            notifData.mDescription = XQConversions::s60DescToQString(*descrp);
             }
         
-        q_ptr->displayNewMessageNotification(notifData);
+        //Play new message alert tone.
+        mSts->playTone(XQSystemToneService::SmsAlertTone);
         
-        QDEBUG_WRITE("processListEntry : Notification display called")
+        // check whether opened cv id and received 
+        // cv id are same and show notification
+        if( showNotification(notifData.mConversationId ))
+            {
+             q_ptr->displayNewMessageNotification(notifData);
+             QDEBUG_WRITE("processListEntry : Notification display called")
+            }
+       
         }
     
     QDEBUG_WRITE("MsgNotifierPrivate::processListEntry : Exit")
@@ -253,38 +300,90 @@
 // @see MsgNotifierPrivate.h
 // ----------------------------------------------------------------------------
 void MsgNotifierPrivate::displayFailedNote(MsgInfo info)
-{
-    // TODO: use XQAiwRequest
-    QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : entered")
-    // change to com.nokia.symbian.messaging (servicename), IMsgErrorNotifier
-    // as the service name.
-    XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier",
-        "displayErrorNote(QVariantList)", false);
+    {
+    QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote start.")
+            
+    // check whether opened cv id and received 
+    // cv id are same then dont show failed note
+    if (!showNotification(info.mConversationId))
+        {
+        return;
+        }
 
-    QVariantList args;
+    //Even if name string is empty we shall add name into args
+    QString nameString;
+
     info.mDisplayName.removeDuplicates();
     info.mDisplayName.sort();
-    
-    QString nameString;
-    
+
     nameString.append(info.mDisplayName.at(0));
-    for(int i = 1; i < info.mDisplayName.count(); ++i){
+    for (int i = 1; i < info.mDisplayName.count(); ++i)
+        {
         nameString.append(", ");
         nameString.append(info.mDisplayName.at(i));
-    }
-      
-    //Even if name string is empty we shall add name into args
-    QVariant nameV(nameString);
-    args << nameV;
+        }
 
-    QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : name and contactnumber")
-
+    // create request arguments
+    QVariantList args;
+    args << QVariant(nameString);
     args << info.mConversationId;
     args << info.mMessageType;
+
+    // TODO: use XQAiwRequest
+    XQServiceRequest snd("messaging.com.nokia.symbian.MsgErrorNotifier",
+            "displayErrorNote(QVariantList)", false);
+
     snd << args;
     snd.send();
-    QDEBUG_WRITE("[MsgNotifierPrivate::handleFailedState] : left")
+    
+    QDEBUG_WRITE("MsgNotifierPrivate::displayFailedNote end.")
+    }
+
+// ----------------------------------------------------------------------------
+// MsgNotifierPrivate::showNotification
+// @see MsgNotifierPrivate.h
+// ----------------------------------------------------------------------------
+bool MsgNotifierPrivate::showNotification(int receivedMsgConvId)
+{
+    bool showNotification = true;
+    
+    RWsSession wsSession ;
+    wsSession.Connect();
+
+    TApaTaskList taskList( wsSession );
+    TApaTask task = taskList.FindApp(KMsgAppUid); // find msgapp is running
 
+    if(task.Exists())
+        {
+        TApaTask foregndtask =   taskList.FindByPos(0) ;  // foreground app
+        // compare  window group id  
+        // if application is in foregorund, then check the currently
+        // opened conversation is same as received one.
+        if(task.WgId() == foregndtask.WgId() )
+            {
+            // get the current conversation ID
+            XQPublishAndSubscribeSettingsKey convIdKey( KMsgCVIdProperty, 
+                    KMsgCVIdKey);
+            QVariant value = mSettingsManager->readItemValue(convIdKey, 
+                    XQSettingsManager::TypeInt);
+
+            int openedConvId  = value.toInt();
+            if( openedConvId == receivedMsgConvId)
+                {
+                showNotification = false;
+                QDEBUG_WRITE("processListEntry : Notification not shown")
+                }
+            }
+        }
+
+    wsSession.Close();
+    return showNotification;
 }
+// ----------------------------------------------------------------------------
+// MsgNotifierPrivate::PartialDeleteConversationList
+// @see mcsconversationclientchangeobserver.h
+// ----------------------------------------------------------------------------
+void MsgNotifierPrivate::PartialDeleteConversationList(
+        const CCsClientConversation& aClientConversation){/*empty implementation*/}
 
 //EOF
--- a/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgnotifications/msgnotifier/src/msgstorehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,7 +16,7 @@
  */
 
 #include "msgstorehandler.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "msgnotifier_p.h"
 #include <ccsrequesthandler.h>
 #include <ccsconversationentry.h>
@@ -63,10 +63,6 @@
         iFailedMessages = NULL;
     }
 
-    if (iFailedNotes) {
-        delete iFailedNotes;
-        iFailedNotes = NULL;
-    }
 }
 
 // ---------------------------------------------------------
@@ -80,7 +76,6 @@
     iMsvEntry->AddObserverL(*this);
 
     iFailedMessages = new (ELeave) CMsvEntrySelection;
-    iFailedNotes = new (ELeave) CMsvEntrySelection;
 }
 
 // ---------------------------------------------------------
@@ -108,8 +103,7 @@
     }
 
     //Handling for outbox entries
-    if( parent == KMsvGlobalOutBoxIndexEntryIdValue )
-    {
+    if (parent == KMsvGlobalOutBoxIndexEntryIdValue) {
         CMsvEntry* rootEntry = iMsvSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
 
         for (TInt i = 0; i < selection->Count(); ++i) {
@@ -120,45 +114,55 @@
                 TInt index = iFailedMessages->Find(entry.Id());
 
                 if (sendingState == KMsvSendStateFailed && KErrNotFound == index) {
+
                     iFailedMessages->AppendL(entry.Id());
-                    iFailedNotes->AppendL(entry.Id());
+                    MsgInfo aInfo;
+                    ProcessIndicatorDataL(entry.Id(), aInfo);
+                    iNotifier->displayFailedNote(aInfo);
                 }
                 else if (sendingState != KMsvSendStateFailed && KErrNotFound != index) {
                     iFailedMessages->Delete(index);
                     iFailedMessages->Compress();
                 }
-                if (iFailedNotes->Count()) {
-                    MsgInfo aInfo;
-                    ProcessIndicatorDataL(iFailedNotes->At(0), aInfo);
-                    iNotifier->displayFailedNote(aInfo);
-                    iFailedNotes->Delete(0);
-                    iFailedNotes->Compress();
-                }
+
             }
         }//end for
     }
-    else
-    {
+    else {
         TMsvEntry entry;
         TMsvId service;
-        TInt error= KErrNone;
-        for (TInt i = 0; i < selection->Count(); ++i)
-        {
+        TInt error = KErrNone;
+        for (TInt i = 0; i < selection->Count(); ++i) {
             error = iMsvSession->GetEntry(selection->At(i), service, entry);
 
-            if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && MmsNotificationStatus(
-                entry) == EMsgStatusFailed)
-            {
-                MsgInfo aInfo;
-                                
-                //Fill aInfo with appropriate data
-                aInfo.mMessageType = ECsMmsNotification;
+            if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification && 
+                MmsNotificationStatus(entry) == EMsgStatusFailed) {
+
+                TInt index = iFailedMessages->Find(entry.Id());
+
+                if (KErrNotFound == index) {
+                    iFailedMessages->AppendL(entry.Id());
+                    MsgInfo aInfo;
+                    //Fill aInfo with appropriate data
+                    aInfo.mMessageType = ECsMmsNotification;
+                    ProcessIndicatorDataL(entry.Id(), aInfo);
+                    iNotifier->displayFailedNote(aInfo);
 
-                ProcessIndicatorDataL(entry.Id(),aInfo);
-                iNotifier->displayFailedNote(aInfo);
+                }// end of if
             }
-        }
+            else if (error == KErrNone && entry.iMtm == KUidMsgMMSNotification
+                && MmsNotificationStatus(entry) == EMsgStatusRetrieving) {
+                
+                TInt index = iFailedMessages->Find(entry.Id());
+                if (KErrNotFound != index) {
+                    iFailedMessages->Delete(index);
+                    iFailedMessages->Compress();
+                }// end of KErrNotFound != index if block
+
+            } // end of 2nd if  
+        } // for loop
     }
+
 }
 
 // ---------------------------------------------------------
@@ -269,12 +273,12 @@
     HBufC* displayName = conversation->GetDisplayName();
 
     if (displayName) {
-        indicatorData.mDisplayName.append(S60QConversions::s60DescToQString(*displayName));
+        indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*displayName));
     }
     else {
         HBufC* number = convEntry->Contact();
         if (number)
-            indicatorData.mDisplayName.append(S60QConversions::s60DescToQString(*number));
+            indicatorData.mDisplayName.append(XQConversions::s60DescToQString(*number));
     }
     delete conversation;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsreadfile.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,471 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile,          "EOF" );
+_LIT8( KTestNewMessage,         "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType,        "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate,               "DATE" ); // Date
+_LIT8( KTestFrom,               "FROM" ); // From
+_LIT8( KTestTo,                 "TO" ); // To
+_LIT8( KTestCc,                 "CC" ); // Cc
+_LIT8( KTestBcc,                "BCC" ); // Bcc
+_LIT8( KTestSubject,            "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel,          "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs,          "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel,    "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs,    "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority,           "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility,   "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport,     "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply,          "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment,      "ATTACHMENT" );
+_LIT8( KTestAttachmentType,     "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName,     "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc,  "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset,  "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid,      "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot,     "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass,       "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow,  "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis,     "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount,         "RETRY-COUNT" );
+_LIT8( KTestRetryInterval,      "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias,				"ALIAS" );
+_LIT8( KTestFromAlias,			"FROMALIAS" );
+_LIT8( KTestToAlias,			"TOALIAS" );
+_LIT8( KTestCcAlias,			"CCALIAS" );
+_LIT8( KTestBccAlias,			"BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging,      "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs,      "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel,      "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize,     "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID,       "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID,                "TID" );
+_LIT8( KTestContentLocation,    "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy,    "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate,  "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId,           "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize,         "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion,             "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus,          "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus,      "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText,        "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus,      "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText,        "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus,              "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute,          "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator,  "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit,              "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota,       "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota,          "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal,       "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal,          "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount,       "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword,         "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword,      "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword,      "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState,            "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota,              "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart,              "START" ); // X-Mms-Start
+_LIT8( KTestStore,              "STORE" ); // X-Mms-Store
+_LIT8( KTestStored,             "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus,        "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText,    "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals,             "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex,    "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId,            "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId,       "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo,          "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass,        "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent,          "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed,   "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId,           "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText,          "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId,            "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus,        "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet            1
+#define aReset          0
+#define PartCount      100
+#define MaxAttaCount   10
+#define DefaultBufLen 256
+#define MaxRecipients   5
+
+// status returned by ReadRow
+enum TTestReadStatus
+    {
+    ETestUnknown,
+    ETestNewMessage,
+    ETestNewAttachment,
+    ETestEof,    // End of file
+    ETestMessageType,
+    ETestDate,
+    ETestFrom,
+    ETestTo,
+    ETestCc,
+    ETestBcc,
+	ETestAlias,
+	ETestFromAlias,
+	ETestToAlias,
+	ETestCcAlias,
+	ETestBccAlias,
+    ETestSubject,
+    ETestExpiryRel,
+    ETestExpiryAbs,
+    ETestDeliveryTimeRel,
+    ETestDeliveryTimeAbs,
+    ETestPriority,
+    ETestSenderVisibility,
+    ETestDeliveryReport,
+    ETestReadReply,
+    ETestAttachmentType,
+//    ETestAttachmentName,
+    ETestAttachmentCharset,
+    ETestAttachmentCid,
+	ETestAttachmentRoot,
+    ETestSettings,
+    ETestMessageClass,
+    ETestDelivReportSendAllow,
+    ETestSingleMessageClass,
+    ETestReplyCharging,
+    ETestReplyChargAbs,
+    ETestReplyChargRel,
+    ETestReplyChargSize,
+    ETestReplyChargID,
+    ETestTID,
+    ETestContentLocation,
+    ETestPreviouslySentIndex,
+    ETestPreviouslySentBy,
+    ETestPreviouslySentDate,
+    ETestMessageId,
+    ETestMessageSize,
+    ETestVersion,
+    ETestReadStatus,
+    ETestResponseStatus,
+    ETestResponseText,
+    ETestRetrieveStatus,
+    ETestRetrieveText,
+    ETestStatus,
+    ETestAttribute,
+    ETestDistributionIndicator,
+    ETestLimit,
+    ETestMessageQuota,
+    ETestSizeQuota,
+    ETestMessageTotal,
+    ETestSizeTotal,
+    ETestMessageCount,
+    ETestAddKeyword,
+    ETestRemoveKeyword,
+    ETestFilterKeyword,
+    ETestMMState,
+    ETestQuota,
+    ETestStart,
+    ETestStore,
+    ETestStored,
+    ETestStoreStatus,
+    ETestStoreStatusText,
+    ETestTotals,
+    ETestDeleteInfoIndex,
+    ETestApplicId,
+    ETestReplyApplicId,
+    ETestApplicInfo,
+    ETestContentClass,
+    ETestDrmContent,
+    ETestAdaptationAllowed,
+    ETestRecommendedRetrievalMode,
+    ETestRecRetrievalModeText,
+    ETestReplaceId,
+    ETestStatusText,
+    ETestCancelId,
+    ETestCancelStatus,
+    ETestAttaRecommendedName,
+    ETestAttachmentContLoc,
+    ETestAttContTypeParamName,
+    ETestAttContTypeParamValue,
+    ETestAttXTypeParamName,
+    ETestAttXTypeParamValue
+
+    };
+
+// VALUE KEYWORDS
+_LIT( KPersonal,      "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto,          "Auto" );
+_LIT( KLow,    "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh,   "High" );
+_LIT( KHide,   "Hide" );
+_LIT( KShow,   "Show" );
+_LIT( KYes,    "Yes" );
+_LIT( KNo,     "No" );
+_LIT( KOn,     "On" );
+_LIT( KOff,     "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired,  "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent,  "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders,  "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime,       "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry,             "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg,         "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType,        "CONTENT-TYPE" );  // for attribute list only
+
+/**
+*  CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+    {
+    public:  // Constructors and destructor
+
+        static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+        virtual ~CMmsReadFile(); // Destructor
+
+    public: // New functions
+
+        TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+        TTestReadStatus ReadRowL();
+        void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+		TInt FindAlias(TPtrC alias);
+		void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+    protected:  // Functions from base classes
+
+    private:
+
+        CMmsReadFile(); // C++ default constructor.
+        // By default constructor is private.
+        void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+        void Reset();
+
+    public: // data
+        TInt                            iMessageType;
+
+
+    private:     // Data
+
+        RFs                             iFs;
+        RFileReadStream*                iReader;
+        TBuf<DefaultBufLen>             iValueBuffer;
+        CDesCArray*     iAliasArray;    // aliases
+        HBufC8*         iByteBuffer;
+        TTime                           iDate;
+        CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+        TInt                            iAttaCount;
+		TInt							iAttaRoot;
+		TInt							iAliasCount;
+        TInt                            iNextMessageType;
+        TParse                          iParse;
+        TFileName                       iFilename;
+
+    protected:  // Data
+    private:    // Data
+
+        // CArrayFixFlat <TestMessage>* iMessages;
+
+    public:     // Friend classes
+    protected:  // Friend classes
+    private:    // Friend classes
+
+    };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+    {
+    public:  // Constructors and destructor
+        static CMmsAttaStructure* NewL(); // Two-phased constructor.
+        virtual ~CMmsAttaStructure(); // Destructor
+    private:
+        CMmsAttaStructure(); // C++ default constructor.
+        // By default constructor is private.
+        void ConstructL();
+
+    public:     // Data
+        HBufC8*         iAtta;
+        HBufC8*         iAttaName; // content location
+        HBufC8*         iAttaType;
+        HBufC8*         iAttaCid;
+        TInt            iAttaCharset;
+        HBufC*          iAttaRecommendedName; // recommended filename
+       	CDesC8ArrayFlat* iContentTypeParams;  // zero or more "parameter"
+    	CDesC8ArrayFlat* iXTypeParams;        // zero or more X-Type "parameters"
+
+    };
+
+
+#endif      // MMSREADFILE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h>  //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+    {
+    Q_OBJECT
+
+public:
+    /**
+     *
+     */
+    MmsTestBed();
+    ~MmsTestBed();
+    void setConnectionLocal(bool value);
+    void fromOutboxToMmsc();
+    void fromMmscToInbox();
+    /**
+     * cleanup MMS service
+     */
+    void cleanupAndCreateNewService();
+    void deleteNotifications();
+    void restoreFactorySettings();
+    void setFetchingState( TMmsReceivingMode aState );
+    void sendFromFile();
+    void sendOneByOne();
+    void sendNotifications();
+    void copyDrafts();
+    void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+    void messageVariation();
+    void cancelSendScheduling();
+    void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+    void deleteSendSchedule();
+    void cancelFetchScheduling();
+    void fetchForced(TInt aDelay = 5);
+    void deleteFetchSchedule();
+    void doAFetchCycle();
+    void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+    void cleanOutbox();
+    void cleanInbox();
+    void cleanSent();
+    void cleanDrafts();
+    void cleanAll();
+    void reply();
+    void replyToAll();
+    void forward();
+    void sendReadReport(); // send a read report
+    int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+    int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+    void sendViaClient();
+    void scheduledFetch(TInt aDelay = 5);
+    void fetchForcedImmediate();
+    void getEventType();
+    void addEventType();
+    void deleteEventType();
+    void cleanLog();
+    void setOnline(bool value);
+    void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+    void sendDeliveryReport();
+
+signals:
+    void entryCreatedInDraft(long int id);
+    void entryMovedToOutbox(long int id);
+    void entryMovedToSent(long int id);
+    void entryCreatedInInbox(long int id);
+
+protected:
+    /**
+     * From MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+            TAny* aArg2, TAny* aArg3);
+
+private:
+    void findDefaultL();
+    void createMmsService();
+    void cleanup();
+    void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+    void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+    void addMMBoxDescriptions();
+    void encodeMessageFromDrafts();
+    TMsvId findMMSFolder();
+    bool checkLogClient();
+    int getLogEntries();
+
+private:
+    //data
+    CTestUiTimer* iTimer;
+    CMsvOperationActiveSchedulerWait* iWait;
+    CMsvSession* iSession;
+    CClientMtmRegistry* iClientMtmRegistry;
+    CMmsClientMtm* iMmsClient;
+    CMmsSettings* iSettings;
+    CMmsHeaders* iMmsHeaders;
+    TMsvId iServiceId;
+    TMsvId iDefaultServiceId;
+    TMsvSessionEvent iEvent;
+    RFs iFs;
+    TFileName iFilename;
+    TFileName iCurrentFile;
+    TFileName iCurrentPath;
+    TParse iParse;     // parse buffer as member to save stack space
+    CBufFlat* iEncodeBuffer;
+    CMsvEntrySelection* iMsvEntrySelection;
+    CLogEvent* iLogEvent;
+    CLogClient* iLogClient;
+    CLogViewEvent* iLogView;
+    CLogFilter* iLogFilter;
+    };
+
+#endif // MMSTESTBED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestbed.hrh	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * 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:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+    EAppMainOk = 1,
+    EAppMainCancel,
+    //
+    EMenufrmCmdCascadeTest,
+    ECleanup,
+    ECleanOutbox,
+    ESaveSettings,
+    ELoadSettings,
+    ECleanInbox,
+    EShowIn,
+    EShowOut,
+    EOutToMMSC,
+    EMMSCToIn,
+    ESendScheduled,
+    EReceiveScheduled,
+    EShowSent,
+    ECleanSent,
+    EStartMyNotifier,
+    EGetEventType,
+    EAddEventType,
+    EDeleteEventType,
+    EViewLog,
+    ECleanLog,
+    EShowWapAccessPoints,
+    ESelectWapAccessPoint,
+    EShowConnectionMode,
+    EShowIAP,
+    EConnectToIAP,
+    EDeleteSendSchedule,
+    EDeleteReceiveSchedule,
+    EDeleteNotifications,
+    ERestoreFactorySettings,
+    ECreateFromFile,
+    EShowNotifications,
+    ESendDeliveryReport,
+    EShowDrafts,
+    ECleanDrafts,
+    ECleanAll,
+    EFetchingDeferred,
+    EFetchingOn,
+    ESendFromFile,
+    ESwitchToLocal,
+    ESwitchToGlobal,
+    EDecodeLoggingOn,
+    EDecodeLoggingOff,
+    EBinaryDumpOn,
+    EBinaryDumpOff,
+    ESendNotification,
+    ECreateToInbox,
+    ECreateToSentItems,
+    ESendFromDrafts,
+    EFindMMSFolder,
+    ESendOneByOne,
+    ECreateToDrafts,
+    ESendViaClient,
+    ESendMemFail,
+    EFetchMemFail,
+    EReceiveForced,
+    ECreateHeadersFromFile,
+    ESwitchToOffline,
+    ESwitchToOnline,
+    ECopyDrafts,
+    ECreateNotification,
+    EReply,
+    EReplyToAll,
+    EForward,
+    EFetchingManual,
+    EFirstBoot,
+    ENoFirstBoot,
+    EFindNetworkStatus,
+    ESendReadReport,
+    ECreateMMBoxViewConf,
+    EGetMMBoxView,
+    ECleanMMBox,
+    EShowMMBox
+};
+
+#define 	ETestLabel1 1
+#define 	ETestLabel2 2
+#define 	ETestLabel3 3
+#define 	ETestLabel4 4
+
+#define     EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+	{
+	ETestEditField = 1
+	};
+
+enum TEditServiceControls
+	{
+	EFolderLabel = 1,
+    EEditUri
+//	EEditServiceFolder,
+//	ENameLabel,
+//	EEditServiceName,
+//	ENumberLabel,
+//	EEditServiceNumber
+	};
+
+enum
+	{
+	EFsViewDialogId = 1
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmsteststaticutils.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,203 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ *  joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+    {
+public:
+    TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+    TInt MdcaCount() const;
+    TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+    CDesCArray* const & iArray1;
+    CDesCArray* const & iArray2;
+    };
+
+/**
+ *  static utility functions
+ *
+ */
+class TMmsTestUtils
+    {
+
+public:
+
+    /**
+     *
+     */
+    TMmsTestUtils();
+
+    /**
+     * read phone number for sending messages
+     *
+     * @param aFileName full path for filename
+     * @param aFs file system handle
+     * @return allocated pointer containing the name
+     *     The caller must delete the pointer when no longer needed
+     */
+    static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+    static void DecodeLoggingOnL();
+    static void DecodeLoggingOffL();
+    static void BinaryDumpOnL();
+    static void BinaryDumpOffL();
+
+    /**
+     * Clean all temporary directories used in local mode.
+     * Does not delete the directories, only the contents
+     *
+     * @param aFs file system handle
+     */
+    static void CleanDirectoryL( RFs& aFs );
+
+    /**
+     * Dump a binary message
+     *
+     * @param aBuffer buffer containing the binary message
+     * @param aFilename full path of the directory whenre the dump goes
+     * @param aParse reference to parser (to save stack space)
+     * @param aFs file system handle
+     */
+    static void Dump(
+        CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+    /**
+     * Delete all MMS messages and notifications from a given folder
+     *
+     * @param aBoxId folder id
+     * @param aSession Messaging server session
+     */
+    static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+    /**
+     * turn on logging messages sent to email addresses
+     */
+    static void EmailLoggingOnL();
+
+    /**
+     * turn off logging messages sent to email addresses
+     */
+    static void EmailLoggingOffL();
+
+    /**
+     * load list of children into selection and return count
+     *
+     * @param aBoxId folder id
+     * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+     *     caller is responsible of deleting the pointer afterwards.
+     *     Pointer may be NULL at entry, and a new pointer will be allocated
+     * @param aSession messge server session
+     * @param aMessageType child MTM type, default is multimedia message
+     * @return number of entries in selection
+     */
+    static TInt CountChildrenL(
+        TMsvId aBoxId,
+        CMsvEntrySelection*& aMsvEntrySelection,
+        CMsvSession& aSession,
+        TUid aMessageType = KUidMsgTypeMultimedia);
+
+    /**
+     * Create a folder entry
+     *
+     * @param aSession messge server session
+     * @param aParentFolder the parent folder
+     * @param aFolderName name of the folder
+     * @param aFolderId will contain the if of the new folder if creation was successful
+     */
+    static void CreateFolderEntryL(
+        CMsvSession& aSession,
+        TMsvId aParentFolder,
+        const TDesC& aFolderName,
+        TMsvId& aFolderId );
+
+    /**
+    * Create an MMS notification from data in buffer
+    * @param aNotificationFolder mms notification folder (target folder)
+    * @param aServiceId id of MMS service
+    * @param aEncodeBuffer buffer that contains the data
+    * @param aSession message server session
+    * @return id of the created notification
+    */
+    static TMsvId CreateNotificationEntryL(
+        TMsvId aNotificationFolder,
+        TMsvId aServiceId,
+        CBufFlat* aEncodeBuffer,
+        CMsvSession& aSession );
+
+    /**
+    * Encode an MMS notification into buffer
+    * @param aUrl url of the notification for local messages a filepath
+    * @param aSize size of the message
+    * @param aMmsHeaders MMS headers structure for creating the notification
+    * @param aMmsEncoder reference to CMmsEncode class
+    * @param aEncodeBuffer flat buffer that will contain the encoded notification
+    */
+    static void FormNotification(
+        TDesC8& aUrl,
+        TInt aSize,
+        CMmsHeaders& aMmsHeaders,
+        CMmsEncode& aMmsEncoder,
+        CBufFlat* aEncodeBuffer );
+
+
+    static TBool IsDrive(const TDesC& aFileName);
+    static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+    static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+    };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/inc/mmstestuitimer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ *  timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+    {
+public:
+
+    static CTestUiTimer* NewL();
+    virtual  ~CTestUiTimer();
+
+    void RunL();
+    void DoCancel();
+    void ConstructL();
+    void IssueRequest();
+    void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+    CTestUiTimer();
+
+public:
+    TTimeIntervalMicroSeconds32 period;
+
+private: // data
+    CActive* iObject;
+    };
+
+#endif // C_TESTUITIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/mmstestbed.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,84 @@
+#
+# 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:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../inc
+
+INCLUDEPATH += ../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../inc
+INCLUDEPATH += ../../../../../mmsengine/mmsengine/inc
+INCLUDEPATH += ../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
+#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+           src/mmsteststaticutils.cpp \
+           src/mmsreadfile.cpp \
+           src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+           inc/mmsteststaticutils.h \
+           inc/mmsreadfile.h \
+           inc/mmstestuitimer.h \
+           inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+    TARGET.CAPABILITY = CAP_GENERAL_DLL
+    TARGET.EPOCSTACKSIZE = 0x8000
+    TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+    TARGET.EPOCALLOWDLLDATA = 1 
+	}
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+     "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+        -lmmsmessage \
+        -lmmsconninit \
+        -lmmscodec \
+        -lmmsserversettings \
+        -lcentralrepository \
+        -lapparc \
+        -lbafl \
+        -lefsrv \
+        -lesock \
+        -lestor \
+        -leuser \
+        -llogcli \
+        -llogwrap \
+        -lapgrfx \
+        -lapmime
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsreadfile.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,1799 @@
+/*
+ * 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:
+ */
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <badesca.h>
+#include    <e32def.h>
+#include    <s32file.h>
+#include    <msvids.h>
+#include    <mtmdef.h>
+//#include    <eikenv.h>
+#include    <apgcli.h>
+#include    <CMsvMimeHeaders.h>
+#include    <AknNoteWrappers.h>
+
+#include    <mmsservercommon.h>
+#include    "mmsconst.h"
+#include    "mmsclient.h"
+#include    "mmsheaders.h"
+#include    "mmsreadfile.h"
+#include    "mmsmmboxviewheaders.h"
+#include    "mmsmmboxmessageheaders.h"
+#include    "mmsmmboxflags.h"
+#include    "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" );    // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+    {
+    // all member variables in a class derived from CBase
+    // are automatically set to 0.
+    }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+    {
+    // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+    iFs = aFs;
+    iReader = &aReadStream;
+    iByteBuffer = HBufC8::NewL( DefaultBufLen );
+    iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+    iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+    Reset();
+    }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+    {
+    CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+    CleanupStack::PushL( self );
+    self->ConstructL( aFs, aReadStream );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+    {
+    Reset(); // resets and destroys all array data
+    if (iAliasArray != NULL) iAliasArray->Reset();
+    delete iByteBuffer;
+    delete iAliasArray;
+    delete iAttaStructures;
+    }
+
+void CMmsReadFile::Reset()
+    {
+    // reset all arrays
+    if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+    iAttaCount = 0;
+    iAttaRoot = 0;
+    }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+    Reset(); // new message
+
+    TUint32 val;
+    TUint   limit = 1000000;
+    TUint   sizeLimit = 1000 * 1024; //max message size 1000 kB!
+    TUint   allLimit = 999999;
+    TInt    error;
+    TRadix  radix = EDecimal;
+    TLex16  lex;
+    TTestReadStatus readStatus = ETestUnknown;
+    CMmsAttaStructure* oneAtta = NULL;
+	TInt    index;
+    TTime y1970( K1970 );
+    TTimeIntervalMicroSeconds interval;
+    TTime date;
+    TInt order = 0;
+    TInt16 shortInteger = 0;
+
+    //iso luuppi, joka kiert ja lukee kunnes EOF tule vastaan
+    //Big Loop, which passes around and read until the EOF
+
+    iMessageType = iNextMessageType;
+    while(readStatus != ETestEof)
+        {
+        readStatus = ReadRowL();
+        if ( readStatus ==  ETestEof )
+            {
+            return(-1);
+            }
+        if ( readStatus == ETestUnknown )
+            {
+            // A line containing only comments, or an unknown tag
+            // As using the scripts to test settings is no longer supported,
+            // any old keywords used to test CMmsSettings class are ignored
+            continue;
+            }
+        if( readStatus == ETestNewMessage )
+            {
+            iNextMessageType = readStatus;
+            if(aMessageCounter++)
+                {
+                return(NULL);
+                }
+            else
+                {
+                iMessageType = iNextMessageType;
+                continue;
+                }
+            }
+        if ( iMessageType == ETestNewMessage)
+            {
+            switch(readStatus)
+                {
+                case ETestFrom:
+                    aMmsHeaders.SetSenderL( iValueBuffer );
+                    break;
+                case ETestFromAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+	    				}
+                    break;
+                case ETestTo:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+                    break;
+                case ETestToAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+						}
+                    break;
+                case ETestCc:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+                    break;
+                case ETestCcAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+						}
+                    break;
+                case ETestBcc:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+                    break;
+                case ETestBccAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+						}
+                    break;
+                case ETestSubject:
+                    aMmsHeaders.SetSubjectL( iValueBuffer );
+                    break;
+                case ETestExpiryRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetExpiryInterval( val );
+                        }
+                    break;
+                case ETestExpiryAbs:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    // expiry date in seconds from 1.1.1970.
+                    aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+                    break;
+                case ETestDeliveryTimeRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetDeliveryTimeInterval( val );
+                        }
+                    break;
+                case ETestDeliveryTimeAbs:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+                    break;
+                case ETestDate:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+                case ETestPriority:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KLow)) == 0)
+                        {
+                        val = EMmsPriorityLow;
+                        }
+                    else if ((iValueBuffer.CompareF(KNormal)) == 0)
+                        {
+                        val = EMmsPriorityNormal;
+                        }
+                    else if ((iValueBuffer.CompareF(KHigh)) == 0)
+                        {
+                        val = EMmsPriorityHigh;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessagePriority( val );
+                    break;
+                case ETestSenderVisibility:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KHide)) == 0)
+                        {
+                        val = EMmsSenderVisibilityHide;
+                        }
+                    else if ((iValueBuffer.CompareF(KShow)) == 0)
+                        {
+                        val = EMmsSenderVisibilityShow;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetSenderVisibility( val );
+                    break;
+                case ETestDeliveryReport:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDeliveryReport( val );
+                    break;
+                case ETestDelivReportSendAllow:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReportAllowed( val );
+                    break;
+
+                case ETestReadReply:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReadReply( val );
+                    break;
+                case ETestNewAttachment:
+                    oneAtta = CMmsAttaStructure::NewL();
+                    iAttaStructures->AppendL(oneAtta);
+                    oneAtta->iAtta->Des().Copy( iValueBuffer );
+                    iAttaCount++;
+                    break;
+                case ETestAttachmentType:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaType->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttachmentContLoc:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaName->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttaRecommendedName:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttachmentCharset:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        if (oneAtta != NULL)
+                            {
+                            oneAtta->iAttaCharset = val;
+                            }
+                        }
+                    break;
+                case ETestAttachmentCid:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+                        }
+                    break;
+                case ETestAttContTypeParamName:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttContTypeParamValue:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttXTypeParamName:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttXTypeParamValue:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttachmentRoot:
+                    iAttaRoot = iAttaCount;
+                    break;
+                case ETestAlias:
+                    // all aliases are global even if they appear
+                    // in the middle of a message
+                    iAliasArray->AppendL( iValueBuffer );
+                    iAliasCount++;
+				    break;
+                case ETestMessageClass: // should be handled!
+                    val = EMmsClassPersonal;
+                    if ((iValueBuffer.CompareF(KPersonal)) == 0)
+                        {
+                        val = EMmsClassPersonal;
+                        }
+                    else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+                        {
+                        val = EMmsClassAdvertisement;
+                        }
+                    else if ((iValueBuffer.CompareF(KInformational)) == 0)
+                        {
+                        val = EMmsClassInformational;
+                        }
+                    else if ((iValueBuffer.CompareF(KAuto)) == 0)
+                        {
+                        val = EMmsClassAuto;
+                        }
+                    else
+                        {
+                        val = (TMmsMessageClass)KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessageClass( val );
+                    break;
+                case ETestReplyCharging:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KRequested)) == 0)
+                        {
+                        val = KMmsReplyChargingRequested;
+                        }
+                    else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+                        {
+                        val = KMmsReplyChargingRequestedTextOnly;
+                        }
+                    else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+                        {
+                        val = KMmsReplyChargingAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+                        {
+                        val = KMmsReplyChargingAcceptedTextOnly;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReplyCharging( val );
+                    break;
+                case ETestReplyChargAbs:
+                    error = date.Set(iValueBuffer);
+                    if ( error == KErrNone )
+                        {
+                        interval = date.MicroSecondsFrom( y1970 );
+                        aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+                        }
+                    break;
+                case ETestReplyChargRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetReplyChargingInterval( val );
+                        }
+                    break;
+                case ETestReplyChargSize:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,sizeLimit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetReplyChargingSize( val );
+                        }
+                    break;
+                case ETestReplyChargID:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+                    break;
+                case ETestTID:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetTidL( iByteBuffer->Des() );
+                    break;
+                case ETestContentLocation:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+                        {
+                        aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+                        }
+                    else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+                        }
+                    else
+                        {
+                        aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+                        }
+                    break;
+                case ETestPreviouslySentIndex:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    order = val;
+                    break;
+                case ETestPreviouslySentBy:
+                    aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+                    break;
+                case ETestPreviouslySentDate:
+                    error = date.Set(iValueBuffer);
+                    if ( error == KErrNone )
+                        {
+                        interval = date.MicroSecondsFrom( y1970 );
+                        aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+                        }
+                    break;
+                case ETestMessageId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+                    break;
+                case ETestMessageSize:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,sizeLimit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetMessageSize( val );
+                        }
+                    break;
+                case ETestVersion:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,EHex,limit);
+                    shortInteger = TInt16( val );
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetMmsVersion( shortInteger );
+                        }
+                    break;
+                case ETestReadStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KRead)) == 0)
+                        {
+                        val = KMmsReadStatusRead;
+                        }
+                    else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+                        {
+                        val = KMmsReadStatusDeletedWithoutBeingRead;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReadStatus( val );
+                    break;
+                case ETestResponseStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+                        {
+                        val = KMmsErrorUnspecified;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+                        {
+                        val = KMmsErrorMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+                        {
+                        val = KMmsErrorNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorNoContentAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+                        {
+                        val = KMmsErrorUnsupportedMessage;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorTransientSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+                        {
+                        val = KMmsErrorTransientMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorPermanentSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorPermanentContentNotAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingForwardingDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingNotSupported;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+                        {
+                        val = KMmsErrorTransientPartialSuccess;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+                        {
+                        val = KMmsErrorPermanentAddressHidingNotSupported;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteStatusL( order, val );
+                        }
+                    else
+                        {
+                         aMmsHeaders.SetResponseStatus( val );
+                        }
+                    break;
+                case ETestResponseText:
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+                        }
+                    else
+                        {
+                        aMmsHeaders.SetResponseTextL( iValueBuffer );
+                        }
+                    break;
+                case ETestRetrieveStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+                        {
+                        val = KMmsErrorReceiveTransientMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorReceiveTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorReceivePermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+                        {
+                        val = KMmsErrorReceivePermanentContentUnsupported;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetResponseStatus( val );
+                    break;
+                case ETestRetrieveText:
+                    aMmsHeaders.SetResponseTextL( iValueBuffer );
+                    break;
+                case ETestStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KDeferred)) == 0)
+                        {
+                        val = KMmsMessageStatusDeferred;
+                        }
+                    else if ((iValueBuffer.CompareF(KExpired)) == 0)
+                        {
+                        val = KMmsMessageStatusExpired;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+                        {
+                        val = KMmsMessageStatusRetrieved;
+                        }
+                    else if ((iValueBuffer.CompareF(KRejected)) == 0)
+                        {
+                        val = KMmsMessageStatusRejected;
+                        }
+                    else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+                        {
+                        val = KMmsMessageStatusUnrecognized;
+                        }
+                    else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+                        {
+                        val = KMmsMessageStatusIndeterminate;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+                        {
+                        val = KMmsMessageStatusForwarded;
+                        }
+                    else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+                        {
+                        val = KMmsMessageStatusUnreachable;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetStatus( val );
+                    break;
+                case ETestMessageType:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KSendReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMSendReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMSendConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+                        {
+                        val = KMmsMessageTypeMNotificationInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+                        {
+                        val = KMmsMessageTypeMNotifyRespInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMRetrieveConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+                        {
+                        val = KMmsMessageTypeAcknowledgeInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+                        {
+                        val = KMmsMessageTypeDeliveryInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+                        {
+                        val = KMmsMessageTypeReadRecInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+                        {
+                        val = KMmsMessageTypeReadOrigInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+                        {
+                        val = KMmsMessageTypeForwardReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+                        {
+                        val = KMmsMessageTypeForwardConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxStoreReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxStoreConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxViewReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxViewConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxUploadReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxUploadConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDeleteReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDeleteConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDescr;
+                        }
+                    else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+                        {
+                        val = KMmsMessageTypeDeleteReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+                        {
+                        val = KMmsMessageTypeDeleteConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+                        {
+                        val = KMmsMessageTypeCancelReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+                        {
+                        val = KMmsMessageTypeCancelConf;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessageType( val );
+                    break;
+                case ETestAttribute:
+                    val = 0;
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+                        {
+                        val = KMmsAssignedBcc;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+                        {
+                        val = KMmsAssignedCc;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+                        {
+                        val = KMmsAssignedContent;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+                        {
+                        val = KMmsAssignedContentType;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+                        {
+                        val = KMmsAssignedDate;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+                        {
+                        val = KMmsAssignedDeliveryReport;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+                        {
+                        val = KMmsAssignedDeliveryTime;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+                        {
+                        val = KMmsAssignedExpiry;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+                        {
+                        val = KMmsAssignedFrom;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+                        {
+                        val = KMmsAssignedMessageClass;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+                        {
+                        val = KMmsAssignedMessageId;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+                        {
+                        val = KMmsAssignedMessageSize;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+                        {
+                        val = KMmsAssignedPriority;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+                        {
+                        val = KMmsAssignedReadReply;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+                        {
+                        val = KMmsAssignedSubject;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+                        {
+                        val = KMmsAssignedTo;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+                        {
+                        val = KMmsAssignedReplyCharging;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingID;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingDeadline;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingSize;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+                        {
+                        val = KMmsAssignedPreviouslySentBy;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+                        {
+                        val = KMmsAssignedPreviouslySentDate;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+                        {
+                        val = KMmsAssignedAdditionalHeaders;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+                    break;
+                case ETestDistributionIndicator:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDistributionIndicator( val );
+                    break;
+                case ETestLimit:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if( error == KErrNone )
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+                        }
+                    break;
+                case ETestMessageQuota:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+                        }
+                    break;
+                case ETestSizeQuota:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+                        }
+                    break;
+                case ETestMessageTotal:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+                        }
+                    break;
+                case ETestSizeTotal:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+                        }
+                    break;
+                case ETestMessageCount:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+                        }
+                    break;
+                case ETestAddKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+                    break;
+                case ETestRemoveKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+                    break;
+                case ETestFilterKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+                    break;
+                case ETestMMState:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KDraft)) == 0)
+                        {
+                        val = KMmsDraft;
+                        }
+                    else if ((iValueBuffer.CompareF(KSent)) == 0)
+                        {
+                        val = KMmsSent;
+                        }
+                    else if ((iValueBuffer.CompareF(KNew)) == 0)
+                        {
+                        val = KMmsNew;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+                        {
+                        val = KMmsRetrieved;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+                        {
+                        val = KMmsForwarded;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+                        }
+                    else
+                        {
+                        aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+                        }
+                    break;
+                case ETestQuota:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+                    break;
+                case ETestStart:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+                        }
+                    break;
+                case ETestStore:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+                    break;
+                case ETestStored:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+                    break;
+                case ETestStoreStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusPermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusPermanentMmboxFull;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+                    break;
+                case ETestStoreStatusText:
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+                    break;
+                case ETestTotals:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+                    break;
+
+                case ETestDeleteInfoIndex:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    order = val;
+                    break;
+
+                case ETestApplicId:
+                    aMmsHeaders.SetApplicIdL( iValueBuffer );
+                    break;
+                case ETestReplyApplicId:
+                    aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+                    break;
+                case ETestApplicInfo:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+                    break;
+                case ETestContentClass:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KText)) == 0)
+                        {
+                        val = KMmsContentClassText;
+                        }
+                    else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+                        {
+                        val = KMmsContentClassImageBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+                        {
+                        val = KMmsContentClassImageRich;
+                        }
+                    else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+                        {
+                        val = KMmsContentClassVideoBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+                        {
+                        val = KMmsContentClassVideoRich;
+                        }
+                    else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+                        {
+                        val = KMmsContentClassMegaPixel;
+                        }
+                    else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+                        {
+                        val = KMmsContentClassContentBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+                        {
+                        val = KMmsContentClassContentRich;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetContentClass( val );
+                    break;
+                case ETestDrmContent:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDrmContent( val );
+                    break;
+                case ETestAdaptationAllowed:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetAdaptationAllowed( val );
+                    break;
+                case ETestRecommendedRetrievalMode:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KManual)) == 0)
+                        {
+                        val = KMmsRecommendedRetrievalModeManual;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetRecommendedRetrievalMode( val );
+                    break;
+                case ETestRecRetrievalModeText:
+                    aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+                    break;
+                case ETestReplaceId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+                    break;
+                case ETestStatusText:
+                    aMmsHeaders.SetResponseTextL( iValueBuffer );
+                    break;
+                case ETestCancelId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+                    break;
+                case ETestCancelStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+                        {
+                        val = KMmsCancelRequestSuccessfullyReceived;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+                        {
+                        val = KMmsCancelRequestCorrupted;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetCancelStatus( val );
+                    break;
+                default:
+                    break;
+                }
+            }
+            else
+            {
+            switch(readStatus)
+                {
+                case ETestAlias:
+                    iAliasArray->AppendL( iValueBuffer );
+                    iAliasCount++;
+				    break;
+
+                default:
+                    break;
+                }
+
+            }
+        }
+    return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+    {
+
+        TBuf8<DefaultBufLen> RowBuffer;
+        TBuf8<32> KeyBuffer;
+
+        // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+        TChar delim( 10 );
+        iReader->ReadL( RowBuffer, delim);
+        TInt length = RowBuffer.Length();
+        if ( RowBuffer.Length() < 2 )
+            {
+            return ETestEof;
+            }
+        RowBuffer.Delete(length - 2,2);
+
+        // DROP POSSIBLE COMMENT OUT
+        TInt pos = RowBuffer.Locate( ';' );
+		if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+        if ( RowBuffer.Length() == 0 )
+            {
+            // the line contained only comment
+            return ETestUnknown;
+            }
+
+        // First split the row (:)
+        pos = RowBuffer.Locate( ':' );
+        if (pos > 0)
+        {
+            TPtrC8 p = RowBuffer.Mid( pos+1 );
+            length = p.Length();
+            iValueBuffer.Zero();
+            for (TInt i=0; i < length; ++i)
+                {
+                iValueBuffer.Append(p[i]);
+                }
+            iValueBuffer.Trim();
+            TPtrC8 pp = RowBuffer.Left(pos);
+            KeyBuffer.CopyUC(pp);
+            KeyBuffer.Trim();
+        }
+        // TRY TO FIND CORRECT TAG
+        if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+        if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+        if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+        if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+        if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+        if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+        if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+        if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+        if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+        if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+        if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+        if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+        if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+        if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+        if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+        if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+        if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+        if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+        if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+        if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+        if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+        if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+        if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+        if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+        if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+        if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+        if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+        if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+        if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+        if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+        if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+        if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+        if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+        if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+        if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+        if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+        if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+        if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+        if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+        if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+        if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+        if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+        if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+        if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+        if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+        if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+        if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+        if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+        if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+        if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+        if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+        if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+        if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+        if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+        if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+        if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+        if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+        if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+        if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+        if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+        if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+        if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+        if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+        if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+        if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+        if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+        if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+        if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+        if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+        if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+        if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+        if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+        if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+        if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+        if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+        if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+        if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+        if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+        if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+        if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+        if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+        if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+        if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+        return ETestUnknown;
+    }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+    {
+
+    // Reset inactivity timer to keem viewServer from crashing
+    User::ResetInactivityTime();
+
+    TInt      i;
+    TInt error = KErrNone;
+    RFile attaFile;
+    _LIT8(KLeftAngle, "<");
+    _LIT8(KRightAngle, ">");
+    // we can't use "seconds from" as it only returns a
+    // 32 bit signed integer. If fails in 2038.
+    // "microseconds from" returns a 64 bit signed integer
+
+    CMsvStore* store = aMmsClient->Entry().EditStoreL();
+    CleanupStack::PushL(store);
+    aMmsHeaders->StoreL(*store);
+    store->CommitL();
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+
+    aMmsClient->LoadMessageL(); // read store is needed to do this
+
+    store = aMmsClient->Entry().EditStoreL();
+    CleanupStack::PushL(store);
+    CMsvAttachment* attaInfo = NULL;
+    TMsvAttachmentId attaId = 0;
+
+    for ( i=0; i < iAttaStructures->Count(); ++i)
+        {
+        attaId = KMsvNullIndexEntryId;
+        iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+        error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+        User::LeaveIfError( error );
+
+		CleanupClosePushL(attaFile);
+
+		CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+		CleanupStack::PushL( mimeHeaders );
+		TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+        TDataRecognitionResult result;
+        result.Reset(); // make sure that it is cleared
+
+        if(iAttaStructures->At(i)->iAttaCid->Length())
+            {
+            TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+            if (attaCID.Find(KLeftAngle) == 0 &&
+                attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+                {
+                // remove angle brackets from cid
+                attaCID = attaCID.Mid(1,attaCID.Length()-2);
+                }
+            mimeHeaders->SetContentIdL(attaCID);
+            }
+
+        if (iAttaStructures->At(i)->iAttaCharset)
+            {
+            mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+            }
+
+        if (iAttaStructures->At(i)->iAttaName->Length())
+            {
+            iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+            }
+        iParse.Set( iFilename, NULL, NULL );
+        iFilename.Copy( iParse.NameAndExt() );
+
+        mimeHeaders->SetContentLocationL( iFilename );
+
+		// if Mime type has not been set, use RapaRecognizer
+		if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+		    {
+		    // TO BE IMPLEMENTED
+
+            RApaLsSession lsSession;
+
+            if ( lsSession.Connect() == KErrNone )
+                {
+                CleanupClosePushL( lsSession );
+
+                iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+                if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+                    {
+                    // Check confidence level. Recognization must be at least
+                    // "EProbable". We don't accept the result if it is "EPossible"
+                    // or "EUnlikely" or "ENotRecognized"!
+
+                    if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+                        {
+                        result.Reset(); // clear buffer and try again with longer buffer
+                        }
+
+                    TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+                    if ( mimeBuf8.Length() == 0 )
+                        {
+                        // Open file buffer and try again..
+
+                        TInt bufSize = 0;
+                        (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+                        if ( bufSize <= 0 )
+                            {
+                            bufSize = 30;
+                            }
+                        HBufC8* buf = HBufC8::NewLC( bufSize );
+                        TPtr8 des = buf->Des();
+
+                        RFile file;
+                        TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+                        if ( err == KErrNone )
+                            {
+                            err = file.Read( des );
+                            file.Close();
+                            if ( err == KErrNone )
+                                {
+                                if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+                                    {
+                                    mimeBuf8.Set( result.iDataType.Des8() );
+                                    }
+                                }
+
+                            }
+                        CleanupStack::PopAndDestroy(); // buf
+                        }
+                    if ( mimeBuf8.Length() > 0 &&
+                        result.iConfidence >= CApaDataRecognizerType::EProbable )
+                        {
+                        contentType.Set( result.iDataType.Des8() );
+                        }
+                    }
+                CleanupStack::PopAndDestroy(1); // lssession
+                }
+		    }
+
+        if ( contentType.Length() > 0 )
+            {
+            TInt position = contentType.Find( KMmsSlash8 );
+            if ( position >= 0 )
+                {
+                mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+                }
+            if ( position < contentType.Length() - 1 )
+                {
+                mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+                }
+//          CreateAttachment2L sets the content type to attaInfo
+//            attaInfo->SetMimeTypeL( contentType );
+            }
+
+        if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+            {
+            iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+            iParse.Set( iFilename, NULL, NULL );
+            iFilename.Copy( iParse.NameAndExt() );
+            mimeHeaders->SetSuggestedFilenameL( iFilename );
+            }
+
+        TInt j = 0;
+        for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+            {
+            mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+            }
+        for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+            {
+            mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+            }
+
+        attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+        // attaInfo does not go onto cleaunpstack because ownership will
+        // be transferred to attachment manager.
+
+        aMmsClient->CreateAttachment2L(
+            *store,
+            attaFile,
+            contentType,
+            *mimeHeaders,
+            attaInfo,
+            attaId);
+        attaInfo = NULL; // ownership transferred
+
+        CleanupStack::PopAndDestroy(); // mimeHeaders
+        CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+        if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+            {
+            aMmsClient->SetMessageRootL( attaId );
+            }
+        }
+
+    store->CommitL();
+    CleanupStack::PopAndDestroy(); // store
+
+    // This frees all memory and resets all values
+    Reset();
+    // Reset inactivity timer to keem viewServer from crashing
+    User::ResetInactivityTime();
+    }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+    {
+	TBuf<DefaultBufLen> abuf;
+	for( TInt i=0; i < iAliasCount; ++i )
+	    {
+		abuf.Copy( iAliasArray->MdcaPoint(i) );
+		abuf.SetLength( abuf.Locate('=') );
+		if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+	    }
+	return( -1 );
+    }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+    {
+    iAtta = NULL;
+    iAttaType = NULL;
+    iAttaName = NULL;
+    iAttaCid = NULL;
+    iAttaRecommendedName = NULL;
+    }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+    {
+    iAtta = HBufC8::NewL(DefaultBufLen);
+    iAttaType = HBufC8::NewL(DefaultBufLen);
+    iAttaName = HBufC8::NewL(DefaultBufLen);
+    iAttaCid = HBufC8::NewL(DefaultBufLen);
+    iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+    iAttaCharset = 0;
+   	iXTypeParams  = new(ELeave) CDesC8ArrayFlat(4);
+   	iContentTypeParams  = new(ELeave) CDesC8ArrayFlat(4);
+
+    }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+    {
+    CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+    {
+    delete iAtta;
+    delete iAttaName;
+    delete iAttaType;
+    delete iAttaCid;
+    delete iAttaRecommendedName;
+    if ( iContentTypeParams )
+        {
+    	iContentTypeParams->Reset();
+        }
+  	delete iContentTypeParams;
+    if ( iXTypeParams )
+        {
+      	iXTypeParams->Reset();
+        }
+	delete iXTypeParams;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestbed.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,2357 @@
+/*
+ * 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:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h"  //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+    {
+    //start the timer
+    iTimer = CTestUiTimer::NewL();
+    iTimer->Cancel();
+
+    iWait = CMsvOperationActiveSchedulerWait::NewLC();
+    // don't leave iWait on cleanup stack
+    CleanupStack::Pop();
+
+    //open msvsession
+    iSession = CMsvSession::OpenSyncL(*this);
+    //create client registry
+    iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+    //create client mtm
+    iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+            KUidMsgTypeMultimedia);
+
+    User::LeaveIfError( iFs.Connect() );
+    iFs.SetSessionPath( KRootPath );
+    iSettings = CMmsSettings::NewL();
+    iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+    findDefaultL();
+    iServiceId = iDefaultServiceId;
+
+    //validate the settings
+    iSettings->ValidateSettings();
+
+    iLogEvent = CLogEvent::NewL();
+    iLogEvent->SetEventType(KLogMmsEventTypeUid);
+    iLogClient = NULL; // we test soon if this is available
+    iLogView = NULL; // needs log client
+    if ( checkLogClient() )
+        {
+        // first we generate a general view of all events
+        // we'll set the filter when we update the view
+        iLogView = CLogViewEvent::NewL( *iLogClient );
+        }
+    iLogFilter = CLogFilter::NewL();
+    // we try to filter MMS events
+    iLogFilter->SetEventType(KLogMmsEventTypeUid);
+    }
+
+MmsTestBed::~MmsTestBed()
+    {
+    delete iLogView;
+    delete iLogFilter;
+    delete iLogClient;
+    delete iLogEvent;
+    delete iSettings;
+    delete iMmsHeaders;
+    if(iTimer)
+    {
+        iTimer->Cancel();
+        delete iTimer;
+    }
+    //delete iMsvEntrySelection;
+    delete iMmsClient;
+    delete iClientMtmRegistry;
+    //delete iClientMtmRegistry;
+    delete iSession;
+    delete iWait;
+    }
+
+void MmsTestBed::setConnectionLocal(bool value)
+    {
+    //value = true for global off, local on
+    //value = false for global on, local off
+    iSettings->LoadSettingsL();
+    iSettings->SetLocalMode( value );
+    iSettings->SaveSettingsL();
+    }
+
+void MmsTestBed::fromOutboxToMmsc()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    // Get List of services
+    cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+            KUidMsgTypeMultimedia);
+    CleanupStack::PushL(selection);
+
+    // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+    for (TInt i = 0; i < selection->Count(); ++i)
+        {
+        cEntry->SetEntryL(selection->At(i));
+        TMsvEntry entry = cEntry->Entry();
+        entry.SetReadOnly(EFalse);
+        entry.SetSendingState(KMsvSendStateUnknown);
+        cEntry->ChangeL(entry);
+        }
+
+    selection->InsertL(0, iServiceId);
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack(parameters);
+
+    op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+            iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending)
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if (iWait->iStatus.Int() != KErrNone)
+        {
+        //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    CleanupStack::PopAndDestroy(); //cEntry
+    }
+
+void MmsTestBed::fromMmscToInbox()
+    {
+    CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+    CleanupStack::PushL(msvEntrySelection);
+
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        msvEntrySelection->InsertL(0, iServiceId);
+        }
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack(parameters);
+
+    op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+            paramPack, iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending)
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if (iWait->iStatus.Int() != KErrNone)
+        {
+        //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); //msvEntrySelection
+    }
+
+void MmsTestBed::findDefaultL()
+    {
+    iSettings->LoadSettingsL();
+    iDefaultServiceId = iSettings->Service();
+    }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+        TAny* aArg2, TAny* /*aArg3*/)
+    {
+    iEvent = aEvent;
+    if (aEvent == EMsvGeneralError)
+        {
+        return;
+        }
+    TMsvId parentId = KMsvNullIndexEntryId;
+    if (aArg2 != NULL)
+        {
+        parentId = *(TMsvId*) aArg2;
+        }
+
+    CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+    TMsvEntry tEntry;
+    TMsvId service;
+    TInt error = KErrNone;
+    error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+    CMsvEntry* cEntry = NULL;
+    switch (aEvent)
+        {
+        case EMsvEntriesCreated:
+            {
+            if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+                {
+                // emit signal for new entry into INBOX
+                emit entryCreatedInInbox(tEntry.Id());
+                }
+            else if (parentId == KMsvDraftEntryIdValue)
+                {
+                // emit signal for new entry into Draft
+                emit entryCreatedInDraft(tEntry.Id());
+                }
+            else if (parentId == iServiceId)
+                {
+                // emit signal for new Entry into SERVICE
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+            break;
+        case EMsvEntriesChanged:
+            {
+            TMsvId id;
+            CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+            if (selection == NULL)
+                {
+                // no selection, cannot handle
+                return;
+                }
+            id = selection->At(0);
+            //DEBUG Entry changed"));
+            if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+                {
+/*
+                cEntry = iSession->GetEntryL( parentId );
+                CleanupStack::PushL( cEntry );
+                TRAPD (error, cEntry->SetEntryL( id ));
+                if ( error != KErrNone )
+                    {
+                    CleanupStack::PopAndDestroy(); // cEntry
+                    return;
+                    }
+                TMsvEntry tEntry = cEntry->Entry();
+                if ( tEntry.Visible() )
+                    {
+                    // generate fake delivery report
+                    CMsvStore* store = cEntry->ReadStoreL();
+                    CleanupStack::PushL( store );
+                    CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+                    CleanupStack::PushL( mmsHeaders );
+                    mmsHeaders->RestoreL( *store );
+                    iEncodeBuffer->ResizeL( 0 );
+                    generateDeliveryReport( mmsHeaders );
+                    CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+                    }
+                CleanupStack::PopAndDestroy(); // cEntry
+*/
+                }
+            }
+            break;
+        case EMsvEntriesDeleted:
+            {
+            //emit signal for entry deleted
+            }
+            break;
+        case EMsvEntriesMoved:
+            {
+            if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+                {
+                // entry moved to outbox
+                emit entryMovedToOutbox(tEntry.Id());
+                }
+            else if (parentId == KMsvSentEntryIdValue)
+                {
+                // entry moved to sent folder
+                emit entryMovedToSent(tEntry.Id());
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+void MmsTestBed::createMmsService()
+    {
+    CMmsSettings * settings = CMmsSettings::NewL();
+    CleanupStack::PushL( settings );
+    settings->CreateNewServiceL( *iSession );
+    CleanupStack::PopAndDestroy(); // settings
+    return;
+    }
+
+void MmsTestBed::cleanup()
+    {
+    TMsvId entryToBeKilled;
+    // Get access to root index
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+
+    entryToBeKilled = iSettings->Service();
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    while (entryToBeKilled != KMsvNullIndexEntryId)
+        {
+        // delete child of root entry
+        deleteEntry(entryToBeKilled, *cEntry);
+        entryToBeKilled = iSettings->Service();
+        }
+
+    CleanupStack::PopAndDestroy(); // cEntry
+    // We deleted everything!
+    iDefaultServiceId = KMsvNullIndexEntryId;
+    iServiceId = KMsvNullIndexEntryId;
+    }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+    {
+    aClientEntry.DeleteL(aEntryId);
+    }
+
+void MmsTestBed::cleanupAndCreateNewService()
+    {
+    cleanup();
+    // all old service entries have been destroyed, create a new one
+    createMmsService();
+    }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+    {
+    // update settings in mmsclient
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+
+    RFileReadStream readStream;
+    readStream.PushL();
+//    TMsvId id = KMsvNullIndexEntryId;
+    CBufFlat* encodeBuffer = NULL;
+    CMmsEncode* encoder = NULL;
+
+    // Open the file
+    TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+    if (err != KErrNone) User::Leave( err );
+
+    TInt   retCode = 0;
+    CMmsReadFile* readFile = NULL;
+    readFile = CMmsReadFile::NewL( iFs, readStream );
+    CleanupStack::PushL( readFile );
+
+    TInt messageCounter = 0;
+    CMsvEntry* cEntry = NULL;
+
+    while(!retCode)
+        {
+        // READ MESSAGE TO BUFFERS
+        iMmsHeaders->Reset(iSettings);
+        // put in some message type just for fun (testing...)
+        iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+        retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+        if(readFile->iMessageType == ETestNewMessage)
+            {
+            // CREATE MESSAGE ENTRY
+            switch ( aCommand )
+                {
+                case ECreateToInbox:
+                case ECreateNotification:
+                    cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+                    break;
+                case ECreateToSentItems:
+                    cEntry = iSession->GetEntryL(KMsvSentEntryId);
+                    break;
+                case ECreateToDrafts:
+                    cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+                    break;
+                case ECreateHeadersFromFile:
+                    // here we just encode headers, no message entry
+                    // the entry is fake.
+                    break;
+                case ECreateMMBoxViewConf:
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        // entry is not created for the description items
+                        // they become attachments
+                        cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+                        }
+                    break;
+                default:
+                    cEntry = iSession->GetEntryL(aBox);
+                    break;
+                }
+
+            // if we are just playing with headers we have no entry
+            if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+                {
+                CleanupStack::PushL(cEntry);
+                iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+                // CREATE MESSAGE
+                iMmsClient->CreateMessageL(iServiceId);
+                }
+            else if ( aCommand == ECreateMMBoxViewConf )
+                {
+                if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                    {
+                    CleanupStack::PushL(cEntry);
+                    iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+                    // CREATE MESSAGE
+                    iMmsClient->CreateMessageL(iServiceId);
+                    }
+                else
+                    {
+                    encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+                    CleanupStack::PushL( encodeBuffer );
+                    encoder = CMmsEncode::NewL( iFs );
+                    CleanupStack::PushL( encoder );
+
+                    // encode headers to a binary file
+                    encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+                    iFilename = KMmsMMBoxDescriptionDirectory;
+                    TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+                    CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+                    encodeBuffer = NULL;
+                    encoder = NULL;
+                    }
+                }
+            else
+                {
+                encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+                CleanupStack::PushL( encodeBuffer );
+                encoder = CMmsEncode::NewL( iFs );
+                CleanupStack::PushL( encoder );
+
+                // encode headers to a binary file
+                encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+                iFilename = KMmsDumpDirectory;
+                TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+                CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+                encodeBuffer = NULL;
+                encoder = NULL;
+                }
+            }
+
+        if ( aCommand != ECreateHeadersFromFile &&
+            ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+            {
+            if(readFile->iMessageType == ETestSettings)
+                {
+                TMsvId ServiceId = iMmsClient->DefaultServiceL();
+                iMmsClient->RestoreSettingsL();
+                iSettings->CopyL( iMmsClient->MmsSettings() );
+                }
+
+            TMemoryInfoV1Buf memory;
+            UserHal::MemoryInfo( memory );
+            TInt available = memory().iFreeRamInBytes;
+//            TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+            TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+            available = memory().iFreeRamInBytes;
+//            TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+            if(readFile->iMessageType == ETestNewMessage)
+                {
+                TMsvEntry tEntry = iMmsClient->Entry().Entry();
+                TMsvId id = tEntry.Id();
+                if ( err == KErrNone )
+                    {
+                    // SAVE MESSAGE
+                    iMmsClient->SaveMessageL();
+
+                    // If we are creating a MMBox View confirmation,
+                    // we add all binary files from KMmsMMBoxDirectory
+                    // as attachments.
+
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        addMMBoxDescriptions();
+                        }
+
+                    // reload the entry in case mms client put something into it
+                    // MESSAGE MUST BE SET VISIBLE
+                    tEntry = iMmsClient->Entry().Entry();
+                    if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+                        }
+                    else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageInformational;
+                        }
+                    tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+                    // Test: Set all as editor oriented - except notifications!
+                    if ( aCommand == ECreateNotification )
+                        {
+                        tEntry.iMtm = KUidMsgMMSNotification;
+                        }
+                    else
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+                        }
+                    if ( aCommand == ECreateToInbox )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+                        tEntry.SetReadOnly( ETrue );
+                        tEntry.SetNew( ETrue );
+                        tEntry.SetUnread( ETrue );
+                        }
+                    else if ( aCommand == ECreateToSentItems )
+                        {
+                        tEntry.SetReadOnly( ETrue );
+                        }
+                    tEntry.SetVisible( ETrue );
+                    tEntry.SetInPreparation( EFalse );
+                    TTime now;
+                    now.UniversalTime();
+                    tEntry.iDate = now;
+                    TMsvId entryId = tEntry.Id();
+                    iMmsClient->Entry().ChangeL( tEntry );
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        // Encode to the directory that is used to fetch MMBox view
+                        iFilename.Copy( KMmsMMBoxDirectory );
+                        encodeMessageFromDrafts();
+                        cEntry->SetEntryL( KMsvDraftEntryId );
+                        cEntry->DeleteL( entryId );
+                        }
+                    }
+                else
+                    {
+                    //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+                    iSession->RemoveEntry(id);
+                    err = KErrNone; // clear error
+                    }
+                CleanupStack::PopAndDestroy(); // cEntry
+                cEntry = NULL;
+                }
+            if(readFile->iMessageType == ETestSettings)
+                {
+                iMmsClient->SetSettingsL( *iSettings );
+                iMmsClient->StoreSettingsL();
+                }
+        }
+    }
+
+    CleanupStack::PopAndDestroy(); //readFile
+
+    readStream.Close();
+    readStream.Pop();
+
+    /*
+    iMmsClient->SwitchCurrentEntryL(id);
+    */
+    }
+
+void MmsTestBed::addMMBoxDescriptions()
+    {
+    // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+    CDir* fileList = NULL;
+    TInt i = 0;  // general counter
+    TInt error = KErrNone;
+    iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+    iFs.SetSessionPath(iCurrentPath);
+
+    TFindFile finder( iFs );
+    error = finder.FindWildByPath( KWild, NULL, fileList );
+    CleanupStack::PushL( fileList );
+    TInt fileCounter = 0;
+
+    if ( error == KErrNone )
+        {
+        fileCounter = fileList->Count();
+        }
+
+    TEntry entry;
+
+    if ( error == KErrNone )
+        {
+        for ( i = 0; i < fileCounter; ++i )
+            {
+            // Reset inactivity timer to keep viewServer from crashing
+            User::ResetInactivityTime();
+            entry = (*fileList)[i]; // name is entry.iName
+            iFilename.Copy( iCurrentPath );
+            iFilename.Append( entry.iName );
+            TPtrC ptr;
+            ptr.Set( iFilename );
+            iWait->iStatus = KErrNone;
+            iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+            iWait->Start();
+            // The descriptions are cleared after being used
+            iFs.Delete( ptr);
+            }
+        }
+
+    iMmsClient->SaveMessageL(); // just in case somthing must be updated
+    CleanupStack::PopAndDestroy(); // fileList
+    fileList = NULL;
+    }
+
+void MmsTestBed::encodeMessageFromDrafts()
+    {
+    CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+    CleanupStack::PushL( encoder );
+    // encode a message iMmsClientPoints to
+    iMmsClient->LoadMessageL();
+    CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->RestoreL( *store );
+    CleanupStack::PopAndDestroy(); // store
+    store = NULL;
+    iWait->iStatus = KErrNone;
+
+// caller sets the directory
+//    iFilename = KMmsMessageDumpDirectory;
+
+    CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+    CleanupStack::PushL( entryWrapper );
+    iEncodeBuffer->ResizeL(0);
+    encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+    iWait->Start();
+    if ( iWait->iStatus == KErrNone )
+        {
+        TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+        }
+    iEncodeBuffer->ResizeL(0);
+    CleanupStack::PopAndDestroy(); // entryWrapper
+    CleanupStack::PopAndDestroy(); // encoder
+    }
+
+void MmsTestBed::deleteNotifications()
+    {
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+
+    CMsvEntry* cEntry = NULL;
+    // delete all messages from the specified box
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+
+    if ( mmsFolderId != KMsvNullIndexEntryId )
+        {
+        cEntry->SetEntryL(mmsFolderId);
+
+        // show invisible entries
+        cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+        CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+        CleanupStack::PushL(msvEntrySelection);
+
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        if (msvEntrySelection->Count() > 0)
+            {
+            CMsvOperation* op = iSession->TransferCommandL(
+                *msvEntrySelection,
+                EMmsDeleteEntries,
+                paramPack,
+                iWait->iStatus);
+            CleanupStack::PushL(op);
+            iWait->Start();
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        // These cannot be deleted unless we have the a server mtm
+        // corresponding to this mtm type.
+        cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+        CleanupStack::PopAndDestroy(); //msvEntrySelection
+        msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+        CleanupStack::PushL(msvEntrySelection);
+
+        if (msvEntrySelection->Count() > 0)
+            {
+            CMsvOperation* op = iSession->TransferCommandL(
+                *msvEntrySelection,
+                EMmsDeleteEntries,
+                paramPack,
+                iWait->iStatus);
+            CleanupStack::PushL(op);
+            iWait->Start();
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    }
+
+TMsvId MmsTestBed::findMMSFolder()
+    {
+    return iSettings->NotificationFolder();
+    }
+
+void MmsTestBed::restoreFactorySettings()
+    {
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+    // do not reset access point
+    TInt accessPoint = iSettings->AccessPoint( 0 );
+    iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+    TInt count = iSettings->AccessPointCount();
+    TInt i = 0;
+    for ( i = count - 1; i >= 0; --i )
+        {
+        iSettings->DeleteAccessPointL( i );
+        }
+    // restore the original access point
+    if ( accessPoint > 0 )
+        {
+        // a negative access point is an error (most likely "KErrNotFound")
+        iSettings->AddAccessPointL( accessPoint, 0 );
+        }
+    iMmsClient->SetSettingsL( *iSettings );
+    iMmsClient->StoreSettingsL();
+    }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+    {
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+
+    iSettings->SetReceivingModeHome( aState );
+
+    iMmsClient->SetSettingsL( *iSettings );
+    iMmsClient->StoreSettingsL();
+    }
+
+void MmsTestBed::sendFromFile()
+    {
+    CMsvOperation * op = NULL;
+
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+    CleanupStack::PushL( cEntry );
+
+    CMsvEntrySelection* selection = NULL;
+    selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy(); // cEntry
+    CleanupStack::PushL( selection );
+
+    TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+    if ( error != KErrNone )
+        {
+        CleanupStack::PopAndDestroy(); // selection
+        delete op;
+        return;
+        }
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(2); // op, selection
+    }
+
+void MmsTestBed::sendOneByOne()
+    {
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+    CleanupStack::PushL( cEntry );
+
+    CMsvEntrySelection* selection = NULL;
+    selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PushL( selection );
+
+    CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( shortSelection );
+
+    TInt i;
+
+    for ( i = 0; i < selection->Count(); ++i )
+        {
+        shortSelection->Reset();
+        shortSelection->AppendL( selection->At( i ) );
+
+        CMsvOperation * op = NULL;
+
+        TTime now;
+        now.UniversalTime();
+
+        TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+        if ( error != KErrNone )
+            {
+            delete op;
+            CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+            return;
+            }
+        CleanupStack::PushL(op);
+        iWait->Start();
+
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+            }
+
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // op
+
+        }
+    CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+    }
+
+void MmsTestBed::sendNotifications()
+    {
+    // Only send one notification!!
+
+    TInt error = KErrNone;
+
+    if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+        {
+        //Not a file
+        return;
+        }
+    TMsvId mmsFolder = findMMSFolder();
+
+    TEntry entry;
+
+
+    // now I think we have a filename
+    TEntry orgEntry;
+    TUint size = 0;
+    error = iFs.Entry( iCurrentFile, orgEntry );
+    size = orgEntry.iSize;
+
+    //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+    if ( size == 0 )
+        {
+        //empty file
+        //TMmsLogger::Log(_L("- empty file"));
+        return;
+        }
+
+    if ( iEncodeBuffer == NULL )
+        {
+        iEncodeBuffer = CBufFlat::NewL( size );
+        }
+    else
+        {
+        iEncodeBuffer->ResizeL( 0 );
+        iEncodeBuffer->ResizeL( size );
+        }
+
+    RFile inFile;
+    error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+    TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+    if ( error == KErrNone )
+        {
+        error = inFile.Read( ptr, size );
+        inFile.Close();
+        }
+    else
+       {
+       //Error
+       //TMmsLogger::Log(_L("- can't read file"));
+       return;
+       }
+
+    TUint8 byte;
+    TUint position = 0;
+    TUint32 uintvar = 0;
+
+    if ( size > 2 )
+        {
+        iEncodeBuffer->Read( 1, &byte, 1 );
+        if ( byte == 6 ) // PUSH PDU
+            {
+            // try to find out length of header
+            position = 2;
+            iEncodeBuffer->Read( position, &byte, 1);
+
+            while ( byte & 0x80  && position < size )
+                {
+                uintvar += ( byte & 0x7f );
+                uintvar <<= 7;
+                position++;
+                iEncodeBuffer->Read( position, &byte, 1 );
+                }
+
+            // add last byte without shift
+            uintvar += byte;
+            position++;
+           }
+        }
+
+    position += uintvar;
+
+    if ( position < size )
+        {
+        ptr = iEncodeBuffer->Ptr( position );
+        size = ptr.Length();
+        }
+
+    if ( size == 0 )
+        {
+        //no MMS stuff
+        //TMmsLogger::Log(_L("- no MMS stuff"));
+        return;
+        }
+
+    TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+    // Now we have streamed our data into this entry.
+    // Now we have an entry that says: local service, MMS MTM
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    if ( entryId != KMsvNullIndexEntryId )
+        {
+        selection->AppendL( entryId );
+        }
+    else
+        {
+        selection->AppendL( iDefaultServiceId );
+        }
+
+    TWatcherParameters parameters; // initialized to zero
+    parameters.iWatcherId = RThread().Id();
+    parameters.iDataPointer = &ptr;
+    TWatcherParametersBuf paramPack( parameters );
+
+    CMsvOperation * op = NULL;
+
+    op = iSession->TransferCommandL(
+        *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    User::After(1000000);
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::copyDrafts()
+    {
+    CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+    cEntry = iSession->GetEntryL(KMsvSentEntryId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages in drafts
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+
+    TMsvLocalOperationProgress progress;
+    cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+    TInt i = 0;
+    for ( i = 0; i < selection->Count(); ++i )
+        {
+        cEntry->SetEntryL( selection->At( i ) );
+        TMsvEntry entry = cEntry->Entry();
+        entry.SetReadOnly( EFalse );
+        cEntry->ChangeL( entry );
+        }
+
+    CleanupStack::PopAndDestroy(2); // selection, cEntry
+    }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+    {
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+
+    TMMSGarbageCollectionParameters parameters; // initialized to zero
+    parameters.iReasonFlags = aReason;
+    TMMSGarbageCollectionParametersBuf paramPack( parameters );
+    op = iSession->TransferCommandL(
+        *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::messageVariation()
+    {
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+
+    op = iSession->TransferCommandL(
+        *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::cancelSendScheduling()
+    {
+    CMsvEntry* cEntry = NULL;
+    setFetchingState( EMmsReceivingPostpone );
+    testFile( iCurrentFile );
+    scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+    deleteSendSchedule();
+
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    if (iMsvEntrySelection != NULL)
+        {
+        delete iMsvEntrySelection;
+        iMsvEntrySelection = NULL;
+        }
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy();
+    }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+    {
+    CMsvEntry* cEntry = NULL;
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    cEntry = iSession->GetEntryL(aBoxId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+//    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledSend,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::deleteSendSchedule()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsDeleteSchedule,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::cancelFetchScheduling()
+    {
+    TMsvId mmsFolder = findMMSFolder();
+    CMsvEntry* cEntry = NULL;
+    setFetchingState( EMmsReceivingPostpone );
+    testFile( iCurrentFile );
+    fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+    // Wait until notification has arrived - may take a while in global mode
+    TInt i = 0;
+    while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+        && i < 2000 )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        i++;
+        if ( (i/100) * 100 == i )
+            {
+            //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+            }
+        CActiveScheduler::Start();
+        }
+    iTimer->Cancel();
+
+    fetchForced( 10000 ); // delay to allow cancelling
+    deleteFetchSchedule();
+
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(mmsFolder);
+    if (iMsvEntrySelection != NULL)
+        {
+        delete iMsvEntrySelection;
+        iMsvEntrySelection = NULL;
+        }
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+    {
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledReceiveForced,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::deleteFetchSchedule()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+    cEntry = iSession->GetEntryL( mmsFolderId );
+    CleanupStack::PushL(cEntry);
+    // Get all notifications
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsDeleteSchedule,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::doAFetchCycle()
+    {
+    // Sends a message from iCurrentFile and lets it come back
+    TMsvId mmsFolder = findMMSFolder();
+    testFile( iCurrentFile );
+    fromOutboxToMmsc(); // immediate send (EMmsSend)
+    // fetching will start automatically
+
+    TInt i = 0;
+    while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+         && i < 2000
+         && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        i++;
+        if ( (i/100) * 100 == i )
+            {
+            //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+            }
+        CActiveScheduler::Start();
+        }
+    iTimer->Cancel();
+    }
+
+bool MmsTestBed::checkLogClient()
+    {
+    if ( iLogClient == NULL )
+        {
+        TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+        }
+    return ( iLogClient != NULL );
+    }
+
+int MmsTestBed::getLogEntries()
+    {
+    TInt count = 0;
+    if ( !iLogView )
+        {
+        return 0;
+        }
+
+    if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+        {
+        // should complete with KErrNone
+        iWait->Start();
+        if ( iWait->iStatus.Int() == KErrNone )
+            {
+            count = iLogView->CountL();
+            }
+        }
+    return count;
+    }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+    {
+    CMsvOperation*  opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+    iWait->Start();
+    if (!opert->iStatus.Int()==KErrNone)
+        {
+        // what should we do? panic?
+        }
+
+    TPckgBuf<TMsvLocalOperationProgress> package;
+    package.Copy(opert->ProgressL());
+    *(TMsvId*)&aNewEntry = package().iId;
+
+    delete opert; opert=NULL;
+    }
+
+void MmsTestBed::cleanOutbox()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanInbox()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanSent()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanDrafts()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanAll()
+    {
+    cleanInbox();
+    cleanOutbox();
+    cleanSent();
+    cleanDrafts();
+    TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+    deleteNotifications();
+    }
+
+void MmsTestBed::reply()
+    {
+    // The first message from inbox is replied to
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::replyToAll()
+    {
+    // The first message from inbox is replied to
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+            KMsvMessagePartRecipient;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::forward()
+    {
+    // The first message from inbox is forwarded
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+            KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                iMmsClient->SwitchCurrentEntryL( newEntry );
+                // Add a sender: 0601234567
+                iMmsClient->LoadMessageL();
+                iMmsClient->SetSenderL( KMmsSender );
+                iMmsClient->SaveMessageL();
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::sendReadReport()
+    {
+    // TURN READ REPORTS ON (until available from menu)
+    iSettings->LoadSettingsL();
+    iSettings->SetReadReplyReportSendingAllowed( ETrue );
+    iSettings->SaveSettingsL();
+    iMmsClient->RestoreSettingsL();
+
+
+    // Read report is sent for the first message in inbox
+    CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+    if ( iMsvEntrySelection->Count() == 0 )
+        {
+        return;
+        }
+    TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+    // new test using Client MTM
+    CMsvOperation * op = NULL;
+    op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy( op );
+    op = NULL;
+
+    // Try sending the read report to current entry
+
+    iMmsClient->SwitchCurrentEntryL( originalEntry );
+    op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy( op );
+    op = NULL;
+
+/*
+    cEntry->SetEntryL( originalEntry );
+    iMmsHeaders->Reset();
+    CMsvStore* store = cEntry->ReadStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->RestoreL( *store );
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+    HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+    CleanupStack::PushL( messageId );
+    messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+    iMmsClient->SwitchCurrentEntryL( originalEntry );
+    iMmsClient->LoadMessageL();
+
+    iMmsHeaders->Reset();
+    iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+    // Message id cannot be accessed via MMS Client MTM!
+
+    iMmsHeaders->SetMessageIdL( messageId->Des() );
+    CleanupStack::PopAndDestroy( messageId );
+
+    iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+    // sender must be insert-address-token because we don't know our number
+    TTime now;
+    now.UniversalTime();
+
+    _LIT( K1970, "19700000:000000.000000" );    // 1-Jan 1970 0:00:00
+
+    TTime y1970( K1970 );
+    TTimeIntervalMicroSeconds interval;
+    // we can't use "seconds from" as it only returns a
+    // 32 bit signed integer. If fails in 2038.
+    // "microseconds from" returns a 64 bit signed integer
+    interval = now.MicroSecondsFrom( y1970 );
+    // date in iMmsHeaders() in seconds from 1.1.1970.
+    iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+    iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = FindMMSFolderL();
+
+    cEntry->SetEntryL( mmsFolderId );
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvMessageEntry;
+    entry.iMtm = KUidMsgTypeMultimedia;
+    entry.SetVisible( ETrue );
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    entry.iRelatedId = iDefaultServiceId;
+    entry.iMtmData1 = KMmsMessageReadRecInd;
+    cEntry->CreateL( entry );
+    TMsvId entryId = entry.Id();
+
+    cEntry->SetEntryL( entryId );
+
+    store = cEntry->EditStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->StoreL( *store );
+    store->CommitL();
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+
+    CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, entryId);
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy( op );
+    CleanupStack::PopAndDestroy( selection );
+*/
+    CleanupStack::PopAndDestroy( cEntry );
+    }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+    {
+    TInt error = KErrNone;
+    TInt messageCount = 0;
+    TInt failureCount = 0;
+    do {
+        CMsvEntry* cEntry = NULL;
+
+        // Get List of services
+        cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+        CleanupStack::PushL(cEntry);
+        // Get all mms messages of outbox
+        CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        CleanupStack::PushL( selection );
+        failureCount++;
+        // These are failures that fail in Message server.
+        if ( failureCount >= 63 && failureCount <= 64 )
+            {
+            failureCount = 65;
+            }
+        cEntry->SetEntryL( iServiceId );
+        TMsvEntry entry = cEntry->Entry();
+        entry.iMtmData3 &= 0x0000000FF;
+        entry.iMtmData3 |= failureCount << 8;
+        cEntry->ChangeL( entry );
+
+        selection->InsertL(0, iServiceId);
+
+        CMsvOperation * op = NULL;
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+        if ( error == KErrNone )
+            {
+            CleanupStack::PushL(op);
+            iWait->Start();
+
+            while (iWait->iStatus.Int() == KRequestPending )
+                {
+                if (!iTimer->IsActive())
+                    {
+                    iTimer->IssueRequest();
+                    }
+                CActiveScheduler::Start();
+                }
+
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                error = iWait->iStatus.Int();
+                if ( iWait->iStatus.Int() != KErrNoMemory )
+                    {
+                    //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+                    }
+                }
+
+            CleanupStack::PopAndDestroy(); // op
+            }
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // selection
+        CleanupStack::PopAndDestroy(); // cEntry
+        selection = NULL;
+        cEntry = NULL;
+        cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+        CleanupStack::PushL(cEntry);
+        selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        messageCount = selection->Count();
+        delete selection;
+        selection = 0;
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    while ( error == KErrNoMemory || messageCount > 0 );
+    return failureCount;
+    }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+    {
+    TInt error = KErrNone;
+    TInt failureCount = 0;
+    TInt messageCount = 0;
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+
+    do {
+        // Inbox must be cleaned if failure makes message to be fetched more than once.
+        // should not happen, but this test is quite stressful, and perfect result
+        // cannot be guaranteed.
+        // What is expected:
+        // 1. Program does not crash
+        // 2. After sufficient number of retries the message is fetched and notification deleted.
+        TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+        CMsvEntry* cEntry = NULL;
+        CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+        CleanupStack::PushL(msvEntrySelection);
+
+        cEntry = iSession->GetEntryL(iServiceId);
+        CleanupStack::PushL(cEntry);
+
+        failureCount++;
+        // These are failures that fail in Message server.
+        if ( failureCount >= 63 && failureCount <= 64 )
+            {
+            failureCount = 65;
+            }
+        cEntry->SetEntryL( iServiceId );
+
+        TMsvEntry entry = cEntry->Entry();
+        entry.iMtmData3 &= 0x0000000FF;
+        entry.iMtmData3 |= failureCount << 8;
+        cEntry->ChangeL( entry );
+
+        // if we have a selected service, insert it into selection
+        if (iServiceId != KMsvNullIndexEntryId)
+            {
+            msvEntrySelection->InsertL(0, iServiceId);
+            }
+
+        CMsvOperation * op = NULL;
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+            EMmsReceiveForced,
+            *msvEntrySelection,
+            paramPack,
+            iWait->iStatus) );
+
+        if ( error == KErrNone )
+            {
+            CleanupStack::PushL(op);
+            iWait->Start();
+
+            while (iWait->iStatus.Int() == KRequestPending )
+                {
+                if (!iTimer->IsActive())
+                    {
+                    iTimer->IssueRequest();
+                    }
+                CActiveScheduler::Start();
+                }
+
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                error = iWait->iStatus.Int();
+                if ( iWait->iStatus.Int() != KErrNoMemory )
+                    {
+                    //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+                    }
+                }
+
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // msvEntrySelection
+        CleanupStack::PopAndDestroy(); // cEntry
+        msvEntrySelection = NULL;
+        cEntry = NULL;
+        cEntry = iSession->GetEntryL( mmsFolderId );
+        CleanupStack::PushL(cEntry);
+        msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        messageCount = msvEntrySelection->Count();
+        delete msvEntrySelection;
+        msvEntrySelection = 0;
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    while ( error == KErrNoMemory || messageCount > 0 );
+    if ( error != KErrNoMemory && error != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+        }
+    return failureCount;
+    }
+
+void MmsTestBed::sendViaClient()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages in drafts
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+
+    CMsvOperation * op = NULL;
+    TTime now;
+    now.UniversalTime();
+    op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+    {
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledReceive,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::fetchForcedImmediate()
+    {
+    TCommandParameters parameters;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsReceiveForced,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::getEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+
+    CLogEventType* eventType = CLogEventType::NewL();
+    CleanupStack::PushL( eventType );
+    eventType->SetUid(iLogEvent->EventType());
+    iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+    iWait->Start();
+    CleanupStack::PopAndDestroy(); // eventType
+    }
+
+void MmsTestBed::addEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+
+    CLogEventType* eventType = CLogEventType::NewL();
+    CleanupStack::PushL( eventType );
+    eventType->SetUid(iLogEvent->EventType());
+    eventType->SetDescription(_L("Multimedia Message") );
+    eventType->SetLoggingEnabled( ETrue );
+
+//    iWait->iStatus = KRequestPending;
+    iLogClient->AddEventType( *eventType, iWait->iStatus );
+    iWait->Start();
+    CleanupStack::PopAndDestroy(); // eventType
+    }
+
+void MmsTestBed::deleteEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+//    iWait->iStatus = KRequestPending;
+    iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+    iWait->Start();
+    }
+
+void MmsTestBed::cleanLog()
+    {
+    TInt count = 0;
+
+    count = getLogEntries();
+
+    TInt i;
+    for ( i = 0; i < count; ++i )
+        {
+        // when a view is created, it will be positioned on the first event
+//        iWait->iStatus = KRequestPending;
+        iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+        iWait->Start();
+
+        if ( iLogView->NextL( iWait->iStatus ) )
+            {
+            // should complete with KErrNone
+            iWait->Start();
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                // could not get next event!
+                break;
+                }
+            }
+        else
+            {
+            break; // no more events!
+            }
+        }
+    }
+
+void MmsTestBed::setOnline(bool value)
+    {
+    //value = true for online mode
+    //value = false for offline mode
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+    if( retval == KErrNone )
+        {
+        repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+        delete repository;
+        }
+    }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+    {
+    iEncodeBuffer->ResizeL( 1024 );
+
+    TInt position = 0;
+
+    // encode message type
+    iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+    position++;
+    iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+    position++;
+
+    // version
+    iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+    position++;
+
+    TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+    iEncodeBuffer->Write( position, &version, 1 );
+    position++;
+
+    // message id from the headers
+    // At least once MMSC did not send us the message id!
+    // if message id is missing, we cannot match the entry!
+    // This only a fake. Real delivery reports should always
+    // contain the message id.
+    if ( aMmsHeaders->MessageId().Length() > 0 )
+        {
+        iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+        position++;
+        iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+        position += aMmsHeaders->MessageId().Length();
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+        }
+
+    // To is taken from the headers
+    iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+    position++;
+
+    TPtrC recipient;
+    if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->ToRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->ToRecipients()[0] );
+        }
+    else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->CcRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->CcRecipients()[0] );
+        }
+    else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->BccRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->BccRecipients()[0] );
+        }
+    else
+        {
+        recipient.Set( _L("Jasso-Kissa@jii.fi") );
+        }
+
+    TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+    if ( recipient.Find( KMiuMau ) != KErrNotFound )
+        {
+        addressType = EMmsAddressTypeEmail;
+        }
+    else
+        {
+        addressType = EMmsAddressTypeMobile;
+        }
+
+    TUint8 character;
+    TInt i;
+    if ( addressType == EMmsAddressTypeEmail )
+        {
+        // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+        for ( i = 0; i < recipient.Length(); ++i )
+            {
+            character = TUint8( recipient[i] & 0xff );
+            iEncodeBuffer->Write( position, &character, 1 );
+            position++;
+            }
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+
+        }
+    else
+        {
+        // must be a phone number
+        // We expect for now that the format is correct as is
+        // All legal characters present in a phone number are ASCII
+
+        TInt i;
+        for ( i = 0; i < recipient.Length(); ++i )
+            {
+            character = TUint8( recipient[i] & 0xff );
+            iEncodeBuffer->Write( position, &character, 1 );
+            position++;
+            }
+        iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+        position += KMmsPlmnLength;
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+        }
+
+    // date
+    iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+    position++;
+
+    TLocale locale;
+    locale.Refresh();
+    TInt64 UtcDate;
+    TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+    TTime now;
+    now.UniversalTime();
+    UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+    UtcDate -= universalTimeOffset.Int();
+
+    if ( locale.QueryHomeHasDaylightSavingOn() )
+        {
+        TTimeIntervalSeconds daylightSaving( 60 * 60 );
+        UtcDate -= daylightSaving.Int();
+        }
+
+    TUint8 len; // number of bytes we will need
+    len = 0;
+    TUint8 array[8];
+
+    TInt64 temp = UtcDate;
+
+    for (i = 7; i >= 0; --i)
+        {
+        array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+        I64LSR( temp, 8 );
+        }
+
+    len = 8;
+    i = 0;
+    while( ( array[i]== 0 ) && ( i < 8 ) )
+        {
+        i++;
+        len--;
+        }
+
+    // a zero should be coded as short integer.
+    // However, if there is a valid reason to code a zero as a long integer,
+    // we allow it. The caller should know what he is doing.
+    if ( len == 0 )
+        {
+        len = 1;
+        }
+    // write short length
+    iEncodeBuffer->Write( position, &len, 1 );
+    position++;
+    // write as many bytes as were non-zero
+    iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+    position+= len;
+    // status
+    iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+    position++;
+    iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+    position++;
+    // DONE!!!
+    iEncodeBuffer->ResizeL( position );
+    return;
+    }
+
+void MmsTestBed::sendDeliveryReport()
+    {
+    if ( iEncodeBuffer->Size() == 0 )
+        {
+        //No delivery report
+        return;
+        }
+
+
+    TMsvId mmsFolder = findMMSFolder();
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+
+    TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+    TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+    // Now we have streamed our data into this entry.
+    // Now we have an entry that says: local service, MMS MTM
+
+    if ( entryId != KMsvNullIndexEntryId )
+        {
+        selection->AppendL( entryId );
+        }
+    else
+        {
+        selection->AppendL( iDefaultServiceId );
+        }
+
+    TWatcherParameters parameters; // initialized to zero
+    parameters.iWatcherId = RThread().Id();
+    parameters.iDataPointer = &ptr;
+    TWatcherParametersBuf paramPack( parameters );
+
+    CMsvOperation * op = NULL;
+
+//    iWait->iStatus = KRequestPending;
+    op = iSession->TransferCommandL(
+        *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmsteststaticutils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,528 @@
+/*
+ * 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:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include <MmsEnginePrivateCRKeys.h>
+#include "mmssettings.h"
+#include <mmsheaders.h>
+#include "mmsservercommon.h"
+#include <mmsencode.h>
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+    {
+    }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+    {
+    TInt count=0;
+    if (iArray1)
+        count += iArray1->MdcaCount();
+    if (iArray2)
+        count += iArray2->MdcaCount();
+    return count;
+    }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+    {
+    if (iArray1)
+        {
+        if (aIndex < iArray1->MdcaCount())
+            return iArray1->MdcaPoint(aIndex);
+        else
+            aIndex -= iArray1->MdcaCount();
+        }
+    return iArray2->MdcaPoint(aIndex);
+    }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+    {
+
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+    {
+    RFile file;
+    TInt error = KErrNone;
+
+    TInt textBufferSize = 256;
+    HBufC* textBuffer = HBufC::NewL( textBufferSize );
+    TPtr textPtr = textBuffer->Des();
+    TFileText textFile;
+
+    error = file.Open( aFs, aFileName,
+            EFileRead|EFileShareReadersOnly );
+
+    if ( error == KErrNone )
+        {
+        textFile.Set( file );
+        error = textFile.Seek( ESeekStart );
+        }
+
+    if ( error == KErrNone )
+        {
+        error = textFile.Read( textPtr );
+        }
+
+    file.Close();
+
+    if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+        {
+        textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+        }
+
+    return textBuffer;
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+    {
+    // CenRep for decodelogging
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 1;
+        repository->Set( KMmsEngineDecodeLog, temp );
+        delete repository;
+        }
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+    {
+    // CenRep for decodelogging
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 0;
+        repository->Set( KMmsEngineDecodeLog, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 1;
+        repository->Set( KMmsEngineBinaryDump, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 0;
+        repository->Set( KMmsEngineBinaryDump, temp );
+        delete repository;
+        }
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+    {
+    // Delete the files in the directory
+    CFileMan* fileMan = CFileMan::NewL( aFs );
+    CleanupStack::PushL( fileMan );
+    fileMan->RmDir( KMmsDefaultLocalModeDir );
+    fileMan->RmDir( KMmsMMBoxDirectory );
+    fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+    CleanupStack::PopAndDestroy(); // fileManager
+    // we don't want to throw these away!
+    aFs.MkDirAll( KMmsDefaultLocalModeDir );
+    aFs.MkDirAll( KMmsMMBoxDirectory );
+    aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+    {
+    TInt error = KErrNone;
+    aFs.MkDirAll( aFilename );
+    TUint att;
+    if ( aFs.Att( aFilename, att ) == KErrNone )
+        {
+        _LIT( KRelated, "dump.mms");
+        aParse.Set( aFilename, &KRelated, NULL );
+        aFilename = aParse.FullName();
+        error = CApaApplication::GenerateFileName( aFs, aFilename );
+        if ( error == KErrNone )
+            {
+            RFile file;
+            error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+            // for message id generation
+            aParse.Set( aFilename, NULL, NULL );
+            if ( error == KErrNone )
+                {
+                // the data is supposed to be in the encode buffer
+                TPtr8 ptr = aBuffer.Ptr( 0 );
+                file.Write( ptr );
+                file.Flush();
+                }
+
+            // done - close files
+            file.Close();
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+    {
+    CMsvEntry* cEntry = NULL;
+    // delete all messages from the specified box
+    cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    // show invisible entries
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PushL(msvEntrySelection);
+
+    CMsvEntrySelection* selection = NULL;
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+    CleanupStack::PushL( selection );
+    if ( selection->Count() > 0 )
+        {
+        msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+        }
+    CleanupStack::PopAndDestroy(); // selection
+
+    int i;
+    for (i = 0; i < msvEntrySelection->Count(); ++i)
+        {
+        CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+        CleanupStack::PushL( entry );
+        TMsvEntry tEntry = entry->Entry();
+        tEntry.SetReadOnly(EFalse);
+        entry->ChangeL(tEntry);
+        cEntry->DeleteL( msvEntrySelection->At(i) );
+        CleanupStack::PopAndDestroy( entry );
+        }
+
+    CleanupStack::PopAndDestroy(msvEntrySelection);
+    CleanupStack::PopAndDestroy(cEntry);
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+    if( retval == KErrNone )
+        {
+        TInt temp = 1;
+        repository->Set( KMmsEngineLogEmailRecipients, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+    if( retval == KErrNone )
+        {
+        TInt temp = 0;
+        repository->Set( KMmsEngineLogEmailRecipients, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+    {
+    CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    if (aMsvEntrySelection != NULL)
+        {
+        delete aMsvEntrySelection;
+        aMsvEntrySelection = NULL;
+        }
+    aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+    CleanupStack::PopAndDestroy(); // cEntry
+    return aMsvEntrySelection->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+    CMsvSession& aSession,
+    TMsvId aParentFolder,
+    const TDesC& aFolderName,
+    TMsvId& aFolderId )
+    {
+    aFolderId = KMsvNullIndexEntryId;
+    CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+    CleanupStack::PushL( cEntry );
+
+    // Create a new folder.
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvFolderEntry;
+    entry.iMtm = KUidMsvLocalServiceMtm;
+    entry.iDetails.Set( aFolderName );
+    entry.SetVisible( EFalse );
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    cEntry->CreateL( entry );
+    aFolderId = entry.Id();
+    CleanupStack::PopAndDestroy( cEntry );
+
+    }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+        TMsvId aNotificationFolder,
+        TMsvId aServiceId,
+        CBufFlat* aEncodeBuffer,
+        CMsvSession& aSession )
+    {
+    TMsvId entryId = KMsvNullIndexEntryId;
+    if ( aNotificationFolder == KMsvNullIndexEntryId )
+        {
+        // no folder no entry
+        return entryId;
+        }
+
+    CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+    CleanupStack::PushL(cEntry);
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvMessageEntry;
+    entry.iMtm = KUidMsgTypeMultimedia;
+    entry.SetVisible( ETrue );
+    // If we want to put data here, InPreparation must be set to true first
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    entry.iRelatedId = aServiceId;
+    entry.iMtmData2 = KMmsNotificationBinary;
+    cEntry->CreateL( entry );
+    entryId = entry.Id();
+
+    //
+    // Stream
+    // 1) length of the data as 32 bit integer
+    // 2) pushed message data
+    // into created entry's stream
+    //
+    cEntry->SetEntryL( entryId );
+    CMsvStore* store = cEntry->EditStoreL();
+    CleanupStack::PushL( store );   // ***
+    RMsvWriteStream outs;
+    outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+    TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+    outs.WriteUint32L( ptr.Length() );
+    outs.WriteL( ptr );
+    outs.CommitL();
+    outs.Close();
+    store->CommitL();
+
+    CleanupStack::PopAndDestroy( &outs ); // close outs
+    CleanupStack::PopAndDestroy( store );
+    CleanupStack::PopAndDestroy( cEntry );
+
+    return entryId;
+
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+        TDesC8& aUrl,
+        TInt aSize,
+        CMmsHeaders& aMmsHeaders,
+        CMmsEncode& aMmsEncoder,
+        CBufFlat* aEncodeBuffer )
+    {
+    // for test purposes aUrl will contain the filename.
+
+    // Reset sets the default encapsulation version
+    // The default version has been set from MmsSettings in NewL
+    aMmsHeaders.Reset();
+
+    // construct the notification into iMmsHeaders, and call encode
+
+    aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+    TTime currentTime;
+    currentTime.UniversalTime();
+    currentTime.Int64();
+
+    TPtrC8 tid;
+    TBufC8<KMMSMAXTIDLENGTH> target;
+    TInt random = 0;
+
+    // we don't generate a true random TID: We generate the
+    // TID from the URL so that if we generate a notification
+    // twice from the same file, we get the same TID and the
+    // same URL. This way we can test the pruning function in
+    // server MTM
+
+    TInt i;
+    for ( i = 0; i < aUrl.Length(); ++i )
+        {
+        random += aUrl[ i ];
+        }
+
+    target.Des().Num( random );
+    tid.Set( target.Des() );
+    aMmsHeaders.SetTidL( tid );
+
+    aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+    aMmsHeaders.SetMessageSize( aSize );
+    const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+    aMmsHeaders.SetExpiryInterval( KTenHours );
+    aMmsHeaders.SetContentLocationL( aUrl );
+
+    aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+    }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+    {
+    //Is the name a file?
+    if (IsDrive(aFileName))
+        return EFalse;
+    return !(IsDir(aFileName, aFs));
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+    {
+    //Is the name a directory?
+    TEntry entry;
+    TInt err = aFs.Entry(aFileName, entry);
+    if (err)
+        return EFalse;
+    else
+        return entry.IsDir();
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+    {
+    //horrible little function to figure if the path is just a drive
+    TBool retVal = EFalse;
+    if (aFileName.Length()==3) //eg "c:\"
+        {
+        if ((aFileName[1] == ':')  && (aFileName[2] == '\\'))
+            retVal=ETrue;
+        }
+    else if (aFileName.Length()==2) //eg "c:"
+        {
+        if (aFileName[1] == ':')
+            retVal=ETrue;
+        }
+    return retVal;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/mmstestbed/src/mmstestuitimer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+    {
+    period = KPeriod;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+    {
+    CTestUiTimer* self = new(ELeave) CTestUiTimer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+    {
+    // No operation to cancel if this function is called
+    iObject = NULL;
+    After(period);
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+    {
+    iObject = aObject;
+    TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+    After( timeout );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+    {
+    CTimer::DoCancel();
+    if ( iObject )
+        {
+        iObject->Cancel();
+        iObject = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+    {
+    if ( iObject )
+        {
+        // If we timeout while holding an active object, we cancel it
+        iObject->Cancel();
+        iObject = NULL;
+        }
+    else
+        {
+        CActiveScheduler::Stop();
+        }
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/group/testmmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,110 @@
+#
+# 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:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+TARGET = test-mms-plugin
+
+INCLUDEPATH += ../inc
+INCLUDEPATH += ../../../inc
+#INCLUDEPATH += ../../../../inc
+
+INCLUDEPATH += ../../../../../../../../inc
+INCLUDEPATH += ../../../../../../inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc
+INCLUDEPATH += ../../../../../msgutils/unidatautils/unidatamodel/inc
+INCLUDEPATH += ../../../../../msgutils/unieditorutils/editorgenutils/inc
+INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
+INCLUDEPATH += ../../../../../../../../mmsengine/mmsmessage/inc 
+INCLUDEPATH += ../../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../mmstestbed/inc
+INCLUDEPATH +=
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_TEST_DLL
+
+CONFIG += hb plugin
+
+SOURCES += \
+  ../src/testmmsplugin.cpp \
+  ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin.cpp \
+  ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp  
+      
+
+# Input
+HEADERS += \
+  ../inc/testmmsplugin.h \
+  ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin.h \
+  ../../../../../msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h 
+               
+   
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+    symbian {
+    TARGET.CAPABILITY = CAP_GENERAL_DLL
+    TARGET.EPOCSTACKSIZE = 0x8000
+    TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+    TARGET.EPOCALLOWDLLDATA = 1
+	}
+
+ LIBS += -leuser \
+    -lconvergedmessageutils \
+    -ls60qconversions \
+    -lMsgMedia \
+    -leikctl \
+    -leditorgenutils \
+    -lcone \
+    -leikcoctl \
+    -leikcore \
+    -leikdlg \
+    -lmsgs \
+    -letext \
+    -lmmsserversettings \
+    -lgsmu \
+    -lmmsgenutils \
+    -lefsrv \
+    -lestor \
+    -lsmcm \
+    -lCommonEngine \
+    -lbafl \
+    -lCdlEngine \
+    -lFeatMgr \
+    -lapmime \
+    -lapgrfx \
+    -lcharconv \
+    -lInetProtUtil \
+    -lsmildtd \  
+    -lxmldom \
+    -lxmlparser \
+    -lcone \
+    -lQtCore \
+    -letel \
+    -lmmsmessage \  
+    -lcommdb \
+    -lcommsdat \
+    -letelmm \
+    -lunidatamodelloader \
+    -lunidatamodel \
+    -lavkon \
+    -leikcoctl \
+    -leikctl \
+    -lform \
+    -luiklaf\ 
+    -lxqutils\ 
+    -lmmstestbed
+  	
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,88 @@
+/*
+ * 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: - Main test class for Msgnotification -indicator plugin, 
+ *                                                   -notification dialog plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <e32const.h>
+
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+class QSignalSpy;
+
+class TEST_EXPORT TestMmsPlugin: public QObject
+    {
+    Q_OBJECT
+
+private slots:
+     
+    /**
+        * Called by framework,its called before the 1st test function is executed.
+     */  
+   
+    void initTestCase();
+
+    /**
+        * Called by framework,its called before each test function is executed.
+     */  
+
+    void init();
+
+    /**
+        * Test Sending MMS
+     */  
+
+    void testSendMMS(); 
+
+    /**
+        * Test receiving MMS
+     */  
+
+    void testMmsReceived();
+
+    /**
+        * Called by framework,its called after each test function is executed.
+     */  
+
+    void cleanup();
+
+    /**
+        * Called by framework,its called after the last test function is executed.
+     */  
+
+    void cleanupTestCase();
+
+private:
+
+    QSignalSpy *spy_draft;
+    QSignalSpy *spy_outbox;
+    QSignalSpy *spy_sent;
+
+    UniEditorMmsPlugin* msgPlugin;
+    int mmsId;
+    MmsTestBed* mmstestbed;
+   
+    };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/inc/testmmsplugin.ini	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,12 @@
+//this file is used to provide predefined set of input data.
+
+const char TEST_MSG_RECIEPIENT[]         = "+919000";
+const char TEST_MSG_FROM2[]              = "999";
+const char TEST_MSG_SUBJECT[]            = "Message Subject";
+const char TEST_SERVICE_NAME_MMS[] 	 = "messaging.mserver.testservice.MMS";
+const char TEST_SENDER[]		 = "+918888";
+const char TEST_ATTACHMENT[]		 = "c:\\sample.txt";
+const char TEST_ATTACHMENT4[]		 = "c:\\SmileyFace.gif";
+const char TEST_ATTACHMENT5[]		 = "c:\\sample.txt";
+const char TEST_CC[]			 = "DummyCCAddress";
+const char TEST_BCC[]			 = "DummyBCCAddress";
\ No newline at end of file
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/mms.rsc has changed
Binary file messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/not.rsc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/plugin_commonU.def	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,31 @@
+; ==============================================================================
+; Generated by qmake (2.01a) (Qt 4.6.3) on: 2010-06-21T15:39:25
+; This file is generated by qmake and should not be modified by the
+; user.
+;  Name        : plugin_commonU.def
+;  Part of     : test-mms-plugin
+;  Description : Fixes common plugin symbols to known ordinals
+;  Version     : 
+;
+; ==============================================================================
+
+
+EXPORTS
+	qt_plugin_query_verification_data @ 1 NONAME
+	qt_plugin_instance @ 2 NONAME
+	?qt_metacast@TestMmsPlugin@@UAEPAXPBD@Z @ 3 NONAME ; void * TestMmsPlugin::qt_metacast(char const *)
+	?init@TestMmsPlugin@@AAEXXZ @ 4 NONAME ; void TestMmsPlugin::init(void)
+	?staticMetaObject@TestMmsPlugin@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const TestMmsPlugin::staticMetaObject
+	?tr@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 6 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *, int)
+	?initTestCase@TestMmsPlugin@@AAEXXZ @ 7 NONAME ; void TestMmsPlugin::initTestCase(void)
+	?cleanup@TestMmsPlugin@@AAEXXZ @ 8 NONAME ; void TestMmsPlugin::cleanup(void)
+	?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 9 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *, int)
+	?qt_metacall@TestMmsPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TestMmsPlugin::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?testMmsReceived@TestMmsPlugin@@AAEXXZ @ 11 NONAME ; void TestMmsPlugin::testMmsReceived(void)
+	?testSendMMS@TestMmsPlugin@@AAEXXZ @ 12 NONAME ; void TestMmsPlugin::testSendMMS(void)
+	?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 13 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *)
+	?tr@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *)
+	?metaObject@TestMmsPlugin@@UBEPBUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const * TestMmsPlugin::metaObject(void) const
+	?getStaticMetaObject@TestMmsPlugin@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & TestMmsPlugin::getStaticMetaObject(void)
+	?cleanupTestCase@TestMmsPlugin@@AAEXXZ @ 17 NONAME ; void TestMmsPlugin::cleanupTestCase(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgnotifications/msgnotifier/tsrc/testmmsgplugin/src/testmmsplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,183 @@
+/*
+ * 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: - Main test class for Msgnotification -indicator plugin, 
+ *                                                   -notification dialog plugin
+ */
+
+#include "testmmsplugin.h"
+#include <QtTest/QtTest>
+#include "debugtraces.h"
+#include <QTimer>
+#include <QSignalSpy>
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+#include <QSignalSpy>
+
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+
+void TestMmsPlugin::initTestCase()
+{
+    qRegisterMetaType<long int> ("long int"); 
+    msgPlugin = new UniEditorMmsPlugin();
+    QVERIFY(msgPlugin != 0);
+    mmsId = -1;
+    mmstestbed = new MmsTestBed;
+	QVERIFY(mmstestbed != 0);
+	if(!mmstestbed)
+	{
+		QSKIP("Mmstestbed creation failed", SkipAll); 
+	}
+
+    spy_draft  = new QSignalSpy(mmstestbed,SIGNAL(entryCreatedInDraft(long int)));
+    spy_outbox = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToOutbox(long int)));
+    spy_sent   = new QSignalSpy(mmstestbed,SIGNAL(entryMovedToSent(long int)));
+
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSendMMS
+//---------------------------------------------------------------
+
+void TestMmsPlugin::testSendMMS()
+{
+   
+    qRegisterMetaType<long int> ("long int");
+    QString service = TEST_SERVICE_NAME_MMS;
+	
+	QString subject  = TEST_MSG_SUBJECT;
+	qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+	
+	QString sender(TEST_SENDER);
+	ConvergedMessageAddress address(sender);
+	ConvergedMessageAttachmentList attachmentList;    
+
+	QString attachment2Path = TEST_ATTACHMENT4;
+	ConvergedMessageAttachment* attachment2 = 
+			new ConvergedMessageAttachment(attachment2Path, ConvergedMessageAttachment::EAttachment);
+	
+	QString attachmentPath = TEST_ATTACHMENT5;
+	ConvergedMessageAttachment* attachment = 
+		new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+		
+	attachmentList.append(attachment);
+	attachmentList.append(attachment2);
+	ConvergedMessage msg;
+	msg.setMessageType(ConvergedMessage::Mms);
+	msg.setSubject(subject);
+	msg.setTimeStamp(timeStamp);
+	msg.addToRecipient(address);
+	msg.addAttachments(attachmentList);
+	msg.setPriority(ConvergedMessage::Normal);
+	//Adding alias
+	ConvergedMessageAddress address1;
+	address1.setAlias(QString(TEST_MSG_RECIEPIENT));
+	msg.addToRecipient(address1);
+	
+	//Adding CC Address
+	QString ccAddress(TEST_CC);
+	ConvergedMessageAddress ccAdd(ccAddress);
+	msg.addCcRecipient(ccAdd);
+	
+	//Adding BCC Address
+	QString bccAddress(TEST_BCC);
+	ConvergedMessageAddress bccAdd(bccAddress);
+	msg.addBccRecipient(bccAdd);
+	
+	mmstestbed->cleanAll();
+	mmstestbed->setConnectionLocal(true);
+	long int id = msgPlugin->convertTo(&msg);
+	
+	QVERIFY(id != 0);
+	msgPlugin->send(id);
+	QTest::qWait(5000); 
+	long int idRec;
+	
+	if( 1 == spy_draft->count())
+		{
+		void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+		idRec = *reinterpret_cast< long int(*)>(temp);
+		QDEBUG_WRITE("passed: spy_draft.count");
+		}
+	else
+		{
+		QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+		mmstestbed->setConnectionLocal(false);
+		return;
+		}
+	if( 1 == spy_outbox->count())
+		{
+		mmstestbed->fromOutboxToMmsc();
+		QDEBUG_WRITE("passed: spy_outbox.count");
+		}
+	else
+		{
+		QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+		mmstestbed->setConnectionLocal(false);
+		return;
+		}
+
+	if( 1 == spy_sent->count())
+		{
+		void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+		long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+		QCOMPARE(sentmsgid, idRec);
+		mmstestbed->fromMmscToInbox();
+		QDEBUG_WRITE("passed: spy_sent.count");
+		}
+	else
+		{
+		QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+		mmstestbed->setConnectionLocal(false);
+		return;
+		}
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMmsReceived
+//---------------------------------------------------------------
+void TestMmsPlugin::testMmsReceived()
+{
+        QTest::qWait(5000);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+    delete msgPlugin;
+    delete mmstestbed;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgsendinterface.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,82 @@
+/*
+ * 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: Message send service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#ifndef MSGSENDINTERFACE_H_
+#define MSGSENDINTERFACE_H_
+
+// INCLUDES
+#include <xqserviceprovider.h>
+
+// FORWARD DECLARATIONS
+class MsgServiceViewManager;
+
+class MsgSendInterface : public XQServiceProvider
+    {
+    Q_OBJECT
+    
+public:
+    /*
+     * Constructor
+     */
+    MsgSendInterface(MsgServiceViewManager* viewManager);
+    
+    /*
+     * Destructor
+     */
+    ~MsgSendInterface();
+    
+public slots:
+    
+    /**
+     * Send message.
+     * @param phoneNumber phone number.
+     * @param contactId contactId.
+     * @param displayName display name.
+     */
+    void send(const QString phoneNumber, const qint32 contactId, 
+            const QString displayName);
+    
+    /**
+     * Send message.
+     * @param phoneNumber phone number.
+     * @param alias alias name.
+     * @param bodyText body text.
+     */
+    void send(const QString phoneNumber, const QString alias, 
+                            const QString bodyText);
+
+    /**
+     * Send message.
+     * @param addressList list of phone numbers and displaynames. 
+     * key is the phone number and value is the display name.
+     * @param bodyText body text.
+     */
+    void send(const QVariantMap addressList, 
+              const QString bodyText = QString());
+
+private:
+    
+    /**
+     * Pointer to view manager
+     * Not owned.
+     */
+    MsgServiceViewManager* mViewManager;
+    };
+
+
+#endif /* MSGSENDINTERFACE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgserviceviewmanager.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,199 @@
+/*
+ * 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: Manages differnt messaging views.
+ * 
+ *
+ */
+
+#ifndef MSGSERVICEVIEWMANAGER_H_
+#define MSGSERVICEVIEWMANAGER_H_
+
+#include <QObject>
+#include <QVariant>
+
+class HbMainWindow;
+class MsgUnifiedEditorView;
+class UnifiedViewer;
+class MsgBaseView;
+class MsgSettingsView;
+class HbAction;
+class MsgStoreHandler;
+
+class MsgServiceViewManager: public QObject
+{
+Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    MsgServiceViewManager(MsgStoreHandler* storeHandler,
+            HbMainWindow* mainWindow, QObject* parent = 0);
+
+    /**
+     * Destructor.
+     */
+    ~MsgServiceViewManager();
+
+    /**
+     * Send message.
+     * @param phoneNumber phone number.
+     * @param contactId contactId.
+     * @param displayName displayname.
+     */
+    void send(const QString phoneNumber, 
+              const qint32 contactId, 
+              const QString displayName);
+
+    /**
+     * Send message.
+     * @param phoneNumber phone number.
+     * @param alias alias.
+     * @param bodyText body text.
+     */
+    void send(const QString phoneNumber, 
+              const QString alias, 
+              const QString bodyText);
+              
+    /**
+     * Send message.
+     * @param addressList list of phone numbers and displaynames. 
+     * key is the phone number and value is the display name.
+     * @param bodyText body text.
+     */
+    void send(const QVariantMap addressList, 
+              const QString bodyText = QString());
+
+    /**
+     * Send message.
+     * @param data data to be sent.
+     */
+    void send(QVariant data);
+
+    /**
+     * Opens the viewer to view the message.
+     * @param msgId message id of the message.
+     */
+    void view(int msgId);
+
+private:
+    /*
+     * Switch to unieditor.
+     * @param editorData editor data.
+     */
+    void switchToUniEditor(const QVariantList& editorData);
+
+    /*
+     * Switch to settings view.
+     */
+    void switchToMsgSettings(const QVariantList& data);
+
+    /**
+     * Handle sms and mms messge
+     * @param msgId message id
+     */
+    void handleSmsMmsMsg(int msgId);
+
+    /**
+     * Handle ringtone message
+     * @param msgId message id
+     */
+    void handleRingtoneMsg(int msgId);
+
+    /**
+     * Handle provisioning message
+     * @param msgId message id
+     */
+    void handleProvisoningMsg(int msgId);
+
+    /**
+     * Handle bluetooth message
+     * @param msgId message id
+     */
+    void handleBTMessage(int msgId);
+    
+private slots:
+    /**
+     * This slot is called on mainwindows back action.
+     */
+    void onBackAction();
+
+    /**
+     * This slot is called when switchView signal is emitted from a view.
+     * @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)
+     */
+    void onDialogSaveTone(HbAction* action);
+	
+private:
+    /**
+     * Main window pointer. 
+     * Not owned.
+     */
+    HbMainWindow* mMainWindow;
+
+    /**
+     * Unified editor. 
+     * Owned.
+     */
+    MsgUnifiedEditorView* mUniEditor;
+    
+    /**
+     * Unified viewer. 
+     * Owned.
+     */
+    UnifiedViewer* mUniViewer;
+    
+    /**
+     * Settings view. 
+     * Owned.
+     */
+    MsgSettingsView* mSettingsView;
+    
+    /**
+     * Back action 
+     * Owned.
+     */
+    HbAction* mBackAction;
+
+    /**
+     * Store handler.
+     * Not Owned.
+     */
+    MsgStoreHandler* mStoreHandler;
+    
+    /**
+     * Current view value.
+     */
+    int mCurrentView;
+    
+	/**
+	 * message Id
+	 */
+    int mMessageId;
+  
+};
+
+#endif /* MSGSERVICEVIEWMANAGER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgservicewindow.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,78 @@
+/*
+ * 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: Message service application main window. 
+ *
+ */
+
+#ifndef __MSG_SERVICE_WINDOW_H__
+#define __MSG_SERVICE_WINDOW_H__
+
+#include <hbmainwindow.h>
+
+// FORWARD DECLARATIONS
+class MsgViewInterface;
+class MsgStoreHandler;
+class MsgServiceViewManager;
+class MsgShareUiInterface;
+class MsgSendInterface;
+
+class MsgServiceWindow : public HbMainWindow
+    {
+    Q_OBJECT
+    
+public:
+    /**
+     * Constructor
+     */
+    MsgServiceWindow();
+    
+    /**
+     * Destructor
+     */
+    ~MsgServiceWindow();
+    
+private:
+    /**
+     * View interface object
+     * Owned
+     */
+    MsgSendInterface* mSendInterface;
+    
+    /**
+     * View interface object
+     * Owned
+     */
+    MsgViewInterface*  mViewInterface;
+    
+    /**
+     * View interface object
+     * Owned
+     */
+    MsgShareUiInterface*  mShareUiInterface;
+    
+    /**
+     * Message store handler
+     * Owned.
+     */
+    MsgStoreHandler* mStoreHandler;
+    
+    /**
+     * View manager
+     * Owned.
+     */
+    MsgServiceViewManager* mViewManager;
+    
+    };
+
+#endif // __MSG_SERVICE_WINDOW_H__ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgshareuiinterface.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,58 @@
+/*
+ * 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: Message share UI service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#ifndef MSGSHAREUIINTERFACE_H_
+#define MSGSHAREUIINTERFACE_H_
+
+// INCLUDES
+#include <xqserviceprovider.h>
+#include <qvariant.h>
+
+class MsgServiceViewManager;
+class MsgShareUiInterface : public XQServiceProvider
+    {
+    Q_OBJECT
+    
+public:
+    /*
+     * Constructor
+     */
+    MsgShareUiInterface(MsgServiceViewManager* viewManager);
+    
+    /*
+     * Destructor
+     */
+    ~MsgShareUiInterface();
+    
+public slots:
+   /**
+    * Send message.
+    * @param data data to be sent.
+    */
+    void send(QVariant data);
+    
+private:
+    /**
+     * Pointer to view manager
+     * Not owned.
+     */
+    MsgServiceViewManager* mViewManager;
+    };
+
+
+#endif /* MSGSHAREUIINTERFACE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgstorehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2008 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: Reads message information from message store.
+*
+*/
+
+#ifndef __MSG_STORE_HANDLER_H__
+#define __MSG_STORE_HANDLER_H__
+
+// INCLUDE FILES
+#include <msvapi.h>
+
+class MsgStoreHandler : public MMsvSessionObserver
+    {
+public:
+    /**
+     * Constructor
+     */
+    explicit MsgStoreHandler();
+    
+    /**
+     * Destructor
+     */
+    virtual ~MsgStoreHandler();
+    
+public :
+    /**
+     * @see MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
+            TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/);
+    
+public:
+    /**
+     * Mark message as read and get the message type
+     * @param messageId  message Id 
+     * @param msgType message type is written to this.
+     * @param msgType message sub type is written to this.
+     */
+    void markAsReadAndGetType(int msgId,
+                              int& msgType,
+                              int& msgSubType);
+ 
+    /**
+     * Delete message.
+     * @param msgId id of the message to be deleted.
+     */
+    void deleteMessage(int msgId);
+    
+private:
+    /**
+     * Does all initilaizations
+     */
+    void InitL();
+    
+    /**
+     * 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.
+     */
+    void extractMsgType(const TMsvEntry& aEntry,
+                        int& msgType,
+                        int& msgSubType);
+    
+private:
+    /**
+     * Session
+     * Owned.
+     */
+    CMsvSession* iMsvSession;     
+    };
+
+#endif // __MSG_STORE_HANDLER_H__
+
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/inc/msgviewinterface.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,57 @@
+/*
+ * 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: Message view service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#ifndef __MSG_VIEW_INTERFACE_H__
+#define __MSG_VIEW_INTERFACE_H__
+
+#include <QObject>
+#include <xqserviceprovider.h>
+
+class MsgServiceViewManager;
+
+class MsgViewInterface : public XQServiceProvider
+    {
+    Q_OBJECT
+    
+public:
+    /**
+     * Constructor
+     */
+    MsgViewInterface(MsgServiceViewManager* viewManager);
+    
+    /**
+     * Destructor
+     */
+    ~MsgViewInterface();
+    
+public slots:
+    /**
+     * Opens the appropriate viewer for a given message id.
+     * @param msgId message Id
+     */
+    void view(int msgId);
+
+private:
+    /**
+     * Pointer to view manager. 
+     * Not owned.
+     */
+    MsgServiceViewManager* mViewManager;
+    };
+
+#endif /* __MSG_VIEW_INTERFACE_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,67 @@
+# 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:
+
+TEMPLATE = app
+TARGET = msgserviceapp
+
+CONFIG += hb service
+
+DEPENDPATH += . inc src
+SERVICE.FILE = service_conf.xml
+SERVICE.OPTIONS = embeddable
+SERVICE.OPTIONS += hidden
+
+INCLUDEPATH += inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../../smartmessaging/ringbc/inc
+INCLUDEPATH += ../../msgutils/unidatamodelloader/inc
+INCLUDEPATH += ../../msgui/inc
+INCLUDEPATH += ../../msgui/unifiedviewer/inc
+INCLUDEPATH += ../../msgui/unifiededitor/inc
+INCLUDEPATH += ../../msgsettings/settingsview/inc
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+# Input
+HEADERS += inc/msgviewinterface.h \
+	         inc/msgservicewindow.h \
+	         inc/msgstorehandler.h \
+	         inc/msgsendinterface.h \
+			 inc/msgshareuiinterface.h \
+			 inc/msgserviceviewmanager.h
+			
+SOURCES += src/main.cpp \
+           src/msgviewinterface.cpp \
+           src/msgservicewindow.cpp \
+           src/msgstorehandler.cpp \
+           src/msgsendinterface.cpp \
+		   src/msgshareuiinterface.cpp \
+		   src/msgserviceviewmanager.cpp
+			
+# Capability
+TARGET.CAPABILITY = ALL -TCB
+TARGET.UID3 = 0x2002E6DA
+
+RESOURCES += msgserviceapp.qrc
+
+LIBS += -lxqservice \
+        -lxqserviceutil \
+        -lconvergedmessageutils \
+        -lmsgs \
+        -lringbc \
+        -lunidatamodelloader \
+        -lunifiedviewer \
+        -lunifiededitor \
+        -lsettingsview
+	
+
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+                             ".\rom\msgserviceapp.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgserviceapp.iby)"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/msgserviceapp.qrc	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/translations">
+        <file alias="messaging_en_GB">resources/messaging_en_GB</file>
+    </qresource>
+</RCC>
Binary file messagingapp/msgservices/msgserviceapp/resources/messaging_en_GB has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/rom/msgserviceapp.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,25 @@
+/*
+ * 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:  
+ *
+ */
+
+#ifndef __MSG_SERVICEAPP_IBY__
+#define __MSG_SERVICEAPP_IBY__
+
+file=ABI_DIR\UREL\msgserviceapp.exe          SHARED_LIB_DIR\msgserviceapp.exe
+data=DATAZ_\resource\apps\msgserviceapp.rsc  resource\apps\msgserviceapp.rsc
+data=DATAZ_\private\10003a3f\import\apps\msgserviceapp_reg.rsc   private\10003a3f\import\apps\msgserviceapp_reg.rsc
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/service_conf.xml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8" ?>  
+<service>
+  <name>messaging</name>
+  <filepath>No path</filepath>
+  <description>Messaging services</description>
+  <interface>
+     <name>com.nokia.symbian.IFileShare</name>
+     <version>1.0</version>
+     <description>Share UI send interface</description>
+     <customproperty key="aiw_action_text_file">messaging</customproperty>
+     <customproperty key="aiw_action_text">txt_messaging_list_attach_to_new_message</customproperty>
+     <customproperty key="aiw_action_icon">qtg_large_message</customproperty>
+     <customproperty key="blocked_mime_types">video/*</customproperty>
+  </interface>
+  <interface>
+      <name>com.nokia.symbian.IMessageSend</name>
+     <version>1.0</version>
+     <description>Message send Interface</description>
+  </interface> 
+  <interface>
+      <name>com.nokia.symbian.IMessageView</name>
+     <version>1.0</version>
+     <description>Message view Interface</description>
+  </interface>
+</service>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/main.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,101 @@
+/*
+* 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: Messaging service application startup main().
+*
+*/
+
+#include <hbapplication.h>
+#include <QTranslator>
+#include <QLocale>
+#include <QFile>
+#include <QPointer>
+#include <QDateTime>
+
+#include "msgservicewindow.h"
+#include "debugtraces.h"
+
+//Localised constants
+#define LOC_TITLE hbTrId("txt_messaging_title_messaging")
+
+const QString debugFileName("c:/msgservice_app.txt");
+
+#ifdef _DEBUG_TRACES_
+void debugInit(QtMsgType type, const char *msg)
+{
+
+    QFile ofile(debugFileName);
+    if (!ofile.open(QIODevice::Append | QIODevice::Text))
+    {
+        qFatal("error opening results file");
+        return;
+    }
+    QDateTime dt = QDateTime::currentDateTime();
+
+    QTextStream out(&ofile);
+    switch (type)
+    {
+        case QtDebugMsg:
+            out << " DEBUG:";
+            out << msg;
+            break;
+        case QtWarningMsg:
+            out << " WARN:";
+            out << msg;
+            break;
+        case QtCriticalMsg:
+            out << "\n ";
+            out << dt.toString("dd/MM/yyyy hh:mm:ss.zzz:ap");
+            out << " CRITICAL:";
+            out << msg;
+            break;
+        case QtFatalMsg:
+            out << " FATAL:";
+            out << msg;
+            abort();
+            break;
+        default:
+            out << " No Log Selection Type:";
+            out << msg;
+            break;
+
+    }
+}
+#endif
+
+int main(int argc, char **argv)
+{
+    HbApplication app( argc, argv );
+    
+    //TODO: Uncomment the lines when actual 
+    //translation files are available in sdk and remove loading locally.
+    QString locale = QLocale::system().name();
+    QString path = "z:/resource/qt/translations/";
+    QTranslator translator;
+    //QTranslator translator_comm;
+    //translator.load(path + QString("messaging_") + locale);
+    //translator_comm.load(path + QString("common_") + locale);
+    translator.load( "messaging_en_GB", ":/translations" );
+    app.installTranslator(&translator);
+    //app.installTranslator(&translator_comm);
+
+    app.setApplicationName(LOC_TITLE);
+    
+    QPointer<MsgServiceWindow> window = new MsgServiceWindow();
+    window->show();
+    
+    int rv = app.exec();
+    delete window;
+    return rv;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgsendinterface.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,74 @@
+/*
+ * 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: Message send service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#include "msgsendinterface.h"
+#include "msgserviceviewmanager.h"
+
+//----------------------------------------------------------------------------
+// MsgSendInterface::MsgSendInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgSendInterface::MsgSendInterface(MsgServiceViewManager* viewManager)
+:XQServiceProvider(QLatin1String("messaging.com.nokia.symbian.IMessageSend"),
+        viewManager),
+mViewManager(viewManager)
+    {
+    publishAll();    
+    }
+
+//----------------------------------------------------------------------------
+// MsgSendInterface::~MsgSendInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgSendInterface::~MsgSendInterface()
+    {
+    }
+
+//----------------------------------------------------------------------------
+// MsgSendInterface::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgSendInterface::send(const QString phoneNumber, 
+                            const qint32 contactId, 
+                            const QString displayName)
+    {   
+    mViewManager->send(phoneNumber,contactId,displayName);    
+    }
+
+//----------------------------------------------------------------------------
+// MsgSendInterface::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgSendInterface::send(const QString phoneNumber, 
+                            const QString alias, 
+                            const QString bodyText)
+    {   
+    mViewManager->send(phoneNumber, alias, bodyText);    
+    }
+
+//----------------------------------------------------------------------------
+// MsgSendInterface::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgSendInterface::send(const QVariantMap addressList, 
+              const QString bodyText)
+      {
+      mViewManager->send(addressList,bodyText);    
+      }
+//EOF
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgserviceviewmanager.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,517 @@
+/*
+ * 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:  Manages differnt messaging views.
+ *
+ */
+
+#include "msgserviceviewmanager.h"
+
+#include <HbMainWindow>
+#include <HbAction>
+#include <HbApplication>
+#include <hbmessagebox.h>
+
+#include <xqserviceutil.h>
+#include <xqappmgr.h>
+
+#include "msgunieditorview.h"
+#include "unifiedviewer.h"
+#include "msgstorehandler.h"
+
+#include "msgsettingsview.h"
+#include "convergedmessageid.h"
+#include "ringbc.h"
+#include "unidatamodelloader.h"
+#include "unidatamodelplugininterface.h"
+
+// LOCALIZATION
+#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DLG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
+
+//----------------------------------------------------------------------------
+// MsgViewInterface::MsgViewInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgServiceViewManager::MsgServiceViewManager(MsgStoreHandler* storeHandler,
+        HbMainWindow* mainWindow, QObject* parent) :
+        QObject(parent), mMainWindow(mainWindow), mUniEditor(NULL),
+        mUniViewer(NULL), mSettingsView(NULL), mBackAction(NULL),
+        mStoreHandler(storeHandler),mMessageId(-1)
+    {
+    //creating back action.
+    mBackAction = new HbAction(Hb::BackNaviAction, this);
+    connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
+    
+    // create a temp view : which is required for lazy loading of other views
+    HbView* tempView = new HbView();
+    mMainWindow->addView(tempView);
+    mMainWindow->setCurrentView(tempView);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::~MsgServiceViewManager
+// @see header
+//----------------------------------------------------------------------------
+MsgServiceViewManager::~MsgServiceViewManager()
+    {
+  
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::onBackAction
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::onBackAction()
+    {
+    switch(mCurrentView)
+        {
+        case MsgBaseView::UNIEDITOR:
+            {
+            mUniEditor->saveContentToDrafts();
+            HbApplication::quit();
+            break;
+            }
+        case MsgBaseView::MSGSETTINGS:
+            {
+            //delete the settings instance
+            if (mSettingsView)
+            {
+                mMainWindow->removeView(mSettingsView);
+                delete mSettingsView;
+                mSettingsView = NULL;
+            }
+            if(mUniEditor)
+                {
+                mMainWindow->setCurrentView(mUniEditor);
+                mCurrentView = MsgBaseView::UNIEDITOR;
+                }
+            else 
+                {
+                ConvergedMessage message;
+                QVariantList param;
+                QByteArray dataArray;
+                QDataStream messageStream(&dataArray, 
+                        QIODevice::WriteOnly | QIODevice::Append);
+                message.serialize(messageStream);
+                param << dataArray;
+
+                // switch to editor
+                switchToUniEditor(param);
+                }
+            break;
+            }
+        case MsgBaseView::UNIVIEWER: 
+        default:
+            {
+            HbApplication::quit();
+            break;
+            }
+            
+        }
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::switchView
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::switchView(const QVariantList& data)
+    {
+    int viewId = data.at(0).toInt();
+    switch (viewId) {
+        case MsgBaseView::UNIEDITOR:
+            {
+            // except first 2 parameters pass other parameters
+            QVariantList editorData;
+            for(int a = 2; a < data.length(); ++a)
+                {
+                editorData << data.at(a);
+                }
+            switchToUniEditor(editorData);
+            break;
+            }
+
+        case MsgBaseView::MSGSETTINGS:
+            {
+            switchToMsgSettings(data);
+            break;
+            }
+        default: 
+            {
+            HbApplication::quit();
+            }
+    }
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::send(const QString phoneNumber, 
+        const qint32 contactId, 
+        const QString displayName)
+    {
+    ConvergedMessage message;
+    ConvergedMessageAddress address;
+    address.setAddress(phoneNumber);
+    address.setAlias(displayName);
+    message.addToRecipient(address);
+
+    QVariantList param;
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, 
+            QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    param << dataArray;
+    
+    // switch to editor
+    switchToUniEditor(param);
+    
+    XQServiceUtil::toBackground(false);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::send(const QString phoneNumber, 
+        const QString alias, 
+        const QString bodyText)
+    {
+    ConvergedMessage message;
+    ConvergedMessageAddress address;
+    address.setAddress(phoneNumber);
+    address.setAlias(alias);
+    message.addToRecipient(address);
+    message.setBodyText(bodyText);
+
+    QVariantList param;
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, 
+            QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    param << dataArray;
+
+    // switch to editor
+    switchToUniEditor(param);
+    
+    XQServiceUtil::toBackground(false);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::send(const QVariantMap addressList, 
+              const QString bodyText)
+    {
+    QStringList phoneNumList = addressList.keys();
+ 
+    ConvergedMessageAddressList addrList; 
+	
+    int count = phoneNumList.count();
+    for( int i = 0; i < count; ++ i )
+        {
+        QString phNum = phoneNumList[i];
+        ConvergedMessageAddress* address = new ConvergedMessageAddress(phNum,
+                addressList.value(phNum).toString());	
+        addrList.append(address);
+        }
+    
+    ConvergedMessage message;
+    message.addToRecipients(addrList);
+    message.setBodyText(bodyText);
+    
+    QVariantList param;
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, 
+            QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    param << dataArray;
+
+    // switch to editor
+    switchToUniEditor(param);
+
+    XQServiceUtil::toBackground(false);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::send(QVariant data)
+    {
+    ConvergedMessage message;
+    ConvergedMessageAttachmentList attachmentList;
+    // handle multiple files from sendUI
+    // e.g. contacts can send multiple vcards
+    QStringList receivedFiles = data.toStringList();
+    int recFileCount = receivedFiles.count();
+    for (int i = 0; i < recFileCount; i++) {
+    ConvergedMessageAttachment *attachment =
+    new ConvergedMessageAttachment(receivedFiles.at(i));
+    attachmentList.append(attachment);
+    }
+    message.addAttachments(attachmentList);
+
+    QVariantList param;
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, 
+            QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    param << dataArray;
+
+    // switch to editor
+    switchToUniEditor(param);
+    
+    XQServiceUtil::toBackground(false);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::switchToUniEditor
+// @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();
+    }
+    
+    // populate
+    mUniEditor->populateContent(editorData);
+    
+    // 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);
+    }
+    mMainWindow->setCurrentView(mSettingsView);
+    }
+
+//----------------------------------------------------------------------------
+// MsgServiceViewManager::view
+// @see header
+//----------------------------------------------------------------------------
+void MsgServiceViewManager::view(int msgId)
+    {
+    int msgType;
+    int msgSubType;
+   
+    mMessageId = msgId;
+    // Mark as read and get message type
+    mStoreHandler->markAsReadAndGetType(msgId,msgType,msgSubType);
+    
+    switch (msgType) {
+        case ConvergedMessage::Sms:
+        case ConvergedMessage::Mms:
+        case ConvergedMessage::MmsNotification:
+            {
+            handleSmsMmsMsg(msgId);
+            break;
+            }
+        case ConvergedMessage::BioMsg:
+            {
+            if (msgSubType == ConvergedMessage::RingingTone) {
+            handleRingtoneMsg(msgId);
+            }
+            else if (msgSubType == ConvergedMessage::Provisioning) {
+            handleProvisoningMsg(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;
+            }
+    }
+    }
+
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleSmsMmsMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleSmsMmsMsg(int msgId)
+    {
+    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;
+    }
+
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleRingtoneMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleRingtoneMsg(int msgId)
+    {
+    mMessageId = msgId;
+    HbMessageBox::question(LOC_DLG_SAVE_RINGTONE, this,
+                           SLOT(onDialogSaveTone(HbAction*)),
+                           HbMessageBox::Save | HbMessageBox::Cancel);
+    }
+
+// ----------------------------------------------------------------------------
+// MsgServiceViewManager::handleProvisoningMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgServiceViewManager::handleProvisoningMsg(int msgId)
+    {
+    QString messageId;
+    messageId.setNum(msgId);
+
+    XQApplicationManager* aiwMgr = new XQApplicationManager();
+
+    XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", 
+            "Provisioning",
+            "ProcessMessage(QString)", true); // embedded
+
+    if (request) {
+    QList<QVariant> args;
+    args << QVariant(messageId);
+    request->setArguments(args);
+
+    // Send the request
+    bool res = request->send();
+
+    // Cleanup
+    delete request;
+    }
+
+    delete aiwMgr;
+
+    // close the application once its handled
+    HbApplication::quit();
+    }
+
+//-----------------------------------------------------------------------------
+//MsgServiceViewManager::handleBTMessage()
+//@see header
+//-----------------------------------------------------------------------------
+void MsgServiceViewManager::handleBTMessage(int msgId)
+    {
+    XQApplicationManager* aiwMgr = new XQApplicationManager();
+    XQAiwRequest* request = 
+    aiwMgr->create("com.nokia.services.btmsgdispservices", "displaymsg",
+            "displaymsg(int)", true); // embedded
+
+    if (request) {
+    QList<QVariant> args;
+    args << QVariant(msgId);
+    request->setArguments(args);
+
+    // Send the request
+    bool res = request->send();
+
+    // Cleanup
+    delete request;
+    }
+
+    delete aiwMgr;
+
+    // close the application once its handled
+    HbApplication::quit();
+    }
+
+//-----------------------------------------------------------------------------
+//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();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgservicewindow.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,88 @@
+/*
+ * 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: Message services manages all messaging Qt highway services. 
+ *
+ */
+
+#include "msgservicewindow.h"
+
+#include "msgviewinterface.h"
+#include "msgsendinterface.h"
+#include "msgshareuiinterface.h"
+
+#include "msgstorehandler.h"
+#include "msgserviceviewmanager.h"
+
+// LOCALIZATION
+#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
+#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
+#define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+
+
+// ----------------------------------------------------------------------------
+// MsgServiceWindow::MsgServiceWindow
+// @see header
+// ----------------------------------------------------------------------------
+MsgServiceWindow::MsgServiceWindow():HbMainWindow(),mSendInterface(NULL),
+mViewInterface(NULL),
+mShareUiInterface(NULL),
+mStoreHandler(NULL),
+mViewManager(NULL)
+    {
+    // create stote handler
+    mStoreHandler = new MsgStoreHandler();
+    
+    // create view manager
+    mViewManager = new MsgServiceViewManager(mStoreHandler,this);
+    
+    // create interfaces 
+    mSendInterface = new MsgSendInterface(mViewManager);
+    mViewInterface = new MsgViewInterface(mViewManager);
+    mShareUiInterface = new MsgShareUiInterface(mViewManager);
+    }
+
+// ----------------------------------------------------------------------------
+// MsgServiceWindow::~MsgServiceWindow
+// @see header
+// ----------------------------------------------------------------------------
+MsgServiceWindow::~MsgServiceWindow()
+    {
+    if(mShareUiInterface)
+        {
+        delete mShareUiInterface;
+        }
+    if(mViewInterface)
+        {
+        delete mViewInterface;
+        }
+    if(mSendInterface)
+        {
+        delete mSendInterface;
+        }
+    if(mViewManager)
+        {
+        delete mViewManager;
+        }
+
+    if(mStoreHandler)
+        {
+        delete mStoreHandler;
+        }
+    }
+
+
+
+    
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgshareuiinterface.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -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: Message share UI service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#include "msgshareuiinterface.h"
+#include "msgserviceviewmanager.h"
+
+//----------------------------------------------------------------------------
+// MsgViewService::MsgViewService
+// @see header
+//----------------------------------------------------------------------------
+MsgShareUiInterface::MsgShareUiInterface(MsgServiceViewManager* viewManager)
+:XQServiceProvider( QLatin1String("messaging.com.nokia.symbian.IFileShare"),
+        viewManager),
+mViewManager(viewManager)
+    {
+    publishAll();    
+    }
+
+//----------------------------------------------------------------------------
+// MsgShareUiInterface::~MsgShareUiInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgShareUiInterface::~MsgShareUiInterface()
+    {
+    }
+
+//----------------------------------------------------------------------------
+// MsgShareUiInterface::send
+// @see header
+//----------------------------------------------------------------------------
+void MsgShareUiInterface::send(QVariant data)
+    {   
+    mViewManager->send(data);    
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgstorehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2008 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:   Reads message information from message store.
+ *
+ */
+
+#include <msvids.h>
+#include <mmsconst.h>
+#include <SendUiConsts.h>
+
+#include "msgstorehandler.h"
+#include "msgbiouids.h"
+#include "convergedmessage.h"
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::MsgStoreHandler
+// @see header
+//----------------------------------------------------------------------------
+MsgStoreHandler::MsgStoreHandler():
+iMsvSession(NULL)
+        {
+        TRAP_IGNORE(InitL());
+        }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::~MsgStoreHandler
+// @see header
+//----------------------------------------------------------------------------
+MsgStoreHandler::~MsgStoreHandler()
+    {
+    if(iMsvSession)
+        {
+        delete iMsvSession;
+        iMsvSession = NULL;
+        }
+    }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::InitL
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::InitL( )
+    {
+    iMsvSession = CMsvSession::OpenSyncL(*this);
+    }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::markAsReadAndGetType
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::markAsReadAndGetType(int msgId,
+                                          int& msgType,
+                                          int& msgSubType)
+    {
+    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;
+    }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::HandleSessionEventL
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::HandleSessionEventL(TMsvSessionEvent /*aEvent*/,
+        TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
+    {
+    // Nothing to do
+    }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::extractMsgType
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::extractMsgType(const TMsvEntry& entry,
+                                    int& msgType,
+                                    int& msgSubType)
+    {
+    msgType = ConvergedMessage::None;
+    msgSubType = ConvergedMessage::None;
+
+    switch(entry.iMtm.iUid)   
+        {
+        case KSenduiMtmSmsUidValue:            
+            msgType = ConvergedMessage::Sms;
+            break;
+        case KSenduiMtmBtUidValue:
+            msgType = ConvergedMessage::BT;
+            break;
+        case KSenduiMtmMmsUidValue:        
+            msgType = ConvergedMessage::Mms;
+            break;
+        case KSenduiMMSNotificationUidValue:            
+            msgType = ConvergedMessage::MmsNotification;
+            break;
+        case KSenduiMtmBioUidValue:
+            { 
+            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;
+        }
+    }
+
+//----------------------------------------------------------------------------
+// MsgStoreHandler::deleteMessage
+// @see header
+//----------------------------------------------------------------------------
+void MsgStoreHandler::deleteMessage(int msgId)
+    {
+    iMsvSession->RemoveEntry(msgId);
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgserviceapp/src/msgviewinterface.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,50 @@
+/*
+ * 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: Message view service interface used for interfacing between
+ *              QT highway and other applications.
+ *
+ */
+
+#include "msgservicewindow.h"
+#include "msgviewinterface.h"
+#include "msgserviceviewmanager.h"
+
+//----------------------------------------------------------------------------
+// MsgViewInterface::MsgViewInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgViewInterface::MsgViewInterface(MsgServiceViewManager* viewManager)
+:XQServiceProvider( QLatin1String("messaging.com.nokia.symbian.IMessageView"), 
+        viewManager),
+ mViewManager(viewManager)
+    {
+    publishAll();    
+    }
+
+//----------------------------------------------------------------------------
+// MsgViewInterface::~MsgViewInterface
+// @see header
+//----------------------------------------------------------------------------
+MsgViewInterface::~MsgViewInterface()
+    {
+    }
+
+//----------------------------------------------------------------------------
+// MsgViewInterface::view
+// @see header
+//----------------------------------------------------------------------------
+void MsgViewInterface::view(int msgId)
+    {
+    mViewManager->view(msgId);
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgservices/msgservices.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,24 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+CONFIG += ordered
+SUBDIRS += msgserviceapp/msgserviceapp.pro
+
--- a/messagingapp/msgsettings/bwins/settingsviewu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/bwins/settingsviewu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -4,13 +4,13 @@
 	??_EMsgSettingsView@@UAE@I@Z @ 3 NONAME ; MsgSettingsView::~MsgSettingsView(unsigned int)
 	?trUtf8@MsgSettingsView@@SA?AVQString@@PBD0H@Z @ 4 NONAME ; class QString MsgSettingsView::trUtf8(char const *, char const *, int)
 	?staticMetaObject@MsgSettingsView@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const MsgSettingsView::staticMetaObject
-	??0MsgSettingsView@@QAE@PAVQGraphicsItem@@@Z @ 6 NONAME ; MsgSettingsView::MsgSettingsView(class QGraphicsItem *)
-	?tr@MsgSettingsView@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString MsgSettingsView::tr(char const *, char const *)
-	??1MsgSettingsView@@UAE@XZ @ 8 NONAME ; MsgSettingsView::~MsgSettingsView(void)
-	?metaObject@MsgSettingsView@@UBEPBUQMetaObject@@XZ @ 9 NONAME ; struct QMetaObject const * MsgSettingsView::metaObject(void) const
-	?getStaticMetaObject@MsgSettingsView@@SAABUQMetaObject@@XZ @ 10 NONAME ; struct QMetaObject const & MsgSettingsView::getStaticMetaObject(void)
-	?tr@MsgSettingsView@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString MsgSettingsView::tr(char const *, char const *, int)
-	?qt_metacast@MsgSettingsView@@UAEPAXPBD@Z @ 12 NONAME ; void * MsgSettingsView::qt_metacast(char const *)
+	?tr@MsgSettingsView@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MsgSettingsView::tr(char const *, char const *)
+	?metaObject@MsgSettingsView@@UBEPBUQMetaObject@@XZ @ 7 NONAME ; struct QMetaObject const * MsgSettingsView::metaObject(void) const
+	?getStaticMetaObject@MsgSettingsView@@SAABUQMetaObject@@XZ @ 8 NONAME ; struct QMetaObject const & MsgSettingsView::getStaticMetaObject(void)
+	?qt_metacast@MsgSettingsView@@UAEPAXPBD@Z @ 9 NONAME ; void * MsgSettingsView::qt_metacast(char const *)
+	??0MsgSettingsView@@QAE@W4SettingsView@0@PAVQGraphicsItem@@@Z @ 10 NONAME ; MsgSettingsView::MsgSettingsView(enum MsgSettingsView::SettingsView, class QGraphicsItem *)
+	??1MsgSettingsView@@UAE@XZ @ 11 NONAME ; MsgSettingsView::~MsgSettingsView(void)
+	?tr@MsgSettingsView@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString MsgSettingsView::tr(char const *, char const *, int)
 	?onSmsCenterEditViewClosed@MsgSettingsView@@QAEXXZ @ 13 NONAME ; void MsgSettingsView::onSmsCenterEditViewClosed(void)
 	?onNewSMSCCenterClicked@MsgSettingsView@@QAEXH@Z @ 14 NONAME ; void MsgSettingsView::onNewSMSCCenterClicked(int)
 
--- a/messagingapp/msgsettings/eabi/settingsviewu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/eabi/settingsviewu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -5,8 +5,8 @@
 	_ZN15MsgSettingsView19getStaticMetaObjectEv @ 4 NONAME
 	_ZN15MsgSettingsView22onNewSMSCCenterClickedEi @ 5 NONAME
 	_ZN15MsgSettingsView25onSmsCenterEditViewClosedEv @ 6 NONAME
-	_ZN15MsgSettingsViewC1EP13QGraphicsItem @ 7 NONAME
-	_ZN15MsgSettingsViewC2EP13QGraphicsItem @ 8 NONAME
+	_ZN15MsgSettingsViewC1ENS_12SettingsViewEP13QGraphicsItem @ 7 NONAME
+	_ZN15MsgSettingsViewC2ENS_12SettingsViewEP13QGraphicsItem @ 8 NONAME
 	_ZN15MsgSettingsViewD0Ev @ 9 NONAME
 	_ZN15MsgSettingsViewD1Ev @ 10 NONAME
 	_ZN15MsgSettingsViewD2Ev @ 11 NONAME
--- a/messagingapp/msgsettings/msginit/msginit.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/msginit/msginit.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -48,6 +48,15 @@
 
 }
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/msginit.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/msginit.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 HEADERS += inc/startupmonitor.h \
 					 inc/simscnumberdetector.h \
 					 inc/msgsimnumberdetector.h
--- a/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/msginit/src/simscnumberdetector.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -256,6 +256,13 @@
             }
         aServiceSettings->SetSmsBearer((CSmsSettings::TMobileSmsBearer) readedSetting);
 
+        // Check if we need to store SMSC time stamp OR device Time stamp
+        if (iCenRepSession->Get(KSmumShowSMSCTimeStamp, readedSetting) != KErrNone) 
+					 {
+            readedSetting = 0;
+       		 }
+        aServiceSettings->SetUseServiceCenterTimeStampForDate(readedSetting);
+
         // Reply via same centre 
         if (iCenRepSession->Get(KSmumRemoveReplyViaSameCentre, readedSetting)
                 != KErrNone)
@@ -308,22 +315,15 @@
         {
         if ( HasSIMChanged() || HasNoSmscSettings() )
             {
-            QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings") 
+            QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings start") 
 
-            CMsvOperationWait* wait = CMsvOperationWait::NewLC();
+            CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
             iSimOperation = iSmsClientMtm->ReadSimParamsL(wait->iStatus);       
             wait->Start();
-
-            QDEBUG_WRITE("CMsgSimOperation::StartL Before CActiveScheduler::Start") 
-
-            CActiveScheduler::Start();
-
-            QDEBUG_WRITE("CMsgSimOperation::StartL After CActiveScheduler::Start") 
-
-            TInt err = wait->iStatus.Int(); 
+            TInt err = wait->iStatus.Int();
             StartRunL(err);
             CleanupStack::PopAndDestroy();
-
+						QDEBUG_WRITE("CMsgSimOperation::StartL Reading sim settings end") 
             }
         }
     CompleteClientRequest(0);
@@ -510,8 +510,7 @@
 
     TInt status = KErrNone;
     TInt value = 0;
-
-    status = RProperty::Get(KPSUidStartup, KPSSimStatus, value);
+		status = RProperty::Get(KPSUidStartup, KPSSimStatus, value);
 
     if (status == KErrNone && value != ESimNotPresent)
         {
@@ -519,14 +518,9 @@
 
         return ETrue;      
         }
-    else
-        {
-        QDEBUG_WRITE("CMsgSimOperation::IsSIMPresent returned False")
-
-        return EFalse;    
-        }
-
-
+    
+		QDEBUG_WRITE("CMsgSimOperation::IsSIMPresent returned False")
+		return EFalse;
     }
 
 TBool CMsgSimOperation::HasSIMChanged()
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingengine.h	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,7 @@
 #ifndef MSGSETTINGENGINE_H_
 #define MSGSETTINGENGINE_H_
 
-#include <QObject.h>
+#include <qobject.h>
 
 //FORWARD DECLARATION
 class SmsSettingsPrivate;
@@ -46,7 +46,7 @@
      */
     enum MmsRetrieval
     {
-        AlwaysAutomatic, AutomInHomeNetwork, Maual, Off, No
+        AlwaysAutomatic, AutomInHomeNetwork, Manual, Off, No
     };
     
 public:
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsform.h	Fri Jun 25 15:47:40 2010 +0530
@@ -20,17 +20,18 @@
 
 #include <hbdataform.h>
 #include "msgsettingengine.h"
+#include "msgsettingsview.h"
 
 class HbDataFormModelItem;
 class HbDataFormModel;
-class QStandardItemModel;
-class QStandardItemModel;
 
 class MsgSettingsForm : public HbDataForm
 {
 Q_OBJECT
 public:
-    explicit MsgSettingsForm(QGraphicsItem *parent = 0);
+    explicit MsgSettingsForm(
+            MsgSettingsView::SettingsView settingsView = MsgSettingsView::DefaultView,
+            QGraphicsItem *parent = 0);
     ~MsgSettingsForm();
     void refreshViewForm();
     void expandSMSSettings();
@@ -39,7 +40,7 @@
     void newSMSCCenterClicked(int);
         
 private:
-    void initSettingModel();
+    void initSettingModel(MsgSettingsView::SettingsView settingsView);
     void addMMSGroupItem(HbDataFormModelItem* parent);
     void addSmsMCGroupItem(HbDataFormModelItem* parent);
     void updateSmsMCGroupItem(HbDataFormModelItem* parent);
@@ -76,7 +77,6 @@
     //msg engine reference
     MsgSettingEngine* mSettingEngine;
     
-    QStandardItemModel* mSmsServiceCenterModel;
     HbDataFormModelItem *smsMessageCenter;
 
 };
--- a/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsettingsview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -35,19 +35,31 @@
 {
     Q_OBJECT
 public:
-    MsgSettingsView(QGraphicsItem *parent = 0);
+    enum SettingsView
+    {
+    DefaultView = 0,
+    SMSView,
+    MMSView
+    };
+    
+public:
+    MsgSettingsView(
+            SettingsView settingsView = MsgSettingsView::DefaultView,
+            QGraphicsItem *parent = 0);
+    
     ~MsgSettingsView();
 
 public slots:
     void onNewSMSCCenterClicked(int index);
     void onSmsCenterEditViewClosed();
         
-private:
+private:    
+    //Sms Center View
+    MsgSMSCenterView* mSMSCenterView;  
+    
     //Settings Form
     MsgSettingsForm* mSettingsForm;
     
-    //Sms Center View
-    MsgSMSCenterView* mSMSCenterView;  
     HbMainWindow* mMainWindow;
 };
 #endif // MSGSETTINGSVIEW_H
--- a/messagingapp/msgsettings/settingsview/inc/msgsmscentersettingsform.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/inc/msgsmscentersettingsform.h	Fri Jun 25 15:47:40 2010 +0530
@@ -23,6 +23,7 @@
 class HbLineEdit;
 class MsgSettingEngine;
 class HbDataFormModelItem;
+class HbAction;
 
 class MsgSMSCenterSettingsForm : public HbDataForm
 {
@@ -46,6 +47,12 @@
     
 private slots:
     void onPressedCustomButton();
+	
+	/**
+     * This slot is called delete message centre dialog launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogDeleteMsgCentre(HbAction* action);
     
 private:
     QString mCenterName;
--- a/messagingapp/msgsettings/settingsview/rom/settingsview.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/rom/settingsview.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -21,5 +21,6 @@
 REM DLL
 file=ABI_DIR\UREL\settingsview.dll                   SHARED_LIB_DIR\settingsview.dll
 
+data=ZSYSTEM\install\settingsview_stub.sis    System\Install\settingsview_stub.sis
 
 #endif
--- a/messagingapp/msgsettings/settingsview/settingsview.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/settingsview.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -10,7 +10,6 @@
 INCLUDEPATH += .
 INCLUDEPATH += ../../../inc
 INCLUDEPATH += ../../msgui/inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 CONFIG += hb
@@ -51,10 +50,19 @@
      
 TARGET.CAPABILITY = All -TCB
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/settingsview.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/settingsview.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 LIBS += -lSmcm \
     -lmsgs \	
-    -ls60qconversions \
     -lcommdb \
     -lmmsserversettings \
-    -lmmsgenericsettings
+    -lmmsgenericsettings \
+    -lxqutils
     
\ No newline at end of file
--- a/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/mmssettingsprivate.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -149,26 +149,42 @@
     mMmsClient->RestoreSettingsL();
     mMmsSetting->CopyL( mMmsClient->MmsSettings() );
 
-    //do your operation
-    TMmsReceivingMode receveMode = EMmsReceivingAutomatic;
-
-    if (aRetrieval == MsgSettingEngine::Maual)
-        receveMode = EMmsReceivingManual;
-    else if (aRetrieval == MsgSettingEngine::Off)
-        receveMode = EMmsReceivingPostpone;
-    else if (aRetrieval == MsgSettingEngine::No)
-        receveMode = EMmsReceivingReject;
-
-    if (aRetrieval == MsgSettingEngine::AlwaysAutomatic)
-        {
-        mMmsSetting->SetReceivingModeForeign(receveMode);
-        }
-    else
-        {
-        mMmsSetting->SetReceivingModeForeign(EMmsReceivingManual);
-        }
-
-    mMmsSetting->SetReceivingModeHome(receveMode);
+    switch ( aRetrieval )
+                {
+                case MsgSettingEngine::AutomInHomeNetwork:
+                    {
+                    mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic );
+                    mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual );
+                    break;
+                    }
+                case MsgSettingEngine::AlwaysAutomatic:
+                    { 
+                    mMmsSetting->SetReceivingModeHome( EMmsReceivingAutomatic );
+                    mMmsSetting->SetReceivingModeForeign( EMmsReceivingAutomatic );
+                    break;
+                    }
+                case  MsgSettingEngine::Manual:
+                    {
+                    mMmsSetting->SetReceivingModeHome( EMmsReceivingManual );
+                    mMmsSetting->SetReceivingModeForeign( EMmsReceivingManual );
+                    break;
+                    }
+                case MsgSettingEngine::Off:
+                    {   
+                    mMmsSetting->SetReceivingModeHome( EMmsReceivingPostpone );
+                    mMmsSetting->SetReceivingModeForeign( EMmsReceivingPostpone );
+                    break;
+                    }
+                case MsgSettingEngine::No:
+                   {   
+                   mMmsSetting->SetReceivingModeHome( EMmsReceivingReject );
+                   mMmsSetting->SetReceivingModeForeign( EMmsReceivingReject );
+                   break;
+                   }
+                default:
+                    break;
+                }
+    
     
     //save the settings
     mMmsClient->SetSettingsL( *mMmsSetting );
@@ -229,21 +245,36 @@
 
     mMmsAccount->LoadSettingsL(*mMmsSetting);
 
-    TMmsReceivingMode receveMode = mMmsSetting->ReceivingModeHome();
+    TMmsReceivingMode receveModeHome = mMmsSetting->ReceivingModeHome();
+    TMmsReceivingMode receveModeForeign = mMmsSetting->ReceivingModeForeign();
+   
     
-    if (receveMode == EMmsReceivingManual)
-        aRetrieval = MsgSettingEngine::Maual;
-    else if (receveMode == EMmsReceivingPostpone)
-        aRetrieval = MsgSettingEngine::Off;
-    else if (receveMode == EMmsReceivingReject)
-        aRetrieval = MsgSettingEngine::No;
-
-    receveMode = mMmsSetting->ReceivingModeForeign();
-    if (receveMode == EMmsReceivingAutomatic)
-        {
-        aRetrieval = MsgSettingEngine::AlwaysAutomatic;
-        }
-
+    // if default value is not acceptable, choose next by keeping costs low
+       if ( receveModeHome == EMmsReceivingAutomatic &&
+           receveModeForeign == EMmsReceivingAutomatic )
+       {
+       aRetrieval = MsgSettingEngine::AlwaysAutomatic;
+       }
+       else if ( receveModeHome == EMmsReceivingManual &&
+           receveModeForeign == EMmsReceivingManual )
+       {
+       aRetrieval = MsgSettingEngine::Manual;   
+       }
+       else if ( receveModeHome == EMmsReceivingReject &&
+           receveModeForeign == EMmsReceivingReject )
+       {
+       aRetrieval = MsgSettingEngine::No; 
+       }
+       else if ( receveModeHome == EMmsReceivingPostpone &&
+           receveModeForeign == EMmsReceivingPostpone )
+       {
+       aRetrieval = MsgSettingEngine::Off;   
+       }
+       // Should always be automatic@home & manaul@roam
+       else
+       {
+       aRetrieval = MsgSettingEngine::AutomInHomeNetwork;   
+       }
     aAnonymousStatus = mMmsSetting->AcceptAnonymousMessages();
 
     aMmsAdvertsStatus = mMmsSetting->AcceptAdvertisementMessages();
--- a/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingengine.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,7 +22,7 @@
 #include "msgsettingengine.h"
 #include "smssettingsprivate.h"
 #include "mmssettingprivate.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 //Constructor
 MsgSettingEngine::MsgSettingEngine()
@@ -237,7 +237,7 @@
     for (int i = 0; i < accessPoints.Count(); i++)
         {
         HBufC* name = static_cast<HBufC *> (accessPoints[i]);
-        QString qName = S60QConversions::s60DescToQString(name->Des());
+        QString qName = XQConversions::s60DescToQString(name->Des());
         nameList.append(qName);
 #ifdef _DEBUG_TRACES_
         qDebug() << "\n " << qName;
@@ -292,7 +292,7 @@
     for (int i = 0; i < accessPoints.Count(); i++)
         {
         HBufC* name = accessPoints[i];
-        QString qName = S60QConversions::s60DescToQString(name->Des());
+        QString qName = XQConversions::s60DescToQString(name->Des());
         nameList.append(qName);
 #ifdef _DEBUG_TRACES_
         qDebug() << "\n qName";
@@ -341,8 +341,8 @@
             << centreName << " " << centreNumber;
 #endif
 
-    HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber);
-    HBufC* d_name = S60QConversions::qStringToS60Desc(centreName);
+    HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
+    HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
 
     dptr_smsSettings->editSMSServiceCentre(d_addr, d_name, index);
     delete d_addr;
@@ -368,8 +368,8 @@
 #endif
 
 
-    HBufC* d_addr = S60QConversions::qStringToS60Desc(centreNumber);
-    HBufC* d_name = S60QConversions::qStringToS60Desc(centreName);
+    HBufC* d_addr = XQConversions::qStringToS60Desc(centreNumber);
+    HBufC* d_name = XQConversions::qStringToS60Desc(centreName);
 
     dptr_smsSettings->addSmsMessageCenter(d_addr, d_name);
     delete d_addr;
@@ -409,8 +409,8 @@
 
     dptr_smsSettings->smsCenterNameAndNumber(index, &d_addr, &d_name);
 
-    centreNumber = S60QConversions::s60DescToQString(d_addr->Des());
-    centreName = S60QConversions::s60DescToQString(d_name->Des());
+    centreNumber = XQConversions::s60DescToQString(d_addr->Des());
+    centreName = XQConversions::s60DescToQString(d_name->Des());
 
 #ifdef _DEBUG_TRACES_
     qDebug() << "Exit smsCenterNameAndNumber " << centreNumber << " "
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsdataformcustomitem.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsdataformcustomitem.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -49,10 +49,7 @@
         case HbDataFormModelItem::CustomItemBase + 1:
             {
             //custom button
-            QString
-                    str =
-                            modelIndex().data(HbDataFormModelItem::KeyRole).toString();
-            HbPushButton *button = new HbPushButton(str);
+            HbPushButton *button = new HbPushButton();
 
             return button;
             }
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsform.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,12 +22,10 @@
 #include <hbdataformmodel.h>
 #include <hbcombobox.h>
 #include <hbpushbutton.h>
-#include <QStandardItemModel>
 
 #include "debugtraces.h"
 
 //Localized constants
-#define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings")
 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages")
 #define LOC_ON hbTrId("txt_messaging_setlabel_val_on")
 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off")
@@ -47,15 +45,15 @@
 #define LOC_ADD_NEW hbTrId("txt_messaging_button_add_new")
 #define LOC_ALWAYS_AUTOMATIC hbTrId("txt_messaging_setlabel_val_always_automatic")
 #define LOC_AUTO_HOME_NETWORK hbTrId("txt_messaging_setlabel_val_auto_home_network")
-#define LOC_MANUAL hbTrId("txt_messaging_setlabel_val_mannual")
+#define LOC_MANUAL hbTrId("txt_messaging_setlabel_val_manual")
 #define LOC_MMS_YES hbTrId("txt_messaging_setlabel_allow_anonymous_mms_val_yes")
 #define LOC_MMS_NO hbTrId("txt_messaging_setlabel_allow_anonymous_mms_val_no")
 
-MsgSettingsForm::MsgSettingsForm(QGraphicsItem *parent) :
+MsgSettingsForm::MsgSettingsForm(
+        MsgSettingsView::SettingsView settingsView,
+        QGraphicsItem *parent) :
     HbDataForm(parent)
 {
-    this->setHeading(LOC_MESSAGE_SETTINGS_HEADING);
-
     mSettingEngine = new MsgSettingEngine();
 
     //custom prototype
@@ -69,7 +67,7 @@
     mSmsMCSettingsGroup << LOC_SMS_CENTRE_IN_USE << LOC_ADD_NEW;
 
     //initialize the form model
-    initSettingModel();
+    initSettingModel(settingsView);
 }
 
 MsgSettingsForm::~MsgSettingsForm()
@@ -77,7 +75,8 @@
     delete mSettingEngine;
 }
 
-void MsgSettingsForm::initSettingModel()
+void MsgSettingsForm::initSettingModel(
+        MsgSettingsView::SettingsView settingsView)
 {
     settingsModel = new HbDataFormModel(0);
 
@@ -154,6 +153,19 @@
     addSmsMCGroupItem(mSmsMCGroup);
 
     this->setModel(settingsModel);
+    
+    if (settingsView == MsgSettingsView::MMSView)
+    {
+        //set MMS Settings as expanded
+        QModelIndex index_mms = settingsModel->indexFromItem(mmsGroup);
+        //TODO: dataform issue on expanding one group item
+        //this->setExpanded(index_mms, true);
+    }
+    else if(settingsView == MsgSettingsView::SMSView)
+    {
+        //expandSMSSettings();
+    }
+        
 }
 
 void MsgSettingsForm::refreshViewForm()
@@ -168,24 +180,13 @@
     mSmsServiceList.clear();
     mSettingEngine->allSMSMessageCenter(mSmsServiceList, defaultServiceCenter);
 
-    mSmsServiceCenterModel->clear();
-    
-    //recreate all the model items 
-    int itemCount = mSmsServiceList.count();
-    for (int i = 0; i < itemCount; ++i)
+    //set the content widget data again    
+    smsMessageCenter->setContentWidgetData("items", mSmsServiceList);
+    if(defaultServiceCenter > 0)
     {
-        QStandardItem *item = new QStandardItem;
-        item->setData(mSmsServiceList.at(i), Qt::DisplayRole);
-        mSmsServiceCenterModel->appendRow(item);
-    }
-    //set the content widget data again
-    if(itemCount > 0)
-    {
-       smsMessageCenter->setContentWidgetData("items", mSmsServiceList);
-    }
-
     smsMessageCenter->setContentWidgetData("currentIndex",
                                                defaultServiceCenter);
+    }
     
     //2. refresh all the custom buttons again
     int childCount = parent->childCount();
@@ -303,20 +304,10 @@
                                     LOC_MMS_AP_IN_USE,
                                     0);
 
-    QStandardItemModel* comboModel = new QStandardItemModel();
-
     QStringList mmsList;
     int defaultAccessPointIndex = -1;
 
     mSettingEngine->allMMsAcessPoints(mmsList, defaultAccessPointIndex);
-    int accessPoints = mmsList.count();
-    for (int a = 0; a < accessPoints; ++a)
-    {
-        QStandardItem* item = new QStandardItem();
-        item->setData(mmsList[a], Qt::DisplayRole);
-        comboModel->appendRow(item);
-    }
-    accessPoint->setModel(comboModel);
     accessPoint->setContentWidgetData("items", mmsList);
     if (defaultAccessPointIndex >= 0)
     {
@@ -345,20 +336,9 @@
 
     int defaultServiceCenter = -1;
     mSmsServiceList.clear();
+    
     mSettingEngine->allSMSMessageCenter(mSmsServiceList, defaultServiceCenter);
-    mSmsServiceCenterModel = new QStandardItemModel(this);
-
-    int itemCount = mSmsServiceList.count();
-    for (int i = 0; i < itemCount; ++i)
-    {
-        QStandardItem *item = new QStandardItem;
-        item->setData(mSmsServiceList.at(i), Qt::DisplayRole);
-        mSmsServiceCenterModel->appendRow(item);
-    }
-
-    smsMessageCenter->setModel(mSmsServiceCenterModel);
     smsMessageCenter->setContentWidgetData("items", mSmsServiceList);
-
     if (defaultServiceCenter >= 0)
     {
         smsMessageCenter->setContentWidgetData("currentIndex",
--- a/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsettingsview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -15,24 +15,43 @@
  *
  */
 #include <hbmainwindow.h>
+#include <hbgroupbox.h>
+#include <QGraphicsLinearLayout>
 
 #include "msgsettingsview.h"
 #include "msgsettingsform.h"
 #include "msgsmscenterview.h"
 #include "debugtraces.h"
 
-MsgSettingsView::MsgSettingsView(QGraphicsItem *parent) :
-    MsgBaseView(parent), mSMSCenterView(0)
+//LOCALAIZED CONSTANTS 
+#define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings")
+
+MsgSettingsView::MsgSettingsView(SettingsView settingsView,
+                                 QGraphicsItem *parent) :
+    MsgBaseView(parent), mSMSCenterView(0), mSettingsForm(0)
 {
-    mSettingsForm = new MsgSettingsForm();
+    mMainWindow = this->mainWindow();
 
-    setWidget(mSettingsForm);
-    mMainWindow = this->mainWindow();
+    // Create parent layout.
+    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mainLayout->setContentsMargins(0, 0, 0, 0);
+    mainLayout->setSpacing(0);
+
+    // Create view heading.
+    HbGroupBox *viewHeading = new HbGroupBox();
+    viewHeading->setHeading(LOC_MESSAGE_SETTINGS_HEADING);
+
+    mSettingsForm = new MsgSettingsForm(settingsView);
 
     connect(mSettingsForm,
             SIGNAL(newSMSCCenterClicked(int)),
             this,
             SLOT(onNewSMSCCenterClicked(int)));
+
+    mainLayout->addItem(viewHeading);
+    mainLayout->addItem(mSettingsForm);
+
+    this->setLayout(mainLayout);
 }
 
 MsgSettingsView::~MsgSettingsView()
@@ -50,13 +69,13 @@
     }
 
     mSMSCenterView = new MsgSMSCenterView(index);
-    
+
     connect(mSMSCenterView,
             SIGNAL(smsCenterEditViewClosed()),
             this,
             SLOT(onSmsCenterEditViewClosed()));
-    
-    mMainWindow->addView(mSMSCenterView);        
+
+    mMainWindow->addView(mSMSCenterView);
     mMainWindow->setCurrentView(mSMSCenterView);
 }
 
--- a/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsmscentersettingsform.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,31 +26,23 @@
 #include <HbNotificationDialog>
 #include <hbinputeditorinterface.h>
 #include <hbmessagebox.h>
+#include <HbAction>
 #include "debugtraces.h"
 
 //Localized constants
-#define LOC_NEW_SMS_CENTRE hbTrId("txt_messaging_title_new_sms_message_centre")
-#define LOC_EDIT_SMS_CENTRE hbTrId("txt_messaging_title_edit_sms_message_centre")
 #define LOC_SMS_CENTRE_NAME hbTrId("txt_messaging_setlabel_message_centre_name")
 #define LOC_SMS_CENTRE_NUMBER hbTrId("txt_messaging_setlabel_message_centre_number")
 #define LOC_SMS_CENTRE_DELETE hbTrId("txt_messaging_button_delete_message_centre")
 #define LOC_MESSAGE_CENTER_SAVED hbTrId("txt_messaging_setlabel_message_centre_saved")
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
 
 MsgSMSCenterSettingsForm::MsgSMSCenterSettingsForm(int view,
                                                    QGraphicsItem *parent) :
     HbDataForm(parent), mEdit1(0), mEdit2(0), mView(view)
 {
     QString heading;
-    if (mView == -1)
+    if (mView > -1)
     {
-        heading = LOC_NEW_SMS_CENTRE;
-    }
-    else
-    {
-        heading = LOC_EDIT_SMS_CENTRE;
-        //custom prototype
+        //add the custom prototype only for edit items
         MsgSettingsDataFormCustomItem* customPrototype =
                 new MsgSettingsDataFormCustomItem(this);
 
@@ -59,8 +51,6 @@
         this->setItemPrototypes(protos);
     }
 
-    this->setHeading(heading);
-
     bool b = connect(this,
                      SIGNAL(itemShown(const QModelIndex&)),
                      this,
@@ -182,37 +172,36 @@
     if (itemData && itemData == messageCenterName && !mEdit1)
     {
         QDEBUG_WRITE("messageCenterName updated..");
-        mEdit1
-                = static_cast<HbLineEdit *> (
-                        this->dataFormViewItem(
-                                topLeft)->dataItemContentWidget());
+        HbDataFormViewItem* item1 = 
+                static_cast<HbDataFormViewItem*>(this->itemByIndex(topLeft));
+        mEdit1 =  static_cast<HbLineEdit*>(item1->dataItemContentWidget());
     }
     else if (itemData && itemData == messageCenterNumber && !mEdit2)
     {
         QDEBUG_WRITE("messageCenterNumber updated..");
-        mEdit2
-                = static_cast<HbLineEdit *> (
-                        this->dataFormViewItem(
-                                topLeft)->dataItemContentWidget());
-        
-        HbEditorInterface editorInterface(mEdit2);
-        editorInterface.setUpAsPhoneNumberEditor();
+        HbDataFormViewItem* item1 = 
+                 static_cast<HbDataFormViewItem*>(this->itemByIndex(topLeft));
+        mEdit2 =  static_cast<HbLineEdit*>(item1->dataItemContentWidget());       
+        mEdit2->setInputMethodHints(Qt::ImhPreferNumbers);
 
     }
 }
 
 void MsgSMSCenterSettingsForm::onPressedCustomButton()
 {
-    bool result = HbMessageBox::question("Delete message centre ?",
-                                         LOC_BUTTON_DELETE,
-                                         LOC_BUTTON_CANCEL);                                         
+   HbMessageBox::question(LOC_SMS_CENTRE_DELETE, this,
+                          SLOT(onDialogDeleteMsgCentre(HbAction*)),
+                          HbMessageBox::Delete | HbMessageBox::Cancel);
+}
 
-    if (result)
-    {
+void MsgSMSCenterSettingsForm::onDialogDeleteMsgCentre(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender()); 
+    if (action == dlg->actions().at(0)) {
         //delete from m/w -- mView is the index to delete
-        mSettingEngine->deleteSmsMessageCenter(mView);
-        emit deleteMessageCentreAndClose();
-    }    
+               mSettingEngine->deleteSmsMessageCenter(mView);
+               emit deleteMessageCentreAndClose();
+    }   
 }
 
 //eof
--- a/messagingapp/msgsettings/settingsview/src/msgsmscenterview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/src/msgsmscenterview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -15,27 +15,50 @@
  *
  */
 #include <hbaction.h>
+#include <hbgroupbox.h>
+#include <QGraphicsLinearLayout>
 
 #include "msgsmscenterview.h"
 #include "msgsmscentersettingsform.h"
 #include "debugtraces.h"
 
+#define LOC_NEW_SMS_CENTRE hbTrId("txt_messaging_title_new_sms_message_centre")
+#define LOC_EDIT_SMS_CENTRE hbTrId("txt_messaging_title_edit_sms_message_centre")
+
 MsgSMSCenterView::MsgSMSCenterView(int view, QGraphicsItem *parent) :
     MsgBaseView(parent)
 {
+    // Create parent layout.
+    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mainLayout->setContentsMargins(0, 0, 0, 0);
+    mainLayout->setSpacing(0);
+
+    // Create view heading.
+    HbGroupBox *viewHeading = new HbGroupBox();
+    if (view == -1)
+    {
+        viewHeading->setHeading(LOC_NEW_SMS_CENTRE);
+    }
+    else
+    {
+        viewHeading->setHeading(LOC_EDIT_SMS_CENTRE);
+    }
+
     mSMSCenterSettingsForm = new MsgSMSCenterSettingsForm(view);
 
-    setWidget(mSMSCenterSettingsForm);
-
-    HbAction* backAction = new HbAction(Hb::BackAction, this);
+    HbAction* backAction = new HbAction(Hb::BackNaviAction, this);
     setNavigationAction(backAction);
 
     connect(mSMSCenterSettingsForm,
             SIGNAL(deleteMessageCentreAndClose()),
             this,
             SLOT(onCloseMessageCenterView()));
+
+    connect(backAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
     
-    connect(backAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
+    mainLayout->addItem(viewHeading);
+    mainLayout->addItem(mSMSCenterSettingsForm);
+    this->setLayout(mainLayout);
 }
 
 MsgSMSCenterView::~MsgSMSCenterView()
--- a/messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -23,4 +23,7 @@
 %{"Nokia"}
 
 ; Unique Vendor name
-:"Nokia"
\ No newline at end of file
+:"Nokia"
+
+;Files
+""-"z:\sys\bin\settingsview.dll"
Binary file messagingapp/msgsettings/settingsview/stub_sis/settingsview_stub.sis has changed
--- a/messagingapp/msgui/appengine/appengine.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/appengine.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -20,9 +20,10 @@
 DEPENDPATH += . src
 
 INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../msguiutils/inc
 INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
-INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include
+INCLUDEPATH += ../../smartmessaging/ringbc/inc
+
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_DLL
@@ -45,6 +46,15 @@
      "$${LITERAL_HASH}include <platform_paths.hrh>" \
      "rom/appengine.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(appengine.iby)"
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/appengine.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/appengine.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 # Input
 HEADERS += inc/conversationsengine.h \
            inc/conversationmsgstorehandler.h \
@@ -68,7 +78,6 @@
 
 LIBS += -lcsserverclientapi \
         -lcsutils \
-        -ls60qconversions \
         -lconvergedmessageutils \
         -lmsgs \
         -lInetProtUtil \
@@ -84,7 +93,11 @@
         -lmmscli \
         -lcommonengine \
         -lmmsserversettings \
-	-lFeatMgr
+        -lsqldb \
+        -lestor \
+	-lFeatMgr \
+	-lfbscli \
+        -lringbc \
+        -lmsguiutils
 
 
-
--- a/messagingapp/msgui/appengine/inc/conversationlistchangehandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationlistchangehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -110,7 +110,14 @@
 
     void ModifyConversationList(
         const CCsClientConversation& aClientConversation);
-
+    
+	/**
+	 * PartialDeleteConversationList
+	 * This is for handling the partial delete of conversation event from server
+	 * @param aClientConversation CCsClientConversation& - reference to client conversation
+	 */
+    void PartialDeleteConversationList(
+            const CCsClientConversation& aClientConversation);
     /**
      * RefreshConversationList
      * This is for handling refresh asynchronusly from the server.
@@ -129,7 +136,18 @@
      * Handles Conversation List received from server and updates into model
      */
     void HandleConversationListL();
-
+    
+    /**
+     * CompareByConvTimeStamp
+     * Helper method to compare conversations by timestamp
+     * 
+     * @param aObj1  CCsConversation object
+     * @param aObj2  CCsConversation object
+     * @return value based of timestamp comparison
+     */
+    static TInt CompareByConvTimeStamp(const CCsClientConversation& aObj1,
+            const CCsClientConversation& aObj2);
+   
 private:
     // data
 
--- a/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationmsgstorehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -143,13 +143,13 @@
      * Sets content to messageId
      * @param messageId, Message Id content
      */
-    void setNotificationMessageId(int messageId);
+    void setNotificationMessageIdL(int messageId);
 
     /**
      * Seeker method for getting mms notification estimated msg size
      * @return Formatted string of msg size
      */
-    QString NotificationMsgSize();
+    QString NotificationMsgSizeL();
     
     /**
      * Seeker method for getting mms notification class type
@@ -184,6 +184,11 @@
      *         KErrGeneral for other cases
      */
     TInt DownloadMessageL(TMsvId aId);
+    
+    /**
+     * Returns the Bio Type of a message
+     */
+    int getMsgSubType(int msgId);
 
 private:
 
@@ -273,7 +278,7 @@
      */
     CMmsNotificationClientMtm* iNotificationClient;
 	
-	TBool iOfflineSupported;	
+    TBool iOfflineSupported;
     };
 
 #endif // CONVERSATION_MSG_STORE_HANDLER_H
--- a/messagingapp/msgui/appengine/inc/conversationsengine.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsengine.h	Fri Jun 25 15:47:40 2010 +0530
@@ -21,6 +21,7 @@
 // INCLUDES
 #include <QObject>
 #include <QStandardItemModel>
+#include <sqldb.h>
 
 #ifdef BUILD_DLL
 #define CONVERSATIONS_ENGINE_API_EXPORT Q_DECL_EXPORT
@@ -160,11 +161,23 @@
     void emitConversationModelUpdated();
     
     /**
+     * Updates the new conversation id for list view
+     */
+    void emitOpenConversationViewIdUpdate(int newConversationId);
+    
+    void disableRegisterationForCVEvents();
+    
+    /**
      * Emits conversationListModelPopulated signal
      */ 
     void emitConversationListModelPopulated();
 
     /**
+     * Emits conversationListModelEntryDeleted
+     */
+    void emitConversationListModelEntryDeleted( int conversationId );
+    
+    /**
      *  Starts fetching remaing conversations
      */
     void fetchMoreConversations();
@@ -202,6 +215,19 @@
     void markAsReadAndGetType( qint32 messageId,
                                int& msgType,
                                int& msgSubType);
+    
+    /*
+     * Get SQL DB handle
+     * @param isOpen, set to true if open, check this before using the handle
+     */
+    RSqlDatabase& getDBHandle(TBool& isOpen);
+    
+    /**
+     * Get the biotype of a message
+     * @param messageId
+     */
+    int getMsgSubType(int messageId);
+    
 private:
 
     /**
@@ -229,6 +255,17 @@
      */
     void conversationListModelPopulated();
     
+	/** 
+	 * Signal to indicate the completion of conversation delete
+	 * operation.
+	 */
+     void conversationListEntryDeleted( int conversationId );
+	 
+    /**
+     * Signal to specify the CV model empty now
+     */
+    void conversationViewEmpty();
+    
 private:
 
     /**
--- a/messagingapp/msgui/appengine/inc/conversationsengine_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsengine_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -119,6 +119,18 @@
     void registerForConversationUpdatesL();
     
     /**
+     *  Remove the CV notifs temporary for some time
+     *  does not destroy the model as such
+     */
+    void deRegisterCVUpdatesTemporary();
+    
+    /**
+     *  Register again after temporary de-register
+     * just need to set the new conversation id
+     */
+    void registerAgainForConversationUpdatesL(int newConversationId);
+    
+    /**
      *  Fetch ConversationId from contactId
      *  @param contactId , contactId
      *  @return conversationId
@@ -133,6 +145,12 @@
     TInt getConversationIdFromAddressL(TDesC& contactAddress);
 
     /**
+     *  Get the latest conversation from the conversation cache by Id
+     *  @param aConversationId for conversation is required
+     */
+    CCsClientConversation* getConversationFromConversationIdL(TInt aConversationId);
+
+    /**
      *  Starts fetching remaing conversations
      */
     void fetchMoreConversations();
--- a/messagingapp/msgui/appengine/inc/conversationsenginedefines.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsenginedefines.h	Fri Jun 25 15:47:40 2010 +0530
@@ -42,7 +42,8 @@
     MessageLocation,
     MessageStore,
     ConversationAlias,
-    NotificationStatus
+    NotificationStatus,
+    PreviewIcon
 };
 
 #endif /* CONVERSATIONS_ENGINE_DEFINES_H */
--- a/messagingapp/msgui/appengine/inc/conversationsengineutility.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsengineutility.h	Fri Jun 25 15:47:40 2010 +0530
@@ -52,13 +52,6 @@
      */
     static int messageSubType(TCsType value);
 
-    /**
-     * Get display-name of a contact from VCard.
-     * @param filePath, VCard file-path
-     * @return display-name
-     */
-    static QString getVcardDisplayName(QString filePath);
-
     };
 
 #endif //CONVERSATIONS_ENGINE_UTILITY_H
--- a/messagingapp/msgui/appengine/inc/conversationsmodel.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationsmodel.h	Fri Jun 25 15:47:40 2010 +0530
@@ -22,6 +22,9 @@
 #include <QObject>
 #include <QStandardItemModel>
 #include <ccsdefs.h>
+#include <sqldb.h>
+#include <QCache>
+#include <HbIcon>
 
 // FORWARD DECLARATIONS
 class CCsConversationEntry;
@@ -75,6 +78,35 @@
      * @param msgId, Message Id
      */
     void deleteRow(int msgId);
+    
+    /*
+     * Get SQL DB handle
+     * @param isOpen, set to true if open, check this before using the handle
+     */
+    RSqlDatabase& getDBHandle(TBool& isOpen);
+
+    /*
+     * Clears the pixmap cache & model
+     */
+    void clearModel();
+    
+    void emitConversationViewEmpty();
+
+signals:
+
+    /*
+     * Signal emitted to retrieve the pixmap icon
+     */
+    void retrievePreviewIcon(int msgId, QString& filepath) const;
+    
+    void conversationViewEmpty();
+
+private slots:
+
+    /*
+     * Slot which handles retrievePreviewIcon signal
+     */
+    void updatePreviewIcon(int msgId, QString& filePath);
 
 private:
 
@@ -116,6 +148,31 @@
     void handleBioMessages(QStandardItem& item, 
         const CCsConversationEntry& entry);
 
+    /**
+     * Populates preview icon into the previewicon cache
+     * @param pixmap, QPixmap
+     * @param filePath, filepath to be used if icon is not in Db
+     * @param msgId, key to pixmap in previewicon cache
+     * @param inDb, indicates if icon was available in Db (or) not
+     */    
+    void setPreviewIcon(QPixmap& pixmap, QString& filePath, int msgId,
+        bool inDb);
+
+    /**
+     * Get the preview icon item if available in pixmap cache / create
+     * and return the preview icon
+     * @param msgId, key to pixmap in previewicon cache
+     * @param filePath, filepath to be used if icon is not in cache
+     */
+    HbIcon* getPreviewIconItem(int msgId, QString& filepath) const;
+    
+    /**
+     * Check if a MMS is forwardable or not
+     * @param messageId, message id
+     * @return true/false
+     */
+    bool validateMsgForForward(qint32 messageId);
+
 private:
 
     /**
@@ -141,6 +198,21 @@
      * Not Own
      */
     UniDataModelPluginInterface* iBioMsgPlugin;
+    
+    /*
+     * SQL DB handle
+     */
+    RSqlDatabase iSqlDb;
+
+    /*
+     * DB open.
+     */
+    TBool iSqlDbOpen;
+
+    /*
+     *  preview-icon cache
+     */
+    QCache<int, HbIcon> previewIconCache;
 };
 
 #endif // CONVERSATIONS_MODEL_H
--- a/messagingapp/msgui/appengine/inc/conversationssummarymodel.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/inc/conversationssummarymodel.h	Fri Jun 25 15:47:40 2010 +0530
@@ -66,9 +66,10 @@
      * Add a new row to the conversation summary model.
      * Overwrite the row if the message already exists.
      * @param conversation, CCsClientConversation
+     * @param caching, initial caching flag
      * 
      */    
-    void addRow(const CCsClientConversation& conversation);
+    void addRow(const CCsClientConversation& conversation, bool caching = false);
 
     /**
      * Delete a row from conversation summary model.
--- a/messagingapp/msgui/appengine/src/conversationchangehandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationchangehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -104,7 +104,6 @@
     const CCsConversationEntry& aConvEntry)
 {
     mConversationsModel->addRow(aConvEntry, true);
-    ConversationsEngine::instance()->emitConversationModelUpdated();
 }
 
 // ---------------------------------------------------------------------------
@@ -115,7 +114,13 @@
     const CCsConversationEntry& aConvEntry)
 {
     mConversationsModel->deleteRow(aConvEntry.EntryId());
-    ConversationsEngine::instance()->emitConversationModelUpdated();
+    
+    //check if the CV model row count has become zero
+    // then needs to emit signal
+    if (mConversationsModel->rowCount() == 0)
+    {
+        mConversationsModel->emitConversationViewEmpty();
+    }
 }
 
 //-----------------------------------------------------------------------
--- a/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationlistchangehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -99,7 +99,8 @@
     for (TInt i = 0; i < aClientConversationList.Count(); ++i)
     {        
         CCsClientConversation *entry = aClientConversationList[i]->CloneL();
-        mClientConversationList.AppendL(entry);
+        mClientConversationList.InsertInOrderAllowRepeats( entry,
+                ConversationsListChangeHandler::CompareByConvTimeStamp );
     }
 
     if (aClientConversationList.Count() > 0)
@@ -137,6 +138,17 @@
 }
 
 //-----------------------------------------------------------------------
+// This is for handling partial delete conversation event asynchronusly from the server
+//-----------------------------------------------------------------------
+//
+
+void ConversationsListChangeHandler::PartialDeleteConversationList(
+            const CCsClientConversation& aClientConversation)
+{
+    ConversationsEngine::instance()->emitConversationListModelEntryDeleted( aClientConversation.GetConversationEntryId() );
+}
+
+//-----------------------------------------------------------------------
 // This is for handling modify conversation event asynchronusly from the server
 //-----------------------------------------------------------------------
 //
@@ -180,7 +192,7 @@
         if (mCurrentIndex < mClientConversationList.Count())
         {
             mConvSummaryModel->addRow(
-                * (mClientConversationList[mCurrentIndex]));
+                * (mClientConversationList[mCurrentIndex]),true);
             mCurrentIndex++;
         }
         else
@@ -213,4 +225,24 @@
 
 }
 
+// ----------------------------------------------------------------------------
+// ConversationsListChangeHandler::CompareByConvTimeStamp
+// ---------------------------------------------------------------------------
+TInt ConversationsListChangeHandler::CompareByConvTimeStamp(const CCsClientConversation& aObj1,
+        const CCsClientConversation& aObj2)
+    {
+    TInt64 timestamp1 = aObj1.GetConversationEntry()->TimeStamp();
+    TInt64 timestamp2 = aObj2.GetConversationEntry()->TimeStamp();
+
+    if (timestamp1 == timestamp2)
+        {
+        return 0;
+        }
+    else if (timestamp1 < timestamp2)
+        {
+        return 1;
+        }
+    return -1;
+    }
+
 // EOF
--- a/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationmsgstorehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,7 @@
 #include "conversationmsgstorehandler.h"
 #include "draftsmodel.h"
 #include "MuiuOperationWait.h"
-#include "MsgBioUids.h"
+#include "msgbiouids.h"
 #include "UniEditorGenUtils.h"
 
 // SYSTEM INCLUDES
@@ -407,8 +407,11 @@
     mDraftsModel = draftsModel;
     iState = EReadDrafts;
     TCallBack callback = TCallBack(ProcessDraftMessages, (TAny*) this);
-    iIdle = CIdle::NewL(CActive::EPriorityStandard);
-    iIdle->Start(callback);
+    TRAPD(err, iIdle = CIdle::NewL(CActive::EPriorityStandard));
+    if(err == KErrNone)
+        {
+        iIdle->Start(callback);    
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -648,10 +651,10 @@
 }
 
 //---------------------------------------------------------------
-// ConversationMsgStoreHandler::setNotificationMessageId
+// ConversationMsgStoreHandler::setNotificationMessageIdL
 // @see header
 //---------------------------------------------------------------
-void ConversationMsgStoreHandler::setNotificationMessageId(int messageId)
+void ConversationMsgStoreHandler::setNotificationMessageIdL(int messageId)
 {
     // get MMS Notification client mtm & set the content to current entry
     if(iNotificationClient)
@@ -668,10 +671,10 @@
 }
 
 //---------------------------------------------------------------
-// ConversationMsgStoreHandler::NotificationMsgSize
+// ConversationMsgStoreHandler::NotificationMsgSizeL
 // @see header
 //---------------------------------------------------------------
-QString ConversationMsgStoreHandler::NotificationMsgSize()
+QString ConversationMsgStoreHandler::NotificationMsgSizeL()
 {
     // Size of message.
     TInt size = iNotificationClient->MessageTransferSize( );
@@ -841,7 +844,7 @@
     iNotificationClient->SwitchCurrentEntryL(aId);    */ 
     
     // set context to current entry
-    setNotificationMessageId(aId);
+    setNotificationMessageIdL(aId);
 
     TTime currentTime;
     currentTime.HomeTime( );
@@ -925,7 +928,7 @@
             {
             // Mark the entry as read
             entry.SetUnread( EFalse );
-            cEntry->ChangeL( entry );
+            TRAP_IGNORE(cEntry->ChangeL( entry ));
             }
         // extract message type
         extractMsgType(entry,msgType,msgSubType);
@@ -949,6 +952,9 @@
         {
         case KSenduiMtmSmsUidValue:            
             msgType = ConvergedMessage::Sms;
+            if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) {
+                msgSubType = ConvergedMessage::NokiaService;
+            }
             break;
         case KSenduiMtmBtUidValue:
             msgType = ConvergedMessage::BT;
@@ -979,12 +985,29 @@
             else if (entry.iBioType == KMsgBioUidVCalendar.iUid)
                 {
                 msgSubType = ConvergedMessage::VCal;
-                }        
+                }
+            else if (entry.iBioType == KMsgBioNokiaServiceSentMessage.iUid) {
+                msgSubType = ConvergedMessage::NokiaService;
+                }
             }
-            break;
-        default:
-            msgType = ConvergedMessage::None;       
-            break;
-        }
+        break;
+    default:
+        msgType = ConvergedMessage::None;
+        break;
     }
+}
+
+int ConversationMsgStoreHandler::getMsgSubType(int msgId)
+{
+    int msgType = ConvergedMessage::None;
+    int msgSubType = ConvergedMessage::None;
+    CMsvEntry* cEntry = NULL;
+    TRAPD(err, cEntry = iMsvSession->GetEntryL(msgId));
+    if (err == KErrNone) {
+        TMsvEntry entry = cEntry->Entry();
+        extractMsgType(entry, msgType, msgSubType);
+    }
+    return msgSubType;
+}
+
 // End of file
--- a/messagingapp/msgui/appengine/src/conversationsengine.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,6 +16,9 @@
  */
 #include "conversationsengine.h"
 
+#include <ccsconversationentry.h>
+#include <ccsclientconversation.h>
+
 #include "conversationsenginedefines.h"
 #include "convergedmessage.h"
 #include "conversationmsgstorehandler.h"
@@ -24,7 +27,7 @@
 #include "draftsmodel.h"
 #include "conversationsengine_p.h"
 #include "debugtraces.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 //---------------------------------------------------------------
 // ConversationsEngine::instance
@@ -52,6 +55,12 @@
     d_ptr = new ConversationsEnginePrivate(mConversationMsgStoreHandler,
         mConversationsSummaryModel,
         mConversationsModel);
+    
+    connect (mConversationsModel,
+            SIGNAL(conversationViewEmpty()),
+            this,
+            SIGNAL(conversationViewEmpty())); 
+   
 }
 
 //---------------------------------------------------------------
@@ -212,7 +221,27 @@
     {
         displayName = indexList[0].data(DisplayName).toString();
         address = indexList[0].data(ConversationAddress).toString();
-    }         
+    }
+    else
+    {
+        int error;
+        CCsClientConversation* clientConv = NULL;
+        TRAP(error, clientConv = d_ptr->getConversationFromConversationIdL(conversationId));
+
+        HBufC *name = clientConv->GetDisplayName();
+        if (name && name->Length())
+        {
+            displayName = XQConversions::s60DescToQString(*name);
+        }
+
+        HBufC *addr = clientConv->GetConversationEntry()->Contact();
+        if (addr && addr->Length())
+        {
+            address = XQConversions::s60DescToQString(*addr);
+        }
+
+        delete clientConv;
+    }
 }
 
 //---------------------------------------------------------------
@@ -224,7 +253,7 @@
     qint64 conversationId = -1;
 
     int error;
-    HBufC* number = S60QConversions::qStringToS60Desc(address);
+    HBufC* number = XQConversions::qStringToS60Desc(address);
     TRAP(error,conversationId = 
         d_ptr->getConversationIdFromAddressL(*number));
 
@@ -284,6 +313,35 @@
 }
 
 //---------------------------------------------------------------
+// ConversationsEngine::emitConversationListModelEntryDeleted
+// @see header
+//---------------------------------------------------------------
+void ConversationsEngine::emitConversationListModelEntryDeleted( int conversationId )
+{
+    emit conversationListEntryDeleted( conversationId );
+}
+
+//---------------------------------------------------------------
+// ConversationsEngine::emitOpenConversationViewIdUpdate
+// @see header
+//---------------------------------------------------------------
+void ConversationsEngine::emitOpenConversationViewIdUpdate(
+        int newConversationId)
+{
+    //also register for subscription now
+    d_ptr->registerAgainForConversationUpdatesL(newConversationId);   
+}
+
+//---------------------------------------------------------------
+// ConversationsEngine::disableRegisterationForCVEvents
+// @see header
+//---------------------------------------------------------------
+void ConversationsEngine::disableRegisterationForCVEvents()
+{
+    d_ptr->deRegisterCVUpdatesTemporary();
+}
+
+//---------------------------------------------------------------
 // ConversationsEngine::fetchMoreConversations
 // @see header
 //---------------------------------------------------------------
@@ -335,6 +393,24 @@
                                                     msgSubType);
 }
 
+//---------------------------------------------------------------
+// ConversationsEngine::getDBHandle()
+// @see header
+//---------------------------------------------------------------
+RSqlDatabase& ConversationsEngine::getDBHandle(TBool& isOpen)
+    {
+    return mConversationsModel->getDBHandle(isOpen);
+    }
+
+
+//---------------------------------------------------------------
+// ConversationsEngine::getMsgSubType()
+// @see header
+//---------------------------------------------------------------
+int ConversationsEngine::getMsgSubType(int messageId)
+{
+ return mConversationMsgStoreHandler->getMsgSubType(messageId);
+}
 
 
 //EOF
--- a/messagingapp/msgui/appengine/src/conversationsengine_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengine_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,6 +26,7 @@
 #include "conversationsmodel.h"
 #include "conversationchangehandler.h"
 #include "conversationlistchangehandler.h"
+#include "debugtraces.h"
 
 //---------------------------------------------------------------
 // ConversationsEnginePrivate::ConversationsEnginePrivate
@@ -50,28 +51,31 @@
 //---------------------------------------------------------------
 ConversationsEnginePrivate::~ConversationsEnginePrivate()
 {
+
+    if( mClientConv )
+    {        
+        if(mServer && mConvChangeHandler)
+        {    
+        TRAP_IGNORE(mServer->RemoveConversationChangeEventL(
+                mConvChangeHandler,mClientConv));
+        }
+        delete mClientConv;
+        mClientConv = NULL;
+    }
+    if(mServer && mConvListChangeHandler)
+    {
+        TRAP_IGNORE(mServer->RemoveConversationListChangeEventL(
+                mConvListChangeHandler));
+        TRAP_IGNORE(mServer->RemoveResultsEventL ( this ));
+        mServer->Cancel();
+        delete mServer;
+        mServer = NULL;
+    }
+    
     delete mConvChangeHandler;
     
     delete mConvListChangeHandler;
     
-    if( mClientConv )
-    {        
-        if(mServer)
-        {    
-        mServer->RemoveConversationChangeEventL (mConvChangeHandler,
-            mClientConv);
-        }
-        delete mClientConv;
-        mClientConv = NULL;
-    }
-    if(mServer)
-    {
-        mServer->RemoveConversationListChangeEventL (mConvListChangeHandler);
-        mServer->RemoveResultsEventL ( this );
-        mServer->Cancel();
-        delete mServer;
-        mServer = NULL;
-    }
 }
 
 //---------------------------------------------------------------
@@ -113,6 +117,7 @@
 {	
     if(!mClientConv)
     {
+        QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL start.");
         //Clear the model before issueing fetch
         mConversationsModel->clear();
         //create a client conversation
@@ -120,12 +125,15 @@
         mClientConv->SetConversationEntryId(aConversationId);
         //set dummy entry
         CCsConversationEntry *entry = CCsConversationEntry::NewL();
-		CleanupStack::PushL(entry);
+        CleanupStack::PushL(entry);
         mClientConv->SetConversationEntryL(entry);
-		CleanupStack::PopAndDestroy(entry);
+        CleanupStack::PopAndDestroy(entry);
         //Get the conversations for new conversationId 
-        mServer->GetConversationsL( mClientConv ); 
-    }   
+        mServer->GetConversationsL(mClientConv);
+
+        QCRITICAL_WRITE("ConversationsEnginePrivate::getConversationsL end.");
+        }   
+    
 }
 
 //---------------------------------------------------------------
@@ -213,6 +221,14 @@
     return convId;
 }
 
+//---------------------------------------------------------------
+// ConversationsEnginePrivate::getConversationFromConversationId
+// @see header
+//---------------------------------------------------------------
+CCsClientConversation* ConversationsEnginePrivate::getConversationFromConversationIdL(TInt aConversationId)
+{
+     return mServer->GetConversationFromConversationIdL(aConversationId);
+}
 
 //---------------------------------------------------------------
 // ConversationsEnginePrivate::clearConversationsL
@@ -220,18 +236,24 @@
 //---------------------------------------------------------------
 void ConversationsEnginePrivate::clearConversationsL()
 {    
+    QCRITICAL_WRITE("ConversationsEnginePrivate::clearConversationsL start.");
+    
     mConvChangeHandler->Cancel();
     //Clear conversations model before populating with new data 
-    mConversationsModel->clear();  
+    mConversationsModel->clearModel();
     
     // Delete old CCsClientConversation object 
     // Remove the old Conversation change observer
     if(mClientConv)
-    {    
-        mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv);
+    {   
+        int error = KErrNone;
+        TRAP(error, mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv));
         delete mClientConv;
         mClientConv = NULL;
+        User::LeaveIfError(error);
     }
+    
+    QCRITICAL_WRITE("ConversationsEnginePrivate::clearConversationsL end.");
 }
 
 //---------------------------------------------------------------
@@ -248,6 +270,30 @@
 }
 
 //---------------------------------------------------------------
+// ConversationsEnginePrivate::deRegisterCVUpdatesTemporary
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::deRegisterCVUpdatesTemporary()
+{
+    mServer->RemoveConversationChangeEventL (mConvChangeHandler ,mClientConv);
+}
+
+//---------------------------------------------------------------
+// ConversationsEnginePrivate::registerAgainForConversationUpdatesL
+// @see header
+//---------------------------------------------------------------
+void ConversationsEnginePrivate::registerAgainForConversationUpdatesL(
+        int newConversationId)
+{
+    //Add the Conversation Change for new  conversationId
+    if(mClientConv)
+    {    
+    mClientConv->SetConversationEntryId(newConversationId);
+    mServer->RequestConversationChangeEventL (mConvChangeHandler ,mClientConv);
+    }
+}
+
+//---------------------------------------------------------------
 // ConversationsEnginePrivate::ConversationList
 // @see header
 //---------------------------------------------------------------
@@ -267,10 +313,14 @@
     RPointerArray<CCsConversationEntry>& aConversationEntryList)
 {
     int error;
-    if(mClientConv)
-    {    
+    if (mClientConv)
+        {
+        QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations start.");
+
         TRAP(error,mConvChangeHandler->ConversationsL(aConversationEntryList));
-    }
+
+        QCRITICAL_WRITE("ConversationsEnginePrivate::Conversations end.");
+        }
 }
 
 
@@ -280,9 +330,9 @@
 //---------------------------------------------------------------
 void ConversationsEnginePrivate::fetchMoreConversations()
 {
-    if(mClientConv)
-        {    
-            mConvChangeHandler->restartHandleConversations();
+    if (mClientConv)
+        {
+        mConvChangeHandler->restartHandleConversations();
         }
 }
 
--- a/messagingapp/msgui/appengine/src/conversationsengineutility.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsengineutility.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,7 @@
 #include <qversitreader.h>
 #include <qtcontacts.h>
 #include <qmobilityglobal.h>
-#include <senduiconsts.h>
+#include <SendUiConsts.h>
 
 #include "conversationsengineutility.h"
 #include "convergedmessage.h"
@@ -47,6 +47,7 @@
     case ECsProvisioning:
     case ECsBioMsg_VCard:
     case ECsBioMsg_VCal:
+    case ECsBioMgs_NokiaService:
         mMessageType = ConvergedMessage::BioMsg;
         break;
     case ECsBlueTooth:
@@ -112,6 +113,9 @@
     case ECsAudio:
         messageSubType = ConvergedMessage::Audio;
         break;
+    case ECsBioMgs_NokiaService:
+        messageSubType = ConvergedMessage::NokiaService;
+        break;
     default:
         messageSubType = ConvergedMessage::None;
         break;
@@ -119,40 +123,4 @@
     return messageSubType;
 }
 
-//---------------------------------------------------------------
-// ConversationsEngineUtility::getVcardDisplayName
-// @see header
-//---------------------------------------------------------------
-QString ConversationsEngineUtility::getVcardDisplayName(QString filePath)
-{
-    QString displayName;
-    //open file for parsing
-    QFile file(filePath);
-    if (!file.open(QIODevice::ReadOnly)) {
-        return displayName;
-    }
-    // parse contents
-    QVersitReader reader;
-    reader.setDevice(&file);
-    if (reader.startReading()) {
-        if (reader.waitForFinished()) {
-            QList<QVersitDocument> versitDocuments = reader.results();
-            // Use the resulting document
-            if (versitDocuments.count() > 0) {
-                QVersitContactImporter importer;
-                QList<QContact> contacts = importer.importContacts(versitDocuments);
-                // get display-name
-                if (contacts.count() > 0) {
-                    QContactManager* contactManager = new QContactManager("symbian");
-                    displayName = contactManager->synthesizedDisplayLabel(contacts[0]);
-                    delete contactManager;
-                }
-            }
-        }
-    }
-    file.close();
-
-    return displayName;
-}
-
 // End of file
--- a/messagingapp/msgui/appengine/src/conversationsmodel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationsmodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,24 +19,57 @@
 #include "conversationsenginedefines.h"
 #include "conversationmsgstorehandler.h"
 #include "convergedmessage.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "conversationsengineutility.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
+#include "ringbc.h"
+#include "msgcontacthandler.h"
+#include "mmsconformancecheck.h"
 #include <ccsconversationentry.h>
+#include <fileprotectionresolver.h>
+
+#include "debugtraces.h"
+
 #include <QFile>
 #include <QFileInfo>
+#include <s32mem.h>
+#include <s32strm.h>
+#include <fbs.h>
+#include <ccsdefs.h>
 
-// LOCAL CONSTANTS
+//CONSTANTS
+_LIT(KDbFileName, "c:[2002A542]conversations.db");
+
+// preview sql query
+_LIT(KSelectConvMsgsStmt, "SELECT message_id, msg_processingstate, subject, body_text, preview_path, msg_property, preview_icon FROM conversation_messages WHERE message_id=:message_id ");
 
+//selecet preview-icon query
+_LIT(KSelectPreviewIconStmt,"SELECT  message_id, preview_icon FROM conversation_messages WHERE message_id = :message_id ");
+
+// preview-cache max cost (items)
+const int CACHE_COST =  50;
+//Preview thumbnail size
+const int KWidth = 9.5 * 6.7;
+const int KHeight = 9.5 * 6.7;
 //---------------------------------------------------------------
 // ConversationsModel::ConversationsModel
 // Constructor
 //---------------------------------------------------------------
 ConversationsModel::ConversationsModel(ConversationMsgStoreHandler* msgStoreHandler,
     QObject* parent) :
-    QStandardItemModel(parent), mMsgStoreHandler(msgStoreHandler)
+    QStandardItemModel(parent), mMsgStoreHandler(msgStoreHandler), iSqlDbOpen(EFalse)
 {
+    //Open SQL DB
+    if (KErrNone == iSqlDb.Open(KDbFileName))
+    {
+        iSqlDbOpen = ETrue;
+    }
+    previewIconCache.setMaxCost(CACHE_COST);
+
+    int err = connect(this, SIGNAL(retrievePreviewIcon(int, QString&)), this,
+        SLOT(updatePreviewIcon(int, QString&)));
+    QCRITICAL_WRITE_FORMAT("Error from connect()", err)
     iDataModelPluginLoader = new UniDataModelLoader;
     iMmsDataPlugin = iDataModelPluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
     iBioMsgPlugin = iDataModelPluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
@@ -48,6 +81,12 @@
 //---------------------------------------------------------------
 ConversationsModel::~ConversationsModel()
 {
+    //Close SQL-DB
+    iSqlDb.Close();
+
+	//clear preview-cache
+    previewIconCache.clear();
+
     if (iDataModelPluginLoader) {
         delete iDataModelPluginLoader;
         iDataModelPluginLoader = NULL;
@@ -128,6 +167,13 @@
         value = item->data(SendingState);
         break;
     }
+    case PreviewIcon:
+    {
+        QString filepath(item->data(Attachments).toString());
+        int msgId = item->data(ConvergedMsgId).toInt();
+        HbIcon *icon = getPreviewIconItem(msgId, filepath);
+        return *icon;
+    }
     case MessagePriority:
     {
         value = item->data(MessagePriority);
@@ -160,7 +206,7 @@
     }
     case DisplayName: // Fall through start
         value = item->data(DisplayName);
-        break;    
+        break;
     case Avatar: // Fall througn end
         value = item->data(Avatar);
         break;
@@ -244,6 +290,8 @@
 //---------------------------------------------------------------
 void ConversationsModel::populateItem(QStandardItem& item, const CCsConversationEntry& entry)
 {
+    QCRITICAL_WRITE("ConversationsModel::populateItem start.");
+
     int msgId = entry.EntryId();
     // id
     item.setData(msgId, ConvergedMsgId);
@@ -252,10 +300,10 @@
     HBufC* description = entry.Description();
     QString subject("");
     if (description && description->Length()) {
-        subject = (S60QConversions::s60DescToQString(*description));     
+        subject = (XQConversions::s60DescToQString(*description));     
     }
 
-    // time stamp 
+    // time stamp
     TTime unixEpoch(KUnixEpoch);
     TTimeIntervalSeconds seconds;
     TTime timeStamp(entry.TimeStamp());
@@ -265,7 +313,7 @@
     //contact details
     HBufC* contact = entry.Contact();
     if (contact && contact->Length()) {
-        item.setData(S60QConversions::s60DescToQString(*contact), ConversationAddress);
+        item.setData(XQConversions::s60DescToQString(*contact), ConversationAddress);
     }
 
     // message type.
@@ -302,9 +350,11 @@
         item.setData(ConvergedMessage::Outbox, MessageLocation);
     }
 
-    //message specific handling    
+    //message specific handling
     if (msgType == ConvergedMessage::Mms) {
+        QCRITICAL_WRITE("ConversationsModel::populateItem  MMS start.")
         handleMMS(item, entry);
+        QCRITICAL_WRITE("ConversationsModel::populateItem MMS end.")
     }
     else if(msgType == ConvergedMessage::MmsNotification) {
         item.setData(subject, Subject);
@@ -320,54 +370,282 @@
         // sms bodytext
         item.setData(subject, BodyText);
     }
+
+    QCRITICAL_WRITE("ConversationsModel::populateItem end.");
 }
 
 //---------------------------------------------------------------
+// ConversationsModel::validateMsgForForward
+// @see header file
+//---------------------------------------------------------------
+bool ConversationsModel::validateMsgForForward(qint32 messageId)
+{
+    bool retValue = true;
+    //Validate if the mms msg can be forwarded or not
+    MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;
+    retValue = mmsConformanceCheck->validateMsgForForward(messageId);
+
+    delete mmsConformanceCheck;
+    return retValue;
+}
+
+
+//---------------------------------------------------------------
 // ConversationsModel::handleMMS
 // @see header
 //---------------------------------------------------------------
 void ConversationsModel::handleMMS(QStandardItem& item, const CCsConversationEntry& entry)
 {
-    iMmsDataPlugin->setMessageId(entry.EntryId());
-    if (iMmsDataPlugin->attachmentCount() > 0) {
-        item.setData(ConvergedMessage::Attachment, MessageProperty);
-    }
+    //msg_id
+    int msgId = entry.EntryId();
+
+    bool isEntryInDb = false;
+    TInt err = KErrNone;
+
+    //check if db is open and query db
+    if (iSqlDbOpen)
+    {
+        RSqlStatement sqlSelectStmt;
+        err = sqlSelectStmt.Prepare(iSqlDb, KSelectConvMsgsStmt);
+
+        // move to fallback option
+        if (KErrNone == err)
+            {
+            TInt msgIdIndex = sqlSelectStmt.ParameterIndex(_L(":message_id"));
+            TInt msgProcessingStateIndex = sqlSelectStmt.ColumnIndex(_L("msg_processingstate"));
+            TInt subjectIndex = sqlSelectStmt.ColumnIndex(_L("subject"));
+            TInt bodyIndex = sqlSelectStmt.ColumnIndex(_L("body_text"));
+            TInt previewPathIndex = sqlSelectStmt.ColumnIndex(
+                    _L("preview_path"));
+            TInt msgpropertyIndex = sqlSelectStmt.ColumnIndex(
+                _L("msg_property"));
+            TInt previewIconIndex = sqlSelectStmt.ColumnIndex(
+                _L("preview_icon"));
+
+            err = sqlSelectStmt.BindInt(msgIdIndex, msgId);
+
+            // populate item
+            if ((KErrNone == err) && (sqlSelectStmt.Next() == KSqlAtRow))
+                {
+                int msgProcessingState = 0;
+                msgProcessingState = sqlSelectStmt.ColumnInt(
+                        msgProcessingStateIndex);
+                if (msgProcessingState == EPreviewMsgProcessed)
+                    {
+                    // use entry to populate model only when,
+                    // entry is present in DB and its processing is over.
+                    RBuf subjectBuffer;
+                    subjectBuffer.Create(sqlSelectStmt.ColumnSize(
+                            subjectIndex));
+                    sqlSelectStmt.ColumnText(subjectIndex, subjectBuffer);
+
+                    item.setData(XQConversions::s60DescToQString(
+                            subjectBuffer), Subject);
+                    subjectBuffer.Close();
+
+                    RBuf bodyBuffer;
+                    bodyBuffer.Create(sqlSelectStmt.ColumnSize(bodyIndex));
+                    sqlSelectStmt.ColumnText(bodyIndex, bodyBuffer);
+
+                    item.setData(
+                            XQConversions::s60DescToQString(bodyBuffer),
+                            BodyText);
+                    bodyBuffer.Close();
+
+                    RBuf previewPathBuffer;
+                    previewPathBuffer.Create(sqlSelectStmt.ColumnSize(
+                            previewPathIndex));
+                    sqlSelectStmt.ColumnText(previewPathIndex,
+                            previewPathBuffer);
+
+                    //Rightnow set inside attachments
+                    QString attachmentPath(XQConversions::s60DescToQString(
+                            previewPathBuffer));
+
+                    item.setData(attachmentPath, Attachments);
+                    previewPathBuffer.Close();
+
+                    int msgProperty = 0;
+                    msgProperty = sqlSelectStmt.ColumnInt(msgpropertyIndex);
+                    item.setData(msgProperty, MessageProperty);
+
+                    RSqlColumnReadStream stream;
+                    //Get data from binary column BLOB
+                    TInt err = stream.ColumnBinary(sqlSelectStmt,
+                            previewIconIndex);
+
+                    QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err)
 
-    int slideCount = iMmsDataPlugin->slideCount();
-    bool isBodyTextSet = false;
-    QString textContent;
-    QStringList attachmentPaths;
+                    if (err == KErrNone)
+                        {
+                        CFbsBitmap *bitmap = new CFbsBitmap;
+                        TRAPD(err,bitmap->InternalizeL(stream));
+                        QCRITICAL_WRITE_FORMAT("Error from bitmap InternalizeL()", err)
+
+                        //convert bitmap to pixmap
+                        if (err == KErrNone)
+                            {
+                            TSize size = bitmap->SizeInPixels();
+                            int bytesPerLine = bitmap->ScanLineLength(
+                                    size.iWidth, bitmap->DisplayMode());
+                            const uchar* dataPtr =
+                                    (const uchar*) bitmap->DataAddress();
+
+                            QPixmap pixmap = QPixmap::fromImage(QImage(
+                                    dataPtr, size.iWidth, size.iHeight,
+                                    bytesPerLine, QImage::Format_RGB16));
+
+                            setPreviewIcon(pixmap, attachmentPath, msgId,
+                                    true);
+
+                            }
+                        //remove bitmap
+                        delete bitmap;
+                        }
+
+                    //set flag to disable fallback option
+                    isEntryInDb = true;
+                    }
+                }
+            }
+        sqlSelectStmt.Close();
+        }
 
-    for (int i = 0; i < slideCount; ++i) {
-        UniMessageInfoList objectList = iMmsDataPlugin->slideContent(i);
-        for (int index = 0; index < objectList.count(); ++index) {
-            attachmentPaths.append(objectList[index]->path());
-            if (!isBodyTextSet && objectList[index]->mimetype().contains("text")) {
-                QFile file(objectList[index]->path());
-                if(file.open(QIODevice::ReadOnly))
+    //fallback option incase of db operation failure or enry not found in DB
+    //populate from data plugins
+    if (!isEntryInDb || err != KErrNone)
+    {
+        int id = iMmsDataPlugin->setMessageId(entry.EntryId());
+        if(id <= 0)
+        {
+            // skip all
+            return;
+        }
+        int msgProperty = 0;
+
+        if (iMmsDataPlugin->attachmentCount() > 0)
+        {
+            msgProperty |= EPreviewAttachment;
+        }
+
+        if(validateMsgForForward(entry.EntryId()))
+        {
+            msgProperty |= EPreviewForward;
+        }
+
+        //subject
+        item.setData(iMmsDataPlugin->subject(), Subject);
+
+        int slideCount = iMmsDataPlugin->slideCount();
+        bool isBodyTextSet = false;
+        bool isAudioSet = false;
+        bool isImageSet = false;
+        bool isVideoSet = false;
+        QString textContent;
+        QString videoPath;
+        QString imagePath;
+
+        for (int i = 0; i < slideCount; ++i)
+        {
+            UniMessageInfoList objectList = iMmsDataPlugin->slideContent(i);
+            for (int index = 0; index < objectList.count(); ++index)
+            {
+                if (!isBodyTextSet && objectList[index]->mimetype().contains(
+                    "text"))
                 {
+                    QFile file(objectList[index]->path());
+                    file.open(QIODevice::ReadOnly);
                     textContent = file.readAll();
                     item.setData(textContent, BodyText);
                     isBodyTextSet = true;
                     file.close();
                 }
+                if (!isVideoSet && !isImageSet && objectList[index]->mimetype().contains(
+                    "image"))
+                {
+                    isImageSet = true;
+                    msgProperty |= EPreviewImage;
+                    if (objectList[index]->isProtected())
+                    {
+                        msgProperty |= EPreviewProtectedImage;
+                    }
+                    if (objectList[index]->isCorrupted())
+                    {
+                        msgProperty |= EPreviewCorruptedImage;
+                    }
+                    imagePath = objectList[index]->path();
+                }
+                if (!isVideoSet && !isAudioSet && objectList[index]->mimetype().contains(
+                    "audio"))
+                {
+                    msgProperty |= EPreviewAudio;
+                    if (objectList[index]->isProtected())
+                    {
+                        msgProperty |= EPreviewProtectedAudio;
+                    }
+                    if (objectList[index]->isCorrupted())
+                    {
+                        msgProperty |= EPreviewCorruptedAudio;
+                    }
+                    isAudioSet = true;
+                }
+                if (!( isImageSet || isAudioSet) && !isVideoSet && objectList[index]->mimetype().contains(
+                    "video"))
+                {
+                    isVideoSet = true;
+                    msgProperty |= EPreviewVideo;
+                    if (objectList[index]->isProtected())
+                    {
+                        msgProperty |= EPreviewProtectedVideo;
+                    }
+                    if (objectList[index]->isCorrupted())
+                    {
+                        msgProperty |= EPreviewCorruptedVideo;
+                    }
+                    videoPath = objectList[index]->path();
+                }
+            }
+            foreach(UniMessageInfo* slide,objectList)
+                {
+                    delete slide;
+                }
+        }
+        QPixmap pixmap;
+        //populate item  with the attachment list
+        //TODO: This code is not required bcoz video icon is show and not preview  
+        if (isVideoSet)
+        {
+            item.setData(videoPath, Attachments);
+            // Store thumbnail only for non protected, non corrupted content.
+            if (!(EPreviewProtectedVideo & msgProperty) &&
+                !(EPreviewCorruptedVideo & msgProperty))
+            {
+                setPreviewIcon(pixmap, videoPath, msgId, false);
             }
         }
-        foreach(UniMessageInfo* slide,objectList)
+        else if (isImageSet)
+        {
+            item.setData(imagePath, Attachments);
+            // Store thumbnail only for non protected, non corrupted content.
+            if (!(EPreviewProtectedImage & msgProperty) &&
+                !(EPreviewCorruptedImage & msgProperty))
             {
-                delete slide;
+                setPreviewIcon(pixmap, imagePath, msgId, false);
             }
+        }
+        //populate msgProperty
+        item.setData(msgProperty, MessageProperty);
     }
-    //populate item  with the attachment list
-    item.setData(attachmentPaths.join("|"), Attachments);
-    if (entry.IsAttributeSet(ECsAttributeHighPriority)) {
+
+    // fill other attributes
+    if (entry.IsAttributeSet(ECsAttributeHighPriority))
+    {
         item.setData(ConvergedMessage::High, MessagePriority);
     }
-    else if (entry.IsAttributeSet(ECsAttributeLowPriority)) {
+    else if (entry.IsAttributeSet(ECsAttributeLowPriority))
+    {
         item.setData(ConvergedMessage::Low, MessagePriority);
     }
-    //subject
-    item.setData(iMmsDataPlugin->subject(), Subject);
 }
 
 //---------------------------------------------------------------
@@ -378,27 +656,33 @@
     const CCsConversationEntry& entry)
 {
     // set context to current entry
-    mMsgStoreHandler->setNotificationMessageId(entry.EntryId());
-    
+    TRAPD(err, mMsgStoreHandler->setNotificationMessageIdL(entry.EntryId()));
+    if(err != KErrNone)
+    {
+        return;
+    }
+
     // fetch relevent info to show in CV
     // msg size
-    QString estimatedMsgSizeStr = 
-            mMsgStoreHandler->NotificationMsgSize();
-    
+    QString estimatedMsgSizeStr = QString("%1").arg(0);
+    estimatedMsgSizeStr.append(" Kb");
+    TRAP_IGNORE(estimatedMsgSizeStr =
+            mMsgStoreHandler->NotificationMsgSizeL());
+
     // msg class type
     QString classInfoStr = mMsgStoreHandler->NotificationClass();
-    
+
     // notification expiry date
     //TODO: Need to do localization of digits used to show expiry time
     TTime expiryTime;
     QString expiryTimeStr;
     mMsgStoreHandler->NotificationExpiryDate(expiryTime, expiryTimeStr);
-    
+
     // notification state e.g. waiting, retrieving etc
     QString statusStr;
     int status;
     mMsgStoreHandler->NotificationStatus(status, statusStr);
-    
+
     // create data for bodytext role
     QString dataText;
     dataText.append("Size: "); // TODO: use logical str name
@@ -437,7 +721,7 @@
 {
     //TODO, needs to be revisited again, once BT team provides the solution for
     //BT received as Biomsg issue.
-    QString description = S60QConversions::s60DescToQString(*(entry.Description()));
+    QString description = XQConversions::s60DescToQString(*(entry.Description()));
 
     if (description.contains(".vcf") || description.contains(".ics")) // "vCard"
     {
@@ -445,10 +729,11 @@
         item.setData(ConvergedMessage::VCard, MessageSubType);
 
         //parse vcf file to get the details
-        QString displayName = ConversationsEngineUtility::getVcardDisplayName(description);
+        QString displayName = MsgContactHandler::getVCardDisplayName(
+                description);
         item.setData(displayName, BodyText);
-    }    
-    else 
+    }
+    else
     {
         if (description.contains(".vcs")) // "vCalendar"
         {
@@ -482,8 +767,11 @@
             QString attachmentPath = attList[0]->path();
 
             //get display-name and set as bodytext
-            QString displayName = ConversationsEngineUtility::getVcardDisplayName(attachmentPath);
+            QString displayName =
+                    MsgContactHandler::getVCardDisplayName(
+                            attachmentPath);
             item.setData(displayName, BodyText);
+            item.setData(attachmentPath, Attachments);
 
             // clear attachement list : its allocated at data model
             while (!attList.isEmpty()) {
@@ -494,15 +782,198 @@
     else if (ConvergedMessage::VCal == msgSubType) {
         //not supported
     }
+    else if (ConvergedMessage::RingingTone == msgSubType) {
+        if (iBioMsgPlugin->attachmentCount() > 0) {
+            UniMessageInfoList attList = iBioMsgPlugin->attachmentList();
+            QString attachmentPath = attList[0]->path();
+
+            //get tone title, and set as bodytext
+            RingBc ringBc;
+            item.setData(ringBc.toneTitle(attachmentPath), BodyText);
+            while (!attList.isEmpty()) {
+                delete attList.takeFirst();
+            }
+        }
+
+    }
     else {
         // description
         HBufC* description = entry.Description();
         QString subject("");
         if (description && description->Length()) {
-            subject = (S60QConversions::s60DescToQString(*description));
+            subject = (XQConversions::s60DescToQString(*description));
             item.setData(subject, BodyText);
         }
     }
 }
 
+//---------------------------------------------------------------
+// ConversationsModel::getDBHandle()
+// @see header
+//---------------------------------------------------------------
+RSqlDatabase& ConversationsModel::getDBHandle(TBool& isOpen)
+{
+    isOpen = iSqlDbOpen;
+    return iSqlDb;
+}
+
+//---------------------------------------------------------------
+// ConversationsModel::setPreviewIcon()
+// @see header
+//---------------------------------------------------------------
+void ConversationsModel::setPreviewIcon(QPixmap& pixmap, QString& filePath,
+    int msgId, bool inDb)
+{
+
+    //Since the population happens in reverse this check is needed so that
+    //most recent items have their icons present in cache
+    if (previewIconCache.totalCost() >= previewIconCache.maxCost())
+        return;
+
+    // if not found in db, set from file path
+    if (!inDb)
+    {
+        QPixmap pixmap(filePath);
+        QPixmap scaledPixmap = pixmap.scaled(KWidth, KHeight, Qt::IgnoreAspectRatio);
+        HbIcon *previewIcon = new HbIcon(scaledPixmap);
+
+        previewIconCache.insert(msgId, previewIcon);
+
+    }
+    else
+    {
+        HbIcon *previewIcon = new HbIcon(pixmap);
+        previewIconCache.insert(msgId, previewIcon);
+    }
+}
+
+//---------------------------------------------------------------
+// ConversationsModel::getPreviewIconItem()
+// @see header
+//---------------------------------------------------------------
+HbIcon* ConversationsModel::getPreviewIconItem(int msgId,
+    QString& filepath) const
+{
+    QCRITICAL_WRITE("ConversationsModel::getPreviewIconItem start.")
+
+    //Initialize icon from the Cache will be NULL if Item not present
+    HbIcon* previewIcon = previewIconCache[msgId];
+    if (!previewIcon)
+    {
+        //This is done in this way as non-const function call cant be done here
+        emit retrievePreviewIcon(msgId, filepath);
+
+        previewIcon = previewIconCache[msgId];
+    }
+
+    QCRITICAL_WRITE("ConversationsModel::getPreviewIconItem start.")
+
+    return previewIcon;
+}
+
+//---------------------------------------------------------------
+// ConversationsModel::updatePreviewIcon()
+// @see header
+//---------------------------------------------------------------
+void ConversationsModel::updatePreviewIcon(int msgId, QString& filePath)
+{
+    QCRITICAL_WRITE("ConversationsModel::updatePreviewIcon start.")
+
+    //sql query to get preview-icon from DB
+    bool imagePreviewed = false;
+    QPixmap pixmap;
+
+    if (iSqlDbOpen)
+    {
+        RSqlStatement sqlSelectPreviewIconStmt;
+        TInt err = sqlSelectPreviewIconStmt.Prepare(iSqlDb,
+            KSelectPreviewIconStmt);
+
+        QCRITICAL_WRITE_FORMAT("Error from Prepare()", err)
+
+        if (err == KErrNone)
+        {
+            //msg_id
+            TInt msgIdIndex = sqlSelectPreviewIconStmt.ParameterIndex(
+                _L(":message_id"));
+            sqlSelectPreviewIconStmt.BindInt(msgIdIndex, msgId);
+
+            // get preview-icon from DB
+            err = sqlSelectPreviewIconStmt.Next();
+            QCRITICAL_WRITE_FORMAT("Error from Next()", err)
+
+            if (err == KSqlAtRow)
+            {
+                TInt previewIconIndex = sqlSelectPreviewIconStmt.ColumnIndex(
+                    _L("preview_icon"));
+
+                RSqlColumnReadStream stream;
+
+                //Get data from binary column BLOB
+                err = stream.ColumnBinary(sqlSelectPreviewIconStmt,
+                    previewIconIndex);
+
+                QCRITICAL_WRITE_FORMAT("Error from ColumnBinary()", err)
+
+                if (err == KErrNone)
+                {
+                    CFbsBitmap *bitmap = new CFbsBitmap;
+                    TRAPD(err,bitmap->InternalizeL(stream));
+                    QCRITICAL_WRITE_FORMAT("Error from bitmap InternalizeL()", err)
+
+                    //convert bitmap to pixmap
+                    if (err == KErrNone)
+                    {
+                        TSize size = bitmap->SizeInPixels();
+                        int bytesPerLine = bitmap->ScanLineLength(size.iWidth,
+                            bitmap->DisplayMode());
+                        const uchar* dataPtr =
+                                (const uchar*) bitmap->DataAddress();
+
+                        pixmap = QPixmap::fromImage(QImage(dataPtr,
+                            size.iWidth, size.iHeight, bytesPerLine,
+                            QImage::Format_RGB16));
+
+                        imagePreviewed = true;
+
+                        QCRITICAL_WRITE("Bitmap Conversion completed")
+                    }
+                    //remove bitmap
+                    delete bitmap;
+                }
+                //close stream
+                stream.Close();
+            }
+        }
+        sqlSelectPreviewIconStmt.Close();
+    }
+
+    // if not found in db, set from file path
+    if (!imagePreviewed)
+    {
+        QPixmap orgPixmap(filePath);
+        pixmap = orgPixmap.scaled(63.65, 63.65, Qt::IgnoreAspectRatio);
+    }
+    HbIcon * previewIcon = new HbIcon(pixmap);
+
+    previewIconCache.insert(msgId, previewIcon);
+
+    QCRITICAL_WRITE("ConversationsModel::updatePreviewIcon end.")
+
+}
+
+//---------------------------------------------------------------
+// ConversationsModel::clearModel()
+// @see header
+//---------------------------------------------------------------
+void ConversationsModel::clearModel()
+{
+    clear();
+    previewIconCache.clear();
+}
+
+void ConversationsModel:: emitConversationViewEmpty()
+{
+    emit conversationViewEmpty();
+}
 //EOF
--- a/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/conversationssummarymodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,10 +18,13 @@
 #include "conversationssummarymodel.h"
 #include "conversationsenginedefines.h"
 #include "conversationsengineutility.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "convergedmessage.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
+#include "ringbc.h"
+#include "msgcontacthandler.h"
+#include "debugtraces.h"
 
 #include <ccsclientconversation.h>
 #include <ccsconversationentry.h>
@@ -35,6 +38,8 @@
 ConversationsSummaryModel::ConversationsSummaryModel(QObject* parent)
 :QStandardItemModel(parent)
     {
+    QStandardItemModel::setSortRole(TimeStamp);
+    QStandardItemModel::sort(0, Qt::DescendingOrder);
     }
 
 //---------------------------------------------------------------
@@ -153,7 +158,7 @@
 // @see header
 //---------------------------------------------------------------
 void ConversationsSummaryModel::addRow(
-        const CCsClientConversation& conversation)
+        const CCsClientConversation& conversation, bool caching)
     {  
     int convId = conversation.GetConversationEntryId();
     
@@ -175,7 +180,12 @@
         QModelIndex index = indexList[0];
         QStandardItem* item = this->item(index.row(), 0);
         populateItem(*item,conversation);
-    }        
+    }  
+    // no need to sort if it is initial caching, as sorting is already done
+    if (!caching)
+        {
+        QStandardItemModel::sort(0, Qt::DescendingOrder);
+        }
     }
 
 //---------------------------------------------------------------
@@ -203,6 +213,8 @@
 void ConversationsSummaryModel::populateItem(QStandardItem& item, 
         const CCsClientConversation& conversation)
     {
+    QCRITICAL_WRITE("ConversationsSummaryModel::populateItem start.");
+            
     //get entry
     CCsConversationEntry* conEntry = conversation.GetConversationEntry(); 
     //error scenario
@@ -239,7 +251,7 @@
         HBufC* body = conEntry->Description();
         if( body && body->Length())
         {     
-            QString bodytext(S60QConversions::s60DescToQString(*body));
+            QString bodytext(XQConversions::s60DescToQString(*body));
             item.setData(bodytext, BodyText); 
             item.setData(bodytext, Subject );
         }
@@ -262,7 +274,7 @@
     //display name
     if(disName && disName->Length())
         {
-        displayName = S60QConversions::s60DescToQString(*disName);
+        displayName = XQConversions::s60DescToQString(*disName);
         item.setData(displayName,DisplayName); 
         }
     
@@ -271,7 +283,7 @@
     QString contactNumber("");
     if ( contactno && contactno->Length() )
         {
-        contactNumber = S60QConversions::s60DescToQString(*contactno);                  
+        contactNumber = XQConversions::s60DescToQString(*contactno);                  
         }        
     item.setData(contactNumber, ConversationAddress);
 
@@ -280,7 +292,9 @@
     item.setData(contactId, ContactId);
     
     // unread status        
-    item.setData(conEntry->IsAttributeSet(ECsAttributeUnread),UnReadStatus);      
+    item.setData(conEntry->IsAttributeSet(ECsAttributeUnread),UnReadStatus); 
+    
+    QCRITICAL_WRITE("ConversationsSummaryModel::populateItem start.");
     }
 
 
@@ -293,7 +307,7 @@
 {
     //TODO, needs to be revisited again, once BT team provides the solution for
     //BT received as Biomsg issue.
-    QString description = S60QConversions::s60DescToQString(*(entry.Description()));
+    QString description = XQConversions::s60DescToQString(*(entry.Description()));
 
     if (description.contains(".vcf") || description.contains(".ics")) // "vCard"
     {
@@ -301,7 +315,8 @@
         item.setData(ConvergedMessage::VCard, MessageSubType);
 
         //parse vcf file to get the details
-        QString displayName = ConversationsEngineUtility::getVcardDisplayName(description);
+        QString displayName = MsgContactHandler::getVCardDisplayName(
+                description);
         item.setData(displayName, BodyText);
     }
     else 
@@ -341,7 +356,8 @@
             QString attachmentPath = attList[0]->path();
 
             //get display-name and set as bodytext
-            QString displayName = ConversationsEngineUtility::getVcardDisplayName(attachmentPath);
+            QString displayName = MsgContactHandler::getVCardDisplayName(
+                    attachmentPath);
             item.setData(displayName, BodyText);
 
             // clear attachement list : its allocated at data model
@@ -353,12 +369,43 @@
     else if (ConvergedMessage::VCal == msgSubType) {
         //not supported
     }
-    else {
+    else if (ConvergedMessage::RingingTone == msgSubType) {
+        if (bioMsgPlugin->attachmentCount() > 0) {
+            UniMessageInfoList attList = bioMsgPlugin->attachmentList();
+            QString attachmentPath = attList[0]->path();
+            	
+            //get tone title, and set as bodytext
+            RingBc ringBc;
+            item.setData(ringBc.toneTitle(attachmentPath), BodyText);
+            while (!attList.isEmpty()) {
+                delete attList.takeFirst();
+            }
+        }
+    }
+
+   else if(ConvergedMessage::NokiaService == msgSubType){
+        // This is a bio message so lets parse it and see if it has a associated attachment ..        
+        if (bioMsgPlugin->attachmentCount() > 0) {
+				// TODO : need to confirm if we need to read from attachment
+        }
+        else {// description
+            HBufC* description = entry.Description();
+            QString subject("");
+            if (description && description->Length()) {
+                subject = (XQConversions::s60DescToQString(*description));
+                item.setData(subject, BodyText);
+            }
+
+        }
+
+    }
+
+   else {
         // description
         HBufC* description = entry.Description();
         QString subject("");
         if (description && description->Length()) {
-            subject = (S60QConversions::s60DescToQString(*description));
+            subject = (XQConversions::s60DescToQString(*description));
             item.setData(subject, BodyText);
         }
     }
--- a/messagingapp/msgui/appengine/src/draftsmodel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/appengine/src/draftsmodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,6 @@
 #include "draftsmodel.h"
 #include "conversationsenginedefines.h"
 #include "conversationsengineutility.h"
-#include "s60qconversions.h"
 #include "conversationsengineutility.h"
 
 #include <ccsclientconversation.h>
@@ -26,7 +25,7 @@
 #include <msvstd.h>
 #include <QDateTime>
 #include <hbicon.h>
-
+#include <xqconversions.h>
 //CONSTANTS
 const QString DATE_FORMAT("dd/MM"); //Date format.
 const QString TIME_FORMAT("hh:mm"); //Time format.
@@ -223,7 +222,7 @@
     item.setData(ConversationsEngineUtility::messageType(entry.iMtm.iUid), MessageType);
 
     // description
-    QString Description(S60QConversions::s60DescToQString(entry.iDescription));
+    QString Description(XQConversions::s60DescToQString(entry.iDescription));
     item.setData(Description, Subject);
 
     // time stamp
@@ -234,7 +233,7 @@
     item.setData(seconds.Int(), TimeStamp);
 
     // contact details
-    QString contact(S60QConversions::s60DescToQString(entry.iDetails));
+    QString contact(XQConversions::s60DescToQString(entry.iDetails));
     item.setData(contact, DisplayName);
     
     // Attachments
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationengine.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * 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:
+ *
+ */
+
+#ifndef T_CONVERSATIONENGINE_H_
+#define T_CONVERSATIONENGINE_H_
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT 
+#endif
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+// FORWARD DECLARATIONS
+class TConversationUpdateHandler;
+
+
+class TEST_EXPORT TConversationEngine: public QObject
+{
+    Q_OBJECT
+
+private slots:
+
+    /**
+     * Intializes component for testing
+     */
+    void initTestCase();
+
+    /**
+     * Initilazes the test case data to be executed
+     */
+    void init();
+
+    /**
+     *  Fetches the conversation list from server
+     */
+    void GetConversationsFromServer();
+
+    /**
+     *  Fetches the conversation list and 
+     *  updates conversation view 
+     */
+    void FetchConversationsAndUpdateCV();
+
+    /**
+     *  Checks current conversaton Id 
+     */
+    void CheckCurrentConversationID();
+    
+    /**
+     *  Mark the conversation status read 
+     *  and update conversation view  
+     */
+    void MarkConversationReadAndUpdateCV();
+    
+    /**
+     *  Delete the conversation and 
+     *  update conversation view  
+     */
+    void DeleteConversationAndUpdateCV();
+
+    /**
+     *  Notify new conversation entry and 
+     *  update conversation view  
+     */
+    void NotifyNewConversationEntryAndUpdateCV();
+
+    /**
+     *  Notify recieved conversation client list 
+     *  and update conversation list/summary view  
+     */
+    void NotifyConversationClientListAndUpdateCLV();
+
+    /**
+     *  Get contact details from conversation id 
+     */
+    void GetContactDetailsFromConversationID();
+
+    /**
+     *  Get conversation id from contact ID  
+     */
+    void GetConversationIDFromContatcID();
+
+    /**
+     *  Notify Modified conversation client and update
+     *  conversation summary list/summary view 
+     */
+    void NotifyModifyConversationClientAndUpdateCLV();
+
+    /**
+     *  Notify Deleted conversation client 
+     *  and update conversation list/summary view    
+     */
+    void NotifyDeleteConversationClientAndUpdateCLV();
+
+    /**
+     *  Notify new conversation client 
+     *  and update conversation list/summary view    
+     */
+    void NotifyNewConversationClientAndUpdateCLV();
+
+    /**
+     *  Get conversation id from contact address 
+     */
+    void GetConversationIDFromAddress();
+
+    /**
+     *  Fetch more conversations from server  
+     */
+    void FetchMoreConversations();
+
+    /**
+     *  Clear conversation from conversation view
+     */
+    void ClearConversations();
+
+    /**
+     *  Get drafts model from conversation engine
+     */
+    void GetDraftsModelFromConversationEngine();
+
+    /**
+     * Clean the test case data
+     */
+    void cleanup();
+
+    /**
+     * Delete the initialized component for testing
+     */
+    void cleanupTestCase();
+    
+private:
+    
+    TConversationUpdateHandler* iConvUpdateHandler; 
+};
+#endif /* T_CONVERSATIONENGINE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationenginestub.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,224 @@
+/*
+ * 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:
+ *
+ */
+
+#ifndef T_CONVERSATIONENGINESTUB_H_
+#define T_CONVERSATIONENGINESTUB_H_
+
+// INCLUDES
+#include <e32def.h>
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+class MCsResultsObserver;
+class TestConversationNotifier;
+class CCsConversationEntry;
+class MCsConversationChangeObserver;
+class MCsConversationListChangeObserver;
+class CCsClientConversation;
+
+
+class TestConversationEngineStub {
+
+public:
+    /**
+     * Returns pointer to sole instance.
+     * @return TestConversationEngineStub object
+     */
+    static TestConversationEngineStub* Instance();
+    
+    /**
+     * Destructor
+     */
+    ~TestConversationEngineStub();
+
+public: //stub client related functions for 
+        //handling requests and commands from appengine
+
+    /**
+     * Set result observer
+     */
+    void SetResultObserver(MCsResultsObserver *aResultObserver);
+
+
+    /**
+     * Remove result observer
+     */
+    void RemoveResultObserver();
+    
+    /**
+     * Set conversation change observer
+     */
+    void SetConversationChangeObserver(MCsConversationChangeObserver* aObserver,
+            CCsClientConversation* aClientConversation);
+    
+    /**
+     * Remove conversation change observer
+     */
+    void RemoveConversationChangeObserver();
+    
+    /**
+     * Set conversation list change observer
+     */
+    void SetConversationListChangeObserver(MCsConversationListChangeObserver* 
+                                        aConversationListChangeObserver);
+    
+    /**
+     * Remove conversation list change observer
+     */
+    void RemoveConversationListChangeObserver();
+
+    /**
+     * Mark conversation as read associated with conversation id
+     */
+    void MarkConversationRead(const TInt aConversationId);
+    
+    /**
+     * Delete conversation associated with conversation id
+     */
+    void DeleteConversation(const TInt aConversationId);
+    
+    /**
+     * Get the client conversation id associated with contact id
+     */
+    TInt GetClientConversationID(const TInt aContactId);
+    
+    /**
+     * Get the client conversation id associated with contact address
+     */
+    TInt GetClientConversationID(const TDesC& aContactAddress);
+
+public: //stub notifications to appengine    
+    
+    //Conversation list notification
+    void UpdateConversationList();
+    
+    //Update modified Conversation entry 
+    //to conversation change handler
+    void UpdateConvEntry(TInt aConversationId);
+
+    //Update new added conversation entry 
+    //to conversation change handler
+    void UpdateAddConvEntry();
+    
+    //Update deleted conversation entry 
+    //to conversation change handler
+    void  UpdateDeletedConvEntry();
+    
+    //conversation client list notification
+    void UpdateConversationClientList();
+    
+    //Update new added conversation client 
+    //to conversation list change handler
+    void UpdateAddConvClient();
+    
+    //Update deleted conversation client 
+    //to conversation list change handler
+    void UpdateDeletedConvClient();
+
+    //Update modified conversation client 
+    //to conversation list change handler
+    void UpdateConvClient(TInt aConversationId);
+
+public: //test conversation engine validation functions
+    
+    //Get the conversation list size
+    TInt GetConvListSize();
+    
+    //Get the unread message count
+    TInt GetUnreadCount();
+    
+    //Get the current conversation id
+    TInt GetConversationID();
+    
+    //Get the message time stamp
+    TInt GetTimeStamp();
+
+    //Get the message type
+    TInt GetMsgType();
+
+    //Get the contact id  
+    TDesC& GetContactID();
+ 
+    //Get the message description
+    TDesC& GetDescription();
+    
+    //Get the conversation client list
+    RPointerArray<CCsClientConversation>& GetConversationClientList();
+
+private:
+
+    /**
+     * Constructor
+     */
+    TestConversationEngineStub();
+
+    /**
+     * Initializes the stub data
+     */
+    void InitL();
+
+    /**
+     * Create conversation entry 
+     */
+    CCsConversationEntry* CreateConversationEntryL(TInt aConvID, bool aUnread);
+
+    /**
+     * Prepare conversation list 
+     */
+    void PrepareConversationListL(TInt aConvID, TInt aToatalCnt, TInt aUnreadCnt);
+    
+    /**
+     * Create conversation client 
+     */
+    CCsClientConversation* 
+    CreateConversationClientL(const HBufC* aDispName, TInt aContactID,
+                                            TInt aUnreadCnt,
+                                            CCsConversationEntry& aConvEntry);
+
+    /**
+     * Prepare conversation client list 
+     */
+    void PrepareConversationClientListL(TInt aContactID, TInt aListSize, 
+                                        TInt aUnRead, TInt aUnReadCnt);
+
+    /**
+     * Update added conversation entry 
+     */
+    void UpdateAddConvEntryL();
+    
+    /**
+     * Update added conversation client 
+     */
+    void UpdateAddConvClientL();
+    
+private://Data
+    TestConversationNotifier* iNotifier;
+    
+    //Test Conversation Stub Data
+    TInt iConversationID;
+    TInt iTimeStamp;
+    TInt iMsgType;
+    TInt iUnReadCount;
+    TBufC<12> iContactID;
+    TBufC<30> iDescription;
+    CCsConversationEntry* iDeletedEntry;
+    RPointerArray<CCsConversationEntry> iConversationEntryList;
+    //Test Conversationclient Stub Data
+    RPointerArray<CCsClientConversation> iConversationClientList;
+};
+
+#endif /* T_CONVERSATIONENGINESTUB_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationnotifier.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,99 @@
+/*
+ * 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:
+ *
+ */
+#ifndef T_CONVERSATIONNOTIFIER_H_
+#define T_CONVERSATIONNOTIFIER_H_
+
+// INCLUDES
+#include <e32def.h>
+#include <e32std.h>
+
+//FARWARD DECLARATION
+class MCsResultsObserver;
+class MCsConversationListChangeObserver;
+class CCsConversationChangeObserver;
+class MCsCachingStatusObserver;
+class CCsConversationEntry;
+class CCsClientConversation;
+class MCsConversationChangeObserver;
+
+class TestConversationNotifier {
+
+public:
+    TestConversationNotifier();
+    
+    void SetResultNotifier(MCsResultsObserver* aResultsObserver);
+
+    void RemoveResultNotifier();
+
+    void SetConversationListNotifier(MCsConversationListChangeObserver* aConversationListChangeObserver);
+    
+    void RemoveConversationListNotifier();
+
+    void SetConversationChangeNotifier(MCsConversationChangeObserver* aConversationChangeObserver);
+    
+    void RemoveConversationChangeNotifier();
+
+    void SetCachingStatusNotifier(MCsCachingStatusObserver* aCachingStatusObserver);
+
+    void RemoveCachingStatusNotifier();
+    
+    void SendListResultUpdate(RPointerArray<CCsConversationEntry>& aConversationEntryList);
+    
+    void UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry);
+    
+    void UpdateConversationEntryAdd(CCsConversationEntry& aConversationEntry);
+    
+    void UpdateConversationEntryDelete(CCsConversationEntry& aConversationEntry);
+    
+    void SendClientListUpdate(RPointerArray<CCsClientConversation>& aConversationClientList);
+    
+    void UpdateConversationClientModify(CCsClientConversation& aConversationClient);
+        
+    void UpdateConversationClientAdd(CCsClientConversation& aConversationClient);
+    
+    void UpdateConversationClientDelete(CCsClientConversation& aConversationClient);
+    
+private:
+    /**
+     * iResultsObserver
+     * Observer which handles conversation event from server.
+     * Not Own.
+     */
+    MCsResultsObserver* iResultsObserver;
+
+    /**
+     * iConversationListChangeObserver
+     * Observer which handle conversation list changes.
+     * Not Own.
+     */
+    MCsConversationListChangeObserver* iConversationListChangeObserver;
+
+    /**
+     * iConversationChangeObserver
+     * Observer which handles conversation changes.
+     * Not Own.
+     */
+    MCsConversationChangeObserver*  iConversationChangeObserver;
+
+    /**
+     * iCachingChangeObserver
+     * Observers which handle conversation change events from server.
+     * Not Own.
+     */
+    MCsCachingStatusObserver* iCachingStatusObserver;
+};
+#endif /* T_CONVERSATIONNOTIFIER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/inc/testconversationupdatehandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ *
+ */
+
+#ifndef T_CONVERSATIONUPDATEHANDLER_H_
+#define T_CONVERSATIONUPDATEHANDLER_H_
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+
+class TConversationUpdateHandler : public QObject
+    {
+    Q_OBJECT
+public: 
+
+    /**
+     * Constructor
+     */
+    explicit TConversationUpdateHandler(QObject* parent = 0);    
+
+    /**
+     * Set the conversation view update handler 
+     */
+    void SetConversationsViewUpdateHandler();
+
+    /**
+     * Set the conversation summary view update handler 
+     */
+    void SetConversationsSummaryViewUpdateHandler();
+   
+private slots:
+
+    /**
+     * Validates Conversation view on updation 
+     */
+    void ConversationsViewUpdated();
+
+    /**
+     * Validates Conversation summary view on updation 
+     */
+    void ConversationsSummaryViewUpdated();
+    
+    };
+#endif /* T_CONVERSATIONUPDATEHANDLER_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testccsrequesthandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,521 @@
+/*
+ * 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:
+ *
+ */
+
+
+// INCLUDE FILES
+
+// SYSTEM INCLUDES
+#include <ccsconversationentry.h>
+#include <ccsclientconversation.h>
+#include <mcsresultsobserver.h>
+#include <mcsconversationlistchangeobserver.h>
+#include <mcsconversationchangeobserver.h>
+#include <mcscachingstatusobserver.h>
+#include <ccsrequesthandler.h>
+#include <rcssession.h>
+
+
+//USER INCLUDES
+
+#include "ccsconversationchangeobserver.h"
+#include "testconversationenginestub.h"
+
+// ========================= MEMBER FUNCTIONS ==================================
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::NewL()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+EXPORT_C CCSRequestHandler* CCSRequestHandler::NewL()
+    {
+
+    CCSRequestHandler* self = NewLC( );
+    CleanupStack::Pop( self );
+
+    return( self ) ;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::NewLC()
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+EXPORT_C CCSRequestHandler* CCSRequestHandler::NewLC()
+    {
+
+    CCSRequestHandler* self = new ( ELeave ) CCSRequestHandler();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::CCSAsyncRequestHandler()
+// C++ default constructor can NOT contain any code, that might leave.
+// -----------------------------------------------------------------------------
+CCSRequestHandler::CCSRequestHandler()
+: CActive( EPriorityStandard )
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::ConstructL()
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::ConstructL()
+    {
+    TestConversationEngineStub::Instance();
+    
+    // Observers
+    iResultsObserver = NULL;
+    iCachingStatusObserver = NULL;
+    iConversationListChangeObserver = NULL;
+    iConversationChangeObserver = NULL;
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::~CCSRequestHandler()
+// Destructor.
+// -----------------------------------------------------------------------------
+CCSRequestHandler::~CCSRequestHandler()
+    {
+
+    Cancel(); 
+
+    // Cleanup
+    if ( iBuffer )
+        {
+        delete iBuffer;
+        iBuffer = NULL;
+        }
+   
+    if ( iResultsBuffer )
+        {
+        delete iResultsBuffer;
+        iResultsBuffer = NULL;
+        }
+    
+    if ( iNotificationHandler )
+        {
+        //delete iNotificationHandler;
+        iNotificationHandler = NULL;
+        }
+    
+    if( iListResultsBuffer )
+        {
+        delete iListResultsBuffer;
+        iListResultsBuffer=NULL;
+        }
+    if( iConvResultsBuffer )
+        {
+        delete iConvResultsBuffer;
+        iConvResultsBuffer=NULL;
+        }
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleGetConversationListResults()
+// This shall handle all entry list result from server
+//
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleGetConversationListResults()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleGetConversationResults()
+// This shall handle GetCoversation results async from server
+//
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleGetConversationResults()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleGetEntryListOverflow()
+// Handle the buffer overflow error for get entry list results
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleGetConversationListOverflow()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleGetConversationOverflow()
+// Handle the buffer overflow error for get conversation results
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleGetConversationOverflow()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RequestResultsEventL()
+// Add conversation result Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RequestResultsEventL(
+        MCsResultsObserver* aObserver)
+    {
+    iResultsObserver = aObserver;
+    TestConversationEngineStub::Instance()->SetResultObserver(aObserver);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RemoveResultsEventL()
+// Remove conversation result observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RemoveResultsEventL
+(MCsResultsObserver* /*aObserver*/)
+    {
+    iResultsObserver = NULL;
+    TestConversationEngineStub::Instance()->RemoveResultObserver();
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RequestConversationListChangeEventL()
+// Add conversation list change event Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RequestConversationListChangeEventL(
+        MCsConversationListChangeObserver* aObserver)
+    {
+    iConversationListChangeObserver = aObserver;
+    TestConversationEngineStub::Instance()->SetConversationListChangeObserver(aObserver);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RemoveConversationListChangeEventL()
+// Remove conversation list change event Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RemoveConversationListChangeEventL(
+        MCsConversationListChangeObserver* /*aObserver*/)
+    {
+    iConversationListChangeObserver = NULL;
+    TestConversationEngineStub::Instance()->RemoveConversationListChangeObserver();
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RequestConversationChangeEventL()
+// Add conversation change event Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RequestConversationChangeEventL(
+        MCsConversationChangeObserver* aObserver,
+        CCsClientConversation* aClientConversation)
+    {
+        TestConversationEngineStub::Instance()->SetConversationChangeObserver(aObserver, aClientConversation);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RemoveConversationChangeEventL()
+// Remove conversation change event observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RemoveConversationChangeEventL(
+        MCsConversationChangeObserver* /*aObserver*/,
+        CCsClientConversation* /*aClientConversation*/)
+    {
+
+    if ( iConversationChangeObserver )
+        {
+        TestConversationEngineStub::Instance()->RemoveConversationChangeObserver();
+        delete iConversationChangeObserver;
+        iConversationChangeObserver = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RequestCachingStatusEventL()
+// Add caching status Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RequestCachingStatusEventL(
+        MCsCachingStatusObserver* /*aObserver*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RemoveCachingStatusEventL()
+// Remove caching status Observer
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::RemoveCachingStatusEventL(
+        MCsCachingStatusObserver* /*aObserver*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::RunL()
+// Invoked to handle responses from the server.
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::RunL()
+    { 
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleErrorL()
+// Send the error code to the client.
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleErrorL(TInt /*aErrorCode*/)
+    {
+    // Not supported
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::DoCancel()
+// Cancels any outstanding operation.
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::DoCancel()
+    {
+    // Do nothing
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::Version()
+// Recovers the conversation server version.
+// -----------------------------------------------------------------------------
+EXPORT_C TVersion CCSRequestHandler::Version() const
+    {
+    TVersion ver(1, 2, 3);
+    return (ver);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::ShutdownServerL()
+// Shuts down the conversation server.
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::ShutdownServerL()
+    {
+    //Do nothing
+    return;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationListL()
+// Get Recent Conversation Entry list with display name
+// for all stored conversation entry IDs.
+// This API can be used to prepare conversation list view.
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::GetConversationListL()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationUnreadListL()
+// Get Recent unread Conversation Entry list with display name
+// for all stored conversation entry IDs.
+// This API can be used to prepare conversation list view.
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::GetConversationUnreadListL(RPointerArray<
+        CCsClientConversation>* /*aClientConversationList*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationsL()
+// Get Conversation Entry list for given Conversation Entry ID to prepare
+// convresation view.
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::GetConversationsL(
+        CCsClientConversation*  aClientConversation)
+    {
+    // check if the aclientconversation is null then return
+    if ( !aClientConversation)
+        {
+            User::Leave(KErrArgument);
+        }
+    if (TestConversationEngineStub::Instance()->GetConversationID() 
+                    != aClientConversation->GetConversationEntryId())
+        {
+            User::Leave(KErrNotFound);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetCachingStatusL()
+// Get caching status
+// Synchronous
+// -----------------------------------------------------------------------------
+EXPORT_C TUint8 CCSRequestHandler::GetCachingStatusL()
+    {
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetTotalUnreadCountL()
+// Get total unread count
+// Synchronous
+// -----------------------------------------------------------------------------
+EXPORT_C TUint32 CCSRequestHandler::GetTotalUnreadCountL()
+    {
+    TUint32 unreadCount = 10;
+    return unreadCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleAddConversationList()
+// Process add conversation list event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleAddConversationList(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleDeleteConversationList()
+// Process delete conversation lsit event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleDeleteConversationList(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleModifyConversationList
+// Process modify conversation lsit event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleModifyConversationList(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleAddConversation
+// Process add conversation event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleAddConversation(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleDeleteConversation
+// Process delete conversation event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleDeleteConversation(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleModifyConversation
+// Process Modify conversation event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleModifyConversation(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleCachingStarted
+// Process caching started event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleCachingStarted(HBufC8* /*aResultsBuffer*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleCachingCompleted
+// Process caching completed event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleCachingCompleted(HBufC8* /*aResultsBuffer*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleCachingError
+// Process caching error event received from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleCachingError(HBufC8* /*aResultsBuffer*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::DeleteConversationL()
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::DeleteConversationL(TInt aConversationId)        
+    {
+        TestConversationEngineStub::Instance()->DeleteConversation(aConversationId);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::HandleRefreshConversationList
+// Process refresh from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleRefreshConversationList(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Ccsrequesthandler::HandleRefreshConversationList
+// Process refresh from server
+// -----------------------------------------------------------------------------
+void CCSRequestHandler::HandleRefreshConversation(HBufC8* /*aResultsBuffer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationIdL()
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CCSRequestHandler::GetConversationIdL(TInt aContactId)        
+    {    
+    TInt conversationId = -1;
+    
+    //Get the associated conversation id from the contact id
+    conversationId = TestConversationEngineStub::Instance()->GetClientConversationID(aContactId);
+
+    return conversationId;
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationIdFromAddressL()
+// -----------------------------------------------------------------------------
+EXPORT_C TInt CCSRequestHandler::GetConversationIdFromAddressL(TDesC& aContactAddress)        
+    {    
+    TInt conversationId = -1;
+
+    //Read the conversation id from file with associated contact.
+    conversationId = TestConversationEngineStub::Instance()->GetClientConversationID(aContactAddress);
+    
+    return conversationId;
+    }
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetMessagingHistoryL()
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::GetMessagingHistoryL(TInt /*aContactId*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::GetConversationIdL()
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::ClearMessagingHistoryL(TInt /*aContactId*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::MarkConversationReadL()
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::MarkConversationReadL(TInt aConversationId)        
+    {
+        TestConversationEngineStub::Instance()->MarkConversationRead(aConversationId);
+    }
+
+// -----------------------------------------------------------------------------
+// CCSRequestHandler::MarkMessagingHistoryReadL()
+// -----------------------------------------------------------------------------
+EXPORT_C void CCSRequestHandler::MarkMessagingHistoryReadL(TInt /*aContactId*/)        
+    {
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationengine.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,339 @@
+/*
+ * 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:
+ *
+ */
+
+// INCLUDES
+#include "conversationsengine.h"
+#include "testconversationengine.h"
+#include "testconversationenginestub.h"
+#include "testconversationenginestub.h"
+#include "testconversationupdatehandler.h"
+#include <ccsclientconversation.h>
+#include <ccsconversationentry.h>
+#include <xqconversions.h>
+#include <conversationsenginedefines.h>
+
+
+void TConversationEngine::initTestCase()
+{
+    iConvUpdateHandler = new TConversationUpdateHandler();
+    QVERIFY2(ConversationsEngine::instance() != NULL, "Appengine is not initialized.");
+    QVERIFY2(TestConversationEngineStub::Instance() != NULL, "Appengine Stub is not initialized.");
+    
+}
+
+void TConversationEngine::init()
+{
+    // allocate, setup the neccessary environment for 
+    // current test case to execute 
+}
+
+// fetch the conversations from server
+void TConversationEngine::GetConversationsFromServer()
+{
+    QVERIFY2(ConversationsEngine::instance()->
+            getConversations(TestConversationEngineStub::Instance()->
+                            GetConversationID()), "Get conversations failed");
+}
+
+//fetch the coversation and validate conversation view
+void TConversationEngine::FetchConversationsAndUpdateCV()
+{
+    QVERIFY2(ConversationsEngine::instance()->
+            getConversations(TestConversationEngineStub::Instance()->
+                            GetConversationID()), "Get conversations failed");
+    
+    //should be used once, will work for all the test cases
+    iConvUpdateHandler->SetConversationsViewUpdateHandler();
+    
+    //listen for emitted signal
+    QSignalSpy convListUpdate(ConversationsEngine::instance(), 
+                        SIGNAL(conversationModelPopulated()));
+    
+    // Now we check to make sure we don't have any signals already
+    QCOMPARE( convListUpdate.count(), 0 );
+
+    //update the coversation model and 
+    //wait for active object to execute
+    TestConversationEngineStub::Instance()->UpdateConversationList();
+    QTest::qWait(2000);
+    
+    //conversation engine should have emitted signal
+    QCOMPARE( convListUpdate.count(), 1 );        
+}
+
+//validate the current conversation id
+void TConversationEngine::CheckCurrentConversationID()
+{
+    QVERIFY2((ConversationsEngine::instance()->getCurrentConversationId() 
+            == TestConversationEngineStub::Instance()->GetConversationID()), 
+            "Current conversation id mismatch");
+}
+
+//mark the conversation as read and validate the conversation view
+void TConversationEngine::MarkConversationReadAndUpdateCV()
+{
+    //mark the conversation as read
+    ConversationsEngine::instance()->
+            markConversationRead(TestConversationEngineStub::Instance()->
+                                GetConversationID());
+
+    //listen for emitted signal
+    QSignalSpy convModify(ConversationsEngine::instance(), 
+                        SIGNAL(conversationModelUpdated()));
+    
+    // Now we check to make sure we don't have any signals already
+    QCOMPARE( convModify.count(), 0 );
+
+    // update the conversation view with modified conversation 
+    TestConversationEngineStub::Instance()->
+            UpdateConvEntry(TestConversationEngineStub::Instance()->
+                                GetConversationID());
+    
+    ConversationsEngine::instance()->emitConversationModelUpdated();
+    
+    //conversation engine should have emitted signal
+    QCOMPARE( convModify.count(), 1 );
+}
+
+//delete the conversation and validate updetad conversation view
+void TConversationEngine::DeleteConversationAndUpdateCV()
+{
+    // delete the conversation entry
+    ConversationsEngine::instance()->
+            deleteConversations(TestConversationEngineStub::Instance()->
+                                GetConversationID());
+   
+    //listen for emitted signal
+    QSignalSpy convDelete(ConversationsEngine::instance(), 
+                        SIGNAL(conversationModelUpdated()));
+    
+    // Now we check to make sure we don't have any signals already
+    QCOMPARE( convDelete.count(), 0 );
+    
+    // update the conversation view with deleted entry  
+    TestConversationEngineStub::Instance()->UpdateDeletedConvEntry();
+
+    ConversationsEngine::instance()->emitConversationModelUpdated();
+    
+    //conversation engine should have emitted signal
+    QCOMPARE( convDelete.count(), 1 );
+}
+
+//notify new recieved conversation and validate conversation view
+void TConversationEngine::NotifyNewConversationEntryAndUpdateCV()
+{
+    //listen for emitted signal
+    QSignalSpy convAdd(ConversationsEngine::instance(), 
+                        SIGNAL(conversationModelUpdated()));
+    
+    // Now we check to make sure we don't have any signals already
+    QCOMPARE( convAdd.count(), 0 );
+
+    TestConversationEngineStub::Instance()->UpdateAddConvEntry();
+    
+    //conversation engine should have emitted signal
+    QCOMPARE( convAdd.count(), 1 );
+}
+
+//update conversation client list and validate conversation summary model
+void TConversationEngine::NotifyConversationClientListAndUpdateCLV()
+{
+    //should be used once, will work for all the test cases
+    //set the conversation summary view update handler 
+    iConvUpdateHandler->SetConversationsSummaryViewUpdateHandler();
+
+    //listen for emitted signal
+    QSignalSpy convClientList(ConversationsEngine::instance(), 
+                        SIGNAL(conversationListModelPopulated()));
+    
+    // Now we check to make sure we don't have any signals already
+    QCOMPARE( convClientList.count(), 0 );
+    
+    //update the conversation client list to summary model
+    TestConversationEngineStub::Instance()->UpdateConversationClientList();
+    QTest::qWait(2000);
+    
+    //conversation engine should have emitted signal
+    QCOMPARE( convClientList.count(), 1 );
+}
+
+//get contactt details associated with conversation id
+void TConversationEngine::GetContactDetailsFromConversationID()
+{
+    //get the conversation client list
+    RPointerArray<CCsClientConversation>&  clientList 
+            = TestConversationEngineStub::Instance()->GetConversationClientList();
+    
+    //match the client list with summary model list
+    for (int loop = 0; loop < clientList.Count(); loop++)
+    {
+        CCsClientConversation* clientConv = clientList[loop];
+         
+        qint64 msgId = clientConv->GetConversationEntryId();
+         
+        QString fname;
+        QString address;
+         
+        ConversationsEngine::instance()->
+                getContactDetails(msgId, fname, address);
+         
+        qDebug() << "msgId " << msgId;
+          
+        //check the bunch of converation client details 
+        QCOMPARE(fname,
+               XQConversions::s60DescToQString(
+                       *(clientConv->GetDisplayName())));
+          
+        QCOMPARE(address,
+                XQConversions::s60DescToQString(
+                        *(clientConv->GetConversationEntry()->Contact())));
+    }
+}
+
+// get conversation id associated with contact id
+void TConversationEngine::GetConversationIDFromContatcID()
+{
+    //get the conversation client list
+    RPointerArray<CCsClientConversation>&  clientList 
+            = TestConversationEngineStub::Instance()->GetConversationClientList();
+
+    //match the client list with summary model list
+    for (int loop = 0; loop < clientList.Count(); loop++)
+     {
+         CCsClientConversation* clientConv = clientList[loop];
+         
+         qint64 msgId = clientConv->GetConversationEntryId();
+         
+         qint64 convID = ConversationsEngine::instance()->
+                 getConversationIdFromContactId(clientConv->GetContactId());
+         QCOMPARE(convID, msgId);
+     }
+}
+
+// update the new conversation client to summary view 
+void TConversationEngine::NotifyNewConversationClientAndUpdateCLV()
+{
+    //Add and update new conversation client to summary model
+    TestConversationEngineStub::Instance()->UpdateAddConvClient();
+
+    //emit the signal for validating the summary model
+    ConversationsEngine::instance()->emitConversationListModelPopulated();
+}
+
+//update the modified conversation client
+void TConversationEngine::NotifyModifyConversationClientAndUpdateCLV()
+{
+    //update the modified conversation client to summary model
+    TestConversationEngineStub::Instance()->
+            UpdateConvClient(TestConversationEngineStub::Instance()->GetConversationID());
+    
+    //emit the signal for validating the summary model
+    ConversationsEngine::instance()->emitConversationListModelPopulated();
+}
+
+//update the deleted conversation client
+void TConversationEngine::NotifyDeleteConversationClientAndUpdateCLV()
+{
+    //update the deleted conversation client to summary model
+    TestConversationEngineStub::Instance()->UpdateDeletedConvClient();
+    
+    //emit the signal for validating the summary model
+    ConversationsEngine::instance()->emitConversationListModelPopulated();
+}
+
+//get the conversation id from address
+void TConversationEngine::GetConversationIDFromAddress()
+{
+    //get the conversation client list
+    RPointerArray<CCsClientConversation>&  clientList 
+                = TestConversationEngineStub::Instance()->GetConversationClientList();
+
+    //math the conversation id recieved from summary model
+    if (clientList.Count())
+    {
+         qint64 msgId = clientList[0]->GetConversationEntryId();
+         
+         QStandardItemModel* convModel = ConversationsEngine::instance()->
+                                                 getConversationsSummaryModel();
+  
+         //match convid in model, if not found raise error
+         QModelIndexList indexList = convModel->match(convModel->index(0, 0), 
+                  ConversationId, msgId, 1, Qt::MatchExactly);
+
+         QVERIFY2(indexList.count(), "No item found in summary model");
+         
+         qint64 convID = ConversationsEngine::instance()->
+                         getConversationIdFromAddress(
+                         convModel->data(indexList[0], ConversationAddress).toString());
+         QCOMPARE(convID, msgId);
+    }
+}
+
+//fetch more conversations from server
+void TConversationEngine::FetchMoreConversations()
+{
+    ConversationsEngine::instance()->fetchMoreConversations();
+}
+
+//clear conversations from conversation view
+void TConversationEngine::ClearConversations()
+{
+    //clear the conversations
+    ConversationsEngine::instance()->clearConversations();
+    
+    //validate the conversation view, and raise the error if entry found
+    QStandardItemModel* convModel 
+                        =  ConversationsEngine::instance()->getConversationsModel();
+    QVERIFY2(convModel->rowCount() == 0, "conversation view not cleared");     
+}
+
+//get the drafts model
+void TConversationEngine::GetDraftsModelFromConversationEngine()
+{
+    QStandardItemModel* convModel 
+                =  ConversationsEngine::instance()->getDraftsModel();
+    QVERIFY2(convModel, "Get Drafts Model Failed");
+}
+
+void TConversationEngine::cleanup()
+{
+    //clean the resources for the current test case
+}
+
+void TConversationEngine::cleanupTestCase()
+{
+    //delete the update handler
+    delete iConvUpdateHandler;
+    iConvUpdateHandler = NULL;
+    //delete the conversation engine variable
+    delete ConversationsEngine::instance();
+    //delete the stub data
+    delete TestConversationEngineStub::Instance();
+}
+
+
+//main entry point
+int main(int argc, char *argv[])
+    { 
+    int ret = -1;
+    QCoreApplication app(argc, argv);
+    QObject* tc = new TConversationEngine();
+    ret =  QTest::qExec(tc, argc, argv);
+	delete tc;
+    return ret;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationenginestub.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,428 @@
+/*
+ * 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:
+ *
+ */
+
+#include <msgitem.h>
+#include <ccsdefs.h>
+#include <ccsconversationentry.h>
+#include <ccsclientconversation.h>
+#include <conversationsenginedefines.h>
+#include "testconversationenginestub.h"
+#include "testconversationnotifier.h"
+#include "convergedmessage.h"
+
+TestConversationEngineStub* TestConversationEngineStub::Instance()
+{
+    static TestConversationEngineStub* iStubEngine 
+                                = new TestConversationEngineStub();
+    return iStubEngine;
+}
+
+void TestConversationEngineStub::InitL()
+{
+    iNotifier = new TestConversationNotifier();
+    iConversationID = 1234;
+    iTimeStamp = 123456789;
+    iMsgType = ECsSMS;
+    iUnReadCount = 3;
+
+    _LIT(Kname , "9343434343");
+    _LIT(KDescription , "This is the test msg.");
+
+    iContactID = Kname;
+    iDescription = KDescription;
+    iDeletedEntry = NULL;
+}
+
+TestConversationEngineStub::TestConversationEngineStub()
+{
+    TRAP_IGNORE(InitL());
+}
+
+TestConversationEngineStub::~TestConversationEngineStub()
+{
+    iConversationClientList.ResetAndDestroy();
+    iConversationEntryList.ResetAndDestroy();
+    delete iNotifier;
+}
+
+void TestConversationEngineStub
+::SetResultObserver(MCsResultsObserver *aResultObserver)
+{
+    iNotifier->SetResultNotifier(aResultObserver);
+}
+
+void TestConversationEngineStub::RemoveResultObserver()
+{
+    iNotifier->RemoveResultNotifier();
+}
+
+void TestConversationEngineStub
+::SetConversationChangeObserver(MCsConversationChangeObserver* aObserver,
+            CCsClientConversation* /*aClientConversation*/)
+{
+    iNotifier->SetConversationChangeNotifier(aObserver);
+}
+    
+void TestConversationEngineStub::RemoveConversationChangeObserver()
+{
+    iNotifier->RemoveConversationChangeNotifier();
+}
+
+void TestConversationEngineStub
+::SetConversationListChangeObserver(MCsConversationListChangeObserver* 
+                                        aConversationListChangeObserver)
+{
+    iNotifier->SetConversationListNotifier(aConversationListChangeObserver);
+}
+
+void TestConversationEngineStub::RemoveConversationListChangeObserver()
+{
+    iNotifier->RemoveConversationListNotifier();
+}
+
+void TestConversationEngineStub
+::MarkConversationRead(const TInt aConversationId)
+{
+    for (TInt i = 0; i < iConversationEntryList.Count(); ++i)
+         {
+             if (iConversationEntryList[i]->EntryId() == aConversationId)
+                 {
+                     iConversationEntryList[i]->
+                         ChangeAttributes(ECsAttributeNone, ECsAttributeUnread);
+                     break;
+                 }
+          }
+}
+
+void TestConversationEngineStub
+::DeleteConversation(const TInt aConversationId)
+{
+    for (TInt i = 0; i < iConversationEntryList.Count(); ++i)
+         {
+             if (iConversationEntryList[i]->EntryId() == aConversationId)
+                 {
+                     iDeletedEntry  = iConversationEntryList[i];
+                     iConversationEntryList.Remove(i);
+                 }
+          }
+}
+
+TInt TestConversationEngineStub::GetConvListSize()
+{
+    return iConversationEntryList.Count();
+}
+
+TInt TestConversationEngineStub::GetUnreadCount()
+{
+    TInt unRead = 0;
+    for (TInt i = 0; i < iConversationEntryList.Count(); ++i)
+     {
+         if (iConversationEntryList[i]->IsAttributeSet(ECsAttributeUnread))
+             {
+                 unRead++;
+             }
+      }
+    return unRead;
+}
+
+TInt TestConversationEngineStub::GetConversationID()
+{
+    return iConversationID;
+}
+
+TInt TestConversationEngineStub::GetTimeStamp()
+{
+    return iTimeStamp;
+}
+
+TInt TestConversationEngineStub::GetMsgType()
+{
+    return iMsgType;
+}
+
+TDesC& TestConversationEngineStub::GetContactID()
+{
+    return iContactID;
+}
+
+TDesC& TestConversationEngineStub::GetDescription()
+{
+    return iDescription;
+}
+
+RPointerArray<CCsClientConversation>& 
+TestConversationEngineStub::GetConversationClientList()
+{
+    return iConversationClientList;
+}
+
+CCsConversationEntry*
+TestConversationEngineStub
+::CreateConversationEntryL(TInt aConvID, bool aUnread)
+{
+    CCsConversationEntry* conversationEntry = CCsConversationEntry::NewL();
+    CleanupStack::PushL(conversationEntry);
+
+    conversationEntry->SetType(iMsgType);
+    conversationEntry->SetEntryId(aConvID);
+
+    conversationEntry->SetTimeStampL(iTimeStamp);
+
+    conversationEntry->SetContactL(iContactID);
+
+    conversationEntry->SetDescriptionL(iDescription);
+    
+    if (aUnread)
+        {
+        conversationEntry->ChangeAttributes(ECsAttributeUnread, 
+                                                ECsAttributeNone);
+        conversationEntry->SetConversationDir(0/*MsgDirectionIncoming*/);
+        }
+    else
+        {
+        conversationEntry->SetConversationDir(1/*MsgDirectionOutgoing*/);
+        conversationEntry->ChangeAttributes(ECsAttributeSent, 
+                                                ECsAttributeNone);
+        }
+   
+    CleanupStack::Pop(conversationEntry);
+    
+    return conversationEntry;
+}
+
+void TestConversationEngineStub
+::PrepareConversationListL(TInt aConvID, TInt aToatalCnt, TInt aUnreadCnt)
+{
+    // create conversation entries
+    for ( TInt iloop = 0; iloop < aToatalCnt; iloop++ )
+        {
+        CCsConversationEntry* conversationEntry 
+                = CreateConversationEntryL(aConvID++, (aUnreadCnt-- > 0));
+        CleanupStack::PushL(conversationEntry);
+    
+        // append conversation entries to list
+        iConversationEntryList.AppendL(conversationEntry);
+
+        CleanupStack::Pop(conversationEntry);
+        }
+}
+
+//Prerae a list with : conv id, no of unread msgs, 
+void TestConversationEngineStub::UpdateConversationList()
+{
+    TInt error;
+    TRAP(error, PrepareConversationListL(iConversationID, 5, iUnReadCount));    
+    iNotifier->SendListResultUpdate(iConversationEntryList);
+}
+
+void TestConversationEngineStub::UpdateConvEntry(TInt aConversationId)
+{
+    for (TInt i = 0; i < iConversationEntryList.Count(); ++i)
+     {
+         if (iConversationEntryList[i]->EntryId() == aConversationId)
+         {
+             iNotifier->
+             UpdateConversationEntryModify(*iConversationEntryList[i]);
+             break;
+         }
+      }
+}
+
+void TestConversationEngineStub::UpdateDeletedConvEntry()
+{
+    if (iDeletedEntry)
+    {
+        iNotifier->UpdateConversationEntryDelete(*iDeletedEntry);
+        delete iDeletedEntry;
+        iDeletedEntry = NULL;
+    }
+}
+
+void TestConversationEngineStub::UpdateAddConvEntryL()
+{
+    CCsConversationEntry*
+    conversationEntry = CreateConversationEntryL(9999/*iConversationID - 1*/, true);
+    CleanupStack::PushL(conversationEntry);
+    iConversationEntryList.AppendL(conversationEntry);
+    CleanupStack::Pop(conversationEntry);
+    iNotifier->UpdateConversationEntryAdd(*conversationEntry);
+}
+
+void TestConversationEngineStub::UpdateAddConvEntry()
+{
+    TInt error;
+    TRAP(error, UpdateAddConvEntryL());
+}
+
+void TestConversationEngineStub::UpdateAddConvClientL()
+{
+    _LIT(KFName , "New User");
+    
+    //need to free alloced descriptor
+    TBuf<10>  BufName(KFName);
+    HBufC * fname = BufName.AllocL();
+    CleanupStack::PushL(fname);
+    
+    CCsConversationEntry* 
+    convEntry = CreateConversationEntryL(iConversationID - 1, true);
+    CleanupStack::PushL(convEntry);
+    
+    CCsClientConversation* 
+    convClient = CreateConversationClientL(fname,4000, 2, *convEntry);
+    CleanupStack::PushL(convClient);
+    
+    iConversationClientList.AppendL(convClient);
+    
+    CleanupStack::Pop(convClient);
+    CleanupStack::PopAndDestroy(convEntry);
+    CleanupStack::PopAndDestroy(fname);
+    iNotifier->UpdateConversationClientAdd(*convClient);
+}
+
+void TestConversationEngineStub::UpdateAddConvClient()
+{
+    TInt error;
+    TRAP(error, UpdateAddConvClientL());
+}
+
+void TestConversationEngineStub::UpdateDeletedConvClient()
+{
+    CCsClientConversation* convClient = iConversationClientList[0];
+    iConversationClientList.Remove(0);
+
+    if (convClient)
+    {
+        iNotifier->UpdateConversationClientDelete(*convClient);
+        delete convClient;
+    }
+}
+
+
+void TestConversationEngineStub::UpdateConvClient(TInt aConversationId)
+{
+    for (TInt i = 0; i < iConversationClientList.Count(); ++i)
+     {
+         if (iConversationClientList[i]->GetConversationEntryId() 
+                                                 == aConversationId)
+         {
+             iConversationClientList[i]->
+             GetConversationEntry()->
+             ChangeAttributes(ECsAttributeNone, ECsAttributeUnread);
+             
+             iConversationClientList[i]->SetUnreadMessageCount(0);
+             
+             iNotifier->
+             UpdateConversationClientModify(*iConversationClientList[i]);
+             break;
+         }
+      }
+}
+
+CCsClientConversation* 
+TestConversationEngineStub::
+CreateConversationClientL(const HBufC* aDispName, TInt aContactID,
+                          TInt aUnreadCnt,
+                          CCsConversationEntry& aConvEntry)
+{
+    CCsClientConversation* conversationClient = CCsClientConversation::NewL();
+    CleanupStack::PushL(conversationClient);
+    
+    conversationClient->SetContactId(aContactID);
+    conversationClient->SetUnreadMessageCount(aUnreadCnt);
+    
+    conversationClient->SetDisplayNameL(aDispName);
+
+    conversationClient->SetConversationEntryL(&aConvEntry);
+    
+    conversationClient->SetConversationEntryId(aConvEntry.EntryId());
+    
+    CleanupStack::Pop(conversationClient);
+    
+    return conversationClient;
+}
+
+void TestConversationEngineStub
+::PrepareConversationClientListL(TInt aContactID, TInt aListSize, 
+                                TInt aUnRead, TInt aUnReadCnt)
+{
+    TInt convID = iConversationID;
+    
+    _LIT(KFName , "abc");
+    
+    //need to free alloced descriptor
+    TBufC<10>  BufName(KFName);
+    HBufC * fname = BufName.AllocL();
+    CleanupStack::PushL(fname);
+    
+    for (TInt loop = 0; loop < aListSize; loop++)
+        {
+            CCsConversationEntry* 
+            convEntry = CreateConversationEntryL(convID++,
+                                  (aUnRead-- > 0 ? true : false));
+            CleanupStack::PushL(convEntry);
+            
+            CCsClientConversation* 
+            convClient = CreateConversationClientL(fname, aContactID++, aUnReadCnt++,
+                                              *convEntry);
+            CleanupStack::PushL(convClient);
+            
+            iConversationClientList.AppendL(convClient);
+            
+            CleanupStack::Pop(convClient);
+            CleanupStack::PopAndDestroy(convEntry);
+        }
+    CleanupStack::Pop(fname);
+}
+
+//conversation client notifications
+void TestConversationEngineStub::UpdateConversationClientList()
+{
+    TInt error;
+    TRAP(error, PrepareConversationClientListL(2000, 5, 3, 0));
+    if (error == KErrNone)
+    {
+        iNotifier->SendClientListUpdate(iConversationClientList);
+    }
+}
+
+TInt TestConversationEngineStub
+::GetClientConversationID(const TInt aContactId)
+{
+    for (TInt i = 0; i < iConversationClientList.Count(); ++i)
+     {
+         if (iConversationClientList[i]->GetContactId() ==  aContactId)
+         {
+             return iConversationClientList[i]->GetConversationEntryId();
+         }
+      }
+    return -1;
+}
+
+TInt TestConversationEngineStub
+::GetClientConversationID(const TDesC& aContactAddress)
+{
+    for (TInt i = 0; i < iConversationClientList.Count(); ++i)
+     {
+         if (iConversationClientList[i]->
+                 GetConversationEntry()->
+                 Contact()->Compare(aContactAddress) == 0)
+         {
+             return iConversationClientList[i]->GetConversationEntryId();
+         }
+      }
+    return -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationnotifier.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,161 @@
+/*
+ * 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:
+ *
+ */
+
+#include "testconversationnotifier.h"
+
+#include <mcsresultsobserver.h>
+#include <mcsconversationlistchangeobserver.h>
+#include <mcsconversationchangeobserver.h>
+#include <mcscachingstatusobserver.h>
+
+
+TestConversationNotifier::TestConversationNotifier()
+                            :iResultsObserver(NULL), 
+                            iConversationListChangeObserver(NULL), 
+                            iConversationChangeObserver(NULL),
+                            iCachingStatusObserver(NULL) 
+{
+}
+
+void TestConversationNotifier
+::SetResultNotifier(MCsResultsObserver* aResultsObserver)
+{
+    iResultsObserver = aResultsObserver;
+}
+
+void TestConversationNotifier::RemoveResultNotifier( )
+{
+    iResultsObserver = NULL;
+}
+
+void TestConversationNotifier
+::SetConversationListNotifier(MCsConversationListChangeObserver* 
+                                    aConversationListChangeObserver)
+{
+    iConversationListChangeObserver = aConversationListChangeObserver;
+}
+
+void TestConversationNotifier::RemoveConversationListNotifier( )
+{
+    iConversationListChangeObserver = NULL;        
+}
+
+void TestConversationNotifier
+::SetConversationChangeNotifier(MCsConversationChangeObserver* 
+                                    aConversationChangeObserver)
+{
+    iConversationChangeObserver = aConversationChangeObserver;
+}
+
+void TestConversationNotifier::RemoveConversationChangeNotifier()
+{
+    iConversationChangeObserver = NULL;
+}
+
+void TestConversationNotifier
+::SetCachingStatusNotifier(MCsCachingStatusObserver* aCachingStatusObserver)
+{
+    iCachingStatusObserver = aCachingStatusObserver;
+}
+
+void TestConversationNotifier::RemoveCachingStatusNotifier()
+{
+    iCachingStatusObserver = NULL;
+}
+
+void TestConversationNotifier
+::SendListResultUpdate(RPointerArray<CCsConversationEntry>& 
+                                        aConversationEntryList)
+{
+    // Pass the results to the observer
+    if ( iResultsObserver )
+    {
+        iResultsObserver->Conversations(aConversationEntryList);
+    }
+}
+
+void TestConversationNotifier
+::UpdateConversationEntryModify(CCsConversationEntry& aConversationEntry)
+{
+    // Pass the results to the observer
+    if ( iConversationChangeObserver )
+    {
+        iConversationChangeObserver->ModifyConversation(aConversationEntry);
+    }
+}
+
+void TestConversationNotifier
+::UpdateConversationEntryAdd(CCsConversationEntry& aConversationEntry)
+{
+    // Pass the results to the observer
+    if ( iConversationChangeObserver )
+    {
+        iConversationChangeObserver->AddConversation(aConversationEntry);
+    }
+}
+
+void TestConversationNotifier
+::UpdateConversationEntryDelete(CCsConversationEntry& aConversationEntry)
+{
+    // Pass the results to the observer
+    if ( iConversationChangeObserver )
+    {
+        iConversationChangeObserver->DeleteConversation(aConversationEntry);
+    }
+}
+
+void TestConversationNotifier
+::SendClientListUpdate(RPointerArray<CCsClientConversation>& 
+                                        aConversationClientList)
+{
+    // Pass the results to the observer
+     if ( iResultsObserver )
+     {
+     iResultsObserver->ConversationList(aConversationClientList);
+     }
+}
+
+void TestConversationNotifier
+::UpdateConversationClientModify(CCsClientConversation& aConversationClient)
+{
+    if ( iConversationListChangeObserver )
+    {
+        iConversationListChangeObserver->
+            ModifyConversationList(aConversationClient);
+    }
+}
+    
+void TestConversationNotifier
+::UpdateConversationClientAdd(CCsClientConversation& aConversationClient)
+{
+    if ( iConversationListChangeObserver )
+    {
+        iConversationListChangeObserver->
+            AddConversationList(aConversationClient);
+    }
+}
+
+void TestConversationNotifier
+::UpdateConversationClientDelete(CCsClientConversation& aConversationClient)
+{
+    if ( iConversationListChangeObserver )
+    {
+        iConversationListChangeObserver->
+                DeleteConversationList(aConversationClient);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testconversationupdatehandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,155 @@
+/*
+ * 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:
+ *
+ */
+
+#include "testconversationupdatehandler.h"
+#include "testconversationenginestub.h"
+#include "conversationsengine.h"
+#include <conversationsenginedefines.h>
+#include <QStandardItemModel>
+#include <xqconversions.h>
+#include <ccsdefs.h>
+#include <ccsclientconversation.h>
+
+
+TConversationUpdateHandler::TConversationUpdateHandler(QObject* parent)
+: QObject(parent)
+{
+    
+}
+    
+
+void TConversationUpdateHandler::SetConversationsViewUpdateHandler()
+{
+    connect(ConversationsEngine::instance(), 
+                SIGNAL(conversationModelPopulated()), 
+                this, 
+                SLOT(ConversationsViewUpdated()));
+
+    connect(ConversationsEngine::instance(), 
+                SIGNAL(conversationModelUpdated()), 
+                this, 
+                SLOT(ConversationsViewUpdated()));
+}
+
+void TConversationUpdateHandler::SetConversationsSummaryViewUpdateHandler()
+{
+    connect(ConversationsEngine::instance(), 
+                SIGNAL(conversationListModelPopulated()), 
+                this, 
+                SLOT(ConversationsSummaryViewUpdated()));
+}
+
+void TConversationUpdateHandler::ConversationsViewUpdated()
+{
+    int loop, entryCount, unRead = 0;
+    
+    QWARN("List is updated to ..Conversation Model");
+
+    //Need to compare the Msglist with stub engine
+    QStandardItemModel* convModel = ConversationsEngine::instance()->getConversationsModel();
+    
+    //get the list with conversation address, 
+    //as this is common for all the conversation entries 
+    QModelIndexList indexList = convModel->match(convModel->index(0, 0), 
+                                                ConversationAddress, 
+                                                XQConversions::s60DescToQString(TestConversationEngineStub::Instance()->GetContactID()), 
+                                                -1, // One match 
+                                                Qt::MatchExactly);
+    entryCount = indexList.count();
+    
+    qDebug() << "entry count " << entryCount;
+    qDebug() << "row count " << convModel->rowCount();
+    
+    QCOMPARE(entryCount, 
+            TestConversationEngineStub::Instance()->GetConvListSize());
+
+    //match all the entries with stub conversation list
+    for(loop = 0; loop < entryCount; loop++)
+    {
+        //check for bunch of conversation fields and attributes
+        QCOMPARE(convModel->data(indexList[loop], MessageType).toInt(),
+                TestConversationEngineStub::Instance()->GetMsgType());
+
+        //compare the message description
+        QCOMPARE(convModel->data(indexList[loop], BodyText).toString(),
+                XQConversions::s60DescToQString(
+                        TestConversationEngineStub::Instance()->
+                         GetDescription()));
+        
+        //check the unread message status 
+        if (convModel->data(indexList[loop], UnReadStatus).toBool())
+        {
+           unRead++;
+        }
+        
+        qDebug() << "Conversation IDs " << convModel->data(indexList[loop], ConvergedMsgId).toInt();
+     }
+    
+    //check the unread messages count
+    QCOMPARE(unRead, TestConversationEngineStub::Instance()->GetUnreadCount());
+}
+
+void TConversationUpdateHandler::ConversationsSummaryViewUpdated()
+{
+    QWARN("List is updated to ..Conversation Summary Model");
+
+    //get the conversation client list
+    RPointerArray<CCsClientConversation>&  clientList 
+        = TestConversationEngineStub::Instance()->GetConversationClientList();
+
+    //get the converation summary model
+    QStandardItemModel* convModel = ConversationsEngine::instance()->getConversationsSummaryModel();
+    
+    //list size and rows in conversation model must be the same
+    QCOMPARE(convModel->rowCount(), clientList.Count());
+    
+
+    //match all the client entries with stub conversation client list
+    for (int loop = 0; loop < clientList.Count(); loop++)
+    {
+        CCsClientConversation* clientConv = clientList[loop];
+        
+        qint64 msgId = clientConv->GetConversationEntryId();
+        
+        //match convId in model, if not found raise error
+        QModelIndexList indexList = convModel->match(convModel->index(0, 0), 
+                 ConversationId, msgId, 1, Qt::MatchExactly);
+        
+         qDebug() << "msgId " << msgId;
+         qDebug() << "index list " << indexList.count();
+         
+         if (indexList.count() == 0)
+         {
+            QFAIL("Conv client not found");
+         }
+     
+         //check the bunch of converation client details 
+         
+         int msgCnt = clientConv->GetUnreadMessageCount();
+         QCOMPARE(convModel->data(indexList[0], UnreadCount).toInt(), msgCnt);
+         
+         TDesC* dispName = clientConv->GetDisplayName();
+         QCOMPARE(convModel->data(indexList[0], DisplayName).toString(),
+                 XQConversions::s60DescToQString(*dispName));
+         
+         int contactId = clientConv->GetContactId();
+         QCOMPARE(convModel->data(indexList[0], ContactId).toInt(), contactId);
+
+         //need to check the conversation entry
+    }
+ }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/src/testrcssession.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,238 @@
+/*
+ * 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:
+ *
+ */
+
+// INCLUDE FILES
+
+// SYSTEM INCLUDES
+#include <rcssession.h>
+
+// USER INCLUDES
+
+// ----------------------------------------------------------------------------
+// StartServer
+// Starts the server. Used only when the server is implemented as a transient.
+// ----------------------------------------------------------------------------
+TInt StartServer()
+{
+    return KErrNone;
+}
+// ============================== MEMBER FUNCTIONS ============================
+
+// ----------------------------------------------------------------------------
+// RCsSession::RCsSession
+// Constructor
+// ----------------------------------------------------------------------------
+RCsSession::RCsSession() : RSessionBase(),
+iListResultsBufferPtr (0, 0),
+iConvResultsBufferPtr (0, 0),
+iRequestBufferPtr (0, 0),
+iNotifyResultsBufferPtr (0, 0),
+iNotifyRequestBufferPtr (0, 0){
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::Connects to the conversation server
+// Returns the version number
+// ----------------------------------------------------------------------------
+TInt RCsSession::Connect()
+{
+    return KErrNone;
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::Version
+// Returns the version number
+// ----------------------------------------------------------------------------
+TVersion RCsSession::Version() const
+{
+    TVersion ver(1,2,3);
+    return ver;
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::ShutdownServerL
+// Shutsdown the CS Server. Synchronous.
+// ----------------------------------------------------------------------------
+void RCsSession::ShutdownServerL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetConversationListL
+// This function sends the request to conversation server
+// to get Recent Conversation Entry list with display name and contact link
+// for all stored conversation entry IDs.
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationListL(TPtr8 /*aResultsBuffer*/,
+                                      TRequestStatus& /*aStatus*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetConversationUnreadListL
+// This function sends the request to conversation server
+// to get Recent unread Conversation Entry list with display name and contact link
+// for all stored conversation entry IDs.
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationUnreadListL(TPtr8 /*aOverflow*/, TPtr8 /*aResultsBuffer*/)
+  {
+  }
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetConversationsL
+// This function sends the request to conversation server
+// to get Conversation Entry list for given Conversation Entry ID.
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationsL(const TDes8& /*aClientConversation*/,
+                                   TPtr8 /*aResultsBuffer*/,
+                                   TRequestStatus& /*aStatus*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::SendNewBufferGetConversationL
+// This function sends the request to conversation server
+// to get whole conversation again for the new buffer size
+//
+// ----------------------------------------------------------------------------
+void RCsSession::SendNewBufferGetConversationL(TPtr8 /*aResultsBuffer*/,
+                                               TRequestStatus& /*aStatus*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetCachingStatusL
+// This function sends the request to conversation server
+// to get caching status.
+// ----------------------------------------------------------------------------
+void RCsSession::GetCachingStatusL(TPtr8 /*aResultsBuffer*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetTotalUnreadCountL
+// This function sends the request to conversation server
+// to get caching status.
+// ----------------------------------------------------------------------------
+void RCsSession::GetTotalUnreadCountL(TPtr8 /*aResultsBuffer*/)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// RCsSession::SetConversationListChangeObserverL
+// This function sends the request to conversation server
+// to set conversation list change observer flag.
+// ----------------------------------------------------------------------------
+void RCsSession::SetConversationListChangeObserverL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::ResetConversationListChangeObserverL
+// This function sends the request to conversation server
+// to reset conversation list change observer flag.
+// ----------------------------------------------------------------------------
+void RCsSession::ResetConversationListChangeObserverL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::SetConversationChangeObserverL
+// This function sends the request to conversation server
+// to set conversation change observer flag for given
+// client conversation
+// ----------------------------------------------------------------------------
+void RCsSession::SetConversationChangeObserverL(
+                                                const TDes8& /*aClientConversation*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::ResetConversationChangeObserverL
+// This function sends the request to conversation server
+// to reset conversation change observer flag for given
+// client conversation
+// ----------------------------------------------------------------------------
+void RCsSession::ResetConversationChangeObserverL(
+                                                  const TDes8& /*aClientConversation*/)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::SetCachingStatusObserverL
+// This function sends the request to conversation server
+// to set caching status observer flag.
+// ----------------------------------------------------------------------------
+void RCsSession::SetCachingStatusObserverL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::ResetConversationListChangeObserverL
+// This function sends the request to conversation server
+// to reset caching status observer flag.
+// ----------------------------------------------------------------------------
+void RCsSession::ResetCachingStatusObserverL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::RequestChangeEventL
+// This function sends the request to conversation server
+// to register for any cache change event.
+// ----------------------------------------------------------------------------
+void RCsSession::RequestChangeEventL(TInt, TPtr8, TPtr8, TRequestStatus&)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::RemoveChangeEventL
+// This function sends the request to conversation server
+// to deregister for for any cache change event.
+// ----------------------------------------------------------------------------
+void RCsSession::RemoveChangeEventL()
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::DeleteConversationL
+// ----------------------------------------------------------------------------
+void RCsSession::DeleteConversationL(TInt)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetConversationIdL
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationIdL(TInt, TPtr8)
+{
+}
+
+// ----------------------------------------------------------------------------
+// RCsSession::GetConversationIdFromAddressL
+// ----------------------------------------------------------------------------
+void RCsSession::GetConversationIdFromAddressL(TDesC& , TPtr8 )
+{
+}
+// ----------------------------------------------------------------------------
+// RCsSession::MarkConversationReadL
+// ----------------------------------------------------------------------------
+void RCsSession::MarkConversationReadL(TInt)
+{
+}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/appengine/tsrc/testconversationengine/testconversationengine.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,103 @@
+#
+# 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:
+#
+QT += testlib
+QT -= gui
+CONFIG += hb
+CONFIG += symbian_test
+
+TEMPLATE = app
+TARGET = testconversationengine
+DEPENDPATH += . inc
+DEPENDPATH += . src
+DEPENDPATH += ../../../appengine/inc
+DEPENDPATH += ../../../appengine/
+
+INCLUDEPATH += . 
+
+INCLUDEPATH += ../../../../../inc
+INCLUDEPATH += ../../../appengine/inc
+INCLUDEPATH += ../../../../msgappfw/client/inc
+INCLUDEPATH += ../../../../smartmessaging/ringbc/inc
+INCLUDEPATH += ../../../../msgutils/unieditorutils/editorgenutils/inc
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_DLL
+
+HEADERS += \
+		   testconversationengine.h \
+		   testconversationenginestub.h \
+		   testconversationnotifier.h \
+		   testconversationupdatehandler.h \
+		   conversationsengine.h \
+           conversationmsgstorehandler.h \
+           conversationsengine_p.h \
+           conversationssummarymodel.h \
+           conversationsmodel.h \
+           conversationsengineutility.h \
+           conversationchangehandler.h \
+           conversationlistchangehandler.h \
+           draftsmodel.h		
+
+SOURCES += \
+		   testconversationengine.cpp \
+           testccsrequesthandler.cpp \
+           testrcssession.cpp \
+           testconversationenginestub.cpp \
+           testconversationnotifier.cpp \
+           testconversationupdatehandler.cpp \
+           src/conversationsengine.cpp \
+           src/conversationmsgstorehandler.cpp \
+           src/conversationsengine_p.cpp \
+           src/conversationssummarymodel.cpp \
+           src/conversationsmodel.cpp \
+           src/conversationsengineutility.cpp \
+           src/conversationchangehandler.cpp \
+           src/conversationlistchangehandler.cpp \
+           src/draftsmodel.cpp
+         
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+symbian*:{
+    TARGET.CAPABILITY = CAP_APPLICATION
+    TARGET.UID3 = 0x2001FE76
+    TARGET.EPOCSTACKSIZE = 0x8000
+    TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+		}
+		
+LIBS += -euser \
+        -ecom \
+        -lcsutils \
+        -lxqutils \
+        -lconvergedmessageutils \
+        -lmsgs \
+        -lInetProtUtil \
+        -lsmildtd \
+        -lxmldom \
+        -lxmlparser \
+        -lunidatamodelloader \
+        	-leditorgenutils \
+	-lsmcm \
+	-lQtVersit \
+        -lQtContacts \
+        -lxqutils \
+        -lmmscli \
+        -lcommonengine \
+        -lmmsserversettings \
+        -lsqldb \
+        -lestor \
+	-lFeatMgr \
+	-lfbscli \
+	-lringbc 
--- a/messagingapp/msgui/bwins/appengineu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/bwins/appengineu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,40 +1,45 @@
 EXPORTS
 	?fetchMoreConversations@ConversationsEngine@@QAEXXZ @ 1 NONAME ; void ConversationsEngine::fetchMoreConversations(void)
-	?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 2 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString)
-	?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 3 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void)
-	?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const
-	??1ConversationsEngine@@UAE@XZ @ 5 NONAME ; ConversationsEngine::~ConversationsEngine(void)
-	?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 6 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &)
-	?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 7 NONAME ; bool ConversationsEngine::deleteConversations(long long)
-	?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 8 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *)
-	?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 9 NONAME ; void * ConversationsEngine::qt_metacast(char const *)
-	?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 10 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void)
-	?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 11 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void)
-	?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *, int)
-	?tr@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 13 NONAME ; class QString ConversationsEngine::tr(char const *, char const *, int)
-	?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 14 NONAME ; void ConversationsEngine::conversationModelUpdated(void)
-	?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void)
-	?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 16 NONAME ; bool ConversationsEngine::downloadOperationSupported(int)
-	?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 17 NONAME ; bool ConversationsEngine::markMessagesRead(class QList<int> &)
-	?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 18 NONAME ; void ConversationsEngine::conversationModelPopulated(void)
-	?downloadMessage@ConversationsEngine@@QAEHH@Z @ 19 NONAME ; int ConversationsEngine::downloadMessage(int)
-	?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 20 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void)
-	?getCurrentConversationId@ConversationsEngine@@QAE_JXZ @ 21 NONAME ; long long ConversationsEngine::getCurrentConversationId(void)
-	?markConversationRead@ConversationsEngine@@QAE_N_J@Z @ 22 NONAME ; bool ConversationsEngine::markConversationRead(long long)
-	??_EConversationsEngine@@UAE@I@Z @ 23 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int)
-	?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 24 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void)
-	?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 25 NONAME ; void ConversationsEngine::conversationListModelPopulated(void)
-	??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 26 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *)
-	?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 27 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &)
-	?instance@ConversationsEngine@@SAPAV1@XZ @ 28 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void)
-	?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString ConversationsEngine::tr(char const *, char const *)
-	?resendMessage@ConversationsEngine@@QAE_NH@Z @ 30 NONAME ; bool ConversationsEngine::resendMessage(int)
-	?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 31 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void)
-	?getConversations@ConversationsEngine@@QAE_N_J@Z @ 32 NONAME ; bool ConversationsEngine::getConversations(long long)
-	?clearConversations@ConversationsEngine@@QAE_NXZ @ 33 NONAME ; bool ConversationsEngine::clearConversations(void)
-	?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 34 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int)
-	?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 35 NONAME ; void ConversationsEngine::deleteMessages(class QList<int> &)
-	?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 36 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject
-	?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 37 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void)
-	?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 38 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?disableRegisterationForCVEvents@ConversationsEngine@@QAEXXZ @ 2 NONAME ; void ConversationsEngine::disableRegisterationForCVEvents(void)
+	?getConversationIdFromAddress@ConversationsEngine@@QAE_JVQString@@@Z @ 3 NONAME ; long long ConversationsEngine::getConversationIdFromAddress(class QString)
+	?deleteAllDraftMessages@ConversationsEngine@@QAEXXZ @ 4 NONAME ; void ConversationsEngine::deleteAllDraftMessages(void)
+	?metaObject@ConversationsEngine@@UBEPBUQMetaObject@@XZ @ 5 NONAME ; struct QMetaObject const * ConversationsEngine::metaObject(void) const
+	??1ConversationsEngine@@UAE@XZ @ 6 NONAME ; ConversationsEngine::~ConversationsEngine(void)
+	?markAsReadAndGetType@ConversationsEngine@@QAEXHAAH0@Z @ 7 NONAME ; void ConversationsEngine::markAsReadAndGetType(int, int &, int &)
+	?deleteConversations@ConversationsEngine@@QAE_N_J@Z @ 8 NONAME ; bool ConversationsEngine::deleteConversations(long long)
+	?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 9 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *)
+	?qt_metacast@ConversationsEngine@@UAEPAXPBD@Z @ 10 NONAME ; void * ConversationsEngine::qt_metacast(char const *)
+	?emitConversationListModelPopulated@ConversationsEngine@@QAEXXZ @ 11 NONAME ; void ConversationsEngine::emitConversationListModelPopulated(void)
+	?getDraftsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 12 NONAME ; class QStandardItemModel * ConversationsEngine::getDraftsModel(void)
+	?emitOpenConversationViewIdUpdate@ConversationsEngine@@QAEXH@Z @ 13 NONAME ; void ConversationsEngine::emitOpenConversationViewIdUpdate(int)
+	?trUtf8@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString ConversationsEngine::trUtf8(char const *, char const *, int)
+	?tr@ConversationsEngine@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString ConversationsEngine::tr(char const *, char const *, int)
+	?conversationModelUpdated@ConversationsEngine@@IAEXXZ @ 16 NONAME ; void ConversationsEngine::conversationModelUpdated(void)
+	?getStaticMetaObject@ConversationsEngine@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & ConversationsEngine::getStaticMetaObject(void)
+	?downloadOperationSupported@ConversationsEngine@@QAE_NH@Z @ 18 NONAME ; bool ConversationsEngine::downloadOperationSupported(int)
+	?markMessagesRead@ConversationsEngine@@QAE_NAAV?$QList@H@@@Z @ 19 NONAME ; bool ConversationsEngine::markMessagesRead(class QList<int> &)
+	?conversationModelPopulated@ConversationsEngine@@IAEXXZ @ 20 NONAME ; void ConversationsEngine::conversationModelPopulated(void)
+	?downloadMessage@ConversationsEngine@@QAEHH@Z @ 21 NONAME ; int ConversationsEngine::downloadMessage(int)
+	?getConversationsModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 22 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsModel(void)
+	?markConversationRead@ConversationsEngine@@QAE_N_J@Z @ 23 NONAME ; bool ConversationsEngine::markConversationRead(long long)
+	?getCurrentConversationId@ConversationsEngine@@QAE_JXZ @ 24 NONAME ; long long ConversationsEngine::getCurrentConversationId(void)
+	??_EConversationsEngine@@UAE@I@Z @ 25 NONAME ; ConversationsEngine::~ConversationsEngine(unsigned int)
+	?getConversationsSummaryModel@ConversationsEngine@@QAEPAVQStandardItemModel@@XZ @ 26 NONAME ; class QStandardItemModel * ConversationsEngine::getConversationsSummaryModel(void)
+	?conversationListModelPopulated@ConversationsEngine@@IAEXXZ @ 27 NONAME ; void ConversationsEngine::conversationListModelPopulated(void)
+	??0ConversationsEngine@@AAE@PAVQObject@@@Z @ 28 NONAME ; ConversationsEngine::ConversationsEngine(class QObject *)
+	?getContactDetails@ConversationsEngine@@QAEX_JAAVQString@@1@Z @ 29 NONAME ; void ConversationsEngine::getContactDetails(long long, class QString &, class QString &)
+	?instance@ConversationsEngine@@SAPAV1@XZ @ 30 NONAME ; class ConversationsEngine * ConversationsEngine::instance(void)
+	?tr@ConversationsEngine@@SA?AVQString@@PBD0@Z @ 31 NONAME ; class QString ConversationsEngine::tr(char const *, char const *)
+	?resendMessage@ConversationsEngine@@QAE_NH@Z @ 32 NONAME ; bool ConversationsEngine::resendMessage(int)
+	?emitConversationModelUpdated@ConversationsEngine@@QAEXXZ @ 33 NONAME ; void ConversationsEngine::emitConversationModelUpdated(void)
+	?getConversations@ConversationsEngine@@QAE_N_J@Z @ 34 NONAME ; bool ConversationsEngine::getConversations(long long)
+	?clearConversations@ConversationsEngine@@QAE_NXZ @ 35 NONAME ; bool ConversationsEngine::clearConversations(void)
+	?getDBHandle@ConversationsEngine@@QAEAAVRSqlDatabase@@AAH@Z @ 36 NONAME ; class RSqlDatabase & ConversationsEngine::getDBHandle(int &)
+	?getMsgSubType@ConversationsEngine@@QAEHH@Z @ 37 NONAME ; int ConversationsEngine::getMsgSubType(int)
+	?getConversationIdFromContactId@ConversationsEngine@@QAE_JH@Z @ 38 NONAME ; long long ConversationsEngine::getConversationIdFromContactId(int)
+	?staticMetaObject@ConversationsEngine@@2UQMetaObject@@B @ 39 NONAME ; struct QMetaObject const ConversationsEngine::staticMetaObject
+	?deleteMessages@ConversationsEngine@@QAEXAAV?$QList@H@@@Z @ 40 NONAME ; void ConversationsEngine::deleteMessages(class QList<int> &)
+	?emitConversationModelPopulated@ConversationsEngine@@QAEXXZ @ 41 NONAME ; void ConversationsEngine::emitConversationModelPopulated(void)
+	?conversationViewEmpty@ConversationsEngine@@IAEXXZ @ 42 NONAME ; void ConversationsEngine::conversationViewEmpty(void)
+	?qt_metacall@ConversationsEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 43 NONAME ; int ConversationsEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
 
--- a/messagingapp/msgui/bwins/conversationviewu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/bwins/conversationviewu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,7 +1,7 @@
 EXPORTS
 	?qt_metacast@MsgConversationBaseView@@UAEPAXPBD@Z @ 1 NONAME ; void * MsgConversationBaseView::qt_metacast(char const *)
 	?metaObject@MsgConversationBaseView@@UBEPBUQMetaObject@@XZ @ 2 NONAME ; struct QMetaObject const * MsgConversationBaseView::metaObject(void) const
-	?saveContentToDrafts@MsgConversationBaseView@@QAEXXZ @ 3 NONAME ; void MsgConversationBaseView::saveContentToDrafts(void)
+	?handleConversationIdChange@MsgConversationBaseView@@AAEX_J@Z @ 3 NONAME ; void MsgConversationBaseView::handleConversationIdChange(long long)
 	?closeConversationView@MsgConversationBaseView@@QAEXXZ @ 4 NONAME ; void MsgConversationBaseView::closeConversationView(void)
 	?trUtf8@MsgConversationBaseView@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString MsgConversationBaseView::trUtf8(char const *, char const *, int)
 	?handleError@MsgConversationBaseView@@AAEXHABVQString@@@Z @ 6 NONAME ; void MsgConversationBaseView::handleError(int, class QString const &)
@@ -10,16 +10,20 @@
 	??0MsgConversationBaseView@@QAE@PAVQGraphicsItem@@@Z @ 9 NONAME ; MsgConversationBaseView::MsgConversationBaseView(class QGraphicsItem *)
 	?handleOk@MsgConversationBaseView@@AAEXABVQVariant@@@Z @ 10 NONAME ; void MsgConversationBaseView::handleOk(class QVariant const &)
 	?trUtf8@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString MsgConversationBaseView::trUtf8(char const *, char const *)
-	?doDelayedConstruction@MsgConversationBaseView@@AAEXXZ @ 12 NONAME ; void MsgConversationBaseView::doDelayedConstruction(void)
-	?openConversation@MsgConversationBaseView@@QAEX_J@Z @ 13 NONAME ; void MsgConversationBaseView::openConversation(long long)
-	?conversationViewClosed@MsgConversationBaseView@@IAEXXZ @ 14 NONAME ; void MsgConversationBaseView::conversationViewClosed(void)
-	?staticMetaObject@MsgConversationBaseView@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const MsgConversationBaseView::staticMetaObject
-	?initView@MsgConversationBaseView@@AAEXXZ @ 16 NONAME ; void MsgConversationBaseView::initView(void)
-	?markMessagesAsRead@MsgConversationBaseView@@QAEXXZ @ 17 NONAME ; void MsgConversationBaseView::markMessagesAsRead(void)
-	?tr@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString MsgConversationBaseView::tr(char const *, char const *)
-	?getStaticMetaObject@MsgConversationBaseView@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & MsgConversationBaseView::getStaticMetaObject(void)
-	?qt_metacall@MsgConversationBaseView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 20 NONAME ; int MsgConversationBaseView::qt_metacall(enum QMetaObject::Call, int, void * *)
-	??1MsgConversationBaseView@@UAE@XZ @ 21 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(void)
-	??_EMsgConversationBaseView@@UAE@I@Z @ 22 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(unsigned int)
-	?clearContent@MsgConversationBaseView@@QAEXXZ @ 23 NONAME ; void MsgConversationBaseView::clearContent(void)
+	?saveContentToDrafts@MsgConversationBaseView@@QAEHXZ @ 12 NONAME ; int MsgConversationBaseView::saveContentToDrafts(void)
+	?setPSCVId@MsgConversationBaseView@@QAEX_N@Z @ 13 NONAME ; void MsgConversationBaseView::setPSCVId(bool)
+	?doDelayedConstruction@MsgConversationBaseView@@AAEXXZ @ 14 NONAME ; void MsgConversationBaseView::doDelayedConstruction(void)
+	?openConversation@MsgConversationBaseView@@QAEX_J@Z @ 15 NONAME ; void MsgConversationBaseView::openConversation(long long)
+	?conversationId@MsgConversationBaseView@@QAE_JXZ @ 16 NONAME ; long long MsgConversationBaseView::conversationId(void)
+	?staticMetaObject@MsgConversationBaseView@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const MsgConversationBaseView::staticMetaObject
+	?conversationViewClosed@MsgConversationBaseView@@IAEXXZ @ 18 NONAME ; void MsgConversationBaseView::conversationViewClosed(void)
+	?initView@MsgConversationBaseView@@AAEXXZ @ 19 NONAME ; void MsgConversationBaseView::initView(void)
+	?markMessagesAsRead@MsgConversationBaseView@@QAEXXZ @ 20 NONAME ; void MsgConversationBaseView::markMessagesAsRead(void)
+	?tr@MsgConversationBaseView@@SA?AVQString@@PBD0@Z @ 21 NONAME ; class QString MsgConversationBaseView::tr(char const *, char const *)
+	?qt_metacall@MsgConversationBaseView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 22 NONAME ; int MsgConversationBaseView::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?getStaticMetaObject@MsgConversationBaseView@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & MsgConversationBaseView::getStaticMetaObject(void)
+	??1MsgConversationBaseView@@UAE@XZ @ 24 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(void)
+	?handleViewReady@MsgConversationBaseView@@AAEXXZ @ 25 NONAME ; void MsgConversationBaseView::handleViewReady(void)
+	??_EMsgConversationBaseView@@UAE@I@Z @ 26 NONAME ; MsgConversationBaseView::~MsgConversationBaseView(unsigned int)
+	?clearContent@MsgConversationBaseView@@QAEXXZ @ 27 NONAME ; void MsgConversationBaseView::clearContent(void)
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/bwins/msgaudiofetcheru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,20 @@
+EXPORTS
+	?metaObject@MsgAudioFetcherView@@UBEPBUQMetaObject@@XZ @ 1 NONAME ; struct QMetaObject const * MsgAudioFetcherView::metaObject(void) const
+	?enableToolBar@MsgAudioFetcherView@@AAEX_N@Z @ 2 NONAME ; void MsgAudioFetcherView::enableToolBar(bool)
+	??1MsgAudioFetcherView@@UAE@XZ @ 3 NONAME ; MsgAudioFetcherView::~MsgAudioFetcherView(void)
+	?staticMetaObject@MsgAudioFetcherView@@2UQMetaObject@@B @ 4 NONAME ; struct QMetaObject const MsgAudioFetcherView::staticMetaObject
+	??_EMsgAudioFetcherView@@UAE@I@Z @ 5 NONAME ; MsgAudioFetcherView::~MsgAudioFetcherView(unsigned int)
+	?trUtf8@MsgAudioFetcherView@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MsgAudioFetcherView::trUtf8(char const *, char const *)
+	?removeToolBarAction@MsgAudioFetcherView@@AAEXXZ @ 7 NONAME ; void MsgAudioFetcherView::removeToolBarAction(void)
+	?qt_metacall@MsgAudioFetcherView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 8 NONAME ; int MsgAudioFetcherView::qt_metacall(enum QMetaObject::Call, int, void * *)
+	?initMainWidget@MsgAudioFetcherView@@AAEXXZ @ 9 NONAME ; void MsgAudioFetcherView::initMainWidget(void)
+	?trUtf8@MsgAudioFetcherView@@SA?AVQString@@PBD0H@Z @ 10 NONAME ; class QString MsgAudioFetcherView::trUtf8(char const *, char const *, int)
+	?tr@MsgAudioFetcherView@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString MsgAudioFetcherView::tr(char const *, char const *, int)
+	?on_rightAction_triggered@MsgAudioFetcherView@@AAEXXZ @ 12 NONAME ; void MsgAudioFetcherView::on_rightAction_triggered(void)
+	??0MsgAudioFetcherView@@QAE@ABV?$QList@VQVariant@@@@@Z @ 13 NONAME ; MsgAudioFetcherView::MsgAudioFetcherView(class QList<class QVariant> const &)
+	?initToolBar@MsgAudioFetcherView@@AAEXXZ @ 14 NONAME ; void MsgAudioFetcherView::initToolBar(void)
+	?tr@MsgAudioFetcherView@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString MsgAudioFetcherView::tr(char const *, char const *)
+	?qt_metacast@MsgAudioFetcherView@@UAEPAXPBD@Z @ 16 NONAME ; void * MsgAudioFetcherView::qt_metacast(char const *)
+	?getStaticMetaObject@MsgAudioFetcherView@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & MsgAudioFetcherView::getStaticMetaObject(void)
+	?on_leftAction_triggered@MsgAudioFetcherView@@AAEXXZ @ 18 NONAME ; void MsgAudioFetcherView::on_leftAction_triggered(void)
+
--- a/messagingapp/msgui/bwins/msgsettingsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-EXPORTS
-	?createMmsView@SettingsViewer@@QAEXXZ @ 1 NONAME ; void SettingsViewer::createMmsView(void)
-	??0SettingsViewer@@QAE@PAVQGraphicsItem@@@Z @ 2 NONAME ; SettingsViewer::SettingsViewer(class QGraphicsItem *)
-	?openMmsSettings@SettingsViewer@@QAEXXZ @ 3 NONAME ; void SettingsViewer::openMmsSettings(void)
-	??1SettingsViewer@@UAE@XZ @ 4 NONAME ; SettingsViewer::~SettingsViewer(void)
-	?staticMetaObject@SettingsViewer@@2UQMetaObject@@B @ 5 NONAME ; struct QMetaObject const SettingsViewer::staticMetaObject
-	??_ESettingsViewer@@UAE@I@Z @ 6 NONAME ; SettingsViewer::~SettingsViewer(unsigned int)
-	?qt_metacast@SettingsViewer@@UAEPAXPBD@Z @ 7 NONAME ; void * SettingsViewer::qt_metacast(char const *)
-	?initView@SettingsViewer@@QAEXXZ @ 8 NONAME ; void SettingsViewer::initView(void)
-	?softkeyClicked@SettingsViewer@@QAEXXZ @ 9 NONAME ; void SettingsViewer::softkeyClicked(void)
-	?changeAccessPoint@SettingsViewer@@QAEXH@Z @ 10 NONAME ; void SettingsViewer::changeAccessPoint(int)
-	?trUtf8@SettingsViewer@@SA?AVQString@@PBD0@Z @ 11 NONAME ; class QString SettingsViewer::trUtf8(char const *, char const *)
-	?trUtf8@SettingsViewer@@SA?AVQString@@PBD0H@Z @ 12 NONAME ; class QString SettingsViewer::trUtf8(char const *, char const *, int)
-	?metaObject@SettingsViewer@@UBEPBUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const * SettingsViewer::metaObject(void) const
-	?openSmsSettings@SettingsViewer@@QAEXXZ @ 14 NONAME ; void SettingsViewer::openSmsSettings(void)
-	?tr@SettingsViewer@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString SettingsViewer::tr(char const *, char const *, int)
-	?iAPSelector@SettingsViewer@@QAEXPAVQStringList@@@Z @ 16 NONAME ; void SettingsViewer::iAPSelector(class QStringList *)
-	?closeSettings@SettingsViewer@@QAEXXZ @ 17 NONAME ; void SettingsViewer::closeSettings(void)
-	?qt_metacall@SettingsViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 18 NONAME ; int SettingsViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?changeService@SettingsViewer@@QAEXXZ @ 19 NONAME ; void SettingsViewer::changeService(void)
-	?createSmsView@SettingsViewer@@QAEXXZ @ 20 NONAME ; void SettingsViewer::createSmsView(void)
-	?settingsViewerClosed@SettingsViewer@@IAEXXZ @ 21 NONAME ; void SettingsViewer::settingsViewerClosed(void)
-	?tr@SettingsViewer@@SA?AVQString@@PBD0@Z @ 22 NONAME ; class QString SettingsViewer::tr(char const *, char const *)
-	?getStaticMetaObject@SettingsViewer@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & SettingsViewer::getStaticMetaObject(void)
-	?settingListClosed@SettingsViewer@@QAEXXZ @ 24 NONAME ; void SettingsViewer::settingListClosed(void)
-
--- a/messagingapp/msgui/bwins/msguiutilsu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/bwins/msguiutilsu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,33 +1,46 @@
 EXPORTS
 	?checkEmailOverSms@MsgSendUtil@@AAE_NAAVConvergedMessage@@AA_N@Z @ 1 NONAME ; bool MsgSendUtil::checkEmailOverSms(class ConvergedMessage &, bool &)
-	?getMmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 2 NONAME ; int MsgSendUtil::getMmsMsgSize(class ConvergedMessage &)
-	?checkModeForInsert@MmsConformanceCheck@@QAEHABVQString@@_N@Z @ 3 NONAME ; int MmsConformanceCheck::checkModeForInsert(class QString const &, bool)
+	?deleteVCardFromTemp@MsgContactsUtil@@CAXABVQString@@@Z @ 2 NONAME ; void MsgContactsUtil::deleteVCardFromTemp(class QString const &)
+	??1MmsConformanceCheck@@UAE@XZ @ 3 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(void)
 	?mediaDurationL@MsgMediaUtil@@AAEHABVTDesC16@@@Z @ 4 NONAME ; int MsgMediaUtil::mediaDurationL(class TDesC16 const &)
 	??0MsgMediaUtil@@QAE@XZ @ 5 NONAME ; MsgMediaUtil::MsgMediaUtil(void)
-	?qt_metacast@MsgSendUtil@@UAEPAXPBD@Z @ 6 NONAME ; void * MsgSendUtil::qt_metacast(char const *)
-	?validateService@MsgSendUtil@@AAE_NPAVUniEditorPluginInterface@@_N@Z @ 7 NONAME ; bool MsgSendUtil::validateService(class UniEditorPluginInterface *, bool)
-	?showPopup@MmsConformanceCheck@@AAEXABVQString@@@Z @ 8 NONAME ; void MmsConformanceCheck::showPopup(class QString const &)
-	?launchEditorQuery@MmsConformanceCheck@@AAE_NXZ @ 9 NONAME ; bool MmsConformanceCheck::launchEditorQuery(void)
-	??1MmsConformanceCheck@@QAE@XZ @ 10 NONAME ; MmsConformanceCheck::~MmsConformanceCheck(void)
-	??0MsgSendUtil@@QAE@PAVQObject@@@Z @ 11 NONAME ; MsgSendUtil::MsgSendUtil(class QObject *)
-	?metaObject@MsgSendUtil@@UBEPBUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const * MsgSendUtil::metaObject(void) const
-	?longestEmailAddressSize@MsgSendUtil@@AAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 13 NONAME ; int MsgSendUtil::longestEmailAddressSize(class QList<class ConvergedMessageAddress *>)
+	?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *)
+	?qt_metacast@MsgSendUtil@@UAEPAXPBD@Z @ 7 NONAME ; void * MsgSendUtil::qt_metacast(char const *)
+	?validateService@MsgSendUtil@@AAE_NPAVUniEditorPluginInterface@@_N@Z @ 8 NONAME ; bool MsgSendUtil::validateService(class UniEditorPluginInterface *, bool)
+	?showPopup@MmsConformanceCheck@@AAEXABVQString@@@Z @ 9 NONAME ; void MmsConformanceCheck::showPopup(class QString const &)
+	??0MsgSendUtil@@QAE@PAVQObject@@@Z @ 10 NONAME ; MsgSendUtil::MsgSendUtil(class QObject *)
+	?metaObject@MsgSendUtil@@UBEPBUQMetaObject@@XZ @ 11 NONAME ; struct QMetaObject const * MsgSendUtil::metaObject(void) const
+	?longestEmailAddressSize@MsgSendUtil@@AAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 12 NONAME ; int MsgSendUtil::longestEmailAddressSize(class QList<class ConvergedMessageAddress *>)
+	?getStaticMetaObject@MmsConformanceCheck@@SAABUQMetaObject@@XZ @ 13 NONAME ; struct QMetaObject const & MmsConformanceCheck::getStaticMetaObject(void)
 	??_EMsgSendUtil@@UAE@I@Z @ 14 NONAME ; MsgSendUtil::~MsgSendUtil(unsigned int)
 	?staticMetaObject@MsgSendUtil@@2UQMetaObject@@B @ 15 NONAME ; struct QMetaObject const MsgSendUtil::staticMetaObject
 	??0MmsConformanceCheck@@QAE@XZ @ 16 NONAME ; MmsConformanceCheck::MmsConformanceCheck(void)
-	?tr@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 17 NONAME ; class QString MsgSendUtil::tr(char const *, char const *)
-	?saveToDrafts@MsgSendUtil@@QAEJAAVConvergedMessage@@@Z @ 18 NONAME ; long MsgSendUtil::saveToDrafts(class ConvergedMessage &)
-	?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 19 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *)
-	?getStaticMetaObject@MsgSendUtil@@SAABUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const & MsgSendUtil::getStaticMetaObject(void)
+	?metaObject@MmsConformanceCheck@@UBEPBUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const * MmsConformanceCheck::metaObject(void) const
+	?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0@Z @ 18 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *)
+	?getStaticMetaObject@MsgSendUtil@@SAABUQMetaObject@@XZ @ 19 NONAME ; struct QMetaObject const & MsgSendUtil::getStaticMetaObject(void)
+	?qt_metacall@MmsConformanceCheck@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 20 NONAME ; int MmsConformanceCheck::qt_metacall(enum QMetaObject::Call, int, void * *)
 	?getSmsMsgSize@MsgSendUtil@@AAEHAAVConvergedMessage@@@Z @ 21 NONAME ; int MsgSendUtil::getSmsMsgSize(class ConvergedMessage &)
 	?tr@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 22 NONAME ; class QString MsgSendUtil::tr(char const *, char const *, int)
-	?mediaDuration@MsgMediaUtil@@QAE?AVQString@@ABV2@@Z @ 23 NONAME ; class QString MsgMediaUtil::mediaDuration(class QString const &)
-	?validateMsgForForward@MmsConformanceCheck@@QAE_NH@Z @ 24 NONAME ; bool MmsConformanceCheck::validateMsgForForward(int)
-	?checkMaxMsgSizeLimit@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 25 NONAME ; bool MsgSendUtil::checkMaxMsgSizeLimit(class ConvergedMessage &)
-	??1MsgSendUtil@@UAE@XZ @ 26 NONAME ; MsgSendUtil::~MsgSendUtil(void)
-	?qt_metacall@MsgSendUtil@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 27 NONAME ; int MsgSendUtil::qt_metacall(enum QMetaObject::Call, int, void * *)
-	??1MsgMediaUtil@@QAE@XZ @ 28 NONAME ; MsgMediaUtil::~MsgMediaUtil(void)
-	?send@MsgSendUtil@@QAEHAAVConvergedMessage@@@Z @ 29 NONAME ; int MsgSendUtil::send(class ConvergedMessage &)
-	?trUtf8@MsgSendUtil@@SA?AVQString@@PBD0H@Z @ 30 NONAME ; class QString MsgSendUtil::trUtf8(char const *, char const *, int)
-	?checkMaxRecipientCount@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 31 NONAME ; bool MsgSendUtil::checkMaxRecipientCount(class ConvergedMessage &)
+	?validateMsgForForward@MmsConformanceCheck@@QAE_NH@Z @ 23 NONAME ; bool MmsConformanceCheck::validateMsgForForward(int)
+	?checkMaxMsgSizeLimit@MsgSendUtil@@AAE_NAAVConvergedMessage@@@Z @ 24 NONAME ; bool MsgSendUtil::checkMaxMsgSizeLimit(class ConvergedMessage &)
+	?trUtf8@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 25 NONAME ; class QString MmsConformanceCheck::trUtf8(char const *, char const *, int)
+	?tr@MmsConformanceCheck@@SA?AVQString@@PBD0H@Z @ 26 NONAME ; class QString MmsConformanceCheck::tr(char const *, char const *, int)
+	??1MsgMediaUtil@@QAE@XZ @ 27 NONAME ; MsgMediaUtil::~MsgMediaUtil(void)
+	?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 * *)
 
--- a/messagingapp/msgui/bwins/unifiededitoru.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/bwins/unifiededitoru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -6,47 +6,58 @@
 	?updateOtherRecipientCount@MsgUnifiedEditorView@@AAEX_N@Z @ 5 NONAME ; void MsgUnifiedEditorView::updateOtherRecipientCount(bool)
 	?qt_metacall@MsgUnifiedEditorView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 6 NONAME ; int MsgUnifiedEditorView::qt_metacall(enum QMetaObject::Call, int, void * *)
 	?fetchImages@MsgUnifiedEditorView@@AAEXXZ @ 7 NONAME ; void MsgUnifiedEditorView::fetchImages(void)
-	?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 8 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *)
-	?sendingOptions@MsgUnifiedEditorView@@AAEXXZ @ 9 NONAME ; void MsgUnifiedEditorView::sendingOptions(void)
-	?saveContentToDrafts@MsgUnifiedEditorView@@QAEXXZ @ 10 NONAME ; void MsgUnifiedEditorView::saveContentToDrafts(void)
-	?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 11 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &)
-	?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 12 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject
-	?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 13 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void)
-	?resizeEvent@MsgUnifiedEditorView@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 14 NONAME ; void MsgUnifiedEditorView::resizeEvent(class QGraphicsSceneResizeEvent *)
-	?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@0H@Z @ 15 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class CFbsBitmap *, int)
-	?populateContent@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 16 NONAME ; void MsgUnifiedEditorView::populateContent(class QList<class QVariant> const &)
-	?addCcBcc@MsgUnifiedEditorView@@AAEXXZ @ 17 NONAME ; void MsgUnifiedEditorView::addCcBcc(void)
-	?ProcessImageL@CUniImageProcessor@@QAEXAAVRFile@@0AAVTSize@@ABVTDesC8@@HH@Z @ 18 NONAME ; void CUniImageProcessor::ProcessImageL(class RFile &, class RFile &, class TSize &, class TDesC8 const &, int, int)
-	?generateFileName@MsgUnifiedEditorView@@AAE?AVQString@@AAV2@@Z @ 19 NONAME ; class QString MsgUnifiedEditorView::generateFileName(class QString &)
-	?metaObject@MsgUnifiedEditorView@@UBEPBUQMetaObject@@XZ @ 20 NONAME ; struct QMetaObject const * MsgUnifiedEditorView::metaObject(void) const
-	?createVCards@MsgUnifiedEditorView@@AAEHABVQVariant@@AAVQStringList@@@Z @ 21 NONAME ; int MsgUnifiedEditorView::createVCards(class QVariant const &, class QStringList &)
-	?audiosFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 22 NONAME ; void MsgUnifiedEditorView::audiosFetched(class QVariant const &)
-	?addSubject@MsgUnifiedEditorView@@AAEXXZ @ 23 NONAME ; void MsgUnifiedEditorView::addSubject(void)
-	?imagesFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 24 NONAME ; void MsgUnifiedEditorView::imagesFetched(class QVariant const &)
-	?serviceRequestError@MsgUnifiedEditorView@@AAEXHABVQString@@@Z @ 25 NONAME ; void MsgUnifiedEditorView::serviceRequestError(int, class QString const &)
-	?qt_metacast@MsgUnifiedEditorView@@UAEPAXPBD@Z @ 26 NONAME ; void * MsgUnifiedEditorView::qt_metacast(char const *)
-	?ScaleImageL@CUniImageProcessor@@QAEXAAVRFile@@AAPAVCFbsBitmap@@1AAVTSize@@H@Z @ 27 NONAME ; void CUniImageProcessor::ScaleImageL(class RFile &, class CFbsBitmap * &, class CFbsBitmap * &, class TSize &, int)
-	?addMenu@MsgUnifiedEditorView@@AAEXXZ @ 28 NONAME ; void MsgUnifiedEditorView::addMenu(void)
-	??_EMsgUnifiedEditorView@@UAE@I@Z @ 29 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(unsigned int)
-	??1MsgUnifiedEditorView@@UAE@XZ @ 30 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(void)
-	?packMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessage@@@Z @ 31 NONAME ; void MsgUnifiedEditorView::packMessage(class ConvergedMessage &)
-	?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 32 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *)
-	?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 33 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *)
-	?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@AAVRFile@@ABVTSize@@ABVTDesC8@@H@Z @ 34 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class RFile &, class TSize const &, class TDesC8 const &, int)
-	?getStaticMetaObject@MsgUnifiedEditorView@@SAABUQMetaObject@@XZ @ 35 NONAME ; struct QMetaObject const & MsgUnifiedEditorView::getStaticMetaObject(void)
-	?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 36 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *, int)
-	?populateContentIntoEditor@MsgUnifiedEditorView@@AAEXABVConvergedMessage@@@Z @ 37 NONAME ; void MsgUnifiedEditorView::populateContentIntoEditor(class ConvergedMessage const &)
-	?send@MsgUnifiedEditorView@@AAEXXZ @ 38 NONAME ; void MsgUnifiedEditorView::send(void)
-	?Reset@CUniImageProcessor@@QAEXXZ @ 39 NONAME ; void CUniImageProcessor::Reset(void)
-	?openDraftsMessage@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 40 NONAME ; void MsgUnifiedEditorView::openDraftsMessage(class QList<class QVariant> const &)
-	?addToolBar@MsgUnifiedEditorView@@AAEXXZ @ 41 NONAME ; void MsgUnifiedEditorView::addToolBar(void)
-	?contactsFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 42 NONAME ; void MsgUnifiedEditorView::contactsFetched(class QVariant const &)
-	?removeAttachmentContainer@MsgUnifiedEditorView@@AAEXXZ @ 43 NONAME ; void MsgUnifiedEditorView::removeAttachmentContainer(void)
-	?pluginPath@MsgUnifiedEditorView@@AAE?AVQString@@XZ @ 44 NONAME ; class QString MsgUnifiedEditorView::pluginPath(void)
-	?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 45 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *, int)
-	??0MsgUnifiedEditorView@@QAE@PAVQGraphicsItem@@@Z @ 46 NONAME ; MsgUnifiedEditorView::MsgUnifiedEditorView(class QGraphicsItem *)
-	?fetchContacts@MsgUnifiedEditorView@@AAEXXZ @ 47 NONAME ; void MsgUnifiedEditorView::fetchContacts(void)
-	?deleteMessage@MsgUnifiedEditorView@@AAEXXZ @ 48 NONAME ; void MsgUnifiedEditorView::deleteMessage(void)
-	?addAttachments@MsgUnifiedEditorView@@AAEXVQStringList@@@Z @ 49 NONAME ; void MsgUnifiedEditorView::addAttachments(class QStringList)
-	?deactivateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 50 NONAME ; void MsgUnifiedEditorView::deactivateInputBlocker(void)
+	?packMessage@MsgUnifiedEditorView@@AAEXAAVConvergedMessage@@_N@Z @ 8 NONAME ; void MsgUnifiedEditorView::packMessage(class ConvergedMessage &, bool)
+	?handleViewExtnActivated@MsgUnifiedEditorView@@AAEXPAVHbListWidgetItem@@@Z @ 9 NONAME ; void MsgUnifiedEditorView::handleViewExtnActivated(class HbListWidgetItem *)
+	?addAttachment@MsgUnifiedEditorView@@AAEHABVQString@@@Z @ 10 NONAME ; int MsgUnifiedEditorView::addAttachment(class QString const &)
+	?doDelayedConstruction@MsgUnifiedEditorView@@AAEXXZ @ 11 NONAME ; void MsgUnifiedEditorView::doDelayedConstruction(void)
+	?onContentChanged@MsgUnifiedEditorView@@AAEXXZ @ 12 NONAME ; void MsgUnifiedEditorView::onContentChanged(void)
+	?staticMetaObject@MsgUnifiedEditorView@@2UQMetaObject@@B @ 13 NONAME ; struct QMetaObject const MsgUnifiedEditorView::staticMetaObject
+	?activateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 14 NONAME ; void MsgUnifiedEditorView::activateInputBlocker(void)
+	?resizeEvent@MsgUnifiedEditorView@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 15 NONAME ; void MsgUnifiedEditorView::resizeEvent(class QGraphicsSceneResizeEvent *)
+	?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@0H@Z @ 16 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class CFbsBitmap *, int)
+	?onDialogSmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 17 NONAME ; void MsgUnifiedEditorView::onDialogSmsSettings(class HbAction *)
+	?populateContent@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 18 NONAME ; void MsgUnifiedEditorView::populateContent(class QList<class QVariant> const &)
+	?onDialogMmsSettings@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 19 NONAME ; void MsgUnifiedEditorView::onDialogMmsSettings(class HbAction *)
+	?addCcBcc@MsgUnifiedEditorView@@AAEXXZ @ 20 NONAME ; void MsgUnifiedEditorView::addCcBcc(void)
+	?saveContentToDrafts@MsgUnifiedEditorView@@QAEHXZ @ 21 NONAME ; int MsgUnifiedEditorView::saveContentToDrafts(void)
+	?ProcessImageL@CUniImageProcessor@@QAEXAAVRFile@@0AAVTSize@@ABVTDesC8@@HH@Z @ 22 NONAME ; void CUniImageProcessor::ProcessImageL(class RFile &, class RFile &, class TSize &, class TDesC8 const &, int, int)
+	?generateFileName@MsgUnifiedEditorView@@AAE?AVQString@@AAV2@@Z @ 23 NONAME ; class QString MsgUnifiedEditorView::generateFileName(class QString &)
+	?metaObject@MsgUnifiedEditorView@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * MsgUnifiedEditorView::metaObject(void) const
+	?createVCards@MsgUnifiedEditorView@@AAEHABVQVariant@@AAVQStringList@@@Z @ 25 NONAME ; int MsgUnifiedEditorView::createVCards(class QVariant const &, class QStringList &)
+	?addSubject@MsgUnifiedEditorView@@AAEXXZ @ 26 NONAME ; void MsgUnifiedEditorView::addSubject(void)
+	?createTempFolder@MsgUnifiedEditorView@@AAE_NXZ @ 27 NONAME ; bool MsgUnifiedEditorView::createTempFolder(void)
+	?imagesFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 28 NONAME ; void MsgUnifiedEditorView::imagesFetched(class QVariant const &)
+	?setFocus@MsgUnifiedEditorView@@AAEXPAVMsgUnifiedEditorBaseWidget@@@Z @ 29 NONAME ; void MsgUnifiedEditorView::setFocus(class MsgUnifiedEditorBaseWidget *)
+	?vkbClosed@MsgUnifiedEditorView@@AAEXXZ @ 30 NONAME ; void MsgUnifiedEditorView::vkbClosed(void)
+	?serviceRequestError@MsgUnifiedEditorView@@AAEXHABVQString@@@Z @ 31 NONAME ; void MsgUnifiedEditorView::serviceRequestError(int, class QString const &)
+	?qt_metacast@MsgUnifiedEditorView@@UAEPAXPBD@Z @ 32 NONAME ; void * MsgUnifiedEditorView::qt_metacast(char const *)
+	?removeTempFolder@MsgUnifiedEditorView@@AAEXXZ @ 33 NONAME ; void MsgUnifiedEditorView::removeTempFolder(void)
+	?vkbOpened@MsgUnifiedEditorView@@AAEXXZ @ 34 NONAME ; void MsgUnifiedEditorView::vkbOpened(void)
+	?ScaleImageL@CUniImageProcessor@@QAEXAAVRFile@@AAPAVCFbsBitmap@@1AAVTSize@@H@Z @ 35 NONAME ; void CUniImageProcessor::ScaleImageL(class RFile &, class CFbsBitmap * &, class CFbsBitmap * &, class TSize &, int)
+	?addMenu@MsgUnifiedEditorView@@AAEXXZ @ 36 NONAME ; void MsgUnifiedEditorView::addMenu(void)
+	?enableSendButton@MsgUnifiedEditorView@@AAEX_N@Z @ 37 NONAME ; void MsgUnifiedEditorView::enableSendButton(bool)
+	?initView@MsgUnifiedEditorView@@AAEXXZ @ 38 NONAME ; void MsgUnifiedEditorView::initView(void)
+	??_EMsgUnifiedEditorView@@UAE@I@Z @ 39 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(unsigned int)
+	??1MsgUnifiedEditorView@@UAE@XZ @ 40 NONAME ; MsgUnifiedEditorView::~MsgUnifiedEditorView(void)
+	?setAttachOptionEnabled@MsgUnifiedEditorView@@AAEXW4TBE_AttachOption@1@_N@Z @ 41 NONAME ; void MsgUnifiedEditorView::setAttachOptionEnabled(enum MsgUnifiedEditorView::TBE_AttachOption, bool)
+	?hideChrome@MsgUnifiedEditorView@@AAEX_N@Z @ 42 NONAME ; void MsgUnifiedEditorView::hideChrome(bool)
+	?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 43 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *)
+	?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0@Z @ 44 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *)
+	?ScaleImageL@CUniImageProcessor@@QAEXPAVCFbsBitmap@@AAVRFile@@ABVTSize@@ABVTDesC8@@H@Z @ 45 NONAME ; void CUniImageProcessor::ScaleImageL(class CFbsBitmap *, class RFile &, class TSize const &, class TDesC8 const &, int)
+	?getStaticMetaObject@MsgUnifiedEditorView@@SAABUQMetaObject@@XZ @ 46 NONAME ; struct QMetaObject const & MsgUnifiedEditorView::getStaticMetaObject(void)
+	?tr@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString MsgUnifiedEditorView::tr(char const *, char const *, int)
+	?send@MsgUnifiedEditorView@@AAEXXZ @ 48 NONAME ; void MsgUnifiedEditorView::send(void)
+	?Reset@CUniImageProcessor@@QAEXXZ @ 49 NONAME ; void CUniImageProcessor::Reset(void)
+	?populateContentIntoEditor@MsgUnifiedEditorView@@AAEXABVConvergedMessage@@_N@Z @ 50 NONAME ; void MsgUnifiedEditorView::populateContentIntoEditor(class ConvergedMessage const &, bool)
+	?openDraftsMessage@MsgUnifiedEditorView@@QAEXABV?$QList@VQVariant@@@@@Z @ 51 NONAME ; void MsgUnifiedEditorView::openDraftsMessage(class QList<class QVariant> const &)
+	?addToolBar@MsgUnifiedEditorView@@AAEXXZ @ 52 NONAME ; void MsgUnifiedEditorView::addToolBar(void)
+	?contactsFetched@MsgUnifiedEditorView@@AAEXABVQVariant@@@Z @ 53 NONAME ; void MsgUnifiedEditorView::contactsFetched(class QVariant const &)
+	?removeAttachmentContainer@MsgUnifiedEditorView@@AAEXXZ @ 54 NONAME ; void MsgUnifiedEditorView::removeAttachmentContainer(void)
+	?trUtf8@MsgUnifiedEditorView@@SA?AVQString@@PBD0H@Z @ 55 NONAME ; class QString MsgUnifiedEditorView::trUtf8(char const *, char const *, int)
+	?onDialogDeleteMsg@MsgUnifiedEditorView@@AAEXPAVHbAction@@@Z @ 56 NONAME ; void MsgUnifiedEditorView::onDialogDeleteMsg(class HbAction *)
+	??0MsgUnifiedEditorView@@QAE@PAVQGraphicsItem@@@Z @ 57 NONAME ; MsgUnifiedEditorView::MsgUnifiedEditorView(class QGraphicsItem *)
+	?fetchContacts@MsgUnifiedEditorView@@AAEXXZ @ 58 NONAME ; void MsgUnifiedEditorView::fetchContacts(void)
+	?deleteMessage@MsgUnifiedEditorView@@AAEXXZ @ 59 NONAME ; void MsgUnifiedEditorView::deleteMessage(void)
+	?addAttachments@MsgUnifiedEditorView@@AAEXVQStringList@@@Z @ 60 NONAME ; void MsgUnifiedEditorView::addAttachments(class QStringList)
+	?deactivateInputBlocker@MsgUnifiedEditorView@@AAEXXZ @ 61 NONAME ; void MsgUnifiedEditorView::deactivateInputBlocker(void)
 
--- a/messagingapp/msgui/bwins/unifiedvieweru.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/bwins/unifiedvieweru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -3,18 +3,18 @@
 	?populateContent@UnifiedViewer@@QAEXH_NH@Z @ 2 NONAME ; void UnifiedViewer::populateContent(int, bool, int)
 	?handleDeleteAction@UnifiedViewer@@QAEXXZ @ 3 NONAME ; void UnifiedViewer::handleDeleteAction(void)
 	?metaObject@UnifiedViewer@@UBEPBUQMetaObject@@XZ @ 4 NONAME ; struct QMetaObject const * UnifiedViewer::metaObject(void) const
-	?resizeEvent@UnifiedViewer@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 5 NONAME ; void UnifiedViewer::resizeEvent(class QGraphicsSceneResizeEvent *)
-	??0UnifiedViewer@@QAE@HPAVQGraphicsItem@@@Z @ 6 NONAME ; UnifiedViewer::UnifiedViewer(int, class QGraphicsItem *)
+	?sendMessage@UnifiedViewer@@AAEXABVQString@@0@Z @ 5 NONAME ; void UnifiedViewer::sendMessage(class QString const &, class QString const &)
+	?resizeEvent@UnifiedViewer@@MAEXPAVQGraphicsSceneResizeEvent@@@Z @ 6 NONAME ; void UnifiedViewer::resizeEvent(class QGraphicsSceneResizeEvent *)
 	?handleFwdAction@UnifiedViewer@@QAEXXZ @ 7 NONAME ; void UnifiedViewer::handleFwdAction(void)
 	?qt_metacast@UnifiedViewer@@UAEPAXPBD@Z @ 8 NONAME ; void * UnifiedViewer::qt_metacast(char const *)
 	?createToolBar@UnifiedViewer@@AAEXXZ @ 9 NONAME ; void UnifiedViewer::createToolBar(void)
 	??1UnifiedViewer@@UAE@XZ @ 10 NONAME ; UnifiedViewer::~UnifiedViewer(void)
-	??_EUnifiedViewer@@UAE@I@Z @ 11 NONAME ; UnifiedViewer::~UnifiedViewer(unsigned int)
-	?qt_metacall@UnifiedViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12 NONAME ; int UnifiedViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?sendMessage@UnifiedViewer@@AAEXABVQString@@@Z @ 13 NONAME ; void UnifiedViewer::sendMessage(class QString const &)
+	?onDialogDeleteMsg@UnifiedViewer@@AAEXPAVHbAction@@@Z @ 11 NONAME ; void UnifiedViewer::onDialogDeleteMsg(class HbAction *)
+	??_EUnifiedViewer@@UAE@I@Z @ 12 NONAME ; UnifiedViewer::~UnifiedViewer(unsigned int)
+	?qt_metacall@UnifiedViewer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13 NONAME ; int UnifiedViewer::qt_metacall(enum QMetaObject::Call, int, void * *)
 	?tr@UnifiedViewer@@SA?AVQString@@PBD0@Z @ 14 NONAME ; class QString UnifiedViewer::tr(char const *, char const *)
-	?validateMsgForForward@UnifiedViewer@@AAE_NXZ @ 15 NONAME ; bool UnifiedViewer::validateMsgForForward(void)
-	?getStaticMetaObject@UnifiedViewer@@SAABUQMetaObject@@XZ @ 16 NONAME ; struct QMetaObject const & UnifiedViewer::getStaticMetaObject(void)
+	?getStaticMetaObject@UnifiedViewer@@SAABUQMetaObject@@XZ @ 15 NONAME ; struct QMetaObject const & UnifiedViewer::getStaticMetaObject(void)
+	??0UnifiedViewer@@QAE@HHPAVQGraphicsItem@@@Z @ 16 NONAME ; UnifiedViewer::UnifiedViewer(int, int, class QGraphicsItem *)
 	?staticMetaObject@UnifiedViewer@@2UQMetaObject@@B @ 17 NONAME ; struct QMetaObject const UnifiedViewer::staticMetaObject
 	?trUtf8@UnifiedViewer@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString UnifiedViewer::trUtf8(char const *, char const *, int)
 	?clearContent@UnifiedViewer@@QAEXXZ @ 19 NONAME ; void UnifiedViewer::clearContent(void)
--- a/messagingapp/msgui/conversationview/conversationview.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/conversationview.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -21,21 +21,21 @@
               inc \
               ../inc \ 
               src
-    					
+
 INCLUDEPATH += .
 INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../msgaudiofetcher/inc
 INCLUDEPATH += ../msguiutils/inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
 INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc
 INCLUDEPATH += ../appengine/inc
 INCLUDEPATH += ../../smartmessaging/ringbc/inc
+INCLUDEPATH += ../../msgsettings/settingsview/inc
+INCLUDEPATH += ../../msgutils/unidatamodel/univcaldataplugin/inc
 
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += /ext/mw/qthighway/inc
-INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include
-INCLUDEPATH += ../../msgutils/unidatamodel/univcaldataplugin/inc
 
 CONFIG += hb
+HB += hbfeedback
 QT += sql
 
 TARGET.UID3 = 0x20024322
@@ -54,8 +54,6 @@
 HEADERS += inc/msgconversationview.h \
     inc/msgconversationviewitem.h \
     inc/msgconversationwidget.h \
-    inc/msgcharcounter_p.h \
-    inc/msgcharcounter.h \
     inc/msgviewutils.h \
     ../../../inc/msgconversationviewdefines.h \
     inc/msgcontactcardwidget.h \
@@ -67,8 +65,6 @@
 SOURCES += src/msgconversationview.cpp \
     src/msgconversationviewitem.cpp \
     src/msgconversationwidget.cpp \
-    src/msgcharcounter_p.cpp \
-    src/msgcharcounter.cpp \
     src/msgviewutils.cpp \
     src/msgcontactcardwidget.cpp \
     src/msgeditorwidget.cpp \
@@ -76,10 +72,17 @@
     
 RESOURCES += conversationview.qrc
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/conversationview.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/conversationview.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
 
 # Libs
 LIBS += -lappengine \
-    -ls60qconversions \
     -lconvergedmessageutils \
     -lapgrfx \
     -lefsrv \
@@ -97,5 +100,9 @@
     -lunieditorpluginloader \
     -lgsmu \
     -lsmcm \
-    -leditorgenutils
+    -leditorgenutils \
+    -lthumbnailmanagerqt \    
+    -lxqsettingsmanager \
+    -lxqutils \
+    -lmsgaudiofetcher
 
--- a/messagingapp/msgui/conversationview/conversationview.qrc	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/conversationview.qrc	Fri Jun 25 15:47:40 2010 +0530
@@ -2,4 +2,16 @@
     <qresource prefix="/">
         <file alias="qtg_anim_loading.axml">resources/qtg_anim_loading.axml</file>
     </qresource>
+    <qresource prefix="/layouts">
+        <file alias="msgcontactcardwidget.css">resources/layouts/msgcontactcardwidget.css</file>
+        <file alias="msgcontactcardwidget.widgetml">resources/layouts/msgcontactcardwidget.widgetml</file>
+        <file alias="msgconversationviewitem.css">resources/layouts/msgconversationviewitem.css</file>
+        <file alias="msgconversationviewitem.widgetml">resources/layouts/msgconversationviewitem.widgetml</file>
+        <file alias="msgconversationwidget.css">resources/layouts/msgconversationwidget.css</file>
+        <file alias="msgconversationwidget.widgetml">resources/layouts/msgconversationwidget.widgetml</file>
+        <file alias="msgconversationwidget_color.css">resources/layouts/msgconversationwidget_color.css</file>
+        <file alias="msgeditorwidget.css">resources/layouts/msgeditorwidget.css</file>
+        <file alias="msgeditorwidget.widgetml">resources/layouts/msgeditorwidget.widgetml</file>
+        <file alias="msgcontactcardwidget_color.css">resources/layouts/msgcontactcardwidget_color.css</file>
+    </qresource>
 </RCC>
--- a/messagingapp/msgui/conversationview/inc/msgcharcounter.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * 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:Implements QT functionality to get message pdu details.
- *
- */
-
-#ifndef MSGCHARCOUNTER_H
-#define MSGCHARCOUNTER_H
-
-// INCLUDES
-#include <QObject>
-
-// FORWARD DECLARATIONS
-class MsgCharCounterPrivate;
-
-// CLASS DECLARATION
-
-/**
- * MsgCharCounter
- * 
- * This class is a QT public class which provides methods to set encoding
- * settings and get the PDU info.
- */
-class MsgCharCounter : public QObject
-{
-	Q_OBJECT
-
-public:
-
-	/**
-	 * Default Constructor.
-	 */
-	MsgCharCounter(QObject *parent = 0);
-
-	/**
-	 * Destructor.
-	 */
-	~MsgCharCounter();
-	
-	/**
-	 * To Set encoding settings like encoding type, character support and
-	 * alternative encoding if any.
-	 */
-	void setEncodingSettings();
-	
-	/**
-	 * Gets the PDU info like, number of PDUs, number of remaining chars in last
-	 * PDU and encoding types used.
-	 * @param buf PDU buffer as input.
-	 * @param numOfRemainingChars output
-	 * @param numOfPDUs output
-	 * @param unicodeMode output
-	 * @param alternativeEncodingType output
-	 */
-	void getNumPDUs(const QString &buf, int &numOfRemainingChars,
-				int &numOfPDUs, bool &unicodeMode,
-				int &alternativeEncodingType);
-
-private:
-
-	/**
-	 * Pointer to S60 class MsgFetcherPrivate.
-	 * Own.
-	 */
-	MsgCharCounterPrivate *d_ptr;
-};
-
-#endif /* MSGCHARCOUNTER_H */
-
-// EOF
--- a/messagingapp/msgui/conversationview/inc/msgcharcounter_p.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-/*
- * 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:Implements Symbian functionality to get message pdu details.
- *
- */
-
-#ifndef MSGCHARCOUNTER_P_H
-#define MSGCHARCOUNTER_P_H
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-#include <gsmuelem.h>
-
-// FORWARD DECLARATIONS
-class MsgCharCounter;
-class CParaFormatLayer;
-class CCharFormatLayer;
-class CRichText;
-class CSmsHeader;
-class QString;
-
-// CLASS DECLARATION
-
-/**
- * MsgCharCounterPrivate
- *
- * This class is a Symbian private class which provides methods to set encoding
- * settings and get the PDU info.
- */
-class MsgCharCounterPrivate
-{
-public:
-
-    /**
-     * Two-phased constructor.
-     * @param msgCharCounter Ptr to MsgCharCounter.
-     */
-    static MsgCharCounterPrivate* newL(MsgCharCounter* msgCharCounter);
-
-    /**
-     * Destructor.
-     */
-    ~MsgCharCounterPrivate();
-
-    /**
-     * To Set encoding settings like encoding type, character support and
-     * alternative encoding if any.
-     * @param unicodeMode True if unicode.
-     * @param alternativeEncodingType Alternative 7bit encoding combinations.
-     * @param charSupportType Character support type, full or reduced.
-     */
-    void setEncodingSettings(bool unicodeMode, int alternativeEncodingType,
-        int charSupportType);
-
-    /**
-     * Gets the PDU info like, number of PDUs, number of remaining chars in last
-     * PDU and encoding types used.
-     * @param buf PDU buffer as input.
-     * @param numOfRemainingChars output
-     * @param numOfPDUs output
-     * @param unicodeMode output
-     * @param alternativeEncodingType output
-     */
-    void getNumPDUs(const QString &buf, int &numOfRemainingChars,
-        int &numOfPDUs, bool &unicodeMode, int &alternativeEncodingType);
-
-private:
-
-    /**
-     * Constructor for performing 1st stage construction
-     * @param .
-     */
-    MsgCharCounterPrivate(MsgCharCounter *msgCharCounter);
-
-    /**
-     * EPOC default constructor for performing 2nd stage construction
-     */
-    void constructL();
-
-private:
-    // Data
-
-    /**
-     * Ptr to QT class MsgCharCounter.
-     * Not Own.
-     */
-    MsgCharCounter *q_ptr;
-
-    /**
-     * Paragraph format layer.
-     * Own.
-     */
-    CParaFormatLayer* mParaFormatLayer;
-
-    /**
-     * Character format layer.
-     * Own.
-     */
-    CCharFormatLayer* mCharFormatLayer;
-
-    /**
-     * Text with rich formatting.
-     * Own.
-     */
-    CRichText* mRichText;
-
-    /**
-     * SMS MTM encapsulation of an SMS message.
-     * Own.
-     */
-    CSmsHeader* mSmsHeader;
-
-    /**
-     * True if message is converted to unicode.
-     */
-    TBool mUnicodeMode;
-
-    /**
-     * Character support, full or reduced.
-     */
-    TInt mCharSupportType;
-
-    /**
-     * GSM encoding type.
-     */
-    TSmsEncoding mAlternativeEncodingType;
-
-};
-
-#endif // MSGCHARCOUNTER_P_H
-
-//EOF
--- a/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgcontactcardwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,15 +25,15 @@
 class HbIconItem;
 class HbTextItem;
 class HbIcon;
-class QGraphicsSceneMouseEvent;
-class HbGestureSceneFilter;
+class ThumbnailManager;
 
 #include "convergedmessageaddress.h"
 
 /**
- * This class is a custom layout widget for Contact Card layout.
+ * @class MsgContactCardWidget
+ * @brief This class is a custom layout widget for Contact Card layout.
  */
-class MsgContactCardWidget : public HbWidget
+class MsgContactCardWidget: public HbWidget
 {
 Q_OBJECT
 
@@ -78,33 +78,27 @@
      * Refreshes all the Contact card fields.
      */
     void updateContents();
-    
 
     /**
      * Clears  all the Contact card fields.
      */
     void clearContent();
-    
+
+signals:
+
     /**
-     * for tactile feed back.
-     */
-    HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
-    
-    /**
-     * To connect/disconnect clicked signal
+     *
      */
-    void connectSignals(bool yes);
-    
+    void conversationIdChanged(qint64 convId);
+
 protected:
+
     /**
-     * reimplemented from base class.
+     * Event handler for gesture events.
+     * Reimplemented from HbWidgetBase.
+     * @see HbWidgetBase
      */
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
-    
-    /**
-     * reimplemented from base class.
-     */
-    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    virtual void gestureEvent(QGestureEvent *event);
 
 private:
 
@@ -112,85 +106,93 @@
      * Initialization function.
      */
     void init();
-    
+
     /** Helper method to get contact id against phone number.
      * @param value phone number.
      */
     int resolveContactId(const QString& value);
+
+    /**
+     * Handles pressed state.
+     */
+    void setPressed(bool pressed);
+
+private slots:
+
+    /**
+     * show longp tap.
+     */
+    void handleLongTap(const QPointF &position);
     
     /**
-     * Helper method to set back ground.
-     */
-    void setBackGround(const QString& bg);
-    
-private slots:
-    /**
-     * show longpress menu for attachment object
+     * handles short tap.
      */
-    void handleLongPress(QPointF position);
-    
-    /**
-     * Helper method to initialize gesture.
-     */
-    void initGesture();
-	
+    void handleShortTap(const QPointF &position);
+
     /**
      * Slot for handling valid returns from the framework.
      * Updates the display name in the contact card widget.
      * @param result const QVariant&
      */
     void handleOk(const QVariant& result);
-    
+
     /**
      * Slot for handling errors. Error ids are provided as 
      * 32-bit integers.
      * @param errorCode qint32
      */
     void handleError(int errorCode, const QString& errorMessage);
-	    
+
     /**
      * Called when clicked() signal is emitted
      * Launches phonebook to view an existing contact 
      * or to add a new contact
      */
     void openContactInfo();
-    
+
     /**
      * Launches Dialer Service 
      */
     void call();
-    
+
     /**
      * Adds unknown number to phonebook
      */
     void addToContacts();
-    
+
     /**
      * Called after service request is completed.
      */
     void onServiceRequestCompleted();
+
+    /**
+     * Slot hit when the thumbnail is ready.
+     */
+    void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
+
+    /**
+     * Ignore gesture events.
+     */
+    void ignoreSignals(bool yes);
     
-signals:
-   /**
-	* Emitted when contact card is short tapped.
-	*/
-    void clicked();
-    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
 
 private:
-    // Data
-
 
     /**
-     * To supress short tap if long tap triggered.
+     * Bool variable on which gesture events are accepted/ignored.
      */
-    bool mMenuShown;  
-	
-	/**
+    bool mIgnoreEvents;
+
+    /**
      * Contact Number for the conversation
      */
     QString mContactNumber;
-	
+
     /**
      * Address string.
      */
@@ -213,15 +215,12 @@
      * Own.
      */
     HbTextItem *mAddressTextItem;
-	   
+
     /**
-     * gesture filter for long press.
-     */    
-    HbGestureSceneFilter* mGestureFilter;
-	
-
-    
-  
+     * ThumbnailManager
+     * Own.
+     */
+    ThumbnailManager *mThumbnailManager;
 };
 
 #endif // MSGCONTACTCARDWIDGET_H
--- a/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationbaseview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -1,20 +1,19 @@
 /*
-* 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:Conversation Base view.
+ * 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:Conversation Base view.
+ *
+ */
 
 #ifndef MSG_CONVERSATION_VIEW_INTERFACE_H
 #define MSG_CONVERSATION_VIEW_INTERFACE_H
@@ -25,6 +24,7 @@
 #define CONVERSATION_VIEW_EXPORT Q_DECL_IMPORT
 #endif
 
+#include <xqsettingskey.h>
 #include "msgbaseview.h"
 
 // FORWARD DECLARATIONS
@@ -32,17 +32,19 @@
 class HbListWidgetItem;
 class MsgContactCardWidget;
 class QGraphicsLinearLayout;
+class XQSettingsManager;
+class XQPublishAndSubscribeUtils;
 
-class CONVERSATION_VIEW_EXPORT MsgConversationBaseView : public MsgBaseView
-    {
-    Q_OBJECT
+class CONVERSATION_VIEW_EXPORT MsgConversationBaseView: public MsgBaseView
+{
+Q_OBJECT
 
 public:
 
     /**
      * Constructor
      */
-    MsgConversationBaseView(QGraphicsItem* parent=0);
+    MsgConversationBaseView(QGraphicsItem* parent = 0);
 
     /**
      * Destructor
@@ -67,85 +69,119 @@
     /**
      * saveContentToDrafts
      * Saves the editors content in cv to drafts
+     * @return valid message id if save is success
+     * else invalid message id ( i.e. -1 )
      */
-    void saveContentToDrafts();
+    int saveContentToDrafts();
 
-public slots:   
+    /**
+     * conversationId
+     * Get the conversationId
+     */
+    qint64 conversationId();
+
+public slots:
     /**
      * Close the conversation view 
      * This slot is triggered when user presses back(seconday sofykey)
      */
     void closeConversationView();
-    
+
     /**
      * Mark messages as read
      * Slot is triiggered when replying started
      */
     void markMessagesAsRead();
-	   
+
+    /**
+     * Publish the conversation id based on the flag.
+     * @param setId if true previous conversation id 
+     * will be published else -1 will be published.
+     */
+    void setPSCVId(bool setId);
+
 private slots:
-   /**
-   * Slot for delayed construction
-   */
+    /**
+     * Slot for delayed construction
+     */
     void doDelayedConstruction();
-    
-	/**
-	* Hides chrome when itu-t is up
-	*/
+
+    /**
+     * Hides chrome when itu-t is up
+     */
     void hideChrome(bool hide);
-	
-	/**
+
+    /**
      * Slot for handling valid returns from the framework.
      * 
      * @param result const QVariant&
      */
     void handleOk(const QVariant& result);
-    
+
     /**
      * Slot for handling errors. Error ids are provided as 
      * 32-bit integers.
      * @param errorCode qint32
      */
     void handleError(int errorCode, const QString& errorMessage);
-    
- 
- signals:
-     /**
-      * Signal emitted when the conversation view is closed.
-      */
-    void conversationViewClosed(); 
-    
-private :
+
+    /**
+     * Slot for handling the timer expiry event fired from view reay indication
+     */
+    void handleViewReady();
+
+    /**
+     *
+     */
+    void handleConversationIdChange(qint64 convId);
+
+signals:
+    /**
+     * Signal emitted when the conversation view is closed.
+     */
+    void conversationViewClosed();
+
+private:
     /**
      * Create and initialise the view
      */
     void initView();
-    
+
 private:
-   
-   /**
+
+    /**
      * Conversation ID
      */
     qint64 mConversationId;
-   
+
     /**
      * MsgConversationView, main view class
      * Owned
      */
-    MsgConversationView *mConversationView;  
-    
+    MsgConversationView *mConversationView;
+
     /**
      * Contact card widget.
      */
     MsgContactCardWidget* mContactCard;
-    
+
     /**
      * Main layout.
      */
     QGraphicsLinearLayout* mMainLayout;
 
-    };
+    /**
+     * Object of XQSettingsKey. 
+     */
+    XQSettingsKey mCVIdkey;
+
+    /**
+     * mSettingsManager
+     * Instance of the XQSettingsManager
+     * Own.
+     */
+    XQSettingsManager* mSettingsManager;
+};
 
 #endif // MSG_CONVERSATION_VIEW_INTERFACE_H
-
 // EOF
--- a/messagingapp/msgui/conversationview/inc/msgconversationview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -32,7 +32,7 @@
 class MsgConversationViewItem;
 class HbStaticVkbHost;
 class QGraphicsLinearLayout;
-
+class HbAction;
 //Defines
 #define INVALID_MSG_ID -1
 
@@ -66,9 +66,10 @@
 
     /**
      * Save the content inside editor to drafts
-     * @return true if save is success else false.
+     * @return valid message id if save is success
+     * else invalid message id ( i.e. -1 )
      */
-    bool saveContentToDrafts();
+    int saveContentToDrafts();
 
 private slots:
 
@@ -77,7 +78,47 @@
      * Populates the menu with relevant actions.
      */
     void menuAboutToShow();
+    
+	/**
+     * This slot is called when settings dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogSettingsLaunch(HbAction* action);
+    
+	/**
+     * This slot is called when delete message centre dialog is launched.
+     * @param action selected action (yes or no).
+     */	
+    void onDialogdeleteMsg(HbAction* action);
+	
+	/**
+     * This slot is called when download message centre dialog is launched.
+     * @param action selected action (yes or no).
+     */	    
+    void onDialogDownLoadMsg(HbAction* action);
+	
+	/**
+     * This slot is called when save tone dialog is launched.
+     * @param action selected action (yes or no).
+     */	
+    void onDialogSaveTone(HbAction* action);
 
+    /**
+     * This slot is called when the orientation is changed
+     * @param newOrientation orientation
+     */
+    void onOrientationChanged(Qt::Orientation newOrientation);
+
+    /**
+     * This slot is called when the orientation is about to bechanged
+     */
+    void onOrientationAboutToBeChanged();
+    
+    /**
+     * This slot is called when the view is successfully added to main window
+     */
+    void onViewReady();
+    
 private:
 
     /**
@@ -106,6 +147,15 @@
     void setContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
 	
     /**
+     * Adds context menu entry to context menu for saving items
+     * @param MsgConversationViewItem* item whose information is needed.
+     * @param HbMenu context menu
+     * @param int sendingstate.
+     * @see ConvergedMessage::MessageType
+     */    
+    void addSaveItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu, int sendingState);
+    
+    /**
      * Adds context menu entry to context menu for Opening items
 	 * @param MsgConversationViewItem* item whose information is needed.
      * @param HbMenu context menu
@@ -148,15 +198,6 @@
      * @see ConvergedMessage::MessageType
      */
     void addDownloadItemToContextMenu(MsgConversationViewItem* item, HbMenu* contextMenu);
-    
-    /**
-     * Validates if message can be forwarded
-     * @param messageType
-     * @param messageId
-     * @return true if message can be forwarded
-     *         false if message cant be forwarded
-     */
-    bool validateMsgForForward(int &messageType,qint32 &messageId);
 
     /**
      * Launches the BT message display service.
@@ -177,6 +218,8 @@
      * Utility method to scroll the list to show the bottom most item
      */
     void scrollToBottom();
+    
+    void onConversationViewEmpty();
 
     /**
      * Handler for long tap of a list item.
@@ -224,11 +267,6 @@
      */
     void contactsFetched(const QVariant& value);
 
-    /*
-     * Get audio files from audio-fetcher and launch editor
-     */
-    void audiosFetched(const QVariant& result );
-    
     /**
      * slot to receive fetched contacts for vcard addition
      */
@@ -295,10 +333,11 @@
      */
     void replyStarted();
     
-	/**
-	* This signal is emitted when vkb is open.
-	*/
-    void hideChrome(bool);
+   /**
+    * This signal is emitted when vkb is open/closed.
+    * @param state True if keypad is opened else false.
+    */
+    void vkbOpened(bool state);
 
 private slots:
     /**
@@ -336,6 +375,12 @@
      * Deactivate Input Blocker
      */
     void deactivateInputBlocker();
+    
+    /**
+     * Handle provisioning message
+     * @param msgId message id
+     */
+    void handleProvisoningMsg(int msgId);
 
 private:
 
@@ -371,10 +416,6 @@
      */
     QGraphicsLinearLayout *mMainLayout;
 
-	/**
-	 * Flag to track if item has been long pressed.
-	 */
-    bool mItemLongPressed;
     /*
      * Instance of VKB 
      */
@@ -385,6 +426,11 @@
      */
     bool mVkbopened;
 
+    /**
+     * variable holding the visible model index
+     */
+    QModelIndex mVisibleIndex;
+
 };
 
 #endif // MSG_CONVERSATION_VIEW_H
--- a/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationviewitem.h	Fri Jun 25 15:47:40 2010 +0530
@@ -20,6 +20,7 @@
 
 // INCLUDES
 #include <HbListViewItem>
+#include "convergedmessage.h"
 
 //Forward Declarations
 class MsgConversationWidget;
@@ -89,7 +90,32 @@
      * Set the Icon that displays the message notification state.
      */
     void setNotificationStateIcon(int notificationState);
+    
+    /*
+     * Update item with sms content
+     */
+    void updateSmsTypeItem(const QModelIndex& index, int messageSubType =
+            ConvergedMessage::None);
 
+    /*
+     * Update item with mms type content
+     */
+    void updateMmsTypeItem(const QModelIndex& index, int messageType,
+        int messageSubType);
+
+    /*
+     * Initializes the msgconverstionviewitem
+     */
+    void init();
+
+private slots:    
+
+    /*
+     * Handler for orientation changed
+     * @param orientation Qt::Orientation
+     */
+    void orientationchanged(Qt::Orientation orientation);
+    
 protected:
 
     /**
@@ -114,10 +140,17 @@
     MsgConversationWidget *mConversation;
 
     /**
+     * Graphics Item to hold message incoming state. 
+     * Applicable for notification
+     * Owned
+     */
+    HbIconItem *mIncomingMsgStateIconItem;
+
+    /**
      * Graphics Item to hold message sending state.
      * Owned
      */
-    HbIconItem *mMessageStateIconItem;
+    HbIconItem *mOutgoingMsgStateIconItem;
 };
 
 #endif // MSG_CONVERSATION_VIEW_ITEM_H
--- a/messagingapp/msgui/conversationview/inc/msgconversationwidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgconversationwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -20,6 +20,7 @@
 
 // SYSTEM INCLUDES
 #include <hbwidget.h>
+#include <HbIcon>
 
 // FORWORD DECLARATIONS
 class HbFrameItem;
@@ -30,24 +31,23 @@
  * This class represents the custom layouted widget to show
  * the conversation inside a bubble shape in the conversation view.
  */
-class MsgConversationWidget : public HbWidget
+class MsgConversationWidget: public HbWidget
 {
 Q_OBJECT
 
-    Q_PROPERTY(int priority READ priority WRITE setPriority)
-    Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment)
-    Q_PROPERTY(bool hasImage READ hasImage WRITE setImage)
-    Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio)
-    Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo)
-    Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable)
-    Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
-    Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS)
-    Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification)
-    Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread)
-    Q_PROPERTY(int sendingState READ sendingState WRITE setSendingState)
-    Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState)
-
-    Q_ENUMS(MessageState)
+Q_ENUMS(SendingState)
+Q_PROPERTY(int priority READ priority WRITE setPriority)
+Q_PROPERTY(bool hasAttachment READ hasAttachment WRITE setAttachment)
+Q_PROPERTY(bool hasImage READ hasImage WRITE setImage)
+Q_PROPERTY(bool hasAudio READ hasAudio WRITE setAudio)
+Q_PROPERTY(bool hasVideo READ hasVideo WRITE setVideo)
+Q_PROPERTY(bool isPlayable READ isPlayable WRITE setPlayable)
+Q_PROPERTY(bool isIncoming READ isIncoming WRITE setIncoming)
+Q_PROPERTY(bool isMMS READ isMMS WRITE setMMS)
+Q_PROPERTY(bool isMMSNotification READ isMMSNotification WRITE setMMSNotification)
+Q_PROPERTY(bool isUnread READ isUnread WRITE setUnread)
+Q_PROPERTY(SendingState sendingState READ sendingState WRITE setSendingState)
+Q_PROPERTY(int notificationState READ notificationState WRITE setNotificationState)
 
 public:
 
@@ -66,6 +66,15 @@
 public:
 
     /**
+     * Enum defining Message Sending State
+     * @attention This enum can have values from 0 to 255 only.
+     */
+    enum SendingState
+    {
+        Unknown = 0x00, Sent = 0x01, Sending = 0x02, Pending = 0x03, Failed = 0x04
+    };
+
+    /**
      * Set subject for this widget
      * @param QString
      */
@@ -78,10 +87,10 @@
     void setBodyText(const QString &bodyText);
 
     /**
-     * Set preview icon path for this widget
-     * @param QString
+     * Set preview icon for this widget
+     * @param HbIcon, preview-icon
      */
-    void setPreviewIconPath(const QString &previewPath);
+    void setPreviewIcon(HbIcon& icon);
 
     /**
      * Set priority property
@@ -210,7 +219,7 @@
      * @return bool
      */
     bool isMMSNotification();
-    
+
     /**
      * Set the sending state.
      * Maps ConvergedMessage::SendingState to MessageState.
@@ -222,7 +231,7 @@
      * Returns the sending state.
      * @return Returns one of the states from enum SendingState.
      */
-    int sendingState();
+    SendingState sendingState();
 
     /**
      * Set the notification state.
@@ -236,7 +245,7 @@
      * @return Returns one of the states from enum NotificationState.
      */
     int notificationState();
-    
+
     /**
      * Sets the Timestamp.
      * @param timeStamp Timestamp to be set.
@@ -264,6 +273,31 @@
      */
     void pressStateChanged(bool pressed, bool animate);
 
+	/**
+     * Function to reset widget items.
+     */
+    void resetProperties();
+
+    /**
+     * Function to repolish widget.
+     */
+    void repolishWidget();
+
+protected:
+    
+    /*
+     * @see HbWidget
+     */
+    virtual void polish(HbStyleParameters &params);
+    
+private slots:
+	
+    /*
+     * Handler for orientation changed
+     * @param orientation Qt::Orientation
+     */
+	void orientationchanged(Qt::Orientation orientation);
+		
 private:
 
     /**
@@ -274,19 +308,6 @@
 public:
 
     /**
-     * Enum defining Message Sending State
-     * @attention This enum can have values from 0 to 255 only.
-     */
-    enum MessageState
-    {
-        Unknown = 0x00,
-        Sent = 0x01,
-        Sending = 0x02,
-        Pending = 0x03,
-        Failed = 0x04
-    };
-    
-    /**
      * Enum defining MMS Notification's Msg State
      * These are added here so that notification state 
      * can be used inside css in future
@@ -294,13 +315,13 @@
      * Add any new states only at the bottom of this enum
      */
     enum NotificationState
-        {
+    {
         NotifUnknown = 0x00,
         NotifReadyForFetching = 0x01,
         NotifRetrieving = 0x02,
         NotifExpired = 0x03,
-        NotifFailed = 0x04, 
-        };
+        NotifFailed = 0x04,
+    };
 
 private:
 
@@ -355,7 +376,7 @@
      * Holds info if this widget is MMS Notification
      */
     bool mIsMMSNotification;
-    
+
     /**
      * Info about message priority.
      * @attention Stores high/low/normal priority.
@@ -366,13 +387,13 @@
     /**
      * Holds sending state information.
      */
-    int mSendingState;
+    MsgConversationWidget::SendingState mSendingState;
 
     /**
      * Holds Notification state information.
      */
     int mNotificationState;
-    
+
     /**
      * Graphics Item to hold new message icon.
      * Owned
--- a/messagingapp/msgui/conversationview/inc/msgeditorwidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/inc/msgeditorwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -26,6 +26,7 @@
 class HbPushButton;
 class HbFrameItem;
 class HbTextItem;
+class HbAction;
 class UniEditorPluginLoader;
 class UniEditorPluginInterface;
 class UniEditorGenUtils;
@@ -100,7 +101,7 @@
     /**
      * This function does initialisations needed for character counter
      */
-    void setEncodingSettings();
+    void setEncodingSettingsL();
    
 signals:
 
@@ -150,6 +151,12 @@
      */  
     void onPressed();
     void onReleased();
+	
+	/**
+     * This slot is called when sms char limit reached dialog is launched.
+     * @param action selected action (yes or no).
+     */	
+    void onSmsCharLimitReached(HbAction* action);
 
 private:
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,37 @@
+
+MsgContactCardWidget
+{
+  layout:layout-msg-mycard;
+  zvalue:3;
+}
+
+MsgContactCardWidget::avatar
+{
+  left:-var(hb-param-margin-gene-left);
+  top:-1.0un;
+  bottom:1.0un;
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-primary-large);
+  pref-height:var(hb-param-graphic-size-primary-large);
+}
+
+MsgContactCardWidget::presence
+{
+  right:var(hb-param-margin-gene-right);
+  center-vertical:0un;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-secondary);
+  pref-hieght:var(hb-param-graphic-size-secondary);
+}
+
+MsgContactCardWidget::addressText
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  center-vertical:0un;
+  text-height:var(hb-param-text-height-primary);
+  font-variant:primary;
+  text-line-count-min:1;
+  text-line-count-max:1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,14 @@
+<hbwidget version="0.1">
+  <layout name="layout-msg-mycard" type="mesh">
+    <meshitem src="avatar" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+    <meshitem src="avatar" srcEdge="TOP" dst="" dstEdge="TOP"/>
+    <meshitem src="avatar" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+
+    <meshitem src="presence" srcEdge="CENTERV" dst="addressText" dstEdge="CENTERV"/>
+    <meshitem src="presence" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+
+    <meshitem src="addressText" srcEdge="LEFT" dst="avatar" dstEdge="RIGHT"/>
+    <meshitem src="addressText" srcEdge="RIGHT" dst="presence" dstEdge="LEFT"/>
+    <meshitem src="addressText" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+  </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgcontactcardwidget_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,10 @@
+
+MsgContactCardWidget[state="normal"]::addressText
+{
+  color:var(qtc_groupbox_normal);
+}
+
+MsgContactCardWidget[state="pressed"]::addressText
+{
+  color:var(qtc_groupbox_pressed);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,34 @@
+MsgConversationViewItem
+{
+    layout:layout-conversation;
+    pref-height:-1;
+    pref-width:-1;
+    size-policy-vertical:minimum-expanding;
+}
+
+MsgConversationViewItem::msgconvwidget
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  top:0.0un;
+  right:var(hb-param-margin-gene-middle-horizontal);
+  bottom:0.0un;
+}
+
+MsgConversationViewItem::msgStateIconIncoming
+{
+  right:var(hb-param-margin-gene-right);
+  size-policy:fixed fixed;
+  aspect-ratio:ignore;
+  pref-height:var(hb-param-graphic-size-primary-small);
+  pref-width:var(hb-param-graphic-size-primary-small);
+}
+
+MsgConversationViewItem::msgStateIconOutgoing
+{
+  left:-var(hb-param-margin-gene-left);
+  size-policy:fixed fixed;
+  aspect-ratio:ignore;
+  pref-height:var(hb-param-graphic-size-primary-small);
+  pref-width:var(hb-param-graphic-size-primary-small);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationviewitem.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,14 @@
+<hbwidget version="0.1">
+  <layout name="layout-conversation" type="mesh">
+    <meshitem src="msgStateIconIncoming" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+    <meshitem src="msgStateIconIncoming" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+
+    <meshitem src="msgStateIconOutgoing" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+    <meshitem src="msgStateIconOutgoing" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+    
+    <meshitem src="msgconvwidget" srcEdge="RIGHT" dst="msgStateIconIncoming" dstEdge="LEFT" />
+    <meshitem src="msgconvwidget" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="msgconvwidget" srcEdge="LEFT" dst="msgStateIconOutgoing" dstEdge="RIGHT"/>
+    <meshitem src="msgconvwidget" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+  </layout>
+</hbwidget>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,187 @@
+
+/*********************************** LAYOUTS **********************************/
+
+@variables
+{
+  bubble_width:expr(var(hb-param-screen-width)-var(hb-param-margin-gene-middle-horizontal)-var(hb-param-graphic-size-primary-small)-var(hb-param-margin-gene-left)-var(hb-param-margin-gene-right));
+  bubble_height:expr((3*var(bubble_width))/4);
+}
+
+MsgConversationWidget:portrait
+{
+  layout:layout-msg-portrait;
+}
+
+MsgConversationWidget:landscape
+{
+  layout:layout-msg-landscape;
+}
+
+/********************* UNREAD INDICATOR / NEW ITEM ICON ************************/
+
+MsgConversationWidget::newItemIcon
+{
+  left:-0.25un;
+  top:-1.0un;
+  bottom:1.0un;
+  size-policy:fixed preferred;
+  fixed-width:1.25un;
+}
+
+/*********************************** BUBBLE ***********************************/
+
+MsgConversationWidget::bubble
+{
+  left:0.0un;
+  top:0.0un;
+  right:0.0un;
+  bottom:0.0un;
+  zvalue:-1;
+}
+
+/********************************** BODYTEXT **********************************/
+
+MsgConversationWidget::bodyText
+{
+  left:-var(hb-param-margin-gene-left);
+  top:-var(hb-param-margin-gene-top);
+  right:1.0un;
+  bottom:var(hb-param-margin-gene-middle-vertical);
+  text-height:var(hb-param-text-height-secondary);
+  font-variant:primary;
+  text-line-count-min:1;
+  text-line-count-max:30;
+}
+
+MsgConversationWidget[isMMS="true"]::bodyText
+{
+	top:-var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgConversationWidget[hasImage="true"]::bodyText:landscape
+{
+	left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+MsgConversationWidget[hasAudio="true"]::bodyText:landscape
+{
+	left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+/********************************** SUBJECT ***********************************/
+
+MsgConversationWidget::subject
+{
+  left:-var(hb-param-margin-gene-left);
+  top:-var(hb-param-margin-gene-top);
+  bottom:var(hb-param-margin-gene-middle-vertical);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  text-align:left;
+  text-height:var(hb-param-text-height-primary);
+  font-variant:primary;
+  text-line-count-min:1;
+  text-line-count-max:1;
+}
+
+MsgConversationWidget[isMMS="false"]::subject
+{
+  text-line-count-max:30;
+  text-height:var(hb-param-text-height-secondary);
+}
+
+MsgConversationWidget[hasImage="true"]::subject:landscape
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+MsgConversationWidget[hasImage="false"][hasAudio="true"]::subject:landscape
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+
+/******************************* ATTACHMENT ICON ******************************/
+
+MsgConversationWidget::attachment
+{
+  right:1.0un;
+  center-vertical:0.0un;
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-secondary);
+  pref-height:var(hb-param-graphic-size-secondary);
+}
+
+/********************************* PRIORITY ICON ******************************/
+
+MsgConversationWidget::priority
+{
+  right:0.5un;
+  center-vertical:0.0un;
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-secondary);
+  pref-height:var(hb-param-graphic-size-secondary);
+}
+
+/******************************** IMAGE / PREVIEW *****************************/
+
+MsgConversationWidget::preview
+{
+  left:-var(hb-param-margin-gene-left);
+  size-policy:fixed fixed;
+  aspect-ratio:ignore;
+}
+
+MsgConversationWidget::preview:landscape
+{
+  left:-var(hb-param-margin-gene-left);
+  top:-var(hb-param-margin-gene-top);
+  bottom:var(hb-param-margin-gene-bottom);
+  size-policy:fixed fixed;
+  aspect-ratio:ignore;
+}
+
+/****************************** TIMESTAMP TEXT ********************************/
+
+MsgConversationWidget::timeStamp
+{
+  left:-var(hb-param-margin-gene-left);
+  right:1.0un;
+  bottom:var(hb-param-margin-gene-bottom);
+  text-align:left;
+  text-height:var(hb-param-text-height-tiny);
+  font-variant:primary;
+  text-line-count-max:1;
+  text-line-count-min:1;
+}
+
+MsgConversationWidget[hasImage="true"]::timeStamp:landscape
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+MsgConversationWidget[hasAudio="true"]::timeStamp:landscape
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+}
+
+/******************************* OVERLAY PLAY ICON ****************************/
+
+MsgConversationWidget::playIcon
+{
+  zvalue:1;
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-primary-small);
+  pref-height:var(hb-param-graphic-size-primary-small);
+}
+
+MsgConversationWidget::playIcon:landscape
+{
+  top:-var(hb-param-margin-gene-top);
+}
+
+
+/* EOF */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,79 @@
+<hbwidget version="0.1">
+
+  <layout name="layout-msg-portrait" type="mesh">
+
+    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />   
+    <meshitem src="subject" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT"  spacer="rightSpacer"  />
+
+    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
+    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+
+    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+
+    <meshitem src="preview" srcEdge="TOP" dst="subject" dstEdge="BOTTOM" />
+    <meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+
+    <meshitem src="bodyText" srcEdge="TOP" dst="preview" dstEdge="BOTTOM" />
+    <meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+    <meshitem src="timeStamp" srcEdge="TOP" dst="bodyText" dstEdge="BOTTOM" />
+    <meshitem src="timeStamp" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
+    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+
+    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+    <meshitem src="playIcon" srcEdge="TOP" dst="subject" dstEdge="BOTTOM"/>
+    <meshitem src="playIcon" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
+
+  </layout>
+
+  <layout name="layout-msg-landscape" type="mesh">
+
+    <meshitem src="preview" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+
+    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />    
+    <meshitem src="subject" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
+    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
+
+    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
+    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+
+    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
+
+    <meshitem src="bodyText" srcEdge="TOP" dst="subject" dstEdge="BOTTOM" />
+    <meshitem src="bodyText" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
+    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+ 
+    <meshitem src="timeStamp" srcEdge="TOP" dst="bodyText" dstEdge="BOTTOM" />
+    <meshitem src="timeStamp" srcEdge="LEFT" dst="playIcon" dstEdge="RIGHT" />
+    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+
+    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
+    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+
+    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+
+    <meshitem src="playIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="playIcon" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
+
+  </layout>
+
+</hbwidget>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgconversationwidget_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,65 @@
+
+/********************************** BODYTEXT **********************************/
+MsgConversationWidget[isIncoming]::bodyText
+{
+  color:var(qtc_conv_list_received_normal);
+}
+
+MsgConversationWidget[isIncoming][isUnread]::bodyText
+{
+  color:var(qtc_conv_list_received_highlight);
+}
+
+MsgConversationWidget[!isIncoming]::bodyText
+{
+  color:var(qtc_conv_list_sent_highlight);
+}
+
+MsgConversationWidget[!isIncoming][sendingState="Sent"]::bodyText
+{
+  color:var(qtc_conv_list_sent_normal);
+}
+
+/********************************** SUBJECT ***********************************/
+MsgConversationWidget[isIncoming]::subject
+{
+  color:var(qtc_conv_list_received_normal);
+}
+
+MsgConversationWidget[isIncoming][isUnread]::subject
+{
+  color:var(qtc_conv_list_received_highlight);
+}
+
+MsgConversationWidget[!isIncoming]::subject
+{
+  color:var(qtc_conv_list_sent_highlight);
+}
+
+MsgConversationWidget[!isIncoming][sendingState="Sent"]::subject
+{
+  color:var(qtc_conv_list_sent_normal);
+}
+
+/****************************** TIMESTAMP TEXT ********************************/
+MsgConversationWidget[isIncoming]::timeStamp
+{
+  color:var(qtc_conv_list_received_normal);
+}
+
+MsgConversationWidget[isIncoming][isUnread]::timeStamp
+{
+  color:var(qtc_conv_list_received_highlight);
+}
+
+MsgConversationWidget[!isIncoming]::timeStamp
+{
+  color:var(qtc_conv_list_sent_highlight);
+}
+
+MsgConversationWidget[!isIncoming][sendingState="Sent"]::timeStamp
+{
+  color:var(qtc_conv_list_sent_normal);
+}
+
+/* EOF */
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,30 @@
+MsgEditorWidget
+{
+  layout:layout-msg-editor;
+}
+
+MsgEditorWidget::msgEditor
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  bottom:var(hb-param-margin-gene-middle-vertical);
+  top:-var(hb-param-margin-gene-middle-vertical); 
+  min-height:7.46un;
+}
+
+MsgEditorWidget::sendButton
+{
+  top:-var(hb-param-margin-gene-middle-vertical);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  bottom:var(hb-param-margin-gene-middle-vertical);
+  fixed-width: 9.34un;
+  fixed-height: 7.46un;
+}
+
+MsgEditorWidget::charCounter
+{
+	  size-policy:fixed fixed;
+	  pref-height:-1;
+	  pref-width:-1;
+	  text-height:var(hb-param-text-height-tiny);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/resources/layouts/msgeditorwidget.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,21 @@
+<hbwidget version="0.1">
+  <layout name="layout-msg-editor" type="mesh">
+
+    <meshitem src="msgEditor" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="msgEditor" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="msgEditor" srcEdge="RIGHT" dst="sendButton" dstEdge="LEFT" />
+    <meshitem src="msgEditor" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+    
+    <meshitem src="sendButton" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+    <meshitem src="sendButton" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+    
+    <meshitem src="charCounter" srcEdge="TOP" dst="msgEditor" dstEdge="TOP" />
+    <meshitem src="charCounter" srcEdge="RIGHT" dst="msgEditor" dstEdge="RIGHT" />
+
+    <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
+    <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
+    <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
+    <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" /> 
+    
+  </layout>
+</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/conversationview/src/msgcharcounter.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * 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:Implements QT functionality to get message pdu details.
- *
- */
-
-#include "msgcharcounter.h"
-#include "msgcharcounter_p.h"
-
-
-	enum MsgCharSupport
-	{
-		msgCharSupportFull = 0,
-		msgCharSupportReduced
-	};
-	
-// ---------------------------------------------------------------------------
-// Default Constructor.
-// ---------------------------------------------------------------------------
-//
-MsgCharCounter::MsgCharCounter( QObject *parent ):
-	QObject( parent )
-	{
-	d_ptr = MsgCharCounterPrivate::newL( this );
-	}
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-MsgCharCounter::~MsgCharCounter()
-{
-	if (d_ptr) {
-		delete d_ptr;
-		d_ptr = NULL;
-	}
-}
-
-// ---------------------------------------------------------------------------
-// Sets the encoding settings.
-// ---------------------------------------------------------------------------
-//
-void MsgCharCounter::setEncodingSettings()
-{
-	// Default values.
-	bool unicodeMode = false;
-	int alternativeEncodingType = 0;
-	int charSupportType = msgCharSupportFull;
-	
-	d_ptr->setEncodingSettings(unicodeMode, alternativeEncodingType,
-			charSupportType);
-}
-
-// ---------------------------------------------------------------------------
-// Gets the PDU details.
-// ---------------------------------------------------------------------------
-//
-void MsgCharCounter::getNumPDUs(const QString &buf,
-		int &numOfRemainingChars,
-		int &numOfPDUs,
-		bool &unicodeMode,
-		int &alternativeEncodingType)
-{
-	d_ptr->getNumPDUs(buf, numOfRemainingChars, numOfPDUs, unicodeMode,
-			alternativeEncodingType);
-}
-
-// EOF
--- a/messagingapp/msgui/conversationview/src/msgcharcounter_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * 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:Implements Symbian functionality to get message pdu details.
- *
- */
-#include "msgcharcounter_p.h"
-
-#include <smuthdr.h>
-#include <gsmuset.h>
-#include <gsmumsg.h>
-#include <txtetext.h>
-#include <txtrich.h>
-
-#include "msgcharcounter.h"
-#include "s60qconversions.h"
-
-enum MsgCharSupport
-{
-    msgCharSupportFull = 0, msgCharSupportReduced
-};
-
-// ---------------------------------------------------------------------------
-// Default Constructor ( 1st phase )
-// ---------------------------------------------------------------------------
-//
-MsgCharCounterPrivate::MsgCharCounterPrivate(MsgCharCounter *msgCharCounter) :
-    q_ptr(msgCharCounter)
-{
-    // No implementation required
-}
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-MsgCharCounterPrivate::~MsgCharCounterPrivate()
-{
-    q_ptr = NULL;
-
-    if (mParaFormatLayer)
-    {
-        delete mParaFormatLayer;
-        mParaFormatLayer = NULL;
-    }
-
-    if (mCharFormatLayer)
-    {
-        delete mCharFormatLayer;
-        mCharFormatLayer = NULL;
-    }
-
-    if (mRichText)
-    {
-        delete mRichText;
-        mRichText = NULL;
-    }
-
-    if (mSmsHeader)
-    {
-        delete mSmsHeader;
-        mSmsHeader = NULL;
-    }
-}
-
-// ---------------------------------------------------------------------------
-// Two-phased constructor.
-// ---------------------------------------------------------------------------
-//
-MsgCharCounterPrivate* MsgCharCounterPrivate::newL(
-    MsgCharCounter *msgCharCounter)
-{
-    MsgCharCounterPrivate* self = new (ELeave) MsgCharCounterPrivate(
-        msgCharCounter);
-    CleanupStack::PushL(self);
-    self->constructL();
-    CleanupStack::Pop(); // self;
-    return self;
-}
-
-// ---------------------------------------------------------------------------
-// EPOC default constructor for performing 2nd stage construction
-// ---------------------------------------------------------------------------
-//
-void MsgCharCounterPrivate::constructL()
-{
-    mParaFormatLayer = CParaFormatLayer::NewL();
-    mCharFormatLayer = CCharFormatLayer::NewL();
-    mRichText = CRichText::NewL(mParaFormatLayer, mCharFormatLayer);
-
-    mSmsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *mRichText);
-}
-
-// ---------------------------------------------------------------------------
-// To Set encoding settings like encoding type, character support and
-// alternative encoding if any.
-// ---------------------------------------------------------------------------
-//
-void MsgCharCounterPrivate::setEncodingSettings(bool unicodeMode,
-    int alternativeEncodingType, int charSupportType)
-{
-    TSmsUserDataSettings smsSettings;
-    CSmsMessage& smsMsg = mSmsHeader->Message();
-
-    mUnicodeMode = unicodeMode;
-    mCharSupportType = charSupportType;
-    mAlternativeEncodingType = (TSmsEncoding) alternativeEncodingType;
-
-    if (mUnicodeMode)
-    {
-        smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabetUCS2);
-    }
-    else
-    {
-        smsSettings.SetAlphabet(TSmsDataCodingScheme::ESmsAlphabet7Bit);
-    }
-    smsSettings.SetTextCompressed(EFalse);
-    smsMsg.SetUserDataSettingsL(smsSettings);
-    //First try without any alternate encoding
-    smsMsg.SetAlternative7bitEncoding(ESmsEncodingNone);
-}
-
-// ---------------------------------------------------------------------------
-// To get PDU Info: extracts details of number of PDUs, number of remaining
-// chars in last PDU and encoding types used.
-// ---------------------------------------------------------------------------
-//
-void MsgCharCounterPrivate::getNumPDUs(const QString &buf,
-    int &numOfRemainingChars, int &numOfPDUs, bool &unicodeMode,
-    int &alternativeEncodingType)
-{
-    TInt numOfUnconvChars;
-    TInt numOfDowngradedChars;
-    TInt isAltEncSupported;
-    TSmsEncoding currentAlternativeEncodingType;
-
-    CSmsMessage& smsMsg = mSmsHeader->Message();
-
-    // need to set the input buffer to SMS buffer through iRichText
-    // (which is reference to SMS Buffer object)
-    HBufC* buffer = S60QConversions::qStringToS60Desc(buf);
-    CleanupStack::PushL(buffer);
-    mRichText->Reset();
-    mRichText->InsertL(0, *buffer);
-
-    //call SMS stack API to get PDU info
-    smsMsg.GetEncodingInfoL(numOfPDUs, numOfUnconvChars, numOfDowngradedChars,
-        numOfRemainingChars);
-
-    //Algo to switch to Unicode if required
-    while ( (numOfUnconvChars || numOfDowngradedChars) && !mUnicodeMode)
-    {
-        currentAlternativeEncodingType = smsMsg.Alternative7bitEncoding();
-        if (currentAlternativeEncodingType != mAlternativeEncodingType)
-        {
-            //try with this new alternative encoding type
-            isAltEncSupported = smsMsg.SetAlternative7bitEncoding(
-                mAlternativeEncodingType);
-            if (isAltEncSupported == KErrNotSupported)
-            {
-                // if required alternative encoding plugin is not supported,
-                // retain the existing encoding mechanism.
-                mAlternativeEncodingType = currentAlternativeEncodingType;
-                continue;
-            }
-        }
-        else if (numOfUnconvChars || (MsgCharSupport) mCharSupportType
-                == msgCharSupportFull)
-        {
-            //switch to Unicode
-            //mUnicodeMode = ETrue;
-            setEncodingSettings(ETrue, ESmsEncodingNone, mCharSupportType);
-        }
-        else
-        {
-            //Get out of while loop and return the results
-            break;
-        }
-        //get the PDU info with new settings
-        mRichText->Reset();
-        mRichText->InsertL(0, *buffer);
-        smsMsg.GetEncodingInfoL(numOfPDUs, numOfUnconvChars,
-            numOfDowngradedChars, numOfRemainingChars);
-    } // end of while
-
-    CleanupStack::PopAndDestroy(buffer);
-    unicodeMode = mUnicodeMode;
-    alternativeEncodingType = mAlternativeEncodingType;
-    if (mUnicodeMode)
-    {
-        // In case of Unicode mode, SMS Stack returns number of available free
-        // User Data units. Need to convert them w.r.t characters.
-        // Each char takse 2 UD units.
-        numOfRemainingChars = numOfRemainingChars / 2;
-    }
-}
-
-//EOF
--- a/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgcontactcardwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -21,70 +21,51 @@
 #include <HbStyle>
 #include <HbIconItem>
 #include <HbTextItem>
-#include <HbFrameDrawer>
-#include <HbGesture>
-#include <HbGestureSceneFilter>
-#include <HbWidgetFeedback>
+#include <HbTapGesture>
+#include <HbInstantFeedback>
 #include <HbFrameItem>
-#include <qmobilityglobal.h>
 #include <qcontactphonenumber.h>
-#include <qcontactfilter.h>
-#include <qcontactmanager.h>
-#include <qcontactdetailfilter.h>
+#include <qcontactavatar.h>
 #include <xqaiwrequest.h>
 #include <xqappmgr.h>
-#include <XQServiceRequest.h>
+#include <xqservicerequest.h>
 #include <cntservicescontact.h>
 #include <QGraphicsSceneMouseEvent>
 #include <HbMenu>
-#include <HbMainWindow>
+#include <thumbnailmanager_qt.h>
+#include <QTimer>
 
 #include <ccsdefs.h>
 
 // USER INCLUDES
 #include "conversationsenginedefines.h"
-#include "debugtraces.h"
 #include "conversationsengine.h"
 #include "convergedmessage.h"
-
-QTM_USE_NAMESPACE
+#include "msgcontacthandler.h"
 
 // LOCAL CONSTANTS
 const QString DEFAULT_AVATAR_ICON("qtg_large_avatar");
 const QString BT_ICON("qtg_large_bluetooth");
-const QString BACKGROUND_FRAME_NORMAL("qtg_fr_groupbox");
-const QString GROUPBOX_BG_FRAME_PRESSED("qtg_fr_groupbox_pressed");
-
-const QString PLUGINPATH("conversationviewplugin.dll");
+const QString BG_FRAME_NORMAL("qtg_fr_groupbox_normal");
+const QString BG_FRAME_PRESSED("qtg_fr_groupbox_pressed");
 
 // LOCALIZATION CONSTANTS
 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_title_received_files")
-#define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
+#define LOC_MENU_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
 #define LOC_COMMON_MENU_CALL hbTrId("txt_common_menu_call_verb")
 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
 
+// LOCAL FUNCTIONS
+
 //---------------------------------------------------------------
 // MsgContactCardWidget::MsgContactCardWidget
 // @see header
 //---------------------------------------------------------------
 MsgContactCardWidget::MsgContactCardWidget(QGraphicsItem *parent) :
-HbWidget(parent), 
-mMenuShown(false),
-mAvatarIconItem(NULL),
-mPresenceIconItem(NULL),
-mAddressTextItem(NULL),
-mGestureFilter(NULL)
-
+    HbWidget(parent), mIgnoreEvents(false), mAvatarIconItem(NULL), mPresenceIconItem(NULL),
+        mAddressTextItem(NULL), mThumbnailManager(NULL)
 {
-    int baseId = style()->registerPlugin(PLUGINPATH);
-    QDEBUG_WRITE_FORMAT("MsgContactCardWidget BASE ID --->", baseId);
-    setPluginBaseId(baseId);
-
-    init();  
-    setBackGround(BACKGROUND_FRAME_NORMAL);
-    connectSignals(true);
-    
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(initGesture()));   
+    init();
 }
 
 //---------------------------------------------------------------
@@ -93,12 +74,6 @@
 //---------------------------------------------------------------
 MsgContactCardWidget::~MsgContactCardWidget()
 {
-    style()->unregisterPlugin(PLUGINPATH);
-    
-    if(mGestureFilter)
-        {
-        removeSceneEventFilter(mGestureFilter);
-        }
 }
 
 //---------------------------------------------------------------
@@ -107,6 +82,12 @@
 //---------------------------------------------------------------
 void MsgContactCardWidget::init()
 {
+    this->setProperty("state", "normal");
+    this->grabGesture(Qt::TapGesture);
+
+    HbFrameItem *frameItem = new HbFrameItem(BG_FRAME_NORMAL, HbFrameDrawer::NinePieces, this);
+    this->setBackgroundItem(frameItem);
+
     mAvatarIconItem = new HbIconItem(this);
     HbStyle::setItemName(mAvatarIconItem, "avatar");
 
@@ -116,6 +97,13 @@
     mAddressTextItem = new HbTextItem(this);
     HbStyle::setItemName(mAddressTextItem, "addressText");
 
+    mThumbnailManager = new ThumbnailManager(this);
+    mThumbnailManager->setMode(ThumbnailManager::Default);
+    mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
+    mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
+
+    connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this,
+        SLOT(thumbnailReady(QPixmap, void*, int, int)));
 }
 
 //---------------------------------------------------------------
@@ -153,10 +141,18 @@
 ConvergedMessageAddressList MsgContactCardWidget::address()
 {
     ConvergedMessageAddressList addresses;
-    QModelIndex index = ConversationsEngine::instance()->getConversationsModel()->index(0, 0);
+    QStandardItemModel* msgModel = ConversationsEngine::instance()->getConversationsModel();
+    const int rowCnt = msgModel->rowCount();
+    QModelIndex index = msgModel->index(rowCnt-1, 0);
     ConvergedMessageAddress* address = new ConvergedMessageAddress(
         index.data(ConversationAddress).toString());
-    address->setAlias(mAddress);
+    QString displayname;
+    QString addr;
+    ConversationsEngine::instance()->getContactDetails(
+            ConversationsEngine::instance()->getCurrentConversationId(),
+            displayname,
+            addr);
+    address->setAlias(displayname);
     addresses.append(address);
     return addresses;
 }
@@ -187,9 +183,8 @@
         QString displayName;
         QString contactAddress;
         convId = ConversationsEngine::instance()->getCurrentConversationId();
-        ConversationsEngine::instance()->getContactDetails(convId, displayName,
-            contactAddress);
-        
+        ConversationsEngine::instance()->getContactDetails(convId, displayName, contactAddress);
+
         mContactNumber = contactAddress;
         QString contactName;
         if (displayName.isEmpty()) {
@@ -198,21 +193,22 @@
         else {
             contactName.append(displayName);
         }
-        
+
         setAddress(contactName);
 
         // Set Avatar
-        HbIcon avatar;
-        QByteArray avatarByteArray = index.data(Avatar).toByteArray();
-        if (avatarByteArray.isEmpty()) {
-            avatar = HbIcon(DEFAULT_AVATAR_ICON);
+        QList<QContact> contactList = MsgContactHandler::findContactList(mContactNumber);
+
+        if (!contactList.isEmpty()) {
+            QList<QContactAvatar> avatarDetails = contactList.at(0).details<QContactAvatar> ();
+
+            if (!avatarDetails.isEmpty()) {
+                mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString());
+            }
         }
-        else {
-            QPixmap pixmap;
-            pixmap.loadFromData(avatarByteArray);
-            avatar = HbIcon(QIcon(pixmap));
-        }
-        setAvatar(avatar);
+
+        // Set default avatar till actual is set.
+        setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
     }
 }
 
@@ -227,121 +223,130 @@
 }
 
 //---------------------------------------------------------------
-// MsgContactCardWidget::initGesture
-// @see header file
-//---------------------------------------------------------------
-void MsgContactCardWidget::initGesture()
-{
-    // Create gesture filter
-    QGraphicsScene* sc = this->scene();
-    mGestureFilter = new HbGestureSceneFilter( Qt::LeftButton, this );
-    
-    // Add gestures for longpress
-    HbGesture* gestureLongpressed = new HbGesture( HbGesture::longpress,5 );
-    
-    mGestureFilter->addGesture( gestureLongpressed );
-    
-    connect( gestureLongpressed, SIGNAL(longPress(QPointF)),
-             this, SLOT(handleLongPress(QPointF)));
-
-    //install gesture filter.
-    this->installSceneEventFilter(mGestureFilter);
-    
-    disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(initGesture()));   
-}
-
-//---------------------------------------------------------------
-// MsgContactCardWidget::mousePressEvent
+// MsgContactCardWidget::gestureEvent
 // @see header file
 //---------------------------------------------------------------
-void MsgContactCardWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{    
-    mMenuShown = false;
-    
-    HbWidgetFeedback::triggered(this, Hb::InstantPressed);
-    
-    setBackGround(GROUPBOX_BG_FRAME_PRESSED);
-    
-    event->accept();
-}
-
-
-//---------------------------------------------------------------
-// MsgContactCardWidget::mouseReleaseEvent
-// @see header file
-//---------------------------------------------------------------
-void MsgContactCardWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void MsgContactCardWidget::gestureEvent(QGestureEvent *event)
 {
-    setBackGround(BACKGROUND_FRAME_NORMAL);
-    
-    if(this->rect().contains(event->pos())&& !mMenuShown)
+    HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
+    if (tapGesture) {
+        switch (tapGesture->state()) {
+        case Qt::GestureStarted:
+        {
+            // Trigger haptic feedback.
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(true);
+            break;
+        }
+        case Qt::GestureUpdated:
         {
-        HbWidgetFeedback::triggered(this, Hb::InstantClicked);
-		emit clicked();
+            if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
+                // Handle longtap.
+                setPressed(false);
+                handleLongTap(tapGesture->scenePosition());
+            }
+            break;
         }
-    
-    event->accept();    
+        case Qt::GestureFinished:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
+                // Handle short tap.
+                setPressed(false);
+                handleShortTap(tapGesture->scenePosition());
+            }
+            break;
+        }
+        case Qt::GestureCanceled:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(false);
+            break;
+        }
+        }
+    }
+    else {
+        HbWidget::gestureEvent(event);
+    }
 }
 
 //---------------------------------------------------------------
-// MsgContactCardWidget::setBackGround
+// MsgContactCardWidget::setPressed
 // @see header file
 //---------------------------------------------------------------
-void MsgContactCardWidget::setBackGround(const QString& bg)
-    {
-    HbFrameItem* backGround = new HbFrameItem(this);
-    backGround->frameDrawer().setFrameGraphicsName(bg);
-    backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-    this->setBackgroundItem(backGround); 
-    this->repolish();
+void MsgContactCardWidget::setPressed(bool pressed)
+{
+    HbFrameItem *frameItem = static_cast<HbFrameItem *> (this->backgroundItem());
+    if (pressed) {
+        this->setProperty("state", "pressed");
+        frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_PRESSED);
+    }
+    else {
+        this->setProperty("state", "normal");
+        frameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_NORMAL);
+    }
+}
+
+//---------------------------------------------------------------
+// MsgContactCardWidget::handleLongTap
+// @see header file
+//---------------------------------------------------------------
+void MsgContactCardWidget::handleLongTap(const QPointF &position)
+{
+    // Check if events need to be ignored/accepted
+    if (mIgnoreEvents) {
+        return;
     }
 
-//---------------------------------------------------------------
-// MsgContactCardWidget::handleLongPress
-// @see header file
-//---------------------------------------------------------------
-void MsgContactCardWidget::handleLongPress(QPointF position)
-{
-    if(KBluetoothMsgsConversationId 
-        != ConversationsEngine::instance()->getCurrentConversationId())    
-        {
+    if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) {
         HbMenu* contextMenu = new HbMenu();
         contextMenu->setDismissPolicy(HbPopup::TapAnywhere);
         contextMenu->setAttribute(Qt::WA_DeleteOnClose, true);
-        contextMenu->setPreferredPos(position);
-        
-        contextMenu->addAction(LOC_MENU_CONTACT_INFO,this, SLOT(openContactInfo()));    
-        contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call()));
-        
+        contextMenu->setPreferredPos(position);   
+
         //If contact doesn't exist in phonebook then add another menu item "Save to Contacts"
         int contactId = resolveContactId(mContactNumber);
-        if(contactId < 0)
-        {
+        if (contactId < 0) {
             contextMenu->addAction(LOC_SAVETO_CONTACTS, this, SLOT(addToContacts()));
         }
-        
+        else{
+            contextMenu->addAction(LOC_MENU_CONTACT_INFO, this, SLOT(openContactInfo()));
+        }
+        contextMenu->addAction(LOC_COMMON_MENU_CALL, this, SLOT(call()));
+
         contextMenu->show();
-        
-        mMenuShown = true;
-        }
+    }
 }
 
 //---------------------------------------------------------------
-// MsgContactCardWidget::overrideFeedback
-// @see header file
+// MsgContactCardWidget::handleShortTap
+// @see header
 //---------------------------------------------------------------
-HbFeedback::InstantEffect MsgContactCardWidget::overrideFeedback(Hb::InstantInteraction interaction) const
-        {
-        switch(interaction)
-            {
-            case Hb::InstantPressed:
-            case Hb::InstantClicked:
-                return HbFeedback::Basic;
-            default:
-                return HbFeedback::NoOverride;
-            }
-        }
-		
+void MsgContactCardWidget::handleShortTap(const QPointF &position)
+{
+    this->ungrabGesture(Qt::TapGesture);
+    
+    // Check if events need to be ignored/accepted
+    if (mIgnoreEvents) {
+        return;
+    }
+    
+    int contactId = resolveContactId(mContactNumber);
+    if(contactId > 0)
+    {
+        //resolved contact open contact card.
+        openContactInfo();
+    }
+    else
+    {
+        //unresolved contact show longpress options menu.
+        handleLongTap(position);
+    }
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));    
+}
+
 //---------------------------------------------------------------
 // MsgContactCardWidget::openContactInfo
 // @see header
@@ -350,40 +355,39 @@
 {
     QString operation;
     QList<QVariant> args;
-    if(KBluetoothMsgsConversationId 
-            != ConversationsEngine::instance()->getCurrentConversationId())
-    {
-        int contactId = resolveContactId(mContactNumber);                
-        if(contactId > 0)
-        {
+    if (KBluetoothMsgsConversationId != ConversationsEngine::instance()->getCurrentConversationId()) {
+        int contactId = resolveContactId(mContactNumber);
+        if (contactId > 0) {
             //open existing contact card
             operation = QString("open(int)");
             args << contactId;
         }
-        else
-        {
+        else {
             //populate data and open unknown contact template
             operation = QString("editCreateNew(QString,QString)");
             QString type = QContactPhoneNumber::DefinitionName;
-    
+
             args << type;
             args << mAddress;
         }
         //service stuff.
         QString serviceName("com.nokia.services.phonebookservices");
-     
+
         XQAiwRequest* request;
         XQApplicationManager appManager;
         request = appManager.create(serviceName, "Fetch", operation, true); // embedded
-        if ( request == NULL )
-        {
-        	return;       
+        if (request == NULL) {
+            return;
         }
-        
+
         // Result handlers
-        connect (request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
-        connect (request, SIGNAL(requestError(const QVariant&)), this, SLOT(handleError(const QVariant&)));
-        
+        connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
+        connect(request, SIGNAL(requestError(const QVariant&)), this,
+            SLOT(handleError(const QVariant&)));
+
+        //disbale subscritption for the CV events
+        ConversationsEngine::instance()->disableRegisterationForCVEvents();
+                
         request->setArguments(args);
         request->send();
         delete request;
@@ -396,28 +400,10 @@
 //---------------------------------------------------------------
 int MsgContactCardWidget::resolveContactId(const QString& value)
 {
-    int contactId = -1;
-    
-    QContactManager phonebookManager("symbian");
-    
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName,
-                                        QContactPhoneNumber::FieldNumber);
-    phoneFilter.setValue(value);
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+    QString displayLabel;
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = phonebookManager.contacts(
-            phoneFilter,
-            sortOrder,
-            QStringList());
-
-    if ( matchingContacts.count() > 0 ) 
-        {       
-        contactId = matchingContacts.at(0).localId();   
-        }
-    
-    return contactId;
+    int count;
+    return MsgContactHandler::resolveContactDisplayName(value, displayLabel, count);
 }
 
 //---------------------------------------------------------------
@@ -427,17 +413,16 @@
 void MsgContactCardWidget::call()
 {
     //Launch dialer service     
-    QString serviceName("com.nokia.services.telephony");
+    QString serviceName("com.nokia.symbian.ICallDial");
     QString operation("dial(QString)");
-    
-    XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false);
-    
-    connect(serviceRequest, SIGNAL(requestCompleted(QVariant)),
-            this, SLOT(onServiceRequestCompleted()));
-    
-    connect(serviceRequest, SIGNAL(requestError(int)),
-            this, SLOT(onServiceRequestCompleted()));
-    
+
+    XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName, operation, false);
+
+    connect(serviceRequest, SIGNAL(requestCompleted(QVariant)), this,
+        SLOT(onServiceRequestCompleted()));
+
+    connect(serviceRequest, SIGNAL(requestError(int)), this, SLOT(onServiceRequestCompleted()));
+
     *serviceRequest << mContactNumber;
     serviceRequest->send();
 }
@@ -448,6 +433,7 @@
 //---------------------------------------------------------------
 void MsgContactCardWidget::addToContacts()
 {
+    openContactInfo();
 }
 
 //---------------------------------------------------------------
@@ -457,23 +443,27 @@
 void MsgContactCardWidget::handleOk(const QVariant& result)
 {
     Q_UNUSED(result)
-    
-    QContactManager phonebookManager("symbian");
-        
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName, 
-                                            QContactPhoneNumber::FieldNumber);
-    phoneFilter.setValue(mContactNumber);
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+
+    QList<QContact> matchingContacts = MsgContactHandler::findContactList(mContactNumber);
+
+    if (!matchingContacts.isEmpty()) {
+        setAddress(matchingContacts.at(0).displayLabel());
+
+        QList<QContactAvatar> avatarDetails = matchingContacts.at(0).details<QContactAvatar> ();
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = phonebookManager.contacts(phoneFilter,
-                                       sortOrder, QStringList());
+        if (!avatarDetails.isEmpty()) {
+            mThumbnailManager->getThumbnail(avatarDetails.at(0).imageUrl().toString());
+        }
+	}
+	
+	// Get the new conversation id.
+    qint64 convId = ConversationsEngine::instance()->getConversationIdFromAddress(
+                mContactNumber);
+    emit conversationIdChanged(convId);
+            
+    ConversationsEngine::instance(
+                    )->emitOpenConversationViewIdUpdate(convId);
     
-    if(matchingContacts.count())
-    {
-        setAddress(matchingContacts.at(0).displayLabel());
-    }
 }
 
 //---------------------------------------------------------------
@@ -481,11 +471,18 @@
 // @see header
 //---------------------------------------------------------------
 void MsgContactCardWidget::handleError(int errorCode, const QString& errorMessage)
-    {
+{
     Q_UNUSED(errorMessage)
-    Q_UNUSED(errorCode)
-    }
-	
+    Q_UNUSED(errorCode)    
+    
+    //unblock the cv events in case of contacts save error
+    ConversationsEngine::instance(
+                        )->emitOpenConversationViewIdUpdate(
+                                ConversationsEngine::instance(
+                                        )->getCurrentConversationId(
+                                                ));
+}
+
 //---------------------------------------------------------------
 // MsgContactCardWidget::onServiceRequestCompleted
 // @see header
@@ -493,26 +490,45 @@
 void MsgContactCardWidget::onServiceRequestCompleted()
 {
     //service request is now complete. delete it.
-    XQServiceRequest* request = qobject_cast<XQServiceRequest*>(sender());
-    if(request)
-    {
+    XQServiceRequest* request = qobject_cast<XQServiceRequest*> (sender());
+    if (request) {
         delete request;
     }
 }
 
 //---------------------------------------------------------------
-// MsgContactCardWidget::connectSignals
+// MsgContactCardWidget::thumbnailReady
 // @see header
 //---------------------------------------------------------------
-void MsgContactCardWidget::connectSignals(bool yes)
+void MsgContactCardWidget::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error)
 {
-    if(yes)
-    {
-        connect(this,SIGNAL(clicked()),this,SLOT(openContactInfo()));
+    Q_UNUSED(data)
+    Q_UNUSED(id)
+
+    if (!error) {
+        QIcon icon(pixmap);
+        setAvatar(HbIcon(icon));
     }
-    else
-    {
-        disconnect(this,SIGNAL(clicked()),this,SLOT(openContactInfo()));
+    else {
+        setAvatar(HbIcon(DEFAULT_AVATAR_ICON));
     }
 }
+
+//---------------------------------------------------------------
+// MsgContactCardWidget::ignoreSignals
+// @see header
+//---------------------------------------------------------------
+void MsgContactCardWidget::ignoreSignals(bool yes)
+{
+    mIgnoreEvents = yes;
+}
+
+//---------------------------------------------------------------
+// MsgContactCardWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void MsgContactCardWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationbaseview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -29,6 +29,8 @@
 #include <qtcontactsglobal.h>
 #include <qtcontacts.h>
 #include <ccsdefs.h>
+#include <XQSettingsManager>
+#include <QTimer>
 
 // USER INCLUDES
 #include "msgconversationview.h"
@@ -36,9 +38,13 @@
 #include "msgviewdefines.h"
 #include "conversationsenginedefines.h"
 #include "msgcontactcardwidget.h"
+#include "conversationidpsconsts.h"
 
 QTM_USE_NAMESPACE
 
+const int INVALID_MSGID = -1;
+const int INVALID_CONVID = -1;
+
 // LOCALIZATION
 #define LOC_SAVED_TO_DRAFTS    hbTrId("txt_messaging_dpopinfo_saved_to_drafts")
 
@@ -47,11 +53,10 @@
 // Constructor
 //---------------------------------------------------------------
 MsgConversationBaseView::MsgConversationBaseView(QGraphicsItem* parent) :
-MsgBaseView(parent),
-mConversationView(NULL),
-mConversationId(-1)
-{ 
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));   
+    MsgBaseView(parent), mConversationId(-1), mCVIdkey(XQSettingsKey::TargetPublishAndSubscribe,
+        KMsgCVIdProperty, KMsgCVIdKey)
+{
+    connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
     initView();
 }
 
@@ -60,7 +65,7 @@
 // Destructor
 //---------------------------------------------------------------
 MsgConversationBaseView::~MsgConversationBaseView()
-{   
+{
 }
 
 //---------------------------------------------------------------
@@ -71,12 +76,14 @@
 {
     ConversationsEngine::instance()->getConversations(convId);
     mConversationId = convId;
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
-    
-    if(mConversationView)
-        {
+    connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
+
+    // publsih conversation id
+    mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId);
+
+    if (mConversationView) {
         mConversationView->refreshView();
-        }
+    }
 }
 
 //---------------------------------------------------------------
@@ -84,8 +91,8 @@
 // create and initialise the conversationview
 //---------------------------------------------------------------
 void MsgConversationBaseView::initView()
-    {
-    
+{
+
     // Create header widget
     mContactCard = new MsgContactCardWidget(this);
 
@@ -93,10 +100,11 @@
 
     qreal spacing = HbDeviceProfile::profile(this).unitValue();
     mMainLayout->setSpacing(spacing);
-    mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN,
-                                   CONTENT_MARGIN, CONTENT_MARGIN);
+    mMainLayout->setContentsMargins(CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN, CONTENT_MARGIN);
 
     mMainLayout->addItem(mContactCard);
+    connect(mContactCard, SIGNAL(conversationIdChanged(qint64)), this,
+        SLOT(handleConversationIdChange(qint64)));
 
     /**
      * Create conversation view and connect to proper signals.
@@ -107,16 +115,15 @@
 
     mConversationView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-    connect(mConversationView, SIGNAL(closeConversationView()),
-            this, SLOT(closeConversationView()));
+    connect(mConversationView, SIGNAL(closeConversationView()), this, SLOT(closeConversationView()));
+
+    connect(mConversationView, SIGNAL(replyStarted()), this, SLOT(markMessagesAsRead()));
 
-    connect(mConversationView,SIGNAL(replyStarted()),
-            this,SLOT(markMessagesAsRead()));
+    connect(mConversationView, SIGNAL(switchView(const QVariantList&)), this,
+        SIGNAL(switchView(const QVariantList&)));
 
-    connect(mConversationView, SIGNAL(switchView(const QVariantList&)),
-            this, SIGNAL(switchView(const QVariantList&)));
-    
-    connect(mConversationView,SIGNAL(hideChrome(bool)),this,SLOT(hideChrome(bool)));
+    connect(mConversationView, SIGNAL(vkbOpened(bool)), this, SLOT(hideChrome(bool)));
+    connect(mConversationView, SIGNAL(vkbOpened(bool)), mContactCard, SLOT(ignoreSignals(bool)));
 
     this->setMenu(mConversationView->menu());
 
@@ -124,6 +131,8 @@
 
     this->setLayout(mMainLayout);
 
+    mSettingsManager = new XQSettingsManager(this);
+
 }
 
 //---------------------------------------------------------------
@@ -132,7 +141,7 @@
 //---------------------------------------------------------------
 void MsgConversationBaseView::closeConversationView()
 {
-   markMessagesAsRead();
+    markMessagesAsRead();
 }
 
 //---------------------------------------------------------------
@@ -140,30 +149,38 @@
 // Mark unread msgs in cv as read
 //---------------------------------------------------------------
 void MsgConversationBaseView::markMessagesAsRead()
-    {
-    if( mConversationId >= 0)
-        {
+{
+    if (mConversationId >= 0) {
         ConversationsEngine::instance()->markConversationRead(mConversationId);
-        }
     }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::saveContentToDrafts
 // saves the editors content to drafts
 //---------------------------------------------------------------
-void MsgConversationBaseView::saveContentToDrafts()
-    {
+int MsgConversationBaseView::saveContentToDrafts()
+{
+    int msgId = INVALID_MSGID;
     bool result = false;
-    if( mConversationId >= 0)
-        {
-        result = mConversationView->saveContentToDrafts();
-        }
-    
-    if(result)
-        {
+    if (mConversationId >= 0) {
+    msgId = mConversationView->saveContentToDrafts();
+    }
+
+    if (msgId != INVALID_MSGID) {
         HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
-        }
     }
+    return msgId;
+}
+
+//--------------------------------------------------------------- 
+// MsgConversationBaseView::conversationId 
+// get the conversation ID 
+//---------------------------------------------------------------     
+qint64 MsgConversationBaseView::conversationId()
+{
+    return mConversationId;
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::clearContent
@@ -180,19 +197,19 @@
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::handleOk(const QVariant& result)
-    {
+{
     Q_UNUSED(result)
-    }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::handleError
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::handleError(int errorCode, const QString& errorMessage)
-    {
+{
     Q_UNUSED(errorMessage)
     Q_UNUSED(errorCode)
-    }
+}
 
 //---------------------------------------------------------------
 // MsgConversationBaseView::doDelayedConstruction
@@ -200,38 +217,70 @@
 //---------------------------------------------------------------	
 void MsgConversationBaseView::doDelayedConstruction()
 {
-    disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
+    disconnect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedConstruction()));
+    QTimer::singleShot(50, this, SLOT(handleViewReady()));
+}
+
+//---------------------------------------------------------------
+// MsgConversationBaseView::handleViewReady
+//
+//---------------------------------------------------------------	
+void MsgConversationBaseView::handleViewReady()
+{
     ConversationsEngine::instance()->fetchMoreConversations();
 }
 
 //---------------------------------------------------------------
+// MsgConversationBaseView::handleConversationIdChange
+//
+//---------------------------------------------------------------
+void MsgConversationBaseView::handleConversationIdChange(qint64 convId)
+{
+    if (INVALID_CONVID != convId && mConversationId != convId) {
+	
+        mConversationId = convId;        
+        // publsih conversation id
+        mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId);       
+    }
+}
+
+//---------------------------------------------------------------
 // MsgConversationBaseView::hideChrome
 //
 //---------------------------------------------------------------
 void MsgConversationBaseView::hideChrome(bool hide)
-    {
-    if(hide)
-        {        
+{
+    if (hide) {
         this->hideItems(Hb::StatusBarItem | Hb::TitleBarItem);
         this->setContentFullScreen(true);
-        
-        if(this->mainWindow()->orientation() == Qt::Horizontal)
-            {
+
+        if (this->mainWindow()->orientation() == Qt::Horizontal) {
             mMainLayout->removeItem(mContactCard);
             mContactCard->hide();
-            }
         }
-    else
-        {
+    }
+    else {
         this->showItems(Hb::StatusBarItem | Hb::TitleBarItem);
         this->setContentFullScreen(false);
-        
-        if(!mContactCard->isVisible())
-            {
-            mMainLayout->insertItem(0,mContactCard);
+
+        if (!mContactCard->isVisible()) {
+            mMainLayout->insertItem(0, mContactCard);
             mContactCard->show();
-            }
         }
     }
+}
 
+//---------------------------------------------------------------
+// MsgConversationBaseView::setPSCVId
+//
+//---------------------------------------------------------------
+void MsgConversationBaseView::setPSCVId(bool setId)
+{
+    if (setId) {
+        mSettingsManager->writeItemValue(mCVIdkey, (int) mConversationId);
+    }
+    else {
+        mSettingsManager->writeItemValue(mCVIdkey, -1);
+    }
+}
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -23,10 +23,13 @@
 #include <HbListView>
 #include <HbMessageBox>
 #include <HbNotificationDialog>
-#include <XQServiceRequest.h>
+#include <HbFrameBackground>
+#include <xqservicerequest.h>
 #include <HbStaticVkbHost>
+#include <HbStyleLoader>
 #include <xqaiwrequest.h>
 #include <xqappmgr.h>
+#include <HbMainWindow>
 
 #include <QDir>
 #include <QDateTime>
@@ -39,6 +42,7 @@
 #include <MmsEngineDomainCRKeys.h>
 
 // USER INCLUDES
+#include "msgcontactsutil.h"
 #include "msgsendutil.h"
 #include "msgconversationviewitem.h"
 #include "conversationsengine.h"
@@ -52,6 +56,8 @@
 #include "unidatamodelplugininterface.h"
 #include "ringbc.h"
 #include "mmsconformancecheck.h"
+#include "msgsettingsview.h"
+#include "msgaudiofetcherview.h"
 
 //Item specific menu.
 
@@ -59,13 +65,11 @@
 #define LOC_COMMON_DELETE hbTrId("txt_common_menu_delete")
 #define LOC_COMMON_FORWARD hbTrId("txt_common_menu_forward")
 #define LOC_COMMON_DOWNLOAD hbTrId("txt_messaging_menu_download")
-#define LOC_COMMON_SEND  hbTrId("txt_common_menu_send") 
-
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
-#define LOC_BUTTON_OK hbTrId("txt_common_button_ok")
+#define LOC_COMMON_SEND  hbTrId("txt_common_button_send") 
+#define LOC_COMMON_SAVE  hbTrId("txt_common_menu_save")
 
 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
 
 //main menu
 #define LOC_ATTACH          hbTrId("txt_messaging_opt_attach")
@@ -75,11 +79,11 @@
 #define LOC_ADD_RECIPIENTS  hbTrId("txt_messaging_opt_add_recipients")
 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
 
-#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dpopinfo_sending_failed")
+#define LOC_MSG_SEND_FAILED hbTrId("txt_messaging_dialog_message_sending_failed")
+#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_settings_incomplete")
+#define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
 
 
-const QString PLUGINPATH("conversationviewplugin.dll");
-
 const int INVALID_MSGID = -1;
 const int INVALID_CONVID = -1;
 const int CONTACT_INSERTION_MODE = 1;
@@ -97,15 +101,26 @@
     mEditorWidget(NULL),
     mContactCardWidget(contactCardWidget),
     mSendUtil(NULL),
-    mItemLongPressed(false),
     mVkbHost(NULL),
-    mVkbopened(false)
+    mVkbopened(false),
+    mVisibleIndex()
 {
+    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(onViewReady()));
     //create send utils
     mSendUtil = new MsgSendUtil(this);
     //initialize view
     setupView();
     setupMenu();
+    
+    connect(ConversationsEngine::instance(), 
+                     SIGNAL(conversationModelUpdated()),
+                     this, 
+                     SLOT(scrollToBottom()));
+
+    connect(ConversationsEngine::instance(), 
+                         SIGNAL(conversationViewEmpty()),
+                         this, 
+                         SLOT(onConversationViewEmpty()));
 }
 
 //---------------------------------------------------------------
@@ -124,10 +139,15 @@
 {
     // Create HbListView and set properties
     mConversationList = new HbListView();
-    style()->registerPlugin(PLUGINPATH);
+    if (!HbStyleLoader::registerFilePath(":/layouts")) {
+        QDEBUG_WRITE("ERROR: ConversationView -> HbStyleLoader::registerFilePath");
+    }
     mConversationList->setLayoutName("custom");
     mConversationList->setItemRecycling(true);
     MsgConversationViewItem *item = new MsgConversationViewItem(this);
+    HbFrameBackground defaultBackground;
+    defaultBackground.setFrameGraphicsName(QString(""));
+    item->setDefaultFrame(defaultBackground);
     mConversationList->setItemPrototype(item);
     mConversationList->setSelectionMode(HbListView::NoSelection);
     mConversationList->setClampingStyle(HbScrollArea::BounceBackClamping);
@@ -142,6 +162,11 @@
     
     connect(mConversationList, SIGNAL(activated(QModelIndex)),
             this, SLOT(openItem(QModelIndex)));
+    connect(this->mainWindow(), SIGNAL(aboutToChangeOrientation()),
+                this, SLOT(onOrientationAboutToBeChanged()));
+    
+    connect(this->mainWindow(), SIGNAL(orientationChanged(Qt::Orientation)),
+                    this, SLOT(onOrientationChanged(Qt::Orientation)));
 
     // Long tap list item
     connect(mConversationList, SIGNAL(longPressed(HbAbstractViewItem*, QPointF)),
@@ -206,7 +231,7 @@
         }
         else {
             mMainLayout->addItem(mEditorWidget);
-            mEditorWidget->setEncodingSettings();
+            TRAP_IGNORE(mEditorWidget->setEncodingSettingsL());
             mEditorWidget->show();
         }
         mContactCardWidget->updateContents();
@@ -224,6 +249,14 @@
             mMessageModel->index(rowCnt - 1, 0));
 }
 
+void MsgConversationView::onConversationViewEmpty()
+{
+    QVariantList param;
+    param << MsgBaseView::CLV; // target view
+    param << MsgBaseView::CV; // source view
+    emit switchView(param);
+}
+
 //---------------------------------------------------------------
 // MsgConversationView::longPressed
 // @see header file
@@ -231,8 +264,6 @@
 void MsgConversationView::longPressed(HbAbstractViewItem* viewItem,
     const QPointF& point)
 {    
-    mItemLongPressed = true;
-    
     MsgConversationViewItem* item = qgraphicsitem_cast<
             MsgConversationViewItem *> (viewItem);
 
@@ -242,22 +273,21 @@
         //If message is in Sending state or is Scheduled to be sent later,
         //do not allow any operations on the message
         int sendingState = item->modelIndex().data(SendingState).toInt();
+        if(sendingState == ConvergedMessage::Scheduled ||
+                   sendingState == ConvergedMessage::Sending ||
+                   sendingState == ConvergedMessage::Waiting)
+           {
+               return;
+           }
         // Create new menu
         HbMenu* contextMenu = new HbMenu();
+        contextMenu->setAttribute(Qt::WA_DeleteOnClose);
+        contextMenu->setPreferredPos(point);
         setContextMenu(item, contextMenu, sendingState);
-        
-        //Before showing menu reset the flag
-        mItemLongPressed = false;
-        contextMenu->exec(point);
-        // Cleanup
-        delete contextMenu;
+        contextMenu->show();
 
     }
-    else
-    {
-        // For cases where the long tap check failed
-        mItemLongPressed = false;
-    }
+    
 }
 
 //---------------------------------------------------------------
@@ -271,7 +301,27 @@
     addResendItemToContextMenu(item, contextMenu, sendingState);
     addForwardItemToContextMenu(item, contextMenu, sendingState);
     addDownloadItemToContextMenu(item, contextMenu);
-    addDeleteItemToContextMenu(item, contextMenu, sendingState);  
+    addDeleteItemToContextMenu(item, contextMenu, sendingState);
+    addSaveItemToContextMenu(item , contextMenu,sendingState);
+}
+
+
+//---------------------------------------------------------------
+// MsgEditorPrivate::addSaveItemToContextMenu
+// @see header
+//---------------------------------------------------------------
+void MsgConversationView::addSaveItemToContextMenu(MsgConversationViewItem* item,
+    HbMenu* contextMenu, int sendingState)
+{
+    Q_UNUSED(sendingState)
+
+    int messageSubType = item->modelIndex().data(MessageSubType).toInt();
+    int direction =  item->modelIndex().data(Direction).toInt();
+    if ((messageSubType == ConvergedMessage::RingingTone) && 
+        (direction == ConvergedMessage::Incoming)) {
+        HbAction *contextItem = contextMenu->addAction(LOC_COMMON_SAVE);
+        connect(contextItem, SIGNAL(triggered()), this, SLOT(saveRingingTone()));
+    }
 }
 
 //---------------------------------------------------------------
@@ -291,10 +341,14 @@
         {
         return;
         }
-    
+    if ((messageSubType == ConvergedMessage::VCard) &&
+        (direction == ConvergedMessage::Incoming))
+        {
+        HbAction *contextItem = contextMenu->addAction(LOC_SAVE_TO_CONTACTS);
+        connect(contextItem, SIGNAL(triggered()),this, SLOT(openItem()));
+        return;
+        }
     if( (sendingState == ConvergedMessage::SentState ) ||
-        (sendingState == ConvergedMessage::Resend ) ||
-        (sendingState == ConvergedMessage::Failed ) ||
         (direction == ConvergedMessage::Incoming))
     {
         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_OPEN);
@@ -343,12 +397,18 @@
     }
     
     qint32 messageId = item->modelIndex().data(ConvergedMsgId).toInt();
+    qint32 messageProperty = item->modelIndex().data(MessageProperty).toInt();
+    
+    bool canForwardMessage  = true;
+    if (messageType == ConvergedMessage::Mms){
+        canForwardMessage = (messageProperty & EPreviewForward)? true:false;
+    }            
 
     if( ((sendingState == ConvergedMessage::SentState) ||
         (sendingState == ConvergedMessage::Resend) ||
         (sendingState == ConvergedMessage::Failed) ||
         (direction == ConvergedMessage::Incoming) ) &&
-        (validateMsgForForward(messageType,messageId))	)
+        canForwardMessage)
     {
         HbAction *contextItem = contextMenu->addAction(LOC_COMMON_FORWARD);
         connect(contextItem, SIGNAL(triggered()),this, SLOT(forwardMessage()));
@@ -431,17 +491,9 @@
     deactivateInputBlocker();
     if( sendResult == KErrNotFound)
     {
-    bool result = HbMessageBox::question("SMS Settings not defined\nDefine now ?",
-            LOC_BUTTON_OK,
-            LOC_BUTTON_CANCEL);
-        if (result)
-        {
-            //switch to settings view
-            QVariantList param;
-            param << MsgBaseView::MSGSETTINGS;
-            param << MsgBaseView::CV;
-            emit switchView(param);
-        }
+    HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE, this,
+                           SLOT(onDialogSettingsLaunch(HbAction*)), 
+                           HbMessageBox::Ok | HbMessageBox::Cancel);
     }
 }
 
@@ -515,11 +567,13 @@
 //---------------------------------------------------------------
 void MsgConversationView::fetchImages()
 {
-    QString interface("Image");
-    QString operation("fetch(QVariantMap,QVariant)");
+    QString service("photos");
+    QString interface("com.nokia.symbian.IImageFetch");
+    QString operation("fetch()");
     XQAiwRequest* request = NULL;
     XQApplicationManager appManager;
-    request = appManager.create(interface, operation, true);//embedded
+    request = appManager.create(service,interface, operation, true); // embedded
+    request->setSynchronous(true); // synchronous
     if(!request)
     {
         QDEBUG_WRITE("AIW-ERROR: NULL request");
@@ -530,7 +584,7 @@
         this, SLOT(imagesFetched(const QVariant&)));
     connect(request, SIGNAL(requestError(int,const QString&)),
         this, SLOT(serviceRequestError(int,const QString&)));
-   
+
     // Make the request
     if (!request->send())
     {
@@ -545,29 +599,25 @@
 //---------------------------------------------------------------
 void MsgConversationView::fetchAudio()
 {
-    QString service("Music Fetcher");
-    QString interface("com.nokia.services.media.Music");
-    QString operation("fetch(QString)");
-    XQAiwRequest* request = NULL;
-    XQApplicationManager appManager;
-    request = appManager.create(service, interface, operation, true); //embedded
-    if(!request)
-    {
-        QDEBUG_WRITE("AIW-ERROR: NULL request");
-        return;
-    }
+    // Launch Audio fetcher view
+    QVariantList params;
+    QByteArray dataArray;
+    QDataStream messageStream
+    (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
 
-    connect(request, SIGNAL(requestOk(const QVariant&)),
-        this, SLOT(audiosFetched(const QVariant&)));
-    connect(request, SIGNAL(requestError(int,const QString&)),
-        this, SLOT(serviceRequestError(int,const QString&)));
+    ConvergedMessage message;
+    message.setBodyText(mEditorWidget->content());
+    // add address from contact-card to to-field
+    ConvergedMessageAddress address;
+    address.setAlias(mContactCardWidget->address().at(0)->alias());
+    address.setAddress(mContactCardWidget->address().at(0)->address());
+    message.addToRecipient(address);
+    message.serialize(messageStream);
 
-    // Make the request
-    if (!request->send())
-    {
-        QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed  ",request->lastError());
-    }
-    delete request;
+    params << MsgBaseView::AUDIOFETCHER; // target view
+    params << MsgBaseView::CV; // source view
+    params << dataArray;
+    emit switchView(params);
 }
 
 //---------------------------------------------------------------
@@ -576,38 +626,16 @@
 //---------------------------------------------------------------
 void MsgConversationView::contactsFetched(const QVariant& value)
 {
-    CntServicesContactList contactList;
-    contactList = qVariantValue<CntServicesContactList>(value);
-    ConvergedMessageAddressList addresses;
+    CntServicesContactList contactList = 
+            qVariantValue<CntServicesContactList>(value);
 	int count = contactList.count();
 	if(count > 0)
-      {
-	  ConvergedMessageAddress* address = new ConvergedMessageAddress;
-      address->setAlias(mContactCardWidget->address().at(0)->alias());
-      address->setAddress(mContactCardWidget->address().at(0)->address());
-      addresses.append(address);
-    	for(int i = 0; i < contactList.count(); i++ )
-	    {
-	    ConvergedMessageAddress* address = new ConvergedMessageAddress;
-	    address->setAlias(contactList[i].mDisplayName);
-	    address->setAddress(contactList[i].mPhoneNumber);
-	    addresses.append(address);
-	    }
-
-      ConvergedMessage message;
-      message.setBodyText(mEditorWidget->content());
-      message.addToRecipients(addresses);//takes the ownership of list elements
-      QByteArray dataArray;
-      QDataStream messageStream
-      (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
-      message.serialize(messageStream);
-      QVariantList params;
-      params << MsgBaseView::UNIEDITOR; // target view
-      params << MsgBaseView::CV; // source view
-      params << dataArray;
-      clearEditors();
-      emit switchView(params);
-     }    
+    {
+        QVariantList params;
+        params << MsgBaseView::ADD_RECIPIENTS;
+        params << value;
+        launchUniEditor(params);
+    }
 }
 
 //---------------------------------------------------------------
@@ -631,26 +659,6 @@
 }
 
 //---------------------------------------------------------------
-// MsgConversationView::audiosFetched()
-// @see header file
-//---------------------------------------------------------------
-void MsgConversationView::audiosFetched(const QVariant& result )
-{
-    if(result.canConvert<QStringList>())
-    {
-        QStringList fileList = result.value<QStringList>();
-        if ( fileList.size()>0 && !fileList.at(0).isEmpty())
-        {
-            QString filepath(QDir::toNativeSeparators(fileList.at(0)));
-            QVariantList params;
-            params << MsgBaseView::ADD_AUDIO;
-            params << filepath;
-            launchUniEditor(params);
-        }
-    }
-}
-
-//---------------------------------------------------------------
 // MsgConversationView::addSubject()
 // @see header file
 //---------------------------------------------------------------
@@ -731,31 +739,8 @@
 //---------------------------------------------------------------
 void MsgConversationView::deleteItem()
     {
-    QModelIndex index = mConversationList->currentIndex();
-    int count = mMessageModel->rowCount();
-    //delete message
-    qint32 messageId = index.data(ConvergedMsgId).toLongLong();    
-
-    bool result = HbMessageBox::question(LOC_DELETE_MESSAGE,
-                             LOC_BUTTON_DELETE,
-                             LOC_BUTTON_CANCEL);
-    if(result)
-        {        
-        if (messageId)
-            {
-            QList<int> msgIdList;
-            msgIdList.append(messageId);          
-            ConversationsEngine::instance()->deleteMessages(msgIdList);
-            //switch view               
-            if (count == 1)
-                {
-                QVariantList param;
-                param << MsgBaseView::CLV; // target view
-                param << MsgBaseView::CV; // source view
-                emit switchView(param);
-                }  
-            }             
-        }
+    HbMessageBox::question(LOC_DELETE_MESSAGE,this,SLOT(onDialogdeleteMsg(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);
 }
 
 //---------------------------------------------------------------
@@ -783,7 +768,7 @@
 // MsgConversationView::saveContentToDrafts()
 // @See header
 //---------------------------------------------------------------
-bool MsgConversationView::saveContentToDrafts()
+int MsgConversationView::saveContentToDrafts()
 {
     int msgId = INVALID_MSGID;
     if(!mEditorWidget->content().isEmpty())
@@ -806,7 +791,7 @@
         }
         deactivateInputBlocker();
     }
-    return ((msgId > INVALID_MSGID)? true : false);
+    return msgId;
 }
 
 //---------------------------------------------------------------
@@ -830,14 +815,23 @@
 {
     qint32 messageId = index.data(ConvergedMsgId).toLongLong();
 
-    QString interface("com.nokia.services.btmsgdispservices.displaymsg");
+    QList<QVariant> args;
+    QString serviceName("com.nokia.services.btmsgdispservices");
     QString operation("displaymsg(int)");
+    XQAiwRequest* request;
+    XQApplicationManager appManager;
+    request = appManager.create(serviceName, "displaymsg", operation, true); // embedded
+    
+    if ( request == NULL )
+        {
+        return;
+        }
 
-    XQServiceRequest request(interface, operation, false);
-
-    request << messageId;
-
-    bool result = request.send();
+    args << QVariant(messageId);
+    
+    request->setArguments(args);
+    request->send();
+    delete request;    
 }
 
 //---------------------------------------------------------------
@@ -877,35 +871,72 @@
 //@see header
 //---------------------------------------------------------------
 void MsgConversationView::openItem(const QModelIndex & index)
-    {
+{
     // Return if invalid index.
     if (!index.isValid() || mVkbopened)
-        {
+    {
         return;
-        }
-
-    if(mItemLongPressed)
-        return;
+    }
     
     int messageType = index.data(MessageType).toInt();
     int messageSubType = index.data(MessageSubType).toInt();
+    int messageId = index.data(ConvergedMsgId).toInt();
     
-    if (ConvergedMessage::BioMsg == messageType) {
-        if (ConvergedMessage::RingingTone == messageSubType) {
-            if (RingBc::askSaveQuery()) {
-                saveRingingTone();
+    if (ConvergedMessage::BioMsg == messageType)
+    {
+        if (ConvergedMessage::RingingTone == messageSubType)
+        {
+            HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this,
+                                   SLOT(onDialogSaveTone(HbAction*)), 
+                                   HbMessageBox::Save | HbMessageBox::Cancel);
+            return;
+        }
+        else if(ConvergedMessage::Provisioning == messageSubType)
+        {
+            int messageId = index.data(ConvergedMsgId).toInt();
+            handleProvisoningMsg(messageId);
+            QList<int> msgIdList;
+            if(index.data(UnReadStatus).toInt())
+            {
+                msgIdList.clear();
+                msgIdList << messageId;
+                ConversationsEngine::instance()->markMessagesRead(msgIdList);
             }
             return;
         }
-        // Unsupported messages
-        else if (ConvergedMessage::VCard == messageSubType
-            || ConvergedMessage::VCal == messageSubType
-            || ConvergedMessage::Provisioning == messageSubType) {
+        else if(ConvergedMessage::VCard == messageSubType)
+        {
+            QString filepath = index.data(Attachments).toStringList().at(0);
+            bool result = MsgContactsUtil::launchVCardViewer(filepath);
+            if(result)
+            {
+                
+                int messageId = index.data(ConvergedMsgId).toInt();
+                QList<int> msgIdList;
+                if(index.data(UnReadStatus).toInt())
+                {
+                    msgIdList.clear();
+                    msgIdList << messageId;
+                    ConversationsEngine::instance()->markMessagesRead(msgIdList);
+                }
+            }
+            return;
+        }
+        else if(ConvergedMessage::VCal == messageSubType)
+        {
             return;
         }
     }
-    else if (ConvergedMessage::BT == messageType) {
+    else if (ConvergedMessage::BT == messageType)
+    {
         launchBtDisplayService(index);
+        QList<int> msgIdList;
+        if(index.data(UnReadStatus).toInt())
+            {
+            msgIdList.clear();
+            msgIdList << messageId;
+            ConversationsEngine::instance()->markMessagesRead(msgIdList);
+            }
         return;
     }
     else if(ConvergedMessage::MmsNotification == messageType)
@@ -923,110 +954,72 @@
         else
         {
             //TODO: use logical str name
-            if(HbMessageBox::question("Download Message?",
-                LOC_COMMON_DOWNLOAD,
-                LOC_BUTTON_CANCEL))
-            {
-                downloadMessage();
-            }
+            HbMessageBox::question("Download Message?",this,
+                                   SLOT(onDialogDownLoadMsg(HbAction*)),
+                                   HbMessageBox::Yes | HbMessageBox::Cancel);
             return;
         }
     }
 
-    ConvergedMessage message;
+    int direction = index.data(Direction).toInt();
+
+    if (direction == ConvergedMessage::Outgoing && ConvergedMessage::Sms == messageType
+        && ConversationsEngine::instance()->getMsgSubType(messageId)== ConvergedMessage::NokiaService)
+    {
+        return;
+    }
+    
     // check whether message is in sending progress, then donot launch viewer.
     int location = index.data(MessageLocation).toInt();
     int sendingState = index.data(SendingState).toInt();
     
-    //If message is in Sending state or is Scheduled to be sent later,
+    //If message is in any other state other than 'Sent'
     //do not open the message
-    if(sendingState == ConvergedMessage::Suspended ||
-            sendingState == ConvergedMessage::Scheduled ||
-            sendingState == ConvergedMessage::Sending ||
-            sendingState == ConvergedMessage::Waiting)
+    if(direction == ConvergedMessage::Outgoing 
+            && sendingState != ConvergedMessage::SentState )
+           
     {
         return;
     }
 
-    //TODO: sendingState check should be removed once msg
-    // movement lock issue is resolved from mw
-    if( !((location == ConvergedMessage::Inbox) ||
-        (location == ConvergedMessage::Sent) ||
-        (sendingState == ConvergedMessage::SentState)||
-        (sendingState == ConvergedMessage::Failed) ||
-        (sendingState == ConvergedMessage::Resend)))
-        {// do not launch viewer, show a note
-        HbNotificationDialog* dlg = new HbNotificationDialog();
-        dlg->setFocusPolicy(Qt::NoFocus);
-        QString text(tr("Message Locked"));
-        dlg->setText(text);
-        dlg->setDismissPolicy(HbPopup::TapAnywhere);
-        dlg->setAttribute(Qt::WA_DeleteOnClose, true);
-        dlg->show();
-        return;
-		}
-
-        // message id
-        qint32 messageId = index.data(ConvergedMsgId).toLongLong();
-        ConvergedMessageId msgId(messageId);
-        message.setMessageId(msgId);
-
-        // contact Id
-        qint32 contactId = index.data(ContactId).toLongLong();
-
-        // message type
-
-        message.setMessageType((ConvergedMessage::MessageType) messageType);
-        message.setMessageSubType((ConvergedMessage::MessageSubType) messageSubType);
-
-        if (messageType == ConvergedMessage::Mms)
-        {
-            message.setSubject(index.data(Subject).toString());
-            message.setPriority((ConvergedMessage::Priority) index.data(
-                MessagePriority).toInt());
-        }
-        else if (messageType == ConvergedMessage::IM)
-        {
-            // add body text and send to the message for IM case
-            message.setBodyText(index.data(BodyText).toString());
-        }
-
-        // time stamp
-        message.setTimeStamp(index.data(TimeStamp).toLongLong());
-
-        //Message direction
-        message.setDirection((ConvergedMessage::Direction)index.data(Direction).toInt());
-
-        // conatct name as address
-        ConvergedMessageAddress address;
-        address.setAlias(mContactCardWidget->address().at(0)->alias());
-        address.setAddress(mContactCardWidget->address().at(0)->address());
-        message.addToRecipient(address);
-
-        // Mark this message as read if its unread
-        QByteArray dataArray;
-        QDataStream messageStream
-        (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
-        message.serialize(messageStream);
-        //if message unread, mark as read before opening view
-        QList<int> msgIdList;
-        if(index.data(UnReadStatus).toInt())
-            {
+   
+    
+    // contact Id
+    qint32 contactId = index.data(ContactId).toLongLong();  
+	    
+    //if message unread, mark as read before opening view
+    QList<int> msgIdList;
+    if(index.data(UnReadStatus).toInt())
+    {
         msgIdList.clear();
         msgIdList << messageId;
         ConversationsEngine::instance()->markMessagesRead(msgIdList);
-        }
+    }
+    
+    qint32 messageProperty = index.data(MessageProperty).toInt();
 
-        //switch view
-        QVariantList param;
-        param << MsgBaseView::UNIVIEWER;  // target view
-        param << MsgBaseView::CV; // source view
+    bool canForwardMessage  = true;
+    if (messageType == ConvergedMessage::Mms){
+        canForwardMessage = (messageProperty & EPreviewForward)? true:false;
+    } 
+    
+    //switch view
+    QVariantList param;
+    param << MsgBaseView::UNIVIEWER;  // target view
+    param << MsgBaseView::CV; // source view
 
-        param << contactId;
-        param << dataArray;
-        param << mMessageModel->rowCount();
-
-        emit switchView(param);
+    param << contactId;
+    param << messageId;
+    param << mMessageModel->rowCount();
+    if (canForwardMessage == true)
+    {
+      param << 1;
+    }
+    else
+   	{
+   		param << 0;
+   	}
+    emit switchView(param);
 }
 
 //---------------------------------------------------------------
@@ -1050,6 +1043,7 @@
     {
         message.setBodyText(mEditorWidget->content());
 
+        // add address from contact-card to to-field
         ConvergedMessageAddress address;
         address.setAlias(mContactCardWidget->address().at(0)->alias());
         address.setAddress(mContactCardWidget->address().at(0)->address());
@@ -1077,6 +1071,28 @@
             // instead, we will get a list of contacts. Pass it as it is.
             data2 = data.at(1);
         }
+        else if(editorOperation == MsgBaseView::ADD_RECIPIENTS)
+        {
+            ConvergedMessageAddressList addresses;
+            CntServicesContactList contactList = 
+                    qVariantValue<CntServicesContactList>(data.at(1));
+            // now add fetched contacts from contact selection dialog
+            for(int i = 0; i < contactList.count(); i++ )
+            {
+                ConvergedMessageAddress* address = new ConvergedMessageAddress;
+                address->setAlias(contactList[i].mDisplayName);
+                if(!contactList[i].mPhoneNumber.isEmpty())
+                {
+                    address->setAddress(contactList[i].mPhoneNumber);
+                }
+                else
+                {
+                    address->setAddress(contactList[i].mEmailAddress);
+                }
+                addresses.append(address);
+            }
+            message.addToRecipients(addresses);
+        }
     }
     else
     {
@@ -1104,12 +1120,7 @@
 // @see header file
 //---------------------------------------------------------------
 void MsgConversationView::populateConversationsView()
-{
-    bool b = connect(ConversationsEngine::instance(), 
-                     SIGNAL(conversationModelUpdated()),
-                     this, 
-                     SLOT(scrollToBottom()));
-
+{    
     mConversationList->setModel(mMessageModel);
     
     refreshView();
@@ -1162,26 +1173,6 @@
 }
 
 //---------------------------------------------------------------
-// MsgConversationView::validateMsgForForward
-// @see header file
-//---------------------------------------------------------------
-bool MsgConversationView::validateMsgForForward(int &messageType,
-    qint32 &messageId)
-{
-    bool retValue = true;
-    if (messageType == ConvergedMessage::Mms)
-    {
-        //Validate if the mms msg can be forwarded or not
-        MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;
-        retValue = mmsConformanceCheck->validateMsgForForward(messageId);
-        
-        delete mmsConformanceCheck;
-    }
-
-    return retValue;
-}
-
-//---------------------------------------------------------------
 // MsgConversationView::vkbOpened
 // @see header file
 //---------------------------------------------------------------
@@ -1189,9 +1180,7 @@
 {
     mVkbopened = true;
     
-    mContactCardWidget->connectSignals(false);
-    
-    emit hideChrome(true);
+    emit vkbOpened(true);
     
     QRectF appRect = mVkbHost->applicationArea();    
     qreal spacing = 0.0;
@@ -1217,12 +1206,12 @@
 {
     mVkbopened = false;
     
-    mContactCardWidget->connectSignals(true);
-    
-    emit hideChrome(false);
+    emit vkbOpened(false);
     
     this->setMaximumHeight(-1);
     connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
+    
+    scrollToBottom();
 }
 
 //---------------------------------------------------------------
@@ -1237,22 +1226,161 @@
 //---------------------------------------------------------------
 // MsgConversationView::activateInputBlocker
 // @see header file
-//--------------------------------------------------------------
+//---------------------------------------------------------------
 void MsgConversationView::activateInputBlocker()
-    {
-        this->grabMouse();
-        this->grabKeyboard();
-    }
+{
+    mainWindow()->setInteractive(false);
+}
 
 //---------------------------------------------------------------
 // MsgConversationView::deactivateInputBlocker
 // @see header file
-//--------------------------------------------------------------
+//---------------------------------------------------------------
 void MsgConversationView::deactivateInputBlocker()
-    {    
-        this->ungrabKeyboard();
-        this->ungrabMouse();
+{
+    mainWindow()->setInteractive(true);
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::handleProvisoningMsg
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::handleProvisoningMsg(int msgId)
+	{
+		QString messageId;
+    messageId.setNum(msgId);
+
+    XQApplicationManager* aiwMgr = new XQApplicationManager();
+
+    XQAiwRequest* request = aiwMgr->create("com.nokia.services.MDM", 
+            "Provisioning",
+            "ProcessMessage(QString)", true); // embedded
+
+    if (request) {
+    QList<QVariant> args;
+    args << QVariant(messageId);
+    request->setArguments(args);
+
+    // Send the request
+    bool res = request->send();
+
+    // Cleanup
+    delete request;
+    }
+
+    delete aiwMgr;
+	}
+
+//---------------------------------------------------------------
+// MsgConversationView::onDialogSettingsLaunch
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::onDialogSettingsLaunch(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        //switch to settings view
+         QVariantList param;
+         param << MsgBaseView::MSGSETTINGS;
+         param << MsgBaseView::CV;
+         param << MsgSettingsView::SMSView;
+         emit switchView(param);
     }
 
+}
 
+//---------------------------------------------------------------
+// MsgConversationView::onDialogdeleteMsg
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::onDialogdeleteMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        QModelIndex index = mConversationList->currentIndex();
+        if (index.isValid()) {
+            int count = mMessageModel->rowCount();
+            //delete message
+            qint32 messageId = index.data(ConvergedMsgId).toLongLong();
+            if (messageId) {
+                QList<int> msgIdList;
+                msgIdList.append(messageId);
+                ConversationsEngine::instance()->deleteMessages(msgIdList);
+                //switch view               
+                if (count == 1) {
+                    QVariantList param;
+                    param << MsgBaseView::CLV; // target view
+                    param << MsgBaseView::CV; // source view
+                    emit switchView(param);
+                }
+            }
+        }
+
+    }
+
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::onDialogDownLoadMsg
+// @see header file
+//--------------------------------------------------------------
+void MsgConversationView::onDialogDownLoadMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        downloadMessage();
+    }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::onDialogSaveTone
+// @see header file
+//--------------------------------------------------------------
+void MsgConversationView::onDialogSaveTone(HbAction* action)
+    {
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        saveRingingTone();
+    }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::onOrientationChanged
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::onOrientationChanged(Qt::Orientation newOrientation)
+{
+    Q_UNUSED(newOrientation)
+
+    // On orientation change always make the preserved index(last visible item) to be visible
+    if(mVisibleIndex.isValid())
+    {
+    mConversationList->scrollTo(mVisibleIndex, HbAbstractItemView::PositionAtBottom);
+    mVisibleIndex = QModelIndex();
+    }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::onOrientationAboutToBeChanged
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::onOrientationAboutToBeChanged()
+{
+    // Preserve the model index of the last visible item to be scrolled on orientation change
+    QList<HbAbstractViewItem *>items = mConversationList->visibleItems();
+    if (items.count() > 0) {
+        mVisibleIndex = items.last()->modelIndex();
+    }
+}
+
+//---------------------------------------------------------------
+// MsgConversationView::onViewReady
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationView::onViewReady()
+{
+    //Disconnect list View's signals, for avoiding execution of the default implementaion
+    disconnect(mainWindow(), SIGNAL(aboutToChangeOrientation()), mConversationList, 0);
+    disconnect(mainWindow(), SIGNAL(orientationChanged(Qt: rientation)), mConversationList, 0);
+}
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationviewitem.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,6 +26,8 @@
 #include <HbIconItem>
 #include <HbIconAnimationManager>
 #include <HbIconAnimator>
+#include <ccsdefs.h>
+#include <HbInstance>
 
 // USER INCLUDES
 #include "msgconversationwidget.h"
@@ -40,6 +42,9 @@
 const QString ANIMATION_FILE(":/qtg_anim_loading.axml");
 const QString ANIMATION_ICON_NAME("qtg_anim_loading");
 const QString VCARD_ICON("qtg_large_mycard");
+const QString IMAGE_ICON("qtg_small_image");
+const QString CORRUPTED_ICON("qtg_small_corrupted");
+const QString MSG_VIDEO_ICON("qtg_small_video");
 
 // LOCALIZATION
 #define LOC_RINGING_TONE hbTrId("txt_messaging_dpopinfo_ringing_tone")
@@ -54,13 +59,8 @@
 //---------------------------------------------------------------
 MsgConversationViewItem::MsgConversationViewItem(QGraphicsItem* parent) :
     HbListViewItem(parent), mIncoming(false), mConversation(0),
-            mMessageStateIconItem(0)
+            mIncomingMsgStateIconItem(0), mOutgoingMsgStateIconItem(0)
 {
-    mConversation = new MsgConversationWidget(this);
-    HbStyle::setItemName(mConversation, "msgconvwidget");
-
-    mMessageStateIconItem = new HbIconItem(this);
-    HbStyle::setItemName(mMessageStateIconItem, "msgStateIcon");
 }
 
 //---------------------------------------------------------------
@@ -69,7 +69,6 @@
 //---------------------------------------------------------------
 MsgConversationViewItem::~MsgConversationViewItem()
 {
-
 }
 
 //---------------------------------------------------------------
@@ -78,7 +77,9 @@
 //---------------------------------------------------------------
 MsgConversationViewItem* MsgConversationViewItem::createItem()
 {
-    return new MsgConversationViewItem();
+    MsgConversationViewItem *item = new MsgConversationViewItem(*this);
+    item->init();
+    return item;
 }
 
 //---------------------------------------------------------------
@@ -94,200 +95,324 @@
             << index.data(ConvergedMsgId).toInt();
 #endif
 
-    // Create items common to each type of message
-
-    QString bodyText = index.data(BodyText).toString();
     int messageType = index.data(MessageType).toInt();
     int messageSubType = index.data(MessageSubType).toInt();
 
-    // Set message properties common to SMS/MMS/IM etc..
+    
+    if (messageType == ConvergedMessage::Sms)
+        {
+        	updateSmsTypeItem(index);
+        }
+    else if (messageType == ConvergedMessage::Mms || messageType
+            == ConvergedMessage::MmsNotification || messageType
+            == ConvergedMessage::BT)
+        {
+        updateMmsTypeItem(index, messageType, messageSubType);
+        }
+    else if (messageType == ConvergedMessage::BioMsg)
+        {
+        if (messageSubType == ConvergedMessage::VCard || messageSubType
+                == ConvergedMessage::RingingTone)
+            {
+            updateMmsTypeItem(index, messageType, messageSubType);
+            }
+        else
+            {
+            updateSmsTypeItem(index, messageSubType);
+            }
+        }
 
+#ifdef _DEBUG_TRACES_
+    qCritical() << "END MsgConversationViewItem::updateChildItems: "
+            << index.data(ConvergedMsgId).toInt();
+#endif
+
+    repolish();
+    HbListViewItem::updateChildItems();
+    }
+
+//---------------------------------------------------------------
+// MsgConversationViewItem::updateSmsTypeItem
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationViewItem::updateSmsTypeItem(const QModelIndex& index,
+    int messageSubType)
+{
+
+    mIncoming = false;
+    mConversation->resetProperties();
+    
     int direction = index.data(Direction).toInt();
-
-    if ( direction == ConvergedMessage::Incoming)
-    {
+    
+    if (direction == ConvergedMessage::Incoming)
+        {
         setIncoming(true);
         mConversation->setIncoming(true);
-        
-        if(messageType == ConvergedMessage::MmsNotification)
+
+        mIncomingMsgStateIconItem->setVisible(false);
+    }
+    else if (direction == ConvergedMessage::Outgoing)
+        {
+        setIncoming(false);
+        mConversation->setIncoming(false);
+
+        int sendingState = index.data(SendingState).toInt();
+        mConversation->setSendingState(sendingState);
+        setMessageStateIcon(sendingState);
+        }
+
+    bool unreadStatus = index.data(UnReadStatus).toBool();
+    mConversation->setUnread(unreadStatus);
+
+    mConversation->drawBubbleFrame();
+    mConversation->drawNewItemFrame();
+
+    QDateTime dateTime;
+    dateTime.setTime_t(index.data(TimeStamp).toUInt());
+    QString resendStateNote((index.data(SendingState).toInt()
+                    == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
+    if (dateTime.date() == QDateTime::currentDateTime().date())
+        {
+
+        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
+                        TIME_FORMAT));
+        }
+    else
+        {
+        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
+                        DATE_FORMAT));
+        }
+
+    if (messageSubType == ConvergedMessage::VCal)
         {
+         mConversation->setSubject(LOC_UNSUPPORTED_MSG_TYPE);
+        }
+    else
+        {
+        QString bodyText = index.data(BodyText).toString();
+        bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
+        bodyText.replace('\r', QChar::LineSeparator);
+        mConversation->setSubject(bodyText);
+        }
+    
+    //repolish
+    mConversation->repolishWidget();
+    }
+
+//---------------------------------------------------------------
+// MsgConversationViewItem::updateMmsTypeItem
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationViewItem::updateMmsTypeItem(const QModelIndex& index,
+        int messageType, int messageSubType)
+    {
+    // create widget
+    if (!mConversation)
+        {
+        mConversation = new MsgConversationWidget(this);
+        HbStyle::setItemName(mConversation, "msgconvwidget");
+        }
+    mIncoming = false;
+    mConversation->resetProperties();
+    
+    mConversation->setMMS(true);
+    int direction = index.data(Direction).toInt();
+    QString bodyText = index.data(BodyText).toString();
+
+    if (direction == ConvergedMessage::Incoming)
+        {
+        setIncoming(true);
+        mConversation->setIncoming(true);
+
+        if (messageType == ConvergedMessage::MmsNotification)
+            {
             mConversation->setMMSNotification(true);
             int notificationState = index.data(NotificationStatus).toInt();
             mConversation->setNotificationState(notificationState);
             setNotificationStateIcon(notificationState);
+            }
+        else
+            {
+            mIncomingMsgStateIconItem->setVisible(false);
+            }
         }
-        else
+    else if (direction == ConvergedMessage::Outgoing)
         {
-            mMessageStateIconItem->setVisible(false);
-        }
-    }
-    else if (direction == ConvergedMessage::Outgoing)
-    {
         setIncoming(false);
         mConversation->setIncoming(false);
 
         int sendingState = index.data(SendingState).toInt();
         mConversation->setSendingState(sendingState);
         setMessageStateIcon(sendingState);
-    }
+        }
 
     bool unreadStatus = index.data(UnReadStatus).toBool();
     mConversation->setUnread(unreadStatus);
-    // Create items common to SMS/MMS/IM etc...
+
     mConversation->drawBubbleFrame();
     mConversation->drawNewItemFrame();
 
     QDateTime dateTime;
     dateTime.setTime_t(index.data(TimeStamp).toUInt());
-    QString resendStateNote((index.data(SendingState).toInt() == ConvergedMessage::Resend)? LOC_RESEND_AT : "");
+    QString resendStateNote((index.data(SendingState).toInt()
+            == ConvergedMessage::Resend) ? LOC_RESEND_AT : "");
     if (dateTime.date() == QDateTime::currentDateTime().date())
-    {
-
-        mConversation->setTimeStamp(resendStateNote + dateTime.toString(TIME_FORMAT));
-    }
-    else
-    {
-        mConversation->setTimeStamp(resendStateNote + dateTime.toString(DATE_FORMAT));
-    }
+        {
 
-    QDEBUG_WRITE_FORMAT("MsgConversationViewItem::updateChildItems msg type value",messageType)
-    
-    if (messageType == ConvergedMessage::Sms ||
-            messageType == ConvergedMessage::IM)
-    {
-        mConversation->setMMS(false);
-        bodyText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
-        bodyText.replace('\r', QChar::LineSeparator);
-        mConversation->setBodyText(bodyText);
-    }
-    else if (messageType == ConvergedMessage::Mms)
-    {
-        mConversation->setMMS(true);
-        QString attachments = index.data(Attachments).toString();
+        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
+                TIME_FORMAT));
+        }
+    else
+        {
+        mConversation->setTimeStamp(resendStateNote + dateTime.toString(
+                DATE_FORMAT));
+        }
+
+    if (messageType == ConvergedMessage::Mms)
+        {
+        //preview path
+        QString previewPath = index.data(Attachments).toString();
         QString subject = index.data(Subject).toString();
 
-        bool hasAttachments = (index.data(MessageProperty).toInt()
-            & ConvergedMessage::Attachment) ? true : false;
+        int msgProperty = index.data(MessageProperty).toInt();
+        bool hasAttachments = (msgProperty & EPreviewAttachment) ? true : false;
 
         if (hasAttachments)
-        {
+            {
             mConversation->setAttachment();
-        }
+            }
         else
-        {
+            {
             mConversation->setAttachment(false);
-        }
-        QStringList mediaFiles = attachments.split('|',
-            QString::SkipEmptyParts);
-        //Can be used for preview icon
-        QStringList imageFiles;
-
-        MsgViewUtils viewUtils;
-
-        for (int i = 0; i < mediaFiles.size(); ++i)
-        {
-            QString type = viewUtils.mimeTypeL(QDir::toNativeSeparators(
-                mediaFiles.at(i)));
+            }
+        
+        // Now set the media contents
+        
+        //preview image
+        bool hasImage = (msgProperty & EPreviewImage) ? true : false;
+        if (hasImage)
+          {
+            mConversation->setImage(true);
+            HbIcon previewIcon;
+            if (msgProperty & EPreviewProtectedImage)
+              {
+                previewIcon = HbIcon(IMAGE_ICON);
+              }
+            else if (msgProperty & EPreviewCorruptedImage)
+              {
+                // TODO: Change to official icon.
+                previewIcon = HbIcon(CORRUPTED_ICON);
+              }
+            else
+              {
+                QVariant previewData = index.data(PreviewIcon);
+                previewIcon = qvariant_cast<HbIcon> (previewData);
+              }
+            mConversation->setPreviewIcon(previewIcon);
+          }
 
-            if (type.contains("image"))
-            {
-                imageFiles << mediaFiles.at(i);
-                mConversation->setImage(true);
-            }
-            else if (type.contains("video"))
-            {
-                mConversation->setVideo(false);
-            }
-            else if (type.contains("audio"))
-            {
-                mConversation->setAudio(true);
-            }
-        }
-        // Now set the media contents
-        if (!imageFiles.isEmpty())
-        {
-            mConversation->setPreviewIconPath(imageFiles.at(0));
-        }
-        mConversation->displayAudioIcon();
+        bool hasVideo = (msgProperty & EPreviewVideo) ? true : false;
+        if (hasVideo)
+          {
+            mConversation->setVideo(true);
+            HbIcon videoPreviewIcon;
+            if (msgProperty & EPreviewProtectedVideo)
+              {
+                videoPreviewIcon = HbIcon(MSG_VIDEO_ICON);
+              }
+            else if (msgProperty & EPreviewCorruptedVideo)
+              {
+                videoPreviewIcon = HbIcon(CORRUPTED_ICON);
+              }
+            else
+              {
+                videoPreviewIcon = HbIcon(MSG_VIDEO_ICON);
+              }
+            mConversation->setPreviewIcon(videoPreviewIcon);
+          }
+        bool hasAudio = (msgProperty & EPreviewAudio) ? true : false;              
+        if (hasAudio)
+          {
+            mConversation->setAudio(true);
+            if (msgProperty & EPreviewProtectedAudio)
+              {
+                mConversation->displayAudioIcon();
+              }
+            else if (msgProperty & EPreviewCorruptedAudio)
+              {
+				mConversation->displayAudioIcon(CORRUPTED_ICON);
+              }
+            else
+              {
+                mConversation->displayAudioIcon();
+              }
+          }
 
         int priority = index.data(MessagePriority).toInt();
         mConversation->setPriority(priority);
         mConversation->setSubject(subject);
-        mConversation->setBodyText(bodyText);        
-    } // END of ConvergedMessage::Mms
+        mConversation->setBodyText(bodyText);
+        }
     else if (messageType == ConvergedMessage::BioMsg)
-    {
+        {
         if (messageSubType == ConvergedMessage::RingingTone)
-        {
-            mConversation->setMMS(true);
+            {
             mConversation->setImage(false);
             mConversation->setAudio(true);
             mConversation->displayAudioIcon();
             mConversation->setSubject(LOC_RINGING_TONE);
-        }
+            mConversation->setBodyText(bodyText);
+            }
         else if (messageSubType == ConvergedMessage::VCard)
-        {
-            mConversation->setMMS(true);
+            {
             mConversation->setImage(false);
             mConversation->setAudio(true);
             mConversation->displayAudioIcon(VCARD_ICON);
             mConversation->setSubject(LOC_BUSINESS_CARD);
             mConversation->setBodyText(bodyText);
+            }
         }
-        else
+    else if (messageType == ConvergedMessage::BT)
         {
-            mConversation->setMMS(false);
-            mConversation->setBodyText(LOC_UNSUPPORTED_MSG_TYPE);
-        }
-    }
-    else if (messageType == ConvergedMessage::BT)
-    {
-        mConversation->setMMS(true);
         QString deviceName = index.data(ConversationAddress).toString();
         mConversation->setSubject(deviceName);
         QString blueToothBody;
         if (messageSubType == ConvergedMessage::VCard)
-        {
+            {
             mConversation->setImage(false);
             mConversation->setAudio(true);
             mConversation->displayAudioIcon(VCARD_ICON);
             blueToothBody.append(LOC_BUSINESS_CARD);
             blueToothBody.append(QChar::LineSeparator);
             blueToothBody.append(bodyText);
-        }        
+            }
         else
-        {
+            {
             blueToothBody.append(bodyText);
-        }
+            }
         mConversation->setBodyText(blueToothBody);
-    }
-    else if(messageType == ConvergedMessage::MmsNotification)
-    {
-        mConversation->setMMS(true);
-        
+        }
+    else if (messageType == ConvergedMessage::MmsNotification)
+        {
         QString subject = index.data(Subject).toString();
         int priority = index.data(MessagePriority).toInt();
         mConversation->setPriority(priority);
         mConversation->setSubject(subject);
         mConversation->setBodyText(bodyText);
+        }
+    
+    //repolish widget
+    mConversation->repolishWidget();
     }
 
-#ifdef _DEBUG_TRACES_
-    qCritical() << "END MsgConversationViewItem::updateChildItems: "
-            << index.data(ConvergedMsgId).toInt();
-#endif
-
-    HbListViewItem::updateChildItems();
-}
-
 //---------------------------------------------------------------
 // MsgConversationViewItem::containsPoint
 //
 //---------------------------------------------------------------
 bool MsgConversationViewItem::containsPoint(const QPointF& point)
 {
-    return mConversation->boundingRect().
-    contains(mConversation->mapFromScene(point));
+    return mConversation->boundingRect(). contains(mConversation->mapFromScene(
+        point));
 }
 
 //---------------------------------------------------------------
@@ -297,6 +422,23 @@
 void MsgConversationViewItem::setIncoming(bool incoming)
 {
     mIncoming = incoming;
+
+    if (mIncoming)
+    {
+        HbStyle::setItemName(mOutgoingMsgStateIconItem, "");
+        mOutgoingMsgStateIconItem->setVisible(false);
+        HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming");
+        mIncomingMsgStateIconItem->setIcon(HbIcon());
+        mIncomingMsgStateIconItem->setVisible(false);
+    }
+    else
+    {
+        HbStyle::setItemName(mIncomingMsgStateIconItem, "");
+        mIncomingMsgStateIconItem->setVisible(false);
+        HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing");
+        mOutgoingMsgStateIconItem->setIcon(HbIcon());
+        mOutgoingMsgStateIconItem->setVisible(false);
+    }
 }
 
 //---------------------------------------------------------------
@@ -314,52 +456,52 @@
 //---------------------------------------------------------------
 void MsgConversationViewItem::setMessageStateIcon(int messageState)
 {
-    HbIconAnimator& iconAnimator = mMessageStateIconItem->animator();
-    HbIconAnimationManager* iconAnimationManager = HbIconAnimationManager::global();
+    HbIconAnimator& iconAnimator = mOutgoingMsgStateIconItem->animator();
+    HbIconAnimationManager* iconAnimationManager =
+            HbIconAnimationManager::global();
     switch (messageState)
     {
-
         case ConvergedMessage::Waiting:
         case ConvergedMessage::Scheduled:
         case ConvergedMessage::Sending:
-        { 
- 	        bool defined = iconAnimationManager->addDefinitionFile(ANIMATION_FILE);
-     	    HbIcon animIcon;
+        {
+            bool defined = iconAnimationManager->addDefinitionFile(
+                ANIMATION_FILE);
+            HbIcon animIcon;
             animIcon.setIconName(ANIMATION_ICON_NAME);
-            QSizeF size = mMessageStateIconItem->size();
-            mMessageStateIconItem->setIcon(animIcon);
-            mMessageStateIconItem->setVisible(true);
+            QSizeF size = mOutgoingMsgStateIconItem->size();
+            mOutgoingMsgStateIconItem->setIcon(animIcon);
+            mOutgoingMsgStateIconItem->setVisible(true);
             iconAnimator.startAnimation();
-            repolish();
             break;
         }     
         case ConvergedMessage::Suspended:
         {
-           iconAnimator.stopAnimation();
-           mMessageStateIconItem->setIcon(MSG_OUTBOX_ICON);
-           mMessageStateIconItem->setVisible(true);
-           break;
-        
+            iconAnimator.stopAnimation();
+            mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
+            mOutgoingMsgStateIconItem->setVisible(true);
+            break;
+
         }
         case ConvergedMessage::Resend:
         {
             iconAnimator.stopAnimation();
-            mMessageStateIconItem->setIcon(MSG_OUTBOX_ICON);
-            mMessageStateIconItem->setVisible(true);
+            mOutgoingMsgStateIconItem->setIcon(MSG_OUTBOX_ICON);
+            mOutgoingMsgStateIconItem->setVisible(true);
             break;
         }
         case ConvergedMessage::Failed:
         {
             iconAnimator.stopAnimation();
-            mMessageStateIconItem->setIcon(MSG_FAIL_ICON);
-            mMessageStateIconItem->setVisible(true);
+            mOutgoingMsgStateIconItem->setIcon(MSG_FAIL_ICON);
+            mOutgoingMsgStateIconItem->setVisible(true);
             break;
         }   
         case ConvergedMessage::Unknown:
         default:
         {
             iconAnimator.stopAnimation();
-            mMessageStateIconItem->setVisible(false);
+            mOutgoingMsgStateIconItem->setVisible(false);
             break;
         }
     }
@@ -372,29 +514,29 @@
 
 void MsgConversationViewItem::setNotificationStateIcon(int notificationState)
 {
-    HbIconAnimator& iconAnimator = mMessageStateIconItem->animator();
-    HbIconAnimationManager* iconAnimationManager = HbIconAnimationManager::global();
+    HbIconAnimator& iconAnimator = mIncomingMsgStateIconItem->animator();
+    HbIconAnimationManager* iconAnimationManager =
+            HbIconAnimationManager::global();
     switch (notificationState)
     {
-
         case ConvergedMessage::NotifRetrieving:
         case ConvergedMessage::NotifWaiting:
         { 
             //TODO: Temp icon until official icons are received
-            bool defined = iconAnimationManager->addDefinitionFile(ANIMATION_FILE);
+            bool defined = iconAnimationManager->addDefinitionFile(
+                ANIMATION_FILE);
             HbIcon animIcon;
             animIcon.setIconName(ANIMATION_ICON_NAME);
-            QSizeF size = mMessageStateIconItem->size();
-            mMessageStateIconItem->setIcon(animIcon);
-            mMessageStateIconItem->setVisible(true);
+            QSizeF size = mIncomingMsgStateIconItem->size();
+            mIncomingMsgStateIconItem->setIcon(animIcon);
+            mIncomingMsgStateIconItem->setVisible(true);
             iconAnimator.startAnimation();
-            repolish();
             break;
         }     
         default:
         {
             iconAnimator.stopAnimation();
-            mMessageStateIconItem->setVisible(false);
+            mIncomingMsgStateIconItem->setVisible(false);
             break;
         }
     }
@@ -409,4 +551,41 @@
     mConversation->pressStateChanged(pressed, animate);
 }
 
+//---------------------------------------------------------------
+// MsgConversationViewItem::init
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationViewItem::init()
+{
+    mConversation = new MsgConversationWidget(this);
+    HbStyle::setItemName(mConversation, "msgconvwidget");
+
+    mIncomingMsgStateIconItem = new HbIconItem(this);
+    HbStyle::setItemName(mIncomingMsgStateIconItem, "msgStateIconIncoming");
+
+    mOutgoingMsgStateIconItem = new HbIconItem(this);
+    HbStyle::setItemName(mOutgoingMsgStateIconItem, "msgStateIconOutgoing");
+
+    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();
+}
+
+//---------------------------------------------------------------
+// MsgConversationViewItem::orientationchanged
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationViewItem::orientationchanged(Qt::Orientation orientation)
+{
+    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged start.")
+
+    repolish();
+
+    QDEBUG_WRITE("MsgConversationViewItem:orientationchanged end.")
+}
+
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgconversationwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,19 +25,26 @@
 #include <QImageReader>
 #include <QDir>
 #include <HbEffect>
+#include <s32strm.h>
+#include <s32mem.h>
+#include <fbs.h>
+#include <sqldb.h>
+#include <QBool>
+#include <QCoreApplication>
+#include <HbEvent>
+#include <HbMainWindow>
+#include <HbInstance>
+
 #include "debugtraces.h"
 
 #include "convergedmessage.h"
-
-const int MAX_SIZE(200);
+#include "conversationsengine.h"
 
 // Icons
 const QString MSG_HIGH_PRIORITY_ICON("qtg_small_priority_high");
 const QString MSG_LOW_PRIORITY_ICON("qtg_small_priority_low");
 const QString MSG_ATTACH_ICON("qtg_small_attachment");
-const QString MSG_AUDIO_ICON("qtg_large_music_player");
-const QString MSG_VIDEO_ICON("qtg_large_video_player");
-const QString MSG_AUDIO_PLAY_ICON("qtg_large_music_player");
+const QString MSG_AUDIO_PLAY_ICON("qtg_small_sound");
 
 
 // Frames
@@ -65,7 +72,7 @@
         mIsMMS(false),
         mIsMMSNotification(false),
         mPriority(0),
-        mSendingState(0),
+        mSendingState(Unknown),
         mNotificationState(0),
         mNewFrameItem(NULL),
         mBubbleFrameItem(NULL),
@@ -102,24 +109,34 @@
     // Common to SMS/MMS
 
     mBubbleFrameItem = new HbFrameItem(this);
-    // ZValue is set to make the bubble to be rendered in behind text items.
-    mBubbleFrameItem->setZValue(-1.0);
     mBubbleFrameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
     HbStyle::setItemName(mBubbleFrameItem, "bubble");
 
+    mNewFrameItem = new HbFrameItem(this);
+    mNewFrameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
+    HbStyle::setItemName(mNewFrameItem, "newItemIcon");
+    mSubjectTextItem = new HbTextItem(this);  
+    mSubjectTextItem->setTextWrapping(Hb::TextWordWrap);      
+    HbStyle::setItemName(mSubjectTextItem, "subject");
     mBodyTextItem = new HbTextItem(this);
     mBodyTextItem->setTextWrapping(Hb::TextWordWrap);
     HbStyle::setItemName(mBodyTextItem, "bodyText");
-
+    mPreviewIconItem = new HbIconItem(this);
+    HbStyle::setItemName(mPreviewIconItem, "preview");
+    mPriorityIconItem = new HbIconItem(this);            
+    HbStyle::setItemName(mPriorityIconItem, "priority");
+    mAttachmentIconItem = new HbIconItem(this);
+    HbStyle::setItemName(mAttachmentIconItem, "attachment");
+    mPlayIconItem = new HbIconItem(this);                
+    HbStyle::setItemName(mPlayIconItem, "playIcon");
     mTimeStampTextItem = new HbTextItem(this);
     HbStyle::setItemName(mTimeStampTextItem, "timeStamp");
-
-    mNewFrameItem = new HbFrameItem(this);
-    HbStyle::setItemName(mNewFrameItem, "newItemIcon");
-
-    mAttachmentIconItem = new HbIconItem(this);
-    HbStyle::setItemName(mAttachmentIconItem, "attachment");
-}
+    	
+    HbMainWindow *mainWindow = hbInstance->allMainWindows()[0];
+    connect(mainWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, 
+			SLOT(orientationchanged(Qt::Orientation)),Qt::UniqueConnection);
+    polishEvent();
+    }
 
 //---------------------------------------------------------------
 // MsgConversationWidget::setSubject
@@ -127,12 +144,9 @@
 //---------------------------------------------------------------
 void MsgConversationWidget::setSubject(const QString &subject)
 {
-    if (!mSubjectTextItem)
-    {
-        mSubjectTextItem = new HbTextItem(this);
-        HbStyle::setItemName(mSubjectTextItem, "subject");
-    }
+    HbStyle::setItemName(mSubjectTextItem, "subject");
     mSubjectTextItem->setText(subject);
+    mSubjectTextItem->show();
 }
 
 //---------------------------------------------------------------
@@ -141,51 +155,31 @@
 //---------------------------------------------------------------
 void MsgConversationWidget::setBodyText(const QString &body)
 {
+    HbStyle::setItemName(mBodyTextItem, "bodyText");
+
     mBodyTextItem->setText(body);
+    mBodyTextItem->show();
 }
 
 //---------------------------------------------------------------
-// MsgConversationWidget::setPreviewIconPath
+// MsgConversationWidget::setPreviewIcon
 // @see header file
 //---------------------------------------------------------------
-void MsgConversationWidget::setPreviewIconPath(const QString &previewPath)
+void MsgConversationWidget::setPreviewIcon(HbIcon& icon)
 {
-    if (!mPreviewIconItem)
-    {
-        mPreviewIconItem = new HbIconItem(this);
-        mPreviewIconItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-        HbStyle::setItemName(mPreviewIconItem, "preview");
-    }
+    QCRITICAL_WRITE("MsgConversationWidget::setPreviewIcon start.")
+
+
+    HbStyle::setItemName(mPreviewIconItem, "preview");
 
-    if (previewPath.isEmpty())
-    {
-        mPreviewIconItem->setEnabled(false);
-    }
-    else
-    {
-        QImageReader iReader(previewPath);
-        QSize size(iReader.size());
-        
-        if(size.height() > MAX_SIZE || size.width() > MAX_SIZE)
-        {
-        size.scale(MAX_SIZE,MAX_SIZE,Qt::KeepAspectRatio);
-        iReader.setScaledSize(size);
+    mPreviewIconItem->setIcon(icon);
+    mPreviewIconItem->setPreferredSize(icon.size());
+    mPreviewIconItem->show();
 
-        QImage icon = iReader.read();
-        QPixmap pixmap = QPixmap::fromImage(icon);
-        
-        mPreviewIconItem->setIcon(HbIcon(pixmap));
-        }
-        else
-        {
-            QPixmap pixmap(previewPath);
-            mPreviewIconItem->setIcon(HbIcon(pixmap));
-        }
-        
-        mPreviewIconItem->setEnabled(true);
-    }
+    QCRITICAL_WRITE("MsgConversationWidget::setPreviewIcon end.")
 }
 
+
 //---------------------------------------------------------------
 // MsgConversationWidget::setPriority
 // @see header file
@@ -196,12 +190,7 @@
 
     if (priority)
     {
-        if (!mPriorityIconItem)
-        {
-            mPriorityIconItem = new HbIconItem(this);
-            HbStyle::setItemName(mPriorityIconItem, "priority");
-        }
-
+        HbStyle::setItemName(mPriorityIconItem, "priority");
         if (ConvergedMessage::Low == priority)
         {
             mPriorityIconItem->setIcon(HbIcon(MSG_LOW_PRIORITY_ICON));
@@ -210,6 +199,7 @@
         {
             mPriorityIconItem->setIcon(HbIcon(MSG_HIGH_PRIORITY_ICON));
         }
+        mPriorityIconItem->show();
     }
 }
 
@@ -232,7 +222,9 @@
 
     if (attachment)
     {
+        HbStyle::setItemName(mAttachmentIconItem, "attachment");
         mAttachmentIconItem->setIcon(HbIcon(MSG_ATTACH_ICON));
+        mAttachmentIconItem->show();
     }
 }
 
@@ -289,24 +281,30 @@
 {
     if (hasAudio())
     {
-        if (hasImage())
+        if (!hasImage())
         {
-            if (!mPlayIconItem)
+            HbStyle::setItemName(mPreviewIconItem, "preview");
+            if(iconPath.isEmpty())
             {
-                mPlayIconItem = new HbIconItem(this);
-                HbStyle::setItemName(mPlayIconItem, "playIcon");
+               qreal iconSize = 0;
+               style()->parameter("hb-param-graphic-size-primary-small",iconSize);
+               HbIcon icon(MSG_AUDIO_PLAY_ICON);
+               icon.setHeight(iconSize);
+               icon.setWidth(iconSize);
+               mPreviewIconItem->setIcon(icon);
             }
-            mPlayIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath);
+            else
+            {
+               mPreviewIconItem->setIconName(iconPath);
+            }
+            mPreviewIconItem->show();
         }
         else
         {
-            if (!mAudioIconItem)
-            {
-                mAudioIconItem = new HbIconItem(this);
-                HbStyle::setItemName(mAudioIconItem, "audioIcon");
-            }
-            mAudioIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath);
-        }
+            HbStyle::setItemName(mPlayIconItem, "playIcon");
+            mPlayIconItem->setIconName(iconPath.isEmpty() ? MSG_AUDIO_PLAY_ICON : iconPath);
+            mPlayIconItem->show();          
+        }       
     }
 }
 
@@ -317,16 +315,6 @@
 void MsgConversationWidget::setVideo(bool video)
 {
     mHasVideo = video;
-
-    if (video)
-    {
-        if (!mVideoIconItem)
-        {
-            mVideoIconItem = new HbIconItem(this);
-            HbStyle::setItemName(mVideoIconItem, "video");
-        }
-        mVideoIconItem->setIcon(HbIcon(MSG_VIDEO_ICON));
-    }
 }
 
 //---------------------------------------------------------------
@@ -381,6 +369,8 @@
 void MsgConversationWidget::setUnread(bool unread)
 {
     mUnread = unread;
+    // Needed for colour group changes to be visible
+    QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));  
 }
 
 //---------------------------------------------------------------
@@ -439,7 +429,8 @@
         case ConvergedMessage::SentState:
         {
             mSendingState = Sent;
-            repolish();
+            // Needed for colour group changes to be visible
+            QCoreApplication::postEvent(this, new HbEvent(HbEvent::ThemeChanged));  
             break;
         }
         case ConvergedMessage::Sending:
@@ -470,7 +461,7 @@
 // MsgConversationWidget::sendingState
 // @see header file
 //---------------------------------------------------------------
-int MsgConversationWidget::sendingState()
+MsgConversationWidget::SendingState MsgConversationWidget::sendingState()
 {
     return mSendingState;
 }
@@ -527,7 +518,11 @@
 //---------------------------------------------------------------
 void MsgConversationWidget::setTimeStamp(const QString &timeStamp)
 {
+    HbStyle::setItemName(mTimeStampTextItem, "timeStamp");
+
     mTimeStampTextItem->setText(timeStamp);
+    mTimeStampTextItem->show();
+ 
 }
 
 //---------------------------------------------------------------
@@ -538,7 +533,6 @@
 {
     if (mUnread)
     {
-        mNewFrameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
         mNewFrameItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
     }
     else
@@ -569,15 +563,7 @@
     }
     else
     {
-        if(mSendingState == Sending || mSendingState == Pending || 
-           mSendingState == Unknown || mSendingState == Failed)
-        {
-            mBubbleFrameItem->frameDrawer().setFrameGraphicsName(CV_SENT_HIGHLIGHT_FR);
-        }
-        else
-        {
             mBubbleFrameItem->frameDrawer().setFrameGraphicsName(CV_SENT_NORMAL_FR);
-        }
     }
 }
 
@@ -610,4 +596,125 @@
     }
 }
 
+//---------------------------------------------------------------
+// MsgConversationWidget::resetProperties
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationWidget::resetProperties()
+    	{
+        mHasAttachment = false;
+        mHasImage = false;
+        mHasAudio = false;
+        mHasVideo = false;
+        mIsPlayable =false;
+        mIncoming =false;
+        mUnread =false;
+        mIsMMS = false;
+        mIsMMSNotification= false;
+        mPriority = 0;
+        mSendingState =Unknown;
+        mNotificationState =0;
+        
+		if(mBodyTextItem){
+			  mBodyTextItem->setText(QString());
+        mBodyTextItem->hide();
+        HbStyle::setItemName(mBodyTextItem, "");
+	    }
+    
+	    if(mSubjectTextItem){
+	    	  mSubjectTextItem->setText(QString());
+	        mSubjectTextItem->hide();
+	        HbStyle::setItemName(mSubjectTextItem, "");
+	    }
+    
+	    if(mTimeStampTextItem){
+	    	  mTimeStampTextItem->setText(QString());
+	        mTimeStampTextItem->hide();
+	        HbStyle::setItemName(mTimeStampTextItem, "");        
+	    }   
+    
+	    if(mAttachmentIconItem){
+	        mAttachmentIconItem->hide();
+	        HbStyle::setItemName(mAttachmentIconItem, "");
+	    }
+    
+	   if(mPriorityIconItem){
+	       HbStyle::setItemName(mPriorityIconItem, "");
+	        mPriorityIconItem->hide();
+	    }
+         
+	    if(mPlayIconItem){
+	        HbStyle::setItemName(mPlayIconItem, "");
+	        mPlayIconItem->hide();
+	       }
+    
+	    if(mPreviewIconItem){
+	        HbStyle::setItemName(mPreviewIconItem, "");
+	        mPreviewIconItem->hide();               
+	       }    
+    	}
+
+//---------------------------------------------------------------
+// MsgConversationWidget::orientationchanged
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationWidget::orientationchanged(Qt::Orientation orientation)
+{
+    QDEBUG_WRITE("MsgConversationWidget:orientationchanged start.")
+            
+    repolish();
+    
+    QDEBUG_WRITE("MsgConversationWidget:orientationchanged end.")    
+}
+
+//---------------------------------------------------------------
+// MsgConversationWidget::polish
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationWidget::polish(HbStyleParameters &params)
+{   
+    QString bubbleOrig = HbStyle::itemName(mBubbleFrameItem);
+    QString newItemIconOrig = HbStyle::itemName(mNewFrameItem);
+    QString subjectOrig = HbStyle::itemName(mSubjectTextItem);
+    QString bodyTextOrig = HbStyle::itemName(mBodyTextItem);
+    QString previewOrig = HbStyle::itemName(mPreviewIconItem);
+    QString priorityOrig = HbStyle::itemName(mPriorityIconItem);
+    QString attachmentOrig = HbStyle::itemName(mAttachmentIconItem);
+    QString timeStampOrig = HbStyle::itemName(mTimeStampTextItem);
+    QString playIconOrig = HbStyle::itemName(mPlayIconItem);
+
+    // Make sure that all the sub-items are polished in every polish.
+    HbStyle::setItemName(mBubbleFrameItem, "bubble");
+    HbStyle::setItemName(mNewFrameItem, "newItemIcon");
+    HbStyle::setItemName(mSubjectTextItem, "subject");
+    HbStyle::setItemName(mBodyTextItem, "bodyText");
+    HbStyle::setItemName(mPreviewIconItem, "preview");
+    HbStyle::setItemName(mPriorityIconItem, "priority");
+    HbStyle::setItemName(mAttachmentIconItem, "attachment");
+    HbStyle::setItemName(mTimeStampTextItem, "timeStamp");
+    HbStyle::setItemName(mPlayIconItem, "playIcon");
+
+    HbWidget::polish(params);
+
+    HbStyle::setItemName(mBubbleFrameItem, bubbleOrig);
+    HbStyle::setItemName(mNewFrameItem, newItemIconOrig);
+    HbStyle::setItemName(mSubjectTextItem, subjectOrig);
+    HbStyle::setItemName(mBodyTextItem, bodyTextOrig);
+    HbStyle::setItemName(mPreviewIconItem, previewOrig);
+    HbStyle::setItemName(mPriorityIconItem, priorityOrig);
+    HbStyle::setItemName(mAttachmentIconItem, attachmentOrig);
+    HbStyle::setItemName(mTimeStampTextItem, timeStampOrig);
+    HbStyle::setItemName(mPlayIconItem, playIconOrig);
+}
+
+//---------------------------------------------------------------
+// MsgConversationWidget::repolishWidget
+// @see header file
+//---------------------------------------------------------------
+void MsgConversationWidget::repolishWidget()
+    	{
+    	repolish();
+    	}
+
+
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgeditorwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -24,21 +24,21 @@
 #include <qgraphicsscene.h>
 #include <HbFrameDrawer>
 #include <HbFrameItem>
+#include <HbAction>
 #include <csmsaccount.h>
 #include <smutset.h>
 #include <hbmessagebox.h>
 #include <QTimer>
 #include "unieditorpluginloader.h"
 #include "unieditorplugininterface.h"
-#include "unisendingsettings.h"
-#include "unieditorgenutils.h"
+#include "UniSendingSettings.h"
+#include "UniEditorGenUtils.h"
 #include "debugtraces.h"
 
 // LOCAL CONSTANTS
-const QString PLUGINPATH("conversationviewplugin.dll");
 
 const QString SEND_ICON("qtg_mono_send");
-const QString BACKGROUND("qtg_fr_input_bg");
+const QString BACKGROUND("qtg_fr_input_v_bg");
 const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
 
 const QString SEND_BUTTON_NORMAL("qtg_fr_input_btn_function_normal");
@@ -46,8 +46,8 @@
 const QString SEND_BUTTON_DISABLED("qtg_fr_input_btn_function_disabled");
 
 #define LOC_SMS_CHAR_LIMIT_REACHED hbTrId("txt_messaging_dialog_sms_character_count_exceeded")
-#define LOC_DIALOG_OK hbTrId("txt_common_button_ok")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
+#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
+
   
 const TInt KShowCounterLimit = 10;
 
@@ -61,14 +61,6 @@
     HbWidget(parent), mMsgEditor(NULL),
     mSendButton(NULL),mPluginLoader(NULL)
 {
-    int baseId = style()->registerPlugin(PLUGINPATH);
-    
-    #ifdef _DEBUG_TRACES_
-    qDebug() << "MsgEditorWidget BASE ID --->" << baseId;
-    #endif
-    
-    setPluginBaseId(baseId);
-    
     //setting background.
     HbFrameItem* backGround = new HbFrameItem(this);
     backGround->frameDrawer().setFrameGraphicsName(BACKGROUND);
@@ -91,14 +83,15 @@
     mMsgEditor->setMaxRows(3); // NOTE: Don't remove this line.
     HbStyle::setItemName(mMsgEditor, "msgEditor");
 
-    mSendButton = new HbPushButton(this);
-    HbStyle::setItemName(mSendButton, "sendButton");
+	mSendButton = new HbPushButton(this); 
+    HbStyle::setItemName(mSendButton, "sendButton"); 
+    mSendButton->setEnabled(false); 
+    
+    HbFrameItem* backGround = new HbFrameItem(this); 
+    backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); 
+    mSendButton->setBackgroundItem(backGround); 
+    updateButtonBackground(SEND_BUTTON_DISABLED); 
     mSendButton->setIcon(HbIcon(SEND_ICON));
-    mSendButton->setEnabled(false);
-    HbFrameDrawer* drawer = new HbFrameDrawer(this);
-    drawer->setFrameType(HbFrameDrawer::NinePieces);
-    mSendButton->setFrameBackground(drawer);
-    updateButtonBackground(SEND_BUTTON_DISABLED);
     
     mCharCounter = new HbTextItem(this);
     HbStyle::setItemName(mCharCounter, "charCounter");
@@ -133,7 +126,6 @@
 //---------------------------------------------------------------
 MsgEditorWidget::~MsgEditorWidget()
 {
-    style()->unregisterPlugin(PLUGINPATH);
     delete mEditorUtils;
 }
 
@@ -229,7 +221,8 @@
     //Check if sms segment limit has been reached
     bool unicode = (unicodeMode) ? true : false;
     int contentSize = mEditorUtils->UTF8Size(string);
-    int maxSmsSize =  mEditorUtils->MaxSmsMsgSizeL(unicode);
+    int maxSmsSize =  0;
+    TRAP_IGNORE(maxSmsSize = mEditorUtils->MaxSmsMsgSizeL(unicode));
     
     if(contentSize > maxSmsSize)
     {        
@@ -259,20 +252,10 @@
 {
     mSmsCharLimitReached = false;
     
-    if(HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED,
-        LOC_DIALOG_OK,
-        LOC_BUTTON_CANCEL))
-    {
-        //Launch UniEditor 
-        emit smsCharLimitReached();
-        return;
-    }
-    else
-    {
-        //Set the previous content
-        setContent(QString(mPrevBuffer));
-        return;
-    }
+    HbMessageBox::question(LOC_SMS_CHAR_LIMIT_REACHED,
+                           this,SLOT(onSmsCharLimitReached(HbAction*)),
+                           HbMessageBox::Ok | HbMessageBox::Cancel);
+
 
 }
 
@@ -299,14 +282,15 @@
 // MsgEditor::updateButtonBackground
 // @see header
 //---------------------------------------------------------------
-void MsgEditorWidget::updateButtonBackground(const QString& bg)
-    {
-    HbFrameDrawer* drawer = mSendButton->frameBackground();
-    if(drawer)
-        {
-        drawer->setFrameGraphicsName(bg);        
-        }
-    }
+void MsgEditorWidget::updateButtonBackground(const QString& bg) 
+    { 
+    HbFrameItem* drawer = static_cast<HbFrameItem*>(mSendButton->backgroundItem()); 
+    if(drawer) 
+        { 
+        drawer->frameDrawer().setFrameGraphicsName(bg);   
+        } 
+    } 
+    
 
 //---------------------------------------------------------------
 // MsgEditor::onPressed
@@ -327,10 +311,10 @@
     }
 	
 //---------------------------------------------------------------
-// MsgEditor::setEncodingSettings
+// MsgEditor::setEncodingSettingsL
 // @see header
 //---------------------------------------------------------------
-void MsgEditorWidget::setEncodingSettings()
+void MsgEditorWidget::setEncodingSettingsL()
 { 
     if( mPluginLoader )
     {
@@ -373,7 +357,7 @@
 MsgEditor::MsgEditor(QGraphicsItem *parent)
 :HbLineEdit(parent)
     {
-    
+     this->setPlaceholderText(LOC_HINT_TEXT);
     }
 
 //---------------------------------------------------------------
@@ -406,5 +390,22 @@
     HbLineEdit::focusOutEvent(event);  
     }
 
+//---------------------------------------------------------------
+// MsgEditor::onSmsCharLimitReached
+// @see header
+//---------------------------------------------------------------
+void MsgEditorWidget::onSmsCharLimitReached(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+
+        //Launch UniEditor 
+        emit smsCharLimitReached();
+    }
+    else {
+        //Set the previous content
+        setContent( QString(mPrevBuffer));
+    }
+}
 
 // EOF
--- a/messagingapp/msgui/conversationview/src/msgviewutils.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/conversationview/src/msgviewutils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,7 +16,7 @@
  */
 
 #include "msgviewutils.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 // ---------------------------------------------------------------------------
 // Constructor
@@ -44,7 +44,7 @@
     RFs rfs;
     RFile file;
 
-    HBufC* fileName = S60QConversions::qStringToS60Desc(aFileName);
+    HBufC* fileName = XQConversions::qStringToS60Desc(aFileName);
 
     //TODO: The RFs and RApaLsSession has to be connected 1's, not for every mms
 
@@ -69,7 +69,7 @@
             rfs.Close();
             apaSession.Close();
 
-            return S60QConversions::s60Desc8ToQString(fileType);
+            return XQConversions::s60Desc8ToQString(fileType);
             }
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/tsrc.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2010 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:
+#
+#
+
+SUBDIRS += unittests
+TEMPLATE = subdirs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/hbwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010 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:
+ *
+ */
+
+#ifndef T_MSGCONVERSATIONVIEW_HBWIDGET_H
+#define T_MSGCONVERSATIONVIEW_HBWIDGET_H
+
+#include <QGraphicsWidget>
+
+/*
+    Mocked HbWidget class' external variables.
+ */
+extern QGraphicsWidget *hbwidget_parent;
+
+/*
+    Mocked HbWidget class.
+ */
+class HbWidget : public QGraphicsWidget
+{
+    Q_OBJECT
+public:
+    HbWidget(QGraphicsWidget *parent = NULL)
+    : QGraphicsWidget(hbwidget_parent = parent)
+    {
+    }
+    ~HbWidget()
+    {        
+    }
+        
+    void repolish() {}
+    
+private:
+    Q_DISABLE_COPY(HbWidget)
+private:    
+};
+
+#endif /* T_MSGCONVERSATIONVIEW_HBWIDGET_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/msgconversationwidgetheaders.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2010 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:
+ *
+ */
+
+#ifndef T_MSGCONVERSATIONWIDGET_HEADERS_H
+#define T_MSGCONVERSATIONWIDGET_HEADERS_H
+
+#include <QGraphicsWidget>
+
+#include "convergedmessage.h"
+#include "debugtraces.h"
+
+#define QCoreApplication QCoreApplication2
+
+/*
+    Mocked HbEvent class.
+ */
+class HbEvent : public QObject
+{
+    Q_OBJECT
+public:
+	  enum Flags{
+	  	ThemeChanged
+	  	};
+	  	
+    HbEvent(HbEvent::Flags flag)
+    {
+    }
+    ~HbEvent()
+    {        
+    }
+        
+private:
+    Q_DISABLE_COPY(HbEvent)   
+};
+
+/*
+    Mocked QCoreApplication class.
+ */
+ class MSG;
+ 
+class QCoreApplication2 : public QObject
+{
+    Q_OBJECT
+public:
+	enum EventFilter
+	{
+		CodecForTr, UnicodeUTF8, DefaultCodec 
+	};
+		
+    QCoreApplication ( int & argc, char ** argv )  {}
+    ~QCoreApplication ()  {}
+    bool filterEvent ( void * message, long * result ) {}
+    virtual bool notify ( QObject * receiver, QEvent * event ) {}
+    EventFilter setEventFilter ( EventFilter filter ) {}
+    virtual bool winEventFilter ( MSG * msg, long * result ) {}
+    static void postEvent(QObject* ref, HbEvent* ob) {}
+
+private:
+    Q_DISABLE_COPY(QCoreApplication)   
+};
+
+/*
+    Mocked Hb class.
+ */
+class Hb : public QObject
+{
+    Q_OBJECT
+public:
+	enum Flags{
+		TextCursorHidden
+		
+	};
+	
+    Hb(QObject *parent = NULL)
+    {
+    }
+    ~Hb()
+    {        
+    }
+        
+private:
+    Q_DISABLE_COPY(Hb)   
+};
+
+/*
+    Mocked HbIcon class.
+ */
+class HbIcon
+{
+  
+public:
+  
+    HbIcon (const QString &iconName)  {}
+    HbIcon (const QIcon &icon) {}
+    HbIcon (const HbIcon &other) {}
+
+    QSizeF size() const {}
+private:
+    //Q_DISABLE_COPY(HbIcon)
+};
+
+/*
+    Mocked HbIconItem class.
+ */
+
+class HbIconItem : public QGraphicsWidget
+{
+    Q_OBJECT
+public:
+    HbIconItem(QGraphicsWidget *parent = NULL)
+    {
+    }
+    ~HbIconItem()
+    {        
+    }
+        void setAlignment(Qt::Alignment alignment) {}
+        void setIcon(const HbIcon &icon) {}
+        void setPreferredSize(QSizeF size) {}
+        void show(){}
+        void setIconName(const QString& name) {}
+private:
+    Q_DISABLE_COPY(HbIconItem)
+private:    
+};
+
+/*
+    Mocked HbTextItem class.
+ */
+class HbTextItem : public QGraphicsWidget
+{
+    Q_OBJECT
+public:
+    HbTextItem(QGraphicsWidget *parent = NULL)
+    {
+    }
+    ~HbTextItem()
+    {        
+    }
+    void setText(const QString &timeStamp){}
+    void show(){}
+private:
+    Q_DISABLE_COPY(HbTextItem)
+private:    
+};
+
+/*
+    Mocked HbIconItem class.
+ */
+extern int hbtextedit_setsmileysenabled_callcount;
+extern int hbtextedit_setreadonly_callcount;
+ 
+class HbTextEdit : public QGraphicsWidget
+{
+    Q_OBJECT
+public:
+    HbTextEdit(QGraphicsWidget *parent = NULL)
+    {
+    }
+    ~HbTextEdit()
+    {        
+    }
+        void setReadOnly(bool status) {
+        	hbtextedit_setreadonly_callcount++;
+        	}
+        void setBackgroundItem(int back) {}
+        void setSmileysEnabled(bool status) {
+        	hbtextedit_setsmileysenabled_callcount++;
+        	}
+        void setFlag(QGraphicsWidget::GraphicsItemFlag flag,bool status) {}
+        void setPlainText(QString text) {}
+        void show() {}
+        void setCursorVisibility(Hb::Flags flag) {}
+private:
+    Q_DISABLE_COPY(HbTextEdit)
+private:    
+};
+
+/*
+    Mocked HbStyle class.
+ */
+extern int hbstyle_setitemname_callcount;
+
+class HbStyle: public QObject
+{
+    Q_OBJECT
+public:
+	enum{
+		P_None
+	};
+    HbStyle(QObject *parent = NULL)
+    {
+    }
+    
+    void static setItemName(QGraphicsWidget* bubbleFrameItem, QString type)
+    {
+    	hbstyle_setitemname_callcount++;
+    }
+    
+private:
+    Q_DISABLE_COPY(HbStyle)
+};
+
+/*
+    Mocked HbFrameDrawer class.
+ */
+ extern int hbframedrawer_setframetype_callcount;
+ 
+class HbFrameDrawer: public QObject
+{
+    Q_OBJECT
+public:
+		enum PieceSize{
+		OnePieces,
+		TwoPieces,
+		ThreePiecesVertical,
+		FourPieces,
+		NinePieces
+	};
+    HbFrameDrawer(QObject *parent = NULL)
+    {
+    }
+    void setFrameType(HbFrameDrawer::PieceSize piece)
+    	{
+    		hbframedrawer_setframetype_callcount++;
+    	}
+    	
+    	void setFrameGraphicsName(const QString name) {}
+    	
+private:
+    Q_DISABLE_COPY(HbFrameDrawer)
+};
+
+/*
+    Mocked HbFrameItem class.
+ */
+extern int hbframeitem_framedrawer_callcount;
+ 
+class HbFrameItem : public QGraphicsWidget
+{
+    Q_OBJECT
+    
+public:
+	
+    HbFrameItem(QGraphicsWidget *parent = NULL)
+    {
+    }
+    ~HbFrameItem()
+    {        
+    }
+    
+HbFrameDrawer& frameDrawer  ( )  
+{
+	hbframeitem_framedrawer_callcount++;
+	return frameDraw;
+}
+    
+private:
+    Q_DISABLE_COPY(HbFrameItem)
+private:
+    HbFrameDrawer frameDraw;    
+};
+
+/*
+    Include the header file of the class under test.
+ */
+#include "../../../inc/msgconversationwidget.h"
+
+#endif /* T_MSGCONVERSATIONWIDGET_HEADERS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2010 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:
+ *
+ */
+
+#include <QtTest/QtTest>
+
+#include "msgconversationwidgetheaders.h"
+
+/*
+    Global variables that are used to control the test environment and/or
+    observe the individual tests. The naming convention can be described with
+    a ternary template
+    
+        <class>_<member>[_<suffix>],
+    
+    where <class> is the name of a mocked class, <member> is the name of a
+    variable, a function, or a property under consideration, and <suffix> is
+    an optional description. For example, if we wish to observe the number of
+    A::B() calls, we declare a global integer a_b_callcount and increment it
+    every time A::B() is called. The variable is also declared in the header
+    file of the mocked class by using the extern keyword. Typically, these
+    global variables are defined and reset in the unit-test class' helper
+    functions.
+    
+    Mocked HbLabel class' global variables:
+    
+         argument of setNumber() and/or setPlainText(),
+         number of setNumber() calls, and
+         number of setPlaintText() calls.
+ */
+
+int hbframeitem_framedrawer_callcount;
+int hbstyle_setitemname_callcount;
+int hbframedrawer_setframetype_callcount;
+int hbtextedit_setreadonly_callcount;
+int hbtextedit_setsmileysenabled_callcount;
+const QString SUBJECT = "Subject";
+const QString BODYTEXT = "Body Text";
+
+QGraphicsWidget *hbwidget_parent;
+
+/*
+    The unit-test class. The class definition contains four helper functions
+    and a number of test functions. The helper functions are responsible for
+    the initialization and cleanup of the test environment, whereas the test
+    functions implement the actual testing. Although the test functions are
+    executed in the order they are defined, they should not depend on each
+    other in any way. In other words, one should be able to scramble the test
+    functions and still compile a working unit test.
+ */
+class TestMsgConversationWidget : public QObject
+{
+    Q_OBJECT
+private slots:
+    void initTestCase();
+    void cleanupTestCase();
+    void init();
+    void cleanup();
+    void testConstructor();
+    void testSetSubject();
+    void testSetBodyText();
+};
+
+/*
+    Initializes the test environment. This function is automatically invoked
+    before the first test function.
+ */
+void TestMsgConversationWidget::initTestCase()
+{
+}
+
+/*
+    Cleans up the test environment. This function is automatically invoked
+    after the last test function.
+ */
+void TestMsgConversationWidget::cleanupTestCase()
+{
+}
+
+/*
+    Performs initialization for a single test function. This function is
+    automatically invoked before each test function.
+ */
+void TestMsgConversationWidget::init()
+{
+    hbframeitem_framedrawer_callcount = 0;
+    hbstyle_setitemname_callcount = 0;
+    hbframedrawer_setframetype_callcount = 0;
+    hbtextedit_setsmileysenabled_callcount = 0;
+    hbtextedit_setreadonly_callcount = 0;
+    hbwidget_parent = NULL;
+}
+
+/*
+    Performs cleanup for a single test function. This function is auto-
+    matically invoked after each test function.
+ */
+void TestMsgConversationWidget::cleanup()
+{
+}
+
+/*
+    Test the constructor with different parent arguments:
+    
+        1. null parent (i.e. default parent argument) and
+        2. non-null parent.
+ */
+void TestMsgConversationWidget::testConstructor()
+{
+    // 1.
+    MsgConversationWidget *widget = new MsgConversationWidget();
+    QVERIFY(!hbwidget_parent);
+    delete widget;
+    
+    // 2.
+    MsgConversationWidget parent(NULL);
+    widget = new MsgConversationWidget(&parent);
+    QVERIFY(hbwidget_parent == &parent);
+    
+    QVERIFY(6 == hbframeitem_framedrawer_callcount);
+    QVERIFY(6 == hbframedrawer_setframetype_callcount);
+    QVERIFY(6 == hbstyle_setitemname_callcount);
+    
+    delete widget;
+}
+
+void TestMsgConversationWidget::testSetSubject()
+{
+    // 1.
+    MsgConversationWidget* myWidget = new MsgConversationWidget();
+    myWidget->setSubject(SUBJECT);
+    QVERIFY(1 == hbtextedit_setreadonly_callcount);
+    QVERIFY(1 == hbtextedit_setsmileysenabled_callcount);
+    
+    delete myWidget;
+}
+
+void TestMsgConversationWidget::testSetBodyText()
+{
+    // 1.
+    MsgConversationWidget* myWidget = new MsgConversationWidget();
+    myWidget->setBodyText(BODYTEXT);
+    QVERIFY(1 == hbtextedit_setreadonly_callcount);
+    QVERIFY(1 == hbtextedit_setsmileysenabled_callcount);
+    
+    delete myWidget;
+}
+
+/*
+    Implement a main() function that initializes the test environment,
+    executes all tests in the order they were defined, and finally cleans up
+    the test environment.
+ */
+QTEST_APPLESS_MAIN(TestMsgConversationWidget)
+
+/*
+    Because both the declaration and the implementation of our test class are
+    in a single .cpp file, we also need to include the generated moc file to
+    make Qt's introspection work.
+ */
+#include "unittest_msgconversationwidget.moc"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittest_msgconversationwidget/unittest_msgconversationwidget.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,31 @@
+#
+# Copyright (c) 2010 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:
+#
+#
+
+CONFIG            += qtestlib symbian_test
+INCLUDEPATH       += .
+MMP_RULES         += "USERINCLUDE . ../../../../../../inc"
+MOC_DIR            = moc
+TARGET             = unittest_msgconversationwidget
+TARGET.CAPABILITY  = All -TCB
+TEMPLATE           = app
+
+HEADERS += hbwidget.h \
+           msgconversationwidgetheaders.h \
+           ../../../inc/msgconversationwidget.h
+
+SOURCES += unittest_msgconversationwidget.cpp \
+           ../../../src/msgconversationwidget.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/conversationview/tsrc/unittests/unittests.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2010 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:
+#
+#
+
+CONFIG  += symbian_test
+SUBDIRS += unittest_nmexampleadapterclass \
+           unittest_nmexamplesymbianclass \
+           unittest_nmexampleview
+TEMPLATE = subdirs
--- a/messagingapp/msgui/eabi/appengineu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/eabi/appengineu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,40 +1,47 @@
 EXPORTS
-	_ZN19ConversationsEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
-	_ZN19ConversationsEngine11qt_metacastEPKc @ 2 NONAME
-	_ZN19ConversationsEngine13resendMessageEi @ 3 NONAME
-	_ZN19ConversationsEngine14deleteMessagesER5QListIiE @ 4 NONAME
-	_ZN19ConversationsEngine14getDraftsModelEv @ 5 NONAME
-	_ZN19ConversationsEngine15downloadMessageEi @ 6 NONAME
-	_ZN19ConversationsEngine16getConversationsEx @ 7 NONAME
-	_ZN19ConversationsEngine16markMessagesReadER5QListIiE @ 8 NONAME
-	_ZN19ConversationsEngine16staticMetaObjectE @ 9 NONAME DATA 16
-	_ZN19ConversationsEngine17getContactDetailsExR7QStringS1_ @ 10 NONAME
-	_ZN19ConversationsEngine18clearConversationsEv @ 11 NONAME
-	_ZN19ConversationsEngine19deleteConversationsEx @ 12 NONAME
-	_ZN19ConversationsEngine19getStaticMetaObjectEv @ 13 NONAME
-	_ZN19ConversationsEngine20markAsReadAndGetTypeEiRiS0_ @ 14 NONAME
-	_ZN19ConversationsEngine20markConversationReadEx @ 15 NONAME
-	_ZN19ConversationsEngine21getConversationsModelEv @ 16 NONAME
-	_ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 17 NONAME
-	_ZN19ConversationsEngine22fetchMoreConversationsEv @ 18 NONAME
-	_ZN19ConversationsEngine24conversationModelUpdatedEv @ 19 NONAME
-	_ZN19ConversationsEngine24getCurrentConversationIdEv @ 20 NONAME
-	_ZN19ConversationsEngine26conversationModelPopulatedEv @ 21 NONAME
-	_ZN19ConversationsEngine26downloadOperationSupportedEi @ 22 NONAME
-	_ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 23 NONAME
-	_ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 24 NONAME
-	_ZN19ConversationsEngine28getConversationsSummaryModelEv @ 25 NONAME
-	_ZN19ConversationsEngine30conversationListModelPopulatedEv @ 26 NONAME
-	_ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 27 NONAME
-	_ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 28 NONAME
-	_ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 29 NONAME
-	_ZN19ConversationsEngine8instanceEv @ 30 NONAME
-	_ZN19ConversationsEngineC1EP7QObject @ 31 NONAME
-	_ZN19ConversationsEngineC2EP7QObject @ 32 NONAME
-	_ZN19ConversationsEngineD0Ev @ 33 NONAME
-	_ZN19ConversationsEngineD1Ev @ 34 NONAME
-	_ZN19ConversationsEngineD2Ev @ 35 NONAME
-	_ZNK19ConversationsEngine10metaObjectEv @ 36 NONAME
-	_ZTI19ConversationsEngine @ 37 NONAME
-	_ZTV19ConversationsEngine @ 38 NONAME
+	_ZN19ConversationsEngine11getDBHandleERi @ 1 NONAME
+	_ZN19ConversationsEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+	_ZN19ConversationsEngine11qt_metacastEPKc @ 3 NONAME
+	_ZN19ConversationsEngine13getMsgSubTypeEi @ 4 NONAME
+	_ZN19ConversationsEngine13resendMessageEi @ 5 NONAME
+	_ZN19ConversationsEngine14deleteMessagesER5QListIiE @ 6 NONAME
+	_ZN19ConversationsEngine14getDraftsModelEv @ 7 NONAME
+	_ZN19ConversationsEngine15downloadMessageEi @ 8 NONAME
+	_ZN19ConversationsEngine16getConversationsEx @ 9 NONAME
+	_ZN19ConversationsEngine16markMessagesReadER5QListIiE @ 10 NONAME
+	_ZN19ConversationsEngine16staticMetaObjectE @ 11 NONAME DATA 16
+	_ZN19ConversationsEngine17getContactDetailsExR7QStringS1_ @ 12 NONAME
+	_ZN19ConversationsEngine18clearConversationsEv @ 13 NONAME
+	_ZN19ConversationsEngine19deleteConversationsEx @ 14 NONAME
+	_ZN19ConversationsEngine19getStaticMetaObjectEv @ 15 NONAME
+	_ZN19ConversationsEngine20markAsReadAndGetTypeEiRiS0_ @ 16 NONAME
+	_ZN19ConversationsEngine20markConversationReadEx @ 17 NONAME
+	_ZN19ConversationsEngine21getConversationsModelEv @ 18 NONAME
+	_ZN19ConversationsEngine22deleteAllDraftMessagesEv @ 19 NONAME
+	_ZN19ConversationsEngine22fetchMoreConversationsEv @ 20 NONAME
+	_ZN19ConversationsEngine24conversationModelUpdatedEv @ 21 NONAME
+	_ZN19ConversationsEngine24getCurrentConversationIdEv @ 22 NONAME
+	_ZN19ConversationsEngine26conversationModelPopulatedEv @ 23 NONAME
+	_ZN19ConversationsEngine26downloadOperationSupportedEi @ 24 NONAME
+	_ZN19ConversationsEngine28emitConversationModelUpdatedEv @ 25 NONAME
+	_ZN19ConversationsEngine28getConversationIdFromAddressE7QString @ 26 NONAME
+	_ZN19ConversationsEngine28getConversationsSummaryModelEv @ 27 NONAME
+	_ZN19ConversationsEngine30conversationListModelPopulatedEv @ 28 NONAME
+	_ZN19ConversationsEngine30emitConversationModelPopulatedEv @ 29 NONAME
+	_ZN19ConversationsEngine30getConversationIdFromContactIdEi @ 30 NONAME
+	_ZN19ConversationsEngine34emitConversationListModelPopulatedEv @ 31 NONAME
+	_ZN19ConversationsEngine8instanceEv @ 32 NONAME
+	_ZN19ConversationsEngineC1EP7QObject @ 33 NONAME
+	_ZN19ConversationsEngineC2EP7QObject @ 34 NONAME
+	_ZN19ConversationsEngineD0Ev @ 35 NONAME
+	_ZN19ConversationsEngineD1Ev @ 36 NONAME
+	_ZN19ConversationsEngineD2Ev @ 37 NONAME
+	_ZNK19ConversationsEngine10metaObjectEv @ 38 NONAME
+	_ZTI19ConversationsEngine @ 39 NONAME
+	_ZTV19ConversationsEngine @ 40 NONAME
+	_ZN19ConversationsEngine28conversationListEntryDeletedEi @ 41 NONAME
+	_ZN19ConversationsEngine37emitConversationListModelEntryDeletedEi @ 42 NONAME
+	_ZN19ConversationsEngine21conversationViewEmptyEv @ 43 NONAME
+	_ZN19ConversationsEngine31disableRegisterationForCVEventsEv @ 44 NONAME
+	_ZN19ConversationsEngine32emitOpenConversationViewIdUpdateEi @ 45 NONAME
 
--- a/messagingapp/msgui/eabi/conversationviewu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/eabi/conversationviewu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -4,26 +4,30 @@
 	_ZN23MsgConversationBaseView11qt_metacallEN11QMetaObject4CallEiPPv @ 3 NONAME
 	_ZN23MsgConversationBaseView11qt_metacastEPKc @ 4 NONAME
 	_ZN23MsgConversationBaseView12clearContentEv @ 5 NONAME
-	_ZN23MsgConversationBaseView16openConversationEx @ 6 NONAME
-	_ZN23MsgConversationBaseView16staticMetaObjectE @ 7 NONAME DATA 16
-	_ZN23MsgConversationBaseView18markMessagesAsReadEv @ 8 NONAME
-	_ZN23MsgConversationBaseView19getStaticMetaObjectEv @ 9 NONAME
-	_ZN23MsgConversationBaseView19saveContentToDraftsEv @ 10 NONAME
-	_ZN23MsgConversationBaseView21closeConversationViewEv @ 11 NONAME
-	_ZN23MsgConversationBaseView21doDelayedConstructionEv @ 12 NONAME
-	_ZN23MsgConversationBaseView22conversationViewClosedEv @ 13 NONAME
-	_ZN23MsgConversationBaseView8handleOkERK8QVariant @ 14 NONAME
-	_ZN23MsgConversationBaseView8initViewEv @ 15 NONAME
-	_ZN23MsgConversationBaseViewC1EP13QGraphicsItem @ 16 NONAME
-	_ZN23MsgConversationBaseViewC2EP13QGraphicsItem @ 17 NONAME
-	_ZN23MsgConversationBaseViewD0Ev @ 18 NONAME
-	_ZN23MsgConversationBaseViewD1Ev @ 19 NONAME
-	_ZN23MsgConversationBaseViewD2Ev @ 20 NONAME
-	_ZNK23MsgConversationBaseView10metaObjectEv @ 21 NONAME
-	_ZTI23MsgConversationBaseView @ 22 NONAME
-	_ZTV23MsgConversationBaseView @ 23 NONAME
-	_ZThn16_N23MsgConversationBaseViewD0Ev @ 24 NONAME
-	_ZThn16_N23MsgConversationBaseViewD1Ev @ 25 NONAME
-	_ZThn8_N23MsgConversationBaseViewD0Ev @ 26 NONAME
-	_ZThn8_N23MsgConversationBaseViewD1Ev @ 27 NONAME
+	_ZN23MsgConversationBaseView14conversationIdEv @ 6 NONAME
+	_ZN23MsgConversationBaseView15handleViewReadyEv @ 7 NONAME
+	_ZN23MsgConversationBaseView16openConversationEx @ 8 NONAME
+	_ZN23MsgConversationBaseView16staticMetaObjectE @ 9 NONAME DATA 16
+	_ZN23MsgConversationBaseView18markMessagesAsReadEv @ 10 NONAME
+	_ZN23MsgConversationBaseView19getStaticMetaObjectEv @ 11 NONAME
+	_ZN23MsgConversationBaseView19saveContentToDraftsEv @ 12 NONAME
+	_ZN23MsgConversationBaseView21closeConversationViewEv @ 13 NONAME
+	_ZN23MsgConversationBaseView21doDelayedConstructionEv @ 14 NONAME
+	_ZN23MsgConversationBaseView22conversationViewClosedEv @ 15 NONAME
+	_ZN23MsgConversationBaseView26handleConversationIdChangeEx @ 16 NONAME
+	_ZN23MsgConversationBaseView8handleOkERK8QVariant @ 17 NONAME
+	_ZN23MsgConversationBaseView8initViewEv @ 18 NONAME
+	_ZN23MsgConversationBaseView9setPSCVIdEb @ 19 NONAME
+	_ZN23MsgConversationBaseViewC1EP13QGraphicsItem @ 20 NONAME
+	_ZN23MsgConversationBaseViewC2EP13QGraphicsItem @ 21 NONAME
+	_ZN23MsgConversationBaseViewD0Ev @ 22 NONAME
+	_ZN23MsgConversationBaseViewD1Ev @ 23 NONAME
+	_ZN23MsgConversationBaseViewD2Ev @ 24 NONAME
+	_ZNK23MsgConversationBaseView10metaObjectEv @ 25 NONAME
+	_ZTI23MsgConversationBaseView @ 26 NONAME
+	_ZTV23MsgConversationBaseView @ 27 NONAME
+	_ZThn16_N23MsgConversationBaseViewD0Ev @ 28 NONAME
+	_ZThn16_N23MsgConversationBaseViewD1Ev @ 29 NONAME
+	_ZThn8_N23MsgConversationBaseViewD0Ev @ 30 NONAME
+	_ZThn8_N23MsgConversationBaseViewD1Ev @ 31 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/eabi/msgaudiofetcheru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,24 @@
+EXPORTS
+	_ZN19MsgAudioFetcherView11initToolBarEv @ 1 NONAME
+	_ZN19MsgAudioFetcherView11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+	_ZN19MsgAudioFetcherView11qt_metacastEPKc @ 3 NONAME
+	_ZN19MsgAudioFetcherView13enableToolBarEb @ 4 NONAME
+	_ZN19MsgAudioFetcherView14initMainWidgetEv @ 5 NONAME
+	_ZN19MsgAudioFetcherView16staticMetaObjectE @ 6 NONAME DATA 16
+	_ZN19MsgAudioFetcherView19getStaticMetaObjectEv @ 7 NONAME
+	_ZN19MsgAudioFetcherView19removeToolBarActionEv @ 8 NONAME
+	_ZN19MsgAudioFetcherView23on_leftAction_triggeredEv @ 9 NONAME
+	_ZN19MsgAudioFetcherView24on_rightAction_triggeredEv @ 10 NONAME
+	_ZN19MsgAudioFetcherViewC1ERK5QListI8QVariantE @ 11 NONAME
+	_ZN19MsgAudioFetcherViewC2ERK5QListI8QVariantE @ 12 NONAME
+	_ZN19MsgAudioFetcherViewD0Ev @ 13 NONAME
+	_ZN19MsgAudioFetcherViewD1Ev @ 14 NONAME
+	_ZN19MsgAudioFetcherViewD2Ev @ 15 NONAME
+	_ZNK19MsgAudioFetcherView10metaObjectEv @ 16 NONAME
+	_ZTI19MsgAudioFetcherView @ 17 NONAME
+	_ZTV19MsgAudioFetcherView @ 18 NONAME
+	_ZThn16_N19MsgAudioFetcherViewD0Ev @ 19 NONAME
+	_ZThn16_N19MsgAudioFetcherViewD1Ev @ 20 NONAME
+	_ZThn8_N19MsgAudioFetcherViewD0Ev @ 21 NONAME
+	_ZThn8_N19MsgAudioFetcherViewD1Ev @ 22 NONAME
+
--- a/messagingapp/msgui/eabi/msgsettingsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-EXPORTS
-	_ZN14SettingsViewer11iAPSelectorEP11QStringList @ 1 NONAME
-	_ZN14SettingsViewer11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
-	_ZN14SettingsViewer11qt_metacastEPKc @ 3 NONAME
-	_ZN14SettingsViewer13changeServiceEv @ 4 NONAME
-	_ZN14SettingsViewer13closeSettingsEv @ 5 NONAME
-	_ZN14SettingsViewer13createMmsViewEv @ 6 NONAME
-	_ZN14SettingsViewer13createSmsViewEv @ 7 NONAME
-	_ZN14SettingsViewer14softkeyClickedEv @ 8 NONAME
-	_ZN14SettingsViewer15openMmsSettingsEv @ 9 NONAME
-	_ZN14SettingsViewer15openSmsSettingsEv @ 10 NONAME
-	_ZN14SettingsViewer16staticMetaObjectE @ 11 NONAME DATA 16
-	_ZN14SettingsViewer17changeAccessPointEi @ 12 NONAME
-	_ZN14SettingsViewer17settingListClosedEv @ 13 NONAME
-	_ZN14SettingsViewer19getStaticMetaObjectEv @ 14 NONAME
-	_ZN14SettingsViewer20settingsViewerClosedEv @ 15 NONAME
-	_ZN14SettingsViewer8initViewEv @ 16 NONAME
-	_ZN14SettingsViewerC1EP13QGraphicsItem @ 17 NONAME
-	_ZN14SettingsViewerC2EP13QGraphicsItem @ 18 NONAME
-	_ZN14SettingsViewerD0Ev @ 19 NONAME
-	_ZN14SettingsViewerD1Ev @ 20 NONAME
-	_ZN14SettingsViewerD2Ev @ 21 NONAME
-	_ZNK14SettingsViewer10metaObjectEv @ 22 NONAME
-	_ZTI14SettingsViewer @ 23 NONAME
-	_ZTV14SettingsViewer @ 24 NONAME
-	_ZThn16_N14SettingsViewerD0Ev @ 25 NONAME
-	_ZThn16_N14SettingsViewerD1Ev @ 26 NONAME
-	_ZThn8_N14SettingsViewerD0Ev @ 27 NONAME
-	_ZThn8_N14SettingsViewerD1Ev @ 28 NONAME
-
--- a/messagingapp/msgui/eabi/msguiutilsu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/eabi/msguiutilsu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -23,15 +23,26 @@
 	_ZN12MsgMediaUtilC2Ev @ 22 NONAME
 	_ZN12MsgMediaUtilD1Ev @ 23 NONAME
 	_ZN12MsgMediaUtilD2Ev @ 24 NONAME
-	_ZN19MmsConformanceCheck17launchEditorQueryEv @ 25 NONAME
-	_ZN19MmsConformanceCheck18checkModeForInsertERK7QStringb @ 26 NONAME
-	_ZN19MmsConformanceCheck21validateMsgForForwardEi @ 27 NONAME
-	_ZN19MmsConformanceCheck9showPopupERK7QString @ 28 NONAME
-	_ZN19MmsConformanceCheckC1Ev @ 29 NONAME
-	_ZN19MmsConformanceCheckC2Ev @ 30 NONAME
-	_ZN19MmsConformanceCheckD1Ev @ 31 NONAME
-	_ZN19MmsConformanceCheckD2Ev @ 32 NONAME
-	_ZNK11MsgSendUtil10metaObjectEv @ 33 NONAME
-	_ZTI11MsgSendUtil @ 34 NONAME
-	_ZTV11MsgSendUtil @ 35 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
 
--- a/messagingapp/msgui/eabi/unifiededitoru.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/eabi/unifiededitoru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -9,49 +9,60 @@
 	_ZN20MsgUnifiedEditorView10addSubjectEv @ 8 NONAME
 	_ZN20MsgUnifiedEditorView10addToolBarEv @ 9 NONAME
 	_ZN20MsgUnifiedEditorView10fetchAudioEv @ 10 NONAME
-	_ZN20MsgUnifiedEditorView10pluginPathEv @ 11 NONAME
+	_ZN20MsgUnifiedEditorView10hideChromeEb @ 11 NONAME
 	_ZN20MsgUnifiedEditorView11fetchImagesEv @ 12 NONAME
-	_ZN20MsgUnifiedEditorView11packMessageER16ConvergedMessage @ 13 NONAME
+	_ZN20MsgUnifiedEditorView11packMessageER16ConvergedMessageb @ 13 NONAME
 	_ZN20MsgUnifiedEditorView11qt_metacallEN11QMetaObject4CallEiPPv @ 14 NONAME
 	_ZN20MsgUnifiedEditorView11qt_metacastEPKc @ 15 NONAME
 	_ZN20MsgUnifiedEditorView11resizeEventEP25QGraphicsSceneResizeEvent @ 16 NONAME
 	_ZN20MsgUnifiedEditorView12createVCardsERK8QVariantR11QStringList @ 17 NONAME
 	_ZN20MsgUnifiedEditorView13addAttachmentERK7QString @ 18 NONAME
-	_ZN20MsgUnifiedEditorView13audiosFetchedERK8QVariant @ 19 NONAME
-	_ZN20MsgUnifiedEditorView13deleteMessageEv @ 20 NONAME
-	_ZN20MsgUnifiedEditorView13fetchContactsEv @ 21 NONAME
-	_ZN20MsgUnifiedEditorView13imagesFetchedERK8QVariant @ 22 NONAME
-	_ZN20MsgUnifiedEditorView14addAttachmentsE11QStringList @ 23 NONAME
-	_ZN20MsgUnifiedEditorView14changePriorityEv @ 24 NONAME
-	_ZN20MsgUnifiedEditorView14forwardMessageER18ConvergedMessageIdN16ConvergedMessage11MessageTypeE @ 25 NONAME
-	_ZN20MsgUnifiedEditorView14sendingOptionsEv @ 26 NONAME
-	_ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 27 NONAME
-	_ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 28 NONAME
+	_ZN20MsgUnifiedEditorView13deleteMessageEv @ 19 NONAME
+	_ZN20MsgUnifiedEditorView13fetchContactsEv @ 20 NONAME
+	_ZN20MsgUnifiedEditorView13imagesFetchedERK8QVariant @ 21 NONAME
+	_ZN20MsgUnifiedEditorView14addAttachmentsE11QStringList @ 22 NONAME
+	_ZN20MsgUnifiedEditorView14changePriorityEv @ 23 NONAME
+	_ZN20MsgUnifiedEditorView14forwardMessageER18ConvergedMessageIdN16ConvergedMessage11MessageTypeE @ 24 NONAME
+	_ZN20MsgUnifiedEditorView15contactsFetchedERK8QVariant @ 25 NONAME
+	_ZN20MsgUnifiedEditorView15populateContentERK5QListI8QVariantE @ 26 NONAME
+	_ZN20MsgUnifiedEditorView16createTempFolderEv @ 27 NONAME
+	_ZN20MsgUnifiedEditorView16enableSendButtonEb @ 28 NONAME
 	_ZN20MsgUnifiedEditorView16generateFileNameER7QString @ 29 NONAME
-	_ZN20MsgUnifiedEditorView16staticMetaObjectE @ 30 NONAME DATA 16
-	_ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 31 NONAME
-	_ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 32 NONAME
-	_ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 33 NONAME
-	_ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 34 NONAME
-	_ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 35 NONAME
-	_ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 36 NONAME
-	_ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 37 NONAME
-	_ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessage @ 38 NONAME
-	_ZN20MsgUnifiedEditorView25removeAttachmentContainerEv @ 39 NONAME
-	_ZN20MsgUnifiedEditorView25updateOtherRecipientCountEb @ 40 NONAME
-	_ZN20MsgUnifiedEditorView4sendEv @ 41 NONAME
-	_ZN20MsgUnifiedEditorView7addMenuEv @ 42 NONAME
-	_ZN20MsgUnifiedEditorView8addCcBccEv @ 43 NONAME
-	_ZN20MsgUnifiedEditorViewC1EP13QGraphicsItem @ 44 NONAME
-	_ZN20MsgUnifiedEditorViewC2EP13QGraphicsItem @ 45 NONAME
-	_ZN20MsgUnifiedEditorViewD0Ev @ 46 NONAME
-	_ZN20MsgUnifiedEditorViewD1Ev @ 47 NONAME
-	_ZN20MsgUnifiedEditorViewD2Ev @ 48 NONAME
-	_ZNK20MsgUnifiedEditorView10metaObjectEv @ 49 NONAME
-	_ZTI20MsgUnifiedEditorView @ 50 NONAME
-	_ZTV20MsgUnifiedEditorView @ 51 NONAME
-	_ZThn16_N20MsgUnifiedEditorViewD0Ev @ 52 NONAME
-	_ZThn16_N20MsgUnifiedEditorViewD1Ev @ 53 NONAME
-	_ZThn8_N20MsgUnifiedEditorViewD0Ev @ 54 NONAME
-	_ZThn8_N20MsgUnifiedEditorViewD1Ev @ 55 NONAME
+	_ZN20MsgUnifiedEditorView16onContentChangedEv @ 30 NONAME
+	_ZN20MsgUnifiedEditorView16removeTempFolderEv @ 31 NONAME
+	_ZN20MsgUnifiedEditorView16staticMetaObjectE @ 32 NONAME DATA 16
+	_ZN20MsgUnifiedEditorView17onDialogDeleteMsgEP8HbAction @ 33 NONAME
+	_ZN20MsgUnifiedEditorView17openDraftsMessageERK5QListI8QVariantE @ 34 NONAME
+	_ZN20MsgUnifiedEditorView19getStaticMetaObjectEv @ 35 NONAME
+	_ZN20MsgUnifiedEditorView19onDialogMmsSettingsEP8HbAction @ 36 NONAME
+	_ZN20MsgUnifiedEditorView19onDialogSmsSettingsEP8HbAction @ 37 NONAME
+	_ZN20MsgUnifiedEditorView19saveContentToDraftsEv @ 38 NONAME
+	_ZN20MsgUnifiedEditorView19serviceRequestErrorEiRK7QString @ 39 NONAME
+	_ZN20MsgUnifiedEditorView20activateInputBlockerEv @ 40 NONAME
+	_ZN20MsgUnifiedEditorView21doDelayedConstructionEv @ 41 NONAME
+	_ZN20MsgUnifiedEditorView22deactivateInputBlockerEv @ 42 NONAME
+	_ZN20MsgUnifiedEditorView22setAttachOptionEnabledENS_16TBE_AttachOptionEb @ 43 NONAME
+	_ZN20MsgUnifiedEditorView23handleViewExtnActivatedEP16HbListWidgetItem @ 44 NONAME
+	_ZN20MsgUnifiedEditorView25populateContentIntoEditorERK16ConvergedMessageb @ 45 NONAME
+	_ZN20MsgUnifiedEditorView25removeAttachmentContainerEv @ 46 NONAME
+	_ZN20MsgUnifiedEditorView25updateOtherRecipientCountEb @ 47 NONAME
+	_ZN20MsgUnifiedEditorView4sendEv @ 48 NONAME
+	_ZN20MsgUnifiedEditorView7addMenuEv @ 49 NONAME
+	_ZN20MsgUnifiedEditorView8addCcBccEv @ 50 NONAME
+	_ZN20MsgUnifiedEditorView8initViewEv @ 51 NONAME
+	_ZN20MsgUnifiedEditorView8setFocusEP26MsgUnifiedEditorBaseWidget @ 52 NONAME
+	_ZN20MsgUnifiedEditorView9vkbClosedEv @ 53 NONAME
+	_ZN20MsgUnifiedEditorView9vkbOpenedEv @ 54 NONAME
+	_ZN20MsgUnifiedEditorViewC1EP13QGraphicsItem @ 55 NONAME
+	_ZN20MsgUnifiedEditorViewC2EP13QGraphicsItem @ 56 NONAME
+	_ZN20MsgUnifiedEditorViewD0Ev @ 57 NONAME
+	_ZN20MsgUnifiedEditorViewD1Ev @ 58 NONAME
+	_ZN20MsgUnifiedEditorViewD2Ev @ 59 NONAME
+	_ZNK20MsgUnifiedEditorView10metaObjectEv @ 60 NONAME
+	_ZTI20MsgUnifiedEditorView @ 61 NONAME
+	_ZTV20MsgUnifiedEditorView @ 62 NONAME
+	_ZThn16_N20MsgUnifiedEditorViewD0Ev @ 63 NONAME
+	_ZThn16_N20MsgUnifiedEditorViewD1Ev @ 64 NONAME
+	_ZThn8_N20MsgUnifiedEditorViewD0Ev @ 65 NONAME
+	_ZThn8_N20MsgUnifiedEditorViewD1Ev @ 66 NONAME
 
--- a/messagingapp/msgui/eabi/unifiedvieweru.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/eabi/unifiedvieweru.def	Fri Jun 25 15:47:40 2010 +0530
@@ -2,17 +2,17 @@
 	_ZN13UnifiedViewer11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
 	_ZN13UnifiedViewer11qt_metacastEPKc @ 2 NONAME
 	_ZN13UnifiedViewer11resizeEventEP25QGraphicsSceneResizeEvent @ 3 NONAME
-	_ZN13UnifiedViewer11sendMessageERK7QString @ 4 NONAME
+	_ZN13UnifiedViewer11sendMessageERK7QStringS2_ @ 4 NONAME
 	_ZN13UnifiedViewer12clearContentEv @ 5 NONAME
 	_ZN13UnifiedViewer13createToolBarEv @ 6 NONAME
 	_ZN13UnifiedViewer15handleFwdActionEv @ 7 NONAME
 	_ZN13UnifiedViewer15populateContentEibi @ 8 NONAME
 	_ZN13UnifiedViewer16staticMetaObjectE @ 9 NONAME DATA 16
-	_ZN13UnifiedViewer18handleDeleteActionEv @ 10 NONAME
-	_ZN13UnifiedViewer19getStaticMetaObjectEv @ 11 NONAME
-	_ZN13UnifiedViewer21validateMsgForForwardEv @ 12 NONAME
-	_ZN13UnifiedViewerC1EiP13QGraphicsItem @ 13 NONAME
-	_ZN13UnifiedViewerC2EiP13QGraphicsItem @ 14 NONAME
+	_ZN13UnifiedViewer17onDialogDeleteMsgEP8HbAction @ 10 NONAME
+	_ZN13UnifiedViewer18handleDeleteActionEv @ 11 NONAME
+	_ZN13UnifiedViewer19getStaticMetaObjectEv @ 12 NONAME
+	_ZN13UnifiedViewerC1EiiP13QGraphicsItem @ 13 NONAME
+	_ZN13UnifiedViewerC2EiiP13QGraphicsItem @ 14 NONAME
 	_ZN13UnifiedViewerD0Ev @ 15 NONAME
 	_ZN13UnifiedViewerD1Ev @ 16 NONAME
 	_ZN13UnifiedViewerD2Ev @ 17 NONAME
--- a/messagingapp/msgui/inc/msgbaseview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/inc/msgbaseview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -45,7 +45,8 @@
         UNIEDITOR,
         UNIVIEWER,
         MSGSETTINGS,
-        SERVICE
+        SERVICE,
+        AUDIOFETCHER
         };
     
     /**
@@ -69,6 +70,10 @@
      */
     void switchView(const QVariantList& data);
     
+    /**
+     * Forceful close of conversation view
+     */
+    void closeOpenConversationView();
 
 };
 
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/conversationviewplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = lib
-TARGET = $$qtLibraryTarget(conversationviewplugin)
-
-TARGET.EPOCALLOWDLLDATA = 1
-TARGET.CAPABILITY = All -TCB
-#UID 3
-TARGET.UID3 = 0x2001FE75
-
-CONFIG += plugin hb
-INCLUDEPATH += . inc ../../conversationview/inc ../../../../inc
-
-symbian:TARGET.EPOCALLOWDLLDATA = 1
-symbian:TARGET.CAPABILITY = CAP_GENERAL_DLL
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Input
-HEADERS += inc/conversationviewplugin.h
-SOURCES += src/conversationviewplugin.cpp
-
-RESOURCES += conversationviewplugin.qrc
-
-# The plugin stub is exported and its used in the sis or image creation
-symbian 		{
-    BLD_INF_RULES.prj_exports += \
-    "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "rom/conversationviewplugin.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(conversationviewplugin.iby)" 
-		}
-
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/conversationviewplugin.qrc	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<RCC>
-    <qresource prefix="/" >
-        <file alias="msgconversationwidget.css" >resources/msgconversationwidget.css</file>
-        <file alias="msgconversationwidget.widgetml" >resources/msgconversationwidget.widgetml</file>
-        <file alias="msgconversationviewitem.css" >resources/msgconversationviewitem.css</file>
-        <file alias="msgconversationviewitem.widgetml" >resources/msgconversationviewitem.widgetml</file>
-        <file alias="msgeditorwidget.css" >resources/msgeditorwidget.css</file>
-        <file alias="msgeditorwidget.widgetml" >resources/msgeditorwidget.widgetml</file>
-        <file alias="msgcontactcardwidget.css" >resources/msgcontactcardwidget.css</file>
-        <file alias="msgcontactcardwidget.widgetml" >resources/msgcontactcardwidget.widgetml</file>
-    </qresource>
-</RCC>
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/inc/conversationviewplugin.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * 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: Layout plugin for all the widgets present in
- * conversation view.
- *
- */
-
-#ifndef CONVERSATIONVIEWPLUGIN_H
-#define CONVERSATIONVIEWPLUGIN_H
-
-// INCLUDES
-#include <QtPlugin>
-#include <hbstyleinterface.h>
-#include <hbglobal.h>
-
-/**
- * This class represents the conversationview layout plugin
- * to define styling information for all the widgets present in
- * the conversation view.
- */
-class ConversationViewPlugin : public QObject, public HbStyleInterface
-{
-    Q_OBJECT Q_INTERFACES(HbStyleInterface)
-
-public:
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    int primitiveCount() const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QGraphicsItem    *createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent = 0 ) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    void updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QString layoutPath() const;
-
-};
-
-#endif // CONVERSATIONVIEWPLUGIN_H
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgcontactcardwidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-
-MsgContactCardWidget
-{
-  layout:layout-msg-mycard;
-  zvalue:3;
-}
-
-MsgContactCardWidget::avatar
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-1.0un;
-  bottom:1.0un;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-primary-large);
-  pref-height:var(hb-param-graphic-size-primary-large);
-}
-
-MsgContactCardWidget::presence
-{
-  right:var(hb-param-margin-gene-right);
-  center-vertical:0un;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-secondary);
-  pref-hieght:var(hb-param-graphic-size-secondary);
-}
-
-MsgContactCardWidget::addressText
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  center-vertical:0un;
-  text-height:var(hb-param-text-height-primary);
-  font-variant:primary;
-  text-line-count-min:1;
-  text-line-count-max:1;
-}
-
-MsgContactCardWidget::backgroundFrame
-{
-  zvalue:-1;
-  left:0un;
-  top:0un;
-  right:0un;
-  bottom:0un;
-}
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgcontactcardwidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-msg-mycard" type="mesh">
-    <meshitem src="avatar" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="avatar" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="avatar" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="presence" srcEdge="CENTERV" dst="addressText" dstEdge="CENTERV"/>
-    <meshitem src="presence" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-
-    <meshitem src="addressText" srcEdge="LEFT" dst="avatar" dstEdge="RIGHT"/>
-    <meshitem src="addressText" srcEdge="RIGHT" dst="presence" dstEdge="LEFT"/>
-    <meshitem src="addressText" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationviewitem.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-MsgConversationViewItem[isIncoming="true"]
-{
-    layout:layout-incoming;
-    pref-height:-1;
-    pref-width:-1;
-    size-policy-vertical:minimum-expanding;
-}
-
-MsgConversationViewItem[isIncoming="false"]
-{
-    layout:layout-outgoing;
-    pref-height:-1;
-    pref-width:-1;
-    size-policy-vertical:minimum-expanding;
-}
-
-MsgConversationViewItem[isIncoming="true"]::msgconvwidget
-{
-  left:-var(hb-param-margin-gene-left);
-  top:0.0un;
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:0.0un;
-}
-
-MsgConversationViewItem[isIncoming="true"]::msgStateIcon
-{
-  right:var(hb-param-margin-gene-right);
-  size-policy:fixed fixed;
-  aspect-ratio:ignore;
-  pref-height:var(hb-param-graphic-size-primary-small);
-  pref-width:var(hb-param-graphic-size-primary-small);
-}
-
-MsgConversationViewItem[isIncoming="false"]::msgconvwidget
-{
-  top:0.0un;
-  right:var(hb-param-margin-gene-right);
-  bottom:0.0un;
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-MsgConversationViewItem[isIncoming="false"]::msgStateIcon
-{
-  left:-var(hb-param-margin-gene-left);
-  size-policy:fixed fixed;
-  aspect-ratio:ignore;
-  pref-height:var(hb-param-graphic-size-primary-small);
-  pref-width:var(hb-param-graphic-size-primary-small);
-}
-
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationviewitem.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-incoming" type="mesh">
-    <meshitem src="msgStateIcon" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="msgStateIcon" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-    
-    <meshitem src="msgconvwidget" srcEdge="RIGHT" dst="msgStateIcon" dstEdge="LEFT" />
-    <meshitem src="msgconvwidget" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="msgconvwidget" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="msgconvwidget" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-  </layout>
-
-  <layout name="layout-outgoing" type="mesh">
-
-    <meshitem src="msgStateIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="msgStateIcon" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-
-    <meshitem src="msgconvwidget" srcEdge="LEFT" dst="msgStateIcon" dstEdge="RIGHT"/>
-    <meshitem src="msgconvwidget" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="msgconvwidget" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="msgconvwidget" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-  </layout>
-
-</hbwidget>
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationwidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-
-/*********************************** LAYOUTS **********************************/
-
-@variables
-{
-  bubble_width:expr(var(hb-param-screen-width)-var(hb-param-margin-gene-middle-horizontal)-var(hb-param-graphic-size-primary-small)-var(hb-param-margin-gene-left)-var(hb-param-margin-gene-right));
-  bubble_height:expr((3*var(bubble_width))/4);
-}
-
-MsgConversationWidget[isMMS="false"]
-{
-  layout:layout-sms;
-}
-
-MsgConversationWidget[isMMS="true"]:portrait
-{
-  layout:layout-mms-portrait;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]:landscape
-{
-  layout:layout-mms-image-landscape;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"]:landscape
-{
-  layout:layout-mms-landscape;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"][hasAudio="true"][hasVideo="false"]:portrait
-{
-  layout:layout-mms-audio-text-portrait;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"][hasAudio="true"][hasVideo="false"]:landscape
-{
-  layout:layout-mms-audio-text-landscape;
-}
-
-/********************* UNREAD INDICATOR / NEW ITEM ICON ************************/
-
-MsgConversationWidget::newItemIcon
-{
-  left:-0.25un;
-  top:-1.0un;
-  bottom:1.0un;
-  size-policy:fixed preferred;
-  fixed-width:1.25un;
-}
-
-/*********************************** BUBBLE ***********************************/
-
-MsgConversationWidget::bubble
-{
-  left:0.0un;
-  top:0.0un;
-  right:0.0un;
-  bottom:0.0un;
-}
-
-/********************************** BODYTEXT **********************************/
-
-MsgConversationWidget::bodyText
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  right:1.0un;
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  text-height:var(hb-param-text-height-secondary);
-  font-variant:primary;
-  text-align:left;
-  text-line-count-min:1;
-  text-line-count-max:100;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]::bodyText:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"][hasAudio="true"]::bodyText:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-/********************************** SUBJECT ***********************************/
-
-MsgConversationWidget[isMMS="true"]::subject
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  text-align:left;
-  text-height:var(hb-param-text-height-primary);
-  font-variant:primary;
-  text-line-count-max:1;
-  text-line-count-min:1;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]::subject:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"][hasAudio="true"]::subject:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-
-/******************************* ATTACHMENT ICON ******************************/
-
-MsgConversationWidget[isMMS="true"]::attachment
-{
-  right:1.0un;
-  center-vertical:0.0un;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-secondary);
-  pref-height:var(hb-param-graphic-size-secondary);
-}
-
-/********************************* PRIORITY ICON ******************************/
-
-MsgConversationWidget[isMMS="true"]::priority
-{
-  right:0.5un;
-  center-vertical:0.0un;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-secondary);
-  pref-height:var(hb-param-graphic-size-secondary);
-}
-
-/******************************** IMAGE / PREVIEW *****************************/
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]::preview:portrait
-{
-  left:-var(hb-param-margin-gene-left);
-  right:1.0un;
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  aspect-ratio:keep;
-  /*max-width:var(bubble_width);*/
-  max-width:41.36un;
-  max-height:31.02un;
-  /*max-height:var(bubble_height);*/
-  min-width:16un;
-  min-height:12un;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]::preview:landscape
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  bottom:var(hb-param-margin-gene-bottom);
-  aspect-ratio:keep;
-  max-width:41.36un;
-  max-height:31.02un;
-  min-width:16un;
-  min-height:12un;
-}
-
-/****************************** TIMESTAMP TEXT ********************************/
-
-MsgConversationWidget::timeStamp
-{
-  left:-var(hb-param-margin-gene-left);
-  right:1.0un;
-  bottom:var(hb-param-margin-gene-bottom);
-  text-align:left;
-  text-height:var(hb-param-text-height-tiny);
-  font-variant:primary;
-  text-line-count-max:1;
-  text-line-count-min:1;
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="true"]::timeStamp:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-MsgConversationWidget[isMMS="true"][hasImage="false"][hasAudio="true"]::timeStamp:landscape
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-}
-
-/******************************* OVERLAY PLAY ICON ****************************/
-
-MsgConversationWidget[isMMS="true"]::playIcon
-{
-  zvalue:1;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-primary-medium);
-  pref-height:var(hb-param-graphic-size-primary-medium);
-}
-
-/******************************** AUDIO ICON **********************************/
-
-MsgConversationWidget[isMMS="true"][hasAudio="true"]::audioIcon
-{
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-left);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-primary-large);
-  pref-height:var(hb-param-graphic-size-primary-large);
-}
-
-/* EOF */
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgconversationwidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,203 +0,0 @@
-<hbwidget version="0.1">
-
-  <layout name="layout-sms" type="mesh">
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="bodyText" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP"/>
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-  </layout>
-
-  <layout name="layout-mms-portrait" type="mesh">
-
-    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="BOTTOM" dst="preview" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
-
-    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
-    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="preview" srcEdge="BOTTOM" dst="bodyText" dstEdge="TOP" />
-    <meshitem src="preview" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP" />
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-    <meshitem src="playIcon" srcEdge="CENTERV" dst="preview" dstEdge="CENTERV" />
-    <meshitem src="playIcon" srcEdge="CENTERH" dst="preview" dstEdge="CENTERH" />
-
-  </layout>
-
-  <layout name="layout-mms-image-landscape" type="mesh">
-
-    <meshitem src="preview" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="preview" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-
-    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="BOTTOM" dst="bodyText" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
-    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
-
-    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
-    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP" />
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="preview" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-    <meshitem src="playIcon" srcEdge="CENTERV" dst="preview" dstEdge="CENTERV" />
-    <meshitem src="playIcon" srcEdge="CENTERH" dst="preview" dstEdge="CENTERH" />
-
-  </layout>
-
-  <layout name="layout-mms-landscape" type="mesh">
-
-    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="BOTTOM" dst="bodyText" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
-
-    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
-    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP" />
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-  </layout>
-
-  <layout name="layout-mms-audio-text-portrait" type="mesh">
-
-    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="BOTTOM" dst="audioIcon" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
-
-    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
-    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="audioIcon" srcEdge="BOTTOM" dst="bodyText" dstEdge="TOP" />
-    <meshitem src="audioIcon" srcEdge="CENTERH" dst="" dstEdge="CENTERH" />
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP" />
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-  </layout>
-
-  <layout name="layout-mms-audio-text-landscape" type="mesh">
-
-    <meshitem src="audioIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="audioIcon" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-
-    <meshitem src="subject" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="BOTTOM" dst="bodyText" dstEdge="TOP" />
-    <meshitem src="subject" srcEdge="LEFT" dst="audioIcon" dstEdge="RIGHT" />
-    <meshitem src="subject" srcEdge="RIGHT" dst="priority" dstEdge="LEFT" />
-
-    <meshitem src="priority" srcEdge="RIGHT" dst="attachment" dstEdge="LEFT" />
-    <meshitem src="priority" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="attachment" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="attachment" srcEdge="CENTERV" dst="subject" dstEdge="CENTERV" />
-
-    <meshitem src="bodyText" srcEdge="LEFT" dst="audioIcon" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bodyText" srcEdge="BOTTOM" dst="timeStamp" dstEdge="TOP" />
-
-    <meshitem src="timeStamp" srcEdge="LEFT" dst="audioIcon" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeStamp" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="newItemIcon" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="newItemIcon" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="newItemIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-
-    <meshitem src="bubble" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bubble" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bubble" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="bubble" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-
-  </layout>
-</hbwidget>
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgeditorwidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-MsgEditorWidget
-{
-  layout:layout-msg-editor;
-}
-
-MsgEditorWidget::msgEditor
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  top:-var(hb-param-margin-gene-middle-vertical); 
-  min-height:7.46un;
-}
-
-MsgEditorWidget::sendButton
-{
-  top:-var(hb-param-margin-gene-middle-vertical);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-  fixed-width: 9.34un;
-  fixed-height: 7.46un;
-}
-
-MsgEditorWidget::charCounter
-{
-	  size-policy:fixed fixed;
-	  pref-height:-1;
-	  pref-width:-1;
-	  text-height:var(hb-param-text-height-tiny);
-}
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/resources/msgeditorwidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-msg-editor" type="mesh">
-
-    <meshitem src="msgEditor" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="msgEditor" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="msgEditor" srcEdge="RIGHT" dst="sendButton" dstEdge="LEFT" />
-    <meshitem src="msgEditor" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    
-    <meshitem src="sendButton" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="sendButton" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    
-    <meshitem src="charCounter" srcEdge="TOP" dst="msgEditor" dstEdge="TOP" />
-    <meshitem src="charCounter" srcEdge="RIGHT" dst="msgEditor" dstEdge="RIGHT" />
-
-    <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
-    <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
-    <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
-    <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" /> 
-    
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/rom/conversationviewplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef __CONVERSATIONVIEWPLUGIN_IBY__
-#define __CONVERSATIONVIEWPLUGIN_IBY__
-
-REM DLL
-file=ABI_DIR\UREL\conversationviewplugin.dll                   SHARED_LIB_DIR\conversationviewplugin.dll
-
-#endif // __CONVERSATIONVIEWPLUGIN_IBY__
--- a/messagingapp/msgui/layoutplugins/conversationviewplugin/src/conversationviewplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * 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: Layout plugin for all the widgets present in
- * conversation view.
- *
- */
-
-#include "conversationviewplugin.h"
-
-// INCLUDES
-#include <hbstyle.h>
-#include <hbiconitem.h>
-#include <hbtextitem.h>
-#include <QDir>
-#include <hbwidget.h>
-#include <hbinstance.h>
-
-#include "debugtraces.h"
-
-// Constants
-#define PRIMITIVECOUNT 1;
-
-//---------------------------------------------------------------
-// ConversationViewPlugin::primitiveCount
-// @see header file
-//---------------------------------------------------------------
-int ConversationViewPlugin::primitiveCount() const
-{
-#ifdef _DEBUG_TRACES_
-    qDebug() << "ConversationViewPlugin::primitiveCount";
-#endif
-
-
-    return PRIMITIVECOUNT;
-}
-
-//---------------------------------------------------------------
-// ConversationViewPlugin::createPrimitive
-// @see header file
-//---------------------------------------------------------------
-QGraphicsItem* ConversationViewPlugin::createPrimitive(
-    HbStyle::Primitive primitive, QGraphicsItem *parent) const
-{
-    Q_UNUSED(primitive)
-    Q_UNUSED(parent)
-    return NULL;
-}
-
-//---------------------------------------------------------------
-// ConversationViewPlugin::updatePrimitive
-// @see header file
-//---------------------------------------------------------------
-void ConversationViewPlugin::updatePrimitive(QGraphicsItem *item,
-    HbStyle::Primitive primitive, const QStyleOption *option) const
-{
-  Q_UNUSED(item)
-  Q_UNUSED(primitive)
-  Q_UNUSED(option)
-}
-
-//---------------------------------------------------------------
-// ConversationViewPlugin::layoutPath
-// @see header file
-//---------------------------------------------------------------
-QString ConversationViewPlugin::layoutPath() const
-{
-    QString path;
-
-    path = QString(":/");
-
-#ifdef _DEBUG_TRACES_
-    qDebug() << "layout plugin resources:" << path;
-#endif
-    return path;
-}
-
-Q_EXPORT_PLUGIN2(conversationviewplugin, ConversationViewPlugin)
-
-// EOF
--- a/messagingapp/msgui/layoutplugins/layoutplugins.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#                                                                    
-# 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:                                                        
-#                                                                     
-#
-
-TEMPLATE = subdirs
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-SUBDIRS += conversationviewplugin/conversationviewplugin.pro
-SUBDIRS += unifiededitorplugin/unifiededitorplugin.pro
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/inc/msglistviewitemplugin.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * 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:
- *
- */
-
-#ifndef MSGLISTITEMVIEWPLUGIN_H
-#define MSGLISTITEMVIEWPLUGIN_H
-
-// INCLUDES
-#include <QtPlugin>
-#include <hbstyleinterface.h>
-#include <hbglobal.h>
-
-class MsgListViewItemStyleOption;
-
-/**
- *
- */
-class MsgListViewItemPlugin : public QObject, public HbStyleInterface
-{
-    Q_OBJECT Q_INTERFACES(HbStyleInterface)
-
-public:
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    int primitiveCount() const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QGraphicsItem *createPrimitive(HbStyle::Primitive primitive,
-        QGraphicsItem *parent = 0) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    void updatePrimitive(QGraphicsItem *item, HbStyle::Primitive primitive,
-        const QStyleOption *option) const;
-
-    /**
-     * Updates Presence Primitive 
-     * @param item QGraphicsItem object
-     * @param primitive HbStyle::Primitive
-     * @param option MsgListViewItemStyleOption object
-     */
-    void updatePresencePrimitive(QGraphicsItem *item, 
-    		HbStyle::Primitive primitive,
-    		const MsgListViewItemStyleOption *option) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QString layoutPath() const;
-
-};
-
-#endif // MSGLISTITEMVIEWPLUGIN_H
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/msglistviewitemplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = lib
-TARGET = $$qtLibraryTarget(msglistviewitemplugin)
-CONFIG += plugin hb
-INCLUDEPATH += . inc 
-INCLUDEPATH += ../../inc
-INCLUDEPATH += ../../../../inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-symbian:TARGET.EPOCALLOWDLLDATA = 1
-symbian:TARGET.CAPABILITY = CAP_GENERAL_DLL
-symbian:TARGET.UID3 = 0x2001FE72
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "rom/msglistviewitemplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msglistviewitemplugin.iby)"
-
-# Input
-HEADERS += inc/msglistviewitemplugin.h
-SOURCES += src/msglistviewitemplugin.cpp
-
-RESOURCES += msglistviewitemplugin.qrc
-
-
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/msglistviewitemplugin.qrc	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-<RCC>
-  <qresource>
-		<file alias="msglistviewitemwidget.css">resources/msglistviewitemwidget.css</file>
-		<file alias="msglistviewitemwidget.widgetml">resources/msglistviewitemwidget.widgetml</file>
-  </qresource>
-</RCC>
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/resources/msglistviewitemwidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-MsgListViewItemWidget:portrait {
-	layout: layout-portrait;
-}
-
-MsgListViewItemWidget:landscape {
-	layout: layout-landscape;
-}
-
-MsgListViewItemWidget::newMsgIndicator:portrait {
-	left:-var(hb-param-margin-view-left);
-	size-policy-horizontal: fixed;
-	size-policy-vertical: fixed;
-	pref-width: 1.25un; 
-	pref-height: 15.1un;
-	aspect-ratio: ignore;
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::addressLabel:portrait {
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-	text-align: left;
-	font-variant: primary;
-	text-height:var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::addressLabel:portrait {
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-middle-vertical);
-	text-align: left;
-	font-variant: secondary;
-	text-height:var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-	color: gray;  
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::previewLabel:portrait {
-	left:-var(hb-param-margin-gene-middle-horizontal);
-	bottom:-var(hb-param-margin-gene-bottom);
-	right:var(hb-param-margin-gene-middle-horizontal);
-	text-align: left top;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-secondary);
-	text-line-count-min:2;
-	text-line-count-max:2;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::previewLabel:portrait {
-	left:-var(hb-param-margin-gene-middle-horizontal);
-	bottom:-var(hb-param-margin-gene-bottom);
-	right:var(hb-param-margin-gene-middle-horizontal);
-	text-align: left top;
-	font-variant: secondary;	
-	text-height: var(hb-param-text-height-secondary);
-	text-line-count-min:2;
-	text-line-count-max:2;
-	color: gray;
-}
-
-MsgListViewItemWidget::unreadCount:portrait {
-	right:var(hb-param-margin-gene-middle-horizontal);
-	size-policy-horizontal: fixed;
-	pref-width:6un;
-	text-align: left;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::timeLabel:portrait {
-	right:var(hb-param-margin-gene-right);
-	bottom:var(hb-param-margin-gene-bottom);
-	size-policy-horizontal: fixed;
-	pref-width:12un;
-	text-align: right;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-tiny);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::timeLabel:portrait {
-	right:var(hb-param-margin-gene-right);
-	bottom:var(hb-param-margin-gene-bottom);
-	size-policy-horizontal: fixed;
-	pref-width:12un;
-	text-align: right;
-	font-variant: secondary;	
-	text-height: var(hb-param-text-height-tiny);
-	text-line-count-min:1;
-	text-line-count-max:1;
-	color: gray;
-}
-
-MsgListViewItemWidget::presenceIndicator:portrait {
-	right: var(hb-param-margin-gene-right);
-	size-policy-horizontal: fixed;
-	size-policy-vertical: fixed;
-	pref-width: var(hb-param-graphic-size-secondary);
-  pref-height: var(hb-param-graphic-size-secondary);
-	aspect-ratio: ignore;
-}
-
-/*Landscape mode*/
-MsgListViewItemWidget::newMsgIndicator:landscape {
-  left:-var(hb-param-margin-view-left);
-	size-policy-horizontal: fixed;
-	size-policy-vertical: ignore;
-	pref-width: 1.25un; 
-	pref-height: -1;
-	aspect-ratio: ignore;
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::addressLabel:landscape {
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-left);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-bottom);
-	text-align: left;
-	font-variant: primary;
-	text-height:var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::addressLabel:landscape {
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-left);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  bottom:var(hb-param-margin-gene-bottom);
-	text-align: left;
-	font-variant: secondary;
-	text-height:var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-	color:gray;
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::previewLabel:landscape {
-	right:var(hb-param-margin-gene-middle-horizontal);
-	text-align: left;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-secondary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::previewLabel:landscape {
-	right:var(hb-param-margin-gene-middle-horizontal);
-	text-align: left;
-	font-variant: secondary;	
-	text-height: var(hb-param-text-height-secondary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-	color:gray;
-}
-
-MsgListViewItemWidget::unreadCount:landscape {
-	right:var(hb-param-margin-gene-middle-horizontal);
-	size-policy-horizontal: fixed;
-	pref-width:6un;
-	text-align: left;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-primary);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget::presenceIndicator:landscape {
-	right: var(hb-param-margin-gene-middle-horizontal);
-	size-policy-horizontal: fixed;
-	size-policy-vertical: fixed;
-	pref-width: var(hb-param-graphic-size-secondary);
-  pref-height: var(hb-param-graphic-size-secondary);
-	aspect-ratio: ignore;
-}
-
-MsgListViewItemWidget[unReadMsg="true"]::timeLabel:landscape {
-	right:var(hb-param-margin-gene-right);
-	size-policy-horizontal: fixed;
-	pref-width:12un;
-	text-align: right;
-	font-variant: primary;	
-	text-height: var(hb-param-text-height-tiny);
-	text-line-count-min:1;
-	text-line-count-max:1;
-}
-
-MsgListViewItemWidget[unReadMsg="false"]::timeLabel:landscape {
-	right:var(hb-param-margin-gene-right);
-	size-policy-horizontal: fixed;
-	pref-width:12un;
-	text-align: right;
-	font-variant: secondary;	
-	text-height: var(hb-param-text-height-tiny);
-	text-line-count-min:1;
-	text-line-count-max:1;
-	color:gray;	
-}
-
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/resources/msglistviewitemwidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="newMsgIndicator" type="mesh">
-  
-  </layout>
-  <layout name="layout-portrait" type="mesh">    
-    <meshitem src="newMsgIndicator" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="newMsgIndicator" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="newMsgIndicator" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="addressLabel" srcEdge="TOP" dst="newMsgIndicator" dstEdge="TOP" />
-    <meshitem src="addressLabel" srcEdge="BOTTOM" dst="previewLabel" dstEdge="TOP" />
-    <meshitem src="addressLabel" srcEdge="RIGHT" dst="unreadCount" dstEdge="LEFT" />
-    <meshitem src="addressLabel" srcEdge="LEFT" dst="newMsgIndicator" dstEdge="RIGHT" />
-    
-    <meshitem src="previewLabel" srcEdge="LEFT" dst="newMsgIndicator" dstEdge="RIGHT" />
-    <meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT" />
-    
-    <meshitem src="unreadCount" srcEdge="TOP" dst="addressLabel" dstEdge="TOP" />
-    <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
-    <meshitem src="unreadCount" srcEdge="BOTTOM" dst="addressLabel" dstEdge="BOTTOM" />
-    
-    <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-    <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    
-    <meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="timeLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />    
-    
-  </layout>
-  
-  <layout name="layout-landscape" type="mesh">
-      
-    <meshitem src="addressLabel" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="addressLabel" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="addressLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    <meshitem src="addressLabel" srcEdge="RIGHT" dst="unreadCount" dstEdge="LEFT" />
-    
-    <meshitem src="unreadCount" srcEdge="RIGHT" dst="presenceIndicator" dstEdge="LEFT" />
-    <meshitem src="unreadCount" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-        
-    <meshitem src="presenceIndicator" srcEdge="RIGHT" dst="" dstEdge="CENTERH" />    
-    <meshitem src="presenceIndicator" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-    
-    <meshitem src="previewLabel" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
-    <meshitem src="previewLabel" srcEdge="RIGHT" dst="timeLabel" dstEdge="LEFT"  />
-    <meshitem src="previewLabel" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV"  />
-  
-    <meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-    <meshitem src="timeLabel" srcEdge="CENTERV" dst="addressLabel" dstEdge="CENTERV" />
-    
-    <meshitem src="newMsgIndicator" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="newMsgIndicator" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="newMsgIndicator" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-  </layout>
-
-</hbwidget>
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/rom/msglistviewitemplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef __MSGLISTVIEWITEMPLUGIN_IBY__
-#define __MSGLISTVIEWITEMPLUGIN_IBY__
-
-REM DLL
-file=ABI_DIR\UREL\msglistviewitemplugin.dll                   SHARED_LIB_DIR\msglistviewitemplugin.dll
-
-#endif // __MSGLISTVIEWITEMPLUGIN_IBY__
--- a/messagingapp/msgui/layoutplugins/msglistviewitemplugin/src/msglistviewitemplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * 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: Layout plugin for all the widgets present in
- * conversationlist view.
- *
- */
-
-// INCLUDES
-#include <hbstyle.h>
-#include <hbiconitem.h>
-#include <hbtextitem.h>
-#include <QDir>
-#include "debugtraces.h"
-#include <hbwidget.h>
-#include <hbinstance.h>
-#include <hbframedrawer.h>
-#include <hbframeitem.h>
-
-// USER INCLUDES
-#include "msglistviewitemplugin.h"
-
-// Frames
-#define NEW_ITEM_FRAME ":/newitem/qtg_fr_list_new_item"
-// Constants
-#define PRIMITIVECOUNT 6;
-
-//---------------------------------------------------------------
-// MsgListViewItemPlugin::primitiveCount
-// @see header file
-//---------------------------------------------------------------
-int MsgListViewItemPlugin::primitiveCount() const
-{
-    return PRIMITIVECOUNT;
-}
-
-//---------------------------------------------------------------
-// MsgListViewItemPlugin::createPrimitive
-// @see header file
-//---------------------------------------------------------------
-QGraphicsItem* MsgListViewItemPlugin::createPrimitive(
-    HbStyle::Primitive primitive, QGraphicsItem *parent) const
-{
-    Q_UNUSED(primitive);
-    Q_UNUSED(parent);   
-}
-
-
-
-//---------------------------------------------------------------
-// MsgListViewItemPlugin::updatePrimitive
-// @see header file
-//---------------------------------------------------------------
-void MsgListViewItemPlugin::updatePrimitive(QGraphicsItem *item,
-    HbStyle::Primitive primitive, const QStyleOption *option) const
-{
-
-    Q_UNUSED(item);
-
-    Q_UNUSED(primitive);
-    Q_UNUSED(option);
-}
-
-
-	
-
-
-//---------------------------------------------------------------
-// MsgListViewItemPlugin::layoutPath
-// @see header file
-//---------------------------------------------------------------
-QString MsgListViewItemPlugin::layoutPath() const
-{
-#ifdef _DEBUG_TRACES_
-    qDebug() << "MsgListViewItemPlugin::layoutPath";
-#endif
-
-    QString path;
-
-    path = QString(":/");
-
-#ifdef _DEBUG_TRACES_
-    qDebug() << "layout plugin resources:" << path;
-#endif
-
-    return path;
-}
-
-Q_EXPORT_PLUGIN2(msglistviewitemplugin, MsgListViewItemPlugin)
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/inc/unifiededitorplugin.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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:
- *
- */
-
-#ifndef UNIFIEDEDITORPLUGIN_H
-#define UNIFIEDEDITORPLUGIN_H
-
-// INCLUDES
-#include <QtPlugin>
-#include <hbstyleinterface.h>
-#include <hbglobal.h>
-
-/**
- * TODO: add comment
- */
-class UnifiedEditorPlugin : public QObject, public HbStyleInterface
-{
-    Q_OBJECT Q_INTERFACES(HbStyleInterface)
-
-public:
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    int primitiveCount() const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QGraphicsItem    *createPrimitive( HbStyle::Primitive primitive, QGraphicsItem *parent = 0 ) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    void updatePrimitive( QGraphicsItem *item, HbStyle::Primitive primitive, const QStyleOption *option ) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QString layoutPath() const;
-
-};
-
-#endif // UNIFIEDEDITORPLUGIN_H
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitoraddress.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-MsgUnifiedEditorAddress {
-	layout:layout-default;
-}
-
-MsgUnifiedEditorAddress::launchBtn {
-	right: var(hb-param-margin-gene-right);
-	fixed-width: 9.5un;
-	fixed-height: 7.46un;
-}
-
-MsgUnifiedEditorAddress::addressField {
-	left: -var(hb-param-margin-gene-left);
-	right: var(hb-param-margin-gene-middle-horizontal);
-	min-height: 7.46un;
-	}
-
-
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitoraddress.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-
-     <meshitem src="addressField" srcEdge="TOP" dst="" dstEdge="TOP" />
-     <meshitem src="addressField" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="addressField" srcEdge="RIGHT" dst="launchBtn" dstEdge="LEFT" />
-     <meshitem src="" srcEdge="BOTTOM" dst="addressField" dstEdge="BOTTOM" />  
-     
-     
-     <meshitem src="launchBtn" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="launchBtn" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />    
-          
-          
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorattachment.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-
-MsgUnifiedEditorAttachment {
-    layout:layout-default;
-}
-
-MsgUnifiedEditorAttachment::attachmentIcon
-{
-  top:-var(hb-param-margin-gene-top);
-  left:-var(hb-param-margin-gene-left);
-  bottom:var(hb-param-margin-gene-bottom);
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-primary-small);
-  pref-height:var(hb-param-graphic-size-primary-small);
-}
-
-MsgUnifiedEditorAttachment::attachmentName
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  text-height:var(hb-param-text-height-secondary);
-  text-line-count-min:1;
-  text-line-count-max:1;
-}
-
-MsgUnifiedEditorAttachment::attachmentDetails
-{
-  right:var(hb-param-margin-gene-right);
-  text-height:var(hb-param-text-height-tiny);
-  text-line-count-min:1;
-  text-line-count-max:1;
-  fixed-width: 13.0un;
-  text-align:right;
-}
-
-MsgUnifiedEditorAttachment::bgFrame
-{
-  zvalue:-1;
-}
-
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorattachment.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-    
-    <meshitem src="attachmentIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="attachmentIcon" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="attachmentIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-    
-    <meshitem src="attachmentDetails" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="attachmentDetails" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-
-    <meshitem src="attachmentName" srcEdge="LEFT" dst="attachmentIcon" dstEdge="RIGHT"/>
-    <meshitem src="attachmentName" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-    <meshitem src="attachmentName" srcEdge="RIGHT" dst="attachmentDetails" dstEdge="LEFT"/>
-
-    <meshitem src="bgFrame" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="bgFrame" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="bgFrame" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="bgFrame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-    
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorbody.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-
-/********************************* LAYOUTS ***********************************/
-MsgUnifiedEditorBody:portrait {
-	layout: layout-portrait;
-}
-
-MsgUnifiedEditorBody[hasImage="false"]:landscape {
-	layout: layout-landscape-no-image;
-}
-
-MsgUnifiedEditorBody[hasImage="true"]:landscape {
-	layout: layout-landscape-image;
-}
-
-/**************************** Text field margin ******************************/
-MsgUnifiedEditorBody::textEdit:portrait {
-    left: -var(hb-param-margin-gene-left);
-    right: var(hb-param-margin-gene-right);
-}
-
-MsgUnifiedEditorBody[hasImage="true"][hasAudio="true"]::textEdit:portrait {
-    top: -var(hb-param-margin-gene-middle-vertical);
-}
-
-MsgUnifiedEditorBody[hasImage="true"][hasAudio="false"]::textEdit:portrait {
-    top: -var(hb-param-margin-gene-middle-vertical);
-}
-
-MsgUnifiedEditorBody[hasImage="false"][hasAudio="true"]::textEdit:portrait {
-    top: -var(hb-param-margin-gene-middle-vertical);
-}
-
-MsgUnifiedEditorBody[hasImage="false"][hasAudio="false"]::textEdit:portrait {
-    top: 0.0un;
-}
-
-MsgUnifiedEditorBody::textEdit:landscape {
-    right: var(hb-param-margin-gene-right);
-}
-
-MsgUnifiedEditorBody[hasImage="true"]::textEdit:landscape {
-    left: -1.0un;
-}
-
-MsgUnifiedEditorBody[hasImage="false"]::textEdit:landscape {
-    left: -var(hb-param-margin-gene-left);
-}
-
-MsgUnifiedEditorBody[hasAudio="true"]::textEdit:landscape {
-    top: -var(hb-param-margin-gene-middle-vertical);
-}
-
-MsgUnifiedEditorBody[hasAudio="false"]::textEdit:landscape {
-    top: 0.0un;
-}
-
-/*************************** Image field margin ******************************/
-MsgUnifiedEditorBody::pixmap {
-    left: -var(hb-param-margin-gene-left);
-}
-
-MsgUnifiedEditorBody::pixmap:portrait {
-    right: var(hb-param-margin-gene-right);
-}
-
-MsgUnifiedEditorBody::pixmap:landscape {
-    right: 1.0un;
-}
-
-MsgUnifiedEditorBody[hasAudio="true"]::pixmap {
-    top: -var(hb-param-margin-gene-middle-vertical);
-}
-
-MsgUnifiedEditorBody[hasAudio="false"]::pixmap {
-    top: 0.0un;
-}
-
-/*************************** Audio field margin ******************************/
-
-MsgUnifiedEditorBody::audioItem {
-    left: -var(hb-param-margin-gene-left);
-    right: var(hb-param-margin-gene-right);
-}
-
-/*************************** Character Counter ******************************/
-MsgUnifiedEditorBody::charCounter
-{
-	  size-policy:fixed fixed;
-	  pref-height:-1;
-	  pref-width:-1;
-	  text-height:var(hb-param-text-height-tiny);
-}
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorbody.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-<hbwidget version="0.1">
-
-  <layout name="layout-portrait" type="mesh">     
-  
-     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-     
-     <meshitem src="pixmap" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM"  />
-     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT"  />  
-     <meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />  
-     
-     <meshitem src="textEdit" srcEdge="TOP" dst="pixmap" dstEdge="BOTTOM" />
-     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-     
-     <meshitem src="textEditFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-     <meshitem src="textEditFrame" srcEdge="BOTTOM" dst="textEdit" dstEdge="BOTTOM" />
-     <meshitem src="textEditFrame" srcEdge="LEFT" dst="textEdit" dstEdge="LEFT" />
-     <meshitem src="textEditFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-     
-    <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-    <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-
-    <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
-    <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
-    <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
-    <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
-     
-  </layout>
-  
-  <layout name="layout-landscape-no-image" type="mesh">     
-     
-     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-
-     <meshitem src="textEdit" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM" />
-     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-     
-     <meshitem src="textEditFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-     <meshitem src="textEditFrame" srcEdge="LEFT" dst="textEdit" dstEdge="LEFT" />
-     <meshitem src="textEditFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-     <meshitem src="textEditFrame" srcEdge="BOTTOM" dst="textEdit" dstEdge="BOTTOM" />     
-
-     <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-     <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-
-     <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
-     <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
-     <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
-     <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
-  
-  </layout>
-  
-  <layout name="layout-landscape-image" type="mesh">     
-     
-     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-
-     <meshitem src="textEdit" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM" />
-     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
-     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-     
-     <meshitem src="textEditFrame" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-     <meshitem src="textEditFrame" srcEdge="LEFT" dst="textEdit" dstEdge="LEFT" />
-     <meshitem src="textEditFrame" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-     <meshitem src="textEditFrame" srcEdge="BOTTOM" dst="textEdit" dstEdge="BOTTOM" />     
-     
-     <meshitem src="pixmap" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM"  />    
-     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="pixmap" srcEdge="RIGHT" dst="textEdit" dstEdge="LEFT" />
-
-     <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
-     <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
-
-     <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
-     <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
-     <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
-     <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
-
-  </layout>
-  
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorsubject.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-
-MsgUnifiedEditorSubject {
-    layout:layout-default;
-}
-
-MsgUnifiedEditorSubject::priorityIcon {
-    fixed-height: var(hb-param-graphic-size-secondary);
-    fixed-width: var(hb-param-graphic-size-secondary);
-    right: var(hb-param-margin-gene-right);
-    left: -0.5un;
-}
-
-MsgUnifiedEditorSubject::subjectEdit {
-    left: -var(hb-param-margin-gene-left);
-    min-height:7.46un;
-    }
-
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/resources/msgunifiededitorsubject.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-
-     <meshitem src="subjectEdit" srcEdge="TOP" dst="" dstEdge="TOP" />
-     <meshitem src="subjectEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="subjectEdit" srcEdge="RIGHT" dst="priorityIcon" dstEdge="LEFT" />
-     <meshitem src="" srcEdge="BOTTOM" dst="subjectEdit" dstEdge="BOTTOM" />
-     
-     <meshitem src="priorityIcon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="priorityIcon" srcEdge="CENTERV" dst="subjectEdit" dstEdge="CENTERV" />
-          
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/rom/unifiededitorplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef __UNIFIEDEDITORPLUGIN_IBY__
-#define __UNIFIEDEDITORPLUGIN_IBY__
-
-REM DLL
-file=ABI_DIR\UREL\unifiededitorplugin.dll                   SHARED_LIB_DIR\unifiededitorplugin.dll
-
-#endif // __UNIFIEDEDITORPLUGIN_IBY__
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/src/unifiededitorplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
- * 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:
- *
- */
-
-// INCLUDES
-#include <hbstyle.h>
-#include "debugtraces.h"
-
-// USER INCLUDES
-#include "unifiededitorplugin.h"
-
-//---------------------------------------------------------------
-// UnifiedEditorPlugin::primitiveCount
-// @see header file
-//---------------------------------------------------------------
-int UnifiedEditorPlugin::primitiveCount() const
-{
-    return 1;
-}
-
-//---------------------------------------------------------------
-// UnifiedEditorPlugin::createPrimitive
-// @see header file
-//---------------------------------------------------------------
-QGraphicsItem* UnifiedEditorPlugin::createPrimitive(
-    HbStyle::Primitive primitive, QGraphicsItem *parent) const
-{
-    Q_UNUSED(primitive);
-    Q_UNUSED(parent);
-    return NULL;
-}
-
-//---------------------------------------------------------------
-// UnifiedEditorPlugin::updatePrimitive
-// @see header file
-//---------------------------------------------------------------
-void UnifiedEditorPlugin::updatePrimitive(QGraphicsItem *item,
-    HbStyle::Primitive primitive, const QStyleOption *option) const
-{
-    Q_UNUSED(item);
-    Q_UNUSED(primitive);
-    Q_UNUSED(option);
-}
-
-//---------------------------------------------------------------
-// UnifiedEditorPlugin::layoutPath
-// @see header file
-//---------------------------------------------------------------
-QString UnifiedEditorPlugin::layoutPath() const
-{
-#ifdef _DEBUG_TRACES_
-    qDebug() << "UnifiedEditorPlugin::layoutPath";
-#endif
-
-
-    QString path = QString(":/");
-
-#ifdef _DEBUG_TRACES_
-    qDebug() << "layout plugin resources:" << path;
-#endif
-
-    return path;
-}
-
-Q_EXPORT_PLUGIN2(UnifiedEditorPlugin, UnifiedEditorPlugin)
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/unifiededitorplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = lib
-TARGET = $$qtLibraryTarget(unifiededitorplugin)
-CONFIG += plugin
-CONFIG += hb
-
-INCLUDEPATH += . inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += ../../../../inc
-
-symbian:TARGET.EPOCALLOWDLLDATA = 1
-symbian:TARGET.CAPABILITY = CAP_GENERAL_DLL
-symbian:TARGET.UID3 = 0x2001FE63
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "rom/unifiededitorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unifiededitorplugin.iby)"
-
-# Input
-HEADERS += inc/unifiededitorplugin.h
-SOURCES += src/unifiededitorplugin.cpp
-
-RESOURCES += unifiededitorplugin.qrc
-
-
--- a/messagingapp/msgui/layoutplugins/unifiededitorplugin/unifiededitorplugin.qrc	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-<RCC>
-  <qresource>
-		<file alias="msgunifiededitoraddress.widgetml">resources/msgunifiededitoraddress.widgetml</file>
-		<file alias="msgunifiededitoraddress.css">resources/msgunifiededitoraddress.css</file>
-		<file alias="msgunifiededitorsubject.widgetml">resources/msgunifiededitorsubject.widgetml</file>
-		<file alias="msgunifiededitorsubject.css">resources/msgunifiededitorsubject.css</file>
-		<file alias="msgunifiededitorattachment.widgetml">resources/msgunifiededitorattachment.widgetml</file>
-		<file alias="msgunifiededitorattachment.css">resources/msgunifiededitorattachment.css</file>
-		<file alias="msgunifiededitorbody.css">resources/msgunifiededitorbody.css</file>
-		<file alias="msgunifiededitorbody.widgetml">resources/msgunifiededitorbody.widgetml</file>
-    </qresource>
-</RCC>
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/inc/unifiedviewerplugin.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * 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:
- *
- */
-
-#ifndef UNIFIEDVIEWERPLUGIN_H
-#define UNIFIEDVIEWERPLUGIN_H
-
-// INCLUDES
-#include <QtPlugin>
-#include <hbstyleinterface.h>
-#include <hbglobal.h>
-
-/**
- * TODO: add comment
- */
-class UnifiedViewerPlugin : public QObject, public HbStyleInterface
-{
-Q_OBJECT
-    Q_INTERFACES(HbStyleInterface)
-
-public:
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    int primitiveCount() const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QGraphicsItem *createPrimitive(HbStyle::Primitive primitive,
-        QGraphicsItem *parent = 0) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    void updatePrimitive(QGraphicsItem *item, HbStyle::Primitive primitive,
-        const QStyleOption *option) const;
-
-    /**
-     * Inherited from HbStyleInterface
-     * @see HbStyleInterface docs
-     */
-    QString layoutPath() const;
-
-};
-
-#endif // UNIFIEDVIEWERPLUGIN_H
-// EOF
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univieweraddresswidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-HbWidget
-{
-  margin-left: 0un;
-  margin-top: 0un;
-}
-
-UniViewerAddressWidget
-{
-  layout: layout-default;
-}
-
-UniViewerAddressWidget::addressField
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  right:var(hb-param-margin-gene-right);
-  bottom:var(hb-param-margin-gene-bottom);
-  size-policy-vertical:fixed;
-}
-
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univieweraddresswidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-    <meshitem src="addressField" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="addressField" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="addressField" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="addressField" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerbodywidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-
-UniViewerBodyWidget:portrait {
-  layout: layout-portrait;
-}
-
-UniViewerBodyWidget:landscape[hasText="true"] {
-  layout: layout-landscape;
-}
-
-UniViewerBodyWidget:landscape[hasText="false"] {
-  layout: layout-landscape-no-text;
-}
-
-UniViewerBodyWidget::pixmap:portrait {
-    top:-var(hb-param-margin-gene-top);
-    left:-var(hb-param-margin-gene-left);
-    right:var(hb-param-margin-gene-right);
-    size-policy-vertical:fixed;
-    size-policy-horizontal:ignored;
-    pref-width:-1;
-}
-
-UniViewerBodyWidget::textItem:portrait {
-   top:-var(hb-param-margin-gene-bottom);
-   left:-var(hb-param-margin-gene-left);
-   right:var(hb-param-margin-gene-right);
-   text-height:var(hb-param-text-height-secondary);
-   text-line-count-min:1;
-   text-line-count-max:100;
-   text-align: left top;
-   font-variant:primary;
-   size-policy-vertical:minimum-expanding;
-   pref-height:-1;
-}
-
-UniViewerBodyWidget::pixmap[hasText="true"]:landscape {
-    top:-var(hb-param-margin-gene-top);
-    left:-var(hb-param-margin-gene-left);
-    size-policy-horizontal:fixed;
-    pref-height:-1;
-    size-policy-vertical:ignored;
-}
-
-UniViewerBodyWidget::textItem:landscape {
-   top:-var(hb-param-margin-gene-top);
-   left:-2.0un;
-   right:var(hb-param-margin-gene-right);
-   text-height:var(hb-param-text-height-secondary);
-   text-line-count-min:1;
-   text-line-count-max:100;
-   text-align: left top;
-   font-variant:primary;
-   size-policy-vertical:minimum-expanding;
-   pref-height:-1;
-}
-
-UniViewerBodyWidget::pixmap[hasText="false"]:landscape {
-    top:-var(hb-param-margin-gene-top);
-    left:-var(hb-param-margin-gene-left);
-    right:var(hb-param-margin-gene-right);
-    bottom:var(hb-param-margin-gene-bottom);
-    size-policy-horizontal:ignored;
-    pref-width:-1;
-    size-policy-vertical:fixed;
-}
-
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerbodywidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-portrait" type="mesh">
-     <meshitem src="pixmap" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-     <meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-
-     <meshitem src="textItem" srcEdge="TOP" dst="pixmap" dstEdge="BOTTOM" />
-     <meshitem src="textItem" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="textItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="textItem" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-  </layout>
-
-  <layout name="layout-landscape" type="mesh">
-     <meshitem src="pixmap" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-
-     <meshitem src="textItem" srcEdge="TOP" dst="" dstEdge="TOP" />
-     <meshitem src="textItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="textItem" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-     <meshitem src="textItem" srcEdge="LEFT" dst="pixmap" dstEdge="RIGHT" />
-  </layout>
-
-  <layout name="layout-landscape-no-text" type="mesh">
-     <meshitem src="pixmap" srcEdge="TOP" dst="" dstEdge="TOP"  />
-     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
-     <meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
-     <meshitem src="pixmap" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"  />
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerdetailswidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-HbWidget {
-    margin-left: 0un;
-    margin-top: 0un;
-}
-
-UniViewerDetailsWidget {
-    layout:layout-default;
-}
-
-UniViewerDetailsWidget::subjectLabel {
-    top:-var(hb-param-margin-gene-top);
-    left:-var(hb-param-margin-gene-left);
-    right:0.5un;
-    text-height:var(hb-param-text-height-primary);
-    text-line-count-min:1;
-    text-line-count-max:10;
-    text-align: left;
-    font-variant: primary;
-}
-
-UniViewerDetailsWidget::timeLabel {
-   top:-var(hb-param-margin-gene-middle-vertical);
-   left:-var(hb-param-margin-gene-left);
-   right:var(hb-param-margin-gene-right);
-   bottom:var(hb-param-margin-gene-bottom);
-   text-height:var(hb-param-text-height-secondary);
-   text-line-count-min:1;
-   text-line-count-max:1;
-   text-align: left;
-   font-variant: primary;
- }
-
-UniViewerDetailsWidget::priorityIcon {
-  right:var(hb-param-margin-gene-right);
-  center-vertical:0.0un;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-secondary);
-  pref-height:var(hb-param-graphic-size-secondary);
-}
-
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/resources/univiewerdetailswidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-     <meshitem src="timeLabel" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="timeLabel" srcEdge="TOP" dst="subjectLabel" dstEdge="BOTTOM" />
-     <meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="timeLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-     <meshitem src="subjectLabel" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-     <meshitem src="subjectLabel" srcEdge="TOP" dst="" dstEdge="TOP" />
-     <meshitem src="subjectLabel" srcEdge="RIGHT" dst="priorityIcon" dstEdge="LEFT" />
-
-     <meshitem src="priorityIcon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-     <meshitem src="priorityIcon" srcEdge="CENTERV" dst="subjectLabel" dstEdge="CENTERV" />
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/rom/unifiededitorplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef __UNIFIEDVIEWERPLUGIN_IBY__
-#define __UNIFIEDVIEWERPLUGIN_IBY__
-
-REM DLL
-file=ABI_DIR\UREL\unifiedviewerplugin.dll                   SHARED_LIB_DIR\unifiedviewerplugin.dll
-
-#endif // __UNIFIEDVIEWERPLUGIN_IBY__
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/src/unifiedviewerplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include "unifiedviewerplugin.h"
-
-// INCLUDES
-#include <HbStyle>
-#include <QtDebug>
-
-//---------------------------------------------------------------
-// UnifiedViewerPlugin::primitiveCount
-// @see header file
-//---------------------------------------------------------------
-int UnifiedViewerPlugin::primitiveCount() const
-{
-    // Return non zero count.
-    return 1;
-}
-
-//---------------------------------------------------------------
-// UnifiedViewerPlugin::createPrimitive
-// @see header file
-//---------------------------------------------------------------
-QGraphicsItem* UnifiedViewerPlugin::createPrimitive(
-    HbStyle::Primitive primitive, QGraphicsItem *parent) const
-{
-    Q_UNUSED(primitive);
-    Q_UNUSED(parent);
-    return NULL;
-}
-
-//---------------------------------------------------------------
-// UnifiedViewerPlugin::updatePrimitive
-// @see header file
-//---------------------------------------------------------------
-void UnifiedViewerPlugin::updatePrimitive(QGraphicsItem *item,
-    HbStyle::Primitive primitive, const QStyleOption *option) const
-{
-    Q_UNUSED(item);
-    Q_UNUSED(primitive);
-    Q_UNUSED(option);
-}
-
-//---------------------------------------------------------------
-// UnifiedViewerPlugin::layoutPath
-// @see header file
-//---------------------------------------------------------------
-QString UnifiedViewerPlugin::layoutPath() const
-{
-    qDebug() << "UnifiedViewerPlugin::layoutPath";
-
-    QString path = QString(":/");
-
-    qDebug() << "layout plugin resources:" << path;
-    return path;
-}
-
-Q_EXPORT_PLUGIN2(UnifiedViewerPlugin, UnifiedViewerPlugin)
-
-// EOF
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/unifiedviewerplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = lib
-TARGET = $$qtLibraryTarget(unifiedviewerplugin)
-CONFIG += plugin
-CONFIG += hb
-
-INCLUDEPATH += . inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-symbian:TARGET.EPOCALLOWDLLDATA = 1
-symbian:TARGET.CAPABILITY = CAP_GENERAL_DLL
-symbian:TARGET.UID3 = 0x2001FE6F
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
-    "rom/unifiededitorplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unifiedviewerplugin.iby)"
-
-# Input
-HEADERS += inc/unifiedviewerplugin.h
-SOURCES += src/unifiedviewerplugin.cpp
-
-RESOURCES += unifiedviewerplugin.qrc
-
-
--- a/messagingapp/msgui/layoutplugins/unifiedviewerplugin/unifiedviewerplugin.qrc	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<RCC>
-  <qresource>
-    <file alias="univieweraddresswidget.css">resources/univieweraddresswidget.css</file>
-    <file alias="univieweraddresswidget.widgetml">resources/univieweraddresswidget.widgetml</file>
-    <file alias="univiewerbodywidget.css">resources/univiewerbodywidget.css</file>
-    <file alias="univiewerbodywidget.widgetml">resources/univiewerbodywidget.widgetml</file>
-    <file alias="univiewerdetailswidget.css">resources/univiewerdetailswidget.css</file>
-    <file alias="univiewerdetailswidget.widgetml">resources/univiewerdetailswidget.widgetml</file>
-    </qresource>
-</RCC>
--- a/messagingapp/msgui/msgapp/inc/draftslistview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/draftslistview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,7 @@
 class HbListWidget;
 class HbListWidgetItem;
 class HbAbstractViewItem;
-
+class HbAction;
 /**
  * List view implementation for showing Draft messages.
  */
@@ -113,6 +113,18 @@
      */
     void handleModelChanged();
 
+	/**
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogDeleteMsg(HbAction* action);
+    
+    /**
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogDeleteAllMessages(HbAction* action);
+    
 private:
 
     /**
@@ -140,6 +152,7 @@
     {
         DRAFTS_EXTN = 0x00, CONVERSATIONS_EXTN = 0x01
     };
+    
 };
 
 #endif /* DRAFTS_LISTVIEW_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/inc/msgactivityhandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,77 @@
+/*
+ * 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:
+ * Handles saving and opening activites. 
+ *
+ */
+
+#ifndef MSGACTIVITYHANDLER_H_
+#define MSGACTIVITYHANDLER_H_
+
+#include <QObject>
+#include <QVariant>
+
+class MsgMainWindow;
+class MsgViewManager;
+
+class MsgActivityHandler: public QObject
+{
+Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    MsgActivityHandler( QObject* parent = 0);
+                  
+    /**
+     * Destructor.
+     */
+   ~MsgActivityHandler();
+
+public slots:
+
+     /**
+      * Saves the current running activity.
+      */
+    void saveActivity();
+    
+public:   
+   /** 
+    * Set the message main window pointer.
+    * @param mainWindow message main window.
+    */
+    void setMainWindow(MsgMainWindow* mainWindow);
+   
+    /**
+     * Clears all saved messaging activities. 
+     */
+    void clearActivities();
+    
+    /**
+     * Parses the activity data.
+     * @param activitry data.
+     * @return valid message Id if its editor activity 
+     * else Invalid message id( i.e. -1) for list view activity 
+     */
+    int parseActivityData(const QVariant &activityData);
+    
+private:
+    /**
+     * main window reference not owned.
+     */
+    MsgMainWindow* mMainWindow;
+};
+
+#endif /* MSGACTIVITYHANDLER_H_ */
--- a/messagingapp/msgui/msgapp/inc/msglistview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msglistview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -26,6 +26,8 @@
 class HbAbstractViewItem;
 class HbListWidget;
 class HbListWidgetItem;
+class HbAction;
+class QGraphicsLinearLayout;
 
 /**
  * This class provides the message list view for the messaging application.
@@ -109,6 +111,19 @@
      */
     void contactInfo();
 
+	/**
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogDeleteMsg(HbAction* action);
+    
+	/**
+	 * This slot is called when appengine emits the partialdeleteconversationlist event.
+	 * This performs grab of the HbAbstractviewitem on which delete was called.
+	 * @param conversation id of the item.
+	 */
+    void enableListitem( int conversationId );
+	    
 private:
 
     /**
@@ -147,6 +162,11 @@
         DRAFTS_EXTN = 0x00, CONVERSATIONS_EXTN = 0x01
     };
 
+    /**
+     * Main layout
+     * Own
+     */    
+    QGraphicsLinearLayout *mMainLayout;
 };
 
 #endif // MSG_LIST_VIEW_H
--- a/messagingapp/msgui/msgapp/inc/msglistviewitem.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msglistviewitem.h	Fri Jun 25 15:47:40 2010 +0530
@@ -76,21 +76,26 @@
 private:
 
     /**
-     * Returns the preview text based on message type, sub type and state.
+     * Create permanent items.
+     */
+    void initItems();
+
+    /**
+     * Returns the preview text based on message type, sub type.
+     * Also sets the indicator icon.
      * @return QString
      */
-    QString previewText(int msgType, int msgSubType, int msgState,int msgDirection);
+    QString defaultPreviewText(int msgType, int msgSubType);
  
     /**
-     * return the preview text based on state.
-     * @return bool
+     * Sets the preview text and timestamp.
      */
-    QString textBySendState(int sendState,int msgDirection);
-    
+    void setTimestampAndPreviewText();
+
 private:
     /**
- 	   * Property to change the color of text
-	   */
+     * Property to change the color of text
+     */
     bool mUnReadMsg;
 
     /**
@@ -99,11 +104,6 @@
     HbFrameItem* mNewMsgIndicatorItem;
     
     /**
-     * Background frame for item.
-     */
-    HbFrameItem* mBgFrameItem;
-
-    /**
      * To display address.
      * Owned
      */
--- a/messagingapp/msgui/msgapp/inc/msgmainwindow.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgmainwindow.h	Fri Jun 25 15:47:40 2010 +0530
@@ -40,18 +40,23 @@
     /**
      * Constructor
      */
-    MsgMainWindow(bool serviceRequest, QWidget *parent = 0);
+    MsgMainWindow(bool serviceRequest, 
+                  int activityMsgId = -1,
+                   QWidget *parent = 0);
 
     /**
      * Destructor
      */
     virtual ~MsgMainWindow();
     
-    
+    /**
+     * Returns view manager.
+     */
+    MsgViewManager* viewManager();
 private:
     MsgServiceInterface* mMsgSI;
     MsgSendServiceInterface* mMsgSendSI;
-
+    MsgViewManager* mViewManager;
 };
 
 #endif // MSG_MAIN_WINDOW_H
--- a/messagingapp/msgui/msgapp/inc/msgserviceinterface.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgserviceinterface.h	Fri Jun 25 15:47:40 2010 +0530
@@ -22,18 +22,11 @@
 // INCLUDES
 #include <xqserviceprovider.h>
 #include <qvariant.h>
-#include <qmobilityglobal.h>
 
 //TODO: to be deprecated
 #include <QStringList>
 class ConvergedMessageAddress;
 
-QTM_BEGIN_NAMESPACE
-class QContactManager;
-QTM_END_NAMESPACE
-
-QTM_USE_NAMESPACE
-
 struct ContactDetail
 {
 public:
--- a/messagingapp/msgui/msgapp/inc/msgviewmanager.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/inc/msgviewmanager.h	Fri Jun 25 15:47:40 2010 +0530
@@ -20,6 +20,7 @@
 #define MSGVIEWMANAGER_H_
 
 #include <QObject>
+#include <QVariantList>
 #include <QVariant>
 
 class HbMainWindow;
@@ -31,6 +32,8 @@
 class DraftsListView;
 class MsgSettingsView;
 class HbAction;
+class HbView;
+class MsgAudioFetcherView;
 
 class MsgViewManager: public QObject
 {
@@ -40,7 +43,8 @@
     /**
      * constructor
      */
-    MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent = 0);
+    MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, 
+                   QObject* parent = 0,int activityMsgId = -1);
 
     /**
      * Destructor.
@@ -83,6 +87,15 @@
      */
     void view(int msgId);
 
+    /**
+     * Returns the current active view.
+     */
+    int currentView();
+	
+    /**
+	 * Saves the content of editor or Cv to draft.
+	 */
+    int saveContentToDraft();
 private:
     /**
      * swiches back to last view after service request is complete.
@@ -152,7 +165,35 @@
      * @param msgId message id
      */
     void handleProvisoningMsg(int msgId);
+    
+	/**
+	* Appends the views to be deleted into a QList to be deleted when view is ready
+	*/
+    void appendViewToBeDeleted(HbView* view);
 
+	 /**
+	  * Save the editor data to be populated
+	  * @param editorData QVariantList
+	  */    
+    void populateUniEditorAfterViewReady(const QVariantList& editorData);
+    
+    /**
+     * Launch Audio fetcher view
+     */
+    void switchToAudioFetcher(const QVariantList& data);
+	
+	/**
+	 * opens unieditor as activity.
+	 * @param activityMsgId activity msg id.
+	 */
+	void openUniEditorActivity(int activityMsgId);
+
+    /**
+    * find contact id corresponding to given phone no.
+    * @param phoneNum
+    */
+    qint32 findContactId(const QString address);
+    
 private slots:
     /**
      * this slot is called on mainwindows back action.
@@ -164,6 +205,33 @@
      */
     void switchView(const QVariantList& data);
 
+    /**
+     * This slot is called when viewReady signal is emitted from main window.
+     */
+    void setViewInteractive();
+
+    /**
+     * Slot to delete previous view instances on view switch
+     */
+    void deletePreviousView();
+	
+	/**
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
+     */	
+    void onDialogDeleteMsg(HbAction* action);
+    
+	/**
+     * This slot is called when save tone dialog is launched.
+     * @param action selected action (yes or no).
+     */	
+    void onDialogSaveTone(HbAction* action);
+    
+    /**
+     * When this slot is called the saved editor data is set to the editor
+     */
+    void populateUniEditorView();
+	
 private:
     /**
      * main window reference not owned.
@@ -179,6 +247,7 @@
     UnifiedViewer* mUniViewer;
     DraftsListView* mDraftsListView;
     MsgSettingsView* mSettingsView;
+    MsgAudioFetcherView* mAudioFetcherView;
     HbAction* mBackAction;
 
     int mPreviousView;
@@ -187,6 +256,11 @@
     bool mServiceRequest;
     qint64 mConversationId;
     bool mViewServiceRequest;
+    QList<HbView*> mViewTobeDeleted;
+    HbView* mDummyview;
+    int mMessageId;
+    
+    QVariantList mEditorData;
 };
 
 #endif /* MSGVIEWMANAGER_H_ */
--- a/messagingapp/msgui/msgapp/msgapp.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/msgapp.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -17,28 +17,31 @@
 TEMPLATE = app
 TARGET = messaging101
 
-ICON = resources/icons/qtg_large_message.svg
-
 DEPENDPATH += . inc src ../inc
 INCLUDEPATH += .
 INCLUDEPATH += ../inc
 INCLUDEPATH += ../../../inc
+INCLUDEPATH += ../msgaudiofetcher/inc
 INCLUDEPATH += ../unifiededitor/inc
 INCLUDEPATH += ../appengine/inc
 INCLUDEPATH += ../conversationview/inc
 INCLUDEPATH += ../unifiedviewer/inc
 INCLUDEPATH += ../../msgsettings/settingsview/inc
+INCLUDEPATH += ../../smartmessaging/ringbc/inc
+
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += /ext/mw/qtextensions/qtmobileextensions/include
-INCLUDEPATH += ../../smartmessaging/ringbc/inc
 
 CONFIG += hb service
 
 QT += sql
 
-TARGET.UID3 = 0x2001FE79
-TARGET.CAPABILITY = All -TCB
-TARGET.EPOCHEAPSIZE = 0x20000 0x1000000
+symbian {
+   TARGET.UID3 = 0x2001FE79
+   TARGET.CAPABILITY = All -TCB
+   TARGET.EPOCSTACKSIZE = 0x14000
+   TARGET.EPOCHEAPSIZE = 0x20000 0x1000000
+   SKINICON = qtg_large_message
+}
   
 # Platforms
 SYMBIAN_PLATFORMS = WINSCW ARMV5
@@ -51,8 +54,12 @@
      "sis/msgapp_stub.sis   /epoc32/data/z/system/install/msgapp_stub.sis" \
      "rom/messaging_uda.confml  CONFML_EXPORT_PATH(messaging_uda.confml,uda_content)" \
      "rom/messaging_uda_copy.implml CRML_EXPORT_PATH(messaging_uda_copy.implml,uda_content)" \
-     "rom/private.zip CRML_EXPORT_PATH(../content/zip/,uda_content)"
-
+     "rom/private.zip CRML_EXPORT_PATH(../content/zip/,uda_content)" \
+     "resources/xml/messaging101.docml  /epoc32/data/z/resource/hb/splashml/messaging101.docml" \
+     "resources/xml/messaging101.splashml  /epoc32/data/z/resource/hb/splashml/messaging101.splashml" \
+     "resources/xml/messaging101_dummy.docml  /epoc32/data/z/resource/hb/splashml/messaging101_dummy.docml" \
+     "resources/xml/messaging101_dummy.splashml  /epoc32/data/z/resource/hb/splashml/messaging101_dummy.splashml"
+          
 # Input
 HEADERS += msgmainwindow.h \
      msglistview.h \
@@ -62,7 +69,8 @@
      msgviewmanager.h \
      msgbaseview.h \
      msgsendserviceinterface.h \
-     msgserviceinterface.h
+     msgserviceinterface.h \
+     msgactivityhandler.h
 
 SOURCES += main.cpp \
      msgmainwindow.cpp \
@@ -72,7 +80,8 @@
      msgutils.cpp \
      msgviewmanager.cpp \
      msgsendserviceinterface.cpp \
-     msgserviceinterface.cpp
+     msgserviceinterface.cpp \
+     msgactivityhandler.cpp
 
 RESOURCES += msgapp.qrc
 
@@ -93,10 +102,6 @@
         -lQtContacts \
         -lsettingsview \
         -lringbc \
-		-lunidatamodelloader
-		
-styleplugin.sources += conversationviewplugin.dll \
-                       unifiededitorplugin.dll \
-                       unifiedviewerplugin.dll
+        -lunidatamodelloader \
+        -lmsgaudiofetcher
 
-DEPLOYMENT += styleplugin
--- a/messagingapp/msgui/msgapp/msgapp.qrc	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/msgapp.qrc	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,13 @@
 <RCC>
-    <qresource prefix="/xml">
-        <file alias="hblistviewitem.css">resources/xml/hblistviewitem.css</file>
-        <file alias="msglistviewitem.css">resources/xml/msglistviewitem.css</file>
-        <file alias="msglistviewitem.widgetml">resources/xml/msglistviewitem.widgetml</file>
-    </qresource>
     <qresource prefix="/translations">
         <file alias="messaging_en_GB">resources/translations/messaging_en_GB</file>
     </qresource>
+    <qresource prefix="/clv">
+        <file alias="msglistviewitem.css">resources/xml/msglistviewitem.css</file>
+        <file alias="msglistviewitem_color.css">resources/xml/msglistviewitem_color.css</file>
+        <file alias="msglistviewitem.widgetml">resources/xml/msglistviewitem.widgetml</file>
+    </qresource>
+    <qresource prefix="/dlv">
+        <file alias="hblistviewitem.css">resources/xml/hblistviewitem.css</file>
+    </qresource>
 </RCC>
--- a/messagingapp/msgui/msgapp/resources/icons/qtg_large_message.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="98" viewBox="0 0 98 98" width="98" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-<g>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="48.9995" x2="48.9995" y1="23.8706" y2="73.753">
-<stop offset="0" style="stop-color:#FEEFA7"/>
-<stop offset="0.5091" style="stop-color:#FFC501"/>
-<stop offset="1" style="stop-color:#F6A800"/>
-</linearGradient>
-<polygon fill="url(#SVGID_1_)" points="84,74.5 14,74.5 14,23.5 49.579,24.5 84,23.5 "/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="48.9995" x2="48.9995" y1="23.627" y2="74.8003">
-<stop offset="0" style="stop-color:#F7AC00"/>
-<stop offset="0.3394" style="stop-color:#FFF8DB"/>
-<stop offset="1" style="stop-color:#FFE066"/>
-</linearGradient>
-<path d="M83.23,24.275v49.449H14.77V24.275H83.23 M84,23.5l-35.249,0.42L14,23.5v51h70V23.5L84,23.5z" fill="url(#SVGID_2_)"/>
-<polygon fill="#FBAB13" fill-opacity="0.3" points="14,73.637 84,73.637 84,72.645 48.999,41.91 14,72.645 " stroke-opacity="0.3"/>
-<polygon fill="#F18800" fill-opacity="0.3" points="14,74.5 84,74.5 84,73.504 48.999,42.773 14,73.504 " stroke-opacity="0.3"/>
-<linearGradient gradientTransform="matrix(-1 0 0 -1 -1118.3896 -657.6523)" gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="-1167.3896" x2="-1167.3896" y1="-701.0981" y2="-731.9614">
-<stop offset="0" style="stop-color:#F98A00"/>
-<stop offset="0.7273" style="stop-color:#FCBC3C"/>
-<stop offset="1" style="stop-color:#FFE36A"/>
-</linearGradient>
-<polygon fill="url(#SVGID_3_)" points="84,74.475 48.999,43.611 14,74.475 "/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="48.9995" x2="48.9995" y1="43.374" y2="75.3424">
-<stop offset="0" style="stop-color:#FFF1B5"/>
-<stop offset="1" style="stop-color:#FFE066"/>
-</linearGradient>
-<polygon fill="url(#SVGID_4_)" points="84,74.475 48.999,43.611 14,74.475 48.999,44.705 "/>
-<polygon fill="#F18800" fill-opacity="0.3" points="49.07,24.5 14,23.5 48.999,59.771 84,23.5 " stroke-opacity="0.3"/>
-<polygon fill="#C26D00" fill-opacity="0.4" points="49.007,24.5 14,23.5 48.999,57.863 84,23.5 " stroke-opacity="0.4"/>
-<polygon fill="#AB6100" fill-opacity="0.4" points="48.879,24.371 14,23.5 48.999,56.252 84,23.5 " stroke-opacity="0.4"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="49.0005" x2="49.0005" y1="52.7031" y2="21.5113">
-<stop offset="0" style="stop-color:#FFDA33"/>
-<stop offset="0.25" style="stop-color:#FFE692"/>
-<stop offset="1" style="stop-color:#FFFBF8"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="14,23.5 48.999,54.363 84,23.5 "/>
-<rect fill="none" height="98" width="98"/>
-</g>
-</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/resources/xml/messaging101.docml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+    <object name="viewextn" type="HbAction">
+        <icon iconName="qtg_mono_sort" name="icon"/>
+    </object>
+    <object name="newmsg" type="HbAction">
+        <icon iconName="qtg_mono_create_message" name="icon"/>
+    </object>
+    <object name="settings" type="HbAction">
+        <string locid="txt_messaging_opt_settings" name="text" value="Settings"/>
+    </object>
+    <widget name="view" type="HbView">
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <widget name="groupBox" type="HbGroupBox">
+                <real name="z" value="1"/>
+                <bool name="collapsable" value="FALSE"/>
+                <string locid="txt_messaging_title_conversations" name="heading" value="Conversations"/>
+            </widget>
+            <layout type="anchor">
+                <anchoritem dst="groupBox" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+                <anchoritem dst="groupBox" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+                <anchoritem dst="groupBox" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+            </layout>
+        </widget>
+        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar">
+            <ref object="viewextn" role="HbWidget:addAction"/>
+            <ref object="newmsg" role="HbWidget:addAction"/>
+        </widget>
+        <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+            <ref object="settings" role="HbWidget:addAction"/>
+        </widget>
+        <string locid="txt_messaging_title_messaging" name="title" value="Messaging"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+    </metadata>
+</hbdocument>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/resources/xml/messaging101.splashml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,7 @@
+<hbsplash version="1">
+  <screenid>clv</screenid>
+	<docml>messaging101.docml</docml>
+	<widget>view</widget>
+	<appuid>0x2001FE79</appuid>
+	<tsappname>Messaging</tsappname>
+</hbsplash>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.docml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="1.1">
+    <object name="viewextn" type="HbAction">
+        <icon iconName="qtg_mono_sort" name="icon"/>
+    </object>
+    <object name="newmsg" type="HbAction">
+        <icon iconName="qtg_mono_create_message" name="icon"/>
+    </object>
+    <object name="settings" type="HbAction">
+        <string locid="txt_messaging_opt_settings" name="text" value="Settings"/>
+    </object>
+    <widget name="view" type="HbView">
+        <widget name="content" role="HbView:widget" type="HbWidget">
+            <layout type="anchor"/>
+        </widget>
+        <widget name="viewToolbar" role="HbView:toolBar" type="HbToolBar"/>
+        <widget name="viewMenu" role="HbView:menu" type="HbMenu">
+            <ref object="settings" role="HbWidget:addAction"/>
+        </widget>
+        <string locid="txt_messaging_title_messaging" name="title" value="Messaging"/>
+    </widget>
+    <metadata activeUIState="Common ui state" display="NHD-3.2-inch_portrait" unit="un">
+        <uistate name="Common ui state" sections="#common"/>
+    </metadata>
+</hbdocument>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/resources/xml/messaging101_dummy.splashml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,7 @@
+<hbsplash version="1">
+  <screenid>dummy</screenid>
+	<docml>messaging101_dummy.docml</docml>
+	<widget>view</widget>
+	<appuid>0x2001FE79</appuid>
+	<tsappname>Messaging</tsappname>
+</hbsplash>
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.css	Fri Jun 25 15:47:40 2010 +0530
@@ -29,7 +29,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   bottom:var(hb-param-margin-gene-middle-vertical);
   text-align: left;
-  color: var(list_item_title_normal);
   font-variant: primary;
   text-height:var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -42,7 +41,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   bottom:var(hb-param-margin-gene-middle-vertical);
   text-align: left;
-  color: var(list_item_title_normal);
   font-variant: secondary;
   text-height:var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -54,7 +52,6 @@
   bottom:-var(hb-param-margin-gene-bottom);
   right:var(hb-param-margin-gene-middle-horizontal);
   text-align: left top;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-secondary);
   text-line-count-min:2;
@@ -66,7 +63,6 @@
   bottom:-var(hb-param-margin-gene-bottom);
   right:var(hb-param-margin-gene-middle-horizontal);
   text-align: left top;
-  color: var(list_item_content_normal);
   font-variant: secondary;
   text-height: var(hb-param-text-height-secondary);
   text-line-count-min:2;
@@ -77,7 +73,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   size-policy-horizontal: fixed;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -90,7 +85,6 @@
   size-policy-horizontal: fixed;
   pref-width:12un;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-tiny);
   text-line-count-min:1;
@@ -103,7 +97,6 @@
   size-policy-horizontal: fixed;
   pref-width:12un;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: secondary;
   text-height: var(hb-param-text-height-tiny);
   text-line-count-min:1;
@@ -135,7 +128,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   bottom:var(hb-param-margin-gene-bottom);
   text-align: left;
-  color: var(list_item_title_normal);
   font-variant: primary;
   text-height:var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -148,7 +140,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   bottom:var(hb-param-margin-gene-bottom);
   text-align: left;
-  color: var(list_item_title_normal);
   font-variant: secondary;
   text-height:var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -158,7 +149,6 @@
 MsgListViewItem[unReadMsg="true"]::previewLabel[layoutName="custom"]:landscape {
   right:var(hb-param-margin-gene-middle-horizontal);
   text-align: left;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-secondary);
   text-line-count-min:1;
@@ -168,7 +158,6 @@
 MsgListViewItem[unReadMsg="false"]::previewLabel[layoutName="custom"]:landscape {
   right:var(hb-param-margin-gene-middle-horizontal);
   text-align: left;
-  color: var(list_item_content_normal);
   font-variant: secondary;
   text-height: var(hb-param-text-height-secondary);
   text-line-count-min:1;
@@ -179,7 +168,6 @@
   right:var(hb-param-margin-gene-middle-horizontal);
   size-policy-horizontal: fixed;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-primary);
   text-line-count-min:1;
@@ -200,7 +188,6 @@
   size-policy-horizontal: fixed;
   pref-width:12un;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: primary;
   text-height: var(hb-param-text-height-tiny);
   text-line-count-min:1;
@@ -212,7 +199,6 @@
   size-policy-horizontal: fixed;
   pref-width:12un;
   text-align: right;
-  color: var(list_item_content_normal);
   font-variant: secondary;
   text-height: var(hb-param-text-height-tiny);
   text-line-count-min:1;
--- a/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -23,11 +23,6 @@
     <meshitem src="timeLabel" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
     <meshitem src="timeLabel" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
 
-    <meshitem src="bgFrame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bgFrame" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bgFrame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bgFrame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
   </layout>
 
   <layout name="layout-landscape" type="mesh">
@@ -54,11 +49,6 @@
     <meshitem src="newMsgIndicator" srcEdge="LEFT" dst="" dstEdge="LEFT" />
     <meshitem src="newMsgIndicator" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
 
-    <meshitem src="bgFrame" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="bgFrame" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="bgFrame" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="bgFrame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
   </layout>
 
 </hbwidget>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/resources/xml/msglistviewitem_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,53 @@
+
+MsgListViewItem[unReadMsg="true"]::addressLabel {
+  color: var(qtc_list_item_title_normal);
+}
+
+MsgListViewItem[unReadMsg="false"]::addressLabel {
+  color: var(qtc_list_item_content_normal);
+}
+
+MsgListViewItem[state="pressed"]::addressLabel {
+  color: var(qtc_list_item_pressed);
+}
+
+MsgListViewItem[unReadMsg="true"]::previewLabel {
+  color: var(qtc_list_item_title_normal);
+}
+
+MsgListViewItem[unReadMsg="false"]::previewLabel {
+  color: var(qtc_list_item_content_normal);
+}
+
+MsgListViewItem[state="pressed"]::previewLabel {
+  color: var(qtc_list_item_pressed);
+}
+
+MsgListViewItem[unReadMsg="true"]::unreadCount {
+  color: var(qtc_list_item_title_normal);
+}
+
+MsgListViewItem[unReadMsg="false"]::unreadCount {
+  color: var(qtc_list_item_content_normal);
+}
+
+MsgListViewItem[state="pressed"]::unreadCount {
+  color: var(qtc_list_item_pressed);
+}
+
+MsgListViewItem[unReadMsg="true"]::timeLabel {
+  color: var(qtc_list_item_title_normal);
+}
+
+MsgListViewItem[unReadMsg="false"]::timeLabel {
+  color: var(qtc_list_item_content_normal);
+}
+
+MsgListViewItem[state="pressed"]::timeLabel {
+  color: var(qtc_list_item_pressed);
+}
+
+MsgListViewItem::presenceIndicator {
+  color: var(qtc_list_item_title_normal);
+}
+
--- a/messagingapp/msgui/msgapp/rom/msgapp.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/rom/msgapp.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -19,11 +19,15 @@
 
 file=ABI_DIR\UREL\messaging101.exe                              SHARED_LIB_DIR\messaging101.exe
 data=DATAZ_\private\10003a3f\import\apps\messaging101_reg.rsc   private\10003a3f\import\apps\messaging101_reg.rsc
-data=DATAZ_\resource\apps\0x2001FE79.mif                        resource\apps\0x2001FE79.mif
+data=DATAZ_\resource\apps\messaging101.mif                        resource\apps\messaging101.mif
 
 data=DATAZ_\system\install\msgapp_stub.sis					           system\install\msgapp_stub.sis
 
-data=\epoc32\data\z\private\2001fe79\conversationviewplugin.qtplugin  \private\2001fe79\conversationviewplugin.qtplugin
-data=\epoc32\data\z\private\2001fe79\unifiededitorplugin.qtplugin  \private\2001fe79\unifiededitorplugin.qtplugin
+<clip>
+      data=ZRESOURCE\hb\splashml\messaging101.splashml  RESOURCE_FILES_DIR\hb\splashml\messaging101.splashml
+      data=ZRESOURCE\hb\splashml\messaging101.docml  RESOURCE_FILES_DIR\hb\splashml\messaging101.docml
+      data=ZRESOURCE\hb\splashml\messaging101_dummy.splashml  RESOURCE_FILES_DIR\hb\splashml\messaging101_dummy.splashml
+      data=ZRESOURCE\hb\splashml\messaging101_dummy.docml  RESOURCE_FILES_DIR\hb\splashml\messaging101_dummy.docml
+</clip>
 
 #endif // __MSGAPP_IBY__
--- a/messagingapp/msgui/msgapp/src/draftslistview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/draftslistview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -43,7 +43,6 @@
 #include "convergedmessageid.h"
 
 // LOCAL CONSTANTS
-const QString LIST_ITEM_FRAME("qtg_fr_list_normal");
 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal");
 const QString NEW_MESSAGE_ICON("qtg_mono_create_message");
 const QString SORT_ICON("qtg_mono_sort");
@@ -67,15 +66,16 @@
 // Confirmation note
 #define LOC_DELETE_MESSAGE        hbTrId("txt_messaging_dialog_delete_message")
 #define LOC_DELETE_ALL_DRAFTS     hbTrId("txt_messaging_dialog_delate_all_drafts")
-#define LOC_BUTTON_DELETE         hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL         hbTrId("txt_common_button_cancel")
 
 //---------------------------------------------------------------
 // DraftsListView::DraftsListView
 // @see header
 //---------------------------------------------------------------
 DraftsListView::DraftsListView(QGraphicsItem *parent) :
-    MsgBaseView(parent), mListView(0), mViewExtnList(0), mToolBar(0)
+    MsgBaseView(parent),
+    mListView(0), 
+    mViewExtnList(0),
+    mToolBar(0)
 {
     // Delayed loading.
     connect(this->mainWindow(), SIGNAL(viewReady()), this, SLOT(doDelayedLoading()));
@@ -120,6 +120,7 @@
         viewAction->setIcon(HbIcon(SORT_ICON));
 
         mViewExtnList = new HbListWidget();
+        mViewExtnList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
         mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS);
         mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS);
 
@@ -163,7 +164,7 @@
         mListView->setClampingStyle(HbScrollArea::BounceBackClamping);
 
         // Register the custorm css path.
-        HbStyleLoader::registerFilePath(":/xml/hblistviewitem.css");
+        HbStyleLoader::registerFilePath(":/dlv");
         //    mListView->setLayoutName("custom");
 
         // Set list item properties.
@@ -171,8 +172,6 @@
         prototype->setGraphicsSize(HbListViewItem::SmallIcon);
         prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
         prototype->setSecondaryTextRowCount(1, 1);
-        HbFrameBackground frame(LIST_ITEM_FRAME, HbFrameDrawer::NinePieces);
-        prototype->setDefaultFrame(frame);
 
         // Create and set model
         QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
@@ -229,14 +228,9 @@
         return;
     }
 
-    bool result = HbMessageBox::question(LOC_DELETE_MESSAGE, LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
-
-    if (result) {
-        int msgId = index.data(ConvergedMsgId).toInt();
-        QList<int> msgIdList;
-        msgIdList.append(msgId);
-        ConversationsEngine::instance()->deleteMessages(msgIdList);
-    }
+    HbMessageBox::question(LOC_DELETE_MESSAGE,
+                           this,SLOT(onDialogDeleteMsg(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);
 
 }
 
@@ -246,12 +240,9 @@
 //------------------------------------------------------------------------------
 void DraftsListView::deleteAllDraftMessage()
 {
-    bool result = HbMessageBox::question(LOC_DELETE_ALL_DRAFTS, LOC_BUTTON_DELETE,
-        LOC_BUTTON_CANCEL);
-
-    if (result) {
-        ConversationsEngine::instance()->deleteAllDraftMessages();
-    }
+    HbMessageBox::question(LOC_DELETE_ALL_DRAFTS,
+                           this,SLOT(onDialogDeleteAllMessages(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);
 }
 
 //------------------------------------------------------------------------------
@@ -305,7 +296,7 @@
         mListView->setCurrentIndex(item->modelIndex(), QItemSelectionModel::Select);
 
         HbMenu *contextMenu = new HbMenu();
-
+        contextMenu->setAttribute(Qt::WA_DeleteOnClose);
         // Open
         HbAction* openAction = contextMenu->addAction(LOC_COMMON_OPEN);
         connect(openAction, SIGNAL(triggered()), this, SLOT(openDraftMessage()));
@@ -314,8 +305,8 @@
         HbAction *deletAction = contextMenu->addAction(LOC_COMMON_DELETE);
         connect(deletAction, SIGNAL(triggered()), this, SLOT(deleteDraftMessage()));
 
-        contextMenu->exec(coords);
-        delete contextMenu;
+        contextMenu->setPreferredPos(coords);
+        contextMenu->show();
     }
 }
 
@@ -353,4 +344,35 @@
     }
 }
 
+//------------------------------------------------------------------------------
+// DraftsListView::onDialogDeleteMsg
+// @see header
+//------------------------------------------------------------------------------
+void DraftsListView::onDialogDeleteMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        QModelIndex index = mListView->currentIndex();
+        if (index.isValid()) {
+            int msgId = index.data(ConvergedMsgId).toInt();
+            QList<int> msgIdList;
+            msgIdList.append(msgId);
+            ConversationsEngine::instance()->deleteMessages(msgIdList);
+        }
+
+    }
+}
+
+//------------------------------------------------------------------------------
+// DraftsListView::onDialogDeleteMsg
+// @see header
+//------------------------------------------------------------------------------
+void DraftsListView::onDialogDeleteAllMessages(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        ConversationsEngine::instance()->deleteAllDraftMessages();
+    }
+}
+
 // EOF
--- a/messagingapp/msgui/msgapp/src/main.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/main.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,13 +22,18 @@
 #include "debugtraces.h"
 #include <QDateTime>
 #include <QPointer>
+#include <HbSplashScreen>
 
 #include "msgmainwindow.h"
+#include "msgactivityhandler.h"
 
 //Localised constants
 #define LOC_TITLE hbTrId("txt_messaging_title_messaging")
 
 const QString debugFileName("c:/art2_app_log.txt");
+const QString activityParam("-activity");
+const int INVALID_MSGID = -1;
+
 #ifdef _DEBUG_TRACES_
 void debugInit(QtMsgType type, const char *msg)
 {
@@ -74,6 +79,22 @@
 #endif
 int main(int argc, char *argv[])
 {
+    
+    QCRITICAL_WRITE("MsgApp start.");
+    
+    QString firstArg(argv[1]);
+    bool serviceRequest = false;
+    // check for argc is greater than 1 and its not from activity
+    if(argc >1 && firstArg != activityParam )
+    {
+        serviceRequest = true;
+        HbSplashScreen::setScreenId("dummy");
+    }
+    else
+    {
+        HbSplashScreen::setScreenId("clv");   
+    }
+    
     // Application
     HbApplication app(argc, argv);
 
@@ -81,12 +102,11 @@
     QString locale = QLocale::system().name();
     QString path = "z:/resource/qt/translations/";
     QTranslator translator;
-    //QTranslator translator_comm;
-    //translator.load(path + QString("messaging_") + locale);
-    //translator_comm.load(path + QString("common_") + locale);
-    translator.load( "messaging_en_GB", ":/translations" );
+    QTranslator translator_comm;
+    translator.load(path + QString("messaging_") + locale);
+    translator_comm.load(path + QString("common_") + locale);
     app.installTranslator(&translator);
-    //app.installTranslator(&translator_comm);
+    app.installTranslator(&translator_comm);
 
     app.setApplicationName(LOC_TITLE);
     
@@ -99,20 +119,38 @@
     }
     qInstallMsgHandler(debugInit);
 #endif
-    bool serviceRequest = false;
-    if(argc >1)
-        {
-        serviceRequest = true;
+    
+   
+    
+     MsgActivityHandler* activityHandler = new MsgActivityHandler(&app);
+     // connect to aboutToQuit signal to save activity
+     QObject::connect(&app, SIGNAL(aboutToQuit()), 
+                      activityHandler, SLOT(saveActivity()));
+     
+    int activityMsgId = INVALID_MSGID;
+    if(app.activateReason() == Hb::ActivationReasonActivity) {
+          // restoring an activity, not a fresh startup or a service
+          QVariant data = app.activateData();
+          activityMsgId = activityHandler->parseActivityData(data);
+          // set service request to false , since its a activity launch
+          serviceRequest = false; 
         }
+    // clear the old activities
+     activityHandler->clearActivities();
+     
     // Main window
-    QPointer<MsgMainWindow> mainWindow = new MsgMainWindow(serviceRequest);
+    QPointer<MsgMainWindow> mainWindow = new MsgMainWindow(serviceRequest,activityMsgId);
+    // Set the main window pointer to activity handler.
+    activityHandler->setMainWindow(mainWindow);
     mainWindow->show();
 
     // Event loop
     int error = app.exec();
-
+    HbApplication::processEvents();
+    
     // delete main window and return error
     delete mainWindow;
+    
     return error;
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgapp/src/msgactivityhandler.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ * Handles saving and opening activites.
+ *
+ */
+
+#include "msgactivityhandler.h"
+
+#include "msgviewmanager.h"
+#include "msgbaseview.h"
+#include "msgmainwindow.h"
+#include <hbapplication.h>
+#include <hbactivitymanager.h>
+#include <QVariantHash>
+
+const int INVALID_MSGID = -1;
+// Activity Names 
+const QString ListViewActivityName("MsgConversationsList");
+const QString EditorActivityName("MsgCreate");
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::MsgActivityHandler
+// Constructor
+//-----------------------------------------------------------------------------
+MsgActivityHandler::MsgActivityHandler(QObject* parent):
+    QObject(parent)
+{
+  
+}
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::MsgActivityHandler
+// Destructor
+//-----------------------------------------------------------------------------
+MsgActivityHandler::~MsgActivityHandler()
+{
+   
+}
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::saveActivity
+// @see header
+//-----------------------------------------------------------------------------
+void MsgActivityHandler::saveActivity()
+{
+    HbActivityManager* activityManager = 
+                        qobject_cast<HbApplication*>(qApp)->activityManager();
+                        
+     int currentView = mMainWindow->viewManager()->currentView();
+     int msgId = INVALID_MSGID;
+     if((currentView == MsgBaseView::CV) || (currentView== MsgBaseView::UNIEDITOR))
+         {
+         msgId = mMainWindow->viewManager()->saveContentToDraft();
+         }
+     
+     // get a screenshot for saving to the activity manager
+     QVariantHash metadata;
+     metadata.insert("screenshot", 
+             QPixmap::grabWidget(mMainWindow, mMainWindow->rect()));
+
+     // save any data necessary to save the state
+     QByteArray serializedActivity;
+     QDataStream stream(&serializedActivity, 
+             QIODevice::WriteOnly | QIODevice::Append);
+  
+    if( msgId != INVALID_MSGID)
+        {
+        stream << EditorActivityName;
+        stream << msgId;
+
+        // add the activity to the activity manager
+        bool ok = activityManager->addActivity(EditorActivityName, 
+                serializedActivity, metadata);
+        }
+    else
+        {    
+        stream << ListViewActivityName;
+
+        // add the activity to the activity manager
+        bool ok = activityManager->addActivity(ListViewActivityName, 
+                serializedActivity, metadata);
+        }
+}
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::parseActivityData
+// @see header
+//-----------------------------------------------------------------------------
+int MsgActivityHandler::parseActivityData(const QVariant &activityData)
+{
+    QByteArray serializedModel = activityData.toByteArray();
+    QDataStream stream(&serializedModel, QIODevice::ReadOnly);
+
+    QString activityName;
+    int msgId = INVALID_MSGID;
+    stream >> activityName;
+    if( activityName == EditorActivityName)
+        {
+        stream >> msgId;
+        }
+    return msgId;
+}
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::clearActivities
+// @see header
+//-----------------------------------------------------------------------------
+void MsgActivityHandler::clearActivities()
+{
+    HbActivityManager* activityManager = 
+                        qobject_cast<HbApplication*>(qApp)->activityManager();
+    activityManager->removeActivity(ListViewActivityName);   
+    activityManager->removeActivity(EditorActivityName);   
+}
+
+//-----------------------------------------------------------------------------
+// MsgActivityHandler::setMainWindow
+// @see header
+//-----------------------------------------------------------------------------
+void  MsgActivityHandler::setMainWindow(MsgMainWindow* mainWindow)
+{
+    mMainWindow = mainWindow;
+}
--- a/messagingapp/msgui/msgapp/src/msglistview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -60,10 +60,7 @@
 #define LOC_OPEN hbTrId("txt_common_menu_open")
 #define LOC_SAVETO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
 #define LOC_DELETE_CONVERSATION hbTrId("txt_messaging_menu_delete_conversation")
-#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
-
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
+#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_contact_info")
 
 //main menu
 #define LOC_SETTINGS    hbTrId("txt_messaging_opt_settings")
@@ -81,9 +78,28 @@
 //---------------------------------------------------------------
 MsgListView::MsgListView(QGraphicsItem *parent) :
     MsgBaseView(parent)
-{
-    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
-}
+    {
+    //These changes are needed for splash implementation to avoid flicker
+    setupToolBar();
+    setupMenu();
+
+    // Create parent layout.
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout->setContentsMargins(0, 0, 0, 0);
+    mMainLayout->setSpacing(0);
+
+    // Create view heading.
+    HbGroupBox *viewHeading = new HbGroupBox();
+    viewHeading->setHeading(LOC_VIEW_HEADING);
+
+    // Add view heading widget to main layout.
+    mMainLayout->addItem(viewHeading);
+
+    this->setLayout(mMainLayout);
+
+    connect(this->mainWindow(), SIGNAL(viewReady()), this,
+            SLOT(doDelayedConstruction()));
+    }
 
 //---------------------------------------------------------------
 // MsgListView::~MsgListView
@@ -107,7 +123,7 @@
 
         // Create new menu
         HbMenu *contextMenu = new HbMenu();
-
+        contextMenu->setAttribute(Qt::WA_DeleteOnClose);
         //open menu option
         contextMenu->addAction(LOC_OPEN,this,SLOT(openConversation()));
         
@@ -131,9 +147,8 @@
         //delete conversation
         contextMenu->addAction(LOC_DELETE_CONVERSATION,this,SLOT(deleteItem()));
 
-        contextMenu->exec(point);
-        // Cleanup
-        delete contextMenu;
+        contextMenu->setPreferredPos(point);    
+        contextMenu->show();
     }
 }
 
@@ -211,18 +226,10 @@
 #ifdef _DEBUG_TRACES_
     qDebug() << "Inside MsgListView::deleteItem";
 #endif
-
-    QModelIndex index = mMsgList->currentIndex();
-    qint64 conversationId = index.data(ConversationId).toLongLong();
-
     //confirmation dialog.
-    bool result = HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION,
-                                         LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
-    if (result) 
-        {
-        ConversationsEngine::instance()->deleteConversations(conversationId);
-        }
-    
+    HbMessageBox::question(LOC_DIALOG_DELETE_CONVERSATION,
+                           this,SLOT(onDialogDeleteMsg(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);    
 #ifdef _DEBUG_TRACES_	
     qDebug() << " Leaving MsgConversationView::deleteItem";
 #endif
@@ -233,19 +240,9 @@
 // @see header
 //---------------------------------------------------------------
 void MsgListView::setupListView()
-{
-    // Create parent layout.
-    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
-    mainLayout->setContentsMargins(0, 0, 0, 0);
-    mainLayout->setSpacing(0);
-
-    // Create view heading.
-    HbGroupBox *viewHeading = new HbGroupBox();
-    viewHeading->setHeading(LOC_VIEW_HEADING);
-
+    {
     // Register the custorm css path.
-    HbStyleLoader::registerFilePath(":/xml/msglistviewitem.css");
-    HbStyleLoader::registerFilePath(":/xml/msglistviewitem.widgetml");
+    HbStyleLoader::registerFilePath(":/clv");
 
     mMsgList = new HbListView(this);
     mMsgList->setScrollingStyle(HbScrollArea::PanOrFlick);
@@ -253,37 +250,29 @@
 
     mMsgList->setLayoutName("custom");
     mMsgList->setItemRecycling(true);
-    mMsgList->setUniformItemSizes(true);   
+    mMsgList->setUniformItemSizes(true);
 
     MsgListViewItem *prototype = new MsgListViewItem(this);
     mMsgList->setItemPrototype(prototype);
-
-    // Set proxy model
-    QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(this);
-    proxyModel->setDynamicSortFilter(true);
-    proxyModel->setSourceModel(ConversationsEngine::instance()->getConversationsSummaryModel());
-    proxyModel->setSortRole(TimeStamp);
-    proxyModel->sort(0, Qt::DescendingOrder);
-
-    mMsgList->setModel(proxyModel);
-
-    connect(ConversationsEngine::instance(), SIGNAL(conversationListModelPopulated()),
-            this, SLOT(populateListView()));
-
+    mMsgList->setModel(ConversationsEngine::instance()->getConversationsSummaryModel());
+    
     // Single tap list item
-    connect(mMsgList, SIGNAL(activated(const QModelIndex&)),
-            this, SLOT(openConversation(const QModelIndex&)));
+    connect(mMsgList, SIGNAL(activated(const QModelIndex&)), this,
+            SLOT(openConversation(const QModelIndex&)));
 
     // Long tap list item
-    connect(mMsgList, SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)),
-            this, SLOT(longPressed(HbAbstractViewItem*, const QPointF&)));
+    connect(mMsgList,
+            SIGNAL(longPressed(HbAbstractViewItem*, const QPointF&)), this,
+            SLOT(longPressed(HbAbstractViewItem*, const QPointF&)));
 
-    // Add all widgets to main layout.
-    mainLayout->addItem(viewHeading);
-    mainLayout->addItem(mMsgList);
+    // enable tap after delete is completed
+    connect(ConversationsEngine::instance(),
+            SIGNAL(conversationListEntryDeleted( int )), this,
+            SLOT(enableListitem( int )));
 
-    this->setLayout(mainLayout);
-}
+    // Add list view to main layout.
+    mMainLayout->addItem(mMsgList);
+    }
 
 //---------------------------------------------------------------
 // MsgListView::addMenu
@@ -312,6 +301,7 @@
     viewAction->setIcon(HbIcon(SORT_ICON));
 
     mViewExtnList = new HbListWidget();
+    mViewExtnList->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
     mViewExtnList->addItem(LOC_TB_EXTN_DRAFTS);
     mViewExtnList->addItem(LOC_TB_EXTN_CONVERSATIONS);
 
@@ -350,10 +340,8 @@
 // @see header
 //---------------------------------------------------------------
 void MsgListView::doDelayedConstruction()
-    {
-    setupToolBar();    
+    {    
     setupListView();
-    setupMenu();
     
     disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
     }
@@ -423,4 +411,51 @@
     delete request;
     }
 
+//---------------------------------------------------------------
+// MsgListView::onDialogDeleteMsg
+// @see header
+//---------------------------------------------------------------
+void MsgListView::onDialogDeleteMsg(HbAction* action)
+    {
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0))
+        {
+        QModelIndex index = mMsgList->currentIndex();
+        if (index.isValid())
+            {
+            HbAbstractViewItem *item = mMsgList->currentViewItem();
+            item->ungrabGesture(Qt::TapGesture);
+            qint64 conversationId = index.data(ConversationId).toLongLong();
+
+            ConversationsEngine::instance()->deleteConversations(
+                    conversationId);
+
+            }
+
+        }
+    }
+
+//---------------------------------------------------------------
+// MsgListView::enableListitem
+// @see header
+//---------------------------------------------------------------
+void MsgListView::enableListitem(int conversationId)
+    {
+    QAbstractItemModel* proxyModel = mMsgList->model();
+    QModelIndexList indexList = proxyModel->match(proxyModel->index(0, 0),
+            ConversationId, conversationId, 1, Qt::MatchExactly);
+    HbAbstractViewItem* item = NULL;
+    int count = indexList.count();
+	// only item is expected to be the result of the above match function
+    if (1 == count)
+        {
+        item = mMsgList->itemByIndex(indexList[0]);
+        if (item)
+            {
+            item->grabGesture(Qt::TapGesture);
+            }
+        }
+
+    }
+
 //EOF
--- a/messagingapp/msgui/msgapp/src/msglistviewitem.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msglistviewitem.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -43,7 +43,6 @@
 #define LOC_RECEIVED_FILES hbTrId("txt_messaging_list_received_files")
 
 const QString NEW_ITEM_FRAME("qtg_fr_list_new_item");
-const QString LIST_ITEM_BG_FRAME("qtg_fr_list_normal");
 const QString BT_ICON("qtg_large_bluetooth");
 const QString MSG_OUTGOING_ICON("qtg_mono_outbox");
 const QString MSG_FAILED_ICON("qtg_mono_failed");
@@ -56,7 +55,6 @@
     HbListViewItem(parent),
     mUnReadMsg(false),
     mNewMsgIndicatorItem(NULL),
-    mBgFrameItem(NULL),
     mAddressLabelItem(NULL),
     mTimestampItem(NULL),
     mPreviewLabelItem(NULL),
@@ -80,58 +78,13 @@
 //---------------------------------------------------------------
 void MsgListViewItem::updateChildItems()
 {
-    if (!mAddressLabelItem)
-    {
-        mAddressLabelItem = new HbTextItem(this);
-        HbStyle::setItemName(mAddressLabelItem, "addressLabel");
-    }
-    if (!mTimestampItem)
-    {
-        mTimestampItem = new HbTextItem(this);
-        HbStyle::setItemName(mTimestampItem, "timeLabel");
-    }
-    if (!mPreviewLabelItem)
-    {
-        mPreviewLabelItem = new HbTextItem(this);
-        mPreviewLabelItem->setTextWrapping(Hb::TextWordWrap);
-        HbStyle::setItemName(mPreviewLabelItem, "previewLabel");
-    }
-    if (!mUnreadCountItem)
-    {
-        mUnreadCountItem = new HbTextItem(this);
-        HbStyle::setItemName(mUnreadCountItem, "unreadCount");
-    }
-    if (!mNewMsgIndicatorItem)
-    {
-        mNewMsgIndicatorItem = new HbFrameItem(this);
-        HbStyle::setItemName(mNewMsgIndicatorItem, "newMsgIndicator");
+    initItems();
 
-        mNewMsgIndicatorItem->frameDrawer().setFrameType(
-            HbFrameDrawer::ThreePiecesVertical);
-    }
-    if (!mBgFrameItem)
-    {
-        mBgFrameItem = new HbFrameItem(this);
-        mBgFrameItem->setZValue(-1.0);
-        HbStyle::setItemName(mBgFrameItem, "bgFrame");
-        
-        mBgFrameItem->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME);
-        mBgFrameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-    }
-
-    // Set the message text depending upon the message type
-    int messageType = modelIndex().data(MessageType).toInt();
-    int messageSubType = modelIndex().data(MessageSubType).toInt();
-    int messageState = modelIndex().data(SendingState).toInt();
-    int messageDirection = modelIndex().data(Direction).toInt();
-    QString prevText;
-    prevText = previewText(messageType, messageSubType, messageState,messageDirection);
-    prevText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
-    prevText.replace('\r', QChar::LineSeparator);
-    mPreviewLabelItem->setText(prevText);
+    setTimestampAndPreviewText();
 
     // Address label
     QString contactName;
+    int messageType = modelIndex().data(MessageType).toInt();
     if(messageType == ConvergedMessage::BT)
     {
         contactName = LOC_RECEIVED_FILES;
@@ -140,15 +93,7 @@
     {
         QString displayName = modelIndex().data(DisplayName).toString();
         QString contactAddress = modelIndex().data(ConversationAddress).toString();
-
-        if (displayName.isEmpty())
-        {
-            contactName.append(contactAddress);
-        }
-        else
-        {
-            contactName.append(displayName);
-        }        
+        contactName.append(displayName);
     }
     mAddressLabelItem->setText(contactName);
 
@@ -159,33 +104,72 @@
     {
         QString unRead(tr("(%n)", "", unreadCount));
         mUnreadCountItem->setText(unRead);
-        mUnReadMsg = true;
-        mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
+        if(!mUnReadMsg)
+        {
+            mUnReadMsg = true;
+            mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(NEW_ITEM_FRAME);
+            repolish();
+        }       
     }
     else
     {
-        mUnreadCountItem->setText(QString());
-        mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
-        mUnReadMsg = false;
-        repolish();
+        mUnreadCountItem->setText(QString());        
+        if(mUnReadMsg)
+        {
+            mUnReadMsg = false;  
+            mNewMsgIndicatorItem->frameDrawer().setFrameGraphicsName(QString());
+            repolish();
+        }
     }
 
     HbListViewItem::updateChildItems();
 }
 
 //---------------------------------------------------------------
-// MsgListViewItem::previewText
+// MsgListViewItem::initItems
 // @see header
 //---------------------------------------------------------------
-QString MsgListViewItem::previewText(int msgType, 
-    int msgSubType, 
-    int msgState,
-    int msgDirection)
+void MsgListViewItem::initItems()
+{
+    if (!mAddressLabelItem) {
+        mAddressLabelItem = new HbTextItem(this);
+        HbStyle::setItemName(mAddressLabelItem, "addressLabel");
+    }
+    if (!mTimestampItem) {
+        mTimestampItem = new HbTextItem(this);
+        HbStyle::setItemName(mTimestampItem, "timeLabel");
+    }
+    if (!mPreviewLabelItem) {
+        mPreviewLabelItem = new HbTextItem(this);
+        mPreviewLabelItem->setTextWrapping(Hb::TextWordWrap);
+        HbStyle::setItemName(mPreviewLabelItem, "previewLabel");
+    }
+    if (!mUnreadCountItem) {
+        mUnreadCountItem = new HbTextItem(this);
+        HbStyle::setItemName(mUnreadCountItem, "unreadCount");
+    }
+    if (!mNewMsgIndicatorItem) {
+        mNewMsgIndicatorItem = new HbFrameItem(this);
+        HbStyle::setItemName(mNewMsgIndicatorItem, "newMsgIndicator");
+
+        mNewMsgIndicatorItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical);
+    }
+    if (!mPresenceIndicatorItem) {
+        mPresenceIndicatorItem = new HbIconItem(this);
+        HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator");
+    }
+}
+//---------------------------------------------------------------
+// MsgListViewItem::defaultPreviewText
+// @see header
+//---------------------------------------------------------------
+QString MsgListViewItem::defaultPreviewText(int msgType, int msgSubType)
 {
     QString bodyText(modelIndex().data(BodyText).toString());
     QString previewText;
     // Set the message text & icons, depending upon the message type
     if (msgType == ConvergedMessage::BioMsg) {
+
         if (msgSubType == ConvergedMessage::RingingTone) {
             previewText = LOC_RINGING_TONE;
         }
@@ -194,12 +178,20 @@
             previewText.append(QChar::LineSeparator);
             previewText.append(bodyText);
         }
+        else if (msgSubType == ConvergedMessage::Provisioning) {
+            previewText = bodyText;
+        }
+        else if (msgSubType == ConvergedMessage::NokiaService) {
+            previewText = bodyText;
+        }
         else {
             previewText = LOC_UNSUPPORTED_MSG_TYPE;
         }
+
+        mPresenceIndicatorItem->setVisible(false);
     }
     else if (msgType == ConvergedMessage::BT) {
-        
+
         if (msgSubType == ConvergedMessage::VCard) {
             previewText = LOC_BUSINESS_CARD;
             previewText.append(QChar::LineSeparator);
@@ -208,26 +200,26 @@
         else {
             previewText = bodyText;
         }
-        if (!mPresenceIndicatorItem) {
-            mPresenceIndicatorItem = new HbIconItem(this);
-            HbStyle::setItemName(mPresenceIndicatorItem, "presenceIndicator");
-            mPresenceIndicatorItem->setIconName(BT_ICON);
-        }
+
+        mPresenceIndicatorItem->setIconName(BT_ICON);
+        mPresenceIndicatorItem->setVisible(true);
     }
     else {
-        previewText = textBySendState(msgState,msgDirection);
+        // All message types except BIO & BT.
+        previewText = modelIndex().data(BodyText).toString();
+        mPresenceIndicatorItem->setVisible(false);
     }
     return previewText;
 }
 
 
 //---------------------------------------------------------------
-// MsgListViewItem::textBySendState
+// MsgListViewItem::setTimestampAndPreviewText
 // @see header
 //---------------------------------------------------------------
-QString MsgListViewItem::textBySendState(int sendState,int msgDirection)
+void MsgListViewItem::setTimestampAndPreviewText()
 {
-    QString previewText;
+    // Get timestamp
     QDateTime dateTime;
     dateTime.setTime_t(modelIndex().data(TimeStamp).toUInt());
     QString dateString;
@@ -238,80 +230,55 @@
         dateString = MsgUtils::dateTimeToString(dateTime, DATE_FORMAT);
     }
 
-    if (msgDirection == ConvergedMessage::Outgoing)
-    {
-        switch (sendState)
-        {
-            case ConvergedMessage::Resend:
-            {
-
-                QString resendString = LOC_MSG_RESEND_AT + dateString;
-                previewText = resendString;
-                dateString = QString("");
-                if (!mPresenceIndicatorItem)
-                {
-                    mPresenceIndicatorItem = new HbIconItem(this);
-                }
-                HbStyle::setItemName(mPresenceIndicatorItem,
-                    "presenceIndicator");
-                mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
-                mPresenceIndicatorItem->setVisible(true);
-                break;
-            }
+    // Set preview text & time based on direction
+    int msgType = modelIndex().data(MessageType).toInt();
+    int msgSubType = modelIndex().data(MessageSubType).toInt();
+    int sendState = modelIndex().data(SendingState).toInt();
+    int msgDirection = modelIndex().data(Direction).toInt();
+    QString previewText;
+    if (ConvergedMessage::Incoming == msgDirection) {
+        previewText = defaultPreviewText(msgType, msgSubType);
+    }
+    else if (msgDirection == ConvergedMessage::Outgoing) {
 
-            case ConvergedMessage::Sending:
-            case ConvergedMessage::Suspended:
-            case ConvergedMessage::Scheduled:
-            case ConvergedMessage::Waiting:
-            {
-                previewText = QString(LOC_MSG_OUTGOING);
-                if (!mPresenceIndicatorItem)
-                {
-                    mPresenceIndicatorItem = new HbIconItem(this);
-                }
-                HbStyle::setItemName(mPresenceIndicatorItem,
-                    "presenceIndicator");
-                mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
-                mPresenceIndicatorItem->setVisible(true);
-                break;
-            }
-            case ConvergedMessage::Failed:
-            {
-                previewText = QString(LOC_MSG_SEND_FAILED);
-                if (!mPresenceIndicatorItem)
-                {
-                    mPresenceIndicatorItem = new HbIconItem(this);
-                }
-                HbStyle::setItemName(mPresenceIndicatorItem,
-                    "presenceIndicator");
-                mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON);
-                mPresenceIndicatorItem->setVisible(true);
-                break;
-            }
-            default:
-                QString postFix = QString("");
-                previewText = modelIndex().data(BodyText).toString();
-                previewText += (QChar(QChar::LineSeparator) + postFix);
-
-                if (!mPresenceIndicatorItem)
-                {
-                    mPresenceIndicatorItem = new HbIconItem(this);
-                }
-
-                HbStyle::setItemName(mPresenceIndicatorItem,
-                    "presenceIndicator");
-                mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON);
-                mPresenceIndicatorItem->setVisible(false);
-
-                break;
+        switch (sendState) {
+        case ConvergedMessage::Resend:
+        {
+            previewText = LOC_MSG_RESEND_AT + dateString;
+            dateString = QString();
+            mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
+            mPresenceIndicatorItem->setVisible(true);
+            break;
+        }
+        case ConvergedMessage::Sending:
+        case ConvergedMessage::Suspended:
+        case ConvergedMessage::Scheduled:
+        case ConvergedMessage::Waiting:
+        {
+            previewText = QString(LOC_MSG_OUTGOING);
+            mPresenceIndicatorItem->setIconName(MSG_OUTGOING_ICON);
+            mPresenceIndicatorItem->setVisible(true);
+            break;
+        }
+        case ConvergedMessage::Failed:
+        {
+            previewText = QString(LOC_MSG_SEND_FAILED);
+            mPresenceIndicatorItem->setIconName(MSG_FAILED_ICON);
+            mPresenceIndicatorItem->setVisible(true);
+            break;
+        }
+        default:
+        {
+            // Successful case
+            previewText = defaultPreviewText(msgType, msgSubType);
+            break;
+        }
         }
     }
-    else
-    {
-        previewText = modelIndex().data(BodyText).toString();
-    }
+    previewText.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
+    previewText.replace('\r', QChar::LineSeparator);
+    mPreviewLabelItem->setText(previewText);
     mTimestampItem->setText(dateString);
-    return previewText;
 }
 
 //---------------------------------------------------------------
--- a/messagingapp/msgui/msgapp/src/msgmainwindow.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msgmainwindow.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -28,13 +28,12 @@
 // MsgMainWindow::MsgMainWindow
 // Constructor
 //---------------------------------------------------------------
-MsgMainWindow::MsgMainWindow(bool serviceRequest, QWidget *parent) :
+MsgMainWindow::MsgMainWindow(bool serviceRequest,int activityMsgId,QWidget *parent) :
 HbMainWindow(parent), mMsgSI(0), mMsgSendSI(0)
 {
-    hideItems(Hb::NaviPaneItem);
-    MsgViewManager* viewManager = new MsgViewManager(serviceRequest,this,this);
-    mMsgSI = new MsgServiceInterface(NULL,viewManager);
-    mMsgSendSI = new MsgSendServiceInterface(NULL,viewManager);
+    mViewManager = new MsgViewManager(serviceRequest,this,this,activityMsgId);
+    mMsgSI = new MsgServiceInterface(NULL,mViewManager);
+    mMsgSendSI = new MsgSendServiceInterface(NULL,mViewManager);
         
     //Model creation
     ConversationsEngine::instance();
@@ -61,4 +60,12 @@
     delete ConversationsEngine::instance();
 }
 
+//---------------------------------------------------------------
+// MsgMainWindow::viewManager
+// Constructor
+//---------------------------------------------------------------
+MsgViewManager* MsgMainWindow::viewManager()
+{   
+     return mViewManager; 
+}
 // End of file
--- a/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msgserviceinterface.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -17,15 +17,11 @@
  */
 
 //TODO: to be deprecated
-#include <qtcontactsglobal.h>
-#include "qcontactdetailfilter.h"
-#include "qcontactdetail.h"
-#include "qtcontacts.h" 
 #include "convergedmessageaddress.h"
 
 #include "msgserviceinterface.h"
 #include "msgviewmanager.h"
-//INCLUDES
+#include "msgcontacthandler.h"
 
 MsgServiceInterface::MsgServiceInterface(QObject* parent, MsgViewManager* manager)
 :XQServiceProvider( QLatin1String("com.nokia.services.hbserviceprovider.conversationview"),parent),
@@ -90,31 +86,24 @@
     mViewManager->openEditor(number,resolvedName);
     }
 
-bool MsgServiceInterface::resolveContact(const ConvergedMessageAddress &address,
-        ContactDetail &contactDetail)
-    {
-    QContactManager* mPhonebookManager = new QContactManager("symbian");
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(
-            QContactPhoneNumber::DefinitionName, 
-            QContactPhoneNumber::FieldNumber);
-    phoneFilter.setValue(address.address());
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
+bool MsgServiceInterface::resolveContact(
+                                         const ConvergedMessageAddress &address,
+                                         ContactDetail &contactDetail)
+{
+    QString displayLabel = QString("");
+    int count;
+    int localId =
+            MsgContactHandler::resolveContactDisplayName(address.address(),
+                                                         displayLabel,
+                                                         count);
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = mPhonebookManager->contacts(
-            phoneFilter,
-            sortOrder,
-            QStringList());
-
-    if ( matchingContacts.count() > 0 ) {       
-        // Fill the contact details
-        QContact match = matchingContacts.at(0);                   
-        contactDetail.contactId = match.localId();
-        contactDetail.displayName = match.displayLabel();   
+    if (localId != -1)
+    {
+        contactDetail.contactId = localId;
+        contactDetail.displayName = displayLabel;
         return true;
     }
     
     return false;
-    }
+}
 
--- a/messagingapp/msgui/msgapp/src/msgviewmanager.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgapp/src/msgviewmanager.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,8 @@
 #include <QSqlError>
 #include <HbApplication>
 #include <xqappmgr.h>
-#include <HbMessageBox.h>
+#include <hbmessagebox.h>
+#include <HbView>
 
 #include "conversationsengine.h"
 #include "msglistview.h"
@@ -38,35 +39,53 @@
 #include "ringbc.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
+#include "msgcontacthandler.h"
+#include "debugtraces.h"
+#include "msgaudiofetcherview.h"
 
 // LOCALIZATION
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
+#define LOC_DIALOG_SAVE_RINGTONE hbTrId("txt_conversations_dialog_save_ringing_tone")
 
 const qint64 NULL_CONVERSATIONID = -1;
 
-MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent) :
+MsgViewManager::MsgViewManager(bool serviceRequest, HbMainWindow* mainWindow, QObject* parent,int activityMsgId) :
     QObject(parent), mMainWindow(mainWindow), mUniEditor(0), mListView(0), mConversationView(0),
-        mUniViewer(0), mDraftsListView(0), mSettingsView(0), mBackAction(0), mServiceRequest(
-            serviceRequest), mConversationId(-1), mViewServiceRequest(false)
+        mUniViewer(0), mDraftsListView(0), mSettingsView(0), mAudioFetcherView(0), mBackAction(0),
+        mServiceRequest(serviceRequest), mConversationId(-1), mViewServiceRequest(false),mMessageId(-1)
 {
     //creating back action.
-    mBackAction = new HbAction(Hb::BackAction, this);
+    mBackAction = new HbAction(Hb::BackNaviAction, this);
     connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()));
 
     //create clv as first view if not a service request.
     if (!mServiceRequest) {
+    
+    if(activityMsgId == NULL_CONVERSATIONID)
+        {
         QVariantList param;
         param << MsgBaseView::CLV;
         param << MsgBaseView::CLV;
         switchView(param);
+        }
+    else 
+        {
+        openUniEditorActivity(activityMsgId);
+        }
+    }
+    else
+    {
+        mDummyview = new HbView();
+        mMainWindow->addView(mDummyview);
+        mMainWindow->setCurrentView(mDummyview);
+        mViewTobeDeleted << mDummyview;
     }
 }
 
 MsgViewManager::~MsgViewManager()
 {
     // TODO Auto-generated destructor stub
+    mEditorData.clear();
 }
 
 void MsgViewManager::onBackAction()
@@ -92,12 +111,17 @@
 
     case MsgBaseView::CV:
     {
+	    mConversationId = -1; //reset the conversation view id since its closed
+		
         //Save content to drafts before switching to clv
         mConversationView->saveContentToDrafts();
 
         //marking messages as red in CV.
         mConversationView->markMessagesAsRead();
 
+        // reset the conversation id published
+        mConversationView->setPSCVId(false);
+
         //clearing content of cv.
         mConversationView->clearContent();
 
@@ -150,14 +174,6 @@
             break;
         }
 
-        //Now UE can be launched from viewer and on its back
-        //we need to clear viewer
-        if (mUniViewer) {
-            mMainWindow->removeView(mUniViewer);
-            delete mUniViewer;
-            mUniViewer = NULL;
-        }
-
         //switch to clv.
         if (mServiceRequest) {
             completeServiceRequest();
@@ -181,13 +197,20 @@
         }
         else {
             QVariantList param;
-            param << MsgBaseView::CV;
-            param << MsgBaseView::UNIVIEWER;
-            param << mConversationId;
+            if (mConversationId != -1)
+                {
+                    //this means CV is till open then just open the fresh CV
+                    param << MsgBaseView::CV;
+                    param << MsgBaseView::UNIVIEWER;
+                    param << mConversationView->conversationId();
+                }
+                else
+                {
+                    param << MsgBaseView::CLV;
+                    param << MsgBaseView::UNIVIEWER;
+                }
             switchView(param);
 
-            delete mUniViewer;
-            mUniViewer = NULL;
         }
         break;
     }
@@ -199,6 +222,19 @@
         switchView(param);
         break;
     }
+    case MsgBaseView::AUDIOFETCHER:
+    {
+        // switch back to previous view
+        QVariantList param;
+        param << mPreviousView;
+        param << MsgBaseView::AUDIOFETCHER;
+        if(mPreviousView == MsgBaseView::CV)
+        {
+            param << mConversationId;
+        }
+        switchView(param);
+        break;
+    }
     default:
     {
         break;
@@ -208,7 +244,10 @@
 
 void MsgViewManager::switchView(const QVariantList& data)
 {
+    QCRITICAL_WRITE("MsgViewManager::switchView start.");
+    
     int viewId = data.at(0).toInt();
+
     switch (viewId) {
     case MsgBaseView::DEFAULT:
     {
@@ -217,15 +256,16 @@
     }
     case MsgBaseView::CLV:
     {
-        switchToClv(data);
-        break;
-    }
+            switchToClv(data);
+            break;
+        }
 
-    case MsgBaseView::CV:
-    {
-        switchToCv(data);
-        break;
-    }
+        case MsgBaseView::CV:
+        {
+
+            switchToCv(data);
+            break;
+        }
 
     case MsgBaseView::DLV:
     {
@@ -250,9 +290,26 @@
         switchToMsgSettings(data);
         break;
     }
+    case MsgBaseView::AUDIOFETCHER:
+    {
+        switchToAudioFetcher(data);
+        break;
+    }
+    }
+    QCRITICAL_WRITE("MsgViewManager::switchView end.");
+}
+
+void MsgViewManager::deletePreviousView()
+{
+    while(mViewTobeDeleted.count())
+    {
+        HbView* v = mViewTobeDeleted.takeAt(0);
+        mMainWindow->removeView(v);
+        delete v;
     }
 }
 
+
 void MsgViewManager::send(const qint32 contactId, const QString phoneNumber,
     const QString displayName)
 {
@@ -348,6 +405,11 @@
     if (conversationId < 0) {
         param << MsgBaseView::CLV;
         param << MsgBaseView::SERVICE;
+
+        if( mCurrentView == MsgBaseView::CV && mConversationView)
+            {
+            mConversationView->setPSCVId(false);
+            }
     }
     else {
         param << MsgBaseView::CV;
@@ -423,27 +485,53 @@
 
 void MsgViewManager::switchToClv(const QVariantList& data)
 {
-    //switch to CLV.
-    mCurrentView = MsgBaseView::CLV;
     mPreviousView = data.at(1).toInt();
 
-    // delete case from viewer service  
+    // delete case from viewer service
     if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) {
-        // quit the application 
+        // quit the application
         HbApplication::quit();
     }
 
-    //remove the settings view from main window
-    if (mSettingsView) {
-        mMainWindow->removeView(mSettingsView);
-        mSettingsView->setNavigationAction(mBackAction);
-        connect(mBackAction, SIGNAL(triggered()), this, SLOT(onBackAction()), Qt::UniqueConnection);
+    // this is the case when viewer/editor is opened and contacts update takes
+    // place resulting in CV close, the view should directly come to CLV 
+    // bypassing the CV
+    if ((mCurrentView == MsgBaseView::UNIVIEWER 
+            && mPreviousView != MsgBaseView::UNIVIEWER)
+            || (mCurrentView == MsgBaseView::UNIEDITOR
+                    && mPreviousView != MsgBaseView::UNIEDITOR))
+    {
+        //dont do anything
+        //wait for the back from viewer/editor
+        //and reset the open CV id
+        mConversationId = -1;
+        return;
     }
+    
+    //delete UniEditor
+    if (mUniEditor)
+    {
+        appendViewToBeDeleted(mUniEditor);
+        mUniEditor = NULL;
+    }
+
+    //delete UniViewer
+    if (mUniViewer)
+    {
+        appendViewToBeDeleted(mUniViewer);
+        mUniViewer = NULL;
+    }
+
     if (mConversationView) {
+        mConversationView->saveContentToDrafts();
         //clearing content of cv.
         mConversationView->clearContent();
+        //reset the open CV id
+        mConversationId = -1;
     }
-
+    
+    //switch to CLV.
+    mCurrentView = MsgBaseView::CLV;
     if (!mListView) {
         mListView = new MsgListView();
         mListView->setNavigationAction(mBackAction);
@@ -452,19 +540,6 @@
         mMainWindow->addView(mListView);
     }
 
-    //delete uni editor.
-    if (mUniEditor) {
-        mMainWindow->removeView(mUniEditor);
-        delete mUniEditor;
-        mUniEditor = NULL;
-    }
-
-    if (mUniViewer) {
-        mMainWindow->removeView(mUniViewer);
-        delete mUniViewer;
-        mUniViewer = NULL;
-    }
-
     mMainWindow->setCurrentView(mListView);
 }
 
@@ -476,20 +551,28 @@
 
     // delete case from viewer service
     if (mViewServiceRequest && (mPreviousView == MsgBaseView::UNIVIEWER)) {
-        // quit the application 
+        // quit the application
         HbApplication::quit();
     }
 
-    //delete uni editor.
-    if (mUniEditor) {
-        mMainWindow->removeView(mUniEditor);
-        delete mUniEditor;
+    // delete Audio Fetcher view
+    if(mAudioFetcherView)
+    {
+        appendViewToBeDeleted(mAudioFetcherView);
+        mAudioFetcherView = NULL;
+    }
+
+    //delete UniEditor
+    if (mUniEditor)
+    {
+        appendViewToBeDeleted(mUniEditor);
         mUniEditor = NULL;
     }
 
-    if (mUniViewer) {
-        mMainWindow->removeView(mUniViewer);
-        delete mUniViewer;
+    //delete UniViewer
+    if (mUniViewer)
+    {
+        appendViewToBeDeleted(mUniViewer);
         mUniViewer = NULL;
     }
 
@@ -497,25 +580,35 @@
     qint64 conversationId;
     if (var.type() == QVariant::String) {
         QString phoneNumber = var.toString();
-        conversationId = findConversationId(phoneNumber);
+        qint32 contactId = findContactId(phoneNumber);
+        if (contactId != -1) {
+            conversationId = ConversationsEngine::instance()->getConversationIdFromContactId(contactId);
+        }
+        else {
+            conversationId = findConversationId(phoneNumber);
+        }
 
         if (conversationId == NULL_CONVERSATIONID) {
             QVariantList param;
             param << MsgBaseView::CLV;
             param << MsgBaseView::CV;
+
+            if( mCurrentView == MsgBaseView::CV && mConversationView){
+                mConversationView->setPSCVId(false);
+                }
+
             switchView(param);
             return;
         }
     }
     else if (var.type() == QVariant::Invalid) {
-        // this case comes when a message is deleted from 
-        // Unified viewer  set curent view as conversation view 
+        // this case comes when a message is deleted from
+        // Unified viewer  set curent view as conversation view
         // and return
         mMainWindow->setCurrentView(mConversationView);
 
-        delete mUniViewer;
-        mUniViewer = NULL;
-
+		// publish already opened conversation's id
+        mConversationView->setPSCVId(true);
         return;
     }
     else {
@@ -532,15 +625,15 @@
 
         mMainWindow->addView(mConversationView);
     }
+    else if (mConversationView->conversationId() != mConversationId){
+  		//Save content to drafts before switching to different CV
+        mConversationView->saveContentToDrafts();
+        //clearing content of current cv.
+        mConversationView->clearContent();
+    }
 
     mConversationView->openConversation(conversationId);
-
-    if (mServiceRequest) {
-        mMainWindow->setCurrentView(mConversationView);
-    }
-    else {
-        mMainWindow->setCurrentView(mConversationView);
-    }
+    mMainWindow->setCurrentView(mConversationView);
 }
 
 void MsgViewManager::switchToDlv(const QVariantList& data)
@@ -549,13 +642,6 @@
     mCurrentView = MsgBaseView::DLV;
     mPreviousView = data.at(1).toInt();
 
-    //delete uni editor.
-    if (mUniEditor) {
-        mMainWindow->removeView(mUniEditor);
-        delete mUniEditor;
-        mUniEditor = NULL;
-    }
-
     if (!mDraftsListView) {
         mDraftsListView = new DraftsListView();
         mDraftsListView->setNavigationAction(mBackAction);
@@ -573,18 +659,43 @@
      * Editor is tried to open again before exiting the previously
      * opened editor. Multi taping in DLV or Forward.
      */
-    if (mUniEditor) {
+    if (mUniEditor && !mAudioFetcherView)
+    {
         return;
     }
 
     mCurrentView = MsgBaseView::UNIEDITOR;
-    mPreviousView = data.at(1).toInt();
+    if(MsgBaseView::AUDIOFETCHER != data.at(1).toInt())
+    {
+        mPreviousView = data.at(1).toInt();
+    }
 
-    if (mConversationView) {
+    // delete Audio Fetcher view
+    if(mAudioFetcherView)
+    {
+        appendViewToBeDeleted(mAudioFetcherView);
+        mAudioFetcherView = NULL;
+    }
+
+    // delete UniViewer
+	if (mUniViewer )
+	{
+	    appendViewToBeDeleted(mUniViewer);
+	    mUniViewer = NULL;
+	}
+
+    if (mConversationView)
+    {
         //clearing content of cv.
         mConversationView->clearContent();
     }
 
+    // reset conversation id published
+    if(mPreviousView == MsgBaseView::CV && mConversationView)
+    {
+        mConversationView->setPSCVId(false);
+    }
+
     //swich to unieditor.
     if (!mUniEditor) {
         mUniEditor = new MsgUnifiedEditorView();
@@ -603,19 +714,15 @@
         }
 
         if (MsgBaseView::DLV == mPreviousView) {
-            mUniEditor->openDraftsMessage(editorData);
+            //Populate editor after view ready indication 
+            populateUniEditorAfterViewReady(editorData);
         }
         else {
             mUniEditor->populateContent(editorData);
         }
     }
 
-    if (mServiceRequest) {
-        mMainWindow->setCurrentView(mUniEditor);
-    }
-    else {
-        mMainWindow->setCurrentView(mUniEditor);
-    }
+    mMainWindow->setCurrentView(mUniEditor);
 }
 
 void MsgViewManager::switchToUniViewer(const QVariantList& data)
@@ -634,23 +741,25 @@
     //switch to univiewer.
     if (data.length() > 2) {
         qint32 contactId = data.at(2).toLongLong();
-        QByteArray dataArray = data.at(3).toByteArray();
+        qint32 messageId = data.at(3).toInt();
         int msgCount = data.at(4).toInt();
+        int canForwardMessage = data.at(5).toInt();
 
-        ConvergedMessage *message = new ConvergedMessage;
-        QDataStream stream(&dataArray, QIODevice::ReadOnly);
-        message->deserialize(stream);
-        qint32 messageId = message->id()->getId();
         if (!mUniViewer) {
-            mUniViewer = new UnifiedViewer(messageId);
+            mUniViewer = new UnifiedViewer(messageId, canForwardMessage);
             mUniViewer->setNavigationAction(mBackAction);
             mMainWindow->addView(mUniViewer);
             connect(mUniViewer, SIGNAL(switchView(const QVariantList&)), this,
                 SLOT(switchView(const QVariantList&)));
         }
         mUniViewer->populateContent(messageId, true, msgCount);
-        delete message;
     }
+
+    if(mPreviousView==MsgBaseView::CV && mConversationView)
+        {
+        mConversationView->setPSCVId(false);
+        }
+
     mMainWindow->setCurrentView(mUniViewer);
 }
 void MsgViewManager::switchToMsgSettings(const QVariantList& data)
@@ -659,11 +768,22 @@
     mPreviousView = data.at(1).toInt();
 
     if (!mSettingsView) {
-        mSettingsView = new MsgSettingsView();
+
+        MsgSettingsView::SettingsView view = MsgSettingsView::DefaultView;
+        if (mPreviousView == MsgBaseView::UNIEDITOR || mPreviousView
+                        == MsgBaseView::CV)
+                {
+                    view = (MsgSettingsView::SettingsView)data.at(2).toInt();
+                }
+
+        mSettingsView = new MsgSettingsView(view);
         mSettingsView->setNavigationAction(mBackAction);
         mMainWindow->addView(mSettingsView);
         mMainWindow->setCurrentView(mSettingsView);
     }
+    if(mPreviousView==MsgBaseView::CV && mConversationView){
+        mConversationView->setPSCVId(false);
+        }
 }
 
 void MsgViewManager::handleDefault(const QVariantList& data)
@@ -675,9 +795,9 @@
         mCurrentView = mPreviousView;
         mPreviousView = previousViewId;
         //remove the settings view from main window
-        if (mSettingsView) {
-            mMainWindow->removeView(mSettingsView);
-            delete mSettingsView;
+        if (mSettingsView)
+        {
+            appendViewToBeDeleted(mSettingsView);
             mSettingsView = NULL;
         }
         switch (mCurrentView) {
@@ -717,7 +837,7 @@
 {
     int msgType;
     int msgSubType;
-
+    mMessageId = msgId;
     qint32 messageId(msgId);
     ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType);
 
@@ -747,14 +867,9 @@
     default:
     {
         // for un supported message show delete option
-        bool result = HbMessageBox::question(LOC_DELETE_MESSAGE, LOC_BUTTON_DELETE,
-            LOC_BUTTON_CANCEL);
-        if (result) {
-            QList<int> msgIdList;
-            msgIdList << msgId;
-            ConversationsEngine::instance()->deleteMessages(msgIdList);
-        }
-        HbApplication::quit(); // exit after handling
+        HbMessageBox::question(LOC_DELETE_MESSAGE,this,
+                               SLOT(onDialogDeleteMsg(HbAction*)),
+                               HbMessageBox::Delete | HbMessageBox::Cancel);
         break;
     }
     }
@@ -788,29 +903,10 @@
 // ----------------------------------------------------------------------------
 void MsgViewManager::handleRingtoneMsg(int msgId)
 {
-    if (RingBc::askSaveQuery()) {
-        UniDataModelLoader* pluginLoader = new UniDataModelLoader();
-        UniDataModelPluginInterface* pluginInterface = pluginLoader->getDataModelPlugin(
-            ConvergedMessage::BioMsg);
-        pluginInterface->setMessageId(msgId);
-        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();
+    mMessageId = msgId;
+    HbMessageBox::question(LOC_DIALOG_SAVE_RINGTONE, this,
+                           SLOT(onDialogSaveTone(HbAction*)), 
+                           HbMessageBox::Save | HbMessageBox::Cancel);
 }
 
 // ----------------------------------------------------------------------------
@@ -844,3 +940,218 @@
     // close the application once its handled
     HbApplication::quit();
 }
+
+void MsgViewManager::setViewInteractive()
+{
+    if(!mMainWindow->isInteractive())
+    {
+        mMainWindow->setInteractive(true);
+    }
+
+    disconnect(mMainWindow, SIGNAL(viewReady()),this,SLOT(setViewInteractive()));
+}
+
+void  MsgViewManager::appendViewToBeDeleted(HbView* view)
+{
+    if (view)
+    {
+        mViewTobeDeleted << view;
+        connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(deletePreviousView()), Qt::UniqueConnection);
+    }
+}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::populateEditorAfterViewReady
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::populateUniEditorAfterViewReady(const QVariantList& editorData)
+	{
+	 //Save the editor data and use it in ViewReady handler
+	 mEditorData = editorData;	 
+	 connect(mMainWindow, SIGNAL(viewReady()), this, SLOT(populateUniEditorView()));
+	}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::populateUniEditorView
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::populateUniEditorView()
+    {
+    if (mUniEditor)
+        {
+        mUniEditor->openDraftsMessage(mEditorData);
+        }
+    mEditorData.clear();
+    
+    disconnect(mMainWindow, SIGNAL(viewReady()), this,
+            SLOT(populateUniEditorView()));
+}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::onDialogDeleteMsg
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::onDialogDeleteMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        QList<int> msgIdList;
+        msgIdList << mMessageId;
+        ConversationsEngine::instance()->deleteMessages(msgIdList);
+    }
+    HbApplication::quit(); // exit after handling
+}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::onDialogSaveTone
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::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();
+}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::currentView
+// @see header
+// ----------------------------------------------------------------------------
+int MsgViewManager::currentView()
+    {
+    return mCurrentView;
+    }
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::switchToAudioFetcher
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::switchToAudioFetcher(const QVariantList& data)
+    {
+    /**
+     * Audio Fetcher is tried to open again
+     */
+    if(mAudioFetcherView)
+        {
+        return;
+        }
+
+    //switch to Audio Fetcher view
+    mCurrentView = MsgBaseView::AUDIOFETCHER;
+    mPreviousView = data.at(1).toInt();
+    QVariantList editorData;
+    // i=2 because view manager consumed first two args
+    for (int i = 2; i < data.length(); i++) {
+        editorData << data.at(i);
+    }
+    mAudioFetcherView = new MsgAudioFetcherView(editorData);
+    mAudioFetcherView->setNavigationAction(mBackAction);
+    connect(mAudioFetcherView, SIGNAL(switchView(const QVariantList&)), this,
+            SLOT(switchView(const QVariantList&)));
+
+    if(mPreviousView==MsgBaseView::CV && mConversationView)
+        {
+        mConversationView->setPSCVId(false);
+        }
+
+    mMainWindow->addView(mAudioFetcherView);
+    mMainWindow->setCurrentView(mAudioFetcherView);
+    }
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::saveContentToDraft
+// @see header
+// ----------------------------------------------------------------------------
+int MsgViewManager::saveContentToDraft()
+    {
+    int msgId = NULL_CONVERSATIONID;
+    if( mCurrentView == MsgBaseView::CV )
+        {
+        msgId = mConversationView->saveContentToDrafts();
+        }
+    else if( mCurrentView ==MsgBaseView::UNIEDITOR)
+        {
+        msgId  = mUniEditor->saveContentToDrafts();
+        }
+    return msgId;
+    }
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::saveContentToDraft
+// @see header
+// ----------------------------------------------------------------------------
+void MsgViewManager::openUniEditorActivity(int activityMsgId)
+{
+    int msgType;
+    int msgSubType;
+  
+    qint32 messageId(activityMsgId);
+    // get the message type
+    ConversationsEngine::instance()->markAsReadAndGetType(messageId, msgType, msgSubType);
+    
+    if (!mUniEditor) {
+           mUniEditor = new MsgUnifiedEditorView();
+           mMainWindow->addView(mUniEditor);
+           mUniEditor->setNavigationAction(mBackAction);
+           connect(mUniEditor, SIGNAL(switchView(const QVariantList&)), this,
+               SLOT(switchView(const QVariantList&)));
+       }
+    
+    // buffer data to open the draft message
+    ConvergedMessageId convergedMsgId(activityMsgId);
+    ConvergedMessage message;
+    message.setMessageType((ConvergedMessage::MessageType) msgType);
+    message.setMessageId(convergedMsgId);
+
+    // Launch uni-editor view
+    QByteArray dataArray;
+    QDataStream messageStream(&dataArray, QIODevice::WriteOnly | QIODevice::Append);
+    message.serialize(messageStream);
+    
+    QVariantList editorData;
+    editorData << dataArray;
+    mUniEditor->openDraftsMessage(editorData);
+    
+    // set the current view
+    mCurrentView = MsgBaseView::UNIEDITOR;
+    mMainWindow->setCurrentView(mUniEditor);
+}
+
+// ----------------------------------------------------------------------------
+// MsgViewManager::findContactId
+// @see header
+// ----------------------------------------------------------------------------
+qint32 MsgViewManager::findContactId(QString address)
+    {
+    QString displayLabel;
+    int count;
+    int localId =
+            MsgContactHandler::resolveContactDisplayName(address,
+                                                         displayLabel,
+                                                         count);
+
+        return localId;
+    }
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetchermodel.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The header file for messaging's audio fetcher model
+ *     
+ */
+
+#ifndef MSGAUDIOFETCHERMODEL_H
+#define MSGAUDIOFETCHERMODEL_H
+
+// SYSTEM INCLUDES
+#include <QStandardItemModel>
+#include <QStringList>
+#include <QDir>
+
+// FORWARD DECLARATIONS
+class MsgAudioSelectionEngine;
+
+/**
+ * @class MsgAudioFetcherModel
+ * @brief This class is messaging's audio fetcher model
+ */
+class MsgAudioFetcherModel : public QStandardItemModel
+{
+Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    explicit MsgAudioFetcherModel(QObject *parent);
+
+    /**
+     * Destructor
+     */
+    virtual ~MsgAudioFetcherModel();
+
+    /**
+     * Clears model
+     */
+    void clearAll();
+    
+    /**
+     * adds a row into the model
+     */
+    void addRow(QString filepath);
+
+public: //from QAbstractItemModel
+    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
+
+private:
+    /**
+     * binary search (ascendant) for the correct index to insert.
+     * @param low the start of search
+     * @param high the end of search.
+     * @return the correct index
+     */
+    int insertIndex(int low, int high, QString variant);
+
+    /**
+     * Add audio files into the model
+     * @param toneDir, Dir from which to get audio files to add to model
+     */
+    void addToneFiles(QDir& toneDir);
+    
+    /**
+     * Finds and adds audio files into the model
+     */
+    void getRomToneFiles();
+
+    /**
+     * Initialize the model
+     */
+    void init();
+    
+    /**
+     * checks if the given file is DRM protected
+     * @param filepath, path of audio file
+     */
+    bool isDRM(QString filepath);
+
+private slots:
+    /**
+     * Handle MDS session open
+     */
+    void mdeSessionOpened();
+
+    /**
+     * Handle MDS session open error
+     */
+    void mdeSessionError(int error);
+    
+    /**
+     * Handle MDS query complete
+     */
+    void queryComplete(const QStringList &nameList,
+            const QStringList &uriList);
+
+    /**
+     * Handle MDS query error
+     */
+    void queryError(int error);
+
+    /**
+     * Handle object observer callback
+     */
+    void onObjectChanged();
+
+private:
+    /**
+     * audio selection engine
+     */
+    MsgAudioSelectionEngine* mSelectionEngine;
+};
+
+#endif /* MsgAudioFetcherModel_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The header file for messaging's audio fetcher view.
+ *
+ */
+
+#ifndef MSGAUDIOFETCHERVIEW_H
+#define MSGAUDIOFETCHERVIEW_H
+
+#ifdef BUILD_MSGAUDIOFETCHER_DLL
+#define MSGAUDIOFETCHER_DLL_EXPORT Q_DECL_EXPORT
+#else
+#define MSGAUDIOFETCHER_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+// SYSTEM INCLUDES
+#include <QObject>
+#include <hblistwidget.h>
+
+// USER INCLUDES
+#include "msgbaseview.h"
+#include "convergedmessage.h"
+
+// FORWARD DECLARATIONS
+class MsgAudioFetcherWidget;
+class HbAction;
+
+/**
+ * @class MsgAudioFetcherView
+ * @brief This class is messaging's audio fetcher view
+ */
+class MSGAUDIOFETCHER_DLL_EXPORT MsgAudioFetcherView : public MsgBaseView
+{
+Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    explicit MsgAudioFetcherView(const QVariantList& data);
+
+    /**
+     * Destructor
+     */
+    ~MsgAudioFetcherView();
+private:
+    /**
+     * Creates a widget and sets it to the view
+     */
+    void initMainWidget();
+
+    /**
+     * Initializes view's toolbar actions
+     */
+    void initToolBar();
+
+    /**
+     * tool bar actions must to be removed in case the app crashes.
+     */
+    void removeToolBarAction();
+
+private slots:
+    /**
+     * Handles toolbar's leftaction (play/pause)
+     */
+    void on_leftAction_triggered();
+
+    /**
+     * Handles toolbar's rightaction (select)
+     */
+    void on_rightAction_triggered();
+
+    /**
+     * enable toolbar actions, only when an item is selected
+     */
+    void enableToolBar(bool enable);
+
+private:
+    /**
+     * view's main widget
+     */
+    MsgAudioFetcherWidget *mWidget;
+    
+    /**
+     * Toolbar's left action
+     */
+    HbAction *mToolBarLeftAction;
+
+    /**
+     * Toolbar's right action
+     */
+    HbAction *mToolBarRightAction;
+    
+    /**
+     * Converged Message object
+     * owned
+     */
+    ConvergedMessage* message;
+};
+
+#endif /* MSGAUDIOFETCHERVIEW_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiofetcherwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The header file for messaging's audio fetcher widget.
+ *
+ */
+#ifndef MSGAUDIOFETCHERWIDGET_H
+#define MSGAUDIOFETCHERWIDGET_H
+
+// SYSTEM INCLUDES
+#include <HbWidget>
+
+// USER INCLUDES
+class HbListView;
+class QGraphicsLinearLayout;
+class MsgAudioFetcherView;
+class MsgAudioFetcherModel;
+class HbLabel;
+class MsgAudioPreview;
+
+/**
+ * @class MsgAudioFetcherWidget
+ * @brief This class is messaging's audio fetcher view's mainwidget
+ */
+class MsgAudioFetcherWidget : public HbWidget
+{
+Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    explicit MsgAudioFetcherWidget();
+
+    /**
+     * Destructor
+     */
+    ~MsgAudioFetcherWidget();
+
+    /**
+     * Get the path of item selected in the list
+     */
+    QString getCurrentItemPath();
+
+    /**
+     * Play or pause the audio file
+     */
+    void playOrPause();
+
+signals:
+    /**
+     * Signal to enable/disable the toolbar
+     */
+    void triggerToolBar(bool enable);
+
+private slots:
+    /**
+     * Handles selection of a list item
+     */
+    void on_list_activated(const QModelIndex &index);
+private:
+    /**
+     * initializes widget
+     */
+    void init();
+    
+private:
+    /**
+     * label of the list view
+     * owned
+     */
+    HbLabel *mLabel;
+    
+    /**
+     * list view
+     * owned
+     */
+    HbListView *mListView;
+    
+    /**
+     * list's layout
+     * owned
+     */
+    QGraphicsLinearLayout *mLayout;
+    
+    /**
+     * populating model
+     * owned
+     */
+    MsgAudioFetcherModel *mFetcherModel;
+
+    /**
+     * For previewing audio files
+     * owned
+     */
+    MsgAudioPreview* mAudioPreview;
+    
+    /**
+     * selection state
+     */
+    bool mSelected;
+    
+    /**
+     * last selected item
+     */
+    QModelIndex mOldSeletedItem;
+};
+
+#endif /* MSGAUDIOFETCHERWIDGET_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudiopreview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The header file for tone previewing.
+ *     
+ */
+
+#ifndef MSGAUDIOPPREVIEW_H
+#define MSGAUDIOPPREVIEW_H
+
+#include <e32base.h>
+#include <DrmAudioSamplePlayer.h>
+#include <mdaaudiotoneplayer.h>
+#include <videoplayer.h>
+#include <centralrepository.h>
+#include <apgcli.h>  // for RApaLsSession
+#include <e32property.h>
+#include <QObject>
+
+class C3DRingingToneInterface;
+class RWindow;
+
+/**
+ * CMFPreviewHandlerBase
+ *
+ * Base class for CMFAudioPreviewHandler.
+ */
+class CMFPreviewHandlerBase: public QObject, public CBase
+
+{
+Q_OBJECT
+public:
+
+    enum TMediaFileType
+    {
+        EMediaFileTypeAudio = 0, EMediaFileTypeVideo
+    };
+    enum TPlayerStatus
+    {
+        EPlayerNotCreated,
+        EPlayerInitializing,
+        EPlayerReady,
+        EPlayerPlaying,
+        EPlayerInitialized,
+        EPlayerPlayingWith3DEffect
+    };
+
+    // these must match with the ones in Profile Engine
+    enum TRingingTypes
+    {
+        ERingingTypeRinging = 0,
+        ERingingTypeAscending,
+        ERingingTypeRingOnce,
+        ERingingTypeBeepOnce,
+        ERingingTypeSilent
+    };
+
+    enum TFLAllowScreenSaver
+    {
+        EFLScreenSaverAllowed = 0, EFLScreenSaverNotAllowed
+    };
+
+protected:
+
+    virtual ~CMFPreviewHandlerBase();
+
+protected:
+
+    /**
+     * C++ default constructor.
+     */
+    CMFPreviewHandlerBase(QObject *parent);
+
+    /**
+     * By default Symbian OS constructor is private.
+     */
+    void ConstructL();
+
+public:
+    void SetAttr(const QString &file);
+    TInt Attr(TInt aAttr);
+    virtual void Play() = 0;
+    virtual void Stop() = 0;
+    virtual TBool IsPlaying() = 0;
+    QString normalizeSeperator(const QString &path);
+protected:
+    TInt ConvertVolume(TInt aVolume);
+    void ReadActiveProfileL();
+    TInt GetDataType(const TDesC& aFileName, TDataType& aDataType);
+    void ReadDefaultToneL();
+
+    void DisableBackLight();
+
+    static TInt DoResetInactivityTimer(TAny* aObject);
+protected:
+    TInt RingingVolume();
+    TInt RingingType();
+    TInt Vibra();
+    TInt Echo3D();
+    TInt Effect3D();
+
+protected:
+    static TInt ConvertVolume(TInt aVolume, TInt aMaxVolume);
+
+protected:
+    TInt iRingingVolume;
+    TInt iRingingType;
+    TInt iVibra;
+    TInt i3DEffect;
+    TInt i3DEcho;
+    TInt iMediaType;
+    TInt iFileSize;
+    HBufC* iFullName;
+
+    TBool iActiveProfileRead;
+    TInt iActiveProfileRingingVolume;
+    TInt iActiveProfileRingingType;
+    TInt iActiveProfileVibra;
+    TInt iActiveProfile3DEffect;
+    TInt iActiveProfile3DEcho;
+
+    TInt iPlayerStatus;
+
+    // handle to window
+    RWindow* iWindow; // does not own
+
+    // for getting file MIME types
+    RApaLsSession iApaSession;
+
+    // for setting screensaver on/off
+    RProperty iProperty;
+
+    // default ringing tone
+    TFileName iDefaultTone;
+
+    /**
+     * Timer for resetting the user inactivity timeout
+     */
+    CPeriodic* iBacklightTimer;
+};
+
+// CLASS DECLARATION
+/**
+ *  This class is used for previewing the tones.
+ *
+ */
+
+class MsgAudioPreview: public CMFPreviewHandlerBase,
+    public MDrmAudioPlayerCallback,
+    public MMdaAudioToneObserver
+
+{
+Q_OBJECT
+public:
+    MsgAudioPreview(QObject *parent);
+    virtual ~MsgAudioPreview();
+signals:
+   // void notifyPreviewEvent(ToneFetcherEngine::TPreviewEvent event, int errorId);
+
+public:
+    void Play();
+    void Stop();
+    TBool IsPlaying();
+
+private:
+    void Cancel();
+    void SetAudioRingingType(TInt aRingingType);
+    void SetToneRingingType(TInt aRingingType);
+    TInt ConvertVolume(TInt aVolume);
+    void PlayL();
+
+private:
+    // from MMdaAudioToneObserver
+    virtual void MatoPrepareComplete(TInt aError);
+    virtual void MatoPlayComplete(TInt aError);
+
+private:
+    // from MDrmAudioPlayerCallback
+    void MdapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration);
+    void MdapcPlayComplete(TInt aError);
+
+private:
+    // audio player
+    CDrmPlayerUtility* iAudioPlayer;
+
+    /// Audioplayer status
+    TPlayerStatus iAudioPlayerStatus;
+
+    /// toneplayer
+    CMdaAudioToneUtility* iTonePlayer;
+
+    /// Toneplayer status
+    TPlayerStatus iTonePlayerStatus;
+
+    // plugin for playing 3D effects
+    C3DRingingToneInterface* i3dRingingTonePlugin;
+
+};
+
+#endif /* MSGAUDIOPPREVIEW_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/inc/msgaudioselectionengine.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The header file for mde tone fetcher.
+ *
+ */
+#ifndef MSGAUDIOSELECTIONENGINE_H
+#define MSGAUDIOSELECTIONENGINE_H
+
+// SYSTEM INCLUDES
+#include <mdesession.h>
+#include <mdequery.h>
+#include <mdelogiccondition.h>
+#include <mdeconstants.h>
+#include <mdeobjectquery.h>
+#include <mdccommon.h>
+#include <mdeitem.h>
+#include <mdeobject.h>
+#include <e32base.h>
+#include <QObject>
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+
+/**
+ *  This class is used for quering tones from mde.
+ */
+class MsgAudioSelectionEngine : public QObject,
+        public CBase,
+        public MMdESessionObserver,
+        public MMdEQueryObserver,
+        public MMdEObjectObserver,
+        public MMdEObjectPresentObserver
+{
+Q_OBJECT
+
+public:
+
+    enum TStorageType
+        {
+        EPhoneMemory = 0, ERomStorage, EMassStorage, EMemoryCard
+        };
+
+    enum TQueryAttribute
+        {
+        EAttrMediaType = 20, // integer
+        EAttrFileSize, // integer
+        EAttrStorageType, // integer
+        EAttrMediaFileId, // integer
+        EAttrFileName, // string
+        EAttrFullName, // string
+        EAttrSongName, // string
+        EAttrArtist, // string
+        EAttrAlbum, // string
+        EAttrGenre, // string
+        EAttrComposer
+        // string
+        };
+
+public:
+    MsgAudioSelectionEngine();
+    virtual ~MsgAudioSelectionEngine();
+    void CreateMetaDataSession();
+signals:
+    void mdeSessionOpened();
+    void mdeSessionError(int error);
+    void queryComplete(QStringList nameList, QStringList uriList);
+    void queryError(int error);
+    void notifyObjectChanged();
+
+public:
+    static CMdEPropertyDef& PropertyDefL(CMdESession* aSession, TInt aAttr);
+    void QueryTones();
+    void SetAttr(int attr, int value);
+
+private:
+    void LeaveIfSessionClosedL();
+    CMdEPropertyDef& PropertyDefL(TInt aAttr);
+    void QueryTonesL();
+    void HandleQueryCompletedL(CMdEQuery& aQuery, TInt aError);
+
+private:
+    // from MMdESessionObserver
+    void HandleSessionOpened(CMdESession& aSession, TInt aError);
+    void HandleSessionError(CMdESession& aSession, TInt aError);
+
+private:
+    // from MMdEQueryObserver (mdequery.h)
+    void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex,
+            TInt aNewItemCount);
+    void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+private:
+    // from MMdEObjectObserver
+    void HandleObjectNotification(CMdESession& aSession,
+            TObserverNotificationType aType,
+            const RArray<TItemId>& aObjectIdArray);
+
+private:
+    // from MMdEObjectPresentObserver
+    void HandleObjectPresentNotification(CMdESession& aSession,
+            TBool aPresent, const RArray<TItemId>& aObjectIdArray);
+    void AddObjectObserverL();
+private:
+
+
+    // session to metadata engine
+    CMdESession* iSession;
+
+    // metadata query
+    CMdEObjectQuery* iQuery;
+
+    // used for saving the quering result.
+    //both name and uri.
+    QStringList iNameList;
+    QStringList iUriList;
+
+    // is metadata session open
+    TBool iSessionOpen;
+
+    // max audio file file size
+    TInt iMaxFileSize;
+
+    // query error
+    TInt iQueryError;
+};
+#endif /* MSGAUDIOSELECTIONENGINE_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/msgaudiofetcher.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,81 @@
+#
+# 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:
+#
+
+TEMPLATE = lib
+TARGET = msgaudiofetcher
+DEFINES += BUILD_MSGAUDIOFETCHER_DLL
+
+DEPENDPATH += . \
+    inc \
+    src
+
+INCLUDEPATH += ../inc
+INCLUDEPATH += ../../../inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+CONFIG += hb
+
+TARGET.UID3 = 0x2001FE67
+TARGET.CAPABILITY = All -TCB
+TARGET.EPOCALLOWDLLDATA = 1
+
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW \
+    ARMV5
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
+    "rom/msgaudiofetcher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msgaudiofetcher.iby)"
+
+# Input
+HEADERS += msgaudioselectionengine.h \
+           msgaudiofetchermodel.h \
+           msgaudiofetcherwidget.h \
+           msgaudiofetcherview.h \
+           msgaudiopreview.h \
+           ../inc/msgbaseview.h
+           
+SOURCES += msgaudioselectionengine.cpp \
+           msgaudiofetchermodel.cpp \
+           msgaudiofetcherwidget.cpp \
+           msgaudiofetcherview.cpp \
+           msgaudiopreview.cpp
+
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/msgaudiofetcher.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/msgaudiofetcher.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
+# Libs
+LIBS += -lconvergedmessageutils \
+        -lxqutils \
+        -lmdeclient \
+        -lcentralrepository \
+        -lProfileEng \
+        -lmediaclientaudio \
+        -lDrmAudioPlayUtility \
+        -lDRMCommon \
+        -lDrmRights \
+        -lDrmHelper \
+        -ldrmutility \
+        -lapmime \
+        -lecom \
+        -lxqservice \
+        -lapgrfx
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/rom/msgaudiofetcher.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,23 @@
+/*
+* 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:
+*
+*/
+#ifndef __MSGAUDIOFETCHER_IBY__
+#define __MSGAUDIOFETCHER_IBY__
+
+REM DLL
+file=ABI_DIR\UREL\msgaudiofetcher.dll                   SHARED_LIB_DIR\msgaudiofetcher.dll
+
+#endif // __MSGAUDIOFETCHER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetchermodel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The source file for messaging's audio fetcher model
+ */
+
+// SYSTEM INCLUDES
+#include <xqutils.h>
+#include <xqappmgr.h>
+
+// USER INCLUDES
+#include "msgaudiofetchermodel.h"
+#include "msgaudioselectionengine.h"
+
+MsgAudioFetcherModel::MsgAudioFetcherModel(QObject *parent) :
+    QStandardItemModel(parent), mSelectionEngine(0)
+{
+    init();   
+}
+
+MsgAudioFetcherModel::~MsgAudioFetcherModel()
+{
+    delete mSelectionEngine;
+}
+
+void MsgAudioFetcherModel::init()
+{
+    mSelectionEngine = new MsgAudioSelectionEngine();
+
+    connect(mSelectionEngine, SIGNAL(mdeSessionOpened()), this, SLOT(mdeSessionOpened()));
+    connect(mSelectionEngine, SIGNAL(mdeSessionError(int)), this, SLOT(mdeSessionError(int)));
+    connect(mSelectionEngine, SIGNAL(queryComplete(QStringList, QStringList)), this,
+        SLOT(queryComplete(QStringList, QStringList)));
+    connect(mSelectionEngine, SIGNAL(queryError(int)), this, SLOT(queryError(int)));
+
+    connect(mSelectionEngine, SIGNAL(notifyObjectChanged()), this, SLOT(onObjectChanged()));
+    mSelectionEngine->CreateMetaDataSession();
+}
+
+void MsgAudioFetcherModel::getRomToneFiles()
+{
+    // z:\data\sounds\digital
+    QDir digitalsoundPath(XQUtils::romRootPath() + XQUtils::digitalSoundsPath());
+    addToneFiles(digitalsoundPath);
+
+    //z:\data\sounds\simple
+    QDir simpleSoundPath(XQUtils::romRootPath() + XQUtils::simpleSoundsPath());
+    addToneFiles(simpleSoundPath);
+
+    //z:\data\sounds
+    QDir soundPath(XQUtils::romRootPath() + XQUtils::soundsPath());
+    addToneFiles(soundPath);
+}
+
+void MsgAudioFetcherModel::addToneFiles(QDir& toneDir)
+{
+    // List only xx.amr files
+    QStringList filters;
+    filters << "*.amr";
+    toneDir.setNameFilters(filters);
+
+    QStringList soundList = toneDir.entryList();
+    for (int i = 0; i < soundList.size(); ++i) {
+        QString fullPath = QDir::toNativeSeparators(toneDir.absolutePath());
+        fullPath.append(QDir::separator());
+        fullPath.append(soundList.at(i));
+        addRow(fullPath);
+    }
+}
+
+QVariant MsgAudioFetcherModel::data(const QModelIndex &index, int role) const
+{
+    return QStandardItemModel::data(index, role);
+}
+
+void MsgAudioFetcherModel::addRow(QString filepath)
+{
+    if(isDRM(filepath))
+    {
+        // don't insert DRM protected files, as sending itself
+        // is not allowed in 'Restricted Mode'
+        return;
+    }
+
+    QFileInfo fInfo(filepath);
+    QStandardItem* item = new QStandardItem();
+    QString filename = fInfo.baseName();
+    item->setData(filename, Qt::DisplayRole);
+    item->setData(filepath, Qt::UserRole);
+
+    // get insert index
+    int index = this->insertIndex(0, rowCount(), filename);
+    insertRow(index, item);
+}
+
+int MsgAudioFetcherModel::insertIndex(int low, int high, QString value)
+{
+    if (low == high) {
+        return low;
+    }
+    int middle = (low + high - 1) / 2;
+    QModelIndex lowItemIndex = ((QStandardItemModel *) this)->index(low, 0);
+    QModelIndex highItemIndex = ((QStandardItemModel *) this)->index(high - 1, 0);
+    QModelIndex middleItemIndex = ((QStandardItemModel *) this)->index(middle, 0);
+    QString lowString = data(lowItemIndex).toString();
+    QString highString = data(highItemIndex).toString();
+    QString middleString = data(middleItemIndex).toString();
+
+    if (value >= highString) {
+        return high;
+    }
+    if (value < lowString) {
+        return low;
+    }
+    high = high - 1;
+    while (low < high) {
+        middle = (low + high) / 2;
+        middleItemIndex = ((QStandardItemModel *) this)->index(middle, 0);
+        middleString = data(middleItemIndex).toString();
+        if (value >= middleString) {
+            low = middle + 1;
+        }
+        else {
+            high = middle;
+        }
+    }
+    return low;
+}
+
+void MsgAudioFetcherModel::clearAll()
+{    
+    QStandardItemModel::clear();
+}
+
+void MsgAudioFetcherModel::mdeSessionOpened()
+{
+    mSelectionEngine->QueryTones();
+    getRomToneFiles();
+}
+
+void MsgAudioFetcherModel::queryComplete(const QStringList &nameList, const QStringList &uriList)
+{
+    for (int i = 0; i < nameList.size(); ++i) {
+        addRow(uriList.at(i));
+    }
+}
+
+void MsgAudioFetcherModel::queryError(int error)
+{
+    Q_UNUSED(error);        
+}
+
+void MsgAudioFetcherModel::mdeSessionError(int error)
+{
+    Q_UNUSED(error);
+}
+
+void MsgAudioFetcherModel::onObjectChanged()
+{
+    clearAll();
+    getRomToneFiles();
+    mSelectionEngine->QueryTones();
+}
+
+bool MsgAudioFetcherModel::isDRM(QString filepath)
+{
+    QList<int> attrNames;
+    attrNames.append(XQApplicationManager::IsProtected);
+    
+    QFile file(filepath);
+    QVariantList attrValues;
+    XQApplicationManager appmgr;
+    bool ok = appmgr.getDrmAttributes(file, attrNames, attrValues);
+    if(!ok)
+    {
+        return true;
+    }
+    return (0 < attrValues.at(0).toInt());
+}
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The source file for messaging's audio fetcher view.
+ *
+ */
+
+// SYSTEM INCLUDES
+#include <hbaction.h>
+#include <hbtoolbar.h>
+
+// USER INCLUDES
+#include "msgaudiofetcherview.h"
+#include "msgaudiofetcherwidget.h"
+#include "convergedmessage.h"
+
+MsgAudioFetcherView::MsgAudioFetcherView(const QVariantList& data) :
+message(NULL)
+{
+    message = new ConvergedMessage;
+    if(data.length() > 0)
+    {
+        QByteArray dataArray = data.at(0).toByteArray();
+        QDataStream stream(&dataArray, QIODevice::ReadOnly);
+        message->deserialize(stream);
+    }
+    initToolBar();
+    initMainWidget();
+    QMetaObject::connectSlotsByName(this);
+}
+
+MsgAudioFetcherView::~MsgAudioFetcherView()
+{
+    if(message != NULL)
+    {
+        delete message;
+        message = NULL;
+    }
+    removeToolBarAction();
+}
+
+void MsgAudioFetcherView::initMainWidget()
+{
+    mWidget = new MsgAudioFetcherWidget();
+    Q_ASSERT(mWidget);
+    setWidget(mWidget);
+    connect(mWidget, SIGNAL(triggerToolBar(bool)), this, SLOT(enableToolBar(bool)));
+}
+
+void MsgAudioFetcherView::initToolBar()
+{
+    mToolBarLeftAction = new HbAction(this);
+    mToolBarLeftAction->setObjectName("leftAction");
+    //TODO: need localized string
+    mToolBarLeftAction->setText(hbTrId("Play/Pause"));
+    toolBar()->addAction(mToolBarLeftAction);
+    mToolBarLeftAction->setEnabled(false);
+
+    mToolBarRightAction = new HbAction(this);
+    mToolBarRightAction->setObjectName("rightAction");
+    //TODO: need localized string
+    mToolBarRightAction->setText(hbTrId("Select"));
+    mToolBarRightAction->setEnabled(false);
+    toolBar()->addAction(mToolBarRightAction);
+
+    toolBar()->setOrientation(Qt::Horizontal);
+    toolBar()->setEnabled(false);
+}
+
+void MsgAudioFetcherView::removeToolBarAction()
+{
+    toolBar()->removeAction(mToolBarRightAction);
+    toolBar()->removeAction(mToolBarLeftAction);
+}
+
+void MsgAudioFetcherView::on_leftAction_triggered()
+{
+    mWidget->playOrPause();
+}
+
+void MsgAudioFetcherView::on_rightAction_triggered()
+{    
+    // param list for switching to editor view
+    QVariantList params;
+    QByteArray dataArray;
+    QDataStream messageStream
+    (&dataArray, QIODevice::WriteOnly | QIODevice::Append);
+
+    QString filepath(mWidget->getCurrentItemPath());
+    ConvergedMessageAttachment* attachment =
+            new ConvergedMessageAttachment(filepath);
+    ConvergedMessageAttachmentList attachmentList;
+    attachmentList.append(attachment);
+    message->addAttachments(attachmentList);
+    
+    message->serialize(messageStream);
+    params << MsgBaseView::UNIEDITOR;
+    params << MsgBaseView::AUDIOFETCHER;
+    params << dataArray;
+    params << MsgBaseView::ADD_AUDIO;
+    emit switchView(params);
+}
+
+void MsgAudioFetcherView::enableToolBar(bool enable)
+{
+    mToolBarRightAction->setEnabled(enable);
+    mToolBarLeftAction->setEnabled(enable);
+    toolBar()->setEnabled(enable);
+}
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiofetcherwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,140 @@
+/*
+ * 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:
+ *     The source file for messaging's audio fetcher widget.
+ *
+ */
+
+// SYSTEM INCLUDES
+#include <HbListView>
+#include <QModelIndex>
+#include <QGraphicsLinearLayout>
+#include <QStandardItemModel>
+#include <HbLabel>
+
+// USER INCLUDES
+#include "msgaudiofetcherwidget.h"
+#include "msgaudiofetchermodel.h"
+#include "msgaudiopreview.h"
+
+// LOCALIZED CONSTANTS
+#define LOC_SELECT_SOUND  hbTrId("txt_messaging_title_select_a_sound")
+
+
+MsgAudioFetcherWidget::MsgAudioFetcherWidget()
+    : HbWidget(this),
+      mLabel(0),
+      mListView(0),
+      mLayout(0),
+      mFetcherModel(0),
+      mAudioPreview(0),
+      mSelected(false)
+{
+    init();
+}
+
+MsgAudioFetcherWidget::~MsgAudioFetcherWidget()
+{
+}
+
+QString MsgAudioFetcherWidget::getCurrentItemPath()
+{
+    QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes();
+    if(modelIndexList.count() > 0)
+    {
+        QModelIndex index = modelIndexList.at(0);
+        QString temppath = 
+                mFetcherModel->data(index, Qt::UserRole).toString();
+        return QDir::toNativeSeparators(temppath);
+    }
+    return QString();
+}
+
+void MsgAudioFetcherWidget::playOrPause()
+{
+    mAudioPreview->SetAttr(getCurrentItemPath());
+    mAudioPreview->Play();
+}
+
+void MsgAudioFetcherWidget::on_list_activated(const QModelIndex &index)
+{
+    QModelIndexList modelIndexList = mListView->selectionModel()->selectedIndexes();
+
+    //stop previewing when clicking another item.
+    if (mAudioPreview->IsPlaying()) {
+        mAudioPreview->SetAttr(getCurrentItemPath());
+            mAudioPreview->Play();
+        
+    }
+
+    /*
+     * when one item is selected, reselecting it will deselect it. selecting another
+     * will also deselect it, while the other is selected.
+     */
+    if(mSelected)
+    {
+        if(mOldSeletedItem != index)
+        {
+            mListView->selectionModel()->select(index, QItemSelectionModel::Select);
+            mOldSeletedItem = index;
+            emit triggerToolBar(true);
+        }
+        else
+        {
+            mListView->selectionModel()->select(index, QItemSelectionModel::Deselect);
+            mSelected = false;
+            emit triggerToolBar(false);
+        }
+        return;
+    }
+
+    if(modelIndexList.count() > 0)
+    {
+		QModelIndexList::const_iterator it;
+        for(it=modelIndexList.begin(); it!=modelIndexList.end(); ++it)
+        {
+            if((*it) == index)
+            {
+                mSelected = true;
+                mOldSeletedItem = index;
+                emit triggerToolBar(true);
+            }
+        }
+    }
+}
+
+void MsgAudioFetcherWidget::init()
+{
+    mLayout = new QGraphicsLinearLayout(this);
+    mLayout->setOrientation(Qt::Vertical);
+    setLayout(mLayout);
+
+    mLabel = new HbLabel(this);
+    // TODO: need localized string
+    mLabel->setPlainText(LOC_SELECT_SOUND);
+    mLayout->addItem(mLabel);
+
+    mListView = new HbListView(this);
+    mListView->setObjectName("list");
+    mLayout->addItem(mListView);
+    mListView->setSelectionMode(HbAbstractItemView::SingleSelection);
+
+    mFetcherModel = new MsgAudioFetcherModel(this);
+    mListView->setModel(mFetcherModel);
+    connect(mListView, SIGNAL(activated(QModelIndex)),
+        this, SLOT(on_list_activated(QModelIndex)));
+    mAudioPreview = new MsgAudioPreview(this);
+}
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudiopreview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,629 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The source file for tone previewing.
+ *     
+ */
+#include "msgaudiopreview.h"
+#include <AudioPreference.h>             // KAudioPriorityPreview
+#include <c3dringingtoneinterface.h>     // C3DRingingToneInterface
+#include <ctsydomainpskeys.h>            // for phone call states
+#include <MProfileEngine.h>
+#include <MProfile.h>
+#include <MProfileTones.h>
+#include "TProfileToneSettings.h"
+#include <MProfileExtraSettings.h>
+#include <MProfile3DToneSettings.h>
+#include <ProfileInternal.hrh>
+#include <ProfileEngineDomainCRKeys.h>   // KProEngDefaultRingingTone
+#include <XQConversions>
+#include <QChar>
+#include <QDir>
+
+
+CMFPreviewHandlerBase::CMFPreviewHandlerBase( QObject *parent  ) : QObject( parent )
+    {
+    iMediaType = KErrNotFound;
+    iRingingVolume = KErrNotFound;
+    iRingingType = KErrNotFound;
+    iVibra = KErrNotFound;
+    i3DEffect = KErrNotFound;
+    i3DEcho = KErrNotFound;
+    iFileSize = KErrNotFound;    
+    iFullName = 0;    
+    iActiveProfileRead = EFalse;
+    iPlayerStatus = EPlayerNotCreated;
+
+    }
+
+void CMFPreviewHandlerBase::ConstructL()
+    {
+    // To allow/not allow screensaver
+    // Errors ignored, no actions needed if API is not available
+    //iProperty.Attach( KPSUidScreenSaver, KScreenSaverAllowScreenSaver );    
+    TRAP_IGNORE(User::LeaveIfError( iApaSession.Connect() ) );
+    
+    TRAP_IGNORE( ReadDefaultToneL() );
+    // To keep backlight on while a video is being previewed
+    iBacklightTimer = CPeriodic::NewL( EPriorityLow );
+    }
+
+CMFPreviewHandlerBase::~CMFPreviewHandlerBase()
+    {
+    delete iFullName;
+    iProperty.Close();
+    iApaSession.Close();
+    }
+
+void CMFPreviewHandlerBase::SetAttr(const QString &file )
+    {
+    if ( !file.isNull() )
+        {
+        QString path = normalizeSeperator(file);
+        delete iFullName;
+        iFullName = 0;
+        iFullName = XQConversions::qStringToS60Desc( path );         
+        }
+    }
+
+TInt CMFPreviewHandlerBase::RingingVolume()
+    {
+    const TInt KDefaultVolumeLevel = 7; // see profile.hrh for volume levels
+    
+    if ( iRingingVolume != KErrNotFound )
+        {
+        return iRingingVolume;
+        }
+        
+    if ( iActiveProfileRead )
+        {
+        return iActiveProfileRingingVolume;
+        }
+
+    return KDefaultVolumeLevel;
+    }
+
+TInt CMFPreviewHandlerBase::RingingType()
+    {
+    if ( iRingingType != KErrNotFound )
+        {
+        return iRingingType;
+        }
+        
+    if ( iActiveProfileRead )
+        {
+        return iActiveProfileRingingType;
+        }
+
+    return ERingingTypeRinging;
+    }
+
+TInt CMFPreviewHandlerBase::Vibra()
+    {
+    if ( iVibra != KErrNotFound )
+        {
+        return iVibra;
+        }
+        
+    if ( iActiveProfileRead )
+        {
+        return iActiveProfileVibra;
+        }
+    
+    return 0;  // in case of error vibra is off
+    }
+
+TInt CMFPreviewHandlerBase::Echo3D()
+    {
+    if ( i3DEcho != KErrNotFound )
+        {
+        return i3DEcho;
+        }
+    
+    if ( iActiveProfileRead )
+        {
+        return iActiveProfile3DEcho;
+        }
+
+    return EProfile3DEchoOff;  // from ProfileInternal.hrh
+    }
+
+TInt CMFPreviewHandlerBase::Effect3D()
+    {
+    if ( i3DEffect != KErrNotFound )
+        {
+        return i3DEffect;
+        }
+    
+    if ( iActiveProfileRead )
+        {
+        return iActiveProfile3DEffect;
+        }
+
+    return EProfile3DEffectOff;
+    }
+
+TInt CMFPreviewHandlerBase::ConvertVolume( TInt aVolume, TInt aMaxVolume )
+    {
+    const TInt KMinVolumeLevel = 1;
+    const TInt KMaxVolumeLevel = 10;
+        
+    TInt result = aMaxVolume * aVolume / KMaxVolumeLevel;
+    
+    // if user has selected minimum volume level set HW volume 1
+    if ( aVolume == KMinVolumeLevel && result == 0 )
+        {
+        result = 1;
+        }
+
+    return result;
+    }
+  
+void CMFPreviewHandlerBase::ReadActiveProfileL()
+    {
+    iActiveProfileRead = EFalse;
+    
+    MProfileEngine* profileEngine = CreateProfileEngineL();
+    CleanupReleasePushL( *profileEngine );
+    
+    MProfile* activeProfile  = profileEngine->ActiveProfileL();
+    CleanupReleasePushL( *activeProfile );
+        
+    const MProfileTones& profileTones = activeProfile->ProfileTones();
+     
+    const TProfileToneSettings& toneSettings = profileTones.ToneSettings();
+    iActiveProfileVibra = toneSettings.iVibratingAlert;
+    iActiveProfileRingingVolume = toneSettings.iRingingVolume;
+    iActiveProfileRingingType = toneSettings.iRingingType;
+          
+    const MProfileExtraSettings& extra = activeProfile->ProfileExtraSettings();
+    const MProfile3DToneSettings& threeD = extra.Profile3DToneSettings();
+    
+    iActiveProfile3DEffect = threeD.Effect();
+    iActiveProfile3DEcho = threeD.Echo();
+   
+    CleanupStack::PopAndDestroy( activeProfile ); 
+    CleanupStack::PopAndDestroy( profileEngine );
+    
+    iActiveProfileRead = ETrue;
+    }
+ 
+void CMFPreviewHandlerBase::ReadDefaultToneL()
+    {
+    CRepository* cenrep = CRepository::NewLC( KCRUidProfileEngine );
+
+    User::LeaveIfError( cenrep->Get( KProEngDefaultRingingTone, iDefaultTone ) );
+    CleanupStack::PopAndDestroy( cenrep );
+    }
+
+TInt CMFPreviewHandlerBase::GetDataType( const TDesC& aFileName, TDataType& aDataType )
+    {
+    TUid dummyUid( KNullUid );
+    return iApaSession.AppForDocument( aFileName, dummyUid, aDataType );
+    }
+
+TInt CMFPreviewHandlerBase::DoResetInactivityTimer( TAny* /*aObject*/ )
+    {
+    User::ResetInactivityTime();
+    return KErrNone;
+    }
+
+void CMFPreviewHandlerBase::DisableBackLight()
+    {
+        const TInt KResetInactivityTimerDelay = 2000000;
+    iBacklightTimer->Cancel(); // Just in case
+    // Disable backlight turn off during video preview
+    iBacklightTimer->Start( KResetInactivityTimerDelay,
+                            KResetInactivityTimerDelay,
+                            TCallBack( DoResetInactivityTimer, 0 ) );
+    
+    }
+
+
+
+MsgAudioPreview::MsgAudioPreview( QObject *parent ) : CMFPreviewHandlerBase( parent )
+    {
+    iAudioPlayerStatus = EPlayerNotCreated;
+    TRAP_IGNORE(CMFPreviewHandlerBase::ConstructL());
+    iTonePlayerStatus = EPlayerNotCreated;
+    }
+
+MsgAudioPreview::~MsgAudioPreview()
+    {
+    Cancel();
+    
+    delete iAudioPlayer;
+    delete iTonePlayer;
+    delete i3dRingingTonePlugin;
+    }
+
+TBool MsgAudioPreview::IsPlaying()
+    {
+    if ( iAudioPlayerStatus != EPlayerNotCreated )
+        {
+        return ETrue;
+        }
+    
+    if ( iTonePlayerStatus != EPlayerNotCreated )
+        {
+        return ETrue;
+        }
+
+    return EFalse;
+    }
+
+void MsgAudioPreview::Play()
+    {
+    TRAP_IGNORE(PlayL());
+    }
+
+void MsgAudioPreview::PlayL()
+    {
+    if( IsPlaying() )
+        {
+        Stop();
+        return;
+        }
+    //sequence for playing a beep once sound
+    _LIT8( KFileListBeepSequence, "\x00\x11\x06\x0A\x08\x73\x0A\x40\x28\x0A\xF7\
+    \x05\xFC\x40\x64\x0A\x08\x40\x32\x0A\xF7\x06\x0B" ); 
+
+    // rng mime type
+    _LIT( KFileListRngMimeType, "application/vnd.nokia.ringing-tone" );
+    
+    Cancel(); // stop previous play
+    
+    if ( !iFullName || iFullName->Des().Length() == 0 )
+        {
+        User::Leave( KErrNotFound );
+        }
+
+    TRAP_IGNORE( ReadActiveProfileL() );
+
+    TPtrC fileName( iFullName->Des() );
+    TDataType dataType;
+    TInt err = GetDataType( fileName, dataType );
+    if ( err == KErrNotFound )
+        {
+        fileName.Set( iDefaultTone );
+        if ( fileName.Length() == 0 )
+             {
+             User::Leave( KErrNotFound );
+             }
+        }
+    else if ( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+        
+    TBool mimeTypeRng = EFalse;
+    
+    if ( err == KErrNone )
+        {
+        if( dataType.Des().CompareF( KFileListRngMimeType ) == 0 )
+            {
+            mimeTypeRng = ETrue;
+            }
+        }
+
+    TInt ringingType = RingingType();
+    if ( ringingType == ERingingTypeBeepOnce )
+        {
+        // Active profile ringing tone is set to Beep Once
+        // Don't initialize a FileSequence but use DesSequence instead
+        iTonePlayer = CMdaAudioToneUtility::NewL( *this );
+        iTonePlayer->PrepareToPlayDesSequence( KFileListBeepSequence() );
+        iTonePlayerStatus = EPlayerInitializing;
+        }
+    else
+        {
+        if( mimeTypeRng )
+            {
+            //Ringingtone is a RNG-file
+            iTonePlayer = CMdaAudioToneUtility::NewL( *this );
+            iTonePlayer->PrepareToPlayFileSequence( fileName );
+            iTonePlayerStatus = EPlayerInitializing;
+            }
+        else
+            {
+            delete iAudioPlayer;
+            iAudioPlayer = 0;
+
+            iAudioPlayer = CDrmPlayerUtility::NewFilePlayerL(
+                fileName, *this, KAudioPriorityRingingTonePreview,
+                ( TMdaPriorityPreference )KAudioPrefRingFilePreview );
+    
+            iAudioPlayerStatus = EPlayerInitializing;
+            }
+        }
+    DisableBackLight();
+    }
+
+void MsgAudioPreview::Stop()
+    {
+    Cancel();
+    }
+
+TInt MsgAudioPreview::ConvertVolume( TInt aVolume )
+    {
+    TInt result = 0;
+    if ( iAudioPlayer )
+        {
+        result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iAudioPlayer->MaxVolume() );
+        }
+    else if ( iTonePlayer )
+        {
+        result = CMFPreviewHandlerBase::ConvertVolume( aVolume, iTonePlayer->MaxVolume() );
+        }
+        
+    //if user has selected silent ringing type, set volume off
+    TInt ringingType = RingingType();
+    if( ringingType == ERingingTypeSilent )
+        {
+        result = 0;
+        }
+
+    return result;
+    }
+
+void MsgAudioPreview::SetToneRingingType( TInt aRingingType )
+    {
+    const TInt KToneInterval = 1000000; // 1 second pause between tones
+    const TInt KAscendingVolumeInterval = 3000000; // 3 seconds
+    
+    if ( !iTonePlayer )
+        {
+        return;
+        }   
+
+
+    TInt ringingVolume = RingingVolume();
+
+    switch( aRingingType )
+        {
+        case ERingingTypeRinging:
+        case ERingingTypeSilent:
+            {
+            iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever,
+                                     TTimeIntervalMicroSeconds( KToneInterval ) );
+            break;
+            }
+        case ERingingTypeAscending:
+            {
+            iTonePlayer->SetRepeats( KMdaAudioToneRepeatForever,
+                                     TTimeIntervalMicroSeconds( KToneInterval ) );
+            
+            TInt volRamp = KAscendingVolumeInterval * ringingVolume;
+            iTonePlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) );
+            break;
+            }
+        case ERingingTypeRingOnce:
+        case ERingingTypeBeepOnce:
+            {
+            iTonePlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) );
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+void MsgAudioPreview::SetAudioRingingType( TInt aRingingType )
+    {
+    const TInt KToneInterval = 1000000; // 1 second pause between tones
+    const TInt KAscendingVolumeInterval = 3000000; // 3 seconds
+    
+    if ( !iAudioPlayer )
+        {
+        return;
+        }
+
+    TInt ringingVolume = RingingVolume();
+        
+    switch( aRingingType )
+        {
+        case ERingingTypeRinging:
+        case ERingingTypeSilent:
+            {
+            iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever,
+                                      TTimeIntervalMicroSeconds( KToneInterval ) );
+            break;
+            }
+        case ERingingTypeAscending:
+            {
+            iAudioPlayer->SetRepeats( KMdaAudioToneRepeatForever,
+                                      TTimeIntervalMicroSeconds( KToneInterval ) );
+            TInt volRamp = KAscendingVolumeInterval * ringingVolume;
+            iAudioPlayer->SetVolumeRamp( TTimeIntervalMicroSeconds( volRamp ) );
+            break;
+            }
+        case ERingingTypeRingOnce:
+            {
+            iAudioPlayer->SetRepeats( 0, TTimeIntervalMicroSeconds( KToneInterval ) );
+            break;
+            }
+
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+void MsgAudioPreview::Cancel()
+    {
+    TBool isPlaying = EFalse;
+    
+    if ( iAudioPlayer )
+        {
+        isPlaying = ETrue;
+        if ( iAudioPlayerStatus == EPlayerPlayingWith3DEffect )
+            {
+            i3dRingingTonePlugin->Stop();
+            // plugin calls AudioPlayer->Stop()
+            iAudioPlayer->Close();
+            }
+        if ( iAudioPlayerStatus == EPlayerPlaying )
+            {
+            iAudioPlayer->Stop();
+            iAudioPlayer->Close();
+            }
+        
+        delete iAudioPlayer;
+        iAudioPlayer = 0;
+        iAudioPlayerStatus = EPlayerNotCreated;
+        }
+    
+    if ( iTonePlayer )
+        {
+        isPlaying = ETrue;
+        if ( iTonePlayerStatus == EPlayerPlaying )
+            {
+            iTonePlayer->CancelPlay();
+            }
+        
+        delete iTonePlayer;
+        iTonePlayer = 0;
+        iTonePlayerStatus = EPlayerNotCreated;
+        }
+        
+
+    if ( isPlaying )
+        {
+        //User::InfoPrint(_L("cancel"));
+//        EnableScreenSaver( ETrue );
+        iBacklightTimer->Cancel();
+        }
+    }
+
+void MsgAudioPreview::MatoPlayComplete( TInt aError )
+    {
+    Q_UNUSED(aError);
+    Cancel();
+ //   emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
+    }
+
+void MsgAudioPreview::MatoPrepareComplete( TInt aError )
+    {
+    if ( aError != KErrNone )
+        {
+        Cancel();
+        
+     //   emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );        
+        return;
+        }
+
+    TInt ringingVolume = RingingVolume();
+    TInt ringingType = RingingType();
+    TInt vibra = Vibra();
+       
+    iTonePlayerStatus = EPlayerInitialized;
+    SetToneRingingType( ringingType );
+    iTonePlayer->SetVolume( ConvertVolume( ringingVolume ) );
+    
+    TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
+    if ( vibra )
+        {
+        pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
+        }
+    iTonePlayer->SetPriority( KAudioPriorityPreview, pref );
+                                             
+    iTonePlayer->Play();
+    iTonePlayerStatus = EPlayerPlaying;
+    }
+
+void MsgAudioPreview::MdapcInitComplete( TInt aError, 
+                        const TTimeIntervalMicroSeconds& /* aDuration */ )
+    {
+    if ( aError != KErrNone )
+        {
+        Cancel();
+    //    emit notifyPreviewEvent( ToneFetcherEngine::EPreviewError, aError );
+        return;
+        }
+        
+
+    TInt ringingVolume = RingingVolume();
+    TInt ringingType = RingingType();
+    TInt vibra = Vibra();
+    TInt echo3D = Echo3D();
+    TInt effect3D = Effect3D();
+
+    
+
+    iAudioPlayerStatus = EPlayerInitialized;
+    SetAudioRingingType( ringingType );
+    iAudioPlayer->SetVolume( ConvertVolume( ringingVolume ) );
+    
+    TMdaPriorityPreference pref = (TMdaPriorityPreference) KAudioPrefRingFilePreview;               
+    if ( vibra )
+        {
+        pref = (TMdaPriorityPreference) KAudioPrefRingFilePreviewVibra;
+        }
+    iAudioPlayer->SetPriority( KAudioPriorityPreview, pref );
+     
+    iAudioPlayerStatus = EPlayerPlaying;
+    
+    if ( effect3D == EProfile3DEffectOff )
+        {
+        iAudioPlayer->Play();  // 3D not used
+        return;
+        }
+
+    if ( !i3dRingingTonePlugin )
+        {
+        TUid emptyUid = { 0 };
+        TRAPD( err, i3dRingingTonePlugin = C3DRingingToneInterface::NewL( emptyUid ) );
+        if ( err != KErrNone || !i3dRingingTonePlugin )
+            {
+            iAudioPlayer->Play();
+            return;
+            }
+        }       
+   
+    i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEffect, effect3D );
+    i3dRingingTonePlugin->SetAttr( E3DRTIAttr3DEcho, echo3D );    
+    i3dRingingTonePlugin->SetAttr( E3DRTIAttrDrmPlayerUtility, iAudioPlayer );
+    TRAP_IGNORE( i3dRingingTonePlugin->PlayL() );
+
+    iAudioPlayerStatus = EPlayerPlayingWith3DEffect;
+    }
+
+void MsgAudioPreview::MdapcPlayComplete( TInt aError )
+    {  
+    Q_UNUSED(aError);
+    Cancel();
+  //  emit notifyPreviewEvent( ToneFetcherEngine::EAudioPreviewComplete, aError );
+    
+    
+    }
+
+
+QString CMFPreviewHandlerBase::normalizeSeperator(const QString &path)
+{
+    QString standardpath( path );
+    QChar c('/');
+    QChar c1('\\');
+    if (standardpath.contains(c, Qt::CaseSensitive)) {
+        standardpath.replace(c, QDir::separator());
+    }
+    if (standardpath.contains(c1, Qt::CaseSensitive)) {
+        standardpath.replace(c1, QDir::separator());
+    }        
+    return standardpath;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msgaudiofetcher/src/msgaudioselectionengine.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 2010 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:
+ *     The source file for mde tone fetcher.
+ *
+ */
+
+// SYSTEM INCLUDES
+#include <XQConversions>
+#include <pathinfo.h>
+#include <bautils.h>
+#include <centralrepository.h>
+#include <ProfileEngineDomainCRKeys.h>
+
+// USER INCLUDES
+#include "msgaudioselectionengine.h"
+
+// CONSTANTS
+_LIT( KAmrMime, "audio/amr" );
+
+MsgAudioSelectionEngine::MsgAudioSelectionEngine()
+    {
+
+    }
+
+MsgAudioSelectionEngine::~MsgAudioSelectionEngine()
+    {
+    delete iQuery;
+    delete iSession;
+    }
+
+
+void MsgAudioSelectionEngine::CreateMetaDataSession()
+{
+    TRAP_IGNORE(iSession = CMdESession::NewL(*this));
+}
+
+
+void MsgAudioSelectionEngine::HandleSessionOpened(CMdESession& /*aSession*/,
+        TInt aError)
+    {
+    if (aError != KErrNone)
+        {
+        delete iSession;
+        iSession = 0;
+        iSessionOpen = EFalse;
+        emit mdeSessionError(aError);
+        }
+    else
+        {
+        iSessionOpen = ETrue;
+        TRAP_IGNORE( AddObjectObserverL() );
+        emit mdeSessionOpened();
+        }
+    }
+
+void MsgAudioSelectionEngine::HandleSessionError(CMdESession& /*aSession*/,
+        TInt aError)
+    {
+    if (aError == KErrNone)
+        {
+        return;
+        }
+
+    delete iSession;
+    iSession = 0;
+    iSessionOpen = EFalse;
+    emit mdeSessionError(aError);
+    }
+
+void MsgAudioSelectionEngine::HandleQueryNewResults(CMdEQuery& /*aQuery*/,
+        TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/)
+    {
+    }
+
+void MsgAudioSelectionEngine::HandleObjectNotification(
+        CMdESession& /*aSession*/, TObserverNotificationType aType,
+        const RArray<TItemId>& /*aObjectIdArray*/)
+    {
+    if (aType == ENotifyAdd || aType == ENotifyModify || aType
+            == ENotifyRemove)
+        {
+        emit notifyObjectChanged();
+        }
+    }
+
+void MsgAudioSelectionEngine::AddObjectObserverL()
+    {
+    if (iSessionOpen)
+        {
+        TUint32 notificationType = ENotifyAdd | ENotifyModify | ENotifyRemove;
+        User::LeaveIfNull(iSession);
+        CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
+        iSession->AddObjectObserverL(*this, 0, notificationType, &defNS);
+        iSession->AddObjectPresentObserverL(*this);
+        }
+    }
+
+void MsgAudioSelectionEngine::HandleObjectPresentNotification(
+        CMdESession& /*aSession*/, TBool /*aPresent*/,
+        const RArray<TItemId>& aObjectIdArray)
+    {
+    if (aObjectIdArray.Count() > 0)
+        {
+        emit notifyObjectChanged();
+        }
+    }
+
+void MsgAudioSelectionEngine::HandleQueryCompleted(CMdEQuery& aQuery,
+        TInt aError)
+    {
+    TRAP_IGNORE(HandleQueryCompletedL(aQuery, aError));
+    }
+
+void MsgAudioSelectionEngine::HandleQueryCompletedL(CMdEQuery& aQuery,
+        TInt aError)
+    {
+    iNameList.clear();
+    iUriList.clear();
+    if (aError == KErrCancel)
+        {
+        emit queryError(aError);
+        return;
+        }
+    else
+        {
+        CMdEObjectQuery* query = static_cast<CMdEObjectQuery*> (&aQuery);
+        TInt count = query->Count();
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMdEObject* object =
+                    (CMdEObject*) query->TakeOwnershipOfResult(i);
+            CleanupStack::PushL(object);
+            CMdEPropertyDef& propDef = MsgAudioSelectionEngine::PropertyDefL(
+                    iSession, MsgAudioSelectionEngine::EAttrFileName);
+
+            CMdEProperty* property = 0;
+            TInt err = object->Property(propDef, property, 0);
+            if (err != KErrNotFound && property)
+                {
+                QString songName(XQConversions::s60DescToQString(
+                        property->TextValueL()));
+                QString uriValue(XQConversions::s60DescToQString(
+                        object->Uri()));
+                iNameList.append(songName);
+                iUriList.append(uriValue);
+                }
+            CleanupStack::PopAndDestroy(object);
+            }
+        emit queryComplete(iNameList, iUriList);
+        }
+    }
+
+void MsgAudioSelectionEngine::QueryTones()
+    {
+    TRAP_IGNORE(QueryTonesL());
+    }
+
+void MsgAudioSelectionEngine::QueryTonesL()
+    {
+    LeaveIfSessionClosedL();
+    CMdENamespaceDef& defNS = iSession->GetDefaultNamespaceDefL();
+    CMdEObjectDef& musicObjectDef = defNS.GetObjectDefL(
+            MdeConstants::Audio::KAudioObject);
+
+    delete iQuery;
+    iQuery = 0;
+    iQuery = iSession->NewObjectQueryL(defNS, musicObjectDef, this);
+    CMdEPropertyDef& titlePropertyDef = musicObjectDef.GetPropertyDefL(
+            MdeConstants::Object::KTitleProperty);
+    CMdEPropertyDef& typePropertyDef = musicObjectDef.GetPropertyDefL(
+            MdeConstants::Object::KItemTypeProperty);
+
+    // set attributes that are included in query result
+    iQuery->AddPropertyFilterL(&titlePropertyDef);
+    iQuery->AddPropertyFilterL(&typePropertyDef);
+
+    iQuery->SetResultMode(EQueryResultModeItem);
+
+
+    // get root condition
+    CMdELogicCondition& conditions = iQuery->Conditions();
+    conditions.AddPropertyConditionL(typePropertyDef,
+            ETextPropertyConditionCompareEquals, KAmrMime);
+
+    iQuery->FindL();
+    }
+
+void MsgAudioSelectionEngine::LeaveIfSessionClosedL()
+    {
+    if (!iSession || !iSessionOpen)
+        {
+        User::Leave(KErrDisconnected);
+        }
+    }
+
+CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(TInt aAttr)
+    {
+    User::LeaveIfNull(iSession);
+    return PropertyDefL(iSession, aAttr);
+    }
+
+CMdEPropertyDef& MsgAudioSelectionEngine::PropertyDefL(CMdESession* aSession,
+        TInt aAttr)
+    {
+    CMdENamespaceDef& defNS = aSession->GetDefaultNamespaceDefL();
+
+    CMdEObjectDef& objectDef = defNS.GetObjectDefL(
+            MdeConstants::Audio::KAudioObject);
+
+    if (aAttr == EAttrFileSize)
+        {
+        return objectDef.GetPropertyDefL(MdeConstants::Object::KSizeProperty);
+        }
+    else if (aAttr == EAttrMediaType)
+        {
+        return objectDef.GetPropertyDefL(
+                MdeConstants::Object::KItemTypeProperty);
+        }
+    else if (aAttr == EAttrSongName || aAttr == EAttrFileName)
+        {
+        return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
+        }
+    else if (aAttr == EAttrArtist)
+        {
+        return objectDef.GetPropertyDefL(
+                MdeConstants::MediaObject::KArtistProperty);
+        }
+    else if (aAttr == EAttrAlbum)
+        {
+        return objectDef.GetPropertyDefL(MdeConstants::Audio::KAlbumProperty);
+        }
+    else if (aAttr == EAttrGenre)
+        {
+        return objectDef.GetPropertyDefL(
+                MdeConstants::MediaObject::KGenreProperty);
+        }
+    else if (aAttr == EAttrComposer)
+        {
+        return objectDef.GetPropertyDefL(
+                MdeConstants::Audio::KComposerProperty);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    return objectDef.GetPropertyDefL(MdeConstants::Object::KTitleProperty);
+    }
+
+
+void MsgAudioSelectionEngine::SetAttr(int attr, int value)
+    {
+    switch (attr)
+        {
+    case MsgAudioSelectionEngine::EAttrFileSize:
+            {
+            iMaxFileSize = value;
+            break;
+            }
+    default:
+        {
+        break;
+        }
+    }
+}
+// End of File
+
--- a/messagingapp/msgui/msgui.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msgui.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,7 @@
 SYMBIAN_PLATFORMS = WINSCW ARMV5
 
 # DLLs
-SUBDIRS += layoutplugins/layoutplugins.pro
+SUBDIRS += msgaudiofetcher/msgaudiofetcher.pro
 SUBDIRS += msguiutils/msguiutils.pro
 SUBDIRS += appengine/appengine.pro
 SUBDIRS += conversationview/conversationview.pro
--- a/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msguiutils/inc/mmsconformancecheck.h	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,9 @@
 #ifndef MMS_CONFORMANCE_CHECK_OPERATION_H
 #define MMS_CONFORMANCE_CHECK_OPERATION_H
 
-#include <msgmediainfo.h>
+#include <QObject>
+
+#include <MsgMediaInfo.h>
 #include <qstring.h>
 
 #ifdef BUILD_MSGUI_UTILS_DLL
@@ -30,7 +32,7 @@
 class CMmsConformance;
 class CMsgMediaResolver;
 class CDRMHelper;
-
+class HbAction;
 
 enum MmsConformanceCheckErrors
 {
@@ -44,8 +46,10 @@
  * 
  */
 
-class MSGUI_UTILS_DLL_EXPORT MmsConformanceCheck
+class MSGUI_UTILS_DLL_EXPORT MmsConformanceCheck : public QObject
 {
+    Q_OBJECT
+    
 public:
 
     /**
@@ -79,15 +83,17 @@
 private:
 
     /*
-     * Launch query dialog
-     */
-    bool launchEditorQuery();
-    
-    /*
      * Launch notification dialog
      */
     void showPopup(const QString& text);
     
+private slots:
+    
+	/**
+     * This slot is called when insert media dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogInsertMedia(HbAction* action);
 private:
 
     /*
@@ -99,6 +105,11 @@
      * Max MMS composition size
      */
     int iMaxMmsSize;    
+    
+    /**
+     * Conformance status
+     */
+    TUint32 iConfStatus;
 
 };
 #endif //MMS_CONFORMANCE_CHECK_OPERATION_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msguiutils/inc/msgcontactsutil.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,43 @@
+/*
+ * 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: This static utility class handles all contacts & phbk
+ * services related common functions for UI modules.
+ *
+ */
+
+#ifndef MSGCONTACTSUTIL_H_
+#define MSGCONTACTSUTIL_H_
+
+#ifdef BUILD_MSGUI_UTILS_DLL
+#define MSGUI_UTILS_DLL_EXPORT Q_DECL_EXPORT
+#else
+#define MSGUI_UTILS_DLL_EXPORT Q_DECL_IMPORT
+#endif
+
+/**
+ * static utility class to handle contacts related common functionality
+ * for UI modules
+ */
+class MSGUI_UTILS_DLL_EXPORT MsgContactsUtil
+{
+
+public:
+    static bool launchVCardViewer(const QString& filepath);
+
+private:
+    static QString copyVCardToTemp(const QString& filepath);
+    static void deleteVCardFromTemp(const QString& filepath);
+};
+
+#endif /* MSGCONTACTSUTIL_H_ */
--- a/messagingapp/msgui/msguiutils/msguiutils.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msguiutils/msguiutils.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,6 @@
 
 INCLUDEPATH += ../../../inc
 INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 CONFIG += hb
@@ -43,14 +42,26 @@
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
     "rom/msguiutils.iby CORE_APP_LAYER_IBY_EXPORT_PATH(msguiutils.iby)"
 
+
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/msguiutils.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/msguiutils.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 # Input
 HEADERS += msgsendutil.h \
            mmsconformancecheck.h \
-           msgmediautil.h
+           msgmediautil.h \
+           msgcontactsutil.h
            
 SOURCES += msgsendutil.cpp \
            mmsconformancecheck.cpp \
-           msgmediautil.cpp
+           msgmediautil.cpp \
+           msgcontactsutil.cpp
     
 # Libs
 LIBS += -lxqservice \
@@ -58,11 +69,11 @@
     -leditorgenutils \
     -lconvergedmessageutils \
     -lcentralrepository \
-    -ls60qconversions \
     -lDRMHelper \
     -lmsgmedia \
     -lapmime \
     -lunidatamodelloader \
-    -lxqutils
+    -lxqutils \
+    -lefsrv
+    
 
-
--- a/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/mmsconformancecheck.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -21,24 +21,26 @@
 #include <MmsConformance.h>
 #include <centralrepository.h>
 #include <mmsconst.h>
-#include <msgmediainfo.h>
+#include <MsgMediaInfo.h>
 #include <fileprotectionresolver.h>
 
 #include <MsgMediaResolver.h>
 #include <DRMHelper.h>
 #include <MmsEngineInternalCRKeys.h>
 #include <hbmessagebox.h>
-#include <hbnotificationdialog>
+#include <HbNotificationDialog>
+#include <hbaction.h>
 
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
-#include "unieditorgenutils.h" // This is needed for KDefaultMaxSize
-#include "s60qconversions.h"
+#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
+#include <xqconversions.h>
 #include "debugtraces.h"
 
 //DEFINES
 #define RMODE_INSERT_ERROR hbTrId("Unable to insert. Object format not supported in restricted creation mode.")
 #define INSERT_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_file")
+#define INSERT_PROTECTED_ERROR hbTrId("txt_messaging_dpopinfo_unable_to_attach_protected")
 #define INSERT_QUERY_CONFRM hbTrId("The receiving phone may not support this object. Continue?")
 // -----------------------------------------------------------------------------
 // MmsConformanceCheck::MmsConformanceCheck
@@ -48,7 +50,7 @@
 {
     QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck start");
 
-    TRAP_IGNORE(        
+    TRAP_IGNORE(
         CRepository* repository = CRepository::NewL(KCRUidMmsEngine);
     CleanupStack::PushL(repository);
 
@@ -62,7 +64,7 @@
     repository->Get( KMmsEngineMaximumSendSize, maxSize );
     iMaxMmsSize = maxSize;
 
-    CleanupStack::PopAndDestroy(repository);        
+    CleanupStack::PopAndDestroy(repository);
     );
 
     QDEBUG_WRITE("MmsConformanceCheck::MmsConformanceCheck end");
@@ -85,33 +87,33 @@
     bool showNote)
 {
     QDEBUG_WRITE("MmsConformanceCheck::CheckModeForInsert start");
-    HBufC* filePath = S60QConversions::qStringToS60Desc(file);
+    HBufC* filePath = XQConversions::qStringToS60Desc(file);
     if (filePath)
     {
         CleanupStack::PushL(filePath);
 
         CMmsConformance* mmsConformance = CMmsConformance::NewL();
         mmsConformance->CheckCharacterSet(EFalse);
-        
+
         CleanupStack::PushL(mmsConformance);
-        
-        CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL();     
+
+        CMsgMediaResolver* mediaResolver = CMsgMediaResolver::NewL();
         mediaResolver->SetCharacterSetRecognition(EFalse);
-        
+
         CleanupStack::PushL(mediaResolver);
-        
+
         RFile fileHandle = mediaResolver->FileHandleL(*filePath);
         CleanupClosePushL(fileHandle);
 
         CMsgMediaInfo* info = mediaResolver->CreateMediaInfoL(fileHandle);
         mediaResolver->ParseInfoDetailsL(info,fileHandle);
-        
+
         TMmsConformance conformance = mmsConformance->MediaConformance(*info);
-        TUint32 confStatus = conformance.iConfStatus;
+        iConfStatus = conformance.iConfStatus;
 
         CleanupStack::PopAndDestroy(4);
 
-        
+
         // In "free" mode user can insert images that are larger by dimensions than allowed by conformance
         if (iCreationMode != EMmsCreationModeRestricted)
         {
@@ -121,22 +123,21 @@
                     | EMmsConfNokTooBig);
 
             // If user answers yes to Guided mode confirmation query he/she moves to free mode
-            if ( (confStatus & i) && ! (confStatus & j))
+            if ( (iConfStatus & i) && ! (iConfStatus & j))
             {
                 if (iCreationMode == EMmsCreationModeFree || info->Protection()
                         & EFileProtSuperDistributable)
                 {
                     // SuperDistribution not checked here
                     // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
-                    confStatus &= ~EMmsConfNokFreeModeOnly;
-                    confStatus &= ~EMmsConfNokScalingNeeded;
+                    iConfStatus &= ~EMmsConfNokFreeModeOnly;
+                    iConfStatus &= ~EMmsConfNokScalingNeeded;
                 }
-                else if (showNote && launchEditorQuery())
+                else if (showNote)
                 {
-                    // Query accepted.
-                    // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
-                    confStatus &= ~EMmsConfNokFreeModeOnly;
-                    confStatus &= ~EMmsConfNokScalingNeeded;
+                    HbMessageBox::question(INSERT_QUERY_CONFRM, this,
+                                           SLOT(onDialogInsertMedia(HbAction*)),
+                                           HbMessageBox::Yes | HbMessageBox::No);
                 }
                 else
                 {
@@ -145,16 +146,24 @@
                 }
             }
         }
-        else if (confStatus & EMmsConfNokDRM || confStatus
-                & EMmsConfNokNotEnoughInfo || confStatus
-                & EMmsConfNokNotSupported || confStatus
-                & EMmsConfNokFreeModeOnly || confStatus & EMmsConfNokCorrupt)
+        else if (iConfStatus & EMmsConfNokDRM || iConfStatus
+                & EMmsConfNokNotEnoughInfo || iConfStatus
+                & EMmsConfNokNotSupported || iConfStatus
+                & EMmsConfNokFreeModeOnly || iConfStatus & EMmsConfNokCorrupt)
         {
             // Sanity check
             // "Not conformant" assumed if check fails.
             if(showNote)
             {
-                showPopup(INSERT_ERROR);
+                // For protected objects.
+                if (EFileProtNoProtection != info->Protection())
+                {
+                    showPopup(INSERT_PROTECTED_ERROR);
+                }
+                else
+                {
+                    showPopup(INSERT_ERROR);
+                }
             }
 
             return EInsertNotSupported;
@@ -174,18 +183,20 @@
     UniDataModelLoader* pluginLoader = new UniDataModelLoader();
     UniDataModelPluginInterface* pluginInterface =
             pluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
-    pluginInterface->setMessageId(messageId);
+    int id = pluginInterface->setMessageId(messageId);
 
-    //Check if slide count is greater than 1
-    if (pluginInterface->slideCount() > 1)
+    //Check if invalid id and slide count is greater than 1
+    if ( ( id <= 0 ) ||
+         (pluginInterface->slideCount() > 1) )
     {
         delete pluginLoader;
         return false;
     }
 
-    //Check if message size is inside max mms composition limits 
+    //Check if message size is inside max mms composition limits
     if (pluginInterface->messageSize() > iMaxMmsSize)
     {
+        delete pluginLoader;
         return false;
     }
 
@@ -211,7 +222,6 @@
     if (!retValue)
     {
         delete pluginLoader;
-
         return false;
     }
 
@@ -233,17 +243,23 @@
         }
 
     delete pluginLoader;
-
     return retValue;
 }
 
-// ---------------------------------------------------------
-// MmsConformanceCheck::launchEditorQuery
-// ---------------------------------------------------------
+// -----------------------------------------------------------------------------
+// MmsConformanceCheck::onDialogInsertMedia
+// -----------------------------------------------------------------------------
 //
-bool MmsConformanceCheck::launchEditorQuery()
+void MmsConformanceCheck::onDialogInsertMedia(HbAction* action)
 {
-    return HbMessageBox::question(INSERT_QUERY_CONFRM);
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        // Query accepted.
+        // Mask "FreeModeOnly" and "ScalingNeeded" away in free mode
+        iConfStatus &= ~EMmsConfNokFreeModeOnly;
+        iConfStatus &= ~EMmsConfNokScalingNeeded;
+    }
+
 }
 
 // -----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/msguiutils/src/msgcontactsutil.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2010 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: This static utility class handles all contacts & phbk services related
+ * common functions for UI modules.
+ *
+ */
+
+#include <QFileInfo>
+#include <QDir>
+#include <QFile>
+#include <xqapplicationmanager.h>
+#include "msgcontactsutil.h"
+
+
+//---------------------------------------------------------------
+// MsgContactsUtil::copyVCardToTemp
+// @see header file
+//---------------------------------------------------------------
+QString MsgContactsUtil::copyVCardToTemp(const QString& filepath)
+{
+    QDir tempDir;
+    QString tempFilePath(QDir::toNativeSeparators(tempDir.tempPath()));
+    tempFilePath.append(QDir::separator());
+    QFileInfo fInfo(filepath);
+    tempFilePath.append(fInfo.fileName());
+    QFile::copy(filepath, tempFilePath);
+    return tempFilePath;
+}
+
+//---------------------------------------------------------------
+// MsgContactsUtil::deleteVCardFromTemp
+// @see header file
+//---------------------------------------------------------------
+void MsgContactsUtil::deleteVCardFromTemp(const QString& filepath)
+{
+    QFile::remove(filepath);
+}
+
+//---------------------------------------------------------------
+// MsgContactsUtil::launchVCardViewer
+// @see header file
+//---------------------------------------------------------------
+bool MsgContactsUtil::launchVCardViewer(const QString& filepath)
+{
+    //TODO: remove copyVcsFile after capabilities fix from Contacts
+    QString newfilepath = copyVCardToTemp(filepath);
+
+    QString service("com.nokia.services.phonebookservices");
+    QString interface("Fetch");
+    QString operation("editCreateNew(QString)");
+    XQApplicationManager appManager;
+    XQAiwRequest* request = appManager.create(service, interface, operation, true); //embedded
+    if(request)
+    {
+	    QList<QVariant> args;
+        args << newfilepath;
+       request->setArguments(args);
+        QVariant retValue;
+        bool res = request->send(retValue);
+        delete request;
+    }
+    else
+    {
+        return false;
+    }
+    //TODO: remove deleteVcsFile after capabilities fix from Contacts
+    deleteVCardFromTemp(newfilepath);
+    return true;
+}
+
+
+// EOF
+
--- a/messagingapp/msgui/msguiutils/src/msgmediautil.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/msguiutils/src/msgmediautil.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -15,7 +15,7 @@
  *
  */
 #include <MsgMediaResolver.h>
-#include <XQConversions.h>
+#include <xqconversions.h>
 
 #include "msgmediautil.h"
 
--- a/messagingapp/msgui/unifiededitor/inc/mmssettingsdefs.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * 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: MMS settings specific enumerations, constants, declaration.
- *
- */
-
-#ifndef MMSSETTINGSDEFS_H
-#define MMSSETTINGSDEFS_H
-
-//  INCLUDES
-
-// CONSTANTS
-// Following definitions are applicable when the Unified SMS and MMS editor is in the build.
-// (Naming like KMmsImageSmallWidth cannot be used, because it is defined in mmsconst.h)
-// Small image: 640*480
-const TInt KMmsUniImageSmallWidth = 640;
-const TInt KMmsUniImageSmallHeight = 480;
-// Large image: 1600*1200
-const TInt KMmsUniImageLargeWidth = 1600;
-const TInt KMmsUniImageLargeHeight = 1200;
-
-#endif // MMSSETTINGSDEFS_H
-            
-// End of File
--- a/messagingapp/msgui/unifiededitor/inc/msgattachmentcontainer.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
- * 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: Container class for msg attachments
- *
- */
-#ifndef MSGATTACHMENTCONTAINER_H
-#define MSGATTACHMENTCONTAINER_H
-
-#include <HbWidget>
-#include "msgunieditorattachment.h"
-
-class QGraphicsLinearLayout;
-class MmsConformanceCheck;
-
-class MsgAttachmentContainer : public HbWidget
-    {
-    Q_OBJECT
-
-public:
-    /**
-     * Add Attachment success/failure states
-     */
-    enum AddAttachmentStatus
-    {
-        EAddSuccess = 0, EAddNotSupported, EAddSizeExceed
-    };
-
-    /**
-     * Constructor
-     */
-    MsgAttachmentContainer(const QString& pluginPath, QGraphicsItem *parent = 0);
-
-    /**
-     * Destructor
-     */
-    ~MsgAttachmentContainer();
-
-    /**
-     * add attachment to the container
-	 * @param filepath of the attachment
-	 * @return add operation status
-     */
-    MsgAttachmentContainer::AddAttachmentStatus addAttachment(
-            const QString& filepath);
-
-    /**
-     * count of attachments in the container
-	 * @return count
-     */
-    int count();
-    
-    /**
-     * List of attachments in the container
-     * @return attachments list
-     */
-    MsgUnifiedEditorAttachmentList attachmentList();
-    
-    /**
-     * Check if the container hold multimedia content
-     * @return true, if multimedia content is present
-     *         false, otherwise.
-     */
-    bool hasMMContent();
-    
-    /**
-     * Size of the attachment container
-     * @return size
-     */
-    int containerSize();
-
-signals:
-    /**
-     * emit when container content changes
-     */
-    void contentChanged();
-
-    /**
-     * emit to indicate view that container is now empty
-	 * View deletes the container if it becomes empty
-     */
-    void emptyAttachmentContainer();
-    
-private slots:
-    /**
-     * delete attachment from the container
-     */
-    void deleteAttachment(MsgUnifiedEditorAttachment* attachment);
-    
-private:
-    /**
-     * size of the msg
-     */
-    int messageSize();
-    
-private:
-    /**
-     * style plugin's path
-     */
-    QString mPluginPath;
-
-    /**
-     * container's layout
-     */
-    QGraphicsLinearLayout* mLayout;
-    
-    /**
-     * MMS conformance check utility class
-     */
-    MmsConformanceCheck* mMmsConformanceCheck;
-
-    /**
-     * attachment list
-     */
-    MsgUnifiedEditorAttachmentList mAttachmentList;
-
-    /**
-     * flag to tell, if container is holding MM content
-     */
-    bool mIsMMContent;
-    };
-
-#endif // MSGATTACHMENTCONTAINER_H
--- a/messagingapp/msgui/unifiededitor/inc/msgmonitor.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * 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: Helper class to monitor msg construction in unified editor
- *
- */
-
-#ifndef MSG_MONITOR_H
-#define MSG_MONITOR_H
-
-#include <QObject>
-#include "convergedmessage.h"
-class MsgUnifiedEditorView;
-class HbWidget;
-class UniEditorGenUtils;
-
-/**
- * Helper class to monitor message's contruction in unified editor.
- * This class is for only reading editor's content to run its logic.
- * This class is NOT a place for content editing inside editor.
- */
-class MsgMonitor : public QObject
-    {
-    Q_OBJECT
-
-public:
-    /**
-     * Constructor
-     */
-    MsgMonitor(QObject* parent=0);
-
-    /**
-     * Destructor
-     */
-    ~MsgMonitor();
-
-    /**
-     * Set to skip showing note for first time
-     * @param skip true/false
-     */
-    inline void setSkipNote(bool skip = true);
-    
-    /**
-     * Seeker method to access current message type
-     */
-    static inline ConvergedMessage::MessageType messageType();
-
-    /**
-     * seeker function to get current msg size in bytes
-     */
-    static inline int messageSize();
-
-    /**
-     * seeker function to get current msg's body size 
-     * in bytes
-     */
-    static inline int bodySize();
-
-    /**
-     * seeker function to get current msg's attachment
-     * container size in bytes
-     */
-    static inline int containerSize();
-
-    /**
-     * seeker function to get current msg's subject
-     * size in bytes
-     */
-    static inline int subjectSize();
-
-    /**
-     * seeker function to get max possible mms size
-     * in bytes
-     */
-    static inline int maxMmsSize();
-    
-    /**
-     * seeker funtion to get max recipient count for sms
-     */
-    static inline int maxSmsRecipients();
-
-    /**
-     * seeker funtion to get max recipient count for mms
-     */
-    static inline int maxMmsRecipients();
-
-public slots:
-    /**
-     * slot to find any msg type change during editor operations
-     */
-    void checkMsgTypeChange();
-
-private:
-    /**
-     * setter method to initialize content
-     */
-    void init();
-
-    /**
-     * handle size change of editor components
-     */
-    void updateSizeInfo(HbWidget* aWidget);
-    
-    /**
-     * show type change discreet note
-     */
-    void showPopup(const QString& text);
-    
-    /**
-     * accessor for view
-     */
-    MsgUnifiedEditorView* view();
-        
-private:
-    /**
-     * Flag to skip showing the type change popup.
-     * Note need to be skipped when an mms is opened from draft.
-     */
-    bool mSkipNote;
-
-    /**
-     * Type of msg under composition in the editor 
-     */
-    static ConvergedMessage::MessageType mMessageType;
-    
-    /**
-     * msg body size in bytes
-     */
-    static int mBodySize;
-    
-    /**
-     * msg container size in bytes
-     */
-    static int mContainerSize;
-    
-    /**
-     * msg subject size in bytes
-     */
-    static int mSubjectSize;
-
-    /**
-     * max mms size in bytes
-     */
-    static int mMaxMmsSize;
-    
-    /**
-     * max recipient count in an sms
-     */
-    static int mMaxSmsRecipients;
-
-    /**
-     * max recipient count in an sms
-     */
-    static int mMaxMmsRecipients;
-
-    /**
-     * UniEditorGenUtils object
-     * Owned
-     */
-    UniEditorGenUtils* mUniEditorGenUtils;
-    };
-
-#include "msgmonitor.inl"
-
-#endif //MSG_MONITOR_H
--- a/messagingapp/msgui/unifiededitor/inc/msgmonitor.inl	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2007 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: msgmonitor.inl
-*/
-
-
-
-// ========== INLINE METHODS ===============================
-
-//---------------------------------------------------------------
-// MsgMonitor::setSkipNote
-// @see header file
-//---------------------------------------------------------------
-inline void MsgMonitor::setSkipNote(bool skip)
-{
-    mSkipNote = skip;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::messageType
-// @see header file
-//---------------------------------------------------------------
-inline ConvergedMessage::MessageType MsgMonitor::messageType()
-{
-    return mMessageType;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::messageSize
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::messageSize()
-{
-    return mBodySize + mContainerSize + mSubjectSize;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::bodySize
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::bodySize()
-{
-    return mBodySize;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::containerSize
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::containerSize()
-{
-    return mContainerSize;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::subjectSize
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::subjectSize()
-{
-    return mSubjectSize;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::maxMmsSize
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::maxMmsSize()
-{
-    return mMaxMmsSize;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::maxSmsRecipients
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::maxSmsRecipients()
-{
-    return mMaxSmsRecipients;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::maxMmsRecipients
-// @see header file
-//---------------------------------------------------------------
-inline int MsgMonitor::maxMmsRecipients()
-{
-    return mMaxMmsRecipients;
-}
-
-//  End of File
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraddress.h	Fri Jun 25 15:47:40 2010 +0530
@@ -15,10 +15,10 @@
  *
  */
 
-#ifndef UNIFIED_EDITOR_ADDRESS_H
-#define UNIFIED_EDITOR_ADDRESS_H
+#ifndef MSG_UNIFIED_EDITOR_ADDRESS_H
+#define MSG_UNIFIED_EDITOR_ADDRESS_H
 
-#include <hbwidget.h>
+#include <msgunieditorbasewidget.h>
 
 #include <convergedmessageaddress.h>
 #include <QMap>
@@ -26,9 +26,10 @@
 class HbTextItem;
 class HbPushButton;
 class HbLineEdit;
+class HbAction;
 class MsgUnifiedEditorLineEdit;
 
-class MsgUnifiedEditorAddress : public HbWidget
+class MsgUnifiedEditorAddress : public MsgUnifiedEditorBaseWidget
     {
     Q_OBJECT
 
@@ -38,7 +39,6 @@
      * Constructor
      */
     MsgUnifiedEditorAddress(const QString& label,
-                            const QString& pluginPath,
                             QGraphicsItem *parent = 0);
 
     /**
@@ -48,9 +48,10 @@
 
     /**
      * Seeker method to return back data to editor's view
-     * Removes duplicates.
+     * By default, does not remove duplicates.
+     * @param removeDuplicates, True if duplicate removal is needed
      */
-    ConvergedMessageAddressList addresses();
+    ConvergedMessageAddressList addresses(bool removeDuplicates=false);
 
     /**
      * Get total number of recipient's (including duplicates)
@@ -59,14 +60,31 @@
 
     /**
      * setter method to set address
+     * @param addrlist, list of addresses to be set in address editor
      */
     void setAddresses(ConvergedMessageAddressList addrlist);
-    
+
     /**
      * Get amount of digits to be used in contact matching
      */
     static int contactMatchDigits();
-        
+
+    /**
+     * setter method to enable flag to skip max recipient limit query
+     */
+    void skipMaxRecipientQuery(bool skip);
+
+    /**
+     * validate contacts
+     */
+    bool validateContacts();
+
+public slots:
+    /**
+     * To set focus on editable field.
+     */
+    void setFocus();
+
 signals:
     /**
      * Emitted when send button from virtual ITUT is pressed.
@@ -79,7 +97,7 @@
     void contentChanged();
 
 private slots:
-   
+
     /**
      * called after selection from pbk.
      */
@@ -88,22 +106,37 @@
      * Slot for handling valid returns from the phonebook contacts fetched.
      */
     void handleOk(const QVariant& result);
-    
+
     /**
-     * Slot for handling errors. Error ids are provided as 
+     * Slot for handling errors. Error ids are provided as
      */
     void handleError(int errorCode, const QString& errorMessage);
 
     /**
      * Called when contentsChanged signal is emitted by the line edit
      */
-    void onContentsAdded(const QString&);
+    void onContentsChanged(const QString&);
 
     /**
-     * Called when contentsChanged signal is emitted by the line edit
-     * Checks for empty text content
+     * launch query for recipient limit usecase
+     */
+    void handleRecipientLimitReached();
+   
+	/**
+     * This slot is called when max recipients reached dialog is launched.
+     * @param action selected action (yes or no).
      */
-    void onContentsRemoved(const QString& text);
+    void onMaxRecipientsReached(HbAction*);
+
+    /**
+     * Handle invalid contact dialog useraction
+     */
+    void handleInvalidContactDialog(HbAction* act);
+    
+    /**
+     * Unblocks signals for pbk buttion after some delay.
+     */
+    void unblockSignals();
 
 private:
     /**
@@ -115,13 +148,26 @@
      * Add edit-field's user-added addresses to Map
      */
     void syncAdditionsToMap();
-    
+
     /**
      * Removes duplicate addresses and gives unique address list
      */
     QStringList uniqueAddressList();
+
+    /**
+     * 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:
-    
+
     /**
      * Push button to launch phone book.
      */
@@ -133,15 +179,39 @@
     MsgUnifiedEditorLineEdit* mAddressEdit;
 
     /**
-     * string to hold plugin path.
-     */
-    QString mPluginPath;
-
-    /**
      * address map.
      */
     QMap<QString, QString> mAddressMap;
-   
+
+    /**
+     * holds the previous buffer inside address field
+     */
+    QString mPrevBuffer;
+
+    /**
+     * flag to skip max recipient limit query
+     */
+    bool mSkipMaxRecipientQuery;
+
+    /**
+     * flag to indicate that the SMS recipient limit is about
+     * to be exceeded by a bulk insertion of addresses e.g. multiple
+     * selection from contact selection dialog
+     */
+    bool mAboutToExceedMaxSmsRecipients;
+
+    /**
+     * flag to indicate that the MMS recipient limit is about
+     * to be exceeded by a bulk insertion of addresses e.g. multiple
+     * selection from contact selection dialog
+     */
+    bool mAboutToExceedMaxMmsRecipients;
+
+    /**
+     * count by which a bulk-insertion will exceed max MMS recipient
+     * limit e.g. multiple selection from contact selection dialog
+     */
+    int mExceedsMaxMmsRecipientsBy;
     };
 
-#endif //UNIFIED_EDITOR_ADDRESS_H
+#endif //MSG_UNIFIED_EDITOR_ADDRESS_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachment.h	Fri Jun 25 15:47:40 2010 +0530
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef UNIFIED_EDITOR_ATTACHMENT_H
-#define UNIFIED_EDITOR_ATTACHMENT_H
+#ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_H
+#define MSG_UNIFIED_EDITOR_ATTACHMENT_H
 
 #include <HbWidget>
 #include <QList>
@@ -24,6 +24,8 @@
 class HbTextItem;
 class HbIconItem;
 class HbGestureSceneFilter;
+class HbFrameItem;
+class MsgUnifiedEditorUtils;
 
 class MsgUnifiedEditorAttachment : public HbWidget
     {
@@ -34,8 +36,7 @@
     /**
      * Constructor
      */
-    MsgUnifiedEditorAttachment( const QString& pluginPath,
-                                const QString& attachmentpath,
+    MsgUnifiedEditorAttachment( const QString& attachmentpath,
                                 const int filesize,
                                 QGraphicsItem *parent = 0 );
 
@@ -68,21 +69,16 @@
      */
     bool isMultimediaContent();
     
-    HbFeedback::InstantEffect overrideFeedback(Hb::InstantInteraction interaction) const;
-
 protected:
     /**
      * reimplemented from base class.
      */
-    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
-    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    virtual void gestureEvent(QGestureEvent *event);
     
     
 private:
-    /**
-     * Helper method to initialize gesture.
-     */
-    void initGesture();
+   
+    void setPressed(bool pressed);
 
 
 signals:
@@ -100,30 +96,36 @@
     /**
 	 * show longpress menu for attachment object
 	 */
-    void longPressed(QPointF position);
+    void handleLongTap(QPointF position);
+    
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
 
 	/**
 	 * slot to remove attachment from msg editor
 	 */
-    void removeAttachment();
+    void handleRemove();
 
 	/**
 	 * slot to open attachment
 	 */
-    void openAttachment();
+    void handleOpen();
 
 	/**
 	 * slot to view details of the attachment file
 	 */
     void viewDetails();
+    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
 
 private:
     /**
-	 * style plugin path
-	 */
-    QString mPluginPath;
-
-    /**
 	 * attachment file's path
 	 */
     QString mPath;
@@ -162,9 +164,21 @@
      * Max limit on sms size. Store at class level for optimization
      */
     int mMaxSmsSize;
+    
+	/**
+     * Background item
+     * Own
+     */
+    HbFrameItem* mBackGround;
+    
+    /**
+     * MsgUnifiedEditorUtils object.
+     * Own
+     */
+    MsgUnifiedEditorUtils *mEditorUtils;
 
     };
 
 typedef QList<MsgUnifiedEditorAttachment*> MsgUnifiedEditorAttachmentList;
 
-#endif //UNIFIED_EDITOR_ATTACHMENT_H
+#endif //MSG_UNIFIED_EDITOR_ATTACHMENT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorattachmentcontainer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,129 @@
+/*
+ * 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: Container class for msg attachments
+ *
+ */
+#ifndef MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H
+#define MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H
+
+#include <HbWidget>
+#include "msgunieditorattachment.h"
+
+class QGraphicsLinearLayout;
+class MmsConformanceCheck;
+
+class MsgAttachmentContainer : public HbWidget
+    {
+    Q_OBJECT
+
+public:
+    /**
+     * Add Attachment success/failure states
+     */
+    enum AddAttachmentStatus
+    {
+        EAddSuccess = 0, EAddNotSupported, EAddSizeExceed
+    };
+
+    /**
+     * Constructor
+     */
+    MsgAttachmentContainer( QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    ~MsgAttachmentContainer();
+
+    /**
+     * add attachment to the container
+	 * @param filepath of the attachment
+	 * @return add operation status
+     */
+    MsgAttachmentContainer::AddAttachmentStatus addAttachment(
+            const QString& filepath);
+
+    /**
+     * count of attachments in the container
+	 * @return count
+     */
+    int count();
+    
+    /**
+     * List of attachments in the container
+     * @return attachments list
+     */
+    MsgUnifiedEditorAttachmentList attachmentList();
+    
+    /**
+     * Check if the container hold multimedia content
+     * @return true, if multimedia content is present
+     *         false, otherwise.
+     */
+    bool hasMMContent();
+    
+    /**
+     * Size of the attachment container
+     * @return size
+     */
+    int containerSize();
+
+signals:
+    /**
+     * emit when container content changes
+     */
+    void contentChanged();
+
+    /**
+     * emit to indicate view that container is now empty
+	 * View deletes the container if it becomes empty
+     */
+    void emptyAttachmentContainer();
+    
+private slots:
+    /**
+     * delete attachment from the container
+     */
+    void deleteAttachment(MsgUnifiedEditorAttachment* attachment);
+    
+private:
+    /**
+     * size of the msg
+     */
+    int messageSize();
+    
+private:
+    
+    /**
+     * container's layout
+     */
+    QGraphicsLinearLayout* mLayout;
+    
+    /**
+     * MMS conformance check utility class
+     */
+    MmsConformanceCheck* mMmsConformanceCheck;
+
+    /**
+     * attachment list
+     */
+    MsgUnifiedEditorAttachmentList mAttachmentList;
+
+    /**
+     * flag to tell, if container is holding MM content
+     */
+    bool mIsMMContent;
+    };
+
+#endif // MSG_UNIFIED_EDITOR_ATTACHMENT_CONTAINER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditoraudiowidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,116 @@
+/*
+ * 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: This widget is used to display audio content.
+ *
+ */
+
+#ifndef MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
+#define MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
+
+// FORWARD DECLARATIONS
+class MsgUnifiedEditorUtils;
+
+#include <HbPushButton>
+
+/**
+ * @class MsgUniFiedEditorAudioWidget
+ * @brief This widget is used to display audio content in univiewer.
+ */
+class MsgUniFiedEditorAudioWidget: public HbPushButton
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    explicit MsgUniFiedEditorAudioWidget(QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    ~MsgUniFiedEditorAudioWidget();
+
+    /**
+     * Populates the widget contents.
+     * @param mimeType Mime type of media.
+     * @param filePath File path of media.
+     */
+    void populate(const QString &filePath);
+
+signals:
+
+    /**
+     * Signal emitted when widget is clicked.
+     * @param mediaPath File path of the media.
+     */
+    void shortTap(const QString &mediaPath);
+
+    /**
+     * Signal emitted when widget is long tapped.
+     * @param position Scene coordinates of tap.
+     */
+    void longTap(const QPointF &position);
+    
+    /**
+     * Emitted when remove action is triggered.
+     */
+    void remove();
+
+private slots:
+
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
+
+    /**
+     * Handles long tap event.
+     * @param position Scene coordinates of tap.
+     */
+    void handleLongTap(const QPointF &position);
+
+    /**
+     * Handles opening of media.
+     */
+    void handleOpen();
+
+    /**
+     * Handles removing of media.
+     */
+    void handleRemove();
+    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
+
+private:
+
+    /**
+     * MsgUnifiedEditorUtils object.
+     * Own
+     */
+    MsgUnifiedEditorUtils *mEditorUtils;
+
+    /**
+     * Media file path.
+     */
+    QString mMediaPath;
+};
+
+#endif //MSG_UNIFIED_EDITOR_AUDIO_WIDGET_H
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbasewidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+/*
+ * 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:common base class for editor fields(address field,subject field,
+ * and body field.
+ *
+ */
+
+#include <HbWidget>
+
+#ifndef MSG_UNIFIED_EDITOR_BASEWIDGET_H
+#define MSG_UNIFIED_EDITOR_BASEWIDGET_H
+
+class MsgUnifiedEditorBaseWidget: public HbWidget
+{
+    Q_OBJECT
+    
+public:
+    MsgUnifiedEditorBaseWidget(QGraphicsItem *parent = 0):HbWidget(parent){}
+    virtual void setFocus(){}
+    
+};
+
+
+#endif /* MSG_UNIFIED_EDITOR_BASEWIDGET_H */
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorbody.h	Fri Jun 25 15:47:40 2010 +0530
@@ -15,27 +15,27 @@
  *
  */
 
-#ifndef UNIFIED_EDITOR_BODY_H
-#define UNIFIED_EDITOR_BODY_H
+#ifndef MSG_UNIFIED_EDITOR_BODY_H
+#define MSG_UNIFIED_EDITOR_BODY_H
 
-#include <hbwidget.h>
+#include <msgunieditorbasewidget.h>
 #include <f32file.h>
 #include "msgunieditorprocessimageoperation.h"
 
 class HbTextEdit;
 class HbTextItem;
 class HbFrameItem;
-class HbIconItem;
-class HbPushButton;
-class HbGestureSceneFilter;
 class CMsgMediaResolver;
 class CMsgImageInfo;
 class MmsConformanceCheck;
 class UniEditorPluginInterface;
 class UniEditorPluginLoader;
+class MsgUnifiedEditorPixmapWidget;
+class MsgUniFiedEditorAudioWidget;
 
 
-class MsgUnifiedEditorBody : public HbWidget,public MUniEditorProcessImageOperationObserver
+class MsgUnifiedEditorBody : public MsgUnifiedEditorBaseWidget,
+                             public MUniEditorProcessImageOperationObserver
 {
     Q_OBJECT
 
@@ -46,7 +46,7 @@
     /**
      * Constructor
      */
-    MsgUnifiedEditorBody(const QString& pluginPath, QGraphicsItem *parent = 0);
+    MsgUnifiedEditorBody(QGraphicsItem *parent = 0);
 
     /**
      * Destructor
@@ -80,12 +80,44 @@
       */
      void disableCharCounter();
      
+     /**
+      * To set focus on editable field.
+      */
+     void setFocus();
+
+     /**
+      * Get to find body already contains an image
+      * @return bool
+      */
+     bool hasImage();
+
+     /**
+      * Get to find body already contains an audio
+      * @return bool
+      */
+     bool hasAudio();
+     
+    /**
+     * from MUniEditorProcessImageOperationObserver  
+     * @see MUniEditorProcessImageOperationObserver
+     */
+    void EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent,
+                               TFileName aFileName );
+    /**
+	 * Function which tells whether the image resize process is in progress
+	 */
+    bool isImageResizing()
+        {
+        return mIsImageResizing;
+        }
+
 public slots:
     /**
      * Called to insert image content in editor.
      * @param medialist list of absolute paths of media.
+     * @param draftMessage specifies draft message
      */
-    void setImage(QString& imagefile);
+    void setImage(QString& imagefile, bool draftMessage = false);
 
     /**
      * Called to insert audio content in editor.
@@ -94,12 +126,6 @@
     void setAudio(QString& audiofile);
 
     /**
-     * Called to insert video content in editor.
-     * @param medialist list of absolute paths of media.
-     */
-    void setVideo(QString& videofile);
-
-    /**
      * Called to insert body text in editor.
      * @param text body text.
      */
@@ -115,14 +141,14 @@
      * Emitted when msg-body content changes
      */
     void contentChanged();
+	
+    /**
+     * Emitted when image is being processed.
+     * @param enable, true to enable/ false to disable.
+     */
+   void enableSendButton(bool enable) const;
 
-public: // from MUniEditorProcessImageOperationObserver
-    
-    /*
-     * @see MUniEditorProcessImageOperationObserver
-     */
-    void EditorOperationEvent( TUniEditorProcessImageOperationEvent aEvent,
-        TFileName aFileName );
+
 
 protected: // from HbWidget
     
@@ -133,47 +159,18 @@
     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
 
 private slots:
-    /**
-     * called on long press on the media objects
-     */
-    void longPressed(QPointF position);
 
     /**
      * called from the media object's item specific menu
      */
     void removeMedia();
-
-    /**
-     * called from the media object's item specific menu
-     */
-    void openMedia();
-
-    /**
-     * called from the media object's item specific menu
-     */
-    void viewDetails();
     
     /**
      * handle text changes in body field
      */
     void onTextChanged();
 
-    /**
-     * Service launch complete.
-     */
-    void handleOk(const QVariant& result);
-
-    /**
-     * Service launch errors.
-     */
-    void handleError(int errorCode, const QString& errorMessage);
-
 private:
-    /**
-     * Get to find body already contains an image
-     * @return bool
-     */
-    bool hasImage();
 
     /**
      * Get to find body already contains an image
@@ -182,21 +179,9 @@
     void setImage(bool image = false);
 
     /**
-     * Get to find body already contains an audio
-     * @return bool
-     */
-    bool hasAudio();
-
-    /**
      * Set that body now contains an audio
      */
 	void setAudio(bool audio = false);
-    
-    /**
-     * Get the region (image/audio/video) where longpress happened
-     * @return region
-     */
-    QString getHitRegion(QPointF position);
 
     /**
      * size of the msg
@@ -237,24 +222,14 @@
     HbTextEdit* mTextEdit;
 
     /**
-     * frame for editor.
-     */
-    HbFrameItem* mEditorFrame;
-
-    /**
      * icon item to preview images.
      */
-    HbIconItem* mIconItem;
+    MsgUnifiedEditorPixmapWidget* mPixmapItem;
 
     /**
      * inline audio item
      */
-    HbPushButton* mAudioItem;
-
-    /**
-     * string to hold plug in path.
-     */
-    QString mPluginPath;
+    MsgUniFiedEditorAudioWidget* mAudioItem;
 
 	/**
 	 * Image file contained inside body
@@ -275,11 +250,6 @@
 	 * Video file contained inside body
 	 */
     QString mVideoFile;
-
-    /**
-     * To setup longpress gesture on media objects
-     */
-    HbGestureSceneFilter* mGestureFilter;
 	
     /**
      * MMs conformance check utility class
@@ -302,11 +272,6 @@
     int mVideoSize;
 
     /**
-     * Rfs object
-     */
-    RFs mfs;
-
-    /**
      * CUniEditorProcessImageOperation object
      */
     CUniEditorProcessImageOperation *mProcessImageOperation;
@@ -363,6 +328,22 @@
      * Maintains information if any unicode character has been entered or not
      */
     bool mUnicode;
+    
+    /**
+     * Content widget for processing animation.
+     */
+    HbWidget* mProcessingWidget;
+
+    /**
+     * boolean specifying a draft message
+     */
+    bool mDraftMessage ;
+    
+    /*
+     * Flag to indicate the state of image resizing process. 
+	 * true - resize in progress. false - resize is not underway.
+     */
+    bool mIsImageResizing;
 };
 
-#endif //UNIFIED_EDITOR_BODY_H
+#endif //MSG_UNIFIED_EDITOR_BODY_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorimageprocessor.h	Fri Jun 25 15:47:40 2010 +0530
@@ -18,8 +18,8 @@
 
 
 
-#ifndef C_UNIIMAGEPROCESSOR_H
-#define C_UNIIMAGEPROCESSOR_H
+#ifndef MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H
+#define MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H
 
 // INCLUDES
 #include <e32base.h>
@@ -412,4 +412,4 @@
 
 #include <msgunieditorimageprocessor.inl>
 
-#endif // C_UNIIMAGEPROCESSOR_H
+#endif // MSG_UNIFIED_EDITOR_IMAGE_PROCESSOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorlineedit.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,103 @@
+/*
+* 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: Derieved HbLineEdit class for custom address editor
+*
+*/
+
+#ifndef MSG_UNIFIED_EDITOR_LINEEDIT_H
+#define MSG_UNIFIED_EDITOR_LINEEDIT_H
+
+#include <HbLineEdit>
+#include<QBasicTimer>
+
+
+class MsgUnifiedEditorLineEdit : public HbLineEdit
+{
+    Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    MsgUnifiedEditorLineEdit(const QString& label, QGraphicsItem* parent=0);
+    
+    /**
+     * Destructor
+     */
+    ~MsgUnifiedEditorLineEdit();
+    
+    /**
+     * seeker method for getting address list
+     */
+    QStringList addresses();
+
+    /**
+     * Flag to retain or override base-class behaviour
+     * Needed because address & subject field classes derieve
+     * from this class, but have different behaviour
+     */
+    void setDefaultBehaviour(bool defaultBehaviour = false);
+    
+    /**
+     * seeker method for getting the text content held by editing field
+     */
+    QString content() const;
+    
+    /**
+     * setter method to clear text content of the editing field
+     */
+    void clearContent();
+    
+    /**
+     * set highlight on invalid contact
+     * @param invalidStr, String to be highlighted
+     */
+    void highlightInvalidString(QString invalidStr);
+
+signals:
+    void contentsChanged(const QString& text);
+
+public slots:
+    void setText(const QString &text, bool underlined = true);
+
+private slots:
+    void selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor);
+    void onContentsChanged();
+    void aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos);
+    
+protected: // from HbLineEdit
+    void inputMethodEvent(QInputMethodEvent *event);
+    void keyPressEvent(QKeyEvent *event);
+    void gestureEvent(QGestureEvent* event);
+    void focusInEvent(QFocusEvent* event);
+    void focusOutEvent(QFocusEvent *event);
+    void timerEvent (QTimerEvent *event);
+
+
+private:
+    void setHighlight(int currentPos);
+    QString text() const;
+    void handleTap();
+
+private:
+    QRegExp mLabelExpr;
+    QString mLabel;
+    QBasicTimer mSelectionSnapTimer;
+
+    int mSelectionStart;
+    int mSelectionEnd;
+    bool mDefaultBehaviour;
+};
+
+#endif // MSG_UNIFIED_EDITOR_LINEEDIT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormmssettingsdefs.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+/*
+ * 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: MMS settings specific enumerations, constants, declaration.
+ *
+ */
+
+#ifndef MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H
+#define MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H
+
+//  INCLUDES
+
+// CONSTANTS
+// Following definitions are applicable when the Unified SMS and MMS editor is in the build.
+// (Naming like KMmsImageSmallWidth cannot be used, because it is defined in mmsconst.h)
+// Small image: 640*480
+const TInt KMmsUniImageSmallWidth = 640;
+const TInt KMmsUniImageSmallHeight = 480;
+// Large image: 1600*1200
+const TInt KMmsUniImageLargeWidth = 1600;
+const TInt KMmsUniImageLargeHeight = 1200;
+
+#endif // MSG_UNIFIED_EDITOR_MMS_SETTINGSDEFS_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,229 @@
+/*
+ * 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: Helper class to monitor msg construction in unified editor
+ *
+ */
+
+#ifndef MSG_UNIFIED_EDITOR_MONITOR_H
+#define MSG_UNIFIED_EDITOR_MONITOR_H
+
+#include <QObject>
+#include "convergedmessage.h"
+class MsgUnifiedEditorView;
+class HbWidget;
+class UniEditorGenUtils;
+
+/**
+ * Helper class to monitor message's contruction in unified editor.
+ * This class is for only reading editor's content to run its logic.
+ * This class is NOT a place for content editing inside editor.
+ */
+class MsgUnifiedEditorMonitor : public QObject
+    {
+    Q_OBJECT
+
+public:
+    /**
+     * Constructor
+     */
+    MsgUnifiedEditorMonitor(QObject* parent=0);
+
+    /**
+     * Destructor
+     */
+    ~MsgUnifiedEditorMonitor();
+
+    /**
+     * Set to skip showing note for first time
+     * @param skip true/false
+     */
+    inline void setSkipNote(bool skip = true);
+    
+    /**
+     * Seeker method to access current message type
+     */
+    static inline ConvergedMessage::MessageType messageType();
+
+    /**
+     * seeker function to get current msg size in bytes
+     */
+    static inline int messageSize();
+
+    /**
+     * seeker function to get current msg's body size 
+     * in bytes
+     */
+    static inline int bodySize();
+
+    /**
+     * seeker function to get current msg's attachment
+     * container size in bytes
+     */
+    static inline int containerSize();
+
+    /**
+     * seeker function to get current msg's subject
+     * size in bytes
+     */
+    static inline int subjectSize();
+
+    /**
+     * seeker function to get max possible mms size
+     * in bytes
+     */
+    static inline int maxMmsSize();
+    
+    /**
+     * seeker funtion to get max recipient count for sms
+     */
+    static inline int maxSmsRecipients();
+
+    /**
+     * seeker funtion to get max recipient count for mms
+     */
+    static inline int maxMmsRecipients();
+    
+    /**
+     * get total address count in To, Cc & Bcc fields
+     */
+    static inline int msgAddressCount();
+
+public slots:
+    /**
+     * slot to handle content change in any editor component
+     */
+    void handleContentChange();
+
+signals:
+    /**
+     * Emitted when composed message can be sent.
+     * @param enable true if send is possible else false.
+     */
+    void enableSend(bool enable);
+
+private:
+    /**
+     * setter method to initialize content
+     */
+    void init();
+
+    /**
+     * Determine the projected msg type due to change in editor content
+     */
+    ConvergedMessage::MessageType projectedMsgType();
+
+    /**
+     * update various msg info changes during editing
+     * @param senderWidget, Editor widget which triggered 
+     * content change slot
+     */
+    void updateMsgInfo(HbWidget* senderWidget);
+    
+    /**
+     * show type change discreet note
+     */
+    void showPopup(const QString& text);
+    
+    /**
+     * accessor for view
+     */
+    MsgUnifiedEditorView* view();
+    
+    /**
+     * check editor body for MMS content
+     * @return true if MMS content is present
+     */
+    bool bodyHasMMSContent();
+    
+    /**
+     * check editor subject for MMS content
+     * @return true if MMS content is present
+     */
+    bool subjectHasMMSContent();
+    
+    /**
+     * check editor attachment container for MMS content
+     * @return true if MMS content is present
+     */
+    bool containerHasMMSContent();
+    
+    /**
+     * check for other MMS content criteria
+     * @return true if MMS criteria is met
+     */
+    bool otherMMSCriteriaMet();
+
+    /**
+     * Checks if composed message can be sent and emits a signal.
+     */
+    void updateSend();
+
+private:
+
+    /**
+     * Flag to skip showing the type change popup.
+     * Note need to be skipped when an mms is opened from draft.
+     */
+    bool mSkipNote;
+
+    /**
+     * Type of msg under composition in the editor 
+     */
+    static ConvergedMessage::MessageType mMessageType;
+    
+    /**
+     * msg body size in bytes
+     */
+    static int mBodySize;
+    
+    /**
+     * msg container size in bytes
+     */
+    static int mContainerSize;
+    
+    /**
+     * msg subject size in bytes
+     */
+    static int mSubjectSize;
+
+    /**
+     * max mms size in bytes
+     */
+    static int mMaxMmsSize;
+    
+    /**
+     * max recipient count in an sms
+     */
+    static int mMaxSmsRecipients;
+
+    /**
+     * max recipient count in an sms
+     */
+    static int mMaxMmsRecipients;
+    
+    /**
+     * current msg address count (to + cc + bcc)
+     */
+    static int mMsgCurrAddressCount;
+
+    /**
+     * UniEditorGenUtils object
+     * Owned
+     */
+    UniEditorGenUtils* mUniEditorGenUtils;
+    };
+
+#include "msgunieditormonitor.inl"
+
+#endif //MSG_UNIFIED_EDITOR_MONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditormonitor.inl	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2007 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: msgmonitor.inl
+*/
+
+
+
+// ========== INLINE METHODS ===============================
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::setSkipNote
+// @see header file
+//---------------------------------------------------------------
+inline void MsgUnifiedEditorMonitor::setSkipNote(bool skip)
+{
+    mSkipNote = skip;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::messageType
+// @see header file
+//---------------------------------------------------------------
+inline ConvergedMessage::MessageType MsgUnifiedEditorMonitor::messageType()
+{
+    return mMessageType;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::messageSize
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::messageSize()
+{
+    return mBodySize + mContainerSize + mSubjectSize;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::bodySize
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::bodySize()
+{
+    return mBodySize;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::containerSize
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::containerSize()
+{
+    return mContainerSize;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::subjectSize
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::subjectSize()
+{
+    return mSubjectSize;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::maxMmsSize
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::maxMmsSize()
+{
+    return mMaxMmsSize;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::maxSmsRecipients
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::maxSmsRecipients()
+{
+    return mMaxSmsRecipients;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::maxMmsRecipients
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::maxMmsRecipients()
+{
+    return mMaxMmsRecipients;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::msgAddressCount
+// @see header file
+//---------------------------------------------------------------
+inline int MsgUnifiedEditorMonitor::msgAddressCount()
+{
+    return mMsgCurrAddressCount;
+}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorpixmapwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * 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: This widget displays the pixmap content.
+ *
+ */
+
+#ifndef MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H
+#define MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H
+
+#include <HbIconItem>
+
+// FORWARD DECLARATIONS
+class MsgUnifiedEditorUtils;
+
+/**
+ * This widget displays the pixmap content.
+ */
+class MsgUnifiedEditorPixmapWidget: public HbIconItem
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    MsgUnifiedEditorPixmapWidget(QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    ~MsgUnifiedEditorPixmapWidget();
+
+    /**
+     * Sets the pixmap content to be displayed.
+     * @param imagePath File path of the image.
+     */
+    void populate(const QString &imagePath);
+
+signals:
+
+    /**
+     * Signal emitted when widget is clicked.
+     * @param mediaPath File path of the media.
+     */
+    void shortTap(const QString &mediaPath);
+
+    /**
+     * Signal emitted when widget is long tapped.
+     * @param position Scene coordinates of tap.
+     */
+    void longTap(const QPointF &position);
+    
+    /**
+     * Emitted when remove action is triggered.
+     */
+    void remove();
+
+protected:
+
+    /**
+     * Event handler for gesture events.
+     * Reimplemented from HbWidgetBase.
+     * @see HbWidgetBase
+     */
+    virtual void gestureEvent(QGestureEvent *event);
+
+private slots:
+
+    /**
+     * Handles opening of media.
+     */
+    void handleOpen();
+    
+    /**
+     * Handles removing of media.
+     */
+    void handleRemove(); 
+    
+    /**
+     * Handles opening of details view.
+     */
+    void viewDetails();
+    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
+
+private:
+
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
+
+    /**
+     * Handles long tap event.
+     * @param position Scene coordinates of tap.
+     */
+    void handleLongTap(const QPointF &position);
+
+private:
+
+    /**
+     * MsgUnifiedEditorUtils object.
+     * Own
+     */
+    MsgUnifiedEditorUtils *mEditorUtils;
+
+    /**
+     * Pixmap file path being set.
+     */
+    QString mPixmapPath;
+};
+
+#endif /* MSG_UNIFIED_EDITOR_PIXMAP_WIDGET_H */
+
+// EOF
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorprocessimageoperation.h	Fri Jun 25 15:47:40 2010 +0530
@@ -17,18 +17,19 @@
 
 
 
-#ifndef __UNIEDITORPROCESSIMAGEOPERATION_H
-#define __UNIEDITORPROCESSIMAGEOPERATION_H
+#ifndef MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H
+#define MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H
 
 // INCLUDES
 
 #include <e32base.h>
+#include <f32file.h>
 #include <msvapi.h>
 #include <apmstd.h>
 
 #include <msgunieditorimageprocessor.h>
 #include <cmsvattachment.h>
-
+#include <QObject>
 
 // FORWARD DECLARATIONS
 
@@ -37,7 +38,7 @@
 class CUniEditorDocument;
 class MMsvAttachmentManager;
 class CMsvStore;
-
+class HbAction;
 // DATA TYPES
 
 // CLASS DECLARATION
@@ -68,17 +69,18 @@
 *
 * @since 3.2
 */
-class CUniEditorProcessImageOperation : public CActive,
+class CUniEditorProcessImageOperation : public QObject,public CActive,
                                         public MUniImageProcessorCallback
     {
+    Q_OBJECT
+    
     public: // new operations
 
         /**
         * Factory method
         */
         static CUniEditorProcessImageOperation* NewL( 
-            MUniEditorProcessImageOperationObserver &aObserver,
-            RFs& aFs );
+            MUniEditorProcessImageOperationObserver &aObserver);
 
         /**
         * Start image process operation
@@ -133,8 +135,7 @@
         * C++ constructor
         */
         CUniEditorProcessImageOperation( 
-            MUniEditorProcessImageOperationObserver &aObserver,
-            RFs& aFs );
+            MUniEditorProcessImageOperationObserver &aObserver);
 
         /**
         * 2nd phase constructor.
@@ -206,6 +207,19 @@
         */
         void CompleteOperation( TInt aError );
         
+		/**
+		* Check image size
+		*/
+        void checkLargeImage();
+        
+    private slots:
+    
+		/**
+     	* This slot is called when large image insertion query dialog is launched.
+     	* @param action selected action (yes or no).
+     	*/
+    	void onDialogLargeImage(HbAction* action);
+    
     private: // data
 
         enum TUniProcessStates
@@ -244,7 +258,8 @@
         TInt                        iMaxImageWidth;
         TInt                        iMaxImageHeight;
         TInt                        iMmsCreationMode;
-        RFs&                        iFs;
+        RFs                         iFs;
+        TBool largeImageQuery;
     };
 
-#endif //__UNIEDITORPROCESSIMAGEOPERATION_H
+#endif //MSG_UNIFIED_EDITOR_PROCESS_IMAGEOPERATION_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorsubject.h	Fri Jun 25 15:47:40 2010 +0530
@@ -14,10 +14,10 @@
  * Description:
  */
 
-#ifndef UNIFIED_EDITOR_SUBJECT_H
-#define UNIFIED_EDITOR_SUBJECT_H
+#ifndef MSG_UNIFIED_EDITOR_SUBJECT_H
+#define MSG_UNIFIED_EDITOR_SUBJECT_H
 
-#include <hbwidget.h>
+#include <msgunieditorbasewidget.h>
 
 #include "convergedmessage.h"
 
@@ -25,7 +25,7 @@
 class UniEditorGenUtils;
 class MsgUnifiedEditorLineEdit;
 
-class MsgUnifiedEditorSubject : public HbWidget
+class MsgUnifiedEditorSubject : public MsgUnifiedEditorBaseWidget
     {
     Q_OBJECT
 
@@ -34,7 +34,7 @@
     /**
      * Constructor
      */
-    MsgUnifiedEditorSubject(const QString& pluginPath, QGraphicsItem *parent = 0);
+    MsgUnifiedEditorSubject(QGraphicsItem *parent = 0);
 
     /**
      * Destructor
@@ -67,6 +67,11 @@
      * @param text
      */
     void setText(const QString& text);
+    
+    /**
+     * To set focus on editable field.
+     */
+    void setFocus();
 
 signals:
     /**
@@ -78,13 +83,7 @@
     /**
      * called when contentsChanged signal is emitted by the line edit
      */
-    void onContentsAdded(const QString&);
-    
-    /**
-     * Called when contentsChanged signal is emitted by the line edit
-     * Checks for empty text content 
-     */
-    void onContentsRemoved(const QString& text);
+    void onContentsChanged(const QString&);
     
 private:
     /**
@@ -96,11 +95,6 @@
 private:
     
     /**
-     * plug in path.
-     */
-    QString mPluginPath;
-    
-    /**
      * line edit to input subject.
      */
     MsgUnifiedEditorLineEdit* mSubjectEdit;
@@ -119,6 +113,11 @@
      * general utilities
      */
     UniEditorGenUtils* mGenUtils;
+    
+    /**
+     * Holds the previous buffer inside subject field
+     */
+    QString mPrevBuffer;
     };
 
-#endif //UNIFIED_EDITOR_SUBJECT_H
+#endif //MSG_UNIFIED_EDITOR_SUBJECT_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorutils.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,90 @@
+/*
+ * 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:  Utility class for unieditor.
+ *
+ */
+
+#ifndef MSG_UNIFIED_EDITOR_UTILS_H
+#define MSG_UNIFIED_EDITOR_UTILS_H
+
+// SYSTEM INCLUDES
+#include <QObject>
+
+// FORWARD DECLARATIONS
+
+/**
+ * @class MsgUnifiedEditorUtils
+ * @brief Utility class for univiewer. Contains common functionality required
+ * for widgets.
+ */
+
+class MsgUnifiedEditorUtils: public QObject
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    explicit MsgUnifiedEditorUtils(QObject *parent = 0);
+
+    /**
+     * Destructor
+     */
+    virtual ~MsgUnifiedEditorUtils();
+
+    /**
+     * Utility function to launch different content viewers.
+     * @param mimeType Mime type of the content.
+     * @param filePath Absolute file path of content.
+     */
+    void launchContentViewer(const QString &mimeType, const QString &filePath);
+
+signals:
+
+    /**
+     * Service launch complete.
+     */
+    void requestOk(const QVariant& result);
+
+    /**
+     * Service launch errors.
+     */
+    void requestError(int errorCode, const QString& errorMessage);
+
+private slots:
+
+    /**
+     * Service launch complete.
+     */
+    void handleOk(const QVariant& result);
+
+    /**
+     * Service launch errors.
+     */
+    void handleError(int errorCode, const QString& errorMessage);
+
+private:
+
+    /**
+     * Launch content viewer using XQSharableFile.
+     * @param filePath Absolute path of content.
+     */
+    void launchViaSharableFile(const QString &filePath);
+
+};
+
+#endif // MSG_UNIFIED_EDITOR_UTILS_H
+//eof
--- a/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/inc/msgunieditorview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef UNIFIED_EDITOR_VIEW_H
-#define UNIFIED_EDITOR_VIEW_H
+#ifndef MSG_UNIFIED_EDITOR_VIEW_H
+#define MSG_UNIFIED_EDITOR_VIEW_H
 
 #ifdef UNIFIEDEDITOR_DLL
 #define UNIFIEDEDITOR_EXPORT Q_DECL_EXPORT
@@ -24,15 +24,10 @@
 #define UNIFIEDEDITOR_EXPORT Q_DECL_IMPORT
 #endif
 
-#include <qmobilityglobal.h>
 #include "msgbaseview.h"
 #include "convergedmessage.h"
 #include "convergedmessageid.h"
 
-QTM_BEGIN_NAMESPACE
-QTM_END_NAMESPACE
-QTM_USE_NAMESPACE
-
 class HbWidget;
 class HbAction;
 class HbGroupBox;
@@ -40,10 +35,13 @@
 class MsgUnifiedEditorSubject;
 class MsgUnifiedEditorAddress;
 class MsgUnifiedEditorBody;
-class MsgMonitor;
+class MsgUnifiedEditorMonitor;
 class MsgAttachmentContainer;
 class UniEditorPluginLoader;
 class HbListWidgetItem;
+class HbAbstractVkbHost;
+class MsgUnifiedEditorBaseWidget;
+class HbListWidget;
 
 class UNIFIEDEDITOR_EXPORT MsgUnifiedEditorView : public MsgBaseView
     {
@@ -77,7 +75,7 @@
     /**
      * Saves the content inside editor to save
      */
-    void saveContentToDrafts();
+    int saveContentToDrafts();
     
 protected:
     /**
@@ -98,20 +96,20 @@
     void addToolBar();
 
     /**
-     * helper method to get style plugin path.
+     * Packs the content inside editor into converged message
+     * @param [OUT]msg, converged message to hold editor data
+     * @param isSave, flag to indicate that msg needs to be packed
+     * for saving to draft or not
      */
-    QString pluginPath();
-
-    /**
-     * Packs the content inside editor into converged message
-     */
-    void packMessage(ConvergedMessage &msg);
+    void packMessage(ConvergedMessage &msg, bool isSave=false);
 
     /**
      * Populate editor with prepopulated msg content
+     * @param messageDetails message details
+     * @param draftMessage boolean for specifying draft message
      */
     void populateContentIntoEditor(
-        const ConvergedMessage& messageDetails);
+        const ConvergedMessage& messageDetails, bool draftMessage = false);
     
     /**
      * Populate the editor with the forwarded message's content
@@ -140,15 +138,52 @@
     void fetchImages();
 
     /**
-     * Fectch conatcts
+     * Fetch contacts
      */
     void fetchContacts();
 
     /**
-     * Fectch audio
+     * Fetch audio
      */
     void fetchAudio();
 
+    /**
+     * To hide/show chrome.
+     */
+    void hideChrome(bool hide);
+    
+    /**
+     * To initialize view.
+     */
+    void initView();
+    
+    /**
+     * Creates temp folder for editor.
+     */
+    bool createTempFolder();
+    
+    /**
+     * Removes editors temp folder.
+     */
+    void removeTempFolder();
+
+    /**
+     * Attachment options in TBE
+     * Row number of the TBE actions
+     */
+    enum TBE_AttachOption
+    {
+        TBE_PHOTO = 0x00, TBE_SOUND = 0x01, TBE_VCARD = 0x02
+    };
+
+    /**
+     * Enable/Disable attachment options for slide-conformance
+     * @param opt, row number of action in TBE
+     * @param isEnabled, true/false
+     */
+    void setAttachOptionEnabled(MsgUnifiedEditorView::TBE_AttachOption opt,
+            bool enable);
+
 private slots:
 
     /**
@@ -172,11 +207,6 @@
     void changePriority();
 
     /**
-     * slot for different sending options.
-     */
-    void sendingOptions();
-
-    /**
      * slot to current delete message.
      */
     void deleteMessage();
@@ -187,11 +217,6 @@
     void imagesFetched(const QVariant& result );
 
     /**
-     * slot to fetch audio files
-     */
-    void audiosFetched(const QVariant& result );
-    
-    /**
      * slot to receive fetched contacts
      */
     void contactsFetched(const QVariant& value);
@@ -239,10 +264,62 @@
      * Deactivate Input Blocker
      */
     void deactivateInputBlocker();
+    
+    /**
+     * Resizes the view when VKB is opened.
+     * This slot is triggered when vkb is opened.
+     */
+    void vkbOpened();
 
+    /**
+     * Resizes the view when VKB is closed.
+     * This slot is triggered when VKB focus is lost.
+     */
+    void vkbClosed();
+    
+    /**
+     * Slot to do delayed construction.
+     */
+    void doDelayedConstruction();
+    
+    /**
+     * Sets focus to item.
+     */
+    void setFocus(MsgUnifiedEditorBaseWidget* item);
+    
+    /**
+     * Listens to contentChanged signal of various fields.
+     */
+    void onContentChanged();
+
+	/**
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogDeleteMsg(HbAction* action);
+
+	/**
+     * This slot is called when define sms settings dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogSmsSettings(HbAction* action);
+    
+    /**
+     * This slot is called when define mms settings dialog is launched.
+     * @param action selected action (yes or no).
+     */
+    void onDialogMmsSettings(HbAction* action);    
+	
+	/**
+     * Enable/Disable send tool button.
+     * @param true/false to enable/disable.
+     */
+     void enableSendButton(bool enable);
+    
 private:
     HbAction* mSubjectAction;
     HbAction* mCcBccAction;
+    HbAction* mSendAction;
     QGraphicsLinearLayout* mMainLayout;
     MsgUnifiedEditorSubject* mSubjectField;
     MsgUnifiedEditorAddress* mToField;
@@ -251,15 +328,25 @@
     MsgUnifiedEditorBody*   mBody;
 
     HbWidget* mContentWidget;
-    QString mPluginPath;
 
-    MsgMonitor* mMsgMonitor;
+    MsgUnifiedEditorMonitor* mMsgMonitor;
     MsgAttachmentContainer* mAttachmentContainer;
     UniEditorPluginLoader* mPluginLoader;
     ConvergedMessageId mOpenedMessageId;
     ConvergedMessage::MessageType mmOpenedMessageType;
 	bool mCanSaveToDrafts;
-	friend class MsgMonitor;
+
+	/**
+	 * TBE's content widget
+	 */
+	HbListWidget* mTBExtnContentWidget;
+	
+    /**
+     * Instance of VKB host
+     */
+	HbAbstractVkbHost* mVkbHost;
+	
+	friend class MsgUnifiedEditorMonitor;
     };
 
-#endif //UNIFIED_EDITOR_VIEW_H
+#endif //MSG_UNIFIED_EDITOR_VIEW_H
--- a/messagingapp/msgui/unifiededitor/inc/msgunifiededitorlineedit.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* 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: Derieved HbLineEdit class for custom address editor
-*
-*/
-
-#ifndef MSGUNIFIEDEDITORLINEEDIT_H
-#define MSGUNIFIEDEDITORLINEEDIT_H
-
-#include <HbLineEdit>
-#include<QBasicTimer>
-
-
-class MsgUnifiedEditorLineEdit : public HbLineEdit
-{
-    Q_OBJECT
-
-public:
-    /**
-     * Constructor
-     */
-    MsgUnifiedEditorLineEdit(const QString& label, QGraphicsItem* parent=0);
-    
-    /**
-     * Destructor
-     */
-    ~MsgUnifiedEditorLineEdit();
-    
-    /**
-     * seeker method for getting address list
-     */
-    QStringList addresses();
-
-    void setDefaultBehaviour(bool defaultBehaviour = false);
-    QString content() const;
-	
-signals:
-    void contentsChanged(const QString& text);
-
-public slots:
-    void setText(const QString &text);
-    void cut();
-    void selectAll();
-
-private slots:
-    void selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor);
-    void onContentsChanged();
-    
-protected: // from HbLineEdit
-    void inputMethodEvent(QInputMethodEvent *event);
-    void keyPressEvent(QKeyEvent *event);
-    void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
-    void focusInEvent(QFocusEvent* event);
-    void timerEvent (QTimerEvent *event);
-
-
-private:
-    void setHighlight(int currentPos);
-    QString text() const;
-
-private:
-    QRegExp mLabelExpr;
-    QString mLabel;
-    QBasicTimer mSelectionSnapTimer;
-
-    int mSelectionStart;
-    int mSelectionEnd;
-    bool mDefaultBehaviour;
-};
-
-#endif // MSGUNIFIEDEDITORLINEEDIT_H
--- a/messagingapp/msgui/unifiededitor/resources/animation.axml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<animations>
-<icon name="frame_anim_looping" playmode="loop">
-<frame duration="100">:/qtg_anim_longtap_1.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_2.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_3.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_4.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_5.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_6.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_7.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_8.svg</frame>
-<frame duration="100">:/qtg_anim_longtap_9.svg</frame>
-</icon>
-</animations>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitoraddress.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,21 @@
+HbWidget {
+    margin-left: 0un;
+    margin-top: 0un;
+}
+MsgUnifiedEditorAddress {
+	layout:layout-default;
+}
+
+MsgUnifiedEditorAddress::launchBtn {
+	right: var(hb-param-margin-gene-right);
+	fixed-width: 9.5un;
+	fixed-height: 7.46un;
+}
+
+MsgUnifiedEditorAddress::addressField {
+	left: -var(hb-param-margin-gene-left);
+	right: var(hb-param-margin-gene-middle-horizontal);
+	min-height: 7.46un;
+	}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitoraddress.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,15 @@
+<hbwidget version="0.1">
+  <layout name="layout-default" type="mesh">
+
+     <meshitem src="addressField" srcEdge="TOP" dst="" dstEdge="TOP" />
+     <meshitem src="addressField" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+     <meshitem src="addressField" srcEdge="RIGHT" dst="launchBtn" dstEdge="LEFT" />
+     <meshitem src="" srcEdge="BOTTOM" dst="addressField" dstEdge="BOTTOM" />  
+     
+     
+     <meshitem src="launchBtn" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+     <meshitem src="launchBtn" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />    
+          
+          
+  </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,39 @@
+HbWidget {
+    margin-left: 0un;
+    margin-top: 0un;
+}
+
+MsgUnifiedEditorAttachment {
+    layout:layout-default;
+}
+
+MsgUnifiedEditorAttachment::attachmentIcon
+{
+  top:-var(hb-param-margin-gene-top);
+  left:-var(hb-param-margin-gene-left);
+  bottom:var(hb-param-margin-gene-bottom);
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-primary-small);
+  pref-height:var(hb-param-graphic-size-primary-small);
+}
+
+MsgUnifiedEditorAttachment::attachmentName
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  text-height:var(hb-param-text-height-secondary);
+  text-line-count-min:1;
+  text-line-count-max:1;
+}
+
+MsgUnifiedEditorAttachment::attachmentDetails
+{
+  right:var(hb-param-margin-gene-right);
+  text-height:var(hb-param-text-height-tiny);
+  text-line-count-min:1;
+  text-line-count-max:1;
+  size-policy:fixed fixed;
+  text-align:right;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,16 @@
+<hbwidget version="0.1">
+  <layout name="layout-default" type="mesh">
+    
+    <meshitem src="attachmentIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="attachmentIcon" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="attachmentIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+    
+    <meshitem src="attachmentDetails" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+    <meshitem src="attachmentDetails" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+
+    <meshitem src="attachmentName" srcEdge="LEFT" dst="attachmentIcon" dstEdge="RIGHT"/>
+    <meshitem src="attachmentName" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+    <meshitem src="attachmentName" srcEdge="RIGHT" dst="attachmentDetails" dstEdge="LEFT"/>
+    
+  </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorattachment_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,20 @@
+
+MsgUnifiedEditorAttachment[state="normal"]::attachmentDetails
+{
+  color:var(qtc_list_item_title_normal);
+}
+
+MsgUnifiedEditorAttachment[state="pressed"]::attachmentDetails
+{
+  color:var(qtc_list_item_pressed);
+}
+
+MsgUnifiedEditorAttachment[state="normal"]::attachmentName
+{
+  color:var(qtc_list_item_title_normal);
+}
+
+MsgUnifiedEditorAttachment[state="pressed"]::attachmentName
+{
+  color:var(qtc_list_item_pressed);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,96 @@
+HbWidget {
+    margin-left: 0un;
+    margin-top: 0un;
+}
+
+/********************************* LAYOUTS ***********************************/
+MsgUnifiedEditorBody:portrait {
+	layout: layout-portrait;
+}
+
+MsgUnifiedEditorBody[hasImage="false"]:landscape {
+	layout: layout-landscape-no-image;
+}
+
+MsgUnifiedEditorBody[hasImage="true"]:landscape {
+	layout: layout-landscape-image;
+}
+
+/**************************** Text field margin ******************************/
+MsgUnifiedEditorBody::textEdit:portrait {
+    left: -var(hb-param-margin-gene-left);
+    right: var(hb-param-margin-gene-right);
+}
+
+MsgUnifiedEditorBody[hasImage="true"][hasAudio="true"]::textEdit:portrait {
+    top: -var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgUnifiedEditorBody[hasImage="true"][hasAudio="false"]::textEdit:portrait {
+    top: -var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgUnifiedEditorBody[hasImage="false"][hasAudio="true"]::textEdit:portrait {
+    top: -var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgUnifiedEditorBody[hasImage="false"][hasAudio="false"]::textEdit:portrait {
+    top: 0.0un;
+}
+
+MsgUnifiedEditorBody::textEdit:landscape {
+    right: var(hb-param-margin-gene-right);
+}
+
+MsgUnifiedEditorBody[hasImage="true"]::textEdit:landscape {
+    left: -1.0un;
+}
+
+MsgUnifiedEditorBody[hasImage="false"]::textEdit:landscape {
+    left: -var(hb-param-margin-gene-left);
+}
+
+MsgUnifiedEditorBody[hasAudio="true"]::textEdit:landscape {
+    top: -var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgUnifiedEditorBody[hasAudio="false"]::textEdit:landscape {
+    top: 0.0un;
+}
+
+/*************************** Image field margin ******************************/
+MsgUnifiedEditorBody::pixmap {
+    left: -var(hb-param-margin-gene-left);
+}
+
+MsgUnifiedEditorBody::pixmap:portrait {
+    right: var(hb-param-margin-gene-right);
+}
+
+MsgUnifiedEditorBody::pixmap:landscape {
+    right: 1.0un;
+}
+
+MsgUnifiedEditorBody[hasAudio="true"]::pixmap {
+    top: -var(hb-param-margin-gene-middle-vertical);
+}
+
+MsgUnifiedEditorBody[hasAudio="false"]::pixmap {
+    top: 0.0un;
+}
+
+/*************************** Audio field margin ******************************/
+
+MsgUnifiedEditorBody::audioItem {
+    left: -var(hb-param-margin-gene-left);
+    right: var(hb-param-margin-gene-right);
+}
+
+/*************************** Character Counter ******************************/
+MsgUnifiedEditorBody::charCounter
+{
+	  size-policy:fixed fixed;
+	  pref-height:-1;
+	  pref-width:-1;
+	  text-height:var(hb-param-text-height-tiny);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorbody.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,74 @@
+<hbwidget version="0.1">
+
+  <layout name="layout-portrait" type="mesh">     
+  
+     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
+     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
+     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
+     
+     <meshitem src="pixmap" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM"  />
+     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT"  />  
+     <meshitem src="pixmap" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />  
+     
+     <meshitem src="textEdit" srcEdge="TOP" dst="pixmap" dstEdge="BOTTOM" />
+     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+     
+    <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+    <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+
+    <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
+    <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
+    <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
+    <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
+     
+  </layout>
+  
+  <layout name="layout-landscape-no-image" type="mesh">     
+     
+     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
+     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
+     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
+
+     <meshitem src="textEdit" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM" />
+     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+     
+     <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+     <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+
+     <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
+     <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
+     <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
+     <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
+  
+  </layout>
+  
+  <layout name="layout-landscape-image" type="mesh">     
+     
+     <meshitem src="audioItem" srcEdge="TOP" dst="" dstEdge="TOP"  />
+     <meshitem src="audioItem" srcEdge="LEFT" dst="" dstEdge="LEFT"  />
+     <meshitem src="audioItem" srcEdge="RIGHT" dst="" dstEdge="RIGHT"  />
+
+     <meshitem src="textEdit" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM" />
+     <meshitem src="textEdit" srcEdge="LEFT" dst="" dstEdge="CENTERH" />
+     <meshitem src="textEdit" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+     <meshitem src="textEdit" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+     
+     <meshitem src="pixmap" srcEdge="TOP" dst="audioItem" dstEdge="BOTTOM"  />    
+     <meshitem src="pixmap" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+     <meshitem src="pixmap" srcEdge="RIGHT" dst="textEdit" dstEdge="LEFT" />
+
+     <meshitem src="charCounter" srcEdge="TOP" dst="textEdit" dstEdge="TOP" />
+     <meshitem src="charCounter" srcEdge="RIGHT" dst="textEdit" dstEdge="RIGHT" />
+
+     <meshitem src="charCounterFrame" srcEdge="LEFT" dst="charCounter" dstEdge="LEFT" />
+     <meshitem src="charCounterFrame" srcEdge="TOP" dst="charCounter" dstEdge="TOP" />
+     <meshitem src="charCounterFrame" srcEdge="RIGHT" dst="charCounter" dstEdge="RIGHT" />
+     <meshitem src="charCounterFrame" srcEdge="BOTTOM" dst="charCounter" dstEdge="BOTTOM" />    
+
+  </layout>
+  
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorsubject.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,21 @@
+HbWidget {
+    margin-left: 0un;
+    margin-top: 0un;
+}
+
+MsgUnifiedEditorSubject {
+    layout:layout-default;
+}
+
+MsgUnifiedEditorSubject::priorityIcon {
+    fixed-height: var(hb-param-graphic-size-secondary);
+    fixed-width: var(hb-param-graphic-size-secondary);
+    right: var(hb-param-margin-gene-right);
+    left: -0.5un;
+}
+
+MsgUnifiedEditorSubject::subjectEdit {
+    left: -var(hb-param-margin-gene-left);
+    min-height:7.46un;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/layouts/msgunifiededitorsubject.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,13 @@
+<hbwidget version="0.1">
+  <layout name="layout-default" type="mesh">
+
+     <meshitem src="subjectEdit" srcEdge="TOP" dst="" dstEdge="TOP" />
+     <meshitem src="subjectEdit" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+     <meshitem src="subjectEdit" srcEdge="RIGHT" dst="priorityIcon" dstEdge="LEFT" />
+     <meshitem src="" srcEdge="BOTTOM" dst="subjectEdit" dstEdge="BOTTOM" />
+     
+     <meshitem src="priorityIcon" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
+     <meshitem src="priorityIcon" srcEdge="CENTERV" dst="subjectEdit" dstEdge="CENTERV" />
+          
+  </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/resources/qtg_anim_loading.axml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,14 @@
+<animations>
+<icon name="qtg_anim_loading" frame_duration="50" playmode="loop">
+<frame>qtg_anim_loading_1</frame>
+<frame>qtg_anim_loading_2</frame>
+<frame>qtg_anim_loading_3</frame>
+<frame>qtg_anim_loading_4</frame>
+<frame>qtg_anim_loading_5</frame>
+<frame>qtg_anim_loading_6</frame>
+<frame>qtg_anim_loading_7</frame>
+<frame>qtg_anim_loading_8</frame>
+<frame>qtg_anim_loading_9</frame>
+<frame>qtg_anim_loading_10</frame>
+</icon>
+</animations>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_1.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0" x2="19.814" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="11.0552" x2="35.3105" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="url(#SVGID_2_)"/>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="0" x2="19.814" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="url(#SVGID_3_)"/>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="11.0552" x2="35.3105" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="url(#SVGID_4_)"/>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="#424242"/>
-<linearGradient gradientTransform="matrix(1 0 0 1 -1269.75 -3487.3887)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="1306.4873" x2="1311.042" y1="3494.2671" y2="3494.2671">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="41.3,6.9 36.7,13.8 36.7,0 41.3,6.9 "/>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="#424242"/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_2.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0" x2="19.814" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="11.0552" x2="35.3105" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="0" x2="19.814" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="url(#SVGID_4_)"/>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="#5AB85B"/>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="#424242"/>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="#424242"/>
-<linearGradient gradientTransform="matrix(0.7071 0.7071 -0.7071 0.7071 1584.3986 -3389.3784)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="1327.9453" x2="1332.5" y1="3487.8726" y2="3487.8726">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="60.3,19.1 52.2,20.8 62,11.1 60.3,19.1 "/>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="#5AB85B"/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_3.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0" x2="19.814" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="11.0552" x2="35.3105" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_3_)"/>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_4_)"/>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="#424242"/>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="#5AB85B"/>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="#5AB85B"/>
-<linearGradient gradientTransform="matrix(0 1 -1 0 3546.5811 -1312.6934)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="1349.4316" x2="1353.9863" y1="3481.4136" y2="3481.4136">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="65.2,41.3 58.3,36.7 72,36.7 65.2,41.3 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_4.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="11.0552" x2="35.3105" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_2_)"/>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_3_)"/>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="#5AB85B"/>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientTransform="matrix(-0.7071 0.7071 -0.7071 -0.7071 3493.6553 1560.1959)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="1367.8477" x2="1372.4023" y1="3493.5483" y2="3493.5483">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="52.9,60.3 51.3,52.2 61,62 52.9,60.3 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_5.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="#424242"/>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_1_)"/>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_2_)"/>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="36.7383" x2="60.9922" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientTransform="matrix(-1 0 0 -1 1424.6426 3552.2568)" gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="1389.332" x2="1393.8867" y1="3487.0864" y2="3487.0864">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_5_)" points="30.8,65.2 35.3,58.3 35.3,72 30.8,65.2 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_6.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="#424242"/>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_1_)"/>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="#5AB85B"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="11.0552" x2="35.3105" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="36.7383" x2="60.9922" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_5_)"/>
-<linearGradient gradientTransform="matrix(-0.7071 -0.7071 0.7071 -0.7071 -1461.6281 3526.3462)" gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="1409.8438" x2="1414.3984" y1="3497.7866" y2="3497.7866">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_6_)" points="11.5,52.9 19.6,51.3 9.9,61 11.5,52.9 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_7.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="#424242"/>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="0" x2="19.814" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="11.0552" x2="35.3105" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="36.7383" x2="60.9922" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="url(#SVGID_5_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_6_)"/>
-<linearGradient gradientTransform="matrix(0 -1 1 0 -3505.6865 1466.1221)" gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="1430.8135" x2="1435.3682" y1="3512.5659" y2="3512.5659">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_7_)" points="6.9,30.8 13.8,35.3 0,35.3 6.9,30.8 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_8.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0" x2="19.814" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="url(#SVGID_1_)"/>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="#424242"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="0" x2="19.814" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="11.0552" x2="35.3105" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="url(#SVGID_5_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="36.7383" x2="60.9922" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="url(#SVGID_6_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_7_)"/>
-<linearGradient gradientTransform="matrix(0.7071 -0.7071 0.7071 0.7071 -3490.3384 -1437.3785)" gradientUnits="userSpaceOnUse" id="SVGID_8_" x1="1452.3613" x2="1456.915" y1="3506.2817" y2="3506.2817">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<polygon fill="url(#SVGID_8_)" points="19.1,11.7 20.8,19.8 11.1,10.1 19.1,11.7 "/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/resources/qtg_anim_longtap_9.svg	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
-<svg baseProfile="tiny" height="75px" version="1.1" viewBox="-1.5 -1.6 75 75" width="75px" x="0px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" y="0px">
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_1_" x1="0" x2="19.814" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M13.8,35.3c0.2-5.6,2.4-10.7,6-14.5L10,11.1C4,17.4,0.2,25.9,0,35.3H13.8z" fill="url(#SVGID_1_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_2_" x1="11.0552" x2="35.3105" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M20.8,19.8c3.8-3.6,8.9-5.8,14.5-6V0c-9.4,0.2-17.9,4-24.3,10L20.8,19.8z" fill="url(#SVGID_2_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_3_" x1="36.7383" x2="60.9922" y1="9.9063" y2="9.9063">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M36.7,0v13.8c5.6,0.2,10.7,2.4,14.5,6L61,10C54.7,4,46.1,0.2,36.7,0z" fill="url(#SVGID_3_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_4_" x1="0" x2="19.814" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M19.8,51.2c-3.6-3.8-5.8-8.9-6-14.5H0C0.2,46.1,4,54.7,10,61L19.8,51.2z" fill="url(#SVGID_4_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_5_" x1="52.2354" x2="72.0469" y1="23.1826" y2="23.1826">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M52.2,20.8c3.6,3.8,5.8,8.9,6,14.5H72c-0.2-9.4-4-17.9-10-24.3L52.2,20.8z" fill="url(#SVGID_5_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_6_" x1="11.0552" x2="35.3105" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M35.3,58.2c-5.6-0.2-10.7-2.4-14.5-6L11.1,62c6.3,6.1,14.8,9.9,24.3,10V58.2z" fill="url(#SVGID_6_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_7_" x1="36.7383" x2="60.9922" y1="62.1421" y2="62.1421">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M51.2,52.2c-3.8,3.6-8.9,5.8-14.5,6V72c9.4-0.2,17.9-4,24.3-10L51.2,52.2z" fill="url(#SVGID_7_)"/>
-<linearGradient gradientUnits="userSpaceOnUse" id="SVGID_8_" x1="52.2354" x2="72.0469" y1="48.8647" y2="48.8647">
-<stop offset="0" style="stop-color:#3B87C0"/>
-<stop offset="1" style="stop-color:#0069B2"/>
-</linearGradient>
-<path d="M58.3,36.7L58.3,36.7c-0.2,5.6-2.5,10.7-6.1,14.5L62,61c6.1-6.3,9.9-14.8,10-24.3H58.3z" fill="url(#SVGID_8_)"/>
-</svg>
--- a/messagingapp/msgui/unifiededitor/src/msgattachmentcontainer.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,175 +0,0 @@
-/*
- * 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: attachment container class
- *
- */
-
-
-// INCLUDES
-#include <QGraphicsLinearLayout>
-#include <QFileInfo>
-#include <HbFrameItem>
-#include <HbFrameDrawer>
-
-// USER INCLUDES
-#include "msgattachmentcontainer.h"
-#include "unieditorgenutils.h"
-#include "msgmonitor.h"
-#include "mmsconformancecheck.h"
-
-// Constants
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::MsgAttachmentContainer
-// @see header file
-//---------------------------------------------------------------
-MsgAttachmentContainer::MsgAttachmentContainer( const QString& pluginPath, QGraphicsItem *parent ) :
-HbWidget(parent),
-mPluginPath(pluginPath),
-mIsMMContent(false)
-{
-    mLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
-    mLayout->setContentsMargins(0,0,0,0);
-    mLayout->setSpacing(0);
-    mMmsConformanceCheck = new MmsConformanceCheck;
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::~MsgAttachmentContainer
-// @see header file
-//---------------------------------------------------------------
-MsgAttachmentContainer::~MsgAttachmentContainer()
-{
-    delete mMmsConformanceCheck;
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::addAttachment
-// @see header file
-//---------------------------------------------------------------
-MsgAttachmentContainer::AddAttachmentStatus 
-    MsgAttachmentContainer::addAttachment(const QString& filepath)
-{
-    //check for insert conformance
-    if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(filepath))
-        return EAddNotSupported;
-
-    int msgSize = messageSize();
-    QFileInfo fileinfo(filepath);
-    int fileSize = fileinfo.size() + KEstimatedMimeHeaderSize;
-    
-    if( (fileSize + msgSize) <= MsgMonitor::maxMmsSize())
-    {
-        MsgUnifiedEditorAttachment* att = new MsgUnifiedEditorAttachment(
-            mPluginPath, filepath, fileSize, this);
-        if( ((mAttachmentList.count() == 0) && att->isMultimediaContent()) ||
-                ((mAttachmentList.count() == 1) && !mIsMMContent) )
-        {
-            mIsMMContent = true;
-        }
-        mAttachmentList << att;
-        int index = mLayout->count();
-        mLayout->insertItem(index,att);
-        connect(att, SIGNAL(deleteMe(MsgUnifiedEditorAttachment*)),
-            this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*)));
-
-        // emit to signal that container content & size changed
-        emit contentChanged();
-    }
-    else
-    {
-        return EAddSizeExceed;
-    }
-    return EAddSuccess;
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::deleteAttachment
-// @see header file
-//---------------------------------------------------------------
-void MsgAttachmentContainer::deleteAttachment(MsgUnifiedEditorAttachment* attachment)
-{
-    mAttachmentList.removeOne(attachment);
-    mLayout->removeItem(attachment);
-    attachment->setParent(NULL);
-    delete attachment;
-
-    if( ((mAttachmentList.count() == 1) && !mAttachmentList.first()->isMultimediaContent()) ||
-        ((mAttachmentList.count() == 0) && mIsMMContent) )
-    {
-        mIsMMContent = false;
-    }
-
-    // emit to indicate change in container content & size
-    emit contentChanged();
-    if(mAttachmentList.count() == 0)
-    {
-        emit emptyAttachmentContainer();
-    }
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::count
-// @see header file
-//---------------------------------------------------------------
-int MsgAttachmentContainer::count()
-{
-    return mAttachmentList.count();
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::attachmentList
-// @see header file
-//---------------------------------------------------------------
-MsgUnifiedEditorAttachmentList MsgAttachmentContainer::attachmentList()
-{
-    return mAttachmentList;
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::containerSize
-// @see header file
-//---------------------------------------------------------------
-int MsgAttachmentContainer::containerSize()
-{
-    int attCount = count();
-    int containerSize = 0;
-    
-    for(int i=0; i<attCount; i++)
-    {
-        containerSize += mAttachmentList.at(i)->size();
-    }
-    return containerSize;
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::messageSize
-// @see header file
-//---------------------------------------------------------------
-int MsgAttachmentContainer::messageSize()
-{
-    return containerSize() + MsgMonitor::bodySize() + MsgMonitor::subjectSize();
-}
-
-//---------------------------------------------------------------
-// MsgAttachmentContainer::hasMMContent
-// @see header file
-//---------------------------------------------------------------
-bool MsgAttachmentContainer::hasMMContent()
-{
-    return mIsMMContent;
-}
-
-//EOF
-
--- a/messagingapp/msgui/unifiededitor/src/msgmonitor.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-/*
- * 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: Helper class to monitor msg construction in unified editor
- *
- */
-
-// INCLUDES
-#include "debugtraces.h"
-#include <HbNotificationDialog>
-#include <HbWidget>
-
-// USER INCLUDES
-#include "msgmonitor.h"
-#include "msgunieditorview.h"
-#include "msgunieditoraddress.h"
-#include "msgunieditorsubject.h"
-#include "msgunieditorbody.h"
-#include "msgattachmentcontainer.h"
-#include "UniEditorGenUtils.h"
-
-// Constants
-
-// Define static
-ConvergedMessage::MessageType MsgMonitor::mMessageType;
-int MsgMonitor::mBodySize;
-int MsgMonitor::mContainerSize;
-int MsgMonitor::mSubjectSize;
-int MsgMonitor::mMaxMmsSize;
-int MsgMonitor::mMaxSmsRecipients;
-int MsgMonitor::mMaxMmsRecipients;
-
-//Localized strings
-#define LOC_POP_MESSAGE_CHANGE_MUL hbTrId("txt_messaging_dpopinfo_message_type_changed_to_mul")
-#define LOC_POP_MESSAGE_CHANGE_TEXT hbTrId("txt_messaging_dpopinfo_message_type_changed_to_tex")
-
-//---------------------------------------------------------------
-// MsgMonitor::MsgMonitor
-// @see header file
-//---------------------------------------------------------------
-MsgMonitor::MsgMonitor(QObject* parent) :
-QObject(parent),
-mSkipNote(false)
-{
-    init();
-    mUniEditorGenUtils = new UniEditorGenUtils;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::~MsgMonitor
-// @see header file
-//---------------------------------------------------------------
-MsgMonitor::~MsgMonitor()
-{
-    delete mUniEditorGenUtils;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::init
-// @see header file
-//---------------------------------------------------------------
-void MsgMonitor::init()
-{
-    mMessageType = ConvergedMessage::Sms;
-    mBodySize = 0;
-    mContainerSize = 0;
-    mSubjectSize = 0;
-
-    UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
-
-    mMaxMmsSize = KDefaultMaxSize;
-    TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL());
-
-    mMaxSmsRecipients = KDefaultSmsRecipients;
-    TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL());
-
-    mMaxMmsRecipients = KDefaultMmsRecipients;
-    TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL());
-
-    delete uniEditorGenUtils;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::checkMsgTypeChange
-// @see header file
-//---------------------------------------------------------------
-void MsgMonitor::checkMsgTypeChange()
-{
-    // fetch editor's content 
-    MsgUnifiedEditorBody* edBody = view()->mBody;
-    QStringList objList = edBody->mediaContent();
-    QString bodyText = edBody->text();
-    
-    MsgUnifiedEditorSubject* edSubject = view()->mSubjectField;
-    ConvergedMessage::Priority priority = ConvergedMessage::Normal;
-    QString subjectText;
-    if(edSubject)
-    {
-        priority = edSubject->priority();
-        subjectText = edSubject->text();
-    }
-
-    MsgUnifiedEditorAddress* edCc = view()->mCcField;
-    MsgUnifiedEditorAddress* edBcc = view()->mBccField;
-    int ccCount = 0;
-    int bccCount = 0;
-    if(edCc && edBcc)
-    {
-        ccCount = edCc->addressCount();
-        bccCount = edBcc->addressCount();
-    }
-    
-    MsgAttachmentContainer* edContainer = view()->mAttachmentContainer;
-    bool hasMMAttachmentContent = false;
-    int attachmentCount = 0;
-    if(edContainer)
-    {
-        hasMMAttachmentContent = edContainer->hasMMContent();
-        attachmentCount = edContainer->count();
-    }
-
-    // find out the msgtype based on content
-    ConvergedMessage::MessageType projectedMsgType = ConvergedMessage::Sms;
-
-    // check for presence of MMS content
-    // 1. If any media-object is present inside body
-    // 2. If priority is set to other than Normal
-    // 3. If subject has some content
-    // 4. If CC/BCC has some content
-    // 5. If MM attachments are present
-    // 6. If only one non-MM attachment is present e.g. vcf 
-    //    and body text is also present
-    // 7. If body text size exceeds sms text-size limit
-    if( !objList.isEmpty() || 
-        (priority != ConvergedMessage::Normal) || 
-        !subjectText.isEmpty() ||
-        (ccCount || bccCount) ||
-        hasMMAttachmentContent ||
-        ((attachmentCount == 1) && !bodyText.isEmpty())
-      )
-    {
-        projectedMsgType = ConvergedMessage::Mms;
-    }
-    else
-    {
-        projectedMsgType = ConvergedMessage::Sms;
-    }
-
-    // optimization 1: if projected type is still sms means
-    // the message under composition has only plain text
-    if(projectedMsgType == ConvergedMessage::Sms)
-    {
-        bool hasUnicodeText = edBody->isUnicode();
-        int bodyTextSize = mUniEditorGenUtils->UTF8Size(bodyText);
-        int maxSmsSize = mUniEditorGenUtils->MaxSmsMsgSizeL(hasUnicodeText);
-        if(bodyTextSize > maxSmsSize)
-        {
-            projectedMsgType = ConvergedMessage::Mms;
-        }
-    }
-        
-    // show type change note, if needed
-    if(mMessageType != projectedMsgType)
-    {
-        mMessageType = projectedMsgType;
-        QString noteStr;
-        if(projectedMsgType == ConvergedMessage::Sms)
-        {
-            noteStr = LOC_POP_MESSAGE_CHANGE_TEXT;
-        }
-        else
-        {
-            noteStr = LOC_POP_MESSAGE_CHANGE_MUL;
-            
-            //Disable char counter
-            edBody->disableCharCounter();
-        }
-        showPopup(noteStr);
-    }
-    
-    // update size of editor component
-    HbWidget* senderWidget = qobject_cast<HbWidget*>(sender());
-    updateSizeInfo(senderWidget);
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::updateSizeInfo
-// @see header file
-//---------------------------------------------------------------
-void MsgMonitor::updateSizeInfo(HbWidget* aWidget)
-{
-    // if sent by body widget
-    MsgUnifiedEditorBody* body = NULL;    
-    body = qobject_cast<MsgUnifiedEditorBody*>(aWidget);
-    if(body)
-    {
-        mBodySize = view()->mBody->bodySize();
-        return;
-    }
-    
-    // if sent by attachment container widget
-    MsgAttachmentContainer* container = NULL;
-    container = qobject_cast<MsgAttachmentContainer*>(aWidget);
-    if(container)
-    {
-        mContainerSize = view()->mAttachmentContainer->containerSize();
-        return;
-    }
-
-    // if sent by subject widget
-    MsgUnifiedEditorSubject* subject = NULL;
-    subject = qobject_cast<MsgUnifiedEditorSubject*>(aWidget);
-    if(subject)
-    {
-        mSubjectSize = view()->mSubjectField->subjectSize();
-    }
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::showPopup
-// @see header file
-//---------------------------------------------------------------
-void MsgMonitor::showPopup(const QString& text)
-{
-    if(!mSkipNote)
-    {
-        HbNotificationDialog* dlg = new HbNotificationDialog();
-        dlg->setFocusPolicy(Qt::NoFocus);
-        dlg->setDismissPolicy(HbPopup::TapAnywhere);
-        dlg->setAttribute(Qt::WA_DeleteOnClose, true);
-        dlg->setText(text);
-        dlg->show();
-    }
-    // reset skip note flag
-    mSkipNote = false;
-}
-
-//---------------------------------------------------------------
-// MsgMonitor::view
-// @see header file
-//---------------------------------------------------------------
-MsgUnifiedEditorView* MsgMonitor::view()
-{
-    return static_cast<MsgUnifiedEditorView*>(this->parent());
-}
-
-//EOF
--- a/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraddress.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -16,40 +16,55 @@
  */
 
 // INCLUDES
-#include "debugtraces.h"
+#include <QTimer>
 #include <HbTextItem>
 #include <HbPushButton>
 #include <HbAction>
-#include <hbinputeditorinterface.h>
+#include <hbmessagebox.h>
 #include <cntservicescontact.h>
 #include <xqaiwrequest.h>
 #include <xqappmgr.h>
 #include <telconfigcrkeys.h>        // KCRUidTelephonyConfiguration
 #include <centralrepository.h>
+#include <HbNotificationDialog>
+#include <commonphoneparser.h>      // Common phone number validity checker
+#include <xqconversions.h>
 
 // USER INCLUDES
+#include "debugtraces.h"
 #include "msgunieditoraddress.h"
-#include "msgunifiededitorlineedit.h"
+#include "msgunieditorlineedit.h"
+#include "msgunieditormonitor.h"
+#include "UniEditorGenUtils.h"
 
 const QString PBK_ICON("qtg_mono_contacts");
-const QString SEND_ICON("qtg_mono_send");
+const QString REPLACEMENT_STR("; ");
+const QString COMMA_SEPERATOR(",");
 
 // Constants
 const int KDefaultGsmNumberMatchLength = 7;  //matching unique ph numbers
+#define LOC_SMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dialog_number_of_recipients_exceeded")
+#define LOC_MMS_RECIPIENT_LIMIT_REACHED hbTrId("txt_messaging_dpopinfo_unable_to_add_more_recipien")
+#define LOC_DIALOG_OK hbTrId("txt_common_button_ok")
+#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
+#define LOC_INVALID_RECIPIENT hbTrId("txt_messaging_dialog_invalid_recipient_found")
+#define LOC_INVALID_RECIPIENT_NOT_ADDED hbTrId("txt_messaging_dialog_invalid_recipient_not_added")
+#define LOC_INVALID_RECIPIENTS_NOT_ADDED hbTrId("txt_messaging_dialog_invalid_recipients_not_added")
+
+
+
+
 
 MsgUnifiedEditorAddress::MsgUnifiedEditorAddress( const QString& label,
-                                                  const QString& pluginPath,
                                                   QGraphicsItem *parent ) :
-HbWidget(parent),
-mPluginPath(pluginPath)
+MsgUnifiedEditorBaseWidget(parent),
+mSkipMaxRecipientQuery(false),
+mAboutToExceedMaxSmsRecipients(false),
+mAboutToExceedMaxMmsRecipients(false),
+mExceedsMaxMmsRecipientsBy(0)
 {
-    #ifdef _DEBUG_TRACES_
-    qDebug() << "MsgUnifiedEditorAddress calling HbStyle::registerPlugin";
-    #endif
+    this->setContentsMargins(0,0,0,0);
 
-    this->setContentsMargins(0,0,0,0);
-    setPluginBaseId(style()->registerPlugin(mPluginPath));
-    
     mLaunchBtn = new HbPushButton(this);
     HbStyle::setItemName(mLaunchBtn,"launchBtn");
     connect(mLaunchBtn,SIGNAL(clicked()),this,SLOT(fetchContacts()));
@@ -61,24 +76,22 @@
 
     mAddressEdit->setMaxRows(40);
     connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
-            this, SLOT(onContentsAdded(const QString&)));
+            this, SLOT(onContentsChanged(const QString&)));
 
-    // add "Send" action in VKB
-    HbEditorInterface editorInterface(mAddressEdit);
     mAddressEdit->setInputMethodHints(Qt::ImhPreferNumbers);
-    HbAction *sendAction = new HbAction(HbIcon(SEND_ICON), QString(),this);
-    connect(sendAction, SIGNAL(triggered()),this, SIGNAL(sendMessage()));
-    editorInterface.addAction(sendAction);
-    
-    }
+}
 
 MsgUnifiedEditorAddress::~MsgUnifiedEditorAddress()
 {
-    style()->unregisterPlugin(mPluginPath);
+	//TODO: Should remove this code depending on orbit's reply whether it is needed
+	//to unregister the same plugin registered on two different widgets twice.
+    //style()->unregisterPlugin(mPluginPath);
 }
 
 void MsgUnifiedEditorAddress::fetchContacts()
 {
+    mLaunchBtn->blockSignals(true);
+
     QList<QVariant> args;
     QString serviceName("com.nokia.services.phonebookservices");
     QString operation("fetch(QString,QString,QString)");
@@ -87,39 +100,48 @@
     request = appManager.create(serviceName, "Fetch", operation, true); // embedded
     if ( request == NULL )
         {
-        return;       
+        return;
         }
 
     // Result handlers
     connect (request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
     connect (request, SIGNAL(requestError(int,const QString&)), this, SLOT(handleError(int,const QString&)));
-    
-    args << QString(tr("Phonebook")); 
+
+    args << QString(tr("Phonebook"));
     args << KCntActionAll;
     args << KCntFilterDisplayAll;
-    
+
     request->setArguments(args);
     request->send();
     delete request;
+
+    //unblock click signal after some delay.
+    QTimer::singleShot(250,this,SLOT(unblockSignals()));
 }
 
 void MsgUnifiedEditorAddress::handleOk(const QVariant& value)
 {
-   CntServicesContactList contactList;
-    contactList = qVariantValue<CntServicesContactList>(value);
+   CntServicesContactList contactList =
+           qVariantValue<CntServicesContactList>(value);
+    int count = contactList.count();
 
-    for(int i = 0; i < contactList.count(); i++ )
+    ConvergedMessageAddressList addrlist;
+    for(int i = 0; i < count; i++ )
     {
-        mAddressMap.insert(contactList[i].mPhoneNumber, contactList[i].mDisplayName);
-        if(!contactList[i].mDisplayName.isEmpty())
+        ConvergedMessageAddress* address =
+                new ConvergedMessageAddress();
+        if(!contactList[i].mPhoneNumber.isEmpty())
         {
-            mAddressEdit->setText(contactList[i].mDisplayName);
+            address->setAddress(contactList[i].mPhoneNumber);
         }
         else
         {
-            mAddressEdit->setText(contactList[i].mPhoneNumber);
+            address->setAddress(contactList[i].mEmailAddress);
         }
+        address->setAlias(contactList[i].mDisplayName);
+        addrlist << address;
     }
+    setAddresses(addrlist);
 }
 
 void MsgUnifiedEditorAddress::handleError(int errorCode, const QString& errorMessage)
@@ -128,31 +150,47 @@
     Q_UNUSED(errorCode)
 }
 
-ConvergedMessageAddressList MsgUnifiedEditorAddress::addresses()
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::addresses
+// @see header
+// ----------------------------------------------------------------------------
+ConvergedMessageAddressList MsgUnifiedEditorAddress::addresses(
+        bool removeDuplicates)
 {
-    #ifdef _DEBUG_TRACES_
-    qCritical() << "MsgUnifiedEditorAddress::address start";
+#ifdef _DEBUG_TRACES_
+    qCritical() << "MsgUnifiedEditorAddress::addresses start";
 #endif
     // sync-up map to account for user-actions on edit-field
     syncDeletionsToMap();
     syncAdditionsToMap();
 
-    QStringList uniqueAddr;
-    uniqueAddr = uniqueAddressList();
-
     ConvergedMessageAddressList addresses;
-    foreach(QString addr, uniqueAddr)
+    if(removeDuplicates)
     {
-        ConvergedMessageAddress* address = new ConvergedMessageAddress;
-        address->setAddress(addr);
-        if(!mAddressMap.value(addr).isEmpty())
+        QStringList uniqueAddr;
+        uniqueAddr = uniqueAddressList();
+        foreach(QString addr, uniqueAddr)
         {
+            ConvergedMessageAddress* address = new ConvergedMessageAddress;
+            address->setAddress(addr);
             address->setAlias(mAddressMap.value(addr));
-         }
-        addresses.append(address);
+            addresses.append(address);
+        }
     }
-    #ifdef _DEBUG_TRACES_
-    qCritical() << "MsgUnifiedEditorAddress::address end";
+    else
+    {
+        QMap<QString, QString>::iterator i = mAddressMap.begin();
+        while (i != mAddressMap.end())
+        {
+            ConvergedMessageAddress* address = new ConvergedMessageAddress;
+            address->setAddress(i.key());
+            address->setAlias(i.value());
+            addresses.append(address);
+            i++;
+        }
+    }
+#ifdef _DEBUG_TRACES_
+    qCritical() << "MsgUnifiedEditorAddress::addresses end";
 #endif
     return addresses;
 }
@@ -164,60 +202,177 @@
 
 void MsgUnifiedEditorAddress::setAddresses(ConvergedMessageAddressList addrlist)
 {
-	int count = addrlist.count();
-    for(int i = 0; i < count; i++ )
+    // avoid processing if no info available
+    if(addrlist.count() == 0)
     {
-        mAddressMap.insert(addrlist[i]->address(), addrlist[i]->alias());
-        if(!addrlist[i]->alias().isEmpty())
+        return;
+    }
+
+    // ensure flags are reset before starting the addr addition
+    mAboutToExceedMaxSmsRecipients = false;
+    mAboutToExceedMaxMmsRecipients = false;
+    mExceedsMaxMmsRecipientsBy = 0;
+
+    // first, we check if MMS max-recipient count will exceed
+    int count = addrlist.count();
+	int futureCount = count + MsgUnifiedEditorMonitor::msgAddressCount();
+	if(futureCount > MsgUnifiedEditorMonitor::maxMmsRecipients())
+	{
+	    mAboutToExceedMaxMmsRecipients = true;
+	    mExceedsMaxMmsRecipientsBy =
+	            futureCount - MsgUnifiedEditorMonitor::maxMmsRecipients();
+	}
+	// else, check if SMS max-recipient count will exceed
+	else if(!mSkipMaxRecipientQuery)
+	{
+	    futureCount = count + addressCount();
+	    if( (addressCount() <= MsgUnifiedEditorMonitor::maxSmsRecipients()) &&
+	        (futureCount > MsgUnifiedEditorMonitor::maxSmsRecipients()) )
+	    {
+	        mAboutToExceedMaxSmsRecipients = true;
+	    }
+	}
+
+	int  invalidCount= 0;
+    QString invalidContacts;
+    for(int i = 0; i < count; i++ )
         {
-            mAddressEdit->setText(addrlist[i]->alias());
-        }
-        else
+        bool isValid = false;
+        isValid = checkValidAddress(addrlist.at(i)->address());
+        if(!isValid)
+           {
+            invalidCount ++;
+            // append the comma till last but one contact.
+            // add the invalid ocntacts to the " , " seperated string.
+            if(invalidCount > 1)
+                {
+                invalidContacts.append(COMMA_SEPERATOR);
+                }
+            invalidContacts.append(addrlist.at(i)->alias());
+           }
+       else
+           {
+           mAddressMap.insertMulti(addrlist[i]->address(), addrlist[i]->alias());
+           if(!addrlist[i]->alias().isEmpty())
+              {
+              mAddressEdit->setText(addrlist[i]->alias());
+              }
+           else
+              {
+              mAddressEdit->setText(addrlist[i]->address(), false);
+              }
+           }
+       }
+    if(invalidCount)
         {
-            mAddressEdit->setText(addrlist[i]->address());
+        QString invalidStr;
+        (invalidCount == 1)?(invalidStr = QString(LOC_INVALID_RECIPIENT_NOT_ADDED)) :(invalidStr = QString(LOC_INVALID_RECIPIENTS_NOT_ADDED));
+        // append line seperator
+         invalidStr.append("<br>");
+         invalidStr.append(invalidContacts);
+         HbMessageBox::information(invalidStr);
         }
-    }
+
+    // addition operation complete, reset flags
+    mAboutToExceedMaxSmsRecipients = false;
+    mAboutToExceedMaxMmsRecipients = false;
+    mExceedsMaxMmsRecipientsBy = 0;
 }
 
 int MsgUnifiedEditorAddress::contactMatchDigits()
-    {
+{
     // Read the amount of digits to be used in contact matching
-    // The key is owned by PhoneApp    
-    CRepository* repository = CRepository::NewLC(KCRUidTelConfiguration);
+    // The key is owned by PhoneApp
     int matchDigitCount = 0;
-    if ( repository->Get(KTelMatchDigits, matchDigitCount) == KErrNone )
+    TRAP_IGNORE(
+        CRepository* repository = CRepository::NewLC(KCRUidTelConfiguration);
+        if ( repository->Get(KTelMatchDigits, matchDigitCount) == KErrNone )
         {
-    // Min is 7
-    matchDigitCount = Max(matchDigitCount, KDefaultGsmNumberMatchLength);
+            // Min is 7
+            matchDigitCount = Max(matchDigitCount, KDefaultGsmNumberMatchLength);
         }
-    CleanupStack::PopAndDestroy(); // repository
-
+        CleanupStack::PopAndDestroy(); // repository
+    );
     return matchDigitCount;
+}
 
-    }
-   
-void MsgUnifiedEditorAddress::onContentsAdded(const QString& text)
+void MsgUnifiedEditorAddress::onContentsChanged(const QString& text)
 {
-    if(!text.isEmpty())
+    // Max MMS recipient count check
+    if( mAboutToExceedMaxMmsRecipients ||
+        (MsgUnifiedEditorMonitor::msgAddressCount() >= MsgUnifiedEditorMonitor::maxMmsRecipients()) )
     {
+        if(mAboutToExceedMaxMmsRecipients)
+        {// show discreet note only once
+            --mExceedsMaxMmsRecipientsBy;
+            if(!mExceedsMaxMmsRecipientsBy)
+            {
+                HbNotificationDialog::launchDialog(
+                        LOC_MMS_RECIPIENT_LIMIT_REACHED);
+            }
+            resetToPrevious();
+        }
+        else
+        {
+            // update monitor data
+            emit contentChanged();
+            if(MsgUnifiedEditorMonitor::msgAddressCount() > MsgUnifiedEditorMonitor::maxMmsRecipients())
+            {
+                HbNotificationDialog::launchDialog(
+                        LOC_MMS_RECIPIENT_LIMIT_REACHED);
+                resetToPrevious();
+                // reset monitor data
+                emit contentChanged();
+            }
+            else
+            {
+                mPrevBuffer = text;
+            }
+        }
+        return;
+    }
+
+    // Max SMS recipient count check
+    if( !mSkipMaxRecipientQuery &&
+        (MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Sms) &&
+        (mAddressEdit->addresses().count() > MsgUnifiedEditorMonitor::maxSmsRecipients()) )
+    {
+        // when we show this dialog, we don't want the intermediate states
+        // to be signalled to us
         disconnect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsAdded(const QString&)));
+                this, SLOT(onContentsChanged(const QString&)));
+        QTimer::singleShot(50, this, SLOT(handleRecipientLimitReached()));
+    }
+    else
+    {
+        if(!mAboutToExceedMaxSmsRecipients)
+        {// remember addresses before the block insertion started
+            mPrevBuffer = text;
+        }
         emit contentChanged();
-        connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsRemoved(const QString&)));
     }
 }
 
-void MsgUnifiedEditorAddress::onContentsRemoved(const QString& text)
+void MsgUnifiedEditorAddress::handleRecipientLimitReached()
 {
-    if(text.isEmpty())
-    {
-        disconnect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsRemoved(const QString&)));
-        emit contentChanged();
-        connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsAdded(const QString&)));
-    }
+    HbMessageBox* dlg = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
+    dlg->setAttribute(Qt::WA_DeleteOnClose);
+    dlg->setFocusPolicy(Qt::NoFocus);
+    dlg->setTimeout(HbPopup::NoTimeout);
+
+    dlg->setText(LOC_SMS_RECIPIENT_LIMIT_REACHED);
+    
+    dlg->clearActions();
+    HbAction* okAction = new HbAction(LOC_DIALOG_OK,dlg);
+    dlg->addAction(okAction);
+
+    HbAction* cancelAction = new HbAction(LOC_BUTTON_CANCEL,dlg);
+    dlg->addAction(cancelAction);
+
+    dlg->open(this,SLOT(onMaxRecipientsReached(HbAction*)));
+    // reconnect to get back updates
+    connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
+            this, SLOT(onContentsChanged(const QString&)));
 }
 
 void MsgUnifiedEditorAddress::syncDeletionsToMap()
@@ -236,6 +391,18 @@
         }
         else
         {
+            // ensure that the matched contact is removed from the
+            // address's list
+            int matchedIndex = addrList.indexOf(i.value());
+            if(matchedIndex == -1)
+            {
+                matchedIndex = addrList.indexOf(i.key());
+            }
+            if(matchedIndex != -1)
+            {
+                addrList.removeAt(matchedIndex);
+            }
+            // now go to next index in map
             ++i;
         }
     }
@@ -243,19 +410,19 @@
 
 void MsgUnifiedEditorAddress::syncAdditionsToMap()
 {
-    QStringList mapAddrList = mAddressMap.values();
-
     // remove already mapped addresses from edit-field
     QStringList userInputAddrList(mAddressEdit->addresses());
+    QStringList mapAddrList = mAddressMap.values();
+    mapAddrList << mAddressMap.keys();
     foreach(QString addr, mapAddrList)
     {
-        userInputAddrList.removeAll(addr);
+        userInputAddrList.removeOne(addr);
     }
 
     // add the unmapped addresses to address-map
     foreach(QString addr, userInputAddrList)
     {
-        mAddressMap.insertMulti(addr, addr);
+        mAddressMap.insertMulti(addr, QString());
     }
 }
 
@@ -267,7 +434,7 @@
     {
         for(int i =j+1;i<mapAddrList.count();i++)
         {
-            if(0 == mapAddrList[j].right(matchDigitCount).compare(mapAddrList[i].right(matchDigitCount)))     
+            if(0 == mapAddrList[j].right(matchDigitCount).compare(mapAddrList[i].right(matchDigitCount)))
             {
                mapAddrList.removeAt(i);
                i--;
@@ -276,6 +443,148 @@
     }
     return mapAddrList;
 }
+
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::skipMaxRecipientQuery
+// @see header
+// ----------------------------------------------------------------------------
+void MsgUnifiedEditorAddress::skipMaxRecipientQuery(bool skip)
+{
+    mSkipMaxRecipientQuery = skip;
+}
+
+void MsgUnifiedEditorAddress::setFocus()
+{
+    mAddressEdit->setFocus(Qt::MouseFocusReason);
+}
+
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::resetToPrevious
+// @see header
+// ----------------------------------------------------------------------------
+void MsgUnifiedEditorAddress::resetToPrevious()
+{
+    // when we do this reset operation, we don't want the intermediate states
+    // to be signalled to us
+    disconnect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
+            this, SLOT(onContentsChanged(const QString&)));
+
+    mAddressEdit->clearContent();
+    QStringList list = mPrevBuffer.split(REPLACEMENT_STR,
+            QString::SkipEmptyParts);
+    int count = list.count();
+    QStringList valList = mAddressMap.values();
+    for(int i=0; i<count; i++)
+    {
+        QString addr = list.at(i);
+        if(valList.contains(addr))
+        {
+            mAddressEdit->setText(addr);
+        }
+        else
+        {
+            mAddressEdit->setText(addr, false);
+        }
+    }
+    syncDeletionsToMap();
+    connect(mAddressEdit, SIGNAL(contentsChanged(const QString&)),
+            this, SLOT(onContentsChanged(const QString&)));
+}
+
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::onMaxRecipientsReached
+// @see header
+// ----------------------------------------------------------------------------
+void MsgUnifiedEditorAddress::onMaxRecipientsReached(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        // accept new content, update prev-buffer
+        emit contentChanged();
+        mPrevBuffer = mAddressEdit->content();
+    }
+    else {
+        // reject the new content, keep the old
+        resetToPrevious();
+    }
+}
+
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::validateContacts
+// @see header
+// ----------------------------------------------------------------------------
+bool MsgUnifiedEditorAddress::validateContacts()
+{
+    UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+
+    // sync-up map to account for user-actions on address-field
+    syncDeletionsToMap();
+    syncAdditionsToMap();
+
+    // get the list of contacts in address-field
+    QStringList fieldAddresses(mAddressEdit->addresses());
+
+    bool isValid = true;
+    foreach(QString addr, fieldAddresses)
+    {
+        // run address validation only if address is unmapped
+        // (i.e. user-inserted)
+        if(mAddressMap.contains(addr))
+        {
+        isValid = checkValidAddress(addr);
+            if(!isValid)
+            {
+                mAddressEdit->highlightInvalidString(addr);
+                QString invalidAddrStr =
+                        QString(LOC_INVALID_RECIPIENT).arg(addr);
+                HbMessageBox* dlg = new HbMessageBox(invalidAddrStr,
+                        HbMessageBox::MessageTypeInformation);
+                dlg->setDismissPolicy(HbPopup::TapInside);
+                dlg->setTimeout(HbPopup::NoTimeout);
+                dlg->setAttribute(Qt::WA_DeleteOnClose, true);
+                dlg->open(this, SLOT(handleInvalidContactDialog(HbAction*)));
+                break;
+            }
+        }
+    }
+
+    return isValid;
+}
+// ----------------------------------------------------------------------------
+// MsgUnifiedEditorAddress::checkValidAddress
+// @see header
+// ----------------------------------------------------------------------------
+bool MsgUnifiedEditorAddress::checkValidAddress(const QString& addr)
+    {
+    bool isValid = false;
+    // 1. perform number validation
+    isValid = CommonPhoneParser::IsValidPhoneNumber(
+            *XQConversions::qStringToS60Desc(addr),
+            CommonPhoneParser::ESMSNumber );
+
+    // 2. if number validity fails, then perform email addr validation
+    UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+    if(!isValid)
+        { // additional check for MMS only
+        isValid = genUtils->IsValidEmailAddress(
+                    *XQConversions::qStringToS60Desc(addr) );
+        }
+    delete genUtils;
+    return isValid;
+    }
+
+void MsgUnifiedEditorAddress::handleInvalidContactDialog(
+        HbAction* act)
+{
+    Q_UNUSED(act);
+    QTimer::singleShot(250, this, SLOT(setFocus()));
+}
+
+void MsgUnifiedEditorAddress::unblockSignals()
+{
+    mLaunchBtn->blockSignals(false);
+}
+
 Q_IMPLEMENT_USER_METATYPE(CntServicesContact)
 Q_IMPLEMENT_USER_METATYPE_NO_OPERATORS(CntServicesContactList)
 
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachment.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,15 +25,19 @@
 #include <HbMenu>
 #include <MsgMimeTypes.h>
 #include <HbFrameItem>
-#include <HbGestureSceneFilter>
-#include <HbGesture>
+#include <HbInstantFeedback>
+#include <HbTapGesture>
 #include <QGraphicsSceneMouseEvent>
 #include <HbWidgetFeedback>
+#include <HbEffect>
+#include <QTimer>
 
 // USER INCLUDES
+#include "msgcontactsutil.h"
 #include "msgunieditorattachment.h"
-#include "unieditorgenutils.h"
-#include "s60qconversions.h"
+#include "UniEditorGenUtils.h"
+#include <xqconversions.h>
+#include "msgunieditorutils.h"
 
 // Constants
 #define BYTES_TO_KBYTES_FACTOR 1024
@@ -49,82 +53,71 @@
 
 const QString ATTACHMENT_ICON("qtg_small_attachment");
 
-MsgUnifiedEditorAttachment::MsgUnifiedEditorAttachment( const QString& pluginPath,
-                                                        const QString& attachmentpath,
+MsgUnifiedEditorAttachment::MsgUnifiedEditorAttachment( const QString& attachmentpath,
                                                         const int filesize,
                                                         QGraphicsItem *parent ) :
 HbWidget(parent),
-mPluginPath(pluginPath),
 mPath(attachmentpath),
 mSize(filesize),
-mMimeType(QString()),
 mAttachmentIcon(0),
 mAttachmentName(0),
-mGestureFilter(0),
-mMaxSmsSize(KFirstNormalSmsLength)
+mMaxSmsSize(KFirstNormalSmsLength),
+mEditorUtils(0)
 {
-#ifdef _DEBUG_TRACES_
-    qDebug() << "MsgUnifiedEditorAttachment calling HbStyle::registerPlugin";
-#endif
+    this->grabGesture(Qt::TapGesture);
+    setProperty("state", "normal");
     
-        setPluginBaseId(style()->registerPlugin(mPluginPath));
-		     
-        //back ground
-        HbFrameItem* backGround = new HbFrameItem(this);
-        backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL);
-        backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-        this->setBackgroundItem(backGround);        
+    //back ground
+    mBackGround = new HbFrameItem(this);
+    mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL);
+    mBackGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
+    this->setBackgroundItem(mBackGround);        
 
-        mAttachmentIcon = new HbIconItem(ATTACHMENT_ICON, this);
-        HbStyle::setItemName(mAttachmentIcon,"attachmentIcon");
+    mAttachmentIcon = new HbIconItem(ATTACHMENT_ICON, this);
+    HbStyle::setItemName(mAttachmentIcon,"attachmentIcon");
 
-        int at_size = 0;
-        TMsgMediaType mediaType = EMsgMediaUnknown;
-        UniEditorGenUtils* genUtils = new UniEditorGenUtils;
-        TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size,
-                                           mMimeType,mediaType));
-        TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL()); 
-        delete genUtils;
-        QFileInfo fileinfo(attachmentpath);
-        QString filename = fileinfo.fileName();
-        mAttachmentName = new HbTextItem(filename,this);
-        HbStyle::setItemName(mAttachmentName,"attachmentName");
-        mAttachmentName->setElideMode(Qt::ElideRight);
-        
-        // for sms, pure size should be shown
-        // for mms, additional mimeheader size must be included
-        qreal displaySize = mSize;
-        if(!isMultimediaContent())
-        {
-            displaySize = fileinfo.size();
-        }
-        int sizeInKb = displaySize/BYTES_TO_KBYTES_FACTOR;
-        QString fileDetails;
-        // if size exceeds 1kb, then show kb or else only bytes
-        if(sizeInKb >= 1)
-        {
-            fileDetails = QString().append(QString("(%1 Kb)").arg(sizeInKb));
-        }
-        else
-        {
-            fileDetails = QString().append(QString("(%1 B)").arg(displaySize));
-        }
+    int at_size = 0;
+    TMsgMediaType mediaType = EMsgMediaUnknown;
+    UniEditorGenUtils* genUtils = new UniEditorGenUtils;
+    TRAP_IGNORE(genUtils->getFileInfoL(mPath,at_size,
+        mMimeType,mediaType));
+    TRAP_IGNORE(mMaxSmsSize = genUtils->MaxSmsMsgSizeL()); 
+    delete genUtils;
+    QFileInfo fileinfo(attachmentpath);
+    QString filename = fileinfo.fileName();
+    mAttachmentName = new HbTextItem(filename,this);
+    HbStyle::setItemName(mAttachmentName,"attachmentName");
+    mAttachmentName->setElideMode(Qt::ElideRight);
 
-        mAttachmentDetails = new HbTextItem(fileDetails, this);
-        HbStyle::setItemName(mAttachmentDetails,"attachmentDetails");
-        mAttachmentDetails->setElideMode(Qt::ElideNone);
-        
-        initGesture();
+    // for sms, pure size should be shown
+    // for mms, additional mimeheader size must be included
+    qreal displaySize = mSize;
+    if(!isMultimediaContent())
+    {
+        displaySize = fileinfo.size();
+    }
+    int sizeInKb = displaySize/BYTES_TO_KBYTES_FACTOR;
+    QString fileDetails;
+    // if size exceeds 1kb, then show kb or else only bytes
+    if(sizeInKb >= 1)
+    {
+        fileDetails = QString().append(QString("(%1 Kb)").arg(sizeInKb));
+    }
+    else
+    {
+        fileDetails = QString().append(QString("(%1 B)").arg(displaySize));
+    }
+
+    mAttachmentDetails = new HbTextItem(fileDetails, this);
+    HbStyle::setItemName(mAttachmentDetails,"attachmentDetails");
+    mAttachmentDetails->setElideMode(Qt::ElideNone);
+    
+    HbEffect::add("attachmentWidget", "listviewitem_press", "pressed");
+    HbEffect::add("attachmentWidget", "listviewitem_release", "released");
 }
 
 MsgUnifiedEditorAttachment::~MsgUnifiedEditorAttachment()
 {
-    style()->unregisterPlugin(mPluginPath);
-    
-    if(mGestureFilter)
-        {
-        removeSceneEventFilter(mGestureFilter);
-        }
 }
 
 const QString& MsgUnifiedEditorAttachment::path()
@@ -142,11 +135,11 @@
     return mMimeType;
 }
 
-void MsgUnifiedEditorAttachment::longPressed(QPointF position)
+void MsgUnifiedEditorAttachment::handleLongTap(QPointF position)
 {
     HbMenu* menu = new HbMenu;
-    menu->addAction(LOC_OPEN, this, SLOT(openAttachment()));
-    menu->addAction(LOC_REMOVE, this, SLOT(removeAttachment()));
+    menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+    menu->addAction(LOC_REMOVE, this, SLOT(handleRemove()));
     menu->addAction(LOC_DETAILS, this, SLOT(viewDetails()));
     menu->setDismissPolicy(HbPopup::TapAnywhere);
     menu->setAttribute(Qt::WA_DeleteOnClose, true);
@@ -154,14 +147,25 @@
     menu->show();
 }
 
-void MsgUnifiedEditorAttachment::removeAttachment()
+void MsgUnifiedEditorAttachment::handleRemove()
 {
     emit deleteMe(this);
 }
 
-void MsgUnifiedEditorAttachment::openAttachment()
+void MsgUnifiedEditorAttachment::handleOpen()
 {
-    //open corresponding viewer app.
+    this->ungrabGesture(Qt::TapGesture);
+    
+    //open corresponding viewer app
+
+    if (!mEditorUtils) 
+    {
+        mEditorUtils = new MsgUnifiedEditorUtils(this);
+    }
+    mEditorUtils->launchContentViewer(mMimeType, mPath);
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
 }
 
 void MsgUnifiedEditorAttachment::viewDetails()
@@ -172,9 +176,9 @@
 bool MsgUnifiedEditorAttachment::isMultimediaContent()
 {
     bool ret = true;
-    QString vcard = S60QConversions::s60Desc8ToQString(KMsgMimeVCard());
-    QString vcal = S60QConversions::s60Desc8ToQString(KMsgMimeVCal());
-    QString ical = S60QConversions::s60Desc8ToQString(KMsgMimeICal());
+    QString vcard = XQConversions::s60Desc8ToQString(KMsgMimeVCard());
+    QString vcal = XQConversions::s60Desc8ToQString(KMsgMimeVCal());
+    QString ical = XQConversions::s60Desc8ToQString(KMsgMimeICal());
     if( !QString::compare(mMimeType, vcard, Qt::CaseInsensitive) ||
         !QString::compare(mMimeType, vcal, Qt::CaseInsensitive) ||
         !QString::compare(mMimeType, ical, Qt::CaseInsensitive) )
@@ -192,61 +196,76 @@
     return ret;
 }
 
-void MsgUnifiedEditorAttachment::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{    
-    HbWidgetFeedback::triggered(this, Hb::InstantPressed);
-    
-    HbFrameItem* backGround = new HbFrameItem(this);
-    backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_PRESSED);
-    backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-    this->setBackgroundItem(backGround); 
-    
-    event->accept();
-}
-
-void MsgUnifiedEditorAttachment::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void MsgUnifiedEditorAttachment::gestureEvent(QGestureEvent *event)
 {
-    HbFrameItem* backGround = new HbFrameItem(this);
-    backGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL);
-    backGround->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
-    this->setBackgroundItem(backGround);
-    
-    if(this->rect().contains(event->pos()))
+    HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
+    if (tapGesture) {
+        switch (tapGesture->state()) {
+        case Qt::GestureStarted:
+        {
+            // Trigger haptic feedback.
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(true);
+            break;
+        }
+        case Qt::GestureUpdated:
         {
-        HbWidgetFeedback::triggered(this, Hb::InstantClicked);
-        emit clicked();
+            if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
+                // Handle longtap.
+                setPressed(false);
+                handleLongTap(tapGesture->scenePosition());
+            }
+            break;
         }
-    
-    event->accept();    
+        case Qt::GestureFinished:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
+                // Handle short tap.
+                setPressed(false);
+                handleShortTap();
+            }
+            break;
+        }
+        case Qt::GestureCanceled:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(false);
+            break;
+        }
+        }
+    }
+    else {
+        HbWidget::gestureEvent(event);
+    }
 }
 
-void MsgUnifiedEditorAttachment::initGesture()
+void MsgUnifiedEditorAttachment::handleShortTap()
 {
-    // Create gesture filter
-    mGestureFilter = new HbGestureSceneFilter( Qt::LeftButton, this );
-    
-    // Add gestures for longpress
-    HbGesture* gestureLongpressed = new HbGesture( HbGesture::longpress,5 );
-    
-    mGestureFilter->addGesture( gestureLongpressed );
-    
-    connect( gestureLongpressed, SIGNAL(longPress(QPointF)),
-             this, SLOT(longPressed(QPointF)) );
-
-    //install gesture filter.
-    this->installSceneEventFilter(mGestureFilter);
+    handleOpen();
 }
 
-HbFeedback::InstantEffect MsgUnifiedEditorAttachment::overrideFeedback(Hb::InstantInteraction interaction) const
-        {
-        switch(interaction)
-            {
-            case Hb::InstantPressed:
-            case Hb::InstantClicked:
-                return HbFeedback::Basic;
-            default:
-                return HbFeedback::NoOverride;
-            }
-        }
+void MsgUnifiedEditorAttachment::setPressed(bool pressed)
+{
+    if (pressed) 
+    {
+        setProperty("state", "pressed");
+        mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_PRESSED);
+        HbEffect::cancel(mBackGround, "released");
+        HbEffect::start(mBackGround, "attachmentWidget", "pressed");
 
+    }
+    else 
+    {
+        setProperty("state", "normal");
+        mBackGround->frameDrawer().setFrameGraphicsName(LIST_ITEM_BG_FRAME_NORMAL);
+        HbEffect::cancel(mBackGround, "pressed");
+        HbEffect::start(mBackGround, "attachmentWidget", "released");
+    }    
+}
+
+void MsgUnifiedEditorAttachment::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
 // EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorattachmentcontainer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,174 @@
+/*
+ * 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: attachment container class
+ *
+ */
+
+
+// INCLUDES
+#include <QGraphicsLinearLayout>
+#include <QFileInfo>
+#include <HbFrameItem>
+#include <HbFrameDrawer>
+
+// USER INCLUDES
+#include "msgunieditorattachmentcontainer.h"
+#include "UniEditorGenUtils.h"
+#include "msgunieditormonitor.h"
+#include "mmsconformancecheck.h"
+
+// Constants
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::MsgAttachmentContainer
+// @see header file
+//---------------------------------------------------------------
+MsgAttachmentContainer::MsgAttachmentContainer( QGraphicsItem *parent ) :
+HbWidget(parent),
+mIsMMContent(false)
+{
+    mLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
+    mLayout->setContentsMargins(0,0,0,0);
+    mLayout->setSpacing(0);
+    mMmsConformanceCheck = new MmsConformanceCheck;
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::~MsgAttachmentContainer
+// @see header file
+//---------------------------------------------------------------
+MsgAttachmentContainer::~MsgAttachmentContainer()
+{
+    delete mMmsConformanceCheck;
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::addAttachment
+// @see header file
+//---------------------------------------------------------------
+MsgAttachmentContainer::AddAttachmentStatus 
+    MsgAttachmentContainer::addAttachment(const QString& filepath)
+{
+    //check for insert conformance
+    if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(filepath))
+        return EAddNotSupported;
+
+    int msgSize = messageSize();
+    QFileInfo fileinfo(filepath);
+    int fileSize = fileinfo.size() + KEstimatedMimeHeaderSize;
+    
+    if( (fileSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize())
+    {
+        MsgUnifiedEditorAttachment* att = new MsgUnifiedEditorAttachment(
+            filepath, fileSize, this);
+        if( ((mAttachmentList.count() == 0) && att->isMultimediaContent()) ||
+                ((mAttachmentList.count() == 1) && !mIsMMContent) )
+        {
+            mIsMMContent = true;
+        }
+        mAttachmentList << att;
+        int index = mLayout->count();
+        mLayout->insertItem(index,att);
+        connect(att, SIGNAL(deleteMe(MsgUnifiedEditorAttachment*)),
+            this, SLOT(deleteAttachment(MsgUnifiedEditorAttachment*)));
+
+        // emit to signal that container content & size changed
+        emit contentChanged();
+    }
+    else
+    {
+        return EAddSizeExceed;
+    }
+    return EAddSuccess;
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::deleteAttachment
+// @see header file
+//---------------------------------------------------------------
+void MsgAttachmentContainer::deleteAttachment(MsgUnifiedEditorAttachment* attachment)
+{
+    mAttachmentList.removeOne(attachment);
+    mLayout->removeItem(attachment);
+    attachment->setParent(NULL);
+    delete attachment;
+
+    if( ((mAttachmentList.count() == 1) && !mAttachmentList.first()->isMultimediaContent()) ||
+        ((mAttachmentList.count() == 0) && mIsMMContent) )
+    {
+        mIsMMContent = false;
+    }
+
+    // emit to indicate change in container content & size
+    emit contentChanged();
+    if(mAttachmentList.count() == 0)
+    {
+        emit emptyAttachmentContainer();
+    }
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::count
+// @see header file
+//---------------------------------------------------------------
+int MsgAttachmentContainer::count()
+{
+    return mAttachmentList.count();
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::attachmentList
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorAttachmentList MsgAttachmentContainer::attachmentList()
+{
+    return mAttachmentList;
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::containerSize
+// @see header file
+//---------------------------------------------------------------
+int MsgAttachmentContainer::containerSize()
+{
+    int attCount = count();
+    int containerSize = 0;
+    
+    for(int i=0; i<attCount; i++)
+    {
+        containerSize += mAttachmentList.at(i)->size();
+    }
+    return containerSize;
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::messageSize
+// @see header file
+//---------------------------------------------------------------
+int MsgAttachmentContainer::messageSize()
+{
+    return containerSize() + MsgUnifiedEditorMonitor::bodySize() + MsgUnifiedEditorMonitor::subjectSize();
+}
+
+//---------------------------------------------------------------
+// MsgAttachmentContainer::hasMMContent
+// @see header file
+//---------------------------------------------------------------
+bool MsgAttachmentContainer::hasMMContent()
+{
+    return mIsMMContent;
+}
+
+//EOF
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditoraudiowidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,137 @@
+/*
+ * 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: This widget is used to display audio content in univiewer.
+ *
+ */
+#include "msgunieditoraudiowidget.h"
+
+// SYSTEM INCLUDES
+#include <QFileInfo>
+#include <QTimer>
+#include <HbMenu>
+
+// USER INCLUDES
+#include "msgmediautil.h"
+#include "msgunieditorutils.h"
+
+// LOCAL CONSTANTS
+#define LOC_OPEN    hbTrId("txt_common_menu_open")
+#define LOC_REMOVE  hbTrId("txt_common_menu_remove")
+
+const QString AUDIO_ICON("qtg_mono_audio");
+const QString AUDIO_MIMETYPE("audio");
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::MsgUniFiedEditorAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+MsgUniFiedEditorAudioWidget::MsgUniFiedEditorAudioWidget(QGraphicsItem *parent) :
+HbPushButton(parent),
+mEditorUtils(0)
+{
+    connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap()));
+    connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF)));
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget()
+{
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::~MsgUniFiedEditorAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::populate(const QString &filePath)
+{
+    mMediaPath = filePath;
+
+    this->setIcon(HbIcon(AUDIO_ICON));
+    QFileInfo fileInfo(mMediaPath);
+    this->setText(fileInfo.baseName());    
+    MsgMediaUtil mediaUtil;
+    this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath));
+    this->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft);
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::handleShortTap
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::handleShortTap()
+{
+    emit shortTap(mMediaPath);
+
+    // Open the media.
+    handleOpen();
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::handleLongTap
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::handleLongTap(const QPointF &position)
+{
+    emit longTap(position);
+
+    // Display context sensitive menu.
+    HbMenu* menu = new HbMenu;
+    menu->setAttribute(Qt::WA_DeleteOnClose);
+    menu->setDismissPolicy(HbPopup::TapAnywhere);
+    
+    menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+    menu->addAction(LOC_REMOVE, this, SLOT(handleRemove()));
+    menu->setPreferredPos(position);
+    menu->show();
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::handleOpen
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::handleOpen()
+{
+    this->ungrabGesture(Qt::TapGesture);
+    
+    if (!mEditorUtils) 
+    {
+        mEditorUtils = new MsgUnifiedEditorUtils(this);
+    }
+    mEditorUtils->launchContentViewer(AUDIO_MIMETYPE, mMediaPath);
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
+}
+
+//----------------------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::handleRemove
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::handleRemove()
+{
+    emit remove();
+}
+
+//---------------------------------------------------------------
+// MsgUniFiedEditorAudioWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void MsgUniFiedEditorAudioWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
+// EOF
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorbody.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -21,25 +21,18 @@
 #include <HbFrameItem>
 #include <HbFrameDrawer>
 #include <HbIconItem>
-#include <HbPushButton>
-#include <QFileInfo>
 #include <HbAction>
-#include <hbinputeditorinterface.h>
-#include <QGraphicsLayout>
-#include <HbGestureSceneFilter>
-#include <HbGesture>
-#include <HbMenu>
 #include <HbMainWindow>
-#include <hbinstance.h>
 #include <HbDeviceProfile>
 #include <QImageReader>
 #include <QFileInfo>
-#include <apmstd.h>
 #include <MsgMediaResolver.h>
 #include <MsgImageInfo.h>
 #include <HbIconAnimationManager>
 #include <HbIconAnimator>
 #include <HbIcon>
+#include <QGraphicsLinearLayout>
+#include <HbNotificationDialog>
 
 #include <csmsaccount.h>
 #include <smutset.h>
@@ -47,84 +40,80 @@
 #include <xqrequestinfo.h>
 #include <xqsharablefile.h>
 #include <xqappmgr.h>
-
+#include <xqconversions.h>
 // USER INCLUDES
 #include "msgunieditorbody.h"
 #include "UniEditorGenUtils.h"
-#include "unisendingsettings.h"
-#include "msgmonitor.h"
-#include "s60qconversions.h"
+#include "UniSendingSettings.h"
+#include "msgunieditormonitor.h"
+
 #include "mmsconformancecheck.h"
 #include "unieditorpluginloader.h"
 #include "unieditorplugininterface.h"
 #include "convergedmessage.h"
 #include "msgmediautil.h"
+#include "msgunieditorpixmapwidget.h"
+#include "msgunieditoraudiowidget.h"
 
 // Constants
-const QString EDITOR_FRAME("qtg_fr_lineedit_normal");
 const QString BACKGROUND_FRAME("qtg_fr_btn_normal");
-const QString AUDIO_REGION("AudioRegion");
-const QString VIDEO_REGION("VideoRegion");
-const QString IMAGE_REGION("ImageRegion");
-const QString INVALID_REGION("InvalidRegion");
-const QString SEND_ICON("qtg_mono_send");
+
+const int KShowCounterLimit = 10;
+const int BYTES_TO_KBYTES_FACTOR = 1024; 
 
 //Localized Constants for item specific menu
-#define LOC_OPEN    hbTrId("txt_common_menu_open")
-#define LOC_REMOVE  hbTrId("txt_common_menu_remove")
-#define LOC_DETAILS hbTrId("txt_common_menu_details")
 #define LOC_TITLE   hbTrId("txt_messaging_title_messaging")
+#define LOC_UNABLE_TO_ADD_CONTENT hbTrId("txt_messaging_dpopinfo_unable_to_add_more_content")
+#define LOC_UNABLE_TO_ATTACH_ITEM hbTrId("txt_messaging_dpopinfo_unable_to_attach_item_avai")
+#define LOC_PROCESSING hbTrId("txt_messaging_formlabel_loading")
+#define LOC_HINT_TEXT hbTrId("txt_messaging_formlabel_enter_message_here")
+
+const QString ANIMATION_ICON("qtg_anim_loading");
+const QString ANIMATION_FILE(":/qtg_anim_loading.axml");
+// LOCAL FUNCTIONS
 
-const QString AUDIO_ICON("qtg_mono_audio");
-const QString ANIMATION_ICON(":/qtg_anim_longtap_2");
+//---------------------------------------------------------------
+// showInsertFailureNote
+// @return fullPath of unified editor's temporary dir
+//---------------------------------------------------------------
+void showInsertFailureNote()
+{
+    int availableSize =
+            (MsgUnifiedEditorMonitor::maxMmsSize() - MsgUnifiedEditorMonitor::messageSize())
+            /BYTES_TO_KBYTES_FACTOR;
+    QString displayStr = QString(LOC_UNABLE_TO_ATTACH_ITEM)
+            .arg(availableSize);
+    HbNotificationDialog* dlg = new HbNotificationDialog();
+    dlg->setFocusPolicy(Qt::NoFocus);
+    dlg->setDismissPolicy(HbPopup::TapAnywhere);
+    dlg->setAttribute(Qt::WA_DeleteOnClose, true);
+    dlg->setText(displayStr);
+    dlg->show();
+}
 
-const TInt KShowCounterLimit = 10;
 
-MsgUnifiedEditorBody::MsgUnifiedEditorBody( const QString& pluginPath, 
-    QGraphicsItem *parent ) :
-HbWidget(parent),
+MsgUnifiedEditorBody::MsgUnifiedEditorBody( QGraphicsItem *parent ) :
+MsgUnifiedEditorBaseWidget(parent),
 mHasImage(false),
 mHasAudio(false),
 mTextEdit(0),
-mEditorFrame(0),
-mIconItem(0),
+mPixmapItem(0),
 mAudioItem(0),
-mPluginPath(pluginPath),
 mImageSize(0),
 mAudioSize(0),
 mVideoSize(0),
 mProcessImageOperation(0),
 mMediaResolver(0),
-mImageInfo(0)
+mImageInfo(0),
+mProcessingWidget(0),
+mDraftMessage(false),
+mIsImageResizing(false)
 {
-    setPluginBaseId(style()->registerPlugin(mPluginPath));
-
     mTextEdit = new HbTextEdit(this);
+    mTextEdit->setPlaceholderText(LOC_HINT_TEXT);
     HbStyle::setItemName(mTextEdit,"textEdit");
-
-    HbFrameDrawer* frameDrawer = new HbFrameDrawer(EDITOR_FRAME, 
-                                                   HbFrameDrawer::NinePieces);
-    
-    mEditorFrame = new HbFrameItem(frameDrawer,this);
-    HbStyle::setItemName(mEditorFrame,"textEditFrame");
-    mEditorFrame->setZValue(-1);
-    
-    // add "Send" action in VKB
-    HbEditorInterface editorInterface(mTextEdit);
-    HbAction *sendAction = new HbAction(HbIcon(SEND_ICON), QString(),this);
-    connect(sendAction, SIGNAL(triggered()),this, SIGNAL(sendMessage()));
-    editorInterface.addAction(sendAction);
-
-    mGestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this);
-    mGestureFilter->setLongpressAnimation(true);
-    HbGesture *gesture = new HbGesture(HbGesture::longpress, 5);
-    mGestureFilter->addGesture(gesture);
-    connect(gesture, SIGNAL(longPress(QPointF)), this, SLOT(longPressed(QPointF)));
     connect(mTextEdit, SIGNAL(contentsChanged()), this, SLOT(onTextChanged()));
 
-    mfs.Connect();
-    mfs.ShareProtected();
-
     mMmsConformanceCheck = new MmsConformanceCheck;
     
     mCharCounter = new HbTextItem(this);
@@ -146,6 +135,7 @@
     mPluginInterface =
                         mPluginLoader->getUniEditorPlugin(ConvergedMessage::Sms);    
     
+    TRAP_IGNORE(
     CSmsSettings* settings = CSmsSettings::NewLC();
     CSmsAccount* account = CSmsAccount::NewLC();
     account->LoadSettingsL( *settings );
@@ -161,23 +151,18 @@
     
     CleanupStack::PopAndDestroy( account );
     CleanupStack::PopAndDestroy( settings );                
+    );
 
-    //Set the mPrevBuffer to NULL initially
-    mPrevBuffer = QString();
-    
     mCharCounter->setVisible(false);
     mBackgroundItem->setVisible(false);
 }
 
 MsgUnifiedEditorBody::~MsgUnifiedEditorBody()
 {
-    style()->unregisterPlugin(mPluginPath);
     delete mMmsConformanceCheck;
     delete mProcessImageOperation;
     delete mMediaResolver;
     delete mImageInfo;
-    //Close has to be called after ProcessImageOperation object is deleted
-    mfs.Close();
 }
 
 QString MsgUnifiedEditorBody::text()
@@ -185,65 +170,82 @@
     return mTextEdit->toPlainText();
 }
 
-void MsgUnifiedEditorBody::setImage(QString& imagefile)
-{
-    if (!mImageInfo)
-     {
-        setImage(true);
-        
-        mImageFile = imagefile;
-        if (mIconItem)
+void MsgUnifiedEditorBody::setImage(QString& imagefile, bool draftMessage)
+    {
+    // do nothing if filepath is empty
+    if (imagefile.isEmpty())
         {
-            delete mIconItem;
-            mIconItem = NULL;
-            mImageSize = 0;
-        }
-
-        int error = KErrNone;
-        
-        if( !mProcessImageOperation )
-        {
-        TRAP(error,mProcessImageOperation = 
-            CUniEditorProcessImageOperation::NewL(*this, mfs));
-        }
-        if( !mMediaResolver && error == KErrNone )
-        {
-        TRAP(error,mMediaResolver = CMsgMediaResolver::NewL());
+        return;
         }
 
-        if( error == KErrNone)
+    mDraftMessage = draftMessage;
+    if (!mImageInfo)
         {
-            mMediaResolver->SetCharacterSetRecognition(EFalse);
+        setImage(true);
 
-            HBufC *name = S60QConversions::qStringToS60Desc(imagefile);
-            RFile file = mMediaResolver->FileHandleL(*name);
-     
-            TRAP(error,mImageInfo = static_cast<CMsgImageInfo*>
-            (mMediaResolver->CreateMediaInfoL(file)));
-            if (error == KErrNone)
+        mImageFile = imagefile;
+        if (mPixmapItem)
             {
-                TRAP(error, mMediaResolver->ParseInfoDetailsL(mImageInfo, file));
+            mPixmapItem->setParent(NULL);
+            delete mPixmapItem;
+            mPixmapItem = NULL;
+            mImageSize = 0;
             }
 
-            file.Close();
-            delete name;
-        }
-        
-        if (error == KErrNone)
-        {
+        int error = KErrNone;
+        if (!mDraftMessage)
+            {
+        // if image is in draft, no need to resize it because it is resized already
+            if (!mProcessImageOperation)
+                {
+                TRAP(error,mProcessImageOperation =
+                        CUniEditorProcessImageOperation::NewL(*this));
+                }
+            if (!mMediaResolver && error == KErrNone)
+                {
+                TRAP(error,mMediaResolver = CMsgMediaResolver::NewL());
+                }
+
+            if (error == KErrNone)
+                {
+                mMediaResolver->SetCharacterSetRecognition(EFalse);
+                HBufC *name = XQConversions::qStringToS60Desc(imagefile);
+                RFile file;
+                TRAP(error, file = mMediaResolver->FileHandleL(*name));
+                if (error == KErrNone)
+                    {
+                    TRAP(error,mImageInfo = static_cast<CMsgImageInfo*>
+                            (mMediaResolver->CreateMediaInfoL(file)));
+                    if (error == KErrNone)
+                        {
+                        TRAP(error, mMediaResolver->ParseInfoDetailsL(
+                                        mImageInfo, file));
+                        }
+                    file.Close();
+                    }
+                delete name;
+                }
+            }
+        if (error == KErrNone && !mDraftMessage)
+            {
             mSavedImageFile = imagefile;
             startResizeAnimation();
+            mIsImageResizing = true;
             mProcessImageOperation->Process(mImageInfo);
-        }
+            }
         else
-        {
-            delete mImageInfo;
-            mImageInfo = NULL;
+            {
+            if (mImageInfo)
+                {
+                delete mImageInfo;
+                mImageInfo = NULL;
+                }
             mSavedImageFile.clear();
             handleSetImage();
+            }
+
         }
     }
-}
 
 void MsgUnifiedEditorBody::handleSetImage()
 {   
@@ -254,7 +256,7 @@
     int msgSize = messageSize();
     QFileInfo fileinfo(mImageFile);
     int imageSize = fileinfo.size() + KEstimatedMimeHeaderSize;
-    if ( (imageSize + msgSize) <= MsgMonitor::maxMmsSize())
+    if ( (imageSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize())
     {
         mImageSize = imageSize;
     }
@@ -263,19 +265,17 @@
         mImageFile.clear();
         setImage(false);
         //Show appropriate note and leave
+        showInsertFailureNote();
         return;
     }
 
-    mIconItem = new HbIconItem(this);
-    mIconItem->hide();
-    //mIconItem->setIconName(mImageFile);
-    QPixmap pixmap(mImageFile);
-    mIconItem->setIcon(HbIcon(pixmap));
-
-    HbStyle::setItemName(mIconItem, "pixmap");
-    mIconItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-    mIconItem->installSceneEventFilter(mGestureFilter);
-
+    mPixmapItem = new MsgUnifiedEditorPixmapWidget(this);
+    mPixmapItem->hide();
+    HbStyle::setItemName(mPixmapItem, "pixmap");
+    mPixmapItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
+    mPixmapItem->populate(mImageFile);
+    connect(mPixmapItem,SIGNAL(remove()),this,SLOT(removeMedia()));
+    
     // repolish the body widget
     this->repolish();
 
@@ -285,6 +285,12 @@
 
 void MsgUnifiedEditorBody::setAudio(QString& audiofile)
 {
+    // do nothing if filepath is empty
+    if(audiofile.isEmpty())
+    {
+        return;
+    }
+
     //check for insert conformance
     if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(audiofile))
         return;
@@ -293,16 +299,16 @@
     mAudioFile = audiofile;
     if(mAudioItem)
     {
+        mAudioItem->setParent(NULL);
         delete mAudioItem;
         mAudioItem = NULL;
         mAudioSize = 0;
     }
 
-    //TODO: Add conformance checks before calculating the size    
     int msgSize = messageSize();
     QFileInfo fileinfo(mAudioFile);
     int audioSize = fileinfo.size() + KEstimatedMimeHeaderSize;
-    if((audioSize + msgSize) <= MsgMonitor::maxMmsSize() )
+    if((audioSize + msgSize) <= MsgUnifiedEditorMonitor::maxMmsSize() )
     {
     	mAudioSize = audioSize;
     }
@@ -311,19 +317,15 @@
     	mAudioFile.clear();
     	setAudio(false);
     	//Show appropriate note and leave
+    	showInsertFailureNote();
     	return;
     }    
 
-    HbIconItem* audioIcon = new HbIconItem(AUDIO_ICON);
-    mAudioItem = new HbPushButton(this);
+    mAudioItem = new MsgUniFiedEditorAudioWidget(this);
     mAudioItem->hide();
     HbStyle::setItemName(mAudioItem,"audioItem");
-    mAudioItem->setIcon(audioIcon->icon());
-    mAudioItem->setText(fileinfo.baseName());
-    MsgMediaUtil mediaUtil;
-    mAudioItem->setAdditionalText(mediaUtil.mediaDuration(mAudioFile));
-    mAudioItem->setTextAlignment(Qt::AlignVCenter | Qt::AlignLeft);
-    connect(mAudioItem, SIGNAL(longPress(QPointF)), this, SLOT(longPressed(QPointF)));
+    mAudioItem->populate(mAudioFile);
+    connect(mAudioItem,SIGNAL(remove()),this,SLOT(removeMedia()));
 
     // repolish the body widget
     this->repolish();
@@ -332,41 +334,12 @@
     emit contentChanged();
 }
 
-void MsgUnifiedEditorBody::setVideo(QString& videofile)
-{
-    //check for insert conformance
-    if(EInsertSuccess != mMmsConformanceCheck->checkModeForInsert(videofile))
-        return;
-
-    // update the media file-list
-    mVideoFile = videofile;
-
-    //TODO: Add conformance checks before calculating the size    
-    int msgSize = messageSize();
-    QFileInfo fileinfo(mVideoFile);
-    int videoSize = fileinfo.size() + KEstimatedMimeHeaderSize;
-    if((videoSize + msgSize) <= MsgMonitor::maxMmsSize() )    
-    {
-    	mVideoSize = videoSize;
-    }
-    else
-    {
-    	//Show appropriate note and leave
-    	return;
-    }    
-
-    //TODO: create video item instance
-
-    // repolish the body widget
-    this->repolish();
-
-    // emit signal to indicate addition of video
-    emit contentChanged();
-}
-
 void MsgUnifiedEditorBody::setText(QString& text)
 {
-	mTextEdit->setPlainText(text);
+    if(!text.isEmpty())
+    {    
+        mTextEdit->setPlainText(text);
+    }
 }
 
 const QStringList MsgUnifiedEditorBody::mediaContent()
@@ -379,17 +352,18 @@
     if(mHasAudio)
         mediaFiles << mAudioFile;
 
-    //TODO: append video content
-
     return mediaFiles;
 }
 
 QSizeF MsgUnifiedEditorBody::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
 {
     QSizeF szHint = HbWidget::sizeHint(which,constraint);
-    
-    QList<HbMainWindow *> windowList = hbInstance->allMainWindows();
-    HbMainWindow* mMainWindow = windowList[0];
+
+    HbMainWindow* mMainWindow = this->mainWindow();    
+    if(!mMainWindow)
+    {
+        return szHint;
+    }
 
     qreal leftMargin = 0.0;
     qreal rightMargin = 0.0;
@@ -440,7 +414,7 @@
         mAudioItem->show();
     }
     
-    if(mIconItem)
+    if(mPixmapItem || mProcessingWidget)
         {
         QSizeF imageSize(0.0,0.0);
         QSizeF defaultImageSize(QImageReader(mImageFile).size());
@@ -474,165 +448,75 @@
                 imageSize.setWidth(newWidth);
             }
 
-            mIconItem->setPreferredSize(imageSize);
-            mIconItem->setSize(imageSize);
+            if(mPixmapItem)
+            {
+            mPixmapItem->setPreferredSize(imageSize);
+            mPixmapItem->setSize(imageSize);
             if(mMainWindow->orientation() == Qt::Horizontal)
             {
-                QPointF currPos = mIconItem->pos();
+                QPointF currPos = mPixmapItem->pos();
                 currPos.setX(leftMargin+((maxWidth-imageSize.width())/2));
-                mIconItem->setPos(currPos);
+                mPixmapItem->setPos(currPos);
+            }
+            mPixmapItem->show();
             }
-            mIconItem->show();
+            
+            if(mProcessingWidget)
+            {
+                imageSize.setHeight(mProcessingWidget->preferredHeight());
+                mProcessingWidget->setPreferredSize(imageSize);
+                mProcessingWidget->show();
+            }
             szHint.rheight() += imageSize.height();
         }
     }
+    
 
     mTextEdit->setMinimumHeight(maxHeight);
     szHint.rheight() += bodyItemSpacing;
     return szHint;
 }
 
-void MsgUnifiedEditorBody::longPressed(QPointF position)
-{
-    HbMenu* menu = new HbMenu;
-    menu->addAction(LOC_OPEN, this, SLOT(openMedia()));
-    menu->addAction(LOC_REMOVE, this, SLOT(removeMedia()));
-    menu->addAction(LOC_DETAILS, this, SLOT(viewDetails()));
-
-    menu->setDismissPolicy(HbPopup::TapAnywhere);
-    menu->setAttribute(Qt::WA_DeleteOnClose, true);
-    menu->setPreferredPos(position);
-
-    menu->setObjectName(getHitRegion(position));
-    menu->show();
-}
-
 void MsgUnifiedEditorBody::removeMedia()
 {
-    HbAction* action = qobject_cast<HbAction*>(sender());
-    QString objName = action->parent()->objectName();
-    if(objName == IMAGE_REGION)
+    QObject* senderObject = sender();
+    
+    MsgUnifiedEditorPixmapWidget* pixmap = 
+        qobject_cast<MsgUnifiedEditorPixmapWidget*>(senderObject);
+
+    MsgUniFiedEditorAudioWidget* audio = 
+        qobject_cast<MsgUniFiedEditorAudioWidget*>(senderObject);
+    
+    if(pixmap) //remove image
     {
         mImageFile.clear();
-        if(mIconItem)
+        if(mPixmapItem)
         {
-            mIconItem->removeSceneEventFilter(mGestureFilter);
-            delete mIconItem;
-            mIconItem = NULL;
+            mPixmapItem->setParent(NULL);
+            delete mPixmapItem;
+            mPixmapItem = NULL;
         }
         setImage(false);
         mImageSize = 0;
     }
-    else if(objName == AUDIO_REGION)
-    {
-        mAudioFile.clear();
-        if(mAudioItem)
+    else if(audio)//remove audio item
         {
-            delete mAudioItem;
-            mAudioItem = NULL;
+            mAudioFile.clear();
+            if(mAudioItem)
+            {
+                mAudioItem->setParent(NULL);
+                delete mAudioItem;
+                mAudioItem = NULL;
+            }
+            setAudio(false);
+            mAudioSize = 0;
         }
-        setAudio(false);
-        mAudioSize = 0;
-    }
-    else if(objName == VIDEO_REGION)
-    {
-        //TODO: complete this with video handling story
-    }
-    else
-    {
-        // return without doing anything
-        return;
-    }
 
     this->repolish();
 
 	emit contentChanged();
 }
 
-//---------------------------------------------------------------
-// MsgUnifiedEditorBody :: openMedia
-// @see header file
-//---------------------------------------------------------------
-void MsgUnifiedEditorBody::openMedia()
-{
-    HbAction* action = qobject_cast<HbAction*>(sender());
-    QString objName = action->parent()->objectName();
-    
-    QString fileName;
-    if ( objName == IMAGE_REGION )
-    {
-        fileName = mImageFile;
-    }
-    else if ( objName == AUDIO_REGION )
-    {
-        fileName = mAudioFile;
-    }
-    else
-    {
-        return;
-    }
-    
-    XQSharableFile sf;
-    XQAiwRequest* request = 0;
-
-    if ( !sf.open(fileName) ) 
-        {
-        return;
-        }
-
-    // Get handlers
-    XQApplicationManager appManager;
-    QList<XQAiwInterfaceDescriptor> fileHandlers = appManager.list(sf);
-    if (fileHandlers.count() > 0)
-        {
-        XQAiwInterfaceDescriptor d = fileHandlers.first();
-        request = appManager.create(sf, d);
-    
-        if ( !request )
-            {
-            sf.close();
-            return ;
-            }
-        }
-    else
-        {
-        sf.close();
-        return;
-        }
-
-    // Result handlers
-    connect (request, SIGNAL(requestOk(const QVariant&)), 
-            this, SLOT(handleOk(const QVariant&)));
-    connect (request, SIGNAL(requestError(const QVariant&)), 
-            this, SLOT(handleError(const QVariant&)));
-
-    request->setEmbedded(true);
-    request->setSynchronous(true);
-
-    // Fill args
-    QList<QVariant> args;
-    args << qVariantFromValue(sf);
-    request->setArguments(args);
-
-    // Fill headers
-    QString key("WindowTitle");
-    QVariant value(QString(LOC_TITLE));
-    XQRequestInfo info;
-    info.setInfo(key, value);
-    request->setInfo(info);
-    
-    request->send();
-    
-    // Cleanup
-    sf.close();
-    delete request;
-}
-
-void MsgUnifiedEditorBody::viewDetails()
-{
-    //open details view.
-}
-
 bool MsgUnifiedEditorBody::hasImage()
 {
     return mHasImage;
@@ -678,48 +562,34 @@
         estimatedMediaSize = KEstimatedMmsSmilHeaderSize;
     }
     
-    return estimatedMediaSize + MsgMonitor::subjectSize() + MsgMonitor::containerSize();
-}
-
-QString MsgUnifiedEditorBody::getHitRegion(QPointF position)
-{
-    if(mIconItem)
-    {
-        QPolygonF imageHitRegion = mIconItem->mapToScene(mIconItem->boundingRect());
-        if(imageHitRegion.containsPoint(position, Qt::OddEvenFill))
-        {
-            return IMAGE_REGION;
-        }
-    }
-
-    if(mAudioItem)
-    {
-        QPolygonF audioHitRegion = mAudioItem->mapToScene(mAudioItem->boundingRect());
-        if(audioHitRegion.containsPoint(position, Qt::OddEvenFill))
-        {
-            return AUDIO_REGION;
-        }
-    }
-
-    //TODO : add hit test for video region with video userstory
-
-    return INVALID_REGION;
+    return estimatedMediaSize + MsgUnifiedEditorMonitor::subjectSize() + MsgUnifiedEditorMonitor::containerSize();
 }
 
 void MsgUnifiedEditorBody::onTextChanged()
 {   
     QString string = text();
-    
-    if(  !mPrevBuffer.isEmpty() &&
-         string.size() > mPrevBuffer.size() &&
-         MsgMonitor::messageType() == ConvergedMessage::Mms )
+
+    if( string.size() > mPrevBuffer.size() &&
+        MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Mms )
     {
-        //Save the previous buffer
-        mPrevBuffer = string;
-        // emit signal to indicate change in content
-        emit contentChanged();
-                
-        return;
+        // reject any text input if mms size limit is reached
+        int futureSize = bodySize() +
+                MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::subjectSize();
+        if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize())
+        {
+            mTextEdit->setPlainText(mPrevBuffer);
+            HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT);
+            mTextEdit->setCursorPosition(mPrevBuffer.length());
+            return;
+        }
+        else if(!mPrevBuffer.isEmpty())
+        {
+            //Save the previous buffer
+            mPrevBuffer = string;
+            // emit signal to indicate change in content
+            emit contentChanged();
+            return;
+        }
     }
 
     //Check done for optimization
@@ -745,7 +615,7 @@
     // emit signal to indicate change in content
     emit contentChanged();
     
-    if(MsgMonitor::messageType() == ConvergedMessage::Sms)
+    if(MsgUnifiedEditorMonitor::messageType() == ConvergedMessage::Sms)
     {
         //Set char counter value
         QString display = QString("%1(%2)").arg(numOfRemainingChars).arg(
@@ -768,54 +638,66 @@
 void MsgUnifiedEditorBody::EditorOperationEvent(
     TUniEditorProcessImageOperationEvent aEvent, TFileName aFileName)
 {
-    stopResizeAnimation();
-    
     delete mImageInfo;
     mImageInfo = NULL;
 
     if (aEvent == EUniEditorProcessImageOperationComplete && 
             aFileName.Length() > 0)
     {
-        mImageFile = S60QConversions::s60DescToQString(aFileName);
+        mImageFile = XQConversions::s60DescToQString(aFileName);
     }
     else
     {
         mImageFile = mSavedImageFile;
     }
     mSavedImageFile.clear();
+
+   // image resize is complete. reset the image resize flag
+    mIsImageResizing = false;
     //handle the processed image from ProcessImage Operation
     handleSetImage();
+    
+    stopResizeAnimation();
 }
 
 void MsgUnifiedEditorBody::startResizeAnimation()
 {
-    HbIconAnimationManager *manager = HbIconAnimationManager::global();
-    bool defined = manager->addDefinitionFile(":/animation.axml");
-
-    HbIcon animIcon;
-    animIcon.setIconName("frame_anim_looping");
-
-    mIconItem = new HbIconItem(this);
-    mIconItem->hide();
-    HbStyle::setItemName(mIconItem,"pixmap");
-    mIconItem->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
-    mIconItem->setIcon(animIcon);
-
-    mImageFile = ANIMATION_ICON;
-    HbIconAnimator animator;
-    animator.setIcon(animIcon);
-
-    animator.startAnimation();
-    this->repolish();
+    // emit signal to indicate disable the send tool button.
+    emit enableSendButton(false);
+    
+	
+    QGraphicsLinearLayout* processingLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    
+    mProcessingWidget = new HbWidget(this);
+    HbStyle::setItemName(mProcessingWidget,"pixmap"); 
+    mProcessingWidget->hide();
+    mProcessingWidget->setLayout(processingLayout);
+    
+    HbTextItem* processingText = new HbTextItem(LOC_PROCESSING,mProcessingWidget);
+    processingText->setAlignment(Qt::AlignCenter);
+    processingLayout->addItem(processingText);
+    
+    HbIconItem* animationItem = new HbIconItem(ANIMATION_ICON,mProcessingWidget);
+    animationItem->setAlignment(Qt::AlignHCenter);
+    processingLayout->addItem(animationItem);
+    
+    HbIconAnimator& iconAnimator = animationItem->animator();
+    HbIconAnimationManager* iconAnimationManager = HbIconAnimationManager::global();
+    iconAnimationManager->addDefinitionFile(ANIMATION_FILE);
+    
+    iconAnimator.startAnimation();
+    
+    this->repolish();    
 }
 
 void MsgUnifiedEditorBody::stopResizeAnimation()
 {
-    if (mIconItem)
+    if(mProcessingWidget)
     {
-        delete mIconItem;
-        mIconItem = NULL;     
-    }   
+        delete mProcessingWidget;
+        mProcessingWidget = NULL;
+    }
+	
 }
 
 // ---------------------------------------------------------
@@ -838,23 +720,11 @@
 }
 
 //---------------------------------------------------------------
-// MsgUnifiedEditorBody :: handleOk
+// MsgUnifiedEditorBody :: setFocus
 // @see header file
 //---------------------------------------------------------------
-void MsgUnifiedEditorBody::handleOk(const QVariant& result)
+void MsgUnifiedEditorBody::setFocus()
 {
-    Q_UNUSED(result)
+    mTextEdit->setFocus(Qt::MouseFocusReason);
 }
-
-//---------------------------------------------------------------
-// MsgUnifiedEditorBody :: handleError
-// @see header file
-//---------------------------------------------------------------
-void MsgUnifiedEditorBody::handleError(int errorCode, 
-    const QString& errorMessage)
-{
-    Q_UNUSED(errorMessage)
-    Q_UNUSED(errorCode)
-}
-
 // EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorlineedit.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,640 @@
+/*
+ * 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:
+ *
+ */
+
+#include "msgunieditorlineedit.h"
+#include <HbTapGesture>
+#include <HbMenu>
+#include <QApplication>
+#include <QClipboard>
+
+const QRegExp expr("[,;\n]$");
+const QRegExp sepAtEnd("; $");
+const QRegExp sepAtMiddle("; ");
+
+const QString replacementStr("; ");
+const QString labelSeperator(": ");
+
+const int fadedAlpha(125);
+const int solidAlpha(255);
+
+const int SNAP_DELAY = 350;
+
+//Localization
+#define LOC_PASTE hbTrId("txt_common_menu_paste")
+
+MsgUnifiedEditorLineEdit::MsgUnifiedEditorLineEdit(const QString& label,QGraphicsItem *parent):
+HbLineEdit(parent),
+mSelectionStart(-1),
+mSelectionEnd(-1),
+mDefaultBehaviour(false)
+{
+    QString labelStr = label.trimmed();
+    
+    QTextCursor cursor(this->textCursor());
+    QTextCharFormat colorFormat(cursor.charFormat());
+   
+    QColor fgColor = this->palette().color(QPalette::Text);     
+    fgColor.setAlpha(fadedAlpha);
+    colorFormat.setForeground(fgColor);
+    cursor.insertText(labelStr , colorFormat);
+
+    fgColor.setAlpha(solidAlpha);
+    colorFormat.setForeground(fgColor);
+
+    cursor.insertText(" ",colorFormat);    
+
+    mLabelExpr.setPattern(QString("^"+labelStr+" $"));
+    mLabel = labelStr+" ";
+    
+    moveCursor(QTextCursor::EndOfBlock);
+
+    connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+            this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+    connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
+    
+    connect(this,SIGNAL(aboutToShowContextMenu(HbMenu*,const QPointF &)),
+            this,SLOT(aboutToShowContextMenu(HbMenu*,const QPointF &)));
+    
+}
+
+MsgUnifiedEditorLineEdit::~MsgUnifiedEditorLineEdit()
+{
+}
+
+void MsgUnifiedEditorLineEdit::inputMethodEvent(QInputMethodEvent *event)
+{
+    //let it go in default way.
+    if(mDefaultBehaviour)
+    {
+        HbAbstractEdit::inputMethodEvent(event);
+        event->accept();
+        return;
+    }
+
+    if (!event->commitString().isEmpty() || event->replacementLength())
+    {
+        if (event->commitString().contains(expr))
+        {
+            if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
+            {
+                event->accept();
+                return;
+            }
+
+            this->setCursorPosition(this->text().length());
+
+            QString str = event->commitString();
+            str.replace(expr, replacementStr);            
+
+            event->setCommitString(str, event->replacementStart(), event->replacementLength());            
+        }
+        else if(this->hasSelectedText())
+        {// all user inputs get appended at the end
+            this->setCursorPosition(this->text().length());
+        }
+    }
+    
+    HbAbstractEdit::inputMethodEvent(event);
+    event->accept();
+}
+
+void MsgUnifiedEditorLineEdit::keyPressEvent(QKeyEvent *event)
+{
+    QString str = event->text();
+
+    if(event->key()== Qt::Key_Enter || event->key()== Qt::Key_Return)
+    {
+        if(mDefaultBehaviour)
+        {
+            HbAbstractEdit::keyReleaseEvent(event);
+            event->accept();
+            return;
+        }
+        if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
+        {
+            event->accept();
+            return;
+        }
+        this->setCursorPosition(this->text().length());
+        str = replacementStr;
+        QKeyEvent eve(event->type(), Qt::Key_Any, event->modifiers(), str);
+        HbAbstractEdit::keyPressEvent(&eve);
+        event->accept();
+        return;
+    }
+
+    if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete )
+    {
+        int pos = this->cursorPosition();
+        bool pbkContact = true;
+
+        if(!this->hasSelectedText())
+        {
+            this->setCursorPosition(pos-2);
+            pbkContact = this->textCursor().charFormat().fontUnderline();
+            this->setCursorPosition(pos);
+        }
+
+        QString text = this->text();
+        text = text.left(pos);
+
+        if(text.contains(mLabelExpr))
+        {
+            event->accept();
+            return;
+        }
+
+        if(pbkContact)
+        {
+            //if already selected delete it.
+            if(this->hasSelectedText())
+            {
+                // deleting phbkContact is an atomic operation
+                // ensure that the signal is emitted only once
+                disconnect(this, SIGNAL(contentsChanged()), 
+                        this, SLOT(onContentsChanged()));
+                HbLineEdit::keyPressEvent(event);
+                event->accept();
+                //delete seperator (i.e."; ").
+                QKeyEvent eve(event->type(), Qt::Key_Delete, Qt::NoModifier);
+                HbLineEdit::keyPressEvent(&eve);
+                HbLineEdit::keyPressEvent(&eve);
+                connect(this, SIGNAL(contentsChanged()), 
+                        this, SLOT(onContentsChanged()));
+                onContentsChanged();
+            }
+            else //make it selected
+            {                
+                this->setCursorPosition(pos-3);
+                setHighlight(pos-3);
+            }
+        }
+        else
+        {
+            QString str = text.right(2);
+            if(str == replacementStr)
+            {
+                // deleting contact is an atomic operation
+                // ensure that the signal is emitted only once
+                disconnect(this, SIGNAL(contentsChanged()), 
+                        this, SLOT(onContentsChanged()));
+                //delete seperator (i.e."; ").
+                QKeyEvent eve(event->type(), Qt::Key_Backspace, Qt::NoModifier);
+                HbLineEdit::keyPressEvent(&eve);
+                HbLineEdit::keyPressEvent(&eve);
+                connect(this, SIGNAL(contentsChanged()), 
+                        this, SLOT(onContentsChanged()));
+                onContentsChanged();
+            }
+            else
+            {
+                HbLineEdit::keyPressEvent(event);
+            }
+            event->accept();
+        }
+        
+        event->accept();
+        return;
+    }
+
+    if (event->key() == Qt::Key_Left )
+    {
+        bool selectedText = this->hasSelectedText();
+
+        //look ahead left.
+        int pos = this->cursorPosition();
+
+        QString text = this->text();
+        text = text.left(pos);
+
+        //no text other than label;
+        if(text.contains(mLabelExpr))
+        {
+            event->accept();
+            return;
+        }
+
+        //look for next seperator while going left.
+        int newPos = text.lastIndexOf(sepAtMiddle);
+
+        if(newPos < 0 && selectedText)
+        {
+            event->accept();
+            return;
+        }
+
+        bool pbkContact = true;
+
+        if(!selectedText)
+        {
+            this->setCursorPosition(pos-2);
+            pbkContact = this->textCursor().charFormat().fontUnderline();
+            this->setCursorPosition(pos);
+        }
+        else
+        {
+            this->setCursorPosition(newPos);
+            pbkContact = this->textCursor().charFormat().fontUnderline();
+            this->setCursorPosition(pos);
+        }
+
+
+        if(pbkContact && newPos >0)
+        {
+
+            setHighlight(newPos-1);
+        }
+        else
+        {
+            //move left, char by char. if seperator met jump over it.
+            if( (newPos > 0 && selectedText) || (pos-2  == newPos))
+            {
+                this->setCursorPosition(newPos+1);
+            }
+
+            HbLineEdit::keyPressEvent(event);
+
+        }
+        event->accept();
+        return;
+    }
+
+    if (event->key() == Qt::Key_Right)
+    {
+        bool selectedText = this->hasSelectedText();
+
+        //look ahead.
+        int pos = this->cursorPosition();
+        this->setCursorPosition(pos+3);
+        bool pbkContact = this->textCursor().charFormat().fontUnderline();
+        this->setCursorPosition(pos);
+
+        //look for next seperator.
+        QString text = this->text();
+        int newPos = text.indexOf(sepAtMiddle,pos+2);
+
+        if(pbkContact && newPos >0)
+        {
+            this->setCursorPosition(newPos-1);
+            setHighlight(newPos-1);
+        }
+        else
+        {            
+            int seperatorPos = text.indexOf(sepAtMiddle,pos);
+
+            if(selectedText || seperatorPos == pos)
+            {
+                this->setCursorPosition(pos+1);
+                this->deselect();
+            }
+            HbAbstractEdit::keyPressEvent(event);
+        }
+        event->accept();
+        return;
+    }
+
+    if(!str.isEmpty())
+    {
+        if(mDefaultBehaviour)
+        {
+            HbAbstractEdit::keyPressEvent(event);
+            event->accept();
+            return;
+        }
+        if (str.contains(expr))
+        {
+            if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
+            {
+                event->accept();
+                return;
+            }
+
+            // auto-complete the last incomplete word
+            int contentLength = this->text().length();
+            int pos = this->cursorPosition();
+            QString incompleteWord(this->text().right(contentLength-(pos-1)));
+            if(!incompleteWord.contains(sepAtMiddle))
+            {
+                this->setCursorPosition(this->text().length());
+            }
+
+            str.replace(expr, replacementStr);
+            QKeyEvent eve(event->type(), event->key(), event->modifiers(), str);
+            HbAbstractEdit::keyPressEvent(&eve);
+        }
+        else
+        {
+            HbAbstractEdit::keyPressEvent(event);
+            event->accept();
+            return;
+        }
+    }
+}
+
+void MsgUnifiedEditorLineEdit::handleTap()
+{
+    int currentPos = this->cursorPosition();
+
+    QString txt = this->text();
+
+    QString tempTxt = txt.left(currentPos+2);
+    int seperatorPos = tempTxt.lastIndexOf(sepAtMiddle,currentPos);
+
+    txt = txt.right(txt.length() - currentPos);
+    int labelPos = txt.indexOf(labelSeperator);
+
+    if(labelPos >= 0 )//pressed on label.
+    {
+        this->setCursorPosition(currentPos + labelPos + 2);
+    }
+    else if(seperatorPos == currentPos-1 || seperatorPos == currentPos)//pressed just on seperator.
+    {
+        this->setCursorPosition(seperatorPos+2);
+    }
+    else
+    {
+        this->setCursorPosition(currentPos+1);
+        bool pbkContact = this->textCursor().charFormat().fontUnderline();
+        if(pbkContact)
+        {
+            setHighlight(currentPos);
+        }
+    }
+
+    this->update();
+}
+
+void MsgUnifiedEditorLineEdit::gestureEvent(QGestureEvent* event)
+{
+    //passing gesture event to base class.
+    HbLineEdit::gestureEvent(event);
+    
+    
+    if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture)))
+    {
+        //capturing gesture position, and map to local co-ordinates.
+        QPointF pos = mapFromScene(tap->scenePosition());
+        
+        switch (tap->state()) 
+        {
+            case Qt::GestureFinished:
+            {
+                if (HbTapGesture::Tap == tap->tapStyleHint()) 
+                {
+                    handleTap();
+                }
+                break;
+            }
+            default:
+                break;
+        }
+        event->accept();
+    }
+    else
+    {
+        event->ignore();
+    }
+}
+
+void MsgUnifiedEditorLineEdit::setText(const QString& text, bool underlined)
+{
+
+    if(!mDefaultBehaviour)
+    {
+        // atomic operation, ensure one signal only at the end
+        disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
+
+        //make sure previous text is complete.
+        if(this->content().length() > 0)
+        {
+            QInputMethodEvent e;
+            e.setCommitString(";");
+            this->inputMethodEvent(&e);
+        }
+        this->setCursorPosition(this->text().length());
+
+        QTextCursor cursor(this->textCursor());
+        QTextCharFormat colorFormat(cursor.charFormat());
+        if(underlined)
+        {
+            QColor fgColor = colorFormat.foreground().color();
+            fgColor.setAlpha(fadedAlpha);
+            colorFormat.setUnderlineColor(fgColor);
+            colorFormat.setFontUnderline(true);        
+        }
+        cursor.insertText(text , colorFormat);
+        colorFormat.setFontUnderline(false);
+
+        cursor.insertText(replacementStr,colorFormat);
+        connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
+        onContentsChanged();
+    }
+    else
+    {
+       this->setCursorPosition(this->text().length());
+       QTextCursor cursor(this->textCursor());
+       cursor.insertText(text);
+    }
+    
+    moveCursor(QTextCursor::EndOfBlock);
+}
+
+QStringList MsgUnifiedEditorLineEdit::addresses()
+{
+    QString text = this->content();
+    QStringList list = text.split(replacementStr,QString::SkipEmptyParts);
+    return list;
+}
+
+void MsgUnifiedEditorLineEdit::focusInEvent(QFocusEvent* event)
+{    
+    HbLineEdit::focusInEvent(event);
+    this->setCursorVisibility(Hb::TextCursorVisible);
+}
+
+void MsgUnifiedEditorLineEdit::focusOutEvent(QFocusEvent* event)
+{    
+    HbLineEdit::focusOutEvent(event);
+    this->setCursorVisibility(Hb::TextCursorHidden);
+}
+
+void MsgUnifiedEditorLineEdit::setHighlight(int currentPos)
+{
+    QString txt = this->text();    
+
+    int endPos = qMax(txt.indexOf(sepAtMiddle,currentPos),
+                      txt.indexOf(labelSeperator,currentPos));
+
+    int startPos = qMax(txt.lastIndexOf(sepAtMiddle,currentPos),
+                        txt.lastIndexOf(labelSeperator,currentPos));
+
+    disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+               this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+
+    //highlight if pbk contact.
+    if(startPos > 0 && endPos > 0 && startPos != endPos)
+    {
+        this->setSelection(startPos + 2, endPos - startPos - 2);
+        this->update();
+    }
+    else
+    {
+        this->deselect();
+    }
+
+    this->update();
+
+    connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+            this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+}
+
+void MsgUnifiedEditorLineEdit::selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor)
+{
+
+    if(mSelectionSnapTimer.isActive())
+    {
+        mSelectionSnapTimer.stop();
+    }
+
+    if(newCursor.selectionStart() < mLabel.length())
+    {
+        this->setTextCursor(oldCursor);
+        return;
+    }
+
+    if(!mDefaultBehaviour)
+        {
+        mSelectionStart  = newCursor.selectionStart();
+        mSelectionEnd    = newCursor.selectionEnd();
+
+        if(mSelectionStart == mSelectionEnd )
+            {
+            return;
+            }
+    
+        mSelectionSnapTimer.start(SNAP_DELAY,this);
+        }
+}
+
+void MsgUnifiedEditorLineEdit::timerEvent(QTimerEvent *event)
+{
+    //passing event to base class.
+    HbLineEdit::timerEvent(event);
+
+    if (event->timerId() == mSelectionSnapTimer.timerId())
+    {
+        mSelectionSnapTimer.stop();
+
+        disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+                   this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+
+        QString txt = this->text();
+
+        int startPos = qMax(txt.lastIndexOf(sepAtMiddle,mSelectionStart),
+                            txt.lastIndexOf(labelSeperator,mSelectionStart));
+
+        int endPos = qMax(txt.indexOf(sepAtMiddle,mSelectionEnd),
+                          txt.indexOf(labelSeperator,mSelectionEnd));
+
+        if(endPos < 0 )
+        {
+            endPos = mSelectionEnd;
+        }
+
+        this->setSelection(startPos + 2, endPos - startPos - 2);
+
+        connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+                this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+
+        event->accept();
+    }
+}
+
+void MsgUnifiedEditorLineEdit::setDefaultBehaviour(bool defaultBehaviour)
+{
+    mDefaultBehaviour = defaultBehaviour;
+}
+
+QString MsgUnifiedEditorLineEdit::text() const
+{
+    return HbLineEdit::text();
+}
+
+QString MsgUnifiedEditorLineEdit::content() const
+{
+    QString text = this->text();
+    text.remove(mLabel);
+    return text;
+}
+
+void MsgUnifiedEditorLineEdit::clearContent()
+{
+    // avoid getting updates during local editing
+    disconnect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
+    
+    int startPos = mLabel.length();
+    this->setSelection(startPos, content().length());
+    QKeyEvent eve(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier);
+    this->keyPressEvent(&eve);
+    this->deselect();
+
+    // re-connect signal to start getting updates
+    connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
+}
+
+void MsgUnifiedEditorLineEdit::onContentsChanged()
+{
+    emit contentsChanged(content());
+}
+
+void MsgUnifiedEditorLineEdit::highlightInvalidString(QString invalidStr)
+{
+    // for only address editor
+    if(!mDefaultBehaviour)
+    {
+        QString txtContent = this->text();
+        int searchStartPos = mLabel.length();
+        int startPos = txtContent.indexOf(invalidStr, searchStartPos);
+        disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+                   this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+        // if invalidStr found
+        if(startPos > 0)
+        {
+            this->setSelection(startPos, invalidStr.length());
+        }
+        connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
+                this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
+    }
+}
+
+void MsgUnifiedEditorLineEdit::aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos)
+{
+    Q_UNUSED(pos)
+    //clear all menu actions.
+    contextMenu->clearActions();
+    
+    const QMimeData *mimedata = QApplication::clipboard()->mimeData();
+    if(mimedata)
+    {
+        if(canInsertFromMimeData(mimedata))
+        {
+            contextMenu->addAction(LOC_PASTE,this,SLOT(paste()));
+        }
+    }
+
+}
+// eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditormonitor.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,350 @@
+/*
+ * 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: Helper class to monitor msg construction in unified editor
+ *
+ */
+
+// INCLUDES
+#include "debugtraces.h"
+#include <HbNotificationDialog>
+#include <HbWidget>
+
+// USER INCLUDES
+#include "msgunieditormonitor.h"
+#include "msgunieditorview.h"
+#include "msgunieditoraddress.h"
+#include "msgunieditorsubject.h"
+#include "msgunieditorbody.h"
+#include "msgunieditorattachmentcontainer.h"
+#include "UniEditorGenUtils.h"
+
+// Constants
+
+// Define static
+ConvergedMessage::MessageType MsgUnifiedEditorMonitor::mMessageType;
+int MsgUnifiedEditorMonitor::mBodySize;
+int MsgUnifiedEditorMonitor::mContainerSize;
+int MsgUnifiedEditorMonitor::mSubjectSize;
+int MsgUnifiedEditorMonitor::mMaxMmsSize;
+int MsgUnifiedEditorMonitor::mMaxSmsRecipients;
+int MsgUnifiedEditorMonitor::mMaxMmsRecipients;
+int MsgUnifiedEditorMonitor::mMsgCurrAddressCount;
+
+//Localized strings
+#define LOC_POP_MESSAGE_CHANGE_MUL hbTrId("txt_messaging_dpopinfo_message_type_changed_to_mul")
+#define LOC_POP_MESSAGE_CHANGE_TEXT hbTrId("txt_messaging_dpopinfo_message_type_changed_to_tex")
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorMonitor::MsgUnifiedEditorMonitor(QObject* parent) :
+QObject(parent),
+mSkipNote(false)
+{
+    init();
+    mUniEditorGenUtils = new UniEditorGenUtils;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::~MsgUnifiedEditorMonitor
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorMonitor::~MsgUnifiedEditorMonitor()
+{
+    delete mUniEditorGenUtils;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::init
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorMonitor::init()
+{
+    mMessageType = ConvergedMessage::Sms;
+    mBodySize = 0;
+    mContainerSize = 0;
+    mSubjectSize = 0;
+    mMsgCurrAddressCount = 0;
+
+    UniEditorGenUtils* uniEditorGenUtils = new UniEditorGenUtils;
+
+    mMaxMmsSize = KDefaultMaxSize;
+    TRAP_IGNORE(mMaxMmsSize = uniEditorGenUtils->MaxMmsMsgSizeL());
+
+    mMaxSmsRecipients = KDefaultSmsRecipients;
+    TRAP_IGNORE(mMaxSmsRecipients = uniEditorGenUtils->MaxSmsRecipientsL());
+
+    mMaxMmsRecipients = KDefaultMmsRecipients;
+    TRAP_IGNORE(mMaxMmsRecipients = uniEditorGenUtils->MaxMmsRecipientsL());
+
+    delete uniEditorGenUtils;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::handleContentChange
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorMonitor::handleContentChange()
+{
+    // get the projected message type & show the type change note
+    ConvergedMessage::MessageType newMsgType = projectedMsgType();    
+    if(mMessageType != newMsgType)
+    {
+        mMessageType = newMsgType;
+        QString noteStr;
+        if(newMsgType == ConvergedMessage::Sms)
+        {
+            noteStr = LOC_POP_MESSAGE_CHANGE_TEXT;
+        }
+        else
+        {
+            noteStr = LOC_POP_MESSAGE_CHANGE_MUL;
+        }
+        showPopup(noteStr);
+    }
+
+    HbWidget* senderWidget = qobject_cast<HbWidget*>(sender());
+    updateMsgInfo(senderWidget);
+    updateSend();
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::projectedMsgType
+// @see header file
+//---------------------------------------------------------------
+ConvergedMessage::MessageType MsgUnifiedEditorMonitor::projectedMsgType()
+{
+    ConvergedMessage::MessageType newMsgType = ConvergedMessage::Sms;
+
+    // check if MMS content is present in any of the editor component
+    if( bodyHasMMSContent() ||
+        subjectHasMMSContent() ||
+        containerHasMMSContent() ||
+        otherMMSCriteriaMet() )
+    {
+        newMsgType = ConvergedMessage::Mms;
+    }
+    return newMsgType;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::updateMsgInfo
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorMonitor::updateMsgInfo(HbWidget* senderWidget)
+{
+    if(mMessageType == ConvergedMessage::Mms)
+    {
+        //Disable char counter & add subject
+        view()->mBody->disableCharCounter();
+        view()->addSubject();
+    }
+
+    // check if sent by body widget
+    MsgUnifiedEditorBody* body = NULL;
+    body = qobject_cast<MsgUnifiedEditorBody*>(senderWidget);
+    if(body)
+    {
+        mBodySize = view()->mBody->bodySize();
+        view()->setAttachOptionEnabled(
+                MsgUnifiedEditorView::TBE_PHOTO, !view()->mBody->hasImage());
+        view()->setAttachOptionEnabled(
+                MsgUnifiedEditorView::TBE_SOUND, !view()->mBody->hasAudio());
+        return;
+    }
+    
+    // check if sent by subject widget
+    MsgUnifiedEditorSubject* subject = NULL;
+    subject = qobject_cast<MsgUnifiedEditorSubject*>(senderWidget);
+    if(subject)
+    {
+        mSubjectSize = view()->mSubjectField->subjectSize();
+        return;
+    }
+
+    // check if sent by attachment container widget
+    MsgAttachmentContainer* container = NULL;
+    container = qobject_cast<MsgAttachmentContainer*>(senderWidget);
+    if(container)
+    {
+        mContainerSize = view()->mAttachmentContainer->containerSize();
+        return;
+    }
+
+    // handle content change from other widgets e.g. To, Cc, Bcc address field
+    int totalAddressCount = view()->mToField->addressCount();
+    if(view()->mCcField && view()->mBccField)
+    {
+        totalAddressCount += view()->mCcField->addressCount() +
+                view()->mBccField->addressCount();
+    }
+    mMsgCurrAddressCount = totalAddressCount;
+    return;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::showPopup
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorMonitor::showPopup(const QString& text)
+{
+    if(!mSkipNote)
+    {
+        HbNotificationDialog* dlg = new HbNotificationDialog();
+        dlg->setFocusPolicy(Qt::NoFocus);
+        dlg->setDismissPolicy(HbPopup::TapAnywhere);
+        dlg->setAttribute(Qt::WA_DeleteOnClose, true);
+        dlg->setText(text);
+        dlg->show();
+    }
+    // reset skip note flag
+    mSkipNote = false;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::view
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorView* MsgUnifiedEditorMonitor::view()
+{
+    return static_cast<MsgUnifiedEditorView*>(this->parent());
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::bodyHasMMSContent
+// @see header file
+//---------------------------------------------------------------
+bool MsgUnifiedEditorMonitor::bodyHasMMSContent()
+{
+    MsgUnifiedEditorBody* edBody = view()->mBody;
+    // If any media-object is present inside body
+    if(!edBody->mediaContent().isEmpty())
+    {
+        return true;
+    }
+    
+    int bodyTextSize = mUniEditorGenUtils->UTF8Size(edBody->text());
+    int maxSmsSize = 0;
+    TRAP_IGNORE(maxSmsSize = 
+           mUniEditorGenUtils->MaxSmsMsgSizeL(edBody->isUnicode()));
+    // If body text size exceeds sms text-size limit
+    if(bodyTextSize > maxSmsSize)
+    {
+        return true;
+    }
+    return false;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::subjectHasMMSContent
+// @see header file
+//---------------------------------------------------------------
+bool MsgUnifiedEditorMonitor::subjectHasMMSContent()
+{
+    MsgUnifiedEditorSubject* edSubject = view()->mSubjectField;
+    ConvergedMessage::Priority priority = ConvergedMessage::Normal;
+    QString subjectText;
+    if(edSubject)
+    {
+        priority = edSubject->priority();
+        subjectText = edSubject->text();
+    }
+    // If priority is set to other than Normal or
+    // If subject has some content
+    if( (priority != ConvergedMessage::Normal) ||
+        !subjectText.isEmpty() )
+    {
+        return true;
+    }
+    return false;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::containerHasMMSContent
+// @see header file
+//---------------------------------------------------------------
+bool MsgUnifiedEditorMonitor::containerHasMMSContent()
+{
+    QString bodyText = view()->mBody->text();
+    MsgAttachmentContainer* edContainer = view()->mAttachmentContainer;
+    bool hasMMAttachmentContent = false;
+    int attachmentCount = 0;
+    if(edContainer)
+    {
+        hasMMAttachmentContent = edContainer->hasMMContent();
+        attachmentCount = edContainer->count();
+    }
+    // If MM attachments are present or
+    // If only one non-MM attachment is present e.g. vcf along with body text
+    if( hasMMAttachmentContent ||
+        ((attachmentCount == 1) && !bodyText.isEmpty()) )
+    {
+        return true;
+    }
+    return false;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::otherMMSCriteriaMet
+// @see header file
+//---------------------------------------------------------------
+bool MsgUnifiedEditorMonitor::otherMMSCriteriaMet()
+{
+    MsgUnifiedEditorAddress* edCc = view()->mCcField;
+    MsgUnifiedEditorAddress* edBcc = view()->mBccField;
+    int ccCount = 0;
+    int bccCount = 0;
+    if(edCc && edBcc)
+    {
+        ccCount = edCc->addressCount();
+        bccCount = edBcc->addressCount();
+    }
+    // If CC/BCC has some content or
+    // If to-recipients count exceeds max sms recipient count
+    if( ccCount || bccCount ||
+        (view()->mToField->addressCount() > mMaxSmsRecipients) )
+    {
+        return true;
+    }
+    
+    // If to-field contains an email address
+    bool isEmailPresent = false;
+    ConvergedMessageAddressList addrList = view()->mToField->addresses();
+    TRAP_IGNORE(isEmailPresent = mUniEditorGenUtils->VerifyEmailAddressesL(addrList));
+    if(isEmailPresent)
+    {
+        return true;
+    }
+    return false;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorMonitor::updateSend
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorMonitor::updateSend()
+{
+    if (mMsgCurrAddressCount > 0 && (mSubjectSize + mBodySize + mContainerSize) > 0 && !view()->mBody->isImageResizing())
+    {
+        emit enableSend(true);
+    }
+    else
+    {
+        emit enableSend(false);
+    }
+}
+
+
+//EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorpixmapwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,187 @@
+/*
+ * 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: This widget displays the pixmap content.
+ *
+ */
+
+#include "msgunieditorpixmapwidget.h"
+
+// SYSTEM INCLUDES
+#include <HbTapGesture>
+#include <HbWidget>
+#include <HbInstantFeedback>
+#include <HbMenu>
+#include <QPixmap>
+#include <QTimer>
+
+// USER INCLUDES
+#include "msgunieditorutils.h"
+
+// LOCAL CONSTANTS
+#define LOC_OPEN    hbTrId("txt_common_menu_open")
+#define LOC_REMOVE  hbTrId("txt_common_menu_remove")
+#define LOC_DETAILS hbTrId("txt_common_menu_details")
+
+const QString IMAGE_MIMETYPE("image");
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::MsgUnifiedEditorPixmapWidget
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorPixmapWidget::MsgUnifiedEditorPixmapWidget(QGraphicsItem *parent) :
+HbIconItem(parent),
+mEditorUtils(0)
+{
+    this->grabGesture(Qt::TapGesture);
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::~MsgUnifiedEditorPixmapWidget
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorPixmapWidget::~MsgUnifiedEditorPixmapWidget()
+{
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::setPixmap
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::populate(const QString &pixmapPath)
+{
+    mPixmapPath = pixmapPath;
+    QPixmap pixmap(mPixmapPath);
+    this->setIcon(HbIcon(pixmap));
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::gestureEvent
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::gestureEvent(QGestureEvent *event)
+{
+    HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
+    if (tapGesture) {
+        switch (tapGesture->state()) {
+        case Qt::GestureStarted:
+        {
+            // Trigger haptic feedback.
+            HbInstantFeedback::play(HbFeedback::Basic);
+            break;
+        }
+        case Qt::GestureUpdated:
+        {
+            if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
+                // Handle longtap.
+                handleLongTap(tapGesture->scenePosition());
+            }
+            break;
+        }
+        case Qt::GestureFinished:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
+                // Handle short tap
+                handleShortTap();
+            }
+            break;
+        }
+        case Qt::GestureCanceled:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            break;
+        }
+        }
+    }
+    else {
+        HbIconItem::gestureEvent(event);
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::handleOpen
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::handleOpen()
+{
+    this->ungrabGesture(Qt::TapGesture);
+    
+    if (!mEditorUtils) {
+        mEditorUtils = new MsgUnifiedEditorUtils(this);
+    }
+    mEditorUtils->launchContentViewer(IMAGE_MIMETYPE, mPixmapPath);
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::handleSave
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::handleRemove()
+{
+    emit remove();
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::handleSave
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::viewDetails()
+{
+    
+}
+
+//----------------------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::handleShortTap
+// @see header file
+//----------------------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::handleShortTap()
+{
+    emit shortTap(mPixmapPath);
+
+    // Open the media.
+    handleOpen();
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::handleLongTap
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::handleLongTap(const QPointF &position)
+{
+    emit longTap(position);
+
+    HbMenu* menu = new HbMenu;
+    menu->setAttribute(Qt::WA_DeleteOnClose);
+    menu->setDismissPolicy(HbPopup::TapAnywhere);
+    
+    menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+    menu->addAction(LOC_REMOVE, this, SLOT(handleRemove()));
+    menu->addAction(LOC_DETAILS, this, SLOT(viewDetails()));
+    
+    menu->setPreferredPos(position);
+    menu->show();
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorPixmapWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorPixmapWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
+// EOF
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorprocessimageoperation.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -19,13 +19,13 @@
 
 // ========== INCLUDE FILES ================================
 
-#include <BASCHED.H>
+#include <basched.h>
 #include <icl/imagedata.h>
 
 #include <centralrepository.h>
 
-#include <messagingvariant.hrh>
-#include <messaginginternalcrkeys.h> // for Central Repository keys
+#include <MessagingVariant.hrh>
+#include <MessagingInternalCRKeys.h> // for Central Repository keys
 
 #include <MsgMediaResolver.h>
 #include <MsgImageInfo.h>
@@ -43,11 +43,12 @@
 
 #include <msvids.h>
 #include <MmsEngineDomainCRKeys.h>
-#include <mmssettingsdefs.h>
+#include <msgunieditormmssettingsdefs.h>
 #include <HbMessageBox>
+#include <HbAction>
 #include <mmsconst.h>
 
-#include "msgmonitor.h"
+#include "msgunieditormonitor.h"
 #include "msgunieditorprocessimageoperation.h"
 
 // ========== CONSTANTS ====================================
@@ -77,15 +78,14 @@
 // ---------------------------------------------------------
 //
 CUniEditorProcessImageOperation* CUniEditorProcessImageOperation::NewL(
-    MUniEditorProcessImageOperationObserver &aObserver,
-    RFs& aFs )
+    MUniEditorProcessImageOperationObserver &aObserver)
     {
     CUniEditorProcessImageOperation* self = new ( ELeave ) 
-    CUniEditorProcessImageOperation(aObserver,aFs );
+                    CUniEditorProcessImageOperation(aObserver);
             
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop( self );
+    CleanupStack::Pop();
     
     return self;
     }
@@ -95,10 +95,9 @@
 // ---------------------------------------------------------
 //
 CUniEditorProcessImageOperation::CUniEditorProcessImageOperation(
-    MUniEditorProcessImageOperationObserver &aObserver,
-    RFs& aFs ) :    CActive( EPriorityStandard ),
-    iObserver(aObserver),
-    iFs( aFs )
+    MUniEditorProcessImageOperationObserver &aObserver) 
+    :    CActive( EPriorityStandard ),
+         iObserver(aObserver)
     {
             CActiveScheduler::Add( this );
     }
@@ -111,6 +110,8 @@
 //
 void CUniEditorProcessImageOperation::ConstructL()
     {
+    User::LeaveIfError(iFs.Connect());
+    iFs.ShareProtected();            
 
     TInt featureBitmask( 0 );
     
@@ -148,7 +149,7 @@
     
     delete repository;
 
-    iMaxMmsSize = MsgMonitor::maxMmsSize();
+    iMaxMmsSize = MsgUnifiedEditorMonitor::maxMmsSize();
     }
 
 // ---------------------------------------------------------
@@ -164,9 +165,13 @@
     delete iImageProcessor;
 
     //Since iFs doesnot have recursive dir deletion use file manager
-    CFileMan *fm = CFileMan::NewL(iFs);
-    fm->RmDir(KTempFilePath);
-    delete fm;
+    TRAP_IGNORE(
+        CFileMan *fm = CFileMan::NewL(iFs);
+        fm->RmDir(KTempFilePath);
+        delete fm;
+        );
+
+    iFs.Close();
     }
 
 // ---------------------------------------------------------
@@ -269,7 +274,7 @@
         {
         iOperationState = EUniProcessImgProcess;
         }
-    CompleteSelf( KErrNone );
+    checkLargeImage();
     }
   
 // ---------------------------------------------------------
@@ -312,6 +317,7 @@
     
     //Delete the previous object if present
     delete iNewImageInfo;
+    iNewImageInfo = NULL;
     iNewImageInfo = static_cast<CMsgImageInfo*>(mediaResolver->CreateMediaInfoL( iNewImageFile ) );
     
     mediaResolver->ParseInfoDetailsL( iNewImageInfo, iNewImageFile );
@@ -408,11 +414,14 @@
     {
     iProcessMethod = EUniProcessImgMethodNone;
     
-    CMmsConformance* mmsConformance = CMmsConformance::NewL();
-    mmsConformance->CheckCharacterSet( EFalse );
-
-    TMmsConformance conformance = 
-        mmsConformance->MediaConformance( *iImageInfo );
+    CMmsConformance* mmsConformance = NULL;
+    TRAP_IGNORE(mmsConformance = CMmsConformance::NewL());
+    TMmsConformance conformance;
+    if(mmsConformance)
+    {
+        mmsConformance->CheckCharacterSet( EFalse );
+        conformance = mmsConformance->MediaConformance( *iImageInfo );
+    }
     
     if ( conformance.iCanAdapt == EFalse )
         {
@@ -467,9 +476,9 @@
 
     if ( !( iProcessMethod & EUniProcessImgMethodScale ) &&
          ( iImageInfo->FileSize() + 
-           MsgMonitor::messageSize() ) > iMaxMmsSize &&
+           MsgUnifiedEditorMonitor::messageSize() ) > iMaxMmsSize &&
          iImageInfo->MimeType().CompareF( KMsgMimeImageJpeg ) == 0 &&
-         (MsgMonitor::messageSize()) < KUniCompressionMargin )
+         (MsgUnifiedEditorMonitor::messageSize()) < KUniCompressionMargin )
         {
         // Only compression needed as image is JPEG that is larger than can be fitted
         // into the message and scaling is not performed. Also current message size
@@ -477,14 +486,14 @@
         iProcessMethod |= EUniProcessImgMethodCompress;
         }
     
-    TBool largeImageQuery = EFalse;
+    largeImageQuery = EFalse;
     
     if ( iProcessMethod == EUniProcessImgMethodNone )
         {
         // Image won't be processed
         if ( ( origSize.iWidth > KImageRichWidth ||
                origSize.iHeight > KImageRichHeight ) &&
-             ( iImageInfo->FileSize() + MsgMonitor::messageSize() ) < iMaxMmsSize )
+             ( iImageInfo->FileSize() + MsgUnifiedEditorMonitor::messageSize() ) < iMaxMmsSize )
             {
             // Original image width or height is "non-conformant" and original image would 
             // fit to into the message without any processing.
@@ -501,20 +510,31 @@
             largeImageQuery = ETrue;
             }
         }
+ 
+    iScaleSize = scaleSize;
+    return ETrue;
+    }
 
+// ---------------------------------------------------------
+// CUniEditorProcessImageOperation::checkLargeImage
+// ---------------------------------------------------------
+//
+void CUniEditorProcessImageOperation::checkLargeImage()
+{
     //Large image query     
     if( largeImageQuery && iMmsCreationMode == EMmsCreationModeWarning)
     {
-        if(!HbMessageBox::question(LOC_LARGE_IMAGE_NOTE))
-        {
-            return EFalse; // Abort
-        }
-        
+        HbMessageBox::question(LOC_LARGE_IMAGE_NOTE, this,
+                               SLOT(onDialogLargeImage(HbAction*)),
+                               HbMessageBox::Yes | HbMessageBox::No); 
+    }
+    else
+    {
+        CompleteSelf(KErrNone);
     }
         
-    iScaleSize = scaleSize;
-    return ETrue;
-    }
+}
+       
 
 // ---------------------------------------------------------
 // CUniEditorProcessImageOperation::CreateEmptyAttachmentL
@@ -676,5 +696,17 @@
         }
     }
 
+// ---------------------------------------------------------
+// CUniEditorProcessImageOperation::onDialogLargeImage
+// ---------------------------------------------------------
+//
+void CUniEditorProcessImageOperation::onDialogLargeImage(HbAction* action)
+    {
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(1)) {
+        iOperationState = EUniProcessImgError;
+        }
+    CompleteSelf(KErrNone);
+    }
 
 // End of file
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorsubject.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,14 +18,17 @@
 // INCLUDES
 #include "debugtraces.h"
 #include <HbIconItem>
+#include <HbNotificationDialog>
 
 // USER INCLUDES
 #include "msgunieditorsubject.h"
 #include "UniEditorGenUtils.h"
-#include "msgunifiededitorlineedit.h"
+#include "msgunieditorlineedit.h"
+#include "msgunieditormonitor.h"
 
 // Localized Constants
 #define LOC_SUBJECT hbTrId("txt_messaging_formlabel_subject")
+#define LOC_UNABLE_TO_ADD_CONTENT hbTrId("txt_messaging_dpopinfo_unable_to_add_more_content")
 
 //priority icon
 const QString HIGH_PRIORITY("qtg_small_priority_high");
@@ -35,19 +38,12 @@
 // MsgUnifiedEditorSubject::MsgUnifiedEditorSubject
 // @see header file
 //---------------------------------------------------------------
-MsgUnifiedEditorSubject::MsgUnifiedEditorSubject( const QString& pluginPath, QGraphicsItem *parent ) :
-HbWidget(parent),
-mPluginPath(pluginPath),
+MsgUnifiedEditorSubject::MsgUnifiedEditorSubject( QGraphicsItem *parent ) :
+MsgUnifiedEditorBaseWidget(parent),
 mPriorityIcon(NULL),
 mPriority(ConvergedMessage::Normal),
 mGenUtils(0)
 {
-#ifdef _DEBUG_TRACES_
-				qDebug() << "MsgUnifiedEditorSubject calling HbStyle::registerPlugin";
-#endif
-
-        setPluginBaseId(style()->registerPlugin(mPluginPath));
-
         mSubjectEdit = new MsgUnifiedEditorLineEdit(LOC_SUBJECT,this);
         mSubjectEdit->setDefaultBehaviour(true);        
         HbStyle::setItemName(mSubjectEdit,"subjectEdit");
@@ -57,7 +53,7 @@
         mGenUtils = new UniEditorGenUtils();
         
         connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsAdded(const QString&)));
+                this, SLOT(onContentsChanged(const QString&)));
 }
 
 //---------------------------------------------------------------
@@ -66,8 +62,6 @@
 //---------------------------------------------------------------
 MsgUnifiedEditorSubject::~MsgUnifiedEditorSubject()
 {
-    style()->unregisterPlugin(mPluginPath);
-   
     if(mGenUtils)
     {
         delete mGenUtils;
@@ -117,33 +111,28 @@
 	return mPriority;
 }
 
-void MsgUnifiedEditorSubject::onContentsAdded(const QString& text)
+void MsgUnifiedEditorSubject::onContentsChanged(const QString& text)
 {
-    if(!text.isEmpty())
+    // reject any text input if mms size limit is reached
+    int futureSize = subjectSize() +
+            MsgUnifiedEditorMonitor::containerSize() + MsgUnifiedEditorMonitor::bodySize();
+    if(futureSize > MsgUnifiedEditorMonitor::maxMmsSize())
     {
+        // atomic operation
         disconnect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsAdded(const QString&)));
-        if(!subjectOkInSms())
-        {
-            emit contentChanged();
-        }
+                    this, SLOT(onContentsChanged(const QString&)));
+        mSubjectEdit->clearContent();
+        mSubjectEdit->setText(mPrevBuffer);
         connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsRemoved(const QString&)));
+                        this, SLOT(onContentsChanged(const QString&)));
+        HbNotificationDialog::launchDialog(LOC_UNABLE_TO_ADD_CONTENT);
+        return;
     }
-}
 
-void MsgUnifiedEditorSubject::onContentsRemoved(const QString& text)
-{
-    if(text.isEmpty())
+    mPrevBuffer = text;
+    if(!subjectOkInSms())
     {
-        disconnect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
-            this, SLOT(onContentsRemoved(const QString&)));
-        if(!subjectOkInSms())
-        {
-            emit contentChanged();
-        }
-        connect(mSubjectEdit, SIGNAL(contentsChanged(const QString&)),
-                this, SLOT(onContentsAdded(const QString&)));
+        emit contentChanged();
     }
 }
 
@@ -162,7 +151,15 @@
 
 void MsgUnifiedEditorSubject::setText(const QString& text)
 {
-    mSubjectEdit->setText(text);
+    if(!text.isEmpty())
+    {
+        mSubjectEdit->setText(text);
+    }
+}
+
+void MsgUnifiedEditorSubject::setFocus()
+{
+    mSubjectEdit->setFocus(Qt::MouseFocusReason);
 }
 
 //EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorutils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,143 @@
+/*
+ * 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: Utility class for unieditor.
+ *
+ */
+
+#include "msgunieditorutils.h"
+
+// SYSTEM INCLUDES
+#include <xqaiwrequest.h>
+#include <xqrequestinfo.h>
+#include <xqappmgr.h>
+#include <hbglobal.h>
+
+// USER INCLUDES
+#include "msgcontactsutil.h"
+
+// LOCAL CONSTANTS
+#define LOC_TITLE   hbTrId("txt_messaging_title_messaging")
+
+const QString IMAGE_MIMETYPE("image");
+const QString AUDIO_MIMETYPE("audio");
+const QString VCARD_MIMETYPE("text/X-vCard");
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::MsgUnifiedEditorUtils
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorUtils::MsgUnifiedEditorUtils(QObject *parent) :
+QObject(parent)
+{
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::~MsgUnifiedEditorUtils
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorUtils::~MsgUnifiedEditorUtils()
+{
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::addAttachmentWidget
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorUtils::launchContentViewer(const QString &mimeType, const QString &filePath)
+{
+    if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE)) {
+        launchViaSharableFile(filePath);
+    }
+    else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
+        MsgContactsUtil::launchVCardViewer(filePath);
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::handleOk
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorUtils::handleOk(const QVariant& result)
+{
+    emit requestOk(result);
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::handleError
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorUtils::handleError(int errorCode, const QString& errorMessage)
+{
+    emit requestError(errorCode, errorMessage);
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorUtils::launchViaSharableFile
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorUtils::launchViaSharableFile(const QString &filePath)
+{
+    XQSharableFile sf;
+    XQAiwRequest* request = 0;
+
+    if (!sf.open(filePath)) {
+        return;
+    }
+
+    // Get handlers
+    XQApplicationManager appManager;
+    QList<XQAiwInterfaceDescriptor> fileHandlers = appManager.list(sf);
+    if (fileHandlers.count() > 0) {
+        XQAiwInterfaceDescriptor d = fileHandlers.first();
+        request = appManager.create(sf, d);
+
+        if (!request) {
+            sf.close();
+            return;
+        }
+    }
+    else {
+        sf.close();
+        return;
+    }
+
+    // Result handlers
+    connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)),
+        Qt::UniqueConnection);
+    connect(request, SIGNAL(requestError(int,const QString&)), this,
+        SLOT(handleError(int,const QString&)), Qt::UniqueConnection);
+
+    request->setEmbedded(true);
+    request->setSynchronous(true);
+
+    // Fill args
+    QList<QVariant> args;
+    args << qVariantFromValue(sf);
+    request->setArguments(args);
+
+    // Fill headers
+    QString key("WindowTitle");
+    QVariant value(QString(LOC_TITLE));
+    XQRequestInfo info;
+    info.setInfo(key, value);
+    request->setInfo(info);
+
+    request->send();
+
+    // Cleanup
+    sf.close();
+    delete request;
+}
+
+//EOF
--- a/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/src/msgunieditorview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -36,10 +36,13 @@
 #include <HbListWidgetItem>
 #include <HbNotificationDialog>
 #include <HbMessageBox>
+#include <HbAbstractVkbHost>
+#include <HbMainWindow>
 #include <xqaiwrequest.h>
 #include <xqappmgr.h>
-
+#include <HbStyleLoader>
 // QT Mobility for fetching business card
+#include <qmobilityglobal.h>
 #include <qversitwriter.h>
 #include <qversitdocument.h>
 #include <qcontact.h>
@@ -47,20 +50,23 @@
 #include <qversitcontactexporter.h>
 #include <cntservicescontact.h>
 
+
 // USER INCLUDES
 #include "debugtraces.h"
 #include "msgunieditorview.h"
 #include "msgunieditoraddress.h"
 #include "msgunieditorsubject.h"
 #include "msgunieditorbody.h"
-#include "msgmonitor.h"
-#include "msgattachmentcontainer.h"
+#include "msgunieditormonitor.h"
+#include "msgunieditorattachmentcontainer.h"
 #include "msgsendutil.h"
 #include "convergedmessageaddress.h"
-#include "unieditorgenutils.h"
+#include "UniEditorGenUtils.h"
 #include "unieditorpluginloader.h"
 #include "unieditorplugininterface.h"
+#include "msgsettingsview.h"
 
+QTM_USE_NAMESPACE
 // Constants
 const QString SEND_ICON("qtg_mono_send");
 const QString ATTACH_ICON("qtg_mono_attach");
@@ -88,32 +94,48 @@
 //options menu.
 #define LOC_ADD_SUBJECT     hbTrId("txt_messaging_opt_add_subject")
 #define LOC_ADD_CC_BCC      hbTrId("txt_messaging_opt_add_cc_bcc")
-#define LOC_PRIORITY        hbTrId("txt_messaging_setlabel_priority")
-#define LOC_SENDING_OPTIONS hbTrId("txt_messaging_opt_sending_options")
+#define LOC_PRIORITY        hbTrId("txt_messaging_opt_priority")
 #define LOC_DELETE_MESSAGE  hbTrId("txt_messaging_opt_delete_message")
 
 //priority sub menu
-#define LOC_HIGH hbTrId("txt_messaging_setlabel_priority_val_high")
-#define LOC_NORMAL hbTrId("txt_messaging_setlabel_priority_val_normal")
-#define LOC_LOW hbTrId("txt_messaging_setlabel_priority_val_low")
+#define LOC_HIGH hbTrId("txt_messaging_opt_attach_sub_high")
+#define LOC_NORMAL hbTrId("txt_messaging_opt_attach_sub_normal")
+#define LOC_LOW hbTrId("txt_messaging_opt_attach_sub_low")
 
 //group box
 #define LOC_OTHER_RECIPIENTS(n) hbTrId("txt_messaging_group_title_ln_other_recipients",n)
+#define LOC_OTHER_RECIPIENTS_EXPAND hbTrId("txt_messaging_title_other_recipients")
 
 //saved to draft note
 #define LOC_SAVED_TO_DRAFTS    hbTrId("txt_messaging_dpopinfo_saved_to_drafts")
 
 //delete confermation
 #define LOC_NOTE_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
-#define LOC_BUTTON_DELETE       hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL       hbTrId("txt_common_button_cancel")
-#define LOC_DIALOG_OK           hbTrId("txt_common_button_ok")
+
+// attachment addition failure note
+#define LOC_UNABLE_TO_ADD_ATTACHMENTS hbTrId("txt_messaging_dpopinfo_unable_to_attach_l1_of_l2")
 
 //extension list item frame.
 const QString POPUP_LIST_FRAME("qtg_fr_popup_list_normal");
 
+//settings confirmation
+#define LOC_DIALOG_SMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_sms_message_centre_does_not_e")
+#define LOC_DIALOG_MMS_SETTINGS_INCOMPLETE hbTrId("txt_messaging_dialog_mms_access_point_not_defined")
 // LOCAL FUNCTIONS
-QString editorTempPath();
+
+//---------------------------------------------------------------
+// editorTempPath
+// @return fullPath of unified editor's temporary dir
+//---------------------------------------------------------------
+QString editorTempPath()
+{
+    QDir tempDir;
+    QString tempPath(QDir::toNativeSeparators(tempDir.tempPath()));
+    tempPath.append(QDir::separator());
+    tempPath.append(UNIFIED_EDITOR_TEMP_FOLDER);
+    tempPath.append(QDir::separator());
+    return tempPath;
+}
 
 //---------------------------------------------------------------
 // MsgUnifiedEditorView::MsgUnifiedEditorView
@@ -123,6 +145,7 @@
     MsgBaseView(parent),
     mSubjectAction(0),
     mCcBccAction(0),
+    mSendAction(0),
     mMainLayout(0),
     mSubjectField(0),
     mToField(0),
@@ -133,19 +156,40 @@
     mMsgMonitor(0),    
     mAttachmentContainer(0),
     mPluginLoader(0),
-    mCanSaveToDrafts(true)
+    mCanSaveToDrafts(true),
+    mVkbHost(NULL)
     {
-    addMenu();
+    connect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
+    
     addToolBar();
+    initView();
+    }
 
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::~MsgUnifiedEditorView
+// @see header file
+//---------------------------------------------------------------
+MsgUnifiedEditorView::~MsgUnifiedEditorView()
+{
+    // clean editor's temporary contents before exiting
+    removeTempFolder();
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::initView
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::initView()
+{
+    if (!HbStyleLoader::registerFilePath(":/layouts")) {
+        QDEBUG_WRITE("ERROR: MsgUnifiedEditorView -> HbStyleLoader::registerFilePath");
+    }
     HbScrollArea* scrollArea = new HbScrollArea(this);
     this->setWidget(scrollArea);
 
     mContentWidget = new HbWidget(this);
     scrollArea->setContentWidget(mContentWidget);
 
-    mPluginPath = pluginPath(); 
-
     mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, mContentWidget);
     qreal vTopSpacing = 0.0;
     qreal vItemSpacing = 0.0;
@@ -155,10 +199,12 @@
     mMainLayout->setContentsMargins(0,vTopSpacing,0,0);
     mMainLayout->setSpacing(vItemSpacing);
 
-    mMsgMonitor = new MsgMonitor(this);    
+    mMsgMonitor = new MsgUnifiedEditorMonitor(this);
+    connect(mMsgMonitor, SIGNAL(enableSend(bool)), this, SLOT(enableSendButton(bool)));
 
-    mToField = new MsgUnifiedEditorAddress( LOC_TO, mPluginPath, mContentWidget );
-    mBody = new MsgUnifiedEditorBody(mPluginPath, mContentWidget);
+    mToField = new MsgUnifiedEditorAddress( LOC_TO, mContentWidget );
+    
+    mBody = new MsgUnifiedEditorBody( mContentWidget);
 
     mMainLayout->addItem(mToField);
     mMainLayout->addItem(mBody);
@@ -166,55 +212,35 @@
     //Set the invalid msg id
     mOpenedMessageId.setId(-1);
 
-    // create editor's temp folder
-    QDir tempDir = QDir(QString());
-    QString tempPath(editorTempPath());
-    if(tempDir.mkpath(tempPath))
-    {
-        tempDir.cd(tempPath);
-        // remove stale folder content when freshly launched
-        QStringList contentList(tempDir.entryList());
-        int contentCount = contentList.count();
-        for(int i=0; i<contentCount; i++)
-        {
-            tempDir.remove(contentList.at(i));
-        }
-    }
-
     connect(mToField, SIGNAL(sendMessage()), this, SLOT(send()));
+    connect(mToField, SIGNAL(contentChanged()),
+            mMsgMonitor, SLOT(handleContentChange()));
+    connect(mToField, SIGNAL(contentChanged()),this,SLOT(onContentChanged()));
+    
     connect(mBody, SIGNAL(sendMessage()), this, SLOT(send()));
+    connect(mBody, SIGNAL(contentChanged()),this,SLOT(onContentChanged()));
     connect(mBody, SIGNAL(contentChanged()),
-            mMsgMonitor, SLOT(checkMsgTypeChange()));
-    }
-
-//---------------------------------------------------------------
-// MsgUnifiedEditorView::~MsgUnifiedEditorView
-// @see header file
-//---------------------------------------------------------------
-MsgUnifiedEditorView::~MsgUnifiedEditorView()
-{
-    // clean editor's temporary contents before exiting
-    QDir tempDir = QDir(QString());
-    QString tempPath(editorTempPath());
-    tempDir.cd(tempPath);
-    QStringList contentList(tempDir.entryList());
-    int contentCount = contentList.count();
-    for(int i=0; i<contentCount; i++)
-    {
-        tempDir.remove(contentList.at(i));
-    }
-    tempDir.cdUp();
-    tempDir.rmdir(UNIFIED_EDITOR_TEMP_FOLDER);
+            mMsgMonitor, SLOT(handleContentChange()));
+    connect(mBody, SIGNAL(enableSendButton(bool)), this, SLOT(enableSendButton(bool)));    
+    
 }
 
 void MsgUnifiedEditorView::addMenu()
 {
     //Create Menu Options
     HbMenu* mainMenu = new HbMenu();
-
-    //TODO:These 2 should be submenu option to Add
-    mSubjectAction = mainMenu->addAction(LOC_ADD_SUBJECT);
-    mCcBccAction = mainMenu->addAction(LOC_ADD_CC_BCC);
+    mainMenu->setFocusPolicy(Qt::NoFocus);
+	
+    //if subject field / cc,bcc fields are already present don't add corresponding actions.
+    if(!mSubjectField)
+    {
+        mSubjectAction = mainMenu->addAction(LOC_ADD_SUBJECT);
+    }
+    
+    if(!mCcField)
+    {
+        mCcBccAction = mainMenu->addAction(LOC_ADD_CC_BCC);
+    }
     
     HbMenu* prioritySubMenu = mainMenu->addMenu(LOC_PRIORITY);
 
@@ -227,7 +253,6 @@
     HbAction* lowPriorityAction = prioritySubMenu->addAction(LOC_LOW);
     lowPriorityAction->setData(ConvergedMessage::Low);
 
-    HbAction* sendOptionsAction = mainMenu->addAction(LOC_SENDING_OPTIONS);
     HbAction* deleteMsgAction = mainMenu->addAction(LOC_DELETE_MESSAGE);
 
     connect(mSubjectAction,SIGNAL(triggered()),this, SLOT(addSubject()));
@@ -235,7 +260,6 @@
     connect(highPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
     connect(normalPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
     connect(lowPriorityAction, SIGNAL(triggered()), this, SLOT(changePriority()));
-    connect(sendOptionsAction,SIGNAL(triggered()),this, SLOT(sendingOptions()));
     connect(deleteMsgAction,SIGNAL(triggered()),this, SLOT(deleteMessage()));
 
     setMenu(mainMenu);
@@ -271,9 +295,11 @@
     if( msg != NULL )
     {
         //Populate the content inside editor
-        populateContentIntoEditor(*msg);
+        populateContentIntoEditor(*msg,true); // true as it is  draft message
         delete msg;
     }
+    
+    mCanSaveToDrafts = false;  
 }
 
 void MsgUnifiedEditorView::forwardMessage(ConvergedMessageId& messageId,
@@ -328,14 +354,10 @@
     // population logic based on editor Operation command
     switch(editorOp)
     {
-        case MsgBaseView::ADD_RECIPIENTS:
-        {
-            addCcBcc();
-        }
-        break;
         case MsgBaseView::ADD_SUBJECT:
         {
             addSubject();
+            setFocus(mSubjectField);
         }
         break;
         case MsgBaseView::ADD_VCARD:
@@ -355,7 +377,36 @@
     // additional common operations for non-forwarded messages
     if(editorOp != MsgBaseView::FORWARD_MSG)
     {
-        mToField->setAddresses(messageDetails->toAddressList());
+        if(editorOp == MsgBaseView::ADD_RECIPIENTS)
+        {
+            // CV sends contact card address as the first address
+            ConvergedMessageAddressList toAddresses = 
+                    messageDetails->toAddressList();
+            int addrCount = toAddresses.count();
+            if(addrCount > 0)
+            {
+                // add contact card address first
+                ConvergedMessageAddress *firstAddress =
+                        new ConvergedMessageAddress();
+                firstAddress->setAlias(toAddresses.at(0)->alias());
+                firstAddress->setAddress(toAddresses.at(0)->address());
+                ConvergedMessageAddressList firstList;
+                firstList << firstAddress;
+                mToField->setAddresses(firstList);
+            
+                // add remaining contacts now
+                ConvergedMessageAddressList otherList;
+                for(int i=1; i<addrCount; i++)
+                {
+                    otherList << toAddresses.at(i);
+                }
+                mToField->setAddresses(otherList);
+            }
+        }
+        else
+        {
+            mToField->setAddresses(messageDetails->toAddressList());
+        }
         QString bodyTxt = messageDetails->bodyText();
         mBody->setText(bodyTxt);
 
@@ -376,19 +427,11 @@
                 case EMsgMediaImage:
                 {
                     mBody->setImage(filePath);
-                    addSubject();
                 }
                 break;
-                case EMsgMediaVideo:
-                {
-                    mBody->setVideo(filePath);
-                    addSubject();
-                }
-                break;
-                case EMsgMediaAudio:
+                 case EMsgMediaAudio:
                 {
                     mBody->setAudio(filePath);
-                    addSubject();
                 }
                 break;
                 default:
@@ -401,14 +444,16 @@
         // add pending attachments in bulk
         addAttachments(pendingAttList);
     }
-    delete messageDetails;
+    delete messageDetails; 
 }
 
 void MsgUnifiedEditorView::populateContentIntoEditor(
-    const ConvergedMessage& messageDetails)
+    const ConvergedMessage& messageDetails,bool draftMessage)
 {
     // skip first-time MMS type switch note for draft
     mMsgMonitor->setSkipNote(true);
+    mToField->skipMaxRecipientQuery(true);
+
     mToField->setAddresses(messageDetails.toAddressList());
     if(messageDetails.ccAddressList().count() > 0 )
     {
@@ -472,20 +517,12 @@
             {
                 case EMsgMediaImage:
                 {
-                    mBody->setImage(filePath);
-                    addSubject();
-                    break;
-                }
-                case EMsgMediaVideo:
-                {
-                    mBody->setVideo(filePath);
-                    addSubject();
+                    mBody->setImage(filePath,draftMessage);
                     break;
                 }
                 case EMsgMediaAudio:
                 {
                     mBody->setAudio(filePath);
-                    addSubject();
                     break;
                 }
                 default:
@@ -505,6 +542,7 @@
 
     delete genUtils;
     // ensure that any msg-type change after this are shown
+    mToField->skipMaxRecipientQuery(false);
     mMsgMonitor->setSkipNote(false);
 }
 
@@ -519,24 +557,26 @@
     HbAction *attachAction = toolBar->addExtension(attachExtension);    
     attachAction->setIcon(HbIcon(ATTACH_ICON));
     
-    HbListWidget* extnList = new HbListWidget();
-    extnList->addItem(LOC_PHOTO);
-    extnList->addItem(LOC_SOUND);
-    extnList->addItem(LOC_BUSINESS_CARD);
+    mTBExtnContentWidget = new HbListWidget();
+    mTBExtnContentWidget->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Fixed);
+    mTBExtnContentWidget->addItem(LOC_PHOTO);
+    mTBExtnContentWidget->addItem(LOC_SOUND);
+    mTBExtnContentWidget->addItem(LOC_BUSINESS_CARD);
 
-    HbListViewItem *prototype = extnList->listItemPrototype();
+    HbListViewItem *prototype = mTBExtnContentWidget->listItemPrototype();
     HbFrameBackground frame(POPUP_LIST_FRAME, HbFrameDrawer::NinePieces);
     prototype->setDefaultFrame(frame);
 
-    connect(extnList, SIGNAL(activated(HbListWidgetItem*)), this,
-            SLOT(handleViewExtnActivated(HbListWidgetItem*)));
-    connect(extnList, SIGNAL(activated(HbListWidgetItem*)), attachExtension, SLOT(close()));
+    connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)),
+            this, SLOT(handleViewExtnActivated(HbListWidgetItem*)));
+    connect(mTBExtnContentWidget, SIGNAL(activated(HbListWidgetItem*)),
+            attachExtension, SLOT(close()));
 
-    attachExtension->setContentWidget(extnList);
+    attachExtension->setContentWidget(mTBExtnContentWidget);
 
     //Add Action to the toolbar and show toolbar
-    toolBar->addAction(HbIcon(SEND_ICON),QString(),this,SLOT(send()));
-
+    mSendAction = toolBar->addAction(HbIcon(SEND_ICON),QString(),this,SLOT(send()));
+    mSendAction->setDisabled(true);
 
     setToolBar(toolBar);
 }
@@ -547,11 +587,6 @@
     { // do nothing if already present
         return;
     }
-    // remove mainmenu's "Add Subject" action
-    HbMenu* mainMenu = this->menu();
-    mainMenu->removeAction(mSubjectAction);
-    mSubjectAction->setParent(NULL);
-    delete mSubjectAction;
 
     int index =0;
     int offset = 1;
@@ -561,10 +596,28 @@
     }
     index = mMainLayout->count() - offset;
 
-    mSubjectField = new MsgUnifiedEditorSubject(mPluginPath, mContentWidget);
+    mSubjectField = new MsgUnifiedEditorSubject( mContentWidget);
+    
     mMainLayout->insertItem(index,mSubjectField);
     connect(mSubjectField, SIGNAL(contentChanged()),
-            mMsgMonitor, SLOT(checkMsgTypeChange()));    
+            mMsgMonitor, SLOT(handleContentChange()));
+    connect(mSubjectField, SIGNAL(contentChanged()),this,SLOT(onContentChanged()));
+    
+    //set focus to subject field.
+    HbAction* subjectAction = qobject_cast<HbAction*>(this->sender());
+    if(subjectAction)
+    {
+        setFocus(mSubjectField);
+    }
+    
+    // remove mainmenu's "Add Subject" action
+    if(mSubjectAction)
+    {
+        HbMenu* mainMenu = this->menu();
+        mainMenu->removeAction(mSubjectAction);
+        mSubjectAction->setParent(NULL);
+        delete mSubjectAction;
+    }
 }
 
 void MsgUnifiedEditorView::addCcBcc()
@@ -574,19 +627,18 @@
         return;
     }
 
-    // remove mainmenu's "Add Cc/Bcc" & "Add Subject" actions
-    HbMenu* mainmenu = this->menu();
-    mainmenu->removeAction(mCcBccAction);
-    mCcBccAction->setParent(NULL);
-    delete mCcBccAction;
-
-    mCcField    = new MsgUnifiedEditorAddress( LOC_CC, mPluginPath, mContentWidget );
-    mBccField   = new MsgUnifiedEditorAddress( LOC_BCC, mPluginPath, mContentWidget );
+    mCcField    = new MsgUnifiedEditorAddress( LOC_CC, mContentWidget );
+    mBccField   = new MsgUnifiedEditorAddress( LOC_BCC, mContentWidget );
+    mCcField->skipMaxRecipientQuery(true);
+    mBccField->skipMaxRecipientQuery(true);
 
     connect(mCcField, SIGNAL(sendMessage()), this, SLOT(send()));
-    connect(mCcField, SIGNAL(contentChanged()), mMsgMonitor, SLOT(checkMsgTypeChange()));
+    connect(mCcField, SIGNAL(contentChanged()), mMsgMonitor, SLOT(handleContentChange()));
+    connect(mCcField, SIGNAL(contentChanged()),this,SLOT(onContentChanged()));
+    
     connect(mBccField, SIGNAL(sendMessage()), this, SLOT(send()));
-    connect(mBccField, SIGNAL(contentChanged()), mMsgMonitor, SLOT(checkMsgTypeChange()));
+    connect(mBccField, SIGNAL(contentChanged()), mMsgMonitor, SLOT(handleContentChange()));
+    connect(mBccField, SIGNAL(contentChanged()),this,SLOT(onContentChanged()));
 
     HbWidget* groupWidget = new HbWidget(mContentWidget);
     groupWidget->setContentsMargins(0,0,0,0);
@@ -604,12 +656,28 @@
     groupBox->setSizePolicy(QSizePolicy::Minimum,QSizePolicy::Preferred);
     
     groupBox->setContentWidget(groupWidget);
-    groupBox->setHeading(LOC_OTHER_RECIPIENTS(-1));
+    groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND);
     mMainLayout->insertItem(1,groupBox);
     connect(groupBox, SIGNAL(toggled(bool)), this, SLOT(updateOtherRecipientCount(bool)));
     
     // add subject field too
     addSubject();
+
+    //set focus to Cc field.
+    HbAction* ccBccAction = qobject_cast<HbAction*>(this->sender());
+    if(mCcBccAction)
+    {
+        setFocus(mCcField);
+    }
+    
+    // remove mainmenu's "Add Cc/Bcc" & "Add Subject" actions
+    if(mCcBccAction)
+    {
+    HbMenu* mainmenu = this->menu();
+    mainmenu->removeAction(mCcBccAction);
+    mCcBccAction->setParent(NULL);
+    delete mCcBccAction;
+    }
     
     this->updateGeometry();
 }
@@ -621,13 +689,16 @@
     {
         if(!state)
         {
-           groupBox->setHeading(LOC_OTHER_RECIPIENTS(-1));
+           groupBox->setHeading(LOC_OTHER_RECIPIENTS_EXPAND);
         }
         else
         {
             int addrCount = mCcField->addressCount();
             addrCount += mBccField->addressCount();
-            groupBox->setHeading(LOC_OTHER_RECIPIENTS(addrCount));
+            if(addrCount > 0)
+            {
+                groupBox->setHeading(LOC_OTHER_RECIPIENTS(addrCount));    
+            }
         }
     }
 }
@@ -647,40 +718,11 @@
     mSubjectField->setPriority(priority);
 }
 
-void MsgUnifiedEditorView::sendingOptions()
-{
-}
-
 void MsgUnifiedEditorView::deleteMessage()
 {
-    bool ok = HbMessageBox::question(LOC_NOTE_DELETE_MESSAGE,
-                                            LOC_BUTTON_DELETE, LOC_BUTTON_CANCEL);
-    
-    if(ok)
-        {
-        mCanSaveToDrafts = false;
-    
-        //delete if draft entry opened
-        if( mOpenedMessageId.getId() != -1)
-            {    
-            if(!mPluginLoader)
-                {
-                mPluginLoader = new UniEditorPluginLoader(this);
-                }
-        
-            UniEditorPluginInterface* pluginInterface =
-                mPluginLoader->getUniEditorPlugin(MsgMonitor::messageType());
-        
-            pluginInterface->deleteDraftsEntry(mOpenedMessageId.getId());
-            }
-    
-        //trigger back action.
-        HbAction* backAction = this->navigationAction();
-        if(backAction)
-            {
-            backAction->trigger();
-            }
-        }
+    HbMessageBox::question(LOC_NOTE_DELETE_MESSAGE,this,
+                           SLOT(onDialogDeleteMsg(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);
 }
 
 void MsgUnifiedEditorView::removeAttachmentContainer()
@@ -700,30 +742,35 @@
     int i=0;
     for(i=0; i<fcount; i++)
     {
-        if(MsgAttachmentContainer::EAddSizeExceed 
-                == addAttachment(files.at(i)))
+        int status = addAttachment(files.at(i));
+        if(status == MsgAttachmentContainer::EAddSizeExceed)
         {
-            // size already exceeds max mms size-limit
+            QString displayStr = QString(LOC_UNABLE_TO_ADD_ATTACHMENTS)
+                    .arg(fcount-i).arg(fcount);
+            HbNotificationDialog::launchDialog(displayStr);
             break;
         }
     }
-    // check if some files failed to add
-    // happens only when size exceeded during addition
-    if(i<fcount)
-    {
-        // TODO: show a note for size exceed
-    }
 }
 
 int MsgUnifiedEditorView::addAttachment(const QString& filepath)
 {
+    // do nothing if filepath is empty
+    if(filepath.isEmpty())
+    {
+        return MsgAttachmentContainer::EAddSuccess;
+    }
+
     if(!mAttachmentContainer)
     {
-        mAttachmentContainer = new MsgAttachmentContainer(mPluginPath, mContentWidget);
+        mAttachmentContainer = new MsgAttachmentContainer( mContentWidget);
         connect(mAttachmentContainer, SIGNAL(emptyAttachmentContainer()),
                 this, SLOT(removeAttachmentContainer()));
         connect(mAttachmentContainer, SIGNAL(contentChanged()),
-                mMsgMonitor, SLOT(checkMsgTypeChange()));
+                mMsgMonitor, SLOT(handleContentChange()));
+        connect(mAttachmentContainer, SIGNAL(contentChanged()),
+                this,SLOT(onContentChanged()));
+        
         int index = mMainLayout->count() - 1;
         mMainLayout->insertItem(index,mAttachmentContainer);
     }
@@ -737,37 +784,31 @@
             removeAttachmentContainer();
         }
     }
-    else if(mAttachmentContainer->hasMMContent())
-    {
-        // when msg is converted to MMS, subject needs to be auto-inserted
-        addSubject();
-    }
     return ret;
 }
 
-QString MsgUnifiedEditorView::pluginPath()
-{
-    QString pluginPath;
-    #ifdef Q_OS_WIN
-    #define PLUGINPATH "../unifiededitorplugin/debug/unifiededitorplugind.dll"
-    #endif
-    #ifdef Q_OS_SYMBIAN
-    #define PLUGINPATH "unifiededitorplugin.dll"
-    #endif
-    pluginPath.append(PLUGINPATH);
-    return pluginPath;
-}
-
 void MsgUnifiedEditorView::send()
 {
     activateInputBlocker();
+    
+    // first run the address validation tests
+    if( !mToField->validateContacts() ||
+        (mCcField && !mCcField->validateContacts()) ||
+        (mBccField && !mBccField->validateContacts()) )
+    {
+        deactivateInputBlocker();
+        return;
+    }
 
     // converged msg for sending
     ConvergedMessage msg;
-    ConvergedMessage::MessageType messageType = MsgMonitor::messageType();
+    ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType();
     msg.setMessageType(messageType);
 
-    ConvergedMessageAddressList addresses = mToField->addresses();
+    // we need to remove duplicate addresses
+    bool removeDuplicates = true;
+    ConvergedMessageAddressList addresses =
+            mToField->addresses(removeDuplicates);
     if(messageType == ConvergedMessage::Sms &&
        addresses.isEmpty())
     {
@@ -780,11 +821,11 @@
     ConvergedMessageAddressList bccAddresses;
     if(mCcField)
     {
-        ccAddresses = mCcField->addresses();
+        ccAddresses = mCcField->addresses(removeDuplicates);
     }
     if(mBccField)
     {
-        bccAddresses = mBccField->addresses();
+        bccAddresses = mBccField->addresses(removeDuplicates);
     }
     if( messageType == ConvergedMessage::Mms &&
             addresses.isEmpty() &&
@@ -795,6 +836,9 @@
         deactivateInputBlocker();
         return;
     }
+    
+    //close vkb before switching view.
+    mVkbHost->closeKeypad(true);
 
     packMessage(msg);
     
@@ -849,8 +893,7 @@
                 receipient = addrList.at(0)->address();
             }
         }
-
-
+        
     QVariantList params;
 
     if(recepientCount == 1 )
@@ -873,26 +916,31 @@
         deactivateInputBlocker();
         if(sendResult == KErrNotFound)
         {
-        	  bool result = HbMessageBox::question("Settings not defined\nDefine now ?",
-                                         LOC_DIALOG_OK,
-                                         LOC_BUTTON_CANCEL);
-            if (result)
+            if (messageType == ConvergedMessage::Sms)
             {
-              QVariantList params;
-              params << MsgBaseView::MSGSETTINGS;// target view
-              params << MsgBaseView::UNIEDITOR; // source view
-              emit switchView(params);
+                HbMessageBox::question(LOC_DIALOG_SMS_SETTINGS_INCOMPLETE,
+                                       this,SLOT(onDialogSmsSettings(HbAction*)),
+                                       HbMessageBox::Ok | HbMessageBox::Cancel);
+            }
+            else
+            {
+                HbMessageBox::question(LOC_DIALOG_MMS_SETTINGS_INCOMPLETE,
+                                       this,SLOT(onDialogMmsSettings(HbAction*)),                             
+                                       HbMessageBox::Ok | HbMessageBox::Cancel);
             }
         }
     }
 }
 
-void MsgUnifiedEditorView::packMessage(ConvergedMessage &msg)
+void MsgUnifiedEditorView::packMessage(ConvergedMessage &msg, bool isSave)
 {
-    ConvergedMessage::MessageType messageType = MsgMonitor::messageType();
+    ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType();
     msg.setMessageType(messageType);
-
-    ConvergedMessageAddressList addresses = mToField->addresses();
+    // If isSave is true (save to draft usecase), then don't remove duplicates
+    // If isSave is false (send usecase), then remove duplicates
+    bool removeDuplicates = !isSave;
+    ConvergedMessageAddressList addresses = 
+            mToField->addresses(removeDuplicates);
     ConvergedMessageAddressList ccAddresses;
     ConvergedMessageAddressList bccAddresses;
 
@@ -906,47 +954,50 @@
     {
         if(mCcField)
         {
-            ccAddresses = mCcField->addresses();
+            ccAddresses = mCcField->addresses(removeDuplicates);
         }
 
         if(mBccField)
         {
-            bccAddresses = mBccField->addresses();
+            bccAddresses = mBccField->addresses(removeDuplicates);
         }
 
-        int matchDigitsCount = MsgUnifiedEditorAddress::contactMatchDigits();
-        //comapre cc and to field,remove duplicate from cc
-        foreach(ConvergedMessageAddress *ccAddress,ccAddresses)
-        {
-          foreach(ConvergedMessageAddress *toAddress,addresses)
-          {
-             if(0 == ccAddress->address().right(matchDigitsCount).compare(toAddress->address().right(matchDigitsCount)))
-             {
-                ccAddresses.removeOne(ccAddress);
-             }
-          }
-        }
-        //comapre bcc and cc field,remove duplicate from bcc
-        foreach(ConvergedMessageAddress *bccAddress,bccAddresses)
+        if(removeDuplicates)
         {
-          foreach(ConvergedMessageAddress *ccAddress,ccAddresses)
-          {
-             if(0 == bccAddress->address().right(matchDigitsCount).compare(ccAddress->address().right(matchDigitsCount)))
-             {
-                bccAddresses.removeOne(bccAddress);
-             }
-          }
-        }
-        //comapre bcc and to field,remove duplicate from bcc
-        foreach(ConvergedMessageAddress *bccAddress,bccAddresses)
-        {
-          foreach(ConvergedMessageAddress *toAddress,addresses)
-          {
-             if(0 == bccAddress->address().right(matchDigitsCount).compare(toAddress->address().right(matchDigitsCount)))
-             {
-                bccAddresses.removeOne(bccAddress);
-             }
-          }
+            int matchDigitsCount = MsgUnifiedEditorAddress::contactMatchDigits();
+            //comapre cc and to field,remove duplicate from cc
+            foreach(ConvergedMessageAddress *ccAddress,ccAddresses)
+            {
+                foreach(ConvergedMessageAddress *toAddress,addresses)
+                {
+                    if(0 == ccAddress->address().right(matchDigitsCount).compare(toAddress->address().right(matchDigitsCount)))
+                    {
+                        ccAddresses.removeOne(ccAddress);
+                    }
+                }
+            }
+            //comapre bcc and cc field,remove duplicate from bcc
+            foreach(ConvergedMessageAddress *bccAddress,bccAddresses)
+            {
+                foreach(ConvergedMessageAddress *ccAddress,ccAddresses)
+                {
+                    if(0 == bccAddress->address().right(matchDigitsCount).compare(ccAddress->address().right(matchDigitsCount)))
+                    {
+                        bccAddresses.removeOne(bccAddress);
+                    }
+                }
+            }
+            //comapre bcc and to field,remove duplicate from bcc
+            foreach(ConvergedMessageAddress *bccAddress,bccAddresses)
+            {
+                foreach(ConvergedMessageAddress *toAddress,addresses)
+                {
+                    if(0 == bccAddress->address().right(matchDigitsCount).compare(toAddress->address().right(matchDigitsCount)))
+                    {
+                        bccAddresses.removeOne(bccAddress);
+                    }
+                }
+            }
         }
 
         if(ccAddresses.count()>0)
@@ -1005,14 +1056,15 @@
         }
 }
 
-void MsgUnifiedEditorView::saveContentToDrafts()
+int MsgUnifiedEditorView::saveContentToDrafts()
 {
     if(!mCanSaveToDrafts)
         {
-        return;
+        return mOpenedMessageId.getId(); // return currently opened message id
         }
+    
     activateInputBlocker();
-    ConvergedMessage::MessageType messageType = MsgMonitor::messageType();
+    ConvergedMessage::MessageType messageType = MsgUnifiedEditorMonitor::messageType();
 
     ConvergedMessageAddressList addresses = mToField->addresses();
 
@@ -1031,8 +1083,8 @@
 
     if(messageType == ConvergedMessage::Sms &&
             addresses.isEmpty() &&
-            MsgMonitor::bodySize() <= 0 &&
-            MsgMonitor::containerSize() <= 0)
+            MsgUnifiedEditorMonitor::bodySize() <= 0 &&
+            MsgUnifiedEditorMonitor::containerSize() <= 0)
     {
         if(mOpenedMessageId.getId() != -1)
         {
@@ -1041,7 +1093,7 @@
 
         // if empty msg, do not save
         deactivateInputBlocker();
-        return;
+        return INVALID_MSGID;
     }
 
     ConvergedMessageAddressList ccAddresses;
@@ -1065,8 +1117,8 @@
             ccAddresses.isEmpty() &&
             bccAddresses.isEmpty() &&
             subectSize <= 0 &&
-            MsgMonitor::bodySize() <= 0 &&
-            MsgMonitor::containerSize() <= 0)
+            MsgUnifiedEditorMonitor::bodySize() <= 0 &&
+            MsgUnifiedEditorMonitor::containerSize() <= 0)
     {
         if(mOpenedMessageId.getId() != -1)
         {
@@ -1074,10 +1126,10 @@
         }
         // if empty msg, do not send
         deactivateInputBlocker();
-        return;
+        return INVALID_MSGID;
     }
     ConvergedMessage msg;
-    packMessage(msg);
+    packMessage(msg, true);
 
     // save to drafts
     MsgSendUtil *sendUtil = new MsgSendUtil(this);
@@ -1100,6 +1152,7 @@
         {
         HbNotificationDialog::launchDialog(LOC_SAVED_TO_DRAFTS);
         }
+    return msgId;
 }
 
 void MsgUnifiedEditorView::resizeEvent( QGraphicsSceneResizeEvent * event )
@@ -1113,20 +1166,6 @@
 }
 
 //---------------------------------------------------------------
-// editorTempPath
-// @return fullPath of unified editor's temporary dir
-//---------------------------------------------------------------
-QString editorTempPath()
-{
-    QDir tempDir = QDir(QString());
-    QString tempPath(QDir::toNativeSeparators(tempDir.tempPath()));
-    tempPath.append(QDir::separator());
-    tempPath.append(UNIFIED_EDITOR_TEMP_FOLDER);
-    tempPath.append(QDir::separator());
-    return tempPath;
-}
-
-//---------------------------------------------------------------
 // MsgUnifiedEditorView::createVCards
 // @see header file
 //---------------------------------------------------------------
@@ -1134,13 +1173,10 @@
         const QVariant& value, QStringList& filelist)
 {
     // make sure that temp-folder is created for storing vcards
-    QDir tempDir = QDir(QString());
-    if(!tempDir.mkpath(editorTempPath()))
+    if(!createTempFolder())
     {
         return KErrGeneral;
     }
-    tempDir.cd(editorTempPath());
-
 
     // extract contact-list
     QContactManager* contactManager = new QContactManager("symbian");
@@ -1216,7 +1252,7 @@
 //---------------------------------------------------------------
 QString MsgUnifiedEditorView::generateFileName(QString& suggestedName)
 {
-    QDir editorTempDir = QDir(QString());
+    QDir editorTempDir;
     editorTempDir.cd(editorTempPath());
 
     for(int i=0; i<MAX_VCARDS; i++)
@@ -1269,17 +1305,17 @@
         {
         //launch photo picker.
         fetchImages();  
-    }
+        }
     else if(itemText == LOC_SOUND)
         {
         //launch audio picker
         fetchAudio();
-    }
+        }
     else if(itemText == LOC_BUSINESS_CARD)
         {
         //launch contact card picker.
         fetchContacts();
-    }
+        }
    
 }
 
@@ -1325,11 +1361,13 @@
 //---------------------------------------------------------------
 void MsgUnifiedEditorView::fetchImages()
 {
-    QString interface("Image");
-    QString operation("fetch(QVariantMap,QVariant)");
+    QString service("photos");
+    QString interface("com.nokia.symbian.IImageFetch");
+    QString operation("fetch()");
     XQAiwRequest* request = NULL;
     XQApplicationManager appManager;
-    request = appManager.create(interface, operation, true);//embedded
+    request = appManager.create(service,interface, operation, true);//embedded
+    request->setSynchronous(true); // synchronous
     if(!request)
     {     
         QCRITICAL_WRITE("AIW-ERROR: NULL request");
@@ -1340,7 +1378,7 @@
         this, SLOT(imagesFetched(const QVariant&)));
     connect(request, SIGNAL(requestError(int,const QString&)),
         this, SLOT(serviceRequestError(int,const QString&)));
-   
+    
     // Make the request
     if (!request->send())
     {
@@ -1355,29 +1393,11 @@
 //---------------------------------------------------------------
 void MsgUnifiedEditorView::fetchAudio()
 {
-    QString service("Music Fetcher");
-    QString interface("com.nokia.services.media.Music");
-    QString operation("fetch(QString)");
-    XQAiwRequest* request = NULL;
-    XQApplicationManager appManager;
-    request = appManager.create(service, interface, operation, true); //embedded
-    if(!request)
-    {
-        QCRITICAL_WRITE("AIW-ERROR: NULL request");
-        return;
-    }
-
-    connect(request, SIGNAL(requestOk(const QVariant&)),
-        this, SLOT(audiosFetched(const QVariant&)));
-    connect(request, SIGNAL(requestError(int,const QString&)),
-        this, SLOT(serviceRequestError(int,const QString&)));
-
-    // Make the request
-    if (!request->send())
-    {
-        QDEBUG_WRITE_FORMAT("AIW-ERROR: Request Send failed :",request->lastError());
-    }
-    delete request;
+    // Launch Audio fetcher view
+    QVariantList params;
+    params << MsgBaseView::AUDIOFETCHER; // target view
+    params << MsgBaseView::UNIEDITOR; // source view
+    emit switchView(params);
 }
 
 //---------------------------------------------------------------
@@ -1407,26 +1427,6 @@
         {
             QString filepath(QDir::toNativeSeparators(fileList.at(0)));
             mBody->setImage(filepath);
-            addSubject();
-        }
-    }
-}
-
-//---------------------------------------------------------------
-// MsgUnifiedEditorView::audiosFetched
-// @see header file
-//---------------------------------------------------------------
-void MsgUnifiedEditorView::audiosFetched(const QVariant& result )
-{
-    if(result.canConvert<QStringList>())
-    {
-        QStringList fileList = result.value<QStringList>();
-        if ( fileList.size()>0 && !fileList.at(0).isEmpty())
-        {
-            QString filepath(QDir::toNativeSeparators(fileList.at(0)));
-            QDEBUG_WRITE_FORMAT("Received audio file path = ", fileList.at(0));
-            mBody->setAudio(filepath);
-            addSubject();
         }
     }
 }
@@ -1445,19 +1445,220 @@
 // @see header file
 //--------------------------------------------------------------
 void MsgUnifiedEditorView::activateInputBlocker()
-    {
-        this->grabMouse();
-        this->grabKeyboard();
-    }
+{
+    mainWindow()->setInteractive(false);
+}
 
 //---------------------------------------------------------------
 // MsgUnifiedEditorView::deactivateInputBlocker
 // @see header file
 //--------------------------------------------------------------
 void MsgUnifiedEditorView::deactivateInputBlocker()
-    {    
-        this->ungrabKeyboard();
-        this->ungrabMouse();
+{
+    mainWindow()->setInteractive(true);
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::setAttachOptionEnabled
+// @see header file
+//--------------------------------------------------------------
+void MsgUnifiedEditorView::setAttachOptionEnabled(
+        MsgUnifiedEditorView::TBE_AttachOption opt, bool enable)
+{
+    HbListWidgetItem* wgtItem = mTBExtnContentWidget->item(opt);
+    wgtItem->setEnabled(enable);
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbOpened
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbOpened()
+{
+    hideChrome(true); 
+    
+    disconnect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
+}
+      
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::vkbClosed
+// @see header file
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::vkbClosed()
+{
+    hideChrome(false);
+    
+    connect(mVkbHost,SIGNAL(keypadOpened()),this,SLOT(vkbOpened()));
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::hideChrome
+//
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::hideChrome(bool hide)
+{
+    if(hide)
+    {        
+        this->setContentFullScreen(true);
+        this->hideItems(Hb::StatusBarItem | Hb::TitleBarItem);
+    }
+    else
+    {
+        this->setContentFullScreen(false);
+        this->showItems(Hb::StatusBarItem | Hb::TitleBarItem);
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::doDelayedConstruction
+//
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::doDelayedConstruction()
+{
+    addMenu();
+    createTempFolder();
+    
+    //Create VKB instance and listen to VKB open and close signals.
+    mVkbHost = new HbAbstractVkbHost(this);
+    connect(mVkbHost, SIGNAL(keypadOpened()), this, SLOT(vkbOpened()));
+    connect(mVkbHost, SIGNAL(keypadClosed()), this, SLOT(vkbClosed()));
+    
+    disconnect(this->mainWindow(),SIGNAL(viewReady()),this,SLOT(doDelayedConstruction()));
+    
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::createTempFolder
+//
+//---------------------------------------------------------------
+bool MsgUnifiedEditorView::createTempFolder()
+{
+    // create editor's temp folder
+    QDir tempDir;
+    QString tempPath(editorTempPath());
+    bool result = tempDir.mkpath(tempPath);    
+    return result;
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::removeTempFolder
+//
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::removeTempFolder()
+{
+    QDir tempDir;
+    QString tempPath(editorTempPath());
+    tempDir.cd(tempPath);
+    QStringList contentList(tempDir.entryList());
+    
+    int contentCount = contentList.count();
+    for(int i=0; i<contentCount; i++)
+    {
+        tempDir.remove(contentList.at(i));
+    }
+    
+    tempDir.cdUp();
+    tempDir.rmdir(UNIFIED_EDITOR_TEMP_FOLDER); 
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::setFocus
+//
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::setFocus(MsgUnifiedEditorBaseWidget* item)
+{
+    if(item)
+    {
+        item->setFocus();  
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::onContentChanged
+//
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::onContentChanged()
+{
+    mCanSaveToDrafts = true; 
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::onDialogDeleteMsg
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::onDialogDeleteMsg(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+
+        mCanSaveToDrafts = false;
+
+        //delete if draft entry opened
+        if (mOpenedMessageId.getId() != -1) {
+            if (!mPluginLoader) {
+                mPluginLoader = new UniEditorPluginLoader(this);
+            }
+
+            UniEditorPluginInterface* pluginInterface = mPluginLoader->getUniEditorPlugin(
+                MsgUnifiedEditorMonitor::messageType());
+
+            pluginInterface->deleteDraftsEntry(mOpenedMessageId.getId());
+        }
+
+        //trigger back action.
+        HbAction* backAction = this->navigationAction();
+        if (backAction) {
+            backAction->trigger();
+        }
+
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::onDialogSmsSettings
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::onDialogSmsSettings(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        
+        QVariantList params;
+        params << MsgBaseView::MSGSETTINGS;// target view
+        params << MsgBaseView::UNIEDITOR; // source view
+        params << MsgSettingsView::SMSView;
+        emit switchView(params);
+    
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::onDialogMmsSettings
+//---------------------------------------------------------------
+void MsgUnifiedEditorView::onDialogMmsSettings(HbAction* action)
+{
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        
+        QVariantList params;
+        params << MsgBaseView::MSGSETTINGS;// target view
+        params << MsgBaseView::UNIEDITOR; // source view
+        params << MsgSettingsView::MMSView;
+        emit switchView(params); 
+    }
+}
+
+//---------------------------------------------------------------
+// MsgUnifiedEditorView::enableSendButton
+// @see header file
+//--------------------------------------------------------------
+void MsgUnifiedEditorView::enableSendButton(bool enable)
+    {
+    if(mSendAction)
+        {
+         // enable/disable based on only if its disabled/enabled.
+         // this check is to avoid unnecessary calls to mSendAction->setEnabled(enable);
+        if(mSendAction->isEnabled() != enable )
+            mSendAction->setEnabled(enable);
+        }
     }
 
 //EOF
--- a/messagingapp/msgui/unifiededitor/src/msgunifiededitorlineedit.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,535 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include <QGraphicsSceneMouseEvent>
-#include "msgunifiededitorlineedit.h"
-
-const QRegExp expr("[,;\n]$");
-const QRegExp sepAtEnd("; $");
-const QRegExp sepAtMiddle("; ");
-
-const QString replacementStr("; ");
-const QString labelSeperator(": ");
-
-const int fadedAlpha(125);
-const int solidAlpha(255);
-
-const int SNAP_DELAY = 350;
-
-MsgUnifiedEditorLineEdit::MsgUnifiedEditorLineEdit(const QString& label,QGraphicsItem *parent):
-HbLineEdit(parent),
-mSelectionStart(-1),
-mSelectionEnd(-1),
-mDefaultBehaviour(false)
-{
-    QString labelStr = label.trimmed();
-    
-    QTextCursor cursor(this->textCursor());
-    QTextCharFormat colorFormat(cursor.charFormat());
-   
-    QColor fgColor = this->palette().color(QPalette::Text);     
-    fgColor.setAlpha(fadedAlpha);
-    colorFormat.setForeground(fgColor);
-    cursor.insertText(labelStr , colorFormat);
-
-    fgColor.setAlpha(solidAlpha);
-    colorFormat.setForeground(fgColor);
-
-    cursor.insertText(" ",colorFormat);    
-
-    mLabelExpr.setPattern(QString("^"+labelStr+" $"));
-    mLabel = labelStr+" ";
-
-    connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
-            this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
-    connect(this, SIGNAL(contentsChanged()), this, SLOT(onContentsChanged()));
-}
-
-MsgUnifiedEditorLineEdit::~MsgUnifiedEditorLineEdit()
-{
-}
-
-void MsgUnifiedEditorLineEdit::inputMethodEvent(QInputMethodEvent *event)
-{
-    //let it go in default way.
-    if(mDefaultBehaviour)
-    {
-        HbAbstractEdit::inputMethodEvent(event);
-        event->accept();
-        return;
-    }
-
-    if (!event->commitString().isEmpty() || event->replacementLength())
-    {
-        if (event->commitString().contains(expr))
-        {
-            if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
-            {
-                event->accept();
-                return;
-            }
-
-            this->setCursorPosition(this->text().length());
-
-            QString str = event->commitString();
-            str.replace(expr, replacementStr);            
-
-            event->setCommitString(str, event->replacementStart(), event->replacementLength());            
-        }
-        else if(this->hasSelectedText())
-        {// all user inputs get appended at the end
-            this->setCursorPosition(this->text().length());
-        }
-
-        HbAbstractEdit::inputMethodEvent(event);
-        event->accept();
-    }
-}
-
-void MsgUnifiedEditorLineEdit::keyPressEvent(QKeyEvent *event)
-{
-    QString str = event->text();
-
-    if(event->key()== Qt::Key_Enter || event->key()== Qt::Key_Return)
-    {
-        if(mDefaultBehaviour)
-        {
-            HbAbstractEdit::keyReleaseEvent(event);
-            event->accept();
-            return;
-        }
-        if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
-        {
-            event->accept();
-            return;
-        }
-        this->setCursorPosition(this->text().length());
-        str = replacementStr;
-        QKeyEvent eve(event->type(), Qt::Key_Any, event->modifiers(), str);
-        HbAbstractEdit::keyPressEvent(&eve);
-        event->accept();
-        return;
-    }
-
-    if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete )
-    {
-        int pos = this->cursorPosition();
-        bool pbkContact = true;
-
-        if(!this->hasSelectedText())
-        {
-            this->setCursorPosition(pos-2);
-            pbkContact = this->textCursor().charFormat().fontUnderline();
-            this->setCursorPosition(pos);
-        }
-
-        QString text = this->text();
-        text = text.left(pos);
-
-        if(text.contains(mLabelExpr))
-        {
-            event->accept();
-            return;
-        }
-
-        if(pbkContact)
-        {
-            //if already selected delete it.
-            if(this->hasSelectedText())
-            {
-                HbLineEdit::keyPressEvent(event);
-                event->accept();
-
-                //delete seperator (i.e."; ").
-                QKeyEvent eve(event->type(), Qt::Key_Delete, Qt::NoModifier);
-                HbLineEdit::keyPressEvent(&eve);
-                HbLineEdit::keyPressEvent(&eve);
-
-            }
-            else //make it selected
-            {                
-                this->setCursorPosition(pos-3);
-                setHighlight(pos-3);
-            }
-        }
-        else
-        {
-            QString str = text.right(2);
-            if(str == replacementStr)
-            {
-                //delete seperator (i.e."; ").
-                QKeyEvent eve(event->type(), Qt::Key_Backspace, Qt::NoModifier);
-                HbLineEdit::keyPressEvent(&eve);
-                HbLineEdit::keyPressEvent(&eve);
-            }
-            else
-            {
-                HbLineEdit::keyPressEvent(event);
-            }
-            event->accept();
-        }
-        
-        event->accept();
-        return;
-
-    }
-
-    if (event->key() == Qt::Key_Left )
-    {
-        bool selectedText = this->hasSelectedText();
-
-        //look ahead left.
-        int pos = this->cursorPosition();
-
-        QString text = this->text();
-        text = text.left(pos);
-
-        //no text other than label;
-        if(text.contains(mLabelExpr))
-        {
-            event->accept();
-            return;
-        }
-
-        //look for next seperator while going left.
-        int newPos = text.lastIndexOf(sepAtMiddle);
-
-        if(newPos < 0 && selectedText)
-        {
-            event->accept();
-            return;
-        }
-
-        bool pbkContact = true;
-
-        if(!selectedText)
-        {
-            this->setCursorPosition(pos-2);
-            pbkContact = this->textCursor().charFormat().fontUnderline();
-            this->setCursorPosition(pos);
-        }
-        else
-        {
-            this->setCursorPosition(newPos);
-            pbkContact = this->textCursor().charFormat().fontUnderline();
-            this->setCursorPosition(pos);
-        }
-
-
-        if(pbkContact && newPos >0)
-        {
-
-            setHighlight(newPos-1);
-        }
-        else
-        {
-            //move left, char by char. if seperator met jump over it.
-            if( (newPos > 0 && selectedText) || (pos-2  == newPos))
-            {
-                this->setCursorPosition(newPos+1);
-            }
-
-            HbLineEdit::keyPressEvent(event);
-
-        }
-        event->accept();
-        return;
-    }
-
-    if (event->key() == Qt::Key_Right)
-    {
-        bool selectedText = this->hasSelectedText();
-
-        //look ahead.
-        int pos = this->cursorPosition();
-        this->setCursorPosition(pos+3);
-        bool pbkContact = this->textCursor().charFormat().fontUnderline();
-        this->setCursorPosition(pos);
-
-        //look for next seperator.
-        QString text = this->text();
-        int newPos = text.indexOf(sepAtMiddle,pos+2);
-
-        if(pbkContact && newPos >0)
-        {
-            this->setCursorPosition(newPos-1);
-            setHighlight(newPos-1);
-        }
-        else
-        {            
-            int seperatorPos = text.indexOf(sepAtMiddle,pos);
-
-            if(selectedText || seperatorPos == pos)
-            {
-                this->setCursorPosition(pos+1);
-                this->deselect();
-            }
-            HbAbstractEdit::keyPressEvent(event);
-        }
-        event->accept();
-        return;
-    }
-
-    if(!str.isEmpty())
-    {
-        if(mDefaultBehaviour)
-        {
-            HbAbstractEdit::keyPressEvent(event);
-            event->accept();
-            return;
-        }
-        if (str.contains(expr))
-        {
-            if(this->text().isEmpty() || this->text().contains(sepAtEnd) || this->text().contains(mLabelExpr))
-            {
-                event->accept();
-                return;
-            }
-
-            // auto-complete the last incomplete word
-            int contentLength = this->text().length();
-            int pos = this->cursorPosition();
-            QString incompleteWord(this->text().right(contentLength-(pos-1)));
-            if(!incompleteWord.contains(sepAtMiddle))
-            {
-                this->setCursorPosition(this->text().length());
-            }
-
-            str.replace(expr, replacementStr);
-            QKeyEvent eve(event->type(), event->key(), event->modifiers(), str);
-            HbAbstractEdit::keyPressEvent(&eve);
-        }
-        else
-        {
-            HbAbstractEdit::keyPressEvent(event);
-            event->accept();
-            return;
-        }
-    }
-}
-
-void MsgUnifiedEditorLineEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
-{
-    HbAbstractEdit::mouseReleaseEvent(event);
-
-    int currentPos = this->cursorPosition();
-
-    QString txt = this->text();
-
-    QString tempTxt = txt.left(currentPos+2);
-    int seperatorPos = tempTxt.lastIndexOf(sepAtMiddle,currentPos);
-
-    txt = txt.right(txt.length() - currentPos);
-    int labelPos = txt.indexOf(labelSeperator);
-
-    if(labelPos >= 0 )//pressed on label.
-    {
-        this->setCursorPosition(currentPos + labelPos + 2);
-    }
-    else if(seperatorPos == currentPos-1 || seperatorPos == currentPos)//pressed just on seperator.
-    {
-        this->setCursorPosition(seperatorPos+2);
-    }
-    else
-    {
-        this->setCursorPosition(currentPos+1);
-        bool pbkContact = this->textCursor().charFormat().fontUnderline();
-        if(pbkContact)
-        {
-            setHighlight(currentPos);
-        }
-    }
-
-    this->update();
-    event->accept();
-}
-
-void MsgUnifiedEditorLineEdit::setText(const QString& text)
-{
-
-    if(!mDefaultBehaviour)
-    {
-        QInputMethodEvent e;
-        //make sure previous text is complete.
-        e.setCommitString(";");
-        this->inputMethodEvent(&e);
-        this->setCursorPosition(this->text().length());
-
-        QTextCursor cursor(this->textCursor());
-        QTextCharFormat colorFormat(cursor.charFormat());
-        QColor fgColor = colorFormat.foreground().color();
-        fgColor.setAlpha(fadedAlpha);
-        colorFormat.setUnderlineColor(fgColor);
-
-        colorFormat.setFontUnderline(true);
-        cursor.insertText(text , colorFormat);
-        colorFormat.setFontUnderline(false);
-
-        cursor.insertText(replacementStr,colorFormat);       
-    }
-    else
-    {
-       this->setCursorPosition(this->text().length());
-       QTextCursor cursor(this->textCursor());
-       cursor.insertText(text);
-    }
-    
-    this->setCursorVisibility(Hb::TextCursorHidden);
-}
-
-QStringList MsgUnifiedEditorLineEdit::addresses()
-{
-    QString text = this->content();
-    QStringList list = text.split(replacementStr,QString::SkipEmptyParts);
-    return list;
-}
-
-void MsgUnifiedEditorLineEdit::focusInEvent(QFocusEvent* event)
-{    
-    HbLineEdit::focusInEvent(event);
-    this->setCursorVisibility(Hb::TextCursorVisible);
-}
-
-void MsgUnifiedEditorLineEdit::setHighlight(int currentPos)
-{
-    QString txt = this->text();    
-
-    int endPos = qMax(txt.indexOf(sepAtMiddle,currentPos),
-                      txt.indexOf(labelSeperator,currentPos));
-
-    int startPos = qMax(txt.lastIndexOf(sepAtMiddle,currentPos),
-                        txt.lastIndexOf(labelSeperator,currentPos));
-
-    disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
-               this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
-
-    //highlight if pbk contact.
-    if(startPos > 0 && endPos > 0 && startPos != endPos)
-    {
-        this->setSelection(startPos + 2, endPos - startPos - 2);
-        this->update();
-    }
-    else
-    {
-        this->deselect();
-    }
-
-    this->update();
-
-    connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
-            this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
-}
-
-void MsgUnifiedEditorLineEdit::cut()
-{
-    HbLineEdit::cut();
-    //after cut delete seperator (i.e."; ").
-    QKeyEvent eve(QEvent::KeyPress, Qt::Key_Delete, Qt::NoModifier);
-    HbLineEdit::keyPressEvent(&eve);
-    HbLineEdit::keyPressEvent(&eve);
-}
-
-void MsgUnifiedEditorLineEdit::selectAll()
-{
-    //don't allow user to select every thing.
-    //do nothing.
-}
-
-void MsgUnifiedEditorLineEdit::selectionChanged(const QTextCursor &oldCursor, const QTextCursor& newCursor)
-{
-
-    if(mSelectionSnapTimer.isActive())
-    {
-        mSelectionSnapTimer.stop();
-    }
-
-    if(newCursor.selectionStart() < mLabel.length())
-    {
-        this->setTextCursor(oldCursor);
-        return;
-    }
-
-    if(!mDefaultBehaviour)
-        {
-        mSelectionStart  = newCursor.selectionStart();
-        mSelectionEnd    = newCursor.selectionEnd();
-
-        if(mSelectionStart == mSelectionEnd )
-            {
-            return;
-            }
-    
-        mSelectionSnapTimer.start(SNAP_DELAY,this);
-        }
-}
-
-void MsgUnifiedEditorLineEdit::timerEvent(QTimerEvent *event)
-{
-    //passing event to base class.
-    HbLineEdit::timerEvent(event);
-
-    if (event->timerId() == mSelectionSnapTimer.timerId())
-    {
-        mSelectionSnapTimer.stop();
-
-        disconnect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
-                   this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
-
-        QString txt = this->text();
-
-        int startPos = qMax(txt.lastIndexOf(sepAtMiddle,mSelectionStart),
-                            txt.lastIndexOf(labelSeperator,mSelectionStart));
-
-        int endPos = qMax(txt.indexOf(sepAtMiddle,mSelectionEnd),
-                          txt.indexOf(labelSeperator,mSelectionEnd));
-
-        if(endPos < 0 )
-        {
-            endPos = mSelectionEnd;
-        }
-
-        this->setSelection(startPos + 2, endPos - startPos - 2);
-
-        connect(this,SIGNAL(selectionChanged(QTextCursor,QTextCursor)),
-                this,SLOT(selectionChanged(QTextCursor,QTextCursor)));
-
-        event->accept();
-    }
-}
-
-void MsgUnifiedEditorLineEdit::setDefaultBehaviour(bool defaultBehaviour)
-{
-    mDefaultBehaviour = defaultBehaviour;
-}
-
-QString MsgUnifiedEditorLineEdit::text() const
-{
-    return HbLineEdit::text();
-}
-
-QString MsgUnifiedEditorLineEdit::content() const
-{
-    QString text = this->text();
-    text.remove(mLabel);
-    return text;
-}
-
-void MsgUnifiedEditorLineEdit::onContentsChanged()
-{
-    emit contentsChanged(content());
-}
-// eof
--- a/messagingapp/msgui/unifiededitor/unifiededitor.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/unifiededitor.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -26,10 +26,12 @@
 INCLUDEPATH += ../msguiutils/inc
 INCLUDEPATH += ../../msgutils/unieditorutils/editorgenutils/inc
 INCLUDEPATH += ../../msgutils/unidatautils/unidatamodelloader/inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
+INCLUDEPATH += ../../msgsettings/settingsview/inc
+
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 CONFIG += hb
+HB += hbfeedback
 
 TARGET.EPOCALLOWDLLDATA = 1
 TARGET.CAPABILITY = All -TCB
@@ -42,37 +44,52 @@
 BLD_INF_RULES.prj_exports += "$${LITERAL_HASH}include <platform_paths.hrh>" \
     "rom/unifiededitor.iby CORE_APP_LAYER_IBY_EXPORT_PATH(unifiededitor.iby)"
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/unifiededitor.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/unifiededitor.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 # Input
-HEADERS += msgmonitor.h \
+HEADERS += msgunieditormonitor.h \
     msgunieditoraddress.h \
     msgunieditorattachment.h \
     msgunieditorbody.h \
     msgunieditorsubject.h \
     msgunieditorview.h \
-    msgunifiededitorlineedit.h \
-    msgattachmentcontainer.h \
+    msgunieditorlineedit.h \
+    msgunieditorattachmentcontainer.h \
     msgbaseview.h \
     msgunieditorimageprocessor.h \
-    msgunieditorprocessimageoperation.h
+    msgunieditorprocessimageoperation.h \
+    msgunieditorbasewidget.h \
+    msgunieditorpixmapwidget.h \
+    msgunieditorutils.h \
+    msgunieditoraudiowidget.h
 
-SOURCES += msgmonitor.inl \
-    msgmonitor.cpp \
+SOURCES += msgunieditormonitor.inl \
+    msgunieditormonitor.cpp \
     msgunieditoraddress.cpp \
     msgunieditorattachment.cpp \
     msgunieditorbody.cpp \
     msgunieditorsubject.cpp \
     msgunieditorview.cpp \
-    msgunifiededitorlineedit.cpp \
-    msgattachmentcontainer.cpp \
+    msgunieditorlineedit.cpp \
+    msgunieditorattachmentcontainer.cpp \
     msgunieditorimageprocessor.inl \
     msgunieditorimageprocessor.cpp \
-    msgunieditorprocessimageoperation.cpp
+    msgunieditorprocessimageoperation.cpp \
+    msgunieditorpixmapwidget.cpp \
+    msgunieditorutils.cpp \
+    msgunieditoraudiowidget.cpp
 
 RESOURCES += unifiededitor.qrc
 
 # Libs
-LIBS += -ls60qconversions \
-        -lconvergedmessageutils \
+LIBS += -lconvergedmessageutils \
         -lmsguiutils \
         -lunieditorpluginloader \
         -leditorgenutils \
@@ -90,7 +107,8 @@
         -lxqservice \
         -lgsmu \
         -lsmcm \
-        -lxqserviceutil
-
+        -lxqserviceutil \
+        -lcommonengine \
+        -lefsrv
 
         
\ No newline at end of file
--- a/messagingapp/msgui/unifiededitor/unifiededitor.qrc	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiededitor/unifiededitor.qrc	Fri Jun 25 15:47:40 2010 +0530
@@ -1,14 +1,16 @@
 <RCC>
     <qresource prefix="/">
-        <file alias="animation.axml">resources/animation.axml</file>
-       <file alias="qtg_anim_longtap_1.svg">resources/qtg_anim_longtap_1.svg</file>
-       <file alias="qtg_anim_longtap_2.svg">resources/qtg_anim_longtap_2.svg</file>
-       <file alias="qtg_anim_longtap_3.svg">resources/qtg_anim_longtap_3.svg</file>
-       <file alias="qtg_anim_longtap_4.svg">resources/qtg_anim_longtap_4.svg</file>
-       <file alias="qtg_anim_longtap_5.svg">resources/qtg_anim_longtap_5.svg</file>
-       <file alias="qtg_anim_longtap_6.svg">resources/qtg_anim_longtap_6.svg</file>
-       <file alias="qtg_anim_longtap_7.svg">resources/qtg_anim_longtap_7.svg</file>
-       <file alias="qtg_anim_longtap_8.svg">resources/qtg_anim_longtap_8.svg</file>
-       <file alias="qtg_anim_longtap_9.svg">resources/qtg_anim_longtap_9.svg</file>       
+        <file alias="qtg_anim_loading.axml">resources/qtg_anim_loading.axml</file>
+    </qresource>
+    <qresource prefix="/layouts">
+        <file alias="msgunifiededitoraddress.css">resources/layouts/msgunifiededitoraddress.css</file>
+        <file alias="msgunifiededitoraddress.widgetml">resources/layouts/msgunifiededitoraddress.widgetml</file>
+        <file alias="msgunifiededitorattachment.css">resources/layouts/msgunifiededitorattachment.css</file>
+        <file alias="msgunifiededitorattachment.widgetml">resources/layouts/msgunifiededitorattachment.widgetml</file>
+        <file alias="msgunifiededitorbody.css">resources/layouts/msgunifiededitorbody.css</file>
+        <file alias="msgunifiededitorbody.widgetml">resources/layouts/msgunifiededitorbody.widgetml</file>
+        <file alias="msgunifiededitorsubject.css">resources/layouts/msgunifiededitorsubject.css</file>
+        <file alias="msgunifiededitorsubject.widgetml">resources/layouts/msgunifiededitorsubject.widgetml</file>
+        <file alias="msgunifiededitorattachment_color.css">resources/layouts/msgunifiededitorattachment_color.css</file>
     </qresource>
 </RCC>
--- a/messagingapp/msgui/unifiedviewer/inc/unicontentswidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/unicontentswidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -81,7 +81,7 @@
         /**
          * this signal is emitted when sendMessage is emitted. from UniViewerTextItem.
          */
-        void sendMessage(const QString& phoneNumber);
+    void sendMessage(const QString& phoneNumber,const QString& alias = QString());
 
 private:
 
--- a/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/unifiedviewer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -28,14 +28,13 @@
 
 #include "convergedmessage.h"
 
-class QGraphicsLinearLayout;
 class UniViewerFeeder;
 class ConvergedMessage;
 class HbScrollArea;
 class UniScrollArea;
 class UniContentsWidget;
 class MessageDeleteAction;
-
+class HbAction;
 /**
  * Main view of unified viewer.
  */
@@ -47,7 +46,9 @@
     /**
      * Constructor
      */
-    UnifiedViewer(const qint32 messageId, QGraphicsItem *parent = 0);
+    UnifiedViewer(const qint32 messageId, 
+                  int canForwardMessage = 0,
+                  QGraphicsItem *parent = 0);
 
     /**
      * Destructor
@@ -74,13 +75,7 @@
      * @see HbView
      */
     void createToolBar();
-
-    /**
-     * Validates if message can be forwarded
-     * @return true if message can be forwarded
-     *         false if message cant be forwarded
-     */
-    bool validateMsgForForward();
+   
 
 public slots:
 
@@ -102,15 +97,15 @@
      * This slot is called when sendMessage signal is emitted for a highlighted
      * phone number, from body widget.
      */
-    void sendMessage(const QString& phoneNumber);
-
-private:
+    void sendMessage(const QString& phoneNumber, const QString& alias = QString());
 
     /**
-     * Main grid layout
-     * Owned
+     * This slot is called when delete message dialog is launched.
+     * @param action selected action (yes or no).
      */
-    QGraphicsLinearLayout* mMainLayout;
+    void onDialogDeleteMsg(HbAction* action);
+    
+private:
 
     /**
      * Feeder object
@@ -144,6 +139,11 @@
      * Message count
      */
     int mMsgCount;
+    
+	/**
+	 * Forward status of message
+	 */
+    bool mForwardMessage;
 };
 
 #endif
--- a/messagingapp/msgui/unifiedviewer/inc/unihighlighter.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
-/*
- * 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: Enables parsing and change font parameters for email/url
- *
- */
-
-#ifndef UNI_HIGHLIGHTER_H
-#define UNI_HIGHLIGHTER_H
-
-#include <QSyntaxHighlighter>
-#include <QHash>
-#include <QTextCharFormat>
-
-QT_BEGIN_NAMESPACE
-class QTextDocument;
-QT_END_NAMESPACE
-
-/**
- * Enables parsing and change font parameters for email/url
- */
-class UniHighlighter : public QSyntaxHighlighter
-{
-Q_OBJECT
-
-public:
-    /*
-     * Constructor
-     */
-    UniHighlighter(QTextDocument *parent = 0);
-
-protected:
-    /*
-     * highlightBlock
-     * @see QSyntaxHighlighter
-     */
-    void highlightBlock(const QString &text);
-
-private:
-
-    struct HighlightingRule
-    {
-        QRegExp pattern;
-        QTextCharFormat format;
-    };
-    QVector<HighlightingRule> highlightingRules;
-
-    QTextCharFormat emailFormat;
-    QTextCharFormat urlFormat;
-};
-
-#endif //UNI_HIGHLIGHTER_H
-// EOF
--- a/messagingapp/msgui/unifiedviewer/inc/uniscrollarea.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/uniscrollarea.h	Fri Jun 25 15:47:40 2010 +0530
@@ -49,16 +49,6 @@
      */
     void setPosToStart();
 
-    /**
-     * Handler for UpGesture
-     */
-    void upGesture(int value);
-
-    /**
-     * Handler for DownGesture
-     */
-    void downGesture(int value);
-
 public slots:
     /**
      * Handle scrolling started signal
--- a/messagingapp/msgui/unifiedviewer/inc/unitexteditor.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * 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: Custom widget derived from HbTextEdit which provides rich text
- *              processing
- *
- */
-#ifndef UNI_TEXT_EDITOR_H
-#define UNI_TEXT_EDITOR_H
-
-#include <hbwidget.h>
-#include <hbtextedit.h>
-#include <qobject.h>
-#include <QTextCursor>
-#include <QTextDocument>
-#include <QTextOption>
-#include <QString>
-
-#include "unidatamodelplugininterface.h"
-
-class QGraphicsItem;
-
-/**
- * UniTextEditor provides support for rich text processing
- */
-class UniTextEditor : public HbTextEdit
-{
-Q_OBJECT
-public:
-    /**
-     * Constructor
-     */
-    UniTextEditor(QGraphicsItem * parent = 0);
-
-    /**
-     * Destructor
-     */
-    ~UniTextEditor();
-
-public:
-
-    /**
-     * called when focus is gained.
-     */
-    void focusInEvent(QFocusEvent *event);
-
-    /**
-     * called when focus is lost.
-     */
-    void focusOutEvent(QFocusEvent *event);
-
-    /**
-     * called when mouse is pressed.
-     */
-    void mousePressEvent(QGraphicsSceneMouseEvent *event);
-
-    /**
-     * called when mouse is moved.
-     */
-    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
-
-    /**
-     * called when mouse is released.
-     */
-    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-
-    };
-
-#endif // UNI_TEXT_EDITOR_H
-// EOF
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresscontainer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -26,8 +26,6 @@
 
 // FORWARD DECLARATIONS
 class QGraphicsLinearLayout;
-class HbIconItem;
-class UniViewerAddressWidget;
 
 /**
  * Container widget for all the address widgets
@@ -68,46 +66,28 @@
     void setCcField(ConvergedMessageAddressList ccRecipients);
 
     /**
+     * Sets Bcc recipients
+     * @param bccRecipients list of Bcc recipients
+     */
+    void setBccField(ConvergedMessageAddressList bccRecipients);
+
+    /**
      * Clears the content of the widget
      */
     void clearContent();
 
+signals:
     /**
-     * Inserts divider into layout.
+     * this signal is emitted when send message is triggered form UniViewerAddressWidget
      */
-    void insertDivider();
+    void sendMessage(const QString& phoneNumber,const QString& alias);
 
 private:
 
     /**
-     * Main layout reference.
-     * Own
-     */
-    QGraphicsLinearLayout *mMainLayout;
-
-    /**
-     * From widget reference.
-     * Own
+     * Main Layout
      */
-    UniViewerAddressWidget *mFromWidget;
-
-    /**
-     * To widget reference.
-     * Own
-     */
-    UniViewerAddressWidget *mToWidget;
-
-    /**
-     * Cc widget reference.
-     * Own
-     */
-    UniViewerAddressWidget *mCcWidget;
-
-    /**
-     * Divider icon item.
-     * Own
-     */
-    HbIconItem *mDivider;
+    QGraphicsLinearLayout* mMainLayout;
 };
 
 #endif // UNI_VIEWER_ADDRESS_CONTAINER_H
--- a/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraddresswidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -11,40 +11,35 @@
  *
  * Contributors:
  *
- * Description:
+ * Description: Custom widget derived from HbTextEdit which provides rich text
+ *              processing
  *
  */
-
 #ifndef UNI_VIEWER_ADDRESS_WIDGET_H
 #define UNI_VIEWER_ADDRESS_WIDGET_H
 
-// SYSTEM INCLUDES
-#include <HbWidget>
+#include <HbTextEdit>
 
-// USER INCLUDES
-#include "convergedmessageaddress.h"
+#include "unidatamodelplugininterface.h"
 
-// FORWARD DECLARATIONS
-class QPointF;
-class HbMenu;
-class UniTextEditor;
-
-class UniViewerAddressWidget : public HbWidget
+/**
+ * UniViewerAddressWidget provides support for rich text processing
+ */
+class UniViewerAddressWidget : public HbTextEdit
 {
-Q_OBJECT
-
+    Q_OBJECT
+    
 public:
-
     /**
      * Constructor
      */
-    explicit UniViewerAddressWidget(QGraphicsItem *parent = 0);
+    UniViewerAddressWidget(QGraphicsItem * parent = 0);
 
     /**
      * Destructor
      */
-    virtual ~UniViewerAddressWidget();
-
+    ~UniViewerAddressWidget();
+    
     /**
      * Populates the addresses and creates the anchors on them.
      * @param label Label of the address like - "From"
@@ -57,32 +52,98 @@
      * @param label Label of the address like - "To", "Cc"
      * @param addressList List of addresses to be populated.
      */
-    void populate(const QString &label,
-                ConvergedMessageAddressList addressList);
+    void populate(const QString &label,ConvergedMessageAddressList addressList);
 
     /**
      * Clears the contents of the widget.
      */
     void clearContent();
 
+protected:
+    /**
+     * Gesture event, overridden from base class.
+     */
+    void gestureEvent(QGestureEvent* event);
+    
+private:
+    /**
+     * Helper method to highlight find item on tap.
+     * @param highlight, if true highlight else dont.
+     */
+    void highlightText(bool highlight);
+    
+    /**
+     * short tap handler.
+     * @param anchor anchor at cursor position.
+     */
+    void shortTapAction(QString anchor); 
+    
+    /** Helper method to get contact id against phone number or e-mail id.
+     * @param value phone number or email id.
+     * @param fieldName name of field to be matched.
+     * @param fieldType type of field to be matched.
+     */
+    int resolveContactId(const QString& value,
+                         const QString& fieldName, 
+                         const QString& fieldType);
+    
+    
 private slots:
 
     /**
-     * Handles the aboutToShowContextMenu() signal generated by HbAbstractEdit.
-     * @see HbAbstractEdit
-     * @param contextMenu Reference of the context menu.
-     * @param pos Position at which the context menu will be displayed.
+      * called when aboutToShowContextMenu signal is emitted.
+      */
+    void aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos);
+    
+    /**
+     * Called when option menu is closed.
+     */
+    void menuClosed();
+    
+    /**
+     * handlers for phone number specific menu items.
+     */
+    void openContactInfo();
+    void call();
+    void saveToContacts();
+    void sendMessage();
+    void copyToClipboard();
+    
+    /**
+     * called after service request is completed.
      */
-    void handleAboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos);
+    void onServiceRequestCompleted();
+    
+    /**
+     * Slot for handling valid returns from the framework.
+     * 
+     * @param result const QVariant&
+     */
+    void handleOk(const QVariant& result);
+    
+    /**
+     * Slot for handling errors. Error ids are provided as 
+     * 32-bit integers.
+     * @param errorCode qint32
+     */
+    void handleError(int errorCode, const QString& errorMessage);
+    
 
+signals:
+    /**
+     * this signal is emitted when send message is triggered for a highlighted number.
+     */
+    void sendMessage(const QString& phoneNumber,const QString& alias);
+    
 private:
+    //Current cursor position.
+    int mCursorPos;
+    
+    //char formats for highlight.
+    QTextCharFormat mFormatHighlight;
+    QTextCharFormat mFormatNormal;
 
-    /**
-     * Reference of the editor.
-     * Own
-     */
-    UniTextEditor *mAddress;
-};
+    };
 
 #endif // UNI_VIEWER_ADDRESS_WIDGET_H
 // EOF
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentcontainer.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-/*
-* 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:  This holds all the attachments inside convergedmessage
-*
-*/
-
-#ifndef UNIVIEWERATTACHMENTCONTAINER_H
-#define UNIVIEWERATTACHMENTCONTAINER_H
-
-// SYSTEM INCLUDES
-#include <HbWidget>
-#include <QList>
-
-// FORWARD DECLARATIONS
-class QGraphicsLinearLayout;
-class UniViewerMediaWidget;
-
-//const int MAX_ATTACHMENT = 10;
-
-/**
- * Container widget for all attachment inside message
- */
-
-class UniViewerAttachmentContainer: public HbWidget
-{
-Q_OBJECT
-
-public:
-
-    /**
-     * Constructor
-     */
-    explicit UniViewerAttachmentContainer(QGraphicsItem *parent = 0);
-
-    /**
-     * Destructor
-     */
-    virtual ~UniViewerAttachmentContainer();
-
-    /**
-     * Add one more attachment into the widget
-     */
-    void addAttachmentWidget(QString type, QString fileName);
-
-    /**
-     * Clears the content of the widget
-     */
-    void clearContent();
-
-private:
-
-    /**
-     * This contains total number of attacmnets added
-     */
-    int mTotalAttachment;
-
-    /**
-     * Main layout reference.
-     * Own
-     */
-    QGraphicsLinearLayout *mMainLayout;
-
-    /**
-     * From widget reference.
-     * Own
-     */
-    QList<UniViewerMediaWidget *> mUniViewerMediaWidgetList;
-
-};
-
-#endif // UNIVIEWERATTACHMENTCONTAINER_H
-//eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerattachmentwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,161 @@
+/*
+ * 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: Widget for displaying attachment media objects.
+ *
+ */
+
+#ifndef UNI_VIEWER_ATTACHMENT_WIDGET_H
+#define UNI_VIEWER_ATTACHMENT_WIDGET_H
+
+// SYSTEM INCLUDES
+#include <HbWidget>
+
+// FORWARD DECLARATIONS
+class HbTextItem;
+class HbIconItem;
+class HbIcon;
+class HbFrameItem;
+class UniViewerUtils;
+class UniMessageInfo;
+
+/**
+ * @class UniViewerAttachmentWidget
+ * @brief Widget for displaying attachment media objects.
+ */
+class UniViewerAttachmentWidget: public HbWidget
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    explicit UniViewerAttachmentWidget(QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    virtual ~UniViewerAttachmentWidget();
+
+    /**
+     * Populates the widget contents.
+     * @param info Object information.
+     */
+    void populate(UniMessageInfo *info);
+
+signals:
+
+    /**
+     * Signal emitted when widget is clicked.
+     * @param mediaPath File path of the media.
+     */
+    void shortTap(const QString &mediaPath);
+
+    /**
+     * Signal emitted when widget is long tapped.
+     * @param position Scene coordinates of tap.
+     */
+    void longTap(const QPointF &position);
+
+protected:
+
+    /**
+     * Event handler for gesture events.
+     * Reimplemented from HbWidgetBase.
+     * @see HbWidgetBase
+     */
+    virtual void gestureEvent(QGestureEvent *event);
+
+private slots:
+
+    /**
+     * Handles opening of media.
+     */
+    void handleOpen();
+
+    /**
+     * Handles saving of media.
+     */
+    void handleSave();
+    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
+
+private:
+
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
+
+    /**
+     * Handles long tap event.
+     * @param position Scene coordinates of tap.
+     */
+    void handleLongTap(const QPointF &position);
+
+    /**
+     * Handles pressed state.
+     */
+    void setPressed(bool pressed);
+
+private:
+
+    /**
+     * Media icon item.
+     * Own
+     */
+    HbIconItem *mMediaIcon;
+
+    /**
+     * Media name text item.
+     * Own
+     */
+    HbTextItem *mName;
+
+    /**
+     * Media information text item.
+     * Own
+     */
+    HbTextItem *mInfo;
+
+    /**
+     * Background item of widget.
+     * Own
+     */
+    HbFrameItem *mFrameItem;
+
+    /**
+     * UniViewerUtils object.
+     * Own
+     */
+    UniViewerUtils *mViewerUtils;
+
+    /**
+     * Media file path.
+     */
+    QString mMediaPath;
+
+    /**
+     * Mime type of media.
+     */
+    QString mMimeType;
+};
+
+#endif // UNI_VIEWER_ATTACHMENT_WIDGET_H
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/inc/univieweraudiowidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,116 @@
+/*
+ * 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: This widget is used to display audio content in univiewer.
+ *
+ */
+
+#ifndef UNI_VIEWER_AUDIO_WIDGET_H
+#define UNI_VIEWER_AUDIO_WIDGET_H
+
+// FORWARD DECLARATIONS
+class UniViewerUtils;
+class UniMessageInfo;
+
+#include <HbPushButton>
+
+/**
+ * @class UniViewerAudioWidget
+ * @brief This widget is used to display audio content in univiewer.
+ */
+class UniViewerAudioWidget: public HbPushButton
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    explicit UniViewerAudioWidget(QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    ~UniViewerAudioWidget();
+
+    /**
+     * Populates the widget contents.
+     * @param info Object information.
+     */
+    void populate(UniMessageInfo *info);
+
+signals:
+
+    /**
+     * Signal emitted when widget is clicked.
+     * @param mediaPath File path of the media.
+     */
+    void shortTap(const QString &mediaPath);
+
+    /**
+     * Signal emitted when widget is long tapped.
+     * @param position Scene coordinates of tap.
+     */
+    void longTap(const QPointF &position);
+
+private slots:
+
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
+
+    /**
+     * Handles long tap event.
+     * @param position Scene coordinates of tap.
+     */
+    void handleLongTap(const QPointF &position);
+
+    /**
+     * Handles opening of media.
+     */
+    void handleOpen();
+
+    /**
+     * Handles saving of media.
+     */
+    void handleSave();
+    
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
+
+private:
+
+    /**
+     * UniViewerUtils object.
+     * Own
+     */
+    UniViewerUtils *mViewerUtils;
+
+    /**
+     * Media file path.
+     */
+    QString mMediaPath;
+
+    /**
+     * Mime type of media.
+     */
+    QString mMimeType;
+};
+
+#endif //UNI_VIEWER_AUDIO_WIDGET_H
+// EOF
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerbodywidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -23,14 +23,13 @@
 #include "unidatamodelplugininterface.h"
 
 class UniViewerTextItem;
-class HbIconItem;
+class UniViewerPixmapWidget;
+class UniViewerAudioWidget;
 class HbTextItem;
-class HbPushButton;
-class HbGestureSceneFilter;
-class QSignalMapper;
 
 /**
- * This widget displays the body of the viewer
+ * @class UniViewerBodyWidget
+ * @brief This widget displays the body of the viewer.
  */
 class UniViewerBodyWidget: public HbWidget
 {
@@ -55,27 +54,27 @@
 
     /**
      * Called to insert image content in viewer.
-     * @param medialist list of absolute paths of media.
+     * @param info Object information.
      */
-    void setImage(QString imagefile);
+    void setPixmap(UniMessageInfo *info);
 
     /**
      * Called to insert audio content in viewer.
-     * @param medialist list of absolute paths of media.
+     * @param info Object information.
      */
-    void setAudio(QString audiofile);
+    void setAudio(UniMessageInfo *info);
 
     /**
      * Called to insert video content in viewer.
-     * @param medialist list of absolute paths of media.
+     * @param info Object information.
      */
-    void setVideo(QString videofile);
+    void setVideo(UniMessageInfo *info);
 
     /**
      * Called to insert text content in viewer.
      * @param text Body text to be set.
      */
-    void setTextContent(QString text);
+    void setText(QString text);
 
     /**
      * Sets the slide counter.
@@ -120,45 +119,12 @@
     void clearContent();
 
 protected:
-    // from HbWidget
-
-    /**
-     * reimplemented from base class to provide proper geometry for scrolling.
-     * @see HbWidget
-     */
-    void resizeEvent(QGraphicsSceneResizeEvent* event);
-
-private slots:
-
-    /**
-     * called on long press on the media objects
-     */
-    void longPressed(QPointF position);
 
     /**
-     * called from the media object's item specific menu
-     */
-    void openMedia();
-
-    /**
-     * Open a specified media file
-     */
-    void openMedia(const QString& fileName);
-
-    /**
-     * called from the media object's item specific menu
+     * Reimplemented from base class to provide proper geometry for scrolling.
+     * @see HbWidget
      */
-    void viewDetails();
-
-    /**
-     * Service launch complete.
-     */
-    void handleOk(const QVariant& result);
-
-    /**
-     * Service launch errors.
-     */
-    void handleError(int errorCode, const QString& errorMessage);
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
 
 signals:
     /**
@@ -192,22 +158,12 @@
     /**
      * Icon item to preview images.
      */
-    HbIconItem* mIconItem;
+    UniViewerPixmapWidget *mPixmapItem;
 
     /**
      * Media widget for embedded audio content.
      */
-    HbPushButton *mAudioItem;
-
-    /**
-     * To setup longpress gesture on media objects
-     */
-    HbGestureSceneFilter* gestureFilter;
-
-    /**
-     * File mapper for opening media
-     */
-    QSignalMapper* mSignalMapper;
+    UniViewerAudioWidget *mAudioItem;
 };
 
 #endif //UNIVIEWER_BODY_WIDGET_H
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder.h	Fri Jun 25 15:47:40 2010 +0530
@@ -126,15 +126,25 @@
      * toAddressList
      * @return list of to address list
      */
-
     ConvergedMessageAddressList toAddressList();
 
     /**
      * ccAddressList
      * @return list of cc address list
      */
+    ConvergedMessageAddressList ccAddressList();
 
-    ConvergedMessageAddressList ccAddressList();
+    /**
+     * bccAddressList
+     * @return list of Bcc address list
+     */
+    ConvergedMessageAddressList bccAddressList();
+
+    /**
+     * recipientCount
+     * @return Total recipient count
+     */
+    int recipientCount();
 
     /**
      * messageSize
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerfeeder_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,6 @@
 
 #include "convergedmessage.h"
 #include "unidatamodelplugininterface.h"
-#include <qmobilityglobal.h>
 
 class QDateTime;
 class UniViewerFeeder;
@@ -33,12 +32,6 @@
 class UniDataModelPluginInterface;
 class UniDataModelLoader;
 
-QTM_BEGIN_NAMESPACE
-class QContactManager;
-QTM_END_NAMESPACE
-
-QTM_USE_NAMESPACE
-
 /**
  * UniViewerFeederPrivate
  * Feeder Private class for unified viewer. Fetches data from the
@@ -138,11 +131,23 @@
      * @return list of cc address list
      */
     ConvergedMessageAddressList ccAddressList();
+
+    /**
+     * bccAddressList
+     * @return list of Bcc address list
+     */
+    ConvergedMessageAddressList bccAddressList();
+
+    /**
+     * Finds total recipient count
+     * @return total recipient count
+     */
+    int recipientCount();
+
     /**
      * messageSize
      * @return int
      */
-
     int messageSize();
 
     /**
@@ -180,13 +185,6 @@
      * Returns the sending state of the message.
      */
     int sendingState();
-    
-    /**
-     * Gets the name(alias) for a address from the Contact database
-     * @int returns number of phone addresses for the specified address.
-     */
-    static int GetNameFromContacts(const QString& address, QString& alias);
-
 
 private:
     /**
@@ -246,8 +244,13 @@
      * owned.
      */
     ConvergedMessageAddressList mCcAddressList;
-	
-	
+
+    /**
+     * CC address list
+     * owned.
+     */
+    ConvergedMessageAddressList mBccAddressList;
+
     /**
      * Msv Session.
      * not Owned.
--- a/messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerheadercontainer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -22,11 +22,13 @@
 
 #include <convergedmessageaddress.h>
 
+class QGraphicsLinearLayout;
 class UniViewerDetailsWidget;
 class HbGroupBox;
+class HbFrameItem;
 class UniViewerAddressContainer;
-class UniViewerAttachmentContainer;
 class UniViewerFeeder;
+class UniViewerAttachmentWidget;
 
 class UniViewerHeaderContainer: public HbWidget
 {
@@ -83,9 +85,27 @@
      */
     QString createAddressList(const ConvergedMessageAddressList &addressList);
 
+private slots:
+
+    /**
+     * Slot to know address box state.
+     */
+    void addressBoxToggled(bool state);
+
+signals:
+    /**
+     * this signal is emitted when send message is triggered form UniViewerAddressWidget
+     */
+    void sendMessage(const QString& phoneNumber,const QString& alias);
+
 private:
 
     /**
+     * Main layout.
+     */
+    QGraphicsLinearLayout *mMainLayout;
+
+    /**
      * UniViewerFeeder object
      * Not Owned
      */
@@ -104,16 +124,21 @@
     HbGroupBox *mHeaderGroupBox;
 
     /**
+     * Separator line
+     * Owned.
+     */
+    HbFrameItem *mSeparator;
+
+    /**
      * UniViewerAddressContainer object
      * owned.
      */
     UniViewerAddressContainer *mAddressContainer;
 
     /**
-     * UniViewerAttachmentContainer object
-     * owned.
+     * List of attachment widgets.
      */
-    UniViewerAttachmentContainer *mAttachmentContainer;
+    QList<UniViewerAttachmentWidget *> mUniViewerAttachmentstList;
 };
 
 #endif /* UNIVIEWER_HEADER_CONTAINER_H */
--- a/messagingapp/msgui/unifiedviewer/inc/univiewermediawidget.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * 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:
- *
- */
-
-#ifndef UNIVIEWERMEDIAWIDGET_H
-#define UNIVIEWERMEDIAWIDGET_H
-
-// SYSTEM INCLUDES
-#include <HbWidget>
-
-// FORWARD DECLARATIONS
-class HbTextItem;
-class HbIconItem;
-class HbIcon;
-class HbPushButton;
-
-/**
- * Widget for displaying inline media objects.
- */
-class UniViewerMediaWidget : public HbWidget
-{
-    Q_OBJECT
-
-public:
-
-    /**
-     * Constructor
-     */
-    explicit UniViewerMediaWidget(QGraphicsItem *parent = 0);
-
-    /**
-     * Destructor
-     */
-    virtual ~UniViewerMediaWidget();
-
-    /**
-     * Initialize method
-     */
-    void init();
-
-    /**
-     * Populates the widget contents.
-     * @param icon Media icon name.
-     * @param name Media file name.
-     * @param info Media information.
-     * @param bgFrame Background frame.
-     */
-    void populate(const QString &icon, const QString &name,
-                  const QString &info, const QString &bgFrame);
-
-    /**
-     * Clears the contents of the widget.
-     */
-    void clearContent();
-
-signals:
-
-    /**
-     * Signal emitted when widget is clicked.
-     */
-    void clicked();
-
-private:
-
-    /**
-     * Media icon item.
-     * Own
-     */
-    HbIconItem *mMediaIcon;
-
-    /**
-     * Media name text item.
-     * Own
-     */
-    HbTextItem *mName;
-
-    /**
-     * Media information text item.
-     * Own
-     */
-    HbTextItem *mInfo;
-
-    /**
-     * Background item of widget.
-     * Own
-     */
-    HbPushButton *mFrameItem;
-};
-
-#endif // UNIVIEWERMEDIAWIDGET_H
-// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerpixmapwidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,145 @@
+/*
+ * 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: This widget displays the pixmap content in viewer.
+ *
+ */
+
+#ifndef UNI_VIEWER_PIXMAP_WIDGET_H
+#define UNI_VIEWER_PIXMAP_WIDGET_H
+
+#include <HbIconItem>
+
+// FORWARD DECLARATIONS
+class UniViewerUtils;
+class UniMessageInfo;
+class ThumbnailManager;
+
+
+/**
+ * This widget displays the pixmap content in viewer.
+ */
+class UniViewerPixmapWidget: public HbIconItem
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    UniViewerPixmapWidget(QGraphicsItem *parent = 0);
+
+    /**
+     * Destructor
+     */
+    ~UniViewerPixmapWidget();
+
+    /**
+     * Sets the pixmap content to be displayed.
+     * @param info Object information.
+     */
+    void populate(UniMessageInfo *info);
+
+signals:
+
+    /**
+     * Signal emitted when widget is clicked.
+     * @param mediaPath File path of the media.
+     */
+    void shortTap(const QString &mediaPath);
+
+    /**
+     * Signal emitted when widget is long tapped.
+     * @param position Scene coordinates of tap.
+     */
+    void longTap(const QPointF &position);
+
+protected:
+
+    /**
+     * Event handler for gesture events.
+     * Reimplemented from HbWidgetBase.
+     * @see HbWidgetBase
+     */
+    virtual void gestureEvent(QGestureEvent *event);
+
+private slots:
+
+    /**
+     *
+     */
+    void handleOpen();
+
+    /**
+     *
+     */
+    void handleSave();
+
+    /**
+     * Slot to regrab gesture after some delay (300 ms) to avoid multiple gesture
+     * events back to back.  
+     */
+    void regrabGesture();
+
+    /**
+     * Slot hit when the thumbnail is ready.
+     */
+   void thumbnailReady(const QPixmap& pixmap, void *data, int id, int error);
+
+private:
+
+    /**
+     * Initialization function.
+     */
+    void init();
+
+    /**
+     * Handles short tap event.
+     */
+    void handleShortTap();
+
+    /**
+     * Handles long tap event.
+     * @param position Scene coordinates of tap.
+     */
+    void handleLongTap(const QPointF &position);
+
+private:
+
+    /**
+     * UniViewerUtils object.
+     * Own
+     */
+    UniViewerUtils *mViewerUtils;
+
+    /**
+     * ThumbnailManager
+     * Own.
+     */
+   ThumbnailManager *mThumbnailManager;
+
+    /**
+     * Mime Type of pixmap.
+     */
+    QString mMimeType;
+
+    /**
+     * Pixmap file path being set.
+     */
+    QString mPixmapPath;
+};
+
+#endif /* UNI_VIEWER_PIXMAP_WIDGET_H */
+
+// EOF
--- a/messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewertextitem.h	Fri Jun 25 15:47:40 2010 +0530
@@ -21,11 +21,6 @@
 #define UNIVIEWERTEXTITEM_H
 
 #include <HbTextEdit>
-#include <xqappmgr.h>
-
-//forward declarations
-class QRegExp;
-class XQAiwRequest;
 
 class UniViewerTextItem : public HbTextEdit
 {
@@ -37,8 +32,10 @@
     void setText(const QString& text);
 
 protected:
-    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
-    void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    /**
+     * Gesture event, overridden from base class.
+     */
+    void gestureEvent(QGestureEvent* event);
 
 private:
 
@@ -68,15 +65,6 @@
      */
     void highlightText(bool highlight);
 	
-    /** Helper method to get contact id against phone number or e-mail id.
-     * @param value phone number or email id.
-     * @param fieldName name of field to be matched.
-     * @param fieldType type of field to be matched.
-     */
-    int resolveContactId(const QString& value,
-                         const QString& fieldName, 
-                         const QString& fieldType);
-
 private slots:
     /**
       * called when aboutToShowContextMenu signal is emitted.
@@ -89,18 +77,26 @@
     void menuClosed();
 
 
-    //handlers for phone number specific menu items.
+    /**
+     * handlers for phone number specific menu items.
+     */
     void call();
     void sendMessage();    
 
-    //handlers for e-mail specific menu items.
+    /**
+     * handlers for e-mail specific menu items.
+     */
     void createEmail();
 
-    //handlers for url specific menu items.
+    /**
+     * handlers for url specific menu items.
+     */
     void openLink();
     void addToBookmarks();
 
-    //common handlers.
+    /**
+     * common handlers.
+     */
     void openContactInfo();
     void saveToContacts();
     void copyToClipboard();
@@ -119,7 +115,9 @@
      */
     void handleError(int errorCode, const QString& errorMessage);
 
-    //called after service request is completed.
+    /**
+     * called after service request is completed.
+     */
     void onServiceRequestCompleted();
     
 signals:
@@ -142,8 +140,6 @@
 
     //Current cursor position.
     int mCursorPos;
-
-    XQApplicationManager mAppManager;
 };
 
 #endif // UNIVIEWERTEXTITEM_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewerutils.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,90 @@
+/*
+ * 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:  Utility class for univiewer.
+ *
+ */
+
+#ifndef UNI_VIEWER_UTILS_H
+#define UNI_VIEWER_UTILS_H
+
+// SYSTEM INCLUDES
+#include <QObject>
+
+// FORWARD DECLARATIONS
+
+/**
+ * @class UniViewerUtils
+ * @brief Utility class for univiewer. Contains common functionality required
+ * for widgets.
+ */
+
+class UniViewerUtils: public QObject
+{
+Q_OBJECT
+
+public:
+
+    /**
+     * Constructor
+     */
+    explicit UniViewerUtils(QObject *parent = 0);
+
+    /**
+     * Destructor
+     */
+    virtual ~UniViewerUtils();
+
+    /**
+     * Utility function to launch different content viewers.
+     * @param mimeType Mime type of the content.
+     * @param filePath Absolute file path of content.
+     */
+    void launchContentViewer(const QString &mimeType, const QString &filePath);
+
+signals:
+
+    /**
+     * Service launch complete.
+     */
+    void requestOk(const QVariant& result);
+
+    /**
+     * Service launch errors.
+     */
+    void requestError(int errorCode, const QString& errorMessage);
+
+private slots:
+
+    /**
+     * Service launch complete.
+     */
+    void handleOk(const QVariant& result);
+
+    /**
+     * Service launch errors.
+     */
+    void handleError(int errorCode, const QString& errorMessage);
+
+private:
+
+    /**
+     * Launch content viewer using XQSharableFile.
+     * @param filePath Absolute path of content.
+     */
+    void launchViaSharableFile(const QString &filePath);
+
+};
+
+#endif // UNI_VIEWER_UTILS_H
+//eof
--- a/messagingapp/msgui/unifiedviewer/inc/univiewslidewidget.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/inc/univiewslidewidget.h	Fri Jun 25 15:47:40 2010 +0530
@@ -79,7 +79,7 @@
     /**
      * this signal is emitted when sendMessage is emitted. from UniViewerTextItem.
      */
-    void sendMessage(const QString& phoneNumber);
+    void sendMessage(const QString& phoneNumber,const QString& alias = QString());
 
 private:
 
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univieweraddresswidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-UniViewerAddressWidget
-{
-  layout:layout-default;
-}
-
-UniViewerAddressWidget::addressField
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  right:var(hb-param-margin-gene-right);
-  bottom:var(hb-param-margin-gene-bottom);
-}
-
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univieweraddresswidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-    <meshitem src="addressField" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="addressField" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="addressField" srcEdge="RIGHT" dst="" dstEdge="RIGHT" />
-    <meshitem src="addressField" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-  </layout>
-</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,45 @@
+
+UniViewerAttachmentWidget
+{
+  layout: layout-default;
+}
+
+UniViewerAttachmentWidget::mediaIcon
+{
+  left:-var(hb-param-margin-gene-left);
+  top:-var(hb-param-margin-gene-top);
+  bottom:var(hb-param-margin-gene-bottom) ;
+  aspect-ratio:ignore;
+  size-policy:fixed fixed;
+  pref-width:var(hb-param-graphic-size-primary-small);
+  pref-height:var(hb-param-graphic-size-primary-small);
+}
+
+UniViewerAttachmentWidget::text-1
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  right:var(hb-param-margin-gene-middle-horizontal);
+  center-vertical:0un;
+  text-height:var(hb-param-text-height-secondary);
+  font-variant:secondary;
+  text-line-count-min:1;
+  text-line-count-max:1;
+}
+
+UniViewerAttachmentWidget::text-2
+{
+  left:-var(hb-param-margin-gene-middle-horizontal);
+  right:var(hb-param-margin-gene-right);
+  center-vertical:0un;
+  size-policy-horizontal:fixed;
+  font-variant:secondary;
+  text-height:var(hb-param-text-height-tiny);
+  text-line-count-min:1;
+  text-line-count-max:1;
+}
+
+UniViewerAttachmentWidget::bgFrame
+{
+  zvalue:-1;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget.widgetml	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,20 @@
+<hbwidget version="0.1">
+  <layout name="layout-default" type="mesh">
+    <meshitem src="mediaIcon" srcEdge="LEFT" dst="" dstEdge="LEFT" />
+    <meshitem src="mediaIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
+    <meshitem src="mediaIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
+
+    <meshitem src="text-1" srcEdge="LEFT" dst="mediaIcon" dstEdge="RIGHT"/>
+    <meshitem src="text-1" srcEdge="RIGHT" dst="text-2" dstEdge="LEFT"/>
+    <meshitem src="text-1" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+
+    <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="RIGHT"/>
+    <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+    <meshitem src="text-2" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
+
+    <meshitem src="bgFrame" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
+    <meshitem src="bgFrame" srcEdge="TOP" dst="" dstEdge="TOP"/>
+    <meshitem src="bgFrame" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
+    <meshitem src="bgFrame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
+  </layout>
+</hbwidget>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerattachmentwidget_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,20 @@
+
+UniViewerAttachmentWidget[state="normal"]::text-1
+{
+  color:var(qtc_list_item_title_normal);
+}
+
+UniViewerAttachmentWidget[state="pressed"]::text-1
+{
+  color:var(qtc_list_item_pressed);
+}
+
+UniViewerAttachmentWidget[state="normal"]::text-2
+{
+  color:var(qtc_list_item_title_normal);
+}
+
+UniViewerAttachmentWidget[state="pressed"]::text-2
+{
+  color:var(qtc_list_item_pressed);
+}
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerbodywidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -2,35 +2,25 @@
 UniViewerBodyWidget[hasText="true"]:portrait
 {
   layout: layout-portrait;
-  size-policy-vertical:minimum-expanding;
-  min-height:expr(var(hb-param-screen-height)-var(hb-param-widget-chrome-height)-var(hb-param-widget-toolbar-height)+1un);
 }
 
 UniViewerBodyWidget[hasText="false"]:portrait
 {
   layout: layout-portrait-no-text;
-  size-policy-vertical:minimum-expanding;
-  min-height:expr(var(hb-param-screen-height)-var(hb-param-widget-chrome-height)-var(hb-param-widget-toolbar-height)+1un);
 }
 
 UniViewerBodyWidget:landscape
 {
-  size-policy-vertical:minimum-expanding;
-  min-height:expr(var(hb-param-screen-height)-var(hb-param-widget-toolbar-height)+1un);
   layout: layout-landscape;
 }
 
 UniViewerBodyWidget[hasText="true"][hasPixmap="false"]:landscape
 {
-  size-policy-vertical:minimum-expanding;
-  min-height:expr(var(hb-param-screen-height)-var(hb-param-widget-toolbar-height)+1un);
   layout: layout-landscape-no-pixmap;
 }
 
 UniViewerBodyWidget[hasText="false"][hasPixmap="true"]:landscape
 {
-  size-policy-vertical:minimum-expanding;
-  min-height:expr(var(hb-param-screen-height)-var(hb-param-widget-toolbar-height)+1un);
   layout: layout-landscape-no-text;
 }
 
@@ -95,7 +85,6 @@
   text-line-count-max:100;
   text-align: left top;
   font-variant:secondary;
-  size-policy-vertical:minimum-expanding;
 }
 
 UniViewerBodyWidget::textItem:portrait
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget.css	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget.css	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,7 @@
   text-height:var(hb-param-text-height-secondary);
   text-line-count-min:1;
   text-line-count-max:1;
-  text-align: left;
+  text-align:left center;
  }
 
 UniViewerDetailsWidget::subjectLabel
@@ -31,16 +31,15 @@
   text-height:var(hb-param-text-height-primary);
   text-line-count-min:1;
   text-line-count-max:10;
-  text-align:left;
+  text-align:left center;
 }
 
 UniViewerDetailsWidget::priorityIcon
 {
   top:-var(hb-param-margin-gene-top);
   right:var(hb-param-margin-gene-right);
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
   pref-width:var(hb-param-graphic-size-secondary);
   pref-height:var(hb-param-graphic-size-secondary);
+  size-policy:fixed fixed;
 }
 
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget_color.css	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/resources/layouts/univiewerdetailswidget_color.css	Fri Jun 25 15:47:40 2010 +0530
@@ -1,10 +1,10 @@
 
 UniViewerDetailsWidget::timeLabel
 {
-  color:var(qtc_dataform_value);
+  color:var(qtc_dataform_heading);
 }
 
 UniViewerDetailsWidget::subjectLabel
 {
-  color:var(qtc_dataform_value);
+  color:var(qtc_dataform_heading);
 }
\ No newline at end of file
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-
-UniViewerMediaWidget
-{
-  layout: layout-default;
-}
-
-UniViewerMediaWidget::mediaIcon
-{
-  left:-var(hb-param-margin-gene-left);
-  top:-var(hb-param-margin-gene-top);
-  bottom:var(hb-param-margin-gene-bottom) ;
-  aspect-ratio:ignore;
-  size-policy:fixed fixed;
-  pref-width:var(hb-param-graphic-size-primary-small);
-  pref-height:var(hb-param-graphic-size-primary-small);
-}
-
-UniViewerMediaWidget::text-1
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-middle-horizontal);
-  center-vertical:0un;
-  text-height:var(hb-param-text-height-secondary);
-  font-variant:secondary;
-  text-line-count-min:1;
-  text-line-count-max:1;
-}
-
-UniViewerMediaWidget::text-2
-{
-  left:-var(hb-param-margin-gene-middle-horizontal);
-  right:var(hb-param-margin-gene-right);
-  center-vertical:0un;
-  text-height:var(hb-param-text-height-tiny);
-  font-variant:secondary;
-  text-align:right;
-  text-line-count-min:1;
-  text-line-count-max:1;
-  size-policy-horizontal:fixed;
-  pref-width:13un;
-}
-
-UniViewerMediaWidget::bgFrame
-{
-  zvalue:-1;
-}
-
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget.widgetml	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<hbwidget version="0.1">
-  <layout name="layout-default" type="mesh">
-    <meshitem src="mediaIcon" srcEdge="LEFT" dst="" dstEdge="LEFT" />
-    <meshitem src="mediaIcon" srcEdge="TOP" dst="" dstEdge="TOP" />
-    <meshitem src="mediaIcon" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM" />
-
-    <meshitem src="text-1" srcEdge="LEFT" dst="mediaIcon" dstEdge="RIGHT"/>
-    <meshitem src="text-1" srcEdge="RIGHT" dst="text-2" dstEdge="LEFT"/>
-    <meshitem src="text-1" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-
-    <meshitem src="text-2" srcEdge="LEFT" dst="text-1" dstEdge="RIGHT"/>
-    <meshitem src="text-2" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="text-2" srcEdge="CENTERV" dst="" dstEdge="CENTERV"/>
-
-    <meshitem src="bgFrame" srcEdge="LEFT" dst="" dstEdge="LEFT"/>
-    <meshitem src="bgFrame" srcEdge="TOP" dst="" dstEdge="TOP"/>
-    <meshitem src="bgFrame" srcEdge="RIGHT" dst="" dstEdge="RIGHT"/>
-    <meshitem src="bgFrame" srcEdge="BOTTOM" dst="" dstEdge="BOTTOM"/>
-  </layout>
-</hbwidget>
\ No newline at end of file
--- a/messagingapp/msgui/unifiedviewer/resources/layouts/univiewermediawidget_color.css	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-
-UniViewerMediaWidget::text-1
-{
-  color:var(qtc_list_item_title_normal);
-}
-
-UniViewerMediaWidget::text-2
-{
-  color:var(qtc_list_item_title_normal);
-}
\ No newline at end of file
--- a/messagingapp/msgui/unifiedviewer/src/unicontentswidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/unicontentswidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -38,7 +38,7 @@
 {
     QDEBUG_WRITE("UniContentsWidget: Constructor start");
 
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical,this);
     mMainLayout->setSpacing(0);
     mMainLayout->setContentsMargins(0, 0, 0, 0);
     
@@ -58,13 +58,13 @@
     // create the mInitailLoadCount number of slides
     for (int i = 0; i < mInitialLoadCount; i++)
     {
-        UniViewSlideWidget* slide = new UniViewSlideWidget(feeder, i);
+        UniViewSlideWidget* slide = new UniViewSlideWidget(feeder, i, this);
         addItemToLayout(slide);
         slide->setInsideLayout(true);
         mSlides.append(slide);
         
-        connect(slide,SIGNAL(sendMessage(const QString&)),
-                this, SIGNAL(sendMessage(const QString&)));
+        connect(slide,SIGNAL(sendMessage(const QString&,const QString&)),
+                this, SIGNAL(sendMessage(const QString&,const QString&)));
     }
 
     setLayout(mMainLayout);
@@ -161,7 +161,7 @@
 void UniContentsWidget::populateContent()
 {
     QDEBUG_WRITE("UniContentsWidget::populateContent() start");
-    
+
     if ( (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) &&
          (mViewFeeder->slideCount() > 0) )
     {
@@ -228,8 +228,8 @@
 
     slide->populateContent();
     
-    connect(slide,SIGNAL(sendMessage(const QString&)),
-            this, SIGNAL(sendMessage(const QString&)));
+    connect(slide,SIGNAL(sendMessage(const QString&,const QString&)),
+            this, SIGNAL(sendMessage(const QString&,const QString&)));
 
     mTotalSlidesLoaded++;
     //TODO to remove the previous slide if the mTotalSlidesLoaded
--- a/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/unifiedviewer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,7 @@
 #include <hbmessagebox.h>
 #include <hbnotificationdialog.h>
 #include <HbStyleLoader>
-#include <centralrepository.h>       
+#include <centralrepository.h>
 #include <MmsEngineDomainCRKeys.h>
 
 // USER INCLUDES
@@ -38,27 +38,25 @@
 #include "conversationsengine.h"
 #include "debugtraces.h"
 #include "nativemessageconsts.h"
-#include "mmsconformancecheck.h"
-#include "UniEditorGenUtils.h" // This is needed for KDefaultMaxSize
 
 // LOCAL CONSTANTS
 const QString REPLY_ICON("qtg_mono_reply");
 const QString REPLY_ALL_ICON("qtg_mono_reply_all");
-const QString FORWARD_ICON("qtg_mono_forward");
+const QString FORWARD_ICON("qtg_mono_forward_msg");
 const QString SEND_ICON("qtg_mono_send");
 const QString DELETE_ICON("qtg_mono_delete");
 
 //LOCALIZED CONSTANTS
 #define LOC_DELETE_MESSAGE hbTrId("txt_messaging_dialog_delete_message")
-#define LOC_BUTTON_DELETE hbTrId("txt_common_button_delete")
-#define LOC_BUTTON_CANCEL hbTrId("txt_common_button_cancel")
 
 //----------------------------------------------------------------------------
 // UnifiedViewer::UnifiedViewer
 // constructor
 //----------------------------------------------------------------------------
-UnifiedViewer::UnifiedViewer(const qint32 messageId, QGraphicsItem *parent) :
-    MsgBaseView(parent)
+UnifiedViewer::UnifiedViewer(const qint32 messageId, 
+                             int canForwardMessage,
+                             QGraphicsItem *parent) :
+    MsgBaseView(parent), mForwardMessage(false)
 {
     QDEBUG_WRITE("UnifiedViewer contruction start");
 
@@ -70,14 +68,15 @@
     mMessageId = messageId;
     mViewFeeder = new UniViewerFeeder(mMessageId, this);
 
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
-
+    if (canForwardMessage > 0) mForwardMessage = true;
+    
     mScrollArea = new UniScrollArea(this);
+    this->setWidget(mScrollArea);
 
     mContentsWidget = new UniContentsWidget(mViewFeeder,this);
-	
-    connect(mContentsWidget,SIGNAL(sendMessage(const QString&)),
-            this, SLOT(sendMessage(const QString&)));
+
+    connect(mContentsWidget,SIGNAL(sendMessage(const QString&,const QString&)),
+            this, SLOT(sendMessage(const QString&,const QString&)));
 
     connect(mScrollArea, SIGNAL(scrolledToNextSlide()),
     mContentsWidget, SLOT(populateNextSlide()));
@@ -85,11 +84,6 @@
     mScrollArea->setContentWidget(mContentsWidget);
     mScrollArea->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
     mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAutoHide);
-    mMainLayout->addItem(mScrollArea);
-    mMainLayout->setSpacing(0);
-    mMainLayout->setContentsMargins(0, 0, 0, 0);
-
-    setLayout(mMainLayout);
 
     QDEBUG_WRITE("UnifiedViewer contruction End");
 }
@@ -121,10 +115,14 @@
     else
     {
         toolbar->addAction(HbIcon(REPLY_ICON), "");
-        toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
+
+        if (mViewFeeder->recipientCount() > 1)
+        {
+            toolbar->addAction(HbIcon(REPLY_ALL_ICON), "");
+        }
     }
 
-    if (validateMsgForForward())
+    if (mForwardMessage)    
     {
         toolbar->addAction(HbIcon(FORWARD_ICON), "", this, SLOT(handleFwdAction()));
     }
@@ -167,6 +165,9 @@
     }
     QDEBUG_WRITE("UnifiedViewer feeder->updateContent END");
 
+    // Dont show the scroll bar.
+    mScrollArea->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOff);
+
     if ( (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) &&
          (mViewFeeder->slideCount() > 0) )
     {
@@ -226,7 +227,7 @@
 void UnifiedViewer::resizeEvent(QGraphicsSceneResizeEvent * event)
 {
     Q_UNUSED(event)
-    mContentsWidget->resize(this->rect().width(), -1);
+    mContentsWidget->resize(this->rect().width(), this->rect().height()+1);
 }
 
 //---------------------------------------------------------------
@@ -235,46 +236,22 @@
 //---------------------------------------------------------------
 void UnifiedViewer::handleDeleteAction()
 {
-    bool result = HbMessageBox::question(LOC_DELETE_MESSAGE,
-                                         LOC_BUTTON_DELETE, 
-                                         LOC_BUTTON_CANCEL);
-    if (result)
-    {
-        QList<int> msgIdList;
-        msgIdList << mMessageId;
-
-        ConversationsEngine::instance()->deleteMessages(msgIdList);
-
-        QVariantList param;
-        if (mMsgCount > 1)
-        {
-            param << MsgBaseView::CV;
-            param << MsgBaseView::UNIVIEWER;
-        }
-        else
-        {
-            param << MsgBaseView::CLV;
-            param << MsgBaseView::UNIVIEWER;
-        }
-
-        QVariant dummy(QVariant::Invalid);
-        param << dummy;
-        emit switchView(param);
-    }
-
+    HbMessageBox::question(LOC_DELETE_MESSAGE,this,
+                           SLOT(onDialogDeleteMsg(HbAction*)),
+                           HbMessageBox::Delete | HbMessageBox::Cancel);
 }
 
 //---------------------------------------------------------------
 // UnifiedViewer::sendMessage
 // @see header file
 //---------------------------------------------------------------
-void UnifiedViewer::sendMessage(const QString& phoneNumber)
+void UnifiedViewer::sendMessage(const QString& phoneNumber,const QString& alias)
     {
     ConvergedMessage message;
     message.setBodyText(QString());
 
     ConvergedMessageAddress address;
-    address.setAlias(phoneNumber);
+    address.setAlias(alias);
     address.setAddress(phoneNumber);
     message.addToRecipient(address);
 
@@ -292,24 +269,32 @@
     }
 
 //---------------------------------------------------------------
-// UnifiedViewer::validateMsgForForward
+// UnifiedViewer::onDialogDeleteMsg
 // @see header file
 //---------------------------------------------------------------
-bool UnifiedViewer::validateMsgForForward()
+void UnifiedViewer::onDialogDeleteMsg(HbAction* action)
 {
-    if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue)
-    {
-        bool retValue = false;
+    HbMessageBox *dlg = qobject_cast<HbMessageBox*> (sender());
+    if (action == dlg->actions().at(0)) {
+        QList<int> msgIdList;
+        msgIdList << mMessageId;
+
+        ConversationsEngine::instance()->deleteMessages(msgIdList);
 
-        //Validate if the mms msg can be forwarded or not
-        MmsConformanceCheck* mmsConformanceCheck = new MmsConformanceCheck;        
-        retValue = mmsConformanceCheck->validateMsgForForward(mMessageId);
+        QVariantList param;
+        if (mMsgCount > 1) {
+            param << MsgBaseView::CV;
+            param << MsgBaseView::UNIVIEWER;
+        }
+        else {
+            param << MsgBaseView::CLV;
+            param << MsgBaseView::UNIVIEWER;
+        }
 
-        delete mmsConformanceCheck;        
-        return retValue;
+        QVariant dummy(QVariant::Invalid);
+        param << dummy;
+        emit switchView(param);
     }
-
-    return true;
 }
 
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/unihighlighter.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * 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: Enables parsing and change font parameters for email/url
- *
- */
-#include "unihighlighter.h"
-
-#include <QtGui>
-
-//---------------------------------------------------------------
-//UniHighlighter :: UniHighlighter
-// @see header file
-//---------------------------------------------------------------
-UniHighlighter::UniHighlighter(QTextDocument *parent) :
-    QSyntaxHighlighter(parent)
-{
-    HighlightingRule rule;
-
-    emailFormat.setFontWeight(QFont::Bold);
-    rule.pattern = QRegExp(
-        "\\b[a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}\\b");
-    rule.format = emailFormat;
-    highlightingRules.append(rule);
-
-    urlFormat.setAnchor(true);
-    urlFormat.setFontUnderline(true);
-    rule.pattern
-            = QRegExp(
-                "\\b((https?|ftp|gopher|telnet|file|notes|ms-help):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\.&]*)\\b");
-    rule.format = urlFormat;
-    highlightingRules.append(rule);
-}
-
-//---------------------------------------------------------------
-//UniHighlighter :: highlightBlock
-// @see header file
-//---------------------------------------------------------------
-void UniHighlighter::highlightBlock(const QString &text)
-{
-    foreach (const HighlightingRule &rule, highlightingRules) 
-        {
-            QRegExp expression(rule.pattern);
-            int index = text.indexOf(expression);
-            while (index >= 0)
-            {
-                int length = expression.matchedLength();
-                setFormat(index, length, rule.format);
-                index = text.indexOf(expression, index + length);
-            }
-        }
-}
-
-// EOF
--- a/messagingapp/msgui/unifiedviewer/src/uniscrollarea.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/uniscrollarea.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -143,22 +143,5 @@
     widgetItem->setPos(0, 0);
 }
 
-//---------------------------------------------------------------
-//UniScrollArea :: upGesture
-// @see header file
-//---------------------------------------------------------------
-void UniScrollArea::upGesture(int value)
-{
-    Q_UNUSED(value)
-}
-
-//---------------------------------------------------------------
-//UniScrollArea :: downGesture
-// @see header file
-//---------------------------------------------------------------
-void UniScrollArea::downGesture(int value)
-{
-    Q_UNUSED(value)
-}
 
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/unitexteditor.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
- * 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:Custom widget derived from HbTextEdit which provides rich text
- *              processing
- *
- */
-
-#include "unitexteditor.h"
-
-#include <QFile>
-#include <QGraphicsSceneMouseEvent>
-#include <HbAbstractEdit>
-
-//---------------------------------------------------------------
-// UniTextEditor::UniTextEditor
-// @see header file
-//---------------------------------------------------------------
-UniTextEditor::UniTextEditor(QGraphicsItem * parent) :
-    HbTextEdit(parent)
-{
-    setReadOnly(true);
-    setCursorVisibility(Hb::TextCursorHidden);
-    setScrollable(false);
-    setAttribute(Qt::WA_InputMethodEnabled, false);
-}
-
-//---------------------------------------------------------------
-// UniTextEditor::~UniTextEditor
-// @see header file
-//---------------------------------------------------------------
-UniTextEditor::~UniTextEditor()
-{
-
-    }
-
-//---------------------------------------------------------------
-//UniTextEditor :: focusInEvent
-// @see header file
-//---------------------------------------------------------------
-void UniTextEditor::focusInEvent(QFocusEvent *event)
-{
-    event->ignore();
-}
-
-//---------------------------------------------------------------
-//UniTextEditor :: focusOutEvent
-// @see header file
-//---------------------------------------------------------------
-void UniTextEditor::focusOutEvent(QFocusEvent *event)
-{
-    event->ignore();
-}
-
-//---------------------------------------------------------------
-//UniTextEditor :: mousePressEvent
-// @see header file
-//---------------------------------------------------------------
-void UniTextEditor::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-    event->ignore();
-}
-
-//---------------------------------------------------------------
-//UniTextEditor :: mouseMoveEvent
-// @see header file
-//---------------------------------------------------------------
-void UniTextEditor::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
-{
-    event->ignore();
-}
-
-//---------------------------------------------------------------
-//UniTextEditor :: mouseReleaseEvent
-// @see header file
-//---------------------------------------------------------------
-void UniTextEditor::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
-{
-    event->ignore();
-}
-
-// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresscontainer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,9 +18,7 @@
 #include "univieweraddresscontainer.h"
 
 // SYSTEM INCLUDES
-#include <QString>
 #include <QGraphicsLinearLayout>
-#include <HbIconItem>
 
 // USER INCLUDES
 #include "univieweraddresswidget.h"
@@ -29,122 +27,92 @@
 #define LOC_FROM hbTrId("txt_messaging_formlabel_from")
 #define LOC_TO hbTrId("txt_messaging_viewer_formlabel_to")
 #define LOC_CC hbTrId("txt_messaging_viewer_formlabel_cc")
-
-// LOCAL CONSTANTS
-const QString DIVIDER_ICON("qtg_graf_divider_h_thin");
+#define LOC_BCC hbTrId("txt_messaging_viewer_formlabel_bcc")
 
 //---------------------------------------------------------------
-// UniViewerAddressContainer :: UniViewerAddressContainer
+// UniViewerAddressContainer::UniViewerAddressContainer
 // @see header file
 //---------------------------------------------------------------
-UniViewerAddressContainer::UniViewerAddressContainer(QGraphicsItem *parent) :
-    HbWidget(parent), mMainLayout(0), mFromWidget(0), mToWidget(0), mCcWidget(0), mDivider(0)
+UniViewerAddressContainer::UniViewerAddressContainer(QGraphicsItem* parent) :
+    HbWidget(parent)
 {
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
     mMainLayout->setContentsMargins(0, 0, 0, 0);
     mMainLayout->setSpacing(0);
     setLayout(mMainLayout);
 }
 
 //---------------------------------------------------------------
-// UniViewerAddressContainer :: ~UniViewerAddressContainer
+// UniViewerAddressContainer::~UniViewerAddressContainer
 // @see header file
 //---------------------------------------------------------------
 UniViewerAddressContainer::~UniViewerAddressContainer()
 {
-
 }
 
 //---------------------------------------------------------------
-// UniViewerAddressContainer :: setFromField
+// UniViewerAddressContainer::setFromField
 // @see header file
 //---------------------------------------------------------------
 void UniViewerAddressContainer::setFromField(const QString& fromRecipient, const QString& alias)
 {
-    if (!mFromWidget) {
-        mFromWidget = new UniViewerAddressWidget();
-    }
+    UniViewerAddressWidget* fromWidget = new UniViewerAddressWidget(this);
 
-    mMainLayout->addItem(mFromWidget);
-    mFromWidget->populate(LOC_FROM, fromRecipient, alias);
+    connect(fromWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
+        SIGNAL(sendMessage(const QString&,const QString&)));
+
+    mMainLayout->addItem(fromWidget);
+
+    fromWidget->populate(LOC_FROM, fromRecipient, alias);
 }
 
 //---------------------------------------------------------------
-// UniViewerAddressContainer :: setToField
+// UniViewerAddressContainer::setToField
 // @see header file
 //---------------------------------------------------------------
 void UniViewerAddressContainer::setToField(ConvergedMessageAddressList toRecipients)
 {
-    if (!mToWidget) {
-        mToWidget = new UniViewerAddressWidget();
-    }
+    UniViewerAddressWidget* toWidget = new UniViewerAddressWidget();
+
+    connect(toWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
+        SIGNAL(sendMessage(const QString&,const QString&)));
 
-    mMainLayout->addItem(mToWidget);
-    mToWidget->populate(LOC_TO, toRecipients);
+    mMainLayout->addItem(toWidget);
+
+    toWidget->populate(LOC_TO, toRecipients);
+
 }
 
 //---------------------------------------------------------------
-//UniViewerAddressContainer :: setCcField
+// UniViewerAddressContainer::setCcField
 // @see header file
 //---------------------------------------------------------------
 void UniViewerAddressContainer::setCcField(ConvergedMessageAddressList ccRecipients)
 {
-    if (!mCcWidget) {
-        mCcWidget = new UniViewerAddressWidget();
-    }
+    UniViewerAddressWidget* ccWidget = new UniViewerAddressWidget();
 
-    mMainLayout->addItem(mCcWidget);
-    mCcWidget->populate(LOC_CC, ccRecipients);
+    connect(ccWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
+        SIGNAL(sendMessage(const QString&,const QString&)));
+
+    mMainLayout->addItem(ccWidget);
+
+    ccWidget->populate(LOC_CC, ccRecipients);
 }
 
 //---------------------------------------------------------------
-// UniViewerAddressContainer :: clearContent
+// UniViewerAddressContainer :: setBccField
 // @see header file
 //---------------------------------------------------------------
-void UniViewerAddressContainer::clearContent()
+void UniViewerAddressContainer::setBccField(ConvergedMessageAddressList bccRecipients)
 {
-    if (mFromWidget) {
-        mMainLayout->removeItem(mFromWidget);
-        mFromWidget->setParent(NULL);
-        delete mFromWidget;
-        mFromWidget = NULL;
-    }
-    if (mToWidget) {
-        mMainLayout->removeItem(mToWidget);
-        mToWidget->setParent(NULL);
-        delete mToWidget;
-        mToWidget = NULL;
-    }
-    if (mCcWidget) {
-        mMainLayout->removeItem(mCcWidget);
-        mCcWidget->setParent(NULL);
-        delete mCcWidget;
-        mCcWidget = NULL;
-    }
-    if (mDivider) {
-        mMainLayout->removeItem(mDivider);
-        mDivider->setParent(NULL);
-        delete mDivider;
-        mDivider = NULL;
-    }
+    UniViewerAddressWidget* bccWidget = new UniViewerAddressWidget();
 
-    resize(rect().width(), -1);
-}
+    connect(bccWidget, SIGNAL(sendMessage(const QString&,const QString&)), this,
+        SIGNAL(sendMessage(const QString&,const QString&)));
 
-//---------------------------------------------------------------
-// UniViewerAddressContainer :: insertDivider
-// @see header file
-//---------------------------------------------------------------
-void UniViewerAddressContainer::insertDivider()
-{
-    if (!mDivider) {
-        mDivider = new HbIconItem(this);
-    }
+    mMainLayout->addItem(bccWidget);
 
-    mDivider->sizePolicy().setHorizontalPolicy(QSizePolicy::Expanding);
-    mDivider->sizePolicy().setVerticalPolicy(QSizePolicy::Fixed);
-    mDivider->setIconName(DIVIDER_ICON);
-    mMainLayout->addItem(mDivider);
+    bccWidget->populate(LOC_BCC, bccRecipients);
 }
 
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraddresswidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -11,51 +11,149 @@
  *
  * Contributors:
  *
- * Description:
+ * Description:Custom widget derived from HbTextEdit which provides rich text
+ *              processing
  *
  */
 
 #include "univieweraddresswidget.h"
-#include "univiewerfeeder_p.h"
+
 // SYSTEM INCLUDES
-#include <HbApplication>
-#include <QString>
 #include <QTextCursor>
+#include <QTextBlock>
+#include <QApplication>
+#include <QClipboard>
+
 #include <HbMenu>
+#include <HbAction>
+#include <HbTapGesture>
 
-// USER INCLUDES
-#include "unitexteditor.h"
+#include <xqservicerequest.h>
+#include <xqappmgr.h>
+#include <cntservicescontact.h>
+#include <qtcontacts.h>
+#include <xqservicerequest.h>
+#include <xqaiwrequest.h>
+#include "msgcontacthandler.h"
 
 // LOCAL CONSTANTS
 const QString ADDRESS_SEPARATOR("; ");
 const QString ADDRESS_OPEN(" (");
 const QString ADDRESS_CLOSE(")");
+const QString SPACE(" ");
 
-//----------------------------------------------------------------------------
+//localization
+#define LOC_OPEN_CONTACT_INFO hbTrId("txt_messaging_menu_open_contact_info")
+#define LOC_CALL              hbTrId("txt_common_menu_call_verb")
+#define LOC_SEND_MESSAGE      hbTrId("txt_common_menu_send_message")
+#define LOC_SAVE_TO_CONTACTS  hbTrId("txt_common_menu_save_to_contacts")
+#define LOC_COPY              hbTrId("txt_common_menu_copy")
+
+const QString BG_FRAME_GRAPHICS("qtg_fr_lineedit_normal");
+
+//---------------------------------------------------------------
 // UniViewerAddressWidget::UniViewerAddressWidget
 // @see header file
-//----------------------------------------------------------------------------
-UniViewerAddressWidget::UniViewerAddressWidget(QGraphicsItem *parent) :
-    HbWidget(parent), mAddress(NULL)
+//---------------------------------------------------------------
+UniViewerAddressWidget::UniViewerAddressWidget(QGraphicsItem * parent) :
+HbTextEdit(parent),
+mCursorPos(-1)
 {
-    mAddress = new UniTextEditor(this);
-    HbStyle::setItemName(mAddress, "addressField");
+    this->setReadOnly(true);    
+    this->setScrollable(false);
+    this->setFlag(QGraphicsItem::ItemIsFocusable,false);
+    this->setCursorVisibility(Hb::TextCursorHidden);
+    this->setBackgroundItem(0);   
 
-    connect(mAddress, SIGNAL(aboutToShowContextMenu(HbMenu *,QPointF)), this,
-        SLOT(handleAboutToShowContextMenu(HbMenu *,QPointF)));
+    HbFontSpec fontSpec(HbFontSpec::Secondary);
+    QFont font = fontSpec.font();
+    this->setFont(font);
 
-    // TODO: Wrapping fix breaking normal scenarios.
-    // this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    mFormatNormal.setForeground(palette().link());
+    mFormatNormal.setBackground(Qt::transparent);
+
+    mFormatHighlight.setBackground(palette().highlight());
+    mFormatHighlight.setForeground(palette().highlightedText());
+
+    connect(this, SIGNAL(aboutToShowContextMenu(HbMenu*,QPointF)),
+            this, SLOT(aboutToShowContextMenu(HbMenu*,QPointF)));
 }
 
-//----------------------------------------------------------------------------
+//---------------------------------------------------------------
 // UniViewerAddressWidget::~UniViewerAddressWidget
 // @see header file
-//----------------------------------------------------------------------------
+//---------------------------------------------------------------
 UniViewerAddressWidget::~UniViewerAddressWidget()
 {
 }
 
+//---------------------------------------------------------------
+//UniViewerAddressWidget :: gestureEvent
+// @see header file
+//---------------------------------------------------------------
+void UniViewerAddressWidget::gestureEvent(QGestureEvent* event)
+{
+    //handle gesture to highlight and dehighlight find item.
+    
+    if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture)))
+    {
+        //capturing gesture position, and map to local co-ordinates.
+        QPointF pos = mapFromScene(tap->scenePosition());
+        
+        switch (tap->state()) 
+        {
+            case Qt::GestureStarted:
+            {
+                //highlight find item.
+                QTextDocument* doc = this->document();
+                mCursorPos = doc->documentLayout()->hitTest(pos, Qt::ExactHit);
+                highlightText(true);
+                break;
+            }  
+            
+            case Qt::GestureFinished:
+            {
+                if (HbTapGesture::Tap == tap->tapStyleHint()) 
+                {
+                    //gesture is finshed dehighlight text.
+                    highlightText(false);
+                    
+                    QString anchor = this->anchorAt(pos);
+                    
+                    //do short tap action.
+                    if (!anchor.isEmpty() && !this->textCursor().hasSelection())
+                    {
+                        shortTapAction(anchor);
+                    }
+                }
+                break;
+            }
+            
+            case Qt::GestureCanceled:
+            {
+                //gesture is canceled due to pan or swipe, dehighlight text.
+                if (HbTapGesture::Tap == tap->tapStyleHint()) 
+                {
+                highlightText(false);
+                break;
+                }
+            }
+            default:
+                break;
+        }
+        
+        event->accept();
+    }
+    else
+    {
+        event->ignore();
+    }
+    
+    //passing gesture event to base class.
+    HbTextEdit::gestureEvent(event);
+}
+
+
 //----------------------------------------------------------------------------
 // UniViewerAddressWidget::populate
 // @see header file
@@ -64,22 +162,40 @@
                                       const QString &address,
                                       const QString &alias)
 {
-
-    QTextCursor cursor(mAddress->document());
-
-    QTextCharFormat addressFormat = cursor.charFormat();
-    addressFormat.setFontWeight(QFont::Bold);
-    addressFormat.setForeground(QApplication::palette().link());
-    addressFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+    QString labelText = label;
+    labelText.trimmed();
+    labelText += SPACE;
+    
+    //Font.
+    HbFontSpec fontSpec(HbFontSpec::Secondary);
+    qreal fontHeight = 0.0;
+    style()->parameter("hb-param-text-height-tiny", fontHeight);
+    fontSpec.setTextHeight(fontHeight);    
+    QFont font = fontSpec.font();
+    
+    QTextCharFormat labelFormat;
+    labelFormat.setFont(font);
+    
+    QTextCharFormat addressFormat;
+    addressFormat.setForeground(palette().link());
+    addressFormat.setFontUnderline(true);
 
     // Insert the label then the addresses
-    cursor.insertText(label);
+    QTextCursor cursor(this->textCursor());
+    cursor.insertText(labelText,labelFormat);
+    
     QString address1 = QString();
     if (!(alias.isEmpty()))
     {
         address1.append(alias);
         QString alias1 = QString();
-        if (UniViewerFeederPrivate::GetNameFromContacts(address, alias1) > 1)
+        
+        int totalNumbers = 0;
+        MsgContactHandler::resolveContactDisplayName(
+                        address,
+                        alias1,
+                        totalNumbers);
+        if (totalNumbers > 1)
         {
             address1.append(ADDRESS_OPEN);
             address1.append(address);
@@ -92,7 +208,6 @@
     }
     addressFormat.setAnchorHref(address);
     cursor.insertText(address1, addressFormat);
-    repolish();
 }
 
 //----------------------------------------------------------------------------
@@ -102,19 +217,30 @@
 void UniViewerAddressWidget::populate(const QString &label,
                                       ConvergedMessageAddressList addressList)
 {
-    QTextCursor cursor(mAddress->document());
+    QString labelText = label;
+    labelText.trimmed();
+    labelText += SPACE;
+    
+    //Font.
+    HbFontSpec fontSpec(HbFontSpec::Secondary);
+    qreal fontHeight = 0.0;
+    style()->parameter("hb-param-text-height-tiny", fontHeight);
+    fontSpec.setTextHeight(fontHeight);    
+    QFont font = fontSpec.font();
+    
+    QTextCharFormat labelFormat;
+    labelFormat.setFont(font);
+    
+    QTextCharFormat defaultFormat;
+    defaultFormat.setForeground(palette().link());
 
-    QTextCharFormat defaultFormat = cursor.charFormat();
-    defaultFormat.setFontWeight(QFont::Bold);
-    defaultFormat.setForeground(QApplication::palette().link());
-
-    QTextCharFormat addressFormat = cursor.charFormat();
-    addressFormat.setFontWeight(QFont::Bold);
-    addressFormat.setForeground(QApplication::palette().link());
-    addressFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+    QTextCharFormat addressFormat;
+    addressFormat.setForeground(palette().link());
+    addressFormat.setFontUnderline(true);
 
     // Insert the label then the addresses
-    cursor.insertText(label);
+    QTextCursor cursor(this->document());
+    cursor.insertText(labelText,labelFormat);
 
     int addressCount = addressList.count();
 
@@ -126,8 +252,13 @@
         {
             address.append(addressList[i]->alias());
             QString alias = QString();
-            if (UniViewerFeederPrivate::GetNameFromContacts(addressList[i]->address(),
-                                                            alias) > 1)
+            
+            int totalNumbers = 0;
+            MsgContactHandler::resolveContactDisplayName(
+                            addressList[i]->address(),
+                            alias,
+                            totalNumbers);
+            if (totalNumbers > 1)
             {
                 address.append(ADDRESS_OPEN);
                 address.append(addressList[i]->address());
@@ -148,7 +279,6 @@
         }
         
     }
-    repolish();
 }
 
 //----------------------------------------------------------------------------
@@ -157,17 +287,264 @@
 //----------------------------------------------------------------------------
 void UniViewerAddressWidget::clearContent()
 {
-    mAddress->document()->clear();
+    this->document()->clear();
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAddressWidget::menuClosed
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAddressWidget::menuClosed()
+{
+    highlightText(false);
 }
 
 //----------------------------------------------------------------------------
-// UniViewerAddressWidget::handleAboutToShowContextMenu
+// UniViewerAddressWidget::highlightText
 // @see header file
 //----------------------------------------------------------------------------
-void UniViewerAddressWidget::handleAboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos)
+void UniViewerAddressWidget::highlightText(bool highlight)
+{
+    QTextBlock textBlock = this->document()->findBlock(mCursorPos);
+
+    QTextBlock::iterator it;
+
+    for (it = textBlock.begin(); !(it.atEnd()); ++it)
+    {
+        QTextFragment currentFragment = it.fragment();
+        
+        if (currentFragment.isValid() && currentFragment.contains(mCursorPos)
+            && currentFragment.charFormat().fontUnderline())
+        {
+            int start = currentFragment.position();
+            int length = currentFragment.length();
+
+            QTextCursor cursor = this->textCursor();
+            cursor.clearSelection();
+            cursor.setPosition(start);
+            cursor.setPosition(start + length,QTextCursor::KeepAnchor);
+
+            if(highlight)
+            {
+                cursor.mergeCharFormat(mFormatHighlight);
+            }
+            else
+            {
+                cursor.mergeCharFormat(mFormatNormal);
+            }
+
+            cursor.clearSelection();
+            break;
+        }
+    }
+}
+
+void UniViewerAddressWidget::aboutToShowContextMenu(HbMenu *contextMenu, const QPointF &pos)
+{
+    //remove default actions.
+    contextMenu->clearActions();
+    
+    // Check if there is an anchor at this pos
+    QString  anchor = this->anchorAt(pos);
+
+    if(!anchor.isEmpty() && !this->textCursor().hasSelection())
+    {
+
+        HbAction* action = NULL;
+
+        action = contextMenu->addAction(LOC_OPEN_CONTACT_INFO, this, SLOT(openContactInfo()));
+        action->setData(anchor);
+
+        action = contextMenu->addAction(LOC_CALL, this, SLOT(call()));
+        action->setData(anchor);
+
+        action = contextMenu->addAction(LOC_SEND_MESSAGE, this, SLOT(sendMessage()));
+        action->setData(anchor);
+
+        action = contextMenu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(saveToContacts()));
+        action->setData(anchor);
+
+        action = contextMenu->addAction(LOC_COPY, this, SLOT(copyToClipboard()));
+        action->setData(anchor);
+
+    }
+
+    connect(contextMenu,SIGNAL(aboutToClose()),this,SLOT(menuClosed()));    
+}
+
+void UniViewerAddressWidget::shortTapAction(QString anchor)
+{
+    HbAction action;
+    action.setData(anchor);
+    connect(&action,SIGNAL(triggered()),this,SLOT(openContactInfo()));
+    action.trigger();
+}
+
+void UniViewerAddressWidget::copyToClipboard()
+{
+    HbAction* action = qobject_cast<HbAction*>(sender());
+
+    if(action)
+    {
+        QMimeData* data = new QMimeData();
+        QString str = action->data().toString();
+        data->setText(str);
+        QApplication::clipboard()->setMimeData(data);
+    }
+}
+
+void UniViewerAddressWidget::call()
 {
-    Q_UNUSED(pos)
-    contextMenu->clearActions();
+    HbAction* action = qobject_cast<HbAction*>(sender());
+
+    if(action)
+    {
+        QString phoneNumber = action->data().toString();
+        
+        //invoke dialer service and pass phoneNumber.        
+        QString serviceName("com.nokia.symbian.ICallDial");
+        QString operation("dial(QString)");
+        
+        XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false);
+        
+        connect(serviceRequest, SIGNAL(requestCompleted(QVariant)),
+                this, SLOT(onServiceRequestCompleted()));
+        
+        connect(serviceRequest, SIGNAL(requestError(int)),
+                this, SLOT(onServiceRequestCompleted()));
+        
+        *serviceRequest << phoneNumber;
+        serviceRequest->send();
+    }
+}
+
+void UniViewerAddressWidget::onServiceRequestCompleted()
+    {
+    //service request is now complete. delete it.    
+    XQServiceRequest* request = qobject_cast<XQServiceRequest*>(sender());
+    
+    if(request)
+        {
+        delete request;
+        }
+    }
+
+
+void UniViewerAddressWidget::openContactInfo()
+{
+    HbAction* action = qobject_cast<HbAction*>(sender());
+    
+    if(action)
+    {
+        QList<QVariant> args;
+        QString operation;
+        
+        QString data = action->data().toString();        
+    
+        int contactId = MsgContactHandler::resolveContactDisplayName(
+                data,
+                QContactPhoneNumber::DefinitionName,
+                QContactPhoneNumber::FieldNumber);
+
+        // if contact is unresolved on phone number field
+        // then, try resolving it on email address field
+        if(contactId <= 0)
+        {
+            contactId = MsgContactHandler::resolveContactDisplayName(
+                data,
+                QContactEmailAddress::DefinitionName,
+                QContactEmailAddress::FieldEmailAddress);
+        }
+
+        if(contactId > 0)
+        {
+            //open contact card
+            operation = QString("open(int)");
+            args << contactId;
+        }
+        else
+        {
+            //save to contacts with phone number field prefilled.
+
+            operation = QString("editCreateNew(QString,QString)");
+            QString type = QContactPhoneNumber::DefinitionName;
+
+            args << type;
+            args << data;
+        }
+        
+        //service stuff.
+        QString serviceName("com.nokia.services.phonebookservices");
+     
+        XQAiwRequest* request;
+        XQApplicationManager appManager;
+        request = appManager.create(serviceName, "Fetch", operation, true); // embedded
+        if ( request == NULL )
+            {
+            return;       
+            }
+
+        // Result handlers
+        connect (request, SIGNAL(requestOk(const QVariant&)), 
+            this, SLOT(handleOk(const QVariant&)));
+        connect (request, SIGNAL(requestError(const QVariant&)), 
+            this, SLOT(handleError(const QVariant&)));
+        
+        request->setArguments(args);
+        request->send();
+        delete request;
+    }
+}
+
+void UniViewerAddressWidget::handleOk(const QVariant& result)
+    {
+    Q_UNUSED(result)
+    }
+
+void UniViewerAddressWidget::handleError(int errorCode, const QString& errorMessage)
+    {
+    Q_UNUSED(errorMessage)
+    Q_UNUSED(errorCode)
+    }
+
+void UniViewerAddressWidget::saveToContacts()
+{
+    //handler for save to contacts.
+}
+
+void UniViewerAddressWidget::sendMessage()
+{
+    HbAction* action = qobject_cast<HbAction*>(sender());
+
+    if(action)
+    {
+        QString phoneNumber = action->data().toString();
+        QString alias;
+
+        QTextBlock textBlock = this->document()->findBlock(mCursorPos);
+
+        QTextBlock::iterator it;
+
+        for (it = textBlock.begin(); !(it.atEnd()); ++it)
+        {
+            QTextFragment currentFragment = it.fragment();
+
+            if (currentFragment.isValid() && currentFragment.contains(mCursorPos)
+                && currentFragment.charFormat().fontUnderline())
+            {
+                QString txt = currentFragment.text();
+                if(txt != phoneNumber)
+                {
+                    alias = txt;  
+                }
+                break;
+            }
+        }
+        
+
+        //invoke editor & pass phoneNumber.
+        emit sendMessage(phoneNumber,alias);
+    }
 }
 
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewerattachmentcontainer.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* 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:
-*
-*/
-
-#include "univiewerattachmentcontainer.h"
-
-// SYSTEM INCLUDES
-#include <QGraphicsLinearLayout>
-#include <QFileInfo>
-
-// USER INCLUDES
-#include "univiewermediawidget.h"
-#include "debugtraces.h"
-
-// LOCAL CONSTANTS
-const QString ATTACHMENT_FRAME("qtg_fr_groupbox");
-const QString ATTACHMENT_ICON("qtg_small_attachment.svg");
-
-const int KILOBYTE = 1024;
-
-//---------------------------------------------------------------
-// UniViewerAttachmentContainer :: UniViewerAttachmentContainer
-// @see header file
-//---------------------------------------------------------------
-UniViewerAttachmentContainer::UniViewerAttachmentContainer(QGraphicsItem *parent) :
-    HbWidget(parent), mTotalAttachment(0), mMainLayout(NULL)
-{
-    QDEBUG_WRITE("AttachmentContainer Initialized..");
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
-    mMainLayout->setContentsMargins(0, 0, 0, 0);
-    mMainLayout->setSpacing(0);
-    setLayout(mMainLayout);
-}
-
-//---------------------------------------------------------------
-// UniViewerAttachmentContainer :: ~UniViewerAttachmentContainer
-// @see header file
-//---------------------------------------------------------------
-UniViewerAttachmentContainer::~UniViewerAttachmentContainer()
-{
-
-}
-
-//---------------------------------------------------------------
-// UniViewerAttachmentContainer :: addAttachmentWidget
-// @see header file
-//---------------------------------------------------------------
-void UniViewerAttachmentContainer::addAttachmentWidget(QString type, QString fileName)
-{
-    Q_UNUSED(type)
-
-    UniViewerMediaWidget *attachmentWidget = new UniViewerMediaWidget(this);
-    mUniViewerMediaWidgetList.append(attachmentWidget);
-    QFileInfo fileInfo(fileName);
-
-    int fileSize = fileInfo.size();
-    QString sizeString('B');
-    if (fileSize > KILOBYTE) {
-        // Convert to Kilobytes.
-        fileSize /= KILOBYTE;
-        sizeString = "Kb";
-    }
-
-    QString fileDetails = "(" + QString::number(fileSize) + sizeString + ")";
-
-    attachmentWidget->populate(ATTACHMENT_ICON, fileInfo.fileName(), fileDetails, ATTACHMENT_FRAME);
-
-    mMainLayout->addItem(attachmentWidget);
-
-    mTotalAttachment++;
-}
-
-//---------------------------------------------------------------
-// UniViewerAttachmentContainer :: clearContent
-// @see header file
-//---------------------------------------------------------------
-void UniViewerAttachmentContainer::clearContent()
-{
-    for (int i = 0; i < mUniViewerMediaWidgetList.count(); ++i) {
-        --mTotalAttachment;
-        mMainLayout->removeItem(mUniViewerMediaWidgetList[i]);
-        mUniViewerMediaWidgetList[i]->setParent(NULL);
-        delete mUniViewerMediaWidgetList[i];
-        mUniViewerMediaWidgetList[i] = NULL;
-    }
-    mUniViewerMediaWidgetList.clear();
-    resize(rect().width(), -1);
-}
-
-//eof
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerattachmentwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,259 @@
+/*
+ * 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: Widget for displaying attachment media objects.
+ *
+ */
+
+#include "univiewerattachmentwidget.h"
+
+// SYSTEM INCLUDES
+#include <HbIconItem>
+#include <HbTextItem>
+#include <HbFrameItem>
+#include <HbMenu>
+#include <HbEffect>
+#include <HbTapGesture>
+#include <HbInstantFeedback>
+
+#include <QFileInfo>
+#include <QTimer>
+
+// USER INCLUDES
+#include "univiewerutils.h"
+#include "unidatamodelplugininterface.h"
+
+// LOCAL CONSTANTS
+#define LOC_OPEN hbTrId("txt_common_menu_open")
+#define LOC_SAVE hbTrId("txt_common_menu_save")
+#define LOC_SAVE_TO_CONTACTS hbTrId("txt_messaging_menu_save_to_contacts")
+
+const QString BG_FRAME_NORMAL("qtg_fr_list_normal");
+const QString BG_FRAME_PRESSED("qtg_fr_list_pressed");
+const QString ATTACHMENT_ICON("qtg_small_attachment");
+const QString CORRUPTED_ATTACH_ICON("qtg_small_corrupted");
+const QString VCARD_MIMETYPE("text/X-vCard");
+
+const int KILOBYTE = 1024;
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::UniViewerAttachmentWidget
+// @see header file
+//----------------------------------------------------------------------------
+UniViewerAttachmentWidget::UniViewerAttachmentWidget(QGraphicsItem *parent) :
+    HbWidget(parent), mMediaIcon(0), mName(0), mInfo(0), mFrameItem(0), mViewerUtils(0)
+{
+    this->grabGesture(Qt::TapGesture);
+
+    setProperty("state", "normal");
+
+    mMediaIcon = new HbIconItem(this);
+    HbStyle::setItemName(mMediaIcon, "mediaIcon");
+
+    mName = new HbTextItem(this);
+    HbStyle::setItemName(mName, "text-1");
+
+    mInfo = new HbTextItem(this);
+    HbStyle::setItemName(mInfo, "text-2");
+
+    mFrameItem = new HbFrameItem(BG_FRAME_NORMAL, HbFrameDrawer::NinePieces, this);
+    HbStyle::setItemName(mFrameItem, "bgFrame");
+
+    HbEffect::add("attachmentWidget", "listviewitem_press", "pressed");
+    HbEffect::add("attachmentWidget", "listviewitem_release", "released");
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::~UniViewerAttachmentWidget
+// @see header file
+//----------------------------------------------------------------------------
+UniViewerAttachmentWidget::~UniViewerAttachmentWidget()
+{
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::populate
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::populate(UniMessageInfo *info)
+{
+    mMimeType = info->mimetype();
+    mMediaPath = info->path();
+
+    QString attachIcon;
+    if (info->isProtected()) {
+        attachIcon = ATTACHMENT_ICON;
+    }
+    else if (info->isCorrupted()) {
+        attachIcon = CORRUPTED_ATTACH_ICON;
+    }
+    else {
+        attachIcon = ATTACHMENT_ICON;
+    }
+
+    mMediaIcon->setIconName(attachIcon);
+    QFileInfo fileInfo(mMediaPath);
+    mName->setText(fileInfo.fileName());
+
+    QString sizeString('B');
+    int fileSize = fileInfo.size();
+    if (fileSize > KILOBYTE) {
+        // Convert to Kilobytes.
+        fileSize /= KILOBYTE;
+        sizeString = "Kb";
+    }
+    QString fileDetails = "(" + QString::number(fileSize) + sizeString + ")";
+    mInfo->setText(fileDetails);
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::resizeEvent
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::gestureEvent(QGestureEvent *event)
+{
+    HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
+    if (tapGesture) {
+        switch (tapGesture->state()) {
+        case Qt::GestureStarted:
+        {
+            // Trigger haptic feedback.
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(true);
+            break;
+        }
+        case Qt::GestureUpdated:
+        {
+            if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
+                // Handle longtap.
+                setPressed(false);
+                handleLongTap(tapGesture->scenePosition());
+            }
+            break;
+        }
+        case Qt::GestureFinished:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
+                // Handle short tap.
+                setPressed(false);
+                handleShortTap();
+            }
+            break;
+        }
+        case Qt::GestureCanceled:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            setPressed(false);
+            break;
+        }
+        }
+    }
+    else {
+        HbWidget::gestureEvent(event);
+    }
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::handleOpen
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::handleOpen()
+{
+    this->ungrabGesture(Qt::TapGesture);
+    
+    if (!mViewerUtils) {
+        mViewerUtils = new UniViewerUtils(this);
+    }
+    mViewerUtils->launchContentViewer(mMimeType, mMediaPath);
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::handleSave
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::handleSave()
+{
+
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::handleShortTap
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::handleShortTap()
+{
+    emit shortTap(mMediaPath);
+
+    // Open the media.
+    handleOpen();
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::handleLongTap
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::handleLongTap(const QPointF &position)
+{
+    emit longTap(position);
+
+    // Display context sensitive menu.
+    HbMenu* menu = new HbMenu;
+    menu->setAttribute(Qt::WA_DeleteOnClose);
+    menu->setPreferredPos(position);
+
+    if (mMimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
+        // For vcard opening & saving is same.
+        menu->addAction(LOC_SAVE_TO_CONTACTS, this, SLOT(handleOpen()));
+    }
+    else {
+        menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+        menu->addAction(LOC_SAVE, this, SLOT(handleSave()));
+    }
+
+    menu->show();
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAttachmentWidget::setPressed
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAttachmentWidget::setPressed(bool pressed)
+{
+    if (pressed) {
+        setProperty("state", "pressed");
+        mFrameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_PRESSED);
+        HbEffect::cancel(mFrameItem, "released");
+        HbEffect::start(mFrameItem, "attachmentWidget", "pressed");
+
+    }
+    else {
+        setProperty("state", "normal");
+        mFrameItem->frameDrawer().setFrameGraphicsName(BG_FRAME_NORMAL);
+        HbEffect::cancel(mFrameItem, "pressed");
+        HbEffect::start(mFrameItem, "attachmentWidget", "released");
+    }
+}
+
+//---------------------------------------------------------------
+// UniViewerAttachmentWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void UniViewerAttachmentWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
+// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/src/univieweraudiowidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,146 @@
+/*
+ * 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: This widget is used to display audio content in univiewer.
+ *
+ */
+#include "univieweraudiowidget.h"
+
+// SYSTEM INCLUDES
+#include <QFileInfo>
+#include <QTimer>
+#include <HbMenu>
+
+// USER INCLUDES
+#include "msgmediautil.h"
+#include "univiewerutils.h"
+#include "unidatamodelplugininterface.h"
+
+// LOCAL CONSTANTS
+#define LOC_OPEN    hbTrId("txt_common_menu_open")
+#define LOC_SAVE    hbTrId("txt_common_menu_save")
+
+const QString AUDIO_ICON("qtg_mono_audio");
+const QString CORRUPTED_AUDIO_ICON("qtg_mono_corrupted");
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::UniViewerAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+UniViewerAudioWidget::UniViewerAudioWidget(QGraphicsItem *parent) :
+    HbPushButton(parent), mViewerUtils(0)
+{
+    connect(this, SIGNAL(clicked()), this, SLOT(handleShortTap()));
+    connect(this, SIGNAL(longPress(QPointF)), this, SLOT(handleLongTap(QPointF)));
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::~UniViewerAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+UniViewerAudioWidget::~UniViewerAudioWidget()
+{
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::~UniViewerAudioWidget
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::populate(UniMessageInfo *info)
+{
+    mMimeType = info->mimetype();
+    mMediaPath = info->path();
+
+    HbIcon audioIcon;
+    if (info->isProtected()) {
+        audioIcon.setIconName(AUDIO_ICON);
+    }
+    else if (info->isCorrupted()) {
+        audioIcon.setIconName(CORRUPTED_AUDIO_ICON);
+    }
+    else {
+        audioIcon.setIconName(AUDIO_ICON);
+    }
+
+    this->setIcon(audioIcon);
+    QFileInfo fileInfo(mMediaPath);
+    this->setText(fileInfo.baseName());
+    this->setTextAlignment(Qt::AlignLeft);
+    MsgMediaUtil mediaUtil;
+    this->setAdditionalText(mediaUtil.mediaDuration(mMediaPath));
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::handleShortTap
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::handleShortTap()
+{
+    emit shortTap(mMediaPath);
+
+    // Open the media.
+    handleOpen();
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::handleLongTap
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::handleLongTap(const QPointF &position)
+{
+    emit longTap(position);
+
+    // Display context sensitive menu.
+    HbMenu* menu = new HbMenu;
+    menu->setAttribute(Qt::WA_DeleteOnClose);
+    menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+    menu->addAction(LOC_SAVE, this, SLOT(handleSave()));
+    menu->setPreferredPos(position);
+    menu->show();
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::handleOpen
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::handleOpen()
+{
+    this->ungrabGesture(Qt::TapGesture);
+    
+    if (!mViewerUtils) {
+        mViewerUtils = new UniViewerUtils(this);
+    }
+    mViewerUtils->launchContentViewer(mMimeType, mMediaPath);
+    
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
+}
+
+//----------------------------------------------------------------------------
+// UniViewerAudioWidget::handleSave
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerAudioWidget::handleSave()
+{
+
+}
+
+//---------------------------------------------------------------
+// UniViewerAudioWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void UniViewerAudioWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
+// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerbodywidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -17,33 +17,21 @@
 
 #include "univiewerbodywidget.h"
 
+// SYSTEM INCLUDES
 #include <QFile>
-#include <QFileInfo>
-#include <QPixmap>
-#include <QGraphicsLayout>
-#include <QSignalMapper>
-
 #include <HbTextItem>
-#include <HbIconItem>
-#include <HbPushButton>
-#include <HbAction>
-#include <HbMenu>
 #include <HbMainWindow>
-#include <HbInstance>
-#include <HbGesture>
-#include <HbGestureSceneFilter>
 
-#include <xqaiwrequest.h>
-#include <xqrequestinfo.h>
-#include <xqappmgr.h>
+// USER INCLUDES
+#include "univiewertextitem.h"
+#include "univiewerpixmapwidget.h"
+#include "univieweraudiowidget.h"
 
-#include "univiewertextitem.h"
-#include "msgmediautil.h"
 // LOCAL CONSTANTS
-const QString AUDIO_ICON("qtg_mono_audio");
-
-// Localization
-#define LOC_TITLE   hbTrId("txt_messaging_title_messaging")
+const QString IMAGE_MIMETYPE("image");
+const QString AUDIO_MIMETYPE("audio");
+const QString VIDEO_MIMETYPE("video");
+const QString TEXT_MIMETYPE("text");
 
 //---------------------------------------------------------------
 //UniViewerBodyWidget::UniViewerBodyWidget
@@ -51,17 +39,9 @@
 //---------------------------------------------------------------
 UniViewerBodyWidget::UniViewerBodyWidget(QGraphicsItem *parent) :
     HbWidget(parent), mHasText(false), mHasPixmap(false), mTextItem(0), mSlideCounter(0),
-        mIconItem(0), mAudioItem(0)
+        mPixmapItem(0), mAudioItem(0)
 {
-    //Gesture filter for the image
-    gestureFilter = new HbGestureSceneFilter(Qt::LeftButton, this);
-    gestureFilter->setLongpressAnimation(true);
-    HbGesture *gesture = new HbGesture(HbGesture::longpress, 20);
-    gestureFilter->addGesture(gesture);
-    connect(gesture, SIGNAL(longPress(QPointF)), this, SLOT(longPressed(QPointF)));
-    // Signal mapper for opening media files
-    mSignalMapper = new QSignalMapper(this);
-    connect(mSignalMapper, SIGNAL(mapped(const QString &)), this, SLOT(openMedia(const QString &)));
+    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 }
 
 //---------------------------------------------------------------
@@ -76,21 +56,16 @@
 //UniViewerBodyWidget::setImage
 // @see header file
 //---------------------------------------------------------------
-void UniViewerBodyWidget::setImage(QString imagefile)
+void UniViewerBodyWidget::setPixmap(UniMessageInfo *info)
 {
     setHasPixmap(true);
     //create image item instance
-    if (!mIconItem) {
-        mIconItem = new HbIconItem(this);
-        HbStyle::setItemName(mIconItem, "pixmap");
+    if (!mPixmapItem) {
+        mPixmapItem = new UniViewerPixmapWidget(this);
+        HbStyle::setItemName(mPixmapItem, "pixmap");
     }
-
-    QPixmap pixmap(imagefile);
-    mIconItem->setIcon(HbIcon(pixmap));
-
-    // TODO
-    // Implementation for short tap action is unclear
-    // Connect to signal mapper
+    mPixmapItem->hide();
+    mPixmapItem->populate(info);
 
     this->repolish();
 }
@@ -99,22 +74,14 @@
 //UniViewerBodyWidget::setAudio
 // @see header file
 //---------------------------------------------------------------
-void UniViewerBodyWidget::setAudio(QString audiofile)
+void UniViewerBodyWidget::setAudio(UniMessageInfo *info)
 {
     if (!mAudioItem) {
-        mAudioItem = new HbPushButton(this);
+        mAudioItem = new UniViewerAudioWidget(this);
         HbStyle::setItemName(mAudioItem, "audioItem");
     }
-    QFileInfo fileInfo(audiofile);
-    mAudioItem->setIcon(HbIcon(AUDIO_ICON));
-    mAudioItem->setText(fileInfo.baseName());
-    MsgMediaUtil mediaUtil;
-    mAudioItem->setAdditionalText(mediaUtil.mediaDuration(audiofile));
-    mAudioItem->setTextAlignment(Qt::AlignLeft);
-
-    // Connect to signal mapper with file name
-    mSignalMapper->setMapping(mAudioItem, audiofile);
-    connect(mAudioItem, SIGNAL(clicked()), mSignalMapper, SLOT(map()));
+    mAudioItem->hide();
+    mAudioItem->populate(info);
 
     this->repolish();
 }
@@ -123,16 +90,25 @@
 //UniViewerBodyWidget::setVideo
 // @see header file
 //---------------------------------------------------------------
-void UniViewerBodyWidget::setVideo(QString videofile)
+void UniViewerBodyWidget::setVideo(UniMessageInfo *info)
 {
-    Q_UNUSED(videofile)
+    setHasPixmap(true);
+    //create image item instance
+    if (!mPixmapItem) {
+       mPixmapItem = new UniViewerPixmapWidget(this);
+       HbStyle::setItemName(mPixmapItem, "pixmap");
+    }
+    mPixmapItem->hide();
+    mPixmapItem->populate(info);
+    
+    this->repolish();
 }
 
 //---------------------------------------------------------------
-//UniViewerBodyWidget::setTextContent
+//UniViewerBodyWidget::setText
 // @see header file
 //---------------------------------------------------------------
-void UniViewerBodyWidget::setTextContent(QString text)
+void UniViewerBodyWidget::setText(QString text)
 {
     setHasText(true);
 
@@ -142,6 +118,7 @@
         connect(mTextItem, SIGNAL(sendMessage(const QString&)), this,
             SIGNAL(sendMessage(const QString&)));
     }
+    mTextItem->hide();
     text.replace(QChar::ParagraphSeparator, QChar::LineSeparator);
     text.replace('\r', QChar::LineSeparator);
     mTextItem->setText(text);
@@ -149,7 +126,7 @@
 }
 
 //---------------------------------------------------------------
-//UniViewerBodyWidget::setTextContent
+// UniViewerBodyWidget::setSlideCounter
 // @see header file
 //---------------------------------------------------------------
 void UniViewerBodyWidget::setSlideCounter(QString &slideCounter)
@@ -159,6 +136,7 @@
         HbStyle::setItemName(mSlideCounter, "slideCounter");
     }
 
+    mSlideCounter->hide();
     mSlideCounter->setText(slideCounter);
     this->repolish();
 }
@@ -212,25 +190,23 @@
     int count = objList.count();
     for (int a = 0; a < count; ++a) {
         UniMessageInfo* info = objList.at(a);
-        QString type = info->mimetype();
+        QString mimeType = info->mimetype();
 
-        if (type.contains("text")) {
+        if (mimeType.contains(TEXT_MIMETYPE)) {
             QFile file(info->path());
-            if (file.open(QIODevice::ReadOnly))
-			{
-			QString textContent(file.readAll());
-            setTextContent(textContent);
-			}
-            
+            if (file.open(QIODevice::ReadOnly)) {
+                QString textContent(file.readAll());
+                setText(textContent);
+            }
         }
-        else if (type.contains("video")) {
-            setVideo(info->path());
+        else if (mimeType.contains(AUDIO_MIMETYPE)) {
+            setAudio(info);
         }
-        else if (type.contains("audio")) {
-            setAudio(info->path());
+        else if (mimeType.contains(VIDEO_MIMETYPE)) {
+            setVideo(info);
         }
-        else if (type.contains("image")) {
-            setImage(info->path());
+        else if (mimeType.contains(IMAGE_MIMETYPE)) {
+            setPixmap(info);
         }
 
         delete info;
@@ -244,10 +220,10 @@
 void UniViewerBodyWidget::clearContent()
 {
     // delete the temp items(pixmap) & clear permanent items(text)
-    if (mIconItem) {
-        mIconItem->setParent(NULL);
-        delete mIconItem;
-        mIconItem = NULL;
+    if (mPixmapItem) {
+        mPixmapItem->setParent(NULL);
+        delete mPixmapItem;
+        mPixmapItem = NULL;
     }
 
     if (mAudioItem) {
@@ -268,199 +244,149 @@
 }
 
 //---------------------------------------------------------------
-//UniViewerBodyWidget::resizeEvent
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::resizeEvent(QGraphicsSceneResizeEvent* event)
-{
-    Q_UNUSED(event)
-
-    HbMainWindow *mainWindow = this->mainWindow();
-    if (mainWindow) {
-        qreal screenWidth = 0.0;
-        qreal screenHeight = 0.0;
-        qreal leftMargin = 0.0;
-        qreal rightMargin = 0.0;
-        qreal chromeHeight = 0.0;
-        qreal toolbarHeight = 0.0;
-        qreal iconSize = 0.0;
-        qreal unitSize = HbDeviceProfile::profile(mIconItem).unitValue();
-        style()->parameter("hb-param-screen-width", screenWidth);
-        style()->parameter("hb-param-screen-height", screenHeight);
-        style()->parameter("hb-param-margin-gene-left", leftMargin);
-        style()->parameter("hb-param-margin-gene-right", rightMargin);
-        style()->parameter("hb-param-widget-chrome-height", chromeHeight);
-        style()->parameter("hb-param-widget-toolbar-height", toolbarHeight);
-        style()->parameter("hb-param-graphic-size-primary-large", iconSize);
-
-        qreal maxWidth = 0.0;
-        qreal maxHeight = 0.0;
-
-        if (mainWindow->orientation() == Qt::Horizontal) {
-            qreal temp;
-            temp = screenWidth;
-            screenWidth = screenHeight;
-            screenHeight = temp;
-            if (mIconItem) {
-                if (mHasText) {
-                    maxWidth = (screenWidth / 2) - leftMargin - unitSize;
-                }
-                else {
-                    maxWidth = screenWidth - leftMargin - rightMargin;
-                }
-                maxHeight = screenHeight - chromeHeight - toolbarHeight;
-            }
-            if (mAudioItem) {
-                mAudioItem->setStretched(true);
-            }
-        }
-        else if (mainWindow->orientation() == Qt::Vertical) {
-            if (mIconItem) {
-                maxWidth = screenWidth - leftMargin - rightMargin;
-                maxHeight = screenHeight - chromeHeight - toolbarHeight;
-            }
-            if (mAudioItem) {
-                mAudioItem->setStretched(false);
-            }
-        }
-
-        if (mIconItem) {
-            qreal imageWidth = mIconItem->icon().defaultSize().width();
-            qreal imageHeight = mIconItem->icon().defaultSize().height();
-
-            qreal widthToSet = 0.0;
-            qreal heightToSet = 0.0;
-
-            if (imageWidth < iconSize) {
-                widthToSet = iconSize;
-                heightToSet = iconSize;
-            }
-            else if (imageWidth <= maxWidth) {
-                // resize not needed
-                widthToSet = imageWidth;
-                heightToSet = qMin(imageHeight, maxHeight);
-            }
-            else {
-                // resize needed, keep aspect-ratio and resize
-                widthToSet = maxWidth;
-                heightToSet = maxWidth * (imageHeight / imageWidth);
-                heightToSet = qMin(heightToSet, maxHeight);
-
-            }
-            if (heightToSet == maxHeight) {
-                widthToSet = heightToSet * (imageWidth / imageHeight);
-            }
-
-            mIconItem->setPreferredWidth(widthToSet);
-            mIconItem->setPreferredHeight(heightToSet);
-        }
-    }
-}
-
-//---------------------------------------------------------------
-//UniViewerBodyWidget::longPressed
+//UniViewerBodyWidget::sizeHint
 // @see header file
 //---------------------------------------------------------------
-void UniViewerBodyWidget::longPressed(QPointF position)
+QSizeF UniViewerBodyWidget::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
 {
-
-    HbMenu* menu = new HbMenu;
-    menu->addAction(tr("Open"), this, SLOT(openMedia()));
-    menu->addAction(tr("View details"), this, SLOT(viewDetails()));
-    menu->exec(position);
-    delete menu;
-}
+    QSizeF szHint = HbWidget::sizeHint(which, constraint);
 
-//---------------------------------------------------------------
-//UniViewerBodyWidget::openMedia
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::openMedia()
-{
-}
-
-//---------------------------------------------------------------
-//UniViewerBodyWidget::openMedia
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::openMedia(const QString& fileName)
-{
-    XQSharableFile sf;
-    XQAiwRequest* request = 0;
-
-    if (!sf.open(fileName)) {
-        return;
+    HbMainWindow *mainWindow = this->mainWindow();
+    if (!mainWindow) {
+        return szHint;
     }
 
-    // Get handlers
-    XQApplicationManager appManager;
-    QList<XQAiwInterfaceDescriptor> fileHandlers = appManager.list(sf);
-    if (fileHandlers.count() > 0) {
-        XQAiwInterfaceDescriptor d = fileHandlers.first();
-        request = appManager.create(sf, d);
+    qreal screenWidth = 0.0;
+    qreal screenHeight = 0.0;
+    qreal leftMargin = 0.0;
+    qreal rightMargin = 0.0;
+    qreal chromeHeight = 0.0;
+    qreal toolbarHeight = 0.0;
+    qreal iconSize = 0.0;
+    qreal spacing = 0.0;
+    qreal unitSize = HbDeviceProfile::profile(mPixmapItem).unitValue();
+    style()->parameter("hb-param-screen-width", screenWidth);
+    style()->parameter("hb-param-screen-height", screenHeight);
+    style()->parameter("hb-param-margin-gene-left", leftMargin);
+    style()->parameter("hb-param-margin-gene-right", rightMargin);
+    style()->parameter("hb-param-widget-chrome-height", chromeHeight);
+    style()->parameter("hb-param-widget-toolbar-height", toolbarHeight);
+    style()->parameter("hb-param-graphic-size-primary-large", iconSize);
+    style()->parameter("hb-param-margin-gene-middle-vertical", spacing);
 
-        if (!request) {
-            sf.close();
-            return;
+    qreal maxWidth = 0.0;
+    qreal maxHeight = 0.0;
+
+    // Calculate max height & max width.
+    if (mainWindow->orientation() == Qt::Horizontal) {
+        qreal temp;
+        temp = screenWidth;
+        screenWidth = screenHeight;
+        screenHeight = temp;
+
+        if (mPixmapItem && mHasText) {
+            maxWidth = (screenWidth / 2) - leftMargin - unitSize;
+        }
+        else {
+            maxWidth = screenWidth - leftMargin - rightMargin;
+        }
+        maxHeight = screenHeight - chromeHeight - toolbarHeight;
+
+        if (mAudioItem) {
+            mAudioItem->setStretched(true);
         }
     }
-    else {
-        sf.close();
-        return;
+    else if (mainWindow->orientation() == Qt::Vertical) {
+        maxWidth = screenWidth - leftMargin - rightMargin;
+        maxHeight = screenHeight - chromeHeight - toolbarHeight;
+
+        if (mAudioItem) {
+            mAudioItem->setStretched(false);
+        }
+    }
+
+    // Slide Counter
+    QSizeF slideCounterSize(0, 0);
+    if (mSlideCounter) {
+        slideCounterSize = mSlideCounter->effectiveSizeHint(which, constraint);
+        mSlideCounter->show();
+    }
+    // Audio Item
+    QSizeF audioSize(0, 0);
+    if (mAudioItem) {
+        audioSize = mAudioItem->effectiveSizeHint(which, constraint);
+        mAudioItem->show();
     }
 
-    // Result handlers
-    connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)));
-    connect(request, SIGNAL(requestError(const QVariant&)), this,
-        SLOT(handleError(const QVariant&)));
+    // Text Item
+    QSizeF textSize(0, 0);
+    if (mTextItem) {
+        textSize = mTextItem->effectiveSizeHint(which, constraint);
+        mTextItem->show();
+    }
+
+    // Pixmap Item
+    QSizeF pixmapSize(0, 0);
+    if (mPixmapItem) {
+        qreal imageWidth = mPixmapItem->icon().defaultSize().width();
+        qreal imageHeight = mPixmapItem->icon().defaultSize().height();
 
-    request->setEmbedded(true);
-    request->setSynchronous(true);
+        qreal widthToSet = 0.0;
+        qreal heightToSet = 0.0;
 
-    // Fill args
-    QList<QVariant> args;
-    args << qVariantFromValue(sf);
-    request->setArguments(args);
+        if (imageWidth < iconSize) {
+            widthToSet = iconSize;
+            heightToSet = iconSize;
+        }
+        else if (imageWidth <= maxWidth) {
+            // resize not needed
+            widthToSet = imageWidth;
+            heightToSet = qMin(imageHeight, maxHeight);
+        }
+        else {
+            // resize needed, keep aspect-ratio and resize
+            widthToSet = maxWidth;
+            heightToSet = maxWidth * (imageHeight / imageWidth);
+            heightToSet = qMin(heightToSet, maxHeight);
 
-    // Fill headers
-    QString key("WindowTitle");
-    QVariant value(QString(LOC_TITLE));
-    XQRequestInfo info;
-    info.setInfo(key, value);
-    request->setInfo(info);
+        }
+        if (heightToSet == maxHeight) {
+            widthToSet = heightToSet * (imageWidth / imageHeight);
+        }
+
+        pixmapSize.setHeight(heightToSet);
+        pixmapSize.setWidth(widthToSet);
+        mPixmapItem->setPreferredSize(pixmapSize);
+        mPixmapItem->show();
+    }
+
+    // Calculate the size hint to be returned.
+    szHint.setHeight(0);
 
-    request->send();
+    if (!slideCounterSize.isNull()) {
+        szHint.rheight() += (slideCounterSize.height() + spacing);
+    }
+    if (!audioSize.isNull()) {
+        szHint.rheight() += (audioSize.height() + spacing);
+    }
 
-    // Cleanup
-    sf.close();
-    delete request;
+    if (mainWindow->orientation() == Qt::Horizontal) {
+        qreal remainingHeight = qMax(pixmapSize.height(), textSize.height());
+        if (remainingHeight > 0.0) {
+            szHint.rheight() += (remainingHeight + spacing);
+        }
+    }
+    else if (mainWindow->orientation() == Qt::Vertical) {
+        if (!pixmapSize.isNull()) {
+            szHint.rheight() += (pixmapSize.height() + spacing);
+        }
+        if (!textSize.isNull()) {
+            szHint.rheight() += (textSize.height() + spacing);
+        }
+    }
+    szHint.rheight() = qMax(maxHeight, szHint.height());
+
+    return szHint;
 }
 
-//---------------------------------------------------------------
-//UniViewerBodyWidget::viewDetails
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::viewDetails()
-{
-    //open details view.
-}
-
-//---------------------------------------------------------------
-// UniViewerBodyWidget :: handleOk
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::handleOk(const QVariant& result)
-{
-    Q_UNUSED(result)
-}
-
-//---------------------------------------------------------------
-// UniViewerBodyWidget :: handleError
-// @see header file
-//---------------------------------------------------------------
-void UniViewerBodyWidget::handleError(int errorCode, const QString& errorMessage)
-{
-    Q_UNUSED(errorMessage)
-    Q_UNUSED(errorCode)
-}
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerdetailswidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -44,7 +44,6 @@
     HbWidget(parent), mSubjectLabel(0), mPriorityIcon(0)
 {
     // Permanent items & will not be removed
-
     mTime = new HbTextItem(this);
     HbStyle::setItemName(mTime, "timeLabel");
 }
--- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -167,6 +167,24 @@
 }
 
 // ---------------------------------------------------------------------------
+// UniViewerFeeder::bccAddressList
+// @see header file
+// ---------------------------------------------------------------------------
+ConvergedMessageAddressList UniViewerFeeder::bccAddressList()
+{
+    return d_ptr->bccAddressList();
+}
+
+// ---------------------------------------------------------------------------
+// UniViewerFeeder::recipientCount
+// @see header file
+// ---------------------------------------------------------------------------
+int UniViewerFeeder::recipientCount()
+{
+    return d_ptr->recipientCount();
+}
+
+// ---------------------------------------------------------------------------
 // UniViewerFeeder::messageSize
 // @see header file
 // ---------------------------------------------------------------------------
--- a/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerfeeder_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,17 +18,15 @@
 #include "univiewerfeeder_p.h"
 // SYSTEM INCLUDES
 #include <msvstd.h>
-#include <s60qconversions.h>
 #include <msvids.h>
-#include <qtcontactsglobal.h>
-#include "qtcontacts.h"
-#include "qcontactdetailfilter.h"
 
 // USER INCLUDES
 #include "nativemessageconsts.h"
 #include "univiewerfeeder.h"
 #include "unidatamodelloader.h"
+#include "msgcontacthandler.h"
 #include "debugtraces.h"
+#include "msgbiouids.h"
 
 // ---------------------------------------------------------------------------
 // UniViewerFeederPrivate::UniViewerFeederPrivate
@@ -158,8 +156,8 @@
 void UniViewerFeederPrivate::fetchDetailsL()
 {
     QDEBUG_WRITE("UniViewerFeederPrivate fetchDetailsL : SMS start");
-    if (msgType() == KSenduiMtmSmsUidValue)
-    {
+    if (msgType() == KSenduiMtmSmsUidValue || (msgType() == KSenduiMtmBioUidValue
+        && mEntry.iBioType == KMsgBioNokiaServiceMessage.iUid)) {
         QString body;
         mPluginInterface->body(body);
         q_ptr->emitMsgBody(body);
@@ -250,14 +248,21 @@
         mPluginInterface->setMessageId(msgId);
     }
 
-    if (msgType() == KSenduiMtmMmsUidValue)
-    {
+    else if (msgType() == KSenduiMtmMmsUidValue) {
         mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::Mms);
         mPluginInterface->setMessageId(msgId);
         mSlideCount = mPluginInterface->slideCount();
+
     }
+    else if (msgType() == KSenduiMtmBioUidValue && mEntry.iBioType
+        == KMsgBioNokiaServiceMessage.iUid) {
+        mPluginInterface = mPluginLoader->getDataModelPlugin(ConvergedMessage::BioMsg);
+        mPluginInterface->setMessageId(msgId);
+    }
+
     mPluginInterface->toRecipientList(mToAddressList);
     mPluginInterface->ccRecipientList(mCcAddressList);
+    mPluginInterface->bccRecipientList(mBccAddressList);
 }
 
 // ---------------------------------------------------------------------------
@@ -267,9 +272,10 @@
 ConvergedMessageAddressList UniViewerFeederPrivate::toAddressList()
 {
     QString alias = QString();
-    for (int i = 0; i < mToAddressList.count(); ++i)
-    {
-        GetNameFromContacts(mToAddressList.at(i)->address(), alias);
+    int count;
+    for (int i = 0; i < mToAddressList.count(); ++i) {
+        MsgContactHandler::resolveContactDisplayName(
+		mToAddressList.at(i)->address(), alias, count);
         mToAddressList.at(i)->setAlias(alias);
         alias.clear();
     }
@@ -283,9 +289,10 @@
 ConvergedMessageAddressList UniViewerFeederPrivate::ccAddressList()
 {
     QString alias = QString();
-    for (int i = 0; i < mCcAddressList.count(); ++i)
-    {
-        GetNameFromContacts(mCcAddressList.at(i)->address(), alias);
+    int count;
+    for (int i = 0; i < mCcAddressList.count(); ++i) {
+        MsgContactHandler::resolveContactDisplayName(
+		mToAddressList.at(i)->address(), alias, count);
         mCcAddressList.at(i)->setAlias(alias);
         alias.clear();
 
@@ -294,6 +301,35 @@
 }
 
 // ---------------------------------------------------------------------------
+// UniViewerFeederPrivate::bccAddressList
+// @see header file
+// ---------------------------------------------------------------------------
+ConvergedMessageAddressList UniViewerFeederPrivate::bccAddressList()
+{
+    QString alias = QString();
+    int count;
+    for (int i = 0; i < mBccAddressList.count(); ++i)
+    {
+        MsgContactHandler::resolveContactDisplayName(
+            mBccAddressList.at(i)->address(),
+            alias,
+            count);
+        mBccAddressList.at(i)->setAlias(alias);
+        alias.clear();
+    }
+    return mBccAddressList;
+}
+
+// ---------------------------------------------------------------------------
+// UniViewerFeederPrivate::recipientCount
+// @see header file
+// ---------------------------------------------------------------------------
+int UniViewerFeederPrivate::recipientCount()
+{
+    return mToAddressList.count() + mCcAddressList.count() + mBccAddressList.count();
+}
+
+// ---------------------------------------------------------------------------
 // UniViewerFeederPrivate::messageSize
 // @see header file
 // ---------------------------------------------------------------------------
@@ -309,7 +345,8 @@
 void UniViewerFeederPrivate::fromAddressAndAlias(QString& from, QString& alias)
 {
     mPluginInterface->fromAddress(from);
-    GetNameFromContacts(from, alias);
+    int count;
+    MsgContactHandler::resolveContactDisplayName(from, alias, count);
 }
 
 // ---------------------------------------------------------------------------
@@ -328,51 +365,13 @@
     {
         delete mCcAddressList.at(i);
     }
-
     mCcAddressList.clear();
-}
-
-// ---------------------------------------------------------------------------
-// UniViewerFeederPrivate::GetNameFromContacts
-// @see header file
-//----------------------------------------------------------------------------
-int UniViewerFeederPrivate::GetNameFromContacts(const QString& address,
-                                                QString& alias)
-{
-    QContactManager contactManager("symbian");
-    //set filter
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(QContactPhoneNumber::DefinitionName,
-                                        QContactPhoneNumber::FieldNumber);
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
-
-    phoneFilter.setValue(address); // this is the phone number to be resolved
 
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts =
-            contactManager.contacts(phoneFilter,
-                                    sortOrder,
-                                    QStringList());
-                                    
-    int count = 0;
-    if (matchingContacts.count() > 0)
+    for (int i = 0; i < mBccAddressList.count(); ++i)
     {
-        QContact match = matchingContacts.at(0);       
-        
-        QString displayLabel = match.displayLabel();
-
-        if (displayLabel != "Unnamed")
-        {
-            alias.append(displayLabel);
-        }
-        
-        QList<QContactPhoneNumber> numbers =
-                match.details<QContactPhoneNumber> ();
-        count = numbers.count();
-     
+        delete mBccAddressList.at(i);
     }
-    
-    return count;
+    mBccAddressList.clear();
 }
 
 // EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerheadercontainer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -24,9 +24,9 @@
 
 // USER INCLUDES
 #include "univieweraddresscontainer.h"
-#include "univiewerattachmentcontainer.h"
 #include "univiewerdetailswidget.h"
 #include "univiewerfeeder.h"
+#include "univiewerattachmentwidget.h"
 
 #include "nativemessageconsts.h"
 
@@ -36,42 +36,62 @@
 // LOCAL CONSTANTS
 const QString ADDR_LIST_SEPARATOR(", ");
 const QString BG_FRAME_GRAPHICS("qtg_fr_form_heading");
+const QString DIVIDER_FRAME("qtg_graf_divider_h_thin");
 
 //---------------------------------------------------------------
 // UniViewerHeaderContainer :: UniViewerHeaderContainer
 // @see header file
 //---------------------------------------------------------------
 UniViewerHeaderContainer::UniViewerHeaderContainer(UniViewerFeeder* feeder, QGraphicsItem *parent) :
-    HbWidget(parent), mViewFeeder(feeder), mViewerDetails(0), mHeaderGroupBox(0),
-        mAddressContainer(0), mAttachmentContainer(0)
+    HbWidget(parent), mViewFeeder(feeder), mViewerDetails(0), mHeaderGroupBox(0), mSeparator(0),
+        mAddressContainer(0)
 {
-    HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this);
-    this->setBackgroundItem(bgItem);
+    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 
-    QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
-    mainLayout->setSpacing(0);
-    mainLayout->setContentsMargins(0, 0, 0, 0);
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
+    mMainLayout->setSpacing(0);
+    mMainLayout->setContentsMargins(0, 0, 0, 0);
 
     // Address Group box
     mHeaderGroupBox = new HbGroupBox(this);
+    connect(mHeaderGroupBox, SIGNAL(toggled(bool)), this, SLOT(addressBoxToggled(bool)));
 
     // Address container
-    mAddressContainer = new UniViewerAddressContainer(mHeaderGroupBox);
+    mAddressContainer = new UniViewerAddressContainer(this);
+    connect(mAddressContainer,SIGNAL(sendMessage(const QString&,const QString&)),
+            this, SIGNAL(sendMessage(const QString&,const QString&)));
 
     mHeaderGroupBox->setContentWidget(mAddressContainer);
 
+    // Separator
+    mSeparator = new HbFrameItem(DIVIDER_FRAME, HbFrameDrawer::OnePiece, this);
+    mSeparator->setMinimumHeight(2.0);
+    mSeparator->frameDrawer().fillWholeRect();
+    mSeparator->hide();
+
     // Viewer Details widget
     mViewerDetails = new UniViewerDetailsWidget(this);
 
-    // Attachment Container
-    mAttachmentContainer = new UniViewerAttachmentContainer(this);
+    // This widget is created to apply background for header & details.
+    HbWidget *headerContainer = new HbWidget(this);
+
+    QGraphicsLinearLayout *headerLayout = new QGraphicsLinearLayout(Qt::Vertical, headerContainer);
+    headerLayout->setSpacing(0);
+    headerLayout->setContentsMargins(0, 0, 0, 0);
+
+    HbFrameItem *bgItem = new HbFrameItem(BG_FRAME_GRAPHICS, HbFrameDrawer::NinePieces, this);
+    headerContainer->setBackgroundItem(bgItem, -2.0);
 
     //Add address group box and insert into layout
-    mainLayout->addItem(mHeaderGroupBox);
-    mainLayout->addItem(mViewerDetails);
-    mainLayout->addItem(mAttachmentContainer);
+    headerLayout->addItem(mHeaderGroupBox);
+    headerLayout->addItem(mSeparator);
+    headerLayout->addItem(mViewerDetails);
 
-    this->setLayout(mainLayout);
+    headerContainer->setLayout(headerLayout);
+
+    mMainLayout->addItem(headerContainer);
+
+    this->setLayout(mMainLayout);
 }
 
 //---------------------------------------------------------------
@@ -109,9 +129,11 @@
     // Expand address group box for outgoing messages.
     if (mViewFeeder->isIncoming()) {
         mHeaderGroupBox->setCollapsed(true);
+        addressBoxToggled(true);
     }
     else {
         mHeaderGroupBox->setCollapsed(false);
+        addressBoxToggled(false);
     }
 }
 
@@ -124,12 +146,17 @@
     if (mViewerDetails) {
         mViewerDetails->clearContent();
     }
-    if (mAddressContainer) {
-        mAddressContainer->clearContent();
+
+    // Clear the attachments.
+    for (int i = 0; i < mUniViewerAttachmentstList.count(); ++i) {
+        mMainLayout->removeItem(mUniViewerAttachmentstList[i]);
+        mUniViewerAttachmentstList[i]->setParent(NULL);
+        delete mUniViewerAttachmentstList[i];
+        mUniViewerAttachmentstList[i] = NULL;
     }
-    if (mAttachmentContainer) {
-        mAttachmentContainer->clearContent();
-    }
+    mUniViewerAttachmentstList.clear();
+
+    resize(rect().width(), -1);
 }
 
 //---------------------------------------------------------------
@@ -165,8 +192,11 @@
     UniMessageInfoList attachList = mViewFeeder->attachmentsList();
     for (int a = 0; a < attachList.count(); ++a) {
         UniMessageInfo* info = attachList.at(a);
-        mAttachmentContainer->addAttachmentWidget(info->mimetype(), info->path());
+        UniViewerAttachmentWidget *attachmentWidget = new UniViewerAttachmentWidget(this);
+        mUniViewerAttachmentstList.append(attachmentWidget);
+        attachmentWidget->populate(info);
         delete info;
+        mMainLayout->addItem(attachmentWidget);
     }
 }
 
@@ -184,20 +214,26 @@
     if (mViewFeeder->isIncoming()) {
         mAddressContainer->setFromField(from, alias);
     }
-    // TO field is added ONLY for outgoing messages.
-    else if (!toList.isEmpty()) {
+    // For outgoing SMS messages add TO field.
+    else if (mViewFeeder->msgType() == KSenduiMtmSmsUidValue && !toList.isEmpty()) {
         mAddressContainer->setToField(toList);
     }
 
-    // CC field is added ONLY for MMS messages.
+    // For MMS messages add TO, CC, BCC fields irrespective of incoming/outgoing.
     if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) {
+        if (!toList.isEmpty()) {
+            mAddressContainer->setToField(toList);
+        }
         ConvergedMessageAddressList ccList = mViewFeeder->ccAddressList();
         if (!ccList.isEmpty()) {
             mAddressContainer->setCcField(ccList);
         }
+        ConvergedMessageAddressList bccList = mViewFeeder->bccAddressList();
+        if (!bccList.isEmpty()) {
+            mAddressContainer->setBccField(bccList);
+        }
     }
 
-    mAddressContainer->insertDivider();
 }
 //---------------------------------------------------------------
 // UniViewerHeaderContainer :: setAddrGroupBoxHeading
@@ -237,3 +273,14 @@
     address.chop(ADDR_LIST_SEPARATOR.size());
     return address;
 }
+
+//---------------------------------------------------------------
+// UniViewerHeaderContainer :: addressBoxToggled
+// @see header file
+//---------------------------------------------------------------
+void UniViewerHeaderContainer::addressBoxToggled(bool state)
+{
+    (state) ? mSeparator->hide() : mSeparator->show();
+}
+
+// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewermediawidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * 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:
- *
- */
-
-#include "univiewermediawidget.h"
-
-// SYSTEM INCLUDES
-#include <HbIconItem>
-#include <HbTextItem>
-#include <HbPushButton>
-#include <HbFrameDrawer>
-
-// USER INCLUDES
-#include "debugtraces.h"
-
-// LOCAL CONSTANTS
-
-//----------------------------------------------------------------------------
-// UniViewerMediaWidget::UniViewerMediaWidget
-// @see header file
-//----------------------------------------------------------------------------
-UniViewerMediaWidget::UniViewerMediaWidget(QGraphicsItem *parent):
-        HbWidget(parent), mMediaIcon(0), mName(0), mInfo(0), mFrameItem(0)
-{
-    init();
-}
-
-//----------------------------------------------------------------------------
-// UniViewerMediaWidget::~UniViewerMediaWidget
-// @see header file
-//----------------------------------------------------------------------------
-UniViewerMediaWidget::~UniViewerMediaWidget()
-{
-}
-
-//----------------------------------------------------------------------------
-// UniViewerMediaWidget::init
-// @see header file
-//----------------------------------------------------------------------------
-void UniViewerMediaWidget::init()
-{
-    mMediaIcon = new HbIconItem(this);
-    HbStyle::setItemName(mMediaIcon, "mediaIcon");
-
-    mName = new HbTextItem(this);
-    HbStyle::setItemName(mName, "text-1");
-
-    mInfo = new HbTextItem(this);
-    HbStyle::setItemName(mInfo, "text-2");
-
-    mFrameItem = new HbPushButton(this);
-    HbStyle::setItemName(mFrameItem, "bgFrame");
-
-    connect(mFrameItem, SIGNAL(clicked(bool)), this, SIGNAL(clicked()));
-}
-
-//----------------------------------------------------------------------------
-// UniViewerMediaWidget::populate
-// @see header file
-//----------------------------------------------------------------------------
-void UniViewerMediaWidget::populate(const QString &icon, const QString &name,
-                                    const QString &info, const QString &bgFrame)
-{
-    HbFrameDrawer *fd = new HbFrameDrawer(bgFrame,
-                                          HbFrameDrawer::NinePieces);
-    mFrameItem->setFrameBackground(fd);
-
-    mMediaIcon->setIconName(icon);
-    mName->setText(name);
-    mInfo->setText(info);
-
-}
-
-//----------------------------------------------------------------------------
-// UniViewerMediaWidget::clearContent
-// @see header file
-//----------------------------------------------------------------------------
-void UniViewerMediaWidget::clearContent()
-{
-    mMediaIcon->setIconName("");
-    mName->setText("");
-    mInfo->setText("");
-}
-
-// EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerpixmapwidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,223 @@
+/*
+ * 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: This widget displays the pixmap content in viewer.
+ *
+ */
+
+#include "univiewerpixmapwidget.h"
+
+// SYSTEM INCLUDES
+#include <HbTapGesture>
+#include <HbWidget>
+#include <HbInstantFeedback>
+#include <HbMenu>
+#include <QPixmap>
+#include <QTimer>
+#include <thumbnailmanager_qt.h>
+
+// USER INCLUDES
+#include "univiewerutils.h"
+#include "unidatamodelplugininterface.h"
+
+// LOCAL CONSTANTS
+#define LOC_OPEN    hbTrId("txt_common_menu_open")
+#define LOC_SAVE    hbTrId("txt_common_menu_save")
+
+const QString PIXMAP_ICON("qtg_small_image");
+const QString CORRUPTED_PIXMAP_ICON("qtg_large_corrupted");
+const QString VIDEO_MIMETYPE("video");
+const QString MSG_VIDEO_ICON("qtg_small_video");
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::UniViewerPixmapWidget
+// @see header file
+//---------------------------------------------------------------
+UniViewerPixmapWidget::UniViewerPixmapWidget(QGraphicsItem *parent) :
+    HbIconItem(parent), mViewerUtils(0), mThumbnailManager(0)
+{
+    this->grabGesture(Qt::TapGesture);
+    init();
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::init
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::init() 
+{
+    mThumbnailManager = new ThumbnailManager(this);
+    mThumbnailManager->setMode(ThumbnailManager::Default);
+    mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForQuality);
+    mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
+
+    connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this,
+    SLOT(thumbnailReady(QPixmap, void*, int, int)));
+
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::~UniViewerPixmapWidget
+// @see header file
+//---------------------------------------------------------------
+UniViewerPixmapWidget::~UniViewerPixmapWidget()
+{
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::setPixmap
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::populate(UniMessageInfo *info)
+{
+    mMimeType = info->mimetype();
+    mPixmapPath = info->path();
+    if (mMimeType.contains(VIDEO_MIMETYPE)) {
+        this->setIcon(MSG_VIDEO_ICON);
+        mThumbnailManager->getThumbnail(mPixmapPath);
+        this->ungrabGesture(Qt::TapGesture);
+    }
+    else if (info->isProtected()) {
+        this->setIconName(PIXMAP_ICON);
+    }
+    else if (info->isCorrupted()) {
+        this->setIconName(CORRUPTED_PIXMAP_ICON);
+    }
+    else {
+        QPixmap pixmap(mPixmapPath);
+        this->setIcon(HbIcon(pixmap));
+    }
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::gestureEvent
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::gestureEvent(QGestureEvent *event)
+{
+    HbTapGesture *tapGesture = qobject_cast<HbTapGesture*> (event->gesture(Qt::TapGesture));
+    if (tapGesture) {
+        switch (tapGesture->state()) {
+        case Qt::GestureStarted:
+        {
+            // Trigger haptic feedback.
+            HbInstantFeedback::play(HbFeedback::Basic);
+            break;
+        }
+        case Qt::GestureUpdated:
+        {
+            if (HbTapGesture::TapAndHold == tapGesture->tapStyleHint()) {
+                // Handle longtap.
+                handleLongTap(tapGesture->scenePosition());
+            }
+            break;
+        }
+        case Qt::GestureFinished:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            if (HbTapGesture::Tap == tapGesture->tapStyleHint()) {
+                // Handle short tap
+                handleShortTap();
+            }
+            break;
+        }
+        case Qt::GestureCanceled:
+        {
+            HbInstantFeedback::play(HbFeedback::Basic);
+            break;
+        }
+        }
+    }
+    else {
+        HbIconItem::gestureEvent(event);
+    }
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::handleOpen
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::handleOpen()
+{
+    this->ungrabGesture(Qt::TapGesture);
+
+    if (!mViewerUtils) {
+        mViewerUtils = new UniViewerUtils(this);
+    }
+    mViewerUtils->launchContentViewer(mMimeType, mPixmapPath);
+
+    //fire timer to regrab gesture after some delay.
+    QTimer::singleShot(300,this,SLOT(regrabGesture()));
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::handleSave
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::handleSave()
+{
+}
+
+//----------------------------------------------------------------------------
+// UniViewerPixmapWidget::handleShortTap
+// @see header file
+//----------------------------------------------------------------------------
+void UniViewerPixmapWidget::handleShortTap()
+{
+    emit shortTap(mPixmapPath);
+
+    // Open the media.
+    handleOpen();
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::handleLongTap
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::handleLongTap(const QPointF &position)
+{
+    emit longTap(position);
+
+    HbMenu* menu = new HbMenu;
+    menu->setAttribute(Qt::WA_DeleteOnClose);
+    menu->addAction(LOC_OPEN, this, SLOT(handleOpen()));
+    menu->addAction(LOC_SAVE, this, SLOT(handleSave()));
+    menu->setPreferredPos(position);
+    menu->show();
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::regrabGesture
+// @see header file
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::regrabGesture()
+{
+    this->grabGesture(Qt::TapGesture);
+}
+
+//---------------------------------------------------------------
+// UniViewerPixmapWidget::thumbnailReady
+// @see header
+//---------------------------------------------------------------
+void UniViewerPixmapWidget::thumbnailReady(const QPixmap& pixmap, void *data, int id, int error)
+{
+    Q_UNUSED(data)
+    Q_UNUSED(id)
+    this->grabGesture(Qt::TapGesture);
+    if (!error) {
+        this->setIcon(HbIcon(pixmap));
+        this->hide();
+        this->updateGeometry();
+    }
+}
+// EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewertextitem.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,30 +18,32 @@
  */
 
 #include "univiewertextitem.h"
+#include "msgcontacthandler.h"
 
 #include <QRegExp>
-#include <QGraphicsSceneMouseEvent>
 #include <QApplication>
 #include <QClipboard>
 #include <QTextBlock>
-
+#include <QUrl>
+#include <QDesktopServices>
+#include <HbTapGesture>
 #include <HbMenu>
 #include <HbAction>
 #include <cntservicescontact.h>
-#include <qtcontacts.h>
-#include <XQServiceRequest.h>
+#include <xqservicerequest.h>
 #include <xqaiwrequest.h>
+#include <xqappmgr.h>
 
-QTM_USE_NAMESPACE
 
 //consts
 
 //regexp
-const QString NUMBER_PATTERN("(\\(|\\+|\\d)((?:\\d{2,})((?:[\\s-/.\\)\\()])*(?:(\\d+|\\))))*)|((\\*#)(?:\\d+(\\*|#)(?:\\d+#)?))");
+const QString NUMBER_PATTERN("(\\(?(\\+|\\d))((?:\\d)((?:[\\s-/.\\)\\(])*(?:(\\d+|\\))))*(?:\\d|\\)))|((\\*#)(?:\\d+(\\*|#)(?:\\d+#)?))");
 
 const QString EMAIL_PATTERN("[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?");
 
-const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&amp;%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&amp;%\\$#_=~]*))+");
+const QString URL_PATTERN("(((ht|f|rt)(tp|sp)(s?)\\:\\/\\/)|(www|wap)(?:\\.))(([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\\,\'\\/\\\\+&amp;%\\$#_=~]*)(\\.)([-\\w]*[0-9a-zA-Z])+(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\?\'\\/\\\\+&amp;%\\$#_=~]*))+");
+
 
 //rules
 const QString NUMBER_RULE("NUMBER_RULE");
@@ -65,7 +67,11 @@
 mCursorPos(-1)
 {
     this->setReadOnly(true);
+    this->setScrollable(false);
     this->setCursorVisibility(Hb::TextCursorHidden);
+    this->setFlag(QGraphicsItem::ItemIsFocusable,false);
+    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+    this->setBackgroundItem(0);   
 
     //inserting rules and patterns to map.
     mRules.insert(NUMBER_RULE,NUMBER_PATTERN);
@@ -112,6 +118,7 @@
         QString ruleName = i.key();
         QString rule = i.value();
         QRegExp ruleExp(rule);
+        ruleExp.setCaseSensitivity(Qt::CaseInsensitive);
 
         QTextCursor cursor = this->document()->find(ruleExp);
 
@@ -172,30 +179,65 @@
     
 }
 
-
-void UniViewerTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+void UniViewerTextItem::gestureEvent(QGestureEvent* event)
 {
-    HbTextEdit::mouseReleaseEvent(event);
-
-    highlightText(false);
-
-    QString anchor = this->anchorAt(event->pos());
-
-    if(!anchor.isEmpty() && !this->textCursor().hasSelection())
+    //handle gesture to highlight and dehighlight find item.
+    
+    if(HbTapGesture *tap = qobject_cast<HbTapGesture*>(event->gesture(Qt::TapGesture)))
     {
-        shortTapAction(anchor);
+        //capturing gesture position, and map to local co-ordinates.
+        QPointF pos = mapFromScene(tap->scenePosition());
+        
+        switch (tap->state()) 
+        {
+            case Qt::GestureStarted:
+            {
+                //highlight find item.
+                QTextDocument* doc = this->document();
+                mCursorPos = doc->documentLayout()->hitTest(pos, Qt::ExactHit);
+                highlightText(true);
+                break;
+            }  
+            
+            case Qt::GestureFinished:
+            {
+                if (HbTapGesture::Tap == tap->tapStyleHint()) 
+                {
+                    //gesture is finshed dehighlight text.
+                    highlightText(false);
+                    
+                    QString anchor = this->anchorAt(pos);
+                    
+                    //do short tap action.
+                    if (!anchor.isEmpty() && !this->textCursor().hasSelection())
+                    {
+                        shortTapAction(anchor);
+                    }
+                }
+                break;
+            }
+            
+            case Qt::GestureCanceled:
+            {
+                //gesture is canceled due to pan or swipe, dehighlight text.
+                if (HbTapGesture::Tap == tap->tapStyleHint()) 
+                {
+                highlightText(false);
+                break;
+                }
+            }
+            default:
+                break;
+        }
+        event->accept();
     }
-}
-
-void UniViewerTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
-{
-    HbTextEdit::mousePressEvent(event);
-
-    QTextDocument* doc = this->document();
-
-    mCursorPos = doc->documentLayout()->hitTest(event->pos(), Qt::ExactHit);
-
-    highlightText(true);
+    else
+    {
+        event->ignore();
+    }
+    
+    //passing gesture event to base class.
+    HbTextEdit::gestureEvent(event);
 }
 
 void UniViewerTextItem::addNumberMenu(HbMenu* contextMenu,const QString& data)
@@ -303,7 +345,7 @@
         phoneNumber.remove(NUMBER_RULE);
         
         //invoke dialer service and pass phoneNumber.        
-        QString serviceName("com.nokia.services.telephony");
+        QString serviceName("com.nokia.symbian.ICallDial");
         QString operation("dial(QString)");
         
         XQServiceRequest* serviceRequest = new XQServiceRequest(serviceName,operation,false);
@@ -343,10 +385,10 @@
         emailId.remove(EMAIL_RULE);
 
         // Launch email editor
-        QString serviceName("com.nokia.services.commonemail");
-        QString interfaceName("imessage.send");
+        QString interfaceName("com.nokia.symbian.IEmailMessageSend");
         QString operation("send(QVariant)");
-        XQAiwRequest* request = mAppManager.create(serviceName, interfaceName, 
+        XQApplicationManager appManager;
+        XQAiwRequest* request = appManager.create(interfaceName, 
 			operation, true); 
         if ( request == NULL )
             {
@@ -384,6 +426,8 @@
         QString url = action->data().toString();
         url.remove(URL_RULE);
         //invoke browser service  & pass url.
+        QUrl uri(url);
+        QDesktopServices::openUrl(uri);
     }
 }
 
@@ -414,9 +458,10 @@
         {
             data.remove(NUMBER_RULE);
     
-            int contactId = resolveContactId(data, 
-                                             QContactPhoneNumber::DefinitionName,
-                                             QContactPhoneNumber::FieldNumber);
+            int contactId = MsgContactHandler::resolveContactDisplayName(
+                                         data, 
+                                         QContactPhoneNumber::DefinitionName,
+                                         QContactPhoneNumber::FieldNumber);
     
             if(contactId > 0)
                 {
@@ -439,9 +484,10 @@
         {
             data.remove(EMAIL_RULE);
     
-            int contactId = resolveContactId(data,
-                                             QContactEmailAddress::DefinitionName,
-                                             QContactEmailAddress::FieldEmailAddress);
+            int contactId = MsgContactHandler::resolveContactDisplayName(
+                    data,
+                    QContactEmailAddress::DefinitionName,
+                    QContactEmailAddress::FieldEmailAddress);
             
             if(contactId > 0)
                 {
@@ -466,7 +512,8 @@
         QString serviceName("com.nokia.services.phonebookservices");
      
         XQAiwRequest* request;
-        request = mAppManager.create(serviceName, "Fetch", operation, true); // embedded
+        XQApplicationManager appManager;
+        request = appManager.create(serviceName, "Fetch", operation, true); // embedded
         if ( request == NULL )
             {
             return;       
@@ -502,33 +549,6 @@
         }
     }
 
-int UniViewerTextItem::resolveContactId(const QString& value,
-                                        const QString& fieldName,
-                                        const QString& fieldType)
-    {
-    int contactId = -1;
-    
-    QContactManager phonebookManager("symbian");
-    
-    QContactDetailFilter phoneFilter;
-    phoneFilter.setDetailDefinitionName(fieldName, fieldType);
-    phoneFilter.setValue(value);
-    phoneFilter.setMatchFlags(QContactFilter::MatchEndsWith);
-
-    QList<QContactSortOrder> sortOrder;
-    QList<QContact> matchingContacts = phonebookManager.contacts(
-            phoneFilter,
-            sortOrder,
-            QStringList());
-
-    if ( matchingContacts.count() > 0 ) 
-        {       
-        contactId = matchingContacts.at(0).localId();;   
-        }
-    
-    return contactId;
-    }
-
 void UniViewerTextItem::menuClosed()
 {
     highlightText(false);
@@ -565,6 +585,7 @@
             }
 
             cursor.clearSelection();
+            break;
         }
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgui/unifiedviewer/src/univiewerutils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,145 @@
+/*
+ * 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: Utility class for univiewer.
+ *
+ */
+
+#include "univiewerutils.h"
+
+// SYSTEM INCLUDES
+#include <xqaiwrequest.h>
+#include <xqrequestinfo.h>
+#include <xqappmgr.h>
+#include <hbglobal.h>
+
+// USER INCLUDES
+#include "msgcontactsutil.h"
+
+// LOCAL CONSTANTS
+#define LOC_TITLE   hbTrId("txt_messaging_title_messaging")
+
+const QString IMAGE_MIMETYPE("image");
+const QString AUDIO_MIMETYPE("audio");
+const QString VCARD_MIMETYPE("text/X-vCard");
+const QString VIDEO_MIMETYPE("video");
+
+//---------------------------------------------------------------
+// UniViewerUtils::UniViewerUtils
+// @see header file
+//---------------------------------------------------------------
+UniViewerUtils::UniViewerUtils(QObject *parent) :
+    QObject(parent)
+{
+}
+
+//---------------------------------------------------------------
+// UniViewerUtils::~UniViewerUtils
+// @see header file
+//---------------------------------------------------------------
+UniViewerUtils::~UniViewerUtils()
+{
+}
+
+//---------------------------------------------------------------
+// UniViewerUtils::addAttachmentWidget
+// @see header file
+//---------------------------------------------------------------
+void UniViewerUtils::launchContentViewer(const QString &mimeType, const QString &filePath)
+{
+    if (mimeType.contains(IMAGE_MIMETYPE) || mimeType.contains(AUDIO_MIMETYPE) || 
+        mimeType.contains(VIDEO_MIMETYPE)) {
+        launchViaSharableFile(filePath);
+    }
+    else if (mimeType.contains(VCARD_MIMETYPE, Qt::CaseInsensitive)) {
+        MsgContactsUtil::launchVCardViewer(filePath);
+    }
+}
+
+//---------------------------------------------------------------
+// UniViewerUtils::handleOk
+// @see header file
+//---------------------------------------------------------------
+void UniViewerUtils::handleOk(const QVariant& result)
+{
+    emit requestOk(result);
+}
+
+//---------------------------------------------------------------
+// UniViewerUtils::handleError
+// @see header file
+//---------------------------------------------------------------
+void UniViewerUtils::handleError(int errorCode, const QString& errorMessage)
+{
+    emit requestError(errorCode, errorMessage);
+}
+
+//---------------------------------------------------------------
+// UniViewerUtils::launchViaSharableFile
+// @see header file
+//---------------------------------------------------------------
+void UniViewerUtils::launchViaSharableFile(const QString &filePath)
+{
+    XQSharableFile sf;
+    XQAiwRequest* request = 0;
+
+    if (!sf.open(filePath)) {
+        return;
+    }
+
+    // Get handlers
+    XQApplicationManager appManager;
+    QList<XQAiwInterfaceDescriptor> fileHandlers = appManager.list(sf);
+    if (fileHandlers.count() > 0) {
+        XQAiwInterfaceDescriptor d = fileHandlers.first();
+        request = appManager.create(sf, d);
+
+        if (!request) {
+            sf.close();
+            return;
+        }
+    }
+    else {
+        sf.close();
+        return;
+    }
+
+    // Result handlers
+    connect(request, SIGNAL(requestOk(const QVariant&)), this, SLOT(handleOk(const QVariant&)),
+        Qt::UniqueConnection);
+    connect(request, SIGNAL(requestError(int,const QString&)), this,
+        SLOT(handleError(int,const QString&)), Qt::UniqueConnection);
+
+    request->setEmbedded(true);
+    request->setSynchronous(true);
+
+    // Fill args
+    QList<QVariant> args;
+    args << qVariantFromValue(sf);
+    request->setArguments(args);
+
+    // Fill headers
+    QString key("WindowTitle");
+    QVariant value(QString(LOC_TITLE));
+    XQRequestInfo info;
+    info.setInfo(key, value);
+    request->setInfo(info);
+
+    request->send();
+
+    // Cleanup
+    sf.close();
+    delete request;
+}
+
+//EOF
--- a/messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/src/univiewslidewidget.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -38,7 +38,7 @@
         mHeaderContainer(0)
 
 {
-    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+    mMainLayout = new QGraphicsLinearLayout(Qt::Vertical, this);
     mMainLayout->setSpacing(0);
     mMainLayout->setContentsMargins(0, 0, 0, 0);
 
@@ -53,7 +53,12 @@
         mHeaderContainer = new UniViewerHeaderContainer(mViewFeeder, this);
 
         // Always connect to populate sms content
-        connect(mViewFeeder, SIGNAL(msgBody(QString)), mBody, SLOT(setTextContent(QString)));
+        connect(mViewFeeder, SIGNAL(msgBody(QString)), mBody, SLOT(setText(QString)));
+        
+        connect(mHeaderContainer,SIGNAL(sendMessage(const QString&,const QString&)),
+                this, SIGNAL(sendMessage(const QString&,const QString&)));
+        
+        
 
         mMainLayout->addItem(mHeaderContainer);
     }
@@ -100,8 +105,7 @@
     if (mViewFeeder->msgType() == KSenduiMtmMmsUidValue) {
         QString slideString;
         if (mViewFeeder->slideCount() > 1) {
-            slideString = QString(LOC_SLIDE_COUNTER).arg(mSlideNumber + 1).arg(
-                mViewFeeder->slideCount());
+            slideString = (LOC_SLIDE_COUNTER).arg(mSlideNumber + 1).arg(mViewFeeder->slideCount());
         }
         mBody->setSlideContents(mViewFeeder->slideContent(mSlideNumber), slideString);
     }
--- a/messagingapp/msgui/unifiedviewer/unifiedviewer.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,6 @@
 INCLUDEPATH += ../appengine/inc
 INCLUDEPATH += ../msguiutils/inc
 INCLUDEPATH += . ../../msgutils/unieditorutils/editorgenutils/inc
-INCLUDEPATH += . ../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 #QMAKE_CXXFLAGS.ARMCC -= --no_hide_all
@@ -39,7 +38,7 @@
 TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
 
 CONFIG += hb
-QT += sql
+HB += hbfeedback
 
 # Platforms
 SYMBIAN_PLATFORMS = WINSCW ARMV5
@@ -49,48 +48,55 @@
      "$${LITERAL_HASH}include <platform_paths.hrh>" \
      "rom/unifiedviewer.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(unifiedviewer.iby)"
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/unifiedviewer.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/unifiedviewer.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 # Input
 HEADERS += inc/unifiedviewer.h \
            inc/unicontentswidget.h \
-           inc/unitexteditor.h \
-#           inc/unihighlighter.h \
            inc/univiewerfeeder.h \
            inc/univiewerfeeder_p.h \
            inc/univiewslidewidget.h \
            inc/uniscrollarea.h \
            ../inc/msgbaseview.h \
+           inc/univiewerutils.h \
            inc/univiewerbodywidget.h \
            inc/univiewerdetailswidget.h \
            inc/univieweraddresswidget.h \
            inc/univieweraddresscontainer.h \
-           inc/univiewermediawidget.h \
-           inc/univiewerattachmentcontainer.h \
+           inc/univiewerattachmentwidget.h \
            inc/univiewertextitem.h \
-           inc/univiewerheadercontainer.h
+           inc/univiewerheadercontainer.h \
+           inc/univiewerpixmapwidget.h \
+           inc/univieweraudiowidget.h
 
 SOURCES += src/unifiedviewer.cpp \
            src/unicontentswidget.cpp \
-           src/unitexteditor.cpp \
-#           src/unihighlighter.cpp \
            src/univiewerfeeder.cpp \
            src/univiewerfeeder_p.cpp \
            src/univiewslidewidget.cpp \
            src/uniscrollarea.cpp \
+           src/univiewerutils.cpp \
            src/univiewerbodywidget.cpp \
            src/univiewerdetailswidget.cpp \
            src/univieweraddresswidget.cpp \
            src/univieweraddresscontainer.cpp \
-           src/univiewermediawidget.cpp \
-           src/univiewerattachmentcontainer.cpp \
+           src/univiewerattachmentwidget.cpp \
            src/univiewertextitem.cpp \
-           src/univiewerheadercontainer.cpp
-
+           src/univiewerheadercontainer.cpp \
+           src/univiewerpixmapwidget.cpp \
+           src/univieweraudiowidget.cpp
 
 RESOURCES += unifiedviewer.qrc
 
 # Libs
-LIBS = -ls60qconversions \
-       -letext \
+LIBS = -letext \
        -lmsgs \
        -lconvergedmessageutils \
        -lappengine \
@@ -99,4 +105,5 @@
        -lQtContacts \
        -lmsguiutils \
        -lcentralrepository \
+       -lthumbnailmanagerqt \
        -lxqserviceutil
--- a/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgui/unifiedviewer/unifiedviewer.qrc	Fri Jun 25 15:47:40 2010 +0530
@@ -1,15 +1,13 @@
 <RCC>
     <qresource prefix="/layouts">
-        <file alias="univieweraddresswidget.css">resources/layouts/univieweraddresswidget.css</file>
-        <file alias="univieweraddresswidget.widgetml">resources/layouts/univieweraddresswidget.widgetml</file>
         <file alias="univiewerbodywidget.css">resources/layouts/univiewerbodywidget.css</file>
         <file alias="univiewerbodywidget_color.css">resources/layouts/univiewerbodywidget_color.css</file>
         <file alias="univiewerbodywidget.widgetml">resources/layouts/univiewerbodywidget.widgetml</file>
         <file alias="univiewerdetailswidget.css">resources/layouts/univiewerdetailswidget.css</file>
         <file alias="univiewerdetailswidget_color.css">resources/layouts/univiewerdetailswidget_color.css</file>
         <file alias="univiewerdetailswidget.widgetml">resources/layouts/univiewerdetailswidget.widgetml</file>
-        <file alias="univiewermediawidget.css">resources/layouts/univiewermediawidget.css</file>
-        <file alias="univiewermediawidget_color.css">resources/layouts/univiewermediawidget_color.css</file>
-        <file alias="univiewermediawidget.widgetml">resources/layouts/univiewermediawidget.widgetml</file>
+        <file alias="univiewerattachmentwidget.css">resources/layouts/univiewerattachmentwidget.css</file>
+        <file alias="univiewerattachmentwidget_color.css">resources/layouts/univiewerattachmentwidget_color.css</file>
+        <file alias="univiewerattachmentwidget.widgetml">resources/layouts/univiewerattachmentwidget.widgetml</file>
     </qresource>
 </RCC>
--- a/messagingapp/msgutils/bwins/s60qconversionsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-EXPORTS
-	?qStringToS60Desc@S60QConversions@@SAPAVHBufC16@@ABVQString@@@Z @ 1 NONAME ; class HBufC16 * S60QConversions::qStringToS60Desc(class QString const &)
-	?s60DescToQString@S60QConversions@@SA?AVQString@@ABVTDesC16@@@Z @ 2 NONAME ; class QString S60QConversions::s60DescToQString(class TDesC16 const &)
-	?s60Desc8ToQString@S60QConversions@@SA?AVQString@@ABVTDesC8@@@Z @ 3 NONAME ; class QString S60QConversions::s60Desc8ToQString(class TDesC8 const &)
-	?qStringToS60Desc8@S60QConversions@@SAPAVHBufC8@@ABVQString@@@Z @ 4 NONAME ; class HBufC8 * S60QConversions::qStringToS60Desc8(class QString const &)
-
--- a/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/convergedmessageutils/convergedmessageutils.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -47,6 +47,15 @@
      "$${LITERAL_HASH}include <platform_paths.hrh>" \
      "rom/convergedmessageutils.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(convergedmessageutils.iby)"
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/convergedmessageutils.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/convergedmessageutils.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 symbian {
 	TARGET.UID3 =  0x20024319
 	TARGET.CAPABILITY = CAP_GENERAL_DLL
--- a/messagingapp/msgutils/eabi/s60qconversionsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-EXPORTS
-	_ZN15S60QConversions16qStringToS60DescERK7QString @ 1 NONAME
-	_ZN15S60QConversions16s60DescToQStringERK7TDesC16 @ 2 NONAME
-	_ZN15S60QConversions17qStringToS60Desc8ERK7QString @ 3 NONAME
-	_ZN15S60QConversions17s60Desc8ToQStringERK6TDesC8 @ 4 NONAME
-
--- a/messagingapp/msgutils/msgutils.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/msgutils.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -20,7 +20,6 @@
 
 SYMBIAN_PLATFORMS = WINSCW ARMV5
 
-SUBDIRS += s60qconversions/s60qconversions.pro
 SUBDIRS += convergedmessageutils/convergedmessageutils.pro
 SUBDIRS += unieditorutils/unieditorutils.pro
 SUBDIRS += unidatautils/unidatautils.pro
\ No newline at end of file
--- a/messagingapp/msgutils/s60qconversions/bwins/s60qconversionsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
-EXPORTS
-	?qStringToS60Desc8@S60QConversions@@SAPAVHBufC8@@ABVQString@@@Z @ 1 NONAME ; class HBufC8 * S60QConversions::qStringToS60Desc8(class QString const &)
-	?qStringToS60Desc@S60QConversions@@SAPAVHBufC16@@ABVQString@@@Z @ 2 NONAME ; class HBufC16 * S60QConversions::qStringToS60Desc(class QString const &)
-	?s60Desc8ToQString@S60QConversions@@SA?AVQString@@ABVTDesC8@@@Z @ 3 NONAME ; class QString S60QConversions::s60Desc8ToQString(class TDesC8 const &)
-	?s60DescToQString@S60QConversions@@SA?AVQString@@ABVTDesC16@@@Z @ 4 NONAME ; class QString S60QConversions::s60DescToQString(class TDesC16 const &)
-
--- a/messagingapp/msgutils/s60qconversions/inc/s60qconversiondefines.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
-* 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:  Global DLL defines 
- *
-*/
-
-
-#ifndef S60QCONV_DEFINES_H
-#define S60QCONV_DEFINES_H 
-
-#include <QObject>
-
-#ifdef BUILD_S60QCONV_DLL
-#define S60QCONV_EXPORT Q_DECL_EXPORT
-#else
-#define S60QCONV_EXPORT Q_DECL_IMPORT
-#endif
-
-#endif // S60QCONV_DEFINES_H
--- a/messagingapp/msgutils/s60qconversions/inc/s60qconversions.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef S60QCONVERSIONS
-#define S60QCONVERSIONS
-
-#include <QObject>
-#include <e32base.h>
-#include "s60qconversiondefines.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class S60QCONV_EXPORT S60QConversions
-    {
-    public:
-        static QString s60DescToQString(const TDesC& desc);
-        static HBufC* qStringToS60Desc(const QString& string);
-        static QString s60Desc8ToQString(const TDesC8& desc);
-        static HBufC8* qStringToS60Desc8(const QString& string);
-    };
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // S60QCONVERSIONS
-
-// End of file
-
--- a/messagingapp/msgutils/s60qconversions/rom/s60qconversions.iby	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-/*
-* 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:
-*
-*/
-#ifndef __S60QCONVERSIONS_IBY__
-#define __S60QCONVERSIONS_IBY__
-
-REM DLL
-file=ABI_DIR\UREL\s60qconversions.dll                   SHARED_LIB_DIR\s60qconversions.dll
-
-#endif // __S60QCONVERSIONS_IBY__
--- a/messagingapp/msgutils/s60qconversions/s60qconversions.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# 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:
-#
-
-TEMPLATE = lib
-TARGET = s60qconversions
-DEPENDPATH += . inc src
-INCLUDEPATH += .
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-
-DEFINES += BUILD_S60QCONV_DLL
-#QMAKE_CXXFLAGS.ARMCC -= --no_hide_all
-
-# UID3
-TARGET.UID3 = 0x2001FE7B
-
-# Capability
-TARGET.CAPABILITY = CAP_GENERAL_DLL
-
-TARGET.EPOCALLOWDLLDATA = 1
-
-# Platforms
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-
-# Build.inf rules
-BLD_INF_RULES.prj_exports += \
-     "$${LITERAL_HASH}include <platform_paths.hrh>" \
-     "rom/s60qconversions.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(s60qconversions.iby)"
-
-# Input
-HEADERS += inc/s60qconversions.h
-SOURCES += src/s60qconversions.cpp
-
--- a/messagingapp/msgutils/s60qconversions/src/s60qconversions.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* 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:
-*
-*/
-
-#include "s60qconversions.h"
-#include "utf.h"
-
-/*!
-    \class S60QConversions
-    \brief S60QConversions class offers functions for converting Symbian/Series60 data types to Qt data types and vice versa.
- */    
-
-
-/*!
-    Converts Symbian/Series60 descriptor (string) to QString
-
-    \param desc descriptor to be converted
-    \return QString containing converted string
- */
-QString S60QConversions::s60DescToQString(const TDesC& desc)
-    {
-    return QString::fromUtf16(desc.Ptr(),desc.Length());
-    }
-
-/*!
-    Converts QString to Symbian/Series60 descriptor (string).
-    Note: Ownership of returned descriptor (string) is transferred to caller
-
-    \param string QString to be converted
-    \return pointer to Symbian/Series60 descriptor on success;
-            otherwise returns NULL pointer
- */
-HBufC* S60QConversions::qStringToS60Desc(const QString& string)
-    {
-    TPtrC16 str(reinterpret_cast<const TUint16*>(string.utf16()));
-    return str.Alloc();
-    }
-
-/*!
-    Converts Symbian/Series60 8 bit descriptor (UTF8 string) to QString
-
-    \param desc 8 bit descriptor to be converted
-    \return QString on success; otherwise returns null QString
- */
-QString S60QConversions::s60Desc8ToQString(const TDesC8& desc)
-    {
-    QString qtString;
-    HBufC* s60str = NULL;
-    TRAPD(error, s60str = CnvUtfConverter::ConvertToUnicodeFromUtf8L(desc));
-    if (error == KErrNone) {
-    qtString = QString::fromUtf16(s60str->Ptr(),s60str->Length());
-    delete s60str;
-    }
-    return qtString;
-    }
-
-/*!
-    Converts QString to Symbian/Series60 8 bit descriptor (UTF8 string).
-    Note: Ownership of returned descriptor (string) is transferred to caller
-
-    \param string QString to be converted
-    \return pointer to UTF8 string in Symbian/Series60 descriptor on success;
-            otherwise returns NULL pointer
- */
-HBufC8* S60QConversions::qStringToS60Desc8(const QString& string)
-    {
-    TPtrC16 str(reinterpret_cast<const TUint16*>(string.utf16()));
-    HBufC8* s60str = NULL;
-    TRAPD(error, s60str = CnvUtfConverter::ConvertFromUnicodeToUtf8L(str));
-    if (error != KErrNone) {
-    return NULL;
-    }
-    return s60str;
-    }
-
-// End of file
-
-
--- a/messagingapp/msgutils/s60qconversions/tsrc/ut/bwins/t_s60qconversionsu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-EXPORTS
-	?Tests60DescToQString@TestS60QConversions@@AAEXXZ @ 1 NONAME ; void TestS60QConversions::Tests60DescToQString(void)
-	?TestqStringToS60Desc@TestS60QConversions@@AAEXXZ @ 2 NONAME ; void TestS60QConversions::TestqStringToS60Desc(void)
-	?staticMetaObject@TestS60QConversions@@2UQMetaObject@@B @ 3 NONAME ; struct QMetaObject const TestS60QConversions::staticMetaObject
-	?tr@TestS60QConversions@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString TestS60QConversions::tr(char const *, char const *)
-	?qt_metacall@TestS60QConversions@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 5 NONAME ; int TestS60QConversions::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?getStaticMetaObject@TestS60QConversions@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & TestS60QConversions::getStaticMetaObject(void)
-	?metaObject@TestS60QConversions@@UBEPBUQMetaObject@@XZ @ 7 NONAME ; struct QMetaObject const * TestS60QConversions::metaObject(void) const
-	?qt_metacast@TestS60QConversions@@UAEPAXPBD@Z @ 8 NONAME ; void * TestS60QConversions::qt_metacast(char const *)
-	?initTestCase@TestS60QConversions@@AAEXXZ @ 9 NONAME ; void TestS60QConversions::initTestCase(void)
-	?cleanupTestCase@TestS60QConversions@@AAEXXZ @ 10 NONAME ; void TestS60QConversions::cleanupTestCase(void)
-	?Tests60Desc8ToQString@TestS60QConversions@@AAEXXZ @ 11 NONAME ; void TestS60QConversions::Tests60Desc8ToQString(void)
-	?trUtf8@TestS60QConversions@@SA?AVQString@@PBD0@Z @ 12 NONAME ; class QString TestS60QConversions::trUtf8(char const *, char const *)
-	?TestqStringToS60Desc8@TestS60QConversions@@AAEXXZ @ 13 NONAME ; void TestS60QConversions::TestqStringToS60Desc8(void)
-	?trUtf8@TestS60QConversions@@SA?AVQString@@PBD0H@Z @ 14 NONAME ; class QString TestS60QConversions::trUtf8(char const *, char const *, int)
-	?tr@TestS60QConversions@@SA?AVQString@@PBD0H@Z @ 15 NONAME ; class QString TestS60QConversions::tr(char const *, char const *, int)
-
--- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include <QtTest/QtTest>
-#include <QObject>
-#include <qtestcase.h>
-#include <t_s60qconversions.h>
-
-
-void TestS60QConversions::initTestCase()
-{
-
-    mS60QConversions=0;
-}
-
-
-void TestS60QConversions::Tests60DescToQString()
-{
-    HBufC* temp = HBufC::NewLC(10);
-    temp->Des().Copy(_L("Sometext"));
-        
-    QString text= S60QConversions::s60DescToQString(temp->Des());
-    QVERIFY(text==QString("Sometext"));
-    CleanupStack::PopAndDestroy(temp);
-       
-}
-
-void TestS60QConversions::TestqStringToS60Desc()
-{
-    QString str ="ExampleText"; 
-    HBufC* s60text = S60QConversions::qStringToS60Desc(str);
-    QVERIFY(str==QString("ExampleText"));
-
-}
-
-void TestS60QConversions::Tests60Desc8ToQString()
-{
-    HBufC8* temp = HBufC8::NewLC(10);
-    temp->Des().Copy(_L("Sometext"));
-        
-    QString text= S60QConversions::s60Desc8ToQString(temp->Des() );
-    QVERIFY(text==QString("Sometext"));
-    
-    CleanupStack::PopAndDestroy(temp);
-}
-
-void TestS60QConversions::TestqStringToS60Desc8()
-{
-    QString str ="ExampleText"; 
-    _LIT8(qStr8,"ExampleText");
-    HBufC8* s60text = S60QConversions::qStringToS60Desc8(str);
-    QVERIFY(s60text->Des() == qStr8);
-    
-}
-
-void TestS60QConversions::cleanupTestCase()
-{
-    delete mS60QConversions;
-}
-
-
-
-
--- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
-* Copyright (c) 2008 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:
-*
-*/
-#ifndef T_S60QCONVERSIONS_H
-#define T_S60QCONVERSIONS_H
-
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-
-#include <QObject>
-#include "s60qconversions.h"
-
-
-class TEST_EXPORT TestS60QConversions: public QObject
-{
-    Q_OBJECT
-
-private slots:
-
-   void initTestCase();
-
-    void Tests60DescToQString();
-
-	void TestqStringToS60Desc();
-
-	void Tests60Desc8ToQString();
-
-	void TestqStringToS60Desc8();
-
-	void cleanupTestCase();
-
-
-private:
-
-    S60QConversions* mS60QConversions;
-};
-
-#endif //TEST_S60QCONVERSIONS_H
--- a/messagingapp/msgutils/s60qconversions/tsrc/ut/ut_s60qconversions/t_s60qconversions.pro	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-#
-# 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:
-#
-QT += testlib
-
-TEMPLATE = lib
-TARGET = 
-
-
-INCLUDEPATH += . 
-
-INCLUDEPATH += ../../../../../inc
-INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += ../../../inc
-
-
-
-DEFINES += BUILD_TEST_DLL 
-HEADERS += \
-					t_s60qconversions.h   
-
-SOURCES += \
-					 t_s60qconversions.cpp      
-
-SYMBIAN_PLATFORMS = WINSCW ARMV5
-symbian {
-    TARGET.CAPABILITY = CAP_GENERAL_DLL
-    TARGET.EPOCSTACKSIZE = 0x8000
-    TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
-    TARGET.EPOCALLOWDLLDATA = 1
-		}
-LIBS+= -ls60qconversions
-
--- a/messagingapp/msgutils/unidatautils/unidatamodel/inc/UniDataModel.inl	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/inc/UniDataModel.inl	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,6 @@
 *
 */
 
-#include "debugtraces.h"
 
 
 // ---------------------------------------------------------
--- a/messagingapp/msgutils/unidatautils/unidatamodel/inc/UniSmilModel.inl	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/inc/UniSmilModel.inl	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,6 @@
 *
 */
 
-#include "debugtraces.h"
 
 // ---------------------------------------------------------
 // CUniSmilModel::Layout
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataModel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataModel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -21,7 +21,6 @@
 
 // ========== INCLUDE FILES ================================
 
-#include "debugtraces.h"
 
 #include <eikenv.h>
 #include <eikdoc.h>
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniDataUtils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -36,7 +36,7 @@
 #include <StringLoader.h>           // for StringLoader (load and foramt strings from resources)
 #include <CommonContentPolicy.h>
 
-#include <UniDataModel.rsg>           // Viewer/Editor Mimetype strings
+#include <unidatamodel.rsg>           // Viewer/Editor Mimetype strings
 
 #include "UniModelConst.h"
 #include "UniDataUtils.h"
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniObjectList.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -323,7 +323,7 @@
     TUriParser8 parser;
 	if( !url8bit )
         {
-		return;
+		return NULL;
 		}
 
     if( aUrl.MatchF( KContentIdString ) == 0 )
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilModel.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -59,7 +59,7 @@
 
 
 // MsgDataUTILS
-#include <UniDataModel.rsg>         // Viewer/Editor Mimetype strings
+#include <unidatamodel.rsg>         // Viewer/Editor Mimetype strings
 #include "UniModelConst.h"              // Definitions and enums
 #include "UniDataUtils.h"
 #include "UniSmilSlide.h"
--- a/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/src/UniSmilParams.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,7 @@
 #include <bautils.h>
 #include <data_caging_path_literals.hrh>
 
-#include <UniDataModel.rsg>
+#include <unidatamodel.rsg>
 
 #include "UniSmil.hrh"
 #include "UniSmilParams.h"
--- a/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodel/unidatamodel.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -32,7 +32,6 @@
 INCLUDEPATH += inc
 INCLUDEPATH += ../../../../inc
 INCLUDEPATH += /s60/app/messaging/inc
-INCLUDEPATH += ../s60qconversions/inc
 INCLUDEPATH += ../../unieditorutils/editorgenutils/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
@@ -53,6 +52,15 @@
 MMP_RULES += "TARGETPATH resource"
 MMP_RULES += "RESOURCE UniDataModel.rss"
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/unidatamodel.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/unidatamodel.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 SOURCES += inc/UniDataUtils.inl \
     src/UniDataUtils.cpp \
     inc/UniDataModel.inl \
@@ -116,7 +124,6 @@
     -lcaf \
     -lDrmServerInterfaces \
     -lmsgcommonutils \
-    -ls60qconversions \
     -lQtCore \
     -leditorgenutils
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelloader/unidatamodelloader.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -50,6 +50,15 @@
 
 MMP_RULES += "SOURCEPATH ."
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/unidatamodelloader.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/unidatamodelloader.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 SOURCES += src/unidatamodelloader.cpp
     
 LIBS += -lQtCore
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/rom/unibiomessagedataplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,6 @@
 #define __UNI_BIO_MESSAGE_DATA_PLUGIN_IBY__
 
 
-# this is the plugin stub for QT plugin
 file=ABI_DIR\UREL\unibiomessagedataplugin.dll               SHARED_LIB_DIR\unibiomessagedataplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unibiomessagedataplugin.qtplugin     \resource\qt\plugins\messaging\datamodel\unibiomessagedataplugin.qtplugin
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,7 @@
 //SYSTEM INCLUDES
 #include <mtclreg.h>
 #include <mtclbase.h>
-#include <s60qconversions.h>
+#include <xqconversions.h>
 
 //USER INCLUDES
 #include "unibiomessagedataplugin.h"
@@ -122,6 +122,12 @@
 {
     RFile file = d_ptr->attachmentL();
 
+    if(attachmentCount() == 0)
+    {
+        file.Close();
+        return QList<UniMessageInfo*> ();
+    }
+     
     UniMessageInfoList attlist;
 
     QString path;
@@ -132,7 +138,7 @@
     User::LeaveIfError(file.FullName(fullName));
     User::LeaveIfError(file.Size(size));
 
-    path = S60QConversions::s60DescToQString(*fullName.AllocL());
+    path = XQConversions::s60DescToQString(*fullName.AllocL());
 
     UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
     attlist << msgobj;
@@ -170,7 +176,11 @@
 //---------------------------------------------------------------
 bool UniBioMessageDataPlugin::hasAttachment()
 {
-    return true;
+    if(attachmentCount() > 0)
+        return true;
+    else
+        return false; 
+        
 }
 
 // UniBioMessageDataPlugin::objectCount()
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/src/unibiomessagedataplugin_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -30,9 +30,9 @@
 #include "debugtraces.h"
 
 #include <QDateTime>
-#include <s60qconversions.h>
+#include <xqconversions.h>
 #include <mmsvattachmentmanager.h>
-
+#include <mmsvattachmentmanagersync.h>
 #include "convergedmessage.h"
 #include "convergedmessageaddress.h"
 #include "unibiomessagedataplugin_p.h"
@@ -49,8 +49,17 @@
 UniBioMessageDataPluginPrivate::~UniBioMessageDataPluginPrivate()
 {
     q_ptr = NULL;
-    if (iMsvEntry)
+    
+    if(attachmentProcessed == EFalse && iAttachmentCount == 1)
     {
+        CMsvStore* store = iMsvEntry->EditStoreL();
+        CleanupStack::PushL(store);
+        MMsvAttachmentManagerSync& attachMan = store->AttachmentManagerExtensionsL();
+        attachMan.RemoveAttachmentL(0);
+        CleanupStack::PopAndDestroy();
+    }
+    
+    if (iMsvEntry) {
         delete iMsvEntry;
     }
 
@@ -141,7 +150,7 @@
     HBufC* buf = HBufC::NewL(len);
     TPtr bufPtr = buf->Des();
     textBody.ExtractSelectively(bufPtr, 0, len, CPlainText::EExtractAll);
-    aBodyText = S60QConversions::s60DescToQString(*buf);
+    aBodyText = XQConversions::s60DescToQString(*buf);
     delete buf;
 }
 
@@ -183,8 +192,8 @@
 
         ConvergedMessageAddress
                 * messageAddress =
-                        new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                                                    S60QConversions::s60DescToQString(name));
+                        new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                                                    XQConversions::s60DescToQString(name));
         mAddressList.append(messageAddress);
     }
     CleanupStack::PopAndDestroy(3, pText);
@@ -209,7 +218,7 @@
     smsHeader->RestoreL(*store);
 
     messageAddress
-            = S60QConversions::s60DescToQString(smsHeader->FromAddress());
+            = XQConversions::s60DescToQString(smsHeader->FromAddress());
     CleanupStack::PopAndDestroy(3, pText);
 }
 
@@ -233,8 +242,7 @@
 //---------------------------------------------------------------
 RFile UniBioMessageDataPluginPrivate::attachmentL()
 {
-    if (attachmentProcessed)
-    {
+    if (attachmentProcessed) {
 
         CMsvStore* store1 = iMsvEntry->ReadStoreL();
         CleanupStack::PushL(store1);
@@ -244,33 +252,52 @@
         return file;
     }
 
-    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
-    CleanupStack::PushL(selection);
+    RFile file;
+    
+    if (iMsvEntry->Entry().SendingState() != KMsvSendStateNotApplicable
+        || iMsvEntry->Entry().SendingState() != KMsvSendStateUnknown) {
 
-    selection->AppendL(iMessageId);
+        CMsvStore* store = iMsvEntry->ReadStoreL();
+        CleanupStack::PushL(store);
+        MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+
+        iAttachmentCount = attachMan.AttachmentCount();
 
-    TBuf8<1> aParameter;
-    CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
-    
-    CMsvOperation* operation =
-            iBioClientMtm->InvokeAsyncFunctionL(KBiosMtmParse,
-                                                *selection,
-                                                aParameter,
-                                                wait->iStatus);
+        if (iAttachmentCount > 0) {
+            file = attachMan.GetAttachmentFileL(0);
+        }
+        CleanupStack::PopAndDestroy(store);
+
+    }
+
+    if (iAttachmentCount == 0) {
+        CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+        CleanupStack::PushL(selection);
 
-    wait->Start();
+        selection->AppendL(iMessageId);
+
+        TBuf8<1> aParameter;
+        CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
 
-    CMsvStore* store = iMsvEntry->ReadStoreL();
-    CleanupStack::PushL(store);
-    MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
+        CMsvOperation* operation = iBioClientMtm->InvokeAsyncFunctionL(KBiosMtmParse, *selection,
+            aParameter, wait->iStatus);
+
+        wait->Start();
 
-    iAttachmentCount = attachMan.AttachmentCount();
-
-    RFile file = attachMan.GetAttachmentFileL(0);
+        CMsvStore* store = iMsvEntry->ReadStoreL();
+        CleanupStack::PushL(store);
+        MMsvAttachmentManager& attachMan = store->AttachmentManagerL();
 
-    delete operation;
-    CleanupStack::PopAndDestroy(3,selection);
-    attachmentProcessed = ETrue;
+        iAttachmentCount = attachMan.AttachmentCount();
+		
+        if(iAttachmentCount) {
+         file = attachMan.GetAttachmentFileL(0);
+		}
+
+        delete operation;
+        CleanupStack::PopAndDestroy(3, selection);
+        attachmentProcessed = ETrue;
+    }
     return file;
 
 }
@@ -282,8 +309,7 @@
 
 int UniBioMessageDataPluginPrivate::attachmentCount()
 {
-    if (!attachmentProcessed)
-    {
+    if (!attachmentProcessed) {
         RFile file = attachmentL();
         file.Close();
     }
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 #include <QtDebug>
 #include <QTimer>
 #include <QSignalSpy>
-#include <s60qconversions.h>
+#include <xqconversions.h>
 #include <bsp.h>
 #include <biodb.h> 
 #include <biouids.h>
@@ -128,10 +128,10 @@
     origFile.Read(readBuf);
     readBuf16->Des().Copy(readBuf);
 
-    QString orig = S60QConversions::s60DescToQString(*readBuf16);
+    QString orig = XQConversions::s60DescToQString(*readBuf16);
     origFile.Close();
 
-    HBufC* filepath = S60QConversions::qStringToS60Desc(path);
+    HBufC* filepath = XQConversions::qStringToS60Desc(path);
 
     RFile file;
     op = file.Open(iFs, *filepath, EFileRead);
@@ -139,7 +139,7 @@
    
     file.Read(readBuf);
     readBuf16->Des().Copy(readBuf);
-    QString bod = S60QConversions::s60DescToQString(*readBuf16);
+    QString bod = XQConversions::s60DescToQString(*readBuf16);
 
     delete readBuf16;
     file.Close();
@@ -197,10 +197,10 @@
     origFile.Read(readBuf);
     readBuf16->Des().Copy(readBuf);
 
-    QString orig = S60QConversions::s60DescToQString(*readBuf16);
+    QString orig = XQConversions::s60DescToQString(*readBuf16);
     origFile.Close();
 
-    HBufC* filepath = S60QConversions::qStringToS60Desc(path);
+    HBufC* filepath = XQConversions::qStringToS60Desc(path);
 
     RFile file;
     op = file.Open(iFs, *filepath, EFileRead);
@@ -210,7 +210,7 @@
 
     readBuf16->Des().Copy(readBuf);
 
-    QString bod = S60QConversions::s60DescToQString(*readBuf16);
+    QString bod = XQConversions::s60DescToQString(*readBuf16);
 
     delete readBuf16;
     file.Close();
@@ -476,7 +476,7 @@
     TBufC<KTelephoneNumberMaxLength> telNumber;
 
     QString recepient(TEST_MSG_FROM1);
-    tempNumber = S60QConversions::qStringToS60Desc(recepient);
+    tempNumber = XQConversions::qStringToS60Desc(recepient);
 
     telNumber = tempNumber->Des();
     newBioEntry.iDetails.Set(telNumber);
@@ -533,9 +533,9 @@
         QString recepient2(TEST_MSG_FROM2);
         QString alias(TEST_MSG_ALIAS1);
 
-        HBufC* addr = S60QConversions::qStringToS60Desc(recepient);
-        HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2);
-        HBufC* alias1 = S60QConversions::qStringToS60Desc(alias);
+        HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+        HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+        HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
 
         CSmsHeader* smsHeader = CSmsHeader::NewL(CSmsPDU::ESmsSubmit, *pText);
         CleanupStack::PushL(smsHeader);
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/tsrc/testunidatamodelvcalplugin/testunidatamodelvcalplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -23,7 +23,6 @@
 
 INCLUDEPATH += .
 INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_TEST_DLL
@@ -48,9 +47,17 @@
     BLD_INF_RULES.prj_exports += "BioMtm.rsc /epoc32/winscw/c/resource/messaging/mtm/BioMtm.rsc"
 		}
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/test_unidatamodel_vcal_plugin.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/test_unidatamodel_vcal_plugin.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
  LIBS += -leuser \
 	-lconvergedmessageutils\
-	-ls60qconversions \
 	-lmsgs \
 	-lsmcm \
 	-lgsmu \
@@ -61,6 +68,7 @@
 	-lbioc \
 	-lefsrv \
 	-lbiodb \
-	-lbifu
+	-lbifu \
+	-lxqutils
 	
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unibiomessagedataplugin/unibiomessagedataplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,6 @@
 
 DEPENDPATH += . inc src
 INCLUDEPATH += ./inc
-INCLUDEPATH += ../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += ../../../../../inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
@@ -51,7 +50,6 @@
      
  LIBS += -leuser \
 	-lconvergedmessageutils\
-	-ls60qconversions \
 	-lmsgs \
 	-lSmcm \
 	-lgsmu \
@@ -59,7 +57,8 @@
 	-lQtCore \
 	-lefsrv \
 	-lbioc \
-	-lbifu
+	-lbifu \
+	-lxqutils
 
 
 # plugin stub deployment
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/rom/unimmsdataplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,6 @@
 #define __UNI_MMS_DATA_PLUGIN_IBY__
 
 
-# this is the plugin stub for QT plugin
 file=ABI_DIR\UREL\unimmsdataplugin.dll               SHARED_LIB_DIR\unimmsdataplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unimmsdataplugin.qtplugin     \resource\qt\plugins\messaging\datamodel\unimmsdataplugin.qtplugin
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/src/unimmsdataplugin_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -30,10 +30,11 @@
 #include <mmsheaders.h>
 #include <MsgMediaInfo.h>
 #include <MsgMediaResolver.h>
+#include <fileprotectionresolver.h>
 #include <QDateTime>
 
 #include "convergedmessage.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "convergedmessageaddress.h"
 #include "unimmsdataplugin_p.h"
 #include "debugtraces.h"
@@ -117,7 +118,7 @@
     TInt len = textBody.DocumentLength();
     HBufC* buf = HBufC::NewL(len);
     TPtr bufPtr = buf->Des();
-    aBodyText = S60QConversions::s60DescToQString(bufPtr);
+    aBodyText = XQConversions::s60DescToQString(bufPtr);
 }
 
 int UniMMSDataPluginPrivate::messageSize()
@@ -129,7 +130,7 @@
 QString UniMMSDataPluginPrivate::subject()
 {
    TPtrC sub =  mMmsClient->SubjectL();
-   return S60QConversions::s60DescToQString(sub);
+   return XQConversions::s60DescToQString(sub);
 }
 
 
@@ -163,8 +164,8 @@
         // populate address
         ConvergedMessageAddress
         * messageAddress =
-            new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                S60QConversions::s60DescToQString(name));
+            new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                XQConversions::s60DescToQString(name));
         mAddressList.append(messageAddress);
     }
 
@@ -203,8 +204,8 @@
         // populate address
         ConvergedMessageAddress
         * messageAddress =
-            new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                S60QConversions::s60DescToQString(name));
+            new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                XQConversions::s60DescToQString(name));
         mAddressList.append(messageAddress);
     }
 
@@ -243,8 +244,8 @@
         // populate address
         ConvergedMessageAddress
         * messageAddress =
-            new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                S60QConversions::s60DescToQString(name));
+            new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                XQConversions::s60DescToQString(name));
         mAddressList.append(messageAddress);
     }
 
@@ -257,7 +258,7 @@
 {
 
     TPtrC sender = mMmsClient->Sender();
-    messageAddress = S60QConversions::s60DescToQString(sender);
+    messageAddress = XQConversions::s60DescToQString(sender);
 }
 
 UniMessageInfoList UniMMSDataPluginPrivate::attachmentList()
@@ -271,15 +272,17 @@
     for (int i = 0; i < attcount; i++)
     {
         CUniObject *obj = mUniDataModel->AttachmentList().GetByIndex(i);
+        CMsgMediaInfo *mediaInfo = obj->MediaInfo();
 
-        mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
-        path
-        = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
+        mimetype = XQConversions::s60Desc8ToQString(obj->MimeType());
+        path = XQConversions::s60DescToQString(mediaInfo->FullFilePath());
         size = obj->Size(EFalse);
 
         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
+        msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection());
+        msgobj->setCorrupted(mediaInfo->Corrupt());
         attlist << msgobj;
-    }
+}
 
     return attlist;
 }
@@ -329,13 +332,15 @@
     for (int i = 0; i < objcount; i++)
     {
         CUniObject *obj = mUniDataModel->ObjectList().GetByIndex(i);
+        CMsgMediaInfo *mediaInfo = obj->MediaInfo();
 
-        mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
-        path
-        = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
+        mimetype = XQConversions::s60Desc8ToQString(obj->MimeType());
+        path = XQConversions::s60DescToQString(mediaInfo->FullFilePath());
         size = obj->Size(EFalse);
 
         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
+        msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection());
+        msgobj->setCorrupted(mediaInfo->Corrupt());
         objlist << msgobj;
     }
 
@@ -361,15 +366,16 @@
     int size;
     for (int i = 0; i < slideobjcount; i++)
     {
-        CUniObject *obj = mUniDataModel->SmilModel().GetObjectByIndex(slidenum,
-            i);
+        CUniObject *obj = mUniDataModel->SmilModel().GetObjectByIndex(slidenum, i);
+        CMsgMediaInfo *mediaInfo = obj->MediaInfo();
 
-        mimetype = S60QConversions::s60Desc8ToQString(obj->MimeType());
-        path
-        = S60QConversions::s60DescToQString(obj->MediaInfo()->FullFilePath());
+        mimetype = XQConversions::s60Desc8ToQString(obj->MimeType());
+        path = XQConversions::s60DescToQString(mediaInfo->FullFilePath());
         size = obj->Size(EFalse);
 
         UniMessageInfo *msgobj = new UniMessageInfo(path, size, mimetype);
+        msgobj->setProtected(EFileProtNoProtection != mediaInfo->Protection());
+        msgobj->setCorrupted(mediaInfo->Corrupt());
         slidecontent << msgobj;
     }
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -20,7 +20,7 @@
 #include <QTimer>
 #include <QSignalSpy>
 #include "convergedmessage.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "unidatamodelplugininterface.h"
 #include "unidatamodelloader.h"
 #include <mmsclient.h>
@@ -168,13 +168,13 @@
     if(subjectField)
         {
         QString subject(TEST_MSG_SUBJECT);
-        HBufC* subj = S60QConversions::qStringToS60Desc(subject);
+        HBufC* subj = XQConversions::qStringToS60Desc(subject);
         iMmsClientMtm->SetSubjectL(*subj);
         }
 
     //Sender
     QString sender(TEST_MSG_FROM1);
-    HBufC* addr = S60QConversions::qStringToS60Desc(sender);
+    HBufC* addr = XQConversions::qStringToS60Desc(sender);
     
     
     if (addr)
@@ -191,7 +191,7 @@
     
     //Recipient
     QString recipient(TEST_MSG_RECIEPIENT1);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recipient);
     if (addr2)
         {
         CleanupStack::PushL(addr2);
@@ -200,7 +200,7 @@
         }
     
     QString recipient2(TEST_MSG_RECIEPIENT2);
-    HBufC* addr3 = S60QConversions::qStringToS60Desc(recipient2);
+    HBufC* addr3 = XQConversions::qStringToS60Desc(recipient2);
     if (addr3)
         {
         CleanupStack::PushL(addr3);
@@ -209,7 +209,7 @@
         }
         
     QString recipient3(TEST_MSG_RECIEPIENT3);
-        HBufC* addr4 = S60QConversions::qStringToS60Desc(recipient3);
+        HBufC* addr4 = XQConversions::qStringToS60Desc(recipient3);
         if (addr4)
             {
             CleanupStack::PushL(addr4);
@@ -377,7 +377,7 @@
     
     //Sender
     QString sender(TEST_MSG_FROM1);
-    HBufC* addr = S60QConversions::qStringToS60Desc(sender);
+    HBufC* addr = XQConversions::qStringToS60Desc(sender);
     
     if (addr)
         {
@@ -393,7 +393,7 @@
     
     //Recipient
     QString recipient(TEST_MSG_RECIEPIENT1);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recipient);
     if (addr2)
         {
         CleanupStack::PushL(addr2);
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/tsrc/testunidatamodelmmsplugin/testunidatamodelmmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -9,7 +9,6 @@
 
 
 INCLUDEPATH += .
-INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/mmsmessage/inc 
 INCLUDEPATH += ../../../../../internal/sf/app/messaging/mmsengine/inc
 INCLUDEPATH += ../../../../../../inc
@@ -38,9 +37,18 @@
     BLD_INF_RULES.prj_exports += "photo.jpg C:/pictures/photo.jpg"
 		}
 		
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/test_unidatamodel_mms_plugin.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/test_unidatamodel_mms_plugin.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+		
  LIBS += -leuser \
 	-lconvergedmessageutils\
-	-ls60qconversions \
+	-lxqutils \
 	-lmsgs \
 	-lsmcm \
 	-lgsmu \
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unimmsdataplugin/unimmsdataplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,6 @@
 DEPENDPATH += . inc src
 
 INCLUDEPATH += ./inc
-INCLUDEPATH += ../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += ../../../unieditorutils/unieditorutils/inc
 INCLUDEPATH += ../../../../../inc
 INCLUDEPATH += ../../../../mmsengine/mmsmessage/inc 
@@ -57,7 +56,6 @@
 	-lbafl \
 	-lestor \
 	-lconvergedmessageutils\
-	-ls60qconversions \
 	-lmsgs \
 	-letext \
 	-lmmscli \
@@ -67,7 +65,8 @@
 	-lunidatamodel \
 	-lmmsserversettings \
 	-lmsgmedia \
-	-leikctl 
+	-leikctl \
+	-lxqutils 
 	
 # plugin stub deployment
 plugin.sources = unimmsdataplugin.dll
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/rom/unismsdataplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -18,7 +18,7 @@
 #define __UNI_SMS_DATA_PLUGIN_IBY__
 
 
-# this is the plugin stub for QT plugin
+
 file=ABI_DIR\UREL\unismsdataplugin.dll               SHARED_LIB_DIR\unismsdataplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\messaging\datamodel\unismsdataplugin.qtplugin     \resource\qt\plugins\messaging\datamodel\unismsdataplugin.qtplugin
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/src/unismsdataplugin_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -31,7 +31,7 @@
 
 #include <csmsemailfields.h>
 //USER INCLUDES
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "convergedmessageaddress.h"
 #include "convergedmessage.h"
 
@@ -149,7 +149,7 @@
     HBufC* buf = HBufC::NewL(len);
     TPtr bufPtr = buf->Des();
     textBody.ExtractSelectively(bufPtr, 0, len, CPlainText::EExtractAll);
-    aBodyText = S60QConversions::s60DescToQString(*buf);
+    aBodyText = XQConversions::s60DescToQString(*buf);
     delete buf;
 }
 
@@ -180,8 +180,8 @@
         // populate address
         ConvergedMessageAddress
                 * messageAddress =
-                        new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                                                    S60QConversions::s60DescToQString(name));
+                        new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                                                    XQConversions::s60DescToQString(name));
         mAddressList.append(messageAddress);
     }
 
@@ -195,8 +195,8 @@
             extractNameAndAddress(emailRecipients.MdcaPoint(id), name, address);
             ConvergedMessageAddress
                     * messageAddress =
-                            new ConvergedMessageAddress(S60QConversions::s60DescToQString(address),
-                                                        S60QConversions::s60DescToQString(name));
+                            new ConvergedMessageAddress(XQConversions::s60DescToQString(address),
+                                                        XQConversions::s60DescToQString(name));
             mAddressList.append(messageAddress);
         }
     }
@@ -226,7 +226,7 @@
     smsHeader->RestoreL(*store);
 
     messageAddress
-            = S60QConversions::s60DescToQString(smsHeader->FromAddress());
+            = XQConversions::s60DescToQString(smsHeader->FromAddress());
     CleanupStack::PopAndDestroy(4, pText);
 }
 
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 #include <QtDebug>
 #include <QTimer>
 #include <QSignalSpy>
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include <csmsaccount.h>
 
 #include "convergedmessage.h"
@@ -111,7 +111,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
@@ -131,9 +131,9 @@
     QString recepient2(TEST_MSG_FROM2);
     QString alias(TEST_MSG_ALIAS1);
 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recepient);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2);
-    HBufC* alias1 = S60QConversions::qStringToS60Desc(alias);
+    HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+    HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
 
     if (addr)
     {
@@ -183,7 +183,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
@@ -203,9 +203,9 @@
     QString recepient2(TEST_MSG_FROM2);
     QString alias(TEST_MSG_ALIAS1);
 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recepient);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2);
-    HBufC* alias1 = S60QConversions::qStringToS60Desc(alias);
+    HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+    HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
 
     if (addr)
     {
@@ -258,7 +258,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
@@ -278,9 +278,9 @@
     QString recepient2(TEST_MSG_FROM2);
     QString alias(TEST_MSG_ALIAS1);
 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recepient);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recepient2);
-    HBufC* alias1 = S60QConversions::qStringToS60Desc(alias);
+    HBufC* addr = XQConversions::qStringToS60Desc(recepient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recepient2);
+    HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
 
     if (addr)
     {
@@ -331,7 +331,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
@@ -351,9 +351,9 @@
     QString recipient2(TEST_MSG_FROM2);
     QString alias(TEST_MSG_ALIAS1);
 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recipient);
-    HBufC* addr2 = S60QConversions::qStringToS60Desc(recipient2);
-    HBufC* alias1 = S60QConversions::qStringToS60Desc(alias);
+    HBufC* addr = XQConversions::qStringToS60Desc(recipient);
+    HBufC* addr2 = XQConversions::qStringToS60Desc(recipient2);
+    HBufC* alias1 = XQConversions::qStringToS60Desc(alias);
 
     if (addr)
     {
@@ -396,7 +396,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/tsrc/testunidatamodelsmsplugin/testunidatamodelsmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -23,7 +23,6 @@
 
 INCLUDEPATH += .
 INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_TEST_DLL
@@ -46,10 +45,19 @@
     TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
     TARGET.EPOCALLOWDLLDATA = 1
 		}
+	
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/test_unidatamodel_sms_plugin.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/test_unidatamodel_sms_plugin.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
 		
  LIBS += -leuser \
 	-lconvergedmessageutils\
-	-ls60qconversions \
+	-lxqutils \
 	-lmsgs \
 	-lsmcm \
 	-lgsmu \
--- a/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unidatautils/unidatamodelplugins/unismsdataplugin/unismsdataplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,6 @@
 DEPENDPATH += . inc src
 
 INCLUDEPATH += ./inc
-INCLUDEPATH += ../../../../msgutils/s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 INCLUDEPATH += ../../../../../inc
 
@@ -49,12 +48,12 @@
     
  LIBS += -leuser \
 	-lconvergedmessageutils\
-	-ls60qconversions \
 	-lmsgs \
 	-lSmcm \
 	-lgsmu \
 	-letext \
-	-lQtCore
+	-lQtCore \
+	-lxqutils
 	
 # plugin stub deployment
 plugin.sources = unismsdataplugin.dll
--- a/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/bwins/editorgenutilsu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -2,28 +2,29 @@
 	?absoluteMaxSmsCharactersL@UniEditorGenUtils@@AAEHXZ @ 1 NONAME ; int UniEditorGenUtils::absoluteMaxSmsCharactersL(void)
 	??0UniEditorGenUtils@@QAE@XZ @ 2 NONAME ; UniEditorGenUtils::UniEditorGenUtils(void)
 	??0CMuiuOperationWait@@IAE@H@Z @ 3 NONAME ; CMuiuOperationWait::CMuiuOperationWait(int)
-	?MaxSmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 4 NONAME ; int UniEditorGenUtils::MaxSmsRecipientsL(void)
-	?Start@CMuiuOperationWait@@QAEXXZ @ 5 NONAME ; void CMuiuOperationWait::Start(void)
-	?getSmsCharacterLimits@UniEditorGenUtils@@AAEXAAH0_N@Z @ 6 NONAME ; void UniEditorGenUtils::getSmsCharacterLimits(int &, int &, bool)
-	?MaxSmsMsgSizeL@UniEditorGenUtils@@QAEH_N@Z @ 7 NONAME ; int UniEditorGenUtils::MaxSmsMsgSizeL(bool)
-	?DoCancel@CMuiuOperationWait@@MAEXXZ @ 8 NONAME ; void CMuiuOperationWait::DoCancel(void)
-	?MaxMmsMsgSizeL@UniEditorGenUtils@@QAEHXZ @ 9 NONAME ; int UniEditorGenUtils::MaxMmsMsgSizeL(void)
-	??_ECMuiuOperationWait@@UAE@I@Z @ 10 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(unsigned int)
-	?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 11 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
-	?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 12 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
-	?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 13 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
-	?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 14 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
-	?RunL@CMuiuOperationWait@@MAEXXZ @ 15 NONAME ; void CMuiuOperationWait::RunL(void)
-	?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 16 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
-	?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 17 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
-	??1CMuiuOperationWait@@UAE@XZ @ 18 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
-	?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 19 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
-	?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 20 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
-	?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 21 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
-	?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 22 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
-	?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 23 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
-	?IsValidEmailAddress@UniEditorGenUtils@@QAEHVQString@@@Z @ 24 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class QString)
-	?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 25 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
-	??1UniEditorGenUtils@@QAE@XZ @ 26 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
-	?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 27 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
+	?IsValidDomain@UniEditorGenUtils@@AAEHABVTDesC16@@@Z @ 4 NONAME ; int UniEditorGenUtils::IsValidDomain(class TDesC16 const &)
+	?MaxSmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 5 NONAME ; int UniEditorGenUtils::MaxSmsRecipientsL(void)
+	?Start@CMuiuOperationWait@@QAEXXZ @ 6 NONAME ; void CMuiuOperationWait::Start(void)
+	?getSmsCharacterLimits@UniEditorGenUtils@@AAEXAAH0_N@Z @ 7 NONAME ; void UniEditorGenUtils::getSmsCharacterLimits(int &, int &, bool)
+	?MaxSmsMsgSizeL@UniEditorGenUtils@@QAEH_N@Z @ 8 NONAME ; int UniEditorGenUtils::MaxSmsMsgSizeL(bool)
+	?DoCancel@CMuiuOperationWait@@MAEXXZ @ 9 NONAME ; void CMuiuOperationWait::DoCancel(void)
+	?MaxMmsMsgSizeL@UniEditorGenUtils@@QAEHXZ @ 10 NONAME ; int UniEditorGenUtils::MaxMmsMsgSizeL(void)
+	??_ECMuiuOperationWait@@UAE@I@Z @ 11 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(unsigned int)
+	?ReplaceCharacters@UniEditorGenUtils@@QAEXAAVTDes16@@ABVTDesC16@@VTChar@@@Z @ 12 NONAME ; void UniEditorGenUtils::ReplaceCharacters(class TDes16 &, class TDesC16 const &, class TChar)
+	?NumberToBase@UniEditorGenUtils@@QAE?AVTChar@@V2@@Z @ 13 NONAME ; class TChar UniEditorGenUtils::NumberToBase(class TChar)
+	?IsValidEmailAddress@UniEditorGenUtils@@QAEHABVTDesC16@@@Z @ 14 NONAME ; int UniEditorGenUtils::IsValidEmailAddress(class TDesC16 const &)
+	?ConvertDigitsTo@UniEditorGenUtils@@QAEXAAVTDes16@@W4TDigitType@@@Z @ 15 NONAME ; void UniEditorGenUtils::ConvertDigitsTo(class TDes16 &, enum TDigitType)
+	?NewLC@CMuiuOperationWait@@SAPAV1@H@Z @ 16 NONAME ; class CMuiuOperationWait * CMuiuOperationWait::NewLC(int)
+	?RunL@CMuiuOperationWait@@MAEXXZ @ 17 NONAME ; void CMuiuOperationWait::RunL(void)
+	?getFileInfoL@UniEditorGenUtils@@QAEXVQString@@AAHAAV2@AAW4TMsgMediaType@@@Z @ 18 NONAME ; void UniEditorGenUtils::getFileInfoL(class QString, int &, class QString &, enum TMsgMediaType &)
+	?MaxMmsRecipientsL@UniEditorGenUtils@@QAEHXZ @ 19 NONAME ; int UniEditorGenUtils::MaxMmsRecipientsL(void)
+	??1CMuiuOperationWait@@UAE@XZ @ 20 NONAME ; CMuiuOperationWait::~CMuiuOperationWait(void)
+	?VerifyEmailAddressesL@UniEditorGenUtils@@QAEHV?$QList@PAVConvergedMessageAddress@@@@@Z @ 21 NONAME ; int UniEditorGenUtils::VerifyEmailAddressesL(class QList<class ConvergedMessageAddress *>)
+	?WriteEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHABVTDes16@@0ABH@Z @ 22 NONAME ; int UniEditorGenUtils::WriteEmailOverSmsSettingsL(class TDes16 const &, class TDes16 const &, int const &)
+	?ReadEmailOverSmsSettingsL@UniEditorGenUtils@@QAEHAAVTDes16@@0AAH@Z @ 23 NONAME ; int UniEditorGenUtils::ReadEmailOverSmsSettingsL(class TDes16 &, class TDes16 &, int &)
+	?absoluteMaxSmsPartsL@UniEditorGenUtils@@AAEHXZ @ 24 NONAME ; int UniEditorGenUtils::absoluteMaxSmsPartsL(void)
+	?UTF8Size@UniEditorGenUtils@@QAEHVQString@@@Z @ 25 NONAME ; int UniEditorGenUtils::UTF8Size(class QString)
+	?IsPhoneOfflineL@UniEditorGenUtils@@QAEHXZ @ 26 NONAME ; int UniEditorGenUtils::IsPhoneOfflineL(void)
+	??1UniEditorGenUtils@@QAE@XZ @ 27 NONAME ; UniEditorGenUtils::~UniEditorGenUtils(void)
+	?AcceptEmailAddressesL@UniEditorGenUtils@@QAEHXZ @ 28 NONAME ; int UniEditorGenUtils::AcceptEmailAddressesL(void)
 
--- a/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/eabi/editorgenutilsu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,35 +1,36 @@
 EXPORTS
 	_ZN17UniEditorGenUtils12NumberToBaseE5TChar @ 1 NONAME
 	_ZN17UniEditorGenUtils12getFileInfoLE7QStringRiRS0_R13TMsgMediaType @ 2 NONAME
-	_ZN17UniEditorGenUtils14MaxMmsMsgSizeLEv @ 3 NONAME
-	_ZN17UniEditorGenUtils14MaxSmsMsgSizeLEb @ 4 NONAME
-	_ZN17UniEditorGenUtils15ConvertDigitsToER6TDes1610TDigitType @ 5 NONAME
-	_ZN17UniEditorGenUtils15IsPhoneOfflineLEv @ 6 NONAME
-	_ZN17UniEditorGenUtils17MaxMmsRecipientsLEv @ 7 NONAME
-	_ZN17UniEditorGenUtils17MaxSmsRecipientsLEv @ 8 NONAME
-	_ZN17UniEditorGenUtils17ReplaceCharactersER6TDes16RK7TDesC165TChar @ 9 NONAME
-	_ZN17UniEditorGenUtils19IsValidEmailAddressE7QString @ 10 NONAME
-	_ZN17UniEditorGenUtils20absoluteMaxSmsPartsLEv @ 11 NONAME
-	_ZN17UniEditorGenUtils21AcceptEmailAddressesLEv @ 12 NONAME
-	_ZN17UniEditorGenUtils21VerifyEmailAddressesLE5QListIP23ConvergedMessageAddressE @ 13 NONAME
-	_ZN17UniEditorGenUtils21getSmsCharacterLimitsERiS0_b @ 14 NONAME
-	_ZN17UniEditorGenUtils25ReadEmailOverSmsSettingsLER6TDes16S1_Ri @ 15 NONAME
-	_ZN17UniEditorGenUtils25absoluteMaxSmsCharactersLEv @ 16 NONAME
-	_ZN17UniEditorGenUtils26WriteEmailOverSmsSettingsLERK6TDes16S2_RKi @ 17 NONAME
-	_ZN17UniEditorGenUtils8UTF8SizeE7QString @ 18 NONAME
-	_ZN17UniEditorGenUtilsC1Ev @ 19 NONAME
-	_ZN17UniEditorGenUtilsC2Ev @ 20 NONAME
-	_ZN17UniEditorGenUtilsD1Ev @ 21 NONAME
-	_ZN17UniEditorGenUtilsD2Ev @ 22 NONAME
-	_ZN18CMuiuOperationWait4RunLEv @ 23 NONAME
-	_ZN18CMuiuOperationWait5NewLCEi @ 24 NONAME
-	_ZN18CMuiuOperationWait5StartEv @ 25 NONAME
-	_ZN18CMuiuOperationWait8DoCancelEv @ 26 NONAME
-	_ZN18CMuiuOperationWaitC1Ei @ 27 NONAME
-	_ZN18CMuiuOperationWaitC2Ei @ 28 NONAME
-	_ZN18CMuiuOperationWaitD0Ev @ 29 NONAME
-	_ZN18CMuiuOperationWaitD1Ev @ 30 NONAME
-	_ZN18CMuiuOperationWaitD2Ev @ 31 NONAME
-	_ZTI18CMuiuOperationWait @ 32 NONAME
-	_ZTV18CMuiuOperationWait @ 33 NONAME
+	_ZN17UniEditorGenUtils13IsValidDomainERK7TDesC16 @ 3 NONAME
+	_ZN17UniEditorGenUtils14MaxMmsMsgSizeLEv @ 4 NONAME
+	_ZN17UniEditorGenUtils14MaxSmsMsgSizeLEb @ 5 NONAME
+	_ZN17UniEditorGenUtils15ConvertDigitsToER6TDes1610TDigitType @ 6 NONAME
+	_ZN17UniEditorGenUtils15IsPhoneOfflineLEv @ 7 NONAME
+	_ZN17UniEditorGenUtils17MaxMmsRecipientsLEv @ 8 NONAME
+	_ZN17UniEditorGenUtils17MaxSmsRecipientsLEv @ 9 NONAME
+	_ZN17UniEditorGenUtils17ReplaceCharactersER6TDes16RK7TDesC165TChar @ 10 NONAME
+	_ZN17UniEditorGenUtils19IsValidEmailAddressERK7TDesC16 @ 11 NONAME
+	_ZN17UniEditorGenUtils20absoluteMaxSmsPartsLEv @ 12 NONAME
+	_ZN17UniEditorGenUtils21AcceptEmailAddressesLEv @ 13 NONAME
+	_ZN17UniEditorGenUtils21VerifyEmailAddressesLE5QListIP23ConvergedMessageAddressE @ 14 NONAME
+	_ZN17UniEditorGenUtils21getSmsCharacterLimitsERiS0_b @ 15 NONAME
+	_ZN17UniEditorGenUtils25ReadEmailOverSmsSettingsLER6TDes16S1_Ri @ 16 NONAME
+	_ZN17UniEditorGenUtils25absoluteMaxSmsCharactersLEv @ 17 NONAME
+	_ZN17UniEditorGenUtils26WriteEmailOverSmsSettingsLERK6TDes16S2_RKi @ 18 NONAME
+	_ZN17UniEditorGenUtils8UTF8SizeE7QString @ 19 NONAME
+	_ZN17UniEditorGenUtilsC1Ev @ 20 NONAME
+	_ZN17UniEditorGenUtilsC2Ev @ 21 NONAME
+	_ZN17UniEditorGenUtilsD1Ev @ 22 NONAME
+	_ZN17UniEditorGenUtilsD2Ev @ 23 NONAME
+	_ZN18CMuiuOperationWait4RunLEv @ 24 NONAME
+	_ZN18CMuiuOperationWait5NewLCEi @ 25 NONAME
+	_ZN18CMuiuOperationWait5StartEv @ 26 NONAME
+	_ZN18CMuiuOperationWait8DoCancelEv @ 27 NONAME
+	_ZN18CMuiuOperationWaitC1Ei @ 28 NONAME
+	_ZN18CMuiuOperationWaitC2Ei @ 29 NONAME
+	_ZN18CMuiuOperationWaitD0Ev @ 30 NONAME
+	_ZN18CMuiuOperationWaitD1Ev @ 31 NONAME
+	_ZN18CMuiuOperationWaitD2Ev @ 32 NONAME
+	_ZTI18CMuiuOperationWait @ 33 NONAME
+	_ZTV18CMuiuOperationWait @ 34 NONAME
 
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/editorgenutils.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -21,7 +21,6 @@
 
 INCLUDEPATH += .
 INCLUDEPATH += ../../../../inc
-INCLUDEPATH += ../../s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_MUIU_UITLS_DLL
@@ -50,11 +49,22 @@
 SOURCES += src/MuiuOperationWait.cpp \
     src/UniEditorGenUtils.cpp
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/editorgenutils.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/editorgenutils.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 LIBS += -leuser \
     -lCentralRepository \
     -lconvergedmessageutils \
     -lsssettings \
-    -ls60qconversions \
     -lMsgMedia \
-    -lapmime
+    -lapmime \
+    -lxqutils \
+    -lavkon \
+    -lefsrv 
 
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/inc/UniEditorGenUtils.h	Fri Jun 25 15:47:40 2010 +0530
@@ -121,13 +121,6 @@
         TInt MaxMmsRecipientsL();
         
         /**
-         * Checks if a given address string is a valid email address
-         * @param addr address string
-         * @return ETrue if addr is valid email address
-         */
-        TBool IsValidEmailAddress( QString addr );
-        
-        /**
          * Calculates the size of the given message
          * @param msg ConvergedMessage
          * @return size of the converged message
@@ -187,6 +180,13 @@
          */
         void ReplaceCharacters(TDes &aDes, const TDesC &aChars, TChar aReplacement);
 
+        /**
+         * Checks if a given address string is a valid email address
+         * @param addr address string
+         * @return ETrue if addr is valid email address
+         */
+        TBool IsValidEmailAddress( const TDesC& aAddress );
+        
       private:
           /**
            * get sms character limits from feature manager
@@ -213,6 +213,11 @@
            */
           int absoluteMaxSmsCharactersL();
           
+          /**
+           * validate the domain portion of an email address
+           */
+          TBool IsValidDomain ( const TDesC& aDomain );
+          
       private: //data
           /**
            * Read only once for optimization purpose
--- a/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/editorgenutils/src/UniEditorGenUtils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,17 @@
 #include "MessagingVariant.hrh"
 #include "MessagingInternalCRKeys.h"  // Keys
 #include "UniEditorGenUtils.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
+
+// CONSTANTS
+const TInt KMuiuCharQuote = '\"';
+const TInt KMuiuCharBackSlash = '\\';
+const TInt KMuiuCharDot = '.';
+const TInt KMuiuCharSpace = ' ';
+const TInt KMuiuCharDel = 127;
+const TInt KMuiuCharAt = '@';
+const TInt KMuiuSpecialCharStrLen = 12;
+_LIT( KRFC822Specials,"()<>@,;:\\\"[]");
 
 // ============================ MEMBER FUNCTIONS ===============================
 
@@ -163,20 +173,29 @@
 // UniEditorGenUtils::VerifyEmailAddressesL
 // @see header
 // ----------------------------------------------------
-TBool UniEditorGenUtils::VerifyEmailAddressesL( ConvergedMessageAddressList addr)
+TBool UniEditorGenUtils::VerifyEmailAddressesL( ConvergedMessageAddressList addrList)
 {
-  TBool emailAddrPresent =  EFalse;
-
-  for ( int i=0; i< addr.count(); i++)
-  {
-	  if( IsValidEmailAddress(addr[i]->address()) )
-	  {
-		  emailAddrPresent = ETrue;
-		  break;
-	  }
-  }
-
-  return emailAddrPresent;
+    TBool emailAddrPresent =  EFalse;
+    int addrCount = addrList.count();
+    for(int i=0; i< addrCount; i++)
+    {
+        QString addr = addrList.at(i)->address();
+        // check if email address, contains at least 3 characters
+        if(addr.size() >= 3)
+        {
+            // search for @ from the address
+            // however, it can't be the first or the last item
+            for(int i = 1; i < addr.size() - 1; i++)
+            {
+                if(addr.at(i) == '@')
+                {
+                    emailAddrPresent = ETrue;
+                    break;
+                }
+            }
+        }
+    }
+    return emailAddrPresent;
 }
 
 // ----------------------------------------------------
@@ -185,7 +204,7 @@
 // ----------------------------------------------------
 TInt UniEditorGenUtils::UTF8Size( QString aText )
     {
-    HBufC* text = S60QConversions::qStringToS60Desc(aText);
+    HBufC* text = XQConversions::qStringToS60Desc(aText);
     TPtrC ptr = text->Des();
     
     TInt count = 0;
@@ -252,27 +271,6 @@
 }
 
 // ----------------------------------------------------
-// UniEditorGenUtils::IsValidEmailAddress
-// @see header
-// ----------------------------------------------------
-TBool UniEditorGenUtils::IsValidEmailAddress( QString addr )
-    { 
-    // valid email address contains at least 3 characters
-    if( addr.size() >= 3 )
-        {
-        // search for @ from the address. however, it can't be the first or the last item
-        for ( int i = 1; i < addr.size() - 1; i++ )
-            {
-            if ( addr.at(i) == '@' )
-                {
-                return ETrue;
-                }
-            }
-        }
-    return EFalse;
-    }
-
-// ----------------------------------------------------
 // UniEditorGenUtils::MaxMmsMsgSizeL
 // @see header
 // ----------------------------------------------------
@@ -303,7 +301,7 @@
                                     QString& mimetype,
                                     TMsgMediaType& mediaType)
 {
-    HBufC* filepath = S60QConversions::qStringToS60Desc(filePath);
+    HBufC* filepath = XQConversions::qStringToS60Desc(filePath);
     int fileSize = 0;
     
 	CMsgMediaResolver* mediaResolver;
@@ -320,7 +318,7 @@
     size = fileSize;
     TDataType datatype;
     mediaResolver->RecognizeL( file, datatype );
-    mimetype = S60QConversions::s60Desc8ToQString(datatype.Des8());
+    mimetype = XQConversions::s60Desc8ToQString(datatype.Des8());
     mediaType = mediaResolver->MediaType(datatype.Des8());
     
     CleanupStack::PopAndDestroy(mediaResolver);
@@ -482,4 +480,126 @@
         }
     }
 
+// ----------------------------------------------------
+// UniEditorGenUtils::IsValidEmailAddressL
+// @see header
+// ----------------------------------------------------
+TBool UniEditorGenUtils::IsValidEmailAddress( const TDesC& aAddress )
+    {
+    TInt c;
+    TInt length = aAddress.Length ();
+    TBufC<KMuiuSpecialCharStrLen> rfc822Specials ( KRFC822Specials );
+        
+    // first we validate the name portion (name@domain)
+    if ( length && aAddress[0] == KMuiuCharDot )
+        {
+        return EFalse;
+        }
+    for ( c = 0 ; c < length ; c++ )
+        {
+        if ( aAddress[c] == KMuiuCharQuote && ( c == 0 || 
+        aAddress[c-1] == KMuiuCharDot || aAddress[c-1] == KMuiuCharQuote ) )
+            {
+            while ( ++c < length )
+                {
+                if ( aAddress[c] == KMuiuCharQuote )
+                    {
+                    if( (c + 1) == length)
+                        {
+                        return EFalse;
+                        }
+                    break;
+                    }
+                if ( aAddress[c] == KMuiuCharBackSlash && 
+                    ( aAddress[++c] == KMuiuCharSpace) ) 
+                    {
+                    continue;
+                    }  
+                if ( aAddress[c] <= KMuiuCharSpace || 
+                    aAddress[c] >= KMuiuCharDel ) 
+                    {
+                    return EFalse;
+                    }
+                }
+            if ( c++ == length )
+                {
+                return EFalse;
+                }
+            if ( aAddress[c] == KMuiuCharAt )
+                {
+                break;
+                }
+            if ( aAddress[c] != KMuiuCharDot )
+                {
+                return EFalse;
+                }
+            continue;
+            }
+        if ( aAddress[c] == KMuiuCharAt )
+            {
+            break; 
+            }
+        if ( aAddress[c] <= KMuiuCharSpace || aAddress[c] >= KMuiuCharDel )
+            {
+            return EFalse;
+            }    
+        if ( rfc822Specials.Locate ( aAddress[c] ) != KErrNotFound )
+            {
+            return EFalse;
+            }
+        }
+    if ( c == 0 || aAddress[c-1] == KMuiuCharDot )
+        {
+        return EFalse;
+        }
+    // next we validate the domain portion (name@domain)
+    if ( c == length )
+        {
+        return EFalse;
+        }
+    else
+        {
+        c++; 
+        return IsValidDomain ( aAddress.Mid ( ( c ) , length-c ) );
+        }
+    }
+
+// ----------------------------------------------------
+// UniEditorGenUtils::IsValidDomainL
+// @see header
+// ----------------------------------------------------
+TBool UniEditorGenUtils::IsValidDomain ( const TDesC& aDomain )
+    {
+    TInt c = 0;  
+    TInt length = aDomain.Length ();
+    TBufC<KMuiuSpecialCharStrLen> rfc822Specials ( KRFC822Specials );
+    
+    if ( length == 0 )
+        {
+        return EFalse;   
+        }
+    
+    do
+        {    
+        if ( aDomain[c] == KMuiuCharDot )
+            {
+            if ( c == 0 || aDomain[c-1] == KMuiuCharDot )
+                {
+                return EFalse;
+                }
+            }
+        if ( aDomain[c] <= KMuiuCharSpace || aDomain[c] >= KMuiuCharDel )
+            {
+            return EFalse;
+            }
+        if ( rfc822Specials.Locate( aDomain[c] ) != KErrNotFound )
+            {
+            return EFalse;
+            }
+        } 
+    while ( ++c < length );
+  
+    return ( aDomain[length-1] != '.' );
+    }
+
 // End of file
--- a/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorpluginloader/unieditorpluginloader.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -50,3 +50,11 @@
 
 SOURCES += src/unieditorpluginloader.cpp
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/unieditorpluginloader.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/unieditorpluginloader.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/inc/unieditormmsplugin_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -218,6 +218,9 @@
     CMmsClientMtm* iMmsMtm;
     CMmsHeaders* iMmsHeader;
 
+    // Flag for forwarded messages
+    TBool iMessageForwarded;
+    
     // owned
     UniDataModelLoader* iDataModelPluginLoader;        
     //Not owned
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/rom/unieditormmsplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -19,7 +19,6 @@
 #define __UNI_EDITOR_MMS_PLUGIN_IBY__
 
 
-# this is the plugin stub for QT plugin
 file=ABI_DIR\UREL\unieditormmsplugin.dll               SHARED_LIB_DIR\unieditormmsplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\messaging\editorplugins\unieditormmsplugin.qtplugin              \resource\qt\plugins\messaging\editorplugins\unieditormmsplugin.qtplugin
 
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/src/unieditormmsplugin_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -43,7 +43,7 @@
 #include "UniSendingSettings.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "debugtraces.h"
 #include "UniEditorGenUtils.h"
 
@@ -89,10 +89,18 @@
     delete iUniDataModel;
     ifsSession.Close();
 
-    delete iMmsMtm;
+    if(iMmsMtm)
+    {
+        delete iMmsMtm;
+    }
+
     delete iMtmRegistry;
     delete iDataModelPluginLoader;
-    delete iSession;
+
+    if(iSession)
+    {
+        delete iSession;
+    }
 }
 
 // -----------------------------------------------------------------------------
@@ -102,7 +110,7 @@
 //
 CUniEditorMmsPluginPrivate::CUniEditorMmsPluginPrivate( )
 {
-    iSession = CMsvSession::OpenSyncL(*this);
+    TRAP_IGNORE(iSession = CMsvSession::OpenSyncL(*this));
 }
 
 // -----------------------------------------------------------------------------
@@ -159,7 +167,7 @@
     populateRecipientsL(aMessage);
 
     //populate convergedmessage with the subject
-    aMessage.setSubject(S60QConversions::s60DescToQString(
+    aMessage.setSubject(XQConversions::s60DescToQString(
         MmsMtmL()->SubjectL()));
 
     // Priority
@@ -196,12 +204,20 @@
     ConvergedMessage &aMessage)
 {
     QDEBUG_WRITE("Enter convertFromForwardHandlerL");
-
-    TMsvEntry entry =MmsMtmL()->Entry().Entry();
+    iMessageForwarded = EFalse;
+    TMsvEntry entry = MmsMtmL()->Entry().Entry();
 
     //populate convergedmessage with the subject prepended with FW:
-    QString subject = LOC_FWD + S60QConversions::s60DescToQString(
-        MmsMtmL()->SubjectL());     
+    QString subject =
+            XQConversions::s60DescToQString(MmsMtmL()->SubjectL());
+
+    if (!(entry.Forwarded() || subject.startsWith(LOC_FWD,
+            Qt::CaseInsensitive)))
+        {
+        subject.insert(0, LOC_FWD);
+        iMessageForwarded = ETrue;
+        }
+
     aMessage.setSubject(subject);
 
     // Priority
@@ -260,10 +276,14 @@
             {
                 QString textContent;
                 QFile file(slideContentList.at(i)->path());
-                file.open(QIODevice::ReadOnly);
-                textContent = file.readAll();
-                aMessage.setBodyText(textContent);
-                file.close();
+                if (file.open(QIODevice::ReadOnly)) {
+                    textContent = file.readAll();
+                    aMessage.setBodyText(textContent);
+                    file.close();
+                }
+                else {
+                    return;
+                }
             }
             else
             {
@@ -374,7 +394,13 @@
 
      //There is no size check inside plugin as it assumes 
      //we get proper data from editor
-     HBufC* sub = S60QConversions::qStringToS60Desc(aMessage->subject());
+     entry = MmsMtmL()->Entry().Entry();
+     if (iMessageForwarded)
+        {
+        entry.SetForwarded(ETrue);
+        iMessageForwarded = EFalse;
+        }
+     HBufC* sub = XQConversions::qStringToS60Desc(aMessage->subject());
      if( sub )
      {
          CleanupStack::PushL(sub);
@@ -499,8 +525,8 @@
      //Saving the changes
      MmsMtmL()->SaveMessageL();
 
+     
      entry = MmsMtmL()->Entry().Entry();
-
      TBuf<KMaxDetailsLength> detailsBuf;
      MakeDetailsL( detailsBuf );
      entry.iDetails.Set( detailsBuf );
@@ -570,7 +596,7 @@
 //
 CMmsClientMtm* CUniEditorMmsPluginPrivate::MmsMtmL()
 {
-    if ( !iMmsMtm )
+    if ( !iMmsMtm && iSession )
     {
         if ( !iMtmRegistry )
         {            
@@ -700,7 +726,7 @@
             continue;
         }
         // convert from QString to HBufC
-        HBufC* addr = S60QConversions::qStringToS60Desc(array[i]->address());
+        HBufC* addr = XQConversions::qStringToS60Desc(array[i]->address());
 
         CleanupStack::PushL(addr);
 
@@ -711,7 +737,7 @@
         }
         else
         {
-            HBufC* displayName = S60QConversions::qStringToS60Desc(array[i]->alias());
+            HBufC* displayName = XQConversions::qStringToS60Desc(array[i]->alias());
             if(displayName)
             {
                 CleanupStack::PushL(displayName);
@@ -749,10 +775,10 @@
     for (TInt i = 0; i < count; ++i)
         {
         //Address
-        QString address = S60QConversions::s60DescToQString(
+        QString address = XQConversions::s60DescToQString(
             TMmsGenUtils::PureAddress(addresses[i]));
         //Alias
-        QString alias = S60QConversions::s60DescToQString(
+        QString alias = XQConversions::s60DescToQString(
             TMmsGenUtils::Alias(addresses[i]));
 
         //add recipient to convergedMessage
@@ -782,10 +808,13 @@
 //
 void CUniEditorMmsPluginPrivate::deleteDraftsEntryL( TMsvId aId )
 {
-    CMsvEntry* pEntry = iSession->GetEntryL(KMsvDraftEntryIdValue);
-    CleanupStack::PushL(pEntry);
-    pEntry->DeleteL( aId );
-    CleanupStack::PopAndDestroy(pEntry);
+    if(iSession)
+    {
+        CMsvEntry* pEntry = iSession->GetEntryL(KMsvDraftEntryIdValue);
+        CleanupStack::PushL(pEntry);
+        pEntry->DeleteL( aId );
+        CleanupStack::PopAndDestroy(pEntry);    
+    }
 }
 
 
@@ -797,7 +826,7 @@
 void CUniEditorMmsPluginPrivate::addObjectL(int aSlideNum, const QString& aFilePath)
 {
 
-    HBufC* filePath = S60QConversions::qStringToS60Desc(aFilePath);
+    HBufC* filePath = XQConversions::qStringToS60Desc(aFilePath);
 
     if (filePath)
     {
@@ -826,7 +855,7 @@
 //
 void CUniEditorMmsPluginPrivate::addAttachmentL(const QString& aFilePath)
 {
-    HBufC * filePath = S60QConversions::qStringToS60Desc(aFilePath);
+    HBufC * filePath = XQConversions::qStringToS60Desc(aFilePath);
     if (filePath)
     {
         CleanupStack::PushL(filePath);
@@ -861,7 +890,7 @@
     delete iEditor;
     iEditor = NULL;
 
-    HBufC* textContent = S60QConversions::qStringToS60Desc(aBodyText);
+    HBufC* textContent = XQConversions::qStringToS60Desc(aBodyText);
     if (textContent)
     {
         CleanupStack::PushL(textContent);
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/bwins/test_mms_pluginu.def	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-EXPORTS
-	qt_plugin_instance @ 1 NONAME
-	qt_plugin_query_verification_data @ 2 NONAME
-	?createMMSMessageWithAttachmentAndSend@TestMmsPlugin@@AAEXH@Z @ 3 NONAME ; void TestMmsPlugin::createMMSMessageWithAttachmentAndSend(int)
-	?validateMsg@TestMmsPlugin@@AAEXABVConvergedMessage@@ABVQString@@@Z @ 4 NONAME ; void TestMmsPlugin::validateMsg(class ConvergedMessage const &, class QString const &)
-	?tr@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *)
-	?getStaticMetaObject@TestMmsPlugin@@SAABUQMetaObject@@XZ @ 6 NONAME ; struct QMetaObject const & TestMmsPlugin::getStaticMetaObject(void)
-	?cleanupTestCase@TestMmsPlugin@@AAEXXZ @ 7 NONAME ; void TestMmsPlugin::cleanupTestCase(void)
-	?testReceived@TestMmsPlugin@@AAEXH@Z @ 8 NONAME ; void TestMmsPlugin::testReceived(int)
-	?qt_metacast@TestMmsPlugin@@UAEPAXPBD@Z @ 9 NONAME ; void * TestMmsPlugin::qt_metacast(char const *)
-	?qt_metacall@TestMmsPlugin@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int TestMmsPlugin::qt_metacall(enum QMetaObject::Call, int, void * *)
-	?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 11 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *, int)
-	?staticMetaObject@TestMmsPlugin@@2UQMetaObject@@B @ 12 NONAME ; struct QMetaObject const TestMmsPlugin::staticMetaObject
-	?init@TestMmsPlugin@@AAEXXZ @ 13 NONAME ; void TestMmsPlugin::init(void)
-	?testSendMMS@TestMmsPlugin@@AAEXXZ @ 14 NONAME ; void TestMmsPlugin::testSendMMS(void)
-	?trUtf8@TestMmsPlugin@@SA?AVQString@@PBD0@Z @ 15 NONAME ; class QString TestMmsPlugin::trUtf8(char const *, char const *)
-	?tr@TestMmsPlugin@@SA?AVQString@@PBD0H@Z @ 16 NONAME ; class QString TestMmsPlugin::tr(char const *, char const *, int)
-	?createMMSMessageWithSmilTextAndImageAttachmentAndSend@TestMmsPlugin@@AAEXXZ @ 17 NONAME ; void TestMmsPlugin::createMMSMessageWithSmilTextAndImageAttachmentAndSend(void)
-	?cleanup@TestMmsPlugin@@AAEXXZ @ 18 NONAME ; void TestMmsPlugin::cleanup(void)
-	?initTestCase@TestMmsPlugin@@AAEXXZ @ 19 NONAME ; void TestMmsPlugin::initTestCase(void)
-	?testMmsReceived@TestMmsPlugin@@AAEXXZ @ 20 NONAME ; void TestMmsPlugin::testMmsReceived(void)
-	?metaObject@TestMmsPlugin@@UBEPBUQMetaObject@@XZ @ 21 NONAME ; struct QMetaObject const * TestMmsPlugin::metaObject(void) const
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsreadfile.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,471 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSREADFILE_H
+#define MMSREADFILE_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <f32file.h>
+#include <msvstd.h>
+
+// forward references
+class CMmsAttaStructure;
+class CMmsHeaders;
+class CEikonEnv;
+class CMmsClientMtm;
+
+// Out-of-range value for any MMS header with assigned number
+// Used in coverage tests to get coverage for "default" branches
+// in "case" statements.
+const TInt KMmsTestIllegalValue = 255;
+
+//
+// TEST KEY WORDS
+// Extended to include all MMS headers to allow generation of arbitrary PDUs
+// Content type header cannot be separately defined,
+// it will always be "multipat/mixed" or "multipart/related"
+_LIT8( KTestEndOfFile,          "EOF" );
+_LIT8( KTestNewMessage,         "MESSAGE BEGIN" );
+//------------------------------------------------
+_LIT8( KTestMessageType,        "MESSAGE-TYPE" ); //X-Mms-Message-Type
+_LIT8( KTestDate,               "DATE" ); // Date
+_LIT8( KTestFrom,               "FROM" ); // From
+_LIT8( KTestTo,                 "TO" ); // To
+_LIT8( KTestCc,                 "CC" ); // Cc
+_LIT8( KTestBcc,                "BCC" ); // Bcc
+_LIT8( KTestSubject,            "SUBJECT" ); // Subject
+_LIT8( KTestExpiryRel,          "EXPIRY-REL" ); // X-Mms-Expiry, relative
+_LIT8( KTestExpiryAbs,          "EXPIRY-ABS" ); // X-Mms-Expiry, absolute
+_LIT8( KTestDeliveryTimeRel,    "DELIVERY-TIME-REL" ); // X-Mms-Delivery-Time, relative
+_LIT8( KTestDeliveryTimeAbs,    "DELIVERY-TIME-ABS" ); // X-Mms-Delivery-Time, absolute
+_LIT8( KTestPriority,           "PRIORITY" ); // X-Mms-Priority
+_LIT8( KTestSenderVisibility,   "SENDER-VISIBILITY" ); // X-Mms-Sender-Visibility
+_LIT8( KTestDeliveryReport,     "DELIVERY-REPORT" ); // X-Mms-Delivery-Report
+_LIT8( KTestReadReply,          "READ-REPLY" ); // X-Mms-Read-Report
+// ---------------------------------------------------
+_LIT8( KTestNewAttachment,      "ATTACHMENT" );
+_LIT8( KTestAttachmentType,     "ATTACHMENTTYPE" );
+_LIT8( KTestAttachmentName,     "ATTACHMENTNAME" );
+_LIT8( KTestAttachmentContLoc,  "ATTACHMENTCONTLOC" );
+_LIT8( KTestAttachmentCharset,  "ATTACHMENTCHARSET" );
+_LIT8( KTestAttachmentCid,      "ATTACHMENTCID" );
+_LIT8( KTestAttachmentRoot,     "ATTACHMENTROOT" );
+// content-type and x-type parameters for attachments
+// should appear in name-value pairs.
+// Test program is not responsible for verifying illegal scripts
+_LIT8( KTestAttContTypeParamName, "ContTypeParamName" );
+_LIT8( KTestAttContTypeParamValue, "ContTypeParamValue" );
+_LIT8( KTestAttXTypeParamName, "X-TypeParamName" );
+_LIT8( KTestAttXTypeParamValue, "X-TypeParamValue" );
+// -----------------------------------------------------
+_LIT8( KTestMessageClass,       "MESSAGE-CLASS" ); // X-Mms-Message-Class
+_LIT8( KTestDelivRepSendAllow,  "DELIV-REP-SEND-ALLOW" ); // X-Mms-Report-Allowed
+_LIT8( KTestAcceptAdvertis,     "ACCEPT-ADVERTISEMENTS" );
+_LIT8( KTestRetryCount,         "RETRY-COUNT" );
+_LIT8( KTestRetryInterval,      "RETRY-INTERVAL" );
+// -------------------------------------------------
+_LIT8( KTestAlias,				"ALIAS" );
+_LIT8( KTestFromAlias,			"FROMALIAS" );
+_LIT8( KTestToAlias,			"TOALIAS" );
+_LIT8( KTestCcAlias,			"CCALIAS" );
+_LIT8( KTestBccAlias,			"BCCALIAS" );
+// -------------------------------------------------
+// more Message headers to allow testing all possible PDUs and
+// MMS 1.1 headers
+_LIT8( KTestReplyCharging,      "REPLY-CHARGING" ); // X-Mms-Reply-Charging
+_LIT8( KTestReplyChargAbs,      "REPLY-CHARG-DEADLINE-ABS" ); // X-Mms-Reply-Charging, absolute
+_LIT8( KTestReplyChargRel,      "REPLY-CHARG-DEADLINE-REL" ); // X-Mms-Reply-Charging, relative
+_LIT8( KTestReplyChargSize,     "REPLY-CHARG-SIZE" ); // X-Mms-Reply-Charging-Size (octets)
+_LIT8( KTestReplyChargID,       "REPLY-CHARGING-ID" ); // X-Mms-Reply-Charging-ID
+_LIT8( KTestTID,                "TID" );
+_LIT8( KTestContentLocation,    "CONTLOC" ); // X-Mms-Content-Location
+// The following three must appear as triplets.
+// index must be first, address and date may appear in any order
+_LIT8( KTestPreviouslySentIndex, "PREVIOUSINDEX" ); // forwarded count for X-Mms-PreviouslySent headers
+_LIT8( KTestPreviouslySentBy,    "PREV-SENT-BY" ); // X-Mms-Previously-Sent-By
+_LIT8( KTestPreviouslySentDate,  "PREV-SENT-DATE" ); // X-Mms-Previously-Sent-Date
+//---
+_LIT8( KTestMessageId,           "MESSAGE-ID" ); // Message-ID
+_LIT8( KTestMessageSize,         "MESSAGE-SIZE" ); // X-Mms-Message-Size (octets)
+_LIT8( KTestVersion,             "MMS-VERSION" ); // X-MMS-Version (hex:, 10 = 1.0, 11 = 1.1 etc. )
+_LIT8( KTestReadStatus,          "READ-STATUS" ); // X-Mms-Read-Status
+_LIT8( KTestResponseStatus,      "RESPONSE-STATUS" ); // X-Mms-Response-Status
+_LIT8( KTestResponseText,        "RESPONSE-TEXT" ); // X-Mms-Response-Text
+_LIT8( KTestRetrieveStatus,      "RETRIEVE-STATUS" ); // X-Mms-Retrieve-Status
+_LIT8( KTestRetrieveText,        "RETRIEVE-TEXT" ); // X-Mms-Retrieve-Text
+_LIT8( KTestStatus,              "STATUS" ); // X-Mms-Status
+// -------------------------------------------------
+// MMS 1.2 headers
+_LIT8( KTestAttribute,          "ATTRIBUTE" ); // X-Mms-Attribute
+// The value should be one of the following:
+// BCC, CC, CONTENT, CONTENT-TYPE, DATE, DELIVERY-REPORT, DELIVERY-TIME-ABS,
+// EXPIRY-ABS, FROM, MESSAGE-CLASS, MESSAGE-ID, MESSAGE-SIZE, PRIORITY,
+// READ-REPLY, SUBJECT, TO, REPLY-CHARGING, REPLY-CHARGING-ID,
+// REPLY-CHARG-DEADLINE-ABS, REPLY-CHARG-SIZE, PREV-SENT-BY,
+// PREV-SENT-DATE, ADDITIONAL-HEADERS
+_LIT8( KTestDistributionIndicator,  "DISTRIBUTION-INDICATOR" ); // X-Mms-Distribution-Indicator
+_LIT8( KTestLimit,              "LIMIT" ); // X-Mms-Limit
+_LIT8( KTestMessageQuota,       "MESSAGE-QUOTA" ); // X-Mms-Mbox-Quota, message number
+_LIT8( KTestSizeQuota,          "SIZE-QUOTA" ); // X-Mms-Mbox-Quota, size quota
+_LIT8( KTestMessageTotal,       "MESSAGE-TOTAL" ); // X-Mms-Mbox-Totals, message number
+_LIT8( KTestSizeTotal,          "SIZE-TOTAL" ); // X-Mms-Mbox-Totals, total size
+_LIT8( KTestMessageCount,       "MESSAGE-COUNT" ); // X-Mms-Message-Count
+_LIT8( KTestAddKeyword,         "ADD-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestRemoveKeyword,      "REMOVE-KEYWORD" ); // X-Mms-MM-Flags
+_LIT8( KTestFilterKeyword,      "FILTER-KEYWORD" ); // X-Mms-MM-FLags
+_LIT8( KTestMMState,            "MESSAGE-STATE" ); // X-Mms-MM-State
+_LIT8( KTestQuota,              "QUOTA" ); // X-Mms-Quotas
+_LIT8( KTestStart,              "START" ); // X-Mms-Start
+_LIT8( KTestStore,              "STORE" ); // X-Mms-Store
+_LIT8( KTestStored,             "STORED" ); // X-Mms-Stored
+_LIT8( KTestStoreStatus,        "STORE-STATUS" ); // X-Mms-Store-Status
+_LIT8( KTestStoreStatusText,    "STORE-STATUS-TEXT" ); // X-Mms-Store-Status-Text
+_LIT8( KTestTotals,             "TOTALS" ); // X-Mms-Totals
+// Delete confirmation header structure
+// This consists of index, content location, response status and response status text.
+// All three values are not always necessary for each index, but at least content-location
+// and response status should be present.
+// The index retains its value until a new index is encountered.
+_LIT8( KTestDeleteInfoIndex,    "DELETESTATUSINDEX" ); // index for next delete info fields
+// This header must precede content-location, response-status and response-text fields
+// in a delete confirmation. Index retains its value until a new index is encountered.
+
+// Element descriptor header not implemented
+
+// Application id headers
+// These will officially be supported in MMS encapsulation version 1.3
+// Java has non-standard support even earlier
+
+_LIT8( KTestApplicId,            "APPLIC-ID" ); // X-Mms-Applic-ID
+_LIT8( KTestReplyApplicId,       "REPLY-APPLIC-ID" ); // X-Mms-Reply-Applic-ID
+_LIT8( KTestApplicInfo,          "AUX-APPLIC-INFO" ); // X-Mms-Aux-Applic-Info
+
+// Since Encapsulation 1.3
+_LIT8( KTestContentClass,        "CONTENT-CLASS" ); // X-Mms-Content-Class
+_LIT8( KTestDrmContent,          "DRM-CONTENT" ); // X-Mms-DRM-Content
+_LIT8( KTestAdaptationAllowed,   "ADAPTATION-ALLOWED" ); // X-Mms-Adaptation-Allowed
+_LIT8( KTestRecommendedRetrievalMode, "REC-RETRIEVAL-MODE" ); // X-Mms-Recommended-Retrieval-Mode
+_LIT8( KTestRecRetrievalModeText, "REC-RETR-MODE-TEXT" ); // X-Mms-Recommended-Retrieval-Mode-Text
+_LIT8( KTestReplaceId,           "REPLACE-ID" ); // X-Mms-Replace-ID
+_LIT8( KTestStatusText,          "STATUS-TEXT" ); // X-Mms-Status-Text
+_LIT8( KTestCancelId,            "CANCEL-ID" ); // X-Mms-Cancel-ID
+_LIT8( KTestCancelStatus,        "CANCEL-STATUS" ); // X-Mms-Cancel-Status
+
+// DATA TYPES
+#define aSet            1
+#define aReset          0
+#define PartCount      100
+#define MaxAttaCount   10
+#define DefaultBufLen 256
+#define MaxRecipients   5
+
+// status returned by ReadRow
+enum TTestReadStatus
+    {
+    ETestUnknown,
+    ETestNewMessage,
+    ETestNewAttachment,
+    ETestEof,    // End of file
+    ETestMessageType,
+    ETestDate,
+    ETestFrom,
+    ETestTo,
+    ETestCc,
+    ETestBcc,
+	ETestAlias,
+	ETestFromAlias,
+	ETestToAlias,
+	ETestCcAlias,
+	ETestBccAlias,
+    ETestSubject,
+    ETestExpiryRel,
+    ETestExpiryAbs,
+    ETestDeliveryTimeRel,
+    ETestDeliveryTimeAbs,
+    ETestPriority,
+    ETestSenderVisibility,
+    ETestDeliveryReport,
+    ETestReadReply,
+    ETestAttachmentType,
+//    ETestAttachmentName,
+    ETestAttachmentCharset,
+    ETestAttachmentCid,
+	ETestAttachmentRoot,
+    ETestSettings,
+    ETestMessageClass,
+    ETestDelivReportSendAllow,
+    ETestSingleMessageClass,
+    ETestReplyCharging,
+    ETestReplyChargAbs,
+    ETestReplyChargRel,
+    ETestReplyChargSize,
+    ETestReplyChargID,
+    ETestTID,
+    ETestContentLocation,
+    ETestPreviouslySentIndex,
+    ETestPreviouslySentBy,
+    ETestPreviouslySentDate,
+    ETestMessageId,
+    ETestMessageSize,
+    ETestVersion,
+    ETestReadStatus,
+    ETestResponseStatus,
+    ETestResponseText,
+    ETestRetrieveStatus,
+    ETestRetrieveText,
+    ETestStatus,
+    ETestAttribute,
+    ETestDistributionIndicator,
+    ETestLimit,
+    ETestMessageQuota,
+    ETestSizeQuota,
+    ETestMessageTotal,
+    ETestSizeTotal,
+    ETestMessageCount,
+    ETestAddKeyword,
+    ETestRemoveKeyword,
+    ETestFilterKeyword,
+    ETestMMState,
+    ETestQuota,
+    ETestStart,
+    ETestStore,
+    ETestStored,
+    ETestStoreStatus,
+    ETestStoreStatusText,
+    ETestTotals,
+    ETestDeleteInfoIndex,
+    ETestApplicId,
+    ETestReplyApplicId,
+    ETestApplicInfo,
+    ETestContentClass,
+    ETestDrmContent,
+    ETestAdaptationAllowed,
+    ETestRecommendedRetrievalMode,
+    ETestRecRetrievalModeText,
+    ETestReplaceId,
+    ETestStatusText,
+    ETestCancelId,
+    ETestCancelStatus,
+    ETestAttaRecommendedName,
+    ETestAttachmentContLoc,
+    ETestAttContTypeParamName,
+    ETestAttContTypeParamValue,
+    ETestAttXTypeParamName,
+    ETestAttXTypeParamValue
+
+    };
+
+// VALUE KEYWORDS
+_LIT( KPersonal,      "Personal" );
+_LIT( KAdvertisement, "Advertisement" );
+_LIT( KInformational, "Informational" );
+_LIT( KAuto,          "Auto" );
+_LIT( KLow,    "Low" );
+_LIT( KNormal, "Normal" );
+_LIT( KHigh,   "High" );
+_LIT( KHide,   "Hide" );
+_LIT( KShow,   "Show" );
+_LIT( KYes,    "Yes" );
+_LIT( KNo,     "No" );
+_LIT( KOn,     "On" );
+_LIT( KOff,     "Off" );
+_LIT( KDeferred, "Deferred" );
+_LIT( KExpired,  "Expired" );
+_LIT( KRetrieved, "Retrieved" );
+_LIT( KRejected, "Rejected" );
+_LIT( KUnrecognized, "Unrecognized" );
+_LIT( KIndeterminate, "Indeterminate" );
+_LIT( KForwarded, "Forwarded" );
+_LIT( KUnreachable, "Unreachable" );
+_LIT( KDraft, "Draft");
+_LIT( KSent, "Sent" );
+_LIT( KNew, "New" );
+// X-Mms-Message-Type
+_LIT( KSendReq, "SendReq" );
+_LIT( KSendConf, "SendConf" );
+_LIT( KNotifInd, "NotifInd" );
+_LIT( KNotifResp, "NotifResp" );
+_LIT( KRetrConf, "RetrConf" );
+_LIT( KAckInd, "AckInd" );
+_LIT( KDelInd, "DelInd" );
+_LIT( KReadReqInd, "ReadReqInd" );
+_LIT( KReadOrigInd, "ReadOrigInd" );
+_LIT( KForwardRec, "ForwardReq" );
+_LIT( KForwardConf, "ForwardConf" );
+_LIT( KMBoxStoreReq, "MBoxStoreReq" );
+_LIT( KMBoxStoreConf, "MBoxStoreConf" );
+_LIT( KMBoxViewReq, "MBoxViewReq" );
+_LIT( KMBoxViewConf, "MBoxViewConf" );
+_LIT( KMBoxUploadReq, "MBoxUploadReq" );
+_LIT( KMBoxUploadConf, "MBoxUploadConf" );
+_LIT( KMBoxDeleteReq, "MBoxDeleteReq" );
+_LIT( KMBoxDeleteConf, "MBoxDeleteConf" );
+_LIT( KMBoxDescr, "MBoxDescr" );
+_LIT( KDeleteReq, "DeleteReq" );
+_LIT( KDeleteConf, "DeleteConf" );
+_LIT( KCancelReq, "CancelReq" );
+_LIT( KCancelResp, "CancelConf" );
+// X-Mms-Read-Status
+_LIT( KRead, "Read" );
+_LIT( KDelNotRead, "DeletedNotRead" );
+// X-Mms-Reply-Charging
+_LIT( KRequested, "Requested" );
+_LIT( KReqTextOnly, "ReqTextOnly" );
+_LIT( KAccepted, "Accepted" );
+_LIT( KAccTextOnly, "AccTextOnly" );
+// X-Mms-Cancel-Status (only receival of request, not actual cancellation)
+_LIT( KCancelSuccessful, "CancelSuccess" );
+_LIT( KCancelCorrupted, "CancelCorrupted" );
+// X-Mms-Content-Class
+_LIT( KText, "Text" );
+_LIT( KImageBasic, "ImageBasic" );
+_LIT( KImageRich, "ImageRich" );
+_LIT( KVideoBasic, "VideoBasic" );
+_LIT( KVideoRich, "VideoRich" );
+_LIT( KMegaPixel, "MegaPixel" );
+_LIT( KContentBasic, "ContentBasic" );
+_LIT( KContentRich, "ContentRich" );
+// X-Mms-Recommended-Retrieval-Mode
+_LIT( KManual, "Manual" );
+
+//X-Mms-ResponseStatus
+// legacy values
+_LIT( KOk, "OK" );
+_LIT( KErrUnspecified, "Unspecified" );
+_LIT( KErrServiceDenied, "ServiceDenied" );
+_LIT( KErrMessageFormatCorrupt, "FormatCorrupt" );
+_LIT( KErrAddressUnresolved, "AddressUnresolved" );
+_LIT( KErrMessageNotFound, "MessageNotFound" );
+_LIT( KErrNetworkProblem, "NetworkProblem" );
+_LIT( KErrContentNotAccepted, "ContentNotAccepted" );
+_LIT( KErrUnsupportedMessage, "UnsupportedMessage" );
+// values since 1.1 (and 1.2)
+_LIT( KErrTransient, "TransientFailure" );
+_LIT( KErrTransientAddressUnresolved, "TransientAddressUnresolved" );
+_LIT( KErrTransientNotFound, "TransientMessageNotFound" );
+_LIT( KErrTransientNetworkproblem, "TransientNetworkProblem" );
+_LIT( KErrTransientPartialSuccess, "PartialSuccess" );
+_LIT( KErrPermanent, "PermanentFailure" );
+_LIT( KErrPermanentServiceDenied, "PermanentServiceDenied" );
+_LIT( KErrPermanentMessageFormatCorrupt, "PermanentFormatCorrupt" );
+_LIT( KErrPermanentAddressUnresolved, "PermanentAddressUnresolved" );
+_LIT( KErrPermanentNotFound, "PermanentMessageNotFound" );
+_LIT( KErrPermanentContentNotAccepted, "PermanentContentNotAccepted" );
+_LIT( KErrReplyChargingLimitNotMet, "ReplyChargingLimitNotMet" );
+_LIT( KErrReplyChargingRequestNotAccepted, "ReplyChargingRequestNotAccepted" );
+_LIT( KErrReplyChargingForwardingDenied, "ReplyChargingForwardingDenied" );
+_LIT( KErrReplyChargingNotSupported, "ReplyChargingNotSupported" );
+_LIT( KErrAddressHidingNotSupported, "AddressHidingNotSupported" );
+_LIT( KErrPermanentLackOfPrepaid, "PermanentLackOfPrepaid" );
+//X-Mms-RetrieveStatus (one extra value)
+_LIT( KErrRetrieveContentUnsupported, "PermanentContentUnsupported" );
+//X-Mms-Store-Status (one extra value)
+_LIT( KErrMMBoxFull, "MMBoxFull" );
+
+_LIT8( KTestContent,  "Content" ); // For attribute list only
+_LIT8( KTestAdditionalHeaders,  "ADDITIONAL-HEADERS" ); // For attribute list only
+_LIT8( KTestDeliveryTime,       "DELIVERY-TIME"); // for attribute list only
+_LIT8( KTestExpiry,             "EXPIRY"); // for attribute list only
+_LIT8( KTestReplyCharg,         "REPLY-CHARG-DEADLINE" ); // for attribute list only
+_LIT8( KTestContentType,        "CONTENT-TYPE" );  // for attribute list only
+
+/**
+*  CMmsReadFile
+*/
+NONSHARABLE_CLASS( CMmsReadFile ):public CBase
+    {
+    public:  // Constructors and destructor
+
+        static CMmsReadFile* NewL(RFs& aFs, RFileReadStream& aReadStream ); // Two-phased constructor.
+        virtual ~CMmsReadFile(); // Destructor
+
+    public: // New functions
+
+        TInt CompleteTestL(TInt aMessageCounter, CMmsHeaders& aMmsHeaders);
+        TTestReadStatus ReadRowL();
+        void CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders );
+		TInt FindAlias(TPtrC alias);
+		void SetAttaStructure( TBool aOldAttaStructure = EFalse );
+
+    protected:  // Functions from base classes
+
+    private:
+
+        CMmsReadFile(); // C++ default constructor.
+        // By default constructor is private.
+        void ConstructL( RFs& aFs, RFileReadStream& aReadStream );
+        void Reset();
+
+    public: // data
+        TInt                            iMessageType;
+
+
+    private:     // Data
+
+        RFs                             iFs;
+        RFileReadStream*                iReader;
+        TBuf<DefaultBufLen>             iValueBuffer;
+        CDesCArray*     iAliasArray;    // aliases
+        HBufC8*         iByteBuffer;
+        TTime                           iDate;
+        CArrayPtrFlat<CMmsAttaStructure>* iAttaStructures;
+        TInt                            iAttaCount;
+		TInt							iAttaRoot;
+		TInt							iAliasCount;
+        TInt                            iNextMessageType;
+        TParse                          iParse;
+        TFileName                       iFilename;
+
+    protected:  // Data
+    private:    // Data
+
+        // CArrayFixFlat <TestMessage>* iMessages;
+
+    public:     // Friend classes
+    protected:  // Friend classes
+    private:    // Friend classes
+
+    };
+
+
+NONSHARABLE_CLASS( CMmsAttaStructure ):public CBase
+    {
+    public:  // Constructors and destructor
+        static CMmsAttaStructure* NewL(); // Two-phased constructor.
+        virtual ~CMmsAttaStructure(); // Destructor
+    private:
+        CMmsAttaStructure(); // C++ default constructor.
+        // By default constructor is private.
+        void ConstructL();
+
+    public:     // Data
+        HBufC8*         iAtta;
+        HBufC8*         iAttaName; // content location
+        HBufC8*         iAttaType;
+        HBufC8*         iAttaCid;
+        TInt            iAttaCharset;
+        HBufC*          iAttaRecommendedName; // recommended filename
+       	CDesC8ArrayFlat* iContentTypeParams;  // zero or more "parameter"
+    	CDesC8ArrayFlat* iXTypeParams;        // zero or more X-Type "parameters"
+
+    };
+
+
+#endif      // MMSREADFILE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,151 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSTESTBED_H
+#define MMSTESTBED_H
+
+#ifdef BUILD_MMSTESTBED_DLL
+#define MMSTESTBED_EXPORT Q_DECL_EXPORT
+#else
+#define MMSTESTBED_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QString>
+
+#include <msvids.h>  //for consts like KMsvNullIndexEntryIdValue
+#include <MSVAPI.H>
+#include <MTCLREG.H>
+#include <mmsclient.h>
+//#include <mmsservercommon.h>
+
+class CTestUiTimer;
+class CMsvSession;
+class CMmsClientMtm;
+class CMmsSettings;
+class CMmsHeaders;
+class CLogEvent;
+class CLogViewEvent;
+class CLogFilter;
+class CLogClient;
+
+class MMSTESTBED_EXPORT MmsTestBed : public QObject, public MMsvSessionObserver
+    {
+    Q_OBJECT
+
+public:
+    /**
+     *
+     */
+    MmsTestBed();
+    ~MmsTestBed();
+    void setConnectionLocal(bool value);
+    void fromOutboxToMmsc();
+    void fromMmscToInbox();
+    /**
+     * cleanup MMS service
+     */
+    void cleanupAndCreateNewService();
+    void deleteNotifications();
+    void restoreFactorySettings();
+    void setFetchingState( TMmsReceivingMode aState );
+    void sendFromFile();
+    void sendOneByOne();
+    void sendNotifications();
+    void copyDrafts();
+    void garbageCollection(TUint32 aReason = 0x00000001); //0x00000001 == KMmsReasonBoot
+    void messageVariation();
+    void cancelSendScheduling();
+    void scheduledSend(TMsvId aBoxId, TInt aDelay = 5);
+    void deleteSendSchedule();
+    void cancelFetchScheduling();
+    void fetchForced(TInt aDelay = 5);
+    void deleteFetchSchedule();
+    void doAFetchCycle();
+    void createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry);
+    void cleanOutbox();
+    void cleanInbox();
+    void cleanSent();
+    void cleanDrafts();
+    void cleanAll();
+    void reply();
+    void replyToAll();
+    void forward();
+    void sendReadReport(); // send a read report
+    int fromOutboxToMmscWithMemoryFailure(); // returns memory failure count
+    int fromMmscToInboxWithMemoryFailure(); // returns memory failure count
+    void sendViaClient();
+    void scheduledFetch(TInt aDelay = 5);
+    void fetchForcedImmediate();
+    void getEventType();
+    void addEventType();
+    void deleteEventType();
+    void cleanLog();
+    void setOnline(bool value);
+    void generateDeliveryReport( CMmsHeaders* aMmsHeaders );
+    void sendDeliveryReport();
+
+signals:
+    void entryCreatedInDraft(long int id);
+    void entryMovedToOutbox(long int id);
+    void entryMovedToSent(long int id);
+    void entryCreatedInInbox(long int id);
+
+protected:
+    /**
+     * From MMsvSessionObserver
+     */
+    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+            TAny* aArg2, TAny* aArg3);
+
+private:
+    void findDefaultL();
+    void createMmsService();
+    void cleanup();
+    void deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry);
+    void testFile(TFileName& aFilePath, TInt aCommand = 0, TMsvId aBox = KMsvGlobalOutBoxIndexEntryId);
+    void addMMBoxDescriptions();
+    void encodeMessageFromDrafts();
+    TMsvId findMMSFolder();
+    bool checkLogClient();
+    int getLogEntries();
+
+private:
+    //data
+    CTestUiTimer* iTimer;
+    CMsvOperationActiveSchedulerWait* iWait;
+    CMsvSession* iSession;
+    CClientMtmRegistry* iClientMtmRegistry;
+    CMmsClientMtm* iMmsClient;
+    CMmsSettings* iSettings;
+    CMmsHeaders* iMmsHeaders;
+    TMsvId iServiceId;
+    TMsvId iDefaultServiceId;
+    TMsvSessionEvent iEvent;
+    RFs iFs;
+    TFileName iFilename;
+    TFileName iCurrentFile;
+    TFileName iCurrentPath;
+    TParse iParse;     // parse buffer as member to save stack space
+    CBufFlat* iEncodeBuffer;
+    CMsvEntrySelection* iMsvEntrySelection;
+    CLogEvent* iLogEvent;
+    CLogClient* iLogClient;
+    CLogViewEvent* iLogView;
+    CLogFilter* iLogFilter;
+    };
+
+#endif // MMSTESTBED_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestbed.hrh	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,131 @@
+/*
+ * 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:
+ */
+
+#include <bldvariant.hrh>
+
+
+#ifndef MMSTESTBED_HRH
+#define MMSTESTBED_HRH
+
+enum
+{
+    EAppMainOk = 1,
+    EAppMainCancel,
+    //
+    EMenufrmCmdCascadeTest,
+    ECleanup,
+    ECleanOutbox,
+    ESaveSettings,
+    ELoadSettings,
+    ECleanInbox,
+    EShowIn,
+    EShowOut,
+    EOutToMMSC,
+    EMMSCToIn,
+    ESendScheduled,
+    EReceiveScheduled,
+    EShowSent,
+    ECleanSent,
+    EStartMyNotifier,
+    EGetEventType,
+    EAddEventType,
+    EDeleteEventType,
+    EViewLog,
+    ECleanLog,
+    EShowWapAccessPoints,
+    ESelectWapAccessPoint,
+    EShowConnectionMode,
+    EShowIAP,
+    EConnectToIAP,
+    EDeleteSendSchedule,
+    EDeleteReceiveSchedule,
+    EDeleteNotifications,
+    ERestoreFactorySettings,
+    ECreateFromFile,
+    EShowNotifications,
+    ESendDeliveryReport,
+    EShowDrafts,
+    ECleanDrafts,
+    ECleanAll,
+    EFetchingDeferred,
+    EFetchingOn,
+    ESendFromFile,
+    ESwitchToLocal,
+    ESwitchToGlobal,
+    EDecodeLoggingOn,
+    EDecodeLoggingOff,
+    EBinaryDumpOn,
+    EBinaryDumpOff,
+    ESendNotification,
+    ECreateToInbox,
+    ECreateToSentItems,
+    ESendFromDrafts,
+    EFindMMSFolder,
+    ESendOneByOne,
+    ECreateToDrafts,
+    ESendViaClient,
+    ESendMemFail,
+    EFetchMemFail,
+    EReceiveForced,
+    ECreateHeadersFromFile,
+    ESwitchToOffline,
+    ESwitchToOnline,
+    ECopyDrafts,
+    ECreateNotification,
+    EReply,
+    EReplyToAll,
+    EForward,
+    EFetchingManual,
+    EFirstBoot,
+    ENoFirstBoot,
+    EFindNetworkStatus,
+    ESendReadReport,
+    ECreateMMBoxViewConf,
+    EGetMMBoxView,
+    ECleanMMBox,
+    EShowMMBox
+};
+
+#define 	ETestLabel1 1
+#define 	ETestLabel2 2
+#define 	ETestLabel3 3
+#define 	ETestLabel4 4
+
+#define     EServiceList 2
+
+
+enum TTestBedDlgCtrlIds
+	{
+	ETestEditField = 1
+	};
+
+enum TEditServiceControls
+	{
+	EFolderLabel = 1,
+    EEditUri
+//	EEditServiceFolder,
+//	ENameLabel,
+//	EEditServiceName,
+//	ENumberLabel,
+//	EEditServiceNumber
+	};
+
+enum
+	{
+	EFsViewDialogId = 1
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmsteststaticutils.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,203 @@
+/*
+ * 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:
+ */
+
+#ifndef MMSTESTSTATICUTILS_H
+#define MMSTESTSTATICUTILS_H
+
+#include <e32std.h>
+#include <msvstd.h>
+#include <badesca.h>
+
+#include "mmsconst.h"
+
+class RFs;
+class CMsvSession;
+class CMmsEncode;
+class CMmsHeaders;
+
+#ifdef __WINS__
+_LIT( KRootPath, "c:\\" );
+#else
+// This is removable disk.
+// drive letter should not be hard coded, must be investigated further
+// We use c: for a while for the tests (to be cahnged later)
+_LIT( KRootPath, "c:\\" );
+//_LIT( KRootPath, "e:\\" );
+#endif
+
+// directory where mmbox descriptions are created
+_LIT( KMmsMMBoxDescriptionDirectory, "C:\\mmsmmboxdescriptions\\");
+// directory where created headers are dumped
+_LIT( KMmsDumpDirectory, "C:\\mmsdump\\");
+// content type of MMS PDUs
+_LIT8( KMmsMimeType, "application/vnd.wap.mms-message" );
+
+_LIT( KWild, "*" );
+
+
+/**
+ *  joined array structure
+ *
+ */
+NONSHARABLE_CLASS( TMmsJoinedArrays ): public MDesCArray
+    {
+public:
+    TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2);
+    TInt MdcaCount() const;
+    TPtrC16 MdcaPoint(TInt aIndex) const;
+private:
+    CDesCArray* const & iArray1;
+    CDesCArray* const & iArray2;
+    };
+
+/**
+ *  static utility functions
+ *
+ */
+class TMmsTestUtils
+    {
+
+public:
+
+    /**
+     *
+     */
+    TMmsTestUtils();
+
+    /**
+     * read phone number for sending messages
+     *
+     * @param aFileName full path for filename
+     * @param aFs file system handle
+     * @return allocated pointer containing the name
+     *     The caller must delete the pointer when no longer needed
+     */
+    static HBufC* ReadContactFromFileL( TDesC& aFileName, RFs& aFs );
+
+    static void DecodeLoggingOnL();
+    static void DecodeLoggingOffL();
+    static void BinaryDumpOnL();
+    static void BinaryDumpOffL();
+
+    /**
+     * Clean all temporary directories used in local mode.
+     * Does not delete the directories, only the contents
+     *
+     * @param aFs file system handle
+     */
+    static void CleanDirectoryL( RFs& aFs );
+
+    /**
+     * Dump a binary message
+     *
+     * @param aBuffer buffer containing the binary message
+     * @param aFilename full path of the directory whenre the dump goes
+     * @param aParse reference to parser (to save stack space)
+     * @param aFs file system handle
+     */
+    static void Dump(
+        CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs );
+
+    /**
+     * Delete all MMS messages and notifications from a given folder
+     *
+     * @param aBoxId folder id
+     * @param aSession Messaging server session
+     */
+    static void CleanBoxL(TMsvId aBoxId, CMsvSession& aSession);
+
+    /**
+     * turn on logging messages sent to email addresses
+     */
+    static void EmailLoggingOnL();
+
+    /**
+     * turn off logging messages sent to email addresses
+     */
+    static void EmailLoggingOffL();
+
+    /**
+     * load list of children into selection and return count
+     *
+     * @param aBoxId folder id
+     * @param aMsvEntrySelection reference to a pointer that will contain the list of child ids
+     *     caller is responsible of deleting the pointer afterwards.
+     *     Pointer may be NULL at entry, and a new pointer will be allocated
+     * @param aSession messge server session
+     * @param aMessageType child MTM type, default is multimedia message
+     * @return number of entries in selection
+     */
+    static TInt CountChildrenL(
+        TMsvId aBoxId,
+        CMsvEntrySelection*& aMsvEntrySelection,
+        CMsvSession& aSession,
+        TUid aMessageType = KUidMsgTypeMultimedia);
+
+    /**
+     * Create a folder entry
+     *
+     * @param aSession messge server session
+     * @param aParentFolder the parent folder
+     * @param aFolderName name of the folder
+     * @param aFolderId will contain the if of the new folder if creation was successful
+     */
+    static void CreateFolderEntryL(
+        CMsvSession& aSession,
+        TMsvId aParentFolder,
+        const TDesC& aFolderName,
+        TMsvId& aFolderId );
+
+    /**
+    * Create an MMS notification from data in buffer
+    * @param aNotificationFolder mms notification folder (target folder)
+    * @param aServiceId id of MMS service
+    * @param aEncodeBuffer buffer that contains the data
+    * @param aSession message server session
+    * @return id of the created notification
+    */
+    static TMsvId CreateNotificationEntryL(
+        TMsvId aNotificationFolder,
+        TMsvId aServiceId,
+        CBufFlat* aEncodeBuffer,
+        CMsvSession& aSession );
+
+    /**
+    * Encode an MMS notification into buffer
+    * @param aUrl url of the notification for local messages a filepath
+    * @param aSize size of the message
+    * @param aMmsHeaders MMS headers structure for creating the notification
+    * @param aMmsEncoder reference to CMmsEncode class
+    * @param aEncodeBuffer flat buffer that will contain the encoded notification
+    */
+    static void FormNotification(
+        TDesC8& aUrl,
+        TInt aSize,
+        CMmsHeaders& aMmsHeaders,
+        CMmsEncode& aMmsEncoder,
+        CBufFlat* aEncodeBuffer );
+
+
+    static TBool IsDrive(const TDesC& aFileName);
+    static TBool IsDir(const TDesC& aFileName, RFs& aFs);
+    static TBool IsFile(const TDesC& aFileName, RFs& aFs);
+
+
+private:
+
+    };
+
+
+#endif // MMSTESTSTATICUTILS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/inc/mmstestuitimer.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,51 @@
+/*
+ * 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:
+ */
+
+#ifndef C_TESTUITIMER_H
+#define C_TESTUITIMER_H
+
+
+#include <e32base.h>
+
+#define KPeriod 10000 // period of timer
+
+/**
+ *  timer for test programs
+ */
+NONSHARABLE_CLASS( CTestUiTimer ): public CTimer
+    {
+public:
+
+    static CTestUiTimer* NewL();
+    virtual  ~CTestUiTimer();
+
+    void RunL();
+    void DoCancel();
+    void ConstructL();
+    void IssueRequest();
+    void TimeoutOperation(CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds);
+
+private:
+    CTestUiTimer();
+
+public:
+    TTimeIntervalMicroSeconds32 period;
+
+private: // data
+    CActive* iObject;
+    };
+
+#endif // C_TESTUITIMER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/mmstestbed.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,77 @@
+#
+# 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:
+#
+
+QT += testlib
+QT -= gui
+
+TEMPLATE = lib
+
+TARGET = mmstestbed
+
+INCLUDEPATH += .
+INCLUDEPATH += inc
+INCLUDEPATH += ../../inc
+INCLUDEPATH += ../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmshttptransport/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsconninit/inc
+#INCLUDEPATH += ../../../mmsengine/mmscodec/inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsserver/inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+DEFINES += BUILD_MMSTESTBED_DLL
+
+SOURCES += src/mmstestbed.cpp \
+           src/mmsteststaticutils.cpp \
+           src/mmsreadfile.cpp \
+           src/mmstestuitimer.cpp
+
+HEADERS += inc/mmstestbed.h \
+           inc/mmsteststaticutils.h \
+           inc/mmsreadfile.h \
+           inc/mmstestuitimer.h \
+           inc/mmstestbed.hrh
+
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+symbian {
+    TARGET.CAPABILITY = CAP_GENERAL_DLL
+    TARGET.EPOCSTACKSIZE = 0x8000
+    TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
+    TARGET.EPOCALLOWDLLDATA = 1 
+	}
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+     "$${LITERAL_HASH}include <platform_paths.hrh>"
+
+LIBS += -lmsgs \
+        -lmmsmessage \
+        -lmmsconninit \
+        -lmmscodec \
+        -lmmsserversettings \
+        -lcentralrepository \
+        -lapparc \
+        -lbafl \
+        -lefsrv \
+        -lesock \
+        -lestor \
+        -leuser \
+        -llogcli \
+        -llogwrap \
+        -lapgrfx \
+        -lapmime
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsreadfile.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,1799 @@
+/*
+ * 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:
+ */
+
+// INCLUDE FILES
+#include    <e32base.h>
+#include    <badesca.h>
+#include    <e32def.h>
+#include    <s32file.h>
+#include    <msvids.h>
+#include    <mtmdef.h>
+//#include    <eikenv.h>
+#include    <apgcli.h>
+#include    <CMsvMimeHeaders.h>
+#include    <AknNoteWrappers.h>
+
+#include    <mmsservercommon.h>
+#include    "mmsconst.h"
+#include    "mmsclient.h"
+#include    "mmsheaders.h"
+#include    "mmsreadfile.h"
+#include    "mmsmmboxviewheaders.h"
+#include    "mmsmmboxmessageheaders.h"
+#include    "mmsmmboxflags.h"
+#include    "mmssettings.h"
+
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+const TInt KMmsGranularity = 8;
+_LIT( K1970, "19700000:000000.000000" );    // 1-Jan 1970 0:00:00
+
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// ==================== LOCAL FUNCTIONS ====================
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsReadFile::CMmsReadFile()
+    {
+    // all member variables in a class derived from CBase
+    // are automatically set to 0.
+    }
+
+
+//
+void CMmsReadFile::ConstructL(RFs& aFs, RFileReadStream& aReadStream )
+    {
+    // iRowBuffer = HBufC8::NewMaxL( 500 ); // Max row length!!!!
+    iFs = aFs;
+    iReader = &aReadStream;
+    iByteBuffer = HBufC8::NewL( DefaultBufLen );
+    iAliasArray = new ( ELeave ) CDesCArrayFlat( KMmsGranularity );
+    iAttaStructures = new ( ELeave ) CArrayPtrFlat<CMmsAttaStructure>( KMmsGranularity );
+    Reset();
+    }
+
+// Two-phased constructor.
+CMmsReadFile* CMmsReadFile::NewL(RFs& aFs, RFileReadStream& aReadStream )
+    {
+    CMmsReadFile* self = new ( ELeave ) CMmsReadFile();
+    CleanupStack::PushL( self );
+    self->ConstructL( aFs, aReadStream );
+    CleanupStack::Pop();
+    return self;
+    }
+
+
+// Destructor
+CMmsReadFile::~CMmsReadFile()
+    {
+    Reset(); // resets and destroys all array data
+    if (iAliasArray != NULL) iAliasArray->Reset();
+    delete iByteBuffer;
+    delete iAliasArray;
+    delete iAttaStructures;
+    }
+
+void CMmsReadFile::Reset()
+    {
+    // reset all arrays
+    if (iAttaStructures != NULL) iAttaStructures->ResetAndDestroy();
+    iAttaCount = 0;
+    iAttaRoot = 0;
+    }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CompleteTest
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::CompleteTestL( TInt aMessageCounter, CMmsHeaders& aMmsHeaders )
+{
+    Reset(); // new message
+
+    TUint32 val;
+    TUint   limit = 1000000;
+    TUint   sizeLimit = 1000 * 1024; //max message size 1000 kB!
+    TUint   allLimit = 999999;
+    TInt    error;
+    TRadix  radix = EDecimal;
+    TLex16  lex;
+    TTestReadStatus readStatus = ETestUnknown;
+    CMmsAttaStructure* oneAtta = NULL;
+	TInt    index;
+    TTime y1970( K1970 );
+    TTimeIntervalMicroSeconds interval;
+    TTime date;
+    TInt order = 0;
+    TInt16 shortInteger = 0;
+
+    //iso luuppi, joka kiert ja lukee kunnes EOF tule vastaan
+    //Big Loop, which passes around and read until the EOF
+
+    iMessageType = iNextMessageType;
+    while(readStatus != ETestEof)
+        {
+        readStatus = ReadRowL();
+        if ( readStatus ==  ETestEof )
+            {
+            return(-1);
+            }
+        if ( readStatus == ETestUnknown )
+            {
+            // A line containing only comments, or an unknown tag
+            // As using the scripts to test settings is no longer supported,
+            // any old keywords used to test CMmsSettings class are ignored
+            continue;
+            }
+        if( readStatus == ETestNewMessage )
+            {
+            iNextMessageType = readStatus;
+            if(aMessageCounter++)
+                {
+                return(NULL);
+                }
+            else
+                {
+                iMessageType = iNextMessageType;
+                continue;
+                }
+            }
+        if ( iMessageType == ETestNewMessage)
+            {
+            switch(readStatus)
+                {
+                case ETestFrom:
+                    aMmsHeaders.SetSenderL( iValueBuffer );
+                    break;
+                case ETestFromAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.SetSenderL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ) );
+	    				}
+                    break;
+                case ETestTo:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientTo );
+                    break;
+                case ETestToAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsTo );
+						}
+                    break;
+                case ETestCc:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientCc );
+                    break;
+                case ETestCcAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsCc );
+						}
+                    break;
+                case ETestBcc:
+                    aMmsHeaders.AddTypedAddresseeL( iValueBuffer, EMsvRecipientBcc );
+                    break;
+                case ETestBccAlias:
+					index = FindAlias(iValueBuffer);
+					if(index >= 0)
+    					{
+                        aMmsHeaders.AddTypedAddresseeL( iAliasArray->MdcaPoint(index).Mid(iAliasArray->MdcaPoint(index).Locate('=') + 1 ), EMmsBcc );
+						}
+                    break;
+                case ETestSubject:
+                    aMmsHeaders.SetSubjectL( iValueBuffer );
+                    break;
+                case ETestExpiryRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetExpiryInterval( val );
+                        }
+                    break;
+                case ETestExpiryAbs:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    // expiry date in seconds from 1.1.1970.
+                    aMmsHeaders.SetExpiryDate( (interval.Int64())/1000000 );
+                    break;
+                case ETestDeliveryTimeRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetDeliveryTimeInterval( val );
+                        }
+                    break;
+                case ETestDeliveryTimeAbs:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    aMmsHeaders.SetDeliveryDate( (interval.Int64())/1000000 );
+                    break;
+                case ETestDate:
+                    error = iDate.Set(iValueBuffer);
+                    interval = iDate.MicroSecondsFrom( y1970 );
+                    aMmsHeaders.SetDate( (interval.Int64())/1000000 );
+                case ETestPriority:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KLow)) == 0)
+                        {
+                        val = EMmsPriorityLow;
+                        }
+                    else if ((iValueBuffer.CompareF(KNormal)) == 0)
+                        {
+                        val = EMmsPriorityNormal;
+                        }
+                    else if ((iValueBuffer.CompareF(KHigh)) == 0)
+                        {
+                        val = EMmsPriorityHigh;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessagePriority( val );
+                    break;
+                case ETestSenderVisibility:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KHide)) == 0)
+                        {
+                        val = EMmsSenderVisibilityHide;
+                        }
+                    else if ((iValueBuffer.CompareF(KShow)) == 0)
+                        {
+                        val = EMmsSenderVisibilityShow;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetSenderVisibility( val );
+                    break;
+                case ETestDeliveryReport:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDeliveryReport( val );
+                    break;
+                case ETestDelivReportSendAllow:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReportAllowed( val );
+                    break;
+
+                case ETestReadReply:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = EMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = EMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReadReply( val );
+                    break;
+                case ETestNewAttachment:
+                    oneAtta = CMmsAttaStructure::NewL();
+                    iAttaStructures->AppendL(oneAtta);
+                    oneAtta->iAtta->Des().Copy( iValueBuffer );
+                    iAttaCount++;
+                    break;
+                case ETestAttachmentType:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaType->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttachmentContLoc:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaName->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttaRecommendedName:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaRecommendedName->Des().Copy( iValueBuffer );
+                        }
+                    break;
+                case ETestAttachmentCharset:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        if (oneAtta != NULL)
+                            {
+                            oneAtta->iAttaCharset = val;
+                            }
+                        }
+                    break;
+                case ETestAttachmentCid:
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iAttaCid->Des().Copy(iValueBuffer);
+                        }
+                    break;
+                case ETestAttContTypeParamName:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttContTypeParamValue:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iContentTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttXTypeParamName:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttXTypeParamValue:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if (oneAtta != NULL)
+                        {
+                        oneAtta->iXTypeParams->AppendL(iByteBuffer->Des());
+                        }
+                    break;
+                case ETestAttachmentRoot:
+                    iAttaRoot = iAttaCount;
+                    break;
+                case ETestAlias:
+                    // all aliases are global even if they appear
+                    // in the middle of a message
+                    iAliasArray->AppendL( iValueBuffer );
+                    iAliasCount++;
+				    break;
+                case ETestMessageClass: // should be handled!
+                    val = EMmsClassPersonal;
+                    if ((iValueBuffer.CompareF(KPersonal)) == 0)
+                        {
+                        val = EMmsClassPersonal;
+                        }
+                    else if ((iValueBuffer.CompareF(KAdvertisement)) == 0)
+                        {
+                        val = EMmsClassAdvertisement;
+                        }
+                    else if ((iValueBuffer.CompareF(KInformational)) == 0)
+                        {
+                        val = EMmsClassInformational;
+                        }
+                    else if ((iValueBuffer.CompareF(KAuto)) == 0)
+                        {
+                        val = EMmsClassAuto;
+                        }
+                    else
+                        {
+                        val = (TMmsMessageClass)KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessageClass( val );
+                    break;
+                case ETestReplyCharging:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KRequested)) == 0)
+                        {
+                        val = KMmsReplyChargingRequested;
+                        }
+                    else if ((iValueBuffer.CompareF(KReqTextOnly)) == 0)
+                        {
+                        val = KMmsReplyChargingRequestedTextOnly;
+                        }
+                    else if ((iValueBuffer.CompareF(KAccepted)) == 0)
+                        {
+                        val = KMmsReplyChargingAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KAccTextOnly)) == 0)
+                        {
+                        val = KMmsReplyChargingAcceptedTextOnly;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReplyCharging( val );
+                    break;
+                case ETestReplyChargAbs:
+                    error = date.Set(iValueBuffer);
+                    if ( error == KErrNone )
+                        {
+                        interval = date.MicroSecondsFrom( y1970 );
+                        aMmsHeaders.SetReplyChargingDate( (interval.Int64())/1000000 );
+                        }
+                    break;
+                case ETestReplyChargRel:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetReplyChargingInterval( val );
+                        }
+                    break;
+                case ETestReplyChargSize:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,sizeLimit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetReplyChargingSize( val );
+                        }
+                    break;
+                case ETestReplyChargID:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplyChargingIdL( iByteBuffer->Des() );
+                    break;
+                case ETestTID:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetTidL( iByteBuffer->Des() );
+                    break;
+                case ETestContentLocation:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteReq )
+                        {
+                        aMmsHeaders.MMBoxMessageHeadersL().ContentLocationList().AppendL( iByteBuffer->Des() );
+                        }
+                    else if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteContentLocationL( order, iByteBuffer->Des() );
+                        }
+                    else
+                        {
+                        aMmsHeaders.SetContentLocationL( iByteBuffer->Des() );
+                        }
+                    break;
+                case ETestPreviouslySentIndex:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    order = val;
+                    break;
+                case ETestPreviouslySentBy:
+                    aMmsHeaders.InsertPreviouslySentByL( order, iValueBuffer );
+                    break;
+                case ETestPreviouslySentDate:
+                    error = date.Set(iValueBuffer);
+                    if ( error == KErrNone )
+                        {
+                        interval = date.MicroSecondsFrom( y1970 );
+                        aMmsHeaders.InsertPreviouslySentDateL( order, (interval.Int64())/1000000 );
+                        }
+                    break;
+                case ETestMessageId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetMessageIdL( iByteBuffer->Des() );
+                    break;
+                case ETestMessageSize:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,sizeLimit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetMessageSize( val );
+                        }
+                    break;
+                case ETestVersion:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,EHex,limit);
+                    shortInteger = TInt16( val );
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.SetMmsVersion( shortInteger );
+                        }
+                    break;
+                case ETestReadStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KRead)) == 0)
+                        {
+                        val = KMmsReadStatusRead;
+                        }
+                    else if ((iValueBuffer.CompareF(KDelNotRead)) == 0)
+                        {
+                        val = KMmsReadStatusDeletedWithoutBeingRead;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetReadStatus( val );
+                    break;
+                case ETestResponseStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrUnspecified)) == 0)
+                        {
+                        val = KMmsErrorUnspecified;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMessageNotFound)) == 0)
+                        {
+                        val = KMmsErrorMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrNetworkProblem)) == 0)
+                        {
+                        val = KMmsErrorNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrContentNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorNoContentAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrUnsupportedMessage)) == 0)
+                        {
+                        val = KMmsErrorUnsupportedMessage;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorTransientSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+                        {
+                        val = KMmsErrorTransientMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentAddressUnresolved)) == 0)
+                        {
+                        val = KMmsErrorPermanentSendingAddressUnresolved;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentContentNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorPermanentContentNotAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingLimitNotMet)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingLimitationsNotMet;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingRequestNotAccepted)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingRequestNotAccepted;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingForwardingDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingForwardingDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrReplyChargingNotSupported)) == 0)
+                        {
+                        val = KMmsErrorPermanentReplyChargingNotSupported;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientPartialSuccess)) == 0)
+                        {
+                        val = KMmsErrorTransientPartialSuccess;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrAddressHidingNotSupported)) == 0)
+                        {
+                        val = KMmsErrorPermanentAddressHidingNotSupported;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteStatusL( order, val );
+                        }
+                    else
+                        {
+                         aMmsHeaders.SetResponseStatus( val );
+                        }
+                    break;
+                case ETestResponseText:
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMBoxDeleteConf )
+                        {
+                        aMmsHeaders.InsertDeleteResponseTextL( order, iValueBuffer );
+                        }
+                    else
+                        {
+                        aMmsHeaders.SetResponseTextL( iValueBuffer );
+                        }
+                    break;
+                case ETestRetrieveStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNotFound)) == 0)
+                        {
+                        val = KMmsErrorReceiveTransientMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorReceiveTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorReceivePermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrRetrieveContentUnsupported)) == 0)
+                        {
+                        val = KMmsErrorReceivePermanentContentUnsupported;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetResponseStatus( val );
+                    break;
+                case ETestRetrieveText:
+                    aMmsHeaders.SetResponseTextL( iValueBuffer );
+                    break;
+                case ETestStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KDeferred)) == 0)
+                        {
+                        val = KMmsMessageStatusDeferred;
+                        }
+                    else if ((iValueBuffer.CompareF(KExpired)) == 0)
+                        {
+                        val = KMmsMessageStatusExpired;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+                        {
+                        val = KMmsMessageStatusRetrieved;
+                        }
+                    else if ((iValueBuffer.CompareF(KRejected)) == 0)
+                        {
+                        val = KMmsMessageStatusRejected;
+                        }
+                    else if ((iValueBuffer.CompareF(KUnrecognized)) == 0)
+                        {
+                        val = KMmsMessageStatusUnrecognized;
+                        }
+                    else if ((iValueBuffer.CompareF(KIndeterminate)) == 0)
+                        {
+                        val = KMmsMessageStatusIndeterminate;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+                        {
+                        val = KMmsMessageStatusForwarded;
+                        }
+                    else if ((iValueBuffer.CompareF(KUnreachable)) == 0)
+                        {
+                        val = KMmsMessageStatusUnreachable;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetStatus( val );
+                    break;
+                case ETestMessageType:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KSendReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMSendReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KSendConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMSendConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KNotifInd)) == 0)
+                        {
+                        val = KMmsMessageTypeMNotificationInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KNotifResp)) == 0)
+                        {
+                        val = KMmsMessageTypeMNotifyRespInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMRetrieveConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KAckInd)) == 0)
+                        {
+                        val = KMmsMessageTypeAcknowledgeInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KDelInd)) == 0)
+                        {
+                        val = KMmsMessageTypeDeliveryInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KReadReqInd)) == 0)
+                        {
+                        val = KMmsMessageTypeReadRecInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KReadOrigInd)) == 0)
+                        {
+                        val = KMmsMessageTypeReadOrigInd;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwardRec)) == 0)
+                        {
+                        val = KMmsMessageTypeForwardReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwardConf)) == 0)
+                        {
+                        val = KMmsMessageTypeForwardConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxStoreReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxStoreReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxStoreConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxStoreConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxViewReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxViewReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxViewConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMboxViewConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxUploadReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxUploadReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxUploadConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxUploadConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDeleteReq)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDeleteReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDeleteConf)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDeleteConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KMBoxDescr)) == 0)
+                        {
+                        val = KMmsMessageTypeMBoxDescr;
+                        }
+                    else if ((iValueBuffer.CompareF(KDeleteReq)) == 0)
+                        {
+                        val = KMmsMessageTypeDeleteReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KDeleteConf)) == 0)
+                        {
+                        val = KMmsMessageTypeDeleteConf;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelReq)) == 0)
+                        {
+                        val = KMmsMessageTypeCancelReq;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelResp)) == 0)
+                        {
+                        val = KMmsMessageTypeCancelConf;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetMessageType( val );
+                    break;
+                case ETestAttribute:
+                    val = 0;
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    if ((iByteBuffer->Des().CompareF(KTestBcc)) == 0)
+                        {
+                        val = KMmsAssignedBcc;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestCc)) == 0)
+                        {
+                        val = KMmsAssignedCc;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestContent)) == 0)
+                        {
+                        val = KMmsAssignedContent;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestContentType)) == 0)
+                        {
+                        val = KMmsAssignedContentType;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDate)) == 0)
+                        {
+                        val = KMmsAssignedDate;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDeliveryReport)) == 0)
+                        {
+                        val = KMmsAssignedDeliveryReport;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestDeliveryTime)) == 0)
+                        {
+                        val = KMmsAssignedDeliveryTime;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestExpiry)) == 0)
+                        {
+                        val = KMmsAssignedExpiry;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestFrom)) == 0)
+                        {
+                        val = KMmsAssignedFrom;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageClass)) == 0)
+                        {
+                        val = KMmsAssignedMessageClass;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageId)) == 0)
+                        {
+                        val = KMmsAssignedMessageId;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestMessageSize)) == 0)
+                        {
+                        val = KMmsAssignedMessageSize;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPriority)) == 0)
+                        {
+                        val = KMmsAssignedPriority;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReadReply)) == 0)
+                        {
+                        val = KMmsAssignedReadReply;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestSubject)) == 0)
+                        {
+                        val = KMmsAssignedSubject;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestTo)) == 0)
+                        {
+                        val = KMmsAssignedTo;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyCharging)) == 0)
+                        {
+                        val = KMmsAssignedReplyCharging;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyChargID)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingID;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyCharg)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingDeadline;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestReplyChargSize)) == 0)
+                        {
+                        val = KMmsAssignedReplyChargingSize;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentBy)) == 0)
+                        {
+                        val = KMmsAssignedPreviouslySentBy;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestPreviouslySentDate)) == 0)
+                        {
+                        val = KMmsAssignedPreviouslySentDate;
+                        }
+                    else if ((iByteBuffer->Des().CompareF(KTestAdditionalHeaders)) == 0)
+                        {
+                        val = KMmsAssignedAdditionalHeaders;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().AttributeArray().InsertInOrder(val);
+                    break;
+                case ETestDistributionIndicator:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDistributionIndicator( val );
+                    break;
+                case ETestLimit:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if( error == KErrNone )
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsLimit(val);
+                        }
+                    break;
+                case ETestMessageQuota:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaNumber(val);
+                        }
+                    break;
+                case ETestSizeQuota:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxQuotaSize(val);
+                        }
+                    break;
+                case ETestMessageTotal:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalNumber(val);
+                        }
+                    break;
+                case ETestSizeTotal:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMMBoxTotalSize(val);
+                        }
+                    break;
+                case ETestMessageCount:
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(KMaxTUint32);
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if ( val > allLimit )
+                        {
+                        val = KMaxTUint32; // this is too hard to type, more than 999999 means "all"
+                        }
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsMessageCount(val);
+                        }
+                    break;
+                case ETestAddKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsAddToken, iValueBuffer);
+                    break;
+                case ETestRemoveKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsRemoveToken, iValueBuffer);
+                    break;
+                case ETestFilterKeyword:
+                    aMmsHeaders.MMBoxMessageHeadersL().AppendKeywordItemL(KMmsFilterToken, iValueBuffer);
+                    break;
+                case ETestMMState:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KDraft)) == 0)
+                        {
+                        val = KMmsDraft;
+                        }
+                    else if ((iValueBuffer.CompareF(KSent)) == 0)
+                        {
+                        val = KMmsSent;
+                        }
+                    else if ((iValueBuffer.CompareF(KNew)) == 0)
+                        {
+                        val = KMmsNew;
+                        }
+                    else if ((iValueBuffer.CompareF(KRetrieved)) == 0)
+                        {
+                        val = KMmsRetrieved;
+                        }
+                    else if ((iValueBuffer.CompareF(KForwarded)) == 0)
+                        {
+                        val = KMmsForwarded;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    if ( aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewReq ||
+                        aMmsHeaders.MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().MMStateArray().InsertInOrder( val );
+                        }
+                    else
+                        {
+                        aMmsHeaders.MMBoxMessageHeadersL().SetMMState( val );
+                        }
+                    break;
+                case ETestQuota:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsQuotas( val );
+                    break;
+                case ETestStart:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    if (error == KErrNone)
+                        {
+                        aMmsHeaders.MMBoxViewHeadersL().SetMmsStart(val);
+                        }
+                    break;
+                case ETestStore:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStore( val );
+                    break;
+                case ETestStored:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStored( val );
+                    break;
+                case ETestStoreStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KOk)) == 0)
+                        {
+                        val = KMmsStatusOk;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransient)) == 0)
+                        {
+                        val = KMmsErrorTransientFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrTransientNetworkproblem)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusTransientNetworkProblem;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanent)) == 0)
+                        {
+                        val = KMmsErrorPermanentFailure;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentServiceDenied)) == 0)
+                        {
+                        val = KMmsErrorPermanentServiceDenied;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentMessageFormatCorrupt)) == 0)
+                        {
+                        val = KMmsErrorPermanentMessageFormatCorrupt;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrPermanentNotFound)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusPermanentMessageNotFound;
+                        }
+                    else if ((iValueBuffer.CompareF(KErrMMBoxFull)) == 0)
+                        {
+                        val = KMmsErrorStoreStatusPermanentMmboxFull;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatus( val );
+                    break;
+                case ETestStoreStatusText:
+                    aMmsHeaders.MMBoxMessageHeadersL().SetMmsStoreStatusTextL( iValueBuffer );
+                    break;
+                case ETestTotals:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.MMBoxViewHeadersL().SetMmsTotals( val );
+                    break;
+
+                case ETestDeleteInfoIndex:
+                    lex.Assign(iValueBuffer);
+                    error = lex.Val(val,radix,limit);
+                    order = val;
+                    break;
+
+                case ETestApplicId:
+                    aMmsHeaders.SetApplicIdL( iValueBuffer );
+                    break;
+                case ETestReplyApplicId:
+                    aMmsHeaders.SetReplyApplicIdL( iValueBuffer );
+                    break;
+                case ETestApplicInfo:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetAuxApplicInfoL( iByteBuffer->Des() );
+                    break;
+                case ETestContentClass:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KText)) == 0)
+                        {
+                        val = KMmsContentClassText;
+                        }
+                    else if ((iValueBuffer.CompareF(KImageBasic)) == 0)
+                        {
+                        val = KMmsContentClassImageBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KImageRich)) == 0)
+                        {
+                        val = KMmsContentClassImageRich;
+                        }
+                    else if ((iValueBuffer.CompareF(KVideoBasic)) == 0)
+                        {
+                        val = KMmsContentClassVideoBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KVideoRich)) == 0)
+                        {
+                        val = KMmsContentClassVideoRich;
+                        }
+                    else if ((iValueBuffer.CompareF(KMegaPixel)) == 0)
+                        {
+                        val = KMmsContentClassMegaPixel;
+                        }
+                    else if ((iValueBuffer.CompareF(KContentBasic)) == 0)
+                        {
+                        val = KMmsContentClassContentBasic;
+                        }
+                    else if ((iValueBuffer.CompareF(KContentRich)) == 0)
+                        {
+                        val = KMmsContentClassContentRich;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetContentClass( val );
+                    break;
+                case ETestDrmContent:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetDrmContent( val );
+                    break;
+                case ETestAdaptationAllowed:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KYes)) == 0)
+                        {
+                        val = KMmsYes;
+                        }
+                    else if ((iValueBuffer.CompareF(KNo)) == 0)
+                        {
+                        val = KMmsNo;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetAdaptationAllowed( val );
+                    break;
+                case ETestRecommendedRetrievalMode:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KManual)) == 0)
+                        {
+                        val = KMmsRecommendedRetrievalModeManual;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetRecommendedRetrievalMode( val );
+                    break;
+                case ETestRecRetrievalModeText:
+                    aMmsHeaders.SetRecommendedRetrievalModeTextL( iValueBuffer );
+                    break;
+                case ETestReplaceId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+                    break;
+                case ETestStatusText:
+                    aMmsHeaders.SetResponseTextL( iValueBuffer );
+                    break;
+                case ETestCancelId:
+                    iByteBuffer->Des().Copy( iValueBuffer );
+                    aMmsHeaders.SetReplaceCancelIdL( iByteBuffer->Des() );
+                    break;
+                case ETestCancelStatus:
+                    val = 0;
+                    if ((iValueBuffer.CompareF(KCancelSuccessful)) == 0)
+                        {
+                        val = KMmsCancelRequestSuccessfullyReceived;
+                        }
+                    else if ((iValueBuffer.CompareF(KCancelCorrupted)) == 0)
+                        {
+                        val = KMmsCancelRequestCorrupted;
+                        }
+                    else
+                        {
+                        val = KMmsTestIllegalValue;
+                        }
+                    aMmsHeaders.SetCancelStatus( val );
+                    break;
+                default:
+                    break;
+                }
+            }
+            else
+            {
+            switch(readStatus)
+                {
+                case ETestAlias:
+                    iAliasArray->AppendL( iValueBuffer );
+                    iAliasCount++;
+				    break;
+
+                default:
+                    break;
+                }
+
+            }
+        }
+    return(-1);
+}
+
+// ---------------------------------------------------------
+// CMmsReadFile()::ReadRowL
+// ---------------------------------------------------------
+//
+TTestReadStatus CMmsReadFile::ReadRowL()
+    {
+
+        TBuf8<DefaultBufLen> RowBuffer;
+        TBuf8<32> KeyBuffer;
+
+        // READ ONE ROW AND DROP CR+LF FROM THE END OF LINE
+        TChar delim( 10 );
+        iReader->ReadL( RowBuffer, delim);
+        TInt length = RowBuffer.Length();
+        if ( RowBuffer.Length() < 2 )
+            {
+            return ETestEof;
+            }
+        RowBuffer.Delete(length - 2,2);
+
+        // DROP POSSIBLE COMMENT OUT
+        TInt pos = RowBuffer.Locate( ';' );
+		if ( pos >= 0 ) RowBuffer.Delete( pos, length-pos-2 );
+
+        if ( RowBuffer.Length() == 0 )
+            {
+            // the line contained only comment
+            return ETestUnknown;
+            }
+
+        // First split the row (:)
+        pos = RowBuffer.Locate( ':' );
+        if (pos > 0)
+        {
+            TPtrC8 p = RowBuffer.Mid( pos+1 );
+            length = p.Length();
+            iValueBuffer.Zero();
+            for (TInt i=0; i < length; ++i)
+                {
+                iValueBuffer.Append(p[i]);
+                }
+            iValueBuffer.Trim();
+            TPtrC8 pp = RowBuffer.Left(pos);
+            KeyBuffer.CopyUC(pp);
+            KeyBuffer.Trim();
+        }
+        // TRY TO FIND CORRECT TAG
+        if ((KeyBuffer.CompareF(KTestNewMessage)) == 0) return(ETestNewMessage);
+        if ((KeyBuffer.CompareF(KTestMessageType)) == 0) return ETestMessageType;
+        if ((KeyBuffer.CompareF(KTestDate)) == 0) return ETestDate;
+        if ((KeyBuffer.CompareF(KTestFrom)) == 0) return ETestFrom;
+        if ((KeyBuffer.CompareF(KTestTo)) == 0) return ETestTo;
+        if ((KeyBuffer.CompareF(KTestCc)) == 0) return ETestCc;
+        if ((KeyBuffer.CompareF(KTestBcc)) == 0) return ETestBcc;
+        if ((KeyBuffer.CompareF(KTestSubject)) == 0) return ETestSubject;
+        if ((KeyBuffer.CompareF(KTestExpiryRel)) == 0) return ETestExpiryRel;
+        if ((KeyBuffer.CompareF(KTestExpiryAbs)) == 0) return ETestExpiryAbs;
+        if ((KeyBuffer.CompareF(KTestDeliveryTimeRel)) == 0) return ETestDeliveryTimeRel;
+        if ((KeyBuffer.CompareF(KTestDeliveryTimeAbs)) == 0) return ETestDeliveryTimeAbs;
+        if ((KeyBuffer.CompareF(KTestPriority)) == 0) return ETestPriority;
+        if ((KeyBuffer.CompareF(KTestSenderVisibility)) == 0) return ETestSenderVisibility;
+        if ((KeyBuffer.CompareF(KTestDeliveryReport)) == 0) return ETestDeliveryReport;
+        if ((KeyBuffer.CompareF(KTestReadReply)) == 0) return ETestReadReply;
+        if ((KeyBuffer.CompareF(KTestNewAttachment)) == 0) return ETestNewAttachment;
+        if ((KeyBuffer.CompareF(KTestAttachmentName)) == 0) return ETestAttaRecommendedName;
+        if ((KeyBuffer.CompareF(KTestAttachmentContLoc)) == 0) return ETestAttachmentContLoc;
+        if ((KeyBuffer.CompareF(KTestAttachmentType)) == 0) return ETestAttachmentType;
+        if ((KeyBuffer.CompareF(KTestAttachmentCharset)) == 0) return ETestAttachmentCharset;
+        if ((KeyBuffer.CompareF(KTestAttachmentCid)) == 0) return ETestAttachmentCid;
+        if ((KeyBuffer.CompareF(KTestAttachmentRoot)) == 0) return ETestAttachmentRoot;
+        if ((KeyBuffer.CompareF(KTestEndOfFile)) == 0) return ETestEof;
+        if ((KeyBuffer.CompareF(KTestMessageClass)) == 0) return ETestMessageClass;
+        if ((KeyBuffer.CompareF(KTestDelivRepSendAllow)) == 0) return ETestDelivReportSendAllow;
+        if ((KeyBuffer.CompareF(KTestAlias)) == 0 ) return ETestAlias;
+        if ((KeyBuffer.CompareF(KTestFromAlias)) == 0 ) return ETestFromAlias;
+        if ((KeyBuffer.CompareF(KTestToAlias)) == 0 ) return ETestToAlias;
+        if ((KeyBuffer.CompareF(KTestCcAlias)) == 0 ) return ETestCcAlias;
+        if ((KeyBuffer.CompareF(KTestBccAlias)) == 0 ) return ETestBccAlias;
+        if ((KeyBuffer.CompareF(KTestReplyCharging)) == 0 ) return ETestReplyCharging;
+        if ((KeyBuffer.CompareF(KTestReplyChargAbs)) == 0 ) return ETestReplyChargAbs;
+        if ((KeyBuffer.CompareF(KTestReplyChargRel)) == 0 ) return ETestReplyChargRel;
+        if ((KeyBuffer.CompareF(KTestReplyChargSize)) == 0 ) return ETestReplyChargSize;
+        if ((KeyBuffer.CompareF(KTestReplyChargID)) == 0 ) return ETestReplyChargID;
+        if ((KeyBuffer.CompareF(KTestTID)) == 0 ) return ETestTID;
+        if ((KeyBuffer.CompareF(KTestContentLocation)) == 0 ) return ETestContentLocation;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentIndex)) == 0 ) return ETestPreviouslySentIndex;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentBy)) == 0 ) return ETestPreviouslySentBy;
+        if ((KeyBuffer.CompareF(KTestPreviouslySentDate)) == 0 ) return ETestPreviouslySentDate;
+        if ((KeyBuffer.CompareF(KTestMessageId)) == 0 ) return ETestMessageId;
+        if ((KeyBuffer.CompareF(KTestMessageSize)) == 0 ) return ETestMessageSize;
+        if ((KeyBuffer.CompareF(KTestVersion)) == 0 ) return ETestVersion;
+        if ((KeyBuffer.CompareF(KTestReadStatus)) == 0 ) return ETestReadStatus;
+        if ((KeyBuffer.CompareF(KTestResponseStatus)) == 0 ) return ETestResponseStatus;
+        if ((KeyBuffer.CompareF(KTestResponseText)) == 0 ) return ETestResponseText;
+        if ((KeyBuffer.CompareF(KTestRetrieveStatus)) == 0 ) return ETestRetrieveStatus;
+        if ((KeyBuffer.CompareF(KTestRetrieveText)) == 0 ) return ETestRetrieveText;
+        if ((KeyBuffer.CompareF(KTestStatus)) == 0 ) return ETestStatus;
+        if ((KeyBuffer.CompareF(KTestAttribute)) == 0 ) return ETestAttribute;
+        if ((KeyBuffer.CompareF(KTestDistributionIndicator)) == 0 ) return ETestDistributionIndicator;
+        if ((KeyBuffer.CompareF(KTestLimit)) == 0 ) return ETestLimit;
+        if ((KeyBuffer.CompareF(KTestMessageQuota)) == 0 ) return ETestMessageQuota;
+        if ((KeyBuffer.CompareF(KTestSizeQuota)) == 0 ) return ETestSizeQuota;
+        if ((KeyBuffer.CompareF(KTestMessageTotal)) == 0 ) return ETestMessageTotal;
+        if ((KeyBuffer.CompareF(KTestSizeTotal)) == 0 ) return ETestSizeTotal;
+        if ((KeyBuffer.CompareF(KTestMessageCount)) == 0 ) return ETestMessageCount;
+        if ((KeyBuffer.CompareF(KTestAddKeyword)) == 0 ) return ETestAddKeyword;
+        if ((KeyBuffer.CompareF(KTestRemoveKeyword)) == 0 ) return ETestRemoveKeyword;
+        if ((KeyBuffer.CompareF(KTestFilterKeyword)) == 0 ) return ETestFilterKeyword;
+        if ((KeyBuffer.CompareF(KTestMMState)) == 0 ) return ETestMMState;
+        if ((KeyBuffer.CompareF(KTestQuota)) == 0 ) return ETestQuota;
+        if ((KeyBuffer.CompareF(KTestStart)) == 0 ) return ETestStart;
+        if ((KeyBuffer.CompareF(KTestStore)) == 0 ) return ETestStore;
+        if ((KeyBuffer.CompareF(KTestStored)) == 0 ) return ETestStored;
+        if ((KeyBuffer.CompareF(KTestStoreStatus)) == 0 ) return ETestStoreStatus;
+        if ((KeyBuffer.CompareF(KTestStoreStatusText)) == 0 ) return ETestStoreStatusText;
+        if ((KeyBuffer.CompareF(KTestTotals)) == 0 ) return ETestTotals;
+        if ((KeyBuffer.CompareF(KTestDeleteInfoIndex)) == 0 ) return ETestDeleteInfoIndex;
+        if ((KeyBuffer.CompareF(KTestApplicId)) == 0 ) return ETestApplicId;
+        if ((KeyBuffer.CompareF(KTestReplyApplicId)) == 0 ) return ETestReplyApplicId;
+        if ((KeyBuffer.CompareF(KTestApplicInfo)) == 0 ) return ETestApplicInfo;
+        if ((KeyBuffer.CompareF(KTestContentClass)) == 0 ) return ETestContentClass;
+        if ((KeyBuffer.CompareF(KTestDrmContent)) == 0 ) return ETestDrmContent;
+        if ((KeyBuffer.CompareF(KTestAdaptationAllowed)) == 0 ) return ETestAdaptationAllowed;
+        if ((KeyBuffer.CompareF(KTestRecommendedRetrievalMode)) == 0 ) return ETestRecommendedRetrievalMode;
+        if ((KeyBuffer.CompareF(KTestRecRetrievalModeText)) == 0 ) return ETestRecRetrievalModeText;
+        if ((KeyBuffer.CompareF(KTestReplaceId)) == 0 ) return ETestReplaceId;
+        if ((KeyBuffer.CompareF(KTestStatusText)) == 0 ) return ETestStatusText;
+        if ((KeyBuffer.CompareF(KTestCancelId)) == 0 ) return ETestCancelId;
+        if ((KeyBuffer.CompareF(KTestCancelStatus)) == 0 ) return ETestCancelStatus;
+        if ((KeyBuffer.CompareF(KTestAttContTypeParamName)) == 0 ) return ETestAttContTypeParamName;
+        if ((KeyBuffer.CompareF(KTestAttContTypeParamValue)) == 0 ) return ETestAttContTypeParamValue;
+        if ((KeyBuffer.CompareF(KTestAttXTypeParamName)) == 0 ) return ETestAttXTypeParamName;
+        if ((KeyBuffer.CompareF(KTestAttXTypeParamValue)) == 0 ) return ETestAttXTypeParamValue;
+        return ETestUnknown;
+    }
+
+// ---------------------------------------------------------
+// CMmsReadFile()::CreateMessageL
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+void CMmsReadFile::CreateMessageL( CMmsClientMtm* aMmsClient, CMmsHeaders* aMmsHeaders )
+    {
+
+    // Reset inactivity timer to keem viewServer from crashing
+    User::ResetInactivityTime();
+
+    TInt      i;
+    TInt error = KErrNone;
+    RFile attaFile;
+    _LIT8(KLeftAngle, "<");
+    _LIT8(KRightAngle, ">");
+    // we can't use "seconds from" as it only returns a
+    // 32 bit signed integer. If fails in 2038.
+    // "microseconds from" returns a 64 bit signed integer
+
+    CMsvStore* store = aMmsClient->Entry().EditStoreL();
+    CleanupStack::PushL(store);
+    aMmsHeaders->StoreL(*store);
+    store->CommitL();
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+
+    aMmsClient->LoadMessageL(); // read store is needed to do this
+
+    store = aMmsClient->Entry().EditStoreL();
+    CleanupStack::PushL(store);
+    CMsvAttachment* attaInfo = NULL;
+    TMsvAttachmentId attaId = 0;
+
+    for ( i=0; i < iAttaStructures->Count(); ++i)
+        {
+        attaId = KMsvNullIndexEntryId;
+        iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+
+        error = attaFile.Open( iFs, iFilename, EFileShareReadersOnly | EFileRead );
+        User::LeaveIfError( error );
+
+		CleanupClosePushL(attaFile);
+
+		CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
+		CleanupStack::PushL( mimeHeaders );
+		TPtrC8 contentType = iAttaStructures->At(i)->iAttaType->Des();
+
+        TDataRecognitionResult result;
+        result.Reset(); // make sure that it is cleared
+
+        if(iAttaStructures->At(i)->iAttaCid->Length())
+            {
+            TPtr8 attaCID = iAttaStructures->At(i)->iAttaCid->Des();
+            if (attaCID.Find(KLeftAngle) == 0 &&
+                attaCID.Find(KRightAngle) == attaCID.Length()-1 )
+                {
+                // remove angle brackets from cid
+                attaCID = attaCID.Mid(1,attaCID.Length()-2);
+                }
+            mimeHeaders->SetContentIdL(attaCID);
+            }
+
+        if (iAttaStructures->At(i)->iAttaCharset)
+            {
+            mimeHeaders->SetMimeCharset(iAttaStructures->At(i)->iAttaCharset);
+            }
+
+        if (iAttaStructures->At(i)->iAttaName->Length())
+            {
+            iFilename.Copy(iAttaStructures->At(i)->iAttaName->Des());
+            }
+        iParse.Set( iFilename, NULL, NULL );
+        iFilename.Copy( iParse.NameAndExt() );
+
+        mimeHeaders->SetContentLocationL( iFilename );
+
+		// if Mime type has not been set, use RapaRecognizer
+		if ( iAttaStructures->At(i)->iAttaType->Length() == 0 && iFilename.Length() > 0)
+		    {
+		    // TO BE IMPLEMENTED
+
+            RApaLsSession lsSession;
+
+            if ( lsSession.Connect() == KErrNone )
+                {
+                CleanupClosePushL( lsSession );
+
+                iFilename.Copy(iAttaStructures->At(i)->iAtta->Des());
+                if ( lsSession.RecognizeData( iFilename, TPtrC8(), result ) == KErrNone )
+                    {
+                    // Check confidence level. Recognization must be at least
+                    // "EProbable". We don't accept the result if it is "EPossible"
+                    // or "EUnlikely" or "ENotRecognized"!
+
+                    if ( result.iConfidence < CApaDataRecognizerType::EProbable )
+                        {
+                        result.Reset(); // clear buffer and try again with longer buffer
+                        }
+
+                    TPtrC8 mimeBuf8 = result.iDataType.Des8();
+
+                    if ( mimeBuf8.Length() == 0 )
+                        {
+                        // Open file buffer and try again..
+
+                        TInt bufSize = 0;
+                        (void)lsSession.GetMaxDataBufSize( bufSize ); // ignore errors
+                        if ( bufSize <= 0 )
+                            {
+                            bufSize = 30;
+                            }
+                        HBufC8* buf = HBufC8::NewLC( bufSize );
+                        TPtr8 des = buf->Des();
+
+                        RFile file;
+                        TInt err=file.Open( iFs, iFilename, EFileShareReadersOnly );
+                        if ( err == KErrNone )
+                            {
+                            err = file.Read( des );
+                            file.Close();
+                            if ( err == KErrNone )
+                                {
+                                if ( ( lsSession.RecognizeData( iFilename, des, result ) ) == KErrNone )
+                                    {
+                                    mimeBuf8.Set( result.iDataType.Des8() );
+                                    }
+                                }
+
+                            }
+                        CleanupStack::PopAndDestroy(); // buf
+                        }
+                    if ( mimeBuf8.Length() > 0 &&
+                        result.iConfidence >= CApaDataRecognizerType::EProbable )
+                        {
+                        contentType.Set( result.iDataType.Des8() );
+                        }
+                    }
+                CleanupStack::PopAndDestroy(1); // lssession
+                }
+		    }
+
+        if ( contentType.Length() > 0 )
+            {
+            TInt position = contentType.Find( KMmsSlash8 );
+            if ( position >= 0 )
+                {
+                mimeHeaders->SetContentTypeL( contentType.Left( position ) );
+                }
+            if ( position < contentType.Length() - 1 )
+                {
+                mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
+                }
+//          CreateAttachment2L sets the content type to attaInfo
+//            attaInfo->SetMimeTypeL( contentType );
+            }
+
+        if (iAttaStructures->At(i)->iAttaRecommendedName->Length())
+            {
+            iFilename.Copy(iAttaStructures->At(i)->iAttaRecommendedName->Des());
+            iParse.Set( iFilename, NULL, NULL );
+            iFilename.Copy( iParse.NameAndExt() );
+            mimeHeaders->SetSuggestedFilenameL( iFilename );
+            }
+
+        TInt j = 0;
+        for ( j = 0; j < iAttaStructures->At(i)->iContentTypeParams->MdcaCount(); ++j )
+            {
+            mimeHeaders->ContentTypeParams().AppendL( iAttaStructures->At(i)->iContentTypeParams->MdcaPoint( j ) );
+            }
+        for ( j = 0; j < iAttaStructures->At(i)->iXTypeParams->MdcaCount(); ++j )
+            {
+            mimeHeaders->XTypeParams().AppendL( iAttaStructures->At(i)->iXTypeParams->MdcaPoint( j ) );
+            }
+
+        attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
+        // attaInfo does not go onto cleaunpstack because ownership will
+        // be transferred to attachment manager.
+
+        aMmsClient->CreateAttachment2L(
+            *store,
+            attaFile,
+            contentType,
+            *mimeHeaders,
+            attaInfo,
+            attaId);
+        attaInfo = NULL; // ownership transferred
+
+        CleanupStack::PopAndDestroy(); // mimeHeaders
+        CleanupStack::PopAndDestroy(); // attaFile.Close()
+
+        if ( iAttaRoot > 0 && iAttaRoot == ( i + 1 ) )
+            {
+            aMmsClient->SetMessageRootL( attaId );
+            }
+        }
+
+    store->CommitL();
+    CleanupStack::PopAndDestroy(); // store
+
+    // This frees all memory and resets all values
+    Reset();
+    // Reset inactivity timer to keem viewServer from crashing
+    User::ResetInactivityTime();
+    }
+
+
+// ---------------------------------------------------------
+// CMmsReadFile()::FindAlias
+// program build a message from given parts
+// ---------------------------------------------------------
+//
+TInt CMmsReadFile::FindAlias( TPtrC aAlias )
+    {
+	TBuf<DefaultBufLen> abuf;
+	for( TInt i=0; i < iAliasCount; ++i )
+	    {
+		abuf.Copy( iAliasArray->MdcaPoint(i) );
+		abuf.SetLength( abuf.Locate('=') );
+		if( ( abuf.CompareF( aAlias ) ) == 0 ) return( i );
+	    }
+	return( -1 );
+    }
+
+
+// C++ default constructor can NOT contain any code, that
+// might leave.
+//
+CMmsAttaStructure::CMmsAttaStructure()
+    {
+    iAtta = NULL;
+    iAttaType = NULL;
+    iAttaName = NULL;
+    iAttaCid = NULL;
+    iAttaRecommendedName = NULL;
+    }
+
+
+//
+void CMmsAttaStructure::ConstructL()
+    {
+    iAtta = HBufC8::NewL(DefaultBufLen);
+    iAttaType = HBufC8::NewL(DefaultBufLen);
+    iAttaName = HBufC8::NewL(DefaultBufLen);
+    iAttaCid = HBufC8::NewL(DefaultBufLen);
+    iAttaRecommendedName = HBufC::NewL(DefaultBufLen);
+    iAttaCharset = 0;
+   	iXTypeParams  = new(ELeave) CDesC8ArrayFlat(4);
+   	iContentTypeParams  = new(ELeave) CDesC8ArrayFlat(4);
+
+    }
+
+// Two-phased constructor.
+CMmsAttaStructure* CMmsAttaStructure::NewL()
+    {
+    CMmsAttaStructure* self = new ( ELeave ) CMmsAttaStructure;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// Destructor
+CMmsAttaStructure::~CMmsAttaStructure()
+    {
+    delete iAtta;
+    delete iAttaName;
+    delete iAttaType;
+    delete iAttaCid;
+    delete iAttaRecommendedName;
+    if ( iContentTypeParams )
+        {
+    	iContentTypeParams->Reset();
+        }
+  	delete iContentTypeParams;
+    if ( iXTypeParams )
+        {
+      	iXTypeParams->Reset();
+        }
+	delete iXTypeParams;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestbed.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,2357 @@
+/*
+ * 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:
+ */
+
+#include <mtmdef.h>
+#include <CoreApplicationUIsSDKCRKeys.h>
+#include <mmsheaders.h>
+#include <mmscmds.h>
+#include <mmsencode.h>
+#include <mmscliententry.h>
+#include <logwrap.h>
+#include <logcli.h>
+#include <logview.h>
+#include "mmssettings.h"  //use mmssettings.h instead of cmmssettings.h
+#include "mmstestbed.h"
+#include "mmsreadfile.h"
+#include "mmstestuitimer.h"
+#include "mmsteststaticutils.h"
+#include "mmstestbed.hrh"
+
+//constants
+_LIT( KMmsSender, "0601234567" );
+
+MmsTestBed::MmsTestBed()
+    {
+    //start the timer
+    iTimer = CTestUiTimer::NewL();
+    iTimer->Cancel();
+
+    iWait = CMsvOperationActiveSchedulerWait::NewLC();
+    // don't leave iWait on cleanup stack
+    CleanupStack::Pop();
+
+    //open msvsession
+    iSession = CMsvSession::OpenSyncL(*this);
+    //create client registry
+    iClientMtmRegistry = CClientMtmRegistry::NewL(*iSession);
+    //create client mtm
+    iMmsClient = (CMmsClientMtm *) iClientMtmRegistry->NewMtmL(
+            KUidMsgTypeMultimedia);
+
+    User::LeaveIfError( iFs.Connect() );
+    iFs.SetSessionPath( KRootPath );
+    iSettings = CMmsSettings::NewL();
+    iMmsHeaders = CMmsHeaders::NewL(iSettings->MmsVersion());
+    findDefaultL();
+    iServiceId = iDefaultServiceId;
+
+    //validate the settings
+    iSettings->ValidateSettings();
+
+    iLogEvent = CLogEvent::NewL();
+    iLogEvent->SetEventType(KLogMmsEventTypeUid);
+    iLogClient = NULL; // we test soon if this is available
+    iLogView = NULL; // needs log client
+    if ( checkLogClient() )
+        {
+        // first we generate a general view of all events
+        // we'll set the filter when we update the view
+        iLogView = CLogViewEvent::NewL( *iLogClient );
+        }
+    iLogFilter = CLogFilter::NewL();
+    // we try to filter MMS events
+    iLogFilter->SetEventType(KLogMmsEventTypeUid);
+    }
+
+MmsTestBed::~MmsTestBed()
+    {
+    delete iLogView;
+    delete iLogFilter;
+    delete iLogClient;
+    delete iLogEvent;
+    delete iSettings;
+    delete iMmsHeaders;
+    if(iTimer)
+    {
+        iTimer->Cancel();
+        delete iTimer;
+    }
+    //delete iMsvEntrySelection;
+    delete iMmsClient;
+    delete iClientMtmRegistry;
+    //delete iClientMtmRegistry;
+    delete iSession;
+    delete iWait;
+    }
+
+void MmsTestBed::setConnectionLocal(bool value)
+    {
+    //value = true for global off, local on
+    //value = false for global on, local off
+    iSettings->LoadSettingsL();
+    iSettings->SetLocalMode( value );
+    iSettings->SaveSettingsL();
+    }
+
+void MmsTestBed::fromOutboxToMmsc()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    // Get List of services
+    cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL(
+            KUidMsgTypeMultimedia);
+    CleanupStack::PushL(selection);
+
+    // Change state to "KMsvSendStateUnknown" in case the entry has been suspended earlier
+    for (TInt i = 0; i < selection->Count(); ++i)
+        {
+        cEntry->SetEntryL(selection->At(i));
+        TMsvEntry entry = cEntry->Entry();
+        entry.SetReadOnly(EFalse);
+        entry.SetSendingState(KMsvSendStateUnknown);
+        cEntry->ChangeL(entry);
+        }
+
+    selection->InsertL(0, iServiceId);
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack(parameters);
+
+    op = iSession->TransferCommandL(*selection, EMmsSend, paramPack,
+            iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending)
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if (iWait->iStatus.Int() != KErrNone)
+        {
+        //DEBUG(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    CleanupStack::PopAndDestroy(); //cEntry
+    }
+
+void MmsTestBed::fromMmscToInbox()
+    {
+    CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+    CleanupStack::PushL(msvEntrySelection);
+
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        msvEntrySelection->InsertL(0, iServiceId);
+        }
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack(parameters);
+
+    op = iMmsClient->InvokeAsyncFunctionL(EMmsReceive, *msvEntrySelection,
+            paramPack, iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending)
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if (iWait->iStatus.Int() != KErrNone)
+        {
+        //DEBUG(_L("Testbed tried to receive, return status %d"),iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); //msvEntrySelection
+    }
+
+void MmsTestBed::findDefaultL()
+    {
+    iSettings->LoadSettingsL();
+    iDefaultServiceId = iSettings->Service();
+    }
+
+void MmsTestBed::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1,
+        TAny* aArg2, TAny* /*aArg3*/)
+    {
+    iEvent = aEvent;
+    if (aEvent == EMsvGeneralError)
+        {
+        return;
+        }
+    TMsvId parentId = KMsvNullIndexEntryId;
+    if (aArg2 != NULL)
+        {
+        parentId = *(TMsvId*) aArg2;
+        }
+
+    CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+    TMsvEntry tEntry;
+    TMsvId service;
+    TInt error = KErrNone;
+    error = iSession->GetEntry(selection->At(0), service, tEntry);
+
+    CMsvEntry* cEntry = NULL;
+    switch (aEvent)
+        {
+        case EMsvEntriesCreated:
+            {
+            if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+                {
+                // emit signal for new entry into INBOX
+                emit entryCreatedInInbox(tEntry.Id());
+                }
+            else if (parentId == KMsvDraftEntryIdValue)
+                {
+                // emit signal for new entry into Draft
+                emit entryCreatedInDraft(tEntry.Id());
+                }
+            else if (parentId == iServiceId)
+                {
+                // emit signal for new Entry into SERVICE
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+            break;
+        case EMsvEntriesChanged:
+            {
+            TMsvId id;
+            CMsvEntrySelection* selection = (CMsvEntrySelection*) aArg1;
+            if (selection == NULL)
+                {
+                // no selection, cannot handle
+                return;
+                }
+            id = selection->At(0);
+            //DEBUG Entry changed"));
+            if (parentId == KMsvGlobalInBoxIndexEntryIdValue)
+                {
+/*
+                cEntry = iSession->GetEntryL( parentId );
+                CleanupStack::PushL( cEntry );
+                TRAPD (error, cEntry->SetEntryL( id ));
+                if ( error != KErrNone )
+                    {
+                    CleanupStack::PopAndDestroy(); // cEntry
+                    return;
+                    }
+                TMsvEntry tEntry = cEntry->Entry();
+                if ( tEntry.Visible() )
+                    {
+                    // generate fake delivery report
+                    CMsvStore* store = cEntry->ReadStoreL();
+                    CleanupStack::PushL( store );
+                    CMmsHeaders* mmsHeaders = CMmsHeaders::NewL( iSettings->MmsVersion() );
+                    CleanupStack::PushL( mmsHeaders );
+                    mmsHeaders->RestoreL( *store );
+                    iEncodeBuffer->ResizeL( 0 );
+                    generateDeliveryReport( mmsHeaders );
+                    CleanupStack::PopAndDestroy( 2 ); // mmsHeaders, store
+                    }
+                CleanupStack::PopAndDestroy(); // cEntry
+*/
+                }
+            }
+            break;
+        case EMsvEntriesDeleted:
+            {
+            //emit signal for entry deleted
+            }
+            break;
+        case EMsvEntriesMoved:
+            {
+            if (parentId == KMsvGlobalOutBoxIndexEntryIdValue)
+                {
+                // entry moved to outbox
+                emit entryMovedToOutbox(tEntry.Id());
+                }
+            else if (parentId == KMsvSentEntryIdValue)
+                {
+                // entry moved to sent folder
+                emit entryMovedToSent(tEntry.Id());
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+void MmsTestBed::createMmsService()
+    {
+    CMmsSettings * settings = CMmsSettings::NewL();
+    CleanupStack::PushL( settings );
+    settings->CreateNewServiceL( *iSession );
+    CleanupStack::PopAndDestroy(); // settings
+    return;
+    }
+
+void MmsTestBed::cleanup()
+    {
+    TMsvId entryToBeKilled;
+    // Get access to root index
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+
+    entryToBeKilled = iSettings->Service();
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    while (entryToBeKilled != KMsvNullIndexEntryId)
+        {
+        // delete child of root entry
+        deleteEntry(entryToBeKilled, *cEntry);
+        entryToBeKilled = iSettings->Service();
+        }
+
+    CleanupStack::PopAndDestroy(); // cEntry
+    // We deleted everything!
+    iDefaultServiceId = KMsvNullIndexEntryId;
+    iServiceId = KMsvNullIndexEntryId;
+    }
+
+void MmsTestBed::deleteEntry(TMsvId aEntryId, CMsvEntry& aClientEntry)
+    {
+    aClientEntry.DeleteL(aEntryId);
+    }
+
+void MmsTestBed::cleanupAndCreateNewService()
+    {
+    cleanup();
+    // all old service entries have been destroyed, create a new one
+    createMmsService();
+    }
+
+void MmsTestBed::testFile(TFileName& aFilePath, TInt aCommand /* = 0 */, TMsvId aBox /* = KMsvGlobalOutBoxIndexEntryId */ )
+    {
+    // update settings in mmsclient
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+
+    RFileReadStream readStream;
+    readStream.PushL();
+//    TMsvId id = KMsvNullIndexEntryId;
+    CBufFlat* encodeBuffer = NULL;
+    CMmsEncode* encoder = NULL;
+
+    // Open the file
+    TInt err = readStream.Open(iFs, aFilePath, EFileShareReadersOnly );
+    if (err != KErrNone) User::Leave( err );
+
+    TInt   retCode = 0;
+    CMmsReadFile* readFile = NULL;
+    readFile = CMmsReadFile::NewL( iFs, readStream );
+    CleanupStack::PushL( readFile );
+
+    TInt messageCounter = 0;
+    CMsvEntry* cEntry = NULL;
+
+    while(!retCode)
+        {
+        // READ MESSAGE TO BUFFERS
+        iMmsHeaders->Reset(iSettings);
+        // put in some message type just for fun (testing...)
+        iMmsHeaders->SetMessageType( KMmsMessageTypeForwardReq );
+        retCode = readFile->CompleteTestL( messageCounter++, *iMmsHeaders );
+        if(readFile->iMessageType == ETestNewMessage)
+            {
+            // CREATE MESSAGE ENTRY
+            switch ( aCommand )
+                {
+                case ECreateToInbox:
+                case ECreateNotification:
+                    cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+                    break;
+                case ECreateToSentItems:
+                    cEntry = iSession->GetEntryL(KMsvSentEntryId);
+                    break;
+                case ECreateToDrafts:
+                    cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+                    break;
+                case ECreateHeadersFromFile:
+                    // here we just encode headers, no message entry
+                    // the entry is fake.
+                    break;
+                case ECreateMMBoxViewConf:
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        // entry is not created for the description items
+                        // they become attachments
+                        cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+                        }
+                    break;
+                default:
+                    cEntry = iSession->GetEntryL(aBox);
+                    break;
+                }
+
+            // if we are just playing with headers we have no entry
+            if ( aCommand != ECreateHeadersFromFile && aCommand != ECreateMMBoxViewConf )
+                {
+                CleanupStack::PushL(cEntry);
+                iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+                // CREATE MESSAGE
+                iMmsClient->CreateMessageL(iServiceId);
+                }
+            else if ( aCommand == ECreateMMBoxViewConf )
+                {
+                if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                    {
+                    CleanupStack::PushL(cEntry);
+                    iMmsClient->SwitchCurrentEntryL(cEntry->EntryId());
+
+                    // CREATE MESSAGE
+                    iMmsClient->CreateMessageL(iServiceId);
+                    }
+                else
+                    {
+                    encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+                    CleanupStack::PushL( encodeBuffer );
+                    encoder = CMmsEncode::NewL( iFs );
+                    CleanupStack::PushL( encoder );
+
+                    // encode headers to a binary file
+                    encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+                    iFilename = KMmsMMBoxDescriptionDirectory;
+                    TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+                    CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+                    encodeBuffer = NULL;
+                    encoder = NULL;
+                    }
+                }
+            else
+                {
+                encodeBuffer = CBufFlat::NewL( 4 * 1024 ); // should be plenty
+                CleanupStack::PushL( encodeBuffer );
+                encoder = CMmsEncode::NewL( iFs );
+                CleanupStack::PushL( encoder );
+
+                // encode headers to a binary file
+                encoder->EncodeHeadersL( *iMmsHeaders, *encodeBuffer );
+
+                iFilename = KMmsDumpDirectory;
+                TMmsTestUtils::Dump( *encodeBuffer, iFilename, iParse, iFs );
+
+                CleanupStack::PopAndDestroy( 2 ); // encodeBuffer, encoder
+                encodeBuffer = NULL;
+                encoder = NULL;
+                }
+            }
+
+        if ( aCommand != ECreateHeadersFromFile &&
+            ( aCommand != ECreateMMBoxViewConf || iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf ) )
+            {
+            if(readFile->iMessageType == ETestSettings)
+                {
+                TMsvId ServiceId = iMmsClient->DefaultServiceL();
+                iMmsClient->RestoreSettingsL();
+                iSettings->CopyL( iMmsClient->MmsSettings() );
+                }
+
+            TMemoryInfoV1Buf memory;
+            UserHal::MemoryInfo( memory );
+            TInt available = memory().iFreeRamInBytes;
+//            TMmsLogger::Log(_L("Free memory before CreateMessageL %d"), available );
+
+            TRAP (err, readFile->CreateMessageL(iMmsClient, iMmsHeaders));
+
+            available = memory().iFreeRamInBytes;
+//            TMmsLogger::Log(_L("Free memory after CreateMessageL %d"), available );
+
+            if(readFile->iMessageType == ETestNewMessage)
+                {
+                TMsvEntry tEntry = iMmsClient->Entry().Entry();
+                TMsvId id = tEntry.Id();
+                if ( err == KErrNone )
+                    {
+                    // SAVE MESSAGE
+                    iMmsClient->SaveMessageL();
+
+                    // If we are creating a MMBox View confirmation,
+                    // we add all binary files from KMmsMMBoxDirectory
+                    // as attachments.
+
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        addMMBoxDescriptions();
+                        }
+
+                    // reload the entry in case mms client put something into it
+                    // MESSAGE MUST BE SET VISIBLE
+                    tEntry = iMmsClient->Entry().Entry();
+                    if ( iMmsClient->MessageClass() == EMmsClassAdvertisement )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageAdvertisement;
+                        }
+                    else if ( iMmsClient->MessageClass() == EMmsClassInformational )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageInformational;
+                        }
+                    tEntry.iMtmData1 &= ~KMmsMessageMobileTerminated;
+
+                    // Test: Set all as editor oriented - except notifications!
+                    if ( aCommand == ECreateNotification )
+                        {
+                        tEntry.iMtm = KUidMsgMMSNotification;
+                        }
+                    else
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageEditorOriented;
+                        }
+                    if ( aCommand == ECreateToInbox )
+                        {
+                        tEntry.iMtmData1 |= KMmsMessageMobileTerminated;
+                        tEntry.SetReadOnly( ETrue );
+                        tEntry.SetNew( ETrue );
+                        tEntry.SetUnread( ETrue );
+                        }
+                    else if ( aCommand == ECreateToSentItems )
+                        {
+                        tEntry.SetReadOnly( ETrue );
+                        }
+                    tEntry.SetVisible( ETrue );
+                    tEntry.SetInPreparation( EFalse );
+                    TTime now;
+                    now.UniversalTime();
+                    tEntry.iDate = now;
+                    TMsvId entryId = tEntry.Id();
+                    iMmsClient->Entry().ChangeL( tEntry );
+                    if ( iMmsHeaders->MessageType() == KMmsMessageTypeMboxViewConf )
+                        {
+                        // Encode to the directory that is used to fetch MMBox view
+                        iFilename.Copy( KMmsMMBoxDirectory );
+                        encodeMessageFromDrafts();
+                        cEntry->SetEntryL( KMsvDraftEntryId );
+                        cEntry->DeleteL( entryId );
+                        }
+                    }
+                else
+                    {
+                    //TMmsLogger::Log(_L("CreateMessageL left with error %d"), err );
+                    iSession->RemoveEntry(id);
+                    err = KErrNone; // clear error
+                    }
+                CleanupStack::PopAndDestroy(); // cEntry
+                cEntry = NULL;
+                }
+            if(readFile->iMessageType == ETestSettings)
+                {
+                iMmsClient->SetSettingsL( *iSettings );
+                iMmsClient->StoreSettingsL();
+                }
+        }
+    }
+
+    CleanupStack::PopAndDestroy(); //readFile
+
+    readStream.Close();
+    readStream.Pop();
+
+    /*
+    iMmsClient->SwitchCurrentEntryL(id);
+    */
+    }
+
+void MmsTestBed::addMMBoxDescriptions()
+    {
+    // add the contents of KMmsMMBoxDescriptionDirectory as attachments
+    CDir* fileList = NULL;
+    TInt i = 0;  // general counter
+    TInt error = KErrNone;
+    iCurrentPath = KMmsMMBoxDescriptionDirectory;
+
+    iFs.SetSessionPath(iCurrentPath);
+
+    TFindFile finder( iFs );
+    error = finder.FindWildByPath( KWild, NULL, fileList );
+    CleanupStack::PushL( fileList );
+    TInt fileCounter = 0;
+
+    if ( error == KErrNone )
+        {
+        fileCounter = fileList->Count();
+        }
+
+    TEntry entry;
+
+    if ( error == KErrNone )
+        {
+        for ( i = 0; i < fileCounter; ++i )
+            {
+            // Reset inactivity timer to keep viewServer from crashing
+            User::ResetInactivityTime();
+            entry = (*fileList)[i]; // name is entry.iName
+            iFilename.Copy( iCurrentPath );
+            iFilename.Append( entry.iName );
+            TPtrC ptr;
+            ptr.Set( iFilename );
+            iWait->iStatus = KErrNone;
+            iMmsClient->AddAttachmentL( ptr, KMmsMimeType, 0, iWait->iStatus );
+
+            iWait->Start();
+            // The descriptions are cleared after being used
+            iFs.Delete( ptr);
+            }
+        }
+
+    iMmsClient->SaveMessageL(); // just in case somthing must be updated
+    CleanupStack::PopAndDestroy(); // fileList
+    fileList = NULL;
+    }
+
+void MmsTestBed::encodeMessageFromDrafts()
+    {
+    CMmsEncode* encoder = CMmsEncode::NewL( iFs );
+    CleanupStack::PushL( encoder );
+    // encode a message iMmsClientPoints to
+    iMmsClient->LoadMessageL();
+    CMsvStore* store = iMmsClient->Entry().ReadStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->RestoreL( *store );
+    CleanupStack::PopAndDestroy(); // store
+    store = NULL;
+    iWait->iStatus = KErrNone;
+
+// caller sets the directory
+//    iFilename = KMmsMessageDumpDirectory;
+
+    CMmsClientEntry* entryWrapper = CMmsClientEntry::NewL( iFs, iMmsClient->Entry(), iServiceId );
+    CleanupStack::PushL( entryWrapper );
+    iEncodeBuffer->ResizeL(0);
+    encoder->StartL( *entryWrapper, *iMmsHeaders, *iEncodeBuffer, iWait->iStatus );
+    iWait->Start();
+    if ( iWait->iStatus == KErrNone )
+        {
+        TMmsTestUtils::Dump( *iEncodeBuffer, iFilename, iParse, iFs );
+        }
+    iEncodeBuffer->ResizeL(0);
+    CleanupStack::PopAndDestroy(); // entryWrapper
+    CleanupStack::PopAndDestroy(); // encoder
+    }
+
+void MmsTestBed::deleteNotifications()
+    {
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+
+    CMsvEntry* cEntry = NULL;
+    // delete all messages from the specified box
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+
+    if ( mmsFolderId != KMsvNullIndexEntryId )
+        {
+        cEntry->SetEntryL(mmsFolderId);
+
+        // show invisible entries
+        cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+        CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+        CleanupStack::PushL(msvEntrySelection);
+
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        if (msvEntrySelection->Count() > 0)
+            {
+            CMsvOperation* op = iSession->TransferCommandL(
+                *msvEntrySelection,
+                EMmsDeleteEntries,
+                paramPack,
+                iWait->iStatus);
+            CleanupStack::PushL(op);
+            iWait->Start();
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        // These cannot be deleted unless we have the a server mtm
+        // corresponding to this mtm type.
+        cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+        CleanupStack::PopAndDestroy(); //msvEntrySelection
+        msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgMMSNotification );
+        CleanupStack::PushL(msvEntrySelection);
+
+        if (msvEntrySelection->Count() > 0)
+            {
+            CMsvOperation* op = iSession->TransferCommandL(
+                *msvEntrySelection,
+                EMmsDeleteEntries,
+                paramPack,
+                iWait->iStatus);
+            CleanupStack::PushL(op);
+            iWait->Start();
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        CleanupStack::PopAndDestroy(); //msvEntrySelection
+
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    }
+
+TMsvId MmsTestBed::findMMSFolder()
+    {
+    return iSettings->NotificationFolder();
+    }
+
+void MmsTestBed::restoreFactorySettings()
+    {
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+    // do not reset access point
+    TInt accessPoint = iSettings->AccessPoint( 0 );
+    iSettings->RestoreFactorySettingsL( iMmsClient->Session(), EMmsFactorySettingsLevelDeep );
+    TInt count = iSettings->AccessPointCount();
+    TInt i = 0;
+    for ( i = count - 1; i >= 0; --i )
+        {
+        iSettings->DeleteAccessPointL( i );
+        }
+    // restore the original access point
+    if ( accessPoint > 0 )
+        {
+        // a negative access point is an error (most likely "KErrNotFound")
+        iSettings->AddAccessPointL( accessPoint, 0 );
+        }
+    iMmsClient->SetSettingsL( *iSettings );
+    iMmsClient->StoreSettingsL();
+    }
+
+void MmsTestBed::setFetchingState( TMmsReceivingMode aState )
+    {
+    iMmsClient->RestoreSettingsL();
+    iSettings->CopyL( iMmsClient->MmsSettings() );
+
+    iSettings->SetReceivingModeHome( aState );
+
+    iMmsClient->SetSettingsL( *iSettings );
+    iMmsClient->StoreSettingsL();
+    }
+
+void MmsTestBed::sendFromFile()
+    {
+    CMsvOperation * op = NULL;
+
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+    CleanupStack::PushL( cEntry );
+
+    CMsvEntrySelection* selection = NULL;
+    selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy(); // cEntry
+    CleanupStack::PushL( selection );
+
+    TRAPD (error, op = iMmsClient->SendL(*selection, iWait->iStatus));
+    if ( error != KErrNone )
+        {
+        CleanupStack::PopAndDestroy(); // selection
+        delete op;
+        return;
+        }
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(2); // op, selection
+    }
+
+void MmsTestBed::sendOneByOne()
+    {
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryId);
+    CleanupStack::PushL( cEntry );
+
+    CMsvEntrySelection* selection = NULL;
+    selection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PushL( selection );
+
+    CMsvEntrySelection* shortSelection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( shortSelection );
+
+    TInt i;
+
+    for ( i = 0; i < selection->Count(); ++i )
+        {
+        shortSelection->Reset();
+        shortSelection->AppendL( selection->At( i ) );
+
+        CMsvOperation * op = NULL;
+
+        TTime now;
+        now.UniversalTime();
+
+        TRAPD (error, op = iMmsClient->SendL(*shortSelection, iWait->iStatus, now ));
+        if ( error != KErrNone )
+            {
+            delete op;
+            CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+            return;
+            }
+        CleanupStack::PushL(op);
+        iWait->Start();
+
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+            }
+
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // op
+
+        }
+    CleanupStack::PopAndDestroy( 3 ); // entry, selection, shortSelection
+    }
+
+void MmsTestBed::sendNotifications()
+    {
+    // Only send one notification!!
+
+    TInt error = KErrNone;
+
+    if (! TMmsTestUtils::IsFile(iCurrentFile, iFs) )
+        {
+        //Not a file
+        return;
+        }
+    TMsvId mmsFolder = findMMSFolder();
+
+    TEntry entry;
+
+
+    // now I think we have a filename
+    TEntry orgEntry;
+    TUint size = 0;
+    error = iFs.Entry( iCurrentFile, orgEntry );
+    size = orgEntry.iSize;
+
+    //TMmsLogger::Log(_L("- notification %S "), &iCurrentFile);
+    if ( size == 0 )
+        {
+        //empty file
+        //TMmsLogger::Log(_L("- empty file"));
+        return;
+        }
+
+    if ( iEncodeBuffer == NULL )
+        {
+        iEncodeBuffer = CBufFlat::NewL( size );
+        }
+    else
+        {
+        iEncodeBuffer->ResizeL( 0 );
+        iEncodeBuffer->ResizeL( size );
+        }
+
+    RFile inFile;
+    error = inFile.Open( iFs, iCurrentFile, EFileShareReadersOnly );
+    TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+    if ( error == KErrNone )
+        {
+        error = inFile.Read( ptr, size );
+        inFile.Close();
+        }
+    else
+       {
+       //Error
+       //TMmsLogger::Log(_L("- can't read file"));
+       return;
+       }
+
+    TUint8 byte;
+    TUint position = 0;
+    TUint32 uintvar = 0;
+
+    if ( size > 2 )
+        {
+        iEncodeBuffer->Read( 1, &byte, 1 );
+        if ( byte == 6 ) // PUSH PDU
+            {
+            // try to find out length of header
+            position = 2;
+            iEncodeBuffer->Read( position, &byte, 1);
+
+            while ( byte & 0x80  && position < size )
+                {
+                uintvar += ( byte & 0x7f );
+                uintvar <<= 7;
+                position++;
+                iEncodeBuffer->Read( position, &byte, 1 );
+                }
+
+            // add last byte without shift
+            uintvar += byte;
+            position++;
+           }
+        }
+
+    position += uintvar;
+
+    if ( position < size )
+        {
+        ptr = iEncodeBuffer->Ptr( position );
+        size = ptr.Length();
+        }
+
+    if ( size == 0 )
+        {
+        //no MMS stuff
+        //TMmsLogger::Log(_L("- no MMS stuff"));
+        return;
+        }
+
+    TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+
+    // Now we have streamed our data into this entry.
+    // Now we have an entry that says: local service, MMS MTM
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    if ( entryId != KMsvNullIndexEntryId )
+        {
+        selection->AppendL( entryId );
+        }
+    else
+        {
+        selection->AppendL( iDefaultServiceId );
+        }
+
+    TWatcherParameters parameters; // initialized to zero
+    parameters.iWatcherId = RThread().Id();
+    parameters.iDataPointer = &ptr;
+    TWatcherParametersBuf paramPack( parameters );
+
+    CMsvOperation * op = NULL;
+
+    op = iSession->TransferCommandL(
+        *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    User::After(1000000);
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::copyDrafts()
+    {
+    CMsvEntry* cEntry = NULL;
+// Copies contents of sent folder to drafts for retrying sending.
+
+    cEntry = iSession->GetEntryL(KMsvSentEntryId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages in drafts
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+
+    TMsvLocalOperationProgress progress;
+    cEntry->CopyL( *selection, KMsvDraftEntryId, progress );
+
+    TInt i = 0;
+    for ( i = 0; i < selection->Count(); ++i )
+        {
+        cEntry->SetEntryL( selection->At( i ) );
+        TMsvEntry entry = cEntry->Entry();
+        entry.SetReadOnly( EFalse );
+        cEntry->ChangeL( entry );
+        }
+
+    CleanupStack::PopAndDestroy(2); // selection, cEntry
+    }
+
+void MmsTestBed::garbageCollection(TUint32 aReason)
+    {
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+
+    TMMSGarbageCollectionParameters parameters; // initialized to zero
+    parameters.iReasonFlags = aReason;
+    TMMSGarbageCollectionParametersBuf paramPack( parameters );
+    op = iSession->TransferCommandL(
+        *selection, EMmsGarbageCollection, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::messageVariation()
+    {
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+
+    op = iSession->TransferCommandL(
+        *selection, EMmsMessageGeneration, TPtrC8(), iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::cancelSendScheduling()
+    {
+    CMsvEntry* cEntry = NULL;
+    setFetchingState( EMmsReceivingPostpone );
+    testFile( iCurrentFile );
+    scheduledSend(KMsvGlobalOutBoxIndexEntryIdValue, 10000); // long delay so that we have time to cancel
+    deleteSendSchedule();
+
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    if (iMsvEntrySelection != NULL)
+        {
+        delete iMsvEntrySelection;
+        iMsvEntrySelection = NULL;
+        }
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy();
+    }
+
+void MmsTestBed::scheduledSend(TMsvId aBoxId, TInt aDelay /* = 5 */)
+    {
+    CMsvEntry* cEntry = NULL;
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    cEntry = iSession->GetEntryL(aBoxId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+//    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledSend,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::deleteSendSchedule()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages of outbox
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsDeleteSchedule,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::cancelFetchScheduling()
+    {
+    TMsvId mmsFolder = findMMSFolder();
+    CMsvEntry* cEntry = NULL;
+    setFetchingState( EMmsReceivingPostpone );
+    testFile( iCurrentFile );
+    fromOutboxToMmsc(); // immediate send (EMmsSend)
+
+    // Wait until notification has arrived - may take a while in global mode
+    TInt i = 0;
+    while ( TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) == 0
+        && i < 2000 )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        i++;
+        if ( (i/100) * 100 == i )
+            {
+            //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+            }
+        CActiveScheduler::Start();
+        }
+    iTimer->Cancel();
+
+    fetchForced( 10000 ); // delay to allow cancelling
+    deleteFetchSchedule();
+
+    cEntry = iSession->GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(mmsFolder);
+    if (iMsvEntrySelection != NULL)
+        {
+        delete iMsvEntrySelection;
+        iMsvEntrySelection = NULL;
+        }
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::fetchForced(TInt aDelay /* = 5 */)
+    {
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledReceiveForced,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::deleteFetchSchedule()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+    cEntry = iSession->GetEntryL( mmsFolderId );
+    CleanupStack::PushL(cEntry);
+    // Get all notifications
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, iDefaultServiceId);
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsDeleteSchedule,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::doAFetchCycle()
+    {
+    // Sends a message from iCurrentFile and lets it come back
+    TMsvId mmsFolder = findMMSFolder();
+    testFile( iCurrentFile );
+    fromOutboxToMmsc(); // immediate send (EMmsSend)
+    // fetching will start automatically
+
+    TInt i = 0;
+    while ( TMmsTestUtils::CountChildrenL( KMsvGlobalInBoxIndexEntryId, iMsvEntrySelection, *iSession ) == 0
+         && i < 2000
+         && TMmsTestUtils::CountChildrenL( mmsFolder, iMsvEntrySelection, *iSession ) > 0 )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        i++;
+        if ( (i/100) * 100 == i )
+            {
+            //TMmsLogger::Log(_L("%d:th wait cycle"), i );
+            }
+        CActiveScheduler::Start();
+        }
+    iTimer->Cancel();
+    }
+
+bool MmsTestBed::checkLogClient()
+    {
+    if ( iLogClient == NULL )
+        {
+        TRAP_IGNORE( iLogClient = CLogClient::NewL( iFs ) );
+        }
+    return ( iLogClient != NULL );
+    }
+
+int MmsTestBed::getLogEntries()
+    {
+    TInt count = 0;
+    if ( !iLogView )
+        {
+        return 0;
+        }
+
+    if ( iLogView->SetFilterL( *iLogFilter, iWait->iStatus ) )
+        {
+        // should complete with KErrNone
+        iWait->Start();
+        if ( iWait->iStatus.Int() == KErrNone )
+            {
+            count = iLogView->CountL();
+            }
+        }
+    return count;
+    }
+
+void MmsTestBed::createEntry(TMsvEntry& aNewEntry, CMsvEntry& aClientEntry)
+    {
+    CMsvOperation*  opert = aClientEntry.CreateL(aNewEntry, iWait->iStatus);
+    iWait->Start();
+    if (!opert->iStatus.Int()==KErrNone)
+        {
+        // what should we do? panic?
+        }
+
+    TPckgBuf<TMsvLocalOperationProgress> package;
+    package.Copy(opert->ProgressL());
+    *(TMsvId*)&aNewEntry = package().iId;
+
+    delete opert; opert=NULL;
+    }
+
+void MmsTestBed::cleanOutbox()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvGlobalOutBoxIndexEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanInbox()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanSent()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvSentEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanDrafts()
+    {
+    TMmsTestUtils::CleanBoxL(KMsvDraftEntryId, *iSession);
+    }
+
+void MmsTestBed::cleanAll()
+    {
+    cleanInbox();
+    cleanOutbox();
+    cleanSent();
+    cleanDrafts();
+    TMmsTestUtils::CleanBoxL( iSettings->MMBoxFolder(), *iSession );
+    deleteNotifications();
+    }
+
+void MmsTestBed::reply()
+    {
+    // The first message from inbox is replied to
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create reply, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::replyToAll()
+    {
+    // The first message from inbox is replied to
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+            KMsvMessagePartRecipient;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ReplyL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create reply to all, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::forward()
+    {
+    // The first message from inbox is forwarded
+    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+
+    if ( iMsvEntrySelection->Count() > 0 )
+        {
+        TMsvId originalEntry = iMsvEntrySelection->At(0);
+        iMmsClient->SwitchCurrentEntryL( originalEntry );
+        TMsvPartList partList = KMsvMessagePartOriginator | KMsvMessagePartDescription |
+            KMsvMessagePartRecipient | KMsvMessagePartAttachments;
+        CMsvOperation * op = NULL;
+        op = iMmsClient->ForwardL( KMsvGlobalOutBoxIndexEntryId, partList, iWait->iStatus);
+        CleanupStack::PushL(op);
+        iWait->Start();
+        while (iWait->iStatus.Int() == KRequestPending )
+            {
+            if (!iTimer->IsActive())
+                {
+                iTimer->IssueRequest();
+                }
+            CActiveScheduler::Start();
+            }
+
+        iTimer->Cancel();
+        if ( iWait->iStatus.Int() != KErrNone )
+            {
+            //TMmsLogger::Log(_L("Create forward, return status %d"), iWait->iStatus.Int());
+            }
+        else
+            {
+            TMsvId newEntry = KMsvNullIndexEntryId;
+            TPckgBuf<TMsvId> package;
+            package.Copy(op->ProgressL());
+            newEntry = package();
+            if ( newEntry != KMsvNullIndexEntryId )
+                {
+                iMmsClient->SwitchCurrentEntryL( newEntry );
+                // Add a sender: 0601234567
+                iMmsClient->LoadMessageL();
+                iMmsClient->SetSenderL( KMmsSender );
+                iMmsClient->SaveMessageL();
+                cEntry->SetEntryL( newEntry );
+                TMsvEntry entry = cEntry->Entry();
+                entry.SetInPreparation( EFalse );
+                entry.SetVisible( ETrue );
+                cEntry->ChangeL(entry);
+                }
+            }
+        CleanupStack::PopAndDestroy(); // op
+        }
+    CleanupStack::PopAndDestroy(); // cEntry
+    }
+
+void MmsTestBed::sendReadReport()
+    {
+    // TURN READ REPORTS ON (until available from menu)
+    iSettings->LoadSettingsL();
+    iSettings->SetReadReplyReportSendingAllowed( ETrue );
+    iSettings->SaveSettingsL();
+    iMmsClient->RestoreSettingsL();
+
+
+    // Read report is sent for the first message in inbox
+    CMsvEntry* cEntry = iSession->GetEntryL( KMsvGlobalInBoxIndexEntryId );
+    CleanupStack::PushL(cEntry);
+    delete iMsvEntrySelection;
+    iMsvEntrySelection = NULL;
+    iMsvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+
+    if ( iMsvEntrySelection->Count() == 0 )
+        {
+        return;
+        }
+    TMsvId originalEntry = iMsvEntrySelection->At( 0 );
+
+    // new test using Client MTM
+    CMsvOperation * op = NULL;
+    op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy( op );
+    op = NULL;
+
+    // Try sending the read report to current entry
+
+    iMmsClient->SwitchCurrentEntryL( originalEntry );
+    op = iMmsClient->SendReadReportL( originalEntry, iWait->iStatus, EMmsReadStatusRead );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy( op );
+    op = NULL;
+
+/*
+    cEntry->SetEntryL( originalEntry );
+    iMmsHeaders->Reset();
+    CMsvStore* store = cEntry->ReadStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->RestoreL( *store );
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+    HBufC8* messageId = HBufC8::NewL( iMmsHeaders->MessageId().Length() );
+    CleanupStack::PushL( messageId );
+    messageId->Des().Copy( iMmsHeaders->MessageId() );
+
+    iMmsClient->SwitchCurrentEntryL( originalEntry );
+    iMmsClient->LoadMessageL();
+
+    iMmsHeaders->Reset();
+    iMmsHeaders->SetMessageType( KMmsMessageTypeReadRecInd );
+    // Message id cannot be accessed via MMS Client MTM!
+
+    iMmsHeaders->SetMessageIdL( messageId->Des() );
+    CleanupStack::PopAndDestroy( messageId );
+
+    iMmsHeaders->AddTypedAddresseeL( iMmsClient->Sender(), EMsvRecipientTo );
+    // sender must be insert-address-token because we don't know our number
+    TTime now;
+    now.UniversalTime();
+
+    _LIT( K1970, "19700000:000000.000000" );    // 1-Jan 1970 0:00:00
+
+    TTime y1970( K1970 );
+    TTimeIntervalMicroSeconds interval;
+    // we can't use "seconds from" as it only returns a
+    // 32 bit signed integer. If fails in 2038.
+    // "microseconds from" returns a 64 bit signed integer
+    interval = now.MicroSecondsFrom( y1970 );
+    // date in iMmsHeaders() in seconds from 1.1.1970.
+    iMmsHeaders->SetDate( (interval.Int64() ) / KMmsMillion );
+    iMmsHeaders->SetReadStatus( KMmsReadStatusRead );
+
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = FindMMSFolderL();
+
+    cEntry->SetEntryL( mmsFolderId );
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvMessageEntry;
+    entry.iMtm = KUidMsgTypeMultimedia;
+    entry.SetVisible( ETrue );
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    entry.iRelatedId = iDefaultServiceId;
+    entry.iMtmData1 = KMmsMessageReadRecInd;
+    cEntry->CreateL( entry );
+    TMsvId entryId = entry.Id();
+
+    cEntry->SetEntryL( entryId );
+
+    store = cEntry->EditStoreL();
+    CleanupStack::PushL( store );
+    iMmsHeaders->StoreL( *store );
+    store->CommitL();
+    CleanupStack::PopAndDestroy( store );
+    store = NULL;
+
+    CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    selection->InsertL(0, entryId);
+
+    CMsvOperation * op = NULL;
+    TCommandParameters parameters; // initialized to zero
+    TCommandParametersBuf paramPack( parameters );
+
+    op = iSession->TransferCommandL(*selection,EMmsScheduledReadReport,paramPack,iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    if ( iWait->iStatus.Int() != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Testbed tried to send read report, return status %d"), iWait->iStatus.Int());
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy( op );
+    CleanupStack::PopAndDestroy( selection );
+*/
+    CleanupStack::PopAndDestroy( cEntry );
+    }
+
+int MmsTestBed::fromOutboxToMmscWithMemoryFailure()
+    {
+    TInt error = KErrNone;
+    TInt messageCount = 0;
+    TInt failureCount = 0;
+    do {
+        CMsvEntry* cEntry = NULL;
+
+        // Get List of services
+        cEntry = iSession->GetEntryL(KMsvGlobalOutBoxIndexEntryIdValue);
+        CleanupStack::PushL(cEntry);
+        // Get all mms messages of outbox
+        CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        CleanupStack::PushL( selection );
+        failureCount++;
+        // These are failures that fail in Message server.
+        if ( failureCount >= 63 && failureCount <= 64 )
+            {
+            failureCount = 65;
+            }
+        cEntry->SetEntryL( iServiceId );
+        TMsvEntry entry = cEntry->Entry();
+        entry.iMtmData3 &= 0x0000000FF;
+        entry.iMtmData3 |= failureCount << 8;
+        cEntry->ChangeL( entry );
+
+        selection->InsertL(0, iServiceId);
+
+        CMsvOperation * op = NULL;
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        TRAP (error, op = iSession->TransferCommandL(*selection,EMmsSend,paramPack,iWait->iStatus));
+
+        if ( error == KErrNone )
+            {
+            CleanupStack::PushL(op);
+            iWait->Start();
+
+            while (iWait->iStatus.Int() == KRequestPending )
+                {
+                if (!iTimer->IsActive())
+                    {
+                    iTimer->IssueRequest();
+                    }
+                CActiveScheduler::Start();
+                }
+
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                error = iWait->iStatus.Int();
+                if ( iWait->iStatus.Int() != KErrNoMemory )
+                    {
+                    //TMmsLogger::Log(_L("Testbed tried to send, return status %d"), iWait->iStatus.Int());
+                    }
+                }
+
+            CleanupStack::PopAndDestroy(); // op
+            }
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // selection
+        CleanupStack::PopAndDestroy(); // cEntry
+        selection = NULL;
+        cEntry = NULL;
+        cEntry = iSession->GetEntryL( KMsvGlobalOutBoxIndexEntryIdValue );
+        CleanupStack::PushL(cEntry);
+        selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        messageCount = selection->Count();
+        delete selection;
+        selection = 0;
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    while ( error == KErrNoMemory || messageCount > 0 );
+    return failureCount;
+    }
+
+int MmsTestBed::fromMmscToInboxWithMemoryFailure()
+    {
+    TInt error = KErrNone;
+    TInt failureCount = 0;
+    TInt messageCount = 0;
+    TMsvId mmsFolderId = KMsvNullIndexEntryId;
+    mmsFolderId = findMMSFolder();
+
+    do {
+        // Inbox must be cleaned if failure makes message to be fetched more than once.
+        // should not happen, but this test is quite stressful, and perfect result
+        // cannot be guaranteed.
+        // What is expected:
+        // 1. Program does not crash
+        // 2. After sufficient number of retries the message is fetched and notification deleted.
+        TMmsTestUtils::CleanBoxL(KMsvGlobalInBoxIndexEntryId, *iSession);
+        CMsvEntry* cEntry = NULL;
+        CMsvEntrySelection* msvEntrySelection = new CMsvEntrySelection;
+        CleanupStack::PushL(msvEntrySelection);
+
+        cEntry = iSession->GetEntryL(iServiceId);
+        CleanupStack::PushL(cEntry);
+
+        failureCount++;
+        // These are failures that fail in Message server.
+        if ( failureCount >= 63 && failureCount <= 64 )
+            {
+            failureCount = 65;
+            }
+        cEntry->SetEntryL( iServiceId );
+
+        TMsvEntry entry = cEntry->Entry();
+        entry.iMtmData3 &= 0x0000000FF;
+        entry.iMtmData3 |= failureCount << 8;
+        cEntry->ChangeL( entry );
+
+        // if we have a selected service, insert it into selection
+        if (iServiceId != KMsvNullIndexEntryId)
+            {
+            msvEntrySelection->InsertL(0, iServiceId);
+            }
+
+        CMsvOperation * op = NULL;
+        TCommandParameters parameters; // initialized to zero
+        TCommandParametersBuf paramPack( parameters );
+
+        TRAP (error, op = iMmsClient->InvokeAsyncFunctionL(
+            EMmsReceiveForced,
+            *msvEntrySelection,
+            paramPack,
+            iWait->iStatus) );
+
+        if ( error == KErrNone )
+            {
+            CleanupStack::PushL(op);
+            iWait->Start();
+
+            while (iWait->iStatus.Int() == KRequestPending )
+                {
+                if (!iTimer->IsActive())
+                    {
+                    iTimer->IssueRequest();
+                    }
+                CActiveScheduler::Start();
+                }
+
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                error = iWait->iStatus.Int();
+                if ( iWait->iStatus.Int() != KErrNoMemory )
+                    {
+                    //TMmsLogger::Log(_L("Testbed tried to receive, return status %d"), iWait->iStatus.Int());
+                    }
+                }
+
+            CleanupStack::PopAndDestroy(); // op
+            }
+
+        iTimer->Cancel();
+        CleanupStack::PopAndDestroy(); // msvEntrySelection
+        CleanupStack::PopAndDestroy(); // cEntry
+        msvEntrySelection = NULL;
+        cEntry = NULL;
+        cEntry = iSession->GetEntryL( mmsFolderId );
+        CleanupStack::PushL(cEntry);
+        msvEntrySelection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+        messageCount = msvEntrySelection->Count();
+        delete msvEntrySelection;
+        msvEntrySelection = 0;
+        CleanupStack::PopAndDestroy(); //cEntry
+        }
+    while ( error == KErrNoMemory || messageCount > 0 );
+    if ( error != KErrNoMemory && error != KErrNone )
+        {
+        //TMmsLogger::Log(_L("Memory failure loop ended with %d"), error);
+        }
+    return failureCount;
+    }
+
+void MmsTestBed::sendViaClient()
+    {
+    CMsvEntry* cEntry = NULL;
+
+    cEntry = iSession->GetEntryL(KMsvDraftEntryId);
+    CleanupStack::PushL(cEntry);
+    // Get all mms messages in drafts
+    CMsvEntrySelection* selection = cEntry->ChildrenWithMtmL( KUidMsgTypeMultimedia );
+    CleanupStack::PushL( selection );
+
+    CMsvOperation * op = NULL;
+    TTime now;
+    now.UniversalTime();
+    op = iMmsClient->SendL( *selection, iWait->iStatus, now );
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(2); // cEntry, selection
+    }
+
+void MmsTestBed::scheduledFetch(TInt aDelay /* = 5 */)
+    {
+    TCommandParameters parameters;
+    parameters.iInitialDelay = aDelay;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsScheduledReceive,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::fetchForcedImmediate()
+    {
+    TCommandParameters parameters;
+    TCommandParametersBuf paramPack( parameters );
+
+    CMsvEntrySelection* selection = new CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+    // if we have a selected service, insert it into selection
+    if (iServiceId != KMsvNullIndexEntryId)
+        {
+        selection->InsertL(0, iServiceId);
+        }
+    else
+        {
+        selection->InsertL(0, iDefaultServiceId);
+        }
+
+
+    CMsvOperation * op = NULL;
+    op = iMmsClient->InvokeAsyncFunctionL(
+        EMmsReceiveForced,
+        *selection,
+        paramPack,
+        iWait->iStatus);
+
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
+void MmsTestBed::getEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+
+    CLogEventType* eventType = CLogEventType::NewL();
+    CleanupStack::PushL( eventType );
+    eventType->SetUid(iLogEvent->EventType());
+    iLogClient->GetEventType( *eventType, iWait->iStatus );
+
+    iWait->Start();
+    CleanupStack::PopAndDestroy(); // eventType
+    }
+
+void MmsTestBed::addEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+
+    CLogEventType* eventType = CLogEventType::NewL();
+    CleanupStack::PushL( eventType );
+    eventType->SetUid(iLogEvent->EventType());
+    eventType->SetDescription(_L("Multimedia Message") );
+    eventType->SetLoggingEnabled( ETrue );
+
+//    iWait->iStatus = KRequestPending;
+    iLogClient->AddEventType( *eventType, iWait->iStatus );
+    iWait->Start();
+    CleanupStack::PopAndDestroy(); // eventType
+    }
+
+void MmsTestBed::deleteEventType()
+    {
+    if ( !checkLogClient() )
+        {
+        return; // not available
+        }
+//    iWait->iStatus = KRequestPending;
+    iLogClient->DeleteEventType( iLogEvent->EventType(), iWait->iStatus );
+    iWait->Start();
+    }
+
+void MmsTestBed::cleanLog()
+    {
+    TInt count = 0;
+
+    count = getLogEntries();
+
+    TInt i;
+    for ( i = 0; i < count; ++i )
+        {
+        // when a view is created, it will be positioned on the first event
+//        iWait->iStatus = KRequestPending;
+        iLogClient->DeleteEvent(iLogView->Event().Id(), iWait->iStatus);
+        iWait->Start();
+
+        if ( iLogView->NextL( iWait->iStatus ) )
+            {
+            // should complete with KErrNone
+            iWait->Start();
+            if ( iWait->iStatus.Int() != KErrNone )
+                {
+                // could not get next event!
+                break;
+                }
+            }
+        else
+            {
+            break; // no more events!
+            }
+        }
+    }
+
+void MmsTestBed::setOnline(bool value)
+    {
+    //value = true for online mode
+    //value = false for offline mode
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KCRUidCoreApplicationUIs ) );
+    if( retval == KErrNone )
+        {
+        repository->Set( KCoreAppUIsNetworkConnectionAllowed, value );
+        delete repository;
+        }
+    }
+
+void MmsTestBed::generateDeliveryReport( CMmsHeaders* aMmsHeaders )
+    {
+    iEncodeBuffer->ResizeL( 1024 );
+
+    TInt position = 0;
+
+    // encode message type
+    iEncodeBuffer->Write( position, &KMmsAssignedMessageType, 1 );
+    position++;
+    iEncodeBuffer->Write( position, &KMmsMessageTypeDeliveryInd, 1 );
+    position++;
+
+    // version
+    iEncodeBuffer->Write( position, &KMmsAssignedMmsVersion, 1 );
+    position++;
+
+    TUint8 version = aMmsHeaders->MmsVersion() | 0x80; // current version as short integer
+    iEncodeBuffer->Write( position, &version, 1 );
+    position++;
+
+    // message id from the headers
+    // At least once MMSC did not send us the message id!
+    // if message id is missing, we cannot match the entry!
+    // This only a fake. Real delivery reports should always
+    // contain the message id.
+    if ( aMmsHeaders->MessageId().Length() > 0 )
+        {
+        iEncodeBuffer->Write( position, &KMmsAssignedMessageId, 1 );
+        position++;
+        iEncodeBuffer->Write( position, &(aMmsHeaders->MessageId()[0]), aMmsHeaders->MessageId().Length() );
+        position += aMmsHeaders->MessageId().Length();
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+        }
+
+    // To is taken from the headers
+    iEncodeBuffer->Write( position, &KMmsAssignedTo, 1 );
+    position++;
+
+    TPtrC recipient;
+    if ( aMmsHeaders->ToRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->ToRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->ToRecipients()[0] );
+        }
+    else if( aMmsHeaders->CcRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->CcRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->CcRecipients()[0] );
+        }
+    else if( aMmsHeaders->BccRecipients().MdcaCount() > 0 &&
+        aMmsHeaders->BccRecipients()[0].Length() > 0 )
+        {
+        recipient.Set( aMmsHeaders->BccRecipients()[0] );
+        }
+    else
+        {
+        recipient.Set( _L("Jasso-Kissa@jii.fi") );
+        }
+
+    TMmsAddressType addressType = EMmsAddressTypeUnknown;
+
+    if ( recipient.Find( KMiuMau ) != KErrNotFound )
+        {
+        addressType = EMmsAddressTypeEmail;
+        }
+    else
+        {
+        addressType = EMmsAddressTypeMobile;
+        }
+
+    TUint8 character;
+    TInt i;
+    if ( addressType == EMmsAddressTypeEmail )
+        {
+        // email address - ASCII ONLY - THIS IS JUST A TEST!
+
+        for ( i = 0; i < recipient.Length(); ++i )
+            {
+            character = TUint8( recipient[i] & 0xff );
+            iEncodeBuffer->Write( position, &character, 1 );
+            position++;
+            }
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+
+        }
+    else
+        {
+        // must be a phone number
+        // We expect for now that the format is correct as is
+        // All legal characters present in a phone number are ASCII
+
+        TInt i;
+        for ( i = 0; i < recipient.Length(); ++i )
+            {
+            character = TUint8( recipient[i] & 0xff );
+            iEncodeBuffer->Write( position, &character, 1 );
+            position++;
+            }
+        iEncodeBuffer->Write( position, KMmsPlmn, KMmsPlmnLength );
+        position += KMmsPlmnLength;
+        iEncodeBuffer->Write( position, &KMmsNull, 1 );
+        position++;
+        }
+
+    // date
+    iEncodeBuffer->Write( position, &KMmsAssignedDate, 1 );
+    position++;
+
+    TLocale locale;
+    locale.Refresh();
+    TInt64 UtcDate;
+    TTimeIntervalSeconds universalTimeOffset( locale.UniversalTimeOffset() );
+
+    TTime now;
+    now.UniversalTime();
+    UtcDate = ( now.MicroSecondsFrom( TTime( KMmsYear1970String ) ).Int64() ) / 1000000 ;
+
+    UtcDate -= universalTimeOffset.Int();
+
+    if ( locale.QueryHomeHasDaylightSavingOn() )
+        {
+        TTimeIntervalSeconds daylightSaving( 60 * 60 );
+        UtcDate -= daylightSaving.Int();
+        }
+
+    TUint8 len; // number of bytes we will need
+    len = 0;
+    TUint8 array[8];
+
+    TInt64 temp = UtcDate;
+
+    for (i = 7; i >= 0; --i)
+        {
+        array[i] = TInt8( ( I64INT( temp ) ) & 0xFF );
+        I64LSR( temp, 8 );
+        }
+
+    len = 8;
+    i = 0;
+    while( ( array[i]== 0 ) && ( i < 8 ) )
+        {
+        i++;
+        len--;
+        }
+
+    // a zero should be coded as short integer.
+    // However, if there is a valid reason to code a zero as a long integer,
+    // we allow it. The caller should know what he is doing.
+    if ( len == 0 )
+        {
+        len = 1;
+        }
+    // write short length
+    iEncodeBuffer->Write( position, &len, 1 );
+    position++;
+    // write as many bytes as were non-zero
+    iEncodeBuffer->Write( position, &(array[8 - len] ), len );
+    position+= len;
+    // status
+    iEncodeBuffer->Write( position, &KMmsAssignedStatus, 1 );
+    position++;
+    iEncodeBuffer->Write( position, &KMmsMessageStatusRetrieved, 1 );
+    position++;
+    // DONE!!!
+    iEncodeBuffer->ResizeL( position );
+    return;
+    }
+
+void MmsTestBed::sendDeliveryReport()
+    {
+    if ( iEncodeBuffer->Size() == 0 )
+        {
+        //No delivery report
+        return;
+        }
+
+
+    TMsvId mmsFolder = findMMSFolder();
+    CMsvEntrySelection* selection = new (ELeave) CMsvEntrySelection;
+    CleanupStack::PushL( selection );
+
+    TMsvId entryId = TMmsTestUtils::CreateNotificationEntryL( mmsFolder, iServiceId, iEncodeBuffer, *iSession );
+    TPtr8 ptr = iEncodeBuffer->Ptr( 0 );
+
+    // Now we have streamed our data into this entry.
+    // Now we have an entry that says: local service, MMS MTM
+
+    if ( entryId != KMsvNullIndexEntryId )
+        {
+        selection->AppendL( entryId );
+        }
+    else
+        {
+        selection->AppendL( iDefaultServiceId );
+        }
+
+    TWatcherParameters parameters; // initialized to zero
+    parameters.iWatcherId = RThread().Id();
+    parameters.iDataPointer = &ptr;
+    TWatcherParametersBuf paramPack( parameters );
+
+    CMsvOperation * op = NULL;
+
+//    iWait->iStatus = KRequestPending;
+    op = iSession->TransferCommandL(
+        *selection, EMmsDecodePushedMessage, paramPack, iWait->iStatus );
+    CleanupStack::PushL(op);
+    iWait->Start();
+
+    while (iWait->iStatus.Int() == KRequestPending )
+        {
+        if (!iTimer->IsActive())
+            {
+            iTimer->IssueRequest();
+            }
+        CActiveScheduler::Start();
+        }
+
+    iTimer->Cancel();
+
+    CleanupStack::PopAndDestroy(); // op
+    CleanupStack::PopAndDestroy(); // selection
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmsteststaticutils.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,528 @@
+/*
+ * 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:
+ */
+
+#include <f32file.h>
+#include <centralrepository.h>
+#include <apparc.h>
+#include <msvapi.h>
+#include <msvids.h>
+
+#include "mmsteststaticutils.h"
+#include "mmsconst.h"
+#include "MmsEnginePrivateCRKeys.h"
+#include "mmssettings.h"
+#include "mmsheaders.h"
+#include "mmsservercommon.h"
+#include "mmsencode.h"
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsJoinedArrays::TMmsJoinedArrays(CDesCArray* const & aArray1, CDesCArray* const & aArray2)
+: iArray1(aArray1), iArray2(aArray2)
+    {
+    }
+
+TInt TMmsJoinedArrays::MdcaCount() const
+    {
+    TInt count=0;
+    if (iArray1)
+        count += iArray1->MdcaCount();
+    if (iArray2)
+        count += iArray2->MdcaCount();
+    return count;
+    }
+
+TPtrC16 TMmsJoinedArrays::MdcaPoint(TInt aIndex) const
+    {
+    if (iArray1)
+        {
+        if (aIndex < iArray1->MdcaCount())
+            return iArray1->MdcaPoint(aIndex);
+        else
+            aIndex -= iArray1->MdcaCount();
+        }
+    return iArray2->MdcaPoint(aIndex);
+    }
+
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+TMmsTestUtils::TMmsTestUtils()
+    {
+
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+HBufC* TMmsTestUtils::ReadContactFromFileL( TDesC& aFileName, RFs& aFs )
+    {
+    RFile file;
+    TInt error = KErrNone;
+
+    TInt textBufferSize = 256;
+    HBufC* textBuffer = HBufC::NewL( textBufferSize );
+    TPtr textPtr = textBuffer->Des();
+    TFileText textFile;
+
+    error = file.Open( aFs, aFileName,
+            EFileRead|EFileShareReadersOnly );
+
+    if ( error == KErrNone )
+        {
+        textFile.Set( file );
+        error = textFile.Seek( ESeekStart );
+        }
+
+    if ( error == KErrNone )
+        {
+        error = textFile.Read( textPtr );
+        }
+
+    file.Close();
+
+    if ( textBuffer->Des().Find( &KMmsByteOrderMark, 1 ) == 0 )
+        {
+        textBuffer->Des().Copy( textBuffer->Des().Mid( 1 ) );
+        }
+
+    return textBuffer;
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOnL()
+    {
+    // CenRep for decodelogging
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 1;
+        repository->Set( KMmsEngineDecodeLog, temp );
+        delete repository;
+        }
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off detailed logging while decoding a message
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::DecodeLoggingOffL()
+    {
+    // CenRep for decodelogging
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 0;
+        repository->Set( KMmsEngineDecodeLog, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOnL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 1;
+        repository->Set( KMmsEngineBinaryDump, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off binary dump of incoming messages
+//----------------------------------------------------------------------------------------
+//
+void TMmsTestUtils::BinaryDumpOffL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) );
+    if( retval == KErrNone )
+        {
+        // Best effort - if cannot access repository, no can do
+        TInt temp = 0;
+        repository->Set( KMmsEngineBinaryDump, temp );
+        delete repository;
+        }
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanDirectoryL( RFs& aFs )
+    {
+    // Delete the files in the directory
+    CFileMan* fileMan = CFileMan::NewL( aFs );
+    CleanupStack::PushL( fileMan );
+    fileMan->RmDir( KMmsDefaultLocalModeDir );
+    fileMan->RmDir( KMmsMMBoxDirectory );
+    fileMan->RmDir( KMmsMMBoxDescriptionDirectory );
+    CleanupStack::PopAndDestroy(); // fileManager
+    // we don't want to throw these away!
+    aFs.MkDirAll( KMmsDefaultLocalModeDir );
+    aFs.MkDirAll( KMmsMMBoxDirectory );
+    aFs.MkDirAll( KMmsMMBoxDescriptionDirectory );
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::Dump( CBufFlat& aBuffer, TFileName& aFilename, TParse& aParse, RFs& aFs )
+    {
+    TInt error = KErrNone;
+    aFs.MkDirAll( aFilename );
+    TUint att;
+    if ( aFs.Att( aFilename, att ) == KErrNone )
+        {
+        _LIT( KRelated, "dump.mms");
+        aParse.Set( aFilename, &KRelated, NULL );
+        aFilename = aParse.FullName();
+        error = CApaApplication::GenerateFileName( aFs, aFilename );
+        if ( error == KErrNone )
+            {
+            RFile file;
+            error = file.Create( aFs, aFilename, EFileWrite | EFileShareExclusive );
+            // for message id generation
+            aParse.Set( aFilename, NULL, NULL );
+            if ( error == KErrNone )
+                {
+                // the data is supposed to be in the encode buffer
+                TPtr8 ptr = aBuffer.Ptr( 0 );
+                file.Write( ptr );
+                file.Flush();
+                }
+
+            // done - close files
+            file.Close();
+            }
+        }
+    }
+
+// ---------------------------------------------------------
+//
+// ---------------------------------------------------------
+//
+void TMmsTestUtils::CleanBoxL(TMsvId aBoxId, CMsvSession& aSession)
+    {
+    CMsvEntry* cEntry = NULL;
+    // delete all messages from the specified box
+    cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    // show invisible entries
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    CMsvEntrySelection* msvEntrySelection = cEntry->ChildrenWithMtmL(KUidMsgTypeMultimedia);
+    CleanupStack::PushL(msvEntrySelection);
+
+    CMsvEntrySelection* selection = NULL;
+    cEntry->SetSortTypeL( TMsvSelectionOrdering( KMsvNoGrouping, EMsvSortByNone, ETrue ) );
+    selection = cEntry->ChildrenWithMtmL(KUidMsgMMSNotification);
+    CleanupStack::PushL( selection );
+    if ( selection->Count() > 0 )
+        {
+        msvEntrySelection->AppendL( selection->Back( 0 ), selection->Count() );
+        }
+    CleanupStack::PopAndDestroy(); // selection
+
+    int i;
+    for (i = 0; i < msvEntrySelection->Count(); ++i)
+        {
+        CMsvEntry* entry = aSession.GetEntryL( msvEntrySelection->At(i) );
+        CleanupStack::PushL( entry );
+        TMsvEntry tEntry = entry->Entry();
+        tEntry.SetReadOnly(EFalse);
+        entry->ChangeL(tEntry);
+        cEntry->DeleteL( msvEntrySelection->At(i) );
+        CleanupStack::PopAndDestroy( entry );
+        }
+
+    CleanupStack::PopAndDestroy(msvEntrySelection);
+    CleanupStack::PopAndDestroy(cEntry);
+    }
+
+//----------------------------------------------------------------------------------------
+// turn on logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOnL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+    if( retval == KErrNone )
+        {
+        TInt temp = 1;
+        repository->Set( KMmsEngineLogEmailRecipients, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+// turn off logging email recipients
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::EmailLoggingOffL()
+    {
+    // CenRep for binarydump setting
+    CRepository* repository = NULL;
+    TInt retval = KErrNone;
+    TRAP( retval, repository = CRepository::NewL( KUidMmsServerMtm ) ); // ***
+    if( retval == KErrNone )
+        {
+        TInt temp = 0;
+        repository->Set( KMmsEngineLogEmailRecipients, temp );
+        delete repository;
+        }
+
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TInt TMmsTestUtils::CountChildrenL(TMsvId aBoxId, CMsvEntrySelection*& aMsvEntrySelection, CMsvSession& aSession, TUid aMessageType )
+    {
+    CMsvEntry* cEntry = aSession.GetEntryL(KMsvRootIndexEntryId);
+    CleanupStack::PushL(cEntry);
+    cEntry->SetEntryL(aBoxId);
+    if (aMsvEntrySelection != NULL)
+        {
+        delete aMsvEntrySelection;
+        aMsvEntrySelection = NULL;
+        }
+    aMsvEntrySelection = cEntry->ChildrenWithMtmL(aMessageType);
+    CleanupStack::PopAndDestroy(); // cEntry
+    return aMsvEntrySelection->Count();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CreateFolderEntryL
+//
+// -----------------------------------------------------------------------------
+//
+void TMmsTestUtils::CreateFolderEntryL(
+    CMsvSession& aSession,
+    TMsvId aParentFolder,
+    const TDesC& aFolderName,
+    TMsvId& aFolderId )
+    {
+    aFolderId = KMsvNullIndexEntryId;
+    CMsvEntry* cEntry = aSession.GetEntryL( aParentFolder );
+    CleanupStack::PushL( cEntry );
+
+    // Create a new folder.
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvFolderEntry;
+    entry.iMtm = KUidMsvLocalServiceMtm;
+    entry.iDetails.Set( aFolderName );
+    entry.SetVisible( EFalse );
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    cEntry->CreateL( entry );
+    aFolderId = entry.Id();
+    CleanupStack::PopAndDestroy( cEntry );
+
+    }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TMsvId TMmsTestUtils::CreateNotificationEntryL(
+        TMsvId aNotificationFolder,
+        TMsvId aServiceId,
+        CBufFlat* aEncodeBuffer,
+        CMsvSession& aSession )
+    {
+    TMsvId entryId = KMsvNullIndexEntryId;
+    if ( aNotificationFolder == KMsvNullIndexEntryId )
+        {
+        // no folder no entry
+        return entryId;
+        }
+
+    CMsvEntry* cEntry = aSession.GetEntryL( aNotificationFolder );
+    CleanupStack::PushL(cEntry);
+
+    TMsvEntry entry;
+    entry.iType = KUidMsvMessageEntry;
+    entry.iMtm = KUidMsgTypeMultimedia;
+    entry.SetVisible( ETrue );
+    // If we want to put data here, InPreparation must be set to true first
+    entry.SetInPreparation( EFalse );
+    entry.iServiceId = KMsvLocalServiceIndexEntryId;
+    entry.iRelatedId = aServiceId;
+    entry.iMtmData2 = KMmsNotificationBinary;
+    cEntry->CreateL( entry );
+    entryId = entry.Id();
+
+    //
+    // Stream
+    // 1) length of the data as 32 bit integer
+    // 2) pushed message data
+    // into created entry's stream
+    //
+    cEntry->SetEntryL( entryId );
+    CMsvStore* store = cEntry->EditStoreL();
+    CleanupStack::PushL( store );   // ***
+    RMsvWriteStream outs;
+    outs.AssignLC( *store, KUidBinaryNotificationStream ); // ***
+    TPtrC8 ptr = aEncodeBuffer->Ptr( 0 );
+    outs.WriteUint32L( ptr.Length() );
+    outs.WriteL( ptr );
+    outs.CommitL();
+    outs.Close();
+    store->CommitL();
+
+    CleanupStack::PopAndDestroy( &outs ); // close outs
+    CleanupStack::PopAndDestroy( store );
+    CleanupStack::PopAndDestroy( cEntry );
+
+    return entryId;
+
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+void TMmsTestUtils::FormNotification(
+        TDesC8& aUrl,
+        TInt aSize,
+        CMmsHeaders& aMmsHeaders,
+        CMmsEncode& aMmsEncoder,
+        CBufFlat* aEncodeBuffer )
+    {
+    // for test purposes aUrl will contain the filename.
+
+    // Reset sets the default encapsulation version
+    // The default version has been set from MmsSettings in NewL
+    aMmsHeaders.Reset();
+
+    // construct the notification into iMmsHeaders, and call encode
+
+    aMmsHeaders.SetMessageType( KMmsMessageTypeMNotificationInd );
+
+    TTime currentTime;
+    currentTime.UniversalTime();
+    currentTime.Int64();
+
+    TPtrC8 tid;
+    TBufC8<KMMSMAXTIDLENGTH> target;
+    TInt random = 0;
+
+    // we don't generate a true random TID: We generate the
+    // TID from the URL so that if we generate a notification
+    // twice from the same file, we get the same TID and the
+    // same URL. This way we can test the pruning function in
+    // server MTM
+
+    TInt i;
+    for ( i = 0; i < aUrl.Length(); ++i )
+        {
+        random += aUrl[ i ];
+        }
+
+    target.Des().Num( random );
+    tid.Set( target.Des() );
+    aMmsHeaders.SetTidL( tid );
+
+    aMmsHeaders.SetMessageClass( EMmsClassPersonal );
+    aMmsHeaders.SetMessageSize( aSize );
+    const TInt KTenHours = 10 * 60 * 60; // 10 hours relative expiry
+    aMmsHeaders.SetExpiryInterval( KTenHours );
+    aMmsHeaders.SetContentLocationL( aUrl );
+
+    aMmsEncoder.EncodeHeadersL( aMmsHeaders, *aEncodeBuffer );
+
+    }
+
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsFile(const TDesC& aFileName, RFs& aFs)
+    {
+    //Is the name a file?
+    if (IsDrive(aFileName))
+        return EFalse;
+    return !(IsDir(aFileName, aFs));
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDir(const TDesC& aFileName, RFs& aFs)
+    {
+    //Is the name a directory?
+    TEntry entry;
+    TInt err = aFs.Entry(aFileName, entry);
+    if (err)
+        return EFalse;
+    else
+        return entry.IsDir();
+    }
+
+//----------------------------------------------------------------------------------------
+//
+//----------------------------------------------------------------------------------------
+TBool TMmsTestUtils::IsDrive(const TDesC& aFileName)
+    {
+    //horrible little function to figure if the path is just a drive
+    TBool retVal = EFalse;
+    if (aFileName.Length()==3) //eg "c:\"
+        {
+        if ((aFileName[1] == ':')  && (aFileName[2] == '\\'))
+            retVal=ETrue;
+        }
+    else if (aFileName.Length()==2) //eg "c:"
+        {
+        if (aFileName[1] == ':')
+            retVal=ETrue;
+        }
+    return retVal;
+    }
+
+// end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/mmstestbed/src/mmstestuitimer.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,121 @@
+/*
+ * 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:
+ */
+
+#include "mmstestuitimer.h"
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::CTestUiTimer(): CTimer( 5 )
+    {
+    period = KPeriod;
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::ConstructL()
+    {
+    CTimer::ConstructL();
+    CActiveScheduler::Add(this);
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer* CTestUiTimer::NewL()
+    {
+    CTestUiTimer* self = new(ELeave) CTestUiTimer();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CTestUiTimer::~CTestUiTimer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::IssueRequest()
+    {
+    // No operation to cancel if this function is called
+    iObject = NULL;
+    After(period);
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::TimeoutOperation( CActive* aObject, TTimeIntervalSeconds aTimeoutInSeconds )
+    {
+    iObject = aObject;
+    TTimeIntervalMicroSeconds32 timeout = aTimeoutInSeconds.Int() * 1000000;
+    After( timeout );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::DoCancel()
+    {
+    CTimer::DoCancel();
+    if ( iObject )
+        {
+        iObject->Cancel();
+        iObject = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CTestUiTimer::RunL()
+    {
+    if ( iObject )
+        {
+        // If we timeout while holding an active object, we cancel it
+        iObject->Cancel();
+        iObject = NULL;
+        }
+    else
+        {
+        CActiveScheduler::Stop();
+        }
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,139 @@
+/*
+ * 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: Main test class declaration for MMS Plugin
+ */
+
+#ifndef TEST_MMS_PLUGIN_H
+#define TEST_MMS_PLUGIN_H
+
+#ifdef BUILD_TEST_DLL
+#define TEST_EXPORT Q_DECL_EXPORT
+#else
+#define TEST_EXPORT Q_DECL_IMPORT
+#endif
+
+#include <QObject>
+#include <QSignalSpy>
+#include <e32const.h>
+
+//Forward Declarations
+class UniEditorMmsPlugin;
+class ConvergedMessage;
+class MmsTestBed;
+
+//Class Declaration: TestMmsPlugin
+class TEST_EXPORT TestMmsPlugin: public QObject
+    {
+    Q_OBJECT
+
+private slots:
+    
+    /**
+	 * Initialises the whole Test
+	 **/  
+   	void initTestCase();//called before the first testfunction is executed.
+    
+    /**
+	 * Initialises each Test Case
+	 **/  
+    void init();//called before each testfunction is executed.
+    
+   	 /**
+	 * Creates a MMS messsage with a text attachment
+	 **/  
+	void createMMSWithTextAttachment();
+	
+	/**
+	 * Tests the MMS message with a text attachment
+	 **/  
+	void testMMSWithTextAttachment();
+	
+	/**
+	 * Sends the MMS message with a text attachment
+	 **/  
+	void sendMMSWithTextAttachment();
+	
+	/**
+	 * Tests that the MMS message is sent successfully
+	 **/  
+	void testSentMMSWithTextAttachment();
+	
+	/**
+	 * Creates a MMS messsage with a text and an Image attachments
+	 **/  
+	void createMMSWithTextAndImageAttachment();
+	
+	/**
+	 * Tests the MMS message with a text and an Image attachments
+	 **/  
+	void testMMSWithTextAndImageAttachment();
+	
+	/**
+	 * Sends the MMS message with a text and an Image attachments
+	 **/  
+	void sendMMSWithTextAndImageAttachment();
+	
+	/**
+	 * Tests that the MMS message is sent successfully
+	 **/  
+	void testSentMMSWithTextAndImageAttachment();
+	
+	/**
+	 * Cleans up each Test Case
+	 **/  	
+	void cleanup();
+	
+	/**
+	 * Cleans up the whole Test Case
+	 **/  	
+    void cleanupTestCase();
+
+private: // Data
+    
+    /**
+	 * msgPlugin - MMS Message Plug-in
+	 **/  	
+    UniEditorMmsPlugin* msgPlugin;
+    
+    /**
+	 * mmstestbed - MMS Message Simulator
+	 **/  	
+    MmsTestBed* mmstestbed;
+    
+    /**
+	 * spy_draft - Signal Spy for Draft Folder
+	 **/  	
+	QSignalSpy* spy_draft;
+	
+	/**
+	 * spy_outbox - Signal Spy for Outbox Folder
+	 **/  	
+	QSignalSpy* spy_outbox;
+	
+	/**
+	 * spy_sent - Signal Spy for Sent Folder
+	 **/  	
+	QSignalSpy* spy_sent;
+	
+	/**
+	 * spy_inbox - Signal Spy for Inbox Folder
+	 **/  	
+	QSignalSpy* spy_inbox;
+	
+	/**
+	 * mmsMsgId - The MMS message Id
+	 **/  	
+	long int mmsMsgId;
+    };
+#endif //TEST_MMS_PLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/inc/testmmsplugin.ini	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,9 @@
+//this file is used to provide predefined set of input data.
+
+//eg.
+const char TEST_MSG_SUBJECT[]     = "Message Subject";
+const char TEST_SENDER[]			= "DummySender<+919860479112>";
+const char TEST_ATTACHMENT4[]		= "c:\\SmileyFace.gif";
+const char TEST_ATTACHMENT5[]		= "c:\\sample.txt";
+const char TEST_CC[]			= "DummyCCAddress<+919860479113>";
+const char TEST_BCC[]			= "DummyBCCAddress<+919860479114>";
\ No newline at end of file
Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/mms.rsc has changed
Binary file messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/not.rsc has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/src/testmmsplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,415 @@
+/*
+ * 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: : Main test class definition for MMS Plugin
+ */
+
+#include <QtTest/QtTest>
+#include <QTimer>
+#include <QSignalSpy>
+#include "debugtraces.h"
+#include "testmmsplugin.h"
+#include "convergedmessage.h"
+#include "convergedmessageid.h"
+#include "unieditormmsplugin.h"
+#include "mmstestbed.h"
+#include "testmmsplugin.ini"
+
+//---------------------------------------------------------------
+// TestMmsPlugin::initTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::initTestCase()
+{
+	//Instantiate UniEditorMmsPlugin and verify if it is correctly Instantited. 
+	msgPlugin = new UniEditorMmsPlugin();
+	QVERIFY(msgPlugin != NULL);
+	
+	//Verify if MMS service is Validated. 
+    QCOMPARE(msgPlugin->validateService(), 1);
+    QCOMPARE(msgPlugin->isServiceValid(), 1);
+    msgPlugin->setEncodingSettings(ETrue, ESmsEncodingNone, -1);
+    QString str("Hello");
+    TInt numOfRemainingChars = 1;
+    TInt numOfPDUs = 1;
+    TBool unicodeMode = ETrue;
+    TSmsEncoding smsEncoding = ESmsEncodingNone;
+    QVERIFY(msgPlugin->getNumPDUs(str, numOfRemainingChars, numOfPDUs, unicodeMode, smsEncoding) == true);
+    
+    //Verify MmsTestBed Instance. 
+    mmstestbed = new MmsTestBed;
+	QVERIFY(mmstestbed != NULL);
+	
+	//register user defined object to meta system.
+	qRegisterMetaType<long int> ("long int");
+	
+	//set up signalspy to listen to signals emitted by mmstestbed
+	spy_draft = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInDraft(long int)));
+	spy_outbox = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToOutbox(long int)));
+	spy_sent  = new QSignalSpy(mmstestbed, SIGNAL(entryMovedToSent(long int)));
+	spy_inbox = new QSignalSpy(mmstestbed, SIGNAL(entryCreatedInInbox(long int)));
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::init
+//---------------------------------------------------------------
+void TestMmsPlugin::init()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAttachment()
+{
+    //Create a Converged Message instance. 
+    QString subject  = TEST_MSG_SUBJECT;
+	qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+	
+	QString sender(TEST_SENDER);
+	ConvergedMessageAddress address(sender);
+	ConvergedMessageAttachmentList attachmentList;    
+
+	//Add a text attachment to attachment list. 
+	QString attachmentPath = TEST_ATTACHMENT5;
+	ConvergedMessageAttachment* attachment = 
+		new ConvergedMessageAttachment(attachmentPath, ConvergedMessageAttachment::EAttachment);
+	
+	attachmentList.append(attachment);
+	
+	//Instantiate a Converged Message object and set service a MMS
+	ConvergedMessage msg;
+	msg.setMessageType(ConvergedMessage::Mms);
+	
+	//Set Subject
+	msg.setSubject(subject);
+	
+	msg.setTimeStamp(timeStamp);
+	
+	//Set recipient. 
+	msg.addToRecipient(address);
+	
+	//Add attachments' list
+	msg.addAttachments(attachmentList);
+	msg.setPriority(ConvergedMessage::Normal);
+	
+	//Adding CC Address
+	QString ccAddress(TEST_CC);
+	ConvergedMessageAddress ccAdd(ccAddress);
+	msg.addCcRecipient(ccAdd);
+	
+	//Adding BCC Address
+	QString bccAddress(TEST_BCC);
+	ConvergedMessageAddress bccAdd(bccAddress);
+	msg.addBccRecipient(bccAdd);
+	
+	//Adding From Address
+	QString recipientAddress(TEST_SENDER);
+	ConvergedMessageAddress recipientAdd(recipientAddress);
+	msg.addFromRecipient(recipientAdd);
+	
+	//start send and prepare to test send-success or fail
+	mmstestbed->cleanAll();
+	mmstestbed->setConnectionLocal(true);
+	
+	//Get a valid MMS message ID and verify that it is valid.
+	mmsMsgId = msgPlugin->convertTo(&msg);
+	QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAttachment()
+{
+	long int mmsDraftMsgId;
+	
+	//check if draft-folder signal was received...this means message was created in draft 
+	if( 1 <= spy_draft->count())
+	{
+		//compare the msgid and verify with the ID given by MMS plugin 
+		void * temp = const_cast<void*>(spy_draft->at(0).at(0).data());
+		mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+		QVERIFY(mmsDraftMsgId == mmsMsgId);
+		
+		//Validate the MMS message with all the values set before. 
+		ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+		QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+		QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+		QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(draftMsg->attachments().count() == 1);
+		QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+		QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT5).mid(QString(TEST_ATTACHMENT5).indexOf(QString("Sample.txt"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+	}
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAttachment()
+{
+	//Send the MMS message and verify if it was sent successfully. 
+	bool sent = msgPlugin->send(mmsMsgId);
+	QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAttachment()
+{
+	QTest::qWait(10000);  //to ensure path completion
+	
+	//check if outbox-folder signal was received...this means message was moved to outbox for send    
+	if( 1 <= spy_outbox->count())
+	{
+		//compare the msgid
+		void * temp = const_cast<void*>(spy_outbox->at(0).at(0).data());
+		long int outboxId = *reinterpret_cast< long int(*)>(temp);
+		QCOMPARE(outboxId, mmsMsgId);
+		
+		//push the message from outbox to mmsc(sent folder)
+		mmstestbed->fromOutboxToMmsc();
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+		
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+		return;
+	}
+
+	//check if sent-folder signal was received....this means message was successfully sent scheduled.
+	if( 1 <= spy_sent->count())
+	{
+		//check for send-path
+		void * temp = const_cast<void*>(spy_sent->at(0).at(0).data());
+		long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+		QCOMPARE(sentmsgid, mmsMsgId);
+		
+		//issue a fetch request on the sent message, to test the receive path
+		mmstestbed->fromMmscToInbox();
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+	
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+		return;
+	}
+	
+	//check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+	if( spy_inbox->count() <= 0)
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+		
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+	}
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::createMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::createMMSWithTextAndImageAttachment()
+{
+    //Create a Converged Message instance. 
+    QString subject  = TEST_MSG_SUBJECT;
+	qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
+	
+	QString sender(TEST_SENDER);
+	ConvergedMessageAddress address(sender);
+	ConvergedMessageAttachmentList attachmentList;    
+
+	//Add a text attachment to attachment list. 
+	QString attachmentPath1 = TEST_ATTACHMENT5;
+	ConvergedMessageAttachment* attachment = 
+		new ConvergedMessageAttachment(attachmentPath1, ConvergedMessageAttachment::EInline);
+	
+	//Add an image attachment to attachment list. 
+	QString attachmentPath2 = TEST_ATTACHMENT4;
+    ConvergedMessageAttachment* attachmentImage = 
+        new ConvergedMessageAttachment(attachmentPath2, ConvergedMessageAttachment::EAttachment);
+    
+    attachmentList.append(attachment);
+    attachmentList.append(attachmentImage);
+    
+    //Instantiate a Converged Message object and set service a MMS
+	ConvergedMessage msg;
+	msg.setMessageType(ConvergedMessage::Mms);
+	msg.setSubject(subject);
+	msg.setTimeStamp(timeStamp);
+	msg.addToRecipient(address);
+	
+	//Add attachments' list
+	msg.addAttachments(attachmentList);
+	msg.setPriority(ConvergedMessage::Normal);
+	
+	//Adding CC Address
+	QString ccAddress(TEST_CC);
+	ConvergedMessageAddress ccAdd(ccAddress);
+	msg.addCcRecipient(ccAdd);
+	
+	//Adding BCC Address
+	QString bccAddress(TEST_BCC);
+	ConvergedMessageAddress bccAdd(bccAddress);
+	msg.addBccRecipient(bccAdd);
+	
+	//Adding From Address
+	QString recipientAddress(TEST_SENDER);
+	ConvergedMessageAddress recipientAdd(recipientAddress);
+	msg.addFromRecipient(recipientAdd);
+	
+	//start send and prepare to test send-success or fail
+	mmstestbed->cleanAll();
+	mmstestbed->setConnectionLocal(true);
+	
+	//Get a valid MMS message ID and verify that it is valid.
+	mmsMsgId = msgPlugin->convertTo(&msg);
+	QVERIFY(mmsMsgId != -1);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testMMSWithTextAndImageAttachment()
+{
+	long int mmsDraftMsgId;
+	
+	//check if draft-folder signal was received...this means message was created in draft 
+	if( 1 <= spy_draft->count())
+	{
+		//compare the msgid and verify with the ID given by MMS plugin 
+		void * temp = const_cast<void*>(spy_draft->at(1).at(0).data());
+		mmsDraftMsgId = *reinterpret_cast< long int(*)>(temp);
+		QVERIFY(mmsDraftMsgId == mmsMsgId);
+		
+		//Validate the MMS message with all the values set before. 
+		ConvergedMessage* draftMsg = msgPlugin->convertFrom(mmsDraftMsgId);
+		QVERIFY(draftMsg->subject().compare(QString(TEST_MSG_SUBJECT)) == 0);
+		QVERIFY(draftMsg->messageType() == ConvergedMessage::Mms);
+		QVERIFY(QString(TEST_SENDER).contains(draftMsg->toAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_CC).contains(draftMsg->ccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_BCC).contains(draftMsg->bccAddressList()[0]->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(QString(TEST_SENDER).contains(draftMsg->fromAddress()->address(), Qt::CaseInsensitive) == true);
+		QVERIFY(draftMsg->attachments().count() == 1);
+		QVERIFY(draftMsg->attachments()[0]->attachmentType() == ConvergedMessageAttachment::EAttachment);
+		QVERIFY(draftMsg->attachments()[0]->filePath().contains(QString(TEST_ATTACHMENT4).mid(QString(TEST_ATTACHMENT4).indexOf(QString("SmileyFace.gif"), 0, Qt::CaseInsensitive)), Qt::CaseInsensitive) == true);	
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to create message in Draft");
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+	}
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::sendMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::sendMMSWithTextAndImageAttachment()
+{
+	//Send the MMS message and verify if it was sent successfully. 
+	bool sent = msgPlugin->send(mmsMsgId);
+	QVERIFY(sent == true);
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::testSentMMSWithTextAndImageAttachment
+//---------------------------------------------------------------
+void TestMmsPlugin::testSentMMSWithTextAndImageAttachment()
+{
+	QTest::qWait(10000);  //to ensure path completion
+	
+	//check if outbox-folder signal was received...this means message was moved to outbox for send    
+	if( 1 <= spy_outbox->count())
+	{
+		//compare the msgid
+		void * temp = const_cast<void*>(spy_outbox->at(1).at(0).data());
+		long int outboxId = *reinterpret_cast< long int(*)>(temp);
+		QCOMPARE(outboxId, mmsMsgId);
+		
+		//push the message from outbox to mmsc(sent folder)
+		mmstestbed->fromOutboxToMmsc();
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Outbox");
+		
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+		return;
+	}
+
+	//check if sent-folder signal was received....this means message was successfully sent scheduled.
+	if( 1 <= spy_sent->count())
+	{
+		//check for send-path
+		void * temp = const_cast<void*>(spy_sent->at(1).at(0).data());
+		long int sentmsgid = *reinterpret_cast< long int(*)>(temp);
+		QCOMPARE(sentmsgid, mmsMsgId);
+		
+		//issue a fetch request on the sent message, to test the receive path
+		mmstestbed->fromMmscToInbox();
+	}
+	else
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Sent folder");
+	
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+		return;
+	}
+	
+	//check if inbox-folder signal was received....this means message was successfully received at the inbox folder.
+	if( spy_inbox->count() <= 0)
+	{
+		QFAIL("testSendReceiveMMS: Failed to move message to Inbox folder");
+		
+		//reset connection to 'global on, local off'
+		mmstestbed->setConnectionLocal(false);
+	}
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanup
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanup()
+{
+}
+
+//---------------------------------------------------------------
+// TestMmsPlugin::cleanupTestCase
+//---------------------------------------------------------------
+void TestMmsPlugin::cleanupTestCase()
+{
+	//Cleanup
+	delete spy_draft;//Signal for Draft Folder
+	delete spy_outbox;//Signal for Outbox Folder
+	delete spy_sent;//Signal for Sent Folder
+	delete spy_inbox;//Signal for inbox Folder
+    delete msgPlugin;//MMS Plugin
+    delete mmstestbed;//MMS Testbed
+}
+
+//End of File
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,322 +0,0 @@
-/*
- * 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:
- */
-
-#include "testmmsplugin.h"
-#include <QtTest/QtTest>
-#include "debugtraces.h"
-
-#include <QTimer>
-#include <QSignalSpy>
-
-#include "convergedmessage.h"
-#include "TestMsg.h"
-#include "convergedmessageid.h"
-#include "unieditormmsplugin.h"
-#include "messageserviceaction.h"
-//---------------------------------------------------------------
-// TestMmsPlugin::initTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::initTestCase()
-{
-    msgPlugin = new UniEditorMmsPlugin();
-    QVERIFY(msgPlugin != 0);
-    smsId = -1;
-    mmsId = -1;
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanupTestCase
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanupTestCase()
-{
-    delete msgPlugin;
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::init
-//---------------------------------------------------------------
-
-void TestMmsPlugin::init()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::cleanup
-//---------------------------------------------------------------
-void TestMmsPlugin::cleanup()
-{
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testSendMMS
-//---------------------------------------------------------------
-
-void TestMmsPlugin::testSendMMS()
-{
-
-    //register user defined object to meta system.
-    qRegisterMetaType<ConvergedMessage*> ("ConvergedMessage*");
-    
-
-    createMMSMessageWithAttachmentAndSend();
-     //wait for the response to complete 
-     //as sending a message goes through different stages
-     
-    //Create a smil attachment with image and text
-    createMMSMessageWithSmilTextAndImageAttachmentAndSend();
-   
-    //Create MMS with Normal priority
-    createMMSMessageWithAttachmentAndSend(ETrue);
-}
-
-
-void TestMmsPlugin::createMMSMessageWithSmilTextAndImageAttachmentAndSend()
-    {
-    QString service = TEST_SERVICE_NAME_MMS;
-    QString bodyText = TEST_MSG_BODY;
-    QString subject  = TEST_MSG_SUBJECT;
-    qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-    
-    QString sender(TEST_SENDER);
-    ConvergedMessageAddress address(sender);
-    ConvergedMessageAttachmentList attachmentList;
-  
-    ConvergedMessageAttachment* attachmentImage = 
-        new ConvergedMessageAttachment(TEST_ATTACHMENT4, ConvergedMessageAttachment::EAttachment);
-    attachmentList.append(attachmentImage);
-    
-    ConvergedMessageAttachment* attachmenttext = 
-            new ConvergedMessageAttachment(TEST_ATTACHMENT5, ConvergedMessageAttachment::EAttachment);
-    attachmentList.append(attachmenttext);
-    
-    ConvergedMessageAttachment* attachmentSmil = 
-                new ConvergedMessageAttachment(TEST_ATTACHMENT3, ConvergedMessageAttachment::ESmil);
-    attachmentList.append(attachmentSmil);
-     
-    
-    
-    ConvergedMessage msg;
-    msg.setMessageType(ConvergedMessage::Mms);
-    msg.setSubject(subject);
-    msg.setTimeStamp(timeStamp);
-    msg.addToRecipient(address);
-    msg.addAttachments(attachmentList);
-    msg.setPriority(ConvergedMessage::Low);
-    
-    long int id = msgPlugin->convertTo(&msg);
-    msgPlugin->send(id);
-
-    }
-
-
-//---------------------------------------------------------------
-// TestMmsPlugin::testMmsReceived
-//---------------------------------------------------------------
-void TestMmsPlugin::testMmsReceived()
-{
-    testReceived(msgPlugin->messageType());  
-    QTest::qWait(5000);
-}
-
-/*
- * Creates a Smil file with only a text document as attachment
- */
- 
-void TestMmsPlugin::createMMSMessageWithAttachmentAndSend(TBool priority)
-    {
-    QString service = TEST_SERVICE_NAME_MMS;
-    QString bodyText = TEST_MSG_BODY;
-    QString subject  = TEST_MSG_SUBJECT;
-    qint64 timeStamp = QDateTime::currentDateTime().toTime_t();
-    
-    QString sender(TEST_SENDER);
-    ConvergedMessageAddress address(sender);
-    ConvergedMessageAttachmentList attachmentList;    
-
-   
-    ConvergedMessageAttachment* attachment2 = 
-            new ConvergedMessageAttachment(TEST_ATTACHMENT2, ConvergedMessageAttachment::ESmil);
-    
-    ConvergedMessageAttachment* attachment = 
-        new ConvergedMessageAttachment(TEST_ATTACHMENT, ConvergedMessageAttachment::EAttachment);
-   
-    attachmentList.append(attachment);
-    
-    attachmentList.append(attachment2);
-    
-    ConvergedMessage msg;
-    msg.setMessageType(ConvergedMessage::Mms);
-    msg.setSubject(subject);
-    msg.setTimeStamp(timeStamp);
-    msg.addToRecipient(address);
-    msg.addAttachments(attachmentList);
-    if(priority == EFalse)
-        {
-        msg.setPriority(ConvergedMessage::Normal);
-        }
-    else
-        {
-        msg.setPriority(ConvergedMessage::High);
-        }
-    
-    //Adding alias
-    ConvergedMessageAddress address1;
-    address1.setAlias(QString(TEST_MSG_RECIEPIENT));
-    msg.addToRecipient(address1);
-    
-    //Adding CC Address
-    QString ccAddress(TEST_CC);
-    ConvergedMessageAddress ccAdd(ccAddress);
-    msg.addCcRecipient(ccAdd);
-    
-    //Adding BCC Address
-    QString bccAddress(TEST_BCC);
-    ConvergedMessageAddress bccAdd(bccAddress);
-    msg.addBccRecipient(bccAdd);
-    
-    long int id = msgPlugin->convertTo(&msg);
-    msgPlugin->send(id);
-    }
-    	
-//---------------------------------------------------------------
-// TestMmsPlugin::testReceived
-//---------------------------------------------------------------
-void TestMmsPlugin::testReceived(int type)
-{
-MessageServiceAction* messageAction = new MessageServiceAction(this);    
-    QVERIFY(messageAction != 0);
-
-    //register user defined object to meta system.
-    qRegisterMetaType<ConvergedMessage*>("ConvergedMessage*");
-
-    //signal spy.
-    //listen to added event
-    QSignalSpy spyAdd( messageAction,
-            SIGNAL(messageAdded(ConvergedMessage*, QString)));
-    //signal spy.
-    //listen to updated event
-        QSignalSpy spyUpdate( messageAction,
-                SIGNAL(messageUpdated(ConvergedMessage*, QString)));
-    //will force stub_clientmanager to emit messageUpdated.
-    messageAction->registerForNotification();
-    //register user defined object to meta system.
-
-    // wait for the response to come
-    QTest::qWait(5000);
-
-    //check signals
-    int countAdd = -1;
-    countAdd = spyAdd.count();
-
-    ConvergedMessage* message = 0;
-    QString serviceId("");
-    
-    if (countAdd)
-    {
-        //verify added event
-        void * temp = const_cast<void*> (spyAdd.at(0).at(0).data());
-        message = *reinterpret_cast<ConvergedMessage*(*)> (temp);
-        serviceId = spyAdd.at(0).at(1).toString();
-        QVERIFY(message != 0);
-        validateMsg(*message, serviceId);
-    }
-
-    int countUpdate = -1;
-    countUpdate = spyUpdate.count();
-    message = 0;
-
-    for (int i = countUpdate; i > 0; --i)
-    {
-        //verify updated event
-        void * temp = const_cast<void*> (spyUpdate.at(i-1).at(0).data());
-        message = *reinterpret_cast<ConvergedMessage*(*)> (temp);
-        if (ConvergedMessage::Inbox == message->location())
-        {
-            serviceId = spyUpdate.at(i-1).at(1).toString();
-            break;
-        }
-    }
-    if (message)
-    {
-        validateMsg(*message, serviceId);
-    }
-    delete message;
-}
-
-//---------------------------------------------------------------
-// TestMmsPlugin::validateMsg
-//---------------------------------------------------------------
-void TestMmsPlugin::validateMsg(const ConvergedMessage& message,
-                                const QString& serviceId)
-{
-#ifdef _DEBUG_TRACES_
-		qDebug() << "....message received.....";
-#endif
-
-    //process incoming messages
-    if (message.location() == ConvergedMessage::Inbox)
-    {
-        int msgId;
-        if (message.id())
-        {
-            msgId = message.id()->getId();
-        }
-        ConvergedMessageAddressList array = message.toAddressList();
-        if (array.count() > 0)
-        {
-            if (array[0])
-                QCOMPARE(array[0]->address(),QString(TEST_MSG_FROM1));
-        }
-        ConvergedMessageAddress *fromAddr = message.fromAddress();
-        if (fromAddr)
-        {
-            QCOMPARE(fromAddr->address(),QString(TEST_MSG_FROM1));
-        }
-
-        QCOMPARE(serviceId,QString(TEST_SERVICE_ID));
-
-        if (message.messageType() == ConvergedMessage::Mms)
-        {
-            mmsId = msgId;
-            QCOMPARE(message.subject(), QString(TEST_MSG_SUBJECT));
-        }
-        else if (message.messageType() == ConvergedMessage::Sms)
-        {
-            smsId = msgId;
-            QCOMPARE(message.bodyText(), QString(TEST_MSG_BODY));
-        }
-    }
-    else if (message.location() == ConvergedMessage::Sent)
-    {
-        ConvergedMessageAddressList array = message.toAddressList();
-        if (array.count() > 0)
-        {
-            if (array[0])
-                QCOMPARE(array[0]->address(),QString(TEST_SENDER));
-        }
-
-   //     QCOMPARE(serviceId,QString(TEST_SERVICE_ID));
-
-        if (message.messageType() == ConvergedMessage::Mms)
-        {
-            QCOMPARE(message.subject(), QString(TEST_MSG_SUBJECT));
-        }
-        else if (message.messageType() == ConvergedMessage::Sms)
-        {
-            QCOMPARE(message.bodyText(), QString(TEST_MSG_BODY));
-        }
-    }
-}
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/*
- * 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:
- */
-
-#ifndef TEST_MMS_PLUGIN_H
-#define TEST_MMS_PLUGIN_H
-
-#ifdef BUILD_TEST_DLL
-#define TEST_EXPORT Q_DECL_EXPORT
-#else
-#define TEST_EXPORT Q_DECL_IMPORT
-#endif
-
-#include <QObject>
-#include <e32const.h>
-
-class UniEditorMmsPlugin;
-class ConvergedMessage;
-
-class TEST_EXPORT TestMmsPlugin: public QObject
-    {
-    Q_OBJECT
-
-private slots:
-    //called by frame work.
-    void initTestCase();//called before the first testfunction is executed.
-    void cleanupTestCase();//called after the last testfunction was executed.
-    void init();//called before each testfunction is executed.
-    void cleanup();//called after every testfunction.
-
-    //test cases.
-    void testSendMMS(); //test sending mms
-    void testMmsReceived(); // test receiving mms    
-
-private:
-    void testReceived(int type);
-    void validateMsg(const ConvergedMessage& message, const QString& serviceId);
-    void createMMSMessageWithAttachmentAndSend(TBool priority = EFalse);
-    void createMMSMessageWithSmilTextAndImageAttachmentAndSend();
-private:
-    UniEditorMmsPlugin* msgPlugin;
-    int smsId;
-    int mmsId;
-    };
-#endif //TEST_MMS_PLUGIN_H
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.ini	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-//this file is used to provide predefined set of input data.
-
-//eg.
-const char TEST_SERVICE_SMS[]     = "SMS";
-const char TEST_SERVICE_ID[]      = "messaging.mserver";
-const char TEST_SERVICE_SMS_ID[]  = "messaging.mserver.sms";
-const char TEST_SERVICE_MMS_ID[]  = "messaging.mserver.mms";
-const char TEST_SERVICE_MMS[]     = "MMS";
-const char TEST_MSG_BODY[]        = "TestTextE_1_2";
-const char TEST_MSG_RECIEPIENT[]  = "Javaid Nabi<+919741596546>";
-const char TEST_MSG_FROM1[]       = "+44111111111";
-const char SERVICE_CENTER_01[]    = "+447802000332";
-const char SERVICE_CENTER_02[]    = "+919845087001";
-const char TEST_MSG_ALIAS1[]      = "Javaid Nabi";
-const char TEST_MSG_FROM2[]       = "9797979797";
-const char TEST_MSG_ALIAS2[]      = "Rajesh Batchu";
-const char TEST_MSG_SUBJECT[]     = "Message Subject";
-const char TEST_SERVICE_NAME_MMS[] 	= "messaging.mserver.testservice.MMS";
-const char TEST_SENDER[]			= "DummySender";
-const char TEST_ATTACHMENT[]		= "c:/sample.txt";
-const char TEST_ATTACHMENT2[]		= "c:/HelloWorld.smil";
-const char TEST_ATTACHMENT3[]		= "c:/ImageFile.smil";
-const char TEST_ATTACHMENT4[]		= "c:/SmileyFace.gif";
-const char TEST_ATTACHMENT5[]		= "c:/testfile.txt";
-const char TEST_MSG_TO3[]       = "SS<+44111111111>";
-const char TEST_CC[]			= "DummyCCAddress";
-const char TEST_BCC[]			= "DummyBCCAddress";
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -20,25 +20,31 @@
 TEMPLATE = lib
 TARGET = test-mms-plugin
 
-
-INCLUDEPATH += .
-INCLUDEPATH += ../../../../../../inc
-INCLUDEPATH += ../../../../unieditorutils/inc
-INCLUDEPATH += ../../../../s60qconversions/inc
+INCLUDEPATH += ./inc
+INCLUDEPATH += ../../../../../../../inc
+INCLUDEPATH += ../../../../../unidatautils/unidatamodels/inc
+INCLUDEPATH += ../../../../../s60qconversions/inc
+INCLUDEPATH += ../../../../editorgenutils/inc
+INCLUDEPATH += ../../../../../../../inc
+INCLUDEPATH += ../../../../../../../mmsengine/mmsmessage/inc 
+INCLUDEPATH += ../../../../../../../mmsengine/inc
+INCLUDEPATH += ../../../../../unidatautils/unidatamodel/inc
+INCLUDEPATH += ../mmstestbed/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_TEST_DLL
 
+CONFIG += hb plugin
+
 SOURCES += \
-  testmmsplugin.cpp \
+  ./src/testmmsplugin.cpp \
   ../../src/unieditormmsplugin.cpp \
   ../../src/unieditormmsplugin_p.cpp  
          
 
 # Input
 HEADERS += \
-  testmmsplugin.h \
-  testmsg.h \
+  ./inc/testmmsplugin.h \
   ../../inc/unieditormmsplugin.h \
   ../../inc/unieditormmsplugin_p.h 
                
@@ -84,6 +90,14 @@
   	-lcommdb \
   	-lcommsdat \
   	-letelmm \
-  	-lgenericclient \
-  	-lunidatamodelloader
-  	
+  	-lunidatamodelloader \
+  	-lunidatamodel \
+  	-lavkon \
+  	-leikcoctl \
+  	-leikctl \
+  	-lform \
+  	-luiklaf\ 
+  	-lmmstestbed \
+	-lmmsmessage \ 
+	-lmmsserversettings \
+	-lxqutils 
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/testmmsgplugin/testmsg.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,600 +0,0 @@
-/*
- * 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:
- */
-
-#ifndef TEST_MSG_H
-#define TEST_MSG_H
-//Headers 
-#include <e32svr.h>
-#include <SMUTHDR.H>
-#include <msvapi.h>
-#include <smut.h>
-#include <msvstd.h>
-#include <rsendas.h>
-#include <rsendasmessage.h>
-#include <SMSCLNT.H>
-#include <csmsaccount.h> 
-//#include <MTMStore.h>
-#include <mtclreg.h>
-#include <mtclbase.h>
-#include <txtrich.h> 				// CRichText
-#include <msvids.h>            // for Message type IDs
-#include <mmsclient.h>       // for CMmsClientMtm
-#include <CMsvMimeHeaders.h>        //Attachemt mimeheader
-#include <MMsvAttachmentManager.h>  //Attachment manager
-#include <MMsvAttachmentManagerSync.h>
-#include <f32file.h>                //parse
-#include <utf.h>
-
-#include <e32base.h>
-#include <e32property.h>
-#include <simtsy.h>
-#include <etelmm.h>
-#include <es_ini.h>
-#include <commsdattypesv1_1.h>
-#include <commsdat.h>
-
-#include <Qtdebug>
-#include <s60qconversions.h>
-#include "testmmsplugin.ini"
-
-using namespace CommsDat;
-
-const TInt KMsvTestUidPhonePwrValue = 0x100052C5;
-enum TMsvTestPhoneStatus
-    {
-    EMsvTestPhoneOff = 0,
-    EMsvTestPhoneOn
-    };
-
-class TestMsg : public MMsvSessionObserver
-{
-public:
-
-    TestMsg();
-    ~TestMsg();
-
-    void createSCSettings();
-
-    void createSMS();
-    void createMMS();
-
-    void deleteMessage(int msgId);
-
-    void initSimTsyL();
-
-public: //MMsvSessionObserver
-
-    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2,
-                             TAny* aArg3);
-
-private:
-
-    void initL();
-    void createSMSL(TMsvId aFolderId, TBool aUnReadFlag);
-    void createMMSL(TMsvId aFolderId, TBool aUnReadFlag);
-    void initializeSimTsyL(TInt aTestNumber, HBufC* aTsyName);
-
-private:
-
-    CMsvSession* iSession;
-    CClientMtmRegistry* iMtmRegistry;
-    CSmsClientMtm *smsClientMtm;
-};
-
-//---------------------------------------------------------------
-// TestMsg::TestMsg
-//---------------------------------------------------------------
-TestMsg::TestMsg()
-{
-    int err;
-    TRAP(err,initL());
-    #ifdef _DEBUG_TRACES_
-qDebug() << "Error in initialization:" << err;
-#endif
-
-}
-
-//---------------------------------------------------------------
-// TestMsg::TestMsg
-//---------------------------------------------------------------
-TestMsg::~TestMsg()
-{
-    if(smsClientMtm)
-    {
-        delete smsClientMtm;
-        smsClientMtm = NULL;
-    }
-    
-    if (iMtmRegistry)
-    {
-        delete iMtmRegistry;
-        iMtmRegistry = NULL;
-    }
-
-    if (iSession)
-    {
-        delete iSession;
-        iSession = NULL;
-    }
-}
-
-//---------------------------------------------------------------
-// TestMsg::createSCSettings
-//---------------------------------------------------------------
-void TestMsg::createSCSettings()
-{
-    smsClientMtm = static_cast<CSmsClientMtm*> (iMtmRegistry->NewMtmL(KUidMsgTypeSMS));
-
-    TMsvSelectionOrdering ordering;
-
-    CMsvEntry* root = CMsvEntry::NewL(smsClientMtm->Session(),
-                                      KMsvRootIndexEntryId,
-                                      ordering);
-
-    CSmsAccount* smsAccount = CSmsAccount::NewLC();
-
-    CSmsSettings* settings = CSmsSettings::NewL();
-    CleanupStack::PushL(settings);
-    smsAccount->LoadSettingsL(*settings);
-
-    TMsvEntry entry;
-    entry.iMtm = KUidMsgTypeSMS;
-    entry.iType = KUidMsvServiceEntry;
-    entry.SetReadOnly(EFalse);
-    entry.SetVisible(EFalse);
-    entry.iDate.UniversalTime();
-    entry.iDetails.Set(_L("Nokiatest"));
-
-    root->SetEntryL(KMsvRootIndexEntryId);
-    root->CreateL(entry);
-
-    QString serviceCenter01(SERVICE_CENTER_01);
-    QString serviceCenter02(SERVICE_CENTER_02);
-    HBufC* sC01 = S60QConversions::qStringToS60Desc(serviceCenter01);
-    HBufC* sC02 = S60QConversions::qStringToS60Desc(serviceCenter02);
-    CleanupStack::PushL(sC01);
-    CleanupStack::PushL(sC02);
-    settings->AddServiceCenterL(_L("Nokia"), *sC01);
-    settings->AddServiceCenterL(_L("Nokia"), *sC02);
-    CleanupStack::PopAndDestroy(sC02);
-    CleanupStack::PopAndDestroy(sC01);
-    settings->SetDefaultServiceCenter(1);
-    settings->SetValidityPeriod(ESmsVPWeek);
-    settings->SetReplyQuoted(ETrue);
-    settings->SetRejectDuplicate(ETrue);
-    settings->SetDelivery(ESmsDeliveryImmediately);
-    settings->SetDeliveryReport(EFalse);
-    settings->SetReplyPath(EFalse);
-    settings->SetMessageConversion(ESmsConvPIDNone);
-    settings->SetCanConcatenate(ETrue);
-    settings->SetCharacterSet(TSmsDataCodingScheme::ESmsAlphabet7Bit);
-    settings->SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFInteger);
-    settings->SetStatusReportHandling(CSmsSettings::EMoveReportToInboxVisible);
-    settings->SetSpecialMessageHandling(CSmsSettings::EMoveReportToInboxVisible);
-    settings->SetSmsBearer(CSmsSettings::ESmsBearerCircuitPreferred);
-    settings->SetCommDbAction(CSmsSettings::ENone);
-    settings->SetSmsBearerAction(CSmsSettings::ENone);
-    smsAccount->SaveSettingsL(*settings);
-
-    CleanupStack::PopAndDestroy(settings);
-    CleanupStack::PopAndDestroy(smsAccount);
-}
-
-//---------------------------------------------------------------
-// TestMsg::createSMS
-//---------------------------------------------------------------
-void TestMsg::createSMS()
-{
-    int err;
-    TRAP(err,createSMSL(KMsvGlobalInBoxIndexEntryId,ETrue));
-    #ifdef _DEBUG_TRACES_
-qDebug() << "Error in creating SMS:" << err;
-#endif
-
-}
-
-//---------------------------------------------------------------
-// TestMsg::createMMS
-//---------------------------------------------------------------
-void TestMsg::createMMS()
-{
-    int err;
-    TRAP(err,createMMSL(KMsvGlobalInBoxIndexEntryId,ETrue));
-    #ifdef _DEBUG_TRACES_
-qDebug() << "Error in creating MMS:" << err;
-#endif
-
-}
-
-//---------------------------------------------------------------
-// TestMsg::initL
-//---------------------------------------------------------------
-void TestMsg::initL()
-{
-    iSession = CMsvSession::OpenSyncL(*this);
-    iMtmRegistry = CClientMtmRegistry::NewL(*iSession);
-}
-
-//---------------------------------------------------------------
-// TestMsg::createSMSL
-//---------------------------------------------------------------
-void TestMsg::createSMSL(TMsvId aFolderId, TBool aUnReadFlag)
-{
-    CSmsClientMtm *smsClientMtm =
-            static_cast<CSmsClientMtm*> (iMtmRegistry->NewMtmL(KUidMsgTypeSMS));
-    CleanupStack::PushL(smsClientMtm);
-    //Create entry from this index entry
-
-    smsClientMtm->SwitchCurrentEntryL(aFolderId);
-    smsClientMtm->CreateMessageL(KUidMsgTypeSMS.iUid);
-    TMsvEntry indexEntry = smsClientMtm->Entry().Entry();
-    indexEntry.SetInPreparation(ETrue);
-    indexEntry.iMtm = KUidMsgTypeSMS;
-    indexEntry.iType = KUidMsvMessageEntry;
-    indexEntry.iServiceId = smsClientMtm->ServiceId();
-    indexEntry.iDate.HomeTime();
-    //AddBody
-    QString body(TEST_MSG_BODY);
-
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
-    if (bodyText)
-    {
-        CleanupStack::PushL(bodyText);
-        CRichText & body = smsClientMtm->Body();
-        body.Reset();
-        body.InsertL(0, *bodyText);
-
-        TBuf<32> buf;
-        buf.Copy(bodyText->Left(32));
-        indexEntry.iDescription.Set(buf);
-
-        CleanupStack::PopAndDestroy(bodyText);
-    }
-
-    // Add addressee
-    //Add Address
-    QString recipient(TEST_MSG_FROM1);
-    // convert from QString to HBufC 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recipient);
-    if (addr)
-    {
-        CleanupStack::PushL(addr);
-        TBuf<32> name;
-        name.Copy(addr->Left(32));
-        indexEntry.iDetails.Set(name);
-
-        if (aFolderId == KMsvDraftEntryId || aFolderId
-                == KMsvGlobalOutBoxIndexEntryId)
-        {
-            smsClientMtm->AddAddresseeL(*addr, TPtrC());
-            indexEntry.SetSendingState(KMsvSendStateWaiting);
-        }
-        else if (aFolderId == KMsvSentEntryId || aFolderId
-                == KMsvGlobalInBoxIndexEntryId)
-        {
-            CSmsHeader& smsHeader = smsClientMtm->SmsHeader();
-            smsHeader.SetFromAddressL(*addr);
-        }
-        CleanupStack::PopAndDestroy(addr);
-    }
-
-    // final fine tuning
-    indexEntry.SetAttachment(EFalse);
-    indexEntry.SetVisible(ETrue);
-    indexEntry.SetInPreparation(EFalse);
-
-    if (aFolderId == KMsvGlobalInBoxIndexEntryId)
-    {
-        if (aUnReadFlag)
-        {
-            indexEntry.SetUnread(ETrue);
-        }
-        indexEntry.SetNew(ETrue);
-    }
-    indexEntry.SetComplete(ETrue);
-    smsClientMtm->Entry().ChangeL(indexEntry);
-    smsClientMtm->SaveMessageL();
-
-    CleanupStack::PopAndDestroy(smsClientMtm);
-}
-
-//---------------------------------------------------------------
-// TestMsg::createMMSL
-//---------------------------------------------------------------
-void TestMsg::createMMSL(TMsvId aFolderId, TBool aUnReadFlag)
-{
-    CMmsClientMtm
-            *mmsClientMtm =
-                    static_cast<CMmsClientMtm*>
-    (iMtmRegistry->NewMtmL(KUidMsgTypeMultimedia));
-    CleanupStack::PushL(mmsClientMtm);
-    //Create entry from this index entry
-
-    mmsClientMtm->SwitchCurrentEntryL(aFolderId);
-    mmsClientMtm->CreateMessageL(mmsClientMtm->DefaultServiceL());
-
-    TMsvEntry indexEntry = mmsClientMtm->Entry().Entry();
-    indexEntry.SetInPreparation(ETrue);
-    indexEntry.iMtm = KUidMsgTypeMultimedia;
-    indexEntry.iType = KUidMsvMessageEntry;
-    indexEntry.iServiceId = mmsClientMtm->DefaultServiceL();
-    indexEntry.iDate.HomeTime();
-
-    //Subject
-    QString subject(TEST_MSG_SUBJECT);
-
-    HBufC* sub = S60QConversions::qStringToS60Desc(subject);
-    if (sub)
-    {
-        CleanupStack::PushL(sub);
-
-        TBuf<32> buf;
-        buf.Copy(sub->Left(32));
-        indexEntry.iDescription.Set(buf);
-
-        mmsClientMtm->SetSubjectL(*sub);
-        CleanupStack::PopAndDestroy(sub);
-    }
-
-    // Add addressee
-    //Add Address
-    QString recipient(TEST_MSG_FROM1);
-    // convert from QString to HBufC 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recipient);
-    if (addr)
-    {
-        CleanupStack::PushL(addr);
-        TBuf<32> name;
-        name.Copy(addr->Left(32));
-        indexEntry.iDetails.Set(name);
-
-        if (aFolderId == KMsvDraftEntryId || aFolderId
-                == KMsvGlobalOutBoxIndexEntryId)
-        {
-            mmsClientMtm->AddAddresseeL(*addr);
-            indexEntry.SetSendingState(KMsvSendStateWaiting);
-        }
-        else if (aFolderId == KMsvSentEntryId || aFolderId
-                == KMsvGlobalInBoxIndexEntryId)
-        {
-            mmsClientMtm->SetSenderL(*addr);
-            mmsClientMtm->AddAddresseeL(*addr);
-        }
-        CleanupStack::PopAndDestroy(addr);
-    }
-
-    // final fine tuning
-    indexEntry.SetVisible(ETrue);
-    indexEntry.SetInPreparation(EFalse);
-
-    if (aFolderId == KMsvGlobalInBoxIndexEntryId)
-    {
-        if (aUnReadFlag)
-        {
-            indexEntry.SetUnread(ETrue);
-        }
-        indexEntry.SetNew(ETrue);
-    }
-
-    //body text
-    QString bodyText(TEST_MSG_BODY);
-    HBufC* text = S60QConversions::qStringToS60Desc(bodyText);
-    if (text)
-    {
-        CleanupStack::PushL(text);
-
-        //we may need some conversion of text here
-        const TInt KMmsMaxBytesPerCharacter = 4;
-        HBufC8* buffer = HBufC8::NewL( text->Length() * KMmsMaxBytesPerCharacter );
-        CleanupStack::PushL( buffer );
-        TPtr8 buf8 = buffer->Des();
-
-        // get an access to the message store
-        CMsvStore* store = mmsClientMtm->Entry().EditStoreL();
-        CleanupStack::PushL(store);
-
-        CMsvMimeHeaders* mimeHeaders = CMsvMimeHeaders::NewL();
-        CleanupStack::PushL( mimeHeaders );
-
-        CMsvAttachment* attaInfo = CMsvAttachment::NewL(CMsvAttachment::EMsvFile);
-        CleanupStack::PushL( attaInfo );
-
-        TPtrC8 contentType;
-        contentType.Set( KMmsTextPlain );
-
-        TInt position = contentType.Find( KMmsSlash8 );
-        mimeHeaders->SetContentTypeL( contentType.Left( position ) );
-        mimeHeaders->SetContentSubTypeL( contentType.Mid( position + 1 ) );
-        attaInfo->SetMimeTypeL( contentType );
-        attaInfo->SetAttachmentNameL( _L("body.txt") );
-
-        mimeHeaders->SetMimeCharset( KMmsUtf8 );
-        mimeHeaders->SetSuggestedFilenameL( _L("body.txt") );
-
-        // if conversion fails, something is really seriously wrong
-        TInt error = CnvUtfConverter::ConvertFromUnicodeToUtf8( buf8, *text );
-
-        attaInfo->SetSize( buf8.Length() );
-        mimeHeaders->StoreL( *attaInfo ); // Mime headers are streamed into atta info
-
-        MMsvAttachmentManagerSync& attaManSync = store->AttachmentManagerExtensionsL();
-        RFile textFile;
-
-        attaManSync.CreateAttachmentL( _L("body.txt"), textFile, attaInfo );
-        CleanupStack::Pop( attaInfo ); //ownership was transferred.
-
-        CleanupClosePushL( textFile );
-
-        //get attachement id, we need it incase of failure
-        TMsvAttachmentId attachmentId = attaInfo->Id();
-        // Now our file handle is open for writing
-        if ( buf8.Length()> 0 )
-        {
-            textFile.Write( buf8 );
-            error = textFile.Flush();
-        }
-        // we must always close
-        CleanupStack::PopAndDestroy( &textFile ); // close textFile
-        CleanupStack::PopAndDestroy( mimeHeaders );
-
-        store->CommitL();
-        CleanupStack::PopAndDestroy(store);
-        CleanupStack::PopAndDestroy( buffer );
-        CleanupStack::PopAndDestroy(text);
-    }
-
-    indexEntry.SetComplete(ETrue);
-    mmsClientMtm->Entry().ChangeL(indexEntry);
-    mmsClientMtm->SaveMessageL();
-
-    // cleanup    
-    CleanupStack::PopAndDestroy(mmsClientMtm);
-}
-
-void TestMsg::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/,
-                                  TAny* /*aArg2*/, TAny* /*aArg3*/)
-{
-}
-
-void TestMsg::deleteMessage(int msgId)
-{
-    CMsvEntry* cEntry = iSession->GetEntryL(KMsvGlobalInBoxIndexEntryId);
-    CleanupStack::PushL(cEntry);
-
-    CMsvEntry* entry = iSession->GetEntryL(msgId);
-    CleanupStack::PushL(entry);
-
-    TMsvEntry tEntry = entry->Entry();
-    tEntry.SetReadOnly(EFalse);
-    entry->ChangeL(tEntry);
-
-    cEntry->DeleteL(msgId);
-    CleanupStack::PopAndDestroy(entry);
-    CleanupStack::PopAndDestroy(cEntry);
-
-}
-
-void TestMsg::initSimTsyL()
-{
-    _LIT(KDefaultTsyName, "SIM");
-    TPtrC defaultTsyName(KDefaultTsyName);
-    HBufC* defaultTsyNameBuf = defaultTsyName.AllocLC();
-    TInt testNumber = 0;
-
-    initializeSimTsyL(testNumber, defaultTsyNameBuf);
-
-    CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion());
-    CleanupStack::PushL(dbSession);
-
-    CMDBRecordLink<CCDModemBearerRecord>
-            *modemBearerRecordSet = new (ELeave) CMDBRecordLink<
-                    CCDModemBearerRecord> (KCDTIdGlobalSettingsRecord
-                    | KCDTIdModemPhoneServicesSMS);
-    CleanupStack::PushL(modemBearerRecordSet);
-
-    modemBearerRecordSet->SetRecordId(1);
-    //Load field container with data from database
-    TRAPD(err, modemBearerRecordSet->LoadL(*dbSession));
-    CCDModemBearerRecord
-            *modemRecord =
-                    static_cast<CCDModemBearerRecord*>
-    (CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord));
-    CleanupStack::PushL(modemRecord);
-
-    /*!
-     * Set the record ID to that previously read from
-     * CCDGlobalSettingsRecord.iModemForPhoneServicesAndSMS
-     */
-    modemRecord->SetRecordId(*modemBearerRecordSet);
-
-    //Load record container with data from database
-    modemRecord->LoadL(*dbSession);
-
-    modemRecord->iTsyName.SetMaxLengthL(defaultTsyNameBuf->Des().Length());
-    modemRecord->iTsyName = defaultTsyNameBuf->Des();
-    modemRecord->ModifyL(*dbSession);
-
-    CleanupStack::PopAndDestroy(4);
-}
-
-void TestMsg::initializeSimTsyL(TInt aTestNumber, HBufC* aTsyName)
-{
-    //Initialize TSY using the System Agent
-    TInt testState;
-    if (KErrNone != RProperty::Get(KUidPSSimTsyCategory,
-                                   KPSSimTsyTestNumber,
-                                   testState))
-    {
-        User::LeaveIfError(RProperty::Define(KUidPSSimTsyCategory,
-                                             KPSSimTsyTestNumber,
-                                             RProperty::EInt));
-    }
-
-    User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory,
-                                      KPSSimTsyTestNumber,
-                                      aTestNumber));
-    if (KErrNone != RProperty::Get(KUidSystemCategory,
-                                   KMsvTestUidPhonePwrValue,
-                                   testState))
-    {
-        User::LeaveIfError(RProperty::Define(KUidSystemCategory,
-                                             KMsvTestUidPhonePwrValue,
-                                             RProperty::EInt));
-    }
-    User::LeaveIfError(RProperty::Set(KUidSystemCategory,
-                                      KMsvTestUidPhonePwrValue,
-                                      EMsvTestPhoneOn));
-
-    User::LeaveIfError(RProperty::Get(KUidPSSimTsyCategory,
-                                      KPSSimTsyTestNumber,
-                                      aTestNumber));
-
-    RTelServer etelServer;
-    TInt err = etelServer.Connect();
-
-    if (err != KErrNone)
-    {
-        return;
-    }
-    User::LeaveIfError(etelServer.LoadPhoneModule(aTsyName->Des()));
-
-    /*!
-     * Find the phone corresponding to this TSY and open a number of
-     * handles on it
-     */
-    TInt numPhones;
-    User::LeaveIfError(etelServer.EnumeratePhones(numPhones));
-    TBool found = EFalse;
-
-    RMobilePhone iPhone;
-    while (!found && numPhones--)
-    {
-        TName phoneTsy;
-        User::LeaveIfError(etelServer.GetTsyName(numPhones, phoneTsy));
-        if (phoneTsy.CompareF(aTsyName->Des()) == KErrNone)
-        {
-            found = ETrue;
-            RTelServer::TPhoneInfo info;
-            User::LeaveIfError(etelServer.GetPhoneInfo(numPhones, info));
-            CleanupClosePushL(iPhone);
-            User::LeaveIfError(iPhone.Open(etelServer, info.iName));
-            User::LeaveIfError(iPhone.Initialise());
-            CleanupStack::PopAndDestroy(&iPhone);
-        }
-    }
-}
-
-#endif //TEST_MSG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/tsrc/tsrc.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,22 @@
+#
+# 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:
+#
+
+TEMPLATE = subdirs
+
+SUBDIRS += mmstestbed/mmstestbed.pro 
+SUBDIRS += testmmsgplugin/testmmsplugin.pro
+
+CONFIG += ordered
\ No newline at end of file
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditormmsplugin/unieditormmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,6 @@
 
 
 
-INCLUDEPATH += ../../../s60qconversions/inc
 INCLUDEPATH += ../../editorgenutils/inc
 INCLUDEPATH += ../../../../../inc
 INCLUDEPATH += ../../../../../mmsengine/mmsmessage/inc 
@@ -56,10 +55,10 @@
 				 -leditorgenutils \
 				 -lunidatamodelloader \
 				 -lconvergedmessageutils \
-				 -ls60qconversions \
 				 -lunidatamodel \
 				 -lmsgmedia \
-				 -leikctl 
+				 -leikctl \
+				 -lxqutils 
 
 	
 # Build.inf rules
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/inc/unieditorsmsplugin_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -110,7 +110,7 @@
         inline void SetUnicodeMode( TBool aUnicodeMode );
         
         //Turkish SMS(PREQ2265) specific...
-        void SetEncodingSettings(TBool aUnicodeMode, TSmsEncoding aAlternativeEncodingType, TInt charSupportType);
+        void SetEncodingSettingsL(TBool aUnicodeMode, TSmsEncoding aAlternativeEncodingType, TInt charSupportType);
        
         /**
          * for deciding on reduced or full charset support
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/rom/unieditorsmsplugin.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 #ifndef __UNI_EDITOR_SMS_PLUGIN_IBY__
 #define __UNI_EDITOR_SMS_PLUGIN_IBY__
 
-# this is the plugin stub for QT plugin
+
 file=ABI_DIR\UREL\unieditorsmsplugin.dll               SHARED_LIB_DIR\unieditorsmsplugin.dll
 data=\epoc32\data\z\resource\qt\plugins\messaging\editorplugins\unieditorsmsplugin.qtplugin              \resource\qt\plugins\messaging\editorplugins\unieditorsmsplugin.qtplugin
 
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -20,7 +20,7 @@
 // USER INCLUDES
 #include "unieditorsmsplugin.h"
 #include "unieditorsmsplugin_p.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 
 // DEBUG
 #include "debugtraces.h"
@@ -140,8 +140,10 @@
 void UniEditorSmsPlugin::setEncodingSettings(TBool aUnicodeMode,
     TSmsEncoding aAlternativeEncodingType, TInt charSupportType)
 {
-    d_ptr->SetEncodingSettings(aUnicodeMode, aAlternativeEncodingType,
-        charSupportType);
+    TRAPD(error, d_ptr->SetEncodingSettingsL(aUnicodeMode,
+            aAlternativeEncodingType,
+            charSupportType));
+    QDEBUG_WRITE_FORMAT("UniEditorSmsPlugin::setEncodingSettings error = ",error);
 }
 
 //---------------------------------------------------------------
@@ -153,7 +155,7 @@
     TSmsEncoding& aAlternativeEncodingType)
 {
     TBool ret = ETrue;
-    HBufC* buffer = S60QConversions::qStringToS60Desc(aBuf);
+    HBufC* buffer = XQConversions::qStringToS60Desc(aBuf);
     TRAPD(error,d_ptr->GetNumPDUsL(*buffer,aNumOfRemainingChars,
                     aNumOfPDUs,aUnicodeMode,aAlternativeEncodingType));
     delete buffer;
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/src/unieditorsmsplugin_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -57,13 +57,13 @@
 #include "convergedmessage.h"
 #include "convergedmessageid.h"
 #include "convergedmessageattachment.h"
-#include "s60qconversions.h"
+
 #include "MuiuOperationWait.h"
 #include "UniEditorGenUtils.h"
 #include "unidatamodelloader.h"
 #include "unidatamodelplugininterface.h"
 #include <hbglobal.h> // for translation support
-
+#include <xqconversions.h>
 // resources
 
 // CONSTANTS
@@ -436,12 +436,12 @@
     int addrCount = addrList.count();
     for(int i=0; i<addrCount; i++)
     {
-        HBufC* addr = S60QConversions::qStringToS60Desc( addrList.at(i)->address() );
-        HBufC* alt_alias = S60QConversions::qStringToS60Desc( addrList.at(i)->alias() );
-        if(addr)
+        HBufC* addr = XQConversions::qStringToS60Desc( addrList.at(i)->address() );
+        HBufC* alt_alias = XQConversions::qStringToS60Desc( addrList.at(i)->alias() );
+        if(addr->Length() > 0)
         {
             CleanupStack::PushL(addr);
-            if(alt_alias)
+            if(alt_alias->Length() > 0)
                 CleanupStack::PushL(alt_alias);
             HBufC* pureAddr = TMmsGenUtils::PureAddress( *addr ).AllocLC();
             HBufC* aliasAddr = TMmsGenUtils::Alias( *addr ).AllocLC();
@@ -461,7 +461,7 @@
                 }
                 else
                 {
-                    if(alt_alias)
+                    if(alt_alias->Length() > 0)
                     {
                         SmsMtmL()->AddAddresseeL( *pureAddr, *alt_alias );
                         appendbuf.Set(alt_alias->Des().Left(appendLen));
@@ -482,7 +482,7 @@
 
             // cleanup
             CleanupStack::PopAndDestroy(2, pureAddr );            
-            if(alt_alias)
+            if(alt_alias->Length() > 0)
             {
                 CleanupStack::PopAndDestroy( alt_alias );
             }
@@ -505,14 +505,14 @@
         CMsvEntry& entry = SmsMtmL()->Entry();
         TMsvEntry msvEntry( entry.Entry() );
         msvEntry.iDetails.Set( idetailsBuf );
+        entry.ChangeL( msvEntry );
         SmsMtmL()->SaveMessageL();
-        entry.ChangeL( msvEntry );
     }
 
     // set subject
     if ( !message->subject().isEmpty() )
     {
-        HBufC* subj = S60QConversions::qStringToS60Desc( message->subject() );
+        HBufC* subj = XQConversions::qStringToS60Desc( message->subject() );
         if( subj )
         {
             CleanupStack::PushL( subj );
@@ -531,7 +531,7 @@
 // -----------------------------------------------------------------------------
 void UniEditorSmsPluginPrivate::SetSmsBodyL(ConvergedMessage* message)
 {
-    HBufC8* bodytext = S60QConversions::qStringToS60Desc8( message->bodyText() );
+    HBufC8* bodytext = XQConversions::qStringToS60Desc8( message->bodyText() );
     if( bodytext->Length() > 0)
     {
         CleanupStack::PushL( bodytext );
@@ -585,7 +585,7 @@
         {
          // create msv attachment in store
         CreateAttachmentL(store,
-                *S60QConversions::qStringToS60Desc(attachment->filePath()));
+                *XQConversions::qStringToS60Desc(attachment->filePath()));
         
         // check for mimetype of the attachment
         TPtrC8 mimetype;
@@ -594,7 +594,7 @@
         TMsgMediaType attMediaType = EMsgMediaUnknown;
         iGenUtils->getFileInfoL(attachment->filePath(),
                 attSize, attMimeType, attMediaType);
-        mimetype.Set( *S60QConversions::qStringToS60Desc8(attMimeType) );
+        mimetype.Set( *XQConversions::qStringToS60Desc8(attMimeType) );
         
         if ( mimetype.CompareF( KMsgMimeTextPlain ) == 0 )
             {
@@ -634,7 +634,7 @@
     }
     else if(!descr.isNull())
     {
-        buf.Copy( *S60QConversions::qStringToS60Desc(descr) );
+        buf.Copy( *XQConversions::qStringToS60Desc(descr) );
     }
     tEntry.iDescription.Set( buf );
 
@@ -658,11 +658,11 @@
     int attSize;
     QString mimeType;
     TMsgMediaType mediaType = EMsgMediaUnknown;
-    QString filepath = S60QConversions::s60DescToQString( aFilePath );
+    QString filepath = XQConversions::s60DescToQString( aFilePath );
     iGenUtils->getFileInfoL(filepath, attSize, mimeType, mediaType);
     
     attachment->SetSize( attSize );
-    attachment->SetMimeTypeL( *S60QConversions::qStringToS60Desc8(mimeType) );
+    attachment->SetMimeTypeL( *XQConversions::qStringToS60Desc8(mimeType) );
     
     CMuiuOperationWait* wait = CMuiuOperationWait::NewLC();
     attachmentManager->AddAttachmentL( aFilePath, attachment, wait->iStatus );
@@ -740,7 +740,7 @@
     
 
     //Initialize the settings
-    SetEncodingSettings( iUnicodeMode, ESmsEncodingNone, 
+    SetEncodingSettingsL( iUnicodeMode, ESmsEncodingNone, 
             iCharSupportType);
     
     //get bodytext
@@ -890,8 +890,7 @@
             {
             CreateVCardSMSL(filehandle);
             CleanupStack::Pop(&filehandle);
-            filehandle.Close();
-            managerSync.RemoveAttachmentL(0);
+            filehandle.Close();         
             }
         else if (mimetype.CompareF(KMsgMimeVCal) == 0 || 
                  mimetype.CompareF(KMsgMimeICal) == 0)
@@ -1623,7 +1622,7 @@
 // encoding or char support
 // when corresponding feilds change. Hence aUnicodeMode is always set to false
 //------------------------------------------------------------------------------
-void UniEditorSmsPluginPrivate::SetEncodingSettings( TBool aUnicodeMode,
+void UniEditorSmsPluginPrivate::SetEncodingSettingsL( TBool aUnicodeMode,
     TSmsEncoding aAlternativeEncodingType, 
     TInt aCharSupportType)
     {
@@ -1708,7 +1707,7 @@
             {
             //switch to Unicode
             //iUnicodeMode = ETrue;
-            SetEncodingSettings( ETrue, iAlternativeEncodingType, TUniSendingSettings::EUniCharSupportFull);
+            SetEncodingSettingsL( ETrue, iAlternativeEncodingType, TUniSendingSettings::EUniCharSupportFull);
             }
         else
             {
@@ -1766,8 +1765,8 @@
             HBufC* pureAddr = TMmsGenUtils::PureAddress( emailRecipients.MdcaPoint( id ) ).AllocLC();
             HBufC* aliasAddr = TMmsGenUtils::Alias( emailRecipients.MdcaPoint( id ) ).AllocLC();
             ConvergedMessageAddress messageAddress(
-                    S60QConversions::s60DescToQString(*pureAddr), 
-                    S60QConversions::s60DescToQString(*aliasAddr));
+                    XQConversions::s60DescToQString(*pureAddr), 
+                    XQConversions::s60DescToQString(*aliasAddr));
             CleanupStack::PopAndDestroy(2, pureAddr );
             aMessage->addToRecipient(messageAddress);
             }
@@ -1785,8 +1784,8 @@
             HBufC* aliasAddr =
                     TMmsGenUtils::Alias(smsRecipients[i]).AllocLC();
             ConvergedMessageAddress messageAddress(
-                    S60QConversions::s60DescToQString(*pureAddr), 
-                    S60QConversions::s60DescToQString(*aliasAddr));
+                    XQConversions::s60DescToQString(*pureAddr), 
+                    XQConversions::s60DescToQString(*aliasAddr));
             CleanupStack::PopAndDestroy(2, pureAddr );
             aMessage->addToRecipient(messageAddress);
             }
@@ -1794,7 +1793,7 @@
 
     if( emailFields.Subject( ).Length( ) )
         { // If email subject exists -> copy it
-        aMessage->setSubject(S60QConversions::s60DescToQString(
+        aMessage->setSubject(XQConversions::s60DescToQString(
                 emailFields.Subject()));
         }
 
@@ -1821,7 +1820,7 @@
             CleanupStack::PushL( store );
             MMsvAttachmentManager& manager = store->AttachmentManagerL();
             CMsvAttachment *attachment = manager.GetAttachmentInfoL(0);
-            QString filepath = S60QConversions::s60DescToQString(attachment->FilePath());
+            QString filepath = XQConversions::s60DescToQString(attachment->FilePath());
             ConvergedMessageAttachment* conv_attachment = 
                 new ConvergedMessageAttachment(filepath, ConvergedMessageAttachment::EAttachment);
             ConvergedMessageAttachmentList conv_attList;
@@ -1862,7 +1861,7 @@
             HBufC* bodyText = HBufC::NewLC ( totalLength ); 
             TPtr bodyTextPtr ( bodyText->Des() ); 
             SmsMtmL()->Body().Extract( bodyTextPtr, 0, totalLength );
-            aMessage->setBodyText(S60QConversions::s60DescToQString(
+            aMessage->setBodyText(XQConversions::s60DescToQString(
                 bodyTextPtr));
             CleanupStack::PopAndDestroy( bodyText );            
         }
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testmsg.h	Fri Jun 25 15:47:40 2010 +0530
@@ -47,7 +47,7 @@
 #include <commsdat.h>
 
 #include <Qtdebug>
-#include <s60qconversions.h>
+#include <xqconversions.h>
 #include "testsmsplugin.ini"
 
 using namespace CommsDat;
@@ -163,8 +163,8 @@
 
     QString serviceCenter01(SERVICE_CENTER_01);
     QString serviceCenter02(SERVICE_CENTER_02);
-    HBufC* sC01 = S60QConversions::qStringToS60Desc(serviceCenter01);
-    HBufC* sC02 = S60QConversions::qStringToS60Desc(serviceCenter02);
+    HBufC* sC01 = XQConversions::qStringToS60Desc(serviceCenter01);
+    HBufC* sC02 = XQConversions::qStringToS60Desc(serviceCenter02);
     CleanupStack::PushL(sC01);
     CleanupStack::PushL(sC02);
     settings->AddServiceCenterL(_L("Nokia"), *sC01);
@@ -249,7 +249,7 @@
     //AddBody
     QString body(TEST_MSG_BODY);
 
-    HBufC* bodyText = S60QConversions::qStringToS60Desc(body);
+    HBufC* bodyText = XQConversions::qStringToS60Desc(body);
     if (bodyText)
     {
         CleanupStack::PushL(bodyText);
@@ -268,7 +268,7 @@
     //Add Address
     QString recipient(TEST_MSG_FROM1);
     // convert from QString to HBufC 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recipient);
+    HBufC* addr = XQConversions::qStringToS60Desc(recipient);
     if (addr)
     {
         CleanupStack::PushL(addr);
@@ -336,7 +336,7 @@
     //Subject
     QString subject(TEST_MSG_SUBJECT);
 
-    HBufC* sub = S60QConversions::qStringToS60Desc(subject);
+    HBufC* sub = XQConversions::qStringToS60Desc(subject);
     if (sub)
     {
         CleanupStack::PushL(sub);
@@ -353,7 +353,7 @@
     //Add Address
     QString recipient(TEST_MSG_FROM1);
     // convert from QString to HBufC 
-    HBufC* addr = S60QConversions::qStringToS60Desc(recipient);
+    HBufC* addr = XQConversions::qStringToS60Desc(recipient);
     if (addr)
     {
         CleanupStack::PushL(addr);
@@ -391,7 +391,7 @@
 
     //body text
     QString bodyText(TEST_MSG_BODY);
-    HBufC* text = S60QConversions::qStringToS60Desc(bodyText);
+    HBufC* text = XQConversions::qStringToS60Desc(bodyText);
     if (text)
     {
         CleanupStack::PushL(text);
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/tsrc/testsmsgplugin/testsmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,6 @@
 INCLUDEPATH += .
 INCLUDEPATH += ../../../../../../inc
 INCLUDEPATH += ../../../../unieditorutils/inc
-INCLUDEPATH += ../../../../s60qconversions/inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
 
 DEFINES += BUILD_TEST_DLL
@@ -50,10 +49,19 @@
     TARGET.EPOCHEAPSIZE = 0x1000 0x1F00000
     TARGET.EPOCALLOWDLLDATA = 1
 	}
+   
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/test_sms_plugin.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/test_sms_plugin.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock    
     
  LIBS += -leuser \
     -lconvergedmessageutils \
-    -ls60qconversions \
+    -lxqutils \
     -lMsgMedia \
     -leditorgenutils \
     -lcone \
--- a/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/msgutils/unieditorutils/unieditorplugins/unieditorsmsplugin/unieditorsmsplugin.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,6 @@
 # UID 3
 TARGET.UID3 = 0x102072DA
 
-INCLUDEPATH += ../../../s60qconversions/inc
 INCLUDEPATH += ../../editorgenutils/inc
 INCLUDEPATH += ../../../../../inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
@@ -48,7 +47,6 @@
 
 LIBS += -leuser \
     -lconvergedmessageutils \
-    -ls60qconversions \
     -lMsgMedia \
     -leditorgenutils \
     -lcone \
@@ -67,7 +65,8 @@
     -lCdlEngine \
     -lFeatMgr \
     -lapmime \
-    -lunidatamodelloader
+    -lunidatamodelloader \
+    -lxqutils
 
 # plugin stub deployment
 plugin.sources = unieditorsmsplugin.dll
--- a/messagingapp/shareui/inc/shareuiprivate.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/inc/shareuiprivate.h	Fri Jun 25 15:47:40 2010 +0530
@@ -36,7 +36,7 @@
 class HbTextItem;
 class HbIconItem;
 
-#define SERVICE_INTERFACE "imessage.send"
+#define SERVICE_INTERFACE "com.nokia.symbian.IFileShare"
 #define SHARE_OP "send(QVariant)"
 
 /**
@@ -125,6 +125,11 @@
      */
     void itemActivated(QModelIndex index);
     
+    /**
+     * Reset internal data structures
+     */
+    void reset();
+    
 private:
     /**
      * Fetch the action associated with a specified interface descriptor.
@@ -185,12 +190,7 @@
      * Show notes
      */
     void showNote(QString text);
-    
-    /**
-     * Reset internal data structures
-     */
-    void reset();
-    
+
 private:
     /**
      * List of files to be sent.
--- a/messagingapp/shareui/rom/shareui.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/rom/shareui.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -19,5 +19,6 @@
 
 REM DLL
 file=ABI_DIR\UREL\shareui.dll                   SHARED_LIB_DIR\shareui.dll
+data=DATAZ_\system\install\shareui_stub.sis					           system\install\shareui_stub.sis
 
 #endif // __SHAREUI_IBY__
--- a/messagingapp/shareui/shareui.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/shareui.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 TEMPLATE = lib
 TARGET = shareui
 DEFINES += BUILD_SHAREUI_DLL
-#DEFINES += __SHAREUI_MIME_HANDLING__
+DEFINES += __SHAREUI_MIME_HANDLING__
 
 DEPENDPATH += inc src
 INCLUDEPATH += inc
@@ -39,8 +39,17 @@
 # Build.inf rules
 BLD_INF_RULES.prj_exports += \
      "$${LITERAL_HASH}include <platform_paths.hrh>" \
+     "sis/shareui_stub.sis   /epoc32/data/z/system/install/shareui_stub.sis" \
      "rom/shareui.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(shareui.iby)" 
      
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/shareui.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/shareui.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
 
 HEADERS += shareuiprivate.h 
     
--- a/messagingapp/shareui/sis/shareui.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/sis/shareui.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 &EN
 
 ; SIS header: name, uid, version
-#{"shareui"},(0xEEB59ABB),1,0,0, TYPE = SA,RU
+#{"shareui"},(0x2002DD00),1,0,0, TYPE = SA,RU
 
 ; Localised Vendor name
 %{"Nokia"}
@@ -27,4 +27,4 @@
 
 ; Executable and default resource files
 "/epoc32/release/armv5/urel/shareui.dll"    - "!:\sys\bin\shareui.dll",FR,RI
-"/epoc32/data/z/pluginstub/unifiededitorplugin.qtplugin"    - "!:\private\2002bce7\unifiededitorplugin.qtplugin"
+
--- a/messagingapp/shareui/sis/shareui_stub.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/sis/shareui_stub.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -17,7 +17,7 @@
 &EN
 
 ; Header
-#{"shareui"}, (0xEEB59ABB), 1, 0, 0, TYPE = SA
+#{"shareui"}, (0x2002DD00), 1, 0, 0, TYPE = SA
 
 ; Localised Vendor name
 %{"Nokia"}
Binary file messagingapp/shareui/sis/shareui_stub.sis has changed
--- a/messagingapp/shareui/src/shareuiprivate.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/src/shareuiprivate.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -69,7 +69,6 @@
  */
 ShareUiPrivate::~ShareUiPrivate()
     {
-    reset();
     }
 
 /**
@@ -78,27 +77,14 @@
 void ShareUiPrivate::reset()
     {
     mFileList.clear();
-    
-    mIndexActionMap.clear(); // TODO Is there MEM leak.
-    mAiwRequestList.clear(); // TODO Is there MEM leak.
-    
-    if ( mContentItemModel )
-        {
-        delete mContentItemModel;
-        mContentItemModel = 0;
-        }
-    
-    if ( mContentListView )
-        {
-        delete mContentListView;
-        mContentListView = 0;
-        }
-    
-    if ( mSharePopup )
-        {
-        delete mSharePopup;
-        mSharePopup = 0;
-        }
+
+    mIndexActionMap.clear();
+    foreach(XQAiwRequest* request,mAiwRequestList)
+    {
+        delete request;
+    }
+    mAiwRequestList.clear();
+
     }
 
 /**
@@ -111,7 +97,7 @@
 bool ShareUiPrivate::init(QStringList& fileList, bool embedded)
     {    
     reset();
-    
+    mIsEmbedded = embedded;
     // No input files
     if ( fileList.count() == 0 )
         {
@@ -142,6 +128,7 @@
     if ( fileList.count() != filteredFileList.count() )
         {
         showNote(LOC_PROTECTED_CONTENT);      
+        return true;
         }
     
     // Only protected content
@@ -201,7 +188,7 @@
             return true;
             }
 
-        mSharePopup->exec();
+        mSharePopup->show();
         }
     else
         {
@@ -218,13 +205,14 @@
     {
     // Dialog
     mSharePopup = new HbDialog();
-    
+    // make it delete itself on close
+    mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true );
     HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup);
     heading->setAlignment(Qt::AlignCenter);
+    mSharePopup->setDismissPolicy(HbDialog::NoDismiss);
     mSharePopup->setHeadingWidget(heading);
-    mSharePopup->setTimeout(HbDialog::NoTimeout);  
     mSharePopup->setFrameType(HbDialog::Strong);
-    mSharePopup->setPrimaryAction(new HbAction(LOC_BUTTON_CANCEL, mSharePopup));
+    connect(mSharePopup, SIGNAL(aboutToClose()), this, SLOT(reset()));
         
     // Content widget
     mContentListView = new HbListView(mSharePopup);
@@ -237,6 +225,9 @@
     mSharePopup->setContentWidget(mContentListView);
     connect(mContentListView, SIGNAL(activated(QModelIndex)),
             this, SLOT(itemActivated(QModelIndex)));  
+    
+    HbAction* cancelAction = new HbAction(LOC_BUTTON_CANCEL,mSharePopup);
+    mSharePopup->addAction(cancelAction);
     }
 
 /**
@@ -289,6 +280,7 @@
         QList<QVariant> args;
         QVariant fileList(mFileList);
         args << fileList;
+        request->setEmbedded(mIsEmbedded);
         request->setArguments(args);
         }
     }
@@ -329,7 +321,6 @@
         action->setEnabled(true);
         action->activate(HbAction::Trigger);
         }    
-    mSharePopup->close();
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/shareui/tsrc/testshareui/inc/testshareuimainwindow.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,39 @@
+/*
+* 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:  Offers message creation and sending services.
+ *
+*/
+
+#ifndef TESTSHAREUIMAINWINDOW_H
+#define TESTSHAREUIMAINWINDOW_H
+
+#include <hbmainwindow.h>
+
+class TestShareUiView;
+
+
+class TestShareUiMainWindow : public HbMainWindow
+{
+    Q_OBJECT
+
+public:
+    TestShareUiMainWindow(QWidget *parent = 0);
+    ~TestShareUiMainWindow();
+    bool init();
+private:
+    TestShareUiView*        mView;
+
+};
+
+#endif // SENDUITESTMAINWINDOW_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/shareui/tsrc/testshareui/inc/testshareuiview.h	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,45 @@
+/*
+* 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:  Offers message creation and sending services.
+ *
+*/
+
+#ifndef TESTSHAREUIVIEW_H_
+#define TESTSHAREUIVIEW_H_
+
+#include <hbview.h>
+#include <hbtoolbar.h>
+#include <hbmainwindow.h>
+
+class ShareUi;
+
+class TestShareUiView : public HbView
+    {
+    Q_OBJECT
+    
+public:
+    TestShareUiView(HbMainWindow* parent = 0);
+    virtual ~TestShareUiView();
+    bool init();
+    
+public slots:
+
+    void openCvPop();
+    
+private:
+    HbToolBar* mToolBar;
+    ShareUi* mDialog;
+    };
+
+#endif /* DEVICEVIEW_H_ */
--- a/messagingapp/shareui/tsrc/testshareui/main.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
-* 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:  Offers message creation and sending services.
- *
-*/
-
-#include <HbApplication.h>
-#include <hbmainwindow.h>
-#include "testshareuimainwindow.h"
-
-int main(int argc, char *argv[])
-{
-    HbApplication a(argc, argv);
-    TestShareUiMainWindow mainWin;
-    mainWin.init();
-    mainWin.show();
-    return a.exec();
-}
--- a/messagingapp/shareui/tsrc/testshareui/rom/testshareui.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/tsrc/testshareui/rom/testshareui.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -14,13 +14,13 @@
 * Description:
 *
 */
-#ifndef __SENDUI101_IBY__
-#define __SENDUI101_IBY__
+#ifndef __TESTSHAREUI_IBY__
+#define __TESTSHAREUI_IBY__
 
 REM DLL
 file=ABI_DIR\UREL\testshareui.exe                   SHARED_LIB_DIR\testshareui.exe
 data=DATAZ_\resource\apps\testshareui.rsc                      resource\apps\testshareui.rsc
 data=DATAZ_\private\10003a3f\import\apps\testshareui_reg.rsc   private\10003a3f\import\apps\testshareui_reg.rsc
-data=DATAZ_\resource\apps\0xE5605609.mif                         resource\apps\0xE5605609.mif
+data=DATAZ_\resource\apps\0x2002DD18.mif                         resource\apps\0x2002DD18.mif
 
-#endif // __SENDUI101_IBY__
+#endif // __TESTSHAREUI_IBY__
--- a/messagingapp/shareui/tsrc/testshareui/sis/testshareui.pkg	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/tsrc/testshareui/sis/testshareui.pkg	Fri Jun 25 15:47:40 2010 +0530
@@ -21,7 +21,7 @@
 &EN
 
 ; SIS header: name, uid, version
-#{"shareui"},(0xE5605609),1,0,0, TYPE = SA,RU
+#{"testshareui"},(0x2002DD18),1,0,0, TYPE = SA,RU
 
 ; Localised Vendor name
 %{"Nokia"}
@@ -33,4 +33,4 @@
 "/epoc32/release/armv5/urel/testshareui.exe"    - "!:\sys\bin\testshareui.exe",FR,RI
 "/epoc32/data/z/resource/apps/testshareui.rsc"    - "!:\resource\apps\testshareui.rsc"
 "/epoc32/data/z/private/10003a3f/import/apps/testshareui_reg.rsc"    - "!:\private\10003a3f\import\apps\testshareui_reg.rsc"
-;"/epoc32/data/z/resource/apps/0xE5605609.mif"    - "!:\resource\apps\0xE5605609.mif"
+;"/epoc32/data/z/resource/apps/0x2002DD18.mif"    - "!:\resource\apps\0x2002DD18.mif"
Binary file messagingapp/shareui/tsrc/testshareui/sis/testshareui.sisx has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/shareui/tsrc/testshareui/src/main.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,38 @@
+/*
+* 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:  Offers message creation and sending services.
+ *
+*/
+
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include "testshareuimainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    // Application
+    HbApplication app(argc, argv);
+
+    TestShareUiMainWindow* mainWin = new TestShareUiMainWindow();
+    mainWin->init();
+    mainWin->show();
+    // Event loop
+    int error = app.exec();
+
+    // delete main window and return error
+    delete mainWin;
+    return error;
+}
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/shareui/tsrc/testshareui/src/testshareuimainwindow.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,55 @@
+/*
+* 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:  Offers message creation and sending services.
+ *
+*/
+
+#include "testshareuimainwindow.h"
+#include "testshareuiview.h"
+#include <QtDebug>
+
+TestShareUiMainWindow::TestShareUiMainWindow(QWidget *parent)
+    : HbMainWindow(parent)
+{
+
+
+
+}
+
+TestShareUiMainWindow::~TestShareUiMainWindow()
+{
+
+}
+
+
+bool TestShareUiMainWindow::init()
+    {
+    qDebug() << "[CvProto.cpp] " << "init()";
+    if((mView = new TestShareUiView(this)) == NULL)
+        {
+        qDebug() << "[CvProto.cpp] " << "DeviceView alloc failed";
+        return false;
+        }
+    
+    if(!mView->init())
+        {
+        qDebug() << "[CvProto.cpp] " << "DeviceView init failed";
+        return false;        
+        }
+    addView(mView);
+    setCurrentView(mView,false);
+    qDebug() << "[CvProto.cpp] " << "init() succeeded";
+    return true;
+
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingapp/shareui/tsrc/testshareui/src/testshareuiview.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,63 @@
+/*
+* 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:  Offers message creation and sending services.
+ *
+*/
+
+#include <hbaction.h>
+#include <hbdevicedialog.h>
+#include <qtdebug>
+#include <xqservicerequest.h>
+#include "testshareuiview.h"
+#include "shareui.h"
+
+TestShareUiView::TestShareUiView(HbMainWindow* parent)
+    {
+    // TODO Auto-generated constructor stub
+
+    }
+
+TestShareUiView::~TestShareUiView()
+    {
+    // TODO Auto-generated destructor stub
+    delete mDialog;
+    }
+
+bool TestShareUiView::init()
+    {
+    // initialize
+    qDebug() << "[DeviceView] " << "init()";
+    mToolBar = toolBar();
+    
+    // clear actions
+    mToolBar->clearActions();
+    
+    // add the actions now
+    // when you press this, a device dialog should pop up.
+    HbAction* openCvAction = new HbAction( HbIcon(""), tr("Launch Share Ui"), this);
+    mToolBar->addAction(openCvAction);
+    connect(openCvAction, SIGNAL(triggered()), this, SLOT(openCvPop()));
+    
+    return true;
+    }
+
+void TestShareUiView::openCvPop()
+    {
+    qDebug() << "[DeviceView] " << "openCvPop() ";
+    mDialog = new ShareUi();
+    QStringList fileList;
+    fileList << QString("c:\\Sunset.jpg");
+    mDialog->send(fileList,true);    
+    }
+
--- a/messagingapp/shareui/tsrc/testshareui/testshareui.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/shareui/tsrc/testshareui/testshareui.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -17,27 +17,33 @@
 TEMPLATE = app
 TARGET = testshareui
 
-DEPENDPATH  += .
-INCLUDEPATH += .
-INCLUDEPATH += ../../inc
+DEPENDPATH += . inc src 
+INCLUDEPATH += inc
 INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE
-
-QT += core
-DEFINES+=_DEBUG
 
 CONFIG += hb
 
-HEADERS += ./testshareuimainwindow.h \
-           ./testshareuiview.h
+
+
+TARGET.UID3 = 0x2002DD18
+TARGET.CAPABILITY = All -TCB
+TARGET.EPOCHEAPSIZE = 0x20000 0x1000000
+  
+# Platforms
+SYMBIAN_PLATFORMS = WINSCW ARMV5
+
+# Build.inf rules
+BLD_INF_RULES.prj_exports += \
+     "$${LITERAL_HASH}include <platform_paths.hrh>" 
+     
+
+# Input
+HEADERS += testshareuimainwindow.h \
+           testshareuiview.h 
 
 SOURCES += main.cpp \
-		   testshareuimainwindow.cpp \
-		   testshareuiview.cpp
-
-LIBS += -lshareui
+          testshareuimainwindow.cpp \
+          testshareuiview.cpp  
 
-
-TARGET.CAPABILITY = ALL -TCB
-TARGET.EPOCHEAPSIZE = 0x20000 0x25000
-symbian:TARGET.UID3 = 0x2002DD18
+# Libs
+LIBS += -lshareui		
--- a/messagingapp/shareui/tsrc/testshareui/testshareuimainwindow.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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:  Offers message creation and sending services.
- *
-*/
-
-#include "testshareuimainwindow.h"
-#include "testshareuiview.h"
-#include <QtDebug>
-
-TestShareUiMainWindow::TestShareUiMainWindow(QWidget *parent)
-    : HbMainWindow(parent)
-{
-
-
-
-}
-
-TestShareUiMainWindow::~TestShareUiMainWindow()
-{
-
-}
-
-
-bool TestShareUiMainWindow::init()
-    {
-    qDebug() << "[CvProto.cpp] " << "init()";
-    if((mView = new TestShareUiView(this)) == NULL)
-        {
-        qDebug() << "[CvProto.cpp] " << "DeviceView alloc failed";
-        return false;
-        }
-    
-    if(!mView->init())
-        {
-        qDebug() << "[CvProto.cpp] " << "DeviceView init failed";
-        return false;        
-        }
-    addView(mView);
-    setCurrentView(mView,false);
-    qDebug() << "[CvProto.cpp] " << "init() succeeded";
-    return true;
-
-    }
--- a/messagingapp/shareui/tsrc/testshareui/testshareuimainwindow.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-/*
-* 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:  Offers message creation and sending services.
- *
-*/
-
-#ifndef TESTSHAREUIMAINWINDOW_H
-#define TESTSHAREUIMAINWINDOW_H
-
-#include <hbmainwindow.h>
-
-class TestShareUiView;
-
-
-class TestShareUiMainWindow : public HbMainWindow
-{
-    Q_OBJECT
-
-public:
-    TestShareUiMainWindow(QWidget *parent = 0);
-    ~TestShareUiMainWindow();
-    bool init();
-private:
-    TestShareUiView*        mView;
-
-};
-
-#endif // SENDUITESTMAINWINDOW_H
--- a/messagingapp/shareui/tsrc/testshareui/testshareuiview.cpp	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
-* 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:  Offers message creation and sending services.
- *
-*/
-
-#include <hbaction.h>
-#include <hbdevicedialog.h>
-#include <qtdebug>
-#include <xqservicerequest.h>
-#include "testshareuiview.h"
-#include "shareui.h"
-
-TestShareUiView::TestShareUiView(HbMainWindow* parent)
-    {
-    // TODO Auto-generated constructor stub
-
-    }
-
-TestShareUiView::~TestShareUiView()
-    {
-    // TODO Auto-generated destructor stub
-    }
-
-bool TestShareUiView::init()
-    {
-    // initialize
-    qDebug() << "[DeviceView] " << "init()";
-    mToolBar = toolBar();
-    
-    // clear actions
-    mToolBar->clearActions();
-    
-    // add the actions now
-    // when you press this, a device dialog should pop up.
-    HbAction* openCvAction = new HbAction( HbIcon(""), tr("Launch Share Ui"), this);
-    mToolBar->addAction(openCvAction);
-    connect(openCvAction, SIGNAL(triggered()), this, SLOT(openCvPop()));
-    
-    return true;
-    }
-
-void TestShareUiView::openCvPop()
-    {
-    qDebug() << "[DeviceView] " << "openCvPop() ";
-    ShareUi dialog;
-    QList<QVariant> fileList;
-    fileList << QVariant(QString("c:\\Sunset.jpg"));
-    dialog.init(fileList,true);    
-    }
-
--- a/messagingapp/shareui/tsrc/testshareui/testshareuiview.h	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* 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:  Offers message creation and sending services.
- *
-*/
-
-#ifndef TESTSHAREUIVIEW_H_
-#define TESTSHAREUIVIEW_H_
-
-#include <hbview.h>
-#include <hbtoolbar.h>
-#include <hbmainwindow.h>
-
-
-class TestShareUiView : public HbView
-    {
-    Q_OBJECT
-    
-public:
-    TestShareUiView(HbMainWindow* parent = 0);
-    virtual ~TestShareUiView();
-    bool init();
-    
-public slots:
-
-    void openCvPop();
-    
-private:
-    HbToolBar* mToolBar;
-    };
-
-#endif /* DEVICEVIEW_H_ */
--- a/messagingapp/smartmessaging/bwins/ringbcu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/bwins/ringbcu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -3,5 +3,4 @@
 	?saveTone@RingBc@@QAEXABVQString@@@Z @ 2 NONAME ; void RingBc::saveTone(class QString const &)
 	??1RingBc@@QAE@XZ @ 3 NONAME ; RingBc::~RingBc(void)
 	??0RingBc@@QAE@XZ @ 4 NONAME ; RingBc::RingBc(void)
-	?askSaveQuery@RingBc@@SA_NXZ @ 5 NONAME ; bool RingBc::askSaveQuery(void)
 
--- a/messagingapp/smartmessaging/eabi/ringbcu.def	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/eabi/ringbcu.def	Fri Jun 25 15:47:40 2010 +0530
@@ -1,9 +1,8 @@
 EXPORTS
-	_ZN6RingBc12askSaveQueryEv @ 1 NONAME
-	_ZN6RingBc8saveToneERK7QString @ 2 NONAME
-	_ZN6RingBc9toneTitleERK7QString @ 3 NONAME
-	_ZN6RingBcC1Ev @ 4 NONAME
-	_ZN6RingBcC2Ev @ 5 NONAME
-	_ZN6RingBcD1Ev @ 6 NONAME
-	_ZN6RingBcD2Ev @ 7 NONAME
+	_ZN6RingBc8saveToneERK7QString @ 1 NONAME
+	_ZN6RingBc9toneTitleERK7QString @ 2 NONAME
+	_ZN6RingBcC1Ev @ 3 NONAME
+	_ZN6RingBcC2Ev @ 4 NONAME
+	_ZN6RingBcD1Ev @ 5 NONAME
+	_ZN6RingBcD2Ev @ 6 NONAME
 
--- a/messagingapp/smartmessaging/ringbc/inc/ringbc.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/inc/ringbc.h	Fri Jun 25 15:47:40 2010 +0530
@@ -63,12 +63,6 @@
 	  */
 	 QString toneTitle(const QString &path);
 	 
-	 /**
-	  * Asks the save query.
-	  * @return bool true if user selected save else flase
-	  */
-	static bool askSaveQuery();
-	 
 private:
    
     /**
--- a/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/inc/ringbc_p.h	Fri Jun 25 15:47:40 2010 +0530
@@ -60,7 +60,7 @@
      * @param path ringing tone file path.
      * @return error code 
      */  
-    int saveToneL(const TDesC& aFileName);
+    void saveToneL(const QString& aFileName);
     
     /**
      * Returns title for the given ringing tone.
--- a/messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/inc/ringbctoneconverter.h	Fri Jun 25 15:47:40 2010 +0530
@@ -23,7 +23,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include "NsmRingTone.h"
+#include "nsmringtone.h"
 
 // FORWARD DECLARATIONS
 NONSHARABLE_STRUCT( TInstruction )
--- a/messagingapp/smartmessaging/ringbc/ringbc.pro	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/ringbc.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -26,7 +26,7 @@
     
 INCLUDEPATH += .
 INCLUDEPATH += ../../../inc
-INCLUDEPATH += ../../msgutils/s60qconversions/inc
+
 
 symbian:
 {
@@ -48,6 +48,15 @@
 
 }
 
+defBlock = \      
+	  "$${LITERAL_HASH}if defined(EABI)" \
+	  "DEFFILE  ../eabi/ringbc.def" \
+             "$${LITERAL_HASH}else" \
+             "DEFFILE  ../bwins/ringbc.def" \
+             "$${LITERAL_HASH}endif"
+	
+MMP_RULES += defBlock
+
 HEADERS += inc/ringbc.h \
 		    inc/ringbc_p.h \
 		   inc/ringbctoneconverter.h 
@@ -56,6 +65,7 @@
 		   src/ringbc_p.cpp \
 		   src/ringbctoneconverter.cpp 
 
-LIBS += -ls60qconversions \
-		-lplatformenv
+LIBS += -lplatformenv \
+        -lxqutils \
+        -lefsrv
 		     
--- a/messagingapp/smartmessaging/ringbc/src/ringbc.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,6 @@
 #include "ringbc.h"
 #include "ringbc_p.h"
 #include "ringbctoneconverter.h"
-#include "s60qconversions.h"
 #include "debugtraces.h"
 
 // ================= MEMBER FUNCTIONS =======================
@@ -72,19 +71,4 @@
     return d_ptr->toneTitle(path);
     }
 
-// ----------------------------------------------------------------------------
-// RingBc::askSaveQuery
-// @see ringbc.h
-// ----------------------------------------------------------------------------
-bool RingBc::askSaveQuery()
-    {
-    QDEBUG_WRITE("RingBc::~RingBc : Enter")
-    bool result =HbMessageBox::question("Save ringing tone ?",
-                                "Save",
-                                "Cancel");
-    
-    QDEBUG_WRITE_FORMAT("RingBc::askSaveQuery  Exit reslut:",result)
-    return result;
-    
-    }
 //  End of File  
--- a/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbc_p.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,7 @@
 // USER INCLUDES
 #include "ringbc_p.h"
 #include "ringbctoneconverter.h"
-#include "s60qconversions.h"
+#include <xqconversions.h>
 #include "debugtraces.h"
 
 //CONSTANTS 
@@ -80,11 +80,11 @@
 void RingBcPrivate::saveTone(const QString &path)
     {
     QDEBUG_WRITE("RingBcPrivate::saveTone : Enter")
-    
+
     int error(KErrNone);
-    HBufC* fileName = S60QConversions::qStringToS60Desc(path);
-    TRAP(error, error = saveToneL(*fileName));
-    if(error)
+
+    TRAP(error, saveToneL(path));
+    if (error)
         {
         QDEBUG_WRITE_FORMAT("RingBcPrivate::saveTone Error code =",error)
         
@@ -109,30 +109,109 @@
         HbMessageBox::information("Saved succesfully");
         QDEBUG_WRITE("RingBcPrivate::saveTone : Ringing tone saved successfully")
         }
-        
-    delete fileName;
-    
+
     QDEBUG_WRITE("RingBcPrivate::saveTone : Exit")
     }
-    
+
 // ----------------------------------------------------------------------------
 // RingBcPrivate::saveToneL
 // @see ringbc_p.h
 // ----------------------------------------------------------------------------
-int  RingBcPrivate::saveToneL(const TDesC& aFileName)
+void RingBcPrivate::saveToneL(const QString& path)
     {
     QDEBUG_WRITE("RingBcPrivate::saveToneL : Enter")
+
+    QStringList pathList = path.split(".");
+    QString extension = QString(".") + pathList.at(pathList.count() - 1);
+
+    RFs fsSession;
+    User::LeaveIfError(fsSession.Connect());
+
+    CleanupClosePushL(fsSession);
+
+    HBufC* fileName = XQConversions::qStringToS60Desc(path);
+
+    RFile file;
+    User::LeaveIfError(file.Open(fsSession, fileName->Des(),
+            EFileShareReadersOnly));
+
+    CleanupClosePushL(file);
+    TInt size;
+    User::LeaveIfError(file.Size(size));
     
+    HBufC8* dataBuf = HBufC8::NewLC(size);
+    TPtr8 data(dataBuf->Des());
+    User::LeaveIfError(file.Read(data, size));
+
+    TBool valid = mConverter->IsRingToneMimeTypeL(data);
+
+    if (valid)
+        {
+        HBufC* title = mConverter->TitleLC(data);
+        TFileName path = PathInfo::PhoneMemoryRootPath();
+        path.Append(PathInfo::SimpleSoundsPath());
+        path.Append(*title);
+        HBufC* fileExtension = XQConversions::qStringToS60Desc(extension);
+        path.Append(fileExtension->Des());
+
+        CFileMan* fileMan = CFileMan::NewL(fsSession);
+        CleanupStack::PushL(fileMan);
+        if(fileMan)
+            {
+            TInt err = fileMan->Copy(fileName->Des(), path, CFileMan::ECopy | CFileMan::EOverWrite);
+            User::LeaveIfError(err);
+            }
+        CleanupStack::PopAndDestroy(2); // title,fileMan        
+        }
+
+    CleanupStack::PopAndDestroy(); // dataBuf
+    CleanupStack::PopAndDestroy(); //file
+    CleanupStack::PopAndDestroy(); //fsSession
+
+    QDEBUG_WRITE("RingBcPrivate::saveToneL : Exit")
+    }
+
+// ----------------------------------------------------------------------------
+// RingBcPrivate::toneTitle
+// @see ringbc_p.h
+// ----------------------------------------------------------------------------
+QString RingBcPrivate::toneTitle(const QString &path)
+    {
+    QDEBUG_WRITE("RingBcPrivate::toneTitle : Enter")
+
+    QString title;
+    QStringList pathList = path.split(".");
+    QString extension = pathList.at(pathList.count() - 1);
+
+    HBufC* fileName = XQConversions::qStringToS60Desc(path);
+    TRAP_IGNORE( title = titleL(*fileName));
+    
+    title.append(QChar('.'));
+    title.append(extension);
+    
+    QDEBUG_WRITE("RingBcPrivate::toneTitle : Exit")
+    return title;
+    }
+
+// ----------------------------------------------------------------------------
+// RingBcPrivate::titleL
+// @see ringbc_p.h
+// ----------------------------------------------------------------------------
+QString RingBcPrivate::titleL(const TDesC& aFileName)
+    {
+    QDEBUG_WRITE("RingBcPrivate::titleL : Enter")
+
+    QString title; // initialize to null string
     RFs fsSession;
     TInt error = fsSession.Connect();
-    if( error == KErrNone)
+    if (error == KErrNone)
         {
         CleanupClosePushL(fsSession);
 
         RFile file;
-        error = file.Open(fsSession,aFileName, EFileRead);
+        error = file.Open(fsSession, aFileName, EFileRead);
 
-        if(error == KErrNone)
+        if (error == KErrNone)
             {
             CleanupClosePushL(file);
             TInt size;
@@ -141,97 +220,23 @@
                 {
                 HBufC8* dataBuf = HBufC8::NewLC(size);
                 TPtr8 data(dataBuf->Des());
-                User::LeaveIfError(file.Read(data, size));             
-             
-                TBool valid = mConverter->IsRingToneMimeTypeL(data);
-                if(valid)
-                    {
-                    HBufC* title = mConverter->TitleLC(data);
-                    TFileName path = PathInfo::PhoneMemoryRootPath();
-                    path.Append( PathInfo::SimpleSoundsPath() );
-                    path.Append(*title);
-                    path.Append(KRingingToneFileExtension);
+                User::LeaveIfError(file.Read(data, size));
 
-                    CFileMan* fileMan = CFileMan::NewL(fsSession);
-                    CleanupStack::PushL( fileMan );
-                    error = fileMan->Copy( file, path );
-                    CleanupStack::PopAndDestroy(2); // title,fileMan        
+                TBool valid = mConverter->IsRingToneMimeTypeL(data);
+                if (valid)
+                    {
+                    HBufC* toneTitle = mConverter->TitleLC(data);
+                    title = XQConversions::s60DescToQString(*toneTitle);
+                    CleanupStack::PopAndDestroy(); //title
                     }
-                else 
-                    {
-                    error = KErrCorrupt;
-                    }
-                CleanupStack::PopAndDestroy(); // dataBuf      
-                }   
+                CleanupStack::PopAndDestroy(); //dataBuf
+                }
             CleanupStack::PopAndDestroy(); //file
             }
         CleanupStack::PopAndDestroy(); //fsSession
         }
-    
-    QDEBUG_WRITE("RingBcPrivate::saveToneL : Exit")
-    return error;
+    QDEBUG_WRITE("RingBcPrivate::titleL : Exit")
+    return title;
     }
 
-// ----------------------------------------------------------------------------
-// RingBcPrivate::toneTitle
-// @see ringbc_p.h
-// ----------------------------------------------------------------------------
- QString RingBcPrivate::toneTitle(const QString &path)
-     {
-     QDEBUG_WRITE("RingBcPrivate::toneTitle : Enter")
-     
-     QString title; 
-     HBufC* fileName = S60QConversions::qStringToS60Desc(path);
-     TRAP_IGNORE( title = titleL(*fileName));
-     
-     QDEBUG_WRITE("RingBcPrivate::toneTitle : Exit")
-     return title;         
-     }
-
- // ----------------------------------------------------------------------------
- // RingBcPrivate::titleL
- // @see ringbc_p.h
- // ----------------------------------------------------------------------------
- QString RingBcPrivate::titleL(const TDesC& aFileName)
-     {
-     QDEBUG_WRITE("RingBcPrivate::titleL : Enter")
-     
-     QString title; // initialize to null string
-     RFs fsSession;
-     TInt error = fsSession.Connect();
-     if( error == KErrNone)
-         {
-         CleanupClosePushL(fsSession);
-
-         RFile file;
-         error = file.Open(fsSession,aFileName, EFileRead);
-        
-         if(error == KErrNone)
-             {
-             CleanupClosePushL(file);
-             TInt size;
-             User::LeaveIfError(file.Size(size));
-             if (size)
-                 {
-                 HBufC8* dataBuf = HBufC8::NewLC(size);
-                 TPtr8 data(dataBuf->Des());
-                 User::LeaveIfError(file.Read(data, size));             
-
-                 TBool valid = mConverter->IsRingToneMimeTypeL(data);
-                 if(valid)
-                     {
-                     HBufC* toneTitle = mConverter->TitleLC(data);
-                     title = S60QConversions::s60DescToQString(*toneTitle);
-                     CleanupStack::PopAndDestroy(); //title
-                     }
-                 CleanupStack::PopAndDestroy(); //dataBuf
-                 }
-             CleanupStack::PopAndDestroy(); //file
-             }
-         CleanupStack::PopAndDestroy(); //fsSession
-         }
-     QDEBUG_WRITE("RingBcPrivate::titleL : Exit")
-     return title;           
-     }
- 
 //  End of File  
--- a/messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingapp/smartmessaging/ringbc/src/ringbctoneconverter.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -24,7 +24,7 @@
 
 // USER INCLUDES
 #include "ringbctoneconverter.h"
-#include "NsmRingTone.h"
+#include "nsmringtone.h"
 #include "debugtraces.h"
 
 
--- a/messagingappbase/msgmedia/src/MsgMediaResolver.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingappbase/msgmedia/src/MsgMediaResolver.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -43,7 +43,7 @@
 #include <MessagingVariant.hrh>
 
 // Resources
-#include <MsgMimeToMediaMapping.rsg>
+#include <msgmimetomediamapping.rsg>
 
 #include "MsgMedia.hrh"
 #include "MsgMediaResolver.h"
--- a/messagingappbase/msgmedia/src/MsgVideoInfo.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/messagingappbase/msgmedia/src/MsgVideoInfo.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -122,11 +122,6 @@
 // -----------------------------------------------------------------------------
 void CMsgVideoInfo::ResolveVideoInfoL( RFile& aFile )
     {
-    CCoeEnv* env = CCoeEnv::Static();
-    if ( !env )
-        {
-        User::Leave( KErrNotSupported );
-        }
 
     CHXMetaDataUtility* dataUtil = CHXMetaDataUtility::NewL();
     
--- a/messagingappbase/obexmtms/Rom/obex.hby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingappbase/obexmtms/Rom/obex.hby	Fri Jun 25 15:47:40 2010 +0530
@@ -20,17 +20,17 @@
 REM Messaging OBEX MTM is not included in this ROM, because it depends on excluded OBEX
 #else
 
-#ifdef SYMBIAN_EXCLUDE_INFRARED
+#ifndef __IRDA 
 REM Infrared watcher is not included in this ROM, because it depends on excluded INFRARED
 #else
 data=MULTI_LINGUIFY(RSC ZSYSTEM\Data\irwatcher		System\Data\irwatcher)
-#endif // SYMBIAN_EXCLUDE_INFRARED
+#endif // __IRDA
 
-#ifdef SYMBIAN_EXCLUDE_BLUETOOTH
+#ifndef __BT
 REM Bluetooth watcher is not included in this ROM, because it depends on excluded BLUETOOTH
 #else
 REM data=MULTI_LINGUIFY(RSC ZSYSTEM\Data\btwatcher		System\Data\btwatcher)
-#endif // SYMBIAN_EXCLUDE_BLUETOOTH
+#endif // __BT
 
 #endif // SYMBIAN_EXCLUDE_OBEX
 
--- a/messagingappbase/obexmtms/Rom/obex.iby	Mon May 03 12:29:07 2010 +0300
+++ b/messagingappbase/obexmtms/Rom/obex.iby	Fri Jun 25 15:47:40 2010 +0530
@@ -30,7 +30,7 @@
 //file=ABI_DIR\BUILD_DIR\msgth.dll                         System\libs\msgth.dll 
 
 
-#ifdef SYMBIAN_EXCLUDE_INFRARED
+#ifndef __IRDA
 REM Messaging infrared MTM is not included in this ROM, because it depends on excluded INFRARED
 #else
 //IR MTM Client
@@ -41,10 +41,10 @@
 
 //IR MTM Resources
 data=DATAZ_\resource\messaging\mtm\irmtm.rsc             resource\messaging\mtm\irmtm.rsc
-#endif // SYMBIAN_EXCLUDE_INFRARED
+#endif // __IRDA
 
 
-#ifdef SYMBIAN_EXCLUDE_BLUETOOTH
+#ifndef __BT
 REM Messaging Bluetooth MTM is not included in this ROM, because it depends on excluded BLUETOOTH
 #else
 //BT MTM Client
@@ -55,7 +55,7 @@
 
 //BT MTM Resources
 data=DATAZ_\resource\messaging\mtm\btmtm.rsc             resource\messaging\mtm\btmtm.rsc
-#endif // SYMBIAN_EXCLUDE_BLUETOOTH
+#endif // __BT
 
 
 //Test Harness Executable
--- a/messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-// Copyright (c) 1999-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:
-//
-
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-
-PRJ_TESTEXPORTS
-//this code builds against the binary interface of irobex
-//for it to build successfully,
-//the relative path to master/common/generic/infra-red/.... must be changed to match your
-//respective perforce client spec. setting 
-../../../../../../../../../master/common/generic/infra-red/irda/inc/ir_sock.h
-../../../../../../../../../master/common/generic/infra-red/irda/inc/ir_sock.inl
-../../../../../../../../../master/common/generic/infra-red/irda/inc/obex.h
-../../../../../../../../../master/common/generic/infra-red/irda/inc/obex.inl
-
-PRJ_TESTMMPFILES
-../group/irobexstub.mmp		// Bluetooth and IrDA OBEX, using OBEX STUB
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/TObexMTM/obexstub/IrobexStub/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,33 @@
+// Copyright (c) 1999-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:
+//
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTEXPORTS
+//this code builds against the binary interface of irobex
+//for it to build successfully,
+//the relative path to master/common/generic/infra-red/.... must be changed to match your
+//respective perforce client spec. setting 
+../../../../../../../../../master/common/generic/infra-red/irda/inc/ir_sock.h
+../../../../../../../../../master/common/generic/infra-red/irda/inc/ir_sock.inl
+../../../../../../../../../master/common/generic/infra-red/irda/inc/obex.h
+../../../../../../../../../master/common/generic/infra-red/irda/inc/obex.inl
+
+PRJ_TESTMMPFILES
+../group/irobexstub.mmp		// Bluetooth and IrDA OBEX, using OBEX STUB
+
--- a/messagingappbase/obexmtms/TObexMTM/testutils/msgth/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-// Copyright (c) 1999-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:
-//
-
-PRJ_PLATFORMS
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-
-PRJ_TESTMMPFILES
-msgth.mmp
-
-PRJ_TESTEXPORTS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/TObexMTM/testutils/msgth/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,25 @@
+// Copyright (c) 1999-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:
+//
+
+PRJ_PLATFORMS
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+msgth.mmp
+
+PRJ_TESTEXPORTS
--- a/messagingappbase/obexmtms/btmtm/btclient/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-// Copyright (c) 2001-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:
-// $Workfile: BLD.INF $
-// $Author: Stevep $
-// $Revision: 13 $
-// $Date: 21/03/02 11:12 $
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-../Include/btcmtm.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(btcmtm.h)
-//../include/btmsgtypeuid.h	<- exported by the generic mtm build process.
-../Include/btHeader.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(btheader.h)
-#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
-#ifdef SYMBIAN_OLD_EXPORT_LOCATION
-../Include/btmtmcmds.h /epoc32/include/btmtmcmds.h
-#endif
-#endif
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-
-./btcmtm.mmp
-
-
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/btmtm/btclient/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,70 @@
+// Copyright (c) 2001-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:
+// $Workfile: BLD.INF $
+// $Author: Stevep $
+// $Revision: 13 $
+// $Date: 21/03/02 11:12 $
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../Include/btcmtm.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(btcmtm.h)
+//../include/btmsgtypeuid.h	<- exported by the generic mtm build process.
+../Include/btHeader.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(btheader.h)
+#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+../Include/btmtmcmds.h /epoc32/include/btmtmcmds.h
+#endif
+#endif
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+
+./btcmtm.mmp
+
+
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/btmtm/btserver/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-// Copyright (c) 2001-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:
-// $Workfile: BLD.INF $
-// $Author: Stevep $
-// $Revision: 9 $
-// $Date: 21/03/02 11:12 $
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-./btsmtm.mmp
-
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/btmtm/btserver/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,61 @@
+// Copyright (c) 2001-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:
+// $Workfile: BLD.INF $
+// $Author: Stevep $
+// $Revision: 9 $
+// $Date: 21/03/02 11:12 $
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+./btsmtm.mmp
+
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/irmtm/irclient/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-// Copyright (c) 2001-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:
-// $Workfile: BLD.INF $
-// $Author: Stevep $
-// $Revision: 11 $
-// $Date: 21/03/02 11:12 $
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-../include/IRCMTM.H SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(ircmtm.h)
-../include/irHeader.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(irheader.h)
-../include/irmsgtypeuid.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(irmsgtypeuid.h)
-../include/irmtmcmds.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(irmtmcmds.h)
-
-
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-
-./ircmtm.MMP
-
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/irmtm/irclient/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,68 @@
+// Copyright (c) 2001-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:
+// $Workfile: BLD.INF $
+// $Author: Stevep $
+// $Revision: 11 $
+// $Date: 21/03/02 11:12 $
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../include/IRCMTM.H SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(ircmtm.h)
+../include/irHeader.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(irheader.h)
+../include/irmsgtypeuid.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(irmsgtypeuid.h)
+../include/irmtmcmds.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(irmtmcmds.h)
+
+
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+
+./ircmtm.MMP
+
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/irmtm/irserver/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-// Copyright (c) 2001-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:
-// $Workfile: BLD.INF $
-// $Author: Stevep $
-// $Revision: 9 $
-// $Date: 21/03/02 11:12 $
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-#ifdef SYMBIAN_OLD_EXPORT_LOCATION
-../include/IRS.H /epoc32/include/irs.h
-#endif
-
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-
-./IRSMTM.MMP
-
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/irmtm/irserver/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,66 @@
+// Copyright (c) 2001-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:
+// $Workfile: BLD.INF $
+// $Author: Stevep $
+// $Revision: 9 $
+// $Date: 21/03/02 11:12 $
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+#ifdef SYMBIAN_OLD_EXPORT_LOCATION
+../include/IRS.H /epoc32/include/irs.h
+#endif
+
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+
+./IRSMTM.MMP
+
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/obexmtm/obexclient/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-// Copyright (c) 1999-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:
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-../include/obexClientMtm.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexclientmtm.h)
-
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-./obexClientMtm.mmp
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/obexmtm/obexclient/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,58 @@
+// Copyright (c) 1999-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:
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../include/obexClientMtm.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexclientmtm.h)
+
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+./obexClientMtm.mmp
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/obexmtm/obexserver/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-// Copyright (c) 1999-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:
-// This file basically provides the information required for building the whole of a component
-// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
-// Examples are provided below of the kind of things we're expecting
-// 
-//
-
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-../include/obexSendOp.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexsendop.h)
-../include/obexServerMtm.h 	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexservermtm.h)
-
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-./obexServerMtm.mmp
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/obexmtm/obexserver/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,58 @@
+// Copyright (c) 1999-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:
+// This file basically provides the information required for building the whole of a component
+// C & C++ style comments are allowed in this file because it's passed through the C++ preprocessor
+// Examples are provided below of the kind of things we're expecting
+// 
+//
+
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../include/obexSendOp.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexsendop.h)
+../include/obexServerMtm.h 	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexservermtm.h)
+
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+./obexServerMtm.mmp
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/obexmtms/obexmtm/obexutil/group/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-// Copyright (c) 1999-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:
-//
-
-PRJ_EXPORTS
-// specify the source file followed by its destination here
-// copy will be used to copy the source file to its destination
-// If there's no destination then the source file will be copied
-// to the same name in /epoc32/include
-
-../include/obexHeader.h 	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexheader.h)
-../include/obexHeaderList.h 	SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(obexheaderlist.h)
-../include/obexinternalutils.h	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexinternalutils.h)
-../include/ObexUtils.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexutils.h)
-../include/ListenerContainer.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(listenercontainer.h)
-../include/btmsgtypeuid.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(btmsgtypeuid.h)
-../include/cobexsendoperation.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(cobexsendoperation.h)
-
-PRJ_MMPFILES
-// specify the .mmp files required for building the important component releasables
-// note that you should specify any .mmp files for test programs further down the file.
-//
-// It's best if the .MMP files are specified in the order in which the components are
-// built, but that eventually shouldn't matter
-//
-// Use C++ style #defines to denote that a component is only built for a particular platform
-//
-// specify "tidy" if the component you need to build doesn't need to be released to
-// the rest of the company
-// specify "ignore" if the MMP file exists but should be ignored - William wants this!
-
-./obexMtmUtil.mmp
-
-
-
-PRJ_TESTMMPFILES
-// specify the .mmp files required for building any test programs here
-//
-// you can specify "manual" to denote that a test should be listed in a generated
-// batch file for running a group of tests which require user input during testing.
-// you can specify "support" to denote that a file is a test support file and shouldn't
-// be listed in a batch file for running a group of tests
-// By default, each test will be listed in a batch file for running a group of tests
-// which can be left to run without requiring watching over by the person running the tests,
-// i.e. tests where no user input is required.  The default will apply if neither "manual"
-// or "support" is specified.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/obexmtms/obexmtm/obexutil/group/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,57 @@
+// Copyright (c) 1999-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:
+//
+
+PRJ_EXPORTS
+// specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+
+../include/obexHeader.h 	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexheader.h)
+../include/obexHeaderList.h 	SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(obexheaderlist.h)
+../include/obexinternalutils.h	SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexinternalutils.h)
+../include/ObexUtils.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(obexutils.h)
+../include/ListenerContainer.h SYMBIAN_APP_LAYER_PLATFORM_EXPORT_PATH(listenercontainer.h)
+../include/btmsgtypeuid.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(btmsgtypeuid.h)
+../include/cobexsendoperation.h SYMBIAN_APP_LAYER_PUBLIC_EXPORT_PATH(cobexsendoperation.h)
+
+PRJ_MMPFILES
+// specify the .mmp files required for building the important component releasables
+// note that you should specify any .mmp files for test programs further down the file.
+//
+// It's best if the .MMP files are specified in the order in which the components are
+// built, but that eventually shouldn't matter
+//
+// Use C++ style #defines to denote that a component is only built for a particular platform
+//
+// specify "tidy" if the component you need to build doesn't need to be released to
+// the rest of the company
+// specify "ignore" if the MMP file exists but should be ignored - William wants this!
+
+./obexMtmUtil.mmp
+
+
+
+PRJ_TESTMMPFILES
+// specify the .mmp files required for building any test programs here
+//
+// you can specify "manual" to denote that a test should be listed in a generated
+// batch file for running a group of tests which require user input during testing.
+// you can specify "support" to denote that a file is a test support file and shouldn't
+// be listed in a batch file for running a group of tests
+// By default, each test will be listed in a batch file for running a group of tests
+// which can be left to run without requiring watching over by the person running the tests,
+// i.e. tests where no user input is required.  The default will apply if neither "manual"
+// or "support" is specified.
--- a/messagingappbase/smilparser/Rom/BLD.INF	Mon May 03 12:29:07 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-// Copyright (c) 2002-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:
-// Gmxml
-// 
-//
-
-PRJ_EXPORTS
-
-../Rom/Gmxml.iby /epoc32/rom/include/gmxml.iby
-
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/Rom/bld.inf	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,22 @@
+// Copyright (c) 2002-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:
+// Gmxml
+// 
+//
+
+PRJ_EXPORTS
+
+../Rom/Gmxml.iby /epoc32/rom/include/gmxml.iby
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (2) of meta_att_2.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,36 @@
+<?XML version="1.0" ?>
+<!DOCTYPE smil SYSTEM "mms_smil.dtd">
+
+<!-- Focus of this test: structure of head -->
+<!-- Focus of this test: structure of head -->
+<!-- meta, transition, layout specified -->
+<smil>
+   <head>
+      <meta name="title" content="mms"/>
+      <meta name="author" content="John Smith" skip-content="false"/>
+      <transition id="ftb2" type="fade" subtype="fadeToColor"/>
+      <layout>
+         <!-- This is a "landscape" screen -->
+         <root-layout width="352" height="144"/>
+         <region id="Image" width="176" height="144" left="0" top="0"/>
+         <region id="Text" width="176" height="144" left="176" top="0"/>
+      </layout>
+   </head>
+   <body>
+      <par dur="8s">
+         <img src="FirstImage.jpg" region="Image"/>
+         <text src="FirstText.txt" region="Text"/>
+         <audio src="FirstSound.amr"/>
+      </par>
+      <par dur="7s">
+         <img src="SecondImage.jpg" region="Image"/>
+         <text src="SecondText.txt" region="Text"/>
+         <audio src="SecondSound.amr"/>
+      </par>
+      <par dur="4s">
+         <img src="ThirdImage.jpg" region="Image"/>
+         <text src="ThirdText.txt" region="Text"/>
+         <audio src="ThirdSound.amr"/>
+      </par>
+   </body>
+</smil>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (3) of meta_att_2.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+<?XML version="1.0" ?>
+<!DOCTYPE smil SYSTEM "mms_smil.dtd">
+
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- name, content, skip-content SPECIFIED -->
+<smil>
+   <head>
+      <meta name="title" content="mms"/>
+      <meta name="author" content="John Smith" skip-content="false"/>
+      <layout>
+         <!-- This is a "landscape" screen -->
+         <root-layout width="352" height="144"/>
+         <region id="Image" width="176" height="144" left="0" top="0"/>
+         <region id="Text" width="176" height="144" left="176" top="0"/>
+      </layout>
+   </head>
+   <body>
+      <par dur="8s">
+         <img src="FirstImage.jpg" region="Image"/>
+         <text src="FirstText.txt" region="Text"/>
+         <audio src="FirstSound.amr"/>
+      </par>
+      <par dur="7s">
+         <img src="SecondImage.jpg" region="Image"/>
+         <text src="SecondText.txt" region="Text"/>
+         <audio src="SecondSound.amr"/>
+      </par>
+      <par dur="4s">
+         <img src="ThirdImage.jpg" region="Image"/>
+         <text src="ThirdText.txt" region="Text"/>
+         <audio src="ThirdSound.amr"/>
+      </par>
+   </body>
+</smil>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (4) of meta_att_2.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+<?XML version="1.0" ?>
+<!DOCTYPE smil SYSTEM "mms_smil.dtd">
+
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- name, content, skip-content SPECIFIED -->
+<smil>
+   <head>
+      <meta name="title" content="mms"/>
+      <meta name="author" content="John Smith" skip-content="false"/>
+      <layout>
+         <!-- This is a "landscape" screen -->
+         <root-layout width="352" height="144"/>
+         <region id="Image" width="176" height="144" left="0" top="0"/>
+         <region id="Text" width="176" height="144" left="176" top="0"/>
+      </layout>
+   </head>
+   <body>
+      <par dur="8s">
+         <img src="FirstImage.jpg" region="Image"/>
+         <text src="FirstText.txt" region="Text"/>
+         <audio src="FirstSound.amr"/>
+      </par>
+      <par dur="7s">
+         <img src="SecondImage.jpg" region="Image"/>
+         <text src="SecondText.txt" region="Text"/>
+         <audio src="SecondSound.amr"/>
+      </par>
+      <par dur="4s">
+         <img src="ThirdImage.jpg" region="Image"/>
+         <text src="ThirdText.txt" region="Text"/>
+         <audio src="ThirdSound.amr"/>
+      </par>
+   </body>
+</smil>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy (5) of meta_att_2.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+<?XML version="1.0" ?>
+<!DOCTYPE smil SYSTEM "mms_smil.dtd">
+
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- name, content, skip-content SPECIFIED -->
+<smil>
+   <head>
+      <meta name="title" content="mms"/>
+      <meta name="author" content="John Smith" skip-content="false"/>
+      <layout>
+         <!-- This is a "landscape" screen -->
+         <root-layout width="352" height="144"/>
+         <region id="Image" width="176" height="144" left="0" top="0"/>
+         <region id="Text" width="176" height="144" left="176" top="0"/>
+      </layout>
+   </head>
+   <body>
+      <par dur="8s">
+         <img src="FirstImage.jpg" region="Image"/>
+         <text src="FirstText.txt" region="Text"/>
+         <audio src="FirstSound.amr"/>
+      </par>
+      <par dur="7s">
+         <img src="SecondImage.jpg" region="Image"/>
+         <text src="SecondText.txt" region="Text"/>
+         <audio src="SecondSound.amr"/>
+      </par>
+      <par dur="4s">
+         <img src="ThirdImage.jpg" region="Image"/>
+         <text src="ThirdText.txt" region="Text"/>
+         <audio src="ThirdSound.amr"/>
+      </par>
+   </body>
+</smil>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/messagingappbase/smilparser/SMILdtd/SMIL_Test_Files/MMS_Output/Valid/Copy of meta_att_2.txt	Fri Jun 25 15:47:40 2010 +0530
@@ -0,0 +1,35 @@
+<?XML version="1.0" ?>
+<!DOCTYPE smil SYSTEM "mms_smil.dtd">
+
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- Focus of this test: meta element, attribute variations -->
+<!-- name, content, skip-content SPECIFIED -->
+<smil>
+   <head>
+      <meta name="title" content="mms"/>
+      <meta name="author" content="John Smith" skip-content="false"/>
+      <layout>
+         <!-- This is a "landscape" screen -->
+         <root-layout width="352" height="144"/>
+         <region id="Image" width="176" height="144" left="0" top="0"/>
+         <region id="Text" width="176" height="144" left="176" top="0"/>
+      </layout>
+   </head>
+   <body>
+      <par dur="8s">
+         <img src="FirstImage.jpg" region="Image"/>
+         <text src="FirstText.txt" region="Text"/>
+         <audio src="FirstSound.amr"/>
+      </par>
+      <par dur="7s">
+         <img src="SecondImage.jpg" region="Image"/>
+         <text src="SecondText.txt" region="Text"/>
+         <audio src="SecondSound.amr"/>
+      </par>
+      <par dur="4s">
+         <img src="ThirdImage.jpg" region="Image"/>
+         <text src="ThirdText.txt" region="Text"/>
+         <audio src="ThirdSound.amr"/>
+      </par>
+   </body>
+</smil>
Binary file mmsengine/conf/mmsengine.confml has changed
--- a/mmsengine/mmscodec/src/mmsencode.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/mmsengine/mmscodec/src/mmsencode.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -22,6 +22,7 @@
 
 // INCLUDE FILES
 #include    <e32std.h>
+#include    <e32hal.h>
 #include    <apparc.h>
 #include    <s32mem.h>
 #include    <msventry.h>
--- a/mmsengine/mmsengine.pro	Mon May 03 12:29:07 2010 +0300
+++ b/mmsengine/mmsengine.pro	Fri Jun 25 15:47:40 2010 +0530
@@ -44,12 +44,12 @@
 #### xml files containing backup_registration ####
     "./group/backup_registration.xml              /epoc32/data/z/private/100058DB/backup_registration.xml" \
 #### loc file needed for rsc generation
-    "./loc/mmsui.loc                              APP_LAYER_LOC_EXPORT_PATH(mmsui.loc)" \
+    "./loc/MmsUi.loc                              APP_LAYER_LOC_EXPORT_PATH(mmsui.loc)" \
 #### Export confml and crml files ####
     "./conf/mmsengine.confml                      APP_LAYER_CONFML(mmsengine.confml)" \
-    "./conf/mmsengine_100058db.crml               APP_LAYER_CRML(mmsengine_100058db.crml)" \
-    "./conf/mmsengine_101fb0d5.crml               APP_LAYER_CRML(mmsengine_101fb0d5.crml)" \
-    "./conf/mmsengine_101fb0d9.crml               APP_LAYER_CRML(mmsengine_101fb0d9.crml)"    
+    "./conf/mmsengine_100058DB.crml               APP_LAYER_CRML(mmsengine_100058db.crml)" \
+    "./conf/mmsengine_101FB0D5.crml               APP_LAYER_CRML(mmsengine_101fb0d5.crml)" \
+    "./conf/mmsengine_101FB0D5.crml               APP_LAYER_CRML(mmsengine_101fb0d9.crml)"    
 }
 
 symbian {
@@ -65,4 +65,4 @@
                              "./mmspushhandler/bld/mmspushhandler.mmp" \
                              "./applicationadapter/bld/mmsapplicationadapter.mmp" \
                              "./mmscodecclient/bld/mmscodecclient.mmp"
-}
\ No newline at end of file
+}
--- a/mmsengine/mmsserversettings/src/mmssettings.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/mmsengine/mmsserversettings/src/mmssettings.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -138,7 +138,7 @@
     iApplicationFolderId =    KMsvNullIndexEntryId;
     iAccesspointArray.Reset();
     iReceivingModeHome =      EMmsReceivingAutomatic;
-    iReceivingModeForeign =   EMmsReceivingManual;
+    iReceivingModeForeign =   EMmsReceivingAutomatic;
     iAcceptPersonal =         ETrue;
     iAcceptAdvertisement =    ETrue;
     iAcceptInformational =    ETrue;
--- a/mmsengine/mmswatcher/src/10005948.rss	Mon May 03 12:29:07 2010 +0300
+++ b/mmsengine/mmswatcher/src/10005948.rss	Fri Jun 25 15:47:40 2010 +0530
@@ -1,46 +1,46 @@
-/*
-* Copyright (c) 2004 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:  10005948.rss*
-*/
-
-
-
-#include "registryinfo.rh"
-
-RESOURCE REGISTRY_INFO theInfo
-	{
-	// The DLL UID - 
-	dll_uid = 0x10005948;
-	interfaces = 
-		{
-		INTERFACE_INFO
-			{
-			// KUidEComWatcher
-			interface_uid = 0x10006554;
-			implementations = 
-				{
-				IMPLEMENTATION_INFO
-					{
-					// Use the DLL UID.
-					implementation_uid = 0x10005948;
-					version_no = 1;
-					display_name = "ECOM MmsWatcher";
-					default_data = "";
-					opaque_data = "";
-					}
-				};
-			}
-		};
-	}
-
+/*
+* Copyright (c) 2004 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:  10005948.rss*
+*/
+
+
+
+#include "registryinfo.rh"
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// The DLL UID - 
+	dll_uid = 0x10005948;
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// KUidEComWatcher
+			interface_uid = 0x10006554;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					// Use the DLL UID.
+					implementation_uid = 0x10005948;
+					version_no = 1;
+					display_name = "ECOM MmsWatcher";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
+
--- a/mobilemessaging/smsmtm/clientmtm/group/smcm.mmp	Mon May 03 12:29:07 2010 +0300
+++ b/mobilemessaging/smsmtm/clientmtm/group/smcm.mmp	Fri Jun 25 15:47:40 2010 +0530
@@ -45,7 +45,7 @@
 APP_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY       euser.lib estor.lib bafl.lib etext.lib 
-LIBRARY	      gsmu.lib msgs.lib cntmodel.lib biodb.lib efsrv.lib
+LIBRARY	      gsmu.lib msgs.lib biodb.lib efsrv.lib
 LIBRARY		commsdat.lib
 LIBRARY		etelmm.lib
 
--- a/mobilemessaging/smsmtm/clientmtm/inc/smut.h	Mon May 03 12:29:07 2010 +0300
+++ b/mobilemessaging/smsmtm/clientmtm/inc/smut.h	Fri Jun 25 15:47:40 2010 +0530
@@ -130,8 +130,6 @@
 
 private:
 	static void CompareEntryL(const TMsvEntry& aEntry, TUid aMtm, TMsvId& aFirstId, CMsvEntrySelection* aServiceIds);
-	static void GetName(CContactItemField& aField, TUid aFieldType, TDes& aName);
-	static void DoGetDetailsL(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength);
 	static void Replace(const TDesC& aOld, const TDesC& aNew, TDes& aString);
 
 	static TBool DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength);
--- a/mobilemessaging/smsmtm/clientmtm/src/smut.cpp	Mon May 03 12:29:07 2010 +0300
+++ b/mobilemessaging/smsmtm/clientmtm/src/smut.cpp	Fri Jun 25 15:47:40 2010 +0530
@@ -373,7 +373,7 @@
 KErrAlreadyExists if more than one contact entry found.
 KErrNone if details is obtained successfully.
 */
-EXPORT_C TInt TSmsUtilities::GetDetails(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength)
+EXPORT_C TInt TSmsUtilities::GetDetails(RFs& /*aFs*/, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength)
 	{
 	__ASSERT_DEBUG( aMaxLength <= aDetails.MaxLength(), User::Invariant() );
 
@@ -382,9 +382,7 @@
 		aMaxLength = aDetails.MaxLength();
 		}
 
-	TRAPD(err, DoGetDetailsL(aFs, aFromAddress, aDetails, aMaxLength));
-
-	if ( (err != KErrNone) || (aDetails.Length() == 0) )
+	if ( (aDetails.Length() == 0) )
 		{
 		if (aFromAddress.Length() <= aMaxLength)
 			{
@@ -524,130 +522,6 @@
 		}
 	}
 
-void TSmsUtilities::DoGetDetailsL(RFs& aFs, const TDesC& aFromAddress, TDes& aDetails, TInt aMaxLength)
-	{
-	__UHEAP_MARK;
-
-	// Check that aFromAddress is a valid GSM telephone number
-	if (!ValidGsmNumber(aFromAddress))
-		User::Leave(KErrArgument);
-
-	aDetails.Zero();
-
-	CContactDatabase* db = CContactDatabase::OpenL();
-	CleanupStack::PushL(db);
-
-	// Lookup the telephone number (aFromAddress) in the contact database
-	CContactIdArray* contactId = db->MatchPhoneNumberL(aFromAddress, KLowerSevenDigits);
-	CleanupStack::PushL(contactId);
-	
-	// Add the name if there is one and only one match in contacts. If there's more than
-	// one then wouldn't know which one to choose	
-	if (contactId->Count() <= 0)
-		{
-		//The telephone number (aFromAddress) was not found in the contact database.
-		User::Leave(KErrNotFound);
-		}
-	else if (contactId->Count() > 1)
-		{
-		//There's more than one telephone number match in contacts.	
-		User::Leave(KErrAlreadyExists);
-		}
-	
-	CContactItem* newContact = db->ReadMinimalContactL((*contactId)[0]);
-	CleanupStack::PushL(newContact);
-
-	CContactItemFieldSet& fieldSet = newContact->CardFields();
-
-	TInt count		= fieldSet.Count();
-
-	HBufC* family	= HBufC::NewLC(aMaxLength);
-	HBufC* given	= HBufC::NewLC(aMaxLength);
-	TPtr familyPtr(family->Des());
-	TPtr givenPtr(given->Des());
-
-	// Find the Given and First Name of the contact
-	// Order important
-	for (TInt curField = 0; curField < count && !(familyPtr.Length() && givenPtr.Length()); curField++)
-		{
-		CContactItemField& field = fieldSet[curField];
-
-		if (!familyPtr.Length())
-			GetName(field, KUidContactFieldFamilyName, familyPtr);
-
-		if (!givenPtr.Length())
-			GetName(field, KUidContactFieldGivenName, givenPtr);
-		}
-
-	familyPtr.Trim();
-	givenPtr.Trim();
-
-	TInt familyLen	= familyPtr.Length();
-	TInt givenLen	= givenPtr.Length();
-
-	if (!familyLen && !givenLen)
-		{
-		//Leave if no family nor given name found
-		User::Leave(KErrNotFound);
-		}
-	else if (givenLen == 0)
-		{
-		// The maximum length of familyPtr may be greater than
-		// aMaxLength, so need to check its length before copying.
-		if (familyPtr.Length() > aMaxLength)
-  			{
-  			familyPtr.Set(familyPtr.LeftTPtr(aMaxLength));
-  			}
-
-		aDetails = familyPtr;
-		}
-	else if (familyLen == 0)
-		{
-		// The maximum length of givenPtr may be greater than
-		// aMaxLength, so need to check its length before copying.
-		if (givenPtr.Length() > aMaxLength)
-  			{
-  			givenPtr.Set(givenPtr.LeftTPtr(aMaxLength));
-  			}
-
-		aDetails = givenPtr;
-		}
-	else
-		{
-		RResourceFile resFile = OpenResourceFileL(aFs);
-		CleanupClosePushL(resFile);
-		ReadResourceStringL(resFile, R_SENDER_NAME_FORMAT, aDetails);
-		CleanupStack::PopAndDestroy(&resFile);
-
-		TBuf<8> givenPlaceHolder = L_SMS_GIVEN_NAME;
-		TBuf<8> familyPlaceHolder = L_SMS_FAMILY_NAME;
-		TInt minLength = aDetails.Length() - givenPlaceHolder.Length() - familyPlaceHolder.Length();
-
-		if ((familyLen + givenLen + minLength) > aMaxLength)
-			{
-			// The maximum length of familyPtr may be greater than
-	   		// aMaxLength, so need to check its length before copying.
-  			if (familyPtr.Length() > aMaxLength)
-   				{
-   				familyPtr.Set(familyPtr.LeftTPtr(aMaxLength));
-   				}
-			aDetails = familyPtr;
-			}
-		else
-			{
-			Replace(givenPlaceHolder, givenPtr, aDetails);
-			Replace(familyPlaceHolder, familyPtr, aDetails);
-			}
-		}
-
-	//Remove leading and trailing spaces
-	aDetails.Trim();
-
-	CleanupStack::PopAndDestroy(5, db);
-
-	__UHEAP_MARKEND;
-	}
-
 TBool TSmsUtilities::ValidGsmNumber(const TDesC& aTelephone)
 	{
 	// Returns ETrue if
@@ -705,17 +579,6 @@
 	return validTel && validCharsFound >= KSmsValidGsmNumberMinLength;
 	}
 
-void TSmsUtilities::GetName(CContactItemField& aField, TUid aFieldType, TDes& aName)
-	{
-	__UHEAP_MARK;
-	if (aField.ContentType().ContainsFieldType(aFieldType))
-		{
-		TPtrC name = aField.TextStorage()->Text();
-		aName = name.Left(Min(aName.MaxLength(), name.Length()));
-		}
-	__UHEAP_MARKEND;
-	}
-
 TBool TSmsUtilities::DoGetDescriptionL(const CSmsMessage& aMessage, TDes& aDescription, TInt aMaxLength)
 // this function returns EFalse if aMessage has no special message indication data and is not an SMS_STATUS_REPORT,
 // i.e. more needs to be done to extract the description from the message
--- a/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/conversation_services_client_api/inc/ccsrequesthandler.h	Fri Jun 25 15:47:40 2010 +0530
@@ -309,6 +309,8 @@
      */
     IMPORT_C CCsClientConversation* GetConversationFromMessageIdL ( TInt aMessageId );
     
+    IMPORT_C CCsClientConversation* GetConversationFromConversationIdL( TInt aConversationId );
+
 protected: // Functions from base classes
 
     /**
@@ -388,6 +390,12 @@
      * Handles delete conversation list event.
      */
     void HandleDeleteConversationList (HBufC8* aResultsBuffer); 
+    
+	/**
+	 * HandlePartialDeleteConversationList
+	 * Handles partial delete of conversation event.
+	 */
+    void HandlePartialDeleteConversationList(HBufC8* aResultsBuffer);
 
     /**
      * HandleModifyConversationList.
--- a/msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/conversation_services_client_api/inc/mcsconversationlistchangeobserver.h	Fri Jun 25 15:47:40 2010 +0530
@@ -59,6 +59,13 @@
     virtual void DeleteConversationList(
             const CCsClientConversation& aClientConversation) = 0;
 
+	/**
+	 * PartialDeleteConversationList
+	 * This is for handling of partial delete of conversation event
+	 * generated from the server
+	 */
+    virtual void PartialDeleteConversationList(
+            const CCsClientConversation& aClientConversation) = 0;
     /**  
      * ModifyConversationList
      * This is for handling modify conversation asynchronusly
--- a/msg_plat/conversation_services_client_api/inc/rcssession.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/conversation_services_client_api/inc/rcssession.h	Fri Jun 25 15:47:40 2010 +0530
@@ -248,6 +248,8 @@
      */
     void GetConversationFromMessageIdL(TInt aMessageId, TPtr8 aResultsBuffer);
     
+    void GetConversationFromConversationIdL(TInt aConversationId, TPtr8 aResultsBuffer);
+
     /**
      * MarkConversationReadL.
      * This function sends the request to conversation server
--- a/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/conversation_services_utilities_api/inc/ccsdefs.h	Fri Jun 25 15:47:40 2010 +0530
@@ -81,6 +81,7 @@
 const TUint32 KConversationCachingEventError     = 0x00000100;
 const TUint32 KConversationEventListRefresh      = 0x00000200;
 const TUint32 KConversationEventRefresh          = 0x00000400;
+const TUint32 KConversationListEventPartialDelete = 0x00000800;
 
 //-----------------------------------------------------------------------------
 // Conversation Server caching status codes
@@ -120,7 +121,9 @@
      EGetConversationId,
      EGetConversationIdFromAddress,
      EGetConversationFromMessageId,
-     EUserMarkReadConversation
+     EUserMarkReadConversation,
+     EGetConversationFromConversationId,
+     EGetConversationFromConversationIdComplete
 };
 
 //-----------------------------------------------------------------------------
@@ -137,6 +140,7 @@
     EModifyConversationListEvent,
     EAddConversationEvent,
     EDeleteConversationEvent,
+    EPartialDeleteConversationListEvent,
     EModifyConversationEvent,
     ECachingStartedEvent,
     ECachingCompletedEvent,
@@ -194,6 +198,7 @@
 ECsProvisioning,
 ECsBioMsg_VCard,
 ECsBioMsg_VCal,
+ECsBioMgs_NokiaService,
 ECsUnknown
 };
 
@@ -283,6 +288,95 @@
  */
 const TInt KSimIdOffset = 99999;
 
+/**
+ * @typedef TCsMsgPreviewProperty
+ */
+
+enum 
+{
+  EPreviewNone           = 0x0000,
+  EPreviewImage          = 0x0001,
+  EPreviewAudio          = 0x0002,
+  EPreviewVideo          = 0x0004,
+  EPreviewAttachment     = 0x0008,
+  EPreviewForward        = 0x0010,
+  EPreviewProtectedImage = 0x0020,
+  EPreviewProtectedAudio = 0x0040,
+  EPreviewProtectedVideo = 0x0080,
+  EPreviewCorruptedImage = 0x0100,
+  EPreviewCorruptedAudio = 0x0200,
+  EPreviewCorruptedVideo = 0x0400
+};
+
+typedef TUint16 TCsMsgPreviewProperty;
+
+/**
+ * @typedef TCsPreviewMsgProcessingState
+ */
+enum
+{
+    EPreviewMsgNotProcessed       = 0,
+    EPreviewMsgProcessing         = 1,
+    EPreviewMsgProcessed          = 2
+};
+
+/** 
+@publishedAll
+@released
+
+Template class CleanupResetAndDestroy to clean up the array
+of implementation information from the cleanup stack.
+*/
+
+template <class T>
+class CleanupResetAndDestroy
+	{
+public:
+	/**
+	Puts an item on the cleanup stack.
+
+	@param  aRef 
+	        The implementation information to be put on the cleanup stack.
+	*/
+	inline static void PushL(T& aRef);
+	inline static void PushL(T* aPointer);
+private:
+	static void ResetAndDestroy(TAny *aPtr);
+	static void ResetAndDestroyDelete(TAny *aPtr);
+	};
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef);
+
+template <class T>
+inline void CleanupResetAndDestroyPushL(T* aPointer);
+
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
+	{CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));}
+
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T* aPointer)
+    {CleanupStack::PushL(TCleanupItem(&ResetAndDestroyDelete,aPointer));}
+
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
+	{(STATIC_CAST(T*,aPtr))->ResetAndDestroy();}
+
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroyDelete(TAny *aPtr)
+    {
+    (STATIC_CAST(T*,aPtr))->ResetAndDestroy();
+    delete (STATIC_CAST(T*,aPtr));
+    }
+
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+	{CleanupResetAndDestroy<T>::PushL(aRef);}
+
+template <class T>
+inline void CleanupResetAndDestroyPushL(T* aPointer)
+    {CleanupResetAndDestroy<T>::PushL(aPointer);}
+	
 #endif // __C_CSSERVER_DEFS_H__
 
 // End of file
--- a/msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/messaging_media_resolver_api/inc/MsgAudioInfo.h	Fri Jun 25 15:47:40 2010 +0530
@@ -25,7 +25,7 @@
 
 #include <e32std.h>
 
-#include <MdaAudioSamplePlayer.h> // MMdaAudioPlayerCallback & CMdaAudioPlayerUtility
+#include <mdaaudiosampleplayer.h> // MMdaAudioPlayerCallback & CMdaAudioPlayerUtility
 #include <MsgMediaInfo.h>
 
 // CONSTANTS
--- a/msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/messaging_media_resolver_api/inc/MsgMediaInfo.inl	Fri Jun 25 15:47:40 2010 +0530
@@ -23,9 +23,16 @@
 //
 inline TPtrC CMsgMediaInfo::FullFilePath() const
     {
-    return iFullFilePath
-        ? iFullFilePath->Des()
-        : KNullDesC();
+    
+    if(iFullFilePath)
+        {
+        return iFullFilePath->Des();
+        }
+    else
+        {
+        return KNullDesC();
+        }
+    
     }
 
 // -----------------------------------------------------------------------------
--- a/msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/messaging_media_resolver_api/inc/MsgVideoInfo.h	Fri Jun 25 15:47:40 2010 +0530
@@ -27,7 +27,7 @@
 #include <w32std.h>
 
 // VideoPlayerUtility API
-#include <VideoPlayer.h>
+#include <videoplayer.h>
 
 // Base Class
 #include <MsgMediaInfo.h>
--- a/msg_plat/mms_conformance_api/tsrc/data/mmc/mmsconformancedata/testcorrupt.amr	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/mms_conformance_api/tsrc/data/mmc/mmsconformancedata/testcorrupt.amr	Fri Jun 25 15:47:40 2010 +0530
@@ -1,2 +1,2 @@
 #!AMR
-o>xVr\OF <ѻBExIWwnS4{DND%iZ"||D*Z2|||||||D*Z2|||||||D%dB2|||||||D*Z2|||||||D*Z2|||||||D*Z2|||||||D*Z2|||||||D*2|||||||D%iZ2|||||||D*Z2|||||||D%dZ2|||||||D%dZ2|||||||D*bZ2|||||||D*2Z2|||||||D*R|||||||D*ZR|||||||D%iZ2|||||||D*Z2|||
\ No newline at end of file
+o>xVr\OF <ѻBExIWwnS4{DND%iZ"||D*Z2|||||||D*Z2|||||||D%dB2|||||||D*Z2|||||||D*Z2|||||||D*Z2|||||||D*Z2|||||||D*
2|||||||D%iZ2|||||||D*Z2|||||||D%dZ2|||||||D%dZ2|||||||D*bZ2|||||||D*2Z2|||||||D*R|||||||D*ZR|||||||D%iZ2|||||||D*Z2|||
\ No newline at end of file
--- a/msg_plat/shareui_api/inc/shareui.h	Mon May 03 12:29:07 2010 +0300
+++ b/msg_plat/shareui_api/inc/shareui.h	Fri Jun 25 15:47:40 2010 +0530
@@ -37,6 +37,8 @@
 
 /**
  * This class offers message creation and sending services.
+ * this class inturn launches HbDialog with list of services asynchronously
+ * object should be alive till dialog handled completely.so client should create this class instance as a member variable
  */
 class SHAREUI_EXPORT ShareUi  
     {