28 #include <MPbk2ApplicationServices.h> |
28 #include <MPbk2ApplicationServices.h> |
29 #include <MPbk2ContactViewSupplier.h> |
29 #include <MPbk2ContactViewSupplier.h> |
30 #include <Pbk2UIControls.hrh> |
30 #include <Pbk2UIControls.hrh> |
31 #include <MPbk2ContactUiControl.h> |
31 #include <MPbk2ContactUiControl.h> |
32 #include <MPbk2FetchDlgObserver.h> |
32 #include <MPbk2FetchDlgObserver.h> |
33 #include <pbk2uicontrols.rsg> |
33 #include <Pbk2UIControls.rsg> |
34 #include <MPbk2ContactLinkIterator.h> |
34 #include <MPbk2ContactLinkIterator.h> |
35 #include <CPbk2IconInfoContainer.h> |
35 #include <CPbk2IconInfoContainer.h> |
36 #include <Pbk2UID.h> |
36 #include <Pbk2UID.h> |
37 #include <CPbk2IconFactory.h> |
37 #include <CPbk2IconFactory.h> |
38 #include <TPbk2IconId.h> |
38 #include <TPbk2IconId.h> |
147 // -------------------------------------------------------------------------- |
147 // -------------------------------------------------------------------------- |
148 // |
148 // |
149 inline CPbk2FetchDlg::CPbk2FetchDlg |
149 inline CPbk2FetchDlg::CPbk2FetchDlg |
150 ( TParams aParams, MPbk2FetchDlgObserver& aObserver ) : |
150 ( TParams aParams, MPbk2FetchDlgObserver& aObserver ) : |
151 iParams( aParams ), |
151 iParams( aParams ), |
152 iObserver( aObserver ), |
152 iObserver( aObserver ) |
153 iSelectPermitted( ETrue ) |
|
154 { |
153 { |
155 } |
154 } |
156 |
155 |
157 // -------------------------------------------------------------------------- |
156 // -------------------------------------------------------------------------- |
158 // CPbk2FetchDlg::~CPbk2FetchDlg |
157 // CPbk2FetchDlg::~CPbk2FetchDlg |
257 { |
256 { |
258 CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC |
257 CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC |
259 ( aContactLink, Phonebook2::Pbk2AppUi()->ApplicationServices(). |
258 ( aContactLink, Phonebook2::Pbk2AppUi()->ApplicationServices(). |
260 ContactManager().ContactStoresL() ); |
259 ContactManager().ContactStoresL() ); |
261 |
260 |
262 // Append the selected contact to results. |
|
263 if ( linkArray->Count() > 0 ) |
261 if ( linkArray->Count() > 0 ) |
264 { |
262 { |
265 const MVPbkContactLink& link = linkArray->At( KFirstElement ); |
263 const MVPbkContactLink& link = linkArray->At( KFirstElement ); |
266 iResults->AppendDelayedL( link ); |
264 iResults->AppendDelayedL( link ); |
267 } |
|
268 |
|
269 CleanupStack::PopAndDestroy(); // linkArray |
|
270 } |
|
271 |
|
272 // -------------------------------------------------------------------------- |
|
273 // CPbk2FetchDlg::AcceptDelayedFetchL |
|
274 // -------------------------------------------------------------------------- |
|
275 // |
|
276 EXPORT_C void CPbk2FetchDlg::DenyDelayedFetchL |
|
277 ( const TDesC8& aContactLink ) |
|
278 { |
|
279 CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC |
|
280 ( aContactLink, Phonebook2::Pbk2AppUi()->ApplicationServices(). |
|
281 ContactManager().ContactStoresL() ); |
|
282 |
|
283 // Unmark the selected contact |
|
284 if ( linkArray->Count() > 0 ) |
|
285 { |
|
286 const MVPbkContactLink& link = linkArray->At( KFirstElement ); |
|
287 iResults->DenyAppendDelayedL( link ); |
|
288 iPages->SelectContactL( link, EFalse ); |
|
289 } |
265 } |
290 |
266 |
291 CleanupStack::PopAndDestroy(); // linkArray |
267 CleanupStack::PopAndDestroy(); // linkArray |
292 } |
268 } |
293 |
269 |
463 if ( okToExit ) |
433 if ( okToExit ) |
464 { |
434 { |
465 // Reset results |
435 // Reset results |
466 iResults->ResetAndDestroy(); |
436 iResults->ResetAndDestroy(); |
467 } |
437 } |
468 else |
|
469 { |
|
470 // Permit selection again |
|
471 iSelectPermitted = ETrue; |
|
472 } |
|
473 |
438 |
474 iExitRecord.Set( EExitOrdered ); // exit is now ordered and |
439 iExitRecord.Set( EExitOrdered ); // exit is now ordered and |
475 // when client later requests |
440 // when client later requests |
476 // exit, the ordered exit |
441 // exit, the ordered exit |
477 // becomes approved exit |
442 // becomes approved exit |
558 result = CEikDialog::OfferKeyEventL( aKeyEvent, aType ); |
523 result = CEikDialog::OfferKeyEventL( aKeyEvent, aType ); |
559 } |
524 } |
560 } |
525 } |
561 else |
526 else |
562 { |
527 { |
563 // EKeyApplicationF means left softkey is pressed |
|
564 if ( EKeyApplicationF == aKeyEvent.iCode && |
|
565 ( iParams.iFlags & EFetchMultiple ) ) |
|
566 { |
|
567 iSelectPermitted = EFalse; |
|
568 } |
|
569 if( !Phonebook2::Pbk2AppUi()->KeyEventHandler().Pbk2ProcessKeyEventL( aKeyEvent, aType ) ) |
528 if( !Phonebook2::Pbk2AppUi()->KeyEventHandler().Pbk2ProcessKeyEventL( aKeyEvent, aType ) ) |
570 { |
529 { |
571 |
530 |
572 if( iNamesListControl && iNamesListControl->IsVisible() |
531 if( iNamesListControl && iNamesListControl->IsVisible() |
573 && aKeyEvent.iCode != EKeyLeftArrow |
532 && aKeyEvent.iCode != EKeyLeftArrow |
826 UpdateMultiSelectionMSKL( EFalse ); |
785 UpdateMultiSelectionMSKL( EFalse ); |
827 } |
786 } |
828 CleanupStack::PopAndDestroy( ); // link |
787 CleanupStack::PopAndDestroy( ); // link |
829 } |
788 } |
830 } |
789 } |
831 } |
|
832 // -------------------------------------------------------------------------- |
|
833 // CPbk2FetchDlg::IsSelectPermitted |
|
834 // -------------------------------------------------------------------------- |
|
835 // |
|
836 TBool CPbk2FetchDlg::IsSelectPermitted() |
|
837 { |
|
838 return iSelectPermitted; |
|
839 } |
790 } |
840 |
791 |
841 // -------------------------------------------------------------------------- |
792 // -------------------------------------------------------------------------- |
842 // CPbk2FetchDlg::HandleControlEventL |
793 // CPbk2FetchDlg::HandleControlEventL |
843 // -------------------------------------------------------------------------- |
794 // -------------------------------------------------------------------------- |
1325 // CPbk2FetchDlg::RestoreSelectionsL |
1276 // CPbk2FetchDlg::RestoreSelectionsL |
1326 // -------------------------------------------------------------------------- |
1277 // -------------------------------------------------------------------------- |
1327 // |
1278 // |
1328 void CPbk2FetchDlg::RestoreSelectionsL() |
1279 void CPbk2FetchDlg::RestoreSelectionsL() |
1329 { |
1280 { |
1330 // Remove selections in all pages. Selections will be restored later. |
|
1331 // In case of sort order change the selections will be in a new position, |
|
1332 // that's why they need to be removed. |
|
1333 if ( iPages ) |
|
1334 { |
|
1335 const TInt pageCount = iPages->DlgPageCount(); |
|
1336 for ( TInt i = 0; i < pageCount; i++ ) |
|
1337 { |
|
1338 if ( iPages->DlgPageAt(i).Control().ContactsMarked() ) |
|
1339 { |
|
1340 iPages->DlgPageAt(i).Control().ClearMarks(); |
|
1341 } |
|
1342 } |
|
1343 } |
|
1344 |
|
1345 if ( iResults ) |
1281 if ( iResults ) |
1346 { |
1282 { |
1347 for ( TInt i = 0; i < iResults->Count(); ++i ) |
1283 for ( TInt i = 0; i < iResults->Count(); ++i ) |
1348 { |
1284 { |
1349 iPages->SelectContactL( iResults->At( i ), ETrue ); |
1285 iPages->SelectContactL( iResults->At( i ), ETrue ); |