# HG changeset patch # User Dario Sestito # Date 1278938578 -3600 # Node ID 22a79a0cd291703171b8d18c848f62dcaf2826ce # Parent 34879f5cfc63463cc38f17b3b5acd411237321c4# Parent 35018d46c3dcebd15197dd7eabcdba5fb3bc6479 Remerge test code fix (Bug 2758) diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp --- a/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -132,6 +132,12 @@ #ifdef _DEBUG RCmsSession::WriteToLog( _L8( "RCmsContact::IsServiceAvailable() - Field: %d" ), aServiceType ); #endif + if( VPbkFieldTypeSelectorFactory::EEmailEditorSelector == aServiceType ) + { + // Resolving email accounts is too slow -> + // CCA show email item if email field is defined in contact + return ETrue; + } return SendReceive( ECmsFetchServiceAvailability, TIpcArgs( aServiceType ) ); } diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h Mon Jul 12 13:42:58 2010 +0100 @@ -32,6 +32,7 @@ class CCmsServerSession; class CCmsServerContact; class CCmsPhonebookProxy; +class CRCSEProfileRegistry; /** * CCmsScheduler is used instead of default active scheduler to @@ -117,6 +118,14 @@ */ RFs& FileSession(); + /** + * Return a reference to RCSE Profile registry. + * Uses lazy initialization + * + * @return RCSE Profile Registry instance + */ + CRCSEProfileRegistry& RCSEProfileRegistryL(); + public: //static /** @@ -140,6 +149,11 @@ /// Phonebook proxy which is responsible for common phonebook /// operations. Available for all CMS sessions. Owned. CCmsPhonebookProxy* iPhonebookProxy; + + /// Owned. Shared RCSE Profile registry instance for all sessions. + /// Constructing this instance is slow and therefore it's kept + /// in server where it can be quickly aquired. + CRCSEProfileRegistry* iRCSEProfileRegistry; }; #endif diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Mon Jul 12 13:42:58 2010 +0100 @@ -476,6 +476,8 @@ /// Used to save Retrieve Contact operation. Owned. MVPbkContactOperationBase* iOperation; + /// Cached VoIP features + TInt iVoipFeatures; }; #endif //__CMSSERVERCONTACT__ diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Mon Jul 12 13:42:58 2010 +0100 @@ -211,9 +211,9 @@ /// retrieving operation is done. RMessage2 iCmsContactRetrieveMessage; - /// Copy of the service message received from the client. It's saved for - /// delayed processing if stores are not opened yet. - RMessage2 iServiceMessage; + /// Pointer for delayed processing if stores are not opened yet. + /// Must be pointer, Message status is not updated if a copy is done ! + const RMessage2* iServiceMessage; /// ETrue, if FeatureManager library was initialized. TBool iFeatureManagerInitialized; diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -124,7 +124,7 @@ // TBool CCmsPhonebookProxy::StoreOpenStatus() { - if( iAtLeastOneStoreReady && iOpenComplete && iCurrentContactStoreReady ) + if( iAtLeastOneStoreReady && iOpenComplete ) { return ETrue; } @@ -142,9 +142,7 @@ PRINT ( _L("Start CCmsPhonebookProxy::InitStoresL()") ); if( !iOpenComplete ) - { - iCurrentContactStoreReady = EFalse; - iReadyStores.ResetAndDestroy(); + { iStoreList->OpenAllL( *this ); } PRINT ( _L("End CCmsPhonebookProxy::InitStoresL()") ); @@ -426,37 +424,20 @@ void CCmsPhonebookProxy::SetContact( MVPbkStoreContact* aContact ) { iContact = aContact; - - if( !iCurrentContactStoreReady && iContact ) + iCurrentContactStoreReady = EFalse; + + if( iContact ) { for( TInt x=0; xDes().CompareC( iContact->ContactStore().StoreProperties().Uri().UriDes() ) == 0 ) - { - + { iCurrentContactStoreReady = ETrue; - iCmsPhonebookOperationsObserver.StoreOpenComplete(); break; } } - } - // Check in case the contact has changed - else if( iCurrentContactStoreReady && iContact ) - { - iCurrentContactStoreReady = EFalse; - - for( TInt x=0; xDes().Compare( - iContact->ContactStore().StoreProperties().Uri().UriDes() ) == 0 ) - { - // Contact found from ready stores - iCurrentContactStoreReady = ETrue; - break; - } - } - } + } } // ---------------------------------------------------------- @@ -488,10 +469,10 @@ { PRINT( _L("Start CCmsPhonebookProxy::OpenComplete()" ) ); iOpenComplete = ETrue; - if ( iAtLeastOneStoreReady && !iCurrentContactStoreReady ) + if ( iAtLeastOneStoreReady ) { iCmsPhonebookOperationsObserver.StoreOpenComplete(); - iCurrentContactStoreReady = ETrue; + iCurrentContactStoreReady = ETrue; } PRINT( _L("End CCmsPhonebookProxy::OpenComplete()" ) ); } @@ -587,7 +568,7 @@ aContactStore.StoreProperties().Uri().UriDes() ) == 0 && !iCurrentContactStoreReady ) { iCurrentContactStoreReady = ETrue; - iCmsPhonebookOperationsObserver.StoreOpenComplete(); + iCmsPhonebookOperationsObserver.StoreOpenComplete(); } } @@ -634,6 +615,10 @@ void CCmsPhonebookProxy::ConfigurationChanged() { PRINT( _L( "CCmsPhonebookProxy::ConfigurationChanged()" ) ); + if( iContactInterface && iContact ) + { + iContactInterface->ContactReadyL( KErrNone, NULL ); + } } // ---------------------------------------------------------- @@ -659,10 +644,12 @@ PRINT( _L( "Start CCmsPhonebookProxy::CreateConfigurationL()" ) ); iAtLeastOneStoreReady = EFalse; + iCurrentContactStoreReady = EFalse; iOpenComplete = EFalse; delete iUriList; iUriList = NULL; iContactStore = NULL; + iReadyStores.ResetAndDestroy(); // Support all contact stores, not only those defined by phonebook2 setting iUriList = iStoreConfiguration->SupportedStoreConfigurationL(); diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -22,7 +22,7 @@ #include "cmsserver.h" #include "cmsserversession.h" #include "cmsphonebookproxy.h" - +#include // ---------------------------------------------------------- // CCmsServer::New @@ -85,6 +85,7 @@ PRINT( _L( "Start CCmsServer::~CCmsServer()" ) ); Cancel(); delete iPhonebookProxy; + delete iRCSEProfileRegistry; iFS.Close(); PRINT( _L( "End CCmsServer::~CCmsServer()" ) ); } @@ -122,6 +123,20 @@ } // ---------------------------------------------------- +// CCmsServer::RCSEProfileRegistryL +// +// ---------------------------------------------------- +// +CRCSEProfileRegistry& CCmsServer::RCSEProfileRegistryL() + { + if( !iRCSEProfileRegistry ) + { + iRCSEProfileRegistry = CRCSEProfileRegistry::NewL(); + } + return *iRCSEProfileRegistry; + } + +// ---------------------------------------------------- // CCmsServer::ContactProxy // // ---------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -50,6 +50,9 @@ #include "cmsserverdefines.h" #include "cmsdebug.h" +/// Definition of non-parsed VoIP features +const TInt KVoIPFeaturesUndefined = KMinTInt; + // ---------------------------------------------------- // CCmsServerContact::CCmsServerContact // @@ -60,7 +63,8 @@ iContactDeleted( EFalse ), iPresenceNotifySubscribed( EFalse ), iSession( aSession ), - iCmsServer( aCmsServer ) + iCmsServer( aCmsServer ), + iVoipFeatures( KVoIPFeaturesUndefined ) { } @@ -117,16 +121,18 @@ iChatHandler->UnsubscribeBrandingForContact( iContactLink, this ); } } - delete iContact; - iContact = NULL; - - iCmsServer.PhonebookProxyHandle().SetContact( iContact ); - + delete iStoreUri; delete iChatHandler; delete iVoipHandler; delete iXSPContactHandler; delete iContactLink; + delete iContact; + iContact = NULL; + + + iCmsServer.PhonebookProxyHandle().SetContact( iContact ); + delete iCachedField8; delete iAsyncContact; delete iCachedField16; @@ -637,10 +643,22 @@ void CCmsServerContact::ContactReadyL( TInt aError, MVPbkStoreContact* aContact ) { TPtrC uri( _L( "" ) ); + + delete iContact; + iContact = aContact; + if( !iContact ) + { + iContactDeleted = ETrue; + } + else + { + iContactDeleted = EFalse; + } + + iCmsServer.PhonebookProxyHandle().SetContact( iContact ); + if( KErrNone == aError && aContact ) { - delete iContact; - iContact = aContact; //Create contactlink array of this contact. This is needed for UI operations. //Only 1 contact link appended to array. //Possible performance issue. Should this be created only when array is requested from client side? @@ -648,7 +666,7 @@ uri.Set( aContact->ParentStore().StoreProperties().Uri().UriDes() ); ParseContactStore( uri ); - iCmsServer.PhonebookProxyHandle().SetContact( iContact ); + iVoipFeatures = KVoIPFeaturesUndefined; // reset VoIP cache } } @@ -1312,52 +1330,50 @@ { PRINT( _L( "Start CCmsServerContact::ParseVoIPAvailabilityL()" ) ); - TInt bitter( 0 ); - TBool found( EFalse ); - - if( CmsServerUtils::IsVoIPSupportedL() ) - { - bitter |= ECmsVoIPSupportBasic; - CheckServiceProviderSupportL( bitter ); - - CSPSettings* settings = CSPSettings::NewLC(); - - if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) + if( iVoipFeatures == KVoIPFeaturesUndefined ) + { + iVoipFeatures = 0; // no features + if( CmsServerUtils::IsVoIPSupportedL() ) { - RIdArray idArray; - CleanupClosePushL(idArray); - User::LeaveIfError( settings->FindServiceIdsL(idArray) ); - - CRCSEProfileRegistry* profileRegistry = CRCSEProfileRegistry::NewLC(); - RPointerArray entries; - CleanupStack::PushL( TCleanupItem(CleanupResetAndDestroy, &entries) ); - - // Check if we have atleast one SPSetting entry - // Any entry in this array uses SIP protocol for VoIP - for (TInt i = 0; !found && i < idArray.Count(); ++i) + iVoipFeatures = ECmsVoIPSupportBasic; + CheckServiceProviderSupportL( iVoipFeatures ); + + CSPSettings* settings = CSPSettings::NewLC(); + + if ( FeatureManager::FeatureSupported(KFeatureIdCommonVoip) ) { - profileRegistry->FindByServiceIdL( idArray[i], entries ); - if (entries.Count() > 0) + RIdArray idArray; + CleanupClosePushL(idArray); + User::LeaveIfError( settings->FindServiceIdsL(idArray) ); + CRCSEProfileRegistry& profileRegistry = iCmsServer.RCSEProfileRegistryL(); + RPointerArray entries; + CleanupStack::PushL( TCleanupItem(CleanupResetAndDestroy, &entries) ); + + // Check if we have atleast one SPSetting entry + // Any entry in this array uses SIP protocol for VoIP + for (TInt i = 0; i < idArray.Count(); ++i) { - bitter |= ECmsVoIPSupportSip; - found = ETrue; + profileRegistry.FindByServiceIdL( idArray[i], entries ); + if (entries.Count() > 0) + { + iVoipFeatures |= ECmsVoIPSupportSip; + break; + } } + + CleanupStack::PopAndDestroy( 2 ); //entries, idArray, } - - CleanupStack::PopAndDestroy( 3 ); //entries, profileRegistry, idArray, + + if( settings->IsFeatureSupported( ESupportCallOutFeature ) ) + { + iVoipFeatures |= ECmsVoIPSupportCallout; + } + + CleanupStack::PopAndDestroy(); // settings } - - if( settings->IsFeatureSupported( ESupportCallOutFeature ) ) - { - bitter |= ECmsVoIPSupportCallout; - } - - CleanupStack::PopAndDestroy(); // settings - - } PRINT( _L( "End CCmsServerContact::ParseVoIPAvailabilityL()" ) ); - return bitter; + return iVoipFeatures; } // ---------------------------------------------------- @@ -1495,8 +1511,7 @@ void CCmsServerContact::VPbkSingleContactOperationFailed( MVPbkContactOperationBase& /*aOperation*/, TInt aError ) - { - TRAP_IGNORE ( ContactReadyL( aError, NULL ) ); + { iCmsServer.CmsSingleContactOperationComplete( aError ); } diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -40,11 +40,6 @@ #include #include -// For finding mailbox accounts -#include -#include - - namespace { TBool IsFieldTypeVoipCapable( TInt aFieldTypeResId, TInt aVoipFlag ) @@ -272,10 +267,11 @@ // void CCmsServerSession::StoreOpenComplete() { - if ( !iServiceMessage.IsNull() ) + if ( iServiceMessage ) { // Some request waits when stores are opened. Handle it now. - DoServiceL( iServiceMessage ); + DoServiceL( *iServiceMessage ); + iServiceMessage = NULL; } } @@ -315,7 +311,7 @@ { PRINT( _L( "Start CCmsServerSession::ServiceL()" ) ); - if ( !iServiceMessage.IsNull() && !iCmsServer->PhonebookProxyHandle().StoreOpenStatus() ) + if ( iServiceMessage && !iCmsServer->PhonebookProxyHandle().StoreOpenStatus() ) { // some message already waits for store opening completion aMessage.Complete( KErrNotReady ); @@ -325,7 +321,7 @@ if( !iCmsServer->PhonebookProxyHandle().StoreOpenStatus() ) { // Stores are not ready yet, save message for later processing - iServiceMessage = aMessage; + iServiceMessage = &aMessage; return; } @@ -485,38 +481,6 @@ availability = iServerContact->ParseVoIPAvailabilityL(); break; } - case VPbkFieldTypeSelectorFactory::EEmailEditorSelector: - { - using namespace EmailInterface; - - CEmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL(); - CleanupStack::PushL( factory ); - MEmailInterface* ifPtr = factory->InterfaceL( KEmailClientApiInterface ); - MEmailClientApi* clientApi = static_cast( ifPtr ); - CleanupReleasePushL( *clientApi ); - - RMailboxPtrArray mailboxes; - TRAPD( error, clientApi->GetMailboxesL( mailboxes );); - TInt count = mailboxes.Count(); - - // Release mailboxs before releasing clientapi - for ( TInt i=0; iRelease(); - } - - mailboxes.Close(); - - CleanupStack::PopAndDestroy( 2 ); // clientApi and factory - - if( count == 0 ) - { - availability = EFalse; - } - - break; - } default: { //In case the type is unknown, just break here and return true diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/group/bld.inf --- a/ccservices/cmsservices/cmsengine/group/bld.inf Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/group/bld.inf Mon Jul 12 13:42:58 2010 +0100 @@ -26,7 +26,7 @@ //-------------------- ../rom/CmsEngine.iby CORE_APP_LAYER_IBY_EXPORT_PATH(CmsEngine.iby) // headers done in cms_client_api -../sis/cmsengine_stub.sis /epoc32/data/z/system/install/cmsengine_stub.sis +//../sis/cmsengine_stub.sis /epoc32/data/z/system/install/cmsengine_stub.sis //-------------------- PRJ_MMPFILES //-------------------- diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/rom/CmsEngine.iby --- a/ccservices/cmsservices/cmsengine/rom/CmsEngine.iby Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/cmsengine/rom/CmsEngine.iby Mon Jul 12 13:42:58 2010 +0100 @@ -24,6 +24,6 @@ file=ABI_DIR\BUILD_DIR\cmsclient.dll SHARED_LIB_DIR\cmsclient.dll data=DATAZ_\RESOURCE_FILES_DIR\cms\cmsserver.rsc RESOURCE_FILES_DIR\cms\cmsserver.rsc -data=DATAZ_\system\install\cmsengine_stub.sis system\install\cmsengine_stub.sis +//data=DATAZ_\system\install\cmsengine_stub.sis system\install\cmsengine_stub.sis #endif //__CMSENGINE_IBY__ diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/sis/cmsengine_stub.pkg --- a/ccservices/cmsservices/cmsengine/sis/cmsengine_stub.pkg Fri May 28 13:07:31 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; Languages -&EN - -; Header -#{"CMS Engine"}, (0x2000B164), 1, 0, 0, TYPE=SA - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Files -; Binaries -""-"z:\sys\bin\cmsserver.exe" -""-"z:\sys\bin\cmsclient.dll" -""-"z:\resource\cms\cmsserver.r*" diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/sis/cmsengine_stub.sis Binary file ccservices/cmsservices/cmsengine/sis/cmsengine_stub.sis has changed diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/cmsengine/sis/cmsengine_urel.pkg --- a/ccservices/cmsservices/cmsengine/sis/cmsengine_urel.pkg Fri May 28 13:07:31 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -;Language - standard language definitions -&EN - -; standard SIS file header -#{"CMS Engine"},(0x2000B164),3,0,0, TYPE=SA, RU - -;Supports Series 60 v 3.0 -[0x101F7961], 0, 0, 0, {"Series60ProductID"} - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -; CMS Engine files to be installed -; CMS Client -"\epoc32\release\armv5\urel\cmsclient.dll" - "!:\sys\bin\cmsclient.dll" - -; CMS Server -"\epoc32\release\armv5\urel\cmsserver.exe" - "!:\sys\bin\cmsserver.exe" -"\epoc32\data\z\resource\cms\cmsserver.rsc" - "!:\resource\cms\cmsserver.rsc" diff -r 35018d46c3dc -r 22a79a0cd291 ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp --- a/ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp Fri May 28 13:07:31 2010 +0100 +++ b/ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -499,7 +499,11 @@ #endif TRAP_IGNORE( iObs.ReceiveIconInfosL( ContactLink(), iPendings, info->OpId() )); // This instance is not needed anymore - Destroy(); + if (!destroyed) + { + Destroy(); + } + } } else if ( iNotifyPending ) @@ -510,7 +514,10 @@ // Empty notification TRAP_IGNORE( iObs.ReceiveIconInfosL( ContactLink(), iPendings, iOpId )); // This instance is not needed anymore - Destroy(); + if (!destroyed) + { + Destroy(); + } } if ( !destroyed ) diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h --- a/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h Mon Jul 12 13:42:58 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-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" @@ -21,10 +21,17 @@ #include class MCCAViewLauncher; +class MCCAStatusProvider; /** * ECom interface for CCA Extension factory. - * + * At the moment extension factory interface is used only for extend CCA + * Status button implementation: + * - CCA Status button implementation uses this interface to launch external + * views (MCCAViewLauncher) when user tap the Status button. + * - CCA Status button implementation uses MCCAStatusProvider interface to + * read status information from plug-in if status infromation doesn't found in + * Presence Cache. * @lib n/a * @since 9.2 */ @@ -45,7 +52,7 @@ { return NULL; } - + /** * Returns Service ID of the plug-in. */ @@ -67,6 +74,32 @@ }; +// Use this UID to access CCCAExtensionFactory's status provider creator. +// Used as a parameter to CCCAExtensionFactory::FactoryExtension method. +const TUid KCCAExtensionFactoryStatusProviderCreatorUid = { 2 }; + +/** + * This class is an extension to CCCAExtensionFactory. + * + * @see CCCAExtensionFactory + * @see KCCAExtensionFactoryStatusProviderCreatorUid + */ +class MCCAExtensionFactoryStatusProviderCreator + { + protected: // Destructor + virtual ~MCCAExtensionFactoryStatusProviderCreator() { } + + public: + + /** + * Creates a status provider. + * Ownership is given. + * @return Status provider instance @see MCCAStatusProvider + */ + virtual MCCAStatusProvider* CreateStatusProviderL() = 0; + + }; + /** * View launcher extension for the CCA. */ @@ -112,6 +145,112 @@ }; +class MCCAStatusProviderObserver; +class MVPbkContactLink; +class CGulIcon; + +/** + * Status provider extension for the CCA + */ +class MCCAStatusProvider + { +public: + /// virtual destructor + virtual ~MCCAStatusProvider() {}; + + /** + * Add observer + * @param aObserver instance @see MCCAStatusProviderObserver + */ + virtual void AddObserverL( + MCCAStatusProviderObserver& aObserver ) = 0; + + /** + * Removes observer + * @param aObserver instance @see MCCAStatusProviderObserver + */ + virtual void RemoveObserver( + MCCAStatusProviderObserver& aObserver ) = 0; + + /** + * CCA fetch status information for the Status button with this method + * if status information is not found from Presence Cache + * @param aLink + * @param aText Status Text, ownership is transfered + * @param aIcon Status Icon, ownership is transfered + */ + virtual void GetStatusInformationL( + const MVPbkContactLink& aLink, + HBufC*& aText, + CGulIcon*& aIcon ) = 0; + + /** + * CCA fetch status information for the Status button with this method + * if status information is not found from Presence Cache + * This function is used only for fetching My card status information + * @param aLink + * @param aText Status Text, ownership is transfered + * @param aIcon Status Icon, ownership is transfered + */ + virtual void GetMyCardStatusInformationL( + const MVPbkContactLink& aLink, + HBufC*& aText, + CGulIcon*& aIcon ) = 0; + + /** + * Extension point for the status provider + */ + virtual TAny* StatusProviderExtension( + TUid /*aExtensionUid*/ ) + { + return NULL; + } + +protected: + MCCAStatusProvider() {}; + + }; + +/** + * Interface to observe content changes + */ +class MCCAStatusProviderObserver + { +public: + /** + * Event types + */ + enum TCCAStatusProviderObserverEvent + { + /// Status is changed and CCA should fetch status information again + EStatusChanged = 0x0 + }; + + /** + * Plug-in can notify CCA about status events + * @param aEvent Type of the event + * @param aLink Contact which the event is about + */ + virtual void StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink = NULL ) = 0; + + /** + * Extension point for the MCCAStatusProviderObserver + */ + virtual TAny* StatusProviderObserverExtension( + TUid /*aExtensionUid*/ ) + { + return NULL; + } + +protected: + MCCAStatusProviderObserver(){}; + virtual ~MCCAStatusProviderObserver() {}; + + }; + + #include "ccaextensionfactory.inl" #endif // CCAEXTENSIONFACTORY_H diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/phonebook_2_common_ui_api/group/bld.inf --- a/contacts_plat/phonebook_2_common_ui_api/group/bld.inf Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/phonebook_2_common_ui_api/group/bld.inf Mon Jul 12 13:42:58 2010 +0100 @@ -46,3 +46,4 @@ ../inc/Pbk2ViewGraph.rh APP_LAYER_PLATFORM_EXPORT_PATH(Pbk2ViewGraph.rh) ../inc/MPbk2ViewActivationTransaction.h APP_LAYER_PLATFORM_EXPORT_PATH(MPbk2ViewActivationTransaction.h) ../inc/Pbk2LaunchNewContact.h APP_LAYER_PLATFORM_EXPORT_PATH(Pbk2LaunchNewContact.h) +../inc/Phonebook2PublicPSKeys.h APP_LAYER_PLATFORM_EXPORT_PATH(Phonebook2PublicPSKeys.h) \ No newline at end of file diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h --- a/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h Mon Jul 12 13:42:58 2010 +0100 @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include // FORWARD DECLARATIONS diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/phonebook_2_common_ui_api/inc/Phonebook2PublicPSKeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/contacts_plat/phonebook_2_common_ui_api/inc/Phonebook2PublicPSKeys.h Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Phonebook 2 public publish and subscribe keys. +* +*/ + + +#ifndef PHONEBOOK2PUBLICPSKEYS_H +#define PHONEBOOK2PUBLICPSKEYS_H + +// -------------------------------------------------------------------------- +// Phonebook Publish & Subscribe UIDs +// -------------------------------------------------------------------------- + +const TUint32 KPbk2PSUidPublic = 0x101F849C; + +// -------------------------------------------------------------------------- +// Phonebook System State API +// -------------------------------------------------------------------------- +// +const TUint32 KPhonebookOpenCompleted = 0x00000001; + +// Enumeration for KPhonebookOpenCompleted +enum TPhonebookOpenCompletedStatus + { + EPhonebookClosed, + EPhonebookOpenCompleted + }; + +#endif // PHONEBOOK2PUBLICPSKEYS_H + +// End of File diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h --- a/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h Mon Jul 12 13:42:58 2010 +0100 @@ -22,7 +22,7 @@ // INCLUDE FILES #include #include -#include +#include // FORWARD DECLARATIONS class CPbk2UIExtensionView; diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h --- a/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h Mon Jul 12 13:42:58 2010 +0100 @@ -22,6 +22,7 @@ // INCLUDES #include #include +#include #include #include #include @@ -35,7 +36,7 @@ class CPcsPlugin: public CBase { - public: + public: /** * Ecom interface static factory method implementation. @@ -56,12 +57,12 @@ */ virtual ~CPcsPlugin(); - public: + public: /** * Gets the plugin id. * @return Id of the plugin. - */ + */ inline TUid PluginId() const; /** @@ -72,11 +73,11 @@ virtual void PerformSearchL( const CPsSettings& aPcsSettings, CPsQuery& aCondition, RPointerArray& aData, - RPointerArray& aPattern) = 0; + RPointerArray& aPattern) = 0; /** * Performs search on a input string - * Implementation needs to be provided by the algorithm classes + * Implementation needs to be provided by the algorithm classes */ virtual void SearchInputL( CPsQuery& aSearchQuery, TDesC& aSearchData, @@ -85,23 +86,23 @@ /** * Performs search on a input string, and return result also as a string - * Implementation needs to be provided by the algorithm classes + * Implementation needs to be provided by the algorithm classes */ virtual void SearchMatchStringL( CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ) = 0; - + TDesC& aSearchData, + TDes& aMatch ) = 0; + /** * Returns ETrue if the predictive search is supported for * the local language * Returns EFalse otherwise */ - virtual TBool IsLanguageSupportedL(const TUint32 aLanguage) = 0; + virtual TBool IsLanguageSupportedL(const TUint32 aLanguage) = 0; /** * Get the data order (mapped to VPbk ids) supported for a URI */ - virtual void GetDataOrderL(TDesC& aURI, RArray& aDataOrder) = 0; + virtual void GetDataOrderL(TDesC& aURI, RArray& aDataOrder) = 0; /** * Get the sort order (mapped to VPbk ids) supported for a URI @@ -112,8 +113,16 @@ * Set the sort order (mapped to VPbk ids) supported for a URI */ virtual void ChangeSortOrderL(TDesC& aURI, RArray& aDataOrder) = 0; - - private: + + /** + * Returns the Adaptive Grid for one or more URI + * Implementation needs to be provided by the algorithm classes + */ + virtual void GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ) = 0; + + private: TUid iPluginId; TUid iDtor_ID_Key; diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h --- a/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h Mon Jul 12 13:42:58 2010 +0100 @@ -11,8 +11,8 @@ * * Contributors: * -* Description: This is the client side interface declaration for the -* predictive search server. +* Description: This is the client side interface declaration for the +* predictive search server. * */ @@ -62,329 +62,347 @@ class CPSRequestHandler : public CActive { - public: // Constructors and destructors + public: // Constructors and destructors - /** - * NewL. - * Two-phased constructor. - * Creates a CPSRequestHandler object using two phase construction, - * and return a pointer to the created object. - * - * @return A pointer to the created instance of CPSRequestHandler. - */ - IMPORT_C static CPSRequestHandler* NewL(); + /** + * NewL. + * Two-phased constructor. + * Creates a CPSRequestHandler object using two phase construction, + * and return a pointer to the created object. + * + * @return A pointer to the created instance of CPSRequestHandler. + */ + IMPORT_C static CPSRequestHandler* NewL(); + + /** + * NewLC. + * Two-phased constructor. + * Creates a CPSRequestHandler object using two phase construction, + * and return a pointer to the created object. + * + * @return A pointer to the created instance of CPSRequestHandler. + */ + IMPORT_C static CPSRequestHandler* NewLC(); - /** - * NewLC. - * Two-phased constructor. - * Creates a CPSRequestHandler object using two phase construction, - * and return a pointer to the created object. - * - * @return A pointer to the created instance of CPSRequestHandler. - */ - IMPORT_C static CPSRequestHandler* NewLC(); + /** + * ~CPSRequestHandler. + * Destructor. + * Destroys the object and release all memory objects. + */ + virtual ~CPSRequestHandler(); + + public: // New functions - /** - * ~CPSRequestHandler. - * Destructor. - * Destroys the object and release all memory objects. - */ - virtual ~CPSRequestHandler(); + /** + * Version. + * Returns the predictive search server version. + * + * @return The current version of predictive search server. + */ + IMPORT_C TVersion Version() const; - public: // New functions + /** + * AddObserver. + * + * @param aObserver The object to be used to handle updates + * from the server. + */ + IMPORT_C void AddObserverL( MPsResultsObserver* aObserver ); - /** - * Version. - * Returns the predictive search server version. - * - * @return The current version of predictive search server. - */ - IMPORT_C TVersion Version() const; - - /** - * AddObserver. - * - * @param aObserver The object to be used to handle updates - * from the server. - */ - IMPORT_C void AddObserverL ( MPsResultsObserver* aObserver ); - - /** - * RemoveObserverL. - * - * @param aObserver The object used to handle updates from the server. - * @return KErrNone if removed. - * KErrNotFound if observer not added already. - */ - IMPORT_C TInt RemoveObserver ( MPsResultsObserver* aObserver ); + /** + * RemoveObserverL. + * + * @param aObserver The object used to handle updates from the server. + * @return KErrNone if removed. + * KErrNotFound if observer not added already. + */ + IMPORT_C TInt RemoveObserver( MPsResultsObserver* aObserver ); + + /** + * SetSearchSettingsL. + * Set the databases and fields to be included in search. + * Databases ids are mapped to virtual phone book URLs. + * Fields to be searched are mapped to virutal phonebook identifiers. + * + * @param aSettings Holds the search settings. + */ + IMPORT_C void SetSearchSettingsL( const CPsSettings& aSettings ); - /** - * SetSearchSettingsL. - * Set the databases and fields to be included in search. - * Databases ids are mapped to virtual phone book URLs. - * Fields to be searched are mapped to virutal phonebook identifiers. - * - * @param aSettings Holds the search settings. - */ - IMPORT_C void SetSearchSettingsL(const CPsSettings& aSettings); - - /** - * GetAllContentsL. - * Sends a request to the predictive search server to get all cached contents. - * This is a asynchronous request. - */ - IMPORT_C void GetAllContentsL(); + /** + * GetAllContentsL. + * Sends a request to the predictive search server to get all cached contents. + * This is a asynchronous request. + */ + IMPORT_C void GetAllContentsL(); - /** - * SearchL. - * Sends a request to the predictive search server. - * This is a asynchronous request. - * - * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) - * @param aStatus Holds the completion status of search request. - */ - IMPORT_C void SearchL(const CPsQuery& aSearchQuery); - - /** - * SearchL. - * Sends a request to the predictive search server. - * This is a asynchronous request. It considers bookmarked contacts - * while sending the results back to the client - * - * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) - * @param aMarkedContacts Array of marked contacts - * @param aContactManager Contact manager instance - */ - IMPORT_C void SearchL(const CPsQuery& aSearchQuery, - RPointerArray& aMarkedContacts, - CVPbkContactManager* aContactManager); - + /** + * SearchL. + * Sends a request to the predictive search server. + * This is a asynchronous request. + * + * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) + * @param aStatus Holds the completion status of search request. + */ + IMPORT_C void SearchL( const CPsQuery& aSearchQuery ); + + /** + * SearchL. + * Sends a request to the predictive search server. + * This is a asynchronous request. It considers bookmarked contacts + * while sending the results back to the client + * + * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) + * @param aMarkedContacts Array of marked contacts + * @param aContactManager Contact manager instance + */ + IMPORT_C void SearchL( const CPsQuery& aSearchQuery, + RPointerArray& aMarkedContacts, + CVPbkContactManager* aContactManager ); + /** * CancelSearch. * Cancels ongoing search. */ - IMPORT_C void CancelSearch(); - - /** - * LookupL. - * Sends a request to the predictive search server. - * Does a predictive search in aSearchData for aSearchQuery and return - * the matches. - * This is a synchronous request. - * - * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) - * @param aSearchData The input data to be searched. - * @param aMatchSet The list of matches. - * @param aMatchLocation The list matched index and length of match - */ - IMPORT_C void LookupL(const CPsQuery& aSearchQuery, - const TDesC& aSearchData, - CDesCArray& aMatchSet, - RArray& aMatchLocation); + IMPORT_C void CancelSearch(); /** - * LookupMatchL. + * LookupL. + * Sends a request to the predictive search server. + * Does a predictive search in aSearchData for aSearchQuery and return + * the matches. + * This is a synchronous request. + * + * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) + * @param aSearchData The input data to be searched. + * @param aMatchSet The list of matches. + * @param aMatchLocation The list matched index and length of match + */ + IMPORT_C void LookupL( const CPsQuery& aSearchQuery, + const TDesC& aSearchData, + CDesCArray& aMatchSet, + RArray& aMatchLocation ); + + /** + * LookupMatchL. * Sends a request to the predictive search server. * Does a predictive search in aSearchData for aSearchQuery and return * the match string in aMatch. * If there is no full match aMatch will be empty (Length()==0) * This is a synchronous request. - * + * * @param aSearchQuery The input search query.(Length of aSearchQuery <= KPsQueryMaxLen) * @param aSearchData The input data to be searched. * @param aMatch The matched result */ - IMPORT_C void LookupMatchL(const CPsQuery& aSearchQuery, - const TDesC& aSearchData, - TDes& aMatch); - - /** - * IsLanguageSupportedL. - * Checks if the language variant is supported by - * the predictive search engine. - * This is a synchronous request. - * - * @param aLanguage The language which has to be checked - * @return ETrue if the language specified is supported by PS engine - * EFalse otherwise - * - */ - IMPORT_C TBool IsLanguageSupportedL(const TLanguage aLanguage); + IMPORT_C void LookupMatchL( const CPsQuery& aSearchQuery, + const TDesC& aSearchData, + TDes& aMatch ); + + /** + * IsLanguageSupportedL. + * Checks if the language variant is supported by + * the predictive search engine. + * This is a synchronous request. + * + * @param aLanguage The language which has to be checked + * @return ETrue if the language specified is supported by PS engine + * EFalse otherwise + * + */ + IMPORT_C TBool IsLanguageSupportedL( const TLanguage aLanguage ); - /** - * GetCachingStatusL - * Gets the status of the caching synchronously - * - * @param aResultsBuffer Pointer to the result buffer. - */ - IMPORT_C TInt GetCachingStatusL(TCachingStatus& aStatus); + /** + * GetCachingStatusL + * Gets the status of the caching synchronously + * + * @param aResultsBuffer Pointer to the result buffer. + */ + IMPORT_C TInt GetCachingStatusL( TCachingStatus& aStatus ); - /** - * ConvertToVpbkLinkLC. - * Extract the VPBK contact link associated with the search result. - * This is a synchronous request. - * - * @param aSearchResult PS result for which contact link is required. - * @param aContactManager An instance of contact manager used for link extraction. - * @return The contact link. - */ - IMPORT_C MVPbkContactLink* ConvertToVpbkLinkLC( const CPsClientData& aSearchResult, - CVPbkContactManager& aContactManager ); - + /** + * ConvertToVpbkLinkLC. + * Extract the VPBK contact link associated with the search result. + * This is a synchronous request. + * + * @param aSearchResult PS result for which contact link is required. + * @param aContactManager An instance of contact manager used for link extraction. + * @return The contact link. + */ + IMPORT_C MVPbkContactLink* ConvertToVpbkLinkLC( const CPsClientData& aSearchResult, + CVPbkContactManager& aContactManager ); + /** * GetDataOrderL. * This function returns the list of supported data fields (mapped to VPbk identifiers) * supported by a datastore. * This is a synchronous request. - * + * * @param aDataStore The data store URI. * @param aDataOrder This array has the field identifiers returned from the server. */ - IMPORT_C void GetDataOrderL(const TDesC& aDataStore, RArray& aDataOrder); - + IMPORT_C void GetDataOrderL( const TDesC& aDataStore, RArray& aDataOrder ); + /** * GetSortOrderL. * This function returns the sort order of data fields (mapped to VPbk identifiers) * set on a datastore. * This is a synchronous request. - * + * * @param aDataStore The data store URI. * @param aSortOrder This array has the field identifiers returned from the server. */ - IMPORT_C void GetSortOrderL(const TDesC& aDataStore, RArray& aSortOrder); - + IMPORT_C void GetSortOrderL( const TDesC& aDataStore, RArray& aSortOrder ); + /** * ChangeSortOrderL. * This function sets the sort order of data fields (mapped to VPbk identifiers) * on a datastore. * This is a synchronous request. - * + * * @param aDataStore The data store URI. * @param aSortOrder This array has the field identifiers to be set for this store. */ - IMPORT_C void ChangeSortOrderL(const TDesC& aDataStore, RArray& aSortOrder); - + IMPORT_C void ChangeSortOrderL( const TDesC& aDataStore, RArray& aSortOrder ); + /** - * ShutdownServerL - * Shuts down the predictive search engine. - * - * CAUTION: Shutdown of predictive search server shouldn't be done for each - * session. It should be done only when the search engine needs to be - * completely shutdown. - */ - IMPORT_C void ShutdownServerL(); - - protected: // Functions from base classes + * GetAdaptiveGridCharactersL. + * This is a support method for Adaptive Search functionality. + * As Predictive Search Engine is well suited for keeping an maintaining data + * structures related to contacts and updated according to contacts + * additions/modifications/deletions, like it is done already in Predictive Search + * Engine. + * + * @param aDataStores The data store URIs. + * @param aSearchText The text in the find box. + * @param aCompanyName The info if Company Name is required. + * @param aAdaptiveGrid The returned Adaptive Grid. + */ + IMPORT_C void GetAdaptiveGridCharactersL( const MDesCArray& aDataStores, + const TDesC& aSearchText, + const TBool aCompanyName, + TDes& aAdaptiveGrid ); - /** - * From CActive, RunL. - * Callback function. - * Invoked to handle responses from the server. - */ - void RunL(); + /** + * ShutdownServerL + * Shuts down the predictive search engine. + * + * CAUTION: Shutdown of predictive search server shouldn't be done for each + * session. It should be done only when the search engine needs to be + * completely shutdown. + */ + IMPORT_C void ShutdownServerL(); + + protected: // Functions from base classes - /** - * From CActive, DoCancel. - * Cancels any outstanding operation. - */ - void DoCancel(); + /** + * From CActive, RunL. + * Callback function. + * Invoked to handle responses from the server. + */ + void RunL(); - public: - - /** - * Notify observers about the cahcing status - */ - void NotifyCachingStatus( TCachingStatus aStatus, TInt aError ); - - private: // Constructors and destructors + /** + * From CActive, DoCancel. + * Cancels any outstanding operation. + */ + void DoCancel(); + + public: - /** - * CPSRequestHandler. - * Performs the first phase of two phase construction. - */ - CPSRequestHandler(); + /** + * Notify observers about the cahcing status + */ + void NotifyCachingStatus( TCachingStatus aStatus, TInt aError ); + + private: // Constructors and destructors - /** - * ConstructL. - * Performs the second phase construction of a - * CPSRequestHandler object. - */ - void ConstructL(); + /** + * CPSRequestHandler. + * Performs the first phase of two phase construction. + */ + CPSRequestHandler(); - private: // Internal data handlers + /** + * ConstructL. + * Performs the second phase construction of a + * CPSRequestHandler object. + */ + void ConstructL(); + + private: // Internal data handlers - /** - * ParseResultsL. - * Parses the results buffer and converts them to data elements. - */ - void HandleSearchResultsL(); - - /** - * HandleBufferOverFlowL. - * Handles internal buffer overflow event. - */ - void HandleBufferOverFlowL(); + /** + * ParseResultsL. + * Parses the results buffer and converts them to data elements. + */ + void HandleSearchResultsL(); + + /** + * HandleBufferOverFlowL. + * Handles internal buffer overflow event. + */ + void HandleBufferOverFlowL(); - /** - * HandleErrorL. - * Handles error events. - */ - void HandleErrorL(TInt aErrorCode); - - /** - * AddMarkedContacts - * Filters the bookmark results and adds them to final search result set - */ - TInt AddMarkedContactsL(RPointerArray& searchResults); + /** + * HandleErrorL. + * Handles error events. + */ + void HandleErrorL(TInt aErrorCode); - /** + /** + * AddMarkedContacts + * Filters the bookmark results and adds them to final search result set + */ + TInt AddMarkedContactsL(RPointerArray& searchResults); + + /** * RunSearchFromBufferL * Runs search if search query buffer ( iPendingSearchQueryBuffer ) is not empty */ void RunSearchFromBufferL(); - - private: // Data + + private: // Data - /** - * iSession, the predictive search server session. - */ - RPsSession iSession; + /** + * iSession, the predictive search server session. + */ + RPsSession iSession; - /** - * iObservers, observers which handles updates from the server. - */ - RPointerArray iObservers; + /** + * iObservers, observers which handles updates from the server. + */ + RPointerArray iObservers; - /** - * iSearchQueryBuffer, the buffer that holds the search query. - */ - HBufC8* iSearchQueryBuffer; + /** + * iSearchQueryBuffer, the buffer that holds the search query. + */ + HBufC8* iSearchQueryBuffer; - /** + /** * iPendingSearchQueryBuffer, the buffer that holds the pending search query. */ HBufC8* iPendingSearchQueryBuffer; - /** - * iSearchDataBuffer, the buffer that holds the search data. - */ - HBufC8* iSearchDataBuffer; + /** + * iSearchDataBuffer, the buffer that holds the search data. + */ + HBufC8* iSearchDataBuffer; - /** - * iSearchResultsBuffer, the buffer that holds the search results. - */ - HBufC8* iSearchResultsBuffer; - - /** - * iConverter, instance of contact id converter - */ - CVPbkContactIdConverter* iConverter; - + /** + * iSearchResultsBuffer, the buffer that holds the search results. + */ + HBufC8* iSearchResultsBuffer; + + /** + * iConverter, instance of contact id converter + */ + CVPbkContactIdConverter* iConverter; + /** * iPropertyHandler, the handler to property which is asynchronously monitored */ CPsPropertyHandler* iPropertyHandler; - + /** * iContactAddedHandler, handler for reacting to contact being added to cache */ @@ -394,29 +412,29 @@ * iContactRemovedHandler, handler for reacting to contact being removed from cache */ CPsUpdateHandler* iContactRemovedHandler; - + /** * iContactModifiedHandler, handler for reacting to contact being modified in cache */ CPsUpdateHandler* iContactModifiedHandler; - + /** * Not Owned * iBookMarkContactManager, contact manager reference received from the client * To be used only for handling marked contacts. */ CVPbkContactManager* iBookMarkContactManager; - + /** * iMarkedContacts, stores the bookmarked contacts if any, sent by the client */ RPointerArray iMarkedContacts; - + /** * ETrue, if search request was cancelled */ TBool iSearchRequestCancelled; - + }; diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/inc/RPsSession.h --- a/contacts_plat/predictivesearch_client_api/inc/RPsSession.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/inc/RPsSession.h Mon Jul 12 13:42:58 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: This is the client side interface declaration for the +* Description: This is the client side interface declaration for the * predictive contact search server. * */ @@ -44,7 +44,7 @@ * RPcsSession. * Constructor */ - RPsSession(); + RPsSession(); /** * Connect. @@ -59,14 +59,14 @@ * @return Version information */ TVersion Version() const; - + /** * SetSearchSettingsL. * Send the search settings (databases/ display fields) to the server. - * @param aSettings The search settings. + * @param aSettings The search settings. */ void SetSearchSettingsL(const TDes8& aSettings); - + /** * SearchL. * Initiates a predictive search request to the server. @@ -77,36 +77,36 @@ void SearchL(const TDes8& aSearchQuery, TPtr8 aResultsBuffer, TRequestStatus& aStatus); - + /** * CancelSearchL. * Cancels a pending search request. * @param aStatus Holds the completion status of request. - */ - void CancelSearch(); - + */ + void CancelSearch(); + /** * SearchL. * Initiates a predictive search request to the server. * @param aSearchQuery The search query. * @param aSearchData The search data. - * @param aResultsBuffer Pointer to the initial results buffer. + * @param aResultsBuffer Pointer to the initial results buffer. */ void SearchL(const TDes8& aSearchQuery, const TDes8& aSearchData, TPtr8 aResultsBuffer); - /** + /** * SearchMatchStringL. * Initiates a predictive search request to the server with result as string. * @param aSearchQuery The search query. * @param aSearchData The search data. - * @param aResultsBuffer Pointer to the initial results buffer. - */ - void SearchMatchStringL(const TDes8& aSearchQuery, - const TDes8& aSearchData, - TDes& aResultsBuffer); - + * @param aResultsBuffer Pointer to the initial results buffer. + */ + void SearchMatchStringL(const TDes8& aSearchQuery, + const TDes8& aSearchData, + TDes& aResultsBuffer); + /** * SendNewBufferL. * Send a new buffer to server if a overflow occurs. @@ -116,65 +116,81 @@ */ void SendNewBufferL(TPtr8 aResultsBuffer, TRequestStatus& aStatus); - + /** * IsLanguageSupportedL * Sends a request to PS server to decide if the language * variant is supported or not * - * @param aLanguage The language id info. - * @param aResultsBuffer Pointer to the initial results buffer. - */ + * @param aLanguage The language id info. + * @param aResultsBuffer Pointer to the initial results buffer. + */ void IsLanguageSupportedL(const TDes8& aLanguage, - TPtr8 aResultsBuffer); + TPtr8 aResultsBuffer); /** * GetDataOrderL * Sends a request to PS server to get the data fields supported * for a data store. * * @param aURI Data store identifier. - * @param aResultsBuffer Pointer to the results buffer. - */ + * @param aResultsBuffer Pointer to the results buffer. + */ void GetDataOrderL(const TDes8& aURI, TPtr8 aResultsBuffer); /** * GetSortOrderL - * Sends a request to PS server to get the sort order of fields + * Sends a request to PS server to get the sort order of fields * supported for a data store. * * @param aURI Data store identifier. - * @param aResultsBuffer Pointer to the results buffer. - */ + * @param aResultsBuffer Pointer to the results buffer. + */ void GetSortOrderL(const TDes8& aURI, TPtr8 aResultsBuffer); /** * ChangeSortOrderL - * Sends a request to PS server to set the sort order of fields + * Sends a request to PS server to set the sort order of fields * for a data store. * - * @param aInput Data store + Sort Order values. - */ + * @param aInput Data store + Sort Order values. + */ void ChangeSortOrderL(const TDes8& aInput); + /** + * GetAdaptiveGridL + * This is a support method for Adaptive Search functionality. + * As Predictive Search Engine is well suited for keeping an maintaining data + * structures related to contacts and updated according to contacts + * additions/modifications/deletions, like it is done already in Predictive Search + * Engine. + * + * @param aURIs The data store URIs. + * @param aCompanyName The info if Company Name is required. + * @param aAdaptiveGrid The returned Adaptive Grid. + */ + void GetAdaptiveGridL( const TDesC8& aURIs, + const TBool aCompanyName, + TDes& aResultsBuffer ); + /** * Shuts down the predictive search server - */ + */ void ShutdownServerL(); - + private: - + /** * iSearchQueryBufferPtr. Pointer to the buffer holding search query. */ - TPtrC8 iSearchQueryBufferPtr; - + TPtrC8 iSearchQueryBufferPtr; + /** * iResultsBufferPtr. Pointer to the buffer holding search results */ - TPtr8 iResultsBufferPtr; - + TPtr8 iResultsBufferPtr; + }; #endif // R_PS_SESSION_H diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg Mon Jul 12 13:42:58 2010 +0100 @@ -1475,7 +1475,7 @@ //****************************************************************************** [Test] -title Cancel search +title CS: Cancel search create PsClientTestSuite api api WriteTitleToLog api CancelSearch "URI[cntdb:\/\/c:contacts.cdb]" "SQ[624374,EPredictiveItuT,EAlphaSort,5]" "RES[1,(FN:mahesh,LN:doraiswamy,CN:Nokia)]" @@ -1529,6 +1529,31 @@ //------------------------------------------------------------------------------ +// Adaptive Grid ("AG") +//------------------------------------------------------------------------------ + + +//****************************************************************************** +[Test] +title AG: Get Adaptive Grid - With Company Name +create PsClientTestSuite api +api WriteTitleToLog +api CheckAdaptiveString "URI[cntdb:\/\/c:contacts.cdb]" "IPSTR[]" "BOOL[ETrue]" "RESSTR[!&+014@ABCDEFGIJKLMNPRTVYÄÅÖ]" +delete api +[Endtest] + + +//****************************************************************************** +[Test] +title AG: Get Adaptive Grid - Without Company Name +create PsClientTestSuite api +api WriteTitleToLog +api CheckAdaptiveString "URI[cntdb:\/\/c:contacts.cdb]" "IPSTR[]" "BOOL[EFalse]" "RESSTR[!&+014@ABCDEFGJKLMPRTVYÄÖ]" +delete api +[Endtest] + + +//------------------------------------------------------------------------------ // Miscellaneous ("Mi") //------------------------------------------------------------------------------ diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h Mon Jul 12 13:42:58 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: Header file for client test suite +* Description: Header file for client test suite * */ @@ -39,14 +39,13 @@ // CLASS DECLARATION -/** -* CPsClientTestSuite test class for STIF Test Framework TestScripter. -* @since S60 v3.2 +/*** CPsClientTestSuite test class for STIF Test Framework TestScripter. +* @since S60 v3.2 */ NONSHARABLE_CLASS(CPsClientTestSuite) : public CScriptBase, public MPsResultsObserver { -public: // Constructors and destructor + public: // Constructors and destructor /** * First phase constructor constructor. @@ -58,53 +57,50 @@ */ virtual ~CPsClientTestSuite(); - - -public: // Functions from base classes + public: // Functions from base classes /** * From CScriptBase Runs a script line. - * + * * @param aItem Script line containing method name and parameters * @return Symbian OS error code */ virtual TInt RunMethodL( CStifItemParser& aItem ); - -public: // Function from base class MPsResultsObserver - /** - * HandlePsResultsUpdateL. - * Handle updates from the Ps server. - * - * @param searchResults Search results returned from the server. - * @param searchSeqs List of matching character sequences. - */ - void HandlePsResultsUpdate(RPointerArray& searchResults, - RPointerArray& searchSeqs); - - /** - * HandlePsError. - * Handle errors from the server. - * - * @param aErrorCode Search errors returned from the server. - */ - void HandlePsError(TInt aErrorCode); - + + public: // Function from base class MPsResultsObserver + + /** + * HandlePsResultsUpdateL. + * Handle updates from the Ps server. + * + * @param searchResults Search results returned from the server. + * @param searchSeqs List of matching character sequences. + */ + void HandlePsResultsUpdate(RPointerArray& searchResults, + RPointerArray& searchSeqs); + + /** + * HandlePsError. + * Handle errors from the server. + * + * @param aErrorCode Search errors returned from the server. + */ + void HandlePsError(TInt aErrorCode); + /** * CachingStatus * Gets called when caching is completed. * Observers need to implement this function accordingly * to take action after cache completion * - * @param aStatus - caching status, - * 20 - Caching completes succesfully, + * @param aStatus - caching status, + * 20 - Caching completes succesfully, * 30 - Caching completed with errors * @param aError - Any error that occurred while caching. KErrNone if no error else the error code */ - void CachingStatus(TCachingStatus& aStatus, TInt& aError); - + void CachingStatus(TCachingStatus& aStatus, TInt& aError); - -private: + private: /** * C++ default constructor. @@ -118,233 +114,236 @@ /** * Frees all resources allocated from test methods. - * */ void Delete(); - - - -private: //Test cases - + + private: //Test cases + /** * This method writes the test case title to the log file */ TInt WriteTitleToLog( ); /** - * This test case creates contacts in the phonebook - * - * @param aItem Script line containing parameters. - */ - TInt CreateContactsL( CStifItemParser& aItem ); - - /** - * This test case creates groups in the phonebook. It creats only - * empty groups, i.e the groups do not have any members. - * - * @param aItem Script line containing parameters. - */ - TInt CreateGroupsInPhoneL( CStifItemParser& aItem ); - - /** - * This test case fires a search query to the psengine - * - * @param aItem Script line containing parameters. - * @return - error status - KErrNone if test case is successful - */ + * This test case creates contacts in the phonebook + * + * @param aItem Script line containing parameters. + */ + TInt CreateContactsL( CStifItemParser& aItem ); + + /** + * This test case creates groups in the phonebook. It creats only + * empty groups, i.e the groups do not have any members. + * + * @param aItem Script line containing parameters. + */ + TInt CreateGroupsInPhoneL( CStifItemParser& aItem ); + + /** + * This test case fires a search query to the psengine + * + * @param aItem Script line containing parameters. + * @return - error status - KErrNone if test case is successful + */ TInt SearchCacheL( CStifItemParser& aItem ); - + /** - * This test case cancels a search query to the psengine - * - * - * @param aItem Script line containing parameters. - * @return - error status - KErrNone if test case is successful - */ + * This test case cancels a search query to the psengine + * + * @param aItem Script line containing parameters. + * @return - error status - KErrNone if test case is successful + */ TInt CancelSearchL( CStifItemParser& aItem ); - - /** - * This test case searches for a query in the given input string - * - * @param aItem Script line containing parameters. - * @return - error status - KErrNone if test case is successful - */ - TInt SearchOnInputStringL(CStifItemParser& aItem); - /** + /** + * This test case searches for a query in the given input string + * + * @param aItem Script line containing parameters. + * @return - error status - KErrNone if test case is successful + */ + TInt SearchOnInputStringL(CStifItemParser& aItem); + + /** * This test case searches for a query with LookupMatch * and ensures the result string is correct * * @param aItem Script line containing parameters. * @return - error status - KErrNone if test case is successful */ - TInt SearchLookupMatchStringL(CStifItemParser& aItem); - - /** - * This method deletes all the contacts in the phonebook - * - * @param aItem Script line containing parameters. - * @return - error status - KErrNone if test case is successful - */ - TInt DeleteAllContactsInPhonebookL(CStifItemParser& aItem); - - /** - * This method checks the caching status - * - * @return - error status - KErrNone if test case is successful - */ - TInt CheckCachingStatusL(); - - - /** - * This method checks the version of the ps server - * - * @return - error status - KErrNone if test case is successful - */ - TInt CheckVersion(); + TInt SearchLookupMatchStringL(CStifItemParser& aItem); + + /** + * This test case requests the Adaptive Grid + * and ensures the result string is correct + * + * @param aItem Script line containing parameters. + * @return - error status - KErrNone if test case is successful + */ + TInt CheckAdaptiveStringL(CStifItemParser& aItem); + + /** + * This method deletes all the contacts in the phonebook + * + * @param aItem Script line containing parameters. + * @return - error status - KErrNone if test case is successful + */ + TInt DeleteAllContactsInPhonebookL(CStifItemParser& aItem); - /** - * This method checks if a particular language is supported by the ps server - * - * @return - error status - KErrNone if test case is successful - */ - TInt TestIsLanguageSupportedL(CStifItemParser& aItem); - + /** + * This method checks the caching status + * + * @return - error status - KErrNone if test case is successful + */ + TInt CheckCachingStatusL(); + + /** + * This method checks the version of the ps server + * + * @return - error status - KErrNone if test case is successful + */ + TInt CheckVersion(); + + /** + * This method checks if a particular language is supported by the ps server + * + * @return - error status - KErrNone if test case is successful + */ + TInt TestIsLanguageSupportedL(CStifItemParser& aItem); + /** - * This method waits for time equal to the input parameter - * @param aInterval The wait interval - */ - void RTimerWait(TTimeIntervalMicroSeconds32 aInterval); - - /** - * This method checks gets all the contents from a particular URI (as specified in the configuration) - * - * @return - error status - KErrNone if test case is successful - */ - TInt GetAllContentsL( CStifItemParser& aItem ); - - /** - * This method searches in a particular group. The group name is given as a - * configuration parameter. - * - * @return - error status - KErrNone if test case is successful - */ - TInt SearchWithInGroupL(CStifItemParser& aItem ); - - - /** - * This method tests the sort order - * - * @return - error status - KErrNone if test case is successful - */ - TInt TestSortOrderL( CStifItemParser& aItem ); - - /** - * This method tests the sort order for error case - * - * @return - error status - KErrNone if test case is successful - */ - TInt TestSortOrderErrCaseL( CStifItemParser& aItem ); - /** - * This method removes the observer from ps searchengine - * - * @return - error status - KErrNone if test case is successful - */ - TInt RemoveObserverL(CStifItemParser& aItem); - - /** - * Tests if contact Id returns correct vpbklink + * This method waits for time equal to the input parameter + * + * @param aInterval The wait interval + */ + void RTimerWait(TTimeIntervalMicroSeconds32 aInterval); + + /** + * This method checks gets all the contents from a particular URI (as specified in the configuration) + * + * @return - error status - KErrNone if test case is successful + */ + TInt GetAllContentsL( CStifItemParser& aItem ); + + /** + * This method searches in a particular group. The group name is given as a + * configuration parameter. + * + * @return - error status - KErrNone if test case is successful + */ + TInt SearchWithInGroupL(CStifItemParser& aItem ); + + /** + * This method tests the sort order + * + * @return - error status - KErrNone if test case is successful + */ + TInt TestSortOrderL( CStifItemParser& aItem ); + + /** + * This method tests the sort order for error case + * + * @return - error status - KErrNone if test case is successful + */ + TInt TestSortOrderErrCaseL( CStifItemParser& aItem ); + + /** + * This method removes the observer from ps searchengine + * + * @return - error status - KErrNone if test case is successful + */ + TInt RemoveObserverL(CStifItemParser& aItem); + + /** + * Tests if contact Id returns correct vpbklink * * @return - - error status - KErrNone if test case is successful */ - TInt ConvertToVpbkLinkL(CStifItemParser& aItem); - - /** - * Tests for bookmarked contacts + TInt ConvertToVpbkLinkL(CStifItemParser& aItem); + + /** + * Tests for bookmarked contacts * * @return error status - KErrNone if test case is successful */ - TInt AddMarkedContactsTestL(CStifItemParser& aItem); - - /** - * Tests for data order + TInt AddMarkedContactsTestL(CStifItemParser& aItem); + + /** + * Tests for data order * * @return error status - KErrNone if test case is successful */ - TInt TestDataOrderL(CStifItemParser& aItem); - - /** - * Tests for data order + TInt TestDataOrderL(CStifItemParser& aItem); + + /** + * Tests for data order * * @return error status - KErrNone if test case is successful */ - TInt TestDataOrderForErrL(CStifItemParser& aItem); - - - /** - * This method shuts the server down - * - * @return - error status - KErrNone if test case is successful - */ - TInt ShutDownL(); + TInt TestDataOrderForErrL(CStifItemParser& aItem); + + /** + * This method shuts the server down + * + * @return - error status - KErrNone if test case is successful + */ + TInt ShutDownL(); + + private: // Data + + /** + * The input data parser + * own + */ + CTestSuiteInputData* iInputParsedData; + + /** + * The search query + */ + CPsQuery *iPsQuery; + + /** + * The CPSRequestHandler instance + */ + CPSRequestHandler* iPsClientHandler; + + /** + * The search settings + */ + CPsSettings* iSettings ; -private: // Data - - /** - * The input data parser - * own - */ - CTestSuiteInputData* iInputParsedData; - - /** - * The search query - */ - CPsQuery *iPsQuery; - - /** - * The CPSRequestHandler instance - */ - CPSRequestHandler* iPsClientHandler; - - /** - * The search settings - */ - CPsSettings* iSettings ; - - /** - * The error return status - */ - TInt iReturnStatus; - - /** - * The group Id of the group name entered in the configuration file - */ - TInt iGroupToBeSearchedId; - - /** - * The current operation being performed - */ - TTestCase iCurrentOperation; - - /** - * RTimer variable to set the timer before RunL calls any function. - * This is required to allow other threads to run since contact fetch - * is CPU intensive task. - */ - RTimer iTimer; - - /** - * The caching status of the psengine - */ - TCachingStatus iCachingStatus; - - /** - * The marked contacts - */ - RPointerArray iMarkedContacts; + /** + * The error return status + */ + TInt iReturnStatus; + + /** + * The group Id of the group name entered in the configuration file + */ + TInt iGroupToBeSearchedId; + + /** + * The current operation being performed + */ + TTestCase iCurrentOperation; + /** + * RTimer variable to set the timer before RunL calls any function. + * This is required to allow other threads to run since contact fetch + * is CPU intensive task. + */ + RTimer iTimer; + + /** + * The caching status of the psengine + */ + TCachingStatus iCachingStatus; + + /** + * The marked contacts + */ + RPointerArray iMarkedContacts; }; -#endif // PS_CLIENT_TEST_SUITE_H +#endif // PS_CLIENT_TEST_SUITE_H // End of File diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h Mon Jul 12 13:42:58 2010 +0100 @@ -27,7 +27,7 @@ #include #include -//User Include +//User Include #include "psclienttestsuitedefs.h" //Forward Declaration @@ -50,10 +50,10 @@ /** * Destructor. */ - virtual ~CTestSuiteInputData(); - + virtual ~CTestSuiteInputData(); + public: // Functions - + /** * Provides the Keyboard mode of this object * @@ -62,12 +62,12 @@ TDesC& KeyboardMode() const; /** - * Sets the Keyboard mode of this object + * Sets the Keyboard mode of this object * - * @param aKeyboardMode The Keyboard mode + * @param aKeyboardMode The Keyboard mode */ void SetKeyboardModeL(const TDesC& aKeyboardMode); - + /** * Returns the search query, as specified in the configuration parameter * @@ -76,12 +76,12 @@ TDesC& Query() const; /** - * Sets the search query + * Sets the search query * - * @param aQuery The Query + * @param aQuery The Query */ void SetQueryL(const TDesC& aQuery); - + /** * Pointer to the data element at the specified location * @@ -93,17 +93,17 @@ /** * Adds the cachedata to the array of input cache data * - * @param aInputCacheData + * @param aInputCacheData */ void AppendInputCacheDataL(const cacheData& aInputCacheData); - + /** * Returns the number of Input Cache Data elements * * @return Number of Input Cache Data elements */ TInt InputCacheDataCount() const; - + /** * Returns the array of cachedata of the result data * @@ -114,24 +114,24 @@ /** * Appends cachedata to the the aResultData * - * @param aResultData + * @param aResultData */ void AppendResultDataL(const cacheData& aResultData); - + /** * Returns the number of ResultData elements * * @return Number of ResultData elements */ TInt ResultDataCount() const; - + /** - * Returns the sort type + * Returns the sort type * * @return sort Type */ TSortType GetSortType(); - + /** * Returns the pointer to the uri at the specified location * @@ -145,89 +145,93 @@ * * @param aCacheUri Cache Uri descriptor to be searched */ - void ApendCacheUrisL(RPointerArray& aCacheUriArray); - + void ApendCacheUrisL(RPointerArray& aCacheUriArray); + /** * Returns the number of Cache Uris (data stores) * * @return Number of Cache Uris (data stores) */ TInt CacheUrisCount() const; - + /* * Returns the Input language (as specified in the configuration file) */ TLanguage LanguageInput(); - + /* - * Returns the expected result for the Input language + * Returns the expected result for the Input language * (as specified in the configuration file) */ TBool LanguageInputExpectedResult(); /* - * Parses the input data - * + * Parses the input data + * * @param aItem - The input test case name and parmeters */ void ParseInputL(CStifItemParser& aItem); - + /* * Creates contacts in the phonebook. The contact data is taken from iInputCacheData */ - void CreateContactsL(); - + void CreateContactsL(); + /* * Creates the search query - * - * @param aPsQuery - The search query as needed by the ps engine - * @param aQueryBuf - The input search query + * + * @param aPsQuery - The search query as needed by the ps engine + * @param aQueryBuf - The input search query */ void CreateSearchQueryL(CPsQuery& aPsQuery,TDesC& aQueryBuf); - + /* * Performs the search settings - * + * * @param aSettings - The search settings */ void PerformSearchSettingsL(CPsSettings& aSettings); - - + /* * compares the search results with expected results - * + * * @param aSettings - The search results */ TInt CompareResWithExpResL(RPointerArray& searchResults); TInt ExactMatchCompareInputDataWithResultDataL(RPointerArray& searchResults); - + /* * Deletes all the created contacts */ void DeleteAllCreatedContactsL(); - + /* * Deletes contacts with specific ids */ void DeleteContactsWithIdsL(RArray& aContactIdArray); - + /* - * Returns the input search string - */ + * Returns the input search string + */ TDesC& InputSearchString() const; - + /* - * Returns the input search string - */ + * Returns the input search string + */ const TDesC& ExpectedResultString() const; - + + /* + * Returns the input boolean + */ + TBool InputBoolean() const; + /* * Return the group name to be searched (as specified in configuration file) */ TDesC& GroupToBeSearched() const; - - /** - * Tests if Id returns correct vpbklink - * + + /* + * Tests if Id returns correct vpbklink + * * @param aPsClientHandler - PsClientHandler instance * @param srchId - Id to be tested\ * @return - ETrue if Id returns correct link, else EFalse @@ -235,19 +239,19 @@ TBool TestVpbkLinkForIdL(CPSRequestHandler& aPsClientHandler,const CPsClientData& aSearchResult); /** - * Returns ths sort order - * + * Returns ths sort order + * * @param aSortOrder - The sort order */ void SortOrder(RArray& aSortOrder); /* - * Return array of expected result locations data + * Return array of expected result locations data */ const RArray& ExpectedLocations(); - + private: // functions - + /** * Default Constructor */ @@ -257,8 +261,8 @@ * Second phase constructor */ void ConstructL(CStifItemParser& aItem,CPSRequestHandler& aPsClientHandler); - -private: // Private functions for internal Parsing data + +private: // Private functions for internal Parsing data void ParseInputForContactsDataL(TDesC& aInput, TInt aType); void AddSingleContactDataL(TDesC& aInput, TInt aType); void ParseInputForMatchLocationsL(TDesC& aInput); @@ -268,105 +272,111 @@ TBool CompareInputDataWithResultDataL(CPsClientData& aResData,cacheData aInputData); void ParseInputForDisplayFieldsL(TDesC& aInput); void ParseInputInputSearchStringL(TDesC& aInput); - void ParseInputExpectedResultStringL(TDesC& aInput); + void ParseInputExpectedResultStringL(TDesC& aInput); + void ParseInputInputBoolean(TDesC& aInput); void ParseInputForLanguageSupportL(TDesC& aInput); void ParseInputForAddingGroupsL(TDesC& aInput); void ParseInputForSearchWithinGroupL(TDesC& aInput); void ParseInputForSortOrderL(TDesC& aInput); TInt GetFieldIdFromVpbkIdentifierL(TDesC& aIdentifierAsString); -private: // data +private: // data - /* + /* * Array of cache data elements */ RPointerArray iInputCacheData; - - /* + + /* * Array of cache data elements of the expected results */ RPointerArray iResultData; - + /* * Array of expected result locations data */ RArray iExpectedLocations; - - /* - * Array of cache uris to be searched + + /* + * Array of cache uris to be searched */ RPointerArray iCacheUris; - - /* - * Keyboard mode + + /* + * Keyboard mode */ - HBufC* iKeyboardModeBuf; - - /* + HBufC* iKeyboardModeBuf; + + /* * The search query */ HBufC* iQueryBuf; - - /* + + /* * The contacts handler. Performs the operations related to virtual phone book - */ + */ CPcsTestContactsHandler * iContactHandler; - - /* - * The client handler + + /* + * The client handler */ CPSRequestHandler* iPsClientHandler; - - /* + + /* * Flag indicating if the contacts have been created */ TBool iContactAlreadyCreated; - - /* + + /* * The list of display fields */ RArray iDisplayFields; - - /* + + /* * The input search string */ HBufC* iInputSearchString; - - /* + + /* * The expected result string */ - HBufC* iExpectedResultString; - - /* + HBufC* iExpectedResultString; + + /* + * The input boolean + */ + TBool iInputBoolean; + + /* * The input language id */ TLanguage iLangId; - - /* + + /* * Flag indicating if the language is supported */ TBool iIsLangSupported; - - /* + + /* * The group to be searched */ HBufC* iGroupToBeSearched; - - /* + + /* * The sort Type */ TSortType iSortType; - + /* * The sort order */ RArray iSortOrder; - + /* * The max number of results */ TInt iMaxNumberOfResults; - + }; #endif // TEST_SUITE_INPUT_DATA_H diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h Mon Jul 12 13:42:58 2010 +0100 @@ -78,6 +78,7 @@ _LIT(KSearchOnInputString, "IPSTR"); // The Input string tag for search in input string _LIT(KExpectedResultString, "RESSTR"); // Expected string result _LIT(KSearchExpectedResultForInput, "RESIP"); // Expected result (For input search string case) +_LIT(KInputBoolean, "BOOL"); // Input Boolean for cases that need it // The enumeration used to specify the type of test case enum TTestCase diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h Mon Jul 12 13:42:58 2010 +0100 @@ -55,14 +55,14 @@ { public: - /** + /** * 1st phase constructor * * @return returns pointer to the constructed object of type CPcsContactFetch */ static CPcsTestContactsHandler* NewL(TBool SimStoreOnly=EFalse); - /** + /** * Destructor * */ @@ -71,7 +71,8 @@ public: //From CActive - /** + + /** * From CActive * Implements cancellation of an outstanding request. * @@ -79,7 +80,6 @@ */ void DoCancel(); - /** * From CActive * Handles an active object's request completion event. @@ -105,8 +105,7 @@ * RunError() functions. */ void RunL() ; - - + /** * From CActive * If the RunL function leaves, @@ -115,7 +114,6 @@ */ TInt RunError(TInt aError) ; - // From base class MVPbkContactStoreListObserver /** @@ -185,8 +183,8 @@ */ void StepComplete(MVPbkContactOperationBase& aOperation, TInt aStepSize ); +// From MVPbkBatchOperationObserver -// From MVPbkBatchOperationObserver /** * From MVPbkBatchOperationObserver * Called when one step of the operation fails. @@ -235,15 +233,13 @@ * */ void DeleteAllCreatedContactsL(); - - + /** * Adds a group to the phonebook * */ void AddGroupL(const TDesC& aGroupName); - /** * Deletes contacts from the phonebook * @@ -252,7 +248,7 @@ void DeleteContactsWithIdsL(RArray& aContactIdArray); /** - * Tests if Id returns correct vpbklink + * Tests if Id returns correct vpbklink * * @param aPsClientHandler - PsClientHandler instance * @param srchId - Id to be tested\ @@ -266,14 +262,15 @@ */ void AddCreatedContactsToGroup(); + private: - /** + + /** * Constructor - * */ CPcsTestContactsHandler(); - /** + /** * 2nd phase constructor * * @param SimStoreOnly @@ -312,7 +309,6 @@ */ CVPbkFieldTypeRefsList* fieldTypeRefList; - /* * The array of contactlinks to be deleted */ diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h Mon Jul 12 13:42:58 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: +* Description: * */ @@ -32,87 +32,85 @@ // CLASS DECLARATION /** - * - * - * - * - * @lib + * @lib * @since S60 v3.2 */ class CPsTestQueryHandler: public CBase, - public MPsResultsObserver + public MPsResultsObserver { - - public: // Constructors and destructor + + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CPsTestQueryHandler* NewL(); + + /** + * Destructor. + */ + virtual ~CPsTestQueryHandler(); + + public: // New functions - /** - * Two-phased constructor. - */ - static CPsTestQueryHandler* NewL(); + /** + * Sets the test case currently being executed + * + * @param aCurrentTestCase Current test case. + */ + void SetCurrentTestCase(TTestCase aCurrentTestCase); - /** - * Destructor. - */ - virtual ~CPsTestQueryHandler(); + /** + * Sets the error code for test case + * + * @param aCurrentErrorCode Error code for the test case. + */ + void SetCurrentErrorCode(TInt aCurrentErrorCode); + + /** + * Returns the error code for test case + * + * @return Error code for the test case. + */ + TInt CurrentErrorCode(); - public: // New functions - /** - * Sets the test case currently being executed - * - * @param aCurrentTestCase Current test case. - */ - void SetCurrentTestCase(TTestCase aCurrentTestCase); - - /** - * Sets the error code for test case - * - * @param aCurrentErrorCode Error code for the test case. - */ - void SetCurrentErrorCode(TInt aCurrentErrorCode); - - /** - * Returns the error code for test case - * - * @return Error code for the test case. - */ - TInt CurrentErrorCode(); - - void GetAllContentsL(); - - void StartSearchL(const CPsQuery& aSearchQuery); - - void TestSearchL(const TDesC& aBuf, TKeyboardModes aMode); - - void InputSearchL(const CPsQuery& aSearchQuery, const TDesC& aInput, RPointerArray& aResultSet); - - void SetSearchSettingsL(RPointerArray& aSearchUri, RArray& aDisplayFields, TInt aMaxResults); - - void ShutDownL(); - - void Cancel(); - - TVersion Version(); - - TBool IsLanguageSupportedL(TLanguage aLang); + void GetAllContentsL(); + + void StartSearchL(const CPsQuery& aSearchQuery); + + void TestSearchL(const TDesC& aBuf, TKeyboardModes aMode); + + void InputSearchL(const CPsQuery& aSearchQuery, const TDesC& aInput, RPointerArray& aResultSet); + + void SetSearchSettingsL(RPointerArray& aSearchUri, RArray& aDisplayFields, TInt aMaxResults); + + void ShutDownL(); + + void Cancel(); + + TVersion Version(); + + TBool IsLanguageSupportedL(TLanguage aLang); - public: // Function from base class MPsResultsObserver - /** - * HandlePsResultsUpdateL. - * Handle updates from the server. - * - * @param searchResults Search results returned from the server. - * @param searchSeqs List of matching character sequences. - */ - void HandlePsResultsUpdate(RPointerArray& searchResults, RPointerArray& searchSeqs); - - /** - * HandlePsError. - * Handle errors from the server. - * - * @param aErrorCode Search errors returned from the server. - */ - void HandlePsError(TInt aErrorCode); - + public: // Function from base class MPsResultsObserver + + /** + * HandlePsResultsUpdateL. + * Handle updates from the server. + * + * @param searchResults Search results returned from the server. + * @param searchSeqs List of matching character sequences. + */ + void HandlePsResultsUpdate(RPointerArray& searchResults, RPointerArray& searchSeqs); + + /** + * HandlePsError. + * Handle errors from the server. + * + * @param aErrorCode Search errors returned from the server. + */ + void HandlePsError(TInt aErrorCode); + /** * CachingStatus * Gets called when caching is completed. @@ -121,55 +119,56 @@ * @param aStatus - caching status, 20 - Caching completes succesfully, 30 - Caching completed with errors * @param aError - Any error that occurred while caching. KErrNone if no error else the error code */ - void CachingStatus(TCachingStatus& aStatus, TInt& aError); + void CachingStatus(TCachingStatus& aStatus, TInt& aError); + + public: + + /** + * Sets the list of contacts created for test case + * + * @param aContactsList List of contacts (each contact as CPsClientData). + */ + void SetContactsDetails(RPointerArray& aContactsList); - public: - /** - * Sets the list of contacts created for test case - * - * @param aContactsList List of contacts (each contact as CPsClientData). - */ - void SetContactsDetails(RPointerArray& aContactsList); - - TInt IndexForGroupDataL(); - - private: - /** - * C++ default constructor. - */ - CPsTestQueryHandler(); + TInt IndexForGroupDataL(); + + private: - /** - * Symbian 2nd phase constructor. - */ - void ConstructL(); + /** + * C++ default constructor. + */ + CPsTestQueryHandler(); + + /** + * Symbian 2nd phase constructor. + */ + void ConstructL(); private: - void FormTestSearchQueryL(const TDesC& aBuf, TKeyboardModes aMode); - - void VerifyResult(RPointerArray& aSearchResults, TBool aResultType); - - TBool VerifySortResult(RPointerArray& aSearchResults); - - void SwitchEPsData(RPointerArray& searchResults); - - TInt CompareByData ( const CPsClientData& aObject1, const CPsClientData& aObject2 ); + void FormTestSearchQueryL(const TDesC& aBuf, TKeyboardModes aMode); + + void VerifyResult(RPointerArray& aSearchResults, TBool aResultType); + + TBool VerifySortResult(RPointerArray& aSearchResults); + + void SwitchEPsData(RPointerArray& searchResults); - private: // data + TInt CompareByData ( const CPsClientData& aObject1, const CPsClientData& aObject2 ); + + private: // data - TTestCase iCurrentTestCase; - - TInt iCurrentErrorCode; - + TTestCase iCurrentTestCase; + + TInt iCurrentErrorCode; + CPSRequestHandler* iAsyncHandler; - CPsSettings* iSettings; + CPsSettings* iSettings; - CPsQuery *iPsQuery; - - RPointerArray iContactsList; + CPsQuery *iPsQuery; + RPointerArray iContactsList; }; #endif //PSTEST_QUERY_HANDLER_H diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -33,7 +33,6 @@ // C++ default constructor can NOT contain any code, that // might leave. // ----------------------------------------------------------------------------- -// CPsClientTestSuite::CPsClientTestSuite(CTestModuleIf& aTestModuleIf):CScriptBase( aTestModuleIf ) { } @@ -41,7 +40,6 @@ // ----------------------------------------------------------------------------- // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- -// void CPsClientTestSuite::ConstructL() { // Local timer for block fetch delay. This is created as first step to @@ -101,7 +99,6 @@ // ----------------------------------------------------------------------------- // Two-phased constructor. // ----------------------------------------------------------------------------- -// CPsClientTestSuite* CPsClientTestSuite::NewL( CTestModuleIf& aTestModuleIf ) { CPsClientTestSuite* self = new (ELeave) CPsClientTestSuite( aTestModuleIf ); @@ -113,7 +110,9 @@ return self; } +// ----------------------------------------------------------------------------- // Destructor +// ----------------------------------------------------------------------------- CPsClientTestSuite::~CPsClientTestSuite() { // Delete resources allocated from test methods @@ -138,7 +137,6 @@ { delete iInputParsedData; iInputParsedData = NULL; - } if(iSettings) @@ -158,11 +156,9 @@ // LibEntryL is a polymorphic Dll entry point. // Returns: CScriptBase: New CScriptBase derived object // ----------------------------------------------------------------------------- -// EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework { return ( CScriptBase* ) CPsClientTestSuite::NewL( aTestModuleIf ); } - // End of File diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -71,6 +71,7 @@ ENTRY( "TC_ITU_TestSearchingInCache", CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file ENTRY( "TC_N97_TestSearchingInCache", CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file ENTRY( "TC_N00_TestSearchingInCache", CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file + ENTRY( "CheckAdaptiveString", CPsClientTestSuite::CheckAdaptiveStringL ), ENTRY( "CheckCachingStatus", CPsClientTestSuite::CheckCachingStatusL ), ENTRY( "CheckVersion", CPsClientTestSuite::CheckVersion), ENTRY( "CheckLanguageSupport", CPsClientTestSuite::TestIsLanguageSupportedL), @@ -137,6 +138,9 @@ return iReturnStatus; } +// ----------------------------------------------------------------------------- +// This test case creates groups in the phonebook +// ----------------------------------------------------------------------------- TInt CPsClientTestSuite::CreateGroupsInPhoneL( CStifItemParser& aItem ) { iReturnStatus = KErrNone; @@ -422,7 +426,6 @@ return iReturnStatus; } - // ----------------------------------------------------------------------------- // Searches for a query in input string. // ----------------------------------------------------------------------------- @@ -459,6 +462,67 @@ } // ----------------------------------------------------------------------------- +// Checks the Adaptive Grid string. +// ----------------------------------------------------------------------------- +TInt CPsClientTestSuite::CheckAdaptiveStringL(CStifItemParser& aItem) +{ + RTimerWait(KOneSecDelay); + iReturnStatus = KErrNone; + + // Create the input parser + iInputParsedData = CTestSuiteInputData::NewL(aItem,*iPsClientHandler); + + // Parse the input data + iInputParsedData->ParseInputL(aItem); + + // If more than one cacheuris are configured, this is not + // supported by the test suite + HBufC* dataStore = HBufC::NewL(50); + if(iInputParsedData->CacheUrisCount() == 1) + { + dataStore->Des().Copy(iInputParsedData->CacheUris(0)); + } + else + { + User::Leave(KErrArgument); + } + + CDesCArrayFlat* dataStoreArr = NULL; + dataStoreArr = new (ELeave) CDesCArrayFlat( 1 ); + CleanupStack::PushL( dataStoreArr ); + dataStoreArr->AppendL( *dataStore ); + + // Search Text + //Get the input string + HBufC* searchText = iInputParsedData->InputSearchString().AllocL(); + + // Company Name + TBool companyName = iInputParsedData->InputBoolean(); + + TBuf result; + // Wait for one second + RTimerWait(KOneSecDelay); + + TPtrC16 ptr = dataStoreArr->MdcaPoint(0); + + // Get the Adaptive Grid + iPsClientHandler->GetAdaptiveGridCharactersL( *dataStoreArr, + searchText->Des(), + companyName, + result ); + + CleanupStack::PopAndDestroy( dataStoreArr ); + delete dataStore; + + if ( iInputParsedData->ExpectedResultString() != result ) + { + iReturnStatus = KErrArgument; + } + + return iReturnStatus; +} + +// ----------------------------------------------------------------------------- // Stores the caching status of the psengine // ----------------------------------------------------------------------------- void CPsClientTestSuite::CachingStatus(TCachingStatus& aStatus, TInt& /*aError*/) @@ -594,7 +658,6 @@ else { iReturnStatus = KErrGeneral; - } return iReturnStatus; @@ -628,8 +691,6 @@ // return error code return iReturnStatus; - - } // ----------------------------------------------------------------------------- @@ -710,7 +771,7 @@ //If more than one cacheuris are configured, then it is an error HBufC* datastore = HBufC::NewL(50); - if(iInputParsedData->CacheUrisCount() ==1) + if(iInputParsedData->CacheUrisCount() == 1) { datastore->Des().Copy(iInputParsedData->CacheUris(0)); } @@ -723,7 +784,6 @@ RArray inputSortOrder; iInputParsedData->SortOrder(inputSortOrder); - //Set the sort order iPsClientHandler->ChangeSortOrderL(*datastore,inputSortOrder); @@ -745,9 +805,8 @@ { iReturnStatus = KErrArgument; } - + delete temp; temp = NULL; - } } else @@ -797,7 +856,6 @@ // set search settings iPsClientHandler->SetSearchSettingsL(*iSettings); - // Create the search query iInputParsedData->CreateSearchQueryL(*iPsQuery, iInputParsedData->GroupToBeSearched()); @@ -935,7 +993,8 @@ //Perform the search iPsClientHandler->SearchL(*iPsQuery,iMarkedContacts,NULL); CActiveScheduler::Start(); - return iReturnStatus; + + return iReturnStatus; } // ----------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -116,6 +116,14 @@ } // ---------------------------------------------------------------------------- +// Returns the Input boolean (as specified in the config file) +// ---------------------------------------------------------------------------- +TBool CTestSuiteInputData::InputBoolean() const +{ + return iInputBoolean; +} + +// ---------------------------------------------------------------------------- // Sets the search query // // ---------------------------------------------------------------------------- @@ -206,7 +214,8 @@ // Sets the cache uris // ---------------------------------------------------------------------------- void CTestSuiteInputData::ApendCacheUrisL(RPointerArray& aCacheUriArray) -{ iCacheUris.ResetAndDestroy(); +{ + iCacheUris.ResetAndDestroy(); for(TInt i =0; i databases; // list of databases @@ -733,7 +743,6 @@ // This function compares the searchResults with expected results // The expected results are stored in iResultData // ----------------------------------------------------------------------------- - TInt CTestSuiteInputData::CompareResWithExpResL(RPointerArray& searchResults) { TInt returnStatus = KErrNone; @@ -849,6 +858,25 @@ } // ----------------------------------------------------------------------------- +// This function parses the input expected result string +// ----------------------------------------------------------------------------- +void CTestSuiteInputData::ParseInputInputBoolean(TDesC& aInput) +{ + if(aInput.Compare(KTrue) == 0) + { + iInputBoolean = ETrue; + } + else if(aInput.Compare(KFalse) == 0) + { + iInputBoolean = EFalse; + } + else + { + User::Leave(KErrArgument); + } +} + +// ----------------------------------------------------------------------------- // Deletes all the created contacts // ----------------------------------------------------------------------------- void CTestSuiteInputData::DeleteAllCreatedContactsL() @@ -900,7 +928,6 @@ iIsLangSupported = ETrue; } else if(langData[1]->Compare(KFalse) == 0) - { iIsLangSupported = EFalse; } @@ -969,7 +996,7 @@ // ----------------------------------------------------------------------------- TBool CTestSuiteInputData::TestVpbkLinkForIdL(CPSRequestHandler& aPsClientHandler,const CPsClientData& aSearchResult) { - return iContactHandler->TestVpbkLinkForIdL(aPsClientHandler,aSearchResult); + return iContactHandler->TestVpbkLinkForIdL(aPsClientHandler,aSearchResult); } // ----------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -109,7 +109,7 @@ } else { - iStore = iContactManager->ContactStoresL().Find( TVPbkContactStoreUriPtr( VPbkContactStoreUris::DefaultCntDbUri() ) ); + iStore = iContactManager->ContactStoresL().Find( TVPbkContactStoreUriPtr( VPbkContactStoreUris::DefaultCntDbUri() ) ); } iStore->OpenL( *this ); @@ -128,10 +128,8 @@ // --------------------------------------------------------------------------------- // Destructor // --------------------------------------------------------------------------------- - CPcsTestContactsHandler::~CPcsTestContactsHandler() { - delete iWait; iWait = NULL; @@ -145,7 +143,7 @@ iContactLinksToAddToGroup->ResetAndDestroy(); delete iContactLinksToAddToGroup; } -//plese note you shouldn't close stores before cleaning links arrays + //plese note you shouldn't close stores before cleaning links arrays if ( iContactManager ) { TRAP_IGNORE(iContactManager->ContactStoresL().CloseAll( *this )); @@ -155,10 +153,9 @@ if(iOp) { - delete iOp ; - iOp = NULL; + delete iOp ; + iOp = NULL; } - } // --------------------------------------------------------------------------- @@ -168,9 +165,9 @@ { iOpenComplete = ETrue; if( iWait->IsStarted() ) - { + { iWait->AsyncStop(); - } + } } // --------------------------------------------------------------------------- @@ -198,11 +195,10 @@ void CPcsTestContactsHandler::HandleStoreEventL(MVPbkContactStore& /*aContactStore*/, TVPbkContactStoreEvent aStoreEvent) { - if ( aStoreEvent.iEventType == iStoreEventToWaitFor ) - { + { iExpectedStoreEventReceived = ETrue; - } + } switch (aStoreEvent.iEventType) { @@ -295,7 +291,6 @@ // --------------------------------------------------------------------------------- // This fucntion deletes all the created contacts // --------------------------------------------------------------------------------- - void CPcsTestContactsHandler::DeleteAllCreatedContactsL() { if(iContactsCreatedLinks->Count()) @@ -314,7 +309,6 @@ // --------------------------------------------------------------------------------- // This fucntion adds a group // --------------------------------------------------------------------------------- - void CPcsTestContactsHandler::AddGroupL(const TDesC& aGroupName) { iGroupAdded = iStore->CreateNewContactGroupLC(); @@ -363,12 +357,12 @@ // Stops main active scheduler loop if stop conditions are fullfiled // --------------------------------------------------------------------------------- void CPcsTestContactsHandler::StopSchedulerIfNothingToWaitFor() - { - if( iOperationComplete && iExpectedStoreEventReceived ) +{ + if( iOperationComplete && iExpectedStoreEventReceived ) { CActiveScheduler::Stop(); } - } +} // --------------------------------------------------------------------------------- // Called when a contact operation has succesfully completed. @@ -537,4 +531,5 @@ iGroupAdded->AddContactL(iContactLinksToAddToGroup->At(i)); } } + // End of file diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -529,4 +529,5 @@ TInt comparison(data1.CompareC( data2, 3, &meth )); return comparison; } + // End of file diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h --- a/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h Mon Jul 12 13:42:58 2010 +0100 @@ -50,7 +50,8 @@ EGetSortOrder, ESetSortOrder, EShutdown, - ESearchMatchString + ESearchMatchString, + EGetAdaptiveGrid }; /** @@ -145,6 +146,8 @@ const TInt KPsQueryMaxLen = 150; const TInt KBufferMaxLen = 255; const TInt KSearchResultsBufferLen = 8192; +const TInt KPsAdaptiveGridSupportedMaxLen = 0; // Max Len of input Search Text +const TInt KPsAdaptiveGridStringMaxLen = 255; // Max Len of returned Adaptive Grid String /** * Data Stores Constants diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -16,7 +16,6 @@ */ - // SYSTEM INCLUDES #include #include @@ -32,9 +31,7 @@ // might leave. // ----------------------------------------------------------------------------- // -CPsUtilsTestSuite::CPsUtilsTestSuite( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) +CPsUtilsTestSuite::CPsUtilsTestSuite( CTestModuleIf& aTestModuleIf ): CScriptBase( aTestModuleIf ) { } @@ -78,18 +75,16 @@ } iLog = CStifLogger::NewL( KPsTestSuiteLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); } // ----------------------------------------------------------------------------- // Two-phased constructor. // ----------------------------------------------------------------------------- -CPsUtilsTestSuite* CPsUtilsTestSuite::NewL( - CTestModuleIf& aTestModuleIf ) +CPsUtilsTestSuite* CPsUtilsTestSuite::NewL( CTestModuleIf& aTestModuleIf ) { CPsUtilsTestSuite* self = new (ELeave) CPsUtilsTestSuite( aTestModuleIf ); @@ -98,22 +93,19 @@ CleanupStack::Pop(); return self; - } // ----------------------------------------------------------------------------- // Destructor // ----------------------------------------------------------------------------- CPsUtilsTestSuite::~CPsUtilsTestSuite() -{ - + { // Delete resources allocated from test methods Delete(); // Delete logger delete iLog; - -} + } // ========================== OTHER EXPORTED FUNCTIONS ========================= @@ -122,13 +114,9 @@ // Returns: CScriptBase: New CScriptBase derived object // ----------------------------------------------------------------------------- // -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework +EXPORT_C CScriptBase* LibEntryL( CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework { - return ( CScriptBase* ) CPsUtilsTestSuite::NewL( aTestModuleIf ); - } - // End of File diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -37,17 +37,15 @@ // ----------------------------------------------------------------------------- void CPsUtilsTestSuite::Delete() { - } // ----------------------------------------------------------------------------- // Run specified method. Contains also table of test mothods and their names. // ----------------------------------------------------------------------------- -TInt CPsUtilsTestSuite::RunMethodL( - CStifItemParser& aItem ) +TInt CPsUtilsTestSuite::RunMethodL( CStifItemParser& aItem ) { - TStifFunctionInfo const KFunctions[] = + TStifFunctionInfo const KFunctions[] = { // First string is the function name used in TestScripter script file. // Second is the actual implementation member function. @@ -58,14 +56,12 @@ ENTRY( "PsData_SetAndGetL", CPsUtilsTestSuite::PsData_SetAndGetL), ENTRY( "PsSettings_SetAndGetL", CPsUtilsTestSuite::PsSettings_SetAndGetL), ENTRY( "PsPattern_SetAndGetL", CPsUtilsTestSuite::PsPattern_SetAndGetL), - }; const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); + sizeof( TStifFunctionInfo ); return RunInternalL( KFunctions, count, aItem ); - } // ----------------------------------------------------------------------------- @@ -76,8 +72,7 @@ TInt errorStatus = KErrGeneral; RPointerArray inputParameterArray; Parse_StifItem(aItem,inputParameterArray); - - + //Parse data for CPsQueryItem TKeyboardModes inputKeyboardMode = EModeUndefined; TChar inputCharacter = '='; @@ -121,7 +116,6 @@ || (itemDest->Character() != itemSrc->Character()) ) { errorStatus = KErrGeneral; - } else { @@ -137,100 +131,93 @@ // ----------------------------------------------------------------------------- // This test case performs all the operations on the CPsQuery // ----------------------------------------------------------------------------- - TInt CPsUtilsTestSuite::CPsQuery_SetAndGetL( CStifItemParser& aItem ) { - TInt errorStatus = KErrNone; - RPointerArray inputParameterArray; - Parse_StifItem(aItem,inputParameterArray); - - //Parse data - TKeyboardModes inputKeyboardMode = EModeUndefined; - TChar inputCharacter = '='; - //Create the query - CPsQuery* inputSearchQuery = CPsQuery::NewL(); - CleanupStack::PushL(inputSearchQuery); - TInt removeIndex; - - // Parse data for CPsQuery - ParseForCPsQueryL(inputParameterArray,inputKeyboardMode,*inputSearchQuery,removeIndex); - - - // Create the destination CPsQuery - CPsQuery* destSearchQuery = NULL; - destSearchQuery = CPsQuery::NewL(); - CleanupStack::PushL(destSearchQuery); - - // Externalize to a stream of type RBufWriteStream - CBufFlat *buf = CBufFlat::NewL(KBufferMaxLen); - CleanupStack::PushL(buf); - RBufWriteStream stream(*buf); - stream.PushL(); - inputSearchQuery->ExternalizeL(stream); - stream.CommitL(); - CleanupStack::PopAndDestroy(); // stream - - // Internalize from the stream - HBufC8* destBuf = HBufC8::NewLC(buf->Size()); - TPtr8 ptrdestBuf(destBuf->Des()); - buf->Read(0, ptrdestBuf, buf->Size()); + TInt errorStatus = KErrNone; + RPointerArray inputParameterArray; + Parse_StifItem(aItem,inputParameterArray); + + //Parse data + TKeyboardModes inputKeyboardMode = EModeUndefined; + TChar inputCharacter = '='; + //Create the query + CPsQuery* inputSearchQuery = CPsQuery::NewL(); + CleanupStack::PushL(inputSearchQuery); + TInt removeIndex; + + // Parse data for CPsQuery + ParseForCPsQueryL(inputParameterArray,inputKeyboardMode,*inputSearchQuery,removeIndex); + + // Create the destination CPsQuery + CPsQuery* destSearchQuery = NULL; + destSearchQuery = CPsQuery::NewL(); + CleanupStack::PushL(destSearchQuery); + + // Externalize to a stream of type RBufWriteStream + CBufFlat *buf = CBufFlat::NewL(KBufferMaxLen); + CleanupStack::PushL(buf); + RBufWriteStream stream(*buf); + stream.PushL(); + inputSearchQuery->ExternalizeL(stream); + stream.CommitL(); + CleanupStack::PopAndDestroy(); // stream + + // Internalize from the stream + HBufC8* destBuf = HBufC8::NewLC(buf->Size()); + TPtr8 ptrdestBuf(destBuf->Des()); + buf->Read(0, ptrdestBuf, buf->Size()); + + RDesReadStream rdStream(destBuf->Des()); + CleanupClosePushL(rdStream); + destSearchQuery->InternalizeL(rdStream); + CleanupStack::PopAndDestroy(3);//rdStream, destBuf, buf - RDesReadStream rdStream(destBuf->Des()); - CleanupClosePushL(rdStream); - destSearchQuery->InternalizeL(rdStream); - CleanupStack::PopAndDestroy(3);//rdStream, destBuf, buf - - - // Check if internalized and externalized values are same. - if ( !ComparePsQueryL(*inputSearchQuery, *destSearchQuery) ) - { - errorStatus = KErrGeneral; - } - - // Perform other operations (not performed yet) - - // Get the item at removeindex - CPsQueryItem* item = CPsQueryItem::NewL(); - CPsQueryItem &tempitem = inputSearchQuery->GetItemAtL(removeIndex); - item->SetMode(tempitem.Mode()); - item->SetCharacter(tempitem.Character()); + // Check if internalized and externalized values are same. + if ( !ComparePsQueryL(*inputSearchQuery, *destSearchQuery) ) + { + errorStatus = KErrGeneral; + } - //Remove the item - inputSearchQuery->Remove(removeIndex); - - //Insert the item back - inputSearchQuery->InsertL(*item,removeIndex); - - //Get the query and check with original query - TPtrC queryPtr ( inputSearchQuery->QueryAsStringLC() ); - if (queryPtr.Compare(*(inputParameterArray[1])) != 0) - { - errorStatus = KErrGeneral; - } - CleanupStack::PopAndDestroy(3); // queryPtr,destSearchQuery,inputSearchQuery - - //Clean up - inputParameterArray.ResetAndDestroy(); - - // Return errorStatus - return errorStatus; + // Perform other operations (not performed yet) + + // Get the item at removeindex + CPsQueryItem* item = CPsQueryItem::NewL(); + CPsQueryItem &tempitem = inputSearchQuery->GetItemAtL(removeIndex); + item->SetMode(tempitem.Mode()); + item->SetCharacter(tempitem.Character()); + + //Remove the item + inputSearchQuery->Remove(removeIndex); + + //Insert the item back + inputSearchQuery->InsertL(*item,removeIndex); + + //Get the query and check with original query + TPtrC queryPtr ( inputSearchQuery->QueryAsStringLC() ); + if (queryPtr.Compare(*(inputParameterArray[1])) != 0) + { + errorStatus = KErrGeneral; + } + CleanupStack::PopAndDestroy(3); // queryPtr,destSearchQuery,inputSearchQuery + + //Clean up + inputParameterArray.ResetAndDestroy(); + + // Return errorStatus + return errorStatus; } - - // ----------------------------------------------------------------------------- // This test case performs all the operations on the CPsClientData // ----------------------------------------------------------------------------- TInt CPsUtilsTestSuite::PsClientData_SetAndGetL( CStifItemParser& aItem ) - { TInt errorStatus = KErrNone; CTestSuiteInputData* iInputParsedData = CTestSuiteInputData::NewL(aItem); // Parse the input data iInputParsedData->ParseInputL(aItem) ; - - + // Create a new source PS Query object CPsClientData* psSrcData = CPsClientData::NewL(); CleanupStack::PushL(psSrcData); @@ -246,7 +233,7 @@ // Set the data elements for (TInt i(0); i < contactDataArray.Count(); i++) { - psSrcData->SetDataL(i, *(contactDataArray[i]) ); + psSrcData->SetDataL(i, *(contactDataArray[i]) ); } //set data extension @@ -286,31 +273,24 @@ TBool ret2 = ComparePsClientDataL(*psSrcData,*destObject); if(ret1 !=0 && ret2) { - errorStatus = KErrGeneral; - } CleanupStack::PopAndDestroy(2); - - + return errorStatus; - } - // ----------------------------------------------------------------------------- // This test case performs all the operations on the CPsData // ----------------------------------------------------------------------------- TInt CPsUtilsTestSuite::PsData_SetAndGetL( CStifItemParser& aItem ) - { TInt errorStatus = KErrNone; CTestSuiteInputData* iInputParsedData = CTestSuiteInputData::NewL(aItem); // Parse the input data iInputParsedData->ParseInputL(aItem) ; - - + // Create a new source PS Query object CPsData* psSrcData = CPsData::NewL(); CleanupStack::PushL(psSrcData); @@ -335,7 +315,7 @@ // Set the data elements for (TInt i(0); i < contactDataArray.Count(); i++) { - psSrcData->SetDataL(i, *(contactDataArray[i]) ); + psSrcData->SetDataL(i, *(contactDataArray[i]) ); } //set data extension @@ -343,66 +323,62 @@ psSrcData->SetDataExtension(contactDataArray[0]); // Create the destination CPsQuery - CPsData* destObject = NULL; - destObject = CPsData::NewL(); - CleanupStack::PushL(destObject); - - // Externalize to a stream of type RBufWriteStream - CBufFlat *buf = CBufFlat::NewL(KBufferMaxLen); - CleanupStack::PushL(buf); - RBufWriteStream stream(*buf); - stream.PushL(); - psSrcData->ExternalizeL(stream); - stream.CommitL(); - CleanupStack::PopAndDestroy(); // stream - - // Internalize from the stream - HBufC8* destBuf = HBufC8::NewLC(buf->Size()); - TPtr8 ptrdestBuf(destBuf->Des()); - buf->Read(0, ptrdestBuf, buf->Size()); - - RDesReadStream rdStream(destBuf->Des()); - CleanupClosePushL(rdStream); - destObject->InternalizeL(rdStream); - CleanupStack::PopAndDestroy(3);//rdStream, destBuf, buf - - //Compare the internalized and externalized object - TInt ret1 = CPsData::CompareByData(*psSrcData,*destObject); - TInt ret2 = CPsData::CompareById(*psSrcData,*destObject); - TBool ret3 = ComparePsDataL(*psSrcData,*destObject); + CPsData* destObject = NULL; + destObject = CPsData::NewL(); + CleanupStack::PushL(destObject); + + // Externalize to a stream of type RBufWriteStream + CBufFlat *buf = CBufFlat::NewL(KBufferMaxLen); + CleanupStack::PushL(buf); + RBufWriteStream stream(*buf); + stream.PushL(); + psSrcData->ExternalizeL(stream); + stream.CommitL(); + CleanupStack::PopAndDestroy(); // stream + + // Internalize from the stream + HBufC8* destBuf = HBufC8::NewLC(buf->Size()); + TPtr8 ptrdestBuf(destBuf->Des()); + buf->Read(0, ptrdestBuf, buf->Size()); + + RDesReadStream rdStream(destBuf->Des()); + CleanupClosePushL(rdStream); + destObject->InternalizeL(rdStream); + CleanupStack::PopAndDestroy(3);//rdStream, destBuf, buf + + //Compare the internalized and externalized object + TInt ret1 = CPsData::CompareByData(*psSrcData,*destObject); + TInt ret2 = CPsData::CompareById(*psSrcData,*destObject); + TBool ret3 = ComparePsDataL(*psSrcData,*destObject); - if((ret1 !=0) && (ret2 != 0) && !ret3 ) - { + if((ret1 !=0) && (ret2 != 0) && !ret3 ) + { + errorStatus = KErrGeneral; + } + else + { + if(iInputParsedData->Id()) + { + if(psSrcData->IsDataMatch(iInputParsedData->Id())) + { + errorStatus = KErrNone; + } + else + { + errorStatus = KErrGeneral; + } + } + else + { + errorStatus = KErrNone; + } + + } - errorStatus = KErrGeneral; - - } - else - { - if(iInputParsedData->Id()) - { - if(psSrcData->IsDataMatch(iInputParsedData->Id())) - { - errorStatus = KErrNone; - } - else - { - errorStatus = KErrGeneral; - } - } - else - { - - errorStatus = KErrNone; - } - - } - - psSrcData->RemoveIntDataExt(iInputParsedData->Id()); - psSrcData->ClearDataMatches(); - CleanupStack::PopAndDestroy(2); - return errorStatus; - + psSrcData->RemoveIntDataExt(iInputParsedData->Id()); + psSrcData->ClearDataMatches(); + CleanupStack::PopAndDestroy(2); + return errorStatus; } // ----------------------------------------------------------------------------- @@ -516,8 +492,7 @@ { errorStatus = KErrGeneral; } - - + CleanupStack::PopAndDestroy(2); // destPsSettings, srcPsSettings // clean up @@ -536,10 +511,10 @@ CTestSuiteInputData* inputParsedData = CTestSuiteInputData::NewL(aItem); // Parse the input data - inputParsedData->ParseInputL(aItem) ; + inputParsedData->ParseInputL(aItem); RPointerArray dataArray; - inputParsedData->Data(dataArray) ; + inputParsedData->Data(dataArray); TInt index = inputParsedData->Id(); @@ -588,16 +563,13 @@ { errorStatus = KErrGeneral; } - - + CleanupStack::PopAndDestroy(2); // destPsPattern, srcPsPattern // clean up delete inputParsedData; // return error code return errorStatus; - - } // ----------------------------------------------------------------------------- @@ -612,7 +584,6 @@ { aInputParameter.Append(string.AllocL()); } - } // ----------------------------------------------------------------------------- @@ -620,7 +591,6 @@ // ----------------------------------------------------------------------------- void CPsUtilsTestSuite::ParseForCPsQueryItemL(RPointerArray& aInputParameterArray,TKeyboardModes& aCurrentMode,TChar& aCurrentChar) { - //There should be only 2 arguments, else it is an error in input if(aInputParameterArray.Count() != 2) { @@ -640,8 +610,7 @@ { aCurrentMode = EModeUndefined; } - - + //Get the current character TDesC* tmp = aInputParameterArray[1]; if (tmp!=NULL) @@ -652,16 +621,15 @@ } aCurrentChar = (*tmp)[0]; } - } // ----------------------------------------------------------------------------- // Parses the input stif parameters for CPsQuery // ----------------------------------------------------------------------------- void CPsUtilsTestSuite::ParseForCPsQueryL(RPointerArray& aInputParameterArray, - TKeyboardModes& aCurrentMode, - CPsQuery& aSearchQuery, - TInt& aRemoveIndex) + TKeyboardModes& aCurrentMode, + CPsQuery& aSearchQuery, + TInt& aRemoveIndex) { //There should be only 3 arguments, else an error in input if(aInputParameterArray.Count()!= 3) @@ -694,12 +662,11 @@ item->SetMode(aCurrentMode); aSearchQuery.AppendL(*item); } - - - // Get the removeIndex - TInt removeIndex = 0; - TLex myDocId(*(aInputParameterArray[2])); - TInt err = myDocId.Val(removeIndex); + + // Get the removeIndex + TInt removeIndex = 0; + TLex myDocId(*(aInputParameterArray[2])); + TInt err = myDocId.Val(removeIndex); if(err == KErrNone) { @@ -709,13 +676,11 @@ { User::Leave(err); } - } // ----------------------------------------------------------------------------- // Compares two CPsQuery objects // ----------------------------------------------------------------------------- - TBool CPsUtilsTestSuite::ComparePsQueryL(CPsQuery& aInputSearchQuery, CPsQuery& aDestSearchQuery) { // The count and keyboardmode of both objects should be equal @@ -724,13 +689,11 @@ ) { return EFalse; - } // Compare each CPsQueryItem from both the objects for(TInt i =0; i < aInputSearchQuery.Count(); i++) { - CPsQueryItem& src = aInputSearchQuery.GetItemAtL(i); CPsQueryItem& dest = aDestSearchQuery.GetItemAtL(i); // The mode and Character should be equal @@ -738,7 +701,6 @@ { return EFalse; } - } // All ok, return ETrue return ETrue; @@ -802,9 +764,7 @@ } } } - - - + return matched; } diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -43,13 +43,11 @@ { } - // ---------------------------------------------------------------------------- // Destructor // ---------------------------------------------------------------------------- CTestSuiteInputData::~CTestSuiteInputData() { - if(iQueryBuf) { delete iQueryBuf; @@ -61,12 +59,9 @@ iKeyboardModeBuf = NULL; } - - iCacheUris.ResetAndDestroy(); - + iCacheUris.ResetAndDestroy(); iDisplayFields.Close(); - } // ---------------------------------------------------------------------------- @@ -87,12 +82,12 @@ void CTestSuiteInputData::Data(RPointerArray & aDataArray) { - for(TInt i = 0 ; i < iDataArray.Count(); i++) + for(TInt i = 0; i < iDataArray.Count(); i++) { aDataArray.Append(iDataArray[i]->AllocL()); } +} -} // ---------------------------------------------------------------------------- // Sets the keyboard mode // ---------------------------------------------------------------------------- @@ -128,7 +123,6 @@ iQueryBuf = aQuery.AllocL(); } - // ---------------------------------------------------------------------------- // Return the cache uri at given index // ---------------------------------------------------------------------------- @@ -145,13 +139,12 @@ return *(iCacheUris[aIndex]); } - // ---------------------------------------------------------------------------- // Return the cache uri // ---------------------------------------------------------------------------- void CTestSuiteInputData::CacheUris(RPointerArray & aUriArray) { - for(TInt i = 0 ; i < iCacheUris.Count(); i++) + for(TInt i = 0; i < iCacheUris.Count(); i++) { aUriArray.Append(iCacheUris[i]->AllocL()); } @@ -161,7 +154,8 @@ // Sets the cache uris // ---------------------------------------------------------------------------- void CTestSuiteInputData::ApendCacheUrisL(RPointerArray& aCacheUriArray) -{ iCacheUris.ResetAndDestroy(); +{ + iCacheUris.ResetAndDestroy(); for(TInt i =0; i AllocL(); - iDataArray.Append(data[i]); - + HBufC *temp = data[i]->AllocL(); + iDataArray.Append(data[i]); } } @@ -348,13 +335,11 @@ GetCharacterSeparatedDataL( aInput,separator, Uris); for(TInt i = 0; i< Uris.Count(); i++) { - HBufC *temp = Uris[i]->AllocL(); - iCacheUris.Append(Uris[i]); - + HBufC *temp = Uris[i]->AllocL(); + iCacheUris.Append(Uris[i]); } } - // ----------------------------------------------------------------------------- // This function parses the input for display fields // ----------------------------------------------------------------------------- @@ -369,15 +354,15 @@ TInt fieldId = 0; TLex num(*(dispFieldsBuf[i])); - TInt err = num.Val(fieldId); // parse the string to extract integer value - if(err != KErrNone) - { - User::Leave(KErrGeneral); - } - else - { - iDisplayFields.Append(fieldId); - } + TInt err = num.Val(fieldId); // parse the string to extract integer value + if(err != KErrNone) + { + User::Leave(KErrGeneral); + } + else + { + iDisplayFields.Append(fieldId); + } } } @@ -395,15 +380,15 @@ TInt groupId = 0; TLex num(*(grpIdsBuf[i])); - TInt err = num.Val(groupId); // parse the string to extract integer value - if(err != KErrNone) - { - User::Leave(KErrGeneral); - } - else - { - iGroupIds.Append(groupId); - } + TInt err = num.Val(groupId); // parse the string to extract integer value + if(err != KErrNone) + { + User::Leave(KErrGeneral); + } + else + { + iGroupIds.Append(groupId); + } } } @@ -412,29 +397,24 @@ // ----------------------------------------------------------------------------- void CTestSuiteInputData::GetCharacterSeparatedDataL(TDesC& aInput,TChar aSeparator, RPointerArray &aSeparatedData) { - TInt SeparatorPos = -1 ; for (TInt j = 0 ; j< aInput.Length();) { - - TInt Startpos = SeparatorPos + 1; + TInt Startpos = SeparatorPos + 1; // Get the data for each contact - while((aInput[j] != aSeparator) && (j < ( aInput.Length()-1) ) ) - j++; - if(j == (aInput.Length() - 1)) - j++; - - TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); - - - // Add data to the output - HBufC* tempData = dataPtr.AllocL(); - aSeparatedData.Append(tempData); - SeparatorPos = j ; - j++; - - } + while((aInput[j] != aSeparator) && (j < ( aInput.Length()-1) ) ) + j++; + if(j == (aInput.Length() - 1)) + j++; + + TPtrC16 dataPtr = aInput.Mid(Startpos ,j - Startpos); + // Add data to the output + HBufC* tempData = dataPtr.AllocL(); + aSeparatedData.Append(tempData); + SeparatorPos = j ; + j++; + } } // ----------------------------------------------------------------------------- @@ -442,7 +422,6 @@ // ----------------------------------------------------------------------------- void CTestSuiteInputData::ParseInputForSearchQueryL(TDesC& aInput) { - RPointerArray queryData; TChar separator = ','; GetCharacterSeparatedDataL( aInput,separator, queryData); @@ -459,12 +438,8 @@ queryData.ResetAndDestroy(); User::Leave(KErrArgument); } - - } - - // ----------------------------------------------------------------------------- // This function creates the search query from the input buffer // ----------------------------------------------------------------------------- @@ -518,14 +493,12 @@ } } - // ----------------------------------------------------------------------------- // Perform the search settings // ----------------------------------------------------------------------------- void CTestSuiteInputData::PerformSearchSettingsL(CPsSettings& aSettings) { - RPointerArray databases; // list of databases RArray displayFields; // list of display fields TInt maxResults = 100; @@ -535,7 +508,6 @@ { for(TInt i =0; iAllocL()); - } // Perform the settings aSettings.SetSearchUrisL(databases); aSettings.SetDisplayFieldsL(displayFields); aSettings.SetMaxResults(maxResults); - // cleanup displayFields.Close(); databases.Reset(); databases.Close(); - - } TInt CTestSuiteInputData::CompareByDataL ( const CPsClientData& aObject1, const CPsClientData& aObject2 ) { TBuf data1; - TBuf<255> data2; - - _LIT(KSpace, " "); + TBuf<255> data2; - data1 = KNullDesC; - for ( int i = 0; i < aObject1.DataElementCount(); i++ ) - { - if ( aObject1.Data(i) ) - { - data1 += aObject1.Data(i)->Des(); - data1 += KSpace; - } - } - - // Trim the unnecessary white spaces before we compare - data1.TrimAll(); + _LIT(KSpace, " "); - data2 = KNullDesC; - for ( int i = 0; i < aObject2.DataElementCount(); i++ ) - { - if ( aObject2.Data(i) ) - { - data2 += aObject2.Data(i)->Des(); - data2 += KSpace; - } - } - - // Trim the unnecessary white spaces before we compare - data2.TrimAll(); - - // Get the standard method - TCollationMethod meth = *Mem::CollationMethodByIndex( 0 ); - meth.iFlags |= TCollationMethod::EIgnoreNone; - meth.iFlags |= TCollationMethod::EFoldCase; + data1 = KNullDesC; + for ( int i = 0; i < aObject1.DataElementCount(); i++ ) + { + if ( aObject1.Data(i) ) + { + data1 += aObject1.Data(i)->Des(); + data1 += KSpace; + } + } + + // Trim the unnecessary white spaces before we compare + data1.TrimAll(); + + data2 = KNullDesC; + for ( int i = 0; i < aObject2.DataElementCount(); i++ ) + { + if ( aObject2.Data(i) ) + { + data2 += aObject2.Data(i)->Des(); + data2 += KSpace; + } + } + + // Trim the unnecessary white spaces before we compare + data2.TrimAll(); + + // Get the standard method + TCollationMethod meth = *Mem::CollationMethodByIndex( 0 ); + meth.iFlags |= TCollationMethod::EIgnoreNone; + meth.iFlags |= TCollationMethod::EFoldCase; + + // Magic: Collation level 3 is used + TInt comparison(data1.CompareC( data2, 3, &meth )); + return comparison; +} - // Magic: Collation level 3 is used - TInt comparison(data1.CompareC( data2, 3, &meth )); - return comparison; -} // End of file diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h --- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h Mon Jul 12 13:42:58 2010 +0100 @@ -36,6 +36,9 @@ * implementations, but instances of the strategies are created using * this classes NewL function. Actual implementation selection is done * based on the given configuration data. + * In case of multiple matches from different stores, results from store + * configured in Phonebook 2 settings are returned. Only if no match + * is found from configured store(s), then return matches from other stores. */ class CVPbkPhoneNumberMatchStrategy : public CBase { @@ -183,7 +186,14 @@ * @return Array of stores that are used in matching. */ TArray StoresToMatch() const; - + + /** + * Checks if contact store is SIM store. + * @param aStore Store to be checked. + * @return ETrue if aStore is SIM store, otherwise EFalse. + */ + TBool IsSimStore( const MVPbkContactStore& aStore ); + private: // Interface for derived classes to implement /** * Called from MatchL to indicate derived classes that diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h --- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h Mon Jul 12 13:42:58 2010 +0100 @@ -134,6 +134,21 @@ IMPORT_C static CVPbkTopContactManager* NewL( CVPbkContactManager& aContactManager ); /** + * Creates the top contact manager passing an already constructed top + * contacts view as a parameter. This greatly improves performance of adding + * new favorites as the top contact view contsrution can be a heavy operation. + * + * Note, passing the view doesn't affect the view and links fetching + * (e.g. GetTopContactsViewL, GetTopContactLinksL, etc.) + * + * @param aContactManager Contact manager which already has its stores opened. + * @param aTopView top contact view which already has been constructed. + */ + IMPORT_C static CVPbkTopContactManager* NewL( + CVPbkContactManager& aContactManager, + MVPbkContactViewBase& aTopView); + + /** * Creates the top contact manager. * Holds its own CVPbkContactManager instance. * diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/conf/T_VPbkVCardApi.cfg --- a/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/conf/T_VPbkVCardApi.cfg Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/conf/T_VPbkVCardApi.cfg Mon Jul 12 13:42:58 2010 +0100 @@ -3,6 +3,7 @@ timeout 20000 create T_VPbkVCardApi test test CreateVCardEng +waittestclass test test ImportVCardToStore waittestclass test test DeleteVCardEng @@ -14,6 +15,7 @@ timeout 20000 create T_VPbkVCardApi test test CreateVCardEng +waittestclass test test ImportVCardToContacts waittestclass test test DeleteVCardEng @@ -25,6 +27,7 @@ timeout 20000 create T_VPbkVCardApi test test CreateVCardEng +waittestclass test test ImportBusinessCardToStore waittestclass test test DeleteVCardEng @@ -36,6 +39,7 @@ timeout 20000 create T_VPbkVCardApi test test CreateVCardEng +waittestclass test test ImportBusinessCardToContacts waittestclass test test DeleteVCardEng diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/group/T_VPbkVCardApi.pkg --- a/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/group/T_VPbkVCardApi.pkg Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/group/T_VPbkVCardApi.pkg Mon Jul 12 13:42:58 2010 +0100 @@ -42,5 +42,5 @@ ; PRJ_TESTEXPORTS "\epoc32\winscw\c\bctestlog\testcbcard.ccf"-"c:\bctestlog\testcbcard.ccf" "\epoc32\winscw\c\bctestlog\testvcard.vcf"-"c:\bctestlog\testvcard.vcf" -"..\conf\T_VPbkVCardApi.cfg"-"c:\TestFramework\T_VPbkVCardApi.cfg" +"..\conf\T_VPbkVCardApi.cfg"-"c:\TestFramework\Ui_T_VPbkVCardApi.cfg" "..\init\T_VPbkVCardApi.ini"-"c:\TestFramework\T_VPbkVCardApi.ini" diff -r 35018d46c3dc -r 22a79a0cd291 contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/init/T_VPbkVCardApi.ini --- a/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/init/T_VPbkVCardApi.ini Fri May 28 13:07:31 2010 +0100 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/init/T_VPbkVCardApi.ini Mon Jul 12 13:42:58 2010 +0100 @@ -38,7 +38,7 @@ [New_Module] ModuleName= TestScripter -TestCaseFile= c:\testframework\T_VPbkVCardApi.cfg +TestCaseFile= c:\testframework\Ui_T_VPbkVCardApi.cfg [End_Module] # End of file \ No newline at end of file diff -r 35018d46c3dc -r 22a79a0cd291 logsui/AppSrc/CLogsBaseView.cpp --- a/logsui/AppSrc/CLogsBaseView.cpp Fri May 28 13:07:31 2010 +0100 +++ b/logsui/AppSrc/CLogsBaseView.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -880,9 +880,7 @@ } //Process Send key for cellular, voip or poc call - if( aKeyEvent.iScanCode == EStdKeyYes && - ( MenuBar()->ItemSpecificCommandsEnabled() || - LogsAppUi()->ActiveViewId() == ELogDetailViewId ) ) + if( aKeyEvent.iScanCode == EStdKeyYes ) { ConstructDelayedL( EFalse ); //EFalse: perform immediately TBool supportLongSendPress = EFalse;//FIXME: FeatureManager::FeatureSupported( ??? ) this value should be available from platform in future diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF --- a/phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF Mon Jul 12 13:42:58 2010 +0100 @@ -208,4 +208,5 @@ ?CreateActionTypeSelectorIdL@VPbkFieldTypeSelectorFactory@@SA?AW4TVPbkContactActionTypeSelector@1@H@Z @ 207 NONAME ; enum VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector VPbkFieldTypeSelectorFactory::CreateActionTypeSelectorIdL(int) ?AddressFieldsIncluded@CVPbkFieldTypeSelector@@QBEHABVMVPbkStoreContactFieldCollection@@@Z @ 208 NONAME ; int CVPbkFieldTypeSelector::AddressFieldsIncluded(class MVPbkStoreContactFieldCollection const &) const ?FindL@CVPbkContactManager@@QAEPAVMVPbkContactOperationBase@@ABVMDesC16Array@@ABVMVPbkFieldTypeList@@AAVMVPbkContactFindFromStoresObserver@@ABVTCallBack@@ABVCDesC16ArrayFlat@@@Z @ 209 NONAME ; class MVPbkContactOperationBase * CVPbkContactManager::FindL(class MDesC16Array const &, class MVPbkFieldTypeList const &, class MVPbkContactFindFromStoresObserver &, class TCallBack const &, class CDesC16ArrayFlat const &) + ?NewL@CVPbkTopContactManager@@SAPAV1@AAVCVPbkContactManager@@AAVMVPbkContactViewBase@@@Z @ 210 NONAME ; class CVPbkTopContactManager * CVPbkTopContactManager::NewL(class CVPbkContactManager &, class MVPbkContactViewBase &) diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF --- a/phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF Mon Jul 12 13:42:58 2010 +0100 @@ -291,4 +291,5 @@ _ZN28VPbkFieldTypeSelectorFactory27CreateActionTypeSelectorIdLEi @ 290 NONAME _ZNK22CVPbkFieldTypeSelector21AddressFieldsIncludedERK32MVPbkStoreContactFieldCollection @ 291 NONAME _ZN19CVPbkContactManager5FindLERK12MDesC16ArrayRK18MVPbkFieldTypeListR34MVPbkContactFindFromStoresObserverRK9TCallBackRK16CDesC16ArrayFlat @ 292 NONAME + _ZN22CVPbkTopContactManager4NewLER19CVPbkContactManagerR20MVPbkContactViewBase @ 293 NONAME diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h --- a/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h Mon Jul 12 13:42:58 2010 +0100 @@ -53,6 +53,23 @@ */ static CVPbkTopContactManagerImpl* NewL( CVPbkContactManager& aContactManager ); + + /** + * Creates the top contact manager passing an already constructed top + * contacts view as a parameter. This greatly improves performance of adding + * new favorites as the top contact view contsrution can be a heavy operation. + * + * Note, passing the view doesn't affect the view and links fetching + * (e.g. GetTopContactsViewL, GetTopContactLinksL, etc.) + * + * @param aContactManager Contact manager which already has its stores opened. + * @param aTopView top contact view which already has been constructed. + * + * @return Top contact manager instance + */ + static CVPbkTopContactManagerImpl* NewL( + CVPbkContactManager& aContactManager, + MVPbkContactViewBase& aTopView); /** * Creates the top contact manager impl. @@ -138,6 +155,9 @@ // or reference to own contact manager iOurContactManager CVPbkContactManager* iContactManager; // not owned CVPbkContactManager* iOurContactManager; // owned + + // Reference to a clients top contact view + MVPbkContactViewBase* iTopView; // not owned }; #endif //VPBKTOPCONTACTMANAGERIMPL_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h --- a/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h Mon Jul 12 13:42:58 2010 +0100 @@ -119,8 +119,11 @@ * @param aErrorObserver Error observer is notified in case of an error * @param aOperation valid values EAddToTop, * ERemoveFromTop, - * EReorderTop - * + * EReorderTop + * @param aTopView Top contact view which already has been constructed. + * If a NULL value is passed, own top contact view is + * constructed. + * * @return Contact operation handle */ static MVPbkContactOperationBase* NewTopOperationL( @@ -128,7 +131,10 @@ const MVPbkContactLinkArray& aContactLinks, MVPbkOperationObserver& aObserver, MVPbkOperationErrorObserver& aErrorObserver, - TTopOperation aOperation ); + TTopOperation aOperation, + MVPbkContactViewBase* aViewRef = NULL + ); + /** * Destructor. Cancels any ongoing requests. @@ -273,6 +279,9 @@ CVPbkContactManager& iContactManager; // not owned MVPbkContactViewBase* iView; // owned + // A handle to externally provided top contact view + MVPbkContactViewBase* iViewRef; // Not owned. + MVPbkContactStore* iContactStore; // not owned CVPbkContactLinkArray* iInputLinks; // owned RPointerArray iContacts; // owns the contacts diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -958,12 +958,15 @@ { // Loop through the rest of the contacts of the subview // and modify their global contact mapping information - for (TInt i = index; i < iContactMapping.Count(); ++i) + for (TInt i = 0; i < iContactMapping.Count(); ++i ) { - if (iContactMapping[i].iViewIndex == subViewIndex) + // Adjust the iContactIndex in the same view except the deleted one. + if ( ( iContactMapping[i].iViewIndex == subViewIndex ) + && ( iContactMapping[i].iContactIndex >= aIndex ) + && ( i != index ) ) { - // Subtract one because one contact was deleted - // from the list before the current index + // Subtract one because one contact was deleted, the index + // from the list which is bigger than the deleted one needs to be adjusted. --iContactMapping[i].iContactIndex; } } @@ -999,13 +1002,18 @@ index = err; } else - { - // We have to fix the indexes of all the succeeding + { + // We have to fix the indexes of all the succeeding // contacts in the view where the contact addition took place - for ( TInt i = index + 1; i < iContactMapping.Count(); ++i ) + for ( TInt i = 0; i < iContactMapping.Count(); ++i ) { - if (iContactMapping[i].iViewIndex == subViewIndex) + // Adjust the iContactIndex in the same view except the added one. + if ( ( iContactMapping[i].iViewIndex == subViewIndex ) + && ( iContactMapping[i].iContactIndex >= aIndex ) + && ( i != index ) ) { + // plus one because one contact was added, the index + // from the list which is bigger than the deleted one needs to be adjusted. ++iContactMapping[i].iContactIndex; } } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -37,12 +37,27 @@ #include #include #include +#include +#include #include "CVPbkPhoneNumberSequentialMatchStrategy.h" #include "CVPbkPhoneNumberParallelMatchStrategy.h" // CONSTANTS +// Unnamed namespace for local definitions +namespace { +// -------------------------------------------------------------------------- +// Phonebook Central Repository UIDs +// Copied from sf\app\contacts\phonebookui\Phonebook2\inc\Phonebook2InternalCRKeys.h +// -------------------------------------------------------------------------- +// +const TUint32 KCRUidPhonebookStoreConfiguration = 0x1020727f; +const TUint32 KPhonebookCurrentConfigurationPartialKey = 0x00000100; +const TUint32 KPhonebookCurrentConfigurationMask = 0xffffff00; + +const TInt KInitialStoreUriSize = 22; // length of KVPbkDefaultCntDbURI const TInt KMagicNumber = -1; +} // namespace NONSHARABLE_CLASS(CVPbkPhoneNumberMatchStrategyImpl) : public CActive, @@ -61,7 +76,8 @@ void MatchL(const TDesC& aPhoneNumber); TInt MaxMatchDigits() const; TArray StoresToMatch() const; - + TBool IsSimStore( const MVPbkContactStore& aStore ); + private: // From CActive void RunL(); void DoCancel(); @@ -133,6 +149,19 @@ const TDesC& aNumberB, TNumberType aNumberBType ); TInt FormatAndCheckNumberType( TDes& aNumber ); + /** + * Reads current store configuration from central repositiry + * @return Array of stores or NULL if error during reading form cenrep. + */ + CVPbkContactStoreUriArray* GetCurrentStoreConfigurationL(); + + /** + * If there is in the results at least one contact + * from currently used stores in Phonebook2 it removes from results + * contacts from other stores + */ + void RefineDuplicatedNumbersL(); + private: // Data CVPbkPhoneNumberMatchStrategy& iParent; /// Ref: The contact manager instance to be used for searching. @@ -410,6 +439,12 @@ delete iResults; iResults = results; } + + if ( iResults->Count() > 1 ) + { + RefineDuplicatedNumbersL(); + } + CVPbkContactLinkArray* results = iResults; iResults = NULL; iObserver->FindCompleteL( results ); @@ -945,6 +980,134 @@ return result; } +CVPbkContactStoreUriArray* CVPbkPhoneNumberMatchStrategyImpl::GetCurrentStoreConfigurationL() + { + CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidPhonebookStoreConfiguration ) ); + CleanupStack::PushL( repository ); + CVPbkContactStoreUriArray* result = CVPbkContactStoreUriArray::NewLC(); + + RArray configurationKeys; + CleanupClosePushL( configurationKeys ); + + repository->FindL( KPhonebookCurrentConfigurationPartialKey, + KPhonebookCurrentConfigurationMask, configurationKeys ); + + HBufC* buffer = HBufC::NewLC( KInitialStoreUriSize ); + const TInt keyCount = configurationKeys.Count(); + TInt ret = KErrNone; + for ( TInt i = 0; i < keyCount; ++i ) + { + TPtr ptr = buffer->Des(); + ptr.Zero(); + TInt actualSize = 0; + ret = repository->Get( configurationKeys[i], ptr, actualSize ); + if ( ret == KErrOverflow ) + { + CleanupStack::PopAndDestroy(); // buffer + buffer = HBufC::NewLC( actualSize ); + ptr.Set( buffer->Des() ); + ret = repository->Get( configurationKeys[i], ptr ); + } + + if ( ret != KErrNone ) + { + break; + } + + if( !result->IsIncluded( TVPbkContactStoreUriPtr( ptr ) ) ) // Only append if the uri is not yet included + { + result->AppendL( ptr ); + } + } + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( &configurationKeys ); + CleanupStack::Pop( result ); + CleanupStack::PopAndDestroy( repository ); + + if ( ret != KErrNone ) + { + delete result; + result = NULL; + } + return result; + } + +void CVPbkPhoneNumberMatchStrategyImpl::RefineDuplicatedNumbersL() + { + CVPbkContactStoreUriArray* stores = GetCurrentStoreConfigurationL(); + if ( !stores ) + { + return; + } + CleanupStack::PushL( stores ); + + TInt storesCount = stores->Count(); + if ( storesCount ) + { + TInt linksCount = iResults->Count(); + // check if there is in the results at least one contact + // from currently used stores + TBool isFromUsedStore = EFalse; + for ( TInt i = 0; i < linksCount; i++ ) + { + const MVPbkContactStoreProperties& linkStoreProp = + iResults->At( i ).ContactStore().StoreProperties(); + + for ( TInt j = 0; j < storesCount; j++ ) + { + if ( !linkStoreProp.Uri().UriDes().Compare( ( *stores )[j].UriDes() ) ) + { + isFromUsedStore = ETrue; + break; + } + } + if ( isFromUsedStore ) + { + break; + } + } + // remove from results contacts from not used stores + if ( isFromUsedStore ) + { + for ( TInt i = 0; i < linksCount; i++ ) + { + TBool remove = ETrue; + const MVPbkContactStoreProperties& linkStoreProp = + iResults->At( i ).ContactStore().StoreProperties(); + + for ( TInt j = 0; j < storesCount; j++ ) + { + if ( !linkStoreProp.Uri().UriDes().Compare( ( *stores )[j].UriDes() ) ) + { + remove = EFalse; + break; + } + } + if ( remove ) + { + iResults->Delete( i ); + linksCount--; + i--; + } + } + } + } + CleanupStack::PopAndDestroy( stores ); + } + +TBool CVPbkPhoneNumberMatchStrategyImpl::IsSimStore( const MVPbkContactStore& aStore ) + { + TVPbkContactStoreUriPtr uriPtr = aStore.StoreProperties().Uri(); + if ( !uriPtr.UriDes().Compare( KVPbkSimGlobalAdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalFdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalSdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalOwnNumberURI ) ) + { + return ETrue; + } + return EFalse; + } + CVPbkPhoneNumberMatchStrategy::CVPbkPhoneNumberMatchStrategy() { } @@ -1000,4 +1163,8 @@ return iImpl->StoresToMatch(); } +TBool CVPbkPhoneNumberMatchStrategy::IsSimStore( const MVPbkContactStore& aStore ) + { + return iImpl->IsSimStore( aStore ); + } // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -20,6 +20,7 @@ #include #include +#include CVPbkPhoneNumberParallelMatchStrategy::CVPbkPhoneNumberParallelMatchStrategy() { @@ -54,16 +55,33 @@ const TDesC& aPhoneNumber) { CVPbkContactFindOperation* operation = NULL; - + if (!iMatchingStarted) { operation = CVPbkContactFindOperation::NewLC(FindObserver()); const TInt storeCount = StoresToMatch().Count(); + TInt maxDigits = MaxMatchDigits(); + for (TInt i = 0; i < storeCount; ++i) { - MVPbkContactOperation* subOperation = - StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( - aPhoneNumber, MaxMatchDigits(), *operation); + MVPbkContactOperation* subOperation = NULL; + + if ( maxDigits == KBestMatchingPhoneNumbers && + IsSimStore( *( StoresToMatch()[i] ) ) ) + { + // KBestMatchingPhoneNumbers enables best matching strategy + // on store level only for phone memory stores, for sim store + // MaxDigits parameter should be set to 7 or greater + const TInt KMaxDigitsForSimStore = 7; + subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, KMaxDigitsForSimStore, *operation); + } + else + { + subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, maxDigits, *operation); + } + if (subOperation) { CleanupDeletePushL(subOperation); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -20,6 +20,7 @@ #include #include +#include CVPbkPhoneNumberSequentialMatchStrategy::CVPbkPhoneNumberSequentialMatchStrategy() { @@ -54,13 +55,26 @@ const TDesC& aPhoneNumber) { MVPbkContactOperation* operation = NULL; - + TInt maxDigits = MaxMatchDigits(); // Get the next store's operation if it not null while ( iCurrentOperation < StoresToMatch().Count() && !operation ) { - operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( - aPhoneNumber, MaxMatchDigits(), FindObserver()); - + if ( maxDigits == KBestMatchingPhoneNumbers && + IsSimStore( *( StoresToMatch()[iCurrentOperation] ) ) ) + { + // KBestMatchingPhoneNumbers enables best matching strategy + // on store level only for phone memory stores, for sim store + // MaxDigits parameter should be set to 7 or greater + const TInt KMaxDigitsForSimStore = 7; + operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, KMaxDigitsForSimStore, FindObserver()); + } + else + { + operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, maxDigits, FindObserver()); + } + if ( operation ) { CleanupDeletePushL(operation); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -41,6 +41,19 @@ return self; } + +EXPORT_C CVPbkTopContactManager* CVPbkTopContactManager::NewL( + CVPbkContactManager& aContactManager, + MVPbkContactViewBase& aTopView) + { + CVPbkTopContactManager* self = + new (ELeave) CVPbkTopContactManager(); + CleanupStack::PushL( self ); + self->iImpl = CVPbkTopContactManagerImpl::NewL( aContactManager, aTopView ); + CleanupStack::Pop( self ); + return self; + } + EXPORT_C CVPbkTopContactManager::~CVPbkTopContactManager() { delete iImpl; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -28,6 +28,21 @@ CVPbkTopContactManagerImpl* CVPbkTopContactManagerImpl::NewL( + CVPbkContactManager& aContactManager, + MVPbkContactViewBase& aTopView + ) + { + CVPbkTopContactManagerImpl* self = + new (ELeave) CVPbkTopContactManagerImpl(); + CleanupStack::PushL( self ); + self->iContactManager = &aContactManager; + self->iTopView = &aTopView; + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CVPbkTopContactManagerImpl* CVPbkTopContactManagerImpl::NewL( CVPbkContactManager& aContactManager ) { CVPbkTopContactManagerImpl* self = @@ -141,7 +156,8 @@ aContactLinks, aObserver, aErrorObserver, - CVPbkTopContactOperation::EAddToTop ); + CVPbkTopContactOperation::EAddToTop, + iTopView); } MVPbkContactOperationBase* CVPbkTopContactManagerImpl::AddToTopL( diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -197,7 +197,8 @@ const MVPbkContactLinkArray& aContactLinks, MVPbkOperationObserver& aObserver, MVPbkOperationErrorObserver& aErrorObserver, - TTopOperation aOperation ) + TTopOperation aOperation, + MVPbkContactViewBase* aViewRef) { __ASSERT_DEBUG( aOperation == EAddToTop || aOperation == ERemoveFromTop || aOperation == EReorderTop, @@ -209,6 +210,7 @@ aOperation ); self->iObserver = &aObserver; self->iInputLinks = CloneArrayL( aContactLinks ); + self->iViewRef = aViewRef; CleanupStack::Pop(self); return self; @@ -479,8 +481,9 @@ { if ( iInputLinks->Count() > 0 ) { - // view is needed for AddToTop operation to get next top index - if ( iCurrentOperation == EAddToTop ) + // If the top view was not passed as a reference, we needed to construct + // own instance for AddToTop operation to get next top index + if ( iCurrentOperation == EAddToTop && !iViewRef ) { iNextState = EStateCreateView; } @@ -535,9 +538,11 @@ { case EAddToTop: { - // get next top index and delete the view right away, - __ASSERT_DEBUG( iView, Panic(ETopViewMissing) ); - TInt nextTopIndex = NextTopOrderIndexL( *iView ); + // Get next top index, either from the provided top view or + // from the self contsructed one. Delete the owned view right away. + __ASSERT_DEBUG( iView || iViewRef, Panic(ETopViewMissing) ); + TInt nextTopIndex = iViewRef ? NextTopOrderIndexL( *iViewRef ) : + NextTopOrderIndexL( *iView ); __ASSERT_DEBUG( nextTopIndex >= 0, Panic(ETopErrorBadIndex) ); delete iView; iView = NULL; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp --- a/phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -676,6 +676,12 @@ { iAsyncOpenOp->Purge(); TInt id = iStoreEvent.iData; + + if ( IsOpen() && id == MVPbkSimPhoneObserver::ESimCardNotInserted ) + { + iCurrentState = iStoreEvent.iEvent; + } + // If not SIM card or BT SAP is active then store is not available if ( id == MVPbkSimPhoneObserver::ESimCardNotInserted || id == MVPbkSimPhoneObserver::EBtSapActive ) diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp --- a/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -365,12 +365,12 @@ if ( curUnsavedCount == 0 ) { // Try to read the next entry, if one existed - static_cast(iOperationImpl)->StartL(); + iOperationImpl->StartL(); } else { CommitNextContactL(); - static_cast(iOperationImpl)->StartL(); + iOperationImpl->StartL(); } } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp --- a/phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -21,6 +21,16 @@ #include #endif +/// Unnamed namespace for local definitions +namespace { + +TBool ComparePtr( const TPtrC* aLeft, const TPtrC& aRight ) + { + return ( aLeft->Compare( aRight )== 0 ); + } + +} /// namespace + /** @param aDatabase A handle to the database. @param aProperties A contact properties object. @@ -216,10 +226,13 @@ } } // get email addresses - else if (isEmail && newEmails.Find(currField.TextStorage()->Text() ) == KErrNotFound) + else if (isEmail) { - DoNonPhoneWriteOpL(currField.TextStorage()->Text(), EInsert, KItemId, EEmailAddress); - newEmails.AppendL(currField.TextStorage()->Text() ); + if (newEmails.Find( currField.TextStorage()->Text(), ComparePtr ) == KErrNotFound) + { + DoNonPhoneWriteOpL(currField.TextStorage()->Text(), EInsert, KItemId, EEmailAddress); + newEmails.AppendL(currField.TextStorage()->Text() ); + } } // get SIP addresses else if (newSips.Find(currField.TextStorage()->Text() ) == KErrNotFound) @@ -290,10 +303,13 @@ } } // get email addresses - else if (isEmail && newEmails.Find(currField.TextStorage()->Text() ) == KErrNotFound) - { - newEmails.AppendL(currField.TextStorage()->Text() ); - } + else if (isEmail) + { + if (newEmails.Find(currField.TextStorage()->Text(), ComparePtr ) == KErrNotFound) + { + newEmails.AppendL(currField.TextStorage()->Text() ); + } + } // get SIP addresses else if (newSips.Find(currField.TextStorage()->Text() ) == KErrNotFound) { @@ -382,7 +398,7 @@ // we already have them in the db and they haven't changed... if (KType == EEmailAddress) { - matchIndex = aNewEmails.Find(valString); + matchIndex = aNewEmails.Find( valString, ComparePtr ); if (matchIndex != KErrNotFound) { aNewEmails.Remove(matchIndex); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp --- a/phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -359,9 +359,8 @@ } else if(iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) { - // It's an unsortable contact, just append its lightweight object - // to unsortable view contacts list. - contact->ChangeToLightweightObject(); + // It's an unsortable contact, + // just append it to unsortable view contacts list. iUnsortedViewContacts->AppendL(contact); CleanupStack::Pop(contact); } @@ -523,13 +522,11 @@ if(diff > 0) { resultContacts->AppendL(firstRightContact); - firstRightContact->ChangeToLightweightObject(); ++indexRight; } else { resultContacts->AppendL(firstLeftContact); - firstLeftContact->ChangeToLightweightObject(); ++indexLeft; if(diff == 0) { @@ -549,10 +546,6 @@ while(indexRight < aRightContacts.Count()) { CViewContact* firstRightContact = static_cast(aRightContacts[indexRight]); - - //change all the fullfil view objects to lightweight into the merged list. - firstRightContact->ChangeToLightweightObject(); - resultContacts->AppendL(firstRightContact); ++indexRight; } @@ -653,8 +646,6 @@ User::LeaveIfError(error); - //Make the view contact object to be lightweighted before insert to iViewContacts. - const_cast(aNewContact)->ChangeToLightweightObject(); iViewContacts->InsertL(aNewContact, position); return position; @@ -821,8 +812,6 @@ */ HBufC* CViewContactManager::AllFieldsLC(TInt aIndex, const TDesC& aSeparator) const { - TBool ifWasFullObject = EFalse; - CViewContact& viewContact = ViewContactAtL(aIndex); if(viewContact.IsLightweightObject()) { @@ -835,19 +824,10 @@ CleanupStack::PushL(contact); viewContact.CopyL(*contact); CleanupStack::PopAndDestroy(contact); - - ifWasFullObject = ETrue; } HBufC* buf = FieldsWithSeparatorLC(viewContact,aSeparator); - - if(ifWasFullObject) - { - //loadFullContent is set in ViewContactAtL if the viewContact was a lightweight object and - //loaded to be full content object in that function. So we need to change it to lightweight - //in order to save more memory. - viewContact.ChangeToLightweightObject(); - } + return buf; } @@ -893,7 +873,6 @@ { // unsortable contacts go at the end or beginning // we want this to be stable (e.g. when ICC becomes unlocked) - contact->ChangeToLightweightObject(); iUnsortedViewContacts->AppendL(contact); index = iUnsortedViewContacts->Count() - 1; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp --- a/phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -973,7 +973,8 @@ */ void CStateOpening::InitialStep() { - iActive->Register(*this, ETrue); + //iActive->Register(*this, ETrue); + iActive->Register( *this ); } /** diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp --- a/phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -390,10 +390,6 @@ delete iContact; iContact=NULL; iContact = CViewContact::NewL(contact); - - //Always keep server side local view in memory saving mode, so we - //change the view contact object stored in iView into lightweight object - const_cast(contact).ChangeToLightweightObject(); const TInt externalizedSize=iContact->ExternalizedSize(); TPckgBuf pckg(externalizedSize); @@ -668,10 +664,6 @@ idMap.iMapping=i; User::LeaveIfError(array.Append(idMap)); } - - //Always keep server side local view in memory saving mode, so we - //change the view contact object stored in iView into lightweight object - const_cast( contact ).ChangeToLightweightObject(); } // Externalize array to client. diff -r 35018d46c3dc -r 22a79a0cd291 phonebookengines/contactsmodel/groupsql/cntmodel.iby --- a/phonebookengines/contactsmodel/groupsql/cntmodel.iby Fri May 28 13:07:31 2010 +0100 +++ b/phonebookengines/contactsmodel/groupsql/cntmodel.iby Mon Jul 12 13:42:58 2010 +0100 @@ -30,7 +30,7 @@ REM Configurable heap size for contact server. #ifndef CONTACT_SERVER_MAX_HEAPSIZE -#define CONTACT_SERVER_MAX_HEAPSIZE 0x100000 +#define CONTACT_SERVER_MAX_HEAPSIZE 0x200000 #endif file=ABI_DIR\BUILD_DIR\cntsrv.exe System\Programs\cntsrv.exe heapmax=CONTACT_SERVER_MAX_HEAPSIZE diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp --- a/phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -45,6 +45,7 @@ #include #include #include +#include // Virtual Phonebook #include @@ -55,6 +56,7 @@ #include #include #include +#include // Debugging headers #include @@ -262,7 +264,12 @@ void CPbk2AppUi::ExitL() { PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL")); - + + TInt err = RProperty::Set( TUid::Uid( KPbk2PSUidPublic ), + KPhonebookOpenCompleted, EPhonebookClosed ); + PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING + ("CPbk2AppUi::ExitL set pubsub key to EPhonebookClosed (%d)"), err); + #ifdef _DEBUG PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING("CPbk2AppUi::ExitL real exit debug")); CAknViewAppUi::ProcessCommandL( EAknCmdExit ); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def --- a/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def Mon Jul 12 13:42:58 2010 +0100 @@ -18,4 +18,5 @@ ?Data@CSpbContactDataModel@@QBE?AVTPtrC8@@W4TBinaryTypes@1@@Z @ 17 NONAME ; class TPtrC8 CSpbContactDataModel::Data(enum CSpbContactDataModel::TBinaryTypes) const ?ListBoxModel@CSpbContactDataModel@@QAEAAVMDesC16Array@@XZ @ 18 NONAME ; class MDesC16Array & CSpbContactDataModel::ListBoxModel(void) ?CleanContentL@CSpbContentProvider@@QAEXAAVMVPbkContactStore@@@Z @ 19 NONAME ; void CSpbContentProvider::CleanContentL(class MVPbkContactStore &) + ?ListIndex@CSpbContactDataModel@@QAEHH@Z @ 20 NONAME ; int CSpbContactDataModel::ListIndex(int) diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def --- a/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def Mon Jul 12 13:42:58 2010 +0100 @@ -20,4 +20,5 @@ _ZTI20CSpbContactDataModel @ 19 NONAME _ZTV20CSpbContactDataModel @ 20 NONAME _ZN19CSpbContentProvider13CleanContentLER17MVPbkContactStore @ 21 NONAME + _ZN20CSpbContactDataModel9ListIndexEi @ 22 NONAME diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h --- a/phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h Mon Jul 12 13:42:58 2010 +0100 @@ -36,13 +36,20 @@ class MPbk2ContactEditorControlExtension; class MVPbkStoreContactField; class TLocality; +class CMnMapView; +enum TCurrentMapLaunchedByState + { + EMapNone = 1, + EMapAssignFromMaps, + EMapShowOnMaps + }; // CLASS DECLARATION /** * Phonebook 2 show on map command object. */ -class CPmapCmd : public CBase, +class CPmapCmd : public CActive, public MPbk2Command, public MVPbkContactObserver { @@ -76,6 +83,27 @@ */ ~CPmapCmd(); + // CActive-related methods + /** + * RunL method to handle the user selection + */ + void RunL(); + + /** + * Cancel method to handle the user selection + */ + void DoCancel(); + + /** + * Function to handle any errors in async request + * @param aError Error Code + */ + TInt RunError( TInt aError ); + + /** + * Disconnects from provider, when operation is completed + */ + void Reset(); public: //From MVPbkContactObserver void ContactOperationCompleted( TContactOpResult aResult ); void ContactOperationFailed( @@ -85,6 +113,7 @@ public: // From MPbk2Command void ExecuteLD(); + void ExecuteL(); void AddObserver( MPbk2CommandObserver& aObserver ); void ResetUiControl( @@ -235,6 +264,16 @@ */ TPbk2FieldGroupId GetFieldGroupL( MVPbkStoreContactField& aField ); + /** + * Handle the selection of map which was launched from Show On Map option. + */ + void HandleSelectiOnShowOnMapsL(); + + /** + * Handle the selection of map which was launched from Assign From Maps option. + */ + void HandleSelectiOnAssignFromMapsL(); + private: // Data /// Ref: Contact editor control MPbk2ContactEditorControl* iEditorControl; @@ -246,12 +285,20 @@ MPbk2CommandObserver* iObserver; /// Own: Map View Provider CMnProvider* iMapViewProvider; + /// Own: Map View + CMnMapView* iMapView; /// Own: Is in editor address view? TBool iAddressView; /// Own: command id TInt iCommandId; /// Own: Is in editor address view? TBool iAddressUpdatePrompt; + /// Own: Current map launched is by which option + TCurrentMapLaunchedByState iCurrentMapLaunchedByState; + /// Own: Current AddressType + TVPbkFieldTypeParameter iAddressType; + /// Own: Is already address is there? + TBool iNoAddress; }; #endif // CPMAPCMD_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h --- a/phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h Mon Jul 12 13:42:58 2010 +0100 @@ -30,7 +30,7 @@ class MPbk2ContactEditorControl; class MPbk2ContactEditorUIField; class MPbk2UIField; - +class MPbk2Command; // CLASS DECLARATION class CPmapContactEditorExtension : public CBase, public MPbk2ContactEditorExtension, @@ -107,7 +107,8 @@ MVPbkStoreContact& iContact; /// Ref: Contact editor control MPbk2ContactEditorControl& iEditorControl; - + /// Own: Map command controller + MPbk2Command* iCmd; }; #endif // CPMAPCONTACTEDITOREXTENSION_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp --- a/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -96,11 +96,14 @@ // CPmapCmd::CPmapCmd( MPbk2ContactEditorControl& aEditorControl, MVPbkStoreContact& aContact, TInt aCommandId ) : + CActive( CActive::EPriorityStandard ), iEditorControl( &aEditorControl ), iContact( &aContact ), iCommandId( aCommandId ) { + CActiveScheduler::Add( this ); iAddressUpdatePrompt = ETrue; + iCurrentMapLaunchedByState = EMapNone; } // -------------------------------------------------------------------------- @@ -108,10 +111,13 @@ // -------------------------------------------------------------------------- // CPmapCmd::CPmapCmd( MPbk2ContactUiControl& aUiControl, TInt aCommandId ) : + CActive( CActive::EPriorityStandard ), iUiControl( &aUiControl ), iCommandId( aCommandId ) { + CActiveScheduler::Add( this ); iAddressUpdatePrompt = ETrue; + iCurrentMapLaunchedByState = EMapNone; } // -------------------------------------------------------------------------- @@ -120,6 +126,14 @@ // CPmapCmd::~CPmapCmd() { + Cancel(); + if(iMapView) + { + iMapView->ResetLandmarksToShow(); + delete iMapView; + iMapView = NULL; + } + ReleaseLandmarkResources(); if( iUiControl ) { iUiControl->RegisterCommand( NULL ); @@ -230,14 +244,17 @@ return ret; } +void CPmapCmd::ExecuteLD() + { + ExecuteL(); + } + // -------------------------------------------------------------------------- // CPmapCmd::ExecuteLD // -------------------------------------------------------------------------- // -void CPmapCmd::ExecuteLD() +void CPmapCmd::ExecuteL() { - CleanupStack::PushL( this ); - PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD")); @@ -258,17 +275,7 @@ else { CleanupStack::PopAndDestroy( prompt ); - FinishProcess(); - - if( !iUiControl ) - { - CleanupStack::PopAndDestroy( this ); - } - else - { - CleanupStack::Pop( this ); - } - + FinishProcess(); PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD end")); @@ -309,24 +316,17 @@ if( iCommandId == EPbk2ExtensionShowOnMap ) { EditorShowOnMapsL(addressType); + return; // as the asynchronous request is processed next part will be executed inside RunL of this class. } else if( iCommandId == EPbk2ExtensionAssignFromMap ) { EditorAssignFromMapsL(addressType); + return; // as the asynchronous request is processed next part will be executed inside RunL of this class. } } FinishProcess(); - if( !iUiControl ) - { - CleanupStack::PopAndDestroy( this ); - } - else - { - CleanupStack::Pop( this ); - } - PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD end")); } @@ -568,9 +568,8 @@ // void CPmapCmd::EditorShowOnMapsL( TVPbkFieldTypeParameter aAddressType ) { - CMnMapView* mapview = CMnMapView::NewChainedL( *iMapViewProvider ); - CleanupStack::PushL( mapview ); - + iAddressType = aAddressType; + RPointerArray landmarks; CleanupClosePushL( landmarks ); @@ -586,198 +585,38 @@ || landmark->GetPosition( locality ) == KErrNone ) { landmarks.AppendL( landmark ); - mapview->AddLandmarksToShowL( landmarks ); } if ( landmark->GetPosition( locality ) == KErrNone ) { - mapview->ShowMapL(); + if(iMapView) + { + delete iMapView; + iMapView = NULL; + } + iMapView = CMnMapView::NewL( *iMapViewProvider ); + iMapView->AddLandmarksToShowL( landmarks ); + iMapView->ShowMapL(); CleanupStack::PopAndDestroy( landmark ); CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); + delete iMapView; + iMapView = NULL; + FinishProcess(); } else { - TRequestStatus status; - mapview->SelectFromMapL( status ); - User::WaitForRequest( status ); - TBool update = EFalse; - TBool geocoordsExist = EFalse; - - CPosLandmark* result = NULL; - if ( status.Int() == KErrNone ) + if(iMapView) { - result = mapview->RetrieveSelectionResultL(); - if ( result->GetPosition( locality ) == KErrNone ) - { - geocoordsExist = ETrue; - } - if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) - || result->IsPositionFieldAvailable( EPositionFieldCity ) - || result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - update = ETrue; - } - + delete iMapView; + iMapView = NULL; } + iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); + iMapView->AddLandmarksToShowL( landmarks ); + iMapView->SelectFromMapL( iStatus ); + iCurrentMapLaunchedByState = EMapShowOnMaps; + SetActive(); CleanupStack::PopAndDestroy( landmark ); CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); - if ( result ) - { - CleanupStack::PushL( result ); - } - - if ( update ) - { - - const TInt KGranularity = 4; - CDesCArrayFlat* arrFields = new (ELeave) CDesCArrayFlat( - KGranularity ); - CleanupStack::PushL( arrFields ); - HBufC* addrLebel = NULL; - - switch ( aAddressType ) - { - case EVPbkVersitParamPREF: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS ); - break; - case EVPbkVersitParamHOME: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS_HOME ); - break; - case EVPbkVersitParamWORK: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS_WORK ); - break; - default: - User::Leave( KErrArgument ); - } - arrFields->AppendL( addrLebel->Des() ); - _LIT(KComma, ","); - _LIT(KSpace, " "); - TInt lenght = 0; - TPtrC street; - if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) - { - result->GetPositionField( EPositionFieldStreet, street ); - lenght += street.Length(); - } - - TPtrC city; - if ( result->IsPositionFieldAvailable( EPositionFieldCity ) ) - { - result->GetPositionField( EPositionFieldCity, city ); - if ( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += city.Length(); - } - - TPtrC country; - if ( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - result->GetPositionField( EPositionFieldCountry, country ); - if ( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += country.Length(); - } - - RBuf newAddr; - newAddr.CreateL( lenght ); - CleanupClosePushL( newAddr ); - - if ( street.Length() ) - { - newAddr += street; - } - - if ( city.Length() ) - { - if ( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += city; - } - - if ( country.Length() ) - { - if ( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += country; - } - - arrFields->AppendL( newAddr ); - HBufC* prompt = StringLoader::LoadLC( - R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if ( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) - { - update = EFalse; - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( &newAddr ); - CleanupStack::PopAndDestroy( addrLebel ); - CleanupStack::PopAndDestroy( arrFields ); - - } - if ( update ) - { - if ( !iEditorControl ) - { - iContact->LockL( *this ); - CActiveScheduler::Start(); - } - UpdateFieldL( *result, EPositionFieldCountry, - EVPbkVersitSubFieldCountry, aAddressType ); - UpdateFieldL( *result, EPositionFieldCity, - EVPbkVersitSubFieldLocality, aAddressType ); - UpdateFieldL( *result, EPositionFieldStreet, - EVPbkVersitSubFieldStreet, aAddressType ); - UpdateFieldL( *result, EPositionFieldPostalCode, - EVPbkVersitSubFieldPostalCode, aAddressType ); - UpdateFieldL( *result, EPositionFieldLocality, - EVPbkVersitSubFieldRegion, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldPostOfficeAddress, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldExtendedAddress, aAddressType ); - - if ( geocoordsExist ) - { - UpdateCoordsL( locality, aAddressType ); - } - if ( !iEditorControl ) - { - iContact->CommitL( *this ); - CActiveScheduler::Start(); - } - if ( ControlExtension() ) - { - ControlExtension()->UpdateControlsL(); - } - - HBufC* text = StringLoader::LoadLC( - R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); - CAknInformationNote* note = new (ELeave) CAknInformationNote( - ETrue ); - note->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - - if ( result ) - { - CleanupStack::PopAndDestroy( result ); - } } } @@ -1028,9 +867,15 @@ // void CPmapCmd::EditorAssignFromMapsL(TVPbkFieldTypeParameter aAddressType) { - CMnMapView* mapview = CMnMapView::NewChainedL( *iMapViewProvider ); - CleanupStack::PushL( mapview ); - + if(iMapView) + { + delete iMapView; + iMapView = NULL; + } + + iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); + iAddressType = aAddressType; + RPointerArray landmarks; CleanupClosePushL( landmarks ); @@ -1042,195 +887,19 @@ FillLandmarkL( *landmark, aAddressType ); } TLocality locality; - TBool noAddress = ETrue; + iNoAddress = ETrue; if( landmark->NumOfAvailablePositionFields() > 0 || landmark->GetPosition( locality ) == KErrNone ) { landmarks.AppendL( landmark ); - mapview->AddLandmarksToShowL( landmarks ); - noAddress = EFalse; + iMapView->AddLandmarksToShowL( landmarks ); + iNoAddress = EFalse; } - TRequestStatus status; - mapview->SelectFromMapL( status ); - User::WaitForRequest( status ); - - TBool update = EFalse; - TBool geocoordsExist = EFalse; - - CPosLandmark* result = NULL; - if ( status.Int() == KErrNone ) - { - result = mapview->RetrieveSelectionResultL(); - if ( result->GetPosition( locality ) == KErrNone ) - { - geocoordsExist = ETrue; - } - - if( result->IsPositionFieldAvailable( EPositionFieldStreet ) || - result->IsPositionFieldAvailable( EPositionFieldCity ) || - result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - update= ETrue; - } - - } - CleanupStack::PopAndDestroy( landmark ); - CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); - if( result ) - { - CleanupStack::PushL( result ); - } - - if( update ) - { - if( iAddressUpdatePrompt && !noAddress ) - { - const TInt KGranularity = 4; - CDesCArrayFlat* arrFields = new ( ELeave ) CDesCArrayFlat - ( KGranularity ); - CleanupStack::PushL(arrFields); - - HBufC* addrLebel = NULL; - - switch( aAddressType ) - { - case EVPbkVersitParamPREF: - addrLebel = StringLoader::LoadLC(R_QTN_PHOB_HEADER_ADDRESS ); - break; - case EVPbkVersitParamHOME: - addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_HOME ); - break; - case EVPbkVersitParamWORK: - addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_WORK ); - break; - default: - User::Leave(KErrArgument); - } - arrFields->AppendL( addrLebel->Des() ); - - _LIT(KComma, ","); - _LIT(KSpace, " "); - - TInt lenght = 0; - TPtrC street; - if( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) - { - result->GetPositionField( EPositionFieldStreet, street ); - lenght += street.Length(); - } - - TPtrC city; - if( result->IsPositionFieldAvailable( EPositionFieldCity ) ) - { - result->GetPositionField( EPositionFieldCity, city ); - if( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += city.Length(); - } - - TPtrC country; - if( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - result->GetPositionField( EPositionFieldCountry, country ); - if( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += country.Length(); - } - - RBuf newAddr; - newAddr.CreateL( lenght ); - CleanupClosePushL( newAddr ); - - if( street.Length() ) - { - newAddr += street; - } - - if( city.Length() ) - { - if( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += city; - } - - if( country.Length() ) - { - if( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += country; - } - - arrFields->AppendL( newAddr ); - HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) - { - update = EFalse; - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( &newAddr ); - CleanupStack::PopAndDestroy( addrLebel ); - CleanupStack::PopAndDestroy( arrFields ); - } - - if( update ) - { - if ( !iEditorControl ) - { - iContact->LockL( *this ); - CActiveScheduler::Start(); - } - UpdateFieldL( *result, EPositionFieldCountry, - EVPbkVersitSubFieldCountry, aAddressType ); - UpdateFieldL( *result, EPositionFieldCity, - EVPbkVersitSubFieldLocality, aAddressType ); - UpdateFieldL( *result, EPositionFieldStreet, - EVPbkVersitSubFieldStreet, aAddressType ); - UpdateFieldL( *result, EPositionFieldPostalCode, - EVPbkVersitSubFieldPostalCode, aAddressType ); - UpdateFieldL( *result, EPositionFieldLocality, - EVPbkVersitSubFieldRegion, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldPostOfficeAddress, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldExtendedAddress, aAddressType ); - - if( geocoordsExist ) - { - UpdateCoordsL( locality, aAddressType ); - } - if ( !iEditorControl ) - { - iContact->CommitL( *this ); - CActiveScheduler::Start(); - } - if( ControlExtension() ) - { - ControlExtension()->UpdateControlsL(); - } - - HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); - note->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - } - - if( result ) - { - CleanupStack::PopAndDestroy( result ); - } + iMapView->SelectFromMapL( iStatus ); + iCurrentMapLaunchedByState = EMapAssignFromMaps; + SetActive(); + CleanupStack::PopAndDestroy( landmark ); + CleanupStack::PopAndDestroy( &landmarks ); } // -------------------------------------------------------------------------- @@ -1539,6 +1208,383 @@ } // -------------------------------------------------------------------------- +// CPmapCmd::HandleSelectiOnAssignFromMapsL +// -------------------------------------------------------------------------- +// +void CPmapCmd::HandleSelectiOnAssignFromMapsL() + { + TBool update = EFalse; + TBool geocoordsExist = EFalse; + + TLocality locality; + CPosLandmark* result = NULL; + TInt currentstatus = iStatus.Int(); + if ( iStatus.Int() == KErrNone && iMapView) + { + result = iMapView->RetrieveSelectionResultL(); + // Get the location name if available + //-----------------Emulator Hack------------------------------- + // result->SetLandmarkNameL(_L("Jupiter Tech Park")); +// result->SetPositionFieldL(EPositionFieldCity, _L("Bangalore")); +// result->SetPositionFieldL(EPositionFieldCountry, _L("India")); + //------------------------------------------------------------- + if(result->GetPosition( locality ) == KErrNone ) + { + geocoordsExist = ETrue; + } + + if( result->IsPositionFieldAvailable( EPositionFieldStreet ) || + result->IsPositionFieldAvailable( EPositionFieldCity ) || + result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + update= ETrue; + } + } + delete iMapView; + iMapView = NULL; + if( result ) + { + CleanupStack::PushL( result ); + } + + if( update ) + { + if( iAddressUpdatePrompt && !iNoAddress ) + { + const TInt KGranularity = 4; + CDesCArrayFlat* arrFields = new ( ELeave ) CDesCArrayFlat + ( KGranularity ); + CleanupStack::PushL(arrFields); + + HBufC* addrLebel = NULL; + + switch( iAddressType ) + { + case EVPbkVersitParamPREF: + addrLebel = StringLoader::LoadLC(R_QTN_PHOB_HEADER_ADDRESS ); + break; + case EVPbkVersitParamHOME: + addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_HOME ); + break; + case EVPbkVersitParamWORK: + addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_WORK ); + break; + default: + User::Leave(KErrArgument); + } + arrFields->AppendL( addrLebel->Des() ); + + _LIT(KComma, ","); + _LIT(KSpace, " "); + + TInt lenght = 0; + TPtrC street; + if( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) + { + result->GetPositionField( EPositionFieldStreet, street ); + lenght += street.Length(); + } + + TPtrC city; + if( result->IsPositionFieldAvailable( EPositionFieldCity ) ) + { + result->GetPositionField( EPositionFieldCity, city ); + if( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += city.Length(); + } + + TPtrC country; + if( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + result->GetPositionField( EPositionFieldCountry, country ); + if( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += country.Length(); + } + + RBuf newAddr; + newAddr.CreateL( lenght ); + CleanupClosePushL( newAddr ); + + if( street.Length() ) + { + newAddr += street; + } + + if( city.Length() ) + { + if( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += city; + } + + if( country.Length() ) + { + if( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += country; + } + + arrFields->AppendL( newAddr ); + HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) + { + update = EFalse; + } + CleanupStack::PopAndDestroy( prompt ); + CleanupStack::PopAndDestroy( &newAddr ); + CleanupStack::PopAndDestroy( addrLebel ); + CleanupStack::PopAndDestroy( arrFields ); + } + + if( update ) + { + if ( !iEditorControl ) + { + iContact->LockL( *this ); + CActiveScheduler::Start(); + } + UpdateFieldL( *result, EPositionFieldCountry, + EVPbkVersitSubFieldCountry, iAddressType ); + UpdateFieldL( *result, EPositionFieldCity, + EVPbkVersitSubFieldLocality, iAddressType ); + UpdateFieldL( *result, EPositionFieldStreet, + EVPbkVersitSubFieldStreet, iAddressType ); + UpdateFieldL( *result, EPositionFieldPostalCode, + EVPbkVersitSubFieldPostalCode, iAddressType ); + UpdateFieldL( *result, EPositionFieldLocality, + EVPbkVersitSubFieldRegion, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldExtendedAddress, iAddressType ); + + if( geocoordsExist ) + { + UpdateCoordsL( locality, iAddressType ); + } + if ( !iEditorControl ) + { + iContact->CommitL( *this ); + CActiveScheduler::Start(); + } + if( ControlExtension() ) + { + ControlExtension()->UpdateControlsL(); + } + + HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); + CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + } + + if( result ) + { + CleanupStack::PopAndDestroy( result ); + } + } + +// -------------------------------------------------------------------------- +// CPmapCmd::HandleSelectiOnAssignFromMapsL +// -------------------------------------------------------------------------- +// +void CPmapCmd::HandleSelectiOnShowOnMapsL() + { + TBool update = EFalse; + TBool geocoordsExist = EFalse; + + TLocality locality; + CPosLandmark* result = NULL; + if ( iStatus.Int() == KErrNone && iMapView) + { + result = iMapView->RetrieveSelectionResultL(); + if ( result->GetPosition( locality ) == KErrNone ) + { + geocoordsExist = ETrue; + } + if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) + || result->IsPositionFieldAvailable( EPositionFieldCity ) + || result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + update = ETrue; + } + + } + + delete iMapView; + iMapView = NULL; + if ( result ) + { + CleanupStack::PushL( result ); + } + + if ( update ) + { + + const TInt KGranularity = 4; + CDesCArrayFlat* arrFields = new (ELeave) CDesCArrayFlat( + KGranularity ); + CleanupStack::PushL( arrFields ); + HBufC* addrLebel = NULL; + + switch ( iAddressType ) + { + case EVPbkVersitParamPREF: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS ); + break; + case EVPbkVersitParamHOME: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS_HOME ); + break; + case EVPbkVersitParamWORK: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS_WORK ); + break; + default: + User::Leave( KErrArgument ); + } + arrFields->AppendL( addrLebel->Des() ); + _LIT(KComma, ","); + _LIT(KSpace, " "); + TInt lenght = 0; + TPtrC street; + if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) + { + result->GetPositionField( EPositionFieldStreet, street ); + lenght += street.Length(); + } + + TPtrC city; + if ( result->IsPositionFieldAvailable( EPositionFieldCity ) ) + { + result->GetPositionField( EPositionFieldCity, city ); + if ( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += city.Length(); + } + + TPtrC country; + if ( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + result->GetPositionField( EPositionFieldCountry, country ); + if ( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += country.Length(); + } + + RBuf newAddr; + newAddr.CreateL( lenght ); + CleanupClosePushL( newAddr ); + + if ( street.Length() ) + { + newAddr += street; + } + + if ( city.Length() ) + { + if ( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += city; + } + + if ( country.Length() ) + { + if ( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += country; + } + + arrFields->AppendL( newAddr ); + HBufC* prompt = StringLoader::LoadLC( + R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if ( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) + { + update = EFalse; + } + CleanupStack::PopAndDestroy( prompt ); + CleanupStack::PopAndDestroy( &newAddr ); + CleanupStack::PopAndDestroy( addrLebel ); + CleanupStack::PopAndDestroy( arrFields ); + + } + if ( update ) + { + if ( !iEditorControl ) + { + iContact->LockL( *this ); + CActiveScheduler::Start(); + } + UpdateFieldL( *result, EPositionFieldCountry, + EVPbkVersitSubFieldCountry, iAddressType ); + UpdateFieldL( *result, EPositionFieldCity, + EVPbkVersitSubFieldLocality, iAddressType ); + UpdateFieldL( *result, EPositionFieldStreet, + EVPbkVersitSubFieldStreet, iAddressType ); + UpdateFieldL( *result, EPositionFieldPostalCode, + EVPbkVersitSubFieldPostalCode, iAddressType ); + UpdateFieldL( *result, EPositionFieldLocality, + EVPbkVersitSubFieldRegion, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldExtendedAddress, iAddressType ); + + if ( geocoordsExist ) + { + UpdateCoordsL( locality, iAddressType ); + } + if ( !iEditorControl ) + { + iContact->CommitL( *this ); + CActiveScheduler::Start(); + } + if ( ControlExtension() ) + { + ControlExtension()->UpdateControlsL(); + } + + HBufC* text = StringLoader::LoadLC( + R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( + ETrue ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + + if ( result ) + { + CleanupStack::PopAndDestroy( result ); + } + } + +// -------------------------------------------------------------------------- // CPmapCmd::ContactOperationFailed // -------------------------------------------------------------------------- // @@ -1548,4 +1594,85 @@ CActiveScheduler::Stop(); } +// ---------------------------------------------------------------------------- +// CPmapCmd::RunL +// RunL method to handle the user selection +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::RunL() + { + // request is completed, inform observer + TInt maperror = iStatus.Int(); + if(iStatus.Int() == KErrNone) + { + switch(iCurrentMapLaunchedByState) + { + case EMapAssignFromMaps: + { + HandleSelectiOnAssignFromMapsL(); + } + break; + case EMapShowOnMaps: + { + HandleSelectiOnShowOnMapsL(); + } + break; + default: + break; + } + } + FinishProcess(); + + if(!iUiControl) + { + // delete this; + } + iCurrentMapLaunchedByState = EMapNone; + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::RunError +// Function to handle any errors in async request +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +TInt CPmapCmd::RunError( TInt /*aError*/ ) + { + Reset(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::DoCancel +// Cancel method to handle the user selection +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::DoCancel() + { + if ( IsActive() && iMapView ) + { + iMapView->Cancel(); + } + Reset(); + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::Reset +// Disconnects from provider, when operation is completed +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::Reset() + { + if(iMapView) + { + iMapView->ResetLandmarksToShow(); + delete iMapView; + iMapView = NULL; + } + ReleaseLandmarkResources(); + } + // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp --- a/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -101,6 +101,11 @@ // CPmapContactEditorExtension::~CPmapContactEditorExtension() { + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } } // -------------------------------------------------------------------------- @@ -170,16 +175,26 @@ { case EPbk2ExtensionShowOnMap: { - MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); - // Execute the command - cmd->ExecuteLD(); + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } + iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); + // Execute the command + iCmd->ExecuteLD(); return ETrue; } case EPbk2ExtensionAssignFromMap: { - MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } + iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); // Execute the command - cmd->ExecuteLD(); + iCmd->ExecuteLD(); return ETrue; } default: diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2DelayedWaitNote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2DelayedWaitNote.h Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Phonebook2 Adaptive Search Grid +* helper class +*/ + + +#ifndef CPBK2DELAYEDWAITNOTE_H +#define CPBK2DELAYEDWAITNOTE_H + +// INCLUDES +#include + +#include + +/** + * Utility class that implements the wait logic and + * process decoration if needed. + */ +class CPbk2DelayedWaitNote : public CTimer, + private MPbk2ProcessDecoratorObserver + { + public: // Construction and destruction + + /** + * Creates a new instance of this class. + * + * @return A new instance of this class. + */ + static CPbk2DelayedWaitNote* NewL( MPbk2ProcessDecoratorObserver& aObserver, TInt aResourceId ); + + /** + * Destructor. + */ + ~CPbk2DelayedWaitNote(); + + public: // Interface + + /** + * Starts the timer and after it expires, will display the + * wait note decorator. + */ + void Start(); + /** + * Stops displaying the wait note decorator or just stops the timer + * if the wait note is not yet shown. + * Call to Stop will always result to ProcessDismissed call of the observer. + */ + void Stop(); + + private: // From CTimer + void RunL(); + TInt RunError( TInt aError ); + + private: // From MPbk2ProcessDecoratorObserver + void ProcessDismissed( TInt aCancelCode ); + + private: // Implementation + CPbk2DelayedWaitNote( MPbk2ProcessDecoratorObserver& aObserver, TInt aResourceId ); + void ConstructL(); + void DismissWaitNote(); + + private: // Data + /// Own: Decorator for the wait note process + MPbk2ProcessDecorator* iDecorator; + // Notifiy if wait note is on + TBool iStarted; + // Ref: + MPbk2ProcessDecoratorObserver& iObserver; + TInt iResourceId; + }; + +#endif // CPBK2DELAYEDWAITNOTE_H + +// End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h --- a/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h Mon Jul 12 13:42:58 2010 +0100 @@ -16,8 +16,8 @@ */ -#ifndef CPbk2NlxAddToTopContactsCmd_H -#define CPbk2NlxAddToTopContactsCmd_H +#ifndef CPBK2NLXADDTOTOPCONTACTSCMD_H +#define CPBK2NLXADDTOTOPCONTACTSCMD_H // INCLUDES #include @@ -29,18 +29,22 @@ #include #include +#include "CPbk2DelayedWaitNote.h" + // FORWARD DECLARATIONS class MPbk2ContactUiControl; class MVPbkContactOperationBase; class CVPbkTopContactManager; class CPbk2ContactRelocator; -class MVPbkContactOperationBase; class MPbk2ContactLinkIterator; class CVPbkContactLinkArray; class CVPbkContactManager; class MPbk2DialogEliminator; class CVPbkContactStoreUriArray; + + + // CLASS DECLARATION /** * Phonebook 2 add to top contacts command object. @@ -165,7 +169,7 @@ TInt CountSimContacts() const; CVPbkContactLinkArray* CreateSimContactsArrayLC() const; void ReplaceSimContactsL(); - void ShowWaitNoteL(); + void ShowDelayedWaitNoteL(); private: // Data @@ -200,10 +204,10 @@ MPbk2DialogEliminator* iFetchDlgEliminator; /// Own: Store uris used for the fetch dlg CVPbkContactStoreUriArray* iStoreUris; - /// Own: Decorator for the wait note process - MPbk2ProcessDecorator* iDecorator; + /// Own: Decorator for the delayed wait note process + CPbk2DelayedWaitNote* iDelayedWaitNote; }; -#endif // CPbk2NlxAddToTopContactsCmd_H +#endif // CPBK2NLXADDTOTOPCONTACTSCMD_H // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h --- a/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h Mon Jul 12 13:42:58 2010 +0100 @@ -16,14 +16,16 @@ */ -#ifndef CPbk2NlxRemoveFromTopContactsCmd_H -#define CPbk2NlxRemoveFromTopContactsCmd_H +#ifndef CPBK2NLXREMOVEFROMTOPCONTACTSCMD_H +#define CPBK2NLXREMOVEFROMTOPCONTACTSCMD_H // INCLUDES #include #include #include +#include "CPbk2DelayedWaitNote.h" + // FORWARD DECLARATIONS class MPbk2ContactUiControl; class CVPbkTopContactManager; @@ -38,7 +40,8 @@ public CActive, public MPbk2Command, public MVPbkOperationObserver, - public MVPbkOperationErrorObserver + public MVPbkOperationErrorObserver, + public MPbk2ProcessDecoratorObserver { public: // Construction and destruction @@ -77,8 +80,12 @@ void RunL(); TInt RunError(TInt aError); + private: // From MPbk2ProcessDecoratorObserver + void ProcessDismissed( TInt aCancelCode ); + private: // Implementation void RemoveTopContactL(); + void ShowDelayedWaitNoteL(); private: // Data //Ref @@ -89,8 +96,10 @@ MVPbkContactOperationBase* iVPbkContactOperationBase; //Own: CVPbkTopContactManager* iVPbkTopContactManager; + + CPbk2DelayedWaitNote* iDelayedWaitNote; }; -#endif // CPbk2NlxRemoveFromTopContactsCmd_H +#endif // CPBK2NLXREMOVEFROMTOPCONTACTSCMD_H // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/src/CPbk2DelayedWaitNote.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2DelayedWaitNote.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,115 @@ +/* +* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Phonebook2 helper class +* +*/ + +// INCLUDES +#include +#include +#include +#include "CPbk2DelayedWaitNote.h" + +#include // For EActivePriorityClockTimer + +const TInt KDelay = 500000; // 0.5 seconds + +CPbk2DelayedWaitNote* CPbk2DelayedWaitNote::NewL + ( MPbk2ProcessDecoratorObserver& aObserver, TInt aResourceId ) + { + CPbk2DelayedWaitNote* self = + new ( ELeave ) CPbk2DelayedWaitNote( aObserver, aResourceId ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +CPbk2DelayedWaitNote::~CPbk2DelayedWaitNote() + { + Cancel(); + delete iDecorator; + iDecorator = NULL; + } + +CPbk2DelayedWaitNote::CPbk2DelayedWaitNote + ( MPbk2ProcessDecoratorObserver& aObserver, TInt aResourceId ) + : CTimer( EActivePriorityClockTimer ), iObserver( aObserver ), + iResourceId( aResourceId ) + { + + } + +void CPbk2DelayedWaitNote::ConstructL() + { + CActiveScheduler::Add( this ); + CTimer::ConstructL(); + } + +void CPbk2DelayedWaitNote::Stop() + { + Cancel(); + DismissWaitNote(); + } + +void CPbk2DelayedWaitNote::Start() + { + if ( !IsActive() && !iStarted ) + { + After( TTimeIntervalMicroSeconds32( KDelay ) ); + } + } + +void CPbk2DelayedWaitNote::RunL() + { + if( !iStarted && !iDecorator ) + { + iDecorator = Pbk2ProcessDecoratorFactory::CreateWaitNoteDecoratorL + ( iResourceId, EFalse ); + iDecorator->SetObserver( *this ); + iDecorator->ProcessStartedL( 0 ); // wait note doesn't care about amount + iStarted = ETrue; + } + } + +void CPbk2DelayedWaitNote::ProcessDismissed( TInt aCancelCode ) + { + iStarted = EFalse; + iObserver.ProcessDismissed( aCancelCode ); + } + +TInt CPbk2DelayedWaitNote::RunError( TInt /*aError*/ ) + { + iStarted = EFalse; + DismissWaitNote(); + return KErrNone; + } + +void CPbk2DelayedWaitNote::DismissWaitNote() + { + if ( iDecorator ) + { + TRAPD( err, iDecorator->ProcessStopped() ); + if ( err != KErrNone ) + { + delete iDecorator; + iDecorator = NULL; + } + } + else + { + iObserver.ProcessDismissed( EAknSoftkeyDone ); + } + } +// End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -139,7 +140,7 @@ delete iMarkedEntries; delete iContactIterator; delete iContactOperation; //Cancels request if pending - delete iDecorator; + delete iDelayedWaitNote; delete iVPbkTopContactManager; delete iContactRelocator; } @@ -170,12 +171,33 @@ { iUiControl->RegisterCommand( this ); } - + iContactManager = &Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager(); - iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager ); + + // For performance optimization, get the top contacts view + // from pbk2 applications services and provide to top contact + // manager if the view is available + + MPbk2ContactViewSupplier2* viewSupplierExtension = + reinterpret_cast( + Phonebook2::Pbk2AppUi()->ApplicationServices().ViewSupplier(). + MPbk2ContactViewSupplierExtension( + KMPbk2ContactViewSupplierExtension2Uid )); + + MVPbkContactViewBase* topContactsView = viewSupplierExtension->TopContactsViewL(); + if ( topContactsView ) + { + iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager, + *topContactsView); + } + else + { + iVPbkTopContactManager = CVPbkTopContactManager::NewL( *iContactManager ); + } + } - + // -------------------------------------------------------------------------- // CPbk2NlxAddToTopContactsCmd::ExecuteLD // -------------------------------------------------------------------------- @@ -260,7 +282,7 @@ { StartNext(ESetAsTopContact); } - ShowWaitNoteL(); + ShowDelayedWaitNoteL(); } break; case ESetAsTopContact: @@ -594,10 +616,10 @@ CCoeEnv::Static()->HandleError( aReason ); } - if ( iDecorator ) + if ( iDelayedWaitNote ) { - // wait for callback from the wait note and finish then - iDecorator->ProcessStopped(); + // wait for callback from the wait note and finish then + iDelayedWaitNote->Stop(); } else { @@ -618,6 +640,10 @@ SetActive(); } +// --------------------------------------------------------------------------- +// CPbk2NlxAddToTopContactsCmd::StartNext +// --------------------------------------------------------------------------- +// void CPbk2NlxAddToTopContactsCmd::StartNext() { __ASSERT_DEBUG( !IsActive(), Panic( ENlxAtcWronglyActivated )); @@ -626,15 +652,23 @@ SetActive(); } -void CPbk2NlxAddToTopContactsCmd::ShowWaitNoteL() +// --------------------------------------------------------------------------- +// CPbk2NlxAddToTopContactsCmd::ShowDelayedWaitNoteL +// --------------------------------------------------------------------------- +// +void CPbk2NlxAddToTopContactsCmd::ShowDelayedWaitNoteL() { - __ASSERT_DEBUG( !iDecorator, Panic( ENlxNoteActive )); - iDecorator = Pbk2ProcessDecoratorFactory::CreateWaitNoteDecoratorL - ( R_QTN_GEN_NOTE_SAVING_WAIT, ETrue ); - iDecorator->SetObserver( *this ); - iDecorator->ProcessStartedL( 0 ); // wait note doesn't care about amount + if ( !iDelayedWaitNote ) + { + iDelayedWaitNote = CPbk2DelayedWaitNote::NewL(*this, R_QTN_GEN_NOTE_SAVING_WAIT); + iDelayedWaitNote->Start(); + } } - + +// --------------------------------------------------------------------------- +// CPbk2NlxAddToTopContactsCmd::ProcessDismissed +// --------------------------------------------------------------------------- +// void CPbk2NlxAddToTopContactsCmd::ProcessDismissed( TInt /*aCancelCode*/ ) { StartNext( EFinish ); @@ -673,10 +707,10 @@ TInt /* aReason */, MVPbkStoreContact* /* aContact */ ) { - if ( iDecorator ) + if ( iDelayedWaitNote ) { // wait for callback from the wait note and finish then - iDecorator->ProcessStopped(); + iDelayedWaitNote->Stop(); } else { diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -27,6 +27,7 @@ #include #include #include +#include // Debugging headers #include @@ -66,6 +67,8 @@ //Cancel the operation if not yet done delete iVPbkContactOperationBase; delete iVPbkTopContactManager; + delete iDelayedWaitNote; + iDelayedWaitNote = NULL; } // -------------------------------------------------------------------------- @@ -148,6 +151,8 @@ // void CPbk2NlxRemoveFromTopContactsCmd::RunL() { + ShowDelayedWaitNoteL(); + RemoveTopContactL(); } @@ -157,6 +162,10 @@ // TInt CPbk2NlxRemoveFromTopContactsCmd::RunError(TInt aError) { + if (iDelayedWaitNote) + { + iDelayedWaitNote->Stop(); + } return aError; } @@ -170,6 +179,29 @@ } // -------------------------------------------------------------------------- +// CPbk2NlxRemoveFromTopContactsCmd::ShowDelayedWaitNoteL +// -------------------------------------------------------------------------- +// +void CPbk2NlxRemoveFromTopContactsCmd::ShowDelayedWaitNoteL() + { + iDelayedWaitNote = CPbk2DelayedWaitNote::NewL(*this, R_QTN_GEN_NOTE_SAVING_WAIT ); + iDelayedWaitNote->Start(); + } + +// -------------------------------------------------------------------------- +// CPbk2NlxRemoveFromTopContactsCmd::ProcessDismissed +// -------------------------------------------------------------------------- +// +void CPbk2NlxRemoveFromTopContactsCmd::ProcessDismissed(TInt /*aCancelCode*/) + { + if( iUiControl ) + { + iUiControl->SetBlank( EFalse); + } + iCommandObserver->CommandFinished( *this ); + } + +// -------------------------------------------------------------------------- // CPbk2NlxRemoveFromTopContactsCmd::RemoveTopContactL // -------------------------------------------------------------------------- // @@ -204,11 +236,10 @@ // void CPbk2NlxRemoveFromTopContactsCmd::VPbkOperationCompleted(MVPbkContactOperationBase*) { - if( iUiControl ) + if (iDelayedWaitNote) { - iUiControl->SetBlank( EFalse); + iDelayedWaitNote->Stop(); } - iCommandObserver->CommandFinished( *this ); } // --------------------------------------------------------------------------- @@ -218,11 +249,10 @@ void CPbk2NlxRemoveFromTopContactsCmd::VPbkOperationFailed( MVPbkContactOperationBase*, TInt aError ) { CCoeEnv::Static()->HandleError( aError ); - if( iUiControl ) + if (iDelayedWaitNote) { - iUiControl->SetBlank( EFalse); + iDelayedWaitNote->Stop(); } - iCommandObserver->CommandFinished( *this ); } // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -61,6 +61,7 @@ #include #include #include "Pbk2InternalCommands.hrh" +#include "CPbk2ContactViewListBox.h" #include "CVPbkContactManager.h" #include "MVPbkContactStoreList.h" @@ -419,6 +420,16 @@ iControl->SetOpeningCca( ETrue ); } + // Set focus, keep current focus on the area of the client screen + // when scoll to the bottom of Names list view. + CPbk2ContactViewListBox* listbox = static_cast(iControl->ComponentControl(0)); + if ( EPbk2CmdCreateNew == aCommandId && + listbox->CurrentItemIndex() < listbox->TopItemIndex() && + listbox->BottomItemIndex() == listbox->Model()->NumberOfItems()-1 ) + { + listbox->SetCurrentItemIndex( listbox->TopItemIndex() ); + } + // No command handling in this class, forward to Commands if (!iCommandHandler->HandleCommandL( aCommandId, *iControlProxy, &iView )) { @@ -1377,6 +1388,10 @@ iContainer->SetRect(iView.ClientRect()); iControl->DrawNow(); } + if ( EPbk2CmdCreateNew == iCurrentCommandId ) + { + iControl->DrawDeferred(); + } } iCurrentCommandId = KErrNotFound; UpdateCbasL(); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -79,6 +80,7 @@ #include #include #include +#include /// Unnamed namespace for local definitions namespace { @@ -155,10 +157,28 @@ { User::Leave( KErrNotReady ); } + // Check status message variation + TInt showStatusInNamesList = 0; + CRepository* cenrep = + CRepository::NewLC( TUid::Uid( KCRUidPhonebook ) ); + User::LeaveIfError( + cenrep->Get( KPhonebookStatusMessageVisibility, + showStatusInNamesList ) ); + CleanupStack::PopAndDestroy( cenrep ); + + // By default status is not shown in names list + TInt32 spbContentFlags = CSpbContentProvider::EPhoneNumber; + + if( showStatusInNamesList ) + { + spbContentFlags = (CSpbContentProvider::EStatusMessage | + CSpbContentProvider::EPhoneNumber); + } + CPbk2StoreManager& storeManager = static_cast(ext)->StoreManager(); - iContentProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), storeManager, - CSpbContentProvider::EStatusMessage | CSpbContentProvider::EPhoneNumber ); + iContentProvider = CSpbContentProvider::NewL( + iAppServices->ContactManager(), storeManager, spbContentFlags ); } return *iContentProvider; } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp --- a/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -488,11 +488,13 @@ for ( TInt i = 0; i < fieldCount; ++i ) { const MVPbkBaseContactField& field = fieldSet.FieldAt(i); - TInt fieldTypeId = field.BestMatchingFieldType()->FieldTypeResId(); - - if ( fieldTypeId == aFieldId ) + if ( field.BestMatchingFieldType() ) { - return &field; + TInt fieldTypeId = field.BestMatchingFieldType()->FieldTypeResId(); + if ( fieldTypeId == aFieldId ) + { + return &field; + } } } return NULL; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h --- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Mon Jul 12 13:42:58 2010 +0100 @@ -22,7 +22,8 @@ // INCLUDES #include #include -#include "CPbk2AdaptiveSearchGridWaiter.h" +#include +#include "MVPbkViewContact.h" // FORWARD DECLARATIONS class CAknSearchField; @@ -30,6 +31,7 @@ class CPbk2AdaptiveGrid; class MVPbkContactViewBase; class MPbk2ContactNameFormatter; +class CPSRequestHandler; // CLASS DECLARATION @@ -40,7 +42,7 @@ * search contacts from Phonebook 2. */ NONSHARABLE_CLASS(CPbk2AdaptiveSearchGridFiller) : public CActive, - public MPbk2SearchGridWaiterObserver + public MPsResultsObserver { public: // Constructors and destructor @@ -70,7 +72,7 @@ * to create adaptive search grid * @param aFindText is text user has entered in the find pane. */ - void StartFilling( const MVPbkContactViewBase& aView, const TDesC& aSearchString ); + void StartFillingL( const MVPbkContactViewBase& aView, const TDesC& aSearchString, TBool aClearCache ); /** @@ -104,17 +106,23 @@ * But actually this operation is done to Adaptive Search Grid. So set the focus back to it. */ void SetFocusToAdaptiveSearchGrid(); - - public: // MPbk2SearchGridWaiterObserver - void GridDelayCompleteL(); - void WaitNoteDismissed(); - + private: // from CActive void RunL(); void DoCancel(); TInt RunError( TInt aError ); - + + private: // from MPsResultsObserver + + void HandlePsResultsUpdate( + RPointerArray& searchResults, + RPointerArray& searchSeqs); + + void HandlePsError(TInt aErrorCode); + + void CachingStatus(TCachingStatus& aStatus, TInt& aError); + private: // Implementation CPbk2AdaptiveSearchGridFiller( CAknSearchField& aField, MPbk2ContactNameFormatter& aNameFormatter ); @@ -129,6 +137,9 @@ TInt NumberOfSpacesInString( const TDesC& aSearchString ); // Used to judge if this contact's title include drgraphs TBool IsDigraphContactsTitleL(const TDesC& aContactTitle); + TBool GridFromPsEngineL( const MVPbkContactViewBase& aView ); + // Check whether the title is empty or not. + TBool IsActualTitleEmpty( const MVPbkViewContact& aContact ); private: // Data /// Own: Containts adaptive search grid. @@ -170,8 +181,11 @@ /// Used to save the contacts' title which include drgraphs RPointerArray iDigraphContactsTitleArray; - /// Own: Used to display wait note if building of grid takes longer than specified time - CPbk2AdaptiveSearchGridWaiter* iGridWaiter; + /// Own: Number of contacts in view + TInt iViewItemCount; + + /// Own: Predictive search handler + CPSRequestHandler* iPsHandler; }; #endif // CPBK2ADAPTIVESEARCHGRIDFILLER_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h --- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h Fri May 28 13:07:31 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Phonebook2 Adaptive Search Grid -* helper class -*/ - - -#ifndef CPBK2ADAPTIVESEARCHGRIDWAITER_H -#define CPBK2ADAPTIVESEARCHGRIDWAITER_H - -// INCLUDES -#include -#include - -class CAknWaitDialog; - -/** - * @internal Only Phonebook 2 internal use supported! - */ -class MPbk2SearchGridWaiterObserver - { - public: // Interface - /** - * Grid delay complete - */ - virtual void GridDelayCompleteL() = 0; - - virtual void WaitNoteDismissed() = 0; - }; - -/** - * Utility class that implements the wait logic and - * process decoration if needed. - */ -NONSHARABLE_CLASS( CPbk2AdaptiveSearchGridWaiter ) : - public CTimer, - private MProgressDialogCallback - - { - public: // Construction and destruction - - /** - * Creates a new instance of this class. - * - * @return A new instance of this class. - */ - static CPbk2AdaptiveSearchGridWaiter* NewL( MPbk2SearchGridWaiterObserver& aObserver ); - - /** - * Destructor. - */ - ~CPbk2AdaptiveSearchGridWaiter(); - - public: // Interface - - void Start(); - void Stop(); - - private: // From CTimer - void RunL(); - TInt RunError( TInt aError ); - - private: // From MProgressDialogCallback - void DialogDismissedL( TInt aButtonId ); - - private: // Implementation - CPbk2AdaptiveSearchGridWaiter( MPbk2SearchGridWaiterObserver& aObserver ); - void ConstructL(); - void DismissWaitNote(); - - private: // Data - /// Own: Decorator for the process - CAknWaitDialog* iWaitNote; - // Notifiy if wait note is on - TBool iStarted; - // Ref: - MPbk2SearchGridWaiterObserver& iObserver; - }; - -#endif // CPBK2ADAPTIVESEARCHGRIDWAITER_H - -// End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -21,12 +21,24 @@ #include "MVPbkViewContact.h" #include "MVPbkContactViewBase.h" #include "MPbk2ContactNameFormatter.h" +#include "MPbk2FilteredViewStack.h" +#include +#include +#include + + +#include +#include +#include +#include #include #include #include #include +#include + const TInt KMaxAdaptiveGridCacheCount = 10; const TInt KAdaptiveSearchKeyMapGranularity = 100; const TInt KAdaptiveSearchRefineStep = 25; @@ -34,6 +46,15 @@ MPbk2ContactNameFormatter::EReplaceNonGraphicChars | MPbk2ContactNameFormatter::EDisableCompanyNameSeparator; +namespace { +enum TNameOrder + { + ETopContactOrderNumber = 0, //TC control data, not shown + ENameFirstPart, //Contact name data + ENameSecondPart, //Contact name data + ENameCompanyPart //to support Company name + }; +} // namespace NONSHARABLE_CLASS(CPbk2AdaptiveGrid) : public CBase { @@ -92,7 +113,11 @@ CPbk2AdaptiveSearchGridFiller::~CPbk2AdaptiveSearchGridFiller() { Cancel(); - delete iGridWaiter; + if ( iPsHandler ) + { + iPsHandler->RemoveObserver( this ); + delete iPsHandler; + } delete iKeyMap; delete iCurrentGrid; iAdaptiveGridCache.ResetAndDestroy(); @@ -125,20 +150,45 @@ { iKeyMap = HBufC::NewL( KAdaptiveSearchKeyMapGranularity ); iFindUtil = CFindUtil::NewL(); - iGridWaiter = CPbk2AdaptiveSearchGridWaiter::NewL( *this ); + // UI Language + TLanguage uiLanguage = User::Language(); + if ( uiLanguage != ELangJapanese && uiLanguage != ELangPrcChinese && + uiLanguage != ELangHongKongChinese && uiLanguage != ELangTaiwanChinese && + uiLanguage != ELangKorean ) + { + iPsHandler = CPSRequestHandler::NewL(); + iPsHandler->AddObserverL( this ); + } } -void CPbk2AdaptiveSearchGridFiller::StartFilling( const MVPbkContactViewBase& aView, const TDesC& aSearchString ) +void CPbk2AdaptiveSearchGridFiller::StartFillingL( const MVPbkContactViewBase& aView, + const TDesC& aSearchString, TBool aClearCache ) { - CPbk2AdaptiveGrid* keyMap = KeyMapFromCache( aSearchString ); + + if( aClearCache ) + { + ClearCache(); + } + + if ( IsActive() && iView == &aView && iViewItemCount == aView.ContactCountL() + && iSearchString && !iSearchString->Compare( aSearchString ) ) + { + return; + } + else + { + StopFilling(); + } - if( keyMap ) - { - iSearchField.SetAdaptiveGridChars( keyMap->GetKeyMap() ); - iGridWaiter->Stop(); - return; - } - + CPbk2AdaptiveGrid* keyMap = KeyMapFromCache( aSearchString ); + + if( keyMap ) + { + iSearchField.SetAdaptiveGridChars( keyMap->GetKeyMap() ); + return; + } + + iViewItemCount = aView.ContactCountL(); delete iSearchString; iSearchString = NULL; @@ -156,6 +206,11 @@ iCounter = 0; + if ( iSearchString->Length() <= KPsAdaptiveGridSupportedMaxLen && GridFromPsEngineL( aView ) ) + { + return; + } + SetActive(); TRequestStatus* status = &iStatus; User::RequestComplete( status, KErrNone ); @@ -176,6 +231,7 @@ TInt stopCount = iCounter + KAdaptiveSearchRefineStep; const TInt itemCount = iView->ContactCountL(); + if( stopCount > itemCount ) { stopCount = itemCount; @@ -207,6 +263,14 @@ else if ( titleLength ) { title = iNameFormatter.GetContactTitleL( contact.Fields(), KContactFormattingFlags ); + + // In FDN, the number will be displayed in the list if the contact is no name. + // If it is, set the search string as NULL. + if ( IsActualTitleEmpty( contact ) ) + { + delete title; + title = NULL; + } } if ( !title ) @@ -341,7 +405,6 @@ void CPbk2AdaptiveSearchGridFiller::InvalidateAdaptiveSearchGrid() { iInvalidateAdaptiveSearchGrid = ETrue; - iGridWaiter->Start(); } void CPbk2AdaptiveSearchGridFiller::SetFocusToAdaptiveSearchGrid() @@ -404,11 +467,6 @@ iCurrentGrid = iKeyMap->Des().AllocL(); iSearchField.SetAdaptiveGridChars( *iKeyMap ); - - if( iInvalidateAdaptiveSearchGrid ) - { - iGridWaiter->Stop(); - } iInvalidateAdaptiveSearchGrid = EFalse; @@ -608,20 +666,145 @@ return isDigraphic; } -void CPbk2AdaptiveSearchGridFiller::GridDelayCompleteL() +void CPbk2AdaptiveSearchGridFiller::HandlePsResultsUpdate( + RPointerArray& /*searchResults*/, + RPointerArray& /*searchSeqs*/ ) + { + + } + +void CPbk2AdaptiveSearchGridFiller::HandlePsError( TInt /*aErrorCode*/ ) + { + + } + +void CPbk2AdaptiveSearchGridFiller::CachingStatus( TCachingStatus& aStatus, TInt& /*aError*/ ) { - // simulating pointer event to hide adaptive grid - TPointerEvent pointerEvent; - pointerEvent.iType = TPointerEvent::EButton1Down; - TPoint position = iSearchField.Rect().iTl; - position.iX += 1; - position.iY += 1; - pointerEvent.iPosition = position; - iSearchField.HandlePointerEventL( pointerEvent ); + TRAP_IGNORE( + MVPbkContactViewBase* allContactsView = Phonebook2::Pbk2AppUi()->ApplicationServices().ViewSupplier().AllContactsViewL(); + + const MPbk2FilteredViewStack* filteredView = dynamic_cast ( iView ); + + if ( aStatus >= ECachingComplete && filteredView && filteredView->Level() == 0 && &filteredView->BaseView() == allContactsView ) + { + HBufC* string = iSearchString->AllocL(); + CleanupStack::PushL( string ); + StartFillingL( *iView, *string, ETrue ); + CleanupStack::PopAndDestroy( string ); + } + ); } -void CPbk2AdaptiveSearchGridFiller::WaitNoteDismissed() +TBool CPbk2AdaptiveSearchGridFiller::GridFromPsEngineL( const MVPbkContactViewBase& aView ) { - iSearchField.ShowAdaptiveSearchGrid(); + if ( iPsHandler == NULL ) + { + return EFalse; + } + MPbk2ApplicationServices& appServices = Phonebook2::Pbk2AppUi()->ApplicationServices(); + MVPbkContactViewBase* allContactsView = appServices.ViewSupplier().AllContactsViewL(); + const MPbk2FilteredViewStack* filteredView = dynamic_cast ( &aView ); + + if ( filteredView && filteredView->Level() == 0 && &filteredView->BaseView() == allContactsView ) + { + CPbk2StoreConfiguration& config = appServices.StoreConfiguration(); + CVPbkContactStoreUriArray* stores = NULL; + stores = config.CurrentConfigurationL(); + if ( !stores || stores->Count() == 0 ) + { + delete stores; + return EFalse; + } + + TInt count = stores->Count(); + CleanupStack::PushL(stores); + + CDesCArrayFlat* array = new ( ELeave ) CDesCArrayFlat( count ); + CleanupStack::PushL( array ); + + for ( TInt i = 0; i < count; ++i) + { + TVPbkContactStoreUriPtr uriPtr = stores->operator[](i); + array->AppendL( uriPtr.UriDes() ); + } + + TBool companyName = EFalse; + TBuf gridChars; + if( FeatureManager::FeatureSupported( KFeatureIdFfContactsCompanyNames ) ) + { + companyName = ETrue; + } + iPsHandler->GetAdaptiveGridCharactersL( *array, *iSearchString, companyName, gridChars ); + + CleanupStack::PopAndDestroy( array ); + CleanupStack::PopAndDestroy( stores ); + + if ( !gridChars.Length() && iViewItemCount > 0 ) + { + // grid should be created on standard way + return EFalse; + } + if ( iKeyMap->Des().MaxLength() < gridChars.Length() ) + { + iKeyMap = iKeyMap->ReAllocL( gridChars.Length() ); + } + iKeyMap->Des().Copy( gridChars ); + + delete iCurrentGrid; + iCurrentGrid = NULL; + iCurrentGrid = iKeyMap->Des().AllocL(); + + iSearchField.SetAdaptiveGridChars( *iKeyMap ); + + iInvalidateAdaptiveSearchGrid = EFalse; + + if ( iSetFocusToSearchGrid ) + { + // set the focus to findbox + iSearchField.DrawDeferred(); + iSetFocusToSearchGrid = EFalse; + } + AddKeyMapToCacheL( *iSearchString, *iKeyMap ); + return ETrue; + } + else + { + return EFalse; + } + } + +TBool CPbk2AdaptiveSearchGridFiller::IsActualTitleEmpty( const MVPbkViewContact& aContact ) + { + TBool result = ETrue; + const TInt fieldCount = aContact.Fields().FieldCount(); + for ( TInt i = ENameFirstPart; i <= ENameSecondPart && i < fieldCount; ++i) + { + const MVPbkBaseContactField& field = aContact.Fields().FieldAt( i ); + if ( iNameFormatter.IsTitleField( field ) ) + { + const MVPbkContactFieldData& fieldData = field.FieldData(); + if ( fieldData.DataType() == EVPbkFieldStorageTypeText ) + { + const TDesC& fieldText = MVPbkContactFieldTextData::Cast( fieldData ).Text(); + TInt length = fieldText.Length(); + + if ( length > 0 ) + { + TInt firstNonSpaceChar = 0; + while ( firstNonSpaceChar < length + && TChar( fieldText[firstNonSpaceChar] ).IsSpace() ) + { + ++firstNonSpaceChar; + } + if ( firstNonSpaceChar != length ) + { + result = EFalse; + break; + } + } + } + } + } + return result; } // End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp Fri May 28 13:07:31 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Phonebook2 Adaptive Search Grid -* helper class -*/ - -// INCLUDES -#include -#include -#include -#include "CPbk2AdaptiveSearchGridWaiter.h" - -const TInt KDelay = 500000; // 0.5 seconds - -CPbk2AdaptiveSearchGridWaiter* CPbk2AdaptiveSearchGridWaiter::NewL - ( MPbk2SearchGridWaiterObserver& aObserver ) - { - CPbk2AdaptiveSearchGridWaiter* self = - new ( ELeave ) CPbk2AdaptiveSearchGridWaiter( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -CPbk2AdaptiveSearchGridWaiter::~CPbk2AdaptiveSearchGridWaiter() - { - Cancel(); - delete iWaitNote; - iWaitNote = NULL; - } - -CPbk2AdaptiveSearchGridWaiter::CPbk2AdaptiveSearchGridWaiter - ( MPbk2SearchGridWaiterObserver& aObserver ) - : CTimer( CActive::EPriorityStandard ), iObserver( aObserver ) - { - - } - -void CPbk2AdaptiveSearchGridWaiter::ConstructL() - { - CActiveScheduler::Add( this ); - CTimer::ConstructL(); - } - -void CPbk2AdaptiveSearchGridWaiter::Stop() - { - Cancel(); - DismissWaitNote(); - } - -void CPbk2AdaptiveSearchGridWaiter::Start() - { - if ( !IsActive() ) - { - Stop(); - After( TTimeIntervalMicroSeconds32( KDelay ) ); - } - } - -void CPbk2AdaptiveSearchGridWaiter::RunL() - { - if( !iStarted && iWaitNote == NULL ) - { - iObserver.GridDelayCompleteL(); - - iWaitNote = new(ELeave) - CAknWaitDialog(reinterpret_cast( &iWaitNote ), ETrue ); - iWaitNote->SetCallback( this ); - iWaitNote->ExecuteLD( R_QTN_GEN_NOTE_CHECKING_PROGRESS ); - iStarted = ETrue; - } - } - -TInt CPbk2AdaptiveSearchGridWaiter::RunError( TInt /*aError*/ ) - { - iStarted = EFalse; - DismissWaitNote(); - return KErrNone; - } - -void CPbk2AdaptiveSearchGridWaiter::DialogDismissedL( TInt /*aButtonId*/ ) - { - iStarted = EFalse; - iObserver.WaitNoteDismissed(); - } - -void CPbk2AdaptiveSearchGridWaiter::DismissWaitNote() - { - if ( iWaitNote ) - { - TRAPD( err, iWaitNote->ProcessFinishedL() ); - if ( err != KErrNone ) - { - delete iWaitNote; - iWaitNote = NULL; - } - } - } -// End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -1850,21 +1850,20 @@ if ( image ) { - image->SetPictureOwnedExternally( EFalse ); - image->CopyControlContextFrom( LineControl( aControlId ) ); - image->SetContainerWindowL( *LineControl( aControlId ) ); - image->SetNonFocusing(); - image->SetBrushStyle( CGraphicsContext::ENullBrush ); + CEikCaptionedControl* line = LineControl( aControlId ); + if( line ) + { + line->SetIconL( + const_cast( image->Bitmap() ), + const_cast( image->Mask() ) ); + line->iBitmap->SetPictureOwnedExternally( EFalse ); + image->SetPictureOwnedExternally( ETrue ); + line->iBitmap->SetNonFocusing(); + line->iBitmap->SetBrushStyle( CGraphicsContext::ENullBrush ); + line->iBitmap->SetContainerWindowL( *line ); + } - delete LineControl( aControlId )->iBitmap; - LineControl( aControlId )->iBitmap = image; - CleanupStack::Pop( image ); - - TRect rect = LineControl( aControlId )->Rect(); - rect.Resize( -1, -1 ); - LineControl( aControlId )->SetRect( rect ); - rect.Resize( 1, 1 ); - LineControl( aControlId )->SetRect( rect ); + CleanupStack::PopAndDestroy( image ); } CleanupStack::PopAndDestroy( factory ); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -717,16 +717,20 @@ // CPbk2FetchDlg::FetchDlgPageChangedL // -------------------------------------------------------------------------- // -void CPbk2FetchDlg::FetchDlgPageChangedL( MPbk2FetchDlgPage& /*aPage*/ ) +void CPbk2FetchDlg::FetchDlgPageChangedL( MPbk2FetchDlgPage& aPage ) { - // An view event burst from VPbk results this function being called - // several times a row. It is not meaningful to restore selections - // every time, but instead wait for a while and restore the selections - // after all events have been received. Hence the idle object is used. delete iSelectionRestorer; iSelectionRestorer = NULL; - iSelectionRestorer = CIdle::NewL( CActive::EPriorityIdle ); - iSelectionRestorer->Start( TCallBack( RestoreSelections, this )); + + if ( aPage.DlgPageReady() ) + { + // An view event burst from VPbk results this function being called + // several times a row. It is not meaningful to restore selections + // every time, but inste ad wait for a while and restore the selections + // after all events have been received. Hence the idle object is used. + iSelectionRestorer = CIdle::NewL( CActive::EPriorityIdle ); + iSelectionRestorer->Start( TCallBack( RestoreSelections, this )); + } } // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -791,18 +791,14 @@ { TBool ret = EFalse; TInt rowsCount = iRows.Count(); - for( TInt i = 0; i < rowsCount && !ret; i++ ) - { - TInt columnsCount = iRows[i]->ColumnCount(); - for( TInt j = 0; j < columnsCount && !ret; j++ ) + for (TInt i = 0; i < rowsCount && !ret; i++ ) + { + if ( iRows[i]->At( EContentColumn ).CompareF( aContent ) == 0 ) { - if ( iRows[i]->At(j).CompareF( aContent ) == 0 ) - { - ret = ETrue; - } + ret = ETrue; } } - + return ret; } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -290,23 +290,19 @@ iModel->SetClipper( *this ); // Insert TEXT_NO_DEFAULT as the last item to the array - // Don't add "No default" for call selector - if ( iSelectorId != VPbkFieldTypeSelectorFactory::EVoiceCallSelector ) - { - CPbk2FieldListBoxRow* row = CPbk2FieldListBoxRow::NewL(); - CleanupStack::PushL( row ); - TBuf iconBuffer; - _LIT( KIcon, "%d" ); - iconBuffer.Format( KIcon, aIconArray.FindIcon( - TPbk2AppIconId( EPbk2qgn_prop_nrtyp_empty ))); - row->AppendColumnL( iconBuffer ); - HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_SETI_NO_DEFAULT ); - row->AppendColumnL( *text ); - CleanupStack::PopAndDestroy( text ); - row->AppendColumnL( KNullDesC ); // empty label column - iModel->AppendRowL( row ); - CleanupStack::Pop( row ); - } + CPbk2FieldListBoxRow* row = CPbk2FieldListBoxRow::NewL(); + CleanupStack::PushL( row ); + TBuf iconBuffer; + _LIT( KIcon, "%d" ); + iconBuffer.Format( KIcon, aIconArray.FindIcon( + TPbk2AppIconId( EPbk2qgn_prop_nrtyp_empty ))); + row->AppendColumnL( iconBuffer ); + HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_SETI_NO_DEFAULT ); + row->AppendColumnL( *text ); + CleanupStack::PopAndDestroy( text ); + row->AppendColumnL( KNullDesC ); // empty label column + iModel->AppendRowL( row ); + CleanupStack::Pop( row ); iListBox->Model()->SetItemTextArray( iModel ); iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -834,7 +834,7 @@ // Skip the line if Email field not supported or having no mailbox if ( aSelectorID == VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) { - if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) || !HasMailboxAccountsL() ) + if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) ) { ret = EFalse; } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -1085,9 +1085,7 @@ return; } - iAdaptiveSearchGridFiller->StopFilling(); - iAdaptiveSearchGridFiller->ClearCache(); - iAdaptiveSearchGridFiller->StartFilling( iViewStack.BaseView(), FindTextL() ); + iAdaptiveSearchGridFiller->StartFillingL( iViewStack.BaseView(), FindTextL(), ETrue ); } // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -935,16 +935,17 @@ iAdaptiveSearchGridFiller->InvalidateAdaptiveSearchGrid(); } } + + if ( iFindDelay->IsActive() ) + { + iFindDelay->Cancel(); + } //if aParam is ETrue, it means that event came from adaptive search, which means //we do not want to delay filtering if ( ( !aParam ) && ( iFindDelay ) && ( NumberOfContacts() >= KFindDelayThresholdContacts ) ) { - if ( iFindDelay->IsActive() ) - { - iFindDelay->Cancel(); - } iFindDelay->After( TTimeIntervalMicroSeconds32( KFindDelayTime ) ); } else @@ -2333,15 +2334,7 @@ return; } - iAdaptiveSearchGridFiller->StopFilling(); - - if( aClearCache ) - { - iAdaptiveSearchGridFiller->ClearCache(); - } - - - iAdaptiveSearchGridFiller->StartFilling( iViewStack, FindTextL() ); + iAdaptiveSearchGridFiller->StartFillingL( iViewStack, FindTextL(), aClearCache ); } /** diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -37,7 +37,6 @@ namespace { // LOCAL CONSTANTS AND MACROS - _LIT( KSeparator, "\t" ); _LIT( KSpace, " " ); } @@ -67,7 +66,7 @@ // inline because only one call site inline void CPbk2PhonebookInfoDlg::ConstructL() { - iListBox = new(ELeave) CAknSingleHeadingPopupMenuStyleListBox; + iListBox = new(ELeave) CAknSinglePopupMenuStyleListBox; iPopupList = CAknPopupList::NewL(iListBox, R_AVKON_SOFTKEYS_OK_EMPTY__OK, AknPopupLayouts::EMenuGraphicHeadingWindow); @@ -164,9 +163,8 @@ { MPbk2StoreInfoUiItem& uiItem = *iInfoItems->At(i); HBufC* itemBuf = HBufC::NewLC(uiItem.HeadingText().Length() + - uiItem.ItemText().Length() + KSeparator().Length() + KSpace().Length()); + uiItem.ItemText().Length() + KSpace().Length()); TPtr ptr(itemBuf->Des()); - ptr.Append(KSeparator); ptr.Append(uiItem.HeadingText()); ptr.Append(KSpace); ptr.Append(uiItem.ItemText()); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp --- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -445,6 +445,21 @@ AppendThumbnailL( aDataElement, aIndex ); + // The cached element needs to be updated when the presence icon is changed + RArray ids; + CleanupClosePushL( ids ); + const MVPbkViewContact& contact = iView->ContactAtL( aIndex ); + iContactIcons->GetIconIdsForContactL( contact, ids ); + + // If no icon was found, append an empty icon + if( ids.Count() == 0 ) + { + ids.Append( iEmptyIconId ); + } + + aDataElement.SetIconId( MPbk2DoubleListboxDataElement::EMainIcon, ids[ 0 ] ); + CleanupStack::PopAndDestroy( &ids ); + // Format line buffer based on element's content FormatBufferFromElement( aDataElement ); } @@ -460,7 +475,10 @@ MVPbkContactLink* link = aViewContact.CreateLinkLC(); CPbk2ContactViewDoubleListboxDataElement* element = CPbk2ContactViewDoubleListboxDataElement::NewL( link, aIndex ); - CleanupStack::Pop(); // link + if( link ) + { + CleanupStack::Pop(); // link + } CleanupStack::PushL( element ); // get data for element diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h --- a/phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h Mon Jul 12 13:42:58 2010 +0100 @@ -137,6 +137,7 @@ void CopyContactsL(); void ShowResultsL(); void CompleteL(); + void PublishOpenCompleteL(); void CompleteWithError( TInt aError ); TBool ValidStoreConfigurationL(); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp --- a/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -735,9 +736,48 @@ { iStartupMonitor.HandleStartupComplete(); iCommandObserver->CommandFinished( *this ); + + if (iAvkonAppUi->IsForeground()) + { + PublishOpenCompleteL(); + } } // -------------------------------------------------------------------------- +// CPsu2CopySimContactsCmd::PublishOpenCompleteL +// -------------------------------------------------------------------------- +// +void CPsu2CopySimContactsCmd::PublishOpenCompleteL() + { + PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING + ("CPsu2CopySimContactsCmd::PublishOpenCompleteL") ); + + TInt err = RProperty::Define( TUid::Uid( KPbk2PSUidPublic ), + KPhonebookOpenCompleted, RProperty::EInt ); + if ( err != KErrAlreadyExists ) + { + User::LeaveIfError( err ); + } + RProperty prop; + CleanupClosePushL( prop ); + User::LeaveIfError(prop.Attach( TUid::Uid( KPbk2PSUidPublic ), + KPhonebookOpenCompleted )); + TInt value( EPhonebookClosed ); + err = prop.Get( value ); + if ( err == KErrNone && value != EPhonebookOpenCompleted) + { + // Only publish once per phonebook opening + PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING + ("publish EPhonebookOpenCompleted") ); + err = prop.Set( EPhonebookOpenCompleted ); + } + User::LeaveIfError( err ); + + CleanupStack::PopAndDestroy(&prop); + } + + +// -------------------------------------------------------------------------- // CPsu2CopySimContactsCmd::CompleteWithError // -------------------------------------------------------------------------- // diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss Mon Jul 12 13:42:58 2010 +0100 @@ -264,6 +264,6 @@ 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_ftu_discover { buf = qtn_cca_ftu_discover; } +RESOURCE TBUF r_qtn_cca_social_networks { buf = qtn_cca_social_networks; } RESOURCE TBUF r_qtn_cca_error_note_maps_not_found { buf = qtn_cca_error_note_maps_not_found; } //End of File diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h Mon Jul 12 13:42:58 2010 +0100 @@ -26,6 +26,7 @@ #include #include #include +#include #include class CPbk2CommandHandler; @@ -53,7 +54,8 @@ public MVPbkContactStoreObserver, public MVPbkSingleContactOperationObserver, public MPbk2ContactUiControl, - public MPbk2ContactUiControl2 + public MPbk2ContactUiControl2, + private MPbk2MenuCommandObserver { public: @@ -163,6 +165,11 @@ const MPbk2UiControlCmdItem* FocusedCommandItem() const; void DeleteCommandItemL( TInt aIndex ); void AddCommandItemL(MPbk2UiControlCmdItem* /*aCommand*/, TInt /*aIndex*/); + +private: // From MPbk2MenuCommandObserver + void PreCommandExecutionL( const MPbk2Command& /*aCommand*/ ) {} + void PostCommandExecutionL( const MPbk2Command& aCommand ); + private: void ConstructL(); @@ -223,9 +230,6 @@ /// Own: contact store in use, has to be closed when done MVPbkContactStore* iContactStore; - - /// Own: Boolean for querying if there is a command being executed - TBool iCommandInProgress; }; #endif // C_CCCAPPCOMMLAUNCHERPBKCMD_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h Mon Jul 12 13:42:58 2010 +0100 @@ -18,7 +18,6 @@ #ifndef __CCAPPCOMMALAUNCHERCONTAINER_H #define __CCAPPCOMMALAUNCHERCONTAINER_H - // INCLUDES #include "ccappcommlauncherheaders.h" #include @@ -238,6 +237,11 @@ * @since S60 v5.0 */ void CreateListboxControlL(); + + /** + * Creates the status control + */ + void CreateStatusControlL(); /** * Updates the number/address popup @@ -275,11 +279,6 @@ * availability. */ void DoCheckExtensionFactoryL(); - - /** - * Set default status text to CCCAppStatusControl - */ - void SetDefaultStatusTextL(); private: // Constructors diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h Mon Jul 12 13:42:58 2010 +0100 @@ -222,7 +222,8 @@ /// Own: CCCAppCommLauncherPbkCmd CCCAppCommLauncherPbkCmd* iPbkCmd; - /// Own: CAknInputBlock + + /// Doesnt Own: CAknInputBlock. Ownership transferred thro SetCancelDelete Call. CAknInputBlock *iInputBlock; }; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h Mon Jul 12 13:42:58 2010 +0100 @@ -27,6 +27,61 @@ class CCCAppCommLauncherContactHandler; class CCCAppCommLauncherMenuHandler; class CCAContactorService; +class TCSParameter; + +/** + * A helper class to keep up the command running state correct. + * Only one command should be able to run at a time. + */ +class TCCAppCommandState + { +public: + /** + * Constructor + */ + TCCAppCommandState(); + /** + * Returns ETrue if a command is running. + * @return ETrue if a command is running. + */ + inline TBool IsRunning() const { return iState; } + /** + * Change to Running state. + */ + void SetRunning(); + /** + * Change to Not Running state. + */ + void SetNotRunning(); + /** + * Sets state to Running and pushes a cleanup item to the CleanupStack. + * The state will be changed to 'Not Running' in case of leave. + */ + void SetRunningAndPushCleanupL(); + /** + * Change to Not Running state and pops up the cleanup item previously + * pushed by PushCleanupL or SetRunningAndPushCleanupL. + */ + void SetNotRunningAndPopCleanup(); + /** + * Pushes a cleanup item to the CleanupStack. + * The state will be changed to 'Not Running' in case of leave. + */ + void PushCleanupL(); + /** + * Pops up the cleanup item previously pushed by + * PushCleanupL or SetRunningAndPushCleanupL. + */ + void PopCleanup(); +private: + TCCAppCommandState& operator=(const TCCAppCommandState&); + TCCAppCommandState(const TCCAppCommandState&); + static void CleanupOperation( TAny* aCommanState ); +private: + /// Own: ETrue if command is running, false otherwise. + TBool iState; + }; + /** * Class implementing CCCAppViewPluginBase interface. This is @@ -47,7 +102,7 @@ #ifdef __COMMLAUNCHERPLUGINUNITTESTMODE friend class T_CCCAppCommLauncherPlugin; #endif// __COMMLAUNCHERPLUGINUNITTESTMODE - + public: /** @@ -213,9 +268,17 @@ } /** - * Return pointer to contactor service. + * Returns a const pointer to contactor service. + * Use ExecuteServiceL to run contactor service. */ - CCAContactorService* ContactorService(); + const CCAContactorService* ContactorService(); + + /** + * Executes the service using CCAContactorService. This must + * be used instead of direct call to CCAContactorService to keep + * the command running/not running state correct. + */ + void ExecuteServiceL(const CCAContactorService::TCSParameter& aParameter); /** * Start timer. @@ -276,6 +339,13 @@ void UpdateMSKinCbaL( TBool aCommMethodsAvailable ); /** + * Returns the command running state instance. Command state must be + * to running before executing the command and to not running after + * the command has completed. + */ + inline TCCAppCommandState& CommandState() {return iCommandState;} + + /** * Notify the timeout after sent an aiw service request. * */ @@ -333,6 +403,11 @@ * Own. */ TBool iIsTimerStart; + + /** + * + */ + TCCAppCommandState iCommandState; }; #endif // C_CCAPPCOMMLAUNCHERPLUGIN_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -52,8 +52,7 @@ iCommandsResourceFile( *CCoeEnv::Static() ), iUiControlsResourceFile( *CCoeEnv::Static() ), iCommonUiResourceFile( *CCoeEnv::Static() ), - iPlugin( aPlugin ), - iCommandInProgress( EFalse ) + iPlugin( aPlugin ) { } @@ -66,6 +65,7 @@ { PreparePbk2ApplicationServicesL(); iCommandHandler = CPbk2CommandHandler::NewL(); + iCommandHandler->AddMenuCommandObserver( *this ); } @@ -106,6 +106,10 @@ } delete iStoreContact; + if ( iCommandHandler ) + { + iCommandHandler->RemoveMenuCommandObserver( *this ); + } delete iCommandHandler; delete iLinks; delete iOperation; @@ -145,26 +149,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdAssignDefaultL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) + { + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdDefaultSettings; - iPbk2CommandId = EPbk2CmdDefaultSettings; - - if( iLinks ) - { - delete iLinks; - iLinks = NULL; + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks && iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks && iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -173,26 +182,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdViewImageL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) + { + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdViewImage; - iPbk2CommandId = EPbk2CmdViewImage; - - if( iLinks ) - { - delete iLinks; - iLinks = NULL; + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks && iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks && iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -201,26 +215,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdChangeImageL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) + { + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdChangeImage; - iPbk2CommandId = EPbk2CmdChangeImage; - - if( iLinks ) - { - delete iLinks; - iLinks = NULL; + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks && iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks && iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -229,26 +248,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdRemoveImageL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) + { + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdRemoveImage; - iPbk2CommandId = EPbk2CmdRemoveImage; - - if( iLinks ) - { - delete iLinks; - iLinks = NULL; + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks && iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks && iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -257,26 +281,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdAddImageL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) + { + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdAddImage; - iPbk2CommandId = EPbk2CmdAddImage; - - if( iLinks ) - { - delete iLinks; - iLinks = NULL; + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks && iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks && iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -286,26 +315,31 @@ void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdShowMapL( const HBufC8* aContact, TPbk2CommandId aCommandId ) { - iCommandInProgress = ETrue; - - iPbk2CommandId = aCommandId; - - if( iLinks ) + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) { - delete iLinks; - iLinks = NULL; + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = aCommandId; + + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( *aContact ); + + if ( iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + (iLinks->At( 0 )).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( *aContact ); - - if ( iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - (iLinks->At( 0 )).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -314,26 +348,31 @@ // void CCCAppCommLauncherPbkCmd::ExecutePbk2CmdDeleteL( const TDesC8& aContact ) { - iCommandInProgress = ETrue; - - iPbk2CommandId = EPbk2CmdDeleteMe; - - if( iLinks ) + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + if ( !cmdState.IsRunning() ) { - delete iLinks; - iLinks = NULL; + cmdState.SetRunningAndPushCleanupL(); + + iPbk2CommandId = EPbk2CmdDeleteMe; + + if( iLinks ) + { + delete iLinks; + iLinks = NULL; + } + + iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); + + if ( iLinks->Count() > 0 ) + { + // operation completes by StoreReady, + // StoreUnavailable or HandleStoreEventL + ( iLinks->At( 0 ) ).ContactStore().OpenL( *this ); + } + + CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) + cmdState.PopCleanup(); } - - iLinks = iAppServices->ContactManager().CreateLinksLC( aContact ); - - if ( iLinks->Count() > 0 ) - { - // operation completes by StoreReady, - // StoreUnavailable or HandleStoreEventL - ( iLinks->At( 0 ) ).ContactStore().OpenL( *this ); - } - - CleanupStack::Pop( 1 ); // iLinks (deleted in destructor) } // --------------------------------------------------------------------------- @@ -342,6 +381,8 @@ // void CCCAppCommLauncherPbkCmd::HandleError( TInt aError ) { + iPlugin.CommandState().SetNotRunning(); + if( KErrNotSupported == aError && (TPbk2CommandId)EPbk2ExtensionShowOnMap == iPbk2CommandId ) { @@ -388,6 +429,7 @@ MVPbkContactStore& /*aContactStore*/, TInt /*aReason*/) { + iPlugin.CommandState().SetNotRunning(); } // --------------------------------------------------------------------------- @@ -411,16 +453,6 @@ delete iStoreContact; iStoreContact = aContact; - if( !iCommandHandler ) - { - TRAPD(err, iCommandHandler = CPbk2CommandHandler::NewL();) - if( err != KErrNone ) - { - HandleError( err ); - return; - } - } - TRAPD(err, iCommandHandler->HandleCommandL( iPbk2CommandId, *this, NULL );) if( err != KErrNone ) @@ -437,7 +469,7 @@ MVPbkContactOperationBase& /*aOperation*/, TInt /*aError*/ ) { - + iPlugin.CommandState().SetNotRunning(); } // -------------------------------------------------------------------------- @@ -723,7 +755,6 @@ /// Reset command pointer, command has completed iCommand->ResetUiControl(*this); iCommand = NULL; - iCommandInProgress = EFalse; } } @@ -885,12 +916,24 @@ } // -------------------------------------------------------------------------- +// CCCAppCommLauncherPbkCmd::PostCommandExecutionL +// -------------------------------------------------------------------------- +// +void CCCAppCommLauncherPbkCmd::PostCommandExecutionL( + const MPbk2Command& /*aCommand*/ ) + { + // Async Pbk2 command has been executed. The state must be set back to + // not running. + iPlugin.CommandState().SetNotRunning(); + } + +// -------------------------------------------------------------------------- // CCCAppCommLauncherPbkCmd::IsPbk2CommandRunning // -------------------------------------------------------------------------- // TBool CCCAppCommLauncherPbkCmd::IsPbk2CommandRunning() { - return iCommandInProgress; + return iPlugin.CommandState().IsRunning(); } // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -85,86 +85,10 @@ // Create the header iHeaderCtrl = CCCAppCommLauncherHeaderControl::NewL( iPlugin ); iHeaderCtrl->SetContainerWindowL(*this); - - FeatureManager::InitializeLibL(); - if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) - { - MVPbkContactLink* link = NULL; - MVPbkContactLinkArray* contactArray = NULL; - TInt isSame = KErrNotFound; - - iAppServices = CPbk2ApplicationServices::InstanceL(); - iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), - iAppServices->StoreManager(), - CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); - - HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); - HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); - TPtr8 contactData8Ptr( contactData8->Des() ); - contactData8Ptr.Copy( contactData.Des() ); - - CVPbkContactManager* vPbkContactManager = &iAppServices->ContactManager(); - - if( vPbkContactManager ) - { - contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); - - if( contactArray->Count() > 0 ) - { - link = contactArray->At( 0 ).CloneLC(); - } - - if ( link ) - { - const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); - TVPbkContactStoreUriPtr uri = storeProperties.Uri(); - - isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), - TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); - } - } - - if( isSame == 0 ) - { - iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); - iStatusControl->SetContainerWindowL( *this ); - iStatusControl->MakeVisible( EFalse ); - iHeaderCtrl->SetStatusButtonVisibility( EFalse ); - CFbsBitmap* bmp = NULL; - CFbsBitmap* bmpMask = NULL; - - AknsUtils::CreateIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnPropWmlBmOvi, - bmp, - bmpMask, - KCcaIconDefaultFileName, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); - - CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); - iStatusControl->SetDefaultStatusIconL( guiIcon ); - iStatusControl->SetContactLinkL( *link ); - - iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); - TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); - iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); - } - - if( link ) - { - CleanupStack::PopAndDestroy(); //link - } - - if( contactArray ) - { - CleanupStack::PopAndDestroy(); // contactArray - } - - CleanupStack::PopAndDestroy(); // contactData8 - } // KFeatureIdFfContactsSocial - FeatureManager::UnInitializeLib(); - + + // create status control + CreateStatusControlL(); + // Get the skin background for the view iBackground = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, TRect(0, 0, 0, 0), EFalse); @@ -198,6 +122,108 @@ iListBox->ActivateL(); } +//----------------------------------------------------------------------------- +// CCCAppCommLauncherContainer::CreateStatusControlL() +//----------------------------------------------------------------------------- +// +void CCCAppCommLauncherContainer::CreateStatusControlL() + { + FeatureManager::InitializeLibL(); + const TBool isFeatureIdFfContactsSocial = + FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ); + FeatureManager::UnInitializeLib(); + + if( isFeatureIdFfContactsSocial ) + { + MVPbkContactLink* link = NULL; + MVPbkContactLinkArray* contactArray = NULL; + TInt isSame = KErrNotFound; + + if( !iAppServices ) + { + iAppServices = CPbk2ApplicationServices::InstanceL(); + } + if( !iProvider ) + { + iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), + iAppServices->StoreManager(), + CSpbContentProvider::EStatusMessage | + CSpbContentProvider::EServiceIcon ); + } + HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); + HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); + TPtr8 contactData8Ptr( contactData8->Des() ); + contactData8Ptr.Copy( contactData.Des() ); + + CVPbkContactManager* vPbkContactManager = + &iAppServices->ContactManager(); + + if( vPbkContactManager ) + { + contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); + + if( contactArray->Count() > 0 ) + { + link = contactArray->At( 0 ).CloneLC(); + } + + if ( link ) + { + const MVPbkContactStoreProperties& storeProperties = + link->ContactStore().StoreProperties(); + TVPbkContactStoreUriPtr uri = storeProperties.Uri(); + + isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), + TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); + } + } + + if( isSame == 0 ) + { + iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this, CCCAppStatusControl::ENormalContact ); + iStatusControl->SetContainerWindowL( *this ); + iStatusControl->MakeVisible( EFalse ); + iHeaderCtrl->SetStatusButtonVisibility( EFalse ); + CFbsBitmap* bmp = NULL; + CFbsBitmap* bmpMask = NULL; + + AknsUtils::CreateIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSocialCommunities, + bmp, + bmpMask, + KCcaIconDefaultFileName, + EMbmPhonebook2eceQgn_prop_social_communities, + EMbmPhonebook2eceQgn_prop_social_communities_mask ); + + CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); + iStatusControl->SetDefaultStatusIconL( guiIcon ); + HBufC* defaultText = + StringLoader::LoadL( R_QTN_CCA_SOCIAL_NETWORKS ); + iStatusControl->SetDefaultStatusTextL( defaultText ); + iStatusControl->SetContactLinkL( *link ); + + iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); + TCallBack callBack( + CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); + iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); + } + + if( link ) + { + CleanupStack::PopAndDestroy(); //link + } + + if( contactArray ) + { + CleanupStack::PopAndDestroy(); // contactArray + } + + CleanupStack::PopAndDestroy(); // contactData8 + } // KFeatureIdFfContactsSocial + } + + // ---------------------------------------------------------------------------- // CCCAppCommLauncherContainer::Draw() // ---------------------------------------------------------------------------- @@ -447,7 +473,9 @@ iPlugin.CancelTimer(); TInt index; - if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) ) + // start iLongTapDetector in listbox area and handle PointerEvent when dragged + if ( iListBox->View()->XYPosToItemIndex( aPointerEvent.iPosition, index ) + || ( aPointerEvent.iType == TPointerEvent::EDrag ) ) { if ( iLongTapDetector ) { @@ -471,52 +499,48 @@ void CCCAppCommLauncherContainer::HandleLongTapEventL( const TPoint& /*aPenEventLocation*/, const TPoint& /*aPenEventScreenLocation*/ ) { - CCAContactorService* contactorService = iPlugin.ContactorService(); - if ( contactorService ) + if ( iPlugin.CommandState().IsRunning() ) + { + return; + } + else if ( CommMethodsAvailable() ) { - if ( contactorService->IsBusy() ) - { - return; + TPtrC fullName; + iPlugin.ContactHandler().ContactFieldItemDataL( + CCmsContactFieldItem::ECmsFullName, fullName ); + + TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults; + + VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector + contactActionType = iPlugin.Container().SelectedCommunicationMethod(); + + if ( !iLongTap && contactActionType + == VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) + { + iLongTap = ETrue; + DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); } - else if ( CommMethodsAvailable() ) + else { - TPtrC fullName; - iPlugin.ContactHandler().ContactFieldItemDataL( - CCmsContactFieldItem::ECmsFullName, fullName ); - - TUint paramFlag = 0;//CCAContactorService::TCSParameter::EEnableDefaults; - - VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector - contactActionType = iPlugin.Container().SelectedCommunicationMethod(); + CCAContactorService::TCSParameter param( + contactActionType, + *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray + paramFlag, + fullName ); + + iPlugin.ExecuteServiceL( param ); - if ( !iLongTap && contactActionType - == VPbkFieldTypeSelectorFactory::EFindOnMapSelector ) - { - iLongTap = ETrue; - DoShowMapCmdL( (TPbk2CommandId)EPbk2ExtensionShowOnMap ); - } - else + //The Timer can be started after user selected any call item + if ( iPlugin.ContactorService()->IsSelected() && + (contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || + contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || + contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) { - CCAContactorService::TCSParameter param( - contactActionType, - *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray - paramFlag, - fullName ); - - contactorService->ExecuteServiceL( param ); - - //The Timer can be started after user selected any call item - if ( contactorService->IsSelected() && - (contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || - contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || - contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) - { - iPlugin.StartTimerL(); - } - - - CleanupStack::PopAndDestroy( 1 );// contactlinkarray + iPlugin.StartTimerL(); } + + + CleanupStack::PopAndDestroy( 1 );// contactlinkarray } } } @@ -552,9 +576,7 @@ iHasBeenDragged = EFalse; } - CCAContactorService* contactorService = iPlugin.ContactorService(); - - if ( executeContactAction && contactorService && contactorService->IsBusy()) + if ( executeContactAction && iPlugin.CommandState().IsRunning() ) { executeContactAction = EFalse; } @@ -578,35 +600,32 @@ } else { - if(contactorService) - { - TPtrC fullName; - - iPlugin.ContactHandler().ContactFieldItemDataL( - CCmsContactFieldItem::ECmsFullName, fullName); - - TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; - - CCAContactorService::TCSParameter param( - contactActionType, - *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray - paramFlag, - fullName); + TPtrC fullName; + + iPlugin.ContactHandler().ContactFieldItemDataL( + CCmsContactFieldItem::ECmsFullName, fullName); + + TUint paramFlag = CCAContactorService::TCSParameter::EEnableDefaults; + + CCAContactorService::TCSParameter param( + contactActionType, + *iPlugin.ContactHandler().ContactIdentifierLC(),//contactlinkarray + paramFlag, + fullName); + + iPlugin.ExecuteServiceL(param); - contactorService->ExecuteServiceL(param); - - //The Timer can be started after user selected any call item - if ( contactorService->IsSelected() && - (contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || - contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || - contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) - { - iPlugin.StartTimerL(); - } - - CleanupStack::PopAndDestroy(1);// contactlinkarray - } - } + //The Timer can be started after user selected any call item + if ( iPlugin.ContactorService()->IsSelected() && + (contactActionType == VPbkFieldTypeSelectorFactory::EVoiceCallSelector || + contactActionType == VPbkFieldTypeSelectorFactory::EVideoCallSelector || + contactActionType == VPbkFieldTypeSelectorFactory::EVOIPCallSelector) ) + { + iPlugin.StartTimerL(); + } + + CleanupStack::PopAndDestroy(1);// contactlinkarray + } } } @@ -644,11 +663,6 @@ iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField); // Forwarding to listbox-model iModel->ContactFieldFetchedNotifyL(aContactField); - - if( iStatusControl && iStatusControl->IsVisible() ) - { - SetDefaultStatusTextL(); - } } // ---------------------------------------------------------------------------- @@ -672,11 +686,6 @@ iListBox->DrawDeferred(); iMdlRowCount = mdlCount; - - if( iStatusControl && iStatusControl->IsVisible() ) - { - SetDefaultStatusTextL(); - } } // --------------------------------------------------------------------------- @@ -729,6 +738,15 @@ iModel->Reset(); iListBox->HandleItemRemovalL(); iHeaderCtrl->ClearL(); + + if (!iStatusControl && iPlugin.ContactHandler().ContactStore() == ECmsContactStorePbk) + { + // create status control + CreateStatusControlL(); + //reset control's rect + SizeChanged(); + } + } // --------------------------------------------------------------------------- @@ -807,28 +825,6 @@ 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() //----------------------------------------------------------------------------- @@ -864,8 +860,11 @@ void CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() { CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); + + MCCAStatusProvider* ccaStatusProvider = NULL; + // if extension is not null, extensionfactory plugins are available -> - // show statuscontrol + // show statuscontrol if( extension ) { if ( !iViewLauncher ) @@ -873,7 +872,24 @@ iViewLauncher = extension->CreateViewLauncherL(); } if( iStatusControl ) - { + { + if( extension ) + { + TAny* factoryExtension = extension->FactoryExtension( KCCAExtensionFactoryStatusProviderCreatorUid ); + + if( factoryExtension ) + { + MCCAExtensionFactoryStatusProviderCreator* statusProviderCreator = + static_cast( factoryExtension ); + + if( statusProviderCreator ) + { + ccaStatusProvider = statusProviderCreator->CreateStatusProviderL(); + } + } + } + + iStatusControl->SetStatusProvider( ccaStatusProvider ); iStatusControl->MakeVisible( ETrue ); iHeaderCtrl->SetStatusButtonVisibility( ETrue ); } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -41,6 +41,9 @@ #include #include +#include +#include + #include "ccappcommlaunchercustomlistboxdata.h" #ifdef RD_UI_TRANSITION_EFFECTS_LIST @@ -180,6 +183,7 @@ TBool aUseLogicalToVisualConversion, const TRgb &aColor); TInt ConvertTextToSmiley( TDes& aText ); + void LoadMarkingIconsL(); private: // New internal methods TBool DrawHighlightBackground(CFbsBitGc& aGc); @@ -275,6 +279,7 @@ TBool iKineticScrolling; CAknSmileyManager* iSmileyMan; TSize iSmileySize; // last set simley size + CAknIconArray* iMarkingIconArray; }; /** @@ -322,6 +327,9 @@ #endif iKineticScrolling = CAknPhysics::FeatureEnabled(); +#ifdef RD_TOUCH2_MARKING + LoadMarkingIconsL(); +#endif // RD_TOUCH2_MARKING } CCCAppCommLauncherCustomListBoxDataExtension::~CCCAppCommLauncherCustomListBoxDataExtension() @@ -348,6 +356,12 @@ delete iAnimation; delete iColorBmp; delete iHiliBmp; + + if ( iMarkingIconArray ) + { + iMarkingIconArray->ResetAndDestroy(); + } + delete iMarkingIconArray; } void CCCAppCommLauncherCustomListBoxDataExtension::AddRowAndSubCellL(TInt aRow, @@ -660,6 +674,9 @@ DeleteAnim(); TryCreateAnimation(); TRAP_IGNORE( CreateColorBitmapsL() ); +#ifdef RD_TOUCH2_MARKING + TRAP_IGNORE( LoadMarkingIconsL() ); +#endif // RD_TOUCH2_MARKING } // ----------------------------------------------------------------------------- @@ -1203,6 +1220,44 @@ return err == KErrNone ? count : err; } +// ----------------------------------------------------------------------------- +// CCCAppCommLauncherCustomListBoxDataExtension::LoadMarkingIconsL +// ----------------------------------------------------------------------------- +// +void CCCAppCommLauncherCustomListBoxDataExtension::LoadMarkingIconsL() + { +#ifdef RD_TOUCH2_MARKING + if ( !iMarkingIconArray ) + { + iMarkingIconArray = new ( ELeave ) CAknIconArray( 2 ); + } + else + { + iMarkingIconArray->ResetAndDestroy(); + } + + CGulIcon* icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), + KAknsIIDQgnPropCheckboxOn, + AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_checkbox_on, + EMbmAvkonQgn_prop_checkbox_on_mask ); + + CleanupStack::PushL( icon ); + iMarkingIconArray->AppendL( icon ); + CleanupStack::Pop( icon ); + + icon = AknsUtils::CreateGulIconL( AknsUtils::SkinInstance(), + KAknsIIDQgnPropCheckboxOff, + AknIconUtils::AvkonIconFileName(), + EMbmAvkonQgn_prop_checkbox_off, + EMbmAvkonQgn_prop_checkbox_off_mask ); + + CleanupStack::PushL( icon ); + iMarkingIconArray->AppendL( icon ); + CleanupStack::Pop( icon ); +#endif // RD_TOUCH2_MARKING + } + CCoeControl *CCCAppCommLauncherCustomListBoxData::Control() const { return iExtension->iControl; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -953,6 +953,7 @@ void CCCAppCommLauncherLPadModel::Reset() { iButtonDataArray.Reset(); + iAddressFields.Close(); iButtonIconArray->ResetAndDestroy(); } @@ -1248,6 +1249,8 @@ HBufC* formattedText = NULL; TBool street = EFalse; TBool local = EFalse; + TBool region = EFalse; + TBool country = EFalse; TPtrC* text = iAddressFields.Find( EAddressStreet ); if ( text ) @@ -1262,15 +1265,49 @@ local = ETrue; } - if ( street && local ) + text = iAddressFields.Find( EAddressCountry ); + if( text ) + { + fields->AppendL( *text ); + country = ETrue; + } + else + { + country = EFalse; + fields->AppendL(KNullDesC16); + } + + text = iAddressFields.Find( EAddressRegion ); + if ( text ) + { + fields->AppendL( *text ); + region = ETrue; + } + else + { + region = EFalse; + fields->AppendL(KNullDesC16); + } + + + if ( street && local) { formattedText = StringLoader::LoadLC( R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); } + else if( street && country ) + { + formattedText = StringLoader::LoadLC( + R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); + } + else if( region || country ) + { + formattedText = StringLoader::LoadLC( + R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); + } else { - formattedText = StringLoader::LoadLC( - R_QTN_PHOB_POPUP_INCOMPLETE_ADDRESS ); + formattedText = KNullDesC16().AllocLC(); } tempText.Append( *formattedText ); @@ -1400,15 +1437,29 @@ const CPbk2ServiceManager::TService& service = services[i]; //Found the appropriate service info if ( service.iServiceId == aServiceId ) - { - // Set service bitmap size + { + 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()); + + // Set service bitmap size AknIconUtils::SetSize( service.iBitmap, iServiceIconSize ); AknIconUtils::SetSize( service.iMask, iServiceIconSize ); - - //Trickiest Bitmap cloning - //No direct way of cloning a bitmap + + // Trickiest Bitmap cloning + // No direct way of cloning a bitmap aBitmap = CloneBitmapLC( iServiceIconSize, service.iBitmap ); aMask = CloneBitmapLC( iServiceIconSize, service.iMask ); + + // Set preferred size for xsp service icons + AknIconUtils::SetSize( service.iBitmap, size ); + AknIconUtils::SetSize( service.iMask, size ); aLocalisedServiceName = service.iDisplayName.AllocL(); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -53,7 +53,10 @@ // iView is deleted through the alfdisplay delete iPbkCmd; delete iAiwServiceHandler; - delete iInputBlock; + if ( iInputBlock ) + { + iInputBlock->Cancel(); + } } // --------------------------------------------------------------------------- @@ -404,8 +407,7 @@ paramFlag, fullName ); - CCAContactorService* contactorService = iPlugin.ContactorService(); - contactorService->ExecuteServiceL( param ); + iPlugin.ExecuteServiceL( param ); CleanupStack::PopAndDestroy( 1 );// contactlinkarray } @@ -420,6 +422,9 @@ { CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DoEditCmdL()")); + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + cmdState.SetRunningAndPushCleanupL(); + // Avoid user input during Edit command execution if( iInputBlock ) { @@ -446,6 +451,8 @@ iAiwServiceHandler->OutParamListL(), NULL, this ); CleanupStack::PopAndDestroy( popAndDestroyUs ); + // Async AIW command -> set state to not running in HandleNotifyL. + cmdState.PopCleanup(); CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DoEditCmdL()")); } @@ -458,6 +465,11 @@ { CCA_DP(KCommLauncherLogFile, CCA_L("->CCCAppCommLauncherMenuHandler::DoAiwCommandL()")); + // Command state is checked in CCCAppCommLauncherPlugin::HandleCommandL + // before calling the menuhandler. + TCCAppCommandState& cmdState( iPlugin.CommandState() ); + cmdState.SetRunningAndPushCleanupL(); + CAiwGenericParamList& inParamList = iAiwServiceHandler->InParamListL(); TInt popAndDestroyUs = 0; @@ -476,6 +488,8 @@ iAiwServiceHandler->OutParamListL(), NULL, NULL );// not needed (so far) CleanupStack::PopAndDestroy( popAndDestroyUs ); + // Synchronous AIW call -> state to not running. + cmdState.SetNotRunningAndPopCleanup(); CCA_DP(KCommLauncherLogFile, CCA_L("<-CCCAppCommLauncherMenuHandler::DoAiwCommandL()")); } @@ -509,6 +523,13 @@ CAiwGenericParamList& aEventParamList, const CAiwGenericParamList& /*aInParamList*/ ) { + if ( aEventId == KAiwEventCompleted || + aEventId == KAiwEventCanceled || + aEventId == KAiwEventError ) + { + iPlugin.CommandState().SetNotRunning(); + } + TInt returnValue = KErrNone; TInt index = 0; const TAiwGenericParam* param = aEventParamList.FindFirst(index, @@ -537,6 +558,9 @@ // Update the commlauncher the UI contact data iPlugin.ContactHandler().RefetchContactL(); iPlugin.Container().ContactsChangedL(); + + //Update the Store + SetContactStore(iPlugin.ContactHandler().ContactStore()); } if (errParam) diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -40,9 +40,108 @@ const TInt KSupportedMethodsArrayLength = sizeof( KSupportedMethodsArray ) / sizeof( TInt ); const TInt KDelayTime = 30000000; // 30s +/** + * Panic codes for the class TCCAppCommandState + */ +enum TCCAppCommandStatePanicCode + { + ETCCAppCommandState_SetRunning_PreCond = 1 + }; + +// --------------------------------------------------------------------------- +// Panic function for the class TCCAppCommandState +// --------------------------------------------------------------------------- +// +void Panic(TCCAppCommandStatePanicCode aPanicCode) + { + _LIT( KPanicText, "TCCAppCommandState" ); + User::Panic( KPanicText, aPanicCode ); + } + // ======== MEMBER FUNCTIONS ======== // --------------------------------------------------------------------------- +// TCCAppCommandState::TCCAppCommandState +// --------------------------------------------------------------------------- +// +TCCAppCommandState::TCCAppCommandState() + : iState( EFalse ) + { + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::SetRunning +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::SetRunning() + { + // Catch all the implementation errors in release build too. + __ASSERT_ALWAYS( !IsRunning(), + Panic( ETCCAppCommandState_SetRunning_PreCond ) ); + iState = ETrue; + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::SetNotRunning +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::SetNotRunning() + { + iState = EFalse; + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::SetRunningAndPushCleanupL +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::SetRunningAndPushCleanupL() + { + SetRunning(); + PushCleanupL(); + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::SetNotRunningAndPopCleanup +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::SetNotRunningAndPopCleanup() + { + SetNotRunning(); + PopCleanup(); + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::PushCleanupL +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::PushCleanupL() + { + CleanupStack::PushL( TCleanupItem( TCCAppCommandState::CleanupOperation, + this) ); + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::PopCleanup +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::PopCleanup() + { + CleanupStack::Pop(); + } + +// --------------------------------------------------------------------------- +// TCCAppCommandState::CleanupOperation +// --------------------------------------------------------------------------- +// +void TCCAppCommandState::CleanupOperation( TAny* aCommanState ) + { + TCCAppCommandState* state = static_cast( + aCommanState ); + state->SetNotRunning(); + } + + +// --------------------------------------------------------------------------- // CCCAppCommLauncherPlugin::NewL // --------------------------------------------------------------------------- // @@ -379,12 +478,27 @@ // CCCAppCommLauncherContainer::ContactorService // --------------------------------------------------------------------------- // -CCAContactorService* CCCAppCommLauncherPlugin::ContactorService() +const CCAContactorService* CCCAppCommLauncherPlugin::ContactorService() { return iContactorService; } // --------------------------------------------------------------------------- +// CCCAppCommLauncherPlugin::ExecuteServiceL +// --------------------------------------------------------------------------- +// +void CCCAppCommLauncherPlugin::ExecuteServiceL( + const CCAContactorService::TCSParameter& aParameter) + { + if (iContactorService) + { + iCommandState.SetRunningAndPushCleanupL(); + iContactorService->ExecuteServiceL( aParameter ); + iCommandState.SetNotRunningAndPopCleanup(); + } + } + +// --------------------------------------------------------------------------- // CCCAppCommLauncherPlugin::StartTimerL // --------------------------------------------------------------------------- // @@ -442,16 +556,20 @@ // void CCCAppCommLauncherPlugin::HandleCommandL( TInt aCommand ) { - // Make sure the aiw request timer is canceled before executing another command. - CancelTimer(); + if ( !iCommandState.IsRunning() ) + { + // 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 ); - // Forward the command handling 1st to base-class. - // The "Exit"- and "Back"-commands are handled there. - CCCAppViewPluginAknView::HandleCommandL( aCommand ); - - // Rest to menuhandler - EnsureMenuHandlerCreatedL(); - iMenuHandler->HandleCommandL( aCommand ); + // Rest to menuhandler + EnsureMenuHandlerCreatedL(); + iMenuHandler->HandleCommandL( aCommand ); + } } // --------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp --- a/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -12,7 +12,7 @@ * Contributors: * * Description: Implementation of details view plugin -* Version : %version: he1s60#23.1.1.2.17 % +* Version : %version: be1s60pr#23.1.1.2.18 % * */ @@ -507,13 +507,40 @@ // -------------------------------------------------------------------------- // void CCCAppDetailsViewPlugin::StoreUnavailable( - MVPbkContactStore& /*aContactStore*/, + MVPbkContactStore& aContactStore, TInt /*aReason*/) { - if (iSchedulerWait.IsStarted()) - { - iSchedulerWait.AsyncStop(); - } + if( iLink ) + { + TVPbkContactStoreUriPtr linkuri = + iLink->ContactStore().StoreProperties().Uri(); + + TVPbkContactStoreUriPtr uri = aContactStore.StoreProperties().Uri(); + + if( linkuri.Compare( uri, + TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ) == 0 ) + { + /* + * When the end user is selecting a phone contact, the SIM store + * will be opened during opening phone stores, and this function is + * called if the SIM store is unavailable.However the scheduler wait + * object can not stop during the operation (phone contact + * selecting), since the program is keeping on waiting for the + * other call backs coming. + */ + if (iSchedulerWait.IsStarted()) + { + iSchedulerWait.AsyncStop(); + } + } + } + else + { + if (iSchedulerWait.IsStarted()) + { + iSchedulerWait.AsyncStop(); + } + } } // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss Mon Jul 12 13:42:58 2010 +0100 @@ -199,9 +199,9 @@ // r_qtn_cca_mc_my_card_in_ovi // --------------------------------------------------------------------------- // -RESOURCE TBUF r_qtn_cca_mc_my_card_in_ovi +RESOURCE TBUF r_qtn_cca_social_networks { - buf = qtn_cca_mc_my_card_in_ovi; + buf = qtn_cca_social_networks; } // --------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h Mon Jul 12 13:42:58 2010 +0100 @@ -268,6 +268,7 @@ void DoCheckExtensionFactoryL(); inline void ResolveNameOrderL(); + void LayoutControls(); private: // Data diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -325,6 +325,53 @@ // Background skin iBackground->SetRect( rect ); + LayoutControls(); + + delete iImageSelectionPopup; + iImageSelectionPopup = NULL; + + if( !iImageLoader ) + { + if( !iModel.IsEmpty() ) + { + TPtrC8 data( iModel.Data( CSpbContactDataModel::EDataImageContent ) ); + TInt err = KErrNotFound; + if( data.Length() ) + { + // thumbnail image in model -> load it + TPtrC file( iModel.Text( CSpbContactDataModel::ETextImageFileName ) ); + TRAP( err, + iImageLoader = CCCAppMyCardImageLoader::NewL( *this ); + iImageLoader->LoadImageL( data, file, iHeaderCtrl->ThumbnailSize() ); + ); + } + + if( err ) + { + // no thumbnail image available -> load default + ThumbnailLoadError( KErrNotFound ); + } + } + } + else + { + // No need to call ResizeImageL() which would invoke the image decoder re-stating + // to show the previous user-assigned image if MyCard image is not set. + if ( iMyCardImageSet ) + { + TRAP_IGNORE( iImageLoader->ResizeImageL(iHeaderCtrl->ThumbnailSize())); + } + } + + DrawDeferred(); + } + +// --------------------------------------------------------------------------- +// CCCAppMyCardContainer::LayoutControls +// --------------------------------------------------------------------------- +// +void CCCAppMyCardContainer::LayoutControls() + { /** * Option0 (w button, prt) * Option2 (w/o button, prt) @@ -376,45 +423,8 @@ listPaneLayoutRect.LayoutRect( Rect(), listPaneLayout.LayoutLine() ); TRect listPaneRect( listPaneLayoutRect.Rect() ); iListBox->SetRect( listPaneRect ); - - delete iImageSelectionPopup; - iImageSelectionPopup = NULL; + } - if( !iImageLoader ) - { - if( !iModel.IsEmpty() ) - { - TPtrC8 data( iModel.Data( CSpbContactDataModel::EDataImageContent ) ); - TInt err = KErrNotFound; - if( data.Length() ) - { - // thumbnail image in model -> load it - TPtrC file( iModel.Text( CSpbContactDataModel::ETextImageFileName ) ); - TRAP( err, - iImageLoader = CCCAppMyCardImageLoader::NewL( *this ); - iImageLoader->LoadImageL( data, file, iHeaderCtrl->ThumbnailSize() ); - ); - } - - if( err ) - { - // no thumbnail image available -> load default - ThumbnailLoadError( KErrNotFound ); - } - } - } - else - { - // No need to call ResizeImageL() which would invoke the image decoder re-stating - // to show the previous user-assigned image if MyCard image is not set. - if ( iMyCardImageSet ) - { - TRAP_IGNORE( iImageLoader->ResizeImageL(iHeaderCtrl->ThumbnailSize())); - } - } - - DrawDeferred(); - } // ---------------------------------------------------------------------------- // CCCAppMyCardContainer::CheckExtensionFactoryL() @@ -434,17 +444,17 @@ void CCCAppMyCardContainer::DoCheckExtensionFactoryL() { CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); - // if extension is not null and view launcher supports mycard view then - // show statuscontrol TBool visible = EFalse; + MCCAStatusProvider* ccaStatusProvider = NULL; + if( extension ) { if ( !iViewLauncher ) { iViewLauncher = extension->CreateViewLauncherL(); } - if( iViewLauncher && - iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) + if ( iControlLink // my card link has been set + && iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) { visible = ETrue; } @@ -454,11 +464,31 @@ delete iViewLauncher; iViewLauncher = NULL; } + + CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); - CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); if( statusControl ) { - statusControl->MakeVisible( visible ); + if( extension ) + { + TAny* factoryExtension = extension->FactoryExtension( KCCAExtensionFactoryStatusProviderCreatorUid ); + + if( factoryExtension ) + { + MCCAExtensionFactoryStatusProviderCreator* statusProviderCreator = + static_cast( factoryExtension ); + + if( statusProviderCreator ) + { + ccaStatusProvider = statusProviderCreator->CreateStatusProviderL(); + } + } + } + + statusControl->SetStatusProvider( ccaStatusProvider ); + statusControl->MakeVisible( visible ); + LayoutControls(); + DrawDeferred(); } } @@ -531,9 +561,32 @@ if( aEvent == MMyCardObserver::EEventContactChanged || ( aEvent == MMyCardObserver::EEventContactLoaded && iModel.IsEmpty() ) ) { + TInt itemCount_BeforeChange = iModel.ListBoxModel().MdcaCount(); + TInt focusItem_BeforeChange = iListBox->CurrentItemIndex(); + CCCAppMyCard& mycard = iPlugin.MyCard(); - iModel.SetDataL( mycard.PresentationContactL(), iIconArray ); + + TInt itemCount_AfterChange = iModel.ListBoxModel().MdcaCount(); + TInt focusItem_AfterChange = iListBox->CurrentItemIndex(); + + if( itemCount_BeforeChange > itemCount_AfterChange && + focusItem_AfterChange == KErrNotFound ) + { + if( focusItem_BeforeChange >= itemCount_AfterChange ) + { + iListBox->SetCurrentItemIndex( itemCount_AfterChange-1 ); + } + else if( focusItem_BeforeChange >= 0 ) + { + iListBox->SetCurrentItemIndex( focusItem_BeforeChange ); + } + else + { + iListBox->SetCurrentItemIndex( 0 ); + } + } + if( iListBox ) { iListBox->HandleItemAdditionL(); @@ -552,15 +605,25 @@ iHeaderCtrl->ThumbnailSize() ); } + CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); + if( iPlugin.MyCard().IsContactLinkReady() && !iControlLink ) { - CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); - if(statusControl) + if( statusControl ) { statusControl->SetContactLinkL( iPlugin.MyCard().ContactLink() ); + iControlLink = ETrue; } - iControlLink = ETrue; } + + if ( statusControl && !statusControl->IsVisible() && + iControlLink && iViewLauncher && + iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) + { + statusControl->MakeVisible( ETrue ); + LayoutControls(); + DrawDeferred(); + } } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -81,12 +81,16 @@ CVPbkContactManager& contactManager = iAppServices->ContactManager(); FeatureManager::InitializeLibL(); - if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) - { + const TBool isFeatureIdFfContactsSocial = + FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ); + FeatureManager::UnInitializeLib(); + + if( isFeatureIdFfContactsSocial ) + { iProvider = CSpbContentProvider::NewL( contactManager, iAppServices->StoreManager(), CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); - iStatusControl = CCCAppStatusControl::NewL( *iProvider, aObserver ); + iStatusControl = CCCAppStatusControl::NewL( *iProvider, aObserver, CCCAppStatusControl::EMyCardContact ); iStatusControl->SetContainerWindowL( *this ); iStatusControl->MakeVisible( EFalse ); @@ -95,19 +99,18 @@ AknsUtils::CreateIconL( AknsUtils::SkinInstance(), - KAknsIIDQgnPropWmlBmOvi, + KAknsIIDQgnPropSocialCommunities, bmp, bmpMask, KMyCardIconDefaultFileName, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); + EMbmPhonebook2eceQgn_prop_social_communities, + EMbmPhonebook2eceQgn_prop_social_communities_mask ); CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); iStatusControl->SetDefaultStatusIconL( guiIcon ); - HBufC* defaultText = StringLoader::LoadL( R_QTN_CCA_MC_MY_CARD_IN_OVI ); + HBufC* defaultText = StringLoader::LoadL( R_QTN_CCA_SOCIAL_NETWORKS ); iStatusControl->SetDefaultStatusTextL( defaultText ); } - FeatureManager::UnInitializeLib(); // Create portrait image diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def Mon Jul 12 13:42:58 2010 +0100 @@ -19,8 +19,8 @@ ?OfferKeyEventL@CCCAppViewPluginAknContainer@@MAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 18 NONAME ; enum TKeyResponse CCCAppViewPluginAknContainer::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) ?Release@CCCAppCmsContactFetcherWrapper@@QAEXXZ @ 19 NONAME ; void CCCAppCmsContactFetcherWrapper::Release(void) ?RemoveObserver@CCCAppCmsContactFetcherWrapper@@QAEXAAVMCCAppContactFieldDataObserver@@@Z @ 20 NONAME ; void CCCAppCmsContactFetcherWrapper::RemoveObserver(class MCCAppContactFieldDataObserver &) - ?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 &) + ?SetTitleL@CCCAppViewPluginAknView@@QAEXABVTDesC16@@@Z @ 21 NONAME ; void CCCAppViewPluginAknView::SetTitleL(class TDesC16 const &) + ?NewL@CCCAppStatusControl@@SAPAV1@AAVCSpbContentProvider@@AAVMCCAStatusControlObserver@@W4TContactType@1@@Z @ 22 NONAME ; class CCCAppStatusControl * CCCAppStatusControl::NewL(class CSpbContentProvider &, class MCCAStatusControlObserver &, enum CCCAppStatusControl::TContactType) ?SetContactLinkL@CCCAppStatusControl@@QAEXAAVMVPbkContactLink@@@Z @ 23 NONAME ; void CCCAppStatusControl::SetContactLinkL(class MVPbkContactLink &) ?NewL@CCCaFactoryExtensionNotifier@@SAPAV1@XZ @ 24 NONAME ; class CCCaFactoryExtensionNotifier * CCCaFactoryExtensionNotifier::NewL(void) ?ObserveExtensionFactoryL@CCCaFactoryExtensionNotifier@@QAEXAAVTCallBack@@@Z @ 25 NONAME ; void CCCaFactoryExtensionNotifier::ObserveExtensionFactory(class TCallBack &) @@ -30,3 +30,5 @@ ?SetDefaultStatusTextL@CCCAppStatusControl@@QAEXPAVHBufC16@@@Z @ 29 NONAME ; void CCCAppStatusControl::SetDefaultStatusTextL(class HBufC16 *) ?SetDefaultStatusIconL@CCCAppStatusControl@@QAEXPAVCGulIcon@@@Z @ 30 NONAME ; void CCCAppStatusControl::SetDefaultStatusIcon(class CGulIcon *) ?IsTopContact@CCCAppCmsContactFetcherWrapper@@QAEHXZ @ 31 NONAME ; int CCCAppCmsContactFetcherWrapper::IsTopContact(void) + ?SetStatusProvider@CCCAppStatusControl@@QAEXPAVMCCAStatusProvider@@@Z @ 32 NONAME ; void CCCAppStatusControl::SetStatusProvider(class MCCAStatusProvider *) + diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def Mon Jul 12 13:42:58 2010 +0100 @@ -31,7 +31,7 @@ _ZTV28CCCAppViewPluginAknContainer @ 30 NONAME ; ## _ZTV30CCCAppCmsContactFetcherWrapper @ 31 NONAME ; ## _ZN19CCCAppStatusControl15SetContactLinkLER16MVPbkContactLink @ 32 NONAME - _ZN19CCCAppStatusControl4NewLER19CSpbContentProviderR25MCCAStatusControlObserver @ 33 NONAME + _ZN19CCCAppStatusControl4NewLER19CSpbContentProviderR25MCCAStatusControlObserverNS_12TContactTypeE @ 33 NONAME _ZN28CCCaFactoryExtensionNotifier16ExtensionFactoryEv @ 34 NONAME _ZN28CCCaFactoryExtensionNotifier24ObserveExtensionFactoryLER9TCallBack @ 35 NONAME _ZN28CCCaFactoryExtensionNotifier4NewLEv @ 36 NONAME @@ -40,4 +40,4 @@ _ZN19CCCAppStatusControl21SetDefaultStatusTextLEP7HBufC16 @ 39 NONAME _ZN19CCCAppStatusControl21SetDefaultStatusIconLEP8CGulIcon @ 40 NONAME _ZN30CCCAppCmsContactFetcherWrapper12IsTopContactEv @ 41 NONAME - + _ZN19CCCAppStatusControl17SetStatusProviderEP18MCCAStatusProvider @ 42 NONAME diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h Mon Jul 12 13:42:58 2010 +0100 @@ -22,6 +22,8 @@ // INCLUDES #include #include +#include + // FORWARD DECLARATIONS class CEikImage; @@ -55,20 +57,29 @@ */ NONSHARABLE_CLASS( CCCAppStatusControl ) : public CCoeControl, - public MSpbContentProviderObserver + public MSpbContentProviderObserver, + public MCCAStatusProviderObserver { public: // Construction & destruction + + enum TContactType + { + ENormalContact = 0x01, + EMyCardContact = 0x02 + }; + /** * Two-phased constructor. */ IMPORT_C static CCCAppStatusControl* NewL( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ); + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ); /** * Destructor. */ - ~CCCAppStatusControl(); + ~CCCAppStatusControl(); public: // New implementation @@ -100,7 +111,14 @@ * @aDefaultStatusText Default status text */ IMPORT_C void SetDefaultStatusTextL( HBufC* aDefaultStatusText ); - + + /** + * Set the CCA statusprovider + * + * @aCCAStatusProvider ECom status provider + */ + IMPORT_C void SetStatusProvider( MCCAStatusProvider* aCCAStatusProvider ); + public: // From CCoeControl /** @@ -142,6 +160,15 @@ MVPbkContactLink& aLink, MSpbContentProviderObserver::TSpbContentEvent aEvent ); +public: // From MCCAStatusProviderObserver + + /* + * From MCCAStatusProviderObserver + */ + void StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink = NULL ); + private: // New functions /** @@ -164,6 +191,12 @@ MVPbkContactLink& aLink, MSpbContentProviderObserver::TSpbContentEvent aEvent ); + /* + * Update contact status from ECom plugin + * @param aLink contact which has the status updated + */ + void UpdateCCAStatusL( MVPbkContactLink* aLink ); + void SetVariableLayouts( TInt aOption ); inline void RewrapStatusTextToArrayL( @@ -177,7 +210,8 @@ */ CCCAppStatusControl( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ); + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ); /** * Constructor for performing 2nd stage construction @@ -267,6 +301,12 @@ * Current control state. */ TStatusControlState iState; + + // Own. ECOM plugin tatus provider + MCCAStatusProvider* iCCAStatusProvider; + + // Current contact type. + CCCAppStatusControl::TContactType iContactType; }; #endif // CCAPPSTATUSCONTROL_H_ diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -60,13 +60,11 @@ CFbsBitmap* mask = aIcon->Mask(); if( bitmap ) { - AknIconUtils::SetSize( - bitmap, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); + AknIconUtils::SetSize( bitmap, aSize ); } if( mask ) { - AknIconUtils::SetSize( - mask, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); + AknIconUtils::SetSize( mask, aSize ); } } } @@ -79,10 +77,11 @@ // EXPORT_C CCCAppStatusControl* CCCAppStatusControl::NewL( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ) + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ) { CCCAppStatusControl* self= new(ELeave) CCCAppStatusControl( - aContentProvider, aObserver ); + aContentProvider, aObserver, aContactType ); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -95,10 +94,12 @@ // CCCAppStatusControl::CCCAppStatusControl( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ) : + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ) : iContentProvider( aContentProvider ), iObserver( aObserver ), - iState( EStateUndefined ) + iState( EStateUndefined ), + iContactType( aContactType ) { } @@ -151,8 +152,15 @@ { iTouchFeedBack->RemoveFeedbackForControl( this ); } - iContentProvider.RemoveObserver( *this ); + + iContentProvider.RemoveObserver( *this ); + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + } + + delete iCCAStatusProvider; delete iStatusImage; delete iStatusIcon; delete iStatusLabel1; @@ -241,6 +249,22 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::SetStatusProvider +// --------------------------------------------------------------------------- +// +EXPORT_C void CCCAppStatusControl::SetStatusProvider( MCCAStatusProvider* aCCAStatusProvider ) + { + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + delete iCCAStatusProvider; + iCCAStatusProvider = NULL; + } + + iCCAStatusProvider = aCCAStatusProvider; + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::CountComponentControls // --------------------------------------------------------------------------- // @@ -280,14 +304,17 @@ void CCCAppStatusControl::SetVariableLayouts( TInt aOption ) { const TRect rect(Rect()); - // set background graphics layout - const TAknWindowComponentLayout innerLayout( - AknLayoutScalable_Apps::bg_button_pane_cp033( aOption ) ); - + + // Set background and border graphics layout + // + // Avkon LAF needs to be used because phob2_cc_button_pane does not have + // definition for inner rect (to make border visible) and LAF change to + // phob2_cc_button_pane was not accepted. If the border layout at some + // point gets broken, then custom LAF for the border is needed. TAknLayoutRect innerLayoutRect; - innerLayoutRect.LayoutRect( rect, innerLayout.LayoutLine() ); - const TRect innerRect( innerLayoutRect.Rect() ); - iBgContext->SetFrameRects( rect, innerRect ); + innerLayoutRect.LayoutRect( rect, + AknLayoutScalable_Avkon::bg_button_pane_g1() ); + iBgContext->SetFrameRects( rect, innerLayoutRect.Rect() ); // status icon const TAknWindowComponentLayout statusIconLayout( @@ -433,6 +460,21 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::StatusEvent +// --------------------------------------------------------------------------- +// +void CCCAppStatusControl::StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink ) + { + if( iCCAStatusProvider && aEvent == MCCAStatusProviderObserver::EStatusChanged && + iLink && aLink && iLink->IsSame( *aLink ) ) + { + UpdateCCAStatusL( iLink ); + } + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::DoStatusUpdateL // --------------------------------------------------------------------------- // @@ -441,10 +483,23 @@ { if( aEvent == EContentNotAvailable ) { - ShowDefaultContentL(); + if( iCCAStatusProvider ) + { + UpdateCCAStatusL( &aLink ); + TRAP_IGNORE( iCCAStatusProvider->AddObserverL( *this ) ); + } + else + { + ShowDefaultContentL(); + } } else if( iLink && iLink->IsSame( aLink ) ) { + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + } + iState = EStateStatusContent; delete iStatusText; iStatusText = NULL; @@ -485,6 +540,55 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::UpdateCCAStatusL +// --------------------------------------------------------------------------- +// +void CCCAppStatusControl::UpdateCCAStatusL( MVPbkContactLink* aLink ) + { + if( aLink && iCCAStatusProvider ) + { + delete iStatusText; + iStatusText = NULL; + delete iStatusIcon; + iStatusIcon = NULL; + + if( iContactType == ENormalContact ) + { + iCCAStatusProvider->GetStatusInformationL( + *aLink, + iStatusText, + iStatusIcon ); + } + else if( iContactType == EMyCardContact ) + { + iCCAStatusProvider->GetMyCardStatusInformationL( + *aLink, + iStatusText, + iStatusIcon ); + } + + if( !iStatusIcon ) + { + iStatusIcon = CreateEmptyIconL(); + } + + ReSizeIcon( iStatusIcon, iStatusIconSize ); + iStatusImage->SetPicture( iStatusIcon->Bitmap(), iStatusIcon->Mask() ); + iStatusImage->MakeVisible( ETrue ); + + const TInt count( RewrapStatusTextL() ); + TInt option( 1 ); + if( count > 1 ) + { + option = 0; + } + SetVariableLayouts( option ); + + DrawDeferred(); + } + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::RewrapStatusTextToArrayL // --------------------------------------------------------------------------- // diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h --- a/phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h Mon Jul 12 13:42:58 2010 +0100 @@ -58,12 +58,15 @@ /** * Initializes view plugin for usage. Calls 1st * PreparePluginViewL and then ActivatePluginViewL. - * - * @since S60 v5.0 + */ + void InitializePluginL(); + + /** + * Sets the CCApp parameter * @param aParameter contains contact information. * Ownership is transferred. - */ - void InitializePlugin( CCCAParameter& aParameter ); + */ + void SetParameter( CCCAParameter& aParameter ); /** * Returns a reference to CCApp parameter diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -171,22 +171,31 @@ // CCCAAppAppUi::InitializePlugin // --------------------------------------------------------------------------- // -void CCCAAppAppUi::InitializePlugin( - CCCAParameter& aParameter ) +void CCCAAppAppUi::InitializePluginL() { CCA_DP( KCCAppLogFile, CCA_L("->CCCAAppAppUi::InitializePluginL")); - iCCAParameter = &aParameter; - if ( KErrNone != - iCCAppView->StartView( iCCAParameter->LaunchedViewUid() )) + + + TInt error = iCCAppView->StartView( iCCAParameter->LaunchedViewUid() ); + if ( KErrNone != error ) { - Exit(); + User::Leave( error ); } - + CCA_DP( KCCAppLogFile, CCA_L("<-CCCAAppAppUi::InitializePluginL")); } // --------------------------------------------------------------------------- +// CCCAAppAppUi::SetParameter +// --------------------------------------------------------------------------- +// +void CCCAAppAppUi::SetParameter( CCCAParameter& aParameter ) + { + iCCAParameter = &aParameter; + } + +// --------------------------------------------------------------------------- // CCCAAppAppUi::Parameter // --------------------------------------------------------------------------- // diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -131,10 +131,11 @@ data->InternalizeL( readStream ); //PERFORMANCE LOGGING: 5. Parameter transferred/unpacked over AppServer - WriteToPerfLog(); - - iAppUi->InitializePlugin( *data );//ownership transferred + WriteToPerfLog(); CleanupStack::Pop( data ); // data + iAppUi->SetParameter( *data );//ownership transferred + iAppUi->InitializePluginL(); + CleanupStack::PopAndDestroy( 2, clientData );// readStream, clientData diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -20,6 +20,7 @@ #include "ccappheaders.h" #include #include "ccappmycardpluginuids.hrh" +#include "ccacmscontactfetcherwrapper.h" // ======== MEMBER FUNCTIONS ======== @@ -109,16 +110,20 @@ CCA_DP( KCCAppLogFile, CCA_L("->CCCAppView::StartViewL")); iDelayedStarting = ETrue; - // 1st start the contact fetching - iCmsWrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( - &iAppUi.Parameter(), CCCAppCmsContactFetcherWrapper::EFindContactFromOtherStores ); - iCmsWrapper->AddObserverL( *this ); - // At the moment mycard does not need to support tabs, so this is // good enough sollution for launching mycard plugin TBool isUidMyCard = ( aUid == TUid::Uid( KCCAMyCardPluginImplmentationUid ) ); + // MyCard does not need CMS session. Initializing CMS for no real use + // will only waste time in MyCard launching. + if( !isUidMyCard ) + { + // 1st start the contact fetching + iCmsWrapper = CCCAppCmsContactFetcherWrapper::CreateInstanceL( + &iAppUi.Parameter(), CCCAppCmsContactFetcherWrapper::EFindContactFromOtherStores ); + iCmsWrapper->AddObserverL( *this ); + } //In this version support only contact type data (i.e. group data discarded) _LIT8( KCcaOpaqueTag_CNT, "CNT" ); //Contact @@ -472,8 +477,11 @@ { CCA_DP( KCCAppLogFile, CCA_L("CCCAppView::ContactFieldDataObserverHandleErrorL")); CCA_DP( KCCAppLogFile, CCA_L("::ContactFieldDataObserverHandleErrorL - aState: %d, aError: %d"), aState, aError ); - //todo; what kind of behaviour is wanted in error case? - // - exit the app if no cms connection/contact is not found? + // If no contact found, leave here and launching CCA fails + if ( CCCAppCmsContactFetcherWrapper::EOpeningContact == aState ) + { + User::Leave(aError); + } } // --------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/conf/phonebook2.confml Binary file phonebookui/Phonebook2/conf/phonebook2.confml has changed diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/conf/phonebook2_101f8794.crml Binary file phonebookui/Phonebook2/conf/phonebook2_101f8794.crml has changed diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp --- a/phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp Mon Jul 12 13:42:58 2010 +0100 @@ -36,6 +36,7 @@ // Include paths USERINCLUDE ../NamesListExtension/inc +USERINCLUDE ../UIControls/inc SYSTEMINCLUDE ../inc SYSTEMINCLUDE ../ccapplication/inc @@ -66,7 +67,8 @@ SOURCE cpbk2mycard.cpp SOURCE cpbk2openmycardcmd.cpp SOURCE cpbk2contextlaunch.cpp -SOURCE cpbk2deletemycardcmd.cpp +SOURCE cpbk2deletemycardcmd.cpp +SOURCE CPbk2DelayedWaitNote.cpp // Resources START RESOURCE ../rss/Pbk2ExNamesListRes.rss diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/group/Pbk2UIControls.mmp --- a/phonebookui/Phonebook2/group/Pbk2UIControls.mmp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/group/Pbk2UIControls.mmp Mon Jul 12 13:42:58 2010 +0100 @@ -164,7 +164,6 @@ SOURCE cpbk2contactviewdoublelistboxmodel.cpp SOURCE pbk2contactviewdoublelistboxdataelement.cpp SOURCE cpbk2doublelistboxmodelcmddecorator.cpp -SOURCE CPbk2AdaptiveSearchGridWaiter.cpp // Resources LANGUAGE_IDS diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/group/iconlistece.txt --- a/phonebookui/Phonebook2/group/iconlistece.txt Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/group/iconlistece.txt Mon Jul 12 13:42:58 2010 +0100 @@ -29,8 +29,9 @@ /c8,8 qgn_prop_pb_comm_valid_lm_large.svg /c8,8 qgn_prop_locev_map.svg /c8,8 qgn_prop_pb_no_valid_lm.svg -/c8,8 qgn_prop_wml_bm_ovi.svg +/c8,8 qgn_prop_social_communities.svg /c8,8 qgn_indi_many_items_add.svg /c8,8 qgn_prop_pb_thump_mycard.svg /c8,8 qgn_prop_pb_add_top.svg /c8,8 qgn_prop_pb_topc.svg + diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h --- a/phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h Mon Jul 12 13:42:58 2010 +0100 @@ -24,7 +24,7 @@ // FORWARD DECLARATIONS class CAknPopupList; -class CAknSingleHeadingPopupMenuStyleListBox; +class CAknSinglePopupMenuStyleListBox; class CVPbkContactManager; class CVPbkContactStoreUriArray; class MPbk2StoreInfoUiItem; @@ -77,7 +77,7 @@ /// Own: Popup list that is the actual dialog that is shown CAknPopupList* iPopupList; /// Own: Listbox that is given to CAknPopupList constructor - CAknSingleHeadingPopupMenuStyleListBox* iListBox; + CAknSinglePopupMenuStyleListBox* iListBox; /// Ref: Keeps track if destructor is already called TBool* iDestroyed; /// Own: Info item array diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h --- a/phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h Mon Jul 12 13:42:58 2010 +0100 @@ -24,6 +24,7 @@ // -------------------------------------------------------------------------- // const TUint32 KCRUidPhonebookInternalConfig = 0x101f884a; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KCRUidPhonebookStoreConfiguration = 0x1020727f; // -------------------------------------------------------------------------- @@ -42,7 +43,9 @@ /// Current configuration key range 0x00000100 to 0x000001ff const TUint32 KPhonebookCurrentConfigurationFirstKey = 0x00000100; const TUint32 KPhonebookCurrentConfigurationLastKey = 0x000001ff; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KPhonebookCurrentConfigurationPartialKey = 0x00000100; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KPhonebookCurrentConfigurationMask = 0xffffff00; /// Possible configuration key range 0x00000200 to 0x000002ff diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h --- a/phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h Mon Jul 12 13:42:58 2010 +0100 @@ -39,6 +39,7 @@ const TUint32 KPhonebookAddFavoritiesVisibility = 0x00000006; const TUint32 KPhonebooksXPExtensionPluginsName = 0x00000007; const TUint32 KPhonebookPredictiveSearchEnablerFlags = 0x00000008; +const TUint32 KPhonebookStatusMessageVisibility = 0x00000009; #endif // PHONEBOOK2PRIVATECRKEYS_H diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/inc/spbcontactdatamodel.h --- a/phonebookui/Phonebook2/inc/spbcontactdatamodel.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/inc/spbcontactdatamodel.h Mon Jul 12 13:42:58 2010 +0100 @@ -94,8 +94,16 @@ * @return Presentation field index shown at aListIndex */ IMPORT_C TInt PresentationFieldIndex( TInt aListIndex ); - + /** + * Get List Box index for field at aIndex + * + * @param Presentation field index + * @return Listbox row index + */ + IMPORT_C TInt ListIndex( TInt aPresentationIndex ); + + /** * Externalize model into stream */ IMPORT_C void ExternalizeL( RWriteStream& aStream ) const; diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/loc/phonebook2ece.loc --- a/phonebookui/Phonebook2/loc/phonebook2ece.loc Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/loc/phonebook2ece.loc Mon Jul 12 13:42:58 2010 +0100 @@ -883,14 +883,21 @@ // #define qtn_cca_title_my_card "My Card" -//d:Default string for CCA status button when the social information text -//d:cannot be displayed. +//d:Default string for CCA status button with the social information text +//d:To be removed when qtn_cca_social_networks is localised and taken into +//d:use into the code. //l:phob2_cc_button_pane //r:9.2 // #define qtn_cca_ftu_discover "See what %U is up to" -//d:Default string for MyCard status button when the social information text +//d:Default string for CCA status button with the social information text +//l:phob2_cc_button_pane +//r:9.2 +// +#define qtn_cca_social_networks "Social networks" + +//d:Default string for MyCard status button with the social information text //d:cannot be displayed. //l:phob2_cc_button_pane //r:9.2 diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss --- a/phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss Mon Jul 12 13:42:58 2010 +0100 @@ -92,7 +92,7 @@ MENU_ITEM { command = ERclCmdSendEmail; txt = qtn_rcl_stylus_popup_email; flags = EEikMenuItemSpecific;}, MENU_ITEM { command = ERclCmdViewDetails; txt = qtn_rcl_opt_details; flags = EEikMenuItemAction; }, - MENU_ITEM { command = ERclCmdAddAsRecipient; txt = qtn_rcl_opt_add_recipient; flags = EEikMenuItemAction;}, + MENU_ITEM { command = ERclCmdAddAsRecipient; txt = qtn_rcl_opt_add_recipient; flags = EEikMenuItemSpecific;}, MENU_ITEM { command = ERclCmdNewSearchPrefilled; txt = qtn_rcl_opt_new_search; }, MENU_ITEM { command = ERclCmdCall; cascade = r_rcl_call_menu_pane; txt = qtn_rcl_opt_call; flags = EEikMenuItemAction; }, MENU_ITEM { command = ERclCmdSend; cascade = r_rcl_send_menu_pane; txt = qtn_rcl_opt_send; flags = EEikMenuItemAction; }, diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp --- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -122,12 +122,29 @@ // The actual ECom loading is implemented in CPbkxRemoteContactLookupProtocolAdapter. for ( TInt i = 0; i < implArray.Count(); i++ ) { - CPbkxRemoteContactLookupProtocolAdapter* adapter = NULL; - adapter = CPbkxRemoteContactLookupProtocolAdapter::NewL( - implArray[i]->ImplementationUid(), *iProtocolEnv ); - CleanupStack::PushL( adapter ); - User::LeaveIfError( iAdapters.Append( adapter ) ); - CleanupStack::Pop( adapter ); + CPbkxRemoteContactLookupProtocolAdapter* volatile adapter = NULL; + + // Trap the error code of loading one specific protocal adapter, if the error is not + // extremly harmful like "No memory", then go on loading remaining possibly working + // adapters. + TRAPD(err, + { + adapter = CPbkxRemoteContactLookupProtocolAdapter::NewL( + implArray[i]->ImplementationUid(), *iProtocolEnv ); + } + ); + + if( err == KErrNoMemory ) + { + User::Leave( KErrNoMemory ); + } + + if ( adapter ) + { + CleanupStack::PushL( adapter ); + User::LeaveIfError( iAdapters.Append( adapter ) ); + CleanupStack::Pop( adapter ); + } } CleanupStack::PopAndDestroy(); // cleanupItem } @@ -153,23 +170,32 @@ RPointerArray protocolAccountsTmp; TCleanupItem cleanupItemAcc(CleanupResetAndDestroyAccArray, &protocolAccountsTmp); CleanupStack::PushL(cleanupItemAcc); - adapter.GetAllProtocolAccountsL( protocolAccountsTmp ); + + TRAPD( err, + { + adapter.GetAllProtocolAccountsL( protocolAccountsTmp ); + } + ); + + if( err == KErrNoMemory ) + { + User::Leave( KErrNoMemory ); + } // Move accounts from temp array to main array // First expand the main array so that we can move ownership in one go. // TODO OOPS, METHOD NOT AVAILABLE iAdapters.SetReserveL( iAdapters.Count() + protocolAccountsTmp.Count() ); - - // Don't need the cleanup item anymore since iAdapters will take ownership, - // and the iAdapters has already been expanded. - CleanupStack::Pop(); // cleanupItemAcc - for ( TInt x = 0; x < protocolAccountsTmp.Count(); x++ ) + const TInt count = protocolAccountsTmp.Count(); + for ( TInt x = 0; x < count; x++ ) { // Ownership is passed - User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ x ] ) ); + User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ 0 ] ) ); + protocolAccountsTmp.Remove( 0 ); } - // just let protocolAccountsTmp pass out of scope. It doesn't own anything now. + + CleanupStack::PopAndDestroy( &protocolAccountsTmp ); } CleanupStack::Pop(); } diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp --- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -710,7 +710,8 @@ CEikStatusPane* statusPane = appUi->StatusPane(); // add the navigation decorators only if the usual statuspane layout is used - if ( statusPane->CurrentLayoutResId() == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT ) + if ( statusPane->CurrentLayoutResId() == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT || + statusPane->CurrentLayoutResId() == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) { iNaviPane = reinterpret_cast( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h --- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h Mon Jul 12 13:42:58 2010 +0100 @@ -75,6 +75,7 @@ public: // "From" CSpbContactDataModel TInt PresentationFieldIndex( TInt aListIndex ); + TInt ListIndex( TInt aPresentationIndex ); void ExternalizeL( RWriteStream& aStream ) const; void InternalizeL( RReadStream& aStream ); void SetDataL( diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -55,6 +55,15 @@ return iImpl->PresentationFieldIndex( aListIndex ); } +// --------------------------------------------------------------------------- +// CSpbContactDataModel::PresentationFieldIndex +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CSpbContactDataModel::ListIndex( TInt aPresentationIndex ) + { + return iImpl->ListIndex( aPresentationIndex ); + } + // -------------------------------------------------------------------------- // CSpbContactDataModel::ExternalizeL // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -180,6 +180,15 @@ return iListIndxToPresentationIndx[ aListIndex ]; } +// --------------------------------------------------------------------------- +// CSpbContactDataModelPrivate::ListIndex +// --------------------------------------------------------------------------- +// +TInt CSpbContactDataModelPrivate::ListIndex( TInt aPresentationIndex ) + { + return iListIndxToPresentationIndx.Find( aPresentationIndex ); + } + // -------------------------------------------------------------------------- // CSpbContactDataModelPrivate::ExternalizeL // -------------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -109,94 +109,90 @@ // --------------------------------------------------------------------------- // void CSpbPhoneNumberParser::SolvePhoneNumberL( MVPbkStoreContact& aContact ) - { - RBuf number; - TInt numberCount = 0; - - // check if the contact has default a number - MVPbkContactAttributeManager& attributeManager = - iContactManager.ContactAttributeManagerL(); + { + RBuf number; + TInt numberCount = 0; - CVPbkDefaultAttribute* attribute = - CVPbkDefaultAttribute::NewL( EVPbkDefaultTypePhoneNumber ); - CleanupStack::PushL( attribute ); - - MVPbkStoreContactField* field = - attributeManager.FindFieldWithAttributeL( *attribute, aContact ); - if( field ) - { - const MVPbkContactFieldTextData* textData = - &MVPbkContactFieldTextData::Cast( field->FieldData() ); - number.CreateL( textData->Text() ); - } - CleanupStack::PopAndDestroy(); //attribute + // check if the contact has default a number + MVPbkContactAttributeManager& attributeManager = + iContactManager.ContactAttributeManagerL(); - // was the default number found? - if( number.Length() == 0 ) - { - CDesC16Array* phoneNumberArray = new (ELeave) CDesC16ArraySeg(8); - CleanupStack::PushL( phoneNumberArray ); - - // get contact fields - MVPbkStoreContactFieldCollection& fields = aContact.Fields(); - const TInt fieldCount = fields.FieldCount(); - // check fields - for ( TInt i = 0; i < fieldCount; ++i ) - { - const MVPbkStoreContactField& field = fields.FieldAt( i ); - // if correct data type - if( field.FieldData().DataType() == EVPbkFieldStorageTypeText ) - { - const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); - if( fieldType ) - { - const TInt fieldTypeResId = fieldType->FieldTypeResId(); - // if one of the number fields - if( fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEGEN || - fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEHOME || - fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEWORK || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEHOME || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK || - fieldTypeResId == R_VPBK_FIELD_TYPE_CARPHONE || - fieldTypeResId == R_VPBK_FIELD_TYPE_ASSTPHONE || - fieldTypeResId == R_VPBK_FIELD_TYPE_PAGERNUMBER ) - { - const MVPbkContactFieldTextData* textData = - &MVPbkContactFieldTextData::Cast( field.FieldData() ); - const TPtrC phoneNumber( textData->Text() ); - - // we need count phonenumbers same way how this is implemented in CCA - // so that we show same count for phonenumbers in names list - // CCA uses descriptor folded compare for phonenumbers - TInt dummy = 0; - if( 0 != phoneNumberArray->FindIsq( phoneNumber, dummy, ECmpFolded ) ) - { - // phone number doesn't exist - phoneNumberArray->InsertIsqL( phoneNumber, ECmpFolded ); - } - } - } - } - } - numberCount = phoneNumberArray->Count(); - // if only one number, store it - if( numberCount == 1 ) + CVPbkDefaultAttribute* attribute = + CVPbkDefaultAttribute::NewL( EVPbkDefaultTypePhoneNumber ); + CleanupStack::PushL( attribute ); + + TBool hasDefaultNumberField = EFalse; + CDesC16Array* phoneNumberArray = new (ELeave) CDesC16ArraySeg(8); + CleanupStack::PushL( phoneNumberArray ); + + // get contact fields + MVPbkStoreContactFieldCollection& fields = aContact.Fields(); + const TInt fieldCount = fields.FieldCount(); + // check fields + for ( TInt i = 0; i < fieldCount; ++i ) + { + const MVPbkStoreContactField& field = fields.FieldAt( i ); + // if correct data type + if( field.FieldData().DataType() == EVPbkFieldStorageTypeText ) { - number.CreateL( (*phoneNumberArray)[0] ); + const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); + if( fieldType ) + { + const TInt fieldTypeResId = fieldType->FieldTypeResId(); + // if one of the number fields + if( fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEGEN || + fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEHOME || + fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEWORK || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEHOME || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK || + fieldTypeResId == R_VPBK_FIELD_TYPE_CARPHONE || + fieldTypeResId == R_VPBK_FIELD_TYPE_ASSTPHONE || + fieldTypeResId == R_VPBK_FIELD_TYPE_PAGERNUMBER ) + { + const MVPbkContactFieldTextData* textData = + &MVPbkContactFieldTextData::Cast( field.FieldData() ); + if( attributeManager.HasFieldAttributeL( *attribute, field ) ) + { + //default number found + number.CreateL( textData->Text() ); + hasDefaultNumberField = ETrue; + break; + } + const TPtrC phoneNumber( textData->Text() ); + // we need count phonenumbers same way how this is implemented in CCA + // so that we show same count for phonenumbers in names list + // CCA uses descriptor folded compare for phonenumbers + TInt dummy = 0; + if( 0 != phoneNumberArray->FindIsq( phoneNumber, dummy, ECmpFolded ) ) + { + // phone number doesn't exist + phoneNumberArray->InsertIsqL( phoneNumber, ECmpFolded ); + } + } + } } - CleanupStack::PopAndDestroy( phoneNumberArray ); - } + } + numberCount = phoneNumberArray->Count(); + + //default number not found, and only one number + if( EFalse == hasDefaultNumberField && numberCount == 1 ) + { + number.CreateL( (*phoneNumberArray)[0] ); + } + + CleanupStack::PopAndDestroy( phoneNumberArray ); + CleanupStack::PopAndDestroy( attribute ); - // no number was found - if( numberCount > 1 ) - { + // no number was found + 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 @@ -204,8 +200,8 @@ number, CSpbContentProvider::ETypePhoneNumber ); } - number.Close(); - } + number.Close(); + } // --------------------------------------------------------------------------- // CSpbPhoneNumberParser::FetchPhoneNumber diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp --- a/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -157,9 +157,9 @@ const TInt KNullIndexData(-1); const TInt32 KVmbxUid(0x100058F5) ; const TInt KOperatorNameLength(100); -const TInt KIconsCount(14); -const TInt KIconsIdCount(12); -const TInt KIconsMaskCount(12); +const TInt KIconsCount(15); +const TInt KIconsIdCount(15); +const TInt KIconsMaskCount(15); _LIT(KNullCell, "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t%d\t"); _LIT(KDesTab, "\t"); @@ -458,6 +458,7 @@ { iSkinIcons->Append( KAknsIIDQgnPropNrtypVoip ); iSkinIcons->Append( KAknsIIDQgnPropNrtypSwis ); + iSkinIcons->Append( KAknsIIDQgnPropNrtypSip ); } iSkinIcons->Append( KAknsIIDQgnPropNrtypAssistant ); iSkinIcons->Append( KAknsIIDQgnPropEmpty ); @@ -478,6 +479,7 @@ { iIcons->Append( EMbmAvkonQgn_prop_nrtyp_voip ); iIcons->Append( EMbmAvkonQgn_prop_empty ); + iIcons->Append( EMbmAvkonQgn_prop_empty ); } iIcons->Append( EMbmAvkonQgn_prop_nrtyp_assistant ); iIcons->Append( EMbmAvkonQgn_prop_empty ); @@ -496,9 +498,12 @@ { iIconsId->Append( EPbkqgn_prop_nrtyp_voip ); iIconsId->Append( EPbkqgn_prop_nrtyp_swis ); + iIconsId->Append( EPbkqgn_prop_nrtyp_sip ); } iIconsId->Append( EPbkqgn_prop_nrtyp_assistant ); iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); + iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); + iIconsId->Append( EPbkqgn_prop_nrtyp_empty ); iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_phone_mask ); iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_home_mask ); @@ -512,9 +517,12 @@ { iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_voip_mask ); iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); + iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); } iIconsMask->Append( EMbmAvkonQgn_prop_nrtyp_assistant_mask ); iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); + iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); + iIconsMask->Append( EMbmAvkonQgn_prop_empty_mask ); } // --------------------------------------------------------- // CSpdiaControl::CSpdiaControl @@ -1521,7 +1529,7 @@ iSdmArray = new (ELeave) CArrayFixFlat (iSdmCount); iDialSkinBmp = new (ELeave)RArray(KArraySize); - iSkinIcons = new (ELeave)RArray(KArraySize); + iSkinIcons = new (ELeave)RArray(iIconsIdCount); iIcons = new (ELeave)RArray(iIconsCount); iIconsId = new (ELeave)RArray(iIconsIdCount); iIconsMask = new (ELeave)RArray(iIconsMaskCount); diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp --- a/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -127,6 +127,7 @@ R_VPBK_FIELD_TYPE_VOIPGEN, R_VPBK_FIELD_TYPE_POC, R_VPBK_FIELD_TYPE_SWIS, + R_VPBK_FIELD_TYPE_SIP, R_VPBK_FIELD_TYPE_PAGERNUMBER, R_VPBK_FIELD_TYPE_ASSTPHONE, R_VPBK_FIELD_TYPE_CARPHONE, @@ -477,6 +478,7 @@ delete iImageManager; delete iWait; + delete iWaitFetchmail; delete iContact; delete iContactLinkArray; delete iSpeedDial; @@ -2067,7 +2069,7 @@ TBool aReturn = EFalse; - if ( (*iSdmArray)[aIndex].Contact()!= NULL ) + if ( (!CheckSpaceBelowCriticalLevelL() )&&( (*iSdmArray)[aIndex].Contact()!= NULL )) { iState = STATE_REMOVE; if((*iSdmArray)[aIndex].Field() != NULL) diff -r 35018d46c3dc -r 22a79a0cd291 phonebookui/Speeddial/src/SpdiaContainer.cpp --- a/phonebookui/Speeddial/src/SpdiaContainer.cpp Fri May 28 13:07:31 2010 +0100 +++ b/phonebookui/Speeddial/src/SpdiaContainer.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -260,7 +260,7 @@ iSpeedPrivate->GridStatus() == CSpeedDialPrivate::EGridUse ) { // if refresh grid here, termination will be interrupt when edit type is full screen QWERTY. - RefreshGrid(); + // RefreshGrid(); iGrid->HandleResourceChange( aType ); // Reload menubar when swap between landscape and portrait mode. @@ -490,8 +490,6 @@ // If not, updated the option menu else if ( !iView->IsFocused() ) { - // LOGTEXT( _L("CR addition: handle HW key shortcuts event in OfferKeyEventL()") ); - iGrid->SetCurrentDataIndex( 0 ); iView->LoadCba( MenuResourceID() ); MiddleSoftKeyL(); } @@ -1064,6 +1062,12 @@ return; } + //reset iLongTapUsed + if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) + { + iLongTapUsed = EFalse; + } + if ( ( aPointerEvent.iType == TPointerEvent::EButton1Down ) || ( aPointerEvent.iType == TPointerEvent::EButton1Up ) ) { diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp --- a/predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp Mon Jul 12 13:42:58 2010 +0100 @@ -33,13 +33,15 @@ SOURCE proxy.cpp SOURCE CPcsAlgorithm1.cpp SOURCE CPcsAlgorithm1Helper.cpp -SOURCE CPcsAlgorithm1FilterHelper.cpp +SOURCE CPcsAlgorithm1FilterHelper.cpp SOURCE CPcsAlgorithm1MultiSearchHelper.cpp SOURCE CPcsAlgorithm1Utils.cpp SOURCE CPcsCache.cpp SOURCE CPcsPoolElement.cpp SOURCE CPcsKeyMap.cpp SOURCE CPsDataPluginInterface.cpp +SOURCE CPcsAdaptiveGrid.cpp +SOURCE CPcsAdaptiveGridItem.cpp USERINCLUDE ../inc USERINCLUDE ../../inc @@ -54,8 +56,8 @@ LIBRARY estor.lib LIBRARY flogger.lib LIBRARY bafl.lib -LIBRARY gdi.lib +LIBRARY gdi.lib LIBRARY PcsUtils.lib LIBRARY ptiengine.lib -LIBRARY centralrepository.lib +LIBRARY centralrepository.lib diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class to hold a single item for Adaptive Grid. +* Used to provide quickly to client applications (Phonebook) +* The Adaptive Grid for the full list of contacts, which is +* the one that is displayed when the Find Box is empty. +*/ + +#ifndef __CPS_ADAPTIVE_GRID_H__ +#define __CPS_ADAPTIVE_GRID_H__ + +// SYSTEM INCLUDES +#include +#include +#include + +#include "CPcsAdaptiveGridItem.h" + +// CLASS DECLARATION + +/** + * Utility class to hold a single item for the Adaptive Grid. + * This class is used to represent one character of the Adaptive Grid + * with its reference counters. + * + * @lib pcsutils.lib + * @since S60 v3.2 + */ +class CPcsAdaptiveGrid : public CBase +{ + public: + + /** + * Two phase construction + * + * @return Instance of CPcsAdaptiveGrid + */ + static CPcsAdaptiveGrid* NewL( ); + + /** + * Destructor + */ + ~CPcsAdaptiveGrid(); + + /** + * Return the count of grid items + */ + TInt Count(); + + /** + * Return the index of the Adaptive Grid item, given the char + */ + TInt GetAdaptiveGridItemIndex( const TChar& aChar ); + + /** + * Get the pointer to the Adaptive Grid item, given the char + */ + CPcsAdaptiveGridItem* GetAdaptiveGridItemPtr( const TChar& aChar ); + + /** + * Increment the ref counter of the Adaptive Grid item, given the char + * and the selector + */ + void IncrementRefCounterL( const TChar& aChar, const TUint aSelector ); + + /** + * Decrement the ref counter of the Adaptive Grid item, given the char + * and the selector + */ + void DecrementRefCounter( const TChar& aChar, const TUint aSelector ); + + /** + * Return the Adaptive Grid, given the Company Name + */ + void GetAdaptiveGrid( const TBool aCompanyName, TDes& aGrid ); + + /** + * Print the Adaptive Grid + */ + void CPcsAdaptiveGrid::PrintAdatptiveGrid( ); + + /** + * Reset the grid + */ + void Reset(); + + private: + + /** + * Default Constructor + */ + CPcsAdaptiveGrid(); + + /** + * Array of Adaptive Grid characters with reference counters. + */ + RPointerArray iAdaptiveGrid; +}; + +#endif // __CPS_ADAPTIVE_GRID_H__ + +// End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGridItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGridItem.h Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,138 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class to hold a single item for Adaptive Grid. +* Used to provide quickly to client applications (Phonebook) +* The Adaptive Grid for the full list of contacts, which is +* the one that is displayed when the Find Box is empty. +*/ + +#ifndef __CPS_ADAPTIVE_GRID_ITEM_H__ +#define __CPS_ADAPTIVE_GRID_ITEM_H__ + +// SYSTEM INCLUDES +#include +#include +#include + +// CLASS DECLARATION + +/** + * Utility class to hold a single item for the Adaptive Grid. + * This class is used to represent one character of the Adaptive Grid + * with its reference counters. + * + * @lib pcsutils.lib + * @since S60 v3.2 + */ +class CPcsAdaptiveGridItem : public CBase +{ + public: + + /** + * Two phase construction + * + * @return Instance of CPcsAdaptiveGridItem + */ + static CPcsAdaptiveGridItem* NewL( const TChar& aChar ); + + /** + * Destructor + */ + ~CPcsAdaptiveGridItem( ); + + /** + * TLinearOrder rule for comparison of data objects + * + * @return order + */ + static TInt CompareByCharacter( const CPcsAdaptiveGridItem& aObject1, + const CPcsAdaptiveGridItem& aObject2 ); + + /** + * Returns the character of the Adaptive Grid item + * + * @return Character input + */ + TChar Character( ) const; + + /** + * Selectors for Adaptive Grid character reference counters + */ + enum TCounterSelector + { + EFirstNameLastName = 0, + EUnnamedCompanyName, + ECompanyName, + ENumberCounters + }; + + /** + * Return the Adaptive Grid item reference counter for a given selector + * + * @param Reference counter selector + * @return Reference counter value + */ + TUint GetRefCounter( const TUint aSelector ); + + /** + * Increments the Adaptive Grid item reference counter for a given selector + * + * @param Reference counter selector + */ + void IncrementRefCounter( const TUint aSelector ); + + /** + * Decrements the Adaptive Grid item reference counter for a given selector + * + * @param Reference counter selector + */ + void DecrementRefCounter( const TUint aSelector ); + + /** + * Checks if Adaptive Grid item reference counters for all selectors are 0 + * + * @return ETrue if all reference counters are 0 + * EFalse otherwise + */ + TBool AreRefCountersZero( ); + + /** + * Checks if Adaptive Grid item reference counters for the requested selectors are not 0 + * + * @return ETrue if one at least of the reference counters is > 0 + * EFalse otherwise + */ + TBool IsRefCounterNonZero( const TBool aCompanyName ); + + private: + + /** + * Default Constructor + */ + CPcsAdaptiveGridItem( const TChar& aChar ); + + /** + * Character of the Adaptive Grid + */ + TChar iCharacter; + + /** + * Reference counters for the Adaptive Grid characters + */ + TFixedArray iCountersArr; +}; + +#endif // __CPS_ADAPTIVE_GRID_ITEM_H__ + +// End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h Mon Jul 12 13:42:58 2010 +0100 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "PSAlgorithmInternalCRKeys.h" @@ -78,17 +79,17 @@ /** * Search Function for input string */ - void SearchInputL(CPsQuery& aSearchQuery, - TDesC& aSearchData, - RPointerArray& aMatchSet, - RArray& aMatchLocation ); + void SearchInputL( CPsQuery& aSearchQuery, + TDesC& aSearchData, + RPointerArray& aMatchSet, + RArray& aMatchLocation ); /** * Performs search on a input string, and return result also as a string */ - void SearchMatchStringL( CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ); + void SearchMatchStringL( CPsQuery& aSearchQuery, + TDesC& aSearchData, + TDes& aMatch ); /** * Returns ETrue if this language is supported @@ -110,7 +111,13 @@ */ void ChangeSortOrderL(TDesC& aURI, RArray& aSortOrder); - + /** + * Get the Adaptive Grid for one or more URIs + */ + void GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ); + // -------------------------------------------------------------------- public: diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h Mon Jul 12 13:42:58 2010 +0100 @@ -47,6 +47,11 @@ static void FormCompleteSearchResultsL(RPointerArray& aSearchResultsArr, RPointerArray& SearchResults); + /** + * Compare by character. + */ + static TInt CompareByCharacter(const TChar& aFirst, const TChar& aSecond); + /** * Compare by length. */ diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h Mon Jul 12 13:42:58 2010 +0100 @@ -27,6 +27,7 @@ #include "CPcsPoolElement.h" #include "TCacheInfo.h" #include "CPcsDefs.h" +#include "CPcsAdaptiveGrid.h" // CLASS DECLARATION class CPcsCache : public CBase @@ -115,9 +116,14 @@ void GetIndexOrder(RArray& aIndexOrder); /** - * Resort data according to the new sortorder - */ + * Resort data according to the new sortorder + */ void ResortdataInPoolsL(); + + /** + * Returns the Adaptive Grid + */ + void GetAdaptiveGridL( const TBool aCompanyName, TDes& aAdaptiveGrid ); private: @@ -151,6 +157,11 @@ */ void ComputeIndexOrder(); + /** + * Matches Adaptive Grid Item Selector + */ + TUint GridItemSelector( TInt aIndex, TBool& aUnnamed ); + private: /* @@ -210,6 +221,10 @@ */ RArray iIndexOrder; + /** + * Grid characters with reference counters. + */ + CPcsAdaptiveGrid* iAdaptiveGridMap; }; diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,216 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class to hold a single item for Adaptive Grid. +* Used to provide quickly to client applications (Phonebook) +* The Adaptive Grid for the full list of contacts, which is +* the one that is displayed when the Find Box is empty. +*/ + + +// INCLUDE FILES +#include "CPcsDebug.h" +#include "CPcsAdaptiveGridItem.h" +#include "CPcsAdaptiveGrid.h" + + + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::NewL +// Two Phase Construction +// ---------------------------------------------------------------------------- +CPcsAdaptiveGrid* CPcsAdaptiveGrid::NewL( ) +{ + return new ( ELeave ) CPcsAdaptiveGrid(); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::CPcsAdaptiveGrid +// Constructor +// ---------------------------------------------------------------------------- +CPcsAdaptiveGrid::CPcsAdaptiveGrid( ) +{ + iAdaptiveGrid.ResetAndDestroy(); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::~CPcsAdaptiveGrid +// Destructor +// ---------------------------------------------------------------------------- +CPcsAdaptiveGrid::~CPcsAdaptiveGrid( ) +{ + iAdaptiveGrid.ResetAndDestroy(); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::Count +// +// ---------------------------------------------------------------------------- +TInt CPcsAdaptiveGrid::Count( ) +{ + return iAdaptiveGrid.Count(); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::GetAdaptiveGridItemIndex +// +// ---------------------------------------------------------------------------- +TInt CPcsAdaptiveGrid::GetAdaptiveGridItemIndex( const TChar& aChar ) +{ + TChar aUpperChar = User::UpperCase( aChar ); + + TInt retValue = KErrNotFound; + + // The Grid items are sorted alphabetically, anyway the number of items in the + // array is small so we do linear search + for ( TInt i=0; i < iAdaptiveGrid.Count(); i++ ) + { + if ( iAdaptiveGrid[i]->Character( ) == aUpperChar ) + { + retValue = i; + break; + } + } + + return retValue; +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::GetAdaptiveGridItemPtr +// +// ---------------------------------------------------------------------------- +CPcsAdaptiveGridItem* CPcsAdaptiveGrid::GetAdaptiveGridItemPtr( const TChar& aChar ) +{ + CPcsAdaptiveGridItem* retValue = NULL; + + TInt gridItemIndex = GetAdaptiveGridItemIndex( aChar ); + + if ( gridItemIndex != KErrNotFound ) + { + retValue = iAdaptiveGrid[gridItemIndex]; + } + + return retValue; +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::IncrementRefCounter +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::IncrementRefCounterL( const TChar& aChar, const TUint aSelector ) +{ + CPcsAdaptiveGridItem* gridItem = GetAdaptiveGridItemPtr( aChar ); + + if ( gridItem == NULL ) + { + TLinearOrder rule( CPcsAdaptiveGridItem::CompareByCharacter ); + + CPcsAdaptiveGridItem* newGridItem = CPcsAdaptiveGridItem::NewL( aChar ); + newGridItem->IncrementRefCounter( aSelector ); + iAdaptiveGrid.InsertInOrder(newGridItem, rule); + } + else + { + gridItem->IncrementRefCounter( aSelector ); + } + + PRINT2 ( _L("CPcsAdaptiveGrid::IncrementRefCounterL: Char='%c', Selector=%d"), + (TUint) aChar, aSelector ); + // PrintAdatptiveGrid( ); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::DecrementRefCounter +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::DecrementRefCounter( const TChar& aChar, const TUint aSelector ) +{ + TInt gridItemIndex = GetAdaptiveGridItemIndex( aChar ); + + if ( gridItemIndex != KErrNotFound ) + { + CPcsAdaptiveGridItem* gridItem = iAdaptiveGrid[gridItemIndex]; + + gridItem->DecrementRefCounter( aSelector ); + + // Remove the Grid item, if there is no reference to it anymore + if ( gridItem->AreRefCountersZero( ) ) + { + iAdaptiveGrid.Remove( gridItemIndex ); + delete gridItem; + } + } + + PRINT2 ( _L("CPcsAdaptiveGrid::DecrementRefCounter: Char='%c', Selector=%d"), + (TUint) aChar, aSelector ); + // PrintAdatptiveGrid( ); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::GetAdaptiveGrid +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::GetAdaptiveGrid( const TBool aCompanyName, TDes& aGrid ) +{ + aGrid.Zero(); + TInt gridCharCount = 0; + for ( TInt i=0; i < iAdaptiveGrid.Count(); i++ ) + { + if ( iAdaptiveGrid[i]->IsRefCounterNonZero( aCompanyName ) ) + { + aGrid.Append( iAdaptiveGrid[i]->Character() ); + gridCharCount++; + if ( gridCharCount == KPsAdaptiveGridStringMaxLen ) + { + break; + } + } + } +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::PrintAdatptiveGrid +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::PrintAdatptiveGrid( ) +{ + PRINT ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: ----------------------------------------") ); + PRINT1 ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: Adaptive Grid (%d items)"), iAdaptiveGrid.Count() ); + PRINT ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: ----------------------------------------") ); + + for ( TInt i=0; i < iAdaptiveGrid.Count(); i++ ) + { + CPcsAdaptiveGridItem* gridItem = iAdaptiveGrid[i]; + + PRINT5 ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: Grid[%d].Character=%c, RefCounters[%d,%d,%d]"), + i, (TUint) iAdaptiveGrid[i]->Character(), + iAdaptiveGrid[i]->GetRefCounter(CPcsAdaptiveGridItem::EFirstNameLastName), + iAdaptiveGrid[i]->GetRefCounter(CPcsAdaptiveGridItem::EUnnamedCompanyName), + iAdaptiveGrid[i]->GetRefCounter(CPcsAdaptiveGridItem::ECompanyName) ); + } + + PRINT ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: ----------------------------------------") ); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::Reset +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::Reset() + { + iAdaptiveGrid.ResetAndDestroy(); + } + +// End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGridItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGridItem.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -0,0 +1,167 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Utility class to hold a single item for Adaptive Grid. +* Used to provide quickly to client applications (Phonebook) +* The Adaptive Grid for the full list of contacts, which is +* the one that is displayed when the Find Box is empty. +*/ + + +// INCLUDE FILES +#include "CPcsDebug.h" +#include "CPcsAlgorithm1Utils.h" +#include "CPcsAdaptiveGridItem.h" + + +// ============================== MEMBER FUNCTIONS ============================ + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::NewL +// Two Phase Construction +// ---------------------------------------------------------------------------- +CPcsAdaptiveGridItem* CPcsAdaptiveGridItem::NewL( const TChar& aChar ) +{ + return new ( ELeave ) CPcsAdaptiveGridItem( aChar ); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::CPcsAdaptiveGridItem +// Constructor +// ---------------------------------------------------------------------------- +CPcsAdaptiveGridItem::CPcsAdaptiveGridItem( const TChar& aChar ): + iCharacter(User::UpperCase( aChar )) +{ + // Set zeroes in the reference counters array + for ( TInt i=0; i < CPcsAdaptiveGridItem::ENumberCounters; i++ ) + { + iCountersArr[i] = 0; + } +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::~CPcsAdaptiveGridItem +// Destructor +// ---------------------------------------------------------------------------- +CPcsAdaptiveGridItem::~CPcsAdaptiveGridItem( ) +{ + iCountersArr.Reset(); +} + +// ---------------------------------------------------------------------------- +// CPcsAlgorithm1Utils::CompareByCharacter() +// TLinearOrder rule for comparison of data objects +// ---------------------------------------------------------------------------- +TInt CPcsAdaptiveGridItem::CompareByCharacter( const CPcsAdaptiveGridItem& aObject1, + const CPcsAdaptiveGridItem& aObject2 ) +{ + return CPcsAlgorithm1Utils::CompareByCharacter( + aObject1.Character(), aObject2.Character() ); +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::Character +// Return character of the Adaptive Grid Item +// ---------------------------------------------------------------------------- +TChar CPcsAdaptiveGridItem::Character( ) const +{ + return iCharacter; +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::GetRefCounter +// Return the reference counter for one selector +// ---------------------------------------------------------------------------- +TUint CPcsAdaptiveGridItem::GetRefCounter( const TUint aSelector ) +{ + if ( aSelector < CPcsAdaptiveGridItem::ENumberCounters ) + { + return iCountersArr[aSelector]; + } + else + { + return 0; + } +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::IncrementRefCounter +// Increment the reference counter for one selector +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGridItem::IncrementRefCounter( const TUint aSelector ) +{ + if ( aSelector < CPcsAdaptiveGridItem::ENumberCounters ) + { + iCountersArr[aSelector]++; + } +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::DecrementRefCounter +// Decrement the reference counter for one selector +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGridItem::DecrementRefCounter( const TUint aSelector ) +{ + if ( aSelector < CPcsAdaptiveGridItem::ENumberCounters ) + { + if ( iCountersArr[aSelector] > 0 ) + { + iCountersArr[aSelector]--; + } + else + { + PRINT2 ( _L("CPcsAdaptiveGridItem::DecrementRefCounter: ERROR Decrement ref counter 0, Character=%c, Selector=%d"), + (TUint) Character(), aSelector ); + } + } +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::AreRefCountersZero +// Check if reference counters for all selectors are 0 +// ---------------------------------------------------------------------------- +TBool CPcsAdaptiveGridItem::AreRefCountersZero( ) +{ + TBool retValue = ETrue; + + for ( TInt i=0; i < CPcsAdaptiveGridItem::ENumberCounters; i++ ) + { + if ( iCountersArr[i] > 0 ) + { + retValue = EFalse; + break; + } + } + + return retValue; +} + +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGridItem::IsRefCounterNonZero +// Check if reference counters for all selectors are 0 +// ---------------------------------------------------------------------------- +TBool CPcsAdaptiveGridItem::IsRefCounterNonZero( const TBool aCompanyName ) +{ + TBool retValue = EFalse; + + if ( iCountersArr[CPcsAdaptiveGridItem::EFirstNameLastName] > 0 || + iCountersArr[CPcsAdaptiveGridItem::EUnnamedCompanyName] > 0 || + ( aCompanyName && iCountersArr[CPcsAdaptiveGridItem::ECompanyName] > 0 ) ) + { + retValue = ETrue; + } + + return retValue; +} + +// End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -256,6 +256,18 @@ __LATENCY_MARK ( _L("CPcsAlgorithm1::PerformSearchL") ); + // Check aSettings + RPointerArray searchUris; + CleanupResetAndDestroyPushL( searchUris ); + aSettings.SearchUrisL(searchUris); + + if ( searchUris.Count() <= 0) + { + PRINT ( _L("searchUris.Count() <= 0, Leave from CPcsAlgorithm1::PerformSearchL") ); + User::Leave(KErrArgument); + } + CleanupStack::PopAndDestroy( &searchUris ); // ResetAndDestroy + // Local arrays to hold the search results RPointerArray tempSearchResults; CleanupClosePushL( tempSearchResults ); @@ -502,8 +514,8 @@ // Search function for input string, result also as string // ---------------------------------------------------------------------------- void CPcsAlgorithm1::SearchMatchStringL( CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ) + TDesC& aSearchData, + TDes& aMatch ) { PRINT ( _L("Enter CPcsAlgorithm1::SearchMatchStringL") ); @@ -752,7 +764,7 @@ if ( cache->GetURI().CompareC(aDataStore) == 0 ) return i; } - return -1; + return KErrNotFound; } // ---------------------------------------------------------------------------- @@ -763,7 +775,7 @@ { // Check if the datastore cache already exists TInt index = GetCacheIndex(aDataStore); - if ( index != -1 ) + if ( index != KErrNotFound ) { // Already exists return; @@ -1230,10 +1242,10 @@ void CPcsAlgorithm1::ChangeSortOrderL ( TDesC& aURI, RArray& aSortOrder ) { - PRINT ( _L("Enter CPcsAlgorithm1::ChangeSortOrderL.") ); + PRINT ( _L("Enter CPcsAlgorithm1::ChangeSortOrderL") ); PRINT ( _L("CPcsAlgorithm1::ChangeSortOrderL. Sort order change received.") ); - PRINT1 ( _L("URI = %S"), &aURI ); + PRINT1 ( _L("CPcsAlgorithm1::ChangeSortOrderL. URI = %S"), &aURI ); // If URI is search in a group URI return if ( CPcsAlgorithm1Utils::IsGroupUri(aURI) ) @@ -1298,7 +1310,127 @@ return; } - PRINT ( _L("End CPcsAlgorithm1::ChangeSortOrderL.") ); + PRINT ( _L("End CPcsAlgorithm1::ChangeSortOrderL") ); +} + +// ---------------------------------------------------------------------------- +// CPcsAlgorithm1::GetAdaptiveGridL +// +// ---------------------------------------------------------------------------- +void CPcsAlgorithm1::GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ) +{ + PRINT ( _L("Enter CPcsAlgorithm1::GetAdaptiveGridL") ); + + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Request of Adaptive Grid for %d URI(s)"), + aURIs.MdcaCount() ); + + RArray cacheIds; + CleanupClosePushL( cacheIds ); + + // Create the list of the cache indexes that will form the Adaptive Grid + for ( TInt i=0; i < aURIs.MdcaCount(); i++ ) + { + TPtrC16 uri = aURIs.MdcaPoint(i); + + // If URI is a group URI skip it + if ( CPcsAlgorithm1Utils::IsGroupUri( uri ) ) + { + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Adaptive Grid for URI \"%S\" is not supported. Skipping"), + &uri ); + continue; + } + + TInt cacheIndex = GetCacheIndex( uri ); + if ( cacheIndex == KErrNotFound ) + { + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Cache for URI \"%S\" doesn't exist"), + &uri ); + continue; + } + + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Cache for URI \"%S\" will be used to form the Adaptive Grid"), + &uri ); + + cacheIds.AppendL( cacheIndex ); + } + + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Number of caches that will be used to form the grid is %d"), + cacheIds.Count( ) ); + + // Create the Adaptive Grid from the cache(s) + if ( cacheIds.Count() == 1 ) // No merge if we have only one cache + { + // Cache instance for this URI + CPcsCache* cache = iPcsCache[cacheIds[0]]; + + // Get the Adaptive Grid + cache->GetAdaptiveGridL( aCompanyName, aAdaptiveGrid ); + + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Adaptive Grid: \"%S\" (No merge was needed)"), + &aAdaptiveGrid ); + } + else if ( cacheIds.Count() > 1 ) // Merge if we have more than one cache + { + RArray gridAll; + CleanupClosePushL( gridAll ); + TUint gridSize = 0; + + HBufC16* gridOne = HBufC::NewLC(KPsAdaptiveGridStringMaxLen); + TPtr16 gridOnePtr( gridOne->Des( )); + + TLinearOrder rule( CPcsAlgorithm1Utils::CompareByCharacter ); + + // Loop through the caches that form the Adaptive Grid + for ( TUint i=0; + gridSize < KPsAdaptiveGridStringMaxLen && i < cacheIds.Count(); + i++ ) + { + // Cache instance for this URI + CPcsCache* cache = iPcsCache[cacheIds[i]]; + + // Get the Adaptive Grid + gridOnePtr.Zero(); + cache->GetAdaptiveGridL( aCompanyName, gridOnePtr ); + + PRINT2 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Adaptive Grid for cache \"%S\" is \"%S\""), + &cache->GetURI(), &gridOnePtr ); + + // Loop through the characters of the Adaptive Grid for the cache + for ( TUint j=0; + gridSize < KPsAdaptiveGridStringMaxLen && j < gridOnePtr.Length(); + j++ ) + { + if ( i == 0 ) // Grid from one cache is already ordered with no repetitions + { + gridAll.Append( gridOnePtr[j]); + } + else // Grids from more caches can have repeated characters + { + gridAll.InsertInOrder( gridOnePtr[j], rule ); // No repeats !!! + } + gridSize++; + } + } + + // Form the Adaptive Grid to be returned + aAdaptiveGrid.Zero(); + for ( TUint i=0; i < gridAll.Count(); i++ ) + { + aAdaptiveGrid.Append( gridAll[i] ); + } + + PRINT1 ( _L("CPcsAlgorithm1::GetAdaptiveGridL. Adaptive Grid: \"%S\" (Merge was done)"), + &aAdaptiveGrid ); + + CleanupStack::PopAndDestroy( gridOne ); + CleanupStack::PopAndDestroy( &gridAll ); // Close + } + + CleanupStack::PopAndDestroy( &cacheIds ); // Close + + PRINT ( _L("End CPcsAlgorithm1::GetAdaptiveGridL") ); } // --------------------------------------------------------------------------------- @@ -1578,5 +1710,6 @@ CleanupStack::PopAndDestroy( &dataStores ); // Close } + // End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -79,10 +79,33 @@ } // ---------------------------------------------------------------------------- +// CPcsAlgorithm1Utils::CompareByCharacter() +// Compare by character. +// ---------------------------------------------------------------------------- +TInt CPcsAlgorithm1Utils::CompareByCharacter( const TChar& aFirst, const TChar& aSecond ) +{ + TInt retValue; + if ( aFirst == aSecond ) + { + retValue = 0; + } + else if ( aFirst < aSecond ) + { + retValue = -1; + } + else + { + retValue = 1; + } + + return retValue; +} + +// ---------------------------------------------------------------------------- // CPcsAlgorithm1Utils::CompareByLength() // Compare by length. // ---------------------------------------------------------------------------- -TInt CPcsAlgorithm1Utils::CompareByLength ( const HBufC& aFirst, const HBufC& aSecond ) +TInt CPcsAlgorithm1Utils::CompareByLength( const HBufC& aFirst, const HBufC& aSecond ) { return ( aFirst.Length() - aSecond.Length() ); } @@ -91,7 +114,7 @@ // CPcsAlgorithm1Utils::CompareExact() // Compare strings exactly case sensitively. // ---------------------------------------------------------------------------- -TBool CPcsAlgorithm1Utils::CompareExact ( const TDesC& aFirst, const TDesC& aSecond ) +TBool CPcsAlgorithm1Utils::CompareExact( const TDesC& aFirst, const TDesC& aSecond ) { return aFirst == aSecond; } @@ -100,7 +123,7 @@ // CPcsAlgorithm1Utils::CompareCollate() // Compare strings with collate rules depending on locale. // ---------------------------------------------------------------------------- -TInt CPcsAlgorithm1Utils::CompareCollate ( const TDesC& aFirst, const TDesC& aSecond ) +TInt CPcsAlgorithm1Utils::CompareCollate( const TDesC& aFirst, const TDesC& aSecond ) { return CPcsAlgorithm1Utils::MyCompareC(aFirst, aSecond); } @@ -146,9 +169,11 @@ { for ( TInt i = 0; i < aPsQuery.Count(); i++ ) { - CPsQueryItem& currentItem = aPsQuery.GetItemAtL(i); - if ( (CPcsKeyMap::IsModePredictive(currentItem.Mode())) - && (aLeft[i] != aRight[i]) ) + CPsQueryItem* currentItemPtr; + TRAPD ( err, currentItemPtr = &(aPsQuery.GetItemAtL(i)) ); + if ( err != KErrNone + || ( CPcsKeyMap::IsModePredictive(currentItemPtr->Mode()) + && aLeft[i] != aRight[i] ) ) { comparison = EFalse; break; diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -23,13 +23,14 @@ // INCLUDE FILES #include - +#include +#include "CPcsDefs.h" #include "CPsData.h" #include "CPcsCache.h" #include "CPcsDebug.h" #include "CWords.h" #include "CPcsAlgorithm1Utils.h" - +#include "CPcsAdaptiveGridItem.h" // ============================== MEMBER FUNCTIONS ============================ @@ -87,7 +88,16 @@ RPointerArray *keyMap = new (ELeave) RPointerArray(1); iKeyArr.InsertL(keyMap,i); } - + + // Adaptive Grid map + if ( iURI->Compare( KVPbkDefaultCntDbURI ) == 0 + || iURI->Compare( KVPbkSimGlobalAdnURI ) == 0 + || iURI->Compare( KVPbkSimGlobalFdnURI ) == 0 + || iURI->Compare( KVPbkSimGlobalSdnURI ) == 0 + || iURI->Compare( KVPbkDefaultGrpDbURI ) == 0 ) + { + iAdaptiveGridMap = CPcsAdaptiveGrid::NewL(); + } PRINT ( _L("End CPcsCache::ConstructL") ); } @@ -110,6 +120,8 @@ iIndexOrder.Reset(); iMasterPoolBackup.Close(); + delete iAdaptiveGridMap; + PRINT ( _L("End CPcsCache::~CPcsCache") ); } @@ -155,27 +167,30 @@ // ---------------------------------------------------------------------------- void CPcsCache::AddToPoolL(TUint64& aPoolMap, CPsData& aData) { - // Temp hash to remember the location of pool elements - // First TInt = Pool - // Second TInt = Location in the pool - // Required for memory optimization so that more than one pool - // element doesn't get added for the same data - RHashMap elementHash; - CleanupClosePushL( elementHash ); - TLinearOrder rule( CPcsPoolElement::CompareByData ); + // Temp hash to remember the location of pool elements + // First TInt = Pool + // Second TInt = Location in the pool + // Required for memory optimization so that more than one pool + // element doesn't get added for the same data + RHashMap elementHash; + CleanupClosePushL( elementHash ); + TLinearOrder rule( CPcsPoolElement::CompareByData ); - // Parse thru each data element - for ( TInt dataIndex = 0; dataIndex < aData.DataElementCount(); dataIndex++ ) - { + TBool unnamed = ETrue; + // Parse thru each data element + for ( TInt dataIndex = 0; dataIndex < aData.DataElementCount(); dataIndex++ ) + { + HBufC* dataStr = aData.Data(dataIndex); + // Find store all the pool IDs where this contact should be RArray poolIds; CleanupClosePushL( poolIds ); // Recover the first character - if ( aData.Data(dataIndex) && aData.Data(dataIndex)->Length() != 0 ) + if ( dataStr && dataStr->Length() != 0 ) { // Split the data into words - CWords* words = CWords::NewLC(*aData.Data(dataIndex)); + CWords* words = CWords::NewLC(*dataStr); // Store the first numeric key for each word for ( TInt i = 0; i < words->MdcaCount(); i++ ) @@ -201,6 +216,21 @@ poolIds.Append(qwertyPoolId); } } + +#ifdef _DEBUG + PRINT2 ( _L("CPcsCache::AddToPoolL: iURI=\"%S\", iUriId=%d"), &*iURI, iUriId ); + TPtrC16 ptr = words->MdcaPoint(i); + PRINT5 ( _L("CPcsCache::AddToPoolL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), + dataIndex, &*dataStr, &(ptr), (TUint) firstChar, aData.IsDataMatch(dataIndex) ); +#endif // _DEBUG + + if ( iAdaptiveGridMap ) + { + // Set the 1st char of the word for the Adaptive Grid or + // increment the reference counter + TUint selector = GridItemSelector( dataIndex, unnamed ); + iAdaptiveGridMap->IncrementRefCounterL( firstChar, selector ); + } } CleanupStack::PopAndDestroy(words); @@ -251,9 +281,9 @@ CleanupStack::PopAndDestroy( &poolIds ); - } // for 1 loop - - CleanupStack::PopAndDestroy( &elementHash ); + } // for 1 loop + + CleanupStack::PopAndDestroy( &elementHash ); } // --------------------------------------------------------------------- @@ -303,30 +333,35 @@ { continue; } - - const RPointerArray& tmpKeyMap = *(iKeyArr[keyIndex]); - for ( TInt arrayIndex = 0; - arrayIndex < tmpKeyMap.Count(); - arrayIndex++ ) + + TInt arrayIndex = 0; + TInt arrayCount = iKeyArr[keyIndex]->Count(); + while ( arrayIndex < arrayCount ) { - CPcsPoolElement *element = tmpKeyMap[arrayIndex]; - TInt id = element->GetPsData()->Id(); - if ( id == aItemId ) - { - data = element->GetPsData(); - delete element; - iKeyArr[keyIndex]->Remove(arrayIndex); - } + CPcsPoolElement* element = (*(iKeyArr[keyIndex]))[arrayIndex]; + if ( element->GetPsData()->Id() == aItemId ) + { + data = element->GetPsData(); + delete element; + iKeyArr[keyIndex]->Remove(arrayIndex); + arrayCount--; + } + else + { + arrayIndex++; + } } } - + // Remove this element from master pool TInt arrayIndex = 0; - while ( arrayIndex < iMasterPool.Count() ) + TInt arrayCount = iMasterPool.Count(); + while ( arrayIndex < arrayCount ) { if ( iMasterPool[arrayIndex]->Id() == aItemId ) { - iMasterPool.Remove(arrayIndex); + iMasterPool.Remove(arrayIndex); + arrayCount--; } else { @@ -334,6 +369,41 @@ } } + if ( iAdaptiveGridMap && data ) + { + TBool unnamed = ETrue; + // Parse thru each data element + for ( TInt dataIndex = 0; dataIndex < data->DataElementCount(); dataIndex++ ) + { + HBufC* dataStr = data->Data(dataIndex); + + // Recover the first character + if ( dataStr && dataStr->Length() != 0 ) + { + // Split the data into words + CWords* words = CWords::NewLC(*dataStr); + + // Store the first numeric key for each word + for ( TInt i = 0; i < words->MdcaCount(); i++ ) + { + TChar firstChar = (words->MdcaPoint(i))[0]; + +#ifdef _DEBUG + PRINT2 ( _L("CPcsCache::RemoveFromCacheL: iURI=\"%S\", iUriId=%d"), &*iURI, iUriId ); + TPtrC16 ptr = words->MdcaPoint(i); + PRINT5 ( _L("CPcsCache::RemoveFromCacheL: Data[%d]=\"%S\", word=\"%S\", firstChar='%c', Match=%d" ), + dataIndex, &*dataStr, &(ptr), (TUint) firstChar, data->IsDataMatch(dataIndex) ); +#endif // _DEBUG + // Decrement the reference counter of the 1st char of the word for the Adaptive Grid or + // delete the Adaptive Grid item if there are no references to it anymore + TUint selector = GridItemSelector( dataIndex, unnamed ); + iAdaptiveGridMap->DecrementRefCounter( firstChar, selector ); + } + CleanupStack::PopAndDestroy( words ); + } + } + } + // Delete data delete data; data = NULL; @@ -350,18 +420,39 @@ { PRINT ( _L("Enter CPcsCache::RemoveAllFromCache") ); - for ( TInt i = 0 ; i < iKeyArr.Count() ; i++ ) + for ( TInt i = 0; i < iKeyArr.Count(); i++ ) { iKeyArr[i]->ResetAndDestroy(); } iMasterPool.ResetAndDestroy(); iCacheInfo.Close(); + + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->Reset(); + } PRINT ( _L("End CPcsCache::RemoveAllFromCache") ); } // --------------------------------------------------------------------- +// CPcsCache::GetAdaptiveGridL +// +// --------------------------------------------------------------------- +void CPcsCache::GetAdaptiveGridL( const TBool aCompanyName, TDes& aAdaptiveGrid ) +{ + PRINT ( _L("Enter CPcsCache::GetAdaptiveGridL") ); + + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); + } + + PRINT ( _L("End CPcsCache::GetAdaptiveGridL") ); +} + +// --------------------------------------------------------------------- // CPcsCache::SetPoolMap // // --------------------------------------------------------------------- @@ -559,19 +650,25 @@ // --------------------------------------------------------------------- void CPcsCache::ResortdataInPoolsL() { - // copy iMasterPool data into iMasterPoolBackup + // Copy iMasterPool data into iMasterPoolBackup for (TInt i = 0; i < iMasterPool.Count(); i++ ) { iMasterPoolBackup.Append( iMasterPool[i] ); } - //Now reset the key array + + // Now reset the key array for (TInt i = 0; i < iKeyArr.Count(); i++ ) { iKeyArr[i]->ResetAndDestroy(); } iMasterPool.Reset(); iCacheInfo.Close(); - //now add data again from the iMasterPoolBackup + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->Reset(); + } + + // Now add data again from the iMasterPoolBackup for (TInt i = 0; i < iMasterPoolBackup.Count(); i++ ) { CPsData* temp = iMasterPoolBackup[i]; @@ -580,4 +677,31 @@ iMasterPoolBackup.Reset(); } +// --------------------------------------------------------------------- +// CPcsCache::GridItemSelectorL +// +// --------------------------------------------------------------------- +TUint CPcsCache::GridItemSelector( TInt aIndex, TBool& aUnnamed ) + { + __ASSERT_ALWAYS( iDataFields.Count() > aIndex, User::Panic(_L("CPcsCache"), KErrArgument ) ); + + if ( iDataFields[aIndex] == R_VPBK_FIELD_TYPE_LASTNAME || iDataFields[aIndex] == R_VPBK_FIELD_TYPE_FIRSTNAME ) + { + aUnnamed = EFalse; + return CPcsAdaptiveGridItem::EFirstNameLastName; + } + else if ( iDataFields[aIndex] == R_VPBK_FIELD_TYPE_COMPANYNAME && !aUnnamed ) + { + return CPcsAdaptiveGridItem::ECompanyName; + } + else if ( iDataFields[aIndex] == R_VPBK_FIELD_TYPE_COMPANYNAME ) + { + return CPcsAdaptiveGridItem::EUnnamedCompanyName; + } + else + { + return CPcsAdaptiveGridItem::ENumberCounters; + } + } + // End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h --- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Mon Jul 12 13:42:58 2010 +0100 @@ -95,8 +95,8 @@ * Performs search on a input string, and return result also as a string */ void SearchMatchStringL( CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ); + TDesC& aSearchData, + TDes& aMatch ); /** * Returns ETrue if this language is supported @@ -118,6 +118,12 @@ */ void ChangeSortOrderL(TDesC& aURI, RArray& aSortOrder); + /** + * Get the Adaptive Grid for one or more URIs + */ + void GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ); // -------------------------------------------------------------------- diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -383,8 +383,8 @@ // Search function for input string, result also as string // ---------------------------------------------------------------------------- void CPcsAlgorithm2::SearchMatchStringL( CPsQuery& /*aSearchQuery*/, - TDesC& /*aSearchData*/, - TDes& /*aMatch*/ ) + TDesC& /*aSearchData*/, + TDes& /*aMatch*/ ) { //NOT IMPLEMENTED YET } @@ -1239,6 +1239,17 @@ PRINT ( _L("End CPcsAlgorithm2::ChangeSortOrderL.") ); } +// ---------------------------------------------------------------------------- +// CPcsAlgorithm2::GetAdaptiveGridL +// +// ---------------------------------------------------------------------------- +void CPcsAlgorithm2::GetAdaptiveGridL( const MDesCArray& /*aURIs*/, + const TBool /*aCompanyName*/, + TDes& /*aAdaptiveGrid*/ ) + { + //NOT IMPLEMENTED YET + } + // --------------------------------------------------------------------------------- // Read the persisted sort order from the central repository // Persisted sort order is of form URI Field1 Field2 Field3 .. FieldN (space delimited) diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/group/PcsServer.mmp --- a/predictivesearch/PcsServer/group/PcsServer.mmp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/group/PcsServer.mmp Mon Jul 12 13:42:58 2010 +0100 @@ -24,6 +24,7 @@ UID 0x1000008e 0x2000B5B6 SECUREID 0x2000B5B6 +EPOCSTACKSIZE 0x8000 EPOCHEAPSIZE 0x100000 0x1000000 EPOCPROCESSPRIORITY background @@ -40,6 +41,7 @@ LIBRARY euser.lib LIBRARY estor.lib LIBRARY flogger.lib +LIBRARY bafl.lib LIBRARY ecom.lib LIBRARY PcsUtils.lib LIBRARY FeatMgr.lib diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/inc/CPcsPluginInterface.h --- a/predictivesearch/PcsServer/inc/CPcsPluginInterface.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/inc/CPcsPluginInterface.h Mon Jul 12 13:42:58 2010 +0100 @@ -127,7 +127,15 @@ * to the algorithm instance */ void ChangeSortOrderL(TDesC& aURI, RArray& aSortOrder); - + + /** + * Forwards the request to get the Adaptive Grid for one or more URI + * to the algorithm instance + */ + void GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ); + /** * Returns the UID of the algorithm in use */ diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/inc/CPcsServer.h --- a/predictivesearch/PcsServer/inc/CPcsServer.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/inc/CPcsServer.h Mon Jul 12 13:42:58 2010 +0100 @@ -58,6 +58,11 @@ */ CPcsPluginInterface* PluginInterface(); + /** + * Returns ETrue if there is Chinese variant feature in phone + */ + TBool IsChineseVariant() const; + private: /** @@ -80,6 +85,11 @@ * A PCS algorithm instance (owned) */ CPcsPluginInterface* iPcs; + + /** + * Flag for whether there is Chinese in phone + */ + TBool iIsChineseVariant; }; #endif // End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/inc/CPcsSession.h --- a/predictivesearch/PcsServer/inc/CPcsSession.h Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/inc/CPcsSession.h Mon Jul 12 13:42:58 2010 +0100 @@ -107,13 +107,17 @@ /** * Service method to get sort order of data fields */ - void GetSortOrderL(const RMessage2& aMessage); + void GetSortOrderL(const RMessage2& aMessage); /** * Service method to get sort order of data fields */ - void ChangeSortOrderL(const RMessage2& aMessage); + void ChangeSortOrderL(const RMessage2& aMessage); + /** + * Service method to get Adaptive Grid + */ + void GetAdaptiveGridL(const RMessage2& aMessage); /** * Service method to shutdown the server diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/src/CPcsPluginInterface.cpp --- a/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -205,7 +205,7 @@ for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ ) { iPcsPluginInstances[idx]->SearchInputL( aSearchQuery, - aSearchData, + aSearchData, aMatchSet, aMatchLocation ); } @@ -217,9 +217,9 @@ // CPcsPluginInterface::SearchMatchStringL // Search // ---------------------------------------------------------------------------- -void CPcsPluginInterface::SearchMatchStringL(CPsQuery& aSearchQuery, - TDesC& aSearchData, - TDes& aMatch ) +void CPcsPluginInterface::SearchMatchStringL( CPsQuery& aSearchQuery, + TDesC& aSearchData, + TDes& aMatch ) { PRINT ( _L("Enter CPcsPluginInterface::SearchMatchStringL") ); @@ -268,4 +268,25 @@ { return(iPcsPluginInstances[0]->ChangeSortOrderL(aURI, aSortOrder)); } + +// ---------------------------------------------------------------------------- +// CPcsPluginInterface::GetAdaptiveGridL +// Adaptive Grid +// ---------------------------------------------------------------------------- +void CPcsPluginInterface::GetAdaptiveGridL( const MDesCArray& aURIs, + const TBool aCompanyName, + TDes& aAdaptiveGrid ) +{ + PRINT ( _L("Enter CPcsPluginInterface::GetAdaptiveGridL ") ); + + for ( TInt idx = 0; idx < iPcsPluginInstances.Count(); idx++ ) + { + iPcsPluginInstances[idx]->GetAdaptiveGridL( aURIs, + aCompanyName, + aAdaptiveGrid ); + } + + PRINT ( _L("End CPcsPluginInterface::GetAdaptiveGridL") ); +} + // End of file diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/src/CPcsServer.cpp --- a/predictivesearch/PcsServer/src/CPcsServer.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/src/CPcsServer.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -70,11 +70,11 @@ iPcs = CPcsPluginInterface::NewL(); // Check if the phone is chinese feature id installed - TBool isChineseVariant = IsChineseFeatureInitilizedL(); + iIsChineseVariant = IsChineseFeatureInitilizedL(); // Create the plugin for the required algorithm // Matches the ECOM Plugin's display name definition in rss file // Check for the chinese feature id flag. - if(isChineseVariant) + if(iIsChineseVariant) { // Chinese variant phones. Use Algorithm 2 PRINT ( _L("Enter CPcsServer::ConstructL() - Chinese Variant Phone Algorithm Instantiated") ); @@ -151,3 +151,12 @@ return chineseFeatureInitialized; } + +// ---------------------------------------------------------------------------- +// CPcsServer::IsChineseVariant() const +// Returns ETrue if there is Chinese variant feature in phone +// ---------------------------------------------------------------------------- +TBool CPcsServer::IsChineseVariant() const + { + return iIsChineseVariant; + } diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServer/src/CPcsSession.cpp --- a/predictivesearch/PcsServer/src/CPcsSession.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServer/src/CPcsSession.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -168,6 +168,11 @@ ChangeSortOrderL(aMessage); break; + case EGetAdaptiveGrid: + PRINT ( _L("Received function EGetAdaptiveGrid") ); + GetAdaptiveGridL(aMessage); + break; + case EShutdown: PRINT ( _L("Received function EShutdown") ); ShutdownServerL(aMessage); @@ -246,13 +251,23 @@ // ------------------------------------------------------------- - RPointerArray searchResults; - RPointerArray searchSeqs; + RPointerArray searchResults; + RPointerArray searchSeqs; + - iServer->PluginInterface()->PerformSearchL(*iSettings, - *psQuery, - searchResults, - searchSeqs); + if( !iServer->IsChineseVariant() ) + { + PRINT ( _L("----Algorithm1 search----") ); + iServer->PluginInterface()->PerformSearchL(*iSettings, + *psQuery, + searchResults, + searchSeqs); + } + else + { + PRINT ( _L("----Algorithm2 fake search----") ); + } + CleanupStack::PopAndDestroy( psQuery ); // Dynamic data buffer @@ -330,11 +345,9 @@ iDes = NULL; } - PRINT ( _L("End CPcsSession::GetAsyncPcsResultsL") ); __LATENCY_MARKEND ( _L("CPcsSession::GetAsyncPcsResultsL") ); - } // ---------------------------------------------------------------------------- @@ -380,11 +393,18 @@ // To hold matched location RArray sequenceLoc; - iServer->PluginInterface()->SearchInputL(*psQuery, - *data, - searchSeqs, - sequenceLoc); - + if( !iServer->IsChineseVariant() ) + { + PRINT ( _L("----Algorithm1 searchinput----") ); + iServer->PluginInterface()->SearchInputL(*psQuery, + *data, + searchSeqs, + sequenceLoc); + } + else + { + PRINT ( _L("----Algorithm2 fake searchinput----") ); + } // Delete the search query and search data CleanupStack::PopAndDestroy( data ); @@ -449,7 +469,6 @@ PRINT ( _L("End CPcsSession::SearchInputL") ); __LATENCY_MARKEND ( _L("CPcsSession::SearchInputL") ); - } // ---------------------------------------------------------------------------- @@ -487,7 +506,7 @@ // Data to be searched // Read data size TUint16 szData = searchDataStream.ReadUint16L(); - HBufC* data = HBufC::NewL(searchDataStream, szData); + HBufC* data = HBufC::NewL(searchDataStream, szData); // searchQueryStream, searchQuery CleanupStack::PopAndDestroy(2, searchData); @@ -495,10 +514,7 @@ // ------------------------------------------------------------- - iServer->PluginInterface()->SearchMatchStringL(*psQuery, - *data, - ptr); - + iServer->PluginInterface()->SearchMatchStringL( *psQuery, *data, ptr ); // Delete the search query and search data CleanupStack::PopAndDestroy( data ); @@ -510,7 +526,6 @@ PRINT ( _L("End CPcsSession::SearchMatchStringL") ); __LATENCY_MARKEND ( _L("CPcsSession::SearchMatchStringL") ); - } // ---------------------------------------------------------------------------- @@ -594,8 +609,6 @@ // URI HBufC* uri = HBufC::NewLC(stream, uriSize); - - // -------------------------------------------------------------- // Get the data order @@ -762,6 +775,71 @@ } // ---------------------------------------------------------------------------- +// CPcsSession::GetAdaptiveGridL +// +// ---------------------------------------------------------------------------- +void CPcsSession::GetAdaptiveGridL(const RMessage2& aMessage) +{ + PRINT ( _L("Enter CPcsSession::GetAdaptiveGridL") ); + __LATENCY_MARK ( _L("CPcsSession::GetAdaptiveGridL") ); + + // Create the result output buffer + HBufC* outBuf = HBufC::NewLC( KBufferMaxLen ); + TPtr outBufPtr( outBuf->Des() ); + + // ------- Read the Data Stores from the message ------- + + // Read URIs from the message + HBufC8* buffer = HBufC8::NewLC(KBufferMaxLen); + + TPtr8 bufferPtr(buffer->Des()); + aMessage.ReadL(0, bufferPtr); + + // Stream over the buffer + RDesReadStream stream(bufferPtr); + stream.PushL(); + + // Number of URIs + TUint16 uriCount = stream.ReadUint16L(); + + CDesCArrayFlat* dataStores = NULL; + dataStores = new (ELeave) CDesCArrayFlat( uriCount ); + CleanupStack::PushL( dataStores ); + + for (TUint i = 0; i < uriCount; i++ ) + { + // Size of URI + TUint16 uriSize = stream.ReadUint16L(); + + // URI + HBufC* uri = HBufC::NewLC( stream, uriSize ); + dataStores->AppendL( *uri ); + CleanupStack::PopAndDestroy( uri ); + } + + // ----------------------------------------------------- + + // Read the Company Name from the message + TBool companyName = aMessage.Int1(); + + // Get the Adaptive Grid + iServer->PluginInterface()->GetAdaptiveGridL( *dataStores, companyName, outBufPtr ); + + // Write the Adaptive Grid to the message + aMessage.Write( 2, *outBuf ); + aMessage.Complete( KErrNone ); + + // Cleanup + CleanupStack::PopAndDestroy( dataStores ); + CleanupStack::PopAndDestroy( &stream ); + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( outBuf ); + + PRINT ( _L("End CPcsSession::GetAdaptiveGridL") ); + __LATENCY_MARKEND ( _L("CPcsSession::GetAdaptiveGridL") ); +} + +// ---------------------------------------------------------------------------- // CPcsSession::ShutdownServerL // // ---------------------------------------------------------------------------- @@ -781,7 +859,15 @@ // ---------------------------------------------------------------------------- CPsQuery* CPcsSession::ReadQueryLC( TInt aParam, const RMessage2& aMessage ) { + PRINT( _L("Enter CPcsSession::ReadQueryLC") ); TInt size = aMessage.GetDesLength( aParam ); + + if(size < 0) + { + PRINT ( _L("DesLength <0, Leave from CPcsSession::ReadQueryLC")); + User::Leave(KErrArgument); + } + HBufC8* tempBuf = HBufC8::NewLC( size ); TPtr8 ptr( tempBuf->Des() ); @@ -801,6 +887,7 @@ CleanupStack::PopAndDestroy( &stream ); CleanupStack::PopAndDestroy( tempBuf ); CleanupStack::PushL( psQuery ); - + + PRINT ( _L("End CPcsSession::ReadQueryLC") ); return psQuery; } diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def --- a/predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def Mon Jul 12 13:42:58 2010 +0100 @@ -18,4 +18,5 @@ ?Version@CPSRequestHandler@@QBE?AVTVersion@@XZ @ 17 NONAME ; class TVersion CPSRequestHandler::Version(void) const ?CancelSearch@CPSRequestHandler@@QAEXXZ @ 18 NONAME ; void CPSRequestHandler::CancelSearch(void) ?LookupMatchL@CPSRequestHandler@@QAEXABVCPsQuery@@ABVTDesC16@@AAVTDes16@@@Z @ 19 NONAME ; void CPSRequestHandler::LookupMatchL(class CPsQuery const &, class TDesC16 const &, class TDes16 &) + ?GetAdaptiveGridCharactersL@CPSRequestHandler@@QAEXABVMDesC16Array@@ABVTDesC16@@HAAVTDes16@@@Z @ 20 NONAME ; void CPSRequestHandler::GetAdaptiveGridCharactersL(class MDesC16Array const &, class TDesC16 const &, int, class TDes16 &) diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def --- a/predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def Mon Jul 12 13:42:58 2010 +0100 @@ -22,4 +22,7 @@ _ZTV18CPsPropertyHandler @ 21 NONAME ; ## _ZN17CPSRequestHandler12CancelSearchEv @ 22 NONAME _ZN17CPSRequestHandler12LookupMatchLERK8CPsQueryRK7TDesC16R6TDes16 @ 23 NONAME + _ZN17CPSRequestHandler26GetAdaptiveGridCharactersLERK12MDesC16ArrayRK7TDesC16iR6TDes16 @ 24 NONAME + _ZTI16CPsUpdateHandler @ 25 NONAME + _ZTV16CPsUpdateHandler @ 26 NONAME diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp --- a/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -383,9 +383,9 @@ // CPSRequestHandler::LookupMatchL() // Sends a request to the predictive search engine to perform a search. // ----------------------------------------------------------------------------- -EXPORT_C void CPSRequestHandler::LookupMatchL(const CPsQuery& aSearchQuery, - const TDesC& aSearchData, - TDes& aMatch ) +EXPORT_C void CPSRequestHandler::LookupMatchL( const CPsQuery& aSearchQuery, + const TDesC& aSearchData, + TDes& aMatch ) { PRINT ( _L("Enter CPSRequestHandler::LookupMatchL") ); @@ -545,7 +545,7 @@ if ( searchResults[i]->Data(j) ) { PRINT3 ( _L("CPSRequestHandler::HandleSearchResultsL: Results[%d,%d] = %S"), - i, j, &searchResults[i]->Data(j)->Des() ); + i, j, &*(searchResults[i]->Data(j)) ); } } } @@ -1262,4 +1262,82 @@ } } +// ----------------------------------------------------------------------------- +// CPSRequestHandler::GetAdaptiveGridCharactersL() +// +// ----------------------------------------------------------------------------- +EXPORT_C void CPSRequestHandler::GetAdaptiveGridCharactersL( const MDesCArray& aDataStores, + const TDesC& aSearchText, + const TBool aCompanyName, + TDes& aAdaptiveGrid ) + { + /* + * aSearchText is unused in the current implementation. + * If/when this API method will support grids at bigger level it will be used. + * Grids at bigger level can be kept in a multilevel Adaptive Grid cache, or could + * be calculated inside PCS Engine. There are two implementation choices. + */ + + PRINT ( _L("Enter CPSRequestHandler::GetAdaptiveGridCharactersL") ); + + if ( aSearchText.Length() > KPsAdaptiveGridSupportedMaxLen ) + { + PRINT1 ( _L("CPSRequestHandler::GetAdaptiveGridCharactersL: Too many chars in search text, Max supported is %d"), + KPsAdaptiveGridSupportedMaxLen ); + } + else + { + // -------------------- Data Stores -------------------- + + // Temp buffer + CBufFlat* dataBuffer = CBufFlat::NewL( KBufferMaxLen ); + CleanupStack::PushL( dataBuffer ); + + // Stream over the temp buffer + RBufWriteStream dataStream( *dataBuffer ); + dataStream.PushL(); + + // Write the URI count in the stream + TInt dataStoresCount = aDataStores.MdcaCount(); + dataStream.WriteUint16L( dataStoresCount ); + + for ( TUint i=0; i < dataStoresCount; i++ ) + { + // Write the URI details in the stream + TPtrC16 uri = aDataStores.MdcaPoint(i); + dataStream.WriteUint16L( uri.Length() ); + dataStream << uri; + } + + // Create a HBufC8 for IPC + HBufC8* storesDataBuffer = HBufC8::NewL( dataBuffer->Size() ); + TPtr8 storesDataBufferPtr( storesDataBuffer->Des() ); + dataBuffer->Read( 0, storesDataBufferPtr, dataBuffer->Size() ); + + CleanupStack::PopAndDestroy( 2, dataBuffer ); // dataBuffer, dataStream + CleanupStack::PushL( storesDataBuffer ); + + // ----------------------------------------------------- + + iSession.GetAdaptiveGridL( storesDataBuffer->Des(), aCompanyName, aAdaptiveGrid ); + + // Cleanup + CleanupStack::PopAndDestroy(storesDataBuffer); + } + +#ifdef _DEBUG + for ( TUint i=0; i < aDataStores.MdcaCount(); i++ ) + { + TPtrC16 ptr = aDataStores.MdcaPoint(i); + PRINT2 ( _L("CPSRequestHandler::GetAdaptiveGridCharactersL: Data Store [%d]: %S"), + i, &ptr ); + } + PRINT1 ( _L("CPSRequestHandler::GetAdaptiveGridCharactersL: Search Text: %S"), &aSearchText ); + PRINT1 ( _L("CPSRequestHandler::GetAdaptiveGridCharactersL: Company Name: %d"), aCompanyName ); + PRINT1 ( _L("CPSRequestHandler::GetAdaptiveGridCharactersL: Grid: %S"), &aAdaptiveGrid ); +#endif // _DEBUG + + PRINT ( _L("End CPSRequestHandler::GetAdaptiveGridCharactersL") ); + } + // End of File diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsServerClientAPI/src/RPsSession.cpp --- a/predictivesearch/PcsServerClientAPI/src/RPsSession.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsServerClientAPI/src/RPsSession.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -11,7 +11,7 @@ * * Contributors: * -* Description: This is the PS server client side interface implementation. +* Description: This is the PS server client side interface implementation. * */ @@ -28,7 +28,7 @@ TInt StartServer() { PRINT ( _L("Enter RPsSession->StartServer") ); - + RProcess server; server.Create ( KPcsServerExeName, KNullDesC ); @@ -41,13 +41,13 @@ server.Close(); return KErrGeneral; } - else + else { server.Resume(); } User::WaitForRequest(status); - + if ( status != KErrNone ) { server.Close(); @@ -64,23 +64,23 @@ // RPsSession::RPsSession // Constructor // ---------------------------------------------------------------------------- -RPsSession::RPsSession() : RSessionBase(), +RPsSession::RPsSession() : RSessionBase(), iSearchQueryBufferPtr (0, 0), iResultsBufferPtr (0, 0) { - PRINT ( _L("Enter RPsSession::RPsSession") ); + PRINT ( _L("Enter RPsSession::RPsSession") ); PRINT ( _L("End RPsSession::RPsSession") ); } // ---------------------------------------------------------------------------- // RPsSession::Connects to the search server -// Returns the version number +// Returns the version number // ---------------------------------------------------------------------------- TInt RPsSession::Connect() { PRINT ( _L("Enter RPsSession::Connect") ); - + TInt err = CreateSession( KPcsServerName, Version() ); if ( err != KErrNone ) { @@ -107,13 +107,13 @@ } PRINT ( _L("End RPsSession::Connect") ); - + return err; } // ---------------------------------------------------------------------------- // RPsSession::Version -// Returns the version number +// Returns the version number // ---------------------------------------------------------------------------- TVersion RPsSession::Version() const { @@ -129,16 +129,16 @@ void RPsSession::SetSearchSettingsL(const TDes8& aSettings) { PRINT ( _L("Enter RPsSession::SetSearchSettingsL") ); - + TIpcArgs args(&aSettings); // Send the search settings to the server. sync call TRequestStatus status; - SendReceive(ESearchSettings, + SendReceive(ESearchSettings, args, status); - User::WaitForRequest(status); - + User::WaitForRequest(status); + PRINT ( _L("End RPsSession::SetSearchSettingsL") ); } @@ -154,18 +154,18 @@ // Hold the pointer to buffers till the async request is complete iSearchQueryBufferPtr.Set(aSearchQuery); - iResultsBufferPtr.Set(aResultsBuffer); + iResultsBufferPtr.Set(aResultsBuffer); TIpcArgs args(&iSearchQueryBufferPtr, &iResultsBufferPtr); aStatus = KRequestPending; // Initiate the search request - SendReceive(ESearch, - args, + SendReceive(ESearch, + args, aStatus ); - - PRINT ( _L("End RPsSession::SearchL") ); + + PRINT ( _L("End RPsSession::SearchL") ); } // ---------------------------------------------------------------------------- @@ -175,16 +175,16 @@ void RPsSession::CancelSearch() { PRINT ( _L("Enter RPsSession::CancelSearch") ); - + TRequestStatus status; - - SendReceive(ECancelSearch, - TIpcArgs(), + + SendReceive(ECancelSearch, + TIpcArgs(), status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::CancelSearch") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::CancelSearch") ); } // ---------------------------------------------------------------------------- @@ -195,20 +195,20 @@ const TDes8& aSearchData, TPtr8 aResultsBuffer) { - PRINT ( _L("Enter RPsSession::SearchL") ); + PRINT ( _L("Enter RPsSession::SearchL") ); TIpcArgs args(&aSearchQuery, &aSearchData, &aResultsBuffer); TRequestStatus status; // Initiate the search request - SendReceive(ESearchInput, - args, + SendReceive(ESearchInput, + args, status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::SearchL") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::SearchL") ); } // ---------------------------------------------------------------------------- @@ -219,20 +219,20 @@ const TDes8& aSearchData, TDes& aResultsBuffer) { - PRINT ( _L("Enter RPsSession::SearchMatchStringL") ); + PRINT ( _L("Enter RPsSession::SearchMatchStringL") ); TIpcArgs args(&aSearchQuery, &aSearchData, &aResultsBuffer); TRequestStatus status; // Initiate the search request - SendReceive(ESearchMatchString, - args, + SendReceive(ESearchMatchString, + args, status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::SearchMatchStringL") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::SearchMatchStringL") ); } // ---------------------------------------------------------------------------- @@ -244,25 +244,25 @@ { PRINT ( _L("Enter RPsSession::SendNewBufferL") ); - iResultsBufferPtr.Set(aResultsBuffer); - + iResultsBufferPtr.Set(aResultsBuffer); + aStatus = KRequestPending; // Search command is reused here. Hence there is no need to fill // the search query. - TIpcArgs args(TIpcArgs::ENothing, + TIpcArgs args(TIpcArgs::ENothing, &iResultsBufferPtr); - SendReceive(ESearch, - args, - aStatus); - - PRINT ( _L("Enter RPsSession::SendNewBufferL") ); + SendReceive(ESearch, + args, + aStatus); + + PRINT ( _L("Enter RPsSession::SendNewBufferL") ); } // ----------------------------------------------------------------------------- // RPsSession::IsLanguageSupportedL() -// Checks if the language variant is supported by +// Checks if the language variant is supported by // the predictive search engine. // Synchronous // ----------------------------------------------------------------------------- @@ -270,17 +270,17 @@ TPtr8 aResultsBuffer) { PRINT ( _L("Enter RPsSession::IsLanguageSupportedL") ); - + TIpcArgs args(&aLanguage, &aResultsBuffer); TRequestStatus status; // initiate the request - SendReceive(ELangSupport, + SendReceive(ELangSupport, args, status); - + User::WaitForRequest(status); - + PRINT ( _L("End RPsSession::IsLanguageSupportedL") ); } @@ -298,13 +298,13 @@ TRequestStatus status; // Initiate the request - SendReceive(EGetDataOrder, - args, + SendReceive(EGetDataOrder, + args, status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::GetDataOrderL") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::GetDataOrderL") ); } // ---------------------------------------------------------------------------- @@ -321,13 +321,13 @@ TRequestStatus status; // Initiate the request - SendReceive(EGetSortOrder, - args, + SendReceive(EGetSortOrder, + args, status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::GetSortOrderL") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::GetSortOrderL") ); } // ---------------------------------------------------------------------------- @@ -343,13 +343,37 @@ TRequestStatus status; // Initiate the request - SendReceive(ESetSortOrder, - args, + SendReceive(ESetSortOrder, + args, status ); - - User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::ChangeSortOrderL") ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::ChangeSortOrderL") ); +} + +// ---------------------------------------------------------------------------- +// RPsSession::GetAdaptiveGridL +// Initiate the Adaptive Grid request. +// ---------------------------------------------------------------------------- +void RPsSession::GetAdaptiveGridL( const TDesC8& aURIs, + const TBool aCompanyName, + TDes& aResultsBuffer ) +{ + PRINT ( _L("Enter RPsSession::GetAdaptiveGrid") ); + + TIpcArgs args( &aURIs, aCompanyName, &aResultsBuffer ); + + TRequestStatus status; + + // Initiate the Adaptive Grid request + SendReceive( EGetAdaptiveGrid, + args, + status ); + + User::WaitForRequest(status); + + PRINT ( _L("End RPsSession::GetAdaptiveGrid") ); } // ---------------------------------------------------------------------------- @@ -359,14 +383,14 @@ void RPsSession::ShutdownServerL() { PRINT ( _L("Enter RPsSession::ShutdownServerL") ); - + TIpcArgs args; - + TRequestStatus status; SendReceive(EShutdown, args, status ); User::WaitForRequest(status); - - PRINT ( _L("End RPsSession::ShutdownServerL") ); + + PRINT ( _L("End RPsSession::ShutdownServerL") ); } // End of File diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsUtils/src/CPcsDebug.cpp --- a/predictivesearch/PcsUtils/src/CPcsDebug.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsUtils/src/CPcsDebug.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -239,7 +239,8 @@ { for ( TInt i = 0; i < aMatchSet.Count(); i++ ) { - PRINT4 ( _L("%SMatchSet[%d]=%S, Length=%d"), &aPreTxt, i, &aMatchSet[i], aMatchSet[i].Length() ); + TPtrC16 ptr = aMatchSet.MdcaPoint(i); + PRINT4 ( _L("%SMatchSet[%d]=%S, Length=%d"), &aPreTxt, i, &ptr, aMatchSet[i].Length() ); } } diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsUtils/src/CPsQuery.cpp --- a/predictivesearch/PcsUtils/src/CPsQuery.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsUtils/src/CPsQuery.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -94,7 +94,7 @@ // ---------------------------------------------------------------------------- EXPORT_C CPsQueryItem& CPsQuery:: GetItemAtL(TInt aIndex) { - if ( aIndex < 0 && aIndex >= iSearchQuery.Count()) + if ( aIndex < 0 || aIndex >= iSearchQuery.Count()) { User::Leave(KErrArgument); } diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/PcsUtils/src/CPsSettings.cpp --- a/predictivesearch/PcsUtils/src/CPsSettings.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/PcsUtils/src/CPsSettings.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -36,7 +36,6 @@ self->ConstructL(); CleanupStack::Pop(); return self; - } // ---------------------------------------------------------------------------- @@ -71,7 +70,7 @@ self->SetSortType(iSortType); // Copy the search uris - RPointerArray newUris; + RPointerArray newUris; for(TInt i =0; i < iSearchUri.Count() ; i++) { @@ -108,10 +107,9 @@ iSearchUri.ResetAndDestroy(); for(TInt i =0 ; i < aSearchUri.Count();i++) { - const HBufC* uriToAppend =aSearchUri[i]->AllocL(); + const HBufC* uriToAppend = aSearchUri[i]->AllocL(); iSearchUri.Append(uriToAppend); } - } // ---------------------------------------------------------------------------- @@ -125,7 +123,6 @@ { iDisplayFields.Append(aDisplayFields[i]); } - } // ---------------------------------------------------------------------------- @@ -152,6 +149,7 @@ { iSortType = aSortType; } + // CPsSettings::SearchUrisL // Returns the list of URIs configured to search from. // ---------------------------------------------------------------------------- @@ -175,7 +173,6 @@ { aDisplayFields.Append(iDisplayFields[i]); } - } // ---------------------------------------------------------------------------- @@ -186,6 +183,7 @@ { return iMaxResults; } + // ---------------------------------------------------------------------------- // CPsSettings::GetSortType // Returns the sort type based on which results will be sorted. @@ -232,7 +230,6 @@ // Cleanup memory delete grpIdBuf; grpIdBuf = NULL; - } } } @@ -287,8 +284,7 @@ TUint8 szUri = aStream.ReadUint8L(); HBufC* uri = HBufC::NewL(aStream, szUri); - iSearchUri.InsertL(uri, index); - + iSearchUri.InsertL(uri, index); } // Read number of display fields @@ -301,6 +297,4 @@ // Read Number of contacts that will be displayed to the client iMaxResults = aStream.ReadInt16L(); iSortType = (TSortType)aStream.ReadInt8L(); - } - diff -r 35018d46c3dc -r 22a79a0cd291 predictivesearch/adapters/contacts/src/cpcscontactstore.cpp --- a/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp Fri May 28 13:07:31 2010 +0100 +++ b/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp Mon Jul 12 13:42:58 2010 +0100 @@ -332,8 +332,12 @@ iNextState = EFetchContactBlock; // Delay the next fetch since contact fetch is CPU intensive, // this will give other threads a chance to use CPU - iTimer.After( iStatus, KTimerInterval); // 100 milliseconds - SetActive(); + if(!IsActive()) + { + iTimer.After( iStatus, KTimerInterval); // 100 milliseconds + SetActive(); + } + } } @@ -361,8 +365,11 @@ iNextState = EFetchContactBlock; // Delay the next fetch since contact fetch is CPU intensive, // this will give other threads a chance to use CPU - iTimer.After( iStatus, KTimerInterval); // 100 milliseconds - SetActive(); + if(!IsActive()) + { + iTimer.After( iStatus, KTimerInterval); // 100 milliseconds + SetActive(); + } } PRINT ( _L("End CPcsContactStore::VPbkSingleContactOperationFailed") );