phonebookui/Phonebook2/UIControls/src/CPbk2FetchDlg.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 15 34879f5cfc63
equal deleted inserted replaced
17:2666d9724c76 18:d4f567ce2e7c
   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 )
   153     {
   154     {
   154     }
   155     }
   155 
   156 
   156 // --------------------------------------------------------------------------
   157 // --------------------------------------------------------------------------
   157 // CPbk2FetchDlg::~CPbk2FetchDlg
   158 // CPbk2FetchDlg::~CPbk2FetchDlg
   256     {
   257     {
   257     CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC
   258     CVPbkContactLinkArray* linkArray = CVPbkContactLinkArray::NewLC
   258         ( aContactLink, Phonebook2::Pbk2AppUi()->ApplicationServices().
   259         ( aContactLink, Phonebook2::Pbk2AppUi()->ApplicationServices().
   259             ContactManager().ContactStoresL() );
   260             ContactManager().ContactStoresL() );
   260 
   261 
       
   262     // Append the selected contact to results.
   261     if ( linkArray->Count() > 0 )
   263     if ( linkArray->Count() > 0 )
   262         {
   264         {
   263         const MVPbkContactLink& link = linkArray->At( KFirstElement );
   265         const MVPbkContactLink& link = linkArray->At( KFirstElement );
   264         iResults->AppendDelayedL( link );
   266         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 );
   265         }
   289         }
   266 
   290 
   267     CleanupStack::PopAndDestroy(); // linkArray
   291     CleanupStack::PopAndDestroy(); // linkArray
   268     }
   292     }
   269 
   293 
   386             {
   410             {
   387             okToExit = CheckIsOkToExitL( aButtonId );
   411             okToExit = CheckIsOkToExitL( aButtonId );
   388             }
   412             }
   389         }
   413         }
   390 
   414 
       
   415     // Only multiple fetch needs to wait buffered operations finished
       
   416     if ( !canceled && ( iParams.iFlags & EFetchMultiple ) )
       
   417         {
       
   418         iResults->WaitOperationsCompleteL();
       
   419         }
       
   420     
   391     // Notify observer
   421     // Notify observer
   392     if ( canceled )
   422     if ( canceled )
   393         {
   423         {
   394         iObserver.FetchCanceled();
   424         iObserver.FetchCanceled();
   395         }
   425         }
   433     if ( okToExit )
   463     if ( okToExit )
   434         {
   464         {
   435         // Reset results
   465         // Reset results
   436         iResults->ResetAndDestroy();
   466         iResults->ResetAndDestroy();
   437         }
   467         }
       
   468     else
       
   469         {
       
   470         // Permit selection again
       
   471         iSelectPermitted = ETrue;
       
   472         }
   438     
   473     
   439     iExitRecord.Set( EExitOrdered );    // exit is now ordered and
   474     iExitRecord.Set( EExitOrdered );    // exit is now ordered and
   440                                         // when client later requests
   475                                         // when client later requests
   441                                         // exit, the ordered exit
   476                                         // exit, the ordered exit
   442                                         // becomes approved exit
   477                                         // becomes approved exit
   523             result = CEikDialog::OfferKeyEventL( aKeyEvent, aType );
   558             result = CEikDialog::OfferKeyEventL( aKeyEvent, aType );
   524             }
   559             }
   525         }
   560         }
   526     else
   561     else
   527         {
   562         {
       
   563         // EKeyApplicationF means left softkey is pressed
       
   564         if ( EKeyApplicationF == aKeyEvent.iCode && 
       
   565                 ( iParams.iFlags & EFetchMultiple ) )
       
   566             {
       
   567             iSelectPermitted = EFalse;
       
   568             }
   528         if( !Phonebook2::Pbk2AppUi()->KeyEventHandler().Pbk2ProcessKeyEventL( aKeyEvent, aType ) )
   569         if( !Phonebook2::Pbk2AppUi()->KeyEventHandler().Pbk2ProcessKeyEventL( aKeyEvent, aType ) )
   529             {
   570             {
   530             
   571             
   531             if( iNamesListControl && iNamesListControl->IsVisible() 
   572             if( iNamesListControl && iNamesListControl->IsVisible() 
   532                 && aKeyEvent.iCode != EKeyLeftArrow
   573                 && aKeyEvent.iCode != EKeyLeftArrow
   785                 UpdateMultiSelectionMSKL( EFalse );
   826                 UpdateMultiSelectionMSKL( EFalse );
   786                 }    
   827                 }    
   787             CleanupStack::PopAndDestroy( ); // link
   828             CleanupStack::PopAndDestroy( ); // link
   788         	}
   829         	}
   789         }
   830         }
       
   831     }
       
   832 // --------------------------------------------------------------------------
       
   833 // CPbk2FetchDlg::IsSelectPermitted
       
   834 // --------------------------------------------------------------------------
       
   835 //
       
   836 TBool CPbk2FetchDlg::IsSelectPermitted()
       
   837     {
       
   838     return iSelectPermitted;
   790     }
   839     }
   791 
   840 
   792 // --------------------------------------------------------------------------
   841 // --------------------------------------------------------------------------
   793 // CPbk2FetchDlg::HandleControlEventL
   842 // CPbk2FetchDlg::HandleControlEventL
   794 // --------------------------------------------------------------------------
   843 // --------------------------------------------------------------------------