Revision: 201019 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 12:26:45 +0300
branchRCL_3
changeset 35 4ae315f230bc
parent 32 2828b4d142c0
child 36 35018d46c3dc
child 39 a6539d1e8e43
Revision: 201019 Kit: 2010121
ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h
ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp
contacts_plat/logs_ui_command_line_api/inc/LogsUiCmdStarter.inl
contacts_plat/phonebook_2_common_ui_api/inc/CPbk2AppViewBase.h
contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h
contacts_plat/phonebook_2_common_ui_api/inc/CPbk2ViewGraph.h
contacts_plat/phonebook_2_icon_api/inc/CPbk2IconArray.h
contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreProperty.h
contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreViewDefinition.h
contacts_plat/phonebook_2_ui_controls_api/inc/CPbk2ContactIconsUtils.h
contacts_plat/phonebook_2_ui_extension_api/inc/CPbk2UIExtensionView.h
contacts_plat/phonebook_2_ui_extension_api/inc/MPbk2SettingsControlExtension.h
contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h
contacts_plat/phonebook_extension_api/inc/Phonebook/CPbkExtensionFactory.h
contacts_plat/predictivesearch_adapters_api/inc/CPsDataPlugin.inl
contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.inl
contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h
contacts_plat/predictivesearch_client_api/inc/MPsResultsObserver.h
contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h
contacts_plat/virtual_phonebook_engine_api/inc/CVPbkDefaultAttribute.h
contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h
logsui/AppSrc/CLogsBaseView.cpp
phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkFindView.h
phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkFindView.cpp
phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp
phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/src/CSatRefreshNotifier.cpp
phonebookengines/VirtualPhonebook/group/VPbkEng.mmp
phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def
phonebookui/Phonebook2/Commands/src/CPbk2CommandHandler.cpp
phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def
phonebookui/Phonebook2/GroupExtension/inc/CPguAddMembersCmd.h
phonebookui/Phonebook2/GroupExtension/src/CPguAddMembersCmd.cpp
phonebookui/Phonebook2/GroupExtension/src/CPguGroupMembersView.cpp
phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp
phonebookui/Phonebook2/GroupExtension/src/CPguSendMessageGroupCmd.cpp
phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp
phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h
phonebookui/Phonebook2/NamesListExtension/inc/cpbk2openmycardcmd.h
phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp
phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp
phonebookui/Phonebook2/NamesListExtension/src/cpbk2openmycardcmd.cpp
phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp
phonebookui/Phonebook2/ServerApplication/inc/CPbk2CommAddressSelectPhase.h
phonebookui/Phonebook2/ServerApplication/src/CPbk2CommAddressSelectPhase.cpp
phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppAppUi.cpp
phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp
phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h
phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h
phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h
phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss
phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2AddItemToContactDlg.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorRingtoneField.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp
phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp
phonebookui/Phonebook2/UIPolicy/inc/CPbk2ContactDuplicatePolicy.h
phonebookui/Phonebook2/UIPolicy/rss/Pbk2UIPolicy.rss
phonebookui/Phonebook2/UIPolicy/src/CPbk2ContactDuplicatePolicy.cpp
phonebookui/Phonebook2/USIMExtension/src/CPsu2NameListViewBase.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontacthandler.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontacthandler.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorcalloperation.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvideocalloperation.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvoipoperation.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccaphonecall.h
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactor.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorcalloperation.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvideocalloperation.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvoipoperation.cpp
phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccaphonecall.cpp
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/ccappmycardheadercontrol.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccacmscontactfetcherwrapper.cpp
phonebookui/Phonebook2/group/Pbk2GroupExtension.mmp
phonebookui/Phonebook2/group/Pbk2UIControls.mmp
phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h
phonebookui/Phonebook2/inc/spbcontentprovider.h
phonebookui/Phonebook2/loc/phonebook2ece.loc
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/conf/pbk2rclactionpriorities.confml
phonebookui/Phonebook2/spbcontentprovider/inc/spbcontentproviderprivate.h
phonebookui/Phonebook2/spbcontentprovider/src/spbcontentprovider.cpp
phonebookui/Phonebook2/spbcontentprovider/src/spbcontentproviderprivate.cpp
phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPsDataPluginInterface.cpp
predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h
predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp
predictivesearch/PcsServerClientAPI/group/PsServerClientAPI.mmp
predictivesearch/PcsServerClientAPI/inc/CPsPropertyHandler.h
predictivesearch/PcsServerClientAPI/inc/CPsUpdateHandler.h
predictivesearch/PcsServerClientAPI/src/CPsPropertyHandler.cpp
predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp
predictivesearch/PcsServerClientAPI/src/CPsUpdateHandler.cpp
predictivesearch/PcsUtils/src/CPsData.cpp
predictivesearch/adapters/contacts/group/pscontactdatastore.mmp
predictivesearch/adapters/contacts/inc/CPsContactDataAdapter.h
predictivesearch/adapters/contacts/inc/cpcscontactstore.h
predictivesearch/adapters/contacts/src/CPsContactDataAdapter.cpp
predictivesearch/adapters/contacts/src/cpcscontactfetch.cpp
predictivesearch/adapters/contacts/src/cpcscontactstore.cpp
predictivesearch/sis/cenrep.pkg
predictivesearch/sis/makesis_urel.bat
predictivesearch/sis/pcs_udeb.pkg
predictivesearch/sis/pcs_urel.pkg
--- a/ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h	Tue May 11 16:00:21 2010 +0300
+++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h	Tue May 25 12:26:45 2010 +0300
@@ -293,7 +293,14 @@
         * @return - ETrue if XSP Contacts else EFalse.
         */
         TBool IsXspContact( const MVPbkContactLink& aContactLink ) const;
-        
+
+        /**
+        * Finds whether the store is XSP Store or not
+        * @param aStoreUri  - Contact store uri which needs to be checked
+        * @return - ETrue if XSP store else EFalse.
+        */
+        TBool IsXspStoreUri( const TDesC& aStoreUri ) const;
+
     private: //Data
         
         /// ETrue, if at least one store was opened successfully
--- a/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp	Tue May 25 12:26:45 2010 +0300
@@ -714,14 +714,22 @@
             uri.Create( KSPMaxDesLength );
             CleanupClosePushL( uri );
             property->GetValue( uri );
-            TVPbkContactStoreUriPtr uriPtr( uri );
-            if( !iUriList->IsIncluded( uriPtr ) ) 
-            	{
-            	iUriList->AppendL( uriPtr );            
-            	}
-            aArray.AppendL( uri );
+            // Don't add native contact DB's into the find array. Some service 
+            // providers might add e.g. default contacts db as contact store.
+            // Unnecessary lookup from default contacts store is very slow
+            // if there are thousands of contacts, and it will delay the launch
+            // of CCA UI with tens of seconds. 
+            if( IsXspStoreUri( uri ) )
+                {
+                TVPbkContactStoreUriPtr uriPtr( uri );
+                if( !iUriList->IsIncluded( uriPtr ) ) 
+                    {
+                    iUriList->AppendL( uriPtr );            
+                    }
+                aArray.AppendL( uri );
+                iXspStoresInstalled = ETrue;
+                }
             CleanupStack::PopAndDestroy();  //uri
-            iXspStoresInstalled = ETrue;
             }
         CleanupStack::PopAndDestroy();  //property
         }
@@ -820,20 +828,24 @@
 TBool CCmsPhonebookProxy::IsXspContact( const MVPbkContactLink& aContactLink ) const
     {
     //find whether the contact belongs to XSP Store using the StoreProperties
-    TBool xspContact = ETrue;
-    const TDesC& storeName = aContactLink.ContactStore().StoreProperties().Uri().UriDes();
-    
-    using namespace VPbkContactStoreUris;
-    if( ( storeName.CompareF( DefaultCntDbUri() ) == 0 ) ||
-            ( storeName.CompareF( SimGlobalAdnUri() ) == 0 ) ||
-            ( storeName.CompareF( SimGlobalFdnUri() ) == 0 ) ||
-            ( storeName.CompareF( SimGlobalSdnUri() ) == 0 ) )
-        {
-        xspContact = EFalse;
-        }
-
-    return xspContact;    
+    return IsXspStoreUri( 
+        aContactLink.ContactStore().StoreProperties().Uri().UriDes() );
     }
 
+// ----------------------------------------------------------
+// CCmsPhonebookProxy::IsXspStoreUri
+// ----------------------------------------------------------
+//
+TBool CCmsPhonebookProxy::IsXspStoreUri( const TDesC& aStoreUri ) const
+    {
+    if( aStoreUri.CompareF( VPbkContactStoreUris::DefaultCntDbUri() ) == 0 ||
+        aStoreUri.CompareF( VPbkContactStoreUris::SimGlobalAdnUri() ) == 0 ||
+        aStoreUri.CompareF( VPbkContactStoreUris::SimGlobalFdnUri() ) == 0 ||
+        aStoreUri.CompareF( VPbkContactStoreUris::SimGlobalSdnUri() ) == 0 )
+        {
+        return EFalse;
+        }
+    return ETrue;
+    }
 
 // End of File
--- a/contacts_plat/logs_ui_command_line_api/inc/LogsUiCmdStarter.inl	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/logs_ui_command_line_api/inc/LogsUiCmdStarter.inl	Tue May 25 12:26:45 2010 +0300
@@ -20,8 +20,8 @@
 #define LOGSUICMDSTARTER_INL
 
 //  INCLUDES
-#include <ApGTask.h>
-#include <ApGCli.h>
+#include <apgtask.h>
+#include <apgcli.h>
 
 // --------------------------------------------------------------------------
 // LogsUiCmdStarter::CmdStart
--- a/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2AppViewBase.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2AppViewBase.h	Tue May 25 12:26:45 2010 +0300
@@ -21,8 +21,8 @@
 
 // INCLUDES
 #include <aknview.h>
-#include <mpbk2keyeventhandler.h>
-#include <mpbk2pointereventhandler.h>
+#include <MPbk2KeyEventHandler.h>
+#include <MPbk2PointerEventHandler.h>
 
 // FORWARD DECLARATIONS
 class CPbk2ViewState;
--- a/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h	Tue May 25 12:26:45 2010 +0300
@@ -21,10 +21,10 @@
 
 // INCLUDES
 #include <e32base.h>
-#include <akntabobserver.h>
+#include <AknTabObserver.h>
 #include <w32std.h>
 #include <pbk2viewinfo.hrh>
-#include <aknnavidecoratorobserver.h>
+#include <AknNaviDecoratorObserver.h>
 
 // FORWARD DECLARATIONS
 class MPbk2ViewExplorer;
--- a/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2ViewGraph.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2ViewGraph.h	Tue May 25 12:26:45 2010 +0300
@@ -21,7 +21,7 @@
 
 // INCLUDES
 #include <e32base.h>
-#include <pbk2viewinfo.hrh>
+#include <Pbk2ViewInfo.hrh>
 
 // FORWARD DECLARATIONS
 class CPbk2ViewNode;
--- a/contacts_plat/phonebook_2_icon_api/inc/CPbk2IconArray.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_icon_api/inc/CPbk2IconArray.h	Tue May 25 12:26:45 2010 +0300
@@ -21,7 +21,7 @@
 
 //  INCLUDES
 #include <e32base.h>
-#include <pbk2iconarrayid.hrh>
+#include <Pbk2IconArrayId.hrh>
 
 //  FORWARD DECLARATIONS
 class CGulIcon;
--- a/contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreProperty.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreProperty.h	Tue May 25 12:26:45 2010 +0300
@@ -21,9 +21,9 @@
 
 // INCLUDE FILES
 #include <e32base.h>
-#include <tvpbkcontactstoreuriptr.h>
-#include <pbk2contentidentifiers.hrh>
-#include <pbk2contactview.hrh>
+#include <TVPbkContactStoreUriPtr.h>
+#include <Pbk2ContentIdentifiers.hrh>
+#include <Pbk2ContactView.hrh>
 
 // FORWARD DECLARATIONS
 class TResourceReader;
--- a/contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreViewDefinition.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_store_property_api/inc/CPbk2StoreViewDefinition.h	Tue May 25 12:26:45 2010 +0300
@@ -21,8 +21,8 @@
 
 // INCLUDE FILES
 #include <e32base.h>
-#include <pbk2contactview.hrh>
-#include <tpbk2iconid.h>
+#include <Pbk2ContactView.hrh>
+#include <TPbk2IconId.h>
 
 // FORWARD DECLARATIONS
 class TResourceReader;
--- a/contacts_plat/phonebook_2_ui_controls_api/inc/CPbk2ContactIconsUtils.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_ui_controls_api/inc/CPbk2ContactIconsUtils.h	Tue May 25 12:26:45 2010 +0300
@@ -21,7 +21,7 @@
 
 // INCLUDE FILES
 #include <e32base.h>
-#include <tpbk2iconid.h>
+#include <TPbk2IconId.h>
 // FORWARD DECLARATIONS
 class CPbk2StorePropertyArray;
 class MPbk2ContactUiControlExtension;
--- a/contacts_plat/phonebook_2_ui_extension_api/inc/CPbk2UIExtensionView.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_ui_extension_api/inc/CPbk2UIExtensionView.h	Tue May 25 12:26:45 2010 +0300
@@ -20,7 +20,7 @@
 #define CPBK2UIEXTENSIONVIEW_H
 
 // INCLUDES
-#include <cpbk2appviewbase.h>
+#include <CPbk2AppViewBase.h>
 
 // FORWARD DECLARATIONS
 class MPbk2UIExtensionView;
--- a/contacts_plat/phonebook_2_ui_extension_api/inc/MPbk2SettingsControlExtension.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_ui_extension_api/inc/MPbk2SettingsControlExtension.h	Tue May 25 12:26:45 2010 +0300
@@ -20,7 +20,7 @@
 #define MPBK2SETTINGSCONTROLEXTENSION_H
 
 // INCLUDES
-#include <mpbk2uireleasable.h>
+#include <MPbk2UiReleasable.h>
 
 // FORWARD DECLARATIONS
 class CAknSettingItemList;
--- a/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h	Tue May 25 12:26:45 2010 +0300
@@ -22,7 +22,7 @@
 // INCLUDE FILES
 #include <e32base.h>
 #include <ecom/ecom.h>
-#include <mpbk2uiextensionfactory.h>
+#include <MPbk2UiExtensionFactory.h>
 
 // FORWARD DECLARATIONS
 class CPbk2UIExtensionView;
--- a/contacts_plat/phonebook_extension_api/inc/Phonebook/CPbkExtensionFactory.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/phonebook_extension_api/inc/Phonebook/CPbkExtensionFactory.h	Tue May 25 12:26:45 2010 +0300
@@ -21,7 +21,7 @@
 #define __CPbkExtensionFactory_H__
 
 #include <ecom/ecom.h>
-#include <mpbkextensionfactory.h>
+#include <MPbkExtensionFactory.h>
 
 class CPbkExtensionFactory : public CBase,
                              public MPbkExtensionFactory
--- a/contacts_plat/predictivesearch_adapters_api/inc/CPsDataPlugin.inl	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/predictivesearch_adapters_api/inc/CPsDataPlugin.inl	Tue May 25 12:26:45 2010 +0300
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include <ecom/ECom.h>
+#include <ecom/ecom.h>
 #include <mdatastoreobserver.h>
 #include <mstorelistobserver.h>
 
--- a/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.inl	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.inl	Tue May 25 12:26:45 2010 +0300
@@ -17,7 +17,7 @@
 
 
 // INCLUDE FILES
-#include <ecom/ECom.h>
+#include <ecom/ecom.h>
 
 // ============================ MEMBER FUNCTIONS ===============================
 
--- a/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h	Tue May 25 12:26:45 2010 +0300
@@ -27,15 +27,15 @@
 #include <e32svr.h>
 #include <s32mem.h>
 #include <e32property.h>
-#include <mvpbkContactLink.h>
+#include <MVPbkContactLink.h>
 #include <CVPbkContactManager.h>
 #include <CVPbkContactStoreUriArray.h>
-#include <tvpbkcontactstoreuriptr.h>
+#include <TVPbkContactStoreUriPtr.h>
 #include <MVPbkContactStoreList.h>
 #include <MVPbkContactStore.h>
 #include <CVPbkContactIdConverter.h>
-#include <vpbkcontactstoreuris.h>
-#include <badesca.H>
+#include <VPbkContactStoreUris.h>
+#include <badesca.h>
 
 // USER INCLUDES
 #include <CPcsDefs.h>
@@ -48,6 +48,7 @@
 // FORWARD DECLARATIONS
 class MPsResultsObserver;
 class CPsPropertyHandler;
+class CPsUpdateHandler;
 
 
 // CLASS DECLARATION
@@ -157,13 +158,13 @@
 		IMPORT_C void SearchL(const CPsQuery& aSearchQuery, 
 							  RPointerArray<CPsClientData>& aMarkedContacts,
 							  CVPbkContactManager* aContactManager);
-							  
+		
         /**
         * CancelSearch.
         * Cancels ongoing search.
-        */        							  
+        */
 		IMPORT_C void CancelSearch();
-							  		    
+		
 		/**
 		* LookupL. 
 		* Sends a request to the predictive search server.
@@ -181,21 +182,21 @@
                               CDesCArray& aMatchSet,
                               RArray<TPsMatchLocation>& aMatchLocation);
 
-    /**
-    * LookupMatchL. 
-    * Sends a request to the predictive search server.
-    * Does a predictive search in aSearchData for aSearchQuery and return
-    * the match string in aMatch.
-    * If there is no full match aMatch will be empty (Length()==0)
-    * This is a synchronous request.
-    * 
-    * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)
-    * @param aSearchData  The input data to be searched.
-    * @param aMatch       The matched result
-    */
-    IMPORT_C void LookupMatchL(const CPsQuery& aSearchQuery,
-                          const TDesC& aSearchData,
-                          TDes& aMatch );		
+        /**
+        * LookupMatchL. 
+        * Sends a request to the predictive search server.
+        * Does a predictive search in aSearchData for aSearchQuery and return
+        * the match string in aMatch.
+        * If there is no full match aMatch will be empty (Length()==0)
+        * This is a synchronous request.
+        * 
+        * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen)
+        * @param aSearchData  The input data to be searched.
+        * @param aMatch       The matched result
+        */
+        IMPORT_C void LookupMatchL(const CPsQuery& aSearchQuery,
+                                   const TDesC& aSearchData,
+                                   TDes& aMatch);
 		
 		/**
 		* IsLanguageSupportedL.
@@ -291,10 +292,9 @@
 	public:
 	
 		/**
-		* CPsPropertyHandler is internal class to make it access
-		* to CPsRequestHandler class
+		* Notify observers about the cahcing status
 		*/
-    	friend class CPsPropertyHandler;
+		void NotifyCachingStatus( TCachingStatus aStatus, TInt aError );
     	
 	private: // Constructors and destructors
 
@@ -323,19 +323,19 @@
 		* HandleBufferOverFlowL.
 		* Handles internal buffer overflow event.
 		*/
-		void HandleBufferOverFlowL();    
+		void HandleBufferOverFlowL();
 
 		/**
 		* HandleErrorL.
 		* Handles error events.
 		*/
-		void HandleErrorL(TInt aErrorCode);   
+		void HandleErrorL(TInt aErrorCode);
 		
 		/**
 		* AddMarkedContacts
 		* Filters the bookmark results and adds them to final search result set
 		*/
-		TInt AddMarkedContactsL(RPointerArray<CPsClientData>& searchResults);  
+		TInt AddMarkedContactsL(RPointerArray<CPsClientData>& searchResults);
 
 		/**
         * RunSearchFromBufferL
@@ -386,6 +386,21 @@
         CPsPropertyHandler* iPropertyHandler;
         
         /**
+        * iContactAddedHandler, handler for reacting to contact being added to cache
+        */
+        CPsUpdateHandler* iContactAddedHandler;
+
+        /**
+        * iContactRemovedHandler, handler for reacting to contact being removed from cache
+        */
+        CPsUpdateHandler* iContactRemovedHandler;
+        
+        /**
+        * iContactModifiedHandler, handler for reacting to contact being modified in cache
+        */
+        CPsUpdateHandler* iContactModifiedHandler;
+        
+        /**
         * Not Owned
         * iBookMarkContactManager, contact manager reference received from the client
         * To be used only for handling marked contacts.
--- a/contacts_plat/predictivesearch_client_api/inc/MPsResultsObserver.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/predictivesearch_client_api/inc/MPsResultsObserver.h	Tue May 25 12:26:45 2010 +0300
@@ -34,35 +34,39 @@
 */
 class MPsResultsObserver
 {
-	public:
+    public:
 
-		/**
-		* HandlePsResultsUpdateL.
-		* Handle updates from the server.
-		* 
-		* @param searchResults Search results returned from the server.
-		* @param searchSeqs    List of matching character sequences.
-		*/
-		virtual void HandlePsResultsUpdate(RPointerArray<CPsClientData>& searchResults,
-		                                    RPointerArray<CPsPattern>& searchSeqs) = 0;
-		                                    
+        /**
+        * HandlePsResultsUpdateL.
+        * Handle updates from the server.
+        * 
+        * @param searchResults Search results returned from the server.
+        * @param searchSeqs    List of matching character sequences.
+        */
+        virtual void HandlePsResultsUpdate(RPointerArray<CPsClientData>& aSearchResults,
+                                           RPointerArray<CPsPattern>& aSearchSeqs) = 0;
 
-		/**
-		* HandlePsErrorL.
-		* Handle errors from the server.
-		* 
-		* @param aErrorCode Search errors returned from the server.	    
-		*/	                                        
-		virtual void HandlePsError(TInt aErrorCode) = 0;
+        /**
+        * HandlePsErrorL.
+        * Handle errors from the server.
+        * 
+        * @param aErrorCode Search errors returned from the server.
+        */
+        virtual void HandlePsError(TInt aErrorCode) = 0;
+
         /**
-        * CachingStatus
-        * Gets called when caching is completed.
+        * CachingStatus.
+        * Gets called when caching is completed, or cache has been modified after
+        * the initial caching. For update events, it's not guaranteed that function
+        * gets called separately for each modification in case there are several same kind of
+        * modifications happening in rapid sequence.
         * Observers need to implement this function accordingly
-        * to take action after cache completion
-        * @param aStatus - caching status, 20 - Caching completes succesfully, 30 - Caching completed with errors
-        * @param aError - Any error that occurred while caching. KErrNone if no error else the error code
+        * to take action after cache completion or update.
+        * @param aStatus - caching status
+        * @param aError - Any error that occurred while caching. 
+        *                 KErrNone if no error, else the error code
         */
-        virtual void CachingStatus(TCachingStatus& aStatus, TInt& aError) = 0;   
+        virtual void CachingStatus(TCachingStatus& aStatus, TInt& aError) = 0;
 };
 
 #endif // __M_PS_RESULTS_OBSERVER__
--- a/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h	Tue May 25 12:26:45 2010 +0300
@@ -19,7 +19,7 @@
 #define __PCSSERVERDEFS_H__
 
 #include <e32base.h>
-#include <BidiText.h>
+#include <biditext.h>
 
 /**
  * PCS Server Exe Name
@@ -58,8 +58,8 @@
  */
 enum TPsServerResponseCommand
 {
-	ESearchComplete,
-	ECancelComplete
+    ESearchComplete,
+    ECancelComplete
 };
 
 /**
@@ -106,10 +106,13 @@
  */
 enum TCachingStatus
 {
-	ECachingNotStarted         =  0,
-	ECachingInProgress         = 10,
-	ECachingComplete           = 20,
-	ECachingCompleteWithErrors = 30
+    ECachingNotStarted          =  0,
+    ECachingInProgress          = 10,
+    ECachingComplete            = 20,
+    ECachingCompleteWithErrors  = 30,
+    ECacheUpdateContactRemoved  = 40,
+    ECacheUpdateContactModified = 50,
+    ECacheUpdateContactAdded    = 60
 };
 
 /**
@@ -117,8 +120,8 @@
  */
 enum TSortType
 {
-	EPatternBased,
-	EAlphabetical
+    EPatternBased,
+    EAlphabetical
 };
 
 /**
@@ -139,7 +142,7 @@
  * Central Repository constants
  */
 const TInt KCRMaxLen = 255;
-const TInt KPsQueryMaxLen = 50;
+const TInt KPsQueryMaxLen = 150;
 const TInt KBufferMaxLen = 255;
 const TInt KSearchResultsBufferLen = 8192;
 
@@ -169,6 +172,20 @@
 const TInt KUnitSeparator  = 31;
 const TInt KSpaceCharacter = 32;
 
+/**
+ * Publish & Subscribe ID and keys for internal use of PCS
+ */
+const TUid KPcsInternalUidCacheStatus = {0x2000B5B6};
+enum TPcsInternalKeyCacheStatus
+    {
+    EPsKeyCacheStatus            = 0,
+    EPsKeyCacheError             = 1,
+    EPsKeyContactRemovedCounter  = 2,
+    EPsKeyContactModifiedCounter = 3,
+    EPsKeyContactAddedCounter    = 4
+    };
+
+
 #endif // __PCSSERVERDEFS_H__
 
 // End of file
--- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkDefaultAttribute.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkDefaultAttribute.h	Tue May 25 12:26:45 2010 +0300
@@ -23,7 +23,7 @@
 #include <e32base.h>
 #include <MVPbkContactAttribute.h>
 #include <MVPbkContactAttributeManager.h>
-#include <VPbkPublicUID.h>
+#include <VPbkPublicUid.h>
 #include <VPbkFieldType.hrh>
 
 
--- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h	Tue May 11 16:00:21 2010 +0300
+++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h	Tue May 25 12:26:45 2010 +0300
@@ -87,7 +87,12 @@
              * first name and last name field values only first
              * one is returned.
              */
-            EVPbkDuplicatedContactsMatchFlag   = 0x00000004
+            EVPbkDuplicatedContactsMatchFlag   = 0x00000004,
+            
+            /**
+             * Enables additional set of rules to compare numbers
+             */
+            EVPbkBestMatchingFlag   = 0x00000008
             };
 
         /**
--- a/logsui/AppSrc/CLogsBaseView.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/logsui/AppSrc/CLogsBaseView.cpp	Tue May 25 12:26:45 2010 +0300
@@ -2015,9 +2015,7 @@
 void CLogsBaseView::SendMessageCmdHandlerL( 
     TInt  aCommandId ,
     const MLogsEventGetter* aEvent )
-    {
-    CMessageData* messageData = CMessageData::NewL();
-    CleanupStack::PushL( messageData );
+    {   
     
     TBool isRead = aEvent->Event()->IsRead();
     TLogId logid = aEvent->LogId();
@@ -2032,8 +2030,11 @@
     else
         {
         return;    
-        }        
-
+        } 
+    
+    CMessageData* messageData = CMessageData::NewL();
+    CleanupStack::PushL( messageData );
+    
     TBuf<KLogsPhoneNumberMaxLen> nbrBuff;        
     CPhoneNumberFormat::DTMFStrip( number, nbrBuff );
     
@@ -2877,10 +2878,12 @@
 
     HBufC* textBuf = NULL;
     textBuf = StringLoader::LoadLC( R_STM_MY_ADDRESS, buf );    
-	CAknNoteDialog* noteDlg = new ( ELeave ) CAknNoteDialog( );
+    CAknNoteDialog* noteDlg = new ( ELeave ) CAknNoteDialog( );
+    CleanupStack::PushL( noteDlg );
     noteDlg->SetTextL( *textBuf );
-	noteDlg->ExecuteLD( R_MY_ADDRESS_QUERY );	
-    CleanupStack::PopAndDestroy( textBuf );  
+    noteDlg->ExecuteLD( R_MY_ADDRESS_QUERY );	
+    CleanupStack::Pop( noteDlg ); 
+    CleanupStack::PopAndDestroy( textBuf );
     }
 
 // ----------------------------------------------------------------------------
--- a/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkFindView.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkFindView.h	Tue May 25 12:26:45 2010 +0300
@@ -27,8 +27,6 @@
 
 namespace VPbkEngUtils { class CVPbkAsyncOperation; }
 
-class CVPbkFieldTypeRefsList;
-class CVPbkContactNameConstructionPolicy;
 class CVPbkContactFindPolicy;
 
 /**
@@ -120,9 +118,7 @@
         void HandleBuildViewMapping();
         void DoAddObserverL(MVPbkContactViewObserver& aObserver);
         void AddObserverError(MVPbkContactViewObserver& aObserver, TInt aError);
-        TBool ContactMatchRefineL(         
-                const MVPbkViewContact& aViewContact,
-                TPtrC aFindWord );
+
         void SetFindStringsL( const MDesCArray& aFindWords );
         void SetAlwaysIncludedContactsL( 
                 const MVPbkContactBookmarkCollection* aAlwaysIncludedContacts );
@@ -147,10 +143,6 @@
         RPointerArray<MVPbkContactViewObserver> iObservers;
         /// Own: find words for filtering
         CDesCArrayFlat* iFindStrings;
-        /// Own: a field type list for name construction policy
-        CVPbkFieldTypeRefsList* iFieldTypeRefsList;
-        /// Own: a policy for name formatting
-        CVPbkContactNameConstructionPolicy* iNameConstructionPolicy;
         /// Own: a policy for match
         CVPbkContactFindPolicy* iContactFindPolicy;
         /// Own: always included contacts
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkFindView.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkFindView.cpp	Tue May 25 12:26:45 2010 +0300
@@ -14,8 +14,7 @@
 * Description:  Filtered contact view
 *
 */
-
-
+#include <eikenv.h>
 #include "CVPbkFindView.h"
 #include <MVPbkFieldType.h>
 #include <CVPbkSortOrder.h>
@@ -24,14 +23,13 @@
 #include <CVPbkAsyncOperation.h>
 #include <VPbkError.h>
 
-#include <CVPbkFieldTypeRefsList.h>
-#include <CVPbkContactNameConstructionPolicy.h>
 #include <CVPbkContactFindPolicy.h>
 #include <MVPbkContactBookmarkCollection.h>
 #include <CVPbkContactFieldIterator.h>
 #include <MVPbkContactFieldData.h>
 #include <MVPbkContactFieldTextData.h>
 
+
 #include <VPbkDebug.h>
 
 namespace {
@@ -108,16 +106,20 @@
     
     SetAlwaysIncludedContactsL( aAlwaysIncludedContacts );
 
-    // Create contact find policy
-    iContactFindPolicy = CVPbkContactFindPolicy::NewL();
     
-    CVPbkContactNameConstructionPolicy::TParam param( *iMasterFieldTypeList );
-    iNameConstructionPolicy =
-        CVPbkContactNameConstructionPolicy::NewL( param );
-        
-    //Create field type list
-    iFieldTypeRefsList = CVPbkFieldTypeRefsList::NewL();        
-            
+    CEikonEnv* eikonEnv = CEikonEnv::Static();
+     
+    if ( eikonEnv )
+        {
+        CVPbkContactFindPolicy::TParam param =
+            CVPbkContactFindPolicy::TParam(
+                *iMasterFieldTypeList,
+                eikonEnv->FsSession() );
+    
+        // Create contact find policy
+        iContactFindPolicy = CVPbkContactFindPolicy::NewL( param );
+        }
+    
     iBaseView.AddObserverL(*this);
 
     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING
@@ -154,8 +156,6 @@
     iBaseView.RemoveObserver(*this); 
     iObservers.Close();
     delete iFindStrings;
-    delete iFieldTypeRefsList;
-    delete iNameConstructionPolicy;
     delete iContactFindPolicy;
     delete iAsyncOperation;        
     }
@@ -464,14 +464,12 @@
         const MVPbkViewContact& contact = iBaseView.ContactAtL( i );
         
         TBool match( ETrue );
-        const TInt countStrings( iFindStrings->MdcaCount() );
-        for ( TInt j(0); j < countStrings; ++j )
+
+        if ( iContactFindPolicy && 
+                !iContactFindPolicy->MatchContactNameL( *iFindStrings, contact ))
             {
-            if ( !ContactMatchRefineL( contact, iFindStrings->MdcaPoint( j ) ) )
-                {                
-                match = EFalse;                
-                }            
-            }                
+            match = EFalse;      
+            }
 
         if ( match && iContactMapping.FindInOrder( i ) == KErrNotFound ) 
             {                    
@@ -618,47 +616,6 @@
         SendViewErrorEventToObservers( res, EFalse );
         }
     }
-    
-// --------------------------------------------------------------------------
-// CVPbkFindView::ContactMatchRefineL
-// --------------------------------------------------------------------------
-//    
-TBool CVPbkFindView::ContactMatchRefineL(         
-        const MVPbkViewContact& aViewContact,
-        TPtrC aFindWord )
-    {
-    TBool match( EFalse );
-    iFieldTypeRefsList->Reset(); 
-    
-    // Create iterator                        
-    MVPbkBaseContactFieldIterator* iterator = 
-        iNameConstructionPolicy->NameConstructionFieldsLC( 
-            aViewContact.Fields(),
-            *iFieldTypeRefsList );                            
-             
-    // Loop iterator
-    while ( iterator->HasNext() )
-        {                    
-        const MVPbkBaseContactField* field = iterator->Next();
-        
-        // Check field's type
-        if ( field->FieldData().DataType() == EVPbkFieldStorageTypeText )
-            {                    
-            const MVPbkContactFieldTextData& data = 
-                MVPbkContactFieldTextData::Cast( field->FieldData() );
-                
-            // Match refine
-            if ( iContactFindPolicy->MatchRefineL( data.Text(), aFindWord ) )
-                {
-                match = ETrue;
-                break;
-                }                
-            }
-        }           
-    CleanupStack::PopAndDestroy( 1 ); //iterator    
-    
-    return match;    
-    }    
 
 // --------------------------------------------------------------------------
 // CVPbkFindView::SetFindStringsL
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp	Tue May 25 12:26:45 2010 +0300
@@ -78,7 +78,11 @@
         void VPbkSingleContactOperationFailed(
                 MVPbkContactOperationBase& aOperation,
                 TInt aError);
-
+   
+    private:
+        /// Phone number types
+        enum TNumberType { ENotInitialized, EUnknown, EDigit, EPlus, EOneZero, ETwoZeros };
+        
     private: // Implementation
         CVPbkPhoneNumberMatchStrategyImpl(CVPbkPhoneNumberMatchStrategy& aParent);
         void ConstructL(
@@ -124,6 +128,11 @@
          */
         TPtrC NameFieldValueL( MVPbkStoreContact* aContact, TVPbkFieldTypeName aFieldType );
         
+        TBool ValidateBestMatchingRulesL( const TDesC& aNumber );
+        TBool CheckBestMatchingRules( const TDesC& aNumberA, TNumberType aNumberAType,
+                const TDesC& aNumberB, TNumberType aNumberBType  );
+        TInt FormatAndCheckNumberType( TDes& aNumber );
+        
     private: // Data
         CVPbkPhoneNumberMatchStrategy& iParent;
         /// Ref: The contact manager instance to be used for searching.
@@ -170,6 +179,8 @@
         RPointerArray <HBufC> iTempNameTokensArray;
         /// Indicates if all contact in iResult are the same
         TBool iDoubledContacts;
+        /// type of iPhoneNumber
+        TNumberType iPhoneNumberType;
     };
 
 CVPbkPhoneNumberMatchStrategyImpl::CVPbkPhoneNumberMatchStrategyImpl(
@@ -226,7 +237,7 @@
 	    iLastNameSelector = CVPbkFieldTypeSelector::NewL( resReader, iContactManager->FieldTypes() );
 	    CleanupStack::PopAndDestroy( lastNameSelectorBuf );
     	}
-    
+
     CleanupStack::PopAndDestroy( &resFile );
     }
 
@@ -267,6 +278,7 @@
     HBufC* phoneNumber = aPhoneNumber.AllocL();
     delete iPhoneNumber;
     iPhoneNumber = phoneNumber;
+    iPhoneNumberType = ENotInitialized;
     
     if ( iWorkingResults )
         {
@@ -351,17 +363,19 @@
                 {
                 iResults = CVPbkContactLinkArray::NewL();
                 }
-            if ( iDoubledContacts )
-                {
-                iDoubledContacts = CheckContactDuplicationL( iStoreContact );
-                }
             
             MVPbkContactLink* result = IsValidResultLC( iStoreContact );
             if ( result )
                 {
                 iResults->AppendL( result );
                 CleanupStack::Pop(); // MVPbkContactLink
+                
+                if ( iDoubledContacts )
+                    {
+                    iDoubledContacts = CheckContactDuplicationL( iStoreContact );
+                    }
                 }
+
             delete iStoreContact;
             iStoreContact = NULL;
                 
@@ -509,7 +523,8 @@
     {
     MVPbkContactLink* result = NULL;
 
-    if (!(iMatchFlags & CVPbkPhoneNumberMatchStrategy::EVPbkExactMatchFlag))
+    if (!(iMatchFlags & CVPbkPhoneNumberMatchStrategy::EVPbkExactMatchFlag)
+            && !(iMatchFlags & CVPbkPhoneNumberMatchStrategy::EVPbkBestMatchingFlag))
         {
         // If exact match is not needed we will accept the contact as valid
         // if it is not NULL
@@ -539,10 +554,19 @@
             if (data.DataType() == EVPbkFieldStorageTypeText)
                 {
                 const TDesC& dataText = MVPbkContactFieldTextData::Cast(data).Text();
-                TPtrC dataTextPtr = dataText.Right(Min(dataText.Length(), iMaxMatchDigits));
-                if (dataTextPtr == matchedNumber)
+                if (iMatchFlags & CVPbkPhoneNumberMatchStrategy::EVPbkExactMatchFlag)
                     {
-                    result = iFieldFilter->FieldAt(i).CreateLinkLC();
+                    TPtrC dataTextPtr = dataText.Right(Min(dataText.Length(), iMaxMatchDigits));
+                    if (dataTextPtr == matchedNumber)
+                        {
+                        result = iFieldFilter->FieldAt(i).CreateLinkLC();
+                        break;
+                        }
+                    }
+                else if (iMatchFlags & CVPbkPhoneNumberMatchStrategy::EVPbkBestMatchingFlag
+                            && ValidateBestMatchingRulesL(dataText))
+                    {
+                    result = aContact->CreateLinkLC();
                     break;
                     }
                 }
@@ -695,6 +719,232 @@
         }
     }
 
+// Removes non-digit chars except plus form the beginning
+// Checks if number matches to one of defined types
+//
+TInt CVPbkPhoneNumberMatchStrategyImpl::FormatAndCheckNumberType( TDes& aNumber )
+    {
+    _LIT( KOneZeroPattern, "0*" );
+    _LIT( KTwoZerosPattern, "00*" );
+    _LIT( KPlusPattern, "+*" );
+    const TChar KPlus = TChar('+');
+    const TChar KZero = TChar('0');
+    const TChar KAsterisk = TChar('*');
+    const TChar KHash = TChar('#');
+    
+    for( TInt pos = 0; pos < aNumber.Length(); ++pos )
+        {
+        TChar chr = aNumber[pos];
+        if ( !chr.IsDigit() && !( pos == 0 && chr == KPlus  )
+                && !( chr == KAsterisk ) && !( chr == KHash ) )
+            {
+            aNumber.Delete( pos, 1 );
+            --pos;
+            }
+        }
+    
+	TInt format;
+	
+    if ( !aNumber.Match( KTwoZerosPattern ) && aNumber.Length() > 2 && aNumber[2] != KZero )
+        {
+        format = ETwoZeros;
+        }
+    else if ( !aNumber.Match( KOneZeroPattern )&& aNumber.Length() > 1 && aNumber[1] != KZero )
+        {
+        format = EOneZero;
+        }
+    else if ( !aNumber.Match( KPlusPattern ) && aNumber.Length() > 1 && aNumber[1] != KZero )
+        {
+        format = EPlus;
+        }
+    else if ( aNumber.Length() > 0 && aNumber[0] != KZero && ( ( TChar ) aNumber[0] ).IsDigit() )
+        {
+        format = EDigit;
+        }
+	else
+		{
+        format = EUnknown;
+	    }
+
+    return format;
+    }
+
+TBool CVPbkPhoneNumberMatchStrategyImpl::ValidateBestMatchingRulesL( const TDesC& aNumber )
+    {
+    if ( iPhoneNumberType == ENotInitialized )
+        {
+        TPtr16 phoneNumber = iPhoneNumber->Des();
+        iPhoneNumberType = ( TNumberType ) FormatAndCheckNumberType( phoneNumber );
+        }
+    
+    HBufC* number = aNumber.AllocLC();
+    TPtr16 phoneNumber = number->Des();
+    TNumberType numberType = ( TNumberType ) FormatAndCheckNumberType( phoneNumber );
+
+    TBool match = ( !phoneNumber.Compare( *iPhoneNumber ) ||
+                  CheckBestMatchingRules( *iPhoneNumber, iPhoneNumberType, *number, numberType  ) ||
+                  CheckBestMatchingRules( *number, numberType, *iPhoneNumber, iPhoneNumberType  ) );
+
+    CleanupStack::PopAndDestroy( number );
+
+    return match;
+    }
+
+TBool CVPbkPhoneNumberMatchStrategyImpl::CheckBestMatchingRules(
+        const TDesC& aNumberA, TNumberType aNumberAType,
+        const TDesC& aNumberB, TNumberType aNumberBType  )
+    {
+    TBool result = EFalse;
+    
+    // Rules for matching not identical numbers
+    // Rules details are presented in Best_Number_Matching_Algorithm_Description.doc
+    
+    // rule International-International 1
+    if ( !result && aNumberAType == EPlus && aNumberBType == ETwoZeros )
+        {
+        TPtrC numberA = aNumberA.Right( aNumberA.Length() - 1 );
+        TPtrC numberB = aNumberB.Right( aNumberB.Length() - 2 );
+        result = !( numberA.Compare( numberB ) );
+        if ( result )
+            {
+            return result;
+            }
+        }
+
+    // rule International-International 2
+    if ( aNumberAType == EPlus && aNumberBType == EDigit )
+        {
+        TPtrC numberA = aNumberA.Right( aNumberA.Length() - 1 );
+        if ( numberA.Length() < aNumberB.Length() )
+            {
+            TPtrC numberB = aNumberB.Right( numberA.Length() );
+            result = !( numberA.Compare( numberB ) );
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // rule International-International 3
+    if ( aNumberAType == ETwoZeros && aNumberBType == EDigit )
+        {
+        TPtrC numberA = aNumberA.Right( aNumberA.Length() - 2 );
+        if ( numberA.Length() < aNumberB.Length() )
+            {
+            TPtrC numberB = aNumberB.Right( numberA.Length() );
+            result = !( numberA.Compare( numberB ) );
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // rule International-Operator 1
+    if ( aNumberAType == EOneZero && aNumberBType == EPlus
+            || aNumberAType == EDigit && aNumberBType == EPlus )
+        {
+        TPtrC numberA;
+        if ( aNumberAType == EOneZero )
+            {
+            numberA.Set( aNumberA.Right( aNumberA.Length() - 1 ) );
+            }
+        else
+            {
+            numberA.Set( aNumberA );
+            }
+        if ( numberA.Length() < aNumberB.Length() - 1 )
+            {
+            TPtrC numberB = aNumberB.Right( numberA.Length() );
+            result = !( numberA.Compare( numberB ) );
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // rule International-Operator 2
+    if ( aNumberAType == EOneZero && aNumberBType == ETwoZeros
+            || aNumberAType == EDigit && aNumberBType == ETwoZeros )
+        {
+        TPtrC numberA;
+        if ( aNumberAType == EOneZero )
+            {
+            numberA.Set( aNumberA.Right( aNumberA.Length() - 1 ) );
+            }
+        else
+            {
+            numberA.Set( aNumberA );
+            }
+        if ( numberA.Length() < aNumberB.Length() - 2 )
+            {
+            TPtrC numberB = aNumberB.Right( numberA.Length() );
+            result = !( numberA.Compare( numberB ) );
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // rule International-Operator 3
+    if ( aNumberAType == EOneZero && aNumberBType == EDigit
+            || aNumberAType == EDigit && aNumberBType == EDigit )
+        {
+        TPtrC numberA;
+        if ( aNumberAType == EOneZero )
+            {
+            numberA.Set( aNumberA.Right( aNumberA.Length() - 1 ) );
+            }
+        else
+            {
+            numberA.Set( aNumberA );
+            }
+        if ( numberA.Length() < aNumberB.Length() )
+            {
+            TPtrC numberB = aNumberB.Right( numberA.Length() );
+            result = !( numberA.Compare( numberB ) );
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // rule Operator-Operator 1
+    if ( aNumberAType == EOneZero && aNumberBType == EDigit )
+        {
+        TPtrC numberA = aNumberA.Right( aNumberA.Length() - 1 );
+        result = !( numberA.Compare( aNumberB ) );
+            {
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+    
+    // rule North America Numbering Plan 1
+    if ( aNumberAType == EDigit && aNumberBType == EPlus )
+        {
+        TPtrC numberB = aNumberB.Right( aNumberB.Length() - 1 );
+        result = !( aNumberA.Compare( numberB ) );
+            {
+            if ( result )
+                {
+                return result;
+                }
+            }
+        }
+
+    // More exceptional acceptance rules can be added here
+	// Keep rules updated in the document Best_Number_Matching_Algorithm_Description.doc
+
+    return result;
+    }
+
 CVPbkPhoneNumberMatchStrategy::CVPbkPhoneNumberMatchStrategy()
     {
     }
--- a/phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/src/CSatRefreshNotifier.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/src/CSatRefreshNotifier.cpp	Tue May 25 12:26:45 2010 +0300
@@ -20,8 +20,8 @@
 // INCLUDE FILES
 #include "CSatRefreshNotifier.h"
 
-#include <RSatSession.h>
-#include <RSatRefresh.h>
+#include <rsatsession.h>
+#include <rsatrefresh.h>
 #include <VPbkDebug.h>
 #include "MSimRefreshObject.h"
 
--- a/phonebookengines/VirtualPhonebook/group/VPbkEng.mmp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookengines/VirtualPhonebook/group/VPbkEng.mmp	Tue May 25 12:26:45 2010 +0300
@@ -138,7 +138,7 @@
 APP_LAYER_SYSTEMINCLUDE
 
 // Dependencies to Symbian OS components
-LIBRARY         euser.lib efsrv.lib bafl.lib ecom.lib estor.lib
+LIBRARY         euser.lib efsrv.lib bafl.lib ecom.lib estor.lib eikcore.lib cone.lib
 
 // Dependencies to other Phonebook components
 LIBRARY         VPbkEngUtils.lib
--- a/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def	Tue May 25 12:26:45 2010 +0300
@@ -17,4 +17,5 @@
 	?InternalizeL@CSpbContactDataModel@@QAEXAAVRReadStream@@@Z @ 16 NONAME ; void CSpbContactDataModel::InternalizeL(class RReadStream &)
 	?Data@CSpbContactDataModel@@QBE?AVTPtrC8@@W4TBinaryTypes@1@@Z @ 17 NONAME ; class TPtrC8 CSpbContactDataModel::Data(enum CSpbContactDataModel::TBinaryTypes) const
 	?ListBoxModel@CSpbContactDataModel@@QAEAAVMDesC16Array@@XZ @ 18 NONAME ; class MDesC16Array & CSpbContactDataModel::ListBoxModel(void)
+	?CleanContentL@CSpbContentProvider@@QAEXAAVMVPbkContactStore@@@Z @ 19 NONAME ; void CSpbContentProvider::CleanContentL(class MVPbkContactStore &)
 
--- a/phonebookui/Phonebook2/Commands/src/CPbk2CommandHandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/Commands/src/CPbk2CommandHandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -705,16 +705,13 @@
             CEikMenuPane* aMenuPane,
             MPbk2ContactUiControl& aControl )
     {
-    // ETrue if all selected contacts are read-only
-    TBool readOnly = AreSelectedContactsFromReadOnlyStoreL( aControl );
-
     switch (aResourceId)
         {
         case R_PHONEBOOK2_NAMESLIST_CONTEXT_MENU_MARKED_ITEMS: // FALLTHROUGH
         case R_PHONEBOOK2_NAMESLIST_DELETE_MENU:
             {
             // Weed out commands not meant to be used with read only stores
-            if (readOnly)
+            if (AreSelectedContactsFromReadOnlyStoreL( aControl ))
                 {
                 aMenuPane->SetItemDimmed(EPbk2CmdDeleteMe, ETrue);
                 }
@@ -727,7 +724,7 @@
                     iContactRelocator->IsPhoneMemoryInConfigurationL();
 
             // Weed out commands not meant to be used with read only stores
-            if (readOnly)
+            if (AreSelectedContactsFromReadOnlyStoreL( aControl ))
                 {
                 aMenuPane->SetItemDimmed(EPbk2CmdDeleteMe, ETrue);
                 aMenuPane->SetItemDimmed(EPbk2CmdEditMe, ETrue);
@@ -770,7 +767,7 @@
         case R_PHONEBOOK2_CONTACTINFO_CONTEXT_MENU:
             {
             // Weed out commands not meant to be used with read only stores
-            if (readOnly)
+            if (AreSelectedContactsFromReadOnlyStoreL( aControl ))
                 {
                 aMenuPane->SetItemDimmed(EPbk2CmdEditMe, ETrue);
                 }
--- a/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def	Tue May 25 12:26:45 2010 +0300
@@ -19,4 +19,5 @@
 	_ZNK20CSpbContactDataModel4TextENS_10TTextTypesE @ 18 NONAME
 	_ZTI20CSpbContactDataModel @ 19 NONAME
 	_ZTV20CSpbContactDataModel @ 20 NONAME
+	_ZN19CSpbContentProvider13CleanContentLER17MVPbkContactStore @ 21 NONAME
 
--- a/phonebookui/Phonebook2/GroupExtension/inc/CPguAddMembersCmd.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/GroupExtension/inc/CPguAddMembersCmd.h	Tue May 25 12:26:45 2010 +0300
@@ -158,6 +158,8 @@
         void DoLaunchFetchDialogL();
         void PrepareFetchResultsL(
                 MVPbkContactLinkArray* aMarkedEntries );
+        void CheckContactsL();
+        void BeginRelocationL();
         void RelocateContactsL();
         void RelocateContactL(
                 MVPbkStoreContact* aStoreContact );
@@ -178,6 +180,8 @@
             {
             ERetrievingContact,
             EHandleContactLockedEvent,
+            ECheckContacts,
+            ERelocateContacts,
             EShowingProgressNote,
             EAddingContactsToGroup,
             ECommitingTransaction,
@@ -213,6 +217,10 @@
         TState iState;
         /// Own: count of contacts already added to group 
         TInt iAddedContactsCount;
+        /// Own: counter of contacts 
+        TInt iContactsCounter;
+        /// Own: Contact 
+        MVPbkStoreContact* iContact;
     };
 
 #endif // CPGUADDMEMBERSCMD_H
--- a/phonebookui/Phonebook2/GroupExtension/src/CPguAddMembersCmd.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/GroupExtension/src/CPguAddMembersCmd.cpp	Tue May 25 12:26:45 2010 +0300
@@ -118,7 +118,8 @@
         {
         iUiControl->RegisterCommand( NULL );
         }
-
+    
+    delete iContact;
     delete iRetrieveContactOperation;
     delete iRetrieveGroupOperation;
     delete iContactGroup;
@@ -136,6 +137,7 @@
 inline void CPguAddMembersCmd::ConstructL()
     {
     iState = ERetrievingContact;
+    iContactsCounter = 0;
     }
 // --------------------------------------------------------------------------
 // CPguAddMembersCmd::NewLC
@@ -208,6 +210,16 @@
             HandleContactLockedEventL();
             break;
             }
+        case ECheckContacts:
+            {
+            CheckContactsL();
+            break;
+            } 
+        case ERelocateContacts:
+            {
+            BeginRelocationL();
+            break;
+            }            
         case EShowingProgressNote:
             {
             ShowProgressNoteL();
@@ -250,20 +262,8 @@
 // --------------------------------------------------------------------------
 //
 TInt CPguAddMembersCmd::RunError( TInt aError )
-    {
-    if ( iState == EAddingContactsToGroup && aError == KErrInUse &&
-         iEntriesToAdd && iEntriesToAdd->Count() > KOneContact )
-        {    
-        // Incase there was more than just one contact being added, ignore
-        // the KErrInUse error and continue with the remaining contacts
-        iState = EAddingContactsToGroup;
-        IssueRequest();   
-        }
-    else if ( aError != KErrNone )
-        {
-        FinishCommand( aError );
-        }
-
+    {        
+    FinishCommand( aError );
     return KErrNone;
     }
 
@@ -288,10 +288,16 @@
 
         TRAP( error, iContactGroup->LockL( *this ) );
         }
-    else if ( &aOperation == iRetrieveContactOperation )
+    else if ( &aOperation == iRetrieveContactOperation && iState == ERelocateContacts )
         {
         TRAP( error, RelocateContactL( aContact ) );
         }
+    else if ( &aOperation == iRetrieveContactOperation && iState == ECheckContacts )
+        {
+        iContact = aContact;
+        // try to lock to check if contact is being modified by another application
+        TRAP( error, iContact->LockL( *this ) );
+        }
 
     if ( error != KErrNone )
         {
@@ -315,11 +321,21 @@
 //
 void CPguAddMembersCmd::ContactOperationCompleted( TContactOpResult aResult )
     {
-    if ( aResult.iOpCode == MVPbkContactObserver::EContactLock )
+    if ( aResult.iOpCode == MVPbkContactObserver::EContactLock && 
+            iState == ERetrievingContact )
         {
         iState = EHandleContactLockedEvent;
         IssueRequest();
         }
+    else if ( aResult.iOpCode == MVPbkContactObserver::EContactLock && 
+            iState == ECheckContacts )
+        {
+        iContactsCounter++;
+        // delete to release the lock of contact
+        delete iContact;
+        iContact = NULL;
+        IssueRequest();
+        }
     else if ( aResult.iOpCode == MVPbkContactObserver::EContactCommit )
         {
         FinishCommand( KErrNone );
@@ -330,10 +346,18 @@
 // CPguAddMembersCmd::ContactOperationFailed
 // --------------------------------------------------------------------------
 //
+
 void CPguAddMembersCmd::ContactOperationFailed
-        ( TContactOp /*aOpCode*/, TInt aErrorCode, TBool aErrorNotified )
+        ( TContactOp aOpCode, TInt aErrorCode, TBool aErrorNotified )
     {
-    if ( !aErrorNotified )
+    if ( aOpCode == MVPbkContactObserver::EContactLock && 
+            iState == ECheckContacts )
+        {
+        delete iContact;
+        iContact = NULL;
+        FinishCommand( aErrorCode );
+        }
+    else if ( !aErrorNotified )
         {
         FinishCommand( aErrorCode );
         }
@@ -357,6 +381,7 @@
 // CPguAddMembersCmd::ContactViewUnavailable
 // --------------------------------------------------------------------------
 //
+
 void CPguAddMembersCmd::ContactViewUnavailable
         ( MVPbkContactViewBase& /*aView*/ )
     {
@@ -681,28 +706,8 @@
                 }
             }
 
-        if ( iEntriesToRelocate->Count() > KOneContact )
-            {
-            RelocateContactsL();
-            }
-        else if ( iEntriesToRelocate->Count() == KOneContact )
-            {
-            // We'll have to retrieve the one single contact and
-            // use single contact relocator
-            delete iRetrieveContactOperation;
-            iRetrieveContactOperation = NULL;
-            iRetrieveContactOperation =
-                Phonebook2::Pbk2AppUi()->ApplicationServices().
-                    ContactManager().RetrieveContactL(
-                        iEntriesToRelocate->At( KFirstElement ), *this );
-            }
-        else
-            {
-            // Contacts will be added to group. First show
-            // the progress note.
-            iState = EShowingProgressNote;
-            IssueRequest();
-            }
+        iState = ECheckContacts;
+        IssueRequest();
         }
     }
 
@@ -945,4 +950,45 @@
         }
     }
 
+void CPguAddMembersCmd::BeginRelocationL()
+    {
+    if ( iEntriesToRelocate->Count() > KOneContact )
+        {
+        RelocateContactsL();
+        }
+    else if ( iEntriesToRelocate->Count() == KOneContact )
+        {
+        // We'll have to retrieve the one single contact and
+        // use single contact relocator
+        delete iRetrieveContactOperation;
+        iRetrieveContactOperation = NULL;
+        iRetrieveContactOperation =
+            Phonebook2::Pbk2AppUi()->ApplicationServices().
+                ContactManager().RetrieveContactL(
+                    iEntriesToRelocate->At( KFirstElement ), *this );
+        }
+    else
+        {
+        // Contacts will be added to group. First show
+        // the progress note.
+        iState = EShowingProgressNote;
+        IssueRequest();
+        }
+    }
+
+void CPguAddMembersCmd::CheckContactsL()
+    {
+    if ( iContactsCounter < iEntriesToAdd->Count() )
+        {
+        delete iRetrieveContactOperation;
+        iRetrieveContactOperation = NULL;
+        iRetrieveContactOperation = Phonebook2::Pbk2AppUi()->ApplicationServices().
+            ContactManager().RetrieveContactL( iEntriesToAdd->At( iContactsCounter ), *this );
+        }
+    else
+        {
+        iState = ERelocateContacts;
+        IssueRequest();
+        }
+    }
 // End of File
--- a/phonebookui/Phonebook2/GroupExtension/src/CPguGroupMembersView.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/GroupExtension/src/CPguGroupMembersView.cpp	Tue May 25 12:26:45 2010 +0300
@@ -56,6 +56,7 @@
 #include <MPbk2ContactViewSupplier.h>
 #include <CPbk2StoreConfiguration.h>
 #include <MPbk2AppUi.h>
+#include <Pbk2MenuFilteringFlags.hrh>
 
 // Virtual Phonebook
 #include <MVPbkContactViewBase.h>
@@ -2093,7 +2094,17 @@
 //
 TInt CPguGroupMembersView::GetViewSpecificMenuFilteringFlagsL() const
     {
-    return iViewImpl->GetViewSpecificMenuFilteringFlagsL();
+    TInt flags = iViewImpl->GetViewSpecificMenuFilteringFlagsL();
+    MPbk2ContactUiControl* ctrl = iViewImpl->Control();
+    if( ctrl )
+        {
+        const MVPbkViewContact* contact = ctrl->FocusedViewContactL();
+        if( contact && contact->Expandable() )
+            {
+            flags |= KPbk2FocusedItemIsExpandable;
+            }
+        }
+    return flags;
     }
 
 // --------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/GroupExtension/src/CPguGroupView.cpp	Tue May 25 12:26:45 2010 +0300
@@ -44,6 +44,7 @@
 #include <MPbk2ContactViewSupplier.h>
 #include <CPbk2ApplicationServices.h>
 #include <MPbk2StoreValidityInformer.h>
+#include <Pbk2MenuFilteringFlags.hrh>
 
 // Virtual Phonebook
 #include <MVPbkContactStoreList.h>
@@ -54,6 +55,7 @@
 #include <MVPbkContactStoreProperties.h>
 #include <VPbkContactStoreUris.h>
 #include <MVPbkContactViewBase.h>
+#include <MVPbkViewContact.h>
 
 // System includes
 #include <eikmenup.h>
@@ -335,6 +337,11 @@
     if ( iControl )
         {
         flags |= iControl->GetMenuFilteringFlagsL();
+        const MVPbkViewContact* contact = iControl->FocusedViewContactL();
+        if( contact && contact->Expandable() )
+            {
+            flags |= KPbk2FocusedItemIsExpandable;
+            }
         }
     return flags;
     }
--- a/phonebookui/Phonebook2/GroupExtension/src/CPguSendMessageGroupCmd.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/GroupExtension/src/CPguSendMessageGroupCmd.cpp	Tue May 25 12:26:45 2010 +0300
@@ -54,7 +54,8 @@
 #include <akntitle.h>
 #include <eikspane.h>
 #include <avkon.hrh>
-
+#include <avkon.rsg>
+#include <layoutmetadata.cdl.h>
 // Debugging headers
 #include <Pbk2Debug.h>
 
@@ -379,8 +380,20 @@
     Phonebook2::Pbk2AppUi()->ApplicationServices().SendUiL()->
         CreateAndSendMessageL( iMtmUid, iMessageData );
 
-    // Sets title pane for tile which was save
-    titlePane->SetText( title );
+    if( !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
+        sp->MakeVisible( ETrue );
+        
+        // Sets title pane for tile which was save
+        titlePane->SetText( title );
+        sp->DrawNow();
+        }
+    else
+        {
+        // Sets title pane for tile which was save
+        titlePane->SetText( title );
+        }
     CleanupStack::Pop();
 
     iState = EStopping;
--- a/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp	Tue May 25 12:26:45 2010 +0300
@@ -182,7 +182,7 @@
                 
     if ( !iMapViewProvider )
         {
-        User::Leave( KErrGeneral );
+        User::Leave( KErrNotSupported );
         }
     
     if( iUiControl && ! iContact )
--- a/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h	Tue May 25 12:26:45 2010 +0300
@@ -155,6 +155,7 @@
     TBool IsTopContact( const MVPbkBaseContact* aContact );
     MVPbkContactLink* MyCardLink() const;
     void InitLocalStoreObserverL();
+    void InitAdnStoreObserverL();
 
     private: // Data
     MCCAConnection* iCCAConnection;  // own
@@ -165,6 +166,7 @@
     TInt iLocalStoreContactsCount;
     // Not own:
     MVPbkContactStore* iLocalStore;
+    MVPbkContactStore* iAdnStore;
     // Own
     CPbk2ApplicationServices*  iAppServices;
     };
--- a/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2openmycardcmd.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2openmycardcmd.h	Tue May 25 12:26:45 2010 +0300
@@ -29,6 +29,7 @@
 class CPbk2StoreSpecificFieldPropertyArray;
 class CPbk2PresentationContact;
 class CPbk2MyCard;
+class MVPbkContactLink;
 
 //Cca
 class MCCAParameter;
@@ -78,6 +79,18 @@
 
     private: // Implementation
 
+        /**
+         * Set contact launch data (launch mycard from link)
+         */
+        void SetContactDataL( MCCAParameter& aParam, MVPbkContactLink* aLink );
+        
+        /**
+         * Set contact launch data (launch mycard from data model)
+         * If aContact is not provided then empty model will be delivered.
+         * Empty model means that mycard does not exist and needs to be created.
+         */
+        void SetContactDataL( MCCAParameter& aParam, CPbk2PresentationContact* aContact = NULL );
+
         void LaunchCcaL(); // Sync
 		void IssueRequest();
 		
--- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp	Tue May 25 12:26:45 2010 +0300
@@ -108,6 +108,10 @@
         {
         iLocalStore->Close( *this );
         }
+    if ( iAdnStore )
+        {
+        iAdnStore->Close( *this );
+        }
     Release( iAppServices );
     }
 
@@ -515,6 +519,7 @@
 		mycard = iNamesListExViewRef->MyCard();
 		}
     InitLocalStoreObserverL();
+    InitAdnStoreObserverL();
     
     MPbk2ContactUiControlExtension* extension = 
         CPbk2NameslistUiControlExtension::NewL( aContactManager, ContentProviderL(), mycard );
@@ -722,10 +727,12 @@
 //
 void CNamesListUIExtensionPlugin::StoreReady( MVPbkContactStore& aContactStore )
     {
-    if ( aContactStore.StoreProperties().Name().UriDes().Compare
+    if ( !aContactStore.StoreProperties().Uri().UriDes().Compare
             ( VPbkContactStoreUris::DefaultCntDbUri() ) )
         {
-        iLocalStoreContactsCount = iLocalStore->StoreInfo().NumberOfContactsL();
+        TRAP_IGNORE( 
+                iLocalStoreContactsCount = iLocalStore->StoreInfo().NumberOfContactsL(); 
+                );
         }
     }
 
@@ -734,9 +741,13 @@
 // --------------------------------------------------------------------------
 //
 void CNamesListUIExtensionPlugin::StoreUnavailable
-        ( MVPbkContactStore& /*aContactStore*/, TInt /*aReason*/ )
+        ( MVPbkContactStore& aContactStore, TInt /*aReason*/ )
     {
-
+    if( iContentProvider )
+       {
+       // when store unavailable, its cached content is to be deleted
+       iContentProvider->CleanContentL( aContactStore );    
+       }
     }
 
 // --------------------------------------------------------------------------
@@ -746,8 +757,8 @@
 void CNamesListUIExtensionPlugin::HandleStoreEventL(
         MVPbkContactStore& aContactStore,
         TVPbkContactStoreEvent aStoreEvent )
-    {
-    if ( aContactStore.StoreProperties().Name().UriDes().Compare
+    {   
+    if ( !aContactStore.StoreProperties().Uri().UriDes().Compare
             ( VPbkContactStoreUris::DefaultCntDbUri() ) )
         {
         switch ( aStoreEvent.iEventType )
@@ -784,4 +795,21 @@
             }
         }
     }
+
+// --------------------------------------------------------------------------
+// CNamesListUIExtensionPlugin::InitAdnStoreObserverL
+// --------------------------------------------------------------------------
+//
+void CNamesListUIExtensionPlugin::InitAdnStoreObserverL()
+    {
+    if ( !iAdnStore )
+        {
+        MVPbkContactStoreList& storeList = iAppServices->ContactManager().ContactStoresL();
+        iAdnStore = storeList.Find( VPbkContactStoreUris::SimGlobalAdnUri() );
+        if ( iAdnStore )
+            {
+            iAdnStore->OpenL( *this );
+            }
+        }
+    }
 //  End of File
--- a/phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp	Tue May 25 12:26:45 2010 +0300
@@ -440,6 +440,8 @@
 				{
 				delete iMyCardLink;
 				iMyCardLink = NULL;
+			    delete iMyCardStoreContact;
+			    iMyCardStoreContact = NULL;
 				iMyCardState = ENonExisting;
 				NotifyObservers( MPbk2MyCardObserver::EStateStatusResolved );
 				
--- a/phonebookui/Phonebook2/NamesListExtension/src/cpbk2openmycardcmd.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/NamesListExtension/src/cpbk2openmycardcmd.cpp	Tue May 25 12:26:45 2010 +0300
@@ -168,35 +168,25 @@
         {
         // Speed up mycard launching by constructing the view model here.
         // This information is not mandatory for mycard launching however.
-        CBufFlat* buffer = CBufFlat::NewL( KKilo );
-        CleanupStack::PushL( buffer );
-        RBufWriteStream stream( *buffer );
-        CleanupClosePushL( stream );
-
-        // create model and dump it into stream
-        CSpbContactDataModel* model = CSpbContactDataModel::NewL( 
-            iMyCard->ContactManager(), *CCoeEnv::Static(), 
-            R_PBK2_MYCARD_FIELD_CLIP_SELECTOR );
-        CleanupStack::PushL( model );
-
         if( iMyCard->MyCardState() == CPbk2MyCard::EExisting )
             {
-            // preset contact data model to contain my cards data.
             CPbk2PresentationContact* contact = PresentationContactL();
             if( contact )
                 {
-                model->SetDataL( *contact, NULL );
+                // preset contact data model to contain my cards data.
+                SetContactDataL( *parameter, contact );
+                }
+            else
+                {
+                // special case when we have mycard but it's not loaded yet.
+                SetContactDataL( *parameter, iMyCard->MyCardLink() );
                 }
             }
-        model->ExternalizeL( stream );
-        CleanupStack::PopAndDestroy( 2, &stream ); // model
-
-        // set model dump as parameter
-        TPtrC8 buf( buffer->Ptr( 0 ) );
-        TPtrC16 data( (TUint16*)buf.Ptr(), ( buf.Size() + 1 ) / 2 );
-        parameter->SetContactDataFlag( MCCAParameter::EContactDataModel );
-        parameter->SetContactDataL( data );
-        CleanupStack::PopAndDestroy( buffer ); 
+        else
+            {
+            // My card does not exist. Give empty model as parameter.
+            SetContactDataL( *parameter );
+            }
         }
 
     // Sync call
@@ -208,6 +198,56 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2OpenMyCardCmd::SetContactDataL
+// --------------------------------------------------------------------------
+//
+void CPbk2OpenMyCardCmd::SetContactDataL( MCCAParameter& aParam, MVPbkContactLink* aLink )
+    {
+    if( aLink )
+        {
+        HBufC8* link8 = aLink->PackLC();                        
+        HBufC16* link16 = HBufC16::NewLC( link8->Length() );
+        link16->Des().Copy( *link8 );
+        aParam.SetContactDataFlag( MCCAParameter::EContactLink );
+        aParam.SetContactDataL( link16->Des() );
+        CleanupStack::PopAndDestroy( 2, link8 ); 
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2OpenMyCardCmd::SetContactDataL
+// --------------------------------------------------------------------------
+//
+void CPbk2OpenMyCardCmd::SetContactDataL( MCCAParameter& aParam, CPbk2PresentationContact* aContact )
+    {
+    CBufFlat* buffer = CBufFlat::NewL( KKilo );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream stream( *buffer );
+    CleanupClosePushL( stream );
+
+    // create model and dump it into stream
+    CSpbContactDataModel* model = CSpbContactDataModel::NewL( 
+        iMyCard->ContactManager(), *CCoeEnv::Static(), 
+        R_PBK2_MYCARD_FIELD_CLIP_SELECTOR );
+    CleanupStack::PushL( model );
+
+    if( aContact )
+        {
+        model->SetDataL( *aContact, NULL );
+        }
+    
+    model->ExternalizeL( stream );
+    CleanupStack::PopAndDestroy( 2, &stream ); // model
+
+    // set model dump as parameter
+    TPtrC8 buf( buffer->Ptr( 0 ) );
+    TPtrC16 data( (TUint16*)buf.Ptr(), ( buf.Size() + 1 ) / 2 );
+    aParam.SetContactDataFlag( MCCAParameter::EContactDataModel );
+    aParam.SetContactDataL( data );
+    CleanupStack::PopAndDestroy( buffer ); 
+    }
+
+// --------------------------------------------------------------------------
 // CPbk2OpenMyCardCmd::IssueRequest
 // --------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp	Tue May 25 12:26:45 2010 +0300
@@ -470,7 +470,7 @@
         const TDesC& compareContactFieldText = 
                 MVPbkContactFieldTextData::Cast(compareContactField->FieldData()).Text();
         const TDesC& contactFieldText = 
-                MVPbkContactFieldTextData::Cast(compareContactField->FieldData()).Text();
+                MVPbkContactFieldTextData::Cast(contactField->FieldData()).Text();
         if ( compareContactFieldText.CompareF( contactFieldText ) == 0 )
             {
             result = ETrue;
--- a/phonebookui/Phonebook2/ServerApplication/inc/CPbk2CommAddressSelectPhase.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ServerApplication/inc/CPbk2CommAddressSelectPhase.h	Tue May 25 12:26:45 2010 +0300
@@ -64,11 +64,33 @@
         
         enum TState
             {
-            EMainContactRetrieving,
-            ExSPLinksRetrieving,
-            ExSPContactsRetrieving,
-            EWaitForPresenceIcons,
-            EDialogWaitsUserInput
+            // EInitialState -> EMainContactRetrieved
+            EInitialState,
+            // EMainContactRetrieved -> ExSPLinksRetrieved
+            // EMainContactRetrieved -> EAddressSelectDone
+            EMainContactRetrieved,
+            // ExSPLinksRetrieved -> ExSPContactRetrieved 
+            // ExSPLinksRetrieved -> EPresenceIconInfoRetrieved
+            // ExSPLinksRetrieved -> EAddressSelectDone
+            ExSPLinksRetrieved, 
+            // ExSPContactRetrieved -> ExSPContactRetrieved
+            // ExSPContactRetrieved -> ExSPContactsRetrieved
+            // ExSPContactRetrieved -> EAddressSelectDone
+            ExSPContactRetrieved,
+            // ExSPContactsRetrieved -> EPresenceIconInfoRetrieved
+            // ExSPContactsRetrieved -> EAddressSelectDone
+            ExSPContactsRetrieved,
+            // EPresenceIconInfoRetrieved -> EPresenceIconRetrieved
+            // EPresenceIconInfoRetrieved -> EAddressSelectDone
+            EPresenceIconInfoRetrieved,
+            // EPresenceIconRetrieved -> EPresenceIconsRetrieved
+            // EPresenceIconRetrieved -> EAddressSelectDone
+            EPresenceIconRetrieved,
+            // EPresenceIconsRetrieved -> EAddressSelectDone
+            EPresenceIconsRetrieved,
+            // EAddressSelectDone -> EAddressSelectError
+            EAddressSelectDone,
+            EAddressSelectError
             };
      
     public: // Construction
@@ -178,7 +200,13 @@
                     aCommSelector );
         void ConstructL(
                 const MVPbkContactLink& aContactLink );
+        void HandleReceiveIconInfosL(
+                const TDesC8& aPackedLink,
+                RPointerArray <MContactPresenceInfo>& aInfoArray,
+                TInt aOpId );
+        void RetrieveContact();
         void RetrieveContactL();
+        void DoSelectAddresses();
         void DoSelectAddressesL();
         TInt CorrectRSK(
                 TInt aAddressSelectResourceId );
@@ -189,6 +217,15 @@
         void FilterXspContactsL();
         TBool IsMatchL( MVPbkStoreContact& aXspContact, 
                 MVPbkStoreContact& aStoreContact );
+        void StartLoadingxSPContactLinks();
+        void StartLoadingxSPContactLinksL();
+        void StartLoadingxSPContacts( MVPbkContactLinkArray& aArray );
+        void StartLoadingxSPContactsL( MVPbkContactLinkArray& aArray );
+        void StartLoadingPresenceIconInfo();
+        void StartLoadingPresenceIconInfoL();
+        TInt NumOfAddressesL( MVPbkStoreContact& aStoreContact );
+        TInt NumOfAddressesL();
+        void GetPresenceInfoL();
     
     private: // Data
         /// Ref: Observer
@@ -233,10 +270,6 @@
         MContactPresence* iContactPresence;
         /// Own: array of presence icons
         RPointerArray<CPbk2PresenceIconInfo> iPresenceIconArray;
-        /// Own: ETrue, if presence icon has been retrieved
-        TBool iPresenceIconsRetrieved;
-        /// Own: ETrue, if contact has been retrieved
-        TBool iContactRetrieved;
         /// Own: Communication method
         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector iCommMethod;
     };
--- a/phonebookui/Phonebook2/ServerApplication/src/CPbk2CommAddressSelectPhase.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ServerApplication/src/CPbk2CommAddressSelectPhase.cpp	Tue May 25 12:26:45 2010 +0300
@@ -43,6 +43,8 @@
 #include <MVPbkContactFieldUriData.h>
 #include <CVPbkFieldTypeRefsList.h>
 #include <CVPbkContactFieldIterator.h>
+#include <CVPbkFieldTypeSelector.h>
+#include <CVPbkFieldFilter.h>
 #include <VPbkEng.rsg>
 
 // System includes
@@ -56,6 +58,22 @@
 /// Unnamed namespace for local definitions
 namespace {
 
+#ifdef _DEBUG
+enum TPanicCode
+    {
+    EPanicPreCond_LaunchServicePhaseL = 1,
+    EPanicPreCond_ContactOperationComplete,
+    EPanicPreCond_RetrieveContactL,
+    EPanicPreCond_DoSelectAddressesL
+    };
+
+static void Panic(TPanicCode aReason)
+    {
+    _LIT(KPanicText, "CPbk2CommAddressSelectPhase");
+    User::Panic(KPanicText, aReason);
+    }
+#endif // _DEBUG
+
 // Separator between service name and user's id in the service name returned
 // in presence icon info.
 _LIT( KServiceNameSeparator, ":");
@@ -130,8 +148,8 @@
             iPriorities( aPriorities ),
             iRskBack( aRskBack ),
             iFieldTypeSelector ( aFieldTypeSelector ),
-            iCommMethod( aCommSelector ),
-            iContactRetrieved( EFalse )
+            iState( EInitialState ),
+            iCommMethod( aCommSelector )
     {
     }
 
@@ -193,25 +211,6 @@
 
     ixSPManager = CVPbkxSPContacts::NewL(
          appUi.ApplicationServices().ContactManager() );
-
-    // Create contact presence manager if chat fields should be shown
-    if ( ( iCommMethod ==
-            VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ) ||
-            ( iCommMethod ==
-                        VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) )
-            
-        {
-        iContactPresence = TContactPresenceFactory::NewContactPresenceL(
-            *this );
-        // ...and start presence icons retrieving
-        HBufC8* packedLink = iContactLink->PackLC();
-        TInt opId = iContactPresence->GetPresenceInfoL( *packedLink );
-        CleanupStack::PopAndDestroy( packedLink );
-        }
-    else
-        {
-        iPresenceIconsRetrieved = ETrue;
-        }
     }
 
 // --------------------------------------------------------------------------
@@ -242,9 +241,9 @@
 //
 void CPbk2CommAddressSelectPhase::LaunchServicePhaseL()
     {
-    // Start by retrieving first contact
-    iState = EMainContactRetrieving;
-    iContactRetrieved = ETrue;
+    __ASSERT_DEBUG( iState == EInitialState, 
+            Panic( EPanicPreCond_LaunchServicePhaseL ) );
+    
     RetrieveContactL();
     
     CPbk2ServerAppAppUi& appUi = static_cast<CPbk2ServerAppAppUi&>
@@ -268,6 +267,11 @@
 
     delete iRetrieveOperation;
     iRetrieveOperation = NULL;
+    
+    if ( iContactPresence )
+    	{
+		iContactPresence->CancelAll();
+    	}
 
     iObserver.PhaseCanceled( *this );
     }
@@ -354,58 +358,35 @@
         ( MVPbkContactOperationBase& /*aOperation*/,
           MVPbkStoreContact* aContact )
     {
-    if ( iState == EMainContactRetrieving )
+    __ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved ||
+            iState == ExSPContactRetrieved, 
+            Panic( EPanicPreCond_ContactOperationComplete ) );
+    
+    if ( iState == EInitialState )
         {
+        iState = EMainContactRetrieved;
         // Contact retrieval complete, take contact ownership
         delete iStoreContact;
         iStoreContact = aContact;
-
-        // Start fetching xSP contact links
-        iState = ExSPLinksRetrieving;
-
-        TRAPD( err,
-            ixSPContactOperation = ixSPManager->GetxSPContactLinksL(
-                *iStoreContact, *this, *this );
-             );
-
-        if ( err != KErrNone )
-            {
-            // Run the address select dialog for the main contact at least
-            TRAPD( err, DoSelectAddressesL() );
-            if ( err != KErrNone )
-                {
-                iObserver.PhaseError( *this, err );
-                }
-            iState = EDialogWaitsUserInput;
-            }
+        StartLoadingxSPContactLinks();
         }
-
-    if ( iState == ExSPContactsRetrieving )
+    else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved )
         {
-        // xSP contact retrieval complete
-        TInt err = ixSPStoreContactsArray.Append( aContact );
-
-        // If error, stop retrieving xSP contacts and show address select
-        // dialog.
+        iState = ExSPContactRetrieved;
+        
+        // xSP contact retrieval complete. Ignore errors, just try next one
+        // or go to next state.
+        /*TInt err = */ixSPStoreContactsArray.Append( aContact );
 
         // Start retrieving next xSP contact, if there are some contacts left
-        if ( ixSPContactsArray->Count() != 0 && err == KErrNone )
+        if ( ixSPContactsArray->Count() > 0 )
             {
-            TRAP( err, RetrieveContactL(); );
-            if ( err != KErrNone )
-                {
-                iState = EDialogWaitsUserInput;
-                }
+            RetrieveContact();
             }
         else
             {
-            FilterXspContactsL();            
-            // Run the address select, if no more contacts to retrieve
-            TRAP( err, DoSelectAddressesL() );
-            if ( err != KErrNone )
-                {
-                iObserver.PhaseError( *this, err );
-                }
+            iState = ExSPContactsRetrieved;
+            StartLoadingPresenceIconInfo();
             }
         }
     }
@@ -446,13 +427,7 @@
     MVPbkContactOperationBase* /*aOperation*/, TInt /*aError*/ )
     {
     // Ignore an error, xSP info can be omitted. Just run address select dialog
-    TRAPD( err, DoSelectAddressesL() );
-    if ( err != KErrNone )
-       {
-       iObserver.PhaseError( *this, err );
-       }
-
-    iState = EDialogWaitsUserInput;
+    DoSelectAddresses();
     }
 // --------------------------------------------------------------------------
 // CPbk2CommAddressSelectPhase::VPbkOperationResultCompleted
@@ -462,38 +437,14 @@
     MVPbkContactOperationBase* /*aOperation*/,
     MVPbkContactLinkArray* aArray )
     {
-    if ( aArray == NULL || aArray->Count() == 0 )
+    iState = ExSPLinksRetrieved;
+    if ( !aArray || aArray->Count() == 0 )
         {
-        // No xSP contacts, run address select dialog
-        TRAPD( err, DoSelectAddressesL() );
-        if ( err != KErrNone )
-            {
-            iObserver.PhaseError( *this, err );
-            }
+        StartLoadingPresenceIconInfo();
         }
     else
         {
-        TRAPD( err,
-            // Take a own copy of supplied contact links
-            ixSPContactsArray = CVPbkContactLinkArray::NewL();
-            CopyContactLinksL( *aArray, *ixSPContactsArray );
-
-            // Start fetching xSP contacts
-            iState = ExSPContactsRetrieving;
-            RetrieveContactL();
-            );
-
-        // If error happened, show address select dialog
-        if ( err != KErrNone )
-            {
-            TRAP( err, DoSelectAddressesL() );
-            if ( err != KErrNone )
-                {
-                iObserver.PhaseError( *this, err );
-                }
-            }
-
-        ixSPStoreContactsArray.ResetAndDestroy();
+		StartLoadingxSPContacts( *aArray );
         }
     }
 
@@ -519,13 +470,8 @@
             CFbsBitmap* aBrandedBitmap,
             CFbsBitmap* aMask )
     {
-    if ( iPresenceIconsRetrieved )
-        {
-        // icons retrieving failed before, no need to take care about
-        // presence icons anymore
-        return;
-        }
-
+	iState = EPresenceIconRetrieved;
+	
     // icon file received, save it to icon info array
     TInt count = iPresenceIconArray.Count();    
     for ( TInt i = 0; i < count; i++ )
@@ -542,24 +488,21 @@
         }
 
     // check if all icon files received
-    iPresenceIconsRetrieved = ETrue;
-    for ( TInt j = 0; j < count && iPresenceIconsRetrieved; j++ )
+    iState = EPresenceIconsRetrieved;
+    for ( TInt j = 0; j < count && iState == EPresenceIconsRetrieved; j++ )
         {
         if ( iPresenceIconArray[j]->IconBitmap() == NULL ||
              iPresenceIconArray[j]->IconBitmapMask() == NULL )
             {
-            iPresenceIconsRetrieved = EFalse;
+            // Not all retrieved, still in state  EPresenceIconRetrieved.
+            iState = EPresenceIconRetrieved;
             }
         }
 
     // start address fetch dialog, if it waits for presence icons
-    if ( iPresenceIconsRetrieved && iState == EWaitForPresenceIcons )
+    if ( iState == EPresenceIconsRetrieved )
         {
-        TRAPD( err, DoSelectAddressesL() );
-        if ( err != KErrNone )
-            {
-            iObserver.PhaseError( *this, err );
-            }
+        DoSelectAddresses();
         }
     }
 
@@ -582,26 +525,11 @@
             TInt /*aOpId*/,
             TInt /*aStatus*/ )
     {
-    // Incase of several errors from contact precense avoid
-    // multiple launching of the select dialog
-    // TODO: How should the errors be hanlded?
-    if (!iPresenceIconsRetrieved)
+    if (iState == EPresenceIconInfoRetrieved || 
+        iState == EPresenceIconRetrieved )
         {
-        // Error occured, destroy presence icon array
-        iPresenceIconsRetrieved = ETrue;
         iPresenceIconArray.ResetAndDestroy();
-        //Needn't to launch address fetch dialog if contact had been retrieved,
-        //because it will start this dialog after retrieve the contact,
-        //avoid multiple launching of the select dialog
-        if ( !iContactRetrieved )
-            {
-            // Launch the address fetch dialog if it's waiting for presence icons.
-            TRAPD( err, DoSelectAddressesL() );
-            if ( err != KErrNone )
-                {
-                iObserver.PhaseError( *this, err );
-                }
-        	}
+        DoSelectAddresses();
         }
     }
 
@@ -610,10 +538,66 @@
 // --------------------------------------------------------------------------
 //
 void CPbk2CommAddressSelectPhase::ReceiveIconInfosL(
-            const TDesC8& /*aPackedLink*/,
+            const TDesC8& aPackedLink,
             RPointerArray <MContactPresenceInfo>& aInfoArray,
-            TInt /*aOpId*/ )
+            TInt aOpId )
+    {
+    iState = EPresenceIconInfoRetrieved;
+    // Must be TRAPped here because presence framework ignores the leave
+    // and this instance will be jammed if ReceiveIconInfosL leaves.
+    TRAPD( res, HandleReceiveIconInfosL( aPackedLink, aInfoArray, aOpId ) );
+    if ( res != KErrNone )
+        {
+        DoSelectAddresses();
+        }
+    
+    }
+// --------------------------------------------------------------------------
+// CPbk2AddressSelectPhase::StoreReady
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StoreReady(
+    MVPbkContactStore& /*aContactStore*/ ) 
     {
+    // not interested
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2AddressSelectPhase::StoreUnavailable
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StoreUnavailable(
+    MVPbkContactStore& /*aContactStore*/,
+    TInt /*aReason*/ ) 
+    {
+    // not interested
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2AttributeAddressSelectPhase::StoreUnavailable
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::HandleStoreEventL(
+     MVPbkContactStore& /*aContactStore*/,
+     TVPbkContactStoreEvent aEvent ) 
+    {
+    if ( aEvent.iContactLink != NULL && iStoreContact != NULL )
+        {
+        if ( aEvent.iContactLink->RefersTo( *iStoreContact ) )
+            {
+            CancelServicePhase();
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::HandleReceiveIconInfosL(
+        const TDesC8& /*aPackedLink*/,
+        RPointerArray<MContactPresenceInfo>& aInfoArray, TInt /*aOpId*/)
+    {    
     // service specific icons received
     TInt count = aInfoArray.Count();
 
@@ -656,54 +640,23 @@
                 }
             }
         }
+    
     if ( iPresenceIconArray.Count() == 0 )
         {
-        iPresenceIconsRetrieved = ETrue;
-        }
-    if ( iPresenceIconsRetrieved && iState == EWaitForPresenceIcons )
-        {
-        TRAPD( err, DoSelectAddressesL() );
-        if ( err != KErrNone )
-            {
-            iObserver.PhaseError( *this, err );
-            }
+        DoSelectAddresses();
         }
     }
-// --------------------------------------------------------------------------
-// CPbk2AddressSelectPhase::StoreReady
-// --------------------------------------------------------------------------
-//
-void CPbk2CommAddressSelectPhase::StoreReady(
-    MVPbkContactStore& /*aContactStore*/ ) 
-    {
-    // not interested
-    }
 
 // --------------------------------------------------------------------------
-// CPbk2AddressSelectPhase::StoreUnavailable
+// CPbk2CommAddressSelectPhase::RetrieveContact
 // --------------------------------------------------------------------------
 //
-void CPbk2CommAddressSelectPhase::StoreUnavailable(
-    MVPbkContactStore& /*aContactStore*/,
-    TInt /*aReason*/ ) 
+void CPbk2CommAddressSelectPhase::RetrieveContact()
     {
-    // not interested
-    }
-
-// --------------------------------------------------------------------------
-// CPbk2AttributeAddressSelectPhase::StoreUnavailable
-// --------------------------------------------------------------------------
-//
-void CPbk2CommAddressSelectPhase::HandleStoreEventL(
-     MVPbkContactStore& /*aContactStore*/,
-     TVPbkContactStoreEvent aEvent ) 
-    {
-    if ( aEvent.iContactLink != NULL && iStoreContact != NULL )
+    TRAPD( res, RetrieveContactL() );
+    if ( res != KErrNone )
         {
-        if ( aEvent.iContactLink->RefersTo( *iStoreContact ) )
-            {
-            CancelServicePhase();
-            }
+        DoSelectAddresses();
         }
     }
 
@@ -713,6 +666,10 @@
 //
 void CPbk2CommAddressSelectPhase::RetrieveContactL()
     {
+    __ASSERT_DEBUG( iState == EInitialState || iState == ExSPLinksRetrieved ||
+            iState == ExSPContactRetrieved, 
+            Panic( EPanicPreCond_RetrieveContactL ) );
+
     CPbk2ServerAppAppUi& appUi =
         static_cast<CPbk2ServerAppAppUi&>
             ( *iEikenv->EikAppUi() );
@@ -722,12 +679,12 @@
     delete iRetrieveOperation;
     iRetrieveOperation = NULL;
 
-    if ( iState == EMainContactRetrieving )
+    if ( iState == EInitialState )
         {
         iRetrieveOperation = appUi.ApplicationServices().ContactManager().
             RetrieveContactL( *iContactLink, *this );
         }
-    else if ( iState == ExSPContactsRetrieving )
+    else if ( iState == ExSPLinksRetrieved || iState == ExSPContactRetrieved  )
         {
         iRetrieveOperation = appUi.ApplicationServices().ContactManager().
             RetrieveContactL( ixSPContactsArray->At( 0 ), *this );
@@ -736,24 +693,29 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::DoSelectAddresses
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::DoSelectAddresses()
+	{
+	TRAPD( res, DoSelectAddressesL() );
+	if ( res != KErrNone )
+		{
+		iState = EAddressSelectError;
+		iObserver.PhaseError( *this, res );
+		}
+	}
+
+// --------------------------------------------------------------------------
 // CPbk2CommAddressSelectPhase::DoSelectAddressesL
 // --------------------------------------------------------------------------
 //
 void CPbk2CommAddressSelectPhase::DoSelectAddressesL()
     {
-    
-    if ( !iStoreContact )
-        {
-        return;
-        }
+    __ASSERT_DEBUG(iStoreContact, Panic(EPanicPreCond_DoSelectAddressesL));
+
+    FilterXspContactsL();
     
-    if ( !iPresenceIconsRetrieved )
-        {
-        // wait for presence icons
-        iState = EWaitForPresenceIcons;
-        return;
-        }
-
     TResourceReader reader;
     CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
 
@@ -774,9 +736,13 @@
     // Launch call directly using default values.
     params.SetUseDefaultDirectly( ETrue );
 
+    TArray<MVPbkStoreContact*> storeContactsArray = 
+            ixSPStoreContactsArray.Array();
+    TArray<CPbk2PresenceIconInfo*> presenceIconsArray = 
+            iPresenceIconArray.Array();
     CPbk2AddressSelect* addressSelect = CPbk2AddressSelect::NewL(
-        params, iFieldTypeSelector, &ixSPStoreContactsArray.Array(),
-        &iPresenceIconArray.Array() );
+        params, iFieldTypeSelector, &storeContactsArray,
+        &presenceIconsArray );
 
     // Correct CBA buttons
     TInt correctedCba = CorrectRSK( iResourceId );
@@ -791,7 +757,8 @@
         ( &iAddressSelectEliminator );
     
     appUi.StoreManager().RegisterStoreEventsL( *this );     
-    MVPbkStoreContactField* resultField = addressSelect->ExecuteLD();   
+    MVPbkStoreContactField* resultField = addressSelect->ExecuteLD();
+    iState = EAddressSelectDone;
     appUi.StoreManager().DeregisterStoreEvents( *this ); 
 	
     CleanupStack::PopAndDestroy(); // reader
@@ -957,7 +924,8 @@
 // CPbk2CommAddressSelectPhase::IsMatchL
 // --------------------------------------------------------------------------
 //
-TBool CPbk2CommAddressSelectPhase::IsMatchL( MVPbkStoreContact& aXspContact, MVPbkStoreContact& aStoreContact )
+TBool CPbk2CommAddressSelectPhase::IsMatchL( MVPbkStoreContact& aXspContact, 
+        MVPbkStoreContact& aStoreContact )
     {
     TBool result = EFalse;
     
@@ -987,4 +955,151 @@
     
     return result;
     }
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinks()
+    {
+    TRAPD( res, StartLoadingxSPContactLinksL() );
+    if (res != KErrNone)
+        {
+        DoSelectAddresses();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingxSPContactLinksL()
+    {
+    delete ixSPContactOperation;
+    ixSPContactOperation = NULL;
+    ixSPContactOperation = ixSPManager->GetxSPContactLinksL(
+            *iStoreContact, *this, *this);
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingxSPContacts
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingxSPContacts(
+        MVPbkContactLinkArray& aArray )
+	{
+	TRAPD( res, StartLoadingxSPContactsL( aArray ) );
+	if ( res != KErrNone )
+		{
+		DoSelectAddresses();
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingxSPContactsL( 
+        MVPbkContactLinkArray& aArray )
+	{
+	// Take a own copy of supplied contact links
+    if (!ixSPContactsArray)
+        {
+        ixSPContactsArray = CVPbkContactLinkArray::NewL();
+        }
+    ixSPStoreContactsArray.ResetAndDestroy();
+    
+	CopyContactLinksL( aArray, *ixSPContactsArray );
+	RetrieveContactL();
+	}
+
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfo()
+	{
+	TRAPD( res, StartLoadingPresenceIconInfoL());
+	if ( res != KErrNone )
+		{
+		// In error case continue like there are no presence icons.
+        DoSelectAddresses();
+		}
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::StartLoadingPresenceIconInfoL()
+	{
+	const TInt oneAddress = 1;
+	if ( ( iCommMethod == 
+			VPbkFieldTypeSelectorFactory::EInstantMessagingSelector ||
+		   iCommMethod ==
+				   VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) &&
+		   NumOfAddressesL() > oneAddress )
+		{
+        GetPresenceInfoL();
+		}
+	else
+		{
+        DoSelectAddresses();
+        }
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::NumOfAddressesL
+// --------------------------------------------------------------------------
+//
+TInt CPbk2CommAddressSelectPhase::NumOfAddressesL( 
+		MVPbkStoreContact& aStoreContact )
+	{
+	CVPbkFieldFilter::TConfig config( aStoreContact.Fields(),
+			&iFieldTypeSelector );
+	CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
+	TInt result = fieldFilter->FieldCount();
+	delete fieldFilter;
+	return result;
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::NumOfAddressesL
+// --------------------------------------------------------------------------
+//
+TInt CPbk2CommAddressSelectPhase::NumOfAddressesL()
+	{
+	TInt numOfAddresses = 0; 
+	if ( iStoreContact )
+		{
+		numOfAddresses += NumOfAddressesL( *iStoreContact );
+		}
+		
+	const TInt count = ixSPStoreContactsArray.Count();
+	for ( TInt i = 0; i < count; ++i )
+		{
+		numOfAddresses += NumOfAddressesL( *ixSPStoreContactsArray[i] );
+		}
+	return numOfAddresses;
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2CommAddressSelectPhase::GetPresenceInfoL
+// --------------------------------------------------------------------------
+//
+void CPbk2CommAddressSelectPhase::GetPresenceInfoL()
+	{
+	if ( !iContactPresence )
+		{
+		iContactPresence = TContactPresenceFactory::NewContactPresenceL(
+				*this );
+		}
+	// ...and start presence icons retrieving
+	HBufC8* packedLink = iContactLink->PackLC();
+	// Operation id no needed because CancelAll is used.
+	/*TInt opId =*/iContactPresence->GetPresenceInfoL( *packedLink );
+	CleanupStack::PopAndDestroy( packedLink );
+	}
+
 // End of File
--- a/phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppAppUi.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppAppUi.cpp	Tue May 25 12:26:45 2010 +0300
@@ -103,6 +103,18 @@
     // Make sure that we are using empty statuspane layout
     ChangeStatuspaneLayoutL( CPbk2ServerAppAppUi::EStatusPaneLayoutEmpty );
     
+    CEikStatusPane* statusPane = StatusPane();
+    if (statusPane && statusPane->PaneCapabilities(
+        TUid::Uid(EEikStatusPaneUidTitle)).IsPresent())
+        {
+        CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
+            (statusPane->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
+        if (titlePane->Text())
+            {            
+            titlePane->SetTextL(KNullDesC);
+            }
+        }
+    
     }
 
 // --------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ServerApplication/src/CPbk2SingleContactDataAssigner.cpp	Tue May 25 12:26:45 2010 +0300
@@ -86,9 +86,9 @@
     if ( !( aFlags & AiwContactAssign::EUseProviderTitle ) )
         {
         titlePaneText = aDataRetriever.GetTitlePaneTextL( aMessage );
+        TPbk2TitlePaneOperator titlePaneOperator;
+        titlePaneOperator.SetTitlePaneL( titlePaneText ); // takes ownership
         }
-    TPbk2TitlePaneOperator titlePaneOperator;
-    titlePaneOperator.SetTitlePaneL( titlePaneText ); // takes ownership
     }
 
 } /// namespace
--- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h	Tue May 25 12:26:45 2010 +0300
@@ -22,6 +22,7 @@
 //  INCLUDES
 #include <e32base.h>
 #include <aknsfld.h>
+#include "CPbk2AdaptiveSearchGridWaiter.h"
 
 // FORWARD DECLARATIONS
 class CAknSearchField;
@@ -38,7 +39,8 @@
  * This class used to create adaptive search grid used to
  * search contacts from Phonebook 2.
  */
-NONSHARABLE_CLASS(CPbk2AdaptiveSearchGridFiller) : public CActive
+NONSHARABLE_CLASS(CPbk2AdaptiveSearchGridFiller) : public CActive,
+        public MPbk2SearchGridWaiterObserver
     {
     public: // Constructors and destructor
 
@@ -102,8 +104,11 @@
          * But actually this operation is done to Adaptive Search Grid. So set the focus back to it.
          */
     	 void SetFocusToAdaptiveSearchGrid();
-    	
-
+    
+    public: // MPbk2SearchGridWaiterObserver
+    	 void GridDelayCompleteL();
+    	 void WaitNoteDismissed();
+    	 
     private: // from CActive
     	
     	void RunL();
@@ -117,9 +122,10 @@
         
         CPbk2AdaptiveGrid* KeyMapFromCache( const TDesC& aFindText );
         void AddKeyMapToCacheL( const TDesC& aFindText, const TDesC& aKeyMap );
-        void SetAdaptiveGridCharsL( const TInt aMaxSpacesNumber );
+        void SetAdaptiveGridCharsL( const TInt aMaxSpacesNumber, const TInt aSearchStringSpacesNumber );
         CDesC16Array* SplitContactFieldTextIntoArrayLC( const TDesC& aText );
-		void BuildGridL( const TDesC& aContactTitle, const TDesC& aSearchString, HBufC*& aKeyMap );
+        CDesC16Array* SplitSearchFieldTextIntoArrayLC( const TDesC& aText );
+		void BuildGridL( const TDesC& aContactString, const CDesC16Array* aSearchWords, HBufC*& aKeyMap );
         TInt NumberOfSpacesInString( const TDesC& aSearchString );
         // Used to judge if this contact's title include drgraphs
         TBool IsDigraphContactsTitleL(const TDesC& aContactTitle);
@@ -160,8 +166,12 @@
 		/// Used to get the focus for the search pane,when it is true, the search pane will be drawn and get
 		/// the focus
 		TBool iSetFocusToSearchGrid;
+
 		/// Used to save the contacts' title which include drgraphs
 		RPointerArray<HBufC> iDigraphContactsTitleArray;
+		
+		/// Own: Used to display wait note if building of grid takes longer than specified time
+		CPbk2AdaptiveSearchGridWaiter* iGridWaiter;
     };
 
 #endif // CPBK2ADAPTIVESEARCHGRIDFILLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h	Tue May 25 12:26:45 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* 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:  Phonebook2 Adaptive Search Grid
+*               helper class
+*/
+
+
+#ifndef CPBK2ADAPTIVESEARCHGRIDWAITER_H
+#define CPBK2ADAPTIVESEARCHGRIDWAITER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <AknProgressDialog.h>
+
+class CAknWaitDialog;
+
+/**
+ * @internal Only Phonebook 2 internal use supported!
+ */
+class MPbk2SearchGridWaiterObserver
+    {
+    public: // Interface
+        /**
+         * Grid delay complete
+         */ 
+        virtual void GridDelayCompleteL() = 0;
+        
+        virtual void WaitNoteDismissed() = 0;
+    };
+
+/**
+ * Utility class that implements the wait logic and
+ * process decoration if needed.
+ */
+NONSHARABLE_CLASS( CPbk2AdaptiveSearchGridWaiter ) :
+        public CTimer,
+        private MProgressDialogCallback
+
+    {
+    public: // Construction and destruction
+
+        /**
+         * Creates a new instance of this class.
+         *
+         * @return  A new instance of this class.
+         */
+        static CPbk2AdaptiveSearchGridWaiter* NewL( MPbk2SearchGridWaiterObserver& aObserver );
+
+        /**
+         * Destructor.
+         */
+        ~CPbk2AdaptiveSearchGridWaiter();
+
+    public: // Interface
+
+        void Start();
+        void Stop();
+        
+    private: // From CTimer
+        void RunL();
+        TInt RunError( TInt aError );
+
+    private: // From MProgressDialogCallback
+        void DialogDismissedL( TInt aButtonId );
+
+    private: // Implementation
+        CPbk2AdaptiveSearchGridWaiter( MPbk2SearchGridWaiterObserver& aObserver );
+        void ConstructL();
+        void DismissWaitNote();
+        
+    private: // Data
+        /// Own: Decorator for the process
+        CAknWaitDialog*  iWaitNote;
+        // Notifiy if wait note is on
+        TBool iStarted;
+        // Ref:
+        MPbk2SearchGridWaiterObserver& iObserver;
+    };
+
+#endif // CPBK2ADAPTIVESEARCHGRIDWAITER_H
+            
+// End of File
--- a/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Tue May 25 12:26:45 2010 +0300
@@ -372,6 +372,7 @@
                 const TKeyEvent& aKeyEvent, 
                 TEventCode aType );
         void RestorePrevNaviDecoratorL();
+        void RestoreStatusPaneL(); 
 
     private: // Data structures
 
@@ -469,6 +470,8 @@
         /// the empty one on to the top.
         /// Doesnt Own.
         CAknNavigationDecorator* iPrevNaviDecorator;
+        
+        TInt iCurrentstatuspane;
     };
 
 #endif // CPBK2CONTACTEDITORDLGIMPL_H
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss	Tue May 25 12:26:45 2010 +0300
@@ -124,6 +124,32 @@
             }
         };
     }
-    
+
+// ---------------------------------------------------------
+// General checking contacts progress bar note
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_qtn_gen_note_checking_progress
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EPbk2NoteCheckingContacts;
+            control = AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+                singular_label = qtn_fdn_reading_memory;       
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                imagefile = AVKON_ICON_FILE;
+                imageid = EMbmAvkonQgn_note_copy;
+                imagemask = EMbmAvkonQgn_note_copy_mask;
+                };
+            }
+        };
+    }
 	
 // End of file
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp	Tue May 25 12:26:45 2010 +0300
@@ -29,7 +29,7 @@
 
 const TInt KMaxAdaptiveGridCacheCount = 10;
 const TInt KAdaptiveSearchKeyMapGranularity = 100;
-const TInt KAdaptiveSearchRefineStep = 10;
+const TInt KAdaptiveSearchRefineStep = 25;
 const TInt KContactFormattingFlags = MPbk2ContactNameFormatter::EPreserveLeadingSpaces |
             MPbk2ContactNameFormatter::EReplaceNonGraphicChars |
             MPbk2ContactNameFormatter::EDisableCompanyNameSeparator;
@@ -63,12 +63,12 @@
 			iKeyMap = aKeyMap.AllocL();
 			}
 
-		const TDesC& FindText() const
+		const TDesC& GetFindText() const
 			{
 			return *iFindText;
 			}
 
-		const TDesC& KeyMap() const
+		const TDesC& GetKeyMap() const
 			{
 			return *iKeyMap;
 			}
@@ -92,6 +92,7 @@
 CPbk2AdaptiveSearchGridFiller::~CPbk2AdaptiveSearchGridFiller()
     {
     Cancel();
+    delete iGridWaiter;
 	delete iKeyMap;
 	delete iCurrentGrid;
 	iAdaptiveGridCache.ResetAndDestroy();
@@ -124,6 +125,7 @@
     {
 	iKeyMap = HBufC::NewL( KAdaptiveSearchKeyMapGranularity );
 	iFindUtil = CFindUtil::NewL();
+	iGridWaiter = CPbk2AdaptiveSearchGridWaiter::NewL( *this );
     }
 
 void CPbk2AdaptiveSearchGridFiller::StartFilling( const MVPbkContactViewBase& aView, const TDesC& aSearchString )
@@ -132,7 +134,8 @@
 
 	if( keyMap )
 		{
-		iSearchField.SetAdaptiveGridChars( keyMap->KeyMap() );
+		iSearchField.SetAdaptiveGridChars( keyMap->GetKeyMap() );
+		iGridWaiter->Stop();
 		return;
 		}
 
@@ -143,7 +146,7 @@
 
 	// If there is no search word, the user is not searching any contacts
 	// so we should reset the array to prepare for the next searching.
-    if ( iSearchString->Length()== 0 )
+    if ( iSearchString->Length() == 0 )
     	{
     	iDigraphContactsTitleArray.ResetAndDestroy();
     	}
@@ -151,7 +154,6 @@
 
 	iKeyMap->Des().Zero();
 
-
 	iCounter = 0;
 
 	SetActive();
@@ -174,13 +176,16 @@
 
 	TInt stopCount = iCounter + KAdaptiveSearchRefineStep;
 	const TInt itemCount = iView->ContactCountL();
-	TInt maxSpacesNumber = 0;
-
 	if( stopCount > itemCount )
 		{
 		stopCount = itemCount;
 		}
 
+	TInt maxSpacesNumber = 0;
+
+    CDesC16Array* searchWordsArray = SplitSearchFieldTextIntoArrayLC( *iSearchString );
+    TInt searchStringSpacesNumber = searchWordsArray->MdcaCount() - 1;
+    
 	for( ; iCounter < stopCount; iCounter++ )
 		{
 		const MVPbkViewContact& contact = iView->ContactAtL( iCounter );
@@ -210,7 +215,7 @@
 		    }
 
         CleanupStack::PushL( title );
-		BuildGridL( *title, *iSearchString, iKeyMap );
+		BuildGridL( *title, searchWordsArray, iKeyMap );
 		
 		// check number of spaces in the contact title
 		TInt numberOfSpaces = NumberOfSpacesInString( *title );
@@ -227,7 +232,7 @@
 			}
 		else
 			{
-			CleanupStack::PopAndDestroy(); //title
+			CleanupStack::PopAndDestroy( title );
 			}
 		}
 	// If there are titles in array, we should add them to build grids again,
@@ -238,14 +243,15 @@
     	for( TInt i(0); i < iDigraphContactsTitleArray.Count() ; i++ )
     		{
     		TPtr ptrContactsTitle = iDigraphContactsTitleArray[i]->Des();
-        	BuildGridL( ptrContactsTitle, *iSearchString, iKeyMap );
+        	BuildGridL( ptrContactsTitle, searchWordsArray, iKeyMap );
     		}
 		}
 
+    CleanupStack::PopAndDestroy( searchWordsArray ); //searchWordsArray
 
 	if( stopCount == itemCount )
 		{
-		SetAdaptiveGridCharsL( maxSpacesNumber );
+		SetAdaptiveGridCharsL( maxSpacesNumber, searchStringSpacesNumber );
 		AddKeyMapToCacheL( *iSearchString, *iKeyMap );
 		}
 	else
@@ -274,7 +280,8 @@
 
 	for( TInt i( 0 ); i < count; i++ )
 		{
-		if( !aFindText.Compare( iAdaptiveGridCache[i]->FindText() ) )
+		if( iAdaptiveGridCache[i] != NULL
+		    && !aFindText.Compare( iAdaptiveGridCache[i]->GetFindText() ) )
 			{
 			return iAdaptiveGridCache[i];
 			}
@@ -285,17 +292,40 @@
 
 void CPbk2AdaptiveSearchGridFiller::AddKeyMapToCacheL( const TDesC& aFindText, const TDesC& aKeyMap )
 	{
-	CPbk2AdaptiveGrid* keyMap = new( ELeave )CPbk2AdaptiveGrid;
-	CleanupStack::PushL( keyMap );
-	keyMap->SetKeyMapL( aFindText, aKeyMap );
-	iAdaptiveGridCache.InsertL( keyMap, 0 );
-	CleanupStack::Pop();//keyMap
+    CPbk2AdaptiveGrid* keyMap = new( ELeave )CPbk2AdaptiveGrid;
+    CleanupStack::PushL( keyMap );
+    keyMap->SetKeyMapL( aFindText, aKeyMap );
+
+    // Keep always in the cache at position 0 the grid cache element for empty find box,
+    // which is the one that requires more time to be built
+    if ( aFindText.Length() == 0 )
+        {
+        if ( iAdaptiveGridCache.Count() > 0 )
+            {
+            delete iAdaptiveGridCache[0];
+            iAdaptiveGridCache.Remove( 0 );
+            }
 
-	if( iAdaptiveGridCache.Count() > KMaxAdaptiveGridCacheCount )
-		{
-		delete iAdaptiveGridCache[0];
-		iAdaptiveGridCache.Remove( 0 );
-		}
+        iAdaptiveGridCache.InsertL( keyMap, 0 );
+        }
+    else
+        {
+        if ( iAdaptiveGridCache.Count() == 0 )
+        {
+        iAdaptiveGridCache.InsertL( NULL, 0 );
+        }
+
+        iAdaptiveGridCache.InsertL( keyMap, 1 );
+    
+        // Delete oldest cache element
+        if( iAdaptiveGridCache.Count() > KMaxAdaptiveGridCacheCount )
+            {
+            delete iAdaptiveGridCache[KMaxAdaptiveGridCacheCount];
+            iAdaptiveGridCache.Remove( KMaxAdaptiveGridCacheCount );
+            }
+        }
+
+    CleanupStack::Pop(); //keyMap
 	}
 
 void CPbk2AdaptiveSearchGridFiller::ClearCache()
@@ -311,6 +341,7 @@
 void CPbk2AdaptiveSearchGridFiller::InvalidateAdaptiveSearchGrid()
 	{
 	iInvalidateAdaptiveSearchGrid = ETrue;
+	iGridWaiter->Start();
 	}
 
 void CPbk2AdaptiveSearchGridFiller::SetFocusToAdaptiveSearchGrid()
@@ -318,11 +349,12 @@
     iSetFocusToSearchGrid = ETrue;
     }
 
-void CPbk2AdaptiveSearchGridFiller::SetAdaptiveGridCharsL(  const TInt aMaxSpacesNumber )
+void CPbk2AdaptiveSearchGridFiller::SetAdaptiveGridCharsL(
+        const TInt aMaxSpacesNumber, const TInt aSearchStringSpacesNumber )
 	{
 	TPtr ptr = iKeyMap->Des();
 
-	//To do upper case for all characters
+	// Do upper case for all characters
 	ptr.UpperCase();
 	CDesCArray* array = new (ELeave) CDesCArrayFlat( KAdaptiveSearchKeyMapGranularity );
 	CleanupStack::PushL( array );
@@ -337,21 +369,17 @@
 	array->Sort( ECmpCollated );
 	ptr.Zero();
 
-    // Add space character only if user typed already some characters
-    // in the find pane and more spaces can be found in contacts than
-    // in the current search string.
-    TInt searchTextLength = iSearchField.TextLength();
-    HBufC* searchText = HBufC::NewL( searchTextLength );
-	TPtr ptrSearchText = searchText->Des();
-	iSearchField.GetSearchText( ptrSearchText );
-    if ( searchTextLength > 0 
-        && NumberOfSpacesInString( ptrSearchText ) < aMaxSpacesNumber  )
+    // Add space character only if:
+	// - user typed already some characters in the find pane,
+	// - and more spaces can be found in contacts than in the current search string,
+	// - and space is not the last character in the search string.
+    if ( iSearchString->Length() > 0 
+         && aMaxSpacesNumber > aSearchStringSpacesNumber
+         && (*iSearchString)[iSearchString->Length() - 1] != TChar( ' ' ) )
         {
         ptr.Append( TChar( ' ' ) );
         }
-    delete searchText;
-    searchText = NULL;
-    
+     
 	for( TInt ii = 0; ii < length; ii++ )
 	    {
 	    ptr.Append(array->MdcaPoint( ii ));
@@ -368,17 +396,22 @@
 				//if grid hasn't been invalidated, we do not need to set it again
 				return;
 				}
-
 			}
 		}
 
-	iInvalidateAdaptiveSearchGrid = EFalse;
-
 	delete iCurrentGrid;
 	iCurrentGrid = NULL;
 	iCurrentGrid = iKeyMap->Des().AllocL();
 
 	iSearchField.SetAdaptiveGridChars( *iKeyMap );
+	
+    if( iInvalidateAdaptiveSearchGrid )
+         {
+         iGridWaiter->Stop();
+         }
+    
+    iInvalidateAdaptiveSearchGrid = EFalse;
+    
 	if ( iSetFocusToSearchGrid )
 	    {
         // set the focus to findbox
@@ -392,120 +425,149 @@
 CDesC16Array* CPbk2AdaptiveSearchGridFiller::SplitContactFieldTextIntoArrayLC(
         const TDesC& aText )
     {
-    const TInt KGranularity = 2;
+    // Attempt to minimize the allocations considering 3 words for the search fields:
+    // FirstName, LastName, CompanyName.
+    const TInt KGranularity = 2; // Attempt to minimize the allocations
+
     CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( KGranularity );
     CleanupStack::PushL( array );
     const TInt textLength = aText.Length();
-    for ( TInt beg = 0; beg < textLength; ++beg )
+    for ( TInt beg = 0; beg < textLength; beg++ )
         {
         // Skip separators before next word
-        if ( !iNameFormatter.IsFindSeparatorChar( aText[beg] ) )
+        if ( iNameFormatter.IsFindSeparatorChar( aText[beg] ) )
             {
-            // Scan the end of the word
-            TInt end = beg;
-            for (; end < textLength &&
-                   !iNameFormatter.IsFindSeparatorChar( aText[end] );
-                ++end )
-                {
-                }
-            const TInt len = end - beg;
-            // Append found word to the array
-          	array->AppendL( aText.Mid( beg,len ) );
-            // Scan for next word
-            beg = end;
+            continue;
             }
+        
+        // Scan till the end of the word
+        TInt end;
+        for ( end = beg + 1;
+              end < textLength && !iNameFormatter.IsFindSeparatorChar( aText[end] );
+              ++end )
+            {
+            }
+
+        // Append found word to the array
+        array->AppendL( aText.Mid( beg, end - beg) );
+
+        // Scan for next word
+        beg = end;
         }
 
-    if ( array->MdcaCount() == 0 && textLength > 0 )
-        {
-        // aText is all word separator characters
-        // -> make a "word" out of those
-        array->AppendL( aText );
-        }
     return array;
     }
 
-
-
-void CPbk2AdaptiveSearchGridFiller::BuildGridL( const TDesC& aContactTitle, const TDesC& aSearchString, HBufC*& aKeyMap )
-	{
-	CDesC16Array* contactTitles = SplitContactFieldTextIntoArrayLC( aContactTitle );
-	CDesC16Array* searchWords = SplitContactFieldTextIntoArrayLC( aSearchString );
+CDesC16Array* CPbk2AdaptiveSearchGridFiller::SplitSearchFieldTextIntoArrayLC(
+        const TDesC& aText )
+    {
+    CDesC16Array* searchWordsArray = SplitContactFieldTextIntoArrayLC( aText );
 
-	//in searchWords list, the last term is the only one which generates new keymap characters
-	//other ones are used only for matching
+    // In searchWordsArray, the last word is the only one which generates new keymap characters
+    // for the grid; the other words are used only for matching the contact words.
+    //
+    // KNullDesC fake word as last word in search string will match all contact words so that all
+    // initials of contact words will be put into the grid.
+    // We do this in case the search string is empty or the last character is a space separator.
+    
+    if( searchWordsArray->MdcaCount() == 0 ||
+        ( aText.Length() > 0 && aText[aText.Length() - 1] == TChar(' ') ) )
+        {
+        searchWordsArray->AppendL( KNullDesC );
+        }
 
-	if( searchWords->MdcaCount() == 0 )
-		{
-		searchWords->AppendL( KNullDesC );
-		}
+    return searchWordsArray;
+    }
 
-	if( aSearchString.Length() > 0 )
-		{
-		if( aSearchString[ aSearchString.Length() - 1 ] == TChar( ' ' ) )
-			{
-			//because we now start new search term, we must add KNullDesC so we
-			//can find the matching new words
-			searchWords->AppendL( KNullDesC );
-			}
-		}
+void CPbk2AdaptiveSearchGridFiller::BuildGridL( const TDesC& aContactString, const CDesC16Array* aSearchWords, HBufC*& aKeyMap )
+	{
+    CDesC16Array* contactWords = SplitContactFieldTextIntoArrayLC( aContactString );
+	
+    const TInt contactWordCount = contactWords->MdcaCount();
+	const TInt searchWordCount = aSearchWords->MdcaCount();
 
+    TPtrC searchWord;
+    TPtrC contactWord;
 
-	const TInt searchWordCount = searchWords->MdcaCount();
+    // Try to make as fast algorithm as possible if there is only one search word,
+    // which is the most common case    
+    if ( searchWordCount == 1 )
+        {
+        searchWord.Set( aSearchWords->MdcaPoint( 0 ) ); // Search word
 
-	TBool contactMatch( searchWordCount == 1 );
-
-	for( TInt i( 0 ); i < searchWordCount; i++ )
-		{
-		TInt contactTitleCount = contactTitles->MdcaCount();
-
-		TBool contactTitleMatch( EFalse );
-
-		for( TInt j( 0 ); j < contactTitleCount; j++ )
-			{
-			TPtrC searchWord = searchWords->MdcaPoint( i );
-			TPtrC contactTitle = contactTitles->MdcaPoint( j );
+        for( TInt j = 0; j < contactWordCount; j++ )
+            {
+            contactWord.Set( contactWords->MdcaPoint( j ) );
+    
+            iFindUtil->Interface()->MatchAdaptiveRefineL( contactWord, searchWord, aKeyMap );
+            }
+        }
+    
+    // The clients of this method will provide at least one search word, so 0 is unexpected
+    else if ( searchWordCount > 1 )
+        {
+        RArray<TBool> contactWordsMatchedArray;
+        contactWordsMatchedArray.ReserveL( contactWordCount );
+        for ( TInt i = 0; i < contactWordCount; ++i )
+            {
+            contactWordsMatchedArray.AppendL( EFalse );
+            }
 
-			const TBool lastSearchWord = ( i == searchWordCount - 1 );
+        TBool matched = ETrue;
 
-			TBool match( EFalse );
+        // Scan search words except for the last one
+        for ( TInt i = 0; matched && i < searchWordCount - 1; i++ )
+            {
+            searchWord.Set( aSearchWords->MdcaPoint( i ) );
 
-			if( lastSearchWord )
-				{
-				if( !contactMatch )
-					{
-					//none of the previous words didin't match, so why this is not filtered?
-					//marked contact!?
-					}
-				else
-					{
-					match = iFindUtil->Interface()->MatchAdaptiveRefineL( contactTitle, searchWord, aKeyMap );
-					}
-				}
-			else
-				{
-				match = iFindUtil->Interface()->MatchRefineL( contactTitle, searchWord );
-				}
+            matched = EFalse; // Search word not matched yet
+            
+            // Check if the search word is matched in the contact
+            for( TInt j = 0; !matched && j < contactWordCount; j++ )
+                {
+                contactWord.Set( contactWords->MdcaPoint( j ) );
+    
+                // Partially or fully matched
+                if ( iFindUtil->Interface()->MatchRefineL( contactWord, searchWord ) )
+                    {
+                    // Allow one search word to match only one contact word.
+                    // This could be done better if both search and grid creation would
+                    // work in the same way for contacts matching...
+                    // Example: Contact: "Dim Din Dit"
+                    //          Search:  "DIN DI"
+                    //          - DIN is matched fully
+                    //          - DI is matched partially and assigned to "Dim"
+                    //          - The grid will show "_T" instead of "_MT"
+                    contactWordsMatchedArray[j] = ETrue;    
+                    matched = ETrue;
+                    }
+                }
+            }
 
-			if( match )
-				{
-
-				if( !contactTitleMatch )
-					{
-					contactTitles->Delete( j );
-					//allow one search word to take away only one contactTitle
-					contactTitleMatch = ETrue;
-					//for loop must go from first contact title to last
-					//to be consistent with match functionality of VPbk.
-					j--; contactTitleCount--;
-					}
-				contactMatch = ETrue;
-				}
-			}
-
-		}
-
-	CleanupStack::PopAndDestroy( 2 );//contactTitle, searchWords
+        // If all search words before the last one matched (fully or partially),
+        // add characters to the grid using last search word.
+        if ( matched )
+            {
+            searchWord.Set( aSearchWords->MdcaPoint( searchWordCount - 1 ) ); // Last search word
+    
+            for( TInt j = 0; j < contactWordCount; j++ )
+                {
+                // skip Contact words matched by previous search words
+                if (contactWordsMatchedArray[j])
+                    {
+                    continue;
+                    }
+    
+                contactWord.Set( contactWords->MdcaPoint( j ) );
+    
+                iFindUtil->Interface()->MatchAdaptiveRefineL( contactWord, searchWord, aKeyMap );
+                }
+            }
+    
+        contactWordsMatchedArray.Close();
+        }
+        
+	CleanupStack::PopAndDestroy( contactWords );
 	}
 
 TInt CPbk2AdaptiveSearchGridFiller::NumberOfSpacesInString(
@@ -545,4 +607,21 @@
 		}
 	return isDigraphic;
 	}
+
+void CPbk2AdaptiveSearchGridFiller::GridDelayCompleteL()
+    {
+    // simulating pointer event to hide adaptive grid
+    TPointerEvent pointerEvent;
+    pointerEvent.iType = TPointerEvent::EButton1Down;
+    TPoint position = iSearchField.Rect().iTl;
+    position.iX += 1;
+    position.iY += 1;
+    pointerEvent.iPosition = position;
+    iSearchField.HandlePointerEventL( pointerEvent );
+    }
+
+void CPbk2AdaptiveSearchGridFiller::WaitNoteDismissed()
+    {
+    iSearchField.ShowAdaptiveSearchGrid();
+    }
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp	Tue May 25 12:26:45 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:  Phonebook2 Adaptive Search Grid
+*               helper class
+*/
+
+//  INCLUDES
+#include <Pbk2ProcessDecoratorFactory.h>
+#include <Pbk2UIControls.rsg>
+#include <AknWaitDialog.h>
+#include "CPbk2AdaptiveSearchGridWaiter.h"
+
+const TInt KDelay = 500000; // 0.5 seconds
+
+CPbk2AdaptiveSearchGridWaiter* CPbk2AdaptiveSearchGridWaiter::NewL
+        ( MPbk2SearchGridWaiterObserver& aObserver )
+    {
+    CPbk2AdaptiveSearchGridWaiter* self = 
+        new ( ELeave ) CPbk2AdaptiveSearchGridWaiter( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CPbk2AdaptiveSearchGridWaiter::~CPbk2AdaptiveSearchGridWaiter()
+    {
+    Cancel();
+    delete iWaitNote;
+    iWaitNote = NULL;
+    }
+
+CPbk2AdaptiveSearchGridWaiter::CPbk2AdaptiveSearchGridWaiter
+        ( MPbk2SearchGridWaiterObserver& aObserver )
+        : CTimer( CActive::EPriorityStandard ), iObserver( aObserver )
+    {
+    
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    CTimer::ConstructL();
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::Stop()
+    {
+    Cancel();
+    DismissWaitNote();
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::Start()
+    {
+    if ( !IsActive() )
+        {
+        Stop();
+        After( TTimeIntervalMicroSeconds32( KDelay ) );
+        }
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::RunL()
+    {
+    if( !iStarted && iWaitNote == NULL )
+        { 
+        iObserver.GridDelayCompleteL();
+        
+        iWaitNote = new(ELeave) 
+            CAknWaitDialog(reinterpret_cast<CEikDialog**>( &iWaitNote ), ETrue );
+        iWaitNote->SetCallback( this );
+        iWaitNote->ExecuteLD( R_QTN_GEN_NOTE_CHECKING_PROGRESS );
+        iStarted = ETrue;
+        }
+    }
+
+TInt CPbk2AdaptiveSearchGridWaiter::RunError( TInt /*aError*/ )
+    {
+    iStarted = EFalse;
+    DismissWaitNote();
+    return KErrNone;
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::DialogDismissedL( TInt /*aButtonId*/ )
+    {
+    iStarted = EFalse;
+    iObserver.WaitNoteDismissed();
+    }
+
+void CPbk2AdaptiveSearchGridWaiter::DismissWaitNote()
+    {
+    if ( iWaitNote )
+        {
+        TRAPD( err, iWaitNote->ProcessFinishedL() );
+        if ( err != KErrNone )
+            {
+            delete iWaitNote;
+            iWaitNote = NULL;
+            }
+        }
+    }
+// End of File
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2AddItemToContactDlg.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AddItemToContactDlg.cpp	Tue May 25 12:26:45 2010 +0300
@@ -393,17 +393,6 @@
     iListBox->Model()->SetItemTextArray(listBoxModel);
     iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
     
-    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
-    if (statusPane)
-        {
-        TInt currentStatusPaneResId = statusPane->CurrentLayoutResId();
-        // Make the statusPane update when it was already set to EMPTY status,
-        // in other case it'll update itself automaticlly
-        if( currentStatusPaneResId == R_AVKON_STATUS_PANE_LAYOUT_EMPTY )
-            {
-            statusPane->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
-            }
-        }    
     }
 
 // --------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue May 25 12:26:45 2010 +0300
@@ -221,18 +221,8 @@
         iEikonEnv->EikAppUi()->RemoveFromStack( iContextMenuBar );
         delete iContextMenuBar;
         }
-
-    // Restore the titlepane text
-    if (iTitlePane && iStoredTitlePaneText)
-        {
-        iTitlePane->SetTextL(*iStoredTitlePaneText);
-        }
-
-    // Reset title pane picture
-    if( iTitlePane )
-        {
-        iTitlePane->SetSmallPicture( NULL, NULL, EFalse );
-        }
+    
+    TRAP_IGNORE ( RestoreStatusPaneL() );    
 
     // Remove empty status pane
     if (iNaviContainer)
@@ -395,16 +385,6 @@
 //
 void CPbk2ContactEditorDlgImpl::ExecuteLD()
     {
-    CleanupStack::PushL( this );
-
-    // Set status pane layout to the Phonebook 2 one
-    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
-    if (statusPane)
-        {
-        statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
-        }
-
-    CleanupStack::Pop( this );
     CAknForm::ExecuteLD(R_PBK2_EDIT_MEMORY_ENTRY_DIALOG);
     }
 
@@ -521,11 +501,11 @@
         CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
         if ( statusPane )
             {
-            TRAP_IGNORE(
-                    statusPane->SwitchLayoutL(
-                            R_AVKON_STATUS_PANE_LAYOUT_USUAL
-                            )
-            );
+            iCurrentstatuspane = statusPane->CurrentLayoutResId();
+            if( iCurrentstatuspane != R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+                {
+                TRAP_IGNORE( statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL) );
+                }
             }
         }
     
@@ -801,6 +781,8 @@
     iEditorExtension->ModifyButtonGroupContainerL(ButtonGroupContainer());
 
     ConstructNaviPaneL();
+	UpdateTitleL();
+    UpdateTitlePictureL();
     }
 
 // --------------------------------------------------------------------------
@@ -809,8 +791,7 @@
 //
 void CPbk2ContactEditorDlgImpl::PostLayoutDynInitL()
     {
-    UpdateTitleL();
-    UpdateTitlePictureL();
+    
     if(iParams.iFocusedContactField)
         {
         const TInt count = iUiFieldArray->Count();
@@ -2576,6 +2557,17 @@
 				}
         	}
         }
+    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
+    
+    if (statusPane)
+        {
+        iCurrentstatuspane = statusPane->CurrentLayoutResId();
+        if( iCurrentstatuspane != R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+            {
+            statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+            }
+        }
+        
     }
 
 // --------------------------------------------------------------------------
@@ -3465,5 +3457,34 @@
         }
     }
 
+// --------------------------------------------------------------------------
+// CPbk2ContactEditorDlgImpl::RestoreStatusPaneL
+// --------------------------------------------------------------------------
+//
+void CPbk2ContactEditorDlgImpl::RestoreStatusPaneL() 
+    {    
+    //Restore StatusPane & Title    
+    if ( iCurrentstatuspane )
+        {
+        CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
+        
+        if (statusPane)
+            {
+            statusPane->SwitchLayoutL( iCurrentstatuspane );            
+            }            
+        }
+    // Restore the titlepane text
+    if (iTitlePane && iStoredTitlePaneText)
+        {    
+        iTitlePane->SetTextL(*iStoredTitlePaneText);
+        }
+    
+    // Reset title pane picture
+    if( iTitlePane )
+        {
+        iTitlePane->SetSmallPicture( NULL, NULL, EFalse );
+        }        
+    }
+   
 
 // End of File
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp	Tue May 25 12:26:45 2010 +0300
@@ -167,23 +167,7 @@
         {
         iControl->SetAknEditorNumericKeymap(EAknEditorStandardNumberModeKeymap);
         iControl->SetAknEditorInputMode(EAknEditorNumericInputMode);
-
-        TInt inputLang = User::Language();
-        switch (inputLang)
-        {
-        case ELangArabic:
-        case ELangFarsi:
-        case ELangHindi:
-        case ELangUrdu:
-            iControl->SetAknEditorAllowedInputModes(
-                        EAknEditorNumericInputMode | EAknEditorHalfWidthTextInputMode );
-            break;
-
-        default:
-            iControl->SetAknEditorAllowedInputModes(EAknEditorNumericInputMode);
-            break;
-        }
-        
+        iControl->SetAknEditorAllowedInputModes(EAknEditorNumericInputMode);
         iControl->SetAknEditorSpecialCharacterTable(0);
         }
 
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorRingtoneField.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorRingtoneField.cpp	Tue May 25 12:26:45 2010 +0300
@@ -237,7 +237,8 @@
     if(aCommand == EPbk2CmdEditorHandleCustomSelect)
         {
 #ifdef ECE_DISABLE_CONTEXT_MENU
-        if (ContactField().FieldData().IsEmpty())
+        if (ContactField().FieldData().IsEmpty() 
+              || !Pbk2RingtoneCommands::IsRingtoneFieldValidL(ContactField()) )
             {
             ret = ext->HandleCustomFieldCommandL(EPbk2CmdEditorChangeRingtone);
             }
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp	Tue May 25 12:26:45 2010 +0300
@@ -1611,23 +1611,6 @@
         {
         ret |= KPbk2ListContainsNoMarkedItems;
         }
-
-    TInt focusIndex = iListBox.CurrentItemIndex();
-    // Non-contact items are not expandable.
-    const TInt commandItemCount = CommandItemCount();
-    if ( focusIndex < commandItemCount )
-        {
-        // It is not a contact.
-        focusIndex = KErrNotFound;
-        }
-
-    // There is an offset between view indexes and listbox indexes.
-    if (focusIndex >= 0 &&
-        iViewStack.ContactAtL(focusIndex - commandItemCount).Expandable())
-        {
-        ret |= KPbk2FocusedItemIsExpandable;
-        }
-
     return ret;
     }
 
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp	Tue May 25 12:26:45 2010 +0300
@@ -432,6 +432,7 @@
             item->SetIconArrayIndexAndId( iDefaultIconIndex,iDefaultIconId );
             item->SetHasThumbnail( ETrue );
             iContactThumbnails[ aListboxIndex ] = item;
+            iIsCacheClean = EFalse;
 		    }
 		
         // if item has a thumbnail image, but it is not loaded yet ( queue )
@@ -610,7 +611,7 @@
         iView->AddObserverL( *this );
         iView->AddStackObserverL( *this );
         }
-    Reset();
+    FlushCache();
     }
 
 // --------------------------------------------------------------------------
@@ -920,7 +921,7 @@
 			iPriorityArray.Remove( 0 );
 			
 			//remove icon from Pbk2IconArray
-			if( iIconArray )
+			if( iIconArray && rem->GetIconArrayIndex() != iDefaultIconIndex )
 				{
 				iIconArray->RemoveIcon( rem->GetIconId() );
 				}
@@ -1025,50 +1026,9 @@
 // --------------------------------------------------------------------------
 //
 void CPbk2ThumbnailManager::DoContactViewReadyL( MVPbkContactViewBase& aView )
-    {   
-    // get contact count
-    const TInt thumbnailCount = iContactThumbnails.Count();
-    if( thumbnailCount == 0 )
-        {
-        PreCreateThumbnailArrayL( aView );
-        }
-    else
-        {
-        // Check if view count has changed
-        if ( aView.ContactCountL() != thumbnailCount )
-            {
-            if( iLoadingQueue.Count() > 0 )
-                {
-                // store item that is currently in processing
-                iInProgressItemToBeRemoved = iLoadingQueue[0];
-                }
-
-            for ( TInt i = thumbnailCount - 1; i >= 0; --i )
-                {
-                CPbk2TmItem* item = iContactThumbnails[i];
-                if ( item )
-                    {
-                    // check that the icon is not a default icon
-                    if( iIconArray && item->GetIconArrayIndex() != iDefaultIconIndex )
-                        {
-                        // inform icon array to remove the icon
-                        iIconArray->RemoveIcon( item->GetIconId() );
-                        }
-
-                    if ( iInProgressItemToBeRemoved == item )
-                        {
-                        // prevent item from being deleted later
-                        iContactThumbnails[i] = NULL;
-                        }
-                    }
-                }
-            
-            // reset and recreate arrays
-            iLoadingQueue.Reset();
-            iPriorityArray.Reset();
-            PreCreateThumbnailArrayL( aView );
-            }
-        }  
+    {
+    FlushCache();
+    PreCreateThumbnailArrayL( aView );
     }
 
 // --------------------------------------------------------------------------
@@ -1086,6 +1046,45 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::FlushCache
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::FlushCache()
+    {
+    // reset operations
+    delete iRetrieveOperation;
+    iRetrieveOperation = NULL;
+    delete iThumbOperation;
+    iThumbOperation = NULL;
+    iState = EIdle;
+
+    if( !iIsCacheClean ) // prevent unnecessary work if cache is already cleaned
+        {
+        iIsCacheClean = ETrue;
+        const TInt count = iContactThumbnails.Count();
+        for ( TInt i = count - 1; i >= 0; --i )
+            {
+            CPbk2TmItem* item = iContactThumbnails[i];
+            if ( item )
+                {
+                // check that the icon is not a default icon
+                if( iIconArray && item->GetIconArrayIndex() != iDefaultIconIndex )
+                    {
+                    iIconArray->RemoveIcon( item->GetIconId() );
+                    }
+        
+                delete item;
+                iContactThumbnails[i] = NULL;
+                }
+            }
+        }
+    
+    // reset loading queue and cache priority
+    iLoadingQueue.Reset();
+    iPriorityArray.Reset();
+    }
+
+// --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::ContactViewUnavailable
 // --------------------------------------------------------------------------
 //
@@ -1102,22 +1101,12 @@
 void CPbk2ThumbnailManager::ContactAddedToView(
     MVPbkContactViewBase& /*aView*/, 
     TInt aIndex, 
-    const MVPbkContactLink& aContactLink )
+    const MVPbkContactLink& /*aContactLink*/ )
     {
-    CPbk2TmItem* item = NULL;
-    TRAPD( err,
-        {
-        item = CPbk2TmItem::NewL( aContactLink.CloneLC(), aIndex );
-        CleanupStack::Pop();
-        });
-    if( KErrNone == err )
-        {
-        // set default icon index
-        item->SetIconArrayIndexAndId( iDefaultIconIndex, iDefaultIconId );
-        item->SetHasThumbnail( ETrue );
-        iContactThumbnails.Insert( item, aIndex );
-        }
-    ResetIndexes();
+    // Because contact events and contact view are not always in sync we need to
+    // flush the whole cache. 
+    FlushCache();
+    iContactThumbnails.Insert( NULL, aIndex );
     }
 
 // --------------------------------------------------------------------------
@@ -1127,9 +1116,12 @@
 void CPbk2ThumbnailManager::ContactRemovedFromView(
     MVPbkContactViewBase& /*aView*/, 
     TInt aIndex, 
-    const MVPbkContactLink& aContactLink )
+    const MVPbkContactLink& /*aContactLink*/ )
     {
-    RemoveThumbnail( aContactLink, aIndex );
+    // Because contact events and contact view are not always in sync we need to
+    // flush the whole cache. 
+    FlushCache();
+    iContactThumbnails.Remove( aIndex );
     }
 
 // --------------------------------------------------------------------------
@@ -1150,7 +1142,7 @@
 //
 void CPbk2ThumbnailManager::TopViewChangedL( MVPbkContactViewBase& /*aOldView*/ )
     {
-    Reset();
+    FlushCache();
     if( iView )
         {
         PreCreateThumbnailArrayL( *iView );
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp	Tue May 25 12:26:45 2010 +0300
@@ -35,7 +35,7 @@
 #include <layoutmetadata.cdl.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <aknphysics.h>
-#include <akniconarray.h>
+#include <AknIconArray.h>
 #include <avkon.mbg>
 
 
--- a/phonebookui/Phonebook2/UIPolicy/inc/CPbk2ContactDuplicatePolicy.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIPolicy/inc/CPbk2ContactDuplicatePolicy.h	Tue May 25 12:26:45 2010 +0300
@@ -69,6 +69,14 @@
         void ConstructL(
                 const MVPbkFieldTypeList* aFieldTypeForFind );
 
+        /**
+         * Creates field type list for find.
+         *
+         * @param aContactManager  Virtual Phonebook Contact Manager.
+         * @return  A field type list.
+         */
+        MVPbkFieldTypeList* CreateFieldTypesForFindL
+                (CVPbkContactManager& aContactManager) const;
     private: // Data
         /// Ref: Contact manager
         CVPbkContactManager& iContactManager;
@@ -80,6 +88,8 @@
         CPbk2DuplicateContactFinder* iDuplicateFinder;
         /// Own: Duplicate contacts
         RPointerArray<MVPbkStoreContact> iDuplicates;
+        /// Own: These are the field types that are used for find
+        MVPbkFieldTypeList* iFieldTypeRefsList;
     };
 
 #endif // CPBK2CONTACTDUPLICATEPOLICY_H
--- a/phonebookui/Phonebook2/UIPolicy/rss/Pbk2UIPolicy.rss	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIPolicy/rss/Pbk2UIPolicy.rss	Tue May 25 12:26:45 2010 +0300
@@ -118,7 +118,7 @@
                     version_no = 1;
                     display_name = "AllContacts";
                     default_data = "";
-                    opaque_data = "48";
+                    opaque_data = "304";
                     }
                 };
             }
--- a/phonebookui/Phonebook2/UIPolicy/src/CPbk2ContactDuplicatePolicy.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/UIPolicy/src/CPbk2ContactDuplicatePolicy.cpp	Tue May 25 12:26:45 2010 +0300
@@ -24,6 +24,13 @@
 #include <MPbk2ContactNameFormatter.h>
 #include <CPbk2DuplicateContactFinder.h>
 #include <MPbk2DuplicateContactObserver.h>
+#include <RPbk2LocalizedResourceFile.h>
+#include "Pbk2DataCaging.hrh"
+#include "Pbk2PresentationUtils.h"
+#include <Pbk2Presentation.rsg>
+#include <CVPbkFieldTypeSelector.h>
+#include <CVPbkFieldTypeIterator.h>
+#include <CVPbkFieldTypeRefsList.h>
 
 // Virtual Phonebook
 #include <CVPbkContactManager.h>
@@ -31,6 +38,10 @@
 #include <CVPbkContactLinkArray.h>
 #include <MVPbkStoreContact.h>
 
+// System includes
+#include <barsread.h>
+
+
 /// Unnamed namespace for local definitions
 namespace {
 
@@ -222,6 +233,7 @@
     delete iDuplicateFinder;
     delete iNameFormatter;
     delete iSortOrderManager;
+    delete iFieldTypeRefsList;
     }
 
 // --------------------------------------------------------------------------
@@ -252,11 +264,11 @@
         iContactManager.FieldTypes(), *iSortOrderManager,
         &iContactManager.FsSession() );
 
-    const MVPbkFieldTypeList* fieldTypesForFind =
-        &iSortOrderManager->SortOrder();
-    if ( aFieldTypeForFind )
+    const MVPbkFieldTypeList* fieldTypesForFind = aFieldTypeForFind;
+    if ( !fieldTypesForFind )
         {
-        fieldTypesForFind = aFieldTypeForFind;
+        iFieldTypeRefsList = CreateFieldTypesForFindL(iContactManager);
+        fieldTypesForFind = iFieldTypeRefsList;
         }
     iDuplicateFinder = CPbk2DuplicateContactFinder::NewL( iContactManager,
         *iNameFormatter, *fieldTypesForFind, iDuplicates );
@@ -279,4 +291,57 @@
         aMaxDuplicatesToFind );
     }
 
+// --------------------------------------------------------------------------
+// CPbk2ContactDuplicatePolicy::CreateFieldTypesForFindL
+// --------------------------------------------------------------------------
+//
+MVPbkFieldTypeList* CPbk2ContactDuplicatePolicy::CreateFieldTypesForFindL
+        (CVPbkContactManager& aContactManager) const
+    {
+    RFs fs = aContactManager.FsSession();
+    RPbk2LocalizedResourceFile resFile(&fs);
+    resFile.OpenLC(KPbk2RomFileDrive, 
+        KDC_RESOURCE_FILES_DIR, 
+        Pbk2PresentationUtils::PresentationResourceFile());
+
+    // Create resource reader.
+    TResourceReader resReader;
+    resReader.SetBuffer(resFile.AllocReadLC(R_TITLE_FIELD_SELECTOR));
+
+    // Create title field selector.
+    CVPbkFieldTypeSelector* titleFieldSelector = CVPbkFieldTypeSelector::NewL
+        (resReader, aContactManager.FieldTypes());
+    CleanupStack::PushL(titleFieldSelector);
+    
+    // Create field type list for find.
+    CVPbkFieldTypeRefsList* fieldTypeRefsList = CVPbkFieldTypeRefsList::NewL();
+    CleanupStack::PushL(fieldTypeRefsList);
+    const MVPbkFieldType* fieldType = NULL;
+
+    // Create field type iterator.
+    CVPbkFieldTypeIterator* fieldTypeIterator =
+        CVPbkFieldTypeIterator::NewLC(*titleFieldSelector, 
+            aContactManager.FieldTypes());
+    while(fieldTypeIterator->HasNext())
+        {
+        fieldType = fieldTypeIterator->Next();
+        if (fieldType)
+            {
+            // Filter the Versit type for find.
+            if (EVPbkNonVersitTypeNone == fieldType->NonVersitType())
+                {
+                fieldTypeRefsList->AppendL(*fieldType);
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy();  // fieldTypeIterator
+    CleanupStack::Pop(fieldTypeRefsList);
+    CleanupStack::PopAndDestroy();  // titleFieldSelector
+    CleanupStack::PopAndDestroy();  // resReader
+    CleanupStack::PopAndDestroy();  // resFile
+
+    return fieldTypeRefsList;
+    }
+
 // End of File
--- a/phonebookui/Phonebook2/USIMExtension/src/CPsu2NameListViewBase.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/USIMExtension/src/CPsu2NameListViewBase.cpp	Tue May 25 12:26:45 2010 +0300
@@ -38,11 +38,12 @@
 #include <MPbk2ContactNameFormatter.h>
 #include <MPbk2PointerEventInspector.h>
 #include <MPbk2ApplicationServices.h>
-
+#include <Pbk2MenuFilteringFlags.hrh>
 
 // Virtual Phonebook
 #include <MVPbkContactViewBase.h>
 #include <CVPbkContactManager.h>
+#include <MVPbkViewContact.h>
 
 // System includes
 #include <avkon.rsg>
@@ -270,6 +271,11 @@
     if ( iControl )
         {
         flags = iControl->GetMenuFilteringFlagsL();
+        const MVPbkViewContact* contact = iControl->FocusedViewContactL();
+        if( contact && contact->Expandable() )
+            {
+            flags |= KPbk2FocusedItemIsExpandable;
+            }
         }
         
     return flags;
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss	Tue May 25 12:26:45 2010 +0300
@@ -265,4 +265,5 @@
 RESOURCE TBUF r_qtn_phob_commlauncher_onelinepreview      { buf = qtn_phob_commlauncher_onelinepreview; }
 RESOURCE TBUF r_qtn_cca_voip_call_with_servicename { buf = qtn_cca_voip_call_single_service; }
 RESOURCE TBUF r_qtn_cca_ftu_discover               { buf = qtn_cca_ftu_discover; }
+RESOURCE TBUF r_qtn_cca_error_note_maps_not_found  { buf = qtn_cca_error_note_maps_not_found; }
 //End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontacthandler.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontacthandler.h	Tue May 25 12:26:45 2010 +0300
@@ -468,6 +468,12 @@
      * Not own.
      */
     CCCAppCommLauncherPlugin& iPlugin;
+    
+    /**
+     * Address amount cache
+     * Own
+     */
+    RHashMap<TInt, TInt> iAddressCache;
     };
 
 #endif // C_CCAPPCOMMLAUNCHERCONTACTHANDLER_H
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Tue May 25 12:26:45 2010 +0300
@@ -285,14 +285,6 @@
         TDes& aText );
 
     /**
-     * Draws find/show on map button
-     *
-     * @param aNumberOfAddresses number of addresses
-     * @param aIndex communication method index 
-     */    
-    void AddressButtonL( const TInt aNumberOfAddresses, const TInt aIndex );
-
-    /**
      * Updates addresses button popup text
      *
      * @since S60 v5.0
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp	Tue May 25 12:26:45 2010 +0300
@@ -30,8 +30,9 @@
 #include <MVPbkContactLink.h>
 #include <MPbk2Command.h>
 #include <Pbk2MenuFilteringFlags.hrh>
-
 #include <coemain.h>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
 
 _LIT(KPbk2CommandsDllResFileName,   "Pbk2Commands.rsc");
 _LIT(KPbk2UiControlsDllResFileName, "Pbk2UiControls.rsc");
@@ -341,7 +342,19 @@
 //
 void CCCAppCommLauncherPbkCmd::HandleError( TInt aError )
     {
-    CCoeEnv::Static()->HandleError( aError );
+    if( KErrNotSupported == aError && 
+        (TPbk2CommandId)EPbk2ExtensionShowOnMap == iPbk2CommandId )
+        {
+        // Show maps specifix error note
+        HBufC* prompt = StringLoader::LoadLC( R_QTN_CCA_ERROR_NOTE_MAPS_NOT_FOUND );
+        CAknErrorNote* note = new ( ELeave ) CAknErrorNote( ETrue );
+        note->ExecuteLD( *prompt );
+        CleanupStack::PopAndDestroy( prompt );        
+        }
+    else
+        {
+        CCoeEnv::Static()->HandleError( aError );
+        }
     }
 // ---------------------------------------------------------------------------
 // CCCAppCommLauncherPbkCmd::StoreReady
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontacthandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontacthandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -66,6 +66,7 @@
         iCmsWrapper->Release();
         }
     iDynamicVoipAddressGroup.Close();
+    iAddressCache.Close();
     }
 
 // --------------------------------------------------------------------------
@@ -165,6 +166,7 @@
         == aParameter.iType )
         {
         iDynamicAddressGroupSet = EFalse;
+        iAddressCache.Close(); // reset cache on change
         iObserver.ContactsChangedL();
         }
     else if (MCCAppContactFieldDataObserver::TParameter::EContactPresenceChanged == aParameter.iType)
@@ -228,7 +230,14 @@
 TInt CCCAppCommLauncherContactHandler::AddressAmount( 
     VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction )
     {
-    return iCmsWrapper->GetContactActionFieldCount(aContactAction);
+    TInt* count = iAddressCache.Find( aContactAction );
+    if( !count )
+        {
+        TInt newcount = iCmsWrapper->GetContactActionFieldCount( aContactAction );
+        iAddressCache.Insert( aContactAction, newcount );
+        return newcount;
+        }
+    return *count;
     }
 
 // ---------------------------------------------------------------------------
@@ -549,6 +558,7 @@
     {
     iCmsWrapper->RefetchContactL();
     iCmsWrapper->AddObserverL( *this );
+    iAddressCache.Close();
     }
 
 // --------------------------------------------------------------------------
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Tue May 25 12:26:45 2010 +0300
@@ -457,7 +457,7 @@
             transApi->StopDrawing();
             }
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
-        if ( aDrawSeparator && 
+        if ( aDrawSeparator && control &&
             static_cast<CEikListBox*>( control )->ItemsInSingleLine() == 1 )
             {
             AknListUtils::DrawSeparator( *iGc, aItemTextRect, iTextColor );
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp	Tue May 25 12:26:45 2010 +0300
@@ -465,8 +465,8 @@
             //      saving memory includes local contact db (contacts.cdb) or if the contact belongs to
             //      local contact DB            
             if( cntStore != ECmsContactStoreSdn 
-                && ( IsPhoneMemoryInConfigurationL()
-                     || (cntStore != ECmsContactStoreSim) )
+                && IsPhoneMemoryInConfigurationL()
+                     && (cntStore != ECmsContactStoreSim)
                 && iImage->Rect().Contains(aPointerEvent.iPosition) )
                 {
                 // Show the feedback
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Tue May 25 12:26:45 2010 +0300
@@ -423,26 +423,16 @@
 
         if ( numberOfAddresses )
             {
-            TBool isServiceAvailable =
+            const TBool isServiceAvailable =
                 iContainer.Plugin().ContactHandler().IsServiceAvailable(
                     preferredCommMethods[i] );
-            if (isServiceAvailable)
+            if ( isServiceAvailable )
                 {
-                if ( preferredCommMethods[i] ==
-                        VPbkFieldTypeSelectorFactory::EFindOnMapSelector )
-                	{
-
-                	AddressButtonL( numberOfAddresses, i );
-
-                	}
-                else
-                	{
-                    TCommLauncherButtonData buttonData = 
-                        TCommLauncherButtonData( preferredCommMethods[i] );
-                    ButtonTextL(preferredCommMethods[i], buttonData.iText);
-                    buttonData.iNumberOfAddresses = numberOfAddresses;
-                    iButtonDataArray.AppendL( buttonData );
-                	}
+                TCommLauncherButtonData buttonData = 
+                    TCommLauncherButtonData( preferredCommMethods[i] );
+                ButtonTextL(preferredCommMethods[i], buttonData.iText);
+                buttonData.iNumberOfAddresses = numberOfAddresses;
+                iButtonDataArray.AppendL( buttonData );
                 }
             }
         }    
@@ -963,7 +953,7 @@
 void CCCAppCommLauncherLPadModel::Reset()
     {
     iButtonDataArray.Reset();
-    iButtonIconArray->Reset();
+    iButtonIconArray->ResetAndDestroy();
     }
 
 // ---------------------------------------------------------------------------
@@ -1042,32 +1032,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppCommLauncherLPadModel::AddressButtonL
-// ---------------------------------------------------------------------------
-//
-void CCCAppCommLauncherLPadModel::AddressButtonL(
-		const TInt aNumberOfAddresses, const TInt aIndex )
-    {
-    RArray<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>& 
-        preferredCommMethods = iContainer.Plugin().PreferredCommMethods();//not owned
-
-    RPointerArray<CMnProvider> providers;
-    CleanupClosePushL( providers );
-    MnProviderFinder::FindProvidersL( providers,
-        CMnProvider::EServiceMapView );
-    if (providers.Count() > 0)
-        {
-        TCommLauncherButtonData buttonData = 
-            TCommLauncherButtonData( preferredCommMethods[aIndex] );
-        ButtonTextL(preferredCommMethods[aIndex], buttonData.iText);
-        buttonData.iNumberOfAddresses = aNumberOfAddresses;
-        iButtonDataArray.AppendL( buttonData );
-        }
-    providers.ResetAndDestroy();
-    CleanupStack::PopAndDestroy( &providers );
-    }
-
-// ---------------------------------------------------------------------------
 // CCCAppCommLauncherLPadModel::UpdateAddressesValidationL
 // ---------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -260,11 +260,6 @@
     {
     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
     
-    // Used for checking whether some maps have been installed or not.
-    RPointerArray<CMnProvider> providers;
-    CleanupClosePushL( providers );
-    MnProviderFinder::FindProvidersL( providers, CMnProvider::EServiceMapView );
-    
     if ( !iPlugin.Container().CommMethodsAvailable() )
         {// no comm methods available
         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectCmd );
@@ -274,14 +269,12 @@
             aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
             }
         }
-    // If the count equals to 0, it means:
-    // No map is installed and there must be no adress item displayed in launcher view. 
-    else if ( providers.Count() > 0 )
+    else
     	{
         CCCAppCommLauncherContactHandler& contactHandler = iPlugin.ContactHandler();
         
         // Get the number how many addresses are defined.
-        TInt addressAmount = 
+        const TInt addressAmount = 
              contactHandler.AddressAmount( VPbkFieldTypeSelectorFactory::EFindOnMapSelector);
         
         // If the amount of address is not 0 and the amount of listbox in launcher view is 1.
@@ -292,9 +285,6 @@
         	aMenuPane->DeleteMenuItem( ECCAppCommLauncherDefaultsCmd );
         	}
     	}
-
-    providers.ResetAndDestroy();
-    CleanupStack::PopAndDestroy( &providers );
     
     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DynInitSelectMenuItemL()"));
     }
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorcalloperation.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorcalloperation.h	Tue May 25 12:26:45 2010 +0300
@@ -50,15 +50,17 @@
      * Two-phased constructor.
      * 
      * @param aParam The phone number to call.
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorCallOperation* NewL(const TDesC& aParam);
+    static CCCAContactorCallOperation* NewL(const TDesC& aParam, const TDesC8& aContactLinkArray);
 
     /**
      * Two-phased constructor.
      * 
      * @param aParam The phone number to call.
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorCallOperation* NewLC(const TDesC& aParam);
+    static CCCAContactorCallOperation* NewLC(const TDesC& aParam, const TDesC8& aContactLinkArray);
     
     /**
      * Executes the operation (makes the call)
@@ -71,13 +73,18 @@
      * Constructor for performing 1st stage construction
      * 
      * @param aParam The phone number to call.
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    CCCAContactorCallOperation(const TDesC& aParam);
+    CCCAContactorCallOperation(const TDesC& aParam, const TDesC8& aContactLinkArray);
 
     /**
      * EPOC default constructor for performing 2nd stage construction
      */
     void ConstructL();
+    
+    
+    //Doesnt Own : Streamed contact link array of contact
+    const TDesC8& iContactLinkArray;
 
     };
 
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvideocalloperation.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvideocalloperation.h	Tue May 25 12:26:45 2010 +0300
@@ -50,15 +50,19 @@
      * Two-phased constructor.
      * 
      * @param aParam The phone number to video call
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorVideocallOperation* NewL(const TDesC& aParam);
+    static CCCAContactorVideocallOperation* NewL(const TDesC& aParam,
+            const TDesC8& aContactLinkArray);
 
     /**
      * Two-phased constructor.
      * 
      * @param aParam The phone number to video call
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorVideocallOperation* NewLC(const TDesC& aParam);
+    static CCCAContactorVideocallOperation* NewLC(const TDesC& aParam,
+            const TDesC8& aContactLinkArray);
     
     /**
      * Executes the operation (makes the video call)
@@ -71,13 +75,17 @@
      * Constructor for performing 1st stage construction
      * 
      * @param aParam The phone number to video call
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    CCCAContactorVideocallOperation(const TDesC& aParam);
+    CCCAContactorVideocallOperation(const TDesC& aParam, const TDesC8& aContactLinkArray);
 
     /**
      * EPOC default constructor for performing 2nd stage construction
      */
     void ConstructL();
+    
+    //Doesnt Own : Streamed contact link array of contact
+    const TDesC8& iContactLinkArray;
 
     };
 
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvoipoperation.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccacontactorvoipoperation.h	Tue May 25 12:26:45 2010 +0300
@@ -51,16 +51,20 @@
      * 
      * @param aParam The address to make the voip call to
      * @param aServiceID The voip service ID
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorVOIPOperation* NewL(const TDesC& aParam, TUint32 aServiceID);
+    static CCCAContactorVOIPOperation* NewL(const TDesC& aParam, 
+            TUint32 aServiceID, const TDesC8& aContactLinkArray);
 
     /**
      * Two-phased constructor.
      * 
      * @param aParam The address to make the voip call to
      * @param aServiceID The voip service ID
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    static CCCAContactorVOIPOperation* NewLC(const TDesC& aParam, TUint32 aServiceID);
+    static CCCAContactorVOIPOperation* NewLC(const TDesC& aParam, 
+            TUint32 aServiceID, const TDesC8& aContactLinkArray);
     
     /**
      * Executes the operation (launches the voip call)
@@ -74,8 +78,10 @@
      * 
      * @param aParam The address to make the voip call to
      * @param aServiceID The voip service ID
+     * @param aContactLinkArray Streamed contact link array of contact to be communicated at
      */
-    CCCAContactorVOIPOperation(const TDesC& aParam, TUint32 aServiceID);
+    CCCAContactorVOIPOperation(const TDesC& aParam, 
+            TUint32 aServiceID, const TDesC8& aContactLinkArray);
 
     /**
      * EPOC default constructor for performing 2nd stage construction
@@ -86,6 +92,10 @@
      * The voip service id
      */
     TUint32 iServiceId;
+    
+    
+    //Doesnt Own : Streamed contact link array of contact
+    const TDesC8& iContactLinkArray;
 
     };
 
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccaphonecall.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/inc/ccaphonecall.h	Tue May 25 12:26:45 2010 +0300
@@ -48,11 +48,12 @@
 	 * Establish a call by using a phone number (or voip address)
 	 *
 	 * @param TDesC8& Phone number
+	 * @param aContactLinkArray Streamed contact link array of contact to be communicated at
 	 * @param aCallType Is this a cellular Voice, VoIP, or Video call
 	 *
 	 * @return void 
 	 */
-	static void ExecuteL( const TDesC& aPhoneNumber,
+	static void ExecuteL( const TDesC& aPhoneNumber,const TDesC8& aContactLinkArray,
 	        TCCAPhoneCallType aCallType = ECCACallTypeVoice, TUint32 aServiceId = 0);
 
 private:
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactor.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactor.cpp	Tue May 25 12:26:45 2010 +0300
@@ -32,12 +32,12 @@
     
     switch (aCommMethod)
         {
-        case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
-            operation = CCCAContactorCallOperation::NewL(aParam);
+        case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:              
+            operation = CCCAContactorCallOperation::NewL(aParam, aContactLinkArray);
             break;
             
         case VPbkFieldTypeSelectorFactory::EVideoCallSelector:
-            operation = CCCAContactorVideocallOperation::NewL(aParam);
+            operation = CCCAContactorVideocallOperation::NewL(aParam, aContactLinkArray);
             break;
         case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
             operation = CCCAContactorUniEditorOperation::NewL(aParam, aName);
@@ -49,7 +49,7 @@
             operation = CCCAContactorURLOperation::NewL(aParam);
             break;
         case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
-            operation = CCCAContactorVOIPOperation::NewL(aParam, aServiceId);
+            operation = CCCAContactorVOIPOperation::NewL(aParam, aServiceId, aContactLinkArray);
             break;
         case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector:
             MCmsContactorImPluginParameter* cmsParameter;
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorcalloperation.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorcalloperation.cpp	Tue May 25 12:26:45 2010 +0300
@@ -26,7 +26,8 @@
 // CCCAContactorCallOperation::CCCAContactorCallOperation()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorCallOperation::CCCAContactorCallOperation(const TDesC& aParam) : CCCAContactorOperation(aParam)
+CCCAContactorCallOperation::CCCAContactorCallOperation(const TDesC& aParam, const TDesC8& aContactLinkArray) : CCCAContactorOperation(aParam), 
+        iContactLinkArray(aContactLinkArray)
     {
     }
 
@@ -42,9 +43,9 @@
 // CCCAContactorCallOperation::NewLC()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorCallOperation* CCCAContactorCallOperation::NewLC(const TDesC& aParam)
+CCCAContactorCallOperation* CCCAContactorCallOperation::NewLC(const TDesC& aParam, const TDesC8& aContactLinkArray)
     {
-    CCCAContactorCallOperation* self = new (ELeave)CCCAContactorCallOperation(aParam);
+    CCCAContactorCallOperation* self = new (ELeave)CCCAContactorCallOperation(aParam, aContactLinkArray);
     CleanupStack::PushL(self);
     self->ConstructL();
     return self;
@@ -54,9 +55,9 @@
 // CCCAContactorCallOperation::NewL()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorCallOperation* CCCAContactorCallOperation::NewL(const TDesC& aParam)
+CCCAContactorCallOperation* CCCAContactorCallOperation::NewL(const TDesC& aParam, const TDesC8& aContactLinkArray)
     {
-    CCCAContactorCallOperation* self=CCCAContactorCallOperation::NewLC(aParam);
+    CCCAContactorCallOperation* self=CCCAContactorCallOperation::NewLC(aParam, aContactLinkArray);
     CleanupStack::Pop(); // self;
     return self;
     }
@@ -77,7 +78,7 @@
 void CCCAContactorCallOperation::ExecuteLD()
     {
     CleanupStack::PushL(this);
-    CCCAPhoneCall::ExecuteL(iParam, CCCAPhoneCall::ECCACallTypeVoice);
+    CCCAPhoneCall::ExecuteL(iParam, iContactLinkArray, CCCAPhoneCall::ECCACallTypeVoice);
     CleanupStack::PopAndDestroy(this);
     }
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvideocalloperation.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvideocalloperation.cpp	Tue May 25 12:26:45 2010 +0300
@@ -25,7 +25,10 @@
 // CCCAContactorVideocallOperation::CCCAContactorVideocallOperation()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVideocallOperation::CCCAContactorVideocallOperation(const TDesC& aParam) : CCCAContactorOperation(aParam)
+CCCAContactorVideocallOperation::CCCAContactorVideocallOperation(const TDesC& aParam,
+        const TDesC8& aContactLinkArray ) : 
+        CCCAContactorOperation(aParam),
+        iContactLinkArray(aContactLinkArray)
     {
     // No implementation required
     }
@@ -42,9 +45,11 @@
 // CCCAContactorVideocallOperation::NewLC()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVideocallOperation* CCCAContactorVideocallOperation::NewLC(const TDesC& aParam)
+CCCAContactorVideocallOperation* CCCAContactorVideocallOperation::NewLC(const TDesC& aParam, 
+                const TDesC8& aContactLinkArray)
     {
-    CCCAContactorVideocallOperation* self = new (ELeave)CCCAContactorVideocallOperation(aParam);
+    CCCAContactorVideocallOperation* self = new (ELeave)CCCAContactorVideocallOperation(
+                        aParam, aContactLinkArray);
     CleanupStack::PushL(self);
     self->ConstructL();
     return self;
@@ -54,10 +59,11 @@
 // CCCAContactorVideocallOperation::NewL()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVideocallOperation* CCCAContactorVideocallOperation::NewL(const TDesC& aParam)
+CCCAContactorVideocallOperation* CCCAContactorVideocallOperation::NewL(const TDesC& aParam, 
+        const TDesC8& aContactLinkArray)
     {
     CCCAContactorVideocallOperation* self=
-            CCCAContactorVideocallOperation::NewLC(aParam);
+            CCCAContactorVideocallOperation::NewLC(aParam, aContactLinkArray);
     CleanupStack::Pop(); // self;
     return self;
     }
@@ -78,7 +84,7 @@
 void CCCAContactorVideocallOperation::ExecuteLD()
     {
     CleanupStack::PushL(this);
-    CCCAPhoneCall::ExecuteL(iParam, CCCAPhoneCall::ECCACallTypeVideo);
+    CCCAPhoneCall::ExecuteL(iParam, iContactLinkArray, CCCAPhoneCall::ECCACallTypeVideo);
     CleanupStack::PopAndDestroy(this);
     }
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvoipoperation.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccacontactorvoipoperation.cpp	Tue May 25 12:26:45 2010 +0300
@@ -25,7 +25,10 @@
 // CCCAContactorVOIPOperation::CCCAContactorVOIPOperation()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVOIPOperation::CCCAContactorVOIPOperation(const TDesC& aParam, TUint32 aServiceId) : CCCAContactorOperation(aParam), iServiceId(aServiceId)
+CCCAContactorVOIPOperation::CCCAContactorVOIPOperation(const TDesC& aParam, 
+        TUint32 aServiceId, const TDesC8& aContactLinkArray) : 
+        CCCAContactorOperation(aParam), iServiceId(aServiceId),
+        iContactLinkArray(aContactLinkArray)
     {
     // No implementation required
     }
@@ -42,9 +45,11 @@
 // CCCAContactorVOIPOperation::NewLC()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVOIPOperation* CCCAContactorVOIPOperation::NewLC(const TDesC& aParam, TUint32 aServiceId)
+CCCAContactorVOIPOperation* CCCAContactorVOIPOperation::NewLC(const TDesC& aParam, 
+        TUint32 aServiceId, const TDesC8& aContactLinkArray)
     {
-    CCCAContactorVOIPOperation* self = new (ELeave)CCCAContactorVOIPOperation(aParam, aServiceId);
+    CCCAContactorVOIPOperation* self = new (ELeave)CCCAContactorVOIPOperation(
+            aParam, aServiceId, aContactLinkArray);
     CleanupStack::PushL(self);
     self->ConstructL();
     return self;
@@ -54,9 +59,11 @@
 // CCCAContactorVOIPOperation::NewL()
 // -----------------------------------------------------------------------------
 //
-CCCAContactorVOIPOperation* CCCAContactorVOIPOperation::NewL(const TDesC& aParam, TUint32 aServiceId)
+CCCAContactorVOIPOperation* CCCAContactorVOIPOperation::NewL(const TDesC& aParam, 
+        TUint32 aServiceId, const TDesC8& aContactLinkArray)
     {
-    CCCAContactorVOIPOperation* self=CCCAContactorVOIPOperation::NewLC(aParam, aServiceId);
+    CCCAContactorVOIPOperation* self=CCCAContactorVOIPOperation::NewLC(
+            aParam, aServiceId, aContactLinkArray);
     CleanupStack::Pop(); // self;
     return self;
     }
@@ -77,7 +84,7 @@
 void CCCAContactorVOIPOperation::ExecuteLD()
     {
     CleanupStack::PushL(this);
-    CCCAPhoneCall::ExecuteL(iParam, CCCAPhoneCall::ECCACallTypeVoIP, iServiceId);
+    CCCAPhoneCall::ExecuteL(iParam, iContactLinkArray, CCCAPhoneCall::ECCACallTypeVoIP, iServiceId);
     CleanupStack::PopAndDestroy(this);
     }
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccaphonecall.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccacontactorservice/src/ccaphonecall.cpp	Tue May 25 12:26:45 2010 +0300
@@ -47,7 +47,7 @@
 // ---------------------------------------------------------
 // CCCAPhoneCall::ExecuteL
 // ---------------------------------------------------------
-void CCCAPhoneCall::ExecuteL( const TDesC& aPhoneNumber, TCCAPhoneCallType aCallType, TUint32 aServiceId)
+void CCCAPhoneCall::ExecuteL( const TDesC& aPhoneNumber,const TDesC8& aContactLinkArray, TCCAPhoneCallType aCallType, TUint32 aServiceId)
 	{
     
     __ASSERT_DEBUG (NULL != &aPhoneNumber && 0 < aPhoneNumber.Size(), Panic (EPanicPreCond_ExecuteL));
@@ -86,10 +86,11 @@
 
 	CAiwDialDataExt* dialDataExt = CAiwDialDataExt::NewLC ();
 	dialDataExt->SetPhoneNumberL ( numBuf->Des ());
+	dialDataExt->SetContactLinkL( aContactLinkArray );	
 	switch (aCallType)
 	    {
 	    case ECCACallTypeVoice:
-	        dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS);
+	        dialDataExt->SetCallType ( CAiwDialData::EAIWForcedCS);	        
 	        break;
 	    case ECCACallTypeVoIP:
 	        dialDataExt->SetServiceId(aServiceId);
@@ -104,7 +105,7 @@
 	    }
 
 	dialDataExt->SetWindowGroup ( CCoeEnv::Static()->RootWin().Identifier ());
-
+	
 	DoAIWCallL (*dialDataExt);
 
 	CleanupStack::PopAndDestroy (dialDataExt);
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Tue May 25 12:26:45 2010 +0300
@@ -83,7 +83,13 @@
     * @aError System wide error code
     */
     void HandleError( TInt aError );
-       
+    	
+    /**
+     * Enables or disables Left Soft Key
+     * 
+     * @param aEnable  enable/disable LSK
+     */   
+    void EnableOptionsMenu( TBool aEnable );
     
 public: 
 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Tue May 25 12:26:45 2010 +0300
@@ -356,6 +356,13 @@
     {
     if( !iStoreCallBack )
         {
+        if ( !iMyCard && iForceCreateMyCard )
+            {
+            // Disable LSK if new contact will be created
+            // to avoid opening wrong menu
+            iPlugin.EnableOptionsMenu( EFalse );
+            }
+        
         iStoreCallBack = CTimerCallBack::NewL(
             TCallBack( &CCCAppMyCard::OpenStoresL, this ) );
 
@@ -650,6 +657,12 @@
         
         iDialogIsRunning = ETrue;
         dlg->ExecuteLD();
+        
+        if( aFlags & TPbk2ContactEditorParams::ENewContact )
+            {
+            // Enable LSK in my card view after edit dialog is opened
+            iPlugin.EnableOptionsMenu( ETrue );
+            }
         }
 	
 	// if field was created, destroy it
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Tue May 25 12:26:45 2010 +0300
@@ -434,7 +434,7 @@
 void CCCAppMyCardContainer::DoCheckExtensionFactoryL()
     {
     CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory();
-    // if extension is not null, extensionfactory plugins are available ->
+    // if extension is not null and view launcher supports mycard view then 
     // show statuscontrol
     TBool visible = EFalse;
     if( extension )
@@ -443,7 +443,11 @@
             {
             iViewLauncher = extension->CreateViewLauncherL();
             }
-        visible = ETrue;
+        if( iViewLauncher && 
+                iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) )
+            {
+            visible = ETrue;
+            }
         }
     else
         {
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp	Tue May 25 12:26:45 2010 +0300
@@ -291,8 +291,10 @@
         {
         case TPointerEvent::EButton1Down:
  
-            // Image selection popup
-        	if ( iPortraitImage->Rect().Contains(aPointerEvent.iPosition) )
+            // Image selection popup. If image is not set, then don't report
+            // touch events
+        	if ( iPortraitImage->Bitmap() &&
+        	     iPortraitImage->Rect().Contains(aPointerEvent.iPosition) )
         		{
 				// Show the feedback
 				MTouchFeedback* feedback = MTouchFeedback::Instance();
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Tue May 25 12:26:45 2010 +0300
@@ -218,13 +218,13 @@
     CCCAppViewPluginAknView::DoActivateL(
         aPrevViewId, aCustomMessageId, aCustomMessage );
     
+    iMyCard->FetchMyCardL(); 
+    
     // Set view title
     HBufC* title = iCoeEnv->AllocReadResourceLC( R_QTN_CCA_TITLE_MY_CARD );
     SetTitleL( *title );
     CleanupStack::PopAndDestroy( title );
-    
-    iMyCard->FetchMyCardL();
-    
+
     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardPlugin::DoActivateL()"));
     }
 
@@ -546,4 +546,9 @@
     CommandHandlerL()->HandleCommandL( EPbk2CmdCopyDetail, *iOwnContainer, NULL );
     }
 
+void CCCAppMyCardPlugin::EnableOptionsMenu( TBool aEnable )
+    {
+    Cba()->MakeCommandVisibleByPosition( 
+           CEikButtonGroupContainer::ELeftSoftkeyPosition, aEnable );
+    }
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccacmscontactfetcherwrapper.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccacmscontactfetcherwrapper.cpp	Tue May 25 12:26:45 2010 +0300
@@ -112,7 +112,8 @@
     {
     CCA_DP(KCCAppUtilLogFile, CCA_L("->CCCAppCmsContactFetcherWrapper::ConstructL()"));
 
-    TRAPD( err, StartFetcherL( ETrue));
+    // The setting of default number is disabled when opening CCA for better performance 
+    TRAPD( err, StartFetcherL( EFalse ));
     // problem can either be with connecting to CMS or with opening the contact
     iErrorsOccured = err;
 
--- a/phonebookui/Phonebook2/group/Pbk2GroupExtension.mmp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/group/Pbk2GroupExtension.mmp	Tue May 25 12:26:45 2010 +0300
@@ -88,5 +88,5 @@
 // Dependencies to Phonebook
 LIBRARY Pbk2CommonUi.lib Pbk2UiControls.lib Pbk2Commands.lib
 LIBRARY Pbk2Presentation.lib VPbkEng.lib
-
+LIBRARY CdlEngine.lib
 // End of File
--- a/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Tue May 25 12:26:45 2010 +0300
@@ -143,10 +143,10 @@
 SOURCE          CPbk2FieldSelector.cpp
 SOURCE          TPbk2FindTextUtil.cpp 
 SOURCE          CPbk2AdaptiveSearchGridFiller.cpp
-SOURCE		Pbk2RingtoneCommands.cpp
-SOURCE		Pbk2ImageCommands.cpp
-SOURCE		CPbk2ContactEditorReadonlyField.cpp 
-SOURCE      CPbk2ContactIconsUtils.cpp
+SOURCE          Pbk2RingtoneCommands.cpp
+SOURCE          Pbk2ImageCommands.cpp
+SOURCE          CPbk2ContactEditorReadonlyField.cpp 
+SOURCE          CPbk2ContactIconsUtils.cpp
 SOURCE          CPbk2UIField.cpp 
 SOURCE          CPbk2UIFieldArray.cpp 
 SOURCE          CPbk2ContactEditorUIFieldBase.cpp 
@@ -156,14 +156,15 @@
 SOURCE          CPbk2ContactEditorArrayItem.cpp 
 SOURCE          Pbk2AddressTools.cpp
 SOURCE          cpbk2predictiveviewstack.cpp 
-SOURCE 			cpbk2contactviewcustomlistboxitemdrawer.cpp 
-SOURCE 			cpbk2contactviewcustomlistboxdata.cpp
-SOURCE 			CPbk2PredictiveSearchFilter.cpp
-SOURCE			CPbk2ThumbnailManager.cpp
+SOURCE          cpbk2contactviewcustomlistboxitemdrawer.cpp 
+SOURCE          cpbk2contactviewcustomlistboxdata.cpp
+SOURCE          CPbk2PredictiveSearchFilter.cpp
+SOURCE          CPbk2ThumbnailManager.cpp
 SOURCE          cpbk2contactviewdoublelistbox.cpp
 SOURCE          cpbk2contactviewdoublelistboxmodel.cpp
 SOURCE          pbk2contactviewdoublelistboxdataelement.cpp
-SOURCE			cpbk2doublelistboxmodelcmddecorator.cpp
+SOURCE          cpbk2doublelistboxmodelcmddecorator.cpp
+SOURCE          CPbk2AdaptiveSearchGridWaiter.cpp
 
 // Resources
 LANGUAGE_IDS
--- a/phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h	Tue May 25 12:26:45 2010 +0300
@@ -140,6 +140,7 @@
 
 	/**
 	 * Reset thumbnail manager. Clear cache and cancel all ongoing operations.
+	 * NOTICE: Does not remove icons from icon array.
 	 */
 	void Reset();
 	
@@ -218,6 +219,12 @@
 	 */
 	void PreCreateThumbnailArrayL( MVPbkContactViewBase& aView );
 
+    /**
+     * Flush cached thumbnails and cancel all ongoing and scheduled operations.
+     * Remove icons from icon array if available.
+     */
+    void FlushCache();
+    
 private: // From MVPbkSingleContactOperationObserver
    void VPbkSingleContactOperationComplete(
 		   MVPbkContactOperationBase& aOperation,
@@ -316,6 +323,9 @@
 	CPbk2TmItem*                    iInProgressItemToBeRemoved;
 	/// Not own. Filtered view of contacts.
 	MPbk2FilteredViewStack*         iView;
+	/// Flag whether cache is clean. Used to prevent unnecessary work when cleaning
+	/// is requested repeatedly
+	TBool iIsCacheClean;
 	};
 
 #endif /* CPBK2THUMBNAILMANAGER_H_ */
--- a/phonebookui/Phonebook2/inc/spbcontentprovider.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/inc/spbcontentprovider.h	Tue May 25 12:26:45 2010 +0300
@@ -28,6 +28,7 @@
 class CPbk2StoreManager;
 class TPbk2IconId;
 class CGulIcon;
+class MVPbkContactStore;
 
 /**
  * Interface to observe content changes
@@ -164,6 +165,11 @@
     IMPORT_C CGulIcon* CreateServiceIconLC( 
         const TPbk2IconId& aIconId );
     
+    /**
+     * Clean the content in the cache if it belongs to the specified store
+     */
+    IMPORT_C void CleanContentL( MVPbkContactStore& aStore );
+    
 private: // Constructors
     
     /// Constructor
--- a/phonebookui/Phonebook2/loc/phonebook2ece.loc	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/loc/phonebook2ece.loc	Tue May 25 12:26:45 2010 +0300
@@ -243,6 +243,7 @@
 // r:5.1
 //
 #define qtn_phob_comlauncher_show_on_map "Show on map"
+
 // d:Text for the video call communication method.
 // l:list_single_large_graphic_pane_t1
 // r:5.0
@@ -345,6 +346,12 @@
 //
 #define qtn_cca_popup_assign_from_map "Assign from map:"
 
+// d:Shown when the user selects "Find on map" in CCA, but there's no location app installed
+// l:popup_note_window
+// r:5.2
+//
+#define qtn_cca_error_note_maps_not_found "Maps not found"
+
 // d:Prompt text for select number/address popup if only one VOIP Service is available in the phone
 // d:%U will be replaced with ServiceName and truncated to fit
 // l:heading_pane_t1
Binary file phonebookui/Phonebook2/remotecontactlookup/contactactionservice/conf/pbk2rclactionpriorities.confml has changed
--- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontentproviderprivate.h	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontentproviderprivate.h	Tue May 25 12:26:45 2010 +0300
@@ -31,6 +31,7 @@
 class CVPbkContactManager;
 class CSpbContactStoreListener;
 class CPbk2StoreManager;
+class MVPbkContactStore;
 
 /**
  * Private implementation of the content provider
@@ -68,7 +69,12 @@
             
     /// From CSpbContentProvider
     inline CGulIcon* CreateServiceIconLC( 
-        const TPbk2IconId& aIconId );
+        const TPbk2IconId& aIconId );		
+    
+    /**
+     * Clean the content in the cache if it belongs to the specified store
+     */
+    void CleanContentL( MVPbkContactStore& aStore );
     
 private: // constructors
     
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontentprovider.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontentprovider.cpp	Tue May 25 12:26:45 2010 +0300
@@ -19,6 +19,7 @@
 #include "spbcontentprovider.h"
 #include "spbcontentproviderprivate.h"
 #include <featmgr.h>
+#include <MVPbkContactStore.h>
 
 // LOCAL METHODS AND CONSTANTS
 namespace {
@@ -126,4 +127,13 @@
     return iImpl->CreateServiceIconLC( aIconId );
     }
 
+// ----------------------------------------------------------------------------
+// CSpbContentProvider::CleanContentL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CSpbContentProvider::CleanContentL( MVPbkContactStore& aStore )
+    {
+    return iImpl->CleanContentL( aStore );
+    }
+
 // end of file
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontentproviderprivate.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontentproviderprivate.cpp	Tue May 25 12:26:45 2010 +0300
@@ -22,6 +22,8 @@
 #include "spbcontent.h"
 #include "spbcontactstorelistener.h"
 
+#include <MVPbkContactStore.h>
+
 // CONSTANTS 
 namespace{
 
@@ -166,4 +168,27 @@
         }
     }
 
+// ----------------------------------------------------------------------------
+// CSpbContentProviderPrivate::CleanContentL
+// ----------------------------------------------------------------------------
+//
+void CSpbContentProviderPrivate::CleanContentL( 
+       MVPbkContactStore& aStore )
+    {
+    TInt i=0;
+    while( i < iContentCache.Count() )
+       {
+       CSpbContent* content = iContentCache[i];
+       if ( &content->Link().ContactStore() == &aStore )
+           {
+           iContentCache.Remove( i );
+           delete content;
+           }
+       else
+           {
+           i++;
+           }
+        }
+    }
+
 // end of file
--- a/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/phonebookui/Phonebook2/xSPExtensionManager/src/CxSPSortViewControl.cpp	Tue May 25 12:26:45 2010 +0300
@@ -129,8 +129,14 @@
          case EKeyUpArrow:
          case EKeyDownArrow:
              {
-             const CListBoxView::CSelectionIndexArray* inds = iListBox->SelectionIndexes();
-             TInt count = inds->Count();
+             const CListBoxView::CSelectionIndexArray* inds = NULL;
+             TInt count = 0;
+             
+             if ( iListBox )
+            	 {
+            	 inds = iListBox->SelectionIndexes();
+            	 count = inds->Count();
+            	 }
              
              if ( count <= 0 )
                  {
@@ -147,8 +153,14 @@
          case EKeyEnter:
          case EKeyOK: 
              {
-             const CListBoxView::CSelectionIndexArray* inds = iListBox->SelectionIndexes();
-             TInt count = inds->Count();
+             const CListBoxView::CSelectionIndexArray* inds = NULL;
+             TInt count = 0;
+             
+             if ( iListBox )
+            	 {
+            	 inds = iListBox->SelectionIndexes();
+            	 count = inds->Count();
+            	 }
              
              if ( count <= 0 )
                  {
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h	Tue May 25 12:26:45 2010 +0300
@@ -73,8 +73,8 @@
 		void PerformSearchL(const CPsSettings& aPcsSettings,
 					   	    CPsQuery& aCondition,
 					   	    RPointerArray<CPsClientData>& aData,
-					   	    RPointerArray<CPsPattern>& aPattern);							
-									
+					   	    RPointerArray<CPsPattern>& aPattern);
+		
 		/**
 		* Search Function for input string
 		*/
@@ -89,20 +89,20 @@
         void  SearchMatchStringL( CPsQuery& aSearchQuery,
                                     TDesC& aSearchData,
                                     TDes& aMatch ); 
-								       
+		
 		/**
 		* Returns ETrue if this language is supported
 		*/
 		TBool IsLanguageSupportedL(const TUint32 aLanguage);
-		      
+		
 		/**
 		* Returns supported data fields for a cache
-		*/		                     
+		*/
 		void GetDataOrderL( TDesC& aURI, RArray<TInt>& aDataOrder );
 
 		/**
 		* Returns supported sort order for a cache
-		*/		                     
+		*/
 		void GetSortOrderL( TDesC& aURI, RArray<TInt>& aDataOrder );
 
 		/**
@@ -123,7 +123,7 @@
 		void AddData ( TDesC& aDataStore, CPsData* aData);
 
 		/** 
-		* Remove a contact from the cache based on contact id		
+		* Remove a contact from the cache based on contact id
 		*/
 		void RemoveData ( TDesC& aDataStore, TInt aItemId );
 
@@ -140,7 +140,7 @@
 		// --------------------------------------------------------------------
 		
 	public:
-				
+		
 		// ----------------- From base class MStoreListObserver ---------------
 
 		/**
@@ -191,15 +191,23 @@
 		*/
 		void ConstructL();
 			
-    private:		
+    private:
 
         /**
+        * Define a P&S property with given key under the internal category 
+        * UID of PCS. Leave if definition fails for any other reason than
+        * key already existing.
+        */
+        void DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey );
+    
+        /**
         * Remove leading and trailing spaces of search query
         */
         void RemoveSpacesL ( CPsQuery& aQuery );
 
 		/**
-		* Replace occurance of "0" in ITU-T mode with space
+		* Replace occurances of "0" in predictive mode with space
+		* if those are on the same button
 		*/
 		TBool ReplaceZeroWithSpaceL ( CPsQuery& aQuery );
 			
@@ -208,8 +216,8 @@
 		*/
 		void DoSearchL ( const CPsSettings& aPcsSettings,
 						 CPsQuery& aCondition,
-						 RPointerArray<CPsData>& searchResults,
-	                     RPointerArray<CPsPattern>& searchSeqs );
+						 RPointerArray<CPsData>& aSearchResults,
+	                     RPointerArray<CPsPattern>& aSearchSeqs );
 		
 		/**                
 		* Search function helper
@@ -286,6 +294,11 @@
 		const TDesC& GetUriForIdL( TUint8 aUriId );
 		
         /**
+        * Inform clients about update happened on the cache
+        */
+        void HandleCacheUpdated( TCachingStatus aStatus );
+        
+        /**
         * launch plugins by idle
         */
          void DoLaunchPluginsL();
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h	Tue May 25 12:26:45 2010 +0300
@@ -67,7 +67,7 @@
 		/**
 		* Removes a data element from the cache
 		*/
-		void RemoveFromCacheL(TInt aItemId);	    
+		void RemoveFromCacheL(TInt aItemId);
 
 		/**
 		* Removes all data elements from the cache
@@ -151,7 +151,7 @@
          */
         void ComputeIndexOrder();
         
-	private:    
+	private:
 
 		/*
 		* Array of key maps
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp	Tue May 25 12:26:45 2010 +0300
@@ -32,9 +32,6 @@
 
 const TText KSpace = ' ';
 
-// UID used for Publish and Subscribe mechanism
-// This should be same as the one defined in CPsPropertyHandler.cpp
-const TUid KCStatus = {0x2000B5B6};
 
 // ============================== MEMBER FUNCTIONS ============================
 
@@ -80,23 +77,19 @@
     iPluginLauncher = CIdle::NewL( CActive::EPriorityStandard );
     
     // Define cache status property used to inform clients about the caching status.
-    TInt err = RProperty::Define(KCStatus,0, RProperty::EInt);      
-    if ( err != KErrAlreadyExists )
-    {
-    	User::LeaveIfError(err);
-    }
+    DefinePropertyL( EPsKeyCacheStatus );
     
     // Define cache error property used to inform client about the errors.
-    err = RProperty::Define(KCStatus,1, RProperty::EInt);
-    if ( err != KErrAlreadyExists )
-    {
-    	User::LeaveIfError(err);
-    }
+    DefinePropertyL( EPsKeyCacheError );
     
+    // Define properties for notifying about cache updates
+    DefinePropertyL( EPsKeyContactRemovedCounter );
+    DefinePropertyL( EPsKeyContactModifiedCounter );
+    DefinePropertyL( EPsKeyContactAddedCounter );
+
     // Initialize key map and pti engine
-    //iKeyMap = CPcsKeyMap::NewL();
     TInt keyMapErr = KErrNone;
-    TRAP( keyMapErr, iKeyMap = CPcsKeyMap::NewL());
+    TRAP( keyMapErr, iKeyMap = CPcsKeyMap::NewL() );
     if ( keyMapErr != KErrNone )
     {
         PRINT ( _L("**********************************************."));
@@ -117,8 +110,7 @@
      
     PRINT ( _L("End CPcsAlgorithm1::ConstructL") );
 } 
-	
-	
+
 // ----------------------------------------------------------------------------
 // CPcsAlgorithm1::~CPcsAlgorithm1
 // Destructor
@@ -147,6 +139,23 @@
 }
 
 // ----------------------------------------------------------------------------
+// CPcsAlgorithm1::DefinePropertyL
+// Define a P&S property with given key under the internal category 
+// UID of PCS. Leave if definition fails for any other reason than
+// key already existing. 
+// ----------------------------------------------------------------------------
+void CPcsAlgorithm1::DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey )
+    {
+    TInt err = RProperty::Define( KPcsInternalUidCacheStatus, 
+                                  aPsKey, 
+                                  RProperty::EInt );
+    if ( err != KErrAlreadyExists )
+        {
+        User::LeaveIfError(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
 // CPcsAlgorithm1::RemoveSpacesL
 // Remove leading and trailing spaces of search query
 // ----------------------------------------------------------------------------
@@ -533,16 +542,16 @@
 // CPcsAlgorithm1::DoSearchL
 // Search function helper
 // ----------------------------------------------------------------------------
-void  CPcsAlgorithm1::DoSearchL(const CPsSettings& aSettings,
-								CPsQuery& aQuery,
-								RPointerArray<CPsData>& aSearchResults,
-								RPointerArray<CPsPattern>& aSearchSeqs )
+void  CPcsAlgorithm1::DoSearchL( const CPsSettings& aSettings,
+                                 CPsQuery& aQuery,
+                                 RPointerArray<CPsData>& aSearchResults,
+                                 RPointerArray<CPsPattern>& aSearchSeqs )
 {
     PRINT ( _L("Enter CPcsAlgorithm1::DoSearchL") );
 
     __LATENCY_MARK ( _L("CPcsAlgorithm1::DoSearchL") ); 
     
-    // -(0)----------------- Check if group search is required ---------------    
+    // (0)------------------ Check if group search is required ---------------
     RArray<TInt> contactsInGroup;
     CleanupClosePushL( contactsInGroup );
     RArray<TInt> groupIdArray;
@@ -619,10 +628,10 @@
 // CPcsAlgorithm1::DoSearchInputL
 // Search function helper
 // ----------------------------------------------------------------------------
-void  CPcsAlgorithm1::DoSearchInputL(CPsQuery& aQuery,
-		                             const TDesC& aData,
-		                             RPointerArray<TDesC>& aMatchSet,
-		                             RArray<TPsMatchLocation>& aMatchLocation )
+void  CPcsAlgorithm1::DoSearchInputL( CPsQuery& aQuery,
+                                      const TDesC& aData,
+                                      RPointerArray<TDesC>& aMatchSet,
+                                      RArray<TPsMatchLocation>& aMatchLocation )
 {
     PRINT ( _L("Enter CPcsAlgorithm1::DoSearchInputL") );
 
@@ -699,7 +708,7 @@
 // CPcsAlgorithm1::RemoveData
 // Remove a data element from the pool
 // ----------------------------------------------------------------------------
-void CPcsAlgorithm1::RemoveData(TDesC &aDataStore, TInt aItemId)
+void CPcsAlgorithm1::RemoveData(TDesC& aDataStore, TInt aItemId)
 {
     TInt arrayIndex = GetCacheIndex(aDataStore);
     
@@ -775,10 +784,10 @@
 	{
 		SetCachingError(aDataStore, err);
 		return;
-	}		    
+	}
     cache->SetDataFields(dataFields); 
     
-    // Check if sort order is persisted already    
+    // Check if sort order is persisted already
     RArray<TInt> sortOrder;
     TRAP(err, ReadSortOrderFromCenRepL(cache->GetURI(), sortOrder));
     if ( err != KErrNone )
@@ -808,7 +817,7 @@
 		SetCachingError(aDataStore, err);
 		UpdateCachingStatus(aDataStore,ECachingCompleteWithErrors);
 		return;
-	}		
+	}
 }
 
 // ----------------------------------------------------------------------------
@@ -821,7 +830,7 @@
     {
     	CPcsCache* cache = iPcsCache[i];
     	
-    	if ( cache->GetURI().CompareC(aDataStore) == 0 ) 
+    	if ( cache->GetURI().CompareC(aDataStore) == 0 )
     	{
     		delete iPcsCache[i];
     		iPcsCache.Remove(i);
@@ -850,7 +859,7 @@
     for ( i = 0; i < iPcsCache.Count(); i++ )
     {
     	if ( iPcsCache[i]->GetUriId() == aUriId ) 
-    	{    	   
+    	{
     	   found = ETrue;
     	   break;
     	}
@@ -870,15 +879,15 @@
 // ----------------------------------------------------------------------------
 TInt CPcsAlgorithm1::FindStoreUri ( const TDesC& aDataStore )
 {
-    for ( int i = 0; i < iPcsCache.Count(); i++ )
+    for ( TInt i = 0; i < iPcsCache.Count(); i++ )
     {
         if ( aDataStore.CompareC(iPcsCache[i]->GetURI()) == 0 ) 
     	{
-    	   return i;   
+    	   return i;
     	}
     }
 
-    return -1;
+    return KErrNotFound;
 }
 
 // ----------------------------------------------------------------------------
@@ -889,12 +898,24 @@
 {
 	PRINT ( _L("Enter CPcsAlgorithm1::UpdateCachingStatus") );
 	
+	// Handle data store update events
+	if ( aStatus == ECacheUpdateContactRemoved ||
+	     aStatus == ECacheUpdateContactModified ||
+	     aStatus == ECacheUpdateContactAdded )
+	    {
+        HandleCacheUpdated( static_cast<TCachingStatus>(aStatus) );
+        return;
+	    }
+	
+	// If not a cache update event, then this event is related to the initial
+	// cache construction.
 	TInt index = FindStoreUri(aDataStore);
+	
 	iPcsCache[index]->UpdateCacheStatus(aStatus);
 	
 	// Check if any error occurred
 	// If so, update the cache status, Set the property and return
-	if( aStatus < 0)
+	if ( aStatus < 0 )
 	{
 		SetCachingError(aDataStore, aStatus);
 		//return;
@@ -905,20 +926,20 @@
 	TBool atLeastOneStoreCachingCompleteWithErrors(EFalse);
 	for ( TInt i = 0; i < iPcsCache.Count(); i++ )
 	{
-		if( iPcsCache[i]->GetCacheStatus() == ECachingComplete)
-		  {
-	      continue;
-	      }	
-		else if ( iPcsCache[i]->GetCacheStatus() == ECachingCompleteWithErrors)
-		   {
-		 	 atLeastOneStoreCachingCompleteWithErrors = ETrue;
-		 	 continue;
-		   }
+		if ( iPcsCache[i]->GetCacheStatus() == ECachingComplete )
+		{
+	        continue;
+	    }
+		else if ( iPcsCache[i]->GetCacheStatus() == ECachingCompleteWithErrors )
+		{
+            atLeastOneStoreCachingCompleteWithErrors = ETrue;
+            continue;
+		}
 		else
 		{
 			status = ECachingInProgress;
 			break;
-		}			
+		}
 	}
 	
 	if ( status == ECachingComplete )
@@ -933,7 +954,7 @@
 	if ( status != iCacheStatus )
 	{
 		iCacheStatus = status;
-		RProperty::Set(KCStatus,0,iCacheStatus );
+		RProperty::Set(KPcsInternalUidCacheStatus, EPsKeyCacheStatus, iCacheStatus );
 	}
 	
 	PRINT ( _L("End CPcsAlgorithm1::UpdateCachingStatus") );
@@ -945,10 +966,10 @@
 // ----------------------------------------------------------------------------
 void CPcsAlgorithm1::SetCachingError(const TDesC& aDataStore, TInt aError)
 {
-	PRINT2 ( _L("SetCachingError::URI %S ERROR %d"), &aDataStore, aError );
+    PRINT2 ( _L("SetCachingError::URI %S ERROR %d"), &aDataStore, aError );
 
-	iCacheError = aError;
-	RProperty::Set( KCStatus, 1, iCacheError );
+    iCacheError = aError;
+    RProperty::Set( KPcsInternalUidCacheStatus, EPsKeyCacheError, iCacheError );
 }
 
 // ----------------------------------------------------------------------------
@@ -960,7 +981,7 @@
 {
 	__LATENCY_MARK ( _L("CPcsAlgorithm1::GetAllContentsL") );
     
-    PRINT ( _L("Enter CPcsAlgorithm1::GetAllContentsL") );   
+    PRINT ( _L("Enter CPcsAlgorithm1::GetAllContentsL") );
     
     // To hold array of results from different data stores
     typedef RPointerArray<CPsData> CPSDATA_R_PTR_ARRAY;
@@ -1145,7 +1166,7 @@
 {
     PRINT ( _L("End CPcsAlgorithm1::GetDataOrderL") );
 
-    TInt arrayIndex = -1;     
+    TInt arrayIndex = KErrNotFound;
     
     if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) )
     {
@@ -1153,8 +1174,8 @@
         arrayIndex = GetCacheIndex(KVPbkDefaultCntDbURI);
     }
     else 
-    {		
-		arrayIndex = GetCacheIndex(aURI);
+    {
+        arrayIndex = GetCacheIndex(aURI);
     }
     
     if ( arrayIndex < 0 ) return;
@@ -1178,17 +1199,16 @@
 {
     PRINT ( _L("End CPcsAlgorithm1::GetSortOrderL") );
 
-    TInt arrayIndex = -1;
+    TInt arrayIndex = KErrNotFound;
     
     if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) )
     {
         // If search in a group uri, use contacts db
-        TBuf<255> cntdb(KVPbkDefaultCntDbURI);
-        arrayIndex = GetCacheIndex(cntdb);
+        arrayIndex = GetCacheIndex(KVPbkDefaultCntDbURI);
     }
     else 
     {
-		arrayIndex = GetCacheIndex(aURI);
+        arrayIndex = GetCacheIndex(aURI);
     }
     
     if ( arrayIndex < 0 ) return;
@@ -1237,10 +1257,10 @@
     RArray<TInt> mySortOrder;
     cache->GetSortOrder(mySortOrder);
     
-    if ( aSortOrder.Count() == mySortOrder.Count() )    
+    if ( aSortOrder.Count() == mySortOrder.Count() )
     {
         TBool same = ETrue;
-        for ( TInt i = 0; i < mySortOrder.Count(); i++ )	
+        for ( TInt i = 0; i < mySortOrder.Count(); i++ )
         {
             if ( mySortOrder[i] != aSortOrder[i] )
             {
@@ -1363,8 +1383,8 @@
 	TInt keyIndex = -1;
 
 	for ( TInt i(KCenrepFieldsStartKey); 
-	  		   i < KCenrepFieldsStartKey + KCenrepNumberOfFieldsCount; 
-	           i++ )
+	      i < KCenrepFieldsStartKey + KCenrepNumberOfFieldsCount; 
+	      i++ )
 	{
 		TInt err = repository->Get( i, str );
 
@@ -1395,8 +1415,8 @@
 	{
 		// Find the next free key index
 		for ( TInt i(KCenrepFieldsStartKey); 
-		  		   i < KCenrepFieldsStartKey + KCenrepNumberOfFieldsCount; 
-		           i++ )
+		      i < KCenrepFieldsStartKey + KCenrepNumberOfFieldsCount; 
+		      i++ )
 	    {
 		    TInt err = repository->Get( i, str );
 
@@ -1479,6 +1499,45 @@
 }
 
 // ---------------------------------------------------------------------------------
+// HandleCacheUpdated.
+// ---------------------------------------------------------------------------------
+void CPcsAlgorithm1::HandleCacheUpdated( TCachingStatus aStatus )
+    {
+    TInt psKey( KErrNotFound );
+    
+    switch ( aStatus )
+        {
+        case ECacheUpdateContactRemoved:
+            psKey = EPsKeyContactRemovedCounter;
+            break;
+            
+        case ECacheUpdateContactModified:
+            psKey = EPsKeyContactModifiedCounter;
+            break;
+            
+        case ECacheUpdateContactAdded:
+            psKey = EPsKeyContactAddedCounter;
+            break;
+            
+        default:
+            break;
+        }
+
+    if ( psKey != KErrNotFound )
+        {
+        // Increment the related counter in P&S by one to signal the clients about
+        // the cache update.
+        TInt counter( KErrNotFound );
+        TInt err = RProperty::Get( KPcsInternalUidCacheStatus, psKey, counter );
+        if ( !err )
+            {
+            counter++;
+            RProperty::Set( KPcsInternalUidCacheStatus, psKey, counter );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------------
 // DoLaunchPluginsL.
 // launch plugins by idle
 // ---------------------------------------------------------------------------------
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Tue May 25 12:26:45 2010 +0300
@@ -164,7 +164,7 @@
 // 
 // ----------------------------------------------------------------------------
 
-TInt CPcsAlgorithm1FilterHelper::AddToPoolL(CPsData* psData, 
+TInt CPcsAlgorithm1FilterHelper::AddToPoolL(CPsData* aPsData, 
 											RPointerArray<TDesC>& aPatternSequence)
 {
 	
@@ -182,7 +182,7 @@
 	TInt matchpatterpoolIndexToAppend = -1;
 	
 	
-	for(TInt cnt=0; cnt <aPatternSequence.Count(); cnt++ )
+	for ( TInt cnt=0; cnt <aPatternSequence.Count(); cnt++ )
 	{
 	
 		// Create the pattern for aPatternSequence[cnt] in  iMatchPatternDetails
@@ -195,8 +195,8 @@
 	    {
 	    	TInt poolIndex = iMatchPatternDetails[indexInMatchPatternDetails]->poolIndex;
 	    	matchpatterpoolIndexToAppend = indexInMatchPatternDetails;
-	       	iMatchPatternPools[poolIndex]->InsertInOrderAllowRepeats(psData, psDataRule);
-	       	TInt findposition = iMatchPatternPools[poolIndex]->Find(psData,identitySearchRule) ;
+	       	iMatchPatternPools[poolIndex]->InsertInOrderAllowRepeats(aPsData, psDataRule);
+	       	TInt findposition = iMatchPatternPools[poolIndex]->Find(aPsData, identitySearchRule) ;
 	       	if ( findposition != KErrNotFound )
 	       	{
 	       		poolItemCount = findposition;
@@ -212,7 +212,7 @@
 		    // 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);
-		 	if(subSeq  == KErrNotFound )
+		 	if ( subSeq == KErrNotFound )
 		 	{
 		 	
 		 		//Create the subpattern and append it.
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Tue May 25 12:26:45 2010 +0300
@@ -450,9 +450,9 @@
     
     // Remember a temporary copy of query list
     // since we sort the queries
-	for( TInt i = 0; i < queryList.Count(); i++)
+	for ( TInt i = 0; i < queryList.Count(); i++)
 	{
-		tempqueryList.Append(queryList[i]);
+		tempqueryList.AppendL(queryList[i]);
 	}
          
 	// Sort the query items before we search them
@@ -470,6 +470,13 @@
 		CPsData* psData = poolElement->GetPsData();
 		psData->ClearDataMatches();
 		
+        // Skip the contact if we are doing a group search and contact doesn't belong to the group
+        if ( aIsSearchInGroup && 
+             aContactsInGroup.Find( psData->Id() ) == KErrNotFound )
+            {
+            continue;
+            }
+        
 		TBool isMatch = ETrue;		
 		TInt wordMatches = 0;
 		
@@ -562,17 +569,7 @@
 		//  And before adding to the result set, check if there is atleast one match per query
 		if ( isMatch && wordMatches >= queryList.Count() )
 		{
-			if ( aIsSearchInGroup )
-			{
-				if ( aContactsInGroup.Find(psData->Id()) != KErrNotFound )
-				{
-					aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
-				}
-			}
-			else 
-			{
-				aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
-			}
+			aAlgorithmFilterHelper->AddL(psData,tmpMatchSet);
 	    } 
 	    
 	    // Cleanup the match sequence array as 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Tue May 25 12:26:45 2010 +0300
@@ -205,7 +205,7 @@
 	CPcsCache* cache1 = (*pcsCache)[aObject1.UriId()];
     CPcsCache* cache2 = (*pcsCache)[aObject2.UriId()];
 	RArray<TInt> indexOrder1;
-    RArray<TInt> indexOrder2;	
+    RArray<TInt> indexOrder2;
 	  
     // Get the index order based on sort order from the cache
 	cache1->GetIndexOrder(indexOrder1);
@@ -224,7 +224,7 @@
         if ( object1Idx < aObject1.DataElementCount() 
              && aObject1.Data(object1Idx)
              && strCompare1->Length() )
-            {   
+            {
             strCompare1->Des().TrimAll();
             
             for(; idx2 < indexOrder2.Count(); idx2++)
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsKeyMap.cpp	Tue May 25 12:26:45 2010 +0300
@@ -653,7 +653,7 @@
 // Initialise the keyboard type variables
 // ----------------------------------------------------------------------------
 void CPcsKeyMap::GetPhysicalKeyboardTypesL( TPtiKeyboardType& aItutKbType,
-                                              TPtiKeyboardType& aQwertyKbType )
+                                            TPtiKeyboardType& aQwertyKbType )
     {
     TInt physicalKeyboard = 0;
     CRepository* aknFepRepository = CRepository::NewL( KCRUidAknFep );
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPsDataPluginInterface.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPsDataPluginInterface.cpp	Tue May 25 12:26:45 2010 +0300
@@ -175,17 +175,17 @@
 // CPsDataPluginInterface::RequestForDataL
 // Requests for data from the data store
 // ---------------------------------------------------------------------------- 
-void  CPsDataPluginInterface::RequestForDataL(TDesC& aDataStore)
+void CPsDataPluginInterface::RequestForDataL(TDesC& aDataStore)
 {
 
     PRINT ( _L("Enter CPsDataPluginInterface::RequestForDataL") );
    
     for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
     {
-        if(iPsDataPluginInstances[idx]->IsDataStoresSupportedL(aDataStore))
+        if ( iPsDataPluginInstances[idx]->IsDataStoresSupportedL(aDataStore) )
         {
-       		iPsDataPluginInstances[idx]->RequestForDataL(aDataStore);
-    		break; 
+            iPsDataPluginInstances[idx]->RequestForDataL(aDataStore);
+            break; 
         }
     }
     
@@ -197,14 +197,14 @@
 // CPsDataPluginInterface::GetAllSupportedDataStoresL
 // Requests all the supported data stores from data adapters
 // ---------------------------------------------------------------------------- 
-void  CPsDataPluginInterface::GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores)
+void CPsDataPluginInterface::GetAllSupportedDataStoresL(RPointerArray<TDesC>& aDataStores)
 {
 
     PRINT ( _L("Enter CPsDataPluginInterface::GetAllSupportedDataStoresL") );
    
     for ( TInt idx = 0; idx < iPsDataPluginInstances.Count(); idx++ )
-    {       
-       iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
+    {
+        iPsDataPluginInstances[idx]->GetSupportedDataStoresL(aDataStores);
     }
     
     PRINT ( _L("End CPsDataPluginInterface::GetAllSupportedDataStoresL") );
@@ -228,11 +228,11 @@
        
        for ( TInt i(0); i<dataStores.Count(); i++)
        {
-	       	if ( dataStores[i]->Compare(aUri) == 0)
-	       	{
-	       		iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields);
-	       		break;
-	       	}
+           if ( dataStores[i]->Compare(aUri) == 0 )
+           {
+               iPsDataPluginInstances[idx]->GetSupportedDataFieldsL(aDataFields);
+               break;
+           }
        }
        CleanupStack::PopAndDestroy( &dataStores ); // Close
     }
--- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h	Tue May 25 12:26:45 2010 +0300
@@ -199,7 +199,14 @@
      */
     void ConstructL();
 
-private:		
+private:
+
+    /**
+     * Define a P&S property with given key under the internal category 
+     * UID of PCS. Leave if definition fails for any other reason than
+     * key already existing.
+     */
+    void DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey );
 
     /**
      * Replace occurance of "0" in ITU-T mode with space
@@ -287,6 +294,11 @@
      * Function to return data base URI for an internal identifier
      */		                     
     TDesC& GetUriForIdL( TUint8 aUriId );	
+
+    /**
+     * Inform clients about update happened on the cache
+     */
+    void HandleCacheUpdated( TCachingStatus aStatus );
     
     /**
     * launch plugins by idle
--- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp	Tue May 25 12:26:45 2010 +0300
@@ -35,12 +35,6 @@
 #include "CPcsDefs.h"
 #include "FindUtilChineseECE.h"
 
-// UID used for Publish and Subscribe mechanism
-// This should be same as the one defined in CPsPropertyHandler.cpp
-const TUid KCStatus =
-    {
-    0x2000B5B6
-    };
 
 // ============================== MEMBER FUNCTIONS ============================
 
@@ -90,18 +84,15 @@
     iPluginLauncher = CIdle::NewL( CActive::EPriorityStandard );
 
     // Define cache status property used to inform clients about the caching status.
-    TInt err = RProperty::Define(KCStatus, 0, RProperty::EInt);
-    if (err != KErrAlreadyExists)
-        {
-        User::LeaveIfError(err);
-        }
-
+    DefinePropertyL( EPsKeyCacheStatus );
+    
     // Define cache error property used to inform client about the errors.
-    err = RProperty::Define(KCStatus, 1, RProperty::EInt);
-    if (err != KErrAlreadyExists)
-        {
-        User::LeaveIfError(err);
-        }
+    DefinePropertyL( EPsKeyCacheError );
+    
+    // Define properties for notifying about cache updates
+    DefinePropertyL( EPsKeyContactRemovedCounter );
+    DefinePropertyL( EPsKeyContactModifiedCounter );
+    DefinePropertyL( EPsKeyContactAddedCounter );
 
     // Initialize key map and pti engine
     TInt keyMapErr = KErrNone;
@@ -157,6 +148,23 @@
     }
 
 // ----------------------------------------------------------------------------
+// CPcsAlgorithm2::DefinePropertyL
+// Define a P&S property with given key under the internal category 
+// UID of PCS. Leave if definition fails for any other reason than
+// key already existing. 
+// ----------------------------------------------------------------------------
+void CPcsAlgorithm2::DefinePropertyL( TPcsInternalKeyCacheStatus aPsKey )
+    {
+    TInt err = RProperty::Define( KPcsInternalUidCacheStatus, 
+                                  aPsKey, 
+                                  RProperty::EInt );
+    if ( err != KErrAlreadyExists )
+        {
+        User::LeaveIfError(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
 // CPcsAlgorithm2::ReplaceZeroWithSpaceL
 // Replace first occurance of '0' in a sequence of '0's in ITU-T with space
 // ----------------------------------------------------------------------------
@@ -803,6 +811,17 @@
     {
     PRINT ( _L("Enter CPcsAlgorithm2::UpdateCachingStatus") );
 
+    // Handle data store update events
+    if ( aStatus == ECacheUpdateContactRemoved ||
+         aStatus == ECacheUpdateContactModified ||
+         aStatus == ECacheUpdateContactAdded )
+        {
+        HandleCacheUpdated( static_cast<TCachingStatus>(aStatus) );
+        return;
+        }
+
+    // If not a cache update event, then this event is related to the initial
+    // cache construction.
     TInt index = FindStoreUri(aDataStore);
     iPcsCache[index]->UpdateCacheStatus(aStatus);
 
@@ -868,7 +887,7 @@
     if (status != iCacheStatus)
         {
         iCacheStatus = status;
-        RProperty::Set(KCStatus, 0, iCacheStatus);
+        RProperty::Set(KPcsInternalUidCacheStatus, EPsKeyCacheStatus, iCacheStatus );
         }
 
     PRINT ( _L("End CPcsAlgorithm2::UpdateCachingStatus") );
@@ -880,12 +899,10 @@
 // ----------------------------------------------------------------------------
 void CPcsAlgorithm2::SetCachingError(TDesC& aDataStore, TInt aError)
     {
-    TBuf<KBufferMaxLen> store;
-    store.Copy(aDataStore);
-    PRINT2 ( _L("SetCachingError::URI %S ERROR %d"), &store, aError );
+    PRINT2 ( _L("SetCachingError::URI %S ERROR %d"), &aDataStore, aError );
 
     iCacheError = aError;
-    RProperty::Set(KCStatus, 1, iCacheError);
+    RProperty::Set( KPcsInternalUidCacheStatus, EPsKeyCacheError, iCacheError );
     }
 
 // ----------------------------------------------------------------------------
@@ -1414,6 +1431,48 @@
     return clientData;
     }
 
+// ---------------------------------------------------------------------------------
+// HandleCacheUpdated.
+// ---------------------------------------------------------------------------------
+void CPcsAlgorithm2::HandleCacheUpdated( TCachingStatus aStatus )
+    {
+    TInt psKey( KErrNotFound );
+    
+    switch ( aStatus )
+        {
+        case ECacheUpdateContactRemoved:
+            psKey = EPsKeyContactRemovedCounter;
+            break;
+            
+        case ECacheUpdateContactModified:
+            psKey = EPsKeyContactModifiedCounter;
+            break;
+            
+        case ECacheUpdateContactAdded:
+            psKey = EPsKeyContactAddedCounter;
+            break;
+            
+        default:
+            break;
+        }
+
+    if ( psKey != KErrNotFound )
+        {
+        // Increment the relevant counter in P&S by one to signal the clients about
+        // the cache update.
+        TInt counter( KErrNotFound );
+        TInt err = RProperty::Get( KPcsInternalUidCacheStatus, psKey, counter );
+        if ( !err )
+            {
+            counter++;
+            RProperty::Set( KPcsInternalUidCacheStatus, psKey, counter );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------------
+// ReconstructCacheDataL.
+// ---------------------------------------------------------------------------------
 void CPcsAlgorithm2::ReconstructCacheDataL()
     {
     PRINT ( _L("Enter CPcsAlgorithm2::ReconstructCacheDataL.") );
--- a/predictivesearch/PcsServerClientAPI/group/PsServerClientAPI.mmp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsServerClientAPI/group/PsServerClientAPI.mmp	Tue May 25 12:26:45 2010 +0300
@@ -27,7 +27,8 @@
 SOURCEPATH    ../src 
 SOURCE        CPsRequestHandler.cpp
 SOURCE        CPsPropertyHandler.cpp
-SOURCE 	      RPsSession.cpp
+SOURCE        CPsUpdateHandler.cpp
+SOURCE        RPsSession.cpp 
 
 USERINCLUDE   ../inc
 USERINCLUDE   ../../PcsUtils/inc
@@ -36,7 +37,7 @@
 LIBRARY       euser.lib
 LIBRARY       flogger.lib
 LIBRARY       estor.lib
-LIBRARY		  bafl.lib
+LIBRARY       bafl.lib
 
 LIBRARY       PcsUtils.lib
 LIBRARY       VPbkEng.lib
--- a/predictivesearch/PcsServerClientAPI/inc/CPsPropertyHandler.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsServerClientAPI/inc/CPsPropertyHandler.h	Tue May 25 12:26:45 2010 +0300
@@ -94,21 +94,21 @@
         * @param aObserver The object to be used to
         *                  handle updates from the server.
         */
-        CPsPropertyHandler(CPSRequestHandler* aRequestHandler );
+        CPsPropertyHandler( CPSRequestHandler* aRequestHandler );
 
         /**
         * ConstructL.
         * Performs the second phase construction of a
         * CPsPropertyHandler object.
         */
-        void ConstructL(  );
+        void ConstructL();
         
     private: // Data
     	
     	/**
     	* iRequestHandler, object to RequestHandler through which 
     	* observers will be accessed
-    	*/		
+    	*/
 		CPSRequestHandler* iRequestHandler;
 		
 		/**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/predictivesearch/PcsServerClientAPI/inc/CPsUpdateHandler.h	Tue May 25 12:26:45 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the client side internal file to handle
+*               cache update notifications sent by the server using
+*               Publish and Subscribe framework.
+*
+*/
+
+#ifndef CPSUPDATEHANDLER_H
+#define CPSUPDATEHANDLER_H
+
+#include <e32base.h>
+
+class CPSRequestHandler;
+
+
+class CPsUpdateHandler : public CActive
+    {
+public:
+    // Cancel and destroy
+    ~CPsUpdateHandler();
+
+    // Two-phased constructor.
+    static CPsUpdateHandler* NewL( CPSRequestHandler& aRequestHandler, TInt aPsKey );
+
+    // Two-phased constructor.
+    static CPsUpdateHandler* NewLC( CPSRequestHandler& aRequestHandler, TInt aPsKey );
+
+private:
+    // C++ constructor
+    CPsUpdateHandler( CPSRequestHandler& aRequestHandler, TInt aPsKey );
+
+    // Second-phase constructor
+    void ConstructL();
+
+private: // From CActive
+    // Handle completion
+    void RunL();
+
+    // How to cancel me
+    void DoCancel();
+
+private:
+    
+    /**
+    * Handle to RequestHandler through which observers will be notified
+    */
+    CPSRequestHandler& iRequestHandler;
+    
+    /**
+    * P&S property handle to be observed
+    */
+    RProperty iProperty;
+    
+    /**
+    * The P&S key observed by this handler object
+    */
+    TInt iPsKey;
+    };
+
+#endif // CPSUPDATEHANDLER_H
--- a/predictivesearch/PcsServerClientAPI/src/CPsPropertyHandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsServerClientAPI/src/CPsPropertyHandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  This is the client side internal file to handle
-*                property used in Publish and Subscribe framework.
+*               property used in Publish and Subscribe framework.
 *
 */
 
@@ -24,10 +24,6 @@
 #include "CPsPropertyHandler.h"
 #include "CPcsDebug.h"
 
-// UID used for Publish and Subscribe mechanism
-// This should be same as the one defined in CPcsAlgorithm.cpp
-// Server UID3 has to be used for this framework
-const TUid KCStatus = {0x2000B5B6};
 
 // ========================= MEMBER FUNCTIONS ==================================
 
@@ -53,16 +49,16 @@
 // CPsPropertyHandler::ConstructL()
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
-void CPsPropertyHandler::ConstructL(  )
+void CPsPropertyHandler::ConstructL()
 {
     PRINT ( _L("Enter CPsPropertyHandler::ConstructL") );
     
-    TInt err = iCacheStatusProperty.Attach(KCStatus, 0 );
-    User::LeaveIfError(err);   
+    TInt err = iCacheStatusProperty.Attach( KPcsInternalUidCacheStatus, EPsKeyCacheStatus );
+    User::LeaveIfError(err);
     
     // Attach the cache error property
-    err = iCacheErrorProperty.Attach(KCStatus, 1);
-    User::LeaveIfError(err); 
+    err = iCacheErrorProperty.Attach( KPcsInternalUidCacheStatus, EPsKeyCacheError );
+    User::LeaveIfError(err);
     
     iCacheStatusProperty.Subscribe(iStatus);
     
@@ -97,7 +93,7 @@
     Cancel(); // Causes call to DoCancel()
     
     iCacheStatusProperty.Close();
-
+    iCacheErrorProperty.Close();
 }
 
 // -----------------------------------------------------------------------------
@@ -106,23 +102,22 @@
 // -----------------------------------------------------------------------------
 void CPsPropertyHandler::RunL()
 {
-	iCacheStatusProperty.Subscribe(iStatus);
-	SetActive();
-	
-	//Get the value
-	TCachingStatus status; 
-	TInt statusValue;
-	iCacheStatusProperty.Get(statusValue);
-	status = (TCachingStatus)statusValue;
-	
-	TInt cacheError;
-	iCacheErrorProperty.Get(cacheError);
-	
-	if( (status == ECachingComplete) || (status == ECachingCompleteWithErrors))
-	{
-		for(TInt i = 0; i < iRequestHandler->iObservers.Count(); i++)
-			iRequestHandler->iObservers[i]->CachingStatus(status, cacheError);
-	}
+    iCacheStatusProperty.Subscribe(iStatus);
+    SetActive();
+    
+    //Get the value
+    TCachingStatus status; 
+    TInt statusValue;
+    iCacheStatusProperty.Get(statusValue);
+    status = (TCachingStatus)statusValue;
+    
+    TInt cacheError;
+    iCacheErrorProperty.Get(cacheError);
+    
+    if ( (status == ECachingComplete) || (status == ECachingCompleteWithErrors) )
+    {
+        iRequestHandler->NotifyCachingStatus( status, cacheError );
+    }
 }
 
 // -----------------------------------------------------------------------------
--- a/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -23,6 +23,7 @@
 
 // USER INCLUDE
 #include "CPsPropertyHandler.h"
+#include "CPsUpdateHandler.h"
 #include "CPcsDebug.h"
 #include "CPsPattern.h"
 
@@ -41,7 +42,7 @@
 
     PRINT ( _L("End CPSRequestHandler::NewL") );
 
-    return (self);
+    return self;
     }
 
 // -----------------------------------------------------------------------------
@@ -74,6 +75,11 @@
     // Initiate the property handler
     iPropertyHandler = CPsPropertyHandler::NewL(this);
 
+    // Initiate handlers for cache updating
+    iContactAddedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactAddedCounter );
+    iContactModifiedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactModifiedCounter );
+    iContactRemovedHandler = CPsUpdateHandler::NewL( *this, EPsKeyContactRemovedCounter );
+    
     // Initialize the contact id converter
     iConverter = NULL;
 
@@ -107,39 +113,15 @@
     // Close the session
     iSession.Close();
 
-    // Cleanup
-    if (iSearchQueryBuffer)
-        {
-        delete iSearchQueryBuffer;
-        }
-
-    if (iPendingSearchQueryBuffer)
-        {
-        delete iPendingSearchQueryBuffer;
-        }
-
-    if (iSearchDataBuffer)
-        {
-        delete iSearchDataBuffer;
-        }
-
-    if (iSearchResultsBuffer)
-        {
-        delete iSearchResultsBuffer;
-        iSearchResultsBuffer = NULL;
-        }
-
-    if (iPropertyHandler)
-        {
-        delete iPropertyHandler;
-        iPropertyHandler = NULL;
-        }
-
-    if (iConverter)
-        {
-        delete iConverter;
-        iConverter = NULL;
-        }
+    delete iSearchQueryBuffer;
+    delete iPendingSearchQueryBuffer;
+    delete iSearchDataBuffer;
+    delete iSearchResultsBuffer;
+    delete iPropertyHandler;
+    delete iContactAddedHandler;
+    delete iContactModifiedHandler;
+    delete iContactRemovedHandler;
+    delete iConverter;
 
     iObservers.Reset();
     iObservers.Close();
@@ -1125,7 +1107,7 @@
     TInt fieldCount = resultStream.ReadUint16L();
 
     // Fields
-    for (int i = 0; i < fieldCount; i++)
+    for (TInt i = 0; i < fieldCount; i++)
         {
         TInt fieldId = resultStream.ReadUint16L();
         aDataOrder.Append(fieldId);
@@ -1266,7 +1248,18 @@
     iSearchDataBuffer = NULL;
 
     PRINT ( _L("End CPSRequestHandler::ChangeSortOrderL") );
+    }
 
+// -----------------------------------------------------------------------------
+// CPSRequestHandler::NotifyCachingStatus()
+// 
+// -----------------------------------------------------------------------------
+void CPSRequestHandler::NotifyCachingStatus( TCachingStatus aStatus, TInt aError )
+    {
+    for ( TInt i = 0; i < iObservers.Count(); i++ )
+        {
+        iObservers[i]->CachingStatus(aStatus, aError);
+        }
     }
 
 // End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/predictivesearch/PcsServerClientAPI/src/CPsUpdateHandler.cpp	Tue May 25 12:26:45 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the client side internal file to handle
+*               cache update notifications sent by the server using
+*               Publish and Subscribe framework.
+*
+*/
+
+#include <CPsRequestHandler.h>
+#include "CPsUpdateHandler.h"
+
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::CPsUpdateHandler
+// C++ constructor
+// -----------------------------------------------------------------------------
+CPsUpdateHandler::CPsUpdateHandler( CPSRequestHandler& aRequestHandler, TInt aPsKey ) :
+    CActive( EPriorityStandard ),
+    iRequestHandler( aRequestHandler ),
+    iPsKey( aPsKey )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::NewLC
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+CPsUpdateHandler* CPsUpdateHandler::NewLC( CPSRequestHandler& aRequestHandler, TInt aPsKey )
+    {
+    CPsUpdateHandler* self = new (ELeave) CPsUpdateHandler( aRequestHandler, aPsKey );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::NewL
+// Two-phased constructor
+// -----------------------------------------------------------------------------
+CPsUpdateHandler* CPsUpdateHandler::NewL( CPSRequestHandler& aRequestHandler, TInt aPsKey )
+    {
+    CPsUpdateHandler* self = CPsUpdateHandler::NewLC( aRequestHandler, aPsKey );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::ConstructL
+// Second phase constructor
+// -----------------------------------------------------------------------------
+void CPsUpdateHandler::ConstructL()
+    {
+    TInt err = iProperty.Attach( KPcsInternalUidCacheStatus, iPsKey );
+    User::LeaveIfError(err);
+    
+    iProperty.Subscribe(iStatus);
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::~CPsUpdateHandler
+// Destructor
+// -----------------------------------------------------------------------------
+CPsUpdateHandler::~CPsUpdateHandler()
+    {
+    Cancel();
+    iProperty.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::DoCancel
+// Cancel subscription to the property
+// -----------------------------------------------------------------------------
+void CPsUpdateHandler::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// -----------------------------------------------------------------------------
+// CPsUpdateHandler::RunL
+// Handle change in the subscribed property
+// -----------------------------------------------------------------------------
+void CPsUpdateHandler::RunL()
+    {
+    iProperty.Subscribe(iStatus);
+    SetActive();
+    
+    // Notify all observers about the update
+    switch ( iPsKey )
+        {
+        case EPsKeyContactRemovedCounter:
+            iRequestHandler.NotifyCachingStatus( ECacheUpdateContactRemoved, 0 );
+            break;
+        case EPsKeyContactModifiedCounter:
+            iRequestHandler.NotifyCachingStatus( ECacheUpdateContactModified, 0 );
+            break;
+        case EPsKeyContactAddedCounter:
+            iRequestHandler.NotifyCachingStatus( ECacheUpdateContactAdded, 0 );
+            break;
+        default:
+            break;
+        }
+    }
+
+// end of file
--- a/predictivesearch/PcsUtils/src/CPsData.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/PcsUtils/src/CPsData.cpp	Tue May 25 12:26:45 2010 +0300
@@ -336,12 +336,13 @@
 // ----------------------------------------------------------------------------
 EXPORT_C TBool CPsData::CompareById(const CPsData& aObject1, const CPsData& aObject2)
 {
-	if(aObject1.Id() == aObject2.Id())
-	{
-		return ETrue;
-	}
-	
-	return EFalse;
+    // Both Id() and UriId() must match if data objects represent the same contact.    
+    // Values of Id() are guaranteed to be unique only within one store. 
+    if ( aObject1.Id() == aObject2.Id() && aObject1.UriId() == aObject2.UriId() )  
+        {      
+            return ETrue;       
+        }        
+    return EFalse;
 }
 
 
--- a/predictivesearch/adapters/contacts/group/pscontactdatastore.mmp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/group/pscontactdatastore.mmp	Tue May 25 12:26:45 2010 +0300
@@ -40,7 +40,7 @@
 SOURCEPATH      ../src
 SOURCE          proxy.cpp
 SOURCE          cpcscontactfetch.cpp
-SOURCE 		CPsContactDataAdapter.cpp
+SOURCE          CPsContactDataAdapter.cpp
 SOURCE          cpcscontactstore.cpp
 
 USERINCLUDE     ../inc
@@ -54,7 +54,7 @@
 
 LIBRARY         flogger.lib
 LIBRARY         bafl.lib
-LIBRARY	    	PcsUtils.lib
+LIBRARY         PcsUtils.lib
 LIBRARY         VPbkEng.lib
 LIBRARY         centralrepository.lib
 LIBRARY         FeatMgr.lib
--- a/predictivesearch/adapters/contacts/inc/CPsContactDataAdapter.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/inc/CPsContactDataAdapter.h	Tue May 25 12:26:45 2010 +0300
@@ -44,7 +44,7 @@
 	    /**
 		 * Two phase construction
 		 */
-		static CPsContactDataAdapter* NewL(TAny* aPsDataPluginParameters);
+		static CPsContactDataAdapter* NewL( TAny* aPsDataPluginParameters );
 
         /**
 		 * Destructor
@@ -59,12 +59,12 @@
 	    * to the algorithm is provided via the observer callback 
 	    * @param aDataStoreURI - The store from which data is requested
 	    */
-		void  RequestForDataL(TDesC& aDataStoreURI );
+		void  RequestForDataL( TDesC& aDataStoreURI );
 		
 		/**
 	    * Checks if the given data store is supported.
 	    * @param aDataStoreURI - data store
-	    * @return True if this store is supported        
+	    * @return True if this store is supported
 	    */  
 	    TBool IsDataStoresSupportedL( TDesC& aDataStoreURI ) ;
 	          
@@ -74,13 +74,13 @@
 	    * @param aDataStores supported data stores URIs
 	    *         
 	    */  
-	    void GetSupportedDataStoresL( RPointerArray<TDesC> &aDataStoresURIs );
+	    void GetSupportedDataStoresL( RPointerArray<TDesC>& aDataStoresURIs );
 	    
 		/**
 	    * Gets the supported data fields.
-	    * @param aDataFields supported data fields.         
+	    * @param aDataFields supported data fields.
 	    */ 
-		void GetSupportedDataFieldsL(RArray<TInt> &aDataFields );
+		void GetSupportedDataFieldsL( RArray<TInt>& aDataFields );
 	
 	private:
 	
--- a/predictivesearch/adapters/contacts/inc/cpcscontactstore.h	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/inc/cpcscontactstore.h	Tue May 25 12:26:45 2010 +0300
@@ -282,6 +282,7 @@
         TInt  iAllContactLinksCount;
         TInt  iFetchedContactCount;
         TBool iContactViewReady;
+        TCachingStatus iOngoingCacheUpdate;
 
         /**
          * Variable to store the next state for the RunL to take appropriate action
--- a/predictivesearch/adapters/contacts/src/CPsContactDataAdapter.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/src/CPsContactDataAdapter.cpp	Tue May 25 12:26:45 2010 +0300
@@ -28,20 +28,20 @@
 // CPsContactDataAdapter::NewL
 // Two Phase Construction
 // ----------------------------------------------------------------------------
-CPsContactDataAdapter* CPsContactDataAdapter::NewL(TAny* aPsDataPluginParameters)
+CPsContactDataAdapter* CPsContactDataAdapter::NewL( TAny* aPsDataPluginParameters )
 {
     PRINT ( _L("Enter CPsContactDataAdapter::NewL") );
-    
+
     // Get the PsData plugin parametrs
-    TPsDataPluginParams* params = reinterpret_cast<TPsDataPluginParams*>( aPsDataPluginParameters );
-	CPsContactDataAdapter* self = new ( ELeave ) CPsContactDataAdapter();
-	CleanupStack::PushL( self );
-	self->ConstructL(params->iDataStoreObserver, params->iStoreListObserver);
-	CleanupStack::Pop( self );
+    TPsDataPluginParams* params = static_cast<TPsDataPluginParams*>( aPsDataPluginParameters );
+    CPsContactDataAdapter* self = new ( ELeave ) CPsContactDataAdapter();
+    CleanupStack::PushL( self );
+    self->ConstructL(params->iDataStoreObserver, params->iStoreListObserver);
+    CleanupStack::Pop( self );
 
     PRINT ( _L("End CPsContactDataAdapter::NewL") );
-    
-	return self;
+
+    return self;
 }
 
 // ----------------------------------------------------------------------------
@@ -49,7 +49,7 @@
 // Two Phase Construction
 // ----------------------------------------------------------------------------
 CPsContactDataAdapter::CPsContactDataAdapter()
-{		
+{
     PRINT ( _L("Enter CPsContactDataAdapter::CPsContactDataAdapter") );
     PRINT ( _L("End CPsContactDataAdapter::CPsContactDataAdapter") );
 }
@@ -58,10 +58,10 @@
 // CPsContactDataAdapter::ConstructL
 // Two Phase Construction
 // ----------------------------------------------------------------------------
-void CPsContactDataAdapter::ConstructL(MDataStoreObserver* aObserverForDataStore,
-									   MStoreListObserver* aStoreListObserver)
+void CPsContactDataAdapter::ConstructL( MDataStoreObserver* aObserverForDataStore,
+                                        MStoreListObserver* aStoreListObserver )
 {
-    PRINT ( _L("Enter CPsContactDataAdapter::ConstructL") );   
+    PRINT ( _L("Enter CPsContactDataAdapter::ConstructL") );
     
     iContactFetcher = CPcsContactFetch::NewL(); 
      
@@ -69,11 +69,10 @@
     iStoreListObserver = aStoreListObserver;
     
     iContactFetcher->SetObserver(*iObserverForDataStore);	
-                
+    
     PRINT ( _L("End CPsContactDataAdapter::ConstructL") );
-} 
-	
-	
+}
+
 // ----------------------------------------------------------------------------
 // CPsContactDataAdapter::~CPsContactDataAdapter
 // Destructor
@@ -86,19 +85,18 @@
     
     PRINT ( _L("End CPsContactDataAdapter::~CPsContactDataAdapter") );
 }
-                                 
+
 // ----------------------------------------------------------------------------
 // CPsContactDataAdapter::RequestForDataL
 // 
 // ----------------------------------------------------------------------------
 void  CPsContactDataAdapter::RequestForDataL( TDesC& aDataStoreURI )
 {
-	PRINT ( _L("Enter CPsContactDataAdapter::RequestForDataL") );
+    PRINT ( _L("Enter CPsContactDataAdapter::RequestForDataL") );
 
-    iContactFetcher->RequestForDataL(aDataStoreURI);  	 	
+    iContactFetcher->RequestForDataL(aDataStoreURI);
 
-	PRINT ( _L("End CPsContactDataAdapter::RequestForDataL") );		     
-     
+    PRINT ( _L("End CPsContactDataAdapter::RequestForDataL") );
 }
 
 // ----------------------------------------------------------------------------
@@ -106,36 +104,35 @@
 // 
 // ----------------------------------------------------------------------------
 
-void CPsContactDataAdapter::GetSupportedDataStoresL( RPointerArray<TDesC> &aDataStoresURIs )
+void CPsContactDataAdapter::GetSupportedDataStoresL( RPointerArray<TDesC>& aDataStoresURIs )
 {
-	PRINT ( _L("Enter CPsContactDataAdapter::GetSupportedDataStoresL") );
-	
-	iContactFetcher->GetSupportedDataStoresL(aDataStoresURIs);
+    PRINT ( _L("Enter CPsContactDataAdapter::GetSupportedDataStoresL") );
 
-	PRINT ( _L("End CPsContactDataAdapter::GetSupportedDataStoresL") );
+    iContactFetcher->GetSupportedDataStoresL(aDataStoresURIs);
+
+    PRINT ( _L("End CPsContactDataAdapter::GetSupportedDataStoresL") );
 }
 
-
 // ----------------------------------------------------------------------------
 // CPsContactDataAdapter::IsDataStoresSupportedL
 // 
 // ----------------------------------------------------------------------------
 TBool CPsContactDataAdapter::IsDataStoresSupportedL( TDesC& aDataStoreURI ) 
 {
-	return iContactFetcher->IsDataStoresSupportedL(aDataStoreURI);
+    return iContactFetcher->IsDataStoresSupportedL(aDataStoreURI);
+}
 
-}
 // ----------------------------------------------------------------------------
 // CPsContactDataAdapter::GetSupportedDataFieldsL
 // 
 // ----------------------------------------------------------------------------
-void CPsContactDataAdapter::GetSupportedDataFieldsL(RArray<TInt> &aDataFields )
+void CPsContactDataAdapter::GetSupportedDataFieldsL( RArray<TInt>& aDataFields )
 {
-	PRINT ( _L("Enter CPsContactDataAdapter::GetSupportedDataFieldsL") );
-	
-	iContactFetcher->GetSupportedDataFieldsL(aDataFields );
-	
-	PRINT ( _L("End CPsContactDataAdapter::GetSupportedDataFieldsL") );
+    PRINT ( _L("Enter CPsContactDataAdapter::GetSupportedDataFieldsL") );
+
+    iContactFetcher->GetSupportedDataFieldsL(aDataFields );
+
+    PRINT ( _L("End CPsContactDataAdapter::GetSupportedDataFieldsL") );
 }
 
 // End of file
--- a/predictivesearch/adapters/contacts/src/cpcscontactfetch.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/src/cpcscontactfetch.cpp	Tue May 25 12:26:45 2010 +0300
@@ -100,7 +100,7 @@
 	CVPbkContactStoreUriArray* uriArray = CVPbkContactStoreUriArray::NewLC();
 	for(TInt i = 0; i< iUriFromCenrep.Count();i++)
 	{
-		uriArray->AppendL( TVPbkContactStoreUriPtr(iUriFromCenrep[i]->Des()));
+		uriArray->AppendL( TVPbkContactStoreUriPtr(*iUriFromCenrep[i]) );
 	}
 
 	// Create the instance of the contact manager
@@ -153,7 +153,7 @@
 }
 
 // ----------------------------------------------------------------------------
-// CPsContactDataAdapter::SetObserver
+// CPcsContactFetch::SetObserver
 // 
 // ----------------------------------------------------------------------------
 void CPcsContactFetch::SetObserver(MDataStoreObserver& aObserver)
@@ -162,7 +162,7 @@
 }
 
 // ----------------------------------------------------------------------------
-// CPsContactDataAdapter::GetSupportedDataStoresL
+// CPcsContactFetch::GetSupportedDataStoresL
 // 
 // ----------------------------------------------------------------------------
 void CPcsContactFetch::GetSupportedDataStoresL( RPointerArray<TDesC> &aDataStoresURIs )
@@ -177,7 +177,7 @@
 }
 
 // ----------------------------------------------------------------------------
-// CPsContactDataAdapter::RequestForDataL
+// CPcsContactFetch::RequestForDataL
 // 
 // ----------------------------------------------------------------------------
 void  CPcsContactFetch::RequestForDataL(TDesC& aDataStoreURI)
@@ -212,8 +212,8 @@
 {
 	PRINT ( _L("Enter CPcsContactFetch::StoreReady") );
 	iAtLeastOneStoreReady = ETrue;
-	if( iWait->IsStarted() ) 
-			iWait->AsyncStop();
+	if( iWait->IsStarted() )
+		iWait->AsyncStop();
 	
 	PRINT ( _L("End CPcsContactFetch::StoreReady") );
 }
@@ -278,7 +278,6 @@
 	{
 		if( iWait->IsStarted() ) 
 			iWait->AsyncStop();
-    	 	
 	}
 }
 
@@ -297,26 +296,29 @@
 void CPcsContactFetch::ReadUrisFromCenrepL()
 {
     
-    CRepository *repository = CRepository::NewL( KCRUidPSContacts );
+    CRepository* repository = CRepository::NewL( KCRUidPSContacts );
+    CleanupStack::PushL( repository );
     
     // Read the cenrep for URIs	
-    TBuf<KCRMaxLen> UriStr;
+    TBuf<KCRMaxLen> uriStr;
     for (TInt i(KUriCenRepStartKey); i < KUriCenRepStartKey + KCenrepUriSupportedCount; i++ )
     {
-	    TInt err = repository->Get(i, UriStr );
-	    if (KErrNone != err)
-	    {
-		    break;
-	    }
-	    
-	    if (UriStr != KNullDesC)
-	    {
-		    iUriFromCenrep.Append(UriStr.AllocL());
-	    }
-	    		
+        TInt err = repository->Get( i, uriStr );
+        if (KErrNone != err)
+        {
+            break;
+        }
+        
+        if (uriStr != KNullDesC)
+        {
+            HBufC* uri = uriStr.AllocLC();
+            iUriFromCenrep.AppendL(uri);
+            CleanupStack::Pop(uri);
+        }
+    
     }
     
-    delete repository;
+    CleanupStack::PopAndDestroy( repository );
 }
 
 
@@ -331,20 +333,20 @@
 	{
 		if( ! (iWait->IsStarted()) ) 
 	    {
-	    	iWait->Start();			        	
+	    	iWait->Start();
 	    }
 	}
 	
 	// Check if data store is already present
-	for ( int i = 0; i < iAllDataStores.Count(); i++ )
+	for ( TInt i = 0; i < iAllDataStores.Count(); i++ )
 	{
 	    CPcsContactStore* contactStore = iAllDataStores[i];
 		if ( contactStore->GetStoreUri().Compare(aDataStoreURI) == 0 )
 		{
 		    // Remove the store
 		    delete contactStore;
-			iAllDataStores.Remove(i);	
-			break;		
+			iAllDataStores.Remove(i);
+			break;
 		}
 	}
 	
@@ -356,12 +358,12 @@
         	CPcsContactStore* contactStore = CPcsContactStore::NewL(*iContactManager,
 		                                                        *iObserver,
 		                                                        stores.At(i).StoreProperties().Uri().UriDes());
-			iAllDataStores.Append(contactStore);	
+			iAllDataStores.Append(contactStore);
 			break;
         }
 	}
 	PRINT ( _L("End CPcsContactFetch::CreateSubStoresL") );
-			  
+	
 }
 
 // ----------------------------------------------------------------------------
@@ -387,7 +389,7 @@
 	    {
 		   aDataFields.Append(fieldToCache);
 	    }
-	    		
+	
     }
     
     delete repository; 
@@ -401,9 +403,9 @@
 TBool CPcsContactFetch::IsDataStoresSupportedL( TDesC& aDataStoreURI ) 
 {
 	
-	for(TInt i =0 ; i<iUriFromCenrep.Count();i++)
+	for ( TInt i = 0 ; i < iUriFromCenrep.Count() ; i++ )
 	{
-		if(iUriFromCenrep[i]->Des().Compare(aDataStoreURI) ==0)
+		if ( iUriFromCenrep[i]->Compare(aDataStoreURI) == 0 )
 		    return ETrue;
 	}
 	
--- a/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp	Tue May 25 12:26:45 2010 +0300
@@ -115,11 +115,10 @@
 {
     PRINT ( _L("Enter CPcsContactStore::ConstructL") );
     
-	iContactManager  = &aContactManager;
+	iContactManager = &aContactManager;
 	iObserver = &aObserver;
 	
-	iUri = HBufC::NewL(aUri.Length());
-	iUri->Des().Copy(aUri);
+	iUri = aUri.AllocL();
 	
 	// create containers for holding the sim data
     iSimContactItems = CVPbkContactLinkArray::NewL();
@@ -200,8 +199,11 @@
 		case TVPbkContactStoreEvent::EContactAdded:
 		{
 		    PRINT ( _L("Add contact/group event received") );
-		    iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink),
-	                                           *this);
+		    
+		    // Observer will be notified once the cache update is complete
+		    iOngoingCacheUpdate = ECacheUpdateContactAdded;
+		                    
+		    iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink), *this );
 			break;
 		}
 		
@@ -243,7 +245,7 @@
 				{
 				    // We are not removing from the array cache. If you try to fetch, 
 				    // then it will give an error
-				    TInt index = CreateCacheIDfromSimArrayIndex (contactLocation);
+				    TInt index = CreateCacheIDfromSimArrayIndex( contactLocation );
 				    
 	                iObserver->RemoveData(*iUri,index );
 		       	}
@@ -265,8 +267,16 @@
 	        if (( aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactChanged ) ||
 	            ( aStoreEvent.iEventType == TVPbkContactStoreEvent::EGroupChanged ) )
 	        {
-	  		    // Add the contact
-	  		   iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink), *this );
+	            // Observer will be notified once the cache update is complete
+	            iOngoingCacheUpdate = ECacheUpdateContactModified;
+	            
+	            // Add the contact
+	            iContactManager->RetrieveContactL( *(aStoreEvent.iContactLink), *this );
+	        }
+	        else
+	        {
+	            // Inform observer immediately about contact removal
+                iObserver->UpdateCachingStatus( *iUri, ECacheUpdateContactRemoved );
 	        }
 	        
 			break;
@@ -363,20 +373,21 @@
 // ---------------------------------------------------------------------------
 void CPcsContactStore::HandleRetrievedContactL(MVPbkStoreContact* aContact)
 {    
+    // Take the ownership
+    aContact->PushL();
+
     if ( iMyCardSupported && IsMyCard( *aContact ) )
         {
+        CleanupStack::PopAndDestroy( 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 )
+    if ( NULL == tmpLink )
     {
         CleanupStack::PopAndDestroy( aContact );
         return;
@@ -402,7 +413,7 @@
         // Get the index of the SIM contact
         TInt tempIndex =  iSimContactItems->Find(*tmpLink);	
 		
-		if( KErrNotFound == tempIndex)
+		if ( KErrNotFound == tempIndex)
 		    {
 		    tempIndex = iSimContactItems->Count();
 	        iSimContactItems->AppendL(tmpLink);
@@ -443,21 +454,21 @@
 	    // Fetch the group name 
 	    HBufC* groupName = myContactGroup->GroupLabel().AllocLC();
 	    TInt grpArrayIndex = -1; 
-	    for(TInt i =0; i  <iFieldsToCache.Count(); i++)
+	    for (TInt i =0; i  <iFieldsToCache.Count(); i++)
 	    {
-	    	if(iFieldsToCache[i] == R_VPBK_FIELD_TYPE_LASTNAME)
+	    	if (iFieldsToCache[i] == R_VPBK_FIELD_TYPE_LASTNAME)
 			{
 			    grpArrayIndex = i;
 			}
 			phoneContact->SetDataL(i, KNullDesC);
 	    }
-	    if(grpArrayIndex != -1)
+	    if (grpArrayIndex != -1)
 	    {
 	    	phoneContact->SetDataL(grpArrayIndex, *groupName);
 	    
             // Check for the contact in the group.
             MVPbkContactLinkArray* contactsContainedInGroup = myContactGroup->ItemsContainedLC();
-            for(TInt i = 0; i < contactsContainedInGroup->Count(); i++)
+            for (TInt i = 0; i < contactsContainedInGroup->Count(); i++)
             {
                 TInt grpContactId = converter->LinkToIdentifier(contactsContainedInGroup->At(i));
                 phoneContact->AddIntDataExtL(grpContactId);
@@ -485,9 +496,16 @@
 	converter = NULL;
 
 	CleanupStack::PopAndDestroy(aContact);
+	
+	// Inform observer if this contact addition was a result of contact store event.
+	if ( iOngoingCacheUpdate == ECacheUpdateContactModified ||
+	     iOngoingCacheUpdate == ECacheUpdateContactAdded )
+	    {
+        iObserver->UpdateCachingStatus( *iUri, iOngoingCacheUpdate );
+        iOngoingCacheUpdate = ECachingComplete;
+	    }
 }
- 
-    
+
 // ---------------------------------------------------------------------------
 // Fetches the data from a particular contact 
 // --------------------------------------------------------------------------- 
@@ -507,11 +525,11 @@
 // Add the data from contact fields
 // --------------------------------------------------------------------------- 
 void CPcsContactStore::AddContactFieldsL( MVPbkBaseContact& aContact,
-                                          TInt afieldtype,
+                                          TInt aFieldType,
                                           CPsData *aPhoneData)
 {
-	const MVPbkFieldType*  myContactDataField = 
-		iContactManager->FieldTypes().Find( afieldtype );
+	const MVPbkFieldType* myContactDataField = 
+		iContactManager->FieldTypes().Find( aFieldType );
 
 	CVPbkBaseContactFieldTypeIterator* itr = 
 		CVPbkBaseContactFieldTypeIterator::NewLC( *myContactDataField, 
@@ -528,9 +546,9 @@
 				MVPbkContactFieldTextData::Cast( field->FieldData() );
 			
 			//If the field exist in iFieldsToCache, then set it
-			for( TInt i = 0 ; i< iFieldsToCache.Count(); i++)
+			for ( TInt i = 0 ; i< iFieldsToCache.Count(); i++ )
 			{
-				if(afieldtype == iFieldsToCache[i])
+				if (aFieldType == iFieldsToCache[i])
 				{	
                     // Check if the field has any data entry. If so
                     // concatenate the next data to the existing one.
@@ -547,7 +565,7 @@
                         newDataPtr.Append(KSpaceCharacter);
                         newDataPtr.Append(data.Text());
                         aPhoneData->SetDataL(i,*newData);
-                        CleanupStack::PopAndDestroy(); // newData
+                        CleanupStack::PopAndDestroy(newData);
                     }
                     else
                     {
@@ -769,7 +787,7 @@
         CleanupStack::Pop(); // iContactViewBase       
     }
 	else
-	{        
+	{
 		// Create sort order with the fields from cenrep
 		CreateSortOrderL(iContactManager->FieldTypes());
 		
@@ -850,27 +868,25 @@
 // ---------------------------------------------------------------------------------
 void CPcsContactStore::ReadFieldsToCacheFromCenrepL()
 {
-	CRepository *repository = CRepository::NewL( KCRUidPSContacts );
+    CRepository* repository = CRepository::NewL( KCRUidPSContacts );
 
     // Read the data fields from cenrep
     for (TInt i(KCenrepFieldsStartKey); i < KCenrepFieldsStartKey + KCenrepNumberOfFieldsCount; i++ )
     {
-	TInt fieldToCache (-1);
-	    TInt err = repository->Get(i, fieldToCache );
-	    
-	    if ( KErrNone != err )
-	    {
-		    break;
-	    }
-	    if ( fieldToCache != 0 )
-	    {
-		    iFieldsToCache.Append(fieldToCache);
-	    }
-	    		
+        TInt fieldToCache (-1);
+        TInt err = repository->Get(i, fieldToCache );
+        
+        if ( KErrNone != err )
+        {
+            break;
+        }
+        if ( fieldToCache != 0 )
+        {
+            iFieldsToCache.Append(fieldToCache);
+        }
     }
     
     delete repository;
-    
 }
 
 // ---------------------------------------------------------------------------------
@@ -922,6 +938,7 @@
 	}
 	
 }
+
 // ---------------------------------------------------------------------------------
 // Checks MyCard extension of contact
 // ---------------------------------------------------------------------------------
@@ -934,7 +951,7 @@
     MVPbkBaseContact& contact = const_cast<MVPbkBaseContact&>( aContact );
     TAny* extension = contact.BaseContactExtension( KVPbkBaseContactExtension2Uid );
 
-    if( extension )
+    if ( extension )
         {
         MVPbkBaseContact2* baseContactExtension = static_cast<MVPbkBaseContact2*>( extension );
         TInt error( KErrNone );
--- a/predictivesearch/sis/cenrep.pkg	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/sis/cenrep.pkg	Tue May 25 12:26:45 2010 +0300
@@ -33,5 +33,5 @@
 
 ; -------- files --------
 
-"\epoc32\data\Z\private\10202BE9\2000B5C6.txt" 			-"!:\Private\10202BE9\2000B5C6.txt"
-"\epoc32\data\Z\private\10202BE9\2000B5C5.txt" 			-"!:\Private\10202BE9\2000B5C5.txt"
+"\epoc32\data\Z\private\10202BE9\2000B5C6.txt" - "!:\Private\10202BE9\2000B5C6.txt"
+"\epoc32\data\Z\private\10202BE9\2000B5C5.txt" - "!:\Private\10202BE9\2000B5C5.txt"
--- a/predictivesearch/sis/makesis_urel.bat	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/sis/makesis_urel.bat	Tue May 25 12:26:45 2010 +0300
@@ -14,23 +14,5 @@
 rem Description:
 rem
 
-@echo off
-set /p userin= What is your release [3.2/5.0]? :
-set tmp_path=%PATH%
-set path=\epoc32\tools\cenrep;%PATH%
-FOR /R "." %%i IN (cenrep.bat) DO set curdrive=%%~di
-\epoc32\tools\cenrep\generate_cenrep_inifile.pl -r %userin% -d ..\adapters\contacts\cenrep -f 4
-\epoc32\tools\cenrep\generate_cenrep_inifile.pl -r %userin% -d ..\PcsAlgorithm\Algorithm1\cenrep -f 4
-
-copy 2000B5C6.txt \epoc32\data\Z\private\10202be9\2000B5C6.txt 
-copy 2000B5C5.txt \epoc32\data\Z\private\10202be9\2000B5C5.txt
-
-set path=%tmp_path%
-
-@echo on
-
-makesis cenrep.pkg
-signsis cenrep.sis cenrep.sisx rd.cer rd-key.pem
-
 makesis pcs_urel.pkg
 signsis pcs_urel.sis pcs_urel.sisx rd.cer rd-key.pem
--- a/predictivesearch/sis/pcs_udeb.pkg	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/sis/pcs_udeb.pkg	Tue May 25 12:26:45 2010 +0300
@@ -29,23 +29,21 @@
 :"Nokia"
 
 ; Predictive Search Engine files to be installed
-"\epoc32\release\armv5\udeb\PsServerClientAPI.dll" 	- "!:\sys\bin\PsServerClientAPI.dll"
-"\epoc32\release\armv5\udeb\PcsUtils.dll" 		- "!:\sys\bin\PcsUtils.dll"
+"\epoc32\release\armv5\udeb\PsServerClientAPI.dll"       - "!:\sys\bin\PsServerClientAPI.dll"
+"\epoc32\release\armv5\udeb\PcsUtils.dll"                - "!:\sys\bin\PcsUtils.dll"
 
 ; PS Algorithm1
-"\epoc32\release\armv5\udeb\PcsAlgorithm1.dll" 		- "!:\sys\bin\PcsAlgorithm1.dll"
-"\epoc32\data\z\resource\plugins\PcsAlgorithm1.rsc" 	- "!:\resource\plugins\PcsAlgorithm1.rsc"
+"\epoc32\release\armv5\udeb\PcsAlgorithm1.dll"           - "!:\sys\bin\PcsAlgorithm1.dll"
+"\epoc32\data\z\resource\plugins\PcsAlgorithm1.rsc"      - "!:\resource\plugins\PcsAlgorithm1.rsc"
 
 ; PS Algorithm2
-"\epoc32\release\armv5\udeb\PcsAlgorithm2.dll" 		- "!:\sys\bin\PcsAlgorithm2.dll"
-"\epoc32\data\z\resource\plugins\PcsAlgorithm2.rsc" 	- "!:\resource\plugins\PcsAlgorithm2.rsc"
-
+"\epoc32\release\armv5\udeb\PcsAlgorithm2.dll"           - "!:\sys\bin\PcsAlgorithm2.dll"
+"\epoc32\data\z\resource\plugins\PcsAlgorithm2.rsc"      - "!:\resource\plugins\PcsAlgorithm2.rsc"
 
 ; PS Server
-"\epoc32\release\armv5\udeb\PcsServer.exe" 		- "!:\sys\bin\PcsServer.exe"
+"\epoc32\release\armv5\udeb\PcsServer.exe"               - "!:\sys\bin\PcsServer.exe"
 
 ; PS Contacts Data Store Adapter
-"\epoc32\release\armv5\udeb\pscontactdatastore.dll" 	- "!:\sys\bin\pscontactdatastore.dll"
+"\epoc32\release\armv5\udeb\pscontactdatastore.dll"      - "!:\sys\bin\pscontactdatastore.dll"
 "\epoc32\data\z\resource\plugins\pscontactdatastore.rsc" - "!:\resource\plugins\pscontactdatastore.rsc"
-"\epoc32\data\z\resource\contactsort.rsc" 		- "!:\resource\contactsort.rsc"
-
+"\epoc32\data\z\resource\contactsort.rsc"                - "!:\resource\contactsort.rsc"
--- a/predictivesearch/sis/pcs_urel.pkg	Tue May 11 16:00:21 2010 +0300
+++ b/predictivesearch/sis/pcs_urel.pkg	Tue May 25 12:26:45 2010 +0300
@@ -29,24 +29,21 @@
 :"Nokia"
 
 ; Predictive Search Engine files to be installed
-"\epoc32\release\armv5\urel\PsServerClientAPI.dll" 	- "!:\sys\bin\PsServerClientAPI.dll"
-"\epoc32\release\armv5\urel\PcsUtils.dll" 		- "!:\sys\bin\PcsUtils.dll"
+"\epoc32\release\armv5\urel\PsServerClientAPI.dll"       - "!:\sys\bin\PsServerClientAPI.dll"
+"\epoc32\release\armv5\urel\PcsUtils.dll"                - "!:\sys\bin\PcsUtils.dll"
 
 ; PS Algorithm1
-"\epoc32\release\armv5\urel\PcsAlgorithm1.dll" 		- "!:\sys\bin\PcsAlgorithm1.dll"
-"\epoc32\data\z\resource\plugins\PcsAlgorithm1.rsc" 	- "!:\resource\plugins\PcsAlgorithm1.rsc"
-
+"\epoc32\release\armv5\urel\PcsAlgorithm1.dll"           - "!:\sys\bin\PcsAlgorithm1.dll"
+"\epoc32\data\z\resource\plugins\PcsAlgorithm1.rsc"      - "!:\resource\plugins\PcsAlgorithm1.rsc"
 
 ; PS Algorithm2
-"\epoc32\release\armv5\urel\PcsAlgorithm2.dll" 		- "!:\sys\bin\PcsAlgorithm2.dll"
-"\epoc32\data\z\resource\plugins\PcsAlgorithm2.rsc" 	- "!:\resource\plugins\PcsAlgorithm2.rsc"
+"\epoc32\release\armv5\urel\PcsAlgorithm2.dll"           - "!:\sys\bin\PcsAlgorithm2.dll"
+"\epoc32\data\z\resource\plugins\PcsAlgorithm2.rsc"      - "!:\resource\plugins\PcsAlgorithm2.rsc"
 
 ; PS Server
-"\epoc32\release\armv5\urel\PcsServer.exe" 		- "!:\sys\bin\PcsServer.exe"
+"\epoc32\release\armv5\urel\PcsServer.exe"               - "!:\sys\bin\PcsServer.exe"
 
 ; PS Contacts Data Store Adapter
-"\epoc32\release\armv5\urel\pscontactdatastore.dll" 	- "!:\sys\bin\pscontactdatastore.dll"
+"\epoc32\release\armv5\urel\pscontactdatastore.dll"      - "!:\sys\bin\pscontactdatastore.dll"
 "\epoc32\data\z\resource\plugins\pscontactdatastore.rsc" - "!:\resource\plugins\pscontactdatastore.rsc"
-"\epoc32\data\z\resource\contactsort.rsc" 		- "!:\resource\contactsort.rsc"
-; cenrep package
-@"cenrep.sisx",(0x10202BE9)
+"\epoc32\data\z\resource\contactsort.rsc"                - "!:\resource\contactsort.rsc"