diff -r 81f8547efd4f -r e8e3147d53eb phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp --- a/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Fri Mar 12 15:41:25 2010 +0200 +++ b/phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp Mon Mar 15 12:39:26 2010 +0200 @@ -71,6 +71,7 @@ const TInt KPbk2MSKControlId( CEikButtonGroupContainer::EMiddleSoftkeyPosition ); const TInt KFirstElement = 0; +const TInt KDefaultMinSelection = 1; enum TPanicCode { @@ -100,7 +101,8 @@ iGroupsListView( NULL ), iCbaId( 0 ), iNaviPaneId( 0 ), - iExitCallback( NULL ) + iExitCallback( NULL ), + iMinSelection( KDefaultMinSelection ) { } @@ -492,6 +494,13 @@ iPages->FocusedContactL(); if ( focusedContact ) { + if ( !( iParams.iFlags & EFetchMultiple ) ) + { + delete iFocusedContactLink; + iFocusedContactLink = NULL; + iFocusedContactLink = focusedContact->CreateLinkLC(); + CleanupStack::Pop(); // iFocusedContactLink + } MVPbkContactLink* link = focusedContact->CreateLinkLC(); SelectContactL( *link, selectContact ); CleanupStack::PopAndDestroy(); // link @@ -821,8 +830,7 @@ void CPbk2FetchDlg::ContactSelected ( const MVPbkContactLink& aLink, TBool aSelected ) { - if ( aSelected && iFocusedContactLink && - iFocusedContactLink->IsSame( aLink ) ) + if ( aSelected && iFocusedContactLink && iFocusedContactLink->IsSame( aLink ) ) { // Deleting focused contact link that next time single fetch // also fetches the contact. @@ -836,6 +844,10 @@ delete this; } } + else + { + TRAP_IGNORE( UpdateCbasL() ); + } } // -------------------------------------------------------------------------- @@ -920,7 +932,7 @@ // void CPbk2FetchDlg::UpdateCbasL() { - if (iResults && iPages && iPages->CurrentPage().DlgPageReady() && + if ( iResults && iPages && iPages->CurrentPage().DlgPageReady() && !iPages->CurrentPage().DlgPageEmpty() ) { // Use user defined CBA parameter if exist @@ -939,6 +951,21 @@ SetCbaCommandSetL( R_PBK2_SOFTKEYS_OK_BACK_OK ); } + if ( iParams.iFlags & EFetchMultiple ) + { + CEikButtonGroupContainer& cba = ButtonGroupContainer(); + if ( iResults->Count() < iParams.iMinSelection ) + { + cba.MakeCommandVisibleByPosition + ( CEikButtonGroupContainer::ELeftSoftkeyPosition, EFalse ); + } + else + { + cba.MakeCommandVisibleByPosition + ( CEikButtonGroupContainer::ELeftSoftkeyPosition, ETrue ); + } + } + MVPbkContactLink* link = NULL; TBool contactSelected = EFalse; //Used the TRAPD to catch the exception when the contact can't be found in DB. @@ -1085,23 +1112,20 @@ { // Focused contact must be returned if no contacts yet selected, // and the focused contact selection is not already on its way - if ( FetchDlgSelection().Count() == 0 ) + if ( FetchDlgSelection().Count() == 0 && !( iParams.iFlags & EFetchMultiple ) ) { - const MVPbkBaseContact* focusedContact = - iPages->FocusedContactL(); + const MVPbkBaseContact* focusedContact = iPages->FocusedContactL(); if ( focusedContact ) { delete iFocusedContactLink; iFocusedContactLink = NULL; iFocusedContactLink = focusedContact->CreateLinkLC(); CleanupStack::Pop(); // iFocusedContactLink - if ( iParams.iFlags & EFetchSingle ) { // Clean result if this is single fetch. iResults->ResetAndDestroy(); } - SelectContactL( *iFocusedContactLink, ETrue ); }