imagehandlingutilities/thumbnailmanager/thumbnailclient/src/thumbnailrequestactive.cpp
branchRCL_3
changeset 20 ffb2d5dd62e9
parent 16 85a88bc05e45
child 21 ad31f4183ddc
equal deleted inserted replaced
16:85a88bc05e45 20:ffb2d5dd62e9
   139             iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
   139             iSession.RequestThumbnailL( iFile, iTargetUri, iParamsPckg, iStatus );
   140             break;
   140             break;
   141             }        
   141             }        
   142         case EReqGetThumbnailPath:
   142         case EReqGetThumbnailPath:
   143             {
   143             {
   144             iSession.RequestThumbnailL( iPath, iTargetUri, iParams.iThumbnailId, 
   144             // for custom size requests file handle can be opened here already, because
   145                                         iParamsPckg, iStatus );
   145             // custom thumbnails are never stored in db  
       
   146             if (iParams.iThumbnailSize == ECustomThumbnailSize &&
       
   147                 iParams.iOriginalControlFlags != EThumbnailGeneratePersistentSizesOnly)
       
   148                 {
       
   149                 TN_DEBUG1( "CThumbnaiRequestActive::StartL()- custom size request" );
       
   150                   
       
   151                 iFile.Close();
       
   152                 User::LeaveIfError( iFile.Open( iFs, iPath, EFileShareReadersOrWriters ) );  
       
   153                 
       
   154                 TN_DEBUG2( "CThumbnailRequestActive::StartL() - file handle opened for %S", &iTargetUri );
       
   155                 
       
   156                 CleanupClosePushL( iFile );
       
   157                 iSession.RequestThumbnailL( iFile, iPath, iParamsPckg, iStatus );
       
   158                 CleanupStack::PopAndDestroy( &iFile );   
       
   159                 }
       
   160             else
       
   161                 {
       
   162                 iSession.RequestThumbnailL( iPath, iTargetUri, iParams.iThumbnailId, 
       
   163                                             iParamsPckg, iStatus );
       
   164                 }            
   146             break;
   165             break;
   147             }  
   166             }  
   148         case EReqSetThumbnailBuffer:
   167         case EReqSetThumbnailBuffer:
   149             {
   168             {
   150             iSession.RequestSetThumbnailL( iParams.iBuffer, iTargetUri, iParamsPckg, iStatus );
   169             iSession.RequestSetThumbnailL( iParams.iBuffer, iTargetUri, iParamsPckg, iStatus );
   210 // ---------------------------------------------------------------------------
   229 // ---------------------------------------------------------------------------
   211 //
   230 //
   212 void CThumbnailRequestActive::RunL()
   231 void CThumbnailRequestActive::RunL()
   213     {
   232     {
   214     TN_DEBUG2( "CThumbnailRequestActive::RunL() - request ID: %d", iParams.iRequestId );
   233     TN_DEBUG2( "CThumbnailRequestActive::RunL() - request ID: %d", iParams.iRequestId );
   215     
   234  
   216     if ( iParams.iControlFlags == EThumbnailPreviewThumbnail )
   235     if ( iParams.iControlFlags == EThumbnailPreviewThumbnail )
   217         {
   236         {
   218         iRequestCompleted = EFalse;
   237         iRequestCompleted = EFalse;
   219 		iProcessingPreview = ETrue;
   238 		iProcessingPreview = ETrue;
   220         }
   239         }
   448     ReleaseServerBitmap();
   467     ReleaseServerBitmap();
   449     }
   468     }
   450 
   469 
   451 
   470 
   452 // ---------------------------------------------------------------------------
   471 // ---------------------------------------------------------------------------
       
   472 // CThumbnailRequestActive::AsyncCancel()
       
   473 // ---------------------------------------------------------------------------
       
   474 //
       
   475 void CThumbnailRequestActive::AsyncCancel()
       
   476     {
       
   477     TN_DEBUG1( "CThumbnailRequestActive::AsyncCancel");
       
   478 
       
   479     __ASSERT_DEBUG(( iRequestId > 0 ), ThumbnailPanic( EThumbnailWrongId ));
       
   480     
       
   481     iCanceled = ETrue;
       
   482     iSession.CancelRequest( iRequestId );
       
   483     ReleaseServerBitmap();
       
   484 
       
   485     // AO stays active until request is complete or timeout is reached
       
   486     }
       
   487 
       
   488 
       
   489 // ---------------------------------------------------------------------------
   453 // CThumbnailRequestActive::ReleaseServerBitmap()
   490 // CThumbnailRequestActive::ReleaseServerBitmap()
   454 // Releases reserved bitmap.
   491 // Releases reserved bitmap.
   455 // ---------------------------------------------------------------------------
   492 // ---------------------------------------------------------------------------
   456 //
   493 //
   457 void CThumbnailRequestActive::ReleaseServerBitmap()
   494 void CThumbnailRequestActive::ReleaseServerBitmap()
   617     iParams.iPriority = aPriority;
   654     iParams.iPriority = aPriority;
   618     iParams.iFlags = aFlags;
   655     iParams.iFlags = aFlags;
   619     iParams.iQualityPreference = aQualityPreference;
   656     iParams.iQualityPreference = aQualityPreference;
   620     iParams.iThumbnailSize = aThumbnailSize;
   657     iParams.iThumbnailSize = aThumbnailSize;
   621     iParams.iThumbnailId = aThumbnailId;
   658     iParams.iThumbnailId = aThumbnailId;
       
   659     iParams.iFileName = aPath;
   622     
   660     
   623     iPath = aPath;
   661     iPath = aPath;
   624     iTargetUri = aTargetUri;
   662     iTargetUri = aTargetUri;
   625     }
   663     }
   626 
   664 
   843     
   881     
   844     CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny );
   882     CThumbnailRequestActive* self = static_cast<CThumbnailRequestActive*>( aAny );
   845     
   883     
   846     self->iTimer->Cancel();
   884     self->iTimer->Cancel();
   847     
   885     
   848     if (self->IsActive())
       
   849         {
       
   850         // hangs without this
       
   851         TRequestStatus* statusPtr = &self->iStatus;
       
   852         User::RequestComplete( statusPtr, KErrTimedOut );
       
   853         }
       
   854     
       
   855     self->Cancel();
   886     self->Cancel();
   856     
   887     
   857     if (self->iStartError != KErrNone)
   888     if (self->iStartError != KErrNone)
   858         {
   889         {
   859         self->iError = self->iStartError;
   890         self->iError = self->iStartError;