tstaskmonitor/utils/src/tsfswentry.cpp
changeset 103 b99b84bcd2d1
parent 83 156f692b1687
equal deleted inserted replaced
83:156f692b1687 103:b99b84bcd2d1
   317 
   317 
   318 // --------------------------------------------------------------------------
   318 // --------------------------------------------------------------------------
   319 // CTsFswEntry::SetScreenshot
   319 // CTsFswEntry::SetScreenshot
   320 // --------------------------------------------------------------------------
   320 // --------------------------------------------------------------------------
   321 //
   321 //
   322 TBool CTsFswEntry::SetScreenshotL(const CFbsBitmap* bitmapArg, UpdatePriority priority)
   322 void CTsFswEntry::SetScreenshotL(const CFbsBitmap* bitmapArg, UpdatePriority priority)
   323 {
   323 {
   324     TInt currentPriority = static_cast<TInt> (mPriority);
   324     TInt currentPriority = static_cast<TInt> (mPriority);
   325     TInt newPriority = static_cast<TInt> (priority);
   325     TInt newPriority = static_cast<TInt> (priority);
   326     if (newPriority >= currentPriority) {
   326     if(newPriority <currentPriority) {
   327         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
   327         User::Leave(KErrAccessDenied);
   328         CleanupStack::PushL(bitmap);
   328     }
   329         User::LeaveIfError(bitmap->Duplicate(bitmapArg->Handle()));
   329     
   330         CleanupStack::Pop(bitmap);
   330     CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
   331 
   331     CleanupStack::PushL(bitmap);
   332         mPriority = priority;
   332     User::LeaveIfError(bitmap->Duplicate(bitmapArg->Handle()));
   333         delete mScreenshot;
   333     CleanupStack::Pop(bitmap);
   334         mScreenshot = bitmap;
   334 
   335 
   335     mPriority = priority;
   336         delete mImgTool;
   336     delete mScreenshot;
   337         mImgTool = 0;
   337     mScreenshot = bitmap;
   338 
   338 
   339         mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
   339     delete mImgTool;
   340             CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
   340     mImgTool = 0;
   341         return ETrue;
   341 
   342     }
   342     mImgTool = CTsGraphicFileScalingHandler::NewL(*this, *mScreenshot, TSize(128, 128),
   343     return EFalse;
   343     CTsGraphicFileScalingHandler::EKeepAspectRatioByExpanding);
   344 }
   344 }
   345 
   345 
   346 // --------------------------------------------------------------------------
   346 // --------------------------------------------------------------------------
   347 // CTsFswEntry::RemoveScreenshot
   347 // CTsFswEntry::RemoveScreenshot
   348 // --------------------------------------------------------------------------
   348 // --------------------------------------------------------------------------
   349 //
   349 //
   350 TBool CTsFswEntry::RemoveScreenshot()
   350 void CTsFswEntry::RemoveScreenshotL()
   351 {
   351 {
   352     if (mScreenshot) {
   352     if (!mScreenshot) {
   353         delete mScreenshot;
   353         User::Leave(KErrNotFound);
   354         mScreenshot = NULL;
   354     }
   355         mPriority = Low;
   355     delete mScreenshot;
   356         return ETrue;
   356     mScreenshot = NULL;
   357     }
   357     mPriority = Low;
   358     return EFalse;
   358     if (mObserver) {
       
   359         mObserver->DataChanged();
       
   360     }
   359 }
   361 }
   360 
   362 
   361 // --------------------------------------------------------------------------
   363 // --------------------------------------------------------------------------
   362 // CTsFswEntry::Screenshot
   364 // CTsFswEntry::Screenshot
   363 // --------------------------------------------------------------------------
   365 // --------------------------------------------------------------------------