Revision: 201011 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 21:13:53 +0300
branchRCL_3
changeset 21 b3431bff8c19
parent 15 e8e3147d53eb
child 23 5586b4d2ec3e
Revision: 201011 Kit: 201013
ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp
ccservices/cmsservices/cmsengine/Server/src/cmssetvoicecalldefault.cpp
contacts_plat/phonebook_2_contact_related_icon_customization_api/group/bld.inf
contacts_plat/phonebook_2_contact_related_icon_customization_api/inc/CContactCustomIconPluginBase.h
contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/init/PsUtilsTestSuite.ini
logsui/AppSrc/CLogsBaseView.cpp
logsui/group/LogsConstants.hrh
logsui/help/data/xhtml.zip
logsui/logsserviceextension/src/clogsviewextension.cpp
phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF
phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyDetailToClipboardCmd.cpp
phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF
phonebookui/Phonebook2/GroupExtension/inc/CPguGroupView.h
phonebookui/Phonebook2/GroupExtension/rss/PguNonTouchableResources.rss
phonebookui/Phonebook2/GroupExtension/rss/PguTouchableMembersListView.rss
phonebookui/Phonebook2/GroupExtension/rss/PguTouchableResources.rss
phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp
phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp
phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h
phonebookui/Phonebook2/UIControls/inc/CPbk2ContactViewListBox.h
phonebookui/Phonebook2/UIControls/inc/cpbk2contactviewdoublelistbox.h
phonebookui/Phonebook2/UIControls/rss/Pbk2ContactEditorDlg.rss
phonebookui/Phonebook2/UIControls/rss/Pbk2NonTouchableUIControls.rss
phonebookui/Phonebook2/UIControls/rss/Pbk2TouchableFetchDlg.rss
phonebookui/Phonebook2/UIControls/rss/Pbk2TouchableUIControls.rss
phonebookui/Phonebook2/UIControls/rss/Pbk2UIControlsTextBuffers.rss
phonebookui/Phonebook2/UIControls/src/CPbk2AddressSelect.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp
phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp
phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp
phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimNonTouchableUiRes.rss
phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableFixedDialingView.rss
phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableServiceDialingView.rss
phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableUiRes.rss
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/bld.inf
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/ut_commlaunchercontacthandler.mmp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/ccappcommlauncherheaders.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_ccappcmscontactfetcher.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_commlaunchercontacthandler.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/ccappcommlauncherheaders.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_ccappcmscontactfetcher.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandler.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandlerCases.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/bwins/ccacontactorserviceu.def
phonebookui/Phonebook2/ccapplication/ccacontactorservice/eabi/ccacontactorserviceu.def
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorservice.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorserviceoperator.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorservice.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorserviceoperator.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/group/ccappmycardplugin.mmp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardlistboxmodel.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardlistboxrow.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxmodel.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxrow.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardpluginfactory.cpp
phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp
phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/inc/ccapputilheaders.h
phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/src/t_ccacmscontactfetcherwrapperblocks.cpp
phonebookui/Phonebook2/group/Pbk2UIControls.mmp
phonebookui/Phonebook2/inc/CPbk2AddressSelect.h
phonebookui/Phonebook2/inc/Pbk2AddressTools.h
phonebookui/Phonebook2/loc/phonebook2ece.loc
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/bld.inf
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/pbk2rclcontactactionservice.mmp
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionservice.iby
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionserviceresources.iby
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/CFscFieldPropertyArray.cpp
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/cfscactionutils.cpp
phonebookui/Phonebook2/remotecontactlookup/engine/group/pbk2rclengine.mmp
phonebookui/Phonebook2/remotecontactlookup/engine/inc/cpbkxrclsearchresultlistbox.h
phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultlistbox.cpp
phonebookui/Phonebook2/remotecontactlookup/group/bld.inf
phonebookui/Phonebook2/remotecontactlookup/settingplugin/data/fscrclsettinginformation.rss
phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp
phonebookui/Phonebook2/xSPExtensionManager/rss/ExtensionManagerRes.rss
phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.cpp
phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.h
phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp
phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.h
phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1FilterHelper.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Helper.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1MultiSearchHelper.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsKeyMap.h
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp
predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h
predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsKeyMap.h
predictivesearch/PcsAlgorithm/Algorithm2/inc/FindUtilChineseECE.h
predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2Helper.cpp
predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2MultiSearchHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsKeyMap.cpp
predictivesearch/PcsServer/src/CPcsPluginInterface.cpp
predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp
predictivesearch/PcsUtils/inc/CWords.h
predictivesearch/PcsUtils/src/CWords.cpp
predictivesearch/adapters/contacts/group/pscontactdatastore.mmp
predictivesearch/adapters/contacts/inc/cpcscontactfetch.h
predictivesearch/adapters/contacts/inc/cpcscontactstore.h
predictivesearch/adapters/contacts/src/cpcscontactstore.cpp
--- a/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -41,8 +41,8 @@
 #include <e32base.h>
 
 // For finding mailbox accounts
-#include <EmailInterfaceFactory.h>
-#include <MEmailMailbox.h>
+#include <emailinterfacefactory.h>
+#include <memailmailbox.h>
 
 
 namespace {
--- a/ccservices/cmsservices/cmsengine/Server/src/cmssetvoicecalldefault.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/ccservices/cmsservices/cmsengine/Server/src/cmssetvoicecalldefault.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-#include <mvpbkcontactstoreproperties.h>
+#include <MVPbkContactStoreProperties.h>
 #include <MVPbkContactStore.h>
 #include <MVPbkStoreContact.h>
 
--- a/contacts_plat/phonebook_2_contact_related_icon_customization_api/group/bld.inf	Mon Mar 15 12:39:26 2010 +0200
+++ b/contacts_plat/phonebook_2_contact_related_icon_customization_api/group/bld.inf	Wed Mar 31 21:13:53 2010 +0300
@@ -17,13 +17,13 @@
 #include <platform_paths.hrh>
 
 PRJ_EXPORTS
-..\inc\CContactCustomIconPluginBase.h        APP_LAYER_PLATFORM_EXPORT_PATH(CContactCustomIconPluginBase.h)
-..\inc\ContactCustomIconPluginDefs.h         APP_LAYER_PLATFORM_EXPORT_PATH(ContactCustomIconPluginDefs.h)
-..\inc\CCustomIconDecisionData.h             APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconDecisionData.h)
-..\inc\CCustomIconDecisionData.inl           APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconDecisionData.inl)
-..\inc\CCustomIconIdMap.h                    APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconIdMap.h)
-..\inc\CCustomIconIdMap.inl                  APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconIdMap.inl)
-..\inc\MCustomIconChangeObserver.h           APP_LAYER_PLATFORM_EXPORT_PATH(MCustomIconChangeObserver.h)
+../inc/CContactCustomIconPluginBase.h        APP_LAYER_PLATFORM_EXPORT_PATH(CContactCustomIconPluginBase.h)
+../inc/ContactCustomIconPluginDefs.h         APP_LAYER_PLATFORM_EXPORT_PATH(ContactCustomIconPluginDefs.h)
+../inc/CCustomIconDecisionData.h             APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconDecisionData.h)
+../inc/CCustomIconDecisionData.inl           APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconDecisionData.inl)
+../inc/CCustomIconIdMap.h                    APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconIdMap.h)
+../inc/CCustomIconIdMap.inl                  APP_LAYER_PLATFORM_EXPORT_PATH(CCustomIconIdMap.inl)
+../inc/MCustomIconChangeObserver.h           APP_LAYER_PLATFORM_EXPORT_PATH(MCustomIconChangeObserver.h)
 
 PRJ_MMPFILES
 // None
--- a/contacts_plat/phonebook_2_contact_related_icon_customization_api/inc/CContactCustomIconPluginBase.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/contacts_plat/phonebook_2_contact_related_icon_customization_api/inc/CContactCustomIconPluginBase.h	Wed Mar 31 21:13:53 2010 +0300
@@ -20,7 +20,7 @@
 
 // INCLUDES
 #include <e32base.h>
-#include <ecom\ecom.h>
+#include <ecom/ecom.h>
 #include <ContactCustomIconPluginDefs.h>
 
 // FORWARD DECLARATIONS
--- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/init/PsUtilsTestSuite.ini	Mon Mar 15 12:39:26 2010 +0200
+++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/init/PsUtilsTestSuite.ini	Wed Mar 31 21:13:53 2010 +0300
@@ -44,7 +44,7 @@
 CreateTestReport= YES			# Possible values: YES or NO
 
 TestReportFilePath= C:\LOGS\TestFramework\
-TestReportFileName= ps_TestReport
+TestReportFileName= PsUtilsApi_TestReport
 
 TestReportFormat= HTML			# Possible values: TXT or HTML
 TestReportOutput= FILE			# Possible values: FILE or RDEBUG
--- a/logsui/AppSrc/CLogsBaseView.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/logsui/AppSrc/CLogsBaseView.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -2086,11 +2086,10 @@
 	// need care about the flag here.
     TUid uid;
     SetToolbarState(ELogsHideItemsAndDrawOnlyBackground, EFalse); 
- 
     TRAPD(err,     
         if (aCommandId == ELogsCmdMenuSendUi)           // with ELogsCmdMenuSendUi show query
             {
-            uid = LogsAppUi()->SendUiL()->ShowTypedQueryL(CSendUi::EWriteMenu, messageData, capabilities, servicesToDim );
+            uid = LogsAppUi()->SendUiL()->ShowTypedQueryL(CSendUi::EWriteMenu, NULL, capabilities, servicesToDim );
             } 
         else if (aCommandId == ELogsCmdToolBarSendUi)   // with ELogsCmdToolBarSendUi dont show query
             {
--- a/logsui/group/LogsConstants.hrh	Mon Mar 15 12:39:26 2010 +0200
+++ b/logsui/group/LogsConstants.hrh	Wed Mar 31 21:13:53 2010 +0300
@@ -25,7 +25,7 @@
 //  CONSTANTS  
 
 /// phone number max length  NOTE! In LOGWRAP.H KLogMaxNumberLength = 100;
-#define KLogsPhoneNumberMaxLen 48
+#define KLogsPhoneNumberMaxLen 100
 
 /// Sip uri max length  NOTE! In LOGWRAP.H KLogMaxNumberLength = 100; so 
 /// KLogsSipUriMaxLen should at least be the same
Binary file logsui/help/data/xhtml.zip has changed
--- a/logsui/logsserviceextension/src/clogsviewextension.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/logsui/logsserviceextension/src/clogsviewextension.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -464,7 +464,7 @@
     _LOG("CLogsViewExtension::SendMessageL iSendUi->ShowTypedQueryL")             
     TUid selectedServiceUid( KNullUid );
     selectedServiceUid = iSendUi->ShowTypedQueryL( CSendUi::ESendMenu,
-        messageData, capabilities, iServiceProvidersToDim );
+        NULL, capabilities, iServiceProvidersToDim );
 
     _LOGP("CLogsViewExtension::Selected service UID =0x%x",  
         selectedServiceUid.iUid )
--- a/phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF	Wed Mar 31 21:13:53 2010 +0300
@@ -117,4 +117,6 @@
 	?NewL@CPbk2MergePhotoConflictDlg@@SAPAV1@PAVMVPbkBaseContact@@0PAH@Z @ 116 NONAME ; class CPbk2MergePhotoConflictDlg * CPbk2MergePhotoConflictDlg::NewL(class MVPbkBaseContact *, class MVPbkBaseContact *, int *)
 	?StopQuery@CPbk2GeneralConfirmationQuery@@QAEXXZ @ 117 NONAME ; void CPbk2GeneralConfirmationQuery::StopQuery(void)
 	?HandleViewForegroundEventL@CPbk2NamesListControl@@QAEXH@Z @ 118 NONAME ; void CPbk2NamesListControl::HandleViewForegroundEventL(int)
+	?MapVPbkFieldTypeToAddressGroupId@Pbk2AddressTools@@SA?AW4TPbk2FieldGroupId@@PBVMVPbkFieldType@@@Z @ 119 NONAME ; enum TPbk2FieldGroupId Pbk2AddressTools::MapVPbkFieldTypeToAddressGroupId(class MVPbkFieldType const *)
+	?IsAddressPreviewEmptyL@Pbk2AddressTools@@SAHAAVMVPbkStoreContact@@W4TPbk2FieldGroupId@@@Z @ 120 NONAME ; int Pbk2AddressTools::IsAddressPreviewEmptyL(class MVPbkStoreContact &, enum TPbk2FieldGroupId)
 
--- a/phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyDetailToClipboardCmd.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyDetailToClipboardCmd.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -32,7 +32,8 @@
 #include <CPbk2PresentationContactFieldCollection.h>
 #include <Pbk2Commands.rsg>
 #include <Pbk2CmdExtRes.rsg>
-
+#include <MVPbkContactFieldUriData.h>
+#include <Pbk2AddressTools.h>
 
 #include <txtetext.h>   // CPlainText
 #include <baclipb.h>    // CClipboard
@@ -188,13 +189,35 @@
     // Fetch field from current UI control
     const MVPbkBaseContactField* field = iUiControl->FocusedField();
     TPtrC detail;
+    RBuf addText; 
     TVPbkFieldStorageType fieldType = field->FieldData().DataType();
     
     switch(fieldType)
         {
         case EVPbkFieldStorageTypeText:
             {
-            detail.Set(MVPbkContactFieldTextData::Cast(field->FieldData()).Text());
+            const MVPbkFieldType* vPbkFieldType = field->BestMatchingFieldType();
+            TPbk2FieldGroupId groupId = Pbk2AddressTools::MapVPbkFieldTypeToAddressGroupId( vPbkFieldType );
+            if( groupId == EPbk2FieldGroupIdHomeAddress || 
+            	groupId == EPbk2FieldGroupIdCompanyAddress || 
+            	groupId == EPbk2FieldGroupIdPostalAddress ) //the focused field belongs to Address
+            	{             
+                MVPbkStoreContact* vPbkStoreContact = const_cast<MVPbkStoreContact*>( iUiControl->FocusedStoreContact() );
+                //address view is empty
+                if( Pbk2AddressTools::IsAddressPreviewEmptyL(*vPbkStoreContact, groupId) )
+                	{
+                    detail.Set( KNullDesC() ); //KNullDesC will be copied to clipboard
+                	}
+                else //address view is not empty
+                	{
+                    Pbk2AddressTools::GetAddressPreviewLC(*vPbkStoreContact, groupId, addText);
+                    detail.Set( addText );
+                	}
+            	}
+            else //the focused field doesn't belong to Address
+            	{
+                detail.Set(MVPbkContactFieldTextData::Cast(field->FieldData()).Text());
+            	}            
             break;
             }
         case EVPbkFieldStorageTypeDateTime:
@@ -229,7 +252,11 @@
         KBeginning, plainText->DocumentLength());
     cb->CommitL();
 
-    CleanupStack::PopAndDestroy(2); // cb, plainText
+    CleanupStack::PopAndDestroy(2); // cb, plainText	
+    if( addText.Length() )
+    	{
+        CleanupStack::PopAndDestroy(&addText);
+    	}
 
     // Show a note
     HBufC* prompt = StringLoader::LoadLC(R_QTN_CCA_INFO_NOTE_COPIED_TO_CLIPBOARD);
--- a/phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF	Wed Mar 31 21:13:53 2010 +0300
@@ -199,4 +199,6 @@
 	_ZN26CPbk2MergePhotoConflictDlg4NewLEP16MVPbkBaseContactS1_Pi @ 198 NONAME
 	_ZN29CPbk2GeneralConfirmationQuery9StopQueryEv @ 199 NONAME
 	_ZN21CPbk2NamesListControl26HandleViewForegroundEventLEi @ 200 NONAME
+	_ZN16Pbk2AddressTools22IsAddressPreviewEmptyLER17MVPbkStoreContact17TPbk2FieldGroupId @ 201 NONAME
+	_ZN16Pbk2AddressTools32MapVPbkFieldTypeToAddressGroupIdEPK14MVPbkFieldType @ 202 NONAME
 
--- a/phonebookui/Phonebook2/GroupExtension/inc/CPguGroupView.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/GroupExtension/inc/CPguGroupView.h	Wed Mar 31 21:13:53 2010 +0300
@@ -115,6 +115,7 @@
                 CPbk2UIExtensionView& aView );
         void ConstructL();
         TBool CurrentStoreSupportsGroupsL() const;
+        TBool CurrentStoreIsAvailableL() const;
         void CreateControlsL();
         void StoreStateL();
         void RestoreStateL();
--- a/phonebookui/Phonebook2/GroupExtension/rss/PguNonTouchableResources.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 Group UI Extension non-touchable UI resources.
-*
-*/
-
-
-// INCLUDES
-#include <avkon.loc>
-#include <uikon.rh>
-#include <eikon.rh>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <avkonicons.hrh>
-#include <pbk2uicontrols.rsg>
-#include <pbk2uicontrols.rh>
-#include <pbk2uicontrols.hrh>
-#include <pbk2commands.hrh>
-#include <pbk2commands.rsg>
-#include <phonebook2.loc>
-#include "pbk2groupui.hrh"
-#include "pbk2uiextension.rh"
-#include "pbk2extensionuid.h"
-#include <pbk2iconinfo.rh>
-#include <pbk2icons.hrh>
-#include <pbk2uid.h>
-#include <pbk2iconid.rh>
-#include <pbk2viewgraph.rh>
-#include <pbk2viewid.hrh>
-#include <pbk2viewinfo.hrh>
-
-// --------------------------------------------------------------------------
-// Resource identifier
-// --------------------------------------------------------------------------
-//
-NAME P2GU   // From Phonebook 2 Group UI
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-
-// Additional include files
-#include "pguinformation.rss"
-#include "pgutextbuffers.rss"
-#include "pgucbaresources.rss"
-#include "pgulistview.rss"
-#include "pgumemberslistviewbase.rss"
-#include "pgumemberslistview.rss"
-#include "pgumembersfetchdlg.rss"
-#include "pgudialogresources.rss"
-
-// End of File
--- a/phonebookui/Phonebook2/GroupExtension/rss/PguTouchableMembersListView.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2002-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: 
-*     This file contains all the resources for Touch UI enabled Phonebook 2
-*     groups list view.
-*
-*/
-
-
-// ---------------------------------------------------------
-// Groups Members View's control
-// ---------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_pbk2_groupmembers_control
-    {
-    flags = KPbk2ContactViewListControlUpdateContextPane |
-            KPbk2ContactViewListControlFindBox;
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxStylusMarkableList|EAknListBoxLoopScrolling;        
-        };
-    iconArray = R_PBK2_FIELDTYPE_ICONS;
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-	defaultIconId = PHONEBOOK2_ICON_ID {};
-    }     
-    
-    
-// --------------------------------------------------------------------------
-// Groups Members View's stylus popup menu when no members have been marked
-// --------------------------------------------------------------------------
-//
-RESOURCE STYLUS_POPUP_MENU r_phonebook2_groupmembers_unmarked_stylus_menu
-    {
-    items =
-        {
-        STYLUS_POPUP_MENU_ITEM
-            {
-            txt = qtn_phob_longtap_rem_from_grp;
-            command = EPbk2CmdRemoveFromGroup;
-            },
-        STYLUS_POPUP_MENU_ITEM
-            {
-            txt = qtn_phob_longtap_is_in_grp;
-            command = EPbk2CmdBelongsToGroups;
-            },
-        STYLUS_POPUP_MENU_ITEM
-            {
-            txt = qtn_phob_longtap_send;
-            command = EPbk2CmdSend;
-            }
-        };
-    }
-    
-
-// End of File
--- a/phonebookui/Phonebook2/GroupExtension/rss/PguTouchableResources.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 Group UI Extension touchable UI resources.
-*
-*/
-
-
-// INCLUDES
-#include <avkon.loc>
-#include <uikon.rh>
-#include <eikon.rh>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <AvkonIcons.hrh>
-#include <Pbk2UIControls.rsg>
-#include <Pbk2UIControls.rh>
-#include <Pbk2UIControls.hrh>
-#include <Pbk2Commands.hrh>
-#include <Pbk2Commands.rsg>
-#include <phonebook2.loc>
-#include "Pbk2GroupUi.hrh"
-#include "Pbk2UIExtension.rh"
-#include "Pbk2ExtensionUID.h"
-#include <Pbk2IconInfo.rh>
-#include <Pbk2Icons.hrh>
-#include <Pbk2UID.h>
-#include <Pbk2IconId.rh>
-#include <Pbk2ViewGraph.rh>
-#include <Pbk2ViewId.hrh>
-#include <Pbk2ViewInfo.hrh>
-
-// --------------------------------------------------------------------------
-// Resource identifier
-// --------------------------------------------------------------------------
-//
-NAME P2GU   // From Phonebook 2 Group UI
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-
-// Additional include files
-#include "PguInformation.rss"
-#include "PguTextBuffers.rss"
-#include "PguCbaResources.rss"
-#include "PguListView.rss"
-#include "PguMembersListViewBase.rss"
-#include "PguTouchableMembersListView.rss"
-#include "PguMembersFetchDlg.rss"
-#include "PguDialogResources.rss"
-
-// End of File
--- a/phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -42,6 +42,8 @@
 #include <CPbk2StoreProperty.h>
 #include <MPbk2ApplicationServices.h>
 #include <MPbk2ContactViewSupplier.h>
+#include <CPbk2ApplicationServices.h>
+#include <MPbk2StoreValidityInformer.h>
 
 // Virtual Phonebook
 #include <MVPbkContactStoreList.h>
@@ -509,7 +511,11 @@
             }
         case R_PHONEBOOK2_INFO_MENU:
             {
-            // menu always visible in group view
+            // If there are no available stores, "memory details" should not be shown in Options menu
+            if( !CurrentStoreIsAvailableL() )
+                {
+                aMenuPane->SetItemDimmed( EPbk2CmdPhonebook2Info, ETrue ); 
+                }
             break;
             }
         default:
@@ -661,6 +667,27 @@
     }
 
 // --------------------------------------------------------------------------
+// CPguGroupView::CurrentStoreIsAvailable
+// --------------------------------------------------------------------------
+//
+TBool CPguGroupView::CurrentStoreIsAvailableL() const
+    {
+    TBool ret = ETrue;
+    CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceLC();
+
+    // Returns the stores that are currently available and open(selected by user in Settings).
+    CVPbkContactStoreUriArray* aValidStores = appServices->StoreValidityInformer().CurrentlyValidStoresL();
+    CleanupStack::PushL( aValidStores );
+    if( 0 == aValidStores->Count() )
+        {
+        ret = EFalse;
+        }
+     CleanupStack::PopAndDestroy(); // aValidStores
+     CleanupStack::PopAndDestroy(); // appServices
+     return ret;
+    }
+
+// --------------------------------------------------------------------------
 // CPguGroupView::CreateControlsL
 // --------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -610,6 +610,15 @@
     delete iFetchPhase;
     iFetchPhase = NULL;
 
+    // If need to open the editor, then change StatuspaneLayout to 
+    // CPbk2ServerAppAppUi::EStatusPaneLayoutUsual
+    if (!(iAssignFlags & EDoNotOpenEditor))
+        {
+        CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
+            ( *CEikonEnv::Static()->EikAppUi() );
+        appUi.ChangeStatuspaneLayoutL(CPbk2ServerAppAppUi::EStatusPaneLayoutUsual);
+        }
+
     iAssignDataPhase->LaunchServicePhaseL();
     }
 
--- a/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Wed Mar 31 21:13:53 2010 +0300
@@ -52,6 +52,7 @@
 class CPbk2ContactEditorArrayItem;
 class CAknInputBlock;
 class MPbk2ApplicationServices;
+class CCnvCharacterSetConverter;
 
 // CLASS DECLARATION
 
@@ -357,6 +358,15 @@
         void WaitFinishL();
         void CloseDialog();
         
+        TBool IsUnicodeL( const TDesC& aText );
+        TBool IsCheckPointEvent(
+                const TKeyEvent& aKeyEvent,
+                TEventCode aType );
+        void CheckCurrentFieldTextL( 
+                CPbk2ContactEditorArrayItem* aCurrentField,
+                const TKeyEvent& aKeyEvent, 
+                TEventCode aType );
+
     private: // Data structures
 
         /**
@@ -444,6 +454,8 @@
         MPbk2ApplicationServices* iAppServices;
         // Own: Custom title text
         HBufC* iTitleText;
+        /// Own: Converts text between Unicode and SMS 7-bit 
+        CCnvCharacterSetConverter* iConverter;
     };
 
 #endif // CPBK2CONTACTEDITORDLGIMPL_H
--- a/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactViewListBox.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactViewListBox.h	Wed Mar 31 21:13:53 2010 +0300
@@ -230,7 +230,7 @@
             TPbk2IconId iDefaultIconId;
             };
 
-    protected:	//data	//TODO handle better
+    protected:	//data
     	/// Own: List box model
     	CPbk2ContactViewListBoxModel* iModel;
     	/// Own: Data loaded from resources
--- a/phonebookui/Phonebook2/UIControls/inc/cpbk2contactviewdoublelistbox.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/inc/cpbk2contactviewdoublelistbox.h	Wed Mar 31 21:13:53 2010 +0300
@@ -92,7 +92,7 @@
         MPbk2ContactUiControlExtension* aUiExtension,
         CPbk2PredictiveSearchFilter& aSearchFilter,	
         MVPbkContactViewBase& aView,
-        CPbk2ThumbnailManager& aThumbManager );	//TODO
+        CPbk2ThumbnailManager& aThumbManager );
     
     /*
      * Constructor
@@ -114,13 +114,13 @@
             		TPbk2IconId aDefaultIconId );
     
     /**
-     * TODO: write description
+     * Apply custom layout to listbox after size change
      */
     void SizeChangedL();
 
 
 private:	//data
-	//REF: View	TODO
+	//REF: View
 	MVPbkContactViewBase& iView;
 	//REF:	thumbnail manager
 	CPbk2ThumbnailManager& iThumbManager;
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2ContactEditorDlg.rss	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/rss/Pbk2ContactEditorDlg.rss	Wed Mar 31 21:13:53 2010 +0300
@@ -64,12 +64,12 @@
         MENU_ITEM
             {
             command = EPbk2CmdEditorChangeImage;
-            txt = qtn_phob_field_change_sync;
+            txt = qtn_phob_opt_change_image;
             },
         MENU_ITEM
             {
             command = EPbk2CmdEditorViewImage;
-            txt = qtn_cca_options_view_image;
+            txt = qtn_phob_opt_view_image;
             },
         MENU_ITEM
             {
@@ -199,12 +199,12 @@
         MENU_ITEM
             {
             command = EPbk2CmdEditorChangeImage;
-            txt = qtn_phob_field_change_sync;
+            txt = qtn_phob_opt_change_image;
             },
         MENU_ITEM
             {
             command = EPbk2CmdEditorViewImage;
-            txt = qtn_cca_options_view_image;
+            txt = qtn_phob_opt_view_image;
             },
 #ifdef ECE_DISABLE_CONTEXT_MENU
         MENU_ITEM
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2NonTouchableUIControls.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Resources for Phonebook 2 UI Controls.
-*
-*/
-
-
-// RESOURCE IDENTIFIER
-NAME    CPUC  // From Phonebook 2 UI Controls
-
-// INCLUDES
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.rsg>
-#include <avkon.hrh>
-#include <avkon.rh>
-#include <avkonicons.hrh>
-#include "pbk2iconid.hrh"
-#include "pbk2iconarrayid.hrh"
-#include "pbk2uicontrols.hrh"
-#include "pbk2uicontrols.rh"
-#include <pbk2iconinfo.rh>
-#include <pbk2iconid.rh>
-#include <pbk2uid.h>
-#include <phonebook2.loc>
-#include <phonebook2ece.loc>
-
-// RESOURCE DEFINITIONS
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-
-// --------------------------------------------------------------------------
-// Names list control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_pbk2_names_list_control
-    {
-    flags = KPbk2ContactViewListControlUpdateContextPane |
-            KPbk2ContactViewListControlFindBox;
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxMarkableList | EAknListBoxLoopScrolling |
-                EAknListBoxShiftEnterMarks;
-        };
-    iconArray = r_pbk2_contact_list_icons;
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    defaultIconId = PHONEBOOK2_ICON_ID {};
-    }
-
-// --------------------------------------------------------------------------
-// Contact info control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_pbk2_contact_info_control
-    {
-    flags = KPbk2ContactInfoControlUpdateStatusPane;
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxSelectionList;
-        };
-    iconArray = r_pbk2_fieldtype_icons;
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    defaultIconId = PHONEBOOK2_ICON_ID {};
-    }
-
-// Additional resource files
-#include "pbk2uicontrolstextbuffers.rss"
-#include "pbk2cbaresources.rss"
-#include "pbk2queryresources.rss"
-#include "pbk2contacteditordlg.rss"
-#include "pbk2selectors.rss"
-#include "pbk2addressselect.rss"
-#include "pbk2fetchdlg.rss"
-#include "pbk2prependdlg.rss"
-#include "pbk2storeinfo.rss"
-#include "pbk2settings.rss"
-#include "pbk2iconresources.rss"
-#include "pbk2thumbnailcontrol.rss"
-#include "pbk2generalnotes.rss"
-#include "tonecmds.rss"
-#include "pbk2mergecontacts.rss"
-
-// End of File
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2TouchableFetchDlg.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,262 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 fetch resources.
-*
-*/
-
-
-#include <Pbk2Icons.hrh>
-
-// --------------------------------------------------------------------------
-// Navi pane label for single entry fetch
-// --------------------------------------------------------------------------
-//
-RESOURCE NAVI_DECORATOR r_pbk2_single_entry_fetch_navilabel
-    {
-    type = ENaviDecoratorLabel;
-    control = NAVI_LABEL
-        {
-        txt = qtn_phob_navi_select_one_entry;
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Single entry fetch resource
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_FETCH_DIALOG r_pbk2_single_entry_fetch_dlg
-    {
-    dialog = r_pbk2_single_entry_fetch_control_dlg;
-    cba = r_pbk2_softkeys_select_back_select;
-    emptyCba = r_pbk2_softkeys_empty_back_empty;
-    navi_pane = r_pbk2_single_entry_fetch_navilabel;
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch resource with groups tab
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_FETCH_DIALOG r_pbk2_multiple_entry_fetch_dlg
-    {
-    dialog = r_pbk2_multiple_entry_fetch_control_dlg;
-    cba = r_pbk2_softkeys_ok_back_mark;
-    emptyCba = r_pbk2_softkeys_empty_back_empty;
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch resource without groups tab
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_FETCH_DIALOG r_pbk2_multiple_entry_fetch_no_groups_dlg
-    {
-    dialog = r_pbk2_multiple_entry_fetch_no_groups_control_dlg;
-    cba = r_pbk2_softkeys_ok_back_mark;
-    emptyCba = r_pbk2_softkeys_empty_back_empty;
-    }
-
-// --------------------------------------------------------------------------
-// Call item fetch resource
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_FETCH_DIALOG r_pbk2_call_item_fetch_dlg
-    {
-    dialog = r_pbk2_single_entry_fetch_control_dlg;
-    cba = r_pbk2_softkeys_call_back_call;
-    emptyCba = r_pbk2_softkeys_empty_back_empty;
-    navi_pane = r_pbk2_single_entry_fetch_navilabel;
-    }
-
-// --------------------------------------------------------------------------
-// Single entry fetch dialog
-// --------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_pbk2_single_entry_fetch_control_dlg
-    {
-    flags = PBK2_FETCHDIALOG_FLAGS;
-    pages = 0;  // Single page
-    buttons = r_pbk2_softkeys_empty_back_empty;
-    items =
-        {
-        DLG_LINE
-            {
-            type = EPbk2CtNamesContactViewList;
-            id = ECtrlFetchNamesList;
-            itemflags = EEikDlgItemTakesEnterKey |
-                        EEikDlgItemOfferAllHotKeys;
-            control = PBK2_CONTACT_CONTROL
-                {
-                flags = KPbk2ContactViewListControlUpdateContextPane |
-                        KPbk2ContactViewListControlFindBox;
-                listbox = LISTBOX
-                    {
-                    flags = EAknListBoxLoopScrolling;
-                    };
-                iconArray = r_pbk2_contact_list_icons;
-                emptyIconId = PHONEBOOK2_ICON_ID
-                    {
-                    ownerUid = KPbk2UID3;
-                    id = EPbk2qgn_prop_nrtyp_empty;
-                    };
-                defaultIconId = PHONEBOOK2_ICON_ID {};
-                };
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch with groups dialog
-// --------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_pbk2_multiple_entry_fetch_control_dlg
-    {
-    flags = PBK2_FETCHDIALOG_FLAGS;
-    pages = r_pbk2_multiple_entry_fetch_dlg_pages;
-    buttons = r_pbk2_softkeys_empty_back_empty;
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch without groups dialog
-// --------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_pbk2_multiple_entry_fetch_no_groups_control_dlg
-    {
-    flags = PBK2_FETCHDIALOG_FLAGS;
-    pages = r_pbk2_multiple_entry_fetch_no_groups_dlg_pages;
-    buttons = r_pbk2_softkeys_empty_back_empty;
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch with groups dialog pages
-// --------------------------------------------------------------------------
-//
-RESOURCE ARRAY r_pbk2_multiple_entry_fetch_dlg_pages
-    {
-    items =
-        {
-        PAGE
-            {
-            id = ECtrlFetchNamesList;
-            bmpfile = phonebook2_mbm_file_location;
-            bmpid = qgn_prop_pb_all_tab2;
-            bmpmask = qgn_prop_pb_all_tab2_mask;
-            lines = r_pbk2_multiple_entry_fetch_contactview;
-            },
-        PAGE
-            {
-            id = ECtrlFetchGroupsList;
-            bmpfile = phonebook2_mbm_file_location;
-            bmpid = qgn_prop_group_tab2;
-            bmpmask = qgn_prop_group_tab2_mask;
-            lines = r_pbk2_multiple_entry_fetch_groupsview;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch without groups dialog pages
-// --------------------------------------------------------------------------
-//
-RESOURCE ARRAY r_pbk2_multiple_entry_fetch_no_groups_dlg_pages
-    {
-    items =
-        {
-        PAGE
-            {
-            id = ECtrlFetchNamesList;
-            bmpfile = phonebook2_mbm_file_location;
-            bmpid = qgn_prop_pb_all_tab2;
-            bmpmask = qgn_prop_pb_all_tab2_mask;
-            lines = r_pbk2_multiple_entry_fetch_contactview;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch dialog page lines - contacts list
-// --------------------------------------------------------------------------
-//
-RESOURCE ARRAY r_pbk2_multiple_entry_fetch_contactview
-    {
-    items =
-        {
-        DLG_LINE
-            {
-            type = EPbk2CtNamesContactViewList;
-            id = ECtrlFetchNamesList;
-            itemflags = EEikDlgItemTakesEnterKey |
-                        EEikDlgItemOfferAllHotKeys;
-            control = PBK2_CONTACT_CONTROL
-                {
-                flags = KPbk2ContactViewListControlUpdateContextPane |
-                        KPbk2ContactViewListControlFindBox;
-                listbox = LISTBOX
-                    {
-                    flags = EAknListBoxStylusMultiselectionList |
-                            EAknListBoxLoopScrolling;
-                    };
-                iconArray = r_pbk2_checkbox_icons;
-                emptyIconId = PHONEBOOK2_ICON_ID
-                    {
-                    ownerUid = KPbk2UID3;
-                    id = EPbk2qgn_prop_checkbox_off;
-                    };
-                defaultIconId = PHONEBOOK2_ICON_ID
-                    {
-                    ownerUid = KPbk2UID3;
-                    id = EPbk2qgn_prop_checkbox_off;
-                    };
-                };
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Multiple entry fetch dialog page lines - groups list
-// --------------------------------------------------------------------------
-//
-RESOURCE ARRAY r_pbk2_multiple_entry_fetch_groupsview
-    {
-    items =
-        {
-        DLG_LINE
-            {
-            type = EPbk2CtGroupsContactViewList;
-            id = ECtrlFetchGroupsList;
-            itemflags = EEikDlgItemTakesEnterKey |
-                        EEikDlgItemOfferAllHotKeys;
-            control = PBK2_CONTACT_CONTROL
-                {
-                flags = KPbk2ContactViewListControlUpdateContextPane;
-                listbox = LISTBOX
-                    {
-                    flags = EAknListBoxStylusMultiselectionList |
-                            EAknListBoxLoopScrolling;
-                    };
-                iconArray = r_pbk2_checkbox_icons;
-                emptyIconId = PHONEBOOK2_ICON_ID
-                    {
-                    ownerUid = KPbk2UID3;
-                    id = EPbk2qgn_prop_checkbox_off;
-                    };
-                defaultIconId = PHONEBOOK2_ICON_ID
-                    {
-                    ownerUid = KPbk2UID3;
-                    id = EPbk2qgn_prop_checkbox_off;
-                    };
-                };
-            }
-        };
-    }
-
-// End of File
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2TouchableUIControls.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Resources for Phonebook 2 UI Controls.
-*
-*/
-
-
-// RESOURCE IDENTIFIER
-NAME    CPUC  // From Phonebook 2 UI Controls
-
-// INCLUDES
-#include <eikon.rh>
-#include <eikon.rsg>
-#include <avkon.rsg>
-#include <avkon.hrh>
-#include <avkon.rh>
-#include <AvkonIcons.hrh>
-#include "Pbk2IconId.hrh"
-#include "Pbk2IconArrayId.hrh"
-#include "Pbk2UIControls.hrh"
-#include "Pbk2UIControls.rh"
-#include <Pbk2IconInfo.rh>
-#include <Pbk2IconId.rh>
-#include <Pbk2UID.h>
-#include <phonebook2.loc>
-#include <phonebook2ece.loc>
-
-// RESOURCE DEFINITIONS
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-
-// --------------------------------------------------------------------------
-// Names list control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_pbk2_names_list_control
-    {
-    flags = KPbk2ContactViewListControlUpdateContextPane |
-            KPbk2ContactViewListControlFindBox;
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxStylusMarkableList | EAknListBoxLoopScrolling;
-        };
-    iconArray = r_pbk2_contact_list_icons;
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    defaultIconId = PHONEBOOK2_ICON_ID {};
-    }
-
-// --------------------------------------------------------------------------
-// Contact info control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_pbk2_contact_info_control
-    {
-    flags = KPbk2ContactInfoControlUpdateStatusPane;
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxSelectionList;
-        };
-    iconArray = r_pbk2_fieldtype_icons;
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    defaultIconId = PHONEBOOK2_ICON_ID {};
-    }
-
-// Additional resource files
-#include "Pbk2UIControlsTextBuffers.rss"
-#include "Pbk2CbaResources.rss"
-#include "Pbk2QueryResources.rss"
-#include "Pbk2ContactEditorDlg.rss"
-#include "Pbk2Selectors.rss"
-#include "Pbk2AddressSelect.rss"
-#include "Pbk2TouchableFetchDlg.rss"
-#include "Pbk2PrependDlg.rss"
-#include "Pbk2StoreInfo.rss"
-#include "Pbk2Settings.rss"
-#include "Pbk2IconResources.rss"
-#include "Pbk2ThumbnailControl.rss"
-#include "Pbk2GeneralNotes.rss"
-#include "ToneCmds.rss"
-#include "Pbk2MergeContacts.rss"
-// End of File
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2UIControlsTextBuffers.rss	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/rss/Pbk2UIControlsTextBuffers.rss	Wed Mar 31 21:13:53 2010 +0300
@@ -634,6 +634,15 @@
     }
 
 // --------------------------------------------------------------------------
+// Text: Voice call:
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cca_popup_voice_call
+    {
+    buf = qtn_cca_popup_voice_call;
+    }
+
+// --------------------------------------------------------------------------
 // Text: Find on map:
 // --------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2AddressSelect.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AddressSelect.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -29,6 +29,7 @@
 #include <CPbk2ServiceManager.h>
 #include <MPbk2AppUi.h>
 #include <Pbk2UIControls.rsg>
+#include <Pbk2Commands.rsg>
 #include <CPbk2ApplicationServices.h>
 #include <TPbk2StoreContactAnalyzer.h>
 
@@ -53,6 +54,7 @@
 #include <spsettings.h>
 #include <spentry.h>
 #include <spproperty.h>
+#include <spsettingsvoiputils.h>
 
 /// Unnamed namespace for local definitions
 namespace {
@@ -691,6 +693,73 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2AddressSelect::IsVoiceCallExistL
+// --------------------------------------------------------------------------
+//
+inline TBool CPbk2AddressSelect::IsVoiceCallExistL()
+    {
+    TInt countFields = iParams.iContact.Fields().FieldCount();
+    TPbk2StoreContactAnalyzer analyzer( iParams.iContactManager, NULL );
+
+    for ( TInt i = 0; i < countFields; i++ )
+        {
+        const MVPbkStoreContactField& field =
+            iParams.iContact.Fields().FieldAt( i );
+        
+        // If the field is voice call, then return ETrue.
+        if ( analyzer.IsFieldTypeIncludedL( field, R_PHONEBOOK2_PHONENUMBER_SELECTOR ) )
+            {
+            return ETrue;
+            }
+        }
+    
+    // No voice call filed, return EFalse.    
+    return EFalse;
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL
+// --------------------------------------------------------------------------
+//
+inline HBufC* CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL()
+    {
+    HBufC* title (NULL);
+    
+    // If the popped up dialog is started in namelist view.
+    // Then, the title of the dialog should obey such rules:
+    // 1. When there are only VoIP addresses for contact or if VoIP is preferred.
+    // Then show "Internet call:"
+    // 2. In other cases show "Call:". This would be shown when:
+    // 2.1 VoIP is not preferred and there's at least one Voice call number for the contact
+    // 2.2 So even in case when there's only voice call numbers.
+    // The title should be "Call:" instead of "Voice call:" 
+    if ( iParams.iTitleResId == R_QTN_PHOB_QTL_CALL_TO_NAME )
+        {
+        // Check whether VoIP is preferred.
+        CSPSettingsVoIPUtils* sPSettings = CSPSettingsVoIPUtils::NewLC();
+        if ( sPSettings->IsPreferredTelephonyVoIP() ||
+             !IsVoiceCallExistL() )
+        	{
+        	title = GetVOIPDialogTitleL();
+        	}
+        else
+        	{
+        	title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CALL );
+        	}
+        CleanupStack::PopAndDestroy( sPSettings ); 
+        }
+    else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVoiceCallSelector )
+        {                               
+        title =  StringLoader::LoadL( R_QTN_CCA_POPUP_VOICE_CALL );
+        }
+    else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
+        {
+        title = GetVOIPDialogTitleL();
+        }	
+    return title;
+    }
+	
+// --------------------------------------------------------------------------
 // CPbk2AddressSelect::LoadDialogTitleL
 // --------------------------------------------------------------------------
 //
@@ -700,10 +769,12 @@
     switch( iParams.iCommMethod )
         {
         case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
+        case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
             {
-            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CALL );
+            title = GetVoiceAndVOIPCallDialogTitleL();
             break;
             }
+        	
         case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
             {
             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_MESSAGE );
@@ -718,12 +789,7 @@
             {
             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CHAT );
             break;
-            }
-        case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
-            {
-            title = GetVOIPDialogTitleL();
-            break;
-            }       
+            }    
         case VPbkFieldTypeSelectorFactory::EURLSelector:
             {
             title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_URL );
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -94,11 +94,14 @@
 #include <hlplch.h>
 #include <aknnavide.h>
 #include <akninputblock.h>
+#include <charconv.h>
 
 /// Unnamed namespace for local definitions
 namespace {
 
 const TInt KEditorNameFormatFlags = MPbk2ContactNameFormatter::EUseSeparator;
+const TInt KTwoBytes = 2;
+const TInt KExtraByte = 1;
 
 #ifdef _DEBUG
 enum TPanicCode
@@ -239,6 +242,8 @@
     iTitleText = NULL;
     delete iStoredTitlePaneText;
     iStoredTitlePaneText = NULL;
+
+    delete iConverter;
     }
 
 // --------------------------------------------------------------------------
@@ -485,7 +490,10 @@
     //Here we can prevent recursive execution of ExecuteBaseCommandL if needed 
     //as touch events are handled in it too. So it may case multiple callbacks to here if 
     //user repeats the same pointer event very quickly using options menu.
-    // if(!iCommandPending) //seems that this check is not needed
+    // This check is needed, otherwise, when touch quickly on Address field and 
+    // quickly on Image field in the Editor Dialog, the address editor will be 
+    // opened, but touch input can not open in any of its editors.
+    if(!iCommandPending) 
         {
         CAknForm::HandlePointerEventL( aPointerEvent );
         }
@@ -695,6 +703,8 @@
 
     if (currentField)
         {
+        CheckCurrentFieldTextL( currentField, aKeyEvent, aType );
+    
         if (currentField->ContactEditorField()
                 && currentField->ContactEditorField()->ConsumesKeyEvent(
                         aKeyEvent, aType))
@@ -1779,6 +1789,7 @@
 void CPbk2ContactEditorDlgImpl::DeleteControl(TInt aControlId)
     {
     DeleteLine( aControlId );
+    TRAP_IGNORE( UpdateTitleL() );    
     }
 
 // --------------------------------------------------------------------------
@@ -3253,4 +3264,108 @@
         }
     }
 
+// --------------------------------------------------------------------------
+// CPbk2ContactEditorDlgImpl::IsUnicodeL
+// --------------------------------------------------------------------------
+//    
+TBool CPbk2ContactEditorDlgImpl::IsUnicodeL( const TDesC& aText )
+    {
+    if ( !iConverter )
+        {
+        iConverter = CCnvCharacterSetConverter::NewLC();
+        CleanupStack::Pop();
+        RFs& fs = Phonebook2::Pbk2AppUi()->
+                ApplicationServices().ContactManager().FsSession();
+        iConverter->PrepareToConvertToOrFromL( KCharacterSetIdentifierSms7Bit, fs );
+        }
+    
+    TBool isUnicode( EFalse );
+    TInt unconvertedCount(0);
+    HBufC8* convertedText = HBufC8::NewLC( aText.Length()*KTwoBytes );
+    TPtr8 convertedTextPtr = convertedText->Des(); 
+
+    iConverter->ConvertFromUnicode( convertedTextPtr, aText, unconvertedCount );
+
+    // If any characters were not converted or if the converted text is longer
+    // than the original the text must be unicode
+    if( unconvertedCount > 0 ||
+        aText.Length() < convertedText->Length() )
+        {
+        isUnicode = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( convertedText );
+    return isUnicode;
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ContactEditorDlgImpl::IsCheckPointEvent
+// --------------------------------------------------------------------------
+//    
+TBool CPbk2ContactEditorDlgImpl::IsCheckPointEvent(
+        const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    TBool check = EFalse;
+    if ( EEventKeyDown == aType )
+        {
+        // Don't handle 'EStdKeyBackspace', 'EStdKeyHash' and those between 
+        // 'EStdKeyPrintScreen' and 'EStdKeyScrollLock'. 
+        // If the definition of standard scancode is changed, the scope here needs to 
+        // be examined again.
+        if ( ( EStdKeyPrintScreen > aKeyEvent.iScanCode || EStdKeyScrollLock < aKeyEvent.iScanCode ) &&
+                EStdKeyBackspace != aKeyEvent.iScanCode &&
+                EStdKeyHash != aKeyEvent.iScanCode )
+            {
+            check = ETrue;
+            }
+        }
+    else if ( EEventKey == aType && EStdKeyNull == aKeyEvent.iScanCode )
+        {
+        check = ETrue;
+        }
+    
+    return check;
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL
+// --------------------------------------------------------------------------
+//    
+void CPbk2ContactEditorDlgImpl::CheckCurrentFieldTextL( 
+        CPbk2ContactEditorArrayItem* aCurrentField,
+		const TKeyEvent& aKeyEvent, 
+		TEventCode aType )
+    {
+    MPbk2ContactEditorField* editorField = aCurrentField->ContactEditorField();
+    MVPbkStoreContactField& contactField = editorField->ContactField();
+    TVPbkFieldStorageType dataType = contactField.FieldData().DataType();
+    
+    if ( EVPbkFieldStorageTypeText == dataType )
+        {
+        const MVPbkContactFieldTextData& textData = 
+            MVPbkContactFieldTextData::Cast(contactField.FieldData());
+        TInt maxSize = textData.MaxLength();
+        
+        if ( KVPbkUnlimitedFieldLength != maxSize &&
+                IsCheckPointEvent( aKeyEvent, aType ) )
+            {
+            CEikEdwin* ctrl = editorField->Control();
+            HBufC* textBuf = ctrl->GetTextInHBufL();
+            
+            if ( textBuf )
+                {
+                TInt maxLen = maxSize;
+                if ( IsUnicodeL( *textBuf ) )
+                    {
+                    maxLen = maxSize / KTwoBytes - KExtraByte;
+                    }
+                if ( ctrl->MaxLength() != maxLen && textBuf->Length() <= maxLen )
+                    {
+                    ctrl->SetMaxLength( maxLen );
+                    }
+                }
+            }
+        }
+    }
+
 // End of File
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -665,6 +665,7 @@
 //
 void CPbk2ContactViewListBox::HandleGainingForeground()
     {
+	DrawDeferred();
     }
 
 // --------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -733,6 +733,11 @@
 void CPbk2FetchDlg::SelectContactL
         ( const MVPbkContactLink& aLink, TBool aSelected )
     {
+    if ( iParams.iFlags & EFetchSingle )
+        {
+         // Clean result if this is single fetch.
+         iResults->ResetAndDestroy();
+        }
     if ( aSelected )
         {
         iResults->AppendL( aLink );
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -60,8 +60,8 @@
 #include <aknPopup.h>
 
 // For checking mailbox accounts
-#include <EmailInterfaceFactory.h>
-#include <MEmailMailbox.h>
+#include <emailinterfacefactory.h>
+#include <memailmailbox.h>
 
 // Debugging headers
 #include <Pbk2Debug.h>
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -846,7 +846,7 @@
                 iContainer( aContainer ),
                 iNameFormatter( aNameFormatter ),
                 iStoreProperties( aStoreProperties ),
-                iThumbManager( aThumbManager ), //TODO
+                iThumbManager( aThumbManager ),
                 iAllowPointerEvents( ETrue )
     {
     }
@@ -940,7 +940,7 @@
                MVPbkContactViewBase& aView,
                MPbk2ContactNameFormatter& aNameFormatter,
                CPbk2StorePropertyArray& aStoreProperties,
-               CPbk2ThumbnailManager* aThumbManager )   //TODO
+               CPbk2ThumbnailManager* aThumbManager )
     {
     CPbk2NamesListControl* self = new (ELeave) CPbk2NamesListControl(
             aContainer, aManager, aView, aNameFormatter, aStoreProperties, aThumbManager );
@@ -1049,7 +1049,6 @@
             *iViewStack, iNameFormatter, iStoreProperties,
             iUiExtension, *iSearchFilter );
 
-        //TODO at this point remove observer
         if( iThumbManager )
             {
             iThumbManager->RemoveObserver();
--- a/phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -412,6 +412,72 @@
      	}
     }
 
+// --------------------------------------------------------------------------
+// Pbk2AddressTools::MapVPbkFieldTypeToAddressGroupId
+// --------------------------------------------------------------------------
+//
+EXPORT_C TPbk2FieldGroupId Pbk2AddressTools::MapVPbkFieldTypeToAddressGroupId( 
+			const MVPbkFieldType* aVPbkFieldType )
+    {
+    TPbk2FieldGroupId groupId = EPbk2FieldGroupIdNone;
+    TArray<TVPbkFieldVersitProperty> versitArr = aVPbkFieldType->VersitProperties();
+    if (versitArr.Count())
+        {
+        const TVPbkFieldVersitProperty& prop = versitArr[0];
 
+        if (prop.Name() == EVPbkVersitNameADR)
+            {
+            if (versitArr[0].Parameters().Contains(EVPbkVersitParamHOME))
+                {
+                groupId = EPbk2FieldGroupIdHomeAddress;
+                }
+            else if (versitArr[0].Parameters().Contains(EVPbkVersitParamWORK))
+                {
+                groupId = EPbk2FieldGroupIdCompanyAddress;
+                }
+            else
+                {
+                groupId = EPbk2FieldGroupIdPostalAddress;
+                }
+            }
+        }
+    return groupId;
+    }
 
+// --------------------------------------------------------------------------
+// Pbk2AddressTools::IsAddressPreviewEmptyL
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool Pbk2AddressTools::IsAddressPreviewEmptyL( 
+		MVPbkStoreContact& aContact,
+		TPbk2FieldGroupId aAddressGroup )
+	{
+    if( aAddressGroup != EPbk2FieldGroupIdPostalAddress &&
+    		aAddressGroup != EPbk2FieldGroupIdCompanyAddress &&
+    		aAddressGroup != EPbk2FieldGroupIdHomeAddress )
+        	{
+        	User::Leave(KErrArgument);
+        	}
+    TBool isEmpty = ETrue;
+    RHashMap<TInt, TPtrC> fieldsMap;
+    GetAddressFieldsLC( aContact, aAddressGroup, fieldsMap );
+    if( fieldsMap.Find( EVPbkVersitSubFieldStreet ) )
+    	{
+        isEmpty = EFalse;
+    	}
+    else if( fieldsMap.Find( EVPbkVersitSubFieldLocality ) )
+    	{
+        isEmpty = EFalse;
+    	}
+    else if( fieldsMap.Find( EVPbkVersitSubFieldRegion ) )
+    	{
+        isEmpty = EFalse;
+    	}
+    else if( fieldsMap.Find( EVPbkVersitSubFieldCountry ) )
+    	{
+        isEmpty = EFalse;
+    	}
+    CleanupStack::PopAndDestroy( &fieldsMap );
+    return isEmpty;
+	}
 
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -117,17 +117,12 @@
     
     // (1) Add thumbnail icon
     //
-    // TODO: to be fixed
-    //const TPbk2IconId& thumb = iThumbManager.GetPbkIconIndex( aIndex, aViewContact );
-    //element->SetIconId( MPbk2DoubleListboxDataElement::EThumbnail, thumb );
-    // -- temporary sollution:
     TInt index = iThumbManager.GetPbkIconIndexL( aIndex, aViewContact );
     if( index != KErrNotFound )
         {
         iBuffer.AppendNum( index );
         }
     iBuffer.Append( KListColumnSeparator );
-    // --
 
     // (2) Add contact name
     //
@@ -162,12 +157,11 @@
         MPbk2DoubleListboxDataElement::ETypeGenericText );
     CleanupStack::Pop( name );
 
-    // (3, 4) Secondary text and icon
-    //
-    // -> These are empty by default
+    // (3) Secondary text 
+    // 
+    // => Empty by default
   
-
-    // (5) Trailing icon
+    // (4) Trailing icon
     //
     RArray<TPbk2IconId> ids;
     CleanupClosePushL( ids );
@@ -222,12 +216,10 @@
 
     // List model format:
     //   [thumbnail icon] \t [contact name] \t [secondary text] \t
-    //   [secondary icon] \t [trailing icon]
+    //   [trailing icon]
 
     // (1) Thumbnail icon
-    // TODO: to be fixed
-    //AppendIconIndex( 
-    //    aElement.IconId( MPbk2DoubleListboxDataElement::EThumbnail ) );
+    // No element support needed for thumbnail at the moment 
 
     // (2) Contact name
     AppendName( aElement.TextPtr( MPbk2DoubleListboxDataElement::EName ) );
@@ -236,14 +228,8 @@
     // (3) Secondary text
     TPtr status( aElement.TextPtr( MPbk2DoubleListboxDataElement::EStatusText ) );
     AppendText( status );
-       
-#if 0	// Service icon is removed for now.
-    // (4) Secondary icon
-    AppendIconIndexIfFound( 
-        aElement.IconId( MPbk2DoubleListboxDataElement::EServiceIcon ) );
-#endif
     
-    // (5) Trailing icon
+    // (4) Trailing icon
     AppendIconIndexIfFound( 
         aElement.IconId( MPbk2DoubleListboxDataElement::EMainIcon ) );
     }
@@ -254,6 +240,9 @@
 //
 void CPbk2ContactViewDoubleListBoxModel::AppendText( TDes& aText ) const
     {
+	//Convert numbers to some languages specific version. E.g.: Arabic.
+    AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText );
+    
     // replace non-allowed characters with ' '
     Pbk2PresentationUtils::ReplaceNonGraphicCharacters(
         aText, KGraphicReplaceCharacter );
--- a/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimNonTouchableUiRes.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 USIM UI extension resource definitions.
-*
-*/
-
-
-// RESOURCE IDENTIFIER
-NAME    P2UU  // From Phonebook 2 USIM UI
-
-// Phonebook 2
-#include "pbk2usimui.hrh"
-#include "pbk2usimui.rh"
-#include <pbk2usimui.hrh>
-#include <pbk2icons.hrh>
-#include <pbk2iconarrayid.hrh>
-#include <pbk2commands.rsg>
-#include <pbk2uicontrols.rsg>
-#include <pbk2uicontrols.rh>
-#include <pbk2uicontrols.hrh>
-#include <pbk2iconinfo.rh>
-#include <pbk2storeproperty.rh>
-#include <pbk2fieldproperty.hrh>
-#include <pbk2fieldproperty.rh>
-#include <pbk2storeproperty.hrh>
-#include <pbk2contactview.hrh>
-#include <pbk2storeinfo.hrh>
-#include <pbk2uid.h>
-#include <pbk2uiextension.rh>
-#include <pbk2viewgraph.rh>
-#include <pbk2extensionuid.h>
-#include <pbk2viewid.hrh>
-#include <pbk2iconid.rh>
-#include <phonebook2.loc>
-#include <psu2.mbg>
-
-// Virtual Phonebook
-#include <vpbkcontactview.rh>
-#include <vpbkfieldtype.rh>
-#include <vpbkstoreuridefinitions.hrh>
-#include <vpbkeng.rsg>
-#include <vpbkfieldtype.hrh>
-
-// System includes
-#include <avkon.loc>
-#include <uikon.rh>
-#include <eikon.rh>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <avkon.hrh>
-#include <avkonicons.hrh>
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-
-// Additional resource files
-#include "pbk2usiminformation.rss"
-#include "pbk2usimcbaresources.rss"
-#include "pbk2usimtextbuffers.rss"
-#include "pbk2usimsimcopy.rss"
-#include "pbk2usimownnumberview.rss"
-#include "pbk2usimservicedialingview.rss"
-#include "pbk2usimfixeddialingview.rss"
-#include "pbk2usimfixeddialinginfoview.rss"
-#include "pbk2usimservicedialinginfoview.rss"
-
-// End of File
--- a/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableFixedDialingView.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,411 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 touchable fixed dialing view definition.
-*
-*/
-
-
-// --------------------------------------------------------------------------
-// FDN contact view
-// --------------------------------------------------------------------------
-//
-RESOURCE VPBK_CONTACT_VIEW r_psu2_fdn_contacts_view
-    {
-    uri = KVPBK_SIM_GLOBAL_FDN_URI;
-    flags = EVPbkContactViewFlagsNone;
-    subViews = {};
-    }
-
-// --------------------------------------------------------------------------
-// Avkon view definition
-// --------------------------------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_psu2_fixed_dialing_appview
-    {
-    menubar = r_psu2_fixed_dialing_menubar;
-    cba = R_AVKON_SOFTKEYS_BACK;
-    }
-
-// --------------------------------------------------------------------------
-// Menu bar
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_psu2_fixed_dialing_menubar
-    {
-    titles =
-        {
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_SYSTEM_MENU;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_copy_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_STYLUS_CALL_MENU;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_open_menupane;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Context menu bar
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_psu2_fixed_dialing_context_menubar
-    {
-    titles =
-        {
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_MARKABLE_LIST_CONTEXT_MENU;
-            },                
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_copy_context_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_newcontact_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_fixed_dialing_delete_menupane;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPsu2CmdActivateFDN;
-            txt = qtn_fdn_activate_fdn;
-            },
-        MENU_ITEM
-            {
-            command = EPsu2CmdDeactivateFDN;
-            txt = qtn_fdn_deactivate_fdn;
-            },
-        MENU_ITEM
-            {
-            command = EPsu2CmdNewContact;
-            txt = qtn_simp_opt_entry_create;
-            },
-        MENU_ITEM
-            {
-            command = EPbk2CmdEditMe;
-            txt = qtn_phob_opt_entry_edit;
-            flags = EEikMenuItemSpecific;
-            },
-        MENU_ITEM
-            {
-            command = EPbk2CmdDeleteMe;
-            txt = qtn_phob_opt_entry_delete;
-            flags = EEikMenuItemSpecific;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Open menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_open_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPsu2CmdOpenFixedDialingInfoView;
-            txt = qtn_simp_opt_entry_view;
-            flags = EEikMenuItemAction; 
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Delete menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_delete_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPbk2CmdDeleteMe;
-            txt = qtn_phob_opt_entry_delete;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// New contact menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_newcontact_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPsu2CmdNewContact;
-            txt = qtn_simp_opt_entry_create;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Copy menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_copy_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPbk2CmdCopy;
-            txt = qtn_simp_opt_copy_to_pb;
-            flags = EEikMenuItemSpecific;
-            },
-        MENU_ITEM
-            {
-            command = EPsu2CmdCopyFromContacts;
-            txt = qtn_fdn_opt_copy_from_pb;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Copy context menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_fixed_dialing_copy_context_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPbk2CmdCopy;
-            txt = qtn_simp_opt_copy_to_pb;
-            },
-        MENU_ITEM
-            {
-            command = EPsu2CmdCopyFromContacts;
-            txt = qtn_fdn_opt_copy_from_pb;
-            }
-        };
-    }
-// --------------------------------------------------------------------------
-// Names list control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_psu2_fixed_dialing_name_list_control
-    {
-    // Flags
-    flags = KPbk2ContactViewListControlUpdateContextPane | KPbk2ContactViewListControlFindBox;
-    // Listbox resource
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxStylusMarkableList|EAknListBoxLoopScrolling;
-        };
-    // Optional link to an icon array resource, see PBK2_ICON_ARRAY
-    iconArray = R_PBK2_FIELDTYPE_ICONS;
-    // Empty icon id in iconArray(s)
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    defaultIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_phone;
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Tabs
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_VIEW_NODE_TAB_ARRAY r_psu2_fixed_dialing_view_tabs
-    {
-    items =
-        {
-        PBK2_VIEW_NODE_TAB
-            {
-            version = 0;
-            tabsInGroup = 1;
-            tab = r_psu2_fixed_dialing_view_tab1;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Tab
-// --------------------------------------------------------------------------
-//
-RESOURCE TAB r_psu2_fixed_dialing_view_tab1
-    {
-    id = EPsu2FixedDialingViewId;
-    }
-
-// --------------------------------------------------------------------------
-// A dialog for asking fixed dialling phone number
-// --------------------------------------------------------------------------
-//
-RESOURCE DIALOG r_psu2_fdn_numberquery_dialog
-    {
-    flags=  EAknGeneralQueryFlags;
-    buttons=R_AVKON_SOFTKEYS_CALL_CANCEL__CALL;
-    items=
-        {
-        DLG_LINE
-            {
-            type=EAknCtQuery;
-            id=EGeneralQuery;
-            control=AVKON_DATA_QUERY
-                {
-                layout = EPhoneLayout;
-                label = qtn_fdn_enter_number_to_call;
-                control= EDWIN
-                    {
-                    };
-                };
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Name formatting field types
-// --------------------------------------------------------------------------
-//
-RESOURCE VPBK_FIELD_TYPE_MAPPING_LIST r_psu2_fdn_name_display_order
-    {
-    items =
-        {
-        /// Top contact indicator / Top contact internal order        
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameTopContact;
-                };
-            },                
-        // Last name
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameN;
-                subField = EVPbkVersitSubFieldFamilyName;
-                };
-            },
-        // First name
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameN;
-                subField = EVPbkVersitSubFieldGivenName;
-                };
-            },
-        /// Last name reading
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameSOUND;
-                subField = EVPbkVersitSubFieldFamilyNamePronunciation;
-                };
-            },
-        /// First name reading
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameSOUND;
-                subField = EVPbkVersitSubFieldGivenNamePronunciation;
-                };
-            },
-        // SIM GSM number = general mobile
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY
-                {
-                name = EVPbkVersitNameTEL;
-                parameters =
-                    {
-                    EVPbkVersitParamCELL
-                    };
-                };
-            },
-        // Generic label
-        VPBK_FIELD_TYPE_MAPPING
-            {
-            versitProperty = VBK_FIELD_VERSIT_PROPERTY {};
-            nonVersitType = EVPbkNonVersitTypeGenericLabel;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Title field selector
-// --------------------------------------------------------------------------
-//
-RESOURCE VPBK_FIELD_TYPE_SELECTOR r_psu2_fdn_title_field_selector
-    {
-    versitProperties =
-        {
-        // Last name
-        VBK_FIELD_VERSIT_PROPERTY
-            {
-            name = EVPbkVersitNameN;
-            subField = EVPbkVersitSubFieldFamilyName;
-            },
-        // SIM GSM number = general mobile
-        VBK_FIELD_VERSIT_PROPERTY
-            {
-            name = EVPbkVersitNameTEL;
-            parameters = { EVPbkVersitParamCELL };
-            }
-        };
-    nonVersitType =
-        {
-        EVPbkNonVersitTypeGenericLabel
-        };
-    }
-
-// End of File
--- a/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableServiceDialingView.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 touchable service dialing view definition.
-*
-*/
-
-
-// --------------------------------------------------------------------------
-// SDN contact view
-// --------------------------------------------------------------------------
-//
-RESOURCE VPBK_CONTACT_VIEW r_psu2_sdn_contacts_view
-    {
-    uri = KVPBK_SIM_GLOBAL_SDN_URI;
-    flags = EVPbkContactViewFlagsNone;
-    subViews = {};
-    }
-
-// --------------------------------------------------------------------------
-// Avkon view definition
-// --------------------------------------------------------------------------
-//
-RESOURCE AVKON_VIEW r_psu2_service_dialing_appview
-    {
-    menubar = r_psu2_service_dialing_menubar;
-    cba = R_AVKON_SOFTKEYS_BACK;
-    }
-
-// --------------------------------------------------------------------------
-// Service dialing view menu bar
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_psu2_service_dialing_menubar
-    {
-    titles =
-        {
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_SYSTEM_MENU;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_service_dialing_copy_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
-            },
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_CALL_MENU;
-            },
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_service_dialing_open_menupane;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Service dialing view context menu bar
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_BAR r_psu2_service_dialing_context_menubar
-    {
-    titles =
-        {
-        MENU_TITLE
-            {
-            menu_pane = r_psu2_service_dialing_copy_menupane;
-            },
-        MENU_TITLE
-            {
-            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Open menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_service_dialing_open_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPsu2CmdOpenServiceDialingInfoView;
-            txt = qtn_simp_opt_entry_view;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Copy menu pane
-// --------------------------------------------------------------------------
-//
-RESOURCE MENU_PANE r_psu2_service_dialing_copy_menupane
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPbk2CmdCopy;
-            txt = qtn_simp_opt_copy_to_pb;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Names list control
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_CONTACT_CONTROL r_psu2_service_dialing_name_list_control
-    {
-    // Flags
-    flags = KPbk2ContactViewListControlUpdateContextPane | KPbk2ContactViewListControlFindBox;
-    // Listbox resource
-    listbox = LISTBOX
-        {
-        flags = EAknListBoxStylusMarkableList|EAknListBoxLoopScrolling;
-        };
-    // Optional link to an icon array resource, see PBK2_ICON_ARRAY
-    iconArray = R_PBK2_FIELDTYPE_ICONS;
-    // Empty icon id in iconArray(s)
-    emptyIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_empty;
-        };
-    // Optional default icon to use for all list rows
-    defaultIconId = PHONEBOOK2_ICON_ID
-        {
-        ownerUid = KPbk2UID3;
-        id = EPbk2qgn_prop_nrtyp_phone;
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Tabs
-// --------------------------------------------------------------------------
-//
-RESOURCE PBK2_VIEW_NODE_TAB_ARRAY r_psu2_service_dialing_view_tabs
-    {
-    items =
-        {
-        PBK2_VIEW_NODE_TAB
-            {
-            version = 0;
-            tabsInGroup = 1;
-            tab = r_psu2_service_dialing_view_tab1;
-            }
-        };
-    }
-
-// --------------------------------------------------------------------------
-// Tab
-// --------------------------------------------------------------------------
-//
-RESOURCE TAB r_psu2_service_dialing_view_tab1
-    {
-    id = EPsu2ServiceDialingViewId;
-    }
-
-// End of File
--- a/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimTouchableUiRes.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* Copyright (c) 2005-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:  Phonebook 2 USIM UI extension resource definitions.
-*
-*/
-
-
-// RESOURCE IDENTIFIER
-NAME    P2UU  // From Phonebook 2 USIM UI
-
-// Phonebook 2
-#include "Pbk2USimUI.hrh"
-#include "Pbk2USimUI.rh"
-#include <Pbk2USimUI.hrh>
-#include <Pbk2Icons.hrh>
-#include <Pbk2IconArrayId.hrh>
-#include <Pbk2Commands.rsg>
-#include <Pbk2UIControls.rsg>
-#include <Pbk2UIControls.rh>
-#include <Pbk2UIControls.hrh>
-#include <Pbk2IconInfo.rh>
-#include <Pbk2StoreProperty.rh>
-#include <Pbk2FieldProperty.hrh>
-#include <Pbk2FieldProperty.rh>
-#include <Pbk2StoreProperty.hrh>
-#include <Pbk2ContactView.hrh>
-#include <Pbk2StoreInfo.hrh>
-#include <Pbk2UID.h>
-#include <Pbk2UIExtension.rh>
-#include <Pbk2ViewGraph.rh>
-#include <Pbk2ExtensionUID.h>
-#include <Pbk2ViewId.hrh>
-#include <Pbk2IconId.rh>
-#include <psu2.mbg>
-#include <phonebook2.loc>
-
-// Virtual Phonebook
-#include <VPbkContactView.rh>
-#include <VPbkFieldType.rh>
-#include <VPbkStoreUriDefinitions.hrh>
-#include <VPbkEng.rsg>
-#include <VPbkFieldType.hrh>
-
-// System includes
-#include <avkon.loc>
-#include <uikon.rh>
-#include <eikon.rh>
-#include <avkon.rh>
-#include <avkon.rsg>
-#include <avkon.mbg>
-#include <avkon.hrh>
-#include <AvkonIcons.hrh>
-
-// --------------------------------------------------------------------------
-// Standard resource signature
-// --------------------------------------------------------------------------
-//
-RESOURCE RSS_SIGNATURE { }
-    
-// Additional resource files
-#include "Pbk2USimInformation.rss"
-#include "Pbk2USimCbaResources.rss"
-#include "Pbk2USimTextBuffers.rss"
-#include "Pbk2USimSimCopy.rss"
-#include "Pbk2USimOwnNumberView.rss"
-#include "Pbk2USimTouchableServiceDialingView.rss"
-#include "Pbk2USimTouchableFixedDialingView.rss"
-#include "Pbk2USimFixedDialingInfoView.rss"
-#include "Pbk2USimServiceDialingInfoView.rss"
-
-// End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h	Wed Mar 31 21:13:53 2010 +0300
@@ -83,6 +83,12 @@
      * (see details from baseclass )
      */
     virtual void SizeChanged();
+	
+	/**
+     * From CCoeControl
+     * (see details from baseclass )
+     */
+	void HandleResourceChange(TInt aType);
 
     /**
      * From CCoeControl
@@ -291,8 +297,8 @@
      * Listbox for the "communication buttons"
      * Own.
      */
-    // CCCAppCommLauncherCustomListBox* iListBox;
-    CAknDoubleLargeStyleListBox* iListBox;
+    CCCAppCommLauncherCustomListBox* iListBox;
+
     /**
      * Background for skinning
      * Own.
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h	Wed Mar 31 21:13:53 2010 +0300
@@ -1234,6 +1234,10 @@
     * @return Instance of CEikListBox.
     */
     CEikListBox* ListBox() const;
+    
+    void InitSmileyL();
+    
+    void SetSmileySubCellL( TInt aSubCell );
 
     
 private:
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h	Wed Mar 31 21:13:53 2010 +0300
@@ -253,11 +253,9 @@
     /**
     * @internal
     */
-    void DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const;
-    /**
-     *  Draw separator line 
-     */
-    void DrawSeparator( CGraphicsContext& aGc, const TRect& aRect, const TRgb& aColor ) const;
+	void DrawBackgroundAndSeparatorLines( 
+        const TRect& aItemTextRect, TBool aDrawSeparator ) const;
+		
                         
 
 private:
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Wed Mar 31 21:13:53 2010 +0300
@@ -237,6 +237,23 @@
      * @param aContactFieldInfo 
      */    
     void UpdateAddressesValidationL( const CCmsContactFieldInfo& aContactFieldInfo );
+    
+    
+    /**
+     * Loads the VOIP Button Icon & Label 
+     * Usecase : If we have only one voip service, the voip(Internet Call)
+     * button should have the Branded Icon of that Service and the label
+     * must be "ServiceName" appended with "Call".
+     * eg : If we have a service named SKYPE installed in the Phone
+     * and if SKYPE supports VOIP, then the VOIP Button Icon should be
+     * the Branded Icon of SKYPE and the Button Label should be
+     * "SKYPE CALL". 
+     * @return TInt - Stores the Info regd whether Image/Text was set for the
+     *          VOIP Buttton or not. We use KVOIPButtonImageSet && with the returnval
+     *          to know whether Image has been set or not
+     *          Will be used in   HandleNotifyChange
+     */
+    TInt LoadVoipButtonInfoL();
    
 
 private: // New
@@ -325,22 +342,6 @@
     void ConstructL();        
     
     /**
-     * Loads the VOIP Button Icon & Label 
-     * Usecase : If we have only one voip service, the voip(Internet Call)
-     * button should have the Branded Icon of that Service and the label
-     * must be "ServiceName" appended with "Call".
-     * eg : If we have a service named SKYPE installed in the Phone
-     * and if SKYPE supports VOIP, then the VOIP Button Icon should be
-     * the Branded Icon of SKYPE and the Button Label should be
-     * "SKYPE CALL". 
-     * @return TInt - Stores the Info regd whether Image/Text was set for the
-     *          VOIP Buttton or not. We use KVOIPButtonImageSet && with the returnval
-     *          to know whether Image has been set or not
-     *          Will be used in   HandleNotifyChange
-     */
-    TInt LoadVoipButtonInfoL();
-    
-    /**
      * Finds the number of services that support internet call 
      * by scanning all the services in the SPSettings Table.
      * @param aServiceId - Stores the last matched service id    
@@ -366,7 +367,13 @@
     /**
      * Handles SPSettings Changes
      */            
-		void DoHandleNotifyChangeL() ;
+	void DoHandleNotifyChangeL() ;
+	
+	/**
+     * Get the size of service bitmap
+	 * @return - Size of the bitmap
+     */	
+	TSize GetServiceBitmapSize();
     
 private:
     //From MSPNotifyChangeObserver
@@ -403,6 +410,14 @@
         TInt aItemIndex,
         TInt aSubCellNumber) const;
 
+    /*
+     * In Arabic variant the displaying of numbers in phonebook should follow 
+     * the Arabic/Latin number setting that is found in General Settings > 
+     * Phone > Language, So the second row text must be digits.
+     * @param aContactField method
+     */
+    TBool IsPhoneNumber( const CCmsContactField& iContactField );
+
 private: // Data
 
     /**
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -286,6 +286,19 @@
     }
 
 // ----------------------------------------------------------------------------
+// CCCAppCommLauncherContainer::HandleResourceChange()
+// ----------------------------------------------------------------------------
+//
+void CCCAppCommLauncherContainer::HandleResourceChange(TInt aType)
+	{
+	if ( aType == KEikDynamicLayoutVariantSwitch )
+		{
+		TRAP_IGNORE( iModel->LoadVoipButtonInfoL() );
+		CCCAppViewPluginAknContainer::HandleResourceChange(aType); 
+		}
+	}
+
+// ----------------------------------------------------------------------------
 // CCCAppCommLauncherContainer::CountComponentControls()
 // ----------------------------------------------------------------------------
 //
@@ -487,16 +500,19 @@
                     *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray
                     paramFlag, 
                     fullName );
-            
-                if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
-                    contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
-                    contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
+                   
+                contactorService->ExecuteServiceL( param );   
+                
+                //The Timer can be started after user selected any call item
+                if ( contactorService->IsSelected() && 
+                	(contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
+                     contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
+                     contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) )
                     {
                     iPlugin.StartTimerL();
                     }
-            
-                contactorService->ExecuteServiceL( param );
-    
+                
+                
                 CleanupStack::PopAndDestroy( 1 );// contactlinkarray
                 }
             }
@@ -575,15 +591,17 @@
                     paramFlag,
                     fullName);
             
-                if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
-                    contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
-                    contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
+                contactorService->ExecuteServiceL(param);
+                
+                //The Timer can be started after user selected any call item
+                if ( contactorService->IsSelected() && 
+                	(contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
+                     contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
+                     contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) )
                     {
                     iPlugin.StartTimerL();
                     }
-            
-                contactorService->ExecuteServiceL(param);
-    
+                
                 CleanupStack::PopAndDestroy(1);// contactlinkarray
         	    }
         	}
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -110,7 +110,23 @@
 	// ------------------------------------------------
 	//
 	
-		
+	// Calculate listbox rect
+    TAknWindowComponentLayout listPaneLayout( TAknWindowComponentLayout::Compose(
+        AknLayoutScalable_Apps::phob2_cc_listscroll_pane( 0 ),
+        TAknWindowComponentLayout::Compose( 
+            AknLayoutScalable_Apps::phob2_cc_list_pane( 0 ), 
+            AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane( 0 ) ) ) );    
+  
+    TAknLayoutRect listPaneLayoutRect;
+    listPaneLayoutRect.LayoutRect( TRect( Size() ), listPaneLayout.LayoutLine() );
+    TRect listPaneRowRect( listPaneLayoutRect.Rect() );
+    
+    // Set listbox item height
+    SetItemHeightL( listPaneRowRect.Height() );
+    iItemDrawer->SetItemCellSize( listPaneRowRect.Size() );
+    
+
+	// Reset sub cell array	
 	iColumnData->ResetSLSubCellArray();
 			  
 	// Comm method icon	
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -50,12 +50,15 @@
 
 
 #include <touchfeedback.h>
+#include <AknSmileyUtils.h>
 // there are 17(!) subcells in qdial grid (0 ... 16)
 const TInt KMaxSubCellIndex = 16 + 1;
 
 // colored tick marks support
 const TInt KColorIconFlag = -1;
 const TInt KColorIconIdx = 0;
+// smiley text place holder
+_LIT( KPlaceHolder, "\xFFF0i" );
 
 /**
  * This class needs to be in .cpp file so that we do not accidentally make it
@@ -76,7 +79,8 @@
 		public MAknPictographAnimatorCallBack,
 		public MCoeForegroundObserver,
 		public MAknsEffectAnimObserver,
-		public MListBoxItemChangeObserver
+        public MListBoxItemChangeObserver,
+        public MAknSmileyObserver
 	{
 public:
 	enum TFlag
@@ -120,6 +124,7 @@
 		TAknWindowLineLayout iGraphicLayout;
 		TInt iSubCellType;
 		TInt iConditionValue; // used with conditional layouts for not always drawn subcells
+        TBool iSmileyCell;
 		};
 
 	SRowAndSubCell& At(TInt aArrayIndex);
@@ -170,6 +175,11 @@
 
 	TBool DrawPressedDownEffectL(MAknsSkinInstance* aSkin, CWindowGc& aGc,
 			const TRect& aOutRect, const TRect& aInnerRect) const;
+    void DrawSmileyWithText( CWindowGc& aGc, const TDesC& aSmileyText, 
+                             const TAknLayoutText& aLayout, 
+                             TBool aUseLogicalToVisualConversion, 
+                             const TRgb &aColor);
+    TInt ConvertTextToSmiley( TDes& aText );
 private:
 	// New internal methods
 	TBool DrawHighlightBackground(CFbsBitGc& aGc);
@@ -191,7 +201,9 @@
 
 	TInt FindSubCellExtIndex(TInt& aArrayIndex, TInt aSubCell) const;
 	TBool SubCellLayoutAlignment(TInt aSubCellIndex) const;
-
+public: // from MAknSmileyObserver
+    void SmileyStillImageLoaded( CAknSmileyIcon* aSmileyIcon );
+    void SmileyAnimationChanged( CAknSmileyIcon* aSmileyIcon );
 private:
 	// From MAknPictographAnimatorCallBack
 	void DrawPictographArea();
@@ -261,6 +273,8 @@
 
 	TRect iMarginRect;
 	TBool iKineticScrolling;
+    CAknSmileyManager* iSmileyMan;
+    TSize iSmileySize; // last set simley size
 	};
 
 /**
@@ -317,6 +331,7 @@
 	// Stop receiving foreground events
 	CCoeEnv* env = CCoeEnv::Static();
 	env->RemoveForegroundObserver(*this);
+    delete iSmileyMan;
 
 	delete iRowAndSubCellArray;
 	iRowAndSubCellArray = NULL;
@@ -394,6 +409,7 @@
 	subcell.iGraphicLayout = NULL;
 	subcell.iSubCellType = 0;
 	subcell.iConditionValue = -1;
+    subcell.iSmileyCell = EFalse;
 
 	TKeyArrayFix key(0, ECmpTInt32);
 	iSLSubCellArray->InsertIsqL(subcell, key);
@@ -1100,6 +1116,16 @@
 		return (ETrue);
 	return (iSubCellExtArray->At(index).iLayoutAlign);
 	}
+void CCCAppCommLauncherCustomListBoxDataExtension::SmileyStillImageLoaded(
+    CAknSmileyIcon* /*aSmileyIcon*/)
+    {
+    iControl->DrawDeferred();
+    }
+
+void CCCAppCommLauncherCustomListBoxDataExtension::SmileyAnimationChanged( 
+    CAknSmileyIcon* /*aSmileyIcon*/ )
+    {
+    }
 
 ///////////handling TSubCellExt,end
 
@@ -1151,6 +1177,31 @@
 	return AknsDrawUtils::DrawFrame(aInstance, aGc, aOutRect, aInnerRect,
 			KAknsIIDQsnFrListPressed, KAknsIIDQsnFrListCenterPressed);
 	}
+void CCCAppCommLauncherCustomListBoxDataExtension::DrawSmileyWithText( CWindowGc& aGc,
+                                                             const TDesC& aSmileyText,
+                                                             const TAknLayoutText& aLayout,
+                                                             TBool aUseLogicalToVisualConversion,
+                                                             const TRgb& aColor )
+    {
+    //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
+    TInt l = Min( aLayout.Font()->TextWidthInPixels(KPlaceHolder), 
+                  aLayout.Font()->HeightInPixels() );
+    TSize s(l,l);
+    if ( iSmileySize != s )
+        {
+        iSmileyMan->SetSize( s );
+        iSmileySize = s;
+        }
+    aGc.SetPenColor( aColor ); // SmileyManager's DrawText does not accept aColor...
+    iSmileyMan->DrawText( aGc, aSmileyText, aLayout, aUseLogicalToVisualConversion );
+    }
+TInt CCCAppCommLauncherCustomListBoxDataExtension::ConvertTextToSmiley( TDes& aText)
+    {
+    //__ASSERT_DEBUG( iSmileyMan, Panic(EAknPanicObjectNotFullyConstructed));
+    TInt count = 0;
+    TRAPD( err, count = iSmileyMan->ConvertTextToCodesL( aText )) ;
+    return err == KErrNone ? count : err;
+    }
 
  CCoeControl *CCCAppCommLauncherCustomListBoxData::Control() const
 	{
@@ -2001,8 +2052,16 @@
             SetUnderlineStyle( aProperties, aGc, subcell );
 
             // * 2 == leave some room for marquee
-            const TInt maxlen( KMaxColumnDataLength * 2 ); 
+            const TInt maxlen( KMaxColumnDataLength * 3 );
             TBuf<maxlen> convBuf = text.Left(maxlen);
+            TBool smileyDraw = EFalse;
+            // do smiley convert before clipping. don't worry marquee now.            
+            if ( iExtension->iSmileyMan && 
+                 iExtension->AtSL(SCindex).iSmileyCell &&
+                 iExtension->ConvertTextToSmiley( convBuf ) > 0 )
+                {
+                smileyDraw = ETrue;
+                }
 
             // Note that this potentially modifies the text so its lenght in pixels
             // might increase. Therefore, this should always be done before
@@ -2067,9 +2126,16 @@
 				marquee->Stop();
 				}
 
-			textLayout.DrawText( aGc, convBuf, bidiConv, color );
-			}
-
+                if ( smileyDraw )
+                    {
+                    TRect tr(textLayout.TextRect());
+                    iExtension->DrawSmileyWithText( aGc, convBuf, textLayout, bidiConv, color );
+                    }
+                else
+                    {
+                textLayout.DrawText( aGc, convBuf, bidiConv, color );
+                    }
+                }
 		if ( iExtension->iPictoInterface )
 			{
 
@@ -2142,6 +2208,7 @@
 
 		if( !iIconArray )
 			{
+            ++ subcell;
 			continue;
 			}
 
@@ -3978,6 +4045,24 @@
 		}
 	return NULL;
 	}
-
+void CCCAppCommLauncherCustomListBoxData::InitSmileyL()
+    {
+    //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
+    if ( iExtension && !iExtension->iSmileyMan )
+        {
+        iExtension->iSmileyMan = CAknSmileyManager::NewL( iExtension );
+        }
+    }
+
+void CCCAppCommLauncherCustomListBoxData::SetSmileySubCellL( TInt aSubCell )
+    {    
+    //__ASSERT_DEBUG( iExtension, Panic( EAknPanicObjectNotFullyConstructed ));
+    TInt index = 0;
+    if ( iExtension )
+        {
+        iExtension->FindSLSubCellIndexOrAddL( index,aSubCell );
+        iExtension->AtSL(index).iSmileyCell = ETrue;
+        }
+    }
 // End of File
 
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -156,13 +156,8 @@
    colors.iHighlightedText=iHighlightedTextColor;
    colors.iHighlightedBack=iHighlightedBackColor;
    
-   DrawBackgroundAndSeparatorLines( aItemTextRect );
-
-   // Draw separator line except last item 
-   if ( aItemIndex < iModel->NumberOfItems() - 1 )
-	   {
-	   DrawSeparator( *iGc, aItemTextRect, iTextColor);
-	   }
+   DrawBackgroundAndSeparatorLines( aItemTextRect, 
+            aItemIndex != FormattedCellData()->ListBox()->BottomItemIndex() );
    
    TBool highlightShown = ETrue;
    
@@ -392,7 +387,8 @@
     {
     }
 
-void CCCAppCommLauncherCustomListBoxItemDrawer::DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const
+void CCCAppCommLauncherCustomListBoxItemDrawer::DrawBackgroundAndSeparatorLines( 
+        const TRect& aItemTextRect, TBool aDrawSeparator ) const
     {
     MAknsSkinInstance *skin = AknsUtils::SkinInstance();
     CCoeControl* control = FormattedCellData()->Control();
@@ -461,24 +457,12 @@
             transApi->StopDrawing();
             }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
+        if ( aDrawSeparator && 
+            static_cast<CEikListBox*>( control )->ItemsInSingleLine() == 1 )
+            {
+            AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor );
+            }
         }
     }
 
-void CCCAppCommLauncherCustomListBoxItemDrawer::DrawSeparator( CGraphicsContext& aGc, const TRect& aRect, const TRgb& aColor ) const
-	{
-	aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
-	aGc.SetPenStyle( CGraphicsContext::ESolidPen );
-	
-	TRgb color( aColor );
-	color.SetAlpha( 32 );
-	aGc.SetPenColor( color );
-	
-	TRect lineRect( aRect );
-	TInt gap = AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine().it; 
-	lineRect.Shrink( gap, 0 );
-	lineRect.Move( 0, -1 );
-	
-	aGc.DrawLine( TPoint( lineRect.iTl.iX, lineRect.iBr.iY ), 
-	TPoint( lineRect.iBr.iX, lineRect.iBr.iY ) );
-	}
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -23,6 +23,7 @@
 #include <CPbk2ServiceManager.h>
 
 #include <aknlayoutscalable_avkon.cdl.h>
+#include <aknlayoutscalable_apps.cdl.h>
 //SpSettings
 #include <spsettings.h>
 #include <spentry.h>
@@ -115,6 +116,59 @@
     CleanupStack::PopAndDestroy(2); // idArray, settings
     return result;
     }
+
+
+/**
+ * Returns index of a first VOIP field.
+ */
+TInt SelectVOIPIndexL(const CCmsContactField& aContactField)
+    {
+    TInt result = 0; // by default returns 0
+    CSPSettings* settings = CSPSettings::NewLC();
+    RIdArray idArray;
+    TBool found = EFalse;
+    CleanupClosePushL(idArray);
+
+    TInt error = settings->FindServiceIdsL(idArray);
+    if (error == KErrNone)
+        {
+        for (TInt i = 0; !found && i < idArray.Count(); ++i)
+            {
+            CSPEntry* entry = CSPEntry::NewLC();
+            settings->FindEntryL(idArray[i], *entry);
+
+            const CSPProperty* prop = NULL;
+            
+            if (entry->GetProperty(prop, EPropertyServiceAttributeMask) == KErrNone)
+                {
+                TInt value = 0;
+                prop->GetValue(value);
+                
+                if ( value & ESupportsInternetCall )
+                    {
+                    for (TInt i = 0; i < aContactField.ItemCount(); ++i)
+                                        {
+                        const CCmsContactFieldItem& item = aContactField.ItemL(i);
+                        TPtrC data = item.Data();
+                        TPtrC scheme = ParseService(data);
+                        if (CompareService(*entry, scheme))
+                            {
+                            result = i;
+                            found = ETrue;
+                            break;
+                            }
+                        }
+                    }
+                }                       
+            CleanupStack::PopAndDestroy(); // entry
+            }
+        }
+
+    CleanupStack::PopAndDestroy(2); // idArray, settings
+    return result;
+    }
+
+
 /**
  * Clones the Bitmap
  * This is better than Duplicating the bitmap
@@ -273,12 +327,14 @@
                 KCCAppCommLauncherMaxButtonDataTextLength )
             {
             tempText.Append( textPtr.Left(
-               KCCAppCommLauncherMaxButtonDataTextLength - tempText.Length() - 1 ) );
+               KCCAppCommLauncherMaxButtonDataTextLength - tempText.Length() - 4 ) );
             }
         else
             {
             tempText.Append( textPtr );
             }
+        tempText.Append( KColumnListSeparator ); 
+		
         // TODO: Check presence icon
         tempText.Append( KColumnListSeparator ); 
         
@@ -286,7 +342,6 @@
         if ( IfShowMultiIcon( aIndex ) )
         	{
         	tempText.AppendNum( EMultiIconIndex );
-        	tempText.Append( KColumnListSeparator );  
         	}  
         }
 
@@ -674,6 +729,11 @@
                 index = SelectIMIndexL(aContactField);
                 }
             
+            if ( VPbkFieldTypeSelectorFactory::EVOIPCallSelector == aContactAction )
+                {
+                index = SelectVOIPIndexL( aContactField );
+                }
+                
             if ( aContactAction == VPbkFieldTypeSelectorFactory::EUniEditorSelector 
                 && buttonData.iPopupText.Length() > 0 
                 && aContactField.Type() != CCmsContactFieldItem::ECmsMobilePhoneGeneric
@@ -690,10 +750,54 @@
                         KCCAppCommLauncherMaxButtonDataTextLength ));
                 }
             }
+        
+        if( IsPhoneNumber( aContactField ) )
+            {
+            AknTextUtils::DisplayTextLanguageSpecificNumberConversion( buttonData.iPopupText );
+            }
+        
         }
     }
 
 // ---------------------------------------------------------------------------
+// CCCAppCommLauncherLPadModel::IsPhoneNumber
+// ---------------------------------------------------------------------------
+//
+TBool CCCAppCommLauncherLPadModel::IsPhoneNumber( const CCmsContactField& aContactField )
+    {
+    TBool isPhoneNumber = EFalse;
+
+    switch( aContactField.Type() )
+        {
+        case CCmsContactFieldItem::ECmsLandPhoneGeneric:
+        case CCmsContactFieldItem::ECmsLandPhoneHome:
+        case CCmsContactFieldItem::ECmsGroupVoice:
+        case CCmsContactFieldItem::ECmsAssistantNumber:
+        case CCmsContactFieldItem::ECmsDefaultTypePhoneNumber:
+        case CCmsContactFieldItem::ECmsFaxNumberHome:
+        case CCmsContactFieldItem::ECmsFaxNumberWork:
+        case CCmsContactFieldItem::ECmsMobilePhoneGeneric:
+        case CCmsContactFieldItem::ECmsMobilePhoneHome:
+        case CCmsContactFieldItem::ECmsMobilePhoneWork:
+        case CCmsContactFieldItem::ECmsVideoNumberGeneric:
+        case CCmsContactFieldItem::ECmsVideoNumberHome:
+        case CCmsContactFieldItem::ECmsVideoNumberWork:
+        case CCmsContactFieldItem::ECmsVoipNumberGeneric:
+        case CCmsContactFieldItem::ECmsVoipNumberHome:
+        case CCmsContactFieldItem::ECmsVoipNumberWork:
+        case CCmsContactFieldItem::ECmsCarPhone:
+        case CCmsContactFieldItem::ECmsPagerNumber:
+            isPhoneNumber = ETrue;
+            break;
+        default:
+            isPhoneNumber = EFalse;
+            break;
+        }
+
+    return isPhoneNumber;
+    }
+
+// ---------------------------------------------------------------------------
 // CCCAppCommLauncherLPadModel::LoadIconArrayL
 // ---------------------------------------------------------------------------
 //
@@ -774,10 +878,29 @@
     CFbsBitmap* bmp = NULL;
     CFbsBitmap* mask = NULL;
     CGulIcon* icon = CGulIcon::NewLC();
-
-    AknIconUtils::CreateIconLC(
-        bmp, mask, KPbk2ECEIconFileName, aBmpId, aMaskId );
-
+   
+    // The color of Icon "many items" should be adjusted to the theme background
+    if( EMbmPhonebook2eceQgn_indi_many_items_add == aBmpId)
+        {
+        TAknsItemID skin; 
+        skin.Set( EAknsMajorGeneric,  EAknsMinorGenericQgnIndiManyItemsAdd );
+        TAknsItemID color;
+        color.Set( EAknsMajorSkin, EAknsMinorQsnIconColors );
+    
+        AknsUtils::CreateColorIconLC(
+            AknsUtils::SkinInstance(),skin,
+            color, EAknsCIQsnIconColorsCG13,
+            bmp, mask,
+            KPbk2ECEIconFileName,
+            aBmpId, aMaskId,
+            AKN_LAF_COLOR_STATIC( 215 ) );
+        }
+    else
+        {
+        AknIconUtils::CreateIconLC(
+            bmp, mask, KPbk2ECEIconFileName, aBmpId, aMaskId );
+        }
+   
     icon->SetBitmap( bmp );
     icon->SetMask( mask );
     CleanupStack::Pop( 2 ); // bmp, mask
@@ -1333,16 +1456,10 @@
         //Found the appropriate service info
         if ( service.iServiceId == aServiceId )
             {
-            //Calculate the Size of the Bitmap for Comm Launcher
-            TRect mainPane = iPlugin.ClientRect();                            
-            TAknLayoutRect listLayoutRect;
-                listLayoutRect.LayoutRect(
-                    mainPane,
-                    AknLayoutScalable_Avkon::list_single_large_graphic_pane_g1(0).LayoutLine() );
-            TSize size(listLayoutRect.Rect().Size());
-                        
-            //Set the size of this bitmap.
-            //without this Cloning of bitmap will not happen            
+            // Get service bitmap size
+            TSize size = GetServiceBitmapSize();           
+
+            // Set service bitmap size           
             AknIconUtils::SetSize( service.iBitmap, size );
             AknIconUtils::SetSize( service.iMask, size );
                
@@ -1350,17 +1467,7 @@
             //No direct way of cloning a bitmap
             aBitmap = CloneBitmapLC(size, service.iBitmap);
             aMask = CloneBitmapLC(size, service.iMask);
-            
-            //Calculate preferred size for xsp service icons
-            AknLayoutUtils::LayoutMetricsRect(
-                AknLayoutUtils::EMainPane, mainPane );            
-            listLayoutRect.LayoutRect(
-                mainPane,
-                AknLayoutScalable_Avkon::list_single_graphic_pane_g2(0).LayoutLine() );
-            TSize xspIconSize(listLayoutRect.Rect().Size()); 
-            AknIconUtils::SetSize( service.iBitmap, xspIconSize );
-            AknIconUtils::SetSize( service.iMask, xspIconSize );
-            
+                       
             aLocalisedServiceName = service.iDisplayName.AllocL(); 
             
             CleanupStack::Pop( 2 ); //aBitmap, aMask
@@ -1369,7 +1476,54 @@
         }            
     }
 
-
+// ---------------------------------------------------------------------------
+// CCCAppCommLauncherLPadModel::GetServiceBitmapSize
+// ---------------------------------------------------------------------------
+//
+TSize CCCAppCommLauncherLPadModel::GetServiceBitmapSize()
+    {     
+    /*
+     * Calculate the rect of list_double_large_graphic_phob2_cc_pane_g1 
+     * and select its size as service bitmap size.
+     * Since the layoutRect is relative to the layoutRect of its parent, so 
+     * we calculate from the topmost-mainPane, then follow below sequence:
+     * phob2_contact_card_pane
+     * phob2_cc_listscroll_pane
+     * phob2_cc_list_pane
+     * list_double_large_graphic_phob2_cc_pane
+     * list_double_large_graphic_phob2_cc_pane_g1
+     */
+    TRect mainPane = iPlugin.ClientRect();
+    
+    TAknLayoutRect listLayoutRect0;
+    listLayoutRect0.LayoutRect(
+            mainPane,
+            AknLayoutScalable_Apps::phob2_contact_card_pane(0).LayoutLine() );
+    
+    TAknLayoutRect listLayoutRect1;
+    listLayoutRect1.LayoutRect(
+    		listLayoutRect0.Rect(),
+            AknLayoutScalable_Apps::phob2_cc_listscroll_pane(0).LayoutLine() );
+    
+    TAknLayoutRect listLayoutRect2;
+    listLayoutRect2.LayoutRect(
+    		listLayoutRect1.Rect(),
+    		AknLayoutScalable_Apps::phob2_cc_list_pane(0).LayoutLine() );
+    
+    TAknLayoutRect listLayoutRect3;
+    listLayoutRect3.LayoutRect(
+    		listLayoutRect2.Rect(),
+    		AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane(0).LayoutLine() );
+            
+    TAknLayoutRect listLayoutRect4;
+    listLayoutRect4.LayoutRect(
+            listLayoutRect3.Rect(),
+            AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g1(0).LayoutLine() );
+    
+    TSize size(listLayoutRect4.Rect().Size());   
+    
+    return size;                                                    
+    }
 // ---------------------------------------------------------------------------
 // CCCAppCommLauncherLPadModel::HandleNotifyChange
 // ---------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/bld.inf	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/bld.inf	Wed Mar 31 21:13:53 2010 +0300
@@ -25,7 +25,7 @@
 PRJ_TESTEXPORTS
 // NOTE: If using ARS requirements all export operations should be done under this.
 // 'abld test export'
-
+../init/ut_commlaunchercontacthandler.ini      /epoc32/winscw/c/TestFramework/ut_commlaunchercontacthandler.ini
 PRJ_EXPORTS
 // Specify the source file followed by its destination here
 // copy will be used to copy the source file to its destination
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/ut_commlaunchercontacthandler.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/group/ut_commlaunchercontacthandler.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -31,17 +31,20 @@
 SOURCE          t_commlaunchercontacthandlerCases.cpp
 SOURCE          t_testsingleton.cpp
 SOURCE          t_ccappcmscontactfetcher.cpp
+SOURCE          ccappcommlauncherheaders.cpp
 
 // tested class
 SOURCE          ../../../src/ccappcommlaunchercontacthandler.cpp
 
 
 USERINCLUDE     ../inc 
-
+USERINCLUDE     ../../../../../../../ccservices/cmsservices/cmsengine/inc
+USERINCLUDE     ../../../../../../phonebook/inc
 
 APP_LAYER_SYSTEMINCLUDE 
 SYSTEMINCLUDE   /epoc32/include/ecom
 SYSTEMINCLUDE   ../../../../inc
+SYSTEMINCLUDE   ../../../../../inc 
 
 
 LIBRARY         euser.lib
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/ccappcommlauncherheaders.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/ccappcommlauncherheaders.h	Wed Mar 31 21:13:53 2010 +0300
@@ -21,14 +21,15 @@
 
 // logfile definition
 #define KCommLauncherLogFile CCA_L("commlauncherplugin.txt")
-#include "ccalogger.h"
 
 #include <e32base.h>
 #include <centralrepository.h>
 #include <vpbkfieldtypeselectorfactory.h>
 
+#include "ccalogger.h"
 #include "t_ccappcmscontactfetcher.h"
 #include "t_testsingleton.h"
+#include "phonebookPrivateCRKeys.h"
 
 class CCmsContactFieldInfo;
 class MCCAppContactFieldDataObserver;
@@ -47,10 +48,10 @@
 const TInt KTestContactInfoNull = 1;
 _LIT8( KTestString, "TestString" );
 
-////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // MCCAppContactFieldDataObserver
-// Dummy interface
-////////////////////////////////////////////////
+// dummy class
+// -----------------------------------------------------------------------------
 class MCCAppContactFieldDataObserver
     {
 public:
@@ -89,10 +90,10 @@
 
     };    
 
-////////////////////////////////////////////////
-// CCmsContactField
-// Dummy class
-////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
+// CCmsContactFieldItem
+// dummy class
+// -----------------------------------------------------------------------------
 class CCmsContactFieldItem : public CBase
     {
     public:  
@@ -202,171 +203,50 @@
             ECmsDefaultTypeUrl = 512
             };
         
-        TPtrC Data() const {};
+        const TPtrC Data() const {return KNullDesC.operator ()().Left(0);}
     };
 
-////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // CCmsContactField
-// Dummy class
-////////////////////////////////////////////////
+// dummy class
+// -----------------------------------------------------------------------------
 class CCmsContactField : public CBase
     {
 public:
 
-    CCmsContactField( TInt aType )
-        {
-        iType = aType;
-        };
-
-    const CCmsContactFieldItem& ItemL( TInt /*aIndex*/) const {};    
+    CCmsContactField( TInt aType ):iType(aType){}
+    const CCmsContactFieldItem& ItemL( TInt /*aIndex*/) const;
+    CCmsContactFieldItem::TCmsContactField Type() const;
+    TInt ItemCount() const{ return 1; }
+    TInt HasDefaultAttribute() const;
     
-    CCmsContactFieldItem::TCmsContactField Type() const
-        {
-        switch ( iType )
-            {
-            // phone
-            case PHONE:
-                {
-                return CCmsContactFieldItem::ECmsLandPhoneHome;
-                break;
-                }
-            // email
-            case EMAIL:
-                {
-                return CCmsContactFieldItem::ECmsEmailWork;
-                break;
-                }
-           // voip
-            case VOIP:
-                {
-                return CCmsContactFieldItem::ECmsVoipNumberHome;
-                break;
-                }
-            // phone
-            case PHONE2:
-                {
-                return CCmsContactFieldItem::ECmsMobilePhoneHome;
-                break;
-                }
-            // email
-            case EMAIL2:
-                {
-                return CCmsContactFieldItem::ECmsEmailGeneric;
-                break;
-                }
-           // voip
-            case VOIP2:
-                {
-                return CCmsContactFieldItem::ECmsVoipNumberWork;
-                break;
-                }
-            // name
-            case NAME:
-                {
-                return CCmsContactFieldItem::ECmsLastName;
-                break;
-                }
-            // default phone
-            default:
-                {
-                return CCmsContactFieldItem::ECmsMobilePhoneWork;
-                break;
-                }
-            }
-        };
-    TInt ItemCount() const
-        {
-        return 1;
-        };
-
-    TInt HasDefaultAttribute() const 
-        { 
-        TInt ret ( KErrNotFound );
-        switch ( iType )
-            {
-            // phone
-            case PHONE:
-                {
-                ret = CCmsContactFieldItem::ECmsDefaultTypePhoneNumber;
-                break;
-                }
-            // email
-            case EMAIL:
-                {
-                ret = CCmsContactFieldItem::ECmsDefaultTypeEmail;
-                break;
-                }
-            // voip
-            case VOIP:
-                {
-                ret = CCmsContactFieldItem::ECmsDefaultTypeVoIP;
-                break;
-                }
-           // mms
-            default:
-                {
-                ret = CCmsContactFieldItem::ECmsDefaultTypeMms;
-                break;
-                }
-            }
-
-        return ret;
-        };
-
+public: // data
     TInt iDummyDefaultAttributeBitMask;
     TInt iDummy;
     TInt iType;
+    CCmsContactFieldItem* iCmsContactFieldItem;
     };
 
-    
-////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // CCmsContactFieldInfo
-// Dummy class
-////////////////////////////////////////////////
+// dummy class
+// -----------------------------------------------------------------------------
 class CCmsContactFieldInfo : public CBase
     {
 public:
-    static CCmsContactFieldInfo* NewL()
-        {
-        CCmsContactFieldInfo* self = new (ELeave) CCmsContactFieldInfo();
-        self->ConstructL();
-        return self;
-        };
-    void ConstructL()
-        {
-        iArray = new (ELeave) RArray<CCmsContactFieldItem::TCmsContactField>();
-        // phone
-        iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneHome );
-        // email
-        iArray->Append( CCmsContactFieldItem::ECmsEmailWork );
-        // voip
-        iArray->Append( CCmsContactFieldItem::ECmsVoipNumberHome );
-        // not number
-        iArray->Append( CCmsContactFieldItem::ECmsLastName );
-        };
-       
-    void AddMoreFields()
-        {
-        // phone
-        iArray->Append( CCmsContactFieldItem::ECmsLandPhoneHome );
-        iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneGeneric );
-        iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneHome );
-        // email
-        iArray->Append( CCmsContactFieldItem::ECmsEmailGeneric );
-        iArray->Append( CCmsContactFieldItem::ECmsEmailHome );
-        // voip
-        iArray->Append( CCmsContactFieldItem::ECmsVoipNumberWork );
-        // im
-        iArray->Append( CCmsContactFieldItem::ECmsImpp );
-        // url
-        iArray->Append( CCmsContactFieldItem::ECmsUrlHome );
-        }; 
-    const RArray<CCmsContactFieldItem::TCmsContactField>& Fields() const { return *iArray; };
-    ~CCmsContactFieldInfo()
-        {
-        iArray->Close();
-        delete iArray;
-        };
+    virtual ~CCmsContactFieldInfo();
+    static CCmsContactFieldInfo* NewL();
+    
+    void AddMoreFields(); 
+    const RArray<CCmsContactFieldItem::TCmsContactField>& Fields() const 
+            { 
+            return *iArray;
+            }
+private:
+    CCmsContactFieldInfo(){}
+    void ConstructL();
+    
+public: // data
     TInt iDummy;
     RArray<CCmsContactFieldItem::TCmsContactField>* iArray;
     };
@@ -374,17 +254,17 @@
 #include "../../../inc/ccappcommlauncherprivatecrkeys.h"
 #include "../../../inc/ccappcommlaunchercontacthandler.h"
    
-////////////////////////////////////////////////
+
+// -----------------------------------------------------------------------------
 // CCCAppCommLauncherView
-// Dummy class
-////////////////////////////////////////////////
-class CCCAppCommLauncherView : 
-    public CBase,
-    public MCCAppContactHandlerNotifier
+// dummy class
+// -----------------------------------------------------------------------------
+class CCCAppCommLauncherView : public CBase,
+                               public MCCAppContactHandlerNotifier
     {
 public:
 
-    CCCAppCommLauncherView( /*CCCAppCommLauncherPlugin& aPlugin*/ ) /*: iPlugin( &aPlugin )*/
+    CCCAppCommLauncherView( /*CCCAppCommLauncherPlugin& aPlugin*/ )
         {
         iContactChangedNotifyCalled = EFalse;
         iContactEnabledFieldsChangedNotifyCalled = EFalse;
@@ -415,7 +295,7 @@
     // MCCAppContactHandlerNotifier
     void ContactsChangedL(){};
     // MCCAppContactHandlerNotifier
-    void ContactPresenceChangedL( const CCmsContactField& /*aContactField*/){};
+    void ContactPresenceChangedL( const CCmsContactField& /*aContactField*/){}
         
     TBool ContactChangedNotifyCalled()
         {
@@ -431,41 +311,26 @@
         iContactEnabledFieldsChangedNotifyCalled = EFalse;
         };
     
-    //CCCAppCommLauncherPlugin& Plugin(){ return *iPlugin; };        
-
-    //CCCAppCommLauncherPlugin* iPlugin;
+public: // data
     TBool iContactChangedNotifyCalled;
     TBool iContactEnabledFieldsChangedNotifyCalled;
-    };    
+    };
 
-////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // CCCAppCommLauncherPlugin
-// Dummy class
-////////////////////////////////////////////////
-class CCCAppCommLauncherPlugin : 
-    public CBase
+// dummy class
+// -----------------------------------------------------------------------------
+class CCCAppCommLauncherPlugin : public CBase
     {
-
 public:
     
-    CCCAppCommLauncherPlugin()
-    {      
-    };
-    
-    ~CCCAppCommLauncherPlugin() 
-    {      
-    };
-    
-    /*
-     * Sets the title to the plugin
-     * @param aTitle - title to be set     
-     */
-    void SetTitleL( const TDesC& aTitle )
-    {      
+    CCCAppCommLauncherPlugin(){}
+    ~CCCAppCommLauncherPlugin(){}
+    static CCCAppCommLauncherPlugin* NewL();
+public:
+    void SetTitleL( const TDesC& /*aTitle*/ ){}
+
     };
 
-    };
-    
-    
-    
+
 #endif // __CCAPPCOMMLAUNCHERHEADERS_H__
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_ccappcmscontactfetcher.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_ccappcmscontactfetcher.h	Wed Mar 31 21:13:53 2010 +0300
@@ -46,7 +46,11 @@
     //ECmsPackedContactLink,
     //ECmsContactId
     };
+
+// -----------------------------------------------------------------------------
+// CCCAppCmsContactFetcherWrapper
 // dummy class
+// -----------------------------------------------------------------------------
 class CCCAppCmsContactFetcherWrapper : public CBase
     {
 public:
@@ -93,10 +97,13 @@
             VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction);
     
     virtual void RefetchContactL();
+    TBool CCCAppCmsContactFetcherWrapper::IsTopContact();
+        
     RPointerArray<MCCAppContactFieldDataObserver> iObservers;
     CCmsContactFieldInfo* iContactFieldInfo;
     RPointerArray<CCmsContactField> iFieldArray;
     TBool iContactStore_called;
+    TBool iTopContact;
     };    
     
     
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_commlaunchercontacthandler.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/inc/t_commlaunchercontacthandler.h	Wed Mar 31 21:13:53 2010 +0300
@@ -284,9 +284,9 @@
         
         TInt TestContactFieldDataObserverNotifyL ( TTestResult& aResult );
         
-        //TInt TestCalculationAndGettersL ( TTestResult& aResult );
+        TInt TestCalculationAndGettersL ( TTestResult& aResult );
         
-        //TInt TestUpdatesL( TTestResult& aResult );
+        TInt TestUpdatesL( TTestResult& aResult );
         
         TInt TestDefaultAttributesL( TTestResult& aResult );
         
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/ccappcommlauncherheaders.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2007-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: implementation to help unit testing
+*/
+
+
+#include "ccappcommlauncherheaders.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
+const CCmsContactFieldItem& CCmsContactField::ItemL( TInt /*aIndex*/) const 
+    {
+    // (*NULL) was allowed by symbian.So its didn't crash. 
+    return *iCmsContactFieldItem;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::Type()
+// -----------------------------------------------------------------------------
+//
+CCmsContactFieldItem::TCmsContactField CCmsContactField::Type() const
+    {
+    CCmsContactFieldItem::TCmsContactField ret = 
+            CCmsContactFieldItem::ECmsMobilePhoneWork;;
+    switch ( iType )
+        {
+        // phone
+        case PHONE:
+            {
+            ret = CCmsContactFieldItem::ECmsLandPhoneHome;
+            break;
+            }
+        // email
+        case EMAIL:
+            {
+            ret = CCmsContactFieldItem::ECmsEmailWork;
+            break;
+            }
+       // voip
+        case VOIP:
+            {
+            ret = CCmsContactFieldItem::ECmsVoipNumberHome;
+            break;
+            }
+        // phone
+        case PHONE2:
+            {
+            ret = CCmsContactFieldItem::ECmsMobilePhoneHome;
+            break;
+            }
+        // email
+        case EMAIL2:
+            {
+            ret = CCmsContactFieldItem::ECmsEmailGeneric;
+            break;
+            }
+       // voip
+        case VOIP2:
+            {
+            ret = CCmsContactFieldItem::ECmsVoipNumberWork;
+            break;
+            }
+        // name
+        case NAME:
+            {
+            ret = CCmsContactFieldItem::ECmsLastName;
+            break;
+            }
+        // default phone
+        default:
+            {
+            ret = CCmsContactFieldItem::ECmsMobilePhoneWork;
+            break;
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::HasDefaultAttribute()
+// -----------------------------------------------------------------------------
+//
+TInt CCmsContactField::HasDefaultAttribute() const
+    { 
+    TInt ret ( KErrNotFound );
+    switch ( iType )
+        {
+        // phone
+        case PHONE:
+            {
+            ret = CCmsContactFieldItem::ECmsDefaultTypePhoneNumber;
+            break;
+            }
+        // email
+        case EMAIL:
+            {
+            ret = CCmsContactFieldItem::ECmsDefaultTypeEmail;
+            break;
+            }
+        // voip
+        case VOIP:
+            {
+            ret = CCmsContactFieldItem::ECmsDefaultTypeVoIP;
+            break;
+            }
+       // mms
+        default:
+            {
+            ret = CCmsContactFieldItem::ECmsDefaultTypeMms;
+            break;
+            }
+        }
+
+    return ret;
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactFieldInfo::~CCmsContactFieldInfo()
+// -----------------------------------------------------------------------------
+//
+CCmsContactFieldInfo::~CCmsContactFieldInfo()
+    {
+    iArray->Close();
+    delete iArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactFieldInfo::NewL()
+// -----------------------------------------------------------------------------
+//
+CCmsContactFieldInfo* CCmsContactFieldInfo::NewL()
+    {
+    CCmsContactFieldInfo* self = new (ELeave) CCmsContactFieldInfo();
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactFieldInfo::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CCmsContactFieldInfo::ConstructL()
+    {
+    iArray = new (ELeave) RArray<CCmsContactFieldItem::TCmsContactField>();
+    // phone
+    iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneHome );
+    // email
+    iArray->Append( CCmsContactFieldItem::ECmsEmailWork );
+    // voip
+    iArray->Append( CCmsContactFieldItem::ECmsVoipNumberHome );
+    // not number
+    iArray->Append( CCmsContactFieldItem::ECmsLastName );
+    }
+
+// -----------------------------------------------------------------------------
+// CCmsContactFieldInfo::AddMoreFields()
+// -----------------------------------------------------------------------------
+//
+void CCmsContactFieldInfo::AddMoreFields()
+    {
+    // phone
+    iArray->Append( CCmsContactFieldItem::ECmsLandPhoneHome );
+    iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneGeneric );
+    iArray->Append( CCmsContactFieldItem::ECmsMobilePhoneHome );
+    // email
+    iArray->Append( CCmsContactFieldItem::ECmsEmailGeneric );
+    iArray->Append( CCmsContactFieldItem::ECmsEmailHome );
+    // voip
+    iArray->Append( CCmsContactFieldItem::ECmsVoipNumberWork );
+    // im
+    iArray->Append( CCmsContactFieldItem::ECmsImpp );
+    // url
+    iArray->Append( CCmsContactFieldItem::ECmsUrlHome );
+    }
+
+// -----------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::NewL()
+// -----------------------------------------------------------------------------
+//
+CCCAppCommLauncherPlugin* CCCAppCommLauncherPlugin::NewL()
+    {
+    CCCAppCommLauncherPlugin* self = new(ELeave)CCCAppCommLauncherPlugin();
+    return self;
+    }
+
+//  End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_ccappcmscontactfetcher.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_ccappcmscontactfetcher.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -14,22 +14,36 @@
 * Description:
 *
 */
+
+
 #include "ccappcommlauncherheaders.h"
 
-//#include "t_ccappcmscontactfetcher.h"
-// dummy class
+
+// ============================ MEMBER FUNCTIONS ===============================
 
-
-CCCAppCmsContactFetcherWrapper::CCCAppCmsContactFetcherWrapper( ) 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
+CCCAppCmsContactFetcherWrapper::CCCAppCmsContactFetcherWrapper( ):iTopContact(ETrue) 
     {
     }
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 void CCCAppCmsContactFetcherWrapper::ConstructL( ) 
     {
     iContactFieldInfo = CCmsContactFieldInfo::NewL();
     CCmsContactField* field = new (ELeave) CCmsContactField( PHONE );
     iFieldArray.Append( field );
     }
-    
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 CCCAppCmsContactFetcherWrapper::~CCCAppCmsContactFetcherWrapper( ) 
     {
     delete iContactFieldInfo;
@@ -37,6 +51,10 @@
     iFieldArray.ResetAndDestroy();
     }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL( CCCAParameter* /*aParameter*/ )
         {
         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper( );
@@ -45,7 +63,11 @@
         CleanupStack::Pop( self );
         return self;
         }
-       
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 CCCAppCmsContactFetcherWrapper* CCCAppCmsContactFetcherWrapper::InstanceL()
         {
         CCCAppCmsContactFetcherWrapper* self = new (ELeave) CCCAppCmsContactFetcherWrapper(  );
@@ -56,11 +78,19 @@
         //return NULL;
         }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 void CCCAppCmsContactFetcherWrapper::Release()
         {
         delete this;
         } 
-        
+
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 const CCmsContactFieldInfo* CCCAppCmsContactFetcherWrapper::ContactInfo()
         {
         T_CTestSingleton* singleton = T_CTestSingleton::InstanceL();
@@ -75,11 +105,19 @@
         return iContactFieldInfo;
         }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 RPointerArray<CCmsContactField>& CCCAppCmsContactFetcherWrapper::ContactFieldDataArray()
         {
         return iFieldArray;
         }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 HBufC8* CCCAppCmsContactFetcherWrapper::ContactIdentifierLC( 
         const TCmsContactIdentifierType /*aIdType = ECmsPackedContactLinkArray*/ )
         {
@@ -88,6 +126,10 @@
         return buf;
         }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 void CCCAppCmsContactFetcherWrapper::AddObserverL( MCCAppContactFieldDataObserver& aObserver )
     {
     const TInt index = iObservers.Find( &aObserver );
@@ -97,6 +139,10 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 void CCCAppCmsContactFetcherWrapper::RemoveObserver( MCCAppContactFieldDataObserver& aObserver )
     {
     const TInt index = iObservers.Find( &aObserver );
@@ -106,26 +152,51 @@
         }
     }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 TBool CCCAppCmsContactFetcherWrapper::IsServiceAvailable(
     VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction */)
     {
     return ETrue;//iCmsContactDataFetcher.IsServiceAvailable( aContactAction );
     }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 TCmsContactStore CCCAppCmsContactFetcherWrapper::ContactStore() const
     {
     const_cast<TBool&>(iContactStore_called) = ETrue;
+    return ECmsContactStorePbk;
     }
 
-
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 TInt CCCAppCmsContactFetcherWrapper::GetContactActionFieldCount(
-        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/)
+        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/ )
     {
     return ETrue; //iCmsContactDataFetcher.GetContactActionFieldCount(aContactAction);
     }
 
+// -----------------------------------------------------------------------------
+// CCmsContactField::ItemL()
+// -----------------------------------------------------------------------------
+//
 void CCCAppCmsContactFetcherWrapper::RefetchContactL()
     {
     
     }
-  
+
+// -----------------------------------------------------------------------------
+// CCCAppCmsContactFetcherWrapper::IsTopContact()
+// -----------------------------------------------------------------------------
+//
+TBool CCCAppCmsContactFetcherWrapper::IsTopContact()
+       {
+       return iTopContact;
+       }
+//  End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandler.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandler.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -175,10 +175,10 @@
     TTestResult& aResult )
     {
     if(!iVersionLogged)
-    	{
-    	SendTestModuleVersion();
-    	iVersionLogged = ETrue;
-    	}
+        {
+        SendTestModuleVersion();
+        iVersionLogged = ETrue;
+        }
     
     // Return value
     TInt execStatus = KErrNone;
@@ -319,17 +319,17 @@
 //-----------------------------------------------------------------------------
 //
 void T_CCCAppCommLauncherContactHandler::SendTestModuleVersion()
-	{
-	TVersion moduleVersion;
-	moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
-	moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
-	moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
-	
-	TFileName moduleName;
-	moduleName = _L("t_commlaunchercontacthandler.dll");
+    {
+    TVersion moduleVersion;
+    moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
+    moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
+    moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
+    
+    TFileName moduleName;
+    moduleName = _L("t_commlaunchercontacthandler.dll");
 
-	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName);
-	}
+    TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName);
+    }
 
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandlerCases.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/tsrc/ut_commlaunchercontacthandler/src/t_commlaunchercontacthandlerCases.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -92,16 +92,23 @@
         // gives errors.
         
         FUNCENTRY( T_CCCAppCommLauncherContactHandler::PrintTest ),
-        //ENTRY( "Loop test", T_CCCAppCommLauncherContactHandler::LoopTest ),
+        ENTRY( "Loop test", T_CCCAppCommLauncherContactHandler::LoopTest ),
         ENTRY( "CreateAndDelete", T_CCCAppCommLauncherContactHandler::TestNewL ),
-        ENTRY( "RequestContactDataL", T_CCCAppCommLauncherContactHandler::TestRequestContactDataL ),
-        ENTRY( "ContactFieldDataObserverNotifyL", TestContactFieldDataObserverNotifyL ),
-        //ENTRY( "CalculationAndGetters", TestCalculationAndGettersL ), Seems to be not valid any more
-        //ENTRY( "Updates", TestUpdatesL ),Seems to be not valid any more
+        ENTRY( "RequestContactDataL", 
+                T_CCCAppCommLauncherContactHandler::TestRequestContactDataL ),
+        ENTRY( "ContactFieldDataObserverNotifyL", 
+                TestContactFieldDataObserverNotifyL ),
+        // Seems to be not valid any more
+        ENTRY( "CalculationAndGetters", 
+                T_CCCAppCommLauncherContactHandler::TestCalculationAndGettersL ),
+        // Seems to be not valid any more
+        ENTRY( "Updates", 
+                T_CCCAppCommLauncherContactHandler::TestUpdatesL ),
         ENTRY( "DefaultAttributes", TestDefaultAttributesL ),
         ENTRY( "TestContactStoreApiL", TestContactStoreApiL ),
         // Example how to use OOM functionality
-        //OOM_ENTRY( "Loop test with OOM", T_CCCAppCommLauncherContactHandler::LoopTest, ETrue, 2, 3),
+        //OOM_ENTRY( "Loop test with OOM", 
+        //        T_CCCAppCommLauncherContactHandler::LoopTest, ETrue, 2, 3),
         //OOM_FUNCENTRY( T_CCCAppCommLauncherContactHandler::PrintTest, ETrue, 1, 3 ),
         };
 
@@ -133,7 +140,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCAppCommLauncherContactHandler::TestRequestContactDataL( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestRequestContactDataL( 
+        TTestResult& aResult )
     {
     
     CCCAppCommLauncherPlugin* plugin =
@@ -141,7 +149,8 @@
     CleanupStack::PushL( plugin );
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
     
     T_CTestSingleton* singleton = T_CTestSingleton::InstanceL();
@@ -173,14 +182,16 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCAppCommLauncherContactHandler::TestContactFieldDataObserverNotifyL ( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestContactFieldDataObserverNotifyL ( 
+        TTestResult& aResult )
     {
     CCCAppCommLauncherPlugin* plugin =
                 new (ELeave) CCCAppCommLauncherPlugin;
     CleanupStack::PushL( plugin );
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
    
     CCmsContactFieldInfo* contactInfo = CCmsContactFieldInfo::NewL();
@@ -188,11 +199,13 @@
     CCmsContactField* contactField = new (ELeave) CCmsContactField ( VOIP );
     CleanupStack::PushL( contactField );
    
-    MCCAppContactFieldDataObserver::TParameter param = MCCAppContactFieldDataObserver::TParameter();
+    MCCAppContactFieldDataObserver::TParameter param = 
+            MCCAppContactFieldDataObserver::TParameter();
     handler->ContactFieldDataObserverNotifyL( param );
 
     view->ResetVariables();
-    param.iType = MCCAppContactFieldDataObserver::TParameter::EContactInfoAvailable;
+    param.iType = 
+            MCCAppContactFieldDataObserver::TParameter::EContactInfoAvailable;
     handler->ContactFieldDataObserverNotifyL( param );
     TL( EFalse == view->ContactEnabledFieldsChangedNotifyCalled() );
     
@@ -202,7 +215,8 @@
     TL( view->ContactEnabledFieldsChangedNotifyCalled() );
     
     view->ResetVariables();
-    param.iType = MCCAppContactFieldDataObserver::TParameter::EContactDataFieldAvailable;
+    param.iType = 
+        MCCAppContactFieldDataObserver::TParameter::EContactDataFieldAvailable;
     handler->ContactFieldDataObserverNotifyL( param );
     TL( EFalse == view->ContactChangedNotifyCalled() );
     
@@ -301,7 +315,8 @@
     CleanupStack::PushL( plugin );
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
     CleanupStack::PopAndDestroy( 3 );
     __UHEAP_MARKEND;
@@ -310,14 +325,16 @@
     __UHEAP_MARK;
     CCCAppCommLauncherPlugin* plugin1 =
                 new (ELeave) CCCAppCommLauncherPlugin;
-    CleanupStack::PushL( plugin );
+    CleanupStack::PushL( plugin1 );
     CCCAppCommLauncherView* view2 = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view2 );
-    CCCAppCommLauncherContactHandler* handler2 = CCCAppCommLauncherContactHandler::NewL( *view2, *plugin1 );
+    CCCAppCommLauncherContactHandler* handler2 = 
+            CCCAppCommLauncherContactHandler::NewL( *view2, *plugin1 );
     CleanupStack::PushL( handler2 );
     CleanupStack::Pop( 3 );
     delete view2;
     delete handler2;
+    delete plugin1;
     __UHEAP_MARKEND;
     
     // Sets test case result and description(Maximum size is KStifMaxResultDes)
@@ -334,39 +351,44 @@
 //
 // -----------------------------------------------------------------------------
 //
-/*TInt T_CCCAppCommLauncherContactHandler::TestCalculationAndGettersL( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestCalculationAndGettersL( 
+        TTestResult& aResult )
     {
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view );
+    CCCAppCommLauncherPlugin *plugin = CCCAppCommLauncherPlugin::NewL();
+    CleanupStack::PushL( plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
     
     handler->ContactFieldDataObserverHandleErrorL( 1, -3 );
     
-    CCmsContactFieldInfo* fieldInfo = CCmsContactFieldInfo::NewL();
-    CleanupStack::PushL( fieldInfo );
-    
-    handler->CalculateAddressAmountsFromEnabledFields( *fieldInfo );
-    
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    T1L( 2, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EUniEditorSelector ));
-    fieldInfo->AddMoreFields();
-    
-    handler->CalculateAddressAmountsFromEnabledFields( *fieldInfo );
-    
-    T1L( 4, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 3, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 2, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    T1L( 6, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EUniEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EURLSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EURLSelector ));
     
     RPointerArray<CCmsContactField> array = handler->ContactFieldDataArray();
     T1L( 1, array.Count( ) );
     
-    HBufC8* test = handler->ContactIdentifierLC( ECmsPackedContactLinkArray );
+    HBufC8* test = handler->ContactIdentifierLC();
     T1L( 0, test->Compare( KTestString ) );
     CleanupStack::PopAndDestroy( test );
     
@@ -378,117 +400,119 @@
     // Case was executed
     return KErrNone;
     }  
-    */
+
 // -----------------------------------------------------------------------------
 // T_CCCAppCommLauncherContactHandler::TestUpdatesL
 //
 // -----------------------------------------------------------------------------
 //
-/*TInt T_CCCAppCommLauncherContactHandler::TestUpdatesL( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestUpdatesL( TTestResult& aResult )
     {
 
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view );
+    CCCAppCommLauncherPlugin *plugin = CCCAppCommLauncherPlugin::NewL();
+    CleanupStack::PushL( plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
-    
-    CCmsContactFieldInfo* fieldInfo = CCmsContactFieldInfo::NewL();
-    CleanupStack::PushL( fieldInfo );
-    handler->CalculateAddressAmountsFromEnabledFields( *fieldInfo );
 
-    CCmsContactField* emailField = new (ELeave) CCmsContactField ( EMAIL );
-    CleanupStack::PushL( emailField );
-    handler->UpdateAddressAmounts( *emailField );
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( emailField );
-    
-    CCmsContactField* phoneField = new (ELeave) CCmsContactField ( PHONE );
-    CleanupStack::PushL( phoneField );
-    handler->UpdateAddressAmounts( *phoneField );
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( phoneField );
-    
-    CCmsContactField* voipField = new (ELeave) CCmsContactField ( VOIP );
-    CleanupStack::PushL( voipField );
-    handler->UpdateAddressAmounts( *voipField );
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( voipField );
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
     
-    CCmsContactField* emailField2 = new (ELeave) CCmsContactField ( EMAIL2 );
-    CleanupStack::PushL( emailField2 );    
-    handler->UpdateAddressAmounts( *emailField2 );
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( emailField2 );
-    
-    CCmsContactField* phoneField2 = new (ELeave) CCmsContactField ( PHONE2 );
-    CleanupStack::PushL( phoneField2 );   
-    handler->UpdateAddressAmounts( *phoneField2 );   
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( phoneField2 );
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount(
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
     
-    CCmsContactField* voipField2 = new (ELeave) CCmsContactField ( VOIP2 );
-    CleanupStack::PushL( voipField2 );    
-    handler->UpdateAddressAmounts( *voipField2 );  
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( voipField2 );
-    
-    CCmsContactField* name = new (ELeave) CCmsContactField ( NAME );
-    CleanupStack::PushL( name );
-    handler->UpdateAddressAmounts( *name );    
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
-    T1L( 1, handler->AddressAmount( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
-    CleanupStack::PopAndDestroy( name );
-    
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ));
+    T1L( 1, handler->AddressAmount( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ));
+
     CleanupStack::PopAndDestroy( 3 );
 
-    _LIT( KDescription, "TestCalculationAndGettersL passed" );
+    _LIT( KDescription, "TestUpdatesL passed" );
     aResult.SetResult( KErrNone, KDescription );
 
     // Case was executed
     return KErrNone;
     } 
-    */
+
 // -----------------------------------------------------------------------------
 // T_CCCAppCommLauncherContactHandler::TestDefaultAttributesL
 //
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCAppCommLauncherContactHandler::TestDefaultAttributesL( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestDefaultAttributesL( 
+        TTestResult& aResult )
     {
     CCCAppCommLauncherPlugin* plugin =
                 new (ELeave) CCCAppCommLauncherPlugin;
     CleanupStack::PushL( plugin );
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
     
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
                 
     CCmsContactField* emailField = new (ELeave) CCmsContactField ( EMAIL );
     CleanupStack::PushL( emailField );
     handler->UpdateDefaultAttributes( *emailField );
     
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
     
     CleanupStack::PopAndDestroy( emailField );
     
@@ -496,10 +520,14 @@
     CleanupStack::PushL( voipField );
     handler->UpdateDefaultAttributes( *voipField );
     
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
     
     CleanupStack::PopAndDestroy( voipField );
     
@@ -507,10 +535,14 @@
     CleanupStack::PushL( phoneField );
     handler->UpdateDefaultAttributes( *phoneField );
     
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
-    TL( EFalse == handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
+    TL( EFalse == handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
     
     CleanupStack::PopAndDestroy( phoneField );
     
@@ -518,16 +550,20 @@
     CleanupStack::PushL( mmsField );
     handler->UpdateDefaultAttributes( *mmsField );
     
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
-    TL( handler->HasDefaultAttribute( VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EUniEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) );
+    TL( handler->HasDefaultAttribute( 
+            VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) );
     
     CleanupStack::PopAndDestroy( mmsField );
     
     CleanupStack::PopAndDestroy( 3 );
 
-    _LIT( KDescription, "TestCalculationAndGettersL passed" );
+    _LIT( KDescription, "TestDefaultAttributesL passed" );
     aResult.SetResult( KErrNone, KDescription );
 
     // Case was executed
@@ -539,7 +575,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCAppCommLauncherContactHandler::TestContactStoreApiL( TTestResult& aResult )
+TInt T_CCCAppCommLauncherContactHandler::TestContactStoreApiL( 
+        TTestResult& aResult )
     {
     // setup
     CCCAppCommLauncherPlugin* plugin =
@@ -547,7 +584,8 @@
     CleanupStack::PushL( plugin );
     CCCAppCommLauncherView* view = CCCAppCommLauncherView::NewL();
     CleanupStack::PushL( view );
-    CCCAppCommLauncherContactHandler* handler = CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
+    CCCAppCommLauncherContactHandler* handler = 
+            CCCAppCommLauncherContactHandler::NewL( *view, *plugin );
     CleanupStack::PushL( handler );
     
     // test itself
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/bwins/ccacontactorserviceu.def	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/bwins/ccacontactorserviceu.def	Wed Mar 31 21:13:53 2010 +0300
@@ -1,5 +1,6 @@
 EXPORTS
 	?ExecuteServiceL@CCAContactorService@@QAEXABVTCSParameter@1@@Z @ 1 NONAME ; void CCAContactorService::ExecuteServiceL(class CCAContactorService::TCSParameter const &)
-	?NewL@CCAContactorService@@SAPAV1@XZ @ 2 NONAME ; class CCAContactorService * CCAContactorService::NewL(void)
-	?IsBusy@CCAContactorService@@QBEHXZ @ 3 NONAME ; int CCAContactorService::IsBusy(void) const
+	?IsSelected@CCAContactorService@@QBEHXZ @ 2 NONAME ; int CCAContactorService::IsSelected(void) const
+	?NewL@CCAContactorService@@SAPAV1@XZ @ 3 NONAME ; class CCAContactorService * CCAContactorService::NewL(void)
+	?IsBusy@CCAContactorService@@QBEHXZ @ 4 NONAME ; int CCAContactorService::IsBusy(void) const
 
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/eabi/ccacontactorserviceu.def	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/eabi/ccacontactorserviceu.def	Wed Mar 31 21:13:53 2010 +0300
@@ -1,5 +1,8 @@
 EXPORTS
 	_ZN19CCAContactorService15ExecuteServiceLERKNS_12TCSParameterE @ 1 NONAME
 	_ZN19CCAContactorService4NewLEv @ 2 NONAME
-	_ZNK19CCAContactorService6IsBusyEv @ 3 NONAME
+	_ZNK19CCAContactorService10IsSelectedEv @ 3 NONAME
+	_ZNK19CCAContactorService6IsBusyEv @ 4 NONAME
+	_ZTI30CCmsContactorImPluginParameter @ 5 NONAME
+	_ZTV30CCmsContactorImPluginParameter @ 6 NONAME
 
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorservice.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorservice.h	Wed Mar 31 21:13:53 2010 +0300
@@ -198,6 +198,11 @@
      * Is contactor service busy.
      */
     IMPORT_C TBool IsBusy() const;
+    
+   /**
+    * Is call item selected.
+    */
+    IMPORT_C TBool IsSelected() const;
 
 private:
     /**
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorserviceoperator.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorserviceoperator.h	Wed Mar 31 21:13:53 2010 +0300
@@ -63,7 +63,13 @@
      * @since S60 5.0
      */
     void Execute(const CCAContactorService::TCSParameter& aParameter);
-
+    
+    /**
+     * Is call item selected
+     * 
+     * @since S60 5.0
+     */
+    TBool IsSelected();
 private:
     /**
      * Constructor.
@@ -157,6 +163,12 @@
      * Own.
      */
     TUint32 iServiceId;
+    
+    /**
+     * Is call item selected
+     * Own
+     */
+    TBool isSelected;
     };
 
 #endif // C_CCACONTACTORSERVICEHANDLER_H
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorservice.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorservice.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -89,4 +89,12 @@
     return iCommandIsBeingHandled;
     }
 
+// --------------------------------------------------------------------------
+// CCAContactorService::IsSelected
+// --------------------------------------------------------------------------
+//
+EXPORT_C TBool CCAContactorService::IsSelected() const
+    {
+    return iOperator->IsSelected();
+    }
 // End of file
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorserviceoperator.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorserviceoperator.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -104,6 +104,11 @@
             CommunicationEnumMapper(iParameter->iCommTypeSelector),
             useDefaults));
         
+        if (result != NULL)
+        	{
+        	isSelected = ETrue;
+        	}
+        
         if (KErrNone != err)
             {
             CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::ExecuteL: LaunchPopupL: Leaves %d."), err);
@@ -138,12 +143,18 @@
     CCA_DP(KCCAContactorServiceLoggerFile, CCA_L("CCCAContactorServiceOperator::Execute: Done."));
     }
 
+
+TBool CCCAContactorServiceOperator::IsSelected()
+	{
+	return isSelected;
+	}
 // --------------------------------------------------------------------------
 // CCCAContactorServiceOperator::CCCAContactorServiceOperator
 // --------------------------------------------------------------------------
 //
 CCCAContactorServiceOperator::CCCAContactorServiceOperator():
-    iServiceId((TUint32)KErrNotFound)
+    iServiceId((TUint32)KErrNotFound),
+    isSelected(EFalse)
     {
     }
 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/group/ccappmycardplugin.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/group/ccappmycardplugin.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -89,6 +89,7 @@
 
 LIBRARY         estor.lib
 LIBRARY         efsrv.lib
+LIBRARY         fbscli.lib
 
 DEBUGLIBRARY    flogger.lib
 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardlistboxmodel.h	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +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:  Listbox model for MyCard details list
-*
-*/
-
-#ifndef CCAPPMYCARDLISTBOXMODEL_H
-#define CCAPPMYCARDLISTBOXMODEL_H
-
-// INCLUDES
-#include <e32base.h>
-#include <badesca.h>
-#include <e32hashtab.h>
-
-#include "ccappmycard.h"
-
-
-// FORWARD DECLARATIONS
-class MVPbkContactFieldData;
-class MVPbkBaseContactField;
-class MVPbkFieldType;
-class CPbk2PresentationContactField;
-class CPbk2IconArray;
-class CPbk2PresentationContact;
-class CEikListBox;
-class CCCAppMyCardListBoxRow;
-class CCoeEnv;
-
-/**
- * Listbox model class for MyCard details list
- *
- *
- *  @lib ccappmycardplugin.dll
- *  @since S60 9.2
- */
-class CCCAppMyCardListBoxModel :
-    public CBase,
-    public MDesCArray,
-    public MMyCardObserver
-{
-
-public:
-
-    /**
-     * Two-phased constructor.
-     * 
-     * @param aMyCard MyCard reference
-     * @param aCoeEnv UI control environment
-     * @param aListBox Listbox UI control
-     * @param aIconArray Listbox's icon array
-     */
-    static CCCAppMyCardListBoxModel* NewL(
-        CCCAppMyCard& aMyCard,
-        CCoeEnv& aCoeEnv,
-        CEikListBox& aListBox,
-        CPbk2IconArray& aIconArray );
-
-    /**
-     * Destructor.
-     */
-    ~CCCAppMyCardListBoxModel();
-
-
-public: // From MMyCardObserver
-    
-    void MyCardEventL( TEvent aEvent );
-    
-    
-public: // From MDesCArray
-    
-    TInt MdcaCount() const;
-    TPtrC MdcaPoint(TInt aIndex) const;
-
-public: // New methods
-    
-    /**
-     * Get Presentation Field index for field at aIndex
-     * 
-     * @param aIndex Listbox row index
-     * @return Presentation field index shown at aIndex  
-     */
-    TInt FieldIndex( TInt aIndex );
-    
-private: // private construction
-
-    /**
-     * Constructor
-     */
-    CCCAppMyCardListBoxModel(
-        CCCAppMyCard& aMyCard,
-        CCoeEnv& aCoeEnv,
-        CEikListBox& aListBox,
-        CPbk2IconArray& aIconArray );
-
-    /**
-     * 2nd constructor
-     */
-    void ConstructL();
-
-private: // new implementation
-
-    /**
-     * Helper function for adding contact field items to
-     * listbox data model.
-     *
-     */
-    void AddDataL();
-
-    /**
-     * Get label for contact field
-     */
-    HBufC* GetLabelLC(const CPbk2PresentationContactField& aField);
-
-    /**
-     * Should field aFieldType be hidden
-     */
-    TBool IsHiddenField(const MVPbkFieldType* aFieldType);
-
-    /**
-     * Get field at aIndex
-     */
-    MVPbkBaseContactField* FieldAtLC(TInt aIndex);
-
-    /**
-     * Field type tester
-     */
-    TBool IsFieldTypeL(TInt aIndex, TInt aSelectorResId);
-
-    /**
-     * Format generic text -type field
-     */
-    void HandleTextTypeFieldL(
-        TInt aIndex,
-        const MVPbkContactFieldData& aFieldData,
-        CCCAppMyCardListBoxRow* aRow );
-
-    /**
-     * Format Date -type field
-     */
-    void HandleDateTimeTypeFieldL(
-        const MVPbkContactFieldData& aFieldData,
-        CCCAppMyCardListBoxRow* aRow);
-
-    /**
-     * Format URI -type field
-     */
-    void HandleUriTypeFieldL(
-        TInt aIndex,
-        const MVPbkContactFieldData& aFieldData,
-        CCCAppMyCardListBoxRow* aRow);
-
-    /**
-     * Clip aBuffer from beginning to fit into listbox
-     */
-    TBool ClipFromBeginning(TDes& aBuffer, TInt aItemIndex, TInt aSubCellNumber) const;
-
-    /**
-     * Expand column and line buffers to be sufficient for aRow
-     */
-    void ExpandBuffersL(CCCAppMyCardListBoxRow* aRow);
-
-    /**
-     * Expand column buffer to aRequiredLength
-     * 
-     * @return new column buffer
-     */
-    TPtr ExpandColumnBufferL(TInt aRequiredLength);
-
-
-private: // data
-
-    /**
-     * Reference to control environment.
-     * Not own.
-     */
-    CCoeEnv& iCoeEnv;
-    
-    /**
-     * Reference to MyCard instance
-     * Not own.
-     */
-    CCCAppMyCard& iMyCard;
-    
-    /**
-     * Reference to listbox.
-     * Not own.
-     */
-    CEikListBox& iListBox;
-
-    /**
-     *  Reference to listbox icon array
-     *  Not own.
-     */
-    CPbk2IconArray& iIconArray;
-
-    /**
-     * Text row array.
-     * Own.
-     */
-    CArrayPtrFlat<CCCAppMyCardListBoxRow> iRows;
-
-    /**
-     * Buffer for storing one formatted listbox row.
-     * Own.
-     */
-    HBufC* iLineBuf;
-
-    /**
-     * Buffer for storing one formatted listbox column.
-     * Own.
-     */
-    HBufC* iColumnBuf;
-
-    /// Not own. Presentation contact
-    CPbk2PresentationContact* iPresentationContact;
-    
-    /// Own: Map current index to Presentation Contact index
-    RHashMap<TInt, TInt> iInxToPresentationIdx; 
-};
-
-#endif // CCAPPMYCARDLISTBOXMODEL_H
-
-// End of File
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardlistboxrow.h	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +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:  Listbox model row for MyCard details list
-*
-*/
-
-#ifndef CCAPPMYCARDLISTBOXROW_H
-#define CCAPPMYCARDLISTBOXROW_H
-
-#include <e32base.h>
-
-
-/**
- * MyCard view list box model row.
- *
- */
-class CCCAppMyCardListBoxRow : public CBase
-{
-public: // Constructors and destructor
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @return  A new instance of this class.
-     */
-    static CCCAppMyCardListBoxRow* NewL();
-
-    /**
-     * Destructor.
-     */
-    ~CCCAppMyCardListBoxRow();
-
-public: // Interface
-
-    /**
-     * Returns the number of columns in this row.
-     *
-     * @return  Number of columns in this row.
-     */
-    TInt ColumnCount() const;
-
-    /**
-     * Returns the descriptor at the given position.
-     *
-     * @param aColumnIndex  Column index.
-     * @return  The descriptor at the given index.
-     */
-    TPtrC At(TInt aColumnIndex) const;
-
-    /**
-     * Appends a given column to the row.
-     *
-     * @param aColumnText   Column to append.
-     */
-    void AppendColumnL(const TDesC& aColumnText);
-
-    /**
-     * Is clip required.
-     */
-    TBool IsClipRequired() const;
-
-    /**
-     * Clip text from beginning if field is numeric field or e-mail field.
-     */
-    void SetClipRequired(TBool aFlag);
-
-    /**
-     * Returns the total descriptor length of all the columns.
-     *
-     * @return  Total row length.
-     */
-    TInt TotalLength() const;
-
-    /**
-     * Returns the maximum column length of this row.
-     *
-     * @return  Maximum column length.
-     */
-    TInt MaxColumnLength() const;
-
-private: // Implementation
-
-    CCCAppMyCardListBoxRow();
-
-private: // Data
-
-    /// Own: Column array
-    RPointerArray<HBufC> iColumns;
-
-    /// Is clip required.
-    TBool iClipBeginning;
-};
-
-#endif //CCAPPMYCARDLISTBOXROW_H
-
-// End of file
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Wed Mar 31 21:13:53 2010 +0300
@@ -112,13 +112,6 @@
     /**
      * From CAknView
      */
-    void DynInitMenuPaneL(
-        TInt aResourceId,
-        CEikMenuPane* aMenuPane );
-
-    /**
-     * From CAknView
-     */
     void HandleCommandL(
         TInt aCommand );
 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -576,8 +576,17 @@
         TPbk2ContactEditorParams::EOwnContact ) );
 	
 	if( err != KErrNone )
-        {
+        {        
         self->iPlugin.HandleError( err );
+        
+        if( !self->iMyCard )
+            {
+            self->iCloseCallBack->Call();
+            }
+        else
+            {
+            self->LoadContact();
+            }
         }
 	
 	return err;
@@ -603,11 +612,17 @@
 		}
 	else if( aFlags & TPbk2ContactEditorParams::EModified )
 		{
-		// focused field
-		field = iMyCardContact->Fields().FieldAtLC( iFocusedFieldIndex );
+        if( iFocusedFieldIndex >= KErrNone )
+            {
+            // focused field
+            field = iMyCardContact->Fields().FieldAtLC( iFocusedFieldIndex ); 
+            }
+        				
 		// pass current store contact, ownership is taken
 		contact = iMyCardContact;
-		iMyCardContact = NULL;
+		iMyCardContact = NULL;		
+		delete iPresentationContact;
+		iPresentationContact = NULL;		
 		}
 	// params for the editor
 	TPbk2ContactEditorParams params( aFlags, field, NULL, this );
@@ -657,21 +672,34 @@
 void CCCAppMyCard::ContactEditingComplete( MVPbkStoreContact* aEditedContact )
 	{
     // create link of mycard
-    MVPbkContactLink* link = NULL;
-    TRAPD( err, 
-        link = aEditedContact->CreateLinkLC();   
-        CleanupStack::Pop(); ); //link
+    MVPbkContactLink* link = NULL;       
     
-    if( !err )
+    TRAPD( err,
         {
+        link = aEditedContact->CreateLinkLC(); 
+        
+        if( link )
+            {
+            CleanupStack::Pop(); //link
+            }
+        } );
+        
+    delete aEditedContact; // ignore given contact
+    
+    if( link && err == KErrNone )
+        {
+        
         delete iMyCard;
         iMyCard = link;
         
         // reload mycard to get rid of the empty template fields
         LoadContact();
         }
+    else if( !iMyCard )
+        {
+        iCloseCallBack->Call();
+        }               
     
-    delete aEditedContact; // ignore given contact
     iDialogIsRunning = EFalse;
 	}
 
@@ -774,7 +802,12 @@
             TPbk2ContactEditorParams::EOwnContact) );
     	if( err != KErrNone )
 			{
+            LoadContact();
             iPlugin.HandleError( err );
+            if( !iMyCard )
+                {
+                iCloseCallBack->Call();
+                }                
 			}
     	}    
     else if( aResult.iOpCode == MVPbkContactObserver::EContactDelete )
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -1164,7 +1164,7 @@
       }
       
     PosToScreenCoordinates( this, pos );    
-    iDetailsPopup->SetPosition( pos );      
+    iDetailsPopup->SetPosition( pos, CAknStylusPopUpMenu::EPositionTypeRightBottom );      
    
     CCoeControl::HandlePointerEventL( aPointerEvent );              
     }
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxmodel.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,501 +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:  Listbox model for MyCard details list
- *
- */
-
-#include <TPbk2StoreContactAnalyzer.h>
-#include <Pbk2UIControls.rsg>
-#include <Pbk2PresentationUtils.h>
-#include <CPbk2PresentationContact.h>
-#include <CPbk2PresentationContactField.h>
-#include <CPbk2PresentationContactFieldCollection.h>
-#include <CPbk2IconArray.h>
-#include <MPbk2FieldProperty.h>
-
-#include <CVPbkContactManager.h>
-#include <MVPbkFieldType.h>
-#include <MVPbkContactFieldTextData.h>
-#include <MVPbkContactFieldUriData.h>
-#include <MVPbkContactFieldDateTimeData.h>
-#include <MVPbkContactFieldData.h>
-#include <VPbkUtils.h>
-#include <VPbkEng.rsg>
-
-#include <aknlists.h>
-#include <avkon.rsg>
-
-#include "ccappmycardcommon.h"
-#include "ccappmycardlistboxmodel.h"
-#include "ccappmycardlistboxrow.h"
-#include <ccappmycardpluginrsc.rsg>
-
-
-/// Granularity of the row array
-const TInt KRowArrayGranularity = 4;
-
-/// Initial buffer size for temporary text buffers
-const TInt KBufferSize = 256;
-
-/// Disallowed characters in column text
-_LIT( KCharsToReplace, "\t" );
-
-/// Replacement character for invalid or graphical column characters
-_LIT( KReplacementChars, " " );
-const TText KReplacedChars = ' ';
-
-/// Content colum index
-const TInt KContentColumnIndex = 2;
-
-/// Column  separator
-const TText KColumnSeparator = '\t';
-
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::NewL
-// ---------------------------------------------------------------------------
-//
-CCCAppMyCardListBoxModel* CCCAppMyCardListBoxModel::NewL(CCCAppMyCard& aMyCard,
-        CCoeEnv& aCoeEnv, CEikListBox& aListBox, CPbk2IconArray& aIconArray)
-    {
-    CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCardListBoxModel::NewL()") );
-
-    CCCAppMyCardListBoxModel* self = new (ELeave) CCCAppMyCardListBoxModel(
-            aMyCard, aCoeEnv, aListBox, aIconArray);
-    CleanupStack::PushL(self);
-    self->ConstructL();
-    CleanupStack::Pop(self);
-
-    CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardListBoxModel::NewL()") );
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::~CCCAppMyCardListBoxModel
-// ---------------------------------------------------------------------------
-//
-CCCAppMyCardListBoxModel::~CCCAppMyCardListBoxModel()
-    {
-    CCA_DP(KMyCardLogFile,
-            CCA_L("->CCCAppMyCardListBoxModel::~CCCAppMyCardListBoxModel()") );
-
-    iRows.ResetAndDestroy();
-    delete iLineBuf;
-    delete iColumnBuf;
-    iInxToPresentationIdx.Close();
-
-    CCA_DP(KMyCardLogFile,
-            CCA_L("<-CCCAppMyCardListBoxModel::~CCCAppMyCardListBoxModel()") );
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::CCCAppMyCardListBoxModel
-// ---------------------------------------------------------------------------
-//
-CCCAppMyCardListBoxModel::CCCAppMyCardListBoxModel(
-    CCCAppMyCard& aMyCard,
-    CCoeEnv& aCoeEnv,
-    CEikListBox& aListBox,
-    CPbk2IconArray& aIconArray ) :
-        iCoeEnv(aCoeEnv),
-        iMyCard(aMyCard),
-        iListBox(aListBox),
-        iIconArray(aIconArray),
-        iRows(KRowArrayGranularity)
-    {
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::ConstructL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::ConstructL()
-    {
-    iLineBuf = HBufC::NewL(KBufferSize);
-    iColumnBuf = HBufC::NewL(KBufferSize);
-
-    iMyCard.AddObserverL(this);
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::MyCardEventL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::MyCardEventL(TEvent aEvent)
-    {
-    if( aEvent == MMyCardObserver::EEventContactLoaded)
-        {
-        CCA_DP( KMyCardLogFile,
-            CCA_L("->CCCAppMyCardListBoxModel::MyCardEventL EEventContactLoaded") );
-
-        iPresentationContact = &iMyCard.PresentationContactL();
-        AddDataL();
-        }
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::MdcaCount
-// ---------------------------------------------------------------------------
-//
-TInt CCCAppMyCardListBoxModel::MdcaCount() const
-    {
-    return iRows.Count();
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::MdcaPoint
-// ---------------------------------------------------------------------------
-//
-TPtrC CCCAppMyCardListBoxModel::MdcaPoint(TInt aIndex) const
-    {
-    TPtr rowText( iLineBuf->Des() );
-    rowText.Zero();
-
-    const CCCAppMyCardListBoxRow& row = *iRows[aIndex];
-    const TInt columnCount = row.ColumnCount();
-    TInt fieldCount = iPresentationContact->PresentationFields().FieldCount();
-
-    for( TInt index = 0; index < columnCount; ++index )
-        {
-        TPtr columnText( iColumnBuf->Des() );
-        columnText.Copy( row.At(index) );
-
-        // Clip the column if required
-        if( index == KContentColumnIndex && 
-            row.IsClipRequired() && 
-            aIndex < fieldCount )
-            {
-            ClipFromBeginning( columnText, aIndex, index );
-            }
- 
-        // Append the column and separator to the formatted row
-        rowText.Append( columnText );
-        rowText.Append( KColumnSeparator );
-        }
-
-    return rowText;
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::FieldIndex
-// ---------------------------------------------------------------------------
-//
-TInt CCCAppMyCardListBoxModel::FieldIndex( TInt aIndex )
-    {
-    TInt* index = iInxToPresentationIdx.Find( aIndex );
-
-    if( index && *index >= 0 )
-        {
-        return iPresentationContact->PresentationFields().StoreIndexOfField( *index );
-        }
-    return KErrNotFound;
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::AddDataL
-// --------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::AddDataL()
-    {
-    CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCardListBoxModel::AddDataL()") );
-
-    iRows.ResetAndDestroy();
-    iInxToPresentationIdx.Close();
-
-    TInt listIdx = -1;
-
-    TInt fieldCount = iPresentationContact->PresentationFields().FieldCount();
-    for (TInt index = 0; index < fieldCount; index++)
-        {
-        CPbk2PresentationContactField& field =
-                iPresentationContact->PresentationFields().At(index);
-
-        // Get master field type list and match field's type against it
-        const MVPbkFieldType* fieldType = VPbkUtils::MatchFieldType(
-                iMyCard.ContactManager().FieldTypes(), field );
-
-        if( field.IsEditable() && fieldType && !IsHiddenField(fieldType) )
-            {
-            HBufC* label = GetLabelLC( field );
-
-            if( label->Length() )
-                {
-                CCCAppMyCardListBoxRow* row =
-                        CCCAppMyCardListBoxRow::NewL();
-                CleanupStack::PushL(row);
-
-                const MVPbkContactFieldData& fieldData = field.FieldData();
-
-                // Add icon
-                TBuf<20> buffer; // 20 should be enough for icon index
-                TInt iconIndex = iIconArray.FindIcon(
-                        field.FieldProperty().IconId() );
-                if( iconIndex != KErrNotFound)
-                    {
-                    buffer.AppendNum(iconIndex);
-                    }
-                row->AppendColumnL(buffer);
-
-                // add label.
-                row->AppendColumnL(*label);
-
-                // Add current index to Presentation Contact index array 
-                // to estimate the text is needed to clip or not.
-                iInxToPresentationIdx.InsertL(++listIdx, index);
-
-                // add field content.
-                switch (fieldData.DataType() )
-                    {
-                    case EVPbkFieldStorageTypeText:
-                        {
-                        HandleTextTypeFieldL(index, fieldData, row);
-                        break;
-                        }
-                    case EVPbkFieldStorageTypeDateTime:
-                        {
-                        HandleDateTimeTypeFieldL(fieldData, row);
-                        break;
-                        }
-                    case EVPbkFieldStorageTypeUri:
-                        {
-                        HandleUriTypeFieldL(index, fieldData, row);
-                        break;
-                        }
-                    }
-
-                // Expand row formatting buffer if required
-                ExpandBuffersL(row);
-
-                // Add the row if data ok to show to user.
-                iRows.AppendL(row);
-                CleanupStack::Pop(row);
-                }
-
-            CleanupStack::PopAndDestroy(label);
-            }
-        } // for
-
-    iListBox.HandleItemAdditionL();
-
-    CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardListBoxModel::AddDataL()") );
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::IsHiddenField
-// --------------------------------------------------------------------------
-//
-TBool CCCAppMyCardListBoxModel::IsHiddenField(const MVPbkFieldType* aFieldType)
-    {
-    TInt resId = aFieldType->FieldTypeResId();
-    return ( resId == R_VPBK_FIELD_TYPE_SYNCCLASS ||
-             resId == R_VPBK_FIELD_TYPE_CALLEROBJIMG );
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::FieldAtLC
-// ---------------------------------------------------------------------------
-//
-MVPbkBaseContactField* CCCAppMyCardListBoxModel::FieldAtLC(TInt aIndex)
-    {
-    TInt *presentationIdx = iInxToPresentationIdx.Find(aIndex);
-
-    if( !presentationIdx)
-        {
-        return NULL;
-        }
-
-    TInt index = iPresentationContact->PresentationFields().StoreIndexOfField(
-            *presentationIdx);
-
-    if( index != KErrNotFound)
-        {
-        // Use FieldAtLC to avoid the unvalidity of the field after new
-        // FieldAt call.
-        return iMyCard.StoreContact().Fields().FieldAtLC(index);
-        }
-
-    return NULL;
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::IsFieldTypeL
-// ---------------------------------------------------------------------------
-//
-TBool CCCAppMyCardListBoxModel::IsFieldTypeL(
-    TInt aIndex, TInt aSelectorResId )
-    {
-    TBool ret = EFalse;
-    MVPbkBaseContactField* field = FieldAtLC(aIndex);
-
-    if( field )
-        {
-        TPbk2StoreContactAnalyzer analyzer( iMyCard.ContactManager(), NULL );
-        ret = analyzer.IsFieldTypeIncludedL( *field, aSelectorResId );
-        CleanupStack::PopAndDestroy(field);
-        }
-
-    return ret;
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::HandleTextTypeFieldL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::HandleTextTypeFieldL( 
-    TInt aIndex,
-    const MVPbkContactFieldData& aFieldData, 
-    CCCAppMyCardListBoxRow* aRow )
-    {
-    const TDesC& fieldText = MVPbkContactFieldTextData::Cast(aFieldData).Text();
-
-    // Check if clipping is required
-    if( IsFieldTypeL( aIndex, R_MYCARD_CLIP_FIELD_SELECTOR ) )
-        {
-        aRow->SetClipRequired( ETrue );
-        }
-    
-    TPtr columnBuf( iColumnBuf->Des() );
-    columnBuf.Set( ExpandColumnBufferL( fieldText.Length() ) );
-    columnBuf.Zero();
-
-    // replace listbox separator characters.
-    Pbk2PresentationUtils::AppendAndReplaceChars( columnBuf, fieldText,
-            KCharsToReplace, KReplacementChars );
-
-    // Replace characters that can not be displayed correctly.
-    Pbk2PresentationUtils::ReplaceNonGraphicCharacters( columnBuf, KReplacedChars );
-
-    aRow->AppendColumnL( columnBuf );
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::HandleDateTimeTypeFieldL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::HandleDateTimeTypeFieldL(
-        const MVPbkContactFieldData& aFieldData, CCCAppMyCardListBoxRow* aRow)
-    {
-    const MVPbkContactFieldDateTimeData& date =
-            MVPbkContactFieldDateTimeData::Cast(aFieldData);
-
-    HBufC* dateFormat = 
-        iCoeEnv.AllocReadResourceLC( R_QTN_DATE_USUAL_WITH_ZERO );
-
-    TLocale locale;
-    TBuf<64> dateBuffer;
-    TTime time( date.DateTime() );
-    time.FormatL( dateBuffer, *dateFormat, locale );
-    CleanupStack::PopAndDestroy( dateFormat );
-
-    aRow->AppendColumnL( dateBuffer );
-    }
-
-// ---------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::HandleUriTypeFieldL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::HandleUriTypeFieldL(TInt aIndex,
-        const MVPbkContactFieldData& aFieldData, CCCAppMyCardListBoxRow* aRow)
-    {
-    TBool isXspField = IsFieldTypeL( aIndex, R_MYCARD_CLIP_FIELD_SELECTOR );
-    if ( isXspField )
-        {
-        aRow->SetClipRequired( ETrue );
-        }
-    
-    const MVPbkContactFieldUriData& uri = 
-        MVPbkContactFieldUriData::Cast( aFieldData );
-
-    HBufC* tempBuf = uri.Text().AllocLC();
-    TPtr text = tempBuf->Des();
-    // Replace characters that can not be displayed correctly.
-    Pbk2PresentationUtils::ReplaceNonGraphicCharacters( text, KReplacedChars );
-    
-    aRow->AppendColumnL( text );
-    CleanupStack::PopAndDestroy( tempBuf );
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::ClipFromBeginning
-// --------------------------------------------------------------------------
-//
-TBool CCCAppMyCardListBoxModel::ClipFromBeginning(TDes& aBuffer,
-        TInt aItemIndex, TInt aSubCellNumber) const
-    {
-    // TODO: This could be better. Model should not care about the 
-    // type of the listbox.
-    CAknFormDoubleGraphicStyleListBox* listbox =
-        static_cast<CAknFormDoubleGraphicStyleListBox*> (&iListBox);
-
-    return AknTextUtils::ClipToFit( aBuffer, AknTextUtils::EClipFromBeginning,
-        listbox, aItemIndex, aSubCellNumber );
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::ExpandBuffersL
-// --------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxModel::ExpandBuffersL(CCCAppMyCardListBoxRow* aRow)
-    {
-    // Row formatting buffer
-    const TInt rowLength = aRow->TotalLength() + aRow->ColumnCount(); // for separator characters
-
-    if( rowLength > iLineBuf->Des().MaxLength() )
-        {
-        iLineBuf = iLineBuf->ReAllocL(rowLength);
-        }
-
-    ExpandColumnBufferL( aRow->MaxColumnLength() );
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::ExpandColumnBufferL
-// --------------------------------------------------------------------------
-//
-TPtr CCCAppMyCardListBoxModel::ExpandColumnBufferL(TInt aRequiredLength)
-    {
-    if( aRequiredLength > iColumnBuf->Des().MaxLength() )
-        {
-        iColumnBuf = iColumnBuf->ReAllocL(aRequiredLength);
-        }
-
-    return iColumnBuf->Des();
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxModel::GetLabelLC
-// --------------------------------------------------------------------------
-//
-HBufC* CCCAppMyCardListBoxModel::GetLabelLC(
-        const CPbk2PresentationContactField& aField)
-    {
-    TPtr columnBuf( iColumnBuf->Des() );
-    columnBuf.Set( ExpandColumnBufferL(aField.FieldLabel().Length() ) );
-    columnBuf.Zero();
-
-    // replace listbox separator characters.
-    Pbk2PresentationUtils::AppendAndReplaceChars( columnBuf,
-        aField.FieldLabel(), KCharsToReplace, KReplacementChars );
-
-    // Replace characters that can not be displayed correctly
-    Pbk2PresentationUtils::ReplaceNonGraphicCharacters( 
-        columnBuf, KReplacedChars );
-
-    HBufC* data = HBufC::NewLC( columnBuf.Length() );
-    data->Des().Append( columnBuf );
-
-    return data;
-    }
-
-// End of File
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxrow.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +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:  Listbox model row for MyCard details list
- *
- */
-
-#include "ccappmycardlistboxrow.h"
-
-// ======== MEMBER FUNCTIONS ========
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::CCCAppMyCardListBoxRow
-// --------------------------------------------------------------------------
-//
-inline CCCAppMyCardListBoxRow::CCCAppMyCardListBoxRow()
-    {
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::~CCCAppMyCardListBoxRow
-// --------------------------------------------------------------------------
-//
-CCCAppMyCardListBoxRow::~CCCAppMyCardListBoxRow()
-    {
-    iColumns.ResetAndDestroy();
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::NewL
-// --------------------------------------------------------------------------
-//
-CCCAppMyCardListBoxRow* CCCAppMyCardListBoxRow::NewL()
-    {
-    return new (ELeave) CCCAppMyCardListBoxRow;
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::ColumnCount
-// --------------------------------------------------------------------------
-//
-TInt CCCAppMyCardListBoxRow::ColumnCount() const
-    {
-    return iColumns.Count();
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::At
-// --------------------------------------------------------------------------
-//
-TPtrC CCCAppMyCardListBoxRow::At(TInt aColumnIndex) const
-    {
-    return *iColumns[aColumnIndex];
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::AppendColumnL
-// --------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxRow::AppendColumnL(const TDesC& aColumnText)
-    {
-    HBufC* buf = aColumnText.AllocLC();
-    iColumns.AppendL( buf );
-    CleanupStack::Pop( buf );
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::IsClipRequired
-// --------------------------------------------------------------------------
-//
-TBool CCCAppMyCardListBoxRow::IsClipRequired() const
-    {
-    return iClipBeginning;
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::SetClipRequired
-// --------------------------------------------------------------------------
-//
-void CCCAppMyCardListBoxRow::SetClipRequired(TBool aFlag)
-    {
-    iClipBeginning = aFlag;
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::TotalLength
-// --------------------------------------------------------------------------
-//
-TInt CCCAppMyCardListBoxRow::TotalLength() const
-    {
-    TInt result = 0;
-    const TInt count = iColumns.Count();
-    for (TInt i = 0; i < count; ++i)
-        {
-        result += At(i).Length();
-        }
-    return result;
-    }
-
-// --------------------------------------------------------------------------
-// CCCAppMyCardListBoxRow::MaxColumnLength
-// --------------------------------------------------------------------------
-//
-TInt CCCAppMyCardListBoxRow::MaxColumnLength() const
-    {
-    TInt result = 0;
-    const TInt count = iColumns.Count();
-    for (TInt i = 0; i < count; ++i)
-        {
-        result = Max(result, At(i).Length());
-        }
-    return result;
-    }
-
-// End of File
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -26,7 +26,6 @@
 #include <ccappmycardpluginrsc.rsg>
 #include <Pbk2UIControls.rsg>
 #include <data_caging_path_literals.hrh>
-#include <phonebook2.mbg>
 #include <mccappengine.h>
 #include <bautils.h>
 #include <AknsUtils.h>
@@ -48,6 +47,8 @@
 #include <mccapppluginparameter.h>
 #include <mccaparameter.h>
 #include <CVPbkContactManager.h>
+#include <MVPbkFieldType.h>
+#include <TVPbkFieldVersitProperty.h>
 
 // ---------------------------------------------------------------------------
 // Constants
@@ -55,8 +56,6 @@
 
 /// MyCard own resource file
 _LIT( KMyCardResourceFileName,          "ccappmycardpluginrsc.rsc" );
-
-_LIT( KMyCardIconFileName,              "\\resource\\apps\\phonebook2.mif");
 /// Phonebook2 UI controls resource file
 _LIT( KMyCardPbk2UiControlsResFileName, "pbk2uicontrols.rsc" );
 // pbk2 common ui
@@ -255,21 +254,10 @@
 
     if ( ECCAppTabIcon == aIconType )
         {
-        CFbsBitmap* bmp = NULL;
-        CFbsBitmap* bmpMask = NULL;
-
-        // TODO: Change icon
-        AknsUtils::CreateIconL(
-            AknsUtils::SkinInstance(),
-            KAknsIIDDefault,//todo; get a proper skin
-            bmp,
-            bmpMask,
-            KMyCardIconFileName,
-            EMbmPhonebook2Qgn_prop_pb_photo_tab3,
-            EMbmPhonebook2Qgn_prop_pb_photo_tab3_mask );
-
-        aIcon.SetBitmap( bmp );
-        aIcon.SetMask( bmpMask );
+        // CCA expects to always receive real icons. MyCard does not have
+        // tab icon defined, so provide some dummy icons.
+        aIcon.SetBitmap( new(ELeave) CFbsBitmap );
+        aIcon.SetMask( new(ELeave) CFbsBitmap );
         }
 
     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardPlugin::ProvideBitmapL()"));
@@ -289,17 +277,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppMyCardPlugin::DynInitMenuPaneL
-// ---------------------------------------------------------------------------
-//
-void CCCAppMyCardPlugin::DynInitMenuPaneL(
-    TInt /*aResourceId*/,
-    CEikMenuPane* /*aMenuPane*/ )
-    {
-    // TODO: menupane handling
-    }
-
-// ---------------------------------------------------------------------------
 // CCCAppMyCardPlugin::HandleCommandL
 // ---------------------------------------------------------------------------
 //
@@ -307,14 +284,45 @@
     {
     CCA_DP(KMyCardLogFile, 
         CCA_L("->CCCAppMyCardPlugin::HandleCommandL command=%d"), aCommand );
-    
+                
     switch( aCommand )
-        {
+        {                
         case ECCAppMyCardCmdEdit:
-            {
-            // when editor is called via options menu, focus first field always 
-            EditL( iMyCard->PresentationContactL().
-                PresentationFields().StoreIndexOfField( 0 ) );
+            {            
+            TInt index;            
+            MVPbkStoreContact& storeContact = iMyCard->StoreContact();
+            
+            TRAPD( err,
+                {
+                index = iMyCard->PresentationContactL().PresentationFields().StoreIndexOfField( 0 );                        
+        
+                MVPbkBaseContactField* field = storeContact.Fields().FieldAtLC( index );
+                                        
+                const MVPbkFieldType* type = field->BestMatchingFieldType();
+                const TArray<TVPbkFieldVersitProperty> fieldProperty = type->VersitProperties();
+    
+                if( fieldProperty.Count() )
+                    {
+                    const TVPbkFieldVersitProperty property = fieldProperty[0];
+                        
+                    if( property.Name() == EVPbkVersitNameADR )
+                        {
+                        index = KErrNotSupported;
+                        }            
+                    }                       
+                                                 
+                if( field )
+                    {
+                    CleanupStack::PopAndDestroy( field );
+                    }
+            
+                EditL( index );
+                } );
+            
+            if( err != KErrNone )
+                {
+                HandleError( err );                
+                }
             break;
             }
         case ECCappMyCardCmdSendVCard:
@@ -483,7 +491,7 @@
               break;                        
              
          default:
-        	 CAknView::ProcessCommandL(aCommandId);
+             CAknView::ProcessCommandL( aCommandId );
              break;
          }
      
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardpluginfactory.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardpluginfactory.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -67,10 +67,6 @@
             {
             return CCCAppMyCardPlugin::NewL();
             }
-        default:
-			{
-			// TODO: Panic?
-			}
         }
     return NULL;
     }
--- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -114,8 +114,8 @@
          &iAppUi.Parameter(), CCCAppCmsContactFetcherWrapper::EFindContactFromOtherStores );
     iCmsWrapper->AddObserverL( *this );
 
-    // TODO: replace hardcoded uid comparison with better sollution that
-    // supports other mycard views too
+    // At the moment mycard does not need to support tabs, so this is 
+    // good enough sollution for launching mycard plugin
     TBool isUidMyCard = ( aUid == 
             TUid::Uid( KCCAMyCardPluginImplmentationUid ) );
 
--- a/phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/inc/ccapputilheaders.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/inc/ccapputilheaders.h	Wed Mar 31 21:13:53 2010 +0300
@@ -54,10 +54,22 @@
 const TUid KTestPropertyCat={0x10012349};  
 enum TTestPropertyKeys 
     {
-	ETestCaseStateProperty = 1,
+    ETestCaseStateProperty = 1,
     ETestParameterTypeProperty
     };    
 
+enum TCmsContactStore
+    {    
+    ECmsContactStorePbk = 0,
+    ECmsContactStoreSim,
+    ECmsContactStoreSdn
+    };
+
+enum TCmsContactIdentifierType
+    {    
+    ECmsPackedContactLinkArray = 0
+    };
+
 // used in CCmsContactFieldItem creation
 const TInt PHONE = 1;
 const TInt EMAIL = 2;
@@ -68,10 +80,10 @@
 const TInt VOIP2 = 7;
 const TInt NAME = 8;
 
-///////////////////////////////////////////////////
-// Dummy class interface
+// -----------------------------------------------------------------------------
+// Dummy class 
 // MCCAParameter
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 class MCCAParameter
     {
 
@@ -123,12 +135,12 @@
 
 
     };
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // Dummy class 
 // CCCAParameter
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 class CCCAParameter : public CBase, 
-					  public MCCAParameter
+                      public MCCAParameter
     {
 
 public:
@@ -180,7 +192,8 @@
         {
         // get property using category and key
         TInt type( MCCAParameter::EContactNone );
-        TInt err = RProperty::Get( KTestPropertyCat, ETestParameterTypeProperty, type );
+        TInt err = RProperty::Get( 
+                KTestPropertyCat, ETestParameterTypeProperty, type );
 
         if ( KErrNone == err )
             {
@@ -222,21 +235,12 @@
     HBufC* iContactData;    
 
     };
-
-
-/** 
-* Contact identifier.
-*/
-enum TCmsContactIdentifierType
-    {    
-    ECmsPackedContactLinkArray = 0
-    };
     
     
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // Dummy class 
-// CCCAParameter
-///////////////////////////////////////////////////
+// CCmsContactBase
+// -----------------------------------------------------------------------------
 class CCmsContactBase : public CBase
     {
     public:
@@ -250,7 +254,10 @@
     };
 
     
-// dummy class
+// -----------------------------------------------------------------------------
+// Dummy class 
+// CCmsContactField
+// -----------------------------------------------------------------------------
 class CCmsContactField : public CCmsContactBase
     {
     public:
@@ -332,10 +339,10 @@
         TInt iType;
     };
 
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // Dummy class 
-// CCCAParameter
-///////////////////////////////////////////////////
+// CCmsContactFieldInfo
+// -----------------------------------------------------------------------------
 class CCmsContactFieldInfo : public CCmsContactBase
     {
 public:
@@ -350,7 +357,8 @@
         iArray = new (ELeave) RArray<CCmsContactFieldItem::TCmsContactField>();
         TInt testCase( 0 );
         // get property using category and key
-        TInt err = RProperty::Get( KTestPropertyCat, ETestCaseStateProperty, testCase );
+        TInt err = RProperty::Get( 
+                KTestPropertyCat, ETestCaseStateProperty, testCase );
 
         if ( KTestOneContactFieldItem == testCase
              || KTestCompleteOpenWithError == testCase
@@ -393,10 +401,10 @@
     };
    
 
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // Dummy class 
-// CCCAParameter
-///////////////////////////////////////////////////
+// RCmsSession
+// -----------------------------------------------------------------------------
 class RCmsSession : public CBase
     {
     public:
@@ -415,21 +423,15 @@
             };
     };
 
-///////////////////////////////////////////////////
+// -----------------------------------------------------------------------------
 // Dummy class 
 // RCmsContact
-///////////////////////////////////////////////////
-enum TCmsContactStore
-    {    
-    ECmsContactStorePbk = 0,
-    ECmsContactStoreSim,
-    ECmsContactStoreSdn
-    };
+// -----------------------------------------------------------------------------
 
 class RCmsContact : public CBase 
     {
     public:  // New functions
-        
+        RCmsContact() : iTopContact( ETrue ){}
         TInt Open( RCmsSession& /*aSession*/,
                             TInt32 aContactId )
             {
@@ -482,33 +484,48 @@
               return NULL;
               };
 
-          TBool IsServiceAvailable( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/ ) const
+          TBool IsServiceAvailable( 
+                  VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector 
+                  /*aContactAction*/ ) const
               {
               return ETrue;
               };
           
           void OrderNotificationsL( 
                       MCmsNotificationHandlerAPI* /*aHandler*/,
-                      CCmsContactFieldItem::TCmsContactNotification /*aNotificationType*/ )
+                      CCmsContactFieldItem::TCmsContactNotification 
+                      /*aNotificationType*/ )
               {
               };
                       
           TCmsContactStore ContactStore() const
               {
               const_cast<TBool&>(iContactStore_called) = ETrue;
+              return ECmsContactStorePbk;
               };
           
           void CancelNotifications( 
-                      CCmsContactFieldItem::TCmsContactNotification /*aNotificationType*/ ) {};
+                      CCmsContactFieldItem::TCmsContactNotification 
+                      /*aNotificationType*/ ) {};
                      
           void DeleteL(){};
           
           ~RCmsContact(){};
           
           TInt GetContactActionFieldCount(
-                  VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector /*aContactAction*/)
+                  VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector 
+                  /*aContactAction*/)
               {
-              return ETrue; //SendReceive( ECmsGetContactActionFieldCount, TIpcArgs( aContactAction ) );
+              return ETrue; 
+              }
+          
+          void SetVoiceCallDefault( TRequestStatus& aStatus ) const
+              {
+              aStatus = KRequestPending;
+              }
+          TBool IsTopContact()
+              {
+              return iTopContact;
               }
 
     public:
@@ -518,6 +535,7 @@
     TBuf<128> iDesDummy;
     
     TBool iContactStore_called;
+    TBool iTopContact;
     };    
 
 #include "ccacmscontactfetcherwrapper.h"
--- a/phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/src/t_ccacmscontactfetcherwrapperblocks.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/tsrc/ut_cmscontactfetcher/src/t_ccacmscontactfetcherwrapperblocks.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -39,7 +39,6 @@
 //
 void T_CCCACmsContactFetcherWrapper::Delete() 
     {
-
     }
 
 // -----------------------------------------------------------------------------
@@ -56,18 +55,30 @@
         // 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( "CreateAndDelete", T_CCCACmsContactFetcherWrapper::CreateAndDeleteL ),
-        ENTRY( "CreateWithContent", T_CCCACmsContactFetcherWrapper::CreateWithContentL ),
-        ENTRY( "CreateWithContactLink", T_CCCACmsContactFetcherWrapper::CreateWithContactLinkL ),
-        ENTRY( "CreateWithMSISDN", T_CCCACmsContactFetcherWrapper::CreateWithMSISDNL ),
-        ENTRY( "CreateWithEmail", T_CCCACmsContactFetcherWrapper::CreateWithEmailL ),
-        ENTRY( "NoDataFields", T_CCCACmsContactFetcherWrapper::NoDataFieldsL ),
-        ENTRY( "ErrorInContactOpen", T_CCCACmsContactFetcherWrapper::ErrorInContactOpenL ),
-        ENTRY( "ErrorInContactFetch", T_CCCACmsContactFetcherWrapper::ErrorInContactFetchL ),
-        ENTRY( "CreateWithManyItems", T_CCCACmsContactFetcherWrapper::CreateWithManyItemsL ),
-        ENTRY( "HandlePhonebookNotification", T_CCCACmsContactFetcherWrapper::HandlePhonebookNotificationL ),
-        ENTRY( "TestContactStoreApiL", T_CCCACmsContactFetcherWrapper::TestContactStoreApiL ),
-        ENTRY( "FindFromOtherStoresL", T_CCCACmsContactFetcherWrapper::FindFromOtherStoresL ),
+        ENTRY( "CreateAndDelete", 
+                T_CCCACmsContactFetcherWrapper::CreateAndDeleteL ),
+        ENTRY( "CreateWithContent", 
+                T_CCCACmsContactFetcherWrapper::CreateWithContentL ),
+        ENTRY( "CreateWithContactLink", 
+                T_CCCACmsContactFetcherWrapper::CreateWithContactLinkL ),
+        ENTRY( "CreateWithMSISDN", 
+                T_CCCACmsContactFetcherWrapper::CreateWithMSISDNL ),
+        ENTRY( "CreateWithEmail", 
+                T_CCCACmsContactFetcherWrapper::CreateWithEmailL ),
+        ENTRY( "NoDataFields", 
+                T_CCCACmsContactFetcherWrapper::NoDataFieldsL ),
+        ENTRY( "ErrorInContactOpen", 
+                T_CCCACmsContactFetcherWrapper::ErrorInContactOpenL ),
+        ENTRY( "ErrorInContactFetch", 
+                T_CCCACmsContactFetcherWrapper::ErrorInContactFetchL ),
+        ENTRY( "CreateWithManyItems", 
+                T_CCCACmsContactFetcherWrapper::CreateWithManyItemsL ),
+        ENTRY( "HandlePhonebookNotification", 
+                T_CCCACmsContactFetcherWrapper::HandlePhonebookNotificationL ),
+        ENTRY( "TestContactStoreApiL", 
+                T_CCCACmsContactFetcherWrapper::TestContactStoreApiL ),
+        ENTRY( "FindFromOtherStoresL", 
+                T_CCCACmsContactFetcherWrapper::FindFromOtherStoresL ),
         //ADD NEW ENTRY HERE
         // [test cases entries] - Do not remove
         };
@@ -104,23 +115,36 @@
           
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+                CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     wrapper->AddObserverL( *this );
     
     CompleteRequestL( &wrapper->iStatus, KErrNone );
-    
-    CCCAppCmsContactFetcherWrapper* wrapper2 = CCCAppCmsContactFetcherWrapper::InstanceL( ); 
+    CompleteRequestL( &wrapper->iStatus, KErrNone );
+    CCCAppCmsContactFetcherWrapper* wrapper2 = 
+                CCCAppCmsContactFetcherWrapper::InstanceL( ); 
     wrapper2->AddObserverL( *this );
     wrapper2->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper2->Release();
     wrapper2 = NULL;
     
     CCCAppCmsContactFetcherWrapper* leaveAgain = NULL;
-    TRAP( leaveCode, leaveAgain = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ) ); 
+    TRAP( leaveCode, leaveAgain = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ) ); 
     T1L( KErrAlreadyExists, leaveCode );
     TL( leaveAgain == NULL );
   
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -149,12 +173,18 @@
         
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     wrapper->AddObserverL( *this );
 
     CompleteRequestL( &wrapper->iStatus, KErrNone );
-    
+    CompleteRequestL( &wrapper->iStatus, KErrNone );
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -182,11 +212,13 @@
     iLog->Log( KCreateWithContent );
 
     
-    User::LeaveIfError( SetupL( KTestOneContactFieldItem, MCCAParameter::EContactId ) );
+    User::LeaveIfError( SetupL( 
+            KTestOneContactFieldItem, MCCAParameter::EContactId ) );
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
 
@@ -200,13 +232,18 @@
         }
 
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
     CleanupStack::PopAndDestroy( param );
     
     TL( iObserverCalled );
-    T1L( 2, iObserverCalledCount );
+    T1L( 1, iObserverCalledCount );
 
     return KErrNone;
 
@@ -217,7 +254,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::CreateWithManyItemsL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::CreateWithManyItemsL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
@@ -227,11 +265,13 @@
     iLog->Log( KCreateWithManyItems );
 
     
-    User::LeaveIfError( SetupL( KTestManyContactFieldItems, MCCAParameter::EContactId ) );
+    User::LeaveIfError( SetupL( 
+            KTestManyContactFieldItems, MCCAParameter::EContactId ) );
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
 
@@ -244,13 +284,18 @@
         }
 
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
     CleanupStack::PopAndDestroy( param );
     
     TL( iObserverCalled );
-    T1L( 4, iObserverCalledCount );
+    T1L( 3, iObserverCalledCount );
 
     return KErrNone;
 
@@ -261,7 +306,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::CreateWithContactLinkL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::CreateWithContactLinkL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
@@ -274,7 +320,8 @@
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
 
@@ -288,13 +335,18 @@
         }
 
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
     CleanupStack::PopAndDestroy( param );
     
     TL( iObserverCalled );
-    T1L( 2, iObserverCalledCount );    
+    T1L( 1, iObserverCalledCount );    
 
     return KErrNone;
 
@@ -319,7 +371,8 @@
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
     
@@ -328,7 +381,7 @@
     
     CompleteRequestL( &wrapper->iStatus, KErrNone );
 
-    TInt count = 1; 
+    TInt count = 2; 
     for ( TInt i(0); i < count; i++ )
         {
         CompleteRequestL( &wrapper->iStatus, KErrNone );
@@ -341,6 +394,11 @@
     T1L( 1, array.Count() ); 
         
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -358,7 +416,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::CreateWithEmailL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::CreateWithEmailL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
@@ -374,9 +433,15 @@
     
     TInt error ( KErrNone );
     CCCAppCmsContactFetcherWrapper* wrapper = NULL;
-    TRAP( error, wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ) );    
+    TRAP( error, wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ) );    
     wrapper->AddObserverL( *this );
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
        
@@ -400,28 +465,39 @@
     iObserverCalledCount++;
     iLog->Log( _L("..contact info notified") );
     
-    switch ( iOngoingTestCase )
+    if ( aParameter.iType == 
+            MCCAppContactFieldDataObserver::TParameter::EContactsChanged )
         {
-        case KTestOneContactFieldItem:
-        case KTestContactLink:
+        iObserverCalledWithContactsChanged = ETrue;
+        }
+    else
+        {
+        switch ( iOngoingTestCase )
             {
-            if ( 1 == iObserverCalledCount )
-                {
-                T1L( MCCAppContactFieldDataObserver::TParameter::EContactInfoAvailable, aParameter.iType );
-                }
-            if ( 2 == iObserverCalledCount )
+            case KTestOneContactFieldItem:
+            case KTestContactLink:
                 {
-                T1L( MCCAppContactFieldDataObserver::TParameter::EContactDataFieldAvailable, aParameter.iType );
+                if ( 1 == iObserverCalledCount )
+                    {
+                    T1L( MCCAppContactFieldDataObserver::TParameter::EContactInfoAvailable, 
+                            aParameter.iType );
+                    }
+                if ( 2 == iObserverCalledCount )
+                    {
+                    T1L( MCCAppContactFieldDataObserver::TParameter::EContactDeleted, 
+                            aParameter.iType );
+                    }
+                break;
                 }
-            break;
-            }
-        default:
-            {
-            break;
-            }
-        } 
+            default:
+                {
+                break;
+                }
+            } 
+        }
     
-    if ( aParameter.iType == MCCAppContactFieldDataObserver::TParameter::EContactsChanged )
+    if ( aParameter.iType == 
+            MCCAppContactFieldDataObserver::TParameter::EContactsChanged )
         {
         iObserverCalledWithContactsChanged = ETrue;
         }
@@ -469,25 +545,34 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::ErrorInContactOpenL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::ErrorInContactOpenL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
     _LIT( KErrorInContactOpen, "ErrorInContactOpen" );
-    TestModuleIf().Printf( 0, KT_CCCACmsContactFetcherWrapper, KErrorInContactOpen );
+    TestModuleIf().Printf( 
+            0, KT_CCCACmsContactFetcherWrapper, KErrorInContactOpen );
     // Print to log file
     iLog->Log( KErrorInContactOpen );
     
-    User::LeaveIfError( SetupL( KTestCompleteOpenWithError, MCCAParameter::EContactId ) );
+    User::LeaveIfError( SetupL( 
+            KTestCompleteOpenWithError, MCCAParameter::EContactId ) );
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
+    CompleteRequestL( &wrapper->iStatus, KErrNone );
     CompleteRequestL( &wrapper->iStatus, KErrCancel );
-
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -505,7 +590,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::ErrorInContactFetchL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::ErrorInContactFetchL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
@@ -515,17 +601,25 @@
     iLog->Log( KErrorInContactFetch );
 
     
-    User::LeaveIfError( SetupL( KTestCompleteFetchWithError, MCCAParameter::EContactId ) );
+    User::LeaveIfError( SetupL( 
+            KTestCompleteFetchWithError, MCCAParameter::EContactId ) );
      
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     
     wrapper->AddObserverL( *this );
     TRequestStatus* status = &wrapper->iStatus;
     User::RequestComplete( status, KErrNone );
             iSchedulerStarted = ETrue;
+    CStopSchedulerAfterDelay* schedulerStopper = 
+            new (ELeave) CStopSchedulerAfterDelay();
+    schedulerStopper->ConstructL();
+    CleanupStack::PushL( schedulerStopper );
+    schedulerStopper->After( 1000000 );// 1 sec
     CActiveScheduler::Start();
+    CleanupStack::PopAndDestroy( schedulerStopper );
 
     TInt count = 1; 
     for ( TInt i(0); i < count; i++ )
@@ -534,6 +628,11 @@
         }
 
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -551,19 +650,23 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::HandlePhonebookNotificationL( CStifItemParser& aItem )
+TInt T_CCCACmsContactFetcherWrapper::HandlePhonebookNotificationL( 
+        CStifItemParser& aItem )
     {
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
     _LIT( KHandlePhonebookNotification, "HandlePhonebookNotification" );
-    TestModuleIf().Printf( 0, KT_CCCACmsContactFetcherWrapper, KHandlePhonebookNotification );
+    TestModuleIf().Printf( 
+            0, KT_CCCACmsContactFetcherWrapper, KHandlePhonebookNotification );
     // Print to log file
     iLog->Log( KHandlePhonebookNotification );
     
-    User::LeaveIfError( SetupL( KTestOneContactFieldItem, MCCAParameter::EContactId ) );
+    User::LeaveIfError( SetupL( 
+            KTestOneContactFieldItem, MCCAParameter::EContactId ) );
         
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param );
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param );
     
     wrapper->AddObserverL( *this );
 
@@ -576,21 +679,28 @@
     
     if (modifiedNotDeleted)
         {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
         wrapper->HandlePhonebookNotificationL(ECmsContactModified);
         CompleteRequestL( &wrapper->iStatus, KErrNone );
         CompleteRequestL( &wrapper->iStatus, KErrNone );
-        // Observer is called 2 times when fetching contacts, and contacts are fetched again after they are changed so 1 + 2*2 = 5
-        T1L( iObserverCalledCount, 5); 
+        // Observer is called 2 times when fetching contacts, 
+        // and contacts are fetched again after they are changed so 1 + 2*2 = 5
+        T1L( iObserverCalledCount, 4); 
         TL( iObserverCalledWithContactsChanged);
         }
     else
         {
         wrapper->HandlePhonebookNotificationL(ECmsContactDeleted);
-        T1L( iObserverCalledCount, 3);
+        T1L( iObserverCalledCount, 2);
         }
         
     wrapper->RemoveObserver( *this );
-       
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -607,7 +717,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::TestContactStoreApiL( CStifItemParser& /*aItem */)
+TInt T_CCCACmsContactFetcherWrapper::TestContactStoreApiL( 
+        CStifItemParser& /*aItem */)
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
@@ -617,14 +728,15 @@
     iLog->Log( KDescription );
     
     User::LeaveIfError( SetupL( KTestNoDataFields, MCCAParameter::EContactId ) );
-        
     // setup
     CCCAParameter* param = CCCAParameter::NewL();
     CleanupStack::PushL( param );
-    CCCAppCmsContactFetcherWrapper* wrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
+    CCCAppCmsContactFetcherWrapper* wrapper = 
+            CCCAppCmsContactFetcherWrapper::CreateInstanceL( param ); 
     wrapper->AddObserverL( *this );
+
     CompleteRequestL( &wrapper->iStatus, KErrNone );
-    
+
     // test itself
     wrapper->iCmsContactDataFetcher.iContactStore_called = EFalse;
     TCmsContactStore cntStore = wrapper->ContactStore();
@@ -632,6 +744,11 @@
 
     // cleanup
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
@@ -645,12 +762,14 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt T_CCCACmsContactFetcherWrapper::FindFromOtherStoresL( CStifItemParser& /*aItem*/ )
+TInt T_CCCACmsContactFetcherWrapper::FindFromOtherStoresL( 
+        CStifItemParser& /*aItem*/ )
     {
     // Print to UI
     _LIT( KT_CCCACmsContactFetcherWrapper, "T_CCCACmsContactFetcherWrapper" );
     _LIT( KFindFromOtherStoresL, "FindFromOtherStoresL" );
-    TestModuleIf().Printf( 0, KT_CCCACmsContactFetcherWrapper, KFindFromOtherStoresL );
+    TestModuleIf().Printf( 
+            0, KT_CCCACmsContactFetcherWrapper, KFindFromOtherStoresL );
     // Print to log file
     iLog->Log( KFindFromOtherStoresL );
  
@@ -660,7 +779,8 @@
     CleanupStack::PushL( param );
     CCCAppCmsContactFetcherWrapper* wrapper = 
         CCCAppCmsContactFetcherWrapper::CreateInstanceL( 
-             param, CCCAppCmsContactFetcherWrapper::EFindContactFromOtherStores ); 
+             param, 
+             CCCAppCmsContactFetcherWrapper::EFindContactFromOtherStores ); 
     wrapper->AddObserverL( *this );
 
     // Since there is not needed external notifiers for the
@@ -678,18 +798,22 @@
     iSchedulerStarted = EFalse;
     delete schedulerStopper;
     schedulerStopper = NULL;
-    
     CompleteRequestL( &wrapper->iStatus, KErrNone );
+    iSchedulerStarted = EFalse;
     CompleteRequestL( &wrapper->iStatus, KErrNone );
-
     wrapper->RemoveObserver( *this );
+    if( wrapper->IsActive() )
+        {
+        TRequestStatus* status = &wrapper->iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
     wrapper->Release(); 
     wrapper = NULL;
 
     CleanupStack::PopAndDestroy( param );
     
     TL( iObserverCalled );
-    T1L( 2, iObserverCalledCount );    
+    T1L( 1, iObserverCalledCount );    
 
     return KErrNone;
     }
@@ -708,7 +832,8 @@
     iOngoingTestCase = aTestCase;
     
     // Ongoing test case
-    TInt err = RProperty::Define( KTestPropertyCat, ETestCaseStateProperty, RProperty::EInt );
+    TInt err = RProperty::Define( 
+            KTestPropertyCat, ETestCaseStateProperty, RProperty::EInt );
     if ( err != KErrAlreadyExists && err != KErrNone )
         {
         return ( err );
@@ -717,14 +842,24 @@
     
     
     // Parameter type used in CCAParameter creation
-    err = RProperty::Define( KTestPropertyCat, ETestParameterTypeProperty, RProperty::EInt );
+    err = RProperty::Define( 
+            KTestPropertyCat, ETestParameterTypeProperty, RProperty::EInt );
     if ( err != KErrAlreadyExists && err != KErrNone )
         {
         return ( err );
         }
-    err = RProperty::Set( KTestPropertyCat, ETestParameterTypeProperty, aParameterType );
+    err = RProperty::Set( 
+            KTestPropertyCat, ETestParameterTypeProperty, aParameterType );
     
-
+    CActiveScheduler* scheduler = new ( ELeave ) CActiveScheduler;
+    if( !CActiveScheduler::Current() )
+        {
+        CActiveScheduler::Install( scheduler );
+        }
+    else
+        {
+        delete scheduler;
+        }
     return KErrNone;
     }
 
@@ -733,12 +868,22 @@
 //
 // -----------------------------------------------------------------------------
 //
-void T_CCCACmsContactFetcherWrapper::CompleteRequestL( TRequestStatus* aStatus, TInt aReason )
+void T_CCCACmsContactFetcherWrapper::CompleteRequestL( 
+        TRequestStatus* aStatus, TInt aReason )
     {
     TRequestStatus* status = aStatus;
     User::RequestComplete( status, aReason );
+
     iSchedulerStarted = ETrue;
+    
+    CStopSchedulerAfterDelay* schedulerStopper = 
+        new (ELeave) CStopSchedulerAfterDelay();
+    schedulerStopper->ConstructL();
+    CleanupStack::PushL( schedulerStopper );
+    schedulerStopper->After( 1000000 );// 1 sec
     CActiveScheduler::Start();
+    CleanupStack::PopAndDestroy( schedulerStopper );
+
     }
 // ========================== OTHER EXPORTED FUNCTIONS =========================
 // None
--- a/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -184,7 +184,7 @@
 LIBRARY euser.lib cone.lib bafl.lib eikdlg.lib bitmaptransforms.lib
 LIBRARY eikcoctl.lib eikctl.lib eikcore.lib estor.lib fbscli.lib ecom.lib
 LIBRARY CentralRepository.lib efsrv.lib egul.lib
-LIBRARY hlplch.lib findutil.lib
+LIBRARY hlplch.lib findutil.lib charconv.lib
 LIBRARY form.lib etext.lib
 
 // Dependencies to AVKON
--- a/phonebookui/Phonebook2/inc/CPbk2AddressSelect.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/inc/CPbk2AddressSelect.h	Wed Mar 31 21:13:53 2010 +0300
@@ -146,6 +146,8 @@
         void SetSelectedFieldL(
                 const MVPbkStoreContactField* aField );
         HBufC* LoadDialogTitleL();
+        HBufC* GetVoiceAndVOIPCallDialogTitleL();
+        TBool IsVoiceCallExistL();
         TBool AreGeoFieldsForAddressesL();
         HBufC* GetVOIPDialogTitleL();
 
--- a/phonebookui/Phonebook2/inc/Pbk2AddressTools.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/inc/Pbk2AddressTools.h	Wed Mar 31 21:13:53 2010 +0300
@@ -21,6 +21,7 @@
 #include "TPbk2ContactEditorParams.h"
 #include <Pbk2FieldProperty.hrh>
 #include <VPbkFieldType.hrh>
+#include <MVPbkFieldType.h>
 #include <e32hashtab.h>
 
 class MVPbkStoreContact;
@@ -113,6 +114,30 @@
 				MVPbkStoreContact& aContact, 
 				TPbk2FieldGroupId aAddressGroup, 
 				RBuf& aText );
+	
+	 /**
+	 * Maps VPbkFieldType to field group
+	 *
+	 * @param aVPbkFieldType  Type of virtual phonebook field type
+	 * @return Suitable group id ( TPbk2FieldGroupId )
+	 */
+	IMPORT_C static TPbk2FieldGroupId MapVPbkFieldTypeToAddressGroupId( 
+			const MVPbkFieldType* aVPbkFieldType );
+	
+	 /**
+	 * Judge whether the address preview of one contact is empty
+	 * Address preview include the following four fields: 
+	 * EVPbkVersitSubFieldStreet, EVPbkVersitSubFieldLocality, 
+	 * EVPbkVersitSubFieldRegion and EVPbkVersitSubFieldCountry.
+	 * If the four fields are all empty, return ETrue; Otherwise, return EFalse.
+	 *
+	* @param aContact  contact
+	* @param aAddressGroup  field group
+	* @return If address preview is empty, return ETrue; Otherwiase, EFalse
+	 */
+	IMPORT_C static TBool IsAddressPreviewEmptyL( 
+			MVPbkStoreContact& aContact,
+			TPbk2FieldGroupId aAddressGroup );
 	};
 
 #endif // PBK2ADDRESSTOOLS_H
--- a/phonebookui/Phonebook2/loc/phonebook2ece.loc	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/loc/phonebook2ece.loc	Wed Mar 31 21:13:53 2010 +0300
@@ -196,12 +196,6 @@
 //
 #define qtn_cca_opt_select_other_address "Select other address"
 
-// d:Command in options menu for viewing the image.
-// l:list_single_pane_t1_cp2
-// r:5.0
-//
-#define qtn_cca_opt_view_image "View image"
-
 // d:Text for the call communication method.
 // l:list_single_large_graphic_pane_t1
 // r:5.0
@@ -594,7 +588,7 @@
 // l:list_single_pane_t1_cp2
 // r:5.0
 //
-#define qtn_cca_options_view_image "View image"
+#define qtn_phob_opt_view_image "View image"
 
 // d:Remove image command in details view options menu
 // l:list_single_pane_t1_cp2
@@ -940,4 +934,10 @@
 //
 #define qtn_phob_my_card_clear "Clear My Card data"
 
+// d:Change image command in details view options menu
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_phob_opt_change_image "Change image"
+
 // End of File
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/bld.inf	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/bld.inf	Wed Mar 31 21:13:53 2010 +0300
@@ -33,7 +33,7 @@
 PRJ_EXPORTS
 
 ../rom/pbk2rclcontactactionservice.iby CORE_APP_LAYER_IBY_EXPORT_PATH(pbk2rclcontactactionservice.iby)
-../rom/pbk2rclcontactactionserviceresources.iby CORE_APP_LAYER_IBY_EXPORT_PATH(pbk2rclcontactactionserviceresources.iby)
+../rom/pbk2rclcontactactionserviceresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(pbk2rclcontactactionserviceresources.iby)
 
 ../conf/pbk2rclactionpriorities.confml             APP_LAYER_CONFML(pbk2rclactionpriorities.confml)
 ../conf/pbk2rclactionpriorities_20029F45.crml      APP_LAYER_CRML(pbk2rclactionpriorities_20029F45.crml)
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/pbk2rclcontactactionservice.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/group/pbk2rclcontactactionservice.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -103,7 +103,7 @@
 SOURCEPATH             ../data
 START RESOURCE         pbk2rclactionutils.rss
 DEPENDS vpbkeng.rsg
-TARGETPATH RESOURCE_FILES_DIR
+TARGETPATH             APP_RESOURCE_DIR
 HEADER
 LANGUAGE_IDS
 END //RESOURCE
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionservice.iby	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionservice.iby	Wed Mar 31 21:13:53 2010 +0300
@@ -20,7 +20,6 @@
 
 // Main service files
 ECOM_PLUGIN(pbk2rclcontactactionservice.dll, pbk2rclcontactactionservice.rsc)
-data=DATAZ_\RESOURCE_FILES_DIR\pbk2rclactionutils.rsc        RESOURCE_FILES_DIR\pbk2rclactionutils.rsc
 
 // Plugins
 ECOM_PLUGIN(pbk2rclcallplugin.dll, pbk2rclcallplugin.rsc)
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionserviceresources.iby	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/rom/pbk2rclcontactactionserviceresources.iby	Wed Mar 31 21:13:53 2010 +0300
@@ -31,6 +31,8 @@
 
 S60_APP_RESOURCE(pbk2rclsendbusinesscardpluginimpl)
 
+S60_APP_RESOURCE(pbk2rclactionutils)
+
 #endif // __PBK2RCLCONTACTACTIONSERVICERESOURCES_IBY__
 
 // End of file
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/CFscFieldPropertyArray.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/CFscFieldPropertyArray.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -68,7 +68,7 @@
     {
     FUNC_LOG;
 
-    TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
+    TFileName resourceFileName( KDC_APP_RESOURCE_DIR );
     resourceFileName.Append(KFscRscFileName);
     BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
     TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );    
@@ -239,7 +239,7 @@
 CFscFieldOrderingManager* CFscFieldPropertyArray::CreateFieldOrderingsLC(void)
     {
     FUNC_LOG;
-    TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
+    TFileName resourceFileName( KDC_APP_RESOURCE_DIR );
     resourceFileName.Append(KFscRscFileName);
     BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
     TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );    
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/cfscactionutils.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/src/cfscactionutils.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -1270,7 +1270,7 @@
 TInt CFscActionUtils::FindAndAddResourceFileL()
     {
     FUNC_LOG;
-    TFileName resourceFileName( KDC_RESOURCE_FILES_DIR );
+    TFileName resourceFileName( KDC_APP_RESOURCE_DIR );     
     resourceFileName.Append(KFscRscFileName);
     BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(), resourceFileName );
     TInt offset = CCoeEnv::Static()->AddResourceFileL( resourceFileName );
--- a/phonebookui/Phonebook2/remotecontactlookup/engine/group/pbk2rclengine.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/engine/group/pbk2rclengine.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -106,6 +106,6 @@
 START RESOURCE	engine.rss
 HEADER
 TARGET          pbk2rclengine.rsc
-TARGETPATH      resource/apps
+TARGETPATH      APP_RESOURCE_DIR
 LANGUAGE_IDS
 END
--- a/phonebookui/Phonebook2/remotecontactlookup/engine/inc/cpbkxrclsearchresultlistbox.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/engine/inc/cpbkxrclsearchresultlistbox.h	Wed Mar 31 21:13:53 2010 +0300
@@ -163,6 +163,12 @@
     
     };
 
+
+
+//This strange old override below (class CPbkxRclSearchResultListView) causes on hardware empty 
+//list text not to draw. Most likely no need for this kind override at all.
+//To fix draw this override is not used (however is part of pbk2rclengine api
+//and therefore not removed completely)
 ////////////////////////////////////////////////////////////////////////////
 // CPbkxRclSearchResultListView
 ////////////////////////////////////////////////////////////////////////////
--- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultlistbox.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultlistbox.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -145,7 +145,14 @@
 //
 CListBoxView* CPbkxRclSearchResultListBox::MakeViewClassInstanceL()
     {
-    return ( new (ELeave) CPbkxRclSearchResultListView() );
+
+//This strange old override below (returning class CPbkxRclSearchResultListView) causes on hardware empty 
+//list text not to draw. Most likely no need for this kind override at all.
+//To fix draw this override is not used (however is part of pbk2rclengine api
+//and therefore not removed completely)
+//    return ( new (ELeave) CPbkxRclSearchResultListView() );
+
+    return ( new (ELeave) CAknColumnListBoxView() );    
     }
 
 ////////////////////////////////////////////////////////////////////////////
@@ -254,6 +261,12 @@
     TRAP_IGNORE( AknsUtils::SetAvkonSkinEnabledL( skinEnabled ) );
     }
 
+
+
+//This strange old override below (CPbkxRclSearchResultListView) causes on hardware empty 
+//list text not to draw. Most likely no need for this kind override at all.
+//To fix draw this override is not used (however is part of pbk2rclengine api
+//and therefore not removed completely)
 ////////////////////////////////////////////////////////////////////////////
 // CPbkxRclSearchResultListView
 ////////////////////////////////////////////////////////////////////////////
--- a/phonebookui/Phonebook2/remotecontactlookup/group/bld.inf	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/group/bld.inf	Wed Mar 31 21:13:53 2010 +0300
@@ -28,7 +28,7 @@
 PRJ_EXPORTS
 ../loc/phonebook2rcl.loc APP_LAYER_LOC_EXPORT_PATH(phonebook2rcl.loc)
 ../rom/pbk2remotecontactlookup.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(pbk2remotecontactlookup.iby)
-../rom/pbk2remotecontactlookupresources.iby CORE_APP_LAYER_IBY_EXPORT_PATH(pbk2remotecontactlookupresources.iby)
+../rom/pbk2remotecontactlookupresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(pbk2remotecontactlookupresources.iby)
 
 // Generic configuration interface for component cenrep settings  
 // component_1000292B implementation specifics for cenrep data
--- a/phonebookui/Phonebook2/remotecontactlookup/settingplugin/data/fscrclsettinginformation.rss	Mon Mar 15 12:39:26 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +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:  Resource definitions for project Freestyle 2 Contacts 
-*                RemoteContactLookup setting plugin.
-*
-*/
-
-
-#include "../../../inc/Pbk2InternalUID.h"   //KFscRclSettingExtensionImplementationUID from pbk2internaluid.h
-
-// --------------------------------------------------------------------------
-// r_fsc_rcl_setting_extension_information
-// Extension information
-// --------------------------------------------------------------------------
-//
-RESOURCE PHONEBOOK2_EXTENSION_INFORMATION r_fsc_rcl_setting_extension_information
-    {
-    version = 0;
-    implementationUid = KFscRclSettingExtensionImplementationUID;
-    loadingPolicy = KPbk2LoadOnSettingsExecution;  
-    
-    // NO Commands
-    menuCommandRange = PHONEBOOK2_EXTENSION_RANGE
-        {
-        firstId = 0;
-        lastId  = 0;
-        };   
-    
-    overwrittenCommands = {};
-    
-    extensionMenus = {};
-    }
-    
-// ---------------------------------------------------------
-// The RCL settings list
-// ---------------------------------------------------------
-//
-RESOURCE AVKON_SETTING_ITEM_LIST r_rcl_setting_list
-    {
-    title = "Settings";
-    }
-
-//END OF FILE
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -23,6 +23,7 @@
 #include <TPbk2IconId.h>
 #include <AknIconUtils.h>
 #include <fbs.h>
+#include <Pbk2NamesListExUID.h>
 
 // CONSTS
 
@@ -34,9 +35,8 @@
 // Staring index for icon id's
 const TInt KIconIndexStartValue = 500;
 
-// TODO: aquire proper uid
 // Used UID for icon id's
-const TInt KIconUidValue        = 3;
+const TInt KIconUidValue        = KPbk2NamesListExtPluginUID2;
 }
 
 /**
--- a/phonebookui/Phonebook2/xSPExtensionManager/rss/ExtensionManagerRes.rss	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/xSPExtensionManager/rss/ExtensionManagerRes.rss	Wed Mar 31 21:13:53 2010 +0300
@@ -169,10 +169,9 @@
     buttons =
         {
         CBA_BUTTON { id = EExtensionManagerCmdMove; txt = qtn_extension_manager_softkey_move; },
-        CBA_BUTTON { id = EAknSoftkeyExit; txt = text_softkey_exit; }
+        CBA_BUTTON { id = EAknSoftkeyBack; txt = text_softkey_back; }
         };
     }
-
 RESOURCE AVKON_VIEW r_extension_manager_sort_view
     {
     cba = r_extension_manager_sort_view_softkeys;
--- a/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -22,6 +22,9 @@
 #include "CxSPSortViewControl.h"
 
 // System includes
+#include <eiklbi.h>
+#include <eiklbx.h> 
+#include <AknUtils.h>
 #include <AknGlobalNote.h>
 #include <aknnavi.h>
 #include <aknnavide.h>
@@ -99,7 +102,7 @@
     {
     switch (aCommand)
         {
-        case EAknSoftkeyExit: // Exit softkey
+        case EAknSoftkeyBack: // Back softkey
             {
             TBool changes = iContainer->CommitSortL( this );
             if( !changes )
@@ -116,22 +119,20 @@
         case EExtensionManagerCmdMove: // Move softkey
         	{
         	iContainer->SetCurrentItemMarkedL( ETrue );
-        	iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
-        	iView.Cba()->DrawDeferred();
+            UpdateCbasL( R_AVKON_SOFTKEYS_OK_CANCEL );
         	break;
         	}
         case EAknSoftkeyOk: // Ok softkey
         	{
         	iContainer->MoveMarkedItemL();
-        	iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
-        	iView.Cba()->DrawDeferred();
+            UpdateCbasL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
         	break;
         	}
         case EAknSoftkeyCancel: // Cancel softkey
         	{
         	iContainer->SetCurrentItemMarkedL( EFalse );
-        	iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
-        	iView.Cba()->DrawDeferred();
+            UpdateCbasL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
+
         	break;
         	}
         default:
@@ -163,15 +164,19 @@
 	 
     if (!iContainer)
         {
-        iContainer = CxSPSortViewControl::NewL( iViewIdChanger, iExtensions );
+        iContainer = CxSPSortViewControl::NewL( iViewIdChanger, iExtensions, iView );
         CCoeEnv::Static()->AppUi()->AddToStackL( iView, iContainer );        
         iContainer->SetMopParent( &iView );        
-        iContainer->SetRect( iView.ClientRect() );
+        iContainer->SetRect( iView.ClientRect() );      
+        
+        CCoeControl& ctrl=iContainer->ComponentControl();
+        CEikListBox& listbox=static_cast <CEikListBox&> (ctrl);
+        listbox.SetListBoxObserver( this );
+        
         iContainer->ActivateL();
         
-        // Load the default cba for the sort view
-        iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
-        
+        UpdateCbasL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
+         
         // Invoke DrawNow() to avoid the cba flicker
         iView.Cba()->DrawNow();
         } 
@@ -193,6 +198,44 @@
     sp->DrawNow();
 	}
 
+void CxSPSortView::UpdateCbasL( TInt aResourceId )
+    {
+    CCoeControl& ctrl=iContainer->ComponentControl();
+    CEikListBox& listbox=static_cast <CEikListBox&> (ctrl);
+       
+    TBool noItemHightLighted = listbox.View()->ItemDrawer()->Flags() & CListItemDrawer::ESingleClickDisabledHighlight;
+    
+    if ( aResourceId == R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS )
+        {
+        if ( noItemHightLighted )
+            {
+            // Load the default cba for the sort view
+            iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_BACK );
+            }
+        else
+            {
+            // Load the default cba for the sort view
+            iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS );
+            }
+        iView.Cba()->DrawDeferred();
+        }
+    else if ( aResourceId == R_AVKON_SOFTKEYS_OK_CANCEL )
+        {
+        if ( noItemHightLighted )
+            {
+            // Load the default cba for the sort view
+            iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_CANCEL );
+            }
+        else
+            {
+            // Load the default cba for the sort view
+            iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+            }
+        iView.Cba()->DrawDeferred();
+        }
+    
+    }
+
 void CxSPSortView::DoDeactivate()
 	{
     if (iContainer)
@@ -223,6 +266,35 @@
         }
     }
 
+void CxSPSortView::HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType)
+    {
+    if( AknLayoutUtils::PenEnabled() )
+        {
+        switch ( aEventType )
+            {
+            case EEventItemSingleClicked:
+                {
+                CCoeControl& ctrl=iContainer->ComponentControl();
+                CEikListBox& listbox=static_cast <CEikListBox&> (ctrl);
+                const CListBoxView::CSelectionIndexArray* inds = listbox.SelectionIndexes();
+                TInt count = inds->Count();
+                 
+                if ( count <= 0 )
+                     {
+                     HandleCommandL( EExtensionManagerCmdMove );
+                     }
+                 else
+                     {
+                     HandleCommandL( EAknSoftkeyOk );
+                     }
+                break;
+                }
+            default:
+               break;
+            }
+          }
+    }
+
 void CxSPSortView::GlobalNoteClosed( const TInt aResult )
     {
     PBK2_DEBUG_PRINT(
--- a/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortView.h	Wed Mar 31 21:13:53 2010 +0300
@@ -22,6 +22,7 @@
 
 //  INCLUDES
 #include <e32base.h>
+#include <eiklbo.h>
 #include "CxSPBaseView.h"
 #include "MGlobalNoteObserver.h"
 
@@ -40,7 +41,7 @@
  * Sort view for Extension Manager. Provides extension sorting UI
  * for user.
  */
-class CxSPSortView : public CxSPBaseView, public MGlobalNoteObserver
+class CxSPSortView : public CxSPBaseView, public MGlobalNoteObserver, public MEikListBoxObserver
     {
     public: // Constructor
 
@@ -63,7 +64,9 @@
 		void DoDeactivate();
         void HandleCommandL( TInt aCommand );
         void HandleStatusPaneSizeChange();
-
+        
+    void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
+    
    	private: // From CxSPBaseView
 
    		void DoActivateViewL( const TVwsViewId& aPrevViewId,
@@ -97,6 +100,9 @@
          * Standard C++ destructor.
          */
         ~CxSPSortView();
+   
+   	private:
+        void UpdateCbasL( TInt aResourceId );
 
     private: // Data
 
--- a/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -26,6 +26,7 @@
 #include <gulicon.h>
 #include <AknGlobalNote.h>
 #include <StringLoader.h>
+#include <avkon.hrh>
 
 // internal includes
 #include "CxSPLoader.h"
@@ -39,6 +40,7 @@
 #include <MPbk2ApplicationServices.h>
 #include <CPbk2ServiceManager.h>
 #include <MPbk2AppUi.h>
+#include <CPbk2UIExtensionView.h>
 
 // CONSTANTS
 _LIT( KTab, "\t" );
@@ -58,11 +60,13 @@
 // ================= MEMBER FUNCTIONS =======================
 
 CxSPSortViewControl::CxSPSortViewControl( CxSPViewIdChanger& aViewIdChanger, 
-											CxSPArray& aExtensions ) :
+											CxSPArray& aExtensions,
+											CPbk2UIExtensionView& aView ) :
 											iViewIdChanger( aViewIdChanger ),
 											iExtensions(aExtensions),
 											iGlobalNote(0),
-											iGlobalNoteObserver(0)
+											iGlobalNoteObserver(0),
+											iView( aView )
     {
     }
 
@@ -82,18 +86,20 @@
     }
 
 CxSPSortViewControl* CxSPSortViewControl::NewL( CxSPViewIdChanger& aViewIdChanger,
-											CxSPArray& aExtensions )
+											CxSPArray& aExtensions, 
+											CPbk2UIExtensionView& aView )
     {
-    CxSPSortViewControl* self = NewLC( aViewIdChanger, aExtensions );
+    CxSPSortViewControl* self = NewLC( aViewIdChanger, aExtensions, aView );
     CleanupStack::Pop(self);
     return self;
     }
 
 CxSPSortViewControl* CxSPSortViewControl::NewLC( CxSPViewIdChanger& aViewIdChanger,
-											CxSPArray& aExtensions )
+											CxSPArray& aExtensions, 
+											CPbk2UIExtensionView& aView )
     {
     CxSPSortViewControl* self =
-        new (ELeave) CxSPSortViewControl( aViewIdChanger, aExtensions );
+        new (ELeave) CxSPSortViewControl( aViewIdChanger, aExtensions, aView );
     CleanupStack::PushL(self);
     self->ConstructL();
     return self;
@@ -111,10 +117,57 @@
         (const TKeyEvent& aKeyEvent,TEventCode aType)
     {
     TKeyResponse result = EKeyWasNotConsumed;
-	if( iListBox )
+    
+	if( iListBox && result == EKeyWasNotConsumed )
         {
         result = iListBox->OfferKeyEventL(aKeyEvent, aType);
         }
+	
+    // Update popup when moving up or down in the list
+     switch(aKeyEvent.iCode)
+         {
+         case EKeyUpArrow:
+         case EKeyDownArrow:
+             {
+             const CListBoxView::CSelectionIndexArray* inds = iListBox->SelectionIndexes();
+             TInt count = inds->Count();
+             
+             if ( count <= 0 )
+                 {
+                 iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS  );
+                 }
+             else
+                 {
+                 iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                 }
+             iView.Cba()->DrawDeferred();
+
+             break;
+             }
+         case EKeyEnter:
+         case EKeyOK: 
+             {
+             const CListBoxView::CSelectionIndexArray* inds = iListBox->SelectionIndexes();
+             TInt count = inds->Count();
+             
+             if ( count <= 0 )
+                 {
+                 SetCurrentItemMarkedL( ETrue );
+                 iView.Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OK_CANCEL );
+                 }
+             else
+                 {
+                 MoveMarkedItemL();
+                 iView.Cba()->SetCommandSetL( R_EXTENSION_MANAGER_SORT_VIEW_SOFTKEYS  );
+                 }
+             iView.Cba()->DrawDeferred();
+             break;
+             }
+         default:
+             {
+             break;
+             }
+         }
     return result;
     }
 
@@ -139,6 +192,19 @@
     return iListBox;
     }
 
+void CxSPSortViewControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+    {
+    if ( iListBox )
+        {
+        iListBox->HandlePointerEventL( aPointerEvent );
+        }
+    }
+
+CCoeControl& CxSPSortViewControl::ComponentControl() const
+    {
+    return *iListBox;
+    }
+
 void CxSPSortViewControl::SetListBoxContentsL()
 	{ 
 	_LIT( KFormat, "%d" );
@@ -281,6 +347,7 @@
 void CxSPSortViewControl::MoveMarkedItemL()
 	{
 	TInt currentIndex = iListBox->CurrentItemIndex();
+
 	TInt markedIndex = -1;
 	
 	const CListBoxView::CSelectionIndexArray* inds = iListBox->SelectionIndexes();
--- a/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.h	Wed Mar 31 21:13:53 2010 +0300
@@ -23,6 +23,7 @@
 #include <coecntrl.h>     // CCoeControl
 #include <cntdef.h>       // TContactItemId
 
+
 // FORWARD DECLARATIONS
 class CAknSingleGraphicStyleListBox;
 class CxSPLoader;
@@ -30,6 +31,7 @@
 class MGlobalNoteObserver;
 class CAknGlobalNote;
 class CGlobalNoteObserver;
+class CPbk2UIExtensionView;
 
 typedef CArrayPtrFlat<CxSPLoader> CxSPArray;
 
@@ -47,7 +49,8 @@
          * @param aExtensions array of extensions
          */
         static CxSPSortViewControl* NewL( CxSPViewIdChanger& aViewIdChanger,
-        									CxSPArray& aExtensions );
+        									CxSPArray& aExtensions, 
+        									CPbk2UIExtensionView& aView);
 
         /**
          * Creates a new CxSPSortViewControl and leaves it to
@@ -55,7 +58,8 @@
          * @see NewL
          */
         static CxSPSortViewControl* NewLC( CxSPViewIdChanger& aViewIdChanger,
-        									CxSPArray& aExtensions );
+        									CxSPArray& aExtensions, 
+        									CPbk2UIExtensionView& aView );
 
         /**
          * Destructor.
@@ -68,9 +72,13 @@
         void SizeChanged();
         TInt CountComponentControls() const;
         CCoeControl* ComponentControl( TInt aIndex ) const;
+        
+        void HandlePointerEventL(const TPointerEvent& aPointerEvent);
 
     public: // Implementation
-
+        
+        CCoeControl& CxSPSortViewControl::ComponentControl() const;
+        
     	/**
     	 * Sets the listbox data
     	 */
@@ -107,7 +115,7 @@
          * @param aViewIdChanger Reference to view id changer
          * @param aExtensions array of extensions
          */
-        CxSPSortViewControl( CxSPViewIdChanger& aViewIdChanger, CxSPArray& aExtensions );
+        CxSPSortViewControl( CxSPViewIdChanger& aViewIdChanger, CxSPArray& aExtensions, CPbk2UIExtensionView& aView );
 
         /**
          * Performs the 2nd phase of construction.
@@ -121,6 +129,9 @@
 
         /// Own: list box control
         CAknSingleGraphicStyleListBox* iListBox;
+        
+        /// not own: sortview
+        CPbk2UIExtensionView& iView;
 
         /// Ref: Array of extensions
         CxSPArray& iExtensions;
--- a/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -157,9 +157,9 @@
 const TInt KNullIndexData(-1);
 const TInt32 KVmbxUid(0x100058F5) ;
 const TInt KOperatorNameLength(100);
-const TInt KIconsCount(13);
-const TInt KIconsIdCount(11);
-const TInt KIconsMaskCount(11);
+const TInt KIconsCount(14);
+const TInt KIconsIdCount(12);
+const TInt KIconsMaskCount(12);
 
 _LIT(KNullCell, "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%d\t");
 _LIT(KDesTab, "\t");
@@ -448,12 +448,13 @@
     iSkinIcons->Append( KAknsIIDQgnPropNrtypFax );
     iSkinIcons->Append( KAknsIIDQgnPropNrtypPager );
     iSkinIcons->Append( KAknsIIDQgnPropNrtypCar );
-    if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) )
+    if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
     	{
-        iSkinIcons->Append( KAknsIIDQgnPropNrtypVoip );  
+        iSkinIcons->Append( KAknsIIDQgnPropNrtypVoip ); 
+        iSkinIcons->Append( KAknsIIDQgnPropNrtypSwis );
         }
     iSkinIcons->Append( KAknsIIDQgnPropNrtypAssistant );
-    iSkinIcons->Append(KAknsIIDQgnPropEmpty);
+    iSkinIcons->Append( KAknsIIDQgnPropEmpty );
     iSkinIcons->Append( KAknsIIDQgnPropNrtypEmail );
     iSkinIcons->Append( KAknsIIDQgnPropNrtypAddress );
     
@@ -462,49 +463,52 @@
     iIcons->Append( EMbmAvkonQgn_prop_nrtyp_phone );
     iIcons->Append( EMbmAvkonQgn_prop_nrtyp_home );
     iIcons->Append( EMbmAvkonQgn_prop_nrtyp_work );
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_mobile  );
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_video  );
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_fax  );
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_pager  );
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_car  );
-    if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) )
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_mobile );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_video );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_fax );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_pager );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_car );
+    if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
     	{
-        iIcons->Append( EMbmAvkonQgn_prop_nrtyp_voip   );
+        iIcons->Append( EMbmAvkonQgn_prop_nrtyp_voip );
+        iIcons->Append( EMbmAvkonQgn_prop_empty );
     	}
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_assistant  );
-    iIcons->Append( EMbmAvkonQgn_prop_empty);
-    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_email  );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_assistant );
+    iIcons->Append( EMbmAvkonQgn_prop_empty );
+    iIcons->Append( EMbmAvkonQgn_prop_nrtyp_email );
     iIcons->Append( EMbmAvkonQgn_prop_nrtyp_address );
     
-    iIconsId->Append( EPbkqgn_prop_nrtyp_phone  );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_phone );
     iIconsId->Append( EPbkqgn_prop_nrtyp_home );
     iIconsId->Append( EPbkqgn_prop_nrtyp_work );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_mobile  );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_video  );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_fax  );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_pager  );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_car  );
-    if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) )
+    iIconsId->Append( EPbkqgn_prop_nrtyp_mobile );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_video );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_fax );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_pager );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_car );
+    if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
     	{
-    	iIconsId->Append( EPbkqgn_prop_nrtyp_voip   );
+    	iIconsId->Append( EPbkqgn_prop_nrtyp_voip );
+    	iIconsId->Append( EPbkqgn_prop_nrtyp_swis );
     	}
-    iIconsId->Append( EPbkqgn_prop_nrtyp_assistant  );
-    iIconsId->Append( EPbkqgn_prop_nrtyp_empty);
+    iIconsId->Append( EPbkqgn_prop_nrtyp_assistant );
+    iIconsId->Append( EPbkqgn_prop_nrtyp_empty );
     
     iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_phone_mask );
     iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_home_mask );
     iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_work_mask );
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_mobile_mask  );
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_video_mask  );
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_fax_mask  );
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_pager_mask  );
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_car_mask  );
-    if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) )
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_mobile_mask );
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_video_mask );
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_fax_mask );
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_pager_mask );
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_car_mask );
+    if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
     	{
-    	iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_voip_mask   );
+    	iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_voip_mask );
+    	iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask );
     	}
-    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_assistant_mask  );
-    iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask);
+    iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_assistant_mask );
+    iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask );
     }
 // ---------------------------------------------------------
 // CSpdiaControl::CSpdiaControl
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h	Wed Mar 31 21:13:53 2010 +0300
@@ -304,11 +304,6 @@
 		RPointerArray<CPcsCache> iPcsCache; 
 
 		/**
-		* Keeps the count of caches
-		*/
-		TUint8 iCacheCount; 
-
-		/**
 		* Instance of key map
 		* Own.
 		*/
@@ -324,7 +319,6 @@
 		*/
 		CPcsAlgorithm1Helper* iHelper;
 		CPcsAlgorithm1MultiSearchHelper* iMultiSearchHelper;
-
 		
 		/**
 		* Global that keeps the updated status of the caching
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1FilterHelper.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1FilterHelper.h	Wed Mar 31 21:13:53 2010 +0300
@@ -92,7 +92,7 @@
 		/**
 		 * 2nd phase construtor
 		 */
-		void ConstructL(TSortType aSortType);   
+		void ConstructL(TSortType aSortType);
 		
 		/**
 		* Adds each result into respective pool based on match pattern
@@ -103,7 +103,7 @@
 		* Searches for for aSeq in iMatchPatternDetails and returns index 
         * where input sequence is found. Returns -1 if not found
 		*/
-		TInt FindSequence(TDesC* aSeq);
+		TInt FindSequence(const TDesC& aSeq);
 		
 		
 		/**
@@ -111,19 +111,19 @@
         * and returns index where input sequence is found. 
         * Returns -1 if not found
 		*/
-		TInt FindSubSequence(TDesC* aSeq,TInt aPatternIndex);
+		TInt FindSubSequence(const TDesC& aSeq, TInt aPatternIndex);
 		
 		/**
 		* Creates the Matchpattern aSeq in  iMatchPatternDetails.
         * Returns the index of the sequence in iMatchPatternDetails
         */
-		TInt CreateMatchPatternDetailsAndPoolsL(TDesC* aSeq);
+		TInt CreateMatchPatternDetailsAndPoolsL(const TDesC& aSeq);
 		
 		/**
 		* Searches for all the subsequences of aSeq and updates the 
 		* aFirstOccrVal in iMatchPatternDetails.
         */
-		void UpdateForSubSequencesL(TDesC& aSeq,TInt aFirstOccrVal);
+		void UpdateForSubSequencesL(const TDesC& aSeq, TInt aFirstOccrVal);
 
 	private:
 		
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Helper.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Helper.h	Wed Mar 31 21:13:53 2010 +0300
@@ -77,15 +77,6 @@
                                   TBool isSearchInGroup,
                                   RArray<TInt>& aContactsInGroup);
 
-        /**
-         * Constructs a bit pattern using the required/supported data fields
-         * For example, 6, 4 and 27 are supported fields <-- 00000111
-         *              6 and 4 are required fields      <-- 00000011
-         * Bit pattern returned is 00000011.
-         */
-        TUint8 FilterDataFieldsL(RArray<TInt>& aRequiredDataFields,
-                                 RArray<TInt>& aSupportedDataFields);
-
     public:
 
         /**
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1MultiSearchHelper.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1MultiSearchHelper.h	Wed Mar 31 21:13:53 2010 +0300
@@ -102,15 +102,6 @@
 
     private:
     
-         /**
-          * Constructs a bit pattern using the required/supported data fields
-          * For example, 6, 4 and 27 are supported fields <-- 00000111
-          *              6 and 4 are required fields      <-- 00000011
-          * Bit pattern returned is 00000011.
-          */
-         TUint8 FilterDataFieldsL(RArray<TInt>& aRequiredDataFields,
-                                  RArray<TInt>& aSupportedDataFields);
-
         /**
 		 * Set the bits corresponding to word matches
 		 *
@@ -133,11 +124,6 @@
          * Resets iWordMatches member variable
          */
         void ClearWordMatches();
-
-        /**
-         * Appends uppercased match to sequence, not allowing duplicates.
-         */
-        void AppendMatchToSeqL( RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch  );
         
     public:
         
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h	Wed Mar 31 21:13:53 2010 +0300
@@ -98,7 +98,21 @@
          * Check if the input URI is of contact search in a group template form
          */
         static TBool IsGroupUri(TDesC& aURI);
-                                    
+
+        /**
+         * Constructs a bit pattern using the required/supported data fields
+         * For example, 6, 4 and 27 are supported fields <-- 00000111
+         *              6 and 4 are required fields      <-- 00000011
+         * Bit pattern returned is 00000011.
+         */
+        static TUint8 FilterDataFieldsL(const RArray<TInt>& aRequiredDataFields,
+                                        const RArray<TInt>& aSupportedDataFields);
+    
+        /**
+         * Create upper-case match sequence buffer from matching part and append it to
+         * array unless there's equal sequence already present.
+         */
+        static void AppendMatchToSeqL( RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch );
 };
 
 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h	Wed Mar 31 21:13:53 2010 +0300
@@ -99,10 +99,6 @@
 		*/
 		TUint8 GetUriId();
 
-		/**
-		* Returns the URI for this cache
-		*/
-		HBufC* GetUri();
 	    /**
 	    * Sets sort order for data fields
 	    */
@@ -191,7 +187,7 @@
 		/**
 		* Internal URI id for this cache
 		*/
-		TInt8 iUriId;
+		TUint8 iUriId;
 
 		/**
 		* Current status of this cache
@@ -201,18 +197,18 @@
 		/**
 		* List of data fields (mapped to VPbk ids) supported by this cache
 		*/
-		RArray<TInt> 	iDataFields;
+		RArray<TInt> iDataFields;
 		/**
 		* Sort order of data fields expected by the clients
 		*/
-		RArray<TInt>    iSortOrder;
+		RArray<TInt> iSortOrder;
 		
 		/**
 		* Order of indexes determined by correlating iDataFields and iSortOrder
 		* Each CPsData data element fields need to be compared in this order
 		* to get the client expected sort order for this cache.
 		*/
-		RArray<TInt>    iIndexOrder;
+		RArray<TInt> iIndexOrder;
 		
 };
 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsKeyMap.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsKeyMap.h	Wed Mar 31 21:13:53 2010 +0300
@@ -73,6 +73,9 @@
          */
         virtual ~CPcsKeyMap();
 
+        TBool IsItutPredictiveAvailable() const;
+        TBool IsQwertyPredictiveAvailable() const;
+
         static TBool IsModePredictive( TKeyboardModes aKbMode );
 
         /**
@@ -125,9 +128,10 @@
         void ConstructL();
 
         /**
-         * Select keyboard types according to available physical keyboard(s)
+         * Get physical Itu-T and QWERTY keyboard types of the device
          */
-        void SetupKeyboardTypesL();
+        void GetPhysicalKeyboardTypesL( TPtiKeyboardType& aItutKbType,
+                                        TPtiKeyboardType& aQwertyKbType );
 
         /**
          * Returns the pool Id for a key
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -76,7 +76,6 @@
     
     iCacheStatus = ECachingNotStarted;  // Starting status
     iCacheError = KErrNone;             // No error
-    iCacheCount = 0;                    // No data
         
     iPluginLauncher = CIdle::NewL( CActive::EPriorityStandard );
     
@@ -233,8 +232,8 @@
     PRINT ( _L("End CPcsAlgorithm1::ReplaceZeroWithSpaceL") );
 
     return  queryModified;
-}  
-   
+}
+
 // ----------------------------------------------------------------------------
 // CPcsAlgorithm1::PerformSearchL
 // Search function for cache
@@ -242,7 +241,7 @@
 void  CPcsAlgorithm1::PerformSearchL(const CPsSettings& aSettings,
                                      CPsQuery& aQuery,
                                      RPointerArray<CPsClientData>& aSearchResults,
-                                     RPointerArray<CPsPattern>& aSearchSeqs)                                    
+                                     RPointerArray<CPsPattern>& aSearchSeqs)
 {
 	PRINT ( _L("Enter CPcsAlgorithm1::PerformSearchL") );
 	
@@ -323,26 +322,24 @@
 	// ------------------------------------------------------------------------
 
     // ------------------ Write result objects to the stream ------------------
-	// Truncate the result set if required
-	TInt numToDisplay = aSettings.MaxResults();
-	TInt resultSet = tempSearchResults.Count();
-	
-	if( resultSet > numToDisplay && numToDisplay != -1)
-	{
-		// Copy the top N contents from tempSearchResults to the results stream
-		for(int i = 0; i < numToDisplay; i++)
-		{
-			aSearchResults.Append(WriteClientDataL(*(tempSearchResults[i])));
-		}
-	}
-	else
-	{
-		// Copy all the contents from tempSearchResults to the results stream
-		for(TInt i = 0; i < resultSet; i++)
-		{
-			aSearchResults.Append(WriteClientDataL(*(tempSearchResults[i])));
-		}
-	}
+    // Truncate the result set if required
+    TInt maxNumToDisplay = aSettings.MaxResults();
+    TInt resultSetCount = tempSearchResults.Count();
+    TInt numToDisplay = 0;
+    if ( maxNumToDisplay == -1 )
+        {
+        numToDisplay = resultSetCount;
+        }
+    else
+        {
+        numToDisplay = Min( maxNumToDisplay, resultSetCount );
+        }
+
+    // Copy desired number of results from tempSearchResults to the results stream
+    for (TInt i = 0; i < numToDisplay; i++)
+        {
+        aSearchResults.Append(WriteClientDataL(*(tempSearchResults[i])));
+        }
 	// ------------------------------------------------------------------------
 
     // Cleanup local results array
@@ -404,7 +401,7 @@
      * any other match for it than the one in "Nik0".
      */
 
-    // --- Remove items from aMatchLocation ---
+    // --- Remove duplicate items from aMatchLocation ---
     TInt i = 0;
     TBool incrementFirstCursor;
     while ( i < aMatchLocation.Count() )
@@ -436,7 +433,7 @@
         }
     }
 
-    // --- Remove items from aMatchSet ---
+    // --- Remove duplicate items from aMatchSet ---
     HBufC* dataUpper = HBufC::NewLC(aData.Length());
     dataUpper->Des().Copy(aData);
     dataUpper->Des().UpperCase(); // Get uppercase, as aMatchSet is in upper case
@@ -479,7 +476,7 @@
     // ------------------------------------------------------------------------
 
     // Sort match set
-	iHelper->SortSearchSeqsL(aMatchSet);  
+	iHelper->SortSearchSeqsL(aMatchSet);
 	
     PRINTQUERY    ( _L("CPcsAlgorithm1::SearchInputL: Final: "), aQuery );
     PRINT1        ( _L("CPcsAlgorithm1::SearchInputL: Final: Search Data: %S"), &aData );
@@ -488,7 +485,7 @@
 	
 	__LATENCY_MARKEND ( _L("CPcsAlgorithm1::SearchInputL") );
 
-    PRINT ( _L("End CPcsAlgorithm1::SearchInputL") );			
+    PRINT ( _L("End CPcsAlgorithm1::SearchInputL") );
 }
 
 // ----------------------------------------------------------------------------
@@ -552,7 +549,7 @@
     CleanupClosePushL( groupIdArray );
     
     // Create a new settings instance
-    CPsSettings *tempSettings = aSettings.CloneL();
+    CPsSettings* tempSettings = aSettings.CloneL();
     CleanupStack::PushL( tempSettings );
     
     TBool isGroupSearch = IsGroupSearchL(*tempSettings, groupIdArray);
@@ -627,7 +624,6 @@
 		                             RPointerArray<TDesC>& aMatchSet,
 		                             RArray<TPsMatchLocation>& aMatchLocation )
 {
-
     PRINT ( _L("Enter CPcsAlgorithm1::DoSearchInputL") );
 
     TInt queryWords = iMultiSearchHelper->CountMultiQueryWordsL(aQuery);
@@ -640,6 +636,7 @@
     }
     
     RPointerArray<CPsQuery> queryList = iMultiSearchHelper->MultiQueryL(aQuery);
+    CleanupResetAndDestroyPushL( queryList );
     
     PRINTQUERYLIST ( _L("CPcsAlgorithm1::DoSearchInputL: "), queryList );
 
@@ -661,11 +658,11 @@
     }
 
 	// Delete all the query elements
-	queryList.ResetAndDestroy();
+	CleanupStack::PopAndDestroy( &queryList ); // ResetAndDestroy
 
 	PRINT ( _L("End CPcsAlgorithm1::DoSearchInputL") );
-}    
-    
+}
+
 // ----------------------------------------------------------------------------
 // CPcsAlgorithm1::AddData
 // Add a data element to the pool
@@ -686,7 +683,7 @@
     }
     else 
     {
-    	PRINT(_L("CPcsAlgorithm1::AddDataL Unknown data store"));
+    	PRINT(_L("CPcsAlgorithm1::AddData: Unknown data store"));
     	return;
     }
     
@@ -762,19 +759,16 @@
     	// Already exists
     	return;
     }
-    
-    // Create a new cache    
+
+    // Create a new cache
     CPcsCache* cache = NULL;
-	TRAPD(err, cache = CPcsCache::NewL(aDataStore, *iKeyMap, iCacheCount));
+	TRAPD(err, cache = CPcsCache::NewL(aDataStore, *iKeyMap, (TUint8) iPcsCache.Count()));
 	if ( err != KErrNone )
 	{
 		SetCachingError(aDataStore, err);
 		return;
 	}
 	
-	// Increment the cachecount
-	iCacheCount++;
-	
     RArray<TInt> dataFields;
     TRAP(err, iPsDataPluginInterface->GetSupportedDataFieldsL(cache->GetURI(), dataFields));
 	if ( err != KErrNone )
@@ -786,7 +780,7 @@
     
     // Check if sort order is persisted already    
     RArray<TInt> sortOrder;
-    TRAP(err, ReadSortOrderFromCenRepL(*(cache->GetUri()), sortOrder));
+    TRAP(err, ReadSortOrderFromCenRepL(cache->GetURI(), sortOrder));
     if ( err != KErrNone )
 	{
 		SetCachingError(aDataStore, err);
@@ -831,7 +825,6 @@
     	{
     		delete iPcsCache[i];
     		iPcsCache.Remove(i);
-    		iCacheCount--;   		
     	}
     }
 }
@@ -868,7 +861,7 @@
 		User::Leave(KErrNotFound);
 	}
 	
-	return *(iPcsCache[i]->GetUri()); 
+	return iPcsCache[i]->GetURI(); 
 }
 
 // ----------------------------------------------------------------------------
@@ -879,7 +872,7 @@
 {
     for ( int i = 0; i < iPcsCache.Count(); i++ )
     {
-    	if ( aDataStore.CompareC(*(iPcsCache[i]->GetUri())) == 0 ) 
+        if ( aDataStore.CompareC(iPcsCache[i]->GetURI()) == 0 ) 
     	{
     	   return i;   
     	}
@@ -955,7 +948,7 @@
 	PRINT2 ( _L("SetCachingError::URI %S ERROR %d"), &aDataStore, aError );
 
 	iCacheError = aError;
-	RProperty::Set( KCStatus,1,iCacheError );
+	RProperty::Set( KCStatus, 1, iCacheError );
 }
 
 // ----------------------------------------------------------------------------
@@ -1157,8 +1150,7 @@
     if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) )
     {
         // If search in a group uri, use contacts db
-        TBuf<255> cntdb(KVPbkDefaultCntDbURI);
-        arrayIndex = GetCacheIndex(cntdb);
+        arrayIndex = GetCacheIndex(KVPbkDefaultCntDbURI);
     }
     else 
     {		
@@ -1186,7 +1178,7 @@
 {
     PRINT ( _L("End CPcsAlgorithm1::GetSortOrderL") );
 
-    TInt arrayIndex = -1;     
+    TInt arrayIndex = -1;
     
     if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) )
     {
@@ -1195,7 +1187,7 @@
         arrayIndex = GetCacheIndex(cntdb);
     }
     else 
-    {		
+    {
 		arrayIndex = GetCacheIndex(aURI);
     }
     
@@ -1223,7 +1215,7 @@
     PRINT ( _L("CPcsAlgorithm1::ChangeSortOrderL. Sort order change received.") );
     PRINT1 ( _L("URI = %S"), &aURI );
     
-    // If URI is search in a group URI return       
+    // If URI is search in a group URI return
     if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) )
     {
        PRINT ( _L("CPcsAlgorithm1::ChangeSortOrderL. Sort order change not supported.") );
@@ -1247,23 +1239,23 @@
     
     if ( aSortOrder.Count() == mySortOrder.Count() )    
     {
-         TBool same = ETrue;
-         for ( TInt i = 0; i < mySortOrder.Count(); i++ )	
-         {
+        TBool same = ETrue;
+        for ( TInt i = 0; i < mySortOrder.Count(); i++ )	
+        {
             if ( mySortOrder[i] != aSortOrder[i] )
-     		{
-     			same = EFalse;
-     			break;
-     		}
-         }
+            {
+                same = EFalse;
+                break;
+            }
+        }
          
-         if ( same )
-         {
-             PRINT ( _L("CPcsAlgorithm1::ChangeSortOrderL. Same sort order received. Ignoring ...") );
-             PRINT ( _L("End CPcsAlgorithm1::ChangeSortOrderL.") );
-             mySortOrder.Reset();
-             return;
-         }
+        if ( same )
+        {
+            PRINT ( _L("CPcsAlgorithm1::ChangeSortOrderL. Same sort order received. Ignoring ...") );
+            PRINT ( _L("End CPcsAlgorithm1::ChangeSortOrderL.") );
+            mySortOrder.Reset();
+            return;
+        }
     }
     
     mySortOrder.Reset();
@@ -1284,7 +1276,7 @@
 		SetCachingError(aURI, err);
 		UpdateCachingStatus(aURI,ECachingCompleteWithErrors);
 		return;
-	}	
+	}
 	
 	PRINT ( _L("End CPcsAlgorithm1::ChangeSortOrderL.") );
 }
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -21,7 +21,7 @@
 #include "CPcsDebug.h"
 
 // Compare functions
-TBool ComparePsPattern ( const TPsPatternDetails& aFirst, const TPsPatternDetails& aSecond )
+TInt ComparePsPattern ( const TPsPatternDetails& aFirst, const TPsPatternDetails& aSecond )
 {
 	return (CPcsAlgorithm1Utils::MyCompareC(*(aFirst.matchPattern), *(aSecond.matchPattern)));
 }
@@ -109,7 +109,7 @@
 // CPcsAlgorithm1FilterHelper::AddL
 // 
 // ----------------------------------------------------------------------------
-void CPcsAlgorithm1FilterHelper::AddL(CPsData* psData, RPointerArray<TDesC>& aPatternSequence)
+void CPcsAlgorithm1FilterHelper::AddL(CPsData* aPsData, RPointerArray<TDesC>& aPatternSequence)
 {
 	if(iSortType == EAlphabetical)
 	{
@@ -117,10 +117,12 @@
 		if(iMatchPatternPools.Count() == 0 )
 		{
 			RPointerArray<CPsData> *tempPsDataArray = new (ELeave) RPointerArray<CPsData> ();
-        	iMatchPatternPools.Append(tempPsDataArray);
+			CleanupStack::PushL( tempPsDataArray );
+        	iMatchPatternPools.AppendL(tempPsDataArray);
+        	CleanupStack::Pop( tempPsDataArray );
 		}
 		// Add result to the result set
-		iMatchPatternPools[0]->Append(psData);
+		iMatchPatternPools[0]->AppendL(aPsData);
 		
 		// Update the count
 		iResultCount++;
@@ -128,33 +130,32 @@
 		// Update sequence list
 		for(TInt i = 0; i < aPatternSequence.Count(); i++)
 		{
-			TInt index = FindSequence(aPatternSequence[i]);
+			TInt index = FindSequence(*aPatternSequence[i]);
 			if ( index  == KErrNotFound )
 			{
 				// sequence not found, add it to array
 				TPsPatternDetails* temp = new ( ELeave ) TPsPatternDetails;
+				CleanupStack::PushL( temp );
 				
-				TInt len = aPatternSequence[i]->Length();
-				temp->matchPattern = HBufC::NewL(len);
-				temp->matchPattern->Des().Copy(*(aPatternSequence[i]));
+				temp->matchPattern = aPatternSequence[i]->AllocL();
 				
 				// First occurence should be -1 for alphabetical sort
 				// and pool index will be 0 as only one pool will be created
 				temp->firstOccurence = -1;
 				temp->poolIndex = 0;
 				
-				iMatchPatternDetails.Append(temp);	
+				iMatchPatternDetails.AppendL(temp);
+				CleanupStack::Pop( temp );
 			}
 		}
 	}
 	else
 	{
 		// PatternBased sort
-		TInt index = AddToPoolL(psData, aPatternSequence);
+		TInt index = AddToPoolL(aPsData, aPatternSequence);
 		
 		// Increment the total count
 		iResultCount++;	
-							
 	}
 }
 
@@ -186,7 +187,7 @@
 	
 		// Create the pattern for aPatternSequence[cnt] in  iMatchPatternDetails
 		// and return the index
-	    TInt indexInMatchPatternDetails = CreateMatchPatternDetailsAndPoolsL(aPatternSequence[cnt]);
+	    TInt indexInMatchPatternDetails = CreateMatchPatternDetailsAndPoolsL(*aPatternSequence[cnt]);
 		
 		//Add the data to the pool the first pattern pool.
 		// The data should be added only once
@@ -203,14 +204,14 @@
 	       	else
 	       	{
 	       		poolItemCount = -1;
-	       	}	
-	       		
+	       	}
+	    
 	    }
 	    else if(cnt > 0)
 		{
 		    // Check if aPatternSequence[cnt] is listed in subpatterns of aPatternSequence[0]
 		    // If not, then create a sub pattern and apped it to  iMatchPatternDetails for aPatternSequence[0]
-		 	TInt subSeq = FindSubSequence(aPatternSequence[cnt],matchpatterpoolIndexToAppend);
+		 	TInt subSeq = FindSubSequence(*aPatternSequence[cnt], matchpatterpoolIndexToAppend);
 		 	if(subSeq  == KErrNotFound )
 		 	{
 		 	
@@ -235,7 +236,7 @@
 // Returns the index of the sequence in iMatchPatternDetails
 // ----------------------------------------------------------------------------
 
-TInt CPcsAlgorithm1FilterHelper::CreateMatchPatternDetailsAndPoolsL(TDesC* aSeq)
+TInt CPcsAlgorithm1FilterHelper::CreateMatchPatternDetailsAndPoolsL(const TDesC& aSeq)
 {
 
 	TInt indexInMatchPatternDetails = FindSequence(aSeq);
@@ -245,8 +246,7 @@
 		TPsPatternDetails* tempPatternDetailsInstance = new ( ELeave ) TPsPatternDetails;
 		
 		//TInt len = aPatternSequence[cnt]->Length();
-		tempPatternDetailsInstance->matchPattern = HBufC::NewL(aSeq->Length());
-		tempPatternDetailsInstance->matchPattern->Des().Copy(*(aSeq));
+		tempPatternDetailsInstance->matchPattern = aSeq.AllocL();
 		tempPatternDetailsInstance->firstOccurence = -1; //RAVIKIRAN
 		
 		// Pools doesn't exist for this sequence..
@@ -353,17 +353,13 @@
 // Searches for for aSeq in iMatchPatternDetails and returns index 
 //  where input sequence is found. Returns -1 if not found
 // ----------------------------------------------------------------------------
-TInt CPcsAlgorithm1FilterHelper::FindSequence(TDesC* aSeq)
+TInt CPcsAlgorithm1FilterHelper::FindSequence(const TDesC& aSeq)
 {
-	TBuf<KPsQueryMaxLen> seqBuf;
-	seqBuf.Append(*aSeq);
-	
 	TInt j = 0;
 	for( ; j < iMatchPatternDetails.Count(); j++)
 	{
-		TBuf<KPsQueryMaxLen> matchPatternBuf;
-		matchPatternBuf.Copy((iMatchPatternDetails[j]->matchPattern->Des()));
-		if ( CPcsAlgorithm1Utils::MyCompareC(seqBuf, matchPatternBuf) == 0 )
+		const TDesC& matchPattern = *(iMatchPatternDetails[j]->matchPattern);
+		if ( CPcsAlgorithm1Utils::MyCompareC(aSeq, matchPattern) == 0 )
             break;
 	}
 	
@@ -379,17 +375,13 @@
 // and returns index where input sequence is found. 
 // Returns -1 if not found
 // ----------------------------------------------------------------------------
-TInt CPcsAlgorithm1FilterHelper::FindSubSequence(TDesC* aSeq,TInt aPatternIndex)
+TInt CPcsAlgorithm1FilterHelper::FindSubSequence(const TDesC& aSeq,TInt aPatternIndex)
 {
-	TBuf<KPsQueryMaxLen> seqBuf;
-	seqBuf.Append(*aSeq);
-	
 	TInt j = 0;
 	for( ; j < iMatchPatternDetails[aPatternIndex]->subPatternArray.Count(); j++)
 	{
-		TBuf<KPsQueryMaxLen> matchPatternBuf;
-		matchPatternBuf.Copy((iMatchPatternDetails[aPatternIndex]->subPatternArray[j]->matchPattern->Des()));
-		if ( CPcsAlgorithm1Utils::MyCompareC(seqBuf, matchPatternBuf) == 0 )
+		const TDesC& matchPattern = *(iMatchPatternDetails[aPatternIndex]->subPatternArray[j]->matchPattern);
+		if ( CPcsAlgorithm1Utils::MyCompareC(aSeq, matchPattern) == 0 )
             break;
 	}
 	
@@ -408,13 +400,13 @@
 // then, firstOccurence of all substring sequences ("A", "AB", "ABC") 
 //       in iMatchPatternDetails will be set to 2
 // ----------------------------------------------------------------------------
-void CPcsAlgorithm1FilterHelper::UpdateForSubSequencesL(TDesC& aSeq,TInt aFirstOccrVal)
+void CPcsAlgorithm1FilterHelper::UpdateForSubSequencesL(const TDesC& aSeq,TInt aFirstOccrVal)
 {
-    HBufC* tempSequence = HBufC::NewL(aSeq.Length() + 1);
-    for ( TInt i =0; i<aSeq.Length(); i++ )
+    TPtrC tempSequence;
+    for ( TInt i = 1; i <= aSeq.Length(); i++ )
 	{
 	    // Get the next substring in tempSequence
-		tempSequence->Des().Append(aSeq[i]);
+		tempSequence.Set( aSeq.Left(i) );
 	
 		// Find if this sequence exist in iMatchPatternDetails
 		TInt patternIndex = FindSequence(tempSequence);
@@ -423,14 +415,9 @@
 		if((patternIndex != KErrNotFound) && (iMatchPatternDetails[patternIndex]->firstOccurence == -1))
 		{
 			iMatchPatternDetails[patternIndex]->firstOccurence = aFirstOccrVal;
-		}	
-				
+		}
+	
 	}
-	delete tempSequence;
-	tempSequence = NULL;
-	
-	return;
-
 }
 // END OF FILE
 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -132,7 +132,9 @@
           dsIndex++ )
     {
         RPointerArray<CPsData> *temp = new (ELeave) RPointerArray<CPsData> ();
-        iSearchResultsArr.Append(temp);
+        CleanupStack::PushL( temp );
+        iSearchResultsArr.AppendL( temp );
+        CleanupStack::Pop( temp );
 
         // Get the contents for this data store
         TInt arrayIndex = iAlgorithm->GetCacheIndex(*(dataStores[dsIndex]));
@@ -146,8 +148,8 @@
         cache->GetDataFields(supportedDataFields);
 
         // Get the filtered data fields for this data store
-        TUint8 filteredDataMatch = FilterDataFieldsL(requiredDataFields,
-                                                     supportedDataFields);
+        TUint8 filteredDataMatch = CPcsAlgorithm1Utils::FilterDataFieldsL(requiredDataFields,
+                                                                          supportedDataFields);
 
         // Perform filtering
         FilterResultsSingleL(filterHelper,
@@ -233,6 +235,14 @@
         CPcsPoolElement* poolElement = static_cast<CPcsPoolElement*>(aSearchSet[index]);
         CPsData* psData = poolElement->GetPsData();
         psData->ClearDataMatches();
+        
+        // Skip this contact if performing group search and this contact doesn't
+        // belong to the group
+        if ( aIsSearchInGroup && aContactsInGroup.Find(psData->Id()) == KErrNotFound )
+            {
+            continue;
+            }
+        
         RPointerArray<TDesC> tempMatchSeq;
         CleanupResetAndDestroyPushL( tempMatchSeq );
         TBool isAdded = EFalse;
@@ -271,20 +281,8 @@
 
                         // Extract matched character sequence
                         TInt len = queryAsDes.Length();
-                        HBufC* seq = HBufC::NewLC(len);
-                        *seq = token.Mid(0, len);
-                        seq->Des().UpperCase();
-
-                        TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
-                        if ( tempMatchSeq.Find(seq, rule) == KErrNotFound )
-                        {
-                            tempMatchSeq.Append(seq);
-                            CleanupStack::Pop(seq);
-                        }
-                        else
-                        {
-                            CleanupStack::PopAndDestroy(seq);
-                        }
+                        TPtrC seq = token.Left(len);
+                        CPcsAlgorithm1Utils::AppendMatchToSeqL( tempMatchSeq, seq );
                     }
                     // Next word
                     token.Set(lex.NextToken());
@@ -295,17 +293,7 @@
         // Add the result
         if ( isAdded )
         {
-            if ( aIsSearchInGroup )
-            {
-                if ( aContactsInGroup.Find(psData->Id()) != KErrNotFound )
-                {
-                    aAlgorithmFilterHelper->AddL(psData,tempMatchSeq);
-                }
-            }
-            else
-            {
-                aAlgorithmFilterHelper->AddL(psData,tempMatchSeq);
-            }
+            aAlgorithmFilterHelper->AddL(psData,tempMatchSeq);
         }
 
         // Cleanup the match sequence array as
@@ -366,20 +354,8 @@
             aMatchLocation.Append(tempLocation);
 
             // Add the sequence to the match sequence
-            HBufC* seq = HBufC::NewLC(len);
-            *seq = token.Mid(0, len);
-            seq->Des().UpperCase();
-
-            TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
-            if ( aMatchSet.Find(seq, rule) == KErrNotFound )
-            {
-                aMatchSet.Append(seq);
-                CleanupStack::Pop();
-            }
-            else
-            {
-                CleanupStack::PopAndDestroy();
-            }
+            TPtrC seq = token.Left(len);
+            CPcsAlgorithm1Utils::AppendMatchToSeqL( aMatchSet, seq );
         }
 
         // Next word
@@ -404,31 +380,4 @@
     aSearchSeqs.Sort(rule);
 }
 
-// ----------------------------------------------------------------------------
-// CPcsAlgorithm1Helper::FilterDataFieldsL()
-// Constructs a bit pattern using the required/supported data fields
-// For example, 6, 4 and 27 are supported fields <-- 00000111
-//              6 and 4 are required fields      <-- 00000011
-// Bit pattern returned is 00000011.
-// ----------------------------------------------------------------------------
-TUint8 CPcsAlgorithm1Helper::FilterDataFieldsL(RArray<TInt>& aRequiredDataFields,
-                                               RArray<TInt>& aSupportedDataFields)
-{
-    TUint8 filteredMatch = 0x0;
-
-    for ( TInt i = 0; i < aSupportedDataFields.Count(); i++ )
-    {
-        for ( TInt j = 0; j < aRequiredDataFields.Count(); j++ )
-        {
-            if ( aSupportedDataFields[i] == aRequiredDataFields[j] )
-            {
-                TUint8 val = 1 << i;
-                filteredMatch |= val;
-            }
-        }
-    }
-
-    return filteredMatch;
-}
-
 // End of file
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -160,8 +160,8 @@
 		cache->GetDataFields(supportedDataFields);
 		
 		// Get the filtered data fields for this data store
-		TUint8 filteredDataMatch = FilterDataFieldsL(requiredDataFields, 
-		                                             supportedDataFields);
+        TUint8 filteredDataMatch = CPcsAlgorithm1Utils::FilterDataFieldsL(requiredDataFields,
+                                                                          supportedDataFields);
 
 	    // Filter the results now
 	    FilterResultsMultiL(filterHelper,
@@ -231,6 +231,7 @@
 {
     PRINT ( _L("Enter CPcsAlgorithm1MultiSearchHelper::SearchMatchSeqMultiL") );
     RPointerArray<HBufC> descriptorsQueryList;
+    CleanupResetAndDestroyPushL( descriptorsQueryList );
     ConvertQueryToListL(aPsQuery, descriptorsQueryList);
     TLex lex(aData);
     while ( !lex.Eos() ) // Search thru all words
@@ -252,35 +253,16 @@
             {
                 newLocation.length = currentQuery->Length();
                 aMatchLocation.AppendL( newLocation );
-                AppendMatchToSeqL( aMatchSeq, currentWord.Left(newLocation.length) );
+                TPtrC matchPart = currentWord.Left(newLocation.length);
+                CPcsAlgorithm1Utils::AppendMatchToSeqL( aMatchSeq, matchPart );
             }
         }
     }
-    descriptorsQueryList.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &descriptorsQueryList ); // ResetAndDestroy
     PRINT ( _L("End CPcsAlgorithm1MultiSearchHelper::SearchMatchSeqMultiL") );
 }
 
 // ----------------------------------------------------------------------------
-// CPcsAlgorithm1MultiSearchHelper::AppendMatchToSeqL
-// ----------------------------------------------------------------------------
-void CPcsAlgorithm1MultiSearchHelper::AppendMatchToSeqL( 
-        RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch  )
-{
-    HBufC* seq = aMatch.AllocLC();
-    seq->Des().UpperCase();
-    TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
-    if ( aMatchSeq.Find(seq, rule) == KErrNotFound )
-    {
-        aMatchSeq.Append(seq);
-        CleanupStack::Pop( seq );
-    }
-    else 
-    {
-        CleanupStack::PopAndDestroy( seq );
-    }
-}
-
-// ----------------------------------------------------------------------------
 // CPcsAlgorithm1MultiSearchHelper::LookupMatchL
 // ----------------------------------------------------------------------------
 void CPcsAlgorithm1MultiSearchHelper::LookupMatchL( CPsQuery& aSearchQuery,
@@ -299,7 +281,7 @@
     {
         TPtrC currentWord = lex.NextToken();
         PRINT2( _L("idx len: %d %d"), lex.Offset() - currentWord.Length(), currentWord.Length() );
-        dataWordIndexes.AppendL( lex.Offset() -  currentWord.Length() );
+        dataWordIndexes.AppendL( lex.Offset() - currentWord.Length() );
         dataWordLengths.AppendL( currentWord.Length() );
     }
 
@@ -374,7 +356,7 @@
         }
         if ( doBacktrack )
         {
-            --currentQueryIndex;            
+            --currentQueryIndex;
         }
         else
         {
@@ -394,7 +376,7 @@
             resultFragment = aData.Mid(
                 dataWordIndexes[ matchedDataIndex ],
                 convertedQueriesAsDes[i].Length() );
-        }        
+        }
     }
     else
     {
@@ -556,20 +538,8 @@
 
 					        // Extract matched character sequence and fill in temp array
 							TInt len = tmpQuery->Length();
-							HBufC* seq = tmpData.Left(len).AllocLC();
-							
-							seq->Des().UpperCase();
-							TIdentityRelation<TDesC> searchRule(CPcsAlgorithm1Utils::CompareExact);
-							if ( tmpMatchSet.Find(seq, searchRule) == KErrNotFound )
-							{
-                                tmpMatchSet.AppendL(seq);
-                                CleanupStack::Pop(seq);
-							}
-							else
-							{ 
-                                CleanupStack::PopAndDestroy(seq);
-								seq = NULL;
-							}
+							TPtrC seq = tmpData.Left(len);
+							CPcsAlgorithm1Utils::AppendMatchToSeqL( tmpMatchSet, seq );
 						}
 				    }
 				     
@@ -724,31 +694,4 @@
 	return query;
 }
 
-// ----------------------------------------------------------------------------
-// CPcsAlgorithm1MultiSearchHelper::FilterDataFieldsL()
-// Constructs a bit pattern using the required/supported data fields
-// For example, 6, 4 and 27 are supported fields <-- 00000111
-//              6 and 4 are required fields      <-- 00000011
-// Bit pattern returned is 00000011.
-// ----------------------------------------------------------------------------
-TUint8 CPcsAlgorithm1MultiSearchHelper::FilterDataFieldsL(RArray<TInt>& aRequiredDataFields,
-                                                          RArray<TInt>& aSupportedDataFields)
-{
-    TUint8 filteredMatch = 0x0;
-    
-	for ( TInt i = 0; i < aSupportedDataFields.Count(); i++ )
-	{
-		for ( TInt j = 0; j < aRequiredDataFields.Count(); j++ )
-		{
-			if ( aSupportedDataFields[i] == aRequiredDataFields[j] )
-			{
-                TUint8 val = 1 << i;
-			    filteredMatch |= val;
-			}
-		}
-	}
-	
-	return filteredMatch;
-}
-
 // End of file
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -297,5 +297,52 @@
     return ETrue;
 }
 
+// ----------------------------------------------------------------------------
+// CPcsAlgorithm1Helper::FilterDataFieldsL()
+// Constructs a bit pattern using the required/supported data fields
+// For example, 6, 4 and 27 are supported fields <-- 00000111
+//              6 and 4 are required fields      <-- 00000011
+// Bit pattern returned is 00000011.
+// ----------------------------------------------------------------------------
+TUint8 CPcsAlgorithm1Utils::FilterDataFieldsL(const RArray<TInt>& aRequiredDataFields,
+                                              const RArray<TInt>& aSupportedDataFields)
+{
+    TUint8 filteredMatch = 0x0;
+
+    for ( TInt i = 0; i < aSupportedDataFields.Count(); i++ )
+    {
+        for ( TInt j = 0; j < aRequiredDataFields.Count(); j++ )
+        {
+            if ( aSupportedDataFields[i] == aRequiredDataFields[j] )
+            {
+                TUint8 val = 1 << i;
+                filteredMatch |= val;
+            }
+        }
+    }
+
+    return filteredMatch;
+}
+
+// ----------------------------------------------------------------------------
+// CPcsAlgorithm1Utils::AppendMatchToSeqL
+// ----------------------------------------------------------------------------
+void CPcsAlgorithm1Utils::AppendMatchToSeqL( 
+        RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch )
+    {
+    HBufC* seq = aMatch.AllocLC();
+    seq->Des().UpperCase();
+    TIdentityRelation<TDesC> rule(CompareExact);
+    if ( aMatchSeq.Find(seq, rule) == KErrNotFound )
+        {
+        aMatchSeq.AppendL(seq);
+        CleanupStack::Pop( seq );
+        }
+    else 
+        {
+        CleanupStack::PopAndDestroy( seq );
+        }
+    }
+
 // End of File
 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -71,6 +71,8 @@
 void CPcsCache::ConstructL(const TDesC& aURI, CPcsKeyMap& aKeyMap, TUint8 aUriId)
 {
     PRINT ( _L("Enter CPcsCache::ConstructL") );
+
+    PRINT2 ( _L("CPcsCache::ConstructL: aURI=%S, aUriId=%d"), &aURI, aUriId);
     
     iURI = aURI.AllocL();
     iUriId = aUriId;
@@ -110,24 +112,26 @@
 
     PRINT ( _L("End CPcsCache::~CPcsCache") );
 }
- 
+
 // ----------------------------------------------------------------------------
 // CPcsCache::GetContactsForKeyL
 // Get list of pool elements specific to a pool
 // ----------------------------------------------------------------------------     
 void CPcsCache::GetContactsForKeyL(TInt aKeyId, RPointerArray<CPcsPoolElement>& aData)
-{
+    {
     PRINT ( _L("Enter CPcsCache::GetContactsForKeyL") );
-        	
-	const RPointerArray<CPcsPoolElement>& arr = *iKeyArr[aKeyId];
-	for ( TInt i = 0; i < arr.Count(); i++ )
-	{
-		CPcsPoolElement* value = arr[i];
-        aData.AppendL(value);
-	}
     
-	PRINT ( _L("End CPcsCache::GetContactsForKeyL") );
-}  
+    if ( aKeyId >= 0 && aKeyId < iKeyArr.Count() )
+        {
+        const RPointerArray<CPcsPoolElement>& arr = *iKeyArr[aKeyId];
+        for ( TInt i = 0; i < arr.Count(); i++ )
+            {
+            aData.AppendL(arr[i]);
+            }
+        }
+    
+    PRINT ( _L("End CPcsCache::GetContactsForKeyL") );
+    }
 
 // ----------------------------------------------------------------------------
 // CPcsCache::GetAllContentsL
@@ -139,20 +143,18 @@
         	
 	for ( TInt i = 0; i < iMasterPool.Count(); i++ )
 	{
-		CPsData* value = iMasterPool[i];
-        aData.AppendL(value);
+        aData.AppendL(iMasterPool[i]);
 	}
     
 	PRINT ( _L("End CPcsCache::GetAllContentsL") );
-}  
-   
+}
 
 // ----------------------------------------------------------------------------
 // CPcsCache::AddToPool
 // Adds a contact to cache
 // ----------------------------------------------------------------------------
 void CPcsCache::AddToPoolL(TUint64& aPoolMap, CPsData& aData)
-{	
+{
      // Temp hash to remember the location of pool elements
      // First TInt  = Pool 
      // Second TInt = Location in the pool
@@ -161,11 +163,11 @@
      RHashMap<TInt, TInt> elementHash;
      CleanupClosePushL( elementHash );
      TLinearOrder<CPcsPoolElement> rule( CPcsPoolElement::CompareByData );
-              
+
      // Parse thru each data element
      for ( TInt dataIndex = 0; dataIndex < aData.DataElementCount(); dataIndex++ )
-     {     	
-     	// Find store all the pool IDs where this contact should be
+     {
+        // Find store all the pool IDs where this contact should be
 		RArray<TUint> poolIds;
 		CleanupClosePushL( poolIds );
 		
@@ -174,24 +176,30 @@
 		{
 		    // Split the data into words
 		    CWords* words = CWords::NewLC(*aData.Data(dataIndex));
-  
+
 		    // Store the first numeric key for each word
 		    for ( TInt i = 0; i < words->MdcaCount(); i++ )
 		    {
 		    	TChar firstChar = (words->MdcaPoint(i))[0];
 		    	
 		    	// Pool ID according to ITU-T mappings
-		    	TInt itutPoolId = iKeyMap->PoolIdForCharacter(firstChar, EPredictiveItuT);
-		    	if ( itutPoolId != KErrNotFound )
+		    	if ( iKeyMap->IsItutPredictiveAvailable() )
 		    	    {
-                    poolIds.Append(itutPoolId);
+                    TInt itutPoolId = iKeyMap->PoolIdForCharacter(firstChar, EPredictiveItuT);
+                    if ( itutPoolId != KErrNotFound )
+                        {
+                        poolIds.Append(itutPoolId);
+                        }
 		    	    }
 		    	
 		    	// Pool ID according to QWERTY mappings
-                TInt qwertyPoolId = iKeyMap->PoolIdForCharacter(firstChar, EPredictiveQwerty);
-                if ( qwertyPoolId != KErrNotFound )
+                if ( iKeyMap->IsQwertyPredictiveAvailable() )
                     {
-                    poolIds.Append(qwertyPoolId);
+                    TInt qwertyPoolId = iKeyMap->PoolIdForCharacter(firstChar, EPredictiveQwerty);
+                    if ( qwertyPoolId != KErrNotFound )
+                        {
+                        poolIds.Append(qwertyPoolId);
+                        }
                     }
 		    }
 		    
@@ -200,7 +208,7 @@
 		
 		for ( TInt poolIdIndex = 0; poolIdIndex < poolIds.Count(); poolIdIndex++ )
 		{
-            TUint poolId = poolIds[ poolIdIndex ];
+            TUint poolId = poolIds[poolIdIndex];
 		    CPcsPoolElement* element = NULL;
 		    
 		    // Check if an element already exists in the pool for this data
@@ -267,6 +275,7 @@
 
     // Include this element in master pool
     TLinearOrder<CPsData> rule( CPcsAlgorithm1Utils::CompareDataBySortOrderL );
+    
     iMasterPool.InsertInOrderAllowRepeatsL(&aData, rule);
 }
 
@@ -276,8 +285,8 @@
 // ---------------------------------------------------------------------
 void CPcsCache::RemoveFromCacheL( TInt aItemId )
 {
-    CPsData *data = NULL;
-            
+    CPsData* data = NULL;
+    
     TUint64* poolMap = iCacheInfo.Find(aItemId);
     
     if ( poolMap == NULL )
@@ -289,8 +298,8 @@
     for ( TInt keyIndex = 0; keyIndex < iKeyArr.Count(); keyIndex++ )
     {
         TBool present = GetPoolMap(*poolMap, keyIndex); 
-        
-        if ( ! present )
+
+        if ( !present )
         {
         	continue;
         }
@@ -307,32 +316,30 @@
 		        data = element->GetPsData();
 		    	delete element;
 		    	iKeyArr[keyIndex]->Remove(arrayIndex);  
-		    }  
-        }      	
-    };   
-    
+		    }
+        }
+    }
+        
     // Remove this element from master pool
-    for ( TInt arrayIndex = 0; 
-              arrayIndex < iMasterPool.Count();
-              arrayIndex++ )
+    TInt arrayIndex = 0;
+    while ( arrayIndex < iMasterPool.Count() )
     {
-	    CPsData *dataElement = iMasterPool[arrayIndex];
-	    TInt id = dataElement->Id();
-	    if ( id == aItemId )
-	    {
-	    	iMasterPool.Remove(arrayIndex);  
-	    }  
-    }      	
-     
+        if ( iMasterPool[arrayIndex]->Id() == aItemId )
+        {
+            iMasterPool.Remove(arrayIndex);  
+        }
+        else
+        {
+            arrayIndex++;
+        }
+    }
+    
     // Delete data 
-    if ( data )
-    {
-    	delete data;
-    	data = NULL;
-    }
+    delete data;
+    data = NULL;
 
     // Clear up cache information
-    iCacheInfo.Remove(aItemId);    
+    iCacheInfo.Remove(aItemId);
 }
 
 // ---------------------------------------------------------------------
@@ -361,8 +368,29 @@
 void CPcsCache::SetPoolMap(TUint64& aPoolMap, TInt aArrayIndex)
 {
     __ASSERT_DEBUG( aArrayIndex < 64, User::Panic(_L("CPcsCache"), KErrOverflow ) );
-    TUint64 val = 1 << aArrayIndex;
-    aPoolMap |= val;
+
+    /* Some platforms do not support 64 bits shift operations.
+     * Split to two 32 bits operations.
+     */
+    
+    TUint32 poolMapH = I64HIGH(aPoolMap);
+    TUint32 poolMapL = I64LOW(aPoolMap);
+    
+    TUint32 valH = 0;
+    TUint32 valL = 0;
+    if (aArrayIndex < 32)
+        {
+        valL = 1 << aArrayIndex;
+        }
+    else
+        {
+        valH = 1 << (aArrayIndex-32);
+        }
+
+    poolMapH |= valH;
+    poolMapL |= valL;
+    
+    aPoolMap = MAKE_TUINT64(poolMapH, poolMapL);
 }
 
 // ---------------------------------------------------------------------
@@ -372,8 +400,28 @@
 TBool CPcsCache::GetPoolMap(TUint64& aPoolMap, TInt aArrayIndex)
 {
     __ASSERT_DEBUG( aArrayIndex < 64, User::Panic(_L("CPcsCache"), KErrOverflow ) );
-    TUint64 val = 1 << aArrayIndex;
-    return (aPoolMap & val);
+
+    /* Some platforms do not support 64 bits shift operations.
+     * Split to two 32 bits operations.
+     */
+
+    TUint32 poolMapH = I64HIGH(aPoolMap);
+    TUint32 poolMapL = I64LOW(aPoolMap);
+    
+    TUint32 valH = 0;
+    TUint32 valL = 0;
+    if (aArrayIndex < 32)
+        {
+        valL = 1 << aArrayIndex;
+        }
+    else
+        {
+        valH = 1 << (aArrayIndex-32);
+        }
+
+    TBool ret = (poolMapH & valH) || (poolMapL & valL);
+
+    return (ret);
 }
 
 // ---------------------------------------------------------------------
@@ -437,15 +485,6 @@
 }
 
 // ---------------------------------------------------------------------
-// CPcsCache::GetUri
-// 
-// ---------------------------------------------------------------------
-HBufC* CPcsCache::GetUri()
-{
-	return iURI;
-}
-
-// ---------------------------------------------------------------------
 // CPcsCache::SetSortOrder
 // 
 // ---------------------------------------------------------------------
@@ -479,7 +518,6 @@
 	}	
 }
 
-
 // ---------------------------------------------------------------------
 // CPcsCache::GetIndexOrder
 // 
@@ -540,5 +578,6 @@
         AddToCacheL( *temp );
         }
     iMasterPoolBackup.Reset();
-    } 
+    }
+
 // End of file
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -98,11 +98,34 @@
     iLanguageNotSupported.Append(ELangTaiwanChinese);
     iLanguageNotSupported.Append(ELangKorean);
 
-    SetupKeyboardTypesL();
+    TPtiKeyboardType physicalItutKbType;
+    TPtiKeyboardType physicalQwertyKbType;    
+    GetPhysicalKeyboardTypesL( physicalItutKbType, physicalQwertyKbType );
+
+    iItutKeyboardType = EPtiKeyboard12Key; // We want to support Virtual Itu-T in most devices
+    CreateKeyMappingL( EPredictiveItuT ); // Create structure for holding characters<-->key mappings
+    if (iItutKeys.Count() == 0)
+        {
+        iItutKeyboardType = EPtiKeyboardNone;
+        }
 
-    // Create structure for holding characters<-->key mappings
-    CreateKeyMappingL( EPredictiveItuT );
-    CreateKeyMappingL( EPredictiveQwerty );
+    iQwertyKeyboardType = physicalQwertyKbType;
+    if (physicalQwertyKbType != EPtiKeyboardNone)
+        {
+        CreateKeyMappingL( EPredictiveQwerty ); // Create structure for holding characters<-->key mappings
+        if (iQwertyKeys.Count() == 0)
+            {
+            iQwertyKeyboardType = EPtiKeyboardNone;
+            }
+        }
+
+    // Set the Default Predictive keyboard mode. If Qwerty keyboard exists, it is always physical.
+    iPredictiveDefaultKeyboardMode =
+        (IsItutPredictiveAvailable() && physicalItutKbType != EPtiKeyboardNone) || !IsQwertyPredictiveAvailable() ?
+            EPredictiveItuT : EPredictiveQwerty;
+
+    PRINT1 ( _L("CPcsKeyMap::ConstructL: ITU-T Keyboard chosen for Predictive Search = %d"), iItutKeyboardType );
+    PRINT1 ( _L("CPcsKeyMap::ConstructL: QWERTY Keyboard chosen for Predictive Search = %d"), iQwertyKeyboardType );
 
     // Sets attribute for holding info if "0" and " " are on the same key
     // Needed for decision if the "0" should be considered as a possible separator
@@ -149,6 +172,24 @@
     }
 
 // ----------------------------------------------------------------------------
+// CPcsKeyMap::IsItutPredictiveAvailable
+// 
+// ----------------------------------------------------------------------------
+TBool CPcsKeyMap::IsItutPredictiveAvailable() const
+    {
+    return ( iItutKeyboardType != EPtiKeyboardNone );
+    }
+
+// ----------------------------------------------------------------------------
+// CPcsKeyMap::IsQwertyPredictiveAvailable
+// 
+// ----------------------------------------------------------------------------
+TBool CPcsKeyMap::IsQwertyPredictiveAvailable() const
+    {
+    return ( iQwertyKeyboardType != EPtiKeyboardNone );
+    }
+
+// ----------------------------------------------------------------------------
 // CPcsKeyMap::IsModePredictive
 // 
 // ----------------------------------------------------------------------------
@@ -272,9 +313,9 @@
                                                const RArray<TPtiKey>& aPtiKeys,
                                                const RPointerArray<TKeyMappingData>& aKeyMappings) const
     {
-    PRINT ( _L("CPcsKeyMap::KeyForCharacterMultiMatch: ===================================================") );
-    PRINT ( _L("CPcsKeyMap::KeyForCharacterMultiMatch: Checking potential error conditions") );
-    PRINT ( _L("CPcsKeyMap::KeyForCharacterMultiMatch: ---------------------------------------------------") );
+    PRINT ( _L("CPcsKeyMap::CheckPotentialErrorConditions: ===================================================") );
+    PRINT ( _L("CPcsKeyMap::CheckPotentialErrorConditions: Checking potential error conditions") );
+    PRINT ( _L("CPcsKeyMap::CheckPotentialErrorConditions: ---------------------------------------------------") );
 
     _LIT(KTextCharArr0, "is single char");
     _LIT(KTextCharArr1, "has \"UI\" priority");
@@ -292,14 +333,14 @@
             {
             if ( KErrNotFound != aKeyMappings[aPoolIndexArr[i]]->iKeyMapCharArr[j].Find((TUint) aChar) )
                 {
-                PRINT5 ( _L("CPcsKeyMap::KeyForCharacterMultiMatch: Char '%c' (0x%04X) %S for pool %d with key '%c'"),
+                PRINT5 ( _L("CPcsKeyMap::CheckPotentialErrorConditions: Char '%c' (0x%04X) %S for pool %d with key '%c'"),
                         (TUint) aChar, (TUint) aChar, &charArrStr[j], aPoolIndexArr[i], aPtiKeys[aPoolIndexArr[i]] );
                 countArr[j]++;
                 }
             }
         }
 
-    PRINT ( _L("CPcsKeyMap::KeyForCharacterMultiMatch: ===================================================") );
+    PRINT ( _L("CPcsKeyMap::CheckPotentialErrorConditions: ===================================================") );
     
 #ifdef __WINS__
     /*
@@ -498,7 +539,7 @@
     // an array which is formed by concatenating QWERTY keys array in the end
     // of the ITU-T keys array.
     TInt poolId = KErrNotFound;
-    if ( aKbMode == EPredictiveItuT && iItutKeys.Count() )
+    if ( aKbMode == EPredictiveItuT && IsItutPredictiveAvailable() )
         {
         poolId = iItutKeys.Find(aKey);
         // IF the key is not found, then it should go to the special pool,
@@ -508,7 +549,7 @@
             poolId = iItutKeys.Count() - 1;
             }
         }
-    else if ( aKbMode == EPredictiveQwerty && iQwertyKeys.Count() )
+    else if ( aKbMode == EPredictiveQwerty && IsQwertyPredictiveAvailable() )
         {
         poolId = iQwertyKeys.Find(aKey);
         // IF the key is not found, then it should go to the special pool,
@@ -538,12 +579,12 @@
     // When selecting pool for non-predictive mode, we use the pool of the
     // default keyboard. The non-predictive matches should be a sub set of the
     // predictive matches of the default keyboard, although strictly speaking,
-    // there' no guarantee for this.
+    // there is no guarantee for this.
     aKbMode = ResolveKeyboardMode( aKbMode, ENonPredictive ); 
 
     TPtiKey key = KeyForCharacterMultiMatch( aChar, aKbMode );
 
-    TInt poolId = (key == EPtiKeyNone) ? KErrNotFound : PoolIdForKey(key, aKbMode);
+    TInt poolId = PoolIdForKey(key, aKbMode);
 
     return poolId;
     }
@@ -563,8 +604,6 @@
 // ----------------------------------------------------------------------------
 void CPcsKeyMap::SetSpaceAndZeroOnSameKey()
     {
-    PRINT ( _L("Enter CPcsKeyMap::SetSpaceAndZeroOnSameKey") );
-
     static const TInt KSpace = 0x20; // ASCII for " "
     static const TInt KZero  = 0x30; // ASCII for "0"
 
@@ -585,8 +624,6 @@
     keyZero = KeyForCharacterMultiMatch(charZero, EPredictiveQwerty);
     iSpaceAndZeroOnSameKeyOnQwerty = (keySpace == keyZero && keyZero != EPtiKeyNone);
     PRINT1 ( _L("CPcsKeyMap::iSpaceAndZeroOnSameKeyOnQwerty = %d"), iSpaceAndZeroOnSameKeyOnQwerty );
-
-    PRINT ( _L("CPcsKeyMap::SetSpaceAndZeroOnSameKey") );
     }
 
 // ----------------------------------------------------------------------------
@@ -612,17 +649,18 @@
     }
 
 // ----------------------------------------------------------------------------
-// CPcsKeyMap::SetupKeyboardTypesL
+// CPcsKeyMap::GetPhysicalKeyboardTypesL
 // Initialise the keyboard type variables
 // ----------------------------------------------------------------------------
-void CPcsKeyMap::SetupKeyboardTypesL()
+void CPcsKeyMap::GetPhysicalKeyboardTypesL( TPtiKeyboardType& aItutKbType,
+                                              TPtiKeyboardType& aQwertyKbType )
     {
     TInt physicalKeyboard = 0;
     CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
     aknFepRepository->Get( KAknFepPhysicalKeyboards, physicalKeyboard );
     delete aknFepRepository;
 
-    PRINT1 ( _L("CPcsKeyMap::SetupKeyboardTypesL: Physical keyboard support flag = 0x%02X"), physicalKeyboard );
+    PRINT1 ( _L("CPcsKeyMap::GetPhysicalKeyboardTypesL: Physical keyboard support flag = 0x%02X"), physicalKeyboard );
 
     // Constants follow the definition of KAknFepPhysicalKeyboards
     const TInt KPtiKeyboard12Key = 0x01;
@@ -632,49 +670,50 @@
     const TInt KPtiKeyboardHalfQwerty = 0x10;
     const TInt KPtiKeyboardCustomQwerty = 0x20; 
 
-    // Setup ITU-T mode first.
+    // Get ITU-T mode first.
     // Use always 12-key mode since all the supported devices should have at least
     // virtual ITU-T available.
-    iItutKeyboardType = EPtiKeyboard12Key;
-    // TODO: ITU-T type could be set to "none" if device does not have either
-    // virtual keypad or hardware ITU-T available. This could be decided according
-    // some cenrep value, feature flag, device model, or platform version.
+    // It will be set to EPtiKeyboardNone if getting the key list will fail.
+    if ( physicalKeyboard & KPtiKeyboard12Key )
+        {
+        aItutKbType = EPtiKeyboard12Key;
+        }
+    else
+        {
+        aItutKbType = EPtiKeyboardNone;
+        }
     
-    // Then setup QWERTY mode. On real-life devices there should never
+    // Then get QWERTY mode. On real-life devices there should never
     // be more than one QWERTY keyboard available but on emulator there can be several.
     // Use the first one found in the following precedence
+    // It will be set to EPtiKeyboardNone if getting the key list will fail.
     if ( physicalKeyboard & KPtiKeyboardQwerty3x11 )
         {
-        iQwertyKeyboardType = EPtiKeyboardQwerty3x11;
+        aQwertyKbType = EPtiKeyboardQwerty3x11;
         }
     else if ( physicalKeyboard & KPtiKeyboardQwerty4x10 )
         {
-        iQwertyKeyboardType = EPtiKeyboardQwerty4x10;
+        aQwertyKbType = EPtiKeyboardQwerty4x10;
         }
     else if ( physicalKeyboard & KPtiKeyboardQwerty4x12 )
         {
-        iQwertyKeyboardType = EPtiKeyboardQwerty4x12;
+        aQwertyKbType = EPtiKeyboardQwerty4x12;
         }
     else if ( physicalKeyboard & KPtiKeyboardCustomQwerty )
         {
-        iQwertyKeyboardType = EPtiKeyboardCustomQwerty;
+        aQwertyKbType = EPtiKeyboardCustomQwerty;
         }
     else if ( physicalKeyboard & KPtiKeyboardHalfQwerty )
         {
-        iQwertyKeyboardType = EPtiKeyboardHalfQwerty;
+        aQwertyKbType = EPtiKeyboardHalfQwerty;
         }
     else
         {
-        iQwertyKeyboardType = EPtiKeyboardNone;
+        aQwertyKbType = EPtiKeyboardNone;
         }
-    
-    // Set the Default Predictive keyboard mode
-    iPredictiveDefaultKeyboardMode = ( 
-            (physicalKeyboard & KPtiKeyboard12Key) || (iQwertyKeyboardType == EPtiKeyboardNone) ?
-                EPredictiveItuT : EPredictiveQwerty );
-    
-    PRINT1 ( _L("CPcsKeyMap::SetupKeyboardTypesL: ITU-T Keyboard chosen for Predictive Search = %d"), iItutKeyboardType );
-    PRINT1 ( _L("CPcsKeyMap::SetupKeyboardTypesL: QWERTY Keyboard chosen for Predictive Search = %d"), iQwertyKeyboardType );
+        
+    PRINT1 ( _L("CPcsKeyMap::GetPhysicalKeyboardTypesL: Physical ITU-T Keyboard = %d"), aItutKbType );
+    PRINT1 ( _L("CPcsKeyMap::GetPhysicalKeyboardTypesL: Physical QWERTY Keyboard = %d"), aQwertyKbType );
     }
 
 // ----------------------------------------------------------------------------
@@ -1116,53 +1155,45 @@
     PRINT1 ( _L("CPcsKeyMap::GetPredictiveKeyboardData: aKbMode=%d "), aKbMode );
     
     // EPredictiveItuT or EPredictiveQwerty mode to ENonPredictive mode if keyboard is not mapped
-    if ( aKbMode == EPredictiveItuT && iItutKeyboardType == EPtiKeyboardNone )
+    if ( aKbMode == EPredictiveItuT && !IsItutPredictiveAvailable() )
         {
-        aKbMode = ENonPredictive;    
+        aKbMode = ENonPredictive;
         }
-    if ( aKbMode == EPredictiveQwerty && iQwertyKeyboardType == EPtiKeyboardNone )
+    if ( aKbMode == EPredictiveQwerty && !IsQwertyPredictiveAvailable() )
         {
-        aKbMode = ENonPredictive;    
+        aKbMode = ENonPredictive;
         }
 
     // Get Predictive Keyboard Data
     switch (aKbMode)
         {
         case EPredictiveItuT:
-            {
             aPtiKeys = &iItutKeys;
             aKeyMappings = &iItutKeyMaps;
             aKbType = iItutKeyboardType;
             break;
-            }
 
         case EPredictiveQwerty:
-            {
             aPtiKeys = &iQwertyKeys;
             aKeyMappings = &iQwertyKeyMaps;
             aKbType = iQwertyKeyboardType;
             break;
-            }
 
         case ENonPredictive:
-            {
             aPtiKeys = NULL;
             aKeyMappings = NULL;
             aKbType = EPtiKeyboardNone;
             break;
-            }
 
         // EPredictiveDefaultKeyboard must have been resolved previously
         // to EPredictiveItuT or EPredictiveQwerty mode
         case EPredictiveDefaultKeyboard: 
         default:
-            {
             aPtiKeys = NULL;
             aKeyMappings = NULL;
             aKbType = EPtiKeyboardNone;
             __ASSERT_DEBUG( EFalse, Panic( EPanic_InvalidKeyboardType ) );
             break;
-            }
         }
     }
 
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2Utils.h	Wed Mar 31 21:13:53 2010 +0300
@@ -64,4 +64,21 @@
     static TBool IsGroupUri(TDesC& aURI);
 
     };
+
+// CleanupStack helpers for item owning RPointerArrays
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+    inline static void PushL(T& aRef)
+        { CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef)); }
+private:
+    inline static void ResetAndDestroy(TAny *aPtr)
+        { static_cast<T*>(aPtr)->ResetAndDestroy(); }
+    };
+
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+    { CleanupResetAndDestroy<T>::PushL(aRef); }
+
 #endif // C_PCS_ALGORITHM_2_UTILS
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsKeyMap.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsKeyMap.h	Wed Mar 31 21:13:53 2010 +0300
@@ -71,10 +71,12 @@
     TBool IsLanguageSupportedL(const TUint32 aLanguage);
 
     void ReconstructKeymapL();
+    
     /**
-     * Returns the pool Id for a key                               
+     * Returns the pool Id for a Character                               
      */
-    TInt CPcsKeyMap::PoolIdForCharacter(const TChar& aChar);
+    TInt PoolIdForCharacter(TChar aChar);
+    
     /**
      * Returns total number of pools                                
      */
@@ -155,6 +157,13 @@
      * @ aLanguage, the keymap construct language.
      */
     void AddKeyMapforConcreteKeyboardL( TInt aKeyboardType, TLanguage aLanguage );
+    
+    /**
+     * In case the given character is a Chinese characer, give the first
+     * character of it's first spelling using the current spelling mode.
+     * Otherwise, the character is returned unmodified.
+     */
+    TChar FirstCharFromSpellingL( TChar aChar ) const;
 
 private:
     CPtiEngine* iPtiEngine;
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/FindUtilChineseECE.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/FindUtilChineseECE.h	Wed Mar 31 21:13:53 2010 +0300
@@ -192,6 +192,16 @@
      * 
      */
     void SetKeyboardMode(TInt aMode);
+    
+    /**
+     * Translate Chinese word to its spelling
+     *
+     * @since S60 v3.2
+     * @param aHZUnicode For translate word
+     * @param aSpellList Reference to spelling list for polyphonic word
+     * @return ETrue for this word can be translated; otherwise EFalse
+     */
+    TBool DoTranslationL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
 
     /*
      * 
@@ -230,15 +240,6 @@
 
     TInt CategoryOfLang(TLanguage aLanguage);
 
-    /**
-     * Translate Chinese word to its spelling
-     *
-     * @since S60 v3.2
-     * @param aHZUnicode For translate word
-     * @param aSpellList Reference to spelling list for polyphonic word
-     * @return ETrue for this word can be translated; otherwise EFalse
-     */
-    TBool DoTranslationL(TInt16 aHZUnicode, RPointerArray<HBufC>& aSpellList);
 
     /**
      * This letter is stroke symbol
--- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2Helper.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2Helper.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -116,12 +116,6 @@
     CPcsAlgorithm2FilterHelper* filterHelper =
             CPcsAlgorithm2FilterHelper::NewL(sortType);
 
-    // Convert the search condition to numeric key string
-    TBuf<KPsQueryMaxLen> numericKeyStr;
-    TPtrC queryPtr = aPsQuery.QueryAsStringLC();
-    keyMap->GetNumericKeyString(queryPtr, numericKeyStr);
-    PRINT2 ( _L("Numeric Key String for %S = %S"), &queryPtr, &numericKeyStr );
-
     // Reset the result set array for new search
     iSearchResultsArr.ResetAndDestroy();
 
@@ -132,9 +126,10 @@
     // Get the required display fields from the client
     RArray<TInt> requiredDataFields;
     aSettings.DisplayFieldsL(requiredDataFields);
-
-    // Search based on first key str
-    TInt numValue = keyMap->PoolIdForCharacter(numericKeyStr[0]);
+    
+    // Search from cache based on first character
+     const CPsQueryItem& firstCharItem = aPsQuery.GetItemAtL(0);
+     TInt numValue  = keyMap->PoolIdForCharacter( firstCharItem.Character() );
 
     // Perform search for each required data store
     RPointerArray<CPcsPoolElement> elements;
@@ -225,12 +220,12 @@
     CPcsAlgorithm2FilterHelper* filterHelper =
             CPcsAlgorithm2FilterHelper::NewL(sortType);
 
-    // Convert the search condition to numeric key string
-    TBuf<KPsQueryMaxLen> numericKeyStr;
+    // Convert the query to string
     TPtrC queryPtr = aPsQuery.QueryAsStringLC();
-    keyMap->GetNumericKeyString(queryPtr, numericKeyStr);
-    PRINT2 ( _L("Numeric Key String for %S = %S"), &queryPtr, &numericKeyStr );
-    TInt numValue = keyMap->PoolIdForCharacter(numericKeyStr[0]);
+
+    // Search from cache based on first character
+    const CPsQueryItem& firstCharItem = aPsQuery.GetItemAtL(0);
+    TInt numValue  = keyMap->PoolIdForCharacter( firstCharItem.Character() );
 
     // Reset the result set array for new search
     iSearchResultsArr.ResetAndDestroy();
@@ -261,7 +256,7 @@
         cache->GetContactsForKeyL(numValue, elements);
 
         // Perform filtering
-        FilterResultsL(filterHelper, elements, numericKeyStr,
+        FilterResultsL(filterHelper, elements, queryPtr,
                        isSearchInGroup, aContactsInGroup);
 
         // If alphabetical sorting, get the results for this datastore               
@@ -328,33 +323,13 @@
     CPcsAlgorithm2FilterHelper* filterHelper =
             CPcsAlgorithm2FilterHelper::NewL(sortType);
 
-    // Convert the search condition to numeric key string
-    TBuf<KPsQueryMaxLen> numericKeyStr;
+    // Convert the query to string
     TPtrC queryPtr = aPsQuery.QueryAsStringLC();
 
-    TChar queryChar;
-
-    // Handle Chinese word search case: extract the first char of one of its spelling
-    // which will be used as search string
-    if (iAlgorithm->FindUtilECE()->IsChineseWord(queryPtr))
-        {
-        RPointerArray<HBufC> spellList;
-        if (iAlgorithm->FindUtilECE()->T9ChineseTranslationL(queryPtr[0], spellList))
-            {
-            queryChar = *(spellList[0]->Ptr());
-            }
-        else
-            {
-            queryChar = queryPtr[0];
-            }
-        spellList.ResetAndDestroy();
-        }
-    else
-        {
-        queryChar = queryPtr[0];
-        }
-
-    TInt numValue = keyMap->PoolIdForCharacter(queryChar);
+    // Search from cache based on first character
+    const CPsQueryItem& firstCharItem = aPsQuery.GetItemAtL(0);
+    TInt numValue  = keyMap->PoolIdForCharacter( firstCharItem.Character() );
+    
     // Reset the result set array for new search
     iSearchResultsArr.ResetAndDestroy();
 
--- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2MultiSearchHelper.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2MultiSearchHelper.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -130,12 +130,6 @@
     CPcsAlgorithm2FilterHelper* filterHelper = CPcsAlgorithm2FilterHelper::NewL(sortType);
     RPointerArray<CPcsPoolElement> elements;
 
-    // Get the initial search elements using the first key of first query
-    TBuf<50> numericKeyStr;
-    TPtrC queryPtr = aPsQuery[0]->QueryAsStringLC();
-    keyMap->GetNumericKeyString(queryPtr, numericKeyStr);
-    CleanupStack::PopAndDestroy();
-
     iMultiSearchResultsArr.ResetAndDestroy();
 
     // Get the data stores  
@@ -146,8 +140,10 @@
     RArray<TInt> requiredDataFields;
     aSettings.DisplayFieldsL(requiredDataFields);
 
-    // Search based on first key str
-    TInt numValue = keyMap->PoolIdForCharacter(numericKeyStr[0]);
+    // Search from cache based on first character
+    const CPsQueryItem& firstCharItem = aPsQuery[0]->GetItemAtL(0);
+    TInt numValue  = keyMap->PoolIdForCharacter( firstCharItem.Character() );
+    
     // Get the elements from all the databases
     for (int dsIndex = 0; dsIndex < aDataStores.Count(); dsIndex++)
         {
--- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsKeyMap.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsKeyMap.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -19,6 +19,7 @@
 // INCLUDE FILES
 
 #include "CPcsAlgorithm2.h"
+#include "CPcsAlgorithm2Utils.h"
 #include "FindUtilChineseECE.h"
 #include "CPcsDebug.h"
 #include "CPcsKeyMap.h"
@@ -693,9 +694,14 @@
 // CPcsKeyMap::PoolIdForCharacter
 // 
 // ----------------------------------------------------------------------------
-TInt CPcsKeyMap::PoolIdForCharacter(const TChar& aChar)
+TInt CPcsKeyMap::PoolIdForCharacter(TChar aChar)
     {
     TInt numValue = KErrNotFound;
+    
+    // If character is a Chinese word character, then we select the
+    // pool ID according the first character of the first spelling of the word.
+    TRAP_IGNORE( aChar = FirstCharFromSpellingL( aChar ) );
+    
     TInt key = KeyForCharacter(aChar);
     if (key != KErrNotFound)
         {
@@ -712,6 +718,27 @@
     }
 
 // ----------------------------------------------------------------------------
+// CPcsKeyMap::CPcsKeyMap::FirstCharFromSpellingL
+// 
+// ----------------------------------------------------------------------------
+TChar CPcsKeyMap::FirstCharFromSpellingL( TChar aChar ) const
+    {
+    TChar translated( aChar );
+    TBuf<1> temp;
+    temp.Append( aChar );
+    if ( iAlgorithm->FindUtilECE()->IsChineseWord( temp ) )
+        {
+        RPointerArray<HBufC> spellList;
+        CleanupResetAndDestroyPushL( spellList );
+        if (iAlgorithm->FindUtilECE()->DoTranslationL(aChar, spellList))
+            {
+            translated = (*spellList[0])[0];
+            }
+        CleanupStack::PopAndDestroy( &spellList ); // ResetAndDestroy
+        }
+    return translated;
+    }
+// ----------------------------------------------------------------------------
 // CPcsKeyMap::PoolCount
 // 
 // ----------------------------------------------------------------------------
--- a/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -226,8 +226,8 @@
     for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ )
     {
        iPcsPluginInstances[idx]->SearchMatchStringL( aSearchQuery,
-                                               aSearchData,                                                  
-                                               aMatch );
+                                                     aSearchData,
+                                                     aMatch );
     }
     
     PRINT ( _L("End CPcsPluginInterface::SearchMatchStringL") );
--- a/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -537,7 +537,7 @@
     PRINT1 ( _L("CPSRequestHandler::HandleSearchResultsL: Number of search results received = %d"), count );
 
     // Internalize each data element
-    for (int i = 0; i < count; i++)
+    for (TInt i = 0; i < count; i++)
         {
         CPsClientData* data = CPsClientData::NewL();
         CleanupStack::PushL(data);
@@ -575,7 +575,7 @@
     PRINT1 ( _L("CPSRequestHandler::HandleSearchResultsL: Number of match sequences received = %d"), seqCount );
 
     // Internalize each char seq
-    for (int i = 0; i < seqCount; i++)
+    for (TInt i = 0; i < seqCount; i++)
         {
         CPsPattern* pattern = CPsPattern::NewL();
         CleanupStack::PushL(pattern);
@@ -590,36 +590,21 @@
         searchSeqs.Append(pattern);
         }
 
-    CleanupStack::PopAndDestroy(); // stream
+    CleanupStack::PopAndDestroy( &stream );
 
     // Pass the results to the observer
-    for (int i = 0; i < iObservers.Count(); i++)
+    for (TInt i = 0; i < iObservers.Count(); i++)
         {
         iObservers[i]->HandlePsResultsUpdate(searchResults, searchSeqs);
         }
 
     // Clear all the internal buffers
-    if (iSearchQueryBuffer)
-        {
-        delete iSearchQueryBuffer;
-        iSearchQueryBuffer = NULL;
-        }
-
-    if (searchResults.Count())
-        {
-        searchResults.ResetAndDestroy();
-        }
-
-    if (searchSeqs.Count())
-        {
-        searchSeqs.ResetAndDestroy();
-        }
-
-    if (iSearchResultsBuffer)
-        {
-        delete iSearchResultsBuffer;
-        iSearchResultsBuffer = NULL;
-        }
+    searchResults.ResetAndDestroy();
+    searchSeqs.ResetAndDestroy();
+    delete iSearchQueryBuffer;
+    iSearchQueryBuffer = NULL;
+    delete iSearchResultsBuffer;
+    iSearchResultsBuffer = NULL;
 
     PRINT ( _L("End CPSRequestHandler::HandleSearchResultsL") );
 
--- a/predictivesearch/PcsUtils/inc/CWords.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsUtils/inc/CWords.h	Wed Mar 31 21:13:53 2010 +0300
@@ -31,12 +31,12 @@
     public:  // Constructors and destructor
         /**
          * Creates a new instance of this class.
-		 * @param aText the text to separate
+         * @param aText the text to separate
          */
         IMPORT_C static CWords* NewLC(const TDesC& aText);
         /**
          * Destructor.
-		 */
+         */
         IMPORT_C ~CWords();
         
     public:  // from MDesCArray
@@ -49,8 +49,8 @@
         static TBool DefaultIsWordSeparator(TChar aChar);
 
     private:
-	
-		/// Own: array of words
+
+        /// Own: array of words
         RArray<TPtrC> iWords;
     };
     
--- a/predictivesearch/PcsUtils/src/CWords.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/PcsUtils/src/CWords.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -65,7 +65,7 @@
                 }
             const TInt len = end-beg;
             // Append found word to the array
-            User::LeaveIfError(iWords.Append(aText.Mid(beg,len)));
+            iWords.AppendL( aText.Mid(beg,len) );
             // Scan for next word
             beg = end;
             }
@@ -74,7 +74,7 @@
     if (iWords.Count()==0 && textLength > 0)
         {
         // aText is all word separator characters -> make a "word" out of those
-        User::LeaveIfError(iWords.Append(aText));
+        iWords.AppendL(aText);
         }
     }
 
--- a/predictivesearch/adapters/contacts/group/pscontactdatastore.mmp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/adapters/contacts/group/pscontactdatastore.mmp	Wed Mar 31 21:13:53 2010 +0300
@@ -57,3 +57,6 @@
 LIBRARY	    	PcsUtils.lib
 LIBRARY         VPbkEng.lib
 LIBRARY         centralrepository.lib
+LIBRARY         FeatMgr.lib
+LIBRARY         pbk2presentation.lib
+
--- a/predictivesearch/adapters/contacts/inc/cpcscontactfetch.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/adapters/contacts/inc/cpcscontactfetch.h	Wed Mar 31 21:13:53 2010 +0300
@@ -27,238 +27,218 @@
 #include <MVPbkContactStoreListObserver.h>
 #include <MVPbkContactFindFromStoresObserver.h>
 #include <MVPbkSingleContactOperationObserver.h>
-#include <MVPbkContactViewObserver.h>
-#include <CVPbkContactLinkArray.h>
 
-// USER INCLUDES 
+// USER INCLUDES
 #include "mdatastoreobserver.h"
 #include "cpcscontactstore.h"
 #include "PSContactsAdapterInternalCRKeys.h"
 
 // FORWARD DECLARATIONS
-class CPsData;
 class CVPbkContactManager;
-class CVPbkContactStoreUriArray;
-class CVPbkContactLinkArray;
-class MVPbkContactOperationBase;
-class MVPbkContactLinkArray;
-class MVPbkBaseContact;
-class CVPbkFieldTypeRefsList;
-class MVPbkContactViewObserver;
 
 
 /**
- *  This class is the contact fetch class. 
- *  This class manages all the data stores defined. 
+ *  This class is the contact fetch class.
+ *  This class manages all the data stores defined.
  *  @lib pscontactsadapter.lib
  */
 class CPcsContactFetch: public CActive,
                         public MVPbkContactStoreListObserver
 
-                          
-{	
-	public:
+
+{
+    public:
 
-			/**
-			* 1st phase constructor 
-			* @return returns pointer to the constructed object of type CPcsContactFetch
-			*/
-			static CPcsContactFetch* NewL();
+            /**
+             * 1st phase constructor
+             * @return returns pointer to the constructed object of type CPcsContactFetch
+             */
+            static CPcsContactFetch* NewL();
 
-			/**
-			* Destructor
-			*/
-			virtual ~CPcsContactFetch();
-   
-	public:
-	
-			// From base class MVPbkContactStoreListObserver
+            /**
+             * Destructor
+             */
+            virtual ~CPcsContactFetch();
+
+    public:
 
-			/**
-			* From MVPbkContactStoreListObserver  
-			* Called when the opening process is complete, ie. all stores have been reported
-			* either failed or successfully opened.
-			*/
-			void OpenComplete();  
+            // From base class MVPbkContactStoreListObserver
 
-			/**
-			* From MVPbkContactStoreListObserver  
-			* Called when a contact store is ready to use.
-			* @param aContactStore - The store that became available.
-			*/
-			void StoreReady(MVPbkContactStore& aContactStore);
+            /**
+             * From MVPbkContactStoreListObserver
+             * Called when the opening process is complete, ie. all stores have been reported
+             * either failed or successfully opened.
+             */
+            void OpenComplete();
 
-			/**
-			* From MVPbkContactStoreListObserver  
-			* Called when a contact store becomes unavailable.
-			* Client may inspect the reason of the unavailability and decide whether or not
-			* it will keep the store opened (ie. listen to the store events).
-			* @param aContactStore - The store that became unavailable.
-			* @param aReason - The reason why the store is unavailable.
-			*                This is one of the system wide error codes.
-			*/
-			void StoreUnavailable(MVPbkContactStore& aContactStore, TInt aReason);
+            /**
+             * From MVPbkContactStoreListObserver
+             * Called when a contact store is ready to use.
+             * @param aContactStore - The store that became available.
+             */
+            void StoreReady(MVPbkContactStore& aContactStore);
+
+            /**
+             * From MVPbkContactStoreListObserver
+             * Called when a contact store becomes unavailable.
+             * Client may inspect the reason of the unavailability and decide whether or not
+             * it will keep the store opened (ie. listen to the store events).
+             * @param aContactStore - The store that became unavailable.
+             * @param aReason - The reason why the store is unavailable.
+             *                  This is one of the system wide error codes.
+             */
+            void StoreUnavailable(MVPbkContactStore& aContactStore, TInt aReason);
 
-			/**
-			* From MVPbkContactStoreListObserver  
-			* Called when changes occur in the contact store i.e contact 
-			* added/deleted, group added/deleted etc.
-			* @see TVPbkContactStoreEvent
-			* @param aContactStore - The store the event occurred in.
-			* @param aStoreEvent - Event that has occured.
-			*/
-			void HandleStoreEventL(
-			        MVPbkContactStore& aContactStore, 
-			        TVPbkContactStoreEvent aStoreEvent);
-	    
-	public:
-		 	/**
-		    * Gets the supported data stores URIs
-		    * @param aDataStoresURIs supported data stores URIs
-		    */  
-		    void GetSupportedDataStoresL( RPointerArray<TDesC> &aDataStoresURIs );
-		    
-		    /**
-		    * Checks if the data store is supported by this adapter
-		    * @param aDataStoreURI - The datastore to be checked
-		    * @return ETrue if this store is supported
-		    */
-		    TBool IsDataStoresSupportedL( TDesC& aDataStoreURI );
+            /**
+             * From MVPbkContactStoreListObserver
+             * Called when changes occur in the contact store i.e contact
+             * added/deleted, group added/deleted etc.
+             * @see TVPbkContactStoreEvent
+             * @param aContactStore - The store the event occurred in.
+             * @param aStoreEvent - Event that has occured.
+             */
+            void HandleStoreEventL(
+                    MVPbkContactStore& aContactStore,
+                    TVPbkContactStoreEvent aStoreEvent);
 
-			/**
-			* Initiate data fetch from the contacts adapter
-			* @param aDataStoreURI - The store from which data is requested
-			*/
-			void RequestForDataL(TDesC& aDataStoreURI);
+    public:
+            /**
+             * Gets the supported data stores URIs
+             * @param aDataStoresURIs supported data stores URIs
+             */
+            void GetSupportedDataStoresL( RPointerArray<TDesC> &aDataStoresURIs );
 
-			/**
-			* Set the observer to receive the fetched results
-			* @param aObserver - Observer to receive the contacts data
-			*/
-			void SetObserver(MDataStoreObserver& aObserver);
-	
-	public:
-			/**
-		    * Gets the supported data fields 
-		    * @param aDataFields - supported data fields         
-		    */ 
-			void GetSupportedDataFieldsL(RArray<TInt> &aDataFields );
-			
-	protected: 
+            /**
+             * Checks if the data store is supported by this adapter
+             * @param aDataStoreURI - The datastore to be checked
+             * @return ETrue if this store is supported
+             */
+            TBool IsDataStoresSupportedL( TDesC& aDataStoreURI );
+
+            /**
+             * Initiate data fetch from the contacts adapter
+             * @param aDataStoreURI - The store from which data is requested
+             */
+            void RequestForDataL(TDesC& aDataStoreURI);
 
-			// From base class CActive
+            /**
+             * Set the observer to receive the fetched results
+             * @param aObserver - Observer to receive the contacts data
+             */
+            void SetObserver(MDataStoreObserver& aObserver);
 
-			/**
-			* From CActive
-			* Implements cancellation of an outstanding request.
-			* This function is called as part of the active object's Cancel().
-			*/
-			void DoCancel() ;
+    public:
+            /**
+             * Gets the supported data fields
+             * @param aDataFields - supported data fields
+             */
+            void GetSupportedDataFieldsL(RArray<TInt> &aDataFields );
+
+    protected:
+
+            // From base class CActive
 
-			/**
-			* From CActive
-			* Handles an active object's request completion event.
-			*
-			* The function is called by the active scheduler when a request
-			* completion event occurs, i.e. after the active scheduler's
-			* WaitForAnyRequest() function completes.
-			*
-			* Before calling this active object's RunL() function, the active scheduler 
-			* has:
-			* 	
-			* 1. decided that this is the highest priority active object with
-			*   a completed request
-			*
-			* 2. marked this active object's request as complete (i.e. the request is no 
-			*   longer outstanding)
-			*
-			* RunL() runs under a trap harness in the active scheduler. If it leaves,
-			* then the active scheduler calls RunError() to handle the leave.
-			*
-			* Note that once the active scheduler's Start() function has been called, 
-			* all user code is run under one of the program's active object's RunL() or 
-			* RunError() functions.
-			*/
-			void RunL();
+            /**
+             * From CActive
+             * Implements cancellation of an outstanding request.
+             * This function is called as part of the active object's Cancel().
+             */
+            void DoCancel();
 
-				
-			/**
-			* From CActive 
-			* If the RunL function leaves,
-			* then the active scheduler calls RunError() to handle the leave.
-			* @param aError - The error code
-			*/
-			TInt RunError( TInt aError );
-		
-	private:	
-	
-			/**
-			* Constructor
-			*/
-			CPcsContactFetch();
-
-			/** 
-			* 2nd phase constructor
-			*/
-			void ConstructL();
-
-			/**
-			* Fetches the data from a particular contact 
-			* @param aContact - The contact from database 
-			* @param aPhoneData - The contact in CPsData format 
-			*/
-			void  GetDataForSingleContactL ( MVPbkBaseContact& aContact,CPsData* aPhoneData );
+            /**
+             * From CActive
+             * Handles an active object's request completion event.
+             *
+             * The function is called by the active scheduler when a request
+             * completion event occurs, i.e. after the active scheduler's
+             * WaitForAnyRequest() function completes.
+             *
+             * Before calling this active object's RunL() function, the active scheduler
+             * has:
+             *
+             * 1. decided that this is the highest priority active object with
+             *   a completed request
+             *
+             * 2. marked this active object's request as complete (i.e. the request is no
+             *   longer outstanding)
+             *
+             * RunL() runs under a trap harness in the active scheduler. If it leaves,
+             * then the active scheduler calls RunError() to handle the leave.
+             *
+             * Note that once the active scheduler's Start() function has been called,
+             * all user code is run under one of the program's active object's RunL() or
+             * RunError() functions.
+             */
+            void RunL();
 
 
-			/**
-			* Creates the substore 
-			* @param aDataStoreURI - The store for which substore is to be created
-			*/
- 			void CreateSubStoresL(TDesC& aDataStoreURI);
-            
-            
+            /**
+             * From CActive
+             * If the RunL function leaves,
+             * then the active scheduler calls RunError() to handle the leave.
+             * @param aError - The error code
+             */
+            TInt RunError( TInt aError );
+
+    private:
+
             /**
-			* Reads the configured URIs from the central repository
-			*/
+             * Constructor
+             */
+            CPcsContactFetch();
+
+            /**
+             * 2nd phase constructor
+             */
+            void ConstructL();
+
+            /**
+             * Creates the substore
+             * @param aDataStoreURI - The store for which substore is to be created
+             */
+             void CreateSubStoresL(TDesC& aDataStoreURI);
+
+            /**
+             * Reads the configured URIs from the central repository
+             */
             void ReadUrisFromCenrepL();
-            
-	private:
-	
-	        /**
-			 * Holds the observer object to communicate add/modify/delete of contacts
-			 * Not owned.
-			 */
-			MDataStoreObserver* iObserver;
-	    
-	    	/**
+
+    private:
+
+            /**
+             * Holds the observer object to communicate add/modify/delete of contacts
+             * Not owned.
+             */
+            MDataStoreObserver* iObserver;
+
+            /**
              * Owns an instance of active scheduler wait
              */
-    	    CActiveSchedulerWait *iWait;
-    	      
-			/**
-			 * Flags for store operations
-			 */
-			TBool   iAtLeastOneStoreReady; 
-			TBool   iNoContactStoreAvailable;
-			TBool   iRequestForData;
-			TBool   iSubStoreCreated;
+            CActiveSchedulerWait *iWait;
 
-			/**
-			 * The contact manager for accessing the phone contacts
-			 * Own.  
-			 */
-			CVPbkContactManager*  iContactManager;		
+            /**
+             * Flags for store operations
+             */
+            TBool iAtLeastOneStoreReady;
+            TBool iNoContactStoreAvailable;
+            TBool iRequestForData;
+            TBool iSubStoreCreated;
 
-			/**
+            /**
+             * The contact manager for accessing the phone contacts
+             * Own.
+             */
+            CVPbkContactManager*  iContactManager;
+
+            /**
              * Uris(data stores) read from the central repository
              */
-    	    RPointerArray<HBufC> iUriFromCenrep;
+            RPointerArray<HBufC> iUriFromCenrep;
 
-			/**
+            /**
              * Data stores instances
              */
-    	    RPointerArray<CPcsContactStore> iAllDataStores;
-   
+            RPointerArray<CPcsContactStore> iAllDataStores;
 };
 
 #endif // C_PCS_CONTACT_FETCH_H
--- a/predictivesearch/adapters/contacts/inc/cpcscontactstore.h	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/adapters/contacts/inc/cpcscontactstore.h	Wed Mar 31 21:13:53 2010 +0300
@@ -29,322 +29,335 @@
 #include <MVPbkSingleContactOperationObserver.h>
 #include <MVPbkContactViewObserver.h>
 #include <CVPbkContactManager.h>
-#include <CVPbkContactLinkArray.h>
 
-// USER INCLUDES 
+// USER INCLUDES
 #include "mdatastoreobserver.h"
 #include "PSContactsAdapterInternalCRKeys.h"
 
 // FORWARD DECLARATIONS
 class CPsData;
 class CVPbkContactManager;
-class CVPbkContactStoreUriArray;
 class CVPbkContactLinkArray;
 class MVPbkContactOperationBase;
-class MVPbkContactLinkArray;
 class MVPbkBaseContact;
 class CVPbkFieldTypeRefsList;
-class CVPbkFieldTypeRefsList;
 class MVPbkContactViewObserver;
+class CPbk2SortOrderManager;
+
 /**
-* States involved in fetching the contacts
-*/
+ * States involved in fetching the contacts
+ */
 enum
 {
-	ECreateView,
-	EFetchContactBlock,
-	EComplete
+    ECreateView,
+    EFetchContactBlock,
+    EComplete
 };
 
 /**
- *  This class represents the data store for the contacts 
+ *  This class represents the data store for the contacts
  *  Each data store (phonecontacts, simcontact, group contacts) is an
  *  instance of this class
  *  @lib pscontactsadapter.lib
  */
-class CPcsContactStore: public CActive, 
+class CPcsContactStore: public CActive,
                         public MVPbkSingleContactOperationObserver,
                         public MVPbkContactViewObserver
-                          
-{	
-	public:
+
+{
+    public:
+
+        /**
+         * 2 phase construction
+         * @param aContactManager - the contact manager
+         * @param aObserver - observer for receiving data
+         * @param aUri - the data store uri
+         * @return returns pointer to the constructed object of type CPcsContactStore
+         */
+        static CPcsContactStore* NewL(CVPbkContactManager& aContactManager,
+                                      MDataStoreObserver& aObserver,
+                                      const TDesC& aUri);
 
-		/**
-		* 2 phase construction
-		* @param aContactManager - the contact manager 
-		* @param aObserver - observer for receiving data
-		* @param aUri - the data store uri
-		* @return returns pointer to the constructed object of type CPcsContactStore
-		*/
-		static CPcsContactStore* NewL(CVPbkContactManager&  aContactManager,
-		                              MDataStoreObserver& aObserver,
-			                              const TDesC& aUri);
+        /**
+         * Destructor
+         */
+        virtual ~CPcsContactStore();
+
+        /**
+         * Handles store events (contact/group addition/modification/deletion etc.)
+         * @param aContactStore - the contact store
+         * @param aStoreEvent - store event
+         */
+        void HandleStoreEventL(MVPbkContactStore& aContactStore,
+                               TVPbkContactStoreEvent aStoreEvent);
+
+        /**
+         * Gets the store Uri
+         * @return - the store uri supported by this instance
+         */
+        TDesC& GetStoreUri();
+
+    public:
+
+        // From base class MVPbkSingleContactOperationObserver
 
-		/**
-		* Destructor
-		*/
-		virtual ~CPcsContactStore();
-		
-		/**
-		* Handles store events (contact/group addition/modification/deletion etc.)
-		* @param aContactStore - the contact store 
-		* @param aStoreEvent - store event
-		*/
-		void HandleStoreEventL(MVPbkContactStore& aContactStore, 
-            				   TVPbkContactStoreEvent aStoreEvent);	
-                
-		/**
-		* Gets the store Uri
-		* @return - the store uri supported by this instance
-		*/    
-        TDesC& GetStoreUri();    
-        
-	public:
-	
-		// From base class MVPbkSingleContactOperationObserver
-		  
-		/**
-		* From MVPbkSingleContactOperationObserver
-		* Called when operation is completed.
-		*
-		* @param aOperation the completed operation.
-		* @param aContact  the contact returned by the operation.
-		*                  Client must take the ownership immediately.
-		*
-		*                  !!! NOTICE !!!
-		*                  If you use Cleanupstack for MVPbkStoreContact
-		*                  Use MVPbkStoreContact::PushL or
-		*                  CleanupDeletePushL from e32base.h.
-		*                  (Do Not Use CleanupStack::PushL(TAny*) because
-		*                  then the virtual destructor of the M-class
-		*                  won't be called when the object is deleted).
-		*/
-		void VPbkSingleContactOperationComplete(
-		        MVPbkContactOperationBase& aOperation,
-		        MVPbkStoreContact* aContact );
+        /**
+         * From MVPbkSingleContactOperationObserver
+         * Called when operation is completed.
+         *
+         * @param aOperation the completed operation.
+         * @param aContact  the contact returned by the operation.
+         *                  Client must take the ownership immediately.
+         *
+         *                  !!! NOTICE !!!
+         *                  If you use Cleanupstack for MVPbkStoreContact
+         *                  Use MVPbkStoreContact::PushL or
+         *                  CleanupDeletePushL from e32base.h.
+         *                  (Do Not Use CleanupStack::PushL(TAny*) because
+         *                  then the virtual destructor of the M-class
+         *                  won't be called when the object is deleted).
+         */
+        void VPbkSingleContactOperationComplete(
+                MVPbkContactOperationBase& aOperation,
+                MVPbkStoreContact* aContact );
 
-		/**
-		* From MVPbkSingleContactOperationObserver
-		* Called if the operation fails.
-		*
-		* @param aOperation    the failed operation.
-		* @param aError        error code of the failure.
-		*/
-		void VPbkSingleContactOperationFailed(
-		        MVPbkContactOperationBase& aOperation, 
-		        TInt aError );
-                	
-	public :
+        /**
+         * From MVPbkSingleContactOperationObserver
+         * Called if the operation fails.
+         *
+         * @param aOperation    the failed operation.
+         * @param aError        error code of the failure.
+         */
+        void VPbkSingleContactOperationFailed(
+                MVPbkContactOperationBase& aOperation,
+                TInt aError );
+
+    public :
+
+        // From base class MVPbkContactViewObserver
+
+        void ContactViewReady(
+                    MVPbkContactViewBase& aView );
 
-		// From base class MVPbkContactViewObserver
+        void ContactViewUnavailable(
+                    MVPbkContactViewBase& aView );
+
+        void ContactAddedToView(
+                    MVPbkContactViewBase& aView,
+                    TInt aIndex,
+                    const MVPbkContactLink& aContactLink );
+
+        void ContactRemovedFromView(
+                    MVPbkContactViewBase& aView,
+                    TInt aIndex,
+                    const MVPbkContactLink& aContactLink );
+
+        void ContactViewError(
+                    MVPbkContactViewBase& aView,
+                    TInt aError,
+                    TBool aErrorNotified );
 
-		void ContactViewReady(
-		            MVPbkContactViewBase& aView ) ;
-		            
-		void ContactViewUnavailable(
-		            MVPbkContactViewBase& aView ) ;
-		            
-		void ContactAddedToView(
-		            MVPbkContactViewBase& aView, 
-		            TInt aIndex, 
-		            const MVPbkContactLink& aContactLink );
-		            
-		void ContactRemovedFromView(
-		            MVPbkContactViewBase& aView, 
-		            TInt aIndex, 
-		            const MVPbkContactLink& aContactLink ) ;
-		            
-		void ContactViewError(
-		            MVPbkContactViewBase& aView, 
-		            TInt aError, 
-		            TBool aErrorNotified ) ;
-		            
-			
-	protected: 
+    protected:
+
+        // From base class CActive
+
+        /**
+         * From CActive
+         * Implements cancellation of an outstanding request.
+         *
+         * This function is called as part of the active object's Cancel().
+         */
+        void DoCancel();
 
-		// From base class CActive
+        /**
+         * From CActive
+         * Handles an active object's request completion event.
+         *
+         * The function is called by the active scheduler when a request
+         * completion event occurs, i.e. after the active scheduler's
+         * WaitForAnyRequest() function completes.
+         *
+         * Before calling this active object's RunL() function, the active scheduler
+         * has:
+         *
+         * 1. decided that this is the highest priority active object with
+         *   a completed request
+         *
+         * 2. marked this active object's request as complete (i.e. the request is no
+         *   longer outstanding)
+         *
+         * RunL() runs under a trap harness in the active scheduler. If it leaves,
+         * then the active scheduler calls RunError() to handle the leave.
+         *
+         * Note that once the active scheduler's Start() function has been called,
+         * all user code is run under one of the program's active object's RunL() or
+         * RunError() functions.
+         */
+        void RunL();
 
-		/**
-		* From CActive
-		* Implements cancellation of an outstanding request.
-		*
-		* This function is called as part of the active object's Cancel().
-		*/
-		void DoCancel() ;
+        /**
+         * From CActive
+         * If the RunL function leaves,
+         * then the active scheduler calls RunError() to handle the leave.
+         * @param aError - The error code
+         */
+        TInt RunError( TInt aError );
 
-		/**
-		* From CActive
-		* Handles an active object's request completion event.
-		*
-		* The function is called by the active scheduler when a request
-		* completion event occurs, i.e. after the active scheduler's
-		* WaitForAnyRequest() function completes.
-		*
-		* Before calling this active object's RunL() function, the active scheduler 
-		* has:
-		* 	
-		* 1. decided that this is the highest priority active object with
-		*   a completed request
-		*
-		* 2. marked this active object's request as complete (i.e. the request is no 
-		*   longer outstanding)
-		*
-		* RunL() runs under a trap harness in the active scheduler. If it leaves,
-		* then the active scheduler calls RunError() to handle the leave.
-		*
-		* Note that once the active scheduler's Start() function has been called, 
-		* all user code is run under one of the program's active object's RunL() or 
-		* RunError() functions.
-		*/
-		void RunL();
+    private:
+
+        /**
+         * Constructor
+         */
+        CPcsContactStore();
+
+        /**
+         * 2nd phase constructor
+         */
+        void ConstructL(CVPbkContactManager& aContactManager, MDataStoreObserver& aObserver,const TDesC& aUri);
+
+        /**
+         * Handles the operations for a single contact after it is fetched
+         * @param aContact - The contact from database
+         */
+        void HandleRetrievedContactL(MVPbkStoreContact* aContact);
 
-			
-		/**
-		* From CActive 
-		* If the RunL function leaves,
-		* then the active scheduler calls RunError() to handle the leave.
-		* @param aError - The error code
-		*/
-		TInt RunError( TInt aError );
-			
-	private:	
-	
-		/**
-		* Constructor
-		*/
-		CPcsContactStore();
+        /**
+         * Fetches the data from a particular contact
+         * @param aContact - The contact from database
+         *
+         */
+        void  GetDataForSingleContactL ( MVPbkBaseContact& aContact, CPsData* aPhoneData );
 
-		/** 
-		* 2nd phase constructor
-		*/
-			void ConstructL(CVPbkContactManager&  aContactManager,MDataStoreObserver& aObserver,const TDesC& aUri);
-
-		/**
-		* Handles the operations for a single contact after it is fetched
-		* @param aContact - The contact from database 
-		*/
-		void HandleRetrievedContactL(MVPbkStoreContact* aContact);
+        /**
+         * Add the data from contact fields
+         * @param aContact - The contact from database
+         * @param afieldtype - Field to be added
+         * @param aPhoneData - the contact data in PS format
+         */
+        void AddContactFieldsL(MVPbkBaseContact& aContact, TInt afieldtype, CPsData* aPhoneData);
 
-		/**
-		* Fetches the data from a particular contact 
-		* @param aContact - The contact from database 
-		* 
-		*/
-		void  GetDataForSingleContactL ( MVPbkBaseContact& aContact,CPsData* aPhoneData );
-
-		/**
-		* Add the data from contact fields
-		* @param aContact - The contact from database 
-		* @param afieldtype - Field to be added 
-		* @param aPhoneData - the contact data in PS format
-		*/
-		void AddContactFieldsL(MVPbkBaseContact& aContact,TInt afieldtype,CPsData* aPhoneData);		
+        /**
+         * Fetches the  data from contact links from the view
+         */
+        void FetchlinksL();
 
-		/**
-		* Fetches the  data from contact links from the view 
-		*/
-        void FetchlinksL();
-        
-		/**
-		* Reads the fields to cache from the central repository 
-		*/            
+        /**
+         * Reads the fields to cache from the central repository
+         */
         void ReadFieldsToCacheFromCenrepL();
-        
-		/**
-		* Creates a cacheId corresponding to sim Id Array Index
-		* @param - aSimId - The sim id
-		*/            
+
+        /**
+         * Creates a cacheId corresponding to sim Id Array Index
+         * @param - aSimId - The sim id
+         */
         TInt CreateCacheIDfromSimArrayIndex(TInt aSimId);
 
-		/**
-		* Creates the contact fetch view 
-		*/
-		void CreateContactFetchViewL();
-		/**
-		* Issues request to active object to call RunL method
-		*/
-		void IssueRequest();
-		
-		/**
-		* Creates a sort order depending on the fields specified in the cenrep
-		* @param aMasterList - aMasterList (i.e list containing all the vpbk fields)
-		*/
-		void CreateSortOrderL(const MVPbkFieldTypeList& aMasterList);
-		
-	private:
-	
-	    
-		/**
-		* Flags for store operations
-		*/
-		TInt    iAllContactLinksCount;
-		TInt    iFetchedContactCount;
-		TBool   iContactViewReady;
-		/**
-		* Variable to store the next state for the RunL to take appropriate action
-		*/
-		TInt 	iNextState;
-		
-		/**
-		* The contact manager for accessing the phone contacts
-		* Not Own.  
-		*/
-		CVPbkContactManager*  iContactManager;		
+        /**
+         * Creates the contact fetch view
+         */
+        void CreateContactFetchViewL();
+
+        /**
+         * Issues request to active object to call RunL method
+         */
+        void IssueRequest();
+
+        /**
+         * Creates a sort order depending on the fields specified in the cenrep
+         * @param aMasterList - aMasterList (i.e list containing all the vpbk fields)
+         */
+        void CreateSortOrderL(const MVPbkFieldTypeList& aMasterList);
+        
+        /**
+         * Checks if contact is my card
+         */
+        TBool IsMyCard( const MVPbkBaseContact& aContact );
+
+    private:
+
 
-		/**
-		* Holds a view base instance
-		* Own.
-		*/
-		MVPbkContactViewBase* iContactViewBase;
+        /**
+         * Flags for store operations
+         */
+        TInt  iAllContactLinksCount;
+        TInt  iFetchedContactCount;
+        TBool iContactViewReady;
+
+        /**
+         * Variable to store the next state for the RunL to take appropriate action
+         */
+        TInt iNextState;
 
-		/**
-		* Holds a contact operation
-		* Own.
-		*/
-		MVPbkContactOperationBase* iOp;
+        /**
+         * The contact manager for accessing the phone contacts
+         * Not Own.
+         */
+        CVPbkContactManager* iContactManager;
+
+        /**
+         * Holds a view base instance
+         * Own.
+         */
+        MVPbkContactViewBase* iContactViewBase;
 
         /**
-        * Owns an instance of active scheduler wait
-        */
-	    CActiveSchedulerWait *iWait;
-	        	    
-	    /**
-        * data fields to be cached(read from the central repository)
-        */
-	    RArray<TInt> iFieldsToCache;
-	    
-	  	/**
-        * Array of contact links 
-        */
-	    CVPbkContactLinkArray *iSimContactItems;
-	    
+         * Holds a contact operation
+         * Own.
+         */
+        MVPbkContactOperationBase* iOp;
+
+        /**
+         * Owns an instance of active scheduler wait
+         */
+        CActiveSchedulerWait *iWait;
+
         /**
-		* Holds the observer object to communicate add/modify/delete of contacts
-		* Not owned.
-		*/
-		MDataStoreObserver* iObserver;
-		
-		/**
-        * Contacts Database URI
-        */
+         * data fields to be cached(read from the central repository)
+         */
+        RArray<TInt> iFieldsToCache;
+
+        /**
+         * Array of contact links
+         */
+        CVPbkContactLinkArray *iSimContactItems;
+
+        /**
+         * Holds the observer object to communicate add/modify/delete of contacts
+         * Not owned.
+         */
+        MDataStoreObserver* iObserver;
+
+        /**
+         * Contacts Database URI
+         */
         HBufC* iUri;
 
-		/**
-        * File session
-        */
+        /**
+         * File session
+         */
         RFs iFs;
+
+        /**
+         * RTimer variable to set the timer before RunL calls any function.
+         * This is required to allow other threads to run since contact fetch
+         * is CPU intensive task.
+         */
+        RTimer iTimer;
+
+        /**
+         * Holds the sort order fields
+         */
+        CVPbkFieldTypeRefsList *iSortOrder;
         
         /**
-        * RTimer variable to set the timer before RunL calls any function.
-        * This is required to allow other threads to run since contact fetch 
-        * is CPU intensive task. 
-        */
-        RTimer iTimer;
+         * Holds MyCard supported status
+         */
+        TBool iMyCardSupported;
+		
         /**
-        * Holds the sort order fields
-        */
-        CVPbkFieldTypeRefsList *iSortOrder;
-
+		 * Own. Sort order for all contacts view
+		 */
+        CPbk2SortOrderManager* iSortOrderMan;
 };
 
 #endif // C_PCS_CONTACT_STORE_H
--- a/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp	Mon Mar 15 12:39:26 2010 +0200
+++ b/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp	Wed Mar 31 21:13:53 2010 +0300
@@ -49,6 +49,8 @@
 #include <CVPbkSortOrder.h>
 #include <data_caging_path_literals.hrh>
 #include <bautils.h>
+#include <featmgr.h>
+#include <CPbk2SortOrderManager.h>
 
 // USER INCLUDES
 #include "cpcscontactstore.h"
@@ -90,14 +92,14 @@
 // Constructor
 // ---------------------------------------------------------------------------------
 CPcsContactStore::CPcsContactStore():
-	CActive( CActive::EPriorityLow),
+    CActive( CActive::EPriorityLow ),
     iAllContactLinksCount(0),
     iFetchedContactCount(0),
     iContactViewReady(EFalse)
 {
     PRINT ( _L("Enter CPcsContactStore::CPcsContactStore") );
     CActiveScheduler::Add( this );
-	PRINT ( _L("End CPcsContactStore::CPcsContactStore") );
+    PRINT ( _L("End CPcsContactStore::CPcsContactStore") );
 }
 
 
@@ -117,7 +119,7 @@
 	iUri = HBufC::NewL(aUri.Length());
 	iUri->Des().Copy(aUri);
 	
-	// create containers for holding the sim data      
+	// create containers for holding the sim data
     iSimContactItems = CVPbkContactLinkArray::NewL();
    
 	
@@ -134,6 +136,13 @@
 	iNextState = ECreateView;
 	IssueRequest();
 	
+    FeatureManager::InitializeLibL();
+    if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) )
+        {
+        iMyCardSupported = ETrue;
+        }
+    FeatureManager::UnInitializeLib();    
+
 	PRINT ( _L("End CPcsContactStore::ConstructL") );
 }
 
@@ -158,7 +167,7 @@
 	
 	delete iUri;
 	iUri = NULL;
-		
+	
 	iTimer.Cancel();
     iTimer.Close();
 	iFieldsToCache.Close();	
@@ -170,6 +179,8 @@
 		Deque();
 	}
 	
+	delete iSortOrderMan;
+	
 	PRINT ( _L("End CPcsContactStore::~CPcsContactStore") );
 }
 
@@ -205,7 +216,8 @@
 		case TVPbkContactStoreEvent::EGroupDeleted:
 		case TVPbkContactStoreEvent::EGroupChanged:
 		{
-		    if ( aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactChanged ) 
+		    if ( aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactChanged ||
+		         aStoreEvent.iEventType == TVPbkContactStoreEvent::EGroupChanged ) 
 		    {
 		    	PRINT ( _L("Change contact/group event received") );
 		    }
@@ -224,16 +236,16 @@
 	        {
 	            // sim domain  
 	            // Pass the sim observer string in the next line
-	            TInt contactLocation =  iSimContactItems->Find(*aStoreEvent.iContactLink);	
+	            TInt contactLocation = iSimContactItems->Find(*aStoreEvent.iContactLink);
 				if( KErrNotFound != contactLocation)
 				{
 				    // We are not removing from the array cache. If you try to fetch, 
-				    // then it will give an error			       
+				    // then it will give an error
 				    TInt index = CreateCacheIDfromSimArrayIndex (contactLocation);
 				    
 	                iObserver->RemoveData(*iUri,index );
-		       	} 	               	           
-		               	           
+		       	}
+		    
 	        }
 	        else
 	        {
@@ -252,10 +264,9 @@
 	            ( aStoreEvent.iEventType == TVPbkContactStoreEvent::EGroupChanged ) )
 	        {
 	  		    // Add the contact
-	  		   iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink),
-	  		                                                           *this );
+	  		   iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink), *this );
 	        }
-	        	  		  
+	        
 			break;
 		}
 	}
@@ -268,7 +279,7 @@
 // ---------------------------------------------------------------------------
 TDesC& CPcsContactStore::GetStoreUri()
 {
-  return *iUri;
+    return *iUri;
 }
 
 // ---------------------------------------------------------------------------
@@ -344,23 +355,26 @@
 // ---------------------------------------------------------------------------
 void CPcsContactStore::HandleRetrievedContactL(MVPbkStoreContact* aContact)
 {    
+    if ( iMyCardSupported && IsMyCard( *aContact ) )
+        {
+        return;
+        }
+    
+    // Take the ownership
+    aContact->PushL();
+
     // Fill the contact link
 	MVPbkContactLink* tmpLink = aContact->CreateLinkLC();
-		
+	
     // If the link is null, then it is not put on the cleanup stack,
     // so we need not pop in such a case
     if( NULL == tmpLink )
     {
-        delete aContact;
-        aContact = NULL;
-    	return;
+        CleanupStack::PopAndDestroy( aContact );
+        return;
     }
    
-    // Recover the URI
-    HBufC* storeUri = HBufC::NewL(aContact->ParentStore().StoreProperties().Uri().UriDes().Length());
-    storeUri->Des().Copy(aContact->ParentStore().StoreProperties().Uri().UriDes());
-        			
-	CPsData *phoneContact = CPsData::NewL();
+	CPsData* phoneContact = CPsData::NewL();
 
 	
 	// Fill the contact id
@@ -369,38 +383,40 @@
 	
 	if ( err == KErrNotSupported )
 	{
-		// simdb domain	
+		// simdb domain
 		PRINT ( _L("SIM domain data received") );
-			
-		TInt tempIndex =  iSimContactItems->Find(*tmpLink);	
+		
+        // Set the contact link 
+        HBufC8* extnInfo = tmpLink->PackLC();
+        phoneContact->SetDataExtension(extnInfo);
+        CleanupStack::Pop( extnInfo );
+
+        // Get the index of the SIM contact
+        TInt tempIndex =  iSimContactItems->Find(*tmpLink);	
 		
 		if( KErrNotFound == tempIndex)
-
 		    {
-		    	tempIndex = iSimContactItems->Count();
+		    tempIndex = iSimContactItems->Count();
 	        iSimContactItems->AppendL(tmpLink);
-	      }
+	        CleanupStack::Pop(); // tmpLink
+	        }
+		else
+		    {
+            CleanupStack::PopAndDestroy(); // tmpLink
+		    }
+		
 	    //Create a dummy sim index and set it
 	    TInt simIndex = CreateCacheIDfromSimArrayIndex(tempIndex);
 	    phoneContact->SetId(simIndex);
-	    
-	    // Set the contact link 
-	    HBufC8* extnInfo = tmpLink->PackLC();
-	    phoneContact->SetDataExtension(extnInfo);
-	    CleanupStack::Pop();//extnInfo		      
-	    CleanupStack::Pop(); // tmpLink
 	}
 	else 
 	{
 	    // cntdb domain
 		TInt32 contactId = converter->LinkToIdentifier(*tmpLink);
-		phoneContact->SetId(contactId);		
+		phoneContact->SetId(contactId);
 		CleanupStack::PopAndDestroy(); // tmpLink
 	}
    	 
-	// Take the ownership
-	aContact->PushL();
-
 	MVPbkContactGroup* myContactGroup= aContact->Group();
 	
 	// The retrieved contact can be a contact item or a contact group, Handle accordingly
@@ -408,63 +424,59 @@
 	{
 		// The fetched contact item (and not a contact group.)
 		GetDataForSingleContactL( *aContact, phoneContact );
+	    // Recover the URI
+	    HBufC* storeUri = aContact->ParentStore().StoreProperties().Uri().UriDes().AllocL();
 		//Add the data to the relevent cache through the observer
 		iObserver->AddData(*storeUri, phoneContact);
+		delete storeUri;
 	}
 	else
 	{  
 	    // Fetch the group name 
-	    HBufC* groupName = HBufC::NewL(myContactGroup->GroupLabel().Length());
-	    groupName->Des().Copy(myContactGroup->GroupLabel());
+	    HBufC* groupName = myContactGroup->GroupLabel().AllocLC();
 	    TInt grpArrayIndex = -1; 
 	    for(TInt i =0; i  <iFieldsToCache.Count(); i++)
 	    {
 	    	if(iFieldsToCache[i] == R_VPBK_FIELD_TYPE_LASTNAME)
-         
-			 {
-			 grpArrayIndex = i;
-			 	
-			 }
-			 phoneContact->SetDataL(i,KNullDesC);
+			{
+			    grpArrayIndex = i;
+			}
+			phoneContact->SetDataL(i, KNullDesC);
 	    }
 	    if(grpArrayIndex != -1)
 	    {
-	    	phoneContact->SetDataL(grpArrayIndex,groupName->Des());
-	    	storeUri->Des().Copy(KVPbkDefaultGrpDbURI);	    
-	    
-	
-	    
+	    	phoneContact->SetDataL(grpArrayIndex, *groupName);
 	    
-        // Check for the contact in the group.
-	    MVPbkContactLinkArray* contactsContainedInGroup = myContactGroup->ItemsContainedLC();
-        for(TInt i = 0; i < contactsContainedInGroup->Count(); i++)
-		{
-			TInt grpContactId = converter->LinkToIdentifier(contactsContainedInGroup->At(i));
-			phoneContact->AddIntDataExtL(grpContactId);
-		}
-		CleanupStack::PopAndDestroy(); // contactsContainedInGroup
- 
- 		
- 		//Add the data to the relevent cache through the observer
-	    iObserver->AddData(*storeUri, phoneContact);
+            // Check for the contact in the group.
+            MVPbkContactLinkArray* contactsContainedInGroup = myContactGroup->ItemsContainedLC();
+            for(TInt i = 0; i < contactsContainedInGroup->Count(); i++)
+            {
+                TInt grpContactId = converter->LinkToIdentifier(contactsContainedInGroup->At(i));
+                phoneContact->AddIntDataExtL(grpContactId);
+            }
+            CleanupStack::PopAndDestroy(); // contactsContainedInGroup
+            
+            // Recover the URI
+            HBufC* storeUri = KVPbkDefaultGrpDbURI().AllocL();
+            
+            //Add the data to the relevent cache through the observer
+            iObserver->AddData(*storeUri, phoneContact);
+            
+            delete storeUri;
 	 	}
 	    else
 	    {
 	    	//We do not add anything here since Lastname does not exists in cenrep
-	    	delete 	phoneContact;
+	    	delete phoneContact;
 	    	phoneContact = NULL;
 	    }
-	    delete groupName;
-	    groupName = NULL;
+	    CleanupStack::PopAndDestroy( groupName );
 	}
 	
 	delete converter;
 	converter = NULL;
 
-	delete storeUri;
-    storeUri = NULL;
-    
-	CleanupStack::PopAndDestroy(aContact); // aContact
+	CleanupStack::PopAndDestroy(aContact);
 }
  
     
@@ -533,8 +545,8 @@
                     {
                         aPhoneData->SetDataL(i,data.Text());
                     }
-				}			
-			}					
+				}
+			}
 		}
 	}
 	
@@ -549,19 +561,19 @@
 
 	PRINT1 ( _L("CPcsContactStore::Total contacts downloaded = %d"),
 	          iFetchedContactCount );
-	          						
+	
     TInt blockCount = iFetchedContactCount + KLinksToFetchInOneGo;
     
     if( blockCount >= iAllContactLinksCount)
     	blockCount = iAllContactLinksCount;
     
-	for(int cnt = iFetchedContactCount; cnt < blockCount; cnt++)
+	for(TInt cnt = iFetchedContactCount; cnt < blockCount; cnt++)
 	{	
 		// Retrieve the contact 
 		MVPbkContactLink* tempLink =iContactViewBase->CreateLinkLC(cnt);
 		iContactManager->RetrieveContactL( *tempLink, *this );
-		CleanupStack::PopAndDestroy();
-	}				
+		CleanupStack::PopAndDestroy(); // tempLink
+	}
 
 }
 
@@ -670,7 +682,7 @@
 	CleanupStack::PushL(viewName);
 
 	// Set the Uri
-	if ( iUri->Des().CompareC(KVPbkDefaultGrpDbURI) == 0)
+	if ( iUri->CompareC(KVPbkDefaultGrpDbURI) == 0)
 	{	    
 		// Special Handling required for Groups Data Store
 		// Read the resource file and create the sort order
@@ -727,9 +739,29 @@
         iResourceFile.Close();                        
 	
 	}
+	else if ( iUri->CompareC(KVPbkDefaultCntDbURI) == 0)
+    {       
+        // For phone contacts DB we use the shared "AllContacts" -view so that 
+        // we don't need to generate a new view. This way we save some RAM
+        // from contacts server and some CPU time because the view is already
+        // generated and sorted. Difference is noticiable with larger amount 
+        // of contacts e.g. 7000. 
+	
+        viewDef->SetUriL( iUri->Des() );
+        viewDef->SetType( EVPbkContactsView );
+
+        if( !iSortOrderMan )
+            {
+            iSortOrderMan = CPbk2SortOrderManager::NewL( 
+                iContactManager->FieldTypes(), &iContactManager->FsSession() );
+            }
+
+        iContactViewBase = iContactManager->CreateContactViewLC( 
+            *this, *viewDef, iSortOrderMan->SortOrder() );
+        CleanupStack::Pop(); // iContactViewBase       
+    }
 	else
-	{
-	
+	{        
 		// Create sort order with the fields from cenrep
 		CreateSortOrderL(iContactManager->FieldTypes());
 		
@@ -779,7 +811,7 @@
 	   	case ECreateView :
 			CreateContactFetchViewL();
 		    break;
-   					      	
+   		
 	   	case EFetchContactBlock:
 	   		PRINT ( _L("Issuing the fetch request for next block") );
 			FetchlinksL();
@@ -789,7 +821,7 @@
 			iTimer.After( timerStatus, 100000); // 100 milliseconds
 			User::WaitForRequest( timerStatus );
 			break;
-	   						
+	   	
 	   	case EComplete:
 		    PRINT ( _L("Contacts Caching FINISHED") );
 		    PRINT_BOOT_PERFORMANCE ( _L("Contacts Caching FINISHED") );
@@ -802,11 +834,11 @@
 // ---------------------------------------------------------------------------------
 TInt CPcsContactStore::RunError(TInt /*aError*/) 
 {
-	 PRINT ( _L(" Enter CPcsContactStore:: CPcsContactStore::RunError()") );
+	PRINT ( _L(" Enter CPcsContactStore:: CPcsContactStore::RunError()") );
 
-	 PRINT1 ( _L(" CPcsContactStore:: RunError().  Completing caching in contacts store %S with status ECachingCompleteWithErrors "), &(iUri->Des()));
-   iObserver->UpdateCachingStatus(*iUri, ECachingCompleteWithErrors);
- 	 PRINT ( _L(" End CPcsContactStore:: CPcsContactStore::RunError()") );
+	PRINT1 ( _L(" CPcsContactStore:: RunError().  Completing caching in contacts store %S with status ECachingCompleteWithErrors "), &(iUri->Des()));
+    iObserver->UpdateCachingStatus(*iUri, ECachingCompleteWithErrors);
+ 	PRINT ( _L(" End CPcsContactStore:: CPcsContactStore::RunError()") );
 	return KErrNone;
 }
 
@@ -887,5 +919,25 @@
 	}
 	
 }
+// ---------------------------------------------------------------------------------
+// Checks MyCard extension of contact
+// ---------------------------------------------------------------------------------
+TBool CPcsContactStore::IsMyCard( const MVPbkBaseContact& aContact )
+    {
+    TBool isMyCard( EFalse);
+    // this is temporary solution to hide own contact from phonebook contacts list,
+    // TODO remove this code when we can hide own contact with contact model
 
+    MVPbkBaseContact& contact = const_cast<MVPbkBaseContact&>( aContact );
+    TAny* extension = contact.BaseContactExtension( KVPbkBaseContactExtension2Uid );
+
+    if( extension )
+        {
+        MVPbkBaseContact2* baseContactExtension = static_cast<MVPbkBaseContact2*>( extension );
+        TInt error( KErrNone );
+        isMyCard = baseContactExtension->IsOwnContact( error );
+        }
+    
+    return isMyCard;
+    }
 // End of file