# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268401285 -7200 # Node ID 81f8547efd4f6bbb2364f55ab0c9b33cb3766bb2 # Parent 04ab22b956c2f7a41754069393281941521bffc0 Revision: 201007 Kit: 201008 diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Client/bwinscw/cmsclientu.def --- a/ccservices/cmsservices/cmsengine/Client/bwinscw/cmsclientu.def Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Client/bwinscw/cmsclientu.def Fri Mar 12 15:41:25 2010 +0200 @@ -40,4 +40,6 @@ ?UserIdentity@CCmsPresenceData@@QBE?AVTPtrC8@@XZ @ 39 NONAME ; class TPtrC8 CCmsPresenceData::UserIdentity(void) const ?Version@RCmsSession@@QBE?AVTVersion@@XZ @ 40 NONAME ; class TVersion RCmsSession::Version(void) const ?Info@CCmsContactFieldItem@@QBE?AVTPtrC16@@XZ @ 41 NONAME ; class TPtrC16 CCmsContactFieldItem::Info(void) const + ?IsTopContact@RCmsContact@@QAEHXZ @ 42 NONAME ; int RCmsContact::IsTopContact(void) + ?SetVoiceCallDefault@RCmsContact@@QBEXAAVTRequestStatus@@@Z @ 43 NONAME ; void RCmsContact::SetVoiceCallDefault(class TRequestStatus &) const diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Client/eabi/cmsclientu.def --- a/ccservices/cmsservices/cmsengine/Client/eabi/cmsclientu.def Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Client/eabi/cmsclientu.def Fri Mar 12 15:41:25 2010 +0200 @@ -58,4 +58,6 @@ _ZTV20CCmsContactFieldInfo @ 57 NONAME ; ## _ZTV20CCmsContactFieldItem @ 58 NONAME ; ## _ZNK20CCmsContactFieldItem4InfoEv @ 59 NONAME + _ZN11RCmsContact12IsTopContactEv @ 60 NONAME + _ZNK11RCmsContact19SetVoiceCallDefaultER14TRequestStatus @ 61 NONAME diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp --- a/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Client/src/cmscontact.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -282,6 +282,16 @@ } // ---------------------------------------------------- +// RCmsContact::SetVoiceCallDefault +// +// ---------------------------------------------------- +// +EXPORT_C void RCmsContact::SetVoiceCallDefault( TRequestStatus& aStatus ) const + { + SendReceive( ECmsSetVoiceCallDefault, TIpcArgs(), aStatus ); + } + +// ---------------------------------------------------- // RCmsContact::SendMessage // // ---------------------------------------------------- @@ -433,4 +443,21 @@ } } +// ---------------------------------------------------- +// RCmsContact::IsTopContact +// +// ---------------------------------------------------- +// +EXPORT_C TBool RCmsContact::IsTopContact() + { + #ifdef _DEBUG + RCmsSession::WriteToLog( _L8( "RCmsContact::IsTopContact()" ) ); + #endif + TInt isTop( EFalse ); + TPckg pack( isTop ); + SendReceive(ECmsIsTopContact, TIpcArgs(&pack)); + + return isTop; + } + diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Client/src/cmssession.cpp --- a/ccservices/cmsservices/cmsengine/Client/src/cmssession.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Client/src/cmssession.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -117,7 +117,7 @@ #ifdef _DEBUG RCmsSession::WriteToLog( _L8( "RCmsSession::IsRunning()" ) ); #endif - TFindServer findServer( KCmsServerName ); + TFindServer findServer( KCmsServerLib ); TFullName name; return ( findServer.Next( name ) == KErrNone ); } diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/group/cmsserver.mmp --- a/ccservices/cmsservices/cmsengine/Server/group/cmsserver.mmp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/group/cmsserver.mmp Fri Mar 12 15:41:25 2010 +0200 @@ -40,6 +40,7 @@ SOURCE cmsserverasynccontact.cpp SOURCE cmsserverxspcontacthandler.cpp SOURCE cmsfindlinkedcontact.cpp +SOURCE cmssetvoicecalldefault.cpp USERINCLUDE ../inc USERINCLUDE ../../inc diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/inc/cmscontactinterface.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmscontactinterface.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmscontactinterface.h Fri Mar 12 15:41:25 2010 +0200 @@ -37,7 +37,7 @@ EContactDeleted };*/ - virtual TBool OfferContactEventL( TCmsPhonebookEvent aEventType, + virtual void OfferContactEventL( TCmsPhonebookEvent aEventType, const MVPbkContactLink* aContactLink ) = 0; virtual void ContactReadyL( TInt error, MVPbkStoreContact* aContact ) = 0; @@ -52,6 +52,8 @@ virtual void HandleError( TInt aError ) = 0; + virtual void FetchContactL ( MVPbkContactLink* aContactLinkToFetch ) = 0; + }; #endif //__CMSCONTACTINTERFACE__ diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsphonebookproxy.h Fri Mar 12 15:41:25 2010 +0200 @@ -50,6 +50,7 @@ class CVPbkContactStoreUriArray; class CVPbkContactViewDefinition; class MVPbkContactFindFromStoresObserver; +class CmsSetVoiceCallDefault; /** * CCmsPhonebookProxy keeps all stores opened to speed up contact @@ -181,6 +182,11 @@ * Destructor */ ~CCmsPhonebookProxy(); + + /** + * Set default attribute for voice call + */ + void SetVoiceCallDefaultL(); public: @@ -316,6 +322,10 @@ RFs& iFileSessionHandle; /// Array to keep a list of installed xSP stores. Owned. CDesCArrayFlat ixSPStoresArray; + /// Default setting handle + CmsSetVoiceCallDefault* iSetDefault; + /// Store contact + MVPbkStoreContact* iContact; }; #endif //__CMSPHONEBOOKPROXY__ diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsservercontact.h Fri Mar 12 15:41:25 2010 +0200 @@ -23,6 +23,7 @@ // INCLUDES #include "cmscontact.h" #include +#include #include "bpasobserver.h" #include "cmscontactinterface.h" #include "mpresencetrafficlightsobs.h" @@ -48,7 +49,8 @@ NONSHARABLE_CLASS( CCmsServerContact ) : public CBase, public MBPASObserver, public MCmsContactInterface, - public MPresenceIconNotifier + public MPresenceIconNotifier, + public MVPbkSingleContactOperationObserver { public: @@ -180,6 +182,13 @@ */ void StartNextFindOperationL( TInt aNextFindStringPos ); + /** + * Checks whether the Current contact is top contact. + * + * @param aMessage Kernel message with client's data + */ + void IsTopContactL( const RMessage2& aMessage ); + private: /** @@ -349,13 +358,14 @@ private: //From MCmsContactInterface void ContactReadyL( TInt aError, MVPbkStoreContact* aContact ); - TBool OfferContactEventL( TCmsPhonebookEvent aEventType, + void OfferContactEventL( TCmsPhonebookEvent aEventType, const MVPbkContactLink* aContactLink ); const MVPbkStoreContact& Contact() const; TBool HandleField( HBufC* aFieldData ); TBool HandleField( HBufC8* aFieldData ); TBool HandleEnabledFields( HBufC* aEnabledFields ); void HandleError( TInt aError ); + void FetchContactL( MVPbkContactLink* aContactLinkToFetch); private: //From MBPASObserver @@ -374,6 +384,15 @@ MVPbkContactLink* aLink, RPointerArray & aInfoArray, TInt aId ); + + private: //From MVPbkSingleContactOperationObserver + + void VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& aOperation, + MVPbkStoreContact* aContact ); + void VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ); private: //Data @@ -448,6 +467,10 @@ /// Array of find operations in xSP stores. Owned. RPointerArray iXSPFindOperationsArray; + + /// Used to save Retrieve Contact operation. Owned. + MVPbkContactOperationBase* iOperation; + }; #endif //__CMSSERVERCONTACT__ diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h --- a/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmsserversession.h Fri Mar 12 15:41:25 2010 +0200 @@ -191,6 +191,13 @@ * @param aMessage Kernel message with client's data */ void DoServiceL( const RMessage2& aMessage ); + + /** + * Checks whether the Current contact is top contact. + * + * @param aMessage Kernel message with client's data + */ + void IsTopContactL( const RMessage2& aMessage ); private: //Data diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/inc/cmssetvoicecalldefault.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ccservices/cmsservices/cmsengine/Server/inc/cmssetvoicecalldefault.h Fri Mar 12 15:41:25 2010 +0200 @@ -0,0 +1,175 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of auto setting default for voice call +* +*/ + +#ifndef CMSSETVOICECALLDEFAULT_H_ +#define CMSSETVOICECALLDEFAULT_H_ + +#include +#include +#include +#include +#include +#include +#include + +class CmsSetVoiceCallDefault: + public CBase, + public MVPbkSetAttributeObserver, + public MVPbkContactObserver +{ +public: + + enum TCmsVoiceCallPriority + { + ECCACommLauncherCallMobile = 0, + ECCACommLauncherCallMobileHome, + ECCACommLauncherCallMobileWork, + ECCACommLauncherCallTelephone, + ECCACommLauncherCallTelephoneWork, + ECCACommLauncherCallTelephoneHome, + ECCACommLauncherCallCarPhone, + ECCACommLauncherCallAssistant, + ECCACommLauncherCallLast + }; + + /** + * Two phased constructor. + */ + static CmsSetVoiceCallDefault* NewL(); + + /** + * Destructor. + */ + ~CmsSetVoiceCallDefault(); + + +private: // From MVPbkSetAttributeObserver + + void AttributeOperationComplete( + MVPbkContactOperationBase& aOperation ); + void AttributeOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ); + +public: + + void SetVoiceCallDefaultL( MVPbkStoreContact* aContact, CVPbkContactManager* aContactManager ); + +private: // From MVPbkContactObserver + + void ContactOperationCompleted( + TContactOpResult aResult ); + + void ContactOperationFailed( + TContactOp aOpCode, + TInt aErrorCode, + TBool aErrorNotified ); + +private: + + /** + * ConstructL + */ + void ConstructL(); + + CmsSetVoiceCallDefault(); + +private: // New implemetations + + /* Lock contact before setting default + * @param - none + * @return - none + */ + void LockContactL(); + + + /* Do set default atrribut + * @param: aDefaultType - default type + * @return: aIndex - the field index which will be set default attribute + */ + void DoSetDefaultL( TVPbkDefaultType aDefaultType, TInt aIndex ); + + + /* + * Check if default setting is needed + * if the contact has no call field + * or call default has been set, then the setting doesn't need. + * @return: True for setting needed, otherwize return false. + */ + TBool IsSettingDefaultNeededL(); + + /* Get call field resource id + * @param: aPriority - setting priority + * @return: field resource id + */ + TInt GetCallFieldResourceId( TInt aPriority ); + + /* + * Get field index from field resource id + * @param: aResourceId - field resource id + * @param: aIndex - the field index + * @return: Ture for find the specified field, otherwize return false. + */ + TBool FieldIndex( TInt aResourceId, TInt& aIndex ); + + /* Default setting complete + * @param - none + * @return - none + */ + void DefaultSettingCompleteL(); + + /* Process finished + * @param:aError - error id + * @return - none + */ + void ProcessFinished( TInt aError ); + + /* Handle error + * @param:aError - error id + * @return - none + */ + void HandleError( TInt aError ); + + /* Check if the contact is phone memory contact + * @param: aContact - the contact to be check + * @return: true for phone memory contact, otherwise return false + */ + TBool IsPhoneMemoryContact( + const MVPbkStoreContact& aContact) const; + + /* + * To set voice call default + */ + void ToSetVoiceCallDefaultL(); + +private: // Member variables + + // Not own: store contact + MVPbkStoreContact* iStoreContact; + + // Not own: contact manager + CVPbkContactManager* iContactManager; + + // Own: attribut operation + MVPbkContactOperationBase* iSetAttributeOperation; + + // Own: filed index array + RArray iFieldIndexArray; + + }; + +#endif /* CMSSETVOICECALLDEFAULT_H_ */ diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsphonebookproxy.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -37,6 +37,7 @@ #include "cmsdefines.h" #include "cmsserver.h" #include "cmsdebug.h" +#include "cmssetvoicecalldefault.h" #include "cmsfindlinkedcontact.h" #include @@ -88,6 +89,7 @@ iStoreConfiguration = CPbk2StoreConfiguration::NewL(); iStoreConfiguration->AddObserverL( *this ); CreateConfigurationL(); + iSetDefault = CmsSetVoiceCallDefault::NewL(); PRINT ( _L("End CCmsPhonebookProxy::ConstructL()") ); } @@ -110,6 +112,7 @@ } iObserverArray.Close(); ixSPStoresArray.Reset(); + delete iSetDefault; } // ---------------------------------------------------------- @@ -228,14 +231,9 @@ { contactLinkToFetch = contactLink.CloneLC(); } - - //Retreive the contact Info - if( iOperation ) - { - delete iOperation; - iOperation = NULL; - } - iOperation = iContactManager->RetrieveContactL( *contactLinkToFetch, *this ); + // Send the latest contact link to cmsservercontact + // to fetch contact. + iContactInterface->FetchContactL( contactLinkToFetch ); CleanupStack::PopAndDestroy(); //contactLinkToFetch if ( findLinkedContact ) @@ -406,6 +404,16 @@ } // ---------------------------------------------------------- +// CCmsPhonebookProxy::SetVoiceCallDefaultL +// +// ---------------------------------------------------------- +// +void CCmsPhonebookProxy::SetVoiceCallDefaultL() + { + iSetDefault->SetVoiceCallDefaultL( iContact, iContactManager ); + } + +// ---------------------------------------------------------- // CCmsPhonebookProxy::ExternalStoresIntalled // // ---------------------------------------------------------- @@ -542,15 +550,15 @@ { PRINT( _L("Start CCmsPhonebookProxy::HandleStoreEventL()" ) ); - TBool found = EFalse; const TInt count = iObserverArray.Count(); - for( TInt i = 0;!found && i < count;i++ ) + // send store event to all observers + for( TInt i = 0; i < count ; i++ ) { MCmsContactInterface* observer( iObserverArray[i] ); if( observer ) { TCmsPhonebookEvent event = SelectEventType( aStoreEvent.iEventType ); - found = observer->OfferContactEventL( event, aStoreEvent.iContactLink ); + observer->OfferContactEventL( event, aStoreEvent.iContactLink ); } } PRINT( _L("End CCmsPhonebookProxy::HandleStoreEventL()" ) ); @@ -719,6 +727,7 @@ PRINT( _L( "Start CCmsPhonebookProxy::VPbkSingleContactOperationComplete()" ) ); ResetData(); + iContact = aContact; CompleteContactRequestL( KErrNone, aContact ); iCmsPhonebookOperationsObserver.CmsSingleContactOperationComplete( KErrNone ); diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsservercontact.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -127,6 +128,7 @@ delete iCachedField16; delete iBrandedPresence; delete iPackedContactLinkArray; + delete iOperation; iPresenceEvents.ResetAndDestroy(); iPhonebookEvents.ResetAndDestroy(); iPresenceEvents.Close(); @@ -198,14 +200,13 @@ // // ---------------------------------------------------- // -TBool CCmsServerContact::OfferContactEventL( TCmsPhonebookEvent aEventType, +void CCmsServerContact::OfferContactEventL( TCmsPhonebookEvent aEventType, const MVPbkContactLink* aContactLink ) { PRINT( _L(" Start CCmsServerContact::OfferContactEventL()" ) ); TBuf<5> buffer( _L( "" ) ); - if ( !iContact ) { buffer.AppendNum( aEventType ); @@ -213,15 +214,12 @@ CleanupStack::PushL( event ); User::LeaveIfError( iPhonebookEvents.Append( event ) ); CleanupStack::Pop(); //event - - return ETrue; + return; } - TBool linkConsumed = EFalse; MVPbkContactLink* self = Contact().CreateLinkLC(); if( aContactLink && aContactLink->IsSame( *self ) ) { - linkConsumed = ETrue; buffer.AppendNum( aEventType ); if( ECmsContactDeleted == aEventType ) @@ -261,7 +259,6 @@ } CleanupStack::PopAndDestroy(); //self PRINT( _L(" End CCmsServerContact::OfferContactEventL()" ) ); - return linkConsumed; } // ---------------------------------------------------- @@ -1449,4 +1446,65 @@ CleanupStack::PopAndDestroy( data ); } +// ---------------------------------------------------------- +// CCmsServerContact::IsTopContactL +// +// ---------------------------------------------------------- +// +void CCmsServerContact::IsTopContactL( const RMessage2& aMessage ) + { + PRINT( _L(" Start CCmsServerContact::IsTopContactL()" ) ); + + __ASSERT_DEBUG( iContact, CCmsServer::PanicServer( ENullContactHandle ) ); + + TBool isFav( EFalse ); + isFav = CVPbkTopContactManager::IsTopContact( *iContact ); + + TPckgC isTopContact( isFav ); + aMessage.WriteL( KFirstParam, isTopContact ); + + aMessage.Complete( KErrNone ); + + PRINT( _L(" End CCmsServerContact::IsTopContactL()" ) ); + } +// ---------------------------------------------------- +// CCmsServerContact::VPbkSingleContactOperationComplete +// +// ---------------------------------------------------- +// +void CCmsServerContact::VPbkSingleContactOperationComplete( + MVPbkContactOperationBase& /*aOperation*/, + MVPbkStoreContact* aContact ) + { + TRAPD( res, ContactReadyL( KErrNone, aContact ) ); + iCmsServer.CmsSingleContactOperationComplete( res ); + } + +// ---------------------------------------------------- +// CCmsServerContact::VPbkSingleContactOperationFailed +// +// ---------------------------------------------------- +// +void CCmsServerContact::VPbkSingleContactOperationFailed( + MVPbkContactOperationBase& /*aOperation*/, + TInt aError ) + { + TRAP_IGNORE ( ContactReadyL( aError, NULL ) ); + iCmsServer.CmsSingleContactOperationComplete( aError ); + } + +// ---------------------------------------------------- +// CCmsServerContact::FetchContactL +// +// ---------------------------------------------------- +// +void CCmsServerContact::FetchContactL( MVPbkContactLink* aContactLinkToFetch ) + { + if( iOperation ) + { + delete iOperation; + iOperation = NULL; + } + iOperation = iContactManager->RetrieveContactL( *aContactLinkToFetch, *this ); + } // End of File diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp --- a/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmsserversession.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -802,6 +802,18 @@ CreateContactL( aMessage ); break; } + case ECmsIsTopContact: + { + PRINT( _L( " CCmsServerSession::ServiceL():Is Top Contact" ) ); + IsTopContactL( aMessage ); + break; + } + case ECmsSetVoiceCallDefault: + { + iCmsServer->PhonebookProxyHandle().SetVoiceCallDefaultL(); + aMessage.Complete( KErrNone ); + break; + } default: { PRINT( _L( " CCmsServerSession::ServiceL(): not supported request" ) ); @@ -812,4 +824,28 @@ PRINT( _L( "End CCmsServerSession::DoServiceL()" ) ); } + +// ---------------------------------------------------------- +// CCmsServerSession::IsTopContactL +// +// ---------------------------------------------------------- +// +void CCmsServerSession::IsTopContactL( const RMessage2& aMessage ) + { + PRINT( _L( "Start CCmsServerSession::IsTopContactL()" ) ); + if( iServerContact && !iServerContact->IsDeleted() ) + { + //Currently only contactlink array is supported. + iServerContact->IsTopContactL( aMessage ); + } + else + { + PRINT( _L( "CCmsServerSession::IsTopContactL'(): Contact has been deleted => complete with KErrNotFound" ) ); + aMessage.Complete( KErrNotFound ); + } + + PRINT( _L( "End CCmsServerSession::IsTopContactL()" ) ); + } + + // End of file diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/Server/src/cmssetvoicecalldefault.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ccservices/cmsservices/cmsengine/Server/src/cmssetvoicecalldefault.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -0,0 +1,392 @@ +/* +* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of auto setting default for voice call +* +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cmssetvoicecalldefault.h" + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::CmsSetVoiceCallDefault +// --------------------------------------------------------------------------- +// +CmsSetVoiceCallDefault::CmsSetVoiceCallDefault() + { + + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::~CmsSetVoiceCallDefault +// --------------------------------------------------------------------------- +// +CmsSetVoiceCallDefault::~CmsSetVoiceCallDefault() + { + delete iSetAttributeOperation; + iFieldIndexArray.Close(); + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::NewL +// --------------------------------------------------------------------------- +// +CmsSetVoiceCallDefault* CmsSetVoiceCallDefault::NewL() + { + CmsSetVoiceCallDefault* self = + new( ELeave ) CmsSetVoiceCallDefault(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::ConstructL +// --------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::ConstructL() + { + + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::AttributeProcessCompleted +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::AttributeOperationComplete( MVPbkContactOperationBase& aOperation ) + { + TInt err = KErrNone; + + if ( &aOperation == iSetAttributeOperation ) + { + TRAP( err, DefaultSettingCompleteL() ); + } + + // Handle error + if ( err != KErrNone ) + { + ProcessFinished( err ); + } + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::AttributeProcessFailed +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::AttributeOperationFailed( + MVPbkContactOperationBase& aOperation, + TInt aError ) + { + ProcessFinished( aError ); + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::ContactOperationCompleted +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::ContactOperationCompleted + (TContactOpResult aResult) + { + if (aResult.iOpCode == EContactLock) + { + TRAPD( err, ToSetVoiceCallDefaultL() ); + if ( err != KErrNone ) + { + ProcessFinished( err ); + } + } + else if (aResult.iOpCode == EContactCommit) + { + ProcessFinished( KErrNone ); + } + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::ContactOperationFailed +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::ContactOperationFailed + ( TContactOp /*aOpCode*/, TInt aErrorCode, + TBool /*aErrorNotified*/ ) + { + ProcessFinished( aErrorCode ); + } + +// ---------------------------------------------------------- +// CmsSetVoiceCallDefault::LockContactL +// ---------------------------------------------------------- +// +void CmsSetVoiceCallDefault::LockContactL() + { + // Lock the contact before changing it + iStoreContact->LockL(*this); + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::DoSetDefaultL +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::DoSetDefaultL( TVPbkDefaultType aDefaultType, TInt aIndex ) + { + CVPbkDefaultAttribute* attr = + CVPbkDefaultAttribute::NewL( aDefaultType ); + CleanupStack::PushL( attr ); + + iSetAttributeOperation = + iContactManager->ContactAttributeManagerL().SetFieldAttributeL + ( iStoreContact->Fields().FieldAt( aIndex ), *attr, *this ); + + CleanupStack::PopAndDestroy( attr ); + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::SetVoiceCallDefaultL +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::SetVoiceCallDefaultL( MVPbkStoreContact* aContact, CVPbkContactManager* aContactManager ) + { + iFieldIndexArray.Reset(); + iStoreContact = aContact; + iContactManager = aContactManager; + + if ( iStoreContact && iContactManager && IsSettingDefaultNeededL() ) + { + LockContactL(); + } + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::SetVoiceCallDefaultL +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::ToSetVoiceCallDefaultL() + { + + TInt count = iFieldIndexArray.Count(); + + if ( count > 0 ) + { + TInt index = KErrNotFound; + + for ( TInt i=0; iFieldTypes()); + + const MVPbkStoreContactFieldCollection& fields = iStoreContact->Fields(); + TBool result = EFalse; + TInt count = fields.FieldCount(); + + // Voice call default attribute + CVPbkDefaultAttribute* attr = + CVPbkDefaultAttribute::NewL( EVPbkDefaultTypePhoneNumber ); + CleanupStack::PushL( attr ); + + for (TInt i = 0; i < count; ++i) + { + const MVPbkStoreContactField& field = fields.FieldAt(i); + + // If this field is voice call field + if ( selector->IsFieldIncluded( field ) ) + { + // Checking if the field has been set as voice call default, + // if hasn't, keep field index in an array + if ( !iContactManager->ContactAttributeManagerL().HasFieldAttributeL + ( *attr, field ) ) + { + result = ETrue; + iFieldIndexArray.AppendL(i); + } + // it has been set as voice call default, no need to set again + else + { + result = EFalse; + iFieldIndexArray.Reset(); + break; + } + } + } + + CleanupStack::PopAndDestroy( attr ); + delete selector; + return result; + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::FieldIndex +// --------------------------------------------------------------------------- +// +TBool CmsSetVoiceCallDefault::FieldIndex( TInt aResourceId, TInt& aIndex ) + { + TBool result = EFalse; + + if( iStoreContact ) + { + const MVPbkBaseContactFieldCollection& fields = iStoreContact->Fields(); + TInt count = iFieldIndexArray.Count(); + + for (TInt i = 0; i < count; ++i) + { + const MVPbkFieldType* fieldType = + fields.FieldAt(iFieldIndexArray[i]).BestMatchingFieldType(); + + if ( fieldType && fieldType->FieldTypeResId() == aResourceId ) + { + result = ETrue; + aIndex = iFieldIndexArray[i]; + break; + } + } + } + return result; + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::NextAttribute +// --------------------------------------------------------------------------- +// +TInt CmsSetVoiceCallDefault::GetCallFieldResourceId( TInt aPriority ) + { + + TInt resourceId; + switch ( aPriority ) + { + case ECCACommLauncherCallMobile: + resourceId = R_VPBK_FIELD_TYPE_MOBILEPHONEGEN; + break; + case ECCACommLauncherCallMobileWork: + resourceId = R_VPBK_FIELD_TYPE_MOBILEPHONEWORK; + break; + case ECCACommLauncherCallMobileHome: + resourceId = R_VPBK_FIELD_TYPE_MOBILEPHONEHOME; + break; + case ECCACommLauncherCallTelephone: + resourceId = R_VPBK_FIELD_TYPE_LANDPHONEGEN; + break; + case ECCACommLauncherCallTelephoneWork: + resourceId = R_VPBK_FIELD_TYPE_LANDPHONEWORK; + break; + case ECCACommLauncherCallTelephoneHome: + resourceId = R_VPBK_FIELD_TYPE_LANDPHONEHOME; + break; + case ECCACommLauncherCallCarPhone: + resourceId = R_VPBK_FIELD_TYPE_CARPHONE; + break; + case ECCACommLauncherCallAssistant: + resourceId = R_VPBK_FIELD_TYPE_ASSTPHONE; + break; + default: + break; + } + return resourceId; + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::DefaultSettingCompleteL +// --------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::DefaultSettingCompleteL() + { + // commit the contact + iStoreContact->CommitL( *this ); + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::ProcessFinished +// -------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::ProcessFinished( TInt aError ) + { + } + +// --------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::HandleError +// --------------------------------------------------------------------------- +// +void CmsSetVoiceCallDefault::HandleError( TInt aError ) + { + } + +// -------------------------------------------------------------------------- +// CmsSetVoiceCallDefault::IsPhoneMemoryContact +// -------------------------------------------------------------------------- +// +TBool CmsSetVoiceCallDefault::IsPhoneMemoryContact( + const MVPbkStoreContact& aContact) const + { + TBool ret = EFalse; + + TVPbkContactStoreUriPtr uri = + aContact.ParentStore().StoreProperties().Uri(); + + TVPbkContactStoreUriPtr phoneMemoryUri + ( VPbkContactStoreUris::DefaultCntDbUri() ); + + if (uri.Compare( phoneMemoryUri, + TVPbkContactStoreUriPtr::EContactStoreUriStoreType ) == 0) + { + ret = ETrue; + } + + return ret; + } diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/inc/cmscommondefines.h --- a/ccservices/cmsservices/cmsengine/inc/cmscommondefines.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/inc/cmscommondefines.h Fri Mar 12 15:41:25 2010 +0200 @@ -67,7 +67,9 @@ ECmsFindParentStore, ECmsFindExternalContact, ECmsFetchServiceAvailability, - ECmsGetContactActionFieldCount + ECmsGetContactActionFieldCount, + ECmsIsTopContact, + ECmsSetVoiceCallDefault }; //Presence data stream delimiters diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/cmsengine/inc/cmscontact.h --- a/ccservices/cmsservices/cmsengine/inc/cmscontact.h Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/cmsengine/inc/cmscontact.h Fri Mar 12 15:41:25 2010 +0200 @@ -207,6 +207,20 @@ IMPORT_C TInt GetContactActionFieldCount( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aContactAction); + /** + * Checks whether the Current contact is top contact. + * + * @return ETrue if Contact is a top contact, otherwise EFalse + */ + IMPORT_C TBool IsTopContact(); + + /** + * Set default attribute for voice call + * + * @param aStatus TRequestStatus& aStatus + */ + IMPORT_C void SetVoiceCallDefault( TRequestStatus& aStatus ) const; + public: /** diff -r 04ab22b956c2 -r 81f8547efd4f ccservices/cmsservices/contactpresence/src/contactpresence.cpp --- a/ccservices/cmsservices/contactpresence/src/contactpresence.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/ccservices/cmsservices/contactpresence/src/contactpresence.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -163,8 +163,6 @@ #endif iOpId++; - CPresenceBrandedIcon* icon = CPresenceBrandedIcon::NewL(iBrandingFactory, iObs ); - iIconReqList.AddLast( *icon ); iListener->GetPresenceInfoL( aPackedLink, iOpId ); return iOpId; diff -r 04ab22b956c2 -r 81f8547efd4f contactextensions/predefinedcontacts/data/pdcstringconstants.st --- a/contactextensions/predefinedcontacts/data/pdcstringconstants.st Fri Feb 19 22:40:27 2010 +0200 +++ b/contactextensions/predefinedcontacts/data/pdcstringconstants.st Fri Mar 12 15:41:25 2010 +0200 @@ -1,8 +1,8 @@ # -# Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" +# under the terms of "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 04ab22b956c2 -r 81f8547efd4f logsui/AppSrc/CLogsEventListView.cpp --- a/logsui/AppSrc/CLogsEventListView.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/logsui/AppSrc/CLogsEventListView.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -496,7 +496,7 @@ popUpRow[i++] = ELogsFilterWlan; } } - if( count > 0 ) + if( count > 0 && MenuBar()->ItemSpecificCommandsEnabled() ) { const MLogsEventGetter* event = Engine()->Model( ELogsMainModel )->At( iEventListCurrent ); //Seletected event supported only for events that have number or remoty party available, so e.g diff -r 04ab22b956c2 -r 81f8547efd4f phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactIdConverter.cpp --- a/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactIdConverter.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CContactIdConverter.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -66,7 +66,7 @@ TInt32 CContactIdConverter::LinkToIdentifier( const MVPbkContactLink& aLink ) const { TInt32 result = KNullContactId; - if ( &aLink.ContactStore() == &iContactStore ) + if ( &aLink && &aLink.ContactStore() == &iContactStore ) { const CContactLink& link = static_cast( aLink ); result = link.ContactId(); diff -r 04ab22b956c2 -r 81f8547efd4f phonebookengines/VirtualPhonebook/VPbkCntModel/src/CFilteredContactView.cpp --- a/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CFilteredContactView.cpp Fri Feb 19 22:40:27 2010 +0200 +++ b/phonebookengines/VirtualPhonebook/VPbkCntModel/src/CFilteredContactView.cpp Fri Mar 12 15:41:25 2010 +0200 @@ -145,8 +145,14 @@ for ( TInt matchPriority = 0; matchPriority <= maxMatchPriority; ++matchPriority ) { - if ( matchingProperty->Matches( - aFilterType->VersitProperties()[matchPriority]) ) + TBool versitIsMatched = matchingProperty->Matches( + aFilterType->VersitProperties()[matchPriority]); + TBool excludedParmaterIsMatched = + aFilterType->ExcludedParameters(). + ContainsAll(aFieldType.ExcludedParameters()); + // if the FilterType is matched the Versit Property and + // the excludeParameter of FiledType, it needn't custom filter. + if ( versitIsMatched && excludedParmaterIsMatched ) { ret = EFalse; break; diff -r 04ab22b956c2 -r 81f8547efd4f phonebookengines/contactsmodel/group/backup_registration.xml --- a/phonebookengines/contactsmodel/group/backup_registration.xml Fri Feb 19 22:40:27 2010 +0200 +++ b/phonebookengines/contactsmodel/group/backup_registration.xml Fri Mar 12 15:41:25 2010 +0200 @@ -1,10 +1,10 @@