# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1276064787 -10800 # Node ID a6539d1e8e433b03fc33fefcef479f50d4259454 # Parent 4ae315f230bcdbe36f183c9311080bfd80aa178e Revision: 201021 Kit: 2010123 diff -r 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp --- a/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsserver.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Wed Jun 09 09:26:27 2010 +0300 @@ -476,6 +476,8 @@ /// Used to save Retrieve Contact operation. Owned. MVPbkContactOperationBase* iOperation; + /// Cached VoIP features + TInt iVoipFeatures; }; #endif //__CMSSERVERCONTACT__ diff -r 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserver.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/group/bld.inf --- a/ccservices/cmsservices/cmsengine/group/bld.inf Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/group/bld.inf Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/rom/CmsEngine.iby --- a/ccservices/cmsservices/cmsengine/rom/CmsEngine.iby Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/cmsengine/rom/CmsEngine.iby Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/sis/cmsengine_stub.pkg --- a/ccservices/cmsservices/cmsengine/sis/cmsengine_stub.pkg Tue May 25 12:26:45 2010 +0300 +++ /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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/sis/cmsengine_stub.sis Binary file ccservices/cmsservices/cmsengine/sis/cmsengine_stub.sis has changed diff -r 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/cmsengine/sis/cmsengine_urel.pkg --- a/ccservices/cmsservices/cmsengine/sis/cmsengine_urel.pkg Tue May 25 12:26:45 2010 +0300 +++ /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 4ae315f230bc -r a6539d1e8e43 ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp --- a/ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp Tue May 25 12:26:45 2010 +0300 +++ b/ccservices/cmsservices/contactpresence/src/presenceiconinfo.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/phonebook_2_common_ui_api/group/bld.inf --- a/contacts_plat/phonebook_2_common_ui_api/group/bld.inf Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/phonebook_2_common_ui_api/group/bld.inf Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h --- a/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/phonebook_2_common_ui_api/inc/CPbk2TabGroupContainer.h Wed Jun 09 09:26:27 2010 +0300 @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include // FORWARD DECLARATIONS diff -r 4ae315f230bc -r a6539d1e8e43 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 Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h --- a/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/phonebook_2_ui_extension_plugin_api/inc/CPbk2UIExtensionPlugin.h Wed Jun 09 09:26:27 2010 +0300 @@ -22,7 +22,7 @@ // INCLUDE FILES #include #include -#include +#include // FORWARD DECLARATIONS class CPbk2UIExtensionView; diff -r 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h --- a/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_algorithm_api/inc/CPcsPlugin.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h --- a/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/inc/CPsRequestHandler.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/inc/RPsSession.h --- a/contacts_plat/predictivesearch_client_api/inc/RPsSession.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/inc/RPsSession.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/conf/PsClientTestSuite.cfg Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/PsClientTestSuite.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/TestSuiteInputData.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/psclienttestsuitedefs.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestcontactshandler.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/inc/pstestqueryhandler.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuite.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/TestSuiteInputData.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestcontactshandler.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp --- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/pstestqueryhandler.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -529,4 +529,5 @@ TInt comparison(data1.CompareC( data2, 3, &meth )); return comparison; } + // End of file diff -r 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h --- a/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_utils_api/inc/CPcsDefs.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuite.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/PsUtilsTestSuiteBlocks.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp --- a/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/predictivesearch_utils_api/tsrc/PsUtilsTestSuite/src/TestSuiteInputData.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h --- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkTopContactManager.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 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 Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/conf/T_VPbkVCardApi.cfg Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 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 Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/group/T_VPbkVCardApi.pkg Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 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 Tue May 25 12:26:45 2010 +0300 +++ b/contacts_plat/virtual_phonebook_vcard_api/tsrc/T_VPbkVCardApi/init/T_VPbkVCardApi.ini Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF --- a/phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/BWINS/VPbkEngU.DEF Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF --- a/phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/EABI/VPbkEngU.DEF Wed Jun 09 09:26:27 2010 +0300 @@ -291,4 +291,5 @@ _ZN28VPbkFieldTypeSelectorFactory27CreateActionTypeSelectorIdLEi @ 290 NONAME _ZNK22CVPbkFieldTypeSelector21AddressFieldsIncludedERK32MVPbkStoreContactFieldCollection @ 291 NONAME _ZN19CVPbkContactManager5FindLERK12MDesC16ArrayRK18MVPbkFieldTypeListR34MVPbkContactFindFromStoresObserverRK9TCallBackRK16CDesC16ArrayFlat @ 292 NONAME + _ZN22CVPbkTopContactManager4NewLER19CVPbkContactManagerR20MVPbkContactViewBase @ 293 NONAME diff -r 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h --- a/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactManagerImpl.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h --- a/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/inc/CVPbkTopContactOperation.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManager.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactManagerImpl.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkTopContactOperation.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp --- a/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkVCardEng/src/CVPbkImportToStoreOperation.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp --- a/phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/contactsmodel/cntplsql/src/cpplcommaddrtable.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp --- a/phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookengines/contactsmodel/cntsrv/src/CCntStateMachine.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -973,7 +973,8 @@ */ void CStateOpening::InitialStep() { - iActive->Register(*this, ETrue); + //iActive->Register(*this, ETrue); + iActive->Register( *this ); } /** diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp --- a/phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/Application/src/CPbk2AppUi.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def --- a/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/BWINS/pbk2spbcontentprovideru.def Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def --- a/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/EABI/pbk2spbcontentprovideru.def Wed Jun 09 09:26:27 2010 +0300 @@ -20,4 +20,5 @@ _ZTI20CSpbContactDataModel @ 19 NONAME _ZTV20CSpbContactDataModel @ 20 NONAME _ZN19CSpbContentProvider13CleanContentLER17MVPbkContactStore @ 21 NONAME + _ZN20CSpbContactDataModel9ListIndexEi @ 22 NONAME diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2DelayedWaitNote.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2DelayedWaitNote.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h --- a/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxAddToTopContactsCmd.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h --- a/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/inc/CPbk2NlxRemoveFromTopContactsCmd.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/src/CPbk2DelayedWaitNote.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2DelayedWaitNote.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxAddToTopContactsCmd.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/src/CPbk2NlxRemoveFromTopContactsCmd.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListExView.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h --- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Wed Jun 09 09:26:27 2010 +0300 @@ -22,7 +22,7 @@ // INCLUDES #include #include -#include "CPbk2AdaptiveSearchGridWaiter.h" +#include // FORWARD DECLARATIONS class CAknSearchField; @@ -30,6 +30,7 @@ class CPbk2AdaptiveGrid; class MVPbkContactViewBase; class MPbk2ContactNameFormatter; +class CPSRequestHandler; // CLASS DECLARATION @@ -40,7 +41,7 @@ * search contacts from Phonebook 2. */ NONSHARABLE_CLASS(CPbk2AdaptiveSearchGridFiller) : public CActive, - public MPbk2SearchGridWaiterObserver + public MPsResultsObserver { public: // Constructors and destructor @@ -70,7 +71,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 +105,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 +136,7 @@ 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 ); private: // Data /// Own: Containts adaptive search grid. @@ -170,8 +178,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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h --- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridWaiter.h Tue May 25 12:26:45 2010 +0300 +++ /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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -21,12 +21,19 @@ #include "MVPbkViewContact.h" #include "MVPbkContactViewBase.h" #include "MPbk2ContactNameFormatter.h" +#include "MPbk2FilteredViewStack.h" +#include +#include +#include +#include #include #include #include #include +#include + const TInt KMaxAdaptiveGridCacheCount = 10; const TInt KAdaptiveSearchKeyMapGranularity = 100; const TInt KAdaptiveSearchRefineStep = 25; @@ -92,7 +99,11 @@ CPbk2AdaptiveSearchGridFiller::~CPbk2AdaptiveSearchGridFiller() { Cancel(); - delete iGridWaiter; + if ( iPsHandler ) + { + iPsHandler->RemoveObserver( this ); + delete iPsHandler; + } delete iKeyMap; delete iCurrentGrid; iAdaptiveGridCache.ResetAndDestroy(); @@ -125,20 +136,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 +192,11 @@ iCounter = 0; + if ( iSearchString->Length() <= KPsAdaptiveGridSupportedMaxLen && GridFromPsEngineL( aView ) ) + { + return; + } + SetActive(); TRequestStatus* status = &iStatus; User::RequestComplete( status, KErrNone ); @@ -176,6 +217,7 @@ TInt stopCount = iCounter + KAdaptiveSearchRefineStep; const TInt itemCount = iView->ContactCountL(); + if( stopCount > itemCount ) { stopCount = itemCount; @@ -341,7 +383,6 @@ void CPbk2AdaptiveSearchGridFiller::InvalidateAdaptiveSearchGrid() { iInvalidateAdaptiveSearchGrid = ETrue; - iGridWaiter->Start(); } void CPbk2AdaptiveSearchGridFiller::SetFocusToAdaptiveSearchGrid() @@ -404,11 +445,6 @@ iCurrentGrid = iKeyMap->Des().AllocL(); iSearchField.SetAdaptiveGridChars( *iKeyMap ); - - if( iInvalidateAdaptiveSearchGrid ) - { - iGridWaiter->Stop(); - } iInvalidateAdaptiveSearchGrid = EFalse; @@ -608,20 +644,110 @@ 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; + } } // End of File diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridWaiter.cpp Tue May 25 12:26:45 2010 +0300 +++ /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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2ContactEditorDlgImpl.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FieldListBoxModel.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsAssignDlg.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListFilteredState.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -1085,9 +1085,7 @@ return; } - iAdaptiveSearchGridFiller->StopFilling(); - iAdaptiveSearchGridFiller->ClearCache(); - iAdaptiveSearchGridFiller->StartFilling( iViewStack.BaseView(), FindTextL() ); + iAdaptiveSearchGridFiller->StartFillingL( iViewStack.BaseView(), FindTextL(), ETrue ); } // -------------------------------------------------------------------------- diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2NamesListReadyState.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2PhonebookInfoDlg.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp --- a/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/cpbk2contactviewdoublelistboxmodel.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h --- a/phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/USIMThinExtension/inc/CPsu2CopySimContactsCmd.h Wed Jun 09 09:26:27 2010 +0300 @@ -137,6 +137,7 @@ void CopyContactsL(); void ShowResultsL(); void CompleteL(); + void PublishOpenCompleteL(); void CompleteWithError( TInt aError ); TBool ValidStoreConfigurationL(); diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp --- a/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/CCCAppCommLauncherPbkCmd.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchermenuhandler.h Wed Jun 09 09:26:27 2010 +0300 @@ -222,7 +222,8 @@ /// Own: CCCAppCommLauncherPbkCmd CCCAppCommLauncherPbkCmd* iPbkCmd; - /// Own: CAknInputBlock + + /// Doesnt Own: CAknInputBlock. Ownership transferred thro SetCancelDelete Call. CAknInputBlock *iInputBlock; }; diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlauncherplugin.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/CCCAppCommLauncherPbkCmd.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -447,7 +447,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 +473,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 +550,7 @@ iHasBeenDragged = EFalse; } - CCAContactorService* contactorService = iPlugin.ContactorService(); - - if ( executeContactAction && contactorService && contactorService->IsBusy()) + if ( executeContactAction && iPlugin.CommandState().IsRunning() ) { executeContactAction = EFalse; } @@ -578,35 +574,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 + } } } diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercustomlistboxdata.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -1400,15 +1400,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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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, diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherplugin.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp --- a/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccadetailsviewplugin/src/ccappdetailsviewplugin.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/inc/ccappmycardcontainer.h Wed Jun 09 09:26:27 2010 +0300 @@ -268,6 +268,7 @@ void DoCheckExtensionFactoryL(); inline void ResolveNameOrderL(); + void LayoutControls(); private: // Data diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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,8 +444,6 @@ void CCCAppMyCardContainer::DoCheckExtensionFactoryL() { CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); - // if extension is not null and view launcher supports mycard view then - // show statuscontrol TBool visible = EFalse; if( extension ) { @@ -443,8 +451,8 @@ { iViewLauncher = extension->CreateViewLauncherL(); } - if( iViewLauncher && - iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) + if ( iControlLink // my card link has been set + && iViewLauncher->IsViewSupported( MCCAViewLauncher::EMyCardView ) ) { visible = ETrue; } @@ -459,6 +467,8 @@ if( statusControl ) { statusControl->MakeVisible( visible ); + LayoutControls(); + DrawDeferred(); } } @@ -531,9 +541,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 +585,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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -280,14 +280,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( diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h --- a/phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/inc/ccaappappui.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappappui.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappservice.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/src/ccaappview.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp --- a/phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/group/Pbk2NamesListExtension.mmp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/group/Pbk2UIControls.mmp --- a/phonebookui/Phonebook2/group/Pbk2UIControls.mmp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/group/Pbk2UIControls.mmp Wed Jun 09 09:26:27 2010 +0300 @@ -164,7 +164,6 @@ SOURCE cpbk2contactviewdoublelistboxmodel.cpp SOURCE pbk2contactviewdoublelistboxdataelement.cpp SOURCE cpbk2doublelistboxmodelcmddecorator.cpp -SOURCE CPbk2AdaptiveSearchGridWaiter.cpp // Resources LANGUAGE_IDS diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h --- a/phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/inc/CPbk2PhonebookInfoDlg.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/inc/spbcontactdatamodel.h --- a/phonebookui/Phonebook2/inc/spbcontactdatamodel.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/inc/spbcontactdatamodel.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/loc/phonebook2ece.loc --- a/phonebookui/Phonebook2/loc/phonebook2ece.loc Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/loc/phonebook2ece.loc Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss --- a/phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/data/engine.rss Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h --- a/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/spbcontentprovider/inc/spbcontactdatamodelprivate.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodel.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbcontactdatamodelprivate.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -180,6 +180,15 @@ return iListIndxToPresentationIndx[ aListIndex ]; } +// --------------------------------------------------------------------------- +// CSpbContactDataModelPrivate::ListIndex +// --------------------------------------------------------------------------- +// +TInt CSpbContactDataModelPrivate::ListIndex( TInt aPresentationIndex ) + { + return iListIndxToPresentationIndx.Find( aPresentationIndex ); + } + // -------------------------------------------------------------------------- // CSpbContactDataModelPrivate::ExternalizeL // -------------------------------------------------------------------------- diff -r 4ae315f230bc -r a6539d1e8e43 phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp --- a/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Speeddial/ControlSrc/SpdiaControl_platsec.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp --- a/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Speeddial/VPbkControlSrc/speeddialprivate.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 phonebookui/Speeddial/src/SpdiaContainer.cpp --- a/phonebookui/Speeddial/src/SpdiaContainer.cpp Tue May 25 12:26:45 2010 +0300 +++ b/phonebookui/Speeddial/src/SpdiaContainer.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp --- a/predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/group/PcsAlgorithm1.mmp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h Wed Jun 09 09:26:27 2010 +0300 @@ -0,0 +1,108 @@ +/* +* 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( ); + + private: + + /** + * Default Constructor + */ + CPcsAdaptiveGrid(); + + /** + * Array of Adaptive Grid characters with reference counters. + */ + RPointerArray iAdaptiveGrid; +}; + +#endif // __CPS_ADAPTIVE_GRID_H__ + +// End of file diff -r 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGridItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGridItem.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAlgorithm1Utils.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsCache.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -0,0 +1,207 @@ +/* +* 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: ----------------------------------------") ); +} + +// End of file diff -r 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGridItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGridItem.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAlgorithm1Utils.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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,9 @@ RPointerArray *keyMap = new (ELeave) RPointerArray(1); iKeyArr.InsertL(keyMap,i); } - + + // Adaptive Grid map + iAdaptiveGridMap = CPcsAdaptiveGrid::NewL( ); PRINT ( _L("End CPcsCache::ConstructL") ); } @@ -110,6 +113,8 @@ iIndexOrder.Reset(); iMasterPoolBackup.Close(); + delete iAdaptiveGridMap; + PRINT ( _L("End CPcsCache::~CPcsCache") ); } @@ -155,27 +160,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 +209,18 @@ 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 + + // 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 +271,9 @@ CleanupStack::PopAndDestroy( &poolIds ); - } // for 1 loop - - CleanupStack::PopAndDestroy( &elementHash ); + } // for 1 loop + + CleanupStack::PopAndDestroy( &elementHash ); } // --------------------------------------------------------------------- @@ -303,30 +323,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 +359,43 @@ } } + if ( 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 +412,34 @@ { 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(); + + delete iAdaptiveGridMap; + iAdaptiveGridMap = NULL; PRINT ( _L("End CPcsCache::RemoveAllFromCache") ); } // --------------------------------------------------------------------- +// CPcsCache::GetAdaptiveGridL +// +// --------------------------------------------------------------------- +void CPcsCache::GetAdaptiveGridL( const TBool aCompanyName, TDes& aAdaptiveGrid ) +{ + PRINT ( _L("Enter CPcsCache::GetAdaptiveGridL") ); + + iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); + + PRINT ( _L("End CPcsCache::GetAdaptiveGridL") ); +} + +// --------------------------------------------------------------------- // CPcsCache::SetPoolMap // // --------------------------------------------------------------------- @@ -559,19 +637,21 @@ // --------------------------------------------------------------------- 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 + + // Now add data again from the iMasterPoolBackup for (TInt i = 0; i < iMasterPoolBackup.Count(); i++ ) { CPsData* temp = iMasterPoolBackup[i]; @@ -580,4 +660,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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h --- a/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/inc/CPcsAlgorithm2.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm2/src/CPcsAlgorithm2.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServer/group/PcsServer.mmp --- a/predictivesearch/PcsServer/group/PcsServer.mmp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServer/group/PcsServer.mmp Wed Jun 09 09:26:27 2010 +0300 @@ -40,6 +40,7 @@ LIBRARY euser.lib LIBRARY estor.lib LIBRARY flogger.lib +LIBRARY bafl.lib LIBRARY ecom.lib LIBRARY PcsUtils.lib LIBRARY FeatMgr.lib diff -r 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServer/inc/CPcsPluginInterface.h --- a/predictivesearch/PcsServer/inc/CPcsPluginInterface.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServer/inc/CPcsPluginInterface.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServer/inc/CPcsSession.h --- a/predictivesearch/PcsServer/inc/CPcsSession.h Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServer/inc/CPcsSession.h Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServer/src/CPcsPluginInterface.cpp --- a/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServer/src/CPcsPluginInterface.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServer/src/CPcsSession.cpp --- a/predictivesearch/PcsServer/src/CPcsSession.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServer/src/CPcsSession.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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,8 +251,8 @@ // ------------------------------------------------------------- - RPointerArray searchResults; - RPointerArray searchSeqs; + RPointerArray searchResults; + RPointerArray searchSeqs; iServer->PluginInterface()->PerformSearchL(*iSettings, *psQuery, @@ -330,11 +335,9 @@ iDes = NULL; } - PRINT ( _L("End CPcsSession::GetAsyncPcsResultsL") ); __LATENCY_MARKEND ( _L("CPcsSession::GetAsyncPcsResultsL") ); - } // ---------------------------------------------------------------------------- @@ -385,7 +388,6 @@ searchSeqs, sequenceLoc); - // Delete the search query and search data CleanupStack::PopAndDestroy( data ); CleanupStack::PopAndDestroy( psQuery ); @@ -449,7 +451,6 @@ PRINT ( _L("End CPcsSession::SearchInputL") ); __LATENCY_MARKEND ( _L("CPcsSession::SearchInputL") ); - } // ---------------------------------------------------------------------------- @@ -487,7 +488,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 +496,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 +508,6 @@ PRINT ( _L("End CPcsSession::SearchMatchStringL") ); __LATENCY_MARKEND ( _L("CPcsSession::SearchMatchStringL") ); - } // ---------------------------------------------------------------------------- @@ -594,8 +591,6 @@ // URI HBufC* uri = HBufC::NewLC(stream, uriSize); - - // -------------------------------------------------------------- // Get the data order @@ -762,6 +757,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 +841,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 +869,7 @@ CleanupStack::PopAndDestroy( &stream ); CleanupStack::PopAndDestroy( tempBuf ); CleanupStack::PushL( psQuery ); - + + PRINT ( _L("End CPcsSession::ReadQueryLC") ); return psQuery; } diff -r 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def --- a/predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServerClientAPI/bwins/PsServerClientAPIu.def Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def --- a/predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServerClientAPI/eabi/PsServerClientAPIu.def Wed Jun 09 09:26:27 2010 +0300 @@ -22,4 +22,7 @@ _ZTV18CPsPropertyHandler @ 21 NONAME ; ## _ZN17CPSRequestHandler12CancelSearchEv @ 22 NONAME _ZN17CPSRequestHandler12LookupMatchLERK8CPsQueryRK7TDesC16R6TDes16 @ 23 NONAME + _ZN17CPSRequestHandler26GetAdaptiveGridCharactersLERK12MDesC16ArrayRK7TDesC16iR6TDes16 @ 24 NONAME + _ZTI16CPsUpdateHandler @ 25 NONAME + _ZTV16CPsUpdateHandler @ 26 NONAME diff -r 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp --- a/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServerClientAPI/src/CPsRequestHandler.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsServerClientAPI/src/RPsSession.cpp --- a/predictivesearch/PcsServerClientAPI/src/RPsSession.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsServerClientAPI/src/RPsSession.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsUtils/src/CPcsDebug.cpp --- a/predictivesearch/PcsUtils/src/CPcsDebug.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsUtils/src/CPcsDebug.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsUtils/src/CPsQuery.cpp --- a/predictivesearch/PcsUtils/src/CPsQuery.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsUtils/src/CPsQuery.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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 4ae315f230bc -r a6539d1e8e43 predictivesearch/PcsUtils/src/CPsSettings.cpp --- a/predictivesearch/PcsUtils/src/CPsSettings.cpp Tue May 25 12:26:45 2010 +0300 +++ b/predictivesearch/PcsUtils/src/CPsSettings.cpp Wed Jun 09 09:26:27 2010 +0300 @@ -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(); - } -