# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277123067 -10800 # Node ID 34879f5cfc63463cc38f17b3b5acd411237321c4 # Parent a6539d1e8e433b03fc33fefcef479f50d4259454 Revision: 201023 Kit: 2010125 diff -r a6539d1e8e43 -r 34879f5cfc63 contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h --- a/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h Wed Jun 09 09:26:27 2010 +0300 +++ b/contacts_plat/cca_view_plugin_api/inc/ccaextensionfactory.h Mon Jun 21 15:24:27 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -21,10 +21,17 @@ #include class MCCAViewLauncher; +class MCCAStatusProvider; /** * ECom interface for CCA Extension factory. - * + * At the moment extension factory interface is used only for extend CCA + * Status button implementation: + * - CCA Status button implementation uses this interface to launch external + * views (MCCAViewLauncher) when user tap the Status button. + * - CCA Status button implementation uses MCCAStatusProvider interface to + * read status information from plug-in if status infromation doesn't found in + * Presence Cache. * @lib n/a * @since 9.2 */ @@ -45,7 +52,7 @@ { return NULL; } - + /** * Returns Service ID of the plug-in. */ @@ -67,6 +74,32 @@ }; +// Use this UID to access CCCAExtensionFactory's status provider creator. +// Used as a parameter to CCCAExtensionFactory::FactoryExtension method. +const TUid KCCAExtensionFactoryStatusProviderCreatorUid = { 2 }; + +/** + * This class is an extension to CCCAExtensionFactory. + * + * @see CCCAExtensionFactory + * @see KCCAExtensionFactoryStatusProviderCreatorUid + */ +class MCCAExtensionFactoryStatusProviderCreator + { + protected: // Destructor + virtual ~MCCAExtensionFactoryStatusProviderCreator() { } + + public: + + /** + * Creates a status provider. + * Ownership is given. + * @return Status provider instance @see MCCAStatusProvider + */ + virtual MCCAStatusProvider* CreateStatusProviderL() = 0; + + }; + /** * View launcher extension for the CCA. */ @@ -112,6 +145,112 @@ }; +class MCCAStatusProviderObserver; +class MVPbkContactLink; +class CGulIcon; + +/** + * Status provider extension for the CCA + */ +class MCCAStatusProvider + { +public: + /// virtual destructor + virtual ~MCCAStatusProvider() {}; + + /** + * Add observer + * @param aObserver instance @see MCCAStatusProviderObserver + */ + virtual void AddObserverL( + MCCAStatusProviderObserver& aObserver ) = 0; + + /** + * Removes observer + * @param aObserver instance @see MCCAStatusProviderObserver + */ + virtual void RemoveObserver( + MCCAStatusProviderObserver& aObserver ) = 0; + + /** + * CCA fetch status information for the Status button with this method + * if status information is not found from Presence Cache + * @param aLink + * @param aText Status Text, ownership is transfered + * @param aIcon Status Icon, ownership is transfered + */ + virtual void GetStatusInformationL( + const MVPbkContactLink& aLink, + HBufC*& aText, + CGulIcon*& aIcon ) = 0; + + /** + * CCA fetch status information for the Status button with this method + * if status information is not found from Presence Cache + * This function is used only for fetching My card status information + * @param aLink + * @param aText Status Text, ownership is transfered + * @param aIcon Status Icon, ownership is transfered + */ + virtual void GetMyCardStatusInformationL( + const MVPbkContactLink& aLink, + HBufC*& aText, + CGulIcon*& aIcon ) = 0; + + /** + * Extension point for the status provider + */ + virtual TAny* StatusProviderExtension( + TUid /*aExtensionUid*/ ) + { + return NULL; + } + +protected: + MCCAStatusProvider() {}; + + }; + +/** + * Interface to observe content changes + */ +class MCCAStatusProviderObserver + { +public: + /** + * Event types + */ + enum TCCAStatusProviderObserverEvent + { + /// Status is changed and CCA should fetch status information again + EStatusChanged = 0x0 + }; + + /** + * Plug-in can notify CCA about status events + * @param aEvent Type of the event + * @param aLink Contact which the event is about + */ + virtual void StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink = NULL ) = 0; + + /** + * Extension point for the MCCAStatusProviderObserver + */ + virtual TAny* StatusProviderObserverExtension( + TUid /*aExtensionUid*/ ) + { + return NULL; + } + +protected: + MCCAStatusProviderObserver(){}; + virtual ~MCCAStatusProviderObserver() {}; + + }; + + #include "ccaextensionfactory.inl" #endif // CCAEXTENSIONFACTORY_H diff -r a6539d1e8e43 -r 34879f5cfc63 contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h --- a/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h Wed Jun 09 09:26:27 2010 +0300 +++ b/contacts_plat/virtual_phonebook_engine_api/inc/CVPbkPhoneNumberMatchStrategy.h Mon Jun 21 15:24:27 2010 +0300 @@ -36,6 +36,9 @@ * implementations, but instances of the strategies are created using * this classes NewL function. Actual implementation selection is done * based on the given configuration data. + * In case of multiple matches from different stores, results from store + * configured in Phonebook 2 settings are returned. Only if no match + * is found from configured store(s), then return matches from other stores. */ class CVPbkPhoneNumberMatchStrategy : public CBase { @@ -183,7 +186,14 @@ * @return Array of stores that are used in matching. */ TArray StoresToMatch() const; - + + /** + * Checks if contact store is SIM store. + * @param aStore Store to be checked. + * @return ETrue if aStore is SIM store, otherwise EFalse. + */ + TBool IsSimStore( const MVPbkContactStore& aStore ); + private: // Interface for derived classes to implement /** * Called from MatchL to indicate derived classes that diff -r a6539d1e8e43 -r 34879f5cfc63 logsui/AppSrc/CLogsBaseView.cpp --- a/logsui/AppSrc/CLogsBaseView.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/logsui/AppSrc/CLogsBaseView.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -880,9 +880,7 @@ } //Process Send key for cellular, voip or poc call - if( aKeyEvent.iScanCode == EStdKeyYes && - ( MenuBar()->ItemSpecificCommandsEnabled() || - LogsAppUi()->ActiveViewId() == ELogDetailViewId ) ) + if( aKeyEvent.iScanCode == EStdKeyYes ) { ConstructDelayedL( EFalse ); //EFalse: perform immediately TBool supportLongSendPress = EFalse;//FIXME: FeatureManager::FeatureSupported( ??? ) this value should be available from platform in future diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkCompositeContactView.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -958,12 +958,15 @@ { // Loop through the rest of the contacts of the subview // and modify their global contact mapping information - for (TInt i = index; i < iContactMapping.Count(); ++i) + for (TInt i = 0; i < iContactMapping.Count(); ++i ) { - if (iContactMapping[i].iViewIndex == subViewIndex) + // Adjust the iContactIndex in the same view except the deleted one. + if ( ( iContactMapping[i].iViewIndex == subViewIndex ) + && ( iContactMapping[i].iContactIndex >= aIndex ) + && ( i != index ) ) { - // Subtract one because one contact was deleted - // from the list before the current index + // Subtract one because one contact was deleted, the index + // from the list which is bigger than the deleted one needs to be adjusted. --iContactMapping[i].iContactIndex; } } @@ -999,13 +1002,18 @@ index = err; } else - { - // We have to fix the indexes of all the succeeding + { + // We have to fix the indexes of all the succeeding // contacts in the view where the contact addition took place - for ( TInt i = index + 1; i < iContactMapping.Count(); ++i ) + for ( TInt i = 0; i < iContactMapping.Count(); ++i ) { - if (iContactMapping[i].iViewIndex == subViewIndex) + // Adjust the iContactIndex in the same view except the added one. + if ( ( iContactMapping[i].iViewIndex == subViewIndex ) + && ( iContactMapping[i].iContactIndex >= aIndex ) + && ( i != index ) ) { + // plus one because one contact was added, the index + // from the list which is bigger than the deleted one needs to be adjusted. ++iContactMapping[i].iContactIndex; } } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberMatchStrategy.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -37,12 +37,27 @@ #include #include #include +#include +#include #include "CVPbkPhoneNumberSequentialMatchStrategy.h" #include "CVPbkPhoneNumberParallelMatchStrategy.h" // CONSTANTS +// Unnamed namespace for local definitions +namespace { +// -------------------------------------------------------------------------- +// Phonebook Central Repository UIDs +// Copied from sf\app\contacts\phonebookui\Phonebook2\inc\Phonebook2InternalCRKeys.h +// -------------------------------------------------------------------------- +// +const TUint32 KCRUidPhonebookStoreConfiguration = 0x1020727f; +const TUint32 KPhonebookCurrentConfigurationPartialKey = 0x00000100; +const TUint32 KPhonebookCurrentConfigurationMask = 0xffffff00; + +const TInt KInitialStoreUriSize = 22; // length of KVPbkDefaultCntDbURI const TInt KMagicNumber = -1; +} // namespace NONSHARABLE_CLASS(CVPbkPhoneNumberMatchStrategyImpl) : public CActive, @@ -61,7 +76,8 @@ void MatchL(const TDesC& aPhoneNumber); TInt MaxMatchDigits() const; TArray StoresToMatch() const; - + TBool IsSimStore( const MVPbkContactStore& aStore ); + private: // From CActive void RunL(); void DoCancel(); @@ -133,6 +149,19 @@ const TDesC& aNumberB, TNumberType aNumberBType ); TInt FormatAndCheckNumberType( TDes& aNumber ); + /** + * Reads current store configuration from central repositiry + * @return Array of stores or NULL if error during reading form cenrep. + */ + CVPbkContactStoreUriArray* GetCurrentStoreConfigurationL(); + + /** + * If there is in the results at least one contact + * from currently used stores in Phonebook2 it removes from results + * contacts from other stores + */ + void RefineDuplicatedNumbersL(); + private: // Data CVPbkPhoneNumberMatchStrategy& iParent; /// Ref: The contact manager instance to be used for searching. @@ -410,6 +439,12 @@ delete iResults; iResults = results; } + + if ( iResults->Count() > 1 ) + { + RefineDuplicatedNumbersL(); + } + CVPbkContactLinkArray* results = iResults; iResults = NULL; iObserver->FindCompleteL( results ); @@ -945,6 +980,134 @@ return result; } +CVPbkContactStoreUriArray* CVPbkPhoneNumberMatchStrategyImpl::GetCurrentStoreConfigurationL() + { + CRepository* repository = CRepository::NewL( TUid::Uid( KCRUidPhonebookStoreConfiguration ) ); + CleanupStack::PushL( repository ); + CVPbkContactStoreUriArray* result = CVPbkContactStoreUriArray::NewLC(); + + RArray configurationKeys; + CleanupClosePushL( configurationKeys ); + + repository->FindL( KPhonebookCurrentConfigurationPartialKey, + KPhonebookCurrentConfigurationMask, configurationKeys ); + + HBufC* buffer = HBufC::NewLC( KInitialStoreUriSize ); + const TInt keyCount = configurationKeys.Count(); + TInt ret = KErrNone; + for ( TInt i = 0; i < keyCount; ++i ) + { + TPtr ptr = buffer->Des(); + ptr.Zero(); + TInt actualSize = 0; + ret = repository->Get( configurationKeys[i], ptr, actualSize ); + if ( ret == KErrOverflow ) + { + CleanupStack::PopAndDestroy(); // buffer + buffer = HBufC::NewLC( actualSize ); + ptr.Set( buffer->Des() ); + ret = repository->Get( configurationKeys[i], ptr ); + } + + if ( ret != KErrNone ) + { + break; + } + + if( !result->IsIncluded( TVPbkContactStoreUriPtr( ptr ) ) ) // Only append if the uri is not yet included + { + result->AppendL( ptr ); + } + } + CleanupStack::PopAndDestroy( buffer ); + CleanupStack::PopAndDestroy( &configurationKeys ); + CleanupStack::Pop( result ); + CleanupStack::PopAndDestroy( repository ); + + if ( ret != KErrNone ) + { + delete result; + result = NULL; + } + return result; + } + +void CVPbkPhoneNumberMatchStrategyImpl::RefineDuplicatedNumbersL() + { + CVPbkContactStoreUriArray* stores = GetCurrentStoreConfigurationL(); + if ( !stores ) + { + return; + } + CleanupStack::PushL( stores ); + + TInt storesCount = stores->Count(); + if ( storesCount ) + { + TInt linksCount = iResults->Count(); + // check if there is in the results at least one contact + // from currently used stores + TBool isFromUsedStore = EFalse; + for ( TInt i = 0; i < linksCount; i++ ) + { + const MVPbkContactStoreProperties& linkStoreProp = + iResults->At( i ).ContactStore().StoreProperties(); + + for ( TInt j = 0; j < storesCount; j++ ) + { + if ( !linkStoreProp.Uri().UriDes().Compare( ( *stores )[j].UriDes() ) ) + { + isFromUsedStore = ETrue; + break; + } + } + if ( isFromUsedStore ) + { + break; + } + } + // remove from results contacts from not used stores + if ( isFromUsedStore ) + { + for ( TInt i = 0; i < linksCount; i++ ) + { + TBool remove = ETrue; + const MVPbkContactStoreProperties& linkStoreProp = + iResults->At( i ).ContactStore().StoreProperties(); + + for ( TInt j = 0; j < storesCount; j++ ) + { + if ( !linkStoreProp.Uri().UriDes().Compare( ( *stores )[j].UriDes() ) ) + { + remove = EFalse; + break; + } + } + if ( remove ) + { + iResults->Delete( i ); + linksCount--; + i--; + } + } + } + } + CleanupStack::PopAndDestroy( stores ); + } + +TBool CVPbkPhoneNumberMatchStrategyImpl::IsSimStore( const MVPbkContactStore& aStore ) + { + TVPbkContactStoreUriPtr uriPtr = aStore.StoreProperties().Uri(); + if ( !uriPtr.UriDes().Compare( KVPbkSimGlobalAdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalFdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalSdnURI ) + || !uriPtr.UriDes().Compare( KVPbkSimGlobalOwnNumberURI ) ) + { + return ETrue; + } + return EFalse; + } + CVPbkPhoneNumberMatchStrategy::CVPbkPhoneNumberMatchStrategy() { } @@ -1000,4 +1163,8 @@ return iImpl->StoresToMatch(); } +TBool CVPbkPhoneNumberMatchStrategy::IsSimStore( const MVPbkContactStore& aStore ) + { + return iImpl->IsSimStore( aStore ); + } // End of File diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberParallelMatchStrategy.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include CVPbkPhoneNumberParallelMatchStrategy::CVPbkPhoneNumberParallelMatchStrategy() { @@ -54,16 +55,33 @@ const TDesC& aPhoneNumber) { CVPbkContactFindOperation* operation = NULL; - + if (!iMatchingStarted) { operation = CVPbkContactFindOperation::NewLC(FindObserver()); const TInt storeCount = StoresToMatch().Count(); + TInt maxDigits = MaxMatchDigits(); + for (TInt i = 0; i < storeCount; ++i) { - MVPbkContactOperation* subOperation = - StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( - aPhoneNumber, MaxMatchDigits(), *operation); + MVPbkContactOperation* subOperation = NULL; + + if ( maxDigits == KBestMatchingPhoneNumbers && + IsSimStore( *( StoresToMatch()[i] ) ) ) + { + // KBestMatchingPhoneNumbers enables best matching strategy + // on store level only for phone memory stores, for sim store + // MaxDigits parameter should be set to 7 or greater + const TInt KMaxDigitsForSimStore = 7; + subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, KMaxDigitsForSimStore, *operation); + } + else + { + subOperation = StoresToMatch()[i]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, maxDigits, *operation); + } + if (subOperation) { CleanupDeletePushL(subOperation); diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp --- a/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkEng/src/CVPbkPhoneNumberSequentialMatchStrategy.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -20,6 +20,7 @@ #include #include +#include CVPbkPhoneNumberSequentialMatchStrategy::CVPbkPhoneNumberSequentialMatchStrategy() { @@ -54,13 +55,26 @@ const TDesC& aPhoneNumber) { MVPbkContactOperation* operation = NULL; - + TInt maxDigits = MaxMatchDigits(); // Get the next store's operation if it not null while ( iCurrentOperation < StoresToMatch().Count() && !operation ) { - operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( - aPhoneNumber, MaxMatchDigits(), FindObserver()); - + if ( maxDigits == KBestMatchingPhoneNumbers && + IsSimStore( *( StoresToMatch()[iCurrentOperation] ) ) ) + { + // KBestMatchingPhoneNumbers enables best matching strategy + // on store level only for phone memory stores, for sim store + // MaxDigits parameter should be set to 7 or greater + const TInt KMaxDigitsForSimStore = 7; + operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, KMaxDigitsForSimStore, FindObserver()); + } + else + { + operation = StoresToMatch()[iCurrentOperation]->CreateMatchPhoneNumberOperationL( + aPhoneNumber, maxDigits, FindObserver()); + } + if ( operation ) { CleanupDeletePushL(operation); diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp --- a/phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/VirtualPhonebook/VPbkSimStore/src/CRemoteStore.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -676,6 +676,12 @@ { iAsyncOpenOp->Purge(); TInt id = iStoreEvent.iData; + + if ( IsOpen() && id == MVPbkSimPhoneObserver::ESimCardNotInserted ) + { + iCurrentState = iStoreEvent.iEvent; + } + // If not SIM card or BT SAP is active then store is not available if ( id == MVPbkSimPhoneObserver::ESimCardNotInserted || id == MVPbkSimPhoneObserver::EBtSapActive ) diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp --- a/phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/contactsmodel/cntplsql/src/cviewcontactmanager.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -359,9 +359,8 @@ } else if(iViewPreferences & (EUnSortedAtBeginning | EUnSortedAtEnd)) { - // It's an unsortable contact, just append its lightweight object - // to unsortable view contacts list. - contact->ChangeToLightweightObject(); + // It's an unsortable contact, + // just append it to unsortable view contacts list. iUnsortedViewContacts->AppendL(contact); CleanupStack::Pop(contact); } @@ -523,13 +522,11 @@ if(diff > 0) { resultContacts->AppendL(firstRightContact); - firstRightContact->ChangeToLightweightObject(); ++indexRight; } else { resultContacts->AppendL(firstLeftContact); - firstLeftContact->ChangeToLightweightObject(); ++indexLeft; if(diff == 0) { @@ -549,10 +546,6 @@ while(indexRight < aRightContacts.Count()) { CViewContact* firstRightContact = static_cast(aRightContacts[indexRight]); - - //change all the fullfil view objects to lightweight into the merged list. - firstRightContact->ChangeToLightweightObject(); - resultContacts->AppendL(firstRightContact); ++indexRight; } @@ -653,8 +646,6 @@ User::LeaveIfError(error); - //Make the view contact object to be lightweighted before insert to iViewContacts. - const_cast(aNewContact)->ChangeToLightweightObject(); iViewContacts->InsertL(aNewContact, position); return position; @@ -821,8 +812,6 @@ */ HBufC* CViewContactManager::AllFieldsLC(TInt aIndex, const TDesC& aSeparator) const { - TBool ifWasFullObject = EFalse; - CViewContact& viewContact = ViewContactAtL(aIndex); if(viewContact.IsLightweightObject()) { @@ -835,19 +824,10 @@ CleanupStack::PushL(contact); viewContact.CopyL(*contact); CleanupStack::PopAndDestroy(contact); - - ifWasFullObject = ETrue; } HBufC* buf = FieldsWithSeparatorLC(viewContact,aSeparator); - - if(ifWasFullObject) - { - //loadFullContent is set in ViewContactAtL if the viewContact was a lightweight object and - //loaded to be full content object in that function. So we need to change it to lightweight - //in order to save more memory. - viewContact.ChangeToLightweightObject(); - } + return buf; } @@ -893,7 +873,6 @@ { // unsortable contacts go at the end or beginning // we want this to be stable (e.g. when ICC becomes unlocked) - contact->ChangeToLightweightObject(); iUnsortedViewContacts->AppendL(contact); index = iUnsortedViewContacts->Count() - 1; diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp --- a/phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/contactsmodel/cntsrv/src/CViewSubSessions.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -390,10 +390,6 @@ delete iContact; iContact=NULL; iContact = CViewContact::NewL(contact); - - //Always keep server side local view in memory saving mode, so we - //change the view contact object stored in iView into lightweight object - const_cast(contact).ChangeToLightweightObject(); const TInt externalizedSize=iContact->ExternalizedSize(); TPckgBuf pckg(externalizedSize); @@ -668,10 +664,6 @@ idMap.iMapping=i; User::LeaveIfError(array.Append(idMap)); } - - //Always keep server side local view in memory saving mode, so we - //change the view contact object stored in iView into lightweight object - const_cast( contact ).ChangeToLightweightObject(); } // Externalize array to client. diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookengines/contactsmodel/groupsql/cntmodel.iby --- a/phonebookengines/contactsmodel/groupsql/cntmodel.iby Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookengines/contactsmodel/groupsql/cntmodel.iby Mon Jun 21 15:24:27 2010 +0300 @@ -30,7 +30,7 @@ REM Configurable heap size for contact server. #ifndef CONTACT_SERVER_MAX_HEAPSIZE -#define CONTACT_SERVER_MAX_HEAPSIZE 0x100000 +#define CONTACT_SERVER_MAX_HEAPSIZE 0x200000 #endif file=ABI_DIR\BUILD_DIR\cntsrv.exe System\Programs\cntsrv.exe heapmax=CONTACT_SERVER_MAX_HEAPSIZE diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h --- a/phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/MapExtension/inc/cpmapcmd.h Mon Jun 21 15:24:27 2010 +0300 @@ -36,13 +36,20 @@ class MPbk2ContactEditorControlExtension; class MVPbkStoreContactField; class TLocality; +class CMnMapView; +enum TCurrentMapLaunchedByState + { + EMapNone = 1, + EMapAssignFromMaps, + EMapShowOnMaps + }; // CLASS DECLARATION /** * Phonebook 2 show on map command object. */ -class CPmapCmd : public CBase, +class CPmapCmd : public CActive, public MPbk2Command, public MVPbkContactObserver { @@ -76,6 +83,27 @@ */ ~CPmapCmd(); + // CActive-related methods + /** + * RunL method to handle the user selection + */ + void RunL(); + + /** + * Cancel method to handle the user selection + */ + void DoCancel(); + + /** + * Function to handle any errors in async request + * @param aError Error Code + */ + TInt RunError( TInt aError ); + + /** + * Disconnects from provider, when operation is completed + */ + void Reset(); public: //From MVPbkContactObserver void ContactOperationCompleted( TContactOpResult aResult ); void ContactOperationFailed( @@ -85,6 +113,7 @@ public: // From MPbk2Command void ExecuteLD(); + void ExecuteL(); void AddObserver( MPbk2CommandObserver& aObserver ); void ResetUiControl( @@ -235,6 +264,16 @@ */ TPbk2FieldGroupId GetFieldGroupL( MVPbkStoreContactField& aField ); + /** + * Handle the selection of map which was launched from Show On Map option. + */ + void HandleSelectiOnShowOnMapsL(); + + /** + * Handle the selection of map which was launched from Assign From Maps option. + */ + void HandleSelectiOnAssignFromMapsL(); + private: // Data /// Ref: Contact editor control MPbk2ContactEditorControl* iEditorControl; @@ -246,12 +285,20 @@ MPbk2CommandObserver* iObserver; /// Own: Map View Provider CMnProvider* iMapViewProvider; + /// Own: Map View + CMnMapView* iMapView; /// Own: Is in editor address view? TBool iAddressView; /// Own: command id TInt iCommandId; /// Own: Is in editor address view? TBool iAddressUpdatePrompt; + /// Own: Current map launched is by which option + TCurrentMapLaunchedByState iCurrentMapLaunchedByState; + /// Own: Current AddressType + TVPbkFieldTypeParameter iAddressType; + /// Own: Is already address is there? + TBool iNoAddress; }; #endif // CPMAPCMD_H diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h --- a/phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/MapExtension/inc/cpmapcontacteditorextension.h Mon Jun 21 15:24:27 2010 +0300 @@ -30,7 +30,7 @@ class MPbk2ContactEditorControl; class MPbk2ContactEditorUIField; class MPbk2UIField; - +class MPbk2Command; // CLASS DECLARATION class CPmapContactEditorExtension : public CBase, public MPbk2ContactEditorExtension, @@ -107,7 +107,8 @@ MVPbkStoreContact& iContact; /// Ref: Contact editor control MPbk2ContactEditorControl& iEditorControl; - + /// Own: Map command controller + MPbk2Command* iCmd; }; #endif // CPMAPCONTACTEDITOREXTENSION_H diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp --- a/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcmd.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -96,11 +96,14 @@ // CPmapCmd::CPmapCmd( MPbk2ContactEditorControl& aEditorControl, MVPbkStoreContact& aContact, TInt aCommandId ) : + CActive( CActive::EPriorityStandard ), iEditorControl( &aEditorControl ), iContact( &aContact ), iCommandId( aCommandId ) { + CActiveScheduler::Add( this ); iAddressUpdatePrompt = ETrue; + iCurrentMapLaunchedByState = EMapNone; } // -------------------------------------------------------------------------- @@ -108,10 +111,13 @@ // -------------------------------------------------------------------------- // CPmapCmd::CPmapCmd( MPbk2ContactUiControl& aUiControl, TInt aCommandId ) : + CActive( CActive::EPriorityStandard ), iUiControl( &aUiControl ), iCommandId( aCommandId ) { + CActiveScheduler::Add( this ); iAddressUpdatePrompt = ETrue; + iCurrentMapLaunchedByState = EMapNone; } // -------------------------------------------------------------------------- @@ -120,6 +126,14 @@ // CPmapCmd::~CPmapCmd() { + Cancel(); + if(iMapView) + { + iMapView->ResetLandmarksToShow(); + delete iMapView; + iMapView = NULL; + } + ReleaseLandmarkResources(); if( iUiControl ) { iUiControl->RegisterCommand( NULL ); @@ -230,14 +244,17 @@ return ret; } +void CPmapCmd::ExecuteLD() + { + ExecuteL(); + } + // -------------------------------------------------------------------------- // CPmapCmd::ExecuteLD // -------------------------------------------------------------------------- // -void CPmapCmd::ExecuteLD() +void CPmapCmd::ExecuteL() { - CleanupStack::PushL( this ); - PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD")); @@ -258,17 +275,7 @@ else { CleanupStack::PopAndDestroy( prompt ); - FinishProcess(); - - if( !iUiControl ) - { - CleanupStack::PopAndDestroy( this ); - } - else - { - CleanupStack::Pop( this ); - } - + FinishProcess(); PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD end")); @@ -309,24 +316,17 @@ if( iCommandId == EPbk2ExtensionShowOnMap ) { EditorShowOnMapsL(addressType); + return; // as the asynchronous request is processed next part will be executed inside RunL of this class. } else if( iCommandId == EPbk2ExtensionAssignFromMap ) { EditorAssignFromMapsL(addressType); + return; // as the asynchronous request is processed next part will be executed inside RunL of this class. } } FinishProcess(); - if( !iUiControl ) - { - CleanupStack::PopAndDestroy( this ); - } - else - { - CleanupStack::Pop( this ); - } - PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING ("CPmapCmd::ExecuteLD end")); } @@ -568,9 +568,8 @@ // void CPmapCmd::EditorShowOnMapsL( TVPbkFieldTypeParameter aAddressType ) { - CMnMapView* mapview = CMnMapView::NewChainedL( *iMapViewProvider ); - CleanupStack::PushL( mapview ); - + iAddressType = aAddressType; + RPointerArray landmarks; CleanupClosePushL( landmarks ); @@ -586,198 +585,38 @@ || landmark->GetPosition( locality ) == KErrNone ) { landmarks.AppendL( landmark ); - mapview->AddLandmarksToShowL( landmarks ); } if ( landmark->GetPosition( locality ) == KErrNone ) { - mapview->ShowMapL(); + if(iMapView) + { + delete iMapView; + iMapView = NULL; + } + iMapView = CMnMapView::NewL( *iMapViewProvider ); + iMapView->AddLandmarksToShowL( landmarks ); + iMapView->ShowMapL(); CleanupStack::PopAndDestroy( landmark ); CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); + delete iMapView; + iMapView = NULL; + FinishProcess(); } else { - TRequestStatus status; - mapview->SelectFromMapL( status ); - User::WaitForRequest( status ); - TBool update = EFalse; - TBool geocoordsExist = EFalse; - - CPosLandmark* result = NULL; - if ( status.Int() == KErrNone ) + if(iMapView) { - result = mapview->RetrieveSelectionResultL(); - if ( result->GetPosition( locality ) == KErrNone ) - { - geocoordsExist = ETrue; - } - if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) - || result->IsPositionFieldAvailable( EPositionFieldCity ) - || result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - update = ETrue; - } - + delete iMapView; + iMapView = NULL; } + iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); + iMapView->AddLandmarksToShowL( landmarks ); + iMapView->SelectFromMapL( iStatus ); + iCurrentMapLaunchedByState = EMapShowOnMaps; + SetActive(); CleanupStack::PopAndDestroy( landmark ); CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); - if ( result ) - { - CleanupStack::PushL( result ); - } - - if ( update ) - { - - const TInt KGranularity = 4; - CDesCArrayFlat* arrFields = new (ELeave) CDesCArrayFlat( - KGranularity ); - CleanupStack::PushL( arrFields ); - HBufC* addrLebel = NULL; - - switch ( aAddressType ) - { - case EVPbkVersitParamPREF: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS ); - break; - case EVPbkVersitParamHOME: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS_HOME ); - break; - case EVPbkVersitParamWORK: - addrLebel = StringLoader::LoadLC( - R_QTN_PHOB_HEADER_ADDRESS_WORK ); - break; - default: - User::Leave( KErrArgument ); - } - arrFields->AppendL( addrLebel->Des() ); - _LIT(KComma, ","); - _LIT(KSpace, " "); - TInt lenght = 0; - TPtrC street; - if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) - { - result->GetPositionField( EPositionFieldStreet, street ); - lenght += street.Length(); - } - - TPtrC city; - if ( result->IsPositionFieldAvailable( EPositionFieldCity ) ) - { - result->GetPositionField( EPositionFieldCity, city ); - if ( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += city.Length(); - } - - TPtrC country; - if ( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - result->GetPositionField( EPositionFieldCountry, country ); - if ( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += country.Length(); - } - - RBuf newAddr; - newAddr.CreateL( lenght ); - CleanupClosePushL( newAddr ); - - if ( street.Length() ) - { - newAddr += street; - } - - if ( city.Length() ) - { - if ( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += city; - } - - if ( country.Length() ) - { - if ( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += country; - } - - arrFields->AppendL( newAddr ); - HBufC* prompt = StringLoader::LoadLC( - R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if ( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) - { - update = EFalse; - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( &newAddr ); - CleanupStack::PopAndDestroy( addrLebel ); - CleanupStack::PopAndDestroy( arrFields ); - - } - if ( update ) - { - if ( !iEditorControl ) - { - iContact->LockL( *this ); - CActiveScheduler::Start(); - } - UpdateFieldL( *result, EPositionFieldCountry, - EVPbkVersitSubFieldCountry, aAddressType ); - UpdateFieldL( *result, EPositionFieldCity, - EVPbkVersitSubFieldLocality, aAddressType ); - UpdateFieldL( *result, EPositionFieldStreet, - EVPbkVersitSubFieldStreet, aAddressType ); - UpdateFieldL( *result, EPositionFieldPostalCode, - EVPbkVersitSubFieldPostalCode, aAddressType ); - UpdateFieldL( *result, EPositionFieldLocality, - EVPbkVersitSubFieldRegion, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldPostOfficeAddress, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldExtendedAddress, aAddressType ); - - if ( geocoordsExist ) - { - UpdateCoordsL( locality, aAddressType ); - } - if ( !iEditorControl ) - { - iContact->CommitL( *this ); - CActiveScheduler::Start(); - } - if ( ControlExtension() ) - { - ControlExtension()->UpdateControlsL(); - } - - HBufC* text = StringLoader::LoadLC( - R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); - CAknInformationNote* note = new (ELeave) CAknInformationNote( - ETrue ); - note->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - - if ( result ) - { - CleanupStack::PopAndDestroy( result ); - } } } @@ -1028,9 +867,15 @@ // void CPmapCmd::EditorAssignFromMapsL(TVPbkFieldTypeParameter aAddressType) { - CMnMapView* mapview = CMnMapView::NewChainedL( *iMapViewProvider ); - CleanupStack::PushL( mapview ); - + if(iMapView) + { + delete iMapView; + iMapView = NULL; + } + + iMapView = CMnMapView::NewChainedL( *iMapViewProvider ); + iAddressType = aAddressType; + RPointerArray landmarks; CleanupClosePushL( landmarks ); @@ -1042,195 +887,19 @@ FillLandmarkL( *landmark, aAddressType ); } TLocality locality; - TBool noAddress = ETrue; + iNoAddress = ETrue; if( landmark->NumOfAvailablePositionFields() > 0 || landmark->GetPosition( locality ) == KErrNone ) { landmarks.AppendL( landmark ); - mapview->AddLandmarksToShowL( landmarks ); - noAddress = EFalse; + iMapView->AddLandmarksToShowL( landmarks ); + iNoAddress = EFalse; } - TRequestStatus status; - mapview->SelectFromMapL( status ); - User::WaitForRequest( status ); - - TBool update = EFalse; - TBool geocoordsExist = EFalse; - - CPosLandmark* result = NULL; - if ( status.Int() == KErrNone ) - { - result = mapview->RetrieveSelectionResultL(); - if ( result->GetPosition( locality ) == KErrNone ) - { - geocoordsExist = ETrue; - } - - if( result->IsPositionFieldAvailable( EPositionFieldStreet ) || - result->IsPositionFieldAvailable( EPositionFieldCity ) || - result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - update= ETrue; - } - - } - CleanupStack::PopAndDestroy( landmark ); - CleanupStack::PopAndDestroy( &landmarks ); - CleanupStack::PopAndDestroy( mapview ); - if( result ) - { - CleanupStack::PushL( result ); - } - - if( update ) - { - if( iAddressUpdatePrompt && !noAddress ) - { - const TInt KGranularity = 4; - CDesCArrayFlat* arrFields = new ( ELeave ) CDesCArrayFlat - ( KGranularity ); - CleanupStack::PushL(arrFields); - - HBufC* addrLebel = NULL; - - switch( aAddressType ) - { - case EVPbkVersitParamPREF: - addrLebel = StringLoader::LoadLC(R_QTN_PHOB_HEADER_ADDRESS ); - break; - case EVPbkVersitParamHOME: - addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_HOME ); - break; - case EVPbkVersitParamWORK: - addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_WORK ); - break; - default: - User::Leave(KErrArgument); - } - arrFields->AppendL( addrLebel->Des() ); - - _LIT(KComma, ","); - _LIT(KSpace, " "); - - TInt lenght = 0; - TPtrC street; - if( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) - { - result->GetPositionField( EPositionFieldStreet, street ); - lenght += street.Length(); - } - - TPtrC city; - if( result->IsPositionFieldAvailable( EPositionFieldCity ) ) - { - result->GetPositionField( EPositionFieldCity, city ); - if( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += city.Length(); - } - - TPtrC country; - if( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) - { - result->GetPositionField( EPositionFieldCountry, country ); - if( lenght ) - { - lenght += KComma().Length() + KSpace().Length(); - } - lenght += country.Length(); - } - - RBuf newAddr; - newAddr.CreateL( lenght ); - CleanupClosePushL( newAddr ); - - if( street.Length() ) - { - newAddr += street; - } - - if( city.Length() ) - { - if( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += city; - } - - if( country.Length() ) - { - if( newAddr.Length() > 0 ) - { - newAddr += KComma(); - newAddr += KSpace(); - } - newAddr += country; - } - - arrFields->AppendL( newAddr ); - HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - if( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) - { - update = EFalse; - } - CleanupStack::PopAndDestroy( prompt ); - CleanupStack::PopAndDestroy( &newAddr ); - CleanupStack::PopAndDestroy( addrLebel ); - CleanupStack::PopAndDestroy( arrFields ); - } - - if( update ) - { - if ( !iEditorControl ) - { - iContact->LockL( *this ); - CActiveScheduler::Start(); - } - UpdateFieldL( *result, EPositionFieldCountry, - EVPbkVersitSubFieldCountry, aAddressType ); - UpdateFieldL( *result, EPositionFieldCity, - EVPbkVersitSubFieldLocality, aAddressType ); - UpdateFieldL( *result, EPositionFieldStreet, - EVPbkVersitSubFieldStreet, aAddressType ); - UpdateFieldL( *result, EPositionFieldPostalCode, - EVPbkVersitSubFieldPostalCode, aAddressType ); - UpdateFieldL( *result, EPositionFieldLocality, - EVPbkVersitSubFieldRegion, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldPostOfficeAddress, aAddressType ); - UpdateFieldL( *result, EPositionFieldNone, - EVPbkVersitSubFieldExtendedAddress, aAddressType ); - - if( geocoordsExist ) - { - UpdateCoordsL( locality, aAddressType ); - } - if ( !iEditorControl ) - { - iContact->CommitL( *this ); - CActiveScheduler::Start(); - } - if( ControlExtension() ) - { - ControlExtension()->UpdateControlsL(); - } - - HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); - CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); - note->ExecuteLD( *text ); - CleanupStack::PopAndDestroy( text ); - } - } - - if( result ) - { - CleanupStack::PopAndDestroy( result ); - } + iMapView->SelectFromMapL( iStatus ); + iCurrentMapLaunchedByState = EMapAssignFromMaps; + SetActive(); + CleanupStack::PopAndDestroy( landmark ); + CleanupStack::PopAndDestroy( &landmarks ); } // -------------------------------------------------------------------------- @@ -1539,6 +1208,383 @@ } // -------------------------------------------------------------------------- +// CPmapCmd::HandleSelectiOnAssignFromMapsL +// -------------------------------------------------------------------------- +// +void CPmapCmd::HandleSelectiOnAssignFromMapsL() + { + TBool update = EFalse; + TBool geocoordsExist = EFalse; + + TLocality locality; + CPosLandmark* result = NULL; + TInt currentstatus = iStatus.Int(); + if ( iStatus.Int() == KErrNone && iMapView) + { + result = iMapView->RetrieveSelectionResultL(); + // Get the location name if available + //-----------------Emulator Hack------------------------------- + // result->SetLandmarkNameL(_L("Jupiter Tech Park")); +// result->SetPositionFieldL(EPositionFieldCity, _L("Bangalore")); +// result->SetPositionFieldL(EPositionFieldCountry, _L("India")); + //------------------------------------------------------------- + if(result->GetPosition( locality ) == KErrNone ) + { + geocoordsExist = ETrue; + } + + if( result->IsPositionFieldAvailable( EPositionFieldStreet ) || + result->IsPositionFieldAvailable( EPositionFieldCity ) || + result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + update= ETrue; + } + } + delete iMapView; + iMapView = NULL; + if( result ) + { + CleanupStack::PushL( result ); + } + + if( update ) + { + if( iAddressUpdatePrompt && !iNoAddress ) + { + const TInt KGranularity = 4; + CDesCArrayFlat* arrFields = new ( ELeave ) CDesCArrayFlat + ( KGranularity ); + CleanupStack::PushL(arrFields); + + HBufC* addrLebel = NULL; + + switch( iAddressType ) + { + case EVPbkVersitParamPREF: + addrLebel = StringLoader::LoadLC(R_QTN_PHOB_HEADER_ADDRESS ); + break; + case EVPbkVersitParamHOME: + addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_HOME ); + break; + case EVPbkVersitParamWORK: + addrLebel = StringLoader::LoadLC( R_QTN_PHOB_HEADER_ADDRESS_WORK ); + break; + default: + User::Leave(KErrArgument); + } + arrFields->AppendL( addrLebel->Des() ); + + _LIT(KComma, ","); + _LIT(KSpace, " "); + + TInt lenght = 0; + TPtrC street; + if( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) + { + result->GetPositionField( EPositionFieldStreet, street ); + lenght += street.Length(); + } + + TPtrC city; + if( result->IsPositionFieldAvailable( EPositionFieldCity ) ) + { + result->GetPositionField( EPositionFieldCity, city ); + if( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += city.Length(); + } + + TPtrC country; + if( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + result->GetPositionField( EPositionFieldCountry, country ); + if( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += country.Length(); + } + + RBuf newAddr; + newAddr.CreateL( lenght ); + CleanupClosePushL( newAddr ); + + if( street.Length() ) + { + newAddr += street; + } + + if( city.Length() ) + { + if( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += city; + } + + if( country.Length() ) + { + if( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += country; + } + + arrFields->AppendL( newAddr ); + HBufC* prompt = StringLoader::LoadLC( R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) + { + update = EFalse; + } + CleanupStack::PopAndDestroy( prompt ); + CleanupStack::PopAndDestroy( &newAddr ); + CleanupStack::PopAndDestroy( addrLebel ); + CleanupStack::PopAndDestroy( arrFields ); + } + + if( update ) + { + if ( !iEditorControl ) + { + iContact->LockL( *this ); + CActiveScheduler::Start(); + } + UpdateFieldL( *result, EPositionFieldCountry, + EVPbkVersitSubFieldCountry, iAddressType ); + UpdateFieldL( *result, EPositionFieldCity, + EVPbkVersitSubFieldLocality, iAddressType ); + UpdateFieldL( *result, EPositionFieldStreet, + EVPbkVersitSubFieldStreet, iAddressType ); + UpdateFieldL( *result, EPositionFieldPostalCode, + EVPbkVersitSubFieldPostalCode, iAddressType ); + UpdateFieldL( *result, EPositionFieldLocality, + EVPbkVersitSubFieldRegion, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldExtendedAddress, iAddressType ); + + if( geocoordsExist ) + { + UpdateCoordsL( locality, iAddressType ); + } + if ( !iEditorControl ) + { + iContact->CommitL( *this ); + CActiveScheduler::Start(); + } + if( ControlExtension() ) + { + ControlExtension()->UpdateControlsL(); + } + + HBufC* text = StringLoader::LoadLC( R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); + CAknInformationNote* note = new ( ELeave ) CAknInformationNote( ETrue ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + } + + if( result ) + { + CleanupStack::PopAndDestroy( result ); + } + } + +// -------------------------------------------------------------------------- +// CPmapCmd::HandleSelectiOnAssignFromMapsL +// -------------------------------------------------------------------------- +// +void CPmapCmd::HandleSelectiOnShowOnMapsL() + { + TBool update = EFalse; + TBool geocoordsExist = EFalse; + + TLocality locality; + CPosLandmark* result = NULL; + if ( iStatus.Int() == KErrNone && iMapView) + { + result = iMapView->RetrieveSelectionResultL(); + if ( result->GetPosition( locality ) == KErrNone ) + { + geocoordsExist = ETrue; + } + if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) + || result->IsPositionFieldAvailable( EPositionFieldCity ) + || result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + update = ETrue; + } + + } + + delete iMapView; + iMapView = NULL; + if ( result ) + { + CleanupStack::PushL( result ); + } + + if ( update ) + { + + const TInt KGranularity = 4; + CDesCArrayFlat* arrFields = new (ELeave) CDesCArrayFlat( + KGranularity ); + CleanupStack::PushL( arrFields ); + HBufC* addrLebel = NULL; + + switch ( iAddressType ) + { + case EVPbkVersitParamPREF: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS ); + break; + case EVPbkVersitParamHOME: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS_HOME ); + break; + case EVPbkVersitParamWORK: + addrLebel = StringLoader::LoadLC( + R_QTN_PHOB_HEADER_ADDRESS_WORK ); + break; + default: + User::Leave( KErrArgument ); + } + arrFields->AppendL( addrLebel->Des() ); + _LIT(KComma, ","); + _LIT(KSpace, " "); + TInt lenght = 0; + TPtrC street; + if ( result->IsPositionFieldAvailable( EPositionFieldStreet ) ) + { + result->GetPositionField( EPositionFieldStreet, street ); + lenght += street.Length(); + } + + TPtrC city; + if ( result->IsPositionFieldAvailable( EPositionFieldCity ) ) + { + result->GetPositionField( EPositionFieldCity, city ); + if ( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += city.Length(); + } + + TPtrC country; + if ( result->IsPositionFieldAvailable( EPositionFieldCountry ) ) + { + result->GetPositionField( EPositionFieldCountry, country ); + if ( lenght ) + { + lenght += KComma().Length() + KSpace().Length(); + } + lenght += country.Length(); + } + + RBuf newAddr; + newAddr.CreateL( lenght ); + CleanupClosePushL( newAddr ); + + if ( street.Length() ) + { + newAddr += street; + } + + if ( city.Length() ) + { + if ( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += city; + } + + if ( country.Length() ) + { + if ( newAddr.Length() > 0 ) + { + newAddr += KComma(); + newAddr += KSpace(); + } + newAddr += country; + } + + arrFields->AppendL( newAddr ); + HBufC* prompt = StringLoader::LoadLC( + R_QTN_PHOB_CONFIRM_CHANGE_ADDRESS, *arrFields ); + CAknQueryDialog* dlg = CAknQueryDialog::NewL(); + if ( !dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *prompt ) ) + { + update = EFalse; + } + CleanupStack::PopAndDestroy( prompt ); + CleanupStack::PopAndDestroy( &newAddr ); + CleanupStack::PopAndDestroy( addrLebel ); + CleanupStack::PopAndDestroy( arrFields ); + + } + if ( update ) + { + if ( !iEditorControl ) + { + iContact->LockL( *this ); + CActiveScheduler::Start(); + } + UpdateFieldL( *result, EPositionFieldCountry, + EVPbkVersitSubFieldCountry, iAddressType ); + UpdateFieldL( *result, EPositionFieldCity, + EVPbkVersitSubFieldLocality, iAddressType ); + UpdateFieldL( *result, EPositionFieldStreet, + EVPbkVersitSubFieldStreet, iAddressType ); + UpdateFieldL( *result, EPositionFieldPostalCode, + EVPbkVersitSubFieldPostalCode, iAddressType ); + UpdateFieldL( *result, EPositionFieldLocality, + EVPbkVersitSubFieldRegion, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldPostOfficeAddress, iAddressType ); + UpdateFieldL( *result, EPositionFieldNone, + EVPbkVersitSubFieldExtendedAddress, iAddressType ); + + if ( geocoordsExist ) + { + UpdateCoordsL( locality, iAddressType ); + } + if ( !iEditorControl ) + { + iContact->CommitL( *this ); + CActiveScheduler::Start(); + } + if ( ControlExtension() ) + { + ControlExtension()->UpdateControlsL(); + } + + HBufC* text = StringLoader::LoadLC( + R_QTN_PHOB_NOTE_ADDRESS_UPDATED ); + CAknInformationNote* note = new (ELeave) CAknInformationNote( + ETrue ); + note->ExecuteLD( *text ); + CleanupStack::PopAndDestroy( text ); + } + + if ( result ) + { + CleanupStack::PopAndDestroy( result ); + } + } + +// -------------------------------------------------------------------------- // CPmapCmd::ContactOperationFailed // -------------------------------------------------------------------------- // @@ -1548,4 +1594,85 @@ CActiveScheduler::Stop(); } +// ---------------------------------------------------------------------------- +// CPmapCmd::RunL +// RunL method to handle the user selection +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::RunL() + { + // request is completed, inform observer + TInt maperror = iStatus.Int(); + if(iStatus.Int() == KErrNone) + { + switch(iCurrentMapLaunchedByState) + { + case EMapAssignFromMaps: + { + HandleSelectiOnAssignFromMapsL(); + } + break; + case EMapShowOnMaps: + { + HandleSelectiOnShowOnMapsL(); + } + break; + default: + break; + } + } + FinishProcess(); + + if(!iUiControl) + { + // delete this; + } + iCurrentMapLaunchedByState = EMapNone; + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::RunError +// Function to handle any errors in async request +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +TInt CPmapCmd::RunError( TInt /*aError*/ ) + { + Reset(); + return KErrNone; + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::DoCancel +// Cancel method to handle the user selection +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::DoCancel() + { + if ( IsActive() && iMapView ) + { + iMapView->Cancel(); + } + Reset(); + } + +// ---------------------------------------------------------------------------- +// CPmapCmd::Reset +// Disconnects from provider, when operation is completed +// (other items were commented in a header). +// ---------------------------------------------------------------------------- +// +void CPmapCmd::Reset() + { + if(iMapView) + { + iMapView->ResetLandmarksToShow(); + delete iMapView; + iMapView = NULL; + } + ReleaseLandmarkResources(); + } + // End of File diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp --- a/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/MapExtension/src/cpmapcontacteditorextension.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -101,6 +101,11 @@ // CPmapContactEditorExtension::~CPmapContactEditorExtension() { + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } } // -------------------------------------------------------------------------- @@ -170,16 +175,26 @@ { case EPbk2ExtensionShowOnMap: { - MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); - // Execute the command - cmd->ExecuteLD(); + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } + iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); + // Execute the command + iCmd->ExecuteLD(); return ETrue; } case EPbk2ExtensionAssignFromMap: { - MPbk2Command* cmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); + if(iCmd) + { + delete iCmd; + iCmd = NULL; + } + iCmd = CPmapCmd::NewL( iEditorControl, iContact, aCommandId ); // Execute the command - cmd->ExecuteLD(); + iCmd->ExecuteLD(); return ETrue; } default: diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp --- a/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/NamesListExtension/src/NamesListUiExtensionPlugin.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -79,6 +80,7 @@ #include #include #include +#include /// Unnamed namespace for local definitions namespace { @@ -155,10 +157,28 @@ { User::Leave( KErrNotReady ); } + // Check status message variation + TInt showStatusInNamesList = 0; + CRepository* cenrep = + CRepository::NewLC( TUid::Uid( KCRUidPhonebook ) ); + User::LeaveIfError( + cenrep->Get( KPhonebookStatusMessageVisibility, + showStatusInNamesList ) ); + CleanupStack::PopAndDestroy( cenrep ); + + // By default status is not shown in names list + TInt32 spbContentFlags = CSpbContentProvider::EPhoneNumber; + + if( showStatusInNamesList ) + { + spbContentFlags = (CSpbContentProvider::EStatusMessage | + CSpbContentProvider::EPhoneNumber); + } + CPbk2StoreManager& storeManager = static_cast(ext)->StoreManager(); - iContentProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), storeManager, - CSpbContentProvider::EStatusMessage | CSpbContentProvider::EPhoneNumber ); + iContentProvider = CSpbContentProvider::NewL( + iAppServices->ContactManager(), storeManager, spbContentFlags ); } return *iContentProvider; } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp --- a/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/Presentation/src/CPbk2DuplicateContactFinder.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -488,11 +488,13 @@ for ( TInt i = 0; i < fieldCount; ++i ) { const MVPbkBaseContactField& field = fieldSet.FieldAt(i); - TInt fieldTypeId = field.BestMatchingFieldType()->FieldTypeResId(); - - if ( fieldTypeId == aFieldId ) + if ( field.BestMatchingFieldType() ) { - return &field; + TInt fieldTypeId = field.BestMatchingFieldType()->FieldTypeResId(); + if ( fieldTypeId == aFieldId ) + { + return &field; + } } } return NULL; diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h --- a/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/inc/CPbk2AdaptiveSearchGridFiller.h Mon Jun 21 15:24:27 2010 +0300 @@ -23,6 +23,7 @@ #include #include #include +#include "MVPbkViewContact.h" // FORWARD DECLARATIONS class CAknSearchField; @@ -137,6 +138,8 @@ // Used to judge if this contact's title include drgraphs TBool IsDigraphContactsTitleL(const TDesC& aContactTitle); TBool GridFromPsEngineL( const MVPbkContactViewBase& aView ); + // Check whether the title is empty or not. + TBool IsActualTitleEmpty( const MVPbkViewContact& aContact ); private: // Data /// Own: Containts adaptive search grid. diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2AdaptiveSearchGridFiller.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -23,6 +23,11 @@ #include "MPbk2ContactNameFormatter.h" #include "MPbk2FilteredViewStack.h" +#include +#include +#include + + #include #include #include @@ -41,6 +46,15 @@ MPbk2ContactNameFormatter::EReplaceNonGraphicChars | MPbk2ContactNameFormatter::EDisableCompanyNameSeparator; +namespace { +enum TNameOrder + { + ETopContactOrderNumber = 0, //TC control data, not shown + ENameFirstPart, //Contact name data + ENameSecondPart, //Contact name data + ENameCompanyPart //to support Company name + }; +} // namespace NONSHARABLE_CLASS(CPbk2AdaptiveGrid) : public CBase { @@ -249,6 +263,14 @@ else if ( titleLength ) { title = iNameFormatter.GetContactTitleL( contact.Fields(), KContactFormattingFlags ); + + // In FDN, the number will be displayed in the list if the contact is no name. + // If it is, set the search string as NULL. + if ( IsActualTitleEmpty( contact ) ) + { + delete title; + title = NULL; + } } if ( !title ) @@ -750,4 +772,39 @@ return EFalse; } } + +TBool CPbk2AdaptiveSearchGridFiller::IsActualTitleEmpty( const MVPbkViewContact& aContact ) + { + TBool result = ETrue; + const TInt fieldCount = aContact.Fields().FieldCount(); + for ( TInt i = ENameFirstPart; i <= ENameSecondPart && i < fieldCount; ++i) + { + const MVPbkBaseContactField& field = aContact.Fields().FieldAt( i ); + if ( iNameFormatter.IsTitleField( field ) ) + { + const MVPbkContactFieldData& fieldData = field.FieldData(); + if ( fieldData.DataType() == EVPbkFieldStorageTypeText ) + { + const TDesC& fieldText = MVPbkContactFieldTextData::Cast( fieldData ).Text(); + TInt length = fieldText.Length(); + + if ( length > 0 ) + { + TInt firstNonSpaceChar = 0; + while ( firstNonSpaceChar < length + && TChar( fieldText[firstNonSpaceChar] ).IsSpace() ) + { + ++firstNonSpaceChar; + } + if ( firstNonSpaceChar != length ) + { + result = EFalse; + break; + } + } + } + } + } + return result; + } // End of File diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -717,16 +717,20 @@ // CPbk2FetchDlg::FetchDlgPageChangedL // -------------------------------------------------------------------------- // -void CPbk2FetchDlg::FetchDlgPageChangedL( MPbk2FetchDlgPage& /*aPage*/ ) +void CPbk2FetchDlg::FetchDlgPageChangedL( MPbk2FetchDlgPage& aPage ) { - // An view event burst from VPbk results this function being called - // several times a row. It is not meaningful to restore selections - // every time, but instead wait for a while and restore the selections - // after all events have been received. Hence the idle object is used. delete iSelectionRestorer; iSelectionRestorer = NULL; - iSelectionRestorer = CIdle::NewL( CActive::EPriorityIdle ); - iSelectionRestorer->Start( TCallBack( RestoreSelections, this )); + + if ( aPage.DlgPageReady() ) + { + // An view event burst from VPbk results this function being called + // several times a row. It is not meaningful to restore selections + // every time, but inste ad wait for a while and restore the selections + // after all events have been received. Hence the idle object is used. + iSelectionRestorer = CIdle::NewL( CActive::EPriorityIdle ); + iSelectionRestorer->Start( TCallBack( RestoreSelections, this )); + } } // -------------------------------------------------------------------------- diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -834,7 +834,7 @@ // Skip the line if Email field not supported or having no mailbox if ( aSelectorID == VPbkFieldTypeSelectorFactory::EEmailEditorSelector ) { - if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) || !HasMailboxAccountsL() ) + if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) ) { ret = EFalse; } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/data/ccappcommlauncherpluginrsc.rss Mon Jun 21 15:24:27 2010 +0300 @@ -264,6 +264,6 @@ RESOURCE TBUF r_qtn_phob_popup_incomplete_address { buf = qtn_phob_popup_incomplete_address; } RESOURCE TBUF r_qtn_phob_commlauncher_onelinepreview { buf = qtn_phob_commlauncher_onelinepreview; } RESOURCE TBUF r_qtn_cca_voip_call_with_servicename { buf = qtn_cca_voip_call_single_service; } -RESOURCE TBUF r_qtn_cca_ftu_discover { buf = qtn_cca_ftu_discover; } +RESOURCE TBUF r_qtn_cca_social_networks { buf = qtn_cca_social_networks; } RESOURCE TBUF r_qtn_cca_error_note_maps_not_found { buf = qtn_cca_error_note_maps_not_found; } //End of File diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/inc/ccappcommlaunchercontainer.h Mon Jun 21 15:24:27 2010 +0300 @@ -18,7 +18,6 @@ #ifndef __CCAPPCOMMALAUNCHERCONTAINER_H #define __CCAPPCOMMALAUNCHERCONTAINER_H - // INCLUDES #include "ccappcommlauncherheaders.h" #include @@ -238,6 +237,11 @@ * @since S60 v5.0 */ void CreateListboxControlL(); + + /** + * Creates the status control + */ + void CreateStatusControlL(); /** * Updates the number/address popup @@ -275,11 +279,6 @@ * availability. */ void DoCheckExtensionFactoryL(); - - /** - * Set default status text to CCCAppStatusControl - */ - void SetDefaultStatusTextL(); private: // Constructors diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchercontainer.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -85,86 +85,10 @@ // Create the header iHeaderCtrl = CCCAppCommLauncherHeaderControl::NewL( iPlugin ); iHeaderCtrl->SetContainerWindowL(*this); - - FeatureManager::InitializeLibL(); - if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) - { - MVPbkContactLink* link = NULL; - MVPbkContactLinkArray* contactArray = NULL; - TInt isSame = KErrNotFound; - - iAppServices = CPbk2ApplicationServices::InstanceL(); - iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), - iAppServices->StoreManager(), - CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); - - HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); - HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); - TPtr8 contactData8Ptr( contactData8->Des() ); - contactData8Ptr.Copy( contactData.Des() ); - - CVPbkContactManager* vPbkContactManager = &iAppServices->ContactManager(); - - if( vPbkContactManager ) - { - contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); - - if( contactArray->Count() > 0 ) - { - link = contactArray->At( 0 ).CloneLC(); - } - - if ( link ) - { - const MVPbkContactStoreProperties& storeProperties = link->ContactStore().StoreProperties(); - TVPbkContactStoreUriPtr uri = storeProperties.Uri(); - - isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), - TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); - } - } - - if( isSame == 0 ) - { - iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this ); - iStatusControl->SetContainerWindowL( *this ); - iStatusControl->MakeVisible( EFalse ); - iHeaderCtrl->SetStatusButtonVisibility( EFalse ); - CFbsBitmap* bmp = NULL; - CFbsBitmap* bmpMask = NULL; - - AknsUtils::CreateIconL( - AknsUtils::SkinInstance(), - KAknsIIDQgnPropWmlBmOvi, - bmp, - bmpMask, - KCcaIconDefaultFileName, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); - - CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); - iStatusControl->SetDefaultStatusIconL( guiIcon ); - iStatusControl->SetContactLinkL( *link ); - - iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); - TCallBack callBack( CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); - iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); - } - - if( link ) - { - CleanupStack::PopAndDestroy(); //link - } - - if( contactArray ) - { - CleanupStack::PopAndDestroy(); // contactArray - } - - CleanupStack::PopAndDestroy(); // contactData8 - } // KFeatureIdFfContactsSocial - FeatureManager::UnInitializeLib(); - + + // create status control + CreateStatusControlL(); + // Get the skin background for the view iBackground = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgAreaMain, TRect(0, 0, 0, 0), EFalse); @@ -198,6 +122,108 @@ iListBox->ActivateL(); } +//----------------------------------------------------------------------------- +// CCCAppCommLauncherContainer::CreateStatusControlL() +//----------------------------------------------------------------------------- +// +void CCCAppCommLauncherContainer::CreateStatusControlL() + { + FeatureManager::InitializeLibL(); + const TBool isFeatureIdFfContactsSocial = + FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ); + FeatureManager::UnInitializeLib(); + + if( isFeatureIdFfContactsSocial ) + { + MVPbkContactLink* link = NULL; + MVPbkContactLinkArray* contactArray = NULL; + TInt isSame = KErrNotFound; + + if( !iAppServices ) + { + iAppServices = CPbk2ApplicationServices::InstanceL(); + } + if( !iProvider ) + { + iProvider = CSpbContentProvider::NewL( iAppServices->ContactManager(), + iAppServices->StoreManager(), + CSpbContentProvider::EStatusMessage | + CSpbContentProvider::EServiceIcon ); + } + HBufC& contactData = iPlugin.AppEngine()->Parameter().ContactDataL(); + HBufC8* contactData8 = HBufC8::NewLC( contactData.Size() ); + TPtr8 contactData8Ptr( contactData8->Des() ); + contactData8Ptr.Copy( contactData.Des() ); + + CVPbkContactManager* vPbkContactManager = + &iAppServices->ContactManager(); + + if( vPbkContactManager ) + { + contactArray = vPbkContactManager->CreateLinksLC( contactData8Ptr ); + + if( contactArray->Count() > 0 ) + { + link = contactArray->At( 0 ).CloneLC(); + } + + if ( link ) + { + const MVPbkContactStoreProperties& storeProperties = + link->ContactStore().StoreProperties(); + TVPbkContactStoreUriPtr uri = storeProperties.Uri(); + + isSame = uri.Compare( VPbkContactStoreUris::DefaultCntDbUri(), + TVPbkContactStoreUriPtr::EContactStoreUriAllComponents ); + } + } + + if( isSame == 0 ) + { + iStatusControl = CCCAppStatusControl::NewL( *iProvider, *this, CCCAppStatusControl::ENormalContact ); + iStatusControl->SetContainerWindowL( *this ); + iStatusControl->MakeVisible( EFalse ); + iHeaderCtrl->SetStatusButtonVisibility( EFalse ); + CFbsBitmap* bmp = NULL; + CFbsBitmap* bmpMask = NULL; + + AknsUtils::CreateIconL( + AknsUtils::SkinInstance(), + KAknsIIDQgnPropSocialCommunities, + bmp, + bmpMask, + KCcaIconDefaultFileName, + EMbmPhonebook2eceQgn_prop_social_communities, + EMbmPhonebook2eceQgn_prop_social_communities_mask ); + + CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); + iStatusControl->SetDefaultStatusIconL( guiIcon ); + HBufC* defaultText = + StringLoader::LoadL( R_QTN_CCA_SOCIAL_NETWORKS ); + iStatusControl->SetDefaultStatusTextL( defaultText ); + iStatusControl->SetContactLinkL( *link ); + + iFactoryExtensionNotifier = CCCaFactoryExtensionNotifier::NewL(); + TCallBack callBack( + CCCAppCommLauncherContainer::CheckExtensionFactoryL, this ); + iFactoryExtensionNotifier->ObserveExtensionFactoryL( callBack ); + } + + if( link ) + { + CleanupStack::PopAndDestroy(); //link + } + + if( contactArray ) + { + CleanupStack::PopAndDestroy(); // contactArray + } + + CleanupStack::PopAndDestroy(); // contactData8 + } // KFeatureIdFfContactsSocial + } + + // ---------------------------------------------------------------------------- // CCCAppCommLauncherContainer::Draw() // ---------------------------------------------------------------------------- @@ -637,11 +663,6 @@ iHeaderCtrl->ContactFieldFetchedNotifyL(aContactField); // Forwarding to listbox-model iModel->ContactFieldFetchedNotifyL(aContactField); - - if( iStatusControl && iStatusControl->IsVisible() ) - { - SetDefaultStatusTextL(); - } } // ---------------------------------------------------------------------------- @@ -665,11 +686,6 @@ iListBox->DrawDeferred(); iMdlRowCount = mdlCount; - - if( iStatusControl && iStatusControl->IsVisible() ) - { - SetDefaultStatusTextL(); - } } // --------------------------------------------------------------------------- @@ -722,6 +738,15 @@ iModel->Reset(); iListBox->HandleItemRemovalL(); iHeaderCtrl->ClearL(); + + if (!iStatusControl && iPlugin.ContactHandler().ContactStore() == ECmsContactStorePbk) + { + // create status control + CreateStatusControlL(); + //reset control's rect + SizeChanged(); + } + } // --------------------------------------------------------------------------- @@ -800,28 +825,6 @@ return *iLongTapDetector; } -// -------------------------------------------------------------------------- -// CCCAppCommLauncherContainer::SetDefaultStatusTextL -// -------------------------------------------------------------------------- -// -void CCCAppCommLauncherContainer::SetDefaultStatusTextL() - { - TPtrC fullName; - iPlugin.ContactHandler().ContactFieldItemDataL( - CCmsContactFieldItem::ECmsFullName, - fullName ); - - if( fullName.Size() == 0 ) - { - return; - } - - HBufC* defaultStatusText = StringLoader::LoadL( - R_QTN_CCA_FTU_DISCOVER, fullName, iCoeEnv ); - - iStatusControl->SetDefaultStatusTextL( defaultStatusText ); - } - //----------------------------------------------------------------------------- // CCCAppCommLauncherContainer::StatusClicked() //----------------------------------------------------------------------------- @@ -857,8 +860,11 @@ void CCCAppCommLauncherContainer::DoCheckExtensionFactoryL() { CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); + + MCCAStatusProvider* ccaStatusProvider = NULL; + // if extension is not null, extensionfactory plugins are available -> - // show statuscontrol + // show statuscontrol if( extension ) { if ( !iViewLauncher ) @@ -866,7 +872,24 @@ iViewLauncher = extension->CreateViewLauncherL(); } if( iStatusControl ) - { + { + if( extension ) + { + TAny* factoryExtension = extension->FactoryExtension( KCCAExtensionFactoryStatusProviderCreatorUid ); + + if( factoryExtension ) + { + MCCAExtensionFactoryStatusProviderCreator* statusProviderCreator = + static_cast( factoryExtension ); + + if( statusProviderCreator ) + { + ccaStatusProvider = statusProviderCreator->CreateStatusProviderL(); + } + } + } + + iStatusControl->SetStatusProvider( ccaStatusProvider ); iStatusControl->MakeVisible( ETrue ); iHeaderCtrl->SetStatusButtonVisibility( ETrue ); } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlauncherlpadmodel.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -953,6 +953,7 @@ void CCCAppCommLauncherLPadModel::Reset() { iButtonDataArray.Reset(); + iAddressFields.Close(); iButtonIconArray->ResetAndDestroy(); } @@ -1248,6 +1249,8 @@ HBufC* formattedText = NULL; TBool street = EFalse; TBool local = EFalse; + TBool region = EFalse; + TBool country = EFalse; TPtrC* text = iAddressFields.Find( EAddressStreet ); if ( text ) @@ -1262,15 +1265,49 @@ local = ETrue; } - if ( street && local ) + text = iAddressFields.Find( EAddressCountry ); + if( text ) + { + fields->AppendL( *text ); + country = ETrue; + } + else + { + country = EFalse; + fields->AppendL(KNullDesC16); + } + + text = iAddressFields.Find( EAddressRegion ); + if ( text ) + { + fields->AppendL( *text ); + region = ETrue; + } + else + { + region = EFalse; + fields->AppendL(KNullDesC16); + } + + + if ( street && local) { formattedText = StringLoader::LoadLC( R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); } + else if( street && country ) + { + formattedText = StringLoader::LoadLC( + R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); + } + else if( region || country ) + { + formattedText = StringLoader::LoadLC( + R_QTN_PHOB_COMMLAUNCHER_ONELINEPREVIEW, *fields ); + } else { - formattedText = StringLoader::LoadLC( - R_QTN_PHOB_POPUP_INCOMPLETE_ADDRESS ); + formattedText = KNullDesC16().AllocLC(); } tempText.Append( *formattedText ); diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp --- a/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccacommlauncherplugin/src/ccappcommlaunchermenuhandler.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -558,6 +558,9 @@ // Update the commlauncher the UI contact data iPlugin.ContactHandler().RefetchContactL(); iPlugin.Container().ContactsChangedL(); + + //Update the Store + SetContactStore(iPlugin.ContactHandler().ContactStore()); } if (errParam) diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/data/ccappmycardpluginrsc.rss Mon Jun 21 15:24:27 2010 +0300 @@ -199,9 +199,9 @@ // r_qtn_cca_mc_my_card_in_ovi // --------------------------------------------------------------------------- // -RESOURCE TBUF r_qtn_cca_mc_my_card_in_ovi +RESOURCE TBUF r_qtn_cca_social_networks { - buf = qtn_cca_mc_my_card_in_ovi; + buf = qtn_cca_social_networks; } // --------------------------------------------------------------------------- diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardcontainer.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -445,6 +445,8 @@ { CCCAExtensionFactory* extension = iFactoryExtensionNotifier->ExtensionFactory(); TBool visible = EFalse; + MCCAStatusProvider* ccaStatusProvider = NULL; + if( extension ) { if ( !iViewLauncher ) @@ -462,11 +464,29 @@ delete iViewLauncher; iViewLauncher = NULL; } + + CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); - CCCAppStatusControl* statusControl = iHeaderCtrl->StatusControl(); if( statusControl ) { - statusControl->MakeVisible( visible ); + if( extension ) + { + TAny* factoryExtension = extension->FactoryExtension( KCCAExtensionFactoryStatusProviderCreatorUid ); + + if( factoryExtension ) + { + MCCAExtensionFactoryStatusProviderCreator* statusProviderCreator = + static_cast( factoryExtension ); + + if( statusProviderCreator ) + { + ccaStatusProvider = statusProviderCreator->CreateStatusProviderL(); + } + } + } + + statusControl->SetStatusProvider( ccaStatusProvider ); + statusControl->MakeVisible( visible ); LayoutControls(); DrawDeferred(); } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp --- a/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccamycardplugin/src/ccappmycardheadercontrol.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -81,12 +81,16 @@ CVPbkContactManager& contactManager = iAppServices->ContactManager(); FeatureManager::InitializeLibL(); - if( FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ) ) - { + const TBool isFeatureIdFfContactsSocial = + FeatureManager::FeatureSupported( KFeatureIdFfContactsSocial ); + FeatureManager::UnInitializeLib(); + + if( isFeatureIdFfContactsSocial ) + { iProvider = CSpbContentProvider::NewL( contactManager, iAppServices->StoreManager(), CSpbContentProvider::EStatusMessage | CSpbContentProvider::EServiceIcon ); - iStatusControl = CCCAppStatusControl::NewL( *iProvider, aObserver ); + iStatusControl = CCCAppStatusControl::NewL( *iProvider, aObserver, CCCAppStatusControl::EMyCardContact ); iStatusControl->SetContainerWindowL( *this ); iStatusControl->MakeVisible( EFalse ); @@ -95,19 +99,18 @@ AknsUtils::CreateIconL( AknsUtils::SkinInstance(), - KAknsIIDQgnPropWmlBmOvi, + KAknsIIDQgnPropSocialCommunities, bmp, bmpMask, KMyCardIconDefaultFileName, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi, - EMbmPhonebook2eceQgn_prop_wml_bm_ovi_mask ); + EMbmPhonebook2eceQgn_prop_social_communities, + EMbmPhonebook2eceQgn_prop_social_communities_mask ); CGulIcon* guiIcon = CGulIcon::NewL( bmp, bmpMask ); iStatusControl->SetDefaultStatusIconL( guiIcon ); - HBufC* defaultText = StringLoader::LoadL( R_QTN_CCA_MC_MY_CARD_IN_OVI ); + HBufC* defaultText = StringLoader::LoadL( R_QTN_CCA_SOCIAL_NETWORKS ); iStatusControl->SetDefaultStatusTextL( defaultText ); } - FeatureManager::UnInitializeLib(); // Create portrait image diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/bwinscw/ccapputilu.def Mon Jun 21 15:24:27 2010 +0300 @@ -19,8 +19,8 @@ ?OfferKeyEventL@CCCAppViewPluginAknContainer@@MAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 18 NONAME ; enum TKeyResponse CCCAppViewPluginAknContainer::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode) ?Release@CCCAppCmsContactFetcherWrapper@@QAEXXZ @ 19 NONAME ; void CCCAppCmsContactFetcherWrapper::Release(void) ?RemoveObserver@CCCAppCmsContactFetcherWrapper@@QAEXAAVMCCAppContactFieldDataObserver@@@Z @ 20 NONAME ; void CCCAppCmsContactFetcherWrapper::RemoveObserver(class MCCAppContactFieldDataObserver &) - ?SetTitleL@CCCAppViewPluginAknView@@QAEXABVTDesC16@@@Z @ 21 NONAME ; void CCCAppViewPluginAknView::SetTitleL(class TDesC16 const &) - ?NewL@CCCAppStatusControl@@SAPAV1@AAVCSpbContentProvider@@AAVMCCAStatusControlObserver@@@Z @ 22 NONAME ; class CCCAppStatusControl * CCCAppStatusControl::NewL(class CSpbContentProvider &, class MCCAStatusControlObserver &) + ?SetTitleL@CCCAppViewPluginAknView@@QAEXABVTDesC16@@@Z @ 21 NONAME ; void CCCAppViewPluginAknView::SetTitleL(class TDesC16 const &) + ?NewL@CCCAppStatusControl@@SAPAV1@AAVCSpbContentProvider@@AAVMCCAStatusControlObserver@@W4TContactType@1@@Z @ 22 NONAME ; class CCCAppStatusControl * CCCAppStatusControl::NewL(class CSpbContentProvider &, class MCCAStatusControlObserver &, enum CCCAppStatusControl::TContactType) ?SetContactLinkL@CCCAppStatusControl@@QAEXAAVMVPbkContactLink@@@Z @ 23 NONAME ; void CCCAppStatusControl::SetContactLinkL(class MVPbkContactLink &) ?NewL@CCCaFactoryExtensionNotifier@@SAPAV1@XZ @ 24 NONAME ; class CCCaFactoryExtensionNotifier * CCCaFactoryExtensionNotifier::NewL(void) ?ObserveExtensionFactoryL@CCCaFactoryExtensionNotifier@@QAEXAAVTCallBack@@@Z @ 25 NONAME ; void CCCaFactoryExtensionNotifier::ObserveExtensionFactory(class TCallBack &) @@ -30,3 +30,5 @@ ?SetDefaultStatusTextL@CCCAppStatusControl@@QAEXPAVHBufC16@@@Z @ 29 NONAME ; void CCCAppStatusControl::SetDefaultStatusTextL(class HBufC16 *) ?SetDefaultStatusIconL@CCCAppStatusControl@@QAEXPAVCGulIcon@@@Z @ 30 NONAME ; void CCCAppStatusControl::SetDefaultStatusIcon(class CGulIcon *) ?IsTopContact@CCCAppCmsContactFetcherWrapper@@QAEHXZ @ 31 NONAME ; int CCCAppCmsContactFetcherWrapper::IsTopContact(void) + ?SetStatusProvider@CCCAppStatusControl@@QAEXPAVMCCAStatusProvider@@@Z @ 32 NONAME ; void CCCAppStatusControl::SetStatusProvider(class MCCAStatusProvider *) + diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/eabi/ccapputilu.def Mon Jun 21 15:24:27 2010 +0300 @@ -31,7 +31,7 @@ _ZTV28CCCAppViewPluginAknContainer @ 30 NONAME ; ## _ZTV30CCCAppCmsContactFetcherWrapper @ 31 NONAME ; ## _ZN19CCCAppStatusControl15SetContactLinkLER16MVPbkContactLink @ 32 NONAME - _ZN19CCCAppStatusControl4NewLER19CSpbContentProviderR25MCCAStatusControlObserver @ 33 NONAME + _ZN19CCCAppStatusControl4NewLER19CSpbContentProviderR25MCCAStatusControlObserverNS_12TContactTypeE @ 33 NONAME _ZN28CCCaFactoryExtensionNotifier16ExtensionFactoryEv @ 34 NONAME _ZN28CCCaFactoryExtensionNotifier24ObserveExtensionFactoryLER9TCallBack @ 35 NONAME _ZN28CCCaFactoryExtensionNotifier4NewLEv @ 36 NONAME @@ -40,4 +40,4 @@ _ZN19CCCAppStatusControl21SetDefaultStatusTextLEP7HBufC16 @ 39 NONAME _ZN19CCCAppStatusControl21SetDefaultStatusIconLEP8CGulIcon @ 40 NONAME _ZN30CCCAppCmsContactFetcherWrapper12IsTopContactEv @ 41 NONAME - + _ZN19CCCAppStatusControl17SetStatusProviderEP18MCCAStatusProvider @ 42 NONAME diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/inc/ccappstatuscontrol.h Mon Jun 21 15:24:27 2010 +0300 @@ -22,6 +22,8 @@ // INCLUDES #include #include +#include + // FORWARD DECLARATIONS class CEikImage; @@ -55,20 +57,29 @@ */ NONSHARABLE_CLASS( CCCAppStatusControl ) : public CCoeControl, - public MSpbContentProviderObserver + public MSpbContentProviderObserver, + public MCCAStatusProviderObserver { public: // Construction & destruction + + enum TContactType + { + ENormalContact = 0x01, + EMyCardContact = 0x02 + }; + /** * Two-phased constructor. */ IMPORT_C static CCCAppStatusControl* NewL( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ); + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ); /** * Destructor. */ - ~CCCAppStatusControl(); + ~CCCAppStatusControl(); public: // New implementation @@ -100,7 +111,14 @@ * @aDefaultStatusText Default status text */ IMPORT_C void SetDefaultStatusTextL( HBufC* aDefaultStatusText ); - + + /** + * Set the CCA statusprovider + * + * @aCCAStatusProvider ECom status provider + */ + IMPORT_C void SetStatusProvider( MCCAStatusProvider* aCCAStatusProvider ); + public: // From CCoeControl /** @@ -142,6 +160,15 @@ MVPbkContactLink& aLink, MSpbContentProviderObserver::TSpbContentEvent aEvent ); +public: // From MCCAStatusProviderObserver + + /* + * From MCCAStatusProviderObserver + */ + void StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink = NULL ); + private: // New functions /** @@ -164,6 +191,12 @@ MVPbkContactLink& aLink, MSpbContentProviderObserver::TSpbContentEvent aEvent ); + /* + * Update contact status from ECom plugin + * @param aLink contact which has the status updated + */ + void UpdateCCAStatusL( MVPbkContactLink* aLink ); + void SetVariableLayouts( TInt aOption ); inline void RewrapStatusTextToArrayL( @@ -177,7 +210,8 @@ */ CCCAppStatusControl( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ); + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ); /** * Constructor for performing 2nd stage construction @@ -267,6 +301,12 @@ * Current control state. */ TStatusControlState iState; + + // Own. ECOM plugin tatus provider + MCCAStatusProvider* iCCAStatusProvider; + + // Current contact type. + CCCAppStatusControl::TContactType iContactType; }; #endif // CCAPPSTATUSCONTROL_H_ diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp --- a/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/ccapplication/ccapp/ccapputil/src/ccappstatuscontrol.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -60,13 +60,11 @@ CFbsBitmap* mask = aIcon->Mask(); if( bitmap ) { - AknIconUtils::SetSize( - bitmap, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); + AknIconUtils::SetSize( bitmap, aSize ); } if( mask ) { - AknIconUtils::SetSize( - mask, aSize, EAspectRatioPreservedAndUnusedSpaceRemoved ); + AknIconUtils::SetSize( mask, aSize ); } } } @@ -79,10 +77,11 @@ // EXPORT_C CCCAppStatusControl* CCCAppStatusControl::NewL( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ) + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ) { CCCAppStatusControl* self= new(ELeave) CCCAppStatusControl( - aContentProvider, aObserver ); + aContentProvider, aObserver, aContactType ); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -95,10 +94,12 @@ // CCCAppStatusControl::CCCAppStatusControl( CSpbContentProvider& aContentProvider, - MCCAStatusControlObserver& aObserver ) : + MCCAStatusControlObserver& aObserver, + CCCAppStatusControl::TContactType aContactType ) : iContentProvider( aContentProvider ), iObserver( aObserver ), - iState( EStateUndefined ) + iState( EStateUndefined ), + iContactType( aContactType ) { } @@ -151,8 +152,15 @@ { iTouchFeedBack->RemoveFeedbackForControl( this ); } - iContentProvider.RemoveObserver( *this ); + + iContentProvider.RemoveObserver( *this ); + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + } + + delete iCCAStatusProvider; delete iStatusImage; delete iStatusIcon; delete iStatusLabel1; @@ -241,6 +249,22 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::SetStatusProvider +// --------------------------------------------------------------------------- +// +EXPORT_C void CCCAppStatusControl::SetStatusProvider( MCCAStatusProvider* aCCAStatusProvider ) + { + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + delete iCCAStatusProvider; + iCCAStatusProvider = NULL; + } + + iCCAStatusProvider = aCCAStatusProvider; + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::CountComponentControls // --------------------------------------------------------------------------- // @@ -436,6 +460,21 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::StatusEvent +// --------------------------------------------------------------------------- +// +void CCCAppStatusControl::StatusEvent( + MCCAStatusProviderObserver::TCCAStatusProviderObserverEvent aEvent, + const MVPbkContactLink* aLink ) + { + if( iCCAStatusProvider && aEvent == MCCAStatusProviderObserver::EStatusChanged && + iLink && aLink && iLink->IsSame( *aLink ) ) + { + UpdateCCAStatusL( iLink ); + } + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::DoStatusUpdateL // --------------------------------------------------------------------------- // @@ -444,10 +483,23 @@ { if( aEvent == EContentNotAvailable ) { - ShowDefaultContentL(); + if( iCCAStatusProvider ) + { + UpdateCCAStatusL( &aLink ); + TRAP_IGNORE( iCCAStatusProvider->AddObserverL( *this ) ); + } + else + { + ShowDefaultContentL(); + } } else if( iLink && iLink->IsSame( aLink ) ) { + if( iCCAStatusProvider ) + { + iCCAStatusProvider->RemoveObserver( *this ); + } + iState = EStateStatusContent; delete iStatusText; iStatusText = NULL; @@ -488,6 +540,55 @@ } // --------------------------------------------------------------------------- +// CCCAppStatusControl::UpdateCCAStatusL +// --------------------------------------------------------------------------- +// +void CCCAppStatusControl::UpdateCCAStatusL( MVPbkContactLink* aLink ) + { + if( aLink && iCCAStatusProvider ) + { + delete iStatusText; + iStatusText = NULL; + delete iStatusIcon; + iStatusIcon = NULL; + + if( iContactType == ENormalContact ) + { + iCCAStatusProvider->GetStatusInformationL( + *aLink, + iStatusText, + iStatusIcon ); + } + else if( iContactType == EMyCardContact ) + { + iCCAStatusProvider->GetMyCardStatusInformationL( + *aLink, + iStatusText, + iStatusIcon ); + } + + if( !iStatusIcon ) + { + iStatusIcon = CreateEmptyIconL(); + } + + ReSizeIcon( iStatusIcon, iStatusIconSize ); + iStatusImage->SetPicture( iStatusIcon->Bitmap(), iStatusIcon->Mask() ); + iStatusImage->MakeVisible( ETrue ); + + const TInt count( RewrapStatusTextL() ); + TInt option( 1 ); + if( count > 1 ) + { + option = 0; + } + SetVariableLayouts( option ); + + DrawDeferred(); + } + } + +// --------------------------------------------------------------------------- // CCCAppStatusControl::RewrapStatusTextToArrayL // --------------------------------------------------------------------------- // diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/conf/phonebook2.confml Binary file phonebookui/Phonebook2/conf/phonebook2.confml has changed diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/conf/phonebook2_101f8794.crml Binary file phonebookui/Phonebook2/conf/phonebook2_101f8794.crml has changed diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/group/iconlistece.txt --- a/phonebookui/Phonebook2/group/iconlistece.txt Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/group/iconlistece.txt Mon Jun 21 15:24:27 2010 +0300 @@ -29,8 +29,9 @@ /c8,8 qgn_prop_pb_comm_valid_lm_large.svg /c8,8 qgn_prop_locev_map.svg /c8,8 qgn_prop_pb_no_valid_lm.svg -/c8,8 qgn_prop_wml_bm_ovi.svg +/c8,8 qgn_prop_social_communities.svg /c8,8 qgn_indi_many_items_add.svg /c8,8 qgn_prop_pb_thump_mycard.svg /c8,8 qgn_prop_pb_add_top.svg /c8,8 qgn_prop_pb_topc.svg + diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h --- a/phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/inc/Phonebook2InternalCRKeys.h Mon Jun 21 15:24:27 2010 +0300 @@ -24,6 +24,7 @@ // -------------------------------------------------------------------------- // const TUint32 KCRUidPhonebookInternalConfig = 0x101f884a; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KCRUidPhonebookStoreConfiguration = 0x1020727f; // -------------------------------------------------------------------------- @@ -42,7 +43,9 @@ /// Current configuration key range 0x00000100 to 0x000001ff const TUint32 KPhonebookCurrentConfigurationFirstKey = 0x00000100; const TUint32 KPhonebookCurrentConfigurationLastKey = 0x000001ff; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KPhonebookCurrentConfigurationPartialKey = 0x00000100; +// value redefined and used also in CVPbkPhoneNumberMatchStrategy.cpp const TUint32 KPhonebookCurrentConfigurationMask = 0xffffff00; /// Possible configuration key range 0x00000200 to 0x000002ff diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h --- a/phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/inc/Phonebook2PrivateCRKeys.h Mon Jun 21 15:24:27 2010 +0300 @@ -39,6 +39,7 @@ const TUint32 KPhonebookAddFavoritiesVisibility = 0x00000006; const TUint32 KPhonebooksXPExtensionPluginsName = 0x00000007; const TUint32 KPhonebookPredictiveSearchEnablerFlags = 0x00000008; +const TUint32 KPhonebookStatusMessageVisibility = 0x00000009; #endif // PHONEBOOK2PRIVATECRKEYS_H diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp --- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbk2remotecontactlookupaccounts.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -122,12 +122,29 @@ // The actual ECom loading is implemented in CPbkxRemoteContactLookupProtocolAdapter. for ( TInt i = 0; i < implArray.Count(); i++ ) { - CPbkxRemoteContactLookupProtocolAdapter* adapter = NULL; - adapter = CPbkxRemoteContactLookupProtocolAdapter::NewL( - implArray[i]->ImplementationUid(), *iProtocolEnv ); - CleanupStack::PushL( adapter ); - User::LeaveIfError( iAdapters.Append( adapter ) ); - CleanupStack::Pop( adapter ); + CPbkxRemoteContactLookupProtocolAdapter* volatile adapter = NULL; + + // Trap the error code of loading one specific protocal adapter, if the error is not + // extremly harmful like "No memory", then go on loading remaining possibly working + // adapters. + TRAPD(err, + { + adapter = CPbkxRemoteContactLookupProtocolAdapter::NewL( + implArray[i]->ImplementationUid(), *iProtocolEnv ); + } + ); + + if( err == KErrNoMemory ) + { + User::Leave( KErrNoMemory ); + } + + if ( adapter ) + { + CleanupStack::PushL( adapter ); + User::LeaveIfError( iAdapters.Append( adapter ) ); + CleanupStack::Pop( adapter ); + } } CleanupStack::PopAndDestroy(); // cleanupItem } @@ -153,23 +170,32 @@ RPointerArray protocolAccountsTmp; TCleanupItem cleanupItemAcc(CleanupResetAndDestroyAccArray, &protocolAccountsTmp); CleanupStack::PushL(cleanupItemAcc); - adapter.GetAllProtocolAccountsL( protocolAccountsTmp ); + + TRAPD( err, + { + adapter.GetAllProtocolAccountsL( protocolAccountsTmp ); + } + ); + + if( err == KErrNoMemory ) + { + User::Leave( KErrNoMemory ); + } // Move accounts from temp array to main array // First expand the main array so that we can move ownership in one go. // TODO OOPS, METHOD NOT AVAILABLE iAdapters.SetReserveL( iAdapters.Count() + protocolAccountsTmp.Count() ); - - // Don't need the cleanup item anymore since iAdapters will take ownership, - // and the iAdapters has already been expanded. - CleanupStack::Pop(); // cleanupItemAcc - for ( TInt x = 0; x < protocolAccountsTmp.Count(); x++ ) + const TInt count = protocolAccountsTmp.Count(); + for ( TInt x = 0; x < count; x++ ) { // Ownership is passed - User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ x ] ) ); + User::LeaveIfError( aAccounts.Append( protocolAccountsTmp[ 0 ] ) ); + protocolAccountsTmp.Remove( 0 ); } - // just let protocolAccountsTmp pass out of scope. It doesn't own anything now. + + CleanupStack::PopAndDestroy( &protocolAccountsTmp ); } CleanupStack::Pop(); } diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp --- a/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/remotecontactlookup/engine/src/cpbkxrclsearchresultdlg.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -710,7 +710,8 @@ CEikStatusPane* statusPane = appUi->StatusPane(); // add the navigation decorators only if the usual statuspane layout is used - if ( statusPane->CurrentLayoutResId() == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT ) + if ( statusPane->CurrentLayoutResId() == R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT || + statusPane->CurrentLayoutResId() == R_AVKON_WIDESCREEN_PANE_LAYOUT_USUAL_FLAT ) { iNaviPane = reinterpret_cast( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); diff -r a6539d1e8e43 -r 34879f5cfc63 phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp --- a/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/phonebookui/Phonebook2/spbcontentprovider/src/spbphonenumberparser.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -109,94 +109,90 @@ // --------------------------------------------------------------------------- // void CSpbPhoneNumberParser::SolvePhoneNumberL( MVPbkStoreContact& aContact ) - { - RBuf number; - TInt numberCount = 0; - - // check if the contact has default a number - MVPbkContactAttributeManager& attributeManager = - iContactManager.ContactAttributeManagerL(); + { + RBuf number; + TInt numberCount = 0; - CVPbkDefaultAttribute* attribute = - CVPbkDefaultAttribute::NewL( EVPbkDefaultTypePhoneNumber ); - CleanupStack::PushL( attribute ); - - MVPbkStoreContactField* field = - attributeManager.FindFieldWithAttributeL( *attribute, aContact ); - if( field ) - { - const MVPbkContactFieldTextData* textData = - &MVPbkContactFieldTextData::Cast( field->FieldData() ); - number.CreateL( textData->Text() ); - } - CleanupStack::PopAndDestroy(); //attribute + // check if the contact has default a number + MVPbkContactAttributeManager& attributeManager = + iContactManager.ContactAttributeManagerL(); - // was the default number found? - if( number.Length() == 0 ) - { - CDesC16Array* phoneNumberArray = new (ELeave) CDesC16ArraySeg(8); - CleanupStack::PushL( phoneNumberArray ); - - // get contact fields - MVPbkStoreContactFieldCollection& fields = aContact.Fields(); - const TInt fieldCount = fields.FieldCount(); - // check fields - for ( TInt i = 0; i < fieldCount; ++i ) - { - const MVPbkStoreContactField& field = fields.FieldAt( i ); - // if correct data type - if( field.FieldData().DataType() == EVPbkFieldStorageTypeText ) - { - const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); - if( fieldType ) - { - const TInt fieldTypeResId = fieldType->FieldTypeResId(); - // if one of the number fields - if( fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEGEN || - fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEHOME || - fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEWORK || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEHOME || - fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK || - fieldTypeResId == R_VPBK_FIELD_TYPE_CARPHONE || - fieldTypeResId == R_VPBK_FIELD_TYPE_ASSTPHONE || - fieldTypeResId == R_VPBK_FIELD_TYPE_PAGERNUMBER ) - { - const MVPbkContactFieldTextData* textData = - &MVPbkContactFieldTextData::Cast( field.FieldData() ); - const TPtrC phoneNumber( textData->Text() ); - - // we need count phonenumbers same way how this is implemented in CCA - // so that we show same count for phonenumbers in names list - // CCA uses descriptor folded compare for phonenumbers - TInt dummy = 0; - if( 0 != phoneNumberArray->FindIsq( phoneNumber, dummy, ECmpFolded ) ) - { - // phone number doesn't exist - phoneNumberArray->InsertIsqL( phoneNumber, ECmpFolded ); - } - } - } - } - } - numberCount = phoneNumberArray->Count(); - // if only one number, store it - if( numberCount == 1 ) + CVPbkDefaultAttribute* attribute = + CVPbkDefaultAttribute::NewL( EVPbkDefaultTypePhoneNumber ); + CleanupStack::PushL( attribute ); + + TBool hasDefaultNumberField = EFalse; + CDesC16Array* phoneNumberArray = new (ELeave) CDesC16ArraySeg(8); + CleanupStack::PushL( phoneNumberArray ); + + // get contact fields + MVPbkStoreContactFieldCollection& fields = aContact.Fields(); + const TInt fieldCount = fields.FieldCount(); + // check fields + for ( TInt i = 0; i < fieldCount; ++i ) + { + const MVPbkStoreContactField& field = fields.FieldAt( i ); + // if correct data type + if( field.FieldData().DataType() == EVPbkFieldStorageTypeText ) { - number.CreateL( (*phoneNumberArray)[0] ); + const MVPbkFieldType* fieldType = field.BestMatchingFieldType(); + if( fieldType ) + { + const TInt fieldTypeResId = fieldType->FieldTypeResId(); + // if one of the number fields + if( fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEGEN || + fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEHOME || + fieldTypeResId == R_VPBK_FIELD_TYPE_LANDPHONEWORK || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEGEN || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEHOME || + fieldTypeResId == R_VPBK_FIELD_TYPE_MOBILEPHONEWORK || + fieldTypeResId == R_VPBK_FIELD_TYPE_CARPHONE || + fieldTypeResId == R_VPBK_FIELD_TYPE_ASSTPHONE || + fieldTypeResId == R_VPBK_FIELD_TYPE_PAGERNUMBER ) + { + const MVPbkContactFieldTextData* textData = + &MVPbkContactFieldTextData::Cast( field.FieldData() ); + if( attributeManager.HasFieldAttributeL( *attribute, field ) ) + { + //default number found + number.CreateL( textData->Text() ); + hasDefaultNumberField = ETrue; + break; + } + const TPtrC phoneNumber( textData->Text() ); + // we need count phonenumbers same way how this is implemented in CCA + // so that we show same count for phonenumbers in names list + // CCA uses descriptor folded compare for phonenumbers + TInt dummy = 0; + if( 0 != phoneNumberArray->FindIsq( phoneNumber, dummy, ECmpFolded ) ) + { + // phone number doesn't exist + phoneNumberArray->InsertIsqL( phoneNumber, ECmpFolded ); + } + } + } } - CleanupStack::PopAndDestroy( phoneNumberArray ); - } + } + numberCount = phoneNumberArray->Count(); + + //default number not found, and only one number + if( EFalse == hasDefaultNumberField && numberCount == 1 ) + { + number.CreateL( (*phoneNumberArray)[0] ); + } + + CleanupStack::PopAndDestroy( phoneNumberArray ); + CleanupStack::PopAndDestroy( attribute ); - // no number was found - if( numberCount > 1 ) - { + // no number was found + if( numberCount > 1 ) + { // contact has multiple numbers and no default TBuf<12> count; count.Num( numberCount ); iContent.PhoneNumberUpdatedL( count, CSpbContentProvider::ETypePhoneNumberMultiple ); - } + } else { // inform the observer @@ -204,8 +200,8 @@ number, CSpbContentProvider::ETypePhoneNumber ); } - number.Close(); - } + number.Close(); + } // --------------------------------------------------------------------------- // CSpbPhoneNumberParser::FetchPhoneNumber diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h --- a/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/inc/CPcsAdaptiveGrid.h Mon Jun 21 15:24:27 2010 +0300 @@ -89,6 +89,11 @@ * Print the Adaptive Grid */ void CPcsAdaptiveGrid::PrintAdatptiveGrid( ); + + /** + * Reset the grid + */ + void Reset(); private: diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsAdaptiveGrid.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -204,4 +204,13 @@ PRINT ( _L("CPcsAdaptiveGrid::PrintAdatptiveGrid: ----------------------------------------") ); } +// ---------------------------------------------------------------------------- +// CPcsAdaptiveGrid::Reset +// +// ---------------------------------------------------------------------------- +void CPcsAdaptiveGrid::Reset() + { + iAdaptiveGrid.ResetAndDestroy(); + } + // End of file diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp --- a/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsAlgorithm/Algorithm1/src/CPcsCache.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -90,7 +90,14 @@ } // Adaptive Grid map - iAdaptiveGridMap = CPcsAdaptiveGrid::NewL( ); + if ( iURI->Compare( KVPbkDefaultCntDbURI ) == 0 + || iURI->Compare( KVPbkSimGlobalAdnURI ) == 0 + || iURI->Compare( KVPbkSimGlobalFdnURI ) == 0 + || iURI->Compare( KVPbkSimGlobalSdnURI ) == 0 + || iURI->Compare( KVPbkDefaultGrpDbURI ) == 0 ) + { + iAdaptiveGridMap = CPcsAdaptiveGrid::NewL(); + } PRINT ( _L("End CPcsCache::ConstructL") ); } @@ -217,10 +224,13 @@ 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 ); + if ( iAdaptiveGridMap ) + { + // Set the 1st char of the word for the Adaptive Grid or + // increment the reference counter + TUint selector = GridItemSelector( dataIndex, unnamed ); + iAdaptiveGridMap->IncrementRefCounterL( firstChar, selector ); + } } CleanupStack::PopAndDestroy(words); @@ -359,7 +369,7 @@ } } - if ( data ) + if ( iAdaptiveGridMap && data ) { TBool unnamed = ETrue; // Parse thru each data element @@ -383,14 +393,12 @@ 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 - +#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 ); } } @@ -420,8 +428,10 @@ iMasterPool.ResetAndDestroy(); iCacheInfo.Close(); - delete iAdaptiveGridMap; - iAdaptiveGridMap = NULL; + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->Reset(); + } PRINT ( _L("End CPcsCache::RemoveAllFromCache") ); } @@ -434,7 +444,10 @@ { PRINT ( _L("Enter CPcsCache::GetAdaptiveGridL") ); - iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->GetAdaptiveGrid( aCompanyName, aAdaptiveGrid ); + } PRINT ( _L("End CPcsCache::GetAdaptiveGridL") ); } @@ -650,7 +663,11 @@ } iMasterPool.Reset(); iCacheInfo.Close(); - + if ( iAdaptiveGridMap ) + { + iAdaptiveGridMap->Reset(); + } + // Now add data again from the iMasterPoolBackup for (TInt i = 0; i < iMasterPoolBackup.Count(); i++ ) { diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsServer/group/PcsServer.mmp --- a/predictivesearch/PcsServer/group/PcsServer.mmp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsServer/group/PcsServer.mmp Mon Jun 21 15:24:27 2010 +0300 @@ -24,6 +24,7 @@ UID 0x1000008e 0x2000B5B6 SECUREID 0x2000B5B6 +EPOCSTACKSIZE 0x8000 EPOCHEAPSIZE 0x100000 0x1000000 EPOCPROCESSPRIORITY background diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsServer/inc/CPcsServer.h --- a/predictivesearch/PcsServer/inc/CPcsServer.h Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsServer/inc/CPcsServer.h Mon Jun 21 15:24:27 2010 +0300 @@ -58,6 +58,11 @@ */ CPcsPluginInterface* PluginInterface(); + /** + * Returns ETrue if there is Chinese variant feature in phone + */ + TBool IsChineseVariant() const; + private: /** @@ -80,6 +85,11 @@ * A PCS algorithm instance (owned) */ CPcsPluginInterface* iPcs; + + /** + * Flag for whether there is Chinese in phone + */ + TBool iIsChineseVariant; }; #endif // End of file diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsServer/src/CPcsServer.cpp --- a/predictivesearch/PcsServer/src/CPcsServer.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsServer/src/CPcsServer.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -70,11 +70,11 @@ iPcs = CPcsPluginInterface::NewL(); // Check if the phone is chinese feature id installed - TBool isChineseVariant = IsChineseFeatureInitilizedL(); + iIsChineseVariant = IsChineseFeatureInitilizedL(); // Create the plugin for the required algorithm // Matches the ECOM Plugin's display name definition in rss file // Check for the chinese feature id flag. - if(isChineseVariant) + if(iIsChineseVariant) { // Chinese variant phones. Use Algorithm 2 PRINT ( _L("Enter CPcsServer::ConstructL() - Chinese Variant Phone Algorithm Instantiated") ); @@ -151,3 +151,12 @@ return chineseFeatureInitialized; } + +// ---------------------------------------------------------------------------- +// CPcsServer::IsChineseVariant() const +// Returns ETrue if there is Chinese variant feature in phone +// ---------------------------------------------------------------------------- +TBool CPcsServer::IsChineseVariant() const + { + return iIsChineseVariant; + } diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/PcsServer/src/CPcsSession.cpp --- a/predictivesearch/PcsServer/src/CPcsSession.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/PcsServer/src/CPcsSession.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -254,10 +254,20 @@ RPointerArray searchResults; RPointerArray searchSeqs; - iServer->PluginInterface()->PerformSearchL(*iSettings, - *psQuery, - searchResults, - searchSeqs); + + if( !iServer->IsChineseVariant() ) + { + PRINT ( _L("----Algorithm1 search----") ); + iServer->PluginInterface()->PerformSearchL(*iSettings, + *psQuery, + searchResults, + searchSeqs); + } + else + { + PRINT ( _L("----Algorithm2 fake search----") ); + } + CleanupStack::PopAndDestroy( psQuery ); // Dynamic data buffer @@ -383,10 +393,18 @@ // To hold matched location RArray sequenceLoc; - iServer->PluginInterface()->SearchInputL(*psQuery, - *data, - searchSeqs, - sequenceLoc); + if( !iServer->IsChineseVariant() ) + { + PRINT ( _L("----Algorithm1 searchinput----") ); + iServer->PluginInterface()->SearchInputL(*psQuery, + *data, + searchSeqs, + sequenceLoc); + } + else + { + PRINT ( _L("----Algorithm2 fake searchinput----") ); + } // Delete the search query and search data CleanupStack::PopAndDestroy( data ); diff -r a6539d1e8e43 -r 34879f5cfc63 predictivesearch/adapters/contacts/src/cpcscontactstore.cpp --- a/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp Wed Jun 09 09:26:27 2010 +0300 +++ b/predictivesearch/adapters/contacts/src/cpcscontactstore.cpp Mon Jun 21 15:24:27 2010 +0300 @@ -332,8 +332,12 @@ iNextState = EFetchContactBlock; // Delay the next fetch since contact fetch is CPU intensive, // this will give other threads a chance to use CPU - iTimer.After( iStatus, KTimerInterval); // 100 milliseconds - SetActive(); + if(!IsActive()) + { + iTimer.After( iStatus, KTimerInterval); // 100 milliseconds + SetActive(); + } + } } @@ -361,8 +365,11 @@ iNextState = EFetchContactBlock; // Delay the next fetch since contact fetch is CPU intensive, // this will give other threads a chance to use CPU - iTimer.After( iStatus, KTimerInterval); // 100 milliseconds - SetActive(); + if(!IsActive()) + { + iTimer.After( iStatus, KTimerInterval); // 100 milliseconds + SetActive(); + } } PRINT ( _L("End CPcsContactStore::VPbkSingleContactOperationFailed") );