equal
deleted
inserted
replaced
195 MVPbkContactOperationBase* CVPbkTopContactOperation::NewTopOperationL( |
195 MVPbkContactOperationBase* CVPbkTopContactOperation::NewTopOperationL( |
196 CVPbkContactManager& aContactManager, |
196 CVPbkContactManager& aContactManager, |
197 const MVPbkContactLinkArray& aContactLinks, |
197 const MVPbkContactLinkArray& aContactLinks, |
198 MVPbkOperationObserver& aObserver, |
198 MVPbkOperationObserver& aObserver, |
199 MVPbkOperationErrorObserver& aErrorObserver, |
199 MVPbkOperationErrorObserver& aErrorObserver, |
200 TTopOperation aOperation ) |
200 TTopOperation aOperation, |
|
201 MVPbkContactViewBase* aViewRef) |
201 { |
202 { |
202 __ASSERT_DEBUG( aOperation == EAddToTop || aOperation == ERemoveFromTop || |
203 __ASSERT_DEBUG( aOperation == EAddToTop || aOperation == ERemoveFromTop || |
203 aOperation == EReorderTop, |
204 aOperation == EReorderTop, |
204 Panic(EInvalidTopOperation) ); |
205 Panic(EInvalidTopOperation) ); |
205 |
206 |
207 aContactManager, |
208 aContactManager, |
208 aErrorObserver, |
209 aErrorObserver, |
209 aOperation ); |
210 aOperation ); |
210 self->iObserver = &aObserver; |
211 self->iObserver = &aObserver; |
211 self->iInputLinks = CloneArrayL( aContactLinks ); |
212 self->iInputLinks = CloneArrayL( aContactLinks ); |
|
213 self->iViewRef = aViewRef; |
212 |
214 |
213 CleanupStack::Pop(self); |
215 CleanupStack::Pop(self); |
214 return self; |
216 return self; |
215 } |
217 } |
216 |
218 |
477 { |
479 { |
478 if ( iNextState == EStateOpenStore ) |
480 if ( iNextState == EStateOpenStore ) |
479 { |
481 { |
480 if ( iInputLinks->Count() > 0 ) |
482 if ( iInputLinks->Count() > 0 ) |
481 { |
483 { |
482 // view is needed for AddToTop operation to get next top index |
484 // If the top view was not passed as a reference, we needed to construct |
483 if ( iCurrentOperation == EAddToTop ) |
485 // own instance for AddToTop operation to get next top index |
|
486 if ( iCurrentOperation == EAddToTop && !iViewRef ) |
484 { |
487 { |
485 iNextState = EStateCreateView; |
488 iNextState = EStateCreateView; |
486 } |
489 } |
487 else |
490 else |
488 { |
491 { |
533 { |
536 { |
534 switch( iCurrentOperation ) |
537 switch( iCurrentOperation ) |
535 { |
538 { |
536 case EAddToTop: |
539 case EAddToTop: |
537 { |
540 { |
538 // get next top index and delete the view right away, |
541 // Get next top index, either from the provided top view or |
539 __ASSERT_DEBUG( iView, Panic(ETopViewMissing) ); |
542 // from the self contsructed one. Delete the owned view right away. |
540 TInt nextTopIndex = NextTopOrderIndexL( *iView ); |
543 __ASSERT_DEBUG( iView || iViewRef, Panic(ETopViewMissing) ); |
|
544 TInt nextTopIndex = iViewRef ? NextTopOrderIndexL( *iViewRef ) : |
|
545 NextTopOrderIndexL( *iView ); |
541 __ASSERT_DEBUG( nextTopIndex >= 0, Panic(ETopErrorBadIndex) ); |
546 __ASSERT_DEBUG( nextTopIndex >= 0, Panic(ETopErrorBadIndex) ); |
542 delete iView; |
547 delete iView; |
543 iView = NULL; |
548 iView = NULL; |
544 |
549 |
545 SetTopOrderToContactsL( iContacts, nextTopIndex ); |
550 SetTopOrderToContactsL( iContacts, nextTopIndex ); |