mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp
changeset 49 c20dd21d1eb4
parent 41 2c19c7cf5550
child 52 866b4af7ffbe
equal deleted inserted replaced
41:2c19c7cf5550 49:c20dd21d1eb4
    29 #include <mtp/cmtptypeopaquedata.h>
    29 #include <mtp/cmtptypeopaquedata.h>
    30 #include "cmtpimagedpthumbnailcreator.h"
    30 #include "cmtpimagedpthumbnailcreator.h"
    31 #include "mtpimagedpconst.h"
    31 #include "mtpimagedpconst.h"
    32 #include "mtpimagedputilits.h"
    32 #include "mtpimagedputilits.h"
    33 #include "cmtpimagedp.h"
    33 #include "cmtpimagedp.h"
    34 
    34 #include "mtpdebug.h"
    35 __FLOG_STMT(_LIT8(KComponent,"CMTPImageDpThumbnailCreator");)
    35 #include "OstTraceDefinitions.h"
       
    36 #ifdef OST_TRACE_COMPILER_IN_USE
       
    37 #include "cmtpimagedpthumbnailcreatorTraces.h"
       
    38 #endif
       
    39 
       
    40 
    36 // --------------------------------------------------------------------------
    41 // --------------------------------------------------------------------------
    37 // CMTPImageDpThumbnailCreator::NewL
    42 // CMTPImageDpThumbnailCreator::NewL
    38 // 2-phased constructor.
    43 // 2-phased constructor.
    39 // --------------------------------------------------------------------------
    44 // --------------------------------------------------------------------------
    40 //
    45 //
    52 // C++ destructor.
    57 // C++ destructor.
    53 // --------------------------------------------------------------------------
    58 // --------------------------------------------------------------------------
    54 //    
    59 //    
    55 CMTPImageDpThumbnailCreator::~CMTPImageDpThumbnailCreator()
    60 CMTPImageDpThumbnailCreator::~CMTPImageDpThumbnailCreator()
    56     {
    61     {
    57     __FLOG(_L8(">> ~CMTPImageDpThumbnailCreator"));
    62     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_CMTPIMAGEDPTHUMBNAILCREATOR_DES_ENTRY );
    58     Cancel();
    63     Cancel();
    59     if(EGetting == iState)
    64     if(EGetting == iState)
    60         {
    65         {
    61         iThumbMgr->CancelRequest(iCurrentReq);
    66         iThumbMgr->CancelRequest(iCurrentReq);
    62         }
    67         }
    72         {
    77         {
    73         *iCreationErr = KErrNotReady;
    78         *iCreationErr = KErrNotReady;
    74         iActiveSchedulerWait->AsyncStop();
    79         iActiveSchedulerWait->AsyncStop();
    75         }
    80         }
    76     delete iActiveSchedulerWait;
    81     delete iActiveSchedulerWait;
    77     __FLOG(_L8("<< ~CMTPImageDpThumbnailCreator"));
    82     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_CMTPIMAGEDPTHUMBNAILCREATOR_DES_EXIT );
    78     __FLOG_CLOSE;
       
    79     }
    83     }
    80  
    84  
    81 // --------------------------------------------------------------------------
    85 // --------------------------------------------------------------------------
    82 // CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator
    86 // CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator
    83 // C++ constructor.
    87 // C++ constructor.
    85 //    
    89 //    
    86 CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(CMTPImageDataProvider& aDataProvider): 
    90 CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(CMTPImageDataProvider& aDataProvider): 
    87     CActive(EPriorityStandard),
    91     CActive(EPriorityStandard),
    88     iDataProvider(aDataProvider)
    92     iDataProvider(aDataProvider)
    89     {
    93     {
    90     __FLOG_OPEN(KMTPSubsystem, KComponent);
    94     OstTraceFunctionEntry0( DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_CMTPIMAGEDPTHUMBNAILCREATOR_CONS_ENTRY );
    91     __FLOG(_L8("CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(), begin"));
       
    92     CActiveScheduler::Add(this);  
    95     CActiveScheduler::Add(this);  
    93     __FLOG(_L8("CMTPImageDpThumbnailCreator::CMTPImageDpThumbnailCreator(), end"));
    96     OstTraceFunctionExit0( DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_CMTPIMAGEDPTHUMBNAILCREATOR_CONS_EXIT );
    94     }
    97     }
    95 
    98 
    96 // --------------------------------------------------------------------------
    99 // --------------------------------------------------------------------------
    97 // CMTPImageDpThumbnailCreator::ConstructL
   100 // CMTPImageDpThumbnailCreator::ConstructL
    98 // 2nd phase constructor.
   101 // 2nd phase constructor.
    99 // --------------------------------------------------------------------------
   102 // --------------------------------------------------------------------------
   100 //
   103 //
   101 void CMTPImageDpThumbnailCreator::ConstructL()
   104 void CMTPImageDpThumbnailCreator::ConstructL()
   102     {
   105     {
   103     __FLOG(_L8("CMTPImageDpThumbnailCreator::ConstructL(), begin"));
   106     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_CONSTRUCTL_ENTRY );
   104     iThumbMgr = CThumbnailManager::NewL( *this ); 
   107     iThumbMgr = CThumbnailManager::NewL( *this ); 
   105     iThumbMgr->SetThumbnailSizeL( EGridThumbnailSize );
   108     iThumbMgr->SetThumbnailSizeL( EGridThumbnailSize );
   106 #ifdef MTPTHUMBSCALING
   109 #ifdef MTPTHUMBSCALING
   107     iScaler = CBitmapScaler::NewL();
   110     iScaler = CBitmapScaler::NewL();
   108 #endif    
   111 #endif    
   109     iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait();
   112     iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait();
   110     __FLOG(_L8("CMTPImageDpThumbnailCreator::ConstructL(), end"));
   113     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_CONSTRUCTL_EXIT );
   111     }
   114     }
   112 
   115 
   113 // --------------------------------------------------------------------------
   116 // --------------------------------------------------------------------------
   114 // CMTPImageDpThumbnailCreator::DoCancel
   117 // CMTPImageDpThumbnailCreator::DoCancel
   115 // From CActive.
   118 // From CActive.
   116 // --------------------------------------------------------------------------
   119 // --------------------------------------------------------------------------
   117 //
   120 //
   118 void CMTPImageDpThumbnailCreator::DoCancel()
   121 void CMTPImageDpThumbnailCreator::DoCancel()
   119     {
   122     {
   120     __FLOG_VA((_L8(">> CMTPImageDpThumbnailCreator::DoCancel() iState %d iStatus 0x%X"), iState, iStatus.Int()));
   123     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_DOCANCEL_ENTRY );
       
   124     OstTraceExt2( TRACE_NORMAL, CMTPIMAGEDPTHUMBNAILCREATOR_DOCANCEL, "iState %d iStatus 0x%X", iState, iStatus.Int() );
   121     switch(iState)
   125     switch(iState)
   122         {
   126         {
   123 #ifdef MTPTHUMBSCALING
   127 #ifdef MTPTHUMBSCALING
   124         case EScaling:
   128         case EScaling:
   125             iScaler->Cancel();
   129             iScaler->Cancel();
   135         {
   139         {
   136         *iCreationErr = KErrCancel;
   140         *iCreationErr = KErrCancel;
   137         iActiveSchedulerWait->AsyncStop();
   141         iActiveSchedulerWait->AsyncStop();
   138         }
   142         }
   139     // we will not continue creating thumbs.
   143     // we will not continue creating thumbs.
   140     __FLOG_VA((_L8("<< CMTPImageDpThumbnailCreator::DoCancel() iState %d"), iState));
   144     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_DOCANCEL_EXIT );
       
   145     OstTrace1( TRACE_NORMAL, DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_DOCANCEL, "iState %d", iState);
   141     }
   146     }
   142 
   147 
   143 // --------------------------------------------------------------------------
   148 // --------------------------------------------------------------------------
   144 // CMTPImageDpThumbnailCreator::RunL
   149 // CMTPImageDpThumbnailCreator::RunL
   145 // From CActive.
   150 // From CActive.
   146 // --------------------------------------------------------------------------
   151 // --------------------------------------------------------------------------
   147 //    
   152 //    
   148 void CMTPImageDpThumbnailCreator::RunL()
   153 void CMTPImageDpThumbnailCreator::RunL()
   149     {
   154     {
   150     __FLOG_VA((_L8(">> CMTPImageDpThumbnailCreator::RunL() iState %d iStatus %d"), iState, iStatus.Int()));
   155     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_RUNL_ENTRY );
   151     User::LeaveIfError(iStatus.Int());
   156     OstTraceExt2( TRACE_NORMAL, CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, "iState %d iStatus 0x%X", iState, iStatus.Int() );
       
   157 
       
   158     LEAVEIFERROR(iStatus.Int(),
       
   159             OstTrace1(TRACE_ERROR, DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, "iStatus %d is not correct!", iStatus.Int() ));
       
   160             
   152     switch (iState)
   161     switch (iState)
   153         { 
   162         { 
   154 #ifdef MTPTHUMBSCALING
   163 #ifdef MTPTHUMBSCALING
   155         case EGetted:
   164         case EGetted:
   156             {
   165             {
   168         case EEncoding:
   177         case EEncoding:
   169             {
   178             {
   170             iState=EIdle;
   179             iState=EIdle;
   171             if (iThumbMgr->Flags() == CThumbnailManager::EDoNotCreate)
   180             if (iThumbMgr->Flags() == CThumbnailManager::EDoNotCreate)
   172                 {
   181                 {
   173                 __FLOG_VA((_L8("CMTPImageDpThumbnailCreator::RunL(),EDoNotCreate; iState %d"), iState));
   182                 OstTrace1( TRACE_NORMAL, DUP2_CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, 
       
   183                         "CMTPImageDpThumbnailCreator::RunL(),EDoNotCreate; iState %d", iState );
       
   184                 
   174                 delete iData;
   185                 delete iData;
   175                 iData = HBufC8::NewL(1);
   186                 iData = HBufC8::NewL(1);
   176                 }
   187                 }
   177             
   188 
   178             __FLOG_VA((_L8("<< CMTPImageDpThumbnailCreator::RunL(),iBuffer->Write(*iData); iState %d"), iState));
   189             OstTrace1( TRACE_NORMAL, DUP3_CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, "iBuffer->Write(*iData); iState %d", iState );
   179             if(iActiveSchedulerWait->IsStarted())
   190             if(iActiveSchedulerWait->IsStarted())
   180                 {
   191                 {
   181                 iActiveSchedulerWait->AsyncStop();
   192                 iActiveSchedulerWait->AsyncStop();
   182                 }
   193                 }
   183             break;
   194             break;
   184             }
   195             }
   185         default:
   196         default:
   186             {
   197             {
       
   198             OstTrace1( TRACE_ERROR, DUP4_CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, "Invalid iState %d", iState );
   187             User::Leave(KErrGeneral);
   199             User::Leave(KErrGeneral);
   188             break;
   200             break;
   189             }
   201             }
   190         }
   202         }
   191     __FLOG_VA((_L8("<< CMTPImageDpThumbnailCreator::RunL() iState %d"), iState));
   203     OstTrace1( TRACE_NORMAL, DUP5_CMTPIMAGEDPTHUMBNAILCREATOR_RUNL, "iState %d", iState );
       
   204     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_RUNL_EXIT );
   192     }
   205     }
   193 
   206 
   194 // --------------------------------------------------------------------------
   207 // --------------------------------------------------------------------------
   195 // RunError
   208 // RunError
   196 // --------------------------------------------------------------------------
   209 // --------------------------------------------------------------------------
   197 //    
   210 //    
   198 TInt CMTPImageDpThumbnailCreator::RunError(TInt aErr)
   211 TInt CMTPImageDpThumbnailCreator::RunError(TInt aErr)
   199     {
   212     {
   200     __FLOG_VA((_L8(">> CMTPImageDpThumbnailCreator::RunError() err 0x%X"), aErr));
   213     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_RUNERROR_ENTRY );
       
   214     OstTraceDef1(OST_TRACE_CATEGORY_PRODUCTION, TRACE_IMPORTANT, CMTPIMAGEDPTHUMBNAILCREATOR_RUNERROR, "err 0x%X", aErr );
   201     iState=EIdle;
   215     iState=EIdle;
   202     if(iActiveSchedulerWait->IsStarted())
   216     if(iActiveSchedulerWait->IsStarted())
   203         {
   217         {
   204         *iCreationErr = aErr;
   218         *iCreationErr = aErr;
   205         iActiveSchedulerWait->AsyncStop();
   219         iActiveSchedulerWait->AsyncStop();
   206         }
   220         }
   207     // no need to cancel iScalerP since only leave is issued if scaler creation fails
   221     // no need to cancel iScalerP since only leave is issued if scaler creation fails
   208     __FLOG(_L8("<< CMTPImageDpThumbnailCreator::RunError()"));
   222     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_RUNERROR_EXIT );
   209     return KErrNone;
   223     return KErrNone;
   210     }
   224     }
   211 
   225 
   212 // --------------------------------------------------------------------------
   226 // --------------------------------------------------------------------------
   213 // 
   227 // 
   214 // --------------------------------------------------------------------------
   228 // --------------------------------------------------------------------------
   215 //
   229 //
   216 void CMTPImageDpThumbnailCreator::GetThumbnailL(const TDesC& aFileName, HBufC8*& aDestinationData,  TInt& result)
   230 void CMTPImageDpThumbnailCreator::GetThumbnailL(const TDesC& aFileName, HBufC8*& aDestinationData,  TInt& result)
   217     {
   231     {
   218     __FLOG(_L8(">> CMtpImageDphumbnailCreator::GetThumbnailL()"));
   232     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_GETTHUMBNAILL_ENTRY );
   219     GetThumbL(aFileName);
   233     GetThumbL(aFileName);
   220     iCreationErr = &result;     //reset the err flag
   234     iCreationErr = &result;     //reset the err flag
   221     *iCreationErr = KErrNone;
   235     *iCreationErr = KErrNone;
   222     __FLOG(_L8("<< CMTPImageDpThumbnailCreator::CreateThumbnailL()"));
       
   223     iActiveSchedulerWait->Start();
   236     iActiveSchedulerWait->Start();
   224     
   237     
   225     /**
   238     /**
   226      * transfer the ownership of iData if query successfully
   239      * transfer the ownership of iData if query successfully
   227      */
   240      */
   232         }
   245         }
   233     else
   246     else
   234         {
   247         {
   235         aDestinationData = NULL;
   248         aDestinationData = NULL;
   236         }
   249         }
       
   250     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_GETTHUMBNAILL_EXIT );
   237     }
   251     }
   238 
   252 
   239 // --------------------------------------------------------------------------
   253 // --------------------------------------------------------------------------
   240 // 
   254 // 
   241 // --------------------------------------------------------------------------
   255 // --------------------------------------------------------------------------
   252     iImgEnc = NULL;
   266     iImgEnc = NULL;
   253     }
   267     }
   254 
   268 
   255 void CMTPImageDpThumbnailCreator::GetThumbL(const TDesC& aFileName)
   269 void CMTPImageDpThumbnailCreator::GetThumbL(const TDesC& aFileName)
   256     {
   270     {
   257     __FLOG(_L8(">> CMtpImageDphumbnailCreator::GetThumbL()"));
   271     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_GETTHUMBL_ENTRY );
   258     // Create an object source representing a path to a file on local
   272     // Create an object source representing a path to a file on local
   259     // file system.
   273     // file system.
   260     delete iObjectSource;
   274     delete iObjectSource;
   261     iObjectSource = NULL;
   275     iObjectSource = NULL;
   262     
   276     
   263     TParsePtrC parse(aFileName);
   277     TParsePtrC parse(aFileName);
   264     if (parse.Ext().Length() >= 1)
   278     if (parse.Ext().Length() >= 1)
   265         {
   279         {
   266         const TDesC& mimeType = iDataProvider.FindMimeType(parse.Ext().Mid(1));
   280         const TDesC& mimeType = iDataProvider.FindMimeType(parse.Ext().Mid(1));
   267         __FLOG_VA((_L16("CMtpImageDphumbnailCreator::GetThumbL() - FileName:%S, MimeType:%S"), &aFileName, &mimeType));
   281         OstTraceExt2( TRACE_NORMAL, CMTPIMAGEDPTHUMBNAILCREATOR_GETTHUMBL, 
       
   282                 "CMtpImageDphumbnailCreator::GetThumbL() - FileName:%S, MimeType:%S", aFileName, mimeType );
   268     
   283     
   269         iObjectSource = CThumbnailObjectSource::NewL(aFileName, mimeType);
   284         iObjectSource = CThumbnailObjectSource::NewL(aFileName, mimeType);
   270         }
   285         }
   271     else
   286     else
   272         {
   287         {
   273         iObjectSource = CThumbnailObjectSource::NewL(aFileName, KNullDesC);
   288         iObjectSource = CThumbnailObjectSource::NewL(aFileName, KNullDesC);
   274         }
   289         }
   275     iCurrentReq = iThumbMgr->GetThumbnailL( *iObjectSource );
   290     iCurrentReq = iThumbMgr->GetThumbnailL( *iObjectSource );
   276     iState = EGetting;
   291     iState = EGetting;
   277     __FLOG(_L8("<< CMtpImageDphumbnailCreator::GetThumbL()"));
   292     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_GETTHUMBL_EXIT );
   278     }
   293     }
   279 
   294 
   280 #ifdef MTPTHUMBSCALING
   295 #ifdef MTPTHUMBSCALING
   281 // --------------------------------------------------------------------------
   296 // --------------------------------------------------------------------------
   282 // CMTPImageDpThumbnailCreator::ScaleBitmapL
   297 // CMTPImageDpThumbnailCreator::ScaleBitmapL
   283 // Scales the bitmap to the thumbnail size.
   298 // Scales the bitmap to the thumbnail size.
   284 // --------------------------------------------------------------------------
   299 // --------------------------------------------------------------------------
   285 //
   300 //
   286 void CMTPImageDpThumbnailCreator::ScaleBitmap()
   301 void CMTPImageDpThumbnailCreator::ScaleBitmap()
   287     {
   302     {
   288     __FLOG(_L8("CMTPImageDpThumbnailCreator::ScaleBitmapL(), begin"));
   303     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_SCALEBITMAP_ENTRY );
   289     TSize size( KThumbWidht, KThumbHeigth ); // size 160x120      
   304     TSize size( KThumbWidht, KThumbHeigth ); // size 160x120      
   290     // Resize image to thumbnail size 
   305     // Resize image to thumbnail size 
   291 //    iScaler->Scale( &iStatus, *iBitmap, size );
   306 //    iScaler->Scale( &iStatus, *iBitmap, size );
   292     
   307     
   293     /**
   308     /**
   297      */    
   312      */    
   298     TRequestStatus* status = &iStatus;
   313     TRequestStatus* status = &iStatus;
   299     User::RequestComplete( status, KErrNone );
   314     User::RequestComplete( status, KErrNone );
   300     
   315     
   301     SetActive();
   316     SetActive();
   302     __FLOG(_L8("CMTPImageDpThumbnailCreator::ScaleBitmapL(), end"));
   317     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_SCALEBITMAP_EXIT );
   303     }
   318     }
   304 #endif
   319 #endif
   305 
   320 
   306 // --------------------------------------------------------------------------
   321 // --------------------------------------------------------------------------
   307 // CMTPImageDpThumbnailCreator::EncodeImageL
   322 // CMTPImageDpThumbnailCreator::EncodeImageL
   308 // Encodes bitmap as a jpeg image.
   323 // Encodes bitmap as a jpeg image.
   309 // --------------------------------------------------------------------------
   324 // --------------------------------------------------------------------------
   310 //
   325 //
   311 void CMTPImageDpThumbnailCreator::EncodeImageL( )
   326 void CMTPImageDpThumbnailCreator::EncodeImageL( )
   312     {
   327     {
   313     __FLOG(_L8(">> CMTPImageDpThumbnailCreator::EncodeImageL()"));
   328     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_ENCODEIMAGEL_ENTRY );
   314 
   329 
   315     delete iData;
   330     delete iData;
   316     iData = NULL;
   331     iData = NULL;
   317     
   332     
   318     delete iImgEnc;
   333     delete iImgEnc;
   320     
   335     
   321     // Convert bitmap to jpg
   336     // Convert bitmap to jpg
   322     iImgEnc = CImageEncoder::DataNewL( iData, KPtpMimeJPEG, CImageEncoder::EPreferFastEncode );
   337     iImgEnc = CImageEncoder::DataNewL( iData, KPtpMimeJPEG, CImageEncoder::EPreferFastEncode );
   323     iImgEnc->Convert( &iStatus, *iBitmap );
   338     iImgEnc->Convert( &iStatus, *iBitmap );
   324     SetActive();
   339     SetActive();
   325     __FLOG(_L8("<< CMTPImageDpThumbnailCreator::EncodeImageL()"));
   340     OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_ENCODEIMAGEL_EXIT );
   326     }
   341     }
   327 
   342 
   328 //
   343 //
   329 //
   344 //
   330 void CMTPImageDpThumbnailCreator::ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId )
   345 void CMTPImageDpThumbnailCreator::ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId )
   331     {
   346     {
       
   347     OstTraceFunctionEntry0( CMTPIMAGEDPTHUMBNAILCREATOR_THUMBNAILREADY_ENTRY );
   332     // This function must not leave.
   348     // This function must not leave.
   333     __FLOG(_L8(">> CMTPImageDpThumbnailCreator::ThumbnailReady()"));
       
   334     if(iCurrentReq != aId)
   349     if(iCurrentReq != aId)
   335         {
   350         {
   336         __FLOG(_L8("CMTPImageDpThumbnailCreator::ThumbnailReady(),iCurrentReq != aId"));
   351         OstTrace0( TRACE_NORMAL, DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_THUMBNAILREADY, 
       
   352                 "CMTPImageDpThumbnailCreator::ThumbnailReady(),iCurrentReq != aId" );
       
   353         OstTraceFunctionExit0( CMTPIMAGEDPTHUMBNAILCREATOR_THUMBNAILREADY_EXIT );
   337         return;
   354         return;
   338         }
   355         }
   339     if (aError == KErrNone)
   356     if (aError == KErrNone)
   340         {
   357         {
   341         TRAP_IGNORE(iThumbMgr->SetFlagsL(CThumbnailManager::EDefaultFlags));
   358         TRAP_IGNORE(iThumbMgr->SetFlagsL(CThumbnailManager::EDefaultFlags));
   348         iState = EScaling;				//direct set to Scaling state jump the scaling function
   365         iState = EScaling;				//direct set to Scaling state jump the scaling function
   349 #endif
   366 #endif
   350         }
   367         }
   351     else if ((iThumbMgr->Flags() == CThumbnailManager::EDoNotCreate) && (aError == KErrNotFound))
   368     else if ((iThumbMgr->Flags() == CThumbnailManager::EDoNotCreate) && (aError == KErrNotFound))
   352         {
   369         {
   353         __FLOG(_L8("CMTPImageDpThumbnailCreator::ThumbnailReady(),EDoNotCreate, KErrNotFound"));
   370         OstTrace0( TRACE_NORMAL, CMTPIMAGEDPTHUMBNAILCREATOR_THUMBNAILREADY, 
       
   371                 "CMTPImageDpThumbnailCreator::ThumbnailReady(),EDoNotCreate, KErrNotFound" );
   354         iState = EEncoding;
   372         iState = EEncoding;
   355         //don't trigger TNM to create thumbnail if image files are too big
   373         //don't trigger TNM to create thumbnail if image files are too big
   356         //iThumbMgr->CreateThumbnails(*iObjectSource);
   374         //iThumbMgr->CreateThumbnails(*iObjectSource);
   357         aError = KErrNone;
   375         aError = KErrNone;
   358         }
   376         }
   359     iStatus=KRequestPending;
   377     iStatus=KRequestPending;
   360     TRequestStatus* status=&iStatus;
   378     TRequestStatus* status=&iStatus;
   361     User::RequestComplete(status, aError);
   379     User::RequestComplete(status, aError);
   362     SetActive();
   380     SetActive();
   363     __FLOG(_L8("<< CMTPImageDpThumbnailCreator::ThumbnailReady()"));
   381     OstTraceFunctionExit0( DUP1_CMTPIMAGEDPTHUMBNAILCREATOR_THUMBNAILREADY_EXIT );
   364     }
   382     }
   365 
   383 
   366 void CMTPImageDpThumbnailCreator::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ )
   384 void CMTPImageDpThumbnailCreator::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ )
   367     {
   385     {
   368     
   386