Revision: 201003 RCL_3 PDK_3.0.h
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 19 Feb 2010 22:40:27 +0200
branchRCL_3
changeset 3 04ab22b956c2
parent 0 e686773b3f54
child 5 81f8547efd4f
Revision: 201003 Kit: 201007
contacts_plat/phonebook_2_commands_api/inc/Pbk2Commands.hrh
contacts_plat/phonebook_2_image_management_api/inc/TPbk2ImageManagerParams.h
contacts_plat/phonebook_2_store_property_api/inc/Pbk2ContentIdentifiers.hrh
contacts_plat/phonebook_thumbnails_api/inc/CPbkThumbnailManager.h
logsui/AocCtViewSrc/CLogsEtelBase.cpp
logsui/AocCtViewSrc/CLogsMMEAocUtil.cpp
logsui/AppSrc/CLogsAppUi.cpp
logsui/AppSrc/CLogsBaseView.cpp
logsui/AppSrc/CLogsRecentListView.cpp
logsui/AppSrc/CLogsSubAppListControlContainer.cpp
logsui/group/Common.rss
phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStore.cpp
phonebookengines/VirtualPhonebook/VPbkEng/src/TVPbkStoreContactAnalyzer.cpp
phonebookengines/VirtualPhonebook/VPbkEng/src/VPbkUtils.cpp
phonebookengines/contactsmodel/cntdbdumper/group/dbdumper.mmp
phonebookengines/contactsmodel/cntplsql/src/csqlitelocalview.cpp
phonebookengines/contactsmodel/src/CNTITEM.CPP
phonebookengines/contactsmodel/tsrc/Integration/TestStartUp/group/10003A73.txt
phonebookengines/contactsmodel/tsrc/TestSyncPlugIn/cntsyncchecker.mmp
phonebookui/Phonebook/BCardEng/src/CBCardThumbnailHandler.cpp
phonebookui/Phonebook/View/inc/CPbkFieldAnalyzer.h
phonebookui/Phonebook/View/inc/CPbkThumbnailManagerImpl.h
phonebookui/Phonebook/View/src/CPbkFieldAnalyzer.cpp
phonebookui/Phonebook/View/src/CPbkSelectFieldDlg.cpp
phonebookui/Phonebook/inc/PhonebookExternalCRKeys.h
phonebookui/Phonebook2/Application/rss/Pbk2MenuResources.rss
phonebookui/Phonebook2/BWINS/Pbk2PresentationU.DEF
phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF
phonebookui/Phonebook2/Commands/rss/NamesListView.rss
phonebookui/Phonebook2/CommandsExtension/inc/CPbk2MergeContactsCmd.h
phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyContactsCmd.cpp
phonebookui/Phonebook2/CommandsExtension/src/CPbk2DeleteContactsCmd.cpp
phonebookui/Phonebook2/CommandsExtension/src/CPbk2GoToURLCmd.cpp
phonebookui/Phonebook2/CommandsExtension/src/CPbk2MergeContactsCmd.cpp
phonebookui/Phonebook2/CommonUI/src/CPbk2RingingToneFetch.cpp
phonebookui/Phonebook2/EABI/Pbk2PresentationU.DEF
phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF
phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NameslistUiControlExtension.h
phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExView.h
phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h
phonebookui/Phonebook2/NamesListExtension/inc/cpbk2deletemycardcmd.h
phonebookui/Phonebook2/NamesListExtension/inc/cpbk2mycard.h
phonebookui/Phonebook2/NamesListExtension/rss/Pbk2ExNamesListRes.rss
phonebookui/Phonebook2/NamesListExtension/src/CPbk2NameslistUiControlExtension.cpp
phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp
phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp
phonebookui/Phonebook2/NamesListExtension/src/Pbk2NlxMenuFiltering.cpp
phonebookui/Phonebook2/NamesListExtension/src/cpbk2cmditemmycard.cpp
phonebookui/Phonebook2/NamesListExtension/src/cpbk2deletemycardcmd.cpp
phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp
phonebookui/Phonebook2/NewContactLauncher/data/NewContactLauncher.rss
phonebookui/Phonebook2/Presentation/inc/CPbk2ImageManagerImpl.h
phonebookui/Phonebook2/Presentation/rss/Pbk2PresentationCommon.rss
phonebookui/Phonebook2/Presentation/src/CPbk2ContactViewBuilder.cpp
phonebookui/Phonebook2/Presentation/src/CPbk2ImageReader.cpp
phonebookui/Phonebook2/Presentation/src/CPbk2ImageWriterBase.cpp
phonebookui/Phonebook2/Presentation/src/CPbk2StoreProperty.cpp
phonebookui/Phonebook2/Presentation/src/Pbk2PresentationUtils.cpp
phonebookui/Phonebook2/ServerApplication/inc/CPbk2SelectSinglePropertyPhase.h
phonebookui/Phonebook2/ServerApplication/inc/CPbk2ServerAppStoreManager.h
phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppStoreManager.cpp
phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h
phonebookui/Phonebook2/UIControls/inc/cpbk2doublelistboxmodelcmddecorator.h
phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss
phonebookui/Phonebook2/UIControls/rss/Pbk2Selectors.rss
phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorFieldArray.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2MergePhotoConflictDlg.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2PredictiveSearchFilter.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2StoreInfoItemBuilder.cpp
phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp
phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp
phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp
phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxitemdrawer.cpp
phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp
phonebookui/Phonebook2/UIServices/src/CPbk2AiwSelectionProvider.cpp
phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimInformation.rss
phonebookui/Phonebook2/USIMExtension/src/CPsu2SecUi.cpp
phonebookui/Phonebook2/USIMThinExtension/src/CPsu2ThinUIExtensionPlugin.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/group/ccappcommlauncherplugin.mmp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistbox.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheadercontrol.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheaders.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherimagedecoding.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchersetdefault.h
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherimagedecoding.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp
phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchersetdefault.cpp
phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/inc/ccappdetailsviewmenuhandler.h
phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewlistboxmodel.cpp
phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewmenuhandler.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.hrh
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardheadercontrol.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardimageloader.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardimageloader.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxmodel.cpp
phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp
phonebookui/Phonebook2/ccapplication/ccapp/ccaclient/src/ccaconnection.cpp
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/group/ccapputil.mmp
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccafactoryextensionnotifier.h
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappimagedecoding.h
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccafactoryextensionnotifier.cpp
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappimagedecoding.cpp
phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp
phonebookui/Phonebook2/group/Pbk2Presentation.mmp
phonebookui/Phonebook2/group/Pbk2UIControls.mmp
phonebookui/Phonebook2/help/data/xhtml.zip
phonebookui/Phonebook2/help/inc/phob.hlp.hrh
phonebookui/Phonebook2/inc/CPbk2ContactViewBuilder.h
phonebookui/Phonebook2/inc/CPbk2MergePhotoConflictDlg.h
phonebookui/Phonebook2/inc/CPbk2NamesListControl.h
phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h
phonebookui/Phonebook2/inc/Pbk2PresentationUtils.h
phonebookui/Phonebook2/inc/spbcontentprovider.h
phonebookui/Phonebook2/loc/phonebook2.loc
phonebookui/Phonebook2/loc/phonebook2ece.loc
phonebookui/Phonebook2/remotecontactlookup/contactactionservice/callplugin/src/cfsccallpluginimpl.cpp
phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactstorelistener.h
phonebookui/Phonebook2/spbcontentprovider/inc/spbcontent.h
phonebookui/Phonebook2/spbcontentprovider/inc/spbphonenumberparser.h
phonebookui/Phonebook2/spbcontentprovider/src/spbcontactstorelistener.cpp
phonebookui/Phonebook2/spbcontentprovider/src/spbcontent.cpp
phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp
phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp
phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp
phonebookui/Speeddial/ControlSrc/SpdiaGrid.cpp
phonebookui/Speeddial/ControlSrc/SpdiaGridDlg.cpp
phonebookui/Speeddial/VPbkControlSrc/SpdiaGridDlgVPbk.cpp
phonebookui/Speeddial/VPbkControlSrc/SpdiaGridVPbk.cpp
phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp
phonebookui/Speeddial/speeddialgsplugin/inc/speeddialgsplugin.h
phonebookui/Speeddial/speeddialgsplugin/src/speeddialgsplugin.cpp
phonebookui/Speeddial/src/SpdiaCallingVmbxView.cpp
phonebookui/Speeddial/src/SpdiaView.cpp
pimprotocols/mtpcontactdp/documentation/PREQ1260ComponentDesign-all.eap
pimprotocols/phonebooksync/Test/TE_Sync/TE_Sync_Config.txt
predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp
predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp
predictivesearch/PcsAlgorithm/group/bld.inf
--- a/contacts_plat/phonebook_2_commands_api/inc/Pbk2Commands.hrh	Tue Feb 02 10:12:17 2010 +0200
+++ b/contacts_plat/phonebook_2_commands_api/inc/Pbk2Commands.hrh	Fri Feb 19 22:40:27 2010 +0200
@@ -162,6 +162,7 @@
     EPbk2NoteCheckingContacts,
     EPbk2NoteContactsRetrievingProgressBar,
     EPbk2NoteContactsSaving,
+    EPbk2NoteContactsSynchronizing,
 
     /// Note range allocated to Group UI Extension
     EGroupUiExtensionFirstNoteId = 100,
--- a/contacts_plat/phonebook_2_image_management_api/inc/TPbk2ImageManagerParams.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/contacts_plat/phonebook_2_image_management_api/inc/TPbk2ImageManagerParams.h	Fri Feb 19 22:40:27 2010 +0200
@@ -42,7 +42,13 @@
 
             /// Fast scaling of the image close, but not excactly to desired
             /// size (always keeps aspect ratio).
-            EUseFastScaling  = 0x0004
+            EUseFastScaling  = 0x0004,
+
+            /// Crop landscape image to square, before thumbnail is scaled.
+            ECropImage       = 0x0008,
+
+            /// Speed optimized algorithm is used for scaling. @See AknIconUtils::ScaleBitmapL
+            EUseSpeedOptimizedScaling  = 0x0010			
             };
 
     public: // Interface
--- a/contacts_plat/phonebook_2_store_property_api/inc/Pbk2ContentIdentifiers.hrh	Tue Feb 02 10:12:17 2010 +0200
+++ b/contacts_plat/phonebook_2_store_property_api/inc/Pbk2ContentIdentifiers.hrh	Fri Feb 19 22:40:27 2010 +0200
@@ -28,7 +28,9 @@
     /// Phonebook 2 memory info dialog (store name)
     EPbk2MemInfoPhone,
     /// Phonebook 2 copy query item (store name)
-    EPbk2CopyQueryItem
+    EPbk2CopyQueryItem,
+    /// Phonebook 2 memory info contacts dialog (store name)
+    EPbk2MemInfoContacts
     };
 
 #endif // PBK2CONTENTIDENTIFIERS_HRH
--- a/contacts_plat/phonebook_thumbnails_api/inc/CPbkThumbnailManager.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/contacts_plat/phonebook_thumbnails_api/inc/CPbkThumbnailManager.h	Fri Feb 19 22:40:27 2010 +0200
@@ -25,7 +25,7 @@
 
 // CONSTANTS
 /// Size of thumbnail images stored to Phonebook contacts
-#define KPbkPersonalImageSize TSize(80,96)
+#define KPbkPersonalImageSize TSize(150,150)
 
 //  FORWARD DECLARATIONS
 class CPbkContactEngine;
--- a/logsui/AocCtViewSrc/CLogsEtelBase.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AocCtViewSrc/CLogsEtelBase.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,7 @@
 #include <etelmm.h>
 #include <mmtsy_names.h>
 #include <secui.h>
-#include <SecUiSecurityHandler.h>
+#include <secuisecurityhandler.h>
 
 
 #include "CLogsEtelBase.h"
--- a/logsui/AocCtViewSrc/CLogsMMEAocUtil.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AocCtViewSrc/CLogsMMEAocUtil.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -21,7 +21,7 @@
 #include <e32svr.h>
 
 #include <secui.h>
-#include <SecUiSecurityHandler.h>
+#include <secuisecurityhandler.h>
 #include <SecUi.rsg>
 
 #include <exterror.h>
--- a/logsui/AppSrc/CLogsAppUi.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AppSrc/CLogsAppUi.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -260,13 +260,21 @@
     //This is needed if we lose foreground and later gain it from AppShell to AppListView. 
     //Because of EMSH-6JDFBV it's also better not try do the below in HandleLosingForeground()
     //so we need to accept a minor performance penalty of executing the below already here.
-    if( ! View( TUid::Uid( ELogAppListViewId ) ) )  
+    if( ! View( TUid::Uid( ELogAppListViewId ) ) && !FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )  
         {
         CAknView* logsView = CLogsAppListView::NewL();    
         CleanupStack::PushL(logsView);
         AddViewL( logsView );       //takes ownership
         CleanupStack::Pop(logsView);   
         }
+    else if ( ! View( TUid::Uid( ELogSubAppListViewId ) ) && FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
+        {
+        // When simple mode enabled, provide SubAppListView here.
+        CAknView* logsView = CLogsSubAppListView::NewL();    
+        CleanupStack::PushL(logsView);
+        AddViewL( logsView );       //takes ownership
+        CleanupStack::Pop(logsView);
+        }
         
     TRACE_EXIT_POINT;
     }
@@ -689,7 +697,14 @@
             if (ExecutionMode() == ELogsInBackground_ExitOrEndPressed && ResetViewOnFocusRegain())
                 {
                 SetResetViewOnFocusRegain(EFalse); // prevent further view switches
-                ActivateLogsViewL(ELogAppListViewId);
+                if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
+                    {
+                    ActivateLogsViewL( ELogSubAppListViewId );
+                    }
+                else
+                    {
+                    ActivateLogsViewL( ELogAppListViewId );
+                    }    
                 }
            
             CAknAppUi::HandleWsEventL( aEvent, aDestination );                    
--- a/logsui/AppSrc/CLogsBaseView.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AppSrc/CLogsBaseView.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -2329,6 +2329,7 @@
 
                 //For long press or single tap prefer video call but not for emergency calls
                 if( (aCommandId == ELogsCmdLongSendKeyCall ||
+                    aEvent->LogsEventData()->VT() &&
                     aCommandId == ELogsCmdSingleTapCall ) &&
                     aEvent->EventType() != ETypeEmerg )
                     {
--- a/logsui/AppSrc/CLogsRecentListView.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AppSrc/CLogsRecentListView.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -29,7 +29,7 @@
 #include <sendui.h> 
 #include <SendUiConsts.h>
 #include <TSendingCapabilities.h>
-#include <sendnorm.rsg>
+#include <Sendnorm.rsg>
 #include <Logs.rsg>
 #include <AiwCommon.hrh>                //KAiwCmdCall
 #include <AiwPoCParameters.h>           //TAiwPocParameterData
--- a/logsui/AppSrc/CLogsSubAppListControlContainer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/AppSrc/CLogsSubAppListControlContainer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -105,7 +105,10 @@
     if ( FeatureManager::FeatureSupported( KFeatureIdSimpleLogs ) )
         {
         // use alt. title and do not create navi decorator for simple logs
+        // Refresh navi pane to empty here to cover navi pane of RecentListView.
         MakeTitleL( R_LOGS_TITLE_TEXT );
+        NavigationTabGroupL( R_AVKON_STATUS_PANE_LAYOUT_EMPTY, 
+                             CLogsNaviDecoratorWrapper::InstanceL() );
         }
     else
         {
--- a/logsui/group/Common.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/logsui/group/Common.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -180,6 +180,7 @@
             {
             command = ELogsCmdShowMyAddress;                 //Show user's voip address
             txt = qtn_voip_show_my_address;
+            flags = EEikMenuItemSpecific;
             }
         };
     }
--- a/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStore.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactStore.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -680,6 +680,7 @@
     if ( err != KErrNone )
         {
         CCoeEnv::Static()->HandleError( err );
+        User::Leave(err);
         }
     CContactItem* newContact = CContactCard::NewLC();
     CContact* result = CContact::NewL(*this, newContact, ETrue);
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/TVPbkStoreContactAnalyzer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/TVPbkStoreContactAnalyzer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -274,12 +274,18 @@
                            T aSelector,
                            const CVPbkContactManager& aClassContactManager )
     {
+    TBool ret = EFalse;
     // Get the field type
     const MVPbkFieldType* fieldType =
         VPbkUtils::MatchFieldType( aClassContactManager.FieldTypes(), aField );
-    CVPbkFieldTypeSelector* selector = CreateSelectorLC( aSelector, aClassContactManager );
-    TBool ret = selector->IsFieldTypeIncluded( *fieldType );
-    CleanupStack::PopAndDestroy( );
+  
+    if ( fieldType )
+        {
+        CVPbkFieldTypeSelector* selector = CreateSelectorLC( aSelector,
+            aClassContactManager );
+        ret = selector->IsFieldTypeIncluded( *fieldType );
+        CleanupStack::PopAndDestroy();
+        }
     return ret;
     }
 
--- a/phonebookengines/VirtualPhonebook/VPbkEng/src/VPbkUtils.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/VPbkUtils.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -61,15 +61,19 @@
         const MVPbkBaseContactField& aField,
         TResourceReader& aResourceReader)
     {
+    TBool ret = EFalse;
     // Get aField's field type
     const MVPbkFieldType* fieldType = MatchFieldType(aFieldTypeList, 
             aField);
-
-    CVPbkFieldTypeSelector* selector = CVPbkFieldTypeSelector::NewL(
-            aResourceReader, aFieldTypeList);
-    // Check if the fields type is the one needed
-    TBool ret = selector->IsFieldTypeIncluded(*fieldType);
-    delete selector;
+    
+    if ( fieldType )
+        {
+        CVPbkFieldTypeSelector* selector = CVPbkFieldTypeSelector::NewL(
+            aResourceReader, aFieldTypeList );
+        // Check if the fields type is the one needed
+        ret = selector->IsFieldTypeIncluded( *fieldType );
+        delete selector;
+        }
     return ret;
     }
 
--- a/phonebookengines/contactsmodel/cntdbdumper/group/dbdumper.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/contactsmodel/cntdbdumper/group/dbdumper.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -21,7 +21,7 @@
 SOURCEPATH		../src
 
 
-systeminclude   	\EPOC32\INCLUDE 
+systeminclude   	/EPOC32/INCLUDE 
 userinclude			../src ../../src
 source          	dbdbmsdumper.CPP
 
--- a/phonebookengines/contactsmodel/cntplsql/src/csqlitelocalview.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/contactsmodel/cntplsql/src/csqlitelocalview.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -606,6 +606,24 @@
 			DebugLogNotification(_L("[CNTMODEL] . . . . . Queueing Database Event "), aEvent);
 #endif
 			iOutstandingEvents.AppendL(aEvent);
+			
+            // The view state is set to ENotReady when a recovery takes place, and also when the tables
+            // are closed, so set ready here.
+            if (iState == ENotReady && (aEvent.iType
+                    == EContactDbObserverEventRecover || aEvent.iType
+                    == EContactDbObserverEventTablesOpened))
+                {
+                SetState(EReady);
+                }
+            // view was Initializing (sorting) before recovery or compression started!  
+            if (iState == EInitializing && (aEvent.iType
+                    == EContactDbObserverEventRecover || aEvent.iType
+                    == EContactDbObserverEventCompress))
+                {
+                // re-read database and sort
+                SafeResort();
+                }
+                
 			}		
 			
 			
--- a/phonebookengines/contactsmodel/src/CNTITEM.CPP	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/contactsmodel/src/CNTITEM.CPP	Fri Feb 19 22:40:27 2010 +0200
@@ -287,18 +287,6 @@
 					}				
 				}
 
-			// Check if the incoming contact item has a vCard property mapping
-			// that is also present in the current template field's Field Types.
-			// This covers the (unusual) case where a template field is defined
-			// to have a vCard property mapping which is also the same as one of
-			// field types (which contains property parameter mappings).
-			for(TInt fieldTypeIdx=0; fieldTypeIdx < fieldContentType.FieldTypeCount(); ++fieldTypeIdx)
-				{
-				if(fieldContentType.FieldType(fieldTypeIdx) == aContentType.Mapping())
-					{
-					++hits;
-					}
-				}
 			
 			misses+=fieldContentType.FieldTypeCount()-hits;
 			score+=10*hits-5*misses;
--- a/phonebookengines/contactsmodel/tsrc/Integration/TestStartUp/group/10003A73.txt	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/contactsmodel/tsrc/Integration/TestStartUp/group/10003A73.txt	Fri Feb 19 22:40:27 2010 +0200
@@ -1,7 +1,7 @@
 # Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
--- a/phonebookengines/contactsmodel/tsrc/TestSyncPlugIn/cntsyncchecker.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookengines/contactsmodel/tsrc/TestSyncPlugIn/cntsyncchecker.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -34,7 +34,7 @@
 
 #if defined(WINS)
 deffile	 ../../bwins/CNTSYNCCHECKER.DEF
-#else if defined(EABI)
+#elif defined(EABI)
 deffile	 ../../EABI/cntsyncchecker.def
 #endif
 
--- a/phonebookui/Phonebook/BCardEng/src/CBCardThumbnailHandler.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/BCardEng/src/CBCardThumbnailHandler.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -32,7 +32,7 @@
 
 // LOCAL CONSTANTS AND MACROS
 // Default size for thumbnail images
-#define KDefaultThumbnailSize TSize(80,96)
+#define KDefaultThumbnailSize TSize(150,150)
 /// JPEG file mime type
 _LIT8(KJpegMimeType, "image/jpeg");
 
--- a/phonebookui/Phonebook/View/inc/CPbkFieldAnalyzer.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/View/inc/CPbkFieldAnalyzer.h	Fri Feb 19 22:40:27 2010 +0200
@@ -21,7 +21,7 @@
 #define __CPBKFIELDANALYZER_H__
 
 #include <e32base.h>
-#include "mpbkfieldanalyzer.h"
+#include "MPbkFieldAnalyzer.h"
 
 //  FORWARD DECLARATIONS
 class CPbkFieldArray;
--- a/phonebookui/Phonebook/View/inc/CPbkThumbnailManagerImpl.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/View/inc/CPbkThumbnailManagerImpl.h	Fri Feb 19 22:40:27 2010 +0200
@@ -29,7 +29,7 @@
 
 // CONSTANTS
 // Size of thumbnail images stored to contacts
-#define KPbkPersonalImageSize TSize(80,96)
+#define KPbkPersonalImageSize TSize(150,150)
 
 //  FORWARD DECLARATIONS
 class MPbkThumbnailGetObserver;
--- a/phonebookui/Phonebook/View/src/CPbkFieldAnalyzer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/View/src/CPbkFieldAnalyzer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -17,9 +17,9 @@
 *
 */
 
-#include "cpbkfieldanalyzer.h"
-#include <cpbkcontactengine.h>
-#include <cpbkcontactitem.h>
+#include "CPbkFieldAnalyzer.h"
+#include <CPbkContactEngine.h>
+#include <CPbkContactItem.h>
 #include <featmgr.h>
 
 
--- a/phonebookui/Phonebook/View/src/CPbkSelectFieldDlg.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/View/src/CPbkSelectFieldDlg.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -29,12 +29,12 @@
 #include    "MPbkControlKeyObserver.h"
 #include    <CPbkIconArray.h>
 #include    "MPbkClipListBoxText.h"
-#include    "cpbkfieldanalyzer.h"
+#include    "CPbkFieldAnalyzer.h"
 
 #include    <CPbkContactItem.h> // CPbkFieldArray
 #include    <CPbkExtGlobals.h>
 #include    <MPbkExtensionFactory.h>
-#include    <cpbkcontactengine.h>
+#include    <CPbkContactEngine.h>
 
 // Unnamed namespace for local definitions
 namespace {
--- a/phonebookui/Phonebook/inc/PhonebookExternalCRKeys.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook/inc/PhonebookExternalCRKeys.h	Fri Feb 19 22:40:27 2010 +0200
@@ -19,7 +19,7 @@
 #ifndef __PhonebookExternalCRKeys_H__
 #define __PhonebookExternalCRKeys_H__
 
-#include <SettingsInternalCRKeys.h> // includes KRCSEPreferredTelephony
+#include <settingsinternalcrkeys.h> // includes KRCSEPreferredTelephony
 
 /**
  * This file contains external CR keys used by Phonebook
--- a/phonebookui/Phonebook2/Application/rss/Pbk2MenuResources.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Application/rss/Pbk2MenuResources.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -110,6 +110,10 @@
             },            
         MENU_TITLE
             {
+            menu_pane = R_PHONEBOOK2_MERGE_CONTACTS;
+            },
+        MENU_TITLE
+            {
             menu_pane = R_PHONEBOOK2_NAMESLIST_COPY_MENU;
             },
         MENU_TITLE
@@ -138,16 +142,6 @@
             },
         MENU_TITLE
             {
-            menu_pane = R_PHONEBOOK2_MERGE_CONTACTS;
-            },
-/* Patrik 23.10.2008 Removed as agreed by ECE program management.
-        MENU_TITLE
-            {
-            menu_pane = R_PHONEBOOK2_MOVE_TOPCONTACTS;
-            },
-*/            
-        MENU_TITLE
-            {
             menu_pane = R_PHONEBOOK2_NAMESLIST_CREATE_MENU;
             },
         MENU_TITLE
--- a/phonebookui/Phonebook2/BWINS/Pbk2PresentationU.DEF	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/BWINS/Pbk2PresentationU.DEF	Fri Feb 19 22:40:27 2010 +0200
@@ -166,4 +166,6 @@
 	?NewL@CPbk2ServiceManager@@SAPAV1@AAVRFs@@@Z @ 165 NONAME ; class CPbk2ServiceManager * CPbk2ServiceManager::NewL(class RFs &)
 	?Services@CPbk2ServiceManager@@QAEABV?$RArray@UTService@CPbk2ServiceManager@@@@XZ @ 166 NONAME ; class RArray<struct CPbk2ServiceManager::TService> const & CPbk2ServiceManager::Services(void)
 	?RefreshDataL@CPbk2ServiceManager@@QAEXXZ @ 167 NONAME ; void CPbk2ServiceManager::RefreshDataL(void)
+	?CreateContactViewForStoresLC@CPbk2ContactViewBuilder@@QBEPAVMVPbkContactViewBase@@ABVCVPbkContactStoreUriArray@@AAVMVPbkContactViewObserver@@ABVMVPbkFieldTypeList@@PAVCVPbkFieldTypeSelector@@KPAVMVPbkContactSelector@@@Z @ 168 NONAME ; class MVPbkContactViewBase * CPbk2ContactViewBuilder::CreateContactViewForStoresLC(class CVPbkContactStoreUriArray const &, class MVPbkContactViewObserver &, class MVPbkFieldTypeList const &, class CVPbkFieldTypeSelector *, unsigned long, class MVPbkContactSelector *) const
+	?CropImageL@Pbk2PresentationImageUtils@@SAXAAVCFbsBitmap@@W4TCroppingMode@1@ABVTSize@@@Z @ 169 NONAME ; void Pbk2PresentationImageUtils::CropImageL(class CFbsBitmap &, enum Pbk2PresentationImageUtils::TCroppingMode, class TSize const &)
 
--- a/phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/BWINS/Pbk2UiControlsU.DEF	Fri Feb 19 22:40:27 2010 +0200
@@ -112,7 +112,9 @@
 	?NewL@CPbk2NamesListControl@@SAPAV1@HPBVCCoeControl@@AAVCVPbkContactManager@@AAVMVPbkContactViewBase@@AAVMPbk2ContactNameFormatter@@AAVCPbk2StorePropertyArray@@PAVCPbk2ThumbnailManager@@@Z @ 111 NONAME ; class CPbk2NamesListControl * CPbk2NamesListControl::NewL(int, class CCoeControl const *, class CVPbkContactManager &, class MVPbkContactViewBase &, class MPbk2ContactNameFormatter &, class CPbk2StorePropertyArray &, class CPbk2ThumbnailManager *)
 	?ExecuteLD@CPbk2MemoryEntryDefaultsAssignDlg@@QAEHABVCPbk2PresentationContactFieldCollection@@ABVCVPbkContactManager@@ABVMPbk2FieldPropertyArray@@W4TVPbkContactActionTypeSelector@VPbkFieldTypeSelectorFactory@@@Z @ 112 NONAME ; int CPbk2MemoryEntryDefaultsAssignDlg::ExecuteLD(class CPbk2PresentationContactFieldCollection const &, class CVPbkContactManager const &, class MPbk2FieldPropertyArray const &, enum VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector)
 	?NewL@CPbk2ContactEditorDlg@@SAPAV1@AAVTPbk2ContactEditorParams@@PAVMVPbkStoreContact@@AAVMPbk2EditedContactObserver@@PAVMPbk2ApplicationServices@@PAVHBufC16@@H@Z @ 113 NONAME ; class CPbk2ContactEditorDlg * CPbk2ContactEditorDlg::NewL(class TPbk2ContactEditorParams &, class MVPbkStoreContact *, class MPbk2EditedContactObserver &, class MPbk2ApplicationServices *, class HBufC16 *, int)
-        ?NewL@CPbk2AddItemToContactDlg@@SAPAV1@PAVMPbk2ApplicationServices@@@Z @ 114 NONAME ; class CPbk2AddItemToContactDlg * CPbk2AddItemToContactDlg::NewL(class MPbk2ApplicationServices *)
+	?NewL@CPbk2AddItemToContactDlg@@SAPAV1@PAVMPbk2ApplicationServices@@@Z @ 114 NONAME ; class CPbk2AddItemToContactDlg * CPbk2AddItemToContactDlg::NewL(class MPbk2ApplicationServices *)
 	?NewL@CPbk2MergeConflictsDlg@@SAPAV1@PAVMPbk2MergeResolver@@H@Z @ 115 NONAME ; class CPbk2MergeConflictsDlg * CPbk2MergeConflictsDlg::NewL(class MPbk2MergeResolver *, int)
-	?NewL@CPbk2MergePhotoConflictDlg@@SAPAV1@PAVCFbsBitmap@@0PAH@Z @ 116 NONAME ; class CPbk2MergePhotoConflictDlg * CPbk2MergePhotoConflictDlg::NewL(class CFbsBitmap *, class CFbsBitmap *, int *)
+	?NewL@CPbk2MergePhotoConflictDlg@@SAPAV1@PAVMVPbkBaseContact@@0PAH@Z @ 116 NONAME ; class CPbk2MergePhotoConflictDlg * CPbk2MergePhotoConflictDlg::NewL(class MVPbkBaseContact *, class MVPbkBaseContact *, int *)
 	?StopQuery@CPbk2GeneralConfirmationQuery@@QAEXXZ @ 117 NONAME ; void CPbk2GeneralConfirmationQuery::StopQuery(void)
+	?HandleViewForegroundEventL@CPbk2NamesListControl@@QAEXH@Z @ 118 NONAME ; void CPbk2NamesListControl::HandleViewForegroundEventL(int)
+
--- a/phonebookui/Phonebook2/Commands/rss/NamesListView.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Commands/rss/NamesListView.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -109,23 +109,6 @@
     }
 
 // ---------------------------------------------------------
-// Names List View's move top contacts
-// ---------------------------------------------------------
-//
-/* Patrik 23.10.2008 Removed as agreed by ECE program management.
-RESOURCE MENU_PANE r_phonebook2_move_topcontacts
-    {
-    items=
-        {
-        MENU_ITEM
-            {
-            command = EPbk2CmdMoveInTopContactsList;
-            txt = qtn_phob_opt_move;
-            }
-        };
-    }*/
-
-// ---------------------------------------------------------
 // Names List View's merge contacts
 // ---------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/CommandsExtension/inc/CPbk2MergeContactsCmd.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/inc/CPbk2MergeContactsCmd.h	Fri Feb 19 22:40:27 2010 +0200
@@ -41,8 +41,6 @@
 class CPbk2MergeResolver;
 class CPbk2ApplicationServices;
 class CAknNavigationDecorator;
-class CImageDecoder;
-class CFbsBitmap;
 class CVPbkContactLinkArray;
 class MVPbkStoreContactField;
 
@@ -164,18 +162,17 @@
     void CleanAfterFetching();
     TBool IsFromReadOnlyStore(
             const MVPbkContactLink& aContactLink ) const;
-    void RetrieveContactL( const MVPbkContactLink& aContactLink );
+    void RetrieveContact( const MVPbkContactLink& aContactLink );
     void NotifyObservers();
     void SetTitlePaneL( TBool aCustom );
     void CheckPhotoConflictL();
     void ResolvePhotoConflictL();
     void ResolveAllPhotoConflicts( 
             EPbk2ConflictedNumber aConflictResolutionNumber );
-    void InitBitmapL( CFbsBitmap*& aBitmap, TDesC8& aData );
     void AddFieldToMergedContactL( MVPbkStoreContactField& field );
-    HBufC* ContactAsStringLC( MVPbkStoreContact* aStoreContact );
+    HBufC* ContactAsStringL( MVPbkStoreContact* aStoreContact );
     void ShowContactsMergedNoteL();
-    void GetStoreContactsL();
+    void GetStoreContacts();
     void ResolveConflictsL();
     void FinalizeMergeL();
     void DeleteSourceContactsL();
@@ -261,15 +258,6 @@
     /// Own: Image field data  from second contact
     TPtrC8 iDataSecond;
     
-    /// Own: Conflict image from first contact
-    CFbsBitmap* iBitmapFirst;
-    
-    /// Own: Conflict image from second contact
-    CFbsBitmap* iBitmapSecond;
-    
-    /// Own: Converts images of any type to bitmaps
-    CImageDecoder* iImgDecoder;
-    
     /// Own: Index of photo conflict 
     //      KErrNotFound if conflit does not exist
     TInt iPhotoConflictIndex;
@@ -288,6 +276,16 @@
     
     /// Own: Waiting note
     MPbk2ProcessDecorator* iWaitDecorator;
+    
+	/// Own: string for ending note
+    HBufC* iFirstContactString;
+	
+	/// Own: string for ending note
+    HBufC* iSecondContactString;
+	
+	/// Own: string for ending note
+    HBufC* iMergedContactString;
+    
     };
 
 #endif // CPBK2MERGECONTACTSCMD_H
--- a/phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyContactsCmd.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/src/CPbk2CopyContactsCmd.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -562,6 +562,7 @@
 
         iDecorator->ProcessStopped();
         }
+    iCommandObserver->CommandFinished(*this);
     }
 
 //  End of File
--- a/phonebookui/Phonebook2/CommandsExtension/src/CPbk2DeleteContactsCmd.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/src/CPbk2DeleteContactsCmd.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -276,6 +276,20 @@
             }
         case EStarting:
             {
+            
+            // Returns NULL if there are no selected contacts.
+            // In that case we will delete the focused contact.
+            if ( iUiControl )
+                {
+                //Re-Fetch the Contact Iterator
+                MPbk2ContactLinkIterator* contactIterator = iUiControl->SelectedContactsIteratorL();
+                if ( contactIterator )
+                    {
+                    delete iContactIterator;
+                    iContactIterator = contactIterator;
+                    }
+                }
+                
             if( iDecorator )
             	{
                 iDecorator->ProcessStartedL( iContactCount );
--- a/phonebookui/Phonebook2/CommandsExtension/src/CPbk2GoToURLCmd.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/src/CPbk2GoToURLCmd.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -38,7 +38,7 @@
 #include <MVPbkContactFieldTextData.h>
 
 // System includes
-#include <BrowserLauncher.h>
+#include <browserlauncher.h>
 #include <coemain.h>
 #include <barsread.h>
 #include <StringLoader.h>
--- a/phonebookui/Phonebook2/CommandsExtension/src/CPbk2MergeContactsCmd.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommandsExtension/src/CPbk2MergeContactsCmd.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -43,9 +43,9 @@
 #include <CPbk2MergeConflictsDlg.h>
 #include <CPbk2MergePhotoConflictDlg.h>
 
-#include <pbk2uicontrols.rsg> 
-#include <pbk2cmdextres.rsg>
-#include <pbk2commonui.rsg>
+#include <Pbk2UIControls.rsg> 
+#include <Pbk2CmdExtRes.rsg>
+#include <Pbk2CommonUi.rsg>
 //Virtual Phonebook
 #include <MVPbkContactLink.h>
 #include <MVPbkContactViewBase.h>
@@ -57,7 +57,7 @@
 #include <MVPbkStoreContact.h>
 #include <MVPbkContactFieldBinaryData.h>
 #include <MVPbkContactFieldTextData.h>
-#include <vpbkeng.rsg>
+#include <VPbkEng.rsg>
 #include <MVPbkContactGroup.h>
 
 //System
@@ -129,6 +129,9 @@
         }
 
     CleanAfterFetching();
+    delete iFirstContactString;
+    delete iSecondContactString;
+    delete iMergedContactString;
     delete iRetrieveOperation;
     delete iDeleteOperation;
     delete iCommitOperation;
@@ -141,9 +144,6 @@
     delete iStoreContactSecond;
     delete iMergedContact;
     delete iMergeResolver;
-    delete iBitmapFirst;
-    delete iBitmapSecond;
-    delete iImgDecoder;
     delete iWaitDecorator;
     if( iGroupsToAdd )
         {
@@ -202,8 +202,6 @@
     iContactManager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager();
     iAppServices = CPbk2ApplicationServices::InstanceL();
     iPhotoConflictIndex = KErrNotFound;
-    iDataFirst.Set( KNullDesC8() );
-    iDataSecond.Set( KNullDesC8() );
     }
     
 // --------------------------------------------------------------------------
@@ -306,7 +304,7 @@
     	    break;
     	case EPhaseGetStoreContacts:
             {
-            GetStoreContactsL();
+            GetStoreContacts();
             }   
             break;
     	case EPhaseMerge:
@@ -431,34 +429,31 @@
 //
 void CPbk2MergeContactsCmd::ShowContactsMergedNoteL()
     {
-    HBufC* firstContactString = ContactAsStringLC( iStoreContactFirst );
-    HBufC* secondContactString = ContactAsStringLC( iStoreContactSecond );
-    HBufC* mergedContactString = ContactAsStringLC( iMergedContact );
     HBufC* unnamed = StringLoader::LoadLC( R_QTN_PHOB_UNNAMED );
     CDesCArrayFlat* strings = new(ELeave) CDesCArrayFlat( 3 );
     CleanupStack::PushL( strings );
     
     HBufC* prompt = NULL;
-    if ( (firstContactString->Length() > 0 || secondContactString->Length() > 0)
-            && mergedContactString->Length() > 0 )
+    if ( (iFirstContactString->Length() > 0 || iSecondContactString->Length() > 0)
+            && iMergedContactString->Length() > 0 )
         {
-        if ( 0 != firstContactString->Length() )
+        if ( 0 != iFirstContactString->Length() )
             {
-            strings->AppendL( *firstContactString );
+            strings->AppendL( *iFirstContactString );
             }
         else
             {
             strings->AppendL( *unnamed );
             }
-        if ( 0 != secondContactString->Length() )
+        if ( 0 != iSecondContactString->Length() )
             {
-            strings->AppendL( *secondContactString );
+            strings->AppendL( *iSecondContactString );
             }
         else
             {
             strings->AppendL( *unnamed );
             }
-        strings->AppendL( *mergedContactString );
+        strings->AppendL( *iMergedContactString );
 
         prompt = StringLoader::LoadLC( R_QTN_PHOB_NOTE_CONTACTS_WERE_MERGED, *strings );
         }
@@ -475,16 +470,14 @@
     CleanupStack::PopAndDestroy( prompt );
     CleanupStack::PopAndDestroy( strings );
     CleanupStack::PopAndDestroy( unnamed );
-    CleanupStack::PopAndDestroy( mergedContactString );
-    CleanupStack::PopAndDestroy( secondContactString );
-    CleanupStack::PopAndDestroy( firstContactString );
+
     }
 
 // --------------------------------------------------------------------------
 // CPbk2MergeContactsCmd::ContactAsStringLC
 // --------------------------------------------------------------------------
 //
-HBufC* CPbk2MergeContactsCmd::ContactAsStringLC( MVPbkStoreContact* aStoreContact )
+HBufC* CPbk2MergeContactsCmd::ContactAsStringL( MVPbkStoreContact* aStoreContact )
     {
     _LIT(KResultFormat, "%S %S");
     TPtrC firstName( KNullDesC() );
@@ -513,17 +506,17 @@
     HBufC* result = NULL;
     if ( firstName.Length() > 0 && lastName.Length() > 0 )
         {
-        result = HBufC::NewLC( firstName.Length() + lastName.Length() + KResultFormat().Length() );
+        result = HBufC::NewL( firstName.Length() + lastName.Length() + KResultFormat().Length() );
         TPtr resAsDes = result->Des();
         resAsDes.Format( KResultFormat, &firstName, &lastName );
         }
     else if ( firstName.Length() > 0 )
         {
-        result = firstName.AllocLC(); 
+        result = firstName.AllocL(); 
         }    
     else
         {
-        result = lastName.AllocLC();
+        result = lastName.AllocL();
         }
     return result;
     }
@@ -783,12 +776,18 @@
 // CPbk2MergeContactsCmd::RetrieveContactL
 // --------------------------------------------------------------------------
 //
-void CPbk2MergeContactsCmd::RetrieveContactL(
+void CPbk2MergeContactsCmd::RetrieveContact(
         const MVPbkContactLink& aContactLink )
     {
     // Retrieve the actual store contact from the given link
-    iRetrieveOperation = iAppServices->
+    TRAPD( error, 
+        iRetrieveOperation = iAppServices->
         ContactManager().RetrieveContactL( aContactLink, *this );
+    );
+    if( error != KErrNone )
+        {
+        Finish( error );
+        }
     }
 
 ////////////////////////////// CALLBACKS /////////////////////////////////////
@@ -809,12 +808,20 @@
         if( !iStoreContactFirst )
             {
             iStoreContactFirst = aContact;
-            TRAP_IGNORE( RetrieveContactL( *iContactSecond ) ); 
+            TRAPD( error, iStoreContactFirst->LockL( *this ) );
+            if( error != KErrNone )
+                {
+                Finish( error );
+                }
             }
         else if( !iStoreContactSecond )
             {
             iStoreContactSecond = aContact;
-            StartNext();
+            TRAPD( error, iStoreContactSecond->LockL( *this ) );
+            if( error != KErrNone )
+                {
+                Finish( error );
+                }
             }
         else if( iNextPhase == EPhaseGetGroups 
                  && aContact->Group()
@@ -866,11 +873,11 @@
             
             if( countFirst )
                 {
-                TRAP( error, RetrieveContactL( iGroupLinksFirst->At( countFirst - 1 ) ); );
+                RetrieveContact( iGroupLinksFirst->At( countFirst - 1 ) );
                 }
             else if( countSecond )
                 {
-                TRAP( error, RetrieveContactL( iGroupLinksSecond->At( countSecond - 1 ) ); );
+                RetrieveContact( iGroupLinksSecond->At( countSecond - 1 ) );
                 }
             else
                 {
@@ -914,7 +921,17 @@
 void CPbk2MergeContactsCmd::ContactOperationCompleted(
         TContactOpResult aResult )
     {
-    if( aResult.iOpCode == MVPbkContactObserver::EContactLock )
+    if( aResult.iOpCode == MVPbkContactObserver::EContactLock 
+            && iNextPhase == EPhaseGetStoreContacts && !iStoreContactSecond )
+        {
+        RetrieveContact( *iContactSecond );
+        }
+    else if( aResult.iOpCode == MVPbkContactObserver::EContactLock 
+            && iNextPhase == EPhaseGetStoreContacts )
+        {
+        StartNext( EPhaseMerge );
+        }
+    else if( aResult.iOpCode == MVPbkContactObserver::EContactLock )
         {
         TInt countGroups = iGroupsToAdd->Count();
         if( countGroups )
@@ -970,9 +987,16 @@
 // --------------------------------------------------------------------------
 //
 void CPbk2MergeContactsCmd::ContactOperationFailed(
-        TContactOp /*aOpCode*/, TInt /*aErrorCode*/, TBool /*aErrorNotified*/ )
+        TContactOp aOpCode, TInt aErrorCode, TBool /*aErrorNotified*/ )
     {
-    DeleteMergedContact();
+    if( aOpCode == MVPbkContactObserver::EContactLock && iNextPhase == EPhaseGetStoreContacts )
+        {
+        Finish( aErrorCode );
+        }
+    else
+        {
+        DeleteMergedContact();
+        }
     }
 
 // --------------------------------------------------------------------------
@@ -1223,11 +1247,6 @@
                     if ( firstField->FieldData().DataType() == EVPbkFieldStorageTypeBinary && 
                             secondField->FieldData().DataType() == EVPbkFieldStorageTypeBinary )
                         {
-                        iDataFirst.Set( MVPbkContactFieldBinaryData::Cast
-                            ( firstField->FieldData() ).BinaryData() );
-                        iDataSecond.Set( MVPbkContactFieldBinaryData::Cast
-                            ( secondField->FieldData() ).BinaryData() );
-                        
                         iPhotoConflictIndex = i;
                         break;
                         }
@@ -1267,29 +1286,10 @@
         return;
         }
     
-    if ( iDataFirst.Length() == 0 || iDataSecond.Length() == 0 )
-        {
-        StartNext( EPhaseFinish );
-        return;
-        }
-    
-    if ( !iBitmapFirst )
-        {
-        InitBitmapL( iBitmapFirst, iDataFirst );
-        return;
-        }
-    if ( !iBitmapSecond )
-        {
-        InitBitmapL( iBitmapSecond, iDataSecond  );
-        return;
-        }
-    
-    delete iImgDecoder;
-    iImgDecoder = NULL;
     TInt result = EPbk2ConflictedFirst;
     
     CPbk2MergePhotoConflictDlg* dlg = 
-        CPbk2MergePhotoConflictDlg::NewL( iBitmapFirst, iBitmapSecond, &result );
+        CPbk2MergePhotoConflictDlg::NewL( iStoreContactFirst, iStoreContactSecond, &result );
     if ( !dlg->ExecuteLD( R_PBK2_MERGE_CONTACTS_PHOTO_CONFLICT_RESOLUTION_DLG ) )
         {
         // dlg returns 0 if canceled
@@ -1300,30 +1300,6 @@
         ResolveAllPhotoConflicts( (EPbk2ConflictedNumber) result );
         StartNext( EPhaseCreateMergedContact );
         }
-    delete iBitmapFirst;
-    iBitmapFirst = NULL;
-    delete iBitmapSecond;
-    iBitmapSecond = NULL;
-    }
-
-// --------------------------------------------------------------------------
-// CPbk2MergeContactsCmd::InitBitmapL
-// --------------------------------------------------------------------------
-//
-void CPbk2MergeContactsCmd::InitBitmapL( CFbsBitmap*& aBitmap, TDesC8& aData )
-    {
-    delete iImgDecoder;
-    iImgDecoder = NULL;
-    iImgDecoder = CImageDecoder::DataNewL
-        ( iContactManager->FsSession(), aData, CImageDecoder::EOptionAlwaysThread );
-    
-    TFrameInfo info = iImgDecoder->FrameInfo();
-    aBitmap = new ( ELeave ) CFbsBitmap;
-    User::LeaveIfError( aBitmap->Create
-        ( info.iOverallSizeInPixels, info.iFrameDisplayMode ));
-    
-    iImgDecoder->Convert( &iStatus, *aBitmap );
-    SetActive();
     }
 
 // --------------------------------------------------------------------------
@@ -1382,17 +1358,13 @@
 // CPbk2MergeContactsCmd::GetStoreContactsL
 // --------------------------------------------------------------------------
 //
-void CPbk2MergeContactsCmd::GetStoreContactsL()
+void CPbk2MergeContactsCmd::GetStoreContacts()
     {
     if( iContactFirst && iContactSecond )
         {
         if( !iStoreContactFirst )
             {
-            RetrieveContactL( *iContactFirst );
-            }
-        else if( iStoreContactSecond )
-            {
-            StartNext( EPhaseMerge );
+            RetrieveContact( *iContactFirst );
             }
         else
             {
@@ -1413,6 +1385,17 @@
     {
     User::LeaveIfNull( iContactFirst );
     User::LeaveIfNull( iContactSecond );
+    
+    iFirstContactString = ContactAsStringL( iStoreContactFirst );
+    iSecondContactString = ContactAsStringL( iStoreContactSecond );
+    iMergedContactString = ContactAsStringL( iMergedContact );
+    
+    delete iStoreContactFirst;
+    iStoreContactFirst = NULL;
+    
+    delete iStoreContactSecond;
+    iStoreContactSecond = NULL;
+    
     if( iContactsToDelete )
         {
         delete iContactsToDelete;
@@ -1504,11 +1487,11 @@
         
         if( countFirst )
             {
-            RetrieveContactL( iGroupLinksFirst->At( countFirst - 1 ) );
+            RetrieveContact( iGroupLinksFirst->At( countFirst - 1 ) );
             }
         else if( countSecond )
             {
-            RetrieveContactL( iGroupLinksSecond->At( countSecond - 1 ) );
+            RetrieveContact( iGroupLinksSecond->At( countSecond - 1 ) );
             }
         else
             {
--- a/phonebookui/Phonebook2/CommonUI/src/CPbk2RingingToneFetch.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/CommonUI/src/CPbk2RingingToneFetch.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -110,21 +110,21 @@
 void CPbk2RingingToneFetch::SetMaxToneFileSizeL( CMediaFileList* aFl )
     {
     // Set file size limit if configured ON.
-    TInt sizeLimitB( 0 );
+    TInt sizeLimitKB( 0 );
     CRepository* cenrep = CRepository::NewL( KCRUidProfileEngine );
     CleanupStack::PushL( cenrep );
 
     User::LeaveIfError( cenrep->Get( KProEngRingingToneMaxSize,
-                                     sizeLimitB ) );
+            sizeLimitKB ) );
     CleanupStack::PopAndDestroy(); // cenrep
-    if ( sizeLimitB < 0 )
+    if ( sizeLimitKB < 0 )
         {
-        sizeLimitB = 0;
+        sizeLimitKB = 0;
         }
-    sizeLimitB *= KKilo;
-    if ( sizeLimitB )
+    
+    if ( sizeLimitKB )
         {
-       aFl->SetAttrL( CMediaFileList::EAttrFileSize, sizeLimitB );
+       aFl->SetAttrL( CMediaFileList::EAttrFileSize, sizeLimitKB );
         }
     }
 
--- a/phonebookui/Phonebook2/EABI/Pbk2PresentationU.DEF	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/EABI/Pbk2PresentationU.DEF	Fri Feb 19 22:40:27 2010 +0200
@@ -211,4 +211,6 @@
 	_ZN23CPbk2FieldPropertyArray4NewLERK18MVPbkFieldTypeListR3RFsP19CPbk2ServiceManager @ 210 NONAME
 	_ZN19CPbk2ServiceManager8ServicesEv @ 211 NONAME
 	_ZN19CPbk2ServiceManager12RefreshDataLEv @ 212 NONAME
+	_ZNK23CPbk2ContactViewBuilder28CreateContactViewForStoresLCERK25CVPbkContactStoreUriArrayR24MVPbkContactViewObserverRK18MVPbkFieldTypeListP22CVPbkFieldTypeSelectormP20MVPbkContactSelector @ 213 NONAME
+	_ZN26Pbk2PresentationImageUtils10CropImageLER10CFbsBitmapNS_13TCroppingModeERK5TSize @ 214 NONAME
 
--- a/phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/EABI/Pbk2UiControlsU.DEF	Fri Feb 19 22:40:27 2010 +0200
@@ -196,6 +196,7 @@
 	_ZN21CPbk2ContactEditorDlg4NewLER24TPbk2ContactEditorParamsP17MVPbkStoreContactR26MPbk2EditedContactObserverP24MPbk2ApplicationServicesP7HBufC16i @ 195 NONAME
 	_ZN24CPbk2AddItemToContactDlg4NewLEP24MPbk2ApplicationServices @ 196 NONAME
 	_ZN22CPbk2MergeConflictsDlg4NewLEP18MPbk2MergeResolveri @ 197 NONAME
-	_ZN26CPbk2MergePhotoConflictDlg4NewLEP10CFbsBitmapS1_Pi @ 198 NONAME
+	_ZN26CPbk2MergePhotoConflictDlg4NewLEP16MVPbkBaseContactS1_Pi @ 198 NONAME
 	_ZN29CPbk2GeneralConfirmationQuery9StopQueryEv @ 199 NONAME
+	_ZN21CPbk2NamesListControl26HandleViewForegroundEventLEi @ 200 NONAME
 
--- a/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NameslistUiControlExtension.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NameslistUiControlExtension.h	Fri Feb 19 22:40:27 2010 +0200
@@ -76,7 +76,7 @@
         /*
          * Creates icon of the bitmap and adds it ot Pbk2IconArray
          */
-        void AddThumbnailToIconArrayL( );
+        void AddMyCardThumbnailToIconArrayL( );
         
     private: // Construction & destruction
         CPbk2NameslistUiControlExtension( CVPbkContactManager& aContactManager,
@@ -132,10 +132,8 @@
         CSpbContentProvider& iContentProvider;
         // Ref:
         CPbk2MyCard* iMyCard;
-        // Ref: my card thumbnail bitmap
+        // Own: my card thumbnail bitmap
         CFbsBitmap* iBitmap;
-        // Current thumbnail icon id
-        TPbk2IconId	iIconId;
         // Ref: thumbnail on array
         CGulIcon* 	iThumbIcon;
     };
--- a/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExView.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExView.h	Fri Feb 19 22:40:27 2010 +0200
@@ -26,6 +26,7 @@
 #include <MPbk2ControlObserver.h>
 #include <MPbk2StoreConfigurationObserver.h>
 #include <MPbk2MenuCommandObserver.h>
+#include <mpbk2uiextensionview2.h>
 #include <akntoolbarobserver.h>
 #include <eiklbo.h>
 #include <coemain.h>
@@ -50,7 +51,6 @@
 class CPbk2ContactUiControlProxy;
 class CAknStylusPopUpMenu;
 class CPbk2MyCard;
-class CPbk2ThumbnailManager;
 class CSpbContentProvider;
 class CPbk2ContextLaunch;
 
@@ -69,7 +69,8 @@
                              public MAknToolbarObserver,
                              public MCoeControlObserver,
                              public MEikListBoxObserver,
-                             private MCoeForegroundObserver
+                             private MCoeForegroundObserver,
+                             public MPbk2UIExtensionView2
     {
     public: // Construction and destruction
 
@@ -114,6 +115,7 @@
         void HandleLongTapEventL(
                 const TPoint& aPenEventLocation,
                 const TPoint& aPenEventScreenLocation);
+        TAny* UIExtensionViewExtension( TUid aExtensionUid );
 
     protected: 
         // from MEikListBoxObserver
@@ -255,8 +257,6 @@
         // application is back in the foreground.
         TBool iNeedSetFocus;
         
-        // Own: thumnail manager for social phonebook 
-        CPbk2ThumbnailManager* iThumbManager;
         // REF: content provider
         CSpbContentProvider&  iContentProvider;
         // Not own. CCA launcher connection
--- a/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/Pbk2NamesListExtensionPlugin.h	Fri Feb 19 22:40:27 2010 +0200
@@ -23,6 +23,7 @@
 
 #include <Pbk2Commands.hrh>
 #include <MVPbkBaseContact.h>
+#include <MVPbkContactStoreObserver.h>
 
 #ifndef NAMESLISTUIEXTENTIONPLUGIN_H
 #define NAMESLISTUIEXTENTIONPLUGIN_H
@@ -34,7 +35,9 @@
 class CPbk2PresentationContact;
 class MPbk2ContactEditorControl;
 class CAiwServiceHandler;
-class CPbk2NamesListExView; 
+class CPbk2NamesListExView;
+class CPbk2ApplicationServices;
+
 // CCA
 class MCCAConnection;
 class MCCAParameter;
@@ -46,7 +49,8 @@
  * Creates instances of the extension classes.
  */
 class CNamesListUIExtensionPlugin : public CPbk2UIExtensionPlugin,
-                                    public MPbk2PluginCommandListerner
+                                    public MPbk2PluginCommandListerner,
+                                    private MVPbkContactStoreObserver
     {
     public: // Construction and destruction
 
@@ -129,7 +133,20 @@
     MPbk2AiwInterestItem* CreatePbk2AiwInterestForIdL(
                     TInt aInterestId,
                     CAiwServiceHandler& aServiceHandler );
-    
+
+    private: // From MVPbkContactStoreObserver
+        
+        void StoreReady(
+                MVPbkContactStore& aContactStore );
+        
+        void StoreUnavailable(
+                MVPbkContactStore& aContactStore,
+                TInt aReason );
+        
+        void HandleStoreEventL(
+                MVPbkContactStore& aContactStore,
+                TVPbkContactStoreEvent aStoreEvent );
+        
     private: // Implementation
     CNamesListUIExtensionPlugin();
     void ConstructL();
@@ -137,12 +154,19 @@
     void DimItem( CEikMenuPane* aMenuPane, TInt aCmd );
     TBool IsTopContact( const MVPbkBaseContact* aContact );
     MVPbkContactLink* MyCardLink() const;
+    void InitLocalStoreObserverL();
 
     private: // Data
     MCCAConnection* iCCAConnection;  // own
     CPbk2NamesListExView* iNamesListExViewRef; //ref  
     //OWN:
     CSpbContentProvider*	iContentProvider;
+    // number of contacts in local store
+    TInt iLocalStoreContactsCount;
+    // Not own:
+    MVPbkContactStore* iLocalStore;
+    // Own
+    CPbk2ApplicationServices*  iAppServices;
     };
 
 #endif // NAMESLISTUIEXTENTIONPLUGIN_H
--- a/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2deletemycardcmd.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2deletemycardcmd.h	Fri Feb 19 22:40:27 2010 +0200
@@ -21,7 +21,6 @@
 // INCLUDES
 #include <e32base.h>
 #include <MPbk2Command.h>
-#include <MVPbkSingleContactOperationObserver.h>
 #include <MVPbkBatchOperationObserver.h>
 
 // FORWARD DECLARATIONS
@@ -39,7 +38,6 @@
 NONSHARABLE_CLASS( CPbk2DeleteMyCardCmd ) :
     public CActive,
     public MPbk2Command,
-    public MVPbkSingleContactOperationObserver,
     public MVPbkBatchOperationObserver
     {
 public: // Construction and destruction
@@ -72,15 +70,6 @@
     void RunL();
     TInt RunError( TInt aError );
 
-private: // From MVPbkSingleContactOperationObserver
-    
-    void VPbkSingleContactOperationComplete(
-        MVPbkContactOperationBase& aOperation,
-        MVPbkStoreContact* aContact );
-    void VPbkSingleContactOperationFailed(
-        MVPbkContactOperationBase& aOperation, 
-        TInt aError );
-
 private: // From MVPbkBatchOperationObserver
     
     void StepComplete( 
@@ -96,7 +85,6 @@
     /// Process states
     enum TProcessState
         {
-        ERetrieving,
         EConfirming,
         EStarting,
         EDeleting,
@@ -135,13 +123,6 @@
     void ProcessDismissed( TInt aCancelCode );
 
     /**
-     * Retrieve contact
-     * 
-     * @param aContactLink link for the contact to retrieve 
-     */
-    void RetrieveContactL( const MVPbkContactLink& aContactLink );
-
-    /**
      * Delete contact that was given in the construction
      */
     void DeleteContactL();
@@ -159,12 +140,8 @@
     
     /// Own: Current state of process
     TProcessState iState;
-    /// Own: Retrieve operation
-    MVPbkContactOperationBase* iRetrieveOperation;
     /// Own: Delete operation
     MVPbkContactOperationBase* iDeleteOperation;
-    /// Own: The store contact to delete
-    MVPbkStoreContact* iStoreContact;
     /// Own: Contact to be deleted (only one contact)
     CVPbkContactLinkArray* iContactsArray;
     /// Own: Application Services instance
--- a/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2mycard.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/inc/cpbk2mycard.h	Fri Feb 19 22:40:27 2010 +0200
@@ -70,9 +70,9 @@
     	
     	/*
     	 * Returns my card thumbnail bitmap, NULL if it doesn't exist.
-    	 * 
+    	 * ownership is transferred to the client
     	 */
-    	CFbsBitmap* MyCardBitmap() const;
+    	CFbsBitmap* MyCardBitmapL() const;
     	
     	/*
     	 * Returns MyCard icon id if created, otherwise empty TPbk2IconId
--- a/phonebookui/Phonebook2/NamesListExtension/rss/Pbk2ExNamesListRes.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/rss/Pbk2ExNamesListRes.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -26,6 +26,7 @@
 #include <AvkonIcons.hrh>
 #include <phonebook2ece.loc>
 #include <phonebook2ece.mbg>
+#include <phonebook2.loc>
 
 //pbk2
 #include <Pbk2UIExtension.rh>
@@ -289,11 +290,9 @@
 // Text for "Create MyCard"
 // --------------------------------------------------------------------------
 //
-RESOURCE TBUF r_qtn_phob_create_mycard
+RESOURCE TBUF r_qtn_contacts_mc_set_up_my_card
     {
-    //buf = qtn_phob_create_mycard;
-    // TODO: replace with correct strings once available
-    buf = "Create MyCard";
+    buf = qtn_contacts_mc_set_up_my_card;
     }    
 
 // --------------------------------------------------------------------------
@@ -301,12 +300,32 @@
 // Text for "MyCard"
 // --------------------------------------------------------------------------
 //
-RESOURCE TBUF r_qtn_phob_open_mycard
+RESOURCE TBUF r_qtn_contacts_mc_my_card
+    {
+    buf = qtn_contacts_mc_my_card;
+    }    
+
+// --------------------------------------------------------------------------
+// TBUF
+// Text for nameslist's secondary row "%N numbers"
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_phob_n_numbers
     {
-    //buf = qtn_phob_open_mycard;
+    //buf = qtn_phob_n_numbers;
     // TODO: replace with correct strings once available
-    buf = "MyCard";
-    }    
+    buf = "%N numbers";
+    }   
+
+// --------------------------------------------------------------------------
+// TBUF
+// Text for delete mycard confirmation query
+// --------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_phob_my_card_clear_confirm
+    {
+    buf = qtn_phob_my_card_clear_confirm;
+    }   
 
 // --------------------------------------------------------------------------
 // PBK2_CONTACT_CONTROL
@@ -381,8 +400,7 @@
         MENU_ITEM
             {
             command = EPbk2CmdDeleteMyCard;
-            // TODO: replace with real localized text once available
-            txt = "Delete MyCard";
+            txt = qtn_phob_opt_entry_delete;
             flags = EEikMenuItemSpecific;
             }
         };
--- a/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NameslistUiControlExtension.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NameslistUiControlExtension.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -35,6 +35,8 @@
 #include <CVPbkTopContactManager.h>
 #include <Pbk2InternalUID.h>
 #include <mpbk2commanditemupdater.h>
+#include <StringLoader.h>
+#include <Pbk2ExNamesListRes.rsg>
 
 //ECE
 #include <gulicon.h>
@@ -86,8 +88,7 @@
           CPbk2MyCard* aMyCard )  :
             iContactManager( aContactManager ),
             iContentProvider( aContentProvider ),
-            iMyCard( aMyCard ),
-            iIconId( TPbk2IconId() )
+            iMyCard( aMyCard )
     {
     }
 
@@ -103,7 +104,7 @@
 		// set this to be observer of the my card
 		iMyCard->SetObserverL( *this );
 		// check if the mycard has already a thumbnail
-		iBitmap = iMyCard->MyCardBitmap();
+		iBitmap = iMyCard->MyCardBitmapL();
 		}
 	
 	iPresenceEngine = CPbk2EcePresenceEngine::NewL(
@@ -145,6 +146,7 @@
     	{
     	iMyCard->RemoveObserver( *this );
     	}
+    delete iBitmap;
     }
 
 // -----------------------------------------------------------------------------
@@ -247,7 +249,7 @@
     // if bitmap is allready set. MyCardEvent - event has come before this one or there was an image on creation
     if( iBitmap && iMyCard )
     	{
-		AddThumbnailToIconArrayL();
+		TRAP_IGNORE( AddMyCardThumbnailToIconArrayL() );
     	}
     }
 
@@ -287,6 +289,25 @@
             {
             elemType = MPbk2DoubleListboxDataElement::ETypePhoneNumber;
             }
+        else if( type == CSpbContentProvider::ETypePhoneNumberMultiple && txt )
+            {
+            // if we get multiple phone numbers from content provider, then
+            // the string only contains the count (as text). We need to format
+            // that into proper UI text.
+            TInt num = 0;
+            TLex16 lex( *txt );
+            TInt err = lex.Val( num );
+            if( !err )
+                {
+                delete txt;
+                txt = StringLoader::LoadL( R_QTN_PHOB_N_NUMBERS, num );
+                }
+            else
+                {
+                // in case of convert error
+                txt->Des().Zero();
+                }
+            }
         
         aDataElement.SetText(
             MPbk2DoubleListboxDataElement::EStatusText, txt, elemType );
@@ -343,12 +364,14 @@
 	if( aEvent == EStateThumbnailLoaded && iMyCard )    
 		{
 		// get bitmap
-		iBitmap = iMyCard->MyCardBitmap();
+        delete iBitmap;
+        iBitmap = NULL;
+        TRAP_IGNORE( iBitmap = iMyCard->MyCardBitmapL() );
 			
 		// if icon array is already set, add icon
 		if( iIconArray )
 			{
-			AddThumbnailToIconArrayL();
+			TRAP_IGNORE( AddMyCardThumbnailToIconArrayL() );
 			}
 		}
 	}
@@ -357,22 +380,24 @@
 // CPbk2NameslistUiControlExtension::AddThumbnailToIconArrayL
 // -----------------------------------------------------------------------------
 //
-void CPbk2NameslistUiControlExtension::AddThumbnailToIconArrayL( )
+void CPbk2NameslistUiControlExtension::AddMyCardThumbnailToIconArrayL( )
 	{
-	if( iMyCard )
+	if( !iMyCard )
 		{
-		iIconId = iMyCard->MyCardIconId();
+        return;
 		}
 	
+    const TPbk2IconId& iconId = iMyCard->MyCardIconId();
 	// if thumb icon is not created, create it and append to array
 	if( !iThumbIcon )
 		{
-		iThumbIcon = CGulIcon::NewLC();
-		CleanupStack::Pop( iThumbIcon );
-		iThumbIcon->SetBitmap( iBitmap );
+        CGulIcon* icon = CGulIcon::NewLC();
+        icon->SetBitmap( iBitmap );
 		iBitmap = NULL;
 		// takes ownership
-		iIconArray->AppendIconL( iThumbIcon, iIconId );
+		iIconArray->AppendIconL( icon, iconId );
+        CleanupStack::Pop( icon );
+        iThumbIcon = icon;  // cache icon pointer
 		}
 	    
 	// else change the bitmap. This is to prevent 
@@ -380,7 +405,7 @@
 	else
 		{
 		iThumbIcon->SetBitmap( iBitmap );
-		iBitmap = NULL;
+        iBitmap = NULL;
 		}
 	}
 
--- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -28,7 +28,6 @@
 #include "Pbk2NamesListEx.hrh"
 #include "cpbk2contextlaunch.h"
 
-#include "CPbk2ThumbnailManager.h"
 #include <spbcontentprovider.h>
 
 // Phonebook 2
@@ -240,8 +239,6 @@
     delete iMyCard;
     CCoeEnv::Static()->RemoveForegroundObserver( *this );
 
-
-    delete iThumbManager;
     delete iContextLauncher;
     FeatureManager::UnInitializeLib();
     }
@@ -291,7 +288,6 @@
     
     iControlProxy = new( ELeave )CPbk2ContactUiControlProxy;
 
-    iThumbManager = CPbk2ThumbnailManager::NewL( *iContactManager );
     iContextLauncher = new(ELeave) CPbk2ContextLaunch( iCCAConnection );
 
     PBK2_PROFILE_END(Pbk2Profile::ENamesListPenSupportConstruction);
@@ -606,7 +602,8 @@
     TInt commandCount = iControl->CommandItemCount();
        
     // Check if there is need to create MyCard
-    if( !iMyCard && IsPhoneMemoryUsedL() ) 
+    if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) &&
+        ( !iMyCard && IsPhoneMemoryUsedL() ) )
     	{				
 		// Get the phoneStore for MyCard
 		MVPbkContactStore* phoneStore = iContactManager->ContactStoresL()
@@ -805,25 +802,6 @@
     }
 
 // --------------------------------------------------------------------------
-// CPbk2NamesListExView::HandleForegroundEventL
-// --------------------------------------------------------------------------
-//
-void CPbk2NamesListExView::HandleForegroundEventL( TBool aForeground )
-    {
-    // CPbk2AppView::HandleForegroundEventL( aForeground );
-
-    // If this view is gaining foreground, then make sure that thumbnail
-    // gets drawn
-    if ( aForeground && iControl )
-        {
-        if ( iControl->IsVisible() )
-            {
-            iControl->ShowThumbnail();
-            }
-        }
-    }
-
-// --------------------------------------------------------------------------
 // CPbk2NamesListExView::ViewStateLC
 // --------------------------------------------------------------------------
 //
@@ -1207,7 +1185,8 @@
                
     if( !phoneStore )
     	{
-		iContactManager->LoadContactStoreL( VPbkContactStoreUris::DefaultCntDbUri() );
+        TRAP_IGNORE( iContactManager->LoadContactStoreL( 
+                VPbkContactStoreUris::DefaultCntDbUri() ) );
     	}
     }
 
@@ -1482,8 +1461,7 @@
                 *Phonebook2::Pbk2AppUi()->ApplicationServices().
                     ViewSupplier().AllContactsViewL(),
                 *iNameFormatter,
-                Phonebook2::Pbk2AppUi()->ApplicationServices().StoreProperties(),
-                iThumbManager );
+                Phonebook2::Pbk2AppUi()->ApplicationServices().StoreProperties() );
 
         PBK2_PROFILE_END
             ( Pbk2Profile::ENamesListViewCreateNamesListControl );
@@ -1860,4 +1838,32 @@
     // is back in the foreground.
     iNeedSetFocus = EFalse;
     }
+
+// --------------------------------------------------------------------------
+// CPbk2NamesListExView::UIExtensionViewExtension
+// --------------------------------------------------------------------------
+//
+TAny* CPbk2NamesListExView::UIExtensionViewExtension(
+                TUid aExtensionUid )
+    {
+    if( aExtensionUid == KMPbk2UIExtensionView2Uid )
+        {
+        return static_cast<MPbk2UIExtensionView2*>( this );
+        }
+    
+    return NULL;
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2NamesListExView::HandleForegroundEventL
+// --------------------------------------------------------------------------
+//
+void CPbk2NamesListExView::HandleForegroundEventL(TBool aForeground)
+    {
+    if ( iControl )
+        {
+        iControl->HandleViewForegroundEventL( aForeground );
+        }
+    }
+
 //  End of File
--- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -40,6 +40,7 @@
 #include <MPbk2ApplicationServices2.h>
 #include <CPbk2StoreConfiguration.h>
 #include <TVPbkContactStoreUriPtr.h>
+#include <CPbk2ApplicationServices.h>
 
 #include <MPbk2ContactUiControl.h>
 #include <MPbk2ViewExplorer.h>
@@ -60,6 +61,7 @@
 #include <MVPbkContactStore.h>
 #include <MVPbkContactStoreList.h>
 #include <MVPbkContactStoreInfo.h>
+#include <MVPbkContactStoreProperties.h>
 
 // Debugging headers
 
@@ -102,6 +104,11 @@
         iCCAConnection->Close();
         }
     delete iContentProvider;
+    if ( iLocalStore )
+        {
+        iLocalStore->Close( *this );
+        }
+    Release( iAppServices );
     }
 
     
@@ -126,6 +133,8 @@
 //
 void CNamesListUIExtensionPlugin::ConstructL()
     {
+    iLocalStoreContactsCount = 0;	
+    iAppServices = CPbk2ApplicationServices::InstanceL();
     }
 
 // --------------------------------------------------------------------------
@@ -136,8 +145,7 @@
 	{
     if( !iContentProvider )
         {
-        MPbk2ApplicationServices& apps = Phonebook2::Pbk2AppUi()->ApplicationServices();
-        TAny* ext = apps.MPbk2ApplicationServicesExtension( 
+        TAny* ext = iAppServices->MPbk2ApplicationServicesExtension( 
             KMPbk2ApplicationServicesExtension2Uid );
         if( !ext )
             {
@@ -145,7 +153,7 @@
             }
         CPbk2StoreManager& storeManager = 
             static_cast<MPbk2ApplicationServices2*>(ext)->StoreManager();
-        iContentProvider = CSpbContentProvider::NewL( apps.ContactManager(), storeManager,  
+        iContentProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), storeManager,  
             CSpbContentProvider::EStatusMessage | CSpbContentProvider::EPhoneNumber );
         }
 	return *iContentProvider;
@@ -288,17 +296,6 @@
                 }
             break;
             }
-/* Patrik 23.10.2008 Removed as agreed by ECE program management.
-        case R_PHONEBOOK2_MOVE_TOPCONTACTS:
-            {
-            if( !Pbk2NlxMenuFiltering::TopRearrangingReadyL( aControl ) || 
-                aControl.ContactsMarked() ) 
-                {
-                DimItem( aMenuPane, EPbk2CmdMoveInTopContactsList);
-                }
-            break;
-            }
-*/
         case R_PHONEBOOK2_NAMELIST_CALL_CONTACT_MENU:
             {
             if ( Pbk2NlxMenuFiltering::AddToFavoritesCmdSelected( aControl ) )
@@ -424,16 +421,10 @@
             }
         case R_PHONEBOOK2_MERGE_CONTACTS:
             {
-            MVPbkContactStoreList& storeList = 
-                Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().ContactStoresL();
-            // only phone memory contacts can be merged
-            MVPbkContactStore* store = storeList.Find( VPbkContactStoreUris::DefaultCntDbUri() );
             TInt numberOfContacts = 0;
-            if( store )
-                {
-                MVPbkContactLink* mylink = MyCardLink();
-                numberOfContacts = store->StoreInfo().NumberOfContactsL() - ( mylink ? 1 : 0 );
-                }
+            MVPbkContactLink* mylink = MyCardLink();
+            numberOfContacts = iLocalStoreContactsCount - ( mylink ? 1 : 0 );
+            
             // there must be two contacts to do merge
             if ( numberOfContacts  < KMinNumOfContactsToMerge )
                 {
@@ -534,7 +525,8 @@
 		{
 		mycard = iNamesListExViewRef->MyCard();
 		}
-	
+    InitLocalStoreObserverL();
+    
     MPbk2ContactUiControlExtension* extension = 
         CPbk2NameslistUiControlExtension::NewL( aContactManager, ContentProviderL(), mycard );
     return extension;
@@ -734,5 +726,85 @@
             break;
         }
     }            
-	
+// --------------------------------------------------------------------------
+// CNamesListUIExtensionPlugin::StoreReady
+// --------------------------------------------------------------------------
+//
+void CNamesListUIExtensionPlugin::StoreReady( MVPbkContactStore& aContactStore )
+    {
+    if ( aContactStore.StoreProperties().Name().UriDes().Compare
+            ( VPbkContactStoreUris::DefaultCntDbUri() ) )
+        {
+        iLocalStoreContactsCount = iLocalStore->StoreInfo().NumberOfContactsL();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CNamesListUIExtensionPlugin::StoreUnavailable
+// --------------------------------------------------------------------------
+//
+void CNamesListUIExtensionPlugin::StoreUnavailable
+        ( MVPbkContactStore& aContactStore, TInt /*aReason*/ )
+    {
+    if ( aContactStore.StoreProperties().Name().UriDes().Compare
+            ( VPbkContactStoreUris::DefaultCntDbUri() ) && iLocalStore )
+        {
+        iLocalStore->Close( *this );
+        iLocalStore = NULL;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CNamesListUIExtensionPlugin::HandleStoreEventL
+// --------------------------------------------------------------------------
+//
+void CNamesListUIExtensionPlugin::HandleStoreEventL(
+        MVPbkContactStore& aContactStore,
+        TVPbkContactStoreEvent aStoreEvent )
+    {
+    if ( aContactStore.StoreProperties().Name().UriDes().Compare
+            ( VPbkContactStoreUris::DefaultCntDbUri() ) )
+        {
+        switch ( aStoreEvent.iEventType )
+           {
+           case TVPbkContactStoreEvent::EContactAdded:
+               {
+               iLocalStoreContactsCount++;
+               break;
+               }
+    
+           case TVPbkContactStoreEvent::EContactDeleted:
+               {
+               iLocalStoreContactsCount--;
+               break;
+               }
+               
+           case TVPbkContactStoreEvent::EStoreBackupRestoreCompleted:
+           case TVPbkContactStoreEvent::EUnknownChanges:
+               {
+               iLocalStoreContactsCount = iLocalStore->StoreInfo().NumberOfContactsL();
+               break;
+               }
+               
+           default:
+               break;
+           }
+        }
+    }
+// --------------------------------------------------------------------------
+// CNamesListUIExtensionPlugin::InitLocalStoreObserverL
+// --------------------------------------------------------------------------
+//
+void CNamesListUIExtensionPlugin::InitLocalStoreObserverL()
+    {
+    if ( !iLocalStore )
+        {
+        MVPbkContactStoreList& storeList = iAppServices->ContactManager().ContactStoresL();
+        iLocalStore = storeList.Find( VPbkContactStoreUris::DefaultCntDbUri() );
+        if ( iLocalStore )
+            {
+            iLocalStore->OpenL( *this );
+            }
+        }
+    }
 //  End of File
--- a/phonebookui/Phonebook2/NamesListExtension/src/Pbk2NlxMenuFiltering.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/Pbk2NlxMenuFiltering.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -38,7 +38,7 @@
 #include <MPbk2ContactLinkIterator.h>
 #include <MPbk2UiControlCmdItem.h>
 #include <Pbk2Commands.hrh>
-#include "pbk2nameslistex.hrh"
+#include "Pbk2NamesListEx.hrh"
 
 
 const TInt KMinNumberOfTopContactsForRearranging = 2;
--- a/phonebookui/Phonebook2/NamesListExtension/src/cpbk2cmditemmycard.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/cpbk2cmditemmycard.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -54,8 +54,8 @@
 
 void CPbk2CmdItemMyCard::ConstructL()
     {
-    iCreateMyCardText = StringLoader::LoadL( R_QTN_PHOB_CREATE_MYCARD );
-    iOpenMyCardText = StringLoader::LoadL( R_QTN_PHOB_OPEN_MYCARD );
+    iCreateMyCardText = StringLoader::LoadL( R_QTN_CONTACTS_MC_SET_UP_MY_CARD );
+    iOpenMyCardText = StringLoader::LoadL( R_QTN_CONTACTS_MC_MY_CARD );
     iMyCard.SetObserverL(*this);
     }
 
--- a/phonebookui/Phonebook2/NamesListExtension/src/cpbk2deletemycardcmd.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/cpbk2deletemycardcmd.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -18,6 +18,9 @@
 
 // INCLUDE FILES
 #include "cpbk2deletemycardcmd.h"
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <Pbk2ExNamesListRes.rsg>
 
 // Phonebook2
 #include <CPbk2ApplicationServices.h>
@@ -89,9 +92,7 @@
         }
 
     delete iContactsArray;
-    delete iRetrieveOperation;
     delete iDeleteOperation;
-    delete iStoreContact;
     Release( iAppServices );
     }
 
@@ -136,7 +137,7 @@
     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
         ("CPbk2DeleteMyCardCmd::ExecuteLD(0x%x)"), this);
 
-    IssueRequest( ERetrieving );
+    IssueRequest( EConfirming );
     }
 
 // --------------------------------------------------------------------------
@@ -180,13 +181,6 @@
 
     switch ( iState )
         {
-        case ERetrieving:
-            {
-            __ASSERT_DEBUG( iContactsArray->Count() == 1, 
-                Panic(EPanicInvalidArray ));
-            RetrieveContactL( iContactsArray->At(0) );
-            break;
-            }
         case EConfirming:
             {
             ConfirmDeletionL();
@@ -228,43 +222,6 @@
     }
 
 // --------------------------------------------------------------------------
-// CPbk2DeleteMyCardCmd::VPbkSingleContactOperationComplete
-// --------------------------------------------------------------------------
-//
-void CPbk2DeleteMyCardCmd::VPbkSingleContactOperationComplete(
-    MVPbkContactOperationBase& aOperation,
-    MVPbkStoreContact* aContact )
-    {
-    if ( &aOperation == iRetrieveOperation )
-        {
-        delete iRetrieveOperation;
-        iRetrieveOperation = NULL;
-
-        // We now have a store contact and we can issue a confirmation
-        iStoreContact = aContact;
-        IssueRequest( EConfirming );
-        }
-    }
-
-// --------------------------------------------------------------------------
-// CPbk2DeleteMyCardCmd::VPbkSingleContactOperationFailed
-// --------------------------------------------------------------------------
-//
-void CPbk2DeleteMyCardCmd::VPbkSingleContactOperationFailed(
-    MVPbkContactOperationBase& aOperation,
-    TInt aError )
-    {
-    if ( &aOperation == iRetrieveOperation )
-        {
-        delete iRetrieveOperation;
-        iRetrieveOperation = NULL;
-
-        // We cannot get the contact, so we have to fail
-        ProcessDismissed( aError );
-        }
-    }
-
-// --------------------------------------------------------------------------
 // CPbk2DeleteMyCardCmd::StepComplete
 // --------------------------------------------------------------------------
 //
@@ -330,18 +287,6 @@
     }
 
 // --------------------------------------------------------------------------
-// CPbk2DeleteMyCardCmd::RetrieveContactL
-// --------------------------------------------------------------------------
-//
-void CPbk2DeleteMyCardCmd::RetrieveContactL(
-        const MVPbkContactLink& aContactLink )
-    {
-    // Retrieve the actual store contact from the given link
-    iRetrieveOperation = iAppServices->
-        ContactManager().RetrieveContactL( aContactLink, *this );
-    }
-
-// --------------------------------------------------------------------------
 // CPbk2DeleteMyCardCmd::DeleteContactL
 // --------------------------------------------------------------------------
 //
@@ -378,11 +323,10 @@
 //
 void CPbk2DeleteMyCardCmd::ConfirmDeletionL()
     {
-    CPbk2GeneralConfirmationQuery* query =
-            CPbk2GeneralConfirmationQuery::NewL();
-    
-    if( query->ExecuteLD( *iStoreContact, R_QTN_QUERY_COMMON_CONF_DELETE, 
-            MPbk2ContactNameFormatter::EPreserveAllOriginalSpaces ) )
+    HBufC* prompt = 
+        StringLoader::LoadLC( R_QTN_PHOB_MY_CARD_CLEAR_CONFIRM );
+    CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+    if( dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) )
         {
         // Continue with starting the deletion
         IssueRequest( EStarting );
@@ -391,6 +335,7 @@
         {
         IssueRequest( ECanceling );
         }
+    CleanupStack::PopAndDestroy( prompt );
     }
 
 //  End of File
--- a/phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NamesListExtension/src/cpbk2mycard.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -174,7 +174,7 @@
 // CPbk2MyCard::MyCardBitmap
 // --------------------------------------------------------------------------
 //
-CFbsBitmap* CPbk2MyCard::MyCardBitmap() const
+CFbsBitmap* CPbk2MyCard::MyCardBitmapL() const
 	{
 	// if fetched
 	if( iThumbBitmap )
@@ -184,7 +184,7 @@
 		CleanupStack::PushL( dstbitmap );
 	
 		//Get the handle to source bitmap
-		TInt srchandle = iThumbBitmap->Handle();
+		const TInt srchandle = iThumbBitmap->Handle();
 		
 		//Duplicate the bitmap handle. Increases the RefCount of bitmap 
 		//managed but Fbs Server
@@ -235,7 +235,8 @@
     NotifyObservers( MPbk2MyCardObserver::EStateStatusResolved );
     
     // fetch store contact
-    iRetrieveOperation = iContactManager->RetrieveContactL( *iMyCardLink, *this );
+    TRAP_IGNORE( iRetrieveOperation = 
+            iContactManager->RetrieveContactL( *iMyCardLink, *this ) );
     }
 
 // --------------------------------------------------------------------------
@@ -271,7 +272,14 @@
     iMyCardStoreContact = aContact;
     
     // load thumbnail
-    LoadThumbnailL( *iMyCardStoreContact );
+    TRAPD( error, LoadThumbnailL( *iMyCardStoreContact ) );
+    if( error )
+        {
+        delete iThumbBitmap;
+        iThumbBitmap = NULL;
+        // inform observers
+        NotifyObservers( MPbk2MyCardObserver::EStateThumbnailNotFound );
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -341,12 +349,12 @@
 		
 			// Define parameters for thumbnail
 			TPbk2ImageManagerParams params;
-			TInt useCropping = 0x0008;
 			// set params
 			params.iSize = size;
-			params.iFlags = TPbk2ImageManagerParams::EScaleImage |
-							TPbk2ImageManagerParams::EKeepAspectRatio |
-							useCropping;	//CROP IMAGE	
+            params.iFlags = TPbk2ImageManagerParams::EScaleImage |
+			                TPbk2ImageManagerParams::EUseSpeedOptimizedScaling |
+							TPbk2ImageManagerParams::ECropImage ;
+            params.iDisplayMode = EColor16MU;	
 			// contact has image. load it.
 			iImageOperation = iImageManager->GetImageAsyncL( 
 				&params, aContact, *thumbType, *this );
@@ -377,11 +385,7 @@
                 KMVPbkContactStoreExtension2Uid));
     if ( phoneStoreExtension )
 		{
-		TRAPD( err, iOperation = phoneStoreExtension->OwnContactLinkL(*this) );
-		if( err )
-			{
-			// TODO: How is this handled?
-			}
+		TRAP_IGNORE( iOperation = phoneStoreExtension->OwnContactLinkL(*this) );
 		}
     }
 
--- a/phonebookui/Phonebook2/NewContactLauncher/data/NewContactLauncher.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/NewContactLauncher/data/NewContactLauncher.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -27,9 +27,9 @@
 #include "NewContactLauncher.hrh"
 #include "NewContactLauncher.rls"
 #include "phonebook2.loc"
-#include <aiwcommon.rh>
-#include <aiwcommon.hrh>
-#include <aiwgenericparam.hrh>
+#include <AiwCommon.rh>
+#include <AiwCommon.hrh>
+#include <AiwGenericParam.hrh>
 //  RESOURCE DEFINITIONS
 // -----------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/Presentation/inc/CPbk2ImageManagerImpl.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/inc/CPbk2ImageManagerImpl.h	Fri Feb 19 22:40:27 2010 +0200
@@ -26,7 +26,7 @@
 
 // CONSTANTS
 // Size of thumbnail images stored to contacts
-#define KPbk2PersonalImageSize TSize(80,96)
+#define KPbk2PersonalImageSize TSize(150,150)
 
 //  FORWARD DECLARATIONS
 class MPbk2ImageGetObserver;
--- a/phonebookui/Phonebook2/Presentation/rss/Pbk2PresentationCommon.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/rss/Pbk2PresentationCommon.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -2012,6 +2012,11 @@
                     {
                     context = EPbk2CopyQueryItem;
                     text = qtn_pbcop_copy_query_list_item_phone;
+                    },
+                PHONEBOOK2_LOCALIZED_TEXT
+                    {
+                    context = EPbk2MemInfoContacts;
+                    text = qtn_phob_pb_info_memory_phone_colon;
                     }
                 };
             }
--- a/phonebookui/Phonebook2/Presentation/src/CPbk2ContactViewBuilder.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/src/CPbk2ContactViewBuilder.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -44,7 +44,6 @@
 #include <coemain.h>
 #include <barsread.h>
 
-
 // --------------------------------------------------------------------------
 // CPbk2ContactViewBuilder::CPbk2ContactViewBuilder
 // --------------------------------------------------------------------------
@@ -95,6 +94,22 @@
         ( EPbk2MainNamesList, aUriArray, aObserver, aSortOrder, aFilter, aFlags );
     }
 
+// --------------------------------------------------------------------------
+// CPbk2ContactViewBuilder::CreateContactViewForStoresLC
+// --------------------------------------------------------------------------
+//
+EXPORT_C MVPbkContactViewBase*
+    CPbk2ContactViewBuilder::CreateContactViewForStoresLC(
+        const CVPbkContactStoreUriArray& aUriArray,
+        MVPbkContactViewObserver& aObserver,
+        const MVPbkFieldTypeList& aSortOrder,
+        CVPbkFieldTypeSelector* aFilter,
+        TUint32 aFlags,
+        MVPbkContactSelector* aContactSelector) const
+    {
+    return CreateViewForStoresLC
+        ( EPbk2MainNamesList, aUriArray, aObserver, aSortOrder, aFilter, aFlags, EFalse, aContactSelector );
+    }
 
 // --------------------------------------------------------------------------
 // CPbk2ContactViewBuilder::CreateTopNonTopContactViewForStoresLC
@@ -195,7 +210,8 @@
         const MVPbkFieldTypeList& aSortOrder,
         CVPbkFieldTypeSelector* aFilter,
         TUint32 aFlags,
-        TBool aTopContacts ) const
+        TBool aTopContacts,
+        MVPbkContactSelector* aContactSelector) const
     {
     // Main view is a composite view that contains several sub composite
     // views. The subviews are identified by TPbk2ContactViewLocation. 
@@ -255,6 +271,10 @@
                     	{
                     	newSubView->SetFlag ( EVPbkExcludeEmptyGroups, ETrue );
                     	}
+                    if( !(newSubView->ContactSelector()) )
+                        {
+                        newSubView->SetContactSelector( aContactSelector );
+                        }
                     
                     subView.AddSubViewL( newSubView );
                     CleanupStack::Pop();
--- a/phonebookui/Phonebook2/Presentation/src/CPbk2ImageReader.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/src/CPbk2ImageReader.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -23,6 +23,8 @@
 // From Phonebook2
 #include "MPbk2ImageReaderObserver.h"
 #include "TPbk2ImageManagerParams.h"
+#include <Pbk2CmdExtRes.rsg>
+#include "Pbk2PresentationUtils.h"
 
 // From Virtual Phonebook
 
@@ -30,6 +32,9 @@
 #include <imageconversion.h>
 #include <bitmaptransforms.h>
 #include <JP2KUids.hrh>
+#include <aknnotewrappers.h>
+#include <StringLoader.h>
+#include <AknIconUtils.h>
 
 /// Unnamed namespace for local defintions
 namespace {
@@ -279,7 +284,17 @@
     iMimeString = NULL;
     iMimeString = HBufC8::NewL(KMaxMimeTypeLength);
     TPtr8 mimePtr = iMimeString->Des();
-    CImageDecoder::GetMimeTypeFileL(iFsSession, aFileName, mimePtr);
+    
+    TRAPD( err, CImageDecoder::GetMimeTypeFileL(iFsSession, aFileName, mimePtr) );
+    	
+    if( err == KErrNotFound )
+        {
+        HBufC* prompt = StringLoader::LoadLC( R_QTN_ALBUM_ERR_FORMAT_UNKNOWN );
+        CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue );
+        dlg->ExecuteLD( *prompt );
+        CleanupStack::PopAndDestroy( prompt );
+        User::Leave( err );
+        }    		
     }
 
 // --------------------------------------------------------------------------
@@ -385,49 +400,13 @@
 //
 void CPbk2ImageReader::CropImageToSquareL()
 	{
-	TInt useCropping = 0x0008;
 	// if cropping is wanted
-	if( iParams.iFlags & useCropping )	//TODO change value ( contacts_plat/image_managemet_api/TPbk2ImageManagerParams )
+	if( iParams.iFlags & TPbk2ImageManagerParams::ECropImage )	
 		{
-		TSize size = iBitmap->SizeInPixels();
-		// crop the image only if the width is bigger than height 
-		if( size.iHeight >= size.iWidth )
-			{
-			// no cropping
-			return;
-			}
-		// take the shorter side
-		TInt sideSize = size.iHeight;	
-		
-		// set target size
-		TSize targetSize( sideSize,sideSize );
-	
-		// crop from both sides
-		TRect targetRect( TPoint( ( size.iWidth - targetSize.iWidth ) / 2,
-								  ( size.iHeight - targetSize.iHeight ) / 2 ),
-									targetSize );
-		
-		// create new bitmap
-		CFbsBitmap* target = new( ELeave ) CFbsBitmap;
-		CleanupStack::PushL( target );
-		User::LeaveIfError( target->Create( targetSize, iBitmap->DisplayMode() ) );
-		
-		// get scanline
-		HBufC8* scanLine = HBufC8::NewLC( iBitmap->ScanLineLength
-			( targetSize.iWidth, iBitmap->DisplayMode() ) );
-		TPtr8 scanLinePtr = scanLine->Des();
-		
-		TPoint startPoint( targetRect.iTl.iX, targetRect.iTl.iY );
-		TInt targetY = 0;
-		for (; startPoint.iY < targetRect.iBr.iY; ++startPoint.iY )
-			{
-			iBitmap->GetScanLine( scanLinePtr, startPoint, targetSize.iWidth, iBitmap->DisplayMode() );
-			target->SetScanLine( scanLinePtr, targetY++ );
-			}
-	
-		iBitmap->Reset();
-		User::LeaveIfError( iBitmap->Duplicate( target->Handle() ) );
-		CleanupStack::PopAndDestroy(2, target); // scanLine, target
+        Pbk2PresentationImageUtils::CropImageL( 
+                *iBitmap, 
+                Pbk2PresentationImageUtils::ELandscapeOptimizedCropping, 
+                iParams.iSize );
 		}
 	}
 
@@ -440,10 +419,38 @@
     {
     __ASSERT_DEBUG(iBitmap, Panic(EPanicPreCond_ScaleBitmapL));
 
+    const TSize bitmapSize = iBitmap->SizeInPixels();
     if ((iParams.iFlags & TPbk2ImageManagerParams::EScaleImage) && 
-        !(iParams.iFlags & TPbk2ImageManagerParams::EUseFastScaling))
+         !(iParams.iFlags & TPbk2ImageManagerParams::EUseFastScaling) &&
+         (iParams.iFlags & TPbk2ImageManagerParams::EUseSpeedOptimizedScaling) &&
+         ( bitmapSize.iHeight == bitmapSize.iWidth ) )
         {
-        const TSize bitmapSize = iBitmap->SizeInPixels();
+        if( bitmapSize.iWidth > iParams.iSize.iWidth || 
+            bitmapSize.iHeight > iParams.iSize.iHeight )
+            {
+            // Use avkon scaler
+            TRect targetRect(TPoint(0,0), 
+                    TSize( ( iParams.iSize.iWidth ), 
+                           ( iParams.iSize.iHeight ) ) );
+            
+            CFbsBitmap* target = new( ELeave ) CFbsBitmap;
+            CleanupStack::PushL( target );
+            User::LeaveIfError( target->Create( 
+                    targetRect.Size(), iBitmap->DisplayMode() ) );
+            
+            AknIconUtils::ScaleBitmapL( targetRect, target, iBitmap );
+            
+            iBitmap->Reset();
+            User::LeaveIfError( iBitmap->Duplicate( target->Handle() ) );
+            CleanupStack::PopAndDestroy( target );
+            
+            NextStateL();
+            return;
+            }
+        }
+    else if ((iParams.iFlags & TPbk2ImageManagerParams::EScaleImage) && 
+             !(iParams.iFlags & TPbk2ImageManagerParams::EUseFastScaling) )
+        {
         if (bitmapSize.iWidth > iParams.iSize.iWidth || 
             bitmapSize.iHeight > iParams.iSize.iHeight)
             {
@@ -456,7 +463,7 @@
             return;
             }
         }
-
+    
     // No scaling requested or needed, go directly to next state
     NextStateL();
     }
--- a/phonebookui/Phonebook2/Presentation/src/CPbk2ImageWriterBase.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/src/CPbk2ImageWriterBase.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -25,6 +25,7 @@
 #include "CPbk2ImageReader.h"
 #include "MPbk2ImageOperationObservers.h"
 #include "CPbk2ImageData.h"
+#include "Pbk2PresentationUtils.h"
 
 // From System
 #include <imageconversion.h>
@@ -317,6 +318,12 @@
     {
     __ASSERT_DEBUG(iBitmap, Panic(EPanicPreCond_ScaleBitmapL));
     iState = EStateScaleBitmap;
+    
+    Pbk2PresentationImageUtils::CropImageL( 
+            *iBitmap, 
+            Pbk2PresentationImageUtils::ELandscapeOptimizedCropping, 
+            ImageSize() );
+    
     if (iBitmap->SizeInPixels() <= ImageSize())
         {
         // Bitmap size is <= personal image size -> skip scaling
--- a/phonebookui/Phonebook2/Presentation/src/CPbk2StoreProperty.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/src/CPbk2StoreProperty.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -298,9 +298,9 @@
     {
     CPbk2Content* content = NULL;
 
-    if ( aContext == EPbk2MemInfoPhone || aContext == EPbk2CopyQueryItem )
+    if ( aContext == EPbk2MemInfoPhone || aContext == EPbk2CopyQueryItem || aContext == EPbk2MemInfoContacts )
         {        
-        // Both EPbk2MemInfoPhone and EPbk2CopyQueryItem use same kind of 
+        // Both EPbk2MemInfoPhone EPbk2CopyQueryItem and EPbk2MemInfoContacts use same kind of 
         // content
         content =  new ( ELeave ) CPbk2StorePropertyContentStoreName
             (  iLocalizedTexts.Array(), aContext );
@@ -349,6 +349,21 @@
         // CPbk2LocalizedText::NewL has taken the ownership of text
         }
     CleanupStack::PopAndDestroy( content );
+    	
+   	// Copy EPbk2MemInfoContacts
+    content = 
+        aProperty.RetrieveContentLC( EPbk2MemInfoContacts );
+    propContent = 
+        dynamic_cast<CPbk2StorePropertyContentStoreName*>( content );
+    if ( propContent )
+        {
+        TInt uid = propContent->Uid();
+        HBufC* text = propContent->StoreName().AllocLC();
+        iLocalizedTexts.AppendL( CPbk2LocalizedText::NewL( uid, text ) );
+        CleanupStack::Pop( text ); 
+        // CPbk2LocalizedText::NewL has taken the ownership of text
+        }
+    CleanupStack::PopAndDestroy( content );
         
     }
     
--- a/phonebookui/Phonebook2/Presentation/src/Pbk2PresentationUtils.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/Presentation/src/Pbk2PresentationUtils.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -21,6 +21,7 @@
 
 // From system
 #include <featmgr.h>
+#include <fbs.h>
 
 /// Namespace for local PresentationUtils definitions
 namespace __RVCT_UNS_Pbk2PresentationUtils {
@@ -225,6 +226,67 @@
         }
     return KPbk2PresentationResFile;
     }    
-    
+
+
+// --------------------------------------------------------------------------
+// Pbk2PresentationImageUtils::CropImageL
+// --------------------------------------------------------------------------
+//
+EXPORT_C void Pbk2PresentationImageUtils::CropImageL( 
+        CFbsBitmap& aBitmap, 
+        TCroppingMode aCroppingMode, 
+        const TSize& aTargetSize  )
+    {
+    const TSize sourceSize( aBitmap.SizeInPixels() );
+    // crop the image only if the width is bigger than height 
+    if( sourceSize.iHeight >= sourceSize.iWidth )
+        {
+        // no cropping
+        return;
+        }
+    // take the shorter side
+    const TInt sideSize( sourceSize.iHeight );   
+    TInt sideSizeW( sourceSize.iHeight );   
+    if( ELandscapeOptimizedCropping &&
+        sideSizeW < aTargetSize.iWidth )
+        {
+        sideSizeW = aTargetSize.iWidth;
+        if( sideSizeW >= sourceSize.iWidth )
+            {
+            return; // no cropping
+            }
+        }
     
+    // set target size
+    const TSize targetSize( sideSizeW, sideSize );
+
+    // crop from both sides
+    const TRect targetRect( TPoint( ( sourceSize.iWidth - targetSize.iWidth ) / 2,
+                              ( sourceSize.iHeight - targetSize.iHeight ) / 2 ),
+                              targetSize );
+    
+    // create new bitmap
+    CFbsBitmap* target = new( ELeave ) CFbsBitmap;
+    CleanupStack::PushL( target );
+    const TDisplayMode displayMode( aBitmap.DisplayMode() );
+    User::LeaveIfError( target->Create( targetSize, displayMode ) );
+    
+    // get scanline
+    HBufC8* scanLine = HBufC8::NewLC( aBitmap.ScanLineLength
+        ( targetSize.iWidth, displayMode ) );
+    TPtr8 scanLinePtr = scanLine->Des();
+    
+    TPoint startPoint( targetRect.iTl.iX, targetRect.iTl.iY );
+    TInt targetY = 0;
+    for (; startPoint.iY < targetRect.iBr.iY; ++startPoint.iY )
+        {
+        aBitmap.GetScanLine( scanLinePtr, startPoint, targetSize.iWidth, displayMode );
+        target->SetScanLine( scanLinePtr, targetY++ );
+        }
+
+    aBitmap.Reset();
+    User::LeaveIfError( aBitmap.Duplicate( target->Handle() ) );
+    CleanupStack::PopAndDestroy( 2, target ); // scanLine, target    
+    }    
+
 // End of File
--- a/phonebookui/Phonebook2/ServerApplication/inc/CPbk2SelectSinglePropertyPhase.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ServerApplication/inc/CPbk2SelectSinglePropertyPhase.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,7 @@
 #include <MVPbkSingleContactOperationObserver.h>
 #include <MPbk2ExitCallback.h>
 #include "MPbk2ServicePhase.h"
-#include <mvpbkcontactobserver.h>
+#include <MVPbkContactObserver.h>
 
 // FORWARD DECLARATIONS
 class CVPbkContactLinkArray;
--- a/phonebookui/Phonebook2/ServerApplication/inc/CPbk2ServerAppStoreManager.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ServerApplication/inc/CPbk2ServerAppStoreManager.h	Fri Feb 19 22:40:27 2010 +0200
@@ -39,6 +39,7 @@
 class CPbk2StoreConfiguration;
 class CVPbkSortOrderAcquirer;
 class MVPbkContactLinkArray;
+class CPbk2MyCardFilter;
 
 // CLASS DECLARATION
 
@@ -191,6 +192,8 @@
         CVPbkSortOrderAcquirer* iSortOrderAcquirer;
         /// Ref: list of opened contact stores
         RPointerArray<MVPbkContactStore> iOpenedStores;
+        /// Own: 
+        CPbk2MyCardFilter* iMyCardFilter;
     };
 
 #endif // CPBK2SERVERAPPSTOREMANAGER_H
--- a/phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppStoreManager.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ServerApplication/src/CPbk2ServerAppStoreManager.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -42,10 +42,15 @@
 #include <MVPbkContactLinkArray.h>
 #include <CVPbkSortOrderAcquirer.h>
 #include <VPbkSortOrderAcquirerUid.h>
+#include <MVPbkBaseContact.h>
+#include <MVPbkContactSelector.h>
 
 // Debugging headers
 #include <Pbk2Debug.h>
 
+#include <featmgr.h>
+
+
 /// Unnamed namespace for local definitions
 namespace {
 
@@ -66,6 +71,51 @@
 
 } /// namespace
 
+/**
+ * Helper class to filter mycard from phonebooks views
+ */
+class CPbk2MyCardFilter : public CBase, 
+                          public MVPbkContactSelector
+    {
+public:
+    CPbk2MyCardFilter();
+    ~CPbk2MyCardFilter();
+protected:  // From MVPbkContactSelector
+    TBool IsContactIncluded(
+                const MVPbkBaseContact& aContact );
+    };
+
+CPbk2MyCardFilter::CPbk2MyCardFilter()
+    {
+    }
+
+CPbk2MyCardFilter::~CPbk2MyCardFilter()
+    {
+    }
+
+TBool CPbk2MyCardFilter::IsContactIncluded(
+                const MVPbkBaseContact& aContact )
+    {
+    TBool isContactIncluded( ETrue );
+    // this is temporary solution to hide own contact from phonebook contacts list,
+    // TODO remove this code when we can hide own contact with contact model
+
+    MVPbkBaseContact& contact = const_cast<MVPbkBaseContact&>( aContact );
+    TAny* extension = contact.BaseContactExtension( 
+                KVPbkBaseContactExtension2Uid );
+
+    if( extension )
+        {
+        MVPbkBaseContact2* baseContactExtension =
+                static_cast<MVPbkBaseContact2*>( extension );
+        TInt error( KErrNone );
+        isContactIncluded =
+                ( !baseContactExtension->IsOwnContact( error ) );
+        }
+    
+    return isContactIncluded;
+    }
+
 // --------------------------------------------------------------------------
 // CPbk2ServerAppStoreManager::CPbk2ServerAppStoreManager
 // --------------------------------------------------------------------------
@@ -169,11 +219,22 @@
     CPbk2ContactViewBuilder* viewBuilder = CPbk2ContactViewBuilder::NewLC
         ( iContactManager, aStoreProperties );
 
+    if( !iMyCardFilter )
+        {
+        FeatureManager::InitializeLibL();
+        if( FeatureManager::FeatureSupported( KFeatureIdffContactsMycard ) )
+            {
+            iMyCardFilter = new (ELeave) CPbk2MyCardFilter();
+            }
+        FeatureManager::UnInitializeLib();    
+        }
+
+    
     if ( aViewType == EVPbkContactsView )
         {
         result = viewBuilder->CreateContactViewForStoresLC
             ( aStoreUris, *this, aSortOrderManager.SortOrder(),
-              aViewFilter, aFlags );
+              aViewFilter, aFlags, iMyCardFilter );
         CleanupStack::Pop(); // result
         }
     else if ( aViewType == EVPbkGroupsView )
@@ -211,10 +272,11 @@
 
             }
         CleanupStack::PopAndDestroy(); // implementations
-        
+                
         result = viewBuilder->CreateGroupViewForStoresLC
             ( aStoreUris, *this, *sortOrder,
               aViewFilter, aFlags );
+        
         CleanupStack::Pop(); // result
         }
 
--- a/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2ContactEditorDlgImpl.h	Fri Feb 19 22:40:27 2010 +0200
@@ -444,10 +444,6 @@
         MPbk2ApplicationServices* iAppServices;
         // Own: Custom title text
         HBufC* iTitleText;
-        // The latest command id
-        TInt iCommandId;      
-        //Resource loader
-        RCoeResourceLoader iPbk2UiResource;
     };
 
 #endif // CPBK2CONTACTEDITORDLGIMPL_H
--- a/phonebookui/Phonebook2/UIControls/inc/cpbk2doublelistboxmodelcmddecorator.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/inc/cpbk2doublelistboxmodelcmddecorator.h	Fri Feb 19 22:40:27 2010 +0200
@@ -19,7 +19,7 @@
 #define CPBK2DOUBLELISTBOXMODELCMDDECORATOR_H_
 
 // internal
-#include "cpbk2listboxmodelcmddecorator.h"
+#include "CPbk2ListboxModelCmdDecorator.h"
 
 class CPbk2ContactViewDoubleListboxDataElement;
 
--- a/phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/rss/Pbk2GeneralNotes.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -97,6 +97,33 @@
             }
         };
     }
+
+// ---------------------------------------------------------
+// General synchronizing progress bar note
+// ---------------------------------------------------------
+//
+RESOURCE DIALOG r_qtn_gen_note_synchronizing_progress
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EPbk2NoteContactsSynchronizing;
+            control = AVKON_NOTE 
+                { 
+                layout = EWaitLayout;
+		singular_label = qtn_gen_note_processing;		
+                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/rss/Pbk2Selectors.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/rss/Pbk2Selectors.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -1023,4 +1023,18 @@
     excludedParameters = {EVPbkVersitParamPAGER,EVPbkVersitParamFAX,EVPbkVersitParamVIDEO};
     }
 
+// --------------------------------------------------------------------------
+//  Selector for Xsp fields
+// --------------------------------------------------------------------------
+//
+RESOURCE VPBK_FIELD_TYPE_SELECTOR r_phonebook2_impp_selector
+    {
+    versitProperties =
+        {
+        VBK_FIELD_VERSIT_PROPERTY
+            {
+            name = EVPbkVersitNameIMPP;
+            }
+       };
+    }
 // End of File
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -27,7 +27,7 @@
 
 const TInt KMaxAdaptiveGridCacheCount = 10;
 const TInt KAdaptiveSearchKeyMapGranularity = 100;
-const TInt KAdaptiveSearchRefineStep = 200;
+const TInt KAdaptiveSearchRefineStep = 10;
 const TInt KContactFormattingFlags = MPbk2ContactNameFormatter::EPreserveLeadingSpaces | MPbk2ContactNameFormatter::EReplaceNonGraphicChars;
 
 
@@ -75,7 +75,7 @@
 // --------------------------------------------------------------------------
 //
 CPbk2AdaptiveSearchGridFiller::CPbk2AdaptiveSearchGridFiller( CAknSearchField& aField, MPbk2ContactNameFormatter& aNameFormatter )
-	: CActive( CActive::EPriorityStandard ), iSearchField( aField ), iNameFormatter( aNameFormatter ),
+	: CActive( CActive::EPriorityIdle ), iSearchField( aField ), iNameFormatter( aNameFormatter ),
 	iInvalidateAdaptiveSearchGrid( EFalse ),iSetFocusToSearchGrid( ETrue )
     {
 	CActiveScheduler::Add( this );
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -79,7 +79,6 @@
 #include <MVPbkContactFieldData.h>
 #include <MVPbkFieldType.h>
 #include <TVPbkFieldVersitProperty.h>
-#include <ccappmycardpluginrsc.rsg>
 
 #include <VPbkEng.rsg> 
 #include <VPbkFieldType.hrh>
@@ -95,9 +94,6 @@
 #include <hlplch.h>
 #include <aknnavide.h>
 #include <akninputblock.h>
-#include <coemain.h>
-
-_LIT( KCCAppMyCardPluginResFileName, "\\resource\\ccappmycardpluginrsc.rsc");
 
 /// Unnamed namespace for local definitions
 namespace {
@@ -175,8 +171,7 @@
         iEndKeyWasPressed( EFalse ),
         iAddressViewStandalone( EFalse ),
         iAppServices( aAppServices ),
-        iTitleText( aTitleText ),
-        iPbk2UiResource( *CCoeEnv::Static() )        
+        iTitleText( aTitleText )
     {
     // Exit is approved by default
     iExitRecord.Set( EExitApproved );
@@ -219,8 +214,7 @@
     // Restore the titlepane text
     if (iTitlePane && iStoredTitlePaneText)
         {
-        // iTitlePane takes ownership of iStoredTitlePaneText
-        iTitlePane->SetText(iStoredTitlePaneText);
+        iTitlePane->SetTextL(*iStoredTitlePaneText);
         }
 
     // Reset title pane picture
@@ -241,37 +235,10 @@
     delete iEditorExtension;
     delete iUiFieldArray;
     Release(iExtensionManager);
-        
-    if( iCommandId == EEikCmdExit || iCommandId == EAknCmdExit )
-		{	
-		CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() );      		
-			
-		if( appUi )
-			{
-			TFileName file;
-			file.Copy( KCCAppMyCardPluginResFileName );
-			iPbk2UiResource.OpenL( file );
-		
-			HBufC* title = StringLoader::LoadLC( R_QTN_MYCARD_EDITOR_TITLE );	
-			
-			iPbk2UiResource.Close();			
-			TBool okToExit = EFalse;
-			
-			if( iTitleText && iTitleText->CompareC( title->Des() ) == 0 )
-				{
-				okToExit = ETrue;
-				}
-			
-			CleanupStack::PopAndDestroy(); // title
-								
-			if ( okToExit )
-				{
-				appUi->ProcessCommandL( EAknCmdExit );
-				}								
-			}
-		}    
-    
 	delete iTitleText;    
+    iTitleText = NULL;
+    delete iStoredTitlePaneText;
+    iStoredTitlePaneText = NULL;
     }
 
 // --------------------------------------------------------------------------
@@ -905,8 +872,6 @@
         !CheckFieldSpecificCommandL(aCommandId) &&
         iExitRecord.IsClear( EExitOrdered ) )
         {
-		iCommandId = aCommandId;
-    
         switch (aCommandId)
             {
             case EPbk2CmdAddItem:
@@ -1515,15 +1480,24 @@
     {
     TInt id = aCurrentField.FieldProperty().FieldType().FieldTypeResId();  
     
-    if(id != R_VPBK_FIELD_TYPE_SYNCCLASS) 
+    // If the selection popup is open, hide menu option "Change" 
+    if( id == R_VPBK_FIELD_TYPE_SYNCCLASS ) 
         {
+        CEikCaptionedControl* line=CurrentLine();  
+        if ( line && (line->iControlType == EAknCtPopupField || line->iControlType == EAknCtPopupFieldText ) )
+            {
+            CAknPopupField* ctrl = static_cast<CAknPopupField*>( line->iControl );
+            if ( ctrl && ctrl->NumLines() > 1 ) 
+                {
+                DimItem( aMenuPane, EPbk2CmdEditorChangeSync);
+                }
+            }
+        }
+    else  // id != R_VPBK_FIELD_TYPE_SYNCCLASS
+        { 
         DimItem( aMenuPane,  EPbk2CmdEditorChangeSync);
         }
-    else 
-        {
-        //Label editing not anymore supported (is dimmed in DynInitMenuPaneL)
-        //DimItem( aMenuPane,  EPbk2CmdEditItemLabel);
-        }
+    
     }
 // CPbk2ContactEditorDlgImpl::DynInitAddressL
 // --------------------------------------------------------------------------
@@ -1633,11 +1607,6 @@
                  iNaviContainer->Pop();
                  iNaviContainer = NULL;
                  }
-            if ( iStoredTitlePaneText )
-                {
-                delete iStoredTitlePaneText;
-                iStoredTitlePaneText = NULL;
-                }
             MakeVisible( EFalse );
             MPbk2ContactEditorEventObserver::TParams params;
             params.iFlags = EPbk2EditorKeyCode;
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorFieldArray.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorFieldArray.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -34,7 +34,7 @@
 #include "TPbk2ContactEditorParams.h"
 #include <MPbk2ApplicationServices.h>
 #include "CPbk2IconInfo.h"
-#include <aknsutils.h>
+#include <AknsUtils.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include "CPbk2UIFieldArray.h"
 #include "CPbk2UIField.h"
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorPhoneNumberField.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -167,7 +167,23 @@
         {
         iControl->SetAknEditorNumericKeymap(EAknEditorStandardNumberModeKeymap);
         iControl->SetAknEditorInputMode(EAknEditorNumericInputMode);
-        iControl->SetAknEditorAllowedInputModes(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->SetAknEditorSpecialCharacterTable(0);
         }
 
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactViewListBox.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -40,7 +40,7 @@
 #include <eikclbd.h>
 
 #include <aknappui.h>
-#include <aknviewappui.h>
+#include <aknViewAppUi.h>
 
 // Debugging headers
 #include <Pbk2Debug.h>
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -471,20 +471,13 @@
          TPtr& aColumnText, TInt aColumnIndex ) const
     {
     TPbk2StoreContactAnalyzer analyzer( iParams.iContactManager, NULL );
-    TBool clip = analyzer.IsFieldTypeIncludedL
-        ( aField, R_PHONEBOOK2_PHONENUMBER_SELECTOR );
-
-    if ( !clip )
+    
+    if ( analyzer.IsFieldTypeIncludedL( aField, R_PHONEBOOK2_PHONENUMBER_SELECTOR )
+            || analyzer.IsFieldTypeIncludedL ( aField, R_PHONEBOOK2_EMAIL_SELECTOR )
+            || analyzer.IsFieldTypeIncludedL( aField, R_PHONEBOOK2_SIP_SELECTOR )
+            || analyzer.IsFieldTypeIncludedL( aField, R_PHONEBOOK2_IMPP_SELECTOR ) )
         {
-        clip = analyzer.IsFieldTypeIncludedL
-            ( aField, R_PHONEBOOK2_EMAIL_SELECTOR );
-        }
-
-    // Clip if required
-    if ( clip )
-        {
-        iTextClipper->ClipFromBeginning
-            ( aColumnText, aIndex, aColumnIndex );
+        iTextClipper->ClipFromBeginning( aColumnText, aIndex, aColumnIndex );
         }
     }
 
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2MergePhotoConflictDlg.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MergePhotoConflictDlg.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -16,15 +16,29 @@
 *
 */
 
+
+
+#include <eikclbd.h>
+#include <aknlayoutscalable_apps.cdl.h>
 #include <aknlists.h>
 #include <AknIconArray.h>
 #include <eikapp.h>
 #include <gulicon.h>
+#include <AknIconUtils.h>
 #include <StringLoader.h>
 #include <aknnavide.h>
 #include <akntitle.h>
+#include <avkon.mbg>
 #include <Pbk2UIControls.rsg>
 #include <MPbk2MergeConflict.h>
+#include <cpbk2imagemanager.h>
+#include <tpbk2imagemanagerparams.h>
+#include <MVPbkBaseContact.h>
+#include <MVPbkFieldType.h>
+#include <vpbkeng.rsg>
+#include <MPbk2AppUi.h>
+#include <MPbk2ApplicationServices.h>
+#include <CVPbkContactManager.h>
 #include "CPbk2MergePhotoConflictDlg.h"
 
 /// Unnamed namespace for local definitions
@@ -32,16 +46,27 @@
 
 _LIT( KPictureRowFormat, "%d\t   %S\t\t" );
 
+inline CGulIcon* CreateEmptyIconL()
+        {               
+        CFbsBitmap* image = NULL;
+        CFbsBitmap* mask = NULL;
+        AknIconUtils::CreateIconL( image, mask, 
+                AknIconUtils::AvkonIconFileName(),
+                EMbmAvkonQgn_prop_empty, 
+                EMbmAvkonQgn_prop_empty_mask );                             
+        return CGulIcon::NewL( image, mask );
+        } 
+
 }
 
 // -----------------------------------------------------------------------------
 // CPbk2MergePhotoConflictDlg::CPbk2MergePhotoConflictDlg
 // -----------------------------------------------------------------------------
 //
-CPbk2MergePhotoConflictDlg::CPbk2MergePhotoConflictDlg( CFbsBitmap* aFirstImage,
-                                                        CFbsBitmap* aSecondImage, 
+CPbk2MergePhotoConflictDlg::CPbk2MergePhotoConflictDlg( MVPbkBaseContact* aFirstContact,
+                                                        MVPbkBaseContact* aSecondContact, 
                                                         TInt* aResult ):
-        iFirstImage( aFirstImage ), iSecondImage( aSecondImage ), iSelectedItem( aResult )
+        iFirstContact( aFirstContact ), iSecondContact( aSecondContact ), iSelectedItem( aResult )
     {
     // No implementation required
     }
@@ -52,6 +77,13 @@
 //
 CPbk2MergePhotoConflictDlg::~CPbk2MergePhotoConflictDlg()
     {
+    StopWait();
+    delete iWait;
+    delete iImageOperationFirst;
+    delete iImageOperationSecond;
+    delete iImageManager;
+    delete iFirstImage;
+    delete iSecondImage;
     delete iNaviDecorator;
     delete iSelectedString;
     }
@@ -60,12 +92,12 @@
 // CPbk2MergePhotoConflictDlg::NewL
 // -----------------------------------------------------------------------------
 //
-EXPORT_C CPbk2MergePhotoConflictDlg* CPbk2MergePhotoConflictDlg::NewL( CFbsBitmap* aFirstImage,
-                                                                       CFbsBitmap* aSecondImage, 
+EXPORT_C CPbk2MergePhotoConflictDlg* CPbk2MergePhotoConflictDlg::NewL( MVPbkBaseContact* aFirstContact,
+                                                                       MVPbkBaseContact* aSecondContact, 
                                                                        TInt* aResult )
     {
     CPbk2MergePhotoConflictDlg* self = 
-        new (ELeave) CPbk2MergePhotoConflictDlg( aFirstImage, aSecondImage, aResult );
+        new (ELeave) CPbk2MergePhotoConflictDlg( aFirstContact, aSecondContact, aResult );
     CleanupStack::PushL(self);
     self->ConstructL();
     CleanupStack::Pop(); // self;
@@ -82,7 +114,10 @@
     SetTitlePaneL( ETrue );
     *iSelectedItem = EPbk2ConflictedFirst;
     iSelectedString = StringLoader::LoadL( R_QTN_PHOB_TITLE_SELECTED );
+    iContactManager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager();
+    iImageManager = CPbk2ImageManager::NewL( *iContactManager );
     CAknDialog::ConstructL( R_AVKON_MENUPANE_EMPTY );
+    iWait = new (ELeave) CActiveSchedulerWait();
     }
 
 // -----------------------------------------------------------------------------
@@ -102,7 +137,6 @@
     
     iListBox = static_cast<CEikFormattedCellListBox*>( Control( 1 ) );
     
-    SetIconsL();
     SetItemsL();
     
     iListBox->CreateScrollBarFrameL( ETrue );
@@ -151,6 +185,19 @@
     return result;
     }
 
+void CPbk2MergePhotoConflictDlg::SizeChanged()
+    {
+    CAknDialog::SizeChanged();
+    TSize size = iListBox->ItemDrawer()->FormattedCellData()->SubCellSize(0);
+    
+    if ( iSize != size )
+        {
+        iSize = size;
+        TRAP_IGNORE( InitBitmapAsyncL( *iFirstContact ) );
+        StartWait();
+        }
+    }
+
 // -----------------------------------------------------------------------------
 // CPbk2MergePhotoConflictDlg::HandleListBoxEventL
 // -----------------------------------------------------------------------------
@@ -173,22 +220,34 @@
 //
 void CPbk2MergePhotoConflictDlg::SetIconsL()
     {
-    if ( iFirstImage == NULL || iSecondImage == NULL )
-        {
-        User::Leave( KErrArgument );
-        }
-    
     CArrayPtr<CGulIcon>* iconList = new (ELeave) CAknIconArray( 2 );
     CleanupStack::PushL( iconList );
-
-    CGulIcon* first = CGulIcon::NewL( iFirstImage );
-    first->SetBitmapsOwnedExternally( ETrue );
+  
+    CGulIcon* first = NULL;
+    if ( iFirstImage )
+        {
+        first = CGulIcon::NewL( iFirstImage );
+        first->SetBitmapsOwnedExternally( ETrue );
+        }
+    else
+        {
+        first = CreateEmptyIconL();
+        }  
     CleanupStack::PushL( first );
     iconList->AppendL( first );
     CleanupStack::Pop( first );
     
-    CGulIcon* second = CGulIcon::NewL( iSecondImage );
-    second->SetBitmapsOwnedExternally( ETrue );
+    CGulIcon* second = NULL;
+    if ( iSecondImage )
+        {
+        second = CGulIcon::NewL( iSecondImage );
+        second->SetBitmapsOwnedExternally( ETrue );
+        
+        }
+    else
+        {
+        second = CreateEmptyIconL();
+        }
     CleanupStack::PushL( second );
     iconList->AppendL( second );
     CleanupStack::Pop( second );
@@ -298,3 +357,132 @@
             }
         }
     }
+
+// --------------------------------------------------------------------------
+// CPbk2MergePhotoConflictDlg::InitBitmapAsyncL
+// --------------------------------------------------------------------------
+//
+void CPbk2MergePhotoConflictDlg::InitBitmapAsyncL( MVPbkBaseContact& aContact )
+    {  
+    // cancel previous operations
+    if ( &aContact == iFirstContact )
+        {
+        delete iImageOperationFirst;
+        iImageOperationFirst = NULL;
+        }
+
+    const MVPbkFieldType* thumbType = iContactManager->FieldTypes().Find(
+            R_VPBK_FIELD_TYPE_THUMBNAILPIC );
+    
+    if( thumbType )
+        {
+        if( iImageManager->HasImage( aContact, *thumbType ) )
+            {
+            // Define parameters for thumbnail
+            TPbk2ImageManagerParams params;
+            TInt useCropping = 0x0008;
+
+            params.iSize = iSize;
+            params.iFlags = TPbk2ImageManagerParams::EScaleImage |
+                            TPbk2ImageManagerParams::EKeepAspectRatio |
+                            useCropping;    //CROP IMAGE    
+            // contact has image. load it.
+            if ( &aContact == iFirstContact )
+                {
+                iImageOperationFirst = iImageManager->GetImageAsyncL( 
+                &params, aContact, *thumbType, *this ); 
+                }
+            else if ( &aContact == iSecondContact )
+                {
+                iImageOperationSecond = iImageManager->GetImageAsyncL( 
+                &params, aContact, *thumbType, *this ); 
+                }
+            }
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2MergePhotoConflictDlg::StopWait
+// --------------------------------------------------------------------------
+//
+void CPbk2MergePhotoConflictDlg::StopWait()
+    {
+    if ( iWait->IsStarted() )
+        {
+        iWait->AsyncStop();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2MergePhotoConflictDlg::StartWait
+// --------------------------------------------------------------------------
+//
+void CPbk2MergePhotoConflictDlg::StartWait()
+    {
+    if ( !iWait->IsStarted() )
+        {
+        iWait->Start();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2MergePhotoConflictDlg::Pbk2ImageGetComplete
+// --------------------------------------------------------------------------
+//
+void CPbk2MergePhotoConflictDlg::Pbk2ImageGetComplete(
+                MPbk2ImageOperation& aOperation,
+                CFbsBitmap* aBitmap )
+    {
+    if ( &aOperation == iImageOperationFirst )
+        {
+        delete iImageOperationFirst;
+        iImageOperationFirst = NULL;
+        delete iFirstImage;
+        iFirstImage = aBitmap;
+        
+        TRAPD( err, InitBitmapAsyncL( *iSecondContact ) );
+        
+        if ( err != KErrNone )
+            {
+            StopWait();
+            TRAP_IGNORE( SetIconsL() ); 
+            }
+        else 
+            {
+            StartWait();
+            }
+        }
+
+    else if ( &aOperation == iImageOperationSecond )
+        {
+        delete iImageOperationSecond;
+        iImageOperationSecond = NULL;
+        delete iSecondImage;
+        iSecondImage = aBitmap;
+        TRAP_IGNORE( SetIconsL() );
+  
+        StopWait();
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2MergePhotoConflictDlg::Pbk2ImageGetFailed
+// --------------------------------------------------------------------------
+//
+void CPbk2MergePhotoConflictDlg::Pbk2ImageGetFailed(
+                MPbk2ImageOperation& aOperation,
+                TInt /*aError*/ )
+    {
+    StopWait();
+    
+    if ( &aOperation == iImageOperationFirst )
+        {
+        delete iImageOperationFirst;
+        iImageOperationFirst = NULL;
+        }
+    else if ( &aOperation == iImageOperationSecond )
+        {
+        delete iImageOperationSecond;
+        iImageOperationSecond = NULL;
+        }
+    }
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListControl.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -41,17 +41,22 @@
 #include <Pbk2InternalUID.h>
 #include "CPbk2PredictiveSearchFilter.h"
 #include "cpbk2contactviewdoublelistbox.h"
+#include <CPbk2ThumbnailManager.h>
+#include <Pbk2CommonUi.rsg>
+#include <Pbk2UIControls.rsg>
 
 // Virtual Phonebook
 #include <MVPbkContactViewBase.h>
 #include <MVPbkViewContact.h>
 #include <MVPbkContactLink.h>
+#include <CVPbkContactLinkArray.h>
 
 // System includes
 #include <barsread.h>
 #include <aknsfld.h>
 #include <AknPriv.hrh>
 #include <featmgr.h>
+#include <AknWaitDialog.h>
 
 // Debugging headers
 #include <Pbk2Debug.h>
@@ -265,6 +270,82 @@
         MPbk2UiControlEventSender& iEventSender;
     };
 
+
+/**
+ * Background Task Handler.
+ */
+NONSHARABLE_CLASS(CPbk2NamesListControlBgTask) : public CActive
+    {    
+    
+    public:
+        CPbk2NamesListControlBgTask( CPbk2NamesListControl& aControl );
+        ~CPbk2NamesListControlBgTask();
+
+        void AddEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent );
+        void ClearAllEvents();
+        void RemoveEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent );
+        
+    private: // From CActive
+        void DoCancel();
+        void RunL();
+        TInt RunError(TInt aError);
+
+    private:
+        //Owns
+        RArray <CPbk2NamesListControl::TPbk2NamesListBgEvents> iEventQueue;  
+        
+        //doesnt Own
+        CPbk2NamesListControl& iControl;
+    };
+
+/**
+ * A helper class for mass update cases.
+ */
+NONSHARABLE_CLASS( CPbk2HandleMassUpdate ) : public CBase
+    {
+    public: // Construction and destruction
+        /**
+         * Creates new instance of this class.
+         * @return new instance of this class.
+         */
+        static CPbk2HandleMassUpdate* NewL(CEikListBox& iListBox);
+
+        /**
+         * Destructor.
+         */
+       ~CPbk2HandleMassUpdate();
+
+    public: 
+        /**
+         * Call this function after each update event.
+         * @return  ETrue if this event is part of a mass update.
+         */	
+       TBool MassUpdateCheckThis();
+
+        /**
+         * Call this function to check if mass update process is ongoing.
+         * @return  ETrue if mass update process is ongoing.
+         */	   
+       TBool MassUpdateDetected();
+       
+    private: 
+        CPbk2HandleMassUpdate(CEikListBox& iListBox);
+        void ConstructL();
+        TBool HandleMassUpdateCheckL(); 
+        void HandleMassUpdateCheckReset();
+        void HandleMassUpdateDone();
+        static TInt HandleMassUpdateTimerCallBack(TAny* aAny);        
+
+    private: 
+		CEikListBox& iListBox;
+        TBool iHandleMassUpdate;
+        TTime iHandleMassUpdateFirst;
+        TTime iHandleMassUpdatePrev;        
+        TInt  iHandleMassUpdateCount;
+        CPeriodic* iHandleMassUpdateTimer;      
+		CAknWaitDialog*  iHandleMassUpdateDialog;		
+    };
+
 // --------------------------------------------------------------------------
 // CPbk2UiControlEventSender::CPbk2UiControlEventSender
 // --------------------------------------------------------------------------
@@ -541,6 +622,195 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::NewL
+// --------------------------------------------------------------------------
+//
+CPbk2HandleMassUpdate* CPbk2HandleMassUpdate::NewL(CEikListBox& aListBox)
+    {
+    CPbk2HandleMassUpdate* self =
+        new( ELeave ) CPbk2HandleMassUpdate(aListBox);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::~CPbk2HandleMassUpdate
+// --------------------------------------------------------------------------
+//
+CPbk2HandleMassUpdate::~CPbk2HandleMassUpdate()
+    {
+    delete iHandleMassUpdateDialog;
+    delete iHandleMassUpdateTimer;    
+    }
+    
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::CPbk2HandleMassUpdate
+// --------------------------------------------------------------------------
+//
+CPbk2HandleMassUpdate::CPbk2HandleMassUpdate(CEikListBox& aListBox) :
+    iListBox(aListBox)
+    {
+    }	
+	
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::ConstructL
+// --------------------------------------------------------------------------
+//
+void CPbk2HandleMassUpdate::ConstructL()
+    {
+    iHandleMassUpdateTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+    }    
+
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::HandleMassUpdateCheckThis
+//
+// Functionality to detect mass updates done to contact database and to prevent
+// e.g nameslist flickering when constant updates are happening in background
+// when pc sync etc is adding hundreds of contacts in line
+// --------------------------------------------------------------------------
+//
+TBool CPbk2HandleMassUpdate::MassUpdateCheckThis()
+    {
+    TBool ret(EFalse);
+    const TInt KNbrUpdBeforeMassCheck(5); 
+    iHandleMassUpdateTimer->Cancel();
+
+    if( iHandleMassUpdateCount > KNbrUpdBeforeMassCheck ) 
+        {
+        //candidates to be checked are they continual of a mass update
+        TRAP_IGNORE(ret = HandleMassUpdateCheckL());
+        }
+    else if( iHandleMassUpdateCount > 0 ) 
+        {
+        //Subsequent updates that are handled normally even if 
+        // they would be first ones in a mass update burst
+        iHandleMassUpdateCount++;
+        iHandleMassUpdatePrev.UniversalTime();
+        }    
+    else
+        {
+        //very first update, set time & counter
+        HandleMassUpdateCheckReset();       
+        }
+    return ret;
+    }
+	
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::MassUpdateDetected
+// --------------------------------------------------------------------------
+//
+TBool CPbk2HandleMassUpdate::MassUpdateDetected()
+    {
+	return iHandleMassUpdate;
+	}
+
+// --------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::HandleMassUpdateCheckL
+// --------------------------------------------------------------------------
+//
+TBool CPbk2HandleMassUpdate::HandleMassUpdateCheckL()
+    {
+    //KDeltaAverage time per update to be considered as mass
+    //update. One occasional update can take KDeltaMax time as long as 
+    //average time not exeeded (therefore timeout for the very first updates in 
+    //practice is also KDeltaAverage).  
+    const TInt64 KDeltaAverage(2000000); 
+    const TInt64 KDeltaMax(KDeltaAverage * 2);     
+    const TTimeIntervalMicroSeconds KMaxPrev(KDeltaMax);  
+    TBool ret(EFalse);
+
+    TTime now;
+    now.UniversalTime();    
+    TTimeIntervalMicroSeconds fs = now.MicroSecondsFrom(iHandleMassUpdateFirst);
+    TTimeIntervalMicroSeconds ps = now.MicroSecondsFrom(iHandleMassUpdatePrev);
+    TTimeIntervalMicroSeconds maxCumu(KDeltaAverage * iHandleMassUpdateCount);
+
+    if( fs < maxCumu && ps < KMaxPrev )
+        {
+        //mass update burst ongoing
+        iHandleMassUpdate=ETrue;        
+        iHandleMassUpdateCount++;
+        iHandleMassUpdatePrev.UniversalTime();   
+        iListBox.UpdateScrollBarsL();
+		
+        if( !iHandleMassUpdateDialog )
+            {
+            iHandleMassUpdateDialog = new(ELeave) CAknWaitDialog
+                (reinterpret_cast<CEikDialog**>(&iHandleMassUpdateDialog), EFalse);
+            iHandleMassUpdateDialog->SetTone(CAknNoteDialog::ENoTone);
+            iHandleMassUpdateDialog->ExecuteLD(R_QTN_GEN_NOTE_SYNCHRONIZING_PROGRESS);  
+			//ExecuteLD above handles validity of pointer iHandleMassUpdateDialog plus 
+			//cleanupstack
+            }
+			
+        TCallBack callback(HandleMassUpdateTimerCallBack, this);
+        TTimeIntervalMicroSeconds32 delta32(KDeltaMax);
+        iHandleMassUpdateTimer->Start( delta32, delta32, callback );
+        ret = ETrue;
+        }
+    else if(iHandleMassUpdate)
+        {
+        //mass update burst ended    
+        HandleMassUpdateDone();
+        ret = ETrue;        
+        }
+    else
+        {
+        //just normal update, set time & counter
+        HandleMassUpdateCheckReset();
+        }
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::HandleMassUpdateCheckReset
+// ----------------------------------------------------------------------------
+//
+void CPbk2HandleMassUpdate::HandleMassUpdateCheckReset()
+    {
+    iHandleMassUpdate=EFalse;        
+    iHandleMassUpdateCount = 1;  //set as first candidate for next burst
+    iHandleMassUpdateFirst.UniversalTime();
+    iHandleMassUpdatePrev=iHandleMassUpdateFirst;    
+    }
+
+// ----------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::HandleMassUpdateTimerCallBack
+// ----------------------------------------------------------------------------
+//
+TInt CPbk2HandleMassUpdate::HandleMassUpdateTimerCallBack(TAny* aAny)
+    {
+    CPbk2HandleMassUpdate* self = static_cast<CPbk2HandleMassUpdate*>( aAny );
+    self->iHandleMassUpdateTimer->Cancel();    
+    self->HandleMassUpdateDone();
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// CPbk2HandleMassUpdate::HandleMassUpdateDone
+// ----------------------------------------------------------------------------
+//
+void CPbk2HandleMassUpdate::HandleMassUpdateDone()
+    {
+    if( iHandleMassUpdateDialog ) 
+        {
+        TRAP_IGNORE(iHandleMassUpdateDialog->ProcessFinishedL());
+        //The below 2 lines just in case... ProcessFinishedL already took care of these
+        delete iHandleMassUpdateDialog;     
+        iHandleMassUpdateDialog = NULL;
+        }
+
+    HandleMassUpdateCheckReset();        
+    iListBox.SetCurrentItemIndex(0);
+    iListBox.SetTopItemIndex(0);
+    }
+	
+///////////////////////// End of helper classes /////////////////////////////
+
+
+// --------------------------------------------------------------------------
 // CPbk2NamesListControl::CPbk2NamesListControl
 // --------------------------------------------------------------------------
 //
@@ -586,11 +856,25 @@
 //
 CPbk2NamesListControl::~CPbk2NamesListControl()
     {
+    ClearMarkedContactsInfo();
+    
+    if (iBgTask)
+        {    
+        delete iBgTask;
+        iBgTask = NULL;
+        }
+    
     if ( iViewStack && iStackObserver )
         {
         iViewStack->RemoveStackObserver( *iStackObserver );
         }
 
+    if( iThumbManager )
+        {
+        TRAP_IGNORE( iThumbManager->SetContactViewL( NULL ) );
+        iThumbManager->RemoveObserver();
+        }
+    
     if (iCommand)
         {
         // inform the command that the control is deleted
@@ -598,6 +882,7 @@
         }
     iObservers.Reset();
     iCommandItems.ResetAndDestroy();
+	delete iCheckMassUpdate;
     delete iListBoxSelectionObserver;
     delete iStateFactory;
     delete iListBox;
@@ -608,7 +893,10 @@
     delete iUiExtension;
     delete iViewStack;
     delete iSearchFilter;
-
+    if( iOwnThumbManager )
+        {
+        delete iThumbManager;
+        }
     if (iOwnBaseView)
         {
         delete iBaseView;
@@ -617,13 +905,6 @@
         {
         FeatureManager::UnInitializeLib();
         }
-
-    // if thumbmanager, remove observer
-    if( iThumbManager )
-        {
-        iThumbManager->RemoveObserver();
-        }
-
     }
 
 // --------------------------------------------------------------------------
@@ -689,6 +970,7 @@
     CleanupStack::PopAndDestroy(); // resReader
     FeatureManager::InitializeLibL();
     iFeatureManagerInitilized = ETrue;
+	iCheckMassUpdate = CPbk2HandleMassUpdate::NewL(*iListBox); //iListbox created in ConstructFromResourceL
     }
 
 // --------------------------------------------------------------------------
@@ -740,16 +1022,19 @@
     // Create the listbox and its model
     if( flags & KPbk2ContactViewListControlDoubleRow )
         {
+        if( !iThumbManager )
+            {
+            iThumbManager = CPbk2ThumbnailManager::NewL( iContactManager );
+            iOwnThumbManager = ETrue;
+            }
+    
         iDoubleListBox = CPbk2ContactViewDoubleListBox::NewL
             ( *this, aReader, iContactManager,
             *iViewStack, iNameFormatter, iStoreProperties,
             iUiExtension, *iSearchFilter, *iThumbManager );
 
-        if( iThumbManager )
-            {
-            iThumbManager->SetObserver( *iDoubleListBox );
-            iViewStack->AddObserverL( *iThumbManager );
-            }
+        iThumbManager->SetObserver( *iDoubleListBox );
+        iThumbManager->SetContactViewL( iViewStack );
 
         iListBox = iDoubleListBox;
         }
@@ -821,6 +1106,8 @@
     // Create the initial state
     iCurrentState = &iStateFactory->ActivateStartupStateL( iCurrentState );
 
+    iBgTask = new (ELeave) CPbk2NamesListControlBgTask( *this );
+    
     PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
         ("CPbk2NamesListControl::ConstructFromResourceL end"));
     }
@@ -1075,7 +1362,7 @@
         {
         HideThumbnail();
         }
-    ReportEventL( MCoeControlObserver::EEventStateChanged );
+    TRAP_IGNORE(ReportEventL( MCoeControlObserver::EEventStateChanged ));
     }
 
 // --------------------------------------------------------------------------
@@ -1331,6 +1618,7 @@
 void CPbk2NamesListControl::ClearMarks()
     {
     iCurrentState->ClearMarks();
+	ClearMarkedContactsInfo();
     }
 
 // --------------------------------------------------------------------------
@@ -1668,8 +1956,11 @@
 
     if (&aView == iViewStack)
         {
-        TRAPD(err, DoHandleContactAdditionL(aIndex));
-        HandleError(err);
+        if( !iCheckMassUpdate->MassUpdateDetected() ) 
+            {
+            TRAPD(err, DoHandleContactAdditionL(aIndex));
+            HandleError(err);
+            }
         }
     }
 
@@ -1874,8 +2165,11 @@
         SelectAndChangeReadyStateL(); 
         }        
 
-    iCurrentState->HandleContactViewEventL
-        ( MPbk2NamesListState::EItemAdded, aIndex );
+    if( !iCheckMassUpdate->MassUpdateDetected() )
+        {
+        iCurrentState->HandleContactViewEventL
+            ( MPbk2NamesListState::EItemAdded, aIndex );
+        }
 
     // At least names list view needs control event about contact addition,
     // so it knows to update CBAs
@@ -2020,7 +2314,11 @@
         iCurrentState->ResetFindL();
         });
     HandleError( res );
-    Reset();
+
+    if( !iCheckMassUpdate->MassUpdateCheckThis() )
+        {
+        Reset();
+        }
 
     // Do not handle contact addition here (DoHandleContactAdditionL),
     // ContactAddedToView to notification is sent separately
@@ -2129,7 +2427,7 @@
     {
     //send event to current state
     //ETrue means that the event came from adaptvie search grid.
-    iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue );
+    TRAP_IGNORE(iCurrentState->HandleControlEventL( aSearchField, MCoeControlObserver::EEventStateChanged, ETrue));
     }
 
 // --------------------------------------------------------------------------
@@ -2144,6 +2442,190 @@
         iSearchFilter->HandleForegroundEventL( aForeground );
         }
     }
+        
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControl::StoreMarkedContactsAndResetViewL
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControl::StoreMarkedContactsAndResetViewL()
+    {  
+    delete iSelectedLinkArray;
+    iSelectedLinkArray = NULL;
+    
+    iSelectedLinkArray = iCurrentState->SelectedContactsL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControl::RestoreMarkedContactsL
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControl::RestoreMarkedContactsL()
+    {    
+    //Set the Marked Contacts
+    if ( iSelectedLinkArray )
+        {
+        for ( TInt index = 0; index<iSelectedLinkArray->Count(); index++ )
+            {
+            iCurrentState->SetSelectedContactL( iSelectedLinkArray->At(index), ETrue );
+            }        
+        }    
+    
+    delete iSelectedLinkArray;
+    iSelectedLinkArray = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControl::ClearMarkedContactsInfo
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControl::ClearMarkedContactsInfo()
+    {   
+    if ( iBgTask )
+        {
+        iBgTask->ClearAllEvents();
+        }
+    delete iSelectedLinkArray;
+    iSelectedLinkArray = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControl::HandleViewForegroundEventL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CPbk2NamesListControl::HandleViewForegroundEventL( TBool aForeground )
+    {
+    if ( aForeground )
+        {
+        if ( iBgTask )
+            {
+            iBgTask->AddEvent( CPbk2NamesListControl::EStateRestoreMarkedContacts );
+            }
+        }
+    else
+        {
+        if ( iBgTask )
+            {
+            iBgTask->AddEvent( CPbk2NamesListControl::EStateSaveMarkedContacts );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask
+// ---------------------------------------------------------------------------
+//
+CPbk2NamesListControlBgTask::CPbk2NamesListControlBgTask( CPbk2NamesListControl& aControl ) :
+    CActive(CActive::EPriorityStandard),
+    iControl( aControl )
+    {
+    CActiveScheduler::Add(this);
+    iEventQueue.Append(CPbk2NamesListControl::EStateBgTaskEmpty);
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::~CPbk2NamesListControlBgTask
+// ---------------------------------------------------------------------------
+//
+CPbk2NamesListControlBgTask::~CPbk2NamesListControlBgTask()
+    {
+    Cancel();
+    iEventQueue.Reset();
+    }
 
 
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::DoCancel
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControlBgTask::DoCancel()
+    {    
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::RunL
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControlBgTask::RunL()
+    {
+    
+    if ( iEventQueue.Count() )
+        {
+        switch ( iEventQueue[0] )
+            {
+            case CPbk2NamesListControl::EStateSaveMarkedContacts:
+                iControl.StoreMarkedContactsAndResetViewL();
+                iEventQueue.Remove( 0 );
+                break;
+                
+            case CPbk2NamesListControl::EStateRestoreMarkedContacts:
+                iControl.RestoreMarkedContactsL();
+                iEventQueue.Remove( 0 );
+                break;
+            
+            case CPbk2NamesListControl::EStateBgTaskEmpty :    
+            default:            
+                iControl.ClearMarkedContactsInfo();
+                break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CPbk2NamesListControlBgTask::RunError(TInt /*aError*/)
+    {    
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::AddEvent
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControlBgTask::AddEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent )
+    {
+    iEventQueue.Insert( aEvent, iEventQueue.Count() - 1 );
+    if ( !IsActive() )
+        {
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete(status, KErrNone);
+        SetActive();
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::RemoveEvent
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControlBgTask::RemoveEvent( CPbk2NamesListControl::TPbk2NamesListBgEvents aEvent )
+    {
+    for ( TInt index = 0; index < iEventQueue.Count(); index++ )
+        {
+        if ( aEvent == iEventQueue[index] )
+            {
+            iEventQueue.Remove( index );      
+            if ( 0 == index )
+                {
+                Cancel(); 
+                }
+            break;
+            }
+        }    
+    }
+
+
+// ---------------------------------------------------------------------------
+// CPbk2NamesListControlBgTask::ClearAllEvents
+// ---------------------------------------------------------------------------
+//
+void CPbk2NamesListControlBgTask::ClearAllEvents()
+    {
+    iEventQueue.Reset();
+    iEventQueue.Append( CPbk2NamesListControl::EStateBgTaskEmpty );
+    Cancel();
+    }
+
 //  End of File
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -1387,10 +1387,11 @@
         const MVPbkContactBookmark& aContactBookmark,
         TBool aSelected )
     {
+    TInt cmdItemCount = CommandItemCount();
     TInt index = iViewStack.IndexOfBookmarkL( aContactBookmark );
     if ( index != KErrNotFound )
         {
-        SetSelectedContactL( index, aSelected );
+        SetSelectedContactL( cmdItemCount+index, aSelected );
         }
     }
 
@@ -1402,10 +1403,11 @@
         const MVPbkContactLink& aContactLink,
         TBool aSelected )
     {
+    TInt cmdItemCount = CommandItemCount();
     TInt index = iViewStack.IndexOfLinkL( aContactLink );
     if ( index != KErrNotFound )
         {
-        SetSelectedContactL( index, aSelected );
+        SetSelectedContactL( index+cmdItemCount, aSelected );
         }
     }
 
@@ -2216,11 +2218,6 @@
             	iFindBox->SetFocus( ETrue, EDrawNow );
             	}
             }
-        else
-            {
-            iFindBox->SetNonFocusing();
-            iFindBox->SetFocus( EFalse, EDrawNow );
-            }
         }
     }
 
@@ -2324,10 +2321,6 @@
             iListBox.SetCurrentItemIndexAndDraw(0);
             }
         }
-    else
-        {
-        iListBox.SetCurrentItemIndexAndDraw(0);
-        }
     }
 
 void CPbk2NamesListReadyState::UpdateAdaptiveSearchGridL( TBool aClearCache )
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -38,6 +38,7 @@
     {
     // LOCAL CONSTANTS AND MACROS
     _LIT( KSeparator, "\t" );    
+    _LIT( KSpace, " " );
     }
 
 
@@ -163,11 +164,12 @@
         {
         MPbk2StoreInfoUiItem& uiItem = *iInfoItems->At(i);
         HBufC* itemBuf = HBufC::NewLC(uiItem.HeadingText().Length() +
-            uiItem.ItemText().Length() + KSeparator().Length());
+            uiItem.ItemText().Length() + KSeparator().Length() + KSpace().Length());
         TPtr ptr(itemBuf->Des());
-        ptr.Append(uiItem.ItemText());
         ptr.Append(KSeparator);
         ptr.Append(uiItem.HeadingText());
+        ptr.Append(KSpace);
+        ptr.Append(uiItem.ItemText());
         // Convert digits
         AknTextUtils::DisplayTextLanguageSpecificNumberConversion(ptr);
         array->AppendL(*itemBuf);
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2PredictiveSearchFilter.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2PredictiveSearchFilter.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -36,7 +36,7 @@
 #include <txtetext.h>
 #include <eikenv.h>
 #include <eikappui.h>
-#include <eikcoctl.rsg>
+#include <EIKCOCTL.rsg>
 #include <eikedwin.h>
 #include <featmgr.h>
 #include <AknFepInternalCRKeys.h>
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2StoreInfoItemBuilder.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2StoreInfoItemBuilder.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -466,7 +466,7 @@
     if ( aItem.TextType() == EPbk2StoreInfoStoreName && aProperty )
         {
         CPbk2Content* content = aProperty->RetrieveContentLC
-            ( EPbk2MemInfoPhone );
+            ( EPbk2MemInfoContacts );
 
         CPbk2StorePropertyContentStoreName* propContent =
             dynamic_cast<CPbk2StorePropertyContentStoreName*>( content );
@@ -486,10 +486,6 @@
         retVal = storeName;
         }
 
-    else if (aValue == singleValue)
-        {
-        retVal = aItem.ItemTextSingular().AllocL();
-        }
     else
         {
         retVal = aItem.ItemTextPlural().AllocL();
--- a/phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ThumbnailManager.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -47,6 +47,8 @@
 #include <Pbk2UIControls.rsg>
 #include <Pbk2UID.h>
 
+namespace {
+
 // Default size for thumbnail images
 #define KDefaultThumbnailSize TSize(36,36)
 // icon offset. Thumbnail indexing starts from 10000 in CPbk2IconArray, so that there is 0 - 9999 indexes free for 
@@ -58,6 +60,10 @@
 const TInt KQueueLimit = 25;
 // Denotes Start Index for an item in the any Queue
 const TInt KStartIndex = 0;
+// Granularity of the thumbnail array
+const TInt KThumbnailArrayGranularity = 200;
+
+}
 
 /*
  * Helper class for mapping between contact link + image + index on listbox
@@ -330,7 +336,6 @@
    return self;
    }
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::CPbk2ThumbnailManager
 // --------------------------------------------------------------------------
@@ -338,12 +343,12 @@
 CPbk2ThumbnailManager::CPbk2ThumbnailManager( 
     CVPbkContactManager& aContactManager ) :
         iState( EIdle ),
+        iContactThumbnails( KThumbnailArrayGranularity ),
         iContactManager( aContactManager ),
         iDefaultIconIndex( KErrNotFound )
 	{
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::~CPbk2ThumbnailManager()
 // --------------------------------------------------------------------------
@@ -360,7 +365,6 @@
     iPriorityArray.Reset();
     }
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::ConstructL()
 // --------------------------------------------------------------------------
@@ -371,11 +375,8 @@
 	iManager = CPbk2ImageManager::NewL( iContactManager );
 	// read file type for thumbnail field
 	ReadFieldTypeL();
-	//reset thumbnail array
-	iContactThumbnails.Reset();
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::SetObserver()
 // --------------------------------------------------------------------------
@@ -403,107 +404,79 @@
 	return iContactThumbnails.Count();
 	}
 
-
 // --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::GetPbkIconIndex()
+// CPbk2ThumbnailManager::GetPbkIconIndexL()
 // --------------------------------------------------------------------------
 //
-TInt CPbk2ThumbnailManager::GetPbkIconIndex( TInt aListboxIndex, const MVPbkBaseContact& aContactLink )
+TInt CPbk2ThumbnailManager::GetPbkIconIndexL( TInt aListboxIndex, const MVPbkBaseContact& aContactLink )
 	{
-	TBool reLoadThumbnail = EFalse;
 	TInt arrIndex = iDefaultIconIndex;
 	
 	// check that requested thumbnail is allready added to thumbnail array
-	if( aListboxIndex < iContactThumbnails.Count() )
+	if( Rng( 0, aListboxIndex, iContactThumbnails.Count() - 1 ) )
 		{
 		CPbk2TmItem* item = iContactThumbnails[ aListboxIndex ];
-		
-        // This is because when find is in use, the indexes are not mapped
-		// directly to thumbnail managers indexes
-		if( !item->GetLink()->RefersTo( aContactLink ) )
+		if( !item )
 		    {
-            // try to find correct one from the array based on contact link
-            item = FindItem( aContactLink );
+            item = CPbk2TmItem::NewL( aContactLink.CreateLinkLC(), aListboxIndex );
+            CleanupStack::Pop(); // link
+            // set default icon index
+            item->SetIconArrayIndexAndId( iDefaultIconIndex,iDefaultIconId );
+            item->SetHasThumbnail( ETrue );
+            iContactThumbnails[ aListboxIndex ] = item;
 		    }
 		
-		if( item )
-		    {
-            // if item has a thumbnail image, but it is not loaded yet ( queue )
-            if( item->HasThumbnail() && !item->GetBitmap() )
+        // if item has a thumbnail image, but it is not loaded yet ( queue )
+        if( item->HasThumbnail() && !item->GetBitmap() )
+            {
+            TBool reOrderItem = ETrue;
+            TInt res = iLoadingQueue.Find( item );
+            //remove from array if duplicate
+            if( res != KErrNotFound )
                 {
-                reLoadThumbnail = ETrue;
-                }
-            else
-                {
-                arrIndex = item->GetIconArrayIndex();
+                // if item's position is 0 or 1, dont reorder
+                if( res <= 1 )
+                    {
+                    reOrderItem = EFalse;
+                    }
+                // else remove item from the array for reordering
+                else
+                    {
+                    iLoadingQueue.Remove( res );
+                    }
                 }
-		    }
-			
-		//if item and thumbnail index was not found ( queue limit ), reload thumbnail
-		if( reLoadThumbnail )
-			{
-			TBool reOrderItem = ETrue;
-			TInt res = iLoadingQueue.Find( item );
-			//remove from array if duplicate
-			if( res != KErrNotFound )
-				{
-				// if item's position is 0 or 1, dont reorder
-				if( res <= 1 )
-					{
-					reOrderItem = EFalse;
-					}
-				// else remove item from the array for reordering
-				else
-					{
-					iLoadingQueue.Remove( res );
-					}
-				}
-			
-			// if item is to be reordered
-			if( reOrderItem )
-				{
-				// if there are more than 2 items
-				if( iLoadingQueue.Count() > 2 && iState == ELoading )
-					{
-					// insert to second position, first one is under loading
-					iLoadingQueue.Insert( item, 1 );
-					}
-				// else append to first or second
-				else
-					{
-					iLoadingQueue.Append( item );
-					}
-				}
-			
-			//if idle, start loading
-			if( iState == EIdle )
-				{
-				StartLoading();
-				}
-			}
+            
+            // if item is to be reordered
+            if( reOrderItem )
+                {
+                // if there are more than 2 items
+                if( iLoadingQueue.Count() > 2 && iState == ELoading )
+                    {
+                    // insert to second position, first one is under loading
+                    iLoadingQueue.Insert( item, 1 );
+                    }
+                // else append to first or second
+                else
+                    {
+                    iLoadingQueue.Append( item );
+                    }
+                }
+            
+            //if idle, start loading
+            if( iState == EIdle )
+                {
+                StartLoading();
+                }
+            }
+        else
+            {
+            arrIndex = item->GetIconArrayIndex();
+            }
 		}
 	return arrIndex;
 	}
 
 // --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::FindItem()
-// --------------------------------------------------------------------------
-//
-CPbk2TmItem* CPbk2ThumbnailManager::FindItem( const MVPbkBaseContact& aContactLink )
-	{
-	const TInt count = iContactThumbnails.Count();
-	for( TInt i = 0; i < count; ++i )
-		{
-		if( iContactThumbnails[ i ]->GetLink()->RefersTo( aContactLink ) )
-			{
-			return iContactThumbnails[i];
-			}
-		}
-	// shouldn't come here ever
-	return NULL;
-	}
-
-// --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::SetDefaultIconId()
 // --------------------------------------------------------------------------
 //
@@ -516,7 +489,6 @@
 	iDefaultIconId = aDefaultIconId;
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::GetDefaultIconIndex()
 // --------------------------------------------------------------------------
@@ -526,7 +498,6 @@
 	return iDefaultIconId;
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::SetPbkIconArray()
 // --------------------------------------------------------------------------
@@ -536,7 +507,6 @@
 	iIconArray = aIconArray;
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::RemoveIconArray()
 // --------------------------------------------------------------------------
@@ -550,53 +520,30 @@
 	// set all the indexes to default because there is no items in icon array to refer to
 	for( TInt i = 0; i < count; ++i )
 		{
-		iContactThumbnails[i]->SetIconArrayIndexAndId( iDefaultIconIndex, iDefaultIconId );
+        CPbk2TmItem* item = iContactThumbnails[i];
+		if( item )
+		    {
+            item->SetIconArrayIndexAndId( iDefaultIconIndex, iDefaultIconId );
+		    }
 		}
 	iIconIdCounter = 0;
 	}
 
-
-// --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::IncreaseIndexes()
-// --------------------------------------------------------------------------
-//
-void CPbk2ThumbnailManager::IncreaseIndexes( TInt aListboxIndex )
-	{
-	TInt i;
-	TInt index = 0;
-	const TInt count = iContactThumbnails.Count();
-	// go through all contacts
-	for( i = 0; i < count; ++i )
-		{
-		index = iContactThumbnails[i]->GetListboxIndex();
-		// increase by one all the indexes that are bigger than newly added index
-		if( index  >= aListboxIndex )
-			{
-			iContactThumbnails[i]->SetListboxIndex( index+1 );
-			}
-		}
-	}
-
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::DecreaseIndexes()
 // --------------------------------------------------------------------------
 //
-void CPbk2ThumbnailManager::DecreaseIndexes( TInt aListboxIndex )
+void CPbk2ThumbnailManager::ResetIndexes()
 	{
-	TInt i;
+    // go through items
 	const TInt count = iContactThumbnails.Count();
-	TInt index = 0;
-	
-	// go through items
-	for( i = 0; i < count; ++i )
+	for( TInt i = 0; i < count; ++i )
 		{
-		index = iContactThumbnails[i]->GetListboxIndex();
-		// decrease all indexes that were bigger than removed index
-		if( index > aListboxIndex )
-			{
-			iContactThumbnails[i]->SetListboxIndex( index-1 );
-			}
+        CPbk2TmItem* item = iContactThumbnails[i];
+        if( item )
+            {
+            item->SetListboxIndex( i );
+            }
 		}
 	}
 
@@ -638,119 +585,35 @@
 	}
 
 // --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::LoadThumbnailL()
+// CPbk2ThumbnailManager::SetContactViewL()
 // --------------------------------------------------------------------------
 //
-void CPbk2ThumbnailManager::LoadThumbnailL( const MVPbkContactLink& aContactLink, TInt aListboxIndex )
-	{
-	// check if the thumbnail is already loaded
-	if( aListboxIndex < iContactThumbnails.Count() &&
-		iContactThumbnails[aListboxIndex]->GetLink()->IsSame( aContactLink ) )
-		{
-		CFbsBitmap* tmp = iContactThumbnails[ aListboxIndex ]->GetBitmap();
-		// if there is icon for the contact allready loaded
-		if( tmp )
-			{
-			//inform observer 
-			if( iObserver )
-				{
-				//if icon array exists
-				if( iIconArray )
-					{
-					//create icon and pass it to the array
-					CGulIcon* icon = CGulIcon::NewL( DuplicateBitmapL( tmp ) );
-					// counter to add icon ids
-					TPbk2IconId iconID( TUid::Uid(KPbk2UID3 ), 
-							KIconIndexOffset + iIconIdCounter );
-					iIconIdCounter++;
-					iIconArray->AppendIconL( icon, iconID );
-					// store the index
-					iContactThumbnails[ aListboxIndex ]->SetIconArrayIndexAndId( iIconArray->FindIcon( iconID ), iconID );
-					iObserver->ThumbnailLoadingComplete( KErrNone,iContactThumbnails[ aListboxIndex]->GetListboxIndex() );
-					}
-				}
-			}
-		else
-			{
-			// has a default icon
-			iObserver->ThumbnailLoadingComplete( KErrNotFound,iContactThumbnails[ aListboxIndex]->GetListboxIndex() );
-			}
-		}
-	// new contact, add new CPbk2TmItem to thumbnail array
-	else
-		{
-		// create new contact item. Thumbnail is not yet loaded so it's set to NULL
-		CPbk2TmItem* item = CPbk2TmItem::NewL( aContactLink.CloneLC(), aListboxIndex );
-		CleanupStack::Pop();
-		// set default icon index
-		item->SetIconArrayIndexAndId( iDefaultIconIndex,iDefaultIconId );
-		item->SetHasThumbnail( ETrue );
-		
-		
-		// if thumbnail to be loaded is added middle of the list (new contact), handle indexes
-		const TInt lastIndex = iContactThumbnails.Count() - 1;
-		if( lastIndex >= 0 && 
-				aListboxIndex <= iContactThumbnails[ lastIndex ]->GetListboxIndex() )
-			{
-			// make room for the new thumbnail. Function does nothing if priority array is not full 
-			// This is because we need to get the thumbnail showing right away when new contact is added
-			MakeRoomForNextThumbnail();
-			// increase indexes after this added index
-			IncreaseIndexes( aListboxIndex );
-			}
-		
-		// add item
-		TLinearOrder<CPbk2TmItem> sorter( CPbk2TmItem::CompareByListboxIndex );
-		iContactThumbnails.InsertInOrderL( item, sorter );
-		
-		// also add item to loading queue. This is because the actual array is sorted between thumbnail loading
-		// list doesn't own the items
-		// if added item's listbox index is smaller than already added, add to start end on loading queue
-		const TInt queueCount = iLoadingQueue.Count();
-		if( aListboxIndex <  queueCount && queueCount > 2  )
-			{
-			//add to second place, first one is under loading
-			iLoadingQueue.Insert( item, 1 );
-			}
-		// just add last place on the list
-		else
-			{
-			iLoadingQueue.Append( item );
-			}
-		
-		//if idle, start loading
-		if( iState == EIdle )
-			{
-			StartLoading();
-			}
-		}
-	}
+void CPbk2ThumbnailManager::SetContactViewL( MPbk2FilteredViewStack* aView )
+    {
+    iView = aView;
+    if( iView )
+        {
+        iView->AddObserverL( *this );
+        iView->AddStackObserverL( *this );
+        }
+    Reset();
+    }
 
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::RemoveThumbnail()
 // --------------------------------------------------------------------------
 //
-TInt CPbk2ThumbnailManager::RemoveThumbnail( const MVPbkContactLink& aContactLink, TInt aListboxIndex  )
+void CPbk2ThumbnailManager::RemoveThumbnail( 
+    const MVPbkContactLink& /*aContactLink*/, TInt aListboxIndex  )
 	{
-	TInt i;
-	const TInt count = iContactThumbnails.Count();
-	CPbk2TmItem* item = NULL;
-	TInt listBoxIndex = 0;
-	
-	for( i = 0; i < count; ++i )
-		{
-		item = iContactThumbnails[i];
-		if( item->GetLink()->IsSame( aContactLink ) )
-			{
-			// store listbox index before updating
-			listBoxIndex = item->GetListboxIndex();
-		
-            // handle indexes
-		    DecreaseIndexes( aListboxIndex );
-
-			// remove item from the list
-			iContactThumbnails.Remove( i );
-			
+    const TInt count = iContactThumbnails.Count();
+    if( count > aListboxIndex )
+        {
+        CPbk2TmItem* item = iContactThumbnails[aListboxIndex];
+        iContactThumbnails.Remove( aListboxIndex );
+        ResetIndexes();
+        if( item )
+            {
 			// check that the icon is not a default icon
 			if( item->GetIconArrayIndex() != iDefaultIconIndex )
 				{
@@ -763,49 +626,42 @@
 				UpdateIconIndexes();
 				}
 			
-			//remove item from priority array if in it
-			const TInt index = iPriorityArray.Find( item->GetLink() );
-			//remove if found
-			if( index != KErrNotFound )
-				{
-				iPriorityArray.Remove( index );
-				}
-			
-			//The item might be even in the loading queue
-			//Remove from loading queue
-			//remove item from priority array if in it
+            // remove from priority list
+            const TInt priIndex = iPriorityArray.Find( item->GetLink() );
+            if( priIndex != KErrNotFound )
+                {
+                iPriorityArray.Remove( priIndex );
+                }
+            
+            // remove from loading queue
             const TInt loadIndex = iLoadingQueue.Find( item );
-            //remove if found
             if( loadIndex != KErrNotFound )
                 {
                 iLoadingQueue.Remove( loadIndex );
                 }
-			
-			// inform observer
-			if( iObserver )
-				{
-				iObserver->ThumbnailRemoved( *item->GetLink(),listBoxIndex );
-				}
-			
-			//The item at 0th position, denotes the current item
-			//whose thumbnail load is in progress.			
-			if ( KStartIndex == loadIndex && !iInProgressItemToBeRemoved )
-			    {
-			    //Remove it when its safe
-			    iInProgressItemToBeRemoved = item;
-			    }
-			else
-			    {
-			    //can be safely deleted immediately
-			    delete item;
-			    }
-			return KErrNone;
-			}
-		}
-	return KErrNotFound;
+            
+            // inform observer
+            if( iObserver )
+                {
+                iObserver->ThumbnailRemoved( *item->GetLink(), aListboxIndex );
+                }
+            
+            //The item at 0th position, denotes the current item
+            //whose thumbnail load is in progress.          
+            if ( KStartIndex == loadIndex && !iInProgressItemToBeRemoved )
+                {
+                //Remove it when its safe
+                iInProgressItemToBeRemoved = item;
+                }
+            else
+                {
+                //can be safely deleted immediately
+                delete item;
+                }
+            }
+        }
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::UpdateIconIndexes()
 // --------------------------------------------------------------------------
@@ -818,18 +674,17 @@
 		const TInt count = iContactThumbnails.Count();
 		for( TInt i = 0; i < count; ++i )
 			{
-			if( !( iDefaultIconId == iContactThumbnails[ i ]->GetIconId() ) ) 
+            CPbk2TmItem* item = iContactThumbnails[ i ];
+			if( item && !( iDefaultIconId == item->GetIconId() ) ) 
 				{
 				// icon is removed from the CPbk2IconArray, update indexes
-				TPbk2IconId id = iContactThumbnails[ i ]->GetIconId();	
-				iContactThumbnails[ i ]->SetIconArrayIndexAndId( iIconArray->FindIcon( id ), id );
+				TPbk2IconId id = item->GetIconId();	
+				item->SetIconArrayIndexAndId( iIconArray->FindIcon( id ), id );
 				}
 			}
 		}
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::DuplicateBitmapL()
 // --------------------------------------------------------------------------
@@ -850,12 +705,11 @@
 	return dstbitmap;
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::StartLoading()
 // --------------------------------------------------------------------------
 //
-void CPbk2ThumbnailManager::StartLoading( )
+void CPbk2ThumbnailManager::StartLoading()
 	{
 	//its safe to delete the item here
 	if ( iInProgressItemToBeRemoved )
@@ -889,7 +743,6 @@
 			StartLoading();
 			}
 		}
-		
 	// no more items
 	else
 		{
@@ -941,7 +794,6 @@
     StartLoading();
     }
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::DoLoadThumbnail()
 // --------------------------------------------------------------------------
@@ -982,12 +834,12 @@
 				{
 				iIconSize = KDefaultThumbnailSize;
 				}
-			TInt useCropping = 0x0008;
 			// set params
 			params.iSize = iIconSize;
 			params.iFlags = TPbk2ImageManagerParams::EScaleImage |
-							TPbk2ImageManagerParams::EKeepAspectRatio |
-							useCropping;	//CROP IMAGE	//TODO change value
+			                TPbk2ImageManagerParams::EUseSpeedOptimizedScaling |
+							TPbk2ImageManagerParams::ECropImage ;
+			params.iDisplayMode = EColor16MU;
 			// fetch the image
 			TRAP( err, iThumbOperation =
 				iManager->GetImageAsyncL( &params, aContact, *iFieldType, *this ) );
@@ -1026,7 +878,6 @@
 		}
 	}
 
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::MakeRoomForNextThumbnail
 // --------------------------------------------------------------------------
@@ -1041,9 +892,10 @@
 		const TInt count = iContactThumbnails.Count();
 		for( TInt i = 0; i < count; ++i )
 			{
-			if( iContactThumbnails[ i ]->GetLink()->IsSame( *iPriorityArray[ KStartIndex ] ) )
+            CPbk2TmItem* item = iContactThumbnails[ i ];
+			if( item && item->GetLink()->IsSame( *iPriorityArray[ KStartIndex ] ) )
 				{
-				rem = iContactThumbnails[i];
+				rem = item;
 				break;
 				}
 			}
@@ -1068,8 +920,6 @@
 		}
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::Pbk2ImageGetComplete
 // --------------------------------------------------------------------------
@@ -1163,48 +1013,43 @@
 void CPbk2ThumbnailManager::DoContactViewReadyL( MVPbkContactViewBase& aView )
     {   
     // get contact count
-    const TInt contactCount = aView.ContactCountL();
     const TInt thumbnailCount = iContactThumbnails.Count();
-    
     if( thumbnailCount == 0 )
         {
-        // first time initialization
-        for( TInt i = 0; i < contactCount; ++i )
-            {
-            CPbk2TmItem* item = CPbk2TmItem::NewL( aView.CreateLinkLC( i ), i );
-            CleanupStack::Pop(); // link
-            CleanupStack::PushL( item );
-            // set default icon index
-            item->SetIconArrayIndexAndId( iDefaultIconIndex,iDefaultIconId );
-            item->SetHasThumbnail( ETrue );
-            
-            // add item
-            iContactThumbnails.AppendL( item );
-            CleanupStack::Pop( item );
-            }
+        PreCreateThumbnailArrayL( aView );
         }
     else
         {
         // there is items in the listbox that are not loaded yet. If there is favorite contacts, 
         // those are added afterwards to the list. normal items are added first.
-        const TInt itemCount = contactCount - thumbnailCount;
+        const TInt itemCount = aView.ContactCountL() - thumbnailCount;
         for( TInt i = 0; i < itemCount; ++i )
-            {            
-            MVPbkContactLink* link = aView.CreateLinkLC( i );
-            // if link exists and some thumbnails are not loaded
-            if( link  )
-                {
-                // add to thumb manager and load thumbnail
-                LoadThumbnailL( *link,i );
-                // created link
-                CleanupStack::PopAndDestroy();
-                }
+            {
+            iContactThumbnails.InsertL( NULL, 0 );
+            }
+        if( itemCount > 0 )
+            {
+            ResetIndexes();
             }
         }  
     }
 
 // --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::ContactAddedToView
+// CPbk2ThumbnailManager::PreCreateThumbnailArrayL
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::PreCreateThumbnailArrayL( MVPbkContactViewBase& aView )
+    {
+    iContactThumbnails.ResetAndDestroy();
+    const TInt contactCount = aView.ContactCountL();
+    for( TInt i = 0; i < contactCount; ++i )
+        {
+        iContactThumbnails.AppendL( NULL );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::ContactViewUnavailable
 // --------------------------------------------------------------------------
 //
 void CPbk2ThumbnailManager::ContactViewUnavailable( 
@@ -1220,13 +1065,14 @@
 void CPbk2ThumbnailManager::ContactAddedToView(
     MVPbkContactViewBase& /*aView*/, 
     TInt aIndex, 
-    const MVPbkContactLink& aContactLink )
+    const MVPbkContactLink& /*aContactLink*/ )
     {
-    TRAP_IGNORE( LoadThumbnailL( aContactLink, aIndex ) );
+    iContactThumbnails.Insert( NULL, aIndex );
+    ResetIndexes();
     }
 
 // --------------------------------------------------------------------------
-// CPbk2ThumbnailManager::ContactViewError
+// CPbk2ThumbnailManager::ContactRemovedFromView
 // --------------------------------------------------------------------------
 //
 void CPbk2ThumbnailManager::ContactRemovedFromView(
@@ -1250,6 +1096,54 @@
     }
 
 // --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::TopViewChangedL
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::TopViewChangedL( MVPbkContactViewBase& /*aOldView*/ )
+    {
+    Reset();
+    if( iView )
+        {
+        PreCreateThumbnailArrayL( *iView );
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::TopViewUpdatedL
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::TopViewUpdatedL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::BaseViewChangedL
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::BaseViewChangedL()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::ViewStackError
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::ViewStackError( TInt /*aError*/ )
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CPbk2ThumbnailManager::ContactAddedToBaseView
+// --------------------------------------------------------------------------
+//
+void CPbk2ThumbnailManager::ContactAddedToBaseView( 
+    MVPbkContactViewBase& /*aBaseView*/,
+    TInt /*aIndex*/,
+    const MVPbkContactLink& /*aContactLink*/ )
+    {
+    }
+
+// --------------------------------------------------------------------------
 // CPbk2ThumbnailManager::ReadFieldTypeL
 // --------------------------------------------------------------------------
 //
--- a/phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/Pbk2AddressTools.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -367,44 +367,51 @@
             {
             continue;
             }
-    	TArray<TVPbkFieldVersitProperty> arrProp = field.BestMatchingFieldType()->VersitProperties();
-		for( TInt idx2 = 0; idx2 < arrProp.Count(); idx2++)
-			{
-			if( arrProp[idx2].Name() != EVPbkVersitNameADR )
-				{
-				continue;
-				}
+    	const MVPbkFieldType* fieldType = field.BestMatchingFieldType();
+        if ( fieldType )
+            {
+            TArray<TVPbkFieldVersitProperty> arrProp =
+                fieldType->VersitProperties();
+            for (TInt idx2 = 0; idx2 < arrProp.Count(); idx2++ )
+                {
+                if ( arrProp[idx2].Name() != EVPbkVersitNameADR )
+                    {
+                    continue;
+                    }
 
-			if( !arrProp[idx2].Parameters().Contains( MapAddressToVersitParam( aAddressGroup ) ) &&
-				aAddressGroup != EPbk2FieldGroupIdPostalAddress	)
-				{
-				continue;
-				}
+                if ( !arrProp[idx2].Parameters().Contains(
+                    MapAddressToVersitParam( aAddressGroup ) )
+                    && aAddressGroup != EPbk2FieldGroupIdPostalAddress )
+                    {
+                    continue;
+                    }
 
-			if( ( arrProp[idx2].Parameters().Contains( MapAddressToVersitParam( EPbk2FieldGroupIdCompanyAddress ) ) ||
-				  arrProp[idx2].Parameters().Contains( MapAddressToVersitParam( EPbk2FieldGroupIdHomeAddress ) ) ) &&
-				  aAddressGroup == EPbk2FieldGroupIdPostalAddress )
-				{
-				continue;
-				}
+                if ( (arrProp[idx2].Parameters().Contains(
+                    MapAddressToVersitParam( EPbk2FieldGroupIdCompanyAddress ) )
+                    || arrProp[idx2].Parameters().Contains(
+                        MapAddressToVersitParam( EPbk2FieldGroupIdHomeAddress ) ))
+                    && aAddressGroup == EPbk2FieldGroupIdPostalAddress )
+                    {
+                    continue;
+                    }
 
-			MVPbkContactFieldData& fieldData = field.FieldData();
-			if( fieldData.DataType() != EVPbkFieldStorageTypeText )
-				{
-				continue;
-				}
+                MVPbkContactFieldData& fieldData = field.FieldData();
+                if ( fieldData.DataType() != EVPbkFieldStorageTypeText )
+                    {
+                    continue;
+                    }
 
-			MVPbkContactFieldTextData& data =
-			   MVPbkContactFieldTextData::Cast( fieldData );
-			if( data.Text().Length() )
-				{
-				aFieldsMap.InsertL( arrProp[idx2].SubField(), data.Text() );
-				}
-			}
+                MVPbkContactFieldTextData& data =
+                    MVPbkContactFieldTextData::Cast( fieldData );
+                if ( data.Text().Length() )
+                    {
+                    aFieldsMap.InsertL( arrProp[idx2].SubField(), data.Text() );
+                    }
+                }
+            }
      	}
     }
 
 
 
 
-
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxdata.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -2158,8 +2158,8 @@
                 iExtension->iClippedColumns |= ( 1 << column );
                 }
 
-            TBool marqueeDisabled =ETrue;
-            if(listbox)
+            TBool marqueeDisabled = ETrue;
+            if ( listbox )
                 {
                 marqueeDisabled = listbox->View()->ItemDrawer()->Flags()
                     & CListItemDrawer::EDisableMarquee;
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxitemdrawer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewcustomlistboxitemdrawer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -170,6 +170,23 @@
     // not used in S60
     }
 
+inline void DrawSeparator( 
+    CGraphicsContext& aGc, 
+    const TRect& aRect, const TRgb& aColor )
+    {
+    aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+    aGc.SetPenStyle( CGraphicsContext::ESolidPen );
+    TRgb color( aColor );
+    color.SetAlpha( 32 );
+    aGc.SetPenColor( color );
+    TRect lineRect( aRect );
+    TInt gap = AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine().it; 
+    lineRect.Shrink( gap, 0 );
+    lineRect.Move( 0, -1 );
+    aGc.DrawLine( TPoint( lineRect.iTl.iX, lineRect.iBr.iY ), 
+                  TPoint( lineRect.iBr.iX, lineRect.iBr.iY ) );
+    }
+
 
 void CPbk2ContactViewCustomListBoxItemDrawer::DrawItemText( TInt aItemIndex,
                                              const TRect& aItemTextRect,
@@ -246,6 +263,13 @@
     ColumnData()->SetCurrentItemIndex(aItemIndex);
     ColumnData()->Draw(Properties(aItemIndex), *iGc,&des,aItemTextRect,(aItemIsCurrent /*|| aViewIsEmphasized*/),colors, aItemIndex);
 
+    const TInt itemCount(iModel->NumberOfItems());
+    if( itemCount - 1 > aItemIndex  )
+        {
+        DrawSeparator( *iGc, aItemTextRect, iTextColor );
+        }
+
+    
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
     if ( transApi )
         {
--- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -121,7 +121,7 @@
     //const TPbk2IconId& thumb = iThumbManager.GetPbkIconIndex( aIndex, aViewContact );
     //element->SetIconId( MPbk2DoubleListboxDataElement::EThumbnail, thumb );
     // -- temporary sollution:
-    TInt index = iThumbManager.GetPbkIconIndex( aIndex, aViewContact );
+    TInt index = iThumbManager.GetPbkIconIndexL( aIndex, aViewContact );
     if( index != KErrNotFound )
         {
         iBuffer.AppendNum( index );
--- a/phonebookui/Phonebook2/UIServices/src/CPbk2AiwSelectionProvider.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/UIServices/src/CPbk2AiwSelectionProvider.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -263,7 +263,7 @@
 // --------------------------------------------------------------------------
 //
 TBool CPbk2AiwSelectionProvider::AcceptSelectionL
-        ( TInt aNumberOfSelectedContacts, HBufC8& /*aContactLink*/ )
+        ( TInt aNumberOfSelectedContacts, HBufC8& aContactLink )
     {
     PBK2_DEBUG_PRINT( PBK2_DEBUG_STRING(
         "CPbk2AiwSelectionProvider::AcceptSelectionL(0x%x)"), this );
@@ -271,6 +271,9 @@
     iEventParamList->AppendL(
         TAiwGenericParam( EGenericParamSelectedCount,
             TAiwVariant(aNumberOfSelectedContacts ) ) );
+    iEventParamList->AppendL(
+        TAiwGenericParam( EGenericParamContactLinkArray,
+            TAiwVariant( aContactLink ) ) );
     TBool acceptOutput = const_cast<MAiwNotifyCallback*>(iCallback)->
             HandleNotifyL( KAiwCmdSelect, KAiwEventOutParamCheck,
                 *iEventParamList, *iInParamList );
--- a/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimInformation.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/USIMExtension/rss/Pbk2USimInformation.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -526,6 +526,11 @@
                     {
                     context = EPbk2CopyQueryItem;
                     text = qtn_pbcop_copy_query_list_item_sim;
+                    },
+                PHONEBOOK2_LOCALIZED_TEXT
+                    {
+                    context = EPbk2MemInfoContacts;
+                    text = qtn_phob_pb_info_memory_sim_colon;
                     }
                 };
             },
--- a/phonebookui/Phonebook2/USIMExtension/src/CPsu2SecUi.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/USIMExtension/src/CPsu2SecUi.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -21,8 +21,8 @@
 #include "CPsu2SecUi.h"
 
 #include <MVPbkSimPhone.h>
-#include <SecUiSecuritySettings.h> // CSecuritySettings
-#include <SecUi.h> // TSecUi
+#include <secuisecuritysettings.h> // CSecuritySettings
+#include <secui.h> // TSecUi
 
 // ============================ MEMBER FUNCTIONS ===============================
 
--- a/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2ThinUIExtensionPlugin.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2ThinUIExtensionPlugin.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -125,7 +125,7 @@
         case R_PHONEBOOK2_NAMESLIST_OTHER_MEMORIES_MENU_PLACEHOLDER:
             {
             if ( iServiceTable.IsOff( KAllSimStores ) ||
- //                aControl.ContactsMarked() || 
+                aControl.ContactsMarked() || 
                  ( iStoreChecker &&
                    !iStoreChecker->IsContactsAvailabe(
                         VPbkContactStoreUris::SimGlobalOwnNumberUri()) &&
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -41,9 +41,6 @@
 #include <phonebook2ece.loc>
 #include "ccappcommlauncher.hrh"
 
-// Todo: This will be read from loc file after localization
-#define qtn_cca_default_status "Open Nokia OVI Services"
-
 //  RESOURCE DEFINITIONS 
 
 // ---------------------------------------------------------------------------
@@ -267,5 +264,5 @@
 RESOURCE TBUF r_qtn_phob_popup_incomplete_address         { buf = qtn_phob_popup_incomplete_address; }
 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_default_status             { buf = qtn_cca_default_status; }
+RESOURCE TBUF r_qtn_cca_ftu_discover               { buf = qtn_cca_ftu_discover; }
 //End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/group/ccappcommlauncherplugin.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/group/ccappcommlauncherplugin.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -34,7 +34,6 @@
 SOURCE          ccappcommlaunchercontainer.cpp
 SOURCE          ccappcommlauncherlpadmodel.cpp
 SOURCE          ccappcommlauncherheadercontrol.cpp
-SOURCE          ccappcommlauncherimagedecoding.cpp
 SOURCE          ccappcommlauncherheadertextorder.cpp
 SOURCE          CCCAppCommLauncherPbkCmd.cpp
 SOURCE          ccappcommlaunchercustomlistboxdata.cpp 
@@ -115,6 +114,9 @@
 LIBRARY         pbk2spbcontentprovider.lib
 LIBRARY			charconv.lib 
 
+LIBRARY         FontUtils.lib
 
+LIBRARY         apgrfx.lib
+LIBRARY         ws32.lib
 // End of File
 
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h	Fri Feb 19 22:40:27 2010 +0200
@@ -207,6 +207,14 @@
      * @since S60 v5.0
      */
     VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector SelectedCommunicationMethod();
+    
+    /**
+     * To check whether the listbox is highlight
+     *
+     * @return ETrue if Highlight,otherwise EFalse
+     * @since S60 v5.0
+    */
+    const TBool IsListBoxHighlightEnabled();
 
 private: // New
 
@@ -253,6 +261,11 @@
     * availability.
     */
     void DoCheckExtensionFactoryL();
+    
+    /**
+	* Set default status text to CCCAppStatusControl
+	*/
+    void SetDefaultStatusTextL();
 
 private: // Constructors
 
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistbox.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistbox.h	Fri Feb 19 22:40:27 2010 +0200
@@ -59,6 +59,7 @@
     private: // Implementation
     	
     	CCCAppCommLauncherCustomListBox();
+    	void SizeChangedL();
 
     private: // Data
         /// Doesnt Own - Ownership Transferred to CPbk2ContactViewCustomListBoxItemDrawer
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxdata.h	Fri Feb 19 22:40:27 2010 +0200
@@ -11,15 +11,12 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: CCA customized control. Code has been modified to
+*              suit CCA requirements. See CFormattedCellListBoxData
+*              in EIKFRLBD.H. 
+*              Ensure that this piece of code is in sync with Avkon EIKFRLBD.H (CFormattedCellListBoxData)
 *
 */
-/*
- * ccappcommlaunchercustomlistboxdata.h
- *
- *  Created on: 2009-11-2
- *      Author: dev
- */
 
 #ifndef CCAPPCOMMLAUNCHERCUSTOMLISTBOXDATA_H_
 #define CCAPPCOMMLAUNCHERCUSTOMLISTBOXDATA_H_
@@ -30,7 +27,7 @@
 #include <eiklbd.h>
 #include <eikfrlb.h>
 #include <avkon.hrh>
-#include <aknsdrawutils.h> // for TAknsQsnTextColorsIndex
+#include <AknsDrawUtils.h> // for TAknsQsnTextColorsIndex
 #include <babitflags.h>    // for TBitFlags32
 
 class CWindowGc;
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercustomlistboxitemdrawer.h	Fri Feb 19 22:40:27 2010 +0200
@@ -11,15 +11,11 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: CCA custom control. Code has been modified to
+*       suit CCA requirements. See CFormattedCellListBoxItemDrawer
+*       in eikfrlb.cpp
 *
 */
-/*
- * ccappcommlaunchercustomlistboxitemdrawer.h
- *
- *  Created on: 2009-10-30
- *      Author: dev
- */
 
 #ifndef CCAPPCOMMLAUNCHERCUSTOMLISTBOXITEMDRAWER_H_
 #define CCAPPCOMMLAUNCHERCUSTOMLISTBOXITEMDRAWER_H_
@@ -258,6 +254,10 @@
     * @internal
     */
     void DrawBackgroundAndSeparatorLines( const TRect& aItemTextRect ) const;
+    /**
+     *  Draw separator line 
+     */
+    void DrawSeparator( CGraphicsContext& aGc, const TRect& aRect, const TRgb& aColor ) const;
                         
 
 private:
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheadercontrol.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheadercontrol.h	Fri Feb 19 22:40:27 2010 +0200
@@ -22,6 +22,7 @@
 // INCLUDES
 #include <eikmobs.h>
 #include "ccappcommlauncherheaders.h"
+#include <ccappimagedecoding.h>
 
 // FORWARD DECLARATIONS
 class CEikImage;
@@ -42,7 +43,10 @@
  *  @lib ccappcommlauncherplugin.dll
  *  @since S60 v5.0
  */
-class CCCAppCommLauncherHeaderControl : public CCoeControl,  public MEikMenuObserver 
+class CCCAppCommLauncherHeaderControl : 
+            public CCoeControl,  
+            public MEikMenuObserver, 
+            public MCCAppImageDecodingObserver
     {
 public:
     // Construction & destruction
@@ -130,10 +134,16 @@
     TKeyResponse OfferKeyEventL(
         const TKeyEvent& aKeyEvent, TEventCode aType);
 
+    inline void SetStatusButtonVisibility( TBool aVisible )
+        { iStatusButtonVisibility = aVisible; }
+    
 public: // MEikMenuObserver
      virtual void ProcessCommandL(TInt aCommandId);
      virtual void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
 
+private:    // from MCCAppImageDecodingObserver
+     void BitmapReadyL( CFbsBitmap* aBitmap );
+     
 private:
 
     /**
@@ -219,7 +229,7 @@
      * Active listener to make asynchronic operation synchronic
      * Own.
      */    
-    CCCAppCommLauncherImageDecoding* iImageDecoding;
+    CCCAppImageDecoding* iImageDecoding;
     
     /**
      * Helper for ordering the texts
@@ -279,6 +289,8 @@
       * Own
       */ 
     HBufC8* iContactThumbnailData;
+    
+    TBool iStatusButtonVisibility;
     };
 
 #endif // CCCAPPCOMMLAUNCHERHEADERCONTROL_H
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheaders.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherheaders.h	Fri Feb 19 22:40:27 2010 +0200
@@ -95,7 +95,6 @@
 #include "ccappcommlauncher.hrh"
 #include "CCCAppCommLauncherPbkCmd.h"
 #include "ccappcommlaunchermenuhandler.h"
-#include "ccappcommlauncherimagedecoding.h"
 #include "ccappcommlauncherprivatecrkeys.h"
 
 #endif // __CCAPPCOMMLAUNCHERHEADERS_H__
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherimagedecoding.h	Tue Feb 02 10:12:17 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Utility class for asynchronously decoding the header thumbnail image
-*
-*/
-
-
-#ifndef CCAPPCOMMLAUNCHERIMAGEDECODING_H_
-#define CCAPPCOMMLAUNCHERIMAGEDECODING_H_
-
-#include "ccappcommlauncherheaders.h"
-
-class CCCAppCommLauncherHeaderControl;
-class CBitmapScaler;
-/**
- * Utility class for asynchronously decoding the header thumbnail image
- *
- *  @code
- *   ?good_class_usage_example(s)
- *  @endcode
- *
- *  @lib ccappcommlauncherplugin.dll
- *  @since S60 v5.0
- */
-class CCCAppCommLauncherImageDecoding : public CActive
-    {
-public:
-    /**
-     * Two-phased constructor
-     * 
-     * @param aHeader The header control to which the bitmap is to be inserted after loading
-     * @param aBitmapData Descriptor containing the bitmap data stream
-     * @param aImageFile Descriptor containing image file name full path
-     */
-    static CCCAppCommLauncherImageDecoding* NewL(CCCAppCommLauncherHeaderControl* aHeader, const TDesC8* aBitmapData, const TDesC* aImageFile);
-    
-    /**
-     * Destructor
-     */
-    ~CCCAppCommLauncherImageDecoding();
-    
-    /**
-     * Starts the decoding process
-     * 
-     * @param aImageSize defines image size
-     */
-    void StartL( TSize aImageSize );
-    
-    /**
-     * From CActive
-     * (see details from baseclass )
-     */
-    void RunL();
-    
-    /**
-     * From CActive
-     * (see details from baseclass )
-     */
-    void DoCancel();
-private:
-    /**
-     * First-phase (C++) constructor
-     * 
-     * @param aHeader The header control to which the bitmap is to be inserted after loading 
-     */
-    CCCAppCommLauncherImageDecoding(CCCAppCommLauncherHeaderControl* aHeader);
-    
-    /**
-     * Second phase constructor
-     * 
-     * @param aBitmapData Descriptor containing the bitmap data stream
-     * @param aImageFile Descriptor containing image file name full path
-     */
-    void ConstructL(const TDesC8* aBitmapData, const TDesC* aImageFile);
-    
-    /**
-     * Scales bitmap
-     *
-     */
-    void ScaleBitmapL();
-
-    /**
-     * Create bitmap
-     *
-     */
-    void CreateBitmapL();
-    
-    enum TCcaImageDecoderState
-        {
-        ECcaConvertThumbnailImage = 1,
-        ECcaScaleThumbnail,
-        ECcaReadImageFromFile,
-        ECcaConvertImageFromFile,
-        ECcaScaleImage
-        };
-    
-    /**
-     * The image scaler whose service is called to scale the image
-     * Own.
-     */
-    CBitmapScaler* iBitmapScaler;
-    
-    /**
-     * The image decoder whose service is called to decode the image
-     * Own.
-     */
-    CImageDecoder* iImgDecoder;
-    
-    /**
-     * The header control to which the bitmap is to be inserted after loading
-     * Not own.
-     */
-    CCCAppCommLauncherHeaderControl* iHeader;
-    
-    /**
-     * Handle to the file server session for loading the bitmap
-     */ 
-    RFs iFs;
-    
-    /**
-     * The bitmap.
-     * Owned until decoding is complete, then ownersip is transferred to header control.
-     */
-    CFbsBitmap* iBitmap; // owned until completion
-    
-    /**
-     * Copy of the bitmap data stream
-     * Own.
-     */
-    HBufC8* iBitmapData;
-
-    /**
-     * Copy of image name with path
-     * Own.
-     */
-    HBufC* iImageFullName;
-    
-    /** 
-      * Contact bitmap size 
-      */ 
-    TSize iBitmapSize;
-    
-    /** 
-      * Decoder internal state
-      */ 
-    TInt iDecoderState;
-    
-    /** 
-      * Timer used to delay image conversion
-      */ 
-    RTimer iTimer;
-    };
-
-#endif /*CCAPPCOMMLAUNCHERIMAGEDECODING_H_*/
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherlpadmodel.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,7 @@
 #include <e32hashtab.h>
 #include <spdefinitions.h>
 #include <mspnotifychangeobserver.h>
-#include <vpbkfieldtype.hrh>
+#include <VPbkFieldType.hrh>
 
 
 _LIT( KPbk2ECEIconFileName, "\\resource\\apps\\phonebook2ece.mif");
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h	Fri Feb 19 22:40:27 2010 +0200
@@ -137,6 +137,9 @@
     
     TBool PluginBusy();
 
+public: // From CAknView
+    void HandleForegroundEventL( TBool aForeground );
+    
 public:
 
     /**
@@ -216,6 +219,15 @@
     CCAContactorService* ContactorService();
     
     void DefaultSettingComplete();
+    /**
+     *  Start timer.
+     */
+    void StartTimerL();
+    
+    /**
+     *  Cancel timer.
+     */
+    void CancelTimer();
 
 private: // new
 
@@ -239,6 +251,12 @@
      * @since S60 v5.0
      */
     void EnsureMenuHandlerCreatedL();
+    
+    /**
+     *  Exit CCA application if it is at background when the request timeout.
+     * 
+     */
+    void CloseCCApp();
 
 private: // constructors
 
@@ -258,6 +276,12 @@
      * methods or not.
      */
     void UpdateMSKinCbaL( TBool aCommMethodsAvailable );
+    
+    /**
+     * Notify the timeout after sent an aiw service request.
+     * 
+     */
+    static TInt ServiceTimeOutL( TAny* aObject );
 
 private:// data
 
@@ -295,7 +319,24 @@
     CCAContactorService* iContactorService;
     
     CActiveSchedulerWait* iWaitFinish;
-
+    
+	/**
+	 * The timer notifier an aiw service request timeout. 
+	 * Own.
+	 */
+	CPeriodic* iAiwRequestTimer;
+    
+    /**
+     * Record whether the View foreground flag.
+     * Own.
+     */
+    TBool iIsCcaForeground;
+    
+    /**
+     * Timer start flag.
+     * Own.
+     */
+    TBool iIsTimerStart;
     };
 
 #endif // C_CCAPPCOMMLAUNCHERPLUGIN_H
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchersetdefault.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchersetdefault.h	Fri Feb 19 22:40:27 2010 +0200
@@ -20,13 +20,13 @@
 
 #include <e32base.h>
 #include "ccalogger.h"
-#include <mvpbksinglecontactoperationobserver.h>
-#include <mvpbkcontactattributemanager.h>
-#include <mvpbkcontactstoreobserver.h>
-#include <vpbkfieldtype.hrh>
-#include <mvpbkcontactobserver.h>
-#include <rpbk2localizedresourcefile.h>
-#include <mvpbkbatchoperationobserver.h>
+#include <MVPbkSingleContactOperationObserver.h>
+#include <MVPbkContactAttributeManager.h>
+#include <MVPbkContactStoreObserver.h>
+#include <VPbkFieldType.hrh>
+#include <MVPbkContactObserver.h>
+#include <RPbk2LocalizedResourceFile.h>
+#include <MVPbkBatchOperationObserver.h>
 
 class CCCAppCmsContactFetcherWrapper;
 class CPbk2ApplicationServices;
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -21,8 +21,8 @@
 #include "spbcontentprovider.h"
 #include "ccappcommlaunchercustomlistbox.h"
 #include <Pbk2PresentationUtils.h>
-#include <cpbk2applicationservices.h>
-#include <cvpbkcontactmanager.h>
+#include <CPbk2ApplicationServices.h>
+#include <CVPbkContactManager.h>
 #include <utf.h>
 #include <gulicon.h>
 #include "ccaextensionfactory.h"
@@ -37,12 +37,11 @@
 #include "ccafactoryextensionnotifier.h"
 #include <featmgr.h>
 
-
+namespace {
 const TInt KSocialPhonebookDisabled = 2;
 const TInt KSocialPhonebookEnabled = 3;
-const TText KReplacedChars = ' ';
-
 _LIT( KCcaIconDefaultFileName, "\\resource\\apps\\phonebook2ece.mif" );
+}
 
 // =========================== MEMBER FUNCTIONS ===============================
 
@@ -115,11 +114,14 @@
                 link = contactArray->At( 0 ).CloneLC();
                 }				
                             
-             const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties();
-             TVPbkContactStoreUriPtr uri = storeProperties.Uri();
+            if ( link )
+                {    
+                const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties();
+                TVPbkContactStoreUriPtr uri = storeProperties.Uri();
             
-             isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), 
-                        TVPbkContactStoreUriPtr::EContactStoreUriAllComponents );
+                isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), 
+                            TVPbkContactStoreUriPtr::EContactStoreUriAllComponents );
+                }
             }
             
         if( isSame == 0 )
@@ -127,7 +129,7 @@
             iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this );
             iStatusControl->SetContainerWindowL( *this );                   
             iStatusControl->MakeVisible( EFalse );
-          
+            iHeaderCtrl->SetStatusButtonVisibility( EFalse );
             CFbsBitmap* bmp = NULL;
             CFbsBitmap* bmpMask = NULL;
         
@@ -139,12 +141,12 @@
                 EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask );
         
             CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask );
-			iStatusControl->SetDefaultStatusL( R_QTN_CCA_DEFAULT_STATUS, guiIcon );
+            iStatusControl->SetDefaultStatusIconL( guiIcon );
             iStatusControl->SetContactLinkL( *link );
 	
             iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL();
             TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this );
-            iFactoryExtensionNotifier->ObserveExtensionFactory( callBack );
+            iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack );
             }
         
         if( link )
@@ -173,9 +175,8 @@
 //
 void CCCAppCommLauncherContainer::CreateListboxControlL()
     {
-    // Will use customed list box later
-    // iListBox = CCCAppCommLauncherCustomListBox::NewL();
-    iListBox = new (ELeave) CAknDoubleLargeStyleListBox();
+    // Use customized list box 
+    iListBox = CCCAppCommLauncherCustomListBox::NewL();
     iListBox->ConstructL(this, EAknListBoxLoopScrolling);
     iListBox->SetContainerWindowL(*this);
     iListBox->CreateScrollBarFrameL(ETrue);
@@ -215,51 +216,73 @@
 //
 void CCCAppCommLauncherContainer::SizeChanged()
     {
-    const TRect drawRect(Rect());
+    const TRect rect(Rect());
     const TBool isLandscape(Layout_Meta_Data::IsLandscapeOrientation());
 
-    // Header, Status and Listbox
-    TAknLayoutRect headerRect;
-	headerRect.LayoutRect(drawRect, AknLayoutScalable_Apps::cl_header_pane(isLandscape));
-	iHeaderCtrl->SetRect(headerRect.Rect());
-
-    AknLayoutUtils::LayoutControl(
-        iListBox, drawRect, AknLayoutScalable_Apps::cl_listscroll_pane(isLandscape));
-
-    TRect listRect = iListBox->Rect();
-
-	if (!isLandscape)
-		{
-		listRect.iTl.iX = drawRect.iTl.iX;
-		listRect.iBr.iX = drawRect.iBr.iX;
-		}
+    // contact card pane layout
+    TAknWindowComponentLayout contactCardPaneLayout( 
+            TAknWindowComponentLayout::Compose( 
+                    AknLayoutScalable_Apps::main_phob2_pane( 0 ),
+                    AknLayoutScalable_Apps::phob2_contact_card_pane( 1 ) ) );
 
-	if( iStatusControl && iStatusControl->IsVisible() )
-		{
-        // status control (similar to list_double2_graphic_pane)
-        TAknLayoutRect statusLayout;
-        statusLayout.LayoutRect( listRect,
-            AknLayoutScalable_Avkon::list_double2_graphic_pane( 0 ) );
-        TRect statusRect( statusLayout.Rect() );
-
-        // list gives space for status control (top of list)
-        listRect.Move( 0, statusRect.Height() );
-        listRect.Resize( 0, -statusRect.Height() );
-       
-        // status control
-        statusRect.Shrink( 10, 5 );
-        iStatusControl->SetRect( statusRect );
-		}
-
-	iListBox->SetRect( listRect );
+    
+    TInt option( isLandscape ? 3 : 2 ); // (w/o button)
+    if( iStatusControl && iStatusControl->IsVisible()  )
+        {
+        // (w button)
+        if( isLandscape )
+            {
+            option = 1;
+            }
+        else
+            {
+            option = 0;
+            }
+			
+        // Status control layout
+        TAknWindowComponentLayout statusPaneLayout(
+            TAknWindowComponentLayout::Compose(
+                TAknWindowComponentLayout::Compose( 
+                    contactCardPaneLayout,
+                    AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ),
+                AknLayoutScalable_Apps::phob2_cc_button_pane( option ) ) );
+        
+        TAknLayoutRect statusPaneLayoutRect;
+        statusPaneLayoutRect.LayoutRect( rect, statusPaneLayout.LayoutLine() );
+        TRect statusPaneRect( statusPaneLayoutRect.Rect() );
+        iStatusControl->SetRect( statusPaneRect );
+        }
+    // Header and Listbox
+    
+    // header layout
+    TAknWindowComponentLayout headerPaneLayout( 
+        TAknWindowComponentLayout::Compose( 
+            contactCardPaneLayout,
+            AknLayoutScalable_Apps::phob2_cc_data_pane( option ) ) );
+    
+    TAknLayoutRect headerPaneLayoutRect;
+    headerPaneLayoutRect.LayoutRect( rect, headerPaneLayout.LayoutLine() );
+    TRect headerPaneRect( headerPaneLayoutRect.Rect() );
+    iHeaderCtrl->SetRect( headerPaneRect );
+    
+    // list layout
+    TAknWindowComponentLayout listPaneLayout( 
+        TAknWindowComponentLayout::Compose( 
+            contactCardPaneLayout,
+            AknLayoutScalable_Apps::phob2_cc_listscroll_pane( option ) ) );
+    
+    TAknLayoutRect listPaneLayoutRect;
+    listPaneLayoutRect.LayoutRect( rect, listPaneLayout.LayoutLine() );
+    TRect listPaneRect( listPaneLayoutRect.Rect() );
+    iListBox->SetRect( listPaneRect );
 
     // Background skin
     if (iBackground)
         {
-        iBackground->SetRect(drawRect);
+        iBackground->SetRect(rect);
         }   
     
-    DrawNow();
+    DrawDeferred();
     }
 
 // ----------------------------------------------------------------------------
@@ -318,6 +341,9 @@
 TKeyResponse CCCAppCommLauncherContainer::OfferKeyEventL(
     const TKeyEvent& aKeyEvent, TEventCode aType)
     {
+    // Make sure timer can be canceled before user do any operation.
+    iPlugin.CancelTimer();
+    
     // Forward the key-event 1st to base-class
     TKeyResponse returnValue =
         CCCAppViewPluginAknContainer::OfferKeyEventL(aKeyEvent, aType);
@@ -402,6 +428,9 @@
 void CCCAppCommLauncherContainer::HandlePointerEventL(
     const TPointerEvent& aPointerEvent)
     {
+    // Make sure timer can be canceled before user do any operation.
+    iPlugin.CancelTimer();
+    
     TInt index;
     if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) )
         {
@@ -424,30 +453,43 @@
 // CCCAppCommLauncherContainer::HandleLongTapEventL()
 // ----------------------------------------------------------------------------
 //
-void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& aPenEventLocation, 
-                                 	const TPoint& aPenEventScreenLocation )
+void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, 
+                                 	const TPoint& /*aPenEventScreenLocation*/ )
     {
     CCAContactorService* contactorService = iPlugin.ContactorService();
-
-    if ( contactorService && contactorService->IsBusy() )
-        {
-        return;
-        }
-    else if ( CommMethodsAvailable() )
+    if ( contactorService )
         {
-        TPtrC fullName;
-        iPlugin.ContactHandler().ContactFieldItemDataL(
-            CCmsContactFieldItem::ECmsFullName, fullName );
+        if ( contactorService->IsBusy() )
+            {
+            return;
+            }
+        else if ( CommMethodsAvailable() )
+            {
+            TPtrC fullName;
+            iPlugin.ContactHandler().ContactFieldItemDataL(
+                CCmsContactFieldItem::ECmsFullName, fullName );
 
-        TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults;
-        CCAContactorService::TCSParameter param(
-            iPlugin.Container().SelectedCommunicationMethod(),
-            *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray
-            paramFlag, 
-            fullName );
-        contactorService->ExecuteServiceL( param );
+            TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults;
+        
+            VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
+                contactActionType = iPlugin.Container().SelectedCommunicationMethod();
+            CCAContactorService::TCSParameter param(
+                contactActionType,
+                *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray
+                paramFlag, 
+                fullName );
+        
+            if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
+                contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
+                contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
+                {
+                iPlugin.StartTimerL();
+                }
+        
+            contactorService->ExecuteServiceL( param );
 
-        CleanupStack::PopAndDestroy( 1 );// contactlinkarray
+            CleanupStack::PopAndDestroy( 1 );// contactlinkarray
+            }
         }
     }
 
@@ -491,7 +533,10 @@
 
     if (executeContactAction)
         {
-        if ( iPlugin.Container().SelectedCommunicationMethod()
+        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector
+            contactActionType = iPlugin.Container().SelectedCommunicationMethod();
+        
+        if ( contactActionType
         		== VPbkFieldTypeSelectorFactory::EFindOnMapSelector )
         	{
         	DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap );
@@ -508,11 +553,18 @@
                 TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults;
     
                 CCAContactorService::TCSParameter param(
-                    iPlugin.Container().SelectedCommunicationMethod(),
+                    contactActionType,
                     *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray
                     paramFlag,
                     fullName);
-    
+            
+                if ( contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector ||
+                    contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector ||
+                    contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
+                    {
+                    iPlugin.StartTimerL();
+                    }
+            
                 contactorService->ExecuteServiceL(param);
     
                 CleanupStack::PopAndDestroy(1);// contactlinkarray
@@ -555,6 +607,11 @@
     iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField);
     // Forwarding to listbox-model
     iModel->ContactFieldFetchedNotifyL(aContactField);
+    
+    if( iStatusControl )
+       	{
+		SetDefaultStatusTextL();
+       	}
     }
 
 // ----------------------------------------------------------------------------
@@ -578,6 +635,11 @@
     iListBox->DrawDeferred();
     
     iMdlRowCount = mdlCount;
+    
+    if( iStatusControl )
+    	{
+		SetDefaultStatusTextL();
+    	}
     }
 
 // ---------------------------------------------------------------------------
@@ -601,6 +663,17 @@
     }
 
 // ---------------------------------------------------------------------------
+// CCCAppCommLauncherContainer::IsHighlight
+// ---------------------------------------------------------------------------
+//
+const TBool CCCAppCommLauncherContainer::IsListBoxHighlightEnabled()
+	{
+    return !( iListBox->ItemDrawer()->Flags() & 
+    		CListItemDrawer::ESingleClickDisabledHighlight );
+	}
+
+
+// ---------------------------------------------------------------------------
 // CCCAppCommLauncherContainer::SelectedCommunicationMethod
 // ---------------------------------------------------------------------------
 //
@@ -695,6 +768,27 @@
     return *iLongTapDetector;
     }
 
+// --------------------------------------------------------------------------
+// CCCAppCommLauncherContainer::SetDefaultStatusTextL
+// --------------------------------------------------------------------------
+//
+void CCCAppCommLauncherContainer::SetDefaultStatusTextL()
+	{	
+	TPtrC fullName;
+	iPlugin.ContactHandler().ContactFieldItemDataL(
+		CCmsContactFieldItem::ECmsFullName, 
+		fullName );
+	
+	if( fullName.Size() == 0 )
+		{
+		return;
+		}
+	
+	HBufC* defaultStatusText = StringLoader::LoadL( 
+        R_QTN_CCA_FTU_DISCOVER, fullName, iCoeEnv );       
+		
+	iStatusControl->SetDefaultStatusTextL( defaultStatusText );
+	}
 
 //-----------------------------------------------------------------------------
 // CCCAppCommLauncherContainer::StatusClicked()
@@ -739,13 +833,21 @@
             {
             iViewLauncher = extension->CreateViewLauncherL();
             }
-        iStatusControl->MakeVisible( ETrue );
+        if( iStatusControl )
+            {
+            iStatusControl->MakeVisible( ETrue );
+            iHeaderCtrl->SetStatusButtonVisibility( ETrue );
+            }
         }
     else
         {
         delete iViewLauncher;
         iViewLauncher = NULL;
-        iStatusControl->MakeVisible( EFalse );
+        if( iStatusControl )
+            {
+            iStatusControl->MakeVisible( EFalse );
+            iHeaderCtrl->SetStatusButtonVisibility( EFalse );
+            }
         }
     
     }
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistbox.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -23,7 +23,8 @@
 
 // System includes
 #include <barsread.h>
-#include <eikclbd.h>
+#include <aknlayoutscalable_apps.cdl.h>
+
 
 #include "ccappcommlaunchercustomlistbox.h"
 #include "ccappcommlaunchercustomlistboxitemdrawer.h"
@@ -77,8 +78,68 @@
     //Ownership has been transferred to iItemDrawer
     iColumnData = columnData;
     }
+// --------------------------------------------------------------------------
+// CCCAppCommLauncherCustomListBox::SizeChanged
+// --------------------------------------------------------------------------
+//
 void CCCAppCommLauncherCustomListBox::SizeChanged()
 	{
 	CAknDoubleLargeStyleListBox::SizeChanged();
+	TRAP_IGNORE( SizeChangedL() );
 	}
 
+// --------------------------------------------------------------------------
+// CCCAppCommLauncherCustomListBox::SizeChangedL
+// --------------------------------------------------------------------------
+//
+void CCCAppCommLauncherCustomListBox::SizeChangedL()
+	{
+	// Text format: "0\tCommunicationName\tContent\t1\t2"
+	// Icons: 
+	//  0: Communication method icon
+	//  1: Presence icon
+	//  2: Multi indication icon 
+	//
+	// Layout: list_double_large_graphic_phob2_cc_pane
+	// ------------------------------------------------
+	// |       |                                      |
+	// |       | Communication method name      [1]   |
+	// |  [0]  |                                      |
+	// |       | Content                        [2]   |
+	// |       |                                      |
+	// ------------------------------------------------
+	//
+	
+		
+	iColumnData->ResetSLSubCellArray();
+			  
+	// Comm method icon	
+	TAknWindowLineLayout gl( AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g1( 0 ) );
+	iColumnData->SetGraphicSubCellL( 0, gl );
+	
+	// Line 1 text
+	TAknTextComponentLayout textLayout = AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_t1( 0 );
+	iColumnData->SetTextSubCellL( 1, textLayout );
+	
+	// Line 2 text
+	TAknTextComponentLayout textLayout2 = AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_t2( 0 );
+	iColumnData->SetTextSubCellL( 2, textLayout2 );
+	
+	// Presence icon
+	TAknWindowLineLayout g2( AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g2( 0 ) );
+	iColumnData->SetGraphicSubCellL( 3, g2 );
+	
+	// Multi indication icon
+	TAknWindowLineLayout g3( AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_g3( 0 ) );
+	iColumnData->SetGraphicSubCellL( 4, g3 );
+	
+	// Conditional subcells must be added in priority order!
+	// Line 1 text variation for 1 post icon
+	TAknTextComponentLayout textLayout3 = AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_t1( 2 );
+	iColumnData->SetConditionalSubCellL( 3, textLayout3, 1 );
+	
+	// Line 2 text variation for 2 post icon
+	TAknTextComponentLayout textLayout4 = AknLayoutScalable_Apps::list_double_large_graphic_phob2_cc_pane_t2( 2 );
+	iColumnData->SetConditionalSubCellL( 4, textLayout4, 2 );
+	
+	}
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -11,50 +11,29 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: CCA customized control. Code has been modified to suit 
+               CCA requirements. See CFormattedCellListBoxData
+*       	   in EIKCLBD.CPP. 
+*              Ensure that this piece of code is in sync with Avkon EIKFRLBD.CPP(CFormattedCellListBoxData)
 *
 */
-/*
- * ccappcommlaunchercustomlistboxdata.cpp
- *
- *  Created on: 2009-11-2
- *      Author: dev
- */
-/*
- * ============================================================================
- *  Name     : Eikfrlbd.cpp
- *  Part of  : Avkon
- *
- *  Description:
- *  Version:
- *
- *  Copyright � 2002-2009 Nokia Corporation.
- *  This material, including documentation and any related 
- *  computer programs, is protected by copyright controlled by 
- *  Nokia Corporation. All rights are reserved. Copying, 
- *  including reproducing, storing,  adapting or translating, any 
- *  or all of this material requires the prior written consent of 
- *  Nokia Corporation. This material also contains confidential 
- *  information which may not be disclosed to others without the 
- *  prior written consent of Nokia Corporation.
- * ============================================================================
- */
+
 
 #include <eikfrlbd.h>
 #include <aknlists.h>
 #include <AknMarqueeControl.h>
-#include <aknpictographinterface.h>
-#include <aknpictographdrawerinterface.h>
-#include <aknseffectanim.h>
-#include <aknslistboxbackgroundcontrolcontext.h>
-#include <aknsframebackgroundcontrolcontext.h>
-#include <aknpanic.h>
-#include <aknbiditextutils.h>
+#include <AknPictographInterface.h>
+#include <AknPictographDrawerInterface.h>
+#include <AknsEffectAnim.h>
+#include <AknsListBoxBackgroundControlContext.h>
+#include <AknsFrameBackgroundControlContext.h>
+#include <AknPanic.h>
+#include <AknBidiTextUtils.h>
 #include <centralrepository.h>
-#include <avkoninternalcrkeys.h>
+#include <AvkonInternalCRKeys.h>
 #include <gulicon.h>
 #include <eikslbd.h>
-//#include <akndebug.h>
+
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <layoutmetadata.cdl.h>
 #include <aknphysics.h>
@@ -69,9 +48,8 @@
 #include <aknlistboxtfxinternal.h>
 #endif //RD_UI_TRANSITION_EFFECTS_LIST
 
-#ifdef RD_TACTILE_FEEDBACK
+
 #include <touchfeedback.h>
-#endif //RD_TACTILE_FEEDBACK
 // there are 17(!) subcells in qdial grid (0 ... 16)
 const TInt KMaxSubCellIndex = 16 + 1;
 
@@ -992,9 +970,9 @@
 		cc = SkinBackgroundContext();
 		}
 
-	return AknsDrawUtils::DrawBackground(AknsUtils::SkinInstance(), cc,
-			iControl, aGc, TPoint(0, 0), itemRect,
-			KAknsDrawParamBottomLevelRGBOnly);
+    TBool ret = AknsDrawUtils::DrawBackground( AknsUtils::SkinInstance(), cc, iControl, aGc, TPoint(0,0),
+                                          itemRect, KAknsDrawParamBottomLevelRGBOnly );
+    return ret;
 	}
 
 // -----------------------------------------------------------------------------
@@ -1298,22 +1276,25 @@
  void CCCAppCommLauncherCustomListBoxData::SetSkinPopupFrame(
 		const TAknsItemID *aFrameId, const TAknsItemID *aFrameCenterId)
 	{
-	if (iExtension && iExtension->iPopupFrame)
-		{
-		iExtension->iPopupFrame->SetFrame(*aFrameId);
-		iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
-		}
-	else
-		{
-		TRAPD(err, iExtension->iPopupFrame = CAknsFrameBackgroundControlContext::NewL(
+    if ( iExtension )
+        {
+        if ( iExtension->iPopupFrame )
+		    {
+		    iExtension->iPopupFrame->SetFrame(*aFrameId);
+            iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
+	    	}
+	    else
+	    	{
+	        TRAPD(err, iExtension->iPopupFrame = CAknsFrameBackgroundControlContext::NewL(
 						KAknsIIDNone,
 						TRect(0,0,1,1), // these must be set by using SetSkinPopupFramePosition
 						TRect(0,0,1,1),
 						EFalse ) );
-		if (!err)
-			{
-			iExtension->iPopupFrame->SetFrame(*aFrameId);
-			iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
+            if (!err)
+			    {
+			    iExtension->iPopupFrame->SetFrame(*aFrameId);
+			    iExtension->iPopupFrame->SetCenter(*aFrameCenterId);
+                }
 			}
 		}
 	}
@@ -1748,27 +1729,27 @@
 		TListItemProperties aProperties, CWindowGc& aGc, const TDesC* aText,
 		const TRect& aItemRect, TBool aHighlight, const TColors& aColors) const
 	{
+    CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
+    if (!view->ViewRect().Intersects(aItemRect))
+        {
+        // outside of the clipping rect -> don't process this item
+        return;
+        }
 	if (aHighlight)
 		{
 		iExtension->iClippedSubcells = 0;
 		}
 
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST
-	MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal(&aGc);
-	TBool effectsDisabled = ETrue;
-
-	if (transApi)
-		{
-		transApi->StartDrawing(MAknListBoxTfxInternal::EListItem);
-		effectsDisabled = transApi->EffectsDisabled();
-
-		if (effectsDisabled)
-			{
-			CListBoxView* view =
-					static_cast<CEikListBox*> (iExtension->iControl)->View();
-			aGc.SetClippingRect(view->ViewRect());
-			}
-		}
+    MAknListBoxTfxInternal *transApi = CAknListLoader::TfxApiInternal( &aGc );
+    if ( transApi )
+        {
+        transApi->StartDrawing( MAknListBoxTfxInternal::EListItem );
+        if(transApi->EffectsDisabled())
+            {
+            aGc.SetClippingRect( view->ViewRect() );
+            }
+        }
 #else
 	CListBoxView* view = static_cast<CEikListBox*>( iExtension->iControl )->View();
 	aGc.SetClippingRect( view->ViewRect() );
@@ -1794,7 +1775,7 @@
 #ifdef RD_UI_TRANSITION_EFFECTS_LIST  
 	if (transApi)
 		{
-		if (effectsDisabled)
+        if(transApi->EffectsDisabled())
 			{
 			aGc.CancelClippingRect();
 			}
@@ -1873,189 +1854,186 @@
 	TPtrC tempText;
 	TRect textShadowRect; // For transparent list
 	TRgb textShadowColour = AKN_LAF_COLOR_STATIC(215); // Black shadow for item text.
-	MAknsControlContext *cc = AknsDrawUtils::ControlContext(Control());
-	TBool skinEnabled = AknsUtils::AvkonSkinEnabled();
-
-	if (!cc)
-		{
-		cc = SkinBackgroundContext();
-		}
-
-	TAknTextLineLayout textLines[KMaxSubCellIndex];
-	TBool rectClipped[KMaxSubCellIndex];
-
-	Mem::FillZ(&rectClipped[0], KMaxSubCellIndex * sizeof(TBool));
-
-	if (iExtension->iSubCellsMightIntersect)
-		{
-		CheckIfSubCellsIntersect(&textLines[0], &rectClipped[0], *aText,
-				aItemRect);
-		}
+    MAknsControlContext *cc = AknsDrawUtils::ControlContext( Control() );
+    if (!cc)
+        {
+        cc = SkinBackgroundContext();
+        }
+
+    TAknTextLineLayout textLines[KMaxSubCellIndex];
+    TBool rectClipped[KMaxSubCellIndex];
+    
+    Mem::FillZ( &rectClipped[0], KMaxSubCellIndex * sizeof( TBool ) );
+    
+    if ( iExtension->iSubCellsMightIntersect )
+        {
+        CheckIfSubCellsIntersect( &textLines[0], &rectClipped[0], *aText, aItemRect );
+        }
 
 	TInt SCindex = 0;
 
-	// This loop does the drawing.    
-	aGc.SetPenStyle(CGraphicsContext::ENullPen);
-	subcell = 0;
-	FOREVER{
-	if (subcell>lastSubCell)
-		{
-		break;
-		}
-
-	TextUtils::ColumnText(text,subcell, aText);
-	if (text == KNullDesC)
-		{
-		// empty subcell, continue to draw next subcell
-		++ subcell;
-		continue;
-		}
-	if (!iExtension) break;
-	if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break;
-
-	if (UseSubCellColors(subcell))
-		{
-		subcellColors = &SubCellColors(subcell);
-		}
-	else
-		{
-		subcellColors = &aColors;
-		}
-
-	TRgb color;
-
-	if (aHighlight)
-		{
-		color = subcellColors->iHighlightedText;
-		aGc.SetBrushColor(subcellColors->iHighlightedBack);
-		if ( skinEnabled )
-			{
-			if ( iExtension->iHighlightedTextColor != NULL )
-				{
-				color = iExtension->iHighlightedTextColor;
-				}
-			}
-		}
-	else
-		{
-		color = subcellColors->iText;
-		aGc.SetBrushColor(subcellColors->iBack);
-		if ( skinEnabled )
-			{
-			if ( iExtension->iTextColor != NULL )
-				{
-				color = iExtension->iTextColor;
-				}
-			}
-		}
-
-	// graphics or text column
-	if (iExtension->AtSL(SCindex).iSubCellType == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText)
-		{
-		const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
-		const CFont* cellFont=Font(aProperties, subcell);
-		const CFont* tempFont=(cellFont) ? cellFont : NULL;
-		const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
-
-		TAknTextLineLayout textLineLayout = NULL;
-
-		if ( rectClipped[subcell] )
-			{
-			textLineLayout = textLines[subcell];
-			}
-		else
-			{
-			// check if there are icons affecting this text layout
-			TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
-
-			if (gSC> -1)
-				{
-				TInt tempIndex;
-				while (gSC> -1) // when gSC == -1, we have found our graphical subcell
-
-					{
-					if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
-					TextUtils::ColumnText(tempText,gSC, aText);
-					if (tempText != KNullDesC)
-						{
-						textLineLayout = iExtension->AtSL(tempIndex).iTextLayout;
-						break;
-						}
-					gSC = iExtension->AtSL(tempIndex).iConditionValue;
-					}
-				}
-
-			if (gSC == -1) // no affecting icons -> use default layout
-
-				{
-				textLineLayout = iExtension->AtSL(SCindex).iTextLayout;
-				}
-			}
-
-		CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
-		TBool isLayoutAlignment = iExtension->SubCellLayoutAlignment(subcell); //gumq  
-		if( !isLayoutAlignment )
-			{
-			switch(align)
-				{
-				case CGraphicsContext::ELeft :
-					{
-					textLineLayout.iJ = ELayoutAlignLeft;
-					}
-				break;
-				case CGraphicsContext::ECenter:
-					{
-					textLineLayout.iJ = ELayoutAlignCenter;
-					}
-				break;
-				case CGraphicsContext::ERight:
-					{
-					textLineLayout.iJ = ELayoutAlignRight;
-					}
-				break;
-				default: break;
-				};
-			}
-
-		TAknLayoutText textLayout;
-		textLayout.LayoutText(textRect, textLineLayout, usedFont);
-
-		SetUnderlineStyle( aProperties, aGc, subcell );
-
-		// * 2 == leave some room for marquee
-		const TInt maxlen( KMaxColumnDataLength * 2 );
-		TBuf<maxlen> convBuf = text.Left(maxlen);
-
-		// Note that this potentially modifies the text so its lenght in pixels
-		// might increase. Therefore, this should always be done before
-		// wrapping/clipping text. In some cases, WordWrapListItem is called
-		// before coming here. Is it certain that it is not done for number subcells?
-
-		// Do number conversion if required.
-		if (SubCellIsNumberCell(subcell))
-			{
-			AknTextUtils::LanguageSpecificNumberConversion(convBuf);
-			}
-
-		// Check whether logical to visual conversion should be done here or not.
-		TBool bidiConv =
-		iExtension->iUseLogicalToVisualConversion &&
-		subcell != iExtension->iFirstWordWrappedSubcellIndex &&
-		subcell != iExtension->iSecondWordWrappedSubcellIndex;
-
-		TBool doesNotFit( EFalse );
-		if ( aHighlight )
-			{
-			doesNotFit = usedFont->TextWidthInPixels( convBuf )> textLayout.TextRect().Width();
-
-			if ( doesNotFit )
-				{
-				iExtension->iClippedSubcells |= ( 1 << subcell );
-				}
-			else
-				{
-				iExtension->iClippedSubcells &= ~( 1 << subcell );
-				}
+    // This loop does the drawing.    
+    aGc.SetPenStyle(CGraphicsContext::ENullPen);
+    subcell=0;
+    FOREVER
+        {        
+        if (subcell>lastSubCell)
+            {
+            break;
+            }
+        
+        TextUtils::ColumnText(text,subcell, aText);
+        if (text == KNullDesC)
+            {
+            // empty subcell, continue to draw next subcell
+            ++ subcell;
+            continue;
+            }
+        if (!iExtension) break;
+        if (iExtension->FindSLSubCellIndex(SCindex,subcell)!=0) break;
+
+        if (UseSubCellColors(subcell))
+            {
+            subcellColors = &SubCellColors(subcell);
+            }
+        else
+            {
+            subcellColors = &aColors;
+            }
+            
+        TRgb color;
+
+        if (aHighlight)
+            {
+            color = subcellColors->iHighlightedText;
+            aGc.SetBrushColor(subcellColors->iHighlightedBack); 
+            if ( AknsUtils::AvkonSkinEnabled() )
+                {
+                if ( iExtension->iHighlightedTextColor != NULL )
+                    {
+                    color = iExtension->iHighlightedTextColor;
+                    }
+                }
+            }
+        else
+            {
+            color = subcellColors->iText;
+            aGc.SetBrushColor(subcellColors->iBack);
+            if ( AknsUtils::AvkonSkinEnabled() )
+                {
+                if ( iExtension->iTextColor != NULL )
+                    {
+                    color = iExtension->iTextColor;
+                    }
+                }
+            }
+        
+        // graphics or text column
+        if (iExtension->AtSL(SCindex).iSubCellType == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText)
+            {
+            const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
+            const CFont* cellFont=Font(aProperties, subcell);
+            const CFont* tempFont=(cellFont) ? cellFont : NULL;
+            const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
+            
+            TAknTextLineLayout textLineLayout = NULL;
+
+            if ( rectClipped[subcell] )
+                {
+                textLineLayout = textLines[subcell];
+                }
+            else
+                {
+                // check if there are icons affecting this text layout
+                TInt gSC = iExtension->AtSL(SCindex).iConditionValue; // graphical subcell which might affect this text subcell
+                
+                if (gSC > -1)
+                    {
+                    TInt tempIndex;
+                    while (gSC > -1) // when gSC == -1, we have found our graphical subcell
+                        {
+                        if (iExtension->FindSLSubCellIndex(tempIndex,gSC)!=0) break;
+                        TextUtils::ColumnText(tempText,gSC, aText);
+                        if (tempText != KNullDesC)
+                            {
+                            textLineLayout = iExtension->AtSL(tempIndex).iTextLayout;
+                            break;                      
+                            }
+                        gSC = iExtension->AtSL(tempIndex).iConditionValue;
+                        }
+                    }
+                    
+                if (gSC == -1) // no affecting icons -> use default layout
+                    {
+                    textLineLayout = iExtension->AtSL(SCindex).iTextLayout;
+                    }
+                }
+
+                      
+            CGraphicsContext::TTextAlign align=SubCellAlignment(subcell); //gumq
+            TBool isLayoutAlignment = iExtension->SubCellLayoutAlignment(subcell); //gumq  
+            if( !isLayoutAlignment )
+                { 
+                switch(align) 
+                    {
+                    case CGraphicsContext::ELeft : 
+                        {
+                        textLineLayout.iJ = ELayoutAlignLeft;    
+                        }
+                        break; 
+                    case CGraphicsContext::ECenter: 
+                        {
+                        textLineLayout.iJ = ELayoutAlignCenter;
+                        }
+                        break; 
+                    case CGraphicsContext::ERight:  
+                        {
+                        textLineLayout.iJ = ELayoutAlignRight;
+                        } 
+                        break; 
+                    default:  break;
+                    }; 
+                }    
+                
+            TAknLayoutText textLayout;
+            textLayout.LayoutText(textRect, textLineLayout, usedFont);
+
+            SetUnderlineStyle( aProperties, aGc, subcell );
+
+            // * 2 == leave some room for marquee
+            const TInt maxlen( KMaxColumnDataLength * 2 ); 
+            TBuf<maxlen> convBuf = text.Left(maxlen);
+
+            // Note that this potentially modifies the text so its lenght in pixels
+            // might increase. Therefore, this should always be done before
+            // wrapping/clipping text. In some cases, WordWrapListItem is called
+            // before coming here. Is it certain that it is not done for number subcells?
+
+            // Do number conversion if required.
+            if (SubCellIsNumberCell(subcell))
+                {
+                AknTextUtils::LanguageSpecificNumberConversion(convBuf);
+                }
+
+            // Check whether logical to visual conversion should be done here or not.
+            TBool bidiConv =
+                iExtension->iUseLogicalToVisualConversion &&
+                subcell != iExtension->iFirstWordWrappedSubcellIndex &&
+                subcell != iExtension->iSecondWordWrappedSubcellIndex;
+
+            TBool doesNotFit( EFalse );
+            if ( aHighlight )
+                {
+                doesNotFit = usedFont->TextWidthInPixels( convBuf ) > textLayout.TextRect().Width();
+            
+                if ( doesNotFit )
+                    {
+                    iExtension->iClippedSubcells |= ( 1 << subcell );
+                    }
+                else 
+                    {
+                    iExtension->iClippedSubcells &= ~( 1 << subcell );
+                    }
 
 			if ( iExtension->iUseClippedByWrap ) // override if already clipped
 
@@ -2554,8 +2532,19 @@
 		iExtension->iAnimFlags.Set(
 				CCCAppCommLauncherCustomListBoxDataExtension::EFlagUpdateBg);
 		}
+    else if( ( aType == KEikMessageUnfadeWindows ) ||
+             ( aType == KEikMessageFadeAllWindows ) )
+        {
+        if( iExtension->iMarquee )
+            {
+            iExtension->iMarquee->HandleResourceChange( aType );
+            }
+        if( iExtension->i2ndLineMarquee )
+            {
+            iExtension->i2ndLineMarquee->HandleResourceChange( aType );
+            }
+        }
 	}
-
 // -----------------------------------------------------------------------------
 // CCCAppCommLauncherCustomListBoxData::HighlightAnim
 // -----------------------------------------------------------------------------
@@ -2785,7 +2774,7 @@
  void CCCAppCommLauncherCustomListBoxData::SetSubCellIconSize(
 		TInt aIndex, TSize aSize)
 	{
-	if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0)
+    if ( iExtension && aIndex < KMaxSubCellIndex && aIndex >= 0 )
 		{
 		iExtension->iSubCellIconSize[aIndex] = aSize;
 		}
@@ -2793,7 +2782,7 @@
 
 TSize CCCAppCommLauncherCustomListBoxData::GetSubCellIconSize(TInt aIndex)
 	{
-	if (iExtension && aIndex <= KMaxSubCellIndex && aIndex >= 0)
+    if ( iExtension && aIndex < KMaxSubCellIndex && aIndex >= 0 )
 		{
 		return iExtension->iSubCellIconSize[aIndex];
 		}
@@ -2975,7 +2964,7 @@
     {
     TInt B = aBaseline;
 
-    if( /*TAknFontId::IsEncodedFont(aFontId) &&*/ aFontId != ELayoutEmpty ) // This tells us that the font id has come from scalable layout API
+    if( TAknFontId::IsEncodedFont(aFontId) && aFontId != ELayoutEmpty ) // This tells us that the font id has come from scalable layout API
         {
         TInt b = aBaseline;
         if (IsParentRelative(b)) { b = aParentHeight - ELayoutP + b; }
@@ -3089,18 +3078,16 @@
 		{
 		if (!aUse && iExtension->iSimpleList)
 			{
-			CEikFormattedCellListBox
-					* list =
-							static_cast<CEikFormattedCellListBox*> (iExtension->iControl);
-			MAknListBoxTfxInternal* transApi = CAknListLoader::TfxApiInternal(
-					list->View()->ItemDrawer()->Gc());
-			if (transApi)
-				{
-				transApi->SetPosition(MAknListBoxTfxInternal::EListTLMargin,
-						TPoint(0, 0));
-				transApi->SetPosition(MAknListBoxTfxInternal::EListBRMargin,
-						TPoint(0, 0));
-				}
+#ifdef RD_UI_TRANSITION_EFFECTS_LIST
+            CEikFormattedCellListBox* list = static_cast<CEikFormattedCellListBox*>( iExtension->iControl );
+            MAknListBoxTfxInternal* transApi =
+                CAknListLoader::TfxApiInternal( list->View()->ItemDrawer()->Gc() );
+            if ( transApi )
+                {
+                transApi->SetPosition( MAknListBoxTfxInternal::EListTLMargin, TPoint( 0, 0 ) );
+                transApi->SetPosition( MAknListBoxTfxInternal::EListBRMargin, TPoint( 0, 0 ) );
+                }
+#endif
 			}
 		iExtension->iSimpleList = aUse;
 		}
@@ -3333,7 +3320,6 @@
 	TInt lastSubCell = Min(KMaxSubCellIndex, LastSubCell());
 	TPtrC text;
 	TBool isEmpty[KMaxSubCellIndex];
-	TBool layoutMirrored = AknLayoutUtils::LayoutMirrored();
 
 	// cache the empty text states
 	while (ETrue)
@@ -3393,44 +3379,41 @@
 
 			TRect bRect2(SubCellPosition(subCell2), SubCellSize(subCell2));
 
-			if (bRect.Intersects(bRect2) && !SubCellIsTransparent(subCell)
-					&& !SubCellIsTransparent(subCell2))
-				{
-				aResults[subCell] = ETrue;
-
-				if (!layoutMirrored)
-					{
-					bRect.iBr.iX = bRect2.iTl.iX;
-					}
-				else
-					{
-					bRect.iTl.iX = bRect2.iBr.iX;
-					}
-				}
-			}
-
-		if (aResults[subCell])
-			{
-			if (iExtension->AtSL(subCellIndex).iSubCellType
-					== CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText)
-				{
-				TAknTextLineLayout textLine =
-						iExtension->AtSL(subCellIndex).iTextLayout;
-
-				textLine.iW = bRect.Width();
-
-				if (!layoutMirrored)
-					{
-					textLine.ir = aItemRect.iBr.iX - bRect.iBr.iX;
-					}
-				else
-					{
-					textLine.il = bRect.iTl.iX - aItemRect.iTl.iX;
-					}
-
-				aLayouts[subCell] = textLine;
-				}
-			}
+            if ( bRect.Intersects( bRect2 ) && !SubCellIsTransparent( subCell ) && !SubCellIsTransparent( subCell2 ) ) 
+                {
+                aResults[subCell] = ETrue;
+
+                if ( !AknLayoutUtils::LayoutMirrored() )
+                    {
+                    bRect.iBr.iX = bRect2.iTl.iX;
+                    }
+                else
+                    {
+                    bRect.iTl.iX = bRect2.iBr.iX;
+                    }
+                }
+            }
+            
+        if ( aResults[subCell] )
+            {
+            if ( iExtension->AtSL( subCellIndex ).iSubCellType == CCCAppCommLauncherCustomListBoxDataExtension::EAknSLText )
+                {
+                TAknTextLineLayout textLine = iExtension->AtSL( subCellIndex ).iTextLayout;
+                
+                textLine.iW = bRect.Width();
+
+                if ( !AknLayoutUtils::LayoutMirrored() )
+                    {
+                    textLine.ir = aItemRect.iBr.iX - bRect.iBr.iX;
+                    }
+                else
+                    {
+                    textLine.il = bRect.iTl.iX - aItemRect.iTl.iX;
+                    }
+                
+                aLayouts[subCell] = textLine;
+                }
+            }
 
 		++subCell;
 		}
@@ -3568,8 +3551,7 @@
 		{
 		cc = SkinBackgroundContext();
 		}
-	TBool linesShown = AknListBoxUtils::ListBoxLinesShown(
-			AknsUtils::SkinInstance(), cc);
+
 
 	Mem::FillZ(textNull, sizeof(textNull));
 
@@ -3609,8 +3591,7 @@
 
 		TRect bRect(SubCellPosition(subcell), SubCellSize(subcell));
 		TMargins m(SubCellMargins(subcell));
-		TRect cRect(bRect.iTl + TSize(m.iLeft, m.iTop), bRect.Size() - TSize(
-				m.iRight + m.iLeft, m.iBottom + m.iTop));
+        TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
 
 		for (subcell2 = subcell + 1; subcell2 <= lastSubCell; subcell2++)
 			{
@@ -3620,10 +3601,8 @@
 				}
 
 			// This is called O(N^2) times - Do not put anything extra to it, it'll slow down drawing!
-			TRect bRect2(SubCellPosition(subcell2), SubCellSize(subcell2));
-			if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2)
-					&& !SubCellIsTransparent(subcell) && !SubCellIsTransparent(
-					subcell2))
+            TRect bRect2 = TRect(SubCellPosition(subcell2),SubCellSize(subcell2));
+            if (cRect.Intersects(bRect2) && bRect.Intersects(bRect2) && !SubCellIsTransparent(subcell) && !SubCellIsTransparent(subcell2)) 
 				{
 				if (!layoutMirrored)
 					{
@@ -3661,8 +3640,8 @@
 		// SetPosition, SetSize and margins support
 		TRect bRect(SubCellPosition(subcell), SubCellRealSize(subcell));
 		TMargins m(SubCellMargins(subcell));
-		TRect cRect(bRect.iTl + TSize(m.iLeft, m.iTop), SubCellRealTextSize(
-				subcell));
+        TRect cRect(bRect.iTl+TSize(m.iLeft,m.iTop),SubCellRealTextSize(subcell));
+        
 
 		if (bRect.iBr.iX == 0)
 			{
@@ -3672,9 +3651,9 @@
 
 		if (layoutMirrored)
 			{
-			TRect bRect(SubCellPosition(subcell), SubCellSize(subcell));
-			TRect cRect2(bRect.iTl + TSize(m.iLeft, m.iTop), bRect.Size()
-					- TSize(m.iRight + m.iLeft, m.iBottom + m.iTop));
+            TRect bRect = TRect(SubCellPosition(subcell),SubCellSize(subcell));
+            TRect cRect2 = TRect(bRect.iTl+TSize(m.iLeft,m.iTop),bRect.Size()-TSize(m.iRight+m.iLeft,m.iBottom+m.iTop));
+            
 
 			TInt shift = (cRect2.Size() - SubCellRealTextSize(subcell)).iWidth;
 			cRect.iTl.iX += shift;
@@ -3735,12 +3714,10 @@
 			CGraphicsContext::TTextAlign align = SubCellAlignment(subcell);
 			if (!SubCellIsGraphics(subcell))
 				{
-				const CFont* rowAndCellFont = RowAndSubCellFont(
-						iExtension->iCurrentlyDrawnItemIndex, subcell);
-				const CFont* cellFont = Font(aProperties, subcell);
-				const CFont* tempFont = (cellFont) ? cellFont : font;
-				const CFont* usedFont = (rowAndCellFont) ? rowAndCellFont
-						: tempFont;
+                const CFont* rowAndCellFont=RowAndSubCellFont(iExtension->iCurrentlyDrawnItemIndex,subcell);
+                const CFont* cellFont=Font(aProperties, subcell);
+                const CFont* tempFont=(cellFont) ? cellFont : font;
+                const CFont* usedFont=(rowAndCellFont) ? rowAndCellFont : tempFont;
 				aGc.UseFont(usedFont);
 				SetUnderlineStyle(aProperties, aGc, subcell);
 
@@ -3749,9 +3726,7 @@
 				baseLineOffset -= cRect.iTl.iY;
 				if (!baseLineOffset)
 					{
-					baseLineOffset = (cRect.Size().iHeight
-							- usedFont->HeightInPixels()) / 2
-							+ usedFont->AscentInPixels();
+                    baseLineOffset = (cRect.Size().iHeight-usedFont->HeightInPixels())/2 + usedFont->AscentInPixels();
 					}
 
 				TBuf<KMaxColumnDataLength + KAknBidiExtraSpacePerLine> clipbuf =
@@ -3769,15 +3744,18 @@
 				TBool clipped(EFalse);
 				TInt clipgap = SubCellTextClipGap(subcell);
 
-				if (iExtension->iUseLogicalToVisualConversion && subcell
-						!= iExtension->iFirstWordWrappedSubcellIndex && subcell
-						!= iExtension->iSecondWordWrappedSubcellIndex)
-					{
-					TInt maxClipWidth = textRect.Size().iWidth + clipgap;
-
-					clipped = AknBidiTextUtils::ConvertToVisualAndClip(
-							text.Left(KMaxColumnDataLength), clipbuf,
-							*usedFont, textRect.Size().iWidth, maxClipWidth);
+                if ( iExtension->iUseLogicalToVisualConversion &&
+                     subcell != iExtension->iFirstWordWrappedSubcellIndex &&
+                     subcell != iExtension->iSecondWordWrappedSubcellIndex )
+                    {
+                    TInt maxClipWidth = textRect.Size().iWidth + clipgap;
+                    
+                    clipped = AknBidiTextUtils::ConvertToVisualAndClip(
+                        text.Left(KMaxColumnDataLength), 
+                        clipbuf,
+                        *usedFont,
+                        textRect.Size().iWidth, 
+                        maxClipWidth );
 					}
 
 				if (clipped)
@@ -3805,32 +3783,27 @@
 
 					if (iExtension->iUseClippedByWrap) // override if already clipped
 						{
-						iExtension->iClippedSubcells
-								= iExtension->iClippedByWrap;
+                        iExtension->iClippedSubcells = iExtension->iClippedByWrap;
 						}
 					}
 
-				CAknMarqueeControl* marquee =
-						subcell == 1 ? iExtension->iMarquee
-								: iExtension->i2ndLineMarquee;
-
-				TBool
-						marqueeDisabled =
-								static_cast<CEikListBox*> (Control())->View()->ItemDrawer()->Flags()
-										& CListItemDrawer::EDisableMarquee;
-
-				if (aHighlight && iExtension->IsMarqueeOn() && clipped
-						&& !marqueeDisabled)
-					{
-					// Let marquee know if it needs to do bidi conversion.
-					marquee->UseLogicalToVisualConversion(clipped);
-
-					if (marquee->DrawText(aGc, textRect, text, baseLineOffset,
-							align, *usedFont))
-						{
-						// All the loops have been executed -> the text needs to be truncated.
-						aGc.DrawText(clipbuf, textRect, baseLineOffset, align,
-								0);
+                CAknMarqueeControl* marquee =
+                    subcell == 1 ? iExtension->iMarquee :
+                                   iExtension->i2ndLineMarquee;
+                
+                TBool marqueeDisabled =
+                        static_cast<CEikListBox*>(
+                            Control() )->View()->ItemDrawer()->Flags() & CListItemDrawer::EDisableMarquee;
+                
+                if ( aHighlight && iExtension->IsMarqueeOn() && clipped && !marqueeDisabled )
+                    {                    
+                    // Let marquee know if it needs to do bidi conversion.
+                    marquee->UseLogicalToVisualConversion( clipped );
+                    
+                    if ( marquee->DrawText( aGc, textRect, text, baseLineOffset, align, *usedFont ) )
+                        {
+                        // All the loops have been executed -> the text needs to be truncated.
+                        aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 );
 						}
 					}
 				else
@@ -3842,34 +3815,30 @@
 
 					if (IsBackgroundDrawingEnabled())
 						{
-						aGc.DrawText(clipbuf, textRect, baseLineOffset, align,
-								0);
-						}
-					else // "Transparent" list, draw text shadow first, then the actual text.
-						{
-						textShadowRect = textRect;
-						textShadowRect.Move(1, 1);
-						aGc.SetPenColor(textShadowColour);
-						aGc.DrawText(clipbuf, textShadowRect, baseLineOffset,
-								align, 0);
-						if (aHighlight)
-							{
-							aGc.SetPenColor(subcellColors->iHighlightedText);
-							}
-						else
-							{
-							aGc.SetPenColor(subcellColors->iText);
-							}
-						aGc.DrawText(clipbuf, textRect, baseLineOffset, align,
-								0);
+                        aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 );
+                        }
+                    else  // "Transparent" list, draw text shadow first, then the actual text.
+                        {
+                        textShadowRect = textRect;
+                        textShadowRect.Move( 1, 1 );
+                        aGc.SetPenColor( textShadowColour );
+                        aGc.DrawText( clipbuf, textShadowRect, baseLineOffset, align, 0 );
+                        if ( aHighlight )
+                            {
+                            aGc.SetPenColor( subcellColors->iHighlightedText );
+                            }
+                        else
+                            {
+                            aGc.SetPenColor( subcellColors->iText );
+                            }
+                        aGc.DrawText( clipbuf, textRect, baseLineOffset, align, 0 );
 						}
 					}
 
 				if (iExtension->iPictoInterface)
 					{
 					iExtension->iPictoInterface->Interface()->DrawPictographsInText(
-							aGc, *usedFont, clipbuf, textRect, baseLineOffset,
-							align, 0);
+                        aGc, *usedFont, clipbuf, textRect, baseLineOffset, align, 0 );
 					}
 				// disable underline after first text.
 				// at least phonebook uses this. See SetSubcellUnderlined to override
@@ -3942,10 +3911,9 @@
 							break;
 						}
 					bmpRect = TRect(bmpPos, size);
-					TPoint posInBitmap = TPoint(0, 0) + bitmap->SizeInPixels()
-							- textRect.Size();
-					posInBitmap.iX >> 1;
-					posInBitmap.iY >> 1;
+                    TPoint posInBitmap = TPoint(0,0) + bitmap->SizeInPixels() - textRect.Size();
+                    posInBitmap.iX /= 2;
+                    posInBitmap.iY /= 2;
 					if (posInBitmap.iX < 0)
 						{
 						posInBitmap.iX = 0;
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxitemdrawer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -11,22 +11,19 @@
 *
 * Contributors:
 *
-* Description: 
+* Description: CCA customized control. Code has been modified to
+*       suit CCA requirements. See CFormattedCellListBoxItemDrawer
+*       in eikfrlb.cpp
+*       Ensure that this piece of code is in sync with Avkon eikfrlb.cpp(CFormattedCellListBoxItemDrawer) 
 *
 */
-/*
- * ccappcommlaunchercustomlistboxitemdrawer.cpp
- *
- *  Created on: 2009-10-30
- *      Author: dev
- */
 
 #include <eikfrlb.h>
 #include <barsread.h>
 #include <gulicon.h>
 #include <AknUtils.h>
-#include <aknscontrolcontext.h>
-#include <aknbiditextutils.h>
+#include <AknsControlContext.h>
+#include <AknBidiTextUtils.h>
 #include <aknlists.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <AknFontId.h>
@@ -84,6 +81,7 @@
    TRect r( aItemRectPos, iItemCellSize );
    CCoeControl* control = FormattedCellData()->Control();
    
+    const MCoeControlBackground* backgroundDrawer = control->FindBackground();
    if ( control )
        {
        MAknsControlContext *cc = AknsDrawUtils::ControlContext( control );
@@ -92,7 +90,11 @@
            {
            cc = FormattedCellData()->SkinBackgroundContext();
            }
-       if ( CAknEnv::Static()->TransparencyEnabled() )
+        if ( backgroundDrawer )
+            {
+            backgroundDrawer->Draw( *iGc, *control, r );
+            }
+        else if ( CAknEnv::Static()->TransparencyEnabled() )
            {
            AknsDrawUtils::Background( AknsUtils::SkinInstance(), cc, control, *iGc, r,
                                   KAknsDrawParamNoClearUnderImage );
@@ -156,6 +158,12 @@
    
    DrawBackgroundAndSeparatorLines( aItemTextRect );
 
+   // Draw separator line except last item 
+   if ( aItemIndex < iModel->NumberOfItems() - 1 )
+	   {
+	   DrawSeparator( *iGc, aItemTextRect, iTextColor);
+	   }
+   
    TBool highlightShown = ETrue;
    
    if (FormattedCellData()->RespectFocus() && !aViewIsEmphasized)
@@ -328,6 +336,15 @@
    iTopItemIndex = aTop;
    }
 
+void CCCAppCommLauncherCustomListBoxItemDrawer::DrawCurrentItemRect(const TRect& aRect) const
+   {
+   iGc->SetClippingRect(iViewRect);
+   iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
+   iGc->SetPenColor(iHighlightedBackColor);
+   iGc->DrawRect(aRect);
+   iGc->CancelClippingRect();
+   }
+
 void CCCAppCommLauncherCustomListBoxItemDrawer::ClearAllPropertiesL()
     {
     delete iPropertyArray;
@@ -369,14 +386,8 @@
     return iPropertyArray->At(index).iProperties;
     }
 
-void CCCAppCommLauncherCustomListBoxItemDrawer::DrawCurrentItemRect(const TRect& aRect) const
-   {
-   iGc->SetClippingRect(iViewRect);
-   iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
-   iGc->SetPenColor(iHighlightedBackColor);
-   iGc->DrawRect(aRect);
-   iGc->CancelClippingRect();
-   }
+
+
 void CCCAppCommLauncherCustomListBoxItemDrawer::CCCAppCommLauncherCustomListBoxItemDrawer_Reserved()
     {
     }
@@ -419,7 +430,14 @@
         TBool bgDrawn( EFalse );
         if ( control )
             {
-	        if ( CAknEnv::Static()->TransparencyEnabled() )
+            const MCoeControlBackground* backgroundDrawer =
+                control->FindBackground();
+            if ( backgroundDrawer )
+                {
+                backgroundDrawer->Draw( *iGc, *control, aItemTextRect );
+                bgDrawn = ETrue;
+                }
+            else if ( CAknEnv::Static()->TransparencyEnabled() )
                 {
                 bgDrawn = AknsDrawUtils::Background(
                     skin, cc, control, *iGc, aItemTextRect,
@@ -445,3 +463,22 @@
 #endif // RD_UI_TRANSITION_EFFECTS_LIST
         }
     }
+
+void CCCAppCommLauncherCustomListBoxItemDrawer::DrawSeparator( CGraphicsContext& aGc, const TRect& aRect, const TRgb& aColor ) const
+	{
+	aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+	aGc.SetPenStyle( CGraphicsContext::ESolidPen );
+	
+	TRgb color( aColor );
+	color.SetAlpha( 32 );
+	aGc.SetPenColor( color );
+	
+	TRect lineRect( aRect );
+	TInt gap = AknLayoutScalable_Avkon::listscroll_gen_pane( 0 ).LayoutLine().it; 
+	lineRect.Shrink( gap, 0 );
+	lineRect.Move( 0, -1 );
+	
+	aGc.DrawLine( TPoint( lineRect.iTl.iX, lineRect.iBr.iY ), 
+	TPoint( lineRect.iBr.iX, lineRect.iBr.iY ) );
+	}
+// End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherheadercontrol.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -59,6 +59,7 @@
     // Create the header image
     iImage = new (ELeave) CEikImage();
     iImage->SetPictureOwnedExternally(ETrue);
+    iImage->SetBrushStyle( CGraphicsContext::ENullBrush ); // transparent
     iImage->SetAlignment(EHCenterVCenter);
     
     // Create the header labels
@@ -93,15 +94,7 @@
         delete iImage;
         iImage = NULL;
         }
-    if (iImageDecoding)
-        {
-        if (iImageDecoding->IsActive())
-            {
-            iImageDecoding->Cancel();
-            }
-        delete iImageDecoding;
-        iImageDecoding = NULL;
-        }
+    delete iImageDecoding;
     if (iTextOrder)
         {
         delete iTextOrder;
@@ -164,40 +157,44 @@
 //
 void CCCAppCommLauncherHeaderControl::SizeChanged()
     {
-    TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
+    const TInt isLandscape = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0;
+    const TRect rect(Rect());
+    
+    /**
+     * Option0 (w button, lsc)
+     * Option2 (w/o button, lsc)
+     * Option0 (w button, prt)
+     * Option1 (w/o button, prt)
+     */
+   
+    // (w/o button)
+    TInt option( isLandscape ? 2 : 1 );
+    if( iStatusButtonVisibility )
+        {
+        // (w button)
+        if( isLandscape )
+            {
+            option = 0;
+            }
+        else
+            {
+            option = 0;
+            }
+        }
     
     AknLayoutUtils::LayoutImage(
-            iImage, Rect(), AknLayoutScalable_Apps::cl_header_pane_g1(isLandscape));
+            iImage, rect, AknLayoutScalable_Apps::phob2_cc_data_pane_g1(option));
    
-    TPoint position = iImage->Position();
-    TSize size = iImage->Size();
-    
-    const TPoint newImagePosition = TPoint( position.iX/2, position.iY/2 );
-    iImage->SetPosition( newImagePosition );
-    
-    const TSize newImageSize = TSize( size.iWidth + 2*( position.iX - newImagePosition.iX ) ,
-            size.iHeight + 2*( position.iY - newImagePosition.iY ) );
-    
-    iImage->SetSize( newImageSize );
-    
-    iContactImageSize = newImageSize;
+    iContactImageSize = iImage->Size();
     
     if ( iImageDecoding )
         {
-        // if bitmap was set resize it
-        if (iImageDecoding->IsActive())
-            {
-            iImageDecoding->Cancel();
-            }
         TRAP_IGNORE( iImageDecoding->StartL( iContactImageSize ) );
         }
     
-    TAknLayoutRect labelsRect;
-    labelsRect.LayoutRect(Rect(), AknLayoutScalable_Apps::cl_header_name_pane(isLandscape));
-    
-    AknLayoutUtils::LayoutLabel(iLabels[0], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t1(2));
-    AknLayoutUtils::LayoutLabel(iLabels[1], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t2(2));
-    AknLayoutUtils::LayoutLabel(iLabels[2], labelsRect.Rect(), AknLayoutScalable_Apps::cl_header_name_pane_t3(2));
+    AknLayoutUtils::LayoutLabel(iLabels[0], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t1(option));
+    AknLayoutUtils::LayoutLabel(iLabels[1], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t2(option));
+    AknLayoutUtils::LayoutLabel(iLabels[2], rect, AknLayoutScalable_Apps::phob2_cc_data_pane_t3(option));
     
     if( iImageSelectionPopup )
         {
@@ -251,7 +248,7 @@
 // ---------------------------------------------------------------------------
 //
 void CCCAppCommLauncherHeaderControl::ContactInfoFetchedNotifyL( 
-    const CCmsContactFieldInfo& aContactFieldInfo )
+    const CCmsContactFieldInfo& /*aContactFieldInfo*/ )
     {
     }
 
@@ -322,6 +319,11 @@
     DrawDeferred();
     }
 
+void CCCAppCommLauncherHeaderControl::BitmapReadyL( CFbsBitmap* aBitmap )
+    {
+    SetBitmap(aBitmap);
+    }
+
 // ---------------------------------------------------------------------------
 // Sets the bitmap shown in the header image 
 // ---------------------------------------------------------------------------
@@ -591,7 +593,7 @@
      }
  
  TKeyResponse CCCAppCommLauncherHeaderControl::OfferKeyEventL(
-         const TKeyEvent& aKeyEvent, TEventCode aType)
+         const TKeyEvent& aKeyEvent, TEventCode /*aType*/)
      {
      TKeyResponse ret( EKeyWasNotConsumed );
      
@@ -612,19 +614,19 @@
 	 {
 	 iHasContactImage = EFalse;
 	 
-     if (iImageDecoding)
-         {
-         if (iImageDecoding->IsActive())
-             {
-             iImageDecoding->Cancel();
-             }
-         delete iImageDecoding;
-         iImageDecoding = NULL;
-         }
+     delete iImageDecoding;
+     iImageDecoding = NULL;
      
      if ( iContactThumbnailData )
     	 {
-         iImageDecoding = CCCAppCommLauncherImageDecoding::NewL(this, iContactThumbnailData, iContactImageFullName );
+         RFs& fs = CEikonEnv::Static()->FsSession();
+         iImageDecoding = CCCAppImageDecoding::NewL(
+                 *this, 
+                 fs, 
+                 iContactThumbnailData, 
+                 iContactImageFullName );
+         iContactImageFullName = NULL;  // ownership is moved to CCCAppImageDecoding
+         iContactThumbnailData = NULL;  // ownership is moved to CCCAppImageDecoding   
          iImageDecoding->StartL( iContactImageSize );
          iHasContactImage = ETrue;
          }
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherimagedecoding.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/*
-* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Implementation of the utility class for asynchronously decoding the header thumbnail image
-*
-*/
-
-#include <bitmaptransforms.h>
-#include "ccappcommlauncherimagedecoding.h"
-
-const TInt KDelay = 500000; // 0.5s
-// ---------------------------------------------------------------------------
-// Two-phase construction
-// ---------------------------------------------------------------------------
-//
-CCCAppCommLauncherImageDecoding* CCCAppCommLauncherImageDecoding::NewL(
-        CCCAppCommLauncherHeaderControl* aHeader, const TDesC8* aBitmapData, const TDesC* aImageFile)
-    {
-    CCCAppCommLauncherImageDecoding* self = new (ELeave) CCCAppCommLauncherImageDecoding(aHeader);
-    CleanupStack::PushL(self);
-    self->ConstructL(aBitmapData, aImageFile);
-    CleanupStack::Pop(self);
-    return self;
-    }
-
-// ---------------------------------------------------------------------------
-// First phase (C++) constructor
-// ---------------------------------------------------------------------------
-//
-CCCAppCommLauncherImageDecoding::CCCAppCommLauncherImageDecoding(CCCAppCommLauncherHeaderControl* aHeader) : 
-CActive( CActive::EPriorityStandard ), iHeader(aHeader)
-    { 
-    CActiveScheduler::Add(this); 
-    }
-
-// ---------------------------------------------------------------------------
-// ConstructL, second phase constructor
-// ---------------------------------------------------------------------------
-//
-void CCCAppCommLauncherImageDecoding::ConstructL(const TDesC8* aBitmapData, const TDesC* aImageFile)
-    {
-    if ( aImageFile )
-        {
-        iImageFullName = aImageFile->AllocL();
-        }
-    if ( aBitmapData )
-        {
-        iBitmapData = aBitmapData->AllocL();
-        }
-    User::LeaveIfError( iFs.Connect() );
-    iTimer.CreateLocal();
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CCCAppCommLauncherImageDecoding::~CCCAppCommLauncherImageDecoding()
-    {
-    DoCancel();
-    if (iBitmap)
-        {
-        delete iBitmap;
-        iBitmap = NULL;
-        }
-    if (iBitmapData)
-        {
-        delete iBitmapData;
-        iBitmapData = NULL;
-        }
-    if (iImageFullName)
-        {
-        delete iImageFullName;
-        }
-    iFs.Close();
-    iTimer.Close();
-    }
-
-// ---------------------------------------------------------------------------
-// Starts the decoding process
-// ---------------------------------------------------------------------------
-//
-void CCCAppCommLauncherImageDecoding::StartL( TSize aImageSize )
-    {
-    iDecoderState = ECcaConvertThumbnailImage;
-    iBitmapSize = aImageSize;
-    CreateBitmapL();
-    }
-
-// ---------------------------------------------------------------------------
-// Called by the active object framework when the decoding (request) is
-// completed.
-// ---------------------------------------------------------------------------
-//
-void CCCAppCommLauncherImageDecoding::RunL() 
-    {
-    User::LeaveIfError( iStatus.Int() );
-    switch ( iDecoderState )
-	    {
-	    case ECcaConvertThumbnailImage:
-	    	{
-	        iDecoderState = ECcaScaleThumbnail;
-	        ScaleBitmapL();
-	        break;
-	    	}
-	
-	    case ECcaScaleThumbnail:
-	    	{
-	    	if ( iImageFullName )
-	    		{
-	            iDecoderState = ECcaReadImageFromFile;
-	            SetPriority( EPriorityIdle );
-	            iTimer.After( iStatus, KDelay ); 
-	            SetActive();
-	    		}
-	    	// don't break here
-	    	}
-	    	
-	    case ECcaScaleImage:
-	    	{
-	        // Ownership of the bitmap is transferred
-	        iHeader->SetBitmap( iBitmap );
-	        iBitmap = NULL;
-	        delete iBitmapScaler;
-	        iBitmapScaler = NULL;
-	        delete iImgDecoder;
-	        iImgDecoder = NULL;
-	        break;
-	    	}
-	        
-	    case ECcaReadImageFromFile:
-	    	{
-	    	if ( iImageFullName )
-	    		{
-	            iDecoderState = ECcaConvertImageFromFile;
-	            CreateBitmapL();
-	    		}
-	    	break;
-	    	}
-	         
-	    case ECcaConvertImageFromFile:
-	    	{
-	        iDecoderState = ECcaScaleImage;
-	        SetPriority( EPriorityStandard );
-	        ScaleBitmapL();
-	        break;
-	    	}
-	        
-	    default:
-	        break;
-	    }
-    }
-// ---------------------------------------------------------------------------
-// Called when the decoding (request) is cancelled for some reason.
-// ---------------------------------------------------------------------------
-//
-void CCCAppCommLauncherImageDecoding::DoCancel()
-    { 
-    if (iImgDecoder)
-        {
-        iImgDecoder->Cancel();
-        delete iImgDecoder;
-        iImgDecoder = NULL;
-        }
-    if ( iBitmapScaler )
-        {
-        iBitmapScaler->Cancel();
-        delete iBitmapScaler;
-        iBitmapScaler = NULL;
-        }
-    iTimer.Cancel();
-    }
-
-void CCCAppCommLauncherImageDecoding::ScaleBitmapL()
-    {   
-    iBitmapScaler = CBitmapScaler::NewL();
-    iBitmapScaler->Scale( &iStatus, *iBitmap, iBitmapSize );
-    SetActive();
-    }
-
-void CCCAppCommLauncherImageDecoding::CreateBitmapL()
-    {
-    if ( iDecoderState == ECcaConvertThumbnailImage )
-        {
-        iImgDecoder = CImageDecoder::DataNewL( iFs, *iBitmapData, CImageDecoder::EOptionAlwaysThread );
-        }
-    else if ( iDecoderState == ECcaConvertImageFromFile )
-        {
-        // leaaves if file doesn't exist
-        TRAPD ( initDecoder, iImgDecoder = CImageDecoder::FileNewL( iFs, *iImageFullName, CImageDecoder::EOptionAlwaysThread ) );
-        if ( initDecoder )
-        	{
-	        delete iBitmapScaler;
-	        iBitmapScaler = NULL;
-	        delete iImgDecoder;
-	        iImgDecoder = NULL;
-        	return;
-        	}
-        }
-   
-   if ( !iBitmap )
-       {
-       TFrameInfo info = iImgDecoder->FrameInfo();
-       iBitmap = new ( ELeave ) CFbsBitmap;
-       User::LeaveIfError( iBitmap->Create( info.iOverallSizeInPixels, info.iFrameDisplayMode ));
-       }
- 
-    iStatus = KRequestPending;
-    iImgDecoder->Convert( &iStatus, *iBitmap );
-    SetActive();
-    }
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -261,6 +261,9 @@
         tempText.Append( textPtr );
         tempText.Append( KColumnListSeparator ); 
         
+        // TODO: Check presence icon
+        tempText.Append( KColumnListSeparator ); 
+        
         // Check if show multi icon at the right end of second row
         if ( IfShowMultiIcon( aIndex ) )
         	{
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -279,7 +279,8 @@
     {
     CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DynInitSelectOtherMenuItemL()"));
 
-    if ( iPlugin.Container().CommMethodsAvailable())
+    if ( iPlugin.Container().CommMethodsAvailable() && 
+    		iPlugin.Container().IsListBoxHighlightEnabled())
         {// comm methods available, continue..
         VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector contactAction =
             iPlugin.Container().SelectedCommunicationMethod();
@@ -307,7 +308,7 @@
             }
         }
     else
-        {// no comm methods available, don't show anything
+        {// no comm methods available or Listbox highlight is disabled, don't show anything
         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherNmbCmd );
         aMenuPane->DeleteMenuItem( ECCAppCommLauncherSelectOtherAddrCmd );
         }
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -39,6 +39,7 @@
     };
 
 const TInt KSupportedMethodsArrayLength = sizeof( KSupportedMethodsArray ) / sizeof( TInt );
+const TInt KDelayTime = 30000000; // 30s
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -82,6 +83,8 @@
        iWaitFinish->AsyncStop();
        }
     delete iWaitFinish;
+    
+    delete iAiwRequestTimer;
 
     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::~CCCAppCommLauncherPlugin()"));
     }
@@ -90,7 +93,8 @@
 // CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin()
 // ---------------------------------------------------------------------------
 //
-CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin()
+CCCAppCommLauncherPlugin::CCCAppCommLauncherPlugin() : iIsCcaForeground( ETrue ),
+        iIsTimerStart( EFalse )
     {
     CCA_DP(KCommLauncherLogFile, CCA_L("CCCAppCommLauncherPlugin()"));
     }
@@ -202,6 +206,9 @@
     // if plugin is showing notifications, this is good place to disable those
     // until ActivatePluginViewL is called again
 
+    // After commlauncher view is deactivated, cancel the timer which started when requests
+    // a call services.
+    CancelTimer();
     CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherPlugin::DoDeactivate()"));
     }
 
@@ -360,6 +367,28 @@
     }
 
 // ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::CloseCCApp
+// ---------------------------------------------------------------------------
+//
+void CCCAppCommLauncherPlugin::CloseCCApp()
+    {
+    // Cancel timer after timer triggered to make sure the same timer just be 
+    // triggered once.
+    CancelTimer();
+    
+    // If CCA is at background, close CCA application.
+    if ( !iIsCcaForeground )
+        {
+        RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+
+        TApaTask ccapp( wsSession );
+        TInt wgId = CCoeEnv::Static()->RootWin().WindowGroupId();
+        ccapp.SetWgId( wgId );
+        ccapp.EndTask();
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // CCCAppCommLauncherContainer::ContactorService
 // ---------------------------------------------------------------------------
 //
@@ -368,6 +397,10 @@
     return iContactorService;
     }
 
+// ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::DefaultSettingComplete
+// ---------------------------------------------------------------------------
+//
 void CCCAppCommLauncherPlugin::DefaultSettingComplete()
 	{
 	if ( iWaitFinish && iWaitFinish->IsStarted() )
@@ -375,6 +408,41 @@
 	   iWaitFinish->AsyncStop();
 	   }
 	}
+
+// ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::StartTimerL
+// ---------------------------------------------------------------------------
+//
+void CCCAppCommLauncherPlugin::StartTimerL()
+    {
+    if ( !iAiwRequestTimer )
+        {
+        iAiwRequestTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+        }
+    
+    // Cancel the timer before start it to make sure formal timer can be canceled
+    // when start a new timer.
+    CancelTimer();
+    
+    TCallBack callback( ServiceTimeOutL, this );
+    iAiwRequestTimer->Start( KDelayTime, KDelayTime, callback );
+    
+    iIsTimerStart = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::CancelTimer
+// ---------------------------------------------------------------------------
+//
+void CCCAppCommLauncherPlugin::CancelTimer()
+    {
+    if ( iAiwRequestTimer && iIsTimerStart )
+        {
+        iAiwRequestTimer->Cancel();
+        iIsTimerStart = EFalse;
+        }
+    }
+
 // ---------------------------------------------------------------------------
 // CCCAppCommLauncherPlugin::IsTopContactL
 // ---------------------------------------------------------------------------
@@ -399,6 +467,9 @@
 //
 void CCCAppCommLauncherPlugin::HandleCommandL( TInt aCommand )
     {
+    // Make sure the aiw request timer is canceled before executing another command.
+    CancelTimer();
+    
     // Forward the command handling 1st to base-class.
     // The "Exit"- and "Back"-commands are handled there.
     CCCAppViewPluginAknView::HandleCommandL( aCommand );
@@ -476,6 +547,15 @@
     }
 
 // ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::HandleForegroundEventL()
+// ---------------------------------------------------------------------------
+//
+void CCCAppCommLauncherPlugin::HandleForegroundEventL( TBool aForeground )
+    {
+    iIsCcaForeground = aForeground;
+    }
+
+// ---------------------------------------------------------------------------
 // CCCAppCommLauncherPlugin::Id
 // ---------------------------------------------------------------------------
 //
@@ -536,4 +616,15 @@
         }
 }
 
+// ---------------------------------------------------------------------------
+// CCCAppCommLauncherPlugin::ServiceTimeOutL
+// ---------------------------------------------------------------------------
+//
+TInt CCCAppCommLauncherPlugin::ServiceTimeOutL( TAny* aObject )
+    {
+    CCCAppCommLauncherPlugin* self = static_cast<CCCAppCommLauncherPlugin*> (aObject);
+    self->CloseCCApp();
+    return 0;
+    }
+
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchersetdefault.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchersetdefault.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -17,19 +17,19 @@
 #include "ccappcommlauncherplugin.h"
 #include "ccappcommlaunchersetdefault.h"
 
-#include <mvpbkcontactlinkarray.h>
-#include <mvpbkcontactstoreproperties.h>
-#include <mvpbkcontactstore.h>
-#include <mvpbkstorecontact.h>
-#include <mvpbkcontactoperationbase.h>
+#include <MVPbkContactLinkArray.h>
+#include <MVPbkContactStoreProperties.h>
+#include <MVPbkContactStore.h>
+#include <MVPbkStoreContact.h>
+#include <MVPbkContactOperationBase.h>
 
-#include <cvpbkcontactmanager.h>
-#include <cpbk2applicationservices.h>
-#include <cvpbkdefaultattribute.h>
+#include <CVPbkContactManager.h>
+#include <CPbk2ApplicationServices.h>
+#include <CVPbkDefaultAttribute.h>
 #include <CVPbkFieldTypeSelector.h>
-#include <vpbkcontactstoreuris.h>
+#include <VPbkContactStoreUris.h>
 
-#include <pbk2datacaging.hrh>
+#include <Pbk2DataCaging.hrh>
 #include <featmgr.h>
 
 const TInt KGranularity = 4;
--- a/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/inc/ccappdetailsviewmenuhandler.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/inc/ccappdetailsviewmenuhandler.h	Fri Feb 19 22:40:27 2010 +0200
@@ -106,7 +106,7 @@
 
 private: // Commands for Options-menu items
 
-    void DoEditCmdL();
+    void DoEditCmdL( TInt aCommand );
     void DoViewImageCmdL();
     void DoSendBusinessCardCmdL();
     void DoTopContactCmdL();
--- a/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewlistboxmodel.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewlistboxmodel.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -1226,10 +1226,16 @@
 // ---------------------------------------------------------------------------
 //
 void CCCAppDetailsViewListBoxModel::HandleUriTypeFieldL(
-    TInt /*aIndex*/,
+    TInt aIndex,
     const MVPbkContactFieldData& aFieldData,
     CCCAppDetailsViewListBoxRow* aRow)
 {
+    TBool isXspField = IsFieldTypeL( aIndex, R_DETAILSVIEW_EL_ADDRESS_SELECTOR );
+    if ( isXspField )
+        {
+        aRow->SetClipRequired( ETrue );
+        }
+    
     const MVPbkContactFieldUriData& uri =
         MVPbkContactFieldUriData::Cast(aFieldData);
 
--- a/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewmenuhandler.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewmenuhandler.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:  Implementation of ccappdetailsview menuhandler
-*  Version     : %version: he1s60#31.1.13 %
+*  Version     : %version: he1s60#31.1.15 %
 *
 */
 
@@ -532,7 +532,7 @@
     case EAknSoftkeyEdit:
     case KAiwCmdAssign: // AIW service cmd for Editing
     case ECCAppDetailsViewEditItemCmd:
-        DoEditCmdL();
+        DoEditCmdL( aCommand );
         break;
 
     case ECCAppDetailsViewImageCmd:
@@ -598,7 +598,7 @@
 // CCCAppDetailsViewMenuHandler::DoEditCmdL
 // ---------------------------------------------------------------------------
 //
-void CCCAppDetailsViewMenuHandler::DoEditCmdL()
+void CCCAppDetailsViewMenuHandler::DoEditCmdL(  TInt aCommand )
 {
     const CCCAppDetailsViewContainer& container =
         static_cast<const CCCAppDetailsViewContainer&>(iPlugin.GetContainer());
@@ -617,8 +617,37 @@
 
     inParamList.AppendL(TAiwGenericParam(EGenericParamContactLinkArray,
         TAiwVariant( *packedLinks)));
-
+    
     TInt focusIndex = container.ListBoxModel().FocusedFieldIndex();
+    
+    TBool itemFocused = iPlugin.MenuBar()->ItemSpecificCommandsEnabled();
+    TBool isAddressField = EFalse;
+    MVPbkBaseContactField* focusedField = container.ListBoxModel().FocusedFieldLC();
+    if ( focusedField )
+        {
+        const MVPbkFieldType* type = focusedField->BestMatchingFieldType();
+        const TArray<TVPbkFieldVersitProperty> propArr = type->VersitProperties();
+        if(propArr.Count())
+            {
+            const TVPbkFieldVersitProperty prop = propArr[0];
+            if(prop.Name() == EVPbkVersitNameADR)
+                {
+                isAddressField = ETrue;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( focusedField );
+    
+    // this is only for the case, if there is only address field( address field is in first 
+    // item in details view), when select "Edit" from options menu, if the item is not focused,
+    // contact eidtor view should be opened instead of address editor view.
+    // if the address field is focused or or select the list item directly, address editor view
+    // should be opened insdead of contact eidtor view.
+    // set focusIndex to KErrNotFound in order to open contact editor view.
+    if ( isAddressField && !itemFocused && aCommand != ECCAppDetailsViewEditItemCmd )
+        {
+        focusIndex = KErrNotFound;
+        }
 
     CCA_DP(KDetailsViewLogFile, CCA_L("CCCAppDetailsViewMenuHandler::DoEditCmdL() focusIndex = %d"), focusIndex);
 
@@ -813,18 +842,21 @@
     {
         const MVPbkStoreContactField& field =
             container.FocusedStoreContact()->Fields().FieldAt( i );
-        TInt countProps =
-            field.BestMatchingFieldType()->VersitProperties().Count();
-        TArray<TVPbkFieldVersitProperty> props =
-            field.BestMatchingFieldType()->VersitProperties();
-        for ( TInt ii = 0; ii < countProps; ii++ )
-        {
-            if ( props[ ii ].Name() == EVPbkVersitNameADR )
+        const MVPbkFieldType* fieldType = field.BestMatchingFieldType();
+        if ( fieldType )
             {
-                addressField = ETrue;
-                break;
+            TInt countProps = fieldType->VersitProperties().Count();
+            TArray<TVPbkFieldVersitProperty> props =
+                fieldType->VersitProperties();
+            for (TInt ii = 0; ii < countProps; ii++ )
+                {
+                if ( props[ii].Name() == EVPbkVersitNameADR )
+                    {
+                    addressField = ETrue;
+                    break;
+                    }
+                }
             }
-        }
     }
     return addressField;
 }
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss	Fri Feb 19 22:40:27 2010 +0200
@@ -48,8 +48,6 @@
 #include <Pbk2IconId.rh>
 
 
-// Todo: This will be read from loc file after localization
-#define qtn_mycard_default_status "My Profile in Ovi"
 //  RESOURCE DEFINITIONS 
 
 // ---------------------------------------------------------------------------
@@ -91,7 +89,7 @@
         MENU_ITEM 
             { 
             command = ECCAppMyCardCmdEdit;
-            txt = "Edit";
+            txt = qtn_phob_opt_entry_edit;
             },         
         MENU_ITEM 
             { 
@@ -101,7 +99,7 @@
         MENU_ITEM 
             { 
             command = ECCappMyCardCmdDelete;
-            txt = qtn_phob_opt_entry_delete;	
+            txt = qtn_phob_my_card_clear;
             }, 	        	        	
         MENU_ITEM 
             { 
@@ -175,31 +173,48 @@
 }
 
 // --------------------------------------------------------------------------
-// r_qtn_mycard_title
+// r_qtn_cca_title_my_card
 // --------------------------------------------------------------------------
 //
-RESOURCE TBUF r_qtn_mycard_title
-{
-    // TODO: localization
-    buf = "MyCard";
+RESOURCE TBUF r_qtn_cca_title_my_card
+{    
+    buf = qtn_cca_title_my_card;
 }
 // --------------------------------------------------------------------------
-// r_qtn_mycard_editor_title
+// r_qtn_cca_mc_title_edit_my_card
 // --------------------------------------------------------------------------
 //
-RESOURCE TBUF r_qtn_mycard_editor_title
+RESOURCE TBUF r_qtn_cca_mc_title_edit_my_card
 {    
     buf = qtn_cca_mc_title_edit_my_card;
 }
 
 // ---------------------------------------------------------------------------
-// r_qtn_mycard_default_status
+// r_qtn_cca_mc_my_card_in_ovi
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_qtn_cca_mc_my_card_in_ovi 			   
+    {  
+    buf = qtn_cca_mc_my_card_in_ovi; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_phob_my_card_clear_confirm
 // ---------------------------------------------------------------------------
 // 
-RESOURCE TBUF r_qtn_mycard_default_status 			   
-	{ 
-	buf = qtn_mycard_default_status; 
-	}
+RESOURCE TBUF r_qtn_phob_my_card_clear_confirm              
+    { 
+    buf = qtn_phob_my_card_clear_confirm; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_cca_info_note_copied_to_clipboard
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_cca_info_note_copied_to_clipboard
+    {
+    buf = qtn_cca_info_note_copied_to_clipboard; 
+    }
 
 // --------------------------------------------------------------------------
 // Social Phonebook field properties for the contact editor
@@ -1678,6 +1693,7 @@
             }
         };
     }
+
 // ---------------------------------------------------------------------------
 // r_ccacommlauncher_contact_image_stylus_menu
 // ---------------------------------------------------------------------------
@@ -1697,4 +1713,17 @@
         };
     }
 
+// ---------------------------------------------------------------------------
+// r_mycard_contact_copy_detail_stylus_menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE STYLUS_POPUP_MENU r_mycard_contact_copy_detail_stylus_menu
+    {
+    items =
+        {
+        STYLUS_POPUP_MENU_ITEM { txt = qtn_cca_options_copy_detail; 
+                             command = ECCAppMyCardCmdStylusCopyDetailCmd; }        
+        };
+    }
+
 //End of File
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,6 +24,7 @@
 #include <MVPbkContactObserver.h>
 #include <MVPbkSingleContactOperationObserver.h>
 #include <MPbk2EditedContactObserver.h>	
+#include <MPbk2ExitCallback.h>
 
 class CVPbkContactManager;
 class MVPbkContactLink;
@@ -37,6 +38,7 @@
 class CCreateMyCard;
 class CPbk2ApplicationServices;
 class CCCAppMyCardPlugin;	
+class MPbk2DialogEliminator;
 
 /**
  * MyCard Observer class
@@ -75,7 +77,8 @@
 		public MVPbkSingleContactLinkOperationObserver,
 		public MVPbkSingleContactOperationObserver,
 		public MVPbkContactObserver,
-		public MPbk2EditedContactObserver
+		public MPbk2EditedContactObserver,
+		public MPbk2ExitCallback
     {
 
 public:
@@ -185,6 +188,9 @@
 	                MVPbkStoreContact* aEditedContact );
 	 void ContactEditingAborted();
     
+private: // From MPbk2ExitCallback
+     TBool OkToExitL( TInt aCommandId );
+
 private: // constructors
     inline CCCAppMyCard( CCCAppMyCardPlugin& aPlugin );
     inline void ConstructL(RFs* aFs);
@@ -219,6 +225,11 @@
      */
     static TInt CloseCcaL( TAny* aPtr );
     
+    /**
+     * Async callback function for closing editor dialog.
+     */
+    static TInt ExitDlgL( TAny* aPtr );
+    
     /*
      * Closes the CCA
      */
@@ -251,10 +262,14 @@
 	CAsyncCallBack*	iCloseCallBack; 
     /// Own: Asynchronous callback for create
     CAsyncCallBack* iCreateCallBack; 
+    /// Own: Asynchronous callback for close dialog
+    CAsyncCallBack* iDlgCloseCallBack; 
 	/// Ref: plugin
 	CCCAppMyCardPlugin& iPlugin;
 	/// Focused contact field index for the editor
 	TInt iFocusedFieldIndex;	
+	/// Now own. Editor dialog eliminator
+	MPbk2DialogEliminator* iEditorEliminator;
 	};
 
 #endif // CCAPPMYCARD_H
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.hrh	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycard.hrh	Fri Feb 19 22:40:27 2010 +0200
@@ -28,7 +28,8 @@
     ECCAppMyCardCmdStylusChangeImageCmd,
     ECCAppMyCardCmdStylusRemoveImageCmd,
     ECCAppMyCardCmdStylusAddImageCmd,
-    ECCappMyCardCmdDelete
+    ECCappMyCardCmdDelete,
+    ECCAppMyCardCmdStylusCopyDetailCmd
 };
 
 /// Panic codes for CCA MyCard plugin
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,8 @@
 #include <ccappviewpluginakncontainer.h>
 #include "ccappmycard.h"
 #include "ccappmycardimageloader.h"
-#include <mpbk2contactuicontrol.h>
+#include <MPbk2ContactUiControl.h>
+#include <aknlongtapdetector.h>
 #include "ccappmycardheadercontrol.h"
 
 #include "ccappstatuscontrol.h"
@@ -55,7 +56,8 @@
     public MEikListBoxObserver,
     public MPbk2ContactUiControl,
     public MCCAStatusControlObserver,
-    public MMyCardHeaderControlObserver
+    public MMyCardHeaderControlObserver,
+    public MAknLongTapDetectorCallBack
     {
 public: // constructor and destructor
 
@@ -141,6 +143,23 @@
      */
     void MyCardHeaderControlClickL( TPoint aPos );
     
+    /**
+     * Default callback function for CAknLongTapDetector member object.
+     * Base class implementation does nothing
+     * 
+     * @param aPenEventLocation Long tap event location relative to parent control.
+     * @param aPenEventScreenLocation Long tap event location relative to screen.
+     */
+    void HandleLongTapEventL( const TPoint& aPenEventLocation, 
+        const TPoint& aPenEventScreenLocation );
+    
+    /**
+    * From CoeControl
+    * Overridden to receive pointer events
+    */
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+    
 public: // New
 
     /**
@@ -206,7 +225,7 @@
         MPbk2Command* aCommand );
     void SetTextL(
        const TDesC& aText );
-    TAny* ContactUiControlExtension(TUid aExtensionUid );
+    TAny* ContactUiControlExtension(TUid aExtensionUid );    
     void ProcessCommandL( TInt aCommandId ) const;
 
     /*
@@ -312,6 +331,23 @@
 	CCCaFactoryExtensionNotifier* iFactoryExtensionNotifier;
 
 	TInt iNameOrder;
+	
+	/**
+     * iLongTapDetector
+     * Own.
+     */
+    CAknLongTapDetector* iLongTapDetector;  
+    
+    /** 
+      * Contact detail selection stylus popup menu 
+      * Own. 
+      */  
+    CAknStylusPopUpMenu* iDetailsPopup;
+    
+    /*
+     * Flag for checking if Stylys opened 
+     */
+    TBool iLongTapHandled;    
     };
 
 #endif // CCAPPMYCARDCONTAINER_H
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardheadercontrol.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardheadercontrol.h	Fri Feb 19 22:40:27 2010 +0200
@@ -94,6 +94,7 @@
     void SetLabel2TextL( const TDesC& aTxt );
     
     inline CCCAppStatusControl* StatusControl();
+    inline const TSize& ThumbnailSize();
     
 public: // Functions from base classes 
 
@@ -207,4 +208,10 @@
     return iStatusControl;
     }
 
+inline const TSize& CCCAppMyCardHeaderControl::ThumbnailSize()
+    {
+    return iPortraitImageSize;
+    }
+
+
 #endif // CCCAPPMYCARDHEADERCONTROL_H
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardimageloader.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardimageloader.h	Fri Feb 19 22:40:27 2010 +0200
@@ -18,13 +18,11 @@
 #ifndef CCAPPMYCARDIMAGELOADER_H
 #define CCAPPMYCARDIMAGELOADER_H
 
-#include <e32base.h>
-#include <MPbk2ImageOperationObservers.h>
+#include <CCAppImageDecoding.h>
 
-class CVPbkContactManager;
-class CPbk2ImageManager;
 class MVPbkStoreContact;
-class MPbk2ImageOperation;
+class CCCAppImageDecoding;
+class CFbsBitmap;
 
 /**
  * MyCard image loading observer class
@@ -59,8 +57,8 @@
  *  @since S60 9.2
  */
 NONSHARABLE_CLASS( CCCAppMyCardImageLoader ) : 
-    public CBase, 
-    public MPbk2ImageGetObserver
+    public CBase,
+    public MCCAppImageDecodingObserver
 {
 
 public:
@@ -69,7 +67,6 @@
      * Two-phased constructor.
      */
     static CCCAppMyCardImageLoader* NewL(
-        CVPbkContactManager& aContactManager,
         MMyCardImageLoaderObserver& aObserver );
 
     /**
@@ -87,46 +84,35 @@
      * 
      * @param aContact source contact for the image
      */
-    void LoadContactImageL( MVPbkStoreContact& aContact );
-
+    void LoadContactImageL( 
+            MVPbkStoreContact& aContact, 
+            const TSize& aThumbnailSize );
+    void ResizeImageL( const TSize& aThumbnailSize );
     
-private: // From MPbk2ImageGetObserver
-    virtual void Pbk2ImageGetComplete(
-            MPbk2ImageOperation& aOperation,
-            CFbsBitmap* aBitmap );
-    virtual void Pbk2ImageGetFailed(
-            MPbk2ImageOperation& aOperation,
-            TInt aError );
-
+private:    // From MCCAppImageDecodingObserver
+    void BitmapReadyL( CFbsBitmap* aBitmap );
     
 private: // constructors
     
     /**
      * Constructor
      */
-    CCCAppMyCardImageLoader(
-        CVPbkContactManager& aContactManager,
+    inline CCCAppMyCardImageLoader(
         MMyCardImageLoaderObserver& aObserver );
-
-    /**
-     * Constructor
-     */
-    void ConstructL();
-
     
 private: // data
 	
-	/// Not own. Virtual phonebook contact manager
-	CVPbkContactManager& iContactManager;
-	
 	/// Not own. Observer
 	MMyCardImageLoaderObserver& iObserver;
 	
-	/// Own. Phonebook image manager
-	CPbk2ImageManager* iImageManager;
-	
-	/// Own. Image operation
-	MPbk2ImageOperation* iOperation;
+	/// Own.
+	HBufC8* iImageBuffer;
+
+    /// Own.
+    HBufC* iImageFileName;
+    
+    /// Own
+    CCCAppImageDecoding* iImageDecoding;
 };
 
 #endif // CCAPPMYCARDIMAGELOADER_H
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardplugin.h	Fri Feb 19 22:40:27 2010 +0200
@@ -179,6 +179,11 @@
     void ViewImageCmdL(); 
     
     /*
+    * Copy detail to clipboard
+    */
+    void CopyDetailL();
+    
+    /*
      * Creates command handler if not created, and returns pointer to it.
      */
     CPbk2CommandHandler* CommandHandlerL();
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycard.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -50,8 +50,8 @@
 #include <CPbk2SortOrderManager.h>
 #include <Pbk2ContactNameFormatterFactory.h>
 #include <MPbk2ContactNameFormatter.h>
-#include <cpbk2applicationservices.h>	
-#include <cpbk2storemanager.h>	
+#include <CPbk2ApplicationServices.h>	
+#include <CPbk2StoreManager.h>
 #include <CPbk2StoreConfiguration.h>	
 #include <CPbk2ContactEditorDlg.h>
 #include <MVPbkBaseContactField.h>
@@ -105,6 +105,7 @@
     
 	delete iCloseCallBack;
     delete iCreateCallBack;
+    delete iDlgCloseCallBack;
 
 	CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCard::~CCCAppMyCard()"));
     }
@@ -138,6 +139,8 @@
         TCallBack( CloseCcaL, this ), CActive::EPriorityIdle );	
     iCreateCallBack = new(ELeave) CAsyncCallBack( 
         TCallBack( CreateMyCardContact, this ), CActive::EPriorityHigh );  
+    iDlgCloseCallBack = new(ELeave) CAsyncCallBack( 
+        TCallBack( ExitDlgL, this ), CActive::EPriorityHigh );
 	}
 
 // ---------------------------------------------------------------------------
@@ -285,17 +288,18 @@
     {
     CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCard::LoadContact()"));    
 
-    delete iFetchOperation;
-    iFetchOperation = NULL;
-    TRAPD( err, iFetchOperation = 
-        iVPbkContactManager->RetrieveContactL( *iMyCard, *this ) );
-    if( err )
+    if( !iFetchOperation && iMyCard )
         {
-        // Cannot load own contact from VPbk  
-        CCA_DP(KMyCardLogFile, 
-            CCA_L("  CCCAppMyCard::LoadContact load error = %d"), err ); 
-
-        // TODO: How is this handled. show error on UI?
+        TRAPD( err, iFetchOperation = 
+            iVPbkContactManager->RetrieveContactL( *iMyCard, *this ) );
+        if( err )
+            {
+            // Cannot load own contact from VPbk  
+            CCA_DP(KMyCardLogFile, 
+                CCA_L("  CCCAppMyCard::LoadContact load error = %d"), err ); 
+    
+            // TODO: How is this handled. show error on UI?
+            }
         }
     
     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCard::LoadContact()"));    
@@ -459,16 +463,21 @@
 		iMyCardContact = NULL;
 		}
 	// params for the editor
-	TPbk2ContactEditorParams params( aFlags, field, NULL, NULL );
+	TPbk2ContactEditorParams params( aFlags, field, NULL, this );
 	
 	// pass custom title text
-	HBufC* title = CCoeEnv::Static()->AllocReadResourceLC( R_QTN_MYCARD_TITLE );
-	// ownership of the title is passed
-	CPbk2ContactEditorDlg* dlg =
-		CPbk2ContactEditorDlg::NewL( params, contact, *this, iAppServices, title,  
-        R_SOCIAL_PHONEBOOK_FIELD_PROPERTIES );
-	CleanupStack::Pop( title );
-	dlg->ExecuteLD();
+    if ( contact )
+        {
+        HBufC* title = CCoeEnv::Static()->AllocReadResourceLC( 
+            R_QTN_CCA_MC_TITLE_EDIT_MY_CARD );
+        // ownership of the title is passed
+        CPbk2ContactEditorDlg* dlg = CPbk2ContactEditorDlg::NewL( params, contact, 
+            *this, iAppServices, title, R_SOCIAL_PHONEBOOK_FIELD_PROPERTIES );
+        CleanupStack::Pop( title );
+        iEditorEliminator = dlg;
+        dlg->ResetWhenDestroyed( &iEditorEliminator );
+        dlg->ExecuteLD();
+        }
 	
 	// if field was created, destroy it
 	if( field )
@@ -498,24 +507,21 @@
 //
 void CCCAppMyCard::ContactEditingComplete( MVPbkStoreContact* aEditedContact )
 	{
-    // My Card modifications are handled in HandleStoreEventL. Editor complete
-    // event is only interesting if we don't yet have mycard at all. Meaning
-    // it was just created.
+    // create link of mycard
+    MVPbkContactLink* link = NULL;
+    TRAPD( err, 
+        link = aEditedContact->CreateLinkLC();   
+        CleanupStack::Pop(); ); //link
     
-    if( !iMyCard )
+    if( !err )
         {
-        TRAPD( err, iMyCard = aEditedContact->CreateLinkLC();   
-            CleanupStack::Pop(); ); //link
-        if( err )
-            {
-            // TODO handle error 
-            }
-        else
-            {
-            // reload contact to get rid of the template(empty) fields. 
-            LoadContact();
-            }
+        delete iMyCard;
+        iMyCard = link;
+        
+        // reload mycard to get rid of the empty template fields
+        LoadContact();
         }
+    
     delete aEditedContact; // ignore given contact
 	}
 
@@ -541,6 +547,19 @@
 	}
 
 // ---------------------------------------------------------------------------
+// CCCAppMyCard::OkToExitL
+// ---------------------------------------------------------------------------
+//
+TBool CCCAppMyCard::OkToExitL( TInt /*aCommandId*/ )
+    {
+    // Handle exit via callback. Calls CCCAppMyCard::ExitDlg.
+    // Dialog's exit is handled this way to make the address selector's 
+    // exit work as it should.
+    iDlgCloseCallBack->Call();
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
 // CCCAppMyCard::CloseCcaL
 // ---------------------------------------------------------------------------
 //
@@ -554,6 +573,20 @@
 	}
 
 // ---------------------------------------------------------------------------
+// CCCAppMyCard::CloseCcaL
+// ---------------------------------------------------------------------------
+//
+TInt CCCAppMyCard::ExitDlgL( TAny* aPtr )
+    {
+    CCCAppMyCard* self = static_cast<CCCAppMyCard*>( aPtr );
+    if( self->iEditorEliminator )
+        {
+        self->iEditorEliminator->RequestExitL( EAknCmdExit );
+        }
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
 // CCCAppMyCard::DoCloseCCaL
 // ---------------------------------------------------------------------------
 //
@@ -642,6 +675,9 @@
         CCA_L("->CCCAppMyCard::VPbkSingleContactOperationFailed error = %d"),
         aError );    
     
+    delete iFetchOperation;
+    iFetchOperation = NULL;
+
     delete iOperation;
     iOperation = NULL;
     
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -30,9 +30,9 @@
 #include <MVPbkStoreContact.h>
 #include <CPbk2IconArray.h>
 #include <Pbk2UIControls.rsg>
-#include <mpbk2command.h>
-#include <pbk2menufilteringflags.hrh>
-#include <mvpbkcontactlink.h>
+#include <MPbk2Command.h>
+#include <Pbk2MenuFilteringFlags.hrh>
+#include <MVPbkContactLink.h>
 
 #include "ccappmycard.hrh"
 #include "ccappmycard.h"
@@ -66,6 +66,12 @@
 #include <centralrepository.h>
 #include <Phonebook2PrivateCRKeys.h>
 
+#include <CPbk2ApplicationServices.h>
+#include <CPbk2ServiceManager.h>
+#include <TPbk2IconId.h>
+#include <CPbk2IconInfo.h>
+
+
 // unnamed namespace
 namespace
 {
@@ -105,6 +111,8 @@
     delete iFactoryExtensionNotifier;
     delete iViewLauncher;
     delete iImageSelectionPopup;
+    delete iLongTapDetector; 
+    delete iDetailsPopup;
     }
 
 // ----------------------------------------------------------------------------
@@ -140,6 +148,46 @@
     TResourceReader reader;
     iCoeEnv->CreateResourceReaderLC( reader, R_PBK2_FIELDTYPE_ICONS );
     CPbk2IconArray* iconArray = CPbk2IconArray::NewL( reader );
+  
+    // Calculate preferred size for xsp service icons.
+    TRect mainPane;
+    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+    TAknLayoutRect listLayoutRect;
+    listLayoutRect.LayoutRect(
+        mainPane,
+        AknLayoutScalable_Avkon::list_single_graphic_pane_g1(0).LayoutLine() );
+    TSize size( listLayoutRect.Rect().Size() );
+        
+    // Add xsp service icons
+    CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceL();
+    CPbk2ServiceManager& servMan = appServices->ServiceManager();
+    
+    const CPbk2ServiceManager::RServicesArray& services = servMan.Services();
+    TUid uid;
+    uid.iUid = KPbk2ServManId;
+    
+    for( TInt i = 0; i < services.Count(); i++ )
+        {
+        const CPbk2ServiceManager::TService& service = services[i];
+        
+        if ( service.iBitmapId && service.iBitmap )
+            {
+            AknIconUtils::SetSize(
+                      service.iBitmap,
+                      size );
+            AknIconUtils::SetSize(
+                      service.iMask,
+                      size );
+            TPbk2IconId id = TPbk2IconId( uid, service.iBitmapId );
+            CPbk2IconInfo* info = CPbk2IconInfo::NewLC(
+               id, service.iBitmap, service.iMask, size );
+            iconArray->AppendIconL( info );
+            CleanupStack::Pop( info );
+            }        
+        }
+    
+    Release( appServices );
+        
     iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
     CleanupStack::PopAndDestroy(); // reader
 
@@ -156,7 +204,6 @@
     iListBox->SetListBoxObserver( this );
     iPlugin.MyCard().AddObserverL( this );
 
-
     if( iPlugin.MyCard().IsContactLinkReady() )
     	{
         CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl();
@@ -169,11 +216,12 @@
     iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL();
 
     TCallBack callBack( CCCAppMyCardContainer::CheckExtensionFactoryL, this );
-    iFactoryExtensionNotifier->ObserveExtensionFactory( callBack );
+    iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack );
+    
+    iLongTapDetector = CAknLongTapDetector::NewL( this );
     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardContainer::ConstructL()"));
     }
 
-
 /**
  * Gets a digit from a descriptor.
  *
@@ -193,10 +241,10 @@
         }
 
     CleanupStack::PopAndDestroy( orderBuf );
+    
     return result;
     }
 
-
 // ----------------------------------------------------------------------------
 // CCCAppMyCardContainer::ResolveNameOrderL()
 // ----------------------------------------------------------------------------
@@ -322,6 +370,14 @@
 	delete iImageSelectionPopup;
 	iImageSelectionPopup = NULL;
 	
+	delete iDetailsPopup;
+	iDetailsPopup = NULL;
+	
+	if( iImageLoader )
+	    {
+        TRAP_IGNORE( iImageLoader->ResizeImageL(iHeaderCtrl->ThumbnailSize()));
+	    }
+	
     DrawDeferred();
     }
 
@@ -444,10 +500,10 @@
         if( !iImageLoader )
             {
             // lazy initialization
-            iImageLoader = CCCAppMyCardImageLoader::NewL(
-                mycard.ContactManager(), *this );
+            iImageLoader = CCCAppMyCardImageLoader::NewL( *this );
             }
-        iImageLoader->LoadContactImageL( mycard.StoreContact() );
+        iImageLoader->LoadContactImageL( mycard.StoreContact(), 
+                iHeaderCtrl->ThumbnailSize() );
         }
 
     if( iPlugin.MyCard().IsContactLinkReady() && !iControlLink )
@@ -513,6 +569,13 @@
         case EEventItemDoubleClicked:
         case EEventItemSingleClicked:
             {
+            // Don't open the editor if stylusMenu opened using longTap 
+            if( iLongTapHandled ) 
+                {
+                iLongTapHandled = EFalse;
+                return;
+                }
+            
             // start the editor and pass tapped field index
             iPlugin.EditL( FocusedFieldIndex() );
             break;
@@ -546,8 +609,6 @@
     return NULL;
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::NumberOfContacts
 // --------------------------------------------------------------------------
@@ -595,7 +656,6 @@
     // do nothing
 	}
 
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::SetFocusedContactL
 // --------------------------------------------------------------------------
@@ -700,8 +760,6 @@
     return NULL;
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::SelectedContactsOrFocusedContactL
 // --------------------------------------------------------------------------
@@ -787,8 +845,6 @@
     // Not supported
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::DynInitMenuPaneL
 // --------------------------------------------------------------------------
@@ -805,9 +861,9 @@
 // --------------------------------------------------------------------------
 //
 void CCCAppMyCardContainer::ProcessCommandL(TInt /*aCommandId*/) const
-	{
+        {
     // Nothing to do
-	}
+        }
 
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::UpdateAfterCommandExecution
@@ -871,8 +927,6 @@
     return KNullDesC;
 	}
 
-
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::ResetFindL
 // --------------------------------------------------------------------------
@@ -900,7 +954,6 @@
     // Do nothing
 	}
 
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::SetBlank
 // --------------------------------------------------------------------------
@@ -910,7 +963,6 @@
     // This control does not support blanking
 	}
 
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::RegisterCommand
 // --------------------------------------------------------------------------
@@ -920,7 +972,6 @@
     iCommand = aCommand;
 	}
 
-
 // --------------------------------------------------------------------------
 // CCCAppMyCardContainer::SetTextL
 // --------------------------------------------------------------------------
@@ -1002,8 +1053,7 @@
             iHeaderCtrl->SetLabel1TextL( lastName );
             break;
             }
-        }
-    
+        }    
 	}
 
 //------------------------------------------------------------------------------
@@ -1044,9 +1094,61 @@
     iImageSelectionPopup->SetPosition( aPos );
     iImageSelectionPopup->ShowMenu();   
 }
+ 
+// ----------------------------------------------------------------------------
+// CCCAppMyCardContainer::HandleLongTapEventL()
+// ----------------------------------------------------------------------------
+//
+void CCCAppMyCardContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, 
+                                    const TPoint& /*aPenEventScreenLocation*/ )
+    {       
+    if( iDetailsPopup )
+        {
+        iLongTapHandled = ETrue;
+        iDetailsPopup->ShowMenu();
+        }
+    }
+ 
+// ----------------------------------------------------------------------------
+// CCCAppCommLauncherContainer::HandlePointerEventL()
+// ----------------------------------------------------------------------------
+//
+void CCCAppMyCardContainer::HandlePointerEventL(
+    const TPointerEvent& aPointerEvent )
+    {               
+    TInt index;
+    TPoint pos = aPointerEvent.iPosition;
+    
+    if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) )
+       {
+       iLongTapDetector->PointerEventL( aPointerEvent );
+         
+       if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+           {
+           // Pressed Down Effect
+           iListBox->View()->ItemDrawer()->SetFlags(
+                   CListItemDrawer::EPressedDownState );
+           }
+       }
+
+   if ( !iDetailsPopup )
+      {
+      iDetailsPopup = CAknStylusPopUpMenu::NewL( &iPlugin, aPointerEvent.iPosition ); 
+      TInt resourceReaderId = R_MYCARD_CONTACT_COPY_DETAIL_STYLUS_MENU; 
+      TResourceReader reader;
+      iCoeEnv->CreateResourceReaderLC( reader , resourceReaderId );
+      iDetailsPopup->ConstructFromResourceL( reader );
+      CleanupStack::PopAndDestroy(); // reader
+      }
+      
+    PosToScreenCoordinates( this, pos );    
+    iDetailsPopup->SetPosition( pos );      
+   
+    CCoeControl::HandlePointerEventL( aPointerEvent );              
+    }
 
 // ---------------------------------------------------------------------------
-// PosToScreenCoordinates
+// CCCAppCommLauncherContainer::PosToScreenCoordinates
 // ---------------------------------------------------------------------------
 //
 void CCCAppMyCardContainer::PosToScreenCoordinates( 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -37,6 +37,7 @@
 #include <phonebook2ece.mbg>
 #include <gulicon.h>
 #include <layoutmetadata.cdl.h>
+#include <StringLoader.h>
 
 namespace {
 /// Amount of child UI components
@@ -99,7 +100,9 @@
             EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask );    
                 
         CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask );
-        iStatusControl->SetDefaultStatusL( R_QTN_MYCARD_DEFAULT_STATUS, guiIcon );      
+        iStatusControl->SetDefaultStatusIconL( guiIcon );
+        HBufC* defaultText = StringLoader::LoadL( R_QTN_CCA_MC_MY_CARD_IN_OVI );                                            
+        iStatusControl->SetDefaultStatusTextL( defaultText );        
         }
     FeatureManager::UnInitializeLib();
     
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardimageloader.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardimageloader.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -26,9 +26,12 @@
 #include <CPbk2ImageManager.h>
 #include <TPbk2ImageManagerParams.h>
 #include <VPbkEng.rsg>
+#include <MVPbkContactFieldBinaryData.h>
+#include <MVPbkContactFieldTextData.h>
 
 // System
 #include <fbs.h>
+#include <eikenv.h>
 
 
 // ---------------------------------------------------------------------------
@@ -36,16 +39,12 @@
 // ---------------------------------------------------------------------------
 //
 CCCAppMyCardImageLoader* CCCAppMyCardImageLoader::NewL(
-    CVPbkContactManager& aContactManager,
     MMyCardImageLoaderObserver& aObserver )
     {
     CCA_DP(KMyCardLogFile, CCA_L("->CCCAppMyCardImageLoader::NewL()"));
     
     CCCAppMyCardImageLoader* self = 
-        new ( ELeave ) CCCAppMyCardImageLoader( aContactManager, aObserver );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
+        new ( ELeave ) CCCAppMyCardImageLoader( aObserver );
     
     CCA_DP(KMyCardLogFile, CCA_L("<-CCCAppMyCardImageLoader::NewL()"));
     return self;
@@ -59,9 +58,10 @@
     {
     CCA_DP(KMyCardLogFile, 
         CCA_L("->CCCAppMyCardImageLoader::~CCCAppMyCardImageLoader()"));
-    
-    delete iImageManager;
-    delete iOperation;
+
+    delete iImageDecoding;
+    delete iImageBuffer;
+    delete iImageFileName;
 
     CCA_DP(KMyCardLogFile, 
         CCA_L("<-CCCAppMyCardImageLoader::~CCCAppMyCardImageLoader()"));
@@ -72,101 +72,95 @@
 // ---------------------------------------------------------------------------
 //
 inline CCCAppMyCardImageLoader::CCCAppMyCardImageLoader(
-    CVPbkContactManager& aContactManager,
     MMyCardImageLoaderObserver& aObserver ) :
-        iContactManager( aContactManager ),
         iObserver( aObserver )
     {
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppMyCardImageLoader::ConstructL
-// ---------------------------------------------------------------------------
-//
-inline void CCCAppMyCardImageLoader::ConstructL()
-    {
-    iImageManager = CPbk2ImageManager::NewL( iContactManager );
-    }
-
-// ---------------------------------------------------------------------------
 // CCCAppMyCardImageLoader::LoadContactImageL
 // ---------------------------------------------------------------------------
 //
 void CCCAppMyCardImageLoader::LoadContactImageL( 
-    MVPbkStoreContact& aContact )
+    MVPbkStoreContact& aContact,
+    const TSize& aThumbnailSize )
     {
     CCA_DP(KMyCardLogFile, 
         CCA_L("->CCCAppMyCardImageLoader::LoadContactImageL()"));
+
+    MVPbkStoreContactFieldCollection& fields = aContact.Fields();
     
-    // cancel previous operations
-    delete iOperation;
-    iOperation = NULL;
+    delete iImageBuffer;
+    iImageBuffer = NULL;
+    delete iImageFileName;
+    iImageFileName = NULL;
+    
+    const TInt fieldCount = fields.FieldCount();                           
     
-    const MVPbkFieldType* thumbType = iContactManager.FieldTypes().Find(
-        R_VPBK_FIELD_TYPE_THUMBNAILPIC );
-  
-    if( thumbType )
+    // Check all the fields and store first and last name
+    for ( TInt i = 0; i < fieldCount;  ++i )
         {
-        if( iImageManager->HasImage( aContact, *thumbType ) )
+        MVPbkStoreContactField& field = fields.FieldAt( i );    
+        const MVPbkFieldType* fieldType = field.BestMatchingFieldType();
+        
+        if ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_THUMBNAILPIC )
             {
-            // contact has image. load it.
-            iOperation = iImageManager->GetImageAsyncL( 
-                NULL, aContact, *thumbType, *this );
+            MVPbkContactFieldData& contactField = field.FieldData(); 
+            iImageBuffer = 
+                MVPbkContactFieldBinaryData::Cast(contactField).BinaryData().AllocL();
+            }
+        
+        if ( fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_CALLEROBJIMG )
+            {
+            MVPbkContactFieldData& contactField = field.FieldData();                        
+            iImageFileName = MVPbkContactFieldTextData::Cast(contactField).Text().AllocL();
             }
         }
-    
-    if( !iOperation )
+        
+    if( iImageBuffer )
         {
-        // no operation means the contact does not have image
+        delete iImageDecoding;
+        iImageDecoding = NULL;
+        
+        RFs& fs = CEikonEnv::Static()->FsSession();
+        iImageDecoding = CCCAppImageDecoding::NewL(
+                *this, 
+                fs, 
+                iImageBuffer, 
+                iImageFileName );
+        iImageFileName = NULL;  // ownership is moved to CCCAppImageDecoding
+        iImageBuffer = NULL;  // ownership is moved to CCCAppImageDecoding   
+        iImageDecoding->StartL( aThumbnailSize );      
+        }
+    else
+        {
         iObserver.ThumbnailLoadError( KErrNotFound );
-        }
+        }        
     
     CCA_DP(KMyCardLogFile, 
         CCA_L("<-CCCAppMyCardImageLoader::LoadContactImageL()"));
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppMyCardImageLoader::Pbk2ImageGetComplete
+// CCCAppMyCardImageLoader::ResizeImageL
 // ---------------------------------------------------------------------------
 //
-void CCCAppMyCardImageLoader::Pbk2ImageGetComplete(
-    MPbk2ImageOperation& /*aOperation*/,
-    CFbsBitmap* aBitmap )
+void CCCAppMyCardImageLoader::ResizeImageL( const TSize& aThumbnailSize )
     {
-    CCA_DP(KMyCardLogFile, 
-        CCA_L("->CCCAppMyCardImageLoader::Pbk2ImageGetComplete()"));
-    
-    delete iOperation;
-    iOperation = NULL;
-    
-    // keep this last, so that observer can delete the image loader when it has
-    // received the notification.
-    iObserver.ThumbnailReady( aBitmap );
-    
-    CCA_DP(KMyCardLogFile, 
-        CCA_L("<-CCCAppMyCardImageLoader::Pbk2ImageGetComplete()"));    
+    if( iImageDecoding  )
+        {
+        iImageDecoding->StartL( aThumbnailSize );      
+        }
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppMyCardImageLoader::Pbk2ImageGetFailed
+// CCCAppMyCardImageLoader::BitmapReadyL
 // ---------------------------------------------------------------------------
 //
-void CCCAppMyCardImageLoader::Pbk2ImageGetFailed( 
-    MPbk2ImageOperation& /*aOperation*/,
-    TInt aError )
+void CCCAppMyCardImageLoader::BitmapReadyL( CFbsBitmap* aBitmap )
     {
-    CCA_DP(KMyCardLogFile, 
-        CCA_L("->CCCAppMyCardImageLoader::Pbk2ImageGetFailed() %d"), aError );    
-    
-    delete iOperation;
-    iOperation = NULL;
-
-    // keep this last, so that observer can delete the image loader when it has
-    // received the notification.
-    iObserver.ThumbnailLoadError( aError );
-
-    CCA_DP(KMyCardLogFile, 
-        CCA_L("<-CCCAppMyCardImageLoader::Pbk2ImageGetFailed()"));    
+    iObserver.ThumbnailReady( aBitmap );
     }
 
+
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxmodel.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardlistboxmodel.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -405,9 +405,15 @@
 // CCCAppMyCardListBoxModel::HandleUriTypeFieldL
 // ---------------------------------------------------------------------------
 //
-void CCCAppMyCardListBoxModel::HandleUriTypeFieldL(TInt /*aIndex*/,
+void CCCAppMyCardListBoxModel::HandleUriTypeFieldL(TInt aIndex,
         const MVPbkContactFieldData& aFieldData, CCCAppMyCardListBoxRow* aRow)
     {
+    TBool isXspField = IsFieldTypeL( aIndex, R_MYCARD_CLIP_FIELD_SELECTOR );
+    if ( isXspField )
+        {
+        aRow->SetClipRequired( ETrue );
+        }
+    
     const MVPbkContactFieldUriData& uri = 
         MVPbkContactFieldUriData::Cast( aFieldData );
 
--- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardplugin.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -23,7 +23,7 @@
 #include "ccappmycard.h"
 #include "ccappmycard.hrh"
 #include <ccappmycardpluginrsc.rsg>
-#include <pbk2uicontrols.rsg>
+#include <Pbk2UIControls.rsg>
 #include <data_caging_path_literals.hrh>
 #include <phonebook2.mbg>
 #include <mccappengine.h>
@@ -35,11 +35,13 @@
 #include <avkon.hrh>
 #include <aknappui.h>
 #include <CPbk2CommandHandler.h>
-#include <pbk2commands.hrh>		//pbk2cmdsend
-#include <pbk2datacaging.hrh>	
+#include <Pbk2Commands.hrh>		//pbk2cmdsend
+#include <Pbk2DataCaging.hrh>	
 #include <TPbk2ContactEditorParams.h>
 #include <CPbk2GeneralConfirmationQuery.h>
 #include <CPbk2PresentationContact.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
 
 // ---------------------------------------------------------------------------
 // Constants
@@ -164,7 +166,7 @@
         aPrevViewId, aCustomMessageId, aCustomMessage );
     
     // Set view title
-    HBufC* title = iCoeEnv->AllocReadResourceLC( R_QTN_MYCARD_TITLE );
+    HBufC* title = iCoeEnv->AllocReadResourceLC( R_QTN_CCA_TITLE_MY_CARD );
     SetTitleL( *title );
     CleanupStack::PopAndDestroy( title );
     
@@ -264,15 +266,15 @@
         	break;
         	}
         case ECCappMyCardCmdDelete: 
-        	{        	        
-        	CPbk2GeneralConfirmationQuery* query =
-			CPbk2GeneralConfirmationQuery::NewL();
-			
-        	if ( query->ExecuteLD( iMyCard->PresentationContactL(), R_QTN_QUERY_COMMON_CONF_DELETE ) )
-				{
-				iMyCard->PresentationContactL().DeleteL( *iMyCard );				
-				}       
-        	        	
+        	{
+            HBufC* prompt = 
+                StringLoader::LoadLC( R_QTN_PHOB_MY_CARD_CLEAR_CONFIRM );
+            CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+            if( dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) )
+                {
+                iMyCard->PresentationContactL().DeleteL( *iMyCard );                
+                }
+            CleanupStack::PopAndDestroy( prompt );
         	break;
         	}        	
         default:
@@ -409,6 +411,10 @@
              AddImageCmdL();
              break;
              
+         case ECCAppMyCardCmdStylusCopyDetailCmd:             
+              CopyDetailL();
+              break;                        
+             
          default:
         	 CAknView::ProcessCommandL(aCommandId);
              break;
@@ -450,4 +456,13 @@
     { 
 	CommandHandlerL()->HandleCommandL( EPbk2CmdChangeImage, *iOwnContainer, NULL );
     } 
+
+// ---------------------------------------------------------------------------
+// CCCAppMyCardContainer::CopyDetailL
+// ---------------------------------------------------------------------------
+//
+void CCCAppMyCardPlugin::CopyDetailL()
+    {
+    CommandHandlerL()->HandleCommandL( EPbk2CmdCopyDetail, *iOwnContainer, NULL );
+    }
 // End of File
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccaclient/src/ccaconnection.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccaclient/src/ccaconnection.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -243,6 +243,8 @@
         iObserver = NULL;
         }
 
+    iClosePending = EFalse; 
+    
     //Kill us if not soft exit requested
     if(!(flags & MCCAParameter::ESoftExit))    
         {
@@ -251,7 +253,7 @@
         MAknServerAppExitObserver::HandleServerAppExit( aReason );
         }
 
-   iClosePending = EFalse; 
+   
    CCA_DP(KCCAClientLoggerFile, CCA_L( "<-CCCAConnection::HandleServerAppExit"));
     }
 
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def	Fri Feb 19 22:40:27 2010 +0200
@@ -22,8 +22,10 @@
 	?SetTitleL@CCCAppViewPluginAknView@@QAEXABVTDesC16@@@Z @ 21 NONAME ; void CCCAppViewPluginAknView::SetTitleL(class TDesC16 const &)		
 	?NewL@CCCAppStatusControl@@SAPAV1@AAVCSpbContentProvider@@AAVMCCAStatusControlObserver@@@Z @ 22 NONAME ; class CCCAppStatusControl * CCCAppStatusControl::NewL(class CSpbContentProvider &, class MCCAStatusControlObserver &)
 	?SetContactLinkL@CCCAppStatusControl@@QAEXAAVMVPbkContactLink@@@Z @ 23 NONAME ; void CCCAppStatusControl::SetContactLinkL(class MVPbkContactLink &)	
-	?SetDefaultStatusL@CCCAppStatusControl@@QAEXHPAVCGulIcon@@@Z @ 24 NONAME ; void CCCAppStatusControl::SetDefaultStatusL(int, class CGulIcon *)
-	?NewL@CCCaFactoryExtensionNotifier@@SAPAV1@XZ @ 25 NONAME ; class CCCaFactoryExtensionNotifier * CCCaFactoryExtensionNotifier::NewL(void)
-	?ObserveExtensionFactory@CCCaFactoryExtensionNotifier@@QAEXAAVTCallBack@@@Z @ 26 NONAME ; void CCCaFactoryExtensionNotifier::ObserveExtensionFactory(class TCallBack &)
-	?ExtensionFactory@CCCaFactoryExtensionNotifier@@QAEPAVCCCAExtensionFactory@@XZ @ 27 NONAME ; class CCCAExtensionFactory * CCCaFactoryExtensionNotifier::ExtensionFactory(void)
-
+	?NewL@CCCaFactoryExtensionNotifier@@SAPAV1@XZ @ 24 NONAME ; class CCCaFactoryExtensionNotifier * CCCaFactoryExtensionNotifier::NewL(void)
+	?ObserveExtensionFactoryL@CCCaFactoryExtensionNotifier@@QAEXAAVTCallBack@@@Z @ 25 NONAME ; void CCCaFactoryExtensionNotifier::ObserveExtensionFactory(class TCallBack &)
+	?ExtensionFactory@CCCaFactoryExtensionNotifier@@QAEPAVCCCAExtensionFactory@@XZ @ 26 NONAME ; class CCCAExtensionFactory * CCCaFactoryExtensionNotifier::ExtensionFactory(void)
+	?StartL@CCCAppImageDecoding@@QAEXABVTSize@@@Z @ 27 NONAME ; void CCCAppImageDecoding::StartL(class TSize const &)
+	?NewL@CCCAppImageDecoding@@SAPAV1@AAVMCCAppImageDecodingObserver@@AAVRFs@@PAVHBufC8@@PAVHBufC16@@@Z @ 28 NONAME ; class CCCAppImageDecoding * CCCAppImageDecoding::NewL(class MCCAppImageDecodingObserver &, class RFs &, class HBufC8 *, class HBufC16 *)
+	?SetDefaultStatusTextL@CCCAppStatusControl@@QAEXPAVHBufC16@@@Z @ 29 NONAME ; void CCCAppStatusControl::SetDefaultStatusTextL(class HBufC16 *)
+	?SetDefaultStatusIconL@CCCAppStatusControl@@QAEXPAVCGulIcon@@@Z @ 30 NONAME ; void CCCAppStatusControl::SetDefaultStatusIcon(class CGulIcon *)
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def	Fri Feb 19 22:40:27 2010 +0200
@@ -32,8 +32,11 @@
 	_ZTV30CCCAppCmsContactFetcherWrapper @ 31 NONAME ; #<VT>#	
 	_ZN19CCCAppStatusControl15SetContactLinkLER16MVPbkContactLink @ 32 NONAME
 	_ZN19CCCAppStatusControl4NewLER19CSpbContentProviderR25MCCAStatusControlObserver @ 33 NONAME
-	_ZN19CCCAppStatusControl17SetDefaultStatusLEiP8CGulIcon @ 34 NONAME
-	_ZN28CCCaFactoryExtensionNotifier16ExtensionFactoryEv @ 35 NONAME
-	_ZN28CCCaFactoryExtensionNotifier23ObserveExtensionFactoryER9TCallBack @ 36 NONAME
-	_ZN28CCCaFactoryExtensionNotifier4NewLEv @ 37 NONAME
+	_ZN28CCCaFactoryExtensionNotifier16ExtensionFactoryEv @ 34 NONAME
+	_ZN28CCCaFactoryExtensionNotifier24ObserveExtensionFactoryLER9TCallBack @ 35 NONAME
+	_ZN28CCCaFactoryExtensionNotifier4NewLEv @ 36 NONAME
+	_ZN19CCCAppImageDecoding4NewLER27MCCAppImageDecodingObserverR3RFsP6HBufC8P7HBufC16 @ 37 NONAME
+	_ZN19CCCAppImageDecoding6StartLERK5TSize @ 38 NONAME
+	_ZN19CCCAppStatusControl21SetDefaultStatusTextLEP7HBufC16 @ 39 NONAME
+	_ZN19CCCAppStatusControl21SetDefaultStatusIconLEP8CGulIcon @ 40 NONAME
 
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/group/ccapputil.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/group/ccapputil.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -31,6 +31,7 @@
 SOURCE                  ccappviewpluginakncontainer.cpp
 SOURCE                  ccappstatuscontrol.cpp
 SOURCE                  ccafactoryextensionnotifier.cpp
+SOURCE                  ccappimagedecoding.cpp
 
 //Internal
 USERINCLUDE             ../inc
@@ -62,6 +63,9 @@
 LIBRARY                 touchfeedback.lib
 LIBRARY                 ecom.lib
 LIBRARY                 AknLayout2Scalable.lib
+LIBRARY                 imageconversion.lib
+LIBRARY                 bitmaptransforms.lib
+LIBRARY                 fbscli.lib
 
 #if defined( ARMCC )
 deffile ../eabi/ 
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccafactoryextensionnotifier.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccafactoryextensionnotifier.h	Fri Feb 19 22:40:27 2010 +0200
@@ -46,7 +46,7 @@
      * 
      * @since TB 9.2
      */
-    IMPORT_C void ObserveExtensionFactory( TCallBack& aCallBack );
+    IMPORT_C void ObserveExtensionFactoryL( TCallBack& aCallBack );
     
     /**
      * Returns CCCAExtensionFactory pointer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappimagedecoding.h	Fri Feb 19 22:40:27 2010 +0200
@@ -0,0 +1,183 @@
+/*
+* Copyright (c) 2008-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:  Utility class for asynchronously decoding the header thumbnail image
+*
+*/
+
+
+#ifndef CCAPPIMAGEDECODING_H_
+#define CCAPPIMAGEDECODING_H_
+
+#include <e32base.h>
+
+class CBitmapScaler;
+class CImageDecoder;
+class CFbsBitmap;
+class RFs;
+
+class MCCAppImageDecodingObserver
+	{
+public:
+	/**
+	 * Bitmap is decoded.
+	 * @param aBitmap Decoded bitmap, ownership is transferred.
+	 */ 
+	virtual void BitmapReadyL( CFbsBitmap* aBitmap ) = 0;
+
+protected:
+	MCCAppImageDecodingObserver() {};
+	virtual ~MCCAppImageDecodingObserver() {};
+	};
+
+
+/**
+ * Utility class for asynchronously decoding the header thumbnail image
+ *
+ *  @code
+ *   ?good_class_usage_example(s)
+ *  @endcode
+ *
+ *  @lib ccapputil.dll
+ *  @since S60 v9.2
+ */
+NONSHARABLE_CLASS( CCCAppImageDecoding ) : public CActive
+    {
+public:
+    /**
+     * Two-phased constructor
+     * 
+     * @param aObserver 
+     * @param aBitmapData Descriptor containing the bitmap data stream, takes ownership
+     * @param aImageFile Descriptor containing image file name full path, takes ownership
+     */
+    IMPORT_C static CCCAppImageDecoding* NewL(
+            MCCAppImageDecodingObserver& aObserver,
+            RFs& aFs,
+            HBufC8* aBitmapData, 
+            HBufC* aImageFile );
+    
+    /**
+     * Destructor
+     */
+    ~CCCAppImageDecoding();
+    
+    /**
+     * Starts the decoding process
+     * 
+     * @param aImageSize defines image size
+     */
+    IMPORT_C void StartL( const TSize& aImageSize );
+
+private:
+    /**
+     * From CActive
+     * (see details from baseclass )
+     */
+    void RunL();
+    
+    /**
+     * From CActive
+     * (see details from baseclass )
+     */
+    void DoCancel();
+private:
+    /**
+     * First-phase (C++) constructor
+     */
+    inline CCCAppImageDecoding(
+            MCCAppImageDecodingObserver& aObserver,
+            RFs& aFs,
+            HBufC8* aBitmapData, 
+            HBufC* aImageFile);
+    
+    /**
+     * Second phase constructor
+     */
+    inline void ConstructL();
+    
+    /**
+     * Scales bitmap
+     *
+     */
+    void ScaleBitmapL();
+
+    void CropBitmapL();
+    
+    /**
+     * Create bitmap
+     *
+     */
+    void CreateBitmapL();
+    
+    enum TCcaImageDecoderState
+        {
+        ECcaConvertThumbnailImage = 1,
+        ECcaScaleThumbnail,
+        ECcaReadImageFromFile,
+        ECcaConvertImageFromFile,
+        ECcaScaleImage
+        };
+    
+    /**
+     * The image scaler whose service is called to scale the image
+     * Own.
+     */
+    CBitmapScaler* iBitmapScaler;
+    
+    /**
+     * The image decoder whose service is called to decode the image
+     * Own.
+     */
+    CImageDecoder* iImgDecoder;
+    
+    MCCAppImageDecodingObserver& iObserver;
+    
+    /**
+     * Handle to the file server session for loading the bitmap
+     */ 
+    RFs& iFs;
+    
+    /**
+     * The bitmap.
+     * Owned until decoding is complete, then ownersip is transferred to header control.
+     */
+    CFbsBitmap* iBitmap; // owned until completion
+    
+    /**
+     * Own.
+     */
+    HBufC8* iBitmapData;
+
+    /**
+     * Own.
+     */
+    HBufC* iImageFullName;
+    
+    /** 
+      * Contact bitmap size 
+      */ 
+    TSize iBitmapSize;
+    
+    /** 
+      * Decoder internal state
+      */ 
+    TInt iDecoderState;
+    
+    /** 
+      * Timer used to delay image conversion
+      */ 
+    RTimer iTimer;
+    };
+
+#endif /*CCAPPIMAGEDECODING_H_*/
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h	Fri Feb 19 22:40:27 2010 +0200
@@ -92,11 +92,18 @@
     TBool IsPressed();
      
      /**
-	 * Sets the default status text and icon 
-	 * 
-	 * @aLink Link to current contact
+	 * Set the default status icon 
+	 * 	 
+	 * @aDefaultStatusIcon Default status icon
 	 */
-     IMPORT_C void SetDefaultStatusL( TInt aDefaultResource, CGulIcon* aDefaultStatusIcon );
+     IMPORT_C void SetDefaultStatusIconL( CGulIcon* aDefaultStatusIcon );
+     
+     /**
+	 * Set the default status text 
+	 * 	 
+	 * @aDefaultStatusText Default status text
+	 */
+     IMPORT_C void SetDefaultStatusTextL( HBufC* aDefaultStatusText );     
              
 public: // From CCoeControl
      
@@ -145,11 +152,11 @@
      * Wraps the status text to fit into the space allocated for it.
      */
     TInt RewrapStatusTextL();
-   
+
     /**
-     * Set default status
+     * Show default status icon and text
      */
-    void DefaultStatusL();
+    void ShowDefaultContentL();
     
     /**
      * Handle status update event
@@ -181,6 +188,21 @@
      */
     void ConstructL();
 
+protected: // enums
+    
+    /**
+     * Internal states
+     */
+    enum TStatusControlState
+        {
+        // Show nothing
+        EStateUndefined,
+        // Default content shown
+        EStateDefaultContent,
+        // Status content shown
+        EStateStatusContent
+        };
+    
 protected: // data
 
     /**
@@ -208,6 +230,11 @@
      * Own. Current status text
      */
     HBufC* iStatusText;
+    
+    /**
+	 * Own. Default status text
+	 */
+	HBufC* iDefaultStatusText;
         
     /**
 	* Ref, Not owned. Status provider for updating the status and icon.
@@ -225,7 +252,6 @@
     // Own.
     CGulIcon* iDefaultIcon;              
         
-    TInt iDefaultResource;
     /**
      * Own. Button background graphics context (button effect)
      */
@@ -240,6 +266,11 @@
      * Not own (singleton). Tactile feedback interface
      */
     MTouchFeedback* iTouchFeedBack;
+    
+    /*
+     * Current control state.
+     */
+    TStatusControlState iState;
     };
 
 #endif // CCAPPSTATUSCONTROL_H_
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccafactoryextensionnotifier.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccafactoryextensionnotifier.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -48,7 +48,10 @@
 CCCaFactoryExtensionNotifier::~CCCaFactoryExtensionNotifier()
     {
     Cancel();
-    iEComSession->Close();
+    if( iEComSession )
+        {
+        iEComSession->Close();
+        }
       
     delete iExtensionFactory;
     }
@@ -126,7 +129,8 @@
 // CCCaFactoryExtensionNotifier::ObserveExtensionFactory( TCallBack& aCallBack )
 // ----------------------------------------------------------------------------
 //
-EXPORT_C void CCCaFactoryExtensionNotifier::ObserveExtensionFactory( TCallBack& aCallBack )
+EXPORT_C void CCCaFactoryExtensionNotifier::ObserveExtensionFactoryL( 
+        TCallBack& aCallBack )
     {
     iCallBack = aCallBack;
     CreateExtensionFactoryL();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappimagedecoding.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of the utility class for asynchronously decoding the header thumbnail image
+*
+*/
+
+#include "ccappimagedecoding.h"
+#include <bitmaptransforms.h>
+#include <Pbk2PresentationUtils.h>
+#include <imageconversion.h>
+
+namespace{
+
+const TInt KDelay = 500000; // 0.5s
+
+inline TSize ScaledLoadSize( const TSize& aOriginalSize, TInt aScaleFactor )
+    {
+    // Divide original size with scalefactor
+    // Round always up if result is not integer
+    return TSize( aOriginalSize.iWidth / aScaleFactor + ( aOriginalSize.iWidth % aScaleFactor ? 1 : 0 ),
+               aOriginalSize.iHeight / aScaleFactor + ( aOriginalSize.iHeight % aScaleFactor ? 1 : 0 ) );
+    }
+} // namespace
+
+// ---------------------------------------------------------------------------
+// Two-phase construction
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCCAppImageDecoding* CCCAppImageDecoding::NewL(
+        MCCAppImageDecodingObserver& aObserver,
+        RFs& aFs,
+        HBufC8* aBitmapData, 
+        HBufC* aImageFile)
+    {
+    CCCAppImageDecoding* self = new (ELeave) CCCAppImageDecoding(
+            aObserver, aFs, aBitmapData, aImageFile);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);    
+    
+    self->iBitmapData = aBitmapData;   // take ownship
+    self->iImageFullName = aImageFile;  // take ownship
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// First phase (C++) constructor
+// ---------------------------------------------------------------------------
+//
+inline CCCAppImageDecoding::CCCAppImageDecoding(
+        MCCAppImageDecodingObserver& aObserver,
+        RFs& aFs,
+        HBufC8* aBitmapData, 
+        HBufC* aImageFile) : 
+CActive( CActive::EPriorityStandard ), 
+iObserver(aObserver), 
+iFs(aFs)
+    { 
+    CActiveScheduler::Add(this); 
+    }
+
+// ---------------------------------------------------------------------------
+// Second phase (C++) constructor
+// ---------------------------------------------------------------------------
+//
+inline void CCCAppImageDecoding::ConstructL()
+    {
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CCCAppImageDecoding::~CCCAppImageDecoding()
+    {
+    Cancel();
+    if (iImgDecoder)
+        {
+        iImgDecoder->Cancel();
+        delete iImgDecoder;
+        }
+    if (iBitmapScaler)
+        {
+        iBitmapScaler->Cancel();
+        delete iBitmapScaler;
+        }
+    delete iBitmap;
+    delete iBitmapData;
+    delete iImageFullName;
+    iTimer.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Starts the decoding process
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCCAppImageDecoding::StartL( const TSize& aImageSize )
+    {
+    Cancel();
+    iDecoderState = ECcaConvertThumbnailImage;
+    iBitmapSize = aImageSize;
+    CreateBitmapL();
+    }
+
+// ---------------------------------------------------------------------------
+// Called by the active object framework when the decoding (request) is
+// completed.
+// ---------------------------------------------------------------------------
+//
+void CCCAppImageDecoding::RunL() 
+    {
+    User::LeaveIfError( iStatus.Int() );
+    switch ( iDecoderState )
+	    {
+	    case ECcaConvertThumbnailImage:
+	    	{
+	        iDecoderState = ECcaScaleThumbnail;
+	        CropBitmapL();
+	        ScaleBitmapL();
+	        break;
+	    	}
+	
+	    case ECcaScaleThumbnail:
+	    	{
+	    	if ( iImageFullName )
+	    		{
+	            iDecoderState = ECcaReadImageFromFile;
+	            SetPriority( EPriorityIdle );
+	            iTimer.After( iStatus, KDelay ); 
+	            SetActive();
+	    		}
+	    	// don't break here
+	    	}
+	    	
+	    case ECcaScaleImage:
+	    	{
+	        // Ownership of the bitmap is transferred
+	        iObserver.BitmapReadyL( iBitmap );
+	        iBitmap = NULL;
+	        delete iBitmapScaler;
+	        iBitmapScaler = NULL;
+	        delete iImgDecoder;
+	        iImgDecoder = NULL;
+	        break;
+	    	}
+	        
+	    case ECcaReadImageFromFile:
+	    	{
+	    	if ( iImageFullName )
+	    		{
+	            iDecoderState = ECcaConvertImageFromFile;
+	            CreateBitmapL();
+	    		}
+	    	break;
+	    	}
+	         
+	    case ECcaConvertImageFromFile:
+	    	{
+	        iDecoderState = ECcaScaleImage;
+	        SetPriority( EPriorityStandard );
+            CropBitmapL();
+	        ScaleBitmapL();
+	        break;
+	    	}
+	        
+	    default:
+	        break;
+	    }
+    }
+// ---------------------------------------------------------------------------
+// Called when the decoding (request) is cancelled for some reason.
+// ---------------------------------------------------------------------------
+//
+void CCCAppImageDecoding::DoCancel()
+    { 
+    if (iImgDecoder)
+        {
+        iImgDecoder->Cancel();
+        delete iImgDecoder;
+        iImgDecoder = NULL;
+        }
+    if ( iBitmapScaler )
+        {
+        iBitmapScaler->Cancel();
+        delete iBitmapScaler;
+        iBitmapScaler = NULL;
+        }
+    iTimer.Cancel();
+    }
+
+void CCCAppImageDecoding::CropBitmapL()
+    {
+    TSize dummy;
+    Pbk2PresentationImageUtils::CropImageL(
+            *iBitmap, 
+            Pbk2PresentationImageUtils::ELandscapeCropping, 
+            dummy );
+    }
+
+void CCCAppImageDecoding::ScaleBitmapL()
+    {   
+    iBitmapScaler = CBitmapScaler::NewL();
+    iBitmapScaler->Scale( &iStatus, *iBitmap, iBitmapSize );
+    SetActive();
+    }
+
+void CCCAppImageDecoding::CreateBitmapL()
+    {
+    TInt initDecoder( KErrGeneral );
+    if ( iDecoderState == ECcaConvertThumbnailImage && iBitmapData )
+        {
+        iImgDecoder = CImageDecoder::DataNewL( iFs, *iBitmapData, CImageDecoder::EOptionAlwaysThread );
+        initDecoder = KErrNone;
+        }
+    else if ( iDecoderState == ECcaConvertImageFromFile && iImageFullName )
+        {
+        // leaaves if file doesn't exist
+        TRAP ( initDecoder, iImgDecoder = CImageDecoder::FileNewL( iFs, *iImageFullName, CImageDecoder::EOptionAlwaysThread ) );
+        }
+    if ( initDecoder )
+        {
+        delete iBitmapScaler;
+        iBitmapScaler = NULL;
+        delete iImgDecoder;
+        iImgDecoder = NULL;
+        return;
+        }
+    
+   if ( !iBitmap )
+       {
+       const TFrameInfo info = iImgDecoder->FrameInfo();
+	   // calculate size for the bitmap
+       const TSize size( iBitmapSize );
+       TSize loadSize( info.iOverallSizeInPixels );
+       
+       for( TInt i = 1 ; i < 9 ; i = i * 2 )
+           {
+		   // we can use scalers 1:1 1:2 1:4 1:8
+           TSize calcSize( ScaledLoadSize( info.iOverallSizeInPixels, i ) );
+           if( calcSize.iHeight < size.iHeight ||
+               calcSize.iWidth < size.iWidth )
+               {
+               break;
+               }
+           loadSize = calcSize;
+           }
+       
+       iBitmap = new ( ELeave ) CFbsBitmap;
+       User::LeaveIfError( iBitmap->Create( loadSize, info.iFrameDisplayMode ));
+       }
+ 
+    iStatus = KRequestPending;
+    iImgDecoder->Convert( &iStatus, *iBitmap );
+    SetActive();
+    }
--- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -22,11 +22,11 @@
 #include <eikimage.h>
 #include <eiklabel.h>
 #include <AknIconUtils.h>
-#include <aknutils.h>
+#include <AknUtils.h>
 #include <avkon.mbg>
 #include <gulicon.h>
-#include <stringloader.h>
-#include <aknsframebackgroundcontrolcontext.h>
+#include <StringLoader.h>
+#include <AknsFrameBackgroundControlContext.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <AknsUtils.h>
 #include <AknsDrawUtils.h>
@@ -93,7 +93,7 @@
     CSpbContentProvider& aContentProvider, MCCAStatusControlObserver& aObserver ) : 
     iContentProvider( aContentProvider ),
     iObserver( aObserver ),
-    iDefaultResource( KErrNotFound )
+    iState( EStateUndefined )
     {		
     } 
 
@@ -155,6 +155,7 @@
     delete iStatusText;    
 	delete iDefaultIcon;
     delete iBgContext; 
+    delete iDefaultStatusText;
     delete iLink;
     }
 
@@ -212,15 +213,33 @@
 	}
 
 // ---------------------------------------------------------------------------
-// CCCAppStatusControl::SetDefaultStatusL
+// CCCAppStatusControl::SetDefaultStatusIconL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CCCAppStatusControl::SetDefaultStatusL( TInt aDefaultResource, 
-		CGulIcon* aDefaultStatusIcon )
+EXPORT_C void CCCAppStatusControl::SetDefaultStatusIconL( CGulIcon* aDefaultStatusIcon )
 	{
-	iDefaultResource = aDefaultResource;
-	delete iDefaultIcon;	
-	iDefaultIcon = aDefaultStatusIcon;					
+	delete iDefaultIcon;
+	iDefaultIcon = aDefaultStatusIcon;
+
+	if( iStatusIconSize != TSize() && iState == EStateDefaultContent )
+        {
+        ShowDefaultContentL();
+        }
+	}
+
+// ---------------------------------------------------------------------------
+// CCCAppStatusControl::SetDefaultStatusTextL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CCCAppStatusControl::SetDefaultStatusTextL( HBufC* aDefaultStatusText ) 		
+	{
+	delete iDefaultStatusText;
+	iDefaultStatusText = aDefaultStatusText;
+	
+	if( iState == EStateDefaultContent )
+	    {
+        ShowDefaultContentL();
+	    }
 	}
 
 // ---------------------------------------------------------------------------
@@ -290,6 +309,7 @@
 
     // resize images for new resolution
     ReSizeIcon( iStatusIcon, iStatusIconSize );
+    ReSizeIcon( iDefaultIcon, iStatusIconSize );
     }
 
 // ---------------------------------------------------------------------------
@@ -410,12 +430,11 @@
     {
     if( aEvent == EContentNotAvailable )
         {
-        DefaultStatusL();
-        return;
+		ShowDefaultContentL();
         }
-    
-    if( iLink && iLink->IsSame( aLink ) )
+    else if( iLink && iLink->IsSame( aLink ) )
         {
+        iState = EStateStatusContent;
         delete iStatusText;
         iStatusText = NULL;
         
@@ -540,6 +559,7 @@
         iStatusLabel1->SetTextL( label1 );
         iStatusLabel2->SetTextL( label2 );
         CleanupStack::PopAndDestroy( 2, statusTxtBuffer ); // txtArray
+        iStatusImage->MakeVisible( ETrue );
         DrawDeferred();
         }
     return txtCount;
@@ -567,37 +587,30 @@
     }
 
 // ---------------------------------------------------------------------------
-// CCCAppStatusControl::DefaultStatusL
+// CCCAppStatusControl::ShowDefaultContentL
 // ---------------------------------------------------------------------------
 //
-void CCCAppStatusControl::DefaultStatusL()
+void CCCAppStatusControl::ShowDefaultContentL()
 	{
-	if( iDefaultResource != KErrNotFound )
+    iState = EStateDefaultContent;
+    
+	if( iDefaultIcon && ( iDefaultIcon->Bitmap() != iStatusImage->Bitmap() ) )
 		{
-		delete iStatusText;
-		iStatusText = NULL;
-		iStatusText = StringLoader::LoadL( iDefaultResource );
-        
-		const TInt count( RewrapStatusTextL() );
-        TInt option( 1 );
-        if( count > 1 )
-            {
-            option = 0;
-            }
-        SetVariableLayouts( option );
+        ReSizeIcon( iDefaultIcon, iStatusIconSize );
+        iStatusImage->SetPicture( iDefaultIcon->Bitmap(), iDefaultIcon->Mask() );
+        iStatusImage->DrawDeferred();
 		}
 	
-	if( iDefaultIcon )
+	if( iDefaultStatusText )
 		{
-        delete iStatusIcon;
-        iStatusIcon = NULL;
-        iStatusIcon = CGulIcon::NewL( iDefaultIcon->Bitmap(), iDefaultIcon->Mask() );
-        iStatusIcon->SetBitmapsOwnedExternally( ETrue ); // iDefaultIcon owns bitmaps
-        ReSizeIcon( iStatusIcon, iStatusIconSize );
-
-        iStatusImage->SetPicture( iDefaultIcon->Bitmap(), iDefaultIcon->Mask() );
-        iStatusImage->MakeVisible( ETrue );
-        DrawDeferred();
+        if( !iStatusText || iDefaultStatusText->CompareC( *iStatusText ) != 0 )
+            {
+            // update text
+            HBufC* txt = iDefaultStatusText->AllocL();
+            delete iStatusText;
+            iStatusText = txt;
+            RewrapStatusTextL();
+            }
 		}
 	}
 
--- a/phonebookui/Phonebook2/group/Pbk2Presentation.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/group/Pbk2Presentation.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -138,6 +138,7 @@
 
 // Dependencies to S60 components
 LIBRARY FeatMgr.lib
+LIBRARY avkon.lib eikcdlg.lib eikctl.lib CommonEngine.lib AknIcon.lib
 
 // Dependencies to Phonebook
 LIBRARY VPbkEng.lib
--- a/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/group/Pbk2UIControls.mmp	Fri Feb 19 22:40:27 2010 +0200
@@ -222,5 +222,5 @@
 LIBRARY         akntransitionutils.lib
 LIBRARY         aknphysics.lib
 LIBRARY			aknpictograph.lib
-LIBRARY		cone.lib
+
 // End of File
Binary file phonebookui/Phonebook2/help/data/xhtml.zip has changed
--- a/phonebookui/Phonebook2/help/inc/phob.hlp.hrh	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/help/inc/phob.hlp.hrh	Fri Feb 19 22:40:27 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -23,11 +23,7 @@
 #define __PHOB_HLP_HRH__
 
 _LIT(KFDN_HLP_FDN_NUM_EDIT_VIEW, "FDN_HLP_FDN_NUM_EDIT_VIEW"); // 
-_LIT(KFDN_HLP_FDN_NUMBER_VIEW, "FDN_HLP_FDN_NUMBER_VIEW"); // 
-_LIT(KFDN_HLP_FDN_VIEW, "FDN_HLP_FDN_VIEW"); // 
-_LIT(KSDN_HLP_APP, "SDN_HLP_APP"); // 
 _LIT(KHLP_CCA_DETAILS, "HLP_CCA_DETAILS"); // 
-_LIT(KHLP_CCA_EDITOR, "HLP_CCA_EDITOR"); // 
 _LIT(KHLP_CCA_LAUNCHER, "HLP_CCA_LAUNCHER"); // 
 _LIT(KPHOB_HLP_GROUP_LIST, "PHOB_HLP_GROUP_LIST"); // 
 _LIT(KPHOB_HLP_SIM_LIST, "PHOB_HLP_SIM_LIST"); // 
@@ -35,5 +31,14 @@
 _LIT(KPHOB_HLP_GROUP_MEMBER_LIST, "PHOB_HLP_GROUP_MEMBER_LIST"); // 
 _LIT(KPHOB_HLP_SETTINGS, "PHOB_HLP_SETTINGS"); // 
 _LIT(KPHOB_HLP_NAME_LIST, "PHOB_HLP_NAME_LIST"); // 
+_LIT(KHLP_CCA_MY_CARD, "HLP_CCA_MY_CARD"); // 
+_LIT(KRLOOK_HLP_INFO_VIEW, "RLOOK_HLP_INFO_VIEW"); // 
+_LIT(KHLP_CCA_EDITOR, "HLP_CCA_EDITOR"); // 
+_LIT(KPHOB_HLP_CONTACT_INFO_VIEW, "PHOB_HLP_CONTACT_INFO_VIEW"); // 
+_LIT(KPHOB_HLP_EDIT_ENTRY, "PHOB_HLP_EDIT_ENTRY"); // 
+_LIT(KFDN_HLP_FDN_NUMBER_VIEW, "FDN_HLP_FDN_NUMBER_VIEW"); // 
+_LIT(KFDN_HLP_FDN_VIEW, "FDN_HLP_FDN_VIEW"); // 
+_LIT(KSDN_HLP_APP, "SDN_HLP_APP"); // 
+_LIT(KPHOB_HLP_SIM_INFO_VIEW, "PHOB_HLP_SIM_INFO_VIEW"); // 
 
 #endif 
\ No newline at end of file
--- a/phonebookui/Phonebook2/inc/CPbk2ContactViewBuilder.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/CPbk2ContactViewBuilder.h	Fri Feb 19 22:40:27 2010 +0200
@@ -81,6 +81,27 @@
                 TUint32 aFlags ) const;
 
         /**
+         * Creates a contact view for the stores specified in the
+         * given array.
+         *
+         * @param aUriArray         Array of URIs of stores to include
+         *                          in the view.
+         * @param aObserver         Observer for the view.
+         * @param aSortOrder        Sort order for the view.
+         * @param aFilter           Field type selector used to filter the view.
+         * @param aFlags            TVPbkContactViewFlag flags for view modifying
+         * @param aContactSelector  Filter for contacts
+         * @return  The contact view.
+         */
+        IMPORT_C MVPbkContactViewBase* CreateContactViewForStoresLC(
+                const CVPbkContactStoreUriArray& aUriArray,
+                MVPbkContactViewObserver& aObserver,
+                const MVPbkFieldTypeList& aSortOrder,
+                CVPbkFieldTypeSelector* aFilter,
+                TUint32 aFlags,
+                MVPbkContactSelector* aContactSelector ) const;        
+        
+        /**
          * Creates a TOP-NON-TOP contact view for the stores specified in the
          * given array.
          *
@@ -98,7 +119,7 @@
                 const MVPbkFieldTypeList& aSortOrder,
                 CVPbkFieldTypeSelector* aFilter,
                 TUint32 aFlags,
-                MVPbkContactSelector& aContactSelector ) const;
+                MVPbkContactSelector& aContactSelector ) const;        
 
         /**
          * Creates a group view for the stores specified in the
@@ -109,7 +130,7 @@
          * @param aObserver     Observer for the view.
          * @param aSortOrder    Sort order for the view.
          * @param aFilter       Field type selector used to filter the view.
-         * @param aFlags		TVPbkContactViewFlag flags for view modifying
+         * @param aFlags        TVPbkContactViewFlag flags for view modifying
          * @return  The contact view.
          */
         IMPORT_C MVPbkContactViewBase* CreateGroupViewForStoresLC(
@@ -118,7 +139,7 @@
                 const MVPbkFieldTypeList& aSortOrder,
                 CVPbkFieldTypeSelector* aFilter,
                 TUint32 aFlags ) const;
-
+        
     private: // Implementation
         CPbk2ContactViewBuilder(
                 CVPbkContactManager& aContactManager,
@@ -133,7 +154,8 @@
                 const MVPbkFieldTypeList& aSortOrder,
                 CVPbkFieldTypeSelector* aFilter,
                 TUint32 aFlags,
-                TBool aTopContacts = EFalse  ) const;
+                TBool aTopContacts = EFalse,
+                MVPbkContactSelector* aContactSelector = NULL) const;
         static TBool IncludeThisViewInTopContactMode(
                 TPbk2ContactViewType aViewType );
         void SetTopRelatedFilteringL(
--- a/phonebookui/Phonebook2/inc/CPbk2MergePhotoConflictDlg.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/CPbk2MergePhotoConflictDlg.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,17 +24,23 @@
 #include <e32base.h>
 #include <AknDialog.h>
 #include <eiklbo.h>
+#include <MPbk2ImageOperationObservers.h>
 
 // CLASS DECLARATION
 class CEikFormattedCellListBox;
 class CAknNavigationDecorator;
 class CFbsBitmap;
+class CPbk2ImageManager;
+class MPbk2ImageOperation;
+class MVPbkBaseContact;
+class CVPbkContactManager;
 
 /**
  *  CPbk2MergePhotoConflictDlg
  * 
  */
 NONSHARABLE_CLASS( CPbk2MergePhotoConflictDlg ) : public CAknDialog,
+                                                  private MPbk2ImageGetObserver,
                                                   private MEikListBoxObserver
     {
 public: // construction
@@ -42,8 +48,8 @@
     /**
      * Two-phased constructor.
      */
-    IMPORT_C static CPbk2MergePhotoConflictDlg* NewL( CFbsBitmap* aFirstImage,
-                                                      CFbsBitmap* aSecondImage, 
+    IMPORT_C static CPbk2MergePhotoConflictDlg* NewL( MVPbkBaseContact* aFirstContact,
+                                                      MVPbkBaseContact* aSecondContact, 
                                                       TInt* aResult );
     
     /**
@@ -56,8 +62,8 @@
     /**
      * Constructor for performing 1st stage construction
      */
-    CPbk2MergePhotoConflictDlg( CFbsBitmap* aFirstImage,
-                                CFbsBitmap* aSecondImage, 
+    CPbk2MergePhotoConflictDlg( MVPbkBaseContact* aFirstContact,
+                                MVPbkBaseContact* aSecondContact, 
                                 TInt* aResult );
     /**
      * Default constructor for performing 2nd stage construction
@@ -76,6 +82,17 @@
 
     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
     
+    void SizeChanged();
+
+private: //functions from MPbk2ImageGetObserver
+    void Pbk2ImageGetComplete(
+                    MPbk2ImageOperation& aOperation,
+                    CFbsBitmap* aBitmap );
+    
+    void Pbk2ImageGetFailed(
+                    MPbk2ImageOperation& aOperation,
+                    TInt aError );
+    
 private: // new methods
     
     void SetIconsL();
@@ -88,6 +105,12 @@
     
     void SetTitlePaneL( TBool aCustom );
     
+    void InitBitmapAsyncL( MVPbkBaseContact& aContact );
+    
+    void StopWait();
+    
+    void StartWait();
+    
 private: // new methods
     
     /// Not own: Pointer for list control
@@ -102,6 +125,26 @@
     TInt* iSelectedItem;
     /// Own: Selection indicator string
     HBufC* iSelectedString;
+    /// Not own: contact to be merged
+    MVPbkBaseContact* iFirstContact;
+    /// not own: contact to be merged
+    MVPbkBaseContact* iSecondContact;
+    /// Not own: contact manager
+    CVPbkContactManager* iContactManager;
+    /// own: image manager
+    CPbk2ImageManager* iImageManager;
+    /// Own. Image operation for first contact
+    MPbk2ImageOperation* iImageOperationFirst;
+    
+    /// Own. Image operation for first contact
+    MPbk2ImageOperation* iImageOperationSecond;
+    
+    /// Own. size of image to be shown in photo conflict dialog
+    TSize iSize;
+    
+    /// Own: Active scheduler waiter
+    CActiveSchedulerWait* iWait;
+   
     };
 
 #endif // CPBK2MERGEPHOTOCONFLICTDLG_H
--- a/phonebookui/Phonebook2/inc/CPbk2NamesListControl.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/CPbk2NamesListControl.h	Fri Feb 19 22:40:27 2010 +0200
@@ -32,7 +32,6 @@
 #include <aknsfld.h>
 #include <eiklbo.h>
 #include "CPbk2ControlContainer.h"
-#include "CPbk2ThumbnailManager.h"
 
 // FORWARD DECLARATIONS
 class MPbk2NamesListState;
@@ -51,6 +50,10 @@
 class MPbk2ContactUiControlExtension;
 class CPbk2PredictiveSearchFilter;
 class CPbk2ContactViewDoubleListBox;
+class MVPbkContactLinkArray;
+class CPbk2NamesListControlBgTask;
+class CPbk2ThumbnailManager;
+class CPbk2HandleMassUpdate;
 
 // CLASS DECLARATION
 
@@ -90,6 +93,16 @@
             EStateFiltered,
             EStateHidden
             };
+        
+        /// The names list Background Events
+        enum TPbk2NamesListBgEvents
+            {
+            /// Startup state
+            EStateBgTaskEmpty = 0,
+            /// Mark & Unmark States
+            EStateSaveMarkedContacts,
+            EStateRestoreMarkedContacts            
+            };
 
     public: // Constructors and destructor
 
@@ -219,6 +232,14 @@
          * @return  Current view.
          */
         MVPbkContactViewBase& View();
+        
+        /**
+         * Foreground event handling function. 
+         * @param aForeground - Indicates the required focus state of the control.
+         * Needs to be called when there is a Foreground Event trigerred for the View.
+         */
+        
+        IMPORT_C void HandleViewForegroundEventL( TBool aForeground );
 
     
         
@@ -398,6 +419,13 @@
 
     private: //from MPbk2ControlContainerForegroundEventObserver
         void HandleForegroundEventL( TBool aForeground );
+    
+    public: //For Storing/Restoring/Clearing the Marked Contacts
+        void StoreMarkedContactsAndResetViewL();
+        void RestoreMarkedContactsL();
+        void ClearMarkedContactsInfo();
+        
+        
         
     private: // Data
         /// Ref: Current state
@@ -449,11 +477,21 @@
         //Flag to indicate Feature manager initilization
         TBool iFeatureManagerInitilized;
         
-        //REF: Thumbnail manager	//TODO
+        // Own/Ref (see below): Thumbnail manager
         CPbk2ThumbnailManager* iThumbManager;
+        // Wheter this control owns the thumbnail manager (iThumbManager) or not 
+        TBool iOwnThumbManager;
         //OWN: double list box "handle"
         CPbk2ContactViewDoubleListBox* 	iDoubleListBox;
         
+        //Own: Selected/Marked Contacts
+        MVPbkContactLinkArray* iSelectedLinkArray;      
+           
+        //Own: Background Task Handler     
+        CPbk2NamesListControlBgTask* iBgTask;
+        //Own: Mass update checker/handler
+        CPbk2HandleMassUpdate* iCheckMassUpdate;
+        
     };
 
 #endif // CPBK2NAMESLISTCONTROL_H
--- a/phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/CPbk2ThumbnailManager.h	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,7 @@
 #include <MPbk2ImageOperationObservers.h>
 #include <MVPbkContactViewObserver.h>
 #include <TPbk2IconId.h>
-
+#include "MPbk2FilteredViewStack.h"
 
 //FORWARD declaration
 class CPbk2ImageManager;
@@ -85,7 +85,8 @@
 NONSHARABLE_CLASS( CPbk2ThumbnailManager ) : public CBase,
 											 public MVPbkSingleContactOperationObserver,
 											 public MPbk2ImageGetObserver,
-											 public MVPbkContactViewObserver
+											 public MVPbkContactViewObserver,
+											 public MPbk2FilteredViewStackObserver
 	{
 public:	// constructor & destructor
 	
@@ -110,7 +111,7 @@
 	 * Returns icon index from Pbk2IconArray for double listbox index. 
 	 * If icon is not set, default icon index is returned
 	 */
-	TInt GetPbkIconIndex( TInt aListboxIndex, const MVPbkBaseContact& aContactLink );
+	TInt GetPbkIconIndexL( TInt aListboxIndex, const MVPbkBaseContact& aContactLink );
 	
 	/*
 	 * Setter for default icon ID
@@ -136,20 +137,7 @@
 	 * Returns number of loaded thumbnails
 	 */
 	TInt ThumbnailCount();	
-	
-	/*
-	 * Adds contact to the array and starts loading the thumbnail for it. 
-	 * If loading is already in progress, contact is added to queue. 
-	 * 
-	 */
-	void LoadThumbnailL(  const MVPbkContactLink& aContactLink, TInt aListboxIndex  );
 
-	/*
-	 * Removes contact from loader's array and deletes the thumbnail. 
-	 * Returns KErrNone or KErrNotFound.
-	 */
-	TInt RemoveThumbnail( const MVPbkContactLink& aContactLink, TInt aListboxIndex  );
-	
 	/**
 	 * Reset thumbnail manager. Clear cache and cancel all ongoing operations.
 	 */
@@ -165,17 +153,24 @@
 	 */
 	const TSize& GetThumbnailIconSize();
 	
+	/**
+	 * Set view for thumbnail manager. Thumbnail manager will start observing the 
+	 * view and update it's internal state accordingly. Remove view by setting it
+	 * to NULL.
+	 */
+	void SetContactViewL( MPbk2FilteredViewStack* aView );
+	
 private:	// new functions
 	
+    /**
+     * Removes contact from loader's array and deletes the thumbnail. 
+     */
+    void RemoveThumbnail( const MVPbkContactLink& aContactLink, TInt aListboxIndex  );
+	
 	/*
-	 * If contact is added to  middle of the list, increase indexes that are added after the given index
+	 * reset listbox indexes to match the array order
 	 */
-	void IncreaseIndexes( TInt aListboxIndex );
-	
-	/*
-	 * If contact is removed from middle of the list, decrease indexes that are added after the given index
-	 */
-	void DecreaseIndexes( TInt aListboxIndex );
+	void ResetIndexes();
 	
 	/*
 	 * Removes allready loaded thumbnail from the last position of the priorization array. 
@@ -184,10 +179,6 @@
 	void MakeRoomForNextThumbnail();
 	
 	/*
-	 * Finds correct item from the iContactThumbnails based on the base contact
-	 */
-	CPbk2TmItem* FindItem( const MVPbkBaseContact& aContactLink );
-	/*
 	 * Starts loading of the contact thumbnails. 
 	 */
 	void StartLoading();
@@ -222,6 +213,11 @@
 	 */
 	void DoContactViewReadyL( MVPbkContactViewBase& aView );
 
+	/**
+	 * Create empty thumbnail item array reflecting the aView. 
+	 */
+	void PreCreateThumbnailArrayL( MVPbkContactViewBase& aView );
+
 private: // From MVPbkSingleContactOperationObserver
    void VPbkSingleContactOperationComplete(
 		   MVPbkContactOperationBase& aOperation,
@@ -255,7 +251,17 @@
         TInt aError, 
         TBool aErrorNotified );
 
-	
+private: // From MPbk2FilteredViewStackObserver
+    void TopViewChangedL( MVPbkContactViewBase& aOldView );
+    void TopViewUpdatedL();
+    void BaseViewChangedL();
+    void ViewStackError( TInt aError );
+    void ContactAddedToBaseView( 
+        MVPbkContactViewBase& aBaseView,
+        TInt aIndex,
+        const MVPbkContactLink& aContactLink );
+
+
 private:	//constructors
 	CPbk2ThumbnailManager( CVPbkContactManager& aContactManager );
 	void ConstructL();
@@ -308,6 +314,8 @@
 	/// Own: Holds the item whose thumbnail load is in progress
 	/// This item needs to be removed when its safe
 	CPbk2TmItem*                    iInProgressItemToBeRemoved;
+	/// Not own. Filtered view of contacts.
+	MPbk2FilteredViewStack*         iView;
 	};
 
 #endif /* CPBK2THUMBNAILMANAGER_H_ */
--- a/phonebookui/Phonebook2/inc/Pbk2PresentationUtils.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/Pbk2PresentationUtils.h	Fri Feb 19 22:40:27 2010 +0200
@@ -21,6 +21,8 @@
 
 #include <e32std.h>
 
+class CFbsBitmap;
+
 /**
  * Util class with static text formatting functions
  */
@@ -119,6 +121,30 @@
         Pbk2PresentationUtils();
     };
 
+class Pbk2PresentationImageUtils
+    {
+public:
+    enum TCroppingMode
+        {
+        /// Landscape image is cropped to square, target size is not used
+        ELandscapeCropping                  = 0x0,
+        /**
+         * Landscape image is cropped to square and optimized to target size.
+         * Cropped bitmap minimum width is aTargetSize width. 
+         */
+        ELandscapeOptimizedCropping
+        };
+    
+    IMPORT_C static void CropImageL( 
+            CFbsBitmap& aBitmap, 
+            TCroppingMode aCroppingMode, 
+            const TSize& aTargetSize );
+    
+private: // Disabled functions
+    Pbk2PresentationImageUtils();
+    };
+
+
 #endif // PBK2PRESENTATIONUTILS_H
 
 // End of File
--- a/phonebookui/Phonebook2/inc/spbcontentprovider.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/inc/spbcontentprovider.h	Fri Feb 19 22:40:27 2010 +0200
@@ -104,7 +104,11 @@
         ETypeSocialStatus,
         
         /// Content is contact's phone number (text)
-        ETypePhoneNumber
+        ETypePhoneNumber,
+        
+        /// Content is contact's phone number count (text [only number])
+        /// This type is used when contact has multiple numbers and no default number
+        ETypePhoneNumberMultiple
         };
     
 public: // Construction & destruction
--- a/phonebookui/Phonebook2/loc/phonebook2.loc	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/loc/phonebook2.loc	Fri Feb 19 22:40:27 2010 +0200
@@ -517,17 +517,17 @@
 //d:Phonebook info popup's contact count text
 //l:list_single_heading_pane_t1_cp2
 //
-#define qtn_phob_pb_info_names                  "contacts"
+#define qtn_phob_pb_info_names                  "Contacts:"
 
 //d:Phonebook info popup's used memory text
 //l:list_single_heading_pane_t1_cp2
 //
-#define qtn_phob_pb_info_reserved               "used"
+#define qtn_phob_pb_info_reserved               "Used:"
 
 //d:Phonebook info popup's free memory text
 //l:list_single_heading_pane_t1_cp2
 //
-#define qtn_phob_pb_info_free                   "free"
+#define qtn_phob_pb_info_free                   "Free:"
 
 //d:Wait note text for deleting phonebook entries
 //l:popup_note_wait_window
@@ -1655,7 +1655,7 @@
 //w:
 //r:3.1
 //
-#define qtn_phob_pb_info_all                "All"
+#define qtn_phob_pb_info_all                "All contacts:"
 
 //d:List query pop-up item one "group"
 //l:list_single_heading_pane_t1_cp2
@@ -1669,7 +1669,7 @@
 //w:
 //r:3.1
 //
-#define qtn_phob_pb_info_groups             "groups"
+#define qtn_phob_pb_info_groups             "Groups:"
 
 //d:Prompt text for memory query pop-up when copying one contact
 //l:heading_pane_t1
@@ -1845,14 +1845,25 @@
 //w:
 //r:3.2
 //
-#define qtn_phob_pb_info_memory_phone          "Phone"
-
+#define qtn_phob_pb_info_memory_phone          "Phone mem."
+//d:Phonebook info pop-up item "Phone:"
+//l:list_single_heading_pane_t1_cp2/opt1
+//w:
+//r:3.2
+//
+#define qtn_phob_pb_info_memory_phone_colon    "Phone mem.:"
 //d:Phonebook info pop-up item "SIM"
 //l:list_single_heading_pane_t1_cp2
 //w:
 //r:3.2
 //
-#define qtn_phob_pb_info_memory_sim          "SIM"
+#define qtn_phob_pb_info_memory_sim          "SIM memory"
+//d:Phonebook info pop-up item "SIM:"
+//l:list_single_heading_pane_t1_cp2
+//w:
+//r:3.2
+//
+#define qtn_phob_pb_info_memory_sim_colon    "SIM memory:"
 
 /////////////////////////////////////////////////////////////////////////////
 // Localisation strings from Service dialling numbers
--- a/phonebookui/Phonebook2/loc/phonebook2ece.loc	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/loc/phonebook2ece.loc	Fri Feb 19 22:40:27 2010 +0200
@@ -237,7 +237,7 @@
 // l:list_single_large_graphic_pane_t1
 // r:5.0
 //
-#define qtn_cca_call "Call"
+#define qtn_cca_call "Voice call"
 
 // d:Text for the VoIP call communication method.
 // l:list_single_large_graphic_pane_t1
@@ -938,4 +938,35 @@
 //
 #define qtn_phob_opt_entry_select_promotion "Select"
 
+//d:Phonebook names list's C-Column text (2nd line). Shown if contact has multiple
+//d:numbers from Call method group and no default for Call.
+//l:list_double_large_graphic_phob2_pane_t2
+//r:9.2
+//
+#define qtn_phob_n_numbers "%N numbers"
+
+//d:My Card item's text on names list.
+//l:list_double_large_graphic_phob2_pane_t1
+//r:9.2
+//
+#define qtn_contacts_mc_my_card "My Card"
+
+//d:My Card promotion item's text. Shown when My Card is not created.
+//l:list_double_large_graphic_phob2_pane_t1
+//r:9.2
+//
+#define qtn_contacts_mc_set_up_my_card "Create My Card"
+
+//d:Confirmation query shown to user when deleting My Card.
+//l:popup_note_window
+//r:9.2
+//
+#define qtn_phob_my_card_clear_confirm "Delete all data stored in My Card?"
+
+//d: Options list text for deleting My Card and all it's details
+//l: list_single_pane_t1_cp2
+//r:9.2
+//
+#define qtn_phob_my_card_clear "Clear My Card data"
+
 // End of File
--- a/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/callplugin/src/cfsccallpluginimpl.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/remotecontactlookup/contactactionservice/callplugin/src/cfsccallpluginimpl.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -34,7 +34,7 @@
 #include <AiwCommon.hrh>
 #include <MVPbkStoreContact.h>
 #include <aiwdialdata.h>
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include <centralrepository.h>
 #include <e32debug.h>
 
--- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactstorelistener.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactstorelistener.h	Fri Feb 19 22:40:27 2010 +0200
@@ -58,7 +58,13 @@
 	/*
 	 * Returns content corresponding to the link
 	 */
-	CSpbContent* ContentByLinkL( const MVPbkContactLink& aLink );
+	CSpbContent* ContentByLink( const MVPbkContactLink& aLink );
+    
+	/**
+	 * Delete content from cache corresponding to the link
+	 * @param aLink contact link to be matched with cache
+	 */
+	void DeleteContentByLink( const MVPbkContactLink& aLink );
 	
 private:    // constructors
     inline CSpbContactStoreListener(
--- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontent.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontent.h	Fri Feb 19 22:40:27 2010 +0200
@@ -63,11 +63,12 @@
             const TDesC8& aBrandId,
             const TDesC8& aIconEntry );
     void PhoneNumberUpdatedL(
-            const TDesC& aPhoneNumber );
+            const TDesC& aPhoneNumber,
+            CSpbContentProvider::TSpbContentType aType );
     /*
 	 * Function reloads the phonenumber, if there is no status text provided
 	 */
-    void RefreshNumber();
+    void RefreshNumberL();
     
 private:
     inline CSpbContent(
@@ -75,9 +76,9 @@
     inline void ConstructL(
             const MVPbkContactLink& aLink);
 private:
-    static TInt StartFetchContent( 
+    static TInt StartFetchContentL( 
             TAny* aPtr );
-    void DoStartFetchContent();
+    void DoStartFetchContentL();
     void NotifyObservers(
             MSpbContentProviderObserver::TSpbContentEvent aEvent);
     
--- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbphonenumberparser.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbphonenumberparser.h	Fri Feb 19 22:40:27 2010 +0200
@@ -43,7 +43,7 @@
     ~CSpbPhoneNumberParser();
 
 public: // Interface
-    void FetchPhoneNumber( const MVPbkContactLink& aLink);
+    void FetchPhoneNumberL( const MVPbkContactLink& aLink);
     
 private:    // from MVPbkSingleContactOperationObserver
     void VPbkSingleContactOperationComplete(
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactstorelistener.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactstorelistener.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -99,19 +99,23 @@
 	/// contact has changed, check if the number needs to be reloaded
 	if( aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactChanged )
 		{
-		CSpbContent* content = ContentByLinkL( *aStoreEvent.iContactLink );
+		CSpbContent* content = ContentByLink( *aStoreEvent.iContactLink );
 		if( content )
 			{
-			content->RefreshNumber();
+			content->RefreshNumberL();
 			}
 		}
+	else if( aStoreEvent.iEventType == TVPbkContactStoreEvent::EContactDeleted )
+	    {
+        DeleteContentByLink( *aStoreEvent.iContactLink );
+	    }
 	}
 
 // ----------------------------------------------------------------------------
-// CSpbContactStoreListener::ContentByLinkL
+// CSpbContactStoreListener::ContentByLink
 // ----------------------------------------------------------------------------
 //
-CSpbContent* CSpbContactStoreListener::ContentByLinkL( 
+CSpbContent* CSpbContactStoreListener::ContentByLink( 
     const MVPbkContactLink& aLink )
     {
     const TInt count( iContentCache.Count() );
@@ -126,3 +130,24 @@
     return NULL;
     }
 
+// ----------------------------------------------------------------------------
+// CSpbContactStoreListener::DeleteContentByLink
+// ----------------------------------------------------------------------------
+//
+void CSpbContactStoreListener::DeleteContentByLink( 
+    const MVPbkContactLink& aLink )
+    {
+    const TInt count = iContentCache.Count();
+    for( TInt i = 0 ; i < count ; ++i )
+        {
+        CSpbContent* content = iContentCache[i];
+        if( content->Match( aLink ) )
+            {
+            delete content;
+            iContentCache.Remove( i );
+            break; // only one content for each contact
+            }
+        }
+    }
+
+// End of file
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontent.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontent.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -80,7 +80,7 @@
 inline CSpbContent::CSpbContent(
     const CSpbContent::TParameters& aParameters ) :
     iParameters(aParameters),
-    iAsyncCallBack( TCallBack( CSpbContent::StartFetchContent, this ), 
+    iAsyncCallBack( TCallBack( CSpbContent::StartFetchContentL, this ), 
         CActive::EPriorityStandard ),
     iType( CSpbContentProvider::ETypeNone )
     {
@@ -90,13 +90,13 @@
 // CSpbContent::RefreshNumber
 // ----------------------------------------------------------------------------
 //
-void CSpbContent::RefreshNumber()
+void CSpbContent::RefreshNumberL()
 	{
 	// if no status text
 	if( iType != CSpbContentProvider::ETypeSocialStatus && iPhoneNumberParser )
 		{
 		// re-fetch phonenumber
-		iPhoneNumberParser->FetchPhoneNumber( Link() );
+		iPhoneNumberParser->FetchPhoneNumberL( Link() );
 		}
 	}
 
@@ -104,9 +104,9 @@
 // CSpbContent::StartFetchContent
 // ----------------------------------------------------------------------------
 //
-TInt CSpbContent::StartFetchContent( TAny* aPtr )
+TInt CSpbContent::StartFetchContentL( TAny* aPtr )
     {
-    static_cast<CSpbContent*>(aPtr)->DoStartFetchContent();
+    static_cast<CSpbContent*>(aPtr)->DoStartFetchContentL();
     return 0;
     }
 
@@ -114,17 +114,22 @@
 // CSpbContent::PhoneNumberUpdatedL
 // ----------------------------------------------------------------------------
 //
-void CSpbContent::DoStartFetchContent()
+void CSpbContent::DoStartFetchContentL()
     {
-    if(iParameters.iStatusProvider)
+    TBool fetching = EFalse;
+    if( iParameters.iStatusProvider )
         {
-        iParameters.iStatusProvider->FetchStatusDataL(*this);
+        TRAPD( err, iParameters.iStatusProvider->FetchStatusDataL(*this) );
+        fetching = ( err == KErrNone );
         }
-    else if(iPhoneNumberParser)
+    
+    if( !fetching && iPhoneNumberParser)
         {
-        iPhoneNumberParser->FetchPhoneNumber(Link());
+        iPhoneNumberParser->FetchPhoneNumberL(Link());
+        fetching = ETrue;
         }
-    else
+
+    if( !fetching )
         {
         NotifyObservers( MSpbContentProviderObserver::EContentNotAvailable );
         }
@@ -134,7 +139,8 @@
 // CSpbContent::PhoneNumberUpdatedL
 // ----------------------------------------------------------------------------
 //
-void CSpbContent::PhoneNumberUpdatedL( const TDesC& aPhoneNumber )
+void CSpbContent::PhoneNumberUpdatedL( const TDesC& aPhoneNumber, 
+    CSpbContentProvider::TSpbContentType aType )
     {
     delete iText;
     iText = NULL;
@@ -145,7 +151,7 @@
         {
         iText = aPhoneNumber.AllocL();
         iReady = ETrue;
-        iType = CSpbContentProvider::ETypePhoneNumber;
+        iType = aType;
         }
     NotifyObservers(MSpbContentProviderObserver::EContentChanged);
     }
@@ -161,7 +167,7 @@
     {
     if(!aStatusMessage.Length() && iPhoneNumberParser )
         {
-        iPhoneNumberParser->FetchPhoneNumber(Link());
+        iPhoneNumberParser->FetchPhoneNumberL(Link());
         return;
         }
     
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -86,11 +86,7 @@
     {
     delete iOperation;
     iOperation = NULL;
-    TRAPD( err, SolvePhoneNumberL( *aContact ) );
-	if( err )
-		{
-		//TODO error handling
-		}
+    TRAP_IGNORE( SolvePhoneNumberL( *aContact ) );
 	delete aContact;
     }
 
@@ -104,7 +100,8 @@
     {
     delete iOperation;
     iOperation = NULL;
-    iContent.PhoneNumberUpdatedL(KNullDesC());
+    TRAP_IGNORE( iContent.PhoneNumberUpdatedL( 
+            KNullDesC, CSpbContentProvider::ETypePhoneNumber ) );
     }
 
 // ---------------------------------------------------------------------------
@@ -159,7 +156,8 @@
 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERWORK ||
 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_LANDPHONEGEN    ||
 						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN  ||
-						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERGEN )
+						fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_VIDEONUMBERGEN  ||
+                        fieldType->FieldTypeResId() == R_VPBK_FIELD_TYPE_CARPHONE )
 						{
 						numberCount++;
 						// if only one number, store it
@@ -173,28 +171,29 @@
 					}
 				}
 			}
-		// if several numbers
-		if( numberCount > 1 )
-			{
-			// empty
-			number.Copy( KNullDesC );
-			// this is for future use.
-			// load localization text for multiple numbers
-			// number = StringLoader::LoadLC( QTN_PHOB_N_NUMBERS,
-			//							   numberCount,
-			//							   CCoeEnv::Static() );
-			}
 		}
+	
 	// no number was found
 	if( number.Length() == 0 )
 		{
-		iContent.PhoneNumberUpdatedL( KNullDesC() );
+        iContent.PhoneNumberUpdatedL( KNullDesC, 
+            CSpbContentProvider::ETypePhoneNumber );
 		}
-	else
-		{
-		// inform the observer
-		iContent.PhoneNumberUpdatedL( number );
-		}
+	else if( numberCount > 1 )
+	    {
+        // contact has multiple numbers and no default
+        TBuf<12> count;
+        count.Num( numberCount );
+        iContent.PhoneNumberUpdatedL( 
+            count, CSpbContentProvider::ETypePhoneNumberMultiple );
+	    }
+    else
+        {
+        // inform the observer
+        iContent.PhoneNumberUpdatedL( 
+            number, CSpbContentProvider::ETypePhoneNumber );
+        }
+
 	number.Close();
 	}
 
@@ -202,7 +201,7 @@
 // CSpbPhoneNumberParser::FetchPhoneNumber
 // ---------------------------------------------------------------------------
 //
-void CSpbPhoneNumberParser::FetchPhoneNumber(
+void CSpbPhoneNumberParser::FetchPhoneNumberL(
             const MVPbkContactLink& aLink)
     {
     delete iOperation;
--- a/phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbserviceiconprovider.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -20,8 +20,8 @@
 #include <cbsfactory.h>
 #include <mbsaccess.h>
 #include <gulicon.h>
-#include <tpbk2iconid.h>
-#include <akniconutils.h>
+#include <TPbk2IconId.h>
+#include <AknIconUtils.h>
 #include <fbs.h>
 
 // CONSTS
--- a/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -33,7 +33,7 @@
 #include <ErrorUI.h>
 #include <vmnumber.h>
 #include <centralrepository.h>
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include <SpeeddialPrivateCRKeys.h>
 #include <telvmbxsettingscrkeys.h>
 #include <voicemailboxdomaincrkeys.h>
@@ -44,7 +44,7 @@
 #include <CPbkContactChangeNotifier.h>
 #include <RPbkViewResourceFile.h>  // Phonebook view dll resource file loader
 #include <StringLoader.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 #include <spdctrl.mbg>
 #include <avkon.mbg>
 #include <gdi.h>
@@ -67,7 +67,7 @@
 #include "SpdiaControl.hrh"
 #include "Speeddial.laf"
 #include "SpdiaPanic.h"
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include "speeddial.hrh"
 
 #include <aknViewAppUi.h>
--- a/phonebookui/Speeddial/ControlSrc/SpdiaGrid.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/ControlSrc/SpdiaGrid.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -31,7 +31,7 @@
 #include <layoutmetadata.cdl.h>
 #include <akntitle.h>
 #include <StringLoader.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 const TInt KItemPrimary(3);
 const TInt KItemSecondary(3);
 
--- a/phonebookui/Speeddial/ControlSrc/SpdiaGridDlg.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/ControlSrc/SpdiaGridDlg.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -44,7 +44,7 @@
 #include <CPbkContactEngine.h>      // phonebook engine
 #include <aknlayoutscalable_apps.cdl.h>
 #include <layoutmetadata.cdl.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 #include "SpdiaControl.hrh"
 #include "SpdiaControl.h"
 #include "SpdiaGridDlg.h"
--- a/phonebookui/Speeddial/VPbkControlSrc/SpdiaGridDlgVPbk.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/VPbkControlSrc/SpdiaGridDlgVPbk.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -40,7 +40,7 @@
 
 #include <aknlayoutscalable_apps.cdl.h>
 #include <layoutmetadata.cdl.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 #include "SpdiaControl.hrh"
 #include "speeddialprivate.h"
 #include "SpdiaGridDlgVPbk.h"
--- a/phonebookui/Speeddial/VPbkControlSrc/SpdiaGridVPbk.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/VPbkControlSrc/SpdiaGridVPbk.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -31,7 +31,7 @@
 #include <layoutmetadata.cdl.h>
 #include <akntitle.h>
 #include <StringLoader.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 const TInt KItemPrimary(3);
 const TInt KItemSecondary(3);
 
--- a/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -39,12 +39,12 @@
 #include <ErrorUI.h>
 #include <vmnumber.h>
 #include <centralrepository.h>
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include <SpeeddialPrivateCRKeys.h>
 
 
 #include <StringLoader.h>
-#include <Spdctrl.rsg>
+#include <SpdCtrl.rsg>
 #include <spdctrl.mbg>
 #include <avkon.mbg>
 #include <gdi.h>
--- a/phonebookui/Speeddial/speeddialgsplugin/inc/speeddialgsplugin.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/speeddialgsplugin/inc/speeddialgsplugin.h	Fri Feb 19 22:40:27 2010 +0200
@@ -26,8 +26,8 @@
 #include <aknview.h>
 #include <eikclb.h>
 #include <gsparentplugin.h>
-#include <GSFWViewUIDs.h>
-#include <GSPluginInterface.h>
+#include <gsfwviewuids.h>
+#include <gsplugininterface.h>
 #include <AknServerApp.h> 
 // Classes referenced
 class CAknViewAppUi;
--- a/phonebookui/Speeddial/speeddialgsplugin/src/speeddialgsplugin.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/speeddialgsplugin/src/speeddialgsplugin.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -29,7 +29,7 @@
 
 // Includes from GS framework:
 #include <gsfwviewuids.h>
-#include <GSPrivatePluginProviderIds.h>
+#include <gsprivatepluginproviderids.h>
 
 #include <AknNullService.h>
 // Plugin includes:
--- a/phonebookui/Speeddial/src/SpdiaCallingVmbxView.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/src/SpdiaCallingVmbxView.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -46,7 +46,7 @@
 #include "SpdiaCallingVmbxContainer.h"
 
 #include <featmgr.h>
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include <centralrepository.h>
 
 //_LIT8( KSpdiaCustomMesg, "outside" );
--- a/phonebookui/Speeddial/src/SpdiaView.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/phonebookui/Speeddial/src/SpdiaView.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -48,15 +48,15 @@
 #include <MVPbkContactLink.h>
 #include <telvmbxsettingscrkeys.h>
 
-#include <SettingsInternalCRKeys.h>
+#include <settingsinternalcrkeys.h>
 #include <SpeeddialPrivateCRKeys.h>
-#include "Spdctrl.rsg"
+#include "SpdCtrl.rsg"
 
 
 #include <CMessageData.h>
 #include <txtrich.h>
 #include <SendUiConsts.h>
-#include <sendnorm.rsg>
+#include <Sendnorm.rsg>
 #include <MVPbkContactFieldTextData.h>
 
 // ================= MEMBER FUNCTIONS =======================
Binary file pimprotocols/mtpcontactdp/documentation/PREQ1260ComponentDesign-all.eap has changed
--- a/pimprotocols/phonebooksync/Test/TE_Sync/TE_Sync_Config.txt	Tue Feb 02 10:12:17 2010 +0200
+++ b/pimprotocols/phonebooksync/Test/TE_Sync/TE_Sync_Config.txt	Fri Feb 19 22:40:27 2010 +0200
@@ -1,7 +1,7 @@
 # Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
 # All rights reserved.
 # This component and the accompanying materials are made available
-# under the terms of "Eclipse Public License v1.0"
+# under the terms of the License "Eclipse Public License v1.0"
 # which accompanies this distribution, and is available
 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
 #
--- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h	Fri Feb 19 22:40:27 2010 +0200
@@ -46,6 +46,30 @@
 										       RPointerArray<CPsData>& SearchResults);
 
 		/**
+		 * Compare by length.
+		 */
+		static TBool CompareByLength(const HBufC& aFirst, const HBufC& aSecond);
+
+		/**
+		 * Compare strings exactly case sensitively.
+		 */
+		static TBool CompareExact(const TDesC& aFirst, const TDesC& aSecond);
+
+		/**
+		 * Compare strings with collate rules depending on locale.
+		 */
+		static TBool CompareCollate(const TDesC& aFirst, const TDesC& aSecond);
+
+		/**
+		 * Compare for keys and strings:
+		 * - Case sensitive compare for keys,
+		 * - Case insensitive and language dependent compare for Contact Data and Query.
+		 */
+		static TBool MyCompareKeyAndString(const TDesC& aContactString,
+		                                   const TDesC& aQueryAsString,
+		                                   CPsQuery& aPsQuery);
+
+		/**
          * Case Sensitive compare for keys
          */
 		static TBool MyCompareK(const TDesC& aLeft, const TDesC& aRight, CPsQuery& aPsQuery);
@@ -54,24 +78,24 @@
          * Customized CompareC         
          */					
         static TInt MyCompareC(const TDesC& aLeft, const TDesC& aRight); 					       
-			  
+		
         
         /**
          * TLinearOrder rule for comparison of data objects
          */
-        static TInt CompareDataBySortOrderL(const CPsData& aObject1, 
+        static TInt CompareDataBySortOrderL(const CPsData& aObject1,
                                            const CPsData& aObject2);
 
         /**
          * Trim off all white spaces and special chars
          */                                   
-        static void MyTrim(TDes& aString);                                           
+        static void MyTrim(TDes& aString);
         
         
         /**
          * Check if the input URI is of contact search in a group template form
          */                                   
-        static TBool IsGroupUri(TDesC& aURI);                                        
+        static TBool IsGroupUri(TDesC& aURI);
                                     
 };
 #endif // C_PCS_ALGORITHM_1_UTILS
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1FilterHelper.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -24,7 +24,6 @@
 TBool ComparePsPattern ( const TPsPatternDetails& aFirst, const TPsPatternDetails& aSecond )
 {
 	return (CPcsAlgorithm1Utils::MyCompareC(*(aFirst.matchPattern), *(aSecond.matchPattern)));
-	     
 }
 
 // ============================== MEMBER FUNCTIONS ============================
@@ -356,13 +355,13 @@
 // ----------------------------------------------------------------------------
 TInt CPcsAlgorithm1FilterHelper::FindSequence(TDesC* aSeq)
 {
-	TBuf<50> seqBuf;
+	TBuf<KPsQueryMaxLen> seqBuf;
 	seqBuf.Append(*aSeq);
 	
 	TInt j = 0;
 	for( ; j < iMatchPatternDetails.Count(); j++)
 	{
-		TBuf<50> matchPatternBuf;
+		TBuf<KPsQueryMaxLen> matchPatternBuf;
 		matchPatternBuf.Copy((iMatchPatternDetails[j]->matchPattern->Des()));
 		if ( CPcsAlgorithm1Utils::MyCompareC(seqBuf, matchPatternBuf) == 0 )
             break;
@@ -382,13 +381,13 @@
 // ----------------------------------------------------------------------------
 TInt CPcsAlgorithm1FilterHelper::FindSubSequence(TDesC* aSeq,TInt aPatternIndex)
 {
-	TBuf<50> seqBuf;
+	TBuf<KPsQueryMaxLen> seqBuf;
 	seqBuf.Append(*aSeq);
 	
 	TInt j = 0;
 	for( ; j < iMatchPatternDetails[aPatternIndex]->subPatternArray.Count(); j++)
 	{
-		TBuf<50> matchPatternBuf;
+		TBuf<KPsQueryMaxLen> matchPatternBuf;
 		matchPatternBuf.Copy((iMatchPatternDetails[aPatternIndex]->subPatternArray[j]->matchPattern->Des()));
 		if ( CPcsAlgorithm1Utils::MyCompareC(seqBuf, matchPatternBuf) == 0 )
             break;
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Helper.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -31,17 +31,6 @@
 #include "CPsDataPluginInterface.h"
 #include "CPcsPoolElement.h"
 
-// Compare functions
-TBool Compare1 ( const TDesC& aFirst, const TDesC& aSecond )
-{
-    return aFirst == aSecond;
-}
-
-TBool Compare2 ( const TDesC& aFirst, const TDesC& aSecond )
-{
-    return CPcsAlgorithm1Utils::MyCompareC(aFirst, aSecond);
-}
-
 // ============================== MEMBER FUNCTIONS ============================
 
 // ----------------------------------------------------------------------------
@@ -270,12 +259,7 @@
                     TBuf<KPsQueryMaxLen> dataWithKeys;
                     iKeyMap->GetMixedKeyStringForDataL( aPsQuery, token, dataWithKeys );
 
-                    // MyCompareC is case insensitive.
-                    // We have some cases that key "Z" (uppercase) is mapping chars "Zz...."
-                    // and key "z" (lowercase) is mapping chars ".," or "Ää".
-                    // The comparison of "Z" and "z" should fail for the keys, that's why we use MyCompareK.
-                    if ( ( CPcsAlgorithm1Utils::MyCompareK(dataWithKeys, queryAsDes, aPsQuery) ) &&
-                         ( CPcsAlgorithm1Utils::MyCompareC(dataWithKeys.Left(queryAsDes.Length()), queryAsDes) == 0 ) )
+                    if ( CPcsAlgorithm1Utils::MyCompareKeyAndString(dataWithKeys, queryAsDes, aPsQuery) )
                     {
                         psData->SetDataMatch(dataIndex);
                         isAdded = ETrue;
@@ -286,7 +270,7 @@
                         *seq = token.Mid(0, len);
                         seq->Des().UpperCase();
 
-                        TIdentityRelation<TDesC> rule(Compare1);
+                        TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
                         if ( tempMatchSeq.Find(seq, rule) == KErrNotFound )
                         {
                             tempMatchSeq.Append(seq);
@@ -355,17 +339,12 @@
     // Search thru multiple words
     while ( token.Length() != 0 )
     {
-         HBufC* data = HBufC::NewLC(token.Length());
-         TPtr dataPtr(data->Des());
-         iKeyMap->GetMixedKeyStringForDataL( aPsQuery, token, dataPtr );
+        HBufC* data = HBufC::NewLC(token.Length());
+        TPtr dataPtr(data->Des());
+        iKeyMap->GetMixedKeyStringForDataL( aPsQuery, token, dataPtr );
 
-         // MyCompareC is case insensitive.
-         // We have some cases that key "Z" (uppercase) is mapping chars "Zz...."
-         // and key "z" (lowercase) is mapping chars ".," or "Ää".
-         // The comparison of "Z" and "z" should fail for the keys, that's why we use MyCompareK.
-         if ( ( CPcsAlgorithm1Utils::MyCompareK(dataPtr, *queryAsDes, aPsQuery) ) &&
-              ( CPcsAlgorithm1Utils::MyCompareC(dataPtr.Left(queryAsDes->Length()), *queryAsDes) == 0 ) )
-         {
+        if ( CPcsAlgorithm1Utils::MyCompareKeyAndString(dataPtr, *queryAsDes, aPsQuery) )
+        {
             TInt len = queryAsDes->Length();
 
             TPsMatchLocation tempLocation;
@@ -386,7 +365,7 @@
             *seq = token.Mid(0, len);
             seq->Des().UpperCase();
 
-            TIdentityRelation<TDesC> rule(Compare1);
+            TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
             if ( aMatchSet.Find(seq, rule) == KErrNotFound )
             {
                 aMatchSet.Append(seq);
@@ -396,13 +375,13 @@
             {
                 CleanupStack::PopAndDestroy();
             }
-         }
+        }
 
-         // Next word
-         token.Set(lex.NextToken());
-         beg = lex.Offset() - token.Length();  // start index of next word
-         CleanupStack::PopAndDestroy(); //data
-     }
+        // Next word
+        token.Set(lex.NextToken());
+        beg = lex.Offset() - token.Length();  // start index of next word
+        CleanupStack::PopAndDestroy(); //data
+    }
 
     CleanupStack::PopAndDestroy( queryAsDes );
 
@@ -416,7 +395,7 @@
 void  CPcsAlgorithm1Helper::SortSearchSeqsL(RPointerArray<TDesC>& aSearchSeqs)
 {
     // Sort the search seqs
-    TLinearOrder<TDesC> rule( Compare2 );
+    TLinearOrder<TDesC> rule( CPcsAlgorithm1Utils::CompareCollate );
     aSearchSeqs.Sort(rule);
 }
 
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1MultiSearchHelper.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -23,16 +23,6 @@
 #include <collate.h>
 #include <biditext.h>
 
-// Compare functions
-TBool CompareByLength ( const HBufC& aFirst, const HBufC& aSecond )
-{
-   return ( aFirst.Length() > aSecond.Length() );
-}
-
-TBool Compare3 ( const TDesC& aFirst, const TDesC& aSecond )
-{
-	return aFirst == aSecond;     
-}
 // ============================== MEMBER FUNCTIONS ============================
 
 // ----------------------------------------------------------------------------
@@ -226,13 +216,12 @@
     RPointerArray<HBufC> descriptorsQueryList;
     ConvertQueryToListL(aPsQuery, descriptorsQueryList);
     TLex lex(aData);
-    while ( !lex.Eos() )                                    // Search thru all words
+    while ( !lex.Eos() ) // Search thru all words
     {
-        TPtrC currentWord = lex.NextToken();                // next word
+        TPtrC currentWord = lex.NextToken(); // next word
 
         TPsMatchLocation newLocation = { lex.Offset() - currentWord.Length(), //start index
-                                         0,
-                                         TBidiText::TextDirectionality(currentWord) };
+                                         0, TBidiText::TextDirectionality(currentWord) };
 
         for ( TInt queryIndex = 0; queryIndex < aPsQuery.Count(); ++queryIndex )
         {
@@ -242,7 +231,7 @@
             // Convert the data to required form (mode specific)
             iKeyMap->GetMixedKeyStringForDataL(*aPsQuery[queryIndex], currentWord, convertedWord);
 
-            if ( CPcsAlgorithm1Utils::MyCompareC(convertedWord.Left(currentQuery->Length()), *currentQuery) == 0 )                
+            if ( CPcsAlgorithm1Utils::MyCompareKeyAndString(convertedWord, *currentQuery, *aPsQuery[queryIndex]) )
             {
                 newLocation.length = currentQuery->Length();
                 aMatchLocation.AppendL( newLocation );
@@ -259,20 +248,20 @@
 // ----------------------------------------------------------------------------
 void CPcsAlgorithm1MultiSearchHelper::AppendMatchToSeqL( 
         RPointerArray<TDesC>& aMatchSeq, const TDesC& aMatch  )
-    {
+{
     HBufC* seq = aMatch.AllocLC();
     seq->Des().UpperCase();
-    TIdentityRelation<TDesC> rule(Compare3);
+    TIdentityRelation<TDesC> rule(CPcsAlgorithm1Utils::CompareExact);
     if ( aMatchSeq.Find(seq, rule) == KErrNotFound )
-        {
+    {
         aMatchSeq.Append(seq);
         CleanupStack::Pop( seq );
-        }
+    }
     else 
-        {
+    {
         CleanupStack::PopAndDestroy( seq );
-        }
     }
+}
 
 // ----------------------------------------------------------------------------
 // CPcsAlgorithm1MultiSearchHelper::LookupMatchL
@@ -280,7 +269,7 @@
 void CPcsAlgorithm1MultiSearchHelper::LookupMatchL( CPsQuery& aSearchQuery,
         const TDesC& aData,
         TDes& aMatchedData )
-    {
+{
     RPointerArray<CPsQuery> queryList = MultiQueryL(aSearchQuery);
     TBuf<KPsQueryMaxLen> queryAsString = aSearchQuery.QueryAsStringLC();
     TBuf<KPsQueryMaxLen> convertedQuery;
@@ -290,116 +279,117 @@
     RArray<TInt> dataWordLengths;
     TLex lex( aData );
     while ( !lex.Eos() )
-        {
+    {
         TPtrC currentWord = lex.NextToken();
         PRINT2( _L("idx len: %d %d"), lex.Offset() - currentWord.Length(), currentWord.Length() );
         dataWordIndexes.AppendL( lex.Offset() -  currentWord.Length() );
         dataWordLengths.AppendL( currentWord.Length() );
-        }
+    }
 
     RArray<TInt> queryIndexes;
     RArray<TPtrC> convertedQueriesAsDes;
     lex.Assign( queryAsString );
     while ( !lex.Eos() )
-        {
+    {
         TPtrC currentWord = lex.NextToken();
         convertedQueriesAsDes.AppendL( 
                 convertedQuery.Mid( lex.Offset() - currentWord.Length(), currentWord.Length()) );
         queryIndexes.AppendL( lex.Offset() - currentWord.Length() );
-        }
+    }
     
     RPointerArray< RArray<TBool> > possibleMatches;
     for ( TInt i(0); i < queryList.Count(); ++i )
-        {
+    {
         RArray<TBool>* matchesForCurrentQuery = new (ELeave) RArray<TBool>;
         possibleMatches.AppendL( matchesForCurrentQuery );
         CPsQuery* currentQuery = queryList[i];
         for ( TInt j(0); j < dataWordIndexes.Count(); j++ )
-            {
+        {
             TPtrC currentDataWord = aData.Mid( dataWordIndexes[j], dataWordLengths[j] );
             RBuf convertedDataWord;
             convertedDataWord.CreateL( currentDataWord.Length() );
             CleanupClosePushL( convertedDataWord );
+
             iKeyMap->GetMixedKeyStringForDataL( *currentQuery, currentDataWord.Left(currentQuery->Count()), convertedDataWord );
-            if ( CPcsAlgorithm1Utils::MyCompareC( convertedQueriesAsDes[i], convertedDataWord ) == 0 )
-                {
+
+            if ( CPcsAlgorithm1Utils::MyCompareKeyAndString(convertedQueriesAsDes[i], convertedDataWord, *currentQuery) )
+            {
                 matchesForCurrentQuery->AppendL( ETrue );
-                }
+            }
             else
-                {
+            {
                 matchesForCurrentQuery->AppendL( EFalse );
-                }
+            }
             PRINT3( _L("CPcsAlgorithm1MultiSearchHelper::LookupMatchL: possibleMatches[%d][%d]=%d"),i,j, (*(possibleMatches[i]))[j] )
             CleanupStack::PopAndDestroy( &convertedDataWord );
-            }
         }
+    }
     
     const TInt KUnapplied(-1);
     RArray<TInt> appliedMatches;
     appliedMatches.ReserveL( queryList.Count() );
     for ( TInt i(0); i < queryList.Count(); ++i )
-        {
+    {
         appliedMatches.AppendL( KUnapplied );
-        }
+    }
     
     //backtrack algorithm starts here to find fully applied match
     TInt currentQueryIndex(0);
-    while ( currentQueryIndex < queryList.Count()   
-            && currentQueryIndex >= 0 )
-        {
+    while ( currentQueryIndex < queryList.Count() && currentQueryIndex >= 0 )
+    {
         TInt currentDataIndex = appliedMatches[ currentQueryIndex ] + 1;
         appliedMatches[ currentQueryIndex ] = KUnapplied;
         RArray<TBool>& matchesForCurrentQuery = *(possibleMatches[currentQueryIndex]);
         TBool doBacktrack( ETrue );
         while ( currentDataIndex < dataWordIndexes.Count() )
-            {
+        {
             PRINT2(_L("CPcsAlgorithm1MultiSearchHelper::LookupMatchL: matchesForCurrentQuery[%d] = %d"), 
                     currentDataIndex, matchesForCurrentQuery[ currentDataIndex ] );
             
             if ( matchesForCurrentQuery[ currentDataIndex ] 
                      && (appliedMatches.Find( currentDataIndex ) == KErrNotFound) )
-                {
+            {
                 appliedMatches[ currentQueryIndex ] = currentDataIndex;
                 doBacktrack = EFalse;
                 break;
-                }
+            }
             ++currentDataIndex;
-            }
+        }
         if ( doBacktrack )
-            {
+        {
             --currentQueryIndex;            
-            }
+        }
         else
-            {
+        {
             ++currentQueryIndex;
-            }
         }
+    }
     
     if ( currentQueryIndex >= 0 ) //found
-        {
+    {
         aMatchedData = queryAsString;
         for ( TInt i(0); i < appliedMatches.Count(); ++i )
-            {
+        {
             TInt matchedDataIndex = appliedMatches[i];
             TPtr resultFragment = aMatchedData.MidTPtr( 
                 queryIndexes[ i ],
                 convertedQueriesAsDes[i].Length() );
             resultFragment = aData.Mid(
-                    dataWordIndexes[ matchedDataIndex ],
-                    convertedQueriesAsDes[i].Length() );
-            }        
-        }
+                dataWordIndexes[ matchedDataIndex ],
+                convertedQueriesAsDes[i].Length() );
+        }        
+    }
     else
-        {
+    {
         aMatchedData.Zero();
-        }
+    }
     
     for ( TInt i(0); i < possibleMatches.Count(); ++i )
-        {
+    {
         RArray<TBool>* pointerToDelete = possibleMatches[i];
         pointerToDelete->Close();
         delete pointerToDelete;
-        }
+    }
     possibleMatches.Close();
     dataWordIndexes.Close();
     dataWordLengths.Close();
@@ -410,7 +400,7 @@
     appliedMatches.Close();
     
     CleanupStack::PopAndDestroy();  //result of queryAsStringLC
-    }
+}
 
 // ----------------------------------------------------------------------------
 // CPcsAlgorithm1MultiSearchHelper::ConvertQueryToList
@@ -465,7 +455,7 @@
 	}
          
 	// Sort the query items before we search them
-	TLinearOrder<HBufC> rule( CompareByLength );
+	TLinearOrder<HBufC> rule( CPcsAlgorithm1Utils::CompareByLength );
 	queryList.Sort(rule);
 	
     // To hold the match results
@@ -488,52 +478,51 @@
 		// Loop from the last query so that longest match is seen first
 		for ( TInt queryIndex = queryList.Count() - 1; queryIndex >= 0; queryIndex-- )
 		{
-		     TBool queryMatch = EFalse;
-		     HBufC* tmpQuery = queryList[queryIndex];
-		     // Get the original query mode corresponding to this query
-		     TInt modeIndex = tempqueryList.Find(tmpQuery);
-		     
-		     for ( TInt dataIndex = 0; dataIndex < psData->DataElementCount(); dataIndex++ )
-		     {
-		         // Filter off data fields not required in search
-		         TReal bitIndex;
-		         Math::Pow(bitIndex, 2, dataIndex);
+		    TBool queryMatch = EFalse;
+		    HBufC* tmpQuery = queryList[queryIndex];
+		    // Get the original query mode corresponding to this query
+		    TInt modeIndex = tempqueryList.Find(tmpQuery);
+		    
+		    for ( TInt dataIndex = 0; dataIndex < psData->DataElementCount(); dataIndex++ )
+		    {
+		        // Filter off data fields not required in search
+		        TReal bitIndex;
+		        Math::Pow(bitIndex, 2, dataIndex);
 
-                 TUint8 filter = (TUint8)bitIndex & aFilteredDataMatch;     		         
-		         if ( filter == 0x0 )
-		         {
+                TUint8 filter = (TUint8)bitIndex & aFilteredDataMatch;     		         
+		        if ( filter == 0x0 )
+		        {
 		            // Move to next data
-		         	continue;
-		         }
-		       			     
-		         TInt wordIndex = -1;			     
-			     
-			     TLex lex(psData->Data(dataIndex)->Des());
-			     
-			     // First word
-			     TPtrC tmpData = lex.NextToken();
-			     
-			     // Search thru multiple words
-			     while ( tmpData.Length() != 0 ) 
-			     {			      
-			         wordIndex++;			         				  
-			     	 
-			     	 TBuf<KPsQueryMaxLen> data; 
-			     	  
-			         // Convert the data to required form (mode specific)
-				     iKeyMap->GetMixedKeyStringForDataL(*searchQuery[modeIndex], tmpData, data);
-				   
-				     // Compare the data against query
-                     if ( CPcsAlgorithm1Utils::MyCompareC(data.Left(tmpQuery->Length()),
-                                                          *tmpQuery) == 0 )				          
-				     {
+		        	continue;
+		        }
+		       	
+		        TInt wordIndex = -1;			     
+			    
+			    TLex lex(psData->Data(dataIndex)->Des());
+			    
+			    // First word
+			    TPtrC tmpData = lex.NextToken();
+			    
+			    // Search thru multiple words
+			    while ( tmpData.Length() != 0 ) 
+			    {			      
+			        wordIndex++;			         				  
+			     	
+			     	TBuf<KPsQueryMaxLen> data; 
+
+	                // Convert the data to required form (mode specific)
+	                iKeyMap->GetMixedKeyStringForDataL(*searchQuery[modeIndex], tmpData, data);
+
+				    // Compare the data against query
+                    if ( CPcsAlgorithm1Utils::MyCompareKeyAndString(data, *tmpQuery, *searchQuery[modeIndex]) )
+				    {
 				        psData->SetDataMatch(dataIndex);				        			        
-				        
+
 				        // Perform two checks.
 				        // 1. Ensure that the word is not matched against any previous query
 				        // 2. If it is the first match to the query
 				        TBool isWordMatch = IsWordMatch(dataIndex, wordIndex);				        
-				      
+
 				        // Check if the current word is not matched to any query
 		                if( !isWordMatch )
 		                {
@@ -544,37 +533,37 @@
 	                 			queryMatch = ETrue;
 	                 			SetWordMap(dataIndex, wordIndex);
 							}
-							
+
 					        // Extract matched character sequence and fill in temp array
 							TInt len = tmpQuery->Length();
 							HBufC* seq = HBufC::NewL(len);
 							*seq = tmpData.Mid(0, len);
 							
 							seq->Des().UpperCase();
-							TIdentityRelation<TDesC> searchRule(Compare3);
+							TIdentityRelation<TDesC> searchRule(CPcsAlgorithm1Utils::CompareExact);
 							if ( tmpMatchSet.Find(seq, searchRule) == KErrNotFound )
 							{
-							tmpMatchSet.Append(seq);
+                                tmpMatchSet.Append(seq);
 							}
 							else
-							    { 
-								  delete seq;
-								  seq = NULL;
-							    }
-						}	
-				     }
+							{ 
+                                delete seq;
+								seq = NULL;
+							}
+						}
+				    }
 				     
-				     // Next word
-				     tmpData.Set(lex.NextToken());
-			     }			     
-		     }		   
-		     
-		     // No data element matches the query. Ignore this result.
-		     if ( queryMatch == EFalse )
-		     {
+				    // Next word
+				    tmpData.Set(lex.NextToken());
+			    }			     
+		    }
+		    
+		    // No data element matches the query. Ignore this result.
+		    if ( queryMatch == EFalse )
+		    {
 		        isMatch = EFalse;
 		     	break;
-		     }		     
+		    }
 		}
 		
 		// If match add the element to the result set
@@ -748,5 +737,3 @@
 }
 
 // End of file
-
-
--- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp	Fri Feb 19 22:40:27 2010 +0200
@@ -76,8 +76,60 @@
 }
 
 // ----------------------------------------------------------------------------
+// CPcsAlgorithm1Utils::CompareByLength()
+// Compare by length.
+// ----------------------------------------------------------------------------
+TBool CPcsAlgorithm1Utils::CompareByLength ( const HBufC& aFirst, const HBufC& aSecond )
+{
+   return ( aFirst.Length() > aSecond.Length() );
+}
+
+// ----------------------------------------------------------------------------
+// CPcsAlgorithm1Utils::CompareExact()
+// Compare strings exactly case sensitively.
+// ----------------------------------------------------------------------------
+TBool CPcsAlgorithm1Utils::CompareExact ( const TDesC& aFirst, const TDesC& aSecond )
+{
+    return aFirst == aSecond;
+}
+
+// ----------------------------------------------------------------------------
+// CPcsAlgorithm1Utils::CompareCollate()
+// Compare strings with collate rules depending on locale.
+// ----------------------------------------------------------------------------
+TBool CPcsAlgorithm1Utils::CompareCollate ( const TDesC& aFirst, const TDesC& aSecond )
+{
+    return CPcsAlgorithm1Utils::MyCompareC(aFirst, aSecond);
+}
+
+// ----------------------------------------------------------------------------
+// CPcsAlgorithm1Utils::MyCompareKeyAndString()
+// Compare for keys and strings:
+// - Case sensitive compare for keys,
+// - Case insensitive and language dependent compare for Contact Data and Query.
+// ----------------------------------------------------------------------------
+TBool CPcsAlgorithm1Utils::MyCompareKeyAndString(const TDesC& aContactString,
+                                                 const TDesC& aQueryAsString,
+                                                 CPsQuery& aPsQuery)
+{
+    TBool comparison = MyCompareK(aContactString, aQueryAsString, aPsQuery); 
+        
+    if (comparison)
+        {
+        // The aContactString can be longer than aQueryAsString and we want a match to be
+        // successful if both strings are equal for the length of the query (aQueryAsString)
+        comparison = (MyCompareC(aContactString.Left(aQueryAsString.Length()), aQueryAsString) == 0);
+        }
+    
+    return comparison;
+}
+
+// ----------------------------------------------------------------------------
 // CPcsAlgorithm1Utils::MyCompareK()
 // Case sensitive compare for keys of first 2 input params.
+// INFO: We have some cases that TPtiKey "Z" (uppercase) is mapping chars "Zz...."
+//       and TPtiKey "z" (lowercase) is mapping chars ".," or "Ää".
+//       The comparison of "Z" and "z" should fail for the keys.
 // ----------------------------------------------------------------------------
 TBool CPcsAlgorithm1Utils::MyCompareK(const TDesC& aLeft, const TDesC& aRight, CPsQuery& aPsQuery)
 {
--- a/predictivesearch/PcsAlgorithm/group/bld.inf	Tue Feb 02 10:12:17 2010 +0200
+++ b/predictivesearch/PcsAlgorithm/group/bld.inf	Fri Feb 19 22:40:27 2010 +0200
@@ -26,5 +26,5 @@
 // Generic configuration interface for component cenrep settings  
 // .crml files contain implementation specifics for cenrep data
 ../conf/predictivesearch_sortorder.confml                  APP_LAYER_CONFML(predictivesearch_sortorder.confml)
-../conf/predictivesearch_sortorder_2000B5C5.crml 	        APP_LAYER_CONFML(predictivesearch_sortorder_2000B5C5.crml)
+../conf/predictivesearch_sortorder_2000B5C5.crml 	        APP_LAYER_CRML(predictivesearch_sortorder_2000B5C5.crml)