201 // CThumbnailRequestActive::RunL() |
202 // CThumbnailRequestActive::RunL() |
202 // --------------------------------------------------------------------------- |
203 // --------------------------------------------------------------------------- |
203 // |
204 // |
204 void CThumbnailRequestActive::RunL() |
205 void CThumbnailRequestActive::RunL() |
205 { |
206 { |
206 TN_DEBUG1( "CThumbnaiRequestActive::RunL()" ); |
207 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - request ID: %d", iParams.iRequestId ); |
207 |
208 |
208 if ( iParams.iControlFlags == EThumbnailPreviewThumbnail ) |
209 if ( iParams.iControlFlags == EThumbnailPreviewThumbnail ) |
209 { |
210 { |
210 iRequestCompleted = EFalse; |
211 iRequestCompleted = EFalse; |
211 iProcessingPreview = ETrue; |
212 iProcessingPreview = ETrue; |
403 if ( iError ) |
404 if ( iError ) |
404 { |
405 { |
405 if( iError == KErrServerTerminated) |
406 if( iError == KErrServerTerminated) |
406 { |
407 { |
407 iSession.Close(); |
408 iSession.Close(); |
408 iSession.Connect(); |
409 TInt connErr = iSession.Connect(); |
|
410 if (connErr != KErrNone) |
|
411 { |
|
412 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - session reconnect err %d", connErr ); |
|
413 } |
|
414 else |
|
415 { |
|
416 TN_DEBUG1( "CThumbnailRequestActive::HandleError() - session reconnected"); |
|
417 } |
409 } |
418 } |
410 iCallbackThumbnail->Set( NULL, iClientData ); |
419 iCallbackThumbnail->Set( NULL, iClientData ); |
411 |
420 |
412 // don't leak internal TNM codes |
421 // don't leak internal TNM codes |
413 if (iError == KThumbnailErrThumbnailNotFound) |
422 if (iError == KThumbnailErrThumbnailNotFound) |
414 { |
423 { |
415 iError = KErrNotFound; |
424 iError = KErrNotFound; |
416 } |
425 } |
417 |
426 |
418 TN_DEBUG2( "CThumbnaiRequestActive::RunL() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
427 TN_DEBUG2( "CThumbnaiRequestActive::HandleError() - iObserver.ThumbnailReady %d", iParams.iRequestId ); |
419 iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); |
428 iObserver.ThumbnailReady( iError, *iCallbackThumbnail, iParams.iRequestId ); |
420 |
429 |
421 iError = KErrNone; |
430 iError = KErrNone; |
422 } |
431 } |
423 |
432 |
708 iSession.ChangePriority(iRequestId, aNewPriority); |
717 iSession.ChangePriority(iRequestId, aNewPriority); |
709 } |
718 } |
710 } |
719 } |
711 |
720 |
712 // --------------------------------------------------------------------------- |
721 // --------------------------------------------------------------------------- |
|
722 // CThumbnailRequestActive::StartError() |
|
723 // Error handling function. |
|
724 // --------------------------------------------------------------------------- |
|
725 // |
|
726 void CThumbnailRequestActive::StartError( const TInt aErr ) |
|
727 { |
|
728 TN_DEBUG1( "CThumbnailRequestActive::StartError"); |
|
729 |
|
730 iStartError = aErr; |
|
731 iRequestActive = ETrue; |
|
732 |
|
733 iTimer->Start( KClientRequestStartErrorTimeout, KClientRequestStartErrorTimeout, |
|
734 TCallBack(TimerCallBack, this)); |
|
735 } |
|
736 |
|
737 // --------------------------------------------------------------------------- |
713 // CThumbnailRequestActive::TimerCallBack() |
738 // CThumbnailRequestActive::TimerCallBack() |
714 // --------------------------------------------------------------------------- |
739 // --------------------------------------------------------------------------- |
715 // |
740 // |
716 TInt CThumbnailRequestActive::TimerCallBack(TAny* aAny) |
741 TInt CThumbnailRequestActive::TimerCallBack(TAny* aAny) |
717 { |
742 { |
718 TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - request timeout"); |
743 TN_DEBUG1( "CThumbnailRequestActive::TimerCallBack() - request timeout"); |
719 |
744 |
720 CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny ); |
745 CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny ); |
721 |
746 |
722 self->Cancel(); |
747 self->Cancel(); |
723 self->iError = KErrTimedOut; |
748 self->iTimer->Cancel(); |
|
749 |
|
750 if (self->iStartError != KErrNone) |
|
751 { |
|
752 self->iError = self->iStartError; |
|
753 } |
|
754 else |
|
755 { |
|
756 self->iError = KErrTimedOut; |
|
757 } |
|
758 |
724 self->HandleError(); |
759 self->HandleError(); |
725 |
760 |
726 return KErrNone; |
761 return KErrNone; |
727 } |
762 } |
728 |
763 |